projects/linux·commit be092017

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

be092017 · Linus Torvalds <[email protected]> · 2016-05-16 17:17:24 -07:00

Pull arm64 updates from Will Deacon:

 - virt_to_page/page_address optimisations

 - support for NUMA systems described using device-tree

 - support for hibernate/suspend-to-disk

 - proper support for maxcpus= command line parameter

 - detection and graceful handling of AArch64-only CPUs

 - miscellaneous cleanups and non-critical fixes

* tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: (92 commits)
  arm64: do not enforce strict 16 byte alignment to stack pointer
  arm64: kernel: Fix incorrect brk randomization
  arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str
  arm64: secondary_start_kernel: Remove unnecessary barrier
  arm64: Ensure pmd_present() returns false after pmd_mknotpresent()
  arm64: Replace hard-coded values in the pmd/pud_bad() macros
  arm64: Implement pmdp_set_access_flags() for hardware AF/DBM
  arm64: Fix typo in the pmdp_huge_get_and_clear() definition
  arm64: mm: remove unnecessary EXPORT_SYMBOL_GPL
  arm64: always use STRICT_MM_TYPECHECKS
  arm64: kvm: Fix kvm teardown for systems using the extended idmap
  arm64: kaslr: increase randomization granularity
  arm64: kconfig: drop CONFIG_RTC_LIB dependency
  arm64: make ARCH_SUPPORTS_DEBUG_PAGEALLOC depend on !HIBERNATION
  arm64: hibernate: Refuse to hibernate if the boot cpu is offline
  arm64: kernel: Add support for hibernate/suspend-to-disk
  PM / Hibernate: Call flush_icache_range() on pages restored in-place
  arm64: Add new asm macro copy_page
  arm64: Promote KERNEL_START/KERNEL_END definitions to a header file
  arm64: kernel: Include _AC definition in page.h
  ...
Commit
be092017b6ffbd013f481f915632db6aa9fc3ca3
Parents
fb6363e9 · e6d9a525

Merge commit. Changes below are compared with the first parent: fb6363e9.

Changes

89 files changed · +3127 −1025

