public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: KVM <kvm@vger.kernel.org>,
	Varun Sethi <Varun.Sethi@freescale.com>,
	Will Deacon <will.deacon@arm.com>
Subject: VFIO iommu page size masking
Date: Fri, 13 Feb 2015 03:41:59 +0100	[thread overview]
Message-ID: <54DD6477.9050008@suse.de> (raw)

Hi Alex,

While trying to get VFIO-PCI working on AArch64 (with 64k page size), I
stumbled over the following piece of code:

> static unsigned long vfio_pgsize_bitmap(struct vfio_iommu *iommu)
> {
>         struct vfio_domain *domain;
>         unsigned long bitmap = PAGE_MASK;
> 
>         mutex_lock(&iommu->lock);
>         list_for_each_entry(domain, &iommu->domain_list, next)
>                 bitmap &= domain->domain->ops->pgsize_bitmap;
>         mutex_unlock(&iommu->lock);
> 
>         return bitmap;
> }

The SMMU page mask is

[    3.054302] arm-smmu e0a00000.smmu: 	Supported page sizes: 0x40201000

but after this function, we end up supporting one 2MB pages and above.
The reason for that is simple: You restrict the bitmap to PAGE_MASK and
above.

Now the big question is why you're doing that. I don't see why it would
be a problem if the IOMMU maps a page in smaller chunks.

So I tried to patch the code above with s/PAGE_MASK/1UL/ and everything
seems to run fine. But maybe we're not lacking some sanity checks?


Alex

             reply	other threads:[~2015-02-13  2:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-13  2:41 Alexander Graf [this message]
2015-02-13 16:31 ` VFIO iommu page size masking 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=54DD6477.9050008@suse.de \
    --to=agraf@suse.de \
    --cc=Varun.Sethi@freescale.com \
    --cc=alex.williamson@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /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