Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp208960imm; Wed, 29 Aug 2018 18:41:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbLg/mX3GjAcwRVIYnYh+3BmBD2xfrol6nHVmMUtd67m/PkptG+eia8GXuyGR5RIOS4Z86t X-Received: by 2002:a63:a40a:: with SMTP id c10-v6mr7680358pgf.346.1535593265699; Wed, 29 Aug 2018 18:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535593265; cv=none; d=google.com; s=arc-20160816; b=uWEGruqXIcQtqQ/HF14Z26x/q3ez5RpyhbbuZDz5tukjf/k3F9Pr+QXJJM/x9NqEW9 T0HEqOu7Lw2AFNACyCIN5IMo6ABln33EMG8EF4PKDVBeHa2GFCjPg5UoLeQ9d8xcg034 q6/UC0sLC5lo5rlY+AcVmDjAZVxyI9P3XwVZh5cYCCBFPpaaSV2ybczSgagsWeTt7hLo 3Tsj/AzEIJlQ8YtwxplcUhj36PRCfYrEVuGM3C7jMcFJlUFhf/UYFVNhNosvbQu22icz RznIqk2hYYrjGb7TiB1Zq/E+OZ15ADaZzrD6yITjYPmT/CQvdjSfI/Gz/vOYENO9b1xx pdXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=2yaqZITlqEEkH0SgA/T2GroSeDPoamEHpjATUKPMpn4=; b=XoDhQuxBFAYl+pOFLR5CsXmlcfz+ML1uRGDQfVpEs9YWbIk4qJBWSdPIai7fFPm65m o88u3xVF3vVyB2HAhrySXWvJlhhwS4c3xdSgln/fCTfMscZ6PFhiMe/7De0saHOUjw/P EO/0tZgdSaOHu4S9szsWbKU4mI/LG19EP8hHAyZEQQFpw2/+IqyPUXy3o1GNZeiX0vLD HiIGNVxmKsSpVlTI5kMNW7hnJKQIDswQ1Qg31Ebn9Apg4y5kMWVqf3qHT0M6xT3J9JA7 /XCEY9QzjboVm1CnBsfiOpB3XC0SJSgyLR/xkcC9fefbFWCG3hu5M27J+f5RzsB0yOCB dkHA== 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 j91-v6si5228207pld.474.2018.08.29.18.40.51; Wed, 29 Aug 2018 18:41:05 -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 S1727366AbeH3FhH (ORCPT + 99 others); Thu, 30 Aug 2018 01:37:07 -0400 Received: from mga11.intel.com ([192.55.52.93]:9350 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727258AbeH3FgZ (ORCPT ); Thu, 30 Aug 2018 01:36:25 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2018 18:36:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,305,1531810800"; d="scan'208";a="79442263" Received: from allen-box.sh.intel.com ([10.239.161.122]) by orsmga003.jf.intel.com with ESMTP; 29 Aug 2018 18:36:44 -0700 From: Lu Baolu To: Joerg Roedel , David Woodhouse Cc: ashok.raj@intel.com, sanjay.k.kumar@intel.com, jacob.jun.pan@intel.com, kevin.tian@intel.com, yi.l.liu@intel.com, yi.y.sun@intel.com, peterx@redhat.com, Jean-Philippe Brucker , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu , Jacob Pan Subject: [PATCH v2 05/12] iommu/vt-d: Reserve a domain id for FL and PT modes Date: Thu, 30 Aug 2018 09:35:17 +0800 Message-Id: <20180830013524.28743-6-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180830013524.28743-1-baolu.lu@linux.intel.com> References: <20180830013524.28743-1-baolu.lu@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vt-d spec rev3.0 (section 6.2.3.1) requires that each pasid entry for first-level or pass-through translation should be programmed with a domain id different from those used for second-level or nested translation. It is recommended that software could use a same domain id for all first-only and pass-through translations. This reserves a domain id for first-level and pass-through translations. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Sanjay Kumar Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 10 ++++++++++ drivers/iommu/intel-pasid.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 93cde957adc7..562da10bf93e 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -1643,6 +1643,16 @@ static int iommu_init_domains(struct intel_iommu *iommu) */ set_bit(0, iommu->domain_ids); + /* + * Vt-d spec rev3.0 (section 6.2.3.1) requires that each pasid + * entry for first-level or pass-through translation modes should + * be programmed with a domain id different from those used for + * second-level or nested translation. We reserve a domain id for + * this purpose. + */ + if (sm_supported(iommu)) + set_bit(FLPT_DEFAULT_DID, iommu->domain_ids); + return 0; } diff --git a/drivers/iommu/intel-pasid.h b/drivers/iommu/intel-pasid.h index 12f480c2bb8b..03c1612d173c 100644 --- a/drivers/iommu/intel-pasid.h +++ b/drivers/iommu/intel-pasid.h @@ -17,6 +17,12 @@ #define PDE_PFN_MASK PAGE_MASK #define PASID_PDE_SHIFT 6 +/* + * Domain ID reserved for pasid entries programmed for first-level + * only and pass-through transfer modes. + */ +#define FLPT_DEFAULT_DID 1 + struct pasid_dir_entry { u64 val; }; -- 2.17.1