Commit Graph

2845 Commits

Author SHA1 Message Date
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
Antoine Tenart e2f0abaf45 arm64: add Alpine SoC family
This patch introduces ARCH_ALPINE to add the support of the Alpine SoC
family for the arm64 architecture.

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:22 +01:00
Arnd Bergmann 56c8b00fdb arm: Xilinx ZynqMP dt patches for v4.6
- Extract clock information from EP108
 - Sort GPIO node
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAlbO/SIACgkQykllyylKDCEL9QCfdcFczSmk3OWvubtp1/d7YoMs
 MhoAn33UBIqTGcmYgpRljfhWWStW1eRE
 =wlZ0
 -----END PGP SIGNATURE-----

Merge tag 'zynqmp-dt-for-4.6' of https://github.com/Xilinx/linux-xlnx into next/dt64

Merge "ARM: Xilinx ZynqMP dt patches for v4.6" from Michal Simek:

- Extract clock information from EP108
- Sort GPIO node

* tag 'zynqmp-dt-for-4.6' of https://github.com/Xilinx/linux-xlnx:
  ARM64: zynqmp: Extract clock information from EP108
  ARM64: zynqmp: Keep gpio node alphabetically sorted
2016-02-26 22:51:16 +01:00
Arnd Bergmann f6c7017c60 Add nor-flash to mt8173 SoC.
Add efuse device to mt1873 SoC.
 Fix power-domain issue mt8173-evb which uses older chip revision.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJWyuyIAAoJELQ5Ylss8dNDTCwP/0zxGGAFsulImbY/NBs1Ho8W
 uukfro+mAMDvJbzV8qgNU4knBLMryPWMp/RGXVwNb2EPCazf8vxGQOy9+hNh19mF
 01CLqs0T3HVb3F1G1ZmpCz/BJy2D6pdLXBMF6fzdglxhUt4aiO5OxLpUFpcB45l5
 vBjPxGEA1/192s7+2aHQKBANd+qYfkQB+Xt7nXIrhuV6cEkzKX4aPehIy1vvGMEm
 NC7+zZpQKaYvlbu6GL94/ZFtBHzF9TmYgQSb305ML35zZSk+zfb3CeH/i4L9RUBC
 DB8Of6Oy6oku+m6Pk+OzjH+vfN6EOyDfxJt010J5zqZXjJv4BhZv8gMawuKjKUek
 HuELW0lY4ArxBOoQ8rftzXIXzKAwK79Ir0tMIY7hXzRr/4i/iTuY4IcNE/TjiHV8
 KsTsMmHAdCzkLrTqasad743NBHOEARA+HEiM0pne/us/oaPznJ2cC5LC2t+UBqnY
 G481YhG/nVlk2dSthMjwsct8Zt6agfSH+YBDurYwep31G2gIwjqT9GEoiVrmGRVw
 NlMIhbA3GFNiUP+EGALDvVTbb0Q86Y4oI+dh+iLdHQXtw66rUoqyJDLJWHkZoOL6
 V3dUMSV+PuB1z7z6a59ihnVIKlHzk4hPYgUBLvd0mHTBI/ZQp7/RZze0osTHIY56
 i+RSMpxi4ZU2m7PGvZfe
 =fziL
 -----END PGP SIGNATURE-----

Merge tag 'v4.5-next-dts64' of https://github.com/mbgg/linux-mediatek into next/dt64

Merge "ARM: mediatek: dts updates for v4.6" from Matthias Brugger:

Add nor-flash to mt8173 SoC.
Add efuse device to mt8173 SoC.
Fix power-domain issue mt8173-evb which uses older chip revision.

* tag 'v4.5-next-dts64' of https://github.com/mbgg/linux-mediatek:
  ARM64: dts: Mediatek: mt8173-evb: fix access MMC fail issue
  dts: arm64: Add EFUSE device node
  arm64: dts: mt8173: Add nor flash node
2016-02-26 22:29:42 +01:00
Ard Biesheuvel 5be8b70af1 arm64: lse: deal with clobbered IP registers after branch via PLT
The LSE atomics implementation uses runtime patching to patch in calls
to out of line non-LSE atomics implementations on cores that lack hardware
support for LSE. To avoid paying the overhead cost of a function call even
if no call ends up being made, the bl instruction is kept invisible to the
compiler, and the out of line implementations preserve all registers, not
just the ones that they are required to preserve as per the AAPCS64.

However, commit fd045f6cd9 ("arm64: add support for module PLTs") added
support for routing branch instructions via veneers if the branch target
offset exceeds the range of the ordinary relative branch instructions.
Since this deals with jump and call instructions that are exposed to ELF
relocations, the PLT code uses x16 to hold the address of the branch target
when it performs an indirect branch-to-register, something which is
explicitly allowed by the AAPCS64 (and ordinary compiler generated code
does not expect register x16 or x17 to retain their values across a bl
instruction).

Since the lse runtime patched bl instructions don't adhere to the AAPCS64,
they don't deal with this clobbering of registers x16 and x17. So add them
to the clobber list of the asm() statements that perform the call
instructions, and drop x16 and x17 from the list of registers that are
callee saved in the out of line non-LSE implementations.

