Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2420748rdb; Mon, 12 Feb 2024 04:34:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXdrfk9oP4b7peD6gWNDZOvjYAIoTZWZFT6BvF3sxwG04la1jSrWh69nM78k+QvypfGafVRQcNdSSB9u0HemZTSA3qy+vXk7UHPABVBiQ== X-Google-Smtp-Source: AGHT+IEW5bExBjao5wpRhSanE72740IXoBMYUtxynzF2bNn3aUEoOFzAo0HRc3re/g9tpoodNfk+ X-Received: by 2002:a17:903:41ce:b0:1da:3268:ed1b with SMTP id u14-20020a17090341ce00b001da3268ed1bmr1648078ple.60.1707741259301; Mon, 12 Feb 2024 04:34:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707741259; cv=pass; d=google.com; s=arc-20160816; b=su58HyvS8/6LaQe6/TzWuwirkhSRx0C4MZgzhGN8afHAfKBGF1YFuD44ZtVW1Snb0o 7dx3Ycjr4h3VsVToqyOi3qAweWFVjcbimq7R2rLnElPUw6rNZ3XPPpc+IPaEVqUdwReC G9BNJ0L3jnfY1XqzRzjMPc5z0689CbPCQtA4E+MOQ3yDjQHW+mu4Tu6dEG5Iwg/DNEAn FSGD6UQaGzKNYnocQ3Fca4yUvui1nK4ID325AwhsmN+uKg4WqNNADeYkMSILjB6zLhSW /jF0YXEodt7ccjEx6pmYmPs6CkXLsVPK0GS1nIW/n3FnTSggqp3RLc+EBEJ5y5Ibt5XL Cbww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Rz5V9PvHLAZWEa2512fNA9JSbGQG1DJqUC3OSS6wcpQ=; fh=i0ggiM01qn2cXwD/VQ8xgmK5ntklUzKslQSG5kNRTKE=; b=qyjuFm89AP57U7QWF9/UyuZglqVma9567Y6222/0ce3jPjWvMW2OKmy+nK5nLA30Q2 IJ3D+MNbh0ILkI34170SFovufjbNNQoV78JsQkviM6KqBHCf8JACfxsN0vU/52AWgMN7 8Y/PLVAfLLkkC1qNBgWhhNNESmMR5xc49ZRVza5gcImVf0wU8UAJH3HReHTNf4igPOhk xIyXgjEtT1bJlu6QUINoYrLWkZD9v7RtFdrF5kL8958CnLdCUi6ELlZWzyye91OV3yPH lVoz7Y4i/ZEcl4ObVBFNuI4adLVM9hVDe0lr4dQrZQ5oseG7IQa/sYZxKEMHJAtFCYXk t7Nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-61552-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCXLEG8UcP1yvE/L/q7z3DhXnD8Kxx+loFJLf+WTGJSFXqH8IYGHUU81BLNdPxaQn68C8i5gP4RC914KNukNlETyZQSsHhvC/Wx2r+ySdA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id i17-20020a170902eb5100b001d06d5f9533si178822pli.619.2024.02.12.04.34.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 04:34:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61552-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-61552-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EFB20287E40 for ; Mon, 12 Feb 2024 12:34:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A251E3B194; Mon, 12 Feb 2024 12:33:11 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEAF33A8DE for ; Mon, 12 Feb 2024 12:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707741191; cv=none; b=HhWIC5OEMG4jdsDy0pvuMzVFvYPxh+zZfETopzW10xM6tpsNNn2uEkTaaNtk3qb+v6YY4HSHJGIG/0P+KxjOhdvhgjsvJQH0VNfBbHGU1JTToURh4VvSL8DJqOoB8ggY9JbqcCuLsjqpwJCLMAcRaosrpHqG6W2wghH638IpwbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707741191; c=relaxed/simple; bh=jVHR1bg6dtwxToygY7pKHGPE6Yy7UaPmdSrAUqoo5JE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d7h14M6nRjbHbtALn8FjOr/uHqXZCKPD0Uobt4S+PJxxzrus/LTBpHTaMIDav1vHxYsIQ7WRkWpa5VaLZOncJw+AoAy0tGL5Cw6ZCcbNkROu7/enAoRtjrC6rsLedDSHoCJe8ctLHDhgCYNIMpXJYP+DvYSKzizzAPF1vY60W7o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0D2131063; Mon, 12 Feb 2024 04:33:51 -0800 (PST) Received: from pluto.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3F0ED3F7BD; Mon, 12 Feb 2024 04:33:08 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, vincent.guittot@linaro.org, peng.fan@oss.nxp.com, michal.simek@amd.com, quic_sibis@quicinc.com, quic_nkela@quicinc.com, souvik.chakravarty@arm.com, Cristian Marussi Subject: [PATCH 05/11] firmware: arm_scmi: Implement SysPower .is_notify_supported callback Date: Mon, 12 Feb 2024 12:32:27 +0000 Message-ID: <20240212123233.1230090-6-cristian.marussi@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212123233.1230090-1-cristian.marussi@arm.com> References: <20240212123233.1230090-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a preliminary check to verify if SysPower-related notify enable commands are supported at all by the running platform, and then provide the callback needed to allow the core SCMI notification subsytem to fine-grain check if a specific resource domain supports notifications. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/system.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/firmware/arm_scmi/system.c b/drivers/firmware/arm_scmi/system.c index 1621da97bcbb..b6358c155f7f 100644 --- a/drivers/firmware/arm_scmi/system.c +++ b/drivers/firmware/arm_scmi/system.c @@ -36,8 +36,20 @@ struct scmi_system_power_state_notifier_payld { struct scmi_system_info { u32 version; bool graceful_timeout_supported; + bool power_state_notify_cmd; }; +static bool scmi_system_notify_supported(const struct scmi_protocol_handle *ph, + u8 evt_id, u32 src_id) +{ + struct scmi_system_info *pinfo = ph->get_priv(ph); + + if (evt_id != SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER) + return false; + + return pinfo->power_state_notify_cmd; +} + static int scmi_system_request_notify(const struct scmi_protocol_handle *ph, bool enable) { @@ -114,6 +126,7 @@ static const struct scmi_event system_events[] = { }; static const struct scmi_event_ops system_event_ops = { + .is_notify_supported = scmi_system_notify_supported, .set_notify_enabled = scmi_system_set_notify_enabled, .fill_custom_report = scmi_system_fill_custom_report, }; @@ -147,6 +160,9 @@ static int scmi_system_protocol_init(const struct scmi_protocol_handle *ph) if (PROTOCOL_REV_MAJOR(pinfo->version) >= 0x2) pinfo->graceful_timeout_supported = true; + if (!ph->hops->protocol_msg_check(ph, SYSTEM_POWER_STATE_NOTIFY, NULL)) + pinfo->power_state_notify_cmd = true; + return ph->set_priv(ph, pinfo, version); } -- 2.43.0