From patchwork Sun Jun 16 22:40:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 13699690 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 20311C27C53 for ; Sun, 16 Jun 2024 22:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=5j391aqzto/eP3nHKqZk0FiYDMLfsJfpvURrq3AtCxI=; b=0mz4zAqpR/NBngWQWCz8GJ58rs rGRT55ymy5q/+OLNXdiQLkN/k3xhq977XChNcIO9q+dcE/BKh032SuBP+bgSGUiUZLeBZ3/SoxRLk pRaRuCIbmnhxhVTpQBiJKd8zadDMgVdkXOp+1/AVlPZBrFj+MU36WckctJPiVWxp1cVFq6hU7EYRM Xtn9xRVFSnX6tXm+pJfwQfQXfedfJu8V+Dp8g83A8/6xScVu4s9aIpJBDBh2CTHnNZROd9E5BvKtf eYp0rMJEae2tTZaVO7f5m4fDMG5YSn7CvVBI9ChlnkcobCf+L0UGQ05Ll0JHqlC8ivoaFl9TZdILL awFZ8Qbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sIya3-00000008SN2-0J6W; Sun, 16 Jun 2024 22:42:35 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sIya0-00000008SM5-1xvN for linux-arm-kernel@lists.infradead.org; Sun, 16 Jun 2024 22:42:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 90B99DA7; Sun, 16 Jun 2024 15:42:54 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C60A13F73B; Sun, 16 Jun 2024 15:42:27 -0700 (PDT) From: Andre Przywara To: Joerg Roedel , Will Deacon , Robin Murphy , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Krzysztof Kozlowski , Conor Dooley , Rob Herring Cc: Chris Morgan , Ryan Walklin , Philippe Simons , iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 0/5] iommu: sun50i: Add Allwinner H616 support Date: Sun, 16 Jun 2024 23:40:51 +0100 Message-Id: <20240616224056.29159-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.39.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240616_154232_579119_BB148F9A X-CRM114-Status: GOOD ( 15.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Version two of this series adds a check that no physical address larger than 4GB makes it into the PTEs: the map_pages() function returns an error and prints a warning into dmesg to give users a clue why this failed. I haven't tested whether this really happens, or whether the 32-bit DMA mask of the master devices already prevents this. In the worst case this might fail on devices with 4GB of DRAM, but would always work on smaller devices, which are arguably under bigger pressure to find contiguous PA ranges. Changelog below. =========================================== The Allwinner H616 contains an IOMMU almost compatible to the one used in the H6. The differing default reset value of the bypass register makes the two technically incompatible, so use a new DT compatible string to be on the safe side. The required driver changes can be applied to both variants, so the driver is ignorant of the differences between the two for now. Change the driver to cope with the new variant in patch 1/5 and 2/5, then apply the required devicetree and binding changes in the remaining patches. I could just verify that the driver probes and allocates the page table from below 4 GB. Others have verified that the driver works with the (not yet upstream) video decoder engine, but more tests are surely welcome. Cheers, Andre. Changelog v1 .. v2: - return error for too large PA in map_pages() - add Krzysztof's ACK to the binding patch Andre Przywara (4): iommu: sun50i: allocate page tables from below 4 GiB dt-bindings: iommu: add new compatible strings iommu: sun50i: Add H616 compatible string arm64: dts: allwinner: h616: add IOMMU node Jernej Skrabec (1): iommu: sun50i: clear bypass register .../bindings/iommu/allwinner,sun50i-h6-iommu.yaml | 7 ++++++- arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 9 +++++++++ drivers/iommu/sun50i-iommu.c | 15 +++++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-)