From patchwork Wed Mar 14 16:58:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 131691 Delivered-To: patches@linaro.org Received: by 10.80.210.197 with SMTP id q5csp410909edg; Wed, 14 Mar 2018 09:59:43 -0700 (PDT) X-Received: by 2002:a19:6d03:: with SMTP id i3-v6mr1471066lfc.34.1521046783349; Wed, 14 Mar 2018 09:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521046783; cv=none; d=google.com; s=arc-20160816; b=k7tJ7Lm9NDbtf89UAhk0qif8afKFzjxhLZJ7gtKR+i00d9v+H/sva5g2I7g4You9lC sDaMLAUJl2U8b1gErjhPtATAIWINAUhZQN/Ivdfs0TLCUP8yQ3iEFPC26PszRgNihtmF F2GE26xveGDtFkYmyBxXUBkt6Jt/ZVVjL+xSULaa8efcf+ePGbMb9yidNI6LNenugN9A EfVZ2cXUqa2KsJZCcTkviaGWtSHDMnd/uza7McBXpl0awHrzonR+ogD7uSVbYl2ONFd3 8uIjLYSiWw6IEwF32BrchV7wELQuTWXdEWU+mMhLSkJLtcE8K+7Y15QJn+Ovb1YFo0DF IUtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=V8T+Aaj2D90miakPHABzG7i+72q2t4QS0xRQy403isQ=; b=KxuLyYZNthRph+J6BoWhafX1TkWet/tRM4gJnn2NQ+vlhd69niMsoQPYBEABt9fHIO UsJD4MfSQmhYs5CZ0mxVgi2Ebt4m1kfBBvJ4x1ukpDtNLgUqwSQypsp1VdwHLkOz4wXy 6KnwDHrOaIKp1uski34Pxt75ZOUVNqmu3mmoffHTJHD2ov6ian+IY819a5ZCYxWT67WT sX2dQqs6NGqZSPxhmRcvLbuDKj0BFtCiM6kYbyYy3k+ohJyVzC+NGwMuSbLffilLEFxe GeBm0NsUSCtMLSdIifSHRqsTY2IFC65BEUa1GfjL2C6/kAf6Mc0Oz63sgu6PPxXdrU5f M7dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fSXiUDNi; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a5-v6sor859704lfe.47.2018.03.14.09.59.43 for (Google Transport Security); Wed, 14 Mar 2018 09:59:43 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fSXiUDNi; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=V8T+Aaj2D90miakPHABzG7i+72q2t4QS0xRQy403isQ=; b=fSXiUDNiPNUwRmBDehxehFub0OUn3PcIHDy3Z8Q1sWy2ZpGZply6kfDwJjLfQAOv84 NJ7BBruTaodsgwA1E7WALo8DQfOfS9cZ/al149BSoMhzX9Go9Rl8Y7x7HM1XiU9ZO4zj n5u2v7ukl4loY3UYJqHMOtwcIwvM+K2d/MSVU= 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=V8T+Aaj2D90miakPHABzG7i+72q2t4QS0xRQy403isQ=; b=qt8LDoSkYxBJehraN+RM70caZaTnVAT0GVza131juv6P6ORISUfGPOQ2rFt0gOoU5s Cf/VX91A8IY71/SF+hHrebb3bMv3fVQlG1PcnG7Urg3Ch9w3hqzf+I/vy0UPbf9+j6Qe PhNmMRNEbosRLv93KgnqNybIUSJQkewPjMASCcV9jmgtKs4FrP5dFicC1/rJEMUbm36I 75tFoRplhwg3SWYJZcS/7C+MhGanV0+9WWcwjuL6HP17SP1s9JIamVytm3kIzu1rtEbd zpfjVeWCj5XjmbA+4isXtzjJuQvLHa9zyZibigNorSur1kHjAeczTWrXhOqCFLIgy69S onQw== X-Gm-Message-State: AElRT7Gy8FGYqnt5hmodkhF2yGl0TiYQxlxA2dZjSb+/HU0phnbi9Has hSgBq8EG2KL/mAgc6LIxMMZ1+JXQ X-Google-Smtp-Source: AG47ELssIfk3nYMBFM/IdJWMH9O/7jg3r/H9ko7kHjxPMx3GcB/H5MNKeav329Q+3JTtBEmPosRPlw== X-Received: by 2002:a19:fe2:: with SMTP id 95-v6mr4115003lfp.13.1521046782940; Wed, 14 Mar 2018 09:59:42 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t24-v6sm724849lfi.30.2018.03.14.09.59.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 09:59:42 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , 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 v6 22/25] drivers: firmware: psci: Deal with CPU hotplug when using OSI mode Date: Wed, 14 Mar 2018 17:58:32 +0100 Message-Id: <1521046715-30683-23-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> References: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.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.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 944d6f6..06f3916 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/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); }