Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1731763rwl; Fri, 31 Mar 2023 16:08:53 -0700 (PDT) X-Google-Smtp-Source: AKy350b3jsF6GlzCiCOsvKhrZ3GBf3Y287Jcn+DAWE/201KGME8i1BSSOskzR8xA9jGJZLvLPfJY X-Received: by 2002:a17:90a:fd81:b0:240:c0df:64fc with SMTP id cx1-20020a17090afd8100b00240c0df64fcmr7147136pjb.2.1680304132733; Fri, 31 Mar 2023 16:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680304132; cv=none; d=google.com; s=arc-20160816; b=K1kTLxLfEP6HIIhza/UGN47gzA1cFFvca7e2CBo+W5wvIrR0Td5SIt5w5Z/TmEdU4s 5Z5aV5OQPMup2GjXje43Hwwu3JpFtCoI1UTqlUl5QnZdyo9kCro7ikkoRXcoRgfUipH1 Mezd2BEsiaV2WpWw6gAz1BjSTHDtdzE3AUkGJdwpXrOBmCPgaaC5G44PO+kYeNkNdMh3 wTvAjsfg8Sywog4hRotb6OLQJNv1gVKFCMWfWPh4OTCjzxQjmKLcc+ySCsE3IhVbaETr JLewQR6xeYjyJ14JbcRz+S7UKwb+Foj6uYAqwyqFkUpsSHfVfIDgXmXAiX7hkoBwlDZ/ jnIg== 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=uoOydllU6T+2zhtYD2LiBkrfMDQYiMs6FC516HwVnl0=; b=KKmJ+1BOwTGX/I3qr1yYgo/BkxxZqGsX4VRvcLtOOqMF7D+0WgHtVtYgyu5lpbPNrm jZlEPGd7Oua2WYXBc2lT/QWBRx8kIDbJ0lRERqiEVZpocqBcdTfPRtqVWUP3SoeHuEi8 oThJtuur6j9VpdSTqLFNS9ZJl67cV1BHLMjnqLBoA036XjKzoLBOzciFjxdW0liNwtF1 1tqxtNIaNOBSbZCdVgB19Vp9NhGisNPhd0OdfA7k8iBJ95fLpOBWB7Nwl7a5PwTT/XaA 8e8y0ACWWdomuCVf1h/fpMZLNCz6joOSHvDEBOJKwDhSsfejkXepm3rcZbdEk2HsMOQy EZjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LPXPVsVV; 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 p15-20020a63c14f000000b0050bfa82c246si3343983pgi.875.2023.03.31.16.08.18; Fri, 31 Mar 2023 16:08:52 -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=LPXPVsVV; 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 S230193AbjCaXHh (ORCPT + 99 others); Fri, 31 Mar 2023 19:07:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230332AbjCaXHe (ORCPT ); Fri, 31 Mar 2023 19:07:34 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F24151A471; Fri, 31 Mar 2023 16:07:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680304054; x=1711840054; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HlcZA4KeerUzEWCR/cSspUC1VQcP8r9snsO4hSuDpJo=; b=LPXPVsVV49RCCnyH83kRYpJdEeVxQQt5YIJK7cgUnGgECmERjHTfEfEh bTC3nZFeRJqE6DRWjDXhbKXf4r/J+xcOLQvpzWWa+dNnjYtfdFqp9R9pc Zhh0w6E/K8T3koqtOG5LJTz++4NLOSSNMcsr4rD6ar6yMuEo5TWjJyihI sgC51QCoxXnmBN2YC7qvWMvIfO2zs8zt6SP4+LxNXwSGDmvGIeUym45f+ LC4v34ad2zStgn8Gmd3OTZnRuzXfKFVf6bdaNwIMBgGbJ6v02Q6k8Sxpt kWqzrcZXJcDhub1lyOSKAN6oTQXTOuQJ9VcJ+XmTyO4vxOtgJW4B2zGAO w==; X-IronPort-AV: E=McAfee;i="6600,9927,10666"; a="343245123" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="343245123" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2023 16:07:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10666"; a="717888337" X-IronPort-AV: E=Sophos;i="5.98,307,1673942400"; d="scan'208";a="717888337" Received: from srinivas-otcpl-7600.jf.intel.com (HELO jacob-builder.jf.intel.com) ([10.54.39.106]) by orsmga001.jf.intel.com with ESMTP; 31 Mar 2023 16:07:32 -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 v3 1/7] iommu/vt-d: Use non-privileged mode for all PASIDs Date: Fri, 31 Mar 2023 16:11:31 -0700 Message-Id: <20230331231137.1947675-2-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230331231137.1947675-1-jacob.jun.pan@linux.intel.com> References: <20230331231137.1947675-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,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,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. 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