In addition, since we have given these functions two scratch registers,
they no longer need to stack/unstack temp registers.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
[will: factored clobber list into #define, updated Makefile comment]
Signed-off-by: Will Deacon <will.deacon@arm.com>

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 18:35:02 +00:00
Kefeng Wang cc30e6b95c arm64: mm: dump: Use VA_START directly instead of private LOWEST_ADDR
Use VA_START macro in asm/memory.h instead of private LOWEST_ADDR
definition in dump.c.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 18:31:41 +00:00
Will Deacon f993318bfe arm64: kconfig: add submenu for 8.2 architectural features
UAO is a feature of ARMv8.2, so add a submenu like we have for 8.1.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 18:12:35 +00:00
Ard Biesheuvel dfd55ad85e arm64: vmemmap: use virtual projection of linear region
Commit dd006da216 ("arm64: mm: increase VA range of identity map") made
some changes to the memory mapping code to allow physical memory to reside
at an offset that exceeds the size of the virtual mapping.

However, since the size of the vmemmap area is proportional to the size of
the VA area, but it is populated relative to the physical space, we may
end up with the struct page array being mapped outside of the vmemmap
region. For instance, on my Seattle A0 box, I can see the following output
in the dmesg log.

   vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
             0xffffffbfc0000000 - 0xffffffbfd0000000   (   256 MB actual)

We can fix this by deciding that the vmemmap region is not a projection of
the physical space, but of the virtual space above PAGE_OFFSET, i.e., the
linear region. This way, we are guaranteed that the vmemmap region is of
sufficient size, and we can even reduce the size by half.

Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2016-02-26 17:59:04 +00:00
Lorenzo Pieralisi c1e4659ba8 arm64: kernel: acpi: fix ioremap in ACPI parking protocol cpu_postboot
When secondary cpus are booted through the ACPI parking protocol, the
booted cpu should check that FW has correctly cleared its mailbox entry
point value to make sure the boot process was correctly executed.
The entry point check is carried in the cpu_ops->cpu_postboot method, that
is executed by secondary cpus when entering the kernel with irqs disabled.

The ACPI parking protocol cpu_ops maps/unmaps the mailboxes on the
primary CPU to trigger secondary boot in the cpu_ops->cpu_boot method
and on secondary processors to carry out FW checks on the booted CPU
to verify the boot protocol was successfully executed in the
cpu_ops->cpu_postboot method.

Therefore, the cpu_ops->cpu_postboot method is forced to ioremap/unmap the
mailboxes, which is wrong in that ioremap cannot be safely be carried out
with irqs disabled.

To fix this issue, this patch reshuffles the code so that the mailboxes
are still mapped after the boot processor executes the cpu_ops->cpu_boot
method for a given cpu, and the VA at which a mailbox is mapped for a given
cpu is stashed in the per-cpu data struct so that secondary cpus can
retrieve them in the cpu_ops->cpu_postboot and complete the required
FW checks.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reported-by: Itaru Kitayama <itaru.kitayama@riken.jp>
Tested-by: Loc Ho <lho@apm.com>
Tested-by: Itaru Kitayama <itaru.kitayama@riken.jp>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Loc Ho <lho@apm.com>
Cc: Itaru Kitayama <itaru.kitayama@riken.jp>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Al Stone <ahs3@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 15:39:52 +00:00
Suzuki K Poulose bf50061844 arm64: Add support for Half precision floating point
ARMv8.2 extensions [1] include an optional feature, which supports
half precision(16bit) floating point/asimd data processing
instructions. This patch adds support for detecting and exposing
the same to the userspace via HWCAPs

[1] https://community.arm.com/groups/processors/blog/2016/01/05/armv8-a-architecture-evolution

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 15:37:01 +00:00
Mark Rutland 3eca86e75e arm64: Remove fixmap include fragility
The asm-generic fixmap.h depends on each architecture's fixmap.h to pull
in the definition of PAGE_KERNEL_RO, if this exists. In the absence of
this, FIXMAP_PAGE_RO will not be defined. In mm/early_ioremap.c the
definition of early_memremap_ro is predicated on FIXMAP_PAGE_RO being
defined.

Currently, the arm64 fixmap.h doesn't include pgtable.h for the
definition of PAGE_KERNEL_RO, and as a knock-on effect early_memremap_ro
is not always defined, leading to link-time failures when it is used.
This has been observed with defconfig on next-20160226.

Unfortunately, as pgtable.h includes fixmap.h, adding the include
introduces a circular dependency, which is just as fragile.

Instead, this patch factors out PAGE_KERNEL_RO and other prot
definitions into a new pgtable-prot header which can be included by poth
pgtable.h and fixmap.h, avoiding the  circular dependency, and ensuring
that early_memremap_ro is alwyas defined where it is used.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 15:22:53 +00:00
Andrew Pinski 104a0c02e8 arm64: Add workaround for Cavium erratum 27456
On ThunderX T88 pass 1.x through 2.1 parts, broadcast TLBI
instructions may cause the icache to become corrupted if it contains
data for a non-current ASID.

This patch implements the workaround (which invalidates the local
icache when switching the mm) by using code patching.

Signed-off-by: Andrew Pinski <apinski@cavium.com>
Signed-off-by: David Daney <david.daney@cavium.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 15:14:27 +00:00
Jeremy Linton 2f39b5f91e arm64: mm: Mark .rodata as RO
Currently the .rodata section is actually still executable when DEBUG_RODATA
is enabled. This changes that so the .rodata is actually read only, no execute.
It also adds the .rodata section to the mem_init banner.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
[catalin.marinas@arm.com: added vm_struct vmlinux_rodata in map_kernel()]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 15:08:04 +00:00
Thomas Petazzoni b5ebfad8df arm64: dts: marvell: re-order Device Tree nodes for Armada AP806
The DT nodes representing the XOR engines were not placed at the
proper location to comply with the requirement of ordering DT nodes by
their unit address. This commit fixes this mistake.

[gregory.clement@free-electrons.com: Fix commit title by adding ' dts:']
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
2016-02-26 15:17:31 +01:00
Thomas Petazzoni d2b78fb6f2 arm64: dts: marvell: update Armada AP806 clock description
Following the review from the DT maintainers, the DT binding for the
clocks has changed, and we now use a DFX server node exposing a
syscon, with the clock nodes being subnodes of the DFX server
node. This commit therefore updates the AP806 Device Tree file to use
this new DT binding.

[gregory.clement@free-electrons.com: Fix commit title by adding ' dts:']
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
2016-02-26 15:17:30 +01:00
Thomas Petazzoni ec7e5a569b arm64: dts: marvell: add Device Tree files for Armada 7K/8K
This commit adds the base Device Tree files for the Armada 7K and 8K
SoCs, as well as the Armada 8040 DB board.

The Armada 7020, 7040 (7K family) and 8020, 8040 (8K family) are
composed of:

 - An AP806 block that contains the CPU core and a few basic
   peripherals. The AP806 is available in dual core configurations
   (used in 7020 and 8020) and quad core configurations (used in 8020
   and 8040).

 - One or two CP110 blocks that contain all the high-speed interfaces
   (SATA, PCIe, Ethernet, etc.). The 7K family chips have one CP110,
   and the 8K family chips have two CP110, giving them twice the
   number of HW interfaces.

In order to represent this from a Device Tree point of view, this
commit creates the following hierarchy:

 * armada-ap806.dtsi - definitions common to dual/quad ap806
   * armada-ap806-dual.dtsi - description of the two CPUs
     * armada-7020.dtsi - description of the 7020 SoC
     * armada-8020.dtsi - description of the 8020 SoC
   * armada-ap806-quad.dtsi - description of the four CPUs
     * armada-7040.dtsi - description of the 7040 SoC
       * armada-7040-db.dts - description of the 7040 board
     * armada-8040.dtsi - description of the 8040 SoC

The CP110 blocks are not described yet, and will be part of future
patch series.

[gregory.clement@free-electrons.com: Fix commit title by adding ' dts:']
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
2016-02-26 15:17:16 +01:00
Miles Chen b7dc8d16e7 arm64/mm: remove unnecessary boundary check
Remove the unnecessary boundary check since there is a huge
gap between user and kernel address that they would never overlap.
(arm64 does not have enough levels of page tables to cover 64-bit
virtual address)

See Documentation/arm64/memory.txt

Signed-off-by: Miles Chen <miles.chen@mediatek.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-26 13:39:53 +00:00
Linus Torvalds 73056bbc68 KVM/ARM fixes:
- Fix per-vcpu vgic bitmap allocation
 - Do not give copy random memory on MMIO read
 - Fix GICv3 APR register restore order
 
 KVM/x86 fixes:
 - Fix ubsan warning
 - Fix hardware breakpoints in a guest vs. preempt notifiers
 - Fix Hurd
 
 Generic:
 - use __GFP_NOWARN together with GFP_NOWAIT
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQEcBAABAgAGBQJWzsReAAoJEL/70l94x66DT6cH/3K/X/eciQIQTjLWKQ9BUhsN
 +4WN+PX51GCvRZgoGgXXxTUzWVpSHNE7iD5FR/yqiUpC6lq+GWYKyQYBU6S2tw7N
 QrzVFUAOIAExfzw4ztLz8pvIIwsF6EC2sA0DRZO85FWApO4P3BJN/1nBa+THJchH
 6RamguztCjVSfboFwpulPzmgzJwIQ1ai+KoO1z/1ifrxjOHLytF5wn6UegPXIkc6
 PAWG0b6w2ZnSwTNhEdsjzlcEANd/otwOoTlcft//KLuBkSS0GgU3vgxv7OXeSn67
 +Wa9wWT/rU6M4Ol0noXcyr/kiF5629bQ4IyLK7YFgOUPFt4Tmg+A1ABGc92WJa4=
 =/9Sf
 -----END PGP SIGNATURE-----

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

Pull KVM fixes from Paolo Bonzini:
 "KVM/ARM fixes:
   - Fix per-vcpu vgic bitmap allocation
   - Do not give copy random memory on MMIO read
   - Fix GICv3 APR register restore order

  KVM/x86 fixes:
   - Fix ubsan warning
   - Fix hardware breakpoints in a guest vs. preempt notifiers
   - Fix Hurd

  Generic:
   - use __GFP_NOWARN together with GFP_NOWAIT"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: x86: MMU: fix ubsan index-out-of-range warning
  arm64: KVM: vgic-v3: Restore ICH_APR0Rn_EL2 before ICH_APR1Rn_EL2
  KVM: async_pf: do not warn on page allocation failures
  KVM: x86: fix conversion of addresses to linear in 32-bit protected mode
  KVM: x86: fix missed hardware breakpoints
  arm/arm64: KVM: Feed initialized memory to MMIO accesses
  KVM: arm/arm64: vgic: Ensure bitmaps are long enough
2016-02-25 19:53:54 -08:00
Duc Dang 406f594054 arm64: dts: apm: Add DT node for X-Gene v2 SLIMpro Mailbox I2C Driver
Add DT node to enable SLIMpro Mailbox I2C Driver for
X-Gene v2 platforms.

Signed-off-by: Duc Dang <dhdang@apm.com>
2016-02-25 17:14:04 -08:00
Duc Dang e99fe22661 arm64: dts: apm: Mailbox device tree node for APM X-Gene v2 platform.
Add mailbox device tree node for APM X-Gene v2 platform.

Signed-off-by: Duc Dang <dhdang@apm.com>
2016-02-25 17:14:03 -08:00
Duc Dang 778b5cbc0d arm64: dts: apm: Add DT node for X-Gene v1 SLIMpro Mailbox I2C Driver
Add DT node to enable SLIMpro Mailbox I2C Driver for
X-Gene v1 platforms.

Signed-off-by: Duc Dang <dhdang@apm.com>
2016-02-25 17:14:02 -08:00
Duc Dang b0e4563c2f arm64: dts: apm: mailbox device tree node for APM X-Gene platform.
Mailbox device tree node for APM X-Gene platform.

Signed-off-by: Feng Kan <fkan@apm.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
2016-02-25 17:14:01 -08:00
Duc Dang edf21f2710 arm64: dts: apm: Update GPIO to control power-off on X-Gene v2 platforms
This patch updates gpio-keys node that supports power-off for
X-Gene v2 Merlin board to adapt with new changes in xgene-gpio-sb
driver (to support configuring some GPIO pins as interrupt pins).

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
2016-02-25 17:14:00 -08:00
Duc Dang b8a4ee33d9 arm64: dts: apm: Update GPIO standby controller DT node for X-Gene v2 platforms
xgene-gpio-sb driver now supports configuring some GPIO pins
as interrupt pins. This patch adds the required fields for GPIO
standby controller DT node of X-Gene v2 platform to work with
this new driver change.

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
2016-02-25 17:13:59 -08:00
Duc Dang 310b1406a5 arm64: dts: apm: Update GPIO to control power-off on X-Gene v1 platforms
This patch updates gpio-keys node that supports power-off for
X-Gene v1 Mustang board to adapt with new changes in xgene-gpio-sb
driver (to support configuring some GPIO pins as interrupt pins).

Signed-off-by: Duc Dang <dhdang@apm.com>
2016-02-25 17:13:58 -08:00
Alim Akhtar 617fe7196d arm64: defconfig: Enable exynos thermal config
This patch enables Exynos thermal and related configs for the
TMU found on Exynos7 SoC. This also enables thermal emulation
mode to test trip points.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2016-02-26 09:32:45 +09:00
Yoshihiro Shimoda 474efcae3b arm64: dts: salvator-x: enable USB 2.0 Host of channel 1 and 2
We should set SW15 to pin 2-3 side on the board before we use CN9
as USB host or peripheral.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2016-02-26 08:55:32 +09:00
Yoshihiro Shimoda e24250c008 arm64: dts: salvator-x: enable usb2_phy of channel 1 and 2
This board has a MAX3355 chip. However, we cannot use the extcon/max3355
driver because the ID pin doesn't connect to a gpio pin (in other words,
it connects to the SoC specific pin).
And, the phy-rcar-gen3-usb2 driver cannot handle such a chip for now.
So, this patch enables usb2_phy of channel 1 and 2.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2016-02-26 08:55:32 +09:00
Yoshihiro Shimoda a2bcdc2876 arm64: dts: r8a7795: add USB2.0 Host (EHCI/OHCI) device nodes
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2016-02-26 08:55:31 +09:00
Yoshihiro Shimoda 5923bb5227 arm64: dts: r8a7795: add usb2_phy device nodes
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2016-02-26 08:55:31 +09:00
Simon Horman 2b953ccd0e arm64: dts: r8a7795: use fallback etheravb compatibility string
Use recently added fallback compatibility string in r8a7795 device tree.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
2016-02-26 08:55:30 +09:00
Ai Kyuse 1c0e7b9a00 arm64: dts: r8a7795: salvator-x: enable SDHI0 & 3
Add the exposed SD card slots. The on-board eMMC needs to wait until we
fixed the 8bit support.

