aarch64: don't be so intent on running driver bringup on cpu0

This commit is contained in:
K. Lange 2022-08-30 17:11:42 +09:00
parent a70b6e58f0
commit ecbe7f6cbb
2 changed files with 13 additions and 3 deletions

View File

@ -119,8 +119,19 @@ int virtio_keyboard_responder(process_t * this, int irq, void * data) {
return 0; return 0;
} }
static void try_to_get_boot_processor(void) {
/* We would prefer these virtio startup processes run on the boot CPU, but
* it's not the end of the world if they don't. If we're not on the boot
* CPU, yield for a bit to try to get on it... */
uint64_t expire = arch_perf_timer() + 100000UL * arch_cpu_mhz();
while (this_core->cpu_id != 0) {
if (arch_perf_timer() >= expire) break;
switch_task(1);
}
}
static void virtio_tablet_thread(void * data) { static void virtio_tablet_thread(void * data) {
while (this_core->cpu_id != 0) switch_task(1); try_to_get_boot_processor();
uint32_t device = (uintptr_t)data; uint32_t device = (uintptr_t)data;
uintptr_t t = 0x12000000; uintptr_t t = 0x12000000;
@ -290,7 +301,7 @@ static const uint8_t ext_key_map[256] = {
}; };
static void virtio_keyboard_thread(void * data) { static void virtio_keyboard_thread(void * data) {
while (this_core->cpu_id != 0) switch_task(1); try_to_get_boot_processor();
uint32_t device = (uintptr_t)data; uint32_t device = (uintptr_t)data;
uintptr_t t = 0x12100000; uintptr_t t = 0x12100000;

View File

@ -504,7 +504,6 @@ static void e1000_init(struct e1000_nic * nic) {
#endif #endif
delay_yield(10000); delay_yield(10000);
while (this_core->cpu_id != 0) switch_task(1);
/* Is this size enough? */ /* Is this size enough? */
uint32_t initial_bar = pci_read_field(e1000_device_pci, PCI_BAR0, 4); uint32_t initial_bar = pci_read_field(e1000_device_pci, PCI_BAR0, 4);