FileStatusAddDelContent
Documentation/arm64/booting.txtmodified+4−0View file
Documentation/devicetree/bindings/numa.txtadded+275−0View file
Documentation/kernel-parameters.txtmodified+4−2View file
arch/arm/include/asm/kvm_host.hmodified+9−1View file
arch/arm/include/asm/kvm_mmu.hmodified+1−0View file
arch/arm/kvm/arm.cmodified+71−47View file
arch/arm/kvm/mmu.cmodified+5−0View file
arch/arm64/Kconfigmodified+39−6View file
arch/arm64/Kconfig.debugmodified+1−1View file
arch/arm64/include/asm/assembler.hmodified+120−13View file
arch/arm64/include/asm/cpufeature.hmodified+25−2View file
arch/arm64/include/asm/elf.hmodified+2−1View file
arch/arm64/include/asm/kernel-pgtable.hmodified+18−3View file
arch/arm64/include/asm/kvm_arm.hmodified+0−11View file
arch/arm64/include/asm/kvm_asm.hmodified+3−0View file
arch/arm64/include/asm/kvm_host.hmodified+13−1View file
arch/arm64/include/asm/kvm_mmu.hmodified+1−0View file
arch/arm64/include/asm/memory.hmodified+31−2View file
arch/arm64/include/asm/mmu.hmodified+1−0View file
arch/arm64/include/asm/mmzone.hadded+12−0View file
arch/arm64/include/asm/numa.hadded+45−0View file
arch/arm64/include/asm/page.hmodified+2−0View file
arch/arm64/include/asm/pgtable-hwdef.hmodified+0−1View file
arch/arm64/include/asm/pgtable-types.hmodified+0−32View file
arch/arm64/include/asm/pgtable.hmodified+43−19View file
arch/arm64/include/asm/smp.hmodified+11−0View file
arch/arm64/include/asm/suspend.hmodified+28−4View file
arch/arm64/include/asm/sysreg.hmodified+20−4View file
arch/arm64/include/asm/topology.hmodified+10−0View file
arch/arm64/include/asm/virt.hmodified+22−0View file
arch/arm64/kernel/Makefilemodified+1−0View file
arch/arm64/kernel/acpi.cmodified+25−8View file
arch/arm64/kernel/asm-offsets.cmodified+7−3View file
arch/arm64/kernel/cpu_errata.cmodified+23−1View file
arch/arm64/kernel/cpufeature.cmodified+204−139View file
arch/arm64/kernel/cpuidle.cmodified+2−7View file
arch/arm64/kernel/cpuinfo.cmodified+22−18View file
arch/arm64/kernel/debug-monitors.cmodified+1−2View file
arch/arm64/kernel/efi-entry.Smodified+1−1View file
arch/arm64/kernel/head.Smodified+85−80View file
arch/arm64/kernel/hibernate-asm.Sadded+176−0View file
arch/arm64/kernel/hibernate.cadded+487−0View file
arch/arm64/kernel/hw_breakpoint.cmodified+5−3View file
arch/arm64/kernel/hyp-stub.Smodified+33−12View file
arch/arm64/kernel/image.hmodified+2−0View file
arch/arm64/kernel/insn.cmodified+1−1View file
arch/arm64/kernel/kaslr.cmodified+3−3View file
arch/arm64/kernel/pci.cmodified+10−0View file
arch/arm64/kernel/process.cmodified+8−10View file
arch/arm64/kernel/setup.cmodified+12−69View file
arch/arm64/kernel/sleep.Smodified+58−99View file
arch/arm64/kernel/smp.cmodified+48−30View file
arch/arm64/kernel/suspend.cmodified+44−58View file
arch/arm64/kernel/sys.cmodified+10−0View file
arch/arm64/kernel/vdso.cmodified+2−2View file
arch/arm64/kernel/vmlinux.lds.Smodified+34−14View file
arch/arm64/kvm/handle_exit.cmodified+7−0View file
arch/arm64/kvm/hyp-init.Smodified+46−2View file
arch/arm64/kvm/hyp.Smodified+8−3View file
arch/arm64/kvm/hyp/entry.Smodified+19−0View file
arch/arm64/kvm/hyp/hyp-entry.Smodified+4−6View file
arch/arm64/kvm/reset.cmodified+30−0View file
arch/arm64/mm/Makefilemodified+1−0View file
arch/arm64/mm/cache.Smodified+0−2View file
arch/arm64/mm/context.cmodified+1−2View file
arch/arm64/mm/dma-mapping.cmodified+12−44View file
arch/arm64/mm/dump.cmodified+17−35View file
arch/arm64/mm/fault.cmodified+73−14View file
arch/arm64/mm/init.cmodified+89−23View file
arch/arm64/mm/mm.hmodified+0−1View file
arch/arm64/mm/mmap.cmodified+0−2View file
arch/arm64/mm/mmu.cmodified+11−13View file
arch/arm64/mm/numa.cadded+396−0View file
arch/arm64/mm/proc-macros.Sdeleted+0−98View before deletion
arch/arm64/mm/proc.Smodified+21−35View file
arch/nios2/include/asm/io.hmodified+0−1View file
arch/nios2/include/asm/page.hmodified+1−1View file
arch/nios2/include/asm/pgtable.hmodified+1−1View file
arch/openrisc/include/asm/page.hmodified+0−2View file
drivers/firmware/efi/arm-init.cmodified+8−0View file
drivers/firmware/efi/libstub/arm64-stub.cmodified+12−3View file
drivers/firmware/efi/libstub/fdt.cmodified+1−23View file
drivers/irqchip/irq-gic.cmodified+2−3View file
drivers/of/Kconfigmodified+3−0View file
drivers/of/Makefilemodified+1−0View file
drivers/of/of_numa.cadded+211−0View file
include/linux/mm.hmodified+5−1View file
include/linux/of.hmodified+9−0View file
kernel/power/swap.cmodified+18−0View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/arm64/booting.txt

