1. 28 Jan, 2021 9 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.11-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · e5ff2cb9
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
      
       - A fix for a regression introduced in 5.11 resulting in Xen dom0
         having problems to correctly initialize Xenstore.
      
       - A fix for avoiding WARN splats when booting as Xen dom0 with
         CONFIG_AMD_MEM_ENCRYPT enabled due to a missing trap handler for the
         #VC exception (even if the handler should never be called).
      
       - A fix for the Xen bklfront driver adapting to the correct but
         unexpected behavior of new qemu.
      
      * tag 'for-linus-5.11-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        x86/xen: avoid warning in Xen pv guest with CONFIG_AMD_MEM_ENCRYPT enabled
        xen: Fix XenStore initialisation for XS_LOCAL
        xen-blkfront: allow discard-* nodes to be optional
      e5ff2cb9
    • Linus Torvalds's avatar
      Merge tag 'asm-generic-fixes-v5.11' of... · 228345bf
      Linus Torvalds authored
      Merge tag 'asm-generic-fixes-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
      
      Pull ia64 fixes from Arnd Bergmann:
       "asm-generic/ia64 fixes, and mark as orphaned
      
        Commit 2b49ddce ("ia64: convert to legacy_timer_tick") from my
        timer series I merged through the asm-generic tree caused a regression
        on all ia64 machines, as bisected by Adrian Glaubitz.
      
        Tony Luck is no longer really working on ia64, so instead of merging
        the fix through his tree, we ended up deciding that I'd merge the fix
        myself along a patch to mark the architecture as Orphaned and a
        compile time warning fix I made while working on the regression"
      
      [ HPE no longer accepts orders for new Itanium hardware, and Intel
        stopped accepting orders a year ago. While intel is still officially
        shipping chips until July 29, 2021, it's unlikely that any such orders
        actually exist.
      
        It's dead, Jim.
                           - Linus ]
      
      * tag 'asm-generic-fixes-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
        ia64: Mark architecture as orphaned
        ia64: fix xchg() warning
        ia64: fix timer cleanup regression
      228345bf
    • Linus Torvalds's avatar
      Merge tag 'arm-soc-fixes-v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 7485e08e
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "These are the current arm-soc bug fixes for linux-5.11. I already
        merged a larger set that just came in during the past three days but
        has not had much exposure in linux-next, but this is the subset I
        merged last week.
      
        Most of these are for the NXP i.MX platform (descriptions from their
        pull request):
      
         - Fix pcf2127 reset for imx7d-flex-concentrator board.
         - Fix i.MX6 suspend with Thumb-2 kernel.
         - Fix ethernet-phy address issue on imx6qdl-sr-som board.
         - Fix GPIO3 `gpio-ranges` on i.MX8MP.
         - Select SOC_BUS for IMX_SCU driver to fix build issue.
         - Fix backlight pwm on imx6qdl-kontron-samx6i which is lost from
           #pwm-cells conversion.
         - Fix duplicated bus node name for i.MX8MN SoC.
         - Fix reset register offset on LS1028A SoC.
         - Rename MMC node aliases for imx6q-tbs2910 to keep the MMC device
           index consistent with previous kernel version.
         - Selecting ARM_GIC_V3 on non-CP15 processors to fix one build
           failure with i.MX8M SoC driver.
         - Fix typos with status property on imx6qdl-kontron-samx6i board.
         - Fix duplicated regulator-name on imx6qdl-gw52xx board.
      
        Aside from i.MX, the bugfixes are all over the place:
      
         - Coccinelle found a refcount imbalance on integrator
         - defconfig fix for TI K3
         - A boot regression fix for ST ux500
         - A code preemption fix for the optee driver
         - USB DMA regression on Broadcom Stingray
         - A bogus boot time warning fix for at91 code"
      
      * tag 'arm-soc-fixes-v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        MAINTAINERS: Include bcm2835 subsequents into search
        arm64: dts: broadcom: Fix USB DMA address translation for Stingray
        drivers: soc: atmel: add null entry at the end of at91_soc_allowed_list[]
        drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs
        tee: optee: replace might_sleep with cond_resched
        firmware: imx: select SOC_BUS to fix firmware build
        arm64: dts: imx8mp: Correct the gpio ranges of gpio3
        ARM: dts: imx6qdl-sr-som: fix some cubox-i platforms
        ARM: imx: build suspend-imx6.S with arm instruction set
        ARM: dts: imx7d-flex-concentrator: fix pcf2127 reset
        ARM: dts: ux500: Reserve memory carveouts
        arm64: defconfig: Drop unused K3 SoC specific options
        bus: arm-integrator-lm: Add of_node_put() before return statement
        ARM: dts: imx6qdl-gw52xx: fix duplicate regulator naming
        ARM: dts: imx6qdl-kontron-samx6i: fix i2c_lcd/cam default status
        ARM: imx: fix imx8m dependencies
        ARM: dts: tbs2910: rename MMC node aliases
        arm64: dts: ls1028a: fix the offset of the reset register
        arm64: dts: imx8mn: Fix duplicate node name
        ARM: dts: imx6qdl-kontron-samx6i: fix pwms for lcd-backlight
      7485e08e
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · b0dfa64d
      Linus Torvalds authored
      Pull rdma fixes from Jason Gunthorpe:
       "Several recent regressions and some bug fixes:
      
         - Typo corrupting the max_recv_sge for cxgb4
      
         - Regression from re-using kernel enums as a HW AbI in vmw_pvrdma
      
         - Sleeping inside a spinlock in hns
      
         - Revert the attempt to fix devlink deadlocks as the fix is more buggy
      
         - Typo in sysfs_emit_at conversions
      
         - Revert the removal of VLAN support in rxe"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        Revert "RDMA/rxe: Remove VLAN code leftovers from RXE"
        RDMA/usnic: Fix misuse of sysfs_emit_at
        Revert "RDMA/mlx5: Fix devlink deadlock on net namespace deletion"
        RDMA/hns: Use mutex instead of spinlock for ida allocation
        RDMA/vmw_pvrdma: Fix network_hdr_type reported in WC
        RDMA/cxgb4: Fix the reported max_recv_sge value
      b0dfa64d
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 25221c99
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - NULL pointer dereference regression fix for Wacom driver (Jason
         Gerecke)
      
       - functional regression fix for pam handling on some Elan and Synaptics
         touchpads (Kai-Heng Feng)
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: wacom: Correct NULL dereference on AES pen proximity
        HID: multitouch: Apply MT_QUIRK_CONFIDENCE quirk for multi-input devices
      25221c99
    • Linus Torvalds's avatar
      Merge tag 'media/v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · fc856f1d
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
      
       - a V4L2 core regression at videobuf2 when checking for single-plane
         dmabuf
      
       - a change at uAPI header v4l2-subdev.h, fixing a breakage as BIT()
         macro is not available in userspace
      
       - fix some regressions at RC core due to the usage of microseconds
         everywhere on it
      
       - a fix for a race condition at RC core
      
       - a rename on a newly-introduced kAPI symbol (v4l2_get_link_rate),
         currently used only by a single driver
      
       - Regression fixes for rcar-vin, cedrus, ite-cir, hantro, css, venus,
         and cec drivers.
      
      * tag 'media/v5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: hantro: Fix reset_raw_fmt initialization
        media: cec: add stm32 driver
        media: cedrus: Fix H264 decoding
        media: v4l2-subdev.h: BIT() is not available in userspace
        media: Revert "media: videobuf2: Fix length check for single plane dmabuf queueing"
        media: rc: ite-cir: fix min_timeout calculation
        media: venus: core: Fix platform driver shutdown
        media: rc: fix timeout handling after switch to microsecond durations
        media: v4l: common: Fix naming of v4l2_get_link_rate
        media: rcar-vin: fix return, use ret instead of zero
        media: ccs: Get static data version minor correctly
        media: ccs-pll: Fix link frequency for C-PHY
        media: rc: ensure that uevent can be read directly after rc device register
      fc856f1d
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · a467b073
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "A handful of clk driver fixes:
      
         - Build fix for CONFIG_PM=n in the mmp2 driver
      
         - Kconfig warning for unmet dependencies in the i.MX driver
      
         - Make the camera AHB clk always be enabled on qcom sc7180
      
         - Use rate round down semantics for qcom sm8250 SD clks"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: mmp2: fix build without CONFIG_PM
        clk: qcom: gcc-sm250: Use floor ops for sdcc clks
        clk: imx: fix Kconfig warning for i.MX SCU clk
        clk: qcom: gcc-sc7180: Mark the camera abh clock always ON
      a467b073
    • Linus Torvalds's avatar
      Merge tag 'sound-5.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · be4a3385
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Although the incoming fixes haven't settled down yet, all changes here
        are small and mostly device-specific fixes, so nothing look worrisome.
      
         - Yet another USB-audio regression fixes
      
         - HD-audio ID fix and device-specific quirks
      
         - SOF Intel / SoundWire fixes including topology
      
         - ASoC Qualcomm and Mediatek fixes"
      
      * tag 'sound-5.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (24 commits)
        ALSA: hda/via: Apply the workaround generically for Clevo machines
        ASoC: Intel: sof_sdw: set proper flags for Dell TGL-H SKU 0A5E
        ASoC: qcom: lpass: Fix out-of-bounds DAI ID lookup
        ASoC: mediatek: mt8192-mt6359: add format constraints for RT5682
        ASoC: ak4458: correct reset polarity
        ASoC: SOF: SND_INTEL_DSP_CONFIG dependency
        ASoC: SOF: Intel: soundwire: fix select/depend unmet dependencies
        ALSA: hda: intel-dsp-config: add PCI id for TGL-H
        ALSA: usb-audio: workaround for iface reset issue
        ALSA: pcm: One more dependency for hw constraints
        ALSA: hda/realtek: Enable headset of ASUS B1400CEPE with ALC256
        ASoC: Intel: Skylake: Zero snd_ctl_elem_value
        ASoC: Intel: Skylake: skl-topology: Fix OOPs ib skl_tplg_complete
        ASoC: qcom: Fix number of HDMI RDMA channels on sc7180
        ASoC: mediatek: mt8183-da7219: ignore TDM DAI link by default
        ASoC: mediatek: mt8183-mt6358: ignore TDM DAI link by default
        ASoC: topology: Properly unregister DAI on removal
        ASoC: topology: Fix memory corruption in soc_tplg_denum_create_values()
        ASoC: qcom: lpass-ipq806x: fix bitwidth regmap field
        ASoC: AMD Renoir - refine DMI entries for some Lenovo products
        ...
      be4a3385
    • Wang Hai's avatar
      Revert "mm/slub: fix a memory leak in sysfs_slab_add()" · 757fed1d
      Wang Hai authored
      This reverts commit dde3c6b7.
      
      syzbot report a double-free bug. The following case can cause this bug.
      
       - mm/slab_common.c: create_cache(): if the __kmem_cache_create() fails,
         it does:
      
      	out_free_cache:
      		kmem_cache_free(kmem_cache, s);
      
       - but __kmem_cache_create() - at least for slub() - will have done
      
      	sysfs_slab_add(s)
      		-> sysfs_create_group() .. fails ..
      		-> kobject_del(&s->kobj); .. which frees s ...
      
      We can't remove the kmem_cache_free() in create_cache(), because other
      error cases of __kmem_cache_create() do not free this.
      
      So, revert the commit dde3c6b7 ("mm/slub: fix a memory leak in
      sysfs_slab_add()") to fix this.
      
      Reported-by: syzbot+d0bd96b4696c1ef67991@syzkaller.appspotmail.com
      Fixes: dde3c6b7 ("mm/slub: fix a memory leak in sysfs_slab_add()")
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarWang Hai <wanghai38@huawei.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      757fed1d
  2. 27 Jan, 2021 3 commits
    • Linus Torvalds's avatar
      Merge branch 'parisc-5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 76c057c8
      Linus Torvalds authored
      Pull parisc fixes from Helge Deller:
       "Two small fixes:
      
         - Fix linking error with 64-bit kernel when modules are disabled,
           reported by kernel test robot
      
         - Remove leftover reference to power_tasklet, by Davidlohr Bueso"
      
      * 'parisc-5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Enable -mlong-calls gcc option by default when !CONFIG_MODULES
        parisc: Remove leftover reference to the power_tasklet
      76c057c8
    • Juergen Gross's avatar
      x86/xen: avoid warning in Xen pv guest with CONFIG_AMD_MEM_ENCRYPT enabled · 2e924936
      Juergen Gross authored
      When booting a kernel which has been built with CONFIG_AMD_MEM_ENCRYPT
      enabled as a Xen pv guest a warning is issued for each processor:
      
      [    5.964347] ------------[ cut here ]------------
      [    5.968314] WARNING: CPU: 0 PID: 1 at /home/gross/linux/head/arch/x86/xen/enlighten_pv.c:660 get_trap_addr+0x59/0x90
      [    5.972321] Modules linked in:
      [    5.976313] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W         5.11.0-rc5-default #75
      [    5.980313] Hardware name: Dell Inc. OptiPlex 9020/0PC5F7, BIOS A05 12/05/2013
      [    5.984313] RIP: e030:get_trap_addr+0x59/0x90
      [    5.988313] Code: 42 10 83 f0 01 85 f6 74 04 84 c0 75 1d b8 01 00 00 00 c3 48 3d 00 80 83 82 72 08 48 3d 20 81 83 82 72 0c b8 01 00 00 00 eb db <0f> 0b 31 c0 c3 48 2d 00 80 83 82 48 ba 72 1c c7 71 1c c7 71 1c 48
      [    5.992313] RSP: e02b:ffffc90040033d38 EFLAGS: 00010202
      [    5.996313] RAX: 0000000000000001 RBX: ffffffff82a141d0 RCX: ffffffff8222ec38
      [    6.000312] RDX: ffffffff8222ec38 RSI: 0000000000000005 RDI: ffffc90040033d40
      [    6.004313] RBP: ffff8881003984a0 R08: 0000000000000007 R09: ffff888100398000
      [    6.008312] R10: 0000000000000007 R11: ffffc90040246000 R12: ffff8884082182a8
      [    6.012313] R13: 0000000000000100 R14: 000000000000001d R15: ffff8881003982d0
      [    6.016316] FS:  0000000000000000(0000) GS:ffff888408200000(0000) knlGS:0000000000000000
      [    6.020313] CS:  e030 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    6.024313] CR2: ffffc900020ef000 CR3: 000000000220a000 CR4: 0000000000050660
      [    6.028314] Call Trace:
      [    6.032313]  cvt_gate_to_trap.part.7+0x3f/0x90
      [    6.036313]  ? asm_exc_double_fault+0x30/0x30
      [    6.040313]  xen_convert_trap_info+0x87/0xd0
      [    6.044313]  xen_pv_cpu_up+0x17a/0x450
      [    6.048313]  bringup_cpu+0x2b/0xc0
      [    6.052313]  ? cpus_read_trylock+0x50/0x50
      [    6.056313]  cpuhp_invoke_callback+0x80/0x4c0
      [    6.060313]  _cpu_up+0xa7/0x140
      [    6.064313]  cpu_up+0x98/0xd0
      [    6.068313]  bringup_nonboot_cpus+0x4f/0x60
      [    6.072313]  smp_init+0x26/0x79
      [    6.076313]  kernel_init_freeable+0x103/0x258
      [    6.080313]  ? rest_init+0xd0/0xd0
      [    6.084313]  kernel_init+0xa/0x110
      [    6.088313]  ret_from_fork+0x1f/0x30
      [    6.092313] ---[ end trace be9ecf17dceeb4f3 ]---
      
      Reason is that there is no Xen pv trap entry for X86_TRAP_VC.
      
      Fix that by adding a generic trap handler for unknown traps and wire all
      unknown bare metal handlers to this generic handler, which will just
      crash the system in case such a trap will ever happen.
      
      Fixes: 0786138c ("x86/sev-es: Add a Runtime #VC Exception Handler")
      Cc: <stable@vger.kernel.org> # v5.10
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarAndrew Cooper <andrew.cooper3@citrix.com>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      2e924936
    • David Woodhouse's avatar
      xen: Fix XenStore initialisation for XS_LOCAL · 5f46400f
      David Woodhouse authored
      In commit 3499ba81 ("xen: Fix event channel callback via INTX/GSI")
      I reworked the triggering of xenbus_probe().
      
      I tried to simplify things by taking out the workqueue based startup
      triggered from wake_waiting(); the somewhat poorly named xenbus IRQ
      handler.
      
      I missed the fact that in the XS_LOCAL case (Dom0 starting its own
      xenstored or xenstore-stubdom, which happens after the kernel is booted
      completely), that IRQ-based trigger is still actually needed.
      
      So... put it back, except more cleanly. By just spawning a xenbus_probe
      thread which waits on xb_waitq and runs the probe the first time it
      gets woken, just as the workqueue-based hack did.
      
      This is actually a nicer approach for *all* the back ends with different
      interrupt methods, and we can switch them all over to that without the
      complex conditions for when to trigger it. But not in -rc6. This is
      the minimal fix for the regression, although it's a step in the right
      direction instead of doing a partial revert and actually putting the
      workqueue back. It's also simpler than the workqueue.
      
      Fixes: 3499ba81 ("xen: Fix event channel callback via INTX/GSI")
      Reported-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/4c9af052a6e0f6485d1de43f2c38b1461996db99.camel@infradead.orgSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      5f46400f
  3. 26 Jan, 2021 15 commits
  4. 25 Jan, 2021 13 commits
    • Paolo Bonzini's avatar
      KVM: x86: allow KVM_REQ_GET_NESTED_STATE_PAGES outside guest mode for VMX · 9a78e158
      Paolo Bonzini authored
      VMX also uses KVM_REQ_GET_NESTED_STATE_PAGES for the Hyper-V eVMCS,
      which may need to be loaded outside guest mode.  Therefore we cannot
      WARN in that case.
      
      However, that part of nested_get_vmcs12_pages is _not_ needed at
      vmentry time.  Split it out of KVM_REQ_GET_NESTED_STATE_PAGES handling,
      so that both vmentry and migration (and in the latter case, independent
      of is_guest_mode) do the parts that are needed.
      
      Cc: <stable@vger.kernel.org> # 5.10.x: f2c7ef3b: KVM: nSVM: cancel KVM_REQ_GET_NESTED_STATE_PAGES
      Cc: <stable@vger.kernel.org> # 5.10.x
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      9a78e158
    • Sean Christopherson's avatar
      KVM: x86: Revert "KVM: x86: Mark GPRs dirty when written" · aed89418
      Sean Christopherson authored
      Revert the dirty/available tracking of GPRs now that KVM copies the GPRs
      to the GHCB on any post-VMGEXIT VMRUN, even if a GPR is not dirty.  Per
      commit de3cd117 ("KVM: x86: Omit caching logic for always-available
      GPRs"), tracking for GPRs noticeably impacts KVM's code footprint.
      
      This reverts commit 1c04d8c9.
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20210122235049.3107620-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      aed89418
    • Sean Christopherson's avatar
      KVM: SVM: Unconditionally sync GPRs to GHCB on VMRUN of SEV-ES guest · 25009140
      Sean Christopherson authored
      Drop the per-GPR dirty checks when synchronizing GPRs to the GHCB, the
      GRPs' dirty bits are set from time zero and never cleared, i.e. will
      always be seen as dirty.  The obvious alternative would be to clear
      the dirty bits when appropriate, but removing the dirty checks is
      desirable as it allows reverting GPR dirty+available tracking, which
      adds overhead to all flavors of x86 VMs.
      
      Note, unconditionally writing the GPRs in the GHCB is tacitly allowed
      by the GHCB spec, which allows the hypervisor (or guest) to provide
      unnecessary info; it's the guest's responsibility to consume only what
      it needs (the hypervisor is untrusted after all).
      
        The guest and hypervisor can supply additional state if desired but
        must not rely on that additional state being provided.
      
      Cc: Brijesh Singh <brijesh.singh@amd.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Fixes: 291bd20d ("KVM: SVM: Add initial support for a VMGEXIT VMEXIT")
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20210122235049.3107620-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      25009140
    • Maxim Levitsky's avatar
      KVM: nVMX: Sync unsync'd vmcs02 state to vmcs12 on migration · d51e1d3f
      Maxim Levitsky authored
      Even when we are outside the nested guest, some vmcs02 fields
      may not be in sync vs vmcs12.  This is intentional, even across
      nested VM-exit, because the sync can be delayed until the nested
      hypervisor performs a VMCLEAR or a VMREAD/VMWRITE that affects those
      rarely accessed fields.
      
      However, during KVM_GET_NESTED_STATE, the vmcs12 has to be up to date to
      be able to restore it.  To fix that, call copy_vmcs02_to_vmcs12_rare()
      before the vmcs12 contents are copied to userspace.
      
      Fixes: 7952d769 ("KVM: nVMX: Sync rarely accessed guest fields only when needed")
      Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Message-Id: <20210114205449.8715-2-mlevitsk@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      d51e1d3f
    • Lorenzo Brescia's avatar
      kvm: tracing: Fix unmatched kvm_entry and kvm_exit events · d95df951
      Lorenzo Brescia authored
      On VMX, if we exit and then re-enter immediately without leaving
      the vmx_vcpu_run() function, the kvm_entry event is not logged.
      That means we will see one (or more) kvm_exit, without its (their)
      corresponding kvm_entry, as shown here:
      
       CPU-1979 [002] 89.871187: kvm_entry: vcpu 1
       CPU-1979 [002] 89.871218: kvm_exit:  reason MSR_WRITE
       CPU-1979 [002] 89.871259: kvm_exit:  reason MSR_WRITE
      
      It also seems possible for a kvm_entry event to be logged, but then
      we leave vmx_vcpu_run() right away (if vmx->emulation_required is
      true). In this case, we will have a spurious kvm_entry event in the
      trace.
      
      Fix these situations by moving trace_kvm_entry() inside vmx_vcpu_run()
      (where trace_kvm_exit() already is).
      
      A trace obtained with this patch applied looks like this:
      
       CPU-14295 [000] 8388.395387: kvm_entry: vcpu 0
       CPU-14295 [000] 8388.395392: kvm_exit:  reason MSR_WRITE
       CPU-14295 [000] 8388.395393: kvm_entry: vcpu 0
       CPU-14295 [000] 8388.395503: kvm_exit:  reason EXTERNAL_INTERRUPT
      
      Of course, not calling trace_kvm_entry() in common x86 code any
      longer means that we need to adjust the SVM side of things too.
      Signed-off-by: default avatarLorenzo Brescia <lorenzo.brescia@edu.unito.it>
      Signed-off-by: default avatarDario Faggioli <dfaggioli@suse.com>
      Message-Id: <160873470698.11652.13483635328769030605.stgit@Wayrath>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      d95df951
    • Zenghui Yu's avatar
      KVM: Documentation: Update description of KVM_{GET,CLEAR}_DIRTY_LOG · 01ead84c
      Zenghui Yu authored
      Update various words, including the wrong parameter name and the vague
      description of the usage of "slot" field.
      Signed-off-by: default avatarZenghui Yu <yuzenghui@huawei.com>
      Message-Id: <20201208043439.895-1-yuzenghui@huawei.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      01ead84c
    • Jay Zhou's avatar
      KVM: x86: get smi pending status correctly · 1f7becf1
      Jay Zhou authored
      The injection process of smi has two steps:
      
          Qemu                        KVM
      Step1:
          cpu->interrupt_request &= \
              ~CPU_INTERRUPT_SMI;
          kvm_vcpu_ioctl(cpu, KVM_SMI)
      
                                      call kvm_vcpu_ioctl_smi() and
                                      kvm_make_request(KVM_REQ_SMI, vcpu);
      
      Step2:
          kvm_vcpu_ioctl(cpu, KVM_RUN, 0)
      
                                      call process_smi() if
                                      kvm_check_request(KVM_REQ_SMI, vcpu) is
                                      true, mark vcpu->arch.smi_pending = true;
      
      The vcpu->arch.smi_pending will be set true in step2, unfortunately if
      vcpu paused between step1 and step2, the kvm_run->immediate_exit will be
      set and vcpu has to exit to Qemu immediately during step2 before mark
      vcpu->arch.smi_pending true.
      During VM migration, Qemu will get the smi pending status from KVM using
      KVM_GET_VCPU_EVENTS ioctl at the downtime, then the smi pending status
      will be lost.
      Signed-off-by: default avatarJay Zhou <jianjay.zhou@huawei.com>
      Signed-off-by: default avatarShengen Zhuang <zhuangshengen@huawei.com>
      Message-Id: <20210118084720.1585-1-jianjay.zhou@huawei.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      1f7becf1
    • Like Xu's avatar
      KVM: x86/pmu: Fix HW_REF_CPU_CYCLES event pseudo-encoding in intel_arch_events[] · 98dd2f10
      Like Xu authored
      The HW_REF_CPU_CYCLES event on the fixed counter 2 is pseudo-encoded as
      0x0300 in the intel_perfmon_event_map[]. Correct its usage.
      
      Fixes: 62079d8a ("KVM: PMU: add proper support for fixed counter 2")
      Signed-off-by: default avatarLike Xu <like.xu@linux.intel.com>
      Message-Id: <20201230081916.63417-1-like.xu@linux.intel.com>
      Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      98dd2f10
    • Like Xu's avatar
      KVM: x86/pmu: Fix UBSAN shift-out-of-bounds warning in intel_pmu_refresh() · e61ab2a3
      Like Xu authored
      Since we know vPMU will not work properly when (1) the guest bit_width(s)
      of the [gp|fixed] counters are greater than the host ones, or (2) guest
      requested architectural events exceeds the range supported by the host, so
      we can setup a smaller left shift value and refresh the guest cpuid entry,
      thus fixing the following UBSAN shift-out-of-bounds warning:
      
      shift exponent 197 is too large for 64-bit type 'long long unsigned int'
      
      Call Trace:
       __dump_stack lib/dump_stack.c:79 [inline]
       dump_stack+0x107/0x163 lib/dump_stack.c:120
       ubsan_epilogue+0xb/0x5a lib/ubsan.c:148
       __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x181 lib/ubsan.c:395
       intel_pmu_refresh.cold+0x75/0x99 arch/x86/kvm/vmx/pmu_intel.c:348
       kvm_vcpu_after_set_cpuid+0x65a/0xf80 arch/x86/kvm/cpuid.c:177
       kvm_vcpu_ioctl_set_cpuid2+0x160/0x440 arch/x86/kvm/cpuid.c:308
       kvm_arch_vcpu_ioctl+0x11b6/0x2d70 arch/x86/kvm/x86.c:4709
       kvm_vcpu_ioctl+0x7b9/0xdb0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3386
       vfs_ioctl fs/ioctl.c:48 [inline]
       __do_sys_ioctl fs/ioctl.c:753 [inline]
       __se_sys_ioctl fs/ioctl.c:739 [inline]
       __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Reported-by: syzbot+ae488dc136a4cc6ba32b@syzkaller.appspotmail.com
      Signed-off-by: default avatarLike Xu <like.xu@linux.intel.com>
      Message-Id: <20210118025800.34620-1-like.xu@linux.intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e61ab2a3
    • Sean Christopherson's avatar
      KVM: x86: Add more protection against undefined behavior in rsvd_bits() · eb79cd00
      Sean Christopherson authored
      Add compile-time asserts in rsvd_bits() to guard against KVM passing in
      garbage hardcoded values, and cap the upper bound at '63' for dynamic
      values to prevent generating a mask that would overflow a u64.
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20210113204515.3473079-1-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      eb79cd00
    • Quentin Perret's avatar
      KVM: Documentation: Fix spec for KVM_CAP_ENABLE_CAP_VM · a10f373a
      Quentin Perret authored
      The documentation classifies KVM_ENABLE_CAP with KVM_CAP_ENABLE_CAP_VM
      as a vcpu ioctl, which is incorrect. Fix it by specifying it as a VM
      ioctl.
      
      Fixes: e5d83c74 ("kvm: make KVM_CAP_ENABLE_CAP_VM architecture agnostic")
      Signed-off-by: default avatarQuentin Perret <qperret@google.com>
      Message-Id: <20210108165349.747359-1-qperret@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a10f373a
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-5.11-2' of... · 615099b0
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
      
      KVM/arm64 fixes for 5.11, take #2
      
      - Don't allow tagged pointers to point to memslots
      - Filter out ARMv8.1+ PMU events on v8.0 hardware
      - Hide PMU registers from userspace when no PMU is configured
      - More PMU cleanups
      - Don't try to handle broken PSCI firmware
      - More sys_reg() to reg_to_encoding() conversions
      615099b0
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · 13391c60
      Linus Torvalds authored
      Pull crypto fix from Herbert Xu:
       "Fix a regression in the cesa driver"
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: marvel/cesa - Fix tdma descriptor on 64-bit
      13391c60