From patchwork Thu May 20 09:22:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 443204 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp2145923jac; Thu, 20 May 2021 03:15:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPYlnn36eE2Y/DHwdfE4fv4jgToBmKIxmUsBUdLTCH24rcvioiPH7kyxEwFLlDg1k0I2D1 X-Received: by 2002:a5d:9916:: with SMTP id x22mr4370133iol.160.1621505704877; Thu, 20 May 2021 03:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621505704; cv=none; d=google.com; s=arc-20160816; b=SrwNc6Y0k99xIzF1ZrlTMysIqXqU9oPYzrZtiQ7/q51VRztcD2OMwaqi0upJarsvJA 80FrTC7OHffv5u1/J8CDdO56kPRMEjML4aJSG27SKWsJ8zGIhG7D3MSuP/8FrsKscFxG fqHSyNx1dZnZtPtfHNjuuzQdqaFKMsJKP46AtABO3YWfu8Vf4g5Kn39PXez8IWGC5v3j gJe65k4Olcwibt4CwO+7C26OZhQl+CvAkxvb1qzmRp0yEdIaZ9o0lS4NH1ua+fICW/n+ UzTpUbrvICgmynuZMi7IHPBo6K11TbqL2JK2XtYCvqfv2KjJ6/AJxB62AGEV3FZSSxjt pQlg== 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=FI1bkALCnQAnwXwrz4vgPwegtv3GC7Qopbdc8xlAqkQ=; b=KfzdibhWByrR8u49Hs7dvf0x4C212r5uiruUufurmjHlw+PT+C6TWe7m+PBXsfEkXy Y2xvi93HbrQ1lsOB08Xqqgf1Lyh12ZHnstBqaDowujW2ffkn+NG3gbAMUaKhspFAYkYz TqLs1ywQBT/VF9kc6DQDCh1Ue3pgHXQnFQXxbvNfnzrx8mBH6Ht1fPKAWJgBxghqkycw FmCCUwik/LTrgB0X9l6+IAXeuI+YGfGdwEiOJFCgVWIRtYTz0T1MStNyO4ps3TCB3GHA hBytR2ILzdQ3PcEb9RA9EL2e+UGC6teZ+3KSPYRs7R9J5XF4uPLkM6az9iSJBI7SqHmv h/Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EJttoUuj; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 m14si2170071ili.85.2021.05.20.03.15.04; Thu, 20 May 2021 03:15:04 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=EJttoUuj; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S235648AbhETKQX (ORCPT + 12 others); Thu, 20 May 2021 06:16:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:46110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236245AbhETKOy (ORCPT ); Thu, 20 May 2021 06:14:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B420C6197D; Thu, 20 May 2021 09:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503903; bh=xO9XK9Tn+qJGOfd2RkV/VZWWHNps1oUzT1w5ix6vWmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EJttoUujeCeTxO5WHJsgBt1OzG6RWAVrWWVW75i1b/n9W5YORktk9hz1e7+7Js459 SXjC7E92olkX7vQk3PKKzXmWIAtmG+YQjVQairp5HB3DfycdUhCc6ntWKgyJZ77AM2 Jpx24oiOyuFjrdVXW5ZoWOSlyw7E6cmJ61PU4Prw= 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 4.19 408/425] ARM: 9075/1: kernel: Fix interrupted SMC calls Date: Thu, 20 May 2021 11:22:57 +0200 Message-Id: <20210520092144.812765603@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.30.2 diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index ae85f67a6352..40afe953a0e2 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "signal.h" /* @@ -159,6 +160,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 e5d43066b889..13d307cd364c 100644 --- a/arch/arm/kernel/smccc-call.S +++ b/arch/arm/kernel/smccc-call.S @@ -12,7 +12,9 @@ * */ #include +#include +#include #include #include #include @@ -36,7 +38,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