Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4909068rdb; Fri, 15 Sep 2023 16:49:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHU0sNpGXmBrdsxFwImD6y3pHD7GuUlqREqNgxJ0CMVxeKvQoS35V+sgFEN4p+8VcCAOsZ X-Received: by 2002:a05:6358:c29:b0:134:c859:d32a with SMTP id f41-20020a0563580c2900b00134c859d32amr3225516rwj.25.1694821782355; Fri, 15 Sep 2023 16:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694821782; cv=none; d=google.com; s=arc-20160816; b=NbMvI7Y/fX9q180FNMSJGUMFHe2s9eb/9JIupH9VApjvFxXdpBiv8z/OjXpdMwrnV3 UgEn8RSjTs0qexEWEWbU/v1QUysWucIY3lH/wdC+imi5MPafGA4SvLOx6uTt+/etaETZ 88542kHAdk+qg2agIiy5jpY31X7IsilA+7o9aHI63ooMqt5Jm1p59BsjNN1cmhYqsL7j v2J79YwBiqAh38ZZHJxvjt0guUzblAVv3bYF7ykIe1SLuXC+BzDiP/RC2eeXLJacuUmc 2psh/LO90i6FWazz4w/w+IiAFeRxd13/jBAEdO3dlco0vM5+QxxPlPHCbx0XArQKMqXt mpLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=t6Jy9kUIu2DIIzGv4f0XPwXh3BxzxnRtd2YRKiqx28g=; fh=3huOtJDs34MZG8hmMeUDgMqrMnjSlHTN/AcQliT1e8w=; b=HLv4Y5bKvyffuaMyWBKFWP3evBfGGEMq+1GeNvOcj8eafRhHFq8exVXdtXamY7Tl/l JyG5to3ndYNfYIfCiH0f6VEoSvwrjW+oPIim0kNgYulApkMFm+bxoFjItOZTlwrw+jev 1s3NVJ21iSF1hK5/1TQYVpVFrHCn7E2A7bXBWuYP1ZbtC8is0Ub3sQv3aXgurm1eGi6w F+tSHA4fiTt3soK1GZKDUQUOEjhiPXQ+scugO8HDGC7tkEPYQdt9FfqrWI9UqovDE/T8 kw6MVNIp9PZQcFutDVIiOJtBLMCex49vCpCUoQ2etfoIY5g8BrYhx5mC/F/0ZVOE5Yhm R2aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OZxwhH5V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k3-20020a6568c3000000b0054fe6b9502esi4046068pgt.687.2023.09.15.16.49.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 16:49:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OZxwhH5V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5DC258038B1D; Fri, 15 Sep 2023 12:11:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236845AbjIOTK6 (ORCPT + 99 others); Fri, 15 Sep 2023 15:10:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237069AbjIOTKs (ORCPT ); Fri, 15 Sep 2023 15:10:48 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BA4310D for ; Fri, 15 Sep 2023 12:10:44 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-d7e741729a2so2432332276.2 for ; Fri, 15 Sep 2023 12:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694805043; x=1695409843; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=t6Jy9kUIu2DIIzGv4f0XPwXh3BxzxnRtd2YRKiqx28g=; b=OZxwhH5VUt4XRyl1wQQPpAAwK6XyCAOE8PteVePIRNM1g5+Lkat5taGgULlraJiY8Q JXCyPwn9+h4zVjt6GfPKtBfyQihcAFl6UkWt/YcOSUjHrGXBCZhsBi/o1y+crpi/fnf+ d8l+9NnaP2Xaa03cLL+MYRuqzZ2k0PB/0Phthbv3Njw83e5UQ2FYKtNUTXW+jFid8uwV V0TaUQJHYnhIiJvO+eAEnjr8ziHOad8bd+7y+tO1/UPH+eu0F5MOK0va1fJ//rdfWCRW PKzSi+U5e7QomCbIf1VqK1BJOLlZ/6u/GasVjLVRd92qaJYfMC+w99VoqGGduZJ4nKL5 wUhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694805043; x=1695409843; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t6Jy9kUIu2DIIzGv4f0XPwXh3BxzxnRtd2YRKiqx28g=; b=hkxdAiHy9BxCoPkrtF8dqdpf+C/kqq+X/6aids+sp8+Bz9sWloiexTtKuFdskL9MZo Eeg7lU51fgbxecysXCUW09ZwkyVhj7RRMUnMVs1KAPEUSMUQGQHtHalRtb9mzdaNegWx 3qGtWPR3+/7TQyP/hs/Fj7vxKvBkqSw/a51Z+OZwAX5May7s8Y6COqQjeCQ21GJegvoJ VO6OZV95hR98sNwtbs44w7j85pGYkJdE+g3CXxDeN3JBg2GOTSzscYiI1V47syVMlfKr yWFZPU/02UaU4sjI43hztcE/YFu8Z7RzjUTFsGT0FNWQ61ATVa4sD0H2baYcS0bDOqWr NQ9w== X-Gm-Message-State: AOJu0Yw4u9C/fCdyGxtann+hvH7hprcuSS3x6Ln9u2kgZVTj+y5+MLdf 8Li9FjLvDWhb+cYMZhGj24fe9gZ0SOt9P6nblbvzNw== X-Received: by 2002:a25:585:0:b0:d78:3f9c:138e with SMTP id 127-20020a250585000000b00d783f9c138emr2468180ybf.37.1694805043192; Fri, 15 Sep 2023 12:10:43 -0700 (PDT) MIME-Version: 1.0 References: <20230607045345.25049-1-quic_kathirav@quicinc.com> In-Reply-To: From: Dmitry Baryshkov Date: Fri, 15 Sep 2023 22:10:32 +0300 Message-ID: Subject: Re: [PATCH V2] firmware: qcom_scm: use the SCM_CONVENTION based on ARM / ARM64 To: Bjorn Andersson Cc: Kathiravan T , Elliot Berman , Andy Gross , Konrad Dybcio , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 15 Sep 2023 12:11:31 -0700 (PDT) On Fri, 15 Sept 2023 at 18:17, Bjorn Andersson wrote: > > On Wed, Jun 07, 2023 at 10:23:45AM +0530, Kathiravan T wrote: > > During SCM probe, to identify the SCM convention, scm call is made with > > SMC_CONVENTION_ARM_64 followed by SMC_CONVENTION_ARM_32. Based on the > > result what convention to be used is decided. > > > > IPQ chipsets starting from IPQ807x, supports both 32bit and 64bit kernel > > variants, however TZ firmware runs in 64bit mode. When running on 32bit > > kernel, scm call is made with SMC_CONVENTION_ARM_64 is causing the > > system crash, due to the difference in the register sets between ARM and > > AARCH64, which is accessed by the TZ. > > > > To avoid this, use SMC_CONVENTION_ARM_64 only on ARM64 builds. > > > > My memory of this is cloudy, but I feel the logic is complicated because > early 64-bit boards all used 32-bit TZ. So, I really would like Elliot's > input before picking this change. But this codepath is not changed by this patch. Only the 32-bit codepath is altered. > > Regards, > Bjorn > > > Cc: stable@vger.kernel.org > > Fixes: 9a434cee773a ("firmware: qcom_scm: Dynamically support SMCCC and legacy conventions") > > Signed-off-by: Kathiravan T > > --- > > Changes in V2: > > - Added the Fixes tag and cc'd stable mailing list > > > > drivers/firmware/qcom_scm.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c > > index fde33acd46b7..db6754db48a0 100644 > > --- a/drivers/firmware/qcom_scm.c > > +++ b/drivers/firmware/qcom_scm.c > > @@ -171,6 +171,7 @@ static enum qcom_scm_convention __get_convention(void) > > if (likely(qcom_scm_convention != SMC_CONVENTION_UNKNOWN)) > > return qcom_scm_convention; > > > > +#if IS_ENABLED(CONFIG_ARM64) > > /* > > * Device isn't required as there is only one argument - no device > > * needed to dma_map_single to secure world > > @@ -191,6 +192,7 @@ static enum qcom_scm_convention __get_convention(void) > > forced = true; > > goto found; > > } > > +#endif > > > > probed_convention = SMC_CONVENTION_ARM_32; > > ret = __scm_smc_call(NULL, &desc, probed_convention, &res, true); > > -- > > 2.17.1 > > -- With best wishes Dmitry