1. 01 7月, 2017 1 次提交
    • A
      ARM: Prepare for randomized task_struct · ffa47aa6
      Arnd Bergmann 提交于
      With the new task struct randomization, we can run into a build
      failure for certain random seeds, which will place fields beyond
      the allow immediate size in the assembly:
      
      arch/arm/kernel/entry-armv.S: Assembler messages:
      arch/arm/kernel/entry-armv.S:803: Error: bad immediate value for offset (4096)
      
      Only two constants in asm-offset.h are affected, and I'm changing
      both of them here to work correctly in all configurations.
      
      One more macro has the problem, but is currently unused, so this
      removes it instead of adding complexity.
      Suggested-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      [kees: Adjust commit log slightly]
      Signed-off-by: NKees Cook <keescook@chromium.org>
      ffa47aa6
  2. 05 6月, 2017 1 次提交
    • V
      ARM: 8676/1: NOMMU: provide pgprot_device() macro · 7ef4783e
      Vladimir Murzin 提交于
      NOMMU build leads to the following error:
      
        CC      drivers/pci/mmap.o
      drivers/pci/mmap.c: In function 'pci_mmap_resource_range':
      drivers/pci/mmap.c:60:3: error: implicit declaration of function 'pgprot_device' [-Werror=implicit-function-declaration]
         vma->vm_page_prot = pgprot_device(vma->vm_page_prot);
         ^
      
      cc1: some warnings being treated as errors
      scripts/Makefile.build:302: recipe for target 'drivers/pci/mmap.o' failed
      make[2]: *** [drivers/pci/mmap.o] Error 1
      scripts/Makefile.build:561: recipe for target 'drivers/pci' failed
      make[1]: *** [drivers/pci] Error 2
      Makefile:1016: recipe for target 'drivers' failed
      make: *** [drivers] Error 2
      
      Fix it with support of pgprot_device() macro for NOMMU.
      
      Fixes: 00d2904f ("ARM/PCI: Use generic pci_mmap_resource_range()")
      Signed-off-by: NVladimir Murzin <vladimir.murzin@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      7ef4783e
  3. 30 5月, 2017 1 次提交
    • L
      ARM: dma-mapping: Don't tear down third-party mappings · a93a121a
      Laurent Pinchart 提交于
      arch_setup_dma_ops() is used in device probe code paths to create an
      IOMMU mapping and attach it to the device. The function assumes that the
      device is attached to a device-specific IOMMU instance (or at least a
      device-specific TLB in a shared IOMMU instance) and thus creates a
      separate mapping for every device.
      
      On several systems (Renesas R-Car Gen2 being one of them), that
      assumption is not true, and IOMMU mappings must be shared between
      multiple devices. In those cases the IOMMU driver knows better than the
      generic ARM dma-mapping layer and attaches mapping to devices manually
      with arm_iommu_attach_device(), which sets the DMA ops for the device.
      
      The arch_setup_dma_ops() function takes this into account and bails out
      immediately if the device already has DMA ops assigned. However, the
      corresponding arch_teardown_dma_ops() function, called from driver
      unbind code paths (including probe deferral), will tear the mapping down
      regardless of who created it. When the device is reprobed
      arch_setup_dma_ops() will be called again but won't perform any
      operation as the DMA ops will still be set.
      
      We need to reset the DMA ops in arch_teardown_dma_ops() to fix this.
      However, we can't do so unconditionally, as then a new mapping would be
      created by arch_setup_dma_ops() when the device is reprobed, regardless
      of whether the device needs to share a mapping or not. We must thus keep
      track of whether arch_setup_dma_ops() created the mapping, and only in
      that case tear it down in arch_teardown_dma_ops().
      
      Keep track of that information in the dev_archdata structure. As the
      structure is embedded in all instances of struct device let's not grow
      it, but turn the existing dma_coherent bool field into a bitfield that
      can be used for other purposes.
      
      Fixes: 09515ef5 ("of/acpi: Configure dma operations at probe time for platform/amba/pci bus devices")
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      a93a121a
  4. 15 5月, 2017 1 次提交
    • Z
      KVM: arm: plug potential guest hardware debug leakage · 661e6b02
      Zhichao Huang 提交于
      Hardware debugging in guests is not intercepted currently, it means
      that a malicious guest can bring down the entire machine by writing
      to the debug registers.
      
      This patch enable trapping of all debug registers, preventing the
      guests to access the debug registers. This includes access to the
      debug mode(DBGDSCR) in the guest world all the time which could
      otherwise mess with the host state. Reads return 0 and writes are
      ignored (RAZ_WI).
      
      The result is the guest cannot detect any working hardware based debug
      support. As debug exceptions are still routed to the guest normal
      debug using software based breakpoints still works.
      
      To support debugging using hardware registers we need to implement a
      debug register aware world switch as well as special trapping for
      registers that may affect the host state.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NZhichao Huang <zhichao.huang@linaro.org>
      Signed-off-by: NAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: NChristoffer Dall <cdall@linaro.org>
      Signed-off-by: NChristoffer Dall <cdall@linaro.org>
      661e6b02
  5. 09 5月, 2017 2 次提交
  6. 02 5月, 2017 1 次提交
    • S
      xen/arm,arm64: fix xen_dma_ops after 815dd187 "Consolidate get_dma_ops..." · e0586326
      Stefano Stabellini 提交于
      The following commit:
      
        commit 815dd187
        Author: Bart Van Assche <bart.vanassche@sandisk.com>
        Date:   Fri Jan 20 13:04:04 2017 -0800
      
            treewide: Consolidate get_dma_ops() implementations
      
      rearranges get_dma_ops in a way that xen_dma_ops are not returned when
      running on Xen anymore, dev->dma_ops is returned instead (see
      arch/arm/include/asm/dma-mapping.h:get_arch_dma_ops and
      include/linux/dma-mapping.h:get_dma_ops).
      
      Fix the problem by storing dev->dma_ops in dev_archdata, and setting
      dev->dma_ops to xen_dma_ops. This way, xen_dma_ops is returned naturally
      by get_dma_ops. The Xen code can retrieve the original dev->dma_ops from
      dev_archdata when needed. It also allows us to remove __generic_dma_ops
      from common headers.
      Signed-off-by: NStefano Stabellini <sstabellini@kernel.org>
      Tested-by: NJulien Grall <julien.grall@arm.com>
      Suggested-by: NCatalin Marinas <catalin.marinas@arm.com>
      Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
      Cc: <stable@vger.kernel.org>        [4.11+]
      CC: linux@armlinux.org.uk
      CC: catalin.marinas@arm.com
      CC: will.deacon@arm.com
      CC: boris.ostrovsky@oracle.com
      CC: jgross@suse.com
      CC: Julien Grall <julien.grall@arm.com>
      e0586326
  7. 27 4月, 2017 2 次提交
    • P
      KVM: mark requests that need synchronization · 7a97cec2
      Paolo Bonzini 提交于
      kvm_make_all_requests() provides a synchronization that waits until all
      kicked VCPUs have acknowledged the kick.  This is important for
      KVM_REQ_MMU_RELOAD as it prevents freeing while lockless paging is
      underway.
      
      This patch adds the synchronization property into all requests that are
      currently being used with kvm_make_all_requests() in order to preserve
      the current behavior and only introduce a new framework.  Removing it
      from requests where it is not necessary is left for future patches.
      Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7a97cec2
    • R
      KVM: mark requests that do not need a wakeup · 930f7fd6
      Radim Krčmář 提交于
      Some operations must ensure that the guest is not running with stale
      data, but if the guest is halted, then the update can wait until another
      event happens.  kvm_make_all_requests() currently doesn't wake up, so we
      can mark all requests used with it.
      
      First 8 bits were arbitrarily reserved for request numbers.
      
      Most uses of requests have the request type as a constant, so a compiler
      will optimize the '&'.
      
      An alternative would be to have an inline function that would return
      whether the request needs a wake-up or not, but I like this one better
      even though it might produce worse assembly.
      Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      930f7fd6
  8. 25 4月, 2017 1 次提交
    • L
      ARM: Implement pci_remap_cfgspace() interface · b9cdbe6e
      Lorenzo Pieralisi 提交于
      The PCI bus specification (rev 3.0, 3.2.5 "Transaction Ordering and
      Posting") defines rules for PCI configuration space transactions ordering
      and posting, that state that configuration writes have to be non-posted
      transactions.
      
      Current ioremap interface on ARM provides mapping functions that provide
      "bufferable" writes transactions (ie ioremap uses MT_DEVICE memory type)
      aka posted writes, so PCI host controller drivers have no arch interface to
      remap PCI configuration space with memory attributes that comply with the
      PCI specifications for configuration space.
      
      Implement an ARM specific pci_remap_cfgspace() interface that allows to map
      PCI config memory regions with MT_UNCACHED memory type (ie strongly ordered
      - non-posted writes), providing a remap function that complies with PCI
      specifications for config space transactions.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Russell King <linux@armlinux.org.uk>
      b9cdbe6e
  9. 20 4月, 2017 2 次提交
    • D
      00d2904f
    • J
      ARM: 8667/3: Fix memory attribute inconsistencies when using fixmap · b089c31c
      Jon Medhurst 提交于
      To cope with the variety in ARM architectures and configurations, the
      pagetable attributes for kernel memory are generated at runtime to match
      the system the kernel finds itself on. This calculated value is stored
      in pgprot_kernel.
      
      However, when early fixmap support was added for ARM (commit
      a5f4c561) the attributes used for mappings were hard coded because
      pgprot_kernel is not set up early enough. Unfortunately, when fixmap is
      used after early boot this means the memory being mapped can have
      different attributes to existing mappings, potentially leading to
      unpredictable behaviour. A specific problem also exists due to the hard
      coded values not include the 'shareable' attribute which means on
      systems where this matters (e.g. those with multiple CPU clusters) the
      cache contents for a memory location can become inconsistent between
      CPUs.
      
      To resolve these issues we change fixmap to use the same memory
      attributes (from pgprot_kernel) that the rest of the kernel uses. To
      enable this we need to refactor the initialisation code so
      build_mem_type_table() is called early enough. Note, that relies on early
      param parsing for memory type overrides passed via the kernel command
      line, so we need to make sure this call is still after
      parse_early_params().
      
      [ardb: keep early_fixmap_init() before param parsing, for earlycon]
      
      Fixes: a5f4c561 ("ARM: 8415/1: early fixmap support for earlycon")
      Cc: <stable@vger.kernel.org> # v4.3+
      Tested-by: Nafzal mohammed <afzal.mohd.ma@gmail.com>
      Signed-off-by: NJon Medhurst <tixy@linaro.org>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      b089c31c
  10. 19 4月, 2017 1 次提交
  11. 09 4月, 2017 11 次提交
  12. 07 4月, 2017 2 次提交
  13. 05 4月, 2017 1 次提交
    • A
      efi/arm-stub: Correct FDT and initrd allocation rules for arm64 · 138728dd
      Ard Biesheuvel 提交于
      On arm64, we have made some changes over the past year to the way the
      kernel itself is allocated and to how it deals with the initrd and FDT.
      This patch brings the allocation logic in the EFI stub in line with that,
      which is necessary because the introduction of KASLR has created the
      possibility for the initrd to be allocated in a place where the kernel
      may not be able to map it. (This is mostly a theoretical scenario, since
      it only affects systems where the physical memory footprint exceeds the
      size of the linear mapping.)
      
      Since we know the kernel itself will be covered by the linear mapping,
      choose a suitably sized window (i.e., based on the size of the linear
      region) covering the kernel when allocating memory for the initrd.
      
      The FDT may be anywhere in memory on arm64 now that we map it via the
      fixmap, so we can lift the address restriction there completely.
      Tested-by: NRichard Ruigrok <rruigrok@codeaurora.org>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: NJeffrey Hugo <jhugo@codeaurora.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20170404160245.27812-4-ard.biesheuvel@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      138728dd
  14. 31 3月, 2017 1 次提交
    • A
      ARM: 8663/1: wire up HWCAP/HWCAP2 feature bits to the CPU modalias · ea2d9a96
      Ard Biesheuvel 提交于
      Wire up the generic support for exposing CPU feature bits via the
      modalias in /sys/device/system/cpu. This allows udev to automatically
      load modules for things like crypto algorithms that are implemented
      using optional instructions.
      
      Since it is non-trivial to transparantly support both HWCAP and HWCAP2
      capabilities in the cpu_feature() macro (which allows a module's hwcap
      dependency and init routine to be declared using a single invocation of
      module_cpu_feature_match()), support only HWCAP2 for now, which covers
      the capabilities that are most likely to be useful in this manner.
      Module dependencies on HWCAP will need to be declared explicitly via a
      MODULE_DEVICE_TABLE(cpu, ...) declaration.
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      ea2d9a96
  15. 29 3月, 2017 3 次提交
  16. 17 3月, 2017 1 次提交
    • A
      ARM: 8662/1: module: split core and init PLT sections · b7ede5a1
      Ard Biesheuvel 提交于
      Since commit 35fa91ee ("ARM: kernel: merge core and init PLTs"),
      the ARM module PLT code allocates all PLT entries in a single core
      section, since the overhead of having a separate init PLT section is
      not justified by the small number of PLT entries usually required for
      init code.
      
      However, the core and init module regions are allocated independently,
      and there is a corner case where the core region may be allocated from
      the VMALLOC region if the dedicated module region is exhausted, but the
      init region, being much smaller, can still be allocated from the module
      region. This puts the PLT entries out of reach of the relocated branch
      instructions, defeating the whole purpose of PLTs.
      
      So split the core and init PLT regions, and name the latter ".init.plt"
      so it gets allocated along with (and sufficiently close to) the .init
      sections that it serves. Also, given that init PLT entries may need to
      be emitted for branches that target the core module, modify the logic
      that disregards defined symbols to only disregard symbols that are
      defined in the same section.
      
      Fixes: 35fa91ee ("ARM: kernel: merge core and init PLTs")
      Cc: <stable@vger.kernel.org> # v4.9+
      Reported-by: NAngus Clark <angus@angusclark.org>
      Tested-by: NAngus Clark <angus@angusclark.org>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      b7ede5a1
  17. 10 3月, 2017 1 次提交
  18. 09 3月, 2017 1 次提交
  19. 07 3月, 2017 1 次提交
    • M
      arm: KVM: Survive unknown traps from guests · f050fe7a
      Mark Rutland 提交于
      Currently we BUG() if we see a HSR.EC value we don't recognise. As
      configurable disables/enables are added to the architecture (controlled
      by RES1/RES0 bits respectively), with associated synchronous exceptions,
      it may be possible for a guest to trigger exceptions with classes that
      we don't recognise.
      
      While we can't service these exceptions in a manner useful to the guest,
      we can avoid bringing down the host. Per ARM DDI 0406C.c, all currently
      unallocated HSR EC encodings are reserved, and per ARM DDI
      0487A.k_iss10775, page G6-4395, EC values within the range 0x00 - 0x2c
      are reserved for future use with synchronous exceptions, and EC values
      within the range 0x2d - 0x3f may be used for either synchronous or
      asynchronous exceptions.
      
      The patch makes KVM handle any unknown EC by injecting an UNDEFINED
      exception into the guest, with a corresponding (ratelimited) warning in
      the host dmesg. We could later improve on this with with a new (opt-in)
      exit to the host userspace.
      
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Reviewed-by: NChristoffer Dall <christoffer.dall@linaro.org>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      f050fe7a
  20. 06 3月, 2017 2 次提交
  21. 02 3月, 2017 1 次提交
  22. 28 2月, 2017 2 次提交