From patchwork Tue Feb 14 23:34:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 13141017 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 BDF6AC61DA4 for ; Tue, 14 Feb 2023 23:35:42 +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=czodnb50P8d/VFTsSopJwKOIAtHCl6CmzZiv2rVgyf4=; b=woLijBNbZaa9Pe U1DMg4evJV5IRuWTnUfecuCVkR9ua9zu0IOiFq8zj770KyHH8f/8EkVyvLEOH/zn3dNrP51RNmDYx FS3Nyf/5cCS5Vhc2sTQ4ypMedecNuJwz7AOWFptQnmAp9whFdoLe/HuB+mp5JSupPm+4NU5K6yMUN BYw7i45fdwy5B64l4GUZLXVKDTl02k3iFLOMM2Wp0t+GLb5niqZT6c2839yh7RdUbswpbt+tVgPan jwb/odeFYzgWL/fSVJJnlwU8y0RPFzRNM6oKeHN99/PZNo/Fprl5G6Nf2FqPCf35wSRIlVWl5+Pig 2UPaCMmcIQy35SCrtpqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pS4ox-003uLX-P2; Tue, 14 Feb 2023 23:34:47 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pS4oo-003uGw-2v for linux-arm-kernel@lists.infradead.org; Tue, 14 Feb 2023 23:34:39 +0000 Received: by mail-pj1-x102e.google.com with SMTP id w14-20020a17090a5e0e00b00233d3b9650eso340845pjf.4 for ; Tue, 14 Feb 2023 15:34:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=48thYLKBHK3Dz7aYi+ob8EdMN1A5iezy1Q0AVsszte8=; b=Jn/v41TrSgPi7e6JR9bOENXFzhjgLtpC2WLsnLwNjTW2sA+9kmuoLM1lFDzBGeJrxU QS5/MJsMtiR1g6oDcEwRP40IExUIYh9rqMGhye9XxKjX8cWpNFtYCJXWrbTzECRzC9QY hP9K2FhnVeWtagHz3/MhR4vQN6SV0o0tNZj1Oh+DKIIZmrY8smcrIfxUlW2cwIgvu5pv 6lONBp53gmw0hZUKyR5Er/HruRiIhjJZk5bS3nkXwDe2n4XD/iBFH4TP2zhLxAN5Zcfm axGca2beR+bZrCa09YrfKHnHMM/erjZhqStBRfsDE1j9ltSpmIlYbNNa84dhif6gDJbT Ur2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=48thYLKBHK3Dz7aYi+ob8EdMN1A5iezy1Q0AVsszte8=; b=78HQTEj+HMqzn+V7hMkxdG3i4nCO66qzIKaxdqMeWmq5E5jRkVt3AyKget2UamTjQ9 sIhSA/emb4K/6/rgFlHbD2gHkSIHTj5IuVX2oWSIs3PfeM9E6hM56lLhgCiMSaadao4j VDQqY5xT4Gr/5PnOOBTno1SbeojFL9ymcXO5hxearuJ6G8eDdGesf4ch+MsCWOPSSCZb TWNwjC6ql1aVv8pt9/2H0RM7u7BwRZLlhWJV5n3vWaI2KV4cURKnDA66MDlvHNo/41R5 pbl5ZRUHM/duH1iYgPJklBAgJxdw3Df21+pP+Cmw04RtKpfuTu3voOSAIuuXQCsS4aNC bmPQ== X-Gm-Message-State: AO0yUKUJLZP3vT85+lqJ3VEkKOeKs8mPtr6/m2NL001WfljsW1HSspL0 l5dKRR5sV8C/+bGlLEvlOPjNw0IEZjbzSQ== X-Google-Smtp-Source: AK7set9J0o/k+q+LqmlDnLvl6JXhdjpU7GwKbLxhJj0CWsSB8aVXZPThklfApiP6i4PsSc4kiu5oBg== X-Received: by 2002:a17:902:fb10:b0:19a:a5c4:afe9 with SMTP id le16-20020a170902fb1000b0019aa5c4afe9mr357460plb.31.1676417674730; Tue, 14 Feb 2023 15:34:34 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id f12-20020a170902684c00b001963a178dfcsm9434801pln.244.2023.02.14.15.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 15:34:33 -0800 (PST) From: Florian Fainelli To: linux-arm-kernel@lists.infradead.org Cc: Florian Fainelli , Thomas Gleixner , Marc Zyngier , Oliver Upton , linux-kernel@vger.kernel.org (open list:IRQCHIP DRIVERS), Sudeep Holla , Broadcom internal kernel review list Subject: [PATCH 1/3] irqchip/gic-v3: Use switch/case statements in gic_cpu_pm_notifier Date: Tue, 14 Feb 2023 15:34:24 -0800 Message-Id: <20230214233426.2994501-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230214233426.2994501-1-f.fainelli@gmail.com> References: <20230214233426.2994501-1-f.fainelli@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230214_153438_143617_5BEF9376 X-CRM114-Status: GOOD ( 13.31 ) 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 No functional change, but facilitates adding new states in subsequent changes. Signed-off-by: Florian Fainelli --- drivers/irqchip/irq-gic-v3.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index bb57ab8bff6a..b60fadb7eb44 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1374,14 +1374,20 @@ static int gic_retrigger(struct irq_data *data) static int gic_cpu_pm_notifier(struct notifier_block *self, unsigned long cmd, void *v) { - if (cmd == CPU_PM_EXIT) { + switch (cmd) { + case CPU_PM_ENTER: + if (gic_dist_security_disabled()) { + gic_write_grpen1(0); + gic_enable_redist(false); + } + break; + case CPU_PM_EXIT: if (gic_dist_security_disabled()) gic_enable_redist(true); gic_cpu_sys_reg_init(); - } else if (cmd == CPU_PM_ENTER && gic_dist_security_disabled()) { - gic_write_grpen1(0); - gic_enable_redist(false); + break; } + return NOTIFY_OK; }