Commit Graph

2827 Commits

Author SHA1 Message Date
Linus Torvalds
c32c2cb272 arm64 fixes:
- Temporarily disable huge pages built using contiguous ptes
 - Ensure vmemmap region is sufficiently aligned for sparsemem sections
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABCgAGBQJW4FSYAAoJELescNyEwWM0cp4H/0+9iMTqb3KowIW1vQPNnOG2
 BG/RVsGlCPAwBu0V4FdcY7eK4fQ9J+/UCmVd5/SrlpjNpblinxRPihbIzs4bToqa
 It02wNk7ISPm0oYtyGrRu1TpC5AvMykcluZkU/CUk0sjZlBAi8WSaJiqftFuZSGH
 lhyhARO4KscbAUUhwDDYNKuWmLbmyOpt9RM2fziNQdjSp+8czCoCR9G+JXiPQFsJ
 ORU10BqBDCyFpp8/NhM55qA76FJo6RCBUWx/6L1oJJxjvahkmPba/hhnfI7+Xj1u
 3FKAntJ6wVZeKqRsIkOlECoU/mrgjlTByTFN+o3KhOky8ZYBHoveIQWtsqNMFd4=
 =7d1o
 -----END PGP SIGNATURE-----

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Will Deacon:
 "I thought we were done for 4.5, but then the 64k-page chaps came
  crawling out of the woodwork.  *sigh*

  The vmemmap fix I sent for -rc7 caused a regression with 64k pages and
  sparsemem and at some point during the release cycle the new hugetlb
  code using contiguous ptes started failing the libhugetlbfs tests with
  64k pages enabled.

  So here are a couple of patches that fix the vmemmap alignment and
  disable the new hugetlb page sizes whilst a proper fix is being
  developed:

   - Temporarily disable huge pages built using contiguous ptes

   - Ensure vmemmap region is sufficiently aligned for sparsemem
     sections"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: hugetlb: partial revert of 66b3923a1a
  arm64: account for sparsemem section alignment when choosing vmemmap offset
2016-03-10 10:39:04 -08:00
Mark Rutland
0d97e6d802 arm64: kasan: clear stale stack poison
Functions which the compiler has instrumented for KASAN place poison on
the stack shadow upon entry and remove this poison prior to returning.

In the case of cpuidle, CPUs exit the kernel a number of levels deep in
C code.  Any instrumented functions on this critical path will leave
portions of the stack shadow poisoned.

If CPUs lose context and return to the kernel via a cold path, we
restore a prior context saved in __cpu_suspend_enter are forgotten, and
we never remove the poison they placed in the stack shadow area by
functions calls between this and the actual exit of the kernel.

Thus, (depending on stackframe layout) subsequent calls to instrumented
functions may hit this stale poison, resulting in (spurious) KASAN
splats to the console.

To avoid this, clear any stale poison from the idle thread for a CPU
prior to bringing a CPU online.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-09 15:43:42 -08:00
Will Deacon
ff7925848b arm64: hugetlb: partial revert of 66b3923a1a
Commit 66b3923a1a ("arm64: hugetlb: add support for PTE contiguous bit")
introduced support for huge pages using the contiguous bit in the PTE
as opposed to block mappings, which may be slightly unwieldy (512M) in
64k page configurations.

