Implement minimal PSCI 1.1.
Only the mandatory functions are supported. This required adding
PSCI_FEATURES which is used to discover which PSCI features are
available and PSCI_CPU_SUSPEND which can put CPUs into low power states.
The hypervisor acts as an adapter for lower version of PSCI running in
EL3.
When waking from a powered down suspend, the CPU needs to be reset to
the same state as when it is first turned on. Only the entry point and
context argument should be present.
Change-Id: I088f214258a1cdd429bee63f1846603057769217
diff --git a/inc/hf/arch/cpu.h b/inc/hf/arch/cpu.h
index aba76aa..bc3a583 100644
--- a/inc/hf/arch/cpu.h
+++ b/inc/hf/arch/cpu.h
@@ -35,10 +35,11 @@
void arch_irq_enable(void);
/**
- * Initializes the register state for a VM.
+ * Reset the register values other than the PC and argument which are set with
+ * `arch_regs_set_pc_arg()`.
*/
-void arch_regs_init(struct arch_regs *r, bool is_primary, uint64_t vmid,
- paddr_t table, uint32_t index);
+void arch_regs_reset(struct arch_regs *r, bool is_primary, uint64_t vmid,
+ paddr_t table, uint32_t index);
/**
* Updates the given registers so that when a vcpu runs, it starts off at the
diff --git a/inc/hf/arch/init.h b/inc/hf/arch/init.h
new file mode 100644
index 0000000..ab0398a
--- /dev/null
+++ b/inc/hf/arch/init.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2019 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+/**
+ * Performs arch specific boot time initialization.
+ *
+ * It must only be called once, on first boot and must be called as early as
+ * possible.
+ */
+void arch_one_time_init(void);
diff --git a/inc/hf/cpu.h b/inc/hf/cpu.h
index 4812abf..7155fde 100644
--- a/inc/hf/cpu.h
+++ b/inc/hf/cpu.h
@@ -132,7 +132,7 @@
struct cpu *cpu_find(size_t id);
void vcpu_init(struct vcpu *vcpu, struct vm *vm);
-void vcpu_on(struct vcpu *vcpu);
+void vcpu_on(struct vcpu *vcpu, ipaddr_t entry, uintreg_t arg);
void vcpu_off(struct vcpu *vcpu);
size_t vcpu_index(const struct vcpu *vcpu);