Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1032748imm; Wed, 20 Jun 2018 10:25:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLvw+MMpFWiKXEVhXFV26Teya0C//UfXL1ww8iMLLCUSUnNPPd0ITRn2CtOa0cwe2FrbxKu X-Received: by 2002:a17:902:206:: with SMTP id 6-v6mr24829103plc.294.1529515521993; Wed, 20 Jun 2018 10:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515521; cv=none; d=google.com; s=arc-20160816; b=eY38lMO4jJiPNYdW0kPlPzuTbHjdbJgp4WD9429pAxZc6iUnihOQsOiNqngUGq/T1+ tKGy4G52u+zH+QhhPxxWTWCYkLha/l1Aj+zYGG+pWEUdrbjuNZS4efawN8bSuEc5oiKX Uk2pHLPqQBS13YOuHBcvHuRwWKX/lgKa3TC+lSdgHCdyPRYJHkDJy+0g9urNXxkemP1V oXaX/l0GYjteHplAndl8mYVVoEtV53R6mgucJwNU/1OKgFiOGlePnv5cjKZUFatkNJi+ zPv0V8J0IuLQL/AVXJdQoHQQ5OrmvL3S8WuVT+CZTqBTZw1jrJHRs4nIPGKv7CJyGFAn bOjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=w6707zj46IMqt6XCkQl3eda+NnYi5j11bRFglc+AHIo=; b=XLQe2z5/evDAo9PtgdrugD/X4/3yTWJ0o9IAy8xM/UnYU5PTPuHx/2hkxhkCID+puP D3eXz7Irts4ZoOJrDy8mFr5k948IGbi688VO5b3+H8xHYJTKJ0lOsOxh36tV/xS6YRiG Kld+7brgnLUWGb635vcsvFBovP0fy06K+U/j8tnKj7IEoU+yoUxTmi9rqDQY+1pctxHI Hv7o70UdcAIGt8Vi0tKFpXaaQCsnh61VgPv6BVW4ZjG6oi2ugPqilq/t80qWqssmoFJt sk33NoStBonqs4gfEZUhv2ZddadE3IyxKpgwheKfC0/bQfCXMQ9gc378fSxycPjvk98w JepA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MYqUP1PX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1-v6si2215864pgf.560.2018.06.20.10.25.08; Wed, 20 Jun 2018 10:25:21 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MYqUP1PX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932885AbeFTRYA (ORCPT + 99 others); Wed, 20 Jun 2018 13:24:00 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:38654 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932883AbeFTRXU (ORCPT ); Wed, 20 Jun 2018 13:23:20 -0400 Received: by mail-lf0-f66.google.com with SMTP id i83-v6so481904lfh.5 for ; Wed, 20 Jun 2018 10:23:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w6707zj46IMqt6XCkQl3eda+NnYi5j11bRFglc+AHIo=; b=MYqUP1PX6RNA8Jk/XK94dyVhwN3dNQK/vBGc7ZQbpt3uVK887zAsAYYjKClORu8hYZ YCval1UFbciw6q+Jf6WI/auuiDVzqnHaK29+Xwx4KQX80gN7FPLwOPneN3N5nWLlWJNn dnX/Cen42KgPaYzK2lzR+hKcvFi1RzNlQuXLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w6707zj46IMqt6XCkQl3eda+NnYi5j11bRFglc+AHIo=; b=Jp7RvQyY3YSti1qu14qTPgp//LLbmo86E5yZsqvUGybF9vkya8DM1Q93Uv33WW7tzo 7M5ornG5C5ZZMsPwbN9oqh71TLldDtI7D79dOrqrjdoHvMupDZ/kc8WX19gk6j9jnAzp nbGd2YOuD+EG4Bgy410G4RlULppVGQdCUWMM/Hx82LUzpj9VRZo4uZz0zbGrhGy8GC63 Ik7+SQDn1Y7fxtshE29UcSBmdyD3H5ufIS0FBmurh5omfncm43WN1y+IsdpL+wq846gk 1q4UtEg+v4LGMbjK5Gimf/CdKPYUqvt02xdPTUjUn34KaCYjKr4BmHSGdGZeJCC5yn8N Awyg== X-Gm-Message-State: APt69E3NYCGlfyyTfSK/ztGIrODiiaBVDtkGLPead1l9xr/mIpoT8UoO R1n4UxF4Jh/unJFextJ5g4lp6g== X-Received: by 2002:a19:428c:: with SMTP id p134-v6mr12790102lfa.4.1529515399164; Wed, 20 Jun 2018 10:23:19 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b2-v6sm514441lji.85.2018.06.20.10.23.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:23:18 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 24/26] drivers: firmware: psci: Deal with CPU hotplug when using OSI mode Date: Wed, 20 Jun 2018 19:22:24 +0200 Message-Id: <20180620172226.15012-25-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620172226.15012-1-ulf.hansson@linaro.org> References: <20180620172226.15012-1-ulf.hansson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To deal with CPU hotplug when OSI mode is used, the CPU device needs to be detached from its PM domain (genpd) when putting it offline, otherwise the CPU becomes considered as being in use from genpd and runtime PM point of view. Obviously, then we also need to re-attach the CPU device when bring the CPU back online, so let's do this. Cc: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/firmware/psci/psci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 700e0e995871..e649673d71f0 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -190,6 +190,10 @@ static int psci_cpu_off(u32 state) int err; u32 fn; + /* If running OSI mode, detach the CPU device from its PM domain. */ + if (psci_osi_mode_enabled) + of_genpd_detach_cpu(smp_processor_id()); + fn = psci_function_id[PSCI_FN_CPU_OFF]; err = invoke_psci_fn(fn, state, 0, 0); return psci_to_linux_errno(err); @@ -204,6 +208,10 @@ static int psci_cpu_on(unsigned long cpuid, unsigned long entry_point) err = invoke_psci_fn(fn, cpuid, entry_point, 0); /* Clear the domain state to start fresh. */ psci_set_domain_state(0); + + if (!err && psci_osi_mode_enabled) + of_genpd_attach_cpu(cpuid); + return psci_to_linux_errno(err); } -- 2.17.1