Unfortunately, this support has resulted in some late regressions when
running the libhugetlbfs test suite with 64k pages and CONFIG_DEBUG_VM
as a result of a BUG:

 | readback (2M: 64):	------------[ cut here ]------------
 | kernel BUG at fs/hugetlbfs/inode.c:446!
 | Internal error: Oops - BUG: 0 [#1] SMP
 | Modules linked in:
 | CPU: 7 PID: 1448 Comm: readback Not tainted 4.5.0-rc7 #148
 | Hardware name: linux,dummy-virt (DT)
 | task: fffffe0040964b00 ti: fffffe00c2668000 task.ti: fffffe00c2668000
 | PC is at remove_inode_hugepages+0x44c/0x480
 | LR is at remove_inode_hugepages+0x264/0x480

Rather than revert the entire patch, simply avoid advertising the
contiguous huge page sizes for now while people are actively working on
a fix. This patch can then be reverted once things have been sorted out.

Cc: David Woods <dwoods@ezchip.com>
Reported-by: Steve Capper <steve.capper@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2016-03-09 15:29:29 +00:00
Ard Biesheuvel
36e5cd6b89 arm64: account for sparsemem section alignment when choosing vmemmap offset
Commit dfd55ad85e ("arm64: vmemmap: use virtual projection of linear
region") fixed an issue where the struct page array would overflow into the
adjacent virtual memory region if system RAM was placed so high up in
physical memory that its addresses were not representable in the build time
configured virtual address size.

However, the fix failed to take into account that the vmemmap region needs
to be relatively aligned with respect to the sparsemem section size, so that
a sequence of page structs corresponding with a sparsemem section in the
linear region appears naturally aligned in the vmemmap region.

So round up vmemmap to sparsemem section size. Since this essentially moves
the projection of the linear region up in memory, also revert the reduction
of the size of the vmemmap region.

Cc: <stable@vger.kernel.org>
Fixes: dfd55ad85e ("arm64: vmemmap: use virtual projection of linear region")
Tested-by: Mark Langsdorf <mlangsdo@redhat.com>
Tested-by: David Daney <david.daney@cavium.com>
Tested-by: Robert Richter <rrichter@cavium.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2016-03-09 14:57:08 +00:00
Marc Zyngier
b40c4892d1 arm64: KVM: vgic-v3: Only wipe LRs on vcpu exit
So far, we're always writing all possible LRs, setting the empty
ones with a zero value. This is obvious doing a low of work for
nothing, and we're better off clearing those we've actually
dirtied on the exit path (it is very rare to inject more than one
interrupt at a time anyway).

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-03-09 04:24:16 +00:00
Marc Zyngier
0d98d00b8d arm64: KVM: vgic-v3: Reset LRs at boot time
In order to let the GICv3 code be more lazy in the way it
accesses the LRs, it is necessary to start with a clean slate.

Let's reset the LRs on each CPU when the vgic is probed (which
includes a round trip to EL2...).

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-03-09 04:24:09 +00:00
Marc Zyngier
84e8b9c88d arm64: KVM: vgic-v3: Do not save an LR known to be empty
On exit, any empty LR will be signaled in ICH_ELRSR_EL2. Which
means that we do not have to save it, and we can just clear
its state in the in-memory copy.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-03-09 04:24:07 +00:00
Marc Zyngier
b4344545cf arm64: KVM: vgic-v3: Save maintenance interrupt state only if required
Next on our list of useless accesses is the maintenance interrupt
status registers (ICH_MISR_EL2, ICH_EISR_EL2).

It is pointless to save them if we haven't asked for a maintenance
interrupt the first place, which can only happen for two reasons:
- Underflow: ICH_HCR_UIE will be set,
- EOI: ICH_LR_EOI will be set.

These conditions can be checked on the in-memory copies of the regs.
Should any of these two condition be valid, we must read GICH_MISR.
We can then check for ICH_MISR_EOI, and only when set read
ICH_EISR_EL2.

This means that in most case, we don't have to save them at all.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-03-09 04:24:06 +00:00
Marc Zyngier
1b8e83c04e arm64: KVM: vgic-v3: Avoid accessing ICH registers
Just like on GICv2, we're a bit hammer-happy with GICv3, and access
them more often than we should.

Adopt a policy similar to what we do for GICv2, only save/restoring
the minimal set of registers. As we don't access the registers
linearly anymore (we may skip some), the convoluted accessors become
slightly simpler, and we can drop the ugly indexing macro that
tended to confuse the reviewers.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-03-09 04:24:04 +00:00
Bjorn Helgaas
e7e127e3c7 PCI: Include pci/hotplug Kconfig directly from pci/Kconfig
Include pci/hotplug/Kconfig directly from pci/Kconfig, so arches don't
have to source both pci/Kconfig and pci/hotplug/Kconfig.

Note that this effectively adds pci/hotplug/Kconfig to the following
arches, because they already sourced drivers/pci/Kconfig but they
previously did not source drivers/pci/hotplug/Kconfig:

  alpha
  arm
  avr32
  frv
  m68k
  microblaze
  mn10300
  sparc
  unicore32

Inspired-by-patch-from: Bogicevic Sasa <brutallesale@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2016-03-08 15:10:48 -06:00
Bogicevic Sasa
5f8fc43217 PCI: Include pci/pcie/Kconfig directly from pci/Kconfig
Include pci/pcie/Kconfig directly from pci/Kconfig, so arches don't
have to source both pci/Kconfig and pci/pcie/Kconfig.

Note that this effectively adds pci/pcie/Kconfig to the following
arches, because they already sourced drivers/pci/Kconfig but they
previously did not source drivers/pci/pcie/Kconfig:

  alpha
  avr32
  blackfin
  frv
  m32r
  m68k
  microblaze
  mn10300
  parisc
  sparc
  unicore32
  xtensa

[bhelgaas: changelog, source pci/pcie/Kconfig at top of pci/Kconfig, whitespace]
Signed-off-by: Sasa Bogicevic <brutallesale@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2016-03-08 14:36:48 -06:00
David S. Miller
810813c47a Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Several cases of overlapping changes, as well as one instance
(vxlan) of a bug fix in 'net' overlapping with code movement
in 'net-next'.

Signed-off-by: David S. Miller <davem@davemloft.net>
2016-03-08 12:34:12 -05:00
Sudeep Holla
6d6acd140a arm64: dts: juno/vexpress: fix node name unit-address presence warnings
Commit fa38a82096a1 ("scripts/dtc: Update to upstream version
53bf130b1cdd") added warnings on node name unit-address presence/absence
mismatch in device trees.

This patch fixes those warning on all the juno/vexpress platforms where
unit-address is present in node name while the reg/ranges property is
not present. It also adds unit-address to all smb bus node.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-03-08 13:54:27 +00:00
Fu Wei
4739f74453 arm64: dts: foundation-v8: add SBSA Generic Watchdog device node
This can be a example of adding SBSA Generic Watchdog device node
into some dts files for the Soc which contains SBSA Generic Watchdog.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Fu Wei <fu.wei@linaro.org>
[edited subject and moved change to dtsi file]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-03-08 10:35:01 +00:00
Christoph Hellwig
bc4b024a8b PCI: Move pci_dma_* helpers to common code
For a long time all architectures implement the pci_dma_* functions using
the generic DMA API, and they all use the same header to do so.

Move this header, pci-dma-compat.h, to include/linux and include it from
the generic pci.h instead of having each arch duplicate this include.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2016-03-07 10:40:02 -06:00
Andreas Färber
cc733bc906 ARM64: dts: amlogic: Add Tronsmart Vega S95 configs
Add Device Trees for Tronsmart Vega S95 Pro, Meta and Telos TV boxes.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Carlo Caione <carlo@endlessm.com>
2016-03-07 11:12:40 +01:00
Andreas Färber
4f24eda840 ARM64: dts: Prepare configs for Amlogic Meson GXBaby
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Carlo Caione <carlo@endlessm.com>
2016-03-07 11:12:40 +01:00
Andreas Färber
451e9e54e2 ARM64: Enable Amlogic Meson GXBaby platform
Provide the ARCH_MESON Kconfig symbol to allow enabling existing serial
and i2c drivers.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Carlo Caione <carlo@endlessm.com>
2016-03-07 10:44:31 +01:00
Linus Torvalds
ed385c7a17 arm64 fix:
- Ensure struct page array fits within vmemmap area
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJW1NaCAAoJELescNyEwWM0Sl8H/3jJiGQixMLmjdfUsZVrtdk5
 0Smn4HKYxv3AV2WQ6+miOquOhMz3xrGIHaOf1Zf4GSo3n02drq3pmHqrM2muBpp5
 tmw9Q36dApXKIztpBQDqk7yCEpY7rELtIjvaOjta3OOLFbBnTsdGdkp+EWEn6m1g
 NJ6Cnw96KMHnivbwLpVzbeRQni9E+oJIhpv4p/wy5gSTqMCdJIBsfK3/uv3rszLZ
 O70F6+ZL9a2wUc4SnSUESpEuFmwoZHWROlZreZlHXQzmuyqpYIJK/JxBMaaz2yC/
 2L2k3kEmgfRwxjh5Jcp5yzKxCJH0ZUYYGoDKoDaIb8iP3SrlTlfp8jBorANIxcY=
 =dfNx
 -----END PGP SIGNATURE-----

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fix from Will Deacon:
 "Arm64 fix for -rc7.  Without it, our struct page array can overflow
  the vmemmap region on systems with a large PHYS_OFFSET.

  Nothing else on the radar at the moment, so hopefully that's it for
  4.5 from us.

  Summary: Ensure struct page array fits within vmemmap area"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: vmemmap: use virtual projection of linear region
2016-03-04 17:43:40 -08:00
Russell King
1b3bf84797 Merge branches 'amba', 'fixes', 'misc' and 'tauros2' into for-next 2016-03-04 23:36:02 +00:00
Adam Buchbinder
ef769e3208 arm64: Fix misspellings in comments.
Signed-off-by: Adam Buchbinder <adam.buchbinder@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-03-04 18:19:17 +00:00
Ard Biesheuvel
cd1b76bb73 arm64: efi: add missing frame pointer assignment
The prologue of the EFI entry point pushes x29 and x30 onto the stack but
fails to create the stack frame correctly by omitting the assignment of x29
to the new value of the stack pointer. So fix that.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-03-04 18:12:23 +00:00
Mark Rutland
1cc6ed90dd arm64: make mrs_s prefixing implicit in read_cpuid
Commit 0f54b14e76 ("arm64: cpufeature: Change read_cpuid() to use
sysreg's mrs_s macro") changed read_cpuid to require a SYS_ prefix on
register names, to allow manual assembly of registers unknown by the
toolchain, using tables in sysreg.h.

This interacts poorly with commit 42b5573403 ("efi/arm64: Check
for h/w support before booting a >4 KB granular kernel"), which is
curretly queued via the tip tree, and uses read_cpuid without a SYS_
prefix. Due to this, a build of next-20160304 fails if EFI and 64K pages
are selected.

To avoid this issue when trees are merged, move the required SYS_
prefixing into read_cpuid, and revert all of the updated callsites to
pass plain register names. This effectively reverts the bulk of commit
0f54b14e76.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: James Morse <james.morse@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-03-04 14:12:46 +00:00
Ingo Molnar
bc94b99636 Linux 4.5-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJW0yM6AAoJEHm+PkMAQRiGeUwIAJRTHFPJTFpJcJjeZEV4/EL1
 7Pl0WSHs/CWBkXIevAg2HgkECSQ9NI9FAUFvoGxCldDpFAnL1U2QV8+Ur2qhiXMG
 5v0jILJuiw57qT/NfhEudZolerlRoHILmB3JRTb+DUV4GHZuWpTkJfUSI9j5aTEl
 w83XUgtK4bKeIyFbHdWQk6xqfzfFBSuEITuSXreOMwkFfMmeScE0WXOPLBZWyhPa
 v0rARJLYgM+vmRAnJjnG8unH+SgnqiNcn2oOFpevKwmpVcOjcEmeuxh/HdeZf7HM
 /R8F86OwdmXsO+z8dQxfcucLg+I9YmKfFr8b6hopu1sRztss2+Uk6H1j2J7IFIg=
 =tvkh
 -----END PGP SIGNATURE-----

Merge tag 'v4.5-rc6' into core/resources, to resolve conflict

Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-03-04 12:12:08 +01:00
Linus Torvalds
c2687cf950 * ARM/MIPS: Fixes for ioctls when copy_from_user returns nonzero
* x86: Small fix for Skylake TSC scaling
 * x86: Improved fix for last week's missed hardware breakpoint bug
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJW2Fi+AAoJEL/70l94x66DN0IH/RdRqc22D9gRKmBi0WmlHxYf
 IwwKoR7U6esszkFkDeRQ5f97ghHoQVo1HWloEV9r9M0+ghS33hrxdbWIncxImvS0
 xCMCA9hON4UwpZ5Afi7XJkW6Ih7XF23+VozfK7J0ZJNGV3wHUXZQftEpF1SBeQrx
 jjngwMJzZQTsv91a5n+tcJh05NkgU2E0XeXpOPM0EX74mF3ldk66uRRyJu3iXRkt
 gA9fFWSR5BO3tAjvwhIy9xh1cmNqDw4F1cVQQaigQiQsFO62QLx0cPKsMP8gtMO9
 YZrldOuKmxt3w+zd5U//6yR476UFF2Rj6uZzrT2iO3XS7dlM/Eex2rD+eRdgBeU=
 =BOxa
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull KVM fixes from Paolo Bonzini:
 - ARM/MIPS: Fixes for ioctls when copy_from_user returns nonzero
 - x86: Small fix for Skylake TSC scaling
 - x86: Improved fix for last week's missed hardware breakpoint bug

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  kvm: x86: Update tsc multiplier on change.
  mips/kvm: fix ioctl error handling
  arm/arm64: KVM: Fix ioctl error handling
  KVM: x86: fix root cause for missed hardware breakpoints
2016-03-03 11:54:56 -08:00
Ard Biesheuvel
57efac2f71 arm64: enable CONFIG_DEBUG_RODATA by default
In spite of its name, CONFIG_DEBUG_RODATA is an important hardening feature
for production kernels, and distros all enable it by default in their
kernel configs. However, since enabling it used to result in more granular,
and thus less efficient kernel mappings, it is not enabled by default for
performance reasons.

However, since commit 2f39b5f91e ("arm64: mm: Mark .rodata as RO"), the
various kernel segments (.text, .rodata, .init and .data) are already
mapped individually, and the only effect of setting CONFIG_DEBUG_RODATA is
that the existing .text and .rodata mappings are updated late in the boot
sequence to have their read-only attributes set, which means that any
performance concerns related to enabling CONFIG_DEBUG_RODATA are no longer
valid.

So from now on, make CONFIG_DEBUG_RODATA default to 'y'

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-03-03 18:14:17 +00:00
Arnd Bergmann
c88f7e6a52 ARM64 defconfig changes for Exynos based boards for v4.6:
1. We want thermal for Exynos7 TMU unit to monitor the temperature.
 2. Enable the drivers for PMIC used on Exynos7-based Espresso board.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJW1VxBAAoJEME3ZuaGi4PXz/wP/1/mAzScizlcdGi7k1DmP7fZ
 9rsAiXYjIjxcI96L0qrEBCZFDdSwBv/pCRTuCg94FClFYBuW+IZmkTeWPHvtsB5O
 my4Xk3O5WEQbpFPUTZwl8yTlRSwlRdob7lGBFWuapqiCcws6l5xRffG1n6itqN32
 RTzLfeSAAj9zg94EX8UaNYcW9T0aIR/QGOIRXfziorACj5FdSiNvnXNwZBPj39ti
 X47h3BuLjCio0LPPSwNf4Z7XqenOX8z77Y8WTOi0WaRcnirdyjlOFTCLMCYvWIVw
 oih2xofdkDH+QsPOY1Qj96C6I1cUhqC3Z+fvz0PiPfk4Lit7hts+tdZ/8HBdX4V2
 tLodKxL7QowlrwbcRWn7i/MujiOTv6H0+OlJWucrOSFwmYqce8kNdyI/DIp5wNyS
 5NpfLX47SzL8sF4KnxdS8dvYrIT+mJUfuNAexNE44orwrm9AHbmTMNs1ZrGJd4Y7
 wlHg/q0m2lwhG8hvVUiDUwTwkljP1Z94zjJSGK0JMIlBwVbCEKNmBEJZv54RseMV
 47xDisM6RY1SWWx497vXaPcP42AivQn9a/rPJoaeEIsxJgQDTeHmbiCSWJYe43QD
 blKjwBb35QORnkc6tkBDOREFahF0uWVYS+7NOHcbDih2efb65rHAURzrnJIUBXTZ
 QR9mA4PxcR54BFs9RznS
 =T9z9
 -----END PGP SIGNATURE-----

Merge tag 'samsung-defconfig-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into next/arm64

Merge "ARM64 defconfig changes for Exynos based boards for v4.6" from Krzysztof Kozlowski:

1. We want thermal for Exynos7 TMU unit to monitor the temperature.
2. Enable the drivers for PMIC used on Exynos7-based Espresso board.

* tag 'samsung-defconfig-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux:
  arm64: defconfig: Enable Samsung MFD and related configs
  arm64: defconfig: Enable exynos thermal config
  ARM: multi_v7_defconfig: Remove MAX77802 RTC Kconfig symbol
  ARM: exynos_defconfig: Remove MAX77802 RTC Kconfig symbol
  rtc: max77686: Cleanup and reduce dmesg output
  rtc: Remove Maxim 77802 driver
  rtc: max77686: Properly handle regmap_irq_get_virq() error code
  rtc: max77686: Fix unsupported year message
  rtc: max77686: Add max77802 support
  rtc: max77686: Add an indirection level to access RTC registers
  rtc: max77686: Use a driver data struct instead hard-coded values
  rtc: max77686: Use usleep_range() instead of msleep()
  rtc: max77686: Use ARRAY_SIZE() instead of current array length
  rtc: max77686: Fix max77686_rtc_read_alarm() return value
  ARM: exynos_defconfig: Enable s5p-secss driver
  ARM: exynos_defconfig: Enable NEON, accelerated crypto and cpufreq stats

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2016-03-02 23:15:48 +01:00
Arnd Bergmann
720721b5de The NXP/Freescale arm64 dts update for 4.6:
- Add "snps,quirk-frame-length-adjustment" property to USB3 node for
   erratum A009116, which affects NXP/Freescale arm64 SoCs LS1043A and
   LS2080A.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJW1ah2AAoJEFBXWFqHsHzO5PAIAIQAzPOkr2W9BR+iR316MWca
 udc8pgQZakiHXsD+3HT9H0PYX55v9PTmgAtQrtsJFHdpH/CYP/bu/WOox5eT+gYw
 ia697PYxxXstXeyXSCX+wsPNsXFMSlKo8Xr3JyS+V+1kVHR30QWuBsIO7x5WePrS
 g1A5XDocZmMsSytItcYcY6DnEgf3psj+VbFhf5j32hN30MBq0eGfhchKqjBGCaHg
 28mlCBaPPhwizEmZsplfkbDr1dl0VVQSwUgYZUm0/hjDRFu67hr+x0exHhNkTop7
 RT9+4nsqm9Q5wBiKzkEetk8hebioGUKR4ilNwTu4psui7XIvP9s19yYZLi7bM3Q=
 =G1e+
 -----END PGP SIGNATURE-----

Merge tag 'imx-dt64-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into next/dt64

Merge "NXP/Freescale arm64 dts update for 4.6" from Shawn Guo:

- Add "snps,quirk-frame-length-adjustment" property to USB3 node for
  erratum A009116, which affects NXP/Freescale arm64 SoCs LS1043A and
  LS2080A.

* tag 'imx-dt64-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  arm64: dts: ls1043a: Add quirk for Erratum A009116
  arm64: dts: ls2080a: Add quirk for Erratum A009116
2016-03-02 23:02:27 +01:00
Arnd Bergmann
3bbf58531f Qualcomm ARM64 Updates for v4.6
* Add MSM8996 support
 * Cleanups for MSM8916
 * Updates for APQ8016 SBC
 * Fixup pmic reg properties
 * Add RPMCC node for 8916
 * Add LPASS audio nodes
 * Add USB support on MSM8916
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJW1MPFAAoJEFKiBbHx2RXVdVUP/0OG6hYYbVm8ZjpVnl1OyL95
 XQBUB1nK1ZhsiPddkmAPVKybMWYS/ZGrBQO37MYi9oJpmyQMvKJojqvagbnmD6SB
 Mq9gb9WZp6uLjJSRT/aP5eJLxjkOJbojb7DaBCaqci+X4RKsPOVQK3LgTUkr9/qC
 yAuC8I/UWPY/PU3cvHZ8EAen+9nK5iXtBWuW5lGoAJG9IWgt3Nj8DRd2zS/7X0vn
 Yeq3FCPO8RBdYOlEopOw5ij9/+7Ytme0jpqP0P7q3yEaPNexp+EJXQNyU6wBmdH+
 5aozKIkjayRJQXZMB69hWgPZQAJ4csVU97K0WWdFtNyFhnAmBCgF9q18z1z1lkCp
 BnTk1+hw6jF39uBeGl2oQ3dVMHuSu8TLNWYEt8JLkW5HqaNSafsh0QxlK5loH/5d
 62753YeQM0i9eK08IBfn1dexlKpjoH0sUGVtGsr3ll853+h7gNpKnkHydanhNPE5
 5IuyxOwOmgglygCL27aplXN2PbGVbZ3LDv4Slcqdk5Cvgssa2ANOVBuQ20R/4cVu
 B/Eqdw94xuYUHTAMJpb1uYi+stwlpeghNyMU7hLhHwvtoA75ek4tdw7NVt7zA+7p
 WEzlLEwkwhY0IgZ88CAdGEMKHcjQgS7pBXkfZws519Zs+ONle9WWmo6I2/CyuCyd
 DkKi9TvBV7E13uSacy81
 =YweL
 -----END PGP SIGNATURE-----

Merge tag 'qcom-arm64-for-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux into next/dt64

Merge "Qualcomm ARM64 Updates for v4.6" from Andy Gross:

* Add MSM8996 support
* Cleanups for MSM8916
* Updates for APQ8016 SBC
* Fixup pmic reg properties
* Add RPMCC node for 8916
* Add LPASS audio nodes
* Add USB support on MSM8916

* tag 'qcom-arm64-for-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux: (24 commits)
  arm64: dts: qcom: Fix MPP's function used for LED control
  arm64: dts: qcom: fix usb digital voltage levels
  arm64: dts: qcom: apq8016-sbc: enable lpass on DB410c
  arm64: dts: qcom: add lpass node
  arm64: dts: qcom: add audio pinctrls
  arm64: dts: qcom: apq8016-sbc: add usb support
  arm64: dts: qcom: add manual pullup setting to otg.
  arm64: dts: qcom: msm8916: Add RPMCC DT node
  ARM64: dts: qcom: Remove size elements from pmic reg properties
  arm64: dts: msm8996: Add #power-domain-cells property
  arm64: dts: apq8016-sbc: Add real regulators and pinctrl for sdhc
  arm64: dts: apq8016-sbc: move sdhci node under soc node
  arm64: dts: apq8016-sbc: make 1.8v available on LS expansion
  arm64: dts: apq8016-sbc: add regulators support
  arm64: dts: qcom: add lable for smd rpm regulators
  arm64: dts: remove s2 regulator from smd regulators.
  arm64: dts: qcom: add correct drive strenght on cs pins
  arm64: dts: qcom: remove redundant spi cs pins from pinconf
  arm64: dts: apq8016-sbc: Add aliases to spi device.
  arm64: dts: Add L2 cache node to msm8916
  ...
2016-03-02 22:28:30 +01:00
Mark Rutland
dbd4d7ca56 arm64: Rework valid_user_regs
We validate pstate using PSR_MODE32_BIT, which is part of the
user-provided pstate (and cannot be trusted). Also, we conflate
validation of AArch32 and AArch64 pstate values, making the code
difficult to reason about.

Instead, validate the pstate value based on the associated task. The
task may or may not be current (e.g. when using ptrace), so this must be
passed explicitly by callers. To avoid circular header dependencies via
sched.h, is_compat_task is pulled out of asm/ptrace.h.

To make the code possible to reason about, the AArch64 and AArch32
validation is split into separate functions. Software must respect the
RES0 policy for SPSR bits, and thus the kernel mirrors the hardware
policy (RAZ/WI) for bits as-yet unallocated. When these acquire an
architected meaning writes may be permitted (potentially with additional
validation).

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-03-02 15:49:28 +00:00
Ard Biesheuvel
6d2aa549de arm64: mm: check at build time that PAGE_OFFSET divides the VA space evenly
Commit 8439e62a15 ("arm64: mm: use bit ops rather than arithmetic in
pa/va translations") changed the boundary check against PAGE_OFFSET from
an arithmetic comparison to a bit test. This means we now silently assume
that PAGE_OFFSET is a power of 2 that divides the kernel virtual address
space into two equal halves. So make that assumption explicit.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-03-02 09:45:52 +00:00
Paolo Bonzini
2b097e9bc3 KVM/ARM fixes for 4.5-rc7
- Fix ioctl error handling on the timer path
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJW1byRAAoJECPQ0LrRPXpDXdoQAIh1BNeIxUhC58UrydqZ6wjw
 o+mLrQwTAVN3FBprAH/63NHwcBhq+i1G3vjfz4KoKc4KNe+48bGqvMKK1KktHfDf
 txOCl7va2sz1xbvY36oNw/OpHUpTMQBDYfq2SxxqXDTOnz6I+mdqxbCH+NZs0GyR
 AR1/XB0C++5GaRS4WqPb/v539Fj4MRLrFjz0GQJxmhzWJkP0uil87vLsQspWxoAX
 f1VcqJujC/BFCNNGoKi4h7BG7YaIM6EEHBFZRa9MsxpGElsxDGJug/qRfycRMuSf
 HIZJGh8EbM7ff9diPRTyk1aO3vFxlb+Q40VR6P+/BGvxnulOZCFaJX9987/LlHtS
 Sdk99rDY530qZTrF/yy7syNQhj4yb6K24LA6ADbWbtCW+WNQHaqAEDWwpEPpBvdu
 xwIRcxND9kUbbyA+f9IPhePHnTl5OXcclv+3CBSlGGCQSXXve214wBs36W4hKs8X
 VEXTij2FfHtSCJG5kPPpezx5wuDtzrdW5wKmWNN22dVey0CfQLa3WkcwhvhgbLpk
 qtp9j7/GcVDj42bqvXwfo8RBibZQW7PHCUynBmrcFkk4IZ6MiMAnkpe6s9fYD36i
 UrDfMSwwtyDDct0Piu9GL/qVaMU6LeGkSBC/Rz60xzIScpYGk/sDHNw+avaNvs21
 PU9hWF58rPjK1fdKnZ1U
 =9wEl
 -----END PGP SIGNATURE-----

Merge tag 'kvm-arm-for-4.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master

KVM/ARM fixes for 4.5-rc7

- Fix ioctl error handling on the timer path
2016-03-02 10:31:30 +01:00
Thomas Gleixner
fc6d73d674 arch/hotplug: Call into idle with a proper state
Let the non boot cpus call into idle with the corresponding hotplug state, so
the hotplug core can handle the further bringup. That's a first step to
convert the boot side of the hotplugged cpus to do all the synchronization
with the other side through the state machine. For now it'll only start the
hotplug thread and kick the full bringup of the cpu.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arch@vger.kernel.org
Cc: Rik van Riel <riel@redhat.com>
Cc: Rafael Wysocki <rafael.j.wysocki@intel.com>
Cc: "Srivatsa S. Bhat" <srivatsa@mit.edu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Turner <pjt@google.com>
Link: http://lkml.kernel.org/r/20160226182341.614102639@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2016-03-01 20:36:57 +01:00
Marc Zyngier
22b39ca3f2 arm64: KVM: Move kvm_call_hyp back to its original localtion
In order to reduce the risk of a bad merge, let's move the new
kvm_call_hyp back to its original location in the file. This has
zero impact from a code point of view.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-03-01 13:49:51 +00:00
Alim Akhtar
6bb8371893 arm64: defconfig: Enable Samsung MFD and related configs
Exynos7 based espresso board uses S2MPS15, a multifunction device.
This patch enables S2MPS1X regulator, pmic-clk and rtc drivers utilized by
the same.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2016-03-01 17:55:03 +09:00
Arnd Bergmann
44563cb452 Second part of X-Gene DT changes queued for v4.6
This patch set includes:
 + X-Gene v2 Mailbox DT node
 + X-Gene v1 and X-Gene v2 SLIMpro Mailbox
 I2C driver DT nodes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWz6/MAAoJEB11UG/BVQ/gguIP+wRLpObAPih/u3qgscGTv7GV
 dn3vD0w877jC6LX1umNf98ToCR7HBQ0GRsUYTb2lF/yH2W4yTACONOS7wMa3ofTb
 aF3RG7NXoJuiVnvqjNkhnEHYhxhvP+fM8LLbC5obtFyShcPlctJvCKNzCe9ccMqp
 WlgW2zGal3hcWdREu1f/9T1+ZA9IFbX6VsMD/f3WMAoYJh9av1dkcDsdGnSXIvI5
 Fb2wqEwnoXXVX3RRj22QoeYpX23/wAgrqrnhwi2LjlV6dzXND5eAicYP1cjlK6EY
 vpcXiUf47Gis8qyc9MiG6+V3Y9q4Y3V6vfIbO7sEGgnqphCZStcRPB4ownOLUlrD
 v6nN/iU2NPNf9XxGboRtJ/qk/E2zyvKLmlAZfibWjivWYQGh2EXvi8NPEowuoEaf
 PU6mezHMdBv3ZX02tzmoNdYMRiuh5MMzFNkGgC7Y3Q+bXxJKbyg+2G4OjGd1TTxb
 VI63mtSdVw/6koOevioH7Q/R0G6W/QkJ3ushg1G/PRCG6Pblp6vZ2Cy/mU1IcZCp
 WHN1QHiCfnlhwOrbBoal8V4l7cWchWm9Q2axdApngtibTviMrlDlAmPm8T1ZjLW3
 mhtkmF/CbSi43/bRjha/t4jUnZ8bYohfDYPcgmV9rB4+u8URerXvVFFqpD45aZr0
 +To8Wj9figTngxxaMdME
 =SF0o
 -----END PGP SIGNATURE-----

Merge tag 'xgene-dts-for-v4.6-part2' of https://github.com/AppliedMicro/xgene-next into next/dt64

Merge "Second part of X-Gene DT changes queued for v4.6" from Duc Dang:

This patch set includes:
+ X-Gene v2 Mailbox DT node
+ X-Gene v1 and X-Gene v2 SLIMpro Mailbox
I2C driver DT nodes

* tag 'xgene-dts-for-v4.6-part2' of https://github.com/AppliedMicro/xgene-next:
  arm64: dts: apm: Add DT node for X-Gene v2 SLIMpro Mailbox I2C Driver
  arm64: dts: apm: Mailbox device tree node for APM X-Gene v2 platform.
  arm64: dts: apm: Add DT node for X-Gene v1 SLIMpro Mailbox I2C Driver
  arm64: dts: apm: mailbox device tree node for APM X-Gene platform.
2016-03-01 00:40:58 +01:00
Arnd Bergmann
1c268a8911 First part of X-Gene DT changes queued for v4.6
This patch set includes:
 + A change in compatible string of X-Gene v2 SoC
 PLL DT node to reflect the v2 hardware
 + Update DT fields for X-Gene v1 and v2 standby
 GPIO controllers
 + Update declaration of power button GPIO for
 X-Gene v1 and X-Gene v2 platforms
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWz64GAAoJEB11UG/BVQ/gv9EQAInTeIVKnzsmUwBrP0EKxq3H
 T1scbrUMhRsOfCQc04xJFt35c684IdvI9chVMtIe1QZZaDQYRbfj/TjZxqOZRxSw
 /gU/QnFM2R6G41Pnu8UxFFp1oMJGob8mcDKFgmNa30+a9Qsd0mXt0q9qjtTIwlCK
 pg3vvpiAUlqBlREel8ahhF+NZ9k/ubMVa8NQGyLridpDtm27J6eCe3zWCX7WhQY/
 lqIVUiCtpb3lNRxaV1zgzlmci1r24pdUKc46GkswxlAdrHwtqZY/AQkdkuhZdQ3t
 0JM1x3/TI6MmQk7nRYVlYV7W/yhQotyMm+o1csO4I/Jk6SNpUVGLHF5BtfMaNXT9
 bEz42gq+3qUn6m9NI7afjokfXNpH9mnfpAzP9ckuHFU2uG23cNXM1ciXFV4b6r07
 Vep7eAS6/cOTsWkYKQ0vkOzz7H279oAtyZ5FMubx7xX+GLRsoKDOfvJOL5fFhLoo
 vJ3+0AxQQ1EAYfGVj3b5Q9mKsCdVKZro6e41WAzZCwDNwE7siz7PpCXRkJuUrOJR
 wlkQVbu/gH0G82MzZjMlzwqGP5+kWeipgUKJecqw2wwaClMeH7268pw8ffvDAnCh
 pFRGqEo1xfLiLbwUny9Wnoa5/PnRD4yDstq2x/6Rf5sxFIrs7JG5R6ZbNtEagSAO
 fChptrHeqEB3Mkxtw3oU
 =ASg+
 -----END PGP SIGNATURE-----

Merge tag 'xgene-dts-for-v4.6-part1' of https://github.com/AppliedMicro/xgene-next into next/dt64

Merge "First part of X-Gene DT changes queued for v4.6" from Duc Dang:

This patch set includes:
+ A change in compatible string of X-Gene v2 SoC
PLL DT node to reflect the v2 hardware
+ Update DT fields for X-Gene v1 and v2 standby
GPIO controllers
+ Update declaration of power button GPIO for
X-Gene v1 and X-Gene v2 platforms

* tag 'xgene-dts-for-v4.6-part1' of https://github.com/AppliedMicro/xgene-next:
  arm64: dts: apm: Update GPIO to control power-off on X-Gene v2 platforms
  arm64: dts: apm: Update GPIO standby controller DT node for X-Gene v2 platforms
  arm64: dts: apm: Update GPIO to control power-off on X-Gene v1 platforms
  arm64: dts: apm: Update X-Gene standby GPIO controller DTS entries
  arm64: dts: apm: Update Merlin DT PCP PLL clock node for v2 hardware
2016-03-01 00:36:51 +01:00
Arnd Bergmann
31cf19a14c ARM64: Hip05: configure updates for 4.6
- Enable DesignWare APB GPIO controller
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWzwAUAAoJEAvIV27ZiWZc4wEP/A4Db26IUU5PLeTCmb6edkGU
 CASTFqNV/jYKJuCGGX3YJ+o0f75xrPFbAl2P7K8/7pkU/St2bSQqHSi4OWS662/j
 zOlHhZn3O60OE6ezfrAHwPUpIIPuhGDbzlbPpc9uV0nc+CfpCzk7Htg3W6vrJXCf
 VxS+l0j4Q63u1iqryFtR/SBOiCJcGJOwDv4H+WEH0wMIjd86CQQfRyb75JmlVkIr
 4gH2vSuqAB6qKtkjvLfMeW2Dki6RrXB4KYRVnYZvvPOmdMcU41tCpo05AUFN4YNh
 S23RdIMbvywpyDtla1VR0dJCgTrz0Mmzc5uIejl23gzJNG8DWYuupyd2c9e3uhAp
 ndIuKWe7ji7FwRn+Q5Mpt2LWZV6EKxry96U2Q8mR5vYV8jGvAVT6cUkEVVN4HiAN
 eigljttTQy8+l2h1joJzj63leVihAFx32L5jS9ejDClQBRWd8MOzFKCJn8J3QQ39
 2zFEHQRXPlZZi5wsy1KX4lV5HHUW7ENhepMN4tAdaUaeG6tzZxkI0CaBdJI+ZksY
 b2CdShWtFgAyPnZHeMRtHhFXNepokT8cd3Sx/AqUfYU9VKDsyBvq1hkoympVYm2T
 Yk9DXvaYDXwbdZvVwGUTi5BKzylS3L43lTCO+MT3z3PXs0kPZbiRBYDlJJY0x4ZI
 tQD/PMrg4z+Tjd8JSGAK
 =GbzW
 -----END PGP SIGNATURE-----

Merge tag 'hip05-config-for-4.6' of git://github.com/hisilicon/linux-hisi into next/arm64

ARM64: Hip05: configure updates for 4.6

- Enable DesignWare APB GPIO controller

* tag 'hip05-config-for-4.6' of git://github.com/hisilicon/linux-hisi:
  arm64: defconfig: Enable DesignWare APB GPIO controller
2016-03-01 00:30:30 +01:00
Will Deacon
fe638401a0 arm64: perf: Extend ARMV8_EVTYPE_MASK to include PMCR.LC
Commit 7175f0591e ("arm64: perf: Enable PMCR long cycle counter bit")
added initial support for a 64-bit cycle counter enabled using PMCR.LC.

Unfortunately, that patch doesn't extend ARMV8_EVTYPE_MASK, so any
attempts to set the enable bit are ignored by armv8pmu_pmcr_write.

This patch extends the mask to include the new bit.

Signed-off-by: Will Deacon <will.deacon@arm.com>
2016-02-29 23:23:59 +00:00
Arnd Bergmann
047b2f6d7b ARM64: DT: Hisilicon Hip05 soc and D02 board updates for 4.6
- Add L2 cache topology
 - Use Cortex specific device node for pmu
 - Append all gicv3 ITS entries
 - Append gpio nodes
 - Append power button node for D02 board
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWzv94AAoJEAvIV27ZiWZcMAgP/2SURsSAQz1m9CabPD78gqPx
 R4PUtAbcrz8f5BbYxGXEXdoDY7AExvjWkZoH5XIP2+xDSB26SRgdkvAqisMYD7RU
 FG78LKJ7vYbAAiJtoqkcwG6GdvdyXYhw3HqCsyfT8cH+PFy4QgiDexrzFgSTh1Sv
 x1CG69ddLjg0Uc0LQx7JUmzdxsZN+jt8lfLCAU9zZBzsVAtxadrxcT/y/V1SXNMI
 sblknpv3I5XPDsQd1Sho0cLU7sGI2rWz5HqXTrW1febw6AMCTkmljZhbq4ezjQG0
 GtB20LiuM3hYtZoQDAUAb/plABhfQOZ0nybjqDhGxvyUb6vuNHHLicA7CsrWsYgE
 5T5KR2nZv3fnYFW1dprgrpuirUdBSk125p7gTwBFmcWv2fMcNKVZROkrjP6I0cwB
 Qu9sUa8jQ0oQqKkPa8KVtNZMRSVwAI+G0aeoJAbAV8Zs7ux4kzkaRZOiROxklWtI
 HFIiFsKmgPcenYbyrH6/b60/GIKIUQBdEN1kbPHSqF6zIt/IoLZhfAL5DHBMuwWE
 aP4mFxPaLUrSNpXGFmSMs737oatHK4lvb2Z1F9YOHXHQ20ttTKFWwQi0SMc1iLEf
 E/KDZedI6aud2DheDl9P7+w9JhFflHMlL0ZT3KWSn7pJ5qelTgxhGE7aPEc2hPXt
 ojSxNrtTqI8Vx7FJdK6C
 =IxPW
 -----END PGP SIGNATURE-----

Merge tag 'hip05-dt-for-4.6' of git://github.com/hisilicon/linux-hisi into next/dt64

Merge "ARM64: DT: Hisilicon Hip05 soc and D02 board updates for 4.6" from Wei Xu:

- Add L2 cache topology
- Use Cortex specific device node for pmu
- Append all gicv3 ITS entries
- Append gpio nodes
- Append power button node for D02 board

* tag 'hip05-dt-for-4.6' of git://github.com/hisilicon/linux-hisi:
  arm64: dts: hip05: Append power button node for D02 board
  arm64: dts: hip05: Append gpio nodes
  arm64: dts: hip05: Append all gicv3 ITS entries
  arm64: dts: hip05: Use Cortex specific device node for pmu
  arm64: dts: hip05: Add L2 cache topology
2016-03-01 00:22:23 +01:00
Arnd Bergmann
e5db3c6321 Allwinner configuration changes for ARM64, 4.6 edition
Not a lot of changes for this kernel release, just a new Kconfig option and
 some changes to the arm64 defconfig to add Allwinner drivers
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJW0J0XAAoJEBx+YmzsjxAgA1MP/0wYih4KBFguL+me5G7EaI1T
 AWwZQ2ONhUzLv3hXExOgJkorgIWtx6GdMvhvmsfbcIvuhuT+E8b5zclQnAECGXCl
 XC91kIsHIEk4U3q4a4UJuUkr+/30j/GKsV2cQwM8ag1RThx7Kk6/dznNQmpElp3f
 l/2LSUrFHctWnOWrauSFKzTVzb8Y1jZu/L/0odffkfLyzhBDL7ZvXNmQUCTKacxv
 lmOqGVeL79TPdR3AGkv/SPqSMAN2vjp9HLGHg75zi9ThxaouDGJ3+DGUg22Ss/G7
 NfOs+KFGJ8hjUU4AG5pm6o50AKBEaJ8y1EVe+B5YvVc9bburuot6MhvskYXIH32q
 bMyzf7IkulxnEMaePKFBasOqNW7PfvbV5jddh8CYIImAz6qwHY77uv1+OGJcyHFu
 xLbsta7/KZctW4NjsYb+Bew5aTj0Ntx/azZrm7QI+bJ1cutUODmefgO6NuNGKGgt
 oLi9ZS4u990J1HbPJhy3Er8mXrC01G06/H8FewA6RA37VRzLZnnKxOfOoJB7fhbK
 OmWRXVGz455KxP8u30TOK00ryxSBtCDmA85WojLoOvyhp9nHu5msP/KeCkrvLxev
 qkSTmEAzh3nOC2FtbxoqTjuRodTSvvO5RVYffUr4MtBX/4VGWoPbMDY0kUmEBQIb
 maqSKkZDccTkINrKAVPZ
 =xgyy
 -----END PGP SIGNATURE-----

Merge tag 'sunxi-config64-for-4.6' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into next/arm64

Merge "Allwinner configuration changes for ARM64, 4.6 edition" from Maxime Ripard:

Not a lot of changes for this kernel release, just a new Kconfig option and
some changes to the arm64 defconfig to add Allwinner drivers

* tag 'sunxi-config64-for-4.6' of https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux:
  arm64: add defconfig options for Allwinner SoCs
  arm64: Introduce Allwinner SoC config option
2016-03-01 00:06:24 +01:00
Arnd Bergmann
5f84a8efc4 mvebu arm64 for 4.6 (part 2)
Add initial support for Armada 7K/8K
 Update Marvell documentation
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAlbQXX4ACgkQCwYYjhRyO9V/HwCdF0ehY/nvq3czV19MjuG6ZZGL
 IUIAn3bzCXq/AB42cd8heU9NDUSzNVpi
 =1eah
 -----END PGP SIGNATURE-----

Merge tag 'mvebu-arm64-4.6-2' of git://git.infradead.org/linux-mvebu into next/arm64

Merge "mvebu arm64 for 4.6 (part 2)" from Gregory CLEMENT:

Add initial support for Armada 7K/8K
Update Marvell documentation

* tag 'mvebu-arm64-4.6-2' of git://git.infradead.org/linux-mvebu:
  arm64: update ARCH_MVEBU for Marvell Armada 7K/8K support
  Documentation: arm: add Marvell Armada 7K and 8K families
  Documentation: arm: add link to Armada 38x Functional Spec
  Documentation: arm: improve Armada 37xx description
  Documentation: arm: update Marvell product listing
2016-03-01 00:01:31 +01:00
Ivan T. Ivanov
4bd40f6ceb arm64: dts: qcom: Fix MPP's function used for LED control
The qcom-spmi-mpp driver is now using string "digital" to denote
old "normal" functionality. Update DTS file.
Also update the powersource.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
2016-02-29 16:17:45 -06:00
Marc Zyngier
623eefa8d0 arm64: KVM: Switch the sys_reg search to be a binary search
Our 64bit sys_reg table is about 90 entries long (so far, and the
PMU support is likely to increase this). This means that on average,
it takes 45 comparaisons to find the right entry (and actually the
full 90 if we have to search the invariant table).

Not the most efficient thing. Specially when you think that this
table is already sorted. Switching to a binary search effectively
reduces the search to about 7 comparaisons. Slightly better!

As an added bonus, the comparison is done by comparing all the
fields at once, instead of one at a time.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:22 +00:00
Shannon Zhao
bb0c70bcca arm64: KVM: Add a new vcpu device control group for PMUv3
To configure the virtual PMUv3 overflow interrupt number, we use the
vcpu kvm_device ioctl, encapsulating the KVM_ARM_VCPU_PMU_V3_IRQ
attribute within the KVM_ARM_VCPU_PMU_V3_CTRL group.

After configuring the PMUv3, call the vcpu ioctl with attribute
KVM_ARM_VCPU_PMU_V3_INIT to initialize the PMUv3.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:21 +00:00
Shannon Zhao
f577f6c2a6 arm64: KVM: Introduce per-vcpu kvm device controls
In some cases it needs to get/set attributes specific to a vcpu and so
needs something else than ONE_REG.

Let's copy the KVM_DEVICE approach, and define the respective ioctls
for the vcpu file descriptor.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:21 +00:00
Shannon Zhao
808e738142 arm64: KVM: Add a new feature bit for PMUv3
To support guest PMUv3, use one bit of the VCPU INIT feature array.
Initialize the PMU when initialzing the vcpu with that bit and PMU
overflow interrupt set.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:21 +00:00
Shannon Zhao
2aa36e9840 arm64: KVM: Reset PMU state when resetting vcpu
When resetting vcpu, it needs to reset the PMU state to initial status.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:21 +00:00
Shannon Zhao
d692b8ad6e arm64: KVM: Add access handler for PMUSERENR register
This register resets as unknown in 64bit mode while it resets as zero
in 32bit mode. Here we choose to reset it as zero for consistency.

PMUSERENR_EL0 holds some bits which decide whether PMU registers can be
accessed from EL0. Add some check helpers to handle the access from EL0.

When these bits are zero, only reading PMUSERENR will trap to EL2 and
writing PMUSERENR or reading/writing other PMU registers will trap to
EL1 other than EL2 when HCR.TGE==0. To current KVM configuration
(HCR.TGE==0) there is no way to get these traps. Here we write 0xf to
physical PMUSERENR register on VM entry, so that it will trap PMU access
from EL0 to EL2. Within the register access handler we check the real
value of guest PMUSERENR register to decide whether this access is
allowed. If not allowed, return false to inject UND to guest.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:21 +00:00
Shannon Zhao
76993739cd arm64: KVM: Add helper to handle PMCR register bits
According to ARMv8 spec, when writing 1 to PMCR.E, all counters are
enabled by PMCNTENSET, while writing 0 to PMCR.E, all counters are
disabled. When writing 1 to PMCR.P, reset all event counters, not
including PMCCNTR, to zero. When writing 1 to PMCR.C, reset PMCCNTR to
zero.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:21 +00:00
Shannon Zhao
7a0adc7064 arm64: KVM: Add access handler for PMSWINC register
Add access handler which emulates writing and reading PMSWINC
register and add support for creating software increment event.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:20 +00:00
Shannon Zhao
76d883c4e6 arm64: KVM: Add access handler for PMOVSSET and PMOVSCLR register
Since the reset value of PMOVSSET and PMOVSCLR is UNKNOWN, use
reset_unknown for its reset handler. Add a handler to emulate writing
PMOVSSET or PMOVSCLR register.

When writing non-zero value to PMOVSSET, the counter and its interrupt
is enabled, kick this vcpu to sync PMU interrupt.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:20 +00:00
Shannon Zhao
9db52c78cd arm64: KVM: Add access handler for PMINTENSET and PMINTENCLR register
Since the reset value of PMINTENSET and PMINTENCLR is UNKNOWN, use
reset_unknown for its reset handler. Add a handler to emulate writing
PMINTENSET or PMINTENCLR register.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:20 +00:00
Shannon Zhao
9feb21ac57 arm64: KVM: Add access handler for event type register
These kind of registers include PMEVTYPERn, PMCCFILTR and PMXEVTYPER
which is mapped to PMEVTYPERn or PMCCFILTR.

The access handler translates all aarch32 register offsets to aarch64
ones and uses vcpu_sys_reg() to access their values to avoid taking care
of big endian.

When writing to these registers, create a perf_event for the selected
event type.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:20 +00:00
Shannon Zhao
96b0eebcc6 arm64: KVM: Add access handler for PMCNTENSET and PMCNTENCLR register
Since the reset value of PMCNTENSET and PMCNTENCLR is UNKNOWN, use
reset_unknown for its reset handler. Add a handler to emulate writing
PMCNTENSET or PMCNTENCLR register.

When writing to PMCNTENSET, call perf_event_enable to enable the perf
event. When writing to PMCNTENCLR, call perf_event_disable to disable
the perf event.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:20 +00:00
Shannon Zhao
051ff581ce arm64: KVM: Add access handler for event counter register
These kind of registers include PMEVCNTRn, PMCCNTR and PMXEVCNTR which
is mapped to PMEVCNTRn.

The access handler translates all aarch32 register offsets to aarch64
ones and uses vcpu_sys_reg() to access their values to avoid taking care
of big endian.

When reading these registers, return the sum of register value and the
value perf event counts.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:20 +00:00
Shannon Zhao
a86b550530 arm64: KVM: Add access handler for PMCEID0 and PMCEID1 register
Add access handler which gets host value of PMCEID0 or PMCEID1 when
guest access these registers. Writing action to PMCEID0 or PMCEID1 is
UNDEFINED.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:19 +00:00
Shannon Zhao
3965c3ce75 arm64: KVM: Add access handler for PMSELR register
Since the reset value of PMSELR_EL0 is UNKNOWN, use reset_unknown for
its reset handler. When reading PMSELR, return the PMSELR.SEL field to
guest.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:19 +00:00
Shannon Zhao
ab9468340d arm64: KVM: Add access handler for PMCR register
Add reset handler which gets host value of PMCR_EL0 and make writable
bits architecturally UNKNOWN except PMCR.E which is zero. Add an access
handler for PMCR.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:19 +00:00
Shannon Zhao
04fe472615 arm64: KVM: Define PMU data structure for each vcpu
Here we plan to support virtual PMU for guest by full software
emulation, so define some basic structs and functions preparing for
futher steps. Define struct kvm_pmc for performance monitor counter and
struct kvm_pmu for performance monitor unit for each vcpu. According to
ARMv8 spec, the PMU contains at most 32(ARMV8_PMU_MAX_COUNTERS)
counters.

Since this only supports ARM64 (or PMUv3), add a separate config symbol
for it.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:19 +00:00
Marc Zyngier
ad88213773 arm64: KVM: Add temporary kvm_perf_event.h
In order to merge the KVM/ARM PMU patches without creating a
conflict mess, let's have a temporary include file that won't
conflict with anything. Subsequent patches will clean that up.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:19 +00:00
Marc Zyngier
21a4179ce0 arm64: KVM: Move __cpu_init_stage2 after kvm_call_hyp
In order to ease the merge with the rest of the arm64 tree, move the
definition of __cpu_init_stage2() after what will be the new kvm_call_hyp.
Hopefully the resolution of the merge conflict will be obvious.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:19 +00:00
Marc Zyngier
6d50d54cd8 arm64: KVM: Move vgic-v2 and timer save/restore to virt/kvm/arm/hyp
We already have virt/kvm/arm/ containing timer and vgic stuff.
Add yet another subdirectory to contain the hyp-specific files
(timer and vgic again).

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:18 +00:00
Marc Zyngier
13720a56ed arm64: KVM: Move kvm/hyp/hyp.h to include/asm/kvm_hyp.h
In order to be able to move code outside of kvm/hyp, we need to make
the global hyp.h file accessible from a standard location.

include/asm/kvm_hyp.h seems good enough.

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:18 +00:00
Marc Zyngier
1f364c8c48 arm64: VHE: Add support for running Linux in EL2 mode
With ARMv8.1 VHE, the architecture is able to (almost) transparently
run the kernel at EL2, despite being written for EL1.

This patch takes care of the "almost" part, mostly preventing the kernel
from dropping from EL2 to EL1, and setting up the HYP configuration.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:18 +00:00
Marc Zyngier
ae7e27fe68 arm64: hw_breakpoint: Allow EL2 breakpoints if running in HYP
With VHE, we place kernel {watch,break}-points at EL2 to get things
like kgdb and "perf -e mem:..." working.

This requires a bit of repainting in the low-level encore/decode,
but is otherwise pretty simple.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:18 +00:00
Marc Zyngier
d98ecdaca2 arm64: perf: Count EL2 events if the kernel is running in HYP
When the kernel is running in HYP (with VHE), it is necessary to
include EL2 events if the user requests counting kernel or
hypervisor events.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:18 +00:00
Marc Zyngier
5f05a72aed arm64: KVM: Move most of the fault decoding to C
The fault decoding process (including computing the IPA in the case
of a permission fault) would be much better done in C code, as we
have a reasonable infrastructure to deal with the VHE/non-VHE
differences.

Let's move the whole thing to C, including the workaround for
erratum 834220, and just patch the odd ESR_EL2 access remaining
in hyp-entry.S.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:18 +00:00
Marc Zyngier
253dcbd39a arm64: KVM: VHE: Add alternative panic handling
As the kernel fully runs in HYP when VHE is enabled, we can
directly branch to the kernel's panic() implementation, and
not perform an exception return.

Add the alternative code to deal with this.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:18 +00:00
Marc Zyngier
77cb2d9133 arm64: KVM: VHE: Add fpsimd enabling on guest access
Despite the fact that a VHE enabled kernel runs at EL2, it uses
CPACR_EL1 to trap FPSIMD access. Add the required alternative
code to re-enable guest FPSIMD access when it has trapped to
EL2.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:17 +00:00
Marc Zyngier
5efe6de138 arm64: KVM: VHE: Use unified sysreg accessors for timer
Switch the timer code to the unified sysreg accessors.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:17 +00:00
Marc Zyngier
68908bf789 arm64: KVM: VHE: Implement VHE activate/deactivate_traps
Running the kernel in HYP mode requires the HCR_E2H bit to be set
at all times, and the HCR_TGE bit to be set when running as a host
(and cleared when running as a guest). At the same time, the vector
 must be set to the current role of the kernel (either host or
hypervisor), and a couple of system registers differ between VHE
and non-VHE.

We implement these by using another set of alternate functions
that get dynamically patched.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:17 +00:00
Marc Zyngier
328762247c arm64: KVM: VHE: Make __fpsimd_enabled VHE aware
As non-VHE and VHE have different ways to express the trapping of
FPSIMD registers to EL2, make __fpsimd_enabled a patchable predicate
and provide a VHE implementation.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:17 +00:00
Marc Zyngier
d1526e5efc arm64: KVM: VHE: Enable minimal sysreg save/restore
We're now in a position where we can introduce VHE's minimal
save/restore, which is limited to the handful of shared sysregs.

Add the required alternative function calls that result in a
"do nothing" call on VHE, and the normal save/restore for non-VHE.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:17 +00:00
Marc Zyngier
094f8233c0 arm64: KVM: VHE: Use unified system register accessors
Use the recently introduced unified system register accessors for
those sysregs that behave differently depending on VHE being in
use or not.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:17 +00:00
Marc Zyngier
9c6c356832 arm64: KVM: VHE: Split save/restore of registers shared between guest and host
A handful of system registers are still shared between host and guest,
even while using VHE (tpidr*_el[01] and actlr_el1).

Also, some of the vcpu state (sp_el0, PC and PSTATE) must be
save/restored on entry/exit, as they are used on the host as well.

In order to facilitate the introduction of a VHE-specific sysreg
save/restore, make move the access to these registers to their
own save/restore functions.

No functional change.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:17 +00:00
Marc Zyngier
edef528dc4 arm64: KVM: VHE: Differenciate host/guest sysreg save/restore
With ARMv8, host and guest share the same system register file,
making the save/restore procedure completely symetrical.
With VHE, host and guest now have different requirements, as they
use different sysregs.

In order to prepare for this, add split sysreg save/restore functions
for both host and guest. No functional changes yet.

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:16 +00:00
Marc Zyngier
915ccd1dbf arm64: KVM: VHE: Introduce unified system register accessors
VHE brings its own bag of new system registers, or rather system
register accessors, as it define new ways to access both guest
and host system registers. For example, from the host:

- The host TCR_EL2 register is accessed using the TCR_EL1 accessor
- The guest TCR_EL1 register is accessed using the TCR_EL12 accessor

Obviously, this is confusing. A way to somehow reduce the complexity
of writing code for both ARMv8 and ARMv8.1 is to use a set of unified
accessors that will generate the right sysreg, depending on the mode
the CPU is running in. For example:

- read_sysreg_el1(tcr) will use TCR_EL1 on ARMv8, and TCR_EL12 on
  ARMv8.1 with VHE.
- read_sysreg_el2(tcr) will use TCR_EL2 on ARMv8, and TCR_EL1 on
  ARMv8.1 with VHE.

We end up with three sets of accessors ({read,write}_sysreg_el[012])
that can be directly used from C code. We take this opportunity to
also add the definition for the new VHE sysregs.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:16 +00:00
Marc Zyngier
cedbb8b78c arm64: KVM: VHE: Patch out kern_hyp_va
The kern_hyp_va macro is pretty meaninless with VHE, as there is
only one mapping - the kernel one.

In order to keep the code readable and efficient, use runtime
patching to replace the 'and' instruction used to compute the VA
with a 'nop'.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:16 +00:00
Marc Zyngier
b81125c791 arm64: KVM: VHE: Patch out use of HVC
With VHE, the host never issues an HVC instruction to get into the
KVM code, as we can simply branch there.

Use runtime code patching to simplify things a bit.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:16 +00:00
Marc Zyngier
d88701bea3 arm64: Add ARM64_HAS_VIRT_HOST_EXTN feature
Add a new ARM64_HAS_VIRT_HOST_EXTN features to indicate that the
CPU has the ARMv8.1 VHE capability.

This will be used to trigger kernel patching in KVM.

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:16 +00:00
Marc Zyngier
82deae0fc8 arm/arm64: Add new is_kernel_in_hyp_mode predicate
With ARMv8.1 VHE extension, it will be possible to run the kernel
at EL2 (aka HYP mode). In order for the kernel to easily find out
where it is running, add a new predicate that returns whether or
not the kernel is in HYP mode.

For completeness, the 32bit code also get such a predicate (always
returning false) so that code common to both architecture (timers,
KVM) can use it transparently.

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:16 +00:00
Marc Zyngier
3a3604bc5e arm64: KVM: Switch to C-based stage2 init
There is no real need to leave the stage2 initialization as part
of the early HYP bootstrap, and we can easily postpone it to
the point where we can safely run C code.

This will help VHE, which doesn't need any of this bootstrap.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:15 +00:00
Marc Zyngier
57c841f131 arm/arm64: KVM: Handle out-of-RAM cache maintenance as a NOP
So far, our handling of cache maintenance by VA has been pretty
simple: Either the access is in the guest RAM and generates a S2
fault, which results in the page being mapped RW, or we go down
the io_mem_abort() path, and nuke the guest.

The first one is fine, but the second one is extremely weird.
Treating the CM as an I/O is wrong, and nothing in the ARM ARM
indicates that we should generate a fault for something that
cannot end-up in the cache anyway (even if the guest maps it,
it will keep on faulting at stage-2 for emulation).

So let's just skip this instruction, and let the guest get away
with it.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:15 +00:00
Marc Zyngier
42428525a9 ARM: KVM: Remove __kvm_hyp_code_start/__kvm_hyp_code_end
Now that we've unified the way we refer to the HYP text between
arm and arm64, drop __kvm_hyp_code_start/end, and just use the
__hyp_text_start/end symbols.

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:12 +00:00
Marc Zyngier
35a2491a62 arm/arm64: KVM: Add hook for C-based stage2 init
As we're about to move the stage2 init to C code, introduce some
C hooks that will later be populated with arch-specific implementations.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 18:34:12 +00:00
Ard Biesheuvel
020d044f66 arm64: mm: treat memstart_addr as a signed quantity
Commit c031a4213c ("arm64: kaslr: randomize the linear region")
implements randomization of the linear region, by subtracting a random
multiple of PUD_SIZE from memstart_addr. This causes the virtual mapping
of system RAM to move upwards in the linear region, and at the same time
causes memstart_addr to assume a value which may be negative if the offset
of system RAM in the physical space is smaller than its offset relative to
PAGE_OFFSET in the virtual space.

Since memstart_addr is effectively an offset now, redefine its type as s64
so that expressions involving shifting or division preserve its sign.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-29 18:31:03 +00:00
Ard Biesheuvel
a6e1f7273b arm64: mm: list kernel sections in order
In the boot log, instead of listing .init first, list .text, .rodata,
.init and .data in the same order they appear in memory

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-29 17:15:44 +00:00
Arnd Bergmann
9b1c124dd4 Second Round of Renesas ARM64 Based SoC DT Updates for v4.6
Updates for r8a7795/salvator-x
 * Enable USB2.0, and SDHI0 & 3
 * Add GIC-400 virtual interfaces
 * Add INTC-EX and L2 cache-controller nodes
 * Use fallback etheravb compatibility string
 * Use GIC_* defines where appropriate
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWz5bjAAoJENfPZGlqN0++pVAP/2RqxDbfPf8/yNW9Aj9pkWFw
 W8t+IVzgee2z9lKn+LFHoYG3qyPj4ND3TQlxPrdpdOitEazqW2q2Lq4eUmeEdlj5
 WVguxgZYrrvS2JhFmkNill5geape6E6jCs7o1PGrMeQVA7ZROJzc+MdFpk52IlFy
 zlsBM1mf7gAzIoePSaiu4i+lfg0rmmHh9ROgcSGHydP+GhCr4cyrCWVVG48SfblV
 cempegtv9H8uIfgdjmXAvsmjdBLzAt0nCWQXFnbiJn3fBC6sfV0dHMggESlYRO/k
 jTEipSFE3wtfefgXBaW8Q3/EHRf71gOwmg/eUcZoSho9tsf9On/bnL2B68ifmgH5
 wV5H905VumIsZjaBMnYj9IvaTEp9appoQOuycH46fMeDOhZO1yKnwUWRdvBjLGA/
 dcwcwj/5qWveUHUapvxFcA80H53UCqGtYro1TpQuSmRY13i2FlOYDpinYT0Krhd5
 nY3dd7CLtc8Px+Pvm+kh+8KGVEYZnwnZB8zhgUT4vaf0LDy69Az0wCDqV1BNKsLS
 OlkWC1yrXd3LR7vXsDdE7+R4N7DiK6QOHoxCDg0sjcB92BT1XtbdmGjhHyAFSiYV
 PA700YHXeUncLDWGbXD1pnF+CVYnZek0MZsD+WAswUl8Dh6czdGGO/hOpL4zMe8o
 PwCXB7G2/AeygeoPz6me
 =UlvA
 -----END PGP SIGNATURE-----

Merge tag 'renesas-arm64-dt2-for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/dt64

Merge "Second Round of Renesas ARM64 Based SoC DT Updates for v4.6"
from Simon Horman:

Updates for r8a7795/salvator-x
* Enable USB2.0, and SDHI0 & 3
* Add GIC-400 virtual interfaces
* Add INTC-EX and L2 cache-controller nodes
* Use fallback etheravb compatibility string
* Use GIC_* defines where appropriate

* tag 'renesas-arm64-dt2-for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas:
  arm64: dts: salvator-x: enable USB 2.0 Host of channel 1 and 2
  arm64: dts: salvator-x: enable usb2_phy of channel 1 and 2
  arm64: dts: r8a7795: add USB2.0 Host (EHCI/OHCI) device nodes
  arm64: dts: r8a7795: add usb2_phy device nodes
  arm64: dts: r8a7795: use fallback etheravb compatibility string
  arm64: dts: r8a7795: salvator-x: enable SDHI0 & 3
  arm64: dts: r8a7795: Add SDHI support to dtsi
  arm64: dts: r8a7795: Add GIC-400 virtual interfaces
  arm64: dts: r8a7795: Add INTC-EX device node
  arm64: dts: r8a7795: Add CA53 L2 cache-controller node
  arm64: dts: r8a7795: Add missing properties to CA57 L2 cache node
  arm64: dts: r8a7795: use GIC_* defines
  arm64: dts: r8a7795: pmu: switch to Cortex specific device nodes
  arm64: dts: r8a7795: Add L2 cache-controller nodes
2016-02-29 16:20:44 +01:00
Arnd Bergmann
e15cd209fc Renesas ARM64 Based SoC SoC Updates for v4.6
* Enable RENESAS_IRQC, and PM and PM_GENERIC_DOMAINS for SoCs with PM Domains
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWz41KAAoJENfPZGlqN0++6oEP/iyw9sgmi7DNIO/J2038qnD9
 tt9KQk5aEQ0M5CQMQ7KwIhSQfZ5ylBtJEH1Rk4gpmT64hzoVjEbbryjq4/t9N5y0
 Qe3h3ZOyu9096MeIIT/8IreKfn4l5YvvIpYMfB9lVNIuHnvln5ueG5rJEdid0vos
 11em67Sd1NO3Is6766vpsdQdAUOSdVTBTxkLBctYUdCX1jH1TBrxLpD0MXiajr72
 k1k+MpGAnDuuIPQoLk+uYOxTKvMT+3sSwo2a2dSgl4vzTPbUkrJpnQVczdPX9VaB
 D+eGUtRyCg5aW96FVtP4LV30weqPmYVYngzes3cRup6Nt18HLId4uJLmeDfGNZ9T
 qqolKNEVQbFWl7qlloxZ/y5Pb08Gm8T946q3rQzq4un6JGnqAxe6DddJwDFvkMX2
 0PE4Unh+4JD6QpozgSpboS5GAAsqUj8YVSoYrnGDlDUMMfhkiduBTTdduJcLrAUf
 X+1jKQ74wazGFeU7k5VHX3A3WujxPDMCzo6QqwkdMnq5GWt3Q+S7EhW65iFwUaer
 CNgldmzHJkhkNHld/LZ0SU0deihnIcSzr8ciSbw1HljH/RMWe9twLWpX297x3RyJ
 KWctkI8xH1l8MO03GMGZbE0LdViGf/Oj2x9qWnwWJZNRc2vz3hhvAEK2wwllFwB7
 vFHheKa6eX9OMiQC1L5g
 =Frkt
 -----END PGP SIGNATURE-----

Merge tag 'renesas-arm64-soc-for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/arm64

Merge "Renesas ARM64 Based SoC SoC Updates for v4.6" from Simon Horman:

* Enable RENESAS_IRQC, and PM and PM_GENERIC_DOMAINS for SoCs with PM Domains

* tag 'renesas-arm64-soc-for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas:
  arm64: renesas: Enable PM and PM_GENERIC_DOMAINS for SoCs with PM Domains
  arm64: renesas: Enable RENESAS_IRQC
2016-02-29 16:19:00 +01:00
Arnd Bergmann
107adb57f2 Renesas ARM64 Based SoC Defconfig Updates for v4.6
* Enable Renesas R-Car Gen3 USB 2.0 phy driver
   which is used on the r8a7795/salvator-x
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWz44hAAoJENfPZGlqN0++CfcQAKrBHaTuXZnf1LLEd968nb+M
 LWDTME1k9Z2lv8tGMMRIU7buSHvwPPd3EKJydnqdKwp7qqaZ0fqc4Veln+MXveZz
 cjQVDyrCt40Dw0ONZyiT1xkCLH0v3XwbHi9TXsHnHPUpJA3x6Q9q2xZe/L6EsVH7
 oqh+4AOnska8uyx3goQ35fuZbFF0uecReIVZXeSgEWzywQES2nmOL0/FWO1VcXAP
 Hd9oQ/1RgfIr11UFXo2AKcq2LFKG4iPiosmGh84XIXWSz+z8B8lDPo7xRrKEcepG
 DLpuNh4mqq9drzZ+vYLBNPcP/h0PDuZZsg7kFdxayogfgXTCq2L4HPwRGH96flu+
 RlBelxP2pGv2C8AgPh4FHIw6gYaEl79RtjT/b+nYY8Q5KB6UPVoGkCct1/M/8LEm
 34s2HqDMmXDDSoZDAti4JpPCRTu7Gv+W6WWdnQ7pXhXBaDu2Ide30tpawTzcWMkt
 v9QVsyeQOY+J3KNwz/uC9lUkJrGu5DIE7SwMb2C8Jvz732pki30lR/YQsKDO2cmn
 fnEU1Ke6P4dUC6UqTz6whnczGrI+gz5LV0lrIV8GtVaTN4/1bSfrhwrf3972y9W4
 IbMTgH1HpSopleWU/nhGO3IUsPalHicCLYetJk/CtGh2ZpoU8h8HkOhfC62AFoID
 DqMu3RIPcI0VDGpeXjSj
 =q6w4
 -----END PGP SIGNATURE-----

Merge tag 'renesas-arm64-defconfig-for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/arm64

Merge "Renesas ARM64 Based SoC Defconfig Updates for v4.6" from Simon Horman:

* Enable Renesas R-Car Gen3 USB 2.0 phy driver
  which is used on the r8a7795/salvator-x

* tag 'renesas-arm64-defconfig-for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas:
  arm64: defconfig: Add Renesas R-Car Gen3 USB 2.0 phy driver support
2016-02-29 16:17:30 +01:00
Michael S. Tsirkin
4cad67fca3 arm/arm64: KVM: Fix ioctl error handling
Calling return copy_to_user(...) in an ioctl will not
do the right thing if there's a pagefault:
copy_to_user returns the number of bytes not copied
in this case.

Fix up kvm to do
	return copy_to_user(...)) ?  -EFAULT : 0;

everywhere.

Cc: stable@vger.kernel.org
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-29 09:56:40 +00:00
Daniel Cashman
5ef11c35ce mm: ASLR: use get_random_long()
Replace calls to get_random_int() followed by a cast to (unsigned long)
with calls to get_random_long().  Also address shifting bug which, in
case of x86 removed entropy mask for mmap_rnd_bits values > 31 bits.

Signed-off-by: Daniel Cashman <dcashman@android.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: David S. Miller <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Nick Kralevich <nnk@google.com>
Cc: Jeff Vander Stoep <jeffv@google.com>
Cc: Mark Salyzyn <salyzyn@android.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-02-27 10:28:52 -08:00
Arnd Bergmann
ebb7c983b5 Merge tag 'arm-soc/for-4.6/soc-arm64' of http://github.com/Broadcom/stblinux into next/arm64
Merge "Broadcom soc-arm64 changes for 4.6" from Florian Fainelli:

This pull request contains Broadcom ARM64-based SoC/platform changes:

- Anup, Ray and Dhanajay enable COMMON_CLK_IPROC, PINCTRL and GPIOLIB for iProc
  SoCs to get the corresponding iProc-based drivers to be available and work

- Zi adds support for Broadcom's Vulcan processor by adding a reference
  board Device Tree file along with a config ARCH_VULCAN symbol

- Jayachandran C. adds the Broadcom implementor ID and part ID for the Vulcan
  processors

* tag 'arm-soc/for-4.6/soc-arm64' of http://github.com/Broadcom/stblinux:
  arm64: cputype info for Broadcom Vulcan
  arm64: Broadcom Vulcan support
  arm64: Select COMMON_CLK_IPROC, PINCTRL and GPIOLIB for iProc SoCs
2016-02-26 23:37:04 +01:00
Arnd Bergmann
f9098036af Merge tag 'arm-soc/for-4.6/defconfig-arm64' of http://github.com/Broadcom/stblinux into next/arm64
Merge "Broadcom defconfig-arm64 changes for 4.6" from Florian Fainelli:

This pull request contains ARM64 defconfig changes for Broadcom SoCs:

- Jayachandran C enables the newly introduced Broadcom Vulcan SoC to the ARM64
  defconfig

* tag 'arm-soc/for-4.6/defconfig-arm64' of http://github.com/Broadcom/stblinux:
  arm64: defconfig: Add Broadcom Vulcan to defconfig
2016-02-26 23:33:12 +01:00
Arnd Bergmann
55da9c0852 Merge tag 'arm-soc/for-4.6/devicetree-arm64' of http://github.com/Broadcom/stblinux into next/dt64
Merge "Broadcom devicetree-arm64 changes for 4.6" from Florian Fainelli:

This pull request contains Broadcom ARM64-based SoCs device tree changes:

- Anup adds additional nodes to the Broadcom Northstart 2 Device Trees: SDHCI
  (iProc-compatible), ARM SP804 timers, ARM SP805 watchdog

- Anup also adds a binding documentation for the ARM SP805 watchdog since there
  was not one in tree before

- Ray adds PCIE root complex nodes to the Northstar 2 Device Tree nodes, using
  the iProc-compatible binding

- Jayachandran C. adds binding documentation for the Broadcom Vulcan processors and
  reference platforms

* tag 'arm-soc/for-4.6/devicetree-arm64' of http://github.com/Broadcom/stblinux:
  dt-bindings: Add documentation for Broadcom Vulcan
  arm64: dts: Add PCIe0 and PCIe4 DT nodes for NS2
  arm64: dts: Add ARM SP805 watchdog DT node for NS2
  dt-bindings: watchdog: Add ARM SP805 DT bindings
  arm64: dts: Add ARM SP804 timer DT nodes for NS2
  arm64: dts: Add SDHCI DT node for NS2
2016-02-26 23:27:58 +01:00
Antoine Tenart
29de0e39aa arm64: dts: alpine: add the MSIX node in the Alpine v2 dtsi
Following the addition of the Alpine MSIX controller driver, add the
corresponding node in the Alpine v2 device tree.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Tsahee Zidenberg <tsahee@annapurnalabs.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2016-02-26 22:58:10 +01:00
Antoine Tenart
1c3554fa94 arm64: dts: add the Alpine v2 EVP
This patch adds the initial support for the Alpine v2 EVP board from
Annapurna Labs (Amazon).

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Barak Wasserstrom <barak@annapurnalabs.com>
Signed-off-by: Tsahee Zidenberg <tsahee@annapurnalabs.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2016-02-26 22:58:03 +01:00
Antoine Tenart
93df6d16af arm64: alpine: select the Alpine MSI controller driver
Select the Alpine MSI controller driver when using an Alpine platform.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Tsahee Zidenberg <tsahee@annapurnalabs.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2016-02-26 22:56:48 +01:00
Antoine Tenart
476cfc05f3 arm64: defconfig: enable the Alpine family
Enable the Alpine SoC family in the arm64 defconfig.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2016-02-26 22:56:31 +01:00