Message ID | 20230620095127.96600-4-angelogioacchino.delregno@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3552014vqr; Tue, 20 Jun 2023 03:05:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5i7gUoLYMG8aQx1H9eS0rPcqOW15wLPHrTI0/b3s33yk9nZoLCFn2EleDaiORFwgd2Fl7w X-Received: by 2002:a05:6a00:98d:b0:668:812d:a1e4 with SMTP id u13-20020a056a00098d00b00668812da1e4mr3785091pfg.22.1687255526630; Tue, 20 Jun 2023 03:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687255526; cv=none; d=google.com; s=arc-20160816; b=M1gXZ7i74tdGHs/ePnU2r3PIJiLA2/1/YES5qONQCsxGYOfeNPtmsiIbchrg4hgXFn eJ3JVtYcgZ8d8T9eHw473ll62dL4l4rPTDLFdtwLi7u8UNk/dprm9Ryl1eyxQotMruvc oxg7m+SPlF6OJBwgdcLG8IQ/UOymiRWcUHOsSNU7vK+e5C3/kz+oQjp/MByta9a/XnUC 8YbElorcs7o/Zy9HWGlrNmVRQFPKyxhDhs0i7doMxL0VvZ6p2l3YCXS5sIHdzRHfoy+v DDr0xbcBDyxgYImVp1yPYF7KD1JbEnE8mWxycY5suAKxe6Br7IsQFCCdeEIPiuCU/uUb AwPw== 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=Qcn9WiEqvG3WryGmzlKh/ivZ3O3mvCcHUR2Vl1fFQiQ=; b=oHMxs+yy+yQrZY+zW8j978RSTwLHsHOSUmJ7YqJWsGZXK59Ya8CsewpS5WhmOJOFwH DD62QbcBveHVXwVK8vHVzsADiyCL3VuxxHnXtFKrBk9WXfdrIq3M4VQOcbO3ksbScH5K KiCaswOl+DZfJAfyt/8nCVAniKJb8CR/1K5ojtcChLjBYPxhtuiKbF8c25kwr8FsU4uD q1YLwexrBIDO/A75vHVnHHA435o8e4yGgDYzbWHu58zrkwC5UtPsF6ifwwIq1Yd6JI9k odTQzuqjXdNCWcYgQmRSaSwLfqpzQGFbtuzB3d4+HnQP7g6CRY/dd5uv9jI/ChWWE75W 70sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="K2h6/knE"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c192-20020a621cc9000000b006683174a49csi1380395pfc.198.2023.06.20.03.05.06; Tue, 20 Jun 2023 03:05:26 -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=@collabora.com header.s=mail header.b="K2h6/knE"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232527AbjFTJyG (ORCPT <rfc822;duw91626@gmail.com> + 99 others); Tue, 20 Jun 2023 05:54:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232033AbjFTJxU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 20 Jun 2023 05:53:20 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 835AF211D; Tue, 20 Jun 2023 02:51:36 -0700 (PDT) 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 615156606F8E; Tue, 20 Jun 2023 10:51:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687254695; bh=rcPOmjDU7rnsS/fpNTQ+CcSQ5KZFIIdniqaYNHmw7pQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K2h6/knEKN+xECeFsxF507s+wQKQBlpzbNmCdzF6Nhw2c02DRNY2kD8zWwAsXWFei ZqnOkRxNcdhAAcpmiQm7bvrAqzAiVCzO5ss4OYQONtyGgLIzrMRhFDFkBJTUdrPFRB vTPz2WV4KYml9TujDp5lf/S67O3hP7fGHyA8DY6hDiH4WLbn6I4H5JV0xoKYljYXXI CvpyyMTL74wDVYIyIbpUD6QNqL9cljXOX3YQY5yaKv0YMjgZuxeOSX1PxlP9QjgVbJ /13Cvd2pGTmaFGwGbIUDxNjKv0iTIDEB7rlhxfagLQTHOyWPBTJZqHHZdjYifMctpl HXJb++yWbeb6Q== From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> 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 <angelogioacchino.delregno@collabora.com>, kernel@collabora.com Subject: [PATCH v4 3/6] iommu/qcom: Disable and reset context bank before programming Date: Tue, 20 Jun 2023 11:51:24 +0200 Message-Id: <20230620095127.96600-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230620095127.96600-1-angelogioacchino.delregno@collabora.com> References: <20230620095127.96600-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769215651190620876?= X-GMAIL-MSGID: =?utf-8?q?1769215651190620876?= |
Series |
Add support for Qualcomm's legacy IOMMU v2
|
|
Commit Message
AngeloGioacchino Del Regno
June 20, 2023, 9:51 a.m. UTC
Writing the new TTBRs, TCRs and MAIRs on a previously enabled
context bank may trigger a context fault, resulting in firmware
driven AP resets: change the domain initialization programming
sequence to disable the context bank(s) and to also clear the
related fault address (CB_FAR) and fault status (CB_FSR)
registers before writing new values to TTBR0/1, TCR/TCR2, MAIR0/1.
Fixes: 0ae349a0f33f ("iommu/qcom: Add qcom_iommu")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/arm-smmu/qcom_iommu.c index b661b559ea01..8b48f7e8f3db 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -273,6 +273,13 @@ static int qcom_iommu_init_domain(struct iommu_domain *domain, ctx->secure_init = true; } + /* Disable context bank before programming */ + iommu_writel(ctx, ARM_SMMU_CB_SCTLR, 0); + + /* Clear context bank fault address fault status registers */ + iommu_writel(ctx, ARM_SMMU_CB_FAR, 0); + iommu_writel(ctx, ARM_SMMU_CB_FSR, ARM_SMMU_FSR_FAULT); + /* TTBRs */ iommu_writeq(ctx, ARM_SMMU_CB_TTBR0, pgtbl_cfg.arm_lpae_s1_cfg.ttbr |