Get the cpu IDs from the FDT.
These are the IDs used to identify cores in PSCI.
Change-Id: I9e88a6c69f963864591e39f0191cdd5ce824ce6d
diff --git a/inc/hf/arch/cpu.h b/inc/hf/arch/cpu.h
index bc3a583..77d93d2 100644
--- a/inc/hf/arch/cpu.h
+++ b/inc/hf/arch/cpu.h
@@ -38,8 +38,8 @@
* Reset the register values other than the PC and argument which are set with
* `arch_regs_set_pc_arg()`.
*/
-void arch_regs_reset(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 vm_id,
+ uint64_t vcpu_id, paddr_t table);
/**
* Updates the given registers so that when a vcpu runs, it starts off at the
diff --git a/inc/hf/boot_params.h b/inc/hf/boot_params.h
index db57d56..43d969a 100644
--- a/inc/hf/boot_params.h
+++ b/inc/hf/boot_params.h
@@ -31,6 +31,8 @@
};
struct boot_params {
+ uint64_t cpu_ids[MAX_CPUS];
+ size_t cpu_count;
struct mem_range mem_ranges[MAX_MEM_RANGES];
size_t mem_ranges_count;
paddr_t initrd_begin;
diff --git a/inc/hf/cpu.h b/inc/hf/cpu.h
index 7155fde..61e1edb 100644
--- a/inc/hf/cpu.h
+++ b/inc/hf/cpu.h
@@ -103,7 +103,7 @@
/* TODO: Update alignment such that cpus are in different cache lines. */
struct cpu {
/** CPU identifier. Doesn't have to be contiguous. */
- size_t id;
+ uint64_t id;
/** Pointer to bottom of the stack. */
void *stack_bottom;
@@ -121,15 +121,14 @@
bool is_on;
};
-void cpu_module_init(void);
+void cpu_module_init(const uint64_t *cpu_ids, size_t count);
-void cpu_init(struct cpu *c);
size_t cpu_index(struct cpu *c);
void cpu_irq_enable(struct cpu *c);
void cpu_irq_disable(struct cpu *c);
bool cpu_on(struct cpu *c, ipaddr_t entry, uintreg_t arg);
void cpu_off(struct cpu *c);
-struct cpu *cpu_find(size_t id);
+struct cpu *cpu_find(uint64_t id);
void vcpu_init(struct vcpu *vcpu, struct vm *vm);
void vcpu_on(struct vcpu *vcpu, ipaddr_t entry, uintreg_t arg);
diff --git a/inc/hf/fdt_handler.h b/inc/hf/fdt_handler.h
index 3f72218..10d1189 100644
--- a/inc/hf/fdt_handler.h
+++ b/inc/hf/fdt_handler.h
@@ -24,6 +24,8 @@
struct fdt_header *fdt_map(paddr_t fdt_addr, struct fdt_node *n,
struct mpool *ppool);
bool fdt_unmap(struct fdt_header *fdt, struct mpool *ppool);
+void fdt_find_cpus(const struct fdt_node *root, uint64_t *cpu_ids,
+ size_t *cpu_count);
void fdt_find_memory_ranges(const struct fdt_node *root, struct boot_params *p);
bool fdt_find_initrd(struct fdt_node *n, paddr_t *begin, paddr_t *end);
diff --git a/inc/hf/vm.h b/inc/hf/vm.h
index be49524..e70b809 100644
--- a/inc/hf/vm.h
+++ b/inc/hf/vm.h
@@ -97,6 +97,7 @@
bool vm_init(uint32_t vcpu_count, struct mpool *ppool, struct vm **new_vm);
uint32_t vm_get_count(void);
struct vm *vm_get(uint32_t id);
-void vm_start_vcpu(struct vm *vm, size_t index, ipaddr_t entry, uintreg_t arg);
+void vm_secondary_start_vcpu(struct vm *vm, size_t index, ipaddr_t entry,
+ uintreg_t arg);
void vm_lock(struct vm *vm, struct vm_locked *locked);
void vm_unlock(struct vm_locked *locked);