Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3097404rdb; Mon, 4 Dec 2023 17:26:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3gFnxHRMLmLjeYSPxTGANrepWUpeVQKuUbNnuo0CytsRk2/Iqjryt/gqx8UR0Egv0T2Ni X-Received: by 2002:a05:6a00:1708:b0:6ce:6b61:2f2e with SMTP id h8-20020a056a00170800b006ce6b612f2emr419852pfc.24.1701739617983; Mon, 04 Dec 2023 17:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701739617; cv=none; d=google.com; s=arc-20160816; b=VlwvBkK+wGlsrbxEKmSPbw0dIXlMzLHrHPYzvsLspGsfvSCcTr1UVzYMPbyLrz/8xB 7I7Kp4t+uI/wIiS4/BgTEcU+aX2c1zSqooDL2PK5HU3r62O97uocemhkLBuhjp6jRV64 1S/V2ydqNJbNXLEJI+ZWSIRw468SXkuREJhYz3M0AMoUP6hOiFAjenJA2D3L9ky++E7O gTEOUCq3K70k7otqhk+7YcfrVjT2c7BURI12cVK/UeX3rAxmeiWqIrDnQzWLQQ7lxi/G mCIWMCX6H7UqO8RWcsk/f3Jp0noLDh+sPDCtpOXAJ4jSpEVLEkGASUjU/Q8ElTNVhwgS 8uUQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=usiSsj9ncjlWC9m4roHQBjAkjS06uWfpkuTyGDpwXBk=; fh=5K4v/0ku97kpa0vTvhWLyUEWwXZiIFVMmzwLLirrjJ4=; b=WkRejBJqD5hOJ6mKTjefN7a3U/D3GhngHNnqwLwOIq8UC+/HAO/nJC0/EptF/TbCtl x1AXqAguijBjRdA3yWW6kf4pUC2y5p3ArqlepXiLmN+8yCHTCYNNX6dRNdlmUk6emEOm WYBNrVgfMrProqPDg1NMiJk/X9DKBh+6npcHVs9++UvscGME+Yhu8lMHWUUO5RQAEL8y gATfV651Mk7jHy5ubjDDBpsljeZPv8QfT+gjKmIOmJIE7Q5Fq+ej7J64niA+CPQ5BQ1K OFmXcJ1Z6d9RLKY/wlid20ajYpyHe9+fh8doq9cvTftTElL4sWJDXy/k2DW+++ho4i7a vPOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dsdSO3FI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id v3-20020a056a00148300b006cd9e5b2d84si635829pfu.328.2023.12.04.17.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 17:26:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dsdSO3FI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id CECE280220B9; Mon, 4 Dec 2023 17:26:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231534AbjLEB0g (ORCPT + 99 others); Mon, 4 Dec 2023 20:26:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230128AbjLEB0f (ORCPT ); Mon, 4 Dec 2023 20:26:35 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61CE8B4 for ; Mon, 4 Dec 2023 17:26:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701739602; x=1733275602; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Bkkpqs/4u4rtpGgvFYZ8AVk/jZfzha1HLmAg3v2cthU=; b=dsdSO3FIG0/ylEWmEqvSRJCdj/QpY93FuIN+YWrMvd5E6fKJu/nWYV0P ECCn2ZwIFkN9XmdmA61diZFaB/3MJ4mVPV/VlSdxQTt7iFC+VbsPTvHuk 7f1MRjE4iTYZuPGeM8Vh5Rf0WqGMYmqHuwOg06Q8X/UsjE+eXRkfzLX8l y9pD6vz0JhyWOoTAQcjJLEYZbIBkUcZvDzyQuztL+06T8D6ESZFDhJMfE +ya/iUTq5yESbzbYDJAbMnbl2ZaM9YKdNOOpSAv3Aj7pMpUn1qYn3MhBv N2Wmn1Uxpsm4w03cw9+C3osDJOjLzOLY08z93ODGPav+4qOmIw1NPNF4A g==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="460313322" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="460313322" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 17:26:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="1102276164" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="1102276164" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga005.fm.intel.com with ESMTP; 04 Dec 2023 17:26:39 -0800 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 0/6] iommu/vt-d: Convert to use static identity domain Date: Tue, 5 Dec 2023 09:21:57 +0800 Message-Id: <20231205012203.244584-1-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 17:26:52 -0800 (PST) Intel's IOMMU driver used a special domain called 1:1 mapping domain to support the domain of type IOMMU_DOMAIN_IDENTITY, which enables device drivers to directly utilize physical addresses for DMA access despite the presence of IOMMU units. The implementation of the 1:1 mapping domain is influenced by hardware differences. While modern Intel VT-d implementations support hardware passthrough translation mode, earlier versions lacked this feature, which requires a more complex implementation approach. The 1:1 mapping domain for earlier hardware was implemented by associating a DMA domain with an IOVA (IO Virtual Address) equivalent to the physical address. While, for most hardware supporting passthrough mode, simply setting the hardware's passthrough mode is sufficient. These two modes were merged together in si_domain, which is a special DMA domain sharing the domain ops of an ordinary DMA domain. As the iommu core has evolved, it has introduced global static identity domain with "never fail" attach semantics. This means that the domain is always available and cannot fail to attach. The iommu driver now assigns this domain directly at iommu_ops->identity_domain instead of allocating it through the domain allocation interface. This converts the Intel IOMMU driver to embrace the global static identity domain. For early legacy hardwares that don't support passthrough translation mode, ask the iommu core to use a DMA type of default domain. For modern hardwares that support passthrough translation mode, implement a static global identity domain. The whole series is also avaiable at https://github.com/LuBaolu/intel-iommu/commits/vtd-static-identity-domain-v2 Very appreciated for your review comments and suggestions. Change log: v2: - Re-orgnize the patches by removing 1:1 mappings before implementing global static domain. v1: https://lore.kernel.org/linux-iommu/20231120112944.142741-1-baolu.lu@linux.intel.com/ Lu Baolu (6): iommu/vt-d: Setup scalable mode context entry in probe path iommu/vt-d: Remove scalable mode context entry setup from attach_dev iommu/vt-d: Refactor domain_context_mapping_one() to be reusable iommu/vt-d: Remove 1:1 mappings from identity domain iommu/vt-d: Add support for static identity domain iommu/vt-d: Cleanup si_domain drivers/iommu/intel/pasid.h | 1 + drivers/iommu/intel/iommu.c | 568 +++++++++++++++--------------------- drivers/iommu/intel/pasid.c | 180 ++++++++++++ drivers/iommu/intel/svm.c | 2 +- 4 files changed, 415 insertions(+), 336 deletions(-) -- 2.34.1