Skip to content

Commit b37c049

Browse files
yakuizhaojren1
authored andcommitted
HV: Use mmio_read/write_long for IOAPIC mmio-access
This is to do the clean-up of IOAPIC mmio-access. Use the same API to access the IOAPIC register. At the same time it also helps to avoid the optimization in direct access mode.(The volatile is already added in mmio_read_long/mmio_write_long) V1->V2: Follow Fengwei's suggestion to use the mmio_read/write_long Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
1 parent ec13f4e commit b37c049

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hypervisor/arch/x86/ioapic.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ ioapic_read_reg32(const void *ioapic_base, const uint8_t offset)
9595
spinlock_irqsave_obtain(&ioapic_lock);
9696

9797
/* Write IOREGSEL */
98-
*(uint32_t *)(ioapic_base) = offset;
98+
mmio_write_long(offset, (void *)ioapic_base);
9999
/* Read IOWIN */
100-
v = *(uint32_t *)(ioapic_base + IOAPIC_WINSWL_OFFSET);
100+
v = mmio_read_long((void *)ioapic_base + IOAPIC_WINSWL_OFFSET);
101101

102102
spinlock_irqrestore_release(&ioapic_lock);
103103
return v;
@@ -112,9 +112,9 @@ ioapic_write_reg32(const void *ioapic_base,
112112
spinlock_irqsave_obtain(&ioapic_lock);
113113

114114
/* Write IOREGSEL */
115-
*(uint32_t *)(ioapic_base) = offset;
115+
mmio_write_long(offset, (void *)ioapic_base);
116116
/* Write IOWIN */
117-
*(uint32_t *)(ioapic_base + IOAPIC_WINSWL_OFFSET) = value;
117+
mmio_write_long(value, (void *)ioapic_base + IOAPIC_WINSWL_OFFSET);
118118

119119
spinlock_irqrestore_release(&ioapic_lock);
120120
}

0 commit comments

Comments
 (0)