Skip to content
  1. Nov 24, 2020
    • Will Deacon's avatar
      arm64: pgtable: Fix pte_accessible() · 07509e10
      Will Deacon authored
      pte_accessible() is used by ptep_clear_flush() to figure out whether TLB
      invalidation is necessary when unmapping pages for reclaim. Although our
      implementation is correct according to the architecture, returning true
      only for valid, young ptes in the absence of racing page-table
      modifications, this is in fact flawed due to lazy invalidation of old
      ptes in ptep_clear_flush_young() where we elide the expensive DSB
      instruction for completing the TLB invalidation.
      
      Rather than penalise the aging path, adjust pte_accessible() to return
      true for any valid pte, even if the access flag is cleared.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 76c714be
      
       ("arm64: pgtable: implement pte_accessible()")
      Reported-by: default avatarYu Zhao <yuzhao@google.com>
      Acked-by: default avatarYu Zhao <yuzhao@google.com>
      Reviewed-by: default avatarMinchan Kim <minchan@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20201120143557.6715-2-will@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      07509e10
  2. Nov 23, 2020
    • Shiju Jose's avatar
      ACPI/IORT: Fix doc warnings in iort.c · 774c4a3b
      Shiju Jose authored
      
      
      Fix following warnings caused by mismatch between
      function parameters and function comments.
      
      drivers/acpi/arm64/iort.c:55: warning: Function parameter or member 'iort_node' not described in 'iort_set_fwnode'
      drivers/acpi/arm64/iort.c:55: warning: Excess function parameter 'node' description in 'iort_set_fwnode'
      drivers/acpi/arm64/iort.c:682: warning: Function parameter or member 'id' not described in 'iort_get_device_domain'
      drivers/acpi/arm64/iort.c:682: warning: Function parameter or member 'bus_token' not described in 'iort_get_device_domain'
      drivers/acpi/arm64/iort.c:682: warning: Excess function parameter 'req_id' description in 'iort_get_device_domain'
      drivers/acpi/arm64/iort.c:1142: warning: Function parameter or member 'dma_size' not described in 'iort_dma_setup'
      drivers/acpi/arm64/iort.c:1142: warning: Excess function parameter 'size' description in 'iort_dma_setup'
      drivers/acpi/arm64/iort.c:1534: warning: Function parameter or member 'ops' not described in 'iort_add_platform_device'
      
      Signed-off-by: default avatarShiju Jose <shiju.jose@huawei.com>
      Acked-by: default avatarHanjun Guo <guohanjun@huawei.com>
      Acked-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Link: https://lore.kernel.org/r/20201014093139.1580-1-shiju.jose@huawei.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      774c4a3b
    • Randy Dunlap's avatar
      arm64/fpsimd: add <asm/insn.h> to <asm/kprobes.h> to fix fpsimd build · 03659efe
      Randy Dunlap authored
      Adding <asm/exception.h> brought in <asm/kprobes.h> which uses
      <asm/probes.h>, which uses 'pstate_check_t' so the latter needs to
      #include <asm/insn.h> for this typedef.
      
      Fixes this build error:
      
        In file included from arch/arm64/include/asm/kprobes.h:24,
                          from arch/arm64/include/asm/exception.h:11,
                          from arch/arm64/kernel/fpsimd.c:35:
        arch/arm64/include/asm/probes.h:16:2: error: unknown type name 'pstate_check_t'
            16 |  pstate_check_t *pstate_cc;
      
      Fixes: c6b90d5c
      
       ("arm64/fpsimd: Fix missing-prototypes in fpsimd.c")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Tian Tao <tiantao6@hisilicon.com>
      Link: https://lore.kernel.org/r/20201123044510.9942-1-rdunlap@infradead.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      03659efe
  3. Nov 13, 2020
  4. Nov 10, 2020
    • Will Deacon's avatar
      arm64: smp: Tell RCU about CPUs that fail to come online · 04e613de
      Will Deacon authored
      Commit ce3d31ad
      
       ("arm64/smp: Move rcu_cpu_starting() earlier") ensured
      that RCU is informed early about incoming CPUs that might end up calling
      into printk() before they are online. However, if such a CPU fails the
      early CPU feature compatibility checks in check_local_cpu_capabilities(),
      then it will be powered off or parked without informing RCU, leading to
      an endless stream of stalls:
      
        | rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
        | rcu:	2-O...: (0 ticks this GP) idle=002/1/0x4000000000000000 softirq=0/0 fqs=2593
        | (detected by 0, t=5252 jiffies, g=9317, q=136)
        | Task dump for CPU 2:
        | task:swapper/2       state:R  running task     stack:    0 pid:    0 ppid:     1 flags:0x00000028
        | Call trace:
        | ret_from_fork+0x0/0x30
      
      Ensure that the dying CPU invokes rcu_report_dead() prior to being powered
      off or parked.
      
      Cc: Qian Cai <cai@redhat.com>
      Cc: "Paul E. McKenney" <paulmck@kernel.org>
      Reviewed-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Suggested-by: default avatarQian Cai <cai@redhat.com>
      Link: https://lore.kernel.org/r/20201105222242.GA8842@willie-the-truck
      Link: https://lore.kernel.org/r/20201106103602.9849-3-will@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      04e613de
    • Will Deacon's avatar
      arm64: psci: Avoid printing in cpu_psci_cpu_die() · 891deb87
      Will Deacon authored
      
      
      cpu_psci_cpu_die() is called in the context of the dying CPU, which
      will no longer be online or tracked by RCU. It is therefore not generally
      safe to call printk() if the PSCI "cpu off" request fails, so remove the
      pr_crit() invocation.
      
      Cc: Qian Cai <cai@redhat.com>
      Cc: "Paul E. McKenney" <paulmck@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Link: https://lore.kernel.org/r/20201106103602.9849-2-will@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      891deb87
    • Will Deacon's avatar
      arm64: kexec_file: Fix sparse warning · 85f0b2fc
      Will Deacon authored
      
      
      Sparse gets cross about us returning 0 from image_load(), which has a
      return type of 'void *':
      
      >> arch/arm64/kernel/kexec_image.c:130:16: sparse: sparse: Using plain integer as NULL pointer
      
      Return NULL instead, as we don't use the return value for anything if it
      does not indicate an error.
      
      Cc: Benjamin Gwin <bgwin@google.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: 108aa503
      
       ("arm64: kexec_file: try more regions if loading segments fails")
      Link: https://lore.kernel.org/r/202011091736.T0zH8kaC-lkp@intel.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      85f0b2fc
    • Will Deacon's avatar
      arm64: errata: Fix handling of 1418040 with late CPU onlining · f969f038
      Will Deacon authored
      
      
      In a surprising turn of events, it transpires that CPU capabilities
      configured as ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE are never set as the
      result of late-onlining. Therefore our handling of erratum 1418040 does
      not get activated if it is not required by any of the boot CPUs, even
      though we allow late-onlining of an affected CPU.
      
      In order to get things working again, replace the cpus_have_const_cap()
      invocation with an explicit check for the current CPU using
      this_cpu_has_cap().
      
      Cc: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20201106114952.10032-1-will@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      f969f038
  5. Nov 06, 2020
  6. Nov 03, 2020
  7. Oct 30, 2020
    • Fangrui Song's avatar
      arm64: Change .weak to SYM_FUNC_START_WEAK_PI for arch/arm64/lib/mem*.S · ec9d7807
      Fangrui Song authored
      Commit 39d114dd ("arm64: add KASAN support") added .weak directives to
      arch/arm64/lib/mem*.S instead of changing the existing SYM_FUNC_START_PI
      macros. This can lead to the assembly snippet `.weak memcpy ... .globl
      memcpy` which will produce a STB_WEAK memcpy with GNU as but STB_GLOBAL
      memcpy with LLVM's integrated assembler before LLVM 12. LLVM 12 (since
      https://reviews.llvm.org/D90108) will error on such an overridden symbol
      binding.
      
      Use the appropriate SYM_FUNC_START_WEAK_PI instead.
      
      Fixes: 39d114dd
      
       ("arm64: add KASAN support")
      Reported-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Signed-off-by: default avatarFangrui Song <maskray@google.com>
      Tested-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20201029181951.1866093-1-maskray@google.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      ec9d7807
    • Qian Cai's avatar
      arm64/smp: Move rcu_cpu_starting() earlier · ce3d31ad
      Qian Cai authored
      
      
      The call to rcu_cpu_starting() in secondary_start_kernel() is not early
      enough in the CPU-hotplug onlining process, which results in lockdep
      splats as follows:
      
       WARNING: suspicious RCU usage
       -----------------------------
       kernel/locking/lockdep.c:3497 RCU-list traversed in non-reader section!!
      
       other info that might help us debug this:
      
       RCU used illegally from offline CPU!
       rcu_scheduler_active = 1, debug_locks = 1
       no locks held by swapper/1/0.
      
       Call trace:
        dump_backtrace+0x0/0x3c8
        show_stack+0x14/0x60
        dump_stack+0x14c/0x1c4
        lockdep_rcu_suspicious+0x134/0x14c
        __lock_acquire+0x1c30/0x2600
        lock_acquire+0x274/0xc48
        _raw_spin_lock+0xc8/0x140
        vprintk_emit+0x90/0x3d0
        vprintk_default+0x34/0x40
        vprintk_func+0x378/0x590
        printk+0xa8/0xd4
        __cpuinfo_store_cpu+0x71c/0x868
        cpuinfo_store_cpu+0x2c/0xc8
        secondary_start_kernel+0x244/0x318
      
      This is avoided by moving the call to rcu_cpu_starting up near the
      beginning of the secondary_start_kernel() function.
      
      Signed-off-by: default avatarQian Cai <cai@redhat.com>
      Acked-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Link: https://lore.kernel.org/lkml/160223032121.7002.1269740091547117869.tip-bot2@tip-bot2/
      Link: https://lore.kernel.org/r/20201028182614.13655-1-cai@redhat.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      ce3d31ad
  8. Oct 29, 2020
    • Rob Herring's avatar
      arm64: Add workaround for Arm Cortex-A77 erratum 1508412 · 96d389ca
      Rob Herring authored
      
      
      On Cortex-A77 r0p0 and r1p0, a sequence of a non-cacheable or device load
      and a store exclusive or PAR_EL1 read can cause a deadlock.
      
      The workaround requires a DMB SY before and after a PAR_EL1 register
      read. In addition, it's possible an interrupt (doing a device read) or
      KVM guest exit could be taken between the DMB and PAR read, so we
      also need a DMB before returning from interrupt and before returning to
      a guest.
      
      A deadlock is still possible with the workaround as KVM guests must also
      have the workaround. IOW, a malicious guest can deadlock an affected
      systems.
      
      This workaround also depends on a firmware counterpart to enable the h/w
      to insert DMB SY after load and store exclusive instructions. See the
      errata document SDEN-1152370 v10 [1] for more information.
      
      [1] https://static.docs.arm.com/101992/0010/Arm_Cortex_A77_MP074_Software_Developer_Errata_Notice_v10.pdf
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: James Morse <james.morse@arm.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Julien Thierry <julien.thierry.kdev@gmail.com>
      Cc: kvmarm@lists.cs.columbia.edu
      Link: https://lore.kernel.org/r/20201028182839.166037-2-robh@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      96d389ca
    • Rob Herring's avatar
      arm64: Add part number for Arm Cortex-A77 · 8a6b88e6
      Rob Herring authored
      
      
      Add the MIDR part number info for the Arm Cortex-A77.
      
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Link: https://lore.kernel.org/r/20201028182839.166037-1-robh@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      8a6b88e6
    • Catalin Marinas's avatar
      arm64: mte: Document that user PSTATE.TCO is ignored by kernel uaccess · ef5dd6a0
      Catalin Marinas authored
      
      
      On exception entry, the kernel explicitly resets the PSTATE.TCO (tag
      check override) so that any kernel memory accesses will be checked (the
      bit is restored on exception return). This has the side-effect that the
      uaccess routines will not honour the PSTATE.TCO that may have been set
      by the user prior to a syscall.
      
      There is no issue in practice since PSTATE.TCO is expected to be used
      only for brief periods in specific routines (e.g. garbage collection).
      To control the tag checking mode of the uaccess routines, the user will
      have to invoke a corresponding prctl() call.
      
      Document the kernel behaviour w.r.t. PSTATE.TCO accordingly.
      
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Fixes: df9d7a22
      
       ("arm64: mte: Add Memory Tagging Extension documentation")
      Reviewed-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      ef5dd6a0
  9. Oct 28, 2020
    • Ard Biesheuvel's avatar
      module: use hidden visibility for weak symbol references · 13150bc5
      Ard Biesheuvel authored
      Geert reports that commit be288182
      
       ("arm64/build: Assert for
      unwanted sections") results in build errors on arm64 for configurations
      that have CONFIG_MODULES disabled.
      
      The commit in question added ASSERT()s to the arm64 linker script to
      ensure that linker generated sections such as .got.plt etc are empty,
      but as it turns out, there are corner cases where the linker does emit
      content into those sections. More specifically, weak references to
      function symbols (which can remain unsatisfied, and can therefore not
      be emitted as relative references) will be emitted as GOT and PLT
      entries when linking the kernel in PIE mode (which is the case when
      CONFIG_RELOCATABLE is enabled, which is on by default).
      
      What happens is that code such as
      
      	struct device *(*fn)(struct device *dev);
      	struct device *iommu_device;
      
      	fn = symbol_get(mdev_get_iommu_device);
      	if (fn) {
      		iommu_device = fn(dev);
      
      essentially gets converted into the following when CONFIG_MODULES is off:
      
      	struct device *iommu_device;
      
      	if (&mdev_get_iommu_device) {
      		iommu_device = mdev_get_iommu_device(dev);
      
      where mdev_get_iommu_device is emitted as a weak symbol reference into
      the object file. The first reference is decorated with an ordinary
      ABS64 data relocation (which yields 0x0 if the reference remains
      unsatisfied). However, the indirect call is turned into a direct call
      covered by a R_AARCH64_CALL26 relocation, which is converted into a
      call via a PLT entry taking the target address from the associated
      GOT entry.
      
      Given that such GOT and PLT entries are unnecessary for fully linked
      binaries such as the kernel, let's give these weak symbol references
      hidden visibility, so that the linker knows that the weak reference
      via R_AARCH64_CALL26 can simply remain unsatisfied.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarFangrui Song <maskray@google.com>
      Acked-by: default avatarJessica Yu <jeyu@kernel.org>
      Cc: Jessica Yu <jeyu@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Link: https://lore.kernel.org/r/20201027151132.14066-1-ardb@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      13150bc5
    • Ard Biesheuvel's avatar
      arm64: efi: increase EFI PE/COFF header padding to 64 KB · a2d50c1c
      Ard Biesheuvel authored
      Commit 76085aff ("efi/libstub/arm64: align PE/COFF sections to segment
      alignment") increased the PE/COFF section alignment to match the minimum
      segment alignment of the kernel image, which ensures that the kernel does
      not need to be moved around in memory by the EFI stub if it was built as
      relocatable.
      
      However, the first PE/COFF section starts at _stext, which is only 4 KB
      aligned, and so the section layout is inconsistent. Existing EFI loaders
      seem to care little about this, but it is better to clean this up.
      
      So let's pad the header to 64 KB to match the PE/COFF section alignment.
      
      Fixes: 76085aff
      
       ("efi/libstub/arm64: align PE/COFF sections to segment alignment")
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Link: https://lore.kernel.org/r/20201027073209.2897-2-ardb@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      a2d50c1c
    • Ard Biesheuvel's avatar
      arm64: vmlinux.lds: account for spurious empty .igot.plt sections · 5f692a81
      Ard Biesheuvel authored
      
      
      Now that we started making the linker warn about orphan sections
      (input sections that are not explicitly consumed by an output section),
      some configurations produce the following warning:
      
        aarch64-linux-gnu-ld: warning: orphan section `.igot.plt' from
               `arch/arm64/kernel/head.o' being placed in section `.igot.plt'
      
      It could be any file that triggers this - head.o is simply the first
      input file in the link - and the resulting .igot.plt section never
      actually appears in vmlinux as it turns out to be empty.
      
      So let's add .igot.plt to our collection of input sections to disregard
      unless they are empty.
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Cc: Jessica Yu <jeyu@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Link: https://lore.kernel.org/r/20201028133332.5571-1-ardb@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      5f692a81
    • Vincenzo Frascino's avatar
      kselftest/arm64: Fix check_user_mem test · 493b35db
      Vincenzo Frascino authored
      The check_user_mem test reports the error below because the test
      plan is not declared correctly:
      
        # Planned tests != run tests (0 != 4)
      
      Fix the test adding the correct test plan declaration.
      
      Fixes: 4dafc08d
      
       ("kselftest/arm64: Check mte tagged user address in kernel")
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Gabor Kertesz <gabor.kertesz@arm.com>
      Cc: Amit Daniel Kachhap <amit.kachhap@arm.com>
      Link: https://lore.kernel.org/r/20201026121248.2340-7-vincenzo.frascino@arm.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      493b35db
    • Vincenzo Frascino's avatar
      kselftest/arm64: Fix check_ksm_options test · cbb268af
      Vincenzo Frascino authored
      The check_ksm_options test reports the error below because the test
      plan is not declared correctly:
      
        # Planned tests != run tests (0 != 4)
      
      Fix the test adding the correct test plan declaration.
      
      Fixes: f981d8fa
      
       ("kselftest/arm64: Verify KSM page merge for MTE pages")
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Gabor Kertesz <gabor.kertesz@arm.com>
      Cc: Amit Daniel Kachhap <amit.kachhap@arm.com>
      Link: https://lore.kernel.org/r/20201026121248.2340-6-vincenzo.frascino@arm.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      cbb268af
    • Vincenzo Frascino's avatar
      kselftest/arm64: Fix check_mmap_options test · 7419390a
      Vincenzo Frascino authored
      The check_mmap_options test reports the error below because the test
      plan is not declared correctly:
      
        # Planned tests != run tests (0 != 22)
      
      Fix the test adding the correct test plan declaration.
      
      Fixes: 53ec81d2
      
       ("kselftest/arm64: Verify all different mmap MTE options")
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Gabor Kertesz <gabor.kertesz@arm.com>
      Cc: Amit Daniel Kachhap <amit.kachhap@arm.com>
      Link: https://lore.kernel.org/r/20201026121248.2340-5-vincenzo.frascino@arm.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      7419390a
    • Vincenzo Frascino's avatar
      kselftest/arm64: Fix check_child_memory test · 386cf789
      Vincenzo Frascino authored
      The check_child_memory test reports the error below because the test
      plan is not declared correctly:
      
        # Planned tests != run tests (0 != 12)
      
      Fix the test adding the correct test plan declaration.
      
      Fixes: dfe537cf
      
       ("kselftest/arm64: Check forked child mte memory accessibility")
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Gabor Kertesz <gabor.kertesz@arm.com>
      Cc: Amit Daniel Kachhap <amit.kachhap@arm.com>
      Link: https://lore.kernel.org/r/20201026121248.2340-4-vincenzo.frascino@arm.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      386cf789
    • Vincenzo Frascino's avatar
      kselftest/arm64: Fix check_tags_inclusion test · 041fa41f
      Vincenzo Frascino authored
      The check_tags_inclusion test reports the error below because the test
      plan is not declared correctly:
      
        # Planned tests != run tests (0 != 4)
      
      Fix the test adding the correct test plan declaration.
      
      Fixes: f3b2a26c
      
       ("kselftest/arm64: Verify mte tag inclusion via prctl")
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Gabor Kertesz <gabor.kertesz@arm.com>
      Cc: Amit Daniel Kachhap <amit.kachhap@arm.com>
      Link: https://lore.kernel.org/r/20201026121248.2340-3-vincenzo.frascino@arm.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      041fa41f
    • Vincenzo Frascino's avatar
      kselftest/arm64: Fix check_buffer_fill test · 5bc7c115
      Vincenzo Frascino authored
      The check_buffer_fill test reports the error below because the test
      plan is not declared correctly:
      
        # Planned tests != run tests (0 != 20)
      
      Fix the test adding the correct test plan declaration.
      
      Fixes: e9b60476
      
       ("kselftest/arm64: Add utilities and a test to validate mte memory")
      Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Gabor Kertesz <gabor.kertesz@arm.com>
      Cc: Amit Daniel Kachhap <amit.kachhap@arm.com>
      Link: https://lore.kernel.org/r/20201026121248.2340-2-vincenzo.frascino@arm.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      5bc7c115
    • Arnd Bergmann's avatar
      arm64: avoid -Woverride-init warning · 332576e6
      Arnd Bergmann authored
      The icache_policy_str[] definition causes a warning when extra
      warning flags are enabled:
      
      arch/arm64/kernel/cpuinfo.c:38:26: warning: initialized field overwritten [-Woverride-init]
         38 |  [ICACHE_POLICY_VIPT]  = "VIPT",
            |                          ^~~~~~
      arch/arm64/kernel/cpuinfo.c:38:26: note: (near initialization for 'icache_policy_str[2]')
      arch/arm64/kernel/cpuinfo.c:39:26: warning: initialized field overwritten [-Woverride-init]
         39 |  [ICACHE_POLICY_PIPT]  = "PIPT",
            |                          ^~~~~~
      arch/arm64/kernel/cpuinfo.c:39:26: note: (near initialization for 'icache_policy_str[3]')
      arch/arm64/kernel/cpuinfo.c:40:27: warning: initialized field overwritten [-Woverride-init]
         40 |  [ICACHE_POLICY_VPIPT]  = "VPIPT",
            |                           ^~~~~~~
      arch/arm64/kernel/cpuinfo.c:40:27: note: (near initialization for 'icache_policy_str[0]')
      
      There is no real need for the default initializer here, as printing a
      NULL string is harmless. Rewrite the logic to have an explicit
      reserved value for the only one that uses the default value.
      
      This partially reverts the commit that removed ICACHE_POLICY_AIVIVT.
      
      Fixes: 155433cb
      
       ("arm64: cache: Remove support for ASID-tagged VIVT I-caches")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20201026193807.3816388-1-arnd@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      332576e6
    • Stephen Boyd's avatar
      KVM: arm64: ARM_SMCCC_ARCH_WORKAROUND_1 doesn't return SMCCC_RET_NOT_REQUIRED · 1de111b5
      Stephen Boyd authored
      According to the SMCCC spec[1](7.5.2 Discovery) the
      ARM_SMCCC_ARCH_WORKAROUND_1 function id only returns 0, 1, and
      SMCCC_RET_NOT_SUPPORTED.
      
       0 is "workaround required and safe to call this function"
       1 is "workaround not required but safe to call this function"
       SMCCC_RET_NOT_SUPPORTED is "might be vulnerable or might not be, who knows, I give up!"
      
      SMCCC_RET_NOT_SUPPORTED might as well mean "workaround required, except
      calling this function may not work because it isn't implemented in some
      cases". Wonderful. We map this SMC call to
      
       0 is SPECTRE_MITIGATED
       1 is SPECTRE_UNAFFECTED
       SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE
      
      For KVM hypercalls (hvc), we've implemented this function id to return
      SMCCC_RET_NOT_SUPPORTED, 0, and SMCCC_RET_NOT_REQUIRED. One of those
      isn't supposed to be there. Per the code we call
      arm64_get_spectre_v2_state() to figure out what to return for this
      feature discovery call.
      
       0 is SPECTRE_MITIGATED
       SMCCC_RET_NOT_REQUIRED is SPECTRE_UNAFFECTED
       SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE
      
      Let's clean this up so that KVM tells the guest this mapping:
      
       0 is SPECTRE_MITIGATED
       1 is SPECTRE_UNAFFECTED
       SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE
      
      Note: SMCCC_RET_NOT_AFFECTED is 1 but isn't part of the SMCCC spec
      
      Fixes: c118bbb5
      
       ("arm64: KVM: Propagate full Spectre v2 workaround state to KVM guests")
      Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Cc: Andre Przywara <andre.przywara@arm.com>
      Cc: Steven Price <steven.price@arm.com>
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://developer.arm.com/documentation/den0028/latest [1]
      Link: https://lore.kernel.org/r/20201023154751.1973872-1-swboyd@chromium.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      1de111b5
  10. Oct 26, 2020