Signed-off-by: Ai Kyuse <ai.kyuse.uw@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2016-02-26 08:55:29 +09:00
Ai Kyuse d9d67010e0 arm64: dts: r8a7795: Add SDHI support to dtsi
Signed-off-by: Ai Kyuse <ai.kyuse.uw@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
[wsa: squashed some fixes and added mmc-caps]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
2016-02-26 08:55:18 +09:00
Srinivas Kandagatla a7b2466cea arm64: dts: qcom: fix usb digital voltage levels
This patch updates the digital voltage levels from corner values to
microvolts as we are going to use s1 regulator directly for vddcx
instead of s1_corner.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
2016-02-25 16:50:08 -06:00
Srinivas Kandagatla b1cda82b93 arm64: dts: qcom: apq8016-sbc: enable lpass on DB410c
This patch enables the lpass on DB410C. LPASS is used as cpu dai for
both analog and digital audio.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
2016-02-25 16:50:08 -06:00
Srinivas Kandagatla 3761a3618f arm64: dts: qcom: add lpass node
This patch adds lpass node to the SOC.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
2016-02-25 16:50:07 -06:00
Srinivas Kandagatla 143bb9ad85 arm64: dts: qcom: add audio pinctrls
This patch adds pinctrls required for digital and analog audio via lpass.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
2016-02-25 16:50:07 -06:00
Srinivas Kandagatla dd8cdc9e1d arm64: dts: qcom: apq8016-sbc: add usb support
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
2016-02-25 16:50:07 -06:00
Srinivas Kandagatla 2a0bc8104e arm64: dts: qcom: add manual pullup setting to otg.
This patch adds manual pull up setting for usb otg indicating that the
vbus is vbus is not routed to USB controller/phy therefore enables
pull-up explicitly before starting controller.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
2016-02-25 16:50:07 -06:00
Quan Nguyen 47f134a2d5 arm64: dts: apm: Update X-Gene standby GPIO controller DTS entries
Update APM X-Gene standby GPIO controller DTS entries to enable it
as interrupt controller.