View file
diff --git a/Documentation/arm64/booting.txt b/Documentation/arm64/booting.txt
index 56d6d8b..8d0df62 100644
--- a/Documentation/arm64/booting.txt
+++ b/Documentation/arm64/booting.txt
@@ -132,6 +132,10 @@ NOTE: versions prior to v4.6 cannot make use of memory below the
physical offset of the Image so it is recommended that the Image be
placed as close as possible to the start of system RAM.
+If an initrd/initramfs is passed to the kernel at boot, it must reside
+entirely within a 1 GB aligned physical memory window of up to 32 GB in
+size that fully covers the kernel Image as well.
+
Any memory described to the kernel (even that below the start of the
image) which is not marked as reserved from the kernel (e.g., with a
memreserve region in the device tree) will be considered as available to

Documentation/devicetree/bindings/numa.txt

View file
diff --git a/Documentation/devicetree/bindings/numa.txt b/Documentation/devicetree/bindings/numa.txt
new file mode 100644
index 0000000..21b3505
--- /dev/null
+++ b/Documentation/devicetree/bindings/numa.txt
@@ -0,0 +1,275 @@
+==============================================================================
+NUMA binding description.
+==============================================================================
+
+==============================================================================
+1 - Introduction
+==============================================================================
+
+Systems employing a Non Uniform Memory Access (NUMA) architecture contain
+collections of hardware resources including processors, memory, and I/O buses,
+that comprise what is commonly known as a NUMA node.
+Processor accesses to memory within the local NUMA node is generally faster
+than processor accesses to memory outside of the local NUMA node.
+DT defines interfaces that allow the platform to convey NUMA node
+topology information to OS.
+
+==============================================================================
+2 - numa-node-id
+==============================================================================
+
+For the purpose of identification, each NUMA node is associated with a unique
+token known as a node id. For the purpose of this binding
+a node id is a 32-bit integer.
+
+A device node is associated with a NUMA node by the presence of a
+numa-node-id property which contains the node id of the device.
+
+Example:
+ /* numa node 0 */
+ numa-node-id = <0>;
+
+ /* numa node 1 */
+ numa-node-id = <1>;
+
+==============================================================================
+3 - distance-map
+==============================================================================
+
+The optional device tree node distance-map describes the relative
+distance (memory latency) between all numa nodes.
+
+- compatible : Should at least contain "numa-distance-map-v1".
+
+- distance-matrix
+ This property defines a matrix to describe the relative distances
+ between all numa nodes.
+ It is represented as a list of node pairs and their relative distance.
+
+ Note:
+ 1. Each entry represents distance from first node to second node.
+ The distances are equal in either direction.
+ 2. The distance from a node to self (local distance) is represented
+ with value 10 and all internode distance should be represented with
+ a value greater than 10.
+ 3. distance-matrix should have entries in lexicographical ascending
+ order of nodes.
+ 4. There must be only one device node distance-map which must
+ reside in the root node.
+ 5. If the distance-map node is not present, a default
+ distance-matrix is used.
+
+Example:
+ 4 nodes connected in mesh/ring topology as below,
+
+ 0_______20______1
+ | |
+ | |
+ 20 20
+ | |
+ | |
+ |_______________|
+ 3 20 2
+
+ if relative distance for each hop is 20,
+ then internode distance would be,
+ 0 -> 1 = 20
+ 1 -> 2 = 20
+ 2 -> 3 = 20
+ 3 -> 0 = 20
+ 0 -> 2 = 40
+ 1 -> 3 = 40
+
+ and dt presentation for this distance matrix is,
+
+ distance-map {
+ compatible = "numa-distance-map-v1";
+ distance-matrix = <0 0 10>,
+ <0 1 20>,
+ <0 2 40>,
+ <0 3 20>,
+ <1 0 20>,
+ <1 1 10>,
+ <1 2 20>,
+ <1 3 40>,
+ <2 0 40>,
+ <2 1 20>,
+ <2 2 10>,
+ <2 3 20>,
+ <3 0 20>,
+ <3 1 40>,
+ <3 2 20>,
+ <3 3 10>;
+ };
+
+==============================================================================
+4 - Example dts
+==============================================================================
+
+Dual socket system consists of 2 boards connected through ccn bus and
+each board having one socket/soc of 8 cpus, memory and pci bus.
+
+ memory@c00000 {
+ device_type = "memory";
+ reg = <0x0 0xc00000 0x0 0x80000000>;
+ /* node 0 */
+ numa-node-id = <0>;
+ };
+
+ memory@10000000000 {
+ device_type = "memory";
+ reg = <0x100 0x0 0x0 0x80000000>;
+ /* node 1 */
+ numa-node-id = <1>;
+ };
+
+ cpus {
+ #address-cells = <2>;
+ #size-cells = <0>;
+
+ cpu@0 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x0>;
+ enable-method = "psci";
+ /* node 0 */
+ numa-node-id = <0>;
+ };
+ cpu@1 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x1>;
+ enable-method = "psci";
+ numa-node-id = <0>;
+ };
+ cpu@2 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x2>;
+ enable-method = "psci";
+ numa-node-id = <0>;
+ };
+ cpu@3 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x3>;
+ enable-method = "psci";
+ numa-node-id = <0>;
+ };
+ cpu@4 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x4>;
+ enable-method = "psci";
+ numa-node-id = <0>;
+ };
+ cpu@5 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x5>;
+ enable-method = "psci";
+ numa-node-id = <0>;
+ };
+ cpu@6 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x6>;
+ enable-method = "psci";
+ numa-node-id = <0>;
+ };
+ cpu@7 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x7>;
+ enable-method = "psci";
+ numa-node-id = <0>;
+ };
+ cpu@8 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x8>;
+ enable-method = "psci";
+ /* node 1 */
+ numa-node-id = <1>;
+ };
+ cpu@9 {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0x9>;
+ enable-method = "psci";
+ numa-node-id = <1>;
+ };
+ cpu@a {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0xa>;
+ enable-method = "psci";
+ numa-node-id = <1>;
+ };
+ cpu@b {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0xb>;
+ enable-method = "psci";
+ numa-node-id = <1>;
+ };
+ cpu@c {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0xc>;
+ enable-method = "psci";
+ numa-node-id = <1>;
+ };
+ cpu@d {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0xd>;
+ enable-method = "psci";
+ numa-node-id = <1>;
+ };
+ cpu@e {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0xe>;
+ enable-method = "psci";
+ numa-node-id = <1>;
+ };
+ cpu@f {
+ device_type = "cpu";
+ compatible = "arm,armv8";
+ reg = <0x0 0xf>;
+ enable-method = "psci";
+ numa-node-id = <1>;
+ };
+ };
+
+ pcie0: pcie0@848000000000 {
+ compatible = "arm,armv8";
+ device_type = "pci";
+ bus-range = <0 255>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <0x8480 0x00000000 0 0x10000000>; /* Configuration space */
+ ranges = <0x03000000 0x8010 0x00000000 0x8010 0x00000000 0x70 0x00000000>;
+ /* node 0 */
+ numa-node-id = <0>;
+ };
+
+ pcie1: pcie1@948000000000 {
+ compatible = "arm,armv8";
+ device_type = "pci";
+ bus-range = <0 255>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <0x9480 0x00000000 0 0x10000000>; /* Configuration space */
+ ranges = <0x03000000 0x9010 0x00000000 0x9010 0x00000000 0x70 0x00000000>;
+ /* node 1 */
+ numa-node-id = <1>;
+ };
+
+ distance-map {
+ compatible = "numa-distance-map-v1";
+ distance-matrix = <0 0 10>,
+ <0 1 20>,
+ <1 1 10>;
+ };

