Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4038655ybg; Fri, 25 Oct 2019 12:26:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDpHl9GVJx9eMvv8kQ3mDpQIkyNhrRxs31MjdjWszdpFUcX/o1bN8Ockq+0eyHBhIO3onD X-Received: by 2002:a17:906:2295:: with SMTP id p21mr5083717eja.8.1572031561843; Fri, 25 Oct 2019 12:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572031561; cv=none; d=google.com; s=arc-20160816; b=Gf54GHzYNXURxWO+OxTfkhL8aLzzZqwcTyPpYX9GYdil5kwoePeMDW1hX89vPRncon fvdH3Fo03W0J6LLBESY+xlU8MfsIPfZvpCZVY3c2xHj0ofZkozvvejcOTY5seYiOxm4z d5HfmQ6ksJlQq5ozyXdMhlK+zGpPLGVPXoEr+LHpf2c0TFCQGGmdBOjo52bCjUb1YuJg iBFGQJxi/H1pqaxZUsORO3RTa5aCGNlmZP5VcUyjdpXVgEWLdd55JJMta0jMpfvc1SmO 4tNECy8JKOmw1jTetY1AJrf6PUe7mJDTt1ZA1a7o87j13m895C3pvihYwRY38bOMJZCu oKpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=DXzTwq3lZDb8xWTZ+pla1g67+IF24iL/ECqkMv4GmjA=; b=nIkklg0N47cXcnbbWDEaEfigXdUaRHc/B6HpoiMH/nsMfwxaN3HxNHcuRUBNz2tGug tPX5+alihlWRODmAkU2ZVULY6l+g0NFHlSS1rBn+mf6z5lBaNS0JLG8D0c0Im1h4kdal BTElU3kLZZmFYDbKKhgCUpQ6V+LF2B3K+D70myJq+3eFSDuDlK+l70RrruP1O6udld6e QZRB9/QfPKZKh4Do/qzKn8VyPb8CNL3Vk2Iw9YUJmSnWAEfIF4ldStWSt2bs3q3RvyQq 9dnWiw5jFFKkFvhflqxCi67CqATVuPaptApsNcwe7/wghGb2UIAZQDoYW04KIE3cB05Q hrhA== 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 g20si2087058eda.229.2019.10.25.12.25.38; Fri, 25 Oct 2019 12:26:01 -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 S2394192AbfJYGHS convert rfc822-to-8bit (ORCPT + 99 others); Fri, 25 Oct 2019 02:07:18 -0400 Received: from mga03.intel.com ([134.134.136.65]:54945 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393713AbfJYGHR (ORCPT ); Fri, 25 Oct 2019 02:07:17 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2019 23:07:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,227,1569308400"; d="scan'208";a="202519934" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga006.jf.intel.com with ESMTP; 24 Oct 2019 23:07:16 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 24 Oct 2019 23:07:00 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 24 Oct 2019 23:06:59 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.225]) with mapi id 14.03.0439.000; Fri, 25 Oct 2019 14:06:54 +0800 From: "Tian, Kevin" To: Jacob Pan , "iommu@lists.linux-foundation.org" , LKML , Joerg Roedel , "David Woodhouse" , Alex Williamson , Jean-Philippe Brucker CC: "Liu, Yi L" , "Raj, Ashok" , Christoph Hellwig , Lu Baolu , Jonathan Cameron , Eric Auger Subject: RE: [PATCH v7 01/11] iommu/vt-d: Cache virtual command capability register Thread-Topic: [PATCH v7 01/11] iommu/vt-d: Cache virtual command capability register Thread-Index: AQHViqRUxHUR72S96U+DLESjOr18Wadq31Eg Date: Fri, 25 Oct 2019 06:06:53 +0000 Message-ID: References: <1571946904-86776-1-git-send-email-jacob.jun.pan@linux.intel.com> <1571946904-86776-2-git-send-email-jacob.jun.pan@linux.intel.com> In-Reply-To: <1571946904-86776-2-git-send-email-jacob.jun.pan@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTBiZDhmM2UtNWNiZC00NjA5LWE2MDEtZDk5N2NjMWZjNzg5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaU4ydjNXXC91RTRqejBqSjd6V01LN2tSeHlUYUY3Z1VTbDRsMHRhN3hjc3ZGVVJXZFg2UHNhUUFiOGdwTmNyZzcifQ== dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Jacob Pan [mailto:jacob.jun.pan@linux.intel.com] > Sent: Friday, October 25, 2019 3:55 AM > > Virtual command registers are used in the guest only, to prevent > vmexit cost, we cache the capability and store it during initialization. > > Signed-off-by: Jacob Pan > --- > drivers/iommu/dmar.c | 1 + > include/linux/intel-iommu.h | 4 ++++ > 2 files changed, 5 insertions(+) > > diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c > index eecd6a421667..49bb7d76e646 100644 > --- a/drivers/iommu/dmar.c > +++ b/drivers/iommu/dmar.c > @@ -950,6 +950,7 @@ static int map_iommu(struct intel_iommu *iommu, > u64 phys_addr) > warn_invalid_dmar(phys_addr, " returns all ones"); > goto unmap; > } > + iommu->vccap = dmar_readq(iommu->reg + DMAR_VCCAP_REG); > > /* the registers might be more than one page */ > map_size = max_t(int, ecap_max_iotlb_offset(iommu->ecap), > diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h > index ed11ef594378..2e1bed9b7eef 100644 > --- a/include/linux/intel-iommu.h > +++ b/include/linux/intel-iommu.h > @@ -186,6 +186,9 @@ > #define ecap_max_handle_mask(e) ((e >> 20) & 0xf) > #define ecap_sc_support(e) ((e >> 7) & 0x1) /* Snooping Control */ > > +/* Virtual command interface capabilities */ > +#define vccap_pasid(v) ((v & DMA_VCS_PAS)) /* PASID > allocation */ DMA_VCS_PAS is defined in [2/11]. should move to here. > + > /* IOTLB_REG */ > #define DMA_TLB_FLUSH_GRANU_OFFSET 60 > #define DMA_TLB_GLOBAL_FLUSH (((u64)1) << 60) > @@ -520,6 +523,7 @@ struct intel_iommu { > u64 reg_size; /* size of hw register set */ > u64 cap; > u64 ecap; > + u64 vccap; > u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF > */ > raw_spinlock_t register_lock; /* protect register handling */ > int seq_id; /* sequence id of the iommu */ > -- > 2.7.4