Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp208875pxj; Thu, 20 May 2021 07:42:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/thHLAKYEwDZrQauIZaa6GdmKh0XQG96vf6fdinewvw7MpNeJTHTom5CHYLuTKXe02WRk X-Received: by 2002:a05:6402:268f:: with SMTP id w15mr5238473edd.321.1621521758417; Thu, 20 May 2021 07:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621521758; cv=none; d=google.com; s=arc-20160816; b=RzCo+IEXis5XBvvEql9XOitaNCGoOcMgNhq7UNaS2EiWb1PVxNON/jAJquGoe+2NDY +s6eEQwDqB+D9IW70/fRKbEA8bjKSQzNCEQBxI1H5OrAXYgey2Yhw6/COAVQ6szvX8nt 6y/mSGMcbUi76w9j2AT93m+7RqNWdPJTvnP6JBpTIqQBeyLV2vUIXjjPq0ef+st6sY6U FJqcGf6c8Uv/YT8MY+kCOcWbxMKxRsiV4+0IqjGUIMRGUaON8V7KIzQRyMcqnInJGVFf OjEpxyy6km9DoTJ30+gPUlEuxV4SowDqrHJ0iNAN1vowROrZ8lO32/HqVfJkYTU7NXDV r8cg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m3O7wbHR6K2GktpqTcn6PKKHp3U1GNc2Uz5TPA1Pawo=; b=0z7oZ+WPLO7i0zmPt+t3LLjRcizMX5WaQIY1q3Ozoe1ugYjGEKK3qjkq6NwE7F8Dy6 7KtL/INJbymgN/qxKpZepaW8eHbq+wYZF+uoLR1jyKwkMH1nO4kHjtEhqDC6vYcfWXTZ 2IeYO7l+f9x9PG6Y9relxi3+ETwxI20qxjcEiiQN5hSFHMbsOYMnTfoGmp8PlGTcLV9h 0iJLJH8gcxfSLIZMu1LGXcOF9eiMpwdmZOhpHKk7VNl2Rzm500Hbcgjc94npkzoHrgkR sa/DoIRs74cXsA8NTJ8Z3yw0b8ojhHUuMmnCE3sWEtJepKY/nN/OugDHo26heR9MWhdW nXGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VDVHjkoU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs11si3610345ejc.319.2021.05.20.07.42.13; Thu, 20 May 2021 07:42:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VDVHjkoU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbhETJ0r (ORCPT + 99 others); Thu, 20 May 2021 05:26:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:52886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231713AbhETJ00 (ORCPT ); Thu, 20 May 2021 05:26:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3B0F961261; Thu, 20 May 2021 09:25:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621502704; bh=gFCcF5BTHerYyZCaGQSR28fzhZp33fOtxwvk3P1bJTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDVHjkoUdUM9aM9BfGJ3Bz+mtx7ZcNNHzOw6J8wiilTU2QCsZQVwH+uCbvLzQJB8V SzCoku/c8zLUKFuFYRL2pQAF5prN2pwSQ3dZE/Rsjh0PmGtZPgn0R21//82j2ZZmCr bNy1oGMTp2mIyHMuFOo/DOH1awY6zifL9D9Q7Pjk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Bjorn Andersson , Russell King , Sasha Levin Subject: [PATCH 5.12 21/45] ARM: 9075/1: kernel: Fix interrupted SMC calls Date: Thu, 20 May 2021 11:22:09 +0200 Message-Id: <20210520092054.208150206@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092053.516042993@linuxfoundation.org> References: <20210520092053.516042993@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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