All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
To: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
	Alex Williamson
	<alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: iommu
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"eric.auger" <eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass
Date: Thu, 29 Oct 2015 18:42:10 +0000	[thread overview]
Message-ID: <56326882.10109@arm.com> (raw)
In-Reply-To: <20151029182819.GJ3440-5wv7dgnIgG8@public.gmane.org>

On 29/10/15 18:28, Will Deacon wrote:
> On Tue, Oct 27, 2015 at 10:00:11AM -0600, Alex Williamson wrote:
>> On Tue, 2015-10-27 at 15:40 +0000, Will Deacon wrote:
>>> On Fri, Oct 16, 2015 at 09:51:22AM -0600, Alex Williamson wrote:
>>>> Would it be possible to add iommu_domain_geometry support to arm-smmu.c?
>>>> In addition to this test to verify that DMA cannot bypass the IOMMU, I'd
>>>> eventually like to pass the aperture information out through the VFIO
>>>> API.  Thanks,
>>>
>>> The slight snag here is that we don't know which SMMU in the system the
>>> domain is attached to at the point when the geometry is queried, so I
>>> can't give you an upper bound on the aperture. For example, if there is
>>> an SMMU with a 32-bit input address and another with a 48-bit input
>>> address.
>>>
>>> We could play the same horrible games that we do with the pgsize bitmap,
>>> and truncate some global aperture everytime we probe an SMMU device, but
>>> I'd really like to have fewer hacks like that if possible. The root of
>>> the problem is still that domains are allocated for a bus, rather than
>>> an IOMMU instance.
>>
>> Yes, Intel VT-d has this issue as well.  In theory we can have
>> heterogeneous IOMMU hardware units (DRHDs) in a system and the upper
>> bound of the geometry could be diminished if we add a less capable DRHD
>> into the domain.  I suspect this is more a theoretical problem than a
>> practical one though as we're typically mixing similar DRHDs and I think
>> we're still capable of 39-bit addressing in the least capable version
>> per the spec.
>>
>> In any case, I really want to start testing geometry.force_aperture,
>> even if we're not yet comfortable to expose the IOMMU limits to the
>> user.  The vfio type1 shouldn't be enabled at all for underlying
>> hardware that allows DMA bypass.  Thanks,
>
> Ok, I'll put it on my list of things to look at under the assumption that
> the actual aperture limits don't need to be accurate as long as DMA to
> an arbitrary unmapped address always faults.

I'm pretty sure we'd only ever set the aperture to the full input 
address range anyway (since we're not a GART-type thing), in which case 
we should only need to worry about unmatched streams that don't hit in a 
domain at all. Doesn't the disable_bypass option already cover that? 
(FWIW I hacked it up for v2 a while back, too[0]).

Robin.

[0]:http://www.linux-arm.org/git?p=linux-rm.git;a=commitdiff;h=23a251189fa3330b799a837bd8eb1023aa2dcea4

WARNING: multiple messages have this Message-ID (diff)
From: Robin Murphy <robin.murphy@arm.com>
To: Will Deacon <will.deacon@arm.com>,
	Alex Williamson <alex.williamson@redhat.com>
Cc: iommu <iommu@lists.linux-foundation.org>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	"eric.auger" <eric.auger@linaro.org>
Subject: Re: [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass
Date: Thu, 29 Oct 2015 18:42:10 +0000	[thread overview]
Message-ID: <56326882.10109@arm.com> (raw)
In-Reply-To: <20151029182819.GJ3440@arm.com>

On 29/10/15 18:28, Will Deacon wrote:
> On Tue, Oct 27, 2015 at 10:00:11AM -0600, Alex Williamson wrote:
>> On Tue, 2015-10-27 at 15:40 +0000, Will Deacon wrote:
>>> On Fri, Oct 16, 2015 at 09:51:22AM -0600, Alex Williamson wrote:
>>>> Would it be possible to add iommu_domain_geometry support to arm-smmu.c?
>>>> In addition to this test to verify that DMA cannot bypass the IOMMU, I'd
>>>> eventually like to pass the aperture information out through the VFIO
>>>> API.  Thanks,
>>>
>>> The slight snag here is that we don't know which SMMU in the system the
>>> domain is attached to at the point when the geometry is queried, so I
>>> can't give you an upper bound on the aperture. For example, if there is
>>> an SMMU with a 32-bit input address and another with a 48-bit input
>>> address.
>>>
>>> We could play the same horrible games that we do with the pgsize bitmap,
>>> and truncate some global aperture everytime we probe an SMMU device, but
>>> I'd really like to have fewer hacks like that if possible. The root of
>>> the problem is still that domains are allocated for a bus, rather than
>>> an IOMMU instance.
>>
>> Yes, Intel VT-d has this issue as well.  In theory we can have
>> heterogeneous IOMMU hardware units (DRHDs) in a system and the upper
>> bound of the geometry could be diminished if we add a less capable DRHD
>> into the domain.  I suspect this is more a theoretical problem than a
>> practical one though as we're typically mixing similar DRHDs and I think
>> we're still capable of 39-bit addressing in the least capable version
>> per the spec.
>>
>> In any case, I really want to start testing geometry.force_aperture,
>> even if we're not yet comfortable to expose the IOMMU limits to the
>> user.  The vfio type1 shouldn't be enabled at all for underlying
>> hardware that allows DMA bypass.  Thanks,
>
> Ok, I'll put it on my list of things to look at under the assumption that
> the actual aperture limits don't need to be accurate as long as DMA to
> an arbitrary unmapped address always faults.

I'm pretty sure we'd only ever set the aperture to the full input 
address range anyway (since we're not a GART-type thing), in which case 
we should only need to worry about unmatched streams that don't hit in a 
domain at all. Doesn't the disable_bypass option already cover that? 
(FWIW I hacked it up for v2 a while back, too[0]).

Robin.

[0]:http://www.linux-arm.org/git?p=linux-rm.git;a=commitdiff;h=23a251189fa3330b799a837bd8eb1023aa2dcea4


  parent reply	other threads:[~2015-10-29 18:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 20:52 [RFC PATCH] vfio/type1: Do not support IOMMUs that allow bypass Alex Williamson
2015-10-16 14:03 ` Eric Auger
2015-10-16 15:51   ` Alex Williamson
2015-10-27 15:40     ` Will Deacon
     [not found]       ` <20151027154043.GF1689-5wv7dgnIgG8@public.gmane.org>
2015-10-27 16:00         ` Alex Williamson
2015-10-27 16:00           ` Alex Williamson
     [not found]           ` <1445961611.8018.269.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-29 18:28             ` Will Deacon
2015-10-29 18:28               ` Will Deacon
     [not found]               ` <20151029182819.GJ3440-5wv7dgnIgG8@public.gmane.org>
2015-10-29 18:42                 ` Robin Murphy [this message]
2015-10-29 18:42                   ` Robin Murphy
     [not found]                   ` <56326882.10109-5wv7dgnIgG8@public.gmane.org>
2015-10-29 18:50                     ` Will Deacon
2015-10-29 18:50                       ` Will Deacon

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=56326882.10109@arm.com \
    --to=robin.murphy-5wv7dgnigg8@public.gmane.org \
    --cc=alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.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.