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: 10283187 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 11361602C2 for ; Wed, 14 Mar 2018 18:11:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 020BF285DD for ; Wed, 14 Mar 2018 18:11:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9F1B285E8; Wed, 14 Mar 2018 18:11:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7443E285AF for ; Wed, 14 Mar 2018 18:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=NGYWocWMMFRdnedswVOIoUrfgRq00r5SeHwiVV5NLHU=; b=Od5EePZNhqyHrjnxUHu0JOvcUi UNNVa0AYpIxzx1zH4G/G8VAHJPAkem0qRa8BIdhHijnLVzPZnnAd6svmUUFNEJGOtIwYxUtFokH4/ i5/Prvf7w088HXfut5yZ6xIJuUsaUNlFpJ8KKdso6ph3cZZiA9YF0oDpbnEBiWR24wJN3HcJiENg0 s035Ofey0U7Adw9GYXmjXqHsd6nxGfDmwgH20C7fOzQvZpXTOoMPFakftr6OZrTKjBkdGlRfvYEpN FGUNUHN3LebRNTTi3sRT9g/DARL4KETV6VQpekUZEFHp9wsmg8qFC5pRMWon2a2SnkHSQuwv8WoPQ ZCu2gfmA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewArr-0008JV-HJ; Wed, 14 Mar 2018 18:11:15 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ewAqW-00064J-Ag for linux-arm-kernel@bombadil.infradead.org; Wed, 14 Mar 2018 18:09:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=V8T+Aaj2D90miakPHABzG7i+72q2t4QS0xRQy403isQ=; b=wNpblBu6vw+QLUEAz8FvNZjzT cqxJe6eN96bP6ZXr9dGvBG9Wud3FpK/lWvK2t22bS/buSV/ITuizZGNT6XbhSn19tqGydHYUmNvmR jJAhYI54IM1w3zL8MtMbFNv6qmJH5k++3e/dYVI4pxZCtEwcY5QTM1YoC855/xBkzy8b/xa6WMgF4 pvN6qbF+TrXadNkFqumsmy+6QpxNTrsAppILKczkiZLGenAIx1K7zZ9G7forq0htWzq1BdDKDSRnH Y1rK4T68Z6y2qGqwdYI7Qd/mss5J2zdskXrmG3bGvgsf984HI4xOBbHQIV5QDdkNaGWUu6+D/CmIK AD2FjRVUA==; Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ew9kl-0003T6-8y for linux-arm-kernel@lists.infradead.org; Wed, 14 Mar 2018 16:59:52 +0000 Received: by mail-lf0-x241.google.com with SMTP id y2-v6so3754555lfc.5 for ; Wed, 14 Mar 2018 09:59:44 -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=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=gDfON5EjMSB8hp8l7BDJT3/2Nvy/v0dfVnJQL7e6bSd6QmzequLD3LKly/eoHV8NUC EbPnwqcZDdPpqpWjD1nE06VYbByhLHdWvXZcHj2pD9cxmjSC/inrJ0Kgc1gQnsW3CZTv iMFLjmwHXnOYchXl2tvxvm8EPC6gDvuAuomvuchejfrdITAY/5wqjaJkGwL9vkJYD38y RMzkcjo3VsrQAMEUGhI7i7npeIbZk1LBE3bnCcttw81Fx/TlsQSiCoGbom7OeZvcYrd8 wGHH/XLl2bvaQl86hQ74AYXhjWsCyKMQ/0SNy6szeTNI+p211Zop6H7AmcJbP6Zx4S0S /zSg== X-Gm-Message-State: AElRT7F13NFYwNIGS4Q7NhvdUjPqEuXybcnksfdzGWxlgwuf2cZlbaAu 7p0pkheYRkmgjtBcu89zFrjCuw== 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) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180314_125951_360362_B74B8D36 X-CRM114-Status: GOOD ( 15.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Juri Lelli , Geert Uytterhoeven , Kevin Hilman , Stephen Boyd , linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Lina Iyer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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); }