From patchwork Thu Apr 13 04:06:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Baolu Lu X-Patchwork-Id: 82770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp774079vqo; Wed, 12 Apr 2023 21:17:57 -0700 (PDT) X-Google-Smtp-Source: AKy350Z85C54E7FwPiwhpU9BF8UvXbZsm1oH+ZsNsoPipx5BqRJ0aaikyXxgaYraQGyzMoEMKjEW X-Received: by 2002:a17:906:6d03:b0:94a:845c:3529 with SMTP id m3-20020a1709066d0300b0094a845c3529mr1246748ejr.9.1681359477218; Wed, 12 Apr 2023 21:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681359477; cv=none; d=google.com; s=arc-20160816; b=lCw0i2fly7r4kzT22ttKiAHNUEI2UatUrTHqKIryzk+4taGygio4wAu78n9eAywfrc Qx1ywK7UXFEFMN0KykHDTu8G720G7U+qFJHZwpReFiv9NrtPFUBj1mrdXwgL/eo49Tow luVpek8nH2+NoAQytmcj5rJvl7gG8BJkju7boXoe6khn5wrKVYgT79A0tNhfsC5MUVtI gMHopassYnPjlVgNiqPicJ20GQsDNnNTbiaVoaTS9eQArOrya98CJBt6/kSCaD52yr5+ 3e+HmhAJj86ANUTur5KzQcBOD1wlL0FQthgHGyCGNsI8c5vyw5/t74b5DCQEqY5rBhcg r0jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=w470Ull3lIZp7kyFNkspMKEX+35yPucZIYPaiuZ1ccw=; b=YreNCKG5UUgFuENpeXUHT3h2DnIYel8UAj9czjO0nILIeS6HkNpmadyvmOU3t4rnme Dwxt5EYgo7/QJA9fpMa5F6sGAv4FkqgcwpaKCFjd1dbho2MOba0OW1EfPPkejPpVjmfo Ca5q+21jqR90iAZAeTs8vTkYR99+bXlZZ1UlOHZNJN6l+kAPxuS+V8V2ixgXbYNP9ZP3 unBkmPl6O9i/7p3avh2E2oCu+FZ9+OsDIDapL3tQMEishdRYzUHnBpnkQ7w6VLkVyDML gnmqKbtvKHSTS+cIGjp51kauK9R0iezOEoVYkHfpqQRneGprTlxw7ue28M9Ug6JR4aGW 2Nog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="FIaLT/9D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fp18-20020a1709069e1200b0093defbd6273si688409ejc.1018.2023.04.12.21.17.32; Wed, 12 Apr 2023 21:17:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="FIaLT/9D"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbjDMEHx (ORCPT + 99 others); Thu, 13 Apr 2023 00:07:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbjDMEHG (ORCPT ); Thu, 13 Apr 2023 00:07:06 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11D436A4D for ; Wed, 12 Apr 2023 21:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681358822; x=1712894822; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QWKb5WYVBBtztVXr3PHvMcXCQDDphOV1gmNATePnwEA=; b=FIaLT/9DNmz1UT6YxYaeQ6IlOONLMCdsPrXXY+s5k/+fOXOhuBxVqcCq 3FMrlpvKjNWUK+2KR5jCGsruFygztt6Y/x5yRq77HHJbXE2PGJdFaC7ob Szb5dnqGlzYOAUWvHmsMzwM5U4Mqy3up5qBU3f1SLOOuDbZJS6WKVuTeJ yX8O2BXrVBeNeR6ykcwYtTdxVE3GDwwuZTbIzauaDW0GQwahBhfAI4sxt 9SHsEDE+tDq/I0Gq0cN5JCyZcdrmXCegI8Gv8Wxp3/NNzj0+NpFL+/ie1 nTah+Isnri+5p+1b+eTOEse4oAxuBPwDfYWF+CYJJEpCa3M5chtML8hyk w==; X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="332786610" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="332786610" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2023 21:07:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10678"; a="935361058" X-IronPort-AV: E=Sophos;i="5.98,339,1673942400"; d="scan'208";a="935361058" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga006.fm.intel.com with ESMTP; 12 Apr 2023 21:06:59 -0700 From: Lu Baolu To: Joerg Roedel Cc: Tina Zhang , Jacob Pan , Christophe JAILLET , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2 10/17] iommu/vt-d: Remove PASID supervisor request support Date: Thu, 13 Apr 2023 12:06:38 +0800 Message-Id: <20230413040645.46157-11-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230413040645.46157-1-baolu.lu@linux.intel.com> References: <20230413040645.46157-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763033195079867134?= X-GMAIL-MSGID: =?utf-8?q?1763033195079867134?= From: Jacob Pan There's no more usage, remove PASID supervisor support. Suggested-by: Lu Baolu Reviewed-by: Lu Baolu Signed-off-by: Jacob Pan Link: https://lore.kernel.org/r/20230331231137.1947675-3-jacob.jun.pan@linux.intel.com Signed-off-by: Lu Baolu --- drivers/iommu/intel/pasid.h | 7 ------ drivers/iommu/intel/pasid.c | 43 ------------------------------------- 2 files changed, 50 deletions(-) diff --git a/drivers/iommu/intel/pasid.h b/drivers/iommu/intel/pasid.h index 20c54e50f533..d6b7d21244b1 100644 --- a/drivers/iommu/intel/pasid.h +++ b/drivers/iommu/intel/pasid.h @@ -41,13 +41,6 @@ #define FLPT_DEFAULT_DID 1 #define NUM_RESERVED_DID 2 -/* - * The SUPERVISOR_MODE flag indicates a first level translation which - * can be used for access to kernel addresses. It is valid only for - * access to the kernel's static 1:1 mapping of physical memory — not - * to vmalloc or even module mappings. - */ -#define PASID_FLAG_SUPERVISOR_MODE BIT(0) #define PASID_FLAG_NESTED BIT(1) #define PASID_FLAG_PAGE_SNOOP BIT(2) diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index 633e0a4a01e7..c5d479770e12 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -335,15 +335,6 @@ static inline void pasid_set_fault_enable(struct pasid_entry *pe) pasid_set_bits(&pe->val[0], 1 << 1, 0); } -/* - * Setup the SRE(Supervisor Request Enable) field (Bit 128) of a - * scalable mode PASID entry. - */ -static inline void pasid_set_sre(struct pasid_entry *pe) -{ - pasid_set_bits(&pe->val[2], 1 << 0, 1); -} - /* * Setup the WPE(Write Protect Enable) field (Bit 132) of a * scalable mode PASID entry. @@ -521,23 +512,6 @@ int intel_pasid_setup_first_level(struct intel_iommu *iommu, return -EINVAL; } - if (flags & PASID_FLAG_SUPERVISOR_MODE) { -#ifdef CONFIG_X86 - unsigned long cr0 = read_cr0(); - - /* CR0.WP is normally set but just to be sure */ - if (unlikely(!(cr0 & X86_CR0_WP))) { - pr_err("No CPU write protect!\n"); - return -EINVAL; - } -#endif - if (!ecap_srs(iommu->ecap)) { - pr_err("No supervisor request support on %s\n", - iommu->name); - return -EINVAL; - } - } - if ((flags & PASID_FLAG_FL5LP) && !cap_fl5lp_support(iommu->cap)) { pr_err("No 5-level paging support for first-level on %s\n", iommu->name); @@ -560,10 +534,6 @@ int intel_pasid_setup_first_level(struct intel_iommu *iommu, /* Setup the first level page table pointer: */ pasid_set_flptr(pte, (u64)__pa(pgd)); - if (flags & PASID_FLAG_SUPERVISOR_MODE) { - pasid_set_sre(pte); - pasid_set_wpe(pte); - } if (flags & PASID_FLAG_FL5LP) pasid_set_flpm(pte, 1); @@ -658,12 +628,6 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu, pasid_set_fault_enable(pte); pasid_set_page_snoop(pte, !!ecap_smpwc(iommu->ecap)); - /* - * Since it is a second level only translation setup, we should - * set SRE bit as well (addresses are expected to be GPAs). - */ - if (pasid != PASID_RID2PASID && ecap_srs(iommu->ecap)) - pasid_set_sre(pte); pasid_set_present(pte); spin_unlock(&iommu->lock); @@ -700,13 +664,6 @@ int intel_pasid_setup_pass_through(struct intel_iommu *iommu, pasid_set_translation_type(pte, PASID_ENTRY_PGTT_PT); pasid_set_fault_enable(pte); pasid_set_page_snoop(pte, !!ecap_smpwc(iommu->ecap)); - - /* - * We should set SRE bit as well since the addresses are expected - * to be GPAs. - */ - if (ecap_srs(iommu->ecap)) - pasid_set_sre(pte); pasid_set_present(pte); spin_unlock(&iommu->lock);