1. 20 3月, 2020 3 次提交
    • L
      Merge tag '5.6-rc6-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · cd607737
      Linus Torvalds 提交于
      Pull cifs fixes from Steve French:
       "Three small smb3 fixes, two for stable"
      
      * tag '5.6-rc6-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        CIFS: fiemap: do not return EINVAL if get nothing
        CIFS: Increment num_remote_opens stats counter even in case of smb2_query_dir_first
        cifs: potential unintitliazed error code in cifs_getattr()
      cd607737
    • L
      Merge tag 'kbuild-fixes-v5.6-3' of... · 207f75c4
      Linus Torvalds 提交于
      Merge tag 'kbuild-fixes-v5.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - fix __uint128_t capability test in Kconfig when GCC that defaults to
         32-bit is used to build the 64-bit kernel
      
       - suppress new noisy Clang warnings -Wpointer-to-enum-cast
      
       - move the namespace field in Module.symvers for the backward
         compatibility reason for the depmod tool
      
       - use available compression for initramdisk when INTRAMFS_SOURCE is
         defined, which was the original behavior
      
       - fix modpost to handle correct large section numbers when it refers to
         modversion CRCs and module namespaces
      
       - fix comments and documents
      
      * tag 'kbuild-fixes-v5.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        scripts/kallsyms: fix wrong kallsyms_relative_base
        modpost: Get proper section index by get_secindex() instead of st_shndx
        initramfs: restore default compression behavior
        modpost: move the namespace field in Module.symvers last
        kbuild: Disable -Wpointer-to-enum-cast
        kbuild: doc: fix references to other documents
        int128: fix __uint128_t compiler test in Kconfig
        kconfig: introduce m32-flag and m64-flag
        kbuild: Fix inconsistent comment
      207f75c4
    • C
      rtc: max8907: add missing select REGMAP_IRQ · 5d892919
      Corentin Labbe 提交于
      I have hit the following build error:
      
        armv7a-hardfloat-linux-gnueabi-ld: drivers/rtc/rtc-max8907.o: in function `max8907_rtc_probe':
        rtc-max8907.c:(.text+0x400): undefined reference to `regmap_irq_get_virq'
      
      max8907 should select REGMAP_IRQ
      
      Fixes: 94c01ab6 ("rtc: add MAX8907 RTC driver")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NCorentin Labbe <clabbe@baylibre.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5d892919
  2. 19 3月, 2020 5 次提交
    • M
      scripts/kallsyms: fix wrong kallsyms_relative_base · 7883a143
      Mikhail Petrov 提交于
      There is the code in the read_symbol function in 'scripts/kallsyms.c':
      
      	if (is_ignored_symbol(name, type))
      		return NULL;
      
      	/* Ignore most absolute/undefined (?) symbols. */
      	if (strcmp(name, "_text") == 0)
      		_text = addr;
      
      But the is_ignored_symbol function returns true for name="_text" and
      type='A'. So the next condition is not executed and the _text variable
      is always zero.
      
      It makes the wrong kallsyms_relative_base symbol as a result of the code
      (CONFIG_KALLSYMS_BASE_RELATIVE is defined):
      
      	if (base_relative) {
      		output_label("kallsyms_relative_base");
      		output_address(relative_base);
      		printf("\n");
      	}
      
      Because the output_address function uses the _text variable.
      
      So the kallsyms_lookup function and all related functions in the kernel
      do not work properly. For example, the stack trace in oops:
      
       Call Trace:
       [aa095e58] [809feab8] kobj_ns_ops_tbl+0x7ff09ac8/0x7ff1c1c4 (unreliable)
       [aa095e98] [80002b64] kobj_ns_ops_tbl+0x7f50db74/0x80000010
       [aa095ef8] [809c3d24] kobj_ns_ops_tbl+0x7feced34/0x7ff1c1c4
       [aa095f28] [80002ed0] kobj_ns_ops_tbl+0x7f50dee0/0x80000010
       [aa095f38] [8000f238] kobj_ns_ops_tbl+0x7f51a248/0x80000010
      
      The right stack trace:
      
       Call Trace:
       [aa095e58] [809feab8] module_vdu_video_init+0x2fc/0x3bc (unreliable)
       [aa095e98] [80002b64] do_one_initcall+0x40/0x1f0
       [aa095ef8] [809c3d24] kernel_init_freeable+0x164/0x1d8
       [aa095f28] [80002ed0] kernel_init+0x14/0x124
       [aa095f38] [8000f238] ret_from_kernel_thread+0x14/0x1c
      
      [masahiroy@kernel.org:
      
      This issue happens on binutils <= 2.22
      The following commit fixed it:
      https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d2667025dd30611514810c28bee9709e4623012a
      
      The symbol type of _text is 'T' on binutils >= 2.23
      The minimal supported binutils version for the kernel build is 2.21
      ]
      Signed-off-by: NMikhail Petrov <Mikhail.Petrov@mir.dev>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      7883a143
    • L
      locks: reinstate locks_delete_block optimization · dcf23ac3
      Linus Torvalds 提交于
      There is measurable performance impact in some synthetic tests due to
      commit 6d390e4b (locks: fix a potential use-after-free problem when
      wakeup a waiter). Fix the race condition instead by clearing the
      fl_blocker pointer after the wake_up, using explicit acquire/release
      semantics.
      
      This does mean that we can no longer use the clearing of fl_blocker as
      the wait condition, so switch the waiters over to checking whether the
      fl_blocked_member list_head is empty.
      Reviewed-by: Nyangerkun <yangerkun@huawei.com>
      Reviewed-by: NNeilBrown <neilb@suse.de>
      Fixes: 6d390e4b (locks: fix a potential use-after-free problem when wakeup a waiter)
      Signed-off-by: NJeff Layton <jlayton@kernel.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dcf23ac3
    • X
      modpost: Get proper section index by get_secindex() instead of st_shndx · 4b8a5cfb
      Xiao Yang 提交于
      (uint16_t) st_shndx is limited to 65535(i.e. SHN_XINDEX) so sym_get_data() gets
      wrong section index by st_shndx if requested symbol contains extended section
      index that is more than 65535.  In this case, we need to get proper section index
      by .symtab_shndx section.
      
      Module.symvers generated by building kernel with "-ffunction-sections -fdata-sections"
      shows the issue.
      
      Fixes: 56067812 ("kbuild: modversions: add infrastructure for emitting relative CRCs")
      Fixes: e84f9fbb ("modpost: refactor namespace_from_kstrtabns() to not hard-code section name")
      Signed-off-by: NXiao Yang <yangx.jy@cn.fujitsu.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      4b8a5cfb
    • L
      mm: slub: be more careful about the double cmpxchg of freelist · 5076190d
      Linus Torvalds 提交于
      This is just a cleanup addition to Jann's fix to properly update the
      transaction ID for the slub slowpath in commit fd4d9c7d ("mm: slub:
      add missing TID bump..").
      
      The transaction ID is what protects us against any concurrent accesses,
      but we should really also make sure to make the 'freelist' comparison
      itself always use the same freelist value that we then used as the new
      next free pointer.
      
      Jann points out that if we do all of this carefully, we could skip the
      transaction ID update for all the paths that only remove entries from
      the lists, and only update the TID when adding entries (to avoid the ABA
      issue with cmpxchg and list handling re-adding a previously seen value).
      
      But this patch just does the "make sure to cmpxchg the same value we
      used" rather than then try to be clever.
      Acked-by: NJann Horn <jannh@google.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5076190d
    • J
      mm: slub: add missing TID bump in kmem_cache_alloc_bulk() · fd4d9c7d
      Jann Horn 提交于
      When kmem_cache_alloc_bulk() attempts to allocate N objects from a percpu
      freelist of length M, and N > M > 0, it will first remove the M elements
      from the percpu freelist, then call ___slab_alloc() to allocate the next
      element and repopulate the percpu freelist. ___slab_alloc() can re-enable
      IRQs via allocate_slab(), so the TID must be bumped before ___slab_alloc()
      to properly commit the freelist head change.
      
      Fix it by unconditionally bumping c->tid when entering the slowpath.
      
      Cc: stable@vger.kernel.org
      Fixes: ebe909e0 ("slub: improve bulk alloc strategy")
      Signed-off-by: NJann Horn <jannh@google.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fd4d9c7d
  3. 18 3月, 2020 4 次提交
  4. 17 3月, 2020 4 次提交
    • E
      initramfs: restore default compression behavior · 785d74ec
      Eugeniy Paltsev 提交于
      Even though INITRAMFS_SOURCE kconfig option isn't set in most of
      defconfigs it is used (set) extensively by various build systems.
      Commit f26661e1 ("initramfs: make initramfs compression choice
      non-optional") has changed default compression mode. Previously we
      compress initramfs using available compression algorithm. Now
      we don't use any compression at all by default.
      It significantly increases the image size in case of build system
      chooses embedded initramfs. Initially I faced with this issue while
      using buildroot.
      
      As of today it's not possible to set preferred compression mode
      in target defconfig as this option depends on INITRAMFS_SOURCE
      being set. Modification of all build systems either doesn't look
      like good option.
      
      Let's instead rewrite initramfs compression mode choices list
      the way that "INITRAMFS_COMPRESSION_NONE" will be the last option
      in the list. In that case it will be chosen only if all other
      options (which implements any compression) are not available.
      Signed-off-by: NEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      785d74ec
    • J
      modpost: move the namespace field in Module.symvers last · 5190044c
      Jessica Yu 提交于
      In order to preserve backwards compatability with kmod tools, we have to
      move the namespace field in Module.symvers last, as the depmod -e -E
      option looks at the first three fields in Module.symvers to check symbol
      versions (and it's expected they stay in the original order of crc,
      symbol, module).
      
      In addition, update an ancient comment above read_dump() in modpost that
      suggested that the export type field in Module.symvers was optional. I
      suspect that there were historical reasons behind that comment that are
      no longer accurate. We have been unconditionally printing the export
      type since 2.6.18 (commit bd5cbced), which is over a decade ago now.
      
      Fix up read_dump() to treat each field as non-optional. I suspect the
      original read_dump() code treated the export field as optional in order
      to support pre <= 2.6.18 Module.symvers (which did not have the export
      type field). Note that although symbol namespaces are optional, the
      field will not be omitted from Module.symvers if a symbol does not have
      a namespace. In this case, the field will simply be empty and the next
      delimiter or end of line will follow.
      
      Cc: stable@vger.kernel.org
      Fixes: cb9b55d2 ("modpost: add support for symbol namespaces")
      Tested-by: NMatthias Maennich <maennich@google.com>
      Reviewed-by: NMatthias Maennich <maennich@google.com>
      Reviewed-by: NLucas De Marchi <lucas.demarchi@intel.com>
      Signed-off-by: NJessica Yu <jeyu@kernel.org>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      5190044c
    • L
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · 3d135f52
      Linus Torvalds 提交于
      Pull ARM fixes from Russell King:
      
       - allow use of ARMv8 arch timer in 32-bit VDSO
      
       - rename missed .fixup section
      
       - fix kbuild issue with stack protector GCC plugin
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 8961/2: Fix Kbuild issue caused by per-task stack protector GCC plugin
        ARM: 8958/1: rename missed uaccess .fixup section
        ARM: 8957/1: VDSO: Match ARMv8 timer in cntvct_functional()
      3d135f52
    • T
      HID: add ALWAYS_POLL quirk to lenovo pixart mouse · 819d578d
      Tony Fischetti 提交于
      A lenovo pixart mouse (17ef:608d) is afflicted common the the malfunction
      where it disconnects and reconnects every minute--each time incrementing
      the device number. This patch adds the device id of the device and
      specifies that it needs the HID_QUIRK_ALWAYS_POLL quirk in order to
      work properly.
      Signed-off-by: NTony Fischetti <tony.fischetti@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      819d578d
  5. 16 3月, 2020 10 次提交
    • C
      HID: google: add moonball USB id · 58322a15
      Chen-Tsung Hsieh 提交于
      Add 1 additional hammer-like device.
      Signed-off-by: NChen-Tsung Hsieh <chentsung@chromium.org>
      Reviewed-by: NNicolas Boichat <drinkcat@chromium.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      58322a15
    • L
      Linux 5.6-rc6 · fb33c651
      Linus Torvalds 提交于
      fb33c651
    • L
      Merge tag 'irq-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a42a7bb6
      Linus Torvalds 提交于
      Pull irq fix from Thomas Gleixner:
       "A single commit to handle an erratum in Cavium ThunderX to prevent
        access to GIC registers which are broken in the implementation"
      
      * tag 'irq-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic-v3: Workaround Cavium erratum 38539 when reading GICD_TYPER2
      a42a7bb6
    • L
      Merge tag 'locking-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 34d5a4b3
      Linus Torvalds 提交于
      Pull futex fix from Thomas Gleixner:
       "Fix for yet another subtle futex issue.
      
        The futex code used ihold() to prevent inodes from vanishing, but
        ihold() does not guarantee inode persistence. Replace the inode
        pointer with a per boot, machine wide, unique inode identifier.
      
        The second commit fixes the breakage of the hash mechanism which
        causes a 100% performance regression"
      
      * tag 'locking-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        futex: Unbreak futex hashing
        futex: Fix inode life-time issue
      34d5a4b3
    • L
      Merge tag 'x86-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ec181b7f
      Linus Torvalds 提交于
      Pull x86 fixes from Thomas Gleixner:
       "Two fixes for x86:
      
         - Map EFI runtime service data as encrypted when SEV is enabled.
      
           Otherwise e.g. SMBIOS data cannot be properly decoded by dmidecode.
      
         - Remove the warning in the vector management code which triggered
           when a managed interrupt affinity changed outside of a CPU hotplug
           operation.
      
           The warning was correct until the recent core code change that
           introduced a CPU isolation feature which needs to migrate managed
           interrupts away from online CPUs under certain conditions to
           achieve the isolation"
      
      * tag 'x86-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/vector: Remove warning on managed interrupt migration
        x86/ioremap: Map EFI runtime services data as encrypted for SEV
      ec181b7f
    • L
      Merge tag 'perf-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e99bc917
      Linus Torvalds 提交于
      Pull perf fixes from Thomas Gleixner:
       "A pile of perf fixes:
      
        Kernel side:
      
         - AMD uncore driver: Replace the open coded sanity check with the
           core variant, which provides the correct error code and also leaves
           a hint in dmesg
      
        Tooling:
      
         - Fix the stdio input handling with glibc versions >= 2.28
      
         - Unbreak the futex-wake benchmark which was reduced to 0 test
           threads due to the conversion to cpumaps
      
         - Initialize sigaction structs before invoking sys_sigactio()
      
         - Plug the mapfile memory leak in perf jevents
      
         - Fix off by one relative directory includes
      
         - Fix an undefined string comparison in perf diff"
      
      * tag 'perf-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/amd/uncore: Replace manual sampling check with CAP_NO_INTERRUPT flag
        tools: Fix off-by 1 relative directory includes
        perf jevents: Fix leak of mapfile memory
        perf bench: Clear struct sigaction before sigaction() syscall
        perf bench futex-wake: Restore thread count default to online CPU count
        perf top: Fix stdio interface input handling with glibc 2.28+
        perf diff: Fix undefined string comparision spotted by clang's -Wstring-compare
        perf symbols: Don't try to find a vmlinux file when looking for kernel modules
        perf bench: Share some global variables to fix build with gcc 10
        perf parse-events: Use asprintf() instead of strncpy() to read tracepoint files
        perf env: Do not return pointers to local variables
        perf tests bp_account: Make global variable static
      e99bc917
    • L
      Merge tag 'timers-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ffe6da91
      Linus Torvalds 提交于
      Pull timer fix from Thomas Gleixner:
       "A single fix adding the missing time namespace adjustment in
        sys/sysinfo which caused sys/sysinfo to be inconsistent with
        /proc/uptime when read from a task inside a time namespace"
      
      * tag 'timers-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sys/sysinfo: Respect boottime inside time namespace
      ffe6da91
    • L
      Merge tag 'ras-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 52ac3777
      Linus Torvalds 提交于
      Pull RAS fixes from Thomas Gleixner:
       "Two RAS related fixes:
      
         - Shut down the per CPU thermal throttling poll work properly when a
           CPU goes offline.
      
           The missing shutdown caused the poll work to be migrated to a
           unbound worker which triggered warnings about the usage of
           smp_processor_id() in preemptible context
      
         - Fix the PPIN feature initialization which missed to enable the
           functionality when PPIN_CTL was enabled but the MSR locked against
           updates"
      
      * tag 'ras-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mce: Fix logic and comments around MSR_PPIN_CTL
        x86/mce/therm_throt: Undo thermal polling properly on CPU offline
      52ac3777
    • L
      Merge tag 'efi-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b67775e1
      Linus Torvalds 提交于
      Pull EFI fixes from Thomas Gleixner:
       "Two EFI fixes:
      
         - Prevent a race and buffer overflow in the sysfs efivars interface
           which causes kernel memory corruption.
      
         - Add the missing NULL pointer checks in efivar_store_raw()"
      
      * tag 'efi-urgent-2020-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi: Add a sanity check to efivar_store_raw()
        efi: Fix a race and a buffer overflow while reading efivars via sysfs
      b67775e1
    • L
      Merge tag 'iommu-fixes-v5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · de28a65c
      Linus Torvalds 提交于
      Pull IOMMU fixes from Joerg Roedel:
      
       - Intel VT-d fixes:
          - RCU list handling fixes
          - Replace WARN_TAINT with pr_warn + add_taint for reporting firmware
            issues
          - DebugFS fixes
          - Fix for hugepage handling in iova_to_phys implementation
          - Fix for handling VMD devices, which have a domain number which
            doesn't fit into 16 bits
          - Warning message fix
      
       - MSI allocation fix for iommu-dma code
      
       - Sign-extension fix for io page-table code
      
       - Fix for AMD-Vi to properly update the is-running bit when AVIC is
         used
      
      * tag 'iommu-fixes-v5.6-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Populate debugfs if IOMMUs are detected
        iommu/amd: Fix IOMMU AVIC not properly update the is_run bit in IRTE
        iommu/vt-d: Ignore devices with out-of-spec domain number
        iommu/vt-d: Fix the wrong printing in RHSA parsing
        iommu/vt-d: Fix debugfs register reads
        iommu/vt-d: quirk_ioat_snb_local_iommu: replace WARN_TAINT with pr_warn + add_taint
        iommu/vt-d: dmar_parse_one_rmrr: replace WARN_TAINT with pr_warn + add_taint
        iommu/vt-d: dmar: replace WARN_TAINT with pr_warn + add_taint
        iommu/vt-d: Silence RCU-list debugging warnings
        iommu/vt-d: Fix RCU-list bugs in intel_iommu_init()
        iommu/dma: Fix MSI reservation allocation
        iommu/io-pgtable-arm: Fix IOVA validation for 32-bit
        iommu/vt-d: Fix a bug in intel_iommu_iova_to_phys() for huge page
        iommu/vt-d: Fix RCU list debugging warnings
      de28a65c
  6. 15 3月, 2020 5 次提交
  7. 14 3月, 2020 9 次提交
    • L
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 69a4d0ba
      Linus Torvalds 提交于
      Pull clk fixes from Stephen Boyd:
       "A small collection of fixes. I'll make another sweep soon to look for
        more fixes for this -rc series.
      
         - Mark device node const in of_clk_get_parent APIs to ease landing
           changes in users later
      
         - Fix flag for Qualcomm SC7180 video clocks where we thought it would
           never turn off but actually hardware takes care of it
      
         - Remove disp_cc_mdss_rscc_ahb_clk on Qualcomm SC7180 SoCs because
           this clk is always on anyway
      
         - Correct some bad dt-binding numbers for i.MX8MN SoCs"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: imx8mn: Fix incorrect clock defines
        clk: qcom: dispcc: Remove support of disp_cc_mdss_rscc_ahb_clk
        clk: qcom: videocc: Update the clock flag for video_cc_vcodec0_core_clk
        of: clk: Make of_clk_get_parent_{count,name}() parameter const
      69a4d0ba
    • P
      Merge branch 'kvm-null-pointer-fix' into kvm-master · 018cabb6
      Paolo Bonzini 提交于
      018cabb6
    • V
      KVM: nVMX: avoid NULL pointer dereference with incorrect EVMCS GPAs · 95fa1010
      Vitaly Kuznetsov 提交于
      When an EVMCS enabled L1 guest on KVM will tries doing enlightened VMEnter
      with EVMCS GPA = 0 the host crashes because the
      
      evmcs_gpa != vmx->nested.hv_evmcs_vmptr
      
      condition in nested_vmx_handle_enlightened_vmptrld() will evaluate to
      false (as nested.hv_evmcs_vmptr is zeroed after init). The crash will
      happen on vmx->nested.hv_evmcs pointer dereference.
      
      Another problematic EVMCS ptr value is '-1' but it only causes host crash
      after nested_release_evmcs() invocation. The problem is exactly the same as
      with '0', we mistakenly think that the EVMCS pointer hasn't changed and
      thus nested.hv_evmcs_vmptr is valid.
      
      Resolve the issue by adding an additional !vmx->nested.hv_evmcs
      check to nested_vmx_handle_enlightened_vmptrld(), this way we will
      always be trying kvm_vcpu_map() when nested.hv_evmcs is NULL
      and this is supposed to catch all invalid EVMCS GPAs.
      
      Also, initialize hv_evmcs_vmptr to '0' in nested_release_evmcs()
      to be consistent with initialization where we don't currently
      set hv_evmcs_vmptr to '-1'.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      95fa1010
    • P
      Merge tag 'kvm-s390-master-5.6-1' of... · 997224fe
      Paolo Bonzini 提交于
      Merge tag 'kvm-s390-master-5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into kvm-master
      
      KVM: s390: Fully do the CPU resets as intended
      
      With 7de3f142 ("KVM: s390: Add new reset vcpu API") we clarified
      the meaning of the reset ioctl to fully reset the CPU and not only the
      parts that can not be handled by userspace. Turns out that we missed
      some parts.
      997224fe
    • M
      irqchip/gic-v3: Workaround Cavium erratum 38539 when reading GICD_TYPER2 · d01fd161
      Marc Zyngier 提交于
      Despite the architecture spec requiring that reserved registers in the GIC
      distributor memory map are RES0 (and thus are not allowed to generate
      an exception), the Cavium ThunderX (aka TX1) SoC explodes as such:
      
      [    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
      [    0.000000] GICv3: 128 SPIs implemented
      [    0.000000] GICv3: 0 Extended SPIs implemented
      [    0.000000] Internal error: synchronous external abort: 96000210 [#1] SMP
      [    0.000000] Modules linked in:
      [    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.0-rc4-00035-g3cf6a3d5725f #7956
      [    0.000000] Hardware name: cavium,thunder-88xx (DT)
      [    0.000000] pstate: 60000085 (nZCv daIf -PAN -UAO)
      [    0.000000] pc : __raw_readl+0x0/0x8
      [    0.000000] lr : gic_init_bases+0x110/0x560
      [    0.000000] sp : ffff800011243d90
      [    0.000000] x29: ffff800011243d90 x28: 0000000000000000
      [    0.000000] x27: 0000000000000018 x26: 0000000000000002
      [    0.000000] x25: ffff8000116f0000 x24: ffff000fbe6a2c80
      [    0.000000] x23: 0000000000000000 x22: ffff010fdc322b68
      [    0.000000] x21: ffff800010a7a208 x20: 00000000009b0404
      [    0.000000] x19: ffff80001124dad0 x18: 0000000000000010
      [    0.000000] x17: 000000004d8d492b x16: 00000000f67eb9af
      [    0.000000] x15: ffffffffffffffff x14: ffff800011249908
      [    0.000000] x13: ffff800091243ae7 x12: ffff800011243af4
      [    0.000000] x11: ffff80001126e000 x10: ffff800011243a70
      [    0.000000] x9 : 00000000ffffffd0 x8 : ffff80001069c828
      [    0.000000] x7 : 0000000000000059 x6 : ffff8000113fb4d1
      [    0.000000] x5 : 0000000000000001 x4 : 0000000000000000
      [    0.000000] x3 : 0000000000000000 x2 : 0000000000000000
      [    0.000000] x1 : 0000000000000000 x0 : ffff8000116f000c
      [    0.000000] Call trace:
      [    0.000000]  __raw_readl+0x0/0x8
      [    0.000000]  gic_of_init+0x188/0x224
      [    0.000000]  of_irq_init+0x200/0x3cc
      [    0.000000]  irqchip_init+0x1c/0x40
      [    0.000000]  init_IRQ+0x160/0x1d0
      [    0.000000]  start_kernel+0x2ec/0x4b8
      [    0.000000] Code: a8c47bfd d65f03c0 d538d080 d65f03c0 (b9400000)
      
      when reading the GICv4.1 GICD_TYPER2 register, which is unexpected...
      
      Work around it by adding a new quirk for the following variants:
      
       ThunderX: CN88xx
       OCTEON TX: CN83xx, CN81xx
       OCTEON TX2: CN93xx, CN96xx, CN98xx, CNF95xx*
      
      and use this flag to avoid accessing GICD_TYPER2. Note that all
      reserved registers (including redistributors and ITS) are impacted
      by this erratum, but that only GICD_TYPER2 has to be worked around
      so far.
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      Tested-by: NRobert Richter <rrichter@marvell.com>
      Tested-by: NMark Salter <msalter@redhat.com>
      Tested-by: NTim Harvey <tharvey@gateworks.com>
      Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: NRobert Richter <rrichter@marvell.com>
      Link: https://lore.kernel.org/r/20191027144234.8395-11-maz@kernel.org
      Link: https://lore.kernel.org/r/20200311115649.26060-1-maz@kernel.org
      d01fd161
    • N
      KVM: x86: Initializing all kvm_lapic_irq fields in ioapic_write_indirect · 0c22056f
      Nitesh Narayan Lal 提交于
      Previously all fields of structure kvm_lapic_irq were not initialized
      before it was passed to kvm_bitmap_or_dest_vcpus(). Which will cause
      an issue when any of those fields are used for processing a request.
      For example not initializing the msi_redir_hint field before passing
      to the kvm_bitmap_or_dest_vcpus(), may lead to a misbehavior of
      kvm_apic_map_get_dest_lapic(). This will specifically happen when the
      kvm_lowest_prio_delivery() returns TRUE due to a non-zero garbage
      value of msi_redir_hint, which should not happen as the request belongs
      to APIC fixed delivery mode and we do not want to deliver the
      interrupt only to the lowest priority candidate.
      
      This patch initializes all the fields of kvm_lapic_irq based on the
      values of ioapic redirect_entry object before passing it on to
      kvm_bitmap_or_dest_vcpus().
      
      Fixes: 7ee30bc1 ("KVM: x86: deliver KVM IOAPIC scan request to target vCPUs")
      Signed-off-by: NNitesh Narayan Lal <nitesh@redhat.com>
      Reviewed-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      [Set level to false since the value doesn't really matter. Suggested
       by Vitaly Kuznetsov. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0c22056f
    • S
      KVM: VMX: Condition ENCLS-exiting enabling on CPU support for SGX1 · 7a57c09b
      Sean Christopherson 提交于
      Enable ENCLS-exiting (and thus set vmcs.ENCLS_EXITING_BITMAP) only if
      the CPU supports SGX1.  Per Intel's SDM, all ENCLS leafs #UD if SGX1
      is not supported[*], i.e. intercepting ENCLS to inject a #UD is
      unnecessary.
      
      Avoiding ENCLS-exiting even when it is reported as supported by the CPU
      works around a reported issue where SGX is "hard" disabled after an S3
      suspend/resume cycle, i.e. CPUID.0x7.SGX=0 and the VMCS field/control
      are enumerated as unsupported.  While the root cause of the S3 issue is
      unknown, it's definitely _not_ a KVM (or kernel) bug, i.e. this is a
      workaround for what is most likely a hardware or firmware issue.  As a
      bonus side effect, KVM saves a VMWRITE when first preparing vmcs01 and
      vmcs02.
      
      Note, SGX must be disabled in BIOS to take advantage of this workaround
      
      [*] The additional ENCLS CPUID check on SGX1 exists so that SGX can be
          globally "soft" disabled post-reset, e.g. if #MC bits in MCi_CTL are
          cleared.  Soft disabled meaning disabling SGX without clearing the
          primary CPUID bit (in leaf 0x7) and without poking into non-SGX
          CPU paths, e.g. for the VMCS controls.
      
      Fixes: 0b665d30 ("KVM: vmx: Inject #UD for SGX ENCLS instruction in guest")
      Reported-by: NToni Spets <toni.spets@iki.fi>
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7a57c09b
    • S
      iommu/amd: Fix IOMMU AVIC not properly update the is_run bit in IRTE · 730ad0ed
      Suravee Suthikulpanit 提交于
      Commit b9c6ff94 ("iommu/amd: Re-factor guest virtual APIC
      (de-)activation code") accidentally left out the ir_data pointer when
      calling modity_irte_ga(), which causes the function amd_iommu_update_ga()
      to return prematurely due to struct amd_ir_data.ref is NULL and
      the "is_run" bit of IRTE does not get updated properly.
      
      This results in bad I/O performance since IOMMU AVIC always generate GA Log
      entry and notify IOMMU driver and KVM when it receives interrupt from the
      PCI pass-through device instead of directly inject interrupt to the vCPU.
      
      Fixes by passing ir_data when calling modify_irte_ga() as done previously.
      
      Fixes: b9c6ff94 ("iommu/amd: Re-factor guest virtual APIC (de-)activation code")
      Signed-off-by: NSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      730ad0ed
    • D
      iommu/vt-d: Ignore devices with out-of-spec domain number · da72a379
      Daniel Drake 提交于
      VMD subdevices are created with a PCI domain ID of 0x10000 or
      higher.
      
      These subdevices are also handled like all other PCI devices by
      dmar_pci_bus_notifier().
      
      However, when dmar_alloc_pci_notify_info() take records of such devices,
      it will truncate the domain ID to a u16 value (in info->seg).
      The device at (e.g.) 10000:00:02.0 is then treated by the DMAR code as if
      it is 0000:00:02.0.
      
      In the unlucky event that a real device also exists at 0000:00:02.0 and
      also has a device-specific entry in the DMAR table,
      dmar_insert_dev_scope() will crash on:
         BUG_ON(i >= devices_cnt);
      
      That's basically a sanity check that only one PCI device matches a
      single DMAR entry; in this case we seem to have two matching devices.
      
      Fix this by ignoring devices that have a domain number higher than
      what can be looked up in the DMAR table.
      
      This problem was carefully diagnosed by Jian-Hong Pan.
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NDaniel Drake <drake@endlessm.com>
      Fixes: 59ce0515 ("iommu/vt-d: Update DRHD/RMRR/ATSR device scope caches when PCI hotplug happens")
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      da72a379