From patchwork Wed Apr 6 01:48:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 12802266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EADEBC433F5 for ; Wed, 6 Apr 2022 01:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eCDhECZeODQveuMBbE6MyL2rRv1R9JlIm84/vVEgEgw=; b=h9fylsBnQtQ9ep EfchJFyd/QK6BsoC+EEEHcSQWuEc7JG5mcULP6Q0OlGgXfCRhJ6Wm69V34dmm8fBzwYn9vttWcdhS 5DW8N1JRUEpyOhWzIUkyrDDUN203r6q7YkVtM81/jsoxoibhU8fwgHdtSWShh5Y4N2/PZiuro4AFQ x7mpG2/YsiMlj0IweHiqVOM2j+Ko1iXX7qbsytS8fpCwoABW8CVWRaaN7fM/uEOK5XLZkWWZB5+vb wFLR5vgg5VYkS0Ukr9MegZ/7tQd35BrGVo2qzokbLojxMqUDbrfHwvjQwt6Vp6Nsw1bCJwlLRiRjD F0OttWVQuY5IOsqRY+Zw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbunr-003Gvj-5v; Wed, 06 Apr 2022 01:49:47 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbunW-003Gld-V8 for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2022 01:49:28 +0000 Received: by mail-pl1-x62c.google.com with SMTP id n8so710002plh.1 for ; Tue, 05 Apr 2022 18:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0FW336dtHK89fvl3u7JvXc/X8Vjn0tSLcri6guFx7q0=; b=Sm9XupWe/onCfaGAwkmriGjGwohqfs7tWqDVDN3hrzuBMaoUOGdAEyO1VLSUAtATA8 Ft0TJTt8T8ciBNG6tsVOxsv8tvLCqPvaXb7mzPcJpEZFilTlFRXoZAoBamloOY0jZhkv 9D62OHjZGQyqzrj1XG9hW8jNlQ6K+qMVy3crY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0FW336dtHK89fvl3u7JvXc/X8Vjn0tSLcri6guFx7q0=; b=M2mTuEb0lzSqPjyCuSu0kPL8y3M9mMu4VsShneSoo10re3xrDUYz/A1FRe4hRxKf7m 1/w8i1BbqFbi07x2TA7OlEPa14Ga0Rly+hu0h7Avgu68q27kfRwtxvSeLNfIpaX3tJji p05SmgFDLDdb8OuN07cdF2sMlewvlD2Pi90AwvtH2eVscGTYEwXalQuf1vudS6w+TOYa d3XWwmxdGiPZSHIVnkDVSBT5R5WUGfpkDIjdVOBwWn8gjjwcHhlyFD5LE7thNtxw2y5g NBhKMukp6uHTznVaz7F6Ak4EbXCGnb4/PYL5Y7a+5nXKU43GXOgDbJH1pORKpjKx1YYJ 5ijQ== X-Gm-Message-State: AOAM531Nw3eHaXLHPg/PW/i/0W4scYLhwD0GHIOuLof1JDZRYOFHy8k6 i+JrRkElgMtUydBoMWMeb1LUbsQ4QDNvUA== X-Google-Smtp-Source: ABdhPJxPnqmvxiqZo+frZDwXl2WoTFYWCfoh8Unlghz4i8m3sD7L7wbxSmmeVCG/tSr91GVENxFv1Q== X-Received: by 2002:a17:902:db03:b0:155:cb6a:7c8e with SMTP id m3-20020a170902db0300b00155cb6a7c8emr6492519plx.125.1649209765864; Tue, 05 Apr 2022 18:49:25 -0700 (PDT) Received: from localhost ([2620:15c:202:201:6903:769c:e1f5:9c25]) by smtp.gmail.com with UTF8SMTPSA id bg13-20020a17090b0d8d00b001caa8f51098sm3475575pjb.9.2022.04.05.18.49.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Apr 2022 18:49:25 -0700 (PDT) From: Brian Norris To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Heiko Stuebner Cc: linux-kernel@vger.kernel.org, Elaine Zhang , linux-pm@vger.kernel.org, Doug Anderson , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Brian Norris Subject: [RFC PATCH 2/2] PM / devfreq: rk3399_dmc: Block PMU during transitions Date: Tue, 5 Apr 2022 18:48:42 -0700 Message-Id: <20220405184816.RFC.2.I2d73b403944f0b8b5871a77585b73f31ccc62999@changeid> X-Mailer: git-send-email 2.35.1.1094.g7c7d902a7c-goog In-Reply-To: <20220406014842.2771799-1-briannorris@chromium.org> References: <20220406014842.2771799-1-briannorris@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220405_184927_035557_C19D5D76 X-CRM114-Status: GOOD ( 15.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org See the previous patch ("soc: rockchip: power-domain: Manage resource conflicts with firmware") for a thorough explanation of the conflicts. While ARM Trusted Firmware may be modifying memory controller and power-domain states, we need to block the kernel's power-domain driver. If the power-domain driver is disabled, there is no resource conflict and this becomes a no-op. Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Acked-by: Chanwoo Choi --- drivers/devfreq/rk3399_dmc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index e494d1497d60..daff40702615 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -93,6 +94,16 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, mutex_lock(&dmcfreq->lock); + /* + * Ensure power-domain transitions don't interfere with ARM Trusted + * Firmware power-domain idling. + */ + err = rockchip_pmu_block(); + if (err) { + dev_err(dev, "Failed to block PMU: %d\n", err); + goto out_unlock; + } + /* * Some idle parameters may be based on the DDR controller clock, which * is half of the DDR frequency. @@ -198,6 +209,8 @@ static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, dmcfreq->volt = target_volt; out: + rockchip_pmu_unblock(); +out_unlock: mutex_unlock(&dmcfreq->lock); return err; }