qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v9 06/27] virtio-blk: Take PCI memory range into a


From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [RFC v9 06/27] virtio-blk: Take PCI memory range into account
Date: Wed, 18 Jul 2012 21:29:50 +0300

On Wed, Jul 18, 2012 at 04:07:33PM +0100, Stefan Hajnoczi wrote:
> Support >4 GB physical memory accesses.
> 
> Signed-off-by: Stefan Hajnoczi <address@hidden>

Need some sane APIs, this is just too scary.

> ---
>  hw/virtio-blk.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
> index abd9386..99654f1 100644
> --- a/hw/virtio-blk.c
> +++ b/hw/virtio-blk.c
> @@ -64,6 +64,13 @@ static VirtIOBlock *to_virtio_blk(VirtIODevice *vdev)
>   */
>  static inline void *phys_to_host(VirtIOBlock *s, target_phys_addr_t phys)
>  {
> +    /* Adjust for 3.6-4 GB PCI memory range */
> +    if (phys >= 0x100000000) {
> +        phys -= 0x100000000 - 0xe0000000;
> +    } else if (phys >= 0xe0000000) {
> +        fprintf(stderr, "phys_to_host bad physical address in PCI range 
> %#lx\n", phys);
> +        exit(1);
> +    }
>      return s->phys_mem_zero_host_ptr + phys;
>  }
>  
> -- 
> 1.7.10.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]