Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp295848lqf; Fri, 26 Apr 2024 07:07:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBVk8H+CULDpE79zuej4vJdwjtgLmqMrR4okCn+d081MS1ud0MxRtdCRVPg9SsgwuNkrFao58Vrmx23VTwUmrvbowLtTerrjoRSthN3A== X-Google-Smtp-Source: AGHT+IFyQgsvw9GD0onpq9BEoK0eTk1ArsRoDv3HL6eLCVtzP0w+DB3U4n79dkmc6pKri/4zk5XH X-Received: by 2002:a17:90a:77c8:b0:2ad:80c5:1784 with SMTP id e8-20020a17090a77c800b002ad80c51784mr3482832pjs.34.1714140428541; Fri, 26 Apr 2024 07:07:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714140428; cv=pass; d=google.com; s=arc-20160816; b=VPkTWbeiBWkTNLKzdAji7MpMfbPtS3+bPxDZ6QFi5UWt1ETgfRxf07jJEZmO3bFdvn +lHd8rv678q65qsSczxk5S2h7bZsHJxohfBySZmq479esbeyw2TUi35zv+yqkquKfmZB 3H/3DSqhncn2QAfInubWnOX6r7J+CdVC8H47EfVgG2NEio3VW+nmEwb8IrZRRjzHlLTC roENSucBgN3Jn5n5AFxF+C2Qn2Y1UQgUj2b2npDM5q1XODxWawOHXaOz8UHL4zNXnkv3 zPhZ0Jo525hE3mGItUGM+SWniw5/D66N+o2sXwOERSAhwMf6+u19njrsOjHDHwUh2tgm K4tQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=GSYyTlumY7UQIeZPZNCgX7hfvLSZ7DucffuS66CBNc8=; fh=QfGN+Nlycv3VEqD8X65neWxvyXXboUCZUO7iSMK6eUk=; b=CShHHMQlEkHpvcKAAIVkDq9LB3+IJG1Ncjr9HUKXr2TnHl1D6tITG9rTR7c4lGrtRC bIAmD2NYChgklBGoj8+X7lxyhGHsZBfcmPNfi6WnMC0uY99T64pP5LVDs3dRPDMLQikX idIuG7JNKlA3TfePA3qkPKig95hpReGqs2JdcxOp9f87cpKns2cTjAiu8c+mJkWoKDGJ uHoErJRr0HPUjSVJaoD9xe8sTlSSNpyC9u19ePpYybLSLL7knJeXw/pO/qdw9SMap9iN 1XSo6RKUks7Ueqq97SuhkR1+q1QF75lkfrTAl3LvWDhLdPwhtU4SiBbcykBSESTl8ygw T1Ag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-160113-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z1-20020a17090ad78100b002aeb2b7da89si6829939pju.23.2024.04.26.07.07.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 07:07:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160113-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-160113-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 42B68B2423F for ; Fri, 26 Apr 2024 13:59:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 999E1148857; Fri, 26 Apr 2024 13:57:42 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B07861487E6; Fri, 26 Apr 2024 13:57:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714139862; cv=none; b=eq4s1zS4p1+IiUu+0NvTyaO2onZEUjh2MzLtsVvOueUbG8P0zr+sDy9JDh7A0fd3WmgSa6PkNbNYe886LLJ6LC7ukcVc4bTI8TkqH19ygfodwghhmwslNz/uK8+uLMZHNcG/OsujWM95S8ioX41TUDs1uTcRQPvBXtH07/RyxHM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714139862; c=relaxed/simple; bh=dHTHd6agazxCncDtB5eXXAKR0X/5llvllP9Zv6vm8FA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mc0ggN5BO7MFamEnWT7M8Y84RjjwZVoOGWnZSBVlYj1cJz+k+4Td7Z2jJAXH/gnS5kB3IqXPA7kGYTHfER8nNYPcuNotacLJLmcoKQXaZ5iZDDk4DJyKEJvw6FiPcwWk9zVA+tIZk80N4jyHRpqAamHoWkDzNKITSsn9UdJVIQM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VQvP86D31z6K6Z3; Fri, 26 Apr 2024 21:55:08 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 94325140A36; Fri, 26 Apr 2024 21:57:37 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 26 Apr 2024 14:57:36 +0100 From: Jonathan Cameron To: Thomas Gleixner , Peter Zijlstra , , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon , Marc Zyngier , Hanjun Guo CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , , Lorenzo Pieralisi , Sudeep Holla Subject: [PATCH v8 12/16] arm64: psci: Ignore DENIED CPUs Date: Fri, 26 Apr 2024 14:51:22 +0100 Message-ID: <20240426135126.12802-13-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240426135126.12802-1-Jonathan.Cameron@huawei.com> References: <20240426135126.12802-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml500002.china.huawei.com (7.191.160.78) To lhrpeml500005.china.huawei.com (7.191.163.240) From: Jean-Philippe Brucker When a CPU is marked as disabled, but online capable in the MADT, PSCI applies some firmware policy to control when it can be brought online. PSCI returns DENIED to a CPU_ON request if this is not currently permitted. The OS can learn the current policy from the _STA enabled bit. Handle the PSCI DENIED return code gracefully instead of printing an error. Note the alternatives to the PSCI cpu_boot() callback do not return -EPERM so the change in smp.c has no affect. See https://developer.arm.com/documentation/den0022/f/?lang=en page 58. Signed-off-by: Jean-Philippe Brucker [ morse: Rewrote commit message ] Signed-off-by: James Morse Tested-by: Miguel Luis Tested-by: Vishnu Pajjuri Tested-by: Jianyong Wu Reviewed-by: Jonathan Cameron Signed-off-by: Russell King (Oracle) Signed-off-by: Jonathan Cameron --- v8: Note in commit message that the -EPERM guard on the error print only affects PSCI as other options never use this error code. Should they do so in future, that may well indicate that they now support similar refusal to boot. --- arch/arm64/kernel/psci.c | 2 +- arch/arm64/kernel/smp.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index 29a8e444db83..fabd732d0a2d 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c @@ -40,7 +40,7 @@ static int cpu_psci_cpu_boot(unsigned int cpu) { phys_addr_t pa_secondary_entry = __pa_symbol(secondary_entry); int err = psci_ops.cpu_on(cpu_logical_map(cpu), pa_secondary_entry); - if (err) + if (err && err != -EPERM) pr_err("failed to boot CPU%d (%d)\n", cpu, err); return err; diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 4ced34f62dab..dc0e0b3ec2d4 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -132,7 +132,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) /* Now bring the CPU into our world */ ret = boot_secondary(cpu, idle); if (ret) { - pr_err("CPU%u: failed to boot: %d\n", cpu, ret); + if (ret != -EPERM) + pr_err("CPU%u: failed to boot: %d\n", cpu, ret); return ret; } -- 2.39.2