Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp389018pxj; Thu, 20 May 2021 11:39:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJwKXBhtBEPB4tAiKr31rlerpx0PI7CLc7+x7iU2FrboClDlP9eTKqFvMZqh3lbcELJrcK X-Received: by 2002:a02:a492:: with SMTP id d18mr7855801jam.28.1621535951357; Thu, 20 May 2021 11:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621535951; cv=none; d=google.com; s=arc-20160816; b=GzE9oKKqjwMwTMBMczobs3QlwILg60X4qaQJ97bKjCcZl832lPypvV3kRh28Ntl0bh r3X4/EGo1FHnk2blh2CrERHTmu/2EvZOjKfFzkmjd1KvNNXJ2hkeMkFDCOPXMwIj0nDj VBiX6A4sk0JhcfXO4441EqGv+fuGtU82HyWQmSlkEoWVk5pbQzng86YeZ27vK8cHlvLg v7c4v0hfztX1cSLx8F9ZdzRIG/XeFFN7MBL/ptrZi+EAa3wxuYxYDVu+y8O5x8OP5Ja9 j0dlsxPwnDUSUiw4Fbx5+DbemVhzjo7PCOwGcMLy8yPGrVee3OEie3Tdn6Pnfa5uR2pH cAnQ== 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=oPqf4WmO6TB5ih3H14uYH0K8kfG9gB1jWI5yDfuepJFUJwC5I9qaAwC0iX+THaZVOv cuhTdM+WcR5A76qZV81CnD/q2/s2BDoRc8+TmFEzoCjo6JOJXV2Z5MhaiEwas9i/EgBn Q0xIit6JdyGd2MlbggJ+cmIU02pyBCrOryd89QvkXAILtZ+t8BXxWAguhkkMoaQPOTMq 23xNGfk3mcqcT2TUKH1abjGzBQMbv7uwxdjjUFsBmrOqXOtIIXVxGsStBjrOUzdRZGTx tcyi1Ke5sUcV4dj50bcNd4tUcm+dqLJEbGRTte03WRv7C6kx00DAL6aBRkIcqINT9XJ7 Xgbw== 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 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 o19si3068531ilt.69.2021.05.20.11.38.58; Thu, 20 May 2021 11:39:11 -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=EJttoUuj; 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 S235520AbhETK0G (ORCPT + 99 others); Thu, 20 May 2021 06:26:06 -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 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 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 -- 2.30.2