From mboxrd@z Thu Jan 1 00:00:00 1970 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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EAE70EB64D9 for ; Mon, 3 Jul 2023 00:37:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE299863E2; Mon, 3 Jul 2023 02:37:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kvTREL7B"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E40CB86442; Mon, 3 Jul 2023 02:37:29 +0200 (CEST) Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8EE9586377 for ; Mon, 3 Jul 2023 02:37:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-657c4bcad0bso1009545b3a.1 for ; Sun, 02 Jul 2023 17:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688344645; x=1690936645; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=Xh/HhAO2KSWchU92hlPEFPS8xV+WlkOONButoCI8DAE=; b=kvTREL7BCq7HzkZV0g+qdkjjP1DKEMUClOs8G1D4vDiv329R8Wjg5xzHYO775qFQ4a VQiFNlJvr+SXFtNRVEzET6yHTOd4G02pnlbrvC0neAqXb1wDimgPAFo+g9it1Ve+brKy 4h02H9SZCyyCKwHx+ViJzqC20+uXHIIpsgYoxEu7WIxMp539NZDpjh6dODzKSbbLBqDa Uv34K0/QkJG0yVpT5FTZ93/X0YOtZkCwWlohJFpBoO3H7aO6RzI0bkph8S/9WE8g6Wof FfODd8fgn1BDIUNkNETL4Kp5W8kdXRLloxjNR1BQ8sT+KC+7mov0TScdNq2C8VdaZwra D4uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688344645; x=1690936645; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Xh/HhAO2KSWchU92hlPEFPS8xV+WlkOONButoCI8DAE=; b=B1YLQZWVqZ93vTUTvjZoIUOnuDebxuwG1ei+3ObBd/VAdJyxO0NVB9ZXuvHllwZWZr O4Lb7XGHzldiDsVUwYoSKhV7bHoGnp/B611zuiHrU3B/s9oE6zHtIyVh2w/Xji9tsoUS bNF9lw5NmA1emP2snriAARL1wn/2LKEX364muoHeeKJrkTie2T9gC3Ik+nuer1oIlgpn xrvDLSXglOMvhMUbAtjYdeVBxbgIdz1mH8rnaoo5tRSxGArWgf6UtL7vHtOcEcXSickq 9skZwkO1dpp3k8jWkeAqFUN/c7XsG8Vfaky+u5fn8rOY19xBQklliM3kNUPRVSTK/WUz 8jNg== X-Gm-Message-State: AC+VfDz0NS7S9kBi0aNgHL3FNm76tq1LLmxRUUNCFnwRSPEH7F52Z0xb 5HY7L8vEZ79qs+znc/7ng4Yg/Q== X-Google-Smtp-Source: ACHHUZ5J7UKjY1bXTtRz5YJpt8Kv5uuN4s2MHhHXsKc/OuyibxFNPnOMVhbdm8WJh/jM5BMOaO7J+A== X-Received: by 2002:a05:6a20:1446:b0:111:ee3b:59a7 with SMTP id a6-20020a056a20144600b00111ee3b59a7mr13002353pzi.5.1688344644721; Sun, 02 Jul 2023 17:37:24 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:b349:4abf:f4cb:7486]) by smtp.gmail.com with ESMTPSA id t16-20020a170902e85000b001a980a23804sm9579617plg.4.2023.07.02.17.37.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jul 2023 17:37:23 -0700 (PDT) Date: Mon, 3 Jul 2023 09:37:20 +0900 From: AKASHI Takahiro To: Simon Glass Cc: trini@konsulko.com, etienne.carriere@st.com, u-boot@lists.denx.de Subject: Re: [PATCH 01/10] firmware: scmi: implement SCMI base protocol Message-ID: Mail-Followup-To: AKASHI Takahiro , Simon Glass , trini@konsulko.com, etienne.carriere@st.com, u-boot@lists.denx.de References: <20230628004841.21774-1-takahiro.akashi@linaro.org> <20230628004841.21774-2-takahiro.akashi@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On Thu, Jun 29, 2023 at 08:09:45PM +0100, Simon Glass wrote: > Hi AKASHI, > > On Wed, 28 Jun 2023 at 01:49, AKASHI Takahiro > wrote: > > > > SCMI base protocol is mandatory according to the SCMI specification. > > > > With this patch, SCMI base protocol can be accessed via SCMI transport > > layers. All the commands, except SCMI_BASE_NOTIFY_ERRORS, are supported. > > This is because U-Boot doesn't support interrupts and the current transport > > layers are not able to handle asynchronous messages properly. > > > > Signed-off-by: AKASHI Takahiro > > --- > > drivers/firmware/scmi/Makefile | 1 + > > drivers/firmware/scmi/base.c | 517 +++++++++++++++++++++++++++++++++ > > include/dm/uclass-id.h | 1 + > > include/scmi_protocols.h | 201 ++++++++++++- > > 4 files changed, 718 insertions(+), 2 deletions(-) > > create mode 100644 drivers/firmware/scmi/base.c > > > > diff --git a/drivers/firmware/scmi/Makefile b/drivers/firmware/scmi/Makefile > > index b2ff483c75a1..1a23d4981709 100644 > > --- a/drivers/firmware/scmi/Makefile > > +++ b/drivers/firmware/scmi/Makefile > > @@ -1,4 +1,5 @@ > > obj-y += scmi_agent-uclass.o > > +obj-y += base.o > > obj-y += smt.o > > obj-$(CONFIG_SCMI_AGENT_SMCCC) += smccc_agent.o > > obj-$(CONFIG_SCMI_AGENT_MAILBOX) += mailbox_agent.o > > [..] > > > diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h > > index 307ad6931ca7..f7a110852321 100644 > > --- a/include/dm/uclass-id.h > > +++ b/include/dm/uclass-id.h > > @@ -116,6 +116,7 @@ enum uclass_id { > > UCLASS_RNG, /* Random Number Generator */ > > UCLASS_RTC, /* Real time clock device */ > > UCLASS_SCMI_AGENT, /* Interface with an SCMI server */ > > + UCLASS_SCMI_BASE, /* Interface for SCMI Base protocol */ > > UCLASS_SCSI, /* SCSI device */ > > UCLASS_SERIAL, /* Serial UART */ > > UCLASS_SIMPLE_BUS, /* Bus with child devices */ > > diff --git a/include/scmi_protocols.h b/include/scmi_protocols.h > > index a220cb2a91ad..769041654534 100644 > > --- a/include/scmi_protocols.h > > +++ b/include/scmi_protocols.h > > @@ -15,6 +15,8 @@ > > * https://developer.arm.com/docs/den0056/b > > */ > > > > +#define SCMI_BASE_NAME_LENGTH_MAX 16 > > + > > enum scmi_std_protocol { > > SCMI_PROTOCOL_ID_BASE = 0x10, > > SCMI_PROTOCOL_ID_POWER_DOMAIN = 0x11, > > @@ -41,12 +43,207 @@ enum scmi_status_code { > > }; > > > > /* > > - * Generic message IDs > > + * SCMI Base Protocol > > */ > > -enum scmi_discovery_id { > > +#define SCMI_BASE_PROTOCOL_VERSION 0x20000 > > + > > +enum scmi_base_message_id { > > SCMI_PROTOCOL_VERSION = 0x0, > > SCMI_PROTOCOL_ATTRIBUTES = 0x1, > > SCMI_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2, > > + SCMI_BASE_DISCOVER_VENDOR = 0x3, > > + SCMI_BASE_DISCOVER_SUB_VENDOR = 0x4, > > + SCMI_BASE_DISCOVER_IMPL_VERSION = 0x5, > > + SCMI_BASE_DISCOVER_LIST_PROTOCOLS = 0x6, > > + SCMI_BASE_DISCOVER_AGENT = 0x7, > > + SCMI_BASE_NOTIFY_ERRORS = 0x8, > > + SCMI_BASE_SET_DEVICE_PERMISSIONS = 0x9, > > + SCMI_BASE_SET_PROTOCOL_PERMISSIONS = 0xa, > > + SCMI_BASE_RESET_AGENT_CONFIGURATION = 0xb, > > +}; > > + > > +/** > > + * struct scmi_protocol_version_out - Response for SCMI_PROTOCOL_VERSION > > + * command > > + * @status: SCMI command status > > + * @version: Protocol version > > + */ > > +struct scmi_protocol_version_out { > > + s32 status; > > + u32 version; > > +}; > > + > > +/** > > + * struct scmi_protocol_attrs_out - Response for SCMI_PROTOCOL_ATTRIBUTES > > + * command > > + * @status: SCMI command status > > + * @attributes: Protocol attributes or implementation details > > + */ > > +struct scmi_protocol_attrs_out { > > + s32 status; > > + u32 attributes; > > +}; > > + > > +#define SCMI_PROTOCOL_ATTRS_NUM_AGENTS(attributes) \ > > + (((attributes) & GENMASK(15, 8)) >> 8) > > +#define SCMI_PROTOCOL_ATTRS_NUM_PROTOCOLS(attributes) \ > > + ((attributes) & GENMASK(7, 0)) > > + > > +/** > > + * struct scmi_protocol_msg_attrs_out - Response for > > + * SCMI_PROTOCOL_MESSAGE_ATTRIBUTES command > > + * @status: SCMI command status > > + * @attributes: Message-specific attributes > > + */ > > +struct scmi_protocol_msg_attrs_out { > > + s32 status; > > + u32 attributes; > > +}; > > + > > +/** > > + * struct scmi_base_discover_vendor_out - Response for > > + * SCMI_BASE_DISCOVER_VENDOR or > > + * SCMI_BASE_DISCOVER_SUB_VENDOR command > > + * @status: SCMI command status > > + * @vendor_identifier: Identifier of vendor or sub-vendor in string > > + */ > > +struct scmi_base_discover_vendor_out { > > + s32 status; > > + u8 vendor_identifier[SCMI_BASE_NAME_LENGTH_MAX]; > > +}; > > + > > +/** > > + * struct scmi_base_discover_impl_version_out - Response for > > + * SCMI_BASE_DISCOVER_IMPL_VERSION command > > + * @status: SCMI command status > > + * @impl_version: Vendor-specific implementation version > > + */ > > +struct scmi_base_discover_impl_version_out { > > + s32 status; > > + u32 impl_version; > > +}; > > + > > +/** > > + * struct scmi_base_discover_list_protocols_out - Response for > > + * SCMI_BASE_DISCOVER_LIST_PROTOCOLS command > > + * @status: SCMI command status > > + * @num_protocols: Number of protocols in @protocol > > + * @protocols: Array of packed protocol ID's > > + */ > > +struct scmi_base_discover_list_protocols_out { > > + s32 status; > > + u32 num_protocols; > > + u32 protocols[3]; > > +}; > > + > > +/** > > + * struct scmi_base_discover_agent_out - Response for > > + * SCMI_BASE_DISCOVER_AGENT command > > + * @status: SCMI command status > > + * @agent_id: Identifier of agent > > + * @name: Name of agent in string > > + */ > > +struct scmi_base_discover_agent_out { > > + s32 status; > > + u32 agent_id; > > + u8 name[SCMI_BASE_NAME_LENGTH_MAX]; > > +}; > > + > > +#define SCMI_BASE_NOTIFY_ERRORS_ENABLE BIT(0) > > + > > +/** > > + * struct scmi_base_set_device_permissions_in - Parameters for > > + * SCMI_BASE_SET_DEVICE_PERMISSIONS command > > + * @agent_id: Identifier of agent > > + * @device_id: Identifier of device > > + * @flags: A set of flags > > + */ > > +struct scmi_base_set_device_permissions_in { > > + u32 agent_id; > > + u32 device_id; > > + u32 flags; > > +}; > > + > > +#define SCMI_BASE_SET_DEVICE_PERMISSIONS_ACCESS BIT(0) > > + > > +/** > > + * struct scmi_base_set_protocol_permissions_in - Parameters for > > + * SCMI_BASE_SET_PROTOCOL_PERMISSIONS command > > + * @agent_id: Identifier of agent > > + * @device_id: Identifier of device > > + * @command_id: Identifier of command > > + * @flags: A set of flags > > + */ > > +struct scmi_base_set_protocol_permissions_in { > > + u32 agent_id; > > + u32 device_id; > > + u32 command_id; > > + u32 flags; > > +}; > > + > > +#define SCMI_BASE_SET_PROTOCOL_PERMISSIONS_COMMAND GENMASK(7, 0) > > +#define SCMI_BASE_SET_PROTOCOL_PERMISSIONS_ACCESS BIT(0) > > + > > +/** > > + * struct scmi_base_reset_agent_configuration_in - Parameters for > > + * SCMI_BASE_RESET_AGENT_CONFIGURATION command > > + * @agent_id: Identifier of agent > > + * @flags: A set of flags > > + */ > > +struct scmi_base_reset_agent_configuration_in { > > + u32 agent_id; > > + u32 flags; > > +}; > > + > > +#define SCMI_BASE_RESET_ALL_ACCESS_PERMISSIONS BIT(0) > > + > > +/** > > + * struct scmi_base_ops - SCMI base protocol interfaces > > + * @protocol_version: Function pointer for > > + * PROTOCOL_VERSION > > + * @protocol_attrs: Function pointer for > > + * PROTOCOL_ATTRIBUTES > > + * @protocol_message_attrs: Function pointer for > > + * PROTOCOL_MESSAGE_ATTRIBUTES > > + * @base_discover_vendor: Function pointer for > > + * BASE_DISCOVER_VENDOR > > + * @base_discover_sub_vendor: Function pointer for > > + * BASE_DISCOVER_SUB_VENDOR > > + * @base_discover_impl_version: Function pointer for > > + * BASE_DISCOVER_IMPLEMENTATION_VERSION > > + * @base_discover_list_protocols: Function pointer for > > + * BASE_DISCOVER_LIST_PROTOCOLS > > + * @base_discover_agent: Function pointer for > > + * BASE_DISCOVER_AGENT > > + * @base_notify_errors: Function pointer for > > + * BASE_NOTIFY_ERRORS > > + * @base_set_device_permissions: Function pointer for > > + * BASE_SET_DEVICE_PROTOCOLS > > + * @base_set_protocol_permissions: Function pointer for > > + * BASE_SET_PROTOCOL_PERMISSIONS > > + * @base_reset_agent_configuration: Function pointer for > > + * BASE_RESET_AGENT_CONFIGURATION > > + */ > > +struct scmi_base_ops { > > + int (*protocol_version)(struct udevice *dev, u32 *version); > > + int (*protocol_attrs)(struct udevice *dev, u32 *num_agents, > > + u32 *num_protocols); > > + int (*protocol_message_attrs)(struct udevice *dev, u32 message_id, > > + u32 *attributes); > > + int (*base_discover_vendor)(struct udevice *dev, u8 *vendor); > > + int (*base_discover_sub_vendor)(struct udevice *dev, u8 *sub_vendor); > > + int (*base_discover_impl_version)(struct udevice *dev, u32 *impl_version); > > + int (*base_discover_list_protocols)(struct udevice *dev, u8 **protocols); > > + int (*base_discover_agent)(struct udevice *dev, u32 agent_id, > > + u32 *ret_agent_id, u8 *name); > > + int (*base_notify_errors)(struct udevice *dev, u32 enable); > > + int (*base_set_device_permissions)(struct udevice *dev, u32 agent_id, > > + u32 device_id, u32 flags); > > + int (*base_set_protocol_permissions)(struct udevice *dev, u32 agent_id, > > + u32 device_id, u32 command_id, > > + u32 flags); > > + int (*base_reset_agent_configuration)(struct udevice *dev, u32 agent_id, > > + u32 flags); > > Please can you add full function comments for each of these? Yes, I will. Thanks, -Takahiro Akashi > > }; > > > > /* > > -- > > 2.41.0 > > > > Regards, > Simon