Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1173623rwl; Fri, 7 Apr 2023 11:03:12 -0700 (PDT) X-Google-Smtp-Source: AKy350atcy6gGTaIWn+0RpKTcDijG12KL3h/bVP5PL99u7c5tniMK2mntZagOXCO3yJbbpGQx3W7 X-Received: by 2002:a05:6402:509:b0:504:8410:c7b6 with SMTP id m9-20020a056402050900b005048410c7b6mr747718edv.10.1680890591869; Fri, 07 Apr 2023 11:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680890591; cv=none; d=google.com; s=arc-20160816; b=x2pqdBibgboBgmw207lJ8MwxbpJ+1SaQHBVwGrjzfjsa4mBfgcFY9qW/ZlEvJpI0DA 9YSVwRQO4U9VVDSnJGPMt37q3t1M+YJgDZ16L1LvxK1bQxnTv9LEN7I3jpEHG7cvaB9+ yZspbWkoOvavjqUG4sFTJXAbwOLJO/5cLsF7TmbYIVtu/2HRt2x6f+W+8dkaGlbPnyFs cSiq+8ei5i1ounIpcOzXfnKtYVLxV7BjByWDkFgeBc9oULVmUD27G/JLJ6YPB9yxHTxW I464JMT2uPzIOYCzhvf1NHCE1RD0tIJ54pJdJ3hx7LLxSW1hdcAKYCvu/+vDNBiRt67U RJag== 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=nID03jVgwG19PCNtOCRICQZMTEK9t22mbwTkq8U3FgI=; b=sELfy4Rz2Lu+ZdoyK7sRHrNViwdupdnN5emKbmvF6Gc8xEFIS4zYgoQQIzIXcy0bbE UTzVxcWYHeLkLMmcAxW8ZiaNgGeVfm0SHMF5O9EhOYsmG6nK4wbgyWOPx8x1eJPKKZCi isdiFKZnyr0hCVA/DMPqSp4KSbYNa512HMlokUq7Re5dt6yHxyC7A7CnOyofv6OeMU/7 iE9ghYnQ2liDEGSKDluyGbhvFVbBWEZs4MwD3hU+Amz8ZciBs4OHQLDF9kRFLJjCWF8R CZ84Awd0IV5aDvB3Sh/y0fdOBLRF4tDqtxawIqAW4PWq1oASVtLpx1NqX4tuKAeNrmp8 lilQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="XofAS/6Y"; 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 d19-20020aa7c1d3000000b004aaa70a9f13si4047487edp.298.2023.04.07.11.02.44; Fri, 07 Apr 2023 11:03:11 -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="XofAS/6Y"; 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 S231466AbjDGSCB (ORCPT + 99 others); Fri, 7 Apr 2023 14:02:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231303AbjDGSBz (ORCPT ); Fri, 7 Apr 2023 14:01:55 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 611946184; Fri, 7 Apr 2023 11:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680890513; x=1712426513; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9tjb6xbQRtW38Psd2PFivPrB5ndPCUqQv+VHHV7YSCI=; b=XofAS/6YE6hvkQZKFMUrsArwgQEqLJDAXNaFTayUh0TdvYl4gAODdzqF 4GvD0X0cozCeu1nlPsbPx0hr2p0eOQFmnFjqNtwdKd0BKRYb62EM9ZgDU yssYZpgfG55tCPIVQ0jd7seGt6kiZhdMGhJr85yDO9TBY5hjdHzqUxGTG 3kTcwF8hnMZDLai5GBNOyQniXXndAj+4PClNKZFtD8nt6y+GxR+/VX6su VU5NLrLKPfwpBxl2cdg14O3h0scen0hWXu+rJt/iGa1O7k/Rvq0RKXuOX 61Xvvf37WHhS8NTtjxwcKkJr8aWnCb9qECC40Ju/rSxwk8GyAAmDbR694 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10673"; a="343046476" X-IronPort-AV: E=Sophos;i="5.98,327,1673942400"; d="scan'208";a="343046476" 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="776910038" X-IronPort-AV: E=Sophos;i="5.98,327,1673942400"; d="scan'208";a="776910038" 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 1/7] iommu/vt-d: Use non-privileged mode for all PASIDs Date: Fri, 7 Apr 2023 11:05:48 -0700 Message-Id: <20230407180554.2784285-2-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-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 Supervisor Request Enable (SRE) bit in a PASID entry is for permission checking on DMA requests. When SRE = 0, DMA with supervisor privilege will be blocked. However, for in-kernel DMA this is not necessary in that we are targeting kernel memory anyway. There's no need to differentiate user and kernel for in-kernel DMA. Let's use non-privileged (user) permission for all PASIDs used in kernel, it will be consistent with DMA without PASID (RID_PASID) as well. Reviewed-by: Lu Baolu Signed-off-by: Jacob Pan --- drivers/iommu/intel/iommu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 0768dcae90fd..9f737ef55463 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2338,8 +2338,6 @@ static int domain_setup_first_level(struct intel_iommu *iommu, if (level != 4 && level != 5) return -EINVAL; - if (pasid != PASID_RID2PASID) - flags |= PASID_FLAG_SUPERVISOR_MODE; if (level == 5) flags |= PASID_FLAG_FL5LP; -- 2.25.1