Re: [PATCH] qemu-kvm: Flush icache after dma operations for ia64

Avi Kivity <[email protected]>
Newsgroups org.kernel.vger.kvm-ia64,org.kernel.vger.kvm
Message-ID <[email protected]>
Jes Sorensen wrote:
>  
> +/*
> + * Is this correct for PPC?
> + */
> +#define dma_flush_range(start, end)                  \
> +    do { (void) (start); (void) (end); } while (0)
>   

Correct or not, should be a function/

> +#define dma_flush_range(start, end)              \
> +    do { (void) (start); (void) (end); } while (0)
>  
>   
Another function.

> @@ -24,6 +24,7 @@
>  #include "qemu-common.h"
>  #include "host-utils.h"
>  #include <assert.h>
> +#include "cache-utils.h"
>  
>  void pstrcpy(char *buf, int buf_size, const char *str)
>  {
> @@ -176,6 +177,10 @@
>          if (copy > qiov->iov[i].iov_len)
>              copy = qiov->iov[i].iov_len;
>          memcpy(qiov->iov[i].iov_base, p, copy);
> +
> +        dma_flush_range((unsigned long)qiov->iov[i].iov_base,
> +                        (unsigned long)qiov->iov[i].iov_base + copy);
> +
>   

Bogus.

>  static AIOPool dma_aio_pool;
>  
> @@ -149,6 +150,17 @@
>      dbs->bh = NULL;
>      qemu_iovec_init(&dbs->iov, sg->nsg);
>      dma_bdrv_cb(dbs, 0);
> +
> +    if (!is_write) {
> +        int i;
> +        QEMUIOVector *qiov;
> +        qiov = &dbs->iov;
> +        for (i = 0; i < qiov->niov; ++i) {
> +            dma_flush_range((unsigned long)qiov->iov[i].iov_base,
> +                (unsigned long)(qiov->iov[i].iov_base + qiov->iov[i].iov_len));
> +	}
> +    }
> +
>   

cpu_physical_memory_unmap() will do this for you...

>  
>  #if !defined(TARGET_IA64)
>  #include "tcg.h"
> @@ -3385,6 +3386,8 @@
>  void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len,
>                                 int is_write, target_phys_addr_t access_len)
>  {
> +    unsigned long flush_len = (unsigned long)access_len;
> +
>      if (buffer != bounce.buffer) {
>          if (is_write) {
>              ram_addr_t addr1 = qemu_ram_addr_from_host(buffer);
> @@ -3402,7 +3405,9 @@
>                  }
>                  addr1 += l;
>                  access_len -= l;
> -            }
> +	    }
> +	    dma_flush_range((unsigned long)buffer,
> +			    (unsigned long)buffer + flush_len);
>          }
>   

... here.

-- 
error compiling committee.c: too many arguments to function
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.