Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp973822ybh; Mon, 13 Jul 2020 06:16:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK/PaDPaCgl47bIKIxoszVF3iJD9CIu3HmGpfCmwh50KAcSaQBpeURDphrfOzKf9uZokDu X-Received: by 2002:aa7:c714:: with SMTP id i20mr92611467edq.215.1594646164366; Mon, 13 Jul 2020 06:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594646164; cv=none; d=google.com; s=arc-20160816; b=cgIY3duHHF+/ROMZpvpqTGtpHiYjE+X14+sDkmFFvcEhUnYFUzMAg5ZQmv8VT7OFkr P/sTAhh6huHpcGirwBM9j1TBuJJ+V49JN5Isrp5mtgogR/CmwJsCm3JKkqqhhXoJjhn3 RhAbtVnjD3kU4Cz7DjwPexEgiJChFonXvxOCy2oxOadzs9vM4GZBjai8DxdNSUqtPU6c tL8A57zk24lD0iPn4sppBY7QeyGSQdx9erVKBUSN8QSak4rz7NMeXn4P0uBOGAcQMLvd 9eoRuc91G32bXApxRMF8PHqipULae6GpwYI6NjvX+LJIy57JxC3ZYs+u+cM1pp/TFg28 sbYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rAxIAkrBRLDFht8AiHdBtj5LtR6FB+X0MT7VNYTV998=; b=BJ/XArBB2XYamDaC0q3Sefxx1zWEMTsMmpH12IR16HforR95ttjHhlzNsw3DqmNxu7 k5TD+P33sfgs4hZbg23tDYRIGmiQ3EvY8rZ9EnN/5FlqZTLGYF0grJz+SxLE6eMoFe53 yruBbevOn4Nc2uZuztDNPM6PvhFpRc1qDNoQd7STxqTp5zasiYHRPd+Og9zHvLVyl/Af EC4WHnR+C0vNkeyz+O4YGfZvXBvytjXv6OYLiw+lmdLfZMrCzgp6bSXwYSjbwurgfQVk Hqwy7/UtXWdP/oRdPShczeysdPH2qGTTkci8tWyljd7LIEBpo5NwNe12DNNQFfExCSuL ZB7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TwkkICUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g26si8946533ejo.47.2020.07.13.06.15.40; Mon, 13 Jul 2020 06:16:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TwkkICUs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729772AbgGMNPB (ORCPT + 99 others); Mon, 13 Jul 2020 09:15:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:57056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729523AbgGMNPB (ORCPT ); Mon, 13 Jul 2020 09:15:01 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DF34D206F0; Mon, 13 Jul 2020 13:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594646100; bh=vsfrQkQHuwH4Y1vXh/4DmCZ6tKypfE6qSWFzh+Q1CxI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TwkkICUs4b3I5XsQCZ7NO0M3cnFT6s/5dWcTpCmKe+uCGj+BCDhAyzY9QAqbHuGFb CKYDfi+beNX2Cxevmjuhay0f5WcEEfX0KSrJFnDh06AEKGNQOd1Ncu48GrSps1DD5Y 8px6YzdOOCHDGSYWOPvvAFmzP/UfGbRI/OhrpNNc= Date: Mon, 13 Jul 2020 14:14:54 +0100 From: Will Deacon To: Liu Yi L Cc: alex.williamson@redhat.com, eric.auger@redhat.com, baolu.lu@linux.intel.com, joro@8bytes.org, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, ashok.raj@intel.com, jun.j.tian@intel.com, yi.y.sun@intel.com, jean-philippe@linaro.org, peterx@redhat.com, hao.wu@intel.com, stefanha@gmail.com, iommu@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Robin Murphy Subject: Re: [PATCH v5 03/15] iommu/smmu: Report empty domain nesting info Message-ID: <20200713131454.GA2739@willie-the-truck> References: <1594552870-55687-1-git-send-email-yi.l.liu@intel.com> <1594552870-55687-4-git-send-email-yi.l.liu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1594552870-55687-4-git-send-email-yi.l.liu@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 12, 2020 at 04:20:58AM -0700, Liu Yi L wrote: > This patch is added as instead of returning a boolean for DOMAIN_ATTR_NESTING, > iommu_domain_get_attr() should return an iommu_nesting_info handle. > > Cc: Will Deacon > Cc: Robin Murphy > Cc: Eric Auger > Cc: Jean-Philippe Brucker > Suggested-by: Jean-Philippe Brucker > Signed-off-by: Liu Yi L > Signed-off-by: Jacob Pan > --- > v4 -> v5: > *) address comments from Eric Auger. > --- > drivers/iommu/arm-smmu-v3.c | 29 +++++++++++++++++++++++++++-- > drivers/iommu/arm-smmu.c | 29 +++++++++++++++++++++++++++-- > 2 files changed, 54 insertions(+), 4 deletions(-) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index f578677..ec815d7 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -3019,6 +3019,32 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev) > return group; > } > > +static int arm_smmu_domain_nesting_info(struct arm_smmu_domain *smmu_domain, > + void *data) > +{ > + struct iommu_nesting_info *info = (struct iommu_nesting_info *)data; > + unsigned int size; > + > + if (!info || smmu_domain->stage != ARM_SMMU_DOMAIN_NESTED) > + return -ENODEV; > + > + size = sizeof(struct iommu_nesting_info); > + > + /* > + * if provided buffer size is smaller than expected, should > + * return 0 and also the expected buffer size to caller. > + */ > + if (info->size < size) { > + info->size = size; > + return 0; > + } > + > + /* report an empty iommu_nesting_info for now */ > + memset(info, 0x0, size); > + info->size = size; > + return 0; > +} Have you verified that this doesn't break the existing usage of DOMAIN_ATTR_NESTING in drivers/vfio/vfio_iommu_type1.c? Will