From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C58E1C0650E for ; Wed, 3 Jul 2019 20:34:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAE51218AD for ; Wed, 3 Jul 2019 20:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727427AbfGCUem (ORCPT ); Wed, 3 Jul 2019 16:34:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51422 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726739AbfGCUek (ORCPT ); Wed, 3 Jul 2019 16:34:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 918BC3091851; Wed, 3 Jul 2019 20:34:30 +0000 (UTC) Received: from x1.home (ovpn-116-83.phx2.redhat.com [10.3.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id E772E17F33; Wed, 3 Jul 2019 20:34:27 +0000 (UTC) Date: Wed, 3 Jul 2019 14:34:27 -0600 From: Alex Williamson To: Shameer Kolothum Cc: , , , , , , , , Subject: Re: [PATCH v7 2/6] vfio/type1: Check reserve region conflict and update iova list Message-ID: <20190703143427.2d63c15f@x1.home> In-Reply-To: <20190626151248.11776-3-shameerali.kolothum.thodi@huawei.com> References: <20190626151248.11776-1-shameerali.kolothum.thodi@huawei.com> <20190626151248.11776-3-shameerali.kolothum.thodi@huawei.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 03 Jul 2019 20:34:40 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, 26 Jun 2019 16:12:44 +0100 Shameer Kolothum wrote: > This retrieves the reserved regions associated with dev group and > checks for conflicts with any existing dma mappings. Also update > the iova list excluding the reserved regions. > > Reserved regions with type IOMMU_RESV_DIRECT_RELAXABLE are > excluded from above checks as they are considered as directly > mapped regions which are known to be relaxable. > > Signed-off-by: Shameer Kolothum > --- > drivers/vfio/vfio_iommu_type1.c | 96 +++++++++++++++++++++++++++++++++ > 1 file changed, 96 insertions(+) > > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c > index 970d1ec06aed..b6bfdfa16c33 100644 > --- a/drivers/vfio/vfio_iommu_type1.c > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -1559,6 +1641,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, > phys_addr_t resv_msi_base; > struct iommu_domain_geometry geo; > LIST_HEAD(iova_copy); > + LIST_HEAD(group_resv_regions); > > mutex_lock(&iommu->lock); > > @@ -1644,6 +1727,13 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, > goto out_detach; > } > > + iommu_get_group_resv_regions(iommu_group, &group_resv_regions); This can fail and should have an error case. I assume we'd fail the group attach on failure. Thanks, Alex