From patchwork Sat Sep 26 13:00:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 11801393 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ECCBD112E for ; Sat, 26 Sep 2020 13:01:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF647206D4 for ; Sat, 26 Sep 2020 13:01:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s/S6NRAG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GVKvSy0s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF647206D4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ndzevZmBFsIHnRsRSzfnqL5Qozo/q1DhZ7cCZEGlCfg=; b=s/S6NRAG16t7+1f9DiNG/iM0G AWlE+XgGj2hfkWmQDrSuFomfCVnL3GBi3Ykbgafk42svKokaJ5MKML/uKdJSW9ECacQP+HY7G4Q7K XrqyF8imfE0Hkoh6iAlHKiwNZKa2lXQ1nZ8SWZ6eilPuMzDYmLthiMhM6njcm9q+SWwl974fiFgpp t8hwMTE26YNpvcE88HXwmwV/LpJoLXWiyC1CCM/Hye/AL1MgsWkIEODXzCK7AvqbcfN0CLZZQOvwA V6TQ0zPVJxxucUN+DFB73IiU4hnT/m5x2JnzgS0rBTKKw1ll/tCXZd1SBumc836s6wGCj0z84J9/W 0WMbBFl0A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM9oO-0008QP-6I; Sat, 26 Sep 2020 13:00:24 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kM9oE-0008MA-Pr for linux-arm-kernel@lists.infradead.org; Sat, 26 Sep 2020 13:00:17 +0000 Received: by mail-wr1-x441.google.com with SMTP id c18so6836969wrm.9 for ; Sat, 26 Sep 2020 06:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0jmpuG1sG/LCfKsjazCgf9OHk0sr2fgX8L2MMSiufQc=; b=GVKvSy0sgUcoO2wR+MPkLvnJLC1JWabHJc374jpH3QNtS+OfhY6zKPZQ9y7/DUWg2t dXP6qfinI7aP9ZHV/Q0esy4mb+4RrRwh8LZzflfZXhJ8ztBASY53Buc0mfVJp0117cKO lpK+3kZfPe5kGjDw/3N6wQL7dQMROqYdr8yY8hdYXL/QzKBHbqSpkprUtarWqzg1+G6d qDM9cgm8D00Rd2gnb+hKzULNIfLZ4v4eHEAglF9eO/hf7FQFCRQGhmZgVgBfemAmzOQd D7b8FCHnlRCnNHZfUvr3f9q2XVyNA3KwYH6PyML+Rwb/D4yjC/gsmepbEL90w1t5Z/X5 Qb1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0jmpuG1sG/LCfKsjazCgf9OHk0sr2fgX8L2MMSiufQc=; b=otAocc6cQvgoXn2aP40vfbttIJwXFemlcCVsSKTZKtUNWiqzo6KICJiTElTBnC9XCP +Fg5kuXJPuXe8KDl95nB0ogaZpnepbU6ACQ+P5CBJFEFnisVK0vlwyM6fZ5Sb+0AaAig u9uaxXbkMo+kW1CZwVEloB4kyswqhtNnBbQgJb2J2c/7T4cCBBHHoYqB8Re3gOu/A5R1 OaIDXb97UE9L2GPx1JqrPg6Au+V5nmjRJlBSRZVX27GehmWsd5Mq9AnM7W0tBYyS+nZa jaGPDHcCGjO8zdexlWfeo2P2KoKWc2Q3ejKAFLN+VTO8ag2MRfd3FNiLeEdZMAbQRcO6 6i9A== X-Gm-Message-State: AOAM533fUCqp4LzvHHesKlK4FLDxUcrMIonJAhl7IgwG2UMMVR1fOV3/ qHKbjtwYmKrzskNKeQ/DPH8= X-Google-Smtp-Source: ABdhPJyIuZfQRoZQ+orDTsJ4JEDVE4SCSy84utTQYhNdRFzDilj+Ty9sQoQIxOcufdQGIoZ1ebtlGg== X-Received: by 2002:a5d:56cd:: with SMTP id m13mr9197517wrw.261.1601125213898; Sat, 26 Sep 2020 06:00:13 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu ([2.237.20.237]) by smtp.gmail.com with ESMTPSA id b11sm6462896wrt.38.2020.09.26.06.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 06:00:13 -0700 (PDT) From: kholk11@gmail.com To: will@kernel.org Subject: [PATCH 5/8] iommu/arm-smmu-qcom: Add test_smr_masks detail to QCOM SMMUv2 Date: Sat, 26 Sep 2020 15:00:01 +0200 Message-Id: <20200926130004.13528-6-kholk11@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200926130004.13528-1-kholk11@gmail.com> References: <20200926130004.13528-1-kholk11@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200926_090014_914362_5A9BEF3B X-CRM114-Status: GOOD ( 13.56 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:441 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [kholk11[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [kholk11[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, marijns95@gmail.com, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, joro@8bytes.org, konradybcio@gmail.com, bjorn.andersson@linaro.org, martin.botka1@gmail.com, kholk11@gmail.com, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: AngeloGioacchino Del Regno On some Qualcomm SoCs with certain hypervisor configurations, writing the streamid masks to the SMRs will trigger a hyp-fault and crash the system. This is seen on at least Qualcomm SDM630, SDM636 and SDM660. Signed-off-by: AngeloGioacchino Del Regno --- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c index f5bbfe86ef30..b18e70bddf29 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c @@ -85,8 +85,21 @@ static int qcom_smmuv2_cfg_probe(struct arm_smmu_device *smmu) return 0; } +static void qcom_smmuv2_test_smr_masks(struct arm_smmu_device *smmu) +{ + /* + * Broken firmware quirk: + * On some Qualcomm SoCs with certain hypervisor configurations, + * writing the streamid masks to the SMRs will trigger a hyp-fault + * and crash the system. + */ + smmu->streamid_mask = 0x7FFF; + smmu->smr_mask_mask = 0x7FFF; +} + static const struct arm_smmu_impl qcom_smmuv2_impl = { .cfg_probe = qcom_smmuv2_cfg_probe, + .test_smr_masks = qcom_smmuv2_test_smr_masks, }; struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)