From patchwork Tue Jun 20 09:51:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13285530 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 9E1D2EB64D8 for ; Tue, 20 Jun 2023 09:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=oMp2qS0lY1mfAZJfreKiHgPFBsxKBxaVoKx1KmK+swg=; b=SrJ4i5/uBlcGzy eu0b+7RRiJphk1LGgXb0fEvXkVBapCkWzwozqAuGKnJjNzaQKzHUclMb0dqHyp70Lh/klrVPcLf28 +aaiSHVPRQ7fs7SZp7edK17EAI4xliNl7D9gC3b7iJwYZYSyIA5QgEKYXj5hL7shO9vs4iW2nGdtz QVRI5QlMm6UwJK2nlV4aOSAyrKQaS9nIsEt36PrgmC91tR1h50q7TPQ1bBYP0X++fhn5fs4WARfx3 UKbhpA8AroiIF8HwaEr9nOp5JxijdZ20foe+fycq42QgMbbBQdcTB5L9lEHwpQ/nCz2BVMlEY2ujQ 6uV7c+RPf1nEQOdnSqag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qBY1Q-00AmBn-0C; Tue, 20 Jun 2023 09:51:36 +0000 Received: from madras.collabora.co.uk ([46.235.227.172]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qBY1N-00AmAY-1F for linux-arm-kernel@lists.infradead.org; Tue, 20 Jun 2023 09:51:34 +0000 Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:c5f8:7372:f042:90a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 004026602242; Tue, 20 Jun 2023 10:51:30 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687254691; bh=uwyXNF91v6sGa/spbsQK7wgAPR7kXwSg3iM/Za/E/Xk=; h=From:To:Cc:Subject:Date:From; b=BPG4e43Bc1WYfvc9ppgzIf3ZLFkS/kDzOrzHj1Bb+188214CDobn964KQShkW99jc gw+qld4zJq4vDmwoM0ett2hIaLJtNR752pRFX8amyiwdp5vdfcnitygfeHhxguPmkg sQ/pGm1BZNWMqb/MhkGo82mfhsQutaZE9HzQjTtkd3nVuuesxQWWfNZGF92ibeupnp hhyT91I6tubjw9X2/113WaghEqrhKaDumwaDgTuShtsAj/9UP9i/C9HdBG0rbmkEdh Q2LKk+j5VxWWHKQU4+zLIS7TKW079pox5c0Cu+CIk5TZ+hCSQGgG52C2qZeTWgx4oY f6lHArq+I2p+Q== From: AngeloGioacchino Del Regno To: agross@kernel.org Cc: andersson@kernel.org, konrad.dybcio@linaro.org, dmitry.baryshkov@linaro.org, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, robdclark@gmail.com, linux-arm-msm@vger.kernel.org, iommu@lists.linux.dev, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno , kernel@collabora.com Subject: [PATCH v4 0/6] Add support for Qualcomm's legacy IOMMU v2 Date: Tue, 20 Jun 2023 11:51:21 +0200 Message-Id: <20230620095127.96600-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230620_025133_601577_857AE012 X-CRM114-Status: GOOD ( 10.24 ) 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 This series adds support for handling "v2" firmware's IOMMU, found on at least MSM8956 and MSM8976 (some other SoCs also need the same but I honestly don't remember which ones precisely). This is strictly required to get functional IOMMUs on these SoCs. I'm sorry for not performing a much needed schema conversion on qcom,iommu.txt, but I really didn't have time to do that :-( This series was tested on Sony Xperia X and X Compact (MSM8956): ADSP, LPASS, Venus, MSS, MDP and GPU are happy :-) Changes in v4: - Rebase over next-20230619 - Rewrite qcom,iommu.txt changes to qcom,iommu.yaml - Changed reset writes to only disable CB through CB_SCTLR and reset CB_FSR and CB_FAR - Addressed misc reviewer's comments Changes in v3: - Removed useless FSRRESTORE reset and definition as pointed out in Robin Murphy's review - Fixed qcom,iommu.txt changes: squashed MSM8976 compatible string addition with msm-iommu-v2 generics addition Changes in v2: - Added back Marijn's notes (sorry man!) - Added ARM_SMMU_CB_FSRRESTORE definition - Changed context bank reset to properly set FSR and FSRRESTORE AngeloGioacchino Del Regno (6): dt-bindings: iommu: qcom,iommu: Add qcom,ctx-num property iommu/qcom: Use the asid read from device-tree if specified iommu/qcom: Disable and reset context bank before programming iommu/qcom: Index contexts by asid number to allow asid 0 dt-bindings: iommu: qcom,iommu: Add QSMMUv2 and MSM8976 compatibles iommu/qcom: Add support for QSMMUv2 and QSMMU-500 secured contexts .../devicetree/bindings/iommu/qcom,iommu.yaml | 22 +++++-- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 62 ++++++++++++++----- 2 files changed, 64 insertions(+), 20 deletions(-)