Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1909455rwn; Fri, 16 Sep 2022 02:44:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fW5JrS5VFMngzGHTw+FGLmMlHROIGIliOdNn1yCmOdm98ENVXdcRdjMgxzeNsphbKQ1Ct X-Received: by 2002:a17:90b:5096:b0:202:df4f:89a with SMTP id rt22-20020a17090b509600b00202df4f089amr4729328pjb.25.1663321499407; Fri, 16 Sep 2022 02:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663321499; cv=none; d=google.com; s=arc-20160816; b=vSw6uRgBtBG3uGODxwPQ1li+tZxCgpOd0S1JucrFWT/F1j80GWLB/QBz6Tt8Y6enKs j0u+B/Rv3ZhtDvl52zO/6Hit3D8yOCkmmwGBW4TIDw2SVgV5GhKBuX0aqUgd8QhdXlRz Pbf3MUPyXxQRkMsz9V1YsNDbTb4OrcD+M4krIezk2GqJsiG0yJrbpFhGTOF55MGZfxXV 67sQWYWw0PY08emhUyQRalur/NpiZ7wOLXrkPqot/DO/8QcERQnTcj1UDsD8Kcs1FlHo Xi0i/bXK09KZiZtsVoadAHa8BIFSWXSb51l6T5b9MXTaTwMG8Y7Zi1HxezBn6TUUkX4R X3Eg== 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; bh=ANo9wKMmcxm+jP1gbYHqbIqW9ezuVt02Yv/nKHnJd9w=; b=KgER2vfkzlPlIOWNqSoo8mioWWs9mN7B9r+ZsgTjixyM7RgUW3Kfyu0PWukabm3rwL R7GqPSuPzHRUyDzxRxTOlVS/tCdykiyeCoY3i8Pliy3KB1NwLxrhhrc17E6/F/f4ec45 CrUIO7L2sqPv48SRRnxT0mLIrbvoozwci9VhyPCVzQ1+OivGBnHrY2FBp0hdeEB6qK48 Kv40WRThqi6QYi3kpfFxA+UJjMk2x86EactoVw5q1jhsUXgMlUlJUlgpvYk83jdHBv91 RPxx600u2FCZi1UHBWGnDN6Mt1dGdlLsdIxDgZK4fDmeT0KznTvU9uR0KpEYxPcU0mW6 G1iA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n66-20020a632745000000b0041b4bc77d5esi5854927pgn.621.2022.09.16.02.44.48; Fri, 16 Sep 2022 02:44:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbiIPJl5 (ORCPT + 99 others); Fri, 16 Sep 2022 05:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbiIPJl4 (ORCPT ); Fri, 16 Sep 2022 05:41:56 -0400 Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5DC9A6C52; Fri, 16 Sep 2022 02:41:54 -0700 (PDT) Received: from robin.home.jannau.net (unknown [91.200.110.112]) by soltyk.jannau.net (Postfix) with ESMTPSA id 5368A26F072; Fri, 16 Sep 2022 11:41:53 +0200 (CEST) From: Janne Grunau To: iommu@lists.linux.dev Cc: Konrad Dybcio , asahi@lists.linux.dev, Alyssa Rosenzweig , Hector Martin , Joerg Roedel , Krzysztof Kozlowski , Mark Kettenis , Rob Herring , Robin Murphy , Sven Peter , Will Deacon , devicetree@vger.kernel.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 0/5] iommu: M1 Pro/Max DART support Date: Fri, 16 Sep 2022 11:41:47 +0200 Message-Id: <20220916094152.87137-1-j@jannau.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 Hej, this is the next attempt adding support for the DART found in Apple's M1 Pro/Max/Ultra. This adds a separate io-pgtable implementation for DART. As already mentioned in v2 the pte format is not fully compatible with io-pgtable-arm. Especially the 2nd least significant bit is used and is not available to tag tables/pages. io-pgtable-dart.c is copied from io-pgtable-arm.c and support for unused features is removed. Support for 4k IO pages is left for A7 to A11 SoCs as there's work underway to run Linux on them. The incompatibilities between both Apple DART pte seems manageable in their own io-pgtable implementation. A short list of the known differences: - the physical addresses are shifted left by 4 bits and and have 2 more bits inside the PTE entries - the read/write protection flags are at a different position - the subpage protection feature is now mandatory. For Linux we can just configure it to always allow access to the entire page. - BIT(1) tags "uncached" mappings (used for the display controller) There is second type of DART (t8110) present on M1 Pro/Max SoCs which uses the same PTE format as t6000. Changes in v5: - collected Sven's ack - minor fixes in "iommu/io-pgtable: Move Apple DART support to its own file" Changes in v4: - split dart and io-pgtable-dart build to allow building dart as module - add missing "SELECT IOMMU_IO_PGTABLE" - made map/unmap_pages/iova_to_phys inon-recursive - replace pgd concatenation with multiple table handling - simplified config and page size checks - collected Robin's Ack Changes in v3: - move APPLE_DART to its own io-pgtable implementation, copied from io-pgtable-arm and simplified Changes in v2: - added Rob's Acked-by: - add APPLE_DART2 io-pgtable format Janne Grunau (1): iommu/io-pgtable: Move Apple DART support to its own file Sven Peter (4): dt-bindings: iommu: dart: add t6000 compatible iommu/io-pgtable: Add DART subpage protection support iommu/io-pgtable-dart: Add DART PTE support for t6000 iommu: dart: Support t6000 variant .../devicetree/bindings/iommu/apple,dart.yaml | 4 +- MAINTAINERS | 1 + drivers/iommu/Kconfig | 13 +- drivers/iommu/Makefile | 1 + drivers/iommu/apple-dart.c | 24 +- drivers/iommu/io-pgtable-arm.c | 63 --- drivers/iommu/io-pgtable-dart.c | 470 ++++++++++++++++++ drivers/iommu/io-pgtable.c | 3 + include/linux/io-pgtable.h | 1 + 9 files changed, 512 insertions(+), 68 deletions(-) create mode 100644 drivers/iommu/io-pgtable-dart.c -- 2.35.1