[dhdang: update patch subject]
Signed-off-by: Y Vo <yvo@apm.com>
Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Duc Dang <dhdang@apm.com>
2016-02-25 14:40:17 -08:00
Loc Ho 8943f5530d arm64: dts: apm: Update Merlin DT PCP PLL clock node for v2 hardware
Update Merlin DT PCP PLL clock node to reflect compatible
string change to reflect v2 hardware.

[dhdang: change patch subject]
Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Duc Dang <dhdang@apm.com>
2016-02-25 14:38:18 -08:00
Andre Przywara 22b0898e83 arm64: add defconfig options for Allwinner SoCs
With the Allwinner platform now supported, enable it in the defconfig
and add some options to give some decent out-of-the-box experience on
those SoCs.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-02-25 10:51:50 -08:00
Catalin Marinas cac4b8cdf5 arm64: Fix building error with 16KB pages and 36-bit VA
In such configuration, Linux uses only two pages of page tables and
__pud_populate() should not be used. However, the BUILD_BUG() triggers
since pud_sect() is still defined and the compiler cannot eliminate such
code, even though at run-time it should not be triggered. This patch
extends the #ifdef ARM64_64K_PAGES condition for pud_sect to include
PGTABLE_LEVELS < 3.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 16:01:26 +00:00
Yong Wu 5ff6b3a6d3 dts: mt8173: Add iommu/smi nodes for mt8173
This patch add the iommu/larbs nodes for mt8173

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2016-02-25 16:49:09 +01:00
Kefeng Wang c966f0521d arm64: defconfig: Enable DesignWare APB GPIO controller
The Synopsys DesignWare APB GPIO controller is used by several vender's socs,
like apm/marvell/altera/hisilicon, enable it by default.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2016-02-25 21:21:26 +08:00
Kefeng Wang 82a14b1e95 arm64: dts: hip05: Append power button node for D02 board
This patch adds poweroff button device node to support
poweroff feature on hip05 d02 board.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2016-02-25 21:15:58 +08:00
Kefeng Wang 8f41d122bf arm64: dts: hip05: Append gpio nodes
There are two dw GPIO controllers in hip05 peri sub, this patch
adds the corresponding device tree nodes.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2016-02-25 21:15:58 +08:00
Kefeng Wang abf9c25d55 arm64: dts: hip05: Append all gicv3 ITS entries
There are four subsystems in hip05 soc, peri/m3/pcie/dsa,
each subsystem has one its, append them under gicv3 node.

They will be used by hisilicon mbigen.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2016-02-25 21:15:58 +08:00
Kefeng Wang 6897db62bb arm64: dts: hip05: Use Cortex specific device node for pmu
Instead of using the generic armv8-pmuv3 compatibility, use
the more specific Cortex A57 compatibility.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2016-02-25 21:15:58 +08:00
Kefeng Wang dbb58d0f79 arm64: dts: hip05: Add L2 cache topology
The Hip05 SoC has four L2 cache for all 16 CPUs, every four cpus
share one L2 cache, add them to the dtsi file so that the cache
hierarchy can be probed.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
2016-02-25 21:15:58 +08:00
Michal Simek 5087bccb2f ARM64: zynqmp: Extract clock information from EP108
Extract clocks and put it specific file to help with platform
autogeneration.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2016-02-25 14:01:03 +01:00
Michal Simek 72e5df437b ARM64: zynqmp: Keep gpio node alphabetically sorted
No functional change.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2016-02-25 14:00:50 +01:00
Suzuki K Poulose 28c5dcb22f arm64: Rename cpuid_feature field extract routines
Now that we have a clear understanding of the sign of a feature,
rename the routines to reflect the sign, so that it is not misused.
The cpuid_feature_extract_field() now accepts a 'sign' parameter.

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 10:33:08 +00:00
Suzuki K Poulose ff96f7bc7b arm64: capabilities: Handle sign of the feature bit
Use the appropriate accessor for the feature bit by keeping
track of the sign of the feature

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 10:33:07 +00:00
Suzuki K Poulose 0710cfdb8d arm64: cpufeature: Fix the sign of feature bits
There is a confusion on whether the values of a feature are signed
or not in ARM. This is not clearly mentioned in the ARM ARM either.
We have dealt most of the bits as signed so far, and marked the
rest as unsigned explicitly. This fixed in ARM ARM and will be rolled
out soon.

