From patchwork Mon Feb 12 12:32:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 199725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2396823dyd; Mon, 12 Feb 2024 04:35:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVpPrWyj/Yruj/R8nBioxTxFWXRm2q1UGe8A41BGN4GFakRWRZAITlJOrRi048liRasnurIi5vGeftdTHPTBpjAiXpqFg== X-Google-Smtp-Source: AGHT+IGXvcIXQJxWGUl9YbGpwojGIRa+upPRfCTGtsXIJptoP6LHY+X9xjVhfb0lA4DH6G7xxwHC X-Received: by 2002:a17:906:29c8:b0:a3c:b23a:9491 with SMTP id y8-20020a17090629c800b00a3cb23a9491mr1244892eje.19.1707741312120; Mon, 12 Feb 2024 04:35:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707741312; cv=pass; d=google.com; s=arc-20160816; b=xYy3QhMoTqraWkslm5/ZApmwwL17BZmy6UlMKCVw3VETdVAakE/nPzDpoai1ZvBuFd pFWw9YupSazz31ba8i2KbD6WGVGJuNN3c85IDBa/xRZYyx7rItjrWMiAh6q4618fWB7u ZIJPOrjiMTIZ1Lv9nBO/CQEKqczCS9exDrRzmpxw2N/DuCXARjHEbhjDzltedTVYEdHH qgC9n+3oPXAFQwc6YqxUb6Pn94VW4EQTYhlDKs+6IF6U5/T+559o/1h0OnmUFShvVV4z 3QUyxKz5a4vuq8xPk3hWyCjxM9QexRpVktoodje0/EhH5ig1Tc3RYRrsjFEmtfAJsa1M qBUA== 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=EURRDnZZgYwdX85h6fkCX6nHnAYH2BU/NBP2OcIDdgc=; fh=HO2HGx7cPD5rE993n9KuWLWNxf5PCQ/6tGZXjZ72+44=; b=gX2pIMY7bil0hPx/VNMJnQ4wywVQaJN0mvuJNJusBxErh4C8c56c64AYLszpqhECuP MaCfuVR6GSTXBsxYEtrlzNRF3j9uW7DdJWrlYJiVzfP47b9LlgGrLoBiKyD5eeyWB/Je ys8tjZKgR7ub1HTRJXfpurUgJthymvK7qEnIpytSrllY05WdQ327QTQKirC9TlR24slL VDU95OTMkZ/61seB/1xPnAI1pDpCBd3lphHz7RdwaHciXSTVkBBjm8QMpL3DtafIVrGJ KPzGOc03WZXkfik7KPP3+fPC7Af+8AHUG4bSWiEP9vObr8TShKUcSRPZ+Wknz3Q2XWE0 Li/g==; 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-61555-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61555-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com X-Forwarded-Encrypted: i=2; AJvYcCW5Q5Xk5N3ZTrrTfEEfZIq44qK7AeBYDStvY658YGmd2S5tlNvFNzw6YdZfHLXkm9MUPGcc67f61FaROKNPZZWoasXszQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gs11-20020a170906f18b00b00a35bc1443f2si152624ejb.42.2024.02.12.04.35.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 04:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61555-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-61555-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61555-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B7F121F26144 for ; Mon, 12 Feb 2024 12:35:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8D5BD3C469; Mon, 12 Feb 2024 12:33:18 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 813113BB29 for ; Mon, 12 Feb 2024 12:33:15 +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=1707741197; cv=none; b=MGk7g86Zh87tDJUmJVLMoFW/kxqytQvbwk2RCAdpdaqVptx3FBzIUiEA5egAXHWIFRahNoNzqBeVqbZZtH77xuqNJlu66TZuLAjKvIJ893Bzx/EZR8QCpEFnThPTU6wyykAqT7WOXUCdWFobPH9RFbXJWmb9pBcKmbEO4y8JAcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707741197; c=relaxed/simple; bh=7MvD/ch+A5tGqG+rlOGbr5Kpr5QHYnQ1tNmpJNxdDFk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uP5W9MJezjfIax+fF335y5RZ30jtfzS1lX2NOdYO8lREqZwhOO+yJdyqobP4doUdvbLZy5PW9cuzps6BC6DvTngWIOOHJrz8S8B7VXLwJFW8C4VO4Ti5xoQpby3W40vS2j2DusONWDASnwGRxFasoQCvFXT6O35HSqz/+yEoSik= 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 1D34911FB; Mon, 12 Feb 2024 04:33:56 -0800 (PST) Received: from pluto.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4E3103F7BD; Mon, 12 Feb 2024 04:33:13 -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 08/11] firmware: arm_scmi: Implement Reset .is_notify_supported callback Date: Mon, 12 Feb 2024 12:32:30 +0000 Message-ID: <20240212123233.1230090-9-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: 1790696554328483073 X-GMAIL-MSGID: 1790696554328483073 Add a preliminary check to verify if Reset-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/reset.c | 37 ++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/arm_scmi/reset.c b/drivers/firmware/arm_scmi/reset.c index 19970d9f9e36..1b318316535e 100644 --- a/drivers/firmware/arm_scmi/reset.c +++ b/drivers/firmware/arm_scmi/reset.c @@ -67,6 +67,7 @@ struct reset_dom_info { struct scmi_reset_info { u32 version; int num_domains; + bool notify_reset_cmd; struct reset_dom_info *dom_info; }; @@ -89,18 +90,24 @@ static int scmi_reset_attributes_get(const struct scmi_protocol_handle *ph, } ph->xops->xfer_put(ph, t); + + if (!ret) + if (!ph->hops->protocol_msg_check(ph, RESET_NOTIFY, NULL)) + pi->notify_reset_cmd = true; + return ret; } static int scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph, - u32 domain, struct reset_dom_info *dom_info, - u32 version) + struct scmi_reset_info *pinfo, + u32 domain, u32 version) { int ret; u32 attributes; struct scmi_xfer *t; struct scmi_msg_resp_reset_domain_attributes *attr; + struct reset_dom_info *dom_info = pinfo->dom_info + domain; ret = ph->xops->xfer_get_init(ph, RESET_DOMAIN_ATTRIBUTES, sizeof(domain), sizeof(*attr), &t); @@ -115,7 +122,9 @@ scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph, attributes = le32_to_cpu(attr->attributes); dom_info->async_reset = SUPPORTS_ASYNC_RESET(attributes); - dom_info->reset_notify = SUPPORTS_NOTIFY_RESET(attributes); + if (pinfo->notify_reset_cmd) + dom_info->reset_notify = + SUPPORTS_NOTIFY_RESET(attributes); dom_info->latency_us = le32_to_cpu(attr->latency); if (dom_info->latency_us == U32_MAX) dom_info->latency_us = 0; @@ -226,6 +235,20 @@ static const struct scmi_reset_proto_ops reset_proto_ops = { .deassert = scmi_reset_domain_deassert, }; +static bool scmi_reset_notify_supported(const struct scmi_protocol_handle *ph, + u8 evt_id, u32 src_id) +{ + struct reset_dom_info *dom; + struct scmi_reset_info *pi = ph->get_priv(ph); + + if (evt_id != SCMI_EVENT_RESET_ISSUED || src_id >= pi->num_domains) + return false; + + dom = pi->dom_info + src_id; + + return dom->reset_notify; +} + static int scmi_reset_notify(const struct scmi_protocol_handle *ph, u32 domain_id, bool enable) { @@ -301,6 +324,7 @@ static const struct scmi_event reset_events[] = { }; static const struct scmi_event_ops reset_event_ops = { + .is_notify_supported = scmi_reset_notify_supported, .get_num_sources = scmi_reset_get_num_sources, .set_notify_enabled = scmi_reset_set_notify_enabled, .fill_custom_report = scmi_reset_fill_custom_report, @@ -339,11 +363,8 @@ static int scmi_reset_protocol_init(const struct scmi_protocol_handle *ph) if (!pinfo->dom_info) return -ENOMEM; - for (domain = 0; domain < pinfo->num_domains; domain++) { - struct reset_dom_info *dom = pinfo->dom_info + domain; - - scmi_reset_domain_attributes_get(ph, domain, dom, version); - } + for (domain = 0; domain < pinfo->num_domains; domain++) + scmi_reset_domain_attributes_get(ph, pinfo, domain, version); pinfo->version = version; return ph->set_priv(ph, pinfo, version);