···1414This file allows to turn off the disk entropy contribution. Default1515value of this file is '1'(on).16161717+dax (RO)1818+--------1919+This file indicates whether the device supports Direct Access (DAX),2020+used by CPU-addressable storage to bypass the pagecache. It shows '1'2121+if true, '0' if not.2222+1723discard_granularity (RO)1824-----------------------1925This shows the size of internal allocation of the device in bytes, if···5145hw_sector_size (RO)5246-------------------5347This is the hardware sector size of the device, in bytes.4848+4949+io_poll (RW)5050+------------5151+When read, this file shows the total number of block IO polls and how5252+many returned success. Writing '0' to this file will disable polling5353+for this device. Writing any non-zero value will enable this feature.54545555iostats (RW)5656-------------···162150device state. This means that it might not be safe to toggle the163151setting from "write back" to "write through", since that will also164152eliminate cache flushes issued by the kernel.153153+154154+write_same_max_bytes (RO)155155+-------------------------156156+This is the number of bytes the device can write in a single write-same157157+command. A value of '0' means write-same is not supported by this158158+device.165159166160167161Jens Axboe <jens.axboe@oracle.com>, February 2009
+54
Documentation/devicetree/bindings/mfd/ac100.txt
···11+X-Powers AC100 Codec/RTC IC Device Tree bindings22+33+AC100 is a audio codec and RTC subsystem combo IC. The 2 parts are44+separated, including power supplies and interrupt lines, but share55+a common register address space and host interface.66+77+Required properties:88+- compatible: "x-powers,ac100"99+- reg: The I2C slave address or RSB hardware address for the chip1010+- sub-nodes:1111+ - codec1212+ - compatible: "x-powers,ac100-codec"1313+ - interrupt-parent: The parent interrupt controller1414+ - interrupts: SoC NMI / GPIO interrupt connected to the1515+ IRQ_AUDIO pin1616+ - #clock-cells: Shall be 01717+ - clock-output-names: "4M_adda"1818+1919+ - see clock/clock-bindings.txt for common clock bindings2020+2121+ - rtc2222+ - compatible: "x-powers,ac100-rtc"2323+ - interrupt-parent: The parent interrupt controller2424+ - interrupts: SoC NMI / GPIO interrupt connected to the2525+ IRQ_RTC pin2626+ - clocks: A phandle to the codec's "4M_adda" clock2727+ - #clock-cells: Shall be 12828+ - clock-output-names: "cko1_rtc", "cko2_rtc", "cko3_rtc"2929+3030+ - see clock/clock-bindings.txt for common clock bindings3131+3232+Example:3333+3434+ac100: codec@e89 {3535+ compatible = "x-powers,ac100";3636+ reg = <0xe89>;3737+3838+ ac100_codec: codec {3939+ compatible = "x-powers,ac100-codec";4040+ interrupt-parent = <&r_pio>;4141+ interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>; /* PL9 */4242+ #clock-cells = <0>;4343+ clock-output-names = "4M_adda";4444+ };4545+4646+ ac100_rtc: rtc {4747+ compatible = "x-powers,ac100-rtc";4848+ interrupt-parent = <&nmi_intc>;4949+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;5050+ clocks = <&ac100_codec>;5151+ #clock-cells = <1>;5252+ clock-output-names = "cko1_rtc", "cko2_rtc", "cko3_rtc";5353+ };5454+};
···1313 "qcom,rpm-msm8660"1414 "qcom,rpm-msm8960"1515 "qcom,rpm-ipq8064"1616+ "qcom,rpm-mdm9615"16171718- reg:1819 Usage: required···6059 "qcom,rpm-pm8058-regulators"6160 "qcom,rpm-pm8901-regulators"6261 "qcom,rpm-pm8921-regulators"6262+ "qcom,rpm-pm8018-regulators"63636464- vdd_l0_l1_lvs-supply:6565- vdd_l2_l11_l12-supply:···139137 Definition: reference to regulator supplying the input pin, as140138 described in the data sheet141139140140+- vin_lvs1-supply:141141+- vdd_l7-supply:142142+- vdd_l8-supply:143143+- vdd_l9_l10_l11_l12-supply:144144+ Usage: optional (pm8018 only)145145+ Value type: <phandle>146146+ Definition: reference to regulator supplying the input pin, as147147+ described in the data sheet148148+142149The regulator node houses sub-nodes for each regulator within the device. Each143150sub-node is identified using the node's name, with valid values listed for each144151of the pmics below.···166155 l12, l14, l15, l16, l17, l18, l21, l22, l23, l24, l25, l26, l27, l28,167156 l29, lvs1, lvs2, lvs3, lvs4, lvs5, lvs6, lvs7, usb-switch, hdmi-switch,168157 ncp158158+159159+pm8018:160160+ s1, s2, s3, s4, s5, , l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,161161+ l12, l14, lvs1169162170163The content of each sub-node is defined by the standard binding for regulators -171164see regulator.txt - with additional custom properties described below:
+34-3
Documentation/devicetree/bindings/mfd/rk808.txt
···11-RK808 Power Management Integrated Circuit11+RK8XX Power Management Integrated Circuit22+33+The rk8xx family current members:44+rk80855+rk8182637Required properties:44-- compatible: "rockchip,rk808"88+- compatible: "rockchip,rk808", "rockchip,rk818"59- reg: I2C slave address610- interrupt-parent: The parent interrupt controller.711- interrupts: the interrupt outputs of the controller.···1713 default output clock name1814- rockchip,system-power-controller: Telling whether or not this pmic is controlling1915 the system power.1616+1717+Optional RK808 properties:2018- vcc1-supply: The input supply for DCDC_REG12119- vcc2-supply: The input supply for DCDC_REG22220- vcc3-supply: The input supply for DCDC_REG3···3529 the gpio controller. If DVS GPIOs aren't present, voltage changes will happen3630 very quickly with no slow ramp time.37313838-Regulators: All the regulators of RK808 to be instantiated shall be3232+Optional RK818 properties:3333+- vcc1-supply: The input supply for DCDC_REG13434+- vcc2-supply: The input supply for DCDC_REG23535+- vcc3-supply: The input supply for DCDC_REG33636+- vcc4-supply: The input supply for DCDC_REG43737+- boost-supply: The input supply for DCDC_BOOST3838+- vcc6-supply: The input supply for LDO_REG1 and LDO_REG23939+- vcc7-supply: The input supply for LDO_REG3, LDO_REG5 and LDO_REG74040+- vcc8-supply: The input supply for LDO_REG4, LDO_REG6 and LDO_REG84141+- vcc9-supply: The input supply for LDO_REG9 and SWITCH_REG4242+- h_5v-supply: The input supply for HDMI_SWITCH4343+- usb-supply: The input supply for OTG_SWITCH4444+4545+Regulators: All the regulators of RK8XX to be instantiated shall be3946listed in a child node named 'regulators'. Each regulator is represented4047by a child node of the 'regulators' node.4148···6647 - valid values for n are 1 to 8.6748 - SWITCH_REGn6849 - valid values for n are 1 to 25050+5151+Following regulators of the RK818 PMIC block are supported. Note that5252+the 'n' in regulator name, as in DCDC_REGn or LDOn, represents the DCDC or LDO5353+number as described in RK818 datasheet.5454+5555+ - DCDC_REGn5656+ - valid values for n are 1 to 4.5757+ - LDO_REGn5858+ - valid values for n are 1 to 9.5959+ - SWITCH_REG6060+ - HDMI_SWITCH6161+ - OTG_SWITCH69627063Standard regulator bindings are used inside regulator subnodes. Check7164 Documentation/devicetree/bindings/regulator/regulator.txt
+1
MAINTAINERS
···10041004ARM/Annapurna Labs ALPINE ARCHITECTURE10051005M: Tsahee Zidenberg <tsahee@annapurnalabs.com>10061006M: Antoine Tenart <antoine.tenart@free-electrons.com>10071007+L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)10071008S: Maintained10081009F: arch/arm/mach-alpine/10091010F: arch/arm/boot/dts/alpine*
+1-8
Makefile
···11VERSION = 422PATCHLEVEL = 833SUBLEVEL = 044-EXTRAVERSION = -rc144+EXTRAVERSION = -rc255NAME = Psychotic Stoned Sheep6677# *DOCUMENTATION*···634634635635# Tell gcc to never replace conditional load with a non-conditional one636636KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)637637-638638-PHONY += gcc-plugins639639-gcc-plugins: scripts_basic640640-ifdef CONFIG_GCC_PLUGINS641641- $(Q)$(MAKE) $(build)=scripts/gcc-plugins642642-endif643643- @:644637645638include scripts/Makefile.gcc-plugins646639
+9
arch/Kconfig
···461461462462endchoice463463464464+config HAVE_ARCH_WITHIN_STACK_FRAMES465465+ bool466466+ help467467+ An architecture should select this if it can walk the kernel stack468468+ frames to determine if an object is part of either the arguments469469+ or local variables (i.e. that it excludes saved return addresses,470470+ and similar) by implementing an inline arch_within_stack_frames(),471471+ which is used by CONFIG_HARDENED_USERCOPY.472472+464473config HAVE_CONTEXT_TRACKING465474 bool466475 help
+1
arch/arm/Kconfig
···3535 select HARDIRQS_SW_RESEND3636 select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)3737 select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v63838+ select HAVE_ARCH_HARDENED_USERCOPY3839 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU3940 select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU4041 select HAVE_ARCH_MMAP_RND_BITS if MMU
···5858# CONFIG_IOMMU_SUPPORT is not set5959CONFIG_FIRMWARE_MEMMAP=y6060CONFIG_FANOTIFY=y6161-CONFIG_PRINTK_TIME=16161+CONFIG_PRINTK_TIME=y6262CONFIG_DYNAMIC_DEBUG=y6363CONFIG_STRIP_ASM_SYMS=y6464CONFIG_PAGE_POISONING=y
+1-1
arch/arm/configs/aspeed_g5_defconfig
···5959# CONFIG_IOMMU_SUPPORT is not set6060CONFIG_FIRMWARE_MEMMAP=y6161CONFIG_FANOTIFY=y6262-CONFIG_PRINTK_TIME=16262+CONFIG_PRINTK_TIME=y6363CONFIG_DYNAMIC_DEBUG=y6464CONFIG_STRIP_ASM_SYMS=y6565CONFIG_PAGE_POISONING=y
+9-2
arch/arm/include/asm/uaccess.h
···480480static inline unsigned long __must_check481481__copy_from_user(void *to, const void __user *from, unsigned long n)482482{483483- unsigned int __ua_flags = uaccess_save_and_enable();483483+ unsigned int __ua_flags;484484+485485+ check_object_size(to, n, false);486486+ __ua_flags = uaccess_save_and_enable();484487 n = arm_copy_from_user(to, from, n);485488 uaccess_restore(__ua_flags);486489 return n;···498495__copy_to_user(void __user *to, const void *from, unsigned long n)499496{500497#ifndef CONFIG_UACCESS_WITH_MEMCPY501501- unsigned int __ua_flags = uaccess_save_and_enable();498498+ unsigned int __ua_flags;499499+500500+ check_object_size(from, n, true);501501+ __ua_flags = uaccess_save_and_enable();502502 n = arm_copy_to_user(to, from, n);503503 uaccess_restore(__ua_flags);504504 return n;505505#else506506+ check_object_size(from, n, true);506507 return arm_copy_to_user(to, from, n);507508#endif508509}
+7-1
arch/arm/kernel/sys_oabi-compat.c
···279279 mm_segment_t fs;280280 long ret, err, i;281281282282- if (maxevents <= 0 || maxevents > (INT_MAX/sizeof(struct epoll_event)))282282+ if (maxevents <= 0 ||283283+ maxevents > (INT_MAX/sizeof(*kbuf)) ||284284+ maxevents > (INT_MAX/sizeof(*events)))283285 return -EINVAL;286286+ if (!access_ok(VERIFY_WRITE, events, sizeof(*events) * maxevents))287287+ return -EFAULT;284288 kbuf = kmalloc(sizeof(*kbuf) * maxevents, GFP_KERNEL);285289 if (!kbuf)286290 return -ENOMEM;···321317322318 if (nsops < 1 || nsops > SEMOPM)323319 return -EINVAL;320320+ if (!access_ok(VERIFY_READ, tsops, sizeof(*tsops) * nsops))321321+ return -EFAULT;324322 sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL);325323 if (!sops)326324 return -ENOMEM;
+5-1
arch/arm/kvm/arm.c
···1009100910101010 switch (ioctl) {10111011 case KVM_CREATE_IRQCHIP: {10121012+ int ret;10121013 if (!vgic_present)10131014 return -ENXIO;10141014- return kvm_vgic_create(kvm, KVM_DEV_TYPE_ARM_VGIC_V2);10151015+ mutex_lock(&kvm->lock);10161016+ ret = kvm_vgic_create(kvm, KVM_DEV_TYPE_ARM_VGIC_V2);10171017+ mutex_unlock(&kvm->lock);10181018+ return ret;10151019 }10161020 case KVM_ARM_SET_DEVICE_ADDR: {10171021 struct kvm_arm_device_addr dev_addr;
···11#22# Makefile for the linux kernel.33#44-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \55- -I$(srctree)/arch/arm/plat-versatile/include44+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/arch/arm/plat-versatile/include6576obj-y := core.o87obj-$(CONFIG_REALVIEW_DT) += realview-dt.o
+1-1
arch/arm/mach-s5pv210/Makefile
···55#66# Licensed under GPLv27788-ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include88+ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/arch/arm/plat-samsung/include991010# Core1111
+3
arch/arm/mach-shmobile/platsmp.c
···4040bool __init shmobile_smp_init_fallback_ops(void)4141{4242 /* fallback on PSCI/smp_ops if no other DT based method is detected */4343+ if (!IS_ENABLED(CONFIG_SMP))4444+ return false;4545+4346 return platform_can_secondary_boot() ? true : false;4447}
···8899config ARCH_ALPINE1010 bool "Annapurna Labs Alpine platform"1111- select ALPINE_MSI1111+ select ALPINE_MSI if PCI1212 help1313 This enables support for the Annapurna Labs Alpine1414 Soc family.···6666config ARCH_HISI6767 bool "Hisilicon SoC Family"6868 select ARM_TIMER_SP8046969- select HISILICON_IRQ_MBIGEN6969+ select HISILICON_IRQ_MBIGEN if PCI7070 help7171 This enables support for Hisilicon ARMv8 SoC family7272
+3
arch/arm64/boot/dts/exynos/exynos7-espresso.dts
···1212/dts-v1/;1313#include "exynos7.dtsi"1414#include <dt-bindings/interrupt-controller/irq.h>1515+#include <dt-bindings/clock/samsung,s2mps11.h>15161617/ {1718 model = "Samsung Exynos7 Espresso board based on EXYNOS7";···44434544&rtc {4645 status = "okay";4646+ clocks = <&clock_ccore PCLK_RTC>, <&s2mps15_osc S2MPS11_CLK_AP>;4747+ clock-names = "rtc", "rtc_src";4748};48494950&watchdog {
+46-7
arch/arm64/configs/defconfig
···11-# CONFIG_LOCALVERSION_AUTO is not set21CONFIG_SYSVIPC=y32CONFIG_POSIX_MQUEUE=y43CONFIG_AUDIT=y···1415CONFIG_LOG_BUF_SHIFT=141516CONFIG_MEMCG=y1617CONFIG_MEMCG_SWAP=y1818+CONFIG_BLK_CGROUP=y1919+CONFIG_CGROUP_PIDS=y1720CONFIG_CGROUP_HUGETLB=y1818-# CONFIG_UTS_NS is not set1919-# CONFIG_IPC_NS is not set2020-# CONFIG_NET_NS is not set2121+CONFIG_CPUSETS=y2222+CONFIG_CGROUP_DEVICE=y2323+CONFIG_CGROUP_CPUACCT=y2424+CONFIG_CGROUP_PERF=y2525+CONFIG_USER_NS=y2126CONFIG_SCHED_AUTOGROUP=y2227CONFIG_BLK_DEV_INITRD=y2328CONFIG_KALLSYMS_ALL=y···7471CONFIG_KSM=y7572CONFIG_TRANSPARENT_HUGEPAGE=y7673CONFIG_CMA=y7474+CONFIG_SECCOMP=y7775CONFIG_XEN=y7876CONFIG_KEXEC=y7977# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set···8884CONFIG_PACKET=y8985CONFIG_UNIX=y9086CONFIG_INET=y8787+CONFIG_IP_MULTICAST=y9188CONFIG_IP_PNP=y9289CONFIG_IP_PNP_DHCP=y9390CONFIG_IP_PNP_BOOTP=y9494-# CONFIG_IPV6 is not set9191+CONFIG_IPV6=m9292+CONFIG_NETFILTER=y9393+CONFIG_NF_CONNTRACK=m9494+CONFIG_NF_CONNTRACK_EVENTS=y9595+CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m9696+CONFIG_NETFILTER_XT_TARGET_LOG=m9797+CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m9898+CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m9999+CONFIG_NF_CONNTRACK_IPV4=m100100+CONFIG_IP_NF_IPTABLES=m101101+CONFIG_IP_NF_FILTER=m102102+CONFIG_IP_NF_TARGET_REJECT=m103103+CONFIG_IP_NF_NAT=m104104+CONFIG_IP_NF_TARGET_MASQUERADE=m105105+CONFIG_IP_NF_MANGLE=m106106+CONFIG_NF_CONNTRACK_IPV6=m107107+CONFIG_IP6_NF_IPTABLES=m108108+CONFIG_IP6_NF_FILTER=m109109+CONFIG_IP6_NF_TARGET_REJECT=m110110+CONFIG_IP6_NF_MANGLE=m111111+CONFIG_IP6_NF_NAT=m112112+CONFIG_IP6_NF_TARGET_MASQUERADE=m113113+CONFIG_BRIDGE=m114114+CONFIG_BRIDGE_VLAN_FILTERING=y115115+CONFIG_VLAN_8021Q=m116116+CONFIG_VLAN_8021Q_GVRP=y117117+CONFIG_VLAN_8021Q_MVRP=y95118CONFIG_BPF_JIT=y96119CONFIG_CFG80211=m97120CONFIG_MAC80211=m···134103CONFIG_MTD_M25P80=y135104CONFIG_MTD_SPI_NOR=y136105CONFIG_BLK_DEV_LOOP=y106106+CONFIG_BLK_DEV_NBD=m137107CONFIG_VIRTIO_BLK=y138108CONFIG_SRAM=y139109# CONFIG_SCSI_PROC_FS is not set···152120CONFIG_PATA_PLATFORM=y153121CONFIG_PATA_OF_PLATFORM=y154122CONFIG_NETDEVICES=y123123+CONFIG_MACVLAN=m124124+CONFIG_MACVTAP=m155125CONFIG_TUN=y126126+CONFIG_VETH=m156127CONFIG_VIRTIO_NET=y157128CONFIG_AMD_XGBE=y158129CONFIG_NET_XGENE=y···385350CONFIG_PWM_SAMSUNG=y386351CONFIG_EXT2_FS=y387352CONFIG_EXT3_FS=y353353+CONFIG_EXT4_FS_POSIX_ACL=y354354+CONFIG_BTRFS_FS=m355355+CONFIG_BTRFS_FS_POSIX_ACL=y388356CONFIG_FANOTIFY=y389357CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y390358CONFIG_QUOTA=y391359CONFIG_AUTOFS4_FS=y392392-CONFIG_FUSE_FS=y393393-CONFIG_CUSE=y360360+CONFIG_FUSE_FS=m361361+CONFIG_CUSE=m362362+CONFIG_OVERLAY_FS=m394363CONFIG_VFAT_FS=y395364CONFIG_TMPFS=y396365CONFIG_HUGETLBFS=y
···265265static inline unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n)266266{267267 kasan_check_write(to, n);268268- return __arch_copy_from_user(to, from, n);268268+ check_object_size(to, n, false);269269+ return __arch_copy_from_user(to, from, n);269270}270271271272static inline unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n)272273{273274 kasan_check_read(from, n);274274- return __arch_copy_to_user(to, from, n);275275+ check_object_size(from, n, true);276276+ return __arch_copy_to_user(to, from, n);275277}276278277279static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)278280{279281 kasan_check_write(to, n);280282281281- if (access_ok(VERIFY_READ, from, n))283283+ if (access_ok(VERIFY_READ, from, n)) {284284+ check_object_size(to, n, false);282285 n = __arch_copy_from_user(to, from, n);283283- else /* security hole - plug it */286286+ } else /* security hole - plug it */284287 memset(to, 0, n);285288 return n;286289}···292289{293290 kasan_check_read(from, n);294291295295- if (access_ok(VERIFY_WRITE, to, n))292292+ if (access_ok(VERIFY_WRITE, to, n)) {293293+ check_object_size(from, n, true);296294 n = __arch_copy_to_user(to, from, n);295295+ }297296 return n;298297}299298
+7
arch/arm64/kernel/entry.S
···353353 lsr x24, x1, #ESR_ELx_EC_SHIFT // exception class354354 cmp x24, #ESR_ELx_EC_DABT_CUR // data abort in EL1355355 b.eq el1_da356356+ cmp x24, #ESR_ELx_EC_IABT_CUR // instruction abort in EL1357357+ b.eq el1_ia356358 cmp x24, #ESR_ELx_EC_SYS64 // configurable trap357359 b.eq el1_undef358360 cmp x24, #ESR_ELx_EC_SP_ALIGN // stack alignment exception···366364 cmp x24, #ESR_ELx_EC_BREAKPT_CUR // debug exception in EL1367365 b.ge el1_dbg368366 b el1_inv367367+368368+el1_ia:369369+ /*370370+ * Fall through to the Data abort case371371+ */369372el1_da:370373 /*371374 * Data abort handling
+49-33
arch/arm64/kernel/hibernate.c
···3535#include <asm/sections.h>3636#include <asm/smp.h>3737#include <asm/suspend.h>3838+#include <asm/sysreg.h>3839#include <asm/virt.h>39404041/*···218217 set_pte(pte, __pte(virt_to_phys((void *)dst) |219218 pgprot_val(PAGE_KERNEL_EXEC)));220219221221- /* Load our new page tables */222222- asm volatile("msr ttbr0_el1, %0;"223223- "isb;"224224- "tlbi vmalle1is;"225225- "dsb ish;"226226- "isb" : : "r"(virt_to_phys(pgd)));220220+ /*221221+ * Load our new page tables. A strict BBM approach requires that we222222+ * ensure that TLBs are free of any entries that may overlap with the223223+ * global mappings we are about to install.224224+ *225225+ * For a real hibernate/resume cycle TTBR0 currently points to a zero226226+ * page, but TLBs may contain stale ASID-tagged entries (e.g. for EFI227227+ * runtime services), while for a userspace-driven test_resume cycle it228228+ * points to userspace page tables (and we must point it at a zero page229229+ * ourselves). Elsewhere we only (un)install the idmap with preemption230230+ * disabled, so T0SZ should be as required regardless.231231+ */232232+ cpu_set_reserved_ttbr0();233233+ local_flush_tlb_all();234234+ write_sysreg(virt_to_phys(pgd), ttbr0_el1);235235+ isb();227236228237 *phys_dst_addr = virt_to_phys((void *)dst);229238···405394 void *, phys_addr_t, phys_addr_t);406395407396 /*397397+ * Restoring the memory image will overwrite the ttbr1 page tables.398398+ * Create a second copy of just the linear map, and use this when399399+ * restoring.400400+ */401401+ tmp_pg_dir = (pgd_t *)get_safe_page(GFP_ATOMIC);402402+ if (!tmp_pg_dir) {403403+ pr_err("Failed to allocate memory for temporary page tables.");404404+ rc = -ENOMEM;405405+ goto out;406406+ }407407+ rc = copy_page_tables(tmp_pg_dir, PAGE_OFFSET, 0);408408+ if (rc)409409+ goto out;410410+411411+ /*412412+ * Since we only copied the linear map, we need to find restore_pblist's413413+ * linear map address.414414+ */415415+ lm_restore_pblist = LMADDR(restore_pblist);416416+417417+ /*418418+ * We need a zero page that is zero before & after resume in order to419419+ * to break before make on the ttbr1 page tables.420420+ */421421+ zero_page = (void *)get_safe_page(GFP_ATOMIC);422422+ if (!zero_page) {423423+ pr_err("Failed to allocate zero page.");424424+ rc = -ENOMEM;425425+ goto out;426426+ }427427+428428+ /*408429 * Locate the exit code in the bottom-but-one page, so that *NULL409430 * still has disastrous affects.410431 */···462419 __flush_dcache_area(hibernate_exit, exit_size);463420464421 /*465465- * Restoring the memory image will overwrite the ttbr1 page tables.466466- * Create a second copy of just the linear map, and use this when467467- * restoring.468468- */469469- tmp_pg_dir = (pgd_t *)get_safe_page(GFP_ATOMIC);470470- if (!tmp_pg_dir) {471471- pr_err("Failed to allocate memory for temporary page tables.");472472- rc = -ENOMEM;473473- goto out;474474- }475475- rc = copy_page_tables(tmp_pg_dir, PAGE_OFFSET, 0);476476- if (rc)477477- goto out;478478-479479- /*480480- * Since we only copied the linear map, we need to find restore_pblist's481481- * linear map address.482482- */483483- lm_restore_pblist = LMADDR(restore_pblist);484484-485485- /*486422 * KASLR will cause the el2 vectors to be in a different location in487423 * the resumed kernel. Load hibernate's temporary copy into el2.488424 *···474452475453 __hyp_set_vectors(el2_vectors);476454 }477477-478478- /*479479- * We need a zero page that is zero before & after resume in order to480480- * to break before make on the ttbr1 page tables.481481- */482482- zero_page = (void *)get_safe_page(GFP_ATOMIC);483455484456 hibernate_exit(virt_to_phys(tmp_pg_dir), resume_hdr.ttbr1_el1,485457 resume_hdr.reenter_kernel, lm_restore_pblist,
+5-26
arch/arm64/kernel/probes/kprobes.c
···4141static void __kprobes4242post_kprobe_handler(struct kprobe_ctlblk *, struct pt_regs *);43434444-static inline unsigned long min_stack_size(unsigned long addr)4545-{4646- unsigned long size;4747-4848- if (on_irq_stack(addr, raw_smp_processor_id()))4949- size = IRQ_STACK_PTR(raw_smp_processor_id()) - addr;5050- else5151- size = (unsigned long)current_thread_info() + THREAD_START_SP - addr;5252-5353- return min(size, FIELD_SIZEOF(struct kprobe_ctlblk, jprobes_stack));5454-}5555-5644static void __kprobes arch_prepare_ss_slot(struct kprobe *p)5745{5846 /* prepare insn slot */···477489{478490 struct jprobe *jp = container_of(p, struct jprobe, kp);479491 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();480480- long stack_ptr = kernel_stack_pointer(regs);481492482493 kcb->jprobe_saved_regs = *regs;483494 /*484484- * As Linus pointed out, gcc assumes that the callee485485- * owns the argument space and could overwrite it, e.g.486486- * tailcall optimization. So, to be absolutely safe487487- * we also save and restore enough stack bytes to cover488488- * the argument area.495495+ * Since we can't be sure where in the stack frame "stacked"496496+ * pass-by-value arguments are stored we just don't try to497497+ * duplicate any of the stack. Do not use jprobes on functions that498498+ * use more than 64 bytes (after padding each to an 8 byte boundary)499499+ * of arguments, or pass individual arguments larger than 16 bytes.489500 */490490- kasan_disable_current();491491- memcpy(kcb->jprobes_stack, (void *)stack_ptr,492492- min_stack_size(stack_ptr));493493- kasan_enable_current();494501495502 instruction_pointer_set(regs, (unsigned long) jp->entry);496503 preempt_disable();···537554 }538555 unpause_graph_tracing();539556 *regs = kcb->jprobe_saved_regs;540540- kasan_disable_current();541541- memcpy((void *)stack_addr, kcb->jprobes_stack,542542- min_stack_size(stack_addr));543543- kasan_enable_current();544557 preempt_enable_no_resched();545558 return 1;546559}
+4-4
arch/arm64/kernel/smp.c
···661661 acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_INTERRUPT,662662 acpi_parse_gic_cpu_interface, 0);663663664664- if (cpu_count > NR_CPUS)665665- pr_warn("no. of cores (%d) greater than configured maximum of %d - clipping\n",666666- cpu_count, NR_CPUS);664664+ if (cpu_count > nr_cpu_ids)665665+ pr_warn("Number of cores (%d) exceeds configured maximum of %d - clipping\n",666666+ cpu_count, nr_cpu_ids);667667668668 if (!bootcpu_valid) {669669 pr_err("missing boot CPU MPIDR, not enabling secondaries\n");···677677 * with entries in cpu_logical_map while initializing the cpus.678678 * If the cpu set-up fails, invalidate the cpu_logical_map entry.679679 */680680- for (i = 1; i < NR_CPUS; i++) {680680+ for (i = 1; i < nr_cpu_ids; i++) {681681 if (cpu_logical_map(i) != INVALID_HWID) {682682 if (smp_cpu_setup(i))683683 cpu_logical_map(i) = INVALID_HWID;
+12-2
arch/arm64/mm/fault.c
···153153}154154#endif155155156156+static bool is_el1_instruction_abort(unsigned int esr)157157+{158158+ return ESR_ELx_EC(esr) == ESR_ELx_EC_IABT_CUR;159159+}160160+156161/*157162 * The kernel tried to access some page that wasn't present.158163 */···166161{167162 /*168163 * Are we prepared to handle this kernel fault?164164+ * We are almost certainly not prepared to handle instruction faults.169165 */170170- if (fixup_exception(regs))166166+ if (!is_el1_instruction_abort(esr) && fixup_exception(regs))171167 return;172168173169 /*···273267 unsigned int ec = ESR_ELx_EC(esr);274268 unsigned int fsc_type = esr & ESR_ELx_FSC_TYPE;275269276276- return (ec == ESR_ELx_EC_DABT_CUR && fsc_type == ESR_ELx_FSC_PERM);270270+ return (ec == ESR_ELx_EC_DABT_CUR && fsc_type == ESR_ELx_FSC_PERM) ||271271+ (ec == ESR_ELx_EC_IABT_CUR && fsc_type == ESR_ELx_FSC_PERM);277272}278273279274static bool is_el0_instruction_abort(unsigned int esr)···318311 /* regs->orig_addr_limit may be 0 if we entered from EL0 */319312 if (regs->orig_addr_limit == KERNEL_DS)320313 die("Accessing user space memory with fs=KERNEL_DS", regs, esr);314314+315315+ if (is_el1_instruction_abort(esr))316316+ die("Attempting to execute userspace memory", regs, esr);321317322318 if (!search_exception_tables(regs->pc))323319 die("Accessing user space memory outside uaccess.h routines", regs, esr);
···5252 select MODULES_USE_ELF_RELA5353 select ARCH_USE_CMPXCHG_LOCKREF5454 select HAVE_ARCH_AUDITSYSCALL5555+ select HAVE_ARCH_HARDENED_USERCOPY5556 default y5657 help5758 The Itanium Processor Family is Intel's 64-bit successor to
···213213214214static inline void adjustformat(struct pt_regs *regs)215215{216216- ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;217216 /*218217 * set format byte to make stack appear modulo 4, which it will219218 * be when doing the rte
···310310{311311 unsigned long over;312312313313- if (access_ok(VERIFY_READ, from, n))313313+ if (access_ok(VERIFY_READ, from, n)) {314314+ if (!__builtin_constant_p(n))315315+ check_object_size(to, n, false);314316 return __copy_tofrom_user((__force void __user *)to, from, n);317317+ }315318 if ((unsigned long)from < TASK_SIZE) {316319 over = (unsigned long)from + n - TASK_SIZE;320320+ if (!__builtin_constant_p(n - over))321321+ check_object_size(to, n - over, false);317322 return __copy_tofrom_user((__force void __user *)to, from,318323 n - over) + over;319324 }···330325{331326 unsigned long over;332327333333- if (access_ok(VERIFY_WRITE, to, n))328328+ if (access_ok(VERIFY_WRITE, to, n)) {329329+ if (!__builtin_constant_p(n))330330+ check_object_size(from, n, true);334331 return __copy_tofrom_user(to, (__force void __user *)from, n);332332+ }335333 if ((unsigned long)to < TASK_SIZE) {336334 over = (unsigned long)to + n - TASK_SIZE;335335+ if (!__builtin_constant_p(n))336336+ check_object_size(from, n - over, true);337337 return __copy_tofrom_user(to, (__force void __user *)from,338338 n - over) + over;339339 }···382372 if (ret == 0)383373 return 0;384374 }375375+376376+ if (!__builtin_constant_p(n))377377+ check_object_size(to, n, false);378378+385379 return __copy_tofrom_user((__force void __user *)to, from, n);386380}387381···412398 if (ret == 0)413399 return 0;414400 }401401+ if (!__builtin_constant_p(n))402402+ check_object_size(from, n, true);403403+415404 return __copy_tofrom_user(to, (__force const void __user *)from, n);416405}417406
+2
arch/powerpc/include/asm/xics.h
···159159extern void xics_kexec_teardown_cpu(int secondary);160160extern void xics_migrate_irqs_away(void);161161extern void icp_native_eoi(struct irq_data *d);162162+extern int xics_set_irq_type(struct irq_data *d, unsigned int flow_type);163163+extern int xics_retrigger(struct irq_data *data);162164#ifdef CONFIG_SMP163165extern int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask,164166 unsigned int strict_check);
+2-2
arch/powerpc/kernel/eeh.c
···168168 int n = 0, l = 0;169169 char buffer[128];170170171171- n += scnprintf(buf+n, len-n, "%04x:%02x:%02x:%01x\n",171171+ n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n",172172 edev->phb->global_number, pdn->busno,173173 PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));174174- pr_warn("EEH: of node=%04x:%02x:%02x:%01x\n",174174+ pr_warn("EEH: of node=%04x:%02x:%02x.%01x\n",175175 edev->phb->global_number, pdn->busno,176176 PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn));177177
+40-29
arch/powerpc/kernel/exceptions-64s.S
···144144 * vector145145 */146146 SET_SCRATCH0(r13) /* save r13 */147147-#ifdef CONFIG_PPC_P7_NAP148148-BEGIN_FTR_SECTION149149- /* Running native on arch 2.06 or later, check if we are150150- * waking up from nap. We only handle no state loss and151151- * supervisor state loss. We do -not- handle hypervisor152152- * state loss at this time.147147+ /*148148+ * Running native on arch 2.06 or later, we may wakeup from winkle149149+ * inside machine check. If yes, then last bit of HSPGR0 would be set150150+ * to 1. Hence clear it unconditionally.153151 */154154- mfspr r13,SPRN_SRR1155155- rlwinm. r13,r13,47-31,30,31156156- OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)157157- beq 9f158158-159159- mfspr r13,SPRN_SRR1160160- rlwinm. r13,r13,47-31,30,31161161- /* waking up from powersave (nap) state */162162- cmpwi cr1,r13,2163163- /* Total loss of HV state is fatal. let's just stay stuck here */164164- OPT_GET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)165165- bgt cr1,.166166-9:167167- OPT_SET_SPR(r13, SPRN_CFAR, CPU_FTR_CFAR)168168-END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)169169-#endif /* CONFIG_PPC_P7_NAP */152152+ GET_PACA(r13)153153+ clrrdi r13,r13,1154154+ SET_PACA(r13)170155 EXCEPTION_PROLOG_0(PACA_EXMC)171156BEGIN_FTR_SECTION172157 b machine_check_powernv_early···12581273 * Check if thread was in power saving mode. We come here when any12591274 * of the following is true:12601275 * a. thread wasn't in power saving mode12611261- * b. thread was in power saving mode with no state loss or12621262- * supervisor state loss12761276+ * b. thread was in power saving mode with no state loss,12771277+ * supervisor state loss or hypervisor state loss.12631278 *12641264- * Go back to nap again if (b) is true.12791279+ * Go back to nap/sleep/winkle mode again if (b) is true.12651280 */12661281 rlwinm. r11,r12,47-31,30,31 /* Was it in power saving mode? */12671282 beq 4f /* No, it wasn;t */12681283 /* Thread was in power saving mode. Go back to nap again. */12691284 cmpwi r11,212701270- bne 3f12711271- /* Supervisor state loss */12851285+ blt 3f12861286+ /* Supervisor/Hypervisor state loss */12721287 li r0,112731288 stb r0,PACA_NAPSTATELOST(r13)127412893: bl machine_check_queue_event12751290 MACHINE_CHECK_HANDLER_WINDUP12761291 GET_PACA(r13)12771292 ld r1,PACAR1(r13)12781278- li r3,PNV_THREAD_NAP12791279- b pnv_enter_arch207_idle_mode12931293+ /*12941294+ * Check what idle state this CPU was in and go back to same mode12951295+ * again.12961296+ */12971297+ lbz r3,PACA_THREAD_IDLE_STATE(r13)12981298+ cmpwi r3,PNV_THREAD_NAP12991299+ bgt 10f13001300+ IDLE_STATE_ENTER_SEQ(PPC_NAP)13011301+ /* No return */13021302+10:13031303+ cmpwi r3,PNV_THREAD_SLEEP13041304+ bgt 2f13051305+ IDLE_STATE_ENTER_SEQ(PPC_SLEEP)13061306+ /* No return */13071307+13081308+2:13091309+ /*13101310+ * Go back to winkle. Please note that this thread was woken up in13111311+ * machine check from winkle and have not restored the per-subcore13121312+ * state. Hence before going back to winkle, set last bit of HSPGR013131313+ * to 1. This will make sure that if this thread gets woken up13141314+ * again at reset vector 0x100 then it will get chance to restore13151315+ * the subcore state.13161316+ */13171317+ ori r13,r13,113181318+ SET_PACA(r13)13191319+ IDLE_STATE_ENTER_SEQ(PPC_WINKLE)13201320+ /* No return */128013214:12811322#endif12821323 /*
+4-13
arch/powerpc/kernel/idle_book3s.S
···4444 PSSCR_PSLL_MASK | PSSCR_TR_MASK | \4545 PSSCR_MTL_MASK46464747-/* Idle state entry routines */4848-4949-#define IDLE_STATE_ENTER_SEQ(IDLE_INST) \5050- /* Magic NAP/SLEEP/WINKLE mode enter sequence */ \5151- std r0,0(r1); \5252- ptesync; \5353- ld r0,0(r1); \5454-1: cmp cr0,r0,r0; \5555- bne 1b; \5656- IDLE_INST; \5757- b .5858-5947 .text60486149/*···351363 * cr3 - set to gt if waking up with partial/complete hypervisor state loss352364 */353365_GLOBAL(pnv_restore_hyp_resource)354354- ld r2,PACATOC(r13);355366BEGIN_FTR_SECTION367367+ ld r2,PACATOC(r13);356368 /*357369 * POWER ISA 3. Use PSSCR to determine if we358370 * are waking up from deep idle state···383395 */384396 clrldi r5,r13,63385397 clrrdi r13,r13,1398398+399399+ /* Now that we are sure r13 is corrected, load TOC */400400+ ld r2,PACATOC(r13);386401 cmpwi cr4,r5,1387402 mtspr SPRN_HSPRG0,r13388403
+2-1
arch/powerpc/kernel/mce.c
···9292 mce->in_use = 1;93939494 mce->initiator = MCE_INITIATOR_CPU;9595- if (handled)9595+ /* Mark it recovered if we have handled it and MSR(RI=1). */9696+ if (handled && (regs->msr & MSR_RI))9697 mce->disposition = MCE_DISPOSITION_RECOVERED;9798 else9899 mce->disposition = MCE_DISPOSITION_NOT_RECOVERED;
+5-2
arch/powerpc/kernel/pci-common.c
···7878static int get_phb_number(struct device_node *dn)7979{8080 int ret, phb_id = -1;8181+ u32 prop_32;8182 u64 prop;82838384 /*···8786 * reading "ibm,opal-phbid", only present in OPAL environment.8887 */8988 ret = of_property_read_u64(dn, "ibm,opal-phbid", &prop);9090- if (ret)9191- ret = of_property_read_u32_index(dn, "reg", 1, (u32 *)&prop);8989+ if (ret) {9090+ ret = of_property_read_u32_index(dn, "reg", 1, &prop_32);9191+ prop = prop_32;9292+ }92939394 if (!ret)9495 phb_id = (int)(prop & (MAX_PHBS - 1));
-20
arch/powerpc/kernel/process.c
···10741074#endif10751075}1076107610771077-#ifdef CONFIG_PPC_TRANSACTIONAL_MEM10781078-void flush_tmregs_to_thread(struct task_struct *tsk)10791079-{10801080- /*10811081- * Process self tracing is not yet supported through10821082- * ptrace interface. Ptrace generic code should have10831083- * prevented this from happening in the first place.10841084- * Warn once here with the message, if some how it10851085- * is attempted.10861086- */10871087- WARN_ONCE(tsk == current,10881088- "Not expecting ptrace on self: TM regs may be incorrect\n");10891089-10901090- /*10911091- * If task is not current, it should have been flushed10921092- * already to it's thread_struct during __switch_to().10931093- */10941094-}10951095-#endif10961096-10971077struct task_struct *__switch_to(struct task_struct *prev,10981078 struct task_struct *new)10991079{
+1-1
arch/powerpc/kernel/prom_init.c
···2940294029412941 /* Don't print anything after quiesce under OPAL, it crashes OFW */29422942 if (of_platform != PLATFORM_OPAL) {29432943- prom_printf("Booting Linux via __start() ...\n");29432943+ prom_printf("Booting Linux via __start() @ 0x%lx ...\n", kbase);29442944 prom_debug("->dt_header_start=0x%x\n", hdr);29452945 }29462946
+19
arch/powerpc/kernel/ptrace.c
···3838#include <asm/page.h>3939#include <asm/pgtable.h>4040#include <asm/switch_to.h>4141+#include <asm/tm.h>41424243#define CREATE_TRACE_POINTS4344#include <trace/events/syscalls.h>···118117 REG_OFFSET_NAME(dsisr),119118 REG_OFFSET_END,120119};120120+121121+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM122122+static void flush_tmregs_to_thread(struct task_struct *tsk)123123+{124124+ /*125125+ * If task is not current, it will have been flushed already to126126+ * it's thread_struct during __switch_to().127127+ *128128+ * A reclaim flushes ALL the state.129129+ */130130+131131+ if (tsk == current && MSR_TM_SUSPENDED(mfmsr()))132132+ tm_reclaim_current(TM_CAUSE_SIGNAL);133133+134134+}135135+#else136136+static inline void flush_tmregs_to_thread(struct task_struct *tsk) { }137137+#endif121138122139/**123140 * regs_query_register_offset() - query register offset from its name
+5-4
arch/powerpc/kernel/setup_32.c
···9393 * and we are running with enough of the MMU enabled to have our9494 * proper kernel virtual addresses9595 *9696- * Find out what kind of machine we're on and save any data we need9797- * from the early boot process (devtree is copied on pmac by prom_init()).9898- * This is called very early on the boot process, after a minimal9999- * MMU environment has been set up but before MMU_init is called.9696+ * We do the initial parsing of the flat device-tree and prepares9797+ * for the MMU to be fully initialized.10098 */10199extern unsigned int memset_nocache_branch; /* Insn to be replaced by NOP */102100103101notrace void __init machine_init(u64 dt_ptr)104102{103103+ /* Configure static keys first, now that we're relocated. */104104+ setup_feature_keys();105105+105106 /* Enable early debugging if any specified (see udbg.h) */106107 udbg_early_init();107108
+1
arch/powerpc/kernel/setup_64.c
···300300301301 /* Apply all the dynamic patching */302302 apply_feature_fixups();303303+ setup_feature_keys();303304304305 /* Initialize the hash table or TLB handling */305306 early_init_mmu();
···188188 &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);189189#endif190190 do_final_fixups();191191+}191192193193+void __init setup_feature_keys(void)194194+{192195 /*193196 * Initialise jump label. This causes all the cpu/mmu_has_feature()194197 * checks to take on their correct polarity based on the current set of
+3-1
arch/powerpc/platforms/cell/spufs/inode.c
···496496 gang = alloc_spu_gang();497497 SPUFS_I(inode)->i_ctx = NULL;498498 SPUFS_I(inode)->i_gang = gang;499499- if (!gang)499499+ if (!gang) {500500+ ret = -ENOMEM;500501 goto out_iput;502502+ }501503502504 inode->i_op = &simple_dir_inode_operations;503505 inode->i_fop = &simple_dir_operations;
+5
arch/powerpc/platforms/pasemi/iommu.c
···187187 if (dev->vendor == 0x1959 && dev->device == 0xa007 &&188188 !firmware_has_feature(FW_FEATURE_LPAR)) {189189 dev->dev.archdata.dma_ops = &dma_direct_ops;190190+ /*191191+ * Set the coherent DMA mask to prevent the iommu192192+ * being used unnecessarily193193+ */194194+ dev->dev.coherent_dma_mask = DMA_BIT_MASK(44);190195 return;191196 }192197#endif
···399399400400 if (!(regs->msr & MSR_RI)) {401401 /* If MSR_RI isn't set, we cannot recover */402402+ pr_err("Machine check interrupt unrecoverable: MSR(RI=0)\n");402403 recovered = 0;403404 } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) {404405 /* Platform corrected itself */
+21-11
arch/powerpc/platforms/powernv/pci-ioda.c
···111111}112112early_param("iommu", iommu_setup);113113114114-static inline bool pnv_pci_is_mem_pref_64(unsigned long flags)114114+static inline bool pnv_pci_is_m64(struct pnv_phb *phb, struct resource *r)115115{116116- return ((flags & (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH)) ==117117- (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH));116116+ /*117117+ * WARNING: We cannot rely on the resource flags. The Linux PCI118118+ * allocation code sometimes decides to put a 64-bit prefetchable119119+ * BAR in the 32-bit window, so we have to compare the addresses.120120+ *121121+ * For simplicity we only test resource start.122122+ */123123+ return (r->start >= phb->ioda.m64_base &&124124+ r->start < (phb->ioda.m64_base + phb->ioda.m64_size));118125}119126120127static struct pnv_ioda_pe *pnv_ioda_init_pe(struct pnv_phb *phb, int pe_no)···236229 sgsz = phb->ioda.m64_segsize;237230 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {238231 r = &pdev->resource[i];239239- if (!r->parent || !pnv_pci_is_mem_pref_64(r->flags))232232+ if (!r->parent || !pnv_pci_is_m64(phb, r))240233 continue;241234242235 start = _ALIGN_DOWN(r->start - base, sgsz);···18841877 unsigned shift, unsigned long index,18851878 unsigned long npages)18861879{18871887- __be64 __iomem *invalidate = pnv_ioda_get_inval_reg(pe->phb, false);18801880+ __be64 __iomem *invalidate = pnv_ioda_get_inval_reg(pe->phb, rm);18881881 unsigned long start, end, inc;1889188218901883 /* We'll invalidate DMA address in PE scope */···28702863 res = &pdev->resource[i + PCI_IOV_RESOURCES];28712864 if (!res->flags || res->parent)28722865 continue;28732873- if (!pnv_pci_is_mem_pref_64(res->flags)) {28662866+ if (!pnv_pci_is_m64(phb, res)) {28742867 dev_warn(&pdev->dev, "Don't support SR-IOV with"28752868 " non M64 VF BAR%d: %pR. \n",28762869 i, res);···29652958 index++;29662959 }29672960 } else if ((res->flags & IORESOURCE_MEM) &&29682968- !pnv_pci_is_mem_pref_64(res->flags)) {29612961+ !pnv_pci_is_m64(phb, res)) {29692962 region.start = res->start -29702963 phb->hose->mem_offset[0] -29712964 phb->ioda.m32_pci_base;···30903083 bridge = bridge->bus->self;30913084 }3092308530933093- /* We fail back to M32 if M64 isn't supported */30943094- if (phb->ioda.m64_segsize &&30953095- pnv_pci_is_mem_pref_64(type))30863086+ /*30873087+ * We fall back to M32 if M64 isn't supported. We enforce the M6430883088+ * alignment for any 64-bit resource, PCIe doesn't care and30893089+ * bridges only do 64-bit prefetchable anyway.30903090+ */30913091+ if (phb->ioda.m64_segsize && (type & IORESOURCE_MEM_64))30963092 return phb->ioda.m64_segsize;30973093 if (type & IORESOURCE_MEM)30983094 return phb->ioda.m32_segsize;···31353125 w = NULL;31363126 if (r->flags & type & IORESOURCE_IO)31373127 w = &hose->io_resource;31383138- else if (pnv_pci_is_mem_pref_64(r->flags) &&31283128+ else if (pnv_pci_is_m64(phb, r) &&31393129 (type & IORESOURCE_PREFETCH) &&31403130 phb->ioda.m64_segsize)31413131 w = &hose->mem_resources[1];
+13-13
arch/powerpc/platforms/pseries/hotplug-memory.c
···320320 return dlpar_update_device_tree_lmb(lmb);321321}322322323323-static struct memory_block *lmb_to_memblock(struct of_drconf_cell *lmb)324324-{325325- unsigned long section_nr;326326- struct mem_section *mem_sect;327327- struct memory_block *mem_block;328328-329329- section_nr = pfn_to_section_nr(PFN_DOWN(lmb->base_addr));330330- mem_sect = __nr_to_section(section_nr);331331-332332- mem_block = find_memory_block(mem_sect);333333- return mem_block;334334-}335335-336323#ifdef CONFIG_MEMORY_HOTREMOVE337324static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)338325{···406419}407420408421static int dlpar_add_lmb(struct of_drconf_cell *);422422+423423+static struct memory_block *lmb_to_memblock(struct of_drconf_cell *lmb)424424+{425425+ unsigned long section_nr;426426+ struct mem_section *mem_sect;427427+ struct memory_block *mem_block;428428+429429+ section_nr = pfn_to_section_nr(PFN_DOWN(lmb->base_addr));430430+ mem_sect = __nr_to_section(section_nr);431431+432432+ mem_block = find_memory_block(mem_sect);433433+ return mem_block;434434+}409435410436static int dlpar_remove_lmb(struct of_drconf_cell *lmb)411437{
···156156 .irq_mask = ics_opal_mask_irq,157157 .irq_unmask = ics_opal_unmask_irq,158158 .irq_eoi = NULL, /* Patched at init time */159159- .irq_set_affinity = ics_opal_set_affinity159159+ .irq_set_affinity = ics_opal_set_affinity,160160+ .irq_set_type = xics_set_irq_type,161161+ .irq_retrigger = xics_retrigger,160162};161163162164static int ics_opal_map(struct ics *ics, unsigned int virq);
+3-1
arch/powerpc/sysdev/xics/ics-rtas.c
···163163 .irq_mask = ics_rtas_mask_irq,164164 .irq_unmask = ics_rtas_unmask_irq,165165 .irq_eoi = NULL, /* Patched at init time */166166- .irq_set_affinity = ics_rtas_set_affinity166166+ .irq_set_affinity = ics_rtas_set_affinity,167167+ .irq_set_type = xics_set_irq_type,168168+ .irq_retrigger = xics_retrigger,167169};168170169171static int ics_rtas_map(struct ics *ics, unsigned int virq)
+52-7
arch/powerpc/sysdev/xics/xics-common.c
···328328329329 pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw);330330331331- /* They aren't all level sensitive but we just don't really know */332332- irq_set_status_flags(virq, IRQ_LEVEL);331331+ /*332332+ * Mark interrupts as edge sensitive by default so that resend333333+ * actually works. The device-tree parsing will turn the LSIs334334+ * back to level.335335+ */336336+ irq_clear_status_flags(virq, IRQ_LEVEL);333337334338 /* Don't call into ICS for IPIs */335339 if (hw == XICS_IPI) {···355351 irq_hw_number_t *out_hwirq, unsigned int *out_flags)356352357353{358358- /* Current xics implementation translates everything359359- * to level. It is not technically right for MSIs but this360360- * is irrelevant at this point. We might get smarter in the future361361- */362354 *out_hwirq = intspec[0];363363- *out_flags = IRQ_TYPE_LEVEL_LOW;364355356356+ /*357357+ * If intsize is at least 2, we look for the type in the second cell,358358+ * we assume the LSB indicates a level interrupt.359359+ */360360+ if (intsize > 1) {361361+ if (intspec[1] & 1)362362+ *out_flags = IRQ_TYPE_LEVEL_LOW;363363+ else364364+ *out_flags = IRQ_TYPE_EDGE_RISING;365365+ } else366366+ *out_flags = IRQ_TYPE_LEVEL_LOW;367367+368368+ return 0;369369+}370370+371371+int xics_set_irq_type(struct irq_data *d, unsigned int flow_type)372372+{373373+ /*374374+ * We only support these. This has really no effect other than setting375375+ * the corresponding descriptor bits mind you but those will in turn376376+ * affect the resend function when re-enabling an edge interrupt.377377+ *378378+ * Set set the default to edge as explained in map().379379+ */380380+ if (flow_type == IRQ_TYPE_DEFAULT || flow_type == IRQ_TYPE_NONE)381381+ flow_type = IRQ_TYPE_EDGE_RISING;382382+383383+ if (flow_type != IRQ_TYPE_EDGE_RISING &&384384+ flow_type != IRQ_TYPE_LEVEL_LOW)385385+ return -EINVAL;386386+387387+ irqd_set_trigger_type(d, flow_type);388388+389389+ return IRQ_SET_MASK_OK_NOCOPY;390390+}391391+392392+int xics_retrigger(struct irq_data *data)393393+{394394+ /*395395+ * We need to push a dummy CPPR when retriggering, since the subsequent396396+ * EOI will try to pop it. Passing 0 works, as the function hard codes397397+ * the priority value anyway.398398+ */399399+ xics_push_cppr(0);400400+401401+ /* Tell the core to do a soft retrigger */365402 return 0;366403}367404
+14
arch/s390/Kconfig
···123123 select HAVE_ALIGNED_STRUCT_PAGE if SLUB124124 select HAVE_ARCH_AUDITSYSCALL125125 select HAVE_ARCH_EARLY_PFN_TO_NID126126+ select HAVE_ARCH_HARDENED_USERCOPY126127 select HAVE_ARCH_JUMP_LABEL127128 select CPU_NO_EFFICIENT_FFS if !HAVE_MARCH_Z9_109_FEATURES128129 select HAVE_ARCH_SECCOMP_FILTER···871870872871 Select this option if you want to run the kernel as a guest under873872 the KVM hypervisor.873873+874874+config S390_GUEST_OLD_TRANSPORT875875+ def_bool y876876+ prompt "Guest support for old s390 virtio transport (DEPRECATED)"877877+ depends on S390_GUEST878878+ help879879+ Enable this option to add support for the old s390-virtio880880+ transport (i.e. virtio devices NOT based on virtio-ccw). This881881+ type of virtio devices is only available on the experimental882882+ kuli userspace or with old (< 2.6) qemu. If you are running883883+ with a modern version of qemu (which supports virtio-ccw since884884+ 1.4 and uses it by default since version 2.4), you probably won't885885+ need this.874886875887endmenu
+4-1
arch/s390/kvm/kvm-s390.c
···16721672 KVM_SYNC_CRS |16731673 KVM_SYNC_ARCH0 |16741674 KVM_SYNC_PFAULT;16751675+ kvm_s390_set_prefix(vcpu, 0);16751676 if (test_kvm_facility(vcpu->kvm, 64))16761677 vcpu->run->kvm_valid_regs |= KVM_SYNC_RICCB;16771678 /* fprs can be synchronized via vrs, even if the guest has no vx. With···23622361 rc = gmap_mprotect_notify(vcpu->arch.gmap,23632362 kvm_s390_get_prefix(vcpu),23642363 PAGE_SIZE * 2, PROT_WRITE);23652365- if (rc)23642364+ if (rc) {23652365+ kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);23662366 return rc;23672367+ }23672368 goto retry;23682369 }23692370
+2
arch/s390/lib/uaccess.c
···104104105105unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)106106{107107+ check_object_size(to, n, false);107108 if (static_branch_likely(&have_mvcos))108109 return copy_from_user_mvcos(to, from, n);109110 return copy_from_user_mvcp(to, from, n);···178177179178unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)180179{180180+ check_object_size(from, n, true);181181 if (static_branch_likely(&have_mvcos))182182 return copy_to_user_mvcos(to, from, n);183183 return copy_to_user_mvcs(to, from, n);
···248248249249static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)250250{251251- if (n && __access_ok((unsigned long) to, n))251251+ if (n && __access_ok((unsigned long) to, n)) {252252+ if (!__builtin_constant_p(n))253253+ check_object_size(from, n, true);252254 return __copy_user(to, (__force void __user *) from, n);253253- else255255+ } else254256 return n;255257}256258257259static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)258260{261261+ if (!__builtin_constant_p(n))262262+ check_object_size(from, n, true);259263 return __copy_user(to, (__force void __user *) from, n);260264}261265262266static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n)263267{264264- if (n && __access_ok((unsigned long) from, n))268268+ if (n && __access_ok((unsigned long) from, n)) {269269+ if (!__builtin_constant_p(n))270270+ check_object_size(to, n, false);265271 return __copy_user((__force void __user *) to, from, n);266266- else272272+ } else267273 return n;268274}269275
+9-2
arch/sparc/include/asm/uaccess_64.h
···210210static inline unsigned long __must_check211211copy_from_user(void *to, const void __user *from, unsigned long size)212212{213213- unsigned long ret = ___copy_from_user(to, from, size);213213+ unsigned long ret;214214215215+ if (!__builtin_constant_p(size))216216+ check_object_size(to, size, false);217217+218218+ ret = ___copy_from_user(to, from, size);215219 if (unlikely(ret))216220 ret = copy_from_user_fixup(to, from, size);217221···231227static inline unsigned long __must_check232228copy_to_user(void __user *to, const void *from, unsigned long size)233229{234234- unsigned long ret = ___copy_to_user(to, from, size);230230+ unsigned long ret;235231232232+ if (!__builtin_constant_p(size))233233+ check_object_size(from, size, true);234234+ ret = ___copy_to_user(to, from, size);236235 if (unlikely(ret))237236 ret = copy_to_user_fixup(to, from, size);238237 return ret;
···288288 jne opportunistic_sysret_failed289289290290 /*291291- * SYSRET can't restore RF. SYSRET can restore TF, but unlike IRET,292292- * restoring TF results in a trap from userspace immediately after293293- * SYSRET. This would cause an infinite loop whenever #DB happens294294- * with register state that satisfies the opportunistic SYSRET295295- * conditions. For example, single-stepping this user code:291291+ * SYSCALL clears RF when it saves RFLAGS in R11 and SYSRET cannot292292+ * restore RF properly. If the slowpath sets it for whatever reason, we293293+ * need to restore it correctly.294294+ *295295+ * SYSRET can restore TF, but unlike IRET, restoring TF results in a296296+ * trap from userspace immediately after SYSRET. This would cause an297297+ * infinite loop whenever #DB happens with register state that satisfies298298+ * the opportunistic SYSRET conditions. For example, single-stepping299299+ * this user code:296300 *297301 * movq $stuck_here, %rcx298302 * pushfq···605601.endm606602#endif607603604604+/* Make sure APIC interrupt handlers end up in the irqentry section: */605605+#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)606606+# define PUSH_SECTION_IRQENTRY .pushsection .irqentry.text, "ax"607607+# define POP_SECTION_IRQENTRY .popsection608608+#else609609+# define PUSH_SECTION_IRQENTRY610610+# define POP_SECTION_IRQENTRY611611+#endif612612+608613.macro apicinterrupt num sym do_sym614614+PUSH_SECTION_IRQENTRY609615apicinterrupt3 \num \sym \do_sym610616trace_apicinterrupt \num \sym617617+POP_SECTION_IRQENTRY611618.endm612619613620#ifdef CONFIG_SMP
···2222#ifdef CONFIG_SMP2323 unsigned int irq_resched_count;2424 unsigned int irq_call_count;2525- /*2626- * irq_tlb_count is double-counted in irq_call_count, so it must be2727- * subtracted from irq_call_count when displaying irq_call_count2828- */2925 unsigned int irq_tlb_count;3026#endif3127#ifdef CONFIG_X86_THERMAL_VECTOR
+2-2
arch/x86/include/asm/init.h
···55 void *(*alloc_pgt_page)(void *); /* allocate buf for page table */66 void *context; /* context for alloc_pgt_page */77 unsigned long pmd_flag; /* page flag for PMD entry */88- bool kernel_mapping; /* kernel mapping or ident mapping */88+ unsigned long offset; /* ident mapping offset */99};10101111int kernel_ident_mapping_init(struct x86_mapping_info *info, pgd_t *pgd_page,1212- unsigned long addr, unsigned long end);1212+ unsigned long pstart, unsigned long pend);13131414#endif /* _ASM_X86_INIT_H */
+2-2
arch/x86/include/asm/pgtable_64.h
···145145 *146146 * | ... | 11| 10| 9|8|7|6|5| 4| 3|2|1|0| <- bit number147147 * | ... |SW3|SW2|SW1|G|L|D|A|CD|WT|U|W|P| <- bit names148148- * | OFFSET (14->63) | TYPE (10-13) |0|X|X|X| X| X|X|X|0| <- swp entry148148+ * | OFFSET (14->63) | TYPE (9-13) |0|X|X|X| X| X|X|X|0| <- swp entry149149 *150150 * G (8) is aliased and used as a PROT_NONE indicator for151151 * !present ptes. We need to start storing swap entries above···156156#define SWP_TYPE_FIRST_BIT (_PAGE_BIT_PROTNONE + 1)157157#define SWP_TYPE_BITS 5158158/* Place the offset above the type: */159159-#define SWP_OFFSET_FIRST_BIT (SWP_TYPE_FIRST_BIT + SWP_TYPE_BITS + 1)159159+#define SWP_OFFSET_FIRST_BIT (SWP_TYPE_FIRST_BIT + SWP_TYPE_BITS)160160161161#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)162162
···176176 return sp;177177}178178179179+/*180180+ * Walks up the stack frames to make sure that the specified object is181181+ * entirely contained by a single stack frame.182182+ *183183+ * Returns:184184+ * 1 if within a frame185185+ * -1 if placed across a frame boundary (or outside stack)186186+ * 0 unable to determine (no frame pointers, etc)187187+ */188188+static inline int arch_within_stack_frames(const void * const stack,189189+ const void * const stackend,190190+ const void *obj, unsigned long len)191191+{192192+#if defined(CONFIG_FRAME_POINTER)193193+ const void *frame = NULL;194194+ const void *oldframe;195195+196196+ oldframe = __builtin_frame_address(1);197197+ if (oldframe)198198+ frame = __builtin_frame_address(2);199199+ /*200200+ * low ----------------------------------------------> high201201+ * [saved bp][saved ip][args][local vars][saved bp][saved ip]202202+ * ^----------------^203203+ * allow copies only within here204204+ */205205+ while (stack <= frame && frame < stackend) {206206+ /*207207+ * If obj + len extends past the last frame, this208208+ * check won't pass and the next frame will be 0,209209+ * causing us to bail out and correctly report210210+ * the copy as invalid.211211+ */212212+ if (obj + len <= frame)213213+ return obj >= oldframe + 2 * sizeof(void *) ? 1 : -1;214214+ oldframe = frame;215215+ frame = *(const void * const *)frame;216216+ }217217+ return -1;218218+#else219219+ return 0;220220+#endif221221+}222222+179223#else /* !__ASSEMBLY__ */180224181225#ifdef CONFIG_X86_64
+7
arch/x86/include/asm/tlbflush.h
···135135136136static inline void __native_flush_tlb(void)137137{138138+ /*139139+ * If current->mm == NULL then we borrow a mm which may change during a140140+ * task switch and therefore we must not be preempted while we write CR3141141+ * back:142142+ */143143+ preempt_disable();138144 native_write_cr3(native_read_cr3());145145+ preempt_enable();139146}140147141148static inline void __native_flush_tlb_global_irq_disabled(void)
+14-12
arch/x86/include/asm/uaccess.h
···761761 * case, and do only runtime checking for non-constant sizes.762762 */763763764764- if (likely(sz < 0 || sz >= n))764764+ if (likely(sz < 0 || sz >= n)) {765765+ check_object_size(to, n, false);765766 n = _copy_from_user(to, from, n);766766- else if(__builtin_constant_p(n))767767+ } else if (__builtin_constant_p(n))767768 copy_from_user_overflow();768769 else769770 __copy_from_user_overflow(sz, n);···782781 might_fault();783782784783 /* See the comment in copy_from_user() above. */785785- if (likely(sz < 0 || sz >= n))784784+ if (likely(sz < 0 || sz >= n)) {785785+ check_object_size(from, n, true);786786 n = _copy_to_user(to, from, n);787787- else if(__builtin_constant_p(n))787787+ } else if (__builtin_constant_p(n))788788 copy_to_user_overflow();789789 else790790 __copy_to_user_overflow(sz, n);···814812#define user_access_begin() __uaccess_begin()815813#define user_access_end() __uaccess_end()816814817817-#define unsafe_put_user(x, ptr) \818818-({ \815815+#define unsafe_put_user(x, ptr, err_label) \816816+do { \819817 int __pu_err; \820818 __put_user_size((x), (ptr), sizeof(*(ptr)), __pu_err, -EFAULT); \821821- __builtin_expect(__pu_err, 0); \822822-})819819+ if (unlikely(__pu_err)) goto err_label; \820820+} while (0)823821824824-#define unsafe_get_user(x, ptr) \825825-({ \822822+#define unsafe_get_user(x, ptr, err_label) \823823+do { \826824 int __gu_err; \827825 unsigned long __gu_val; \828826 __get_user_size(__gu_val, (ptr), sizeof(*(ptr)), __gu_err, -EFAULT); \829827 (x) = (__force __typeof__(*(ptr)))__gu_val; \830830- __builtin_expect(__gu_err, 0); \831831-})828828+ if (unlikely(__gu_err)) goto err_label; \829829+} while (0)832830833831#endif /* _ASM_X86_UACCESS_H */834832
+2
arch/x86/include/asm/uaccess_32.h
···3737static __always_inline unsigned long __must_check3838__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)3939{4040+ check_object_size(from, n, true);4041 return __copy_to_user_ll(to, from, n);4142}4243···9695__copy_from_user(void *to, const void __user *from, unsigned long n)9796{9897 might_fault();9898+ check_object_size(to, n, false);9999 if (__builtin_constant_p(n)) {100100 unsigned long ret;101101
+2
arch/x86/include/asm/uaccess_64.h
···5454{5555 int ret = 0;56565757+ check_object_size(dst, size, false);5758 if (!__builtin_constant_p(size))5859 return copy_user_generic(dst, (__force void *)src, size);5960 switch (size) {···120119{121120 int ret = 0;122121122122+ check_object_size(src, size, true);123123 if (!__builtin_constant_p(size))124124 return copy_user_generic((__force void *)dst, src, size);125125 switch (size) {
+3-2
arch/x86/include/asm/uv/bios.h
···7979 u16 nasid; /* HNasid */8080 u16 sockid; /* Socket ID, high bits of APIC ID */8181 u16 pnode; /* Index to MMR and GRU spaces */8282- u32 pxm; /* ACPI proximity domain number */8282+ u32 unused2;8383 u32 limit; /* PA bits 56:26 (UV_GAM_RANGE_SHFT) */8484};8585···8888#define UV_SYSTAB_VERSION_UV4 0x400 /* UV4 BIOS base version */8989#define UV_SYSTAB_VERSION_UV4_1 0x401 /* + gpa_shift */9090#define UV_SYSTAB_VERSION_UV4_2 0x402 /* + TYPE_NVRAM/WINDOW/MBOX */9191-#define UV_SYSTAB_VERSION_UV4_LATEST UV_SYSTAB_VERSION_UV4_29191+#define UV_SYSTAB_VERSION_UV4_3 0x403 /* - GAM Range PXM Value */9292+#define UV_SYSTAB_VERSION_UV4_LATEST UV_SYSTAB_VERSION_UV4_392939394#define UV_SYSTAB_TYPE_UNUSED 0 /* End of table (offset == 0) */9495#define UV_SYSTAB_TYPE_GAM_PARAMS 1 /* GAM PARAM conversions */
+26-2
arch/x86/kernel/apic/apic.c
···313313314314/* Clock divisor */315315#define APIC_DIVISOR 16316316-#define TSC_DIVISOR 32316316+#define TSC_DIVISOR 8317317318318/*319319 * This function sets up the local APIC timer, with a timeout of···565565 CLOCK_EVT_FEAT_DUMMY);566566 levt->set_next_event = lapic_next_deadline;567567 clockevents_config_and_register(levt,568568- (tsc_khz / TSC_DIVISOR) * 1000,568568+ tsc_khz * (1000 / TSC_DIVISOR),569569 0xF, ~0UL);570570 } else571571 clockevents_register_device(levt);572572+}573573+574574+/*575575+ * Install the updated TSC frequency from recalibration at the TSC576576+ * deadline clockevent devices.577577+ */578578+static void __lapic_update_tsc_freq(void *info)579579+{580580+ struct clock_event_device *levt = this_cpu_ptr(&lapic_events);581581+582582+ if (!this_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER))583583+ return;584584+585585+ clockevents_update_freq(levt, tsc_khz * (1000 / TSC_DIVISOR));586586+}587587+588588+void lapic_update_tsc_freq(void)589589+{590590+ /*591591+ * The clockevent device's ->mult and ->shift can both be592592+ * changed. In order to avoid races, schedule the frequency593593+ * update code on each CPU.594594+ */595595+ on_each_cpu(__lapic_update_tsc_freq, NULL, 0);572596}573597574598/*
+9-4
arch/x86/kernel/apic/x2apic_cluster.c
···155155/*156156 * At CPU state changes, update the x2apic cluster sibling info.157157 */158158-int x2apic_prepare_cpu(unsigned int cpu)158158+static int x2apic_prepare_cpu(unsigned int cpu)159159{160160 if (!zalloc_cpumask_var(&per_cpu(cpus_in_cluster, cpu), GFP_KERNEL))161161 return -ENOMEM;···168168 return 0;169169}170170171171-int x2apic_dead_cpu(unsigned int this_cpu)171171+static int x2apic_dead_cpu(unsigned int this_cpu)172172{173173 int cpu;174174···186186static int x2apic_cluster_probe(void)187187{188188 int cpu = smp_processor_id();189189+ int ret;189190190191 if (!x2apic_mode)191192 return 0;192193194194+ ret = cpuhp_setup_state(CPUHP_X2APIC_PREPARE, "X2APIC_PREPARE",195195+ x2apic_prepare_cpu, x2apic_dead_cpu);196196+ if (ret < 0) {197197+ pr_err("Failed to register X2APIC_PREPARE\n");198198+ return 0;199199+ }193200 cpumask_set_cpu(cpu, per_cpu(cpus_in_cluster, cpu));194194- cpuhp_setup_state(CPUHP_X2APIC_PREPARE, "X2APIC_PREPARE",195195- x2apic_prepare_cpu, x2apic_dead_cpu);196201 return 1;197202}198203
+20-22
arch/x86/kernel/apic/x2apic_uv_x.c
···223223 if (strncmp(oem_id, "SGI", 3) != 0)224224 return 0;225225226226+ if (numa_off) {227227+ pr_err("UV: NUMA is off, disabling UV support\n");228228+ return 0;229229+ }230230+226231 /* Setup early hub type field in uv_hub_info for Node 0 */227232 uv_cpu_info->p_uv_hub_info = &uv_hub_info_node0;228233···330325 struct uv_gam_range_entry *gre = uv_gre_table;331326 struct uv_gam_range_s *grt;332327 unsigned long last_limit = 0, ram_limit = 0;333333- int bytes, i, sid, lsid = -1;328328+ int bytes, i, sid, lsid = -1, indx = 0, lindx = -1;334329335330 if (!gre)336331 return;···361356 }362357 sid = gre->sockid - _min_socket;363358 if (lsid < sid) { /* new range */364364- grt = &_gr_table[sid];365365- grt->base = lsid;359359+ grt = &_gr_table[indx];360360+ grt->base = lindx;366361 grt->nasid = gre->nasid;367362 grt->limit = last_limit = gre->limit;368363 lsid = sid;364364+ lindx = indx++;369365 continue;370366 }371367 if (lsid == sid && !ram_limit) { /* update range */···377371 }378372 if (!ram_limit) { /* non-contiguous ram range */379373 grt++;380380- grt->base = sid - 1;374374+ grt->base = lindx;381375 grt->nasid = gre->nasid;382376 grt->limit = last_limit = gre->limit;383377 continue;···11611155 for (; gre->type != UV_GAM_RANGE_TYPE_UNUSED; gre++) {11621156 if (!index) {11631157 pr_info("UV: GAM Range Table...\n");11641164- pr_info("UV: # %20s %14s %5s %4s %5s %3s %2s %3s\n",11581158+ pr_info("UV: # %20s %14s %5s %4s %5s %3s %2s\n",11651159 "Range", "", "Size", "Type", "NASID",11661166- "SID", "PN", "PXM");11601160+ "SID", "PN");11671161 }11681162 pr_info(11691169- "UV: %2d: 0x%014lx-0x%014lx %5luG %3d %04x %02x %02x %3d\n",11631163+ "UV: %2d: 0x%014lx-0x%014lx %5luG %3d %04x %02x %02x\n",11701164 index++,11711165 (unsigned long)lgre << UV_GAM_RANGE_SHFT,11721166 (unsigned long)gre->limit << UV_GAM_RANGE_SHFT,11731167 ((unsigned long)(gre->limit - lgre)) >>11741168 (30 - UV_GAM_RANGE_SHFT), /* 64M -> 1G */11751175- gre->type, gre->nasid, gre->sockid,11761176- gre->pnode, gre->pxm);11691169+ gre->type, gre->nasid, gre->sockid, gre->pnode);1177117011781171 lgre = gre->limit;11791172 if (sock_min > gre->sockid)···12911286 _pnode_to_socket[i] = SOCK_EMPTY;1292128712931288 /* fill in pnode/node/addr conversion list values */12941294- pr_info("UV: GAM Building socket/pnode/pxm conversion tables\n");12891289+ pr_info("UV: GAM Building socket/pnode conversion tables\n");12951290 for (; gre->type != UV_GAM_RANGE_TYPE_UNUSED; gre++) {12961291 if (gre->type == UV_GAM_RANGE_TYPE_HOLE)12971292 continue;···12991294 if (_socket_to_pnode[i] != SOCK_EMPTY)13001295 continue; /* duplicate */13011296 _socket_to_pnode[i] = gre->pnode;13021302- _socket_to_node[i] = gre->pxm;1303129713041298 i = gre->pnode - minpnode;13051299 _pnode_to_socket[i] = gre->sockid;1306130013071301 pr_info(13081308- "UV: sid:%02x type:%d nasid:%04x pn:%02x pxm:%2d pn2s:%2x\n",13021302+ "UV: sid:%02x type:%d nasid:%04x pn:%02x pn2s:%2x\n",13091303 gre->sockid, gre->type, gre->nasid,13101304 _socket_to_pnode[gre->sockid - minsock],13111311- _socket_to_node[gre->sockid - minsock],13121305 _pnode_to_socket[gre->pnode - minpnode]);13131306 }1314130713151315- /* check socket -> node values */13081308+ /* Set socket -> node values */13161309 lnid = -1;13171310 for_each_present_cpu(cpu) {13181311 int nid = cpu_to_node(cpu);···13211318 lnid = nid;13221319 apicid = per_cpu(x86_cpu_to_apicid, cpu);13231320 sockid = apicid >> uv_cpuid.socketid_shift;13241324- i = sockid - minsock;13251325-13261326- if (nid != _socket_to_node[i]) {13271327- pr_warn(13281328- "UV: %02x: type:%d socket:%02x PXM:%02x != node:%2d\n",13291329- i, sockid, gre->type, _socket_to_node[i], nid);13301330- _socket_to_node[i] = nid;13311331- }13211321+ _socket_to_node[sockid - minsock] = nid;13221322+ pr_info("UV: sid:%02x: apicid:%04x node:%2d\n",13231323+ sockid, apicid, nid);13321324 }1333132513341326 /* Setup physical blade to pnode translation from GAM Range Table */
+17-121
arch/x86/kernel/fpu/xstate.c
···866866 return get_xsave_addr(&fpu->state.xsave, xsave_state);867867}868868869869-870870-/*871871- * Set xfeatures (aka XSTATE_BV) bit for a feature that we want872872- * to take out of its "init state". This will ensure that an873873- * XRSTOR actually restores the state.874874- */875875-static void fpu__xfeature_set_non_init(struct xregs_state *xsave,876876- int xstate_feature_mask)877877-{878878- xsave->header.xfeatures |= xstate_feature_mask;879879-}880880-881881-/*882882- * This function is safe to call whether the FPU is in use or not.883883- *884884- * Note that this only works on the current task.885885- *886886- * Inputs:887887- * @xsave_state: state which is defined in xsave.h (e.g. XFEATURE_MASK_FP,888888- * XFEATURE_MASK_SSE, etc...)889889- * @xsave_state_ptr: a pointer to a copy of the state that you would890890- * like written in to the current task's FPU xsave state. This pointer891891- * must not be located in the current tasks's xsave area.892892- * Output:893893- * address of the state in the xsave area or NULL if the state894894- * is not present or is in its 'init state'.895895- */896896-static void fpu__xfeature_set_state(int xstate_feature_mask,897897- void *xstate_feature_src, size_t len)898898-{899899- struct xregs_state *xsave = ¤t->thread.fpu.state.xsave;900900- struct fpu *fpu = ¤t->thread.fpu;901901- void *dst;902902-903903- if (!boot_cpu_has(X86_FEATURE_XSAVE)) {904904- WARN_ONCE(1, "%s() attempted with no xsave support", __func__);905905- return;906906- }907907-908908- /*909909- * Tell the FPU code that we need the FPU state to be in910910- * 'fpu' (not in the registers), and that we need it to911911- * be stable while we write to it.912912- */913913- fpu__current_fpstate_write_begin();914914-915915- /*916916- * This method *WILL* *NOT* work for compact-format917917- * buffers. If the 'xstate_feature_mask' is unset in918918- * xcomp_bv then we may need to move other feature state919919- * "up" in the buffer.920920- */921921- if (xsave->header.xcomp_bv & xstate_feature_mask) {922922- WARN_ON_ONCE(1);923923- goto out;924924- }925925-926926- /* find the location in the xsave buffer of the desired state */927927- dst = __raw_xsave_addr(&fpu->state.xsave, xstate_feature_mask);928928-929929- /*930930- * Make sure that the pointer being passed in did not931931- * come from the xsave buffer itself.932932- */933933- WARN_ONCE(xstate_feature_src == dst, "set from xsave buffer itself");934934-935935- /* put the caller-provided data in the location */936936- memcpy(dst, xstate_feature_src, len);937937-938938- /*939939- * Mark the xfeature so that the CPU knows there is state940940- * in the buffer now.941941- */942942- fpu__xfeature_set_non_init(xsave, xstate_feature_mask);943943-out:944944- /*945945- * We are done writing to the 'fpu'. Reenable preeption946946- * and (possibly) move the fpstate back in to the fpregs.947947- */948948- fpu__current_fpstate_write_end();949949-}950950-951869#define NR_VALID_PKRU_BITS (CONFIG_NR_PROTECTION_KEYS * 2)952870#define PKRU_VALID_MASK (NR_VALID_PKRU_BITS - 1)953871954872/*955955- * This will go out and modify the XSAVE buffer so that PKRU is956956- * set to a particular state for access to 'pkey'.957957- *958958- * PKRU state does affect kernel access to user memory. We do959959- * not modfiy PKRU *itself* here, only the XSAVE state that will960960- * be restored in to PKRU when we return back to userspace.873873+ * This will go out and modify PKRU register to set the access874874+ * rights for @pkey to @init_val.961875 */962876int arch_set_user_pkey_access(struct task_struct *tsk, int pkey,963877 unsigned long init_val)964878{965965- struct xregs_state *xsave = &tsk->thread.fpu.state.xsave;966966- struct pkru_state *old_pkru_state;967967- struct pkru_state new_pkru_state;879879+ u32 old_pkru;968880 int pkey_shift = (pkey * PKRU_BITS_PER_PKEY);969881 u32 new_pkru_bits = 0;970882···886974 */887975 if (!boot_cpu_has(X86_FEATURE_OSPKE))888976 return -EINVAL;977977+ /*978978+ * For most XSAVE components, this would be an arduous task:979979+ * brining fpstate up to date with fpregs, updating fpstate,980980+ * then re-populating fpregs. But, for components that are981981+ * never lazily managed, we can just access the fpregs982982+ * directly. PKRU is never managed lazily, so we can just983983+ * manipulate it directly. Make sure it stays that way.984984+ */985985+ WARN_ON_ONCE(!use_eager_fpu());889986890987 /* Set the bits we need in PKRU: */891988 if (init_val & PKEY_DISABLE_ACCESS)···905984 /* Shift the bits in to the correct place in PKRU for pkey: */906985 new_pkru_bits <<= pkey_shift;907986908908- /* Locate old copy of the state in the xsave buffer: */909909- old_pkru_state = get_xsave_addr(xsave, XFEATURE_MASK_PKRU);987987+ /* Get old PKRU and mask off any old bits in place: */988988+ old_pkru = read_pkru();989989+ old_pkru &= ~((PKRU_AD_BIT|PKRU_WD_BIT) << pkey_shift);910990911911- /*912912- * When state is not in the buffer, it is in the init913913- * state, set it manually. Otherwise, copy out the old914914- * state.915915- */916916- if (!old_pkru_state)917917- new_pkru_state.pkru = 0;918918- else919919- new_pkru_state.pkru = old_pkru_state->pkru;920920-921921- /* Mask off any old bits in place: */922922- new_pkru_state.pkru &= ~((PKRU_AD_BIT|PKRU_WD_BIT) << pkey_shift);923923-924924- /* Set the newly-requested bits: */925925- new_pkru_state.pkru |= new_pkru_bits;926926-927927- /*928928- * We could theoretically live without zeroing pkru.pad.929929- * The current XSAVE feature state definition says that930930- * only bytes 0->3 are used. But we do not want to931931- * chance leaking kernel stack out to userspace in case a932932- * memcpy() of the whole xsave buffer was done.933933- *934934- * They're in the same cacheline anyway.935935- */936936- new_pkru_state.pad = 0;937937-938938- fpu__xfeature_set_state(XFEATURE_MASK_PKRU, &new_pkru_state, sizeof(new_pkru_state));991991+ /* Write old part along with new part: */992992+ write_pkru(old_pkru | new_pkru_bits);939993940994 return 0;941995}
···936936937937 x86_init.oem.arch_setup();938938939939- kernel_randomize_memory();940940-941939 iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;942940 setup_memory_map();943941 parse_setup_data();···1053105510541056 max_possible_pfn = max_pfn;1055105710581058+ /*10591059+ * Define random base addresses for memory sections after max_pfn is10601060+ * defined and before each memory section base is used.10611061+ */10621062+ kernel_randomize_memory();10631063+10561064#ifdef CONFIG_X86_3210571065 /* max_low_pfn get updated here */10581066 find_low_pfn_range();···11011097 efi_find_mirror();11021098 }1103109911001100+ reserve_bios_regions();11011101+11041102 /*11051103 * The EFI specification says that boot service code won't be called11061104 * after ExitBootServices(). This is, in fact, a lie.···1131112511321126 early_trap_pf_init();1133112711341134- setup_real_mode();11281128+ /*11291129+ * Update mmu_cr4_features (and, indirectly, trampoline_cr4_features)11301130+ * with the current CR4 value. This may not be necessary, but11311131+ * auditing all the early-boot CR4 manipulation would be needed to11321132+ * rule it out.11331133+ */11341134+ if (boot_cpu_data.cpuid_level >= 0)11351135+ /* A CPU has %cr4 if and only if it has CPUID. */11361136+ mmu_cr4_features = __read_cr4();1135113711361138 memblock_set_current_limit(get_max_mapped());11371139···11871173 x86_init.paging.pagetable_init();1188117411891175 kasan_init();11901190-11911191- if (boot_cpu_data.cpuid_level >= 0) {11921192- /* A CPU has %cr4 if and only if it has CPUID */11931193- mmu_cr4_features = __read_cr4();11941194- if (trampoline_cr4_features)11951195- *trampoline_cr4_features = mmu_cr4_features;11961196- }1197117611981177#ifdef CONFIG_X86_3211991178 /* sync back kernel address range */
+4
arch/x86/kernel/tsc.c
···2222#include <asm/nmi.h>2323#include <asm/x86_init.h>2424#include <asm/geode.h>2525+#include <asm/apic.h>25262627unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */2728EXPORT_SYMBOL(cpu_khz);···12491248 pr_info("Refined TSC clocksource calibration: %lu.%03lu MHz\n",12501249 (unsigned long)tsc_khz / 1000,12511250 (unsigned long)tsc_khz % 1000);12511251+12521252+ /* Inform the TSC deadline clockevent devices about the recalibration */12531253+ lapic_update_tsc_freq();1252125412531255out:12541256 if (boot_cpu_has(X86_FEATURE_ART))
+11-11
arch/x86/kernel/uprobes.c
···357357 *cursor &= 0xfe;358358 }359359 /*360360- * Similar treatment for VEX3 prefix.361361- * TODO: add XOP/EVEX treatment when insn decoder supports them360360+ * Similar treatment for VEX3/EVEX prefix.361361+ * TODO: add XOP treatment when insn decoder supports them362362 */363363- if (insn->vex_prefix.nbytes == 3) {363363+ if (insn->vex_prefix.nbytes >= 3) {364364 /*365365 * vex2: c5 rvvvvLpp (has no b bit)366366 * vex3/xop: c4/8f rxbmmmmm wvvvvLpp367367 * evex: 62 rxbR00mm wvvvv1pp zllBVaaa368368- * (evex will need setting of both b and x since369369- * in non-sib encoding evex.x is 4th bit of MODRM.rm)370370- * Setting VEX3.b (setting because it has inverted meaning):368368+ * Setting VEX3.b (setting because it has inverted meaning).369369+ * Setting EVEX.x since (in non-SIB encoding) EVEX.x370370+ * is the 4th bit of MODRM.rm, and needs the same treatment.371371+ * For VEX3-encoded insns, VEX3.x value has no effect in372372+ * non-SIB encoding, the change is superfluous but harmless.371373 */372374 cursor = auprobe->insn + insn_offset_vex_prefix(insn) + 1;373373- *cursor |= 0x20;375375+ *cursor |= 0x60;374376 }375377376378 /*···417415418416 reg = MODRM_REG(insn); /* Fetch modrm.reg */419417 reg2 = 0xff; /* Fetch vex.vvvv */420420- if (insn->vex_prefix.nbytes == 2)421421- reg2 = insn->vex_prefix.bytes[1];422422- else if (insn->vex_prefix.nbytes == 3)418418+ if (insn->vex_prefix.nbytes)423419 reg2 = insn->vex_prefix.bytes[2];424420 /*425425- * TODO: add XOP, EXEV vvvv reading.421421+ * TODO: add XOP vvvv reading.426422 *427423 * vex.vvvv field is in bits 6-3, bits are inverted.428424 * But in 32-bit mode, high-order bit may be ignored.
+2
arch/x86/lib/hweight.S
···35353636ENTRY(__sw_hweight64)3737#ifdef CONFIG_X86_643838+ pushq %rdi3839 pushq %rdx39404041 movq %rdi, %rdx # w -> t···6160 shrq $56, %rax # w = w_tmp >> 5662616362 popq %rdx6363+ popq %rdi6464 ret6565#else /* CONFIG_X86_32 */6666 /* We're getting an u64 arg in (%eax,%edx): unsigned long hweight64(__u64 w) */
···33 * included by both the compressed kernel and the regular kernel.44 */5566-static void ident_pmd_init(unsigned long pmd_flag, pmd_t *pmd_page,66+static void ident_pmd_init(struct x86_mapping_info *info, pmd_t *pmd_page,77 unsigned long addr, unsigned long end)88{99 addr &= PMD_MASK;1010 for (; addr < end; addr += PMD_SIZE) {1111 pmd_t *pmd = pmd_page + pmd_index(addr);12121313- if (!pmd_present(*pmd))1414- set_pmd(pmd, __pmd(addr | pmd_flag));1313+ if (pmd_present(*pmd))1414+ continue;1515+1616+ set_pmd(pmd, __pmd((addr - info->offset) | info->pmd_flag));1517 }1618}1719···32303331 if (pud_present(*pud)) {3432 pmd = pmd_offset(pud, 0);3535- ident_pmd_init(info->pmd_flag, pmd, addr, next);3333+ ident_pmd_init(info, pmd, addr, next);3634 continue;3735 }3836 pmd = (pmd_t *)info->alloc_pgt_page(info->context);3937 if (!pmd)4038 return -ENOMEM;4141- ident_pmd_init(info->pmd_flag, pmd, addr, next);3939+ ident_pmd_init(info, pmd, addr, next);4240 set_pud(pud, __pud(__pa(pmd) | _KERNPG_TABLE));4341 }4442···4644}47454846int kernel_ident_mapping_init(struct x86_mapping_info *info, pgd_t *pgd_page,4949- unsigned long addr, unsigned long end)4747+ unsigned long pstart, unsigned long pend)5048{4949+ unsigned long addr = pstart + info->offset;5050+ unsigned long end = pend + info->offset;5151 unsigned long next;5252 int result;5353- int off = info->kernel_mapping ? pgd_index(__PAGE_OFFSET) : 0;54535554 for (; addr < end; addr = next) {5656- pgd_t *pgd = pgd_page + pgd_index(addr) + off;5555+ pgd_t *pgd = pgd_page + pgd_index(addr);5756 pud_t *pud;58575958 next = (addr & PGDIR_MASK) + PGDIR_SIZE;
+12-2
arch/x86/mm/init.c
···122122 return __va(pfn << PAGE_SHIFT);123123}124124125125-/* need 3 4k for initial PMD_SIZE, 3 4k for 0-ISA_END_ADDRESS */126126-#define INIT_PGT_BUF_SIZE (6 * PAGE_SIZE)125125+/*126126+ * By default need 3 4k for initial PMD_SIZE, 3 4k for 0-ISA_END_ADDRESS.127127+ * With KASLR memory randomization, depending on the machine e820 memory128128+ * and the PUD alignment. We may need twice more pages when KASLR memory129129+ * randomization is enabled.130130+ */131131+#ifndef CONFIG_RANDOMIZE_MEMORY132132+#define INIT_PGD_PAGE_COUNT 6133133+#else134134+#define INIT_PGD_PAGE_COUNT 12135135+#endif136136+#define INIT_PGT_BUF_SIZE (INIT_PGD_PAGE_COUNT * PAGE_SIZE)127137RESERVE_BRK(early_pgt_alloc, INIT_PGT_BUF_SIZE);128138void __init early_alloc_pgt_buf(void)129139{
+1-1
arch/x86/mm/kaslr.c
···9797 * add padding if needed (especially for memory hotplug support).9898 */9999 BUG_ON(kaslr_regions[0].base != &page_offset_base);100100- memory_tb = ((max_pfn << PAGE_SHIFT) >> TB_SHIFT) +100100+ memory_tb = DIV_ROUND_UP(max_pfn << PAGE_SHIFT, 1UL << TB_SHIFT) +101101 CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING;102102103103 /* Adapt phyiscal memory region size based on available memory */
+21
arch/x86/platform/efi/quirks.c
···254254 for_each_efi_memory_desc(md) {255255 unsigned long long start = md->phys_addr;256256 unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;257257+ size_t rm_size;257258258259 if (md->type != EFI_BOOT_SERVICES_CODE &&259260 md->type != EFI_BOOT_SERVICES_DATA)···263262 /* Do not free, someone else owns it: */264263 if (md->attribute & EFI_MEMORY_RUNTIME)265264 continue;265265+266266+ /*267267+ * Nasty quirk: if all sub-1MB memory is used for boot268268+ * services, we can get here without having allocated the269269+ * real mode trampoline. It's too late to hand boot services270270+ * memory back to the memblock allocator, so instead271271+ * try to manually allocate the trampoline if needed.272272+ *273273+ * I've seen this on a Dell XPS 13 9350 with firmware274274+ * 1.4.4 with SGX enabled booting Linux via Fedora 24's275275+ * grub2-efi on a hard disk. (And no, I don't know why276276+ * this happened, but Linux should still try to boot rather277277+ * panicing early.)278278+ */279279+ rm_size = real_mode_size_needed();280280+ if (rm_size && (start + rm_size) < (1<<20) && size >= rm_size) {281281+ set_real_mode_mem(start, rm_size);282282+ start += rm_size;283283+ size -= rm_size;284284+ }266285267286 free_bootmem_late(start, size);268287 }
+7-4
arch/x86/platform/uv/bios_uv.c
···187187void uv_bios_init(void)188188{189189 uv_systab = NULL;190190- if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab) {190190+ if ((efi.uv_systab == EFI_INVALID_TABLE_ADDR) ||191191+ !efi.uv_systab || efi_runtime_disabled()) {191192 pr_crit("UV: UVsystab: missing\n");192193 return;193194 }···200199 return;201200 }202201202202+ /* Starting with UV4 the UV systab size is variable */203203 if (uv_systab->revision >= UV_SYSTAB_VERSION_UV4) {204204+ int size = uv_systab->size;205205+204206 iounmap(uv_systab);205205- uv_systab = ioremap(efi.uv_systab, uv_systab->size);207207+ uv_systab = ioremap(efi.uv_systab, size);206208 if (!uv_systab) {207207- pr_err("UV: UVsystab: ioremap(%d) failed!\n",208208- uv_systab->size);209209+ pr_err("UV: UVsystab: ioremap(%d) failed!\n", size);209210 return;210211 }211212 }
···39503950 bool need_put = !!rbd_dev->opts;3951395139523952 ceph_oid_destroy(&rbd_dev->header_oid);39533953+ ceph_oloc_destroy(&rbd_dev->header_oloc);3953395439543955 rbd_put_client(rbd_dev->rbd_client);39553956 rbd_spec_put(rbd_dev->spec);···53365335 goto err_out_client;53375336 }53385337 spec->pool_id = (u64)rc;53395339-53405340- /* The ceph file layout needs to fit pool id in 32 bits */53415341-53425342- if (spec->pool_id > (u64)U32_MAX) {53435343- rbd_warn(NULL, "pool id too large (%llu > %u)",53445344- (unsigned long long)spec->pool_id, U32_MAX);53455345- rc = -EIO;53465346- goto err_out_client;53475347- }5348533853495339 rbd_dev = rbd_dev_create(rbdc, spec, rbd_opts);53505340 if (!rbd_dev) {
+9-19
drivers/block/virtio_blk.c
···391391 num_vqs = 1;392392393393 vblk->vqs = kmalloc(sizeof(*vblk->vqs) * num_vqs, GFP_KERNEL);394394- if (!vblk->vqs) {394394+ if (!vblk->vqs)395395+ return -ENOMEM;396396+397397+ names = kmalloc(sizeof(*names) * num_vqs, GFP_KERNEL);398398+ callbacks = kmalloc(sizeof(*callbacks) * num_vqs, GFP_KERNEL);399399+ vqs = kmalloc(sizeof(*vqs) * num_vqs, GFP_KERNEL);400400+ if (!names || !callbacks || !vqs) {395401 err = -ENOMEM;396402 goto out;397403 }398398-399399- names = kmalloc(sizeof(*names) * num_vqs, GFP_KERNEL);400400- if (!names)401401- goto err_names;402402-403403- callbacks = kmalloc(sizeof(*callbacks) * num_vqs, GFP_KERNEL);404404- if (!callbacks)405405- goto err_callbacks;406406-407407- vqs = kmalloc(sizeof(*vqs) * num_vqs, GFP_KERNEL);408408- if (!vqs)409409- goto err_vqs;410404411405 for (i = 0; i < num_vqs; i++) {412406 callbacks[i] = virtblk_done;···411417 /* Discover virtqueues and write information to configuration. */412418 err = vdev->config->find_vqs(vdev, num_vqs, vqs, callbacks, names);413419 if (err)414414- goto err_find_vqs;420420+ goto out;415421416422 for (i = 0; i < num_vqs; i++) {417423 spin_lock_init(&vblk->vqs[i].lock);···419425 }420426 vblk->num_vqs = num_vqs;421427422422- err_find_vqs:428428+out:423429 kfree(vqs);424424- err_vqs:425430 kfree(callbacks);426426- err_callbacks:427431 kfree(names);428428- err_names:429432 if (err)430433 kfree(vblk->vqs);431431- out:432434 return err;433435}434436
+23-3
drivers/clocksource/arm_arch_timer.c
···88 * it under the terms of the GNU General Public License version 2 as99 * published by the Free Software Foundation.1010 */1111+1212+#define pr_fmt(fmt) "arm_arch_timer: " fmt1313+1114#include <linux/init.h>1215#include <linux/kernel.h>1316#include <linux/device.h>···373370 arch_timer_ppi[PHYS_NONSECURE_PPI]);374371}375372373373+static u32 check_ppi_trigger(int irq)374374+{375375+ u32 flags = irq_get_trigger_type(irq);376376+377377+ if (flags != IRQF_TRIGGER_HIGH && flags != IRQF_TRIGGER_LOW) {378378+ pr_warn("WARNING: Invalid trigger for IRQ%d, assuming level low\n", irq);379379+ pr_warn("WARNING: Please fix your firmware\n");380380+ flags = IRQF_TRIGGER_LOW;381381+ }382382+383383+ return flags;384384+}385385+376386static int arch_timer_starting_cpu(unsigned int cpu)377387{378388 struct clock_event_device *clk = this_cpu_ptr(arch_timer_evt);389389+ u32 flags;379390380391 __arch_timer_setup(ARCH_CP15_TIMER, clk);381392382382- enable_percpu_irq(arch_timer_ppi[arch_timer_uses_ppi], 0);393393+ flags = check_ppi_trigger(arch_timer_ppi[arch_timer_uses_ppi]);394394+ enable_percpu_irq(arch_timer_ppi[arch_timer_uses_ppi], flags);383395384384- if (arch_timer_has_nonsecure_ppi())385385- enable_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI], 0);396396+ if (arch_timer_has_nonsecure_ppi()) {397397+ flags = check_ppi_trigger(arch_timer_ppi[PHYS_NONSECURE_PPI]);398398+ enable_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI], flags);399399+ }386400387401 arch_counter_set_user_access();388402 if (evtstrm_enable)
+20-1
drivers/cpufreq/powernv-cpufreq.c
···145145/* Use following macros for conversions between pstate_id and index */146146static inline int idx_to_pstate(unsigned int i)147147{148148+ if (unlikely(i >= powernv_pstate_info.nr_pstates)) {149149+ pr_warn_once("index %u is out of bound\n", i);150150+ return powernv_freqs[powernv_pstate_info.nominal].driver_data;151151+ }152152+148153 return powernv_freqs[i].driver_data;149154}150155151156static inline unsigned int pstate_to_idx(int pstate)152157{158158+ int min = powernv_freqs[powernv_pstate_info.min].driver_data;159159+ int max = powernv_freqs[powernv_pstate_info.max].driver_data;160160+161161+ if (min > 0) {162162+ if (unlikely((pstate < max) || (pstate > min))) {163163+ pr_warn_once("pstate %d is out of bound\n", pstate);164164+ return powernv_pstate_info.nominal;165165+ }166166+ } else {167167+ if (unlikely((pstate > max) || (pstate < min))) {168168+ pr_warn_once("pstate %d is out of bound\n", pstate);169169+ return powernv_pstate_info.nominal;170170+ }171171+ }153172 /*154173 * abs() is deliberately used so that is works with155174 * both monotonically increasing and decreasing···612593 } else {613594 gpstate_idx = calc_global_pstate(gpstates->elapsed_time,614595 gpstates->highest_lpstate_idx,615615- freq_data.pstate_id);596596+ gpstates->last_lpstate_idx);616597 }617598618599 /*
···190190 * map the capsule described by @capsule with its data in @pages and191191 * send it to the firmware via the UpdateCapsule() runtime service.192192 *193193- * @capsule must be a virtual mapping of the first page in @pages194194- * (@pages[0]) in the kernel address space. That is, a195195- * capsule_header_t that describes the entire contents of the capsule193193+ * @capsule must be a virtual mapping of the complete capsule update in the194194+ * kernel address space, as the capsule can be consumed immediately.195195+ * A capsule_header_t that describes the entire contents of the capsule196196 * must be at the start of the first data page.197197 *198198 * Even though this function will validate that the firmware supports
+10
drivers/gpio/Kconfig
···874874 LP3943 can be used as a GPIO expander which provides up to 16 GPIOs.875875 Open drain outputs are required for this usage.876876877877+config GPIO_LP873X878878+ tristate "TI LP873X GPO"879879+ depends on MFD_TI_LP873X880880+ help881881+ This driver supports the GPO on TI Lp873x PMICs. 2 GPOs are present882882+ on LP873X PMICs.883883+884884+ This driver can also be built as a module. If so, the module will be885885+ called gpio-lp873x.886886+877887config GPIO_MAX77620878888 tristate "GPIO support for PMIC MAX77620 and MAX20024"879889 depends on MFD_MAX77620
···185185 goto out;186186 }187187188188+ /*189189+ * cirrus_modeset_init() is initializing/registering the emulated fbdev190190+ * and DRM internals can access/test some of the fields in191191+ * mode_config->funcs as part of the fbdev registration process.192192+ * Make sure dev->mode_config.funcs is properly set to avoid193193+ * dereferencing a NULL pointer.194194+ * FIXME: mode_config.funcs assignment should probably be done in195195+ * cirrus_modeset_init() (that's a common pattern seen in other DRM196196+ * drivers).197197+ */198198+ dev->mode_config.funcs = &cirrus_mode_funcs;188199 r = cirrus_modeset_init(cdev);189200 if (r) {190201 dev_err(&dev->pdev->dev, "Fatal error during modeset init: %d\n", r);191202 goto out;192203 }193193-194194- dev->mode_config.funcs = (void *)&cirrus_mode_funcs;195204196205 return 0;197206out:
+3-5
drivers/gpu/drm/drm_crtc.c
···11211121 struct drm_connector *connector;11221122 int ret;1123112311241124- mutex_lock(&dev->mode_config.mutex);11251125-11261126- drm_for_each_connector(connector, dev) {11241124+ /* FIXME: taking the mode config mutex ends up in a clash with11251125+ * fbcon/backlight registration */11261126+ list_for_each_entry(connector, &dev->mode_config.connector_list, head) {11271127 ret = drm_connector_register(connector);11281128 if (ret)11291129 goto err;11301130 }11311131-11321132- mutex_unlock(&dev->mode_config.mutex);1133113111341132 return 0;11351133
+22
drivers/gpu/drm/drm_edid.c
···7474#define EDID_QUIRK_FORCE_8BPC (1 << 8)7575/* Force 12bpc */7676#define EDID_QUIRK_FORCE_12BPC (1 << 9)7777+/* Force 6bpc */7878+#define EDID_QUIRK_FORCE_6BPC (1 << 10)77797880struct detailed_mode_closure {7981 struct drm_connector *connector;···10199 { "API", 0x7602, EDID_QUIRK_PREFER_LARGE_60 },102100 /* Unknown Acer */103101 { "ACR", 2423, EDID_QUIRK_FIRST_DETAILED_PREFERRED },102102+103103+ /* AEO model 0 reports 8 bpc, but is a 6 bpc panel */104104+ { "AEO", 0, EDID_QUIRK_FORCE_6BPC },104105105106 /* Belinea 10 15 55 */106107 { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 },···38673862 /* HDMI deep color modes supported? Assign to info, if so */38683863 drm_assign_hdmi_deep_color_info(edid, info, connector);3869386438653865+ /*38663866+ * Digital sink with "DFP 1.x compliant TMDS" according to EDID 1.3?38673867+ *38683868+ * For such displays, the DFP spec 1.0, section 3.10 "EDID support"38693869+ * tells us to assume 8 bpc color depth if the EDID doesn't have38703870+ * extensions which tell otherwise.38713871+ */38723872+ if ((info->bpc == 0) && (edid->revision < 4) &&38733873+ (edid->input & DRM_EDID_DIGITAL_TYPE_DVI)) {38743874+ info->bpc = 8;38753875+ DRM_DEBUG("%s: Assigning DFP sink color depth as %d bpc.\n",38763876+ connector->name, info->bpc);38773877+ }38783878+38703879 /* Only defined for 1.4 with digital displays */38713880 if (edid->revision < 4)38723881 return;···41004081 edid_fixup_preferred(connector, quirks);4101408241024083 drm_add_display_info(edid, &connector->display_info, connector);40844084+40854085+ if (quirks & EDID_QUIRK_FORCE_6BPC)40864086+ connector->display_info.bpc = 6;4103408741044088 if (quirks & EDID_QUIRK_FORCE_8BPC)41054089 connector->display_info.bpc = 8;
+6-24
drivers/gpu/drm/i915/intel_display.c
···5691569156925692static bool skl_cdclk_wait_for_pcu_ready(struct drm_i915_private *dev_priv)56935693{56945694- unsigned int i;56955695-56965696- for (i = 0; i < 15; i++) {56975697- if (skl_cdclk_pcu_ready(dev_priv))56985698- return true;56995699- udelay(10);57005700- }57015701-57025702- return false;56945694+ return _wait_for(skl_cdclk_pcu_ready(dev_priv), 3000, 10) == 0;57035695}5704569657055697static void skl_set_cdclk(struct drm_i915_private *dev_priv, int cdclk, int vco)···1210612114 pipe_config->pipe_bpp = connector->base.display_info.bpc*3;1210712115 }12108121161210912109- /* Clamp bpp to default limit on screens without EDID 1.4 */1211012110- if (connector->base.display_info.bpc == 0) {1211112111- int type = connector->base.connector_type;1211212112- int clamp_bpp = 24;1211312113-1211412114- /* Fall back to 18 bpp when DP sink capability is unknown. */1211512115- if (type == DRM_MODE_CONNECTOR_DisplayPort ||1211612116- type == DRM_MODE_CONNECTOR_eDP)1211712117- clamp_bpp = 18;1211812118-1211912119- if (bpp > clamp_bpp) {1212012120- DRM_DEBUG_KMS("clamping display bpp (was %d) to default limit of %d\n",1212112121- bpp, clamp_bpp);1212212122- pipe_config->pipe_bpp = clamp_bpp;1212312123- }1211712117+ /* Clamp bpp to 8 on screens without EDID 1.4 */1211812118+ if (connector->base.display_info.bpc == 0 && bpp > 24) {1211912119+ DRM_DEBUG_KMS("clamping display bpp (was %d) to default limit of 24\n",1212012120+ bpp);1212112121+ pipe_config->pipe_bpp = 24;1212412122 }1212512123}1212612124
+11-14
drivers/gpu/drm/i915/intel_fbdev.c
···782782 struct intel_fbdev *ifbdev = dev_priv->fbdev;783783 struct fb_info *info;784784785785- if (!ifbdev)785785+ if (!ifbdev || !ifbdev->fb)786786 return;787787788788 info = ifbdev->helper.fbdev;···827827828828void intel_fbdev_output_poll_changed(struct drm_device *dev)829829{830830- struct drm_i915_private *dev_priv = to_i915(dev);831831- if (dev_priv->fbdev)832832- drm_fb_helper_hotplug_event(&dev_priv->fbdev->helper);830830+ struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;831831+832832+ if (ifbdev && ifbdev->fb)833833+ drm_fb_helper_hotplug_event(&ifbdev->helper);833834}834835835836void intel_fbdev_restore_mode(struct drm_device *dev)836837{837837- int ret;838838- struct drm_i915_private *dev_priv = to_i915(dev);839839- struct intel_fbdev *ifbdev = dev_priv->fbdev;840840- struct drm_fb_helper *fb_helper;838838+ struct intel_fbdev *ifbdev = to_i915(dev)->fbdev;841839842840 if (!ifbdev)843841 return;844842845843 intel_fbdev_sync(ifbdev);844844+ if (!ifbdev->fb)845845+ return;846846847847- fb_helper = &ifbdev->helper;848848-849849- ret = drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper);850850- if (ret) {847847+ if (drm_fb_helper_restore_fbdev_mode_unlocked(&ifbdev->helper)) {851848 DRM_DEBUG("failed to restore crtc mode\n");852849 } else {853853- mutex_lock(&fb_helper->dev->struct_mutex);850850+ mutex_lock(&dev->struct_mutex);854851 intel_fb_obj_invalidate(ifbdev->fb->obj, ORIGIN_GTT);855855- mutex_unlock(&fb_helper->dev->struct_mutex);852852+ mutex_unlock(&dev->struct_mutex);856853 }857854}
···11511151 if (ret)11521152 goto out;1153115311541154- ret = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem);11541154+ ret = ttm_bo_move_ttm(bo, true, intr, no_wait_gpu, new_mem);11551155out:11561156 ttm_bo_mem_put(bo, &tmp_mem);11571157 return ret;···11791179 if (ret)11801180 return ret;1181118111821182- ret = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem);11821182+ ret = ttm_bo_move_ttm(bo, true, intr, no_wait_gpu, &tmp_mem);11831183 if (ret)11841184 goto out;11851185
+2-2
drivers/gpu/drm/radeon/radeon_ttm.c
···346346 if (unlikely(r)) {347347 goto out_cleanup;348348 }349349- r = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem);349349+ r = ttm_bo_move_ttm(bo, true, interruptible, no_wait_gpu, new_mem);350350out_cleanup:351351 ttm_bo_mem_put(bo, &tmp_mem);352352 return r;···379379 if (unlikely(r)) {380380 return r;381381 }382382- r = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem);382382+ r = ttm_bo_move_ttm(bo, true, interruptible, no_wait_gpu, &tmp_mem);383383 if (unlikely(r)) {384384 goto out_cleanup;385385 }
+1
drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c
···125125126126 /* Link drm_bridge to encoder */127127 bridge->encoder = encoder;128128+ encoder->bridge = bridge;128129129130 ret = drm_bridge_attach(rcdu->ddev, bridge);130131 if (ret) {
+2-1
drivers/gpu/drm/ttm/ttm_bo.c
···354354355355 if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) &&356356 !(new_man->flags & TTM_MEMTYPE_FLAG_FIXED))357357- ret = ttm_bo_move_ttm(bo, evict, no_wait_gpu, mem);357357+ ret = ttm_bo_move_ttm(bo, evict, interruptible, no_wait_gpu,358358+ mem);358359 else if (bdev->driver->move)359360 ret = bdev->driver->move(bo, evict, interruptible,360361 no_wait_gpu, mem);
+9-1
drivers/gpu/drm/ttm/ttm_bo_util.c
···4545}46464747int ttm_bo_move_ttm(struct ttm_buffer_object *bo,4848- bool evict,4848+ bool evict, bool interruptible,4949 bool no_wait_gpu, struct ttm_mem_reg *new_mem)5050{5151 struct ttm_tt *ttm = bo->ttm;···5353 int ret;54545555 if (old_mem->mem_type != TTM_PL_SYSTEM) {5656+ ret = ttm_bo_wait(bo, interruptible, no_wait_gpu);5757+5858+ if (unlikely(ret != 0)) {5959+ if (ret != -ERESTARTSYS)6060+ pr_err("Failed to expire sync object before unbinding TTM\n");6161+ return ret;6262+ }6363+5664 ttm_tt_unbind(ttm);5765 ttm_bo_free_old_node(bo);5866 ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,
+32-105
drivers/input/keyboard/cros_ec_keyb.c
···2727#include <linux/input.h>2828#include <linux/interrupt.h>2929#include <linux/kernel.h>3030+#include <linux/notifier.h>3031#include <linux/platform_device.h>3132#include <linux/slab.h>3233#include <linux/input/matrix_keypad.h>···4544 * @dev: Device pointer4645 * @idev: Input device4746 * @ec: Top level ChromeOS device to use to talk to EC4747+ * @notifier: interrupt event notifier for transport devices4848 */4949struct cros_ec_keyb {5050 unsigned int rows;···5957 struct device *dev;6058 struct input_dev *idev;6159 struct cros_ec_device *ec;6060+ struct notifier_block notifier;6261};63626463···149146 input_sync(ckdev->idev);150147}151148152152-static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state)153153-{154154- int ret = 0;155155- struct cros_ec_command *msg;156156-157157- msg = kmalloc(sizeof(*msg) + ckdev->cols, GFP_KERNEL);158158- if (!msg)159159- return -ENOMEM;160160-161161- msg->version = 0;162162- msg->command = EC_CMD_MKBP_STATE;163163- msg->insize = ckdev->cols;164164- msg->outsize = 0;165165-166166- ret = cros_ec_cmd_xfer(ckdev->ec, msg);167167- if (ret < 0) {168168- dev_err(ckdev->dev, "Error transferring EC message %d\n", ret);169169- goto exit;170170- }171171-172172- memcpy(kb_state, msg->data, ckdev->cols);173173-exit:174174- kfree(msg);175175- return ret;176176-}177177-178178-static irqreturn_t cros_ec_keyb_irq(int irq, void *data)179179-{180180- struct cros_ec_keyb *ckdev = data;181181- struct cros_ec_device *ec = ckdev->ec;182182- int ret;183183- uint8_t kb_state[ckdev->cols];184184-185185- if (device_may_wakeup(ec->dev))186186- pm_wakeup_event(ec->dev, 0);187187-188188- ret = cros_ec_keyb_get_state(ckdev, kb_state);189189- if (ret >= 0)190190- cros_ec_keyb_process(ckdev, kb_state, ret);191191- else192192- dev_err(ckdev->dev, "failed to get keyboard state: %d\n", ret);193193-194194- return IRQ_HANDLED;195195-}196196-197149static int cros_ec_keyb_open(struct input_dev *dev)198150{199151 struct cros_ec_keyb *ckdev = input_get_drvdata(dev);200200- struct cros_ec_device *ec = ckdev->ec;201152202202- return request_threaded_irq(ec->irq, NULL, cros_ec_keyb_irq,203203- IRQF_TRIGGER_LOW | IRQF_ONESHOT,204204- "cros_ec_keyb", ckdev);153153+ return blocking_notifier_chain_register(&ckdev->ec->event_notifier,154154+ &ckdev->notifier);205155}206156207157static void cros_ec_keyb_close(struct input_dev *dev)208158{209159 struct cros_ec_keyb *ckdev = input_get_drvdata(dev);210210- struct cros_ec_device *ec = ckdev->ec;211160212212- free_irq(ec->irq, ckdev);161161+ blocking_notifier_chain_unregister(&ckdev->ec->event_notifier,162162+ &ckdev->notifier);163163+}164164+165165+static int cros_ec_keyb_work(struct notifier_block *nb,166166+ unsigned long queued_during_suspend, void *_notify)167167+{168168+ struct cros_ec_keyb *ckdev = container_of(nb, struct cros_ec_keyb,169169+ notifier);170170+171171+ if (ckdev->ec->event_data.event_type != EC_MKBP_EVENT_KEY_MATRIX)172172+ return NOTIFY_DONE;173173+ /*174174+ * If EC is not the wake source, discard key state changes during175175+ * suspend.176176+ */177177+ if (queued_during_suspend)178178+ return NOTIFY_OK;179179+ if (ckdev->ec->event_size != ckdev->cols) {180180+ dev_err(ckdev->dev,181181+ "Discarded incomplete key matrix event.\n");182182+ return NOTIFY_OK;183183+ }184184+ cros_ec_keyb_process(ckdev, ckdev->ec->event_data.data.key_matrix,185185+ ckdev->ec->event_size);186186+ return NOTIFY_OK;213187}214188215189/*···245265 if (!idev)246266 return -ENOMEM;247267248248- if (!ec->irq) {249249- dev_err(dev, "no EC IRQ specified\n");250250- return -EINVAL;251251- }252252-253268 ckdev->ec = ec;269269+ ckdev->notifier.notifier_call = cros_ec_keyb_work;254270 ckdev->dev = dev;255271 dev_set_drvdata(dev, ckdev);256272···287311 return 0;288312}289313290290-#ifdef CONFIG_PM_SLEEP291291-/* Clear any keys in the buffer */292292-static void cros_ec_keyb_clear_keyboard(struct cros_ec_keyb *ckdev)293293-{294294- uint8_t old_state[ckdev->cols];295295- uint8_t new_state[ckdev->cols];296296- unsigned long duration;297297- int i, ret;298298-299299- /*300300- * Keep reading until we see that the scan state does not change.301301- * That indicates that we are done.302302- *303303- * Assume that the EC keyscan buffer is at most 32 deep.304304- */305305- duration = jiffies;306306- ret = cros_ec_keyb_get_state(ckdev, new_state);307307- for (i = 1; !ret && i < 32; i++) {308308- memcpy(old_state, new_state, sizeof(old_state));309309- ret = cros_ec_keyb_get_state(ckdev, new_state);310310- if (0 == memcmp(old_state, new_state, sizeof(old_state)))311311- break;312312- }313313- duration = jiffies - duration;314314- dev_info(ckdev->dev, "Discarded %d keyscan(s) in %dus\n", i,315315- jiffies_to_usecs(duration));316316-}317317-318318-static int cros_ec_keyb_resume(struct device *dev)319319-{320320- struct cros_ec_keyb *ckdev = dev_get_drvdata(dev);321321-322322- /*323323- * When the EC is not a wake source, then it could not have caused the324324- * resume, so we clear the EC's key scan buffer. If the EC was a325325- * wake source (e.g. the lid is open and the user might press a key to326326- * wake) then the key scan buffer should be preserved.327327- */328328- if (!ckdev->ec->was_wake_device)329329- cros_ec_keyb_clear_keyboard(ckdev);330330-331331- return 0;332332-}333333-334334-#endif335335-336336-static SIMPLE_DEV_PM_OPS(cros_ec_keyb_pm_ops, NULL, cros_ec_keyb_resume);337337-338314#ifdef CONFIG_OF339315static const struct of_device_id cros_ec_keyb_of_match[] = {340316 { .compatible = "google,cros-ec-keyb" },···300372 .driver = {301373 .name = "cros-ec-keyb",302374 .of_match_table = of_match_ptr(cros_ec_keyb_of_match),303303- .pm = &cros_ec_keyb_pm_ops,304375 },305376};306377
+26-2
drivers/mfd/Kconfig
···112112 help113113 Support for the BCM590xx PMUs from Broadcom114114115115+config MFD_AC100116116+ tristate "X-Powers AC100"117117+ select MFD_CORE118118+ depends on SUNXI_RSB119119+ help120120+ If you say Y here you get support for the X-Powers AC100 audio codec121121+ IC.122122+ This driver include only the core APIs. You have to select individual123123+ components like codecs or RTC under the corresponding menus.124124+115125config MFD_AXP20X116126 tristate117127 select MFD_CORE···862852 different functionality of the device.863853864854config MFD_RK808865865- tristate "Rockchip RK808 Power Management chip"855855+ tristate "Rockchip RK808/RK818 Power Management Chip"866856 depends on I2C && OF867857 select MFD_CORE868858 select REGMAP_I2C869859 select REGMAP_IRQ870860 help871871- If you say yes here you get support for the RK808861861+ If you say yes here you get support for the RK808 and RK818872862 Power Management chips.873863 This driver provides common support for accessing the device874864 through I2C interface. The device supports multiple sub-devices···1233122312341224 This driver can also be built as a module. If so, the module12351225 will be called tps65217.12261226+12271227+config MFD_TI_LP873X12281228+ tristate "TI LP873X Power Management IC"12291229+ depends on I2C12301230+ select MFD_CORE12311231+ select REGMAP_I2C12321232+ help12331233+ If you say yes here then you get support for the LP873X series of12341234+ Power Management Integrated Circuits (PMIC).12351235+ These include voltage regulators, thermal protection, configurable12361236+ General Purpose Outputs (GPO) that are used in portable devices.12371237+12381238+ This driver can also be built as a module. If so, the module12391239+ will be called lp873x.1236124012371241config MFD_TPS6521812381242 tristate "TI TPS65218 Power Management chips"
···2323#include <linux/module.h>2424#include <linux/mfd/core.h>2525#include <linux/mfd/cros_ec.h>2626+#include <asm/unaligned.h>26272728#define CROS_EC_DEV_EC_INDEX 02829#define CROS_EC_DEV_PD_INDEX 1···5049 .pdata_size = sizeof(pd_p),5150};52515252+static irqreturn_t ec_irq_thread(int irq, void *data)5353+{5454+ struct cros_ec_device *ec_dev = data;5555+ int ret;5656+5757+ if (device_may_wakeup(ec_dev->dev))5858+ pm_wakeup_event(ec_dev->dev, 0);5959+6060+ ret = cros_ec_get_next_event(ec_dev);6161+ if (ret > 0)6262+ blocking_notifier_call_chain(&ec_dev->event_notifier,6363+ 0, ec_dev);6464+ return IRQ_HANDLED;6565+}6666+5367int cros_ec_register(struct cros_ec_device *ec_dev)5468{5569 struct device *dev = ec_dev->dev;5670 int err = 0;7171+7272+ BLOCKING_INIT_NOTIFIER_HEAD(&ec_dev->event_notifier);57735874 ec_dev->max_request = sizeof(struct ec_params_hello);5975 ec_dev->max_response = sizeof(struct ec_response_get_protocol_info);···88708971 cros_ec_query_all(ec_dev);90727373+ if (ec_dev->irq) {7474+ err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread,7575+ IRQF_TRIGGER_LOW | IRQF_ONESHOT,7676+ "chromeos-ec", ec_dev);7777+ if (err) {7878+ dev_err(dev, "Failed to request IRQ %d: %d",7979+ ec_dev->irq, err);8080+ return err;8181+ }8282+ }8383+9184 err = mfd_add_devices(ec_dev->dev, PLATFORM_DEVID_AUTO, &ec_cell, 1,9285 NULL, ec_dev->irq, NULL);9386 if (err) {9487 dev_err(dev,9588 "Failed to register Embedded Controller subdevice %d\n",9689 err);9797- return err;9090+ goto fail_mfd;9891 }999210093 if (ec_dev->max_passthru) {···12394 dev_err(dev,12495 "Failed to register Power Delivery subdevice %d\n",12596 err);126126- return err;9797+ goto fail_mfd;12798 }12899 }129100···132103 if (err) {133104 mfd_remove_devices(dev);134105 dev_err(dev, "Failed to register sub-devices\n");135135- return err;106106+ goto fail_mfd;136107 }137108 }138109139110 dev_info(dev, "Chrome EC device registered\n");140111141112 return 0;113113+114114+fail_mfd:115115+ if (ec_dev->irq)116116+ free_irq(ec_dev->irq, ec_dev);117117+ return err;142118}143119EXPORT_SYMBOL(cros_ec_register);144120···170136}171137EXPORT_SYMBOL(cros_ec_suspend);172138139139+static void cros_ec_drain_events(struct cros_ec_device *ec_dev)140140+{141141+ while (cros_ec_get_next_event(ec_dev) > 0)142142+ blocking_notifier_call_chain(&ec_dev->event_notifier,143143+ 1, ec_dev);144144+}145145+173146int cros_ec_resume(struct cros_ec_device *ec_dev)174147{175148 enable_irq(ec_dev->irq);176149150150+ /*151151+ * In some cases, we need to distinguish between events that occur152152+ * during suspend if the EC is not a wake source. For example,153153+ * keypresses during suspend should be discarded if it does not wake154154+ * the system.155155+ *156156+ * If the EC is not a wake source, drain the event queue and mark them157157+ * as "queued during suspend".158158+ */177159 if (ec_dev->wake_enabled) {178160 disable_irq_wake(ec_dev->irq);179161 ec_dev->wake_enabled = 0;162162+ } else {163163+ cros_ec_drain_events(ec_dev);180164 }181165182166 return 0;
+99
drivers/mfd/lp873x.c
···11+/*22+ * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/33+ *44+ * Author: Keerthy <j-keerthy@ti.com>55+ *66+ * This program is free software; you can redistribute it and/or77+ * modify it under the terms of the GNU General Public License as88+ * published by the Free Software Foundation version 2.99+ *1010+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any1111+ * kind, whether express or implied; without even the implied warranty1212+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313+ * GNU General Public License for more details.1414+ */1515+1616+#include <linux/interrupt.h>1717+#include <linux/mfd/core.h>1818+#include <linux/module.h>1919+#include <linux/of_device.h>2020+#include <linux/regmap.h>2121+2222+#include <linux/mfd/lp873x.h>2323+2424+static const struct regmap_config lp873x_regmap_config = {2525+ .reg_bits = 8,2626+ .val_bits = 8,2727+ .max_register = LP873X_REG_MAX,2828+};2929+3030+static const struct mfd_cell lp873x_cells[] = {3131+ { .name = "lp873x-regulator", },3232+ { .name = "lp873x-gpio", },3333+};3434+3535+static int lp873x_probe(struct i2c_client *client,3636+ const struct i2c_device_id *ids)3737+{3838+ struct lp873x *lp873;3939+ int ret;4040+ unsigned int otpid;4141+4242+ lp873 = devm_kzalloc(&client->dev, sizeof(*lp873), GFP_KERNEL);4343+ if (!lp873)4444+ return -ENOMEM;4545+4646+ lp873->dev = &client->dev;4747+4848+ lp873->regmap = devm_regmap_init_i2c(client, &lp873x_regmap_config);4949+ if (IS_ERR(lp873->regmap)) {5050+ ret = PTR_ERR(lp873->regmap);5151+ dev_err(lp873->dev,5252+ "Failed to initialize register map: %d\n", ret);5353+ return ret;5454+ }5555+5656+ mutex_init(&lp873->lock);5757+5858+ ret = regmap_read(lp873->regmap, LP873X_REG_OTP_REV, &otpid);5959+ if (ret) {6060+ dev_err(lp873->dev, "Failed to read OTP ID\n");6161+ return ret;6262+ }6363+6464+ lp873->rev = otpid & LP873X_OTP_REV_OTP_ID;6565+6666+ i2c_set_clientdata(client, lp873);6767+6868+ ret = mfd_add_devices(lp873->dev, PLATFORM_DEVID_AUTO, lp873x_cells,6969+ ARRAY_SIZE(lp873x_cells), NULL, 0, NULL);7070+7171+ return ret;7272+}7373+7474+static const struct of_device_id of_lp873x_match_table[] = {7575+ { .compatible = "ti,lp8733", },7676+ { .compatible = "ti,lp8732", },7777+ {}7878+};7979+MODULE_DEVICE_TABLE(of, of_lp873x_match_table);8080+8181+static const struct i2c_device_id lp873x_id_table[] = {8282+ { "lp873x", 0 },8383+ { },8484+};8585+MODULE_DEVICE_TABLE(i2c, lp873x_id_table);8686+8787+static struct i2c_driver lp873x_driver = {8888+ .driver = {8989+ .name = "lp873x",9090+ .of_match_table = of_lp873x_match_table,9191+ },9292+ .probe = lp873x_probe,9393+ .id_table = lp873x_id_table,9494+};9595+module_i2c_driver(lp873x_driver);9696+9797+MODULE_AUTHOR("J Keerthy <j-keerthy@ti.com>");9898+MODULE_DESCRIPTION("LP873X chip family Multi-Function Device driver");9999+MODULE_LICENSE("GPL v2");
···49495050 /* This is a pointer to outside our current stack frame. */5151 if (bad_frame) {5252- bad_stack = do_usercopy_stack_callee((uintptr_t)bad_stack);5252+ bad_stack = do_usercopy_stack_callee((uintptr_t)&bad_stack);5353 } else {5454 /* Put start address just inside stack. */5555 bad_stack = task_stack_page(current) + THREAD_SIZE;
···7777 NVMET_RDMA_Q_CONNECTING,7878 NVMET_RDMA_Q_LIVE,7979 NVMET_RDMA_Q_DISCONNECTING,8080+ NVMET_RDMA_IN_DEVICE_REMOVAL,8081};81828283struct nvmet_rdma_queue {···616615 if (!len)617616 return 0;618617619619- /* use the already allocated data buffer if possible */620620- if (len <= NVMET_RDMA_INLINE_DATA_SIZE && rsp->queue->host_qid) {621621- nvmet_rdma_use_inline_sg(rsp, len, 0);622622- } else {623623- status = nvmet_rdma_alloc_sgl(&rsp->req.sg, &rsp->req.sg_cnt,624624- len);625625- if (status)626626- return status;627627- }618618+ status = nvmet_rdma_alloc_sgl(&rsp->req.sg, &rsp->req.sg_cnt,619619+ len);620620+ if (status)621621+ return status;628622629623 ret = rdma_rw_ctx_init(&rsp->rw, cm_id->qp, cm_id->port_num,630624 rsp->req.sg, rsp->req.sg_cnt, 0, addr, key,···980984 struct nvmet_rdma_device *dev = queue->dev;981985982986 nvmet_rdma_free_queue(queue);983983- rdma_destroy_id(cm_id);987987+988988+ if (queue->state != NVMET_RDMA_IN_DEVICE_REMOVAL)989989+ rdma_destroy_id(cm_id);990990+984991 kref_put(&dev->ref, nvmet_rdma_free_dev);985992}986993···12321233 switch (queue->state) {12331234 case NVMET_RDMA_Q_CONNECTING:12341235 case NVMET_RDMA_Q_LIVE:12351235- disconnect = true;12361236 queue->state = NVMET_RDMA_Q_DISCONNECTING;12371237+ case NVMET_RDMA_IN_DEVICE_REMOVAL:12381238+ disconnect = true;12371239 break;12381240 case NVMET_RDMA_Q_DISCONNECTING:12391241 break;···12721272 schedule_work(&queue->release_work);12731273}1274127412751275+/**12761276+ * nvme_rdma_device_removal() - Handle RDMA device removal12771277+ * @queue: nvmet rdma queue (cm id qp_context)12781278+ * @addr: nvmet address (cm_id context)12791279+ *12801280+ * DEVICE_REMOVAL event notifies us that the RDMA device is about12811281+ * to unplug so we should take care of destroying our RDMA resources.12821282+ * This event will be generated for each allocated cm_id.12831283+ *12841284+ * Note that this event can be generated on a normal queue cm_id12851285+ * and/or a device bound listener cm_id (where in this case12861286+ * queue will be null).12871287+ *12881288+ * we claim ownership on destroying the cm_id. For queues we move12891289+ * the queue state to NVMET_RDMA_IN_DEVICE_REMOVAL and for port12901290+ * we nullify the priv to prevent double cm_id destruction and destroying12911291+ * the cm_id implicitely by returning a non-zero rc to the callout.12921292+ */12931293+static int nvmet_rdma_device_removal(struct rdma_cm_id *cm_id,12941294+ struct nvmet_rdma_queue *queue)12951295+{12961296+ unsigned long flags;12971297+12981298+ if (!queue) {12991299+ struct nvmet_port *port = cm_id->context;13001300+13011301+ /*13021302+ * This is a listener cm_id. Make sure that13031303+ * future remove_port won't invoke a double13041304+ * cm_id destroy. use atomic xchg to make sure13051305+ * we don't compete with remove_port.13061306+ */13071307+ if (xchg(&port->priv, NULL) != cm_id)13081308+ return 0;13091309+ } else {13101310+ /*13111311+ * This is a queue cm_id. Make sure that13121312+ * release queue will not destroy the cm_id13131313+ * and schedule all ctrl queues removal (only13141314+ * if the queue is not disconnecting already).13151315+ */13161316+ spin_lock_irqsave(&queue->state_lock, flags);13171317+ if (queue->state != NVMET_RDMA_Q_DISCONNECTING)13181318+ queue->state = NVMET_RDMA_IN_DEVICE_REMOVAL;13191319+ spin_unlock_irqrestore(&queue->state_lock, flags);13201320+ nvmet_rdma_queue_disconnect(queue);13211321+ flush_scheduled_work();13221322+ }13231323+13241324+ /*13251325+ * We need to return 1 so that the core will destroy13261326+ * it's own ID. What a great API design..13271327+ */13281328+ return 1;13291329+}13301330+12751331static int nvmet_rdma_cm_handler(struct rdma_cm_id *cm_id,12761332 struct rdma_cm_event *event)12771333{···13501294 break;13511295 case RDMA_CM_EVENT_ADDR_CHANGE:13521296 case RDMA_CM_EVENT_DISCONNECTED:13531353- case RDMA_CM_EVENT_DEVICE_REMOVAL:13541297 case RDMA_CM_EVENT_TIMEWAIT_EXIT:13551355- /*13561356- * We can get the device removal callback even for a13571357- * CM ID that we aren't actually using. In that case13581358- * the context pointer is NULL, so we shouldn't try13591359- * to disconnect a non-existing queue. But we also13601360- * need to return 1 so that the core will destroy13611361- * it's own ID. What a great API design..13621362- */13631363- if (queue)13641364- nvmet_rdma_queue_disconnect(queue);13651365- else13661366- ret = 1;12981298+ nvmet_rdma_queue_disconnect(queue);12991299+ break;13001300+ case RDMA_CM_EVENT_DEVICE_REMOVAL:13011301+ ret = nvmet_rdma_device_removal(cm_id, queue);13671302 break;13681303 case RDMA_CM_EVENT_REJECTED:13691304 case RDMA_CM_EVENT_UNREACHABLE:···1443139614441397static void nvmet_rdma_remove_port(struct nvmet_port *port)14451398{14461446- struct rdma_cm_id *cm_id = port->priv;13991399+ struct rdma_cm_id *cm_id = xchg(&port->priv, NULL);1447140014481448- rdma_destroy_id(cm_id);14011401+ if (cm_id)14021402+ rdma_destroy_id(cm_id);14491403}1450140414511405static struct nvmet_fabrics_ops nvmet_rdma_ops = {
+2
drivers/pci/msi.c
···14111411 if (info->flags & MSI_FLAG_USE_DEF_CHIP_OPS)14121412 pci_msi_domain_update_chip_ops(info);1413141314141414+ info->flags |= MSI_FLAG_ACTIVATE_EARLY;14151415+14141416 domain = msi_create_irq_domain(fwnode, info, parent);14151417 if (!domain)14161418 return NULL;
+14-13
drivers/perf/arm_pmu.c
···688688 return 0;689689}690690691691-static DEFINE_MUTEX(arm_pmu_mutex);691691+static DEFINE_SPINLOCK(arm_pmu_lock);692692static LIST_HEAD(arm_pmu_list);693693694694/*···701701{702702 struct arm_pmu *pmu;703703704704- mutex_lock(&arm_pmu_mutex);704704+ spin_lock(&arm_pmu_lock);705705 list_for_each_entry(pmu, &arm_pmu_list, entry) {706706707707 if (!cpumask_test_cpu(cpu, &pmu->supported_cpus))···709709 if (pmu->reset)710710 pmu->reset(pmu);711711 }712712- mutex_unlock(&arm_pmu_mutex);712712+ spin_unlock(&arm_pmu_lock);713713 return 0;714714}715715···821821 if (!cpu_hw_events)822822 return -ENOMEM;823823824824- mutex_lock(&arm_pmu_mutex);824824+ spin_lock(&arm_pmu_lock);825825 list_add_tail(&cpu_pmu->entry, &arm_pmu_list);826826- mutex_unlock(&arm_pmu_mutex);826826+ spin_unlock(&arm_pmu_lock);827827828828 err = cpu_pm_pmu_register(cpu_pmu);829829 if (err)···859859 return 0;860860861861out_unregister:862862- mutex_lock(&arm_pmu_mutex);862862+ spin_lock(&arm_pmu_lock);863863 list_del(&cpu_pmu->entry);864864- mutex_unlock(&arm_pmu_mutex);864864+ spin_unlock(&arm_pmu_lock);865865 free_percpu(cpu_hw_events);866866 return err;867867}···869869static void cpu_pmu_destroy(struct arm_pmu *cpu_pmu)870870{871871 cpu_pm_pmu_unregister(cpu_pmu);872872- mutex_lock(&arm_pmu_mutex);872872+ spin_lock(&arm_pmu_lock);873873 list_del(&cpu_pmu->entry);874874- mutex_unlock(&arm_pmu_mutex);874874+ spin_unlock(&arm_pmu_lock);875875 free_percpu(cpu_pmu->hw_events);876876}877877···967967968968 /* If we didn't manage to parse anything, try the interrupt affinity */969969 if (cpumask_weight(&pmu->supported_cpus) == 0) {970970- if (!using_spi) {971971- /* If using PPIs, check the affinity of the partition */972972- int ret, irq;970970+ int irq = platform_get_irq(pdev, 0);973971974974- irq = platform_get_irq(pdev, 0);972972+ if (irq_is_percpu(irq)) {973973+ /* If using PPIs, check the affinity of the partition */974974+ int ret;975975+975976 ret = irq_get_percpu_devid_partition(irq, &pmu->supported_cpus);976977 if (ret) {977978 kfree(irqs);
···323323324324config REGULATOR_LP873X325325 tristate "TI LP873X Power regulators"326326- depends on MFD_LP873X && OF326326+ depends on MFD_TI_LP873X && OF327327 help328328 This driver supports LP873X voltage regulator chips. LP873X329329 provides two step-down converters and two general-purpose LDO···635635 outputs which can be controlled by i2c communication.636636637637config REGULATOR_RK808638638- tristate "Rockchip RK808 Power regulators"638638+ tristate "Rockchip RK808/RK818 Power regulators"639639 depends on MFD_RK808640640 help641641 Select this option to enable the power regulator of ROCKCHIP642642- PMIC RK808.642642+ PMIC RK808 and RK818.643643 This driver supports the control of different power rails of device644644 through regulator interface. The device supports multiple DCDC/LDO645645 outputs which can be controlled by i2c communication.
+112-8
drivers/regulator/axp20x-regulator.c
···244244 .ops = &axp20x_ops_sw,245245};246246247247+static const struct regulator_linear_range axp806_dcdca_ranges[] = {248248+ REGULATOR_LINEAR_RANGE(600000, 0x0, 0x32, 10000),249249+ REGULATOR_LINEAR_RANGE(1120000, 0x33, 0x47, 20000),250250+};251251+252252+static const struct regulator_linear_range axp806_dcdcd_ranges[] = {253253+ REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2d, 20000),254254+ REGULATOR_LINEAR_RANGE(1600000, 0x2e, 0x3f, 100000),255255+};256256+257257+static const struct regulator_linear_range axp806_cldo2_ranges[] = {258258+ REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),259259+ REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),260260+};261261+262262+static const struct regulator_desc axp806_regulators[] = {263263+ AXP_DESC_RANGES(AXP806, DCDCA, "dcdca", "vina", axp806_dcdca_ranges,264264+ 72, AXP806_DCDCA_V_CTRL, 0x7f, AXP806_PWR_OUT_CTRL1,265265+ BIT(0)),266266+ AXP_DESC(AXP806, DCDCB, "dcdcb", "vinb", 1000, 2550, 50,267267+ AXP806_DCDCB_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(1)),268268+ AXP_DESC_RANGES(AXP806, DCDCC, "dcdcc", "vinc", axp806_dcdca_ranges,269269+ 72, AXP806_DCDCC_V_CTRL, 0x7f, AXP806_PWR_OUT_CTRL1,270270+ BIT(2)),271271+ AXP_DESC_RANGES(AXP806, DCDCD, "dcdcd", "vind", axp806_dcdcd_ranges,272272+ 64, AXP806_DCDCD_V_CTRL, 0x3f, AXP806_PWR_OUT_CTRL1,273273+ BIT(3)),274274+ AXP_DESC(AXP806, DCDCE, "dcdce", "vine", 1100, 3400, 100,275275+ AXP806_DCDCB_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(4)),276276+ AXP_DESC(AXP806, ALDO1, "aldo1", "aldoin", 700, 3300, 100,277277+ AXP806_ALDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(5)),278278+ AXP_DESC(AXP806, ALDO2, "aldo2", "aldoin", 700, 3400, 100,279279+ AXP806_ALDO2_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(6)),280280+ AXP_DESC(AXP806, ALDO3, "aldo3", "aldoin", 700, 3300, 100,281281+ AXP806_ALDO3_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL1, BIT(7)),282282+ AXP_DESC(AXP806, BLDO1, "bldo1", "bldoin", 700, 1900, 100,283283+ AXP806_BLDO1_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(0)),284284+ AXP_DESC(AXP806, BLDO2, "bldo2", "bldoin", 700, 1900, 100,285285+ AXP806_BLDO2_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(1)),286286+ AXP_DESC(AXP806, BLDO3, "bldo3", "bldoin", 700, 1900, 100,287287+ AXP806_BLDO3_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(2)),288288+ AXP_DESC(AXP806, BLDO4, "bldo4", "bldoin", 700, 1900, 100,289289+ AXP806_BLDO4_V_CTRL, 0x0f, AXP806_PWR_OUT_CTRL2, BIT(3)),290290+ AXP_DESC(AXP806, CLDO1, "cldo1", "cldoin", 700, 3300, 100,291291+ AXP806_CLDO1_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2, BIT(4)),292292+ AXP_DESC_RANGES(AXP806, CLDO2, "cldo2", "cldoin", axp806_cldo2_ranges,293293+ 32, AXP806_CLDO2_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2,294294+ BIT(5)),295295+ AXP_DESC(AXP806, CLDO3, "cldo3", "cldoin", 700, 3300, 100,296296+ AXP806_CLDO3_V_CTRL, 0x1f, AXP806_PWR_OUT_CTRL2, BIT(6)),297297+ AXP_DESC_SW(AXP806, SW, "sw", "swin", AXP806_PWR_OUT_CTRL2, BIT(7)),298298+};299299+247300static const struct regulator_linear_range axp809_dcdc4_ranges[] = {248301 REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000),249302 REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000),250250-};251251-252252-static const struct regulator_linear_range axp809_dldo1_ranges[] = {253253- REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000),254254- REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000),255303};256304257305static const struct regulator_desc axp809_regulators[] = {···326278 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),327279 AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100,328280 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),329329- AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges,281281+ AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp806_cldo2_ranges,330282 32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,331283 BIT(3)),332284 AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100,···350302static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)351303{352304 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);305305+ unsigned int reg = AXP20X_DCDC_FREQ;353306 u32 min, max, def, step;354307355308 switch (axp20x->variant) {···361312 def = 1500;362313 step = 75;363314 break;315315+ case AXP806_ID:316316+ /*317317+ * AXP806 DCDC work frequency setting has the same range and318318+ * step as AXP22X, but at a different register.319319+ * Fall through to the check below.320320+ * (See include/linux/mfd/axp20x.h)321321+ */322322+ reg = AXP806_DCDC_FREQ_CTRL;364323 case AXP221_ID:365324 case AXP223_ID:366325 case AXP809_ID:···400343401344 dcdcfreq = (dcdcfreq - min) / step;402345403403- return regmap_update_bits(axp20x->regmap, AXP20X_DCDC_FREQ,346346+ return regmap_update_bits(axp20x->regmap, reg,404347 AXP20X_FREQ_DCDC_MASK, dcdcfreq);405348}406349···434377static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)435378{436379 struct axp20x_dev *axp20x = rdev_get_drvdata(rdev);380380+ unsigned int reg = AXP20X_DCDC_MODE;437381 unsigned int mask;438382439383 switch (axp20x->variant) {···450392 workmode <<= ffs(mask) - 1;451393 break;452394395395+ case AXP806_ID:396396+ reg = AXP806_DCDC_MODE_CTRL2;397397+ /*398398+ * AXP806 DCDC regulator IDs have the same range as AXP22X.399399+ * Fall through to the check below.400400+ * (See include/linux/mfd/axp20x.h)401401+ */453402 case AXP221_ID:454403 case AXP223_ID:455404 case AXP809_ID:···473408 return -EINVAL;474409 }475410476476- return regmap_update_bits(rdev->regmap, AXP20X_DCDC_MODE, mask, workmode);411411+ return regmap_update_bits(rdev->regmap, reg, mask, workmode);412412+}413413+414414+/*415415+ * This function checks whether a regulator is part of a poly-phase416416+ * output setup based on the registers settings. Returns true if it is.417417+ */418418+static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)419419+{420420+ u32 reg = 0;421421+422422+ /* Only AXP806 has poly-phase outputs */423423+ if (axp20x->variant != AXP806_ID)424424+ return false;425425+426426+ regmap_read(axp20x->regmap, AXP806_DCDC_MODE_CTRL2, ®);427427+428428+ switch (id) {429429+ case AXP806_DCDCB:430430+ return (((reg & GENMASK(7, 6)) == BIT(6)) ||431431+ ((reg & GENMASK(7, 6)) == BIT(7)));432432+ case AXP806_DCDCC:433433+ return ((reg & GENMASK(7, 6)) == BIT(7));434434+ case AXP806_DCDCE:435435+ return !!(reg & BIT(5));436436+ }437437+438438+ return false;477439}478440479441static int axp20x_regulator_probe(struct platform_device *pdev)···532440 drivevbus = of_property_read_bool(pdev->dev.parent->of_node,533441 "x-powers,drive-vbus-en");534442 break;443443+ case AXP806_ID:444444+ regulators = axp806_regulators;445445+ nregulators = AXP806_REG_ID_MAX;446446+ break;535447 case AXP809_ID:536448 regulators = axp809_regulators;537449 nregulators = AXP809_REG_ID_MAX;···552456 for (i = 0; i < nregulators; i++) {553457 const struct regulator_desc *desc = ®ulators[i];554458 struct regulator_desc *new_desc;459459+460460+ /*461461+ * If this regulator is a slave in a poly-phase setup,462462+ * skip it, as its controls are bound to the master463463+ * regulator and won't work.464464+ */465465+ if (axp20x_is_polyphase_slave(axp20x, i))466466+ continue;555467556468 /*557469 * Regulators DC1SW and DC5LDO are connected internally,
···187187 This driver can also be built as a module. If so, the module188188 will be called rtc-abx80x.189189190190+config RTC_DRV_AC100191191+ tristate "X-Powers AC100"192192+ depends on MFD_AC100193193+ help194194+ If you say yes here you get support for the real-time clock found195195+ in X-Powers AC100 family peripheral ICs.196196+197197+ This driver can also be built as a module. If so, the module198198+ will be called rtc-ac100.199199+190200config RTC_DRV_AS3722191201 tristate "ams AS3722 RTC driver"192202 depends on MFD_AS3722···338328 will be called rtc-max77686.339329340330config RTC_DRV_RK808341341- tristate "Rockchip RK808 RTC"331331+ tristate "Rockchip RK808/RK818 RTC"342332 depends on MFD_RK808343333 help344334 If you say yes here you will get support for the345345- RTC of RK808 PMIC.335335+ RTC of RK808 and RK818 PMIC.346336347337 This driver can also be built as a module. If so, the module348338 will be called rk808-rtc.
···66# it under the terms of the GNU General Public License (version 2 only)77# as published by the Free Software Foundation.8899-obj-$(CONFIG_S390_GUEST) += kvm_virtio.o virtio_ccw.o99+s390-virtio-objs := virtio_ccw.o1010+ifdef CONFIG_S390_GUEST_OLD_TRANSPORT1111+s390-virtio-objs += kvm_virtio.o1212+endif1313+obj-$(CONFIG_S390_GUEST) += $(s390-virtio-objs)
+3-1
drivers/s390/virtio/kvm_virtio.c
···458458 if (test_devices_support(total_memory_size) < 0)459459 return -ENODEV;460460461461+ pr_warn("The s390-virtio transport is deprecated. Please switch to a modern host providing virtio-ccw.\n");462462+461463 rc = vmem_add_mapping(total_memory_size, PAGE_SIZE);462464 if (rc)463465 return rc;···484482}485483486484/* code for early console output with virtio_console */487487-static __init int early_put_chars(u32 vtermno, const char *buf, int count)485485+static int early_put_chars(u32 vtermno, const char *buf, int count)488486{489487 char scratch[17];490488 unsigned int len = count;
···388388 int sleeptime;389389 unsigned long target_jiffies;390390 unsigned int guard;391391- unsigned int compensation = 0;391391+ unsigned int compensated_ratio;392392 int interval; /* jiffies to sleep for each attempt */393393 unsigned int duration_jiffies = msecs_to_jiffies(duration);394394 unsigned int window_size_now;···409409 * c-states, thus we need to compensate the injected idle ratio410410 * to achieve the actual target reported by the HW.411411 */412412- compensation = get_compensation(target_ratio);413413- interval = duration_jiffies*100/(target_ratio+compensation);412412+ compensated_ratio = target_ratio +413413+ get_compensation(target_ratio);414414+ if (compensated_ratio <= 0)415415+ compensated_ratio = 1;416416+ interval = duration_jiffies * 100 / compensated_ratio;414417415418 /* align idle time */416419 target_jiffies = roundup(jiffies, interval);···650647 goto exit_set;651648 } else if (set_target_ratio > 0 && new_target_ratio == 0) {652649 pr_info("Stop forced idle injection\n");653653- set_target_ratio = 0;654650 end_power_clamp();651651+ set_target_ratio = 0;655652 } else /* adjust currently running */ {656653 set_target_ratio = new_target_ratio;657654 /* make new set_target_ratio visible to other cpus */
···20332033 */20342034 clear_bit(BTRFS_INODE_NEEDS_FULL_SYNC,20352035 &BTRFS_I(inode)->runtime_flags);20362036+ /*20372037+ * An ordered extent might have started before and completed20382038+ * already with io errors, in which case the inode was not20392039+ * updated and we end up here. So check the inode's mapping20402040+ * flags for any errors that might have happened while doing20412041+ * writeback of file data.20422042+ */20432043+ ret = btrfs_inode_check_errors(inode);20362044 inode_unlock(inode);20372045 goto out;20382046 }
+36-10
fs/btrfs/inode.c
···34353435 found_key.offset = 0;34363436 inode = btrfs_iget(root->fs_info->sb, &found_key, root, NULL);34373437 ret = PTR_ERR_OR_ZERO(inode);34383438- if (ret && ret != -ESTALE)34383438+ if (ret && ret != -ENOENT)34393439 goto out;3440344034413441- if (ret == -ESTALE && root == root->fs_info->tree_root) {34413441+ if (ret == -ENOENT && root == root->fs_info->tree_root) {34423442 struct btrfs_root *dead_root;34433443 struct btrfs_fs_info *fs_info = root->fs_info;34443444 int is_dead_root = 0;···34743474 * Inode is already gone but the orphan item is still there,34753475 * kill the orphan item.34763476 */34773477- if (ret == -ESTALE) {34773477+ if (ret == -ENOENT) {34783478 trans = btrfs_start_transaction(root, 1);34793479 if (IS_ERR(trans)) {34803480 ret = PTR_ERR(trans);···36333633/*36343634 * read an inode from the btree into the in-memory inode36353635 */36363636-static void btrfs_read_locked_inode(struct inode *inode)36363636+static int btrfs_read_locked_inode(struct inode *inode)36373637{36383638 struct btrfs_path *path;36393639 struct extent_buffer *leaf;···36523652 filled = true;3653365336543654 path = btrfs_alloc_path();36553655- if (!path)36553655+ if (!path) {36563656+ ret = -ENOMEM;36563657 goto make_bad;36583658+ }3657365936583660 memcpy(&location, &BTRFS_I(inode)->location, sizeof(location));3659366136603662 ret = btrfs_lookup_inode(NULL, root, path, &location, 0);36613661- if (ret)36633663+ if (ret) {36643664+ if (ret > 0)36653665+ ret = -ENOENT;36623666 goto make_bad;36673667+ }3663366836643669 leaf = path->nodes[0];36653670···38173812 }3818381338193814 btrfs_update_iflags(inode);38203820- return;38153815+ return 0;3821381638223817make_bad:38233818 btrfs_free_path(path);38243819 make_bad_inode(inode);38203820+ return ret;38253821}3826382238273823/*···42104204 int err = 0;42114205 struct btrfs_root *root = BTRFS_I(dir)->root;42124206 struct btrfs_trans_handle *trans;42074207+ u64 last_unlink_trans;4213420842144209 if (inode->i_size > BTRFS_EMPTY_DIR_SIZE)42154210 return -ENOTEMPTY;···42334226 if (err)42344227 goto out;4235422842294229+ last_unlink_trans = BTRFS_I(inode)->last_unlink_trans;42304230+42364231 /* now the directory is empty */42374232 err = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),42384233 dentry->d_name.name, dentry->d_name.len);42394239- if (!err)42344234+ if (!err) {42404235 btrfs_i_size_write(inode, 0);42364236+ /*42374237+ * Propagate the last_unlink_trans value of the deleted dir to42384238+ * its parent directory. This is to prevent an unrecoverable42394239+ * log tree in the case we do something like this:42404240+ * 1) create dir foo42414241+ * 2) create snapshot under dir foo42424242+ * 3) delete the snapshot42434243+ * 4) rmdir foo42444244+ * 5) mkdir foo42454245+ * 6) fsync foo or some file inside foo42464246+ */42474247+ if (last_unlink_trans >= trans->transid)42484248+ BTRFS_I(dir)->last_unlink_trans = last_unlink_trans;42494249+ }42414250out:42424251 btrfs_end_transaction(trans, root);42434252 btrfs_btree_balance_dirty(root);···56295606 return ERR_PTR(-ENOMEM);5630560756315608 if (inode->i_state & I_NEW) {56325632- btrfs_read_locked_inode(inode);56095609+ int ret;56105610+56115611+ ret = btrfs_read_locked_inode(inode);56335612 if (!is_bad_inode(inode)) {56345613 inode_tree_add(inode);56355614 unlock_new_inode(inode);···56405615 } else {56415616 unlock_new_inode(inode);56425617 iput(inode);56435643- inode = ERR_PTR(-ESTALE);56185618+ ASSERT(ret < 0);56195619+ inode = ERR_PTR(ret < 0 ? ret : -ESTALE);56445620 }56455621 }56465622
+162-11
fs/btrfs/send.c
···231231 u64 parent_ino;232232 u64 ino;233233 u64 gen;234234- bool is_orphan;235234 struct list_head update_refs;236235};237236···272273 int name_len;273274 char name[];274275};276276+277277+static void inconsistent_snapshot_error(struct send_ctx *sctx,278278+ enum btrfs_compare_tree_result result,279279+ const char *what)280280+{281281+ const char *result_string;282282+283283+ switch (result) {284284+ case BTRFS_COMPARE_TREE_NEW:285285+ result_string = "new";286286+ break;287287+ case BTRFS_COMPARE_TREE_DELETED:288288+ result_string = "deleted";289289+ break;290290+ case BTRFS_COMPARE_TREE_CHANGED:291291+ result_string = "updated";292292+ break;293293+ case BTRFS_COMPARE_TREE_SAME:294294+ ASSERT(0);295295+ result_string = "unchanged";296296+ break;297297+ default:298298+ ASSERT(0);299299+ result_string = "unexpected";300300+ }301301+302302+ btrfs_err(sctx->send_root->fs_info,303303+ "Send: inconsistent snapshot, found %s %s for inode %llu without updated inode item, send root is %llu, parent root is %llu",304304+ result_string, what, sctx->cmp_key->objectid,305305+ sctx->send_root->root_key.objectid,306306+ (sctx->parent_root ?307307+ sctx->parent_root->root_key.objectid : 0));308308+}275309276310static int is_waiting_for_move(struct send_ctx *sctx, u64 ino);277311···18931861 * was already unlinked/moved, so we can safely assume that we will not18941862 * overwrite anything at this point in time.18951863 */18961896- if (other_inode > sctx->send_progress) {18641864+ if (other_inode > sctx->send_progress ||18651865+ is_waiting_for_move(sctx, other_inode)) {18971866 ret = get_inode_info(sctx->parent_root, other_inode, NULL,18981867 who_gen, NULL, NULL, NULL, NULL);18991868 if (ret < 0)···25352502 key.type = BTRFS_INODE_ITEM_KEY;25362503 key.offset = 0;25372504 ret = btrfs_search_slot(NULL, sctx->send_root, &key, path, 0, 0);25052505+ if (ret > 0)25062506+ ret = -ENOENT;25382507 if (ret < 0)25392508 goto out;25402509···29822947 }2983294829842949 if (loc.objectid > send_progress) {29502950+ struct orphan_dir_info *odi;29512951+29522952+ odi = get_orphan_dir_info(sctx, dir);29532953+ free_orphan_dir_info(sctx, odi);29852954 ret = 0;29862955 goto out;29872956 }···30863047 pm->parent_ino = parent_ino;30873048 pm->ino = ino;30883049 pm->gen = ino_gen;30893089- pm->is_orphan = is_orphan;30903050 INIT_LIST_HEAD(&pm->list);30913051 INIT_LIST_HEAD(&pm->update_refs);30923052 RB_CLEAR_NODE(&pm->node);···31513113 return NULL;31523114}3153311531163116+static int path_loop(struct send_ctx *sctx, struct fs_path *name,31173117+ u64 ino, u64 gen, u64 *ancestor_ino)31183118+{31193119+ int ret = 0;31203120+ u64 parent_inode = 0;31213121+ u64 parent_gen = 0;31223122+ u64 start_ino = ino;31233123+31243124+ *ancestor_ino = 0;31253125+ while (ino != BTRFS_FIRST_FREE_OBJECTID) {31263126+ fs_path_reset(name);31273127+31283128+ if (is_waiting_for_rm(sctx, ino))31293129+ break;31303130+ if (is_waiting_for_move(sctx, ino)) {31313131+ if (*ancestor_ino == 0)31323132+ *ancestor_ino = ino;31333133+ ret = get_first_ref(sctx->parent_root, ino,31343134+ &parent_inode, &parent_gen, name);31353135+ } else {31363136+ ret = __get_cur_name_and_parent(sctx, ino, gen,31373137+ &parent_inode,31383138+ &parent_gen, name);31393139+ if (ret > 0) {31403140+ ret = 0;31413141+ break;31423142+ }31433143+ }31443144+ if (ret < 0)31453145+ break;31463146+ if (parent_inode == start_ino) {31473147+ ret = 1;31483148+ if (*ancestor_ino == 0)31493149+ *ancestor_ino = ino;31503150+ break;31513151+ }31523152+ ino = parent_inode;31533153+ gen = parent_gen;31543154+ }31553155+ return ret;31563156+}31573157+31543158static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm)31553159{31563160 struct fs_path *from_path = NULL;···32033123 u64 parent_ino, parent_gen;32043124 struct waiting_dir_move *dm = NULL;32053125 u64 rmdir_ino = 0;31263126+ u64 ancestor;31273127+ bool is_orphan;32063128 int ret;3207312932083130 name = fs_path_alloc();···32173135 dm = get_waiting_dir_move(sctx, pm->ino);32183136 ASSERT(dm);32193137 rmdir_ino = dm->rmdir_ino;31383138+ is_orphan = dm->orphanized;32203139 free_waiting_dir_move(sctx, dm);3221314032223222- if (pm->is_orphan) {31413141+ if (is_orphan) {32233142 ret = gen_unique_name(sctx, pm->ino,32243143 pm->gen, from_path);32253144 } else {···32383155 goto out;3239315632403157 sctx->send_progress = sctx->cur_ino + 1;31583158+ ret = path_loop(sctx, name, pm->ino, pm->gen, &ancestor);31593159+ if (ret < 0)31603160+ goto out;31613161+ if (ret) {31623162+ LIST_HEAD(deleted_refs);31633163+ ASSERT(ancestor > BTRFS_FIRST_FREE_OBJECTID);31643164+ ret = add_pending_dir_move(sctx, pm->ino, pm->gen, ancestor,31653165+ &pm->update_refs, &deleted_refs,31663166+ is_orphan);31673167+ if (ret < 0)31683168+ goto out;31693169+ if (rmdir_ino) {31703170+ dm = get_waiting_dir_move(sctx, pm->ino);31713171+ ASSERT(dm);31723172+ dm->rmdir_ino = rmdir_ino;31733173+ }31743174+ goto out;31753175+ }32413176 fs_path_reset(name);32423177 to_path = name;32433178 name = NULL;···32753174 /* already deleted */32763175 goto finish;32773176 }32783278- ret = can_rmdir(sctx, rmdir_ino, odi->gen, sctx->cur_ino + 1);31773177+ ret = can_rmdir(sctx, rmdir_ino, odi->gen, sctx->cur_ino);32793178 if (ret < 0)32803179 goto out;32813180 if (!ret)···33053204 * and old parent(s).33063205 */33073206 list_for_each_entry(cur, &pm->update_refs, list) {33083308- if (cur->dir == rmdir_ino)32073207+ /*32083208+ * The parent inode might have been deleted in the send snapshot32093209+ */32103210+ ret = get_inode_info(sctx->send_root, cur->dir, NULL,32113211+ NULL, NULL, NULL, NULL, NULL);32123212+ if (ret == -ENOENT) {32133213+ ret = 0;33093214 continue;32153215+ }32163216+ if (ret < 0)32173217+ goto out;32183218+33103219 ret = send_utimes(sctx, cur->dir, cur->dir_gen);33113220 if (ret < 0)33123221 goto out;···34363325 u64 left_gen;34373326 u64 right_gen;34383327 int ret = 0;33283328+ struct waiting_dir_move *wdm;3439332934403330 if (RB_EMPTY_ROOT(&sctx->waiting_dir_moves))34413331 return 0;···34953383 goto out;34963384 }3497338534983498- if (is_waiting_for_move(sctx, di_key.objectid)) {33863386+ wdm = get_waiting_dir_move(sctx, di_key.objectid);33873387+ if (wdm && !wdm->orphanized) {34993388 ret = add_pending_dir_move(sctx,35003389 sctx->cur_ino,35013390 sctx->cur_inode_gen,···35833470 ret = is_ancestor(sctx->parent_root,35843471 sctx->cur_ino, sctx->cur_inode_gen,35853472 ino, path_before);35863586- break;34733473+ if (ret)34743474+ break;35873475 }3588347635893477 fs_path_reset(path_before);···37573643 goto out;37583644 if (ret) {37593645 struct name_cache_entry *nce;36463646+ struct waiting_dir_move *wdm;3760364737613648 ret = orphanize_inode(sctx, ow_inode, ow_gen,37623649 cur->full_path);37633650 if (ret < 0)37643651 goto out;36523652+36533653+ /*36543654+ * If ow_inode has its rename operation delayed36553655+ * make sure that its orphanized name is used in36563656+ * the source path when performing its rename36573657+ * operation.36583658+ */36593659+ if (is_waiting_for_move(sctx, ow_inode)) {36603660+ wdm = get_waiting_dir_move(sctx,36613661+ ow_inode);36623662+ ASSERT(wdm);36633663+ wdm->orphanized = true;36643664+ }36653665+37653666 /*37663667 * Make sure we clear our orphanized inode's37673668 * name from the name cache. This is because the···37923663 name_cache_delete(sctx, nce);37933664 kfree(nce);37943665 }36663666+36673667+ /*36683668+ * ow_inode might currently be an ancestor of36693669+ * cur_ino, therefore compute valid_path (the36703670+ * current path of cur_ino) again because it36713671+ * might contain the pre-orphanization name of36723672+ * ow_inode, which is no longer valid.36733673+ */36743674+ fs_path_reset(valid_path);36753675+ ret = get_cur_path(sctx, sctx->cur_ino,36763676+ sctx->cur_inode_gen, valid_path);36773677+ if (ret < 0)36783678+ goto out;37953679 } else {37963680 ret = send_unlink(sctx, cur->full_path);37973681 if (ret < 0)···57445602{57455603 int ret = 0;5746560457475747- BUG_ON(sctx->cur_ino != sctx->cmp_key->objectid);56055605+ if (sctx->cur_ino != sctx->cmp_key->objectid) {56065606+ inconsistent_snapshot_error(sctx, result, "reference");56075607+ return -EIO;56085608+ }5748560957495610 if (!sctx->cur_inode_new_gen &&57505611 sctx->cur_ino != BTRFS_FIRST_FREE_OBJECTID) {···57725627{57735628 int ret = 0;5774562957755775- BUG_ON(sctx->cur_ino != sctx->cmp_key->objectid);56305630+ if (sctx->cur_ino != sctx->cmp_key->objectid) {56315631+ inconsistent_snapshot_error(sctx, result, "xattr");56325632+ return -EIO;56335633+ }5776563457775635 if (!sctx->cur_inode_new_gen && !sctx->cur_inode_deleted) {57785636 if (result == BTRFS_COMPARE_TREE_NEW)···57995651{58005652 int ret = 0;5801565358025802- BUG_ON(sctx->cur_ino != sctx->cmp_key->objectid);56545654+ if (sctx->cur_ino != sctx->cmp_key->objectid) {56555655+ inconsistent_snapshot_error(sctx, result, "extent");56565656+ return -EIO;56575657+ }5803565858045659 if (!sctx->cur_inode_new_gen && !sctx->cur_inode_deleted) {58055660 if (result != BTRFS_COMPARE_TREE_DELETED)
+77-8
fs/btrfs/tree-log.c
···44694469static int btrfs_check_ref_name_override(struct extent_buffer *eb,44704470 const int slot,44714471 const struct btrfs_key *key,44724472- struct inode *inode)44724472+ struct inode *inode,44734473+ u64 *other_ino)44734474{44744475 int ret;44754476 struct btrfs_path *search_path;···45294528 search_path, parent,45304529 name, this_name_len, 0);45314530 if (di && !IS_ERR(di)) {45324532- ret = 1;45314531+ struct btrfs_key di_key;45324532+45334533+ btrfs_dir_item_key_to_cpu(search_path->nodes[0],45344534+ di, &di_key);45354535+ if (di_key.type == BTRFS_INODE_ITEM_KEY) {45364536+ ret = 1;45374537+ *other_ino = di_key.objectid;45384538+ } else {45394539+ ret = -EAGAIN;45404540+ }45334541 goto out;45344542 } else if (IS_ERR(di)) {45354543 ret = PTR_ERR(di);···47324722 if ((min_key.type == BTRFS_INODE_REF_KEY ||47334723 min_key.type == BTRFS_INODE_EXTREF_KEY) &&47344724 BTRFS_I(inode)->generation == trans->transid) {47254725+ u64 other_ino = 0;47264726+47354727 ret = btrfs_check_ref_name_override(path->nodes[0],47364728 path->slots[0],47374737- &min_key, inode);47294729+ &min_key, inode,47304730+ &other_ino);47384731 if (ret < 0) {47394732 err = ret;47404733 goto out_unlock;47414734 } else if (ret > 0) {47424742- err = 1;47434743- btrfs_set_log_full_commit(root->fs_info, trans);47444744- goto out_unlock;47354735+ struct btrfs_key inode_key;47364736+ struct inode *other_inode;47374737+47384738+ if (ins_nr > 0) {47394739+ ins_nr++;47404740+ } else {47414741+ ins_nr = 1;47424742+ ins_start_slot = path->slots[0];47434743+ }47444744+ ret = copy_items(trans, inode, dst_path, path,47454745+ &last_extent, ins_start_slot,47464746+ ins_nr, inode_only,47474747+ logged_isize);47484748+ if (ret < 0) {47494749+ err = ret;47504750+ goto out_unlock;47514751+ }47524752+ ins_nr = 0;47534753+ btrfs_release_path(path);47544754+ inode_key.objectid = other_ino;47554755+ inode_key.type = BTRFS_INODE_ITEM_KEY;47564756+ inode_key.offset = 0;47574757+ other_inode = btrfs_iget(root->fs_info->sb,47584758+ &inode_key, root,47594759+ NULL);47604760+ /*47614761+ * If the other inode that had a conflicting dir47624762+ * entry was deleted in the current transaction,47634763+ * we don't need to do more work nor fallback to47644764+ * a transaction commit.47654765+ */47664766+ if (IS_ERR(other_inode) &&47674767+ PTR_ERR(other_inode) == -ENOENT) {47684768+ goto next_key;47694769+ } else if (IS_ERR(other_inode)) {47704770+ err = PTR_ERR(other_inode);47714771+ goto out_unlock;47724772+ }47734773+ /*47744774+ * We are safe logging the other inode without47754775+ * acquiring its i_mutex as long as we log with47764776+ * the LOG_INODE_EXISTS mode. We're safe against47774777+ * concurrent renames of the other inode as well47784778+ * because during a rename we pin the log and47794779+ * update the log with the new name before we47804780+ * unpin it.47814781+ */47824782+ err = btrfs_log_inode(trans, root, other_inode,47834783+ LOG_INODE_EXISTS,47844784+ 0, LLONG_MAX, ctx);47854785+ iput(other_inode);47864786+ if (err)47874787+ goto out_unlock;47884788+ else47894789+ goto next_key;47454790 }47464791 }47474792···48644799 ins_nr = 0;48654800 }48664801 btrfs_release_path(path);48674867-48024802+next_key:48684803 if (min_key.offset < (u64)-1) {48694804 min_key.offset++;48704805 } else if (min_key.type < max_key.type) {···50584993 if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)50594994 break;5060499550615061- if (IS_ROOT(parent))49964996+ if (IS_ROOT(parent)) {49974997+ inode = d_inode(parent);49984998+ if (btrfs_must_commit_transaction(trans, inode))49994999+ ret = 1;50625000 break;50015001+ }5063500250645003 parent = dget_parent(parent);50655004 dput(old_parent);
···19491949{19501950 struct backing_dev_info *bdi;1951195119521952+ /*19531953+ * If we are expecting writeback progress we must submit plugged IO.19541954+ */19551955+ if (blk_needs_flush_plug(current))19561956+ blk_schedule_flush_plug(current);19571957+19521958 if (!nr_pages)19531959 nr_pages = get_nr_dirty_pages();19541960
+2
fs/nfs/nfs42proc.c
···338338 case 0:339339 break;340340 case -NFS4ERR_EXPIRED:341341+ case -NFS4ERR_ADMIN_REVOKED:342342+ case -NFS4ERR_DELEG_REVOKED:341343 case -NFS4ERR_STALE_STATEID:342344 case -NFS4ERR_OLD_STATEID:343345 case -NFS4ERR_BAD_STATEID:
···136136 cancel_delayed_work_sync(&clp->cl_renewd);137137}138138139139+/**140140+ * nfs4_set_lease_period - Sets the lease period on a nfs_client141141+ *142142+ * @clp: pointer to nfs_client143143+ * @lease: new value for lease period144144+ * @lastrenewed: time at which lease was last renewed145145+ */146146+void nfs4_set_lease_period(struct nfs_client *clp,147147+ unsigned long lease,148148+ unsigned long lastrenewed)149149+{150150+ spin_lock(&clp->cl_lock);151151+ clp->cl_lease_time = lease;152152+ clp->cl_last_renewal = lastrenewed;153153+ spin_unlock(&clp->cl_lock);154154+155155+ /* Cap maximum reconnect timeout at 1/2 lease period */156156+ rpc_cap_max_reconnect_timeout(clp->cl_rpcclient, lease >> 1);157157+}158158+139159/*140160 * Local variables:141161 * c-basic-offset: 8
+3-6
fs/nfs/nfs4state.c
···277277{278278 int status;279279 struct nfs_fsinfo fsinfo;280280+ unsigned long now;280281281282 if (!test_bit(NFS_CS_CHECK_LEASE_TIME, &clp->cl_res_state)) {282283 nfs4_schedule_state_renewal(clp);283284 return 0;284285 }285286287287+ now = jiffies;286288 status = nfs4_proc_get_lease_time(clp, &fsinfo);287289 if (status == 0) {288288- /* Update lease time and schedule renewal */289289- spin_lock(&clp->cl_lock);290290- clp->cl_lease_time = fsinfo.lease_time * HZ;291291- clp->cl_last_renewal = jiffies;292292- spin_unlock(&clp->cl_lock);293293-290290+ nfs4_set_lease_period(clp, fsinfo.lease_time * HZ, now);294291 nfs4_schedule_state_renewal(clp);295292 }296293
+48-17
fs/nfsd/nfs4state.c
···49034903 return nfs_ok;49044904}4905490549064906+static __be3249074907+nfsd4_free_lock_stateid(stateid_t *stateid, struct nfs4_stid *s)49084908+{49094909+ struct nfs4_ol_stateid *stp = openlockstateid(s);49104910+ __be32 ret;49114911+49124912+ mutex_lock(&stp->st_mutex);49134913+49144914+ ret = check_stateid_generation(stateid, &s->sc_stateid, 1);49154915+ if (ret)49164916+ goto out;49174917+49184918+ ret = nfserr_locks_held;49194919+ if (check_for_locks(stp->st_stid.sc_file,49204920+ lockowner(stp->st_stateowner)))49214921+ goto out;49224922+49234923+ release_lock_stateid(stp);49244924+ ret = nfs_ok;49254925+49264926+out:49274927+ mutex_unlock(&stp->st_mutex);49284928+ nfs4_put_stid(s);49294929+ return ret;49304930+}49314931+49064932__be3249074933nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,49084934 struct nfsd4_free_stateid *free_stateid)···49364910 stateid_t *stateid = &free_stateid->fr_stateid;49374911 struct nfs4_stid *s;49384912 struct nfs4_delegation *dp;49394939- struct nfs4_ol_stateid *stp;49404913 struct nfs4_client *cl = cstate->session->se_client;49414914 __be32 ret = nfserr_bad_stateid;49424915···49544929 ret = nfserr_locks_held;49554930 break;49564931 case NFS4_LOCK_STID:49574957- ret = check_stateid_generation(stateid, &s->sc_stateid, 1);49584958- if (ret)49594959- break;49604960- stp = openlockstateid(s);49614961- ret = nfserr_locks_held;49624962- if (check_for_locks(stp->st_stid.sc_file,49634963- lockowner(stp->st_stateowner)))49644964- break;49654965- WARN_ON(!unhash_lock_stateid(stp));49324932+ atomic_inc(&s->sc_count);49664933 spin_unlock(&cl->cl_lock);49674967- nfs4_put_stid(s);49684968- ret = nfs_ok;49344934+ ret = nfsd4_free_lock_stateid(stateid, s);49694935 goto out;49704936 case NFS4_REVOKED_DELEG_STID:49714937 dp = delegstateid(s);···55235507lookup_or_create_lock_state(struct nfsd4_compound_state *cstate,55245508 struct nfs4_ol_stateid *ost,55255509 struct nfsd4_lock *lock,55265526- struct nfs4_ol_stateid **lst, bool *new)55105510+ struct nfs4_ol_stateid **plst, bool *new)55275511{55285512 __be32 status;55295513 struct nfs4_file *fi = ost->st_stid.sc_file;···55315515 struct nfs4_client *cl = oo->oo_owner.so_client;55325516 struct inode *inode = d_inode(cstate->current_fh.fh_dentry);55335517 struct nfs4_lockowner *lo;55185518+ struct nfs4_ol_stateid *lst;55345519 unsigned int strhashval;55205520+ bool hashed;5535552155365522 lo = find_lockowner_str(cl, &lock->lk_new_owner);55375523 if (!lo) {···55495531 goto out;55505532 }5551553355525552- *lst = find_or_create_lock_stateid(lo, fi, inode, ost, new);55535553- if (*lst == NULL) {55345534+retry:55355535+ lst = find_or_create_lock_stateid(lo, fi, inode, ost, new);55365536+ if (lst == NULL) {55545537 status = nfserr_jukebox;55555538 goto out;55565539 }55405540+55415541+ mutex_lock(&lst->st_mutex);55425542+55435543+ /* See if it's still hashed to avoid race with FREE_STATEID */55445544+ spin_lock(&cl->cl_lock);55455545+ hashed = !list_empty(&lst->st_perfile);55465546+ spin_unlock(&cl->cl_lock);55475547+55485548+ if (!hashed) {55495549+ mutex_unlock(&lst->st_mutex);55505550+ nfs4_put_stid(&lst->st_stid);55515551+ goto retry;55525552+ }55575553 status = nfs_ok;55545554+ *plst = lst;55585555out:55595556 nfs4_put_stateowner(&lo->lo_owner);55605557 return status;···56365603 goto out;56375604 status = lookup_or_create_lock_state(cstate, open_stp, lock,56385605 &lock_stp, &new);56395639- if (status == nfs_ok)56405640- mutex_lock(&lock_stp->st_mutex);56415606 } else {56425607 status = nfs4_preprocess_seqid_op(cstate,56435608 lock->lk_old_lock_seqid,
+6-3
fs/nfsd/vfs.c
···12521252 if (IS_ERR(dchild))12531253 return nfserrno(host_err);12541254 err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);12551255- if (err) {12561256- dput(dchild);12551255+ /*12561256+ * We unconditionally drop our ref to dchild as fh_compose will have12571257+ * already grabbed its own ref for it.12581258+ */12591259+ dput(dchild);12601260+ if (err)12571261 return err;12581258- }12591262 return nfsd_create_locked(rqstp, fhp, fname, flen, iap, type,12601263 rdev, resfhp);12611264}
+1-3
fs/pipe.c
···144144 struct page *page = buf->page;145145146146 if (page_count(page) == 1) {147147- if (memcg_kmem_enabled()) {147147+ if (memcg_kmem_enabled())148148 memcg_kmem_uncharge(page, 0);149149- __ClearPageKmemcg(page);150150- }151149 __SetPageLocked(page);152150 return 0;153151 }
···2525#include <asm-generic/qrwlock_types.h>26262727/*2828- * Writer states & reader shift and bias2828+ * Writer states & reader shift and bias.2929+ *3030+ * | +0 | +1 | +2 | +3 |3131+ * ----+----+----+----+----+3232+ * LE | 78 | 56 | 34 | 12 | 0x123456783333+ * ----+----+----+----+----+3434+ * | wr | rd |3535+ * +----+----+----+----+3636+ *3737+ * ----+----+----+----+----+3838+ * BE | 12 | 34 | 56 | 78 | 0x123456783939+ * ----+----+----+----+----+4040+ * | rd | wr |4141+ * +----+----+----+----+2942 */3043#define _QW_WAITING 1 /* A writer is waiting */3144#define _QW_LOCKED 0xff /* A writer holds the lock */···147134}148135149136/**137137+ * __qrwlock_write_byte - retrieve the write byte address of a queue rwlock138138+ * @lock : Pointer to queue rwlock structure139139+ * Return: the write byte address of a queue rwlock140140+ */141141+static inline u8 *__qrwlock_write_byte(struct qrwlock *lock)142142+{143143+ return (u8 *)lock + 3 * IS_BUILTIN(CONFIG_CPU_BIG_ENDIAN);144144+}145145+146146+/**150147 * queued_write_unlock - release write lock of a queue rwlock151148 * @lock : Pointer to queue rwlock structure152149 */153150static inline void queued_write_unlock(struct qrwlock *lock)154151{155155- smp_store_release((u8 *)&lock->cnts, 0);152152+ smp_store_release(__qrwlock_write_byte(lock), 0);156153}157154158155/*
+2-1
include/drm/ttm/ttm_bo_driver.h
···962962 *963963 * @bo: A pointer to a struct ttm_buffer_object.964964 * @evict: 1: This is an eviction. Don't try to pipeline.965965+ * @interruptible: Sleep interruptible if waiting.965966 * @no_wait_gpu: Return immediately if the GPU is busy.966967 * @new_mem: struct ttm_mem_reg indicating where to move.967968 *···977976 */978977979978extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,980980- bool evict, bool no_wait_gpu,979979+ bool evict, bool interruptible, bool no_wait_gpu,981980 struct ttm_mem_reg *new_mem);982981983982/**
···7474 "Attempted to advance past end of bvec iter\n");75757676 while (bytes) {7777- unsigned len = min(bytes, bvec_iter_len(bv, *iter));7777+ unsigned iter_len = bvec_iter_len(bv, *iter);7878+ unsigned len = min(bytes, iter_len);78797980 bytes -= len;8081 iter->bi_size -= len;
+12
include/linux/kvm_host.h
···11131113/* create, destroy, and name are mandatory */11141114struct kvm_device_ops {11151115 const char *name;11161116+11171117+ /*11181118+ * create is called holding kvm->lock and any operations not suitable11191119+ * to do while holding the lock should be deferred to init (see11201120+ * below).11211121+ */11161122 int (*create)(struct kvm_device *dev, u32 type);11231123+11241124+ /*11251125+ * init is called after create if create is successful and is called11261126+ * outside of holding kvm->lock.11271127+ */11281128+ void (*init)(struct kvm_device *dev);1117112911181130 /*11191131 * Destroy is responsible for freeing dev.
+178
include/linux/mfd/ac100.h
···11+/*22+ * Functions and registers to access AC100 codec / RTC combo IC.33+ *44+ * Copyright (C) 2016 Chen-Yu Tsai55+ *66+ * Chen-Yu Tsai <wens@csie.org>77+ *88+ * This program is free software; you can redistribute it and/or modify99+ * it under the terms of the GNU General Public License version 2 as1010+ * published by the Free Software Foundation.1111+ */1212+1313+#ifndef __LINUX_MFD_AC100_H1414+#define __LINUX_MFD_AC100_H1515+1616+#include <linux/regmap.h>1717+1818+struct ac100_dev {1919+ struct device *dev;2020+ struct regmap *regmap;2121+};2222+2323+/* Audio codec related registers */2424+#define AC100_CHIP_AUDIO_RST 0x002525+#define AC100_PLL_CTRL1 0x012626+#define AC100_PLL_CTRL2 0x022727+#define AC100_SYSCLK_CTRL 0x032828+#define AC100_MOD_CLK_ENA 0x042929+#define AC100_MOD_RST_CTRL 0x053030+#define AC100_I2S_SR_CTRL 0x063131+3232+/* I2S1 interface */3333+#define AC100_I2S1_CLK_CTRL 0x103434+#define AC100_I2S1_SND_OUT_CTRL 0x113535+#define AC100_I2S1_SND_IN_CTRL 0x123636+#define AC100_I2S1_MXR_SRC 0x133737+#define AC100_I2S1_VOL_CTRL1 0x143838+#define AC100_I2S1_VOL_CTRL2 0x153939+#define AC100_I2S1_VOL_CTRL3 0x164040+#define AC100_I2S1_VOL_CTRL4 0x174141+#define AC100_I2S1_MXR_GAIN 0x184242+4343+/* I2S2 interface */4444+#define AC100_I2S2_CLK_CTRL 0x204545+#define AC100_I2S2_SND_OUT_CTRL 0x214646+#define AC100_I2S2_SND_IN_CTRL 0x224747+#define AC100_I2S2_MXR_SRC 0x234848+#define AC100_I2S2_VOL_CTRL1 0x244949+#define AC100_I2S2_VOL_CTRL2 0x255050+#define AC100_I2S2_VOL_CTRL3 0x265151+#define AC100_I2S2_VOL_CTRL4 0x275252+#define AC100_I2S2_MXR_GAIN 0x285353+5454+/* I2S3 interface */5555+#define AC100_I2S3_CLK_CTRL 0x305656+#define AC100_I2S3_SND_OUT_CTRL 0x315757+#define AC100_I2S3_SND_IN_CTRL 0x325858+#define AC100_I2S3_SIG_PATH_CTRL 0x335959+6060+/* ADC digital controls */6161+#define AC100_ADC_DIG_CTRL 0x406262+#define AC100_ADC_VOL_CTRL 0x416363+6464+/* HMIC plug sensing / key detection */6565+#define AC100_HMIC_CTRL1 0x446666+#define AC100_HMIC_CTRL2 0x456767+#define AC100_HMIC_STATUS 0x466868+6969+/* DAC digital controls */7070+#define AC100_DAC_DIG_CTRL 0x487171+#define AC100_DAC_VOL_CTRL 0x497272+#define AC100_DAC_MXR_SRC 0x4c7373+#define AC100_DAC_MXR_GAIN 0x4d7474+7575+/* Analog controls */7676+#define AC100_ADC_APC_CTRL 0x507777+#define AC100_ADC_SRC 0x517878+#define AC100_ADC_SRC_BST_CTRL 0x527979+#define AC100_OUT_MXR_DAC_A_CTRL 0x538080+#define AC100_OUT_MXR_SRC 0x548181+#define AC100_OUT_MXR_SRC_BST 0x558282+#define AC100_HPOUT_CTRL 0x568383+#define AC100_ERPOUT_CTRL 0x578484+#define AC100_SPKOUT_CTRL 0x588585+#define AC100_LINEOUT_CTRL 0x598686+8787+/* ADC digital audio processing (high pass filter & auto gain control */8888+#define AC100_ADC_DAP_L_STA 0x808989+#define AC100_ADC_DAP_R_STA 0x819090+#define AC100_ADC_DAP_L_CTRL 0x829191+#define AC100_ADC_DAP_R_CTRL 0x839292+#define AC100_ADC_DAP_L_T_L 0x84 /* Left Target Level */9393+#define AC100_ADC_DAP_R_T_L 0x85 /* Right Target Level */9494+#define AC100_ADC_DAP_L_H_A_C 0x86 /* Left High Avg. Coef */9595+#define AC100_ADC_DAP_L_L_A_C 0x87 /* Left Low Avg. Coef */9696+#define AC100_ADC_DAP_R_H_A_C 0x88 /* Right High Avg. Coef */9797+#define AC100_ADC_DAP_R_L_A_C 0x89 /* Right Low Avg. Coef */9898+#define AC100_ADC_DAP_L_D_T 0x8a /* Left Decay Time */9999+#define AC100_ADC_DAP_L_A_T 0x8b /* Left Attack Time */100100+#define AC100_ADC_DAP_R_D_T 0x8c /* Right Decay Time */101101+#define AC100_ADC_DAP_R_A_T 0x8d /* Right Attack Time */102102+#define AC100_ADC_DAP_N_TH 0x8e /* Noise Threshold */103103+#define AC100_ADC_DAP_L_H_N_A_C 0x8f /* Left High Noise Avg. Coef */104104+#define AC100_ADC_DAP_L_L_N_A_C 0x90 /* Left Low Noise Avg. Coef */105105+#define AC100_ADC_DAP_R_H_N_A_C 0x91 /* Right High Noise Avg. Coef */106106+#define AC100_ADC_DAP_R_L_N_A_C 0x92 /* Right Low Noise Avg. Coef */107107+#define AC100_ADC_DAP_H_HPF_C 0x93 /* High High-Pass-Filter Coef */108108+#define AC100_ADC_DAP_L_HPF_C 0x94 /* Low High-Pass-Filter Coef */109109+#define AC100_ADC_DAP_OPT 0x95 /* AGC Optimum */110110+111111+/* DAC digital audio processing (high pass filter & dynamic range control) */112112+#define AC100_DAC_DAP_CTRL 0xa0113113+#define AC100_DAC_DAP_H_HPF_C 0xa1 /* High High-Pass-Filter Coef */114114+#define AC100_DAC_DAP_L_HPF_C 0xa2 /* Low High-Pass-Filter Coef */115115+#define AC100_DAC_DAP_L_H_E_A_C 0xa3 /* Left High Energy Avg Coef */116116+#define AC100_DAC_DAP_L_L_E_A_C 0xa4 /* Left Low Energy Avg Coef */117117+#define AC100_DAC_DAP_R_H_E_A_C 0xa5 /* Right High Energy Avg Coef */118118+#define AC100_DAC_DAP_R_L_E_A_C 0xa6 /* Right Low Energy Avg Coef */119119+#define AC100_DAC_DAP_H_G_D_T_C 0xa7 /* High Gain Delay Time Coef */120120+#define AC100_DAC_DAP_L_G_D_T_C 0xa8 /* Low Gain Delay Time Coef */121121+#define AC100_DAC_DAP_H_G_A_T_C 0xa9 /* High Gain Attack Time Coef */122122+#define AC100_DAC_DAP_L_G_A_T_C 0xaa /* Low Gain Attack Time Coef */123123+#define AC100_DAC_DAP_H_E_TH 0xab /* High Energy Threshold */124124+#define AC100_DAC_DAP_L_E_TH 0xac /* Low Energy Threshold */125125+#define AC100_DAC_DAP_H_G_K 0xad /* High Gain K parameter */126126+#define AC100_DAC_DAP_L_G_K 0xae /* Low Gain K parameter */127127+#define AC100_DAC_DAP_H_G_OFF 0xaf /* High Gain offset */128128+#define AC100_DAC_DAP_L_G_OFF 0xb0 /* Low Gain offset */129129+#define AC100_DAC_DAP_OPT 0xb1 /* DRC optimum */130130+131131+/* Digital audio processing enable */132132+#define AC100_ADC_DAP_ENA 0xb4133133+#define AC100_DAC_DAP_ENA 0xb5134134+135135+/* SRC control */136136+#define AC100_SRC1_CTRL1 0xb8137137+#define AC100_SRC1_CTRL2 0xb9138138+#define AC100_SRC1_CTRL3 0xba139139+#define AC100_SRC1_CTRL4 0xbb140140+#define AC100_SRC2_CTRL1 0xbc141141+#define AC100_SRC2_CTRL2 0xbd142142+#define AC100_SRC2_CTRL3 0xbe143143+#define AC100_SRC2_CTRL4 0xbf144144+145145+/* RTC clk control */146146+#define AC100_CLK32K_ANALOG_CTRL 0xc0147147+#define AC100_CLKOUT_CTRL1 0xc1148148+#define AC100_CLKOUT_CTRL2 0xc2149149+#define AC100_CLKOUT_CTRL3 0xc3150150+151151+/* RTC module */152152+#define AC100_RTC_RST 0xc6153153+#define AC100_RTC_CTRL 0xc7154154+#define AC100_RTC_SEC 0xc8 /* second */155155+#define AC100_RTC_MIN 0xc9 /* minute */156156+#define AC100_RTC_HOU 0xca /* hour */157157+#define AC100_RTC_WEE 0xcb /* weekday */158158+#define AC100_RTC_DAY 0xcc /* day */159159+#define AC100_RTC_MON 0xcd /* month */160160+#define AC100_RTC_YEA 0xce /* year */161161+#define AC100_RTC_UPD 0xcf /* update trigger */162162+163163+/* RTC alarm */164164+#define AC100_ALM_INT_ENA 0xd0165165+#define AC100_ALM_INT_STA 0xd1166166+#define AC100_ALM_SEC 0xd8167167+#define AC100_ALM_MIN 0xd9168168+#define AC100_ALM_HOU 0xda169169+#define AC100_ALM_WEE 0xdb170170+#define AC100_ALM_DAY 0xdc171171+#define AC100_ALM_MON 0xdd172172+#define AC100_ALM_YEA 0xde173173+#define AC100_ALM_UPD 0xdf174174+175175+/* RTC general purpose register 0 ~ 15 */176176+#define AC100_RTC_GP(x) (0xe0 + (x))177177+178178+#endif /* __LINUX_MFD_AC100_H */
···109109 * should check msg.result for the EC's result code.110110 * @pkt_xfer: send packet to EC and get response111111 * @lock: one transaction at a time112112+ * @mkbp_event_supported: true if this EC supports the MKBP event protocol.113113+ * @event_notifier: interrupt event notifier for transport devices.114114+ * @event_data: raw payload transferred with the MKBP event.115115+ * @event_size: size in bytes of the event data.112116 */113117struct cros_ec_device {114118···141137 int (*pkt_xfer)(struct cros_ec_device *ec,142138 struct cros_ec_command *msg);143139 struct mutex lock;140140+ bool mkbp_event_supported;141141+ struct blocking_notifier_head event_notifier;142142+143143+ struct ec_response_get_next_event event_data;144144+ int event_size;144145};145146146147/* struct cros_ec_platform - ChromeOS EC platform information···277268 * @return 0 if ok, -ve on error278269 */279270int cros_ec_query_all(struct cros_ec_device *ec_dev);271271+272272+/**273273+ * cros_ec_get_next_event - Fetch next event from the ChromeOS EC274274+ *275275+ * @ec_dev: Device to fetch event from276276+ *277277+ * Returns: 0 on success, Linux error number on failure278278+ */279279+int cros_ec_get_next_event(struct cros_ec_device *ec_dev);280280281281/* sysfs stuff */282282extern struct attribute_group cros_ec_attr_group;
+34
include/linux/mfd/cros_ec_commands.h
···17931793 };17941794} __packed;1795179517961796+/*17971797+ * Command for retrieving the next pending MKBP event from the EC device17981798+ *17991799+ * The device replies with UNAVAILABLE if there aren't any pending events.18001800+ */18011801+#define EC_CMD_GET_NEXT_EVENT 0x6718021802+18031803+enum ec_mkbp_event {18041804+ /* Keyboard matrix changed. The event data is the new matrix state. */18051805+ EC_MKBP_EVENT_KEY_MATRIX = 0,18061806+18071807+ /* New host event. The event data is 4 bytes of host event flags. */18081808+ EC_MKBP_EVENT_HOST_EVENT = 1,18091809+18101810+ /* New Sensor FIFO data. The event data is fifo_info structure. */18111811+ EC_MKBP_EVENT_SENSOR_FIFO = 2,18121812+18131813+ /* Number of MKBP events */18141814+ EC_MKBP_EVENT_COUNT,18151815+};18161816+18171817+union ec_response_get_next_data {18181818+ uint8_t key_matrix[13];18191819+18201820+ /* Unaligned */18211821+ uint32_t host_event;18221822+} __packed;18231823+18241824+struct ec_response_get_next_event {18251825+ uint8_t event_type;18261826+ /* Followed by event data if any */18271827+ union ec_response_get_next_data data;18281828+} __packed;18291829+17961830/*****************************************************************************/17971831/* Temperature sensor commands */17981832
+269
include/linux/mfd/lp873x.h
···11+/*22+ * Functions to access LP873X power management chip.33+ *44+ * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/55+ *66+ * This program is free software; you can redistribute it and/or77+ * modify it under the terms of the GNU General Public License as88+ * published by the Free Software Foundation version 2.99+ *1010+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any1111+ * kind, whether express or implied; without even the implied warranty1212+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313+ * GNU General Public License for more details.1414+ */1515+1616+#ifndef __LINUX_MFD_LP873X_H1717+#define __LINUX_MFD_LP873X_H1818+1919+#include <linux/i2c.h>2020+#include <linux/regulator/driver.h>2121+#include <linux/regulator/machine.h>2222+2323+/* LP873x chip id list */2424+#define LP873X 0x002525+2626+/* All register addresses */2727+#define LP873X_REG_DEV_REV 0X002828+#define LP873X_REG_OTP_REV 0X012929+#define LP873X_REG_BUCK0_CTRL_1 0X023030+#define LP873X_REG_BUCK0_CTRL_2 0X033131+#define LP873X_REG_BUCK1_CTRL_1 0X043232+#define LP873X_REG_BUCK1_CTRL_2 0X053333+#define LP873X_REG_BUCK0_VOUT 0X063434+#define LP873X_REG_BUCK1_VOUT 0X073535+#define LP873X_REG_LDO0_CTRL 0X083636+#define LP873X_REG_LDO1_CTRL 0X093737+#define LP873X_REG_LDO0_VOUT 0X0A3838+#define LP873X_REG_LDO1_VOUT 0X0B3939+#define LP873X_REG_BUCK0_DELAY 0X0C4040+#define LP873X_REG_BUCK1_DELAY 0X0D4141+#define LP873X_REG_LDO0_DELAY 0X0E4242+#define LP873X_REG_LDO1_DELAY 0X0F4343+#define LP873X_REG_GPO_DELAY 0X104444+#define LP873X_REG_GPO2_DELAY 0X114545+#define LP873X_REG_GPO_CTRL 0X124646+#define LP873X_REG_CONFIG 0X134747+#define LP873X_REG_PLL_CTRL 0X144848+#define LP873X_REG_PGOOD_CTRL1 0X154949+#define LP873X_REG_PGOOD_CTRL2 0X165050+#define LP873X_REG_PG_FAULT 0X175151+#define LP873X_REG_RESET 0X185252+#define LP873X_REG_INT_TOP_1 0X195353+#define LP873X_REG_INT_TOP_2 0X1A5454+#define LP873X_REG_INT_BUCK 0X1B5555+#define LP873X_REG_INT_LDO 0X1C5656+#define LP873X_REG_TOP_STAT 0X1D5757+#define LP873X_REG_BUCK_STAT 0X1E5858+#define LP873X_REG_LDO_STAT 0x1F5959+#define LP873X_REG_TOP_MASK_1 0x206060+#define LP873X_REG_TOP_MASK_2 0x216161+#define LP873X_REG_BUCK_MASK 0x226262+#define LP873X_REG_LDO_MASK 0x236363+#define LP873X_REG_SEL_I_LOAD 0x246464+#define LP873X_REG_I_LOAD_2 0x256565+#define LP873X_REG_I_LOAD_1 0x266666+6767+#define LP873X_REG_MAX LP873X_REG_I_LOAD_16868+6969+/* Register field definitions */7070+#define LP873X_DEV_REV_DEV_ID 0xC07171+#define LP873X_DEV_REV_ALL_LAYER 0x307272+#define LP873X_DEV_REV_METAL_LAYER 0x0F7373+7474+#define LP873X_OTP_REV_OTP_ID 0xFF7575+7676+#define LP873X_BUCK0_CTRL_1_BUCK0_FPWM BIT(3)7777+#define LP873X_BUCK0_CTRL_1_BUCK0_RDIS_EN BIT(2)7878+#define LP873X_BUCK0_CTRL_1_BUCK0_EN_PIN_CTRL BIT(1)7979+#define LP873X_BUCK0_CTRL_1_BUCK0_EN BIT(0)8080+8181+#define LP873X_BUCK0_CTRL_2_BUCK0_ILIM 0x388282+#define LP873X_BUCK0_CTRL_2_BUCK0_SLEW_RATE 0x078383+8484+#define LP873X_BUCK1_CTRL_1_BUCK1_FPWM BIT(3)8585+#define LP873X_BUCK1_CTRL_1_BUCK1_RDIS_EN BIT(2)8686+#define LP873X_BUCK1_CTRL_1_BUCK1_EN_PIN_CTRL BIT(1)8787+#define LP873X_BUCK1_CTRL_1_BUCK1_EN BIT(0)8888+8989+#define LP873X_BUCK1_CTRL_2_BUCK1_ILIM 0x389090+#define LP873X_BUCK1_CTRL_2_BUCK1_SLEW_RATE 0x079191+9292+#define LP873X_BUCK0_VOUT_BUCK0_VSET 0xFF9393+9494+#define LP873X_BUCK1_VOUT_BUCK1_VSET 0xFF9595+9696+#define LP873X_LDO0_CTRL_LDO0_RDIS_EN BIT(2)9797+#define LP873X_LDO0_CTRL_LDO0_EN_PIN_CTRL BIT(1)9898+#define LP873X_LDO0_CTRL_LDO0_EN BIT(0)9999+100100+#define LP873X_LDO1_CTRL_LDO1_RDIS_EN BIT(2)101101+#define LP873X_LDO1_CTRL_LDO1_EN_PIN_CTRL BIT(1)102102+#define LP873X_LDO1_CTRL_LDO1_EN BIT(0)103103+104104+#define LP873X_LDO0_VOUT_LDO0_VSET 0x1F105105+106106+#define LP873X_LDO1_VOUT_LDO1_VSET 0x1F107107+108108+#define LP873X_BUCK0_DELAY_BUCK0_SD_DELAY 0xF0109109+#define LP873X_BUCK0_DELAY_BUCK0_SU_DELAY 0x0F110110+111111+#define LP873X_BUCK1_DELAY_BUCK1_SD_DELAY 0xF0112112+#define LP873X_BUCK1_DELAY_BUCK1_SU_DELAY 0x0F113113+114114+#define LP873X_LDO0_DELAY_LDO0_SD_DELAY 0xF0115115+#define LP873X_LDO0_DELAY_LDO0_SU_DELAY 0x0F116116+117117+#define LP873X_LDO1_DELAY_LDO1_SD_DELAY 0xF0118118+#define LP873X_LDO1_DELAY_LDO1_SU_DELAY 0x0F119119+120120+#define LP873X_GPO_DELAY_GPO_SD_DELAY 0xF0121121+#define LP873X_GPO_DELAY_GPO_SU_DELAY 0x0F122122+123123+#define LP873X_GPO2_DELAY_GPO2_SD_DELAY 0xF0124124+#define LP873X_GPO2_DELAY_GPO2_SU_DELAY 0x0F125125+126126+#define LP873X_GPO_CTRL_GPO2_OD BIT(6)127127+#define LP873X_GPO_CTRL_GPO2_EN_PIN_CTRL BIT(5)128128+#define LP873X_GPO_CTRL_GPO2_EN BIT(4)129129+#define LP873X_GPO_CTRL_GPO_OD BIT(2)130130+#define LP873X_GPO_CTRL_GPO_EN_PIN_CTRL BIT(1)131131+#define LP873X_GPO_CTRL_GPO_EN BIT(0)132132+133133+#define LP873X_CONFIG_SU_DELAY_SEL BIT(6)134134+#define LP873X_CONFIG_SD_DELAY_SEL BIT(5)135135+#define LP873X_CONFIG_CLKIN_PIN_SEL BIT(4)136136+#define LP873X_CONFIG_CLKIN_PD BIT(3)137137+#define LP873X_CONFIG_EN_PD BIT(2)138138+#define LP873X_CONFIG_TDIE_WARN_LEVEL BIT(1)139139+#define LP873X_EN_SPREAD_SPEC BIT(0)140140+141141+#define LP873X_PLL_CTRL_EN_PLL BIT(6)142142+#define LP873X_EXT_CLK_FREQ 0x1F143143+144144+#define LP873X_PGOOD_CTRL1_PGOOD_POL BIT(7)145145+#define LP873X_PGOOD_CTRL1_PGOOD_OD BIT(6)146146+#define LP873X_PGOOD_CTRL1_PGOOD_WINDOW_LDO BIT(5)147147+#define LP873X_PGOOD_CTRL1_PGOOD_WINDOWN_BUCK BIT(4)148148+#define LP873X_PGOOD_CTRL1_PGOOD_EN_PGOOD_LDO1 BIT(3)149149+#define LP873X_PGOOD_CTRL1_PGOOD_EN_PGOOD_LDO0 BIT(2)150150+#define LP873X_PGOOD_CTRL1_PGOOD_EN_PGOOD_BUCK1 BIT(1)151151+#define LP873X_PGOOD_CTRL1_PGOOD_EN_PGOOD_BUCK0 BIT(0)152152+153153+#define LP873X_PGOOD_CTRL2_EN_PGOOD_TWARN BIT(2)154154+#define LP873X_PGOOD_CTRL2_EN_PG_FAULT_GATE BIT(1)155155+#define LP873X_PGOOD_CTRL2_PGOOD_MODE BIT(0)156156+157157+#define LP873X_PG_FAULT_PG_FAULT_LDO1 BIT(3)158158+#define LP873X_PG_FAULT_PG_FAULT_LDO0 BIT(2)159159+#define LP873X_PG_FAULT_PG_FAULT_BUCK1 BIT(1)160160+#define LP873X_PG_FAULT_PG_FAULT_BUCK0 BIT(0)161161+162162+#define LP873X_RESET_SW_RESET BIT(0)163163+164164+#define LP873X_INT_TOP_1_PGOOD_INT BIT(7)165165+#define LP873X_INT_TOP_1_LDO_INT BIT(6)166166+#define LP873X_INT_TOP_1_BUCK_INT BIT(5)167167+#define LP873X_INT_TOP_1_SYNC_CLK_INT BIT(4)168168+#define LP873X_INT_TOP_1_TDIE_SD_INT BIT(3)169169+#define LP873X_INT_TOP_1_TDIE_WARN_INT BIT(2)170170+#define LP873X_INT_TOP_1_OVP_INT BIT(1)171171+#define LP873X_INT_TOP_1_I_MEAS_INT BIT(0)172172+173173+#define LP873X_INT_TOP_2_RESET_REG_INT BIT(0)174174+175175+#define LP873X_INT_BUCK_BUCK1_PG_INT BIT(6)176176+#define LP873X_INT_BUCK_BUCK1_SC_INT BIT(5)177177+#define LP873X_INT_BUCK_BUCK1_ILIM_INT BIT(4)178178+#define LP873X_INT_BUCK_BUCK0_PG_INT BIT(2)179179+#define LP873X_INT_BUCK_BUCK0_SC_INT BIT(1)180180+#define LP873X_INT_BUCK_BUCK0_ILIM_INT BIT(0)181181+182182+#define LP873X_INT_LDO_LDO1_PG_INT BIT(6)183183+#define LP873X_INT_LDO_LDO1_SC_INT BIT(5)184184+#define LP873X_INT_LDO_LDO1_ILIM_INT BIT(4)185185+#define LP873X_INT_LDO_LDO0_PG_INT BIT(2)186186+#define LP873X_INT_LDO_LDO0_SC_INT BIT(1)187187+#define LP873X_INT_LDO_LDO0_ILIM_INT BIT(0)188188+189189+#define LP873X_TOP_STAT_PGOOD_STAT BIT(7)190190+#define LP873X_TOP_STAT_SYNC_CLK_STAT BIT(4)191191+#define LP873X_TOP_STAT_TDIE_SD_STAT BIT(3)192192+#define LP873X_TOP_STAT_TDIE_WARN_STAT BIT(2)193193+#define LP873X_TOP_STAT_OVP_STAT BIT(1)194194+195195+#define LP873X_BUCK_STAT_BUCK1_STAT BIT(7)196196+#define LP873X_BUCK_STAT_BUCK1_PG_STAT BIT(6)197197+#define LP873X_BUCK_STAT_BUCK1_ILIM_STAT BIT(4)198198+#define LP873X_BUCK_STAT_BUCK0_STAT BIT(3)199199+#define LP873X_BUCK_STAT_BUCK0_PG_STAT BIT(2)200200+#define LP873X_BUCK_STAT_BUCK0_ILIM_STAT BIT(0)201201+202202+#define LP873X_LDO_STAT_LDO1_STAT BIT(7)203203+#define LP873X_LDO_STAT_LDO1_PG_STAT BIT(6)204204+#define LP873X_LDO_STAT_LDO1_ILIM_STAT BIT(4)205205+#define LP873X_LDO_STAT_LDO0_STAT BIT(3)206206+#define LP873X_LDO_STAT_LDO0_PG_STAT BIT(2)207207+#define LP873X_LDO_STAT_LDO0_ILIM_STAT BIT(0)208208+209209+#define LP873X_TOP_MASK_1_PGOOD_INT_MASK BIT(7)210210+#define LP873X_TOP_MASK_1_SYNC_CLK_MASK BIT(4)211211+#define LP873X_TOP_MASK_1_TDIE_WARN_MASK BIT(2)212212+#define LP873X_TOP_MASK_1_I_MEAS_MASK BIT(0)213213+214214+#define LP873X_TOP_MASK_2_RESET_REG_MASK BIT(0)215215+216216+#define LP873X_BUCK_MASK_BUCK1_PGF_MASK BIT(7)217217+#define LP873X_BUCK_MASK_BUCK1_PGR_MASK BIT(6)218218+#define LP873X_BUCK_MASK_BUCK1_ILIM_MASK BIT(4)219219+#define LP873X_BUCK_MASK_BUCK0_PGF_MASK BIT(3)220220+#define LP873X_BUCK_MASK_BUCK0_PGR_MASK BIT(2)221221+#define LP873X_BUCK_MASK_BUCK0_ILIM_MASK BIT(0)222222+223223+#define LP873X_LDO_MASK_LDO1_PGF_MASK BIT(7)224224+#define LP873X_LDO_MASK_LDO1_PGR_MASK BIT(6)225225+#define LP873X_LDO_MASK_LDO1_ILIM_MASK BIT(4)226226+#define LP873X_LDO_MASK_LDO0_PGF_MASK BIT(3)227227+#define LP873X_LDO_MASK_LDO0_PGR_MASK BIT(2)228228+#define LP873X_LDO_MASK_LDO0_ILIM_MASK BIT(0)229229+230230+#define LP873X_SEL_I_LOAD_CURRENT_BUCK_SELECT BIT(0)231231+232232+#define LP873X_I_LOAD_2_BUCK_LOAD_CURRENT BIT(0)233233+234234+#define LP873X_I_LOAD_1_BUCK_LOAD_CURRENT 0xFF235235+236236+#define LP873X_MAX_REG_ID LP873X_LDO_1237237+238238+/* Number of step-down converters available */239239+#define LP873X_NUM_BUCK 2240240+/* Number of LDO voltage regulators available */241241+#define LP873X_NUM_LDO 2242242+/* Number of total regulators available */243243+#define LP873X_NUM_REGULATOR (LP873X_NUM_BUCK + LP873X_NUM_LDO)244244+245245+enum lp873x_regulator_id {246246+ /* BUCK's */247247+ LP873X_BUCK_0,248248+ LP873X_BUCK_1,249249+ /* LDOs */250250+ LP873X_LDO_0,251251+ LP873X_LDO_1,252252+};253253+254254+/**255255+ * struct lp873x - state holder for the lp873x driver256256+ * @dev: struct device pointer for MFD device257257+ * @rev: revision of the lp873x258258+ * @lock: lock guarding the data structure259259+ * @regmap: register map of the lp873x PMIC260260+ *261261+ * Device data may be used to access the LP873X chip262262+ */263263+struct lp873x {264264+ struct device *dev;265265+ u8 rev;266266+ struct mutex lock; /* lock guarding the data structure */267267+ struct regmap *regmap;268268+};269269+#endif /* __LINUX_MFD_LP873X_H */
···155155void kzfree(const void *);156156size_t ksize(const void *);157157158158+#ifdef CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR159159+const char *__check_heap_object(const void *ptr, unsigned long n,160160+ struct page *page);161161+#else162162+static inline const char *__check_heap_object(const void *ptr,163163+ unsigned long n,164164+ struct page *page)165165+{166166+ return NULL;167167+}168168+#endif169169+158170/*159171 * Some archs want to perform DMA into kmalloc caches and need a guaranteed160172 * alignment larger than the alignment of a 64-bit integer.
···114114#ifndef user_access_begin115115#define user_access_begin() do { } while (0)116116#define user_access_end() do { } while (0)117117-#define unsafe_get_user(x, ptr) __get_user(x, ptr)118118-#define unsafe_put_user(x, ptr) __put_user(x, ptr)117117+#define unsafe_get_user(x, ptr, err) do { if (unlikely(__get_user(x, ptr))) goto err; } while (0)118118+#define unsafe_put_user(x, ptr, err) do { if (unlikely(__put_user(x, ptr))) goto err; } while (0)119119#endif120120121121#endif /* __LINUX_UACCESS_H__ */
+11-3
include/trace/events/timer.h
···330330#ifdef CONFIG_NO_HZ_COMMON331331332332#define TICK_DEP_NAMES \333333- tick_dep_name(NONE) \333333+ tick_dep_mask_name(NONE) \334334 tick_dep_name(POSIX_TIMER) \335335 tick_dep_name(PERF_EVENTS) \336336 tick_dep_name(SCHED) \337337 tick_dep_name_end(CLOCK_UNSTABLE)338338339339#undef tick_dep_name340340+#undef tick_dep_mask_name340341#undef tick_dep_name_end341342342342-#define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);343343-#define tick_dep_name_end(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);343343+/* The MASK will convert to their bits and they need to be processed too */344344+#define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \345345+ TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);346346+#define tick_dep_name_end(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \347347+ TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);348348+/* NONE only has a mask defined for it */349349+#define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep);344350345351TICK_DEP_NAMES346352347353#undef tick_dep_name354354+#undef tick_dep_mask_name348355#undef tick_dep_name_end349356350357#define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },358358+#define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep },351359#define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep }352360353361#define show_tick_dep_name(val) \
···136136 *137137 * Of course the contents will be ABI, but that's up the AFU driver.138138 */139139- size_t data_size;140140- u8 data[];139139+ __u32 data_size;140140+ __u8 data[];141141};142142143143struct cxl_event {
+2
init/Kconfig
···1761176117621762config SLAB17631763 bool "SLAB"17641764+ select HAVE_HARDENED_USERCOPY_ALLOCATOR17641765 help17651766 The regular slab allocator that is established and known to work17661767 well in all environments. It organizes cache hot objects in···1769176817701769config SLUB17711770 bool "SLUB (Unqueued Allocator)"17711771+ select HAVE_HARDENED_USERCOPY_ALLOCATOR17721772 help17731773 SLUB is a slab allocator that minimizes cache line usage17741774 instead of managing queues of cached objects (SLAB approach).
+54-23
kernel/events/core.c
···843843 }844844 }845845}846846+847847+/*848848+ * Update cpuctx->cgrp so that it is set when first cgroup event is added and849849+ * cleared when last cgroup event is removed.850850+ */851851+static inline void852852+list_update_cgroup_event(struct perf_event *event,853853+ struct perf_event_context *ctx, bool add)854854+{855855+ struct perf_cpu_context *cpuctx;856856+857857+ if (!is_cgroup_event(event))858858+ return;859859+860860+ if (add && ctx->nr_cgroups++)861861+ return;862862+ else if (!add && --ctx->nr_cgroups)863863+ return;864864+ /*865865+ * Because cgroup events are always per-cpu events,866866+ * this will always be called from the right CPU.867867+ */868868+ cpuctx = __get_cpu_context(ctx);869869+ cpuctx->cgrp = add ? event->cgrp : NULL;870870+}871871+846872#else /* !CONFIG_CGROUP_PERF */847873848874static inline bool···946920 struct perf_event_context *ctx)947921{948922}923923+924924+static inline void925925+list_update_cgroup_event(struct perf_event *event,926926+ struct perf_event_context *ctx, bool add)927927+{928928+}929929+949930#endif950931951932/*···14251392static void14261393list_add_event(struct perf_event *event, struct perf_event_context *ctx)14271394{13951395+14281396 lockdep_assert_held(&ctx->lock);1429139714301398 WARN_ON_ONCE(event->attach_state & PERF_ATTACH_CONTEXT);···14461412 list_add_tail(&event->group_entry, list);14471413 }1448141414491449- if (is_cgroup_event(event))14501450- ctx->nr_cgroups++;14151415+ list_update_cgroup_event(event, ctx, true);1451141614521417 list_add_rcu(&event->event_entry, &ctx->event_list);14531418 ctx->nr_events++;···16141581static void16151582list_del_event(struct perf_event *event, struct perf_event_context *ctx)16161583{16171617- struct perf_cpu_context *cpuctx;16181618-16191584 WARN_ON_ONCE(event->ctx != ctx);16201585 lockdep_assert_held(&ctx->lock);16211586···1625159416261595 event->attach_state &= ~PERF_ATTACH_CONTEXT;1627159616281628- if (is_cgroup_event(event)) {16291629- ctx->nr_cgroups--;16301630- /*16311631- * Because cgroup events are always per-cpu events, this will16321632- * always be called from the right CPU.16331633- */16341634- cpuctx = __get_cpu_context(ctx);16351635- /*16361636- * If there are no more cgroup events then clear cgrp to avoid16371637- * stale pointer in update_cgrp_time_from_cpuctx().16381638- */16391639- if (!ctx->nr_cgroups)16401640- cpuctx->cgrp = NULL;16411641- }15971597+ list_update_cgroup_event(event, ctx, false);1642159816431599 ctx->nr_events--;16441600 if (event->attr.inherit_stat)···17341716static inline int17351717event_filter_match(struct perf_event *event)17361718{17371737- return (event->cpu == -1 || event->cpu == smp_processor_id())17381738- && perf_cgroup_match(event) && pmu_filter_match(event);17191719+ return (event->cpu == -1 || event->cpu == smp_processor_id()) &&17201720+ perf_cgroup_match(event) && pmu_filter_match(event);17391721}1740172217411723static void···17551737 * maintained, otherwise bogus information is return17561738 * via read() for time_enabled, time_running:17571739 */17581758- if (event->state == PERF_EVENT_STATE_INACTIVE17591759- && !event_filter_match(event)) {17401740+ if (event->state == PERF_EVENT_STATE_INACTIVE &&17411741+ !event_filter_match(event)) {17601742 delta = tstamp - event->tstamp_stopped;17611743 event->tstamp_running += delta;17621744 event->tstamp_stopped = tstamp;···2254223622552237 lockdep_assert_held(&ctx->mutex);2256223822572257- event->ctx = ctx;22582239 if (event->cpu != -1)22592240 event->cpu = cpu;22412241+22422242+ /*22432243+ * Ensures that if we can observe event->ctx, both the event and ctx22442244+ * will be 'complete'. See perf_iterate_sb_cpu().22452245+ */22462246+ smp_store_release(&event->ctx, ctx);2260224722612248 if (!task) {22622249 cpu_function_call(cpu, __perf_install_in_context, event);···59925969 struct perf_event *event;5993597059945971 list_for_each_entry_rcu(event, &pel->list, sb_list) {59725972+ /*59735973+ * Skip events that are not fully formed yet; ensure that59745974+ * if we observe event->ctx, both event and ctx will be59755975+ * complete enough. See perf_install_in_context().59765976+ */59775977+ if (!smp_load_acquire(&event->ctx))59785978+ continue;59795979+59955980 if (event->state < PERF_EVENT_STATE_INACTIVE)59965981 continue;59975982 if (!event_filter_match(event))
+22-1
kernel/futex.c
···179179 * Futex flags used to encode options to functions and preserve them across180180 * restarts.181181 */182182-#define FLAGS_SHARED 0x01182182+#ifdef CONFIG_MMU183183+# define FLAGS_SHARED 0x01184184+#else185185+/*186186+ * NOMMU does not have per process address space. Let the compiler optimize187187+ * code away.188188+ */189189+# define FLAGS_SHARED 0x00190190+#endif183191#define FLAGS_CLOCKRT 0x02184192#define FLAGS_HAS_TIMEOUT 0x04185193···413405 if (!key->both.ptr)414406 return;415407408408+ /*409409+ * On MMU less systems futexes are always "private" as there is no per410410+ * process address space. We need the smp wmb nevertheless - yes,411411+ * arch/blackfin has MMU less SMP ...412412+ */413413+ if (!IS_ENABLED(CONFIG_MMU)) {414414+ smp_mb(); /* explicit smp_mb(); (B) */415415+ return;416416+ }417417+416418 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {417419 case FUT_OFF_INODE:418420 ihold(key->shared.inode); /* implies smp_mb(); (B) */···453435 WARN_ON_ONCE(1);454436 return;455437 }438438+439439+ if (!IS_ENABLED(CONFIG_MMU))440440+ return;456441457442 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {458443 case FUT_OFF_INODE:
+11
kernel/irq/msi.c
···359359 else360360 dev_dbg(dev, "irq [%d-%d] for MSI\n",361361 virq, virq + desc->nvec_used - 1);362362+ /*363363+ * This flag is set by the PCI layer as we need to activate364364+ * the MSI entries before the PCI layer enables MSI in the365365+ * card. Otherwise the card latches a random msi message.366366+ */367367+ if (info->flags & MSI_FLAG_ACTIVATE_EARLY) {368368+ struct irq_data *irq_data;369369+370370+ irq_data = irq_domain_get_irq_data(domain, desc->irq);371371+ irq_domain_activate_irq(irq_data);372372+ }362373 }363374364375 return 0;
···5858 * one writer running. But the buffer might get flushed from another5959 * CPU, so we need to be careful.6060 */6161-static int vprintk_nmi(int level, const char *fmt, va_list args)6161+static int vprintk_nmi(const char *fmt, va_list args)6262{6363 struct nmi_seq_buf *s = this_cpu_ptr(&nmi_print_seq);6464 int add = 0;···7979 if (!len)8080 smp_rmb();81818282- if (level != LOGLEVEL_DEFAULT) {8383- add = snprintf(s->buffer + len, sizeof(s->buffer) - len,8484- KERN_SOH "%c", '0' + level);8585- add += vsnprintf(s->buffer + len + add,8686- sizeof(s->buffer) - len - add,8787- fmt, args);8888- } else {8989- add = vsnprintf(s->buffer + len, sizeof(s->buffer) - len,9090- fmt, args);9191- }8282+ add = vsnprintf(s->buffer + len, sizeof(s->buffer) - len, fmt, args);92839384 /*9485 * Do it once again if the buffer has been flushed in the meantime.
···7474#include <linux/context_tracking.h>7575#include <linux/compiler.h>7676#include <linux/frame.h>7777+#include <linux/prefetch.h>77787879#include <asm/switch_to.h>7980#include <asm/tlb.h>···29732972EXPORT_PER_CPU_SYMBOL(kernel_cpustat);2974297329752974/*29752975+ * The function fair_sched_class.update_curr accesses the struct curr29762976+ * and its field curr->exec_start; when called from task_sched_runtime(),29772977+ * we observe a high rate of cache misses in practice.29782978+ * Prefetching this data results in improved performance.29792979+ */29802980+static inline void prefetch_curr_exec_start(struct task_struct *p)29812981+{29822982+#ifdef CONFIG_FAIR_GROUP_SCHED29832983+ struct sched_entity *curr = (&p->se)->cfs_rq->curr;29842984+#else29852985+ struct sched_entity *curr = (&task_rq(p)->cfs)->curr;29862986+#endif29872987+ prefetch(curr);29882988+ prefetch(&curr->exec_start);29892989+}29902990+29912991+/*29762992 * Return accounted runtime for the task.29772993 * In case the task is currently running, return the runtime plus current's29782994 * pending runtime that have not been accounted yet.···30233005 * thread, breaking clock_gettime().30243006 */30253007 if (task_current(rq, p) && task_on_rq_queued(p)) {30083008+ prefetch_curr_exec_start(p);30263009 update_rq_clock(rq);30273010 p->sched_class->update_curr(rq);30283011 }
···508508 */509509void account_idle_ticks(unsigned long ticks)510510{511511+ cputime_t cputime, steal;511512512513 if (sched_clock_irqtime) {513514 irqtime_account_idle_ticks(ticks);514515 return;515516 }516517517517- account_idle_time(jiffies_to_cputime(ticks));518518+ cputime = jiffies_to_cputime(ticks);519519+ steal = steal_account_process_time(cputime);520520+521521+ if (steal >= cputime)522522+ return;523523+524524+ cputime -= steal;525525+ account_idle_time(cputime);518526}519527520528/*
+4-1
kernel/sched/deadline.c
···658658 *659659 * XXX figure out if select_task_rq_dl() deals with offline cpus.660660 */661661- if (unlikely(!rq->online))661661+ if (unlikely(!rq->online)) {662662+ lockdep_unpin_lock(&rq->lock, rf.cookie);662663 rq = dl_task_offline_migration(rq, p);664664+ rf.cookie = lockdep_pin_lock(&rq->lock);665665+ }663666664667 /*665668 * Queueing this task back might have overloaded rq, check if we need
+1-1
kernel/sched/fair.c
···42694269 pcfs_rq = tg->parent->cfs_rq[cpu];4270427042714271 cfs_rq->throttle_count = pcfs_rq->throttle_count;42724272- pcfs_rq->throttled_clock_task = rq_clock_task(cpu_rq(cpu));42724272+ cfs_rq->throttled_clock_task = rq_clock_task(cpu_rq(cpu));42734273}4274427442754275/* conditionally throttle active cfs_rq's from put_prev_entity() */
+4-1
kernel/time/timer.c
···14961496 struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);14971497 u64 expires = KTIME_MAX;14981498 unsigned long nextevt;14991499+ bool is_max_delta;1499150015001501 /*15011502 * Pretend that there is no timer pending if the cpu is offline.···1507150615081507 spin_lock(&base->lock);15091508 nextevt = __next_timer_interrupt(base);15091509+ is_max_delta = (nextevt == base->clk + NEXT_TIMER_MAX_DELTA);15101510 base->next_expiry = nextevt;15111511 /*15121512 * We have a fresh next event. Check whether we can forward the base:···15211519 expires = basem;15221520 base->is_idle = false;15231521 } else {15241524- expires = basem + (nextevt - basej) * TICK_NSEC;15221522+ if (!is_max_delta)15231523+ expires = basem + (nextevt - basej) * TICK_NSEC;15251524 /*15261525 * If we expect to sleep more than a tick, mark the base idle:15271526 */
+4-4
lib/strncpy_from_user.c
···4040 unsigned long c, data;41414242 /* Fall back to byte-at-a-time if we get a page fault */4343- if (unlikely(unsafe_get_user(c,(unsigned long __user *)(src+res))))4444- break;4343+ unsafe_get_user(c, (unsigned long __user *)(src+res), byte_at_a_time);4444+4545 *(unsigned long *)(dst+res) = c;4646 if (has_zero(c, &data, &constants)) {4747 data = prep_zero_mask(c, data, &constants);···5656 while (max) {5757 char c;58585959- if (unlikely(unsafe_get_user(c,src+res)))6060- return -EFAULT;5959+ unsafe_get_user(c,src+res, efault);6160 dst[res] = c;6261 if (!c)6362 return res;···7576 * Nope: we hit the address space limit, and we still had more7677 * characters the caller would have wanted. That's an EFAULT.7778 */7979+efault:7880 return -EFAULT;7981}8082
+3-4
lib/strnlen_user.c
···4545 src -= align;4646 max += align;47474848- if (unlikely(unsafe_get_user(c,(unsigned long __user *)src)))4949- return 0;4848+ unsafe_get_user(c, (unsigned long __user *)src, efault);5049 c |= aligned_byte_mask(align);51505251 for (;;) {···6061 if (unlikely(max <= sizeof(unsigned long)))6162 break;6263 max -= sizeof(unsigned long);6363- if (unlikely(unsafe_get_user(c,(unsigned long __user *)(src+res))))6464- return 0;6464+ unsafe_get_user(c, (unsigned long __user *)(src+res), efault);6565 }6666 res -= align;6767···7577 * Nope: we hit the address space limit, and we still had more7678 * characters the caller would have wanted. That's 0.7779 */8080+efault:7881 return 0;7982}8083
+4
mm/Makefile
···2121KCOV_INSTRUMENT_mmzone.o := n2222KCOV_INSTRUMENT_vmstat.o := n23232424+# Since __builtin_frame_address does work as used, disable the warning.2525+CFLAGS_usercopy.o += $(call cc-disable-warning, frame-address)2626+2427mmu-y := nommu.o2528mmu-$(CONFIG_MMU) := gup.o highmem.o memory.o mincore.o \2629 mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \···10299obj-$(CONFIG_IDLE_PAGE_TRACKING) += page_idle.o103100obj-$(CONFIG_FRAME_VECTOR) += frame_vector.o104101obj-$(CONFIG_DEBUG_PAGE_REF) += debug_page_ref.o102102+obj-$(CONFIG_HARDENED_USERCOPY) += usercopy.o
···23372337 return 0;2338233823392339 memcg = get_mem_cgroup_from_mm(current->mm);23402340- if (!mem_cgroup_is_root(memcg))23402340+ if (!mem_cgroup_is_root(memcg)) {23412341 ret = memcg_kmem_charge_memcg(page, gfp, order, memcg);23422342+ if (!ret)23432343+ __SetPageKmemcg(page);23442344+ }23422345 css_put(&memcg->css);23432346 return ret;23442347}···23682365 page_counter_uncharge(&memcg->memsw, nr_pages);2369236623702367 page->mem_cgroup = NULL;23682368+23692369+ /* slab pages do not have PageKmemcg flag set */23702370+ if (PageKmemcg(page))23712371+ __ClearPageKmemcg(page);23722372+23712373 css_put_many(&memcg->css, nr_pages);23722374}23732375#endif /* !CONFIG_SLOB */···4077406940784070static DEFINE_IDR(mem_cgroup_idr);4079407140804080-static void mem_cgroup_id_get(struct mem_cgroup *memcg)40724072+static void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n)40814073{40824082- atomic_inc(&memcg->id.ref);40744074+ atomic_add(n, &memcg->id.ref);40834075}4084407640854085-static void mem_cgroup_id_put(struct mem_cgroup *memcg)40774077+static struct mem_cgroup *mem_cgroup_id_get_online(struct mem_cgroup *memcg)40864078{40874087- if (atomic_dec_and_test(&memcg->id.ref)) {40794079+ while (!atomic_inc_not_zero(&memcg->id.ref)) {40804080+ /*40814081+ * The root cgroup cannot be destroyed, so it's refcount must40824082+ * always be >= 1.40834083+ */40844084+ if (WARN_ON_ONCE(memcg == root_mem_cgroup)) {40854085+ VM_BUG_ON(1);40864086+ break;40874087+ }40884088+ memcg = parent_mem_cgroup(memcg);40894089+ if (!memcg)40904090+ memcg = root_mem_cgroup;40914091+ }40924092+ return memcg;40934093+}40944094+40954095+static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n)40964096+{40974097+ if (atomic_sub_and_test(n, &memcg->id.ref)) {40884098 idr_remove(&mem_cgroup_idr, memcg->id.id);40894099 memcg->id.id = 0;4090410040914101 /* Memcg ID pins CSS */40924102 css_put(&memcg->css);40934103 }41044104+}41054105+41064106+static inline void mem_cgroup_id_get(struct mem_cgroup *memcg)41074107+{41084108+ mem_cgroup_id_get_many(memcg, 1);41094109+}41104110+41114111+static inline void mem_cgroup_id_put(struct mem_cgroup *memcg)41124112+{41134113+ mem_cgroup_id_put_many(memcg, 1);40944114}4095411540964116/**···47554719 if (!mem_cgroup_is_root(mc.from))47564720 page_counter_uncharge(&mc.from->memsw, mc.moved_swap);4757472147224722+ mem_cgroup_id_put_many(mc.from, mc.moved_swap);47234723+47584724 /*47594725 * we charged both to->memory and to->memsw, so we47604726 * should uncharge to->memory.···47644726 if (!mem_cgroup_is_root(mc.to))47654727 page_counter_uncharge(&mc.to->memory, mc.moved_swap);4766472847674767- css_put_many(&mc.from->css, mc.moved_swap);47294729+ mem_cgroup_id_get_many(mc.to, mc.moved_swap);47304730+ css_put_many(&mc.to->css, mc.moved_swap);4768473147694769- /* we've already done css_get(mc.to) */47704732 mc.moved_swap = 0;47714733 }47724734 memcg_oom_recover(from);···55755537 else55765538 nr_file += nr_pages;55775539 pgpgout++;55785578- } else55405540+ } else {55795541 nr_kmem += 1 << compound_order(page);55425542+ __ClearPageKmemcg(page);55435543+ }5580554455815545 page->mem_cgroup = NULL;55825546 } while (next != page_list);···58305790 */58315791void mem_cgroup_swapout(struct page *page, swp_entry_t entry)58325792{58335833- struct mem_cgroup *memcg;57935793+ struct mem_cgroup *memcg, *swap_memcg;58345794 unsigned short oldid;5835579558365796 VM_BUG_ON_PAGE(PageLRU(page), page);···58455805 if (!memcg)58465806 return;5847580758485848- mem_cgroup_id_get(memcg);58495849- oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg));58085808+ /*58095809+ * In case the memcg owning these pages has been offlined and doesn't58105810+ * have an ID allocated to it anymore, charge the closest online58115811+ * ancestor for the swap instead and transfer the memory+swap charge.58125812+ */58135813+ swap_memcg = mem_cgroup_id_get_online(memcg);58145814+ oldid = swap_cgroup_record(entry, mem_cgroup_id(swap_memcg));58505815 VM_BUG_ON_PAGE(oldid, page);58515851- mem_cgroup_swap_statistics(memcg, true);58165816+ mem_cgroup_swap_statistics(swap_memcg, true);5852581758535818 page->mem_cgroup = NULL;5854581958555820 if (!mem_cgroup_is_root(memcg))58565821 page_counter_uncharge(&memcg->memory, 1);58225822+58235823+ if (memcg != swap_memcg) {58245824+ if (!mem_cgroup_is_root(swap_memcg))58255825+ page_counter_charge(&swap_memcg->memsw, 1);58265826+ page_counter_uncharge(&memcg->memsw, 1);58275827+ }5857582858585829 /*58595830 * Interrupts should be disabled here because the caller holds the···59045853 if (!memcg)59055854 return 0;5906585559075907- if (!mem_cgroup_is_root(memcg) &&59085908- !page_counter_try_charge(&memcg->swap, 1, &counter))59095909- return -ENOMEM;58565856+ memcg = mem_cgroup_id_get_online(memcg);5910585759115911- mem_cgroup_id_get(memcg);58585858+ if (!mem_cgroup_is_root(memcg) &&58595859+ !page_counter_try_charge(&memcg->swap, 1, &counter)) {58605860+ mem_cgroup_id_put(memcg);58615861+ return -ENOMEM;58625862+ }58635863+59125864 oldid = swap_cgroup_record(entry, mem_cgroup_id(memcg));59135865 VM_BUG_ON_PAGE(oldid, page);59145866 mem_cgroup_swap_statistics(memcg, true);
+2
mm/memory_hotplug.c
···1219121912201220 /* init node's zones as empty zones, we don't have any present pages.*/12211221 free_area_init_node(nid, zones_size, start_pfn, zholes_size);12221222+ pgdat->per_cpu_nodestats = alloc_percpu(struct per_cpu_nodestat);1222122312231224 /*12241225 * The node we allocated has no zone fallback lists. For avoiding···12501249static void rollback_node_hotadd(int nid, pg_data_t *pgdat)12511250{12521251 arch_refresh_nodedata(nid, NULL);12521252+ free_percpu(pgdat->per_cpu_nodestats);12531253 arch_free_nodedata(pgdat);12541254 return;12551255}
+1-1
mm/oom_kill.c
···764764{765765 struct mm_struct *mm = task->mm;766766 struct task_struct *p;767767- bool ret;767767+ bool ret = true;768768769769 /*770770 * Skip tasks without mm because it might have passed its exit_mm and
···12841284 VM_BUG_ON_PAGE(!PageSwapBacked(page), page);12851285 __inc_node_page_state(page, NR_SHMEM_PMDMAPPED);12861286 } else {12871287- if (PageTransCompound(page)) {12881288- VM_BUG_ON_PAGE(!PageLocked(page), page);12871287+ if (PageTransCompound(page) && page_mapping(page)) {12881288+ VM_WARN_ON_ONCE(!PageLocked(page));12891289+12891290 SetPageDoubleMap(compound_head(page));12901291 if (PageMlocked(page))12911292 clear_page_mlock(compound_head(page));···13041303{13051304 int i, nr = 1;1306130513071307- VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page);13061306+ VM_BUG_ON_PAGE(compound && !PageHead(page), page);13081307 lock_page_memcg(page);1309130813101309 /* Hugepages are not counted in NR_FILE_MAPPED for now. */
···44414441module_init(slab_proc_init);44424442#endif4443444344444444+#ifdef CONFIG_HARDENED_USERCOPY44454445+/*44464446+ * Rejects objects that are incorrectly sized.44474447+ *44484448+ * Returns NULL if check passes, otherwise const char * to name of cache44494449+ * to indicate an error.44504450+ */44514451+const char *__check_heap_object(const void *ptr, unsigned long n,44524452+ struct page *page)44534453+{44544454+ struct kmem_cache *cachep;44554455+ unsigned int objnr;44564456+ unsigned long offset;44574457+44584458+ /* Find and validate object. */44594459+ cachep = page->slab_cache;44604460+ objnr = obj_to_index(cachep, page, (void *)ptr);44614461+ BUG_ON(objnr >= cachep->num);44624462+44634463+ /* Find offset within object. */44644464+ offset = ptr - index_to_obj(cachep, page, objnr) - obj_offset(cachep);44654465+44664466+ /* Allow address range falling entirely within object size. */44674467+ if (offset <= cachep->object_size && n <= cachep->object_size - offset)44684468+ return NULL;44694469+44704470+ return cachep->name;44714471+}44724472+#endif /* CONFIG_HARDENED_USERCOPY */44734473+44444474/**44454475 * ksize - get the actual amount of memory allocated for a given object44464476 * @objp: Pointer to the object
+45-1
mm/slub.c
···36293629 */36303630static void free_partial(struct kmem_cache *s, struct kmem_cache_node *n)36313631{36323632+ LIST_HEAD(discard);36323633 struct page *page, *h;3633363436343635 BUG_ON(irqs_disabled());···36373636 list_for_each_entry_safe(page, h, &n->partial, lru) {36383637 if (!page->inuse) {36393638 remove_partial(n, page);36403640- discard_slab(s, page);36393639+ list_add(&page->lru, &discard);36413640 } else {36423641 list_slab_objects(s, page,36433642 "Objects remaining in %s on __kmem_cache_shutdown()");36443643 }36453644 }36463645 spin_unlock_irq(&n->list_lock);36463646+36473647+ list_for_each_entry_safe(page, h, &discard, lru)36483648+ discard_slab(s, page);36473649}3648365036493651/*···37673763}37683764EXPORT_SYMBOL(__kmalloc_node);37693765#endif37663766+37673767+#ifdef CONFIG_HARDENED_USERCOPY37683768+/*37693769+ * Rejects objects that are incorrectly sized.37703770+ *37713771+ * Returns NULL if check passes, otherwise const char * to name of cache37723772+ * to indicate an error.37733773+ */37743774+const char *__check_heap_object(const void *ptr, unsigned long n,37753775+ struct page *page)37763776+{37773777+ struct kmem_cache *s;37783778+ unsigned long offset;37793779+ size_t object_size;37803780+37813781+ /* Find object and usable object size. */37823782+ s = page->slab_cache;37833783+ object_size = slab_ksize(s);37843784+37853785+ /* Reject impossible pointers. */37863786+ if (ptr < page_address(page))37873787+ return s->name;37883788+37893789+ /* Find offset within object. */37903790+ offset = (ptr - page_address(page)) % s->size;37913791+37923792+ /* Adjust for redzone and reject if within the redzone. */37933793+ if (kmem_cache_debug(s) && s->flags & SLAB_RED_ZONE) {37943794+ if (offset < s->red_left_pad)37953795+ return s->name;37963796+ offset -= s->red_left_pad;37973797+ }37983798+37993799+ /* Allow address range falling entirely within object size. */38003800+ if (offset <= object_size && n <= object_size - offset)38013801+ return NULL;38023802+38033803+ return s->name;38043804+}38053805+#endif /* CONFIG_HARDENED_USERCOPY */3770380637713807static size_t __ksize(const void *object)37723808{
+268
mm/usercopy.c
···11+/*22+ * This implements the various checks for CONFIG_HARDENED_USERCOPY*,33+ * which are designed to protect kernel memory from needless exposure44+ * and overwrite under many unintended conditions. This code is based55+ * on PAX_USERCOPY, which is:66+ *77+ * Copyright (C) 2001-2016 PaX Team, Bradley Spengler, Open Source88+ * Security Inc.99+ *1010+ * This program is free software; you can redistribute it and/or modify1111+ * it under the terms of the GNU General Public License version 2 as1212+ * published by the Free Software Foundation.1313+ *1414+ */1515+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt1616+1717+#include <linux/mm.h>1818+#include <linux/slab.h>1919+#include <asm/sections.h>2020+2121+enum {2222+ BAD_STACK = -1,2323+ NOT_STACK = 0,2424+ GOOD_FRAME,2525+ GOOD_STACK,2626+};2727+2828+/*2929+ * Checks if a given pointer and length is contained by the current3030+ * stack frame (if possible).3131+ *3232+ * Returns:3333+ * NOT_STACK: not at all on the stack3434+ * GOOD_FRAME: fully within a valid stack frame3535+ * GOOD_STACK: fully on the stack (when can't do frame-checking)3636+ * BAD_STACK: error condition (invalid stack position or bad stack frame)3737+ */3838+static noinline int check_stack_object(const void *obj, unsigned long len)3939+{4040+ const void * const stack = task_stack_page(current);4141+ const void * const stackend = stack + THREAD_SIZE;4242+ int ret;4343+4444+ /* Object is not on the stack at all. */4545+ if (obj + len <= stack || stackend <= obj)4646+ return NOT_STACK;4747+4848+ /*4949+ * Reject: object partially overlaps the stack (passing the5050+ * the check above means at least one end is within the stack,5151+ * so if this check fails, the other end is outside the stack).5252+ */5353+ if (obj < stack || stackend < obj + len)5454+ return BAD_STACK;5555+5656+ /* Check if object is safely within a valid frame. */5757+ ret = arch_within_stack_frames(stack, stackend, obj, len);5858+ if (ret)5959+ return ret;6060+6161+ return GOOD_STACK;6262+}6363+6464+static void report_usercopy(const void *ptr, unsigned long len,6565+ bool to_user, const char *type)6666+{6767+ pr_emerg("kernel memory %s attempt detected %s %p (%s) (%lu bytes)\n",6868+ to_user ? "exposure" : "overwrite",6969+ to_user ? "from" : "to", ptr, type ? : "unknown", len);7070+ /*7171+ * For greater effect, it would be nice to do do_group_exit(),7272+ * but BUG() actually hooks all the lock-breaking and per-arch7373+ * Oops code, so that is used here instead.7474+ */7575+ BUG();7676+}7777+7878+/* Returns true if any portion of [ptr,ptr+n) over laps with [low,high). */7979+static bool overlaps(const void *ptr, unsigned long n, unsigned long low,8080+ unsigned long high)8181+{8282+ unsigned long check_low = (uintptr_t)ptr;8383+ unsigned long check_high = check_low + n;8484+8585+ /* Does not overlap if entirely above or entirely below. */8686+ if (check_low >= high || check_high < low)8787+ return false;8888+8989+ return true;9090+}9191+9292+/* Is this address range in the kernel text area? */9393+static inline const char *check_kernel_text_object(const void *ptr,9494+ unsigned long n)9595+{9696+ unsigned long textlow = (unsigned long)_stext;9797+ unsigned long texthigh = (unsigned long)_etext;9898+ unsigned long textlow_linear, texthigh_linear;9999+100100+ if (overlaps(ptr, n, textlow, texthigh))101101+ return "<kernel text>";102102+103103+ /*104104+ * Some architectures have virtual memory mappings with a secondary105105+ * mapping of the kernel text, i.e. there is more than one virtual106106+ * kernel address that points to the kernel image. It is usually107107+ * when there is a separate linear physical memory mapping, in that108108+ * __pa() is not just the reverse of __va(). This can be detected109109+ * and checked:110110+ */111111+ textlow_linear = (unsigned long)__va(__pa(textlow));112112+ /* No different mapping: we're done. */113113+ if (textlow_linear == textlow)114114+ return NULL;115115+116116+ /* Check the secondary mapping... */117117+ texthigh_linear = (unsigned long)__va(__pa(texthigh));118118+ if (overlaps(ptr, n, textlow_linear, texthigh_linear))119119+ return "<linear kernel text>";120120+121121+ return NULL;122122+}123123+124124+static inline const char *check_bogus_address(const void *ptr, unsigned long n)125125+{126126+ /* Reject if object wraps past end of memory. */127127+ if (ptr + n < ptr)128128+ return "<wrapped address>";129129+130130+ /* Reject if NULL or ZERO-allocation. */131131+ if (ZERO_OR_NULL_PTR(ptr))132132+ return "<null>";133133+134134+ return NULL;135135+}136136+137137+static inline const char *check_heap_object(const void *ptr, unsigned long n,138138+ bool to_user)139139+{140140+ struct page *page, *endpage;141141+ const void *end = ptr + n - 1;142142+ bool is_reserved, is_cma;143143+144144+ /*145145+ * Some architectures (arm64) return true for virt_addr_valid() on146146+ * vmalloced addresses. Work around this by checking for vmalloc147147+ * first.148148+ */149149+ if (is_vmalloc_addr(ptr))150150+ return NULL;151151+152152+ if (!virt_addr_valid(ptr))153153+ return NULL;154154+155155+ page = virt_to_head_page(ptr);156156+157157+ /* Check slab allocator for flags and size. */158158+ if (PageSlab(page))159159+ return __check_heap_object(ptr, n, page);160160+161161+ /*162162+ * Sometimes the kernel data regions are not marked Reserved (see163163+ * check below). And sometimes [_sdata,_edata) does not cover164164+ * rodata and/or bss, so check each range explicitly.165165+ */166166+167167+ /* Allow reads of kernel rodata region (if not marked as Reserved). */168168+ if (ptr >= (const void *)__start_rodata &&169169+ end <= (const void *)__end_rodata) {170170+ if (!to_user)171171+ return "<rodata>";172172+ return NULL;173173+ }174174+175175+ /* Allow kernel data region (if not marked as Reserved). */176176+ if (ptr >= (const void *)_sdata && end <= (const void *)_edata)177177+ return NULL;178178+179179+ /* Allow kernel bss region (if not marked as Reserved). */180180+ if (ptr >= (const void *)__bss_start &&181181+ end <= (const void *)__bss_stop)182182+ return NULL;183183+184184+ /* Is the object wholly within one base page? */185185+ if (likely(((unsigned long)ptr & (unsigned long)PAGE_MASK) ==186186+ ((unsigned long)end & (unsigned long)PAGE_MASK)))187187+ return NULL;188188+189189+ /* Allow if start and end are inside the same compound page. */190190+ endpage = virt_to_head_page(end);191191+ if (likely(endpage == page))192192+ return NULL;193193+194194+ /*195195+ * Reject if range is entirely either Reserved (i.e. special or196196+ * device memory), or CMA. Otherwise, reject since the object spans197197+ * several independently allocated pages.198198+ */199199+ is_reserved = PageReserved(page);200200+ is_cma = is_migrate_cma_page(page);201201+ if (!is_reserved && !is_cma)202202+ goto reject;203203+204204+ for (ptr += PAGE_SIZE; ptr <= end; ptr += PAGE_SIZE) {205205+ page = virt_to_head_page(ptr);206206+ if (is_reserved && !PageReserved(page))207207+ goto reject;208208+ if (is_cma && !is_migrate_cma_page(page))209209+ goto reject;210210+ }211211+212212+ return NULL;213213+214214+reject:215215+ return "<spans multiple pages>";216216+}217217+218218+/*219219+ * Validates that the given object is:220220+ * - not bogus address221221+ * - known-safe heap or stack object222222+ * - not in kernel text223223+ */224224+void __check_object_size(const void *ptr, unsigned long n, bool to_user)225225+{226226+ const char *err;227227+228228+ /* Skip all tests if size is zero. */229229+ if (!n)230230+ return;231231+232232+ /* Check for invalid addresses. */233233+ err = check_bogus_address(ptr, n);234234+ if (err)235235+ goto report;236236+237237+ /* Check for bad heap object. */238238+ err = check_heap_object(ptr, n, to_user);239239+ if (err)240240+ goto report;241241+242242+ /* Check for bad stack object. */243243+ switch (check_stack_object(ptr, n)) {244244+ case NOT_STACK:245245+ /* Object is not touching the current process stack. */246246+ break;247247+ case GOOD_FRAME:248248+ case GOOD_STACK:249249+ /*250250+ * Object is either in the correct frame (when it251251+ * is possible to check) or just generally on the252252+ * process stack (when frame checking not available).253253+ */254254+ return;255255+ default:256256+ err = "<process stack>";257257+ goto report;258258+ }259259+260260+ /* Check for object in kernel to avoid text exposure. */261261+ err = check_kernel_text_object(ptr, n);262262+ if (!err)263263+ return;264264+265265+report:266266+ report_usercopy(ptr, n, to_user, err);267267+}268268+EXPORT_SYMBOL(__check_object_size);
+2-2
net/9p/trans_virtio.c
···507507 /* wakeup anybody waiting for slots to pin pages */508508 wake_up(&vp_wq);509509 }510510- kfree(in_pages);511511- kfree(out_pages);510510+ kvfree(in_pages);511511+ kvfree(out_pages);512512 return err;513513}514514
···177177 * increase over time if the server is down or not responding.178178 */179179#define XS_TCP_INIT_REEST_TO (3U * HZ)180180-#define XS_TCP_MAX_REEST_TO (5U * 60 * HZ)181180182181/*183182 * TCP idle timeout; client drops the transport socket if it is idle···21722173 write_unlock_bh(&sk->sk_callback_lock);21732174 }21742175 xs_udp_do_set_buffer_size(xprt);21762176+21772177+ xprt->stat.connect_start = jiffies;21752178}2176217921772180static void xs_udp_setup_socket(struct work_struct *work)···22372236 unsigned int keepcnt = xprt->timeout->to_retries + 1;22382237 unsigned int opt_on = 1;22392238 unsigned int timeo;22392239+ unsigned int addr_pref = IPV6_PREFER_SRC_PUBLIC;2240224022412241 /* TCP Keepalive options */22422242 kernel_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,···22482246 (char *)&keepidle, sizeof(keepidle));22492247 kernel_setsockopt(sock, SOL_TCP, TCP_KEEPCNT,22502248 (char *)&keepcnt, sizeof(keepcnt));22492249+22502250+ /* Avoid temporary address, they are bad for long-lived22512251+ * connections such as NFS mounts.22522252+ * RFC4941, section 3.6 suggests that:22532253+ * Individual applications, which have specific22542254+ * knowledge about the normal duration of connections,22552255+ * MAY override this as appropriate.22562256+ */22572257+ kernel_setsockopt(sock, SOL_IPV6, IPV6_ADDR_PREFERENCES,22582258+ (char *)&addr_pref, sizeof(addr_pref));2251225922522260 /* TCP user timeout (see RFC5482) */22532261 timeo = jiffies_to_msecs(xprt->timeout->to_initval) *···23072295 /* SYN_SENT! */23082296 if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO)23092297 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO;22982298+ break;22992299+ case -EADDRNOTAVAIL:23002300+ /* Source port number is unavailable. Try a new one! */23012301+ transport->srcport = 0;23102302 }23112303out:23122304 return ret;···23852369 xprt_wake_pending_tasks(xprt, status);23862370}2387237123722372+static unsigned long xs_reconnect_delay(const struct rpc_xprt *xprt)23732373+{23742374+ unsigned long start, now = jiffies;23752375+23762376+ start = xprt->stat.connect_start + xprt->reestablish_timeout;23772377+ if (time_after(start, now))23782378+ return start - now;23792379+ return 0;23802380+}23812381+23822382+static void xs_reconnect_backoff(struct rpc_xprt *xprt)23832383+{23842384+ xprt->reestablish_timeout <<= 1;23852385+ if (xprt->reestablish_timeout > xprt->max_reconnect_timeout)23862386+ xprt->reestablish_timeout = xprt->max_reconnect_timeout;23872387+ if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO)23882388+ xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO;23892389+}23902390+23882391/**23892392 * xs_connect - connect a socket to a remote endpoint23902393 * @xprt: pointer to transport structure···24212386static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task)24222387{24232388 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);23892389+ unsigned long delay = 0;2424239024252391 WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport));24262392···24332397 /* Start by resetting any existing state */24342398 xs_reset_transport(transport);2435239924362436- queue_delayed_work(xprtiod_workqueue,24372437- &transport->connect_worker,24382438- xprt->reestablish_timeout);24392439- xprt->reestablish_timeout <<= 1;24402440- if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO)24412441- xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO;24422442- if (xprt->reestablish_timeout > XS_TCP_MAX_REEST_TO)24432443- xprt->reestablish_timeout = XS_TCP_MAX_REEST_TO;24442444- } else {24002400+ delay = xs_reconnect_delay(xprt);24012401+ xs_reconnect_backoff(xprt);24022402+24032403+ } else24452404 dprintk("RPC: xs_connect scheduled xprt %p\n", xprt);24462446- queue_delayed_work(xprtiod_workqueue,24472447- &transport->connect_worker, 0);24482448- }24052405+24062406+ queue_delayed_work(xprtiod_workqueue,24072407+ &transport->connect_worker,24082408+ delay);24492409}2450241024512411/**···2992296029932961 xprt->ops = &xs_tcp_ops;29942962 xprt->timeout = &xs_tcp_default_timeout;29632963+29642964+ xprt->max_reconnect_timeout = xprt->timeout->to_maxval;2995296529962966 INIT_WORK(&transport->recv_worker, xs_tcp_data_receive_workfn);29972967 INIT_DELAYED_WORK(&transport->connect_worker, xs_tcp_setup_socket);
+7-3
scripts/Kbuild.include
···108108as-instr = $(call try-run,\109109 printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))110110111111+# Do not attempt to build with gcc plugins during cc-option tests.112112+# (And this uses delayed resolution so the flags will be up to date.)113113+CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))114114+111115# cc-option112116# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)113117114118cc-option = $(call try-run,\115115- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))119119+ $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))116120117121# cc-option-yn118122# Usage: flag := $(call cc-option-yn,-march=winchip-c6)119123cc-option-yn = $(call try-run,\120120- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)124124+ $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n)121125122126# cc-option-align123127# Prefix align with either -falign or -malign···131127# cc-disable-warning132128# Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)133129cc-disable-warning = $(call try-run,\134134- $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))130130+ $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))135131136132# cc-name137133# Expands to either gcc or clang
+30-13
scripts/Makefile.gcc-plugins
···1919 endif2020 endif21212222- GCC_PLUGINS_CFLAGS := $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y))2222+ GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))23232424- export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN SANCOV_PLUGIN2424+ export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR SANCOV_PLUGIN25252626- ifeq ($(PLUGINCC),)2727- ifneq ($(GCC_PLUGINS_CFLAGS),)2828- ifeq ($(call cc-ifversion, -ge, 0405, y), y)2929- PLUGINCC := $(shell $(CONFIG_SHELL) -x $(srctree)/scripts/gcc-plugin.sh "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)")3030- $(warning warning: your gcc installation does not support plugins, perhaps the necessary headers are missing?)3131- else3232- $(warning warning: your gcc version does not support plugins, you should upgrade it to gcc 4.5 at least)3333- endif3434- endif3535- else2626+ ifneq ($(PLUGINCC),)3627 # SANCOV_PLUGIN can be only in CFLAGS_KCOV because avoid duplication.3728 GCC_PLUGINS_CFLAGS := $(filter-out $(SANCOV_PLUGIN), $(GCC_PLUGINS_CFLAGS))3829 endif39304031 KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)4132 GCC_PLUGIN := $(gcc-plugin-y)4242-3333+ GCC_PLUGIN_SUBDIR := $(gcc-plugin-subdir-y)4334endif3535+3636+# If plugins aren't supported, abort the build before hard-to-read compiler3737+# errors start getting spewed by the main build.3838+PHONY += gcc-plugins-check3939+gcc-plugins-check: FORCE4040+ifdef CONFIG_GCC_PLUGINS4141+ ifeq ($(PLUGINCC),)4242+ ifneq ($(GCC_PLUGINS_CFLAGS),)4343+ ifeq ($(call cc-ifversion, -ge, 0405, y), y)4444+ $(Q)$(srctree)/scripts/gcc-plugin.sh --show-error "$(__PLUGINCC)" "$(HOSTCXX)" "$(CC)" || true4545+ @echo "Cannot use CONFIG_GCC_PLUGINS: your gcc installation does not support plugins, perhaps the necessary headers are missing?" >&2 && exit 14646+ else4747+ @echo "Cannot use CONFIG_GCC_PLUGINS: your gcc version does not support plugins, you should upgrade it to at least gcc 4.5" >&2 && exit 14848+ endif4949+ endif5050+ endif5151+endif5252+ @:5353+5454+# Actually do the build, if requested.5555+PHONY += gcc-plugins5656+gcc-plugins: scripts_basic gcc-plugins-check5757+ifdef CONFIG_GCC_PLUGINS5858+ $(Q)$(MAKE) $(build)=scripts/gcc-plugins5959+endif6060+ @:
···432432 die "$P: file '${file}' not found\n";433433 }434434 }435435- if ($from_filename || vcs_file_exists($file)) {435435+ if ($from_filename || ($file ne "&STDIN" && vcs_file_exists($file))) {436436 $file =~ s/^\Q${cur_path}\E//; #strip any absolute path437437 $file =~ s/^\Q${lk_path}\E//; #or the path to the lk tree438438 push(@files, $file);
+28
security/Kconfig
···118118 this low address space will need the permission specific to the119119 systems running LSM.120120121121+config HAVE_HARDENED_USERCOPY_ALLOCATOR122122+ bool123123+ help124124+ The heap allocator implements __check_heap_object() for125125+ validating memory ranges against heap object sizes in126126+ support of CONFIG_HARDENED_USERCOPY.127127+128128+config HAVE_ARCH_HARDENED_USERCOPY129129+ bool130130+ help131131+ The architecture supports CONFIG_HARDENED_USERCOPY by132132+ calling check_object_size() just before performing the133133+ userspace copies in the low level implementation of134134+ copy_to_user() and copy_from_user().135135+136136+config HARDENED_USERCOPY137137+ bool "Harden memory copies between kernel and userspace"138138+ depends on HAVE_ARCH_HARDENED_USERCOPY139139+ select BUG140140+ help141141+ This option checks for obviously wrong memory regions when142142+ copying memory to/from the kernel (via copy_to_user() and143143+ copy_from_user() functions) by rejecting memory ranges that144144+ are larger than the specified heap object, span multiple145145+ separately allocates pages, are not on the process stack,146146+ or are part of the kernel text. This kills entire classes147147+ of heap overflow exploits and similar kernel memory exposures.148148+121149source security/selinux/Kconfig122150source security/smack/Kconfig123151source security/tomoyo/Kconfig
+20-12
sound/pci/hda/hda_intel.c
···906906 struct snd_card *card = dev_get_drvdata(dev);907907 struct azx *chip;908908 struct hda_intel *hda;909909+ struct hdac_bus *bus;909910910911 if (!card)911912 return 0;912913913914 chip = card->private_data;914915 hda = container_of(chip, struct hda_intel, chip);916916+ bus = azx_bus(chip);915917 if (chip->disabled || hda->init_failed || !chip->running)916918 return 0;917919918918- if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL919919- && hda->need_i915_power) {920920- snd_hdac_display_power(azx_bus(chip), true);921921- snd_hdac_i915_set_bclk(azx_bus(chip));920920+ if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {921921+ snd_hdac_display_power(bus, true);922922+ if (hda->need_i915_power)923923+ snd_hdac_i915_set_bclk(bus);922924 }925925+923926 if (chip->msi)924927 if (pci_enable_msi(pci) < 0)925928 chip->msi = 0;···931928 azx_init_pci(chip);932929933930 hda_intel_init_chip(chip, true);931931+932932+ /* power down again for link-controlled chips */933933+ if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) &&934934+ !hda->need_i915_power)935935+ snd_hdac_display_power(bus, false);934936935937 snd_power_change_state(card, SNDRV_CTL_POWER_D0);936938···1016100810171009 chip = card->private_data;10181010 hda = container_of(chip, struct hda_intel, chip);10111011+ bus = azx_bus(chip);10191012 if (chip->disabled || hda->init_failed)10201013 return 0;10211014···10241015 return 0;1025101610261017 if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) {10271027- bus = azx_bus(chip);10281028- if (hda->need_i915_power) {10291029- snd_hdac_display_power(bus, true);10181018+ snd_hdac_display_power(bus, true);10191019+ if (hda->need_i915_power)10301020 snd_hdac_i915_set_bclk(bus);10311031- } else {10321032- /* toggle codec wakeup bit for STATESTS read */10331033- snd_hdac_set_codec_wakeup(bus, true);10341034- snd_hdac_set_codec_wakeup(bus, false);10351035- }10361021 }1037102210381023 /* Read STATESTS before controller reset */···10451042 /* disable controller Wake Up event*/10461043 azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &10471044 ~STATESTS_INT_MASK);10451045+10461046+ /* power down again for link-controlled chips */10471047+ if ((chip->driver_caps & AZX_DCAPS_I915_POWERWELL) &&10481048+ !hda->need_i915_power)10491049+ snd_hdac_display_power(bus, false);1048105010491051 trace_azx_runtime_resume(chip);10501052 return 0;
+2
sound/usb/quirks.c
···11281128{11291129 /* devices which do not support reading the sample rate. */11301130 switch (chip->usb_id) {11311131+ case USB_ID(0x041E, 0x4080): /* Creative Live Cam VF0610 */11311132 case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */11321133 case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */11331134 case USB_ID(0x045E, 0x076E): /* MS Lifecam HD-5001 */···11391138 case USB_ID(0x047F, 0xAA05): /* Plantronics DA45 */11401139 case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */11411140 case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */11411141+ case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */11421142 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */11431143 case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */11441144 case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */
+3-6
tools/arch/x86/include/asm/cpufeatures.h
···225225#define X86_FEATURE_RDSEED ( 9*32+18) /* The RDSEED instruction */226226#define X86_FEATURE_ADX ( 9*32+19) /* The ADCX and ADOX instructions */227227#define X86_FEATURE_SMAP ( 9*32+20) /* Supervisor Mode Access Prevention */228228-#define X86_FEATURE_PCOMMIT ( 9*32+22) /* PCOMMIT instruction */229228#define X86_FEATURE_CLFLUSHOPT ( 9*32+23) /* CLFLUSHOPT instruction */230229#define X86_FEATURE_CLWB ( 9*32+24) /* CLWB instruction */231230#define X86_FEATURE_AVX512PF ( 9*32+26) /* AVX-512 Prefetch */···300301#define X86_BUG_FXSAVE_LEAK X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */301302#define X86_BUG_CLFLUSH_MONITOR X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */302303#define X86_BUG_SYSRET_SS_ATTRS X86_BUG(8) /* SYSRET doesn't fix up SS attrs */303303-#define X86_BUG_NULL_SEG X86_BUG(9) /* Nulling a selector preserves the base */304304-#define X86_BUG_SWAPGS_FENCE X86_BUG(10) /* SWAPGS without input dep on GS */305305-306306-307304#ifdef CONFIG_X86_32308305/*309306 * 64-bit kernels don't use X86_BUG_ESPFIX. Make the define conditional···307312 */308313#define X86_BUG_ESPFIX X86_BUG(9) /* "" IRET to 16-bit SS corrupts ESP/RSP high bits */309314#endif310310-315315+#define X86_BUG_NULL_SEG X86_BUG(10) /* Nulling a selector preserves the base */316316+#define X86_BUG_SWAPGS_FENCE X86_BUG(11) /* SWAPGS without input dep on GS */317317+#define X86_BUG_MONITOR X86_BUG(12) /* IPI required to wake up remote CPU */311318#endif /* _ASM_X86_CPUFEATURES_H */
···8484 BPF_MAP_TYPE_PERCPU_HASH,8585 BPF_MAP_TYPE_PERCPU_ARRAY,8686 BPF_MAP_TYPE_STACK_TRACE,8787+ BPF_MAP_TYPE_CGROUP_ARRAY,8788};88898990enum bpf_prog_type {···9493 BPF_PROG_TYPE_SCHED_CLS,9594 BPF_PROG_TYPE_SCHED_ACT,9695 BPF_PROG_TYPE_TRACEPOINT,9696+ BPF_PROG_TYPE_XDP,9797};98989999#define BPF_PSEUDO_MAP_FD 1···315313 */316314 BPF_FUNC_skb_get_tunnel_opt,317315 BPF_FUNC_skb_set_tunnel_opt,316316+317317+ /**318318+ * bpf_skb_change_proto(skb, proto, flags)319319+ * Change protocol of the skb. Currently supported is320320+ * v4 -> v6, v6 -> v4 transitions. The helper will also321321+ * resize the skb. eBPF program is expected to fill the322322+ * new headers via skb_store_bytes and lX_csum_replace.323323+ * @skb: pointer to skb324324+ * @proto: new skb->protocol type325325+ * @flags: reserved326326+ * Return: 0 on success or negative error327327+ */328328+ BPF_FUNC_skb_change_proto,329329+330330+ /**331331+ * bpf_skb_change_type(skb, type)332332+ * Change packet type of skb.333333+ * @skb: pointer to skb334334+ * @type: new skb->pkt_type type335335+ * Return: 0 on success or negative error336336+ */337337+ BPF_FUNC_skb_change_type,338338+339339+ /**340340+ * bpf_skb_in_cgroup(skb, map, index) - Check cgroup2 membership of skb341341+ * @skb: pointer to skb342342+ * @map: pointer to bpf_map in BPF_MAP_TYPE_CGROUP_ARRAY type343343+ * @index: index of the cgroup in the bpf_map344344+ * Return:345345+ * == 0 skb failed the cgroup2 descendant test346346+ * == 1 skb succeeded the cgroup2 descendant test347347+ * < 0 error348348+ */349349+ BPF_FUNC_skb_in_cgroup,350350+351351+ /**352352+ * bpf_get_hash_recalc(skb)353353+ * Retrieve and possibly recalculate skb->hash.354354+ * @skb: pointer to skb355355+ * Return: hash356356+ */357357+ BPF_FUNC_get_hash_recalc,358358+359359+ /**360360+ * u64 bpf_get_current_task(void)361361+ * Returns current task_struct362362+ * Return: current363363+ */364364+ BPF_FUNC_get_current_task,365365+366366+ /**367367+ * bpf_probe_write_user(void *dst, void *src, int len)368368+ * safely attempt to write to a location369369+ * @dst: destination address in userspace370370+ * @src: source address on stack371371+ * @len: number of bytes to copy372372+ * Return: 0 on success or negative error373373+ */374374+ BPF_FUNC_probe_write_user,375375+318376 __BPF_FUNC_MAX_ID,319377};320378···409347#define BPF_F_ZERO_CSUM_TX (1ULL << 1)410348#define BPF_F_DONT_FRAGMENT (1ULL << 2)411349412412-/* BPF_FUNC_perf_event_output flags. */350350+/* BPF_FUNC_perf_event_output and BPF_FUNC_perf_event_read flags. */413351#define BPF_F_INDEX_MASK 0xffffffffULL414352#define BPF_F_CURRENT_CPU BPF_F_INDEX_MASK353353+/* BPF_FUNC_perf_event_output for sk_buff input context. */354354+#define BPF_F_CTXLEN_MASK (0xfffffULL << 32)415355416356/* user accessible mirror of in-kernel sk_buff.417357 * new fields can only be added to the end of this structure···448384 __u8 tunnel_ttl;449385 __u16 tunnel_ext;450386 __u32 tunnel_label;387387+};388388+389389+/* User return codes for XDP prog type.390390+ * A valid XDP program must return one of these defined values. All other391391+ * return codes are reserved for future use. Unknown return codes will result392392+ * in packet drop.393393+ */394394+enum xdp_action {395395+ XDP_ABORTED = 0,396396+ XDP_DROP,397397+ XDP_PASS,398398+ XDP_TX,399399+};400400+401401+/* user accessible metadata for XDP packet hook402402+ * new fields must be added to the end of this structure403403+ */404404+struct xdp_md {405405+ __u32 data;406406+ __u32 data_end;451407};452408453409#endif /* _UAPI__LINUX_BPF_H__ */
+9-1
tools/perf/Documentation/perf-probe.txt
···176176177177'NAME' specifies the name of this argument (optional). You can use the name of local variable, local data structure member (e.g. var->field, var.field2), local array with fixed index (e.g. array[1], var->array[0], var->pointer[2]), or kprobe-tracer argument format (e.g. $retval, %ax, etc). Note that the name of this argument will be set as the last member name if you specify a local data structure member (e.g. field2 for 'var->field1.field2'.)178178'$vars' and '$params' special arguments are also available for NAME, '$vars' is expanded to the local variables (including function parameters) which can access at given probe point. '$params' is expanded to only the function parameters.179179-'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo. You can specify 'string' type only for the local variable or structure member which is an array of or a pointer to 'char' or 'unsigned char' type.179179+'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo. Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), signedness casting (u/s), "string" and bitfield are supported. (see TYPES for detail)180180181181On x86 systems %REG is always the short form of the register: for example %AX. %RAX or %EAX is not valid.182182+183183+TYPES184184+-----185185+Basic types (u8/u16/u32/u64/s8/s16/s32/s64) are integer types. Prefix 's' and 'u' means those types are signed and unsigned respectively. Traced arguments are shown in decimal (signed) or hex (unsigned). You can also use 's' or 'u' to specify only signedness and leave its size auto-detected by perf probe.186186+String type is a special type, which fetches a "null-terminated" string from kernel space. This means it will fail and store NULL if the string container has been paged out. You can specify 'string' type only for the local variable or structure member which is an array of or a pointer to 'char' or 'unsigned char' type.187187+Bitfield is another special type, which takes 3 parameters, bit-width, bit-offset, and container-size (usually 32). The syntax is;188188+189189+ b<bit-width>@<bit-offset>/<container-size>182190183191LINE SYNTAX184192-----------
+2-2
tools/perf/Documentation/perf-script.txt
···116116--fields::117117 Comma separated list of fields to print. Options are:118118 comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff,119119- srcline, period, iregs, brstack, brstacksym, flags.120120- Field list can be prepended with the type, trace, sw or hw,119119+ srcline, period, iregs, brstack, brstacksym, flags, bpf-output,120120+ callindent. Field list can be prepended with the type, trace, sw or hw,121121 to indicate to which event type the field list applies.122122 e.g., -F sw:comm,tid,time,ip,sym and -F trace:time,cpu,trace123123
+23-4
tools/perf/arch/powerpc/util/sym-handling.c
···5454#endif55555656#if defined(_CALL_ELF) && _CALL_ELF == 25757-bool arch__prefers_symtab(void)5858-{5959- return true;6060-}61576258#ifdef HAVE_LIBELF_SUPPORT6359void arch__sym_update(struct symbol *s, GElf_Sym *sym)···96100 tev->point.offset += lep_offset;97101 }98102}103103+104104+void arch__post_process_probe_trace_events(struct perf_probe_event *pev,105105+ int ntevs)106106+{107107+ struct probe_trace_event *tev;108108+ struct map *map;109109+ struct symbol *sym = NULL;110110+ struct rb_node *tmp;111111+ int i = 0;112112+113113+ map = get_target_map(pev->target, pev->uprobes);114114+ if (!map || map__load(map, NULL) < 0)115115+ return;116116+117117+ for (i = 0; i < ntevs; i++) {118118+ tev = &pev->tevs[i];119119+ map__for_each_symbol(map, sym, tmp) {120120+ if (map->unmap_ip(map, sym->start) == tev->point.address)121121+ arch__fix_tev_from_maps(pev, tev, map, sym);122122+ }123123+ }124124+}125125+99126#endif
···331331 return 0;332332}333333334334-static void read_counters(bool close_counters)334334+static void read_counters(void)335335{336336 struct perf_evsel *counter;337337···341341342342 if (perf_stat_process_counter(&stat_config, counter))343343 pr_warning("failed to process counter %s\n", counter->name);344344-345345- if (close_counters) {346346- perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter),347347- thread_map__nr(evsel_list->threads));348348- }349344 }350345}351346···348353{349354 struct timespec ts, rs;350355351351- read_counters(false);356356+ read_counters();352357353358 clock_gettime(CLOCK_MONOTONIC, &ts);354359 diff_timespec(&rs, &ts, &ref_time);···373378 */374379 if (!target__none(&target) || initial_delay)375380 perf_evlist__enable(evsel_list);381381+}382382+383383+static void disable_counters(void)384384+{385385+ /*386386+ * If we don't have tracee (attaching to task or cpu), counters may387387+ * still be running. To get accurate group ratios, we must stop groups388388+ * from counting before reading their constituent counters.389389+ */390390+ if (!target__none(&target))391391+ perf_evlist__disable(evsel_list);376392}377393378394static volatile int workload_exec_errno;···663657 }664658 }665659660660+ disable_counters();661661+666662 t1 = rdclock();667663668664 update_stats(&walltime_nsecs_stats, t1 - t0);669665670670- read_counters(true);666666+ /*667667+ * Closing a group leader splits the group, and as we only disable668668+ * group leaders, results in remaining events becoming enabled. To669669+ * avoid arbitrary skew, we must read all counters before closing any670670+ * group leaders.671671+ */672672+ read_counters();673673+ perf_evlist__close(evsel_list);671674672675 return WEXITSTATUS(status);673676}
+37-23
tools/perf/util/probe-event.c
···170170 module = "kernel";171171172172 for (pos = maps__first(maps); pos; pos = map__next(pos)) {173173+ /* short_name is "[module]" */173174 if (strncmp(pos->dso->short_name + 1, module,174174- pos->dso->short_name_len - 2) == 0) {175175+ pos->dso->short_name_len - 2) == 0 &&176176+ module[pos->dso->short_name_len - 2] == '\0') {175177 return pos;176178 }177179 }178180 return NULL;179181}180182181181-static struct map *get_target_map(const char *target, bool user)183183+struct map *get_target_map(const char *target, bool user)182184{183185 /* Init maps of given executable or kernel */184186 if (user)···387385 if (uprobes)388386 address = sym->start;389387 else390390- address = map->unmap_ip(map, sym->start);388388+ address = map->unmap_ip(map, sym->start) - map->reloc;391389 break;392390 }393391 if (!address) {···666664 return ret;667665}668666669669-/* Post processing the probe events */670670-static int post_process_probe_trace_events(struct probe_trace_event *tevs,671671- int ntevs, const char *module,672672- bool uprobe)667667+static int668668+post_process_kernel_probe_trace_events(struct probe_trace_event *tevs,669669+ int ntevs)673670{674671 struct ref_reloc_sym *reloc_sym;675672 char *tmp;676673 int i, skipped = 0;677677-678678- if (uprobe)679679- return add_exec_to_probe_trace_events(tevs, ntevs, module);680680-681681- /* Note that currently ref_reloc_sym based probe is not for drivers */682682- if (module)683683- return add_module_to_probe_trace_events(tevs, ntevs, module);684674685675 reloc_sym = kernel_get_ref_reloc_sym();686676 if (!reloc_sym) {···703709 reloc_sym->unrelocated_addr;704710 }705711 return skipped;712712+}713713+714714+void __weak715715+arch__post_process_probe_trace_events(struct perf_probe_event *pev __maybe_unused,716716+ int ntevs __maybe_unused)717717+{718718+}719719+720720+/* Post processing the probe events */721721+static int post_process_probe_trace_events(struct perf_probe_event *pev,722722+ struct probe_trace_event *tevs,723723+ int ntevs, const char *module,724724+ bool uprobe)725725+{726726+ int ret;727727+728728+ if (uprobe)729729+ ret = add_exec_to_probe_trace_events(tevs, ntevs, module);730730+ else if (module)731731+ /* Currently ref_reloc_sym based probe is not for drivers */732732+ ret = add_module_to_probe_trace_events(tevs, ntevs, module);733733+ else734734+ ret = post_process_kernel_probe_trace_events(tevs, ntevs);735735+736736+ if (ret >= 0)737737+ arch__post_process_probe_trace_events(pev, ntevs);738738+739739+ return ret;706740}707741708742/* Try to find perf_probe_event with debuginfo */···771749772750 if (ntevs > 0) { /* Succeeded to find trace events */773751 pr_debug("Found %d probe_trace_events.\n", ntevs);774774- ret = post_process_probe_trace_events(*tevs, ntevs,752752+ ret = post_process_probe_trace_events(pev, *tevs, ntevs,775753 pev->target, pev->uprobes);776754 if (ret < 0 || ret == ntevs) {777755 clear_probe_trace_events(*tevs, ntevs);···29582936 return err;29592937}2960293829612961-bool __weak arch__prefers_symtab(void) { return false; }29622962-29632939/* Concatinate two arrays */29642940static void *memcat(void *a, size_t sz_a, void *b, size_t sz_b)29652941{···31773157 ret = find_probe_trace_events_from_cache(pev, tevs);31783158 if (ret > 0 || pev->sdt) /* SDT can be found only in the cache */31793159 return ret == 0 ? -ENOENT : ret; /* Found in probe cache */31803180-31813181- if (arch__prefers_symtab() && !perf_probe_event_need_dwarf(pev)) {31823182- ret = find_probe_trace_events_from_map(pev, tevs);31833183- if (ret > 0)31843184- return ret; /* Found in symbol table */31853185- }3186316031873161 /* Convert perf_probe_event with debuginfo */31883162 ret = try_to_find_probe_trace_events(pev, tevs);
···297297 char sbuf[STRERR_BUFSIZE];298298 int bsize, boffs, total;299299 int ret;300300+ char sign;300301301302 /* TODO: check all types */302302- if (cast && strcmp(cast, "string") != 0) {303303+ if (cast && strcmp(cast, "string") != 0 &&304304+ strcmp(cast, "s") != 0 && strcmp(cast, "u") != 0) {303305 /* Non string type is OK */306306+ /* and respect signedness cast */304307 tvar->type = strdup(cast);305308 return (tvar->type == NULL) ? -ENOMEM : 0;306309 }···364361 return (tvar->type == NULL) ? -ENOMEM : 0;365362 }366363364364+ if (cast && (strcmp(cast, "u") == 0))365365+ sign = 'u';366366+ else if (cast && (strcmp(cast, "s") == 0))367367+ sign = 's';368368+ else369369+ sign = die_is_signed_type(&type) ? 's' : 'u';370370+367371 ret = dwarf_bytesize(&type);368372 if (ret <= 0)369373 /* No size ... try to use default type */···383373 dwarf_diename(&type), MAX_BASIC_TYPE_BITS);384374 ret = MAX_BASIC_TYPE_BITS;385375 }386386- ret = snprintf(buf, 16, "%c%d",387387- die_is_signed_type(&type) ? 's' : 'u', ret);376376+ ret = snprintf(buf, 16, "%c%d", sign, ret);388377389378formatted:390379 if (ret < 0 || ret >= 16) {
+5-1
tools/perf/util/sort.c
···588588 } else {589589 pevent_event_info(&seq, evsel->tp_format, &rec);590590 }591591- return seq.buffer;591591+ /*592592+ * Trim the buffer, it starts at 4KB and we're not going to593593+ * add anything more to this buffer.594594+ */595595+ return realloc(seq.buffer, seq.len + 1);592596}593597594598static int64_t
···7373 int i, vcpu_lock_idx = -1, ret;7474 struct kvm_vcpu *vcpu;75757676- mutex_lock(&kvm->lock);7777-7878- if (irqchip_in_kernel(kvm)) {7979- ret = -EEXIST;8080- goto out;8181- }7676+ if (irqchip_in_kernel(kvm))7777+ return -EEXIST;82788379 /*8480 * This function is also called by the KVM_CREATE_IRQCHIP handler,···8387 * the proper checks already.8488 */8589 if (type == KVM_DEV_TYPE_ARM_VGIC_V2 &&8686- !kvm_vgic_global_state.can_emulate_gicv2) {8787- ret = -ENODEV;8888- goto out;8989- }9090+ !kvm_vgic_global_state.can_emulate_gicv2)9191+ return -ENODEV;90929193 /*9294 * Any time a vcpu is run, vcpu_load is called which tries to grab the···132138 vcpu = kvm_get_vcpu(kvm, vcpu_lock_idx);133139 mutex_unlock(&vcpu->mutex);134140 }135135-136136-out:137137- mutex_unlock(&kvm->lock);138141 return ret;139142}140143
+15-1
virt/kvm/kvm_main.c
···696696{697697 struct kvm_device *dev, *tmp;698698699699+ /*700700+ * We do not need to take the kvm->lock here, because nobody else701701+ * has a reference to the struct kvm at this point and therefore702702+ * cannot access the devices list anyhow.703703+ */699704 list_for_each_entry_safe(dev, tmp, &kvm->devices, vm_node) {700705 list_del(&dev->vm_node);701706 dev->ops->destroy(dev);···28372832 dev->ops = ops;28382833 dev->kvm = kvm;2839283428352835+ mutex_lock(&kvm->lock);28402836 ret = ops->create(dev, cd->type);28412837 if (ret < 0) {28382838+ mutex_unlock(&kvm->lock);28422839 kfree(dev);28432840 return ret;28442841 }28422842+ list_add(&dev->vm_node, &kvm->devices);28432843+ mutex_unlock(&kvm->lock);28442844+28452845+ if (ops->init)28462846+ ops->init(dev);2845284728462848 ret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);28472849 if (ret < 0) {28482850 ops->destroy(dev);28512851+ mutex_lock(&kvm->lock);28522852+ list_del(&dev->vm_node);28532853+ mutex_unlock(&kvm->lock);28492854 return ret;28502855 }2851285628522852- list_add(&dev->vm_node, &kvm->devices);28532857 kvm_get_kvm(kvm);28542858 cd->fd = ret;28552859 return 0;