Here is the criteria in a nutshell:

1) The fields, which are either signed or unsigned, use increasing
   numerical values to indicate an increase in functionality. Thus, if a value
   of 0x1 indicates the presence of some instructions, then the 0x2 value will
   indicate the presence of those instructions plus some additional instructions
   or functionality.

2) For ID field values where the value 0x0 defines that a feature is not present,
   the number is an unsigned value.

3) For some features where the feature was made optional or removed after the
   start of the definition of the architecture, the value 0x0 is used to
   indicate the presence of a feature, and 0xF indicates the absence of the
   feature. In these cases, the fields are, in effect, holding signed values.

So with these rules applied, we have only the following fields which are signed and
the rest are unsigned.

 a) ID_AA64PFR0_EL1: {FP, ASIMD}
 b) ID_AA64MMFR0_EL1: {TGran4K, TGran64K}
 c) ID_AA64DFR0_EL1: PMUVer (0xf - PMUv3 not implemented)
 d) ID_DFR0_EL1: PerfMon
 e) ID_MMFR0_EL1: {InnerShr, OuterShr}

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 10:33:07 +00:00
Suzuki K Poulose e53435031a arm64: cpufeature: Correct feature register tables
Correct the feature bit entries for :
  ID_DFR0
  ID_MMFR0

to fix the default safe value for some of the bits.

Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 10:33:07 +00:00
Suzuki K Poulose 13f417f3b8 arm64: Ensure the secondary CPUs have safe ASIDBits size
Adds a hook for checking whether a secondary CPU has the
features used already by the kernel during early boot, based
on the boot CPU and plugs in the check for ASID size.

The ID_AA64MMFR0_EL1:ASIDBits determines the size of the mm context
id and is used in the early boot to make decisions. The value is
picked up from the Boot CPU and cannot be delayed until other CPUs
are up. If a secondary CPU has a smaller size than that of the Boot
CPU, things will break horribly and the usual SANITY check is not good
enough to prevent the system from crashing. So, crash the system with
enough information.

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 10:33:06 +00:00
Suzuki K Poulose 038dc9c66a arm64: Add helper for extracting ASIDBits
Add a helper to extract ASIDBits on the current cpu

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 10:33:06 +00:00
Suzuki K Poulose fd9c2790cb arm64: Enable CPU capability verification unconditionally
We verify the capabilities of the secondary CPUs only when
hotplug is enabled. The boot time activated CPUs do not
go through the verification by checking whether the system
wide capabilities were initialised or not.

This patch removes the capability check dependency on CONFIG_HOTPLUG_CPU,
to make sure that all the secondary CPUs go through the check.
The boot time activated CPUs will still skip the system wide
capability check. The plan is to hook in a check for CPU features
used by the kernel at early boot up, based on the Boot CPU values.

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 10:33:06 +00:00
Suzuki K Poulose bb9052744f arm64: Handle early CPU boot failures
A secondary CPU could fail to come online due to insufficient
capabilities and could simply die or loop in the kernel.
e.g, a CPU with no support for the selected kernel PAGE_SIZE
loops in kernel with MMU turned off.
or a hotplugged CPU which doesn't have one of the advertised
system capability will die during the activation.

There is no way to synchronise the status of the failing CPU
back to the master. This patch solves the issue by adding a
field to the secondary_data which can be updated by the failing
CPU. If the secondary CPU fails even before turning the MMU on,
it updates the status in a special variable reserved in the head.txt
section to make sure that the update can be cache invalidated safely
without possible sharing of cache write back granule.

Here are the possible states :

 -1. CPU_MMU_OFF - Initial value set by the master CPU, this value
indicates that the CPU could not turn the MMU on, hence the status
could not be reliably updated in the secondary_data. Instead, the
CPU has updated the status @ __early_cpu_boot_status.

 0. CPU_BOOT_SUCCESS - CPU has booted successfully.

 1. CPU_KILL_ME - CPU has invoked cpu_ops->die, indicating the
master CPU to synchronise by issuing a cpu_ops->cpu_kill.

 2. CPU_STUCK_IN_KERNEL - CPU couldn't invoke die(), instead is
looping in the kernel. This information could be used by say,
kexec to check if it is really safe to do a kexec reboot.

 3. CPU_PANIC_KERNEL - CPU detected some serious issues which
requires kernel to crash immediately. The secondary CPU cannot
call panic() until it has initialised the GIC. This flag can
be used to instruct the master to do so.

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[catalin.marinas@arm.com: conflict resolution]
[catalin.marinas@arm.com: converted "status" from int to long]
[catalin.marinas@arm.com: updated update_early_cpu_boot_status to use str_l]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-25 10:32:23 +00:00
Paolo Bonzini 0fb00d326f KVM/ARM fixes for 4.5-rc6
- Fix per-vcpu vgic bitmap allocation
 - Do not give copy random memory on MMIO read
 - Fix GICv3 APR register restore order
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWzefIAAoJECPQ0LrRPXpDHkEQAIPGVBEilV0Na9QfIcQBiSxK
 IGwFSXAIa2sScfjAyDPbSME/R912XTzdfXLgvYjoUhP8WUX3g/2dRD7OcYOh33zB
 MgUg6QRSIUIyXj6HzOsFnt/rOWlEchjGXzcyVzlQTRjJhIRyHnFprUJsVbPk1Wc8
 NJSXlyAYc3dHmJB29NjAgWRhZGmBx9SddRPfHFYLv9DoVkFGpD+TYL6XMeyfY8Eh
 PVjGipi8K8kl4DJb/pc5kOhtqoXu30JqVlgvpUAQEPSbYQSBbdmjRpd1Ol7M73b1
 sX1+UQmuIk3wcij/YpD3Ep70N5pfjgGAqms1vzBvTk6PKTXKtrjj15uOYcWgx38Z
 W9llAnlzOY5+1htirxiIdfy44gxChcWb5XTykxnJXKEaEQdVHx5E8Yc9Nf3TbNMr
 cLJh5CX9KowOxjW/HmbXXKrL2VNyb0XaecH0VWUV/QNeVqvbY/o38VRgTU0EMuoJ
 nY1QeP3DOQfpq44UHhhzY9gx3myxW4MBr/C/vcbsNi3KiHwP1BIDygenf1cq+FID
 4t/qXEJ+7ScEcDeiw+dTRPodD+6BwL4SH67aGbrxYE2yU9vugdkq2EtP3i5Z0iga
 cKPdzAcFoBJJF4OKcTjdk34dEzGiSVcDdNXhAmIzpHL6xqMwyYNIYUyrHivu3QwP
 8Ctb1ReLpiF574/JhDMo
 =/Pum
 -----END PGP SIGNATURE-----

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

