For DMA in native system, operating system depends on platform
flushes icache of memory touched by DMA operations.
But as to virtual DMA of virtual machine, dma emulation code has to
use explicit instructions to flush icahce,otherwise,
guest may use old icache and leads to guest's crash.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Yang Zhang <yang.zhang@intel.com>
asm volatile ("isync" : : : "memory");
}
+#elif defined (__ia64__)
+static inline void flush_icache_range(unsigned long start, unsigned long stop)
+{
+ while (start < stop) {
+ asm volatile ("fc %0" :: "r"(start));
+ start += 32;
+ }
+ asm volatile (";;sync.i;;srlz.i;;");
+}
+
+#define qemu_cache_utils_init(envp) do { (void) (envp); } while (0)
#else
#define qemu_cache_utils_init(envp) do { (void) (envp); } while (0)
#endif
+
#endif /* QEMU_CACHE_UTILS_H */
*/
#include "qemu-common.h"
#include "host-utils.h"
+#include "cache-utils.h"
void pstrcpy(char *buf, size_t buf_size, const char *str)
{
if (copy > qiov->iov[i].iov_len)
copy = qiov->iov[i].iov_len;
memcpy(qiov->iov[i].iov_base, p, copy);
+
+#ifdef __ia64__
+ flush_icache_range((unsigned long)qiov->iov[i].iov_base,
+ (unsigned long)(qiov->iov[i].iov_base + copy));
+#endif
+
p += copy;
count -= copy;
}
#include "dma.h"
#include "block_int.h"
+#include "cache-utils.h"
void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint)
{
dbs->bh = NULL;
qemu_iovec_init(&dbs->iov, sg->nsg);
dma_bdrv_cb(dbs, 0);
+
+#ifdef __ia64__
+ if (!is_write) {
+ int i;
+ QEMUIOVector *qiov;
+ qiov = &dbs->iov;
+ for (i = 0; i < qiov->niov; ++i) {
+ flush_icache_range((unsigned long)qiov->iov[i].iov_base,
+ (unsigned long)(qiov->iov[i].iov_base + qiov->iov[i].iov_len));
+ }
+ }
+#endif
+
return dbs->acb;
}