Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp732118pxj; Fri, 11 Jun 2021 10:02:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZEUdsdwTOcVPHiHbpWegm3Q1i0APYb1y1FN4AEysbIWBJz+l/AF2cZOHcqcDEpqzdLO/G X-Received: by 2002:a17:906:a850:: with SMTP id dx16mr4557087ejb.333.1623430970734; Fri, 11 Jun 2021 10:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623430970; cv=none; d=google.com; s=arc-20160816; b=cDxYQLJc8QfF3PNYWgBA9PvmApZcBoa935L4is9ZcWNcucIRrvLSrmUJ2/nRxnxwOO qMUKlrQV7szisIm+PJbvsc9xnguhCFUhFHKn/Qi9Qx20Oi7n09xNa5niMiAtKdcAH4zW K02xxEXPVGqlgiRYTtMe33GwmxXZV6cYLBPwAU9T6OjUXMota+xQXaQeNCJCI0e56j3J zTm/4QgUldZ3HTKhjB1B1kHNZP41aVyuj/8FMg0GSyG+xiZPu6j6Ja7bg1qBCHb0HARk KyzLXfbU8T7vi7tGqRerQodmHiRFVr+vhRZJDqettH3ljyM+1LM75eOr8M/NCtwPG91H 9wvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=iNlTbnJ2IuEYsIbwS5fre9Ykh2bsEj5y78p9H/N64T0=; b=dMyqy5n+EhQoAzYN7RRMbWuGc+DsYS6j3gYY0cWyYAgEIatp3QPys7SYMxX+DUN4NV HVnoGMnJ2n+o/bDOgC1ut89GUjq9to2S+uRvy9i+f+GEZ6nhrqtuJqeEfiD8BTNvoRcx GJK2U4O+7iZT6rEbm6HOKxNwqOSSX66QHyV61Is3TYeysODaUvBrJ3WZhQmA3UaWNprn sYjUCVoO8zMyijq+aOhzoIsVF6pxTUIeIm5G1I09wu6bEmpN7EYpsaJ99DD/Tzp0yY+t uD6IsxSkAi8D+zzXVGCj5QPDj8dZd+aY6J/ZsURRJeDuPDbsdzwiivYbznffNWJMf8mp wcHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si5469337edu.447.2021.06.11.10.02.20; Fri, 11 Jun 2021 10:02:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231195AbhFKRC3 (ORCPT + 99 others); Fri, 11 Jun 2021 13:02:29 -0400 Received: from foss.arm.com ([217.140.110.172]:35520 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230487AbhFKRC1 (ORCPT ); Fri, 11 Jun 2021 13:02:27 -0400 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 14B8F143D; Fri, 11 Jun 2021 10:00:29 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AD1EA3F719; Fri, 11 Jun 2021 10:00:25 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, virtualization@lists.linux-foundation.org, virtio-dev@lists.oasis-open.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, cristian.marussi@arm.com, igor.skalkin@opensynergy.com, peter.hilber@opensynergy.com, alex.bennee@linaro.org, jean-philippe@linaro.org, mikhail.golubev@opensynergy.com, anton.yakovlev@opensynergy.com, Vasyl.Vavrychuk@opensynergy.com, Andriy.Tryshnivskyy@opensynergy.com Subject: [PATCH v4 02/16] firmware: arm_scmi: Add support for type handling in common functions Date: Fri, 11 Jun 2021 17:59:23 +0100 Message-Id: <20210611165937.701-3-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210611165937.701-1-cristian.marussi@arm.com> References: <20210611165937.701-1-cristian.marussi@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add SCMI type handling to pack/unpack_scmi_header common helper functions. Signed-off-by: Cristian Marussi --- Needed later in the series to support delegated xfers --- drivers/firmware/arm_scmi/common.h | 6 +++++- drivers/firmware/arm_scmi/driver.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 8685619d38f9..7c2b9fd7e929 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -70,6 +70,7 @@ struct scmi_msg_resp_prot_version { * * @id: The identifier of the message being sent * @protocol_id: The identifier of the protocol used to send @id message + * @type: The SCMI type for this message * @seq: The token to identify the message. When a message returns, the * platform returns the whole message header unmodified including the * token @@ -80,6 +81,7 @@ struct scmi_msg_resp_prot_version { struct scmi_msg_hdr { u8 id; u8 protocol_id; + u8 type; u16 seq; u32 status; bool poll_completion; @@ -89,13 +91,14 @@ struct scmi_msg_hdr { * pack_scmi_header() - packs and returns 32-bit header * * @hdr: pointer to header containing all the information on message id, - * protocol id and sequence id. + * protocol id, sequence id and type. * * Return: 32-bit packed message header to be sent to the platform. */ static inline u32 pack_scmi_header(struct scmi_msg_hdr *hdr) { return FIELD_PREP(MSG_ID_MASK, hdr->id) | + FIELD_PREP(MSG_TYPE_MASK, hdr->type) | FIELD_PREP(MSG_TOKEN_ID_MASK, hdr->seq) | FIELD_PREP(MSG_PROTOCOL_ID_MASK, hdr->protocol_id); } @@ -110,6 +113,7 @@ static inline void unpack_scmi_header(u32 msg_hdr, struct scmi_msg_hdr *hdr) { hdr->id = MSG_XTRACT_ID(msg_hdr); hdr->protocol_id = MSG_XTRACT_PROT_ID(msg_hdr); + hdr->type = MSG_XTRACT_TYPE(msg_hdr); } /** diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 6713b259f1e6..f15d75af87ea 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -565,6 +565,7 @@ static int xfer_get_init(const struct scmi_protocol_handle *ph, xfer->tx.len = tx_size; xfer->rx.len = rx_size ? : info->desc->max_msg_size; + xfer->hdr.type = MSG_TYPE_COMMAND; xfer->hdr.id = msg_id; xfer->hdr.poll_completion = false; -- 2.17.1