Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3442737imm; Thu, 17 May 2018 08:50:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoiuP4LoEEKrBg2C+euwitmElt3SEKxLQ8NoxJtD2X24NvJ2mqhHf+pykSz6oAAy96cX9lO X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr5819507pld.118.1526572251470; Thu, 17 May 2018 08:50:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526572251; cv=none; d=google.com; s=arc-20160816; b=CqBvscjx2DtO+3UuLiL0pSgiQRm6+ZiD2JtZ73SUX36MDcwJ9Hrv2keMLuSL3K+Qve gir6IUzf7n0ADUW0YKzJS230arDo46T//dQmUQ5iUu4zWuF/WFQQ/o/Pvkivva86BPet UhdFsEov6i/ToTRu/HSsRuRRAMI3US0IJSoih+XFlFnIaEcuZXaBZuei4Q49mwYM4vfA 9G8ucMlM7OamCw7yxlm4qN+CRHKSV3RfUqqD9Wd9EtEX4EvI+V2AndF7EhlZFGF0M0/i AIWaVFnI7qymOpUeXcYD94ENgXSNgOxreJFROwd+Ri2JqJ1qWIW39gpljw4BJxEafSfS 7eVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dmarc-filter:dkim-signature :dkim-signature:arc-authentication-results; bh=OFLdgglLFbUPnLQxeCLBUUnB0rqfWL+hGwZq0BeIQqw=; b=yV2T2YcCvBMI2j/2G45y95grpUYenxMkXBz6Eoz/DdkjFH/m5TE7QICvIQJZoIqS33 DyzS3nmjQZAtsZfzkZ8rC1cr0Ittl24ip7OGKTbvBtJriUq7ASHmP2iSvHDlCjP/djPs L9r287/aMuai7BLAgE4yrPi+wj/OALNu1pN8T+jx0qq1OgFJB5E6ZgNXsiIX9CP/7MKl LCFzasO1rN/6s5pqaqC3DhvLN2l1CtfT/EyIm6n6szFs+llOynNaxhog6MSG0dM6upDC ez6eq6c94xDP9X+u+AnwNPOmFJKm7YtND6nrGGYVU0/oOsyelOwvhwDuCzyMBLHRPt0z gsPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q21B3v2B; dkim=pass header.i=@codeaurora.org header.s=default header.b=HlE2r3to; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15-v6si4251892pgq.385.2018.05.17.08.50.37; Thu, 17 May 2018 08:50:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Q21B3v2B; dkim=pass header.i=@codeaurora.org header.s=default header.b=HlE2r3to; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752464AbeEQPuJ (ORCPT + 99 others); Thu, 17 May 2018 11:50:09 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48914 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752398AbeEQPuF (ORCPT ); Thu, 17 May 2018 11:50:05 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0CA0E60C66; Thu, 17 May 2018 15:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526572205; bh=7K9mNjg1cK9m/rB12osGmRyMeSI0s/xoTu8vhKvqQwQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q21B3v2BOzdkzrpGI+NO1DDBpmOoF/RayacyQDvJQXEvIW4LDup15ls0Wd5QBG3Pi cQa3y0JwCPBx2ftNVakL3xEdPK1UiOae63+TT8PD0q7aDE5EoOB6DTbKxkrvjJz2WH wudRMF8mbi1fEQik84jVDSUJxKWp9ROkf2iveQTU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from jcrouse-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6A5F16055C; Thu, 17 May 2018 15:50:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526572204; bh=7K9mNjg1cK9m/rB12osGmRyMeSI0s/xoTu8vhKvqQwQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HlE2r3toN/TV5PXullzuccN3aGHc/tfc3eyiKRzESlulBXA6erPVEUVAGwyd8rE9t bRDi8tEZR1S0bdc7wDViVo0PqbjsZsvnDQ6gR1HWX+sOJ5wzO1PaTGL3NXoqAte8Y7 I3YLYedcVIpgh1B2BUzxKJAqEQFxPFdPz+oNoQxg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6A5F16055C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org Date: Thu, 17 May 2018 09:50:01 -0600 From: Jordan Crouse To: Vikash Garodia Cc: hverkuil@xs4all.nl, mchehab@kernel.org, andy.gross@linaro.org, bjorn.andersson@linaro.org, stanimir.varbanov@linaro.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, acourbot@google.com Subject: Re: [PATCH 1/4] soc: qcom: mdt_loader: Add check to make scm calls Message-ID: <20180517155000.GH4995@jcrouse-lnx.qualcomm.com> Mail-Followup-To: Vikash Garodia , hverkuil@xs4all.nl, mchehab@kernel.org, andy.gross@linaro.org, bjorn.andersson@linaro.org, stanimir.varbanov@linaro.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, acourbot@google.com References: <1526556740-25494-1-git-send-email-vgarodia@codeaurora.org> <1526556740-25494-2-git-send-email-vgarodia@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526556740-25494-2-git-send-email-vgarodia@codeaurora.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 17, 2018 at 05:02:17PM +0530, Vikash Garodia wrote: > In order to invoke scm calls, ensure that the platform > has the required support to invoke the scm calls in > secure world. > > Signed-off-by: Vikash Garodia > --- > drivers/soc/qcom/mdt_loader.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) > > diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c > index 17b314d..db55d53 100644 > --- a/drivers/soc/qcom/mdt_loader.c > +++ b/drivers/soc/qcom/mdt_loader.c > @@ -121,10 +121,12 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw, > if (!fw_name) > return -ENOMEM; > > - ret = qcom_scm_pas_init_image(pas_id, fw->data, fw->size); > - if (ret) { > - dev_err(dev, "invalid firmware metadata\n"); > - goto out; > + if (qcom_scm_is_available()) { > + ret = qcom_scm_pas_init_image(pas_id, fw->data, fw->size); > + if (ret) { > + dev_err(dev, "invalid firmware metadata\n"); > + goto out; > + } > } > > for (i = 0; i < ehdr->e_phnum; i++) { > @@ -144,10 +146,13 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw, > } > > if (relocate) { > - ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, max_addr - min_addr); > - if (ret) { > - dev_err(dev, "unable to setup relocation\n"); > - goto out; > + if (qcom_scm_is_available()) { > + ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, > + max_addr - min_addr); > + if (ret) { > + dev_err(dev, "unable to setup relocation\n"); > + goto out; > + } > } > As far as I can tell you can make it all the way through the function with 'ret' uninitialized if qcom_scm_is_available() returns false which is a bug, but I'm confused why you would even bother loading the firmware even if you didn't have SCM. Jordan -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project