From patchwork Wed Jun 20 17:22:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 139392 Delivered-To: patches@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1051116lji; Wed, 20 Jun 2018 10:23:19 -0700 (PDT) X-Received: by 2002:a2e:92cb:: with SMTP id k11-v6mr2504956ljh.18.1529515399489; Wed, 20 Jun 2018 10:23:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515399; cv=none; d=google.com; s=arc-20160816; b=HgSCXjYVU4WcmtWXiot4UA6rijmfiUDbfJ+CIHiQsRTJBRzna6IEVAj9zauBG4PsBm gKzbddizH/xArWe9gao/PZuHFI4ZT9QvDHYgv1hdN0IEsD9d7DdHbAsEr/rKHaaa/Vtm lsphy/vYz60vau0/SZaTB0ue4PxdXNv94OFPy4cDaPh/T4ySImcQ7hxhJ9V4BKTsvvBj 4HwyEDm6gK6H/ooKeJK/JFtwzxi+DXXBzOlkErqH6Gh9VjiQk60ZHv9i6O2hsilJDQch DL3QMHXIcdd/VnHrxIaCpxfdb9h5KC1mS30lnzD45G2nl7Opa/FtUDf/vqgwx0Fv3Etf XiCQ== 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=w6707zj46IMqt6XCkQl3eda+NnYi5j11bRFglc+AHIo=; b=xBTUdRx/ROo6s8LxLnXr46Mp1DKtY0swJJ50rQDZAXhK6CfgVtAsNXNC7PKpAudJw6 YVFvQFOpQZoYRWLR4pcii3Dbw+iXSciF4uevaC0ONuvpITyWtPSLKrhMeRitksG/w70K 9WJfD8ViFzQ+d6QhGLyCAHXdPe4LB+nljmle0dP7eV6NEsTiHeJsm6luXGCl6dSp9/hP bdyS11a/XtqPJwjEMLAPaa/rP3vMsTkM0RVQPNBFBE77J8FdO1gERuIqnRlI/smV75iY qAufk7mtNBBbQKMRvN4cH6+2U9onZZC+L1FnuqsckNgZ6itwn7eClkMMgk3TnwjKH1ST nyjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MYqUP1PX; 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 l13-v6sor638200lfi.78.2018.06.20.10.23.19 for (Google Transport Security); Wed, 20 Jun 2018 10:23:19 -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=MYqUP1PX; 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=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=rL7eyaAOQcKSVcSlWLifLlGy/sfDl23+igXSkeP4clDgEsu3ZnHDD18ssoycV9BflG 0QGjiZXOKX679qTukgjDVFJ4CODTxwVa/0PuyMz5Li1I5y8cDV/LUS5m3Rfvm0/OiEkM 4+WrxQzdYXpFKtgcPAtWzbNU7ktrP0grFjxjm3sjeXWF8lHZIBkT3DtZCytYgFGnOIp+ 7yXWgTteW+J/T65ITH1GXuCU2pUdTGSo5wvVodcgfGX449qE083OfvG8wpZ4mzJtirkk kPMO3GItzOzRpYsi/gPsJwduTZO6tq/eIKfO6Ue7Gh9cfMbuZyn6gDSoEQMIAe6gS4R9 hqOA== X-Gm-Message-State: APt69E0rfIkUIM4a1DASTumbbwzutCa72mxhObo5xzE+/fVSLYmz42xf 1C4lHR8D0Dz2d/NxXWpncrcUjCNc X-Google-Smtp-Source: ADUXVKKO7UQ2hkCEVdaK5Yf4srm6bzhJGEXUFWekAvaP3L9+qrqsnljNOBZe+oStCJOAS8uRawZ5tA== X-Received: by 2002:a19:428c:: with SMTP id p134-v6mr12790102lfa.4.1529515399164; Wed, 20 Jun 2018 10:23:19 -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 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> 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.17.1 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); }