Received: from eggs.gnu.org ([2001:4830:134:3::10]:46983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiWuY-0002CE-8K for qemu-devel@nongnu.org; Tue, 22 Mar 2016 20:44:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiWuV-0005em-1x for qemu-devel@nongnu.org; Tue, 22 Mar 2016 20:44:34 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:35622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiWuU-0005dq-Me for qemu-devel@nongnu.org; Tue, 22 Mar 2016 20:44:30 -0400 Received: by mail-pf0-x242.google.com with SMTP id u190so88893pfb.2 for ; Tue, 22 Mar 2016 17:44:29 -0700 (PDT) References: <1458546426-26222-1-git-send-email-aik@ozlabs.ru> <1458546426-26222-13-git-send-email-aik@ozlabs.ru> <20160322030515.GZ23586@voom.redhat.com> <20160322094710.75ce3ace@t450s.home> From: Alexey Kardashevskiy Message-ID: <56F1E6E8.8010901@ozlabs.ru> Date: Wed, 23 Mar 2016 11:44:24 +1100 MIME-Version: 1.0 In-Reply-To: <20160322094710.75ce3ace@t450s.home> Content-Type: text/plain; charset=koi8-r; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH qemu v14 12/18] vfio: Check that IOMMU MR translates to system address space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson , David Gibson Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org On 03/23/2016 02:47 AM, Alex Williamson wrote: > On Tue, 22 Mar 2016 14:05:15 +1100 > David Gibson wrote: > >> On Mon, Mar 21, 2016 at 06:47:00PM +1100, Alexey Kardashevskiy wrote: >>> At the moment IOMMU MR only translate to the system memory. >>> However if some new code changes this, we will need clear indication why >>> it is not working so here is the check. >>> >>> Signed-off-by: Alexey Kardashevskiy >> >> Reviewed-by: David Gibson >> >> Alex, any chance we could merge this quickly, since it is a reasonable >> sanity check even without the rest of the changes. > > It all sounds very theoretical to inspire some rush to merge it > quickly, is there any chance we could actually hit this currently? The chances are as big as chances that some platform starts supporting VFIO soon, for these new folks such a check would be a good piece of documentation or at least a warning trigger to ask a question in the lists. >>> --- >>> Changes: >>> v14: >>> * new to the series >>> --- >>> hw/vfio/common.c | 6 ++++++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c >>> index 55723c9..9587c25 100644 >>> --- a/hw/vfio/common.c >>> +++ b/hw/vfio/common.c >>> @@ -266,6 +266,12 @@ static void vfio_iommu_map_notify(Notifier *n, void *data) >>> >>> trace_vfio_iommu_map_notify(iova, iova + iotlb->addr_mask); >>> >>> + if (iotlb->target_as != &address_space_memory) { >>> + error_report("Wrong target AS \"%s\", only system memory is allowed", >>> + iotlb->target_as->name?iotlb->target_as->name:"noname"); > > Spaces please. > >>> + return; >>> + } >>> + >>> /* >>> * The IOMMU TLB entry we have just covers translation through >>> * this IOMMU to its immediate target. We need to translate >> > -- Alexey