1. Nov 03, 2021
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-pm', 'acpi-battery' and 'acpi-ac' · f8df1601
      Rafael J. Wysocki authored
      Merge updates related to device power management, system sleep,
      battery driver and AC driver for 5.16-rc1:
      
       - Check the states of all ACPI power resources during initialization
         to avoid dealing with power resources in unknown states (Rafael
         Wysocki).
      
       - Fix ACPI power resource issues related to sharing wakeup power
         resources (Rafael Wysocki).
      
       - Avoid registering redundant suspend_ops (Rafael Wysocki).
      
       - Report battery charging state as "full" if it appears to be over
         the design capacity (André Almeida).
      
       - Quirk GK45 mini PC to skip reading _PSR in the AC driver (Stefan
         Schaeckeler).
      
      * acpi-pm:
        ACPI: PM: sleep: Do not set suspend_ops unnecessarily
        ACPI: PM: Turn off wakeup power resources on _DSW/_PSW errors
        ACPI: PM: Fix sharing of wakeup power resources
        ACPI: PM: Turn off unused wakeup power resources
        ACPI: PM: Check states of power resources during initialization
      
      * acpi-battery:
        ACPI: battery: Accept charges over the design capacity as full
      
      * acpi-ac:
        ACPI: AC: Quirk GK45 to skip reading _PSR
      f8df1601
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-glue', 'acpi-pnp', 'acpi-processor' and 'acpi-soc' · c3fb4660
      Rafael J. Wysocki authored
      Merge updates of the code associating ACPI device objects with
      devices and PNP code, processor driver, and Intel LPSS driver updates
      for 5.16-rc1:
      
       - Make the association of ACPI device objects with PCI devices more
         straightforward and simplify the code doing that for all devices
         in general (Rafael Wysocki).
      
       - Use acpi_device_adr() in acpi_find_child_device() instead of
         evaluating _ADR (Rafael Wysocki).
      
       - Drop duplicate device IDs from PNP device IDs list (Krzysztof
         Kozlowski).
      
       - Allow acpi_idle_play_dead() to use C3 on AMD processors (Richard
         Gong).
      
       - Use ACPI_COMPANION() to simplify code in the ACPI driver for Intel
         SoCs (Rafael Wysocki).
      
      * acpi-glue:
        ACPI: glue: Use acpi_device_adr() in acpi_find_child_device()
        ACPI: glue: Look for ACPI bus type only if ACPI companion is not known
        ACPI: glue: Drop cleanup callback from struct acpi_bus_type
        PCI: ACPI: Drop acpi_pci_bus
      
      * acpi-pnp:
        ACPI: PNP: remove duplicated BRI0A49 and BDP3336 entries
      
      * acpi-processor:
        ACPI: processor idle: Allow playing dead in C3 state
      
      * acpi-soc:
        ACPI: LPSS: Use ACPI_COMPANION() directly
      c3fb4660
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-x86', 'acpi-resources', 'acpi-scan' and 'acpi-misc' · b2ffa16a
      Rafael J. Wysocki authored
      Merge x86-specific ACPI updates, ACPI resources management updates,
      one ACPI device enumeration update and miscellaneous ACPI updates for
      5.16-rc1:
      
       - Avoid flushing caches before entering C3 type of idle states on
         AMD processors (Deepak Sharma).
      
       - Avoid enumerating CPUs that are not present and not online-capable
         according to the platform firmware (Mario Limonciello).
      
       - Add DMI-based mechanism to quirk IRQ overrides and use it for two
         platforms (Hui Wang).
      
       - Change the configuration of unused ACPI device objects to reflect
         the D3cold power state after enumerating devices (Rafael Wysocki).
      
       - Update MAINTAINERS information regarding ACPI (Rafael Wysocki).
      
       - Fix typo in ACPI Kconfig (Masanari Iid).
      
       - Use sysfs_emit() instead of snprintf() in some places (Qing Wang).
      
      * acpi-x86:
        x86: ACPI: cstate: Optimize C3 entry on AMD CPUs
        x86/ACPI: Don't add CPUs that are not online capable
        ACPICA: Add support for MADT online enabled bit
      
      * acpi-resources:
        ACPI: resources: Add one more Medion model in IRQ override quirk
        ACPI: resources: Add DMI-based legacy IRQ override quirk
      
      * acpi-scan:
        ACPI: scan: Release PM resources blocked by unused objects
      
      * acpi-misc:
        ACPI: replace snprintf() in "show" functions with sysfs_emit()
        ACPI: Update information in MAINTAINERS
        ACPI: Kconfig: Fix a typo in Kconfig
      b2ffa16a
    • Rafael J. Wysocki's avatar
      Merge branch 'acpica' · 9cb31aa1
      Rafael J. Wysocki authored
      Merge ACPICA updates for 5.16-rc1:
      
       - Fix system-wide resume issue caused by evaluating control methods
         too early in the resume path (Rafael Wysocki).
      
       - Add support for Windows 2020 _OSI string (Mario Limonciello).
      
       - Add Generic Port Affinity type for SRAT (Alison Schofield).
      
       - Add disassembly support for the NHLT ACPI table (Bob Moore).
      
      * acpica:
        ACPICA: Update version to 20210930
        ACPICA: iASL table disassembler: Added disassembly support for the NHLT ACPI table
        ACPICA: ACPI 6.4 SRAT: add Generic Port Affinity type
        ACPICA: Add support for Windows 2020 _OSI string
        ACPICA: Avoid evaluating methods too early during system resume
      9cb31aa1
  2. Oct 28, 2021
  3. Oct 26, 2021
    • Rafael J. Wysocki's avatar
      gpio-amdpt: ACPI: Use the ACPI_COMPANION() macro directly · f0b2731b
      Rafael J. Wysocki authored
      
      
      The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
      macro and the ACPI handle produced by the former comes from the
      ACPI device object produced by the latter, so it is way more
      straightforward to evaluate the latter directly instead of passing
      the handle produced by the former to acpi_bus_get_device().
      
      Modify pt_gpio_probe() accordingly (no intentional functional impact).
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: default avatarBartosz Golaszewski <brgl@bgdev.pl>
      f0b2731b
    • Rafael J. Wysocki's avatar
      nouveau: ACPI: Use the ACPI_COMPANION() macro directly · ae364fd9
      Rafael J. Wysocki authored
      
      
      The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
      macro and the ACPI handle produced by the former comes from the
      ACPI device object produced by the latter, so it is way more
      straightforward to evaluate the latter directly instead of passing
      the handle produced by the former to acpi_bus_get_device().
      
      Modify nouveau_acpi_edid() accordingly (no intentional functional
      impact).
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: default avatarBen Skeggs <bskeggs@redhat.com>
      ae364fd9
    • Hui Wang's avatar
      ACPI: resources: Add one more Medion model in IRQ override quirk · 1b26ae40
      Hui Wang authored
      The Medion s17 series laptops have the same issue on the keyboard
      as the s15 series, if skipping to call acpi_get_override_irq(), the
      keyboard could work well. So put the DMI info of s17 series in the
      IRQ override quirk table as well.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213031
      
      
      Tested-by: default avatardirksche <dirksche@posteo.de>
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1b26ae40
    • Stefan Schaeckeler's avatar
      ACPI: AC: Quirk GK45 to skip reading _PSR · 3d730ee6
      Stefan Schaeckeler authored
      
      
      Let GK45 not go into BIOS for determining the AC power state.
      
      The BIOS wrongly returns 0, so hardcode the power state to 1.
      
      The mini PC GK45 by Besstar Tech Lld. (aka Kodlix) just runs
      off AC. It does not include any batteries. Nevertheless BIOS
      reports AC off:
      
      root@kodlix:/usr/src/linux# cat /sys/class/power_supply/ADP1/online
      0
      
      root@kodlix:/usr/src/linux# modprobe acpi_dbg
      root@kodlix:/usr/src/linux# tools/power/acpi/acpidbg
      
      - find _PSR
         \_SB.PCI0.SBRG.H_EC.ADP1._PSR Method       000000009283cee8 001 Args 0 Len 001C Aml 00000000f54e5f67
      
      - execute \_SB.PCI0.SBRG.H_EC.ADP1._PSR
      Evaluating \_SB.PCI0.SBRG.H_EC.ADP1._PSR
      Evaluation of \_SB.PCI0.SBRG.H_EC.ADP1._PSR returned object 00000000dc08c187, external buffer length 18
       [Integer] = 0000000000000000
      
      that should be
      
       [Integer] = 0000000000000001
      
      Signed-off-by: default avatarStefan Schaeckeler <schaecsn@gmx.net>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3d730ee6
    • Rafael J. Wysocki's avatar
      ACPI: PM: sleep: Do not set suspend_ops unnecessarily · d69d1f70
      Rafael J. Wysocki authored
      
      
      If none of the S1 - S3 sleep states is supported, it is not necessary
      to register suspend_ops, so don't do that then.
      
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d69d1f70
    • Linus Torvalds's avatar
      Linux 5.15-rc7 · 3906fe9b
      Linus Torvalds authored
      3906fe9b
    • Matthew Wilcox (Oracle)'s avatar
      secretmem: Prevent secretmem_users from wrapping to zero · cb685432
      Matthew Wilcox (Oracle) authored
      Commit 11086054 ("mm/secretmem: use refcount_t instead of atomic_t")
      attempted to fix the problem of secretmem_users wrapping to zero and
      allowing suspend once again.
      
      But it was reverted in commit 87066fdd
      
       ("Revert 'mm/secretmem: use
      refcount_t instead of atomic_t'") because of the problems it caused - a
      refcount_t was not semantically the right type to use.
      
      Instead prevent secretmem_users from wrapping to zero by forbidding new
      users if the number of users has wrapped from positive to negative.
      This stops a long way short of reaching the necessary 4 billion users
      where it wraps to zero again, so there's no need to be clever with
      special anti-wrap types or checking the return value from atomic_inc().
      
      Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Cc: Jordy Zomer <jordy@pwning.systems>
      Cc: Kees Cook <keescook@chromium.org>,
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cb685432
    • Linus Torvalds's avatar
      spi: Fix tegra20 build with CONFIG_PM=n once again · ac8a6eba
      Linus Torvalds authored
      Commit efafec27 ("spi: Fix tegra20 build with CONFIG_PM=n") already
      fixed the build without PM support once.  There was an alternative fix
      by Guenter in commit 2bab9409 ("spi: tegra20-slink: Declare runtime
      suspend and resume functions conditionally"), and Mark then merged the
      two correctly in ffb1e76f ("Merge tag 'v5.15-rc2' into spi-5.15").
      
      But for some inexplicable reason, Mark then merged things _again_ in
      commit 59c4e190
      
       ("Merge tag 'v5.15-rc3' into spi-5.15"), and screwed
      things up at that point, and the __maybe_unused attribute on
      tegra_slink_runtime_resume() went missing.
      
      Reinstate it, so that alpha (and other architectures without PM support)
      builds cleanly again.
      
      Btw, this is another prime example of how random back-merges are not
      good.  Just don't do them.  Subsystem developers should not merge my
      tree in any normal circumstances.  Both of those merge commits pointed
      to above are bad: even the one that got the merge result right doesn't
      even mention _why_ it was done, and the one that got it wrong is
      obviously broken.
      
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: Mark Brown <broonie@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ac8a6eba
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · c2b43854
      Linus Torvalds authored
      Pull ARM fixes from Russell King:
      
       - Fix clang-related relocation warning in futex code
      
       - Fix incorrect use of get_kernel_nofault()
      
       - Fix bad code generation in __get_user_check() when kasan is enabled
      
       - Ensure TLB function table is correctly aligned
      
       - Remove duplicated string function definitions in decompressor
      
       - Fix link-time orphan section warnings
      
       - Fix old-style function prototype for arch_init_kprobes()
      
       - Only warn about XIP address when not compile testing
      
       - Handle BE32 big endian for keystone2 remapping
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
        ARM: 9148/1: handle CONFIG_CPU_ENDIAN_BE32 in arch/arm/kernel/head.S
        ARM: 9141/1: only warn about XIP address when not compile testing
        ARM: 9139/1: kprobes: fix arch_init_kprobes() prototype
        ARM: 9138/1: fix link warning with XIP + frame-pointer
        ARM: 9134/1: remove duplicate memcpy() definition
        ARM: 9133/1: mm: proc-macros: ensure *_tlb_fns are 4B aligned
        ARM: 9132/1: Fix __get_user_check failure with ARM KASAN images
        ARM: 9125/1: fix incorrect use of get_kernel_nofault()
        ARM: 9122/1: select HAVE_FUTEX_CMPXCHG
      c2b43854
    • Linus Torvalds's avatar
      Merge tag 'libata-5.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata · 4862649f
      Linus Torvalds authored
      Pull libata fix from Damien Le Moal:
       "A single fix in this pull request addressing an invalid error code
        return in the sata_mv driver (from Zheyu)"
      
      * tag 'libata-5.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
        ata: sata_mv: Fix the error handling of mv_chip_id()
      4862649f
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v5.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · a51aec41
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "Some late pin control fixes, the most generally annoying will probably
        be the AMD IRQ storm fix affecting the Microsoft surface.
      
        Summary:
      
         - Three fixes pertaining to Broadcom DT bindings. Some stuff didn't
           work out as inteded, we need to back out
      
         - A resume bug fix in the STM32 driver
      
         - Disable and mask the interrupts on probe in the AMD pinctrl driver,
           affecting Microsoft surface"
      
      * tag 'pinctrl-v5.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: amd: disable and mask interrupts on probe
        pinctrl: stm32: use valid pin identifier in stm32_pinctrl_resume()
        Revert "pinctrl: bcm: ns: support updated DT binding as syscon subnode"
        dt-bindings: pinctrl: brcm,ns-pinmux: drop unneeded CRU from example
        Revert "dt-bindings: pinctrl: bcm4708-pinmux: rework binding to use syscon"
      a51aec41
  4. Oct 25, 2021
  5. Oct 23, 2021
  6. Oct 22, 2021
    • Paolo Bonzini's avatar
      KVM: SEV-ES: go over the sev_pio_data buffer in multiple passes if needed · 95e16b47
      Paolo Bonzini authored
      The PIO scratch buffer is larger than a single page, and therefore
      it is not possible to copy it in a single step to vcpu->arch/pio_data.
      Bound each call to emulator_pio_in/out to a single page; keep
      track of how many I/O operations are left in vcpu->arch.sev_pio_count,
      so that the operation can be restarted in the complete_userspace_io
      callback.
      
      For OUT, this means that the previous kvm_sev_es_outs implementation
      becomes an iterator of the loop, and we can consume the sev_pio_data
      buffer before leaving to userspace.
      
      For IN, instead, consuming the buffer and decreasing sev_pio_count
      is always done in the complete_userspace_io callback, because that
      is when the memcpy is done into sev_pio_data.
      
      Cc: stable@vger.kernel.org
      Fixes: 7ed9abfe
      
       ("KVM: SVM: Support string IO operations for an SEV-ES guest")
      Reported-by: default avatarFelix Wilhelm <fwilhelm@google.com>
      Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      95e16b47
    • Paolo Bonzini's avatar
      KVM: SEV-ES: keep INS functions together · 4fa4b38d
      Paolo Bonzini authored
      Make the diff a little nicer when we actually get to fixing
      the bug.  No functional change intended.
      
      Cc: stable@vger.kernel.org
      Fixes: 7ed9abfe
      
       ("KVM: SVM: Support string IO operations for an SEV-ES guest")
      Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      4fa4b38d
    • Paolo Bonzini's avatar
      KVM: x86: remove unnecessary arguments from complete_emulator_pio_in · 6b5efc93
      Paolo Bonzini authored
      complete_emulator_pio_in can expect that vcpu->arch.pio has been filled in,
      and therefore does not need the size and count arguments.  This makes things
      nicer when the function is called directly from a complete_userspace_io
      callback.
      
      No functional change intended.
      
      Cc: stable@vger.kernel.org
      Fixes: 7ed9abfe
      
       ("KVM: SVM: Support string IO operations for an SEV-ES guest")
      Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      6b5efc93
    • Paolo Bonzini's avatar
      KVM: x86: split the two parts of emulator_pio_in · 3b27de27
      Paolo Bonzini authored
      emulator_pio_in handles both the case where the data is pending in
      vcpu->arch.pio.count, and the case where I/O has to be done via either
      an in-kernel device or a userspace exit.  For SEV-ES we would like
      to split these, to identify clearly the moment at which the
      sev_pio_data is consumed.  To this end, create two different
      functions: __emulator_pio_in fills in vcpu->arch.pio.count, while
      complete_emulator_pio_in clears it and releases vcpu->arch.pio.data.
      
      Because this patch has to be backported, things are left a bit messy.
      kernel_pio() operates on vcpu->arch.pio, which leads to emulator_pio_in()
      having with two calls to complete_emulator_pio_in().  It will be fixed
      in the next release.
      
      While at it, remove the unused void* val argument of emulator_pio_in_out.
      The function currently hardcodes vcpu->arch.pio_data as the
      source/destination buffer, which sucks but will be fixed after the more
      severe SEV-ES buffer overflow.
      
      No functional change intended.
      
      Cc: stable@vger.kernel.org
      Fixes: 7ed9abfe
      
       ("KVM: SVM: Support string IO operations for an SEV-ES guest")
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3b27de27
    • Paolo Bonzini's avatar
      KVM: SEV-ES: clean up kvm_sev_es_ins/outs · ea724ea4
      Paolo Bonzini authored
      A few very small cleanups to the functions, smushed together because
      the patch is already very small like this:
      
      - inline emulator_pio_in_emulated and emulator_pio_out_emulated,
        since we already have the vCPU
      
      - remove the data argument and pull setting vcpu->arch.sev_pio_data into
        the caller
      
      - remove unnecessary clearing of vcpu->arch.pio.count when
        emulation is done by the kernel (and therefore vcpu->arch.pio.count
        is already clear on exit from emulator_pio_in and emulator_pio_out).
      
      No functional change intended.
      
      Cc: stable@vger.kernel.org
      Fixes: 7ed9abfe
      
       ("KVM: SVM: Support string IO operations for an SEV-ES guest")
      Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ea724ea4
    • Paolo Bonzini's avatar
      KVM: x86: leave vcpu->arch.pio.count alone in emulator_pio_in_out · 0d33b1ba
      Paolo Bonzini authored
      Currently emulator_pio_in clears vcpu->arch.pio.count twice if
      emulator_pio_in_out performs kernel PIO.  Move the clear into
      emulator_pio_out where it is actually necessary.
      
      No functional change intended.
      
      Cc: stable@vger.kernel.org
      Fixes: 7ed9abfe
      
       ("KVM: SVM: Support string IO operations for an SEV-ES guest")
      Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      0d33b1ba
    • Paolo Bonzini's avatar
      KVM: SEV-ES: rename guest_ins_data to sev_pio_data · b5998402
      Paolo Bonzini authored
      We will be using this field for OUTS emulation as well, in case the
      data that is pushed via OUTS spans more than one page.  In that case,
      there will be a need to save the data pointer across exits to userspace.
      
      So, change the name to something that refers to any kind of PIO.
      Also spell out what it is used for, namely SEV-ES.
      
      No functional change intended.
      
      Cc: stable@vger.kernel.org
      Fixes: 7ed9abfe
      
       ("KVM: SVM: Support string IO operations for an SEV-ES guest")
      Reviewed-by: default avatarMaxim Levitsky <mlevitsk@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b5998402