Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp721155pxf; Thu, 1 Apr 2021 11:46:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVx2kCORPsCskden3Pw6VgK/a/Ga7lM4RTHMEIPt1WpR0hDimwyQlIqa9Gz2P4c9/9QF37 X-Received: by 2002:a17:906:ad96:: with SMTP id la22mr10916320ejb.237.1617302771637; Thu, 01 Apr 2021 11:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617302771; cv=none; d=google.com; s=arc-20160816; b=xYKsVOESvgRSGwIPa0nR6ddtElvw7UHjMfOIdzefygd4jya7Rc6Ya1AVilPMcbZaLv 0DDquBXeeA2d+m3GM+VHe2A0CKTsgvgtJ44l9ghHaGluzTDNaO3u2jldSp3CTeRXeO6+ bNun4qrcqGFRknvaJTjIfi+EIc0e5IO1B4LGdbro+Ez9YDhswIB9YsonfWIf/RX9iel8 0/pVHjXw/IOuNuZk9Ugfeyq7DdtcO+CZl9l2HPYgUVkOSLu+5ENLWqIwbCzX/TlnAnUa T+VlpTZZqUbWJXvwT5CKtODIwvZUmv9FljfGr1dsnTmVb4LMIZMXFB2Wx7urdXb7HsE8 B0Vw== 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:dkim-signature; bh=ZiqbkW+fsGYOXlnxQRppzJEJzKV895R44yHk0nQoUrI=; b=qsLuTTsZ0jrE6VHSM1wMi04Hs+zgPHHnsHiEi5avOrAPcoMGpa0RcCCt1w9kD/Z1Zj CJ0aOe2KFOjMMztLaKNeuY4V/tH+9nccyjMaglJ0rSPaUrPeMl5S6OLQje+LfeaIPBDl gJV4ury1sZUA6936N6+XPhnsH2TUvDNI3KIIN4oi3BUMJ2OyxKgyBjvdCNo2PAxMT10h bzng3+5PP5m9ozAvgTwafTwmXptCHVUDBN5LiRIK8lc+1WEzv3ttUd/fOrKokWjNG+QQ luyJKdd35s+nyqMzm+DurhyyC/nJpJaYhyjeRMesfnhVGAaMPLY5q5nCGJB6h7Jpxf7j YXYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RlKkIlbv; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q27si5130799edi.328.2021.04.01.11.45.49; Thu, 01 Apr 2021 11:46:11 -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=@redhat.com header.s=mimecast20190719 header.b=RlKkIlbv; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235032AbhDASpO (ORCPT + 99 others); Thu, 1 Apr 2021 14:45:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29383 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236892AbhDASXI (ORCPT ); Thu, 1 Apr 2021 14:23:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617301387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZiqbkW+fsGYOXlnxQRppzJEJzKV895R44yHk0nQoUrI=; b=RlKkIlbvlHuBcozVJsWNKa0Sg00ixnK/3H3fZMa9XVBzsX3v5Es3zOKAy6mvl4/vXi1pli L/6tmvHoBNaWI2/tJycrjzCQZ1SIKDInSucg9vLPzKaJC09mMOJjeHMSOAsLboFLGxQj6C jS7B5SxTgMB1FDnQDLa1I/fYZ7NTNqw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-427-beXxze8UPcWqRglpKTpo3A-1; Thu, 01 Apr 2021 09:20:38 -0400 X-MC-Unique: beXxze8UPcWqRglpKTpo3A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3CA0483DD26; Thu, 1 Apr 2021 13:20:35 +0000 (UTC) Received: from [10.36.112.13] (ovpn-112-13.ams2.redhat.com [10.36.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BD9C5C1A1; Thu, 1 Apr 2021 13:20:25 +0000 (UTC) Subject: Re: [PATCH v14 13/13] iommu/smmuv3: Accept configs with more than one context descriptor To: Shameerali Kolothum Thodi , yuzenghui Cc: "eric.auger.pro@gmail.com" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "kvmarm@lists.cs.columbia.edu" , "will@kernel.org" , "maz@kernel.org" , "robin.murphy@arm.com" , "joro@8bytes.org" , "alex.williamson@redhat.com" , "tn@semihalf.com" , zhukeqian , "jacob.jun.pan@linux.intel.com" , "yi.l.liu@intel.com" , wangxingang , jiangkunkun , "jean-philippe@linaro.org" , "zhangfei.gao@linaro.org" , "zhangfei.gao@gmail.com" , "vivek.gautam@arm.com" , "nicoleotsuka@gmail.com" , lushenming , "vsethi@nvidia.com" , "Wanghaibin (D)" References: <20210223205634.604221-1-eric.auger@redhat.com> <20210223205634.604221-14-eric.auger@redhat.com> <86614466-3c74-3a38-5f2e-6ac2f55c309a@huawei.com> <27a474c325fc46a092c2e11854baaccc@huawei.com> From: Auger Eric Message-ID: Date: Thu, 1 Apr 2021 15:20:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <27a474c325fc46a092c2e11854baaccc@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shameer, On 4/1/21 2:38 PM, Shameerali Kolothum Thodi wrote: > > >> -----Original Message----- >> From: Auger Eric [mailto:eric.auger@redhat.com] >> Sent: 01 April 2021 12:49 >> To: yuzenghui >> Cc: eric.auger.pro@gmail.com; iommu@lists.linux-foundation.org; >> linux-kernel@vger.kernel.org; kvm@vger.kernel.org; >> kvmarm@lists.cs.columbia.edu; will@kernel.org; maz@kernel.org; >> robin.murphy@arm.com; joro@8bytes.org; alex.williamson@redhat.com; >> tn@semihalf.com; zhukeqian ; >> jacob.jun.pan@linux.intel.com; yi.l.liu@intel.com; wangxingang >> ; jiangkunkun ; >> jean-philippe@linaro.org; zhangfei.gao@linaro.org; zhangfei.gao@gmail.com; >> vivek.gautam@arm.com; Shameerali Kolothum Thodi >> ; nicoleotsuka@gmail.com; >> lushenming ; vsethi@nvidia.com; Wanghaibin (D) >> >> Subject: Re: [PATCH v14 13/13] iommu/smmuv3: Accept configs with more than >> one context descriptor >> >> Hi Zenghui, >> >> On 3/30/21 11:23 AM, Zenghui Yu wrote: >>> 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? >>> >> I added this patch upon Shameer's request, to be more vSVA friendly. >> Hower this series does not really target multiple CD support. At the >> moment the driver only supports STRTAB_STE_1_S1DSS_SSID0 (0x2) I think. >> At this moment maybe I can only check the s1dss field is 0x2. Or simply >> removes this patch? >> >> Thoughts? > > Right. This was useful for vSVA tests. But yes, to properly support multiple CDs > we need to pass the S1DSS from Qemu. And that requires further changes. > So I think it's better to remove this patch and reject S1CDMAX != 0 cases. OK I will remove it Thanks Eric > > Thanks, > Shameer > >> >> Eric >