Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4225635pxf; Tue, 30 Mar 2021 02:27:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzY5aWraQrMfGqg4C79+DjJVS5y1JGIG0TGm8Ax0XNgs6XDCj4Hf8WfqyNRLRRSW8y83oFs X-Received: by 2002:a17:906:938f:: with SMTP id l15mr32220747ejx.15.1617096468232; Tue, 30 Mar 2021 02:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617096468; cv=none; d=google.com; s=arc-20160816; b=CTApoYbwwtW0nmwUTn5JxLZ6ZsJGo8PnOugVdkW76sWVJg7T78cDw737A6Il07O5WF spnc9DnFY/sRzTAkmtWsL/EQs30X/CmqRl2TqCiJ/LVif33lqo1pnJ0ddHV6UloY4tTs EX1kCGdAQvQxDHehz4DKzgwxHC5/RLk4dQy04SaqeVdi6hmUsmdj4v42fEUG+g/FcM6E WqHXDexZMbRXnFSXIaGvEEKlaOjdSEjlhFY5zN0T3TykN7TiI3aKwrSR9CRWYtDbgQzH vBdVDf2OZ5scH/CilPlXpZG9kePOHyAJ7K6HszhTP6PTWmLiIkt5nbbOOlrCQbxmDvcE h7Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=GrJaKxN2uFjSLFyygyvZBMHgGncgqxTYYtE6eXHgtFw=; b=WvOQy4DHrMU87q0dDJjj0KX7H/bTO9ccEG+OjH4nYc4GMBIJQI22Pbp7xiFq/bX8sU qPdbbAPf+rFcjT+8gRB9gOTypfAfBn00JNU/q7XDCD6JJdvHULu80Bg3oVZvxYkCK6n1 RZPEc26NEObKjRfORUj5XP7ZWTByLAmEMB0kRhSOUFHtWpZoROGqERtqcld3kVEc6ZKi tjW3f+dRGm4Tx9zD/PRm0kqZToJuHgXSYz074xxitUyZBYb5gka2ti0oPasF//1rpKwG 2zcc56ghI8NUgfNjU9h9o+kF0H7PrqGVTcKVaeP+zIaSVxXMrGD1HYBNBuz3p3eTAjjO yayA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s25si14916011ejy.8.2021.03.30.02.27.25; Tue, 30 Mar 2021 02:27:48 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231599AbhC3JY1 (ORCPT + 99 others); Tue, 30 Mar 2021 05:24:27 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:15822 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231737AbhC3JYH (ORCPT ); Tue, 30 Mar 2021 05:24:07 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4F8kVF4Ljjz9tHp; Tue, 30 Mar 2021 17:21:57 +0800 (CST) Received: from [10.174.185.179] (10.174.185.179) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Tue, 30 Mar 2021 17:23:55 +0800 Subject: Re: [PATCH v14 13/13] iommu/smmuv3: Accept configs with more than one context descriptor To: Eric Auger CC: , , , , , , , , , , , , , , , , , , , , , , , , References: <20210223205634.604221-1-eric.auger@redhat.com> <20210223205634.604221-14-eric.auger@redhat.com> From: Zenghui Yu Message-ID: <86614466-3c74-3a38-5f2e-6ac2f55c309a@huawei.com> Date: Tue, 30 Mar 2021 17:23:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20210223205634.604221-14-eric.auger@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.185.179] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, On 2021/2/24 4:56, Eric Auger wrote: > In preparation for vSVA, let's accept userspace provided configs > with more than one CD. We check the max CD against the host iommu > capability and also the format (linear versus 2 level). > > Signed-off-by: Eric Auger > Signed-off-by: Shameer Kolothum > --- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > index 332d31c0680f..ab74a0289893 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -3038,14 +3038,17 @@ static int arm_smmu_attach_pasid_table(struct iommu_domain *domain, > if (smmu_domain->s1_cfg.set) > goto out; > > - /* > - * we currently support a single CD so s1fmt and s1dss > - * fields are also ignored > - */ > - if (cfg->pasid_bits) > + list_for_each_entry(master, &smmu_domain->devices, domain_head) { > + if (cfg->pasid_bits > master->ssid_bits) > + goto out; > + } > + if (cfg->vendor_data.smmuv3.s1fmt == STRTAB_STE_0_S1FMT_64K_L2 && > + !(smmu->features & ARM_SMMU_FEAT_2_LVL_CDTAB)) > goto out; > > smmu_domain->s1_cfg.cdcfg.cdtab_dma = cfg->base_ptr; > + smmu_domain->s1_cfg.s1cdmax = cfg->pasid_bits; > + smmu_domain->s1_cfg.s1fmt = cfg->vendor_data.smmuv3.s1fmt; And what about the SIDSS field?