Documentation/kernel-parameters.txt

View file
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 13f89d1..09126c2 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -168,16 +168,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
acpi= [HW,ACPI,X86,ARM64]
Advanced Configuration and Power Interface
- Format: { force | off | strict | noirq | rsdt |
+ Format: { force | on | off | strict | noirq | rsdt |
copy_dsdt }
force -- enable ACPI if default was off
+ on -- enable ACPI but allow fallback to DT [arm64]
off -- disable ACPI if default was on
noirq -- do not use ACPI for IRQ routing
strict -- Be less tolerant of platforms that are not
strictly ACPI specification compliant.
rsdt -- prefer RSDT over (default) XSDT
copy_dsdt -- copy DSDT to memory
- For ARM64, ONLY "acpi=off" or "acpi=force" are available
+ For ARM64, ONLY "acpi=off", "acpi=on" or "acpi=force"
+ are available
See also Documentation/power/runtime_pm.txt, pci=noacpi

arch/arm/include/asm/kvm_host.h

View file
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 3850701..738d5ee 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -265,6 +265,15 @@ static inline void __cpu_init_stage2(void)
kvm_call_hyp(__init_stage2_translation);
}
+static inline void __cpu_reset_hyp_mode(phys_addr_t boot_pgd_ptr,
+ phys_addr_t phys_idmap_start)
+{
+ /*
+ * TODO
+ * kvm_call_reset(boot_pgd_ptr, phys_idmap_start);
+ */
+}
+
static inline int kvm_arch_dev_ioctl_check_extension(long ext)
{
return 0;
@@ -277,7 +286,6 @@ void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot);
struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr);
-static inline void kvm_arch_hardware_disable(void) {}
static inline void kvm_arch_hardware_unsetup(void) {}
static inline void kvm_arch_sync_events(struct kvm *kvm) {}
static inline void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu) {}

