Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1870429ybb; Thu, 2 Apr 2020 08:49:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJa7dFS56MhOU5CK0iDzLBLXBuyU4BMkGvX20hytkiqAOAzMbJ23nqx6oNFxFGpHr3ZiXJ9 X-Received: by 2002:aca:ac46:: with SMTP id v67mr2755616oie.62.1585842572417; Thu, 02 Apr 2020 08:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585842572; cv=none; d=google.com; s=arc-20160816; b=TXlNxBUKvaZlVuwoTVPGORbB5f+rL7MujnhgYVrnb1qGMhrFWd3KxgD9kf9qBStJZr cL5ZgthU3RusS5TGYla2EMkJ18N3wWmxSHuxBY1HDOuH1qgs+PPcGli4Cpd3qLsdsSgv dTE8VI4sfr9W+EQVub2ll3b8HBgaCJBMz5wCYl/3rQ1y2T/bZwBODmDcHrgKLLqZpe1i UuOcR2Zr9V81K7bE0hLstLuD7GneDTf6ZmAZ/t7NM6XZRsdHgCj9D7Pach8B3K2GmAjG 1co/V+JMf62LLUvVwwLyjSmyRkKTpVo+lLruM0z9xM6l7GhBkkqNVR3WLBNsndQdC+e9 t64g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:ironport-sdr:ironport-sdr; bh=jYf5AJHvW1nsnHeVOprCd4nzXHjScr0V6CMifjNthC4=; b=P7VXt/Af4tt91szE7vxyXx4+r8Inu+PXCZwETSAT3AFIP5Ad4D2Qr/Z7I64YkpYIRR 6JunJTNkXfbsGIqHq5g6tCbYLBTXjD3gV2t9QXdguv3cKQQ0Z0p7cMAXz4B2FTJTQY7M JElLv7X6HSuSz0ckEPL99mX5usbmGSlsGXQYsmfSbrp+LtUQGawo2+fpIq7Fd1gSMKqw MsEqjHSasn+uy5qO2fRU60FFsh/O5cjWeDYvBK9ODf1kSgpYn1bN7HeSmczChg8YmgVh Kej8AjEDPX1jVM8DXTtKvPQRDs+u6Db/wUDIjiuedvAkNt8hkz2fsWg5WKDVWIYp68Ls mxSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i14si2332987oov.24.2020.04.02.08.49.18; Thu, 02 Apr 2020 08:49:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389416AbgDBPsv convert rfc822-to-8bit (ORCPT + 99 others); Thu, 2 Apr 2020 11:48:51 -0400 Received: from mga12.intel.com ([192.55.52.136]:37901 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388677AbgDBPsv (ORCPT ); Thu, 2 Apr 2020 11:48:51 -0400 IronPort-SDR: H982esY7z4C51MWKu7UzxnVZmuPDLnrp88z7d/saxkgo/29XNXC3R0AnqwQ3790uid28x6j9I2 ifCRoNW5fPyw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 08:48:50 -0700 IronPort-SDR: KEe169meLIkf/vdOOwURi2neV19Ws31MpLRpkg89lEXup7r2SGjaTaWNXhMRk0b2QZoFy4X97l /vpNoWLNO2bQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,336,1580803200"; d="scan'208";a="249872084" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga003.jf.intel.com with ESMTP; 02 Apr 2020 08:48:50 -0700 Date: Thu, 2 Apr 2020 08:54:38 -0700 From: Jacob Pan To: Auger Eric Cc: "Liu, Yi L" , "Tian, Kevin" , Lu Baolu , "iommu@lists.linux-foundation.org" , LKML , Joerg Roedel , David Woodhouse , Alex Williamson , Jean-Philippe Brucker , "Raj, Ashok" , Christoph Hellwig , Jonathan Cameron , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH V10 08/11] iommu/vt-d: Add svm/sva invalidate function Message-ID: <20200402085438.38d7bd80@jacob-builder> In-Reply-To: References: <1584746861-76386-1-git-send-email-jacob.jun.pan@linux.intel.com> <1584746861-76386-9-git-send-email-jacob.jun.pan@linux.intel.com> <3215b83c-81f7-a30f-fe82-a51f29d7b874@redhat.com> <20200331135807.4e9976ab@jacob-builder> Organization: OTC X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Apr 2020 09:32:37 +0200 Auger Eric wrote: > > I didn’t read through all comments. Here is a concern with this 2-D > > table, the iommu cache type is defined as below. I suppose there is > > a problem here. If I'm using IOMMU_CACHE_INV_TYPE_PASID, it will > > beyond the 2-D table. > > > > /* IOMMU paging structure cache */ > > #define IOMMU_CACHE_INV_TYPE_IOTLB (1 << 0) /* IOMMU IOTLB */ > > #define IOMMU_CACHE_INV_TYPE_DEV_IOTLB (1 << 1) /* Device IOTLB */ > > #define IOMMU_CACHE_INV_TYPE_PASID (1 << 2) /* PASID cache */ > > #define IOMMU_CACHE_INV_TYPE_NR (3) > oups indeed I think it is not an issue, since we use bit position not the raw cache type as index into the 2D array. Right? for_each_set_bit(cache_type, ret = to_vtd_granularity(cache_type, inv_info->granularity, & static inline int to_vtd_granularity(int type, int granu, int *vtd_granu) { *vtd_granu = inv_type_granu_table[type][granu];