FABRIC-3.10.8 MC-1b: aarch64's second core online and parked
Cores from the DTB /cpus or, on QEMU (ACPI, no DTB), the MADT GICC entries; the MADT lookup is now shared (hal/acpi.c) with amd64. PSCI CPU_ON through the discovered conduit into ap_entry.S, which copies the boot core's MMU/control state, sets TPIDR_EL1 and parks. Core 1 online at EL1 with its own block; its vCPU thread 0.0% on the host. QEMU aarch64 -smp 2 -name debug-threads=on. 3-ISA acceptance clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
24bde47481
commit
3a2ba5149f
@@ -27,6 +27,7 @@
|
||||
#include "starkernel/apic.h"
|
||||
#include "starkernel/timer.h"
|
||||
#include "starkernel/console.h"
|
||||
#include "starkernel/acpi.h" /* MC-1b: the MADT lookup, shared with aarch64 */
|
||||
#include "uefi.h"
|
||||
|
||||
extern char sk_ap_tramp_start[], sk_ap_tramp_end[];
|
||||
@@ -49,48 +50,6 @@ typedef struct __attribute__((packed)) {
|
||||
|
||||
/* ---- MADT ---------------------------------------------------------------- */
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t signature[8];
|
||||
uint8_t checksum;
|
||||
uint8_t oem_id[6];
|
||||
uint8_t revision;
|
||||
uint32_t rsdt_address;
|
||||
uint32_t length;
|
||||
uint64_t xsdt_address;
|
||||
} smp_rsdp_t;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t signature[4];
|
||||
uint32_t length;
|
||||
uint8_t rest[28];
|
||||
} smp_sdt_t;
|
||||
|
||||
static int sig_eq(const uint8_t *p, const char *s, int n)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n; i++) if (p[i] != (uint8_t)s[i]) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const uint8_t *find_madt(void *rsdp_ptr)
|
||||
{
|
||||
const smp_rsdp_t *r = (const smp_rsdp_t *)rsdp_ptr;
|
||||
const smp_sdt_t *xsdt;
|
||||
const uint64_t *ent;
|
||||
uint32_t n, i;
|
||||
|
||||
if (!r || !sig_eq(r->signature, "RSD PTR ", 8) || r->revision < 2 || !r->xsdt_address) return 0;
|
||||
xsdt = (const smp_sdt_t *)(uintptr_t)r->xsdt_address;
|
||||
if (!sig_eq(xsdt->signature, "XSDT", 4) || xsdt->length <= 36u) return 0;
|
||||
n = (xsdt->length - 36u) / 8u;
|
||||
ent = (const uint64_t *)((const uint8_t *)xsdt + 36u);
|
||||
for (i = 0; i < n; i++) {
|
||||
const smp_sdt_t *sdt = (const smp_sdt_t *)(uintptr_t)ent[i];
|
||||
if (sdt && sig_eq(sdt->signature, "APIC", 4)) return (const uint8_t *)sdt;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int id_seen(const uint64_t *ids, uint32_t n, uint64_t id)
|
||||
{
|
||||
uint32_t i;
|
||||
@@ -102,7 +61,7 @@ static int id_seen(const uint64_t *ids, uint32_t n, uint64_t id)
|
||||
* id fits xAPIC (<= 255) and was not already listed. */
|
||||
uint32_t arch_smp_enumerate(BootInfo *boot_info, uint64_t *hw_ids, uint32_t cap)
|
||||
{
|
||||
const uint8_t *madt = find_madt(boot_info ? boot_info->acpi_table : (void *)0);
|
||||
const uint8_t *madt = acpi_find_table(boot_info ? boot_info->acpi_table : (void *)0, "APIC");
|
||||
const uint8_t *p, *end;
|
||||
uint32_t n = 0, pass;
|
||||
|
||||
@@ -110,7 +69,7 @@ uint32_t arch_smp_enumerate(BootInfo *boot_info, uint64_t *hw_ids, uint32_t cap)
|
||||
if (cap) hw_ids[0] = apic_id();
|
||||
return 1;
|
||||
}
|
||||
end = madt + ((const smp_sdt_t *)madt)->length;
|
||||
end = madt + acpi_table_length(madt);
|
||||
for (pass = 0; pass < 2; pass++) {
|
||||
for (p = madt + 44; p + 2 <= end; p += p[1]) {
|
||||
uint64_t id;
|
||||
@@ -148,6 +107,12 @@ void arch_smp_park_once(void)
|
||||
__asm__ volatile ("cli; hlt" ::: "memory");
|
||||
}
|
||||
|
||||
const char *arch_smp_arrival(const sk_percpu_t *pc)
|
||||
{
|
||||
(void)pc;
|
||||
return "long mode"; /* the trampoline's only way to reach C */
|
||||
}
|
||||
|
||||
/* ---- the trampoline page ------------------------------------------------- */
|
||||
|
||||
static uint64_t g_tramp_page; /* 0 = not chosen yet */
|
||||
|
||||
Reference in New Issue
Block a user