KVM/ARM fixes for 4.5-rc6

- Fix per-vcpu vgic bitmap allocation
- Do not give copy random memory on MMIO read
- Fix GICv3 APR register restore order
2016-02-25 09:53:55 +01:00
Olof Johansson 072201624a mvebu dt64 for 4.6 (part 1)
Device tree part of the Armada 3700 support:
 - binding for the Armada 3700 SoCs
 - device tree files for the SoCs and a board
 - tidy up the Marvell related files
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAlbEltYACgkQCwYYjhRyO9UZxACgi1NcAIrem831BSMOHVRBphAB
 qT8An3bCV/tPx2QYz0kKYmGfyb7VtTzo
 =IdEY
 -----END PGP SIGNATURE-----

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

mvebu dt64 for 4.6 (part 1)

Device tree part of the Armada 3700 support:
- binding for the Armada 3700 SoCs
- device tree files for the SoCs and a board
- tidy up the Marvell related files

* tag 'mvebu-dt64-4.6-1' of git://git.infradead.org/linux-mvebu:
  arm64: dts: add the Marvell Armada 3700 family and a development board
  devicetree: bindings: add DT binding for the Marvell Armada 3700 SoC family
  Documentation: dt: Tidy up the Marvell related files
  Documentation: dt-bindings: Add a new compatible for the Armada 3700

Signed-off-by: Olof Johansson <olof@lixom.net>
2016-02-24 16:49:05 -08:00
Olof Johansson c74f162e84 mvebu arm64 for 4.6 (part 1)
Non dt part of the Armada 3700 support:
 - Kconfig update
 - defconfig update
 - documentation update (including MAINTAINERS:)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEUEABECAAYFAlbElN0ACgkQCwYYjhRyO9XkzgCfaYJggCHzsLpMvnTK1bMNgPCY
 jYkAmOIRjMJskq40RBXSXpyoJboqyZs=
 =tAva
 -----END PGP SIGNATURE-----

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

mvebu arm64 for 4.6 (part 1)

Non dt part of the Armada 3700 support:
- Kconfig update
- defconfig update
- documentation update (including MAINTAINERS:)

* tag 'mvebu-arm64-4.6-1' of git://git.infradead.org/linux-mvebu:
  arm64: defconfig: enable Armada 3700 related config
  Documentation: arm: update supported Marvell EBU processors
  MAINTAINERS: Extend dts entry for ARM64 mvebu files
  arm64: add mvebu architecture entry
  irqchip/armada-370-xp: Do not enable it by default when ARCH_MVEBU is selected
  ARM: mvebu: Use the ARMADA_370_XP_IRQ option
  irqchip/armada-370-xp: Allow allocation of multiple MSIs
  irqchip/armada-370-xp: Use shorter names for irq_chip
  irqchip/armada-370-xp: Use PCI_MSI_DOORBELL_START where appropriate
  irqchip/armada-370-xp: Use the generic MSI infrastructure
  irqchip/armada-370-xp: Add Kconfig option for the driver

Signed-off-by: Olof Johansson <olof@lixom.net>
2016-02-24 16:46:14 -08:00
Minghuan Lian f21a3c7d57 dts/ls2080a: Update PCIe compatible
The patch adds LS2085a to PCIe compatible to fix the compatibility
issue when using firmware with LS2085a compatible property.

Signed-off-by: Minghuan Lian <minghuan.lian@nxp.com>
Signed-off-by: Mingkai Hu <mingkai.hu@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
2016-02-24 16:40:41 -08:00
Suravee Suthikulpanit 18f94513ea arm64: dts: amd: Fix-up for ccn504 and kcs nodes
This is a fix-up patch based on the review comment from
Arnd regarding:
    * fix ccn504 address in the node name
    * remove kcs interrupt-name

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Olof Johansson <olof@lixom.net>
2016-02-24 14:02:19 -08:00
Olof Johansson 4375acc3e2 Define the tuning-related mmc clocks and move from
gpio-key,wakeup to the more generic wakeup-source property.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABCAAGBQJWuwVbAAoJEPOmecmc0R2B5b4H/j869d1n99jqv+we15c0B87e
 bYjNk9UKW4me+rrpU4PLBVyj15KYj+otAS/aB9S5Z+GckRWHLIB4FppE+cCyqAvb
 jmLle+vrMcni23AfbVB9nBzcx/PpE+G0NB9s/PDo07B4MxpeShvYDCW/x3u7ak2r
 VotY8hqp3SI7JVXskknmiJtaxA9RI+CpVPucBJ6SZL5CYFgLSYqo0JiW7ArRWoeb
 /vdbmMN+9CwbYAaWPzkVgPvCTNqsKJeP3K05u+zxOqV++YIva8H2Ml59euxC3CsY
 0IssrCVb0iwlBEF+Lxya/tJJe7lZ5iTcjfE/NMI4lmxvFTUFNMKt8v79kLIKEx0=
 =+Sh9
 -----END PGP SIGNATURE-----

Merge tag 'v4.6-rockchip-dts64-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into next/dt64

Define the tuning-related mmc clocks and move from
gpio-key,wakeup to the more generic wakeup-source property.

* tag 'v4.6-rockchip-dts64-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  arm64: dts: rockchip: replace gpio-key,wakeup with wakeup-source property
  arm64: dts: rockchip: add rk3368 tuning clk for emmc and sdmmc

