From patchwork Fri Apr 18 02:30:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 28611 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4EB242013D for ; Fri, 18 Apr 2014 02:32:45 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f10sf4721576yha.3 for ; Thu, 17 Apr 2014 19:32:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=7083kONHglCIn26WpnW8Q/INra+yY0GxRL5Yd0UJO5E=; b=jeR5B6JAByRLj/xcl7c4/GQx18CkqPoUPGjKFkVyU/UmhWq8xs42WwqpBqlv/B8RGS r/ZfO/2+qvUbwptxqvgdmlyTI4OH5KVmEB63rqwMkYE0/GdhqOkZvkk2us4dV5Hs7MGw w4oOW8tptyXX5MoWUIM1SdzBKtC1bexaDif/8LE5SvtU89jmzZuK6ORWM2D0RckioSxP DVA6JEXto9qsUrU2U209DpllzFfMAxOFWK8wnHaGfnktK0+j3afF8ZvdfcqRWzbXMmO2 AcvuzFgMX0uGMsW4EYaJltogHol07GpSZ85iPHNnV+jXC4QvjYwyFffKZVZy20vogfFI YBPA== X-Gm-Message-State: ALoCoQlj+iyluk+3jJfnQvbSzCwkW4exKcCD5rNfyzmOsC3paKJfFw2gWrZPCpdpbyC9j0cMD8oh X-Received: by 10.58.107.203 with SMTP id he11mr9443897veb.12.1397788365514; Thu, 17 Apr 2014 19:32:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.4 with SMTP id t4ls468795qge.1.gmail; Thu, 17 Apr 2014 19:32:45 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr9158557vdb.20.1397788365421; Thu, 17 Apr 2014 19:32:45 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id ud8si4219338vdc.213.2014.04.17.19.32.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 19:32:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id jw12so1809997veb.37 for ; Thu, 17 Apr 2014 19:32:45 -0700 (PDT) X-Received: by 10.58.126.4 with SMTP id mu4mr15035412veb.0.1397788365318; Thu, 17 Apr 2014 19:32:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp80099vcb; Thu, 17 Apr 2014 19:32:44 -0700 (PDT) X-Received: by 10.66.254.166 with SMTP id aj6mr19465995pad.11.1397788364538; Thu, 17 Apr 2014 19:32:44 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id py5si9486521pbc.400.2014.04.17.19.32.42; Thu, 17 Apr 2014 19:32:42 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752308AbaDRCb2 (ORCPT + 26 others); Thu, 17 Apr 2014 22:31:28 -0400 Received: from mail-ie0-f182.google.com ([209.85.223.182]:43532 "EHLO mail-ie0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbaDRCa1 (ORCPT ); Thu, 17 Apr 2014 22:30:27 -0400 Received: by mail-ie0-f182.google.com with SMTP id y20so1177899ier.27 for ; Thu, 17 Apr 2014 19:30:26 -0700 (PDT) X-Received: by 10.50.109.130 with SMTP id hs2mr782074igb.29.1397788226792; Thu, 17 Apr 2014 19:30:26 -0700 (PDT) Received: from localhost.localdomain (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id m8sm673967igx.9.2014.04.17.19.30.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 19:30:26 -0700 (PDT) From: Alex Elder To: bcm@fixthebug.org, mporter@linaro.org Cc: bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/10] ARM: bcm: rewrite commentary for bcm_kona_do_smc() Date: Thu, 17 Apr 2014 21:30:14 -0500 Message-Id: <1397788215-20279-10-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397788215-20279-1-git-send-email-elder@linaro.org> References: <1397788215-20279-1-git-send-email-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: elder@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The block of comments in bcm_kona_do_smc() are somewhat confusing. This patch attempts to clarify what's going on. Signed-off-by: Alex Elder Reviewed-by: Tim Kryger Reviewed-by: Markus Mayer Reviewed-by: Matt Porter --- arch/arm/mach-bcm/bcm_kona_smc.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index cc81c86..a55a7ec 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -77,16 +77,34 @@ int __init bcm_kona_smc_init(void) } /* - * Since interrupts are disabled in the open mode, we must keep - * interrupts disabled in secure mode by setting R5=0x3. If interrupts - * are enabled in open mode, we can set R5=0x0 to allow interrupts in - * secure mode. If we did this, the secure monitor would return back - * control to the open mode to handle the interrupt prior to completing - * the secure service. If this happened, R12 would not be - * SEC_EXIT_NORMAL and we would need to call SMC again after resetting - * R5 (it gets clobbered by the secure monitor) and setting R4 to - * SSAPI_RET_FROM_INT_SERV to indicate that we want the secure monitor - * to finish up the previous uncompleted secure service. + * int bcm_kona_do_smc(u32 service_id, u32 buffer_addr) + * + * Only core 0 can run the secure monitor code. If an "smc" request + * is initiated on a different core it must be redirected to core 0 + * for execution. We rely on the caller to handle this. + * + * Each "smc" request supplies a service id and the address of a + * buffer containing parameters related to the service to be + * performed. A flags value defines the behavior of the level 2 + * cache and interrupt handling while the secure monitor executes. + * + * Parameters to the "smc" request are passed in r4-r6 as follows: + * r4 service id + * r5 flags (SEC_ROM_*) + * r6 physical address of buffer with other parameters + * + * Execution of an "smc" request produces two distinct results. + * + * First, the secure monitor call itself (regardless of the specific + * service request) can succeed, or can produce an error. When an + * "smc" request completes this value is found in r12; it should + * always be SEC_EXIT_NORMAL. + * + * In addition, the particular service performed produces a result. + * The values that should be expected depend on the service. We + * therefore return this value to the caller, so it can handle the + * request result appropriately. This result value is found in r0 + * when the "smc" request completes. */ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys) {