diff -u linux-kvm-5.19.0/Documentation/admin-guide/kernel-parameters.txt linux-kvm-5.19.0/Documentation/admin-guide/kernel-parameters.txt --- linux-kvm-5.19.0/Documentation/admin-guide/kernel-parameters.txt +++ linux-kvm-5.19.0/Documentation/admin-guide/kernel-parameters.txt @@ -6882,0 +6883,11 @@ + + amd_pstate= [X86] + disable + Do not enable amd_pstate as the default + scaling driver for the supported processors + passive + Use amd_pstate as a scaling driver, driver requests a + desired performance on this abstract scale and the power + management firmware translates the requests into actual + hardware states (core frequency, data fabric and memory + clocks etc.) diff -u linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts --- linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts +++ linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts @@ -250,21 +250,21 @@ /* SODIMM 96 */ MX8MM_IOMUXC_SAI1_RXD2_GPIO4_IO4 0x1c4 /* CPLD_D[7] */ - MX8MM_IOMUXC_SAI1_RXD3_GPIO4_IO5 0x1c4 + MX8MM_IOMUXC_SAI1_RXD3_GPIO4_IO5 0x184 /* CPLD_D[6] */ - MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x1c4 + MX8MM_IOMUXC_SAI1_RXFS_GPIO4_IO0 0x184 /* CPLD_D[5] */ - MX8MM_IOMUXC_SAI1_TXC_GPIO4_IO11 0x1c4 + MX8MM_IOMUXC_SAI1_TXC_GPIO4_IO11 0x184 /* CPLD_D[4] */ - MX8MM_IOMUXC_SAI1_TXD0_GPIO4_IO12 0x1c4 + MX8MM_IOMUXC_SAI1_TXD0_GPIO4_IO12 0x184 /* CPLD_D[3] */ - MX8MM_IOMUXC_SAI1_TXD1_GPIO4_IO13 0x1c4 + MX8MM_IOMUXC_SAI1_TXD1_GPIO4_IO13 0x184 /* CPLD_D[2] */ - MX8MM_IOMUXC_SAI1_TXD2_GPIO4_IO14 0x1c4 + MX8MM_IOMUXC_SAI1_TXD2_GPIO4_IO14 0x184 /* CPLD_D[1] */ - MX8MM_IOMUXC_SAI1_TXD3_GPIO4_IO15 0x1c4 + MX8MM_IOMUXC_SAI1_TXD3_GPIO4_IO15 0x184 /* CPLD_D[0] */ - MX8MM_IOMUXC_SAI1_TXD4_GPIO4_IO16 0x1c4 + MX8MM_IOMUXC_SAI1_TXD4_GPIO4_IO16 0x184 /* KBD_intK */ MX8MM_IOMUXC_SAI2_MCLK_GPIO4_IO27 0x1c4 /* DISP_reset */ diff -u linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi --- linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mn.dtsi @@ -662,7 +662,6 @@ pgc_otg1: power-domain@1 { #power-domain-cells = <0>; reg = ; - power-domains = <&pgc_hsiomix>; }; pgc_gpumix: power-domain@2 { @@ -1075,7 +1074,7 @@ assigned-clock-parents = <&clk IMX8MN_SYS_PLL2_500M>; phys = <&usbphynop1>; fsl,usbmisc = <&usbmisc1 0>; - power-domains = <&pgc_otg1>; + power-domains = <&pgc_hsiomix>; status = "disabled"; }; @@ -1175,4 +1174,5 @@ assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_100M>; clock-names = "main_clk"; + power-domains = <&pgc_otg1>; }; }; diff -u linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi --- linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi @@ -331,16 +331,6 @@ "SODIMM_82", "SODIMM_70", "SODIMM_72"; - - ctrl-sleep-moci-hog { - gpio-hog; - /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */ - gpios = <29 GPIO_ACTIVE_HIGH>; - line-name = "CTRL_SLEEP_MOCI#"; - output-high; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ctrl_sleep_moci>; - }; }; &gpio3 { @@ -409,6 +399,16 @@ "SODIMM_256", "SODIMM_48", "SODIMM_44"; + + ctrl-sleep-moci-hog { + gpio-hog; + /* Verdin CTRL_SLEEP_MOCI# (SODIMM 256) */ + gpios = <29 GPIO_ACTIVE_HIGH>; + line-name = "CTRL_SLEEP_MOCI#"; + output-high; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ctrl_sleep_moci>; + }; }; /* On-module I2C */ diff -u linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/ipq8074.dtsi linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/ipq8074.dtsi @@ -195,7 +195,7 @@ pcie_qmp0: phy@86000 { compatible = "qcom,ipq8074-qmp-pcie-phy"; - reg = <0x00086000 0x1000>; + reg = <0x00086000 0x1c4>; #address-cells = <1>; #size-cells = <1>; ranges; @@ -223,7 +223,7 @@ pcie_qmp1: phy@8e000 { compatible = "qcom,ipq8074-qmp-pcie-phy"; - reg = <0x0008e000 0x1000>; + reg = <0x0008e000 0x1c4>; #address-cells = <1>; #size-cells = <1>; ranges; diff -u linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sc7280.dtsi linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sc7280.dtsi --- linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2168,9 +2168,8 @@ lpasscc: lpasscc@3000000 { compatible = "qcom,sc7280-lpasscc"; reg = <0 0x03000000 0 0x40>, - <0 0x03c04000 0 0x4>, - <0 0x03389000 0 0x24>; - reg-names = "qdsp6ss", "top_cc", "cc"; + <0 0x03c04000 0 0x4>; + reg-names = "qdsp6ss", "top_cc"; clocks = <&gcc GCC_CFG_NOC_LPASS_CLK>; clock-names = "iface"; #clock-cells = <1>; @@ -2192,13 +2191,13 @@ reg = <0 0x03380000 0 0x30000>; clocks = <&rpmhcc RPMH_CXO_CLK>, <&rpmhcc RPMH_CXO_CLK_A>, - <&lpasscore LPASS_CORE_CC_CORE_CLK>; + <&lpass_core LPASS_CORE_CC_CORE_CLK>; clock-names = "bi_tcxo", "bi_tcxo_ao", "iface"; #clock-cells = <1>; #power-domain-cells = <1>; }; - lpasscore: clock-controller@3900000 { + lpass_core: clock-controller@3900000 { compatible = "qcom,sc7280-lpasscorecc"; reg = <0 0x03900000 0 0x50000>; clocks = <&rpmhcc RPMH_CXO_CLK>; diff -u linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sm8450.dtsi linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sm8450.dtsi --- linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sm8450.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sm8450.dtsi @@ -3082,7 +3082,7 @@ ufs_mem_phy: phy@1d87000 { compatible = "qcom,sm8450-qmp-ufs-phy"; - reg = <0 0x01d87000 0 0xe10>; + reg = <0 0x01d87000 0 0x1c4>; #address-cells = <2>; #size-cells = <2>; ranges; diff -u linux-kvm-5.19.0/arch/arm64/kernel/mte.c linux-kvm-5.19.0/arch/arm64/kernel/mte.c --- linux-kvm-5.19.0/arch/arm64/kernel/mte.c +++ linux-kvm-5.19.0/arch/arm64/kernel/mte.c @@ -57,7 +57,12 @@ * the new page->flags are visible before the tags were updated. */ smp_wmb(); - mte_clear_page_tags(page_address(page)); + /* + * Test PG_mte_tagged again in case it was racing with another + * set_pte_at(). + */ + if (!test_and_set_bit(PG_mte_tagged, &page->flags)) + mte_clear_page_tags(page_address(page)); } void mte_sync_tags(pte_t old_pte, pte_t pte) @@ -73,7 +78,7 @@ /* if PG_mte_tagged is set, tags have already been initialised */ for (i = 0; i < nr_pages; i++, page++) { - if (!test_and_set_bit(PG_mte_tagged, &page->flags)) + if (!test_bit(PG_mte_tagged, &page->flags)) mte_sync_page_tags(page, old_pte, check_swap, pte_is_tagged); } diff -u linux-kvm-5.19.0/arch/arm64/kvm/hyp/nvhe/switch.c linux-kvm-5.19.0/arch/arm64/kvm/hyp/nvhe/switch.c --- linux-kvm-5.19.0/arch/arm64/kvm/hyp/nvhe/switch.c +++ linux-kvm-5.19.0/arch/arm64/kvm/hyp/nvhe/switch.c @@ -53,18 +53,6 @@ write_sysreg(val, cptr_el2); write_sysreg(__this_cpu_read(kvm_hyp_vector), vbar_el2); - if (cpus_have_final_cap(ARM64_SME)) { - val = read_sysreg_s(SYS_HFGRTR_EL2); - val &= ~(HFGxTR_EL2_nTPIDR2_EL0_MASK | - HFGxTR_EL2_nSMPRI_EL1_MASK); - write_sysreg_s(val, SYS_HFGRTR_EL2); - - val = read_sysreg_s(SYS_HFGWTR_EL2); - val &= ~(HFGxTR_EL2_nTPIDR2_EL0_MASK | - HFGxTR_EL2_nSMPRI_EL1_MASK); - write_sysreg_s(val, SYS_HFGWTR_EL2); - } - if (cpus_have_final_cap(ARM64_WORKAROUND_SPECULATIVE_AT)) { struct kvm_cpu_context *ctxt = &vcpu->arch.ctxt; @@ -108,20 +96,6 @@ write_sysreg(this_cpu_ptr(&kvm_init_params)->hcr_el2, hcr_el2); - if (cpus_have_final_cap(ARM64_SME)) { - u64 val; - - val = read_sysreg_s(SYS_HFGRTR_EL2); - val |= HFGxTR_EL2_nTPIDR2_EL0_MASK | - HFGxTR_EL2_nSMPRI_EL1_MASK; - write_sysreg_s(val, SYS_HFGRTR_EL2); - - val = read_sysreg_s(SYS_HFGWTR_EL2); - val |= HFGxTR_EL2_nTPIDR2_EL0_MASK | - HFGxTR_EL2_nSMPRI_EL1_MASK; - write_sysreg_s(val, SYS_HFGWTR_EL2); - } - cptr = CPTR_EL2_DEFAULT; if (vcpu_has_sve(vcpu) && (vcpu->arch.flags & KVM_ARM64_FP_ENABLED)) cptr |= CPTR_EL2_TZ; diff -u linux-kvm-5.19.0/arch/arm64/kvm/hyp/vhe/switch.c linux-kvm-5.19.0/arch/arm64/kvm/hyp/vhe/switch.c --- linux-kvm-5.19.0/arch/arm64/kvm/hyp/vhe/switch.c +++ linux-kvm-5.19.0/arch/arm64/kvm/hyp/vhe/switch.c @@ -63,10 +63,6 @@ __activate_traps_fpsimd32(vcpu); } - if (cpus_have_final_cap(ARM64_SME)) - write_sysreg(read_sysreg(sctlr_el2) & ~SCTLR_ELx_ENTP2, - sctlr_el2); - write_sysreg(val, cpacr_el1); write_sysreg(__this_cpu_read(kvm_hyp_vector), vbar_el1); @@ -88,10 +84,6 @@ */ asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT)); - if (cpus_have_final_cap(ARM64_SME)) - write_sysreg(read_sysreg(sctlr_el2) | SCTLR_ELx_ENTP2, - sctlr_el2); - write_sysreg(CPACR_EL1_DEFAULT, cpacr_el1); if (!arm64_kernel_unmapped_at_el0()) diff -u linux-kvm-5.19.0/arch/parisc/kernel/drivers.c linux-kvm-5.19.0/arch/parisc/kernel/drivers.c --- linux-kvm-5.19.0/arch/parisc/kernel/drivers.c +++ linux-kvm-5.19.0/arch/parisc/kernel/drivers.c @@ -882,15 +882,13 @@ &root); } -static void print_parisc_device(struct parisc_device *dev) +static __init void print_parisc_device(struct parisc_device *dev) { - char hw_path[64]; - static int count; + static int count __initdata; - print_pa_hwpath(dev, hw_path); - pr_info("%d. %s at %pap [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }", - ++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type, - dev->id.hversion_rev, dev->id.hversion, dev->id.sversion); + pr_info("%d. %s at %pap { type:%d, hv:%#x, sv:%#x, rev:%#x }", + ++count, dev->name, &(dev->hpa.start), dev->id.hw_type, + dev->id.hversion, dev->id.sversion, dev->id.hversion_rev); if (dev->num_addrs) { int k; @@ -1079,7 +1077,7 @@ -static int print_one_device(struct device * dev, void * data) +static __init int print_one_device(struct device * dev, void * data) { struct parisc_device * pdev = to_parisc_device(dev); diff -u linux-kvm-5.19.0/arch/powerpc/kernel/interrupt_64.S linux-kvm-5.19.0/arch/powerpc/kernel/interrupt_64.S --- linux-kvm-5.19.0/arch/powerpc/kernel/interrupt_64.S +++ linux-kvm-5.19.0/arch/powerpc/kernel/interrupt_64.S @@ -565,15 +565,24 @@ * Returning to soft-disabled context. * Check if a MUST_HARD_MASK interrupt has become pending, in which * case we need to disable MSR[EE] in the return context. + * + * The MSR[EE] check catches among other things the short incoherency + * in hard_irq_disable() between clearing MSR[EE] and setting + * PACA_IRQ_HARD_DIS. */ ld r12,_MSR(r1) andi. r10,r12,MSR_EE beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled lbz r11,PACAIRQHAPPENED(r13) andi. r10,r11,PACA_IRQ_MUST_HARD_MASK - beq .Lfast_kernel_interrupt_return_\srr\() // No HARD_MASK pending + bne 1f // HARD_MASK is pending + // No HARD_MASK pending, clear possible HARD_DIS set by interrupt + andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l + stb r11,PACAIRQHAPPENED(r13) + b .Lfast_kernel_interrupt_return_\srr\() - /* Must clear MSR_EE from _MSR */ + +1: /* Must clear MSR_EE from _MSR */ #ifdef CONFIG_PPC_BOOK3S li r10,0 /* Clear valid before changing _MSR */ diff -u linux-kvm-5.19.0/arch/x86/Kconfig linux-kvm-5.19.0/arch/x86/Kconfig --- linux-kvm-5.19.0/arch/x86/Kconfig +++ linux-kvm-5.19.0/arch/x86/Kconfig @@ -1972,7 +1972,6 @@ config EFI_STUB bool "EFI stub support" depends on EFI - depends on $(cc-option,-mabi=ms) || X86_32 select RELOCATABLE help This kernel feature allows a bzImage to be loaded directly diff -u linux-kvm-5.19.0/arch/x86/coco/tdx/tdx.c linux-kvm-5.19.0/arch/x86/coco/tdx/tdx.c --- linux-kvm-5.19.0/arch/x86/coco/tdx/tdx.c +++ linux-kvm-5.19.0/arch/x86/coco/tdx/tdx.c @@ -43,6 +43,8 @@ static struct miscdevice tdx_misc_dev; +#define ATTR_SEPT_VE_DISABLE BIT(28) + /* * Wrapper for standard use of __tdx_hypercall with no output aside from * return code. @@ -107,10 +109,11 @@ panic("TDCALL %lld failed (Buggy TDX module!)\n", fn); } -static u64 get_cc_mask(void) +static void tdx_parse_tdinfo(u64 *cc_mask) { struct tdx_module_output out; unsigned int gpa_width; + u64 td_attr; /* * TDINFO TDX module call is used to get the TD execution environment @@ -118,19 +121,27 @@ * information, etc. More details about the ABI can be found in TDX * Guest-Host-Communication Interface (GHCI), section 2.4.2 TDCALL * [TDG.VP.INFO]. + */ + tdx_module_call(TDX_GET_INFO, 0, 0, 0, 0, &out); + + /* + * The highest bit of a guest physical address is the "sharing" bit. + * Set it for shared pages and clear it for private pages. * * The GPA width that comes out of this call is critical. TDX guests * can not meaningfully run without it. */ - tdx_module_call(TDX_GET_INFO, 0, 0, 0, 0, &out); - gpa_width = out.rcx & GENMASK(5, 0); + *cc_mask = BIT_ULL(gpa_width - 1); /* - * The highest bit of a guest physical address is the "sharing" bit. - * Set it for shared pages and clear it for private pages. + * The kernel can not handle #VE's when accessing normal kernel + * memory. Ensure that no #VE will be delivered for accesses to + * TD-private memory. Only VMM-shared memory (MMIO) will #VE. */ - return BIT_ULL(gpa_width - 1); + td_attr = out.rdx; + if (!(td_attr & ATTR_SEPT_VE_DISABLE)) + panic("TD misconfiguration: SEPT_VE_DISABLE attibute must be set.\n"); } /* @@ -767,7 +778,7 @@ setup_force_cpu_cap(X86_FEATURE_TDX_GUEST); cc_set_vendor(CC_VENDOR_INTEL); - cc_mask = get_cc_mask(); + tdx_parse_tdinfo(&cc_mask); cc_set_mask(cc_mask); /* diff -u linux-kvm-5.19.0/arch/x86/events/intel/core.c linux-kvm-5.19.0/arch/x86/events/intel/core.c --- linux-kvm-5.19.0/arch/x86/events/intel/core.c +++ linux-kvm-5.19.0/arch/x86/events/intel/core.c @@ -4792,6 +4792,7 @@ INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 5, 0x00000000), INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 6, 0x00000000), INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 7, 0x00000000), + INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_X, 11, 0x00000000), INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE_L, 3, 0x0000007c), INTEL_CPU_DESC(INTEL_FAM6_SKYLAKE, 3, 0x0000007c), INTEL_CPU_DESC(INTEL_FAM6_KABYLAKE, 9, 0x0000004e), diff -u linux-kvm-5.19.0/arch/x86/events/intel/ds.c linux-kvm-5.19.0/arch/x86/events/intel/ds.c --- linux-kvm-5.19.0/arch/x86/events/intel/ds.c +++ linux-kvm-5.19.0/arch/x86/events/intel/ds.c @@ -982,8 +982,13 @@ INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x800000000ULL), /* SLOTS */ INTEL_PLD_CONSTRAINT(0x1cd, 0xff), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ - INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x1d0, 0xf), /* MEM_INST_RETIRED.LOAD */ - INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x2d0, 0xf), /* MEM_INST_RETIRED.STORE */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_INST_RETIRED.LOCK_LOADS */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x41d0, 0xf), /* MEM_INST_RETIRED.SPLIT_LOADS */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */ INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf), /* MEM_LOAD_*_RETIRED.* */ @@ -1004,8 +1009,13 @@ INTEL_FLAGS_EVENT_CONSTRAINT(0xc0, 0xfe), INTEL_PLD_CONSTRAINT(0x1cd, 0xfe), INTEL_PSD_CONSTRAINT(0x2cd, 0x1), - INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x1d0, 0xf), - INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x2d0, 0xf), + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_INST_RETIRED.LOCK_LOADS */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x41d0, 0xf), /* MEM_INST_RETIRED.SPLIT_LOADS */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */ + INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */ INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf), diff -u linux-kvm-5.19.0/arch/x86/events/intel/lbr.c linux-kvm-5.19.0/arch/x86/events/intel/lbr.c --- linux-kvm-5.19.0/arch/x86/events/intel/lbr.c +++ linux-kvm-5.19.0/arch/x86/events/intel/lbr.c @@ -1869,7 +1869,7 @@ return; clear_arch_lbr: - clear_cpu_cap(&boot_cpu_data, X86_FEATURE_ARCH_LBR); + setup_clear_cpu_cap(X86_FEATURE_ARCH_LBR); } /** diff -u linux-kvm-5.19.0/arch/x86/kernel/cpu/microcode/amd.c linux-kvm-5.19.0/arch/x86/kernel/cpu/microcode/amd.c --- linux-kvm-5.19.0/arch/x86/kernel/cpu/microcode/amd.c +++ linux-kvm-5.19.0/arch/x86/kernel/cpu/microcode/amd.c @@ -440,7 +440,13 @@ return ret; native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy); - if (rev >= mc->hdr.patch_id) + + /* + * Allow application of the same revision to pick up SMT-specific + * changes even if the revision of the other SMT thread is already + * up-to-date. + */ + if (rev > mc->hdr.patch_id) return ret; if (!__apply_microcode_amd(mc)) { @@ -528,8 +534,12 @@ native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy); - /* Check whether we have saved a new patch already: */ - if (*new_rev && rev < mc->hdr.patch_id) { + /* + * Check whether a new patch has been saved already. Also, allow application of + * the same revision in order to pick up SMT-thread-specific configuration even + * if the sibling SMT thread already has an up-to-date revision. + */ + if (*new_rev && rev <= mc->hdr.patch_id) { if (!__apply_microcode_amd(mc)) { *new_rev = mc->hdr.patch_id; return; diff -u linux-kvm-5.19.0/arch/x86/kernel/unwind_orc.c linux-kvm-5.19.0/arch/x86/kernel/unwind_orc.c --- linux-kvm-5.19.0/arch/x86/kernel/unwind_orc.c +++ linux-kvm-5.19.0/arch/x86/kernel/unwind_orc.c @@ -713,7 +713,7 @@ /* Otherwise, skip ahead to the user-specified starting frame: */ while (!unwind_done(state) && (!on_stack(&state->stack_info, first_frame, sizeof(long)) || - state->sp < (unsigned long)first_frame)) + state->sp <= (unsigned long)first_frame)) unwind_next_frame(state); return; diff -u linux-kvm-5.19.0/arch/x86/kvm/cpuid.c linux-kvm-5.19.0/arch/x86/kvm/cpuid.c --- linux-kvm-5.19.0/arch/x86/kvm/cpuid.c +++ linux-kvm-5.19.0/arch/x86/kvm/cpuid.c @@ -1096,11 +1096,13 @@ entry->eax = max(entry->eax, 0x80000021); break; case 0x80000001: + entry->ebx &= ~GENMASK(27, 16); cpuid_entry_override(entry, CPUID_8000_0001_EDX); cpuid_entry_override(entry, CPUID_8000_0001_ECX); break; case 0x80000006: - /* L2 cache and TLB: pass through host info. */ + /* Drop reserved bits, pass host L2 cache and TLB info. */ + entry->edx &= ~GENMASK(17, 16); break; case 0x80000007: /* Advanced power management */ /* invariant TSC is CPUID.80000007H:EDX[8] */ @@ -1130,6 +1132,7 @@ g_phys_as = phys_as; entry->eax = g_phys_as | (virt_as << 8); + entry->ecx &= ~(GENMASK(31, 16) | GENMASK(11, 8)); entry->edx = 0; cpuid_entry_override(entry, CPUID_8000_0008_EBX); break; @@ -1149,6 +1152,9 @@ entry->ecx = entry->edx = 0; break; case 0x8000001a: + entry->eax &= GENMASK(2, 0); + entry->ebx = entry->ecx = entry->edx = 0; + break; case 0x8000001e: break; case 0x8000001F: @@ -1156,7 +1162,8 @@ entry->eax = entry->ebx = entry->ecx = entry->edx = 0; } else { cpuid_entry_override(entry, CPUID_8000_001F_EAX); - + /* Clear NumVMPL since KVM does not support VMPL. */ + entry->ebx &= ~GENMASK(31, 12); /* * Enumerate '0' for "PA bits reduction", the adjusted * MAXPHYADDR is enumerated directly (see 0x80000008). diff -u linux-kvm-5.19.0/arch/x86/kvm/emulate.c linux-kvm-5.19.0/arch/x86/kvm/emulate.c --- linux-kvm-5.19.0/arch/x86/kvm/emulate.c +++ linux-kvm-5.19.0/arch/x86/kvm/emulate.c @@ -794,8 +794,7 @@ ctxt->mode, linear); } -static inline int assign_eip(struct x86_emulate_ctxt *ctxt, ulong dst, - enum x86emul_mode mode) +static inline int assign_eip(struct x86_emulate_ctxt *ctxt, ulong dst) { ulong linear; int rc; @@ -805,41 +804,71 @@ if (ctxt->op_bytes != sizeof(unsigned long)) addr.ea = dst & ((1UL << (ctxt->op_bytes << 3)) - 1); - rc = __linearize(ctxt, addr, &max_size, 1, false, true, mode, &linear); + rc = __linearize(ctxt, addr, &max_size, 1, false, true, ctxt->mode, &linear); if (rc == X86EMUL_CONTINUE) ctxt->_eip = addr.ea; return rc; } +static inline int emulator_recalc_and_set_mode(struct x86_emulate_ctxt *ctxt) +{ + u64 efer; + struct desc_struct cs; + u16 selector; + u32 base3; + + ctxt->ops->get_msr(ctxt, MSR_EFER, &efer); + + if (!(ctxt->ops->get_cr(ctxt, 0) & X86_CR0_PE)) { + /* Real mode. cpu must not have long mode active */ + if (efer & EFER_LMA) + return X86EMUL_UNHANDLEABLE; + ctxt->mode = X86EMUL_MODE_REAL; + return X86EMUL_CONTINUE; + } + + if (ctxt->eflags & X86_EFLAGS_VM) { + /* Protected/VM86 mode. cpu must not have long mode active */ + if (efer & EFER_LMA) + return X86EMUL_UNHANDLEABLE; + ctxt->mode = X86EMUL_MODE_VM86; + return X86EMUL_CONTINUE; + } + + if (!ctxt->ops->get_segment(ctxt, &selector, &cs, &base3, VCPU_SREG_CS)) + return X86EMUL_UNHANDLEABLE; + + if (efer & EFER_LMA) { + if (cs.l) { + /* Proper long mode */ + ctxt->mode = X86EMUL_MODE_PROT64; + } else if (cs.d) { + /* 32 bit compatibility mode*/ + ctxt->mode = X86EMUL_MODE_PROT32; + } else { + ctxt->mode = X86EMUL_MODE_PROT16; + } + } else { + /* Legacy 32 bit / 16 bit mode */ + ctxt->mode = cs.d ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16; + } + + return X86EMUL_CONTINUE; +} + static inline int assign_eip_near(struct x86_emulate_ctxt *ctxt, ulong dst) { - return assign_eip(ctxt, dst, ctxt->mode); + return assign_eip(ctxt, dst); } -static int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst, - const struct desc_struct *cs_desc) +static int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst) { - enum x86emul_mode mode = ctxt->mode; - int rc; + int rc = emulator_recalc_and_set_mode(ctxt); -#ifdef CONFIG_X86_64 - if (ctxt->mode >= X86EMUL_MODE_PROT16) { - if (cs_desc->l) { - u64 efer = 0; - - ctxt->ops->get_msr(ctxt, MSR_EFER, &efer); - if (efer & EFER_LMA) - mode = X86EMUL_MODE_PROT64; - } else - mode = X86EMUL_MODE_PROT32; /* temporary value */ - } -#endif - if (mode == X86EMUL_MODE_PROT16 || mode == X86EMUL_MODE_PROT32) - mode = cs_desc->d ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16; - rc = assign_eip(ctxt, dst, mode); - if (rc == X86EMUL_CONTINUE) - ctxt->mode = mode; - return rc; + if (rc != X86EMUL_CONTINUE) + return rc; + + return assign_eip(ctxt, dst); } static inline int jmp_rel(struct x86_emulate_ctxt *ctxt, int rel) @@ -2172,7 +2201,7 @@ if (rc != X86EMUL_CONTINUE) return rc; - rc = assign_eip_far(ctxt, ctxt->src.val, &new_desc); + rc = assign_eip_far(ctxt, ctxt->src.val); /* Error handling is not implemented. */ if (rc != X86EMUL_CONTINUE) return X86EMUL_UNHANDLEABLE; @@ -2250,7 +2279,7 @@ &new_desc); if (rc != X86EMUL_CONTINUE) return rc; - rc = assign_eip_far(ctxt, eip, &new_desc); + rc = assign_eip_far(ctxt, eip); /* Error handling is not implemented. */ if (rc != X86EMUL_CONTINUE) return X86EMUL_UNHANDLEABLE; @@ -2633,7 +2662,7 @@ * those side effects need to be explicitly handled for both success * and shutdown. */ - return X86EMUL_CONTINUE; + return emulator_recalc_and_set_mode(ctxt); emulate_shutdown: ctxt->ops->triple_fault(ctxt); @@ -2876,6 +2905,7 @@ ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); ctxt->_eip = rdx; + ctxt->mode = usermode; *reg_write(ctxt, VCPU_REGS_RSP) = rcx; return X86EMUL_CONTINUE; @@ -3469,7 +3499,7 @@ if (rc != X86EMUL_CONTINUE) return rc; - rc = assign_eip_far(ctxt, ctxt->src.val, &new_desc); + rc = assign_eip_far(ctxt, ctxt->src.val); if (rc != X86EMUL_CONTINUE) goto fail; @@ -3611,11 +3641,25 @@ static int em_cr_write(struct x86_emulate_ctxt *ctxt) { - if (ctxt->ops->set_cr(ctxt, ctxt->modrm_reg, ctxt->src.val)) + int cr_num = ctxt->modrm_reg; + int r; + + if (ctxt->ops->set_cr(ctxt, cr_num, ctxt->src.val)) return emulate_gp(ctxt, 0); /* Disable writeback. */ ctxt->dst.type = OP_NONE; + + if (cr_num == 0) { + /* + * CR0 write might have updated CR0.PE and/or CR0.PG + * which can affect the cpu's execution mode. + */ + r = emulator_recalc_and_set_mode(ctxt); + if (r != X86EMUL_CONTINUE) + return r; + } + return X86EMUL_CONTINUE; } diff -u linux-kvm-5.19.0/arch/x86/kvm/vmx/vmx.c linux-kvm-5.19.0/arch/x86/kvm/vmx/vmx.c --- linux-kvm-5.19.0/arch/x86/kvm/vmx/vmx.c +++ linux-kvm-5.19.0/arch/x86/kvm/vmx/vmx.c @@ -2008,15 +2008,17 @@ return (unsigned long)data; } -static u64 vcpu_supported_debugctl(struct kvm_vcpu *vcpu) +static u64 vmx_get_supported_debugctl(struct kvm_vcpu *vcpu, bool host_initiated) { - u64 debugctl = vmx_supported_debugctl(); + u64 debugctl = 0; - if (!intel_pmu_lbr_is_enabled(vcpu)) - debugctl &= ~DEBUGCTLMSR_LBR_MASK; + if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT) && + (host_initiated || guest_cpuid_has(vcpu, X86_FEATURE_BUS_LOCK_DETECT))) + debugctl |= DEBUGCTLMSR_BUS_LOCK_DETECT; - if (!guest_cpuid_has(vcpu, X86_FEATURE_BUS_LOCK_DETECT)) - debugctl &= ~DEBUGCTLMSR_BUS_LOCK_DETECT; + if ((vmx_get_perf_capabilities() & PMU_CAP_LBR_FMT) && + (host_initiated || intel_pmu_lbr_is_enabled(vcpu))) + debugctl |= DEBUGCTLMSR_LBR | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI; return debugctl; } @@ -2090,7 +2092,9 @@ vmcs_writel(GUEST_SYSENTER_ESP, data); break; case MSR_IA32_DEBUGCTLMSR: { - u64 invalid = data & ~vcpu_supported_debugctl(vcpu); + u64 invalid; + + invalid = data & ~vmx_get_supported_debugctl(vcpu, msr_info->host_initiated); if (invalid & (DEBUGCTLMSR_BTF|DEBUGCTLMSR_LBR)) { if (report_ignored_msrs) vcpu_unimpl(vcpu, "%s: BTF|LBR in IA32_DEBUGCTLMSR 0x%llx, nop\n", @@ -8067,6 +8071,11 @@ if (!cpu_has_virtual_nmis()) enable_vnmi = 0; +#ifdef CONFIG_X86_SGX_KVM + if (!cpu_has_vmx_encls_vmexit()) + enable_sgx = false; +#endif + /* * set_apic_access_page_addr() is used to reload apic access * page upon invalidation. No need to do anything if not diff -u linux-kvm-5.19.0/arch/x86/kvm/x86.c linux-kvm-5.19.0/arch/x86/kvm/x86.c --- linux-kvm-5.19.0/arch/x86/kvm/x86.c +++ linux-kvm-5.19.0/arch/x86/kvm/x86.c @@ -542,6 +542,7 @@ #define EXCPT_TRAP 1 #define EXCPT_ABORT 2 #define EXCPT_INTERRUPT 3 +#define EXCPT_DB 4 static int exception_type(int vector) { @@ -552,8 +553,14 @@ mask = 1 << vector; - /* #DB is trap, as instruction watchpoints are handled elsewhere */ - if (mask & ((1 << DB_VECTOR) | (1 << BP_VECTOR) | (1 << OF_VECTOR))) + /* + * #DBs can be trap-like or fault-like, the caller must check other CPU + * state, e.g. DR6, to determine whether a #DB is a trap or fault. + */ + if (mask & (1 << DB_VECTOR)) + return EXCPT_DB; + + if (mask & ((1 << BP_VECTOR) | (1 << OF_VECTOR))) return EXCPT_TRAP; if (mask & ((1 << DF_VECTOR) | (1 << MC_VECTOR))) @@ -2302,11 +2309,11 @@ /* we verify if the enable bit is set... */ if (system_time & 1) { - kvm_gfn_to_pfn_cache_init(vcpu->kvm, &vcpu->arch.pv_time, vcpu, - KVM_HOST_USES_PFN, system_time & ~1ULL, - sizeof(struct pvclock_vcpu_time_info)); + kvm_gpc_activate(vcpu->kvm, &vcpu->arch.pv_time, vcpu, + KVM_HOST_USES_PFN, system_time & ~1ULL, + sizeof(struct pvclock_vcpu_time_info)); } else { - kvm_gfn_to_pfn_cache_destroy(vcpu->kvm, &vcpu->arch.pv_time); + kvm_gpc_deactivate(vcpu->kvm, &vcpu->arch.pv_time); } return; @@ -3346,7 +3353,7 @@ static void kvmclock_reset(struct kvm_vcpu *vcpu) { - kvm_gfn_to_pfn_cache_destroy(vcpu->kvm, &vcpu->arch.pv_time); + kvm_gpc_deactivate(vcpu->kvm, &vcpu->arch.pv_time); vcpu->arch.time = 0; } @@ -6199,26 +6206,22 @@ return 0; } -static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp) +static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, + struct kvm_msr_filter *filter) { - struct kvm_msr_filter __user *user_msr_filter = argp; struct kvm_x86_msr_filter *new_filter, *old_filter; - struct kvm_msr_filter filter; bool default_allow; bool empty = true; int r = 0; u32 i; - if (copy_from_user(&filter, user_msr_filter, sizeof(filter))) - return -EFAULT; - - if (filter.flags & ~KVM_MSR_FILTER_DEFAULT_DENY) + if (filter->flags & ~KVM_MSR_FILTER_DEFAULT_DENY) return -EINVAL; - for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) - empty &= !filter.ranges[i].nmsrs; + for (i = 0; i < ARRAY_SIZE(filter->ranges); i++) + empty &= !filter->ranges[i].nmsrs; - default_allow = !(filter.flags & KVM_MSR_FILTER_DEFAULT_DENY); + default_allow = !(filter->flags & KVM_MSR_FILTER_DEFAULT_DENY); if (empty && !default_allow) return -EINVAL; @@ -6226,8 +6229,8 @@ if (!new_filter) return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) { - r = kvm_add_msr_filter(new_filter, &filter.ranges[i]); + for (i = 0; i < ARRAY_SIZE(filter->ranges); i++) { + r = kvm_add_msr_filter(new_filter, &filter->ranges[i]); if (r) { kvm_free_msr_filter(new_filter); return r; @@ -6250,6 +6253,62 @@ return 0; } +#ifdef CONFIG_KVM_COMPAT +/* for KVM_X86_SET_MSR_FILTER */ +struct kvm_msr_filter_range_compat { + __u32 flags; + __u32 nmsrs; + __u32 base; + __u32 bitmap; +}; + +struct kvm_msr_filter_compat { + __u32 flags; + struct kvm_msr_filter_range_compat ranges[KVM_MSR_FILTER_MAX_RANGES]; +}; + +#define KVM_X86_SET_MSR_FILTER_COMPAT _IOW(KVMIO, 0xc6, struct kvm_msr_filter_compat) + +long kvm_arch_vm_compat_ioctl(struct file *filp, unsigned int ioctl, + unsigned long arg) +{ + void __user *argp = (void __user *)arg; + struct kvm *kvm = filp->private_data; + long r = -ENOTTY; + + switch (ioctl) { + case KVM_X86_SET_MSR_FILTER_COMPAT: { + struct kvm_msr_filter __user *user_msr_filter = argp; + struct kvm_msr_filter_compat filter_compat; + struct kvm_msr_filter filter; + int i; + + if (copy_from_user(&filter_compat, user_msr_filter, + sizeof(filter_compat))) + return -EFAULT; + + filter.flags = filter_compat.flags; + for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) { + struct kvm_msr_filter_range_compat *cr; + + cr = &filter_compat.ranges[i]; + filter.ranges[i] = (struct kvm_msr_filter_range) { + .flags = cr->flags, + .nmsrs = cr->nmsrs, + .base = cr->base, + .bitmap = (__u8 *)(ulong)cr->bitmap, + }; + } + + r = kvm_vm_ioctl_set_msr_filter(kvm, &filter); + break; + } + } + + return r; +} +#endif + #ifdef CONFIG_HAVE_KVM_PM_NOTIFIER static int kvm_arch_suspend_notifier(struct kvm *kvm) { @@ -6672,9 +6731,16 @@ case KVM_SET_PMU_EVENT_FILTER: r = kvm_vm_ioctl_set_pmu_event_filter(kvm, argp); break; - case KVM_X86_SET_MSR_FILTER: - r = kvm_vm_ioctl_set_msr_filter(kvm, argp); + case KVM_X86_SET_MSR_FILTER: { + struct kvm_msr_filter __user *user_msr_filter = argp; + struct kvm_msr_filter filter; + + if (copy_from_user(&filter, user_msr_filter, sizeof(filter))) + return -EFAULT; + + r = kvm_vm_ioctl_set_msr_filter(kvm, &filter); break; + } default: r = -ENOTTY; } @@ -8601,6 +8667,12 @@ unsigned long rflags = static_call(kvm_x86_get_rflags)(vcpu); toggle_interruptibility(vcpu, ctxt->interruptibility); vcpu->arch.emulate_regs_need_sync_to_vcpu = false; + + /* + * Note, EXCPT_DB is assumed to be fault-like as the emulator + * only supports code breakpoints and general detect #DB, both + * of which are fault-like. + */ if (!ctxt->have_exception || exception_type(ctxt->exception.vector) == EXCPT_TRAP) { kvm_pmu_trigger_event(vcpu, PERF_COUNT_HW_INSTRUCTIONS); @@ -9459,6 +9531,11 @@ static void kvm_inject_exception(struct kvm_vcpu *vcpu) { + trace_kvm_inj_exception(vcpu->arch.exception.nr, + vcpu->arch.exception.has_error_code, + vcpu->arch.exception.error_code, + vcpu->arch.exception.injected); + if (vcpu->arch.exception.error_code && !is_protmode(vcpu)) vcpu->arch.exception.error_code = false; static_call(kvm_x86_queue_exception)(vcpu); @@ -9516,13 +9593,16 @@ /* try to inject new event if pending */ if (vcpu->arch.exception.pending) { - trace_kvm_inj_exception(vcpu->arch.exception.nr, - vcpu->arch.exception.has_error_code, - vcpu->arch.exception.error_code); - - vcpu->arch.exception.pending = false; - vcpu->arch.exception.injected = true; - + /* + * Fault-class exceptions, except #DBs, set RF=1 in the RFLAGS + * value pushed on the stack. Trap-like exception and all #DBs + * leave RF as-is (KVM follows Intel's behavior in this regard; + * AMD states that code breakpoint #DBs excplitly clear RF=0). + * + * Note, most versions of Intel's SDM and AMD's APM incorrectly + * describe the behavior of General Detect #DBs, which are + * fault-like. They do _not_ set RF, a la code breakpoints. + */ if (exception_type(vcpu->arch.exception.nr) == EXCPT_FAULT) __kvm_set_rflags(vcpu, kvm_get_rflags(vcpu) | X86_EFLAGS_RF); @@ -9536,6 +9616,10 @@ } kvm_inject_exception(vcpu); + + vcpu->arch.exception.pending = false; + vcpu->arch.exception.injected = true; + can_inject = false; } @@ -11316,6 +11400,8 @@ vcpu->arch.regs_avail = ~0; vcpu->arch.regs_dirty = ~0; + kvm_gpc_init(&vcpu->arch.pv_time); + if (!irqchip_in_kernel(vcpu->kvm) || kvm_vcpu_is_reset_bsp(vcpu)) vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; else diff -u linux-kvm-5.19.0/arch/x86/kvm/xen.c linux-kvm-5.19.0/arch/x86/kvm/xen.c --- linux-kvm-5.19.0/arch/x86/kvm/xen.c +++ linux-kvm-5.19.0/arch/x86/kvm/xen.c @@ -42,13 +42,13 @@ int idx = srcu_read_lock(&kvm->srcu); if (gfn == GPA_INVALID) { - kvm_gfn_to_pfn_cache_destroy(kvm, gpc); + kvm_gpc_deactivate(kvm, gpc); goto out; } do { - ret = kvm_gfn_to_pfn_cache_init(kvm, gpc, NULL, KVM_HOST_USES_PFN, - gpa, PAGE_SIZE); + ret = kvm_gpc_activate(kvm, gpc, NULL, KVM_HOST_USES_PFN, gpa, + PAGE_SIZE); if (ret) goto out; @@ -554,15 +554,15 @@ offsetof(struct compat_vcpu_info, time)); if (data->u.gpa == GPA_INVALID) { - kvm_gfn_to_pfn_cache_destroy(vcpu->kvm, &vcpu->arch.xen.vcpu_info_cache); + kvm_gpc_deactivate(vcpu->kvm, &vcpu->arch.xen.vcpu_info_cache); r = 0; break; } - r = kvm_gfn_to_pfn_cache_init(vcpu->kvm, - &vcpu->arch.xen.vcpu_info_cache, - NULL, KVM_HOST_USES_PFN, data->u.gpa, - sizeof(struct vcpu_info)); + r = kvm_gpc_activate(vcpu->kvm, + &vcpu->arch.xen.vcpu_info_cache, NULL, + KVM_HOST_USES_PFN, data->u.gpa, + sizeof(struct vcpu_info)); if (!r) kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); @@ -570,16 +570,16 @@ case KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO: if (data->u.gpa == GPA_INVALID) { - kvm_gfn_to_pfn_cache_destroy(vcpu->kvm, - &vcpu->arch.xen.vcpu_time_info_cache); + kvm_gpc_deactivate(vcpu->kvm, + &vcpu->arch.xen.vcpu_time_info_cache); r = 0; break; } - r = kvm_gfn_to_pfn_cache_init(vcpu->kvm, - &vcpu->arch.xen.vcpu_time_info_cache, - NULL, KVM_HOST_USES_PFN, data->u.gpa, - sizeof(struct pvclock_vcpu_time_info)); + r = kvm_gpc_activate(vcpu->kvm, + &vcpu->arch.xen.vcpu_time_info_cache, + NULL, KVM_HOST_USES_PFN, data->u.gpa, + sizeof(struct pvclock_vcpu_time_info)); if (!r) kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); break; @@ -590,16 +590,15 @@ break; } if (data->u.gpa == GPA_INVALID) { - kvm_gfn_to_pfn_cache_destroy(vcpu->kvm, - &vcpu->arch.xen.runstate_cache); + kvm_gpc_deactivate(vcpu->kvm, + &vcpu->arch.xen.runstate_cache); r = 0; break; } - r = kvm_gfn_to_pfn_cache_init(vcpu->kvm, - &vcpu->arch.xen.runstate_cache, - NULL, KVM_HOST_USES_PFN, data->u.gpa, - sizeof(struct vcpu_runstate_info)); + r = kvm_gpc_activate(vcpu->kvm, &vcpu->arch.xen.runstate_cache, + NULL, KVM_HOST_USES_PFN, data->u.gpa, + sizeof(struct vcpu_runstate_info)); break; case KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT: @@ -1817,7 +1816,12 @@ { vcpu->arch.xen.vcpu_id = vcpu->vcpu_idx; vcpu->arch.xen.poll_evtchn = 0; + timer_setup(&vcpu->arch.xen.poll_timer, cancel_evtchn_poll, 0); + + kvm_gpc_init(&vcpu->arch.xen.runstate_cache); + kvm_gpc_init(&vcpu->arch.xen.vcpu_info_cache); + kvm_gpc_init(&vcpu->arch.xen.vcpu_time_info_cache); } void kvm_xen_destroy_vcpu(struct kvm_vcpu *vcpu) @@ -1825,18 +1829,17 @@ if (kvm_xen_timer_enabled(vcpu)) kvm_xen_stop_timer(vcpu); - kvm_gfn_to_pfn_cache_destroy(vcpu->kvm, - &vcpu->arch.xen.runstate_cache); - kvm_gfn_to_pfn_cache_destroy(vcpu->kvm, - &vcpu->arch.xen.vcpu_info_cache); - kvm_gfn_to_pfn_cache_destroy(vcpu->kvm, - &vcpu->arch.xen.vcpu_time_info_cache); + kvm_gpc_deactivate(vcpu->kvm, &vcpu->arch.xen.runstate_cache); + kvm_gpc_deactivate(vcpu->kvm, &vcpu->arch.xen.vcpu_info_cache); + kvm_gpc_deactivate(vcpu->kvm, &vcpu->arch.xen.vcpu_time_info_cache); + del_timer_sync(&vcpu->arch.xen.poll_timer); } void kvm_xen_init_vm(struct kvm *kvm) { idr_init(&kvm->arch.xen.evtchn_ports); + kvm_gpc_init(&kvm->arch.xen.shinfo_cache); } void kvm_xen_destroy_vm(struct kvm *kvm) @@ -1844,7 +1847,7 @@ struct evtchnfd *evtchnfd; int i; - kvm_gfn_to_pfn_cache_destroy(kvm, &kvm->arch.xen.shinfo_cache); + kvm_gpc_deactivate(kvm, &kvm->arch.xen.shinfo_cache); idr_for_each_entry(&kvm->arch.xen.evtchn_ports, evtchnfd, i) { if (!evtchnfd->deliver.port.port) diff -u linux-kvm-5.19.0/block/bio.c linux-kvm-5.19.0/block/bio.c --- linux-kvm-5.19.0/block/bio.c +++ linux-kvm-5.19.0/block/bio.c @@ -741,7 +741,7 @@ return; } - if (bio->bi_opf & REQ_ALLOC_CACHE) { + if ((bio->bi_opf & REQ_ALLOC_CACHE) && !WARN_ON_ONCE(in_interrupt())) { struct bio_alloc_cache *cache; bio_uninit(bio); diff -u linux-kvm-5.19.0/block/blk-mq.c linux-kvm-5.19.0/block/blk-mq.c --- linux-kvm-5.19.0/block/blk-mq.c +++ linux-kvm-5.19.0/block/blk-mq.c @@ -3036,8 +3036,11 @@ struct page *page; unsigned long flags; - /* There is no need to clear a driver tags own mapping */ - if (drv_tags == tags) + /* + * There is no need to clear mapping if driver tags is not initialized + * or the mapping belongs to the driver tags. + */ + if (!drv_tags || drv_tags == tags) return; list_for_each_entry(page, &tags->page_list, lru) { @@ -4109,9 +4112,7 @@ return 0; err_hctxs: - xa_destroy(&q->hctx_table); - q->nr_hw_queues = 0; - blk_mq_sysfs_deinit(q); + blk_mq_release(q); err_poll: blk_stat_free_callback(q->poll_cb); q->poll_cb = NULL; diff -u linux-kvm-5.19.0/block/genhd.c linux-kvm-5.19.0/block/genhd.c --- linux-kvm-5.19.0/block/genhd.c +++ linux-kvm-5.19.0/block/genhd.c @@ -542,6 +542,7 @@ bdi_unregister(disk->bdi); out_unregister_queue: blk_unregister_queue(disk); + rq_qos_exit(disk->queue); out_put_slave_dir: kobject_put(disk->slave_dir); out_put_holder_dir: diff -u linux-kvm-5.19.0/debian.kvm/abi/abiname linux-kvm-5.19.0/debian.kvm/abi/abiname --- linux-kvm-5.19.0/debian.kvm/abi/abiname +++ linux-kvm-5.19.0/debian.kvm/abi/abiname @@ -1 +1 @@ -1014 +1016 diff -u linux-kvm-5.19.0/debian.kvm/abi/version linux-kvm-5.19.0/debian.kvm/abi/version --- linux-kvm-5.19.0/debian.kvm/abi/version +++ linux-kvm-5.19.0/debian.kvm/abi/version @@ -1 +1 @@ -5.19.0-1014.15 +5.19.0-1016.17 diff -u linux-kvm-5.19.0/debian.kvm/changelog linux-kvm-5.19.0/debian.kvm/changelog --- linux-kvm-5.19.0/debian.kvm/changelog +++ linux-kvm-5.19.0/debian.kvm/changelog @@ -1,3 +1,578 @@ +linux-kvm (5.19.0-1017.18) kinetic; urgency=medium + + * kinetic/linux-kvm: 5.19.0-1017.18 -proposed tracker (LP: #2001748) + + * Packaging resync (LP: #1786013) + - debian/dkms-versions -- update from kernel-versions (main/2023.01.02) + + [ Ubuntu: 5.19.0-30.31 ] + + * kinetic/linux: 5.19.0-30.31 -proposed tracker (LP: #2001756) + * Packaging resync (LP: #1786013) + - [Packaging] update helper scripts + - debian/dkms-versions -- update from kernel-versions (main/2023.01.02) + * Add some ACPI device IDs for Intel HID device (LP: #1995453) + - platform/x86/intel/hid: Add some ACPI device IDs + * Fix iosm: WWAN cannot build the connection (DW5823e) (LP: #1998115) + - net: wwan: iosm: fix driver not working with INTEL_IOMMU disabled + - [Config] CONFIG_IOSM update annotations on arm64 armhf ppc64el s390x riscv64 + * BPF_[AND|OR|XOR|FETCH|XCHG|CMPXCHG] in net:test_bpf.sh from + ubuntu_kernel_selftests failed on K-5.19 P9 (LP: #2001618) + - powerpc/bpf/64: add support for BPF_ATOMIC bitwise operations + - powerpc/bpf/64: add support for atomic fetch operations + - powerpc/bpf/64: Add instructions for atomic_[cmp]xchg + * [DEP-8] Run ADT regression suite for lowlatency kernels Jammy and later + (LP: #1999528) + - [DEP-8] Fix regression suite to run on lowlatency + * Kinetic update: upstream stable patchset 2022-12-15 (LP: #1999828) + - serial: ar933x: Deassert Transmit Enable on ->rs485_config() + - KVM: x86: Trace re-injected exceptions + - RDMA/cma: Use output interface for net_dev check + - IB/hfi1: Correctly move list in sc_disable() + - RDMA/hns: Disable local invalidate operation + - NFSv4: Fix a potential state reclaim deadlock + - NFSv4.1: Handle RECLAIM_COMPLETE trunking errors + - NFSv4.1: We must always send RECLAIM_COMPLETE after a reboot + - SUNRPC: Fix null-ptr-deref when xps sysfs alloc failed + - NFSv4.2: Fixup CLONE dest file size for zero-length count + - nfs4: Fix kmemleak when allocate slot failed + - net: dsa: Fix possible memory leaks in dsa_loop_init() + - RDMA/core: Fix null-ptr-deref in ib_core_cleanup() + - RDMA/qedr: clean up work queue on failure in qedr_alloc_resources() + - net: dsa: fall back to default tagger if we can't load the one from DT + - nfc: fdp: Fix potential memory leak in fdp_nci_send() + - nfc: nxp-nci: Fix potential memory leak in nxp_nci_send() + - nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send() + - nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send() + - net: fec: fix improper use of NETDEV_TX_BUSY + - ata: pata_legacy: fix pdc20230_set_piomode() + - net: sched: Fix use after free in red_enqueue() + - net: tun: fix bugs for oversize packet when napi frags enabled + - netfilter: nf_tables: netlink notifier might race to release objects + - netfilter: nf_tables: release flow rule object from commit path + - ipvs: use explicitly signed chars + - ipvs: fix WARNING in __ip_vs_cleanup_batch() + - ipvs: fix WARNING in ip_vs_app_net_cleanup() + - rose: Fix NULL pointer dereference in rose_send_frame() + - mISDN: fix possible memory leak in mISDN_register_device() + - isdn: mISDN: netjet: fix wrong check of device registration + - btrfs: fix inode list leak during backref walking at resolve_indirect_refs() + - btrfs: fix inode list leak during backref walking at find_parent_nodes() + - btrfs: fix ulist leaks in error paths of qgroup self tests + - netfilter: ipset: enforce documented limit to prevent allocating huge memory + - Bluetooth: virtio_bt: Use skb_put to set length + - Bluetooth: L2CAP: fix use-after-free in l2cap_conn_del() + - Bluetooth: L2CAP: Fix memory leak in vhci_write + - net: mdio: fix undefined behavior in bit shift for __mdiobus_register + - ibmvnic: Free rwi on reset success + - stmmac: dwmac-loongson: fix invalid mdio_node + - net/smc: Fix possible leaked pernet namespace in smc_init() + - net, neigh: Fix null-ptr-deref in neigh_table_clear() + - ipv6: fix WARNING in ip6_route_net_exit_late() + - vsock: fix possible infinite sleep in vsock_connectible_wait_data() + - media: rkisp1: Don't pass the quantization to rkisp1_csm_config() + - media: rkisp1: Initialize color space on resizer sink and source pads + - media: rkisp1: Use correct macro for gradient registers + - media: rkisp1: Zero v4l2_subdev_format fields in when validating links + - media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE + - media: cros-ec-cec: limit msg.len to CEC_MAX_MSG_SIZE + - media: dvb-frontends/drxk: initialize err to 0 + - media: meson: vdec: fix possible refcount leak in vdec_probe() + - media: v4l: subdev: Fail graciously when getting try data for NULL state + - ACPI: APEI: Fix integer overflow in ghes_estatus_pool_init() + - scsi: core: Restrict legal sdev_state transitions via sysfs + - HID: saitek: add madcatz variant of MMO7 mouse device ID + - drm/amdgpu: set vm_update_mode=0 as default for Sienna Cichlid in SRIOV case + - i2c: xiic: Add platform module alias + - efi/tpm: Pass correct address to memblock_reserve + - clk: qcom: Update the force mem core bit for GPU clocks + - ARM: dts: imx6qdl-gw59{10,13}: fix user pushbutton GPIO offset + - arm64: dts: imx8: correct clock order + - arm64: dts: lx2160a: specify clock frequencies for the MDIO controllers + - arm64: dts: ls1088a: specify clock frequencies for the MDIO controllers + - arm64: dts: ls208xa: specify clock frequencies for the MDIO controllers + - block: Fix possible memory leak for rq_wb on add_disk failure + - firmware: arm_scmi: Suppress the driver's bind attributes + - firmware: arm_scmi: Make Rx chan_setup fail on memory errors + - firmware: arm_scmi: Fix devres allocation device in virtio transport + - arm64: dts: juno: Add thermal critical trip points + - i2c: piix4: Fix adapter not be removed in piix4_remove() + - Bluetooth: L2CAP: Fix attempting to access uninitialized memory + - fscrypt: stop using keyrings subsystem for fscrypt_master_key + - fscrypt: fix keyring memory leak on mount failure + - btrfs: fix lost file sync on direct IO write with nowait and dsync iocb + - btrfs: fix tree mod log mishandling of reallocated nodes + - btrfs: fix type of parameter generation in btrfs_get_dentry + - ftrace: Fix use-after-free for dynamic ftrace_ops + - tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd() + - kprobe: reverse kp->flags when arm_kprobe failed + - ring-buffer: Check for NULL cpu_buffer in ring_buffer_wake_waiters() + - tools/nolibc/string: Fix memcmp() implementation + - tracing/histogram: Update document for KEYS_MAX size + - capabilities: fix potential memleak on error path from vfs_getxattr_alloc() + - fuse: add file_modified() to fallocate + - efi: random: reduce seed size to 32 bytes + - efi: random: Use 'ACPI reclaim' memory for random seed + - arm64: entry: avoid kprobe recursion + - perf/x86/intel: Fix pebs event constraints for ICL + - perf/x86/intel: Add Cooper Lake stepping to isolation_ucodes[] + - perf/x86/intel: Fix pebs event constraints for SPR + - parisc: Make 8250_gsc driver dependend on CONFIG_PARISC + - parisc: Export iosapic_serial_irq() symbol for serial port driver + - parisc: Avoid printing the hardware path twice + - ext4: fix warning in 'ext4_da_release_space' + - ext4: fix BUG_ON() when directory entry has invalid rec_len + - x86/syscall: Include asm/ptrace.h in syscall_wrapper header + - KVM: x86: Mask off reserved bits in CPUID.80000006H + - KVM: x86: Mask off reserved bits in CPUID.8000001AH + - KVM: x86: Mask off reserved bits in CPUID.80000008H + - KVM: x86: Mask off reserved bits in CPUID.80000001H + - KVM: x86: Mask off reserved bits in CPUID.8000001FH + - KVM: VMX: fully disable SGX if SECONDARY_EXEC_ENCLS_EXITING unavailable + - KVM: arm64: Fix bad dereference on MTE-enabled systems + - KVM: x86: emulator: em_sysexit should update ctxt->mode + - KVM: x86: emulator: introduce emulator_recalc_and_set_mode + - KVM: x86: emulator: update the emulation mode after rsm + - KVM: x86: emulator: update the emulation mode after CR0 write + - tee: Fix tee_shm_register() for kernel TEE drivers + - ext4,f2fs: fix readahead of verity data + - cifs: fix regression in very old smb1 mounts + - drm/rockchip: dsi: Clean up 'usage_mode' when failing to attach + - drm/rockchip: dsi: Force synchronous probe + - drm/i915/sdvo: Filter out invalid outputs more sensibly + - drm/i915/sdvo: Setup DDC fully before output init + - wifi: brcmfmac: Fix potential buffer overflow in brcmf_fweh_event_worker() + - usb: dwc3: gadget: Don't delay End Transfer on delayed_status + - RDMA/hns: Fix NULL pointer problem in free_mr_init() + - docs/process/howto: Replace C89 with C11 + - RDMA/rxe: Fix mr leak in RESPST_ERR_RNR + - tools/nolibc: Fix missing strlen() definition and infinite loop with gcc-12 + - ata: palmld: fix return value check in palmld_pata_probe() + - net: lan966x: Fix the MTU calculation + - net: lan966x: Adjust maximum frame size when vlan is enabled/disabled + - net: lan966x: Fix FDMA when MTU is changed + - net: lan966x: Fix unmapping of received frames using FDMA + - bridge: Fix flushing of dynamic FDB entries + - iio: adc: stm32-adc: fix channel sampling time init + - drm/vc4: hdmi: Check the HSM rate at runtime_resume + - hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax() + - drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback + - drm/amdgpu: Program GC registers through RLCG interface in gfx_v11/gmc_v11 + - nvme-pci: disable write zeroes on various Kingston SSD + - bio: safeguard REQ_ALLOC_CACHE bio put + - clk: rs9: Fix I2C accessors + - arm64: dts: imx8mm: Enable CPLD_Dn pull down resistor on MX8Menlo + - clk: renesas: r8a779g0: Fix HSCIF parent clocks + - arm64: dts: verdin-imx8mp: fix ctrl_sleep_moci + - arm64: dts: imx8mm: remove otg1/2 power domain dependency on hsio + - arm64: dts: imx8mm: correct usb power domains + - arm64: dts: imx8mn: remove otg1 power domain dependency on hsio + - arm64: dts: imx8mn: Correct the usb power domain + - drm/rockchip: dw_hdmi: filter regulator -EPROBE_DEFER error messages + - drm/rockchip: fix fbdev on non-IOMMU devices + - drm/i915: stop abusing swiotlb_max_segment + - blk-mq: Fix kmemleak in blk_mq_init_allocated_queue + - firmware: arm_scmi: Fix deferred_tx_wq release on error paths + - clk: renesas: r8a779g0: Add SASYNCPER clocks + - btrfs: fix a memory allocation failure test in btrfs_submit_direct + - ACPI: NUMA: Add CXL CFMWS 'nodes' to the possible nodes set + - tracing/fprobe: Fix to check whether fprobe is registered correctly + - fprobe: Check rethook_alloc() return in rethook initialization + - fuse: fix readdir cache race + - net/ulp: remove SOCK_SUPPORT_ZC from tls sockets + - ARM: dts: imx6dl-yapp4: Do not allow PM to switch PU regulator off on Q/QP + - net: remove SOCK_SUPPORT_ZC from sockmap + - net: also flag accepted sockets supporting msghdr originated zerocopy + - ext4: update the backup superblock's at the end of the online resize + - x86/tdx: Prepare for using "INFO" call for a second purpose + - x86/tdx: Panic on bad configs that #VE on "private" memory access + - KVM: VMX: Fold vmx_supported_debugctl() into vcpu_supported_debugctl() + - KVM: VMX: Ignore guest CPUID for host userspace writes to DEBUGCTL + - KVM: Initialize gfn_to_pfn_cache locks in dedicated helper + - KVM: Reject attempts to consume or refresh inactive gfn_to_pfn_cache + - KVM: arm64: Fix SMPRI_EL1/TPIDR2_EL0 trapping on VHE + - drm/amdgpu: disable GFXOFF during compute for GFX11 + * Kinetic update: upstream stable patchset 2022-12-07 (LP: #1999079) + - can: j1939: transport: j1939_session_skb_drop_old(): + spin_unlock_irqrestore() before kfree_skb() + - can: kvaser_usb: Fix possible completions during init_completion + - ALSA: Use del_timer_sync() before freeing timer + - ALSA: usb-audio: Add quirks for M-Audio Fast Track C400/600 + - ALSA: au88x0: use explicitly signed char + - ALSA: rme9652: use explicitly signed char + - USB: add RESET_RESUME quirk for NVIDIA Jetson devices in RCM + - usb: gadget: uvc: fix sg handling in error case + - usb: gadget: uvc: fix sg handling during video encode + - usb: dwc3: gadget: Stop processing more requests on IMI + - usb: dwc3: gadget: Don't set IMI for no_interrupt + - usb: bdc: change state when port disconnected + - usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 + controller + - mtd: rawnand: marvell: Use correct logic for nand-keep-config + - xhci: Add quirk to reset host back to default state at shutdown + - xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices + - xhci: Remove device endpoints from bandwidth list when freeing the device + - tools: iio: iio_utils: fix digit calculation + - iio: light: tsl2583: Fix module unloading + - iio: temperature: ltc2983: allocate iio channels once + - iio: adxl372: Fix unsafe buffer attributes + - fbdev: smscufx: Fix several use-after-free bugs + - cpufreq: intel_pstate: Read all MSRs on the target CPU + - cpufreq: intel_pstate: hybrid: Use known scaling factor for P-cores + - fs/binfmt_elf: Fix memory leak in load_elf_binary() + - exec: Copy oldsighand->action under spin-lock + - mac802154: Fix LQI recording + - scsi: qla2xxx: Use transport-defined speed mask for supported_speeds + - drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume + - drm/msm/dsi: fix memory corruption with too many bridges + - drm/msm/hdmi: fix memory corruption with too many bridges + - drm/msm/dp: fix IRQ lifetime + - coresight: cti: Fix hang in cti_disable_hw() + - mmc: sdhci_am654: 'select', not 'depends' REGMAP_MMIO + - mmc: core: Fix kernel panic when remove non-standard SDIO card + - mmc: sdhci-pci-core: Disable ES for ASUS BIOS on Jasper Lake + - mmc: sdhci-esdhc-imx: Propagate ESDHC_FLAG_HS400* only on 8bit bus + - counter: microchip-tcb-capture: Handle Signal1 read and Synapse + - kernfs: fix use-after-free in __kernfs_remove + - pinctrl: Ingenic: JZ4755 bug fixes + - ARC: mm: fix leakage of memory allocated for PTE + - perf auxtrace: Fix address filter symbol name match for modules + - s390/futex: add missing EX_TABLE entry to __futex_atomic_op() + - s390/pci: add missing EX_TABLE entries to + __pcistg_mio_inuser()/__pcilg_mio_inuser() + - mmc: block: Remove error check of hw_reset on reset + - ethtool: eeprom: fix null-deref on genl_info in dump + - net: ieee802154: fix error return code in dgram_bind() + - media: v4l2: Fix v4l2_i2c_subdev_set_name function documentation + - media: atomisp: prevent integer overflow in sh_css_set_black_frame() + - drm/msm: Fix return type of mdp4_lvds_connector_mode_valid + - KVM: selftests: Fix number of pages for memory slot in + memslot_modification_stress_test + - ASoC: qcom: lpass-cpu: mark HDMI TX registers as volatile + - perf: Fix missing SIGTRAPs + - sched/core: Fix comparison in sched_group_cookie_match() + - arc: iounmap() arg is volatile + - mtd: rawnand: intel: Add missing of_node_put() in ebu_nand_probe() + - ASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile + - ALSA: ac97: fix possible memory leak in snd_ac97_dev_register() + - perf/x86/intel/lbr: Use setup_clear_cpu_cap() instead of clear_cpu_cap() + - tipc: fix a null-ptr-deref in tipc_topsrv_accept + - net: netsec: fix error handling in netsec_register_mdio() + - net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg() + - net: hinic: fix memory leak when reading function table + - net: hinic: fix the issue of CMDQ memory leaks + - net: hinic: fix the issue of double release MBOX callback of VF + - net: macb: Specify PHY PM management done by MAC + - nfc: virtual_ncidev: Fix memory leak in virtual_nci_send() + - x86/unwind/orc: Fix unreliable stack dump with gcov + - amd-xgbe: fix the SFP compliance codes check for DAC cables + - amd-xgbe: add the bit rate quirk for Molex cables + - drm/i915/dp: Reset frl trained flag before restarting FRL training + - atlantic: fix deadlock at aq_nic_stop + - kcm: annotate data-races around kcm->rx_psock + - kcm: annotate data-races around kcm->rx_wait + - net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed + - net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY + - tcp: fix a signed-integer-overflow bug in tcp_add_backlog() + - tcp: fix indefinite deferral of RTO with SACK reneging + - net-memcg: avoid stalls when under memory pressure + - drm/amdkfd: Fix memory leak in kfd_mem_dmamap_userptr() + - can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error + path + - can: mcp251x: mcp251x_can_probe(): add missing unregister_candev() in error + path + - PM: hibernate: Allow hybrid sleep to work with s2idle + - media: vivid: s_fbuf: add more sanity checks + - media: vivid: dev->bitmap_cap wasn't freed in all cases + - media: v4l2-dv-timings: add sanity checks for blanking values + - media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check 'interlaced' + - media: vivid: set num_in/outputs to 0 if not supported + - perf vendor events power10: Fix hv-24x7 metric events + - ipv6: ensure sane device mtu in tunnels + - i40e: Fix ethtool rx-flow-hash setting for X722 + - i40e: Fix VF hang when reset is triggered on another VF + - i40e: Fix flow-type by setting GL_HASH_INSET registers + - net: ksz884x: fix missing pci_disable_device() on error in pcidev_init() + - PM: domains: Fix handling of unavailable/disabled idle states + - perf vendor events arm64: Fix incorrect Hisi hip08 L3 metrics + - net: fec: limit register access on i.MX6UL + - net: ethernet: ave: Fix MAC to be in charge of PHY PM + - ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev() + - ALSA: aoa: Fix I2S device accounting + - openvswitch: switch from WARN to pr_warn + - net: ehea: fix possible memory leak in ehea_register_port() + - net: bcmsysport: Indicate MAC is in charge of PHY PM + - nh: fix scope used to find saddr when adding non gw nh + - net: broadcom: bcm4908_enet: update TX stats after actual transmission + - netdevsim: remove dir in nsim_dev_debugfs_init() when creating ports dir + failed + - net/mlx5e: Do not increment ESN when updating IPsec ESN state + - net/mlx5e: Extend SKB room check to include PTP-SQ + - net/mlx5: Fix possible use-after-free in async command interface + - net/mlx5: Update fw fatal reporter state on PCI handlers successful recover + - net/mlx5: Fix crash during sync firmware reset + - net: do not sense pfmemalloc status in skb_append_pagefrags() + - kcm: do not sense pfmemalloc status in kcm_sendpage() + - net: enetc: survive memory pressure without crashing + - arm64: Add AMPERE1 to the Spectre-BHB affected list + - can: rcar_canfd: fix channel specific IRQ handling for RZ/G2L + - can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global + FIFO receive + - ALSA: hda/realtek: Add quirk for ASUS Zenbook using CS35L41 + - ALSA: hda/realtek: Add another HP ZBook G9 model quirks + - usb: gadget: uvc: limit isoc_sg to super speed gadgets + - usb: gadget: uvc: fix dropped frame after missed isoc + - usb: gadget: aspeed: Fix probe regression + - usb: dwc3: gadget: Force sending delayed status during soft disconnect + - usb: typec: ucsi: Check the connection on resume + - usb: typec: ucsi: acpi: Implement resume callback + - usb: dwc3: Don't switch OTG -> peripheral if extcon is present + - mtd: rawnand: tegra: Fix PM disable depth imbalance in probe + - mtd: parsers: bcm47xxpart: Fix halfblock reads + - iio: adxl367: Fix unsafe buffer attributes + - fbdev: stifb: Fall back to cfb_fillrect() on 32-bit HCRX cards + - drm/amdgpu: Fix VRAM BO swap issue + - drm/i915: Extend Wa_1607297627 to Alderlake-P + - drm/amdgpu: Remove ATC L2 access for MMHUB 2.1.x + - drm/amdgpu: fix pstate setting issue + - drm/amdkfd: update gfx1037 Lx cache setting + - drm/amdkfd: correct the cache info for gfx1036 + - drm/msm: fix use-after-free on probe deferral + - drm/msm/hdmi: fix IRQ lifetime + - drm/msm/dp: fix memory corruption with too many bridges + - drm/msm/dp: fix bridge lifetime + - mmc: queue: Cancel recovery work on cleanup + - mmc: core: Fix WRITE_ZEROES CQE handling + - counter: 104-quad-8: Fix race getting function mode and direction + - mm/uffd: fix vma check on userfault for wp + - mm: migrate: fix return value if all subpages of THPs are migrated + successfully + - mm,madvise,hugetlb: fix unexpected data loss with MADV_DONTNEED on hugetlbfs + - mm/huge_memory: do not clobber swp_entry_t during THP split + - s390/cio: fix out-of-bounds access on cio_ignore free + - s390/uaccess: add missing EX_TABLE entries to __clear_user() + - ACPI: PCC: Fix unintentional integer overflow + - powerpc/64s/interrupt: Fix clear of PACA_IRQS_HARD_DIS when returning to + soft-masked context + - media: amphion: release m2m ctx when releasing vpu instance + - media: ov8865: Fix an error handling path in ov8865_probe() + - media: sun6i-csi: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun4i-csi: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun8i-di: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun8i-rotate: Add a Kconfig dependency on RESET_CONTROLLER + - media: cedrus: Add a Kconfig dependency on RESET_CONTROLLER + - drm/msm/a6xx: Replace kcalloc() with kvzalloc() + - drm/msm/dp: add atomic_check to bridge ops + - drm/msm/dp: cleared DP_DOWNSPREAD_CTRL register before start link training + - ASoC: codec: tlv320adc3xxx: add GPIOLIB dependency + - pinctrl: qcom: Avoid glitching lines when we first mux to output + - spi: qup: support using GPIO as chip select line + - x86/fpu: Configure init_fpstate attributes orderly + - x86/fpu: Fix the init_fpstate size check with the actual size + - x86/fpu: Exclude dynamic states from init_fpstate + - bpf: prevent decl_tag from being referenced in func_proto + - mtd: rawnand: intel: Remove unused nand_pa member from ebu_nand_cs + - mtd: rawnand: intel: Use devm_platform_ioremap_resource_byname() + - ASoC: codecs: tlv320adc3xxx: Wrap adc3xxx_i2c_remove() in __exit_p() + - spi: aspeed: Fix window offset of CE1 + - net: lan966x: Fix the rx drop counter + - x86/fpu: Fix copy_xstate_to_uabi() to copy init states correctly + - amd-xgbe: Yellow carp devices do not need rrc + - drm/i915/dgfx: Keep PCI autosuspend control 'on' by default on all dGPU + - net: lan966x: Stop replacing tx dcbs and dcbs_buf when changing MTU + - mptcp: set msk local address earlier + - netdevsim: fix memory leak in nsim_bus_dev_new() + - net/mlx5: Wait for firmware to enable CRS before pci_restore_state + - net/mlx5: DR, Fix matcher disconnect error flow + - net/mlx5e: Update restore chain id for slow path packets + - net/mlx5e: TC, Reject forwarding from internal port to internal port + - riscv: mm: add missing memcpy in kasan_init + * Virtual GPU driver packaging regression (LP: #1996112) + - [Packaging] Reintroduce VM DRM drivers into modules + * Fix AMD-PState driver for Genoa CPU (LP: #1998106) + - Documentation: amd-pstate: Add unit test introduction + - cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at + init + - cpufreq: amd-pstate: change amd-pstate driver to be built-in type + - cpufreq: amd-pstate: add amd-pstate driver parameter for mode selection + - Documentation: amd-pstate: add driver working mode introduction + - Documentation: add amd-pstate kernel command line options + * Kinetic update: upstream stable patchset 2022-11-30 (LP: #1998398) + - clk: tegra: Fix Tegra PWM parent clock + - Revert "btrfs: call __btrfs_remove_free_space_cache_locked on cache load + failure" + - ocfs2: clear dinode links count in case of error + - ocfs2: fix BUG when iput after ocfs2_mknod fails + - selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context() + - cpufreq: qcom: fix writes in read-only memory region + - i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter + - x86/microcode/AMD: Apply the patch early on every logical thread + - hwmon/coretemp: Handle large core ID value + - ata: ahci-imx: Fix MODULE_ALIAS + - ata: ahci: Match EM_MAX_SLOTS with SATA_PMP_MAX_PORTS + - x86/resctrl: Fix min_cbm_bits for AMD + - cpufreq: qcom: fix memory leak in error path + - drm/amdgpu: fix sdma doorbell init ordering on APUs + - mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages + - kvm: Add support for arch compat vm ioctls + - KVM: arm64: vgic: Fix exit condition in scan_its_table() + - media: ipu3-imgu: Fix NULL pointer dereference in active selection access + - media: mceusb: set timeout to at least timeout provided + - media: venus: dec: Handle the case where find_format fails + - x86/topology: Fix multiple packages shown on a single-package system + - x86/topology: Fix duplicated core ID within a package + - btrfs: fix processing of delayed data refs during backref walking + - btrfs: fix processing of delayed tree block refs during backref walking + - drm/vc4: Add module dependency on hdmi-codec + - ACPI: extlog: Handle multiple records + - tipc: Fix recognition of trial period + - tipc: fix an information leak in tipc_topsrv_kern_subscr + - i40e: Fix DMA mappings leak + - HID: magicmouse: Do not set BTN_MOUSE on double report + - sfc: Change VF mac via PF as first preference if available. + - net/atm: fix proc_mpc_write incorrect return value + - net: phy: dp83867: Extend RX strap quirk for SGMII mode + - net: phylink: add mac_managed_pm in phylink_config structure + - scsi: lpfc: Fix memory leak in lpfc_create_port() + - udp: Update reuse->has_conns under reuseport_lock. + - cifs: Fix xid leak in cifs_create() + - cifs: Fix xid leak in cifs_copy_file_range() + - cifs: Fix xid leak in cifs_flock() + - cifs: Fix xid leak in cifs_ses_add_channel() + - dm: remove unnecessary assignment statement in alloc_dev() + - net: hsr: avoid possible NULL deref in skb_clone() + - ionic: catch NULL pointer issue on reconfig + - netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements + - nvme-hwmon: consistently ignore errors from nvme_hwmon_init + - nvme-hwmon: kmalloc the NVME SMART log buffer + - nvmet: fix workqueue MEM_RECLAIM flushing dependency + - net: sched: cake: fix null pointer access issue when cake_init() fails + - net: sched: delete duplicate cleanup of backlog and qlen + - net: sched: sfb: fix null pointer access issue when sfb_init() fails + - sfc: include vport_id in filter spec hash and equal() + - wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new() + - net: hns: fix possible memory leak in hnae_ae_register() + - net: sched: fix race condition in qdisc_graft() + - net: phy: dp83822: disable MDI crossover status change interrupt + - iommu/vt-d: Allow NVS regions in arch_rmrr_sanity_check() + - iommu/vt-d: Clean up si_domain in the init_dmars() error path + - ACPI: video: Force backlight native for more TongFang devices + - x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB + - mm: /proc/pid/smaps_rollup: fix no vma's null-deref + - smb3: interface count displayed incorrectly + - cpufreq: tegra194: Fix module loading + - KVM: x86: Copy filter arg outside kvm_vm_ioctl_set_msr_filter() + - KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER + - media: venus: Fix NV12 decoder buffer discovery on HFI_VERSION_1XX + - drm/vc4: hdmi: Enforce the minimum rate at runtime_resume + - net/smc: Fix an error code in smc_lgr_create() + - net: stmmac: Enable mac_managed_pm phylink config + - blk-mq: fix null pointer dereference in blk_mq_clear_rq_mapping() + - net: ethernet: mtk_eth_soc: fix possible memory leak in mtk_probe() + - net: ethernet: mtk_eth_wed: add missing put_device() in mtk_wed_add_hw() + - net: ethernet: mtk_eth_wed: add missing of_node_put() + - ip6mr: fix UAF issue in ip6mr_sk_done() when addrconf_init_net() failed + - cifs: Fix memory leak when build ntlmssp negotiate blob failed + - netfilter: rpfilter/fib: Populate flowic_l3mdev field + - netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces. + - net: Fix return value of qdisc ingress handling on success + - drbd: only clone bio if we have a backing device + - wifi: mt76: mt7921e: fix random fw download fail + * Mediatek WLAN RZ616(MT7922) SAR table control (LP: #1997200) + - mt76: add 6 GHz band support in mt76_sar_freq_ranges + - mt76: mt7921: introduce ACPI SAR support + - mt76: mt7921: introduce ACPI SAR config in tx power + - wifi: mt76: mt7921: fix use after free in mt7921_acpi_read() + * Kinetic update: upstream stable patchset 2022-11-14 (LP: #1996540) + - scsi: qla2xxx: Fix response queue handler reading stale packets + - Upstream stable to v5.15.74, v6.0.2 + - rcu-tasks: Convert RCU_LOCKDEP_WARN() to WARN_ONCE() + - mmc: sdhci-msm: add compatible string check for sdm670 + - thermal: intel_powerclamp: Use first online CPU as control_cpu + - gcov: support GCC 12.1 and newer compilers + - io-wq: Fix memory leak in worker creation + - arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored + - serial: Deassert Transmit Enable on probe in driver-specific way + - KVM: x86: Treat #DBs from the emulator as fault-like (code and DR7.GD=1) + - drm/amd/display: Enable dpia support for dcn314 + - drm/amdgpu: Enable F32_WPTR_POLL_ENABLE in mqd + - libbpf: Initialize err in probe_map_create + - libbpf: Fix crash if SEC("freplace") programs don't have attach_prog_fd set + - libbpf: Fix NULL pointer exception in API btf_dump__dump_type_data + - drm/vc4: drv: Call component_unbind_all() + - video/aperture: Disable and unregister sysfb devices via aperture helpers + - drm/bridge: anx7625: Fix refcount bug in anx7625_parse_dt() + - drm/i915/dg2: Bump up CDCLK for DG2 + - drm/panel: use 'select' for Ili9341 panel driver helpers + - drm: fix drm_mipi_dbi build errors + - ALSA: hda/hdmi: change type for the 'assigned' variable + - ALSA: hda/hdmi: Fix the converter allocation for the silent stream + - arm64: dts: qcom: sc7280: Cleanup the lpasscc node + - arm64: dts: qcom: sc7280: Update lpasscore node + - arm64: dts: qcom: pm8350c: Drop PWM reg declaration + - arm64: dts: qcom: sc7180-trogdor: Keep pm6150_adc enabled for TZ + - arm64: dts: qcom: sm8350-sagami: correct TS pin property + - soc/tegra: fuse: Add missing of_node_put() in tegra_init_fuse() + - arm64: dts: qcom: ipq8074: fix PCIe PHY serdes size + - arm64: dts: qcom: sm8450: fix UFS PHY serdes size + - arm64: dts: exynos: fix polarity of "enable" line of NFC chip in TM2 + - selftests/cpu-hotplug: Use return instead of exit + - selftests/cpu-hotplug: Delete fault injection related code + - selftests/cpu-hotplug: Reserve one cpu online at least + - usb: common: usb-conn-gpio: Simplify some error message + - HID: uclogic: Fix warning in uclogic_rdesc_template_apply + - tty: xilinx_uartps: Check clk_enable return value + - fpga: dfl-pci: Add IDs for Intel N6000, N6001 and C6100 cards + - iio: Use per-device lockdep class for mlock + - scsi: lpfc: Fix various issues reported by tools + - phy: qcom-qmp-usb: disable runtime PM on unbind + - block: Fix the enum blk_eh_timer_return documentation + - RDMA/rxe: Set pd early in mr alloc routines + - clk: imx8mp: tune the order of enet_qos_root_clk + - libbpf: Ensure functions with always_inline attribute are inline + - libbpf: Do not require executable permission for shared libraries + - micrel: ksz8851: fixes struct pointer issue + - net: ftmac100: fix endianness-related issues from 'sparse' + - net: sched: cls_u32: Avoid memcpy() false-positive warning + - libbpf: Fix overrun in netlink attribute iteration + - ALSA: usb-audio: Add quirk to enable Avid Mbox 3 support + - ASoC: sunxi: sun4i-codec: set debugfs_prefix for CPU DAI component + - ASoC: amd: yc: Add ASUS UM5302TA into DMI table + - ASoC: amd: yc: Add Lenovo Yoga Slim 7 Pro X to quirks table + - arm64: dts: qcom: sc7280-idp: correct ADC channel node name and unit address + - ARM: orion: fix include path + - hid: topre: Add driver fixing report descriptor + - [Config] updateconfigs for HID_TOPRE + - fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe + - dmaengine: dw-edma: Remove runtime PM support + - HID: playstation: stop DualSense output work on remove. + - HID: playstation: add initial DualSense Edge controller support + - net: flag sockets supporting msghdr originated zerocopy + - drm/amd/pm: disable cstate feature for gpu reset scenario + - dm clone: Fix typo in block_device format specifier + + -- Stefan Bader Thu, 12 Jan 2023 10:07:40 +0100 + +linux-kvm (5.19.0-1016.17) kinetic; urgency=medium + + * kinetic/linux-kvm: 5.19.0-1016.17 -proposed tracker (LP: #1999791) + + [ Ubuntu: 5.19.0-29.30 ] + + * kinetic/linux: 5.19.0-29.30 -proposed tracker (LP: #1999799) + * CVE-2022-3643 + - xen/netback: Ensure protocol headers don't fall in the non-linear area + * CVE-2022-45934 + - Bluetooth: L2CAP: Fix u8 overflow + * CVE-2022-4378 + - proc: proc_skip_spaces() shouldn't think it is working on C strings + - proc: avoid integer type confusion in get_proc_long + * CVE-2022-42896 + - Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM + - Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm + + -- Thadeu Lima de Souza Cascardo Thu, 05 Jan 2023 17:20:49 -0300 + linux-kvm (5.19.0-1015.16) kinetic; urgency=medium * kinetic/linux-kvm: 5.19.0-1015.16 -proposed tracker (LP: #1999738) diff -u linux-kvm-5.19.0/debian.kvm/config/config.common.ubuntu linux-kvm-5.19.0/debian.kvm/config/config.common.ubuntu --- linux-kvm-5.19.0/debian.kvm/config/config.common.ubuntu +++ linux-kvm-5.19.0/debian.kvm/config/config.common.ubuntu @@ -1221,6 +1221,7 @@ # CONFIG_HID_STEELSERIES is not set # CONFIG_HID_SUNPLUS is not set # CONFIG_HID_TIVO is not set +# CONFIG_HID_TOPRE is not set # CONFIG_HID_TOPSEED is not set # CONFIG_HID_TWINHAN is not set # CONFIG_HID_UDRAW_PS3 is not set diff -u linux-kvm-5.19.0/debian.kvm/reconstruct linux-kvm-5.19.0/debian.kvm/reconstruct --- linux-kvm-5.19.0/debian.kvm/reconstruct +++ linux-kvm-5.19.0/debian.kvm/reconstruct @@ -6,6 +6,7 @@ rm -f 'fs/io-wq.c' rm -f 'fs/io-wq.h' rm -f 'fs/io_uring.c' +rm -f 'tools/testing/selftests/cpu-hotplug/config' chmod +x 'debian.kvm-22.10/scripts/helpers/copy-files' chmod +x 'debian/cloud-tools/hv_get_dhcp_info' chmod +x 'debian/cloud-tools/hv_get_dns_info' diff -u linux-kvm-5.19.0/debian.kvm/tracking-bug linux-kvm-5.19.0/debian.kvm/tracking-bug --- linux-kvm-5.19.0/debian.kvm/tracking-bug +++ linux-kvm-5.19.0/debian.kvm/tracking-bug @@ -1 +1 @@ -1999738 2022.11.14-8 +2001748 2023.01.02-1 diff -u linux-kvm-5.19.0/debian.master/abi/abiname linux-kvm-5.19.0/debian.master/abi/abiname --- linux-kvm-5.19.0/debian.master/abi/abiname +++ linux-kvm-5.19.0/debian.master/abi/abiname @@ -1 +1 @@ -27 +29 diff -u linux-kvm-5.19.0/debian.master/abi/version linux-kvm-5.19.0/debian.master/abi/version --- linux-kvm-5.19.0/debian.master/abi/version +++ linux-kvm-5.19.0/debian.master/abi/version @@ -1 +1 @@ -5.19.0-27.28 +5.19.0-29.30 diff -u linux-kvm-5.19.0/debian.master/changelog linux-kvm-5.19.0/debian.master/changelog --- linux-kvm-5.19.0/debian.master/changelog +++ linux-kvm-5.19.0/debian.master/changelog @@ -1,3 +1,583 @@ +linux (5.19.0-30.31) kinetic; urgency=medium + + * kinetic/linux: 5.19.0-30.31 -proposed tracker (LP: #2001756) + + * Packaging resync (LP: #1786013) + - [Packaging] update helper scripts + - debian/dkms-versions -- update from kernel-versions (main/2023.01.02) + + * Add some ACPI device IDs for Intel HID device (LP: #1995453) + - platform/x86/intel/hid: Add some ACPI device IDs + + * Fix iosm: WWAN cannot build the connection (DW5823e) (LP: #1998115) + - net: wwan: iosm: fix driver not working with INTEL_IOMMU disabled + - [Config] CONFIG_IOSM update annotations on arm64 armhf ppc64el s390x riscv64 + + * BPF_[AND|OR|XOR|FETCH|XCHG|CMPXCHG] in net:test_bpf.sh from + ubuntu_kernel_selftests failed on K-5.19 P9 (LP: #2001618) + - powerpc/bpf/64: add support for BPF_ATOMIC bitwise operations + - powerpc/bpf/64: add support for atomic fetch operations + - powerpc/bpf/64: Add instructions for atomic_[cmp]xchg + + * [DEP-8] Run ADT regression suite for lowlatency kernels Jammy and later + (LP: #1999528) + - [DEP-8] Fix regression suite to run on lowlatency + + * Kinetic update: upstream stable patchset 2022-12-15 (LP: #1999828) + - serial: ar933x: Deassert Transmit Enable on ->rs485_config() + - KVM: x86: Trace re-injected exceptions + - RDMA/cma: Use output interface for net_dev check + - IB/hfi1: Correctly move list in sc_disable() + - RDMA/hns: Disable local invalidate operation + - NFSv4: Fix a potential state reclaim deadlock + - NFSv4.1: Handle RECLAIM_COMPLETE trunking errors + - NFSv4.1: We must always send RECLAIM_COMPLETE after a reboot + - SUNRPC: Fix null-ptr-deref when xps sysfs alloc failed + - NFSv4.2: Fixup CLONE dest file size for zero-length count + - nfs4: Fix kmemleak when allocate slot failed + - net: dsa: Fix possible memory leaks in dsa_loop_init() + - RDMA/core: Fix null-ptr-deref in ib_core_cleanup() + - RDMA/qedr: clean up work queue on failure in qedr_alloc_resources() + - net: dsa: fall back to default tagger if we can't load the one from DT + - nfc: fdp: Fix potential memory leak in fdp_nci_send() + - nfc: nxp-nci: Fix potential memory leak in nxp_nci_send() + - nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send() + - nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send() + - net: fec: fix improper use of NETDEV_TX_BUSY + - ata: pata_legacy: fix pdc20230_set_piomode() + - net: sched: Fix use after free in red_enqueue() + - net: tun: fix bugs for oversize packet when napi frags enabled + - netfilter: nf_tables: netlink notifier might race to release objects + - netfilter: nf_tables: release flow rule object from commit path + - ipvs: use explicitly signed chars + - ipvs: fix WARNING in __ip_vs_cleanup_batch() + - ipvs: fix WARNING in ip_vs_app_net_cleanup() + - rose: Fix NULL pointer dereference in rose_send_frame() + - mISDN: fix possible memory leak in mISDN_register_device() + - isdn: mISDN: netjet: fix wrong check of device registration + - btrfs: fix inode list leak during backref walking at resolve_indirect_refs() + - btrfs: fix inode list leak during backref walking at find_parent_nodes() + - btrfs: fix ulist leaks in error paths of qgroup self tests + - netfilter: ipset: enforce documented limit to prevent allocating huge memory + - Bluetooth: virtio_bt: Use skb_put to set length + - Bluetooth: L2CAP: fix use-after-free in l2cap_conn_del() + - Bluetooth: L2CAP: Fix memory leak in vhci_write + - net: mdio: fix undefined behavior in bit shift for __mdiobus_register + - ibmvnic: Free rwi on reset success + - stmmac: dwmac-loongson: fix invalid mdio_node + - net/smc: Fix possible leaked pernet namespace in smc_init() + - net, neigh: Fix null-ptr-deref in neigh_table_clear() + - ipv6: fix WARNING in ip6_route_net_exit_late() + - vsock: fix possible infinite sleep in vsock_connectible_wait_data() + - media: rkisp1: Don't pass the quantization to rkisp1_csm_config() + - media: rkisp1: Initialize color space on resizer sink and source pads + - media: rkisp1: Use correct macro for gradient registers + - media: rkisp1: Zero v4l2_subdev_format fields in when validating links + - media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE + - media: cros-ec-cec: limit msg.len to CEC_MAX_MSG_SIZE + - media: dvb-frontends/drxk: initialize err to 0 + - media: meson: vdec: fix possible refcount leak in vdec_probe() + - media: v4l: subdev: Fail graciously when getting try data for NULL state + - ACPI: APEI: Fix integer overflow in ghes_estatus_pool_init() + - scsi: core: Restrict legal sdev_state transitions via sysfs + - HID: saitek: add madcatz variant of MMO7 mouse device ID + - drm/amdgpu: set vm_update_mode=0 as default for Sienna Cichlid in SRIOV case + - i2c: xiic: Add platform module alias + - efi/tpm: Pass correct address to memblock_reserve + - clk: qcom: Update the force mem core bit for GPU clocks + - ARM: dts: imx6qdl-gw59{10,13}: fix user pushbutton GPIO offset + - arm64: dts: imx8: correct clock order + - arm64: dts: lx2160a: specify clock frequencies for the MDIO controllers + - arm64: dts: ls1088a: specify clock frequencies for the MDIO controllers + - arm64: dts: ls208xa: specify clock frequencies for the MDIO controllers + - block: Fix possible memory leak for rq_wb on add_disk failure + - firmware: arm_scmi: Suppress the driver's bind attributes + - firmware: arm_scmi: Make Rx chan_setup fail on memory errors + - firmware: arm_scmi: Fix devres allocation device in virtio transport + - arm64: dts: juno: Add thermal critical trip points + - i2c: piix4: Fix adapter not be removed in piix4_remove() + - Bluetooth: L2CAP: Fix attempting to access uninitialized memory + - fscrypt: stop using keyrings subsystem for fscrypt_master_key + - fscrypt: fix keyring memory leak on mount failure + - btrfs: fix lost file sync on direct IO write with nowait and dsync iocb + - btrfs: fix tree mod log mishandling of reallocated nodes + - btrfs: fix type of parameter generation in btrfs_get_dentry + - ftrace: Fix use-after-free for dynamic ftrace_ops + - tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd() + - kprobe: reverse kp->flags when arm_kprobe failed + - ring-buffer: Check for NULL cpu_buffer in ring_buffer_wake_waiters() + - tools/nolibc/string: Fix memcmp() implementation + - tracing/histogram: Update document for KEYS_MAX size + - capabilities: fix potential memleak on error path from vfs_getxattr_alloc() + - fuse: add file_modified() to fallocate + - efi: random: reduce seed size to 32 bytes + - efi: random: Use 'ACPI reclaim' memory for random seed + - arm64: entry: avoid kprobe recursion + - perf/x86/intel: Fix pebs event constraints for ICL + - perf/x86/intel: Add Cooper Lake stepping to isolation_ucodes[] + - perf/x86/intel: Fix pebs event constraints for SPR + - parisc: Make 8250_gsc driver dependend on CONFIG_PARISC + - parisc: Export iosapic_serial_irq() symbol for serial port driver + - parisc: Avoid printing the hardware path twice + - ext4: fix warning in 'ext4_da_release_space' + - ext4: fix BUG_ON() when directory entry has invalid rec_len + - x86/syscall: Include asm/ptrace.h in syscall_wrapper header + - KVM: x86: Mask off reserved bits in CPUID.80000006H + - KVM: x86: Mask off reserved bits in CPUID.8000001AH + - KVM: x86: Mask off reserved bits in CPUID.80000008H + - KVM: x86: Mask off reserved bits in CPUID.80000001H + - KVM: x86: Mask off reserved bits in CPUID.8000001FH + - KVM: VMX: fully disable SGX if SECONDARY_EXEC_ENCLS_EXITING unavailable + - KVM: arm64: Fix bad dereference on MTE-enabled systems + - KVM: x86: emulator: em_sysexit should update ctxt->mode + - KVM: x86: emulator: introduce emulator_recalc_and_set_mode + - KVM: x86: emulator: update the emulation mode after rsm + - KVM: x86: emulator: update the emulation mode after CR0 write + - tee: Fix tee_shm_register() for kernel TEE drivers + - ext4,f2fs: fix readahead of verity data + - cifs: fix regression in very old smb1 mounts + - drm/rockchip: dsi: Clean up 'usage_mode' when failing to attach + - drm/rockchip: dsi: Force synchronous probe + - drm/i915/sdvo: Filter out invalid outputs more sensibly + - drm/i915/sdvo: Setup DDC fully before output init + - wifi: brcmfmac: Fix potential buffer overflow in brcmf_fweh_event_worker() + - usb: dwc3: gadget: Don't delay End Transfer on delayed_status + - RDMA/hns: Fix NULL pointer problem in free_mr_init() + - docs/process/howto: Replace C89 with C11 + - RDMA/rxe: Fix mr leak in RESPST_ERR_RNR + - tools/nolibc: Fix missing strlen() definition and infinite loop with gcc-12 + - ata: palmld: fix return value check in palmld_pata_probe() + - net: lan966x: Fix the MTU calculation + - net: lan966x: Adjust maximum frame size when vlan is enabled/disabled + - net: lan966x: Fix FDMA when MTU is changed + - net: lan966x: Fix unmapping of received frames using FDMA + - bridge: Fix flushing of dynamic FDB entries + - iio: adc: stm32-adc: fix channel sampling time init + - drm/vc4: hdmi: Check the HSM rate at runtime_resume + - hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax() + - drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback + - drm/amdgpu: Program GC registers through RLCG interface in gfx_v11/gmc_v11 + - nvme-pci: disable write zeroes on various Kingston SSD + - bio: safeguard REQ_ALLOC_CACHE bio put + - clk: rs9: Fix I2C accessors + - arm64: dts: imx8mm: Enable CPLD_Dn pull down resistor on MX8Menlo + - clk: renesas: r8a779g0: Fix HSCIF parent clocks + - arm64: dts: verdin-imx8mp: fix ctrl_sleep_moci + - arm64: dts: imx8mm: remove otg1/2 power domain dependency on hsio + - arm64: dts: imx8mm: correct usb power domains + - arm64: dts: imx8mn: remove otg1 power domain dependency on hsio + - arm64: dts: imx8mn: Correct the usb power domain + - drm/rockchip: dw_hdmi: filter regulator -EPROBE_DEFER error messages + - drm/rockchip: fix fbdev on non-IOMMU devices + - drm/i915: stop abusing swiotlb_max_segment + - blk-mq: Fix kmemleak in blk_mq_init_allocated_queue + - firmware: arm_scmi: Fix deferred_tx_wq release on error paths + - clk: renesas: r8a779g0: Add SASYNCPER clocks + - btrfs: fix a memory allocation failure test in btrfs_submit_direct + - ACPI: NUMA: Add CXL CFMWS 'nodes' to the possible nodes set + - tracing/fprobe: Fix to check whether fprobe is registered correctly + - fprobe: Check rethook_alloc() return in rethook initialization + - fuse: fix readdir cache race + - net/ulp: remove SOCK_SUPPORT_ZC from tls sockets + - ARM: dts: imx6dl-yapp4: Do not allow PM to switch PU regulator off on Q/QP + - net: remove SOCK_SUPPORT_ZC from sockmap + - net: also flag accepted sockets supporting msghdr originated zerocopy + - ext4: update the backup superblock's at the end of the online resize + - x86/tdx: Prepare for using "INFO" call for a second purpose + - x86/tdx: Panic on bad configs that #VE on "private" memory access + - KVM: VMX: Fold vmx_supported_debugctl() into vcpu_supported_debugctl() + - KVM: VMX: Ignore guest CPUID for host userspace writes to DEBUGCTL + - KVM: Initialize gfn_to_pfn_cache locks in dedicated helper + - KVM: Reject attempts to consume or refresh inactive gfn_to_pfn_cache + - KVM: arm64: Fix SMPRI_EL1/TPIDR2_EL0 trapping on VHE + - drm/amdgpu: disable GFXOFF during compute for GFX11 + + * Kinetic update: upstream stable patchset 2022-12-07 (LP: #1999079) + - can: j1939: transport: j1939_session_skb_drop_old(): + spin_unlock_irqrestore() before kfree_skb() + - can: kvaser_usb: Fix possible completions during init_completion + - ALSA: Use del_timer_sync() before freeing timer + - ALSA: usb-audio: Add quirks for M-Audio Fast Track C400/600 + - ALSA: au88x0: use explicitly signed char + - ALSA: rme9652: use explicitly signed char + - USB: add RESET_RESUME quirk for NVIDIA Jetson devices in RCM + - usb: gadget: uvc: fix sg handling in error case + - usb: gadget: uvc: fix sg handling during video encode + - usb: dwc3: gadget: Stop processing more requests on IMI + - usb: dwc3: gadget: Don't set IMI for no_interrupt + - usb: bdc: change state when port disconnected + - usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 + controller + - mtd: rawnand: marvell: Use correct logic for nand-keep-config + - xhci: Add quirk to reset host back to default state at shutdown + - xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices + - xhci: Remove device endpoints from bandwidth list when freeing the device + - tools: iio: iio_utils: fix digit calculation + - iio: light: tsl2583: Fix module unloading + - iio: temperature: ltc2983: allocate iio channels once + - iio: adxl372: Fix unsafe buffer attributes + - fbdev: smscufx: Fix several use-after-free bugs + - cpufreq: intel_pstate: Read all MSRs on the target CPU + - cpufreq: intel_pstate: hybrid: Use known scaling factor for P-cores + - fs/binfmt_elf: Fix memory leak in load_elf_binary() + - exec: Copy oldsighand->action under spin-lock + - mac802154: Fix LQI recording + - scsi: qla2xxx: Use transport-defined speed mask for supported_speeds + - drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume + - drm/msm/dsi: fix memory corruption with too many bridges + - drm/msm/hdmi: fix memory corruption with too many bridges + - drm/msm/dp: fix IRQ lifetime + - coresight: cti: Fix hang in cti_disable_hw() + - mmc: sdhci_am654: 'select', not 'depends' REGMAP_MMIO + - mmc: core: Fix kernel panic when remove non-standard SDIO card + - mmc: sdhci-pci-core: Disable ES for ASUS BIOS on Jasper Lake + - mmc: sdhci-esdhc-imx: Propagate ESDHC_FLAG_HS400* only on 8bit bus + - counter: microchip-tcb-capture: Handle Signal1 read and Synapse + - kernfs: fix use-after-free in __kernfs_remove + - pinctrl: Ingenic: JZ4755 bug fixes + - ARC: mm: fix leakage of memory allocated for PTE + - perf auxtrace: Fix address filter symbol name match for modules + - s390/futex: add missing EX_TABLE entry to __futex_atomic_op() + - s390/pci: add missing EX_TABLE entries to + __pcistg_mio_inuser()/__pcilg_mio_inuser() + - mmc: block: Remove error check of hw_reset on reset + - ethtool: eeprom: fix null-deref on genl_info in dump + - net: ieee802154: fix error return code in dgram_bind() + - media: v4l2: Fix v4l2_i2c_subdev_set_name function documentation + - media: atomisp: prevent integer overflow in sh_css_set_black_frame() + - drm/msm: Fix return type of mdp4_lvds_connector_mode_valid + - KVM: selftests: Fix number of pages for memory slot in + memslot_modification_stress_test + - ASoC: qcom: lpass-cpu: mark HDMI TX registers as volatile + - perf: Fix missing SIGTRAPs + - sched/core: Fix comparison in sched_group_cookie_match() + - arc: iounmap() arg is volatile + - mtd: rawnand: intel: Add missing of_node_put() in ebu_nand_probe() + - ASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile + - ALSA: ac97: fix possible memory leak in snd_ac97_dev_register() + - perf/x86/intel/lbr: Use setup_clear_cpu_cap() instead of clear_cpu_cap() + - tipc: fix a null-ptr-deref in tipc_topsrv_accept + - net: netsec: fix error handling in netsec_register_mdio() + - net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg() + - net: hinic: fix memory leak when reading function table + - net: hinic: fix the issue of CMDQ memory leaks + - net: hinic: fix the issue of double release MBOX callback of VF + - net: macb: Specify PHY PM management done by MAC + - nfc: virtual_ncidev: Fix memory leak in virtual_nci_send() + - x86/unwind/orc: Fix unreliable stack dump with gcov + - amd-xgbe: fix the SFP compliance codes check for DAC cables + - amd-xgbe: add the bit rate quirk for Molex cables + - drm/i915/dp: Reset frl trained flag before restarting FRL training + - atlantic: fix deadlock at aq_nic_stop + - kcm: annotate data-races around kcm->rx_psock + - kcm: annotate data-races around kcm->rx_wait + - net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed + - net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY + - tcp: fix a signed-integer-overflow bug in tcp_add_backlog() + - tcp: fix indefinite deferral of RTO with SACK reneging + - net-memcg: avoid stalls when under memory pressure + - drm/amdkfd: Fix memory leak in kfd_mem_dmamap_userptr() + - can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error + path + - can: mcp251x: mcp251x_can_probe(): add missing unregister_candev() in error + path + - PM: hibernate: Allow hybrid sleep to work with s2idle + - media: vivid: s_fbuf: add more sanity checks + - media: vivid: dev->bitmap_cap wasn't freed in all cases + - media: v4l2-dv-timings: add sanity checks for blanking values + - media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check 'interlaced' + - media: vivid: set num_in/outputs to 0 if not supported + - perf vendor events power10: Fix hv-24x7 metric events + - ipv6: ensure sane device mtu in tunnels + - i40e: Fix ethtool rx-flow-hash setting for X722 + - i40e: Fix VF hang when reset is triggered on another VF + - i40e: Fix flow-type by setting GL_HASH_INSET registers + - net: ksz884x: fix missing pci_disable_device() on error in pcidev_init() + - PM: domains: Fix handling of unavailable/disabled idle states + - perf vendor events arm64: Fix incorrect Hisi hip08 L3 metrics + - net: fec: limit register access on i.MX6UL + - net: ethernet: ave: Fix MAC to be in charge of PHY PM + - ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev() + - ALSA: aoa: Fix I2S device accounting + - openvswitch: switch from WARN to pr_warn + - net: ehea: fix possible memory leak in ehea_register_port() + - net: bcmsysport: Indicate MAC is in charge of PHY PM + - nh: fix scope used to find saddr when adding non gw nh + - net: broadcom: bcm4908_enet: update TX stats after actual transmission + - netdevsim: remove dir in nsim_dev_debugfs_init() when creating ports dir + failed + - net/mlx5e: Do not increment ESN when updating IPsec ESN state + - net/mlx5e: Extend SKB room check to include PTP-SQ + - net/mlx5: Fix possible use-after-free in async command interface + - net/mlx5: Update fw fatal reporter state on PCI handlers successful recover + - net/mlx5: Fix crash during sync firmware reset + - net: do not sense pfmemalloc status in skb_append_pagefrags() + - kcm: do not sense pfmemalloc status in kcm_sendpage() + - net: enetc: survive memory pressure without crashing + - arm64: Add AMPERE1 to the Spectre-BHB affected list + - can: rcar_canfd: fix channel specific IRQ handling for RZ/G2L + - can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global + FIFO receive + - ALSA: hda/realtek: Add quirk for ASUS Zenbook using CS35L41 + - ALSA: hda/realtek: Add another HP ZBook G9 model quirks + - usb: gadget: uvc: limit isoc_sg to super speed gadgets + - usb: gadget: uvc: fix dropped frame after missed isoc + - usb: gadget: aspeed: Fix probe regression + - usb: dwc3: gadget: Force sending delayed status during soft disconnect + - usb: typec: ucsi: Check the connection on resume + - usb: typec: ucsi: acpi: Implement resume callback + - usb: dwc3: Don't switch OTG -> peripheral if extcon is present + - mtd: rawnand: tegra: Fix PM disable depth imbalance in probe + - mtd: parsers: bcm47xxpart: Fix halfblock reads + - iio: adxl367: Fix unsafe buffer attributes + - fbdev: stifb: Fall back to cfb_fillrect() on 32-bit HCRX cards + - drm/amdgpu: Fix VRAM BO swap issue + - drm/i915: Extend Wa_1607297627 to Alderlake-P + - drm/amdgpu: Remove ATC L2 access for MMHUB 2.1.x + - drm/amdgpu: fix pstate setting issue + - drm/amdkfd: update gfx1037 Lx cache setting + - drm/amdkfd: correct the cache info for gfx1036 + - drm/msm: fix use-after-free on probe deferral + - drm/msm/hdmi: fix IRQ lifetime + - drm/msm/dp: fix memory corruption with too many bridges + - drm/msm/dp: fix bridge lifetime + - mmc: queue: Cancel recovery work on cleanup + - mmc: core: Fix WRITE_ZEROES CQE handling + - counter: 104-quad-8: Fix race getting function mode and direction + - mm/uffd: fix vma check on userfault for wp + - mm: migrate: fix return value if all subpages of THPs are migrated + successfully + - mm,madvise,hugetlb: fix unexpected data loss with MADV_DONTNEED on hugetlbfs + - mm/huge_memory: do not clobber swp_entry_t during THP split + - s390/cio: fix out-of-bounds access on cio_ignore free + - s390/uaccess: add missing EX_TABLE entries to __clear_user() + - ACPI: PCC: Fix unintentional integer overflow + - powerpc/64s/interrupt: Fix clear of PACA_IRQS_HARD_DIS when returning to + soft-masked context + - media: amphion: release m2m ctx when releasing vpu instance + - media: ov8865: Fix an error handling path in ov8865_probe() + - media: sun6i-csi: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun4i-csi: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun8i-di: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun8i-rotate: Add a Kconfig dependency on RESET_CONTROLLER + - media: cedrus: Add a Kconfig dependency on RESET_CONTROLLER + - drm/msm/a6xx: Replace kcalloc() with kvzalloc() + - drm/msm/dp: add atomic_check to bridge ops + - drm/msm/dp: cleared DP_DOWNSPREAD_CTRL register before start link training + - ASoC: codec: tlv320adc3xxx: add GPIOLIB dependency + - pinctrl: qcom: Avoid glitching lines when we first mux to output + - spi: qup: support using GPIO as chip select line + - x86/fpu: Configure init_fpstate attributes orderly + - x86/fpu: Fix the init_fpstate size check with the actual size + - x86/fpu: Exclude dynamic states from init_fpstate + - bpf: prevent decl_tag from being referenced in func_proto + - mtd: rawnand: intel: Remove unused nand_pa member from ebu_nand_cs + - mtd: rawnand: intel: Use devm_platform_ioremap_resource_byname() + - ASoC: codecs: tlv320adc3xxx: Wrap adc3xxx_i2c_remove() in __exit_p() + - spi: aspeed: Fix window offset of CE1 + - net: lan966x: Fix the rx drop counter + - x86/fpu: Fix copy_xstate_to_uabi() to copy init states correctly + - amd-xgbe: Yellow carp devices do not need rrc + - drm/i915/dgfx: Keep PCI autosuspend control 'on' by default on all dGPU + - net: lan966x: Stop replacing tx dcbs and dcbs_buf when changing MTU + - mptcp: set msk local address earlier + - netdevsim: fix memory leak in nsim_bus_dev_new() + - net/mlx5: Wait for firmware to enable CRS before pci_restore_state + - net/mlx5: DR, Fix matcher disconnect error flow + - net/mlx5e: Update restore chain id for slow path packets + - net/mlx5e: TC, Reject forwarding from internal port to internal port + - riscv: mm: add missing memcpy in kasan_init + + * Virtual GPU driver packaging regression (LP: #1996112) + - [Packaging] Reintroduce VM DRM drivers into modules + + * Fix AMD-PState driver for Genoa CPU (LP: #1998106) + - Documentation: amd-pstate: Add unit test introduction + - cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at + init + - cpufreq: amd-pstate: change amd-pstate driver to be built-in type + - cpufreq: amd-pstate: add amd-pstate driver parameter for mode selection + - Documentation: amd-pstate: add driver working mode introduction + - Documentation: add amd-pstate kernel command line options + + * Kinetic update: upstream stable patchset 2022-11-30 (LP: #1998398) + - clk: tegra: Fix Tegra PWM parent clock + - Revert "btrfs: call __btrfs_remove_free_space_cache_locked on cache load + failure" + - ocfs2: clear dinode links count in case of error + - ocfs2: fix BUG when iput after ocfs2_mknod fails + - selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context() + - cpufreq: qcom: fix writes in read-only memory region + - i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter + - x86/microcode/AMD: Apply the patch early on every logical thread + - hwmon/coretemp: Handle large core ID value + - ata: ahci-imx: Fix MODULE_ALIAS + - ata: ahci: Match EM_MAX_SLOTS with SATA_PMP_MAX_PORTS + - x86/resctrl: Fix min_cbm_bits for AMD + - cpufreq: qcom: fix memory leak in error path + - drm/amdgpu: fix sdma doorbell init ordering on APUs + - mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages + - kvm: Add support for arch compat vm ioctls + - KVM: arm64: vgic: Fix exit condition in scan_its_table() + - media: ipu3-imgu: Fix NULL pointer dereference in active selection access + - media: mceusb: set timeout to at least timeout provided + - media: venus: dec: Handle the case where find_format fails + - x86/topology: Fix multiple packages shown on a single-package system + - x86/topology: Fix duplicated core ID within a package + - btrfs: fix processing of delayed data refs during backref walking + - btrfs: fix processing of delayed tree block refs during backref walking + - drm/vc4: Add module dependency on hdmi-codec + - ACPI: extlog: Handle multiple records + - tipc: Fix recognition of trial period + - tipc: fix an information leak in tipc_topsrv_kern_subscr + - i40e: Fix DMA mappings leak + - HID: magicmouse: Do not set BTN_MOUSE on double report + - sfc: Change VF mac via PF as first preference if available. + - net/atm: fix proc_mpc_write incorrect return value + - net: phy: dp83867: Extend RX strap quirk for SGMII mode + - net: phylink: add mac_managed_pm in phylink_config structure + - scsi: lpfc: Fix memory leak in lpfc_create_port() + - udp: Update reuse->has_conns under reuseport_lock. + - cifs: Fix xid leak in cifs_create() + - cifs: Fix xid leak in cifs_copy_file_range() + - cifs: Fix xid leak in cifs_flock() + - cifs: Fix xid leak in cifs_ses_add_channel() + - dm: remove unnecessary assignment statement in alloc_dev() + - net: hsr: avoid possible NULL deref in skb_clone() + - ionic: catch NULL pointer issue on reconfig + - netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements + - nvme-hwmon: consistently ignore errors from nvme_hwmon_init + - nvme-hwmon: kmalloc the NVME SMART log buffer + - nvmet: fix workqueue MEM_RECLAIM flushing dependency + - net: sched: cake: fix null pointer access issue when cake_init() fails + - net: sched: delete duplicate cleanup of backlog and qlen + - net: sched: sfb: fix null pointer access issue when sfb_init() fails + - sfc: include vport_id in filter spec hash and equal() + - wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new() + - net: hns: fix possible memory leak in hnae_ae_register() + - net: sched: fix race condition in qdisc_graft() + - net: phy: dp83822: disable MDI crossover status change interrupt + - iommu/vt-d: Allow NVS regions in arch_rmrr_sanity_check() + - iommu/vt-d: Clean up si_domain in the init_dmars() error path + - ACPI: video: Force backlight native for more TongFang devices + - x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB + - mm: /proc/pid/smaps_rollup: fix no vma's null-deref + - smb3: interface count displayed incorrectly + - cpufreq: tegra194: Fix module loading + - KVM: x86: Copy filter arg outside kvm_vm_ioctl_set_msr_filter() + - KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER + - media: venus: Fix NV12 decoder buffer discovery on HFI_VERSION_1XX + - drm/vc4: hdmi: Enforce the minimum rate at runtime_resume + - net/smc: Fix an error code in smc_lgr_create() + - net: stmmac: Enable mac_managed_pm phylink config + - blk-mq: fix null pointer dereference in blk_mq_clear_rq_mapping() + - net: ethernet: mtk_eth_soc: fix possible memory leak in mtk_probe() + - net: ethernet: mtk_eth_wed: add missing put_device() in mtk_wed_add_hw() + - net: ethernet: mtk_eth_wed: add missing of_node_put() + - ip6mr: fix UAF issue in ip6mr_sk_done() when addrconf_init_net() failed + - cifs: Fix memory leak when build ntlmssp negotiate blob failed + - netfilter: rpfilter/fib: Populate flowic_l3mdev field + - netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces. + - net: Fix return value of qdisc ingress handling on success + - drbd: only clone bio if we have a backing device + - wifi: mt76: mt7921e: fix random fw download fail + + * Mediatek WLAN RZ616(MT7922) SAR table control (LP: #1997200) + - mt76: add 6 GHz band support in mt76_sar_freq_ranges + - mt76: mt7921: introduce ACPI SAR support + - mt76: mt7921: introduce ACPI SAR config in tx power + - wifi: mt76: mt7921: fix use after free in mt7921_acpi_read() + + * Kinetic update: upstream stable patchset 2022-11-14 (LP: #1996540) + - scsi: qla2xxx: Fix response queue handler reading stale packets + - Upstream stable to v5.15.74, v6.0.2 + - rcu-tasks: Convert RCU_LOCKDEP_WARN() to WARN_ONCE() + - mmc: sdhci-msm: add compatible string check for sdm670 + - thermal: intel_powerclamp: Use first online CPU as control_cpu + - gcov: support GCC 12.1 and newer compilers + - io-wq: Fix memory leak in worker creation + - arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored + - serial: Deassert Transmit Enable on probe in driver-specific way + - KVM: x86: Treat #DBs from the emulator as fault-like (code and DR7.GD=1) + - drm/amd/display: Enable dpia support for dcn314 + - drm/amdgpu: Enable F32_WPTR_POLL_ENABLE in mqd + - libbpf: Initialize err in probe_map_create + - libbpf: Fix crash if SEC("freplace") programs don't have attach_prog_fd set + - libbpf: Fix NULL pointer exception in API btf_dump__dump_type_data + - drm/vc4: drv: Call component_unbind_all() + - video/aperture: Disable and unregister sysfb devices via aperture helpers + - drm/bridge: anx7625: Fix refcount bug in anx7625_parse_dt() + - drm/i915/dg2: Bump up CDCLK for DG2 + - drm/panel: use 'select' for Ili9341 panel driver helpers + - drm: fix drm_mipi_dbi build errors + - ALSA: hda/hdmi: change type for the 'assigned' variable + - ALSA: hda/hdmi: Fix the converter allocation for the silent stream + - arm64: dts: qcom: sc7280: Cleanup the lpasscc node + - arm64: dts: qcom: sc7280: Update lpasscore node + - arm64: dts: qcom: pm8350c: Drop PWM reg declaration + - arm64: dts: qcom: sc7180-trogdor: Keep pm6150_adc enabled for TZ + - arm64: dts: qcom: sm8350-sagami: correct TS pin property + - soc/tegra: fuse: Add missing of_node_put() in tegra_init_fuse() + - arm64: dts: qcom: ipq8074: fix PCIe PHY serdes size + - arm64: dts: qcom: sm8450: fix UFS PHY serdes size + - arm64: dts: exynos: fix polarity of "enable" line of NFC chip in TM2 + - selftests/cpu-hotplug: Use return instead of exit + - selftests/cpu-hotplug: Delete fault injection related code + - selftests/cpu-hotplug: Reserve one cpu online at least + - usb: common: usb-conn-gpio: Simplify some error message + - HID: uclogic: Fix warning in uclogic_rdesc_template_apply + - tty: xilinx_uartps: Check clk_enable return value + - fpga: dfl-pci: Add IDs for Intel N6000, N6001 and C6100 cards + - iio: Use per-device lockdep class for mlock + - scsi: lpfc: Fix various issues reported by tools + - phy: qcom-qmp-usb: disable runtime PM on unbind + - block: Fix the enum blk_eh_timer_return documentation + - RDMA/rxe: Set pd early in mr alloc routines + - clk: imx8mp: tune the order of enet_qos_root_clk + - libbpf: Ensure functions with always_inline attribute are inline + - libbpf: Do not require executable permission for shared libraries + - micrel: ksz8851: fixes struct pointer issue + - net: ftmac100: fix endianness-related issues from 'sparse' + - net: sched: cls_u32: Avoid memcpy() false-positive warning + - libbpf: Fix overrun in netlink attribute iteration + - ALSA: usb-audio: Add quirk to enable Avid Mbox 3 support + - ASoC: sunxi: sun4i-codec: set debugfs_prefix for CPU DAI component + - ASoC: amd: yc: Add ASUS UM5302TA into DMI table + - ASoC: amd: yc: Add Lenovo Yoga Slim 7 Pro X to quirks table + - arm64: dts: qcom: sc7280-idp: correct ADC channel node name and unit address + - ARM: orion: fix include path + - hid: topre: Add driver fixing report descriptor + - [Config] updateconfigs for HID_TOPRE + - fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe + - dmaengine: dw-edma: Remove runtime PM support + - HID: playstation: stop DualSense output work on remove. + - HID: playstation: add initial DualSense Edge controller support + - net: flag sockets supporting msghdr originated zerocopy + - drm/amd/pm: disable cstate feature for gpu reset scenario + - dm clone: Fix typo in block_device format specifier + + -- Luke Nowakowski-Krijger Fri, 06 Jan 2023 07:01:36 -0800 + +linux (5.19.0-29.30) kinetic; urgency=medium + + * kinetic/linux: 5.19.0-29.30 -proposed tracker (LP: #1999799) + + * CVE-2022-3643 + - xen/netback: Ensure protocol headers don't fall in the non-linear area + + * CVE-2022-45934 + - Bluetooth: L2CAP: Fix u8 overflow + + * CVE-2022-4378 + - proc: proc_skip_spaces() shouldn't think it is working on C strings + - proc: avoid integer type confusion in get_proc_long + + * CVE-2022-42896 + - Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM + - Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm + + -- Thadeu Lima de Souza Cascardo Wed, 04 Jan 2023 08:36:13 -0300 + linux (5.19.0-28.29) kinetic; urgency=medium * kinetic/linux: 5.19.0-28.29 -proposed tracker (LP: #1999746) diff -u linux-kvm-5.19.0/debian.master/config/annotations linux-kvm-5.19.0/debian.master/config/annotations --- linux-kvm-5.19.0/debian.master/config/annotations +++ linux-kvm-5.19.0/debian.master/config/annotations @@ -6937,7 +6937,7 @@ CONFIG_MHI_WWAN_CTRL policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm'}> CONFIG_MHI_WWAN_MBIM policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm'}> CONFIG_RPMSG_WWAN_CTRL policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm'}> -CONFIG_IOSM policy<{'amd64': 'm'}> +CONFIG_IOSM policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm'}> # Menu: Device Drivers >> Non-Transparent Bridge support CONFIG_NTB policy<{'amd64': 'm', 'arm64': 'm', 'armhf': 'm', 'ppc64el': 'm', 'riscv64': 'm', 's390x': 'n'}> diff -u linux-kvm-5.19.0/debian.master/config/config.common.ubuntu linux-kvm-5.19.0/debian.master/config/config.common.ubuntu --- linux-kvm-5.19.0/debian.master/config/config.common.ubuntu +++ linux-kvm-5.19.0/debian.master/config/config.common.ubuntu @@ -4590,6 +4590,7 @@ CONFIG_HID_THINGM=m CONFIG_HID_THRUSTMASTER=m CONFIG_HID_TIVO=m +# CONFIG_HID_TOPRE is not set CONFIG_HID_TOPSEED=m CONFIG_HID_TWINHAN=m CONFIG_HID_U2FZERO=m diff -u linux-kvm-5.19.0/debian.master/control.d/generic.inclusion-list linux-kvm-5.19.0/debian.master/control.d/generic.inclusion-list --- linux-kvm-5.19.0/debian.master/control.d/generic.inclusion-list +++ linux-kvm-5.19.0/debian.master/control.d/generic.inclusion-list @@ -45,11 +45,16 @@ drivers/firmware/iscsi_ibft.ko drivers/gpio/gpio-max77620.ko drivers/gpu/drm/ast/ast.ko +drivers/gpu/drm/bochs/bochs-drm.ko +drivers/gpu/drm/cirrus/cirrus.ko drivers/gpu/drm/drm.ko drivers/gpu/drm/drm_kms_helper.ko drivers/gpu/drm/tegra/tegra-drm.ko drivers/gpu/drm/ttm/ttm.ko drivers/gpu/drm/vboxvideo/vboxvideo.ko +drivers/gpu/drm/virtio/virtio-gpu.ko +drivers/gpu/drm/vmwgfx/vmwgfx.ko +drivers/gpu/drm/xen/drm_xen_front.ko drivers/gpu/host1x/host1x.ko drivers/hid/hid-generic.ko drivers/hid/hid-hyperv.ko diff -u linux-kvm-5.19.0/debian.master/reconstruct linux-kvm-5.19.0/debian.master/reconstruct --- linux-kvm-5.19.0/debian.master/reconstruct +++ linux-kvm-5.19.0/debian.master/reconstruct @@ -6,6 +6,7 @@ rm -f 'fs/io-wq.c' rm -f 'fs/io-wq.h' rm -f 'fs/io_uring.c' +rm -f 'tools/testing/selftests/cpu-hotplug/config' chmod +x 'debian/cloud-tools/hv_get_dhcp_info' chmod +x 'debian/cloud-tools/hv_get_dns_info' chmod +x 'debian/cloud-tools/hv_set_ifconfig' diff -u linux-kvm-5.19.0/debian.master/tracking-bug linux-kvm-5.19.0/debian.master/tracking-bug --- linux-kvm-5.19.0/debian.master/tracking-bug +++ linux-kvm-5.19.0/debian.master/tracking-bug @@ -1 +1 @@ -1999746 2022.11.14-8 +2001756 2023.01.02-1 diff -u linux-kvm-5.19.0/debian.master/upstream-stable linux-kvm-5.19.0/debian.master/upstream-stable --- linux-kvm-5.19.0/debian.master/upstream-stable +++ linux-kvm-5.19.0/debian.master/upstream-stable @@ -3 +3,3 @@ + linux-5.15.y = v5.15.78 linux-5.19.y = v5.19.17 + linux-6.0.y = v6.0.8 diff -u linux-kvm-5.19.0/debian/changelog linux-kvm-5.19.0/debian/changelog --- linux-kvm-5.19.0/debian/changelog +++ linux-kvm-5.19.0/debian/changelog @@ -1,3 +1,578 @@ +linux-kvm (5.19.0-1017.18) kinetic; urgency=medium + + * kinetic/linux-kvm: 5.19.0-1017.18 -proposed tracker (LP: #2001748) + + * Packaging resync (LP: #1786013) + - debian/dkms-versions -- update from kernel-versions (main/2023.01.02) + + [ Ubuntu: 5.19.0-30.31 ] + + * kinetic/linux: 5.19.0-30.31 -proposed tracker (LP: #2001756) + * Packaging resync (LP: #1786013) + - [Packaging] update helper scripts + - debian/dkms-versions -- update from kernel-versions (main/2023.01.02) + * Add some ACPI device IDs for Intel HID device (LP: #1995453) + - platform/x86/intel/hid: Add some ACPI device IDs + * Fix iosm: WWAN cannot build the connection (DW5823e) (LP: #1998115) + - net: wwan: iosm: fix driver not working with INTEL_IOMMU disabled + - [Config] CONFIG_IOSM update annotations on arm64 armhf ppc64el s390x riscv64 + * BPF_[AND|OR|XOR|FETCH|XCHG|CMPXCHG] in net:test_bpf.sh from + ubuntu_kernel_selftests failed on K-5.19 P9 (LP: #2001618) + - powerpc/bpf/64: add support for BPF_ATOMIC bitwise operations + - powerpc/bpf/64: add support for atomic fetch operations + - powerpc/bpf/64: Add instructions for atomic_[cmp]xchg + * [DEP-8] Run ADT regression suite for lowlatency kernels Jammy and later + (LP: #1999528) + - [DEP-8] Fix regression suite to run on lowlatency + * Kinetic update: upstream stable patchset 2022-12-15 (LP: #1999828) + - serial: ar933x: Deassert Transmit Enable on ->rs485_config() + - KVM: x86: Trace re-injected exceptions + - RDMA/cma: Use output interface for net_dev check + - IB/hfi1: Correctly move list in sc_disable() + - RDMA/hns: Disable local invalidate operation + - NFSv4: Fix a potential state reclaim deadlock + - NFSv4.1: Handle RECLAIM_COMPLETE trunking errors + - NFSv4.1: We must always send RECLAIM_COMPLETE after a reboot + - SUNRPC: Fix null-ptr-deref when xps sysfs alloc failed + - NFSv4.2: Fixup CLONE dest file size for zero-length count + - nfs4: Fix kmemleak when allocate slot failed + - net: dsa: Fix possible memory leaks in dsa_loop_init() + - RDMA/core: Fix null-ptr-deref in ib_core_cleanup() + - RDMA/qedr: clean up work queue on failure in qedr_alloc_resources() + - net: dsa: fall back to default tagger if we can't load the one from DT + - nfc: fdp: Fix potential memory leak in fdp_nci_send() + - nfc: nxp-nci: Fix potential memory leak in nxp_nci_send() + - nfc: s3fwrn5: Fix potential memory leak in s3fwrn5_nci_send() + - nfc: nfcmrvl: Fix potential memory leak in nfcmrvl_i2c_nci_send() + - net: fec: fix improper use of NETDEV_TX_BUSY + - ata: pata_legacy: fix pdc20230_set_piomode() + - net: sched: Fix use after free in red_enqueue() + - net: tun: fix bugs for oversize packet when napi frags enabled + - netfilter: nf_tables: netlink notifier might race to release objects + - netfilter: nf_tables: release flow rule object from commit path + - ipvs: use explicitly signed chars + - ipvs: fix WARNING in __ip_vs_cleanup_batch() + - ipvs: fix WARNING in ip_vs_app_net_cleanup() + - rose: Fix NULL pointer dereference in rose_send_frame() + - mISDN: fix possible memory leak in mISDN_register_device() + - isdn: mISDN: netjet: fix wrong check of device registration + - btrfs: fix inode list leak during backref walking at resolve_indirect_refs() + - btrfs: fix inode list leak during backref walking at find_parent_nodes() + - btrfs: fix ulist leaks in error paths of qgroup self tests + - netfilter: ipset: enforce documented limit to prevent allocating huge memory + - Bluetooth: virtio_bt: Use skb_put to set length + - Bluetooth: L2CAP: fix use-after-free in l2cap_conn_del() + - Bluetooth: L2CAP: Fix memory leak in vhci_write + - net: mdio: fix undefined behavior in bit shift for __mdiobus_register + - ibmvnic: Free rwi on reset success + - stmmac: dwmac-loongson: fix invalid mdio_node + - net/smc: Fix possible leaked pernet namespace in smc_init() + - net, neigh: Fix null-ptr-deref in neigh_table_clear() + - ipv6: fix WARNING in ip6_route_net_exit_late() + - vsock: fix possible infinite sleep in vsock_connectible_wait_data() + - media: rkisp1: Don't pass the quantization to rkisp1_csm_config() + - media: rkisp1: Initialize color space on resizer sink and source pads + - media: rkisp1: Use correct macro for gradient registers + - media: rkisp1: Zero v4l2_subdev_format fields in when validating links + - media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE + - media: cros-ec-cec: limit msg.len to CEC_MAX_MSG_SIZE + - media: dvb-frontends/drxk: initialize err to 0 + - media: meson: vdec: fix possible refcount leak in vdec_probe() + - media: v4l: subdev: Fail graciously when getting try data for NULL state + - ACPI: APEI: Fix integer overflow in ghes_estatus_pool_init() + - scsi: core: Restrict legal sdev_state transitions via sysfs + - HID: saitek: add madcatz variant of MMO7 mouse device ID + - drm/amdgpu: set vm_update_mode=0 as default for Sienna Cichlid in SRIOV case + - i2c: xiic: Add platform module alias + - efi/tpm: Pass correct address to memblock_reserve + - clk: qcom: Update the force mem core bit for GPU clocks + - ARM: dts: imx6qdl-gw59{10,13}: fix user pushbutton GPIO offset + - arm64: dts: imx8: correct clock order + - arm64: dts: lx2160a: specify clock frequencies for the MDIO controllers + - arm64: dts: ls1088a: specify clock frequencies for the MDIO controllers + - arm64: dts: ls208xa: specify clock frequencies for the MDIO controllers + - block: Fix possible memory leak for rq_wb on add_disk failure + - firmware: arm_scmi: Suppress the driver's bind attributes + - firmware: arm_scmi: Make Rx chan_setup fail on memory errors + - firmware: arm_scmi: Fix devres allocation device in virtio transport + - arm64: dts: juno: Add thermal critical trip points + - i2c: piix4: Fix adapter not be removed in piix4_remove() + - Bluetooth: L2CAP: Fix attempting to access uninitialized memory + - fscrypt: stop using keyrings subsystem for fscrypt_master_key + - fscrypt: fix keyring memory leak on mount failure + - btrfs: fix lost file sync on direct IO write with nowait and dsync iocb + - btrfs: fix tree mod log mishandling of reallocated nodes + - btrfs: fix type of parameter generation in btrfs_get_dentry + - ftrace: Fix use-after-free for dynamic ftrace_ops + - tracing: kprobe: Fix memory leak in test_gen_kprobe/kretprobe_cmd() + - kprobe: reverse kp->flags when arm_kprobe failed + - ring-buffer: Check for NULL cpu_buffer in ring_buffer_wake_waiters() + - tools/nolibc/string: Fix memcmp() implementation + - tracing/histogram: Update document for KEYS_MAX size + - capabilities: fix potential memleak on error path from vfs_getxattr_alloc() + - fuse: add file_modified() to fallocate + - efi: random: reduce seed size to 32 bytes + - efi: random: Use 'ACPI reclaim' memory for random seed + - arm64: entry: avoid kprobe recursion + - perf/x86/intel: Fix pebs event constraints for ICL + - perf/x86/intel: Add Cooper Lake stepping to isolation_ucodes[] + - perf/x86/intel: Fix pebs event constraints for SPR + - parisc: Make 8250_gsc driver dependend on CONFIG_PARISC + - parisc: Export iosapic_serial_irq() symbol for serial port driver + - parisc: Avoid printing the hardware path twice + - ext4: fix warning in 'ext4_da_release_space' + - ext4: fix BUG_ON() when directory entry has invalid rec_len + - x86/syscall: Include asm/ptrace.h in syscall_wrapper header + - KVM: x86: Mask off reserved bits in CPUID.80000006H + - KVM: x86: Mask off reserved bits in CPUID.8000001AH + - KVM: x86: Mask off reserved bits in CPUID.80000008H + - KVM: x86: Mask off reserved bits in CPUID.80000001H + - KVM: x86: Mask off reserved bits in CPUID.8000001FH + - KVM: VMX: fully disable SGX if SECONDARY_EXEC_ENCLS_EXITING unavailable + - KVM: arm64: Fix bad dereference on MTE-enabled systems + - KVM: x86: emulator: em_sysexit should update ctxt->mode + - KVM: x86: emulator: introduce emulator_recalc_and_set_mode + - KVM: x86: emulator: update the emulation mode after rsm + - KVM: x86: emulator: update the emulation mode after CR0 write + - tee: Fix tee_shm_register() for kernel TEE drivers + - ext4,f2fs: fix readahead of verity data + - cifs: fix regression in very old smb1 mounts + - drm/rockchip: dsi: Clean up 'usage_mode' when failing to attach + - drm/rockchip: dsi: Force synchronous probe + - drm/i915/sdvo: Filter out invalid outputs more sensibly + - drm/i915/sdvo: Setup DDC fully before output init + - wifi: brcmfmac: Fix potential buffer overflow in brcmf_fweh_event_worker() + - usb: dwc3: gadget: Don't delay End Transfer on delayed_status + - RDMA/hns: Fix NULL pointer problem in free_mr_init() + - docs/process/howto: Replace C89 with C11 + - RDMA/rxe: Fix mr leak in RESPST_ERR_RNR + - tools/nolibc: Fix missing strlen() definition and infinite loop with gcc-12 + - ata: palmld: fix return value check in palmld_pata_probe() + - net: lan966x: Fix the MTU calculation + - net: lan966x: Adjust maximum frame size when vlan is enabled/disabled + - net: lan966x: Fix FDMA when MTU is changed + - net: lan966x: Fix unmapping of received frames using FDMA + - bridge: Fix flushing of dynamic FDB entries + - iio: adc: stm32-adc: fix channel sampling time init + - drm/vc4: hdmi: Check the HSM rate at runtime_resume + - hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax() + - drm/amdkfd: Fix type of reset_type parameter in hqd_destroy() callback + - drm/amdgpu: Program GC registers through RLCG interface in gfx_v11/gmc_v11 + - nvme-pci: disable write zeroes on various Kingston SSD + - bio: safeguard REQ_ALLOC_CACHE bio put + - clk: rs9: Fix I2C accessors + - arm64: dts: imx8mm: Enable CPLD_Dn pull down resistor on MX8Menlo + - clk: renesas: r8a779g0: Fix HSCIF parent clocks + - arm64: dts: verdin-imx8mp: fix ctrl_sleep_moci + - arm64: dts: imx8mm: remove otg1/2 power domain dependency on hsio + - arm64: dts: imx8mm: correct usb power domains + - arm64: dts: imx8mn: remove otg1 power domain dependency on hsio + - arm64: dts: imx8mn: Correct the usb power domain + - drm/rockchip: dw_hdmi: filter regulator -EPROBE_DEFER error messages + - drm/rockchip: fix fbdev on non-IOMMU devices + - drm/i915: stop abusing swiotlb_max_segment + - blk-mq: Fix kmemleak in blk_mq_init_allocated_queue + - firmware: arm_scmi: Fix deferred_tx_wq release on error paths + - clk: renesas: r8a779g0: Add SASYNCPER clocks + - btrfs: fix a memory allocation failure test in btrfs_submit_direct + - ACPI: NUMA: Add CXL CFMWS 'nodes' to the possible nodes set + - tracing/fprobe: Fix to check whether fprobe is registered correctly + - fprobe: Check rethook_alloc() return in rethook initialization + - fuse: fix readdir cache race + - net/ulp: remove SOCK_SUPPORT_ZC from tls sockets + - ARM: dts: imx6dl-yapp4: Do not allow PM to switch PU regulator off on Q/QP + - net: remove SOCK_SUPPORT_ZC from sockmap + - net: also flag accepted sockets supporting msghdr originated zerocopy + - ext4: update the backup superblock's at the end of the online resize + - x86/tdx: Prepare for using "INFO" call for a second purpose + - x86/tdx: Panic on bad configs that #VE on "private" memory access + - KVM: VMX: Fold vmx_supported_debugctl() into vcpu_supported_debugctl() + - KVM: VMX: Ignore guest CPUID for host userspace writes to DEBUGCTL + - KVM: Initialize gfn_to_pfn_cache locks in dedicated helper + - KVM: Reject attempts to consume or refresh inactive gfn_to_pfn_cache + - KVM: arm64: Fix SMPRI_EL1/TPIDR2_EL0 trapping on VHE + - drm/amdgpu: disable GFXOFF during compute for GFX11 + * Kinetic update: upstream stable patchset 2022-12-07 (LP: #1999079) + - can: j1939: transport: j1939_session_skb_drop_old(): + spin_unlock_irqrestore() before kfree_skb() + - can: kvaser_usb: Fix possible completions during init_completion + - ALSA: Use del_timer_sync() before freeing timer + - ALSA: usb-audio: Add quirks for M-Audio Fast Track C400/600 + - ALSA: au88x0: use explicitly signed char + - ALSA: rme9652: use explicitly signed char + - USB: add RESET_RESUME quirk for NVIDIA Jetson devices in RCM + - usb: gadget: uvc: fix sg handling in error case + - usb: gadget: uvc: fix sg handling during video encode + - usb: dwc3: gadget: Stop processing more requests on IMI + - usb: dwc3: gadget: Don't set IMI for no_interrupt + - usb: bdc: change state when port disconnected + - usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 + controller + - mtd: rawnand: marvell: Use correct logic for nand-keep-config + - xhci: Add quirk to reset host back to default state at shutdown + - xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices + - xhci: Remove device endpoints from bandwidth list when freeing the device + - tools: iio: iio_utils: fix digit calculation + - iio: light: tsl2583: Fix module unloading + - iio: temperature: ltc2983: allocate iio channels once + - iio: adxl372: Fix unsafe buffer attributes + - fbdev: smscufx: Fix several use-after-free bugs + - cpufreq: intel_pstate: Read all MSRs on the target CPU + - cpufreq: intel_pstate: hybrid: Use known scaling factor for P-cores + - fs/binfmt_elf: Fix memory leak in load_elf_binary() + - exec: Copy oldsighand->action under spin-lock + - mac802154: Fix LQI recording + - scsi: qla2xxx: Use transport-defined speed mask for supported_speeds + - drm/amdgpu: disallow gfxoff until GC IP blocks complete s2idle resume + - drm/msm/dsi: fix memory corruption with too many bridges + - drm/msm/hdmi: fix memory corruption with too many bridges + - drm/msm/dp: fix IRQ lifetime + - coresight: cti: Fix hang in cti_disable_hw() + - mmc: sdhci_am654: 'select', not 'depends' REGMAP_MMIO + - mmc: core: Fix kernel panic when remove non-standard SDIO card + - mmc: sdhci-pci-core: Disable ES for ASUS BIOS on Jasper Lake + - mmc: sdhci-esdhc-imx: Propagate ESDHC_FLAG_HS400* only on 8bit bus + - counter: microchip-tcb-capture: Handle Signal1 read and Synapse + - kernfs: fix use-after-free in __kernfs_remove + - pinctrl: Ingenic: JZ4755 bug fixes + - ARC: mm: fix leakage of memory allocated for PTE + - perf auxtrace: Fix address filter symbol name match for modules + - s390/futex: add missing EX_TABLE entry to __futex_atomic_op() + - s390/pci: add missing EX_TABLE entries to + __pcistg_mio_inuser()/__pcilg_mio_inuser() + - mmc: block: Remove error check of hw_reset on reset + - ethtool: eeprom: fix null-deref on genl_info in dump + - net: ieee802154: fix error return code in dgram_bind() + - media: v4l2: Fix v4l2_i2c_subdev_set_name function documentation + - media: atomisp: prevent integer overflow in sh_css_set_black_frame() + - drm/msm: Fix return type of mdp4_lvds_connector_mode_valid + - KVM: selftests: Fix number of pages for memory slot in + memslot_modification_stress_test + - ASoC: qcom: lpass-cpu: mark HDMI TX registers as volatile + - perf: Fix missing SIGTRAPs + - sched/core: Fix comparison in sched_group_cookie_match() + - arc: iounmap() arg is volatile + - mtd: rawnand: intel: Add missing of_node_put() in ebu_nand_probe() + - ASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile + - ALSA: ac97: fix possible memory leak in snd_ac97_dev_register() + - perf/x86/intel/lbr: Use setup_clear_cpu_cap() instead of clear_cpu_cap() + - tipc: fix a null-ptr-deref in tipc_topsrv_accept + - net: netsec: fix error handling in netsec_register_mdio() + - net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg() + - net: hinic: fix memory leak when reading function table + - net: hinic: fix the issue of CMDQ memory leaks + - net: hinic: fix the issue of double release MBOX callback of VF + - net: macb: Specify PHY PM management done by MAC + - nfc: virtual_ncidev: Fix memory leak in virtual_nci_send() + - x86/unwind/orc: Fix unreliable stack dump with gcov + - amd-xgbe: fix the SFP compliance codes check for DAC cables + - amd-xgbe: add the bit rate quirk for Molex cables + - drm/i915/dp: Reset frl trained flag before restarting FRL training + - atlantic: fix deadlock at aq_nic_stop + - kcm: annotate data-races around kcm->rx_psock + - kcm: annotate data-races around kcm->rx_wait + - net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed + - net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY + - tcp: fix a signed-integer-overflow bug in tcp_add_backlog() + - tcp: fix indefinite deferral of RTO with SACK reneging + - net-memcg: avoid stalls when under memory pressure + - drm/amdkfd: Fix memory leak in kfd_mem_dmamap_userptr() + - can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error + path + - can: mcp251x: mcp251x_can_probe(): add missing unregister_candev() in error + path + - PM: hibernate: Allow hybrid sleep to work with s2idle + - media: vivid: s_fbuf: add more sanity checks + - media: vivid: dev->bitmap_cap wasn't freed in all cases + - media: v4l2-dv-timings: add sanity checks for blanking values + - media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check 'interlaced' + - media: vivid: set num_in/outputs to 0 if not supported + - perf vendor events power10: Fix hv-24x7 metric events + - ipv6: ensure sane device mtu in tunnels + - i40e: Fix ethtool rx-flow-hash setting for X722 + - i40e: Fix VF hang when reset is triggered on another VF + - i40e: Fix flow-type by setting GL_HASH_INSET registers + - net: ksz884x: fix missing pci_disable_device() on error in pcidev_init() + - PM: domains: Fix handling of unavailable/disabled idle states + - perf vendor events arm64: Fix incorrect Hisi hip08 L3 metrics + - net: fec: limit register access on i.MX6UL + - net: ethernet: ave: Fix MAC to be in charge of PHY PM + - ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev() + - ALSA: aoa: Fix I2S device accounting + - openvswitch: switch from WARN to pr_warn + - net: ehea: fix possible memory leak in ehea_register_port() + - net: bcmsysport: Indicate MAC is in charge of PHY PM + - nh: fix scope used to find saddr when adding non gw nh + - net: broadcom: bcm4908_enet: update TX stats after actual transmission + - netdevsim: remove dir in nsim_dev_debugfs_init() when creating ports dir + failed + - net/mlx5e: Do not increment ESN when updating IPsec ESN state + - net/mlx5e: Extend SKB room check to include PTP-SQ + - net/mlx5: Fix possible use-after-free in async command interface + - net/mlx5: Update fw fatal reporter state on PCI handlers successful recover + - net/mlx5: Fix crash during sync firmware reset + - net: do not sense pfmemalloc status in skb_append_pagefrags() + - kcm: do not sense pfmemalloc status in kcm_sendpage() + - net: enetc: survive memory pressure without crashing + - arm64: Add AMPERE1 to the Spectre-BHB affected list + - can: rcar_canfd: fix channel specific IRQ handling for RZ/G2L + - can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global + FIFO receive + - ALSA: hda/realtek: Add quirk for ASUS Zenbook using CS35L41 + - ALSA: hda/realtek: Add another HP ZBook G9 model quirks + - usb: gadget: uvc: limit isoc_sg to super speed gadgets + - usb: gadget: uvc: fix dropped frame after missed isoc + - usb: gadget: aspeed: Fix probe regression + - usb: dwc3: gadget: Force sending delayed status during soft disconnect + - usb: typec: ucsi: Check the connection on resume + - usb: typec: ucsi: acpi: Implement resume callback + - usb: dwc3: Don't switch OTG -> peripheral if extcon is present + - mtd: rawnand: tegra: Fix PM disable depth imbalance in probe + - mtd: parsers: bcm47xxpart: Fix halfblock reads + - iio: adxl367: Fix unsafe buffer attributes + - fbdev: stifb: Fall back to cfb_fillrect() on 32-bit HCRX cards + - drm/amdgpu: Fix VRAM BO swap issue + - drm/i915: Extend Wa_1607297627 to Alderlake-P + - drm/amdgpu: Remove ATC L2 access for MMHUB 2.1.x + - drm/amdgpu: fix pstate setting issue + - drm/amdkfd: update gfx1037 Lx cache setting + - drm/amdkfd: correct the cache info for gfx1036 + - drm/msm: fix use-after-free on probe deferral + - drm/msm/hdmi: fix IRQ lifetime + - drm/msm/dp: fix memory corruption with too many bridges + - drm/msm/dp: fix bridge lifetime + - mmc: queue: Cancel recovery work on cleanup + - mmc: core: Fix WRITE_ZEROES CQE handling + - counter: 104-quad-8: Fix race getting function mode and direction + - mm/uffd: fix vma check on userfault for wp + - mm: migrate: fix return value if all subpages of THPs are migrated + successfully + - mm,madvise,hugetlb: fix unexpected data loss with MADV_DONTNEED on hugetlbfs + - mm/huge_memory: do not clobber swp_entry_t during THP split + - s390/cio: fix out-of-bounds access on cio_ignore free + - s390/uaccess: add missing EX_TABLE entries to __clear_user() + - ACPI: PCC: Fix unintentional integer overflow + - powerpc/64s/interrupt: Fix clear of PACA_IRQS_HARD_DIS when returning to + soft-masked context + - media: amphion: release m2m ctx when releasing vpu instance + - media: ov8865: Fix an error handling path in ov8865_probe() + - media: sun6i-csi: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun4i-csi: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun8i-di: Add a Kconfig dependency on RESET_CONTROLLER + - media: sun8i-rotate: Add a Kconfig dependency on RESET_CONTROLLER + - media: cedrus: Add a Kconfig dependency on RESET_CONTROLLER + - drm/msm/a6xx: Replace kcalloc() with kvzalloc() + - drm/msm/dp: add atomic_check to bridge ops + - drm/msm/dp: cleared DP_DOWNSPREAD_CTRL register before start link training + - ASoC: codec: tlv320adc3xxx: add GPIOLIB dependency + - pinctrl: qcom: Avoid glitching lines when we first mux to output + - spi: qup: support using GPIO as chip select line + - x86/fpu: Configure init_fpstate attributes orderly + - x86/fpu: Fix the init_fpstate size check with the actual size + - x86/fpu: Exclude dynamic states from init_fpstate + - bpf: prevent decl_tag from being referenced in func_proto + - mtd: rawnand: intel: Remove unused nand_pa member from ebu_nand_cs + - mtd: rawnand: intel: Use devm_platform_ioremap_resource_byname() + - ASoC: codecs: tlv320adc3xxx: Wrap adc3xxx_i2c_remove() in __exit_p() + - spi: aspeed: Fix window offset of CE1 + - net: lan966x: Fix the rx drop counter + - x86/fpu: Fix copy_xstate_to_uabi() to copy init states correctly + - amd-xgbe: Yellow carp devices do not need rrc + - drm/i915/dgfx: Keep PCI autosuspend control 'on' by default on all dGPU + - net: lan966x: Stop replacing tx dcbs and dcbs_buf when changing MTU + - mptcp: set msk local address earlier + - netdevsim: fix memory leak in nsim_bus_dev_new() + - net/mlx5: Wait for firmware to enable CRS before pci_restore_state + - net/mlx5: DR, Fix matcher disconnect error flow + - net/mlx5e: Update restore chain id for slow path packets + - net/mlx5e: TC, Reject forwarding from internal port to internal port + - riscv: mm: add missing memcpy in kasan_init + * Virtual GPU driver packaging regression (LP: #1996112) + - [Packaging] Reintroduce VM DRM drivers into modules + * Fix AMD-PState driver for Genoa CPU (LP: #1998106) + - Documentation: amd-pstate: Add unit test introduction + - cpufreq: amd-pstate: cpufreq: amd-pstate: reset MSR_AMD_PERF_CTL register at + init + - cpufreq: amd-pstate: change amd-pstate driver to be built-in type + - cpufreq: amd-pstate: add amd-pstate driver parameter for mode selection + - Documentation: amd-pstate: add driver working mode introduction + - Documentation: add amd-pstate kernel command line options + * Kinetic update: upstream stable patchset 2022-11-30 (LP: #1998398) + - clk: tegra: Fix Tegra PWM parent clock + - Revert "btrfs: call __btrfs_remove_free_space_cache_locked on cache load + failure" + - ocfs2: clear dinode links count in case of error + - ocfs2: fix BUG when iput after ocfs2_mknod fails + - selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context() + - cpufreq: qcom: fix writes in read-only memory region + - i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter + - x86/microcode/AMD: Apply the patch early on every logical thread + - hwmon/coretemp: Handle large core ID value + - ata: ahci-imx: Fix MODULE_ALIAS + - ata: ahci: Match EM_MAX_SLOTS with SATA_PMP_MAX_PORTS + - x86/resctrl: Fix min_cbm_bits for AMD + - cpufreq: qcom: fix memory leak in error path + - drm/amdgpu: fix sdma doorbell init ordering on APUs + - mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages + - kvm: Add support for arch compat vm ioctls + - KVM: arm64: vgic: Fix exit condition in scan_its_table() + - media: ipu3-imgu: Fix NULL pointer dereference in active selection access + - media: mceusb: set timeout to at least timeout provided + - media: venus: dec: Handle the case where find_format fails + - x86/topology: Fix multiple packages shown on a single-package system + - x86/topology: Fix duplicated core ID within a package + - btrfs: fix processing of delayed data refs during backref walking + - btrfs: fix processing of delayed tree block refs during backref walking + - drm/vc4: Add module dependency on hdmi-codec + - ACPI: extlog: Handle multiple records + - tipc: Fix recognition of trial period + - tipc: fix an information leak in tipc_topsrv_kern_subscr + - i40e: Fix DMA mappings leak + - HID: magicmouse: Do not set BTN_MOUSE on double report + - sfc: Change VF mac via PF as first preference if available. + - net/atm: fix proc_mpc_write incorrect return value + - net: phy: dp83867: Extend RX strap quirk for SGMII mode + - net: phylink: add mac_managed_pm in phylink_config structure + - scsi: lpfc: Fix memory leak in lpfc_create_port() + - udp: Update reuse->has_conns under reuseport_lock. + - cifs: Fix xid leak in cifs_create() + - cifs: Fix xid leak in cifs_copy_file_range() + - cifs: Fix xid leak in cifs_flock() + - cifs: Fix xid leak in cifs_ses_add_channel() + - dm: remove unnecessary assignment statement in alloc_dev() + - net: hsr: avoid possible NULL deref in skb_clone() + - ionic: catch NULL pointer issue on reconfig + - netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements + - nvme-hwmon: consistently ignore errors from nvme_hwmon_init + - nvme-hwmon: kmalloc the NVME SMART log buffer + - nvmet: fix workqueue MEM_RECLAIM flushing dependency + - net: sched: cake: fix null pointer access issue when cake_init() fails + - net: sched: delete duplicate cleanup of backlog and qlen + - net: sched: sfb: fix null pointer access issue when sfb_init() fails + - sfc: include vport_id in filter spec hash and equal() + - wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new() + - net: hns: fix possible memory leak in hnae_ae_register() + - net: sched: fix race condition in qdisc_graft() + - net: phy: dp83822: disable MDI crossover status change interrupt + - iommu/vt-d: Allow NVS regions in arch_rmrr_sanity_check() + - iommu/vt-d: Clean up si_domain in the init_dmars() error path + - ACPI: video: Force backlight native for more TongFang devices + - x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB + - mm: /proc/pid/smaps_rollup: fix no vma's null-deref + - smb3: interface count displayed incorrectly + - cpufreq: tegra194: Fix module loading + - KVM: x86: Copy filter arg outside kvm_vm_ioctl_set_msr_filter() + - KVM: x86: Add compat handler for KVM_X86_SET_MSR_FILTER + - media: venus: Fix NV12 decoder buffer discovery on HFI_VERSION_1XX + - drm/vc4: hdmi: Enforce the minimum rate at runtime_resume + - net/smc: Fix an error code in smc_lgr_create() + - net: stmmac: Enable mac_managed_pm phylink config + - blk-mq: fix null pointer dereference in blk_mq_clear_rq_mapping() + - net: ethernet: mtk_eth_soc: fix possible memory leak in mtk_probe() + - net: ethernet: mtk_eth_wed: add missing put_device() in mtk_wed_add_hw() + - net: ethernet: mtk_eth_wed: add missing of_node_put() + - ip6mr: fix UAF issue in ip6mr_sk_done() when addrconf_init_net() failed + - cifs: Fix memory leak when build ntlmssp negotiate blob failed + - netfilter: rpfilter/fib: Populate flowic_l3mdev field + - netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces. + - net: Fix return value of qdisc ingress handling on success + - drbd: only clone bio if we have a backing device + - wifi: mt76: mt7921e: fix random fw download fail + * Mediatek WLAN RZ616(MT7922) SAR table control (LP: #1997200) + - mt76: add 6 GHz band support in mt76_sar_freq_ranges + - mt76: mt7921: introduce ACPI SAR support + - mt76: mt7921: introduce ACPI SAR config in tx power + - wifi: mt76: mt7921: fix use after free in mt7921_acpi_read() + * Kinetic update: upstream stable patchset 2022-11-14 (LP: #1996540) + - scsi: qla2xxx: Fix response queue handler reading stale packets + - Upstream stable to v5.15.74, v6.0.2 + - rcu-tasks: Convert RCU_LOCKDEP_WARN() to WARN_ONCE() + - mmc: sdhci-msm: add compatible string check for sdm670 + - thermal: intel_powerclamp: Use first online CPU as control_cpu + - gcov: support GCC 12.1 and newer compilers + - io-wq: Fix memory leak in worker creation + - arm64: mte: Avoid setting PG_mte_tagged if no tags cleared or restored + - serial: Deassert Transmit Enable on probe in driver-specific way + - KVM: x86: Treat #DBs from the emulator as fault-like (code and DR7.GD=1) + - drm/amd/display: Enable dpia support for dcn314 + - drm/amdgpu: Enable F32_WPTR_POLL_ENABLE in mqd + - libbpf: Initialize err in probe_map_create + - libbpf: Fix crash if SEC("freplace") programs don't have attach_prog_fd set + - libbpf: Fix NULL pointer exception in API btf_dump__dump_type_data + - drm/vc4: drv: Call component_unbind_all() + - video/aperture: Disable and unregister sysfb devices via aperture helpers + - drm/bridge: anx7625: Fix refcount bug in anx7625_parse_dt() + - drm/i915/dg2: Bump up CDCLK for DG2 + - drm/panel: use 'select' for Ili9341 panel driver helpers + - drm: fix drm_mipi_dbi build errors + - ALSA: hda/hdmi: change type for the 'assigned' variable + - ALSA: hda/hdmi: Fix the converter allocation for the silent stream + - arm64: dts: qcom: sc7280: Cleanup the lpasscc node + - arm64: dts: qcom: sc7280: Update lpasscore node + - arm64: dts: qcom: pm8350c: Drop PWM reg declaration + - arm64: dts: qcom: sc7180-trogdor: Keep pm6150_adc enabled for TZ + - arm64: dts: qcom: sm8350-sagami: correct TS pin property + - soc/tegra: fuse: Add missing of_node_put() in tegra_init_fuse() + - arm64: dts: qcom: ipq8074: fix PCIe PHY serdes size + - arm64: dts: qcom: sm8450: fix UFS PHY serdes size + - arm64: dts: exynos: fix polarity of "enable" line of NFC chip in TM2 + - selftests/cpu-hotplug: Use return instead of exit + - selftests/cpu-hotplug: Delete fault injection related code + - selftests/cpu-hotplug: Reserve one cpu online at least + - usb: common: usb-conn-gpio: Simplify some error message + - HID: uclogic: Fix warning in uclogic_rdesc_template_apply + - tty: xilinx_uartps: Check clk_enable return value + - fpga: dfl-pci: Add IDs for Intel N6000, N6001 and C6100 cards + - iio: Use per-device lockdep class for mlock + - scsi: lpfc: Fix various issues reported by tools + - phy: qcom-qmp-usb: disable runtime PM on unbind + - block: Fix the enum blk_eh_timer_return documentation + - RDMA/rxe: Set pd early in mr alloc routines + - clk: imx8mp: tune the order of enet_qos_root_clk + - libbpf: Ensure functions with always_inline attribute are inline + - libbpf: Do not require executable permission for shared libraries + - micrel: ksz8851: fixes struct pointer issue + - net: ftmac100: fix endianness-related issues from 'sparse' + - net: sched: cls_u32: Avoid memcpy() false-positive warning + - libbpf: Fix overrun in netlink attribute iteration + - ALSA: usb-audio: Add quirk to enable Avid Mbox 3 support + - ASoC: sunxi: sun4i-codec: set debugfs_prefix for CPU DAI component + - ASoC: amd: yc: Add ASUS UM5302TA into DMI table + - ASoC: amd: yc: Add Lenovo Yoga Slim 7 Pro X to quirks table + - arm64: dts: qcom: sc7280-idp: correct ADC channel node name and unit address + - ARM: orion: fix include path + - hid: topre: Add driver fixing report descriptor + - [Config] updateconfigs for HID_TOPRE + - fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe + - dmaengine: dw-edma: Remove runtime PM support + - HID: playstation: stop DualSense output work on remove. + - HID: playstation: add initial DualSense Edge controller support + - net: flag sockets supporting msghdr originated zerocopy + - drm/amd/pm: disable cstate feature for gpu reset scenario + - dm clone: Fix typo in block_device format specifier + + -- Stefan Bader Thu, 12 Jan 2023 10:07:40 +0100 + +linux-kvm (5.19.0-1016.17) kinetic; urgency=medium + + * kinetic/linux-kvm: 5.19.0-1016.17 -proposed tracker (LP: #1999791) + + [ Ubuntu: 5.19.0-29.30 ] + + * kinetic/linux: 5.19.0-29.30 -proposed tracker (LP: #1999799) + * CVE-2022-3643 + - xen/netback: Ensure protocol headers don't fall in the non-linear area + * CVE-2022-45934 + - Bluetooth: L2CAP: Fix u8 overflow + * CVE-2022-4378 + - proc: proc_skip_spaces() shouldn't think it is working on C strings + - proc: avoid integer type confusion in get_proc_long + * CVE-2022-42896 + - Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM + - Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm + + -- Thadeu Lima de Souza Cascardo Thu, 05 Jan 2023 17:20:49 -0300 + linux-kvm (5.19.0-1015.16) kinetic; urgency=medium * kinetic/linux-kvm: 5.19.0-1015.16 -proposed tracker (LP: #1999738) diff -u linux-kvm-5.19.0/debian/control linux-kvm-5.19.0/debian/control --- linux-kvm-5.19.0/debian/control +++ linux-kvm-5.19.0/debian/control @@ -51,7 +51,7 @@ XS-Testsuite: autopkgtest #XS-Testsuite-Depends: gcc-4.7 binutils -Package: linux-kvm-headers-5.19.0-1015 +Package: linux-kvm-headers-5.19.0-1017 Build-Profiles: Architecture: all Multi-Arch: foreign @@ -61,46 +61,46 @@ Description: Header files related to Linux kernel version 5.19.0 This package provides kernel header files for version 5.19.0, for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-kvm-headers-5.19.0-1015/debian.README.gz for details + /usr/share/doc/linux-kvm-headers-5.19.0-1017/debian.README.gz for details -Package: linux-kvm-tools-5.19.0-1015 +Package: linux-kvm-tools-5.19.0-1017 Build-Profiles: Architecture: amd64 Section: devel Priority: optional Depends: ${misc:Depends}, ${shlibs:Depends}, linux-tools-common -Description: Linux kernel version specific tools for version 5.19.0-1015 +Description: Linux kernel version specific tools for version 5.19.0-1017 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.19.0-1015 on + version 5.19.0-1017 on 64 bit x86. - You probably want to install linux-tools-5.19.0-1015-. + You probably want to install linux-tools-5.19.0-1017-. -Package: linux-kvm-cloud-tools-5.19.0-1015 +Package: linux-kvm-cloud-tools-5.19.0-1017 Build-Profiles: Architecture: amd64 Section: devel Priority: optional Depends: ${misc:Depends}, ${shlibs:Depends}, linux-cloud-tools-common -Description: Linux kernel version specific cloud tools for version 5.19.0-1015 +Description: Linux kernel version specific cloud tools for version 5.19.0-1017 This package provides the architecture dependant parts for kernel - version locked tools for cloud tools for version 5.19.0-1015 on + version locked tools for cloud tools for version 5.19.0-1017 on 64 bit x86. - You probably want to install linux-cloud-tools-5.19.0-1015-. + You probably want to install linux-cloud-tools-5.19.0-1017-. -Package: linux-image-unsigned-5.19.0-1015-kvm +Package: linux-image-unsigned-5.19.0-1017-kvm Build-Profiles: Architecture: amd64 Section: kernel Priority: optional Provides: linux-image, fuse-module, ${linux:rprovides} -Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.19.0-1015-kvm +Depends: ${misc:Depends}, ${shlibs:Depends}, kmod, linux-base (>= 4.5ubuntu1~16.04.1), linux-modules-5.19.0-1017-kvm Recommends: grub-pc | grub-efi-amd64 | grub-efi-ia32 | grub | lilo, initramfs-tools | linux-initramfs-tool Breaks: flash-kernel (<< 3.90ubuntu2) [arm64 armhf], s390-tools (<< 2.3.0-0ubuntu3) [s390x] -Conflicts: linux-image-5.19.0-1015-kvm -Suggests: fdutils, linux-kvm-doc-5.19.0 | linux-kvm-source-5.19.0, linux-kvm-tools, linux-headers-5.19.0-1015-kvm +Conflicts: linux-image-5.19.0-1017-kvm +Suggests: fdutils, linux-kvm-doc-5.19.0 | linux-kvm-source-5.19.0, linux-kvm-tools, linux-headers-5.19.0-1017-kvm Description: Linux kernel image for version 5.19.0 on 64 bit x86 SMP This package contains the unsigned Linux kernel image for version 5.19.0 on 64 bit x86 SMP. @@ -113,12 +113,12 @@ the linux-kvm meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-5.19.0-1015-kvm +Package: linux-modules-5.19.0-1017-kvm Build-Profiles: Architecture: amd64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.19.0-1015-kvm | linux-image-unsigned-5.19.0-1015-kvm +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.19.0-1017-kvm | linux-image-unsigned-5.19.0-1017-kvm Built-Using: ${linux:BuiltUsing} Description: Linux kernel extra modules for version 5.19.0 on 64 bit x86 SMP Contains the corresponding System.map file, the modules built by the @@ -133,12 +133,12 @@ the linux-kvm meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-modules-extra-5.19.0-1015-kvm +Package: linux-modules-extra-5.19.0-1017-kvm Build-Profiles: Architecture: amd64 Section: kernel Priority: optional -Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.19.0-1015-kvm | linux-image-unsigned-5.19.0-1015-kvm, wireless-regdb +Depends: ${misc:Depends}, ${shlibs:Depends}, linux-image-5.19.0-1017-kvm | linux-image-unsigned-5.19.0-1017-kvm, wireless-regdb Description: Linux kernel extra modules for version 5.19.0 on 64 bit x86 SMP This package contains the Linux kernel extra modules for version 5.19.0 on 64 bit x86 SMP. @@ -155,21 +155,21 @@ the linux-kvm meta-package, which will ensure that upgrades work correctly, and that supporting packages are also installed. -Package: linux-headers-5.19.0-1015-kvm +Package: linux-headers-5.19.0-1017-kvm Build-Profiles: Architecture: amd64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-kvm-headers-5.19.0-1015, ${shlibs:Depends} +Depends: ${misc:Depends}, linux-kvm-headers-5.19.0-1017, ${shlibs:Depends} Provides: linux-headers, linux-headers-3.0 Description: Linux kernel headers for version 5.19.0 on 64 bit x86 SMP This package provides kernel header files for version 5.19.0 on 64 bit x86 SMP. . This is for sites that want the latest kernel headers. Please read - /usr/share/doc/linux-headers-5.19.0-1015/debian.README.gz for details. + /usr/share/doc/linux-headers-5.19.0-1017/debian.README.gz for details. -Package: linux-image-unsigned-5.19.0-1015-kvm-dbgsym +Package: linux-image-unsigned-5.19.0-1017-kvm-dbgsym Build-Profiles: Architecture: amd64 Section: devel @@ -186,31 +186,31 @@ is uncompressed, and unstripped. This package also includes the unstripped modules. -Package: linux-tools-5.19.0-1015-kvm +Package: linux-tools-5.19.0-1017-kvm Build-Profiles: Architecture: amd64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-kvm-tools-5.19.0-1015 -Description: Linux kernel version specific tools for version 5.19.0-1015 +Depends: ${misc:Depends}, linux-kvm-tools-5.19.0-1017 +Description: Linux kernel version specific tools for version 5.19.0-1017 This package provides the architecture dependant parts for kernel version locked tools (such as perf and x86_energy_perf_policy) for - version 5.19.0-1015 on + version 5.19.0-1017 on 64 bit x86. -Package: linux-cloud-tools-5.19.0-1015-kvm +Package: linux-cloud-tools-5.19.0-1017-kvm Build-Profiles: Architecture: amd64 Section: devel Priority: optional -Depends: ${misc:Depends}, linux-kvm-cloud-tools-5.19.0-1015 -Description: Linux kernel version specific cloud tools for version 5.19.0-1015 +Depends: ${misc:Depends}, linux-kvm-cloud-tools-5.19.0-1017 +Description: Linux kernel version specific cloud tools for version 5.19.0-1017 This package provides the architecture dependant parts for kernel - version locked tools for cloud for version 5.19.0-1015 on + version locked tools for cloud for version 5.19.0-1017 on 64 bit x86. -Package: linux-buildinfo-5.19.0-1015-kvm +Package: linux-buildinfo-5.19.0-1017-kvm Build-Profiles: Architecture: amd64 Section: kernel diff -u linux-kvm-5.19.0/debian/scripts/helpers/open linux-kvm-5.19.0/debian/scripts/helpers/open --- linux-kvm-5.19.0/debian/scripts/helpers/open +++ linux-kvm-5.19.0/debian/scripts/helpers/open @@ -138,6 +138,7 @@ # Load the info about derivative BACKPORT_SUFFIX= +BACKPORT_NO_SUFFIX= derivative_conf="$DEBIAN/etc/update.conf" if [ -f "$derivative_conf" ]; then # shellcheck disable=SC1090 @@ -145,7 +146,7 @@ fi # Run the update script used for backport kernels -if [ -n "$BACKPORT_SUFFIX" ]; then +if [ -n "$BACKPORT_SUFFIX" ] || [ -n "$BACKPORT_NO_SUFFIX" ]; then update_from_master_script="$DEBIAN/scripts/helpers/copy-files" if [ ! -x "$update_from_master_script" ]; then echo "Backport kernel is missing the"\ diff -u linux-kvm-5.19.0/debian/tests/ubuntu-regression-suite linux-kvm-5.19.0/debian/tests/ubuntu-regression-suite --- linux-kvm-5.19.0/debian/tests/ubuntu-regression-suite +++ linux-kvm-5.19.0/debian/tests/ubuntu-regression-suite @@ -4,7 +4,7 @@ # Only run regression-suite on kernels we can boot in canonistack source=`dpkg-parsechangelog -SSource` case $source in - linux|linux-unstable|linux-hwe*|linux-kvm|linux-oem) + linux|linux-unstable|linux-hwe*|linux-lowlatency*|linux-kvm|linux-oem) ;; *) echo "ubuntu-regression-suite is pointless, if one cannot boot the kernel" diff -u linux-kvm-5.19.0/drivers/acpi/acpi_pcc.c linux-kvm-5.19.0/drivers/acpi/acpi_pcc.c --- linux-kvm-5.19.0/drivers/acpi/acpi_pcc.c +++ linux-kvm-5.19.0/drivers/acpi/acpi_pcc.c @@ -27,7 +27,7 @@ * Arbitrary retries in case the remote processor is slow to respond * to PCC commands */ -#define PCC_CMD_WAIT_RETRIES_NUM 500 +#define PCC_CMD_WAIT_RETRIES_NUM 500ULL struct pcc_data { struct pcc_mbox_chan *pcc_chan; diff -u linux-kvm-5.19.0/drivers/acpi/apei/ghes.c linux-kvm-5.19.0/drivers/acpi/apei/ghes.c --- linux-kvm-5.19.0/drivers/acpi/apei/ghes.c +++ linux-kvm-5.19.0/drivers/acpi/apei/ghes.c @@ -163,7 +163,7 @@ clear_fixmap(fixmap_idx); } -int ghes_estatus_pool_init(int num_ghes) +int ghes_estatus_pool_init(unsigned int num_ghes) { unsigned long addr, len; int rc; diff -u linux-kvm-5.19.0/drivers/acpi/video_detect.c linux-kvm-5.19.0/drivers/acpi/video_detect.c --- linux-kvm-5.19.0/drivers/acpi/video_detect.c +++ linux-kvm-5.19.0/drivers/acpi/video_detect.c @@ -516,4 +516,68 @@ }, /* + * More Tongfang devices with the same issue as the Clevo NL5xRU and + * NL5xNU/TUXEDO Aura 15 Gen1 and Gen2. See the description above. + */ + { + .callback = video_detect_force_native, + .ident = "TongFang GKxNRxx", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GKxNRxx"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang GKxNRxx", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_MATCH(DMI_BOARD_NAME, "POLARIS1501A1650TI"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang GKxNRxx", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_MATCH(DMI_BOARD_NAME, "POLARIS1501A2060"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang GKxNRxx", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_MATCH(DMI_BOARD_NAME, "POLARIS1701A1650TI"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang GKxNRxx", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_MATCH(DMI_BOARD_NAME, "POLARIS1701A2060"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang GMxNGxx", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GMxNGxx"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang GMxZGxx", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GMxZGxx"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang GMxRGxx", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"), + }, + }, + /* * Desktops which falsely report a backlight and which our heuristics * for this do not catch. diff -u linux-kvm-5.19.0/drivers/base/power/domain.c linux-kvm-5.19.0/drivers/base/power/domain.c --- linux-kvm-5.19.0/drivers/base/power/domain.c +++ linux-kvm-5.19.0/drivers/base/power/domain.c @@ -2950,6 +2950,10 @@ np = it.node; if (!of_match_node(idle_state_match, np)) continue; + + if (!of_device_is_available(np)) + continue; + if (states) { ret = genpd_parse_state(&states[i], np); if (ret) { diff -u linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra114.c linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra114.c --- linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra114.c +++ linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra114.c @@ -1166,6 +1166,7 @@ { TEGRA114_CLK_I2S3_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, { TEGRA114_CLK_I2S4_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, { TEGRA114_CLK_VIMCLK_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA114_CLK_PWM, TEGRA114_CLK_PLL_P, 408000000, 0 }, /* must be the last entry */ { TEGRA114_CLK_CLK_MAX, TEGRA114_CLK_CLK_MAX, 0, 0 }, }; diff -u linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra20.c linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra20.c --- linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra20.c +++ linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra20.c @@ -1044,6 +1044,7 @@ { TEGRA20_CLK_GR2D, TEGRA20_CLK_PLL_C, 300000000, 0 }, { TEGRA20_CLK_GR3D, TEGRA20_CLK_PLL_C, 300000000, 0 }, { TEGRA20_CLK_VDE, TEGRA20_CLK_PLL_C, 300000000, 0 }, + { TEGRA20_CLK_PWM, TEGRA20_CLK_PLL_P, 48000000, 0 }, /* must be the last entry */ { TEGRA20_CLK_CLK_MAX, TEGRA20_CLK_CLK_MAX, 0, 0 }, }; diff -u linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra210.c linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra210.c --- linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra210.c +++ linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra210.c @@ -3597,6 +3597,7 @@ { TEGRA210_CLK_VIMCLK_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, { TEGRA210_CLK_HDA, TEGRA210_CLK_PLL_P, 51000000, 0 }, { TEGRA210_CLK_HDA2CODEC_2X, TEGRA210_CLK_PLL_P, 48000000, 0 }, + { TEGRA210_CLK_PWM, TEGRA210_CLK_PLL_P, 48000000, 0 }, /* This MUST be the last entry. */ { TEGRA210_CLK_CLK_MAX, TEGRA210_CLK_CLK_MAX, 0, 0 }, }; diff -u linux-kvm-5.19.0/drivers/counter/104-quad-8.c linux-kvm-5.19.0/drivers/counter/104-quad-8.c --- linux-kvm-5.19.0/drivers/counter/104-quad-8.c +++ linux-kvm-5.19.0/drivers/counter/104-quad-8.c @@ -231,34 +231,45 @@ COUNTER_FUNCTION_QUADRATURE_X4, }; +static int quad8_function_get(const struct quad8 *const priv, const size_t id, + enum counter_function *const function) +{ + if (!priv->quadrature_mode[id]) { + *function = COUNTER_FUNCTION_PULSE_DIRECTION; + return 0; + } + + switch (priv->quadrature_scale[id]) { + case 0: + *function = COUNTER_FUNCTION_QUADRATURE_X1_A; + return 0; + case 1: + *function = COUNTER_FUNCTION_QUADRATURE_X2_A; + return 0; + case 2: + *function = COUNTER_FUNCTION_QUADRATURE_X4; + return 0; + default: + /* should never reach this path */ + return -EINVAL; + } +} + static int quad8_function_read(struct counter_device *counter, struct counter_count *count, enum counter_function *function) { struct quad8 *const priv = counter_priv(counter); - const int id = count->id; unsigned long irqflags; + int retval; spin_lock_irqsave(&priv->lock, irqflags); - if (priv->quadrature_mode[id]) - switch (priv->quadrature_scale[id]) { - case 0: - *function = COUNTER_FUNCTION_QUADRATURE_X1_A; - break; - case 1: - *function = COUNTER_FUNCTION_QUADRATURE_X2_A; - break; - case 2: - *function = COUNTER_FUNCTION_QUADRATURE_X4; - break; - } - else - *function = COUNTER_FUNCTION_PULSE_DIRECTION; + retval = quad8_function_get(priv, count->id, function); spin_unlock_irqrestore(&priv->lock, irqflags); - return 0; + return retval; } static int quad8_function_write(struct counter_device *counter, @@ -358,6 +369,7 @@ enum counter_synapse_action *action) { struct quad8 *const priv = counter_priv(counter); + unsigned long irqflags; int err; enum counter_function function; const size_t signal_a_id = count->synapses[0].signal->id; @@ -373,9 +385,21 @@ return 0; } - err = quad8_function_read(counter, count, &function); - if (err) + spin_lock_irqsave(&priv->lock, irqflags); + + /* Get Count function and direction atomically */ + err = quad8_function_get(priv, count->id, &function); + if (err) { + spin_unlock_irqrestore(&priv->lock, irqflags); return err; + } + err = quad8_direction_read(counter, count, &direction); + if (err) { + spin_unlock_irqrestore(&priv->lock, irqflags); + return err; + } + + spin_unlock_irqrestore(&priv->lock, irqflags); /* Default action mode */ *action = COUNTER_SYNAPSE_ACTION_NONE; @@ -388,10 +412,6 @@ return 0; case COUNTER_FUNCTION_QUADRATURE_X1_A: if (synapse->signal->id == signal_a_id) { - err = quad8_direction_read(counter, count, &direction); - if (err) - return err; - if (direction == COUNTER_COUNT_DIRECTION_FORWARD) *action = COUNTER_SYNAPSE_ACTION_RISING_EDGE; else diff -u linux-kvm-5.19.0/drivers/cpufreq/amd-pstate.c linux-kvm-5.19.0/drivers/cpufreq/amd-pstate.c --- linux-kvm-5.19.0/drivers/cpufreq/amd-pstate.c +++ linux-kvm-5.19.0/drivers/cpufreq/amd-pstate.c @@ -58,12 +58,8 @@ * we disable it by default to go acpi-cpufreq on these processors and add a * module parameter to be able to enable it manually for debugging. */ -static bool shared_mem = false; -module_param(shared_mem, bool, 0444); -MODULE_PARM_DESC(shared_mem, - "enable amd-pstate on processors with shared memory solution (false = disabled (default), true = enabled)"); - static struct cpufreq_driver amd_pstate_driver; +static int cppc_load __initdata; /** * struct amd_aperf_mperf @@ -483,12 +479,22 @@ amd_pstate_driver.boost_enabled = true; } +static void amd_perf_ctl_reset(unsigned int cpu) +{ + wrmsrl_on_cpu(cpu, MSR_AMD_PERF_CTL, 0); +} + static int amd_pstate_cpu_init(struct cpufreq_policy *policy) { int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; struct device *dev; struct amd_cpudata *cpudata; + /* + * Resetting PERF_CTL_MSR will put the CPU in P0 frequency, + * which is ideal for initialization process. + */ + amd_perf_ctl_reset(policy->cpu); dev = get_cpu_device(policy->cpu); if (!dev) return -ENODEV; @@ -681,6 +687,15 @@ if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) return -ENODEV; + /* + * by default the pstate driver is disabled to load + * enable the amd_pstate passive mode driver explicitly + * with amd_pstate=passive in kernel command line + */ + if (!cppc_load) { + pr_debug("driver load is disabled, boot with amd_pstate=passive to enable this\n"); + return -ENODEV; + } if (!acpi_cpc_valid()) { pr_debug("the _CPC object is not present in SBIOS\n"); @@ -695,13 +710,11 @@ if (boot_cpu_has(X86_FEATURE_CPPC)) { pr_debug("AMD CPPC MSR based functionality is supported\n"); amd_pstate_driver.adjust_perf = amd_pstate_adjust_perf; - } else if (shared_mem) { + } else { + pr_debug("AMD CPPC shared memory based functionality is supported\n"); static_call_update(amd_pstate_enable, cppc_enable); static_call_update(amd_pstate_init_perf, cppc_init_perf); static_call_update(amd_pstate_update_perf, cppc_update_perf); - } else { - pr_info("This processor supports shared memory solution, you can enable it with amd_pstate.shared_mem=1\n"); - return -ENODEV; } /* enable amd pstate feature */ @@ -718,16 +731,22 @@ return ret; } +device_initcall(amd_pstate_init); -static void __exit amd_pstate_exit(void) +static int __init amd_pstate_param(char *str) { - cpufreq_unregister_driver(&amd_pstate_driver); + if (!str) + return -EINVAL; - amd_pstate_enable(false); -} + if (!strcmp(str, "disable")) { + cppc_load = 0; + pr_info("driver is explicitly disabled\n"); + } else if (!strcmp(str, "passive")) + cppc_load = 1; -module_init(amd_pstate_init); -module_exit(amd_pstate_exit); + return 0; +} +early_param("amd_pstate", amd_pstate_param); MODULE_AUTHOR("Huang Rui "); MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver"); diff -u linux-kvm-5.19.0/drivers/cpufreq/intel_pstate.c linux-kvm-5.19.0/drivers/cpufreq/intel_pstate.c --- linux-kvm-5.19.0/drivers/cpufreq/intel_pstate.c +++ linux-kvm-5.19.0/drivers/cpufreq/intel_pstate.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -280,10 +281,10 @@ * structure is used to store those callbacks. */ struct pstate_funcs { - int (*get_max)(void); - int (*get_max_physical)(void); - int (*get_min)(void); - int (*get_turbo)(void); + int (*get_max)(int cpu); + int (*get_max_physical)(int cpu); + int (*get_min)(int cpu); + int (*get_turbo)(int cpu); int (*get_scaling)(void); int (*get_cpu_scaling)(int cpu); int (*get_aperf_mperf_shift)(void); @@ -398,16 +399,6 @@ return cppc_perf.nominal_perf; } - -static u32 intel_pstate_cppc_nominal(int cpu) -{ - u64 nominal_perf; - - if (cppc_get_nominal_perf(cpu, &nominal_perf)) - return 0; - - return nominal_perf; -} #else /* CONFIG_ACPI_CPPC_LIB */ static inline void intel_pstate_set_itmt_prio(int cpu) { @@ -531,35 +522,18 @@ { int perf_ctl_max_phys = cpu->pstate.max_pstate_physical; int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling; - int perf_ctl_turbo = pstate_funcs.get_turbo(); - int turbo_freq = perf_ctl_turbo * perf_ctl_scaling; + int perf_ctl_turbo = pstate_funcs.get_turbo(cpu->cpu); int scaling = cpu->pstate.scaling; pr_debug("CPU%d: perf_ctl_max_phys = %d\n", cpu->cpu, perf_ctl_max_phys); - pr_debug("CPU%d: perf_ctl_max = %d\n", cpu->cpu, pstate_funcs.get_max()); pr_debug("CPU%d: perf_ctl_turbo = %d\n", cpu->cpu, perf_ctl_turbo); pr_debug("CPU%d: perf_ctl_scaling = %d\n", cpu->cpu, perf_ctl_scaling); pr_debug("CPU%d: HWP_CAP guaranteed = %d\n", cpu->cpu, cpu->pstate.max_pstate); pr_debug("CPU%d: HWP_CAP highest = %d\n", cpu->cpu, cpu->pstate.turbo_pstate); pr_debug("CPU%d: HWP-to-frequency scaling factor: %d\n", cpu->cpu, scaling); - /* - * If the product of the HWP performance scaling factor and the HWP_CAP - * highest performance is greater than the maximum turbo frequency - * corresponding to the pstate_funcs.get_turbo() return value, the - * scaling factor is too high, so recompute it to make the HWP_CAP - * highest performance correspond to the maximum turbo frequency. - */ - cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * scaling; - if (turbo_freq < cpu->pstate.turbo_freq) { - cpu->pstate.turbo_freq = turbo_freq; - scaling = DIV_ROUND_UP(turbo_freq, cpu->pstate.turbo_pstate); - cpu->pstate.scaling = scaling; - - pr_debug("CPU%d: refined HWP-to-frequency scaling factor: %d\n", - cpu->cpu, scaling); - } - + cpu->pstate.turbo_freq = rounddown(cpu->pstate.turbo_pstate * scaling, + perf_ctl_scaling); cpu->pstate.max_freq = rounddown(cpu->pstate.max_pstate * scaling, perf_ctl_scaling); @@ -1740,7 +1714,7 @@ intel_pstate_update_epp_defaults(cpudata); } -static int atom_get_min_pstate(void) +static int atom_get_min_pstate(int not_used) { u64 value; @@ -1748,7 +1722,7 @@ return (value >> 8) & 0x7F; } -static int atom_get_max_pstate(void) +static int atom_get_max_pstate(int not_used) { u64 value; @@ -1756,7 +1730,7 @@ return (value >> 16) & 0x7F; } -static int atom_get_turbo_pstate(void) +static int atom_get_turbo_pstate(int not_used) { u64 value; @@ -1834,23 +1808,23 @@ cpudata->vid.turbo = value & 0x7f; } -static int core_get_min_pstate(void) +static int core_get_min_pstate(int cpu) { u64 value; - rdmsrl(MSR_PLATFORM_INFO, value); + rdmsrl_on_cpu(cpu, MSR_PLATFORM_INFO, &value); return (value >> 40) & 0xFF; } -static int core_get_max_pstate_physical(void) +static int core_get_max_pstate_physical(int cpu) { u64 value; - rdmsrl(MSR_PLATFORM_INFO, value); + rdmsrl_on_cpu(cpu, MSR_PLATFORM_INFO, &value); return (value >> 8) & 0xFF; } -static int core_get_tdp_ratio(u64 plat_info) +static int core_get_tdp_ratio(int cpu, u64 plat_info) { /* Check how many TDP levels present */ if (plat_info & 0x600000000) { @@ -1860,13 +1834,13 @@ int err; /* Get the TDP level (0, 1, 2) to get ratios */ - err = rdmsrl_safe(MSR_CONFIG_TDP_CONTROL, &tdp_ctrl); + err = rdmsrl_safe_on_cpu(cpu, MSR_CONFIG_TDP_CONTROL, &tdp_ctrl); if (err) return err; /* TDP MSR are continuous starting at 0x648 */ tdp_msr = MSR_CONFIG_TDP_NOMINAL + (tdp_ctrl & 0x03); - err = rdmsrl_safe(tdp_msr, &tdp_ratio); + err = rdmsrl_safe_on_cpu(cpu, tdp_msr, &tdp_ratio); if (err) return err; @@ -1883,7 +1857,7 @@ return -ENXIO; } -static int core_get_max_pstate(void) +static int core_get_max_pstate(int cpu) { u64 tar; u64 plat_info; @@ -1891,10 +1865,10 @@ int tdp_ratio; int err; - rdmsrl(MSR_PLATFORM_INFO, plat_info); + rdmsrl_on_cpu(cpu, MSR_PLATFORM_INFO, &plat_info); max_pstate = (plat_info >> 8) & 0xFF; - tdp_ratio = core_get_tdp_ratio(plat_info); + tdp_ratio = core_get_tdp_ratio(cpu, plat_info); if (tdp_ratio <= 0) return max_pstate; @@ -1903,7 +1877,7 @@ return tdp_ratio; } - err = rdmsrl_safe(MSR_TURBO_ACTIVATION_RATIO, &tar); + err = rdmsrl_safe_on_cpu(cpu, MSR_TURBO_ACTIVATION_RATIO, &tar); if (!err) { int tar_levels; @@ -1918,13 +1892,13 @@ return max_pstate; } -static int core_get_turbo_pstate(void) +static int core_get_turbo_pstate(int cpu) { u64 value; int nont, ret; - rdmsrl(MSR_TURBO_RATIO_LIMIT, value); - nont = core_get_max_pstate(); + rdmsrl_on_cpu(cpu, MSR_TURBO_RATIO_LIMIT, &value); + nont = core_get_max_pstate(cpu); ret = (value) & 255; if (ret <= nont) ret = nont; @@ -1952,50 +1926,37 @@ return 10; } -static int knl_get_turbo_pstate(void) +static int knl_get_turbo_pstate(int cpu) { u64 value; int nont, ret; - rdmsrl(MSR_TURBO_RATIO_LIMIT, value); - nont = core_get_max_pstate(); + rdmsrl_on_cpu(cpu, MSR_TURBO_RATIO_LIMIT, &value); + nont = core_get_max_pstate(cpu); ret = (((value) >> 8) & 0xFF); if (ret <= nont) ret = nont; return ret; } -#ifdef CONFIG_ACPI_CPPC_LIB -static u32 hybrid_ref_perf; - -static int hybrid_get_cpu_scaling(int cpu) +static void hybrid_get_type(void *data) { - return DIV_ROUND_UP(core_get_scaling() * hybrid_ref_perf, - intel_pstate_cppc_nominal(cpu)); + u8 *cpu_type = data; + + *cpu_type = get_this_hybrid_cpu_type(); } -static void intel_pstate_cppc_set_cpu_scaling(void) +static int hybrid_get_cpu_scaling(int cpu) { - u32 min_nominal_perf = U32_MAX; - int cpu; - - for_each_present_cpu(cpu) { - u32 nominal_perf = intel_pstate_cppc_nominal(cpu); + u8 cpu_type = 0; - if (nominal_perf && nominal_perf < min_nominal_perf) - min_nominal_perf = nominal_perf; - } + smp_call_function_single(cpu, hybrid_get_type, &cpu_type, 1); + /* P-cores have a smaller perf level-to-freqency scaling factor. */ + if (cpu_type == 0x40) + return 78741; - if (min_nominal_perf < U32_MAX) { - hybrid_ref_perf = min_nominal_perf; - pstate_funcs.get_cpu_scaling = hybrid_get_cpu_scaling; - } -} -#else -static inline void intel_pstate_cppc_set_cpu_scaling(void) -{ + return core_get_scaling(); } -#endif /* CONFIG_ACPI_CPPC_LIB */ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate) { @@ -2025,10 +1986,10 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) { - int perf_ctl_max_phys = pstate_funcs.get_max_physical(); + int perf_ctl_max_phys = pstate_funcs.get_max_physical(cpu->cpu); int perf_ctl_scaling = pstate_funcs.get_scaling(); - cpu->pstate.min_pstate = pstate_funcs.get_min(); + cpu->pstate.min_pstate = pstate_funcs.get_min(cpu->cpu); cpu->pstate.max_pstate_physical = perf_ctl_max_phys; cpu->pstate.perf_ctl_scaling = perf_ctl_scaling; @@ -2044,8 +2005,8 @@ } } else { cpu->pstate.scaling = perf_ctl_scaling; - cpu->pstate.max_pstate = pstate_funcs.get_max(); - cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(); + cpu->pstate.max_pstate = pstate_funcs.get_max(cpu->cpu); + cpu->pstate.turbo_pstate = pstate_funcs.get_turbo(cpu->cpu); } if (cpu->pstate.scaling == perf_ctl_scaling) { @@ -3221,9 +3182,9 @@ static int __init intel_pstate_msrs_not_valid(void) { - if (!pstate_funcs.get_max() || - !pstate_funcs.get_min() || - !pstate_funcs.get_turbo()) + if (!pstate_funcs.get_max(0) || + !pstate_funcs.get_min(0) || + !pstate_funcs.get_turbo(0)) return -ENODEV; return 0; @@ -3450,7 +3411,7 @@ default_driver = &intel_pstate; if (boot_cpu_has(X86_FEATURE_HYBRID_CPU)) - intel_pstate_cppc_set_cpu_scaling(); + pstate_funcs.get_cpu_scaling = hybrid_get_cpu_scaling; goto hwp_cpu_matched; } diff -u linux-kvm-5.19.0/drivers/dma/dw-edma/dw-edma-core.c linux-kvm-5.19.0/drivers/dma/dw-edma/dw-edma-core.c --- linux-kvm-5.19.0/drivers/dma/dw-edma/dw-edma-core.c +++ linux-kvm-5.19.0/drivers/dma/dw-edma/dw-edma-core.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -663,15 +662,12 @@ if (chan->status != EDMA_ST_IDLE) return -EBUSY; - pm_runtime_get(chan->chip->dev); - return 0; } static void dw_edma_free_chan_resources(struct dma_chan *dchan) { unsigned long timeout = jiffies + msecs_to_jiffies(5000); - struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan); int ret; while (time_before(jiffies, timeout)) { @@ -684,8 +680,6 @@ cpu_relax(); } - - pm_runtime_put(chan->chip->dev); } static int dw_edma_channel_setup(struct dw_edma_chip *chip, bool write, @@ -950,9 +944,6 @@ if (err) goto err_irq_free; - /* Power management */ - pm_runtime_enable(dev); - /* Turn debugfs on */ dw_edma_v0_core_debugfs_on(chip); @@ -982,9 +973,6 @@ for (i = (dw->nr_irqs - 1); i >= 0; i--) free_irq(dw->ops->irq_vector(dev, i), &dw->irq[i]); - /* Power management */ - pm_runtime_disable(dev); - /* Deregister eDMA device */ dma_async_device_unregister(&dw->wr_edma); list_for_each_entry_safe(chan, _chan, &dw->wr_edma.channels, diff -u linux-kvm-5.19.0/drivers/firmware/efi/efi.c linux-kvm-5.19.0/drivers/firmware/efi/efi.c --- linux-kvm-5.19.0/drivers/firmware/efi/efi.c +++ linux-kvm-5.19.0/drivers/firmware/efi/efi.c @@ -605,7 +605,7 @@ seed = early_memremap(efi_rng_seed, sizeof(*seed)); if (seed != NULL) { - size = READ_ONCE(seed->size); + size = min(seed->size, EFI_RANDOM_SEED_SIZE); early_memunmap(seed, sizeof(*seed)); } else { pr_err("Could not map UEFI random seed!\n"); diff -u linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c --- linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -326,7 +326,10 @@ if (r) return r; - ctx->stable_pstate = current_stable_pstate; + if (mgr->adev->pm.stable_pstate_ctx) + ctx->stable_pstate = mgr->adev->pm.stable_pstate_ctx->stable_pstate; + else + ctx->stable_pstate = current_stable_pstate; return 0; } diff -u linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c --- linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -2952,6 +2952,14 @@ amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE); amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE); + /* + * Per PMFW team's suggestion, driver needs to handle gfxoff + * and df cstate features disablement for gpu reset(e.g. Mode1Reset) + * scenario. Add the missing df cstate disablement here. + */ + if (amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_DISALLOW)) + dev_warn(adev->dev, "Failed to disallow df cstate"); + for (i = adev->num_ip_blocks - 1; i >= 0; i--) { if (!adev->ip_blocks[i].status.valid) continue; @@ -3226,6 +3234,15 @@ return r; } adev->ip_blocks[i].status.hw = true; + + if (adev->in_s0ix && adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) { + /* disable gfxoff for IP resume. The gfxoff will be re-enabled in + * amdgpu_device_resume() after IP resume. + */ + amdgpu_gfx_off_ctrl(adev, false); + DRM_DEBUG("will disable gfxoff for re-initializing other blocks\n"); + } + } return 0; @@ -4144,6 +4161,13 @@ drm_kms_helper_poll_disable(dev); + if (adev->in_s0ix) { + /* re-enable gfxoff after IP resume. This re-enables gfxoff after + * it was disabled for IP resume in amdgpu_device_ip_resume_phase2(). + */ + amdgpu_gfx_off_ctrl(adev, true); + DRM_DEBUG("will enable gfxoff for the mission mode\n"); + } if (fbcon) drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, true); diff -u linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c --- linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -1864,7 +1864,7 @@ WREG32_SOC15(GC, 0, regSH_MEM_BASES, sh_mem_bases); /* Enable trap for each kfd vmid. */ - data = RREG32(SOC15_REG_OFFSET(GC, 0, regSPI_GDBG_PER_VMID_CNTL)); + data = RREG32_SOC15(GC, 0, regSPI_GDBG_PER_VMID_CNTL); data = REG_SET_FIELD(data, SPI_GDBG_PER_VMID_CNTL, TRAP_EN, 1); } soc21_grbm_select(adev, 0, 0, 0, 0); reverted: --- linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +++ linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c @@ -1504,11 +1504,6 @@ WREG32_SDMA(i, mmSDMA0_CNTL, temp); if (!amdgpu_sriov_vf(adev)) { - ring = &adev->sdma.instance[i].ring; - adev->nbio.funcs->sdma_doorbell_range(adev, i, - ring->use_doorbell, ring->doorbell_index, - adev->doorbell_index.sdma_doorbell_range); - /* unhalt engine */ temp = RREG32_SDMA(i, mmSDMA0_F32_CNTL); temp = REG_SET_FIELD(temp, SDMA0_F32_CNTL, HALT, 0); diff -u linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/soc15.c linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/soc15.c --- linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/soc15.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -1211,6 +1211,20 @@ return 0; } +static void soc15_sdma_doorbell_range_init(struct amdgpu_device *adev) +{ + int i; + + /* sdma doorbell range is programed by hypervisor */ + if (!amdgpu_sriov_vf(adev)) { + for (i = 0; i < adev->sdma.num_instances; i++) { + adev->nbio.funcs->sdma_doorbell_range(adev, i, + true, adev->doorbell_index.sdma_engine[i] << 1, + adev->doorbell_index.sdma_doorbell_range); + } + } +} + static int soc15_common_hw_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; @@ -1230,6 +1244,13 @@ /* enable the doorbell aperture */ soc15_enable_doorbell_aperture(adev, true); + /* HW doorbell routing policy: doorbell writing not + * in SDMA/IH/MM/ACV range will be routed to CP. So + * we need to init SDMA doorbell range prior + * to CP ip block init and ring test. IH already + * happens before CP. + */ + soc15_sdma_doorbell_range_init(adev); return 0; } diff -u linux-kvm-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c linux-kvm-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c --- linux-kvm-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1141,7 +1141,8 @@ hw_params.fb[i] = &fb_info->fb[i]; switch (adev->ip_versions[DCE_HWIP][0]) { - case IP_VERSION(3, 1, 3): /* Only for this asic hw internal rev B0 */ + case IP_VERSION(3, 1, 3): + case IP_VERSION(3, 1, 4): hw_params.dpia_supported = true; hw_params.disable_dpia = adev->dm.dc->debug.dpia_debug.bits.disable_dpia; break; diff -u linux-kvm-5.19.0/drivers/gpu/drm/bridge/analogix/anx7625.c linux-kvm-5.19.0/drivers/gpu/drm/bridge/analogix/anx7625.c --- linux-kvm-5.19.0/drivers/gpu/drm/bridge/analogix/anx7625.c +++ linux-kvm-5.19.0/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1624,6 +1624,7 @@ anx7625_get_swing_setting(dev, pdata); pdata->is_dpi = 1; /* default dpi mode */ + of_node_put(pdata->mipi_host_node); pdata->mipi_host_node = of_graph_get_remote_node(np, 0, 0); if (!pdata->mipi_host_node) { DRM_DEV_ERROR(dev, "fail to get internal panel.\n"); diff -u linux-kvm-5.19.0/drivers/gpu/drm/i915/display/intel_dp.c linux-kvm-5.19.0/drivers/gpu/drm/i915/display/intel_dp.c --- linux-kvm-5.19.0/drivers/gpu/drm/i915/display/intel_dp.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/display/intel_dp.c @@ -3883,6 +3883,8 @@ drm_dp_pcon_hdmi_frl_link_error_count(&intel_dp->aux, &intel_dp->attached_connector->base); + intel_dp->frl.is_trained = false; + /* Restart FRL training or fall back to TMDS mode */ intel_dp_check_frl_training(intel_dp); } diff -u linux-kvm-5.19.0/drivers/gpu/drm/msm/dp/dp_ctrl.c linux-kvm-5.19.0/drivers/gpu/drm/msm/dp/dp_ctrl.c --- linux-kvm-5.19.0/drivers/gpu/drm/msm/dp/dp_ctrl.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/dp/dp_ctrl.c @@ -1245,8 +1245,7 @@ { int ret = 0; const u8 *dpcd = ctrl->panel->dpcd; - u8 encoding = DP_SET_ANSI_8B10B; - u8 ssc; + u8 encoding[] = { 0, DP_SET_ANSI_8B10B }; u8 assr; struct dp_link_info link_info = {0}; @@ -1258,13 +1257,11 @@ dp_aux_link_configure(ctrl->aux, &link_info); - if (drm_dp_max_downspread(dpcd)) { - ssc = DP_SPREAD_AMP_0_5; - drm_dp_dpcd_write(ctrl->aux, DP_DOWNSPREAD_CTRL, &ssc, 1); - } + if (drm_dp_max_downspread(dpcd)) + encoding[0] |= DP_SPREAD_AMP_0_5; - drm_dp_dpcd_write(ctrl->aux, DP_MAIN_LINK_CHANNEL_CODING_SET, - &encoding, 1); + /* config DOWNSPREAD_CTRL and MAIN_LINK_CHANNEL_CODING_SET */ + drm_dp_dpcd_write(ctrl->aux, DP_DOWNSPREAD_CTRL, encoding, 2); if (drm_dp_alternate_scrambler_reset_cap(dpcd)) { assr = DP_ALTERNATE_SCRAMBLER_RESET_ENABLE; diff -u linux-kvm-5.19.0/drivers/gpu/drm/msm/hdmi/hdmi.c linux-kvm-5.19.0/drivers/gpu/drm/msm/hdmi/hdmi.c --- linux-kvm-5.19.0/drivers/gpu/drm/msm/hdmi/hdmi.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -281,6 +281,11 @@ struct platform_device *pdev = hdmi->pdev; int ret; + if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) { + DRM_DEV_ERROR(dev->dev, "too many bridges\n"); + return -ENOSPC; + } + hdmi->dev = dev; hdmi->encoder = encoder; @@ -311,7 +316,7 @@ goto fail; } - ret = devm_request_irq(&pdev->dev, hdmi->irq, + ret = devm_request_irq(dev->dev, hdmi->irq, msm_hdmi_irq, IRQF_TRIGGER_HIGH, "hdmi_isr", hdmi); if (ret < 0) { diff -u linux-kvm-5.19.0/drivers/gpu/drm/msm/msm_drv.c linux-kvm-5.19.0/drivers/gpu/drm/msm/msm_drv.c --- linux-kvm-5.19.0/drivers/gpu/drm/msm/msm_drv.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/msm_drv.c @@ -240,6 +240,7 @@ for (i = 0; i < priv->num_bridges; i++) drm_bridge_remove(priv->bridges[i]); + priv->num_bridges = 0; pm_runtime_get_sync(dev); msm_irq_uninstall(ddev); diff -u linux-kvm-5.19.0/drivers/gpu/drm/panel/Kconfig linux-kvm-5.19.0/drivers/gpu/drm/panel/Kconfig --- linux-kvm-5.19.0/drivers/gpu/drm/panel/Kconfig +++ linux-kvm-5.19.0/drivers/gpu/drm/panel/Kconfig @@ -154,8 +154,8 @@ config DRM_PANEL_ILITEK_ILI9341 tristate "Ilitek ILI9341 240x320 QVGA panels" depends on OF && SPI - depends on DRM_KMS_HELPER - depends on DRM_GEM_CMA_HELPER + select DRM_KMS_HELPER + select DRM_GEM_DMA_HELPER depends on BACKLIGHT_CLASS_DEVICE select DRM_MIPI_DBI help diff -u linux-kvm-5.19.0/drivers/gpu/drm/vc4/vc4_hdmi.c linux-kvm-5.19.0/drivers/gpu/drm/vc4/vc4_hdmi.c --- linux-kvm-5.19.0/drivers/gpu/drm/vc4/vc4_hdmi.c +++ linux-kvm-5.19.0/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -2889,12 +2889,37 @@ struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); unsigned long __maybe_unused flags; u32 __maybe_unused value; + unsigned long rate; int ret; + /* + * The HSM clock is in the HDMI power domain, so we need to set + * its frequency while the power domain is active so that it + * keeps its rate. + */ + ret = clk_set_min_rate(vc4_hdmi->hsm_clock, HSM_MIN_CLOCK_FREQ); + if (ret) + return ret; + ret = clk_prepare_enable(vc4_hdmi->hsm_clock); if (ret) return ret; + /* + * Whenever the RaspberryPi boots without an HDMI monitor + * plugged in, the firmware won't have initialized the HSM clock + * rate and it will be reported as 0. + * + * If we try to access a register of the controller in such a + * case, it will lead to a silent CPU stall. Let's make sure we + * prevent such a case. + */ + rate = clk_get_rate(vc4_hdmi->hsm_clock); + if (!rate) { + ret = -EINVAL; + goto err_disable_clk; + } + if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); @@ -2916,6 +2941,10 @@ #endif return 0; + +err_disable_clk: + clk_disable_unprepare(vc4_hdmi->hsm_clock); + return ret; } static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) diff -u linux-kvm-5.19.0/drivers/hid/hid-ids.h linux-kvm-5.19.0/drivers/hid/hid-ids.h --- linux-kvm-5.19.0/drivers/hid/hid-ids.h +++ linux-kvm-5.19.0/drivers/hid/hid-ids.h @@ -867,6 +867,7 @@ #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 #define USB_DEVICE_ID_MADCATZ_RAT5 0x1705 #define USB_DEVICE_ID_MADCATZ_RAT9 0x1709 +#define USB_DEVICE_ID_MADCATZ_MMO7 0x1713 #define USB_VENDOR_ID_MCC 0x09db #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 @@ -1142,6 +1143,7 @@ #define USB_DEVICE_ID_SONY_PS4_CONTROLLER_2 0x09cc #define USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE 0x0ba0 #define USB_DEVICE_ID_SONY_PS5_CONTROLLER 0x0ce6 +#define USB_DEVICE_ID_SONY_PS5_CONTROLLER_2 0x0df2 #define USB_DEVICE_ID_SONY_MOTION_CONTROLLER 0x03d5 #define USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER 0x042f #define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER 0x0002 @@ -1231,6 +1233,9 @@ #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 #define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203 +#define USB_VENDOR_ID_TOPRE 0x0853 +#define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108 0x0148 + #define USB_VENDOR_ID_TOPSEED 0x0766 #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 diff -u linux-kvm-5.19.0/drivers/hid/hid-quirks.c linux-kvm-5.19.0/drivers/hid/hid-quirks.c --- linux-kvm-5.19.0/drivers/hid/hid-quirks.c +++ linux-kvm-5.19.0/drivers/hid/hid-quirks.c @@ -620,6 +620,7 @@ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5) }, { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_MMO7) }, #endif #if IS_ENABLED(CONFIG_HID_SAMSUNG) { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, diff -u linux-kvm-5.19.0/drivers/iio/accel/adxl367.c linux-kvm-5.19.0/drivers/iio/accel/adxl367.c --- linux-kvm-5.19.0/drivers/iio/accel/adxl367.c +++ linux-kvm-5.19.0/drivers/iio/accel/adxl367.c @@ -1211,17 +1211,30 @@ return sysfs_emit(buf, "%d\n", fifo_watermark); } -static IIO_CONST_ATTR(hwfifo_watermark_min, "1"); -static IIO_CONST_ATTR(hwfifo_watermark_max, - __stringify(ADXL367_FIFO_MAX_WATERMARK)); +static ssize_t hwfifo_watermark_min_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sysfs_emit(buf, "%s\n", "1"); +} + +static ssize_t hwfifo_watermark_max_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sysfs_emit(buf, "%s\n", __stringify(ADXL367_FIFO_MAX_WATERMARK)); +} + +static IIO_DEVICE_ATTR_RO(hwfifo_watermark_min, 0); +static IIO_DEVICE_ATTR_RO(hwfifo_watermark_max, 0); static IIO_DEVICE_ATTR(hwfifo_watermark, 0444, adxl367_get_fifo_watermark, NULL, 0); static IIO_DEVICE_ATTR(hwfifo_enabled, 0444, adxl367_get_fifo_enabled, NULL, 0); static const struct attribute *adxl367_fifo_attributes[] = { - &iio_const_attr_hwfifo_watermark_min.dev_attr.attr, - &iio_const_attr_hwfifo_watermark_max.dev_attr.attr, + &iio_dev_attr_hwfifo_watermark_min.dev_attr.attr, + &iio_dev_attr_hwfifo_watermark_max.dev_attr.attr, &iio_dev_attr_hwfifo_watermark.dev_attr.attr, &iio_dev_attr_hwfifo_enabled.dev_attr.attr, NULL, diff -u linux-kvm-5.19.0/drivers/iio/industrialio-core.c linux-kvm-5.19.0/drivers/iio/industrialio-core.c --- linux-kvm-5.19.0/drivers/iio/industrialio-core.c +++ linux-kvm-5.19.0/drivers/iio/industrialio-core.c @@ -1647,6 +1647,8 @@ iio_device_detach_buffers(indio_dev); + lockdep_unregister_key(&iio_dev_opaque->mlock_key); + ida_simple_remove(&iio_ida, iio_dev_opaque->id); kfree(iio_dev_opaque); } @@ -1706,6 +1708,9 @@ INIT_LIST_HEAD(&iio_dev_opaque->buffer_list); INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers); + lockdep_register_key(&iio_dev_opaque->mlock_key); + lockdep_set_class(&indio_dev->mlock, &iio_dev_opaque->mlock_key); + return indio_dev; } EXPORT_SYMBOL(iio_device_alloc); diff -u linux-kvm-5.19.0/drivers/iio/temperature/ltc2983.c linux-kvm-5.19.0/drivers/iio/temperature/ltc2983.c --- linux-kvm-5.19.0/drivers/iio/temperature/ltc2983.c +++ linux-kvm-5.19.0/drivers/iio/temperature/ltc2983.c @@ -1385,13 +1385,6 @@ return ret; } - st->iio_chan = devm_kzalloc(&st->spi->dev, - st->iio_channels * sizeof(*st->iio_chan), - GFP_KERNEL); - - if (!st->iio_chan) - return -ENOMEM; - ret = regmap_update_bits(st->regmap, LTC2983_GLOBAL_CONFIG_REG, LTC2983_NOTCH_FREQ_MASK, LTC2983_NOTCH_FREQ(st->filter_notch_freq)); @@ -1514,6 +1507,12 @@ gpiod_set_value_cansleep(gpio, 0); } + st->iio_chan = devm_kzalloc(&spi->dev, + st->iio_channels * sizeof(*st->iio_chan), + GFP_KERNEL); + if (!st->iio_chan) + return -ENOMEM; + ret = ltc2983_setup(st, true); if (ret) return ret; diff -u linux-kvm-5.19.0/drivers/infiniband/core/cma.c linux-kvm-5.19.0/drivers/infiniband/core/cma.c --- linux-kvm-5.19.0/drivers/infiniband/core/cma.c +++ linux-kvm-5.19.0/drivers/infiniband/core/cma.c @@ -1434,7 +1434,7 @@ return false; memset(&fl4, 0, sizeof(fl4)); - fl4.flowi4_iif = net_dev->ifindex; + fl4.flowi4_oif = net_dev->ifindex; fl4.daddr = daddr; fl4.saddr = saddr; diff -u linux-kvm-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c linux-kvm-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c --- linux-kvm-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ linux-kvm-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -82,7 +82,6 @@ HR_OPC_MAP(ATOMIC_CMP_AND_SWP, ATOM_CMP_AND_SWAP), HR_OPC_MAP(ATOMIC_FETCH_AND_ADD, ATOM_FETCH_AND_ADD), HR_OPC_MAP(SEND_WITH_INV, SEND_WITH_INV), - HR_OPC_MAP(LOCAL_INV, LOCAL_INV), HR_OPC_MAP(MASKED_ATOMIC_CMP_AND_SWP, ATOM_MSK_CMP_AND_SWAP), HR_OPC_MAP(MASKED_ATOMIC_FETCH_AND_ADD, ATOM_MSK_FETCH_AND_ADD), HR_OPC_MAP(REG_MR, FAST_REG_PMR), @@ -524,9 +523,6 @@ else ret = -EOPNOTSUPP; break; - case IB_WR_LOCAL_INV: - hr_reg_enable(rc_sq_wqe, RC_SEND_WQE_SO); - fallthrough; case IB_WR_SEND_WITH_INV: rc_sq_wqe->inv_key = cpu_to_le32(wr->ex.invalidate_rkey); break; @@ -2773,8 +2769,12 @@ static int free_mr_init(struct hns_roce_dev *hr_dev) { + struct hns_roce_v2_priv *priv = hr_dev->priv; + struct hns_roce_v2_free_mr *free_mr = &priv->free_mr; int ret; + mutex_init(&free_mr->mutex); + ret = free_mr_alloc_res(hr_dev); if (ret) return ret; @@ -3190,7 +3190,6 @@ hr_reg_write(mpt_entry, MPT_ST, V2_MPT_ST_VALID); hr_reg_write(mpt_entry, MPT_PD, mr->pd); - hr_reg_enable(mpt_entry, MPT_L_INV_EN); hr_reg_write_bool(mpt_entry, MPT_BIND_EN, mr->access & IB_ACCESS_MW_BIND); @@ -3281,7 +3280,6 @@ hr_reg_enable(mpt_entry, MPT_RA_EN); hr_reg_enable(mpt_entry, MPT_R_INV_EN); - hr_reg_enable(mpt_entry, MPT_L_INV_EN); hr_reg_enable(mpt_entry, MPT_FRE); hr_reg_clear(mpt_entry, MPT_MR_MW); @@ -3313,7 +3311,6 @@ hr_reg_write(mpt_entry, MPT_PD, mw->pdn); hr_reg_enable(mpt_entry, MPT_R_INV_EN); - hr_reg_enable(mpt_entry, MPT_L_INV_EN); hr_reg_enable(mpt_entry, MPT_LW_EN); hr_reg_enable(mpt_entry, MPT_MR_MW); @@ -3762,7 +3759,6 @@ HR_WC_OP_MAP(RDMA_READ, RDMA_READ), HR_WC_OP_MAP(RDMA_WRITE, RDMA_WRITE), HR_WC_OP_MAP(RDMA_WRITE_WITH_IMM, RDMA_WRITE), - HR_WC_OP_MAP(LOCAL_INV, LOCAL_INV), HR_WC_OP_MAP(ATOM_CMP_AND_SWAP, COMP_SWAP), HR_WC_OP_MAP(ATOM_FETCH_AND_ADD, FETCH_ADD), HR_WC_OP_MAP(ATOM_MSK_CMP_AND_SWAP, MASKED_COMP_SWAP), @@ -3812,9 +3808,6 @@ case HNS_ROCE_V2_WQE_OP_RDMA_WRITE_WITH_IMM: wc->wc_flags |= IB_WC_WITH_IMM; break; - case HNS_ROCE_V2_WQE_OP_LOCAL_INV: - wc->wc_flags |= IB_WC_WITH_INVALIDATE; - break; case HNS_ROCE_V2_WQE_OP_ATOM_CMP_AND_SWAP: case HNS_ROCE_V2_WQE_OP_ATOM_FETCH_AND_ADD: case HNS_ROCE_V2_WQE_OP_ATOM_MSK_CMP_AND_SWAP: diff -u linux-kvm-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.h linux-kvm-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.h --- linux-kvm-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.h +++ linux-kvm-5.19.0/drivers/infiniband/hw/hns/hns_roce_hw_v2.h @@ -182,7 +182,6 @@ HNS_ROCE_V2_WQE_OP_ATOM_MSK_CMP_AND_SWAP = 0x8, HNS_ROCE_V2_WQE_OP_ATOM_MSK_FETCH_AND_ADD = 0x9, HNS_ROCE_V2_WQE_OP_FAST_REG_PMR = 0xa, - HNS_ROCE_V2_WQE_OP_LOCAL_INV = 0xb, HNS_ROCE_V2_WQE_OP_BIND_MW = 0xc, HNS_ROCE_V2_WQE_OP_MASK = 0x1f, }; @@ -915,7 +914,6 @@ #define RC_SEND_WQE_OWNER RC_SEND_WQE_FIELD_LOC(7, 7) #define RC_SEND_WQE_CQE RC_SEND_WQE_FIELD_LOC(8, 8) #define RC_SEND_WQE_FENCE RC_SEND_WQE_FIELD_LOC(9, 9) -#define RC_SEND_WQE_SO RC_SEND_WQE_FIELD_LOC(10, 10) #define RC_SEND_WQE_SE RC_SEND_WQE_FIELD_LOC(11, 11) #define RC_SEND_WQE_INLINE RC_SEND_WQE_FIELD_LOC(12, 12) #define RC_SEND_WQE_WQE_INDEX RC_SEND_WQE_FIELD_LOC(30, 15) diff -u linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_loc.h linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_loc.h --- linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_loc.h +++ linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_loc.h @@ -64,10 +64,10 @@ /* rxe_mr.c */ u8 rxe_get_next_key(u32 last_key); -void rxe_mr_init_dma(struct rxe_pd *pd, int access, struct rxe_mr *mr); -int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, +void rxe_mr_init_dma(int access, struct rxe_mr *mr); +int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova, int access, struct rxe_mr *mr); -int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr); +int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr); int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length, enum rxe_mr_copy_dir dir); int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma, diff -u linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_mr.c linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_mr.c --- linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_mr.c +++ linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_mr.c @@ -103,17 +103,16 @@ return -ENOMEM; } -void rxe_mr_init_dma(struct rxe_pd *pd, int access, struct rxe_mr *mr) +void rxe_mr_init_dma(int access, struct rxe_mr *mr) { rxe_mr_init(access, mr); - mr->ibmr.pd = &pd->ibpd; mr->access = access; mr->state = RXE_MR_STATE_VALID; mr->type = IB_MR_TYPE_DMA; } -int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova, +int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova, int access, struct rxe_mr *mr) { struct rxe_map **map; @@ -125,7 +124,7 @@ int err; int i; - umem = ib_umem_get(pd->ibpd.device, start, length, access); + umem = ib_umem_get(&rxe->ib_dev, start, length, access); if (IS_ERR(umem)) { pr_warn("%s: Unable to pin memory region err = %d\n", __func__, (int)PTR_ERR(umem)); @@ -175,7 +174,6 @@ } } - mr->ibmr.pd = &pd->ibpd; mr->umem = umem; mr->access = access; mr->length = length; @@ -197,7 +195,7 @@ return err; } -int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr) +int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr) { int err; @@ -208,7 +206,6 @@ if (err) goto err1; - mr->ibmr.pd = &pd->ibpd; mr->max_buf = max_pages; mr->state = RXE_MR_STATE_FREE; mr->type = IB_MR_TYPE_MEM_REG; diff -u linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_resp.c linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_resp.c --- linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_resp.c +++ linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_resp.c @@ -784,8 +784,10 @@ skb = prepare_ack_packet(qp, req_pkt, &ack_pkt, opcode, payload, res->cur_psn, AETH_ACK_UNLIMITED); - if (!skb) + if (!skb) { + rxe_put(mr); return RESPST_ERR_RNR; + } rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt), payload, RXE_FROM_MR_OBJ); diff -u linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_verbs.c linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_verbs.c --- linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_verbs.c +++ linux-kvm-5.19.0/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -897,7 +897,9 @@ return ERR_PTR(-ENOMEM); rxe_get(pd); - rxe_mr_init_dma(pd, access, mr); + mr->ibmr.pd = ibpd; + + rxe_mr_init_dma(access, mr); return &mr->ibmr; } @@ -921,15 +923,15 @@ rxe_get(pd); + mr->ibmr.pd = ibpd; - err = rxe_mr_init_user(pd, start, length, iova, access, mr); + err = rxe_mr_init_user(rxe, start, length, iova, access, mr); if (err) goto err3; return &mr->ibmr; err3: - rxe_put(pd); rxe_put(mr); err2: return ERR_PTR(err); @@ -953,15 +955,15 @@ } rxe_get(pd); + mr->ibmr.pd = ibpd; - err = rxe_mr_init_fast(pd, max_num_sg, mr); + err = rxe_mr_init_fast(max_num_sg, mr); if (err) goto err2; return &mr->ibmr; err2: - rxe_put(pd); rxe_put(mr); err1: return ERR_PTR(err); diff -u linux-kvm-5.19.0/drivers/iommu/intel/iommu.c linux-kvm-5.19.0/drivers/iommu/intel/iommu.c --- linux-kvm-5.19.0/drivers/iommu/intel/iommu.c +++ linux-kvm-5.19.0/drivers/iommu/intel/iommu.c @@ -2483,6 +2483,7 @@ if (md_domain_init(si_domain, DEFAULT_DOMAIN_ADDRESS_WIDTH)) { domain_exit(si_domain); + si_domain = NULL; return -EFAULT; } @@ -3170,6 +3171,10 @@ disable_dmar_iommu(iommu); free_dmar_iommu(iommu); } + if (si_domain) { + domain_exit(si_domain); + si_domain = NULL; + } kfree(g_iommus); diff -u linux-kvm-5.19.0/drivers/md/dm.c linux-kvm-5.19.0/drivers/md/dm.c --- linux-kvm-5.19.0/drivers/md/dm.c +++ linux-kvm-5.19.0/drivers/md/dm.c @@ -1985,7 +1985,6 @@ md->disk->minors = 1; md->disk->flags |= GENHD_FL_NO_PART; md->disk->fops = &dm_blk_dops; - md->disk->queue = md->queue; md->disk->private_data = md; sprintf(md->disk->disk_name, "dm-%d", minor); diff -u linux-kvm-5.19.0/drivers/media/platform/amphion/vpu_v4l2.c linux-kvm-5.19.0/drivers/media/platform/amphion/vpu_v4l2.c --- linux-kvm-5.19.0/drivers/media/platform/amphion/vpu_v4l2.c +++ linux-kvm-5.19.0/drivers/media/platform/amphion/vpu_v4l2.c @@ -603,6 +603,10 @@ inst->workqueue = NULL; } + if (inst->fh.m2m_ctx) { + v4l2_m2m_ctx_release(inst->fh.m2m_ctx); + inst->fh.m2m_ctx = NULL; + } v4l2_ctrl_handler_free(&inst->ctrl_handler); mutex_destroy(&inst->lock); v4l2_fh_del(&inst->fh); @@ -685,13 +689,6 @@ vpu_trace(vpu->dev, "tgid = %d, pid = %d, inst = %p\n", inst->tgid, inst->pid, inst); - vpu_inst_lock(inst); - if (inst->fh.m2m_ctx) { - v4l2_m2m_ctx_release(inst->fh.m2m_ctx); - inst->fh.m2m_ctx = NULL; - } - vpu_inst_unlock(inst); - call_void_vop(inst, release); vpu_inst_unregister(inst); vpu_inst_put(inst); diff -u linux-kvm-5.19.0/drivers/media/rc/mceusb.c linux-kvm-5.19.0/drivers/media/rc/mceusb.c --- linux-kvm-5.19.0/drivers/media/rc/mceusb.c +++ linux-kvm-5.19.0/drivers/media/rc/mceusb.c @@ -1077,7 +1077,7 @@ struct mceusb_dev *ir = dev->priv; unsigned int units; - units = DIV_ROUND_CLOSEST(timeout, MCE_TIME_UNIT); + units = DIV_ROUND_UP(timeout, MCE_TIME_UNIT); cmdbuf[2] = units >> 8; cmdbuf[3] = units; diff -u linux-kvm-5.19.0/drivers/mmc/core/block.c linux-kvm-5.19.0/drivers/mmc/core/block.c --- linux-kvm-5.19.0/drivers/mmc/core/block.c +++ linux-kvm-5.19.0/drivers/mmc/core/block.c @@ -134,6 +134,7 @@ * track of the current selected device partition. */ unsigned int part_curr; +#define MMC_BLK_PART_INVALID UINT_MAX /* Unknown partition active */ int area_type; /* debugfs files (only in main mmc_blk_data) */ @@ -987,33 +988,39 @@ return ms; } +/* + * Attempts to reset the card and get back to the requested partition. + * Therefore any error here must result in cancelling the block layer + * request, it must not be reattempted without going through the mmc_blk + * partition sanity checks. + */ static int mmc_blk_reset(struct mmc_blk_data *md, struct mmc_host *host, int type) { int err; + struct mmc_blk_data *main_md = dev_get_drvdata(&host->card->dev); if (md->reset_done & type) return -EEXIST; md->reset_done |= type; err = mmc_hw_reset(host->card); + /* + * A successful reset will leave the card in the main partition, but + * upon failure it might not be, so set it to MMC_BLK_PART_INVALID + * in that case. + */ + main_md->part_curr = err ? MMC_BLK_PART_INVALID : main_md->part_type; + if (err) + return err; /* Ensure we switch back to the correct partition */ - if (err) { - struct mmc_blk_data *main_md = - dev_get_drvdata(&host->card->dev); - int part_err; - - main_md->part_curr = main_md->part_type; - part_err = mmc_blk_part_switch(host->card, md->part_type); - if (part_err) { - /* - * We have failed to get back into the correct - * partition, so we need to abort the whole request. - */ - return -ENODEV; - } - } - return err; + if (mmc_blk_part_switch(host->card, md->part_type)) + /* + * We have failed to get back into the correct + * partition, so we need to abort the whole request. + */ + return -ENODEV; + return 0; } static inline void mmc_blk_reset_success(struct mmc_blk_data *md, int type) @@ -1871,8 +1878,9 @@ return; /* Reset before last retry */ - if (mqrq->retries + 1 == MMC_MAX_RETRIES) - mmc_blk_reset(md, card->host, type); + if (mqrq->retries + 1 == MMC_MAX_RETRIES && + mmc_blk_reset(md, card->host, type)) + return; /* Command errors fail fast, so use all MMC_MAX_RETRIES */ if (brq->sbc.error || brq->cmd.error) diff -u linux-kvm-5.19.0/drivers/mmc/core/queue.c linux-kvm-5.19.0/drivers/mmc/core/queue.c --- linux-kvm-5.19.0/drivers/mmc/core/queue.c +++ linux-kvm-5.19.0/drivers/mmc/core/queue.c @@ -48,6 +48,7 @@ case REQ_OP_DRV_OUT: case REQ_OP_DISCARD: case REQ_OP_SECURE_ERASE: + case REQ_OP_WRITE_ZEROES: return MMC_ISSUE_SYNC; case REQ_OP_FLUSH: return mmc_cqe_can_dcmd(host) ? MMC_ISSUE_DCMD : MMC_ISSUE_SYNC; @@ -494,6 +495,13 @@ if (blk_queue_quiesced(q)) blk_mq_unquiesce_queue(q); + /* + * If the recovery completes the last (and only remaining) request in + * the queue, and the card has been removed, we could end up here with + * the recovery not quite finished yet, so cancel it. + */ + cancel_work_sync(&mq->recovery_work); + blk_mq_free_tag_set(&mq->tag_set); /* diff -u linux-kvm-5.19.0/drivers/mtd/nand/raw/intel-nand-controller.c linux-kvm-5.19.0/drivers/mtd/nand/raw/intel-nand-controller.c --- linux-kvm-5.19.0/drivers/mtd/nand/raw/intel-nand-controller.c +++ linux-kvm-5.19.0/drivers/mtd/nand/raw/intel-nand-controller.c @@ -108,7 +108,6 @@ struct ebu_nand_cs { void __iomem *chipaddr; - dma_addr_t nand_pa; u32 addr_sel; }; @@ -596,13 +595,11 @@ ebu_host->dev = dev; nand_controller_init(&ebu_host->controller); - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ebunand"); - ebu_host->ebu = devm_ioremap_resource(&pdev->dev, res); + ebu_host->ebu = devm_platform_ioremap_resource_byname(pdev, "ebunand"); if (IS_ERR(ebu_host->ebu)) return PTR_ERR(ebu_host->ebu); - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hsnand"); - ebu_host->hsnand = devm_ioremap_resource(&pdev->dev, res); + ebu_host->hsnand = devm_platform_ioremap_resource_byname(pdev, "hsnand"); if (IS_ERR(ebu_host->hsnand)) return PTR_ERR(ebu_host->hsnand); @@ -614,31 +611,33 @@ ret = of_property_read_u32(chip_np, "reg", &cs); if (ret) { dev_err(dev, "failed to get chip select: %d\n", ret); - return ret; + goto err_of_node_put; } if (cs >= MAX_CS) { dev_err(dev, "got invalid chip select: %d\n", cs); - return -EINVAL; + ret = -EINVAL; + goto err_of_node_put; } ebu_host->cs_num = cs; resname = devm_kasprintf(dev, GFP_KERNEL, "nand_cs%d", cs); - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resname); - ebu_host->cs[cs].chipaddr = devm_ioremap_resource(dev, res); + ebu_host->cs[cs].chipaddr = devm_platform_ioremap_resource_byname(pdev, + resname); if (IS_ERR(ebu_host->cs[cs].chipaddr)) - return PTR_ERR(ebu_host->cs[cs].chipaddr); - ebu_host->cs[cs].nand_pa = res->start; + goto err_of_node_put; ebu_host->clk = devm_clk_get(dev, NULL); - if (IS_ERR(ebu_host->clk)) - return dev_err_probe(dev, PTR_ERR(ebu_host->clk), - "failed to get clock\n"); + if (IS_ERR(ebu_host->clk)) { + ret = dev_err_probe(dev, PTR_ERR(ebu_host->clk), + "failed to get clock\n"); + goto err_of_node_put; + } ret = clk_prepare_enable(ebu_host->clk); if (ret) { dev_err(dev, "failed to enable clock: %d\n", ret); - return ret; + goto err_of_node_put; } ebu_host->clk_rate = clk_get_rate(ebu_host->clk); @@ -703,6 +702,8 @@ ebu_dma_cleanup(ebu_host); err_disable_unprepare_clk: clk_disable_unprepare(ebu_host->clk); +err_of_node_put: + of_node_put(chip_np); return ret; } diff -u linux-kvm-5.19.0/drivers/net/can/spi/mcp251x.c linux-kvm-5.19.0/drivers/net/can/spi/mcp251x.c --- linux-kvm-5.19.0/drivers/net/can/spi/mcp251x.c +++ linux-kvm-5.19.0/drivers/net/can/spi/mcp251x.c @@ -1409,11 +1409,14 @@ ret = mcp251x_gpio_setup(priv); if (ret) - goto error_probe; + goto out_unregister_candev; netdev_info(net, "MCP%x successfully initialized.\n", priv->model); return 0; +out_unregister_candev: + unregister_candev(net); + error_probe: destroy_workqueue(priv->wq); priv->wq = NULL; diff -u linux-kvm-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c linux-kvm-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c --- linux-kvm-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ linux-kvm-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -1873,7 +1873,7 @@ { int err; - init_completion(&priv->start_comp); + reinit_completion(&priv->start_comp); err = kvaser_usb_hydra_send_simple_cmd(priv->dev, CMD_START_CHIP_REQ, priv->channel); @@ -1891,7 +1891,7 @@ { int err; - init_completion(&priv->stop_comp); + reinit_completion(&priv->stop_comp); /* Make sure we do not report invalid BUS_OFF from CMD_CHIP_STATE_EVENT * see comment in kvaser_usb_hydra_update_state() diff -u linux-kvm-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c linux-kvm-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c --- linux-kvm-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ linux-kvm-5.19.0/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1319,7 +1319,7 @@ { int err; - init_completion(&priv->start_comp); + reinit_completion(&priv->start_comp); err = kvaser_usb_leaf_send_simple_cmd(priv->dev, CMD_START_CHIP, priv->channel); @@ -1337,7 +1337,7 @@ { int err; - init_completion(&priv->stop_comp); + reinit_completion(&priv->stop_comp); err = kvaser_usb_leaf_send_simple_cmd(priv->dev, CMD_STOP_CHIP, priv->channel); diff -u linux-kvm-5.19.0/drivers/net/ethernet/cadence/macb_main.c linux-kvm-5.19.0/drivers/net/ethernet/cadence/macb_main.c --- linux-kvm-5.19.0/drivers/net/ethernet/cadence/macb_main.c +++ linux-kvm-5.19.0/drivers/net/ethernet/cadence/macb_main.c @@ -805,6 +805,7 @@ bp->phylink_config.dev = &dev->dev; bp->phylink_config.type = PHYLINK_NETDEV; + bp->phylink_config.mac_managed_pm = true; if (bp->phy_interface == PHY_INTERFACE_MODE_SGMII) { bp->phylink_config.poll_fixed_state = true; diff -u linux-kvm-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.c linux-kvm-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.c --- linux-kvm-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.c +++ linux-kvm-5.19.0/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2090,7 +2090,12 @@ else enetc_rxbdr_wr(hw, idx, ENETC_RBBSR, ENETC_RXB_DMA_SIZE); + /* Also prepare the consumer index in case page allocation never + * succeeds. In that case, hardware will never advance producer index + * to match consumer index, and will drop all frames. + */ enetc_rxbdr_wr(hw, idx, ENETC_RBPIR, 0); + enetc_rxbdr_wr(hw, idx, ENETC_RBCIR, 1); /* enable Rx ints by setting pkt thr to 1 */ enetc_rxbdr_wr(hw, idx, ENETC_RBICR0, ENETC_RBICR0_ICEN | 0x1); diff -u linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_ethtool.c linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_ethtool.c --- linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -2093,9 +2093,6 @@ err = i40e_setup_rx_descriptors(&rx_rings[i]); if (err) goto rx_unwind; - err = i40e_alloc_rx_bi(&rx_rings[i]); - if (err) - goto rx_unwind; /* now allocate the Rx buffers to make sure the OS * has enough memory, any failure here means abort @@ -3098,10 +3095,17 @@ if (cmd->flow_type == TCP_V4_FLOW || cmd->flow_type == UDP_V4_FLOW) { - if (i_set & I40E_L3_SRC_MASK) - cmd->data |= RXH_IP_SRC; - if (i_set & I40E_L3_DST_MASK) - cmd->data |= RXH_IP_DST; + if (hw->mac.type == I40E_MAC_X722) { + if (i_set & I40E_X722_L3_SRC_MASK) + cmd->data |= RXH_IP_SRC; + if (i_set & I40E_X722_L3_DST_MASK) + cmd->data |= RXH_IP_DST; + } else { + if (i_set & I40E_L3_SRC_MASK) + cmd->data |= RXH_IP_SRC; + if (i_set & I40E_L3_DST_MASK) + cmd->data |= RXH_IP_DST; + } } else if (cmd->flow_type == TCP_V6_FLOW || cmd->flow_type == UDP_V6_FLOW) { if (i_set & I40E_L3_V6_SRC_MASK) @@ -3459,12 +3463,15 @@ /** * i40e_get_rss_hash_bits - Read RSS Hash bits from register + * @hw: hw structure * @nfc: pointer to user request * @i_setc: bits currently set * * Returns value of bits to be set per user request **/ -static u64 i40e_get_rss_hash_bits(struct ethtool_rxnfc *nfc, u64 i_setc) +static u64 i40e_get_rss_hash_bits(struct i40e_hw *hw, + struct ethtool_rxnfc *nfc, + u64 i_setc) { u64 i_set = i_setc; u64 src_l3 = 0, dst_l3 = 0; @@ -3483,8 +3490,13 @@ dst_l3 = I40E_L3_V6_DST_MASK; } else if (nfc->flow_type == TCP_V4_FLOW || nfc->flow_type == UDP_V4_FLOW) { - src_l3 = I40E_L3_SRC_MASK; - dst_l3 = I40E_L3_DST_MASK; + if (hw->mac.type == I40E_MAC_X722) { + src_l3 = I40E_X722_L3_SRC_MASK; + dst_l3 = I40E_X722_L3_DST_MASK; + } else { + src_l3 = I40E_L3_SRC_MASK; + dst_l3 = I40E_L3_DST_MASK; + } } else { /* Any other flow type are not supported here */ return i_set; @@ -3502,6 +3514,7 @@ return i_set; } +#define FLOW_PCTYPES_SIZE 64 /** * i40e_set_rss_hash_opt - Enable/Disable flow types for RSS hash * @pf: pointer to the physical function struct @@ -3514,9 +3527,11 @@ struct i40e_hw *hw = &pf->hw; u64 hena = (u64)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0)) | ((u64)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1)) << 32); - u8 flow_pctype = 0; + DECLARE_BITMAP(flow_pctypes, FLOW_PCTYPES_SIZE); u64 i_set, i_setc; + bitmap_zero(flow_pctypes, FLOW_PCTYPES_SIZE); + if (pf->flags & I40E_FLAG_MFP_ENABLED) { dev_err(&pf->pdev->dev, "Change of RSS hash input set is not supported when MFP mode is enabled\n"); @@ -3532,36 +3547,35 @@ switch (nfc->flow_type) { case TCP_V4_FLOW: - flow_pctype = I40E_FILTER_PCTYPE_NONF_IPV4_TCP; + set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_TCP, flow_pctypes); if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) - hena |= - BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK); + set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK, + flow_pctypes); break; case TCP_V6_FLOW: - flow_pctype = I40E_FILTER_PCTYPE_NONF_IPV6_TCP; + set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_TCP, flow_pctypes); if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) - hena |= - BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK); - if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) - hena |= - BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK); + set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK, + flow_pctypes); break; case UDP_V4_FLOW: - flow_pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP; - if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) - hena |= - BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | - BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP); - + set_bit(I40E_FILTER_PCTYPE_NONF_IPV4_UDP, flow_pctypes); + if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) { + set_bit(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP, + flow_pctypes); + set_bit(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP, + flow_pctypes); + } hena |= BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4); break; case UDP_V6_FLOW: - flow_pctype = I40E_FILTER_PCTYPE_NONF_IPV6_UDP; - if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) - hena |= - BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | - BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP); - + set_bit(I40E_FILTER_PCTYPE_NONF_IPV6_UDP, flow_pctypes); + if (pf->hw_features & I40E_HW_MULTIPLE_TCP_UDP_RSS_PCTYPE) { + set_bit(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP, + flow_pctypes); + set_bit(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP, + flow_pctypes); + } hena |= BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6); break; case AH_ESP_V4_FLOW: @@ -3594,17 +3608,20 @@ return -EINVAL; } - if (flow_pctype) { - i_setc = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, - flow_pctype)) | - ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, - flow_pctype)) << 32); - i_set = i40e_get_rss_hash_bits(nfc, i_setc); - i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_pctype), - (u32)i_set); - i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_pctype), - (u32)(i_set >> 32)); - hena |= BIT_ULL(flow_pctype); + if (bitmap_weight(flow_pctypes, FLOW_PCTYPES_SIZE)) { + u8 flow_id; + + for_each_set_bit(flow_id, flow_pctypes, FLOW_PCTYPES_SIZE) { + i_setc = (u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id)) | + ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id)) << 32); + i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc); + + i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_id), + (u32)i_set); + i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_id), + (u32)(i_set >> 32)); + hena |= BIT_ULL(flow_id); + } } i40e_write_rx_ctl(hw, I40E_PFQF_HENA(0), (u32)hena); diff -u linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_main.c linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_main.c --- linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_main.c +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -3440,12 +3440,8 @@ if (ring->vsi->type == I40E_VSI_MAIN) xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq); - kfree(ring->rx_bi); ring->xsk_pool = i40e_xsk_pool(ring); if (ring->xsk_pool) { - ret = i40e_alloc_rx_bi_zc(ring); - if (ret) - return ret; ring->rx_buf_len = xsk_pool_get_rx_frame_size(ring->xsk_pool); /* For AF_XDP ZC, we disallow packets to span on @@ -3463,9 +3459,6 @@ ring->queue_index); } else { - ret = i40e_alloc_rx_bi(ring); - if (ret) - return ret; ring->rx_buf_len = vsi->rx_buf_len; if (ring->vsi->type == I40E_VSI_MAIN) { ret = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq, @@ -13181,6 +13174,14 @@ i40e_reset_and_rebuild(pf, true, true); } + if (!i40e_enabled_xdp_vsi(vsi) && prog) { + if (i40e_realloc_rx_bi_zc(vsi, true)) + return -ENOMEM; + } else if (i40e_enabled_xdp_vsi(vsi) && !prog) { + if (i40e_realloc_rx_bi_zc(vsi, false)) + return -ENOMEM; + } + for (i = 0; i < vsi->num_queue_pairs; i++) WRITE_ONCE(vsi->rx_rings[i]->xdp_prog, vsi->xdp_prog); @@ -13413,6 +13414,7 @@ i40e_queue_pair_disable_irq(vsi, queue_pair); err = i40e_queue_pair_toggle_rings(vsi, queue_pair, false /* off */); + i40e_clean_rx_ring(vsi->rx_rings[queue_pair]); i40e_queue_pair_toggle_napi(vsi, queue_pair, false /* off */); i40e_queue_pair_clean_rings(vsi, queue_pair); i40e_queue_pair_reset_stats(vsi, queue_pair); diff -u linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c --- linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1458,14 +1458,6 @@ return -ENOMEM; } -int i40e_alloc_rx_bi(struct i40e_ring *rx_ring) -{ - unsigned long sz = sizeof(*rx_ring->rx_bi) * rx_ring->count; - - rx_ring->rx_bi = kzalloc(sz, GFP_KERNEL); - return rx_ring->rx_bi ? 0 : -ENOMEM; -} - static void i40e_clear_rx_bi(struct i40e_ring *rx_ring) { memset(rx_ring->rx_bi, 0, sizeof(*rx_ring->rx_bi) * rx_ring->count); @@ -1596,6 +1588,11 @@ rx_ring->xdp_prog = rx_ring->vsi->xdp_prog; + rx_ring->rx_bi = + kcalloc(rx_ring->count, sizeof(*rx_ring->rx_bi), GFP_KERNEL); + if (!rx_ring->rx_bi) + return -ENOMEM; + return 0; } diff -u linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c --- linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -1536,10 +1536,12 @@ if (test_bit(__I40E_VF_RESETS_DISABLED, pf->state)) return true; - /* If the VFs have been disabled, this means something else is - * resetting the VF, so we shouldn't continue. - */ - if (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) + /* Bail out if VFs are disabled. */ + if (test_bit(__I40E_VF_DISABLE, pf->state)) + return true; + + /* If VF is being reset already we don't need to continue. */ + if (test_and_set_bit(I40E_VF_STATE_RESETTING, &vf->vf_states)) return true; i40e_trigger_vf_reset(vf, flr); @@ -1576,7 +1578,7 @@ i40e_cleanup_reset_vf(vf); i40e_flush(hw); - clear_bit(__I40E_VF_DISABLE, pf->state); + clear_bit(I40E_VF_STATE_RESETTING, &vf->vf_states); return true; } @@ -1609,8 +1611,12 @@ return false; /* Begin reset on all VFs at once */ - for (v = 0; v < pf->num_alloc_vfs; v++) - i40e_trigger_vf_reset(&pf->vf[v], flr); + for (v = 0; v < pf->num_alloc_vfs; v++) { + vf = &pf->vf[v]; + /* If VF is being reset no need to trigger reset again */ + if (!test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states)) + i40e_trigger_vf_reset(&pf->vf[v], flr); + } /* HW requires some time to make sure it can flush the FIFO for a VF * when it resets it. Poll the VPGEN_VFRSTAT register for each VF in @@ -1626,9 +1632,11 @@ */ while (v < pf->num_alloc_vfs) { vf = &pf->vf[v]; - reg = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_id)); - if (!(reg & I40E_VPGEN_VFRSTAT_VFRD_MASK)) - break; + if (!test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states)) { + reg = rd32(hw, I40E_VPGEN_VFRSTAT(vf->vf_id)); + if (!(reg & I40E_VPGEN_VFRSTAT_VFRD_MASK)) + break; + } /* If the current VF has finished resetting, move on * to the next VF in sequence. @@ -1656,6 +1664,10 @@ if (pf->vf[v].lan_vsi_idx == 0) continue; + /* If VF is reset in another thread just continue */ + if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states)) + continue; + i40e_vsi_stop_rings_no_wait(pf->vsi[pf->vf[v].lan_vsi_idx]); } @@ -1667,6 +1679,10 @@ if (pf->vf[v].lan_vsi_idx == 0) continue; + /* If VF is reset in another thread just continue */ + if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states)) + continue; + i40e_vsi_wait_queues_disabled(pf->vsi[pf->vf[v].lan_vsi_idx]); } @@ -1676,8 +1692,13 @@ mdelay(50); /* Finish the reset on each VF */ - for (v = 0; v < pf->num_alloc_vfs; v++) + for (v = 0; v < pf->num_alloc_vfs; v++) { + /* If VF is reset in another thread just continue */ + if (test_bit(I40E_VF_STATE_RESETTING, &vf->vf_states)) + continue; + i40e_cleanup_reset_vf(&pf->vf[v]); + } i40e_flush(hw); clear_bit(__I40E_VF_DISABLE, pf->state); diff -u linux-kvm-5.19.0/drivers/net/ethernet/mediatek/mtk_eth_soc.c linux-kvm-5.19.0/drivers/net/ethernet/mediatek/mtk_eth_soc.c --- linux-kvm-5.19.0/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -3533,19 +3533,23 @@ eth->irq[i] = platform_get_irq(pdev, i); if (eth->irq[i] < 0) { dev_err(&pdev->dev, "no IRQ%d resource found\n", i); - return -ENXIO; + err = -ENXIO; + goto err_wed_exit; } } for (i = 0; i < ARRAY_SIZE(eth->clks); i++) { eth->clks[i] = devm_clk_get(eth->dev, mtk_clks_source_name[i]); if (IS_ERR(eth->clks[i])) { - if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) { + err = -EPROBE_DEFER; + goto err_wed_exit; + } if (eth->soc->required_clks & BIT(i)) { dev_err(&pdev->dev, "clock %s not found\n", mtk_clks_source_name[i]); - return -EINVAL; + err = -EINVAL; + goto err_wed_exit; } eth->clks[i] = NULL; } @@ -3556,7 +3560,7 @@ err = mtk_hw_init(eth); if (err) - return err; + goto err_wed_exit; eth->hwlro = MTK_HAS_CAPS(eth->soc->caps, MTK_HWLRO); @@ -3645,6 +3649,8 @@ mtk_free_dev(eth); err_deinit_hw: mtk_hw_deinit(eth); +err_wed_exit: + mtk_wed_exit(); return err; } @@ -3664,6 +3670,7 @@ phylink_disconnect_phy(mac->phylink); } + mtk_wed_exit(); mtk_hw_deinit(eth); netif_napi_del(ð->tx_napi); diff -u linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/main.c linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/main.c --- linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -1809,6 +1809,10 @@ err = mlx5_load_one(dev, false); + if (!err) + devlink_health_reporter_state_update(dev->priv.health.fw_fatal_reporter, + DEVLINK_HEALTH_REPORTER_STATE_HEALTHY); + mlx5_pci_trace(dev, "Done, err = %d, device %s\n", err, !err ? "recovered" : "Failed"); } diff -u linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c --- linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c +++ linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c @@ -309,6 +309,7 @@ lan966x, FDMA_CH_DB_DISCARD); tx->activated = false; + tx->last_in_use = -1; } static void lan966x_fdma_tx_reload(struct lan966x_tx *tx) @@ -413,13 +414,15 @@ /* Get the received frame and unmap it */ db = &rx->dcbs[rx->dcb_index].db[rx->db_index]; page = rx->page[rx->dcb_index][rx->db_index]; + + dma_sync_single_for_cpu(lan966x->dev, (dma_addr_t)db->dataptr, + FDMA_DCB_STATUS_BLOCKL(db->status), + DMA_FROM_DEVICE); + skb = build_skb(page_address(page), PAGE_SIZE << rx->page_order); if (unlikely(!skb)) goto unmap_page; - dma_unmap_single(lan966x->dev, (dma_addr_t)db->dataptr, - FDMA_DCB_STATUS_BLOCKL(db->status), - DMA_FROM_DEVICE); skb_put(skb, FDMA_DCB_STATUS_BLOCKL(db->status)); lan966x_ifh_get_src_port(skb->data, &src_port); @@ -429,4 +432,8 @@ goto free_skb; + dma_unmap_single_attrs(lan966x->dev, (dma_addr_t)db->dataptr, + PAGE_SIZE << rx->page_order, DMA_FROM_DEVICE, + DMA_ATTR_SKIP_CPU_SYNC); + skb->dev = lan966x->ports[src_port]->dev; skb_pull(skb, IFH_LEN * sizeof(u32)); @@ -453,9 +460,9 @@ free_skb: kfree_skb(skb); unmap_page: - dma_unmap_page(lan966x->dev, (dma_addr_t)db->dataptr, - FDMA_DCB_STATUS_BLOCKL(db->status), - DMA_FROM_DEVICE); + dma_unmap_single_attrs(lan966x->dev, (dma_addr_t)db->dataptr, + PAGE_SIZE << rx->page_order, DMA_FROM_DEVICE, + DMA_ATTR_SKIP_CPU_SYNC); __free_pages(page, rx->page_order); return NULL; @@ -667,12 +674,14 @@ int i; for (i = 0; i < lan966x->num_phys_ports; ++i) { + struct lan966x_port *port; int mtu; - if (!lan966x->ports[i]) + port = lan966x->ports[i]; + if (!port) continue; - mtu = lan966x->ports[i]->dev->mtu; + mtu = lan_rd(lan966x, DEV_MAC_MAXLEN_CFG(port->chip_port)); if (mtu > max_mtu) max_mtu = mtu; } @@ -687,17 +696,14 @@ static int lan966x_fdma_reload(struct lan966x *lan966x, int new_mtu) { - void *rx_dcbs, *tx_dcbs, *tx_dcbs_buf; - dma_addr_t rx_dma, tx_dma; + dma_addr_t rx_dma; + void *rx_dcbs; u32 size; int err; /* Store these for later to free them */ rx_dma = lan966x->rx.dma; - tx_dma = lan966x->tx.dma; rx_dcbs = lan966x->rx.dcbs; - tx_dcbs = lan966x->tx.dcbs; - tx_dcbs_buf = lan966x->tx.dcbs_buf; napi_synchronize(&lan966x->napi); napi_disable(&lan966x->napi); @@ -715,17 +721,6 @@ size = ALIGN(size, PAGE_SIZE); dma_free_coherent(lan966x->dev, size, rx_dcbs, rx_dma); - lan966x_fdma_tx_disable(&lan966x->tx); - err = lan966x_fdma_tx_alloc(&lan966x->tx); - if (err) - goto restore_tx; - - size = sizeof(struct lan966x_tx_dcb) * FDMA_DCB_MAX; - size = ALIGN(size, PAGE_SIZE); - dma_free_coherent(lan966x->dev, size, tx_dcbs, tx_dma); - - kfree(tx_dcbs_buf); - lan966x_fdma_wakeup_netdev(lan966x); napi_enable(&lan966x->napi); @@ -735,11 +730,6 @@ lan966x->rx.dcbs = rx_dcbs; lan966x_fdma_rx_start(&lan966x->rx); -restore_tx: - lan966x->tx.dma = tx_dma; - lan966x->tx.dcbs = tx_dcbs; - lan966x->tx.dcbs_buf = tx_dcbs_buf; - return err; } @@ -751,6 +741,8 @@ max_mtu = lan966x_fdma_get_max_mtu(lan966x); max_mtu += IFH_LEN * sizeof(u32); + max_mtu += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + max_mtu += VLAN_HLEN * 2; if (round_up(max_mtu, PAGE_SIZE) / PAGE_SIZE - 1 == lan966x->rx.page_order) diff -u linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_main.c linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_main.c --- linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -385,7 +385,7 @@ int old_mtu = dev->mtu; int err; - lan_wr(DEV_MAC_MAXLEN_CFG_MAX_LEN_SET(new_mtu), + lan_wr(DEV_MAC_MAXLEN_CFG_MAX_LEN_SET(LAN966X_HW_MTU(new_mtu)), lan966x, DEV_MAC_MAXLEN_CFG(port->chip_port)); dev->mtu = new_mtu; @@ -394,7 +394,7 @@ err = lan966x_fdma_change_mtu(lan966x); if (err) { - lan_wr(DEV_MAC_MAXLEN_CFG_MAX_LEN_SET(old_mtu), + lan_wr(DEV_MAC_MAXLEN_CFG_MAX_LEN_SET(LAN966X_HW_MTU(old_mtu)), lan966x, DEV_MAC_MAXLEN_CFG(port->chip_port)); dev->mtu = old_mtu; } diff -u linux-kvm-5.19.0/drivers/net/ethernet/pensando/ionic/ionic_lif.c linux-kvm-5.19.0/drivers/net/ethernet/pensando/ionic/ionic_lif.c --- linux-kvm-5.19.0/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ linux-kvm-5.19.0/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -2820,11 +2820,15 @@ * than the full array, but leave the qcq shells in place */ for (i = lif->nxqs; i < lif->ionic->ntxqs_per_lif; i++) { - lif->txqcqs[i]->flags &= ~IONIC_QCQ_F_INTR; - ionic_qcq_free(lif, lif->txqcqs[i]); + if (lif->txqcqs && lif->txqcqs[i]) { + lif->txqcqs[i]->flags &= ~IONIC_QCQ_F_INTR; + ionic_qcq_free(lif, lif->txqcqs[i]); + } - lif->rxqcqs[i]->flags &= ~IONIC_QCQ_F_INTR; - ionic_qcq_free(lif, lif->rxqcqs[i]); + if (lif->rxqcqs && lif->rxqcqs[i]) { + lif->rxqcqs[i]->flags &= ~IONIC_QCQ_F_INTR; + ionic_qcq_free(lif, lif->rxqcqs[i]); + } } if (err) diff -u linux-kvm-5.19.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c linux-kvm-5.19.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c --- linux-kvm-5.19.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ linux-kvm-5.19.0/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1209,6 +1209,7 @@ if (priv->plat->tx_queues_to_use > 1) priv->phylink_config.mac_capabilities &= ~(MAC_10HD | MAC_100HD | MAC_1000HD); + priv->phylink_config.mac_managed_pm = true; phylink = phylink_create(&priv->phylink_config, fwnode, mode, &stmmac_phylink_mac_ops); diff -u linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mac80211.c linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mac80211.c --- linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mac80211.c +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -178,6 +178,12 @@ { .start_freq = 5350, .end_freq = 5470, }, { .start_freq = 5470, .end_freq = 5725, }, { .start_freq = 5725, .end_freq = 5950, }, + { .start_freq = 5945, .end_freq = 6165, }, + { .start_freq = 6165, .end_freq = 6405, }, + { .start_freq = 6405, .end_freq = 6525, }, + { .start_freq = 6525, .end_freq = 6705, }, + { .start_freq = 6705, .end_freq = 6865, }, + { .start_freq = 6865, .end_freq = 7125, }, }; static const struct cfg80211_sar_capa mt76_sar_capa = { diff -u linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/init.c linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/init.c --- linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -34,14 +34,13 @@ { struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); struct mt7921_dev *dev = mt7921_hw_dev(hw); - struct mt7921_phy *phy = mt7921_hw_phy(hw); memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2)); dev->mt76.region = request->dfs_region; mt7921_mutex_acquire(dev); mt76_connac_mcu_set_channel_domain(hw->priv); - mt76_connac_mcu_set_rate_txpower(phy->mt76); + mt7921_set_tx_sar_pwr(hw, NULL); mt7921_mutex_release(dev); } @@ -289,6 +288,8 @@ if (!mt76_is_mmio(&dev->mt76)) hw->extra_tx_headroom += MT_SDIO_TXD_SIZE + MT_SDIO_HDR_SIZE; + mt7921_init_acpi_sar(dev); + ret = mt7921_init_wcid(dev); if (ret) return ret; diff -u linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c --- linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -257,7 +257,7 @@ if (err) return err; - err = mt76_connac_mcu_set_rate_txpower(phy->mt76); + err = mt7921_set_tx_sar_pwr(mphy->hw, NULL); if (err) return err; @@ -548,7 +548,7 @@ mt7921_mutex_acquire(dev); if (changed & IEEE80211_CONF_CHANGE_POWER) { - ret = mt76_connac_mcu_set_rate_txpower(phy->mt76); + ret = mt7921_set_tx_sar_pwr(hw, NULL); if (ret) goto out; } @@ -1465,20 +1465,33 @@ } #endif +int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw, + const struct cfg80211_sar_specs *sar) +{ + struct mt76_phy *mphy = hw->priv; + int err; + + if (sar) { + err = mt76_init_sar_power(hw, sar); + if (err) + return err; + } + + mt7921_init_acpi_sar_power(mt7921_hw_phy(hw), !sar); + + err = mt76_connac_mcu_set_rate_txpower(mphy); + + return err; +} + static int mt7921_set_sar_specs(struct ieee80211_hw *hw, const struct cfg80211_sar_specs *sar) { struct mt7921_dev *dev = mt7921_hw_dev(hw); - struct mt76_phy *mphy = hw->priv; int err; mt7921_mutex_acquire(dev); - err = mt76_init_sar_power(hw, sar); - if (err) - goto out; - - err = mt76_connac_mcu_set_rate_txpower(mphy); -out: + err = mt7921_set_tx_sar_pwr(hw, sar); mt7921_mutex_release(dev); return err; diff -u linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h --- linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h @@ -8,6 +8,7 @@ #include #include "../mt76_connac_mcu.h" #include "regs.h" +#include "acpi_sar.h" #define MT7921_MAX_INTERFACES 4 #define MT7921_WTBL_SIZE 20 @@ -170,6 +171,9 @@ struct sk_buff_head scan_event_list; struct delayed_work scan_work; +#ifdef CONFIG_ACPI + struct mt7921_acpi_sar *acpisar; +#endif }; #define mt7921_init_reset(dev) ((dev)->hif_ops->init_reset(dev)) @@ -470,2 +474,20 @@ bool enable); +#ifdef CONFIG_ACPI +int mt7921_init_acpi_sar(struct mt7921_dev *dev); +int mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default); +#else +static inline int +mt7921_init_acpi_sar(struct mt7921_dev *dev) +{ + return 0; +} + +static inline int +mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default) +{ + return 0; +} +#endif +int mt7921_set_tx_sar_pwr(struct ieee80211_hw *hw, + const struct cfg80211_sar_specs *sar); #endif diff -u linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci.c linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci.c --- linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci.c +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -152,6 +152,7 @@ { 0x820c8000, 0x0c000, 0x2000 }, /* WF_UMAC_TOP (PSE) */ { 0x820cc000, 0x0e000, 0x1000 }, /* WF_UMAC_TOP (PP) */ { 0x820cd000, 0x0f000, 0x1000 }, /* WF_MDP_TOP */ + { 0x74030000, 0x10000, 0x10000 }, /* PCIE_MAC_IREG */ { 0x820ce000, 0x21c00, 0x0200 }, /* WF_LMAC_TOP (WF_SEC) */ { 0x820cf000, 0x22000, 0x1000 }, /* WF_LMAC_TOP (WF_PF) */ { 0x820e0000, 0x20000, 0x0400 }, /* WF_LMAC_TOP BN0 (WF_CFG) */ diff -u linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c --- linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c @@ -52,6 +52,8 @@ if (err) return err; + mt76_rmw_field(dev, MT_PCIE_MAC_PM, MT_PCIE_MAC_PM_L0S_DIS, 1); + err = mt7921_run_firmware(dev); mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_FWDL], false); diff -u linux-kvm-5.19.0/drivers/net/wwan/iosm/iosm_ipc_pcie.c linux-kvm-5.19.0/drivers/net/wwan/iosm/iosm_ipc_pcie.c --- linux-kvm-5.19.0/drivers/net/wwan/iosm/iosm_ipc_pcie.c +++ linux-kvm-5.19.0/drivers/net/wwan/iosm/iosm_ipc_pcie.c @@ -254,6 +254,7 @@ const struct pci_device_id *pci_id) { struct iosm_pcie *ipc_pcie = kzalloc(sizeof(*ipc_pcie), GFP_KERNEL); + int ret; pr_debug("Probing device 0x%X from the vendor 0x%X", pci_id->device, pci_id->vendor); @@ -286,6 +287,12 @@ goto pci_enable_fail; } + ret = dma_set_mask(ipc_pcie->dev, DMA_BIT_MASK(64)); + if (ret) { + dev_err(ipc_pcie->dev, "Could not set PCI DMA mask: %d", ret); + return ret; + } + ipc_pcie_config_aspm(ipc_pcie); dev_dbg(ipc_pcie->dev, "PCIe device enabled."); diff -u linux-kvm-5.19.0/drivers/nvme/host/core.c linux-kvm-5.19.0/drivers/nvme/host/core.c --- linux-kvm-5.19.0/drivers/nvme/host/core.c +++ linux-kvm-5.19.0/drivers/nvme/host/core.c @@ -3163,8 +3163,12 @@ return ret; if (!ctrl->identified && !nvme_discovery_ctrl(ctrl)) { + /* + * Do not return errors unless we are in a controller reset, + * the controller works perfectly fine without hwmon. + */ ret = nvme_hwmon_init(ctrl); - if (ret < 0) + if (ret == -EINTR) return ret; } diff -u linux-kvm-5.19.0/drivers/nvme/host/pci.c linux-kvm-5.19.0/drivers/nvme/host/pci.c --- linux-kvm-5.19.0/drivers/nvme/host/pci.c +++ linux-kvm-5.19.0/drivers/nvme/host/pci.c @@ -3506,6 +3506,16 @@ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, { PCI_DEVICE(0x2646, 0x2263), /* KINGSTON A2000 NVMe SSD */ .driver_data = NVME_QUIRK_NO_DEEPEST_PS, }, + { PCI_DEVICE(0x2646, 0x5018), /* KINGSTON OM8SFP4xxxxP OS21012 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x5016), /* KINGSTON OM3PGP4xxxxP OS21011 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x501A), /* KINGSTON OM8PGP4xxxxP OS21005 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x501B), /* KINGSTON OM8PGP4xxxxQ OS21005 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, + { PCI_DEVICE(0x2646, 0x501E), /* KINGSTON OM3PGP4xxxxQ OS21011 NVMe SSD */ + .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, { PCI_DEVICE(0x1e4B, 0x1001), /* MAXIO MAP1001 */ .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1e4B, 0x1002), /* MAXIO MAP1002 */ diff -u linux-kvm-5.19.0/drivers/nvme/target/core.c linux-kvm-5.19.0/drivers/nvme/target/core.c --- linux-kvm-5.19.0/drivers/nvme/target/core.c +++ linux-kvm-5.19.0/drivers/nvme/target/core.c @@ -1167,7 +1167,7 @@ * reset the keep alive timer when the controller is enabled. */ if (ctrl->kato) - mod_delayed_work(system_wq, &ctrl->ka_work, ctrl->kato * HZ); + mod_delayed_work(nvmet_wq, &ctrl->ka_work, ctrl->kato * HZ); } static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl) diff -u linux-kvm-5.19.0/drivers/platform/x86/intel/hid.c linux-kvm-5.19.0/drivers/platform/x86/intel/hid.c --- linux-kvm-5.19.0/drivers/platform/x86/intel/hid.c +++ linux-kvm-5.19.0/drivers/platform/x86/intel/hid.c @@ -27,6 +27,9 @@ {"INTC1051", 0}, {"INTC1054", 0}, {"INTC1070", 0}, + {"INTC1076", 0}, + {"INTC1077", 0}, + {"INTC1078", 0}, {"", 0}, }; MODULE_DEVICE_TABLE(acpi, intel_hid_ids); diff -u linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.c linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.c --- linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.c +++ linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_debugfs.c @@ -5156,7 +5156,7 @@ static int lpfc_idiag_extacc_avail_get(struct lpfc_hba *phba, char *pbuffer, int len) { - uint16_t ext_cnt, ext_size; + uint16_t ext_cnt = 0, ext_size = 0; len += scnprintf(pbuffer+len, LPFC_EXT_ACC_BUF_SIZE-len, "\nAvailable Extents Information:\n"); diff -u linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_hbadisc.c linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_hbadisc.c --- linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_hbadisc.c +++ linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -2964,7 +2964,7 @@ uint32_t boot_flag, addr_mode; uint16_t next_fcf_index, fcf_index; uint16_t current_fcf_index; - uint16_t vlan_id; + uint16_t vlan_id = LPFC_FCOE_NULL_VID; int rc; /* If link state is not up, stop the roundrobin failover process */ @@ -3069,7 +3069,7 @@ struct fcf_record *new_fcf_record; uint32_t boot_flag, addr_mode; uint16_t fcf_index, next_fcf_index; - uint16_t vlan_id; + uint16_t vlan_id = LPFC_FCOE_NULL_VID; int rc; /* If link state is not up, no need to proceed */ diff -u linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_init.c linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_init.c --- linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_init.c +++ linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_init.c @@ -325,8 +325,7 @@ prog_id_word = pmboxq->u.mb.un.varWords[7]; /* Decode the Option rom version word to a readable string */ - if (prg->dist < 4) - dist = dist_char[prg->dist]; + dist = dist_char[prg->dist]; if ((prg->dist == 3) && (prg->num == 0)) snprintf(phba->OptionROMVersion, 32, "%d.%d%d", @@ -2255,6 +2254,101 @@ return; } +static void +lpfc_fill_vpd(struct lpfc_hba *phba, uint8_t *vpd, int length, int *pindex) +{ + int i, j; + + while (length > 0) { + /* Look for Serial Number */ + if ((vpd[*pindex] == 'S') && (vpd[*pindex + 1] == 'N')) { + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3+i); + while (i--) { + phba->SerialNumber[j++] = vpd[(*pindex)++]; + if (j == 31) + break; + } + phba->SerialNumber[j] = 0; + continue; + } else if ((vpd[*pindex] == 'V') && (vpd[*pindex + 1] == '1')) { + phba->vpd_flag |= VPD_MODEL_DESC; + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3+i); + while (i--) { + phba->ModelDesc[j++] = vpd[(*pindex)++]; + if (j == 255) + break; + } + phba->ModelDesc[j] = 0; + continue; + } else if ((vpd[*pindex] == 'V') && (vpd[*pindex + 1] == '2')) { + phba->vpd_flag |= VPD_MODEL_NAME; + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3+i); + while (i--) { + phba->ModelName[j++] = vpd[(*pindex)++]; + if (j == 79) + break; + } + phba->ModelName[j] = 0; + continue; + } else if ((vpd[*pindex] == 'V') && (vpd[*pindex + 1] == '3')) { + phba->vpd_flag |= VPD_PROGRAM_TYPE; + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3+i); + while (i--) { + phba->ProgramType[j++] = vpd[(*pindex)++]; + if (j == 255) + break; + } + phba->ProgramType[j] = 0; + continue; + } else if ((vpd[*pindex] == 'V') && (vpd[*pindex + 1] == '4')) { + phba->vpd_flag |= VPD_PORT; + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + j = 0; + length -= (3 + i); + while (i--) { + if ((phba->sli_rev == LPFC_SLI_REV4) && + (phba->sli4_hba.pport_name_sta == + LPFC_SLI4_PPNAME_GET)) { + j++; + (*pindex)++; + } else + phba->Port[j++] = vpd[(*pindex)++]; + if (j == 19) + break; + } + if ((phba->sli_rev != LPFC_SLI_REV4) || + (phba->sli4_hba.pport_name_sta == + LPFC_SLI4_PPNAME_NON)) + phba->Port[j] = 0; + continue; + } else { + *pindex += 2; + i = vpd[*pindex]; + *pindex += 1; + *pindex += i; + length -= (3 + i); + } + } +} + /** * lpfc_parse_vpd - Parse VPD (Vital Product Data) * @phba: pointer to lpfc hba data structure. @@ -2274,7 +2368,7 @@ { uint8_t lenlo, lenhi; int Length; - int i, j; + int i; int finished = 0; int index = 0; @@ -2307,101 +2401,10 @@ Length = ((((unsigned short)lenhi) << 8) + lenlo); if (Length > len - index) Length = len - index; - while (Length > 0) { - /* Look for Serial Number */ - if ((vpd[index] == 'S') && (vpd[index+1] == 'N')) { - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - phba->SerialNumber[j++] = vpd[index++]; - if (j == 31) - break; - } - phba->SerialNumber[j] = 0; - continue; - } - else if ((vpd[index] == 'V') && (vpd[index+1] == '1')) { - phba->vpd_flag |= VPD_MODEL_DESC; - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - phba->ModelDesc[j++] = vpd[index++]; - if (j == 255) - break; - } - phba->ModelDesc[j] = 0; - continue; - } - else if ((vpd[index] == 'V') && (vpd[index+1] == '2')) { - phba->vpd_flag |= VPD_MODEL_NAME; - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - phba->ModelName[j++] = vpd[index++]; - if (j == 79) - break; - } - phba->ModelName[j] = 0; - continue; - } - else if ((vpd[index] == 'V') && (vpd[index+1] == '3')) { - phba->vpd_flag |= VPD_PROGRAM_TYPE; - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - phba->ProgramType[j++] = vpd[index++]; - if (j == 255) - break; - } - phba->ProgramType[j] = 0; - continue; - } - else if ((vpd[index] == 'V') && (vpd[index+1] == '4')) { - phba->vpd_flag |= VPD_PORT; - index += 2; - i = vpd[index]; - index += 1; - j = 0; - Length -= (3+i); - while(i--) { - if ((phba->sli_rev == LPFC_SLI_REV4) && - (phba->sli4_hba.pport_name_sta == - LPFC_SLI4_PPNAME_GET)) { - j++; - index++; - } else - phba->Port[j++] = vpd[index++]; - if (j == 19) - break; - } - if ((phba->sli_rev != LPFC_SLI_REV4) || - (phba->sli4_hba.pport_name_sta == - LPFC_SLI4_PPNAME_NON)) - phba->Port[j] = 0; - continue; - } - else { - index += 2; - i = vpd[index]; - index += 1; - index += i; - Length -= (3 + i); - } - } - finished = 0; - break; + + lpfc_fill_vpd(phba, vpd, Length, &index); + finished = 0; + break; case 0x78: finished = 1; break; @@ -4821,7 +4824,7 @@ rc = lpfc_vmid_res_alloc(phba, vport); if (rc) - goto out; + goto out_put_shost; /* Initialize all internally managed lists. */ INIT_LIST_HEAD(&vport->fc_nodes); @@ -4839,16 +4842,17 @@ error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); if (error) - goto out_put_shost; + goto out_free_vmid; spin_lock_irq(&phba->port_list_lock); list_add_tail(&vport->listentry, &phba->port_list); spin_unlock_irq(&phba->port_list_lock); return vport; -out_put_shost: +out_free_vmid: kfree(vport->vmid); bitmap_free(vport->vmid_priority_range); +out_put_shost: scsi_host_put(shost); out: return NULL; @@ -8286,8 +8290,10 @@ &phba->pcidev->dev, phba->cfg_sg_dma_buf_size, i, 0); - if (!phba->lpfc_sg_dma_buf_pool) + if (!phba->lpfc_sg_dma_buf_pool) { + rc = -ENOMEM; goto out_free_bsmbx; + } phba->lpfc_cmd_rsp_buf_pool = dma_pool_create("lpfc_cmd_rsp_buf_pool", @@ -8295,8 +8301,10 @@ sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp), i, 0); - if (!phba->lpfc_cmd_rsp_buf_pool) + if (!phba->lpfc_cmd_rsp_buf_pool) { + rc = -ENOMEM; goto out_free_sg_dma_buf; + } mempool_free(mboxq, phba->mbox_mem_pool); @@ -12386,7 +12394,7 @@ for (i = 0; i < phba->cfg_irq_chann; i++) { eqhdl = lpfc_get_eq_hdl(i); - eqhdl->irq = LPFC_VECTOR_MAP_EMPTY; + eqhdl->irq = LPFC_IRQ_EMPTY; eqhdl->phba = phba; } } @@ -12759,7 +12767,7 @@ static void lpfc_cpuhp_remove(struct lpfc_hba *phba) { - if (phba->pport->fc_flag & FC_OFFLINE_MODE) + if (phba->pport && (phba->pport->fc_flag & FC_OFFLINE_MODE)) return; __lpfc_cpuhp_remove(phba); @@ -13023,9 +13031,17 @@ LPFC_DRIVER_HANDLER_NAME"%d", index); eqhdl->idx = index; - rc = request_irq(pci_irq_vector(phba->pcidev, index), - &lpfc_sli4_hba_intr_handler, 0, - name, eqhdl); + rc = pci_irq_vector(phba->pcidev, index); + if (rc < 0) { + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, + "0489 MSI-X fast-path (%d) " + "pci_irq_vec failed (%d)\n", index, rc); + goto cfg_fail_out; + } + eqhdl->irq = rc; + + rc = request_irq(eqhdl->irq, &lpfc_sli4_hba_intr_handler, 0, + name, eqhdl); if (rc) { lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, "0486 MSI-X fast-path (%d) " @@ -13033,8 +13049,6 @@ goto cfg_fail_out; } - eqhdl->irq = pci_irq_vector(phba->pcidev, index); - if (aff_mask) { /* If found a neighboring online cpu, set affinity */ if (cpu_select < nr_cpu_ids) @@ -13151,7 +13165,14 @@ } eqhdl = lpfc_get_eq_hdl(0); - eqhdl->irq = pci_irq_vector(phba->pcidev, 0); + rc = pci_irq_vector(phba->pcidev, 0); + if (rc < 0) { + pci_free_irq_vectors(phba->pcidev); + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, + "0496 MSI pci_irq_vec failed (%d)\n", rc); + return rc; + } + eqhdl->irq = rc; cpu = cpumask_first(cpu_present_mask); lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, cpu); @@ -13178,8 +13199,8 @@ * MSI-X -> MSI -> IRQ. * * Return codes - * 0 - successful - * other values - error + * Interrupt mode (2, 1, 0) - successful + * LPFC_INTR_ERROR - error **/ static uint32_t lpfc_sli4_enable_intr(struct lpfc_hba *phba, uint32_t cfg_mode) @@ -13224,7 +13245,14 @@ intr_mode = 0; eqhdl = lpfc_get_eq_hdl(0); - eqhdl->irq = pci_irq_vector(phba->pcidev, 0); + retval = pci_irq_vector(phba->pcidev, 0); + if (retval < 0) { + lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, + "0502 INTR pci_irq_vec failed (%d)\n", + retval); + return LPFC_INTR_ERROR; + } + eqhdl->irq = retval; cpu = cpumask_first(cpu_present_mask); lpfc_assign_eq_map_info(phba, 0, LPFC_CPU_FIRST_IRQ, diff -u linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_sli.c linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_sli.c --- linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_sli.c +++ linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_sli.c @@ -6197,6 +6197,9 @@ struct lpfc_mbx_get_rsrc_extent_info *rsrc_info; LPFC_MBOXQ_t *mbox; + *extnt_count = 0; + *extnt_size = 0; + mbox = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); if (!mbox) return -ENOMEM; diff -u linux-kvm-5.19.0/drivers/scsi/qla2xxx/qla_attr.c linux-kvm-5.19.0/drivers/scsi/qla2xxx/qla_attr.c --- linux-kvm-5.19.0/drivers/scsi/qla2xxx/qla_attr.c +++ linux-kvm-5.19.0/drivers/scsi/qla2xxx/qla_attr.c @@ -3329,11 +3329,34 @@ .bsg_timeout = qla24xx_bsg_timeout, }; +static uint +qla2x00_get_host_supported_speeds(scsi_qla_host_t *vha, uint speeds) +{ + uint supported_speeds = FC_PORTSPEED_UNKNOWN; + + if (speeds & FDMI_PORT_SPEED_64GB) + supported_speeds |= FC_PORTSPEED_64GBIT; + if (speeds & FDMI_PORT_SPEED_32GB) + supported_speeds |= FC_PORTSPEED_32GBIT; + if (speeds & FDMI_PORT_SPEED_16GB) + supported_speeds |= FC_PORTSPEED_16GBIT; + if (speeds & FDMI_PORT_SPEED_8GB) + supported_speeds |= FC_PORTSPEED_8GBIT; + if (speeds & FDMI_PORT_SPEED_4GB) + supported_speeds |= FC_PORTSPEED_4GBIT; + if (speeds & FDMI_PORT_SPEED_2GB) + supported_speeds |= FC_PORTSPEED_2GBIT; + if (speeds & FDMI_PORT_SPEED_1GB) + supported_speeds |= FC_PORTSPEED_1GBIT; + + return supported_speeds; +} + void qla2x00_init_host_attr(scsi_qla_host_t *vha) { struct qla_hw_data *ha = vha->hw; - u32 speeds = FC_PORTSPEED_UNKNOWN; + u32 speeds = 0, fdmi_speed = 0; fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count; fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name); @@ -3343,7 +3366,8 @@ fc_host_max_npiv_vports(vha->host) = ha->max_npiv_vports; fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count; - speeds = qla25xx_fdmi_port_speed_capability(ha); + fdmi_speed = qla25xx_fdmi_port_speed_capability(ha); + speeds = qla2x00_get_host_supported_speeds(vha, fdmi_speed); fc_host_supported_speeds(vha->host) = speeds; } diff -u linux-kvm-5.19.0/drivers/scsi/qla2xxx/qla_isr.c linux-kvm-5.19.0/drivers/scsi/qla2xxx/qla_isr.c --- linux-kvm-5.19.0/drivers/scsi/qla2xxx/qla_isr.c +++ linux-kvm-5.19.0/drivers/scsi/qla2xxx/qla_isr.c @@ -3771,6 +3771,8 @@ struct qla_hw_data *ha = vha->hw; struct purex_entry_24xx *purex_entry; struct purex_item *pure_item; + u16 rsp_in = 0; + int is_shadow_hba; if (!ha->flags.fw_started) return; @@ -3780,7 +3782,18 @@ qla_cpu_update(rsp->qpair, smp_processor_id()); } - while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) { +#define __update_rsp_in(_is_shadow_hba, _rsp, _rsp_in) \ + do { \ + _rsp_in = _is_shadow_hba ? *(_rsp)->in_ptr : \ + rd_reg_dword_relaxed((_rsp)->rsp_q_in); \ + } while (0) + + is_shadow_hba = IS_SHADOW_REG_CAPABLE(ha); + + __update_rsp_in(is_shadow_hba, rsp, rsp_in); + + while (rsp->ring_index != rsp_in && + rsp->ring_ptr->signature != RESPONSE_PROCESSED) { pkt = (struct sts_entry_24xx *)rsp->ring_ptr; rsp->ring_index++; @@ -3893,6 +3906,7 @@ } pure_item = qla27xx_copy_fpin_pkt(vha, (void **)&pkt, &rsp); + __update_rsp_in(is_shadow_hba, rsp, rsp_in); if (!pure_item) break; qla24xx_queue_purex_item(vha, pure_item, diff -u linux-kvm-5.19.0/drivers/scsi/scsi_sysfs.c linux-kvm-5.19.0/drivers/scsi/scsi_sysfs.c --- linux-kvm-5.19.0/drivers/scsi/scsi_sysfs.c +++ linux-kvm-5.19.0/drivers/scsi/scsi_sysfs.c @@ -828,6 +828,14 @@ } mutex_lock(&sdev->state_mutex); + switch (sdev->sdev_state) { + case SDEV_RUNNING: + case SDEV_OFFLINE: + break; + default: + mutex_unlock(&sdev->state_mutex); + return -EINVAL; + } if (sdev->sdev_state == SDEV_RUNNING && state == SDEV_RUNNING) { ret = 0; } else { diff -u linux-kvm-5.19.0/drivers/spi/spi-qup.c linux-kvm-5.19.0/drivers/spi/spi-qup.c --- linux-kvm-5.19.0/drivers/spi/spi-qup.c +++ linux-kvm-5.19.0/drivers/spi/spi-qup.c @@ -1057,6 +1057,8 @@ else master->num_chipselect = num_cs; + master->use_gpio_descriptors = true; + master->max_native_cs = SPI_NUM_CHIPSELECTS; master->bus_num = pdev->id; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); diff -u linux-kvm-5.19.0/drivers/tee/tee_shm.c linux-kvm-5.19.0/drivers/tee/tee_shm.c --- linux-kvm-5.19.0/drivers/tee/tee_shm.c +++ linux-kvm-5.19.0/drivers/tee/tee_shm.c @@ -327,9 +327,6 @@ void *ret; int id; - if (!access_ok((void __user *)addr, length)) - return ERR_PTR(-EFAULT); - mutex_lock(&teedev->mutex); id = idr_alloc(&teedev->idr, NULL, 1, 0, GFP_KERNEL); mutex_unlock(&teedev->mutex); diff -u linux-kvm-5.19.0/drivers/thermal/intel/intel_powerclamp.c linux-kvm-5.19.0/drivers/thermal/intel/intel_powerclamp.c --- linux-kvm-5.19.0/drivers/thermal/intel/intel_powerclamp.c +++ linux-kvm-5.19.0/drivers/thermal/intel/intel_powerclamp.c @@ -531,11 +531,7 @@ cpus_read_lock(); /* prefer BSP */ - control_cpu = 0; - if (!cpu_online(control_cpu)) { - control_cpu = get_cpu(); - put_cpu(); - } + control_cpu = cpumask_first(cpu_online_mask); clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); diff -u linux-kvm-5.19.0/drivers/tty/serial/8250/8250_pci.c linux-kvm-5.19.0/drivers/tty/serial/8250/8250_pci.c --- linux-kvm-5.19.0/drivers/tty/serial/8250/8250_pci.c +++ linux-kvm-5.19.0/drivers/tty/serial/8250/8250_pci.c @@ -1642,7 +1642,6 @@ resource_size_t bar_data[3]; u8 config_base; struct serial_private *priv = pci_get_drvdata(dev); - struct uart_8250_port *port; if (!(pci_resource_flags(dev, 5) & IORESOURCE_IO) || !(pci_resource_flags(dev, 4) & IORESOURCE_IO) || @@ -1689,13 +1688,7 @@ pci_write_config_byte(dev, config_base + 0x06, dev->irq); - if (priv) { - /* re-apply RS232/485 mode when - * pciserial_resume_ports() - */ - port = serial8250_get_port(priv->line[i]); - pci_fintek_rs485_config(&port->port, NULL); - } else { + if (!priv) { /* First init without port data * force init to RS232 Mode */ diff -u linux-kvm-5.19.0/drivers/tty/serial/8250/8250_port.c linux-kvm-5.19.0/drivers/tty/serial/8250/8250_port.c --- linux-kvm-5.19.0/drivers/tty/serial/8250/8250_port.c +++ linux-kvm-5.19.0/drivers/tty/serial/8250/8250_port.c @@ -600,7 +600,7 @@ static int serial8250_em485_init(struct uart_8250_port *p) { if (p->em485) - return 0; + goto deassert_rts; p->em485 = kmalloc(sizeof(struct uart_8250_em485), GFP_ATOMIC); if (!p->em485) @@ -616,7 +616,9 @@ p->em485->active_timer = NULL; p->em485->tx_stopped = true; - p->rs485_stop_tx(p); +deassert_rts: + if (p->em485->tx_stopped) + p->rs485_stop_tx(p); return 0; } @@ -2052,6 +2054,9 @@ static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl) { + if (port->rs485.flags & SER_RS485_ENABLED) + return; + if (port->set_mctrl) port->set_mctrl(port, mctrl); else @@ -3198,9 +3203,6 @@ if (flags & UART_CONFIG_TYPE) autoconfig(up); - if (port->rs485.flags & SER_RS485_ENABLED) - port->rs485_config(port, &port->rs485); - /* if access method is AU, it is a 16550 with a quirk */ if (port->type == PORT_16550A && port->iotype == UPIO_AU) up->bugs |= UART_BUG_NOMSR; diff -u linux-kvm-5.19.0/drivers/tty/serial/fsl_lpuart.c linux-kvm-5.19.0/drivers/tty/serial/fsl_lpuart.c --- linux-kvm-5.19.0/drivers/tty/serial/fsl_lpuart.c +++ linux-kvm-5.19.0/drivers/tty/serial/fsl_lpuart.c @@ -2713,10 +2713,6 @@ if (ret) goto failed_reset; - ret = uart_add_one_port(&lpuart_reg, &sport->port); - if (ret) - goto failed_attach_port; - ret = uart_get_rs485_mode(&sport->port); if (ret) goto failed_get_rs485; @@ -2728,7 +2724,9 @@ sport->port.rs485.delay_rts_after_send) dev_err(&pdev->dev, "driver doesn't support RTS delays\n"); - sport->port.rs485_config(&sport->port, &sport->port.rs485); + ret = uart_add_one_port(&lpuart_reg, &sport->port); + if (ret) + goto failed_attach_port; ret = devm_request_irq(&pdev->dev, sport->port.irq, handler, 0, DRIVER_NAME, sport); diff -u linux-kvm-5.19.0/drivers/tty/serial/xilinx_uartps.c linux-kvm-5.19.0/drivers/tty/serial/xilinx_uartps.c --- linux-kvm-5.19.0/drivers/tty/serial/xilinx_uartps.c +++ linux-kvm-5.19.0/drivers/tty/serial/xilinx_uartps.c @@ -1331,12 +1331,20 @@ unsigned long flags; u32 ctrl_reg; int may_wake; + int ret; may_wake = device_may_wakeup(device); if (console_suspend_enabled && uart_console(port) && !may_wake) { - clk_enable(cdns_uart->pclk); - clk_enable(cdns_uart->uartclk); + ret = clk_enable(cdns_uart->pclk); + if (ret) + return ret; + + ret = clk_enable(cdns_uart->uartclk); + if (ret) { + clk_disable(cdns_uart->pclk); + return ret; + } spin_lock_irqsave(&port->lock, flags); diff -u linux-kvm-5.19.0/drivers/usb/core/quirks.c linux-kvm-5.19.0/drivers/usb/core/quirks.c --- linux-kvm-5.19.0/drivers/usb/core/quirks.c +++ linux-kvm-5.19.0/drivers/usb/core/quirks.c @@ -388,6 +388,15 @@ /* Kingston DataTraveler 3.0 */ { USB_DEVICE(0x0951, 0x1666), .driver_info = USB_QUIRK_NO_LPM }, + /* NVIDIA Jetson devices in Force Recovery mode */ + { USB_DEVICE(0x0955, 0x7018), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x0955, 0x7019), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x0955, 0x7418), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x0955, 0x7721), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x0955, 0x7c18), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x0955, 0x7e19), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x0955, 0x7f21), .driver_info = USB_QUIRK_RESET_RESUME }, + /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, diff -u linux-kvm-5.19.0/drivers/usb/dwc3/core.c linux-kvm-5.19.0/drivers/usb/dwc3/core.c --- linux-kvm-5.19.0/drivers/usb/dwc3/core.c +++ linux-kvm-5.19.0/drivers/usb/dwc3/core.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -85,7 +86,7 @@ * mode. If the controller supports DRD but the dr_mode is not * specified or set to OTG, then set the mode to peripheral. */ - if (mode == USB_DR_MODE_OTG && + if (mode == USB_DR_MODE_OTG && !dwc->edev && (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) || !device_property_read_bool(dwc->dev, "usb-role-switch")) && !DWC3_VER_IS_PRIOR(DWC3, 330A)) @@ -1656,6 +1657,46 @@ } } +static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) +{ + struct device *dev = dwc->dev; + struct device_node *np_phy; + struct extcon_dev *edev = NULL; + const char *name; + + if (device_property_read_bool(dev, "extcon")) + return extcon_get_edev_by_phandle(dev, 0); + + /* + * Device tree platforms should get extcon via phandle. + * On ACPI platforms, we get the name from a device property. + * This device property is for kernel internal use only and + * is expected to be set by the glue code. + */ + if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) + return extcon_get_extcon_dev(name); + + /* + * Try to get an extcon device from the USB PHY controller's "port" + * node. Check if it has the "port" node first, to avoid printing the + * error message from underlying code, as it's a valid case: extcon + * device (and "port" node) may be missing in case of "usb-role-switch" + * or OTG mode. + */ + np_phy = of_parse_phandle(dev->of_node, "phys", 0); + if (of_graph_is_present(np_phy)) { + struct device_node *np_conn; + + np_conn = of_graph_get_remote_node(np_phy, -1, -1); + if (np_conn) + edev = extcon_find_edev_by_node(np_conn); + of_node_put(np_conn); + } + of_node_put(np_phy); + + return edev; +} + static int dwc3_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1806,6 +1847,12 @@ goto err2; } + dwc->edev = dwc3_get_extcon(dwc); + if (IS_ERR(dwc->edev)) { + ret = dev_err_probe(dwc->dev, PTR_ERR(dwc->edev), "failed to get extcon\n"); + goto err3; + } + ret = dwc3_get_dr_mode(dwc); if (ret) goto err3; reverted: --- linux-kvm-5.19.0/drivers/usb/dwc3/drd.c +++ linux-kvm-5.19.0.orig/drivers/usb/dwc3/drd.c @@ -8,7 +8,6 @@ */ #include -#include #include #include #include @@ -439,51 +438,6 @@ return NOTIFY_DONE; } -static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) -{ - struct device *dev = dwc->dev; - struct device_node *np_phy; - struct extcon_dev *edev = NULL; - const char *name; - - if (device_property_read_bool(dev, "extcon")) - return extcon_get_edev_by_phandle(dev, 0); - - /* - * Device tree platforms should get extcon via phandle. - * On ACPI platforms, we get the name from a device property. - * This device property is for kernel internal use only and - * is expected to be set by the glue code. - */ - if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) { - edev = extcon_get_extcon_dev(name); - if (!edev) - return ERR_PTR(-EPROBE_DEFER); - - return edev; - } - - /* - * Try to get an extcon device from the USB PHY controller's "port" - * node. Check if it has the "port" node first, to avoid printing the - * error message from underlying code, as it's a valid case: extcon - * device (and "port" node) may be missing in case of "usb-role-switch" - * or OTG mode. - */ - np_phy = of_parse_phandle(dev->of_node, "phys", 0); - if (of_graph_is_present(np_phy)) { - struct device_node *np_conn; - - np_conn = of_graph_get_remote_node(np_phy, -1, -1); - if (np_conn) - edev = extcon_find_edev_by_node(np_conn); - of_node_put(np_conn); - } - of_node_put(np_phy); - - return edev; -} - #if IS_ENABLED(CONFIG_USB_ROLE_SWITCH) #define ROLE_SWITCH 1 static int dwc3_usb_role_switch_set(struct usb_role_switch *sw, @@ -588,10 +542,6 @@ device_property_read_bool(dwc->dev, "usb-role-switch")) return dwc3_setup_role_switch(dwc); - dwc->edev = dwc3_get_extcon(dwc); - if (IS_ERR(dwc->edev)) - return PTR_ERR(dwc->edev); - if (dwc->edev) { dwc->edev_nb.notifier_call = dwc3_drd_notifier; ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST, diff -u linux-kvm-5.19.0/drivers/usb/dwc3/gadget.c linux-kvm-5.19.0/drivers/usb/dwc3/gadget.c --- linux-kvm-5.19.0/drivers/usb/dwc3/gadget.c +++ linux-kvm-5.19.0/drivers/usb/dwc3/gadget.c @@ -1276,8 +1276,8 @@ trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS; } - /* always enable Interrupt on Missed ISOC */ - trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; + if (!no_interrupt && !chain) + trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; break; case USB_ENDPOINT_XFER_BULK: @@ -2500,6 +2500,9 @@ if (dwc->ep0state != EP0_SETUP_PHASE) { int ret; + if (dwc->delayed_status) + dwc3_ep0_send_delayed_status(dwc); + reinit_completion(&dwc->ep0_in_setup); spin_unlock_irqrestore(&dwc->lock, flags); @@ -3214,6 +3217,10 @@ if (event->status & DEPEVT_STATUS_SHORT && !chain) return 1; + if ((trb->ctrl & DWC3_TRB_CTRL_ISP_IMI) && + DWC3_TRB_SIZE_TRBSTS(trb->size) == DWC3_TRBSTS_MISSED_ISOC) + return 1; + if ((trb->ctrl & DWC3_TRB_CTRL_IOC) || (trb->ctrl & DWC3_TRB_CTRL_LST)) return 1; diff -u linux-kvm-5.19.0/drivers/usb/gadget/function/uvc_queue.c linux-kvm-5.19.0/drivers/usb/gadget/function/uvc_queue.c --- linux-kvm-5.19.0/drivers/usb/gadget/function/uvc_queue.c +++ linux-kvm-5.19.0/drivers/usb/gadget/function/uvc_queue.c @@ -84,12 +84,9 @@ return -ENODEV; buf->state = UVC_BUF_STATE_QUEUED; - if (queue->use_sg) { - buf->sgt = vb2_dma_sg_plane_desc(vb, 0); - buf->sg = buf->sgt->sgl; - } else { - buf->mem = vb2_plane_vaddr(vb, 0); - } + buf->sgt = vb2_dma_sg_plane_desc(vb, 0); + buf->sg = buf->sgt->sgl; + buf->mem = vb2_plane_vaddr(vb, 0); buf->length = vb2_plane_size(vb, 0); if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) buf->bytesused = 0; @@ -304,6 +301,7 @@ queue->sequence = 0; queue->buf_used = 0; + queue->flags &= ~UVC_QUEUE_DROP_INCOMPLETE; } else { ret = vb2_streamoff(&queue->queue, queue->queue.type); if (ret < 0) @@ -329,10 +327,11 @@ void uvcg_complete_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) { - if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && - buf->length != buf->bytesused) { - buf->state = UVC_BUF_STATE_QUEUED; + if (queue->flags & UVC_QUEUE_DROP_INCOMPLETE) { + queue->flags &= ~UVC_QUEUE_DROP_INCOMPLETE; + buf->state = UVC_BUF_STATE_ERROR; vb2_set_plane_payload(&buf->buf.vb2_buf, 0, 0); + vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_ERROR); return; } diff -u linux-kvm-5.19.0/drivers/usb/gadget/function/uvc_video.c linux-kvm-5.19.0/drivers/usb/gadget/function/uvc_video.c --- linux-kvm-5.19.0/drivers/usb/gadget/function/uvc_video.c +++ linux-kvm-5.19.0/drivers/usb/gadget/function/uvc_video.c @@ -88,6 +88,7 @@ struct uvc_buffer *buf) { void *mem = req->buf; + struct uvc_request *ureq = req->context; int len = video->req_size; int ret; @@ -113,13 +114,14 @@ video->queue.buf_used = 0; buf->state = UVC_BUF_STATE_DONE; list_del(&buf->queue); - uvcg_complete_buffer(&video->queue, buf); video->fid ^= UVC_STREAM_FID; + ureq->last_buf = buf; video->payload_size = 0; } if (video->payload_size == video->max_payload_size || + video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE || buf->bytesused == video->queue.buf_used) video->payload_size = 0; } @@ -155,10 +157,10 @@ sg = sg_next(sg); for_each_sg(sg, iter, ureq->sgt.nents - 1, i) { - if (!len || !buf->sg || !sg_dma_len(buf->sg)) + if (!len || !buf->sg || !buf->sg->length) break; - sg_left = sg_dma_len(buf->sg) - buf->offset; + sg_left = buf->sg->length - buf->offset; part = min_t(unsigned int, len, sg_left); sg_set_page(iter, sg_page(buf->sg), part, buf->offset); @@ -180,7 +182,8 @@ req->length -= len; video->queue.buf_used += req->length - header_len; - if (buf->bytesused == video->queue.buf_used || !buf->sg) { + if (buf->bytesused == video->queue.buf_used || !buf->sg || + video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) { video->queue.buf_used = 0; buf->state = UVC_BUF_STATE_DONE; buf->offset = 0; @@ -195,6 +198,7 @@ struct uvc_buffer *buf) { void *mem = req->buf; + struct uvc_request *ureq = req->context; int len = video->req_size; int ret; @@ -209,12 +213,13 @@ req->length = video->req_size - len; - if (buf->bytesused == video->queue.buf_used) { + if (buf->bytesused == video->queue.buf_used || + video->queue.flags & UVC_QUEUE_DROP_INCOMPLETE) { video->queue.buf_used = 0; buf->state = UVC_BUF_STATE_DONE; list_del(&buf->queue); - uvcg_complete_buffer(&video->queue, buf); video->fid ^= UVC_STREAM_FID; + ureq->last_buf = buf; } } @@ -255,6 +260,11 @@ case 0: break; + case -EXDEV: + uvcg_dbg(&video->uvc->func, "VS request missed xfer.\n"); + queue->flags |= UVC_QUEUE_DROP_INCOMPLETE; + break; + case -ESHUTDOWN: /* disconnect from host. */ uvcg_dbg(&video->uvc->func, "VS request cancelled.\n"); uvcg_queue_cancel(queue, 1); @@ -431,7 +441,8 @@ /* Endpoint now owns the request */ req = NULL; - video->req_int_count++; + if (buf->state != UVC_BUF_STATE_DONE) + video->req_int_count++; } if (!req) @@ -448,6 +459,9 @@ */ int uvcg_video_enable(struct uvc_video *video, int enable) { + struct uvc_device *uvc = video->uvc; + struct usb_composite_dev *cdev = uvc->func.config->cdev; + struct usb_gadget *gadget = cdev->gadget; unsigned int i; int ret; @@ -479,9 +493,11 @@ if (video->max_payload_size) { video->encode = uvc_video_encode_bulk; video->payload_size = 0; - } else - video->encode = video->queue.use_sg ? + } else { + video->encode = (video->queue.use_sg && + !(gadget->speed <= USB_SPEED_HIGH)) ? uvc_video_encode_isoc_sg : uvc_video_encode_isoc; + } video->req_int_count = 0; diff -u linux-kvm-5.19.0/drivers/usb/host/xhci-mem.c linux-kvm-5.19.0/drivers/usb/host/xhci-mem.c --- linux-kvm-5.19.0/drivers/usb/host/xhci-mem.c +++ linux-kvm-5.19.0/drivers/usb/host/xhci-mem.c @@ -889,15 +889,19 @@ if (dev->eps[i].stream_info) xhci_free_stream_info(xhci, dev->eps[i].stream_info); - /* Endpoints on the TT/root port lists should have been removed - * when usb_disable_device() was called for the device. - * We can't drop them anyway, because the udev might have gone - * away by this point, and we can't tell what speed it was. + /* + * Endpoints are normally deleted from the bandwidth list when + * endpoints are dropped, before device is freed. + * If host is dying or being removed then endpoints aren't + * dropped cleanly, so delete the endpoint from list here. + * Only applicable for hosts with software bandwidth checking. */ - if (!list_empty(&dev->eps[i].bw_endpoint_list)) - xhci_warn(xhci, "Slot %u endpoint %u " - "not removed from BW list!\n", - slot_id, i); + + if (!list_empty(&dev->eps[i].bw_endpoint_list)) { + list_del_init(&dev->eps[i].bw_endpoint_list); + xhci_dbg(xhci, "Slot %u endpoint %u not removed from BW list!\n", + slot_id, i); + } } /* If this is a hub, free the TT(s) from the TT list */ xhci_free_tt_info(xhci, dev, slot_id); diff -u linux-kvm-5.19.0/drivers/usb/host/xhci.c linux-kvm-5.19.0/drivers/usb/host/xhci.c --- linux-kvm-5.19.0/drivers/usb/host/xhci.c +++ linux-kvm-5.19.0/drivers/usb/host/xhci.c @@ -810,9 +810,15 @@ spin_lock_irq(&xhci->lock); xhci_halt(xhci); - /* Workaround for spurious wakeups at shutdown with HSW */ - if (xhci->quirks & XHCI_SPURIOUS_WAKEUP) + + /* + * Workaround for spurious wakeps at shutdown with HSW, and for boot + * firmware delay in ADL-P PCH if port are left in U3 at shutdown + */ + if (xhci->quirks & XHCI_SPURIOUS_WAKEUP || + xhci->quirks & XHCI_RESET_TO_DEFAULT) xhci_reset(xhci, XHCI_RESET_SHORT_USEC); + spin_unlock_irq(&xhci->lock); xhci_cleanup_msix(xhci); diff -u linux-kvm-5.19.0/drivers/usb/host/xhci.h linux-kvm-5.19.0/drivers/usb/host/xhci.h --- linux-kvm-5.19.0/drivers/usb/host/xhci.h +++ linux-kvm-5.19.0/drivers/usb/host/xhci.h @@ -1900,6 +1900,7 @@ #define XHCI_BROKEN_D3COLD BIT_ULL(41) #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) +#define XHCI_RESET_TO_DEFAULT BIT_ULL(44) unsigned int num_active_eps; unsigned int limit_active_eps; diff -u linux-kvm-5.19.0/drivers/usb/typec/ucsi/ucsi.c linux-kvm-5.19.0/drivers/usb/typec/ucsi/ucsi.c --- linux-kvm-5.19.0/drivers/usb/typec/ucsi/ucsi.c +++ linux-kvm-5.19.0/drivers/usb/typec/ucsi/ucsi.c @@ -183,16 +183,6 @@ } EXPORT_SYMBOL_GPL(ucsi_send_command); -int ucsi_resume(struct ucsi *ucsi) -{ - u64 command; - - /* Restore UCSI notification enable mask after system resume */ - command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy; - - return ucsi_send_command(ucsi, command, NULL, 0); -} -EXPORT_SYMBOL_GPL(ucsi_resume); /* -------------------------------------------------------------------------- */ struct ucsi_work { @@ -744,6 +734,7 @@ static int ucsi_check_connection(struct ucsi_connector *con) { + u8 prev_flags = con->status.flags; u64 command; int ret; @@ -754,10 +745,13 @@ return ret; } + if (con->status.flags == prev_flags) + return 0; + if (con->status.flags & UCSI_CONSTAT_CONNECTED) { - if (UCSI_CONSTAT_PWR_OPMODE(con->status.flags) == - UCSI_CONSTAT_PWR_OPMODE_PD) - ucsi_partner_task(con, ucsi_check_altmodes, 30, 0); + ucsi_register_partner(con); + ucsi_pwr_opmode_change(con); + ucsi_partner_change(con); } else { ucsi_partner_change(con); ucsi_port_psy_changed(con); @@ -1276,6 +1270,28 @@ return ret; } +int ucsi_resume(struct ucsi *ucsi) +{ + struct ucsi_connector *con; + u64 command; + int ret; + + /* Restore UCSI notification enable mask after system resume */ + command = UCSI_SET_NOTIFICATION_ENABLE | ucsi->ntfy; + ret = ucsi_send_command(ucsi, command, NULL, 0); + if (ret < 0) + return ret; + + for (con = ucsi->connector; con->port; con++) { + mutex_lock(&con->lock); + ucsi_check_connection(con); + mutex_unlock(&con->lock); + } + + return 0; +} +EXPORT_SYMBOL_GPL(ucsi_resume); + static void ucsi_init_work(struct work_struct *work) { struct ucsi *ucsi = container_of(work, struct ucsi, work.work); diff -u linux-kvm-5.19.0/drivers/video/fbdev/smscufx.c linux-kvm-5.19.0/drivers/video/fbdev/smscufx.c --- linux-kvm-5.19.0/drivers/video/fbdev/smscufx.c +++ linux-kvm-5.19.0/drivers/video/fbdev/smscufx.c @@ -97,7 +97,6 @@ struct kref kref; int fb_count; bool virtualized; /* true when physical usb device not present */ - struct delayed_work free_framebuffer_work; atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */ atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */ u8 *edid; /* null until we read edid from hw or get from sysfs */ @@ -1117,15 +1116,24 @@ { struct ufx_data *dev = container_of(kref, struct ufx_data, kref); - /* this function will wait for all in-flight urbs to complete */ - if (dev->urbs.count > 0) - ufx_free_urb_list(dev); + kfree(dev); +} - pr_debug("freeing ufx_data %p", dev); +static void ufx_ops_destory(struct fb_info *info) +{ + struct ufx_data *dev = info->par; + int node = info->node; - kfree(dev); + /* Assume info structure is freed after this point */ + framebuffer_release(info); + + pr_debug("fb_info for /dev/fb%d has been freed", node); + + /* release reference taken by kref_init in probe() */ + kref_put(&dev->kref, ufx_free); } + static void ufx_release_urb_work(struct work_struct *work) { struct urb_node *unode = container_of(work, struct urb_node, @@ -1134,14 +1142,9 @@ up(&unode->dev->urbs.limit_sem); } -static void ufx_free_framebuffer_work(struct work_struct *work) +static void ufx_free_framebuffer(struct ufx_data *dev) { - struct ufx_data *dev = container_of(work, struct ufx_data, - free_framebuffer_work.work); struct fb_info *info = dev->info; - int node = info->node; - - unregister_framebuffer(info); if (info->cmap.len != 0) fb_dealloc_cmap(&info->cmap); @@ -1153,11 +1156,6 @@ dev->info = NULL; - /* Assume info structure is freed after this point */ - framebuffer_release(info); - - pr_debug("fb_info for /dev/fb%d has been freed", node); - /* ref taken in probe() as part of registering framebfufer */ kref_put(&dev->kref, ufx_free); } @@ -1169,11 +1167,13 @@ { struct ufx_data *dev = info->par; + mutex_lock(&disconnect_mutex); + dev->fb_count--; /* We can't free fb_info here - fbmem will touch it when we return */ if (dev->virtualized && (dev->fb_count == 0)) - schedule_delayed_work(&dev->free_framebuffer_work, HZ); + ufx_free_framebuffer(dev); if ((dev->fb_count == 0) && (info->fbdefio)) { fb_deferred_io_cleanup(info); @@ -1186,6 +1186,8 @@ kref_put(&dev->kref, ufx_free); + mutex_unlock(&disconnect_mutex); + return 0; } @@ -1292,6 +1294,7 @@ .fb_blank = ufx_ops_blank, .fb_check_var = ufx_ops_check_var, .fb_set_par = ufx_ops_set_par, + .fb_destroy = ufx_ops_destory, }; /* Assumes &info->lock held by caller @@ -1673,9 +1676,6 @@ goto destroy_modedb; } - INIT_DELAYED_WORK(&dev->free_framebuffer_work, - ufx_free_framebuffer_work); - retval = ufx_reg_read(dev, 0x3000, &id_rev); check_warn_goto_error(retval, "error %d reading 0x3000 register from device", retval); dev_dbg(dev->gdev, "ID_REV register value 0x%08x", id_rev); @@ -1748,10 +1748,12 @@ static void ufx_usb_disconnect(struct usb_interface *interface) { struct ufx_data *dev; + struct fb_info *info; mutex_lock(&disconnect_mutex); dev = usb_get_intfdata(interface); + info = dev->info; pr_debug("USB disconnect starting\n"); @@ -1765,12 +1767,15 @@ /* if clients still have us open, will be freed on last close */ if (dev->fb_count == 0) - schedule_delayed_work(&dev->free_framebuffer_work, 0); + ufx_free_framebuffer(dev); - /* release reference taken by kref_init in probe() */ - kref_put(&dev->kref, ufx_free); + /* this function will wait for all in-flight urbs to complete */ + if (dev->urbs.count > 0) + ufx_free_urb_list(dev); + + pr_debug("freeing ufx_data %p", dev); - /* consider ufx_data freed */ + unregister_framebuffer(info); mutex_unlock(&disconnect_mutex); } diff -u linux-kvm-5.19.0/drivers/video/fbdev/stifb.c linux-kvm-5.19.0/drivers/video/fbdev/stifb.c --- linux-kvm-5.19.0/drivers/video/fbdev/stifb.c +++ linux-kvm-5.19.0/drivers/video/fbdev/stifb.c @@ -1055,7 +1055,8 @@ { struct stifb_info *fb = container_of(info, struct stifb_info, info); - if (rect->rop != ROP_COPY) + if (rect->rop != ROP_COPY || + (fb->id == S9000_ID_HCRX && fb->info.var.bits_per_pixel == 32)) return cfb_fillrect(info, rect); SETUP_HW(fb); diff -u linux-kvm-5.19.0/fs/btrfs/ctree.h linux-kvm-5.19.0/fs/btrfs/ctree.h --- linux-kvm-5.19.0/fs/btrfs/ctree.h +++ linux-kvm-5.19.0/fs/btrfs/ctree.h @@ -3362,7 +3362,10 @@ ssize_t btrfs_do_encoded_write(struct kiocb *iocb, struct iov_iter *from, const struct btrfs_ioctl_encoded_io_args *encoded); -ssize_t btrfs_dio_rw(struct kiocb *iocb, struct iov_iter *iter, size_t done_before); +ssize_t btrfs_dio_read(struct kiocb *iocb, struct iov_iter *iter, + size_t done_before); +struct iomap_dio *btrfs_dio_write(struct kiocb *iocb, struct iov_iter *iter, + size_t done_before); extern const struct dentry_operations btrfs_dentry_operations; diff -u linux-kvm-5.19.0/fs/btrfs/extent-tree.c linux-kvm-5.19.0/fs/btrfs/extent-tree.c --- linux-kvm-5.19.0/fs/btrfs/extent-tree.c +++ linux-kvm-5.19.0/fs/btrfs/extent-tree.c @@ -3310,21 +3310,22 @@ } /* - * If this is a leaf and there are tree mod log users, we may - * have recorded mod log operations that point to this leaf. - * So we must make sure no one reuses this leaf's extent before - * mod log operations are applied to a node, otherwise after - * rewinding a node using the mod log operations we get an - * inconsistent btree, as the leaf's extent may now be used as - * a node or leaf for another different btree. + * If there are tree mod log users we may have recorded mod log + * operations for this node. If we re-allocate this node we + * could replay operations on this node that happened when it + * existed in a completely different root. For example if it + * was part of root A, then was reallocated to root B, and we + * are doing a btrfs_old_search_slot(root b), we could replay + * operations that happened when the block was part of root A, + * giving us an inconsistent view of the btree. + * * We are safe from races here because at this point no other * node or root points to this extent buffer, so if after this - * check a new tree mod log user joins, it will not be able to - * find a node pointing to this leaf and record operations that - * point to this leaf. + * check a new tree mod log user joins we will not have an + * existing log of operations on this node that we have to + * contend with. */ - if (btrfs_header_level(buf) == 0 && - test_bit(BTRFS_FS_TREE_MOD_LOG_USERS, &fs_info->flags)) + if (test_bit(BTRFS_FS_TREE_MOD_LOG_USERS, &fs_info->flags)) must_pin = true; if (must_pin || btrfs_is_zoned(fs_info)) { diff -u linux-kvm-5.19.0/fs/btrfs/file.c linux-kvm-5.19.0/fs/btrfs/file.c --- linux-kvm-5.19.0/fs/btrfs/file.c +++ linux-kvm-5.19.0/fs/btrfs/file.c @@ -1890,6 +1890,7 @@ loff_t endbyte; ssize_t err; unsigned int ilock_flags = 0; + struct iomap_dio *dio; if (iocb->ki_flags & IOCB_NOWAIT) ilock_flags |= BTRFS_ILOCK_TRY; @@ -1959,11 +1960,22 @@ * So here we disable page faults in the iov_iter and then retry if we * got -EFAULT, faulting in the pages before the retry. */ -again: from->nofault = true; - err = btrfs_dio_rw(iocb, from, written); + dio = btrfs_dio_write(iocb, from, written); from->nofault = false; + /* + * iomap_dio_complete() will call btrfs_sync_file() if we have a dsync + * iocb, and that needs to lock the inode. So unlock it before calling + * iomap_dio_complete() to avoid a deadlock. + */ + btrfs_inode_unlock(inode, ilock_flags); + + if (IS_ERR_OR_NULL(dio)) + err = PTR_ERR_OR_ZERO(dio); + else + err = iomap_dio_complete(dio); + /* No increment (+=) because iomap returns a cumulative value. */ if (err > 0) written = err; @@ -1989,12 +2001,10 @@ } else { fault_in_iov_iter_readable(from, left); prev_left = left; - goto again; + goto relock; } } - btrfs_inode_unlock(inode, ilock_flags); - /* * Add back IOCB_DSYNC. Our caller, btrfs_file_write_iter(), will do * the fsync (call generic_write_sync()). @@ -3787,7 +3797,7 @@ */ pagefault_disable(); to->nofault = true; - ret = btrfs_dio_rw(iocb, to, read); + ret = btrfs_dio_read(iocb, to, read); to->nofault = false; pagefault_enable(); diff -u linux-kvm-5.19.0/fs/btrfs/free-space-cache.c linux-kvm-5.19.0/fs/btrfs/free-space-cache.c --- linux-kvm-5.19.0/fs/btrfs/free-space-cache.c +++ linux-kvm-5.19.0/fs/btrfs/free-space-cache.c @@ -48,25 +48,6 @@ struct btrfs_free_space *info, u64 offset, u64 bytes, bool update_stats); -static void __btrfs_remove_free_space_cache_locked( - struct btrfs_free_space_ctl *ctl) -{ - struct btrfs_free_space *info; - struct rb_node *node; - - while ((node = rb_last(&ctl->free_space_offset)) != NULL) { - info = rb_entry(node, struct btrfs_free_space, offset_index); - if (!info->bitmap) { - unlink_free_space(ctl, info, true); - kmem_cache_free(btrfs_free_space_cachep, info); - } else { - free_bitmap(ctl, info); - } - - cond_resched_lock(&ctl->tree_lock); - } -} - static struct inode *__lookup_free_space_inode(struct btrfs_root *root, struct btrfs_path *path, u64 offset) @@ -900,14 +881,7 @@ return ret; free_cache: io_ctl_drop_pages(&io_ctl); - - /* - * We need to call the _locked variant so we don't try to update the - * discard counters. - */ - spin_lock(&ctl->tree_lock); - __btrfs_remove_free_space_cache_locked(ctl); - spin_unlock(&ctl->tree_lock); + __btrfs_remove_free_space_cache(ctl); goto out; } @@ -1033,13 +1007,7 @@ if (ret == 0) ret = 1; } else { - /* - * We need to call the _locked variant so we don't try to update - * the discard counters. - */ - spin_lock(&tmp_ctl.tree_lock); __btrfs_remove_free_space_cache(&tmp_ctl); - spin_unlock(&tmp_ctl.tree_lock); btrfs_warn(fs_info, "block group %llu has wrong amount of free space", block_group->start); @@ -3002,6 +2970,25 @@ btrfs_put_block_group(block_group); } +static void __btrfs_remove_free_space_cache_locked( + struct btrfs_free_space_ctl *ctl) +{ + struct btrfs_free_space *info; + struct rb_node *node; + + while ((node = rb_last(&ctl->free_space_offset)) != NULL) { + info = rb_entry(node, struct btrfs_free_space, offset_index); + if (!info->bitmap) { + unlink_free_space(ctl, info, true); + kmem_cache_free(btrfs_free_space_cachep, info); + } else { + free_bitmap(ctl, info); + } + + cond_resched_lock(&ctl->tree_lock); + } +} + void __btrfs_remove_free_space_cache(struct btrfs_free_space_ctl *ctl) { spin_lock(&ctl->tree_lock); diff -u linux-kvm-5.19.0/fs/btrfs/inode.c linux-kvm-5.19.0/fs/btrfs/inode.c --- linux-kvm-5.19.0/fs/btrfs/inode.c +++ linux-kvm-5.19.0/fs/btrfs/inode.c @@ -8164,7 +8164,7 @@ */ status = BLK_STS_RESOURCE; dip->csums = kcalloc(nr_sectors, fs_info->csum_size, GFP_NOFS); - if (!dip) + if (!dip->csums) goto out_err; status = btrfs_lookup_bio_sums(inode, dio_bio, dip->csums); @@ -8270,7 +8270,7 @@ .bio_set = &btrfs_dio_bioset, }; -ssize_t btrfs_dio_rw(struct kiocb *iocb, struct iov_iter *iter, size_t done_before) +ssize_t btrfs_dio_read(struct kiocb *iocb, struct iov_iter *iter, size_t done_before) { struct btrfs_dio_data data; @@ -8278,6 +8278,15 @@ IOMAP_DIO_PARTIAL, &data, done_before); } +struct iomap_dio *btrfs_dio_write(struct kiocb *iocb, struct iov_iter *iter, + size_t done_before) +{ + struct btrfs_dio_data data; + + return __iomap_dio_rw(iocb, iter, &btrfs_dio_iomap_ops, &btrfs_dio_ops, + IOMAP_DIO_PARTIAL, &data, done_before); +} + static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, u64 start, u64 len) { diff -u linux-kvm-5.19.0/fs/cifs/cifsfs.c linux-kvm-5.19.0/fs/cifs/cifsfs.c --- linux-kvm-5.19.0/fs/cifs/cifsfs.c +++ linux-kvm-5.19.0/fs/cifs/cifsfs.c @@ -1281,8 +1281,11 @@ ssize_t rc; struct cifsFileInfo *cfile = dst_file->private_data; - if (cfile->swapfile) - return -EOPNOTSUPP; + if (cfile->swapfile) { + rc = -EOPNOTSUPP; + free_xid(xid); + return rc; + } rc = cifs_file_copychunk_range(xid, src_file, off, dst_file, destoff, len, flags); diff -u linux-kvm-5.19.0/fs/cifs/connect.c linux-kvm-5.19.0/fs/cifs/connect.c --- linux-kvm-5.19.0/fs/cifs/connect.c +++ linux-kvm-5.19.0/fs/cifs/connect.c @@ -3846,12 +3846,11 @@ pSMB->AndXCommand = 0xFF; pSMB->Flags = cpu_to_le16(TCON_EXTENDED_SECINFO); bcc_ptr = &pSMB->Password[0]; - if (tcon->pipe || (ses->server->sec_mode & SECMODE_USER)) { - pSMB->PasswordLength = cpu_to_le16(1); /* minimum */ - *bcc_ptr = 0; /* password is null byte */ - bcc_ptr++; /* skip password */ - /* already aligned so no need to do it below */ - } + + pSMB->PasswordLength = cpu_to_le16(1); /* minimum */ + *bcc_ptr = 0; /* password is null byte */ + bcc_ptr++; /* skip password */ + /* already aligned so no need to do it below */ if (ses->server->sign) smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; diff -u linux-kvm-5.19.0/fs/cifs/file.c linux-kvm-5.19.0/fs/cifs/file.c --- linux-kvm-5.19.0/fs/cifs/file.c +++ linux-kvm-5.19.0/fs/cifs/file.c @@ -1812,11 +1812,13 @@ struct cifsFileInfo *cfile; __u32 type; - rc = -EACCES; xid = get_xid(); - if (!(fl->fl_flags & FL_FLOCK)) - return -ENOLCK; + if (!(fl->fl_flags & FL_FLOCK)) { + rc = -ENOLCK; + free_xid(xid); + return rc; + } cfile = (struct cifsFileInfo *)file->private_data; tcon = tlink_tcon(cfile->tlink); @@ -1835,8 +1837,9 @@ * if no lock or unlock then nothing to do since we do not * know what it is */ + rc = -EOPNOTSUPP; free_xid(xid); - return -EOPNOTSUPP; + return rc; } rc = cifs_setlk(file, fl, type, wait_flag, posix_lck, lock, unlock, diff -u linux-kvm-5.19.0/fs/cifs/smb2ops.c linux-kvm-5.19.0/fs/cifs/smb2ops.c --- linux-kvm-5.19.0/fs/cifs/smb2ops.c +++ linux-kvm-5.19.0/fs/cifs/smb2ops.c @@ -529,6 +529,7 @@ p = buf; spin_lock(&ses->iface_lock); + ses->iface_count = 0; /* * Go through iface_list and do kref_put to remove * any unused ifaces. ifaces in use will be removed @@ -649,9 +650,9 @@ kref_put(&iface->refcount, release_iface); } else list_add_tail(&info->iface_head, &ses->iface_list); - spin_unlock(&ses->iface_lock); ses->iface_count++; + spin_unlock(&ses->iface_lock); ses->iface_last_update = jiffies; next_iface: nb_iface++; diff -u linux-kvm-5.19.0/fs/cifs/smb2pdu.c linux-kvm-5.19.0/fs/cifs/smb2pdu.c --- linux-kvm-5.19.0/fs/cifs/smb2pdu.c +++ linux-kvm-5.19.0/fs/cifs/smb2pdu.c @@ -1525,7 +1525,7 @@ &blob_length, ses, server, sess_data->nls_cp); if (rc) - goto out_err; + goto out; if (use_spnego) { /* BB eventually need to add this */ diff -u linux-kvm-5.19.0/fs/exec.c linux-kvm-5.19.0/fs/exec.c --- linux-kvm-5.19.0/fs/exec.c +++ linux-kvm-5.19.0/fs/exec.c @@ -1200,11 +1200,11 @@ return -ENOMEM; refcount_set(&newsighand->count, 1); - memcpy(newsighand->action, oldsighand->action, - sizeof(newsighand->action)); write_lock_irq(&tasklist_lock); spin_lock(&oldsighand->siglock); + memcpy(newsighand->action, oldsighand->action, + sizeof(newsighand->action)); rcu_assign_pointer(me->sighand, newsighand); spin_unlock(&oldsighand->siglock); write_unlock_irq(&tasklist_lock); diff -u linux-kvm-5.19.0/fs/ext4/ioctl.c linux-kvm-5.19.0/fs/ext4/ioctl.c --- linux-kvm-5.19.0/fs/ext4/ioctl.c +++ linux-kvm-5.19.0/fs/ext4/ioctl.c @@ -135,9 +135,8 @@ if (ext4_has_metadata_csum(sb) && es->s_checksum != ext4_superblock_csum(sb, es)) { ext4_msg(sb, KERN_ERR, "Invalid checksum for backup " - "superblock %llu\n", sb_block); + "superblock %llu", sb_block); unlock_buffer(bh); - err = -EFSBADCRC; goto out_bh; } func(es, arg); diff -u linux-kvm-5.19.0/fs/ext4/migrate.c linux-kvm-5.19.0/fs/ext4/migrate.c --- linux-kvm-5.19.0/fs/ext4/migrate.c +++ linux-kvm-5.19.0/fs/ext4/migrate.c @@ -425,7 +425,8 @@ * already is extent-based, error out. */ if (!ext4_has_feature_extents(inode->i_sb) || - (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) + ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) || + ext4_has_inline_data(inode)) return -EINVAL; if (S_ISLNK(inode->i_mode) && inode->i_blocks == 0) diff -u linux-kvm-5.19.0/fs/ext4/namei.c linux-kvm-5.19.0/fs/ext4/namei.c --- linux-kvm-5.19.0/fs/ext4/namei.c +++ linux-kvm-5.19.0/fs/ext4/namei.c @@ -2259,8 +2259,16 @@ memset(de, 0, len); /* wipe old data */ de = (struct ext4_dir_entry_2 *) data2; top = data2 + len; - while ((char *)(de2 = ext4_next_entry(de, blocksize)) < top) + while ((char *)(de2 = ext4_next_entry(de, blocksize)) < top) { + if (ext4_check_dir_entry(dir, NULL, de, bh2, data2, len, + (data2 + (blocksize - csum_size) - + (char *) de))) { + brelse(bh2); + brelse(bh); + return -EFSCORRUPTED; + } de = de2; + } de->rec_len = ext4_rec_len_to_disk(data2 + (blocksize - csum_size) - (char *) de, blocksize); diff -u linux-kvm-5.19.0/fs/ext4/resize.c linux-kvm-5.19.0/fs/ext4/resize.c --- linux-kvm-5.19.0/fs/ext4/resize.c +++ linux-kvm-5.19.0/fs/ext4/resize.c @@ -1155,6 +1155,7 @@ while (group < sbi->s_groups_count) { struct buffer_head *bh; ext4_fsblk_t backup_block; + struct ext4_super_block *es; /* Out of journal space, and can't get more - abort - so sad */ err = ext4_resize_ensure_credits_batch(handle, 1); @@ -1183,6 +1184,10 @@ memcpy(bh->b_data, data, size); if (rest) memset(bh->b_data + size, 0, rest); + es = (struct ext4_super_block *) bh->b_data; + es->s_block_group_nr = cpu_to_le16(group); + if (ext4_has_metadata_csum(sb)) + es->s_checksum = ext4_superblock_csum(sb, es); set_buffer_uptodate(bh); unlock_buffer(bh); err = ext4_handle_dirty_metadata(handle, NULL, bh); diff -u linux-kvm-5.19.0/fs/fuse/file.c linux-kvm-5.19.0/fs/fuse/file.c --- linux-kvm-5.19.0/fs/fuse/file.c +++ linux-kvm-5.19.0/fs/fuse/file.c @@ -3002,6 +3002,10 @@ goto out; } + err = file_modified(file); + if (err) + goto out; + if (!(mode & FALLOC_FL_KEEP_SIZE)) set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); diff -u linux-kvm-5.19.0/fs/kernfs/dir.c linux-kvm-5.19.0/fs/kernfs/dir.c --- linux-kvm-5.19.0/fs/kernfs/dir.c +++ linux-kvm-5.19.0/fs/kernfs/dir.c @@ -1585,8 +1585,11 @@ down_write(&root->kernfs_rwsem); kn = kernfs_find_ns(parent, name, ns); - if (kn) + if (kn) { + kernfs_get(kn); __kernfs_remove(kn); + kernfs_put(kn); + } up_write(&root->kernfs_rwsem); diff -u linux-kvm-5.19.0/fs/nfs/nfs42proc.c linux-kvm-5.19.0/fs/nfs/nfs42proc.c --- linux-kvm-5.19.0/fs/nfs/nfs42proc.c +++ linux-kvm-5.19.0/fs/nfs/nfs42proc.c @@ -1093,6 +1093,9 @@ &args.seq_args, &res.seq_res, 0); trace_nfs4_clone(src_inode, dst_inode, &args, status); if (status == 0) { + /* a zero-length count means clone to EOF in src */ + if (count == 0 && res.dst_fattr->valid & NFS_ATTR_FATTR_SIZE) + count = nfs_size_to_loff_t(res.dst_fattr->size) - dst_offset; nfs42_copy_dest_done(dst_inode, dst_offset, count); status = nfs_post_op_update_inode(dst_inode, res.dst_fattr); } diff -u linux-kvm-5.19.0/fs/proc/task_mmu.c linux-kvm-5.19.0/fs/proc/task_mmu.c --- linux-kvm-5.19.0/fs/proc/task_mmu.c +++ linux-kvm-5.19.0/fs/proc/task_mmu.c @@ -969,7 +969,7 @@ vma = vma->vm_next; } - show_vma_header_prefix(m, priv->mm->mmap->vm_start, + show_vma_header_prefix(m, priv->mm->mmap ? priv->mm->mmap->vm_start : 0, last_vma_end, 0, 0, 0, 0); seq_pad(m, ' '); seq_puts(m, "[rollup]\n"); diff -u linux-kvm-5.19.0/include/linux/blk-mq.h linux-kvm-5.19.0/include/linux/blk-mq.h --- linux-kvm-5.19.0/include/linux/blk-mq.h +++ linux-kvm-5.19.0/include/linux/blk-mq.h @@ -265,9 +265,16 @@ rq_list_add(dst, rq); } +/** + * enum blk_eh_timer_return - How the timeout handler should proceed + * @BLK_EH_DONE: The block driver completed the command or will complete it at + * a later time. + * @BLK_EH_RESET_TIMER: Reset the request timer and continue waiting for the + * request to complete. + */ enum blk_eh_timer_return { - BLK_EH_DONE, /* drivers has completed the command */ - BLK_EH_RESET_TIMER, /* reset timer and try again */ + BLK_EH_DONE, + BLK_EH_RESET_TIMER, }; #define BLK_TAG_ALLOC_FIFO 0 /* allocate starting from 0 */ diff -u linux-kvm-5.19.0/include/linux/efi.h linux-kvm-5.19.0/include/linux/efi.h --- linux-kvm-5.19.0/include/linux/efi.h +++ linux-kvm-5.19.0/include/linux/efi.h @@ -1247,7 +1247,7 @@ arch_efi_call_virt_teardown(); \ }) -#define EFI_RANDOM_SEED_SIZE 64U +#define EFI_RANDOM_SEED_SIZE 32U // BLAKE2S_HASH_SIZE struct linux_efi_random_seed { u32 size; diff -u linux-kvm-5.19.0/include/linux/fs.h linux-kvm-5.19.0/include/linux/fs.h --- linux-kvm-5.19.0/include/linux/fs.h +++ linux-kvm-5.19.0/include/linux/fs.h @@ -1455,7 +1455,7 @@ const struct xattr_handler **s_xattr; #ifdef CONFIG_FS_ENCRYPTION const struct fscrypt_operations *s_cop; - struct key *s_master_keys; /* master crypto keys in use */ + struct fscrypt_keyring *s_master_keys; /* master crypto keys in use */ #endif #ifdef CONFIG_FS_VERITY const struct fsverity_operations *s_vop; diff -u linux-kvm-5.19.0/include/linux/mlx5/driver.h linux-kvm-5.19.0/include/linux/mlx5/driver.h --- linux-kvm-5.19.0/include/linux/mlx5/driver.h +++ linux-kvm-5.19.0/include/linux/mlx5/driver.h @@ -968,7 +968,7 @@ struct mlx5_async_ctx { struct mlx5_core_dev *dev; atomic_t num_inflight; - struct wait_queue_head wait; + struct completion inflight_done; }; struct mlx5_async_work; diff -u linux-kvm-5.19.0/include/linux/perf_event.h linux-kvm-5.19.0/include/linux/perf_event.h --- linux-kvm-5.19.0/include/linux/perf_event.h +++ linux-kvm-5.19.0/include/linux/perf_event.h @@ -736,11 +736,14 @@ struct fasync_struct *fasync; /* delayed work for NMIs and such */ - int pending_wakeup; - int pending_kill; - int pending_disable; + unsigned int pending_wakeup; + unsigned int pending_kill; + unsigned int pending_disable; + unsigned int pending_sigtrap; unsigned long pending_addr; /* SIGTRAP */ - struct irq_work pending; + struct irq_work pending_irq; + struct callback_head pending_task; + unsigned int pending_work; atomic_t event_limit; @@ -855,6 +858,14 @@ #endif void *task_ctx_data; /* pmu specific data */ struct rcu_head rcu_head; + + /* + * Sum (event->pending_sigtrap + event->pending_work) + * + * The SIGTRAP is targeted at ctx->task, as such it won't do changing + * that until the signal is delivered. + */ + local_t nr_pending; }; /* diff -u linux-kvm-5.19.0/include/linux/userfaultfd_k.h linux-kvm-5.19.0/include/linux/userfaultfd_k.h --- linux-kvm-5.19.0/include/linux/userfaultfd_k.h +++ linux-kvm-5.19.0/include/linux/userfaultfd_k.h @@ -146,9 +146,9 @@ static inline bool vma_can_userfault(struct vm_area_struct *vma, unsigned long vm_flags) { - if (vm_flags & VM_UFFD_MINOR) - return is_vm_hugetlb_page(vma) || vma_is_shmem(vma); - + if ((vm_flags & VM_UFFD_MINOR) && + (!is_vm_hugetlb_page(vma) && !vma_is_shmem(vma))) + return false; #ifndef CONFIG_PTE_MARKER_UFFD_WP /* * If user requested uffd-wp but not enabled pte markers for diff -u linux-kvm-5.19.0/include/net/sock.h linux-kvm-5.19.0/include/net/sock.h --- linux-kvm-5.19.0/include/net/sock.h +++ linux-kvm-5.19.0/include/net/sock.h @@ -1868,6 +1868,13 @@ void sock_kzfree_s(struct sock *sk, void *mem, int size); void sk_send_sigurg(struct sock *sk); +static inline void sock_replace_proto(struct sock *sk, struct proto *proto) +{ + if (sk->sk_socket) + clear_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); + WRITE_ONCE(sk->sk_prot, proto); +} + struct sockcm_cookie { u64 transmit_time; u32 mark; @@ -2566,7 +2573,7 @@ static inline gfp_t gfp_memcg_charge(void) { - return in_softirq() ? GFP_NOWAIT : GFP_KERNEL; + return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; } static inline long sock_rcvtimeo(const struct sock *sk, bool noblock) diff -u linux-kvm-5.19.0/io_uring/io-wq.c linux-kvm-5.19.0/io_uring/io-wq.c --- linux-kvm-5.19.0/io_uring/io-wq.c +++ linux-kvm-5.19.0/io_uring/io-wq.c @@ -1177,10 +1177,10 @@ wqe = kzalloc_node(sizeof(struct io_wqe), GFP_KERNEL, alloc_node); if (!wqe) goto err; + wq->wqes[node] = wqe; if (!alloc_cpumask_var(&wqe->cpu_mask, GFP_KERNEL)) goto err; cpumask_copy(wqe->cpu_mask, cpumask_of_node(node)); - wq->wqes[node] = wqe; wqe->node = alloc_node; wqe->acct[IO_WQ_ACCT_BOUND].max_workers = bounded; wqe->acct[IO_WQ_ACCT_UNBOUND].max_workers = diff -u linux-kvm-5.19.0/kernel/bpf/btf.c linux-kvm-5.19.0/kernel/bpf/btf.c --- linux-kvm-5.19.0/kernel/bpf/btf.c +++ linux-kvm-5.19.0/kernel/bpf/btf.c @@ -4326,4 +4326,9 @@ } + if (btf_type_is_resolve_source_only(ret_type)) { + btf_verifier_log_type(env, t, "Invalid return type"); + return -EINVAL; + } + if (btf_type_needs_resolve(ret_type) && !env_type_is_resolved(env, ret_type_id)) { diff -u linux-kvm-5.19.0/kernel/events/core.c linux-kvm-5.19.0/kernel/events/core.c --- linux-kvm-5.19.0/kernel/events/core.c +++ linux-kvm-5.19.0/kernel/events/core.c @@ -54,6 +54,7 @@ #include #include #include +#include #include "internal.h" @@ -2270,11 +2271,26 @@ event->pmu->del(event, 0); event->oncpu = -1; - if (READ_ONCE(event->pending_disable) >= 0) { - WRITE_ONCE(event->pending_disable, -1); + if (event->pending_disable) { + event->pending_disable = 0; perf_cgroup_event_disable(event, ctx); state = PERF_EVENT_STATE_OFF; } + + if (event->pending_sigtrap) { + bool dec = true; + + event->pending_sigtrap = 0; + if (state != PERF_EVENT_STATE_OFF && + !event->pending_work) { + event->pending_work = 1; + dec = false; + task_work_add(current, &event->pending_task, TWA_RESUME); + } + if (dec) + local_dec(&event->ctx->nr_pending); + } + perf_event_set_state(event, state); if (!is_software_event(event)) @@ -2426,7 +2442,7 @@ * hold the top-level event's child_mutex, so any descendant that * goes to exit will block in perf_event_exit_event(). * - * When called from perf_pending_event it's OK because event->ctx + * When called from perf_pending_irq it's OK because event->ctx * is the current context on this CPU and preemption is disabled, * hence we can't get into perf_event_task_sched_out for this context. */ @@ -2465,9 +2481,8 @@ void perf_event_disable_inatomic(struct perf_event *event) { - WRITE_ONCE(event->pending_disable, smp_processor_id()); - /* can fail, see perf_pending_event_disable() */ - irq_work_queue(&event->pending); + event->pending_disable = 1; + irq_work_queue(&event->pending_irq); } #define MAX_INTERRUPTS (~0ULL) @@ -3422,11 +3437,23 @@ raw_spin_lock_nested(&next_ctx->lock, SINGLE_DEPTH_NESTING); if (context_equiv(ctx, next_ctx)) { + perf_pmu_disable(pmu); + + /* PMIs are disabled; ctx->nr_pending is stable. */ + if (local_read(&ctx->nr_pending) || + local_read(&next_ctx->nr_pending)) { + /* + * Must not swap out ctx when there's pending + * events that rely on the ctx->task relation. + */ + raw_spin_unlock(&next_ctx->lock); + rcu_read_unlock(); + goto inside_switch; + } + WRITE_ONCE(ctx->task, next); WRITE_ONCE(next_ctx->task, task); - perf_pmu_disable(pmu); - if (cpuctx->sched_cb_usage && pmu->sched_task) pmu->sched_task(ctx, false); @@ -3467,6 +3494,7 @@ raw_spin_lock(&ctx->lock); perf_pmu_disable(pmu); +inside_switch: if (cpuctx->sched_cb_usage && pmu->sched_task) pmu->sched_task(ctx, false); task_ctx_sched_out(cpuctx, ctx, EVENT_ALL); @@ -4933,7 +4961,7 @@ static void _free_event(struct perf_event *event) { - irq_work_sync(&event->pending); + irq_work_sync(&event->pending_irq); unaccount_event(event); @@ -6427,7 +6455,8 @@ return; /* - * perf_pending_event() can race with the task exiting. + * Both perf_pending_task() and perf_pending_irq() can race with the + * task exiting. */ if (current->flags & PF_EXITING) return; @@ -6436,23 +6465,33 @@ event->attr.type, event->attr.sig_data); } -static void perf_pending_event_disable(struct perf_event *event) +/* + * Deliver the pending work in-event-context or follow the context. + */ +static void __perf_pending_irq(struct perf_event *event) { - int cpu = READ_ONCE(event->pending_disable); + int cpu = READ_ONCE(event->oncpu); + /* + * If the event isn't running; we done. event_sched_out() will have + * taken care of things. + */ if (cpu < 0) return; + /* + * Yay, we hit home and are in the context of the event. + */ if (cpu == smp_processor_id()) { - WRITE_ONCE(event->pending_disable, -1); - - if (event->attr.sigtrap) { + if (event->pending_sigtrap) { + event->pending_sigtrap = 0; perf_sigtrap(event); - atomic_set_release(&event->event_limit, 1); /* rearm event */ - return; + local_dec(&event->ctx->nr_pending); + } + if (event->pending_disable) { + event->pending_disable = 0; + perf_event_disable_local(event); } - - perf_event_disable_local(event); return; } @@ -6472,35 +6511,62 @@ * irq_work_queue(); // FAILS * * irq_work_run() - * perf_pending_event() + * perf_pending_irq() * * But the event runs on CPU-B and wants disabling there. */ - irq_work_queue_on(&event->pending, cpu); + irq_work_queue_on(&event->pending_irq, cpu); } -static void perf_pending_event(struct irq_work *entry) +static void perf_pending_irq(struct irq_work *entry) { - struct perf_event *event = container_of(entry, struct perf_event, pending); + struct perf_event *event = container_of(entry, struct perf_event, pending_irq); int rctx; - rctx = perf_swevent_get_recursion_context(); /* * If we 'fail' here, that's OK, it means recursion is already disabled * and we won't recurse 'further'. */ + rctx = perf_swevent_get_recursion_context(); - perf_pending_event_disable(event); - + /* + * The wakeup isn't bound to the context of the event -- it can happen + * irrespective of where the event is. + */ if (event->pending_wakeup) { event->pending_wakeup = 0; perf_event_wakeup(event); } + __perf_pending_irq(event); + if (rctx >= 0) perf_swevent_put_recursion_context(rctx); } +static void perf_pending_task(struct callback_head *head) +{ + struct perf_event *event = container_of(head, struct perf_event, pending_task); + int rctx; + + /* + * If we 'fail' here, that's OK, it means recursion is already disabled + * and we won't recurse 'further'. + */ + preempt_disable_notrace(); + rctx = perf_swevent_get_recursion_context(); + + if (event->pending_work) { + event->pending_work = 0; + perf_sigtrap(event); + local_dec(&event->ctx->nr_pending); + } + + if (rctx >= 0) + perf_swevent_put_recursion_context(rctx); + preempt_enable_notrace(); +} + #ifdef CONFIG_GUEST_PERF_EVENTS struct perf_guest_info_callbacks __rcu *perf_guest_cbs; @@ -9169,8 +9235,8 @@ */ static int __perf_event_overflow(struct perf_event *event, - int throttle, struct perf_sample_data *data, - struct pt_regs *regs) + int throttle, struct perf_sample_data *data, + struct pt_regs *regs) { int events = atomic_read(&event->event_limit); int ret = 0; @@ -9193,24 +9259,36 @@ if (events && atomic_dec_and_test(&event->event_limit)) { ret = 1; event->pending_kill = POLL_HUP; - event->pending_addr = data->addr; - perf_event_disable_inatomic(event); } + if (event->attr.sigtrap) { + /* + * Should not be able to return to user space without processing + * pending_sigtrap (kernel events can overflow multiple times). + */ + WARN_ON_ONCE(event->pending_sigtrap && event->attr.exclude_kernel); + if (!event->pending_sigtrap) { + event->pending_sigtrap = 1; + local_inc(&event->ctx->nr_pending); + } + event->pending_addr = data->addr; + irq_work_queue(&event->pending_irq); + } + READ_ONCE(event->overflow_handler)(event, data, regs); if (*perf_event_fasync(event) && event->pending_kill) { event->pending_wakeup = 1; - irq_work_queue(&event->pending); + irq_work_queue(&event->pending_irq); } return ret; } int perf_event_overflow(struct perf_event *event, - struct perf_sample_data *data, - struct pt_regs *regs) + struct perf_sample_data *data, + struct pt_regs *regs) { return __perf_event_overflow(event, 1, data, regs); } @@ -11514,8 +11592,8 @@ init_waitqueue_head(&event->waitq); - event->pending_disable = -1; - init_irq_work(&event->pending, perf_pending_event); + init_irq_work(&event->pending_irq, perf_pending_irq); + init_task_work(&event->pending_task, perf_pending_task); mutex_init(&event->mmap_mutex); raw_spin_lock_init(&event->addr_filters.lock); @@ -11537,9 +11615,6 @@ if (parent_event) event->event_caps = parent_event->event_caps; - if (event->attr.sigtrap) - atomic_set(&event->event_limit, 1); - if (task) { event->attach_state = PERF_ATTACH_TASK; /* diff -u linux-kvm-5.19.0/kernel/kprobes.c linux-kvm-5.19.0/kernel/kprobes.c --- linux-kvm-5.19.0/kernel/kprobes.c +++ linux-kvm-5.19.0/kernel/kprobes.c @@ -2425,8 +2425,11 @@ if (!kprobes_all_disarmed && kprobe_disabled(p)) { p->flags &= ~KPROBE_FLAG_DISABLED; ret = arm_kprobe(p); - if (ret) + if (ret) { p->flags |= KPROBE_FLAG_DISABLED; + if (p != kp) + kp->flags |= KPROBE_FLAG_DISABLED; + } } out: mutex_unlock(&kprobe_mutex); diff -u linux-kvm-5.19.0/kernel/sched/sched.h linux-kvm-5.19.0/kernel/sched/sched.h --- linux-kvm-5.19.0/kernel/sched/sched.h +++ linux-kvm-5.19.0/kernel/sched/sched.h @@ -1146,6 +1146,14 @@ #endif } +DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); + +#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu))) +#define this_rq() this_cpu_ptr(&runqueues) +#define task_rq(p) cpu_rq(task_cpu(p)) +#define cpu_curr(cpu) (cpu_rq(cpu)->curr) +#define raw_rq() raw_cpu_ptr(&runqueues) + struct sched_group; #ifdef CONFIG_SCHED_CORE static inline struct cpumask *sched_group_span(struct sched_group *sg); @@ -1233,7 +1241,7 @@ return true; for_each_cpu_and(cpu, sched_group_span(group), p->cpus_ptr) { - if (sched_core_cookie_match(rq, p)) + if (sched_core_cookie_match(cpu_rq(cpu), p)) return true; } return false; @@ -1348,14 +1356,6 @@ static inline void update_idle_core(struct rq *rq) { } #endif -DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); - -#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu))) -#define this_rq() this_cpu_ptr(&runqueues) -#define task_rq(p) cpu_rq(task_cpu(p)) -#define cpu_curr(cpu) (cpu_rq(cpu)->curr) -#define raw_rq() raw_cpu_ptr(&runqueues) - #ifdef CONFIG_FAIR_GROUP_SCHED static inline struct task_struct *task_of(struct sched_entity *se) { diff -u linux-kvm-5.19.0/kernel/sysctl.c linux-kvm-5.19.0/kernel/sysctl.c --- linux-kvm-5.19.0/kernel/sysctl.c +++ linux-kvm-5.19.0/kernel/sysctl.c @@ -266,13 +266,14 @@ ppos); } -static size_t proc_skip_spaces(char **buf) +static void proc_skip_spaces(char **buf, size_t *size) { - size_t ret; - char *tmp = skip_spaces(*buf); - ret = tmp - *buf; - *buf = tmp; - return ret; + while (*size) { + if (!isspace(**buf)) + break; + (*size)--; + (*buf)++; + } } static void proc_skip_char(char **buf, size_t *size, const char v) @@ -341,13 +342,12 @@ unsigned long *val, bool *neg, const char *perm_tr, unsigned perm_tr_len, char *tr) { - int len; char *p, tmp[TMPBUFLEN]; + ssize_t len = *size; - if (!*size) + if (len <= 0) return -EINVAL; - len = *size; if (len > TMPBUFLEN - 1) len = TMPBUFLEN - 1; @@ -520,7 +520,7 @@ bool neg; if (write) { - left -= proc_skip_spaces(&p); + proc_skip_spaces(&p, &left); if (!left) break; @@ -547,7 +547,7 @@ if (!write && !first && left && !err) proc_put_char(&buffer, &left, '\n'); if (write && !err && left) - left -= proc_skip_spaces(&p); + proc_skip_spaces(&p, &left); if (write && first) return err ? : -EINVAL; *lenp -= left; @@ -589,7 +589,7 @@ if (left > PAGE_SIZE - 1) left = PAGE_SIZE - 1; - left -= proc_skip_spaces(&p); + proc_skip_spaces(&p, &left); if (!left) { err = -EINVAL; goto out_free; @@ -609,7 +609,7 @@ } if (!err && left) - left -= proc_skip_spaces(&p); + proc_skip_spaces(&p, &left); out_free: if (err) @@ -1074,7 +1074,7 @@ if (write) { bool neg; - left -= proc_skip_spaces(&p); + proc_skip_spaces(&p, &left); if (!left) break; @@ -1103,7 +1103,7 @@ if (!write && !first && left && !err) proc_put_char(&buffer, &left, '\n'); if (write && !err) - left -= proc_skip_spaces(&p); + proc_skip_spaces(&p, &left); if (write && first) return err ? : -EINVAL; *lenp -= left; diff -u linux-kvm-5.19.0/kernel/trace/ftrace.c linux-kvm-5.19.0/kernel/trace/ftrace.c --- linux-kvm-5.19.0/kernel/trace/ftrace.c +++ linux-kvm-5.19.0/kernel/trace/ftrace.c @@ -2996,18 +2996,8 @@ command |= FTRACE_UPDATE_TRACE_FUNC; } - if (!command || !ftrace_enabled) { - /* - * If these are dynamic or per_cpu ops, they still - * need their data freed. Since, function tracing is - * not currently active, we can just free them - * without synchronizing all CPUs. - */ - if (ops->flags & FTRACE_OPS_FL_DYNAMIC) - goto free_ops; - - return 0; - } + if (!command || !ftrace_enabled) + goto out; /* * If the ops uses a trampoline, then it needs to be @@ -3044,6 +3034,7 @@ removed_ops = NULL; ops->flags &= ~FTRACE_OPS_FL_REMOVING; +out: /* * Dynamic ops may be freed, we must make sure that all * callers are done before leaving this function. @@ -3071,7 +3062,6 @@ if (IS_ENABLED(CONFIG_PREEMPTION)) synchronize_rcu_tasks(); - free_ops: ftrace_trampoline_free(ops); } diff -u linux-kvm-5.19.0/kernel/trace/kprobe_event_gen_test.c linux-kvm-5.19.0/kernel/trace/kprobe_event_gen_test.c --- linux-kvm-5.19.0/kernel/trace/kprobe_event_gen_test.c +++ linux-kvm-5.19.0/kernel/trace/kprobe_event_gen_test.c @@ -100,20 +100,20 @@ KPROBE_GEN_TEST_FUNC, KPROBE_GEN_TEST_ARG0, KPROBE_GEN_TEST_ARG1); if (ret) - goto free; + goto out; /* Use kprobe_event_add_fields to add the rest of the fields */ ret = kprobe_event_add_fields(&cmd, KPROBE_GEN_TEST_ARG2, KPROBE_GEN_TEST_ARG3); if (ret) - goto free; + goto out; /* * This actually creates the event. */ ret = kprobe_event_gen_cmd_end(&cmd); if (ret) - goto free; + goto out; /* * Now get the gen_kprobe_test event file. We need to prevent @@ -136,13 +136,11 @@ goto delete; } out: + kfree(buf); return ret; delete: /* We got an error after creating the event, delete it */ ret = kprobe_event_delete("gen_kprobe_test"); - free: - kfree(buf); - goto out; } @@ -170,14 +168,14 @@ KPROBE_GEN_TEST_FUNC, "$retval"); if (ret) - goto free; + goto out; /* * This actually creates the event. */ ret = kretprobe_event_gen_cmd_end(&cmd); if (ret) - goto free; + goto out; /* * Now get the gen_kretprobe_test event file. We need to @@ -201,13 +199,11 @@ goto delete; } out: + kfree(buf); return ret; delete: /* We got an error after creating the event, delete it */ ret = kprobe_event_delete("gen_kretprobe_test"); - free: - kfree(buf); - goto out; } diff -u linux-kvm-5.19.0/kernel/trace/ring_buffer.c linux-kvm-5.19.0/kernel/trace/ring_buffer.c --- linux-kvm-5.19.0/kernel/trace/ring_buffer.c +++ linux-kvm-5.19.0/kernel/trace/ring_buffer.c @@ -937,6 +937,9 @@ struct ring_buffer_per_cpu *cpu_buffer; struct rb_irq_work *rbwork; + if (!buffer) + return; + if (cpu == RING_BUFFER_ALL_CPUS) { /* Wake up individual ones too. One level recursion */ @@ -945,7 +948,15 @@ rbwork = &buffer->irq_work; } else { + if (WARN_ON_ONCE(!buffer->buffers)) + return; + if (WARN_ON_ONCE(cpu >= nr_cpu_ids)) + return; + cpu_buffer = buffer->buffers[cpu]; + /* The CPU buffer may not have been initialized yet */ + if (!cpu_buffer) + return; rbwork = &cpu_buffer->irq_work; } diff -u linux-kvm-5.19.0/mm/huge_memory.c linux-kvm-5.19.0/mm/huge_memory.c --- linux-kvm-5.19.0/mm/huge_memory.c +++ linux-kvm-5.19.0/mm/huge_memory.c @@ -2401,7 +2401,16 @@ page_tail); page_tail->mapping = head->mapping; page_tail->index = head->index + tail; - page_tail->private = 0; + + /* + * page->private should not be set in tail pages with the exception + * of swap cache pages that store the swp_entry_t in tail pages. + * Fix up and warn once if private is unexpectedly set. + */ + if (!folio_test_swapcache(page_folio(head))) { + VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head); + page_tail->private = 0; + } /* Page flags must be visible before we make the page non-compound. */ smp_wmb(); diff -u linux-kvm-5.19.0/mm/hugetlb.c linux-kvm-5.19.0/mm/hugetlb.c --- linux-kvm-5.19.0/mm/hugetlb.c +++ linux-kvm-5.19.0/mm/hugetlb.c @@ -2924,11 +2924,11 @@ page = alloc_buddy_huge_page_with_mpol(h, vma, addr); if (!page) goto out_uncharge_cgroup; + spin_lock_irq(&hugetlb_lock); if (!avoid_reserve && vma_has_reserves(vma, gbl_chg)) { SetHPageRestoreReserve(page); h->resv_huge_pages--; } - spin_lock_irq(&hugetlb_lock); list_add(&page->lru, &h->hugepage_activelist); /* Fall through */ } diff -u linux-kvm-5.19.0/mm/madvise.c linux-kvm-5.19.0/mm/madvise.c --- linux-kvm-5.19.0/mm/madvise.c +++ linux-kvm-5.19.0/mm/madvise.c @@ -811,7 +811,14 @@ if (start & ~huge_page_mask(hstate_vma(vma))) return false; - *end = ALIGN(*end, huge_page_size(hstate_vma(vma))); + /* + * Madvise callers expect the length to be rounded up to PAGE_SIZE + * boundaries, and may be unaware that this VMA uses huge pages. + * Avoid unexpected data loss by rounding down the number of + * huge pages freed. + */ + *end = ALIGN_DOWN(*end, huge_page_size(hstate_vma(vma))); + return true; } @@ -826,6 +833,9 @@ if (!madvise_dontneed_free_valid_vma(vma, start, &end, behavior)) return -EINVAL; + if (start == end) + return 0; + if (!userfaultfd_remove(vma, start, end)) { *prev = NULL; /* mmap_lock has been dropped, prev is stale */ diff -u linux-kvm-5.19.0/mm/migrate.c linux-kvm-5.19.0/mm/migrate.c --- linux-kvm-5.19.0/mm/migrate.c +++ linux-kvm-5.19.0/mm/migrate.c @@ -1521,6 +1521,13 @@ */ list_splice(&ret_pages, from); + /* + * Return 0 in case all subpages of fail-to-migrate THPs are + * migrated successfully. + */ + if (list_empty(from)) + rc = 0; + count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded); count_vm_events(PGMIGRATE_FAIL, nr_failed_pages); count_vm_events(THP_MIGRATION_SUCCESS, nr_thp_succeeded); diff -u linux-kvm-5.19.0/net/bluetooth/l2cap_core.c linux-kvm-5.19.0/net/bluetooth/l2cap_core.c --- linux-kvm-5.19.0/net/bluetooth/l2cap_core.c +++ linux-kvm-5.19.0/net/bluetooth/l2cap_core.c @@ -1989,7 +1989,7 @@ if (link_type == LE_LINK && c->src_type == BDADDR_BREDR) continue; - if (c->psm == psm) { + if (c->chan_type != L2CAP_CHAN_FIXED && c->psm == psm) { int src_match, dst_match; int src_any, dst_any; @@ -3763,7 +3763,8 @@ l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC, sizeof(rfc), (unsigned long) &rfc, endptr - ptr); - if (test_bit(FLAG_EFS_ENABLE, &chan->flags)) { + if (remote_efs && + test_bit(FLAG_EFS_ENABLE, &chan->flags)) { chan->remote_id = efs.id; chan->remote_stype = efs.stype; chan->remote_msdu = le16_to_cpu(efs.msdu); @@ -4451,7 +4452,8 @@ chan->ident = cmd->ident; l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, len, rsp); - chan->num_conf_rsp++; + if (chan->num_conf_rsp < L2CAP_CONF_MAX_CONF_RSP) + chan->num_conf_rsp++; /* Reset config buffer. */ chan->conf_len = 0; @@ -5812,6 +5814,19 @@ BT_DBG("psm 0x%2.2x scid 0x%4.4x mtu %u mps %u", __le16_to_cpu(psm), scid, mtu, mps); + /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part A + * page 1059: + * + * Valid range: 0x0001-0x00ff + * + * Table 4.15: L2CAP_LE_CREDIT_BASED_CONNECTION_REQ SPSM ranges + */ + if (!psm || __le16_to_cpu(psm) > L2CAP_PSM_LE_DYN_END) { + result = L2CAP_CR_LE_BAD_PSM; + chan = NULL; + goto response; + } + /* Check if we have socket listening on psm */ pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src, &conn->hcon->dst, LE_LINK); @@ -6000,6 +6015,18 @@ psm = req->psm; + /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part A + * page 1059: + * + * Valid range: 0x0001-0x00ff + * + * Table 4.15: L2CAP_LE_CREDIT_BASED_CONNECTION_REQ SPSM ranges + */ + if (!psm || __le16_to_cpu(psm) > L2CAP_PSM_LE_DYN_END) { + result = L2CAP_CR_LE_BAD_PSM; + goto response; + } + BT_DBG("psm 0x%2.2x mtu %u mps %u", __le16_to_cpu(psm), mtu, mps); memset(&pdu, 0, sizeof(pdu)); @@ -7614,6 +7641,7 @@ return; } + l2cap_chan_hold(chan); l2cap_chan_lock(chan); } else { BT_DBG("unknown cid 0x%4.4x", cid); @@ -8459,9 +8487,8 @@ * expected length. */ if (skb->len < L2CAP_LEN_SIZE) { - if (l2cap_recv_frag(conn, skb, conn->mtu) < 0) - goto drop; - return; + l2cap_recv_frag(conn, skb, conn->mtu); + break; } len = get_unaligned_le16(skb->data) + L2CAP_HDR_SIZE; @@ -8505,7 +8532,7 @@ /* Header still could not be read just continue */ if (conn->rx_skb->len < L2CAP_LEN_SIZE) - return; + break; } if (skb->len > conn->rx_len) { diff -u linux-kvm-5.19.0/net/can/j1939/transport.c linux-kvm-5.19.0/net/can/j1939/transport.c --- linux-kvm-5.19.0/net/can/j1939/transport.c +++ linux-kvm-5.19.0/net/can/j1939/transport.c @@ -342,10 +342,12 @@ __skb_unlink(do_skb, &session->skb_queue); /* drop ref taken in j1939_session_skb_queue() */ skb_unref(do_skb); + spin_unlock_irqrestore(&session->skb_queue.lock, flags); kfree_skb(do_skb); + } else { + spin_unlock_irqrestore(&session->skb_queue.lock, flags); } - spin_unlock_irqrestore(&session->skb_queue.lock, flags); } void j1939_session_skb_queue(struct j1939_session *session, diff -u linux-kvm-5.19.0/net/core/dev.c linux-kvm-5.19.0/net/core/dev.c --- linux-kvm-5.19.0/net/core/dev.c +++ linux-kvm-5.19.0/net/core/dev.c @@ -5136,11 +5136,13 @@ case TC_ACT_SHOT: mini_qdisc_qstats_cpu_drop(miniq); kfree_skb_reason(skb, SKB_DROP_REASON_TC_INGRESS); + *ret = NET_RX_DROP; return NULL; case TC_ACT_STOLEN: case TC_ACT_QUEUED: case TC_ACT_TRAP: consume_skb(skb); + *ret = NET_RX_SUCCESS; return NULL; case TC_ACT_REDIRECT: /* skb_mac_header check was done by cls/act_bpf, so @@ -5153,8 +5155,10 @@ *another = true; break; } + *ret = NET_RX_SUCCESS; return NULL; case TC_ACT_CONSUMED: + *ret = NET_RX_SUCCESS; return NULL; default: break; diff -u linux-kvm-5.19.0/net/core/neighbour.c linux-kvm-5.19.0/net/core/neighbour.c --- linux-kvm-5.19.0/net/core/neighbour.c +++ linux-kvm-5.19.0/net/core/neighbour.c @@ -400,7 +400,7 @@ write_lock_bh(&tbl->lock); neigh_flush_dev(tbl, dev, skip_perm); pneigh_ifdown_and_unlock(tbl, dev); - pneigh_queue_purge(&tbl->proxy_queue, dev_net(dev)); + pneigh_queue_purge(&tbl->proxy_queue, dev ? dev_net(dev) : NULL); if (skb_queue_empty_lockless(&tbl->proxy_queue)) del_timer_sync(&tbl->proxy_timer); return 0; diff -u linux-kvm-5.19.0/net/core/skbuff.c linux-kvm-5.19.0/net/core/skbuff.c --- linux-kvm-5.19.0/net/core/skbuff.c +++ linux-kvm-5.19.0/net/core/skbuff.c @@ -3838,7 +3838,7 @@ skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], size); } else if (i < MAX_SKB_FRAGS) { get_page(page); - skb_fill_page_desc(skb, i, page, offset, size); + skb_fill_page_desc_noacc(skb, i, page, offset, size); } else { return -EMSGSIZE; } diff -u linux-kvm-5.19.0/net/ieee802154/socket.c linux-kvm-5.19.0/net/ieee802154/socket.c --- linux-kvm-5.19.0/net/ieee802154/socket.c +++ linux-kvm-5.19.0/net/ieee802154/socket.c @@ -502,8 +502,10 @@ if (err < 0) goto out; - if (addr->family != AF_IEEE802154) + if (addr->family != AF_IEEE802154) { + err = -EINVAL; goto out; + } ieee802154_addr_from_sa(&haddr, &addr->addr); dev = ieee802154_get_dev(sock_net(sk), &haddr); diff -u linux-kvm-5.19.0/net/ipv4/af_inet.c linux-kvm-5.19.0/net/ipv4/af_inet.c --- linux-kvm-5.19.0/net/ipv4/af_inet.c +++ linux-kvm-5.19.0/net/ipv4/af_inet.c @@ -754,6 +754,8 @@ (TCPF_ESTABLISHED | TCPF_SYN_RECV | TCPF_CLOSE_WAIT | TCPF_CLOSE))); + if (test_bit(SOCK_SUPPORT_ZC, &sock->flags)) + set_bit(SOCK_SUPPORT_ZC, &newsock->flags); sock_graft(sk2, newsock); newsock->state = SS_CONNECTED; diff -u linux-kvm-5.19.0/net/ipv4/datagram.c linux-kvm-5.19.0/net/ipv4/datagram.c --- linux-kvm-5.19.0/net/ipv4/datagram.c +++ linux-kvm-5.19.0/net/ipv4/datagram.c @@ -70,7 +70,7 @@ } inet->inet_daddr = fl4->daddr; inet->inet_dport = usin->sin_port; - reuseport_has_conns(sk, true); + reuseport_has_conns_set(sk); sk->sk_state = TCP_ESTABLISHED; sk_set_txhash(sk); inet->inet_id = prandom_u32(); diff -u linux-kvm-5.19.0/net/ipv4/netfilter/nft_fib_ipv4.c linux-kvm-5.19.0/net/ipv4/netfilter/nft_fib_ipv4.c --- linux-kvm-5.19.0/net/ipv4/netfilter/nft_fib_ipv4.c +++ linux-kvm-5.19.0/net/ipv4/netfilter/nft_fib_ipv4.c @@ -65,6 +65,7 @@ struct flowi4 fl4 = { .flowi4_scope = RT_SCOPE_UNIVERSE, .flowi4_iif = LOOPBACK_IFINDEX, + .flowi4_uid = sock_net_uid(nft_net(pkt), NULL), }; const struct net_device *oif; const struct net_device *found; @@ -84,7 +85,7 @@ oif = NULL; if (priv->flags & NFTA_FIB_F_IIF) - fl4.flowi4_oif = l3mdev_master_ifindex_rcu(oif); + fl4.flowi4_l3mdev = l3mdev_master_ifindex_rcu(oif); if (nft_hook(pkt) == NF_INET_PRE_ROUTING && nft_fib_is_loopback(pkt->skb, nft_in(pkt))) { diff -u linux-kvm-5.19.0/net/ipv4/tcp.c linux-kvm-5.19.0/net/ipv4/tcp.c --- linux-kvm-5.19.0/net/ipv4/tcp.c +++ linux-kvm-5.19.0/net/ipv4/tcp.c @@ -455,6 +455,7 @@ WRITE_ONCE(sk->sk_sndbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[1])); WRITE_ONCE(sk->sk_rcvbuf, READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_rmem[1])); + set_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); sk_sockets_allocated_inc(sk); } EXPORT_SYMBOL(tcp_init_sock); diff -u linux-kvm-5.19.0/net/ipv4/tcp_input.c linux-kvm-5.19.0/net/ipv4/tcp_input.c --- linux-kvm-5.19.0/net/ipv4/tcp_input.c +++ linux-kvm-5.19.0/net/ipv4/tcp_input.c @@ -2193,7 +2193,8 @@ */ static bool tcp_check_sack_reneging(struct sock *sk, int flag) { - if (flag & FLAG_SACK_RENEGING) { + if (flag & FLAG_SACK_RENEGING && + flag & FLAG_SND_UNA_ADVANCED) { struct tcp_sock *tp = tcp_sk(sk); unsigned long delay = max(usecs_to_jiffies(tp->srtt_us >> 4), msecs_to_jiffies(10)); diff -u linux-kvm-5.19.0/net/ipv4/tcp_ipv4.c linux-kvm-5.19.0/net/ipv4/tcp_ipv4.c --- linux-kvm-5.19.0/net/ipv4/tcp_ipv4.c +++ linux-kvm-5.19.0/net/ipv4/tcp_ipv4.c @@ -1853,11 +1853,13 @@ __skb_push(skb, hdrlen); no_coalesce: + limit = (u32)READ_ONCE(sk->sk_rcvbuf) + (u32)(READ_ONCE(sk->sk_sndbuf) >> 1); + /* Only socket owner can try to collapse/prune rx queues * to reduce memory overhead, so add a little headroom here. * Few sockets backlog are possibly concurrently non empty. */ - limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf) + 64*1024; + limit += 64 * 1024; if (unlikely(sk_add_backlog(sk, skb, limit))) { bh_unlock_sock(sk); diff -u linux-kvm-5.19.0/net/ipv4/udp.c linux-kvm-5.19.0/net/ipv4/udp.c --- linux-kvm-5.19.0/net/ipv4/udp.c +++ linux-kvm-5.19.0/net/ipv4/udp.c @@ -446,7 +446,7 @@ result = lookup_reuseport(net, sk, skb, saddr, sport, daddr, hnum); /* Fall back to scoring if group has connections */ - if (result && !reuseport_has_conns(sk, false)) + if (result && !reuseport_has_conns(sk)) return result; result = result ? : sk; @@ -1618,6 +1618,7 @@ { skb_queue_head_init(&udp_sk(sk)->reader_queue); sk->sk_destruct = udp_destruct_sock; + set_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); return 0; } EXPORT_SYMBOL_GPL(udp_init_sock); diff -u linux-kvm-5.19.0/net/ipv6/addrconf.c linux-kvm-5.19.0/net/ipv6/addrconf.c --- linux-kvm-5.19.0/net/ipv6/addrconf.c +++ linux-kvm-5.19.0/net/ipv6/addrconf.c @@ -7210,9 +7210,11 @@ __addrconf_sysctl_unregister(net, all, NETCONFA_IFINDEX_ALL); err_reg_all: kfree(dflt); + net->ipv6.devconf_dflt = NULL; #endif err_alloc_dflt: kfree(all); + net->ipv6.devconf_all = NULL; err_alloc_all: kfree(net->ipv6.inet6_addr_lst); err_alloc_addr: diff -u linux-kvm-5.19.0/net/ipv6/netfilter/nft_fib_ipv6.c linux-kvm-5.19.0/net/ipv6/netfilter/nft_fib_ipv6.c --- linux-kvm-5.19.0/net/ipv6/netfilter/nft_fib_ipv6.c +++ linux-kvm-5.19.0/net/ipv6/netfilter/nft_fib_ipv6.c @@ -41,9 +41,8 @@ if (ipv6_addr_type(&fl6->daddr) & IPV6_ADDR_LINKLOCAL) { lookup_flags |= RT6_LOOKUP_F_IFACE; fl6->flowi6_oif = get_ifindex(dev ? dev : pkt->skb->dev); - } else if ((priv->flags & NFTA_FIB_F_IIF) && - (netif_is_l3_master(dev) || netif_is_l3_slave(dev))) { - fl6->flowi6_oif = dev->ifindex; + } else if (priv->flags & NFTA_FIB_F_IIF) { + fl6->flowi6_l3mdev = l3mdev_master_ifindex_rcu(dev); } if (ipv6_addr_type(&fl6->saddr) & IPV6_ADDR_UNICAST) @@ -67,6 +66,7 @@ struct flowi6 fl6 = { .flowi6_iif = LOOPBACK_IFINDEX, .flowi6_proto = pkt->tprot, + .flowi6_uid = sock_net_uid(nft_net(pkt), NULL), }; u32 ret = 0; @@ -164,6 +164,7 @@ struct flowi6 fl6 = { .flowi6_iif = LOOPBACK_IFINDEX, .flowi6_proto = pkt->tprot, + .flowi6_uid = sock_net_uid(nft_net(pkt), NULL), }; struct rt6_info *rt; int lookup_flags; diff -u linux-kvm-5.19.0/net/ipv6/udp.c linux-kvm-5.19.0/net/ipv6/udp.c --- linux-kvm-5.19.0/net/ipv6/udp.c +++ linux-kvm-5.19.0/net/ipv6/udp.c @@ -182,7 +182,7 @@ result = lookup_reuseport(net, sk, skb, saddr, sport, daddr, hnum); /* Fall back to scoring if group has connections */ - if (result && !reuseport_has_conns(sk, false)) + if (result && !reuseport_has_conns(sk)) return result; result = result ? : sk; diff -u linux-kvm-5.19.0/net/kcm/kcmsock.c linux-kvm-5.19.0/net/kcm/kcmsock.c --- linux-kvm-5.19.0/net/kcm/kcmsock.c +++ linux-kvm-5.19.0/net/kcm/kcmsock.c @@ -162,7 +162,8 @@ /* Buffer limit is okay now, add to ready list */ list_add_tail(&kcm->wait_rx_list, &kcm->mux->kcm_rx_waiters); - kcm->rx_wait = true; + /* paired with lockless reads in kcm_rfree() */ + WRITE_ONCE(kcm->rx_wait, true); } static void kcm_rfree(struct sk_buff *skb) @@ -178,7 +179,7 @@ /* For reading rx_wait and rx_psock without holding lock */ smp_mb__after_atomic(); - if (!kcm->rx_wait && !kcm->rx_psock && + if (!READ_ONCE(kcm->rx_wait) && !READ_ONCE(kcm->rx_psock) && sk_rmem_alloc_get(sk) < sk->sk_rcvlowat) { spin_lock_bh(&mux->rx_lock); kcm_rcv_ready(kcm); @@ -237,7 +238,8 @@ if (kcm_queue_rcv_skb(&kcm->sk, skb)) { /* Should mean socket buffer full */ list_del(&kcm->wait_rx_list); - kcm->rx_wait = false; + /* paired with lockless reads in kcm_rfree() */ + WRITE_ONCE(kcm->rx_wait, false); /* Commit rx_wait to read in kcm_free */ smp_wmb(); @@ -280,10 +282,12 @@ kcm = list_first_entry(&mux->kcm_rx_waiters, struct kcm_sock, wait_rx_list); list_del(&kcm->wait_rx_list); - kcm->rx_wait = false; + /* paired with lockless reads in kcm_rfree() */ + WRITE_ONCE(kcm->rx_wait, false); psock->rx_kcm = kcm; - kcm->rx_psock = psock; + /* paired with lockless reads in kcm_rfree() */ + WRITE_ONCE(kcm->rx_psock, psock); spin_unlock_bh(&mux->rx_lock); @@ -310,7 +314,8 @@ spin_lock_bh(&mux->rx_lock); psock->rx_kcm = NULL; - kcm->rx_psock = NULL; + /* paired with lockless reads in kcm_rfree() */ + WRITE_ONCE(kcm->rx_psock, NULL); /* Commit kcm->rx_psock before sk_rmem_alloc_get to sync with * kcm_rfree @@ -834,7 +839,7 @@ } get_page(page); - skb_fill_page_desc(skb, i, page, offset, size); + skb_fill_page_desc_noacc(skb, i, page, offset, size); skb_shinfo(skb)->flags |= SKBFL_SHARED_FRAG; coalesced: @@ -1240,7 +1245,8 @@ if (!kcm->rx_psock) { if (kcm->rx_wait) { list_del(&kcm->wait_rx_list); - kcm->rx_wait = false; + /* paired with lockless reads in kcm_rfree() */ + WRITE_ONCE(kcm->rx_wait, false); } requeue_rx_msgs(mux, &kcm->sk.sk_receive_queue); @@ -1793,7 +1799,8 @@ if (kcm->rx_wait) { list_del(&kcm->wait_rx_list); - kcm->rx_wait = false; + /* paired with lockless reads in kcm_rfree() */ + WRITE_ONCE(kcm->rx_wait, false); } /* Move any pending receive messages to other kcm sockets */ requeue_rx_msgs(mux, &sk->sk_receive_queue); diff -u linux-kvm-5.19.0/net/mac802154/rx.c linux-kvm-5.19.0/net/mac802154/rx.c --- linux-kvm-5.19.0/net/mac802154/rx.c +++ linux-kvm-5.19.0/net/mac802154/rx.c @@ -132,7 +132,7 @@ ieee802154_parse_frame_start(struct sk_buff *skb, struct ieee802154_hdr *hdr) { int hlen; - struct ieee802154_mac_cb *cb = mac_cb_init(skb); + struct ieee802154_mac_cb *cb = mac_cb(skb); skb_reset_mac_header(skb); @@ -294,8 +294,9 @@ ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) { struct ieee802154_local *local = hw_to_local(hw); + struct ieee802154_mac_cb *cb = mac_cb_init(skb); - mac_cb(skb)->lqi = lqi; + cb->lqi = lqi; skb->pkt_type = IEEE802154_RX_MSG; skb_queue_tail(&local->skb_queue, skb); tasklet_schedule(&local->tasklet); diff -u linux-kvm-5.19.0/net/mptcp/protocol.c linux-kvm-5.19.0/net/mptcp/protocol.c --- linux-kvm-5.19.0/net/mptcp/protocol.c +++ linux-kvm-5.19.0/net/mptcp/protocol.c @@ -2897,7 +2897,7 @@ sock_put(sk); } -static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk) +void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk) { #if IS_ENABLED(CONFIG_MPTCP_IPV6) const struct ipv6_pinfo *ssk6 = inet6_sk(ssk); @@ -3640,7 +3640,6 @@ if (mptcp_is_fully_established(newsk)) mptcp_pm_fully_established(msk, msk->first, GFP_KERNEL); - mptcp_copy_inaddrs(newsk, msk->first); mptcp_rcv_space_init(msk, msk->first); mptcp_propagate_sndbuf(newsk, msk->first); diff -u linux-kvm-5.19.0/net/mptcp/protocol.h linux-kvm-5.19.0/net/mptcp/protocol.h --- linux-kvm-5.19.0/net/mptcp/protocol.h +++ linux-kvm-5.19.0/net/mptcp/protocol.h @@ -597,6 +597,7 @@ int mptcp_allow_join_id0(const struct net *net); unsigned int mptcp_stale_loss_cnt(const struct net *net); int mptcp_get_pm_type(const struct net *net); +void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk); void mptcp_subflow_fully_established(struct mptcp_subflow_context *subflow, struct mptcp_options_received *mp_opt); bool __mptcp_retransmit_pending_data(struct sock *sk); diff -u linux-kvm-5.19.0/net/mptcp/subflow.c linux-kvm-5.19.0/net/mptcp/subflow.c --- linux-kvm-5.19.0/net/mptcp/subflow.c +++ linux-kvm-5.19.0/net/mptcp/subflow.c @@ -723,6 +723,8 @@ goto dispose_child; } + if (new_msk) + mptcp_copy_inaddrs(new_msk, child); subflow_drop_ctx(child); goto out; } @@ -750,6 +752,11 @@ ctx->conn = new_msk; new_msk = NULL; + /* set msk addresses early to ensure mptcp_pm_get_local_id() + * uses the correct data + */ + mptcp_copy_inaddrs(ctx->conn, child); + /* with OoO packets we can reach here without ingress * mpc option */ diff -u linux-kvm-5.19.0/net/netfilter/nf_tables_api.c linux-kvm-5.19.0/net/netfilter/nf_tables_api.c --- linux-kvm-5.19.0/net/netfilter/nf_tables_api.c +++ linux-kvm-5.19.0/net/netfilter/nf_tables_api.c @@ -5819,8 +5819,9 @@ (NFT_SET_CONCAT | NFT_SET_INTERVAL)) { if (flags & NFT_SET_ELEM_INTERVAL_END) return false; - if (!nla[NFTA_SET_ELEM_KEY_END] && - !(flags & NFT_SET_ELEM_CATCHALL)) + + if (nla[NFTA_SET_ELEM_KEY_END] && + flags & NFT_SET_ELEM_CATCHALL) return false; } else { if (nla[NFTA_SET_ELEM_KEY_END]) @@ -8410,9 +8411,6 @@ nf_tables_chain_destroy(&trans->ctx); break; case NFT_MSG_DELRULE: - if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD) - nft_flow_rule_destroy(nft_trans_flow_rule(trans)); - nf_tables_rule_destroy(&trans->ctx, nft_trans_rule(trans)); break; case NFT_MSG_DELSET: @@ -8918,6 +8916,9 @@ nft_rule_expr_deactivate(&trans->ctx, nft_trans_rule(trans), NFT_TRANS_COMMIT); + + if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD) + nft_flow_rule_destroy(nft_trans_flow_rule(trans)); break; case NFT_MSG_NEWSET: nft_clear(net, nft_trans_set(trans)); @@ -9975,6 +9976,8 @@ nft_net = nft_pernet(net); deleted = 0; mutex_lock(&nft_net->commit_mutex); + if (!list_empty(&nf_tables_destroy_list)) + rcu_barrier(); again: list_for_each_entry(table, &nft_net->tables, list) { if (nft_table_has_owner(table) && diff -u linux-kvm-5.19.0/net/openvswitch/datapath.c linux-kvm-5.19.0/net/openvswitch/datapath.c --- linux-kvm-5.19.0/net/openvswitch/datapath.c +++ linux-kvm-5.19.0/net/openvswitch/datapath.c @@ -1606,7 +1606,8 @@ if (IS_ERR(dp)) return; - WARN(dp->user_features, "Dropping previously announced user features\n"); + pr_warn("%s: Dropping previously announced user features\n", + ovs_dp_name(dp)); dp->user_features = 0; } diff -u linux-kvm-5.19.0/net/sched/sch_sfb.c linux-kvm-5.19.0/net/sched/sch_sfb.c --- linux-kvm-5.19.0/net/sched/sch_sfb.c +++ linux-kvm-5.19.0/net/sched/sch_sfb.c @@ -455,9 +455,8 @@ { struct sfb_sched_data *q = qdisc_priv(sch); - qdisc_reset(q->qdisc); - sch->qstats.backlog = 0; - sch->q.qlen = 0; + if (likely(q->qdisc)) + qdisc_reset(q->qdisc); q->slot = 0; q->double_buffering = false; sfb_zero_all_buckets(q); diff -u linux-kvm-5.19.0/net/sched/sch_taprio.c linux-kvm-5.19.0/net/sched/sch_taprio.c --- linux-kvm-5.19.0/net/sched/sch_taprio.c +++ linux-kvm-5.19.0/net/sched/sch_taprio.c @@ -1638,8 +1638,6 @@ if (q->qdiscs[i]) qdisc_reset(q->qdiscs[i]); } - sch->qstats.backlog = 0; - sch->q.qlen = 0; } static void taprio_destroy(struct Qdisc *sch) diff -u linux-kvm-5.19.0/net/sched/sch_tbf.c linux-kvm-5.19.0/net/sched/sch_tbf.c --- linux-kvm-5.19.0/net/sched/sch_tbf.c +++ linux-kvm-5.19.0/net/sched/sch_tbf.c @@ -330,8 +330,6 @@ struct tbf_sched_data *q = qdisc_priv(sch); qdisc_reset(q->qdisc); - sch->qstats.backlog = 0; - sch->q.qlen = 0; q->t_c = ktime_get_ns(); q->tokens = q->buffer; q->ptokens = q->mtu; diff -u linux-kvm-5.19.0/net/smc/af_smc.c linux-kvm-5.19.0/net/smc/af_smc.c --- linux-kvm-5.19.0/net/smc/af_smc.c +++ linux-kvm-5.19.0/net/smc/af_smc.c @@ -3332,14 +3332,14 @@ rc = register_pernet_subsys(&smc_net_stat_ops); if (rc) - return rc; + goto out_pernet_subsys; smc_ism_init(); smc_clc_init(); rc = smc_nl_init(); if (rc) - goto out_pernet_subsys; + goto out_pernet_subsys_stat; rc = smc_pnet_init(); if (rc) @@ -3432,6 +3432,8 @@ smc_pnet_exit(); out_nl: smc_nl_exit(); +out_pernet_subsys_stat: + unregister_pernet_subsys(&smc_net_stat_ops); out_pernet_subsys: unregister_pernet_subsys(&smc_net_ops); diff -u linux-kvm-5.19.0/net/smc/smc_core.c linux-kvm-5.19.0/net/smc/smc_core.c --- linux-kvm-5.19.0/net/smc/smc_core.c +++ linux-kvm-5.19.0/net/smc/smc_core.c @@ -894,7 +894,8 @@ } memcpy(lgr->pnet_id, ibdev->pnetid[ibport - 1], SMC_MAX_PNETID_LEN); - if (smc_wr_alloc_lgr_mem(lgr)) + rc = smc_wr_alloc_lgr_mem(lgr); + if (rc) goto free_wq; smc_llc_lgr_init(lgr, smc); diff -u linux-kvm-5.19.0/net/sunrpc/sysfs.c linux-kvm-5.19.0/net/sunrpc/sysfs.c --- linux-kvm-5.19.0/net/sunrpc/sysfs.c +++ linux-kvm-5.19.0/net/sunrpc/sysfs.c @@ -536,13 +536,16 @@ struct net *net) { struct rpc_sysfs_client *rpc_client; + struct rpc_sysfs_xprt_switch *xswitch = + (struct rpc_sysfs_xprt_switch *)xprt_switch->xps_sysfs; + + if (!xswitch) + return; rpc_client = rpc_sysfs_client_alloc(rpc_sunrpc_client_kobj, net, clnt->cl_clid); if (rpc_client) { char name[] = "switch"; - struct rpc_sysfs_xprt_switch *xswitch = - (struct rpc_sysfs_xprt_switch *)xprt_switch->xps_sysfs; int ret; clnt->cl_sysfs = rpc_client; @@ -576,6 +579,8 @@ rpc_xprt_switch->xprt_switch = xprt_switch; rpc_xprt_switch->xprt = xprt; kobject_uevent(&rpc_xprt_switch->kobject, KOBJ_ADD); + } else { + xprt_switch->xps_sysfs = NULL; } } @@ -587,6 +592,9 @@ struct rpc_sysfs_xprt_switch *switch_obj = (struct rpc_sysfs_xprt_switch *)xprt_switch->xps_sysfs; + if (!switch_obj) + return; + rpc_xprt = rpc_sysfs_xprt_alloc(&switch_obj->kobject, xprt, gfp_flags); if (rpc_xprt) { xprt->xprt_sysfs = rpc_xprt; diff -u linux-kvm-5.19.0/net/vmw_vsock/af_vsock.c linux-kvm-5.19.0/net/vmw_vsock/af_vsock.c --- linux-kvm-5.19.0/net/vmw_vsock/af_vsock.c +++ linux-kvm-5.19.0/net/vmw_vsock/af_vsock.c @@ -1894,8 +1894,11 @@ err = 0; transport = vsk->transport; - while ((data = vsock_connectible_has_data(vsk)) == 0) { + while (1) { prepare_to_wait(sk_sleep(sk), wait, TASK_INTERRUPTIBLE); + data = vsock_connectible_has_data(vsk); + if (data != 0) + break; if (sk->sk_err != 0 || (sk->sk_shutdown & RCV_SHUTDOWN) || diff -u linux-kvm-5.19.0/security/commoncap.c linux-kvm-5.19.0/security/commoncap.c --- linux-kvm-5.19.0/security/commoncap.c +++ linux-kvm-5.19.0/security/commoncap.c @@ -401,8 +401,10 @@ &tmpbuf, size, GFP_NOFS); dput(dentry); - if (ret < 0 || !tmpbuf) - return ret; + if (ret < 0 || !tmpbuf) { + size = ret; + goto out_free; + } fs_ns = inode->i_sb->s_user_ns; cap = (struct vfs_cap_data *) tmpbuf; diff -u linux-kvm-5.19.0/security/selinux/ss/services.c linux-kvm-5.19.0/security/selinux/ss/services.c --- linux-kvm-5.19.0/security/selinux/ss/services.c +++ linux-kvm-5.19.0/security/selinux/ss/services.c @@ -2022,7 +2022,8 @@ * in `newc'. Verify that the context is valid * under the new policy. */ -static int convert_context(struct context *oldc, struct context *newc, void *p) +static int convert_context(struct context *oldc, struct context *newc, void *p, + gfp_t gfp_flags) { struct convert_context_args *args; struct ocontext *oc; @@ -2036,7 +2037,7 @@ args = p; if (oldc->str) { - s = kstrdup(oldc->str, GFP_KERNEL); + s = kstrdup(oldc->str, gfp_flags); if (!s) return -ENOMEM; diff -u linux-kvm-5.19.0/sound/pci/hda/patch_hdmi.c linux-kvm-5.19.0/sound/pci/hda/patch_hdmi.c --- linux-kvm-5.19.0/sound/pci/hda/patch_hdmi.c +++ linux-kvm-5.19.0/sound/pci/hda/patch_hdmi.c @@ -53,7 +53,8 @@ struct hdmi_spec_per_cvt { hda_nid_t cvt_nid; - int assigned; + bool assigned; /* the stream has been assigned */ + bool silent_stream; /* silent stream activated */ unsigned int channels_min; unsigned int channels_max; u32 rates; @@ -988,7 +989,8 @@ * of the pin. */ static int hdmi_choose_cvt(struct hda_codec *codec, - int pin_idx, int *cvt_id) + int pin_idx, int *cvt_id, + bool silent) { struct hdmi_spec *spec = codec->spec; struct hdmi_spec_per_pin *per_pin; @@ -1003,6 +1005,9 @@ if (per_pin && per_pin->silent_stream) { cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); + per_cvt = get_cvt(spec, cvt_idx); + if (per_cvt->assigned && !silent) + return -EBUSY; if (cvt_id) *cvt_id = cvt_idx; return 0; @@ -1013,7 +1018,7 @@ per_cvt = get_cvt(spec, cvt_idx); /* Must not already be assigned */ - if (per_cvt->assigned) + if (per_cvt->assigned || per_cvt->silent_stream) continue; if (per_pin == NULL) break; @@ -1199,12 +1204,12 @@ if (pcm_idx < 0) return -EINVAL; - err = hdmi_choose_cvt(codec, -1, &cvt_idx); + err = hdmi_choose_cvt(codec, -1, &cvt_idx, false); if (err) return err; per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = 1; + per_cvt->assigned = true; hinfo->nid = per_cvt->cvt_nid; pin_cvt_fixup(codec, NULL, per_cvt->cvt_nid); @@ -1267,18 +1272,17 @@ } } - err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx); + err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, false); if (err < 0) goto unlock; per_cvt = get_cvt(spec, cvt_idx); /* Claim converter */ - per_cvt->assigned = 1; + per_cvt->assigned = true; set_bit(pcm_idx, &spec->pcm_in_use); per_pin = get_pin(spec, pin_idx); per_pin->cvt_nid = per_cvt->cvt_nid; - per_pin->silent_stream = false; hinfo->nid = per_cvt->cvt_nid; /* flip stripe flag for the assigned stream if supported */ @@ -1308,7 +1312,7 @@ snd_hdmi_eld_update_pcm_info(&eld->info, hinfo); if (hinfo->channels_min > hinfo->channels_max || !hinfo->rates || !hinfo->formats) { - per_cvt->assigned = 0; + per_cvt->assigned = false; hinfo->nid = 0; snd_hda_spdif_ctls_unassign(codec, pcm_idx); err = -ENODEV; @@ -1760,14 +1764,14 @@ } pin_idx = pin_id_to_pin_index(codec, per_pin->pin_nid, per_pin->dev_id); - err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx); + err = hdmi_choose_cvt(codec, pin_idx, &cvt_idx, true); if (err) { codec_err(codec, "hdmi: no free converter to enable silent mode\n"); goto unlock_out; } per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = 1; + per_cvt->silent_stream = true; per_pin->cvt_nid = per_cvt->cvt_nid; per_pin->silent_stream = true; @@ -1827,7 +1831,7 @@ cvt_idx = cvt_nid_to_cvt_index(codec, per_pin->cvt_nid); if (cvt_idx >= 0 && cvt_idx < spec->num_cvts) { per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = 0; + per_cvt->silent_stream = false; } if (spec->silent_stream_type == SILENT_STREAM_I915) { @@ -2223,7 +2227,7 @@ goto unlock; } per_cvt = get_cvt(spec, cvt_idx); - per_cvt->assigned = 0; + per_cvt->assigned = false; hinfo->nid = 0; azx_stream(get_azx_dev(substream))->stripe = 0; diff -u linux-kvm-5.19.0/sound/pci/hda/patch_realtek.c linux-kvm-5.19.0/sound/pci/hda/patch_realtek.c --- linux-kvm-5.19.0/sound/pci/hda/patch_realtek.c +++ linux-kvm-5.19.0/sound/pci/hda/patch_realtek.c @@ -9334,6 +9334,7 @@ SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED), + SND_PCI_QUIRK(0x103c, 0x896d, "HP ZBook Firefly 16 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), @@ -9352,6 +9353,7 @@ SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x89c0, "HP ZBook Power 15.6 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x89c6, "Zbook Fury 17 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF), @@ -9406,6 +9408,7 @@ SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401), SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE), + SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2), SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502), SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS), SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS), diff -u linux-kvm-5.19.0/sound/soc/amd/yc/acp6x-mach.c linux-kvm-5.19.0/sound/soc/amd/yc/acp6x-mach.c --- linux-kvm-5.19.0/sound/soc/amd/yc/acp6x-mach.c +++ linux-kvm-5.19.0/sound/soc/amd/yc/acp6x-mach.c @@ -143,6 +143,20 @@ DMI_MATCH(DMI_PRODUCT_NAME, "21CL"), } }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "82"), + } + }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"), + } + }, {} }; diff -u linux-kvm-5.19.0/sound/soc/qcom/lpass-cpu.c linux-kvm-5.19.0/sound/soc/qcom/lpass-cpu.c --- linux-kvm-5.19.0/sound/soc/qcom/lpass-cpu.c +++ linux-kvm-5.19.0/sound/soc/qcom/lpass-cpu.c @@ -781,10 +781,20 @@ return true; if (reg == LPASS_HDMI_TX_LEGACY_ADDR(v)) return true; + if (reg == LPASS_HDMI_TX_VBIT_CTL_ADDR(v)) + return true; + if (reg == LPASS_HDMI_TX_PARITY_ADDR(v)) + return true; for (i = 0; i < v->hdmi_rdma_channels; ++i) { if (reg == LPAIF_HDMI_RDMACURR_REG(v, i)) return true; + if (reg == LPASS_HDMI_TX_DMA_ADDR(v, i)) + return true; + if (reg == LPASS_HDMI_TX_CH_LSB_ADDR(v, i)) + return true; + if (reg == LPASS_HDMI_TX_CH_MSB_ADDR(v, i)) + return true; } return false; } diff -u linux-kvm-5.19.0/sound/usb/quirks.c linux-kvm-5.19.0/sound/usb/quirks.c --- linux-kvm-5.19.0/sound/usb/quirks.c +++ linux-kvm-5.19.0/sound/usb/quirks.c @@ -1020,6 +1020,304 @@ return 0; } +static void mbox3_setup_48_24_magic(struct usb_device *dev) +{ + /* The Mbox 3 is "little endian" */ + /* max volume is: 0x0000. */ + /* min volume is: 0x0080 (shown in little endian form) */ + + + /* Load 48000Hz rate into buffer */ + u8 com_buff[4] = {0x80, 0xbb, 0x00, 0x00}; + + /* Set 48000Hz sample rate */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 0x01, 0x21, 0x0100, 0x0001, &com_buff, 4); //Is this really needed? + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 0x01, 0x21, 0x0100, 0x8101, &com_buff, 4); + + /* Deactivate Tuner */ + /* on = 0x01*/ + /* off = 0x00*/ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 0x01, 0x21, 0x0003, 0x2001, &com_buff, 1); + + /* Set clock source to Internal (as opposed to S/PDIF) */ + com_buff[0] = 0x01; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0100, 0x8001, &com_buff, 1); + + /* Mute the hardware loopbacks to start the device in a known state. */ + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue input 1 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0110, 0x4001, &com_buff, 2); + /* Analogue input 1 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0111, 0x4001, &com_buff, 2); + /* Analogue input 2 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0114, 0x4001, &com_buff, 2); + /* Analogue input 2 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0115, 0x4001, &com_buff, 2); + /* Analogue input 3 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0118, 0x4001, &com_buff, 2); + /* Analogue input 3 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0119, 0x4001, &com_buff, 2); + /* Analogue input 4 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011c, 0x4001, &com_buff, 2); + /* Analogue input 4 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011d, 0x4001, &com_buff, 2); + + /* Set software sends to output */ + com_buff[0] = 0x00; + com_buff[1] = 0x00; + /* Analogue software return 1 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0100, 0x4001, &com_buff, 2); + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue software return 1 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0101, 0x4001, &com_buff, 2); + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue software return 2 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0104, 0x4001, &com_buff, 2); + com_buff[0] = 0x00; + com_buff[1] = 0x00; + /* Analogue software return 2 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0105, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue software return 3 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0108, 0x4001, &com_buff, 2); + /* Analogue software return 3 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0109, 0x4001, &com_buff, 2); + /* Analogue software return 4 left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010c, 0x4001, &com_buff, 2); + /* Analogue software return 4 right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010d, 0x4001, &com_buff, 2); + + /* Return to muting sends */ + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* Analogue fx return left channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0120, 0x4001, &com_buff, 2); + /* Analogue fx return right channel: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0121, 0x4001, &com_buff, 2); + + /* Analogue software input 1 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0100, 0x4201, &com_buff, 2); + /* Analogue software input 2 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0101, 0x4201, &com_buff, 2); + /* Analogue software input 3 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0102, 0x4201, &com_buff, 2); + /* Analogue software input 4 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0103, 0x4201, &com_buff, 2); + /* Analogue input 1 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0104, 0x4201, &com_buff, 2); + /* Analogue input 2 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0105, 0x4201, &com_buff, 2); + /* Analogue input 3 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0106, 0x4201, &com_buff, 2); + /* Analogue input 4 fx send: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0107, 0x4201, &com_buff, 2); + + /* Toggle allowing host control */ + com_buff[0] = 0x02; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0000, 0x2001, &com_buff, 1); + + /* Do not dim fx returns */ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0002, 0x2001, &com_buff, 1); + + /* Do not set fx returns to mono */ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0001, 0x2001, &com_buff, 1); + + /* Mute the S/PDIF hardware loopback + * same odd volume logic here as above + */ + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* S/PDIF hardware input 1 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0112, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 1 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0113, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 2 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0116, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 2 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0117, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 3 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011a, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 3 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011b, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 4 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011e, 0x4001, &com_buff, 2); + /* S/PDIF hardware input 4 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x011f, 0x4001, &com_buff, 2); + /* S/PDIF software return 1 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0102, 0x4001, &com_buff, 2); + /* S/PDIF software return 1 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0103, 0x4001, &com_buff, 2); + /* S/PDIF software return 2 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0106, 0x4001, &com_buff, 2); + /* S/PDIF software return 2 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0107, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x00; + /* S/PDIF software return 3 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010a, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* S/PDIF software return 3 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010b, 0x4001, &com_buff, 2); + /* S/PDIF software return 4 left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010e, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x00; + /* S/PDIF software return 4 right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x010f, 0x4001, &com_buff, 2); + + com_buff[0] = 0x00; + com_buff[1] = 0x80; + /* S/PDIF fx returns left channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0122, 0x4001, &com_buff, 2); + /* S/PDIF fx returns right channel */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0123, 0x4001, &com_buff, 2); + + /* Set the dropdown "Effect" to the first option */ + /* Room1 = 0x00 */ + /* Room2 = 0x01 */ + /* Room3 = 0x02 */ + /* Hall 1 = 0x03 */ + /* Hall 2 = 0x04 */ + /* Plate = 0x05 */ + /* Delay = 0x06 */ + /* Echo = 0x07 */ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0200, 0x4301, &com_buff, 1); /* max is 0xff */ + /* min is 0x00 */ + + + /* Set the effect duration to 0 */ + /* max is 0xffff */ + /* min is 0x0000 */ + com_buff[0] = 0x00; + com_buff[1] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0400, 0x4301, &com_buff, 2); + + /* Set the effect volume and feedback to 0 */ + /* max is 0xff */ + /* min is 0x00 */ + com_buff[0] = 0x00; + /* feedback: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0500, 0x4301, &com_buff, 1); + /* volume: */ + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 1, 0x21, 0x0300, 0x4301, &com_buff, 1); + + /* Set soft button hold duration */ + /* 0x03 = 250ms */ + /* 0x05 = 500ms DEFAULT */ + /* 0x08 = 750ms */ + /* 0x0a = 1sec */ + com_buff[0] = 0x05; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0005, 0x2001, &com_buff, 1); + + /* Use dim LEDs for button of state */ + com_buff[0] = 0x00; + snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), + 3, 0x21, 0x0004, 0x2001, &com_buff, 1); +} + +#define MBOX3_DESCRIPTOR_SIZE 464 + +static int snd_usb_mbox3_boot_quirk(struct usb_device *dev) +{ + struct usb_host_config *config = dev->actconfig; + int err; + int descriptor_size; + + descriptor_size = le16_to_cpu(get_cfg_desc(config)->wTotalLength); + + if (descriptor_size != MBOX3_DESCRIPTOR_SIZE) { + dev_err(&dev->dev, "Invalid descriptor size=%d.\n", descriptor_size); + return -ENODEV; + } + + dev_dbg(&dev->dev, "device initialised!\n"); + + err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, + &dev->descriptor, sizeof(dev->descriptor)); + config = dev->actconfig; + if (err < 0) + dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); + + err = usb_reset_configuration(dev); + if (err < 0) + dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err); + dev_dbg(&dev->dev, "mbox3_boot: new boot length = %d\n", + le16_to_cpu(get_cfg_desc(config)->wTotalLength)); + + mbox3_setup_48_24_magic(dev); + dev_info(&dev->dev, "Digidesign Mbox 3: 24bit 48kHz"); + + return 0; /* Successful boot */ +} #define MICROBOOK_BUF_SIZE 128 @@ -1324,6 +1622,10 @@ case USB_ID(0x0dba, 0x3000): /* Digidesign Mbox 2 */ return snd_usb_mbox2_boot_quirk(dev); + case USB_ID(0x0dba, 0x5000): + /* Digidesign Mbox 3 */ + return snd_usb_mbox3_boot_quirk(dev); + case USB_ID(0x1235, 0x0010): /* Focusrite Novation Saffire 6 USB */ case USB_ID(0x1235, 0x0018): /* Focusrite Novation Twitch */ diff -u linux-kvm-5.19.0/tools/lib/bpf/bpf_tracing.h linux-kvm-5.19.0/tools/lib/bpf/bpf_tracing.h --- linux-kvm-5.19.0/tools/lib/bpf/bpf_tracing.h +++ linux-kvm-5.19.0/tools/lib/bpf/bpf_tracing.h @@ -424,7 +424,7 @@ */ #define BPF_PROG(name, args...) \ name(unsigned long long *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(unsigned long long *ctx, ##args); \ typeof(name(0)) name(unsigned long long *ctx) \ { \ @@ -433,7 +433,7 @@ return ____##name(___bpf_ctx_cast(args)); \ _Pragma("GCC diagnostic pop") \ } \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(unsigned long long *ctx, ##args) struct pt_regs; @@ -458,7 +458,7 @@ */ #define BPF_KPROBE(name, args...) \ name(struct pt_regs *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args); \ typeof(name(0)) name(struct pt_regs *ctx) \ { \ @@ -467,7 +467,7 @@ return ____##name(___bpf_kprobe_args(args)); \ _Pragma("GCC diagnostic pop") \ } \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args) #define ___bpf_kretprobe_args0() ctx @@ -482,7 +482,7 @@ */ #define BPF_KRETPROBE(name, args...) \ name(struct pt_regs *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args); \ typeof(name(0)) name(struct pt_regs *ctx) \ { \ @@ -515,7 +515,7 @@ */ #define BPF_KPROBE_SYSCALL(name, args...) \ name(struct pt_regs *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args); \ typeof(name(0)) name(struct pt_regs *ctx) \ { \ @@ -525,7 +525,7 @@ return ____##name(___bpf_syscall_args(args)); \ _Pragma("GCC diagnostic pop") \ } \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args) #endif diff -u linux-kvm-5.19.0/tools/lib/bpf/libbpf.c linux-kvm-5.19.0/tools/lib/bpf/libbpf.c --- linux-kvm-5.19.0/tools/lib/bpf/libbpf.c +++ linux-kvm-5.19.0/tools/lib/bpf/libbpf.c @@ -9598,11 +9598,15 @@ int err = 0; /* BPF program's BTF ID */ - if (attach_prog_fd) { + if (prog->type == BPF_PROG_TYPE_EXT || attach_prog_fd) { + if (!attach_prog_fd) { + pr_warn("prog '%s': attach program FD is not set\n", prog->name); + return -EINVAL; + } err = libbpf_find_prog_btf_id(attach_name, attach_prog_fd); if (err < 0) { - pr_warn("failed to find BPF program (FD %d) BTF ID for '%s': %d\n", - attach_prog_fd, attach_name, err); + pr_warn("prog '%s': failed to find BPF program (FD %d) BTF ID for '%s': %d\n", + prog->name, attach_prog_fd, attach_name, err); return err; } *btf_obj_fd = 0; @@ -9619,7 +9623,8 @@ err = find_kernel_btf_id(prog->obj, attach_name, attach_type, btf_obj_fd, btf_type_id); } if (err) { - pr_warn("failed to find kernel BTF type ID of '%s': %d\n", attach_name, err); + pr_warn("prog '%s': failed to find kernel BTF type ID of '%s': %d\n", + prog->name, attach_name, err); return err; } return 0; @@ -11206,15 +11211,17 @@ static int resolve_full_path(const char *file, char *result, size_t result_sz) { const char *search_paths[3] = {}; - int i; + int i, perm; if (str_has_sfx(file, ".so") || strstr(file, ".so.")) { search_paths[0] = getenv("LD_LIBRARY_PATH"); search_paths[1] = "/usr/lib64:/usr/lib"; search_paths[2] = arch_specific_lib_paths(); + perm = R_OK; } else { search_paths[0] = getenv("PATH"); search_paths[1] = "/usr/bin:/usr/sbin"; + perm = R_OK | X_OK; } for (i = 0; i < ARRAY_SIZE(search_paths); i++) { @@ -11233,8 +11240,8 @@ if (!seg_len) continue; snprintf(result, result_sz, "%.*s/%s", seg_len, s, file); - /* ensure it is an executable file/link */ - if (access(result, R_OK | X_OK) < 0) + /* ensure it has required permissions */ + if (access(result, perm) < 0) continue; pr_debug("resolved '%s' to '%s'\n", file, result); return 0; diff -u linux-kvm-5.19.0/virt/kvm/kvm_main.c linux-kvm-5.19.0/virt/kvm/kvm_main.c --- linux-kvm-5.19.0/virt/kvm/kvm_main.c +++ linux-kvm-5.19.0/virt/kvm/kvm_main.c @@ -4730,6 +4730,12 @@ }; }; +long __weak kvm_arch_vm_compat_ioctl(struct file *filp, unsigned int ioctl, + unsigned long arg) +{ + return -ENOTTY; +} + static long kvm_vm_compat_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { @@ -4738,6 +4744,11 @@ if (kvm->mm != current->mm || kvm->vm_dead) return -EIO; + + r = kvm_arch_vm_compat_ioctl(filp, ioctl, arg); + if (r != -ENOTTY) + return r; + switch (ioctl) { #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT case KVM_CLEAR_DIRTY_LOG: { diff -u linux-kvm-5.19.0/virt/kvm/pfncache.c linux-kvm-5.19.0/virt/kvm/pfncache.c --- linux-kvm-5.19.0/virt/kvm/pfncache.c +++ linux-kvm-5.19.0/virt/kvm/pfncache.c @@ -81,6 +81,9 @@ { struct kvm_memslots *slots = kvm_memslots(kvm); + if (!gpc->active) + return false; + if ((gpa & ~PAGE_MASK) + len > PAGE_SIZE) return false; @@ -235,10 +238,11 @@ { struct kvm_memslots *slots = kvm_memslots(kvm); unsigned long page_offset = gpa & ~PAGE_MASK; - kvm_pfn_t old_pfn, new_pfn; + bool unmap_old = false; unsigned long old_uhva; + kvm_pfn_t old_pfn; void *old_khva; - int ret = 0; + int ret; /* * If must fit within a single page. The 'len' argument is @@ -256,6 +260,11 @@ write_lock_irq(&gpc->lock); + if (!gpc->active) { + ret = -EINVAL; + goto out_unlock; + } + old_pfn = gpc->pfn; old_khva = gpc->khva - offset_in_page(gpc->khva); old_uhva = gpc->uhva; @@ -286,6 +295,7 @@ /* If the HVA→PFN mapping was already valid, don't unmap it. */ old_pfn = KVM_PFN_ERR_FAULT; old_khva = NULL; + ret = 0; } out: @@ -300,14 +310,15 @@ gpc->khva = NULL; } - /* Snapshot the new pfn before dropping the lock! */ - new_pfn = gpc->pfn; + /* Detect a pfn change before dropping the lock! */ + unmap_old = (old_pfn != gpc->pfn); +out_unlock: write_unlock_irq(&gpc->lock); mutex_unlock(&gpc->refresh_lock); - if (old_pfn != new_pfn) + if (unmap_old) gpc_release_pfn_and_khva(kvm, old_pfn, old_khva); return ret; @@ -344,39 +355,58 @@ +void kvm_gpc_init(struct gfn_to_pfn_cache *gpc) +{ + rwlock_init(&gpc->lock); + mutex_init(&gpc->refresh_lock); +} +EXPORT_SYMBOL_GPL(kvm_gpc_init); -int kvm_gfn_to_pfn_cache_init(struct kvm *kvm, struct gfn_to_pfn_cache *gpc, - struct kvm_vcpu *vcpu, enum pfn_cache_usage usage, - gpa_t gpa, unsigned long len) +int kvm_gpc_activate(struct kvm *kvm, struct gfn_to_pfn_cache *gpc, + struct kvm_vcpu *vcpu, enum pfn_cache_usage usage, + gpa_t gpa, unsigned long len) { WARN_ON_ONCE(!usage || (usage & KVM_GUEST_AND_HOST_USE_PFN) != usage); if (!gpc->active) { - rwlock_init(&gpc->lock); - mutex_init(&gpc->refresh_lock); - gpc->khva = NULL; gpc->pfn = KVM_PFN_ERR_FAULT; gpc->uhva = KVM_HVA_ERR_BAD; gpc->vcpu = vcpu; gpc->usage = usage; gpc->valid = false; - gpc->active = true; spin_lock(&kvm->gpc_lock); list_add(&gpc->list, &kvm->gpc_list); spin_unlock(&kvm->gpc_lock); + + /* + * Activate the cache after adding it to the list, a concurrent + * refresh must not establish a mapping until the cache is + * reachable by mmu_notifier events. + */ + write_lock_irq(&gpc->lock); + gpc->active = true; + write_unlock_irq(&gpc->lock); } return kvm_gfn_to_pfn_cache_refresh(kvm, gpc, gpa, len); } -EXPORT_SYMBOL_GPL(kvm_gfn_to_pfn_cache_init); +EXPORT_SYMBOL_GPL(kvm_gpc_activate); -void kvm_gfn_to_pfn_cache_destroy(struct kvm *kvm, struct gfn_to_pfn_cache *gpc) +void kvm_gpc_deactivate(struct kvm *kvm, struct gfn_to_pfn_cache *gpc) { if (gpc->active) { + /* + * Deactivate the cache before removing it from the list, KVM + * must stall mmu_notifier events until all users go away, i.e. + * until gpc->lock is dropped and refresh is guaranteed to fail. + */ + write_lock_irq(&gpc->lock); + gpc->active = false; + write_unlock_irq(&gpc->lock); + spin_lock(&kvm->gpc_lock); list_del(&gpc->list); spin_unlock(&kvm->gpc_lock); kvm_gfn_to_pfn_cache_unmap(kvm, gpc); - gpc->active = false; } } -EXPORT_SYMBOL_GPL(kvm_gfn_to_pfn_cache_destroy); +EXPORT_SYMBOL_GPL(kvm_gpc_deactivate); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/Documentation/admin-guide/pm/amd-pstate.rst +++ linux-kvm-5.19.0/Documentation/admin-guide/pm/amd-pstate.rst @@ -182,6 +182,7 @@ Then, ``amd-pstate`` updates the desired performance according to the CPU scheduler assigned. +.. _processor_support: Processor Support ======================= @@ -282,21 +283,19 @@ Kernel Module Options for ``amd-pstate`` ========================================= -``shared_mem`` -Use a module param (shared_mem) to enable related processors manually with -**amd_pstate.shared_mem=1**. -Due to the performance issue on the processors with `Shared Memory Support -`_, we disable it presently and will re-enable this by default -once we address performance issue with this solution. +Passive Mode +------------ -To check whether the current processor is using `Full MSR Support `_ -or `Shared Memory Support `_ : :: +``amd_pstate=passive`` - ray@hr-test1:~$ lscpu | grep cppc - Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip pku ospke vaes vpclmulqdq rdpid overflow_recov succor smca fsrm - -If the CPU flags have ``cppc``, then this processor supports `Full MSR Support -`_. Otherwise, it supports `Shared Memory Support `_. +It will be enabled if the ``amd_pstate=passive`` is passed to the kernel in the command line. +In this mode, ``amd_pstate`` driver software specifies a desired QoS target in the CPPC +performance scale as a relative number. This can be expressed as percentage of nominal +performance (infrastructure max). Below the nominal sustained performance level, +desired performance expresses the average performance level of the processor subject +to the Performance Reduction Tolerance register. Above the nominal performance level, +processor must provide at least nominal performance requested and go higher if current +operating conditions allow. ``cpupower`` tool support for ``amd-pstate`` @@ -393,6 +392,76 @@ CPU_005 712 116384 39 49 166 0.7565 9645075 2214891 38431470 25.1 11.646 469 2.496 kworker/5:0-40 CPU_006 712 116408 39 49 166 0.6769 8950227 1839034 37192089 24.06 11.272 470 2.496 kworker/6:0-1264 +Unit Tests for amd-pstate +------------------------- + +``amd-pstate-ut`` is a test module for testing the ``amd-pstate`` driver. + + * It can help all users to verify their processor support (SBIOS/Firmware or Hardware). + + * Kernel can have a basic function test to avoid the kernel regression during the update. + + * We can introduce more functional or performance tests to align the result together, it will benefit power and performance scale optimization. + +1. Test case decriptions + + +---------+--------------------------------+------------------------------------------------------------------------------------+ + | Index | Functions | Description | + +=========+================================+====================================================================================+ + | 0 | amd_pstate_ut_acpi_cpc_valid || Check whether the _CPC object is present in SBIOS. | + | | || | + | | || The detail refer to `Processor Support `_. | + +---------+--------------------------------+------------------------------------------------------------------------------------+ + | 1 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. | + | | || | + | | || AMD P-States and ACPI hardware P-States always can be supported in one processor. | + | | | But AMD P-States has the higher priority and if it is enabled with | + | | | :c:macro:`MSR_AMD_CPPC_ENABLE` or ``cppc_set_enable``, it will respond to the | + | | | request from AMD P-States. | + +---------+--------------------------------+------------------------------------------------------------------------------------+ + | 2 | amd_pstate_ut_check_perf || Check if the each performance values are reasonable. | + | | || highest_perf >= nominal_perf > lowest_nonlinear_perf > lowest_perf > 0. | + +---------+--------------------------------+------------------------------------------------------------------------------------+ + | 3 | amd_pstate_ut_check_freq || Check if the each frequency values and max freq when set support boost mode | + | | | are reasonable. | + | | || max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0 | + | | || If boost is not active but supported, this maximum frequency will be larger than | + | | | the one in ``cpuinfo``. | + +---------+--------------------------------+------------------------------------------------------------------------------------+ + +#. How to execute the tests + + We use test module in the kselftest frameworks to implement it. + We create amd-pstate-ut module and tie it into kselftest.(for + details refer to Linux Kernel Selftests [4]_). + + 1. Build + + + open the :c:macro:`CONFIG_X86_AMD_PSTATE` configuration option. + + set the :c:macro:`CONFIG_X86_AMD_PSTATE_UT` configuration option to M. + + make project + + make selftest :: + + $ cd linux + $ make -C tools/testing/selftests + + #. Installation & Steps :: + + $ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest + $ sudo ./kselftest/run_kselftest.sh -c amd-pstate + TAP version 13 + 1..1 + # selftests: amd-pstate: amd-pstate-ut.sh + # amd-pstate-ut: ok + ok 1 selftests: amd-pstate: amd-pstate-ut.sh + + #. Results :: + + $ dmesg | grep "amd_pstate_ut" | tee log.txt + [12977.570663] amd_pstate_ut: 1 amd_pstate_ut_acpi_cpc_valid success! + [12977.570673] amd_pstate_ut: 2 amd_pstate_ut_check_enabled success! + [12977.571207] amd_pstate_ut: 3 amd_pstate_ut_check_perf success! + [12977.571212] amd_pstate_ut: 4 amd_pstate_ut_check_freq success! Reference =========== @@ -405,3 +474,6 @@ .. [3] Processor Programming Reference (PPR) for AMD Family 19h Model 51h, Revision A1 Processors https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip + +.. [4] Linux Kernel Selftests, + https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html only in patch2: unchanged: --- linux-kvm-5.19.0.orig/Documentation/process/howto.rst +++ linux-kvm-5.19.0/Documentation/process/howto.rst @@ -36,7 +36,7 @@ - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] The kernel is written using GNU C and the GNU toolchain. While it -adheres to the ISO C89 standard, it uses a number of extensions that are +adheres to the ISO C11 standard, it uses a number of extensions that are not featured in the standard. The kernel is a freestanding C environment, with no reliance on the standard C library, so some portions of the C standard are not supported. Arbitrary long long only in patch2: unchanged: --- linux-kvm-5.19.0.orig/Documentation/trace/histogram.rst +++ linux-kvm-5.19.0/Documentation/trace/histogram.rst @@ -39,7 +39,7 @@ will use the event's kernel stacktrace as the key. The keywords 'keys' or 'key' can be used to specify keys, and the keywords 'values', 'vals', or 'val' can be used to specify values. Compound - keys consisting of up to two fields can be specified by the 'keys' + keys consisting of up to three fields can be specified by the 'keys' keyword. Hashing a compound key produces a unique entry in the table for each unique combination of component keys, and can be useful for providing more fine-grained summaries of event data. only in patch2: unchanged: --- linux-kvm-5.19.0.orig/Documentation/translations/it_IT/process/howto.rst +++ linux-kvm-5.19.0/Documentation/translations/it_IT/process/howto.rst @@ -44,7 +44,7 @@ - "C: A Reference Manual" di Harbison and Steele [Prentice Hall] Il kernel è stato scritto usando GNU C e la toolchain GNU. -Sebbene si attenga allo standard ISO C89, esso utilizza una serie di +Sebbene si attenga allo standard ISO C11, esso utilizza una serie di estensioni che non sono previste in questo standard. Il kernel è un ambiente C indipendente, che non ha alcuna dipendenza dalle librerie C standard, così alcune parti del C standard non sono supportate. only in patch2: unchanged: --- linux-kvm-5.19.0.orig/Documentation/translations/ja_JP/howto.rst +++ linux-kvm-5.19.0/Documentation/translations/ja_JP/howto.rst @@ -65,7 +65,7 @@ - 『新・詳説 C 言語 H&S リファレンス』 (サミュエル P ハービソン/ガイ L スティール共著 斉藤 信男監訳)[ソフトバンク] カーネルは GNU C と GNU ツールチェインを使って書かれています。カーネル -は ISO C89 仕様に準拠して書く一方で、標準には無い言語拡張を多く使って +は ISO C11 仕様に準拠して書く一方で、標準には無い言語拡張を多く使って います。カーネルは標準 C ライブラリに依存しない、C 言語非依存環境です。 そのため、C の標準の中で使えないものもあります。特に任意の long long の除算や浮動小数点は使えません。カーネルがツールチェインや C 言語拡張 only in patch2: unchanged: --- linux-kvm-5.19.0.orig/Documentation/translations/ko_KR/howto.rst +++ linux-kvm-5.19.0/Documentation/translations/ko_KR/howto.rst @@ -62,7 +62,7 @@ - "Practical C Programming" by Steve Oualline [O'Reilly] - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] -커널은 GNU C와 GNU 툴체인을 사용하여 작성되었다. 이 툴들은 ISO C89 표준을 +커널은 GNU C와 GNU 툴체인을 사용하여 작성되었다. 이 툴들은 ISO C11 표준을 따르는 반면 표준에 있지 않은 많은 확장기능도 가지고 있다. 커널은 표준 C 라이브러리와는 관계없이 freestanding C 환경이어서 C 표준의 일부는 지원되지 않는다. 임의의 long long 나누기나 floating point는 지원되지 않는다. only in patch2: unchanged: --- linux-kvm-5.19.0.orig/Documentation/translations/zh_CN/process/howto.rst +++ linux-kvm-5.19.0/Documentation/translations/zh_CN/process/howto.rst @@ -45,7 +45,7 @@ - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] 《C语言参考手册(原书第5版)》(邱仲潘 等译)[机械工业出版社] -Linux内核使用GNU C和GNU工具链开发。虽然它遵循ISO C89标准,但也用到了一些 +Linux内核使用GNU C和GNU工具链开发。虽然它遵循ISO C11标准,但也用到了一些 标准中没有定义的扩展。内核是自给自足的C环境,不依赖于标准C库的支持,所以 并不支持C标准中的部分定义。比如long long类型的大数除法和浮点运算就不允许 使用。有时候确实很难弄清楚内核对工具链的要求和它所使用的扩展,不幸的是目 only in patch2: unchanged: --- linux-kvm-5.19.0.orig/Documentation/translations/zh_TW/process/howto.rst +++ linux-kvm-5.19.0/Documentation/translations/zh_TW/process/howto.rst @@ -48,7 +48,7 @@ - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] 《C語言參考手冊(原書第5版)》(邱仲潘 等譯)[機械工業出版社] -Linux內核使用GNU C和GNU工具鏈開發。雖然它遵循ISO C89標準,但也用到了一些 +Linux內核使用GNU C和GNU工具鏈開發。雖然它遵循ISO C11標準,但也用到了一些 標準中沒有定義的擴展。內核是自給自足的C環境,不依賴於標準C庫的支持,所以 並不支持C標準中的部分定義。比如long long類型的大數除法和浮點運算就不允許 使用。有時候確實很難弄清楚內核對工具鏈的要求和它所使用的擴展,不幸的是目 only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arc/include/asm/io.h +++ linux-kvm-5.19.0/arch/arc/include/asm/io.h @@ -32,7 +32,7 @@ { } -extern void iounmap(const void __iomem *addr); +extern void iounmap(const volatile void __iomem *addr); /* * io{read,write}{16,32}be() macros only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arc/include/asm/pgtable-levels.h +++ linux-kvm-5.19.0/arch/arc/include/asm/pgtable-levels.h @@ -161,7 +161,7 @@ #define pmd_pfn(pmd) ((pmd_val(pmd) & PAGE_MASK) >> PAGE_SHIFT) #define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd)) #define set_pmd(pmdp, pmd) (*(pmdp) = pmd) -#define pmd_pgtable(pmd) ((pgtable_t) pmd_page_vaddr(pmd)) +#define pmd_pgtable(pmd) ((pgtable_t) pmd_page(pmd)) /* * 4th level paging: pte only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arc/mm/ioremap.c +++ linux-kvm-5.19.0/arch/arc/mm/ioremap.c @@ -94,7 +94,7 @@ EXPORT_SYMBOL(ioremap_prot); -void iounmap(const void __iomem *addr) +void iounmap(const volatile void __iomem *addr) { /* weird double cast to handle phys_addr_t > 32 bits */ if (arc_uncached_addr_space((phys_addr_t)(u32)addr)) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm/boot/dts/imx6q-yapp4-crux.dts +++ linux-kvm-5.19.0/arch/arm/boot/dts/imx6q-yapp4-crux.dts @@ -33,6 +33,10 @@ status = "okay"; }; +®_pu { + regulator-always-on; +}; + ®_usb_h1_vbus { status = "okay"; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm/boot/dts/imx6qdl-gw5910.dtsi +++ linux-kvm-5.19.0/arch/arm/boot/dts/imx6qdl-gw5910.dtsi @@ -29,7 +29,7 @@ user-pb { label = "user_pb"; - gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>; + gpios = <&gsc_gpio 2 GPIO_ACTIVE_LOW>; linux,code = ; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm/boot/dts/imx6qdl-gw5913.dtsi +++ linux-kvm-5.19.0/arch/arm/boot/dts/imx6qdl-gw5913.dtsi @@ -26,7 +26,7 @@ user-pb { label = "user_pb"; - gpios = <&gsc_gpio 0 GPIO_ACTIVE_LOW>; + gpios = <&gsc_gpio 2 GPIO_ACTIVE_LOW>; linux,code = ; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm/boot/dts/imx6qp-yapp4-crux-plus.dts +++ linux-kvm-5.19.0/arch/arm/boot/dts/imx6qp-yapp4-crux-plus.dts @@ -33,6 +33,10 @@ status = "okay"; }; +®_pu { + regulator-always-on; +}; + ®_usb_h1_vbus { status = "okay"; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm/plat-orion/Makefile +++ linux-kvm-5.19.0/arch/arm/plat-orion/Makefile @@ -2,7 +2,7 @@ # # Makefile for the linux kernel. # -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include +ccflags-y := -I$(srctree)/$(src)/include orion-gpio-$(CONFIG_GPIOLIB) += gpio.o obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/arm/juno-base.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/arm/juno-base.dtsi @@ -750,12 +750,26 @@ polling-delay = <1000>; polling-delay-passive = <100>; thermal-sensors = <&scpi_sensors0 0>; + trips { + pmic_crit0: trip0 { + temperature = <90000>; + hysteresis = <2000>; + type = "critical"; + }; + }; }; soc { polling-delay = <1000>; polling-delay-passive = <100>; thermal-sensors = <&scpi_sensors0 3>; + trips { + soc_crit0: trip0 { + temperature = <80000>; + hysteresis = <2000>; + type = "critical"; + }; + }; }; big_cluster_thermal_zone: big-cluster { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi @@ -795,7 +795,7 @@ reg = <0x27>; interrupt-parent = <&gpa1>; interrupts = <3 IRQ_TYPE_EDGE_RISING>; - en-gpios = <&gpf1 4 GPIO_ACTIVE_HIGH>; + en-gpios = <&gpf1 4 GPIO_ACTIVE_LOW>; wake-gpios = <&gpj0 2 GPIO_ACTIVE_HIGH>; }; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi @@ -771,6 +771,9 @@ little-endian; #address-cells = <1>; #size-cells = <0>; + clock-frequency = <2500000>; + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL + QORIQ_CLK_PLL_DIV(1)>; status = "disabled"; }; @@ -780,6 +783,9 @@ little-endian; #address-cells = <1>; #size-cells = <0>; + clock-frequency = <2500000>; + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL + QORIQ_CLK_PLL_DIV(1)>; status = "disabled"; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi @@ -525,6 +525,9 @@ little-endian; #address-cells = <1>; #size-cells = <0>; + clock-frequency = <2500000>; + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL + QORIQ_CLK_PLL_DIV(2)>; status = "disabled"; }; @@ -534,6 +537,9 @@ little-endian; #address-cells = <1>; #size-cells = <0>; + clock-frequency = <2500000>; + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL + QORIQ_CLK_PLL_DIV(2)>; status = "disabled"; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi @@ -1377,6 +1377,9 @@ #address-cells = <1>; #size-cells = <0>; little-endian; + clock-frequency = <2500000>; + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL + QORIQ_CLK_PLL_DIV(2)>; status = "disabled"; }; @@ -1387,6 +1390,9 @@ little-endian; #address-cells = <1>; #size-cells = <0>; + clock-frequency = <2500000>; + clocks = <&clockgen QORIQ_CLK_PLATFORM_PLL + QORIQ_CLK_PLL_DIV(2)>; status = "disabled"; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/freescale/imx8-ss-conn.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8-ss-conn.dtsi @@ -38,9 +38,9 @@ interrupts = ; reg = <0x5b010000 0x10000>; clocks = <&sdhc0_lpcg IMX_LPCG_CLK_4>, - <&sdhc0_lpcg IMX_LPCG_CLK_5>, - <&sdhc0_lpcg IMX_LPCG_CLK_0>; - clock-names = "ipg", "per", "ahb"; + <&sdhc0_lpcg IMX_LPCG_CLK_0>, + <&sdhc0_lpcg IMX_LPCG_CLK_5>; + clock-names = "ipg", "ahb", "per"; power-domains = <&pd IMX_SC_R_SDHC_0>; status = "disabled"; }; @@ -49,9 +49,9 @@ interrupts = ; reg = <0x5b020000 0x10000>; clocks = <&sdhc1_lpcg IMX_LPCG_CLK_4>, - <&sdhc1_lpcg IMX_LPCG_CLK_5>, - <&sdhc1_lpcg IMX_LPCG_CLK_0>; - clock-names = "ipg", "per", "ahb"; + <&sdhc1_lpcg IMX_LPCG_CLK_0>, + <&sdhc1_lpcg IMX_LPCG_CLK_5>; + clock-names = "ipg", "ahb", "per"; power-domains = <&pd IMX_SC_R_SDHC_1>; fsl,tuning-start-tap = <20>; fsl,tuning-step= <2>; @@ -62,9 +62,9 @@ interrupts = ; reg = <0x5b030000 0x10000>; clocks = <&sdhc2_lpcg IMX_LPCG_CLK_4>, - <&sdhc2_lpcg IMX_LPCG_CLK_5>, - <&sdhc2_lpcg IMX_LPCG_CLK_0>; - clock-names = "ipg", "per", "ahb"; + <&sdhc2_lpcg IMX_LPCG_CLK_0>, + <&sdhc2_lpcg IMX_LPCG_CLK_5>; + clock-names = "ipg", "ahb", "per"; power-domains = <&pd IMX_SC_R_SDHC_2>; status = "disabled"; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/freescale/imx8mm.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/freescale/imx8mm.dtsi @@ -276,6 +276,7 @@ assigned-clocks = <&clk IMX8MM_CLK_USB_PHY_REF>; assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_100M>; clock-names = "main_clk"; + power-domains = <&pgc_otg1>; }; usbphynop2: usbphynop2 { @@ -285,6 +286,7 @@ assigned-clocks = <&clk IMX8MM_CLK_USB_PHY_REF>; assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_100M>; clock-names = "main_clk"; + power-domains = <&pgc_otg2>; }; soc@0 { @@ -669,13 +671,11 @@ pgc_otg1: power-domain@2 { #power-domain-cells = <0>; reg = ; - power-domains = <&pgc_hsiomix>; }; pgc_otg2: power-domain@3 { #power-domain-cells = <0>; reg = ; - power-domains = <&pgc_hsiomix>; }; pgc_gpumix: power-domain@4 { @@ -1180,7 +1180,7 @@ assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_500M>; phys = <&usbphynop1>; fsl,usbmisc = <&usbmisc1 0>; - power-domains = <&pgc_otg1>; + power-domains = <&pgc_hsiomix>; status = "disabled"; }; @@ -1200,7 +1200,7 @@ assigned-clock-parents = <&clk IMX8MM_SYS_PLL2_500M>; phys = <&usbphynop2>; fsl,usbmisc = <&usbmisc2 0>; - power-domains = <&pgc_otg2>; + power-domains = <&pgc_hsiomix>; status = "disabled"; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/qcom/pm8350c.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/pm8350c.dtsi @@ -30,9 +30,8 @@ #interrupt-cells = <2>; }; - pm8350c_pwm: pwm@e800 { + pm8350c_pwm: pwm { compatible = "qcom,pm8350c-pwm"; - reg = <0xe800>; #pwm-cells = <2>; status = "disabled"; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dts @@ -24,8 +24,6 @@ }; &pm6150_adc { - status = "disabled"; - /delete-node/ skin-temp-thermistor@4e; /delete-node/ charger-thermistor@4f; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor.dtsi @@ -54,8 +54,6 @@ }; &pm6150_adc { - status = "disabled"; - /delete-node/ charger-thermistor@4f; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/qcom/sc7280-idp.dts +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sc7280-idp.dts @@ -78,7 +78,7 @@ }; &pmk8350_vadc { - pmr735a_die_temp { + pmr735a-die-temp@403 { reg = ; label = "pmr735a_die_temp"; qcom,pre-scaling = <1 1>; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi @@ -264,7 +264,7 @@ }; &pmk8350_vadc { - pmk8350_die_temp { + pmk8350-die-temp@3 { reg = ; label = "pmk8350_die_temp"; qcom,pre-scaling = <1 1>; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi +++ linux-kvm-5.19.0/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi @@ -223,7 +223,7 @@ gpio-reserved-ranges = <44 4>; ts_int_default: ts-int-default { - pin = "gpio23"; + pins = "gpio23"; function = "gpio"; drive-strength = <2>; bias-disable; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/include/asm/cputype.h +++ linux-kvm-5.19.0/arch/arm64/include/asm/cputype.h @@ -60,6 +60,7 @@ #define ARM_CPU_IMP_FUJITSU 0x46 #define ARM_CPU_IMP_HISI 0x48 #define ARM_CPU_IMP_APPLE 0x61 +#define ARM_CPU_IMP_AMPERE 0xC0 #define ARM_CPU_PART_AEM_V8 0xD0F #define ARM_CPU_PART_FOUNDATION 0xD00 @@ -123,6 +124,8 @@ #define APPLE_CPU_PART_M1_ICESTORM_MAX 0x028 #define APPLE_CPU_PART_M1_FIRESTORM_MAX 0x029 +#define AMPERE_CPU_PART_AMPERE1 0xAC3 + #define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53) #define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57) #define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72) @@ -172,6 +175,7 @@ #define MIDR_APPLE_M1_FIRESTORM_PRO MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM_PRO) #define MIDR_APPLE_M1_ICESTORM_MAX MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM_MAX) #define MIDR_APPLE_M1_FIRESTORM_MAX MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM_MAX) +#define MIDR_AMPERE1 MIDR_CPU_MODEL(ARM_CPU_IMP_AMPERE, AMPERE_CPU_PART_AMPERE1) /* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */ #define MIDR_FUJITSU_ERRATUM_010001 MIDR_FUJITSU_A64FX only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/kernel/entry-common.c +++ linux-kvm-5.19.0/arch/arm64/kernel/entry-common.c @@ -329,7 +329,8 @@ __this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 0); } -static bool cortex_a76_erratum_1463225_debug_handler(struct pt_regs *regs) +static __always_inline bool +cortex_a76_erratum_1463225_debug_handler(struct pt_regs *regs) { if (!__this_cpu_read(__in_cortex_a76_erratum_1463225_wa)) return false; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/kernel/proton-pack.c +++ linux-kvm-5.19.0/arch/arm64/kernel/proton-pack.c @@ -868,6 +868,10 @@ MIDR_ALL_VERSIONS(MIDR_NEOVERSE_N1), {}, }; + static const struct midr_range spectre_bhb_k11_list[] = { + MIDR_ALL_VERSIONS(MIDR_AMPERE1), + {}, + }; static const struct midr_range spectre_bhb_k8_list[] = { MIDR_ALL_VERSIONS(MIDR_CORTEX_A72), MIDR_ALL_VERSIONS(MIDR_CORTEX_A57), @@ -878,6 +882,8 @@ k = 32; else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k24_list)) k = 24; + else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k11_list)) + k = 11; else if (is_midr_in_range_list(read_cpuid_id(), spectre_bhb_k8_list)) k = 8; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/kvm/hyp/exception.c +++ linux-kvm-5.19.0/arch/arm64/kvm/hyp/exception.c @@ -13,6 +13,7 @@ #include #include #include +#include #if !defined (__KVM_NVHE_HYPERVISOR__) && !defined (__KVM_VHE_HYPERVISOR__) #error Hypervisor code only! @@ -115,7 +116,7 @@ new |= (old & PSR_C_BIT); new |= (old & PSR_V_BIT); - if (kvm_has_mte(vcpu->kvm)) + if (kvm_has_mte(kern_hyp_va(vcpu->kvm))) new |= PSR_TCO_BIT; new |= (old & PSR_DIT_BIT); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/kvm/hyp/include/hyp/switch.h +++ linux-kvm-5.19.0/arch/arm64/kvm/hyp/include/hyp/switch.h @@ -99,6 +99,17 @@ vcpu->arch.mdcr_el2_host = read_sysreg(mdcr_el2); write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2); + + if (cpus_have_final_cap(ARM64_SME)) { + sysreg_clear_set_s(SYS_HFGRTR_EL2, + HFGxTR_EL2_nSMPRI_EL1_MASK | + HFGxTR_EL2_nTPIDR2_EL0_MASK, + 0); + sysreg_clear_set_s(SYS_HFGWTR_EL2, + HFGxTR_EL2_nSMPRI_EL1_MASK | + HFGxTR_EL2_nTPIDR2_EL0_MASK, + 0); + } } static inline void __deactivate_traps_common(struct kvm_vcpu *vcpu) @@ -108,6 +119,15 @@ write_sysreg(0, hstr_el2); if (kvm_arm_support_pmu_v3()) write_sysreg(0, pmuserenr_el0); + + if (cpus_have_final_cap(ARM64_SME)) { + sysreg_clear_set_s(SYS_HFGRTR_EL2, 0, + HFGxTR_EL2_nSMPRI_EL1_MASK | + HFGxTR_EL2_nTPIDR2_EL0_MASK); + sysreg_clear_set_s(SYS_HFGWTR_EL2, 0, + HFGxTR_EL2_nSMPRI_EL1_MASK | + HFGxTR_EL2_nTPIDR2_EL0_MASK); + } } static inline void ___activate_traps(struct kvm_vcpu *vcpu) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/kvm/vgic/vgic-its.c +++ linux-kvm-5.19.0/arch/arm64/kvm/vgic/vgic-its.c @@ -2149,7 +2149,7 @@ memset(entry, 0, esz); - while (len > 0) { + while (true) { int next_offset; size_t byte_offset; @@ -2162,6 +2162,9 @@ return next_offset; byte_offset = next_offset * esz; + if (byte_offset >= len) + break; + id += next_offset; gpa += byte_offset; len -= byte_offset; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/arm64/mm/mteswap.c +++ linux-kvm-5.19.0/arch/arm64/mm/mteswap.c @@ -62,7 +62,12 @@ * the new page->flags are visible before the tags were updated. */ smp_wmb(); - mte_restore_page_tags(page_address(page), tags); + /* + * Test PG_mte_tagged again in case it was racing with another + * set_pte_at(). + */ + if (!test_and_set_bit(PG_mte_tagged, &page->flags)) + mte_restore_page_tags(page_address(page), tags); return true; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/parisc/include/asm/hardware.h +++ linux-kvm-5.19.0/arch/parisc/include/asm/hardware.h @@ -10,12 +10,12 @@ #define SVERSION_ANY_ID PA_SVERSION_ANY_ID struct hp_hardware { - unsigned short hw_type:5; /* HPHW_xxx */ - unsigned short hversion; - unsigned long sversion:28; - unsigned short opt; - const char name[80]; /* The hardware description */ -}; + unsigned int hw_type:8; /* HPHW_xxx */ + unsigned int hversion:12; + unsigned int sversion:12; + unsigned char opt; + unsigned char name[59]; /* The hardware description */ +} __packed; struct parisc_device; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/powerpc/net/bpf_jit_comp64.c +++ linux-kvm-5.19.0/arch/powerpc/net/bpf_jit_comp64.c @@ -360,6 +360,7 @@ u32 size = BPF_SIZE(code); u32 tmp1_reg = bpf_to_ppc(TMP_REG_1); u32 tmp2_reg = bpf_to_ppc(TMP_REG_2); + u32 save_reg, ret_reg; s16 off = insn[i].off; s32 imm = insn[i].imm; bool func_addr_fixed; @@ -777,42 +778,83 @@ * BPF_STX ATOMIC (atomic ops) */ case BPF_STX | BPF_ATOMIC | BPF_W: - if (imm != BPF_ADD) { - pr_err_ratelimited( - "eBPF filter atomic op code %02x (@%d) unsupported\n", - code, i); - return -ENOTSUPP; - } - - /* *(u32 *)(dst + off) += src */ + case BPF_STX | BPF_ATOMIC | BPF_DW: + save_reg = tmp2_reg; + ret_reg = src_reg; - /* Get EA into TMP_REG_1 */ - EMIT(PPC_RAW_ADDI(tmp1_reg, dst_reg, off)); + /* Get offset into TMP_REG_1 */ + EMIT(PPC_RAW_LI(tmp1_reg, off)); tmp_idx = ctx->idx * 4; /* load value from memory into TMP_REG_2 */ - EMIT(PPC_RAW_LWARX(tmp2_reg, 0, tmp1_reg, 0)); - /* add value from src_reg into this */ - EMIT(PPC_RAW_ADD(tmp2_reg, tmp2_reg, src_reg)); - /* store result back */ - EMIT(PPC_RAW_STWCX(tmp2_reg, 0, tmp1_reg)); - /* we're done if this succeeded */ - PPC_BCC_SHORT(COND_NE, tmp_idx); - break; - case BPF_STX | BPF_ATOMIC | BPF_DW: - if (imm != BPF_ADD) { + if (size == BPF_DW) + EMIT(PPC_RAW_LDARX(tmp2_reg, tmp1_reg, dst_reg, 0)); + else + EMIT(PPC_RAW_LWARX(tmp2_reg, tmp1_reg, dst_reg, 0)); + + /* Save old value in _R0 */ + if (imm & BPF_FETCH) + EMIT(PPC_RAW_MR(_R0, tmp2_reg)); + + switch (imm) { + case BPF_ADD: + case BPF_ADD | BPF_FETCH: + EMIT(PPC_RAW_ADD(tmp2_reg, tmp2_reg, src_reg)); + break; + case BPF_AND: + case BPF_AND | BPF_FETCH: + EMIT(PPC_RAW_AND(tmp2_reg, tmp2_reg, src_reg)); + break; + case BPF_OR: + case BPF_OR | BPF_FETCH: + EMIT(PPC_RAW_OR(tmp2_reg, tmp2_reg, src_reg)); + break; + case BPF_XOR: + case BPF_XOR | BPF_FETCH: + EMIT(PPC_RAW_XOR(tmp2_reg, tmp2_reg, src_reg)); + break; + case BPF_CMPXCHG: + /* + * Return old value in BPF_REG_0 for BPF_CMPXCHG & + * in src_reg for other cases. + */ + ret_reg = bpf_to_ppc(BPF_REG_0); + + /* Compare with old value in BPF_R0 */ + if (size == BPF_DW) + EMIT(PPC_RAW_CMPD(bpf_to_ppc(BPF_REG_0), tmp2_reg)); + else + EMIT(PPC_RAW_CMPW(bpf_to_ppc(BPF_REG_0), tmp2_reg)); + /* Don't set if different from old value */ + PPC_BCC_SHORT(COND_NE, (ctx->idx + 3) * 4); + fallthrough; + case BPF_XCHG: + save_reg = src_reg; + break; + default: pr_err_ratelimited( "eBPF filter atomic op code %02x (@%d) unsupported\n", code, i); - return -ENOTSUPP; + return -EOPNOTSUPP; } - /* *(u64 *)(dst + off) += src */ - EMIT(PPC_RAW_ADDI(tmp1_reg, dst_reg, off)); - tmp_idx = ctx->idx * 4; - EMIT(PPC_RAW_LDARX(tmp2_reg, 0, tmp1_reg, 0)); - EMIT(PPC_RAW_ADD(tmp2_reg, tmp2_reg, src_reg)); - EMIT(PPC_RAW_STDCX(tmp2_reg, 0, tmp1_reg)); + /* store new value */ + if (size == BPF_DW) + EMIT(PPC_RAW_STDCX(save_reg, tmp1_reg, dst_reg)); + else + EMIT(PPC_RAW_STWCX(save_reg, tmp1_reg, dst_reg)); + /* we're done if this succeeded */ PPC_BCC_SHORT(COND_NE, tmp_idx); + + if (imm & BPF_FETCH) { + EMIT(PPC_RAW_MR(ret_reg, _R0)); + /* + * Skip unnecessary zero-extension for 32-bit cmpxchg. + * For context, see commit 39491867ace5. + */ + if (size != BPF_DW && imm == BPF_CMPXCHG && + insn_is_zext(&insn[i + 1])) + addrs[++i] = ctx->idx * 4; + } break; /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/riscv/mm/kasan_init.c +++ linux-kvm-5.19.0/arch/riscv/mm/kasan_init.c @@ -113,6 +113,8 @@ base_pud = pt_ops.get_pud_virt(pfn_to_phys(_pgd_pfn(*pgd))); } else if (pgd_none(*pgd)) { base_pud = memblock_alloc(PTRS_PER_PUD * sizeof(pud_t), PAGE_SIZE); + memcpy(base_pud, (void *)kasan_early_shadow_pud, + sizeof(pud_t) * PTRS_PER_PUD); } else { base_pud = (pud_t *)pgd_page_vaddr(*pgd); if (base_pud == lm_alias(kasan_early_shadow_pud)) { @@ -173,8 +175,11 @@ base_p4d = pt_ops.get_p4d_virt(pfn_to_phys(_pgd_pfn(*pgd))); } else { base_p4d = (p4d_t *)pgd_page_vaddr(*pgd); - if (base_p4d == lm_alias(kasan_early_shadow_p4d)) + if (base_p4d == lm_alias(kasan_early_shadow_p4d)) { base_p4d = memblock_alloc(PTRS_PER_PUD * sizeof(p4d_t), PAGE_SIZE); + memcpy(base_p4d, (void *)kasan_early_shadow_p4d, + sizeof(p4d_t) * PTRS_PER_P4D); + } } p4dp = base_p4d + p4d_index(vaddr); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/s390/include/asm/futex.h +++ linux-kvm-5.19.0/arch/s390/include/asm/futex.h @@ -17,7 +17,8 @@ "3: jl 1b\n" \ " lhi %0,0\n" \ "4: sacf 768\n" \ - EX_TABLE(0b,4b) EX_TABLE(2b,4b) EX_TABLE(3b,4b) \ + EX_TABLE(0b,4b) EX_TABLE(1b,4b) \ + EX_TABLE(2b,4b) EX_TABLE(3b,4b) \ : "=d" (ret), "=&d" (oldval), "=&d" (newval), \ "=m" (*uaddr) \ : "0" (-EFAULT), "d" (oparg), "a" (uaddr), \ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/s390/lib/uaccess.c +++ linux-kvm-5.19.0/arch/s390/lib/uaccess.c @@ -156,7 +156,7 @@ asm volatile( " lr 0,%[spec]\n" "0: mvcos 0(%1),0(%4),%0\n" - " jz 4f\n" + "6: jz 4f\n" "1: algr %0,%2\n" " slgr %1,%2\n" " j 0b\n" @@ -166,11 +166,11 @@ " clgr %0,%3\n" /* copy crosses next page boundary? */ " jnh 5f\n" "3: mvcos 0(%1),0(%4),%3\n" - " slgr %0,%3\n" + "7: slgr %0,%3\n" " j 5f\n" "4: slgr %0,%0\n" "5:\n" - EX_TABLE(0b,2b) EX_TABLE(3b,5b) + EX_TABLE(0b,2b) EX_TABLE(6b,2b) EX_TABLE(3b,5b) EX_TABLE(7b,5b) : "+a" (size), "+a" (to), "+a" (tmp1), "=a" (tmp2) : "a" (empty_zero_page), [spec] "d" (spec.val) : "cc", "memory", "0"); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/s390/pci/pci_mmio.c +++ linux-kvm-5.19.0/arch/s390/pci/pci_mmio.c @@ -64,7 +64,7 @@ asm volatile ( " sacf 256\n" "0: llgc %[tmp],0(%[src])\n" - " sllg %[val],%[val],8\n" + "4: sllg %[val],%[val],8\n" " aghi %[src],1\n" " ogr %[val],%[tmp]\n" " brctg %[cnt],0b\n" @@ -72,7 +72,7 @@ "2: ipm %[cc]\n" " srl %[cc],28\n" "3: sacf 768\n" - EX_TABLE(0b, 3b) EX_TABLE(1b, 3b) EX_TABLE(2b, 3b) + EX_TABLE(0b, 3b) EX_TABLE(4b, 3b) EX_TABLE(1b, 3b) EX_TABLE(2b, 3b) : [src] "+a" (src), [cnt] "+d" (cnt), [val] "+d" (val), [tmp] "=d" (tmp), @@ -215,10 +215,10 @@ "2: ahi %[shift],-8\n" " srlg %[tmp],%[val],0(%[shift])\n" "3: stc %[tmp],0(%[dst])\n" - " aghi %[dst],1\n" + "5: aghi %[dst],1\n" " brctg %[cnt],2b\n" "4: sacf 768\n" - EX_TABLE(0b, 4b) EX_TABLE(1b, 4b) EX_TABLE(3b, 4b) + EX_TABLE(0b, 4b) EX_TABLE(1b, 4b) EX_TABLE(3b, 4b) EX_TABLE(5b, 4b) : [ioaddr_len] "+&d" (ioaddr_len.pair), [cc] "+d" (cc), [val] "=d" (val), only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/x86/include/asm/iommu.h +++ linux-kvm-5.19.0/arch/x86/include/asm/iommu.h @@ -25,8 +25,10 @@ { u64 start = rmrr->base_address; u64 end = rmrr->end_address + 1; + int entry_type; - if (e820__mapped_all(start, end, E820_TYPE_RESERVED)) + entry_type = e820__get_entry_type(start, end); + if (entry_type == E820_TYPE_RESERVED || entry_type == E820_TYPE_NVS) return 0; pr_err(FW_BUG "No firmware reserved region can cover this RMRR [%#018Lx-%#018Lx], contact BIOS vendor for fixes\n", only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/x86/include/asm/syscall_wrapper.h +++ linux-kvm-5.19.0/arch/x86/include/asm/syscall_wrapper.h @@ -6,7 +6,7 @@ #ifndef _ASM_X86_SYSCALL_WRAPPER_H #define _ASM_X86_SYSCALL_WRAPPER_H -struct pt_regs; +#include extern long __x64_sys_ni_syscall(const struct pt_regs *regs); extern long __ia32_sys_ni_syscall(const struct pt_regs *regs); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/x86/kernel/cpu/resctrl/core.c +++ linux-kvm-5.19.0/arch/x86/kernel/cpu/resctrl/core.c @@ -66,9 +66,6 @@ .rid = RDT_RESOURCE_L3, .name = "L3", .cache_level = 3, - .cache = { - .min_cbm_bits = 1, - }, .domains = domain_init(RDT_RESOURCE_L3), .parse_ctrlval = parse_cbm, .format_str = "%d=%0*x", @@ -83,9 +80,6 @@ .rid = RDT_RESOURCE_L2, .name = "L2", .cache_level = 2, - .cache = { - .min_cbm_bits = 1, - }, .domains = domain_init(RDT_RESOURCE_L2), .parse_ctrlval = parse_cbm, .format_str = "%d=%0*x", @@ -877,6 +871,7 @@ r->cache.arch_has_sparse_bitmaps = false; r->cache.arch_has_empty_bitmaps = false; r->cache.arch_has_per_cpu_cfg = false; + r->cache.min_cbm_bits = 1; } else if (r->rid == RDT_RESOURCE_MBA) { hw_res->msr_base = MSR_IA32_MBA_THRTL_BASE; hw_res->msr_update = mba_wrmsr_intel; @@ -897,6 +892,7 @@ r->cache.arch_has_sparse_bitmaps = true; r->cache.arch_has_empty_bitmaps = true; r->cache.arch_has_per_cpu_cfg = true; + r->cache.min_cbm_bits = 0; } else if (r->rid == RDT_RESOURCE_MBA) { hw_res->msr_base = MSR_IA32_MBA_BW_BASE; hw_res->msr_update = mba_wrmsr_amd; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/x86/kernel/cpu/topology.c +++ linux-kvm-5.19.0/arch/x86/kernel/cpu/topology.c @@ -96,6 +96,7 @@ unsigned int ht_mask_width, core_plus_mask_width, die_plus_mask_width; unsigned int core_select_mask, core_level_siblings; unsigned int die_select_mask, die_level_siblings; + unsigned int pkg_mask_width; bool die_level_present = false; int leaf; @@ -111,10 +112,10 @@ core_level_siblings = smp_num_siblings = LEVEL_MAX_SIBLINGS(ebx); core_plus_mask_width = ht_mask_width = BITS_SHIFT_NEXT_LEVEL(eax); die_level_siblings = LEVEL_MAX_SIBLINGS(ebx); - die_plus_mask_width = BITS_SHIFT_NEXT_LEVEL(eax); + pkg_mask_width = die_plus_mask_width = BITS_SHIFT_NEXT_LEVEL(eax); sub_index = 1; - do { + while (true) { cpuid_count(leaf, sub_index, &eax, &ebx, &ecx, &edx); /* @@ -132,10 +133,15 @@ die_plus_mask_width = BITS_SHIFT_NEXT_LEVEL(eax); } + if (LEAFB_SUBTYPE(ecx) != INVALID_TYPE) + pkg_mask_width = BITS_SHIFT_NEXT_LEVEL(eax); + else + break; + sub_index++; - } while (LEAFB_SUBTYPE(ecx) != INVALID_TYPE); + } - core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width; + core_select_mask = (~(-1 << pkg_mask_width)) >> ht_mask_width; die_select_mask = (~(-1 << die_plus_mask_width)) >> core_plus_mask_width; @@ -148,7 +154,7 @@ } c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, - die_plus_mask_width); + pkg_mask_width); /* * Reinit the apicid, now that we have extended initial_apicid. */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/x86/kernel/fpu/init.c +++ linux-kvm-5.19.0/arch/x86/kernel/fpu/init.c @@ -210,13 +210,6 @@ fpstate_reset(¤t->thread.fpu); } -static void __init fpu__init_init_fpstate(void) -{ - /* Bring init_fpstate size and features up to date */ - init_fpstate.size = fpu_kernel_cfg.max_size; - init_fpstate.xfeatures = fpu_kernel_cfg.max_features; -} - /* * Called on the boot CPU once per system bootup, to set up the initial * FPU state that is later cloned into all processes: @@ -236,5 +229,4 @@ fpu__init_system_xstate_size_legacy(); fpu__init_system_xstate(fpu_kernel_cfg.max_size); fpu__init_task_struct_size(); - fpu__init_init_fpstate(); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/x86/kernel/fpu/xstate.c +++ linux-kvm-5.19.0/arch/x86/kernel/fpu/xstate.c @@ -360,7 +360,7 @@ print_xstate_features(); - xstate_init_xcomp_bv(&init_fpstate.regs.xsave, fpu_kernel_cfg.max_features); + xstate_init_xcomp_bv(&init_fpstate.regs.xsave, init_fpstate.xfeatures); /* * Init all the features state with header.xfeatures being 0x0 @@ -678,20 +678,6 @@ return ebx; } -/* - * Will the runtime-enumerated 'xstate_size' fit in the init - * task's statically-allocated buffer? - */ -static bool __init is_supported_xstate_size(unsigned int test_xstate_size) -{ - if (test_xstate_size <= sizeof(init_fpstate.regs)) - return true; - - pr_warn("x86/fpu: xstate buffer too small (%zu < %d), disabling xsave\n", - sizeof(init_fpstate.regs), test_xstate_size); - return false; -} - static int __init init_xstate_size(void) { /* Recompute the context size for enabled features: */ @@ -717,10 +703,6 @@ kernel_default_size = xstate_calculate_size(fpu_kernel_cfg.default_features, compacted); - /* Ensure we have the space to store all default enabled features. */ - if (!is_supported_xstate_size(kernel_default_size)) - return -EINVAL; - if (!paranoid_xstate_size_valid(kernel_size)) return -EINVAL; @@ -875,6 +857,19 @@ update_regset_xstate_info(fpu_user_cfg.max_size, fpu_user_cfg.max_features); + /* + * init_fpstate excludes dynamic states as they are large but init + * state is zero. + */ + init_fpstate.size = fpu_kernel_cfg.default_size; + init_fpstate.xfeatures = fpu_kernel_cfg.default_features; + + if (init_fpstate.size > sizeof(init_fpstate.regs)) { + pr_warn("x86/fpu: init_fpstate buffer too small (%zu < %d), disabling XSAVE\n", + sizeof(init_fpstate.regs), init_fpstate.size); + goto out_disable; + } + setup_init_fpu_buf(); /* @@ -1130,6 +1125,15 @@ */ mask = fpstate->user_xfeatures; + /* + * Dynamic features are not present in init_fpstate. When they are + * in an all zeros init state, remove those from 'mask' to zero + * those features in the user buffer instead of retrieving them + * from init_fpstate. + */ + if (fpu_state_size_dynamic()) + mask &= (header.xfeatures | xinit->header.xcomp_bv); + for_each_extended_xfeature(i, mask) { /* * If there was a feature or alignment gap, zero the space only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/x86/kvm/trace.h +++ linux-kvm-5.19.0/arch/x86/kvm/trace.h @@ -358,25 +358,29 @@ * Tracepoint for kvm interrupt injection: */ TRACE_EVENT(kvm_inj_exception, - TP_PROTO(unsigned exception, bool has_error, unsigned error_code), - TP_ARGS(exception, has_error, error_code), + TP_PROTO(unsigned exception, bool has_error, unsigned error_code, + bool reinjected), + TP_ARGS(exception, has_error, error_code, reinjected), TP_STRUCT__entry( __field( u8, exception ) __field( u8, has_error ) __field( u32, error_code ) + __field( bool, reinjected ) ), TP_fast_assign( __entry->exception = exception; __entry->has_error = has_error; __entry->error_code = error_code; + __entry->reinjected = reinjected; ), - TP_printk("%s (0x%x)", + TP_printk("%s (0x%x)%s", __print_symbolic(__entry->exception, kvm_trace_sym_exc), /* FIXME: don't print error_code if not present */ - __entry->has_error ? __entry->error_code : 0) + __entry->has_error ? __entry->error_code : 0, + __entry->reinjected ? " [reinjected]" : "") ); /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/arch/x86/kvm/vmx/capabilities.h +++ linux-kvm-5.19.0/arch/x86/kvm/vmx/capabilities.h @@ -21,8 +21,6 @@ #define PMU_CAP_FW_WRITES (1ULL << 13) #define PMU_CAP_LBR_FMT 0x3f -#define DEBUGCTLMSR_LBR_MASK (DEBUGCTLMSR_LBR | DEBUGCTLMSR_FREEZE_LBRS_ON_PMI) - struct nested_vmx_msrs { /* * We only store the "true" versions of the VMX capability MSRs. We @@ -404,17 +402,4 @@ return PMU_CAP_FW_WRITES | perf_cap; } -static inline u64 vmx_supported_debugctl(void) -{ - u64 debugctl = 0; - - if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT)) - debugctl |= DEBUGCTLMSR_BUS_LOCK_DETECT; - - if (vmx_get_perf_capabilities() & PMU_CAP_LBR_FMT) - debugctl |= DEBUGCTLMSR_LBR_MASK; - - return debugctl; -} - #endif /* __KVM_X86_VMX_CAPS_H */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/acpi/acpi_extlog.c +++ linux-kvm-5.19.0/drivers/acpi/acpi_extlog.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -138,8 +139,8 @@ int cpu = mce->extcpu; struct acpi_hest_generic_status *estatus, *tmp; struct acpi_hest_generic_data *gdata; - const guid_t *fru_id = &guid_null; - char *fru_text = ""; + const guid_t *fru_id; + char *fru_text; guid_t *sec_type; static u32 err_seq; @@ -160,17 +161,23 @@ /* log event via trace */ err_seq++; - gdata = (struct acpi_hest_generic_data *)(tmp + 1); - if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID) - fru_id = (guid_t *)gdata->fru_id; - if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT) - fru_text = gdata->fru_text; - sec_type = (guid_t *)gdata->section_type; - if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { - struct cper_sec_mem_err *mem = (void *)(gdata + 1); - if (gdata->error_data_length >= sizeof(*mem)) - trace_extlog_mem_event(mem, err_seq, fru_id, fru_text, - (u8)gdata->error_severity); + apei_estatus_for_each_section(tmp, gdata) { + if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID) + fru_id = (guid_t *)gdata->fru_id; + else + fru_id = &guid_null; + if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT) + fru_text = gdata->fru_text; + else + fru_text = ""; + sec_type = (guid_t *)gdata->section_type; + if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { + struct cper_sec_mem_err *mem = (void *)(gdata + 1); + + if (gdata->error_data_length >= sizeof(*mem)) + trace_extlog_mem_event(mem, err_seq, fru_id, fru_text, + (u8)gdata->error_severity); + } } out: only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/acpi/numa/srat.c +++ linux-kvm-5.19.0/drivers/acpi/numa/srat.c @@ -327,6 +327,7 @@ pr_warn("ACPI NUMA: Failed to add memblk for CFMWS node %d [mem %#llx-%#llx]\n", node, start, end); } + node_set(node, numa_nodes_parsed); /* Set the next available fake_pxm value */ (*fake_pxm)++; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/ata/ahci.h +++ linux-kvm-5.19.0/drivers/ata/ahci.h @@ -252,7 +252,7 @@ PCS_7 = 0x94, /* 7+ port PCS (Denverton) */ /* em constants */ - EM_MAX_SLOTS = 8, + EM_MAX_SLOTS = SATA_PMP_MAX_PORTS, EM_MAX_RETRY = 5, /* em_ctl bits */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/ata/ahci_imx.c +++ linux-kvm-5.19.0/drivers/ata/ahci_imx.c @@ -1230,4 +1230,4 @@ MODULE_DESCRIPTION("Freescale i.MX AHCI SATA platform driver"); MODULE_AUTHOR("Richard Zhu "); MODULE_LICENSE("GPL"); -MODULE_ALIAS("ahci:imx"); +MODULE_ALIAS("platform:" DRV_NAME); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/ata/pata_legacy.c +++ linux-kvm-5.19.0/drivers/ata/pata_legacy.c @@ -315,9 +315,10 @@ outb(inb(0x1F4) & 0x07, 0x1F4); rt = inb(0x1F3); - rt &= 0x07 << (3 * adev->devno); + rt &= ~(0x07 << (3 * !adev->devno)); if (pio) - rt |= (1 + 3 * pio) << (3 * adev->devno); + rt |= (1 + 3 * pio) << (3 * !adev->devno); + outb(rt, 0x1F3); udelay(100); outb(inb(0x1F2) | 0x01, 0x1F2); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/ata/pata_palmld.c +++ linux-kvm-5.19.0/drivers/ata/pata_palmld.c @@ -63,8 +63,8 @@ /* remap drive's physical memory address */ mem = devm_platform_ioremap_resource(pdev, 0); - if (!mem) - return -ENOMEM; + if (IS_ERR(mem)) + return PTR_ERR(mem); /* request and activate power and reset GPIOs */ lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/block/drbd/drbd_req.c +++ linux-kvm-5.19.0/drivers/block/drbd/drbd_req.c @@ -30,11 +30,6 @@ return NULL; memset(req, 0, sizeof(*req)); - req->private_bio = bio_alloc_clone(device->ldev->backing_bdev, bio_src, - GFP_NOIO, &drbd_io_bio_set); - req->private_bio->bi_private = req; - req->private_bio->bi_end_io = drbd_request_endio; - req->rq_state = (bio_data_dir(bio_src) == WRITE ? RQ_WRITE : 0) | (bio_op(bio_src) == REQ_OP_WRITE_ZEROES ? RQ_ZEROES : 0) | (bio_op(bio_src) == REQ_OP_DISCARD ? RQ_UNMAP : 0); @@ -1221,9 +1216,12 @@ /* Update disk stats */ req->start_jif = bio_start_io_acct(req->master_bio); - if (!get_ldev(device)) { - bio_put(req->private_bio); - req->private_bio = NULL; + if (get_ldev(device)) { + req->private_bio = bio_alloc_clone(device->ldev->backing_bdev, + bio, GFP_NOIO, + &drbd_io_bio_set); + req->private_bio->bi_private = req; + req->private_bio->bi_end_io = drbd_request_endio; } /* process discards always from our submitter thread */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/bluetooth/virtio_bt.c +++ linux-kvm-5.19.0/drivers/bluetooth/virtio_bt.c @@ -219,7 +219,7 @@ if (!skb) return; - skb->len = len; + skb_put(skb, len); virtbt_rx_handle(vbt, skb); if (virtbt_add_inbuf(vbt) < 0) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/char/hw_random/bcm2835-rng.c +++ linux-kvm-5.19.0/drivers/char/hw_random/bcm2835-rng.c @@ -71,7 +71,7 @@ while ((rng_readl(priv, RNG_STATUS) >> 24) == 0) { if (!wait) return 0; - cpu_relax(); + hwrng_msleep(rng, 1000); } num_words = rng_readl(priv, RNG_STATUS) >> 24; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/clk/clk-renesas-pcie.c +++ linux-kvm-5.19.0/drivers/clk/clk-renesas-pcie.c @@ -90,13 +90,66 @@ .n_yes_ranges = ARRAY_SIZE(rs9_writeable_ranges), }; +static int rs9_regmap_i2c_write(void *context, + unsigned int reg, unsigned int val) +{ + struct i2c_client *i2c = context; + const u8 data[3] = { reg, 1, val }; + const int count = ARRAY_SIZE(data); + int ret; + + ret = i2c_master_send(i2c, data, count); + if (ret == count) + return 0; + else if (ret < 0) + return ret; + else + return -EIO; +} + +static int rs9_regmap_i2c_read(void *context, + unsigned int reg, unsigned int *val) +{ + struct i2c_client *i2c = context; + struct i2c_msg xfer[2]; + u8 txdata = reg; + u8 rxdata[2]; + int ret; + + xfer[0].addr = i2c->addr; + xfer[0].flags = 0; + xfer[0].len = 1; + xfer[0].buf = (void *)&txdata; + + xfer[1].addr = i2c->addr; + xfer[1].flags = I2C_M_RD; + xfer[1].len = 2; + xfer[1].buf = (void *)rxdata; + + ret = i2c_transfer(i2c->adapter, xfer, 2); + if (ret < 0) + return ret; + if (ret != 2) + return -EIO; + + /* + * Byte 0 is transfer length, which is always 1 due + * to BCP register programming to 1 in rs9_probe(), + * ignore it and use data from Byte 1. + */ + *val = rxdata[1]; + return 0; +} + static const struct regmap_config rs9_regmap_config = { .reg_bits = 8, .val_bits = 8, - .cache_type = REGCACHE_FLAT, - .max_register = 0x8, + .cache_type = REGCACHE_NONE, + .max_register = RS9_REG_BCP, .rd_table = &rs9_readable_table, .wr_table = &rs9_writeable_table, + .reg_write = rs9_regmap_i2c_write, + .reg_read = rs9_regmap_i2c_read, }; static int rs9_get_output_config(struct rs9_driver_data *rs9, int idx) @@ -242,11 +295,17 @@ return ret; } - rs9->regmap = devm_regmap_init_i2c(client, &rs9_regmap_config); + rs9->regmap = devm_regmap_init(&client->dev, NULL, + client, &rs9_regmap_config); if (IS_ERR(rs9->regmap)) return dev_err_probe(&client->dev, PTR_ERR(rs9->regmap), "Failed to allocate register map\n"); + /* Always read back 1 Byte via I2C */ + ret = regmap_write(rs9->regmap, RS9_REG_BCP, 1); + if (ret < 0) + return ret; + /* Register clock */ for (i = 0; i < rs9->chip_info->num_clks; i++) { snprintf(name, 5, "DIF%d", i); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/clk/imx/clk-imx8mp.c +++ linux-kvm-5.19.0/drivers/clk/imx/clk-imx8mp.c @@ -665,8 +665,8 @@ hws[IMX8MP_CLK_CAN1_ROOT] = imx_clk_hw_gate2("can1_root_clk", "can1", ccm_base + 0x4350, 0); hws[IMX8MP_CLK_CAN2_ROOT] = imx_clk_hw_gate2("can2_root_clk", "can2", ccm_base + 0x4360, 0); hws[IMX8MP_CLK_SDMA1_ROOT] = imx_clk_hw_gate4("sdma1_root_clk", "ipg_root", ccm_base + 0x43a0, 0); - hws[IMX8MP_CLK_ENET_QOS_ROOT] = imx_clk_hw_gate4("enet_qos_root_clk", "sim_enet_root_clk", ccm_base + 0x43b0, 0); hws[IMX8MP_CLK_SIM_ENET_ROOT] = imx_clk_hw_gate4("sim_enet_root_clk", "enet_axi", ccm_base + 0x4400, 0); + hws[IMX8MP_CLK_ENET_QOS_ROOT] = imx_clk_hw_gate4("enet_qos_root_clk", "sim_enet_root_clk", ccm_base + 0x43b0, 0); hws[IMX8MP_CLK_GPU2D_ROOT] = imx_clk_hw_gate4("gpu2d_root_clk", "gpu2d_core", ccm_base + 0x4450, 0); hws[IMX8MP_CLK_GPU3D_ROOT] = imx_clk_hw_gate4("gpu3d_root_clk", "gpu3d_core", ccm_base + 0x4460, 0); hws[IMX8MP_CLK_UART1_ROOT] = imx_clk_hw_gate4("uart1_root_clk", "uart1", ccm_base + 0x4490, 0); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/clk/qcom/gcc-sc7280.c +++ linux-kvm-5.19.0/drivers/clk/qcom/gcc-sc7280.c @@ -3486,6 +3486,7 @@ regmap_update_bits(regmap, 0x28004, BIT(0), BIT(0)); regmap_update_bits(regmap, 0x28014, BIT(0), BIT(0)); regmap_update_bits(regmap, 0x71004, BIT(0), BIT(0)); + regmap_update_bits(regmap, 0x7100C, BIT(13), BIT(13)); ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks, ARRAY_SIZE(gcc_dfs_clocks)); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/clk/qcom/gpucc-sc7280.c +++ linux-kvm-5.19.0/drivers/clk/qcom/gpucc-sc7280.c @@ -463,6 +463,7 @@ */ regmap_update_bits(regmap, 0x1170, BIT(0), BIT(0)); regmap_update_bits(regmap, 0x1098, BIT(0), BIT(0)); + regmap_update_bits(regmap, 0x1098, BIT(13), BIT(13)); return qcom_cc_really_probe(pdev, &gpu_cc_sc7280_desc, regmap); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/clk/renesas/r8a779g0-cpg-mssr.c +++ linux-kvm-5.19.0/drivers/clk/renesas/r8a779g0-cpg-mssr.c @@ -47,6 +47,7 @@ CLK_S0_VIO, CLK_S0_VC, CLK_S0_HSC, + CLK_SASYNCPER, CLK_SV_VIP, CLK_SV_IR, CLK_SDSRC, @@ -84,6 +85,7 @@ DEF_FIXED(".s0_vio", CLK_S0_VIO, CLK_PLL1_DIV2, 2, 1), DEF_FIXED(".s0_vc", CLK_S0_VC, CLK_PLL1_DIV2, 2, 1), DEF_FIXED(".s0_hsc", CLK_S0_HSC, CLK_PLL1_DIV2, 2, 1), + DEF_FIXED(".sasyncper", CLK_SASYNCPER, CLK_PLL5_DIV4, 3, 1), DEF_FIXED(".sv_vip", CLK_SV_VIP, CLK_PLL1, 5, 1), DEF_FIXED(".sv_ir", CLK_SV_IR, CLK_PLL1, 5, 1), DEF_BASE(".sdsrc", CLK_SDSRC, CLK_TYPE_GEN4_SDSRC, CLK_PLL5), @@ -128,6 +130,9 @@ DEF_FIXED("s0d4_hsc", R8A779G0_CLK_S0D4_HSC, CLK_S0_HSC, 4, 1), DEF_FIXED("cl16m_hsc", R8A779G0_CLK_CL16M_HSC, CLK_S0_HSC, 48, 1), DEF_FIXED("s0d2_cc", R8A779G0_CLK_S0D2_CC, CLK_S0, 2, 1), + DEF_FIXED("sasyncperd1",R8A779G0_CLK_SASYNCPERD1, CLK_SASYNCPER,1, 1), + DEF_FIXED("sasyncperd2",R8A779G0_CLK_SASYNCPERD2, CLK_SASYNCPER,2, 1), + DEF_FIXED("sasyncperd4",R8A779G0_CLK_SASYNCPERD4, CLK_SASYNCPER,4, 1), DEF_FIXED("svd1_ir", R8A779G0_CLK_SVD1_IR, CLK_SV_IR, 1, 1), DEF_FIXED("svd2_ir", R8A779G0_CLK_SVD2_IR, CLK_SV_IR, 2, 1), DEF_FIXED("svd1_vip", R8A779G0_CLK_SVD1_VIP, CLK_SV_VIP, 1, 1), @@ -150,10 +155,10 @@ }; static const struct mssr_mod_clk r8a779g0_mod_clks[] __initconst = { - DEF_MOD("hscif0", 514, R8A779G0_CLK_S0D3_PER), - DEF_MOD("hscif1", 515, R8A779G0_CLK_S0D3_PER), - DEF_MOD("hscif2", 516, R8A779G0_CLK_S0D3_PER), - DEF_MOD("hscif3", 517, R8A779G0_CLK_S0D3_PER), + DEF_MOD("hscif0", 514, R8A779G0_CLK_SASYNCPERD1), + DEF_MOD("hscif1", 515, R8A779G0_CLK_SASYNCPERD1), + DEF_MOD("hscif2", 516, R8A779G0_CLK_SASYNCPERD1), + DEF_MOD("hscif3", 517, R8A779G0_CLK_SASYNCPERD1), }; /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/clk/tegra/clk-tegra124.c +++ linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra124.c @@ -1330,6 +1330,7 @@ { TEGRA124_CLK_I2S3_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, { TEGRA124_CLK_I2S4_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, { TEGRA124_CLK_VIMCLK_SYNC, TEGRA124_CLK_CLK_MAX, 24576000, 0 }, + { TEGRA124_CLK_PWM, TEGRA124_CLK_PLL_P, 408000000, 0 }, /* must be the last entry */ { TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0 }, }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/clk/tegra/clk-tegra30.c +++ linux-kvm-5.19.0/drivers/clk/tegra/clk-tegra30.c @@ -1237,6 +1237,7 @@ { TEGRA30_CLK_VIMCLK_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, { TEGRA30_CLK_HDA, TEGRA30_CLK_PLL_P, 102000000, 0 }, { TEGRA30_CLK_HDA2CODEC_2X, TEGRA30_CLK_PLL_P, 48000000, 0 }, + { TEGRA30_CLK_PWM, TEGRA30_CLK_PLL_P, 48000000, 0 }, /* must be the last entry */ { TEGRA30_CLK_CLK_MAX, TEGRA30_CLK_CLK_MAX, 0, 0 }, }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/counter/microchip-tcb-capture.c +++ linux-kvm-5.19.0/drivers/counter/microchip-tcb-capture.c @@ -28,7 +28,6 @@ int qdec_mode; int num_channels; int channel[2]; - bool trig_inverted; }; static const enum counter_function mchp_tc_count_functions[] = { @@ -153,7 +152,7 @@ regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], SR), &sr); - if (priv->trig_inverted) + if (signal->id == 1) sigstatus = (sr & ATMEL_TC_MTIOB); else sigstatus = (sr & ATMEL_TC_MTIOA); @@ -171,6 +170,17 @@ struct mchp_tc_data *const priv = counter_priv(counter); u32 cmr; + if (priv->qdec_mode) { + *action = COUNTER_SYNAPSE_ACTION_BOTH_EDGES; + return 0; + } + + /* Only TIOA signal is evaluated in non-QDEC mode */ + if (synapse->signal->id != 0) { + *action = COUNTER_SYNAPSE_ACTION_NONE; + return 0; + } + regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], CMR), &cmr); switch (cmr & ATMEL_TC_ETRGEDG) { @@ -199,8 +209,8 @@ struct mchp_tc_data *const priv = counter_priv(counter); u32 edge = ATMEL_TC_ETRGEDG_NONE; - /* QDEC mode is rising edge only */ - if (priv->qdec_mode) + /* QDEC mode is rising edge only; only TIOA handled in non-QDEC mode */ + if (priv->qdec_mode || synapse->signal->id != 0) return -EINVAL; switch (action) { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/cpufreq/Kconfig.x86 +++ linux-kvm-5.19.0/drivers/cpufreq/Kconfig.x86 @@ -35,7 +35,7 @@ If in doubt, say N. config X86_AMD_PSTATE - tristate "AMD Processor P-State driver" + bool "AMD Processor P-State driver" depends on X86 && ACPI select ACPI_PROCESSOR select ACPI_CPPC_LIB if X86_64 only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ linux-kvm-5.19.0/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -215,6 +215,7 @@ int speed = 0, pvs = 0, pvs_ver = 0; u8 *speedbin; size_t len; + int ret = 0; speedbin = nvmem_cell_read(speedbin_nvmem, &len); @@ -232,7 +233,8 @@ break; default: dev_err(cpu_dev, "Unable to read nvmem data. Defaulting to 0!\n"); - return -ENODEV; + ret = -ENODEV; + goto len_error; } snprintf(*pvs_name, sizeof("speedXX-pvsXX-vXX"), "speed%d-pvs%d-v%d", @@ -240,8 +242,9 @@ drv->versions = (1 << speed); +len_error: kfree(speedbin); - return 0; + return ret; } static const struct qcom_cpufreq_match_data match_data_kryo = { @@ -264,7 +267,8 @@ struct nvmem_cell *speedbin_nvmem; struct device_node *np; struct device *cpu_dev; - char *pvs_name = "speedXX-pvsXX-vXX"; + char pvs_name_buffer[] = "speedXX-pvsXX-vXX"; + char *pvs_name = pvs_name_buffer; unsigned cpu; const struct of_device_id *match; int ret; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/cpufreq/tegra194-cpufreq.c +++ linux-kvm-5.19.0/drivers/cpufreq/tegra194-cpufreq.c @@ -592,6 +592,7 @@ { .compatible = "nvidia,tegra234-ccplex-cluster", .data = &tegra234_cpufreq_soc }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, tegra194_cpufreq_of_match); static struct platform_driver tegra194_ccplex_driver = { .driver = { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/firmware/arm_scmi/driver.c +++ linux-kvm-5.19.0/drivers/firmware/arm_scmi/driver.c @@ -1814,8 +1814,12 @@ { int ret = scmi_chan_setup(info, dev, prot_id, true); - if (!ret) /* Rx is optional, hence no error check */ - scmi_chan_setup(info, dev, prot_id, false); + if (!ret) { + /* Rx is optional, report only memory errors */ + ret = scmi_chan_setup(info, dev, prot_id, false); + if (ret && ret != -ENOMEM) + ret = 0; + } return ret; } @@ -2322,6 +2326,7 @@ static struct platform_driver scmi_driver = { .driver = { .name = "arm-scmi", + .suppress_bind_attrs = true, .of_match_table = scmi_of_match, .dev_groups = versions_groups, }, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/firmware/arm_scmi/virtio.c +++ linux-kvm-5.19.0/drivers/firmware/arm_scmi/virtio.c @@ -148,7 +148,6 @@ { unsigned long flags; DECLARE_COMPLETION_ONSTACK(vioch_shutdown_done); - void *deferred_wq = NULL; /* * Prepare to wait for the last release if not already released @@ -162,16 +161,11 @@ vioch->shutdown_done = &vioch_shutdown_done; virtio_break_device(vioch->vqueue->vdev); - if (!vioch->is_rx && vioch->deferred_tx_wq) { - deferred_wq = vioch->deferred_tx_wq; + if (!vioch->is_rx && vioch->deferred_tx_wq) /* Cannot be kicked anymore after this...*/ vioch->deferred_tx_wq = NULL; - } spin_unlock_irqrestore(&vioch->lock, flags); - if (deferred_wq) - destroy_workqueue(deferred_wq); - scmi_vio_channel_release(vioch); /* Let any possibly concurrent RX path release the channel */ @@ -416,6 +410,11 @@ return vioch && !vioch->cinfo; } +static void scmi_destroy_tx_workqueue(void *deferred_tx_wq) +{ + destroy_workqueue(deferred_tx_wq); +} + static int virtio_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, bool tx) { @@ -430,6 +429,8 @@ /* Setup a deferred worker for polling. */ if (tx && !vioch->deferred_tx_wq) { + int ret; + vioch->deferred_tx_wq = alloc_workqueue(dev_name(&scmi_vdev->dev), WQ_UNBOUND | WQ_FREEZABLE | WQ_SYSFS, @@ -437,6 +438,11 @@ if (!vioch->deferred_tx_wq) return -ENOMEM; + ret = devm_add_action_or_reset(dev, scmi_destroy_tx_workqueue, + vioch->deferred_tx_wq); + if (ret) + return ret; + INIT_WORK(&vioch->deferred_tx_work, scmi_vio_deferred_tx_worker); } @@ -444,12 +450,12 @@ for (i = 0; i < vioch->max_msg; i++) { struct scmi_vio_msg *msg; - msg = devm_kzalloc(cinfo->dev, sizeof(*msg), GFP_KERNEL); + msg = devm_kzalloc(dev, sizeof(*msg), GFP_KERNEL); if (!msg) return -ENOMEM; if (tx) { - msg->request = devm_kzalloc(cinfo->dev, + msg->request = devm_kzalloc(dev, VIRTIO_SCMI_MAX_PDU_SIZE, GFP_KERNEL); if (!msg->request) @@ -458,7 +464,7 @@ refcount_set(&msg->users, 1); } - msg->input = devm_kzalloc(cinfo->dev, VIRTIO_SCMI_MAX_PDU_SIZE, + msg->input = devm_kzalloc(dev, VIRTIO_SCMI_MAX_PDU_SIZE, GFP_KERNEL); if (!msg->input) return -ENOMEM; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/firmware/efi/libstub/random.c +++ linux-kvm-5.19.0/drivers/firmware/efi/libstub/random.c @@ -75,7 +75,12 @@ if (status != EFI_SUCCESS) return status; - status = efi_bs_call(allocate_pool, EFI_RUNTIME_SERVICES_DATA, + /* + * Use EFI_ACPI_RECLAIM_MEMORY here so that it is guaranteed that the + * allocation will survive a kexec reboot (although we refresh the seed + * beforehand) + */ + status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY, sizeof(*seed) + EFI_RANDOM_SEED_SIZE, (void **)&seed); if (status != EFI_SUCCESS) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/firmware/efi/tpm.c +++ linux-kvm-5.19.0/drivers/firmware/efi/tpm.c @@ -97,7 +97,7 @@ goto out_calc; } - memblock_reserve((unsigned long)final_tbl, + memblock_reserve(efi.tpm_final_log, tbl_size + sizeof(*final_tbl)); efi_tpm_final_log_size = tbl_size; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/fpga/dfl-pci.c +++ linux-kvm-5.19.0/drivers/fpga/dfl-pci.c @@ -77,12 +77,18 @@ #define PCIE_DEVICE_ID_INTEL_PAC_D5005 0x0B2B #define PCIE_DEVICE_ID_SILICOM_PAC_N5010 0x1000 #define PCIE_DEVICE_ID_SILICOM_PAC_N5011 0x1001 +#define PCIE_DEVICE_ID_INTEL_DFL 0xbcce +/* PCI Subdevice ID for PCIE_DEVICE_ID_INTEL_DFL */ +#define PCIE_SUBDEVICE_ID_INTEL_N6000 0x1770 +#define PCIE_SUBDEVICE_ID_INTEL_N6001 0x1771 +#define PCIE_SUBDEVICE_ID_INTEL_C6100 0x17d4 /* VF Device */ #define PCIE_DEVICE_ID_VF_INT_5_X 0xBCBF #define PCIE_DEVICE_ID_VF_INT_6_X 0xBCC1 #define PCIE_DEVICE_ID_VF_DSC_1_X 0x09C5 #define PCIE_DEVICE_ID_INTEL_PAC_D5005_VF 0x0B2C +#define PCIE_DEVICE_ID_INTEL_DFL_VF 0xbccf static struct pci_device_id cci_pcie_id_tbl[] = { {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_PF_INT_5_X),}, @@ -96,6 +102,18 @@ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_PAC_D5005_VF),}, {PCI_DEVICE(PCI_VENDOR_ID_SILICOM_DENMARK, PCIE_DEVICE_ID_SILICOM_PAC_N5010),}, {PCI_DEVICE(PCI_VENDOR_ID_SILICOM_DENMARK, PCIE_DEVICE_ID_SILICOM_PAC_N5011),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6000),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL_VF, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6000),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6001),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL_VF, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_N6001),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_C6100),}, + {PCI_DEVICE_SUB(PCI_VENDOR_ID_INTEL, PCIE_DEVICE_ID_INTEL_DFL_VF, + PCI_VENDOR_ID_INTEL, PCIE_SUBDEVICE_ID_INTEL_C6100),}, {0,} }; MODULE_DEVICE_TABLE(pci, cci_pcie_id_tbl); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/fsi/fsi-master-ast-cf.c +++ linux-kvm-5.19.0/drivers/fsi/fsi-master-ast-cf.c @@ -1324,12 +1324,14 @@ } master->cvic = devm_of_iomap(&pdev->dev, np, 0, NULL); if (IS_ERR(master->cvic)) { + of_node_put(np); rc = PTR_ERR(master->cvic); dev_err(&pdev->dev, "Error %d mapping CVIC\n", rc); goto err_free; } rc = of_property_read_u32(np, "copro-sw-interrupts", &master->cvic_sw_irq); + of_node_put(np); if (rc) { dev_err(&pdev->dev, "Can't find coprocessor SW interrupt\n"); goto err_free; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/Kconfig +++ linux-kvm-5.19.0/drivers/gpu/drm/Kconfig @@ -31,6 +31,7 @@ config DRM_MIPI_DBI tristate depends on DRM + select DRM_KMS_HELPER config DRM_MIPI_DSI bool only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c @@ -681,6 +681,13 @@ void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle) { + /* Temporary workaround to fix issues observed in some + * compute applications when GFXOFF is enabled on GFX11. + */ + if (IP_VERSION_MAJ(adev->ip_versions[GC_HWIP][0]) == 11) { + pr_debug("GFXOFF is %s\n", idle ? "enabled" : "disabled"); + amdgpu_gfx_off_ctrl(adev, idle); + } amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_COMPUTE, !idle); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c @@ -111,7 +111,7 @@ lock_srbm(adev, mec, pipe, 0, 0); - WREG32(SOC15_REG_OFFSET(GC, 0, regCPC_INT_CNTL), + WREG32_SOC15(GC, 0, regCPC_INT_CNTL, CP_INT_CNTL_RING0__TIME_STAMP_INT_ENABLE_MASK | CP_INT_CNTL_RING0__OPCODE_ERROR_INT_ENABLE_MASK); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -460,13 +460,13 @@ struct ttm_tt *ttm = bo->tbo.ttm; int ret; + if (WARN_ON(ttm->num_pages != src_ttm->num_pages)) + return -EINVAL; + ttm->sg = kmalloc(sizeof(*ttm->sg), GFP_KERNEL); if (unlikely(!ttm->sg)) return -ENOMEM; - if (WARN_ON(ttm->num_pages != src_ttm->num_pages)) - return -EINVAL; - /* Same sequence as in amdgpu_ttm_tt_pin_userptr */ ret = sg_alloc_table_from_pages(ttm->sg, src_ttm->pages, ttm->num_pages, 0, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -424,8 +424,9 @@ static bool amdgpu_mem_visible(struct amdgpu_device *adev, struct ttm_resource *mem) { - uint64_t mem_size = (u64)mem->num_pages << PAGE_SHIFT; + u64 mem_size = (u64)mem->num_pages << PAGE_SHIFT; struct amdgpu_res_cursor cursor; + u64 end; if (mem->mem_type == TTM_PL_SYSTEM || mem->mem_type == TTM_PL_TT) @@ -434,12 +435,18 @@ return false; amdgpu_res_first(mem, 0, mem_size, &cursor); + end = cursor.start + cursor.size; + while (cursor.remaining) { + amdgpu_res_next(&cursor, cursor.size); - /* ttm_resource_ioremap only supports contiguous memory */ - if (cursor.size != mem_size) - return false; + /* ttm_resource_ioremap only supports contiguous memory */ + if (end != cursor.start) + return false; + + end = cursor.start + cursor.size; + } - return cursor.start + cursor.size <= adev->gmc.visible_vram_size; + return end <= adev->gmc.visible_vram_size; } /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c @@ -720,6 +720,12 @@ adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE; } + if (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_SIENNA_CICHLID) + /* VF MMIO access (except mailbox range) from CPU + * will be blocked during sriov runtime + */ + adev->virt.caps |= AMDGPU_VF_MMIO_ACCESS_PROTECT; + /* we have the ability to check now */ if (amdgpu_sriov_vf(adev)) { switch (adev->asic_type) { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h @@ -31,6 +31,7 @@ #define AMDGPU_SRIOV_CAPS_IS_VF (1 << 2) /* this GPU is a virtual function */ #define AMDGPU_PASSTHROUGH_MODE (1 << 3) /* thw whole GPU is pass through for VM */ #define AMDGPU_SRIOV_CAPS_RUNTIME (1 << 4) /* is out of full access mode */ +#define AMDGPU_VF_MMIO_ACCESS_PROTECT (1 << 5) /* MMIO write access is not allowed in sriov runtime */ /* flags for indirect register access path supported by rlcg for sriov */ #define AMDGPU_RLCG_GC_WRITE_LEGACY (0x8 << 28) @@ -294,6 +295,9 @@ #define amdgpu_passthrough(adev) \ ((adev)->virt.caps & AMDGPU_PASSTHROUGH_MODE) +#define amdgpu_sriov_vf_mmio_access_protection(adev) \ +((adev)->virt.caps & AMDGPU_VF_MMIO_ACCESS_PROTECT) + static inline bool is_virtual_machine(void) { #if defined(CONFIG_X86) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -2293,7 +2293,11 @@ */ #ifdef CONFIG_X86_64 if (amdgpu_vm_update_mode == -1) { - if (amdgpu_gmc_vram_full_visible(&adev->gmc)) + /* For asic with VF MMIO access protection + * avoid using CPU for VM table updates + */ + if (amdgpu_gmc_vram_full_visible(&adev->gmc) && + !amdgpu_sriov_vf_mmio_access_protection(adev)) adev->vm_manager.vm_update_mode = AMDGPU_VM_USE_CPU_FOR_COMPUTE; else only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c @@ -181,6 +181,10 @@ /* Use register 17 for GART */ const unsigned eng = 17; unsigned int i; + unsigned char hub_ip = 0; + + hub_ip = (vmhub == AMDGPU_GFXHUB_0) ? + GC_HWIP : MMHUB_HWIP; spin_lock(&adev->gmc.invalidate_lock); /* @@ -194,8 +198,8 @@ if (use_semaphore) { for (i = 0; i < adev->usec_timeout; i++) { /* a read return value of 1 means semaphore acuqire */ - tmp = RREG32_NO_KIQ(hub->vm_inv_eng0_sem + - hub->eng_distance * eng); + tmp = RREG32_RLC_NO_KIQ(hub->vm_inv_eng0_sem + + hub->eng_distance * eng, hub_ip); if (tmp & 0x1) break; udelay(1); @@ -205,12 +209,12 @@ DRM_ERROR("Timeout waiting for sem acquire in VM flush!\n"); } - WREG32_NO_KIQ(hub->vm_inv_eng0_req + hub->eng_distance * eng, inv_req); + WREG32_RLC_NO_KIQ(hub->vm_inv_eng0_req + hub->eng_distance * eng, inv_req, hub_ip); /* Wait for ACK with a delay.*/ for (i = 0; i < adev->usec_timeout; i++) { - tmp = RREG32_NO_KIQ(hub->vm_inv_eng0_ack + - hub->eng_distance * eng); + tmp = RREG32_RLC_NO_KIQ(hub->vm_inv_eng0_ack + + hub->eng_distance * eng, hub_ip); tmp &= 1 << vmid; if (tmp) break; @@ -224,8 +228,8 @@ * add semaphore release after invalidation, * write with 0 means semaphore release */ - WREG32_NO_KIQ(hub->vm_inv_eng0_sem + - hub->eng_distance * eng, 0); + WREG32_RLC_NO_KIQ(hub->vm_inv_eng0_sem + + hub->eng_distance * eng, 0, hub_ip); /* Issue additional private vm invalidation to MMHUB */ if ((vmhub != AMDGPU_GFXHUB_0) && only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c @@ -32,8 +32,6 @@ #include "gc/gc_10_1_0_offset.h" #include "soc15_common.h" -#define mmMM_ATC_L2_MISC_CG_Sienna_Cichlid 0x064d -#define mmMM_ATC_L2_MISC_CG_Sienna_Cichlid_BASE_IDX 0 #define mmDAGB0_CNTL_MISC2_Sienna_Cichlid 0x0070 #define mmDAGB0_CNTL_MISC2_Sienna_Cichlid_BASE_IDX 0 @@ -574,7 +572,6 @@ case IP_VERSION(2, 1, 0): case IP_VERSION(2, 1, 1): case IP_VERSION(2, 1, 2): - def = data = RREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid); def1 = data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_Sienna_Cichlid); break; default: @@ -608,8 +605,6 @@ case IP_VERSION(2, 1, 0): case IP_VERSION(2, 1, 1): case IP_VERSION(2, 1, 2): - if (def != data) - WREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid, data); if (def1 != data1) WREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_Sienna_Cichlid, data1); break; @@ -634,8 +629,8 @@ case IP_VERSION(2, 1, 0): case IP_VERSION(2, 1, 1): case IP_VERSION(2, 1, 2): - def = data = RREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid); - break; + /* There is no ATCL2 in MMHUB for 2.1.x */ + return; default: def = data = RREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG); break; @@ -646,18 +641,8 @@ else data &= ~MM_ATC_L2_MISC_CG__MEM_LS_ENABLE_MASK; - if (def != data) { - switch (adev->ip_versions[MMHUB_HWIP][0]) { - case IP_VERSION(2, 1, 0): - case IP_VERSION(2, 1, 1): - case IP_VERSION(2, 1, 2): - WREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid, data); - break; - default: - WREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG, data); - break; - } - } + if (def != data) + WREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG, data); } static int mmhub_v2_0_set_clockgating(struct amdgpu_device *adev, @@ -695,7 +680,10 @@ case IP_VERSION(2, 1, 0): case IP_VERSION(2, 1, 1): case IP_VERSION(2, 1, 2): - data = RREG32_SOC15(MMHUB, 0, mmMM_ATC_L2_MISC_CG_Sienna_Cichlid); + /* There is no ATCL2 in MMHUB for 2.1.x. Keep the status + * based on DAGB + */ + data = MM_ATC_L2_MISC_CG__ENABLE_MASK; data1 = RREG32_SOC15(MMHUB, 0, mmDAGB0_CNTL_MISC2_Sienna_Cichlid); break; default: only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c @@ -854,7 +854,8 @@ m->sdmax_rlcx_rb_cntl = order_base_2(prop->queue_size / 4) << SDMA0_QUEUE0_RB_CNTL__RB_SIZE__SHIFT | 1 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_ENABLE__SHIFT | - 4 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT; + 4 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT | + 1 << SDMA0_QUEUE0_RB_CNTL__F32_WPTR_POLL_ENABLE__SHIFT; m->sdmax_rlcx_rb_base = lower_32_bits(prop->hqd_base_gpu_addr >> 8); m->sdmax_rlcx_rb_base_hi = upper_32_bits(prop->hqd_base_gpu_addr >> 8); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdkfd/kfd_crat.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdkfd/kfd_crat.c @@ -795,6 +795,102 @@ }, }; +static struct kfd_gpu_cache_info gfx1037_cache_info[] = { + { + /* TCP L1 Cache per CU */ + .cache_size = 16, + .cache_level = 1, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_DATA_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 1, + }, + { + /* Scalar L1 Instruction Cache per SQC */ + .cache_size = 32, + .cache_level = 1, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_INST_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 2, + }, + { + /* Scalar L1 Data Cache per SQC */ + .cache_size = 16, + .cache_level = 1, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_DATA_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 2, + }, + { + /* GL1 Data Cache per SA */ + .cache_size = 128, + .cache_level = 1, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_DATA_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 2, + }, + { + /* L2 Data Cache per GPU (Total Tex Cache) */ + .cache_size = 256, + .cache_level = 2, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_DATA_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 2, + }, +}; + +static struct kfd_gpu_cache_info gc_10_3_6_cache_info[] = { + { + /* TCP L1 Cache per CU */ + .cache_size = 16, + .cache_level = 1, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_DATA_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 1, + }, + { + /* Scalar L1 Instruction Cache per SQC */ + .cache_size = 32, + .cache_level = 1, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_INST_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 2, + }, + { + /* Scalar L1 Data Cache per SQC */ + .cache_size = 16, + .cache_level = 1, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_DATA_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 2, + }, + { + /* GL1 Data Cache per SA */ + .cache_size = 128, + .cache_level = 1, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_DATA_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 2, + }, + { + /* L2 Data Cache per GPU (Total Tex Cache) */ + .cache_size = 256, + .cache_level = 2, + .flags = (CRAT_CACHE_FLAGS_ENABLED | + CRAT_CACHE_FLAGS_DATA_CACHE | + CRAT_CACHE_FLAGS_SIMD_CACHE), + .num_cu_shared = 2, + }, +}; + static void kfd_populated_cu_info_cpu(struct kfd_topology_device *dev, struct crat_subtype_computeunit *cu) { @@ -1516,11 +1612,17 @@ num_of_cache_types = ARRAY_SIZE(beige_goby_cache_info); break; case IP_VERSION(10, 3, 3): - case IP_VERSION(10, 3, 6): /* TODO: Double check these on production silicon */ - case IP_VERSION(10, 3, 7): /* TODO: Double check these on production silicon */ pcache_info = yellow_carp_cache_info; num_of_cache_types = ARRAY_SIZE(yellow_carp_cache_info); break; + case IP_VERSION(10, 3, 6): + pcache_info = gc_10_3_6_cache_info; + num_of_cache_types = ARRAY_SIZE(gc_10_3_6_cache_info); + break; + case IP_VERSION(10, 3, 7): + pcache_info = gfx1037_cache_info; + num_of_cache_types = ARRAY_SIZE(gfx1037_cache_info); + break; case IP_VERSION(11, 0, 0): case IP_VERSION(11, 0, 1): case IP_VERSION(11, 0, 2): only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c @@ -371,7 +371,8 @@ << SDMA0_QUEUE0_RB_CNTL__RB_SIZE__SHIFT | q->vmid << SDMA0_QUEUE0_RB_CNTL__RB_VMID__SHIFT | 1 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_ENABLE__SHIFT | - 6 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT; + 6 << SDMA0_QUEUE0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT | + 1 << SDMA0_QUEUE0_RB_CNTL__F32_WPTR_POLL_ENABLE__SHIFT; m->sdmax_rlcx_rb_base = lower_32_bits(q->queue_address >> 8); m->sdmax_rlcx_rb_base_hi = upper_32_bits(q->queue_address >> 8); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/include/kgd_kfd_interface.h +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/include/kgd_kfd_interface.h @@ -262,8 +262,9 @@ uint32_t queue_id); int (*hqd_destroy)(struct amdgpu_device *adev, void *mqd, - uint32_t reset_type, unsigned int timeout, - uint32_t pipe_id, uint32_t queue_id); + enum kfd_preempt_type reset_type, + unsigned int timeout, uint32_t pipe_id, + uint32_t queue_id); bool (*hqd_sdma_is_occupied)(struct amdgpu_device *adev, void *mqd); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c @@ -2241,9 +2241,17 @@ static int arcturus_set_df_cstate(struct smu_context *smu, enum pp_df_cstate state) { + struct amdgpu_device *adev = smu->adev; uint32_t smu_version; int ret; + /* + * Arcturus does not need the cstate disablement + * prerequisite for gpu reset. + */ + if (amdgpu_in_reset(adev) || adev->in_suspend) + return 0; + ret = smu_cmn_get_smc_version(smu, NULL, &smu_version); if (ret) { dev_err(smu->adev->dev, "Failed to get smu version!\n"); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +++ linux-kvm-5.19.0/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c @@ -1643,6 +1643,15 @@ static int aldebaran_set_df_cstate(struct smu_context *smu, enum pp_df_cstate state) { + struct amdgpu_device *adev = smu->adev; + + /* + * Aldebaran does not need the cstate disablement + * prerequisite for gpu reset. + */ + if (amdgpu_in_reset(adev) || adev->in_suspend) + return 0; + return smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_DFCstateControl, state, NULL); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/drm_aperture.c +++ linux-kvm-5.19.0/drivers/gpu/drm/drm_aperture.c @@ -7,6 +7,7 @@ #include #include /* for firmware helpers */ #include +#include #include #include @@ -292,7 +293,20 @@ #if IS_REACHABLE(CONFIG_FB) struct apertures_struct *a; int ret; +#endif + /* + * If a driver asked to unregister a platform device registered by + * sysfb, then can be assumed that this is a driver for a display + * that is set up by the system firmware and has a generic driver. + * + * Drivers for devices that don't have a generic driver will never + * ask for this, so let's assume that a real driver for the display + * was already probed and prevent sysfb to register devices later. + */ + sysfb_disable(); + +#if IS_REACHABLE(CONFIG_FB) a = alloc_apertures(1); if (!a) return -ENOMEM; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/display/intel_cdclk.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/display/intel_cdclk.c @@ -2300,7 +2300,7 @@ min_cdclk = max(min_cdclk, (int)crtc_state->pixel_rate); /* - * HACK. Currently for TGL platforms we calculate + * HACK. Currently for TGL/DG2 platforms we calculate * min_cdclk initially based on pixel_rate divided * by 2, accounting for also plane requirements, * however in some cases the lowest possible CDCLK @@ -2308,7 +2308,7 @@ * Explicitly stating here that this seems to be currently * rather a Hack, than final solution. */ - if (IS_TIGERLAKE(dev_priv)) { + if (IS_TIGERLAKE(dev_priv) || IS_DG2(dev_priv)) { /* * Clamp to max_cdclk_freq in case pixel rate is higher, * in order not to break an 8K, but still leave W/A at place. only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/display/intel_sdvo.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/display/intel_sdvo.c @@ -2747,13 +2747,10 @@ if (!intel_sdvo_connector) return false; - if (device == 0) { - intel_sdvo->controlled_output |= SDVO_OUTPUT_TMDS0; + if (device == 0) intel_sdvo_connector->output_flag = SDVO_OUTPUT_TMDS0; - } else if (device == 1) { - intel_sdvo->controlled_output |= SDVO_OUTPUT_TMDS1; + else if (device == 1) intel_sdvo_connector->output_flag = SDVO_OUTPUT_TMDS1; - } intel_connector = &intel_sdvo_connector->base; connector = &intel_connector->base; @@ -2808,7 +2805,6 @@ encoder->encoder_type = DRM_MODE_ENCODER_TVDAC; connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; - intel_sdvo->controlled_output |= type; intel_sdvo_connector->output_flag = type; if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) { @@ -2849,13 +2845,10 @@ encoder->encoder_type = DRM_MODE_ENCODER_DAC; connector->connector_type = DRM_MODE_CONNECTOR_VGA; - if (device == 0) { - intel_sdvo->controlled_output |= SDVO_OUTPUT_RGB0; + if (device == 0) intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB0; - } else if (device == 1) { - intel_sdvo->controlled_output |= SDVO_OUTPUT_RGB1; + else if (device == 1) intel_sdvo_connector->output_flag = SDVO_OUTPUT_RGB1; - } if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) { kfree(intel_sdvo_connector); @@ -2884,13 +2877,10 @@ encoder->encoder_type = DRM_MODE_ENCODER_LVDS; connector->connector_type = DRM_MODE_CONNECTOR_LVDS; - if (device == 0) { - intel_sdvo->controlled_output |= SDVO_OUTPUT_LVDS0; + if (device == 0) intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS0; - } else if (device == 1) { - intel_sdvo->controlled_output |= SDVO_OUTPUT_LVDS1; + else if (device == 1) intel_sdvo_connector->output_flag = SDVO_OUTPUT_LVDS1; - } if (intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo) < 0) { kfree(intel_sdvo_connector); @@ -2923,16 +2913,39 @@ return false; } +static u16 intel_sdvo_filter_output_flags(u16 flags) +{ + flags &= SDVO_OUTPUT_MASK; + + /* SDVO requires XXX1 function may not exist unless it has XXX0 function.*/ + if (!(flags & SDVO_OUTPUT_TMDS0)) + flags &= ~SDVO_OUTPUT_TMDS1; + + if (!(flags & SDVO_OUTPUT_RGB0)) + flags &= ~SDVO_OUTPUT_RGB1; + + if (!(flags & SDVO_OUTPUT_LVDS0)) + flags &= ~SDVO_OUTPUT_LVDS1; + + return flags; +} + static bool intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags) { - /* SDVO requires XXX1 function may not exist unless it has XXX0 function.*/ + struct drm_i915_private *i915 = to_i915(intel_sdvo->base.base.dev); + + flags = intel_sdvo_filter_output_flags(flags); + + intel_sdvo->controlled_output = flags; + + intel_sdvo_select_ddc_bus(i915, intel_sdvo); if (flags & SDVO_OUTPUT_TMDS0) if (!intel_sdvo_dvi_init(intel_sdvo, 0)) return false; - if ((flags & SDVO_TMDS_MASK) == SDVO_TMDS_MASK) + if (flags & SDVO_OUTPUT_TMDS1) if (!intel_sdvo_dvi_init(intel_sdvo, 1)) return false; @@ -2953,7 +2966,7 @@ if (!intel_sdvo_analog_init(intel_sdvo, 0)) return false; - if ((flags & SDVO_RGB_MASK) == SDVO_RGB_MASK) + if (flags & SDVO_OUTPUT_RGB1) if (!intel_sdvo_analog_init(intel_sdvo, 1)) return false; @@ -2961,14 +2974,13 @@ if (!intel_sdvo_lvds_init(intel_sdvo, 0)) return false; - if ((flags & SDVO_LVDS_MASK) == SDVO_LVDS_MASK) + if (flags & SDVO_OUTPUT_LVDS1) if (!intel_sdvo_lvds_init(intel_sdvo, 1)) return false; - if ((flags & SDVO_OUTPUT_MASK) == 0) { + if (flags == 0) { unsigned char bytes[2]; - intel_sdvo->controlled_output = 0; memcpy(bytes, &intel_sdvo->caps.output_flags, 2); DRM_DEBUG_KMS("%s: Unknown SDVO output type (0x%02x%02x)\n", SDVO_NAME(intel_sdvo), @@ -3380,8 +3392,6 @@ */ intel_sdvo->base.cloneable = 0; - intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo); - /* Set the input timing to the screen. Assume always input 0. */ if (!intel_sdvo_set_target_input(intel_sdvo)) goto err_output; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/gem/i915_gem_internal.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/gem/i915_gem_internal.c @@ -6,7 +6,6 @@ #include #include -#include #include "i915_drv.h" #include "i915_gem.h" @@ -38,22 +37,12 @@ struct scatterlist *sg; unsigned int sg_page_sizes; unsigned int npages; - int max_order; + int max_order = MAX_ORDER; + unsigned int max_segment; gfp_t gfp; - max_order = MAX_ORDER; -#ifdef CONFIG_SWIOTLB - if (is_swiotlb_active(obj->base.dev->dev)) { - unsigned int max_segment; - - max_segment = swiotlb_max_segment(); - if (max_segment) { - max_segment = max_t(unsigned int, max_segment, - PAGE_SIZE) >> PAGE_SHIFT; - max_order = min(max_order, ilog2(max_segment)); - } - } -#endif + max_segment = i915_sg_segment_size(i915->drm.dev) >> PAGE_SHIFT; + max_order = min(max_order, get_order(max_segment)); gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE; if (IS_I965GM(i915) || IS_I965G(i915)) { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/gem/i915_gem_shmem.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/gem/i915_gem_shmem.c @@ -194,7 +194,7 @@ struct intel_memory_region *mem = obj->mm.region; struct address_space *mapping = obj->base.filp->f_mapping; const unsigned long page_count = obj->base.size / PAGE_SIZE; - unsigned int max_segment = i915_sg_segment_size(); + unsigned int max_segment = i915_sg_segment_size(i915->drm.dev); struct sg_table *st; struct sgt_iter sgt_iter; struct page *page; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -189,7 +189,7 @@ struct drm_i915_private *i915 = container_of(bdev, typeof(*i915), bdev); struct intel_memory_region *mr = i915->mm.regions[INTEL_MEMORY_SYSTEM]; struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm); - const unsigned int max_segment = i915_sg_segment_size(); + const unsigned int max_segment = i915_sg_segment_size(i915->drm.dev); const size_t size = (size_t)ttm->num_pages << PAGE_SHIFT; struct file *filp = i915_tt->filp; struct sgt_iter sgt_iter; @@ -586,7 +586,7 @@ ret = sg_alloc_table_from_pages_segment(st, ttm->pages, ttm->num_pages, 0, (unsigned long)ttm->num_pages << PAGE_SHIFT, - i915_sg_segment_size(), GFP_KERNEL); + i915_sg_segment_size(i915_tt->dev), GFP_KERNEL); if (ret) { st->sgl = NULL; return ERR_PTR(ret); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/gem/i915_gem_userptr.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/gem/i915_gem_userptr.c @@ -129,7 +129,7 @@ static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) { const unsigned long num_pages = obj->base.size >> PAGE_SHIFT; - unsigned int max_segment = i915_sg_segment_size(); + unsigned int max_segment = i915_sg_segment_size(obj->base.dev->dev); struct sg_table *st; unsigned int sg_page_sizes; struct page **pvec; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/gt/intel_workarounds.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/gt/intel_workarounds.c @@ -2224,11 +2224,11 @@ } if (IS_DG1_GRAPHICS_STEP(i915, STEP_A0, STEP_B0) || - IS_ROCKETLAKE(i915) || IS_TIGERLAKE(i915)) { + IS_ROCKETLAKE(i915) || IS_TIGERLAKE(i915) || IS_ALDERLAKE_P(i915)) { /* * Wa_1607030317:tgl * Wa_1607186500:tgl - * Wa_1607297627:tgl,rkl,dg1[a0] + * Wa_1607297627:tgl,rkl,dg1[a0],adlp * * On TGL and RKL there are multiple entries for this WA in the * BSpec; some indicate this is an A0-only WA, others indicate only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/i915_scatterlist.h +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/i915_scatterlist.h @@ -9,7 +9,8 @@ #include #include -#include +#include +#include #include "i915_gem.h" @@ -127,19 +128,26 @@ return page_sizes; } -static inline unsigned int i915_sg_segment_size(void) +static inline unsigned int i915_sg_segment_size(struct device *dev) { - unsigned int size = swiotlb_max_segment(); + size_t max = min_t(size_t, UINT_MAX, dma_max_mapping_size(dev)); - if (size == 0) - size = UINT_MAX; - - size = rounddown(size, PAGE_SIZE); - /* swiotlb_max_segment_size can return 1 byte when it means one page. */ - if (size < PAGE_SIZE) - size = PAGE_SIZE; - - return size; + /* + * For Xen PV guests pages aren't contiguous in DMA (machine) address + * space. The DMA API takes care of that both in dma_alloc_* (by + * calling into the hypervisor to make the pages contiguous) and in + * dma_map_* (by bounce buffering). But i915 abuses ignores the + * coherency aspects of the DMA API and thus can't cope with bounce + * buffering actually happening, so add a hack here to force small + * allocations and mappings when running in PV mode on Xen. + * + * Note this will still break if bounce buffering is required for other + * reasons, like confidential computing hypervisors or PCIe root ports + * with addressing limitations. + */ + if (xen_pv_domain()) + max = PAGE_SIZE; + return round_down(max, PAGE_SIZE); } bool i915_sg_trim(struct sg_table *orig_st); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/i915/intel_runtime_pm.c +++ linux-kvm-5.19.0/drivers/gpu/drm/i915/intel_runtime_pm.c @@ -591,8 +591,15 @@ pm_runtime_use_autosuspend(kdev); } - /* Enable by default */ - pm_runtime_allow(kdev); + /* + * FIXME: Temp hammer to keep autosupend disable on lmem supported platforms. + * As per PCIe specs 5.3.1.4.1, all iomem read write request over a PCIe + * function will be unsupported in case PCIe endpoint function is in D3. + * Let's keep i915 autosuspend control 'on' till we fix all known issue + * with lmem access in D3. + */ + if (!IS_DGFX(i915)) + pm_runtime_allow(kdev); /* * The core calls the driver load handler with an RPM reference held. only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c @@ -91,7 +91,7 @@ static void *state_kcalloc(struct a6xx_gpu_state *a6xx_state, int nr, size_t objsize) { struct a6xx_state_memobj *obj = - kzalloc((nr * objsize) + sizeof(*obj), GFP_KERNEL); + kvzalloc((nr * objsize) + sizeof(*obj), GFP_KERNEL); if (!obj) return NULL; @@ -819,7 +819,7 @@ snapshot->iova = bo->iova; snapshot->size = bo->size; - snapshot->data = kvzalloc(snapshot->size, GFP_KERNEL); + snapshot->data = state_kcalloc(a6xx_state, 1, snapshot->size); if (!snapshot->data) return NULL; @@ -1034,14 +1034,8 @@ struct a6xx_gpu_state *a6xx_state = container_of(state, struct a6xx_gpu_state, base); - if (a6xx_state->gmu_log) - kvfree(a6xx_state->gmu_log->data); - - if (a6xx_state->gmu_hfi) - kvfree(a6xx_state->gmu_hfi->data); - list_for_each_entry_safe(obj, tmp, &a6xx_state->objs, node) - kfree(obj); + kvfree(obj); adreno_gpu_state_destroy(state); kfree(a6xx_state); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/disp/mdp4/mdp4_lvds_connector.c @@ -56,8 +56,9 @@ return ret; } -static int mdp4_lvds_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) +static enum drm_mode_status +mdp4_lvds_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) { struct mdp4_lvds_connector *mdp4_lvds_connector = to_mdp4_lvds_connector(connector); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/msm/dp/dp_display.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/dp/dp_display.c @@ -1254,7 +1254,7 @@ return -EINVAL; } - rc = devm_request_irq(&dp->pdev->dev, dp->irq, + rc = devm_request_irq(dp_display->drm_dev->dev, dp->irq, dp_display_irq_handler, IRQF_TRIGGER_HIGH, "dp_display_isr", dp); if (rc < 0) { @@ -1585,7 +1585,7 @@ * For DisplayPort interfaces external bridges are optional, so * silently ignore an error if one is not present (-ENODEV). */ - rc = dp_parser_find_next_bridge(dp_priv->parser); + rc = devm_dp_parser_find_next_bridge(dp->drm_dev->dev, dp_priv->parser); if (!dp->is_edp && rc == -ENODEV) return 0; @@ -1614,6 +1614,12 @@ return -EINVAL; priv = dev->dev_private; + + if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) { + DRM_DEV_ERROR(dev->dev, "too many bridges\n"); + return -ENOSPC; + } + dp_display->drm_dev = dev; dp_priv = container_of(dp_display, struct dp_display_private, dp_display); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/msm/dp/dp_drm.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/dp/dp_drm.c @@ -31,6 +31,36 @@ connector_status_disconnected; } +static int dp_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct msm_dp *dp; + + dp = to_dp_bridge(bridge)->dp_display; + + drm_dbg_dp(dp->drm_dev, "is_connected = %s\n", + (dp->is_connected) ? "true" : "false"); + + /* + * There is no protection in the DRM framework to check if the display + * pipeline has been already disabled before trying to disable it again. + * Hence if the sink is unplugged, the pipeline gets disabled, but the + * crtc->active is still true. Any attempt to set the mode or manually + * disable this encoder will result in the crash. + * + * TODO: add support for telling the DRM subsystem that the pipeline is + * disabled by the hardware and thus all access to it should be forbidden. + * After that this piece of code can be removed. + */ + if (bridge->ops & DRM_BRIDGE_OP_HPD) + return (dp->is_connected) ? 0 : -ENOTCONN; + + return 0; +} + + /** * dp_bridge_get_modes - callback to add drm modes via drm_mode_probed_add() * @bridge: Poiner to drm bridge @@ -61,6 +91,9 @@ } static const struct drm_bridge_funcs dp_bridge_ops = { + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, .enable = dp_bridge_enable, .disable = dp_bridge_disable, .post_disable = dp_bridge_post_disable, @@ -68,6 +101,7 @@ .mode_valid = dp_bridge_mode_valid, .get_modes = dp_bridge_get_modes, .detect = dp_bridge_detect, + .atomic_check = dp_bridge_atomic_check, }; struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/msm/dp/dp_parser.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/dp/dp_parser.c @@ -263,12 +263,12 @@ return 0; } -int dp_parser_find_next_bridge(struct dp_parser *parser) +int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser) { - struct device *dev = &parser->pdev->dev; + struct platform_device *pdev = parser->pdev; struct drm_bridge *bridge; - bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); + bridge = devm_drm_of_get_bridge(dev, pdev->dev.of_node, 1, 0); if (IS_ERR(bridge)) return PTR_ERR(bridge); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/msm/dp/dp_parser.h +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/dp/dp_parser.h @@ -142,8 +142,9 @@ struct dp_parser *dp_parser_get(struct platform_device *pdev); /** - * dp_parser_find_next_bridge() - find an additional bridge to DP + * devm_dp_parser_find_next_bridge() - find an additional bridge to DP * + * @dev: device to tie bridge lifetime to * @parser: dp_parser data from client * * This function is used to find any additional bridge attached to @@ -151,6 +152,6 @@ * * Return: 0 if able to get the bridge, otherwise negative errno for failure. */ -int dp_parser_find_next_bridge(struct dp_parser *parser); +int devm_dp_parser_find_next_bridge(struct device *dev, struct dp_parser *parser); #endif only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/msm/dsi/dsi.c +++ linux-kvm-5.19.0/drivers/gpu/drm/msm/dsi/dsi.c @@ -227,6 +227,12 @@ return -EINVAL; priv = dev->dev_private; + + if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) { + DRM_DEV_ERROR(dev->dev, "too many bridges\n"); + return -ENOSPC; + } + msm_dsi->dev = dev; ret = msm_dsi_host_modeset_init(msm_dsi->host, dev); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ linux-kvm-5.19.0/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1031,23 +1031,31 @@ if (ret) { DRM_DEV_ERROR(dsi->dev, "Failed to register component: %d\n", ret); - return ret; + goto out; } second = dw_mipi_dsi_rockchip_find_second(dsi); - if (IS_ERR(second)) - return PTR_ERR(second); + if (IS_ERR(second)) { + ret = PTR_ERR(second); + goto out; + } if (second) { ret = component_add(second, &dw_mipi_dsi_rockchip_ops); if (ret) { DRM_DEV_ERROR(second, "Failed to register component: %d\n", ret); - return ret; + goto out; } } return 0; + +out: + mutex_lock(&dsi->usage_mutex); + dsi->usage_mode = DW_DSI_USAGE_IDLE; + mutex_unlock(&dsi->usage_mutex); + return ret; } static int dw_mipi_dsi_rockchip_host_detach(void *priv_data, @@ -1634,5 +1642,11 @@ .of_match_table = dw_mipi_dsi_rockchip_dt_ids, .pm = &dw_mipi_dsi_rockchip_pm_ops, .name = "dw-mipi-dsi-rockchip", + /* + * For dual-DSI display, one DSI pokes at the other DSI's + * drvdata in dw_mipi_dsi_rockchip_find_second(). This is not + * safe for asynchronous probe. + */ + .probe_type = PROBE_FORCE_SYNCHRONOUS, }, }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ linux-kvm-5.19.0/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -565,7 +565,8 @@ ret = rockchip_hdmi_parse_dt(hdmi); if (ret) { - DRM_DEV_ERROR(hdmi->dev, "Unable to parse OF data\n"); + if (ret != -EPROBE_DEFER) + DRM_DEV_ERROR(hdmi->dev, "Unable to parse OF data\n"); return ret; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ linux-kvm-5.19.0/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -364,9 +364,12 @@ { struct rockchip_gem_object *rk_obj; struct drm_gem_object *obj; + bool is_framebuffer; int ret; - rk_obj = rockchip_gem_create_object(drm, size, false); + is_framebuffer = drm->fb_helper && file_priv == drm->fb_helper->client.file; + + rk_obj = rockchip_gem_create_object(drm, size, is_framebuffer); if (IS_ERR(rk_obj)) return ERR_CAST(rk_obj); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/vc4/vc4_drv.c +++ linux-kvm-5.19.0/drivers/gpu/drm/vc4/vc4_drv.c @@ -267,6 +267,13 @@ } } +static void vc4_component_unbind_all(void *ptr) +{ + struct vc4_dev *vc4 = ptr; + + component_unbind_all(vc4->dev, &vc4->base); +} + static int vc4_drm_bind(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -291,6 +298,7 @@ if (IS_ERR(vc4)) return PTR_ERR(vc4); vc4->is_vc5 = is_vc5; + vc4->dev = dev; drm = &vc4->base; platform_set_drvdata(pdev, drm); @@ -341,6 +349,10 @@ if (ret) return ret; + ret = devm_add_action_or_reset(dev, vc4_component_unbind_all, vc4); + if (ret) + return ret; + ret = vc4_plane_create_additional_planes(drm); if (ret) goto unbind_all; @@ -361,8 +373,6 @@ return 0; unbind_all: - component_unbind_all(dev, drm); - return ret; } @@ -461,6 +471,7 @@ module_exit(vc4_drm_unregister); MODULE_ALIAS("platform:vc4-drm"); +MODULE_SOFTDEP("pre: snd-soc-hdmi-codec"); MODULE_DESCRIPTION("Broadcom VC4 DRM Driver"); MODULE_AUTHOR("Eric Anholt "); MODULE_LICENSE("GPL v2"); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/gpu/drm/vc4/vc4_drv.h +++ linux-kvm-5.19.0/drivers/gpu/drm/vc4/vc4_drv.h @@ -75,6 +75,7 @@ struct vc4_dev { struct drm_device base; + struct device *dev; bool is_vc5; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hid/Kconfig +++ linux-kvm-5.19.0/drivers/hid/Kconfig @@ -1141,6 +1141,12 @@ Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic CLLRCMCE remote control. +config HID_TOPRE + tristate "Topre REALFORCE keyboards" + depends on HID + help + Say Y for N-key rollover support on Topre REALFORCE R2 108 key keyboards. + config HID_THINGM tristate "ThingM blink(1) USB RGB LED" depends on HID only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hid/Makefile +++ linux-kvm-5.19.0/drivers/hid/Makefile @@ -123,6 +123,7 @@ obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o hid-thrustmaster.o obj-$(CONFIG_HID_TIVO) += hid-tivo.o obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o +obj-$(CONFIG_HID_TOPRE) += hid-topre.o obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o obj-$(CONFIG_HID_U2FZERO) += hid-u2fzero.o hid-uclogic-objs := hid-uclogic-core.o \ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hid/hid-magicmouse.c +++ linux-kvm-5.19.0/drivers/hid/hid-magicmouse.c @@ -480,7 +480,7 @@ magicmouse_raw_event(hdev, report, data + 2, data[1]); magicmouse_raw_event(hdev, report, data + 2 + data[1], size - 2 - data[1]); - break; + return 0; default: return 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hid/hid-playstation.c +++ linux-kvm-5.19.0/drivers/hid/hid-playstation.c @@ -46,6 +46,7 @@ uint32_t fw_version; int (*parse_report)(struct ps_device *dev, struct hid_report *report, u8 *data, int size); + void (*remove)(struct ps_device *dev); }; /* Calibration data for playstation motion sensors. */ @@ -174,6 +175,7 @@ struct led_classdev player_leds[5]; struct work_struct output_worker; + bool output_worker_initialized; void *output_report_dmabuf; uint8_t output_seq; /* Sequence number for output report. */ }; @@ -299,6 +301,7 @@ {0, 0}, }; +static inline void dualsense_schedule_work(struct dualsense *ds); static void dualsense_set_lightbar(struct dualsense *ds, uint8_t red, uint8_t green, uint8_t blue); /* @@ -792,6 +795,7 @@ return ret; } + static int dualsense_get_firmware_info(struct dualsense *ds) { uint8_t *buf; @@ -881,7 +885,7 @@ ds->update_player_leds = true; spin_unlock_irqrestore(&ds->base.lock, flags); - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); return 0; } @@ -925,6 +929,16 @@ } } +static inline void dualsense_schedule_work(struct dualsense *ds) +{ + unsigned long flags; + + spin_lock_irqsave(&ds->base.lock, flags); + if (ds->output_worker_initialized) + schedule_work(&ds->output_worker); + spin_unlock_irqrestore(&ds->base.lock, flags); +} + /* * Helper function to send DualSense output reports. Applies a CRC at the end of a report * for Bluetooth reports. @@ -1085,7 +1099,7 @@ spin_unlock_irqrestore(&ps_dev->lock, flags); /* Schedule updating of microphone state at hardware level. */ - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); } ds->last_btn_mic_state = btn_mic_state; @@ -1200,10 +1214,22 @@ ds->motor_right = effect->u.rumble.weak_magnitude / 256; spin_unlock_irqrestore(&ds->base.lock, flags); - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); return 0; } +static void dualsense_remove(struct ps_device *ps_dev) +{ + struct dualsense *ds = container_of(ps_dev, struct dualsense, base); + unsigned long flags; + + spin_lock_irqsave(&ds->base.lock, flags); + ds->output_worker_initialized = false; + spin_unlock_irqrestore(&ds->base.lock, flags); + + cancel_work_sync(&ds->output_worker); +} + static int dualsense_reset_leds(struct dualsense *ds) { struct dualsense_output_report report; @@ -1240,7 +1266,7 @@ ds->lightbar_blue = blue; spin_unlock_irqrestore(&ds->base.lock, flags); - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); } static void dualsense_set_player_leds(struct dualsense *ds) @@ -1263,7 +1289,7 @@ ds->update_player_leds = true; ds->player_leds_state = player_ids[player_id]; - schedule_work(&ds->output_worker); + dualsense_schedule_work(ds); } static struct ps_device *dualsense_create(struct hid_device *hdev) @@ -1302,7 +1328,9 @@ ps_dev->battery_capacity = 100; /* initial value until parse_report. */ ps_dev->battery_status = POWER_SUPPLY_STATUS_UNKNOWN; ps_dev->parse_report = dualsense_parse_report; + ps_dev->remove = dualsense_remove; INIT_WORK(&ds->output_worker, dualsense_output_worker); + ds->output_worker_initialized = true; hid_set_drvdata(hdev, ds); max_output_report_size = sizeof(struct dualsense_output_report_bt); @@ -1439,7 +1467,8 @@ goto err_stop; } - if (hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER) { + if (hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER || + hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) { dev = dualsense_create(hdev); if (IS_ERR(dev)) { hid_err(hdev, "Failed to create dualsense.\n"); @@ -1470,6 +1499,9 @@ ps_devices_list_remove(dev); ps_device_release_player_id(dev); + if (dev->remove) + dev->remove(dev); + hid_hw_close(hdev); hid_hw_stop(hdev); } @@ -1477,6 +1509,8 @@ static const struct hid_device_id ps_devices[] = { { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER) }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) }, + { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) }, { } }; MODULE_DEVICE_TABLE(hid, ps_devices); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hid/hid-saitek.c +++ linux-kvm-5.19.0/drivers/hid/hid-saitek.c @@ -187,6 +187,8 @@ .driver_data = SAITEK_RELEASE_MODE_RAT7 }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7), .driver_data = SAITEK_RELEASE_MODE_MMO7 }, + { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_MMO7), + .driver_data = SAITEK_RELEASE_MODE_MMO7 }, { } }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hid/hid-topre.c +++ linux-kvm-5.19.0/drivers/hid/hid-topre.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * HID driver for Topre REALFORCE Keyboards + * + * Copyright (c) 2022 Harry Stern + * + * Based on the hid-macally driver + */ + +#include +#include + +#include "hid-ids.h" + +MODULE_AUTHOR("Harry Stern "); +MODULE_DESCRIPTION("REALFORCE R2 Keyboard driver"); +MODULE_LICENSE("GPL"); + +/* + * Fix the REALFORCE R2's non-boot interface's report descriptor to match the + * events it's actually sending. It claims to send array events but is instead + * sending variable events. + */ +static __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int *rsize) +{ + if (*rsize >= 119 && rdesc[69] == 0x29 && rdesc[70] == 0xe7 && + rdesc[71] == 0x81 && rdesc[72] == 0x00) { + hid_info(hdev, + "fixing up Topre REALFORCE keyboard report descriptor\n"); + rdesc[72] = 0x02; + } + return rdesc; +} + +static const struct hid_device_id topre_id_table[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE, + USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) }, + { } +}; +MODULE_DEVICE_TABLE(hid, topre_id_table); + +static struct hid_driver topre_driver = { + .name = "topre", + .id_table = topre_id_table, + .report_fixup = topre_report_fixup, +}; + +module_hid_driver(topre_driver); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hid/hid-uclogic-rdesc.c +++ linux-kvm-5.19.0/drivers/hid/hid-uclogic-rdesc.c @@ -1009,7 +1009,7 @@ if (memcmp(p, head, sizeof(head)) == 0 && p[sizeof(head)] < param_num) { v = param_list[p[sizeof(head)]]; - put_unaligned(cpu_to_le32(v), (s32 *)p); + put_unaligned((__force u32)cpu_to_le32(v), (s32 *)p); p += sizeof(head) + 1; } else { p++; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hwmon/coretemp.c +++ linux-kvm-5.19.0/drivers/hwmon/coretemp.c @@ -46,9 +46,6 @@ #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) #define MAX_CORE_DATA (NUM_REAL_CORES + BASE_SYSFS_ATTR_NO) -#define TO_CORE_ID(cpu) (cpu_data(cpu).cpu_core_id) -#define TO_ATTR_NO(cpu) (TO_CORE_ID(cpu) + BASE_SYSFS_ATTR_NO) - #ifdef CONFIG_SMP #define for_each_sibling(i, cpu) \ for_each_cpu(i, topology_sibling_cpumask(cpu)) @@ -91,6 +88,8 @@ struct platform_data { struct device *hwmon_dev; u16 pkg_id; + u16 cpu_map[NUM_REAL_CORES]; + struct ida ida; struct cpumask cpumask; struct temp_data *core_data[MAX_CORE_DATA]; struct device_attribute name_attr; @@ -441,7 +440,7 @@ MSR_IA32_THERM_STATUS; tdata->is_pkg_data = pkg_flag; tdata->cpu = cpu; - tdata->cpu_core_id = TO_CORE_ID(cpu); + tdata->cpu_core_id = topology_core_id(cpu); tdata->attr_size = MAX_CORE_ATTRS; mutex_init(&tdata->update_lock); return tdata; @@ -454,7 +453,7 @@ struct platform_data *pdata = platform_get_drvdata(pdev); struct cpuinfo_x86 *c = &cpu_data(cpu); u32 eax, edx; - int err, attr_no; + int err, index, attr_no; /* * Find attr number for sysfs: @@ -462,14 +461,26 @@ * The attr number is always core id + 2 * The Pkgtemp will always show up as temp1_*, if available */ - attr_no = pkg_flag ? PKG_SYSFS_ATTR_NO : TO_ATTR_NO(cpu); + if (pkg_flag) { + attr_no = PKG_SYSFS_ATTR_NO; + } else { + index = ida_alloc(&pdata->ida, GFP_KERNEL); + if (index < 0) + return index; + pdata->cpu_map[index] = topology_core_id(cpu); + attr_no = index + BASE_SYSFS_ATTR_NO; + } - if (attr_no > MAX_CORE_DATA - 1) - return -ERANGE; + if (attr_no > MAX_CORE_DATA - 1) { + err = -ERANGE; + goto ida_free; + } tdata = init_temp_data(cpu, pkg_flag); - if (!tdata) - return -ENOMEM; + if (!tdata) { + err = -ENOMEM; + goto ida_free; + } /* Test if we can access the status register */ err = rdmsr_safe_on_cpu(cpu, tdata->status_reg, &eax, &edx); @@ -505,6 +516,9 @@ exit_free: pdata->core_data[attr_no] = NULL; kfree(tdata); +ida_free: + if (!pkg_flag) + ida_free(&pdata->ida, index); return err; } @@ -524,6 +538,9 @@ kfree(pdata->core_data[indx]); pdata->core_data[indx] = NULL; + + if (indx >= BASE_SYSFS_ATTR_NO) + ida_free(&pdata->ida, indx - BASE_SYSFS_ATTR_NO); } static int coretemp_probe(struct platform_device *pdev) @@ -537,6 +554,7 @@ return -ENOMEM; pdata->pkg_id = pdev->id; + ida_init(&pdata->ida); platform_set_drvdata(pdev, pdata); pdata->hwmon_dev = devm_hwmon_device_register_with_groups(dev, DRVNAME, @@ -553,6 +571,7 @@ if (pdata->core_data[i]) coretemp_remove_core(pdata, i); + ida_destroy(&pdata->ida); return 0; } @@ -647,7 +666,7 @@ struct platform_device *pdev = coretemp_get_pdev(cpu); struct platform_data *pd; struct temp_data *tdata; - int indx, target; + int i, indx = -1, target; /* * Don't execute this on suspend as the device remove locks @@ -660,12 +679,19 @@ if (!pdev) return 0; - /* The core id is too big, just return */ - indx = TO_ATTR_NO(cpu); - if (indx > MAX_CORE_DATA - 1) + pd = platform_get_drvdata(pdev); + + for (i = 0; i < NUM_REAL_CORES; i++) { + if (pd->cpu_map[i] == topology_core_id(cpu)) { + indx = i + BASE_SYSFS_ATTR_NO; + break; + } + } + + /* Too many cores and this core is not populated, just return */ + if (indx < 0) return 0; - pd = platform_get_drvdata(pdev); tdata = pd->core_data[indx]; cpumask_clear_cpu(cpu, &pd->cpumask); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/hwtracing/coresight/coresight-cti-core.c +++ linux-kvm-5.19.0/drivers/hwtracing/coresight/coresight-cti-core.c @@ -90,11 +90,9 @@ static int cti_enable_hw(struct cti_drvdata *drvdata) { struct cti_config *config = &drvdata->config; - struct device *dev = &drvdata->csdev->dev; unsigned long flags; int rc = 0; - pm_runtime_get_sync(dev->parent); spin_lock_irqsave(&drvdata->spinlock, flags); /* no need to do anything if enabled or unpowered*/ @@ -119,7 +117,6 @@ /* cannot enable due to error */ cti_err_not_enabled: spin_unlock_irqrestore(&drvdata->spinlock, flags); - pm_runtime_put(dev->parent); return rc; } @@ -153,7 +150,6 @@ static int cti_disable_hw(struct cti_drvdata *drvdata) { struct cti_config *config = &drvdata->config; - struct device *dev = &drvdata->csdev->dev; struct coresight_device *csdev = drvdata->csdev; spin_lock(&drvdata->spinlock); @@ -175,7 +171,6 @@ coresight_disclaim_device_unlocked(csdev); CS_LOCK(drvdata->base); spin_unlock(&drvdata->spinlock); - pm_runtime_put(dev->parent); return 0; /* not disabled this call */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/i2c/busses/i2c-piix4.c +++ linux-kvm-5.19.0/drivers/i2c/busses/i2c-piix4.c @@ -1080,6 +1080,7 @@ "", &piix4_main_adapters[0]); if (retval < 0) return retval; + piix4_adapter_count = 1; } /* Check for auxiliary SMBus on some AMD chipsets */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/i2c/busses/i2c-qcom-cci.c +++ linux-kvm-5.19.0/drivers/i2c/busses/i2c-qcom-cci.c @@ -638,6 +638,11 @@ if (ret < 0) goto error; + pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + for (i = 0; i < cci->data->num_masters; i++) { if (!cci->master[i].cci) continue; @@ -649,14 +654,12 @@ } } - pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); - pm_runtime_use_autosuspend(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - return 0; error_i2c: + pm_runtime_disable(dev); + pm_runtime_dont_use_autosuspend(dev); + for (--i ; i >= 0; i--) { if (cci->master[i].cci) { i2c_del_adapter(&cci->master[i].adap); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/i2c/busses/i2c-xiic.c +++ linux-kvm-5.19.0/drivers/i2c/busses/i2c-xiic.c @@ -920,6 +920,7 @@ module_platform_driver(xiic_i2c_driver); +MODULE_ALIAS("platform:" DRIVER_NAME); MODULE_AUTHOR("info@mocean-labs.com"); MODULE_DESCRIPTION("Xilinx I2C bus driver"); MODULE_LICENSE("GPL v2"); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/iio/accel/adxl372.c +++ linux-kvm-5.19.0/drivers/iio/accel/adxl372.c @@ -998,17 +998,30 @@ return sprintf(buf, "%d\n", st->watermark); } -static IIO_CONST_ATTR(hwfifo_watermark_min, "1"); -static IIO_CONST_ATTR(hwfifo_watermark_max, - __stringify(ADXL372_FIFO_SIZE)); +static ssize_t hwfifo_watermark_min_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sysfs_emit(buf, "%s\n", "1"); +} + +static ssize_t hwfifo_watermark_max_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + return sysfs_emit(buf, "%s\n", __stringify(ADXL372_FIFO_SIZE)); +} + +static IIO_DEVICE_ATTR_RO(hwfifo_watermark_min, 0); +static IIO_DEVICE_ATTR_RO(hwfifo_watermark_max, 0); static IIO_DEVICE_ATTR(hwfifo_watermark, 0444, adxl372_get_fifo_watermark, NULL, 0); static IIO_DEVICE_ATTR(hwfifo_enabled, 0444, adxl372_get_fifo_enabled, NULL, 0); static const struct attribute *adxl372_fifo_attributes[] = { - &iio_const_attr_hwfifo_watermark_min.dev_attr.attr, - &iio_const_attr_hwfifo_watermark_max.dev_attr.attr, + &iio_dev_attr_hwfifo_watermark_min.dev_attr.attr, + &iio_dev_attr_hwfifo_watermark_max.dev_attr.attr, &iio_dev_attr_hwfifo_watermark.dev_attr.attr, &iio_dev_attr_hwfifo_enabled.dev_attr.attr, NULL, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/iio/adc/stm32-adc.c +++ linux-kvm-5.19.0/drivers/iio/adc/stm32-adc.c @@ -2058,18 +2058,19 @@ stm32_adc_chan_init_one(indio_dev, &channels[scan_index], val, vin[1], scan_index, differential); + val = 0; ret = of_property_read_u32(child, "st,min-sample-time-ns", &val); /* st,min-sample-time-ns is optional */ - if (!ret) { - stm32_adc_smpr_init(adc, channels[scan_index].channel, val); - if (differential) - stm32_adc_smpr_init(adc, vin[1], val); - } else if (ret != -EINVAL) { + if (ret && ret != -EINVAL) { dev_err(&indio_dev->dev, "Invalid st,min-sample-time-ns property %d\n", ret); goto err; } + stm32_adc_smpr_init(adc, channels[scan_index].channel, val); + if (differential) + stm32_adc_smpr_init(adc, vin[1], val); + scan_index++; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/iio/light/tsl2583.c +++ linux-kvm-5.19.0/drivers/iio/light/tsl2583.c @@ -858,7 +858,7 @@ TSL2583_POWER_OFF_DELAY_MS); pm_runtime_use_autosuspend(&clientp->dev); - ret = devm_iio_device_register(indio_dev->dev.parent, indio_dev); + ret = iio_device_register(indio_dev); if (ret) { dev_err(&clientp->dev, "%s: iio registration failed\n", __func__); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/infiniband/core/device.c +++ linux-kvm-5.19.0/drivers/infiniband/core/device.c @@ -2815,10 +2815,18 @@ nldev_init(); rdma_nl_register(RDMA_NL_LS, ibnl_ls_cb_table); - roce_gid_mgmt_init(); + ret = roce_gid_mgmt_init(); + if (ret) { + pr_warn("Couldn't init RoCE GID management\n"); + goto err_parent; + } return 0; +err_parent: + rdma_nl_unregister(RDMA_NL_LS); + nldev_exit(); + unregister_pernet_device(&rdma_dev_net_ops); err_compat: unregister_blocking_lsm_notifier(&ibdev_lsm_nb); err_sa: only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/infiniband/core/nldev.c +++ linux-kvm-5.19.0/drivers/infiniband/core/nldev.c @@ -2537,7 +2537,7 @@ rdma_nl_register(RDMA_NL_NLDEV, nldev_cb_table); } -void __exit nldev_exit(void) +void nldev_exit(void) { rdma_nl_unregister(RDMA_NL_NLDEV); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/infiniband/hw/hfi1/pio.c +++ linux-kvm-5.19.0/drivers/infiniband/hw/hfi1/pio.c @@ -913,8 +913,7 @@ spin_unlock(&sc->release_lock); write_seqlock(&sc->waitlock); - if (!list_empty(&sc->piowait)) - list_move(&sc->piowait, &wake_list); + list_splice_init(&sc->piowait, &wake_list); write_sequnlock(&sc->waitlock); while (!list_empty(&wake_list)) { struct iowait *wait; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/infiniband/hw/qedr/main.c +++ linux-kvm-5.19.0/drivers/infiniband/hw/qedr/main.c @@ -344,6 +344,10 @@ if (IS_IWARP(dev)) { xa_init(&dev->qps); dev->iwarp_wq = create_singlethread_workqueue("qedr_iwarpq"); + if (!dev->iwarp_wq) { + rc = -ENOMEM; + goto err1; + } } /* Allocate Status blocks for CNQ */ @@ -351,7 +355,7 @@ GFP_KERNEL); if (!dev->sb_array) { rc = -ENOMEM; - goto err1; + goto err_destroy_wq; } dev->cnq_array = kcalloc(dev->num_cnq, @@ -402,6 +406,9 @@ kfree(dev->cnq_array); err2: kfree(dev->sb_array); +err_destroy_wq: + if (IS_IWARP(dev)) + destroy_workqueue(dev->iwarp_wq); err1: kfree(dev->sgid_tbl); return rc; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/isdn/hardware/mISDN/netjet.c +++ linux-kvm-5.19.0/drivers/isdn/hardware/mISDN/netjet.c @@ -956,7 +956,7 @@ } if (card->irq > 0) free_irq(card->irq, card); - if (card->isac.dch.dev.dev.class) + if (device_is_registered(&card->isac.dch.dev.dev)) mISDN_unregister_device(&card->isac.dch.dev); for (i = 0; i < 2; i++) { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/isdn/mISDN/core.c +++ linux-kvm-5.19.0/drivers/isdn/mISDN/core.c @@ -233,11 +233,12 @@ if (debug & DEBUG_CORE) printk(KERN_DEBUG "mISDN_register %s %d\n", dev_name(&dev->dev), dev->id); + dev->dev.class = &mISDN_class; + err = create_stack(dev); if (err) goto error1; - dev->dev.class = &mISDN_class; dev->dev.platform_data = dev; dev->dev.parent = parent; dev_set_drvdata(&dev->dev, dev); @@ -249,8 +250,8 @@ error3: delete_stack(dev); - return err; error1: + put_device(&dev->dev); return err; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/md/dm-clone-target.c +++ linux-kvm-5.19.0/drivers/md/dm-clone-target.c @@ -2035,7 +2035,7 @@ reason = "max discard sectors smaller than a region"; if (reason) { - DMWARN("Destination device (%pd) %s: Disabling discard passdown.", + DMWARN("Destination device (%pg) %s: Disabling discard passdown.", dest_dev, reason); clear_bit(DM_CLONE_DISCARD_PASSDOWN, &clone->flags); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/cec/platform/cros-ec/cros-ec-cec.c +++ linux-kvm-5.19.0/drivers/media/cec/platform/cros-ec/cros-ec-cec.c @@ -44,6 +44,8 @@ uint8_t *cec_message = cros_ec->event_data.data.cec_message; unsigned int len = cros_ec->event_size; + if (len > CEC_MAX_MSG_SIZE) + len = CEC_MAX_MSG_SIZE; cros_ec_cec->rx_msg.len = len; memcpy(cros_ec_cec->rx_msg.msg, cec_message, len); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/cec/platform/s5p/s5p_cec.c +++ linux-kvm-5.19.0/drivers/media/cec/platform/s5p/s5p_cec.c @@ -115,6 +115,8 @@ dev_dbg(cec->dev, "Buffer overrun (worker did not process previous message)\n"); cec->rx = STATE_BUSY; cec->msg.len = status >> 24; + if (cec->msg.len > CEC_MAX_MSG_SIZE) + cec->msg.len = CEC_MAX_MSG_SIZE; cec->msg.rx_status = CEC_RX_STATUS_OK; s5p_cec_get_rx_buf(cec, cec->msg.len, cec->msg.msg); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/dvb-frontends/drxk_hard.c +++ linux-kvm-5.19.0/drivers/media/dvb-frontends/drxk_hard.c @@ -6660,7 +6660,7 @@ static int drxk_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { struct drxk_state *state = fe->demodulator_priv; - u16 err; + u16 err = 0; dprintk(1, "\n"); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/i2c/ov8865.c +++ linux-kvm-5.19.0/drivers/media/i2c/ov8865.c @@ -3034,11 +3034,13 @@ &rate); if (!ret && sensor->extclk) { ret = clk_set_rate(sensor->extclk, rate); - if (ret) - return dev_err_probe(dev, ret, - "failed to set clock rate\n"); + if (ret) { + dev_err_probe(dev, ret, "failed to set clock rate\n"); + goto error_endpoint; + } } else if (ret && !sensor->extclk) { - return dev_err_probe(dev, ret, "invalid clock config\n"); + dev_err_probe(dev, ret, "invalid clock config\n"); + goto error_endpoint; } sensor->extclk_rate = rate ? rate : clk_get_rate(sensor->extclk); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/qcom/venus/helpers.c +++ linux-kvm-5.19.0/drivers/media/platform/qcom/venus/helpers.c @@ -1802,7 +1802,7 @@ struct venus_core *core = inst->core; u32 fmt = to_hfi_raw_fmt(v4l2_pixfmt); struct hfi_plat_caps *caps; - u32 buftype; + bool found; if (!fmt) return false; @@ -1811,12 +1811,13 @@ if (!caps) return false; - if (inst->session_type == VIDC_SESSION_TYPE_DEC) - buftype = HFI_BUFFER_OUTPUT2; - else - buftype = HFI_BUFFER_OUTPUT; + found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT, fmt); + if (found) + goto done; - return find_fmt_from_caps(caps, buftype, fmt); + found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT2, fmt); +done: + return found; } EXPORT_SYMBOL_GPL(venus_helper_check_format); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/qcom/venus/vdec.c +++ linux-kvm-5.19.0/drivers/media/platform/qcom/venus/vdec.c @@ -183,6 +183,8 @@ else return NULL; fmt = find_format(inst, pixmp->pixelformat, f->type); + if (!fmt) + return NULL; } pixmp->width = clamp(pixmp->width, frame_width_min(inst), only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +++ linux-kvm-5.19.0/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c @@ -1291,11 +1291,12 @@ struct rkisp1_capture *cap = video_get_drvdata(vdev); const struct rkisp1_capture_fmt_cfg *fmt = rkisp1_find_fmt_cfg(cap, cap->pix.fmt.pixelformat); - struct v4l2_subdev_format sd_fmt; + struct v4l2_subdev_format sd_fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .pad = link->source->index, + }; int ret; - sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; - sd_fmt.pad = link->source->index; ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt); if (ret) return ret; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c +++ linux-kvm-5.19.0/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c @@ -347,7 +347,7 @@ RKISP1_CIF_ISP_LSC_XSIZE_01 + i * 4); /* program x grad tables */ - data = RKISP1_CIF_ISP_LSC_SECT_SIZE(arg->x_grad_tbl[i * 2], + data = RKISP1_CIF_ISP_LSC_SECT_GRAD(arg->x_grad_tbl[i * 2], arg->x_grad_tbl[i * 2 + 1]); rkisp1_write(params->rkisp1, data, RKISP1_CIF_ISP_LSC_XGRAD_01 + i * 4); @@ -359,7 +359,7 @@ RKISP1_CIF_ISP_LSC_YSIZE_01 + i * 4); /* program y grad tables */ - data = RKISP1_CIF_ISP_LSC_SECT_SIZE(arg->y_grad_tbl[i * 2], + data = RKISP1_CIF_ISP_LSC_SECT_GRAD(arg->y_grad_tbl[i * 2], arg->y_grad_tbl[i * 2 + 1]); rkisp1_write(params->rkisp1, data, RKISP1_CIF_ISP_LSC_YGRAD_01 + i * 4); @@ -1072,7 +1072,7 @@ } } -static void rkisp1_csm_config(struct rkisp1_params *params, bool full_range) +static void rkisp1_csm_config(struct rkisp1_params *params) { static const u16 full_range_coeff[] = { 0x0026, 0x004b, 0x000f, @@ -1086,7 +1086,7 @@ }; unsigned int i; - if (full_range) { + if (params->quantization == V4L2_QUANTIZATION_FULL_RANGE) { for (i = 0; i < ARRAY_SIZE(full_range_coeff); i++) rkisp1_write(params->rkisp1, full_range_coeff[i], RKISP1_CIF_ISP_CC_COEFF_0 + i * 4); @@ -1555,11 +1555,7 @@ rkisp1_param_set_bits(params, RKISP1_CIF_ISP_HIST_PROP_V10, rkisp1_hst_params_default_config.mode); - /* set the range */ - if (params->quantization == V4L2_QUANTIZATION_FULL_RANGE) - rkisp1_csm_config(params, true); - else - rkisp1_csm_config(params, false); + rkisp1_csm_config(params); spin_lock_irq(¶ms->config_lock); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h +++ linux-kvm-5.19.0/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h @@ -567,7 +567,7 @@ (((v0) & 0x1FFF) | (((v1) & 0x1FFF) << 13)) #define RKISP1_CIF_ISP_LSC_SECT_SIZE(v0, v1) \ (((v0) & 0xFFF) | (((v1) & 0xFFF) << 16)) -#define RKISP1_CIF_ISP_LSC_GRAD_SIZE(v0, v1) \ +#define RKISP1_CIF_ISP_LSC_SECT_GRAD(v0, v1) \ (((v0) & 0xFFF) | (((v1) & 0xFFF) << 16)) /* LSC: ISP_LSC_TABLE_SEL */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c +++ linux-kvm-5.19.0/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c @@ -510,6 +510,10 @@ sink_fmt->height = RKISP1_DEFAULT_HEIGHT; sink_fmt->field = V4L2_FIELD_NONE; sink_fmt->code = RKISP1_DEF_FMT; + sink_fmt->colorspace = V4L2_COLORSPACE_SRGB; + sink_fmt->xfer_func = V4L2_XFER_FUNC_SRGB; + sink_fmt->ycbcr_enc = V4L2_YCBCR_ENC_601; + sink_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE; sink_crop = v4l2_subdev_get_try_crop(sd, sd_state, RKISP1_RSZ_PAD_SINK); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/sunxi/sun4i-csi/Kconfig +++ linux-kvm-5.19.0/drivers/media/platform/sunxi/sun4i-csi/Kconfig @@ -3,7 +3,7 @@ config VIDEO_SUN4I_CSI tristate "Allwinner A10 CMOS Sensor Interface Support" depends on V4L_PLATFORM_DRIVERS - depends on VIDEO_DEV && COMMON_CLK && HAS_DMA + depends on VIDEO_DEV && COMMON_CLK && RESET_CONTROLLER && HAS_DMA depends on ARCH_SUNXI || COMPILE_TEST select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/sunxi/sun6i-csi/Kconfig +++ linux-kvm-5.19.0/drivers/media/platform/sunxi/sun6i-csi/Kconfig @@ -2,7 +2,7 @@ config VIDEO_SUN6I_CSI tristate "Allwinner V3s Camera Sensor Interface driver" depends on V4L_PLATFORM_DRIVERS - depends on VIDEO_DEV && COMMON_CLK && HAS_DMA + depends on VIDEO_DEV && COMMON_CLK && RESET_CONTROLLER && HAS_DMA depends on ARCH_SUNXI || COMPILE_TEST select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/sunxi/sun8i-di/Kconfig +++ linux-kvm-5.19.0/drivers/media/platform/sunxi/sun8i-di/Kconfig @@ -4,7 +4,7 @@ depends on V4L_MEM2MEM_DRIVERS depends on VIDEO_DEV depends on ARCH_SUNXI || COMPILE_TEST - depends on COMMON_CLK && OF + depends on COMMON_CLK && RESET_CONTROLLER && OF depends on PM select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/platform/sunxi/sun8i-rotate/Kconfig +++ linux-kvm-5.19.0/drivers/media/platform/sunxi/sun8i-rotate/Kconfig @@ -5,7 +5,7 @@ depends on V4L_MEM2MEM_DRIVERS depends on VIDEO_DEV depends on ARCH_SUNXI || COMPILE_TEST - depends on COMMON_CLK && OF + depends on COMMON_CLK && RESET_CONTROLLER && OF depends on PM select VIDEOBUF2_DMA_CONTIG select V4L2_MEM2MEM_DEV only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/test-drivers/vivid/vivid-core.c +++ linux-kvm-5.19.0/drivers/media/test-drivers/vivid/vivid-core.c @@ -339,6 +339,28 @@ return vivid_vid_out_g_fbuf(file, fh, a); } +/* + * Only support the framebuffer of one of the vivid instances. + * Anything else is rejected. + */ +bool vivid_validate_fb(const struct v4l2_framebuffer *a) +{ + struct vivid_dev *dev; + int i; + + for (i = 0; i < n_devs; i++) { + dev = vivid_devs[i]; + if (!dev || !dev->video_pbase) + continue; + if ((unsigned long)a->base == dev->video_pbase && + a->fmt.width <= dev->display_width && + a->fmt.height <= dev->display_height && + a->fmt.bytesperline <= dev->display_byte_stride) + return true; + } + return false; +} + static int vidioc_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffer *a) { struct video_device *vdev = video_devdata(file); @@ -920,8 +942,12 @@ /* how many inputs do we have and of what type? */ dev->num_inputs = num_inputs[inst]; - if (dev->num_inputs < 1) - dev->num_inputs = 1; + if (node_type & 0x20007) { + if (dev->num_inputs < 1) + dev->num_inputs = 1; + } else { + dev->num_inputs = 0; + } if (dev->num_inputs >= MAX_INPUTS) dev->num_inputs = MAX_INPUTS; for (i = 0; i < dev->num_inputs; i++) { @@ -938,8 +964,12 @@ /* how many outputs do we have and of what type? */ dev->num_outputs = num_outputs[inst]; - if (dev->num_outputs < 1) - dev->num_outputs = 1; + if (node_type & 0x40300) { + if (dev->num_outputs < 1) + dev->num_outputs = 1; + } else { + dev->num_outputs = 0; + } if (dev->num_outputs >= MAX_OUTPUTS) dev->num_outputs = MAX_OUTPUTS; for (i = 0; i < dev->num_outputs; i++) { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/test-drivers/vivid/vivid-core.h +++ linux-kvm-5.19.0/drivers/media/test-drivers/vivid/vivid-core.h @@ -610,4 +610,6 @@ return dev->output_type[dev->output] == HDMI; } +bool vivid_validate_fb(const struct v4l2_framebuffer *a); + #endif only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/test-drivers/vivid/vivid-vid-cap.c +++ linux-kvm-5.19.0/drivers/media/test-drivers/vivid/vivid-vid-cap.c @@ -452,6 +452,12 @@ tpg_reset_source(&dev->tpg, dev->src_rect.width, dev->src_rect.height, dev->field_cap); dev->crop_cap = dev->src_rect; dev->crop_bounds_cap = dev->src_rect; + if (dev->bitmap_cap && + (dev->compose_cap.width != dev->crop_cap.width || + dev->compose_cap.height != dev->crop_cap.height)) { + vfree(dev->bitmap_cap); + dev->bitmap_cap = NULL; + } dev->compose_cap = dev->crop_cap; if (V4L2_FIELD_HAS_T_OR_B(dev->field_cap)) dev->compose_cap.height /= 2; @@ -909,6 +915,8 @@ struct vivid_dev *dev = video_drvdata(file); struct v4l2_rect *crop = &dev->crop_cap; struct v4l2_rect *compose = &dev->compose_cap; + unsigned orig_compose_w = compose->width; + unsigned orig_compose_h = compose->height; unsigned factor = V4L2_FIELD_HAS_T_OR_B(dev->field_cap) ? 2 : 1; int ret; @@ -1025,17 +1033,17 @@ s->r.height /= factor; } v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect); - if (dev->bitmap_cap && (compose->width != s->r.width || - compose->height != s->r.height)) { - vfree(dev->bitmap_cap); - dev->bitmap_cap = NULL; - } *compose = s->r; break; default: return -EINVAL; } + if (dev->bitmap_cap && (compose->width != orig_compose_w || + compose->height != orig_compose_h)) { + vfree(dev->bitmap_cap); + dev->bitmap_cap = NULL; + } tpg_s_crop_compose(&dev->tpg, crop, compose); return 0; } @@ -1272,7 +1280,14 @@ return -EINVAL; if (a->fmt.bytesperline < (a->fmt.width * fmt->bit_depth[0]) / 8) return -EINVAL; - if (a->fmt.height * a->fmt.bytesperline < a->fmt.sizeimage) + if (a->fmt.bytesperline > a->fmt.sizeimage / a->fmt.height) + return -EINVAL; + + /* + * Only support the framebuffer of one of the vivid instances. + * Anything else is rejected. + */ + if (!vivid_validate_fb(a)) return -EINVAL; dev->fb_vbase_cap = phys_to_virt((unsigned long)a->base); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/media/v4l2-core/v4l2-dv-timings.c +++ linux-kvm-5.19.0/drivers/media/v4l2-core/v4l2-dv-timings.c @@ -161,6 +161,20 @@ (bt->interlaced && !(caps & V4L2_DV_BT_CAP_INTERLACED)) || (!bt->interlaced && !(caps & V4L2_DV_BT_CAP_PROGRESSIVE))) return false; + + /* sanity checks for the blanking timings */ + if (!bt->interlaced && + (bt->il_vbackporch || bt->il_vsync || bt->il_vfrontporch)) + return false; + if (bt->hfrontporch > 2 * bt->width || + bt->hsync > 1024 || bt->hbackporch > 1024) + return false; + if (bt->vfrontporch > 4096 || + bt->vsync > 128 || bt->vbackporch > 4096) + return false; + if (bt->interlaced && (bt->il_vfrontporch > 4096 || + bt->il_vsync > 128 || bt->il_vbackporch > 4096)) + return false; return fnc == NULL || fnc(t, fnc_handle); } EXPORT_SYMBOL_GPL(v4l2_valid_dv_timings); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/mmc/core/sdio_bus.c +++ linux-kvm-5.19.0/drivers/mmc/core/sdio_bus.c @@ -291,7 +291,8 @@ { struct sdio_func *func = dev_to_sdio_func(dev); - sdio_free_func_cis(func); + if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO)) + sdio_free_func_cis(func); kfree(func->info); kfree(func->tmpbuf); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/mmc/host/Kconfig +++ linux-kvm-5.19.0/drivers/mmc/host/Kconfig @@ -1072,9 +1072,10 @@ config MMC_SDHCI_AM654 tristate "Support for the SDHCI Controller in TI's AM654 SOCs" - depends on MMC_SDHCI_PLTFM && OF && REGMAP_MMIO + depends on MMC_SDHCI_PLTFM && OF select MMC_SDHCI_IO_ACCESSORS select MMC_CQHCI + select REGMAP_MMIO help This selects the Secure Digital Host Controller Interface (SDHCI) support present in TI's AM654 SOCs. The controller supports only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/mmc/host/sdhci-esdhc-imx.c +++ linux-kvm-5.19.0/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1660,6 +1660,10 @@ host->mmc_host_ops.execute_tuning = usdhc_execute_tuning; } + err = sdhci_esdhc_imx_probe_dt(pdev, host, imx_data); + if (err) + goto disable_ahb_clk; + if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) sdhci_esdhc_ops.platform_execute_tuning = esdhc_executing_tuning; @@ -1667,13 +1671,15 @@ if (imx_data->socdata->flags & ESDHC_FLAG_ERR004536) host->quirks |= SDHCI_QUIRK_BROKEN_ADMA; - if (imx_data->socdata->flags & ESDHC_FLAG_HS400) + if (host->caps & MMC_CAP_8_BIT_DATA && + imx_data->socdata->flags & ESDHC_FLAG_HS400) host->mmc->caps2 |= MMC_CAP2_HS400; if (imx_data->socdata->flags & ESDHC_FLAG_BROKEN_AUTO_CMD23) host->quirks2 |= SDHCI_QUIRK2_ACMD23_BROKEN; - if (imx_data->socdata->flags & ESDHC_FLAG_HS400_ES) { + if (host->caps & MMC_CAP_8_BIT_DATA && + imx_data->socdata->flags & ESDHC_FLAG_HS400_ES) { host->mmc->caps2 |= MMC_CAP2_HS400_ES; host->mmc_host_ops.hs400_enhanced_strobe = esdhc_hs400_enhanced_strobe; @@ -1695,10 +1701,6 @@ goto disable_ahb_clk; } - err = sdhci_esdhc_imx_probe_dt(pdev, host, imx_data); - if (err) - goto disable_ahb_clk; - sdhci_esdhc_imx_hwinit(host); err = sdhci_add_host(host); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/mmc/host/sdhci-msm.c +++ linux-kvm-5.19.0/drivers/mmc/host/sdhci-msm.c @@ -2462,6 +2462,7 @@ {.compatible = "qcom,sm8250-sdhci", .data = &sdhci_msm_v5_var}, {.compatible = "qcom,sc7280-sdhci", .data = &sdhci_msm_v5_var}, /* Add entries where soc specific handling is required, here */ + {.compatible = "qcom,sdm670-sdhci", .data = &sdm845_sdhci_var}, {.compatible = "qcom,sdm845-sdhci", .data = &sdm845_sdhci_var}, {.compatible = "qcom,sc7180-sdhci", .data = &sdm845_sdhci_var}, {}, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/mmc/host/sdhci-pci-core.c +++ linux-kvm-5.19.0/drivers/mmc/host/sdhci-pci-core.c @@ -893,6 +893,12 @@ dmi_match(DMI_SYS_VENDOR, "IRBIS")); } +static bool jsl_broken_hs400es(struct sdhci_pci_slot *slot) +{ + return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_JSL_EMMC && + dmi_match(DMI_BIOS_VENDOR, "ASUSTeK COMPUTER INC."); +} + static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot) { int ret = byt_emmc_probe_slot(slot); @@ -901,9 +907,11 @@ slot->host->mmc->caps2 |= MMC_CAP2_CQE; if (slot->chip->pdev->device != PCI_DEVICE_ID_INTEL_GLK_EMMC) { - slot->host->mmc->caps2 |= MMC_CAP2_HS400_ES; - slot->host->mmc_host_ops.hs400_enhanced_strobe = - intel_hs400_enhanced_strobe; + if (!jsl_broken_hs400es(slot)) { + slot->host->mmc->caps2 |= MMC_CAP2_HS400_ES; + slot->host->mmc_host_ops.hs400_enhanced_strobe = + intel_hs400_enhanced_strobe; + } slot->host->mmc->caps2 |= MMC_CAP2_CQE_DCMD; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/mtd/nand/raw/marvell_nand.c +++ linux-kvm-5.19.0/drivers/mtd/nand/raw/marvell_nand.c @@ -2672,7 +2672,7 @@ chip->controller = &nfc->controller; nand_set_flash_node(chip, np); - if (!of_property_read_bool(np, "marvell,nand-keep-config")) + if (of_property_read_bool(np, "marvell,nand-keep-config")) chip->options |= NAND_KEEP_TIMINGS; mtd = nand_to_mtd(chip); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/mtd/nand/raw/tegra_nand.c +++ linux-kvm-5.19.0/drivers/mtd/nand/raw/tegra_nand.c @@ -1181,7 +1181,7 @@ pm_runtime_enable(&pdev->dev); err = pm_runtime_resume_and_get(&pdev->dev); if (err) - return err; + goto err_dis_pm; err = reset_control_reset(rst); if (err) { @@ -1215,6 +1215,8 @@ err_put_pm: pm_runtime_put_sync_suspend(ctrl->dev); pm_runtime_force_suspend(ctrl->dev); +err_dis_pm: + pm_runtime_disable(&pdev->dev); return err; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/mtd/parsers/bcm47xxpart.c +++ linux-kvm-5.19.0/drivers/mtd/parsers/bcm47xxpart.c @@ -233,11 +233,11 @@ } /* Read middle of the block */ - err = mtd_read(master, offset + 0x8000, 0x4, &bytes_read, + err = mtd_read(master, offset + (blocksize / 2), 0x4, &bytes_read, (uint8_t *)buf); if (err && !mtd_is_bitflip(err)) { pr_err("mtd_read error while parsing (offset: 0x%X): %d\n", - offset + 0x8000, err); + offset + (blocksize / 2), err); continue; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/can/mscan/mpc5xxx_can.c +++ linux-kvm-5.19.0/drivers/net/can/mscan/mpc5xxx_can.c @@ -322,14 +322,14 @@ &mscan_clksrc); if (!priv->can.clock.freq) { dev_err(&ofdev->dev, "couldn't get MSCAN clock properties\n"); - goto exit_free_mscan; + goto exit_put_clock; } err = register_mscandev(dev, mscan_clksrc); if (err) { dev_err(&ofdev->dev, "registering %s failed (err=%d)\n", DRV_NAME, err); - goto exit_free_mscan; + goto exit_put_clock; } dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n", @@ -337,7 +337,9 @@ return 0; -exit_free_mscan: +exit_put_clock: + if (data->put_clock) + data->put_clock(ofdev); free_candev(dev); exit_dispose_irq: irq_dispose_mapping(irq); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/can/rcar/rcar_canfd.c +++ linux-kvm-5.19.0/drivers/net/can/rcar/rcar_canfd.c @@ -1156,11 +1156,13 @@ { struct rcar_canfd_channel *priv = gpriv->ch[ch]; u32 ridx = ch + RCANFD_RFFIFO_IDX; - u32 sts; + u32 sts, cc; /* Handle Rx interrupts */ sts = rcar_canfd_read(priv->base, RCANFD_RFSTS(gpriv, ridx)); - if (likely(sts & RCANFD_RFSTS_RFIF)) { + cc = rcar_canfd_read(priv->base, RCANFD_RFCC(gpriv, ridx)); + if (likely(sts & RCANFD_RFSTS_RFIF && + cc & RCANFD_RFCC_RFIE)) { if (napi_schedule_prep(&priv->napi)) { /* Disable Rx FIFO interrupts */ rcar_canfd_clear_bit(priv->base, @@ -1243,11 +1245,9 @@ static irqreturn_t rcar_canfd_channel_tx_interrupt(int irq, void *dev_id) { - struct rcar_canfd_global *gpriv = dev_id; - u32 ch; + struct rcar_canfd_channel *priv = dev_id; - for_each_set_bit(ch, &gpriv->channels_mask, gpriv->max_channels) - rcar_canfd_handle_channel_tx(gpriv, ch); + rcar_canfd_handle_channel_tx(priv->gpriv, priv->channel); return IRQ_HANDLED; } @@ -1275,11 +1275,9 @@ static irqreturn_t rcar_canfd_channel_err_interrupt(int irq, void *dev_id) { - struct rcar_canfd_global *gpriv = dev_id; - u32 ch; + struct rcar_canfd_channel *priv = dev_id; - for_each_set_bit(ch, &gpriv->channels_mask, gpriv->max_channels) - rcar_canfd_handle_channel_err(gpriv, ch); + rcar_canfd_handle_channel_err(priv->gpriv, priv->channel); return IRQ_HANDLED; } @@ -1715,6 +1713,7 @@ priv->ndev = ndev; priv->base = gpriv->base; priv->channel = ch; + priv->gpriv = gpriv; priv->can.clock.freq = fcan_freq; dev_info(&pdev->dev, "can_clk rate is %u\n", priv->can.clock.freq); @@ -1743,7 +1742,7 @@ } err = devm_request_irq(&pdev->dev, err_irq, rcar_canfd_channel_err_interrupt, 0, - irq_name, gpriv); + irq_name, priv); if (err) { dev_err(&pdev->dev, "devm_request_irq CH Err(%d) failed, error %d\n", err_irq, err); @@ -1757,7 +1756,7 @@ } err = devm_request_irq(&pdev->dev, tx_irq, rcar_canfd_channel_tx_interrupt, 0, - irq_name, gpriv); + irq_name, priv); if (err) { dev_err(&pdev->dev, "devm_request_irq Tx (%d) failed, error %d\n", tx_irq, err); @@ -1783,7 +1782,6 @@ priv->can.do_set_mode = rcar_canfd_do_set_mode; priv->can.do_get_berr_counter = rcar_canfd_get_berr_counter; - priv->gpriv = gpriv; SET_NETDEV_DEV(ndev, &pdev->dev); netif_napi_add_weight(ndev, &priv->napi, rcar_canfd_rx_poll, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/dsa/dsa_loop.c +++ linux-kvm-5.19.0/drivers/net/dsa/dsa_loop.c @@ -378,6 +378,17 @@ #define NUM_FIXED_PHYS (DSA_LOOP_NUM_PORTS - 2) +static void dsa_loop_phydevs_unregister(void) +{ + unsigned int i; + + for (i = 0; i < NUM_FIXED_PHYS; i++) + if (!IS_ERR(phydevs[i])) { + fixed_phy_unregister(phydevs[i]); + phy_device_free(phydevs[i]); + } +} + static int __init dsa_loop_init(void) { struct fixed_phy_status status = { @@ -385,23 +396,23 @@ .speed = SPEED_100, .duplex = DUPLEX_FULL, }; - unsigned int i; + unsigned int i, ret; for (i = 0; i < NUM_FIXED_PHYS; i++) phydevs[i] = fixed_phy_register(PHY_POLL, &status, NULL); - return mdio_driver_register(&dsa_loop_drv); + ret = mdio_driver_register(&dsa_loop_drv); + if (ret) + dsa_loop_phydevs_unregister(); + + return ret; } module_init(dsa_loop_init); static void __exit dsa_loop_exit(void) { - unsigned int i; - mdio_driver_unregister(&dsa_loop_drv); - for (i = 0; i < NUM_FIXED_PHYS; i++) - if (!IS_ERR(phydevs[i])) - fixed_phy_unregister(phydevs[i]); + dsa_loop_phydevs_unregister(); } module_exit(dsa_loop_exit); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/amd/xgbe/xgbe-pci.c +++ linux-kvm-5.19.0/drivers/net/ethernet/amd/xgbe/xgbe-pci.c @@ -285,6 +285,9 @@ /* Yellow Carp devices do not need cdr workaround */ pdata->vdata->an_cdr_workaround = 0; + + /* Yellow Carp devices do not need rrc */ + pdata->vdata->enable_rrc = 0; } else { pdata->xpcs_window_def_reg = PCS_V2_WINDOW_DEF; pdata->xpcs_window_sel_reg = PCS_V2_WINDOW_SELECT; @@ -483,6 +486,7 @@ .tx_desc_prefetch = 5, .rx_desc_prefetch = 5, .an_cdr_workaround = 1, + .enable_rrc = 1, }; static struct xgbe_version_data xgbe_v2b = { @@ -498,6 +502,7 @@ .tx_desc_prefetch = 5, .rx_desc_prefetch = 5, .an_cdr_workaround = 1, + .enable_rrc = 1, }; static const struct pci_device_id xgbe_pci_table[] = { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ linux-kvm-5.19.0/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -239,6 +239,7 @@ #define XGBE_SFP_BASE_BR_1GBE_MAX 0x0d #define XGBE_SFP_BASE_BR_10GBE_MIN 0x64 #define XGBE_SFP_BASE_BR_10GBE_MAX 0x68 +#define XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX 0x78 #define XGBE_SFP_BASE_CU_CABLE_LEN 18 @@ -284,6 +285,8 @@ #define XGBE_BEL_FUSE_VENDOR "BEL-FUSE " #define XGBE_BEL_FUSE_PARTNO "1GBT-SFP06 " +#define XGBE_MOLEX_VENDOR "Molex Inc. " + struct xgbe_sfp_ascii { union { char vendor[XGBE_SFP_BASE_VENDOR_NAME_LEN + 1]; @@ -834,7 +837,11 @@ break; case XGBE_SFP_SPEED_10000: min = XGBE_SFP_BASE_BR_10GBE_MIN; - max = XGBE_SFP_BASE_BR_10GBE_MAX; + if (memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_NAME], + XGBE_MOLEX_VENDOR, XGBE_SFP_BASE_VENDOR_NAME_LEN) == 0) + max = XGBE_MOLEX_SFP_BASE_BR_10GBE_MAX; + else + max = XGBE_SFP_BASE_BR_10GBE_MAX; break; default: return false; @@ -1151,7 +1158,10 @@ } /* Determine the type of SFP */ - if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR) + if (phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE && + xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000)) + phy_data->sfp_base = XGBE_SFP_BASE_10000_CR; + else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR) phy_data->sfp_base = XGBE_SFP_BASE_10000_SR; else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_LR) phy_data->sfp_base = XGBE_SFP_BASE_10000_LR; @@ -1167,9 +1177,6 @@ phy_data->sfp_base = XGBE_SFP_BASE_1000_CX; else if (sfp_base[XGBE_SFP_BASE_1GBE_CC] & XGBE_SFP_BASE_1GBE_CC_T) phy_data->sfp_base = XGBE_SFP_BASE_1000_T; - else if ((phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE) && - xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000)) - phy_data->sfp_base = XGBE_SFP_BASE_10000_CR; switch (phy_data->sfp_base) { case XGBE_SFP_BASE_1000_T: @@ -2640,7 +2647,7 @@ } /* No link, attempt a receiver reset cycle */ - if (phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) { + if (pdata->vdata->enable_rrc && phy_data->rrc_count++ > XGBE_RRC_FREQUENCY) { phy_data->rrc_count = 0; xgbe_phy_rrc(pdata); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/amd/xgbe/xgbe.h +++ linux-kvm-5.19.0/drivers/net/ethernet/amd/xgbe/xgbe.h @@ -1013,6 +1013,7 @@ unsigned int tx_desc_prefetch; unsigned int rx_desc_prefetch; unsigned int an_cdr_workaround; + unsigned int enable_rrc; }; struct xgbe_prv_data { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c +++ linux-kvm-5.19.0/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c @@ -1451,26 +1451,57 @@ egress_sa_threshold_expired); } +#define AQ_LOCKED_MDO_DEF(mdo) \ +static int aq_locked_mdo_##mdo(struct macsec_context *ctx) \ +{ \ + struct aq_nic_s *nic = netdev_priv(ctx->netdev); \ + int ret; \ + mutex_lock(&nic->macsec_mutex); \ + ret = aq_mdo_##mdo(ctx); \ + mutex_unlock(&nic->macsec_mutex); \ + return ret; \ +} + +AQ_LOCKED_MDO_DEF(dev_open) +AQ_LOCKED_MDO_DEF(dev_stop) +AQ_LOCKED_MDO_DEF(add_secy) +AQ_LOCKED_MDO_DEF(upd_secy) +AQ_LOCKED_MDO_DEF(del_secy) +AQ_LOCKED_MDO_DEF(add_rxsc) +AQ_LOCKED_MDO_DEF(upd_rxsc) +AQ_LOCKED_MDO_DEF(del_rxsc) +AQ_LOCKED_MDO_DEF(add_rxsa) +AQ_LOCKED_MDO_DEF(upd_rxsa) +AQ_LOCKED_MDO_DEF(del_rxsa) +AQ_LOCKED_MDO_DEF(add_txsa) +AQ_LOCKED_MDO_DEF(upd_txsa) +AQ_LOCKED_MDO_DEF(del_txsa) +AQ_LOCKED_MDO_DEF(get_dev_stats) +AQ_LOCKED_MDO_DEF(get_tx_sc_stats) +AQ_LOCKED_MDO_DEF(get_tx_sa_stats) +AQ_LOCKED_MDO_DEF(get_rx_sc_stats) +AQ_LOCKED_MDO_DEF(get_rx_sa_stats) + const struct macsec_ops aq_macsec_ops = { - .mdo_dev_open = aq_mdo_dev_open, - .mdo_dev_stop = aq_mdo_dev_stop, - .mdo_add_secy = aq_mdo_add_secy, - .mdo_upd_secy = aq_mdo_upd_secy, - .mdo_del_secy = aq_mdo_del_secy, - .mdo_add_rxsc = aq_mdo_add_rxsc, - .mdo_upd_rxsc = aq_mdo_upd_rxsc, - .mdo_del_rxsc = aq_mdo_del_rxsc, - .mdo_add_rxsa = aq_mdo_add_rxsa, - .mdo_upd_rxsa = aq_mdo_upd_rxsa, - .mdo_del_rxsa = aq_mdo_del_rxsa, - .mdo_add_txsa = aq_mdo_add_txsa, - .mdo_upd_txsa = aq_mdo_upd_txsa, - .mdo_del_txsa = aq_mdo_del_txsa, - .mdo_get_dev_stats = aq_mdo_get_dev_stats, - .mdo_get_tx_sc_stats = aq_mdo_get_tx_sc_stats, - .mdo_get_tx_sa_stats = aq_mdo_get_tx_sa_stats, - .mdo_get_rx_sc_stats = aq_mdo_get_rx_sc_stats, - .mdo_get_rx_sa_stats = aq_mdo_get_rx_sa_stats, + .mdo_dev_open = aq_locked_mdo_dev_open, + .mdo_dev_stop = aq_locked_mdo_dev_stop, + .mdo_add_secy = aq_locked_mdo_add_secy, + .mdo_upd_secy = aq_locked_mdo_upd_secy, + .mdo_del_secy = aq_locked_mdo_del_secy, + .mdo_add_rxsc = aq_locked_mdo_add_rxsc, + .mdo_upd_rxsc = aq_locked_mdo_upd_rxsc, + .mdo_del_rxsc = aq_locked_mdo_del_rxsc, + .mdo_add_rxsa = aq_locked_mdo_add_rxsa, + .mdo_upd_rxsa = aq_locked_mdo_upd_rxsa, + .mdo_del_rxsa = aq_locked_mdo_del_rxsa, + .mdo_add_txsa = aq_locked_mdo_add_txsa, + .mdo_upd_txsa = aq_locked_mdo_upd_txsa, + .mdo_del_txsa = aq_locked_mdo_del_txsa, + .mdo_get_dev_stats = aq_locked_mdo_get_dev_stats, + .mdo_get_tx_sc_stats = aq_locked_mdo_get_tx_sc_stats, + .mdo_get_tx_sa_stats = aq_locked_mdo_get_tx_sa_stats, + .mdo_get_rx_sc_stats = aq_locked_mdo_get_rx_sc_stats, + .mdo_get_rx_sa_stats = aq_locked_mdo_get_rx_sa_stats, }; int aq_macsec_init(struct aq_nic_s *nic) @@ -1492,6 +1523,7 @@ nic->ndev->features |= NETIF_F_HW_MACSEC; nic->ndev->macsec_ops = &aq_macsec_ops; + mutex_init(&nic->macsec_mutex); return 0; } @@ -1515,7 +1547,7 @@ if (!nic->macsec_cfg) return 0; - rtnl_lock(); + mutex_lock(&nic->macsec_mutex); if (nic->aq_fw_ops->send_macsec_req) { struct macsec_cfg_request cfg = { 0 }; @@ -1564,7 +1596,7 @@ ret = aq_apply_macsec_cfg(nic); unlock: - rtnl_unlock(); + mutex_unlock(&nic->macsec_mutex); return ret; } @@ -1576,9 +1608,9 @@ if (!netif_carrier_ok(nic->ndev)) return; - rtnl_lock(); + mutex_lock(&nic->macsec_mutex); aq_check_txsa_expiration(nic); - rtnl_unlock(); + mutex_unlock(&nic->macsec_mutex); } int aq_macsec_rx_sa_cnt(struct aq_nic_s *nic) @@ -1589,21 +1621,30 @@ if (!cfg) return 0; + mutex_lock(&nic->macsec_mutex); + for (i = 0; i < AQ_MACSEC_MAX_SC; i++) { if (!test_bit(i, &cfg->rxsc_idx_busy)) continue; cnt += hweight_long(cfg->aq_rxsc[i].rx_sa_idx_busy); } + mutex_unlock(&nic->macsec_mutex); return cnt; } int aq_macsec_tx_sc_cnt(struct aq_nic_s *nic) { + int cnt; + if (!nic->macsec_cfg) return 0; - return hweight_long(nic->macsec_cfg->txsc_idx_busy); + mutex_lock(&nic->macsec_mutex); + cnt = hweight_long(nic->macsec_cfg->txsc_idx_busy); + mutex_unlock(&nic->macsec_mutex); + + return cnt; } int aq_macsec_tx_sa_cnt(struct aq_nic_s *nic) @@ -1614,12 +1655,15 @@ if (!cfg) return 0; + mutex_lock(&nic->macsec_mutex); + for (i = 0; i < AQ_MACSEC_MAX_SC; i++) { if (!test_bit(i, &cfg->txsc_idx_busy)) continue; cnt += hweight_long(cfg->aq_txsc[i].tx_sa_idx_busy); } + mutex_unlock(&nic->macsec_mutex); return cnt; } @@ -1691,6 +1735,8 @@ if (!cfg) return data; + mutex_lock(&nic->macsec_mutex); + aq_macsec_update_stats(nic); common_stats = &cfg->stats; @@ -1773,5 +1819,7 @@ data += i; + mutex_unlock(&nic->macsec_mutex); + return data; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/aquantia/atlantic/aq_nic.h +++ linux-kvm-5.19.0/drivers/net/ethernet/aquantia/atlantic/aq_nic.h @@ -157,6 +157,8 @@ struct mutex fwreq_mutex; #if IS_ENABLED(CONFIG_MACSEC) struct aq_macsec_cfg *macsec_cfg; + /* mutex to protect data in macsec_cfg */ + struct mutex macsec_mutex; #endif /* PTP support */ struct aq_ptp_s *aq_ptp; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/broadcom/bcm4908_enet.c +++ linux-kvm-5.19.0/drivers/net/ethernet/broadcom/bcm4908_enet.c @@ -561,8 +561,6 @@ if (++ring->write_idx == ring->length - 1) ring->write_idx = 0; - enet->netdev->stats.tx_bytes += skb->len; - enet->netdev->stats.tx_packets++; return NETDEV_TX_OK; } @@ -635,6 +633,7 @@ struct bcm4908_enet_dma_ring_bd *buf_desc; struct bcm4908_enet_dma_ring_slot *slot; struct device *dev = enet->dev; + unsigned int bytes = 0; int handled = 0; while (handled < weight && tx_ring->read_idx != tx_ring->write_idx) { @@ -645,12 +644,17 @@ dma_unmap_single(dev, slot->dma_addr, slot->len, DMA_TO_DEVICE); dev_kfree_skb(slot->skb); - if (++tx_ring->read_idx == tx_ring->length) - tx_ring->read_idx = 0; handled++; + bytes += slot->len; + + if (++tx_ring->read_idx == tx_ring->length) + tx_ring->read_idx = 0; } + enet->netdev->stats.tx_packets += handled; + enet->netdev->stats.tx_bytes += bytes; + if (handled < weight) { napi_complete_done(napi, handled); bcm4908_enet_dma_ring_intrs_on(enet, tx_ring); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/broadcom/bcmsysport.c +++ linux-kvm-5.19.0/drivers/net/ethernet/broadcom/bcmsysport.c @@ -1991,6 +1991,9 @@ goto out_clk_disable; } + /* Indicate that the MAC is responsible for PHY PM */ + phydev->mac_managed_pm = true; + /* Reset house keeping link status */ priv->old_duplex = -1; priv->old_link = -1; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/faraday/ftmac100.h +++ linux-kvm-5.19.0/drivers/net/ethernet/faraday/ftmac100.h @@ -122,9 +122,9 @@ * Transmit descriptor, aligned to 16 bytes */ struct ftmac100_txdes { - unsigned int txdes0; - unsigned int txdes1; - unsigned int txdes2; /* TXBUF_BADR */ + __le32 txdes0; + __le32 txdes1; + __le32 txdes2; /* TXBUF_BADR */ unsigned int txdes3; /* not used by HW */ } __attribute__ ((aligned(16))); @@ -143,9 +143,9 @@ * Receive descriptor, aligned to 16 bytes */ struct ftmac100_rxdes { - unsigned int rxdes0; - unsigned int rxdes1; - unsigned int rxdes2; /* RXBUF_BADR */ + __le32 rxdes0; + __le32 rxdes1; + __le32 rxdes2; /* RXBUF_BADR */ unsigned int rxdes3; /* not used by HW */ } __attribute__ ((aligned(16))); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/freescale/fec_main.c +++ linux-kvm-5.19.0/drivers/net/ethernet/freescale/fec_main.c @@ -656,7 +656,7 @@ dev_kfree_skb_any(skb); if (net_ratelimit()) netdev_err(ndev, "Tx DMA memory map failed\n"); - return NETDEV_TX_BUSY; + return NETDEV_TX_OK; } bdp->cbd_datlen = cpu_to_fec16(size); @@ -718,7 +718,7 @@ dev_kfree_skb_any(skb); if (net_ratelimit()) netdev_err(ndev, "Tx DMA memory map failed\n"); - return NETDEV_TX_BUSY; + return NETDEV_TX_OK; } } @@ -2346,6 +2346,31 @@ IEEE_R_DROP, IEEE_R_FRAME_OK, IEEE_R_CRC, IEEE_R_ALIGN, IEEE_R_MACERR, IEEE_R_FDXFC, IEEE_R_OCTETS_OK }; +/* for i.MX6ul */ +static u32 fec_enet_register_offset_6ul[] = { + FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0, + FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL, + FEC_X_CNTRL, FEC_ADDR_LOW, FEC_ADDR_HIGH, FEC_OPD, FEC_TXIC0, FEC_RXIC0, + FEC_HASH_TABLE_HIGH, FEC_HASH_TABLE_LOW, FEC_GRP_HASH_TABLE_HIGH, + FEC_GRP_HASH_TABLE_LOW, FEC_X_WMRK, FEC_R_DES_START_0, + FEC_X_DES_START_0, FEC_R_BUFF_SIZE_0, FEC_R_FIFO_RSFL, FEC_R_FIFO_RSEM, + FEC_R_FIFO_RAEM, FEC_R_FIFO_RAFL, FEC_RACC, + RMON_T_DROP, RMON_T_PACKETS, RMON_T_BC_PKT, RMON_T_MC_PKT, + RMON_T_CRC_ALIGN, RMON_T_UNDERSIZE, RMON_T_OVERSIZE, RMON_T_FRAG, + RMON_T_JAB, RMON_T_COL, RMON_T_P64, RMON_T_P65TO127, RMON_T_P128TO255, + RMON_T_P256TO511, RMON_T_P512TO1023, RMON_T_P1024TO2047, + RMON_T_P_GTE2048, RMON_T_OCTETS, + IEEE_T_DROP, IEEE_T_FRAME_OK, IEEE_T_1COL, IEEE_T_MCOL, IEEE_T_DEF, + IEEE_T_LCOL, IEEE_T_EXCOL, IEEE_T_MACERR, IEEE_T_CSERR, IEEE_T_SQE, + IEEE_T_FDXFC, IEEE_T_OCTETS_OK, + RMON_R_PACKETS, RMON_R_BC_PKT, RMON_R_MC_PKT, RMON_R_CRC_ALIGN, + RMON_R_UNDERSIZE, RMON_R_OVERSIZE, RMON_R_FRAG, RMON_R_JAB, + RMON_R_RESVD_O, RMON_R_P64, RMON_R_P65TO127, RMON_R_P128TO255, + RMON_R_P256TO511, RMON_R_P512TO1023, RMON_R_P1024TO2047, + RMON_R_P_GTE2048, RMON_R_OCTETS, + IEEE_R_DROP, IEEE_R_FRAME_OK, IEEE_R_CRC, IEEE_R_ALIGN, IEEE_R_MACERR, + IEEE_R_FDXFC, IEEE_R_OCTETS_OK +}; #else static __u32 fec_enet_register_version = 1; static u32 fec_enet_register_offset[] = { @@ -2370,7 +2395,24 @@ u32 *buf = (u32 *)regbuf; u32 i, off; int ret; +#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ + defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \ + defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST) + u32 *reg_list; + u32 reg_cnt; + if (!of_machine_is_compatible("fsl,imx6ul")) { + reg_list = fec_enet_register_offset; + reg_cnt = ARRAY_SIZE(fec_enet_register_offset); + } else { + reg_list = fec_enet_register_offset_6ul; + reg_cnt = ARRAY_SIZE(fec_enet_register_offset_6ul); + } +#else + /* coldfire */ + static u32 *reg_list = fec_enet_register_offset; + static const u32 reg_cnt = ARRAY_SIZE(fec_enet_register_offset); +#endif ret = pm_runtime_resume_and_get(dev); if (ret < 0) return; @@ -2379,8 +2421,8 @@ memset(buf, 0, regs->len); - for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) { - off = fec_enet_register_offset[i]; + for (i = 0; i < reg_cnt; i++) { + off = reg_list[i]; if ((off == FEC_R_BOUND || off == FEC_R_FSTART) && !(fep->quirks & FEC_QUIRK_HAS_FRREG)) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/hisilicon/hns/hnae.c +++ linux-kvm-5.19.0/drivers/net/ethernet/hisilicon/hns/hnae.c @@ -419,8 +419,10 @@ hdev->cls_dev.release = hnae_release; (void)dev_set_name(&hdev->cls_dev, "hnae%d", hdev->id); ret = device_register(&hdev->cls_dev); - if (ret) + if (ret) { + put_device(&hdev->cls_dev); return ret; + } __module_get(THIS_MODULE); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c +++ linux-kvm-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_debugfs.c @@ -85,6 +85,7 @@ struct tag_sml_funcfg_tbl *funcfg_table_elem; struct hinic_cmd_lt_rd *read_data; u16 out_size = sizeof(*read_data); + int ret = ~0; int err; read_data = kzalloc(sizeof(*read_data), GFP_KERNEL); @@ -111,20 +112,25 @@ switch (idx) { case VALID: - return funcfg_table_elem->dw0.bs.valid; + ret = funcfg_table_elem->dw0.bs.valid; + break; case RX_MODE: - return funcfg_table_elem->dw0.bs.nic_rx_mode; + ret = funcfg_table_elem->dw0.bs.nic_rx_mode; + break; case MTU: - return funcfg_table_elem->dw1.bs.mtu; + ret = funcfg_table_elem->dw1.bs.mtu; + break; case RQ_DEPTH: - return funcfg_table_elem->dw13.bs.cfg_rq_depth; + ret = funcfg_table_elem->dw13.bs.cfg_rq_depth; + break; case QUEUE_NUM: - return funcfg_table_elem->dw13.bs.cfg_q_num; + ret = funcfg_table_elem->dw13.bs.cfg_q_num; + break; } kfree(read_data); - return ~0; + return ret; } static ssize_t hinic_dbg_cmd_read(struct file *filp, char __user *buffer, size_t count, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c +++ linux-kvm-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_hw_cmdq.c @@ -929,7 +929,7 @@ err_set_cmdq_depth: hinic_ceq_unregister_cb(&func_to_io->ceqs, HINIC_CEQ_CMDQ); - + free_cmdq(&cmdqs->cmdq[HINIC_CMDQ_SYNC]); err_cmdq_ctxt: hinic_wqs_cmdq_free(&cmdqs->cmdq_pages, cmdqs->saved_wqs, HINIC_MAX_CMDQ_TYPES); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c +++ linux-kvm-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_hw_dev.c @@ -883,7 +883,7 @@ if (err) return -EINVAL; - interrupt_info->lli_credit_cnt = temp_info.lli_timer_cnt; + interrupt_info->lli_credit_cnt = temp_info.lli_credit_cnt; interrupt_info->lli_timer_cnt = temp_info.lli_timer_cnt; err = hinic_msg_to_mgmt(&pfhwdev->pf_to_mgmt, HINIC_MOD_COMM, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/huawei/hinic/hinic_sriov.c +++ linux-kvm-5.19.0/drivers/net/ethernet/huawei/hinic/hinic_sriov.c @@ -1181,7 +1181,6 @@ dev_err(&hwdev->hwif->pdev->dev, "Failed to register VF, err: %d, status: 0x%x, out size: 0x%x\n", err, register_info.status, out_size); - hinic_unregister_vf_mbox_cb(hwdev, HINIC_MOD_L2NIC); return -EIO; } } else { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ linux-kvm-5.19.0/drivers/net/ethernet/ibm/ehea/ehea_main.c @@ -2900,6 +2900,7 @@ ret = of_device_register(&port->ofdev); if (ret) { pr_err("failed to register device. ret=%d\n", ret); + put_device(&port->ofdev.dev); goto out; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/ibm/ibmvnic.c +++ linux-kvm-5.19.0/drivers/net/ethernet/ibm/ibmvnic.c @@ -3007,19 +3007,19 @@ rwi = get_next_rwi(adapter); /* - * If there is another reset queued, free the previous rwi - * and process the new reset even if previous reset failed - * (the previous reset could have failed because of a fail - * over for instance, so process the fail over). - * * If there are no resets queued and the previous reset failed, * the adapter would be in an undefined state. So retry the * previous reset as a hard reset. + * + * Else, free the previous rwi and, if there is another reset + * queued, process the new reset even if previous reset failed + * (the previous reset could have failed because of a fail + * over for instance, so process the fail over). */ - if (rwi) - kfree(tmprwi); - else if (rc) + if (!rwi && rc) rwi = tmprwi; + else + kfree(tmprwi); if (rwi && (rwi->reset_reason == VNIC_RESET_FAILOVER || rwi->reset_reason == VNIC_RESET_MOBILITY || rc)) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/intel/i40e/i40e_txrx.h +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_txrx.h @@ -469,7 +469,6 @@ bool __i40e_chk_linearize(struct sk_buff *skb); int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames, u32 flags); -int i40e_alloc_rx_bi(struct i40e_ring *rx_ring); /** * i40e_get_head - Retrieve head from head writeback only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/intel/i40e/i40e_type.h +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_type.h @@ -1404,6 +1404,10 @@ #define I40E_PFQF_CTL_0_HASHLUTSIZE_512 0x00010000 /* INPUT SET MASK for RSS, flow director, and flexible payload */ +#define I40E_X722_L3_SRC_SHIFT 49 +#define I40E_X722_L3_SRC_MASK (0x3ULL << I40E_X722_L3_SRC_SHIFT) +#define I40E_X722_L3_DST_SHIFT 41 +#define I40E_X722_L3_DST_MASK (0x3ULL << I40E_X722_L3_DST_SHIFT) #define I40E_L3_SRC_SHIFT 47 #define I40E_L3_SRC_MASK (0x3ULL << I40E_L3_SRC_SHIFT) #define I40E_L3_V6_SRC_SHIFT 43 only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h @@ -39,6 +39,7 @@ I40E_VF_STATE_MC_PROMISC, I40E_VF_STATE_UC_PROMISC, I40E_VF_STATE_PRE_ENABLE, + I40E_VF_STATE_RESETTING }; /* VF capabilities */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -10,14 +10,6 @@ #include "i40e_txrx_common.h" #include "i40e_xsk.h" -int i40e_alloc_rx_bi_zc(struct i40e_ring *rx_ring) -{ - unsigned long sz = sizeof(*rx_ring->rx_bi_zc) * rx_ring->count; - - rx_ring->rx_bi_zc = kzalloc(sz, GFP_KERNEL); - return rx_ring->rx_bi_zc ? 0 : -ENOMEM; -} - void i40e_clear_rx_bi_zc(struct i40e_ring *rx_ring) { memset(rx_ring->rx_bi_zc, 0, @@ -30,6 +22,58 @@ } /** + * i40e_realloc_rx_xdp_bi - reallocate SW ring for either XSK or normal buffer + * @rx_ring: Current rx ring + * @pool_present: is pool for XSK present + * + * Try allocating memory and return ENOMEM, if failed to allocate. + * If allocation was successful, substitute buffer with allocated one. + * Returns 0 on success, negative on failure + */ +static int i40e_realloc_rx_xdp_bi(struct i40e_ring *rx_ring, bool pool_present) +{ + size_t elem_size = pool_present ? sizeof(*rx_ring->rx_bi_zc) : + sizeof(*rx_ring->rx_bi); + void *sw_ring = kcalloc(rx_ring->count, elem_size, GFP_KERNEL); + + if (!sw_ring) + return -ENOMEM; + + if (pool_present) { + kfree(rx_ring->rx_bi); + rx_ring->rx_bi = NULL; + rx_ring->rx_bi_zc = sw_ring; + } else { + kfree(rx_ring->rx_bi_zc); + rx_ring->rx_bi_zc = NULL; + rx_ring->rx_bi = sw_ring; + } + return 0; +} + +/** + * i40e_realloc_rx_bi_zc - reallocate rx SW rings + * @vsi: Current VSI + * @zc: is zero copy set + * + * Reallocate buffer for rx_rings that might be used by XSK. + * XDP requires more memory, than rx_buf provides. + * Returns 0 on success, negative on failure + */ +int i40e_realloc_rx_bi_zc(struct i40e_vsi *vsi, bool zc) +{ + struct i40e_ring *rx_ring; + unsigned long q; + + for_each_set_bit(q, vsi->af_xdp_zc_qps, vsi->alloc_queue_pairs) { + rx_ring = vsi->rx_rings[q]; + if (i40e_realloc_rx_xdp_bi(rx_ring, zc)) + return -ENOMEM; + } + return 0; +} + +/** * i40e_xsk_pool_enable - Enable/associate an AF_XDP buffer pool to a * certain ring/qid * @vsi: Current VSI @@ -69,6 +113,10 @@ if (err) return err; + err = i40e_realloc_rx_xdp_bi(vsi->rx_rings[qid], true); + if (err) + return err; + err = i40e_queue_pair_enable(vsi, qid); if (err) return err; @@ -113,6 +161,9 @@ xsk_pool_dma_unmap(pool, I40E_RX_DMA_ATTR); if (if_running) { + err = i40e_realloc_rx_xdp_bi(vsi->rx_rings[qid], false); + if (err) + return err; err = i40e_queue_pair_enable(vsi, qid); if (err) return err; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/intel/i40e/i40e_xsk.h +++ linux-kvm-5.19.0/drivers/net/ethernet/intel/i40e/i40e_xsk.h @@ -32,7 +32,7 @@ bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi, struct i40e_ring *tx_ring); int i40e_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags); -int i40e_alloc_rx_bi_zc(struct i40e_ring *rx_ring); +int i40e_realloc_rx_bi_zc(struct i40e_vsi *vsi, bool zc); void i40e_clear_rx_bi_zc(struct i40e_ring *rx_ring); #endif /* _I40E_XSK_H_ */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/lantiq_etop.c +++ linux-kvm-5.19.0/drivers/net/ethernet/lantiq_etop.c @@ -485,7 +485,6 @@ len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) { - dev_kfree_skb_any(skb); netdev_err(dev, "tx ring full\n"); netif_tx_stop_queue(txq); return NETDEV_TX_BUSY; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mediatek/mtk_wed.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mediatek/mtk_wed.c @@ -808,16 +808,16 @@ pdev = of_find_device_by_node(np); if (!pdev) - return; + goto err_of_node_put; get_device(&pdev->dev); irq = platform_get_irq(pdev, 0); if (irq < 0) - return; + goto err_put_device; regs = syscon_regmap_lookup_by_phandle(np, NULL); if (IS_ERR(regs)) - return; + goto err_put_device; rcu_assign_pointer(mtk_soc_wed_ops, &wed_ops); @@ -853,8 +853,16 @@ hw_list[index] = hw; + mutex_unlock(&hw_lock); + + return; + unlock: mutex_unlock(&hw_lock); +err_put_device: + put_device(&pdev->dev); +err_of_node_put: + of_node_put(np); } void mtk_wed_exit(void) @@ -875,6 +883,7 @@ hw_list[i] = NULL; debugfs_remove(hw->debugfs_dir); put_device(hw->dev); + of_node_put(hw->node); kfree(hw); } } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/cmd.c @@ -2004,7 +2004,7 @@ ctx->dev = dev; /* Starts at 1 to avoid doing wake_up if we are not cleaning up */ atomic_set(&ctx->num_inflight, 1); - init_waitqueue_head(&ctx->wait); + init_completion(&ctx->inflight_done); } EXPORT_SYMBOL(mlx5_cmd_init_async_ctx); @@ -2018,8 +2018,8 @@ */ void mlx5_cmd_cleanup_async_ctx(struct mlx5_async_ctx *ctx) { - atomic_dec(&ctx->num_inflight); - wait_event(ctx->wait, atomic_read(&ctx->num_inflight) == 0); + if (!atomic_dec_and_test(&ctx->num_inflight)) + wait_for_completion(&ctx->inflight_done); } EXPORT_SYMBOL(mlx5_cmd_cleanup_async_ctx); @@ -2032,7 +2032,7 @@ status = cmd_status_err(ctx->dev, status, work->opcode, work->out); work->user_callback(status, work); if (atomic_dec_and_test(&ctx->num_inflight)) - wake_up(&ctx->wait); + complete(&ctx->inflight_done); } int mlx5_cmd_exec_cb(struct mlx5_async_ctx *ctx, void *in, int in_size, @@ -2050,7 +2050,7 @@ ret = cmd_exec(ctx->dev, in, in_size, out, out_size, mlx5_cmd_exec_cb_handler, work, false); if (ret && atomic_dec_and_test(&ctx->num_inflight)) - wake_up(&ctx->wait); + complete(&ctx->inflight_done); return ret; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h @@ -6,6 +6,7 @@ #include "en.h" #include "en_stats.h" +#include "en/txrx.h" #include #define MLX5E_PTP_CHANNEL_IX 0 @@ -67,6 +68,14 @@ fk.ports.dst == htons(PTP_EV_PORT)); } +static inline bool mlx5e_ptpsq_fifo_has_room(struct mlx5e_txqsq *sq) +{ + if (!sq->ptpsq) + return true; + + return mlx5e_skb_fifo_has_room(&sq->ptpsq->skb_fifo); +} + int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params, u8 lag_port, struct mlx5e_ptp **cp); void mlx5e_ptp_close(struct mlx5e_ptp *c); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h @@ -95,6 +95,7 @@ struct encap_flow_item encaps[MLX5_MAX_FLOW_FWD_VPORTS]; struct mlx5e_tc_flow *peer_flow; struct mlx5e_mod_hdr_handle *mh; /* attached mod header instance */ + struct mlx5e_mod_hdr_handle *slow_mh; /* attached mod header instance for slow path */ struct mlx5e_hairpin_entry *hpe; /* attached hairpin instance */ struct list_head hairpin; /* flows sharing the same hairpin */ struct list_head peer; /* flows with peer flow */ @@ -110,6 +111,7 @@ struct completion del_hw_done; struct mlx5_flow_attr *attr; struct list_head attrs; + u32 chain_mapping; }; struct mlx5_flow_handle * only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h @@ -58,6 +58,12 @@ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq); static inline bool +mlx5e_skb_fifo_has_room(struct mlx5e_skb_fifo *fifo) +{ + return (*fifo->pc - *fifo->cc) < fifo->mask; +} + +static inline bool mlx5e_wqc_has_room_for(struct mlx5_wq_cyc *wq, u16 cc, u16 pc, u16 n) { return (mlx5_wq_cyc_ctr2ix(wq, cc - pc) >= n) || (cc == pc); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c @@ -101,7 +101,6 @@ struct xfrm_replay_state_esn *replay_esn; u32 seq_bottom = 0; u8 overlap; - u32 *esn; if (!(sa_entry->x->props.flags & XFRM_STATE_ESN)) { sa_entry->esn_state.trigger = 0; @@ -116,11 +115,9 @@ sa_entry->esn_state.esn = xfrm_replay_seqhi(sa_entry->x, htonl(seq_bottom)); - esn = &sa_entry->esn_state.esn; sa_entry->esn_state.trigger = 1; if (unlikely(overlap && seq_bottom < MLX5E_IPSEC_ESN_SCOPE_MID)) { - ++(*esn); sa_entry->esn_state.overlap = 0; return true; } else if (unlikely(!overlap && only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -1266,8 +1266,13 @@ struct mlx5e_tc_flow *flow, struct mlx5_flow_spec *spec) { + struct mlx5e_tc_mod_hdr_acts mod_acts = {}; + struct mlx5e_mod_hdr_handle *mh = NULL; struct mlx5_flow_attr *slow_attr; struct mlx5_flow_handle *rule; + bool fwd_and_modify_cap; + u32 chain_mapping = 0; + int err; slow_attr = mlx5_alloc_flow_attr(MLX5_FLOW_NAMESPACE_FDB); if (!slow_attr) @@ -1278,13 +1283,56 @@ slow_attr->esw_attr->split_count = 0; slow_attr->flags |= MLX5_ATTR_FLAG_SLOW_PATH; + fwd_and_modify_cap = MLX5_CAP_ESW_FLOWTABLE((esw)->dev, fdb_modify_header_fwd_to_table); + if (!fwd_and_modify_cap) + goto skip_restore; + + err = mlx5_chains_get_chain_mapping(esw_chains(esw), flow->attr->chain, &chain_mapping); + if (err) + goto err_get_chain; + + err = mlx5e_tc_match_to_reg_set(esw->dev, &mod_acts, MLX5_FLOW_NAMESPACE_FDB, + CHAIN_TO_REG, chain_mapping); + if (err) + goto err_reg_set; + + mh = mlx5e_mod_hdr_attach(esw->dev, get_mod_hdr_table(flow->priv, flow), + MLX5_FLOW_NAMESPACE_FDB, &mod_acts); + if (IS_ERR(mh)) { + err = PTR_ERR(mh); + goto err_attach; + } + + slow_attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; + slow_attr->modify_hdr = mlx5e_mod_hdr_get(mh); + +skip_restore: rule = mlx5e_tc_offload_fdb_rules(esw, flow, spec, slow_attr); - if (!IS_ERR(rule)) - flow_flag_set(flow, SLOW); + if (IS_ERR(rule)) { + err = PTR_ERR(rule); + goto err_offload; + } + flow->slow_mh = mh; + flow->chain_mapping = chain_mapping; + flow_flag_set(flow, SLOW); + + mlx5e_mod_hdr_dealloc(&mod_acts); kfree(slow_attr); return rule; + +err_offload: + if (fwd_and_modify_cap) + mlx5e_mod_hdr_detach(esw->dev, get_mod_hdr_table(flow->priv, flow), mh); +err_attach: +err_reg_set: + if (fwd_and_modify_cap) + mlx5_chains_put_chain_mapping(esw_chains(esw), chain_mapping); +err_get_chain: + mlx5e_mod_hdr_dealloc(&mod_acts); + kfree(slow_attr); + return ERR_PTR(err); } void mlx5e_tc_unoffload_from_slow_path(struct mlx5_eswitch *esw, @@ -1302,7 +1350,17 @@ slow_attr->action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; slow_attr->esw_attr->split_count = 0; slow_attr->flags |= MLX5_ATTR_FLAG_SLOW_PATH; + if (flow->slow_mh) { + slow_attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; + slow_attr->modify_hdr = mlx5e_mod_hdr_get(flow->slow_mh); + } mlx5e_tc_unoffload_fdb_rules(esw, flow, slow_attr); + if (flow->slow_mh) { + mlx5e_mod_hdr_detach(esw->dev, get_mod_hdr_table(flow->priv, flow), flow->slow_mh); + mlx5_chains_put_chain_mapping(esw_chains(esw), flow->chain_mapping); + flow->chain_mapping = 0; + flow->slow_mh = NULL; + } flow_flag_clear(flow, SLOW); kfree(slow_attr); } @@ -3866,6 +3924,7 @@ struct mlx5e_tc_flow_parse_attr *parse_attr; struct mlx5_flow_attr *attr = flow->attr; struct mlx5_esw_flow_attr *esw_attr; + struct net_device *filter_dev; int err; err = flow_action_supported(flow_action, extack); @@ -3874,6 +3933,7 @@ esw_attr = attr->esw_attr; parse_attr = attr->parse_attr; + filter_dev = parse_attr->filter_dev; parse_state = &parse_attr->parse_state; mlx5e_tc_act_init_parse_state(parse_state, flow, flow_action, extack); parse_state->ct_priv = get_ct_priv(priv); @@ -3883,13 +3943,21 @@ return err; /* Forward to/from internal port can only have 1 dest */ - if ((netif_is_ovs_master(parse_attr->filter_dev) || esw_attr->dest_int_port) && + if ((netif_is_ovs_master(filter_dev) || esw_attr->dest_int_port) && esw_attr->out_count > 1) { NL_SET_ERR_MSG_MOD(extack, "Rules with internal port can have only one destination"); return -EOPNOTSUPP; } + /* Forward from tunnel/internal port to internal port is not supported */ + if ((mlx5e_get_tc_tun(filter_dev) || netif_is_ovs_master(filter_dev)) && + esw_attr->dest_int_port) { + NL_SET_ERR_MSG_MOD(extack, + "Forwarding from tunnel/internal port to internal port is not supported"); + return -EOPNOTSUPP; + } + err = actions_prepare_mod_hdr_actions(priv, flow, attr, extack); if (err) return err; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -391,6 +391,11 @@ if (unlikely(sq->ptpsq)) { mlx5e_skb_cb_hwtstamp_init(skb); mlx5e_skb_fifo_push(&sq->ptpsq->skb_fifo, skb); + if (!netif_tx_queue_stopped(sq->txq) && + !mlx5e_skb_fifo_has_room(&sq->ptpsq->skb_fifo)) { + netif_tx_stop_queue(sq->txq); + sq->stats->stopped++; + } skb_get(skb); } @@ -857,6 +862,7 @@ if (netif_tx_queue_stopped(sq->txq) && mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, sq->stop_room) && + mlx5e_ptpsq_fifo_has_room(sq) && !test_bit(MLX5E_SQ_STATE_RECOVERING, &sq->state)) { netif_tx_wake_queue(sq->txq); stats->wake++; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c @@ -361,6 +361,23 @@ err = -ETIMEDOUT; } + do { + err = pci_read_config_word(dev->pdev, PCI_DEVICE_ID, ®16); + if (err) + return err; + if (reg16 == dev_id) + break; + msleep(20); + } while (!time_after(jiffies, timeout)); + + if (reg16 == dev_id) { + mlx5_core_info(dev, "Firmware responds to PCI config cycles again\n"); + } else { + mlx5_core_err(dev, "Firmware is not responsive (0x%04x) after %llu ms\n", + reg16, mlx5_tout_ms(dev, PCI_TOGGLE)); + err = -ETIMEDOUT; + } + restore: list_for_each_entry(sdev, &bridge_bus->devices, bus_list) { pci_cfg_access_unlock(sdev); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c @@ -122,7 +122,7 @@ { struct mlx5_mpfs *mpfs = dev->priv.mpfs; - if (!MLX5_ESWITCH_MANAGER(dev)) + if (!mpfs) return; WARN_ON(!hlist_empty(mpfs->hash)); @@ -137,7 +137,7 @@ int err = 0; u32 index; - if (!MLX5_ESWITCH_MANAGER(dev)) + if (!mpfs) return 0; mutex_lock(&mpfs->lock); @@ -185,7 +185,7 @@ int err = 0; u32 index; - if (!MLX5_ESWITCH_MANAGER(dev)) + if (!mpfs) return 0; mutex_lock(&mpfs->lock); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +++ linux-kvm-5.19.0/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c @@ -1200,7 +1200,8 @@ } remove_from_nic_tbl: - mlx5dr_matcher_remove_from_tbl_nic(dmn, nic_matcher); + if (!nic_matcher->rules) + mlx5dr_matcher_remove_from_tbl_nic(dmn, nic_matcher); free_hw_ste: mlx5dr_domain_nic_unlock(nic_dmn); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/micrel/ks8851_spi.c +++ linux-kvm-5.19.0/drivers/net/ethernet/micrel/ks8851_spi.c @@ -413,7 +413,8 @@ spi->bits_per_word = 8; - ks = netdev_priv(netdev); + kss = netdev_priv(netdev); + ks = &kss->ks8851; ks->lock = ks8851_lock_spi; ks->unlock = ks8851_unlock_spi; @@ -433,8 +434,6 @@ IRQ_RXPSI) /* RX process stop */ ks->rc_ier = STD_IRQ; - kss = to_ks8851_spi(ks); - kss->spidev = spi; mutex_init(&kss->lock); INIT_WORK(&kss->tx_work, ks8851_tx_work); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/micrel/ksz884x.c +++ linux-kvm-5.19.0/drivers/net/ethernet/micrel/ksz884x.c @@ -6851,7 +6851,7 @@ char banner[sizeof(version)]; struct ksz_switch *sw = NULL; - result = pci_enable_device(pdev); + result = pcim_enable_device(pdev); if (result) return result; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c +++ linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_ethtool.c @@ -656,7 +656,15 @@ stats->rx_dropped = dev->stats.rx_dropped + lan966x->stats[idx + SYS_COUNT_RX_LONG] + lan966x->stats[idx + SYS_COUNT_DR_LOCAL] + - lan966x->stats[idx + SYS_COUNT_DR_TAIL]; + lan966x->stats[idx + SYS_COUNT_DR_TAIL] + + lan966x->stats[idx + SYS_COUNT_RX_RED_PRIO_0] + + lan966x->stats[idx + SYS_COUNT_RX_RED_PRIO_1] + + lan966x->stats[idx + SYS_COUNT_RX_RED_PRIO_2] + + lan966x->stats[idx + SYS_COUNT_RX_RED_PRIO_3] + + lan966x->stats[idx + SYS_COUNT_RX_RED_PRIO_4] + + lan966x->stats[idx + SYS_COUNT_RX_RED_PRIO_5] + + lan966x->stats[idx + SYS_COUNT_RX_RED_PRIO_6] + + lan966x->stats[idx + SYS_COUNT_RX_RED_PRIO_7]; for (i = 0; i < LAN966X_NUM_TC; i++) { stats->rx_dropped += only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/microchip/lan966x/lan966x_main.h +++ linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_main.h @@ -24,6 +24,8 @@ #define LAN966X_BUFFER_MEMORY (160 * 1024) #define LAN966X_BUFFER_MIN_SZ 60 +#define LAN966X_HW_MTU(mtu) ((mtu) + ETH_HLEN + ETH_FCS_LEN) + #define PGID_AGGR 64 #define PGID_SRC 80 #define PGID_ENTRIES 89 only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/microchip/lan966x/lan966x_regs.h +++ linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_regs.h @@ -444,6 +444,21 @@ #define DEV_MAC_MAXLEN_CFG_MAX_LEN_GET(x)\ FIELD_GET(DEV_MAC_MAXLEN_CFG_MAX_LEN, x) +/* DEV:MAC_CFG_STATUS:MAC_TAGS_CFG */ +#define DEV_MAC_TAGS_CFG(t) __REG(TARGET_DEV, t, 8, 28, 0, 1, 44, 12, 0, 1, 4) + +#define DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA BIT(1) +#define DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA_SET(x)\ + FIELD_PREP(DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA, x) +#define DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA_GET(x)\ + FIELD_GET(DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA, x) + +#define DEV_MAC_TAGS_CFG_VLAN_AWR_ENA BIT(0) +#define DEV_MAC_TAGS_CFG_VLAN_AWR_ENA_SET(x)\ + FIELD_PREP(DEV_MAC_TAGS_CFG_VLAN_AWR_ENA, x) +#define DEV_MAC_TAGS_CFG_VLAN_AWR_ENA_GET(x)\ + FIELD_GET(DEV_MAC_TAGS_CFG_VLAN_AWR_ENA, x) + /* DEV:MAC_CFG_STATUS:MAC_IFG_CFG */ #define DEV_MAC_IFG_CFG(t) __REG(TARGET_DEV, t, 8, 28, 0, 1, 44, 20, 0, 1, 4) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/microchip/lan966x/lan966x_vlan.c +++ linux-kvm-5.19.0/drivers/net/ethernet/microchip/lan966x/lan966x_vlan.c @@ -169,6 +169,12 @@ ANA_VLAN_CFG_VLAN_POP_CNT, lan966x, ANA_VLAN_CFG(port->chip_port)); + lan_rmw(DEV_MAC_TAGS_CFG_VLAN_AWR_ENA_SET(port->vlan_aware) | + DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA_SET(port->vlan_aware), + DEV_MAC_TAGS_CFG_VLAN_AWR_ENA | + DEV_MAC_TAGS_CFG_VLAN_DBL_AWR_ENA, + lan966x, DEV_MAC_TAGS_CFG(port->chip_port)); + /* Drop frames with multicast source address */ val = ANA_DROP_CFG_DROP_MC_SMAC_ENA_SET(1); if (port->vlan_aware && !pvid) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/sfc/ef10.c +++ linux-kvm-5.19.0/drivers/net/ethernet/sfc/ef10.c @@ -3271,6 +3271,30 @@ bool was_enabled = efx->port_enabled; int rc; +#ifdef CONFIG_SFC_SRIOV + /* If this function is a VF and we have access to the parent PF, + * then use the PF control path to attempt to change the VF MAC address. + */ + if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) { + struct efx_nic *efx_pf = pci_get_drvdata(efx->pci_dev->physfn); + struct efx_ef10_nic_data *nic_data = efx->nic_data; + u8 mac[ETH_ALEN]; + + /* net_dev->dev_addr can be zeroed by efx_net_stop in + * efx_ef10_sriov_set_vf_mac, so pass in a copy. + */ + ether_addr_copy(mac, efx->net_dev->dev_addr); + + rc = efx_ef10_sriov_set_vf_mac(efx_pf, nic_data->vf_index, mac); + if (!rc) + return 0; + + netif_dbg(efx, drv, efx->net_dev, + "Updating VF mac via PF failed (%d), setting directly\n", + rc); + } +#endif + efx_device_detach_sync(efx); efx_net_stop(efx->net_dev); @@ -3293,40 +3317,6 @@ efx_net_open(efx->net_dev); efx_device_attach_if_not_resetting(efx); -#ifdef CONFIG_SFC_SRIOV - if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) { - struct efx_ef10_nic_data *nic_data = efx->nic_data; - struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; - - if (rc == -EPERM) { - struct efx_nic *efx_pf; - - /* Switch to PF and change MAC address on vport */ - efx_pf = pci_get_drvdata(pci_dev_pf); - - rc = efx_ef10_sriov_set_vf_mac(efx_pf, - nic_data->vf_index, - efx->net_dev->dev_addr); - } else if (!rc) { - struct efx_nic *efx_pf = pci_get_drvdata(pci_dev_pf); - struct efx_ef10_nic_data *nic_data = efx_pf->nic_data; - unsigned int i; - - /* MAC address successfully changed by VF (with MAC - * spoofing) so update the parent PF if possible. - */ - for (i = 0; i < efx_pf->vf_count; ++i) { - struct ef10_vf *vf = nic_data->vf + i; - - if (vf->efx == efx) { - ether_addr_copy(vf->mac, - efx->net_dev->dev_addr); - return 0; - } - } - } - } else -#endif if (rc == -EPERM) { netif_err(efx, drv, efx->net_dev, "Cannot change MAC address; use sfboot to enable" only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/sfc/filter.h +++ linux-kvm-5.19.0/drivers/net/ethernet/sfc/filter.h @@ -157,7 +157,8 @@ u32 flags:6; u32 dmaq_id:12; u32 rss_context; - __be16 outer_vid __aligned(4); /* allow jhash2() of match values */ + u32 vport_id; + __be16 outer_vid; __be16 inner_vid; u8 loc_mac[ETH_ALEN]; u8 rem_mac[ETH_ALEN]; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/sfc/rx_common.c +++ linux-kvm-5.19.0/drivers/net/ethernet/sfc/rx_common.c @@ -660,17 +660,17 @@ (EFX_FILTER_FLAG_RX | EFX_FILTER_FLAG_TX))) return false; - return memcmp(&left->outer_vid, &right->outer_vid, + return memcmp(&left->vport_id, &right->vport_id, sizeof(struct efx_filter_spec) - - offsetof(struct efx_filter_spec, outer_vid)) == 0; + offsetof(struct efx_filter_spec, vport_id)) == 0; } u32 efx_filter_spec_hash(const struct efx_filter_spec *spec) { - BUILD_BUG_ON(offsetof(struct efx_filter_spec, outer_vid) & 3); - return jhash2((const u32 *)&spec->outer_vid, + BUILD_BUG_ON(offsetof(struct efx_filter_spec, vport_id) & 3); + return jhash2((const u32 *)&spec->vport_id, (sizeof(struct efx_filter_spec) - - offsetof(struct efx_filter_spec, outer_vid)) / 4, + offsetof(struct efx_filter_spec, vport_id)) / 4, 0); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/socionext/netsec.c +++ linux-kvm-5.19.0/drivers/net/ethernet/socionext/netsec.c @@ -1961,11 +1961,13 @@ ret = PTR_ERR(priv->phydev); dev_err(priv->dev, "get_phy_device err(%d)\n", ret); priv->phydev = NULL; + mdiobus_unregister(bus); return -ENODEV; } ret = phy_device_register(priv->phydev); if (ret) { + phy_device_free(priv->phydev); mdiobus_unregister(bus); dev_err(priv->dev, "phy_device_register err(%d)\n", ret); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/socionext/sni_ave.c +++ linux-kvm-5.19.0/drivers/net/ethernet/socionext/sni_ave.c @@ -1229,6 +1229,8 @@ phy_support_asym_pause(phydev); + phydev->mac_managed_pm = true; + phy_attached_info(phydev); return 0; @@ -1757,6 +1759,10 @@ ave_global_reset(ndev); + ret = phy_init_hw(ndev->phydev); + if (ret) + return ret; + ave_ethtool_get_wol(ndev, &wol); wol.wolopts = priv->wolopts; __ave_ethtool_set_wol(ndev, &wol); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +++ linux-kvm-5.19.0/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c @@ -51,7 +51,6 @@ struct stmmac_resources res; struct device_node *np; int ret, i, phy_mode; - bool mdio = false; np = dev_of_node(&pdev->dev); @@ -69,12 +68,10 @@ if (!plat) return -ENOMEM; + plat->mdio_node = of_get_child_by_name(np, "mdio"); if (plat->mdio_node) { - dev_err(&pdev->dev, "Found MDIO subnode\n"); - mdio = true; - } + dev_info(&pdev->dev, "Found MDIO subnode\n"); - if (mdio) { plat->mdio_bus_data = devm_kzalloc(&pdev->dev, sizeof(*plat->mdio_bus_data), GFP_KERNEL); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/netdevsim/bus.c +++ linux-kvm-5.19.0/drivers/net/netdevsim/bus.c @@ -135,6 +135,10 @@ static void nsim_bus_dev_release(struct device *dev) { + struct nsim_bus_dev *nsim_bus_dev; + + nsim_bus_dev = container_of(dev, struct nsim_bus_dev, dev); + kfree(nsim_bus_dev); } static struct device_type nsim_bus_dev_type = { @@ -310,6 +314,8 @@ err_nsim_bus_dev_id_free: ida_free(&nsim_bus_dev_ids, nsim_bus_dev->dev.id); + put_device(&nsim_bus_dev->dev); + nsim_bus_dev = NULL; err_nsim_bus_dev_free: kfree(nsim_bus_dev); return ERR_PTR(err); @@ -319,9 +325,8 @@ { /* Disallow using nsim_bus_dev */ smp_store_release(&nsim_bus_dev->init, false); - device_unregister(&nsim_bus_dev->dev); ida_free(&nsim_bus_dev_ids, nsim_bus_dev->dev.id); - kfree(nsim_bus_dev); + device_unregister(&nsim_bus_dev->dev); } static struct device_driver nsim_driver = { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/netdevsim/dev.c +++ linux-kvm-5.19.0/drivers/net/netdevsim/dev.c @@ -309,8 +309,10 @@ if (IS_ERR(nsim_dev->ddir)) return PTR_ERR(nsim_dev->ddir); nsim_dev->ports_ddir = debugfs_create_dir("ports", nsim_dev->ddir); - if (IS_ERR(nsim_dev->ports_ddir)) - return PTR_ERR(nsim_dev->ports_ddir); + if (IS_ERR(nsim_dev->ports_ddir)) { + err = PTR_ERR(nsim_dev->ports_ddir); + goto err_ddir; + } debugfs_create_bool("fw_update_status", 0600, nsim_dev->ddir, &nsim_dev->fw_update_status); debugfs_create_u32("fw_update_overwrite_mask", 0600, nsim_dev->ddir, @@ -346,7 +348,7 @@ nsim_dev->nodes_ddir = debugfs_create_dir("rate_nodes", nsim_dev->ddir); if (IS_ERR(nsim_dev->nodes_ddir)) { err = PTR_ERR(nsim_dev->nodes_ddir); - goto err_out; + goto err_ports_ddir; } debugfs_create_bool("fail_trap_drop_counter_get", 0600, nsim_dev->ddir, @@ -354,8 +356,9 @@ nsim_udp_tunnels_debugfs_create(nsim_dev); return 0; -err_out: +err_ports_ddir: debugfs_remove_recursive(nsim_dev->ports_ddir); +err_ddir: debugfs_remove_recursive(nsim_dev->ddir); return err; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/phy/dp83822.c +++ linux-kvm-5.19.0/drivers/net/phy/dp83822.c @@ -254,8 +254,7 @@ DP83822_EEE_ERROR_CHANGE_INT_EN); if (!dp83822->fx_enabled) - misr_status |= DP83822_MDI_XOVER_INT_EN | - DP83822_ANEG_ERR_INT_EN | + misr_status |= DP83822_ANEG_ERR_INT_EN | DP83822_WOL_PKT_INT_EN; err = phy_write(phydev, MII_DP83822_MISR2, misr_status); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/phy/dp83867.c +++ linux-kvm-5.19.0/drivers/net/phy/dp83867.c @@ -810,6 +810,14 @@ else val &= ~DP83867_SGMII_TYPE; phy_write_mmd(phydev, DP83867_DEVADDR, DP83867_SGMIICTL, val); + + /* This is a SW workaround for link instability if RX_CTRL is + * not strapped to mode 3 or 4 in HW. This is required for SGMII + * in addition to clearing bit 7, handled above. + */ + if (dp83867->rxctrl_strap_quirk) + phy_set_bits_mmd(phydev, DP83867_DEVADDR, DP83867_CFG4, + BIT(8)); } val = phy_read(phydev, DP83867_CFG3); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/phy/mdio_bus.c +++ linux-kvm-5.19.0/drivers/net/phy/mdio_bus.c @@ -583,7 +583,7 @@ } for (i = 0; i < PHY_MAX_ADDR; i++) { - if ((bus->phy_mask & (1 << i)) == 0) { + if ((bus->phy_mask & BIT(i)) == 0) { struct phy_device *phydev; phydev = mdiobus_scan(bus, i); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/phy/phylink.c +++ linux-kvm-5.19.0/drivers/net/phy/phylink.c @@ -1422,6 +1422,9 @@ if (phy_interrupt_is_valid(phy)) phy_request_interrupt(phy); + if (pl->config->mac_managed_pm) + phy->mac_managed_pm = true; + return 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/tun.c +++ linux-kvm-5.19.0/drivers/net/tun.c @@ -1459,7 +1459,8 @@ int err; int i; - if (it->nr_segs > MAX_SKB_FRAGS + 1) + if (it->nr_segs > MAX_SKB_FRAGS + 1 || + len > (ETH_MAX_MTU - NET_SKB_PAD - NET_IP_ALIGN)) return ERR_PTR(-EMSGSIZE); local_bh_disable(); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +++ linux-kvm-5.19.0/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c @@ -228,6 +228,10 @@ brcmf_fweh_event_name(event->code), event->code, event->emsg.ifidx, event->emsg.bsscfgidx, event->emsg.addr); + if (event->emsg.bsscfgidx >= BRCMF_MAX_IFS) { + bphy_err(drvr, "invalid bsscfg index: %u\n", event->emsg.bsscfgidx); + goto event_free; + } /* convert event message */ emsg_be = &event->emsg; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/wireless/mediatek/mt76/mt7921/Makefile +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/Makefile @@ -9,6 +9,7 @@ mt7921-common-y := mac.o mcu.o main.o init.o debugfs.o trace.o mt7921-common-$(CONFIG_NL80211_TESTMODE) += testmode.o +mt7921-common-$(CONFIG_ACPI) += acpi_sar.o mt7921e-y := pci.o pci_mac.o pci_mcu.o dma.o mt7921s-y := sdio.o sdio_mac.o sdio_mcu.o mt7921u-y := usb.o usb_mac.o only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.c @@ -0,0 +1,282 @@ +// SPDX-License-Identifier: ISC +/* Copyright (C) 2022 MediaTek Inc. */ + +#include +#include "mt7921.h" + +static int +mt7921_acpi_read(struct mt7921_dev *dev, u8 *method, u8 **tbl, u32 *len) +{ + struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL }; + union acpi_object *sar_root, *sar_unit; + struct mt76_dev *mdev = &dev->mt76; + acpi_handle root, handle; + acpi_status status; + u32 i = 0; + int ret; + + root = ACPI_HANDLE(mdev->dev); + if (!root) + return -EOPNOTSUPP; + + status = acpi_get_handle(root, method, &handle); + if (ACPI_FAILURE(status)) + return -EIO; + + status = acpi_evaluate_object(handle, NULL, NULL, &buf); + if (ACPI_FAILURE(status)) + return -EIO; + + sar_root = buf.pointer; + if (sar_root->type != ACPI_TYPE_PACKAGE || + sar_root->package.count < 4 || + sar_root->package.elements[0].type != ACPI_TYPE_INTEGER) { + dev_err(mdev->dev, "sar cnt = %d\n", + sar_root->package.count); + goto free; + } + + if (!*tbl) { + *tbl = devm_kzalloc(mdev->dev, sar_root->package.count, + GFP_KERNEL); + if (!*tbl) + goto free; + } + if (len) + *len = sar_root->package.count; + + for (i = 0; i < sar_root->package.count; i++) { + sar_unit = &sar_root->package.elements[i]; + + if (sar_unit->type != ACPI_TYPE_INTEGER) + break; + *(*tbl + i) = (u8)sar_unit->integer.value; + } +free: + ret = (i == sar_root->package.count) ? 0 : -EINVAL; + + kfree(sar_root); + + return ret; +} + +/* MTCL : Country List Table for 6G band */ +static int +mt7921_asar_acpi_read_mtcl(struct mt7921_dev *dev, u8 **table, u8 *version) +{ + *version = (mt7921_acpi_read(dev, MT7921_ACPI_MTCL, table, NULL) < 0) + ? 1 : 2; + return 0; +} + +/* MTDS : Dynamic SAR Power Table */ +static int +mt7921_asar_acpi_read_mtds(struct mt7921_dev *dev, u8 **table, u8 version) +{ + int len, ret, sarlen, prelen, tblcnt; + bool enable; + + ret = mt7921_acpi_read(dev, MT7921_ACPI_MTDS, table, &len); + if (ret) + return ret; + + /* Table content validation */ + switch (version) { + case 1: + enable = ((struct mt7921_asar_dyn *)*table)->enable; + sarlen = sizeof(struct mt7921_asar_dyn_limit); + prelen = sizeof(struct mt7921_asar_dyn); + break; + case 2: + enable = ((struct mt7921_asar_dyn_v2 *)*table)->enable; + sarlen = sizeof(struct mt7921_asar_dyn_limit_v2); + prelen = sizeof(struct mt7921_asar_dyn_v2); + break; + default: + return -EINVAL; + } + + tblcnt = (len - prelen) / sarlen; + if (!enable || + tblcnt > MT7921_ASAR_MAX_DYN || tblcnt < MT7921_ASAR_MIN_DYN) + ret = -EINVAL; + + return ret; +} + +/* MTGS : Geo SAR Power Table */ +static int +mt7921_asar_acpi_read_mtgs(struct mt7921_dev *dev, u8 **table, u8 version) +{ + int len, ret = 0, sarlen, prelen, tblcnt; + + ret = mt7921_acpi_read(dev, MT7921_ACPI_MTGS, table, &len); + if (ret) + return ret; + + /* Table content validation */ + switch (version) { + case 1: + sarlen = sizeof(struct mt7921_asar_geo_limit); + prelen = sizeof(struct mt7921_asar_geo); + break; + case 2: + sarlen = sizeof(struct mt7921_asar_geo_limit_v2); + prelen = sizeof(struct mt7921_asar_geo_v2); + break; + default: + return -EINVAL; + } + + tblcnt = (len - prelen) / sarlen; + if (tblcnt > MT7921_ASAR_MAX_GEO || tblcnt < MT7921_ASAR_MIN_GEO) + ret = -EINVAL; + + return ret; +} + +int mt7921_init_acpi_sar(struct mt7921_dev *dev) +{ + struct mt7921_acpi_sar *asar; + int ret; + + asar = devm_kzalloc(dev->mt76.dev, sizeof(*asar), GFP_KERNEL); + if (!asar) + return -ENOMEM; + + mt7921_asar_acpi_read_mtcl(dev, (u8 **)&asar->countrylist, &asar->ver); + + /* MTDS is mandatory. Return error if table is invalid */ + ret = mt7921_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver); + if (ret) { + devm_kfree(dev->mt76.dev, asar->dyn); + devm_kfree(dev->mt76.dev, asar->countrylist); + devm_kfree(dev->mt76.dev, asar); + return ret; + } + + /* MTGS is optional */ + ret = mt7921_asar_acpi_read_mtgs(dev, (u8 **)&asar->geo, asar->ver); + if (ret) { + devm_kfree(dev->mt76.dev, asar->geo); + asar->geo = NULL; + } + + dev->phy.acpisar = asar; + + return 0; +} + +static s8 +mt7921_asar_get_geo_pwr(struct mt7921_phy *phy, + enum nl80211_band band, s8 dyn_power) +{ + struct mt7921_acpi_sar *asar = phy->acpisar; + struct mt7921_asar_geo_band *band_pwr; + s8 geo_power; + u8 idx, max; + + if (!asar->geo) + return dyn_power; + + switch (phy->mt76->dev->region) { + case NL80211_DFS_FCC: + idx = 0; + break; + case NL80211_DFS_ETSI: + idx = 1; + break; + default: /* WW */ + idx = 2; + break; + } + + if (asar->ver == 1) { + band_pwr = &asar->geo->tbl[idx].band[0]; + max = ARRAY_SIZE(asar->geo->tbl[idx].band); + } else { + band_pwr = &asar->geo_v2->tbl[idx].band[0]; + max = ARRAY_SIZE(asar->geo_v2->tbl[idx].band); + } + + switch (band) { + case NL80211_BAND_2GHZ: + idx = 0; + break; + case NL80211_BAND_5GHZ: + idx = 1; + break; + case NL80211_BAND_6GHZ: + idx = 2; + break; + default: + return dyn_power; + } + + if (idx >= max) + return dyn_power; + + geo_power = (band_pwr + idx)->pwr; + dyn_power += (band_pwr + idx)->offset; + + return min(geo_power, dyn_power); +} + +static s8 +mt7921_asar_range_pwr(struct mt7921_phy *phy, + const struct cfg80211_sar_freq_ranges *range, + u8 idx) +{ + const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa; + struct mt7921_acpi_sar *asar = phy->acpisar; + u8 *limit, band, max; + + if (!capa) + return 127; + + if (asar->ver == 1) { + limit = &asar->dyn->tbl[0].frp[0]; + max = ARRAY_SIZE(asar->dyn->tbl[0].frp); + } else { + limit = &asar->dyn_v2->tbl[0].frp[0]; + max = ARRAY_SIZE(asar->dyn_v2->tbl[0].frp); + } + + if (idx >= max) + return 127; + + if (range->start_freq >= 5945) + band = NL80211_BAND_6GHZ; + else if (range->start_freq >= 5150) + band = NL80211_BAND_5GHZ; + else + band = NL80211_BAND_2GHZ; + + return mt7921_asar_get_geo_pwr(phy, band, limit[idx]); +} + +int mt7921_init_acpi_sar_power(struct mt7921_phy *phy, bool set_default) +{ + const struct cfg80211_sar_capa *capa = phy->mt76->hw->wiphy->sar_capa; + int i; + + if (!phy->acpisar) + return 0; + + /* When ACPI SAR enabled in HW, we should apply rules for .frp + * 1. w/o .sar_specs : set ACPI SAR power as the defatul value + * 2. w/ .sar_specs : set power with min(.sar_specs, ACPI_SAR) + */ + for (i = 0; i < capa->num_freq_ranges; i++) { + struct mt76_freq_range_power *frp = &phy->mt76->frp[i]; + + frp->range = set_default ? &capa->freq_ranges[i] : frp->range; + if (!frp->range) + continue; + + frp->power = min_t(s8, set_default ? 127 : frp->power, + mt7921_asar_range_pwr(phy, frp->range, i)); + } + + return 0; +} only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.h +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/acpi_sar.h @@ -0,0 +1,93 @@ +/* SPDX-License-Identifier: ISC */ +/* Copyright (C) 2022 MediaTek Inc. */ + +#ifndef __MT7921_ACPI_SAR_H +#define __MT7921_ACPI_SAR_H + +#define MT7921_ASAR_MIN_DYN 1 +#define MT7921_ASAR_MAX_DYN 8 +#define MT7921_ASAR_MIN_GEO 3 +#define MT7921_ASAR_MAX_GEO 8 + +#define MT7921_ACPI_MTCL "MTCL" +#define MT7921_ACPI_MTDS "MTDS" +#define MT7921_ACPI_MTGS "MTGS" + +struct mt7921_asar_dyn_limit { + u8 idx; + u8 frp[5]; +} __packed; + +struct mt7921_asar_dyn { + u8 names[4]; + u8 enable; + u8 nr_tbl; + struct mt7921_asar_dyn_limit tbl[0]; +} __packed; + +struct mt7921_asar_dyn_limit_v2 { + u8 idx; + u8 frp[11]; +} __packed; + +struct mt7921_asar_dyn_v2 { + u8 names[4]; + u8 enable; + u8 rsvd; + u8 nr_tbl; + struct mt7921_asar_dyn_limit_v2 tbl[0]; +} __packed; + +struct mt7921_asar_geo_band { + u8 pwr; + u8 offset; +} __packed; + +struct mt7921_asar_geo_limit { + u8 idx; + /* 0:2G, 1:5G */ + struct mt7921_asar_geo_band band[2]; +} __packed; + +struct mt7921_asar_geo { + u8 names[4]; + u8 version; + u8 nr_tbl; + struct mt7921_asar_geo_limit tbl[0]; +} __packed; + +struct mt7921_asar_geo_limit_v2 { + u8 idx; + /* 0:2G, 1:5G, 2:6G */ + struct mt7921_asar_geo_band band[3]; +} __packed; + +struct mt7921_asar_geo_v2 { + u8 names[4]; + u8 version; + u8 rsvd; + u8 nr_tbl; + struct mt7921_asar_geo_limit_v2 tbl[0]; +} __packed; + +struct mt7921_asar_cl { + u8 names[4]; + u8 version; + u8 mode_6g; + u8 cl6g[6]; +} __packed; + +struct mt7921_acpi_sar { + u8 ver; + union { + struct mt7921_asar_dyn *dyn; + struct mt7921_asar_dyn_v2 *dyn_v2; + }; + union { + struct mt7921_asar_geo *geo; + struct mt7921_asar_geo_v2 *geo_v2; + }; + struct mt7921_asar_cl *countrylist; +}; + +#endif only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/wireless/mediatek/mt76/mt7921/regs.h +++ linux-kvm-5.19.0/drivers/net/wireless/mediatek/mt76/mt7921/regs.h @@ -440,6 +440,8 @@ #define MT_PCIE_MAC_BASE 0x10000 #define MT_PCIE_MAC(ofs) (MT_PCIE_MAC_BASE + (ofs)) #define MT_PCIE_MAC_INT_ENABLE MT_PCIE_MAC(0x188) +#define MT_PCIE_MAC_PM MT_PCIE_MAC(0x194) +#define MT_PCIE_MAC_PM_L0S_DIS BIT(8) #define MT_DMA_SHDL(ofs) (0x7c026000 + (ofs)) #define MT_DMASHDL_SW_CONTROL MT_DMA_SHDL(0x004) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/wwan/Kconfig +++ linux-kvm-5.19.0/drivers/net/wwan/Kconfig @@ -94,7 +94,7 @@ config IOSM tristate "IOSM Driver for Intel M.2 WWAN Device" - depends on INTEL_IOMMU + depends on PCI select NET_DEVLINK select RELAY if WWAN_DEBUGFS help only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/wwan/wwan_hwsim.c +++ linux-kvm-5.19.0/drivers/net/wwan/wwan_hwsim.c @@ -311,7 +311,7 @@ return ERR_PTR(err); err_free_dev: - kfree(dev); + put_device(&dev->dev); return ERR_PTR(err); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/net/xen-netback/netback.c +++ linux-kvm-5.19.0/drivers/net/xen-netback/netback.c @@ -330,10 +330,13 @@ struct xenvif_tx_cb { - u16 pending_idx; + u16 copy_pending_idx[XEN_NETBK_LEGACY_SLOTS_MAX + 1]; + u8 copy_count; }; #define XENVIF_TX_CB(skb) ((struct xenvif_tx_cb *)(skb)->cb) +#define copy_pending_idx(skb, i) (XENVIF_TX_CB(skb)->copy_pending_idx[i]) +#define copy_count(skb) (XENVIF_TX_CB(skb)->copy_count) static inline void xenvif_tx_create_map_op(struct xenvif_queue *queue, u16 pending_idx, @@ -368,31 +371,93 @@ return skb; } -static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queue, - struct sk_buff *skb, - struct xen_netif_tx_request *txp, - struct gnttab_map_grant_ref *gop, - unsigned int frag_overflow, - struct sk_buff *nskb) +static void xenvif_get_requests(struct xenvif_queue *queue, + struct sk_buff *skb, + struct xen_netif_tx_request *first, + struct xen_netif_tx_request *txfrags, + unsigned *copy_ops, + unsigned *map_ops, + unsigned int frag_overflow, + struct sk_buff *nskb, + unsigned int extra_count, + unsigned int data_len) { struct skb_shared_info *shinfo = skb_shinfo(skb); skb_frag_t *frags = shinfo->frags; - u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx; - int start; + u16 pending_idx; pending_ring_idx_t index; unsigned int nr_slots; + struct gnttab_copy *cop = queue->tx_copy_ops + *copy_ops; + struct gnttab_map_grant_ref *gop = queue->tx_map_ops + *map_ops; + struct xen_netif_tx_request *txp = first; + + nr_slots = shinfo->nr_frags + 1; + + copy_count(skb) = 0; + + /* Create copy ops for exactly data_len bytes into the skb head. */ + __skb_put(skb, data_len); + while (data_len > 0) { + int amount = data_len > txp->size ? txp->size : data_len; + + cop->source.u.ref = txp->gref; + cop->source.domid = queue->vif->domid; + cop->source.offset = txp->offset; + + cop->dest.domid = DOMID_SELF; + cop->dest.offset = (offset_in_page(skb->data + + skb_headlen(skb) - + data_len)) & ~XEN_PAGE_MASK; + cop->dest.u.gmfn = virt_to_gfn(skb->data + skb_headlen(skb) + - data_len); + + cop->len = amount; + cop->flags = GNTCOPY_source_gref; + + index = pending_index(queue->pending_cons); + pending_idx = queue->pending_ring[index]; + callback_param(queue, pending_idx).ctx = NULL; + copy_pending_idx(skb, copy_count(skb)) = pending_idx; + copy_count(skb)++; - nr_slots = shinfo->nr_frags; + cop++; + data_len -= amount; - /* Skip first skb fragment if it is on same page as header fragment. */ - start = (frag_get_pending_idx(&shinfo->frags[0]) == pending_idx); + if (amount == txp->size) { + /* The copy op covered the full tx_request */ + + memcpy(&queue->pending_tx_info[pending_idx].req, + txp, sizeof(*txp)); + queue->pending_tx_info[pending_idx].extra_count = + (txp == first) ? extra_count : 0; + + if (txp == first) + txp = txfrags; + else + txp++; + queue->pending_cons++; + nr_slots--; + } else { + /* The copy op partially covered the tx_request. + * The remainder will be mapped. + */ + txp->offset += amount; + txp->size -= amount; + } + } - for (shinfo->nr_frags = start; shinfo->nr_frags < nr_slots; - shinfo->nr_frags++, txp++, gop++) { + for (shinfo->nr_frags = 0; shinfo->nr_frags < nr_slots; + shinfo->nr_frags++, gop++) { index = pending_index(queue->pending_cons++); pending_idx = queue->pending_ring[index]; - xenvif_tx_create_map_op(queue, pending_idx, txp, 0, gop); + xenvif_tx_create_map_op(queue, pending_idx, txp, + txp == first ? extra_count : 0, gop); frag_set_pending_idx(&frags[shinfo->nr_frags], pending_idx); + + if (txp == first) + txp = txfrags; + else + txp++; } if (frag_overflow) { @@ -413,7 +478,8 @@ skb_shinfo(skb)->frag_list = nskb; } - return gop; + (*copy_ops) = cop - queue->tx_copy_ops; + (*map_ops) = gop - queue->tx_map_ops; } static inline void xenvif_grant_handle_set(struct xenvif_queue *queue, @@ -449,7 +515,7 @@ struct gnttab_copy **gopp_copy) { struct gnttab_map_grant_ref *gop_map = *gopp_map; - u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx; + u16 pending_idx; /* This always points to the shinfo of the skb being checked, which * could be either the first or the one on the frag_list */ @@ -460,24 +526,37 @@ struct skb_shared_info *first_shinfo = NULL; int nr_frags = shinfo->nr_frags; const bool sharedslot = nr_frags && - frag_get_pending_idx(&shinfo->frags[0]) == pending_idx; + frag_get_pending_idx(&shinfo->frags[0]) == + copy_pending_idx(skb, copy_count(skb) - 1); int i, err; - /* Check status of header. */ - err = (*gopp_copy)->status; - if (unlikely(err)) { - if (net_ratelimit()) - netdev_dbg(queue->vif->dev, - "Grant copy of header failed! status: %d pending_idx: %u ref: %u\n", - (*gopp_copy)->status, - pending_idx, - (*gopp_copy)->source.u.ref); - /* The first frag might still have this slot mapped */ - if (!sharedslot) - xenvif_idx_release(queue, pending_idx, - XEN_NETIF_RSP_ERROR); + for (i = 0; i < copy_count(skb); i++) { + int newerr; + + /* Check status of header. */ + pending_idx = copy_pending_idx(skb, i); + + newerr = (*gopp_copy)->status; + if (likely(!newerr)) { + /* The first frag might still have this slot mapped */ + if (i < copy_count(skb) - 1 || !sharedslot) + xenvif_idx_release(queue, pending_idx, + XEN_NETIF_RSP_OKAY); + } else { + err = newerr; + if (net_ratelimit()) + netdev_dbg(queue->vif->dev, + "Grant copy of header failed! status: %d pending_idx: %u ref: %u\n", + (*gopp_copy)->status, + pending_idx, + (*gopp_copy)->source.u.ref); + /* The first frag might still have this slot mapped */ + if (i < copy_count(skb) - 1 || !sharedslot) + xenvif_idx_release(queue, pending_idx, + XEN_NETIF_RSP_ERROR); + } + (*gopp_copy)++; } - (*gopp_copy)++; check_frags: for (i = 0; i < nr_frags; i++, gop_map++) { @@ -524,14 +603,6 @@ if (err) continue; - /* First error: if the header haven't shared a slot with the - * first frag, release it as well. - */ - if (!sharedslot) - xenvif_idx_release(queue, - XENVIF_TX_CB(skb)->pending_idx, - XEN_NETIF_RSP_OKAY); - /* Invalidate preceding fragments of this skb. */ for (j = 0; j < i; j++) { pending_idx = frag_get_pending_idx(&shinfo->frags[j]); @@ -801,7 +872,6 @@ unsigned *copy_ops, unsigned *map_ops) { - struct gnttab_map_grant_ref *gop = queue->tx_map_ops; struct sk_buff *skb, *nskb; int ret; unsigned int frag_overflow; @@ -883,8 +953,12 @@ continue; } + data_len = (txreq.size > XEN_NETBACK_TX_COPY_LEN) ? + XEN_NETBACK_TX_COPY_LEN : txreq.size; + ret = xenvif_count_requests(queue, &txreq, extra_count, txfrags, work_to_do); + if (unlikely(ret < 0)) break; @@ -910,9 +984,8 @@ index = pending_index(queue->pending_cons); pending_idx = queue->pending_ring[index]; - data_len = (txreq.size > XEN_NETBACK_TX_COPY_LEN && - ret < XEN_NETBK_LEGACY_SLOTS_MAX) ? - XEN_NETBACK_TX_COPY_LEN : txreq.size; + if (ret >= XEN_NETBK_LEGACY_SLOTS_MAX - 1 && data_len < txreq.size) + data_len = txreq.size; skb = xenvif_alloc_skb(data_len); if (unlikely(skb == NULL)) { @@ -923,8 +996,6 @@ } skb_shinfo(skb)->nr_frags = ret; - if (data_len < txreq.size) - skb_shinfo(skb)->nr_frags++; /* At this point shinfo->nr_frags is in fact the number of * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX. */ @@ -986,54 +1057,19 @@ type); } - XENVIF_TX_CB(skb)->pending_idx = pending_idx; - - __skb_put(skb, data_len); - queue->tx_copy_ops[*copy_ops].source.u.ref = txreq.gref; - queue->tx_copy_ops[*copy_ops].source.domid = queue->vif->domid; - queue->tx_copy_ops[*copy_ops].source.offset = txreq.offset; - - queue->tx_copy_ops[*copy_ops].dest.u.gmfn = - virt_to_gfn(skb->data); - queue->tx_copy_ops[*copy_ops].dest.domid = DOMID_SELF; - queue->tx_copy_ops[*copy_ops].dest.offset = - offset_in_page(skb->data) & ~XEN_PAGE_MASK; - - queue->tx_copy_ops[*copy_ops].len = data_len; - queue->tx_copy_ops[*copy_ops].flags = GNTCOPY_source_gref; - - (*copy_ops)++; - - if (data_len < txreq.size) { - frag_set_pending_idx(&skb_shinfo(skb)->frags[0], - pending_idx); - xenvif_tx_create_map_op(queue, pending_idx, &txreq, - extra_count, gop); - gop++; - } else { - frag_set_pending_idx(&skb_shinfo(skb)->frags[0], - INVALID_PENDING_IDX); - memcpy(&queue->pending_tx_info[pending_idx].req, - &txreq, sizeof(txreq)); - queue->pending_tx_info[pending_idx].extra_count = - extra_count; - } - - queue->pending_cons++; - - gop = xenvif_get_requests(queue, skb, txfrags, gop, - frag_overflow, nskb); + xenvif_get_requests(queue, skb, &txreq, txfrags, copy_ops, + map_ops, frag_overflow, nskb, extra_count, + data_len); __skb_queue_tail(&queue->tx_queue, skb); queue->tx.req_cons = idx; - if (((gop-queue->tx_map_ops) >= ARRAY_SIZE(queue->tx_map_ops)) || + if ((*map_ops >= ARRAY_SIZE(queue->tx_map_ops)) || (*copy_ops >= ARRAY_SIZE(queue->tx_copy_ops))) break; } - (*map_ops) = gop - queue->tx_map_ops; return; } @@ -1112,9 +1148,8 @@ while ((skb = __skb_dequeue(&queue->tx_queue)) != NULL) { struct xen_netif_tx_request *txp; u16 pending_idx; - unsigned data_len; - pending_idx = XENVIF_TX_CB(skb)->pending_idx; + pending_idx = copy_pending_idx(skb, 0); txp = &queue->pending_tx_info[pending_idx].req; /* Check the remap error code. */ @@ -1133,18 +1168,6 @@ continue; } - data_len = skb->len; - callback_param(queue, pending_idx).ctx = NULL; - if (data_len < txp->size) { - /* Append the packet payload as a fragment. */ - txp->offset += data_len; - txp->size -= data_len; - } else { - /* Schedule a response immediately. */ - xenvif_idx_release(queue, pending_idx, - XEN_NETIF_RSP_OKAY); - } - if (txp->flags & XEN_NETTXF_csum_blank) skb->ip_summed = CHECKSUM_PARTIAL; else if (txp->flags & XEN_NETTXF_data_validated) @@ -1331,7 +1354,7 @@ /* Called after netfront has transmitted */ int xenvif_tx_action(struct xenvif_queue *queue, int budget) { - unsigned nr_mops, nr_cops = 0; + unsigned nr_mops = 0, nr_cops = 0; int work_done, ret; if (unlikely(!tx_work_todo(queue))) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/nfc/fdp/fdp.c +++ linux-kvm-5.19.0/drivers/nfc/fdp/fdp.c @@ -249,11 +249,19 @@ static int fdp_nci_send(struct nci_dev *ndev, struct sk_buff *skb) { struct fdp_nci_info *info = nci_get_drvdata(ndev); + int ret; if (atomic_dec_and_test(&info->data_pkt_counter)) info->data_pkt_counter_cb(ndev); - return info->phy_ops->write(info->phy, skb); + ret = info->phy_ops->write(info->phy, skb); + if (ret < 0) { + kfree_skb(skb); + return ret; + } + + consume_skb(skb); + return 0; } static int fdp_nci_request_firmware(struct nci_dev *ndev) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/nfc/nfcmrvl/i2c.c +++ linux-kvm-5.19.0/drivers/nfc/nfcmrvl/i2c.c @@ -132,10 +132,15 @@ ret = -EREMOTEIO; } else ret = 0; + } + + if (ret) { kfree_skb(skb); + return ret; } - return ret; + consume_skb(skb); + return 0; } static void nfcmrvl_i2c_nci_update_config(struct nfcmrvl_private *priv, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/nfc/nxp-nci/core.c +++ linux-kvm-5.19.0/drivers/nfc/nxp-nci/core.c @@ -77,10 +77,13 @@ return -EINVAL; r = info->phy_ops->write(info->phy_id, skb); - if (r < 0) + if (r < 0) { kfree_skb(skb); + return r; + } - return r; + consume_skb(skb); + return 0; } static const struct nci_ops nxp_nci_ops = { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/nfc/s3fwrn5/core.c +++ linux-kvm-5.19.0/drivers/nfc/s3fwrn5/core.c @@ -110,11 +110,15 @@ } ret = s3fwrn5_write(info, skb); - if (ret < 0) + if (ret < 0) { kfree_skb(skb); + mutex_unlock(&info->mutex); + return ret; + } + consume_skb(skb); mutex_unlock(&info->mutex); - return ret; + return 0; } static int s3fwrn5_nci_post_setup(struct nci_dev *ndev) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/nfc/virtual_ncidev.c +++ linux-kvm-5.19.0/drivers/nfc/virtual_ncidev.c @@ -54,16 +54,19 @@ mutex_lock(&nci_mutex); if (state != virtual_ncidev_enabled) { mutex_unlock(&nci_mutex); + kfree_skb(skb); return 0; } if (send_buff) { mutex_unlock(&nci_mutex); + kfree_skb(skb); return -1; } send_buff = skb_copy(skb, GFP_KERNEL); mutex_unlock(&nci_mutex); wake_up_interruptible(&wq); + consume_skb(skb); return 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/nvme/host/hwmon.c +++ linux-kvm-5.19.0/drivers/nvme/host/hwmon.c @@ -12,7 +12,7 @@ struct nvme_hwmon_data { struct nvme_ctrl *ctrl; - struct nvme_smart_log log; + struct nvme_smart_log *log; struct mutex read_lock; }; @@ -60,14 +60,14 @@ static int nvme_hwmon_get_smart_log(struct nvme_hwmon_data *data) { return nvme_get_log(data->ctrl, NVME_NSID_ALL, NVME_LOG_SMART, 0, - NVME_CSI_NVM, &data->log, sizeof(data->log), 0); + NVME_CSI_NVM, data->log, sizeof(*data->log), 0); } static int nvme_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *val) { struct nvme_hwmon_data *data = dev_get_drvdata(dev); - struct nvme_smart_log *log = &data->log; + struct nvme_smart_log *log = data->log; int temp; int err; @@ -163,7 +163,7 @@ case hwmon_temp_max: case hwmon_temp_min: if ((!channel && data->ctrl->wctemp) || - (channel && data->log.temp_sensor[channel - 1])) { + (channel && data->log->temp_sensor[channel - 1])) { if (data->ctrl->quirks & NVME_QUIRK_NO_TEMP_THRESH_CHANGE) return 0444; @@ -176,7 +176,7 @@ break; case hwmon_temp_input: case hwmon_temp_label: - if (!channel || data->log.temp_sensor[channel - 1]) + if (!channel || data->log->temp_sensor[channel - 1]) return 0444; break; default: @@ -230,7 +230,13 @@ data = kzalloc(sizeof(*data), GFP_KERNEL); if (!data) - return 0; + return -ENOMEM; + + data->log = kzalloc(sizeof(*data->log), GFP_KERNEL); + if (!data->log) { + err = -ENOMEM; + goto err_free_data; + } data->ctrl = ctrl; mutex_init(&data->read_lock); @@ -238,8 +244,7 @@ err = nvme_hwmon_get_smart_log(data); if (err) { dev_warn(dev, "Failed to read smart log (error %d)\n", err); - kfree(data); - return err; + goto err_free_log; } hwmon = hwmon_device_register_with_info(dev, "nvme", @@ -247,11 +252,17 @@ NULL); if (IS_ERR(hwmon)) { dev_warn(dev, "Failed to instantiate hwmon device\n"); - kfree(data); - return PTR_ERR(hwmon); + err = PTR_ERR(hwmon); + goto err_free_log; } ctrl->hwmon_device = hwmon; return 0; + +err_free_log: + kfree(data->log); +err_free_data: + kfree(data); + return err; } void nvme_hwmon_exit(struct nvme_ctrl *ctrl) @@ -262,6 +273,7 @@ hwmon_device_unregister(ctrl->hwmon_device); ctrl->hwmon_device = NULL; + kfree(data->log); kfree(data); } } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/parisc/iosapic.c +++ linux-kvm-5.19.0/drivers/parisc/iosapic.c @@ -875,6 +875,7 @@ return vi->txn_irq; } +EXPORT_SYMBOL(iosapic_serial_irq); #endif only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/phy/qualcomm/phy-qcom-qmp.c +++ linux-kvm-5.19.0/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -6273,7 +6273,9 @@ return -ENOMEM; pm_runtime_set_active(dev); - pm_runtime_enable(dev); + ret = devm_pm_runtime_enable(dev); + if (ret) + return ret; /* * Prevent runtime pm from being ON by default. Users can enable * it using power/control in sysfs. @@ -6323,13 +6325,10 @@ phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); if (!IS_ERR(phy_provider)) dev_info(dev, "Registered Qcom-QMP phy\n"); - else - pm_runtime_disable(dev); return PTR_ERR_OR_ZERO(phy_provider); err_node_put: - pm_runtime_disable(dev); of_node_put(child); return ret; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/pinctrl/pinctrl-ingenic.c +++ linux-kvm-5.19.0/drivers/pinctrl/pinctrl-ingenic.c @@ -667,7 +667,7 @@ static const struct group_desc jz4755_groups[] = { INGENIC_PIN_GROUP("uart0-data", jz4755_uart0_data, 0), INGENIC_PIN_GROUP("uart0-hwflow", jz4755_uart0_hwflow, 0), - INGENIC_PIN_GROUP("uart1-data", jz4755_uart1_data, 0), + INGENIC_PIN_GROUP("uart1-data", jz4755_uart1_data, 1), INGENIC_PIN_GROUP("uart2-data", jz4755_uart2_data, 1), INGENIC_PIN_GROUP("ssi-dt-b", jz4755_ssi_dt_b, 0), INGENIC_PIN_GROUP("ssi-dt-f", jz4755_ssi_dt_f, 0), @@ -721,7 +721,7 @@ "ssi-ce1-b", "ssi-ce1-f", }; static const char *jz4755_mmc0_groups[] = { "mmc0-1bit", "mmc0-4bit", }; -static const char *jz4755_mmc1_groups[] = { "mmc0-1bit", "mmc0-4bit", }; +static const char *jz4755_mmc1_groups[] = { "mmc1-1bit", "mmc1-4bit", }; static const char *jz4755_i2c_groups[] = { "i2c-data", }; static const char *jz4755_cim_groups[] = { "cim-data", }; static const char *jz4755_lcd_groups[] = { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/pinctrl/qcom/pinctrl-msm.c +++ linux-kvm-5.19.0/drivers/pinctrl/qcom/pinctrl-msm.c @@ -51,6 +51,7 @@ * detection. * @skip_wake_irqs: Skip IRQs that are handled by wakeup interrupt controller * @disabled_for_mux: These IRQs were disabled because we muxed away. + * @ever_gpio: This bit is set the first time we mux a pin to gpio_func. * @soc: Reference to soc_data of platform specific data. * @regs: Base addresses for the TLMM tiles. * @phys_base: Physical base address @@ -72,6 +73,7 @@ DECLARE_BITMAP(enabled_irqs, MAX_NR_GPIO); DECLARE_BITMAP(skip_wake_irqs, MAX_NR_GPIO); DECLARE_BITMAP(disabled_for_mux, MAX_NR_GPIO); + DECLARE_BITMAP(ever_gpio, MAX_NR_GPIO); const struct msm_pinctrl_soc_data *soc; void __iomem *regs[MAX_NR_TILES]; @@ -218,6 +220,25 @@ val = msm_readl_ctl(pctrl, g); + /* + * If this is the first time muxing to GPIO and the direction is + * output, make sure that we're not going to be glitching the pin + * by reading the current state of the pin and setting it as the + * output. + */ + if (i == gpio_func && (val & BIT(g->oe_bit)) && + !test_and_set_bit(group, pctrl->ever_gpio)) { + u32 io_val = msm_readl_io(pctrl, g); + + if (io_val & BIT(g->in_bit)) { + if (!(io_val & BIT(g->out_bit))) + msm_writel_io(io_val | BIT(g->out_bit), pctrl, g); + } else { + if (io_val & BIT(g->out_bit)) + msm_writel_io(io_val & ~BIT(g->out_bit), pctrl, g); + } + } + if (egpio_func && i == egpio_func) { if (val & BIT(g->egpio_present)) val &= ~BIT(g->egpio_enable); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/s390/cio/css.c +++ linux-kvm-5.19.0/drivers/s390/cio/css.c @@ -753,13 +753,9 @@ { struct idset *set = data; struct subchannel *sch = to_subchannel(dev); - struct ccw_device *cdev; - if (sch->st == SUBCHANNEL_TYPE_IO) { - cdev = sch_get_cdev(sch); - if (cdev && cdev->online) - idset_sch_del(set, sch->schid); - } + if (sch->st == SUBCHANNEL_TYPE_IO && sch->config.ena) + idset_sch_del(set, sch->schid); return 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/scsi/lpfc/lpfc_sli4.h +++ linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_sli4.h @@ -489,7 +489,7 @@ #define LPFC_SLI4_HANDLER_NAME_SZ 16 struct lpfc_hba_eq_hdl { uint32_t idx; - uint16_t irq; + int irq; char handler_name[LPFC_SLI4_HANDLER_NAME_SZ]; struct lpfc_hba *phba; struct lpfc_queue *eq; @@ -611,6 +611,8 @@ }; #define LPFC_VECTOR_MAP_EMPTY 0xffff +#define LPFC_IRQ_EMPTY 0xffffffff + /* Multi-XRI pool */ #define XRI_BATCH 8 only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/scsi/lpfc/lpfc_vmid.c +++ linux-kvm-5.19.0/drivers/scsi/lpfc/lpfc_vmid.c @@ -245,9 +245,7 @@ /* allocate the per cpu variable for holding */ /* the last access time stamp only if VMID is enabled */ if (!vmp->last_io_time) - vmp->last_io_time = __alloc_percpu(sizeof(u64), - __alignof__(struct - lpfc_vmid)); + vmp->last_io_time = alloc_percpu_gfp(u64, GFP_ATOMIC); if (!vmp->last_io_time) { hash_del(&vmp->hnode); vmp->flag = LPFC_VMID_SLOT_FREE; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/soc/tegra/fuse/fuse-tegra.c +++ linux-kvm-5.19.0/drivers/soc/tegra/fuse/fuse-tegra.c @@ -568,6 +568,7 @@ np = of_find_matching_node(NULL, car_match); if (np) { void __iomem *base = of_iomap(np, 0); + of_node_put(np); if (base) { tegra_enable_fuse_clk(base); iounmap(base); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/spi/spi-aspeed-smc.c +++ linux-kvm-5.19.0/drivers/spi/spi-aspeed-smc.c @@ -398,7 +398,7 @@ windows[cs].cs = cs; windows[cs].size = data->segment_end(aspi, reg_val) - data->segment_start(aspi, reg_val); - windows[cs].offset = cs ? windows[cs - 1].offset + windows[cs - 1].size : 0; + windows[cs].offset = data->segment_start(aspi, reg_val) - aspi->ahb_base_phy; dev_vdbg(aspi->dev, "CE%d offset=0x%.8x size=0x%x\n", cs, windows[cs].offset, windows[cs].size); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/staging/media/atomisp/pci/sh_css_params.c +++ linux-kvm-5.19.0/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -950,8 +950,8 @@ params->fpn_config.data = NULL; } if (!params->fpn_config.data) { - params->fpn_config.data = kvmalloc(height * width * - sizeof(short), GFP_KERNEL); + params->fpn_config.data = kvmalloc(array3_size(height, width, sizeof(short)), + GFP_KERNEL); if (!params->fpn_config.data) { IA_CSS_ERROR("out of memory"); IA_CSS_LEAVE_ERR_PRIVATE(-ENOMEM); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/staging/media/ipu3/ipu3-v4l2.c +++ linux-kvm-5.19.0/drivers/staging/media/ipu3/ipu3-v4l2.c @@ -192,33 +192,30 @@ struct v4l2_subdev_state *sd_state, struct v4l2_subdev_selection *sel) { - struct v4l2_rect *try_sel, *r; - struct imgu_v4l2_subdev *imgu_sd = container_of(sd, - struct imgu_v4l2_subdev, - subdev); + struct imgu_v4l2_subdev *imgu_sd = + container_of(sd, struct imgu_v4l2_subdev, subdev); if (sel->pad != IMGU_NODE_IN) return -EINVAL; switch (sel->target) { case V4L2_SEL_TGT_CROP: - try_sel = v4l2_subdev_get_try_crop(sd, sd_state, sel->pad); - r = &imgu_sd->rect.eff; - break; + if (sel->which == V4L2_SUBDEV_FORMAT_TRY) + sel->r = *v4l2_subdev_get_try_crop(sd, sd_state, + sel->pad); + else + sel->r = imgu_sd->rect.eff; + return 0; case V4L2_SEL_TGT_COMPOSE: - try_sel = v4l2_subdev_get_try_compose(sd, sd_state, sel->pad); - r = &imgu_sd->rect.bds; - break; + if (sel->which == V4L2_SUBDEV_FORMAT_TRY) + sel->r = *v4l2_subdev_get_try_compose(sd, sd_state, + sel->pad); + else + sel->r = imgu_sd->rect.bds; + return 0; default: return -EINVAL; } - - if (sel->which == V4L2_SUBDEV_FORMAT_TRY) - sel->r = *try_sel; - else - sel->r = *r; - - return 0; } static int imgu_subdev_set_selection(struct v4l2_subdev *sd, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/staging/media/meson/vdec/vdec.c +++ linux-kvm-5.19.0/drivers/staging/media/meson/vdec/vdec.c @@ -1102,6 +1102,7 @@ err_vdev_release: video_device_release(vdev); + v4l2_device_unregister(&core->v4l2_dev); return ret; } @@ -1110,6 +1111,7 @@ struct amvdec_core *core = platform_get_drvdata(pdev); video_unregister_device(core->vdev_dec); + v4l2_device_unregister(&core->v4l2_dev); return 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/staging/media/sunxi/cedrus/Kconfig +++ linux-kvm-5.19.0/drivers/staging/media/sunxi/cedrus/Kconfig @@ -2,6 +2,7 @@ config VIDEO_SUNXI_CEDRUS tristate "Allwinner Cedrus VPU driver" depends on VIDEO_DEV + depends on RESET_CONTROLLER depends on HAS_DMA depends on OF select MEDIA_CONTROLLER only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/tee/tee_core.c +++ linux-kvm-5.19.0/drivers/tee/tee_core.c @@ -333,6 +333,9 @@ if (data.flags) return -EINVAL; + if (!access_ok((void __user *)(unsigned long)data.addr, data.length)) + return -EFAULT; + shm = tee_shm_register_user_buf(ctx, data.addr, data.length); if (IS_ERR(shm)) return PTR_ERR(shm); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/tty/serial/8250/8250_omap.c +++ linux-kvm-5.19.0/drivers/tty/serial/8250/8250_omap.c @@ -342,6 +342,9 @@ omap8250_update_mdr1(up, priv); up->port.ops->set_mctrl(&up->port, up->port.mctrl); + + if (up->port.rs485.flags & SER_RS485_ENABLED) + serial8250_em485_stop_tx(up); } /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/tty/serial/8250/Kconfig +++ linux-kvm-5.19.0/drivers/tty/serial/8250/Kconfig @@ -118,7 +118,7 @@ config SERIAL_8250_GSC tristate - depends on SERIAL_8250 && GSC + depends on SERIAL_8250 && PARISC default SERIAL_8250 config SERIAL_8250_DMA only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/tty/serial/ar933x_uart.c +++ linux-kvm-5.19.0/drivers/tty/serial/ar933x_uart.c @@ -591,6 +591,11 @@ dev_err(port->dev, "RS485 needs rts-gpio\n"); return 1; } + + if (rs485conf->flags & SER_RS485_ENABLED) + gpiod_set_value(up->rts_gpiod, + !!(rs485conf->flags & SER_RS485_RTS_AFTER_SEND)); + port->rs485 = *rs485conf; return 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/tty/serial/imx.c +++ linux-kvm-5.19.0/drivers/tty/serial/imx.c @@ -380,8 +380,7 @@ { *ucr2 &= ~(UCR2_CTSC | UCR2_CTS); - sport->port.mctrl |= TIOCM_RTS; - mctrl_gpio_set(sport->gpios, sport->port.mctrl); + mctrl_gpio_set(sport->gpios, sport->port.mctrl | TIOCM_RTS); } /* called with port.lock taken and irqs caller dependent */ @@ -390,8 +389,7 @@ *ucr2 &= ~UCR2_CTSC; *ucr2 |= UCR2_CTS; - sport->port.mctrl &= ~TIOCM_RTS; - mctrl_gpio_set(sport->gpios, sport->port.mctrl); + mctrl_gpio_set(sport->gpios, sport->port.mctrl & ~TIOCM_RTS); } static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec) @@ -2338,8 +2336,6 @@ dev_err(&pdev->dev, "low-active RTS not possible when receiver is off, enabling receiver\n"); - imx_uart_rs485_config(&sport->port, &sport->port.rs485); - /* Disable interrupts before requesting them */ ucr1 = imx_uart_readl(sport, UCR1); ucr1 &= ~(UCR1_ADEN | UCR1_TRDYEN | UCR1_IDEN | UCR1_RRDYEN | UCR1_RTSDEN); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/tty/serial/serial_core.c +++ linux-kvm-5.19.0/drivers/tty/serial/serial_core.c @@ -151,15 +151,10 @@ unsigned long flags; unsigned int old; - if (port->rs485.flags & SER_RS485_ENABLED) { - set &= ~TIOCM_RTS; - clear &= ~TIOCM_RTS; - } - spin_lock_irqsave(&port->lock, flags); old = port->mctrl; port->mctrl = (old & ~clear) | set; - if (old != port->mctrl) + if (old != port->mctrl && !(port->rs485.flags & SER_RS485_ENABLED)) port->ops->set_mctrl(port, port->mctrl); spin_unlock_irqrestore(&port->lock, flags); } @@ -1333,8 +1328,13 @@ spin_lock_irqsave(&port->lock, flags); ret = port->rs485_config(port, &rs485); - if (!ret) + if (!ret) { port->rs485 = rs485; + + /* Reset RTS and other mctrl lines when disabling RS485 */ + if (!(rs485.flags & SER_RS485_ENABLED)) + port->ops->set_mctrl(port, port->mctrl); + } spin_unlock_irqrestore(&port->lock, flags); if (ret) return ret; @@ -2318,7 +2318,8 @@ uart_change_pm(state, UART_PM_STATE_ON); spin_lock_irq(&uport->lock); - ops->set_mctrl(uport, 0); + if (!(uport->rs485.flags & SER_RS485_ENABLED)) + ops->set_mctrl(uport, 0); spin_unlock_irq(&uport->lock); if (console_suspend_enabled || !uart_console(uport)) { /* Protected by port mutex for now */ @@ -2329,7 +2330,10 @@ if (tty) uart_change_speed(tty, state, NULL); spin_lock_irq(&uport->lock); - ops->set_mctrl(uport, uport->mctrl); + if (!(uport->rs485.flags & SER_RS485_ENABLED)) + ops->set_mctrl(uport, uport->mctrl); + else + uport->rs485_config(uport, &uport->rs485); ops->start_tx(uport); spin_unlock_irq(&uport->lock); tty_port_set_initialized(port, 1); @@ -2436,10 +2440,10 @@ */ spin_lock_irqsave(&port->lock, flags); port->mctrl &= TIOCM_DTR; - if (port->rs485.flags & SER_RS485_ENABLED && - !(port->rs485.flags & SER_RS485_RTS_AFTER_SEND)) - port->mctrl |= TIOCM_RTS; - port->ops->set_mctrl(port, port->mctrl); + if (!(port->rs485.flags & SER_RS485_ENABLED)) + port->ops->set_mctrl(port, port->mctrl); + else + port->rs485_config(port, &port->rs485); spin_unlock_irqrestore(&port->lock, flags); /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/usb/common/usb-conn-gpio.c +++ linux-kvm-5.19.0/drivers/usb/common/usb-conn-gpio.c @@ -208,10 +208,8 @@ if (PTR_ERR(info->vbus) == -ENODEV) info->vbus = NULL; - if (IS_ERR(info->vbus)) { - ret = PTR_ERR(info->vbus); - return dev_err_probe(dev, ret, "failed to get vbus :%d\n", ret); - } + if (IS_ERR(info->vbus)) + return dev_err_probe(dev, PTR_ERR(info->vbus), "failed to get vbus\n"); info->role_sw = usb_role_switch_get(dev); if (IS_ERR(info->role_sw)) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/usb/gadget/udc/aspeed-vhub/dev.c +++ linux-kvm-5.19.0/drivers/usb/gadget/udc/aspeed-vhub/dev.c @@ -591,6 +591,7 @@ d->gadget.max_speed = USB_SPEED_HIGH; d->gadget.speed = USB_SPEED_UNKNOWN; d->gadget.dev.of_node = vhub->pdev->dev.of_node; + d->gadget.dev.of_node_reused = true; rc = usb_add_gadget_udc(d->port_dev, &d->gadget); if (rc != 0) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/usb/gadget/udc/bdc/bdc_udc.c +++ linux-kvm-5.19.0/drivers/usb/gadget/udc/bdc/bdc_udc.c @@ -151,6 +151,7 @@ bdc->delayed_status = false; bdc->reinit = reinit; bdc->test_mode = false; + usb_gadget_set_state(&bdc->gadget, USB_STATE_NOTATTACHED); } /* TNotify wkaeup timer */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/usb/host/xhci-pci.c +++ linux-kvm-5.19.0/drivers/usb/host/xhci-pci.c @@ -58,25 +58,13 @@ #define PCI_DEVICE_ID_INTEL_CML_XHCI 0xa3af #define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI 0x9a13 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138 -#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e -#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI 0x464e -#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed -#define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI 0xa71e -#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI 0x7ec0 +#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI 0x51ed #define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb #define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc -#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 0x161a -#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 0x161b -#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 0x161d -#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 0x161e -#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 0x15d6 -#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 0x15d7 -#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 0x161c -#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8 0x161f #define PCI_DEVICE_ID_ASMEDIA_1042_XHCI 0x1042 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 @@ -258,6 +246,10 @@ xhci->quirks |= XHCI_MISSING_CAS; if (pdev->vendor == PCI_VENDOR_ID_INTEL && + pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI) + xhci->quirks |= XHCI_RESET_TO_DEFAULT; + + if (pdev->vendor == PCI_VENDOR_ID_INTEL && (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_XHCI || @@ -268,12 +260,7 @@ pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI || pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI || - pdev->device == PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI)) + pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI)) xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; if (pdev->vendor == PCI_VENDOR_ID_ETRON && @@ -306,8 +293,14 @@ } if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && - pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) { + /* + * try to tame the ASMedia 1042 controller which reports 0.96 + * but appears to behave more like 1.0 + */ + xhci->quirks |= XHCI_SPURIOUS_SUCCESS; xhci->quirks |= XHCI_BROKEN_STREAMS; + } if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) { xhci->quirks |= XHCI_TRUST_TX_LENGTH; @@ -336,15 +329,8 @@ pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4)) xhci->quirks |= XHCI_NO_SOFT_RETRY; - if (pdev->vendor == PCI_VENDOR_ID_AMD && - (pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 || - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 || - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 || - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 || - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 || - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 || - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 || - pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8)) + /* xHC spec requires PCI devices to support D3hot and D3cold */ + if (xhci->hci_version >= 0x120) xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW; if (xhci->quirks & XHCI_RESET_ON_RESUME) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/usb/typec/ucsi/ucsi_acpi.c +++ linux-kvm-5.19.0/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -185,6 +185,15 @@ return 0; } +static int ucsi_acpi_resume(struct device *dev) +{ + struct ucsi_acpi *ua = dev_get_drvdata(dev); + + return ucsi_resume(ua->ucsi); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(ucsi_acpi_pm_ops, NULL, ucsi_acpi_resume); + static const struct acpi_device_id ucsi_acpi_match[] = { { "PNP0CA0", 0 }, { }, @@ -194,6 +203,7 @@ static struct platform_driver ucsi_acpi_platform_driver = { .driver = { .name = "ucsi_acpi", + .pm = pm_ptr(&ucsi_acpi_pm_ops), .acpi_match_table = ACPI_PTR(ucsi_acpi_match), }, .probe = ucsi_acpi_probe, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/drivers/video/fbdev/core/fbmem.c +++ linux-kvm-5.19.0/drivers/video/fbdev/core/fbmem.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -1765,17 +1764,6 @@ do_free = true; } - /* - * If a driver asked to unregister a platform device registered by - * sysfb, then can be assumed that this is a driver for a display - * that is set up by the system firmware and has a generic driver. - * - * Drivers for devices that don't have a generic driver will never - * ask for this, so let's assume that a real driver for the display - * was already probed and prevent sysfb to register devices later. - */ - sysfb_disable(); - mutex_lock(®istration_lock); do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/binfmt_elf.c +++ linux-kvm-5.19.0/fs/binfmt_elf.c @@ -911,7 +911,7 @@ interp_elf_ex = kmalloc(sizeof(*interp_elf_ex), GFP_KERNEL); if (!interp_elf_ex) { retval = -ENOMEM; - goto out_free_ph; + goto out_free_file; } /* Get the exec headers */ @@ -1354,6 +1354,7 @@ out_free_dentry: kfree(interp_elf_ex); kfree(interp_elf_phdata); +out_free_file: allow_write_access(interpreter); if (interpreter) fput(interpreter); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/btrfs/backref.c +++ linux-kvm-5.19.0/fs/btrfs/backref.c @@ -138,6 +138,7 @@ u64 root_objectid; u64 inum; int share_count; + bool have_delayed_delete_refs; }; static inline int extent_is_shared(struct share_check *sc) @@ -288,8 +289,10 @@ struct prelim_ref *ref, *next_ref; rbtree_postorder_for_each_entry_safe(ref, next_ref, - &preftree->root.rb_root, rbnode) + &preftree->root.rb_root, rbnode) { + free_inode_elem_list(ref->inode_list); free_pref(ref); + } preftree->root = RB_ROOT_CACHED; preftree->count = 0; @@ -647,6 +650,18 @@ return (struct extent_inode_elem *)(uintptr_t)node->aux; } +static void free_leaf_list(struct ulist *ulist) +{ + struct ulist_node *node; + struct ulist_iterator uiter; + + ULIST_ITER_INIT(&uiter); + while ((node = ulist_next(ulist, &uiter))) + free_inode_elem_list(unode_aux_to_inode_list(node)); + + ulist_free(ulist); +} + /* * We maintain three separate rbtrees: one for direct refs, one for * indirect refs which have a key, and one for indirect refs which do not @@ -761,7 +776,11 @@ cond_resched(); } out: - ulist_free(parents); + /* + * We may have inode lists attached to refs in the parents ulist, so we + * must free them before freeing the ulist and its refs. + */ + free_leaf_list(parents); return ret; } @@ -820,16 +839,11 @@ struct preftrees *preftrees, struct share_check *sc) { struct btrfs_delayed_ref_node *node; - struct btrfs_delayed_extent_op *extent_op = head->extent_op; struct btrfs_key key; - struct btrfs_key tmp_op_key; struct rb_node *n; int count; int ret = 0; - if (extent_op && extent_op->update_key) - btrfs_disk_key_to_cpu(&tmp_op_key, &extent_op->key); - spin_lock(&head->lock); for (n = rb_first_cached(&head->ref_tree); n; n = rb_next(n)) { node = rb_entry(n, struct btrfs_delayed_ref_node, @@ -855,10 +869,16 @@ case BTRFS_TREE_BLOCK_REF_KEY: { /* NORMAL INDIRECT METADATA backref */ struct btrfs_delayed_tree_ref *ref; + struct btrfs_key *key_ptr = NULL; + + if (head->extent_op && head->extent_op->update_key) { + btrfs_disk_key_to_cpu(&key, &head->extent_op->key); + key_ptr = &key; + } ref = btrfs_delayed_node_to_tree_ref(node); ret = add_indirect_ref(fs_info, preftrees, ref->root, - &tmp_op_key, ref->level + 1, + key_ptr, ref->level + 1, node->bytenr, count, sc, GFP_ATOMIC); break; @@ -884,13 +904,22 @@ key.offset = ref->offset; /* - * Found a inum that doesn't match our known inum, we - * know it's shared. + * If we have a share check context and a reference for + * another inode, we can't exit immediately. This is + * because even if this is a BTRFS_ADD_DELAYED_REF + * reference we may find next a BTRFS_DROP_DELAYED_REF + * which cancels out this ADD reference. + * + * If this is a DROP reference and there was no previous + * ADD reference, then we need to signal that when we + * process references from the extent tree (through + * add_inline_refs() and add_keyed_refs()), we should + * not exit early if we find a reference for another + * inode, because one of the delayed DROP references + * may cancel that reference in the extent tree. */ - if (sc && sc->inum && ref->objectid != sc->inum) { - ret = BACKREF_FOUND_SHARED; - goto out; - } + if (sc && count < 0) + sc->have_delayed_delete_refs = true; ret = add_indirect_ref(fs_info, preftrees, ref->root, &key, 0, node->bytenr, count, sc, @@ -920,7 +949,7 @@ } if (!ret) ret = extent_is_shared(sc); -out: + spin_unlock(&head->lock); return ret; } @@ -1023,7 +1052,8 @@ key.type = BTRFS_EXTENT_DATA_KEY; key.offset = btrfs_extent_data_ref_offset(leaf, dref); - if (sc && sc->inum && key.objectid != sc->inum) { + if (sc && sc->inum && key.objectid != sc->inum && + !sc->have_delayed_delete_refs) { ret = BACKREF_FOUND_SHARED; break; } @@ -1033,6 +1063,7 @@ ret = add_indirect_ref(fs_info, preftrees, root, &key, 0, bytenr, count, sc, GFP_NOFS); + break; } default: @@ -1122,7 +1153,8 @@ key.type = BTRFS_EXTENT_DATA_KEY; key.offset = btrfs_extent_data_ref_offset(leaf, dref); - if (sc && sc->inum && key.objectid != sc->inum) { + if (sc && sc->inum && key.objectid != sc->inum && + !sc->have_delayed_delete_refs) { ret = BACKREF_FOUND_SHARED; break; } @@ -1354,6 +1386,12 @@ if (ret < 0) goto out; ref->inode_list = eie; + /* + * We transferred the list ownership to the ref, + * so set to NULL to avoid a double free in case + * an error happens after this. + */ + eie = NULL; } ret = ulist_add_merge_ptr(refs, ref->parent, ref->inode_list, @@ -1379,6 +1417,14 @@ eie->next = ref->inode_list; } eie = NULL; + /* + * We have transferred the inode list ownership from + * this ref to the ref we added to the 'refs' ulist. + * So set this ref's inode list to NULL to avoid + * use-after-free when our caller uses it or double + * frees in case an error happens before we return. + */ + ref->inode_list = NULL; } cond_resched(); } @@ -1395,24 +1441,6 @@ return ret; } -static void free_leaf_list(struct ulist *blocks) -{ - struct ulist_node *node = NULL; - struct extent_inode_elem *eie; - struct ulist_iterator uiter; - - ULIST_ITER_INIT(&uiter); - while ((node = ulist_next(blocks, &uiter))) { - if (!node->aux) - continue; - eie = unode_aux_to_inode_list(node); - free_inode_elem_list(eie); - node->aux = 0; - } - - ulist_free(blocks); -} - /* * Finds all leafs with a reference to the specified combination of bytenr and * offset. key_list_head will point to a list of corresponding keys (caller must @@ -1544,6 +1572,7 @@ .root_objectid = root->root_key.objectid, .inum = inum, .share_count = 0, + .have_delayed_delete_refs = false, }; ulist_init(roots); @@ -1578,6 +1607,7 @@ break; bytenr = node->val; shared.share_count = 0; + shared.have_delayed_delete_refs = false; cond_resched(); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/btrfs/export.c +++ linux-kvm-5.19.0/fs/btrfs/export.c @@ -58,7 +58,7 @@ } struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid, - u64 root_objectid, u32 generation, + u64 root_objectid, u64 generation, int check_generation) { struct btrfs_fs_info *fs_info = btrfs_sb(sb); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/btrfs/export.h +++ linux-kvm-5.19.0/fs/btrfs/export.h @@ -19,7 +19,7 @@ } __attribute__ ((packed)); struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid, - u64 root_objectid, u32 generation, + u64 root_objectid, u64 generation, int check_generation); struct dentry *btrfs_get_parent(struct dentry *child); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/btrfs/tests/qgroup-tests.c +++ linux-kvm-5.19.0/fs/btrfs/tests/qgroup-tests.c @@ -232,8 +232,10 @@ ret = insert_normal_tree_ref(root, nodesize, nodesize, 0, BTRFS_FS_TREE_OBJECTID); - if (ret) + if (ret) { + ulist_free(old_roots); return ret; + } ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); if (ret) { @@ -266,8 +268,10 @@ } ret = remove_extent_item(root, nodesize, nodesize); - if (ret) + if (ret) { + ulist_free(old_roots); return -EINVAL; + } ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); if (ret) { @@ -329,8 +333,10 @@ ret = insert_normal_tree_ref(root, nodesize, nodesize, 0, BTRFS_FS_TREE_OBJECTID); - if (ret) + if (ret) { + ulist_free(old_roots); return ret; + } ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); if (ret) { @@ -362,8 +368,10 @@ ret = add_tree_ref(root, nodesize, nodesize, 0, BTRFS_FIRST_FREE_OBJECTID); - if (ret) + if (ret) { + ulist_free(old_roots); return ret; + } ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); if (ret) { @@ -401,8 +409,10 @@ ret = remove_extent_ref(root, nodesize, nodesize, 0, BTRFS_FIRST_FREE_OBJECTID); - if (ret) + if (ret) { + ulist_free(old_roots); return ret; + } ret = btrfs_find_all_roots(&trans, fs_info, nodesize, 0, &new_roots, false); if (ret) { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/cifs/dir.c +++ linux-kvm-5.19.0/fs/cifs/dir.c @@ -543,8 +543,10 @@ cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %pd and dentry = 0x%p\n", inode, direntry, direntry); - if (unlikely(cifs_forced_shutdown(CIFS_SB(inode->i_sb)))) - return -EIO; + if (unlikely(cifs_forced_shutdown(CIFS_SB(inode->i_sb)))) { + rc = -EIO; + goto out_free_xid; + } tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb)); rc = PTR_ERR(tlink); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/cifs/sess.c +++ linux-kvm-5.19.0/fs/cifs/sess.c @@ -496,6 +496,7 @@ cifs_put_tcp_session(chan->server, 0); } + free_xid(xid); return rc; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/crypto/fscrypt_private.h +++ linux-kvm-5.19.0/fs/crypto/fscrypt_private.h @@ -225,7 +225,7 @@ * will be NULL if the master key was found in a process-subscribed * keyring rather than in the filesystem-level keyring. */ - struct key *ci_master_key; + struct fscrypt_master_key *ci_master_key; /* * Link in list of inodes that were unlocked with the master key. @@ -440,6 +440,40 @@ struct fscrypt_master_key { /* + * Back-pointer to the super_block of the filesystem to which this + * master key has been added. Only valid if ->mk_active_refs > 0. + */ + struct super_block *mk_sb; + + /* + * Link in ->mk_sb->s_master_keys->key_hashtable. + * Only valid if ->mk_active_refs > 0. + */ + struct hlist_node mk_node; + + /* Semaphore that protects ->mk_secret and ->mk_users */ + struct rw_semaphore mk_sem; + + /* + * Active and structural reference counts. An active ref guarantees + * that the struct continues to exist, continues to be in the keyring + * ->mk_sb->s_master_keys, and that any embedded subkeys (e.g. + * ->mk_direct_keys) that have been prepared continue to exist. + * A structural ref only guarantees that the struct continues to exist. + * + * There is one active ref associated with ->mk_secret being present, + * and one active ref for each inode in ->mk_decrypted_inodes. + * + * There is one structural ref associated with the active refcount being + * nonzero. Finding a key in the keyring also takes a structural ref, + * which is then held temporarily while the key is operated on. + */ + refcount_t mk_active_refs; + refcount_t mk_struct_refs; + + struct rcu_head mk_rcu_head; + + /* * The secret key material. After FS_IOC_REMOVE_ENCRYPTION_KEY is * executed, this is wiped and no new inodes can be unlocked with this * key; however, there may still be inodes in ->mk_decrypted_inodes @@ -447,7 +481,10 @@ * FS_IOC_REMOVE_ENCRYPTION_KEY can be retried, or * FS_IOC_ADD_ENCRYPTION_KEY can add the secret again. * - * Locking: protected by this master key's key->sem. + * While ->mk_secret is present, one ref in ->mk_active_refs is held. + * + * Locking: protected by ->mk_sem. The manipulation of ->mk_active_refs + * associated with this field is protected by ->mk_sem as well. */ struct fscrypt_master_key_secret mk_secret; @@ -468,23 +505,13 @@ * * This is NULL for v1 policy keys; those can only be added by root. * - * Locking: in addition to this keyring's own semaphore, this is - * protected by this master key's key->sem, so we can do atomic - * search+insert. It can also be searched without taking any locks, but - * in that case the returned key may have already been removed. + * Locking: protected by ->mk_sem. (We don't just rely on the keyrings + * subsystem semaphore ->mk_users->sem, as we need support for atomic + * search+insert along with proper synchronization with ->mk_secret.) */ struct key *mk_users; /* - * Length of ->mk_decrypted_inodes, plus one if mk_secret is present. - * Once this goes to 0, the master key is removed from ->s_master_keys. - * The 'struct fscrypt_master_key' will continue to live as long as the - * 'struct key' whose payload it is, but we won't let this reference - * count rise again. - */ - refcount_t mk_refcount; - - /* * List of inodes that were unlocked using this key. This allows the * inodes to be evicted efficiently if the key is removed. */ @@ -509,10 +536,10 @@ is_master_key_secret_present(const struct fscrypt_master_key_secret *secret) { /* - * The READ_ONCE() is only necessary for fscrypt_drop_inode() and - * fscrypt_key_describe(). These run in atomic context, so they can't - * take the key semaphore and thus 'secret' can change concurrently - * which would be a data race. But they only need to know whether the + * The READ_ONCE() is only necessary for fscrypt_drop_inode(). + * fscrypt_drop_inode() runs in atomic context, so it can't take the key + * semaphore and thus 'secret' can change concurrently which would be a + * data race. But fscrypt_drop_inode() only need to know whether the * secret *was* present at the time of check, so READ_ONCE() suffices. */ return READ_ONCE(secret->size) != 0; @@ -541,7 +568,11 @@ return 0; } -struct key * +void fscrypt_put_master_key(struct fscrypt_master_key *mk); + +void fscrypt_put_master_key_activeref(struct fscrypt_master_key *mk); + +struct fscrypt_master_key * fscrypt_find_master_key(struct super_block *sb, const struct fscrypt_key_specifier *mk_spec); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/crypto/hooks.c +++ linux-kvm-5.19.0/fs/crypto/hooks.c @@ -5,8 +5,6 @@ * Encryption hooks for higher-level filesystem operations. */ -#include - #include "fscrypt_private.h" /** @@ -142,7 +140,6 @@ unsigned int oldflags, unsigned int flags) { struct fscrypt_info *ci; - struct key *key; struct fscrypt_master_key *mk; int err; @@ -158,14 +155,13 @@ ci = inode->i_crypt_info; if (ci->ci_policy.version != FSCRYPT_POLICY_V2) return -EINVAL; - key = ci->ci_master_key; - mk = key->payload.data[0]; - down_read(&key->sem); + mk = ci->ci_master_key; + down_read(&mk->mk_sem); if (is_master_key_secret_present(&mk->mk_secret)) err = fscrypt_derive_dirhash_key(ci, mk); else err = -ENOKEY; - up_read(&key->sem); + up_read(&mk->mk_sem); return err; } return 0; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/crypto/keyring.c +++ linux-kvm-5.19.0/fs/crypto/keyring.c @@ -18,6 +18,7 @@ * information about these ioctls. */ +#include #include #include #include @@ -25,6 +26,18 @@ #include "fscrypt_private.h" +/* The master encryption keys for a filesystem (->s_master_keys) */ +struct fscrypt_keyring { + /* + * Lock that protects ->key_hashtable. It does *not* protect the + * fscrypt_master_key structs themselves. + */ + spinlock_t lock; + + /* Hash table that maps fscrypt_key_specifier to fscrypt_master_key */ + struct hlist_head key_hashtable[128]; +}; + static void wipe_master_key_secret(struct fscrypt_master_key_secret *secret) { fscrypt_destroy_hkdf(&secret->hkdf); @@ -38,20 +51,70 @@ memzero_explicit(src, sizeof(*src)); } -static void free_master_key(struct fscrypt_master_key *mk) +static void fscrypt_free_master_key(struct rcu_head *head) +{ + struct fscrypt_master_key *mk = + container_of(head, struct fscrypt_master_key, mk_rcu_head); + /* + * The master key secret and any embedded subkeys should have already + * been wiped when the last active reference to the fscrypt_master_key + * struct was dropped; doing it here would be unnecessarily late. + * Nevertheless, use kfree_sensitive() in case anything was missed. + */ + kfree_sensitive(mk); +} + +void fscrypt_put_master_key(struct fscrypt_master_key *mk) +{ + if (!refcount_dec_and_test(&mk->mk_struct_refs)) + return; + /* + * No structural references left, so free ->mk_users, and also free the + * fscrypt_master_key struct itself after an RCU grace period ensures + * that concurrent keyring lookups can no longer find it. + */ + WARN_ON(refcount_read(&mk->mk_active_refs) != 0); + key_put(mk->mk_users); + mk->mk_users = NULL; + call_rcu(&mk->mk_rcu_head, fscrypt_free_master_key); +} + +void fscrypt_put_master_key_activeref(struct fscrypt_master_key *mk) { + struct super_block *sb = mk->mk_sb; + struct fscrypt_keyring *keyring = sb->s_master_keys; size_t i; - wipe_master_key_secret(&mk->mk_secret); + if (!refcount_dec_and_test(&mk->mk_active_refs)) + return; + /* + * No active references left, so complete the full removal of this + * fscrypt_master_key struct by removing it from the keyring and + * destroying any subkeys embedded in it. + */ + + spin_lock(&keyring->lock); + hlist_del_rcu(&mk->mk_node); + spin_unlock(&keyring->lock); + + /* + * ->mk_active_refs == 0 implies that ->mk_secret is not present and + * that ->mk_decrypted_inodes is empty. + */ + WARN_ON(is_master_key_secret_present(&mk->mk_secret)); + WARN_ON(!list_empty(&mk->mk_decrypted_inodes)); for (i = 0; i <= FSCRYPT_MODE_MAX; i++) { fscrypt_destroy_prepared_key(&mk->mk_direct_keys[i]); fscrypt_destroy_prepared_key(&mk->mk_iv_ino_lblk_64_keys[i]); fscrypt_destroy_prepared_key(&mk->mk_iv_ino_lblk_32_keys[i]); } + memzero_explicit(&mk->mk_ino_hash_key, + sizeof(mk->mk_ino_hash_key)); + mk->mk_ino_hash_key_initialized = false; - key_put(mk->mk_users); - kfree_sensitive(mk); + /* Drop the structural ref associated with the active refs. */ + fscrypt_put_master_key(mk); } static inline bool valid_key_spec(const struct fscrypt_key_specifier *spec) @@ -61,44 +124,6 @@ return master_key_spec_len(spec) != 0; } -static int fscrypt_key_instantiate(struct key *key, - struct key_preparsed_payload *prep) -{ - key->payload.data[0] = (struct fscrypt_master_key *)prep->data; - return 0; -} - -static void fscrypt_key_destroy(struct key *key) -{ - free_master_key(key->payload.data[0]); -} - -static void fscrypt_key_describe(const struct key *key, struct seq_file *m) -{ - seq_puts(m, key->description); - - if (key_is_positive(key)) { - const struct fscrypt_master_key *mk = key->payload.data[0]; - - if (!is_master_key_secret_present(&mk->mk_secret)) - seq_puts(m, ": secret removed"); - } -} - -/* - * Type of key in ->s_master_keys. Each key of this type represents a master - * key which has been added to the filesystem. Its payload is a - * 'struct fscrypt_master_key'. The "." prefix in the key type name prevents - * users from adding keys of this type via the keyrings syscalls rather than via - * the intended method of FS_IOC_ADD_ENCRYPTION_KEY. - */ -static struct key_type key_type_fscrypt = { - .name = "._fscrypt", - .instantiate = fscrypt_key_instantiate, - .destroy = fscrypt_key_destroy, - .describe = fscrypt_key_describe, -}; - static int fscrypt_user_key_instantiate(struct key *key, struct key_preparsed_payload *prep) { @@ -131,32 +156,6 @@ .describe = fscrypt_user_key_describe, }; -/* Search ->s_master_keys or ->mk_users */ -static struct key *search_fscrypt_keyring(struct key *keyring, - struct key_type *type, - const char *description) -{ - /* - * We need to mark the keyring reference as "possessed" so that we - * acquire permission to search it, via the KEY_POS_SEARCH permission. - */ - key_ref_t keyref = make_key_ref(keyring, true /* possessed */); - - keyref = keyring_search(keyref, type, description, false); - if (IS_ERR(keyref)) { - if (PTR_ERR(keyref) == -EAGAIN || /* not found */ - PTR_ERR(keyref) == -EKEYREVOKED) /* recently invalidated */ - keyref = ERR_PTR(-ENOKEY); - return ERR_CAST(keyref); - } - return key_ref_to_ptr(keyref); -} - -#define FSCRYPT_FS_KEYRING_DESCRIPTION_SIZE \ - (CONST_STRLEN("fscrypt-") + sizeof_field(struct super_block, s_id)) - -#define FSCRYPT_MK_DESCRIPTION_SIZE (2 * FSCRYPT_KEY_IDENTIFIER_SIZE + 1) - #define FSCRYPT_MK_USERS_DESCRIPTION_SIZE \ (CONST_STRLEN("fscrypt-") + 2 * FSCRYPT_KEY_IDENTIFIER_SIZE + \ CONST_STRLEN("-users") + 1) @@ -164,21 +163,6 @@ #define FSCRYPT_MK_USER_DESCRIPTION_SIZE \ (2 * FSCRYPT_KEY_IDENTIFIER_SIZE + CONST_STRLEN(".uid.") + 10 + 1) -static void format_fs_keyring_description( - char description[FSCRYPT_FS_KEYRING_DESCRIPTION_SIZE], - const struct super_block *sb) -{ - sprintf(description, "fscrypt-%s", sb->s_id); -} - -static void format_mk_description( - char description[FSCRYPT_MK_DESCRIPTION_SIZE], - const struct fscrypt_key_specifier *mk_spec) -{ - sprintf(description, "%*phN", - master_key_spec_len(mk_spec), (u8 *)&mk_spec->u); -} - static void format_mk_users_keyring_description( char description[FSCRYPT_MK_USERS_DESCRIPTION_SIZE], const u8 mk_identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]) @@ -199,20 +183,15 @@ /* Create ->s_master_keys if needed. Synchronized by fscrypt_add_key_mutex. */ static int allocate_filesystem_keyring(struct super_block *sb) { - char description[FSCRYPT_FS_KEYRING_DESCRIPTION_SIZE]; - struct key *keyring; + struct fscrypt_keyring *keyring; if (sb->s_master_keys) return 0; - format_fs_keyring_description(description, sb); - keyring = keyring_alloc(description, GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, - current_cred(), KEY_POS_SEARCH | - KEY_USR_SEARCH | KEY_USR_READ | KEY_USR_VIEW, - KEY_ALLOC_NOT_IN_QUOTA, NULL, NULL); - if (IS_ERR(keyring)) - return PTR_ERR(keyring); - + keyring = kzalloc(sizeof(*keyring), GFP_KERNEL); + if (!keyring) + return -ENOMEM; + spin_lock_init(&keyring->lock); /* * Pairs with the smp_load_acquire() in fscrypt_find_master_key(). * I.e., here we publish ->s_master_keys with a RELEASE barrier so that @@ -222,21 +201,80 @@ return 0; } -void fscrypt_sb_free(struct super_block *sb) +/* + * Release all encryption keys that have been added to the filesystem, along + * with the keyring that contains them. + * + * This is called at unmount time. The filesystem's underlying block device(s) + * are still available at this time; this is important because after user file + * accesses have been allowed, this function may need to evict keys from the + * keyslots of an inline crypto engine, which requires the block device(s). + * + * This is also called when the super_block is being freed. This is needed to + * avoid a memory leak if mounting fails after the "test_dummy_encryption" + * option was processed, as in that case the unmount-time call isn't made. + */ +void fscrypt_destroy_keyring(struct super_block *sb) { - key_put(sb->s_master_keys); + struct fscrypt_keyring *keyring = sb->s_master_keys; + size_t i; + + if (!keyring) + return; + + for (i = 0; i < ARRAY_SIZE(keyring->key_hashtable); i++) { + struct hlist_head *bucket = &keyring->key_hashtable[i]; + struct fscrypt_master_key *mk; + struct hlist_node *tmp; + + hlist_for_each_entry_safe(mk, tmp, bucket, mk_node) { + /* + * Since all inodes were already evicted, every key + * remaining in the keyring should have an empty inode + * list, and should only still be in the keyring due to + * the single active ref associated with ->mk_secret. + * There should be no structural refs beyond the one + * associated with the active ref. + */ + WARN_ON(refcount_read(&mk->mk_active_refs) != 1); + WARN_ON(refcount_read(&mk->mk_struct_refs) != 1); + WARN_ON(!is_master_key_secret_present(&mk->mk_secret)); + wipe_master_key_secret(&mk->mk_secret); + fscrypt_put_master_key_activeref(mk); + } + } + kfree_sensitive(keyring); sb->s_master_keys = NULL; } +static struct hlist_head * +fscrypt_mk_hash_bucket(struct fscrypt_keyring *keyring, + const struct fscrypt_key_specifier *mk_spec) +{ + /* + * Since key specifiers should be "random" values, it is sufficient to + * use a trivial hash function that just takes the first several bits of + * the key specifier. + */ + unsigned long i = get_unaligned((unsigned long *)&mk_spec->u); + + return &keyring->key_hashtable[i % ARRAY_SIZE(keyring->key_hashtable)]; +} + /* - * Find the specified master key in ->s_master_keys. - * Returns ERR_PTR(-ENOKEY) if not found. + * Find the specified master key struct in ->s_master_keys and take a structural + * ref to it. The structural ref guarantees that the key struct continues to + * exist, but it does *not* guarantee that ->s_master_keys continues to contain + * the key struct. The structural ref needs to be dropped by + * fscrypt_put_master_key(). Returns NULL if the key struct is not found. */ -struct key *fscrypt_find_master_key(struct super_block *sb, - const struct fscrypt_key_specifier *mk_spec) +struct fscrypt_master_key * +fscrypt_find_master_key(struct super_block *sb, + const struct fscrypt_key_specifier *mk_spec) { - struct key *keyring; - char description[FSCRYPT_MK_DESCRIPTION_SIZE]; + struct fscrypt_keyring *keyring; + struct hlist_head *bucket; + struct fscrypt_master_key *mk; /* * Pairs with the smp_store_release() in allocate_filesystem_keyring(). @@ -246,10 +284,38 @@ */ keyring = smp_load_acquire(&sb->s_master_keys); if (keyring == NULL) - return ERR_PTR(-ENOKEY); /* No keyring yet, so no keys yet. */ + return NULL; /* No keyring yet, so no keys yet. */ - format_mk_description(description, mk_spec); - return search_fscrypt_keyring(keyring, &key_type_fscrypt, description); + bucket = fscrypt_mk_hash_bucket(keyring, mk_spec); + rcu_read_lock(); + switch (mk_spec->type) { + case FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR: + hlist_for_each_entry_rcu(mk, bucket, mk_node) { + if (mk->mk_spec.type == + FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR && + memcmp(mk->mk_spec.u.descriptor, + mk_spec->u.descriptor, + FSCRYPT_KEY_DESCRIPTOR_SIZE) == 0 && + refcount_inc_not_zero(&mk->mk_struct_refs)) + goto out; + } + break; + case FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER: + hlist_for_each_entry_rcu(mk, bucket, mk_node) { + if (mk->mk_spec.type == + FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER && + memcmp(mk->mk_spec.u.identifier, + mk_spec->u.identifier, + FSCRYPT_KEY_IDENTIFIER_SIZE) == 0 && + refcount_inc_not_zero(&mk->mk_struct_refs)) + goto out; + } + break; + } + mk = NULL; +out: + rcu_read_unlock(); + return mk; } static int allocate_master_key_users_keyring(struct fscrypt_master_key *mk) @@ -277,17 +343,30 @@ static struct key *find_master_key_user(struct fscrypt_master_key *mk) { char description[FSCRYPT_MK_USER_DESCRIPTION_SIZE]; + key_ref_t keyref; format_mk_user_description(description, mk->mk_spec.u.identifier); - return search_fscrypt_keyring(mk->mk_users, &key_type_fscrypt_user, - description); + + /* + * We need to mark the keyring reference as "possessed" so that we + * acquire permission to search it, via the KEY_POS_SEARCH permission. + */ + keyref = keyring_search(make_key_ref(mk->mk_users, true /*possessed*/), + &key_type_fscrypt_user, description, false); + if (IS_ERR(keyref)) { + if (PTR_ERR(keyref) == -EAGAIN || /* not found */ + PTR_ERR(keyref) == -EKEYREVOKED) /* recently invalidated */ + keyref = ERR_PTR(-ENOKEY); + return ERR_CAST(keyref); + } + return key_ref_to_ptr(keyref); } /* * Give the current user a "key" in ->mk_users. This charges the user's quota * and marks the master key as added by the current user, so that it cannot be - * removed by another user with the key. Either the master key's key->sem must - * be held for write, or the master key must be still undergoing initialization. + * removed by another user with the key. Either ->mk_sem must be held for + * write, or the master key must be still undergoing initialization. */ static int add_master_key_user(struct fscrypt_master_key *mk) { @@ -309,7 +388,7 @@ /* * Remove the current user's "key" from ->mk_users. - * The master key's key->sem must be held for write. + * ->mk_sem must be held for write. * * Returns 0 if removed, -ENOKEY if not found, or another -errno code. */ @@ -327,63 +406,49 @@ } /* - * Allocate a new fscrypt_master_key which contains the given secret, set it as - * the payload of a new 'struct key' of type fscrypt, and link the 'struct key' - * into the given keyring. Synchronized by fscrypt_add_key_mutex. + * Allocate a new fscrypt_master_key, transfer the given secret over to it, and + * insert it into sb->s_master_keys. */ -static int add_new_master_key(struct fscrypt_master_key_secret *secret, - const struct fscrypt_key_specifier *mk_spec, - struct key *keyring) +static int add_new_master_key(struct super_block *sb, + struct fscrypt_master_key_secret *secret, + const struct fscrypt_key_specifier *mk_spec) { + struct fscrypt_keyring *keyring = sb->s_master_keys; struct fscrypt_master_key *mk; - char description[FSCRYPT_MK_DESCRIPTION_SIZE]; - struct key *key; int err; mk = kzalloc(sizeof(*mk), GFP_KERNEL); if (!mk) return -ENOMEM; + mk->mk_sb = sb; + init_rwsem(&mk->mk_sem); + refcount_set(&mk->mk_struct_refs, 1); mk->mk_spec = *mk_spec; - move_master_key_secret(&mk->mk_secret, secret); - - refcount_set(&mk->mk_refcount, 1); /* secret is present */ INIT_LIST_HEAD(&mk->mk_decrypted_inodes); spin_lock_init(&mk->mk_decrypted_inodes_lock); if (mk_spec->type == FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER) { err = allocate_master_key_users_keyring(mk); if (err) - goto out_free_mk; + goto out_put; err = add_master_key_user(mk); if (err) - goto out_free_mk; + goto out_put; } - /* - * Note that we don't charge this key to anyone's quota, since when - * ->mk_users is in use those keys are charged instead, and otherwise - * (when ->mk_users isn't in use) only root can add these keys. - */ - format_mk_description(description, mk_spec); - key = key_alloc(&key_type_fscrypt, description, - GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, current_cred(), - KEY_POS_SEARCH | KEY_USR_SEARCH | KEY_USR_VIEW, - KEY_ALLOC_NOT_IN_QUOTA, NULL); - if (IS_ERR(key)) { - err = PTR_ERR(key); - goto out_free_mk; - } - err = key_instantiate_and_link(key, mk, sizeof(*mk), keyring, NULL); - key_put(key); - if (err) - goto out_free_mk; + move_master_key_secret(&mk->mk_secret, secret); + refcount_set(&mk->mk_active_refs, 1); /* ->mk_secret is present */ + spin_lock(&keyring->lock); + hlist_add_head_rcu(&mk->mk_node, + fscrypt_mk_hash_bucket(keyring, mk_spec)); + spin_unlock(&keyring->lock); return 0; -out_free_mk: - free_master_key(mk); +out_put: + fscrypt_put_master_key(mk); return err; } @@ -392,42 +457,34 @@ static int add_existing_master_key(struct fscrypt_master_key *mk, struct fscrypt_master_key_secret *secret) { - struct key *mk_user; - bool rekey; int err; /* * If the current user is already in ->mk_users, then there's nothing to - * do. (Not applicable for v1 policy keys, which have NULL ->mk_users.) + * do. Otherwise, we need to add the user to ->mk_users. (Neither is + * applicable for v1 policy keys, which have NULL ->mk_users.) */ if (mk->mk_users) { - mk_user = find_master_key_user(mk); + struct key *mk_user = find_master_key_user(mk); + if (mk_user != ERR_PTR(-ENOKEY)) { if (IS_ERR(mk_user)) return PTR_ERR(mk_user); key_put(mk_user); return 0; } - } - - /* If we'll be re-adding ->mk_secret, try to take the reference. */ - rekey = !is_master_key_secret_present(&mk->mk_secret); - if (rekey && !refcount_inc_not_zero(&mk->mk_refcount)) - return KEY_DEAD; - - /* Add the current user to ->mk_users, if applicable. */ - if (mk->mk_users) { err = add_master_key_user(mk); - if (err) { - if (rekey && refcount_dec_and_test(&mk->mk_refcount)) - return KEY_DEAD; + if (err) return err; - } } /* Re-add the secret if needed. */ - if (rekey) + if (!is_master_key_secret_present(&mk->mk_secret)) { + if (!refcount_inc_not_zero(&mk->mk_active_refs)) + return KEY_DEAD; move_master_key_secret(&mk->mk_secret, secret); + } + return 0; } @@ -436,38 +493,36 @@ const struct fscrypt_key_specifier *mk_spec) { static DEFINE_MUTEX(fscrypt_add_key_mutex); - struct key *key; + struct fscrypt_master_key *mk; int err; mutex_lock(&fscrypt_add_key_mutex); /* serialize find + link */ -retry: - key = fscrypt_find_master_key(sb, mk_spec); - if (IS_ERR(key)) { - err = PTR_ERR(key); - if (err != -ENOKEY) - goto out_unlock; + + mk = fscrypt_find_master_key(sb, mk_spec); + if (!mk) { /* Didn't find the key in ->s_master_keys. Add it. */ err = allocate_filesystem_keyring(sb); - if (err) - goto out_unlock; - err = add_new_master_key(secret, mk_spec, sb->s_master_keys); + if (!err) + err = add_new_master_key(sb, secret, mk_spec); } else { /* * Found the key in ->s_master_keys. Re-add the secret if * needed, and add the user to ->mk_users if needed. */ - down_write(&key->sem); - err = add_existing_master_key(key->payload.data[0], secret); - up_write(&key->sem); + down_write(&mk->mk_sem); + err = add_existing_master_key(mk, secret); + up_write(&mk->mk_sem); if (err == KEY_DEAD) { - /* Key being removed or needs to be removed */ - key_invalidate(key); - key_put(key); - goto retry; + /* + * We found a key struct, but it's already been fully + * removed. Ignore the old struct and add a new one. + * fscrypt_add_key_mutex means we don't need to worry + * about concurrent adds. + */ + err = add_new_master_key(sb, secret, mk_spec); } - key_put(key); + fscrypt_put_master_key(mk); } -out_unlock: mutex_unlock(&fscrypt_add_key_mutex); return err; } @@ -771,19 +826,19 @@ const u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]) { struct fscrypt_key_specifier mk_spec; - struct key *key, *mk_user; struct fscrypt_master_key *mk; + struct key *mk_user; int err; mk_spec.type = FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER; memcpy(mk_spec.u.identifier, identifier, FSCRYPT_KEY_IDENTIFIER_SIZE); - key = fscrypt_find_master_key(sb, &mk_spec); - if (IS_ERR(key)) { - err = PTR_ERR(key); + mk = fscrypt_find_master_key(sb, &mk_spec); + if (!mk) { + err = -ENOKEY; goto out; } - mk = key->payload.data[0]; + down_read(&mk->mk_sem); mk_user = find_master_key_user(mk); if (IS_ERR(mk_user)) { err = PTR_ERR(mk_user); @@ -791,7 +846,8 @@ key_put(mk_user); err = 0; } - key_put(key); + up_read(&mk->mk_sem); + fscrypt_put_master_key(mk); out: if (err == -ENOKEY && capable(CAP_FOWNER)) err = 0; @@ -953,11 +1009,10 @@ struct super_block *sb = file_inode(filp)->i_sb; struct fscrypt_remove_key_arg __user *uarg = _uarg; struct fscrypt_remove_key_arg arg; - struct key *key; struct fscrypt_master_key *mk; u32 status_flags = 0; int err; - bool dead; + bool inodes_remain; if (copy_from_user(&arg, uarg, sizeof(arg))) return -EFAULT; @@ -977,12 +1032,10 @@ return -EACCES; /* Find the key being removed. */ - key = fscrypt_find_master_key(sb, &arg.key_spec); - if (IS_ERR(key)) - return PTR_ERR(key); - mk = key->payload.data[0]; - - down_write(&key->sem); + mk = fscrypt_find_master_key(sb, &arg.key_spec); + if (!mk) + return -ENOKEY; + down_write(&mk->mk_sem); /* If relevant, remove current user's (or all users) claim to the key */ if (mk->mk_users && mk->mk_users->keys.nr_leaves_on_tree != 0) { @@ -991,7 +1044,7 @@ else err = remove_master_key_user(mk); if (err) { - up_write(&key->sem); + up_write(&mk->mk_sem); goto out_put_key; } if (mk->mk_users->keys.nr_leaves_on_tree != 0) { @@ -1003,26 +1056,22 @@ status_flags |= FSCRYPT_KEY_REMOVAL_STATUS_FLAG_OTHER_USERS; err = 0; - up_write(&key->sem); + up_write(&mk->mk_sem); goto out_put_key; } } /* No user claims remaining. Go ahead and wipe the secret. */ - dead = false; + err = -ENOKEY; if (is_master_key_secret_present(&mk->mk_secret)) { wipe_master_key_secret(&mk->mk_secret); - dead = refcount_dec_and_test(&mk->mk_refcount); - } - up_write(&key->sem); - if (dead) { - /* - * No inodes reference the key, and we wiped the secret, so the - * key object is free to be removed from the keyring. - */ - key_invalidate(key); + fscrypt_put_master_key_activeref(mk); err = 0; - } else { + } + inodes_remain = refcount_read(&mk->mk_active_refs) > 0; + up_write(&mk->mk_sem); + + if (inodes_remain) { /* Some inodes still reference this key; try to evict them. */ err = try_to_lock_encrypted_files(sb, mk); if (err == -EBUSY) { @@ -1038,7 +1087,7 @@ * has been fully removed including all files locked. */ out_put_key: - key_put(key); + fscrypt_put_master_key(mk); if (err == 0) err = put_user(status_flags, &uarg->removal_status_flags); return err; @@ -1085,7 +1134,6 @@ { struct super_block *sb = file_inode(filp)->i_sb; struct fscrypt_get_key_status_arg arg; - struct key *key; struct fscrypt_master_key *mk; int err; @@ -1102,19 +1150,18 @@ arg.user_count = 0; memset(arg.__out_reserved, 0, sizeof(arg.__out_reserved)); - key = fscrypt_find_master_key(sb, &arg.key_spec); - if (IS_ERR(key)) { - if (key != ERR_PTR(-ENOKEY)) - return PTR_ERR(key); + mk = fscrypt_find_master_key(sb, &arg.key_spec); + if (!mk) { arg.status = FSCRYPT_KEY_STATUS_ABSENT; err = 0; goto out; } - mk = key->payload.data[0]; - down_read(&key->sem); + down_read(&mk->mk_sem); if (!is_master_key_secret_present(&mk->mk_secret)) { - arg.status = FSCRYPT_KEY_STATUS_INCOMPLETELY_REMOVED; + arg.status = refcount_read(&mk->mk_active_refs) > 0 ? + FSCRYPT_KEY_STATUS_INCOMPLETELY_REMOVED : + FSCRYPT_KEY_STATUS_ABSENT /* raced with full removal */; err = 0; goto out_release_key; } @@ -1136,8 +1183,8 @@ } err = 0; out_release_key: - up_read(&key->sem); - key_put(key); + up_read(&mk->mk_sem); + fscrypt_put_master_key(mk); out: if (!err && copy_to_user(uarg, &arg, sizeof(arg))) err = -EFAULT; @@ -1149,13 +1196,9 @@ { int err; - err = register_key_type(&key_type_fscrypt); - if (err) - return err; - err = register_key_type(&key_type_fscrypt_user); if (err) - goto err_unregister_fscrypt; + return err; err = register_key_type(&key_type_fscrypt_provisioning); if (err) @@ -1165,7 +1208,5 @@ err_unregister_fscrypt_user: unregister_key_type(&key_type_fscrypt_user); -err_unregister_fscrypt: - unregister_key_type(&key_type_fscrypt); return err; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/crypto/keysetup.c +++ linux-kvm-5.19.0/fs/crypto/keysetup.c @@ -9,7 +9,6 @@ */ #include -#include #include #include "fscrypt_private.h" @@ -152,6 +151,7 @@ { crypto_free_skcipher(prep_key->tfm); fscrypt_destroy_inline_crypt_key(prep_key); + memzero_explicit(prep_key, sizeof(*prep_key)); } /* Given a per-file encryption key, set up the file's crypto transform object */ @@ -405,20 +405,18 @@ /* * Find the master key, then set up the inode's actual encryption key. * - * If the master key is found in the filesystem-level keyring, then the - * corresponding 'struct key' is returned in *master_key_ret with its semaphore - * read-locked. This is needed to ensure that only one task links the - * fscrypt_info into ->mk_decrypted_inodes (as multiple tasks may race to create - * an fscrypt_info for the same inode), and to synchronize the master key being - * removed with a new inode starting to use it. + * If the master key is found in the filesystem-level keyring, then it is + * returned in *mk_ret with its semaphore read-locked. This is needed to ensure + * that only one task links the fscrypt_info into ->mk_decrypted_inodes (as + * multiple tasks may race to create an fscrypt_info for the same inode), and to + * synchronize the master key being removed with a new inode starting to use it. */ static int setup_file_encryption_key(struct fscrypt_info *ci, bool need_dirhash_key, - struct key **master_key_ret) + struct fscrypt_master_key **mk_ret) { - struct key *key; - struct fscrypt_master_key *mk = NULL; struct fscrypt_key_specifier mk_spec; + struct fscrypt_master_key *mk; int err; err = fscrypt_select_encryption_impl(ci); @@ -429,11 +427,10 @@ if (err) return err; - key = fscrypt_find_master_key(ci->ci_inode->i_sb, &mk_spec); - if (IS_ERR(key)) { - if (key != ERR_PTR(-ENOKEY) || - ci->ci_policy.version != FSCRYPT_POLICY_V1) - return PTR_ERR(key); + mk = fscrypt_find_master_key(ci->ci_inode->i_sb, &mk_spec); + if (!mk) { + if (ci->ci_policy.version != FSCRYPT_POLICY_V1) + return -ENOKEY; /* * As a legacy fallback for v1 policies, search for the key in @@ -443,9 +440,7 @@ */ return fscrypt_setup_v1_file_key_via_subscribed_keyrings(ci); } - - mk = key->payload.data[0]; - down_read(&key->sem); + down_read(&mk->mk_sem); /* Has the secret been removed (via FS_IOC_REMOVE_ENCRYPTION_KEY)? */ if (!is_master_key_secret_present(&mk->mk_secret)) { @@ -473,18 +468,18 @@ if (err) goto out_release_key; - *master_key_ret = key; + *mk_ret = mk; return 0; out_release_key: - up_read(&key->sem); - key_put(key); + up_read(&mk->mk_sem); + fscrypt_put_master_key(mk); return err; } static void put_crypt_info(struct fscrypt_info *ci) { - struct key *key; + struct fscrypt_master_key *mk; if (!ci) return; @@ -494,24 +489,18 @@ else if (ci->ci_owns_key) fscrypt_destroy_prepared_key(&ci->ci_enc_key); - key = ci->ci_master_key; - if (key) { - struct fscrypt_master_key *mk = key->payload.data[0]; - + mk = ci->ci_master_key; + if (mk) { /* * Remove this inode from the list of inodes that were unlocked - * with the master key. - * - * In addition, if we're removing the last inode from a key that - * already had its secret removed, invalidate the key so that it - * gets removed from ->s_master_keys. + * with the master key. In addition, if we're removing the last + * inode from a master key struct that already had its secret + * removed, then complete the full removal of the struct. */ spin_lock(&mk->mk_decrypted_inodes_lock); list_del(&ci->ci_master_key_link); spin_unlock(&mk->mk_decrypted_inodes_lock); - if (refcount_dec_and_test(&mk->mk_refcount)) - key_invalidate(key); - key_put(key); + fscrypt_put_master_key_activeref(mk); } memzero_explicit(ci, sizeof(*ci)); kmem_cache_free(fscrypt_info_cachep, ci); @@ -525,7 +514,7 @@ { struct fscrypt_info *crypt_info; struct fscrypt_mode *mode; - struct key *master_key = NULL; + struct fscrypt_master_key *mk = NULL; int res; res = fscrypt_initialize(inode->i_sb->s_cop->flags); @@ -548,8 +537,7 @@ WARN_ON(mode->ivsize > FSCRYPT_MAX_IV_SIZE); crypt_info->ci_mode = mode; - res = setup_file_encryption_key(crypt_info, need_dirhash_key, - &master_key); + res = setup_file_encryption_key(crypt_info, need_dirhash_key, &mk); if (res) goto out; @@ -564,12 +552,9 @@ * We won the race and set ->i_crypt_info to our crypt_info. * Now link it into the master key's inode list. */ - if (master_key) { - struct fscrypt_master_key *mk = - master_key->payload.data[0]; - - refcount_inc(&mk->mk_refcount); - crypt_info->ci_master_key = key_get(master_key); + if (mk) { + crypt_info->ci_master_key = mk; + refcount_inc(&mk->mk_active_refs); spin_lock(&mk->mk_decrypted_inodes_lock); list_add(&crypt_info->ci_master_key_link, &mk->mk_decrypted_inodes); @@ -579,9 +564,9 @@ } res = 0; out: - if (master_key) { - up_read(&master_key->sem); - key_put(master_key); + if (mk) { + up_read(&mk->mk_sem); + fscrypt_put_master_key(mk); } put_crypt_info(crypt_info); return res; @@ -746,7 +731,6 @@ int fscrypt_drop_inode(struct inode *inode) { const struct fscrypt_info *ci = fscrypt_get_info(inode); - const struct fscrypt_master_key *mk; /* * If ci is NULL, then the inode doesn't have an encryption key set up @@ -756,7 +740,6 @@ */ if (!ci || !ci->ci_master_key) return 0; - mk = ci->ci_master_key->payload.data[0]; /* * With proper, non-racy use of FS_IOC_REMOVE_ENCRYPTION_KEY, all inodes @@ -775,6 +758,6 @@ * then the thread removing the key will either evict the inode itself * or will correctly detect that it wasn't evicted due to the race. */ - return !is_master_key_secret_present(&mk->mk_secret); + return !is_master_key_secret_present(&ci->ci_master_key->mk_secret); } EXPORT_SYMBOL_GPL(fscrypt_drop_inode); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/crypto/policy.c +++ linux-kvm-5.19.0/fs/crypto/policy.c @@ -713,12 +713,8 @@ * delayed key setup that requires the inode number. */ if (ci->ci_policy.version == FSCRYPT_POLICY_V2 && - (ci->ci_policy.v2.flags & FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32)) { - const struct fscrypt_master_key *mk = - ci->ci_master_key->payload.data[0]; - - fscrypt_hash_inode_number(ci, mk); - } + (ci->ci_policy.v2.flags & FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32)) + fscrypt_hash_inode_number(ci, ci->ci_master_key); return inode->i_sb->s_cop->set_context(inode, &ctx, ctxsize, fs_data); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/ext4/verity.c +++ linux-kvm-5.19.0/fs/ext4/verity.c @@ -365,13 +365,14 @@ pgoff_t index, unsigned long num_ra_pages) { - DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); struct page *page; index += ext4_verity_metadata_pos(inode) >> PAGE_SHIFT; page = find_get_page_flags(inode->i_mapping, index, FGP_ACCESSED); if (!page || !PageUptodate(page)) { + DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); + if (page) put_page(page); else if (num_ra_pages > 1) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/f2fs/verity.c +++ linux-kvm-5.19.0/fs/f2fs/verity.c @@ -262,13 +262,14 @@ pgoff_t index, unsigned long num_ra_pages) { - DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); struct page *page; index += f2fs_verity_metadata_pos(inode) >> PAGE_SHIFT; page = find_get_page_flags(inode->i_mapping, index, FGP_ACCESSED); if (!page || !PageUptodate(page)) { + DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); + if (page) put_page(page); else if (num_ra_pages > 1) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/fuse/readdir.c +++ linux-kvm-5.19.0/fs/fuse/readdir.c @@ -77,8 +77,10 @@ goto unlock; addr = kmap_local_page(page); - if (!offset) + if (!offset) { clear_page(addr); + SetPageUptodate(page); + } memcpy(addr + offset, dirent, reclen); kunmap_local(addr); fi->rdc.size = (index << PAGE_SHIFT) + offset + reclen; @@ -516,6 +518,12 @@ page = find_get_page_flags(file->f_mapping, index, FGP_ACCESSED | FGP_LOCK); + /* Page gone missing, then re-added to cache, but not initialized? */ + if (page && !PageUptodate(page)) { + unlock_page(page); + put_page(page); + page = NULL; + } spin_lock(&fi->rdc.lock); if (!page) { /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/nfs/delegation.c +++ linux-kvm-5.19.0/fs/nfs/delegation.c @@ -228,8 +228,7 @@ * */ void nfs_inode_reclaim_delegation(struct inode *inode, const struct cred *cred, - fmode_t type, - const nfs4_stateid *stateid, + fmode_t type, const nfs4_stateid *stateid, unsigned long pagemod_limit) { struct nfs_delegation *delegation; @@ -239,25 +238,24 @@ delegation = rcu_dereference(NFS_I(inode)->delegation); if (delegation != NULL) { spin_lock(&delegation->lock); - if (nfs4_is_valid_delegation(delegation, 0)) { - nfs4_stateid_copy(&delegation->stateid, stateid); - delegation->type = type; - delegation->pagemod_limit = pagemod_limit; - oldcred = delegation->cred; - delegation->cred = get_cred(cred); - clear_bit(NFS_DELEGATION_NEED_RECLAIM, - &delegation->flags); - spin_unlock(&delegation->lock); - rcu_read_unlock(); - put_cred(oldcred); - trace_nfs4_reclaim_delegation(inode, type); - return; - } - /* We appear to have raced with a delegation return. */ + nfs4_stateid_copy(&delegation->stateid, stateid); + delegation->type = type; + delegation->pagemod_limit = pagemod_limit; + oldcred = delegation->cred; + delegation->cred = get_cred(cred); + clear_bit(NFS_DELEGATION_NEED_RECLAIM, &delegation->flags); + if (test_and_clear_bit(NFS_DELEGATION_REVOKED, + &delegation->flags)) + atomic_long_inc(&nfs_active_delegations); spin_unlock(&delegation->lock); + rcu_read_unlock(); + put_cred(oldcred); + trace_nfs4_reclaim_delegation(inode, type); + } else { + rcu_read_unlock(); + nfs_inode_set_delegation(inode, cred, type, stateid, + pagemod_limit); } - rcu_read_unlock(); - nfs_inode_set_delegation(inode, cred, type, stateid, pagemod_limit); } static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *delegation, int issync) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/nfs/nfs4client.c +++ linux-kvm-5.19.0/fs/nfs/nfs4client.c @@ -346,6 +346,7 @@ ret = nfs4_setup_slot_table(tbl, NFS4_MAX_SLOT_TABLE, "NFSv4.0 transport Slot table"); if (ret) { + nfs4_shutdown_slot_table(tbl); kfree(tbl); return ret; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/nfs/nfs4state.c +++ linux-kvm-5.19.0/fs/nfs/nfs4state.c @@ -1787,6 +1787,7 @@ static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp) { + set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state); /* Mark all delegations for reclaim */ nfs_delegation_mark_reclaim(clp); nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_reboot); @@ -2671,6 +2672,7 @@ if (status < 0) goto out_error; nfs4_state_end_reclaim_reboot(clp); + continue; } /* Detect expired delegations... */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/ocfs2/namei.c +++ linux-kvm-5.19.0/fs/ocfs2/namei.c @@ -231,6 +231,7 @@ handle_t *handle = NULL; struct ocfs2_super *osb; struct ocfs2_dinode *dirfe; + struct ocfs2_dinode *fe = NULL; struct buffer_head *new_fe_bh = NULL; struct inode *inode = NULL; struct ocfs2_alloc_context *inode_ac = NULL; @@ -381,6 +382,7 @@ goto leave; } + fe = (struct ocfs2_dinode *) new_fe_bh->b_data; if (S_ISDIR(mode)) { status = ocfs2_fill_new_dir(osb, handle, dir, inode, new_fe_bh, data_ac, meta_ac); @@ -453,8 +455,11 @@ leave: if (status < 0 && did_quota_inode) dquot_free_inode(inode); - if (handle) + if (handle) { + if (status < 0 && fe) + ocfs2_set_links_count(fe, 0); ocfs2_commit_trans(osb, handle); + } ocfs2_inode_unlock(dir, 1); if (did_block_signals) @@ -631,18 +636,9 @@ return status; } - status = __ocfs2_mknod_locked(dir, inode, dev, new_fe_bh, + return __ocfs2_mknod_locked(dir, inode, dev, new_fe_bh, parent_fe_bh, handle, inode_ac, fe_blkno, suballoc_loc, suballoc_bit); - if (status < 0) { - u64 bg_blkno = ocfs2_which_suballoc_group(fe_blkno, suballoc_bit); - int tmp = ocfs2_free_suballoc_bits(handle, inode_ac->ac_inode, - inode_ac->ac_bh, suballoc_bit, bg_blkno, 1); - if (tmp) - mlog_errno(tmp); - } - - return status; } static int ocfs2_mkdir(struct user_namespace *mnt_userns, @@ -2027,8 +2023,11 @@ ocfs2_clusters_to_bytes(osb->sb, 1)); if (status < 0 && did_quota_inode) dquot_free_inode(inode); - if (handle) + if (handle) { + if (status < 0 && fe) + ocfs2_set_links_count(fe, 0); ocfs2_commit_trans(osb, handle); + } ocfs2_inode_unlock(dir, 1); if (did_block_signals) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/fs/super.c +++ linux-kvm-5.19.0/fs/super.c @@ -291,7 +291,7 @@ WARN_ON(s->s_inode_lru.node); WARN_ON(!list_empty(&s->s_mounts)); security_sb_free(s); - fscrypt_sb_free(s); + fscrypt_destroy_keyring(s); put_user_ns(s->s_user_ns); kfree(s->s_subtype); call_rcu(&s->rcu, destroy_super_rcu); @@ -451,6 +451,7 @@ evict_inodes(sb); /* only nonzero refcount inodes can have marks */ fsnotify_sb_delete(sb); + fscrypt_destroy_keyring(sb); security_sb_delete(sb); if (sb->s_dio_done_wq) { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/acpi/ghes.h +++ linux-kvm-5.19.0/include/acpi/ghes.h @@ -71,7 +71,7 @@ void ghes_unregister_vendor_record_notifier(struct notifier_block *nb); #endif -int ghes_estatus_pool_init(int num_ghes); +int ghes_estatus_pool_init(unsigned int num_ghes); /* From drivers/edac/ghes_edac.c */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/linux/fscrypt.h +++ linux-kvm-5.19.0/include/linux/fscrypt.h @@ -311,7 +311,7 @@ } /* keyring.c */ -void fscrypt_sb_free(struct super_block *sb); +void fscrypt_destroy_keyring(struct super_block *sb); int fscrypt_ioctl_add_key(struct file *filp, void __user *arg); int fscrypt_add_test_dummy_key(struct super_block *sb, const struct fscrypt_dummy_policy *dummy_policy); @@ -521,7 +521,7 @@ } /* keyring.c */ -static inline void fscrypt_sb_free(struct super_block *sb) +static inline void fscrypt_destroy_keyring(struct super_block *sb) { } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/linux/iio/iio-opaque.h +++ linux-kvm-5.19.0/include/linux/iio/iio-opaque.h @@ -11,6 +11,7 @@ * checked by device drivers but should be considered * read-only as this is a core internal bit * @driver_module: used to make it harder to undercut users + * @mlock_key: lockdep class for iio_dev lock * @info_exist_lock: lock to prevent use during removal * @trig_readonly: mark the current trigger immutable * @event_interface: event chrdevs associated with interrupt lines @@ -42,6 +43,7 @@ int currentmode; int id; struct module *driver_module; + struct lock_class_key mlock_key; struct mutex info_exist_lock; bool trig_readonly; struct iio_event_interface *event_interface; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/linux/kvm_host.h +++ linux-kvm-5.19.0/include/linux/kvm_host.h @@ -1248,8 +1248,18 @@ void kvm_vcpu_mark_page_dirty(struct kvm_vcpu *vcpu, gfn_t gfn); /** - * kvm_gfn_to_pfn_cache_init - prepare a cached kernel mapping and HPA for a - * given guest physical address. + * kvm_gpc_init - initialize gfn_to_pfn_cache. + * + * @gpc: struct gfn_to_pfn_cache object. + * + * This sets up a gfn_to_pfn_cache by initializing locks. Note, the cache must + * be zero-allocated (or zeroed by the caller before init). + */ +void kvm_gpc_init(struct gfn_to_pfn_cache *gpc); + +/** + * kvm_gpc_activate - prepare a cached kernel mapping and HPA for a given guest + * physical address. * * @kvm: pointer to kvm instance. * @gpc: struct gfn_to_pfn_cache object. @@ -1273,9 +1283,9 @@ * kvm_gfn_to_pfn_cache_check() to ensure that the cache is valid before * accessing the target page. */ -int kvm_gfn_to_pfn_cache_init(struct kvm *kvm, struct gfn_to_pfn_cache *gpc, - struct kvm_vcpu *vcpu, enum pfn_cache_usage usage, - gpa_t gpa, unsigned long len); +int kvm_gpc_activate(struct kvm *kvm, struct gfn_to_pfn_cache *gpc, + struct kvm_vcpu *vcpu, enum pfn_cache_usage usage, + gpa_t gpa, unsigned long len); /** * kvm_gfn_to_pfn_cache_check - check validity of a gfn_to_pfn_cache. @@ -1332,7 +1342,7 @@ void kvm_gfn_to_pfn_cache_unmap(struct kvm *kvm, struct gfn_to_pfn_cache *gpc); /** - * kvm_gfn_to_pfn_cache_destroy - destroy and unlink a gfn_to_pfn_cache. + * kvm_gpc_deactivate - deactivate and unlink a gfn_to_pfn_cache. * * @kvm: pointer to kvm instance. * @gpc: struct gfn_to_pfn_cache object. @@ -1340,7 +1350,7 @@ * This removes a cache from the @kvm's list to be processed on MMU notifier * invocation. */ -void kvm_gfn_to_pfn_cache_destroy(struct kvm *kvm, struct gfn_to_pfn_cache *gpc); +void kvm_gpc_deactivate(struct kvm *kvm, struct gfn_to_pfn_cache *gpc); void kvm_sigset_activate(struct kvm_vcpu *vcpu); void kvm_sigset_deactivate(struct kvm_vcpu *vcpu); @@ -1397,6 +1407,8 @@ struct kvm_enable_cap *cap); long kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg); +long kvm_arch_vm_compat_ioctl(struct file *filp, unsigned int ioctl, + unsigned long arg); int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/linux/net.h +++ linux-kvm-5.19.0/include/linux/net.h @@ -41,6 +41,7 @@ #define SOCK_NOSPACE 2 #define SOCK_PASSCRED 3 #define SOCK_PASSSEC 4 +#define SOCK_SUPPORT_ZC 5 #ifndef ARCH_HAS_SOCKET_TYPES /** only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/linux/phylink.h +++ linux-kvm-5.19.0/include/linux/phylink.h @@ -88,6 +88,7 @@ * (See commit 7cceb599d15d ("net: phylink: avoid mac_config calls") * @poll_fixed_state: if true, starts link_poll, * if MAC link is at %MLO_AN_FIXED mode. + * @mac_managed_pm: if true, indicate the MAC driver is responsible for PHY PM. * @ovr_an_inband: if true, override PCS to MLO_AN_INBAND * @get_fixed_state: callback to execute to determine the fixed link state, * if MAC link is at %MLO_AN_FIXED mode. @@ -100,6 +101,7 @@ enum phylink_op_type type; bool legacy_pre_march2020; bool poll_fixed_state; + bool mac_managed_pm; bool ovr_an_inband; void (*get_fixed_state)(struct phylink_config *config, struct phylink_link_state *state); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/media/v4l2-common.h +++ linux-kvm-5.19.0/include/media/v4l2-common.h @@ -175,7 +175,8 @@ * * @sd: pointer to &struct v4l2_subdev * @client: pointer to struct i2c_client - * @devname: the name of the device; if NULL, the I²C device's name will be used + * @devname: the name of the device; if NULL, the I²C device drivers's name + * will be used * @postfix: sub-device specific string to put right after the I²C device name; * may be NULL */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/media/v4l2-subdev.h +++ linux-kvm-5.19.0/include/media/v4l2-subdev.h @@ -1046,6 +1046,8 @@ struct v4l2_subdev_state *state, unsigned int pad) { + if (WARN_ON(!state)) + return NULL; if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &state->pads[pad].try_fmt; @@ -1064,6 +1066,8 @@ struct v4l2_subdev_state *state, unsigned int pad) { + if (WARN_ON(!state)) + return NULL; if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &state->pads[pad].try_crop; @@ -1082,6 +1086,8 @@ struct v4l2_subdev_state *state, unsigned int pad) { + if (WARN_ON(!state)) + return NULL; if (WARN_ON(pad >= sd->entity.num_pads)) pad = 0; return &state->pads[pad].try_compose; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/net/sch_generic.h +++ linux-kvm-5.19.0/include/net/sch_generic.h @@ -1156,7 +1156,6 @@ static inline void qdisc_reset_queue(struct Qdisc *sch) { __qdisc_reset_queue(&sch->q); - sch->qstats.backlog = 0; } static inline struct Qdisc *qdisc_replace(struct Qdisc *sch, struct Qdisc *new, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/net/sock_reuseport.h +++ linux-kvm-5.19.0/include/net/sock_reuseport.h @@ -43,21 +43,20 @@ extern int reuseport_attach_prog(struct sock *sk, struct bpf_prog *prog); extern int reuseport_detach_prog(struct sock *sk); -static inline bool reuseport_has_conns(struct sock *sk, bool set) +static inline bool reuseport_has_conns(struct sock *sk) { struct sock_reuseport *reuse; bool ret = false; rcu_read_lock(); reuse = rcu_dereference(sk->sk_reuseport_cb); - if (reuse) { - if (set) - reuse->has_conns = 1; - ret = reuse->has_conns; - } + if (reuse && reuse->has_conns) + ret = true; rcu_read_unlock(); return ret; } +void reuseport_has_conns_set(struct sock *sk); + #endif /* _SOCK_REUSEPORT_H */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/include/uapi/linux/videodev2.h +++ linux-kvm-5.19.0/include/uapi/linux/videodev2.h @@ -1575,7 +1575,8 @@ ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt)) #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \ ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \ - (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) + ((bt)->interlaced ? \ + ((bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) : 0)) #define V4L2_DV_BT_FRAME_HEIGHT(bt) \ ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt)) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/kernel/events/ring_buffer.c +++ linux-kvm-5.19.0/kernel/events/ring_buffer.c @@ -22,7 +22,7 @@ atomic_set(&handle->rb->poll, EPOLLIN); handle->event->pending_wakeup = 1; - irq_work_queue(&handle->event->pending); + irq_work_queue(&handle->event->pending_irq); } /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/kernel/gcov/gcc_4_7.c +++ linux-kvm-5.19.0/kernel/gcov/gcc_4_7.c @@ -30,6 +30,13 @@ #define GCOV_TAG_FUNCTION_LENGTH 3 +/* Since GCC 12.1 sizes are in BYTES and not in WORDS (4B). */ +#if (__GNUC__ >= 12) +#define GCOV_UNIT_SIZE 4 +#else +#define GCOV_UNIT_SIZE 1 +#endif + static struct gcov_info *gcov_info_head; /** @@ -383,12 +390,18 @@ pos += store_gcov_u32(buffer, pos, info->version); pos += store_gcov_u32(buffer, pos, info->stamp); +#if (__GNUC__ >= 12) + /* Use zero as checksum of the compilation unit. */ + pos += store_gcov_u32(buffer, pos, 0); +#endif + for (fi_idx = 0; fi_idx < info->n_functions; fi_idx++) { fi_ptr = info->functions[fi_idx]; /* Function record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); - pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH); + pos += store_gcov_u32(buffer, pos, + GCOV_TAG_FUNCTION_LENGTH * GCOV_UNIT_SIZE); pos += store_gcov_u32(buffer, pos, fi_ptr->ident); pos += store_gcov_u32(buffer, pos, fi_ptr->lineno_checksum); pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); @@ -402,7 +415,8 @@ /* Counter record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FOR_COUNTER(ct_idx)); - pos += store_gcov_u32(buffer, pos, ci_ptr->num * 2); + pos += store_gcov_u32(buffer, pos, + ci_ptr->num * 2 * GCOV_UNIT_SIZE); for (cv_idx = 0; cv_idx < ci_ptr->num; cv_idx++) { pos += store_gcov_u64(buffer, pos, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/kernel/power/hibernate.c +++ linux-kvm-5.19.0/kernel/power/hibernate.c @@ -641,7 +641,7 @@ int error; if (hibernation_mode == HIBERNATION_SUSPEND) { - error = suspend_devices_and_enter(PM_SUSPEND_MEM); + error = suspend_devices_and_enter(mem_sleep_current); if (error) { hibernation_mode = hibernation_ops ? HIBERNATION_PLATFORM : only in patch2: unchanged: --- linux-kvm-5.19.0.orig/kernel/rcu/tasks.h +++ linux-kvm-5.19.0/kernel/rcu/tasks.h @@ -327,7 +327,7 @@ static void synchronize_rcu_tasks_generic(struct rcu_tasks *rtp) { /* Complain if the scheduler has not started. */ - RCU_LOCKDEP_WARN(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, + WARN_ONCE(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, "synchronize_rcu_tasks called too soon"); /* Wait for the grace period. */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/kernel/trace/fprobe.c +++ linux-kvm-5.19.0/kernel/trace/fprobe.c @@ -141,6 +141,8 @@ return -E2BIG; fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler); + if (!fp->rethook) + return -ENOMEM; for (i = 0; i < size; i++) { struct fprobe_rethook_node *node; @@ -301,7 +303,8 @@ { int ret; - if (!fp || fp->ops.func != fprobe_handler) + if (!fp || (fp->ops.saved_func != fprobe_handler && + fp->ops.saved_func != fprobe_kprobe_handler)) return -EINVAL; /* only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/atm/mpoa_proc.c +++ linux-kvm-5.19.0/net/atm/mpoa_proc.c @@ -219,11 +219,12 @@ if (!page) return -ENOMEM; - for (p = page, len = 0; len < nbytes; p++, len++) { + for (p = page, len = 0; len < nbytes; p++) { if (get_user(*p, buff++)) { free_page((unsigned long)page); return -EFAULT; } + len += 1; if (*p == '\0' || *p == '\n') break; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/bridge/br_netlink.c +++ linux-kvm-5.19.0/net/bridge/br_netlink.c @@ -1332,7 +1332,7 @@ if (data[IFLA_BR_FDB_FLUSH]) { struct net_bridge_fdb_flush_desc desc = { - .flags_mask = BR_FDB_STATIC + .flags_mask = BIT(BR_FDB_STATIC) }; br_fdb_flush(br, &desc); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/bridge/br_sysfs_br.c +++ linux-kvm-5.19.0/net/bridge/br_sysfs_br.c @@ -345,7 +345,7 @@ struct netlink_ext_ack *extack) { struct net_bridge_fdb_flush_desc desc = { - .flags_mask = BR_FDB_STATIC + .flags_mask = BIT(BR_FDB_STATIC) }; br_fdb_flush(br, &desc); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/core/net_namespace.c +++ linux-kvm-5.19.0/net/core/net_namespace.c @@ -117,6 +117,7 @@ static int ops_init(const struct pernet_operations *ops, struct net *net) { + struct net_generic *ng; int err = -ENOMEM; void *data = NULL; @@ -135,7 +136,13 @@ if (!err) return 0; + if (ops->id && ops->size) { cleanup: + ng = rcu_dereference_protected(net->gen, + lockdep_is_held(&pernet_ops_rwsem)); + ng->ptr[*ops->id] = NULL; + } + kfree(data); out: only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/core/sock_reuseport.c +++ linux-kvm-5.19.0/net/core/sock_reuseport.c @@ -21,6 +21,22 @@ static int reuseport_resurrect(struct sock *sk, struct sock_reuseport *old_reuse, struct sock_reuseport *reuse, bool bind_inany); +void reuseport_has_conns_set(struct sock *sk) +{ + struct sock_reuseport *reuse; + + if (!rcu_access_pointer(sk->sk_reuseport_cb)) + return; + + spin_lock_bh(&reuseport_lock); + reuse = rcu_dereference_protected(sk->sk_reuseport_cb, + lockdep_is_held(&reuseport_lock)); + if (likely(reuse)) + reuse->has_conns = 1; + spin_unlock_bh(&reuseport_lock); +} +EXPORT_SYMBOL(reuseport_has_conns_set); + static int reuseport_sock_index(struct sock *sk, const struct sock_reuseport *reuse, bool closed) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/dsa/dsa2.c +++ linux-kvm-5.19.0/net/dsa/dsa2.c @@ -1407,9 +1407,9 @@ static int dsa_port_parse_cpu(struct dsa_port *dp, struct net_device *master, const char *user_protocol) { + const struct dsa_device_ops *tag_ops = NULL; struct dsa_switch *ds = dp->ds; struct dsa_switch_tree *dst = ds->dst; - const struct dsa_device_ops *tag_ops; enum dsa_tag_protocol default_proto; /* Find out which protocol the switch would prefer. */ @@ -1432,10 +1432,17 @@ } tag_ops = dsa_find_tagger_by_name(user_protocol); - } else { - tag_ops = dsa_tag_driver_get(default_proto); + if (IS_ERR(tag_ops)) { + dev_warn(ds->dev, + "Failed to find a tagging driver for protocol %s, using default\n", + user_protocol); + tag_ops = NULL; + } } + if (!tag_ops) + tag_ops = dsa_tag_driver_get(default_proto); + if (IS_ERR(tag_ops)) { if (PTR_ERR(tag_ops) == -ENOPROTOOPT) return -EPROBE_DEFER; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ethtool/eeprom.c +++ linux-kvm-5.19.0/net/ethtool/eeprom.c @@ -124,7 +124,7 @@ if (ret) goto err_free; - ret = get_module_eeprom_by_page(dev, &page_data, info->extack); + ret = get_module_eeprom_by_page(dev, &page_data, info ? info->extack : NULL); if (ret < 0) goto err_ops; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/hsr/hsr_forward.c +++ linux-kvm-5.19.0/net/hsr/hsr_forward.c @@ -150,15 +150,15 @@ struct hsr_port *port) { if (!frame->skb_std) { - if (frame->skb_hsr) { + if (frame->skb_hsr) frame->skb_std = create_stripped_skb_hsr(frame->skb_hsr, frame); - } else { - /* Unexpected */ - WARN_ONCE(1, "%s:%d: Unexpected frame received (port_src %s)\n", - __FILE__, __LINE__, port->dev->name); + else + netdev_warn_once(port->dev, + "Unexpected frame received in hsr_get_untagged_frame()\n"); + + if (!frame->skb_std) return NULL; - } } return skb_clone(frame->skb_std, GFP_ATOMIC); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv4/netfilter/ipt_rpfilter.c +++ linux-kvm-5.19.0/net/ipv4/netfilter/ipt_rpfilter.c @@ -78,7 +78,8 @@ flow.flowi4_mark = info->flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0; flow.flowi4_tos = iph->tos & IPTOS_RT_MASK; flow.flowi4_scope = RT_SCOPE_UNIVERSE; - flow.flowi4_oif = l3mdev_master_ifindex_rcu(xt_in(par)); + flow.flowi4_l3mdev = l3mdev_master_ifindex_rcu(xt_in(par)); + flow.flowi4_uid = sock_net_uid(xt_net(par), NULL); return rpfilter_lookup_reverse(xt_net(par), &flow, xt_in(par), info->flags) ^ invert; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv4/nexthop.c +++ linux-kvm-5.19.0/net/ipv4/nexthop.c @@ -2534,7 +2534,7 @@ if (!err) { nh->nh_flags = fib_nh->fib_nh_flags; fib_info_update_nhc_saddr(net, &fib_nh->nh_common, - fib_nh->fib_nh_scope); + !fib_nh->fib_nh_scope ? 0 : fib_nh->fib_nh_scope - 1); } else { fib_nh_release(net, fib_nh); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv4/tcp_bpf.c +++ linux-kvm-5.19.0/net/ipv4/tcp_bpf.c @@ -606,7 +606,7 @@ } else { sk->sk_write_space = psock->saved_write_space; /* Pairs with lockless read in sk_clone_lock() */ - WRITE_ONCE(sk->sk_prot, psock->sk_proto); + sock_replace_proto(sk, psock->sk_proto); } return 0; } @@ -619,7 +619,7 @@ } /* Pairs with lockless read in sk_clone_lock() */ - WRITE_ONCE(sk->sk_prot, &tcp_bpf_prots[family][config]); + sock_replace_proto(sk, &tcp_bpf_prots[family][config]); return 0; } EXPORT_SYMBOL_GPL(tcp_bpf_update_proto); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv4/tcp_ulp.c +++ linux-kvm-5.19.0/net/ipv4/tcp_ulp.c @@ -136,6 +136,9 @@ if (icsk->icsk_ulp_ops) goto out_err; + if (sk->sk_socket) + clear_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags); + err = ulp_ops->init(sk); if (err) goto out_err; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv4/udp_bpf.c +++ linux-kvm-5.19.0/net/ipv4/udp_bpf.c @@ -141,14 +141,14 @@ if (restore) { sk->sk_write_space = psock->saved_write_space; - WRITE_ONCE(sk->sk_prot, psock->sk_proto); + sock_replace_proto(sk, psock->sk_proto); return 0; } if (sk->sk_family == AF_INET6) udp_bpf_check_v6_needs_rebuild(psock->sk_proto); - WRITE_ONCE(sk->sk_prot, &udp_bpf_prots[family]); + sock_replace_proto(sk, &udp_bpf_prots[family]); return 0; } EXPORT_SYMBOL_GPL(udp_bpf_update_proto); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv6/datagram.c +++ linux-kvm-5.19.0/net/ipv6/datagram.c @@ -256,7 +256,7 @@ goto out; } - reuseport_has_conns(sk, true); + reuseport_has_conns_set(sk); sk->sk_state = TCP_ESTABLISHED; sk_set_txhash(sk); out: only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv6/ip6_gre.c +++ linux-kvm-5.19.0/net/ipv6/ip6_gre.c @@ -1148,14 +1148,16 @@ dev->needed_headroom = dst_len; if (set_mtu) { - dev->mtu = rt->dst.dev->mtu - t_hlen; + int mtu = rt->dst.dev->mtu - t_hlen; + if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) - dev->mtu -= 8; + mtu -= 8; if (dev->type == ARPHRD_ETHER) - dev->mtu -= ETH_HLEN; + mtu -= ETH_HLEN; - if (dev->mtu < IPV6_MIN_MTU) - dev->mtu = IPV6_MIN_MTU; + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + WRITE_ONCE(dev->mtu, mtu); } } ip6_rt_put(rt); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv6/ip6_tunnel.c +++ linux-kvm-5.19.0/net/ipv6/ip6_tunnel.c @@ -1452,8 +1452,8 @@ struct net_device *tdev = NULL; struct __ip6_tnl_parm *p = &t->parms; struct flowi6 *fl6 = &t->fl.u.ip6; - unsigned int mtu; int t_hlen; + int mtu; __dev_addr_set(dev, &p->laddr, sizeof(struct in6_addr)); memcpy(dev->broadcast, &p->raddr, sizeof(struct in6_addr)); @@ -1500,12 +1500,13 @@ dev->hard_header_len = tdev->hard_header_len + t_hlen; mtu = min_t(unsigned int, tdev->mtu, IP6_MAX_MTU); - dev->mtu = mtu - t_hlen; + mtu = mtu - t_hlen; if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) - dev->mtu -= 8; + mtu -= 8; - if (dev->mtu < IPV6_MIN_MTU) - dev->mtu = IPV6_MIN_MTU; + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + WRITE_ONCE(dev->mtu, mtu); } } } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv6/netfilter/ip6t_rpfilter.c +++ linux-kvm-5.19.0/net/ipv6/netfilter/ip6t_rpfilter.c @@ -37,8 +37,10 @@ bool ret = false; struct flowi6 fl6 = { .flowi6_iif = LOOPBACK_IFINDEX, + .flowi6_l3mdev = l3mdev_master_ifindex_rcu(dev), .flowlabel = (* (__be32 *) iph) & IPV6_FLOWINFO_MASK, .flowi6_proto = iph->nexthdr, + .flowi6_uid = sock_net_uid(net, NULL), .daddr = iph->saddr, }; int lookup_flags; @@ -55,9 +57,7 @@ if (rpfilter_addr_linklocal(&iph->saddr)) { lookup_flags |= RT6_LOOKUP_F_IFACE; fl6.flowi6_oif = dev->ifindex; - /* Set flowi6_oif for vrf devices to lookup route in l3mdev domain. */ - } else if (netif_is_l3_master(dev) || netif_is_l3_slave(dev) || - (flags & XT_RPFILTER_LOOSE) == 0) + } else if ((flags & XT_RPFILTER_LOOSE) == 0) fl6.flowi6_oif = dev->ifindex; rt = (void *)ip6_route_lookup(net, &fl6, skb, lookup_flags); @@ -72,9 +72,7 @@ goto out; } - if (rt->rt6i_idev->dev == dev || - l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) == dev->ifindex || - (flags & XT_RPFILTER_LOOSE)) + if (rt->rt6i_idev->dev == dev || (flags & XT_RPFILTER_LOOSE)) ret = true; out: ip6_rt_put(rt); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv6/route.c +++ linux-kvm-5.19.0/net/ipv6/route.c @@ -6555,10 +6555,16 @@ static int __net_init ip6_route_net_init_late(struct net *net) { #ifdef CONFIG_PROC_FS - proc_create_net("ipv6_route", 0, net->proc_net, &ipv6_route_seq_ops, - sizeof(struct ipv6_route_iter)); - proc_create_net_single("rt6_stats", 0444, net->proc_net, - rt6_stats_seq_show, NULL); + if (!proc_create_net("ipv6_route", 0, net->proc_net, + &ipv6_route_seq_ops, + sizeof(struct ipv6_route_iter))) + return -ENOMEM; + + if (!proc_create_net_single("rt6_stats", 0444, net->proc_net, + rt6_stats_seq_show, NULL)) { + remove_proc_entry("ipv6_route", net->proc_net); + return -ENOMEM; + } #endif return 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/ipv6/sit.c +++ linux-kvm-5.19.0/net/ipv6/sit.c @@ -1130,10 +1130,12 @@ if (tdev && !netif_is_l3_master(tdev)) { int t_hlen = tunnel->hlen + sizeof(struct iphdr); + int mtu; - dev->mtu = tdev->mtu - t_hlen; - if (dev->mtu < IPV6_MIN_MTU) - dev->mtu = IPV6_MIN_MTU; + mtu = tdev->mtu - t_hlen; + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + WRITE_ONCE(dev->mtu, mtu); } } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/netfilter/ipset/ip_set_hash_gen.h +++ linux-kvm-5.19.0/net/netfilter/ipset/ip_set_hash_gen.h @@ -42,31 +42,8 @@ #define AHASH_MAX_SIZE (6 * AHASH_INIT_SIZE) /* Max muber of elements in the array block when tuned */ #define AHASH_MAX_TUNED 64 - #define AHASH_MAX(h) ((h)->bucketsize) -/* Max number of elements can be tuned */ -#ifdef IP_SET_HASH_WITH_MULTI -static u8 -tune_bucketsize(u8 curr, u32 multi) -{ - u32 n; - - if (multi < curr) - return curr; - - n = curr + AHASH_INIT_SIZE; - /* Currently, at listing one hash bucket must fit into a message. - * Therefore we have a hard limit here. - */ - return n > curr && n <= AHASH_MAX_TUNED ? n : curr; -} -#define TUNE_BUCKETSIZE(h, multi) \ - ((h)->bucketsize = tune_bucketsize((h)->bucketsize, multi)) -#else -#define TUNE_BUCKETSIZE(h, multi) -#endif - /* A hash bucket */ struct hbucket { struct rcu_head rcu; /* for call_rcu */ @@ -936,7 +913,12 @@ goto set_full; /* Create a new slot */ if (n->pos >= n->size) { - TUNE_BUCKETSIZE(h, multi); +#ifdef IP_SET_HASH_WITH_MULTI + if (h->bucketsize >= AHASH_MAX_TUNED) + goto set_full; + else if (h->bucketsize < multi) + h->bucketsize += AHASH_INIT_SIZE; +#endif if (n->size >= AHASH_MAX(h)) { /* Trigger rehashing */ mtype_data_next(&h->next, d); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/netfilter/ipvs/ip_vs_app.c +++ linux-kvm-5.19.0/net/netfilter/ipvs/ip_vs_app.c @@ -599,13 +599,19 @@ int __net_init ip_vs_app_net_init(struct netns_ipvs *ipvs) { INIT_LIST_HEAD(&ipvs->app_list); - proc_create_net("ip_vs_app", 0, ipvs->net->proc_net, &ip_vs_app_seq_ops, - sizeof(struct seq_net_private)); +#ifdef CONFIG_PROC_FS + if (!proc_create_net("ip_vs_app", 0, ipvs->net->proc_net, + &ip_vs_app_seq_ops, + sizeof(struct seq_net_private))) + return -ENOMEM; +#endif return 0; } void __net_exit ip_vs_app_net_cleanup(struct netns_ipvs *ipvs) { unregister_ip_vs_app(ipvs, NULL /* all */); +#ifdef CONFIG_PROC_FS remove_proc_entry("ip_vs_app", ipvs->net->proc_net); +#endif } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/netfilter/ipvs/ip_vs_conn.c +++ linux-kvm-5.19.0/net/netfilter/ipvs/ip_vs_conn.c @@ -1265,8 +1265,8 @@ * The drop rate array needs tuning for real environments. * Called from timer bh only => no locking */ - static const char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; - static char todrop_counter[9] = {0}; + static const signed char todrop_rate[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; + static signed char todrop_counter[9] = {0}; int i; /* if the conn entry hasn't lasted for 60 seconds, don't drop it. @@ -1447,20 +1447,36 @@ { atomic_set(&ipvs->conn_count, 0); - proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net, - &ip_vs_conn_seq_ops, sizeof(struct ip_vs_iter_state)); - proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net, - &ip_vs_conn_sync_seq_ops, - sizeof(struct ip_vs_iter_state)); +#ifdef CONFIG_PROC_FS + if (!proc_create_net("ip_vs_conn", 0, ipvs->net->proc_net, + &ip_vs_conn_seq_ops, + sizeof(struct ip_vs_iter_state))) + goto err_conn; + + if (!proc_create_net("ip_vs_conn_sync", 0, ipvs->net->proc_net, + &ip_vs_conn_sync_seq_ops, + sizeof(struct ip_vs_iter_state))) + goto err_conn_sync; +#endif + return 0; + +#ifdef CONFIG_PROC_FS +err_conn_sync: + remove_proc_entry("ip_vs_conn", ipvs->net->proc_net); +err_conn: + return -ENOMEM; +#endif } void __net_exit ip_vs_conn_net_cleanup(struct netns_ipvs *ipvs) { /* flush all the connection entries first */ ip_vs_conn_flush(ipvs); +#ifdef CONFIG_PROC_FS remove_proc_entry("ip_vs_conn", ipvs->net->proc_net); remove_proc_entry("ip_vs_conn_sync", ipvs->net->proc_net); +#endif } int __init ip_vs_conn_init(void) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/rose/rose_link.c +++ linux-kvm-5.19.0/net/rose/rose_link.c @@ -236,6 +236,9 @@ unsigned char *dptr; int len; + if (!neigh->dev) + return; + len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN + 3; if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/cls_u32.c +++ linux-kvm-5.19.0/net/sched/cls_u32.c @@ -1040,7 +1040,11 @@ } #endif - memcpy(&n->sel, s, sel_size); + unsafe_memcpy(&n->sel, s, sel_size, + /* A composite flex-array structure destination, + * which was correctly sized with struct_size(), + * bounds-checked against nla_len(), and allocated + * above. */); RCU_INIT_POINTER(n->ht_up, ht); n->handle = handle; n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_api.c +++ linux-kvm-5.19.0/net/sched/sch_api.c @@ -1081,12 +1081,13 @@ skip: if (!ingress) { - notify_and_destroy(net, skb, n, classid, - rtnl_dereference(dev->qdisc), new); + old = rtnl_dereference(dev->qdisc); if (new && !new->ops->attach) qdisc_refcount_inc(new); rcu_assign_pointer(dev->qdisc, new ? : &noop_qdisc); + notify_and_destroy(net, skb, n, classid, old, new); + if (new && new->ops->attach) new->ops->attach(new); } else { only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_atm.c +++ linux-kvm-5.19.0/net/sched/sch_atm.c @@ -577,7 +577,6 @@ pr_debug("atm_tc_reset(sch %p,[qdisc %p])\n", sch, p); list_for_each_entry(flow, &p->flows, list) qdisc_reset(flow->q); - sch->q.qlen = 0; } static void atm_tc_destroy(struct Qdisc *sch) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_cake.c +++ linux-kvm-5.19.0/net/sched/sch_cake.c @@ -2224,8 +2224,12 @@ static void cake_reset(struct Qdisc *sch) { + struct cake_sched_data *q = qdisc_priv(sch); u32 c; + if (!q->tins) + return; + for (c = 0; c < CAKE_MAX_TINS; c++) cake_clear_tin(sch, c); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_cbq.c +++ linux-kvm-5.19.0/net/sched/sch_cbq.c @@ -1052,7 +1052,6 @@ cl->cpriority = cl->priority; } } - sch->q.qlen = 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_choke.c +++ linux-kvm-5.19.0/net/sched/sch_choke.c @@ -315,8 +315,6 @@ rtnl_qdisc_drop(skb, sch); } - sch->q.qlen = 0; - sch->qstats.backlog = 0; if (q->tab) memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *)); q->head = q->tail = 0; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_drr.c +++ linux-kvm-5.19.0/net/sched/sch_drr.c @@ -441,8 +441,6 @@ qdisc_reset(cl->qdisc); } } - sch->qstats.backlog = 0; - sch->q.qlen = 0; } static void drr_destroy_qdisc(struct Qdisc *sch) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_dsmark.c +++ linux-kvm-5.19.0/net/sched/sch_dsmark.c @@ -409,8 +409,6 @@ pr_debug("%s(sch %p,[qdisc %p])\n", __func__, sch, p); if (p->q) qdisc_reset(p->q); - sch->qstats.backlog = 0; - sch->q.qlen = 0; } static void dsmark_destroy(struct Qdisc *sch) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_etf.c +++ linux-kvm-5.19.0/net/sched/sch_etf.c @@ -445,9 +445,6 @@ timesortedlist_clear(sch); __qdisc_reset_queue(&sch->q); - sch->qstats.backlog = 0; - sch->q.qlen = 0; - q->last = 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_ets.c +++ linux-kvm-5.19.0/net/sched/sch_ets.c @@ -727,8 +727,6 @@ } for (band = 0; band < q->nbands; band++) qdisc_reset(q->classes[band].qdisc); - sch->qstats.backlog = 0; - sch->q.qlen = 0; } static void ets_qdisc_destroy(struct Qdisc *sch) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_fq_codel.c +++ linux-kvm-5.19.0/net/sched/sch_fq_codel.c @@ -347,8 +347,6 @@ codel_vars_init(&flow->cvars); } memset(q->backlogs, 0, q->flows_cnt * sizeof(u32)); - sch->q.qlen = 0; - sch->qstats.backlog = 0; q->memory_usage = 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_fq_pie.c +++ linux-kvm-5.19.0/net/sched/sch_fq_pie.c @@ -521,9 +521,6 @@ INIT_LIST_HEAD(&flow->flowchain); pie_vars_init(&flow->vars); } - - sch->q.qlen = 0; - sch->qstats.backlog = 0; } static void fq_pie_destroy(struct Qdisc *sch) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_hfsc.c +++ linux-kvm-5.19.0/net/sched/sch_hfsc.c @@ -1484,8 +1484,6 @@ } q->eligible = RB_ROOT; qdisc_watchdog_cancel(&q->watchdog); - sch->qstats.backlog = 0; - sch->q.qlen = 0; } static void only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_htb.c +++ linux-kvm-5.19.0/net/sched/sch_htb.c @@ -1008,8 +1008,6 @@ } qdisc_watchdog_cancel(&q->watchdog); __qdisc_reset_queue(&q->direct_queue); - sch->q.qlen = 0; - sch->qstats.backlog = 0; memset(q->hlevel, 0, sizeof(q->hlevel)); memset(q->row_mask, 0, sizeof(q->row_mask)); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_multiq.c +++ linux-kvm-5.19.0/net/sched/sch_multiq.c @@ -152,7 +152,6 @@ for (band = 0; band < q->bands; band++) qdisc_reset(q->queues[band]); - sch->q.qlen = 0; q->curband = 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_prio.c +++ linux-kvm-5.19.0/net/sched/sch_prio.c @@ -135,8 +135,6 @@ for (prio = 0; prio < q->bands; prio++) qdisc_reset(q->queues[prio]); - sch->qstats.backlog = 0; - sch->q.qlen = 0; } static int prio_offload(struct Qdisc *sch, struct tc_prio_qopt *qopt) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_qfq.c +++ linux-kvm-5.19.0/net/sched/sch_qfq.c @@ -1458,8 +1458,6 @@ qdisc_reset(cl->qdisc); } } - sch->qstats.backlog = 0; - sch->q.qlen = 0; } static void qfq_destroy_qdisc(struct Qdisc *sch) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_red.c +++ linux-kvm-5.19.0/net/sched/sch_red.c @@ -72,6 +72,7 @@ { struct red_sched_data *q = qdisc_priv(sch); struct Qdisc *child = q->qdisc; + unsigned int len; int ret; q->vars.qavg = red_calc_qavg(&q->parms, @@ -126,9 +127,10 @@ break; } + len = qdisc_pkt_len(skb); ret = qdisc_enqueue(skb, child, to_free); if (likely(ret == NET_XMIT_SUCCESS)) { - qdisc_qstats_backlog_inc(sch, skb); + sch->qstats.backlog += len; sch->q.qlen++; } else if (net_xmit_drop_count(ret)) { q->stats.pdrop++; @@ -176,8 +178,6 @@ struct red_sched_data *q = qdisc_priv(sch); qdisc_reset(q->qdisc); - sch->qstats.backlog = 0; - sch->q.qlen = 0; red_restart(&q->vars); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_skbprio.c +++ linux-kvm-5.19.0/net/sched/sch_skbprio.c @@ -213,9 +213,6 @@ struct skbprio_sched_data *q = qdisc_priv(sch); int prio; - sch->qstats.backlog = 0; - sch->q.qlen = 0; - for (prio = 0; prio < SKBPRIO_MAX_PRIORITY; prio++) __skb_queue_purge(&q->qdiscs[prio]); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/sched/sch_teql.c +++ linux-kvm-5.19.0/net/sched/sch_teql.c @@ -124,7 +124,6 @@ struct teql_sched_data *dat = qdisc_priv(sch); skb_queue_purge(&dat->q); - sch->q.qlen = 0; } static void only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/tipc/discover.c +++ linux-kvm-5.19.0/net/tipc/discover.c @@ -148,8 +148,8 @@ { struct net *net = d->net; struct tipc_net *tn = tipc_net(net); - bool trial = time_before(jiffies, tn->addr_trial_end); u32 self = tipc_own_addr(net); + bool trial = time_before(jiffies, tn->addr_trial_end) && !self; if (mtyp == DSC_TRIAL_FAIL_MSG) { if (!trial) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/tipc/topsrv.c +++ linux-kvm-5.19.0/net/tipc/topsrv.c @@ -450,12 +450,19 @@ static void tipc_topsrv_accept(struct work_struct *work) { struct tipc_topsrv *srv = container_of(work, struct tipc_topsrv, awork); - struct socket *lsock = srv->listener; - struct socket *newsock; + struct socket *newsock, *lsock; struct tipc_conn *con; struct sock *newsk; int ret; + spin_lock_bh(&srv->idr_lock); + if (!srv->listener) { + spin_unlock_bh(&srv->idr_lock); + return; + } + lsock = srv->listener; + spin_unlock_bh(&srv->idr_lock); + while (1) { ret = kernel_accept(lsock, &newsock, O_NONBLOCK); if (ret < 0) @@ -489,7 +496,7 @@ read_lock_bh(&sk->sk_callback_lock); srv = sk->sk_user_data; - if (srv->listener) + if (srv) queue_work(srv->rcv_wq, &srv->awork); read_unlock_bh(&sk->sk_callback_lock); } @@ -568,7 +575,7 @@ sub.seq.upper = upper; sub.timeout = TIPC_WAIT_FOREVER; sub.filter = filter; - *(u32 *)&sub.usr_handle = port; + *(u64 *)&sub.usr_handle = (u64)port; con = tipc_conn_alloc(tipc_topsrv(net)); if (IS_ERR(con)) @@ -699,8 +706,9 @@ __module_get(lsock->sk->sk_prot_creator->owner); srv->listener = NULL; spin_unlock_bh(&srv->idr_lock); - sock_release(lsock); + tipc_topsrv_work_stop(srv); + sock_release(lsock); idr_destroy(&srv->conn_idr); kfree(srv); } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/net/unix/unix_bpf.c +++ linux-kvm-5.19.0/net/unix/unix_bpf.c @@ -145,12 +145,12 @@ if (restore) { sk->sk_write_space = psock->saved_write_space; - WRITE_ONCE(sk->sk_prot, psock->sk_proto); + sock_replace_proto(sk, psock->sk_proto); return 0; } unix_dgram_bpf_check_needs_rebuild(psock->sk_proto); - WRITE_ONCE(sk->sk_prot, &unix_dgram_bpf_prot); + sock_replace_proto(sk, &unix_dgram_bpf_prot); return 0; } @@ -158,12 +158,12 @@ { if (restore) { sk->sk_write_space = psock->saved_write_space; - WRITE_ONCE(sk->sk_prot, psock->sk_proto); + sock_replace_proto(sk, psock->sk_proto); return 0; } unix_stream_bpf_check_needs_rebuild(psock->sk_proto); - WRITE_ONCE(sk->sk_prot, &unix_stream_bpf_prot); + sock_replace_proto(sk, &unix_stream_bpf_prot); return 0; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/security/selinux/ss/sidtab.c +++ linux-kvm-5.19.0/security/selinux/ss/sidtab.c @@ -325,7 +325,7 @@ } rc = convert->func(context, &dst_convert->context, - convert->args); + convert->args, GFP_ATOMIC); if (rc) { context_destroy(&dst->context); goto out_unlock; @@ -404,7 +404,7 @@ while (i < SIDTAB_LEAF_ENTRIES && *pos < count) { rc = convert->func(&esrc->ptr_leaf->entries[i].context, &edst->ptr_leaf->entries[i].context, - convert->args); + convert->args, GFP_KERNEL); if (rc) return rc; (*pos)++; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/security/selinux/ss/sidtab.h +++ linux-kvm-5.19.0/security/selinux/ss/sidtab.h @@ -65,7 +65,7 @@ }; struct sidtab_convert_params { - int (*func)(struct context *oldc, struct context *newc, void *args); + int (*func)(struct context *oldc, struct context *newc, void *args, gfp_t gfp_flags); void *args; struct sidtab *target; }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/aoa/soundbus/i2sbus/core.c +++ linux-kvm-5.19.0/sound/aoa/soundbus/i2sbus/core.c @@ -147,6 +147,7 @@ return rc; } +/* Returns 1 if added, 0 for otherwise; don't return a negative value! */ /* FIXME: look at device node refcounting */ static int i2sbus_add_dev(struct macio_dev *macio, struct i2sbus_control *control, @@ -213,7 +214,7 @@ * either as the second one in that case is just a modem. */ if (!ok) { kfree(dev); - return -ENODEV; + return 0; } mutex_init(&dev->lock); @@ -302,6 +303,10 @@ if (soundbus_add_one(&dev->sound)) { printk(KERN_DEBUG "i2sbus: device registration error!\n"); + if (dev->sound.ofdev.dev.kobj.state_initialized) { + soundbus_dev_put(&dev->sound); + return 0; + } goto err; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/pci/ac97/ac97_codec.c +++ linux-kvm-5.19.0/sound/pci/ac97/ac97_codec.c @@ -2009,6 +2009,7 @@ err = device_register(&ac97->dev); if (err < 0) { ac97_err(ac97, "Can't register ac97 bus\n"); + put_device(&ac97->dev); ac97->dev.bus = NULL; return err; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/pci/au88x0/au88x0.h +++ linux-kvm-5.19.0/sound/pci/au88x0/au88x0.h @@ -141,7 +141,7 @@ #ifndef CHIP_AU8810 stream_t dma_wt[NR_WT]; wt_voice_t wt_voice[NR_WT]; /* WT register cache. */ - char mixwt[(NR_WT / NR_WTPB) * 6]; /* WT mixin objects */ + s8 mixwt[(NR_WT / NR_WTPB) * 6]; /* WT mixin objects */ #endif /* Global resources */ @@ -235,8 +235,8 @@ static void vortex_connect_default(vortex_t * vortex, int en); static int vortex_adb_allocroute(vortex_t * vortex, int dma, int nr_ch, int dir, int type, int subdev); -static char vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, - int restype); +static int vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, + int restype); #ifndef CHIP_AU8810 static int vortex_wt_allocroute(vortex_t * vortex, int dma, int nr_ch); static void vortex_wt_connect(vortex_t * vortex, int en); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/pci/au88x0/au88x0_core.c +++ linux-kvm-5.19.0/sound/pci/au88x0/au88x0_core.c @@ -1998,7 +1998,7 @@ out: Mean checkout if != 0. Else mean Checkin resource. restype: Indicates type of resource to be checked in or out. */ -static char +static int vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype) { int i, qty = resnum[restype], resinuse = 0; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/pci/rme9652/hdsp.c +++ linux-kvm-5.19.0/sound/pci/rme9652/hdsp.c @@ -433,7 +433,7 @@ struct snd_rawmidi *rmidi; struct snd_rawmidi_substream *input; struct snd_rawmidi_substream *output; - char istimer; /* timer in use */ + signed char istimer; /* timer in use */ struct timer_list timer; spinlock_t lock; int pending; @@ -480,7 +480,7 @@ pid_t playback_pid; int running; int system_sample_rate; - const char *channel_map; + const signed char *channel_map; int dev; int irq; unsigned long port; @@ -502,7 +502,7 @@ where the data for that channel can be read/written from/to. */ -static const char channel_map_df_ss[HDSP_MAX_CHANNELS] = { +static const signed char channel_map_df_ss[HDSP_MAX_CHANNELS] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; @@ -517,7 +517,7 @@ -1, -1, -1, -1, -1, -1, -1, -1 }; -static const char channel_map_ds[HDSP_MAX_CHANNELS] = { +static const signed char channel_map_ds[HDSP_MAX_CHANNELS] = { /* ADAT channels are remapped */ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, /* channels 12 and 13 are S/PDIF */ @@ -526,7 +526,7 @@ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; -static const char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = { +static const signed char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = { /* ADAT channels */ 0, 1, 2, 3, 4, 5, 6, 7, /* SPDIF */ @@ -540,7 +540,7 @@ -1, -1 }; -static const char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = { +static const signed char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = { /* ADAT */ 1, 3, 5, 7, /* SPDIF */ @@ -554,7 +554,7 @@ -1, -1, -1, -1, -1, -1 }; -static const char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = { +static const signed char channel_map_H9632_qs[HDSP_MAX_CHANNELS] = { /* ADAT is disabled in this mode */ /* SPDIF */ 8, 9, @@ -3939,7 +3939,7 @@ return hdsp_hw_pointer(hdsp); } -static char *hdsp_channel_buffer_location(struct hdsp *hdsp, +static signed char *hdsp_channel_buffer_location(struct hdsp *hdsp, int stream, int channel) @@ -3964,7 +3964,7 @@ void __user *src, unsigned long count) { struct hdsp *hdsp = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES)) return -EINVAL; @@ -3982,7 +3982,7 @@ void *src, unsigned long count) { struct hdsp *hdsp = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; channel_buf = hdsp_channel_buffer_location(hdsp, substream->pstr->stream, channel); if (snd_BUG_ON(!channel_buf)) @@ -3996,7 +3996,7 @@ void __user *dst, unsigned long count) { struct hdsp *hdsp = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; if (snd_BUG_ON(pos + count > HDSP_CHANNEL_BUFFER_BYTES)) return -EINVAL; @@ -4014,7 +4014,7 @@ void *dst, unsigned long count) { struct hdsp *hdsp = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; channel_buf = hdsp_channel_buffer_location(hdsp, substream->pstr->stream, channel); if (snd_BUG_ON(!channel_buf)) @@ -4028,7 +4028,7 @@ unsigned long count) { struct hdsp *hdsp = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; channel_buf = hdsp_channel_buffer_location (hdsp, substream->pstr->stream, channel); if (snd_BUG_ON(!channel_buf)) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/pci/rme9652/rme9652.c +++ linux-kvm-5.19.0/sound/pci/rme9652/rme9652.c @@ -230,7 +230,7 @@ int last_spdif_sample_rate; /* so that we can catch externally ... */ int last_adat_sample_rate; /* ... induced rate changes */ - const char *channel_map; + const signed char *channel_map; struct snd_card *card; struct snd_pcm *pcm; @@ -247,12 +247,12 @@ where the data for that channel can be read/written from/to. */ -static const char channel_map_9652_ss[26] = { +static const signed char channel_map_9652_ss[26] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; -static const char channel_map_9636_ss[26] = { +static const signed char channel_map_9636_ss[26] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* channels 16 and 17 are S/PDIF */ 24, 25, @@ -260,7 +260,7 @@ -1, -1, -1, -1, -1, -1, -1, -1 }; -static const char channel_map_9652_ds[26] = { +static const signed char channel_map_9652_ds[26] = { /* ADAT channels are remapped */ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, /* channels 12 and 13 are S/PDIF */ @@ -269,7 +269,7 @@ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; -static const char channel_map_9636_ds[26] = { +static const signed char channel_map_9636_ds[26] = { /* ADAT channels are remapped */ 1, 3, 5, 7, 9, 11, 13, 15, /* channels 8 and 9 are S/PDIF */ @@ -1819,7 +1819,7 @@ return rme9652_hw_pointer(rme9652); } -static char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652, +static signed char *rme9652_channel_buffer_location(struct snd_rme9652 *rme9652, int stream, int channel) @@ -1847,7 +1847,7 @@ void __user *src, unsigned long count) { struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES)) return -EINVAL; @@ -1867,7 +1867,7 @@ void *src, unsigned long count) { struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; channel_buf = rme9652_channel_buffer_location(rme9652, substream->pstr->stream, @@ -1883,7 +1883,7 @@ void __user *dst, unsigned long count) { struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; if (snd_BUG_ON(pos + count > RME9652_CHANNEL_BUFFER_BYTES)) return -EINVAL; @@ -1903,7 +1903,7 @@ void *dst, unsigned long count) { struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; channel_buf = rme9652_channel_buffer_location(rme9652, substream->pstr->stream, @@ -1919,7 +1919,7 @@ unsigned long count) { struct snd_rme9652 *rme9652 = snd_pcm_substream_chip(substream); - char *channel_buf; + signed char *channel_buf; channel_buf = rme9652_channel_buffer_location (rme9652, substream->pstr->stream, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/soc/codecs/Kconfig +++ linux-kvm-5.19.0/sound/soc/codecs/Kconfig @@ -1580,6 +1580,7 @@ config SND_SOC_TLV320ADC3XXX tristate "Texas Instruments TLV320ADC3001/3101 audio ADC" depends on I2C + depends on GPIOLIB help Enable support for Texas Instruments TLV320ADC3001 and TLV320ADC3101 ADCs. only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/soc/codecs/tlv320adc3xxx.c +++ linux-kvm-5.19.0/sound/soc/codecs/tlv320adc3xxx.c @@ -1451,7 +1451,7 @@ .of_match_table = tlv320adc3xxx_of_match, }, .probe_new = adc3xxx_i2c_probe, - .remove = adc3xxx_i2c_remove, + .remove = __exit_p(adc3xxx_i2c_remove), .id_table = adc3xxx_i2c_id, }; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/soc/sunxi/sun4i-codec.c +++ linux-kvm-5.19.0/sound/soc/sunxi/sun4i-codec.c @@ -1253,6 +1253,9 @@ static const struct snd_soc_component_driver sun4i_codec_component = { .name = "sun4i-codec", +#ifdef CONFIG_DEBUG_FS + .debugfs_prefix = "cpu", +#endif }; #define SUN4I_CODEC_RATES SNDRV_PCM_RATE_CONTINUOUS only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/synth/emux/emux.c +++ linux-kvm-5.19.0/sound/synth/emux/emux.c @@ -126,15 +126,10 @@ */ int snd_emux_free(struct snd_emux *emu) { - unsigned long flags; - if (! emu) return -EINVAL; - spin_lock_irqsave(&emu->voice_lock, flags); - if (emu->timer_active) - del_timer(&emu->tlist); - spin_unlock_irqrestore(&emu->voice_lock, flags); + del_timer_sync(&emu->tlist); snd_emux_proc_free(emu); snd_emux_delete_virmidi(emu); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/usb/implicit.c +++ linux-kvm-5.19.0/sound/usb/implicit.c @@ -47,6 +47,8 @@ static const struct snd_usb_implicit_fb_match playback_implicit_fb_quirks[] = { /* Fixed EP */ /* FIXME: check the availability of generic matching */ + IMPLICIT_FB_FIXED_DEV(0x0763, 0x2030, 0x81, 3), /* M-Audio Fast Track C400 */ + IMPLICIT_FB_FIXED_DEV(0x0763, 0x2031, 0x81, 3), /* M-Audio Fast Track C600 */ IMPLICIT_FB_FIXED_DEV(0x0763, 0x2080, 0x81, 2), /* M-Audio FastTrack Ultra */ IMPLICIT_FB_FIXED_DEV(0x0763, 0x2081, 0x81, 2), /* M-Audio FastTrack Ultra */ IMPLICIT_FB_FIXED_DEV(0x2466, 0x8010, 0x81, 2), /* Fractal Audio Axe-Fx III */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/sound/usb/quirks-table.h +++ linux-kvm-5.19.0/sound/usb/quirks-table.h @@ -2985,6 +2985,82 @@ } } }, +/* DIGIDESIGN MBOX 3 */ +{ + USB_DEVICE(0x0dba, 0x5000), + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { + .vendor_name = "Digidesign", + .product_name = "Mbox 3", + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_COMPOSITE, + .data = (const struct snd_usb_audio_quirk[]) { + { + .ifnum = 0, + .type = QUIRK_IGNORE_INTERFACE + }, + { + .ifnum = 1, + .type = QUIRK_IGNORE_INTERFACE + }, + { + .ifnum = 2, + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = &(const struct audioformat) { + .formats = SNDRV_PCM_FMTBIT_S24_3LE, + .channels = 4, + .iface = 2, + .altsetting = 1, + .altset_idx = 1, + .attributes = 0x00, + .endpoint = 0x01, + .ep_attr = USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .nr_rates = 1, + .rate_table = (unsigned int[]) { + 48000 + } + } + }, + { + .ifnum = 3, + .type = QUIRK_AUDIO_FIXED_ENDPOINT, + .data = &(const struct audioformat) { + .formats = SNDRV_PCM_FMTBIT_S24_3LE, + .channels = 4, + .iface = 3, + .altsetting = 1, + .altset_idx = 1, + .endpoint = 0x81, + .attributes = 0x00, + .ep_attr = USB_ENDPOINT_XFER_ISOC | + USB_ENDPOINT_SYNC_ASYNC, + .maxpacksize = 0x009c, + .rates = SNDRV_PCM_RATE_48000, + .rate_min = 48000, + .rate_max = 48000, + .nr_rates = 1, + .rate_table = (unsigned int[]) { + 48000 + } + } + }, + { + .ifnum = 4, + .type = QUIRK_MIDI_FIXED_ENDPOINT, + .data = &(const struct snd_usb_midi_endpoint_info) { + .out_cables = 0x0001, + .in_cables = 0x0001 + } + }, + { + .ifnum = -1 + } + } + } +}, { /* Tascam US122 MKII - playback-only support */ USB_DEVICE_VENDOR_SPEC(0x0644, 0x8021), only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/iio/iio_utils.c +++ linux-kvm-5.19.0/tools/iio/iio_utils.c @@ -547,6 +547,10 @@ { int count = 0; + /* It takes a digit to represent zero */ + if (!num) + return 1; + while (num != 0) { num /= 10; count++; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/include/nolibc/string.h +++ linux-kvm-5.19.0/tools/include/nolibc/string.h @@ -19,9 +19,9 @@ int memcmp(const void *s1, const void *s2, size_t n) { size_t ofs = 0; - char c1 = 0; + int c1 = 0; - while (ofs < n && !(c1 = ((char *)s1)[ofs] - ((char *)s2)[ofs])) { + while (ofs < n && !(c1 = ((unsigned char *)s1)[ofs] - ((unsigned char *)s2)[ofs])) { ofs++; } return c1; @@ -125,14 +125,18 @@ } /* this function is only used with arguments that are not constants or when - * it's not known because optimizations are disabled. + * it's not known because optimizations are disabled. Note that gcc 12 + * recognizes an strlen() pattern and replaces it with a jump to strlen(), + * thus itself, hence the asm() statement below that's meant to disable this + * confusing practice. */ static __attribute__((unused)) -size_t nolibc_strlen(const char *str) +size_t strlen(const char *str) { size_t len; - for (len = 0; str[len]; len++); + for (len = 0; str[len]; len++) + asm(""); return len; } @@ -140,13 +144,12 @@ * the two branches, then will rely on an external definition of strlen(). */ #if defined(__OPTIMIZE__) +#define nolibc_strlen(x) strlen(x) #define strlen(str) ({ \ __builtin_constant_p((str)) ? \ __builtin_strlen((str)) : \ nolibc_strlen((str)); \ }) -#else -#define strlen(str) nolibc_strlen((str)) #endif static __attribute__((unused)) only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/lib/bpf/btf_dump.c +++ linux-kvm-5.19.0/tools/lib/bpf/btf_dump.c @@ -2325,7 +2325,7 @@ d->typed_dump->indent_lvl = OPTS_GET(opts, indent_level, 0); /* default indent string is a tab */ - if (!opts->indent_str) + if (!OPTS_GET(opts, indent_str, NULL)) d->typed_dump->indent_str[0] = '\t'; else libbpf_strlcpy(d->typed_dump->indent_str, opts->indent_str, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/lib/bpf/libbpf_probes.c +++ linux-kvm-5.19.0/tools/lib/bpf/libbpf_probes.c @@ -247,7 +247,7 @@ LIBBPF_OPTS(bpf_map_create_opts, opts); int key_size, value_size, max_entries; __u32 btf_key_type_id = 0, btf_value_type_id = 0; - int fd = -1, btf_fd = -1, fd_inner = -1, exp_err = 0, err; + int fd = -1, btf_fd = -1, fd_inner = -1, exp_err = 0, err = 0; opts.map_ifindex = ifindex; only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/lib/bpf/nlattr.c +++ linux-kvm-5.19.0/tools/lib/bpf/nlattr.c @@ -32,7 +32,7 @@ static int nla_ok(const struct nlattr *nla, int remaining) { - return remaining >= sizeof(*nla) && + return remaining >= (int)sizeof(*nla) && nla->nla_len >= sizeof(*nla) && nla->nla_len <= remaining; } only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/lib/bpf/usdt.bpf.h +++ linux-kvm-5.19.0/tools/lib/bpf/usdt.bpf.h @@ -244,7 +244,7 @@ */ #define BPF_USDT(name, args...) \ name(struct pt_regs *ctx); \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args); \ typeof(name(0)) name(struct pt_regs *ctx) \ { \ @@ -253,7 +253,7 @@ return ____##name(___bpf_usdt_args(args)); \ _Pragma("GCC diagnostic pop") \ } \ -static __attribute__((always_inline)) typeof(name(0)) \ +static __always_inline typeof(name(0)) \ ____##name(struct pt_regs *ctx, ##args) #endif /* __USDT_BPF_H__ */ only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json +++ linux-kvm-5.19.0/tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json @@ -112,21 +112,21 @@ "MetricName": "indirect_branch" }, { - "MetricExpr": "(armv8_pmuv3_0@event\\=0x1014@ + armv8_pmuv3_0@event\\=0x1018@) / BR_MIS_PRED", + "MetricExpr": "(armv8_pmuv3_0@event\\=0x1013@ + armv8_pmuv3_0@event\\=0x1016@) / BR_MIS_PRED", "PublicDescription": "Push branch L3 topdown metric", "BriefDescription": "Push branch L3 topdown metric", "MetricGroup": "TopDownL3", "MetricName": "push_branch" }, { - "MetricExpr": "armv8_pmuv3_0@event\\=0x100c@ / BR_MIS_PRED", + "MetricExpr": "armv8_pmuv3_0@event\\=0x100d@ / BR_MIS_PRED", "PublicDescription": "Pop branch L3 topdown metric", "BriefDescription": "Pop branch L3 topdown metric", "MetricGroup": "TopDownL3", "MetricName": "pop_branch" }, { - "MetricExpr": "(BR_MIS_PRED - armv8_pmuv3_0@event\\=0x1010@ - armv8_pmuv3_0@event\\=0x1014@ - armv8_pmuv3_0@event\\=0x1018@ - armv8_pmuv3_0@event\\=0x100c@) / BR_MIS_PRED", + "MetricExpr": "(BR_MIS_PRED - armv8_pmuv3_0@event\\=0x1010@ - armv8_pmuv3_0@event\\=0x1013@ - armv8_pmuv3_0@event\\=0x1016@ - armv8_pmuv3_0@event\\=0x100d@) / BR_MIS_PRED", "PublicDescription": "Other branch L3 topdown metric", "BriefDescription": "Other branch L3 topdown metric", "MetricGroup": "TopDownL3", only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/perf/pmu-events/arch/powerpc/power10/nest_metrics.json +++ linux-kvm-5.19.0/tools/perf/pmu-events/arch/powerpc/power10/nest_metrics.json @@ -1,13 +1,13 @@ [ { "MetricName": "VEC_GROUP_PUMP_RETRY_RATIO_P01", - "MetricExpr": "(hv_24x7@PM_PB_RTY_VG_PUMP01\\,chip\\=?@ / hv_24x7@PM_PB_VG_PUMP01\\,chip\\=?@) * 100", + "MetricExpr": "(hv_24x7@PM_PB_RTY_VG_PUMP01\\,chip\\=?@ / (1 + hv_24x7@PM_PB_VG_PUMP01\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "VEC_GROUP_PUMP_RETRY_RATIO_P23", - "MetricExpr": "(hv_24x7@PM_PB_RTY_VG_PUMP23\\,chip\\=?@ / hv_24x7@PM_PB_VG_PUMP23\\,chip\\=?@) * 100", + "MetricExpr": "(hv_24x7@PM_PB_RTY_VG_PUMP23\\,chip\\=?@ / (1 + hv_24x7@PM_PB_VG_PUMP23\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, @@ -61,13 +61,13 @@ }, { "MetricName": "REMOTE_NODE_PUMPS_RETRIES_RATIO_P01", - "MetricExpr": "(hv_24x7@PM_PB_RTY_RNS_PUMP01\\,chip\\=?@ / hv_24x7@PM_PB_RNS_PUMP01\\,chip\\=?@) * 100", + "MetricExpr": "(hv_24x7@PM_PB_RTY_RNS_PUMP01\\,chip\\=?@ / (1 + hv_24x7@PM_PB_RNS_PUMP01\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "REMOTE_NODE_PUMPS_RETRIES_RATIO_P23", - "MetricExpr": "(hv_24x7@PM_PB_RTY_RNS_PUMP23\\,chip\\=?@ / hv_24x7@PM_PB_RNS_PUMP23\\,chip\\=?@) * 100", + "MetricExpr": "(hv_24x7@PM_PB_RTY_RNS_PUMP23\\,chip\\=?@ / (1 + hv_24x7@PM_PB_RNS_PUMP23\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, @@ -151,193 +151,193 @@ }, { "MetricName": "XLINK0_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK0_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK0_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK1_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK1_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK1_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK2_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK2_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK2_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK3_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK3_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK3_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK4_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK4_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK4_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK5_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK5_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK5_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK6_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK6_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK6_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK7_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK7_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_XLINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK7_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK0_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK0_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK0_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK1_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK1_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK1_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK2_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK2_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK2_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK3_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK3_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK3_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK4_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK4_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK4_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK5_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK5_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK5_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK6_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK6_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK6_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "XLINK7_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_XLINK7_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_XLINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_XLINK7_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_XLINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_XLINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK0_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK0_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK0_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK1_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK1_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK1_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK2_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK2_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK2_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK3_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK3_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK3_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK4_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK4_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK4_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK5_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK5_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK5_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK6_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK6_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK6_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK7_OUT_TOTAL_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK7_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (hv_24x7@PM_ALINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK7_OUT_ODD_TOTAL_UTIL\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_TOTAL_UTIL\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK0_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK0_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK0_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK0_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK0_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK1_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK1_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK1_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK1_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK1_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK2_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK2_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK2_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK2_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK2_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK3_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK3_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK3_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK3_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK3_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK4_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK4_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK4_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK4_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK4_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK5_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK5_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK5_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK5_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK5_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK6_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK6_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK6_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK6_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK6_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, { "MetricName": "ALINK7_OUT_DATA_UTILIZATION", - "MetricExpr": "((hv_24x7@PM_ALINK7_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_DATA\\,chip\\=?@) / (hv_24x7@PM_ALINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", + "MetricExpr": "((hv_24x7@PM_ALINK7_OUT_ODD_DATA\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_DATA\\,chip\\=?@) / (1 + hv_24x7@PM_ALINK7_OUT_ODD_AVLBL_CYCLES\\,chip\\=?@ + hv_24x7@PM_ALINK7_OUT_EVEN_AVLBL_CYCLES\\,chip\\=?@)) * 100", "ScaleUnit": "1.063%", "AggregationMode": "PerChip" }, only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/perf/util/auxtrace.c +++ linux-kvm-5.19.0/tools/perf/util/auxtrace.c @@ -2290,11 +2290,19 @@ bool near; }; +static bool kern_sym_name_match(const char *kname, const char *name) +{ + size_t n = strlen(name); + + return !strcmp(kname, name) || + (!strncmp(kname, name, n) && kname[n] == '\t'); +} + static bool kern_sym_match(struct sym_args *args, const char *name, char type) { /* A function with the same name, and global or the n'th found or any */ return kallsyms__is_function(type) && - !strcmp(name, args->name) && + kern_sym_name_match(name, args->name) && ((args->global && isupper(type)) || (args->selected && ++(args->cnt) == args->idx) || (!args->global && !args->selected)); only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh +++ linux-kvm-5.19.0/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh @@ -4,6 +4,7 @@ SYSFS= # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 +retval=0 prerequisite() { @@ -102,10 +103,10 @@ if ! online_cpu $cpu; then echo $FUNCNAME $cpu: unexpected fail >&2 - exit 1 + retval=1 elif ! cpu_is_online $cpu; then echo $FUNCNAME $cpu: unexpected offline >&2 - exit 1 + retval=1 fi } @@ -115,10 +116,10 @@ if online_cpu $cpu 2> /dev/null; then echo $FUNCNAME $cpu: unexpected success >&2 - exit 1 + retval=1 elif ! cpu_is_offline $cpu; then echo $FUNCNAME $cpu: unexpected online >&2 - exit 1 + retval=1 fi } @@ -128,10 +129,10 @@ if ! offline_cpu $cpu; then echo $FUNCNAME $cpu: unexpected fail >&2 - exit 1 + retval=1 elif ! cpu_is_offline $cpu; then echo $FUNCNAME $cpu: unexpected offline >&2 - exit 1 + retval=1 fi } @@ -141,16 +142,33 @@ if offline_cpu $cpu 2> /dev/null; then echo $FUNCNAME $cpu: unexpected success >&2 - exit 1 + retval=1 elif ! cpu_is_online $cpu; then echo $FUNCNAME $cpu: unexpected offline >&2 - exit 1 + retval=1 fi } -error=-12 +online_all_hot_pluggable_cpus() +{ + for cpu in `hotplaggable_offline_cpus`; do + online_cpu_expect_success $cpu + done +} + +offline_all_hot_pluggable_cpus() +{ + local reserve_cpu=$online_max + for cpu in `hotpluggable_online_cpus`; do + # Reserve one cpu oneline at least. + if [ $cpu -eq $reserve_cpu ];then + continue + fi + offline_cpu_expect_success $cpu + done +} + allcpus=0 -priority=0 online_cpus=0 online_max=0 offline_cpus=0 @@ -158,31 +176,20 @@ present_cpus=0 present_max=0 -while getopts e:ahp: opt; do +while getopts ah opt; do case $opt in - e) - error=$OPTARG - ;; a) allcpus=1 ;; h) - echo "Usage $0 [ -a ] [ -e errno ] [ -p notifier-priority ]" + echo "Usage $0 [ -a ]" echo -e "\t default offline one cpu" echo -e "\t run with -a option to offline all cpus" exit ;; - p) - priority=$OPTARG - ;; esac done -if ! [ "$error" -ge -4095 -a "$error" -lt 0 ]; then - echo "error code must be -4095 <= errno < 0" >&2 - exit 1 -fi - prerequisite # @@ -201,7 +208,7 @@ offline_cpu_expect_success $present_max online_cpu $present_max fi - exit 0 + exit $retval else echo "Full scope test: all hotplug cpus" echo -e "\t online all offline cpus" @@ -209,85 +216,10 @@ echo -e "\t online all offline cpus" fi -# -# Online all hot-pluggable CPUs -# -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_success $cpu -done - -# -# Offline all hot-pluggable CPUs -# -for cpu in `hotpluggable_online_cpus`; do - offline_cpu_expect_success $cpu -done - -# -# Online all hot-pluggable CPUs again -# -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_success $cpu -done - -# -# Test with cpu notifier error injection -# +online_all_hot_pluggable_cpus -DEBUGFS=`mount -t debugfs | head -1 | awk '{ print $3 }'` -NOTIFIER_ERR_INJECT_DIR=$DEBUGFS/notifier-error-inject/cpu +offline_all_hot_pluggable_cpus -prerequisite_extra() -{ - msg="skip extra tests:" - - /sbin/modprobe -q -r cpu-notifier-error-inject - /sbin/modprobe -q cpu-notifier-error-inject priority=$priority - - if [ ! -d "$DEBUGFS" ]; then - echo $msg debugfs is not mounted >&2 - exit $ksft_skip - fi - - if [ ! -d $NOTIFIER_ERR_INJECT_DIR ]; then - echo $msg cpu-notifier-error-inject module is not available >&2 - exit $ksft_skip - fi -} - -prerequisite_extra - -# -# Offline all hot-pluggable CPUs -# -echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error -for cpu in `hotpluggable_online_cpus`; do - offline_cpu_expect_success $cpu -done - -# -# Test CPU hot-add error handling (offline => online) -# -echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_fail $cpu -done - -# -# Online all hot-pluggable CPUs -# -echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error -for cpu in `hotplaggable_offline_cpus`; do - online_cpu_expect_success $cpu -done - -# -# Test CPU hot-remove error handling (online => offline) -# -echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error -for cpu in `hotpluggable_online_cpus`; do - offline_cpu_expect_fail $cpu -done +online_all_hot_pluggable_cpus -echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error -/sbin/modprobe -q -r cpu-notifier-error-inject +exit $retval only in patch2: unchanged: --- linux-kvm-5.19.0.orig/tools/testing/selftests/kvm/memslot_modification_stress_test.c +++ linux-kvm-5.19.0/tools/testing/selftests/kvm/memslot_modification_stress_test.c @@ -68,7 +68,7 @@ static void add_remove_memslot(struct kvm_vm *vm, useconds_t delay, uint64_t nr_modifications) { - const uint64_t pages = 1; + uint64_t pages = max_t(int, vm->page_size, getpagesize()) / vm->page_size; uint64_t gpa; int i;