kvm-userspace: sync icache for more architectures
PATCH 1/1 kvm-userspace: sync icache for more architectures
Subject: [PATCH][UPDATE] kvm-userspace: sync icache for more architectures
From: Christian Ehrhardt <[email protected]>
A ia64 patch introduced kvm_sync_icache within a ifdef __ia64__, but the concept of split caches is not bound to ia64. This patch replaces the the call to kvm_synch_icache by the flush_icache_range function that is already available in qemu for ia64 and ppc (noop for x86). The call now depends on USE_KVM.
qemu/exec.c +5 -2
@@ -35,6 +35,7 @@#include "cpu.h" #include "exec-all.h" #ifdef USE_KVM +#include "dyngen.h" #include "qemu-kvm.h" #endif #if defined(CONFIG_USER_ONLY )
@@ -2600,8 +2601,10 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, phys_ram_dirty[addr1 >>TARGET_PAGE_BITS ] |= (0xff & ~CODE_DIRTY_FLAG ); } -#ifdef __ia64__ -kvm_sync_icache ((unsigned long )ptr, l); +#ifdef USE_KVM +/* qemu doesn't execute guest code directly, but kvm does +therefore fluch instruction caches */ +flush_icache_range ((unsigned long )ptr, ((unsigned long )ptr)+l);#endif } }else {
qemu/hw/ipf.c +0 -11
@@ -273,17 +273,6 @@ static void pc_init_ne2k_isa(NICInfo *nd, qemu_irq *pic)#ifdef USE_KVM extern kvm_context_t kvm_context;extern int kvm_allowed; - -void kvm_sync_icache (unsigned long address,int len) -{ -int l; - -for (l =0 ; l < (len +32 ); l +=32 ) -__ia64_fc (address + l); - -ia64_sync_i (); -ia64_srlz_i (); -}#endif static void main_cpu_reset (void *opaque)
qemu/target-ia64/cpu.h +0 -5
@@ -73,9 +73,4 @@ CPUState *cpu_ia64_init(void);#include "cpu-all.h" -/* IA64 has seperate I/D cache, with coherence maintained by DMA controller. -* So to emulate right behavior that guest OS is assumed, we need to flush -* I/D cache here. -*/ -void kvm_sync_icache (unsigned long address,int len);#endif
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
A message that is not in the archive (sent off-list or not yet received): 11979832594036-git-send-email-ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
PATCH 1/1 kvm-userspace: simplify mmio callback
Subject: [PATCH][UPDATE] kvm-userspace: simplify mmio callback
From: Christian Ehrhardt <[email protected]>
Merging the read[bwlq]/write[bwlq] callback callback pointers to mmio_read/write functions simplifies the callback interface. On the qemu side it now uses the cpu_physical_memory_rw function. Additonally this patch merges the RedHat 7.1 mmio workaround that was spread to two code locations.
libkvm/libkvm.c +8 -35
@@ -826,44 +826,17 @@ static int handle_mmio(kvm_context_t kvm, struct kvm_run *kvm_run) {unsigned long addr = kvm_run->mmio.phys_addr;void *data = kvm_run->mmio.data; -int r =-1 ; -/* hack: Red Hat 7.1 generates these wierd accesses. */ -if (addr ==0xa0000 && kvm_run->mmio.len ==3 ) +/* hack: Red Hat 7.1 generates these weird accesses. */ +if ((addr >0xa0000 -4 && addr <=0xa0000 ) && kvm_run->mmio.len ==3 )return 0 ; -if (kvm_run->mmio.is_write) { -switch (kvm_run->mmio.len) { -case 1 : - r = kvm->callbacks->writeb (kvm->opaque, addr, *(uint8_t *)data); -break ; -case 2 : - r = kvm->callbacks->writew (kvm->opaque, addr, *(uint16_t *)data); -break ; -case 4 : - r = kvm->callbacks->writel (kvm->opaque, addr, *(uint32_t *)data); -break ; -case 8 : - r = kvm->callbacks->writeq (kvm->opaque, addr, *(uint64_t *)data); -break ; - } - }else { -switch (kvm_run->mmio.len) { -case 1 : - r = kvm->callbacks->readb (kvm->opaque, addr, (uint8_t *)data); -break ; -case 2 : - r = kvm->callbacks->readw (kvm->opaque, addr, (uint16_t *)data); -break ; -case 4 : - r = kvm->callbacks->readl (kvm->opaque, addr, (uint32_t *)data); -break ; -case 8 : - r = kvm->callbacks->readq (kvm->opaque, addr, (uint64_t *)data); -break ; - } - } -return r; +if (kvm_run->mmio.is_write) +return kvm->callbacks->mmio_write (kvm->opaque, addr, data, + kvm_run->mmio.len); +else +return kvm->callbacks->mmio_read (kvm->opaque, addr, data, + kvm_run->mmio.len); }int handle_io_window (kvm_context_t kvm)
libkvm/libkvm.h +6 -16
@@ -45,22 +45,12 @@ struct kvm_callbacks {int (*outw)(void *opaque,uint16_t addr,uint16_t data);/// For 32bit IO writes from the guest (Usually when executing 'outl') int (*outl)(void *opaque,uint16_t addr,uint32_t data); -/// For 8bit memory reads from unmapped memory (For MMIO devices) -int (*readb)(void *opaque,uint64_t addr,uint8_t *data); -/// For 16bit memory reads from unmapped memory (For MMIO devices) -int (*readw)(void *opaque,uint64_t addr,uint16_t *data); -/// For 32bit memory reads from unmapped memory (For MMIO devices) -int (*readl)(void *opaque,uint64_t addr,uint32_t *data); -/// For 64bit memory reads from unmapped memory (For MMIO devices) -int (*readq)(void *opaque,uint64_t addr,uint64_t *data); -/// For 8bit memory writes to unmapped memory (For MMIO devices) -int (*writeb)(void *opaque,uint64_t addr,uint8_t data); -/// For 16bit memory writes to unmapped memory (For MMIO devices) -int (*writew)(void *opaque,uint64_t addr,uint16_t data); -/// For 32bit memory writes to unmapped memory (For MMIO devices) -int (*writel)(void *opaque,uint64_t addr,uint32_t data); -/// For 64bit memory writes to unmapped memory (For MMIO devices) -int (*writeq)(void *opaque,uint64_t addr,uint64_t data); +/// generic memory reads to unmapped memory (For MMIO devices) +int (*mmio_read)(void *opaque,uint64_t addr,uint8_t *data, +int len); +/// generic memory writes to unmapped memory (For MMIO devices) +int (*mmio_write)(void *opaque,uint64_t addr,uint8_t *data, +int len);int (*debug)(void *opaque,int vcpu);/*! * \brief Called when the VCPU issues an 'hlt' instruction.
qemu/qemu-kvm.c +9 -55
81 lines not on this page · raw message
user/main.c +4 -50
78 lines not on this page · raw message
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
A message that is not in the archive (sent off-list or not yet received): 11979832622415-git-send-email-ehrhardt-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Re: [PATCH][UPDATE] kvm-userspace: simplify mmio callback
Quoted 9 lines · Christian Ehrhardt
Subject: [PATCH][UPDATE] kvm-userspace: simplify mmio callback
From: Christian Ehrhardt <[email protected]>Merging the read[bwlq]/write[bwlq] callback callback pointers to mmio_read/write functions simplifies the callback interface. On the qemu side it now uses the
cpu_physical_memory_rwfunction. Additonally this patch merges the RedHat 7.1 mmio workaround that was spread to two code locations.
Applied (after much mulling), thanks.
Signature · 9 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Avi Kivity
AppliedQuoted 10 lines · Christian Ehrhardt
Subject: [PATCH][UPDATE] kvm-userspace: sync icache for more architectures
From: Christian Ehrhardt <[email protected]>A ia64 patch introduced
kvm_sync_icachewithin a ifdef__ia64__, but the concept of split caches is not bound to ia64. This patch replaces the the call tokvm_synch_icacheby theflush_icache_rangefunction that is already available in qemu for ia64 and ppc (noop for x86). The call now depends onUSE_KVM.
Applied, thanks.
Signature · 9 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace