From patchwork Fri Apr 18 02:30:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 4012891 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7CC9D9F319 for ; Fri, 18 Apr 2014 02:33:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC5B620328 for ; Fri, 18 Apr 2014 02:33:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8655202EC for ; Fri, 18 Apr 2014 02:33:10 +0000 (UTC) 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 1WayaA-0004fq-He; Fri, 18 Apr 2014 02:31:14 +0000 Received: from mail-ig0-f178.google.com ([209.85.213.178]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WayZg-0004SN-5x for linux-arm-kernel@lists.infradead.org; Fri, 18 Apr 2014 02:30:44 +0000 Received: by mail-ig0-f178.google.com with SMTP id hn18so269074igb.17 for ; Thu, 17 Apr 2014 19:30:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8TV7JNjQaIssUHdSQ6h34FJTJSGzQtq1sU9ukkfEi+A=; b=Wh85Olm9OiZ3MQFf/nL3qX5i4Uksxd1mCTwzkCCi8lhpeBrUoagzTgr4YY2nTXDDco Ut5sjp6qPx+TLcIN/eWIOKvqdtwkDT/vGd6L9Fw/j/vOFytQtubq5RffdYwuKS6IIiGY aIlRgulRLJJzrLFo6zt1rXKfY+BV2izn9RP61+0JALyMCgJkayYVgEk/tXb/uqrBbQZF xQAz9YcJ3EMk40Hzu42oDKPzQaOc/PL18fTNRVQrX9Tk/14E26GbjBL39K+ixtO/5TAS 4oLN8u9t1CNqw59k/ApVnF6trsAr/xkFgCf6xoHZvYLpjrYLv4EG1FhSNCFQIzxGTAtb bkLg== X-Gm-Message-State: ALoCoQllK5XjctVvTTugLwd135ZXshCSf6nzT6gaoS0GfUkOJkgjTpJXISE5OHVPEAaVo85f7rbc X-Received: by 10.50.57.109 with SMTP id h13mr843806igq.3.1397788222951; Thu, 17 Apr 2014 19:30:22 -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.21 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 19:30:22 -0700 (PDT) From: Alex Elder To: bcm@fixthebug.org, mporter@linaro.org Subject: [PATCH 05/10] ARM: bcm: don't special-case CPU 0 in bcm_kona_smc() Date: Thu, 17 Apr 2014 21:30:10 -0500 Message-Id: <1397788215-20279-6-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_193044_264538_5D3693E2 X-CRM114-Status: GOOD ( 11.37 ) X-Spam-Score: -0.7 (/) 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's logic in bcm_kona_smc() to ensure __bcm_kona_smc() gets called on CPU 0; if already executing on CPU 0, that function is called directly. The direct call is not protected from interrupts, however, which is not safe. Note that smp_call_function_single() is designed to handle the case where the target cpu is the current one. It also gets a reference to the CPU and disables IRQs across the call. So we can simplify things and at the same time be protected against interrupts by calling smp_call_function_single() unconditionally. 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 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index 47cf360..6fdcf96 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -114,12 +114,7 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, * Due to a limitation of the secure monitor, we must use the SMP * infrastructure to forward all secure monitor calls to Core 0. */ - if (get_cpu() != 0) - smp_call_function_single(0, __bcm_kona_smc, (void *)&data, 1); - else - __bcm_kona_smc(&data); - - put_cpu(); + smp_call_function_single(0, __bcm_kona_smc, &data, 1); return data.result; }