arch/arm/include/asm/kvm_mmu.h

View file
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h
index da44be9..f17a8d4 100644
--- a/arch/arm/include/asm/kvm_mmu.h
+++ b/arch/arm/include/asm/kvm_mmu.h
@@ -66,6 +66,7 @@ void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu);
phys_addr_t kvm_mmu_get_httbr(void);
phys_addr_t kvm_mmu_get_boot_httbr(void);
phys_addr_t kvm_get_idmap_vector(void);
+phys_addr_t kvm_get_idmap_start(void);
int kvm_mmu_init(void);
void kvm_clear_hyp_idmap(void);

arch/arm/kvm/arm.c

View file
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index dded1b7..9ef013d 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -16,7 +16,6 @@
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <linux/cpu.h>
#include <linux/cpu_pm.h>
#include <linux/errno.h>
#include <linux/err.h>
@@ -66,6 +65,8 @@ static DEFINE_SPINLOCK(kvm_vmid_lock);
static bool vgic_present;
+static DEFINE_PER_CPU(unsigned char, kvm_arm_hardware_enabled);
+
static void kvm_arm_set_running_vcpu(struct kvm_vcpu *vcpu)
{
BUG_ON(preemptible());
@@ -90,11 +91,6 @@ struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void)
return &kvm_arm_running_vcpu;
}
-int kvm_arch_hardware_enable(void)
-{
- return 0;
-}
-
int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE;
@@ -1033,11 +1029,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
}
}
-static void cpu_init_stage2(void *dummy)
-{
- __cpu_init_stage2();
-}
-
static void cpu_init_hyp_mode(void *dummy)
{
phys_addr_t boot_pgd_ptr;
@@ -1065,43 +1056,87 @@ static void cpu_hyp_reinit(void)
{
if (is_kernel_in_hyp_mode()) {
/*
- * cpu_init_stage2() is safe to call even if the PM
+ * __cpu_init_stage2() is safe to call even if the PM
* event was cancelled before the CPU was reset.
*/
- cpu_init_stage2(NULL);
+ __cpu_init_stage2();
} else {
if (__hyp_get_vectors() == hyp_default_vectors)
cpu_init_hyp_mode(NULL);
}
}
-static int hyp_init_cpu_notify(struct notifier_block *self,
- unsigned long action, void *cpu)
+static void cpu_hyp_reset(void)
+{
+ phys_addr_t boot_pgd_ptr;
+ phys_addr_t phys_idmap_start;
+
+ if (!is_kernel_in_hyp_mode()) {
+ boot_pgd_ptr = kvm_mmu_get_boot_httbr();
+ phys_idmap_start = kvm_get_idmap_start();
+
+ __cpu_reset_hyp_mode(boot_pgd_ptr, phys_idmap_start);
+ }
+}
+
+static void _kvm_arch_hardware_enable(void *discard)
{
- switch (action) {
- case CPU_STARTING:
- case CPU_STARTING_FROZEN:
+ if (!__this_cpu_read(kvm_arm_hardware_enabled)) {
cpu_hyp_reinit();
+ __this_cpu_write(kvm_arm_hardware_enabled, 1);
}
+}
+
+int kvm_arch_hardware_enable(void)
+{
+ _kvm_arch_hardware_enable(NULL);
+ return 0;
+}
- return NOTIFY_OK;
+static void _kvm_arch_hardware_disable(void *discard)
+{
+ if (__this_cpu_read(kvm_arm_hardware_enabled)) {
+ cpu_hyp_reset();
+ __this_cpu_write(kvm_arm_hardware_enabled, 0);
+ }
}
-static struct notifier_block hyp_init_cpu_nb = {
- .notifier_call = hyp_init_cpu_notify,
-};
+void kvm_arch_hardware_disable(void)
+{
+ _kvm_arch_hardware_disable(NULL);
+}
#ifdef CONFIG_CPU_PM
static int hyp_init_cpu_pm_notifier(struct notifier_block *self,
unsigned long cmd,
void *v)
{
- if (cmd == CPU_PM_EXIT) {
- cpu_hyp_reinit();
+ /*
+ * kvm_arm_hardware_enabled is left with its old value over
+ * PM_ENTER->PM_EXIT. It is used to indicate PM_EXIT should
+ * re-enable hyp.
+ */
+ switch (cmd) {
+ case CPU_PM_ENTER:
+ if (__this_cpu_read(kvm_arm_hardware_enabled))
+ /*
+ * don't update kvm_arm_hardware_enabled here
+ * so that the hardware will be re-enabled
+ * when we resume. See below.
+ */
+ cpu_hyp_reset();
+
+ return NOTIFY_OK;
+ case CPU_PM_EXIT:
+ if (__this_cpu_read(kvm_arm_hardware_enabled))
+ /* The hardware was enabled before suspend. */
+ cpu_hyp_reinit();
+
return NOTIFY_OK;
- }
- return NOTIFY_DONE;
+ default:
+ return NOTIFY_DONE;
+ }
}
static struct notifier_block hyp_init_cpu_pm_nb = {
@@ -1143,16 +1178,12 @@ static int init_common_resources(void)
static int init_subsystems(void)
{
- int err;
+ int err = 0;
/*
- * Register CPU Hotplug notifier
+ * Enable hardware so that subsystem initialisation can access EL2.
*/
- err = register_cpu_notifier(&hyp_init_cpu_nb);
- if (err) {
- kvm_err("Cannot register KVM init CPU notifier (%d)\n", err);
- return err;
- }
+ on_each_cpu(_kvm_arch_hardware_enable, NULL, 1);
/*
* Register CPU lower-power notifier
@@ -1170,9 +1201,10 @@ static int init_subsystems(void)
case -ENODEV:
case -ENXIO:
vgic_present = false;
+ err = 0;
break;
default:
- return err;
+ goto out;
}
/*
@@ -1180,12 +1212,15 @@ static int init_subsystems(void)
*/
err = kvm_timer_hyp_init();
if (err)
- return err;
+ goto out;
kvm_perf_init();
kvm_coproc_table_init();
- return 0;
+out:
+ on_each_cpu(_kvm_arch_hardware_disable, NULL, 1);
+
+ return err;
}
static void teardown_hyp_mode(void)
@@ -1198,17 +1233,11 @@ static void teardown_hyp_mode(void)
free_hyp_pgds();
for_each_possible_cpu(cpu)
free_page(per_cpu(kvm_arm_hyp_stack_page, cpu));
- unregister_cpu_notifier(&hyp_init_cpu_nb);
hyp_cpu_pm_exit();
}
static int init_vhe_mode(void)
{
- /*
- * Execute the init code on each CPU.
- */
- on_each_cpu(cpu_init_stage2, NULL, 1);
-
/* set size of VMID supported by CPU */
kvm_vmid_bits = kvm_get_vmid_bits();
kvm_info("%d-bit VMID\n", kvm_vmid_bits);
@@ -1295,11 +1324,6 @@ static int init_hyp_mode(void)
}
}
- /*
- * Execute the init code on each CPU.
- */
- on_each_cpu(cpu_init_hyp_mode, NULL, 1);
-
#ifndef CONFIG_HOTPLUG_CPU
free_boot_hyp_pgd();
#endif

arch/arm/kvm/mmu.c

View file
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index d6d4191..be30212 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -1666,6 +1666,11 @@ phys_addr_t kvm_get_idmap_vector(void)
return hyp_idmap_vector;
}
+phys_addr_t kvm_get_idmap_start(void)
+{
+ return hyp_idmap_start;

This diff is incomplete. Download the complete patch.

arch/arm64/Kconfig

View file

This diff is incomplete. Download the complete patch.

arch/arm64/Kconfig.debug

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/assembler.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/cpufeature.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/elf.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/kernel-pgtable.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/kvm_arm.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/kvm_asm.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/kvm_host.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/kvm_mmu.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/memory.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/mmu.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/mmzone.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/numa.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/page.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/pgtable-hwdef.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/pgtable-types.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/pgtable.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/smp.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/suspend.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/sysreg.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/topology.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/include/asm/virt.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/acpi.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/asm-offsets.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpu_errata.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpufeature.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpuidle.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/cpuinfo.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/debug-monitors.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/efi-entry.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/head.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/hibernate-asm.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/hibernate.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/hw_breakpoint.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/hyp-stub.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/image.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/insn.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/kaslr.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/pci.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/process.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/setup.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/sleep.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/smp.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/suspend.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/sys.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/vdso.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kernel/vmlinux.lds.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/handle_exit.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp-init.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp/entry.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/hyp/hyp-entry.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/kvm/reset.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/cache.S

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/context.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/dma-mapping.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/dump.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/fault.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/init.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/mm.h

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/mmap.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/mmu.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/numa.c

View file

This diff is incomplete. Download the complete patch.

arch/arm64/mm/proc-macros.S

View before deletion

This diff is incomplete. Download the complete patch.

arch/arm64/mm/proc.S

View file

This diff is incomplete. Download the complete patch.

arch/nios2/include/asm/io.h

View file

This diff is incomplete. Download the complete patch.

arch/nios2/include/asm/page.h

View file

This diff is incomplete. Download the complete patch.

arch/nios2/include/asm/pgtable.h

View file

This diff is incomplete. Download the complete patch.

arch/openrisc/include/asm/page.h

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/efi/arm-init.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/efi/libstub/arm64-stub.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/efi/libstub/fdt.c

View file

This diff is incomplete. Download the complete patch.

drivers/irqchip/irq-gic.c

View file

This diff is incomplete. Download the complete patch.

drivers/of/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/of/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/of/of_numa.c

View file

This diff is incomplete. Download the complete patch.

include/linux/mm.h

View file

This diff is incomplete. Download the complete patch.

include/linux/of.h

View file

This diff is incomplete. Download the complete patch.

kernel/power/swap.c

View file

This diff is incomplete. Download the complete patch.