aarch64: virtio: be even pickier about cache maintenance

This commit is contained in:
K. Lange 2022-02-13 17:59:38 +09:00
parent 62b0b216d6
commit 54cd122d3e

View File

@ -235,12 +235,13 @@ static void virtio_tablet_thread(void * data) {
/* Inform the device we have room */
while (queue->used.index == index) {
switch_task(0);
asm volatile ("dc ivac, %0\ndsb sy" :: "r"(&queue->used) : "memory");
}
uint16_t them = queue->used.index;
for (; index < them; index++) {
asm volatile ("dc civac, %0\ndsb sy" :: "r"(&buffers[index%queue_size]) : "memory");
asm volatile ("dc ivac, %0\ndsb sy" :: "r"(&buffers[index%queue_size]) : "memory");
struct virtio_input_event evt = buffers[index%queue_size];
while (evt.type == 0xFF) {
evt = buffers[index%queue_size];
@ -381,12 +382,13 @@ static void virtio_keyboard_thread(void * data) {
/* Inform the device we have room */
while (queue->used.index == index) {
switch_task(0);
asm volatile ("dc ivac, %0\ndsb sy" :: "r"(&queue->used) : "memory");
}
uint16_t them = queue->used.index;
for (; index < them; index++) {
asm volatile ("dc civac, %0\ndsb sy" :: "r"(&buffers[index%queue_size]) : "memory");
asm volatile ("dc ivac, %0\ndsb sy" :: "r"(&buffers[index%queue_size]) : "memory");
struct virtio_input_event evt = buffers[index%queue_size];
while (evt.type == 0xFF) {
evt = buffers[index%queue_size];