Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3558336rwl; Mon, 27 Mar 2023 16:19:31 -0700 (PDT) X-Google-Smtp-Source: AK7set9g5mihvUugLlMb+bH3spDGU4Qeg+ORTW4cqsm38NjbxRjNweNz611BI4Q+yN92yir8eToI X-Received: by 2002:a05:6a20:c520:b0:d6:5fd9:6a99 with SMTP id gm32-20020a056a20c52000b000d65fd96a99mr15516755pzb.18.1679959170845; Mon, 27 Mar 2023 16:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679959170; cv=none; d=google.com; s=arc-20160816; b=dpV+865yEZqcCV/trQjt7Aw5vzK3nqyog+fUBL4+hahhy7EhsBqcV3XK4YWlfUXL/j LmSwxkcNPzZORZUiWWPEF3cjjjy6oyi4JrQy+990a+uP4ugoRQj8PWQwoVXAghyZBD0j 5wKSzsb+lCW8bG/s6S0R5qt3ITcvJKyWr5GRv7ZNNHuujbgYTnaCVUHhwx0hZQKJZ2pp DO51Qfw/aFlcjjjmTpDYYcqxxzCTjwcQgkUktknhncahvbC1+ZFj6r4HBqKB4ZNrxoZw Ccnzk5fZHrKJeuZeI4sUgNn6Wi3AE4S20vPiq3FUqIEm2VxCkFtnikhyeM9+QGuTvKsl SHkA== 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=etI5G37ex7gRsr0Ne8EBsrCgceYl8WZtrNavGVoAyPxZaJRiERVoPZmNNEvEsvHxL1 vrPHy6i/9fbUZ81TFEI7sscuFPfCX9x2NjhocYaETgIVnKAtZNXXqSGMYBeboP8JBboi l4dPXVW7SERGpJHjWlKct40/5XkLGctheEXbn9S665K3aMrB2uzm4Q6r/QqKTQQsbPcc 1tjmpAEuUO52bGyPRs9znQ2JXjZ5pW6C6nP37mJL5LSemadKX3tFkHV/8fe1OVYPJKIJ F2wzQdMJ8GsT+HXPyRhfV5RNCf1bDbGJCvY/GoOtSDeNebkEouagTnfhv/qMb5T7tUq0 9rOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RE6QS8iC; 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 y29-20020aa78f3d000000b005d8fd3b36ecsi28032765pfr.228.2023.03.27.16.19.19; Mon, 27 Mar 2023 16:19:30 -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=RE6QS8iC; 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 S231203AbjC0XRm (ORCPT + 99 others); Mon, 27 Mar 2023 19:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbjC0XRj (ORCPT ); Mon, 27 Mar 2023 19:17:39 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7D0F2128; Mon, 27 Mar 2023 16:17:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679959058; x=1711495058; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HlcZA4KeerUzEWCR/cSspUC1VQcP8r9snsO4hSuDpJo=; b=RE6QS8iC1MH8FCPV+a43n81lWWTQXWNcZow3L9gZWJfc889XLiIvaTtB l76aM+l272GCvNBNIL+ywmUbFwJHpOP2Ps+Kg2XJbjuO3uQvGrkHFJczM Q6WXnrDW9RTJUQMn7VAbf29dTTRXKH9/XOc6ygbNvDMuMmSxIzj7TvaAM qJkfEuVYn9jr2FRgZdh66rZSe1NBiolJ7D4LZwqmuHInpSNy4VqxAsWc6 FU7pB8Hpo/RTJbikBmx0oYildrwfV0ClHSbrlqtkkWdh4Xs4UE3OcB5GB cUQgs4CeMi6AL85BTWpWZx0/JzEVReCm8p03Sn8H9YXV6IXBNpuVPB1yB A==; X-IronPort-AV: E=McAfee;i="6600,9927,10662"; a="320817293" X-IronPort-AV: E=Sophos;i="5.98,295,1673942400"; d="scan'208";a="320817293" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 16:17:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10662"; a="686144711" X-IronPort-AV: E=Sophos;i="5.98,295,1673942400"; d="scan'208";a="686144711" Received: from srinivas-otcpl-7600.jf.intel.com (HELO jacob-builder.jf.intel.com) ([10.54.39.106]) by fmsmga007.fm.intel.com with ESMTP; 27 Mar 2023 16:17:37 -0700 From: Jacob Pan To: LKML , iommu@lists.linux.dev, Jason Gunthorpe , "Lu Baolu" , Joerg Roedel , dmaengine@vger.kernel.org, vkoul@kernel.org Cc: "Robin Murphy" , "Will Deacon" , David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , "Yu, Fenghua" , Dave Jiang , Tony Luck , "Zanussi, Tom" , Jacob Pan Subject: [PATCH v2 1/8] iommu/vt-d: Use non-privileged mode for all PASIDs Date: Mon, 27 Mar 2023 16:21:31 -0700 Message-Id: <20230327232138.1490712-2-jacob.jun.pan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230327232138.1490712-1-jacob.jun.pan@linux.intel.com> References: <20230327232138.1490712-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. 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