LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
Cc: "eric.auger@redhat.com" <eric.auger@redhat.com>,
	"pmorel@linux.vnet.ibm.com" <pmorel@linux.vnet.ibm.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	Linuxarm <linuxarm@huawei.com>,
	"John Garry" <john.garry@huawei.com>,
	"xuwei (O)" <xuwei5@huawei.com>, Joerg Roedel <joro@8bytes.org>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v6 0/7] vfio/type1: Add support for valid iova list management
Date: Tue, 5 Jun 2018 11:03:04 -0600	[thread overview]
Message-ID: <20180605110304.33e14b0d@w520.home> (raw)
In-Reply-To: <20180525145408.2938a9ec@w520.home>

[Cc +dwmw2]

On Fri, 25 May 2018 14:54:08 -0600
Alex Williamson <alex.williamson@redhat.com> wrote:

> On Fri, 25 May 2018 08:45:36 +0000
> Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> wrote:
> 
> > Yes, the above changes related to list empty cases looks fine to me.   
> 
> Thanks Shameer, applied to my next branch with the discussed fixes for
> v4.18 (modulo patch 4/7 which Joerg already pushed for v4.17).  Thanks,

Hi Shameer,

We're still hitting issues with this.  VT-d marks reserved regions for
any RMRR ranges, which are IOVA ranges that the BIOS requests to be
identity mapped for a device.  These are indicated by these sorts of
log entries on boot:

 DMAR: Setting RMRR:
 DMAR: Setting identity map for device 0000:00:02.0 [0xbf800000 - 0xcf9fffff]
 DMAR: Setting identity map for device 0000:00:1a.0 [0xbe8d1000 - 0xbe8dffff]
 DMAR: Setting identity map for device 0000:00:1d.0 [0xbe8d1000 - 0xbe8dffff]

So while for an unaffected device, I see very usable ranges for QEMU,
such as:

	00: 0000000000000000 - 00000000fedfffff
	01: 00000000fef00000 - 01ffffffffffffff

If I try to assign the previously assignable 00:02.0 IGD graphics
device, I get:

	00: 0000000000000000 - 00000000bf7fffff
	01: 00000000cfa00000 - 00000000fedfffff
	02: 00000000fef00000 - 01ffffffffffffff

And we get a fault when QEMU tries the following mapping:

vfio_dma_map(0x55f790421a20, 0x100000, 0xbff00000, 0x7ff163f00000)

bff00000 clearly extends into the gap starting at bf800000.  VT-d is
rather split-brained about RMRRs, typically we'd exclude devices from
assignment at all for relying on RMRRs and these reserved ranges
would be a welcome mechanism to avoid conflicts with those ranges, but
for RMRR ranges covering IGD and USB devices we've decided that we
don't need to honor the RMRR (see device_is_rmrr_locked()), but it's
still listed as a reserved range and bites us here.

Unless we can get VT-d to exclude RMRRs from reserved regions where
we've already seen fit to allow the devices to participate in the IOMMU
API, this would introduce a functional regression for assignment of
these devices.  David, should we skip GFX and USB devices with RMRRs in
intel_iommu_get_resv_regions() just as we do in
device_is_rmrr_locked()?  Thanks,

Alex

  reply	other threads:[~2018-06-05 17:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 11:40 Shameer Kolothum
2018-04-18 11:40 ` [PATCH v6 1/7] vfio/type1: Introduce iova list and add iommu aperture validity check Shameer Kolothum
2018-04-18 11:40 ` [PATCH v6 2/7] vfio/type1: Check reserve region conflict and update iova list Shameer Kolothum
2018-04-18 11:40 ` [PATCH v6 3/7] vfio/type1: Update iova list on detach Shameer Kolothum
2018-04-18 11:40 ` [PATCH v6 4/7] iommu/dma: Move PCI window region reservation back into dma specific path Shameer Kolothum
2018-04-24 13:16   ` Shameerali Kolothum Thodi
2018-04-30 16:10     ` Alex Williamson
2018-05-03 13:16   ` Joerg Roedel
2018-04-18 11:40 ` [PATCH v6 5/7] vfio/type1: check dma map request is within a valid iova range Shameer Kolothum
2018-04-18 11:40 ` [PATCH v6 6/7] vfio/type1: Add IOVA range capability support Shameer Kolothum
2018-04-18 11:40 ` [PATCH v6 7/7] vfio/type1: remove duplicate retrieval of reserved regions Shameer Kolothum
2018-05-24 18:20 ` [PATCH v6 0/7] vfio/type1: Add support for valid iova list management Alex Williamson
2018-05-25  8:45   ` Shameerali Kolothum Thodi
2018-05-25 20:54     ` Alex Williamson
2018-06-05 17:03       ` Alex Williamson [this message]
2018-06-06  6:52         ` Shameerali Kolothum Thodi
2018-06-07 15: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=20180605110304.33e14b0d@w520.home \
    --to=alex.williamson@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=john.garry@huawei.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=pmorel@linux.vnet.ibm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=xuwei5@huawei.com \
    --subject='Re: [PATCH v6 0/7] vfio/type1: Add support for valid iova list management' \
    /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

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).