Signed-off-by: Olof Johansson <olof@lixom.net>
2016-02-24 13:51:45 -08:00
Olof Johansson 8f4f2721dd Enable the rockchip-specific timers on arm64 rockchip platforms.
The driver got reworked to not use arm32-specific dsb calls in
 4.5-rc1, so now we can safely enable it.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABCAAGBQJWuwShAAoJEPOmecmc0R2BCHwIAJGwmP7QIBjjW9Yj1aH6IxcD
 iTeyD37c1ZcJEt2NDXJ6rgWfT0b4ozAOyz8zm56DKbTdR6WE3knew9KoNhMzECw9
 45WhpQgsseZ27gByWMNoTD/fRgeZ3KOJXmPiQ5qYbvHOXzof4+V9MC8eL/oCGpu9
 BH2PEk85kU8SinoHGBz/xPMH0/NkqfEUXOgaWPfO2ySvyGz2eCiFU+ySVnh+tSQH
 m+lJsC3EVkV3zQrbOxkDikJ5hWaSMjCGLTMXX4lJmdZ+V9VXflMR+QxZ1fXKwJ3T
 23a0u+O58I8CV7HW1SejAY3kFmHgEoQ0k0xlYAvetvAaGHN+hw+EmCcIH/fElnE=
 =JEWQ
 -----END PGP SIGNATURE-----

Merge tag 'v4.6-rockchip-soc64-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into next/arm64

Enable the rockchip-specific timers on arm64 rockchip platforms.
The driver got reworked to not use arm32-specific dsb calls in
4.5-rc1, so now we can safely enable it.

* tag 'v4.6-rockchip-soc64-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip:
  arm64: Enable the timer on Rockchip architecture

Signed-off-by: Olof Johansson <olof@lixom.net>
2016-02-24 13:51:08 -08:00
Olof Johansson 7fa12181b0 Few updates for ARM VExpress/Juno platforms
1. GICv3 support on Foundation models
 
 2. Support for Juno R2 board
 
 3. Support for ARM HDLCD on all Juno platforms
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJWuxfzAAoJEABBurwxfuKYF3cP/0rJX1WsVPtJZthVoA0+elTp
 ruRl2vnzxnlrGG93dpWH3HKx4o56En9AIwKHacHkVKcfoSsC3YSTFS3KD34eweFy
 GYJQxtK+eEXZnR3zxbDpyaj2bo/VqFHULB1o8WXJWSs5IAhS4eKeWLoDe/38AsV7
 GXKjoL7Gxi3znS+fZObUwBKrLSUGEgEMJp4I0tX7T1GE0sCPg5aW+ApoHfD4HYC6
 LgKaRuKfaJNrjDETIQ2TqSUuwJobT/xoYjSGPr2cMthBfPUvACXu7+fBFwpfmHct
 EAmNnxBI6f3RuuDuxCFATIMfPPOrEslyFCYBcWhwOtl0r1Y6rq+J/P9AYB3xRqYG
 KzYN33Wo87wwn8y0TULXkRrs9s0WddtulgmH/IrSKby7w7U4sCGmMcNv37kjCRGJ
 oKsSKSAag3g7kBAJEFP4X7tMwG2tl4koUmWvyZO2ihsXt1tHUYQcBLzUdw1N/pNk
 hkQjOr1BRLgEYh451QdBDzcV+QBTgDe3DaG6WpI6RNFuGnKYsqaCyh5qiZGCbvD4
 7dGquR+EBakaEEKjzVIqTva77SB0ZwVAsNgPbgXK0ibqfGuWSQq58GqwWh4Nv0cf
 Xzfihicwsak6swohmn6n5/u3gywekOsoHd1OVrb24cfFHLXcqaLOz7Rs+sFZp93v
 bxHKj68IUAhzU+awmPB9
 =r0q6
 -----END PGP SIGNATURE-----

Merge tag 'vexpress-for-v4.6/dt-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into next/dt

Few updates for ARM VExpress/Juno platforms

1. GICv3 support on Foundation models

2. Support for Juno R2 board

3. Support for ARM HDLCD on all Juno platforms

* tag 'vexpress-for-v4.6/dt-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  arm64: dts: Add HDLCD support on Juno platforms
  Documentation: drm: Add DT bindings for ARM HDLCD
  arm64: dts: Add support for Juno r2 board
  arm64: dts: move juno pcie-controller to base file
  arm64: dts: add .dts for GICv3 Foundation model
  arm64: dts: split Foundation model dts to put the GIC separately
  arm64: dts: Foundation model: increase GICC region to allow EOImode=1
  arm64: dts: prepare foundation-v8.dts to cope with GICv3

Signed-off-by: Olof Johansson <olof@lixom.net>
2016-02-24 13:40:18 -08:00
Marc Zyngier fd451b90e7 arm64: KVM: vgic-v3: Restore ICH_APR0Rn_EL2 before ICH_APR1Rn_EL2
The GICv3 architecture spec says:

Writing to the active priority registers in any order other than
the following order will result in UNPREDICTABLE behavior:
- ICH_AP0R<n>_EL2.
- ICH_AP1R<n>_EL2.

So let's not pointlessly go against the rule...

Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2016-02-24 17:25:58 +00:00
Suzuki K Poulose fce6361fe9 arm64: Move cpu_die_early to smp.c
This patch moves cpu_die_early to smp.c, where it fits better.
No functional changes, except for adding the necessary checks
for CONFIG_HOTPLUG_CPU.

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 17:17:45 +00:00
Suzuki K Poulose ee02a15919 arm64: Introduce cpu_die_early
Or in other words, make fail_incapable_cpu() reusable.

We use fail_incapable_cpu() to kill a secondary CPU early during the
bringup, which doesn't have the system advertised capabilities.
This patch makes the routine more generic, to kill a secondary
booting CPU, getting rid of the dependency on capability struct.
This can be used by checks which are not necessarily attached to
a capability struct (e.g, cpu ASIDBits).

In that process, renames the function to cpu_die_early() to better
match its functionality. This will be moved to arch/arm64/kernel/smp.c
later.

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 17:17:44 +00:00
Suzuki K Poulose c4bc34d202 arm64: Add a helper for parking CPUs in a loop
Adds a routine which can be used to park CPUs (spinning in kernel)
when they can't be killed.

Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 17:17:44 +00:00
Ard Biesheuvel 2b5fe07a78 arm64: efi: invoke EFI_RNG_PROTOCOL to supply KASLR randomness
Since arm64 does not use a decompressor that supplies an execution
environment where it is feasible to some extent to provide a source of
randomness, the arm64 KASLR kernel depends on the bootloader to supply
some random bits in the /chosen/kaslr-seed DT property upon kernel entry.

