From patchwork Fri Sep 5 11:22:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 36811 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 494B9202E4 for ; Fri, 5 Sep 2014 11:25:46 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf68622759pde.3 for ; Fri, 05 Sep 2014 04:25:42 -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=HA5WVXyHoLPZJpo/SX3kJiT2tIokONxJAHE3bA2kwe0=; b=YKnFHBiIEjsYL1JQ3Mhx2/12pJWWz/SSJNa4AVLoQETaH81iXaMqG5x1Senwhs+xPC 7DwiRAeFPYJRbykSsO5YITdJ7Aro918pPWA9DclxatCX0b1AhlmgggYrBDEMcWhNMGqU 5aBYn8mFxh/oKKMwIhokJRzt3JsIskjVAU3vf89+WBCM3v92HWKqUHld6TY7Vfm1JM9D RUhhbVyGLcVMJQdllsGDXE9gHsTThhtgspgLuot0LuMZH+DQCZaM8e1yPfWq/2v9EeAR SA2ha1At/0lPbwFxfmDMaaw7dglkzOWcupRBQjv/k7vaahWUHWqfvpIkH7bKSbr7z2l8 cqsg== X-Gm-Message-State: ALoCoQkThTh34/gi8QHE5Uyw++gSvSbijm9/gKbcjem/N4Rid1KZ8auWUhIW0EEC4EuiQEUZONOl X-Received: by 10.66.66.3 with SMTP id b3mr6260554pat.6.1409916341589; Fri, 05 Sep 2014 04:25:41 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.112 with SMTP id 103ls719654qga.9.gmail; Fri, 05 Sep 2014 04:25:41 -0700 (PDT) X-Received: by 10.52.248.232 with SMTP id yp8mr50114vdc.83.1409916341489; Fri, 05 Sep 2014 04:25:41 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id ej9si340855vcb.25.2014.09.05.04.25.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:25:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id la4so12135356vcb.15 for ; Fri, 05 Sep 2014 04:25:41 -0700 (PDT) X-Received: by 10.221.68.66 with SMTP id xx2mr9660683vcb.1.1409916341407; Fri, 05 Sep 2014 04:25:41 -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.221.45.67 with SMTP id uj3csp67407vcb; Fri, 5 Sep 2014 04:25:40 -0700 (PDT) X-Received: by 10.70.119.1 with SMTP id kq1mr20325245pdb.35.1409916340511; Fri, 05 Sep 2014 04:25:40 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id j2si3494164pdr.83.2014.09.05.04.25.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Sep 2014 04:25:36 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) 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 1XPrbr-00041Y-6q; Fri, 05 Sep 2014 11:23:19 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XPrbh-0003n0-Rh for linux-arm-kernel@lists.infradead.org; Fri, 05 Sep 2014 11:23:10 +0000 Received: from leverpostej.cambridge.arm.com (leverpostej.cambridge.arm.com [10.1.205.151]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s85BMPwp016013; Fri, 5 Sep 2014 12:22:27 +0100 (BST) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] arm64: psci: respect MIGRATE_INFO_TYPE Date: Fri, 5 Sep 2014 12:22:18 +0100 Message-Id: <1409916139-20127-2-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409916139-20127-1-git-send-email-mark.rutland@arm.com> References: <1409916139-20127-1-git-send-email-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140905_042310_247382_F4FD47A1 X-CRM114-Status: GOOD ( 11.88 ) X-Spam-Score: -6.7 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Mark Rutland , robh@kernel.org, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, catalin.marinas@arm.com, will.deacon@arm.com, ashwin.chaugule@linaro.org, christoffer.dall@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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: mark.rutland@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) 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 Commit e71246a23acb (PSCI: Add initial support for PSCIv0.2 functions) added hooks for MIGRATE_INFO_TYPE, but didn't call it anywhere. This means that currently a UP Trusted OS can reject CPU_OFF calls, which will cause things to blow up. This patch ensures we test MIGRATE_INFO_TYPE before calling CPU_OFF. If there's a UP trusted OS hotplug is rejected. Full support for PSCI in the presence of a UP trusted OS will require the use of MIGRATE and will have to come as a later patch. Signed-off-by: Mark Rutland Cc: Ashwin Chaugule Cc: Rob Herring Cc: Stefano Stabellini Cc: Ian Campbell Cc: Christoffer Dall Cc: Will Deacon Cc: Catalin Marinas --- arch/arm64/kernel/psci.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index 5539547..a5407af 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c @@ -386,6 +386,20 @@ static int cpu_psci_cpu_disable(unsigned int cpu) /* Fail early if we don't have CPU_OFF support */ if (!psci_ops.cpu_off) return -EOPNOTSUPP; + + /* + * In the presence of a UP trusted OS, it might not be possible to + * hotplug certain CPUs, and CPU_OFF may return (which would be bad). + * Supporting a UP trusted OS requires careful use of + * MIGRATE_INFO_UP_CPU and MIGRATE, so for now fail in the presence of + * a UP Trusted OS. + */ + if (psci_ops.migrate_info_type && + psci_ops.migrate_info_type() != PSCI_0_2_TOS_MP) { + pr_warn("Unable to handle UP trusted OS\n"); + return -EPERM; + } + return 0; }