1. 15 Oct, 2021 1 commit
    • Jason Gunthorpe's avatar
      vfio: Delete vfio_get/put_group from vfio_iommu_group_notifier() · 63b150fd
      Jason Gunthorpe authored
      iommu_group_register_notifier()/iommu_group_unregister_notifier() are
      built using a blocking_notifier_chain which integrates a rwsem. The
      notifier function cannot be running outside its registration.
      
      When considering how the notifier function interacts with create/destroy
      of the group there are two fringe cases, the notifier starts before
      list_add(&vfio.group_list) and the notifier runs after the kref
      becomes 0.
      
      Prior to vfio_create_group() unlocking and returning we have
         container_users == 0
         device_list == empty
      And this cannot change until the mutex is unlocked.
      
      After the kref goes to zero we must also have
         container_users == 0
         device_list == empty
      
      Both are required because they are balanced operations and a 0 kref means
      some caller became unbalanced. Add the missing assertion that
      container_users must be zero as well.
      
      These two facts are important because when checking each operation we see:
      
      - IOMMU_GROUP_NOTIFY_ADD_DEVICE
         Empty device_list avoids the WARN_ON in vfio_group_nb_add_dev()
         0 container_users ends the call
      - IOMMU_GROUP_NOTIFY_BOUND_DRIVER
         0 container_users ends the call
      
      Finally, we have IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER, which only deletes
      items from the unbound list. During creation this list is empty, during
      kref == 0 nothing can read this list, and it will be freed soon.
      
      Since the vfio_group_release() doesn't hold the appropriate lock to
      manipulate the unbound_list and could race with the notifier, move the
      cleanup to directly before the kfree.
      
      This allows deleting all of the deferred group put code.
      Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
      Reviewed-by: default avatarLiu Yi L <yi.l.liu@intel.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Link: https://lore.kernel.org/r/1-v3-2fdfe4ca2cc6+18c-vfio_group_cdev_jgg@nvidia.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      63b150fd
  2. 12 Oct, 2021 2 commits
    • Alex Williamson's avatar
    • Colin Xu's avatar
      vfio/pci: Add OpRegion 2.0+ Extended VBT support. · 49ba1a29
      Colin Xu authored
      Due to historical reason, some legacy shipped system doesn't follow
      OpRegion 2.1 spec but still stick to OpRegion 2.0, in which the extended
      VBT is not contiguous after OpRegion in physical address, but any
      location pointed by RVDA via absolute address. Also although current
      OpRegion 2.1+ systems appears that the extended VBT follows OpRegion,
      RVDA is the relative address to OpRegion head, the extended VBT location
      may change to non-contiguous to OpRegion. In both cases, it's impossible
      to map a contiguous range to hold both OpRegion and the extended VBT and
      expose via one vfio region.
      
      The only difference between OpRegion 2.0 and 2.1 is where extended
      VBT is stored: For 2.0, RVDA is the absolute address of extended VBT
      while for 2.1, RVDA is the relative address of extended VBT to OpRegion
      baes, and there is no other difference between OpRegion 2.0 and 2.1.
      To support the non-contiguous region case as described, the updated read
      op will patch OpRegion version and RVDA on-the-fly accordingly. So that
      from vfio igd OpRegion view, only 2.1+ with contiguous extended VBT
      after OpRegion is exposed, regardless the underneath host OpRegion is
      2.0 or 2.1+. The mechanism makes it possible to support legacy OpRegion
      2.0 extended VBT systems with on the market, and support OpRegion 2.1+
      where the extended VBT isn't contiguous after OpRegion.
      
      Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
      Cc: Hang Yuan <hang.yuan@linux.intel.com>
      Cc: Swee Yee Fonn <swee.yee.fonn@intel.com>
      Cc: Fred Gao <fred.gao@intel.com>
      Signed-off-by: default avatarColin Xu <colin.xu@intel.com>
      Link: https://lore.kernel.org/r/20211012124855.52463-1-colin.xu@gmail.comSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      49ba1a29
  3. 11 Oct, 2021 1 commit
  4. 30 Sep, 2021 16 commits
  5. 29 Sep, 2021 2 commits
    • Linus Torvalds's avatar
      Merge tag 'sound-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 02d5e016
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "This became a slightly large collection of changes, partly because
        I've been off in the last weeks. Most of changes are small and
        scattered while a bit big change is found in HD-audio Realtek codec
        driver; it's a very device-specific fix that has been long wanted, so
        I decided to pick up although it's in the middle RC.
      
        Some highlights:
      
         - A new guard ioctl for ALSA rawmidi API to avoid the misuse of the
           new timestamp framing mode; it's for a regression fix
      
         - HD-audio: a revert of the 5.15 change that might work badly, new
           quirks for Lenovo Legion & co, a follow-up fix for CS8409
      
         - ASoC: lots of SOF-related fixes, fsl component fixes, corrections
           of mediatek drivers
      
         - USB-audio: fix for the PM resume
      
         - FireWire: oxfw and motu fixes"
      
      * tag 'sound-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (25 commits)
        ALSA: pcsp: Make hrtimer forwarding more robust
        ALSA: rawmidi: introduce SNDRV_RAWMIDI_IOCTL_USER_PVERSION
        ALSA: firewire-motu: fix truncated bytes in message tracepoints
        ASoC: SOF: trace: Omit error print when waking up trace sleepers
        ASoC: mediatek: mt8195: remove wrong fixup assignment on HDMITX
        ASoC: SOF: loader: Re-phrase the missing firmware error to avoid duplication
        ASoC: SOF: loader: release_firmware() on load failure to avoid batching
        ALSA: hda/cs8409: Setup Dolphin Headset Mic as Phantom Jack
        ALSA: pcxhr: "fix" PCXHR_REG_TO_PORT definition
        ASoC: SOF: imx: imx8m: Bar index is only valid for IRAM and SRAM types
        ASoC: SOF: imx: imx8: Bar index is only valid for IRAM and SRAM types
        ASoC: SOF: Fix DSP oops stack dump output contents
        ALSA: hda/realtek: Quirks to enable speaker output for Lenovo Legion 7i 15IMHG05, Yoga 7i 14ITL5/15ITL5, and 13s Gen2 laptops.
        ALSA: usb-audio: Unify mixer resume and reset_resume procedure
        Revert "ALSA: hda: Drop workaround for a hang at shutdown again"
        ALSA: oxfw: fix transmission method for Loud models based on OXFW971
        ASoC: mediatek: common: handle NULL case in suspend/resume function
        ASoC: fsl_xcvr: register platform component before registering cpu dai
        ASoC: fsl_spdif: register platform component before registering cpu dai
        ASoC: fsl_micfil: register platform component before registering cpu dai
        ...
      02d5e016
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · 6e439bbd
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
       "This contains fixes for a resource leak in ccp as well as stack
        corruption in x86/sm4"
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: x86/sm4 - Fix frame pointer stack corruption
        crypto: ccp - fix resource leaks in ccp_run_aes_gcm_cmd()
      6e439bbd
  6. 28 Sep, 2021 10 commits
  7. 27 Sep, 2021 8 commits
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.15-2021-09-27' of... · 0513e464
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.15-2021-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull more perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix 'perf test' DWARF unwind for optimized builds.
      
       - Fix 'perf test' 'Object code reading' when dealing with samples in
         @plt symbols.
      
       - Fix off-by-one directory paths in the ARM support code.
      
       - Fix error message to eliminate confusion in 'perf config' when first
         creating a config file.
      
       - 'perf iostat' fix for system wide operation.
      
       - Fix printing of metrics when 'perf iostat' is used with one or more
         iio_root_ports and unconnected cpus (using -C).
      
       - Fix several typos in the documentation files.
      
       - Fix spelling mistake "icach" -> "icache" in the power8 JSON vendor
         files.
      
      * tag 'perf-tools-fixes-for-v5.15-2021-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf iostat: Fix Segmentation fault from NULL 'struct perf_counts_values *'
        perf iostat: Use system-wide mode if the target cpu_list is unspecified
        perf config: Refine error message to eliminate confusion
        perf doc: Fix typos all over the place
        perf arm: Fix off-by-one directory paths.
        perf vendor events powerpc: Fix spelling mistake "icach" -> "icache"
        perf tests: Fix flaky test 'Object code reading'
        perf test: Fix DWARF unwind for optimized builds.
      0513e464
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 9cccec2b
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "A bit late... I got sidetracked by back-from-vacation routines and
        conferences. But most of these patches are already a few weeks old and
        things look more calm on the mailing list than what this pull request
        would suggest.
      
        x86:
      
         - missing TLB flush
      
         - nested virtualization fixes for SMM (secure boot on nested
           hypervisor) and other nested SVM fixes
      
         - syscall fuzzing fixes
      
         - live migration fix for AMD SEV
      
         - mirror VMs now work for SEV-ES too
      
         - fixes for reset
      
         - possible out-of-bounds access in IOAPIC emulation
      
         - fix enlightened VMCS on Windows 2022
      
        ARM:
      
         - Add missing FORCE target when building the EL2 object
      
         - Fix a PMU probe regression on some platforms
      
        Generic:
      
         - KCSAN fixes
      
        selftests:
      
         - random fixes, mostly for clang compilation"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (43 commits)
        selftests: KVM: Explicitly use movq to read xmm registers
        selftests: KVM: Call ucall_init when setting up in rseq_test
        KVM: Remove tlbs_dirty
        KVM: X86: Synchronize the shadow pagetable before link it
        KVM: X86: Fix missed remote tlb flush in rmap_write_protect()
        KVM: x86: nSVM: don't copy virt_ext from vmcb12
        KVM: x86: nSVM: test eax for 4K alignment for GP errata workaround
        KVM: x86: selftests: test simultaneous uses of V_IRQ from L1 and L0
        KVM: x86: nSVM: restore int_vector in svm_clear_vintr
        kvm: x86: Add AMD PMU MSRs to msrs_to_save_all[]
        KVM: x86: nVMX: re-evaluate emulation_required on nested VM exit
        KVM: x86: nVMX: don't fail nested VM entry on invalid guest state if !from_vmentry
        KVM: x86: VMX: synthesize invalid VM exit when emulating invalid guest state
        KVM: x86: nSVM: refactor svm_leave_smm and smm_enter_smm
        KVM: x86: SVM: call KVM_REQ_GET_NESTED_STATE_PAGES on exit from SMM mode
        KVM: x86: reset pdptrs_from_userspace when exiting smm
        KVM: x86: nSVM: restore the L1 host state prior to resuming nested guest on SMM exit
        KVM: nVMX: Filter out all unsupported controls when eVMCS was activated
        KVM: KVM: Use cpumask_available() to check for NULL cpumask when kicking vCPUs
        KVM: Clean up benign vcpu->cpu data races when kicking vCPUs
        ...
      9cccec2b
    • Linus Torvalds's avatar
      Merge tag 'media/v5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · e6609f2c
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
       "A couple of driver fixes:
      
         - hantro: Fix check for single irq
      
         - cedrus: Fix SUNXI tile size calculation
      
         - s5p-jpeg: rename JPEG marker constants to prevent build warnings
      
         - ir_toy: prevent device from hanging during transmit"
      
      * tag 'media/v5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: ir_toy: prevent device from hanging during transmit
        media: s5p-jpeg: rename JPEG marker constants to prevent build warnings
        media: cedrus: Fix SUNXI tile size calculation
        media: hantro: Fix check for single irq
      e6609f2c
    • Jackie Liu's avatar
      watchdog/sb_watchdog: fix compilation problem due to COMPILE_TEST · c388a189
      Jackie Liu authored
      Compiling sb_watchdog needs to clearly define SIBYTE_HDR_FEATURES.
      In arch/mips/sibyte/Platform like:
      
        cflags-$(CONFIG_SIBYTE_BCM112X) +=                                      \
                      -I$(srctree)/arch/mips/include/asm/mach-sibyte          \
                      -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
      
      Otherwise, SIBYTE_HDR_FEATURES is SIBYTE_HDR_FMASK_ALL.
      SIBYTE_HDR_FMASK_ALL is mean:
      
       #define SIBYTE_HDR_FMASK_ALL  SIBYTE_HDR_FMASK_1250_ALL | SIBYTE_HDR_FMASK_112x_ALL \
      				     | SIBYTE_HDR_FMASK_1480_ALL)
      
      So, If not limited to CPU_SB1, we will get such an error:
      
        arch/mips/include/asm/sibyte/bcm1480_scd.h:261: error: "M_SPC_CFG_CLEAR" redefined [-Werror]
        arch/mips/include/asm/sibyte/bcm1480_scd.h:262: error: "M_SPC_CFG_ENABLE" redefined [-Werror]
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarJackie Liu <liuyun01@kylinos.cn>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c388a189
    • Linus Torvalds's avatar
      vboxfs: fix broken legacy mount signature checking · 9b3b353e
      Linus Torvalds authored
      Commit 9d682ea6 ("vboxsf: Fix the check for the old binary
      mount-arguments struct") was meant to fix a build error due to sign
      mismatch in 'char' and the use of character constants, but it just moved
      the error elsewhere, in that on some architectures characters and signed
      and on others they are unsigned, and that's just how the C standard
      works.
      
      The proper fix is a simple "don't do that then".  The code was just
      being silly and odd, and it should never have cared about signed vs
      unsigned characters in the first place, since what it is testing is not
      four "characters", but four bytes.
      
      And the way to compare four bytes is by using "memcmp()".
      
      Which compilers will know to just turn into a single 32-bit compare with
      a constant, as long as you don't have crazy debug options enabled.
      
      Link: https://lore.kernel.org/lkml/20210927094123.576521-1-arnd@kernel.org/
      Cc: Arnd Bergmann <arnd@kernel.org>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9b3b353e
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 42d43c92
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - NULL pointer dereference fixes in amd_sfh driver (Basavaraj Natikar,
         Evgeny Novikov)
      
       - data processing fix for hid-u2fzero (Andrej Shadura)
      
       - fix for out-of-bounds write in hid-betop (F.A.Sulaiman)
      
       - new device IDs / device-specific quirks
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: amd_sfh: Fix potential NULL pointer dereference
        HID: u2fzero: ignore incomplete packets without data
        HID: amd_sfh: Fix potential NULL pointer dereference
        HID: wacom: Add new Intuos BT (CTL-4100WL/CTL-6100WL) device IDs
        HID: apple: Fix logical maximum and usage maximum of Magic Keyboard JIS
        HID: betop: fix slab-out-of-bounds Write in betop_probe
      42d43c92
    • Randy Dunlap's avatar
      NIOS2: setup.c: drop unused variable 'dram_start' · 9523b33c
      Randy Dunlap authored
      This is a nuisance when CONFIG_WERROR is set, so drop the variable
      declaration since the code that used it was removed.
      
      ../arch/nios2/kernel/setup.c: In function 'setup_arch':
      ../arch/nios2/kernel/setup.c:152:13: warning: unused variable 'dram_start' [-Wunused-variable]
        152 |         int dram_start;
      
      Fixes: 7f7bc20b ("nios2: Don't use _end for calculating min_low_pfn")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Andreas Oetken <andreas.oetken@siemens.com>
      Signed-off-by: default avatarDinh Nguyen <dinguyen@kernel.org>
      9523b33c
    • Like Xu's avatar
      perf iostat: Fix Segmentation fault from NULL 'struct perf_counts_values *' · 4da8b121
      Like Xu authored
      If the 'perf iostat' user specifies two or more iio_root_ports and also
      specifies the cpu(s) by -C which is not *connected to all* the above iio
      ports, the iostat_print_metric() will run into trouble:
      
      For example:
      
        $ perf iostat list
        S0-uncore_iio_0<0000:16>
        S1-uncore_iio_0<0000:97> # <--- CPU 1 is located in the socket S0
      
        $ perf iostat 0000:16,0000:97 -C 1 -- ls
        port 	Inbound Read(MB)	Inbound Write(MB)	Outbound Read(MB)	Outbound
        Write(MB) ../perf-iostat: line 12: 104418 Segmentation fault
        (core dumped) perf stat --iostat$DELIMITER$*
      
      The core-dump stack says, in the above corner case, the returned
      (struct perf_counts_values *) count will be NULL, and the caller
      iostat_print_metric() apparently doesn't not handle this case.
      
        433	struct perf_counts_values *count = perf_counts(evsel->counts, die, 0);
        434
        435	if (count->run && count->ena) {
        (gdb) p count
        $1 = (struct perf_counts_values *) 0x0
      
      The deeper reason is that there are actually no statistics from the user
      specified pair "iostat 0000:X, -C (disconnected) Y ", but let's fix it with
      minimum cost by adding a NULL check in the user space.
      
      Fixes: f9ed693e ("perf stat: Enable iostat mode for x86 platforms")
      Signed-off-by: default avatarLike Xu <likexu@tencent.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20210927081115.39568-2-likexu@tencent.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4da8b121