All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Li Qiang <liq3ea@163.com>, pbonzini@redhat.com, jslaby@suse.cz
Cc: liq3ea@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 3/3] edu: uses uint64_t in dma operation
Date: Wed, 22 May 2019 13:01:46 +0200	[thread overview]
Message-ID: <6721f9ce-3150-d491-106c-fb2dfb3b7327@redhat.com> (raw)
In-Reply-To: <20190510164349.81507-4-liq3ea@163.com>

On 5/10/19 6:43 PM, Li Qiang wrote:
> The dma related variable dma.dst/src/cnt is dma_addr_t, it is
> uint64_t in x64 platform. Change these usage from uint32_to
> uint64_t to avoid trancation in edu_dma_timer.
> 
> Signed-off-by: Li Qiang <liq3ea@163.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
> Change since v3:
> Change 'size2' para of 'edu_check_range' to 64-bits.
> 
>  hw/misc/edu.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/misc/edu.c b/hw/misc/edu.c
> index 33de05141f..19e5545e2c 100644
> --- a/hw/misc/edu.c
> +++ b/hw/misc/edu.c
> @@ -98,23 +98,24 @@ static void edu_lower_irq(EduState *edu, uint32_t val)
>      }
>  }
>  
> -static bool within(uint32_t addr, uint32_t start, uint32_t end)
> +static bool within(uint64_t addr, uint64_t start, uint64_t end)
>  {
>      return start <= addr && addr < end;
>  }
>  
> -static void edu_check_range(uint32_t addr, uint32_t size1, uint32_t start,
> -                uint32_t size2)
> +static void edu_check_range(uint64_t addr, uint64_t size1, uint64_t start,
> +                uint64_t size2)
>  {
> -    uint32_t end1 = addr + size1;
> -    uint32_t end2 = start + size2;
> +    uint64_t end1 = addr + size1;
> +    uint64_t end2 = start + size2;
>  
>      if (within(addr, start, end2) &&
>              end1 > addr && within(end1, start, end2)) {
>          return;
>      }
>  
> -    hw_error("EDU: DMA range 0x%.8x-0x%.8x out of bounds (0x%.8x-0x%.8x)!",
> +    hw_error("EDU: DMA range 0x%016"PRIx64"-0x%016"PRIx64
> +             " out of bounds (0x%016"PRIx64"-0x%016"PRIx64")!",
>              addr, end1 - 1, start, end2 - 1);
>  }
>  
> @@ -139,13 +140,13 @@ static void edu_dma_timer(void *opaque)
>      }
>  
>      if (EDU_DMA_DIR(edu->dma.cmd) == EDU_DMA_FROM_PCI) {
> -        uint32_t dst = edu->dma.dst;
> +        uint64_t dst = edu->dma.dst;
>          edu_check_range(dst, edu->dma.cnt, DMA_START, DMA_SIZE);
>          dst -= DMA_START;
>          pci_dma_read(&edu->pdev, edu_clamp_addr(edu, edu->dma.src),
>                  edu->dma_buf + dst, edu->dma.cnt);
>      } else {
> -        uint32_t src = edu->dma.src;
> +        uint64_t src = edu->dma.src;
>          edu_check_range(src, edu->dma.cnt, DMA_START, DMA_SIZE);
>          src -= DMA_START;
>          pci_dma_write(&edu->pdev, edu_clamp_addr(edu, edu->dma.dst),
> 


  reply	other threads:[~2019-05-22 11:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 16:43 [Qemu-devel] [PATCH v4 0/3] hw: edu: some fixes Li Qiang
2019-05-10 16:43 ` [Qemu-devel] [PATCH v4 1/3] edu: mmio: allow 64-bit access Li Qiang
2019-05-10 16:43 ` [Qemu-devel] [PATCH v4 2/3] edu: mmio: allow 64-bit access in read dispatch Li Qiang
2019-05-10 16:43 ` [Qemu-devel] [PATCH v4 3/3] edu: uses uint64_t in dma operation Li Qiang
2019-05-22 11:01   ` Philippe Mathieu-Daudé [this message]
2019-05-10 23:53 ` [Qemu-devel] [PATCH v4 0/3] hw: edu: some fixes Peter Xu
2019-05-11  0:40   ` Li Qiang
2019-05-21 13:30 ` Li Qiang
2019-05-22  8:29   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6721f9ce-3150-d491-106c-fb2dfb3b7327@redhat.com \
    --to=philmd@redhat.com \
    --cc=jslaby@suse.cz \
    --cc=liq3ea@163.com \
    --cc=liq3ea@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.