Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp254230pxj; Thu, 20 May 2021 08:40:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5EQ9q6HL4EgfXTl5nHID/0uCm03clmXgVKZT7asXwVrQ4InHIHUsBIiOWVXNpdoYZoeRW X-Received: by 2002:aa7:cc9a:: with SMTP id p26mr5646209edt.74.1621525220927; Thu, 20 May 2021 08:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621525220; cv=none; d=google.com; s=arc-20160816; b=tHMIzqQwiiqf1wyZrO40+nd093jewBHwf1O5bfvUzpxoJwxtiaBvfRVwkrucJ6N0+x 046O1pSvZwgkuxYROVq0j91dWE1eorRn4JaqVaMsaxNl5wBlcSboN/NwC1CJzJkg2NUr 69wfv9Xk6L5XwdU0nbBt3bPVW6ad2I7A4ZUaqF7f0SilZ85l5fD6nZDfhb78xRpLcfpN M7xWnXXr4MsEskYmlVXmrOzJUiw/KNpfyEJ7AGME+9M51miUU0JjVEBcTIF1gOkzXhQy H6o5AdDpl1o2KBtwdXqj4Qo7PTtrEzWzTNP4kfALV6YEja4FRRreuwFR3LRqeziCflV8 LxAg== 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=L+WHJaaob9t92if9J2BR+AYFAEUSkmRmoofJn6FQLbA=; b=vTZxTKk1VX9plILBCxj6oOIml63MuKi7nuWYgISMqcjx05HNhmo7o0qhDxPsNILfk3 UBj1eyw0TT9e8KDzBVqqNOgzYwr3YyiaLMgWcia2y8WCM6NZcoAIIdfj106Z8qKros5t ghNvyVVMSqjRfRlbdMqYwiY9FLaWCZnELBpHpUSNAF0dBi4KyoKx7OA1uleiuIMoawS7 Jb/yAep6E4Bf0kPR1SIJMA4gp2olRSaQvVKiJgXf+6gMGWNSJX3jmrdzZZQvOFt32iWX Od8PupEIJUlb/CWKoFLyBASuUx9OMJSsf676hrOju4p2ua2L+WOVBygEEnuovAbXSqWN qE5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WWyOTmsw; 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 l18si2592171edv.57.2021.05.20.08.39.56; Thu, 20 May 2021 08:40:20 -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=WWyOTmsw; 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 S232305AbhETJgh (ORCPT + 99 others); Thu, 20 May 2021 05:36:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:36172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232854AbhETJeU (ORCPT ); Thu, 20 May 2021 05:34:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF8AB613F6; Thu, 20 May 2021 09:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621502949; bh=OzlWMVGgpd25rHrQBjN8DYUmb/aeiDcv8B+taC7pLC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WWyOTmsw3XAiyGT8+/onT+J5gEVfd9Z0C1GTsrxhaX3IIHg1YNx09oMBKbHxQ8m8v 38hcW4j8D6fBtSyBjicR0bKrq2ONgrniybEKtzFHdzhxRlkegSM9XQL0f7a+sNWqdA KmwwckQ+OPS2p8SmFg4lj1Y8HoPo1tIDn+DncXQI= 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.4 18/37] ARM: 9075/1: kernel: Fix interrupted SMC calls Date: Thu, 20 May 2021 11:22:39 +0200 Message-Id: <20210520092052.881855162@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092052.265851579@linuxfoundation.org> References: <20210520092052.265851579@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 bfb05c93494d..4ce2e29da14d 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "signal.h" /* @@ -160,6 +161,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