On UEFI systems, we can use the EFI_RNG_PROTOCOL, if supplied, to obtain
some random bits. At the same time, use it to randomize the offset of the
kernel Image in physical memory.

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:29 +00:00
Ard Biesheuvel c031a4213c arm64: kaslr: randomize the linear region
When KASLR is enabled (CONFIG_RANDOMIZE_BASE=y), and entropy has been
provided by the bootloader, randomize the placement of RAM inside the
linear region if sufficient space is available. For instance, on a 4KB
granule/3 levels kernel, the linear region is 256 GB in size, and we can
choose any 1 GB aligned offset that is far enough from the top of the
address space to fit the distance between the start of the lowest memblock
and the top of the highest memblock.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:27 +00:00
Ard Biesheuvel f80fb3a3d5 arm64: add support for kernel ASLR
This adds support for KASLR is implemented, based on entropy provided by
the bootloader in the /chosen/kaslr-seed DT property. Depending on the size
of the address space (VA_BITS) and the page size, the entropy in the
virtual displacement is up to 13 bits (16k/2 levels) and up to 25 bits (all
4 levels), with the sidenote that displacements that result in the kernel
image straddling a 1GB/32MB/512MB alignment boundary (for 4KB/16KB/64KB
granule kernels, respectively) are not allowed, and will be rounded up to
an acceptable value.

If CONFIG_RANDOMIZE_MODULE_REGION_FULL is enabled, the module region is
randomized independently from the core kernel. This makes it less likely
that the location of core kernel data structures can be determined by an
adversary, but causes all function calls from modules into the core kernel
to be resolved via entries in the module PLTs.

If CONFIG_RANDOMIZE_MODULE_REGION_FULL is not enabled, the module region is
randomized by choosing a page aligned 128 MB region inside the interval
[_etext - 128 MB, _stext + 128 MB). This gives between 10 and 14 bits of
entropy (depending on page size), independently of the kernel randomization,
but still guarantees that modules are within the range of relative branch
and jump instructions (with the caveat that, since the module region is
shared with other uses of the vmalloc area, modules may need to be loaded
further away if the module region is exhausted)

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:27 +00:00
Ard Biesheuvel 1e48ef7fcc arm64: add support for building vmlinux as a relocatable PIE binary
This implements CONFIG_RELOCATABLE, which links the final vmlinux
image with a dynamic relocation section, allowing the early boot code
to perform a relocation to a different virtual address at runtime.

This is a prerequisite for KASLR (CONFIG_RANDOMIZE_BASE).

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:27 +00:00
Ard Biesheuvel 6c94f27ac8 arm64: switch to relative exception tables
Instead of using absolute addresses for both the exception location
and the fixup, use offsets relative to the exception table entry values.
Not only does this cut the size of the exception table in half, it is
also a prerequisite for KASLR, since absolute exception table entries
are subject to dynamic relocation, which is incompatible with the sorting
of the exception table that occurs at build time.

This patch also introduces the _ASM_EXTABLE preprocessor macro (which
exists on x86 as well) and its _asm_extable assembly counterpart, as
shorthands to emit exception table entries.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:26 +00:00
Ard Biesheuvel 4a2e034e5c arm64: make asm/elf.h available to asm files
This reshuffles some code in asm/elf.h and puts a #ifndef __ASSEMBLY__
around its C definitions so that the CPP defines can be used in asm
source files as well.

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:25 +00:00
Ard Biesheuvel 2bf31a4a05 arm64: avoid dynamic relocations in early boot code
Before implementing KASLR for arm64 by building a self-relocating PIE
executable, we have to ensure that values we use before the relocation
routine is executed are not subject to dynamic relocation themselves.
This applies not only to virtual addresses, but also to values that are
supplied by the linker at build time and relocated using R_AARCH64_ABS64
relocations.

So instead, use assemble time constants, or force the use of static
relocations by folding the constants into the instructions.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:25 +00:00
Ard Biesheuvel 6ad1fe5d90 arm64: avoid R_AARCH64_ABS64 relocations for Image header fields
Unfortunately, the current way of using the linker to emit build time
constants into the Image header will no longer work once we switch to
the use of PIE executables. The reason is that such constants are emitted
into the binary using R_AARCH64_ABS64 relocations, which are resolved at
runtime, not at build time, and the places targeted by those relocations
will contain zeroes before that.

So refactor the endian swapping linker script constant generation code so
that it emits the upper and lower 32-bit words separately.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:25 +00:00
Ard Biesheuvel fd045f6cd9 arm64: add support for module PLTs
This adds support for emitting PLTs at module load time for relative
branches that are out of range. This is a prerequisite for KASLR, which
may place the kernel and the modules anywhere in the vmalloc area,
making it more likely that branch target offsets exceed the maximum
range of +/- 128 MB.

In this version, I removed the distinction between relocations against
.init executable sections and ordinary executable sections. The reason
is that it is hardly worth the trouble, given that .init.text usually
does not contain that many far branches, and this version now only
reserves PLT entry space for jump and call relocations against undefined
symbols (since symbols defined in the same module can be assumed to be
within +/- 128 MB)

For example, the mac80211.ko module (which is fairly sizable at ~400 KB)
built with -mcmodel=large gives the following relocation counts:

                    relocs    branches   unique     !local
  .text              3925       3347       518        219
  .init.text           11          8         7          1
  .exit.text            4          4         4          1
  .text.unlikely       81         67        36         17

('unique' means branches to unique type/symbol/addend combos, of which
!local is the subset referring to undefined symbols)

IOW, we are only emitting a single PLT entry for the .init sections, and
we are better off just adding it to the core PLT section instead.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-02-24 14:57:24 +00:00
Georgi Djakov e2841db7a2 arm64: dts: qcom: msm8916: Add RPMCC DT node
Add the RPM Clock Controller DT node and include the necessary header
file for clocks.

Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2016-02-24 00:14:06 -06:00
Stephen Boyd bd6429e810 ARM64: dts: qcom: Remove size elements from pmic reg properties
The #size-cells for the pmics are 0, but we specify a size in the
reg property so that MPP and GPIO modules can figure out how many
pins there are. Now that we've done that by counting irqs, we can
remove the size elements in the reg properties and be DT
compliant.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2016-02-24 00:14:06 -06:00