Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1172733rwl; Fri, 7 Apr 2023 11:02:32 -0700 (PDT) X-Google-Smtp-Source: AKy350Z0RO7p6FNEWI5UY+vl/8cESPjvJIZcFn5jraBZ04a5oM0U3zGTpb9UAhaXuLnuj+2det2/ X-Received: by 2002:a17:906:1188:b0:947:793d:b5c4 with SMTP id n8-20020a170906118800b00947793db5c4mr295608eja.64.1680890552137; Fri, 07 Apr 2023 11:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680890552; cv=none; d=google.com; s=arc-20160816; b=lYNFatD8RLwhE/R/Er29h8KkUZKXRM1vgZ6GbMiaS3raykgwo/JYNjKGTMsxX2el/B Hu2NKhrRPe0E6qhBjF+P6AZHzKvC4muaAmFb/g4snbnpuqivkA0OlsdAkuxeDQtnG3BB VC/vRpzO4B2Q6eX5yZK60XsizAtPzY76fmKSrj/zaI2KP/HtKLA4RiB9s32pCrLQ4oF8 M65blAxDIbIN8rNgwHl9xZrq7+8yl8ad8bbHEicGBDAnVD8syZFBoGPgYiCI0lkDdqiN YVMMrHkOcNPnbHfRHq9W4oaqnECRSoNkK32BlWu2rAOJP0v9pPt2DwJ1W+I2eB5XgPer ckrA== 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=EbHzM+jQoiSYkZHI8m/FgcwUG9Tz3f34TINxnrmmTGw=; b=oUnfQjdIiZU6jbWR64DAzUC/gaj72ssQtHr0Gz1hfnrprLc9aOgqWOTF/ontCkQ8yC wqDqRDZb73zHftopkiBfwug6u9MJkxfPxMl0Q7To0+6Rl8/3H0nzDw0GSaOnJaPiVW07 xnWT2R9AB/T9RoM5rBn5pwQJRtlTn1cVrqVmmY3t4/8GzXf1asV2/IEtQrQFrA3MpFL0 e9TdI7rUSFIhYpQ7vr8l8iamx3fryvTaLBb0ABuvZZgDIYKLLkQfqlLsR2XWbw0hJnj0 UB1cvDaUWhbZV9HPkpvc1zR9bloOZCyhhSdjTb3vRa+FQuOzJphzJ5hrjzcXCQ2mZs9U 99jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MA8vZ6KX; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb18-20020a170907961200b00948c33042fcsi4803345ejc.998.2023.04.07.11.02.04; Fri, 07 Apr 2023 11:02:32 -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=MA8vZ6KX; 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 S231342AbjDGSBz (ORCPT + 99 others); Fri, 7 Apr 2023 14:01:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231290AbjDGSBx (ORCPT ); Fri, 7 Apr 2023 14:01:53 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86F25B8B; Fri, 7 Apr 2023 11:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680890511; x=1712426511; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JiKWRtMCJrQDoJeK3U/0yd9kaHBuQqQPeP9njgeoB0o=; b=MA8vZ6KXP4pZonY0eJeeUrclpfekJgkyQ6zlfZB+LZhjHjNxTD/K5pct WKT1xqdMXqntr6k8elRPexUPa40Z0Q8BcfXSWD9Gc+EQL7JXKvq2iwnwA d4o5n3wozxii4InyAtFDXGNMvwJWSHgBr8LoN4GrQMHWqMVgWejx7PNDW aN1Ps0hA9+YtOcve5FKx9k46/pa3Bjs7QLS2IV35BQYoAfYJJAgHOGZa2 izzWbYJPWwFS/YzC4q+siG16MIlt2pHexmPJ7IxrPstlb5jTR3A2qxEyX 3VD2xyUEnievFAna6WnM+ul2LHFF4ly+1ukJFsrKvkRDKvQdun6T5jr+Q Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10673"; a="343046458" X-IronPort-AV: E=Sophos;i="5.98,327,1673942400"; d="scan'208";a="343046458" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2023 11:01:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10673"; a="776910042" X-IronPort-AV: E=Sophos;i="5.98,327,1673942400"; d="scan'208";a="776910042" Received: from srinivas-otcpl-7600.jf.intel.com (HELO jacob-builder.jf.intel.com) ([10.54.39.106]) by FMSMGA003.fm.intel.com with ESMTP; 07 Apr 2023 11:01:49 -0700 From: Jacob Pan To: LKML , iommu@lists.linux.dev, "Robin Murphy" , Jason Gunthorpe , "Lu Baolu" , Joerg Roedel , dmaengine@vger.kernel.org, vkoul@kernel.org Cc: "Will Deacon" , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Tony Luck , "Zanussi, Tom" , Jacob Pan Subject: [PATCH v4 2/7] iommu/vt-d: Remove PASID supervisor request support Date: Fri, 7 Apr 2023 11:05:49 -0700 Message-Id: <20230407180554.2784285-3-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230407180554.2784285-1-jacob.jun.pan@linux.intel.com> References: <20230407180554.2784285-1-jacob.jun.pan@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 There's no more usage, remove PASID supervisor support. Suggested-by: Lu Baolu Reviewed-by: Lu Baolu Signed-off-by: Jacob Pan --- drivers/iommu/intel/pasid.c | 43 ------------------------------------- drivers/iommu/intel/pasid.h | 7 ------ 2 files changed, 50 deletions(-) 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); 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) -- 2.25.1