qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Pavel Fedin <p.fedin@samsung.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] vfio: Align iova also to IOMMU page size
Date: Tue, 24 Nov 2015 15:34:30 +0000	[thread overview]
Message-ID: <CAFEAcA8LSBb0btqw3=MEkMPVAkbH1mO7WOcnGpsCmQyphjnFNA@mail.gmail.com> (raw)
In-Reply-To: <1447884282.4697.111.camel@redhat.com>

On 18 November 2015 at 22:04, Alex Williamson
<alex.williamson@redhat.com> wrote:
> On Tue, 2015-11-17 at 10:46 +0300, Pavel Fedin wrote:
>> On some architectures TARGET_PAGE_ALIGN() is not enough to get the right
>> alignment. For example on ARM TARGET_PAGE_BITS is 10 because some old CPUs
>> support 1K page size, while minimum SMMU page size is 4K.

> I don't understand how this is supposed to work, if we align to a larger
> size than the processor, then there are processor size pages of RAM than
> could be handed out as DMA targets for devices, but we can't map them
> through the IOMMU.  Thus if the guest tries to use them, we get IOMMU
> faults in the host and likely memory corruption in the guest because the
> device can't read or write to the page it's supposed to.  This doesn't
> seem like the right solution.  Thanks,

There are a number of different interesting page sizes here:
 * the host kernel page size
 * the target CPU architecture's worst-case smallest page size
 * the page size the guest kernel is actually using at the moment
   (consider a 4K-page guest kernel on a 64K-page host kernel)

These don't necessarily have to all be the same. I would
expect VFIO to be interested in the host kernel page size,
not TARGET_PAGE_ALIGN. It might also be interested in the
in-practice guest kernel page settings, but you can't actually
determine those from outside. (In general non-TCG code should
probably not try to use the TARGET_PAGE_* constants.)

thanks
-- PMM

  parent reply	other threads:[~2015-11-24 15:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  7:46 [Qemu-devel] [PATCH] vfio: Align iova also to IOMMU page size Pavel Fedin
2015-11-18 22:04 ` Alex Williamson
2015-11-19 10:29   ` Pavel Fedin
2015-11-19 23:33     ` Alex Williamson
2015-11-24 15:24       ` Pavel Fedin
2015-12-02 19:40         ` Alex Williamson
2015-12-03  9:02           ` Pavel Fedin
2015-12-03 16:26             ` Alex Williamson
2015-12-03 16:33               ` Peter Maydell
2015-12-03 17:19                 ` Alex Williamson
2015-12-03 17:36                   ` Peter Maydell
2015-12-03 17:58                     ` Alex Williamson
2015-12-07 10:53                       ` Pavel Fedin
2015-12-07 11:20                         ` Peter Maydell
2015-12-08 23:42                           ` Alex Williamson
2015-12-09  8:08                             ` Pavel Fedin
2015-12-09 10:09     ` Alex Bennée
2015-11-24 15:34   ` Peter Maydell [this message]
2015-11-25  7:00     ` Pavel Fedin
2015-12-02 19:05       ` Alex Williamson

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='CAFEAcA8LSBb0btqw3=MEkMPVAkbH1mO7WOcnGpsCmQyphjnFNA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=alex.williamson@redhat.com \
    --cc=p.fedin@samsung.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).