From patchwork Thu Apr 12 11:14:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 133262 Delivered-To: patches@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1574018ljb; Thu, 12 Apr 2018 04:15:21 -0700 (PDT) X-Received: by 10.46.51.2 with SMTP id d2mr344788ljc.131.1523531721007; Thu, 12 Apr 2018 04:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523531721; cv=none; d=google.com; s=arc-20160816; b=kv4FBpSuEAZcUM8S61MJLN+13wuRpesgK9sUVFKMykS1ogNahMv8fsGorVPZ6Nk51b 6EYzt5eFAgQvH+JvEe3Ew50y7OxkA0cW/n38MapZvpwc/Zz9yKP0Nle04qvxwlme4UQ5 D5+9Oku8TSbFB9MPDiZEdbPIjL58KlRKJy7zm1BbQlIR/69CV/gwlUBkjBa6DA1sFxB7 W7oRstUYRE8ko9tmfWp4Frk8vXuZ31HujWZsUUODjUoiRFpnJjVjNyEhRz1gLhTJeKBs s1Xxv7IBqRuojnjS7hCaVkWHpcAYA3/RuQ+buMiXuT+2uVOTxQSq/KxEhg+QnCsWF5Wn tLqQ== 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=GmFusUm4IUgl6U995YtZ2yCefkzhvUqg/9MbDJuHTvE=; b=GlGxov4B4ZiNA/NTxnjrEPYjje52AG4sU/uVhqzEtRSkAoQN9R6DyD23u6q9+IpmHu iG7VH/vVLELf7LhsUdb5nLTU8sBoAUPe5MsthBZyhTkBvpaGWxHJZGew04d6K45D3SvP mtreeUa4+UrKdyjngiQ++nXChfNHSY0x60mRkUKTtRaETFeT8fH2qbqUjmAJWteT00kc H9ccoVjYxa+li7UmBnxJyuIXkUAtmDimsibTMt1HZUo+kPd+bis2XsawdtFNgLFD8zoG 4bsPIInFSqTPM3HzN4Q0zKq8FI+8Azdw/ct7rRB7oUu87M9EizOJqRcexhv1NhYS0k3t kM8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hpSnQinm; 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 j8-v6sor914214lfe.7.2018.04.12.04.15.20 for (Google Transport Security); Thu, 12 Apr 2018 04:15:20 -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=hpSnQinm; 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=GmFusUm4IUgl6U995YtZ2yCefkzhvUqg/9MbDJuHTvE=; b=hpSnQinm9rhHxF9ssMlB1eUFo8LtYJhbp7Q7T6bZYbOl1XOlYqkDVCzQs2JAa3bGe4 OsQCr2LUoL33iDda5Vv4GMH454RpU+mji3kbu0GO/ahXZnfgnXQ8Ug4rAaeJU8/n8HyO srQiit8nc+WO9nnoehxNybEsg4jOhKleFlPV0= 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=GmFusUm4IUgl6U995YtZ2yCefkzhvUqg/9MbDJuHTvE=; b=DpFJaVek5ySsDaAyCdR6t/HGOlDqFiVj/K9qNj6ESycXMnjE1vruWxh2eK5dDOVcV9 ZeyYO81oYcI/RwBMeR7XeFqW0nGVCko3Oq8zAYyjO36WmGkKrpcf2mMQDUOgEsyim1Pa Gir8Pnc3wH6xbiVIUIC1O7WbwFQI7CIXebz5sz2qj90etyvoKcs2yPSCg59F3naNW4eS hrZc3lb8ZixFbMzeFaIp12QxJY0ZINK2mwE9cndOIVRRBHP7ABrauuypaIoWqyciBNNV VgO3vyJDnhLq4zZbj5kpS+SXLlxxkogjpP52TIEjcBgwjtkF+tRkMCUcjRUY48ZK5cmz cr1Q== X-Gm-Message-State: ALQs6tAI7W09uL7Jk0fZQ6OnaO5E/JmzhIxUkQdniyM69d9uyDWO07YH 6ISiwDYf/JlrMNIJESVUZ5zF4/KV X-Google-Smtp-Source: AIpwx48DMW7SKu3ka7LBXwAn5XSccfZ7zs+GShxh82BTMXqVldxkvXiNqH51Uu3HgtAcy/E6ssWl+w== X-Received: by 2002:a19:9b08:: with SMTP id d8-v6mr5591185lfe.66.1523531720780; Thu, 12 Apr 2018 04:15:20 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id r29sm543187lje.72.2018.04.12.04.15.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Apr 2018 04:15:20 -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 v7 24/26] drivers: firmware: psci: Deal with CPU hotplug when using OSI mode Date: Thu, 12 Apr 2018 13:14:29 +0200 Message-Id: <1523531671-27491-25-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523531671-27491-1-git-send-email-ulf.hansson@linaro.org> References: <1523531671-27491-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/psci.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 700e0e9..e649673 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); }