Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752814AbbGBQUH (ORCPT ); Thu, 2 Jul 2015 12:20:07 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37167 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753653AbbGBQT6 (ORCPT ); Thu, 2 Jul 2015 12:19:58 -0400 Message-ID: <559564AC.6030100@codeaurora.org> Date: Thu, 02 Jul 2015 09:19:56 -0700 From: Stephen Boyd User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Bjorn Andersson , Kumar Gala , Andy Gross CC: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Subject: Re: [PATCH] firmware: qcom: scm: Peripheral Authentication Service References: <1435693579-16109-1-git-send-email-bjorn.andersson@sonymobile.com> In-Reply-To: <1435693579-16109-1-git-send-email-bjorn.andersson@sonymobile.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2148 Lines: 81 On 06/30/2015 12:46 PM, Bjorn Andersson wrote: > + > +int __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size) > +{ > + dma_addr_t mdata_phys; > + void *mdata_buf; > + u32 scm_ret; > + int ret; > + struct pas_init_image_req { > + u32 proc; > + u32 image_addr; Please mark these as __le32 and do the appropriate conversions to little endian. Also consider removing the struct name and just make it anonymous, i.e. struct { __le32 proc; __le32 image_addr; } cmd; > + } request; > + > + /* > + * During the scm call memory protection will be enabled for the meta > + * data blob, so make sure it's physically contiguous, 4K aligned and > + * non-cachable to avoid XPU violations. > + */ > + mdata_buf = dma_alloc_coherent(NULL, size, &mdata_phys, GFP_KERNEL); > + if (!mdata_buf) { > + pr_err("Allocation of metadata buffer failed.\n"); > + return -ENOMEM; > + } > + memcpy(mdata_buf, metadata, size); > + > + request.proc = peripheral; > + request.image_addr = mdata_phys; > + > + ret = qcom_scm_call(QCOM_SCM_SVC_PIL, QCOM_SCM_PAS_INIT_IMAGE_CMD, > + &request, sizeof(request), > + &scm_ret, sizeof(scm_ret)); > + > + dma_free_coherent(NULL, size, mdata_buf, mdata_phys); > + > + return ret ? : scm_ret; > +} > + > +int __qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size) > +{ > + u32 scm_ret; > + int ret; > + struct pas_init_image_req { > + u32 proc; > + u32 addr; > + u32 len; > + } request; Same comment here. > + > + request.proc = peripheral; > + request.addr = addr; > + request.len = size; > + > + ret = qcom_scm_call(QCOM_SCM_SVC_PIL, QCOM_SCM_PAS_MEM_SETUP_CMD, > + &request, sizeof(request), > + &scm_ret, sizeof(scm_ret)); > + > + return ret ? : scm_ret; > +} > + > -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/