Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

en_rx_am.c was deleted in 'net-next' but had a bug fixed in it in
'net'.

The esp{4,6}_offload.c conflicts were overlapping changes.
The 'out' label is removed so we just return ERR_PTR(-EINVAL)
directly.

Signed-off-by: David S. Miller <davem@davemloft.net>

+729 -162
+46
Documentation/virtual/kvm/api.txt
··· 3403 3403 or if no page table is present for the addresses (e.g. when using 3404 3404 hugepages). 3405 3405 3406 + 4.108 KVM_PPC_GET_CPU_CHAR 3407 + 3408 + Capability: KVM_CAP_PPC_GET_CPU_CHAR 3409 + Architectures: powerpc 3410 + Type: vm ioctl 3411 + Parameters: struct kvm_ppc_cpu_char (out) 3412 + Returns: 0 on successful completion 3413 + -EFAULT if struct kvm_ppc_cpu_char cannot be written 3414 + 3415 + This ioctl gives userspace information about certain characteristics 3416 + of the CPU relating to speculative execution of instructions and 3417 + possible information leakage resulting from speculative execution (see 3418 + CVE-2017-5715, CVE-2017-5753 and CVE-2017-5754). The information is 3419 + returned in struct kvm_ppc_cpu_char, which looks like this: 3420 + 3421 + struct kvm_ppc_cpu_char { 3422 + __u64 character; /* characteristics of the CPU */ 3423 + __u64 behaviour; /* recommended software behaviour */ 3424 + __u64 character_mask; /* valid bits in character */ 3425 + __u64 behaviour_mask; /* valid bits in behaviour */ 3426 + }; 3427 + 3428 + For extensibility, the character_mask and behaviour_mask fields 3429 + indicate which bits of character and behaviour have been filled in by 3430 + the kernel. If the set of defined bits is extended in future then 3431 + userspace will be able to tell whether it is running on a kernel that 3432 + knows about the new bits. 3433 + 3434 + The character field describes attributes of the CPU which can help 3435 + with preventing inadvertent information disclosure - specifically, 3436 + whether there is an instruction to flash-invalidate the L1 data cache 3437 + (ori 30,30,0 or mtspr SPRN_TRIG2,rN), whether the L1 data cache is set 3438 + to a mode where entries can only be used by the thread that created 3439 + them, whether the bcctr[l] instruction prevents speculation, and 3440 + whether a speculation barrier instruction (ori 31,31,0) is provided. 3441 + 3442 + The behaviour field describes actions that software should take to 3443 + prevent inadvertent information disclosure, and thus describes which 3444 + vulnerabilities the hardware is subject to; specifically whether the 3445 + L1 data cache should be flushed when returning to user mode from the 3446 + kernel, and whether a speculation barrier should be placed between an 3447 + array bounds check and the array access. 3448 + 3449 + These fields use the same bit definitions as the new 3450 + H_GET_CPU_CHARACTERISTICS hypercall. 3451 + 3406 3452 5. The kvm_run structure 3407 3453 ------------------------ 3408 3454
+1 -1
Documentation/x86/pti.txt
··· 78 78 non-PTI SYSCALL entry code, so requires mapping fewer 79 79 things into the userspace page tables. The downside is 80 80 that stacks must be switched at entry time. 81 - d. Global pages are disabled for all kernel structures not 81 + c. Global pages are disabled for all kernel structures not 82 82 mapped into both kernel and userspace page tables. This 83 83 feature of the MMU allows different processes to share TLB 84 84 entries mapping the kernel. Losing the feature means more
+1
MAINTAINERS
··· 9102 9102 9103 9103 MIPS 9104 9104 M: Ralf Baechle <ralf@linux-mips.org> 9105 + M: James Hogan <jhogan@kernel.org> 9105 9106 L: linux-mips@linux-mips.org 9106 9107 W: http://www.linux-mips.org/ 9107 9108 T: git git://git.linux-mips.org/pub/scm/ralf/linux.git
+1 -1
Makefile
··· 2 2 VERSION = 4 3 3 PATCHLEVEL = 15 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc8 5 + EXTRAVERSION = -rc9 6 6 NAME = Fearless Coyote 7 7 8 8 # *DOCUMENTATION*
+29 -6
arch/alpha/kernel/sys_sio.c
··· 102 102 alpha_mv.sys.sio.route_tab); 103 103 } 104 104 105 + static bool sio_pci_dev_irq_needs_level(const struct pci_dev *dev) 106 + { 107 + if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) && 108 + (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA)) 109 + return false; 110 + 111 + return true; 112 + } 113 + 105 114 static unsigned int __init 106 115 sio_collect_irq_levels(void) 107 116 { ··· 119 110 120 111 /* Iterate through the devices, collecting IRQ levels. */ 121 112 for_each_pci_dev(dev) { 122 - if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) && 123 - (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA)) 113 + if (!sio_pci_dev_irq_needs_level(dev)) 124 114 continue; 125 115 126 116 if (dev->irq) ··· 128 120 return level_bits; 129 121 } 130 122 131 - static void __init 132 - sio_fixup_irq_levels(unsigned int level_bits) 123 + static void __sio_fixup_irq_levels(unsigned int level_bits, bool reset) 133 124 { 134 125 unsigned int old_level_bits; 135 126 ··· 146 139 */ 147 140 old_level_bits = inb(0x4d0) | (inb(0x4d1) << 8); 148 141 149 - level_bits |= (old_level_bits & 0x71ff); 142 + if (reset) 143 + old_level_bits &= 0x71ff; 144 + 145 + level_bits |= old_level_bits; 150 146 151 147 outb((level_bits >> 0) & 0xff, 0x4d0); 152 148 outb((level_bits >> 8) & 0xff, 0x4d1); 149 + } 150 + 151 + static inline void 152 + sio_fixup_irq_levels(unsigned int level_bits) 153 + { 154 + __sio_fixup_irq_levels(level_bits, true); 153 155 } 154 156 155 157 static inline int ··· 197 181 const long min_idsel = 6, max_idsel = 14, irqs_per_slot = 5; 198 182 int irq = COMMON_TABLE_LOOKUP, tmp; 199 183 tmp = __kernel_extbl(alpha_mv.sys.sio.route_tab, irq); 200 - return irq >= 0 ? tmp : -1; 184 + 185 + irq = irq >= 0 ? tmp : -1; 186 + 187 + /* Fixup IRQ level if an actual IRQ mapping is detected */ 188 + if (sio_pci_dev_irq_needs_level(dev) && irq >= 0) 189 + __sio_fixup_irq_levels(1 << irq, false); 190 + 191 + return irq; 201 192 } 202 193 203 194 static inline int
+6 -6
arch/alpha/lib/ev6-memset.S
··· 18 18 * The algorithm for the leading and trailing quadwords remains the same, 19 19 * however the loop has been unrolled to enable better memory throughput, 20 20 * and the code has been replicated for each of the entry points: __memset 21 - * and __memsetw to permit better scheduling to eliminate the stalling 21 + * and __memset16 to permit better scheduling to eliminate the stalling 22 22 * encountered during the mask replication. 23 23 * A future enhancement might be to put in a byte store loop for really 24 24 * small (say < 32 bytes) memset()s. Whether or not that change would be ··· 34 34 .globl memset 35 35 .globl __memset 36 36 .globl ___memset 37 - .globl __memsetw 37 + .globl __memset16 38 38 .globl __constant_c_memset 39 39 40 40 .ent ___memset ··· 415 415 * to mask stalls. Note that entry point names also had to change 416 416 */ 417 417 .align 5 418 - .ent __memsetw 418 + .ent __memset16 419 419 420 - __memsetw: 420 + __memset16: 421 421 .frame $30,0,$26,0 422 422 .prologue 0 423 423 ··· 596 596 nop 597 597 ret $31,($26),1 # L0 : 598 598 599 - .end __memsetw 600 - EXPORT_SYMBOL(__memsetw) 599 + .end __memset16 600 + EXPORT_SYMBOL(__memset16) 601 601 602 602 memset = ___memset 603 603 __memset = ___memset
+2 -2
arch/arm64/kvm/handle_exit.c
··· 45 45 46 46 ret = kvm_psci_call(vcpu); 47 47 if (ret < 0) { 48 - kvm_inject_undefined(vcpu); 48 + vcpu_set_reg(vcpu, 0, ~0UL); 49 49 return 1; 50 50 } 51 51 ··· 54 54 55 55 static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run) 56 56 { 57 - kvm_inject_undefined(vcpu); 57 + vcpu_set_reg(vcpu, 0, ~0UL); 58 58 return 1; 59 59 } 60 60
+11 -1
arch/mips/Kconfig
··· 259 259 select LEDS_GPIO_REGISTER 260 260 select BCM47XX_NVRAM 261 261 select BCM47XX_SPROM 262 + select BCM47XX_SSB if !BCM47XX_BCMA 262 263 help 263 264 Support for BCM47XX based boards 264 265 ··· 390 389 select SYS_SUPPORTS_32BIT_KERNEL 391 390 select SYS_SUPPORTS_MIPS16 392 391 select SYS_SUPPORTS_MULTITHREADING 392 + select SYS_SUPPORTS_VPE_LOADER 393 393 select SYS_HAS_EARLY_PRINTK 394 394 select GPIOLIB 395 395 select SWAP_IO_SPACE ··· 518 516 select SYS_SUPPORTS_MIPS16 519 517 select SYS_SUPPORTS_MULTITHREADING 520 518 select SYS_SUPPORTS_SMARTMIPS 519 + select SYS_SUPPORTS_VPE_LOADER 521 520 select SYS_SUPPORTS_ZBOOT 522 521 select SYS_SUPPORTS_RELOCATABLE 523 522 select USE_OF ··· 2284 2281 The only reason this is a build-time option is to save ~14K from the 2285 2282 final kernel image. 2286 2283 2284 + config SYS_SUPPORTS_VPE_LOADER 2285 + bool 2286 + depends on SYS_SUPPORTS_MULTITHREADING 2287 + help 2288 + Indicates that the platform supports the VPE loader, and provides 2289 + physical_memsize. 2290 + 2287 2291 config MIPS_VPE_LOADER 2288 2292 bool "VPE loader support." 2289 - depends on SYS_SUPPORTS_MULTITHREADING && MODULES 2293 + depends on SYS_SUPPORTS_VPE_LOADER && MODULES 2290 2294 select CPU_MIPSR2_IRQ_VI 2291 2295 select CPU_MIPSR2_IRQ_EI 2292 2296 select MIPS_MT
+10 -4
arch/mips/Kconfig.debug
··· 124 124 125 125 If unsure, say N. 126 126 127 - menuconfig MIPS_CPS_NS16550 127 + menuconfig MIPS_CPS_NS16550_BOOL 128 128 bool "CPS SMP NS16550 UART output" 129 129 depends on MIPS_CPS 130 130 help 131 131 Output debug information via an ns16550 compatible UART if exceptions 132 132 occur early in the boot process of a secondary core. 133 133 134 - if MIPS_CPS_NS16550 134 + if MIPS_CPS_NS16550_BOOL 135 + 136 + config MIPS_CPS_NS16550 137 + def_bool MIPS_CPS_NS16550_BASE != 0 135 138 136 139 config MIPS_CPS_NS16550_BASE 137 140 hex "UART Base Address" 138 141 default 0x1b0003f8 if MIPS_MALTA 142 + default 0 139 143 help 140 144 The base address of the ns16550 compatible UART on which to output 141 145 debug information from the early stages of core startup. 142 146 147 + This is only used if non-zero. 148 + 143 149 config MIPS_CPS_NS16550_SHIFT 144 150 int "UART Register Shift" 145 - default 0 if MIPS_MALTA 151 + default 0 146 152 help 147 153 The number of bits to shift ns16550 register indices by in order to 148 154 form their addresses. That is, log base 2 of the span between 149 155 adjacent ns16550 registers in the system. 150 156 151 - endif # MIPS_CPS_NS16550 157 + endif # MIPS_CPS_NS16550_BOOL 152 158 153 159 endmenu
+1 -1
arch/mips/ar7/platform.c
··· 575 575 uart_port.type = PORT_AR7; 576 576 uart_port.uartclk = clk_get_rate(bus_clk) / 2; 577 577 uart_port.iotype = UPIO_MEM32; 578 - uart_port.flags = UPF_FIXED_TYPE; 578 + uart_port.flags = UPF_FIXED_TYPE | UPF_BOOT_AUTOCONF; 579 579 uart_port.regshift = 2; 580 580 581 581 uart_port.line = 0;
+2
arch/mips/ath25/devices.c
··· 73 73 74 74 void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk) 75 75 { 76 + #ifdef CONFIG_SERIAL_8250_CONSOLE 76 77 struct uart_port s; 77 78 78 79 memset(&s, 0, sizeof(s)); ··· 86 85 s.uartclk = uartclk; 87 86 88 87 early_serial_setup(&s); 88 + #endif /* CONFIG_SERIAL_8250_CONSOLE */ 89 89 } 90 90 91 91 int __init ath25_add_wmac(int nr, u32 base, int irq)
-1
arch/mips/kernel/mips-cm.c
··· 292 292 *this_cpu_ptr(&cm_core_lock_flags)); 293 293 } else { 294 294 WARN_ON(cluster != 0); 295 - WARN_ON(vp != 0); 296 295 WARN_ON(block != CM_GCR_Cx_OTHER_BLOCK_LOCAL); 297 296 298 297 /*
+2 -1
arch/mips/lib/Makefile
··· 16 16 obj-$(CONFIG_CPU_TX39XX) += r3k_dump_tlb.o 17 17 18 18 # libgcc-style stuff needed in the kernel 19 - obj-y += ashldi3.o ashrdi3.o bswapsi.o bswapdi.o cmpdi2.o lshrdi3.o ucmpdi2.o 19 + obj-y += ashldi3.o ashrdi3.o bswapsi.o bswapdi.o cmpdi2.o lshrdi3.o multi3.o \ 20 + ucmpdi2.o
+17
arch/mips/lib/libgcc.h
··· 10 10 struct DWstruct { 11 11 int high, low; 12 12 }; 13 + 14 + struct TWstruct { 15 + long long high, low; 16 + }; 13 17 #elif defined(__LITTLE_ENDIAN) 14 18 struct DWstruct { 15 19 int low, high; 20 + }; 21 + 22 + struct TWstruct { 23 + long long low, high; 16 24 }; 17 25 #else 18 26 #error I feel sick. ··· 30 22 struct DWstruct s; 31 23 long long ll; 32 24 } DWunion; 25 + 26 + #if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) 27 + typedef int ti_type __attribute__((mode(TI))); 28 + 29 + typedef union { 30 + struct TWstruct s; 31 + ti_type ti; 32 + } TWunion; 33 + #endif 33 34 34 35 #endif /* __ASM_LIBGCC_H */
+54
arch/mips/lib/multi3.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <linux/export.h> 3 + 4 + #include "libgcc.h" 5 + 6 + /* 7 + * GCC 7 suboptimally generates __multi3 calls for mips64r6, so for that 8 + * specific case only we'll implement it here. 9 + * 10 + * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82981 11 + */ 12 + #if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPSR6) && (__GNUC__ == 7) 13 + 14 + /* multiply 64-bit values, low 64-bits returned */ 15 + static inline long long notrace dmulu(long long a, long long b) 16 + { 17 + long long res; 18 + 19 + asm ("dmulu %0,%1,%2" : "=r" (res) : "r" (a), "r" (b)); 20 + return res; 21 + } 22 + 23 + /* multiply 64-bit unsigned values, high 64-bits of 128-bit result returned */ 24 + static inline long long notrace dmuhu(long long a, long long b) 25 + { 26 + long long res; 27 + 28 + asm ("dmuhu %0,%1,%2" : "=r" (res) : "r" (a), "r" (b)); 29 + return res; 30 + } 31 + 32 + /* multiply 128-bit values, low 128-bits returned */ 33 + ti_type notrace __multi3(ti_type a, ti_type b) 34 + { 35 + TWunion res, aa, bb; 36 + 37 + aa.ti = a; 38 + bb.ti = b; 39 + 40 + /* 41 + * a * b = (a.lo * b.lo) 42 + * + 2^64 * (a.hi * b.lo + a.lo * b.hi) 43 + * [+ 2^128 * (a.hi * b.hi)] 44 + */ 45 + res.s.low = dmulu(aa.s.low, bb.s.low); 46 + res.s.high = dmuhu(aa.s.low, bb.s.low); 47 + res.s.high += dmulu(aa.s.high, bb.s.low); 48 + res.s.high += dmulu(aa.s.low, bb.s.high); 49 + 50 + return res.ti; 51 + } 52 + EXPORT_SYMBOL(__multi3); 53 + 54 + #endif /* 64BIT && CPU_MIPSR6 && GCC7 */
+1 -1
arch/mips/mm/uasm-micromips.c
··· 40 40 41 41 #include "uasm.c" 42 42 43 - static const struct insn const insn_table_MM[insn_invalid] = { 43 + static const struct insn insn_table_MM[insn_invalid] = { 44 44 [insn_addu] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_addu32_op), RT | RS | RD}, 45 45 [insn_addiu] = {M(mm_addiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM}, 46 46 [insn_and] = {M(mm_pool32a_op, 0, 0, 0, 0, mm_and_op), RT | RS | RD},
+2 -2
arch/mips/ralink/timer.c
··· 109 109 } 110 110 111 111 rt->irq = platform_get_irq(pdev, 0); 112 - if (!rt->irq) { 112 + if (rt->irq < 0) { 113 113 dev_err(&pdev->dev, "failed to load irq\n"); 114 - return -ENOENT; 114 + return rt->irq; 115 115 } 116 116 117 117 rt->membase = devm_ioremap_resource(&pdev->dev, res);
+3 -1
arch/mips/rb532/Makefile
··· 2 2 # Makefile for the RB532 board specific parts of the kernel 3 3 # 4 4 5 - obj-y += irq.o time.o setup.o serial.o prom.o gpio.o devices.o 5 + obj-$(CONFIG_SERIAL_8250_CONSOLE) += serial.o 6 + 7 + obj-y += irq.o time.o setup.o prom.o gpio.o devices.o
+4
arch/mips/rb532/devices.c
··· 310 310 return platform_add_devices(rb532_devs, ARRAY_SIZE(rb532_devs)); 311 311 } 312 312 313 + #ifdef CONFIG_NET 314 + 313 315 static int __init setup_kmac(char *s) 314 316 { 315 317 printk(KERN_INFO "korina mac = %s\n", s); ··· 323 321 } 324 322 325 323 __setup("kmac=", setup_kmac); 324 + 325 + #endif /* CONFIG_NET */ 326 326 327 327 arch_initcall(plat_setup_devices);
+25
arch/powerpc/include/uapi/asm/kvm.h
··· 443 443 __u32 ap_encodings[8]; 444 444 }; 445 445 446 + /* For KVM_PPC_GET_CPU_CHAR */ 447 + struct kvm_ppc_cpu_char { 448 + __u64 character; /* characteristics of the CPU */ 449 + __u64 behaviour; /* recommended software behaviour */ 450 + __u64 character_mask; /* valid bits in character */ 451 + __u64 behaviour_mask; /* valid bits in behaviour */ 452 + }; 453 + 454 + /* 455 + * Values for character and character_mask. 456 + * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. 457 + */ 458 + #define KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 (1ULL << 63) 459 + #define KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED (1ULL << 62) 460 + #define KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 (1ULL << 61) 461 + #define KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 (1ULL << 60) 462 + #define KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV (1ULL << 59) 463 + #define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58) 464 + #define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57) 465 + #define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56) 466 + 467 + #define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63) 468 + #define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62) 469 + #define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61) 470 + 446 471 /* Per-vcpu XICS interrupt controller state */ 447 472 #define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c) 448 473
+131
arch/powerpc/kvm/powerpc.c
··· 39 39 #include <asm/iommu.h> 40 40 #include <asm/switch_to.h> 41 41 #include <asm/xive.h> 42 + #ifdef CONFIG_PPC_PSERIES 43 + #include <asm/hvcall.h> 44 + #include <asm/plpar_wrappers.h> 45 + #endif 42 46 43 47 #include "timing.h" 44 48 #include "irq.h" ··· 552 548 #ifdef CONFIG_KVM_XICS 553 549 case KVM_CAP_IRQ_XICS: 554 550 #endif 551 + case KVM_CAP_PPC_GET_CPU_CHAR: 555 552 r = 1; 556 553 break; 557 554 ··· 1764 1759 return r; 1765 1760 } 1766 1761 1762 + #ifdef CONFIG_PPC_BOOK3S_64 1763 + /* 1764 + * These functions check whether the underlying hardware is safe 1765 + * against attacks based on observing the effects of speculatively 1766 + * executed instructions, and whether it supplies instructions for 1767 + * use in workarounds. The information comes from firmware, either 1768 + * via the device tree on powernv platforms or from an hcall on 1769 + * pseries platforms. 1770 + */ 1771 + #ifdef CONFIG_PPC_PSERIES 1772 + static int pseries_get_cpu_char(struct kvm_ppc_cpu_char *cp) 1773 + { 1774 + struct h_cpu_char_result c; 1775 + unsigned long rc; 1776 + 1777 + if (!machine_is(pseries)) 1778 + return -ENOTTY; 1779 + 1780 + rc = plpar_get_cpu_characteristics(&c); 1781 + if (rc == H_SUCCESS) { 1782 + cp->character = c.character; 1783 + cp->behaviour = c.behaviour; 1784 + cp->character_mask = KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 | 1785 + KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED | 1786 + KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 | 1787 + KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 | 1788 + KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV | 1789 + KVM_PPC_CPU_CHAR_BR_HINT_HONOURED | 1790 + KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF | 1791 + KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS; 1792 + cp->behaviour_mask = KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY | 1793 + KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR | 1794 + KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR; 1795 + } 1796 + return 0; 1797 + } 1798 + #else 1799 + static int pseries_get_cpu_char(struct kvm_ppc_cpu_char *cp) 1800 + { 1801 + return -ENOTTY; 1802 + } 1803 + #endif 1804 + 1805 + static inline bool have_fw_feat(struct device_node *fw_features, 1806 + const char *state, const char *name) 1807 + { 1808 + struct device_node *np; 1809 + bool r = false; 1810 + 1811 + np = of_get_child_by_name(fw_features, name); 1812 + if (np) { 1813 + r = of_property_read_bool(np, state); 1814 + of_node_put(np); 1815 + } 1816 + return r; 1817 + } 1818 + 1819 + static int kvmppc_get_cpu_char(struct kvm_ppc_cpu_char *cp) 1820 + { 1821 + struct device_node *np, *fw_features; 1822 + int r; 1823 + 1824 + memset(cp, 0, sizeof(*cp)); 1825 + r = pseries_get_cpu_char(cp); 1826 + if (r != -ENOTTY) 1827 + return r; 1828 + 1829 + np = of_find_node_by_name(NULL, "ibm,opal"); 1830 + if (np) { 1831 + fw_features = of_get_child_by_name(np, "fw-features"); 1832 + of_node_put(np); 1833 + if (!fw_features) 1834 + return 0; 1835 + if (have_fw_feat(fw_features, "enabled", 1836 + "inst-spec-barrier-ori31,31,0")) 1837 + cp->character |= KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31; 1838 + if (have_fw_feat(fw_features, "enabled", 1839 + "fw-bcctrl-serialized")) 1840 + cp->character |= KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED; 1841 + if (have_fw_feat(fw_features, "enabled", 1842 + "inst-l1d-flush-ori30,30,0")) 1843 + cp->character |= KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30; 1844 + if (have_fw_feat(fw_features, "enabled", 1845 + "inst-l1d-flush-trig2")) 1846 + cp->character |= KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2; 1847 + if (have_fw_feat(fw_features, "enabled", 1848 + "fw-l1d-thread-split")) 1849 + cp->character |= KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV; 1850 + if (have_fw_feat(fw_features, "enabled", 1851 + "fw-count-cache-disabled")) 1852 + cp->character |= KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS; 1853 + cp->character_mask = KVM_PPC_CPU_CHAR_SPEC_BAR_ORI31 | 1854 + KVM_PPC_CPU_CHAR_BCCTRL_SERIALISED | 1855 + KVM_PPC_CPU_CHAR_L1D_FLUSH_ORI30 | 1856 + KVM_PPC_CPU_CHAR_L1D_FLUSH_TRIG2 | 1857 + KVM_PPC_CPU_CHAR_L1D_THREAD_PRIV | 1858 + KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS; 1859 + 1860 + if (have_fw_feat(fw_features, "enabled", 1861 + "speculation-policy-favor-security")) 1862 + cp->behaviour |= KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY; 1863 + if (!have_fw_feat(fw_features, "disabled", 1864 + "needs-l1d-flush-msr-pr-0-to-1")) 1865 + cp->behaviour |= KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR; 1866 + if (!have_fw_feat(fw_features, "disabled", 1867 + "needs-spec-barrier-for-bound-checks")) 1868 + cp->behaviour |= KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR; 1869 + cp->behaviour_mask = KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY | 1870 + KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR | 1871 + KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR; 1872 + 1873 + of_node_put(fw_features); 1874 + } 1875 + 1876 + return 0; 1877 + } 1878 + #endif 1879 + 1767 1880 long kvm_arch_vm_ioctl(struct file *filp, 1768 1881 unsigned int ioctl, unsigned long arg) 1769 1882 { ··· 1981 1858 goto out; 1982 1859 r = kvm->arch.kvm_ops->get_rmmu_info(kvm, &info); 1983 1860 if (r >= 0 && copy_to_user(argp, &info, sizeof(info))) 1861 + r = -EFAULT; 1862 + break; 1863 + } 1864 + case KVM_PPC_GET_CPU_CHAR: { 1865 + struct kvm_ppc_cpu_char cpuchar; 1866 + 1867 + r = kvmppc_get_cpu_char(&cpuchar); 1868 + if (r >= 0 && copy_to_user(argp, &cpuchar, sizeof(cpuchar))) 1984 1869 r = -EFAULT; 1985 1870 break; 1986 1871 }
+2 -1
arch/s390/include/asm/kvm_host.h
··· 207 207 __u16 ipa; /* 0x0056 */ 208 208 __u32 ipb; /* 0x0058 */ 209 209 __u32 scaoh; /* 0x005c */ 210 - __u8 reserved60; /* 0x0060 */ 210 + #define FPF_BPBC 0x20 211 + __u8 fpf; /* 0x0060 */ 211 212 #define ECB_GS 0x40 212 213 #define ECB_TE 0x10 213 214 #define ECB_SRSI 0x04
+4 -1
arch/s390/include/uapi/asm/kvm.h
··· 224 224 #define KVM_SYNC_RICCB (1UL << 7) 225 225 #define KVM_SYNC_FPRS (1UL << 8) 226 226 #define KVM_SYNC_GSCB (1UL << 9) 227 + #define KVM_SYNC_BPBC (1UL << 10) 227 228 /* length and alignment of the sdnx as a power of two */ 228 229 #define SDNXC 8 229 230 #define SDNXL (1UL << SDNXC) ··· 248 247 }; 249 248 __u8 reserved[512]; /* for future vector expansion */ 250 249 __u32 fpc; /* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */ 251 - __u8 padding1[52]; /* riccb needs to be 64byte aligned */ 250 + __u8 bpbc : 1; /* bp mode */ 251 + __u8 reserved2 : 7; 252 + __u8 padding1[51]; /* riccb needs to be 64byte aligned */ 252 253 __u8 riccb[64]; /* runtime instrumentation controls block */ 253 254 __u8 padding2[192]; /* sdnx needs to be 256byte aligned */ 254 255 union {
+12
arch/s390/kvm/kvm-s390.c
··· 421 421 case KVM_CAP_S390_GS: 422 422 r = test_facility(133); 423 423 break; 424 + case KVM_CAP_S390_BPB: 425 + r = test_facility(82); 426 + break; 424 427 default: 425 428 r = 0; 426 429 } ··· 2201 2198 kvm_s390_set_prefix(vcpu, 0); 2202 2199 if (test_kvm_facility(vcpu->kvm, 64)) 2203 2200 vcpu->run->kvm_valid_regs |= KVM_SYNC_RICCB; 2201 + if (test_kvm_facility(vcpu->kvm, 82)) 2202 + vcpu->run->kvm_valid_regs |= KVM_SYNC_BPBC; 2204 2203 if (test_kvm_facility(vcpu->kvm, 133)) 2205 2204 vcpu->run->kvm_valid_regs |= KVM_SYNC_GSCB; 2206 2205 /* fprs can be synchronized via vrs, even if the guest has no vx. With ··· 2344 2339 current->thread.fpu.fpc = 0; 2345 2340 vcpu->arch.sie_block->gbea = 1; 2346 2341 vcpu->arch.sie_block->pp = 0; 2342 + vcpu->arch.sie_block->fpf &= ~FPF_BPBC; 2347 2343 vcpu->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID; 2348 2344 kvm_clear_async_pf_completion_queue(vcpu); 2349 2345 if (!kvm_s390_user_cpu_state_ctrl(vcpu->kvm)) ··· 3304 3298 vcpu->arch.sie_block->ecd |= ECD_HOSTREGMGMT; 3305 3299 vcpu->arch.gs_enabled = 1; 3306 3300 } 3301 + if ((kvm_run->kvm_dirty_regs & KVM_SYNC_BPBC) && 3302 + test_kvm_facility(vcpu->kvm, 82)) { 3303 + vcpu->arch.sie_block->fpf &= ~FPF_BPBC; 3304 + vcpu->arch.sie_block->fpf |= kvm_run->s.regs.bpbc ? FPF_BPBC : 0; 3305 + } 3307 3306 save_access_regs(vcpu->arch.host_acrs); 3308 3307 restore_access_regs(vcpu->run->s.regs.acrs); 3309 3308 /* save host (userspace) fprs/vrs */ ··· 3355 3344 kvm_run->s.regs.pft = vcpu->arch.pfault_token; 3356 3345 kvm_run->s.regs.pfs = vcpu->arch.pfault_select; 3357 3346 kvm_run->s.regs.pfc = vcpu->arch.pfault_compare; 3347 + kvm_run->s.regs.bpbc = (vcpu->arch.sie_block->fpf & FPF_BPBC) == FPF_BPBC; 3358 3348 save_access_regs(vcpu->run->s.regs.acrs); 3359 3349 restore_access_regs(vcpu->arch.host_acrs); 3360 3350 /* Save guest register state */
+10
arch/s390/kvm/vsie.c
··· 223 223 memcpy(scb_o->gcr, scb_s->gcr, 128); 224 224 scb_o->pp = scb_s->pp; 225 225 226 + /* branch prediction */ 227 + if (test_kvm_facility(vcpu->kvm, 82)) { 228 + scb_o->fpf &= ~FPF_BPBC; 229 + scb_o->fpf |= scb_s->fpf & FPF_BPBC; 230 + } 231 + 226 232 /* interrupt intercept */ 227 233 switch (scb_s->icptcode) { 228 234 case ICPT_PROGI: ··· 271 265 scb_s->ecb3 = 0; 272 266 scb_s->ecd = 0; 273 267 scb_s->fac = 0; 268 + scb_s->fpf = 0; 274 269 275 270 rc = prepare_cpuflags(vcpu, vsie_page); 276 271 if (rc) ··· 331 324 prefix_unmapped(vsie_page); 332 325 scb_s->ecb |= scb_o->ecb & ECB_TE; 333 326 } 327 + /* branch prediction */ 328 + if (test_kvm_facility(vcpu->kvm, 82)) 329 + scb_s->fpf |= scb_o->fpf & FPF_BPBC; 334 330 /* SIMD */ 335 331 if (test_kvm_facility(vcpu->kvm, 129)) { 336 332 scb_s->eca |= scb_o->eca & ECA_VX;
+1 -1
arch/x86/entry/entry_64.S
··· 1264 1264 #endif 1265 1265 1266 1266 #ifdef CONFIG_X86_MCE 1267 - idtentry machine_check has_error_code=0 paranoid=1 do_sym=*machine_check_vector(%rip) 1267 + idtentry machine_check do_mce has_error_code=0 paranoid=1 1268 1268 #endif 1269 1269 1270 1270 /*
+7 -3
arch/x86/include/asm/nospec-branch.h
··· 194 194 SPECTRE_V2_IBRS, 195 195 }; 196 196 197 + extern char __indirect_thunk_start[]; 198 + extern char __indirect_thunk_end[]; 199 + 197 200 /* 198 201 * On VMEXIT we must ensure that no RSB predictions learned in the guest 199 202 * can be followed in the host, by overwriting the RSB completely. Both ··· 206 203 static inline void vmexit_fill_RSB(void) 207 204 { 208 205 #ifdef CONFIG_RETPOLINE 209 - unsigned long loops = RSB_CLEAR_LOOPS / 2; 206 + unsigned long loops; 210 207 211 208 asm volatile (ANNOTATE_NOSPEC_ALTERNATIVE 212 209 ALTERNATIVE("jmp 910f", 213 210 __stringify(__FILL_RETURN_BUFFER(%0, RSB_CLEAR_LOOPS, %1)), 214 211 X86_FEATURE_RETPOLINE) 215 212 "910:" 216 - : "=&r" (loops), ASM_CALL_CONSTRAINT 217 - : "r" (loops) : "memory" ); 213 + : "=r" (loops), ASM_CALL_CONSTRAINT 214 + : : "memory" ); 218 215 #endif 219 216 } 217 + 220 218 #endif /* __ASSEMBLY__ */ 221 219 #endif /* __NOSPEC_BRANCH_H__ */
+1
arch/x86/include/asm/traps.h
··· 88 88 #ifdef CONFIG_X86_32 89 89 dotraplinkage void do_iret_error(struct pt_regs *, long); 90 90 #endif 91 + dotraplinkage void do_mce(struct pt_regs *, long); 91 92 92 93 static inline int get_si_code(unsigned long condition) 93 94 {
+5
arch/x86/kernel/cpu/mcheck/mce.c
··· 1785 1785 void (*machine_check_vector)(struct pt_regs *, long error_code) = 1786 1786 unexpected_machine_check; 1787 1787 1788 + dotraplinkage void do_mce(struct pt_regs *regs, long error_code) 1789 + { 1790 + machine_check_vector(regs, error_code); 1791 + } 1792 + 1788 1793 /* 1789 1794 * Called for each booted CPU to set up machine checks. 1790 1795 * Must be called with preempt off:
+22 -1
arch/x86/kernel/kprobes/opt.c
··· 40 40 #include <asm/debugreg.h> 41 41 #include <asm/set_memory.h> 42 42 #include <asm/sections.h> 43 + #include <asm/nospec-branch.h> 43 44 44 45 #include "common.h" 45 46 ··· 204 203 } 205 204 206 205 /* Check whether insn is indirect jump */ 207 - static int insn_is_indirect_jump(struct insn *insn) 206 + static int __insn_is_indirect_jump(struct insn *insn) 208 207 { 209 208 return ((insn->opcode.bytes[0] == 0xff && 210 209 (X86_MODRM_REG(insn->modrm.value) & 6) == 4) || /* Jump */ ··· 236 235 target = (unsigned long)insn->next_byte + insn->immediate.value; 237 236 238 237 return (start <= target && target <= start + len); 238 + } 239 + 240 + static int insn_is_indirect_jump(struct insn *insn) 241 + { 242 + int ret = __insn_is_indirect_jump(insn); 243 + 244 + #ifdef CONFIG_RETPOLINE 245 + /* 246 + * Jump to x86_indirect_thunk_* is treated as an indirect jump. 247 + * Note that even with CONFIG_RETPOLINE=y, the kernel compiled with 248 + * older gcc may use indirect jump. So we add this check instead of 249 + * replace indirect-jump check. 250 + */ 251 + if (!ret) 252 + ret = insn_jump_into_range(insn, 253 + (unsigned long)__indirect_thunk_start, 254 + (unsigned long)__indirect_thunk_end - 255 + (unsigned long)__indirect_thunk_start); 256 + #endif 257 + return ret; 239 258 } 240 259 241 260 /* Decode whole function to ensure any instructions don't jump into target */
+15 -10
arch/x86/kernel/process.c
··· 380 380 disable_local_APIC(); 381 381 mcheck_cpu_clear(this_cpu_ptr(&cpu_info)); 382 382 383 + /* 384 + * Use wbinvd on processors that support SME. This provides support 385 + * for performing a successful kexec when going from SME inactive 386 + * to SME active (or vice-versa). The cache must be cleared so that 387 + * if there are entries with the same physical address, both with and 388 + * without the encryption bit, they don't race each other when flushed 389 + * and potentially end up with the wrong entry being committed to 390 + * memory. 391 + */ 392 + if (boot_cpu_has(X86_FEATURE_SME)) 393 + native_wbinvd(); 383 394 for (;;) { 384 395 /* 385 - * Use wbinvd followed by hlt to stop the processor. This 386 - * provides support for kexec on a processor that supports 387 - * SME. With kexec, going from SME inactive to SME active 388 - * requires clearing cache entries so that addresses without 389 - * the encryption bit set don't corrupt the same physical 390 - * address that has the encryption bit set when caches are 391 - * flushed. To achieve this a wbinvd is performed followed by 392 - * a hlt. Even if the processor is not in the kexec/SME 393 - * scenario this only adds a wbinvd to a halting processor. 396 + * Use native_halt() so that memory contents don't change 397 + * (stack usage and variables) after possibly issuing the 398 + * native_wbinvd() above. 394 399 */ 395 - asm volatile("wbinvd; hlt" : : : "memory"); 400 + native_halt(); 396 401 } 397 402 } 398 403
+6
arch/x86/kernel/vmlinux.lds.S
··· 124 124 ASSERT(. - _entry_trampoline == PAGE_SIZE, "entry trampoline is too big"); 125 125 #endif 126 126 127 + #ifdef CONFIG_RETPOLINE 128 + __indirect_thunk_start = .; 129 + *(.text.__x86.indirect_thunk) 130 + __indirect_thunk_end = .; 131 + #endif 132 + 127 133 /* End of text section */ 128 134 _etext = .; 129 135 } :text = 0x9090
+2 -2
arch/x86/kvm/x86.c
··· 7496 7496 7497 7497 int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) 7498 7498 { 7499 - if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG_BIT)) { 7499 + if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG)) { 7500 7500 /* 7501 7501 * When EFER.LME and CR0.PG are set, the processor is in 7502 7502 * 64-bit mode (though maybe in a 32-bit code segment). 7503 7503 * CR4.PAE and EFER.LMA must be set. 7504 7504 */ 7505 - if (!(sregs->cr4 & X86_CR4_PAE_BIT) 7505 + if (!(sregs->cr4 & X86_CR4_PAE) 7506 7506 || !(sregs->efer & EFER_LMA)) 7507 7507 return -EINVAL; 7508 7508 } else {
+3 -2
arch/x86/lib/retpoline.S
··· 9 9 #include <asm/nospec-branch.h> 10 10 11 11 .macro THUNK reg 12 - .section .text.__x86.indirect_thunk.\reg 12 + .section .text.__x86.indirect_thunk 13 13 14 14 ENTRY(__x86_indirect_thunk_\reg) 15 15 CFI_STARTPROC ··· 25 25 * than one per register with the correct names. So we do it 26 26 * the simple and nasty way... 27 27 */ 28 - #define EXPORT_THUNK(reg) EXPORT_SYMBOL(__x86_indirect_thunk_ ## reg) 28 + #define __EXPORT_THUNK(sym) _ASM_NOKPROBE(sym); EXPORT_SYMBOL(sym) 29 + #define EXPORT_THUNK(reg) __EXPORT_THUNK(__x86_indirect_thunk_ ## reg) 29 30 #define GENERATE_THUNK(reg) THUNK reg ; EXPORT_THUNK(reg) 30 31 31 32 GENERATE_THUNK(_ASM_AX)
+1 -1
arch/x86/mm/mem_encrypt.c
··· 738 738 return total; 739 739 } 740 740 741 - void __init sme_encrypt_kernel(struct boot_params *bp) 741 + void __init __nostackprotector sme_encrypt_kernel(struct boot_params *bp) 742 742 { 743 743 unsigned long workarea_start, workarea_end, workarea_len; 744 744 unsigned long execute_start, execute_end, execute_len;
+15 -5
drivers/md/dm-crypt.c
··· 1954 1954 /* Ignore extra keys (which are used for IV etc) */ 1955 1955 subkey_size = crypt_subkey_size(cc); 1956 1956 1957 - if (crypt_integrity_hmac(cc)) 1957 + if (crypt_integrity_hmac(cc)) { 1958 + if (subkey_size < cc->key_mac_size) 1959 + return -EINVAL; 1960 + 1958 1961 crypt_copy_authenckey(cc->authenc_key, cc->key, 1959 1962 subkey_size - cc->key_mac_size, 1960 1963 cc->key_mac_size); 1964 + } 1965 + 1961 1966 for (i = 0; i < cc->tfms_count; i++) { 1962 1967 if (crypt_integrity_hmac(cc)) 1963 1968 r = crypto_aead_setkey(cc->cipher_tfm.tfms_aead[i], ··· 2057 2052 clear_bit(DM_CRYPT_KEY_VALID, &cc->flags); 2058 2053 2059 2054 ret = crypt_setkey(cc); 2060 - 2061 - /* wipe the kernel key payload copy in each case */ 2062 - memset(cc->key, 0, cc->key_size * sizeof(u8)); 2063 2055 2064 2056 if (!ret) { 2065 2057 set_bit(DM_CRYPT_KEY_VALID, &cc->flags); ··· 2525 2523 } 2526 2524 } 2527 2525 2526 + /* wipe the kernel key payload copy */ 2527 + if (cc->key_string) 2528 + memset(cc->key, 0, cc->key_size * sizeof(u8)); 2529 + 2528 2530 return ret; 2529 2531 } 2530 2532 ··· 2746 2740 cc->tag_pool_max_sectors * cc->on_disk_tag_size); 2747 2741 if (!cc->tag_pool) { 2748 2742 ti->error = "Cannot allocate integrity tags mempool"; 2743 + ret = -ENOMEM; 2749 2744 goto bad; 2750 2745 } 2751 2746 ··· 2968 2961 return ret; 2969 2962 if (cc->iv_gen_ops && cc->iv_gen_ops->init) 2970 2963 ret = cc->iv_gen_ops->init(cc); 2964 + /* wipe the kernel key payload copy */ 2965 + if (cc->key_string) 2966 + memset(cc->key, 0, cc->key_size * sizeof(u8)); 2971 2967 return ret; 2972 2968 } 2973 2969 if (argc == 2 && !strcasecmp(argv[1], "wipe")) { ··· 3017 3007 3018 3008 static struct target_type crypt_target = { 3019 3009 .name = "crypt", 3020 - .version = {1, 18, 0}, 3010 + .version = {1, 18, 1}, 3021 3011 .module = THIS_MODULE, 3022 3012 .ctr = crypt_ctr, 3023 3013 .dtr = crypt_dtr,
+37 -12
drivers/md/dm-integrity.c
··· 2559 2559 int r = 0; 2560 2560 unsigned i; 2561 2561 __u64 journal_pages, journal_desc_size, journal_tree_size; 2562 - unsigned char *crypt_data = NULL; 2562 + unsigned char *crypt_data = NULL, *crypt_iv = NULL; 2563 + struct skcipher_request *req = NULL; 2563 2564 2564 2565 ic->commit_ids[0] = cpu_to_le64(0x1111111111111111ULL); 2565 2566 ic->commit_ids[1] = cpu_to_le64(0x2222222222222222ULL); ··· 2618 2617 2619 2618 if (blocksize == 1) { 2620 2619 struct scatterlist *sg; 2621 - SKCIPHER_REQUEST_ON_STACK(req, ic->journal_crypt); 2622 - unsigned char iv[ivsize]; 2623 - skcipher_request_set_tfm(req, ic->journal_crypt); 2620 + 2621 + req = skcipher_request_alloc(ic->journal_crypt, GFP_KERNEL); 2622 + if (!req) { 2623 + *error = "Could not allocate crypt request"; 2624 + r = -ENOMEM; 2625 + goto bad; 2626 + } 2627 + 2628 + crypt_iv = kmalloc(ivsize, GFP_KERNEL); 2629 + if (!crypt_iv) { 2630 + *error = "Could not allocate iv"; 2631 + r = -ENOMEM; 2632 + goto bad; 2633 + } 2624 2634 2625 2635 ic->journal_xor = dm_integrity_alloc_page_list(ic); 2626 2636 if (!ic->journal_xor) { ··· 2653 2641 sg_set_buf(&sg[i], va, PAGE_SIZE); 2654 2642 } 2655 2643 sg_set_buf(&sg[i], &ic->commit_ids, sizeof ic->commit_ids); 2656 - memset(iv, 0x00, ivsize); 2644 + memset(crypt_iv, 0x00, ivsize); 2657 2645 2658 - skcipher_request_set_crypt(req, sg, sg, PAGE_SIZE * ic->journal_pages + sizeof ic->commit_ids, iv); 2646 + skcipher_request_set_crypt(req, sg, sg, PAGE_SIZE * ic->journal_pages + sizeof ic->commit_ids, crypt_iv); 2659 2647 init_completion(&comp.comp); 2660 2648 comp.in_flight = (atomic_t)ATOMIC_INIT(1); 2661 2649 if (do_crypt(true, req, &comp)) ··· 2671 2659 crypto_free_skcipher(ic->journal_crypt); 2672 2660 ic->journal_crypt = NULL; 2673 2661 } else { 2674 - SKCIPHER_REQUEST_ON_STACK(req, ic->journal_crypt); 2675 - unsigned char iv[ivsize]; 2676 2662 unsigned crypt_len = roundup(ivsize, blocksize); 2663 + 2664 + req = skcipher_request_alloc(ic->journal_crypt, GFP_KERNEL); 2665 + if (!req) { 2666 + *error = "Could not allocate crypt request"; 2667 + r = -ENOMEM; 2668 + goto bad; 2669 + } 2670 + 2671 + crypt_iv = kmalloc(ivsize, GFP_KERNEL); 2672 + if (!crypt_iv) { 2673 + *error = "Could not allocate iv"; 2674 + r = -ENOMEM; 2675 + goto bad; 2676 + } 2677 2677 2678 2678 crypt_data = kmalloc(crypt_len, GFP_KERNEL); 2679 2679 if (!crypt_data) { ··· 2693 2669 r = -ENOMEM; 2694 2670 goto bad; 2695 2671 } 2696 - 2697 - skcipher_request_set_tfm(req, ic->journal_crypt); 2698 2672 2699 2673 ic->journal_scatterlist = dm_integrity_alloc_journal_scatterlist(ic, ic->journal); 2700 2674 if (!ic->journal_scatterlist) { ··· 2717 2695 struct skcipher_request *section_req; 2718 2696 __u32 section_le = cpu_to_le32(i); 2719 2697 2720 - memset(iv, 0x00, ivsize); 2698 + memset(crypt_iv, 0x00, ivsize); 2721 2699 memset(crypt_data, 0x00, crypt_len); 2722 2700 memcpy(crypt_data, &section_le, min((size_t)crypt_len, sizeof(section_le))); 2723 2701 2724 2702 sg_init_one(&sg, crypt_data, crypt_len); 2725 - skcipher_request_set_crypt(req, &sg, &sg, crypt_len, iv); 2703 + skcipher_request_set_crypt(req, &sg, &sg, crypt_len, crypt_iv); 2726 2704 init_completion(&comp.comp); 2727 2705 comp.in_flight = (atomic_t)ATOMIC_INIT(1); 2728 2706 if (do_crypt(true, req, &comp)) ··· 2780 2758 } 2781 2759 bad: 2782 2760 kfree(crypt_data); 2761 + kfree(crypt_iv); 2762 + skcipher_request_free(req); 2763 + 2783 2764 return r; 2784 2765 } 2785 2766
+5 -1
drivers/md/dm-thin-metadata.c
··· 80 80 #define SECTOR_TO_BLOCK_SHIFT 3 81 81 82 82 /* 83 + * For btree insert: 83 84 * 3 for btree insert + 84 85 * 2 for btree lookup used within space map 86 + * For btree remove: 87 + * 2 for shadow spine + 88 + * 4 for rebalance 3 child node 85 89 */ 86 - #define THIN_MAX_CONCURRENT_LOCKS 5 90 + #define THIN_MAX_CONCURRENT_LOCKS 6 87 91 88 92 /* This should be plenty */ 89 93 #define SPACE_MAP_ROOT_SIZE 128
+2 -17
drivers/md/persistent-data/dm-btree.c
··· 683 683 pn->keys[1] = rn->keys[0]; 684 684 memcpy_disk(value_ptr(pn, 1), &val, sizeof(__le64)); 685 685 686 - /* 687 - * rejig the spine. This is ugly, since it knows too 688 - * much about the spine 689 - */ 690 - if (s->nodes[0] != new_parent) { 691 - unlock_block(s->info, s->nodes[0]); 692 - s->nodes[0] = new_parent; 693 - } 694 - if (key < le64_to_cpu(rn->keys[0])) { 695 - unlock_block(s->info, right); 696 - s->nodes[1] = left; 697 - } else { 698 - unlock_block(s->info, left); 699 - s->nodes[1] = right; 700 - } 701 - s->count = 2; 702 - 686 + unlock_block(s->info, left); 687 + unlock_block(s->info, right); 703 688 return 0; 704 689 } 705 690
+5 -2
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
··· 111 111 ethtype_mask = 0; 112 112 } 113 113 114 + if (ethtype_key == ETH_P_IPV6) 115 + fs->type = 1; 116 + 114 117 fs->val.ethtype = ethtype_key; 115 118 fs->mask.ethtype = ethtype_mask; 116 119 fs->val.proto = key->ip_proto; ··· 208 205 VLAN_PRIO_SHIFT); 209 206 vlan_tci_mask = mask->vlan_id | (mask->vlan_priority << 210 207 VLAN_PRIO_SHIFT); 211 - fs->val.ivlan = cpu_to_be16(vlan_tci); 212 - fs->mask.ivlan = cpu_to_be16(vlan_tci_mask); 208 + fs->val.ivlan = vlan_tci; 209 + fs->mask.ivlan = vlan_tci_mask; 213 210 214 211 /* Chelsio adapters use ivlan_vld bit to match vlan packets 215 212 * as 802.1Q. Also, when vlan tag is present in packets,
+9
drivers/net/ethernet/emulex/benet/be_main.c
··· 4634 4634 4635 4635 be_schedule_worker(adapter); 4636 4636 4637 + /* 4638 + * The IF was destroyed and re-created. We need to clear 4639 + * all promiscuous flags valid for the destroyed IF. 4640 + * Without this promisc mode is not restored during 4641 + * be_open() because the driver thinks that it is 4642 + * already enabled in HW. 4643 + */ 4644 + adapter->if_flags &= ~BE_IF_FLAGS_ALL_PROMISCUOUS; 4645 + 4637 4646 if (netif_running(netdev)) 4638 4647 status = be_open(netdev); 4639 4648
+58 -15
drivers/net/ethernet/ibm/ibmvnic.c
··· 411 411 struct ibmvnic_rx_pool *rx_pool; 412 412 int rx_scrqs; 413 413 int i, j, rc; 414 + u64 *size_array; 415 + 416 + size_array = (u64 *)((u8 *)(adapter->login_rsp_buf) + 417 + be32_to_cpu(adapter->login_rsp_buf->off_rxadd_buff_size)); 414 418 415 419 rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs); 416 420 for (i = 0; i < rx_scrqs; i++) { ··· 422 418 423 419 netdev_dbg(adapter->netdev, "Re-setting rx_pool[%d]\n", i); 424 420 425 - rc = reset_long_term_buff(adapter, &rx_pool->long_term_buff); 421 + if (rx_pool->buff_size != be64_to_cpu(size_array[i])) { 422 + free_long_term_buff(adapter, &rx_pool->long_term_buff); 423 + rx_pool->buff_size = be64_to_cpu(size_array[i]); 424 + alloc_long_term_buff(adapter, &rx_pool->long_term_buff, 425 + rx_pool->size * 426 + rx_pool->buff_size); 427 + } else { 428 + rc = reset_long_term_buff(adapter, 429 + &rx_pool->long_term_buff); 430 + } 431 + 426 432 if (rc) 427 433 return rc; 428 434 ··· 454 440 static void release_rx_pools(struct ibmvnic_adapter *adapter) 455 441 { 456 442 struct ibmvnic_rx_pool *rx_pool; 457 - int rx_scrqs; 458 443 int i, j; 459 444 460 445 if (!adapter->rx_pool) 461 446 return; 462 447 463 - rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs); 464 - for (i = 0; i < rx_scrqs; i++) { 448 + for (i = 0; i < adapter->num_active_rx_pools; i++) { 465 449 rx_pool = &adapter->rx_pool[i]; 466 450 467 451 netdev_dbg(adapter->netdev, "Releasing rx_pool[%d]\n", i); ··· 482 470 483 471 kfree(adapter->rx_pool); 484 472 adapter->rx_pool = NULL; 473 + adapter->num_active_rx_pools = 0; 485 474 } 486 475 487 476 static int init_rx_pools(struct net_device *netdev) ··· 506 493 dev_err(dev, "Failed to allocate rx pools\n"); 507 494 return -1; 508 495 } 496 + 497 + adapter->num_active_rx_pools = 0; 509 498 510 499 for (i = 0; i < rxadd_subcrqs; i++) { 511 500 rx_pool = &adapter->rx_pool[i]; ··· 551 536 rx_pool->next_alloc = 0; 552 537 rx_pool->next_free = 0; 553 538 } 539 + 540 + adapter->num_active_rx_pools = rxadd_subcrqs; 554 541 555 542 return 0; 556 543 } ··· 604 587 static void release_tx_pools(struct ibmvnic_adapter *adapter) 605 588 { 606 589 struct ibmvnic_tx_pool *tx_pool; 607 - int i, tx_scrqs; 590 + int i; 608 591 609 592 if (!adapter->tx_pool) 610 593 return; 611 594 612 - tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); 613 - for (i = 0; i < tx_scrqs; i++) { 595 + for (i = 0; i < adapter->num_active_tx_pools; i++) { 614 596 netdev_dbg(adapter->netdev, "Releasing tx_pool[%d]\n", i); 615 597 tx_pool = &adapter->tx_pool[i]; 616 598 kfree(tx_pool->tx_buff); ··· 620 604 621 605 kfree(adapter->tx_pool); 622 606 adapter->tx_pool = NULL; 607 + adapter->num_active_tx_pools = 0; 623 608 } 624 609 625 610 static int init_tx_pools(struct net_device *netdev) ··· 636 619 sizeof(struct ibmvnic_tx_pool), GFP_KERNEL); 637 620 if (!adapter->tx_pool) 638 621 return -1; 622 + 623 + adapter->num_active_tx_pools = 0; 639 624 640 625 for (i = 0; i < tx_subcrqs; i++) { 641 626 tx_pool = &adapter->tx_pool[i]; ··· 685 666 tx_pool->consumer_index = 0; 686 667 tx_pool->producer_index = 0; 687 668 } 669 + 670 + adapter->num_active_tx_pools = tx_subcrqs; 688 671 689 672 return 0; 690 673 } ··· 882 861 if (adapter->vpd->buff) 883 862 len = adapter->vpd->len; 884 863 885 - reinit_completion(&adapter->fw_done); 864 + init_completion(&adapter->fw_done); 886 865 crq.get_vpd_size.first = IBMVNIC_CRQ_CMD; 887 866 crq.get_vpd_size.cmd = GET_VPD_SIZE; 888 867 ibmvnic_send_crq(adapter, &crq); ··· 943 922 adapter->vpd = kzalloc(sizeof(*adapter->vpd), GFP_KERNEL); 944 923 if (!adapter->vpd) 945 924 return -ENOMEM; 925 + 926 + /* Vital Product Data (VPD) */ 927 + rc = ibmvnic_get_vpd(adapter); 928 + if (rc) { 929 + netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n"); 930 + return rc; 931 + } 946 932 947 933 adapter->map_id = 1; 948 934 adapter->napi = kcalloc(adapter->req_rx_queues, ··· 1024 996 static int ibmvnic_open(struct net_device *netdev) 1025 997 { 1026 998 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 1027 - int rc, vpd; 999 + int rc; 1028 1000 1029 1001 mutex_lock(&adapter->reset_lock); 1030 1002 ··· 1046 1018 1047 1019 rc = __ibmvnic_open(netdev); 1048 1020 netif_carrier_on(netdev); 1049 - 1050 - /* Vital Product Data (VPD) */ 1051 - vpd = ibmvnic_get_vpd(adapter); 1052 - if (vpd) 1053 - netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n"); 1054 1021 1055 1022 mutex_unlock(&adapter->reset_lock); 1056 1023 ··· 1576 1553 static int do_reset(struct ibmvnic_adapter *adapter, 1577 1554 struct ibmvnic_rwi *rwi, u32 reset_state) 1578 1555 { 1556 + u64 old_num_rx_queues, old_num_tx_queues; 1579 1557 struct net_device *netdev = adapter->netdev; 1580 1558 int i, rc; 1581 1559 ··· 1585 1561 1586 1562 netif_carrier_off(netdev); 1587 1563 adapter->reset_reason = rwi->reset_reason; 1564 + 1565 + old_num_rx_queues = adapter->req_rx_queues; 1566 + old_num_tx_queues = adapter->req_tx_queues; 1588 1567 1589 1568 if (rwi->reset_reason == VNIC_RESET_MOBILITY) { 1590 1569 rc = ibmvnic_reenable_crq_queue(adapter); ··· 1633 1606 rc = init_resources(adapter); 1634 1607 if (rc) 1635 1608 return rc; 1609 + } else if (adapter->req_rx_queues != old_num_rx_queues || 1610 + adapter->req_tx_queues != old_num_tx_queues) { 1611 + release_rx_pools(adapter); 1612 + release_tx_pools(adapter); 1613 + init_rx_pools(netdev); 1614 + init_tx_pools(netdev); 1636 1615 } else { 1637 1616 rc = reset_tx_pools(adapter); 1638 1617 if (rc) ··· 3636 3603 *req_value, 3637 3604 (long int)be64_to_cpu(crq->request_capability_rsp. 3638 3605 number), name); 3639 - *req_value = be64_to_cpu(crq->request_capability_rsp.number); 3606 + 3607 + if (be16_to_cpu(crq->request_capability_rsp.capability) == 3608 + REQ_MTU) { 3609 + pr_err("mtu of %llu is not supported. Reverting.\n", 3610 + *req_value); 3611 + *req_value = adapter->fallback.mtu; 3612 + } else { 3613 + *req_value = 3614 + be64_to_cpu(crq->request_capability_rsp.number); 3615 + } 3616 + 3640 3617 ibmvnic_send_req_caps(adapter, 1); 3641 3618 return; 3642 3619 default:
+2
drivers/net/ethernet/ibm/ibmvnic.h
··· 1091 1091 u64 opt_rxba_entries_per_subcrq; 1092 1092 __be64 tx_rx_desc_req; 1093 1093 u8 map_id; 1094 + u64 num_active_rx_pools; 1095 + u64 num_active_tx_pools; 1094 1096 1095 1097 struct tasklet_struct tasklet; 1096 1098 enum vnic_state state;
+3 -5
drivers/net/usb/usbnet.c
··· 457 457 void usbnet_defer_kevent (struct usbnet *dev, int work) 458 458 { 459 459 set_bit (work, &dev->flags); 460 - if (!schedule_work (&dev->kevent)) { 461 - if (net_ratelimit()) 462 - netdev_err(dev->net, "kevent %d may have been dropped\n", work); 463 - } else { 460 + if (!schedule_work (&dev->kevent)) 461 + netdev_dbg(dev->net, "kevent %d may have been dropped\n", work); 462 + else 464 463 netdev_dbg(dev->net, "kevent %d scheduled\n", work); 465 - } 466 464 } 467 465 EXPORT_SYMBOL_GPL(usbnet_defer_kevent); 468 466
+15 -2
drivers/scsi/libsas/sas_scsi_host.c
··· 486 486 487 487 int sas_eh_abort_handler(struct scsi_cmnd *cmd) 488 488 { 489 - int res; 489 + int res = TMF_RESP_FUNC_FAILED; 490 490 struct sas_task *task = TO_SAS_TASK(cmd); 491 491 struct Scsi_Host *host = cmd->device->host; 492 + struct domain_device *dev = cmd_to_domain_dev(cmd); 492 493 struct sas_internal *i = to_sas_internal(host->transportt); 494 + unsigned long flags; 493 495 494 496 if (!i->dft->lldd_abort_task) 495 497 return FAILED; 496 498 497 - res = i->dft->lldd_abort_task(task); 499 + spin_lock_irqsave(host->host_lock, flags); 500 + /* We cannot do async aborts for SATA devices */ 501 + if (dev_is_sata(dev) && !host->host_eh_scheduled) { 502 + spin_unlock_irqrestore(host->host_lock, flags); 503 + return FAILED; 504 + } 505 + spin_unlock_irqrestore(host->host_lock, flags); 506 + 507 + if (task) 508 + res = i->dft->lldd_abort_task(task); 509 + else 510 + SAS_DPRINTK("no task to abort\n"); 498 511 if (res == TMF_RESP_FUNC_SUCC || res == TMF_RESP_FUNC_COMPLETE) 499 512 return SUCCESS; 500 513
+3 -3
fs/nfsd/auth.c
··· 60 60 gi->gid[i] = exp->ex_anon_gid; 61 61 else 62 62 gi->gid[i] = rqgi->gid[i]; 63 - 64 - /* Each thread allocates its own gi, no race */ 65 - groups_sort(gi); 66 63 } 64 + 65 + /* Each thread allocates its own gi, no race */ 66 + groups_sort(gi); 67 67 } else { 68 68 gi = get_group_info(rqgi); 69 69 }
+2 -1
fs/orangefs/devorangefs-req.c
··· 162 162 struct orangefs_kernel_op_s *op, *temp; 163 163 __s32 proto_ver = ORANGEFS_KERNEL_PROTO_VERSION; 164 164 static __s32 magic = ORANGEFS_DEVREQ_MAGIC; 165 - struct orangefs_kernel_op_s *cur_op = NULL; 165 + struct orangefs_kernel_op_s *cur_op; 166 166 unsigned long ret; 167 167 168 168 /* We do not support blocking IO. */ ··· 186 186 return -EAGAIN; 187 187 188 188 restart: 189 + cur_op = NULL; 189 190 /* Get next op (if any) from top of list. */ 190 191 spin_lock(&orangefs_request_list_lock); 191 192 list_for_each_entry_safe(op, temp, &orangefs_request_list, list) {
+2 -2
fs/orangefs/waitqueue.c
··· 29 29 */ 30 30 void purge_waiting_ops(void) 31 31 { 32 - struct orangefs_kernel_op_s *op; 32 + struct orangefs_kernel_op_s *op, *tmp; 33 33 34 34 spin_lock(&orangefs_request_list_lock); 35 - list_for_each_entry(op, &orangefs_request_list, list) { 35 + list_for_each_entry_safe(op, tmp, &orangefs_request_list, list) { 36 36 gossip_debug(GOSSIP_WAIT_DEBUG, 37 37 "pvfs2-client-core: purging op tag %llu %s\n", 38 38 llu(op->tag),
+21
include/linux/swapops.h
··· 124 124 return unlikely(swp_type(entry) == SWP_DEVICE_WRITE); 125 125 } 126 126 127 + static inline unsigned long device_private_entry_to_pfn(swp_entry_t entry) 128 + { 129 + return swp_offset(entry); 130 + } 131 + 127 132 static inline struct page *device_private_entry_to_page(swp_entry_t entry) 128 133 { 129 134 return pfn_to_page(swp_offset(entry)); ··· 157 152 static inline bool is_write_device_private_entry(swp_entry_t entry) 158 153 { 159 154 return false; 155 + } 156 + 157 + static inline unsigned long device_private_entry_to_pfn(swp_entry_t entry) 158 + { 159 + return 0; 160 160 } 161 161 162 162 static inline struct page *device_private_entry_to_page(swp_entry_t entry) ··· 199 189 return unlikely(swp_type(entry) == SWP_MIGRATION_WRITE); 200 190 } 201 191 192 + static inline unsigned long migration_entry_to_pfn(swp_entry_t entry) 193 + { 194 + return swp_offset(entry); 195 + } 196 + 202 197 static inline struct page *migration_entry_to_page(swp_entry_t entry) 203 198 { 204 199 struct page *p = pfn_to_page(swp_offset(entry)); ··· 233 218 { 234 219 return 0; 235 220 } 221 + 222 + static inline unsigned long migration_entry_to_pfn(swp_entry_t entry) 223 + { 224 + return 0; 225 + } 226 + 236 227 static inline struct page *migration_entry_to_page(swp_entry_t entry) 237 228 { 238 229 return NULL;
+4
include/uapi/linux/kvm.h
··· 932 932 #define KVM_CAP_HYPERV_SYNIC2 148 933 933 #define KVM_CAP_HYPERV_VP_INDEX 149 934 934 #define KVM_CAP_S390_AIS_MIGRATION 150 935 + #define KVM_CAP_PPC_GET_CPU_CHAR 151 936 + #define KVM_CAP_S390_BPB 152 935 937 936 938 #ifdef KVM_CAP_IRQ_ROUTING 937 939 ··· 1263 1261 #define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg) 1264 1262 /* Available with KVM_CAP_PPC_RADIX_MMU */ 1265 1263 #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) 1264 + /* Available with KVM_CAP_PPC_GET_CPU_CHAR */ 1265 + #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) 1266 1266 1267 1267 /* ioctl for vm fd */ 1268 1268 #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
+14 -6
kernel/irq/matrix.c
··· 321 321 int irq_matrix_alloc(struct irq_matrix *m, const struct cpumask *msk, 322 322 bool reserved, unsigned int *mapped_cpu) 323 323 { 324 - unsigned int cpu; 324 + unsigned int cpu, best_cpu, maxavl = 0; 325 + struct cpumap *cm; 326 + unsigned int bit; 325 327 328 + best_cpu = UINT_MAX; 326 329 for_each_cpu(cpu, msk) { 327 - struct cpumap *cm = per_cpu_ptr(m->maps, cpu); 328 - unsigned int bit; 330 + cm = per_cpu_ptr(m->maps, cpu); 329 331 330 - if (!cm->online) 332 + if (!cm->online || cm->available <= maxavl) 331 333 continue; 332 334 335 + best_cpu = cpu; 336 + maxavl = cm->available; 337 + } 338 + 339 + if (maxavl) { 340 + cm = per_cpu_ptr(m->maps, best_cpu); 333 341 bit = matrix_alloc_area(m, cm, 1, false); 334 342 if (bit < m->alloc_end) { 335 343 cm->allocated++; ··· 346 338 m->global_available--; 347 339 if (reserved) 348 340 m->global_reserved--; 349 - *mapped_cpu = cpu; 350 - trace_irq_matrix_alloc(bit, cpu, m, cm); 341 + *mapped_cpu = best_cpu; 342 + trace_irq_matrix_alloc(bit, best_cpu, m, cm); 351 343 return bit; 352 344 } 353 345 }
+40 -26
mm/page_vma_mapped.c
··· 30 30 return true; 31 31 } 32 32 33 + static inline bool pfn_in_hpage(struct page *hpage, unsigned long pfn) 34 + { 35 + unsigned long hpage_pfn = page_to_pfn(hpage); 36 + 37 + /* THP can be referenced by any subpage */ 38 + return pfn >= hpage_pfn && pfn - hpage_pfn < hpage_nr_pages(hpage); 39 + } 40 + 41 + /** 42 + * check_pte - check if @pvmw->page is mapped at the @pvmw->pte 43 + * 44 + * page_vma_mapped_walk() found a place where @pvmw->page is *potentially* 45 + * mapped. check_pte() has to validate this. 46 + * 47 + * @pvmw->pte may point to empty PTE, swap PTE or PTE pointing to arbitrary 48 + * page. 49 + * 50 + * If PVMW_MIGRATION flag is set, returns true if @pvmw->pte contains migration 51 + * entry that points to @pvmw->page or any subpage in case of THP. 52 + * 53 + * If PVMW_MIGRATION flag is not set, returns true if @pvmw->pte points to 54 + * @pvmw->page or any subpage in case of THP. 55 + * 56 + * Otherwise, return false. 57 + * 58 + */ 33 59 static bool check_pte(struct page_vma_mapped_walk *pvmw) 34 60 { 61 + unsigned long pfn; 62 + 35 63 if (pvmw->flags & PVMW_MIGRATION) { 36 - #ifdef CONFIG_MIGRATION 37 64 swp_entry_t entry; 38 65 if (!is_swap_pte(*pvmw->pte)) 39 66 return false; ··· 68 41 69 42 if (!is_migration_entry(entry)) 70 43 return false; 71 - if (migration_entry_to_page(entry) - pvmw->page >= 72 - hpage_nr_pages(pvmw->page)) { 44 + 45 + pfn = migration_entry_to_pfn(entry); 46 + } else if (is_swap_pte(*pvmw->pte)) { 47 + swp_entry_t entry; 48 + 49 + /* Handle un-addressable ZONE_DEVICE memory */ 50 + entry = pte_to_swp_entry(*pvmw->pte); 51 + if (!is_device_private_entry(entry)) 73 52 return false; 74 - } 75 - if (migration_entry_to_page(entry) < pvmw->page) 76 - return false; 77 - #else 78 - WARN_ON_ONCE(1); 79 - #endif 53 + 54 + pfn = device_private_entry_to_pfn(entry); 80 55 } else { 81 - if (is_swap_pte(*pvmw->pte)) { 82 - swp_entry_t entry; 83 - 84 - entry = pte_to_swp_entry(*pvmw->pte); 85 - if (is_device_private_entry(entry) && 86 - device_private_entry_to_page(entry) == pvmw->page) 87 - return true; 88 - } 89 - 90 56 if (!pte_present(*pvmw->pte)) 91 57 return false; 92 58 93 - /* THP can be referenced by any subpage */ 94 - if (pte_page(*pvmw->pte) - pvmw->page >= 95 - hpage_nr_pages(pvmw->page)) { 96 - return false; 97 - } 98 - if (pte_page(*pvmw->pte) < pvmw->page) 99 - return false; 59 + pfn = pte_pfn(*pvmw->pte); 100 60 } 101 61 102 - return true; 62 + return pfn_in_hpage(pvmw->page, pfn); 103 63 } 104 64 105 65 /**
+15 -4
net/core/dev.c
··· 3166 3166 hdr_len = skb_transport_header(skb) - skb_mac_header(skb); 3167 3167 3168 3168 /* + transport layer */ 3169 - if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) 3170 - hdr_len += tcp_hdrlen(skb); 3171 - else 3172 - hdr_len += sizeof(struct udphdr); 3169 + if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) { 3170 + const struct tcphdr *th; 3171 + struct tcphdr _tcphdr; 3172 + 3173 + th = skb_header_pointer(skb, skb_transport_offset(skb), 3174 + sizeof(_tcphdr), &_tcphdr); 3175 + if (likely(th)) 3176 + hdr_len += __tcp_hdrlen(th); 3177 + } else { 3178 + struct udphdr _udphdr; 3179 + 3180 + if (skb_header_pointer(skb, skb_transport_offset(skb), 3181 + sizeof(_udphdr), &_udphdr)) 3182 + hdr_len += sizeof(struct udphdr); 3183 + } 3173 3184 3174 3185 if (shinfo->gso_type & SKB_GSO_DODGY) 3175 3186 gso_segs = DIV_ROUND_UP(skb->len - hdr_len,
+3
net/ipv4/esp4_offload.c
··· 118 118 if (!xo) 119 119 return ERR_PTR(-EINVAL); 120 120 121 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_ESP)) 122 + return ERR_PTR(-EINVAL); 123 + 121 124 x = skb->sp->xvec[skb->sp->len - 1]; 122 125 aead = x->data; 123 126 esph = ip_esp_hdr(skb);
+1 -1
net/ipv4/igmp.c
··· 332 332 return htonl(INADDR_ANY); 333 333 334 334 for_ifa(in_dev) { 335 - if (inet_ifa_match(fl4->saddr, ifa)) 335 + if (fl4->saddr == ifa->ifa_local) 336 336 return fl4->saddr; 337 337 } endfor_ifa(in_dev); 338 338
+3
net/ipv4/tcp_offload.c
··· 32 32 static struct sk_buff *tcp4_gso_segment(struct sk_buff *skb, 33 33 netdev_features_t features) 34 34 { 35 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)) 36 + return ERR_PTR(-EINVAL); 37 + 35 38 if (!pskb_may_pull(skb, sizeof(struct tcphdr))) 36 39 return ERR_PTR(-EINVAL); 37 40
+3
net/ipv4/udp_offload.c
··· 203 203 goto out; 204 204 } 205 205 206 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP)) 207 + goto out; 208 + 206 209 if (!pskb_may_pull(skb, sizeof(struct udphdr))) 207 210 goto out; 208 211
+3
net/ipv6/esp6_offload.c
··· 145 145 if (!xo) 146 146 return ERR_PTR(-EINVAL); 147 147 148 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_ESP)) 149 + return ERR_PTR(-EINVAL); 150 + 148 151 x = skb->sp->xvec[skb->sp->len - 1]; 149 152 aead = x->data; 150 153 esph = ip_esp_hdr(skb);
+3
net/ipv6/tcpv6_offload.c
··· 46 46 { 47 47 struct tcphdr *th; 48 48 49 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)) 50 + return ERR_PTR(-EINVAL); 51 + 49 52 if (!pskb_may_pull(skb, sizeof(*th))) 50 53 return ERR_PTR(-EINVAL); 51 54
+3
net/ipv6/udp_offload.c
··· 42 42 const struct ipv6hdr *ipv6h; 43 43 struct udphdr *uh; 44 44 45 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP)) 46 + goto out; 47 + 45 48 if (!pskb_may_pull(skb, sizeof(struct udphdr))) 46 49 goto out; 47 50
+3 -2
net/rds/tcp.c
··· 90 90 sizeof(val)); 91 91 } 92 92 93 - u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc) 93 + u32 rds_tcp_write_seq(struct rds_tcp_connection *tc) 94 94 { 95 - return tcp_sk(tc->t_sock->sk)->snd_nxt; 95 + /* seq# of the last byte of data in tcp send buffer */ 96 + return tcp_sk(tc->t_sock->sk)->write_seq; 96 97 } 97 98 98 99 u32 rds_tcp_snd_una(struct rds_tcp_connection *tc)
+1 -1
net/rds/tcp.h
··· 55 55 void rds_tcp_reset_callbacks(struct socket *sock, struct rds_conn_path *cp); 56 56 void rds_tcp_restore_callbacks(struct socket *sock, 57 57 struct rds_tcp_connection *tc); 58 - u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc); 58 + u32 rds_tcp_write_seq(struct rds_tcp_connection *tc); 59 59 u32 rds_tcp_snd_una(struct rds_tcp_connection *tc); 60 60 u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq); 61 61 extern struct rds_transport rds_tcp_transport;
+2 -2
net/rds/tcp_send.c
··· 86 86 * m_ack_seq is set to the sequence number of the last byte of 87 87 * header and data. see rds_tcp_is_acked(). 88 88 */ 89 - tc->t_last_sent_nxt = rds_tcp_snd_nxt(tc); 89 + tc->t_last_sent_nxt = rds_tcp_write_seq(tc); 90 90 rm->m_ack_seq = tc->t_last_sent_nxt + 91 91 sizeof(struct rds_header) + 92 92 be32_to_cpu(rm->m_inc.i_hdr.h_len) - 1; ··· 98 98 rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED; 99 99 100 100 rdsdebug("rm %p tcp nxt %u ack_seq %llu\n", 101 - rm, rds_tcp_snd_nxt(tc), 101 + rm, rds_tcp_write_seq(tc), 102 102 (unsigned long long)rm->m_ack_seq); 103 103 } 104 104
+3
net/sctp/offload.c
··· 45 45 struct sk_buff *segs = ERR_PTR(-EINVAL); 46 46 struct sctphdr *sh; 47 47 48 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_SCTP)) 49 + goto out; 50 + 48 51 sh = sctp_hdr(skb); 49 52 if (!pskb_may_pull(skb, sizeof(*sh))) 50 53 goto out;
+2
net/tls/tls_sw.c
··· 577 577 get_page(page); 578 578 sg = ctx->sg_plaintext_data + ctx->sg_plaintext_num_elem; 579 579 sg_set_page(sg, page, copy, offset); 580 + sg_unmark_end(sg); 581 + 580 582 ctx->sg_plaintext_num_elem++; 581 583 582 584 sk_mem_charge(sk, copy);
+1 -1
virt/kvm/arm/mmu.c
··· 1310 1310 return -EFAULT; 1311 1311 } 1312 1312 1313 - if (is_vm_hugetlb_page(vma) && !logging_active) { 1313 + if (vma_kernel_pagesize(vma) == PMD_SIZE && !logging_active) { 1314 1314 hugetlb = true; 1315 1315 gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT; 1316 1316 } else {
+5 -3
virt/kvm/arm/vgic/vgic-init.c
··· 285 285 if (ret) 286 286 goto out; 287 287 288 - ret = vgic_v4_init(kvm); 289 - if (ret) 290 - goto out; 288 + if (vgic_has_its(kvm)) { 289 + ret = vgic_v4_init(kvm); 290 + if (ret) 291 + goto out; 292 + } 291 293 292 294 kvm_for_each_vcpu(i, vcpu, kvm) 293 295 kvm_vgic_vcpu_enable(vcpu);
+1 -1
virt/kvm/arm/vgic/vgic-v4.c
··· 118 118 struct kvm_vcpu *vcpu; 119 119 int i, nr_vcpus, ret; 120 120 121 - if (!vgic_supports_direct_msis(kvm)) 121 + if (!kvm_vgic_global_state.has_gicv4) 122 122 return 0; /* Nothing to see here... move along. */ 123 123 124 124 if (dist->its_vm.vpes)