Linux virtualization list
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	"virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Cc: "jayachandran.nair@cavium.com" <jayachandran.nair@cavium.com>,
	"tnowicki@caviumnetworks.com" <tnowicki@caviumnetworks.com>,
	"mst@redhat.com" <mst@redhat.com>,
	Marc Zyngier <Marc.Zyngier@arm.com>,
	Will Deacon <Will.Deacon@arm.com>,
	"jintack@cs.columbia.edu" <jintack@cs.columbia.edu>,
	"eric.auger.pro@gmail.com" <eric.auger.pro@gmail.com>
Subject: Re: [PATCH 1/4] iommu: Add virtio-iommu driver
Date: Wed, 21 Mar 2018 14:23:38 +0000	[thread overview]
Message-ID: <739fbfdf-1651-8036-367a-52940b93dee6@arm.com> (raw)
In-Reply-To: <a11f1b52-c031-014c-8c23-1732f3d4666c@arm.com>

On 21/03/18 13:14, Jean-Philippe Brucker wrote:
> On 21/03/18 06:43, Tian, Kevin wrote:
> [...]
>>> +
>>> +#include <uapi/linux/virtio_iommu.h>
>>> +
>>> +#define MSI_IOVA_BASE			0x8000000
>>> +#define MSI_IOVA_LENGTH			0x100000
>>
>> this is ARM specific, and according to virtio-iommu spec isn't it
>> better probed on the endpoint instead of hard-coding here?
> 
> These values are arbitrary, not really ARM-specific even if ARM is the
> only user yet: we're just reserving a random IOVA region for mapping MSIs.
> It is hard-coded because of the way iommu-dma.c works, but I don't quite
> remember why that allocation isn't dynamic.

The host kernel needs to have *some* MSI region in place before the 
guest can start configuring interrupts, otherwise it won't know what 
address to give to the underlying hardware. However, as soon as the host 
kernel has picked a region, host userspace needs to know that it can no 
longer use addresses in that region for DMA-able guest memory. It's a 
lot easier when the address is fixed in hardware and the host userspace 
will never be stupid enough to try and VFIO_IOMMU_DMA_MAP it, but in the 
more general case where MSI writes undergo IOMMU address translation so 
it's an arbitrary IOVA, this has the potential to conflict with stuff 
like guest memory hotplug.

What we currently have is just the simplest option, with the host kernel 
just picking something up-front and pretending to host userspace that 
it's a fixed hardware address. There's certainly scope for it to be a 
bit more dynamic in the sense of adding an interface to let userspace 
move it around (before attaching any devices, at least), but I don't 
think it's feasible for the host kernel to second-guess userspace enough 
to make it entirely transparent like it is in the DMA API domain case.

Of course, that's all assuming the host itself is using a virtio-iommu 
(e.g. in a nested virt or emulation scenario). When it's purely within a 
guest then an MSI reservation shouldn't matter so much, since the guest 
won't be anywhere near the real hardware configuration anyway.

Robin.

> As said on the v0.6 spec thread, I'm not sure allocating the IOVA range in
> the host is preferable. With nested translation the guest has to map it
> anyway, and I believe dealing with IOVA allocation should be left to the
> guest when possible.
> 
> Thanks,
> Jean
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
> 

  parent reply	other threads:[~2018-03-21 14:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180214145340.1223-1-jean-philippe.brucker@arm.com>
2018-02-14 14:53 ` [PATCH 1/4] iommu: Add virtio-iommu driver Jean-Philippe Brucker
2018-02-14 14:53 ` [PATCH 2/4] iommu/virtio: Add probe request Jean-Philippe Brucker
2018-02-14 14:53 ` [PATCH 3/4] iommu/virtio: Add event queue Jean-Philippe Brucker
2018-02-14 14:53 ` [PATCH 4/4] vfio: Allow type-1 IOMMU instantiation with a virtio-iommu Jean-Philippe Brucker
     [not found] ` <20180214145340.1223-5-jean-philippe.brucker@arm.com>
2018-02-14 15:26   ` Alex Williamson
     [not found]   ` <20180214082639.54556efb@w520.home>
2018-02-14 15:35     ` Robin Murphy
     [not found]     ` <9f98aa85-3160-e285-cacd-2f429c58a775@arm.com>
2018-02-15 13:53       ` Jean-Philippe Brucker
     [not found] ` <20180214145340.1223-2-jean-philippe.brucker@arm.com>
     [not found]   ` <417e1617-e5ff-7b13-64e3-a8a98d30bcb9@semihalf.com>
2018-02-20 11:30     ` [PATCH 1/4] iommu: Add virtio-iommu driver Jean-Philippe Brucker
2018-02-21 20:12   ` kbuild test robot
2018-02-21 21:08   ` kbuild test robot
     [not found]   ` <201802220455.lMEb6LLi%fengguang.wu@intel.com>
     [not found]     ` <e5ffc52f-4510-f757-aa83-2a99af3ae06b@arm.com>
2018-02-27 14:47       ` Michael S. Tsirkin
2018-03-21  6:43   ` Tian, Kevin
     [not found]   ` <AADFC41AFE54684AB9EE6CBC0274A5D19108B0FE@SHSMSX101.ccr.corp.intel.com>
2018-03-21 13:14     ` Jean-Philippe Brucker
     [not found]     ` <a11f1b52-c031-014c-8c23-1732f3d4666c@arm.com>
2018-03-21 14:23       ` Robin Murphy [this message]
2018-03-22 10:06         ` Tian, Kevin
     [not found]         ` <AADFC41AFE54684AB9EE6CBC0274A5D19108DC42@SHSMSX101.ccr.corp.intel.com>
2018-03-23  8:27           ` Tian, Kevin
     [not found]           ` <AADFC41AFE54684AB9EE6CBC0274A5D191090157@SHSMSX101.ccr.corp.intel.com>
2018-04-11 18:35             ` Jean-Philippe Brucker
2018-03-23 14:48   ` Robin Murphy
     [not found]   ` <d0cfe602-f6e8-2d6e-0942-23012f3facef@arm.com>
2018-04-11 18:33     ` Jean-Philippe Brucker
     [not found] ` <20180214145340.1223-3-jean-philippe.brucker@arm.com>
2018-03-23 15:00   ` [PATCH 2/4] iommu/virtio: Add probe request Robin Murphy
     [not found]   ` <8156517f-74b1-2923-2838-402f09a5c488@arm.com>
2018-04-11 18:33     ` Jean-Philippe Brucker

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=739fbfdf-1651-8036-367a-52940b93dee6@arm.com \
    --to=robin.murphy@arm.com \
    --cc=Marc.Zyngier@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=eric.auger.pro@gmail.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jayachandran.nair@cavium.com \
    --cc=jean-philippe.brucker@arm.com \
    --cc=jintack@cs.columbia.edu \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=mst@redhat.com \
    --cc=tnowicki@caviumnetworks.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtualization@lists.linux-foundation.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