From patchwork Mon Apr 21 21:53:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 28745 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3C2102032B for ; Mon, 21 Apr 2014 21:54:51 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id p10sf19036559pdj.7 for ; Mon, 21 Apr 2014 14:54:51 -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=WhxrevPvv6CTaLLZB51xtYK7Z+58xqazcYuuwFwdajs=; b=UKv7ZQaPPnkGtkV9lRY5YKNTbHWI464DLQXLRhWBZ55hDe66cQU/YpQvLPDXna4uvx IjsvnJmXsx7ZQYwxp6Lm+flaQ/W4t8kyzWdhDwiPMj7HDEWDpVGR3gesAKByKyrJXEE6 S97i1VyRhLJvBZ/t/Th9DdPSeUcIaY0tY+xRFnAJbMF1JKuLMpJdlMUiOQq4nJaiN0Xo FB2E3S0smPbLlncVz9oTJMCDIK+tuzTWrOZhJdtDjhHXsd3e9EZmCZYuxPQEIbkLfjEz hDx2vYatgYxcwugEv7GsZflX9m7scX0ClcHdjqAMgApREz1YB6VCMoU4qjUAq9aMKM2f xdcw== X-Gm-Message-State: ALoCoQlPGk6/lJlghew/OvlbbSy/ksC9jZr0XPKdStpHhklKrs3LLwrxVYFLc/4g5qbE+iHPiR+D X-Received: by 10.66.173.75 with SMTP id bi11mr21156845pac.4.1398117291365; Mon, 21 Apr 2014 14:54:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.69 with SMTP id e63ls2712882qgd.29.gmail; Mon, 21 Apr 2014 14:54:51 -0700 (PDT) X-Received: by 10.58.96.36 with SMTP id dp4mr5414231veb.21.1398117291235; Mon, 21 Apr 2014 14:54:51 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id tq2si6456170vdc.75.2014.04.21.14.54.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 14:54:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ld13so1605184vcb.19 for ; Mon, 21 Apr 2014 14:54:51 -0700 (PDT) X-Received: by 10.58.185.145 with SMTP id fc17mr37572871vec.14.1398117291141; Mon, 21 Apr 2014 14:54:51 -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 ib8csp321054vcb; Mon, 21 Apr 2014 14:54:50 -0700 (PDT) X-Received: by 10.68.164.4 with SMTP id ym4mr41042443pbb.53.1398117290271; Mon, 21 Apr 2014 14:54:50 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id td10si21518495pac.263.2014.04.21.14.54.49; Mon, 21 Apr 2014 14:54:49 -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 S1755255AbaDUVxe (ORCPT + 26 others); Mon, 21 Apr 2014 17:53:34 -0400 Received: from mail-yk0-f182.google.com ([209.85.160.182]:49579 "EHLO mail-yk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755232AbaDUVx2 (ORCPT ); Mon, 21 Apr 2014 17:53:28 -0400 X-Greylist: delayed 2493 seconds by postgrey-1.27 at vger.kernel.org; Mon, 21 Apr 2014 17:53:28 EDT Received: by mail-yk0-f182.google.com with SMTP id 142so3938531ykq.27 for ; Mon, 21 Apr 2014 14:53:27 -0700 (PDT) X-Received: by 10.236.160.196 with SMTP id u44mr56241498yhk.39.1398117207581; Mon, 21 Apr 2014 14:53:27 -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 t63sm74182258yhm.32.2014.04.21.14.53.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Apr 2014 14:53:27 -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 v2 04/10] ARM: bcm: have bcm_kona_smc() return request result Date: Mon, 21 Apr 2014 16:53:05 -0500 Message-Id: <1398117191-2433-5-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1398117191-2433-1-git-send-email-elder@linaro.org> References: <1398117191-2433-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.220.174 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: , Currently it is assumed that SEC_ROM_RET_OK is the only valid "good" result of a secure monitor request. However the values that can be returned by a secure monitor request are dependent on which service id was provided. We therefore should handle the result in a request-dependent way. The most natural way to do that is to have the initiator of the request--where bcm_kona_smc() is called--handle the result in a way appropriate to the request. An "smc" operation must be performed only on core 0, while the request can be initiated from any core. To pass back the request result, we add a new field to the bcm_kona_smc_data structure, and have bcm_kona_smc() return that value rather than 0. There's only one caller right now. Move the existing check of the result out of __bcm_kona_smc() and into the kona_l2_cache_init() where the SSAPI_ENABLE_L2_CACHE request is initiated. 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 | 12 +++++------- arch/arm/mach-bcm/kona.c | 8 +++++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index 0d2bfe2..47cf360 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -30,6 +30,7 @@ struct bcm_kona_smc_data { unsigned arg1; unsigned arg2; unsigned arg3; + unsigned result; }; static const struct of_device_id bcm_kona_smc_ids[] __initconst = { @@ -80,7 +81,6 @@ static void __bcm_kona_smc(void *info) { struct bcm_kona_smc_data *data = info; u32 *args = bcm_smc_buffer; - int rc; BUG_ON(smp_processor_id() != 0); BUG_ON(!args); @@ -94,11 +94,8 @@ static void __bcm_kona_smc(void *info) /* Flush caches for input data passed to Secure Monitor */ flush_cache_all(); - /* Trap into Secure Monitor */ - rc = bcm_kona_smc_asm(data->service_id, bcm_smc_buffer_phys); - - if (rc != SEC_ROM_RET_OK) - pr_err("Secure Monitor call failed (0x%x)!\n", rc); + /* Trap into Secure Monitor and record the request result */ + data->result = bcm_kona_smc_asm(data->service_id, bcm_smc_buffer_phys); } unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, @@ -111,6 +108,7 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, data.arg1 = arg1; data.arg2 = arg2; data.arg3 = arg3; + data.result = 0; /* * Due to a limitation of the secure monitor, we must use the SMP @@ -123,5 +121,5 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, put_cpu(); - return 0; + return data.result; } diff --git a/arch/arm/mach-bcm/kona.c b/arch/arm/mach-bcm/kona.c index 768bc28..ecdd713 100644 --- a/arch/arm/mach-bcm/kona.c +++ b/arch/arm/mach-bcm/kona.c @@ -19,6 +19,7 @@ void __init kona_l2_cache_init(void) { + unsigned int result; int ret; if (!IS_ENABLED(CONFIG_CACHE_L2X0)) @@ -31,7 +32,12 @@ void __init kona_l2_cache_init(void) return; } - bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); + result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); + if (result != SEC_ROM_RET_OK) { + pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n", + result); + return; + } /* * The aux_val and aux_mask have no effect since L2 cache is already