Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1130928pxb; Thu, 4 Mar 2021 04:14:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXj4kt5zFI5Ipo5dMerjDP8HDZSoYZ0QKV+wi2zfN2RF9xbO/OhEumlSNEoJmQpOEqiABx X-Received: by 2002:a50:fc94:: with SMTP id f20mr4009446edq.370.1614860084586; Thu, 04 Mar 2021 04:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614860084; cv=none; d=google.com; s=arc-20160816; b=HGW1GIGbC/jJvEkSjvewldzvxxZwMblBWKM1AeYLLLiVcDnnqsfy1DGq1xdLI6mXyz en5IrquDVYOw9VJLAcWj401bJMqM7eGHSFee4DqkMW6i62/V10r9c8/Jhu8KydSVYwKS vjXHQ/HU5xBcNX8ZtdiyGipCsFPAnIAPWCfy/zURqzZDI68M2Bi4HAAdu3tE2+bdlqjz sjhwxq1IFsZtqEHDo7VglLxzh4/mVjXnGbogfTwyK9Kk+yF4555H6WxY0h0NoNzeXCrq 1YLgaBvZccbB3Ke2oMa/iGztxXGqc9OTUXaGXocs+BZ2KRTs0JG3BdMhS4FGkV4xQk9d YWJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=m0yEupP/L76P6gyISve2gAOojgj7J2+MhN1/3SbMwsE=; b=XjUfgbdNyQmOPyKwX/lPaz4FCAx9mRYjkuC6IxPs9Dk18SuDEQOJKYuQ1jgcOZGqfD FpJPUaF/yGuWOUvnGBrzPr935Ut5AcmpUYFma2LjdRucqGSpEpoTdQ01uRbJGuMK93TR WhKvAp5Kp75Z82Blyj3uP7kZ3v17dFQ87UkgVbhs25x2JAydrvvv/bcECx67B1Gdimnp TWE6ovQfvJFOfRxAYpBZS2UJGXIKA5rNkTkvPckHXCCZrzXcprX3jY47lQvQgdTGX37m MhjiIBtkwL+QS6j6keDdcRAgHundBvOz+K3rh6y1S1s/a/TeUuLL2Mj71Nl6e+zJcSK0 F7Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C6KCV2Nd; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si17213107edr.491.2021.03.04.04.14.22; Thu, 04 Mar 2021 04:14:44 -0800 (PST) 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=@linaro.org header.s=google header.b=C6KCV2Nd; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580620AbhCCSee (ORCPT + 99 others); Wed, 3 Mar 2021 13:34:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242777AbhCCRPz (ORCPT ); Wed, 3 Mar 2021 12:15:55 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E63CC061763 for ; Wed, 3 Mar 2021 09:14:51 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id n22so5800980wmc.2 for ; Wed, 03 Mar 2021 09:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=m0yEupP/L76P6gyISve2gAOojgj7J2+MhN1/3SbMwsE=; b=C6KCV2Ndp6CnJ973AOgZXdDV2ekUchmEJSgJwIBEmdHi354O2kCSutw5rxsuaetRS2 6TWGzr8yJbWn4m3Gscu98rUzjS2Da4D50fqwZ+2nRW3QMP/1VIwc8h4YVEOlFw1OyElu xR9MPTccInyAI8SkqACUaRFoBJTIw+uwfVrORZaWtVapcLsDmBiWKh6hdddFwFXInOZh xJjh9otvchYhdcs8tvPO2rfa1cVCTzy81vjuAhs8lCNNERHj3NaDswXNENqNEwXgT/6q jez/V3484hDD5fJMt5nEduLgJm3Fs3iR+fK1ydpKCCATvHZ1rXTXxQ04lcxTcAOS0RKV bPRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=m0yEupP/L76P6gyISve2gAOojgj7J2+MhN1/3SbMwsE=; b=Hsen3qYroIG6dlbqPJ8iXYGiN9+PVudFYa4Jrm93pMIKX9i0P4Hm9iMKhDF8zyvDat nC0FMvWwxpKqelJDeDkQC55OScPNoac4Sxq6LkKCGnrgyn7ir9frY7wj/5F1qqKHSYVw 7+T8exQCb+bYLbe8zfKexveru2hkRgI0EHnb2JiB9PyF2brKBAufrqwo2JBYXzgqV2ne nxwvHG+X0waZGektKz/lHFkE7DWRaTQHbesTIW6Mu+yY0sDgtBP0rJ4DWV9xeQB8GzAo CCstdtRtpSlsdV9W4AjySie4yqhoSyONOUu6xfPYMnLhnaVAdbn0E9k/v81JgcaFIguv Zg5g== X-Gm-Message-State: AOAM532L2toDznDZwnYjhjDB9OXQYpOCfIfXgdcaPuCQYPlZ7uaEPg3F skfhP8msB/ytgqq+LSxNTbmxzw== X-Received: by 2002:a7b:c308:: with SMTP id k8mr69805wmj.54.1614791690288; Wed, 03 Mar 2021 09:14:50 -0800 (PST) Received: from myrica ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id v5sm6552574wmh.2.2021.03.03.09.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Mar 2021 09:14:49 -0800 (PST) Date: Wed, 3 Mar 2021 18:14:28 +0100 From: Jean-Philippe Brucker To: Vivek Gautam Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, virtualization@lists.linux-foundation.org, joro@8bytes.org, will.deacon@arm.com, mst@redhat.com, robin.murphy@arm.com, eric.auger@redhat.com, alex.williamson@redhat.com, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, yi.l.liu@intel.com, lorenzo.pieralisi@arm.com, shameerali.kolothum.thodi@huawei.com Subject: Re: [PATCH RFC v1 04/15] iommu/arm-smmu-v3: Update CD base address info for user-space Message-ID: References: <20210115121342.15093-1-vivek.gautam@arm.com> <20210115121342.15093-5-vivek.gautam@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210115121342.15093-5-vivek.gautam@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 15, 2021 at 05:43:31PM +0530, Vivek Gautam wrote: > Update base address information in vendor pasid table info to pass that > to user-space for stage1 table management. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > Cc: Jean-Philippe Brucker > Cc: Eric Auger > Cc: Alex Williamson > Cc: Kevin Tian > Cc: Jacob Pan > Cc: Liu Yi L > Cc: Lorenzo Pieralisi > Cc: Shameerali Kolothum Thodi > --- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-cd-lib.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-cd-lib.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-cd-lib.c > index 8a7187534706..ec37476c8d09 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-cd-lib.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-cd-lib.c > @@ -55,6 +55,9 @@ static __le64 *arm_smmu_get_cd_ptr(struct iommu_vendor_psdtable_cfg *pst_cfg, > if (arm_smmu_alloc_cd_leaf_table(dev, l1_desc)) > return NULL; > > + if (s1cfg->s1fmt == STRTAB_STE_0_S1FMT_LINEAR) > + pst_cfg->base = l1_desc->l2ptr_dma; > + This isn't the right place, because this path allocates second-level tables for two-level tables. I don't think we need pst_cfg->base at all, because for both linear and two-level tables, the base pointer is in cdcfg->cdtab_dma, which can be read directly. Thanks, Jean > l1ptr = cdcfg->cdtab + idx * CTXDESC_L1_DESC_DWORDS; > arm_smmu_write_cd_l1_desc(l1ptr, l1_desc); > /* An invalid L1CD can be cached */ > @@ -211,6 +214,9 @@ static int arm_smmu_alloc_cd_tables(struct iommu_vendor_psdtable_cfg *pst_cfg) > goto err_free_l1; > } > > + if (s1cfg->s1fmt == STRTAB_STE_0_S1FMT_64K_L2) > + pst_cfg->base = cdcfg->cdtab_dma; > + > return 0; > > err_free_l1: > -- > 2.17.1 >