1. 30 Sep, 2022 3 commits
    • Jim Mattson's avatar
      KVM: x86: Hide IA32_PLATFORM_DCA_CAP[31:0] from the guest · aae2e722
      Jim Mattson authored
      The only thing reported by CPUID.9 is the value of
      IA32_PLATFORM_DCA_CAP[31:0] in EAX. This MSR doesn't even exist in the
      guest, since CPUID.1:ECX.DCA[bit 18] is clear in the guest.
      
      Clear CPUID.9 in KVM_GET_SUPPORTED_CPUID.
      
      Fixes: 24c82e57 ("KVM: Sanitize cpuid")
      Signed-off-by: default avatarJim Mattson <jmattson@google.com>
      Message-Id: <20220922231854.249383-1-jmattson@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      aae2e722
    • David Matlack's avatar
      KVM: selftests: Gracefully handle empty stack traces · 09636efd
      David Matlack authored
      Bail out of test_dump_stack() if the stack trace is empty rather than
      invoking addr2line with zero addresses. The problem with the latter is
      that addr2line will block waiting for addresses to be passed in via
      stdin, e.g. if running a selftest from an interactive terminal.
      
      Opportunistically fix up the comment that mentions skipping 3 frames
      since only 2 are skipped in the code.
      
      Cc: Vipin Sharma <vipinsh@google.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarDavid Matlack <dmatlack@google.com>
      Message-Id: <20220922231724.3560211-1-dmatlack@google.com>
      [Small tweak to keep backtrace() call close to if(). - Paolo]
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      09636efd
    • Emanuele Giuseppe Esposito's avatar
      KVM: selftests: replace assertion with warning in access_tracking_perf_test · 6336a810
      Emanuele Giuseppe Esposito authored
      Page_idle uses {ptep/pmdp}_clear_young_notify which in turn calls
      the mmu notifier callback ->clear_young(), which purposefully
      does not flush the TLB.
      
      When running the test in a nested guest, point 1. of the test
      doc header is violated, because KVM TLB is unbounded by size
      and since no flush is forced, KVM does not update the sptes
      accessed/idle bits resulting in guest assertion failure.
      
      More precisely, only the first ACCESS_WRITE in run_test() actually
      makes visible changes, because sptes are created and the accessed
      bit is set to 1 (or idle bit is 0). Then the first mark_memory_idle()
      passes since access bit is still one, and sets all pages as idle
      (or not accessed). When the next write is performed, the update
      is not flushed therefore idle is still 1 and next mark_memory_idle()
      fails.
      Signed-off-by: default avatarEmanuele Giuseppe Esposito <eesposit@redhat.com>
      Message-Id: <20220926082923.299554-1-eesposit@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      6336a810
  2. 27 Sep, 2022 1 commit
  3. 23 Sep, 2022 1 commit
  4. 22 Sep, 2022 6 commits
    • Sean Christopherson's avatar
      KVM: x86: Inject #UD on emulated XSETBV if XSAVES isn't enabled · 50b2d49b
      Sean Christopherson authored
      Inject #UD when emulating XSETBV if CR4.OSXSAVE is not set.  This also
      covers the "XSAVE not supported" check, as setting CR4.OSXSAVE=1 #GPs if
      XSAVE is not supported (and userspace gets to keep the pieces if it
      forces incoherent vCPU state).
      
      Add a comment to kvm_emulate_xsetbv() to call out that the CPU checks
      CR4.OSXSAVE before checking for intercepts.  AMD'S APM implies that #UD
      has priority (says that intercepts are checked before #GP exceptions),
      while Intel's SDM says nothing about interception priority.  However,
      testing on hardware shows that both AMD and Intel CPUs prioritize the #UD
      over interception.
      
      Fixes: 02d4160f ("x86: KVM: add xsetbv to the emulator")
      Cc: stable@vger.kernel.org
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20220824033057.3576315-4-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      50b2d49b
    • Dr. David Alan Gilbert's avatar
      KVM: x86: Always enable legacy FP/SSE in allowed user XFEATURES · a1020a25
      Dr. David Alan Gilbert authored
      Allow FP and SSE state to be saved and restored via KVM_{G,SET}_XSAVE on
      XSAVE-capable hosts even if their bits are not exposed to the guest via
      XCR0.
      
      Failing to allow FP+SSE first showed up as a QEMU live migration failure,
      where migrating a VM from a pre-XSAVE host, e.g. Nehalem, to an XSAVE
      host failed due to KVM rejecting KVM_SET_XSAVE.  However, the bug also
      causes problems even when migrating between XSAVE-capable hosts as
      KVM_GET_SAVE won't set any bits in user_xfeatures if XSAVE isn't exposed
      to the guest, i.e. KVM will fail to actually migrate FP+SSE.
      
      Because KVM_{G,S}ET_XSAVE are designed to allowing migrating between
      hosts with and without XSAVE, KVM_GET_XSAVE on a non-XSAVE (by way of
      fpu_copy_guest_fpstate_to_uabi()) always sets the FP+SSE bits in the
      header so that KVM_SET_XSAVE will work even if the new host supports
      XSAVE.
      
      Fixes: ad856280 ("x86/kvm/fpu: Limit guest user_xfeatures to supported bits of XCR0")
      bz: https://bugzilla.redhat.com/show_bug.cgi?id=2079311
      Cc: stable@vger.kernel.org
      Cc: Leonardo Bras <leobras@redhat.com>
      Signed-off-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
      [sean: add comment, massage changelog]
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20220824033057.3576315-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a1020a25
    • Sean Christopherson's avatar
      KVM: x86: Reinstate kvm_vcpu_arch.guest_supported_xcr0 · ee519b3a
      Sean Christopherson authored
      Reinstate the per-vCPU guest_supported_xcr0 by partially reverting
      commit 988896bb; the implicit assessment that guest_supported_xcr0 is
      always the same as guest_fpu.fpstate->user_xfeatures was incorrect.
      
      kvm_vcpu_after_set_cpuid() isn't the only place that sets user_xfeatures,
      as user_xfeatures is set to fpu_user_cfg.default_features when guest_fpu
      is allocated via fpu_alloc_guest_fpstate() => __fpstate_reset().
      guest_supported_xcr0 on the other hand is zero-allocated.  If userspace
      never invokes KVM_SET_CPUID2, supported XCR0 will be '0', whereas the
      allowed user XFEATURES will be non-zero.
      
      Practically speaking, the edge case likely doesn't matter as no sane
      userspace will live migrate a VM without ever doing KVM_SET_CPUID2. The
      primary motivation is to prepare for KVM intentionally and explicitly
      setting bits in user_xfeatures that are not set in guest_supported_xcr0.
      
      Because KVM_{G,S}ET_XSAVE can be used to svae/restore FP+SSE state even
      if the host doesn't support XSAVE, KVM needs to set the FP+SSE bits in
      user_xfeatures even if they're not allowed in XCR0, e.g. because XCR0
      isn't exposed to the guest.  At that point, the simplest fix is to track
      the two things separately (allowed save/restore vs. allowed XCR0).
      
      Fixes: 988896bb ("x86/kvm/fpu: Remove kvm_vcpu_arch.guest_supported_xcr0")
      Cc: stable@vger.kernel.org
      Cc: Leonardo Bras <leobras@redhat.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20220824033057.3576315-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ee519b3a
    • Miaohe Lin's avatar
      KVM: x86/mmu: add missing update to max_mmu_rmap_size · 604f5332
      Miaohe Lin authored
      The update to statistic max_mmu_rmap_size is unintentionally removed by
      commit 4293ddb7 ("KVM: x86/mmu: Remove redundant spte present check
      in mmu_set_spte"). Add missing update to it or max_mmu_rmap_size will
      always be nonsensical 0.
      
      Fixes: 4293ddb7 ("KVM: x86/mmu: Remove redundant spte present check in mmu_set_spte")
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Message-Id: <20220907080657.42898-1-linmiaohe@huawei.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      604f5332
    • Jinrong Liang's avatar
      selftests: kvm: Fix a compile error in selftests/kvm/rseq_test.c · 561cafeb
      Jinrong Liang authored
      The following warning appears when executing:
      	make -C tools/testing/selftests/kvm
      
      rseq_test.c: In function ‘main’:
      rseq_test.c:237:33: warning: implicit declaration of function ‘gettid’; did you mean ‘getgid’? [-Wimplicit-function-declaration]
                (void *)(unsigned long)gettid());
                                       ^~~~~~
                                       getgid
      /usr/bin/ld: /tmp/ccr5mMko.o: in function `main':
      ../kvm/tools/testing/selftests/kvm/rseq_test.c:237: undefined reference to `gettid'
      collect2: error: ld returned 1 exit status
      make: *** [../lib.mk:173: ../kvm/tools/testing/selftests/kvm/rseq_test] Error 1
      
      Use the more compatible syscall(SYS_gettid) instead of gettid() to fix it.
      More subsequent reuse may cause it to be wrapped in a lib file.
      Signed-off-by: default avatarJinrong Liang <cloudliang@tencent.com>
      Message-Id: <20220802071240.84626-1-cloudliang@tencent.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      561cafeb
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-6.0-2' of... · b4ac28a3
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
      
      KVM/arm64 fixes for 6.0, take #2
      
      - Fix kmemleak usage in Protected KVM (again)
      b4ac28a3
  5. 21 Sep, 2022 4 commits
  6. 19 Sep, 2022 1 commit
  7. 18 Sep, 2022 5 commits
  8. 16 Sep, 2022 9 commits
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · a335366b
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - fix the level-low interrupt type support in gpio-mpc8xxx
      
       - convert another two drivers to using immutable irq chips
      
       - MAINTAINERS update
      
      * tag 'gpio-fixes-for-v6.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        gpio: mt7621: Make the irqchip immutable
        gpio: ixp4xx: Make irqchip immutable
        MAINTAINERS: Update HiSilicon GPIO Driver maintainer
        gpio: mpc8xxx: Fix support for IRQ_TYPE_LEVEL_LOW flow_type in mpc85xx
      a335366b
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 6879c2d3
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "Nothing special, just driver fixes:
      
         - Fix IRQ wakeup and pins for UFS and SDC2 issues on the Qualcomm
           SC8180x
      
         - Fix the Rockchip driver to support interrupt on both rising and
           falling edges.
      
         - Name the Allwinner A100 R_PIO properly
      
         - Fix several issues with the Ocelot interrupts"
      
      * tag 'pinctrl-v6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: ocelot: Fix interrupt controller
        pinctrl: sunxi: Fix name for A100 R_PIO
        pinctrl: rockchip: Enhance support for IRQ_TYPE_EDGE_BOTH
        pinctrl: qcom: sc8180x: Fix wrong pin numbers
        pinctrl: qcom: sc8180x: Fix gpio_wakeirq_map
      6879c2d3
    • Linus Torvalds's avatar
      Merge tag 'block-6.0-2022-09-16' of git://git.kernel.dk/linux-block · 68e777e4
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Two fixes for -rc6:
      
         - Fix a mixup of sectors and bytes in the secure erase ioctl
           (Mikulas)
      
         - Fix for a bad return value for a non-blocking bio/blk queue enter
           call (me)"
      
      * tag 'block-6.0-2022-09-16' of git://git.kernel.dk/linux-block:
        blk-lib: fix blkdev_issue_secure_erase
        block: blk_queue_enter() / __bio_queue_enter() must return -EAGAIN for nowait
      68e777e4
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.0-2022-09-16' of git://git.kernel.dk/linux-block · 0158137d
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "Two small patches:
      
         - Fix using an unsigned type for the return value, introduced in this
           release (Pavel)
      
         - Stable fix for a missing check for a fixed file on put (me)"
      
      * tag 'io_uring-6.0-2022-09-16' of git://git.kernel.dk/linux-block:
        io_uring/msg_ring: check file type before putting
        io_uring/rw: fix error'ed retry return values
      0158137d
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2022-09-16' of git://anongit.freedesktop.org/drm/drm · 5763d7f2
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "This is the regular drm fixes pull.
      
        The i915 and misc fixes are fairly regular, but the amdgpu contains
        fixes for new hw blocks, the dcn314 specific path hookups and also has
        a bunch of fixes for clang stack size warnings which are a bit churny
        but fairly straightforward. This means it looks a little larger than
        usual.
      
        amdgpu:
         - BACO fixes for some RDNA2 boards
         - PCI AER fixes uncovered by a core PCI change
         - Properly hook up dirtyfb helper
         - RAS fixes for GC 11.x
         - TMR fix
         - DCN 3.2.x fixes
         - DCN 3.1.4 fixes
         - LLVM DML stack size fixes
      
        i915:
         - Revert a display patch around max DP source rate now that the
           proper WaEdpLinkRateDataReload is in place
         - Fix perf limit reasons bit position
         - Fix unclaimmed mmio registers on suspend flow with GuC
         - A vma_move_to_active fix for a regression with video decoding
         - DP DSP fix
      
        gma500:
         - Locking and IRQ fixes
      
        meson:
         - OSD1 display fixes
      
        panel-edp:
         - Fix Innolux timings
      
        rockchip:
         - DP/HDMI fixes"
      
      * tag 'drm-fixes-2022-09-16' of git://anongit.freedesktop.org/drm/drm: (42 commits)
        drm/amdgpu: make sure to init common IP before gmc
        drm/amdgpu: move nbio sdma_doorbell_range() into sdma code for vega
        drm/amdgpu: move nbio ih_doorbell_range() into ih code for vega
        drm/rockchip: Fix return type of cdn_dp_connector_mode_valid
        drm/amd/display: Mark dml30's UseMinimumDCFCLK() as noinline for stack usage
        drm/amd/display: Reduce number of arguments of dml31's CalculateFlipSchedule()
        drm/amd/display: Reduce number of arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()
        drm/amd/display: Reduce number of arguments of dml32_CalculatePrefetchSchedule()
        drm/amd/display: Reduce number of arguments of dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport()
        drm/amd/display: Refactor SubVP calculation to remove FPU
        drm/amd/display: Limit user regamma to a valid value
        drm/amd/display: add workaround for subvp cursor corruption for DCN32/321
        drm/amd/display: SW cursor fallback for SubVP
        drm/amd/display: Round cursor width up for MALL allocation
        drm/amd/display: Correct dram channel width for dcn314
        drm/amd/display: Relax swizzle checks for video non-RGB formats on DCN314
        drm/amd/display: Hook up DCN314 specific dml implementation
        drm/amd/display: Enable dlg and vba compilation for dcn314
        drm/amd/display: Fix compilation errors on DCN314
        drm/amd/display: Fix divide by zero in DML
        ...
      5763d7f2
    • Linus Torvalds's avatar
      Merge tag '6.0-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · 714820c6
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Four smb3 fixes for stable:
      
         - important fix to revalidate mapping when doing direct writes
      
         - missing spinlock
      
         - two fixes to socket handling
      
         - trivial change to update internal version number for cifs.ko"
      
      * tag '6.0-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: update internal module number
        cifs: add missing spinlock around tcon refcount
        cifs: always initialize struct msghdr smb_msg completely
        cifs: don't send down the destination address to sendmsg for a SOCK_STREAM
        cifs: revalidate mapping when doing direct writes
      714820c6
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2022-09-15' of... · 25100377
      Dave Airlie authored
      Merge tag 'drm-intel-fixes-2022-09-15' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
      
      - Revert a display patch around max DP source rate now
        that the proper WaEdpLinkRateDataReload is in place. (Ville)
      - Fix perf limit reasons bit position. (Ashutosh)
      - Fix unclaimmed mmio registers on suspend flow with GuC. (Umesh)
      - A vma_move_to_active fix for a regression with video decoding. (Nirmoy)
      - DP DSP fix. (Ankit)
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/YyMtmGMXRLsURoM5@intel.com
      25100377
    • Dave Airlie's avatar
      Merge tag 'drm-misc-fixes-2022-09-15' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes · 87d9862b
      Dave Airlie authored
      Short summary of fixes pull:
      
       * gma500: Locking and IRQ fixes
       * meson: OSD1 display fixes
       * panel-edp: Fix Innolux timings
       * rockchip: DP/HDMI fixes
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Thomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/YyMUpP1w21CPXq+I@linux-uq9g
      87d9862b
    • Dave Airlie's avatar
      Merge tag 'amd-drm-fixes-6.0-2022-09-14' of... · e2111ae2
      Dave Airlie authored
      Merge tag 'amd-drm-fixes-6.0-2022-09-14' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
      
      amd-drm-fixes-6.0-2022-09-14:
      
      amdgpu:
      - BACO fixes for some RDNA2 boards
      - PCI AER fixes uncovered by a core PCI change
      - Properly hook up dirtyfb helper
      - RAS fixes for GC 11.x
      - TMR fix
      - DCN 3.2.x fixes
      - DCN 3.1.4 fixes
      - LLVM DML stack size fixes
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220914184030.6145-1-alexander.deucher@amd.com
      e2111ae2
  9. 15 Sep, 2022 4 commits
  10. 14 Sep, 2022 6 commits
    • Alex Deucher's avatar
      drm/amdgpu: make sure to init common IP before gmc · a8671493
      Alex Deucher authored
      Move common IP init before GMC init so that HDP gets
      remapped before GMC init which uses it.
      
      This fixes the Unsupported Request error reported through
      AER during driver load. The error happens as a write happens
      to the remap offset before real remapping is done.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216373
      
      The error was unnoticed before and got visible because of the commit
      referenced below. This doesn't fix anything in the commit below, rather
      fixes the issue in amdgpu exposed by the commit. The reference is only
      to associate this commit with below one so that both go together.
      
      Fixes: 8795e182 ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()")
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      a8671493
    • Alex Deucher's avatar
      drm/amdgpu: move nbio sdma_doorbell_range() into sdma code for vega · e3163bc8
      Alex Deucher authored
      This mirrors what we do for other asics and this way we are
      sure the sdma doorbell range is properly initialized.
      
      There is a comment about the way doorbells on gfx9 work that
      requires that they are initialized for other IPs before GFX
      is initialized.  However, the statement says that it applies to
      multimedia as well, but the VCN code currently initializes
      doorbells after GFX and there are no known issues there.  In my
      testing at least I don't see any problems on SDMA.
      
      This is a prerequisite for fixing the Unsupported Request error
      reported through AER during driver load.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216373
      
      The error was unnoticed before and got visible because of the commit
      referenced below. This doesn't fix anything in the commit below, rather
      fixes the issue in amdgpu exposed by the commit. The reference is only
      to associate this commit with below one so that both go together.
      
      Fixes: 8795e182 ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()")
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      e3163bc8
    • Alex Deucher's avatar
      drm/amdgpu: move nbio ih_doorbell_range() into ih code for vega · dc1d85cb
      Alex Deucher authored
      This mirrors what we do for other asics and this way we are
      sure the ih doorbell range is properly initialized.
      
      There is a comment about the way doorbells on gfx9 work that
      requires that they are initialized for other IPs before GFX
      is initialized.  In this case IH is initialized before GFX,
      so there should be no issue.
      
      This is a prerequisite for fixing the Unsupported Request error
      reported through AER during driver load.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216373
      
      The error was unnoticed before and got visible because of the commit
      referenced below. This doesn't fix anything in the commit below, rather
      fixes the issue in amdgpu exposed by the commit. The reference is only
      to associate this commit with below one so that both go together.
      
      Fixes: 8795e182 ("PCI/portdrv: Don't disable AER reporting in get_port_device_capability()")
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      dc1d85cb
    • Horatiu Vultur's avatar
      pinctrl: ocelot: Fix interrupt controller · c297561b
      Horatiu Vultur authored
      When an external device generated a level based interrupt then the
      interrupt controller could miss the interrupt. The reason is that the
      interrupt controller can detect only link changes.
      
      In the following example, if there is a PHY that generates an interrupt
      then the following would happen. The GPIO detected that the interrupt
      line changed, and then the 'ocelot_irq_handler' was called. Here it
      detects which GPIO line saw the change and for that will call the
      following:
      1. irq_mask
      2. phy interrupt routine
      3. irq_eoi
      4. irq_unmask
      
      And this works fine for simple cases, but if the PHY generates many
      interrupts, for example when doing PTP timestamping, then the following
      could happen. Again the function 'ocelot_irq_handler' will be called
      and then from here the following could happen:
      1. irq_mask
      2. phy interrupt routine
      3. irq_eoi
      4. irq_unmask
      
      Right before step 3(irq_eoi), the PHY will generate another interrupt.
      Now the interrupt controller will acknowledge the change in the
      interrupt line. So we miss the interrupt.
      
      A solution will be to use 'handle_level_irq' instead of
      'handle_fasteoi_irq', because for this will change routine order of
      handling the interrupt.
      1. irq_mask
      2. irq_ack
      3. phy interrupt routine
      4. irq_unmask
      
      And now if the PHY will generate a new interrupt before irq_unmask, the
      interrupt controller will detect this because it already acknowledge the
      change in interrupt line at step 2(irq_ack).
      
      But this is not the full solution because there is another issue. In
      case there are 2 PHYs that share the interrupt line. For example phy1
      generates an interrupt, then the following can happen:
      1.irq_mask
      2.irq_ack
      3.phy0 interrupt routine
      4.phy1 interrupt routine
      5.irq_unmask
      
      In case phy0 will generate an interrupt while clearing the interrupt
      source in phy1, then the interrupt line will be kept down by phy0. So
      the interrupt controller will not see any changes in the interrupt line.
      The solution here is to update 'irq_unmask' such that it can detect if
      the interrupt line is still active or not. And if it is active then call
      again the procedure to clear the interrupts. But we don't want to do it
      every time, only if we know that the interrupt controller has not seen
      already that the interrupt line has changed.
      
      While at this, add support also for IRQ_TYPE_LEVEL_LOW.
      
      Fixes: be36abb7 ("pinctrl: ocelot: add support for interrupt controller")
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Link: https://lore.kernel.org/r/20220909145942.844102-1-horatiu.vultur@microchip.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      c297561b
    • Sergio Paracuellos's avatar
      gpio: mt7621: Make the irqchip immutable · 09eed5a1
      Sergio Paracuellos authored
      Commit 6c846d02 ("gpio: Don't fiddle with irqchips marked as
      immutable") added a warning to indicate if the gpiolib is altering the
      internals of irqchips.  Following this change the following warnings
      are now observed for the mt7621 driver:
      
      gpio gpiochip0: (1e000600.gpio-bank0): not an immutable chip, please consider fixing it!
      gpio gpiochip1: (1e000600.gpio-bank1): not an immutable chip, please consider fixing it!
      gpio gpiochip2: (1e000600.gpio-bank2): not an immutable chip, please consider fixing it!
      
      Fix this by making the irqchip in the mt7621 driver immutable.
      Tested-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
      Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
      Signed-off-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      09eed5a1
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 3245cb65
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
      
       - Update some stale binding maintainer emails
      
       - Fix property name error in apple,aic binding
      
       - Add missing param to of_dma_configure_id() stub
      
       - Fix an off-by-one error in unflatten_dt_nodes()
      
      * tag 'devicetree-fixes-for-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: pinctrl: qcom: drop non-working codeaurora.org emails
        dt-bindings: power: qcom,rpmpd: drop non-working codeaurora.org emails
        dt-bindings: apple,aic: Fix required item "apple,fiq-index" in affinity description
        dt-bindings: interconnect: fsl,imx8m-noc: drop Leonard Crestez
        of/device: Fix up of_dma_configure_id() stub
        MAINTAINERS: Update email of Neil Armstrong
        of: fdt: fix off-by-one error in unflatten_dt_nodes()
      3245cb65