From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43E78C433ED for ; Wed, 12 May 2021 18:05:00 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 9371C616E8 for ; Wed, 12 May 2021 18:04:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9371C616E8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=7bCEsrdoAsszAizsRyPVoLshpYE3Dcq4yxra4wqPNJM=; b=B4tdw3vqVHNSjhAn2VzjbLqEQ qJdzwcRxrBQNYnUMl4UwDz9GYWpoIGivlhgZkkloY8bgPatI3WPpmrPNycnGt4wcqM/J72Jui5TFt i8cRJ1moIvsXDOX8Y1yjVTA402jP6lzFnSR6eUL/JjcXiNCUFF41R+W4Iwm8TdNw33LE8JwCFKvGD CE8GHwxpihPBZ9oX4AR5RcjRcxxlAKUmkQxVJqbtyUYOneTmTYpMOUM7OQTdj3E6GchwvSeiu/unF bztX8lDGM7njgQnDydO2wrYqfyDL9mnJg6r6gS9VbOvNRwe+er7IzUmmNGYyPztysZOA134LLMjNU fIH9QV8rQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgtCo-003W8f-Iu; Wed, 12 May 2021 18:03:35 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgtBp-003Vjh-N5 for linux-arm-kernel@desiato.infradead.org; Wed, 12 May 2021 18:02:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=m3O7wbHR6K2GktpqTcn6PKKHp3U1GNc2Uz5TPA1Pawo=; b=b5he4AX8zLsM7LnYh7BJ6DpViO IwAl4kxYCCWHtjrERHlnXMSIVf1eD1OLU9hIiXweMuTmL2TBf/UQmokwKIN7rb/gdVdK7PxrnpOX9 xFM5rOs/ep12AthXBbqCbk1gbS9JelpazHC0Ar96769vPAgkITJXPi8fNt+lwpiUumNYoSjyIrfgP 9IxjgnzWBU1jH4kTK4lqiqjH1+x6Hucp244L+X1bqFvsWctSKRAK+V7BS1T1B+AWDXjLe2ROPbHPC BREC1HDl874U1Z912IeXhtP+uajBoRK81lf8D6rEQ0tuHjRTsZYvuvcwhOL2xNPqZH4AwAkX2kUJv UC5JqeVA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgtBn-00AfpI-0E for linux-arm-kernel@lists.infradead.org; Wed, 12 May 2021 18:02:32 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id BBA456142D; Wed, 12 May 2021 18:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620842550; bh=gFCcF5BTHerYyZCaGQSR28fzhZp33fOtxwvk3P1bJTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WPm+k/mN8r5aQcLu4FQiW96t1aqrfsfgO5cNdVlaaF7Shr0XG3us57SLumTYzJWGb eHov1W9Cu792VBkO/YE6/l9mmqbugpPubZBg3JP5W0VbfPy3fkH2eC8VD9b81xtnkb SPAtcC+Ybd2fBPyRwjOiP5Fsh8G9wpkpoc4M2m9zVLN9TNWc2bI5YZiJrGwp+absio I+PUjXUHebhRW5bV8eJ9W9ro13Ch9VxDrtGeZRIoXMly8y0K+VVnTDmswjFGnTkNtZ NQc97u/6y9XL1W63P0OGyZ6R5jmG/6kbK7OpGSyMc0jZWjSENW0rxKeZ5aQXYkAErR l9fNOBoxghUNg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Manivannan Sadhasivam , Bjorn Andersson , Russell King , Sasha Levin , linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.11 15/35] ARM: 9075/1: kernel: Fix interrupted SMC calls Date: Wed, 12 May 2021 14:01:45 -0400 Message-Id: <20210512180206.664536-15-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210512180206.664536-1-sashal@kernel.org> References: <20210512180206.664536-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210512_110231_122805_58C0769E X-CRM114-Status: GOOD ( 12.19 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Manivannan Sadhasivam [ Upstream commit 57ac51667d8cd62731223d687e5fe7b41c502f89 ] On Qualcomm ARM32 platforms, the SMC call can return before it has completed. If this occurs, the call can be restarted, but it requires using the returned session ID value from the interrupted SMC call. The ARM32 SMCC code already has the provision to add platform specific quirks for things like this. So let's make use of it and add the Qualcomm specific quirk (ARM_SMCCC_QUIRK_QCOM_A6) used by the QCOM_SCM driver. This change is similar to the below one added for ARM64 a while ago: commit 82bcd087029f ("firmware: qcom: scm: Fix interrupted SCM calls") Without this change, the Qualcomm ARM32 platforms like SDX55 will return -EINVAL for SMC calls used for modem firmware loading and validation. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bjorn Andersson Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/kernel/asm-offsets.c | 3 +++ arch/arm/kernel/smccc-call.S | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index be8050b0c3df..70993af22d80 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "signal.h" /* @@ -148,6 +149,8 @@ int main(void) DEFINE(SLEEP_SAVE_SP_PHYS, offsetof(struct sleep_save_sp, save_ptr_stash_phys)); DEFINE(SLEEP_SAVE_SP_VIRT, offsetof(struct sleep_save_sp, save_ptr_stash)); #endif + DEFINE(ARM_SMCCC_QUIRK_ID_OFFS, offsetof(struct arm_smccc_quirk, id)); + DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS, offsetof(struct arm_smccc_quirk, state)); BLANK(); DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL); DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE); diff --git a/arch/arm/kernel/smccc-call.S b/arch/arm/kernel/smccc-call.S index 00664c78faca..931df62a7831 100644 --- a/arch/arm/kernel/smccc-call.S +++ b/arch/arm/kernel/smccc-call.S @@ -3,7 +3,9 @@ * Copyright (c) 2015, Linaro Limited */ #include +#include +#include #include #include #include @@ -27,7 +29,14 @@ UNWIND( .fnstart) UNWIND( .save {r4-r7}) ldm r12, {r4-r7} \instr - pop {r4-r7} + ldr r4, [sp, #36] + cmp r4, #0 + beq 1f // No quirk structure + ldr r5, [r4, #ARM_SMCCC_QUIRK_ID_OFFS] + cmp r5, #ARM_SMCCC_QUIRK_QCOM_A6 + bne 1f // No quirk present + str r6, [r4, #ARM_SMCCC_QUIRK_STATE_OFFS] +1: pop {r4-r7} ldr r12, [sp, #(4 * 4)] stm r12, {r0-r3} bx lr -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel