From patchwork Fri Apr 18 02:30:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 28607 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2102B2013D for ; Fri, 18 Apr 2014 02:32:33 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id x10sf3925367pdj.10 for ; Thu, 17 Apr 2014 19:32:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=KkADpVNI3MAMuYpgIPgesCvBWr/HWWTdGh1J9tsLNh4=; b=ZkfVUHFNF0AUWtGT+6ygTDGYRifSOd025lwuqtTNs2Pfv5gAkqQkEq7V16i8H/kfyd 0AZbQ/skf5U7wFCJ9kuwRpbk967/xEGHdiyb8+b9CmfCM6QroD9NSwWFc7U1yWM18/HR aulL/jwNptFh+QdGDY9kb4dsN+v/c3ea+A97w9OytlRSpIj5rgIZN85ZKbq47GFOcywE GnxJoG9xkNnwBK3+ouNbR10pyHIV302NmrDgfsNNRJ7mx6tVZUfz7RTV4zTSQwG84qjm Yoi6KkZsNqBH8h6dHiihWJFvvsrY+MB6eoW5ZUGPAELb1LmOizPxYE8IXOuvlhKR3uRI G7KQ== X-Gm-Message-State: ALoCoQmWxLAUPwvUhAuFmxBr79pBgznS1ZvhX+meQuTrUw8pbbX3+iEb4Ljlfke1c55LICYujoAD X-Received: by 10.66.102.3 with SMTP id fk3mr9182572pab.17.1397788353301; Thu, 17 Apr 2014 19:32:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.136 with SMTP id v8ls1333556qgd.13.gmail; Thu, 17 Apr 2014 19:32:33 -0700 (PDT) X-Received: by 10.52.241.106 with SMTP id wh10mr9720969vdc.16.1397788353150; Thu, 17 Apr 2014 19:32:33 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id f17si4753986vcq.201.2014.04.17.19.32.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 19:32:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 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.171; Received: by mail-ve0-f171.google.com with SMTP id jy13so1821801veb.16 for ; Thu, 17 Apr 2014 19:32:33 -0700 (PDT) X-Received: by 10.52.23.97 with SMTP id l1mr9837983vdf.11.1397788353071; Thu, 17 Apr 2014 19:32:33 -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 ib8csp80085vcb; Thu, 17 Apr 2014 19:32:32 -0700 (PDT) X-Received: by 10.229.66.133 with SMTP id n5mr16311200qci.0.1397788352668; Thu, 17 Apr 2014 19:32:32 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id a1si1815212qar.166.2014.04.17.19.32.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Apr 2014 19:32:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Waya2-0004d2-00; Fri, 18 Apr 2014 02:31:06 +0000 Received: from mail-ie0-f177.google.com ([209.85.223.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WayZf-0004SF-JJ for linux-arm-kernel@lists.infradead.org; Fri, 18 Apr 2014 02:30:44 +0000 Received: by mail-ie0-f177.google.com with SMTP id rl12so1167399iec.22 for ; Thu, 17 Apr 2014 19:30:22 -0700 (PDT) X-Received: by 10.50.79.134 with SMTP id j6mr924907igx.6.1397788221939; Thu, 17 Apr 2014 19:30:21 -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.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 19:30:21 -0700 (PDT) From: Alex Elder To: bcm@fixthebug.org, mporter@linaro.org Subject: [PATCH 04/10] ARM: bcm: have bcm_kona_smc() return request result Date: Thu, 17 Apr 2014 21:30:09 -0500 Message-Id: <1397788215-20279-5-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140417_193043_685851_F4DAD016 X-CRM114-Status: GOOD ( 17.94 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.223.177 listed in list.dnswl.org] Cc: bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.171 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 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