qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Alex Williamson <alex.williamson@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 3/3] vfio: Fix 128 bit handling
Date: Thu, 22 Aug 2013 13:13:23 +0200	[thread overview]
Message-ID: <5215F253.3050205@redhat.com> (raw)
In-Reply-To: <5215EAC5.3050101@ozlabs.ru>

Il 22/08/2013 12:41, Alexey Kardashevskiy ha scritto:
> On 08/22/2013 07:11 PM, Paolo Bonzini wrote:
>> Il 22/08/2013 10:20, Alexey Kardashevskiy ha scritto:
>>>      iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);
>>> -    end = (section->offset_within_address_space + int128_get64(section->size)) &
>>> -          TARGET_PAGE_MASK;
>>> +    llend = int128_make64(section->offset_within_address_space);
>>> +    llend = int128_add(llend, section->size);
>>> +    llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK));
>>>  
>>> -    if (iova >= end) {
>>> +    if (int128_ge(int128_make64(iova), llend)) {
>>>          return;
>>>      }
>>>  
>>> +    end = (section->offset_within_address_space + int128_get64(section->size)) &
>>> +          TARGET_PAGE_MASK;
>>> +
>>
>> This can still fail for section->size = 2^64.  Do your IOMMU patches
>> take care of it?
> 
> Nope. That part works for IOMMU mapped to RAM which is smaller than 2^64
> bytes and therefore I do not see why we would need 2^64 bits sizes there.

Understood.  So the IOMMU patches take care of it because this code is
only used for non-IOMMU regions.  Thanks,

Paolo

> Either way, I cannot test it quick (yes, I know, I should have some x86
> VFIO setup by hand as everyone has a lot of x86, etc...) so I decided to
> leave to the moment when x86 folks hit the problem :)
> 
> 

      reply	other threads:[~2013-08-22 11:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-22  8:20 [Qemu-devel] [PATCH v2 0/3] vfio: fixes for better support for 128 bit memory section sizes Alexey Kardashevskiy
2013-08-22  8:20 ` [Qemu-devel] [PATCH v2 1/3] int128: add int128_exts64() Alexey Kardashevskiy
2013-08-22  9:09   ` Paolo Bonzini
2013-08-22  9:47     ` Peter Maydell
2013-08-22  9:48       ` Paolo Bonzini
2013-08-22 10:43         ` Peter Maydell
2013-08-22 10:50         ` Alexey Kardashevskiy
2013-08-22 11:14           ` Paolo Bonzini
2013-08-22  8:20 ` [Qemu-devel] [PATCH v2 2/3] vfio: Fix debug output for int128 values Alexey Kardashevskiy
2013-08-22  8:20 ` [Qemu-devel] [PATCH v2 3/3] vfio: Fix 128 bit handling Alexey Kardashevskiy
2013-08-22  9:11   ` Paolo Bonzini
2013-08-22 10:41     ` Alexey Kardashevskiy
2013-08-22 11:13       ` Paolo Bonzini [this message]

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=5215F253.3050205@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=alex.williamson@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).