From patchwork Mon Feb 12 12:32:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 199722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2396443dyd; Mon, 12 Feb 2024 04:34:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV4zrF/OitJGqgCliV7EgM+EqSWZGXt1qDYaDTVvWA31KU9TvckFrSWsZEt9lXrZ5wchMNVOl4SWABe8VeC6yJgNSvZGA== X-Google-Smtp-Source: AGHT+IHpIpm6llg0Dc4InhPoyDtlP4BWQMQpyWV/SH4NNsshAiF7E6mmmzizNxljx/B/aJgPTnoh X-Received: by 2002:a25:aba3:0:b0:dcb:d0cb:651e with SMTP id v32-20020a25aba3000000b00dcbd0cb651emr228396ybi.28.1707741268276; Mon, 12 Feb 2024 04:34:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707741268; cv=pass; d=google.com; s=arc-20160816; b=ivulK+kwdELDgBGhkXAuFZksZZ1DDS9B1wfoN8yCwEAhxwbFgK7kA+BYgYBDyLeLdK wm/6wnH182fXGq4NMT0YNBPtUsuQ3cZHveDtitvgejr29qNPJ0T5W/XhkwRssCXgMBSP 3nikPvwKaJ9c1rncJs0rUOoIiY8WDWSB8yTP3O0zWha9rIMQByEP+YhYUksj2s1+XXeQ oIJIPJHn7RAnWgiXWRJZKCR+TZQ2kPALX3kSHBc7EH3vU+kfNSUyHTy43vtrxH1mFMJ1 aZ3uApf7di9bPqZ/WZM1jhg0Xj/PJ9d2kAJK/3BSXx12NTAVsdIP3bzBWIm3wj9oRBUm rEfg== 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=havvmS2fhYzhajfcJMDawEU+WajyE7s/axGyKTCUiAE=; b=C7DTYFmMgxw2Wm3bb5KKflPHgZOcS+lv4mJam14+zZA0IFIjMvy+pYEWi9uyI7Nd04 YhntXxV8pK9aFOGrxagPyaWeV8WMD0tXL8D1qmch6bCKDC+x8DQkRyysfFPQFKWV37qr uC7zQ/30rSMVMe7m+7/eJ5qFxUc/sv9FkbS81kWMRN6qh5AX1Aeo0Ep/5+D5ogO/R02D zLwQ/Eel5sgRUzEs1lIVROdayJNJs00fUEGEdpGeMGWK2RhQknWeq4s1G9bHRAoYBJTs mThelVZFW8Mtswu4bKh+QUMgW/MhJBXV1I8U8lYhZnCxpQHKT4f4RS9DWmudIwIMLX8e Kw+Q==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61552-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCV4ZfwMUF3RK3m0fqmXAiflXBdWiCsk0zVTdbqBYMoqEwrv00yJD31RySh2tSi5CDO0s6yfUjaSoStypbv5h+T7M0yM5A== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id hf5-20020a0562140e8500b0068cb008e834si268933qvb.78.2024.02.12.04.34.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 04:34:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61552-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61552-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 14ADF1C21E85 for ; Mon, 12 Feb 2024 12:34:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE5033B29A; Mon, 12 Feb 2024 12:33:12 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790696508038218599 X-GMAIL-MSGID: 1790696508038218599 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); }