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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F05B8E7490C for ; Mon, 2 Oct 2023 18:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VjqabDzLKv97BFB96cqlIB0z/ptAB20vXBFoilZsr0w=; b=T26mRSJ+8z5a/n Wv3YyVdk3VduYE8qadcVISLclwhz8BvjxVTrr6lZyoHQijQp/yiVXgOYyeriaoeyjXrY3nsh3fjMJ oSy7H382CQMgQauDEKticGXa7F78hKNN90ICwOdZhDYO1szZK73iFHrpZkTJWSQ3qnVDLfFa7jo8b iBBvj61Oq26Kt9605qrqO0+DBhzBX5uHS7sUoBzMOz/ctR5Ht89pqj8e4Cv/ObvvoCqEOmIcmg34H Bim9YLTyUjZkWqd0RxYaFLYXzpLEXdVHHhtUdtrfCMk50FJsq5siZGObVKWxzz7D6W0hvCt7qilsI XN04TFytpRBlgo3wJ9Jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnNkM-00DDh3-2Y; Mon, 02 Oct 2023 18:34:22 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnNkK-00DDgh-0Q for linux-arm-kernel@lists.infradead.org; Mon, 02 Oct 2023 18:34:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696271658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=moRj567UqOl/iY2WCPLyt7FFc0+jEQjRNpNCUARYnqs=; b=IeeZl2LwznhRp2bDS7Z/Y+mn66IS3Z4e+bKtUN3YZ4Imtgm1jeAy30/gXnXdN4pOx6fCb/ KG8IZCu2xGx6+sUyWaGUB6Ef3UFtgJY8NG8CyqnX66hNVvVK65/jsGWZqke6a/aTleM5FH 0meGpG081DIoe+dzr5MKOLlpUGXXWYw= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-fUrtoV7yORq_PGazuZH_Nw-1; Mon, 02 Oct 2023 14:34:09 -0400 X-MC-Unique: fUrtoV7yORq_PGazuZH_Nw-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-59f67676065so1569197b3.0 for ; Mon, 02 Oct 2023 11:34:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696271649; x=1696876449; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=moRj567UqOl/iY2WCPLyt7FFc0+jEQjRNpNCUARYnqs=; b=JxWwo5tm3DVE5qWbMyNHjLZrXsm4BD2TNjEHZh0AwEv4ulrxOV3Jpy3tSf9YIQa2qp hPeMHuVK4WNwaKxSzl01YjCOdgTtlFBfhBBMKGUD3Eee5Ir9Q03A3CeJATzjiKVJ85Pm 12/t8tBPN1Qe/XS6vEyrzRpcBxT/7tEuNhmiuv3CFMd7CI02sLi8YQfVyLT0z1G5OpQm ztRhlc1uAh3I50uHZAG5Zqrkg3Ig8kOMfrk2+aVeHA3ebt4MIZlxj7N6J705YfzVV2u5 uJsReTUf7jbVAEMtI09lmcSQUHP6zy4ivQpaVp7We+LT5JmQ0SxYV7ibuFQix1kWPlLy 1/1w== X-Gm-Message-State: AOJu0YxuTgg9IO/LPctaNyiNKLfBP8hYFyvmzoBtdh3yGRdLct+My51s TIHBQJuvJu5/Ke2rN/p3bFONxLaJ6rMysIz0Ux0aXQKc6KO/ZhKKVi6WpMmgUY+CBMSYwx67yBd QzqYPkqMzrlqkw3c9QH0lrdTfbg9Z+IGCADE= X-Received: by 2002:a81:7c43:0:b0:58f:c78e:5918 with SMTP id x64-20020a817c43000000b0058fc78e5918mr10407289ywc.52.1696271649276; Mon, 02 Oct 2023 11:34:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6SP8Aiv3+xZec2xqHGrrNExMp/Wx6XTpZH0dl31Z6Rq6TSaKxSXmvluaLgNmK0B792p3syQ== X-Received: by 2002:a81:7c43:0:b0:58f:c78e:5918 with SMTP id x64-20020a817c43000000b0058fc78e5918mr10407270ywc.52.1696271648909; Mon, 02 Oct 2023 11:34:08 -0700 (PDT) Received: from brian-x1 (c-73-214-169-22.hsd1.pa.comcast.net. [73.214.169.22]) by smtp.gmail.com with ESMTPSA id a14-20020a81bb4e000000b00579e5c4982fsm7865199ywl.36.2023.10.02.11.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 11:34:08 -0700 (PDT) Date: Mon, 2 Oct 2023 14:34:06 -0400 From: Brian Masney To: Nikunj Kela Cc: sudeep.holla@arm.com, cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH v4 4/4] firmware: arm_scmi: Add qcom hvc/shmem transport support Message-ID: References: <20230718160833.36397-1-quic_nkela@quicinc.com> <20230911194359.27547-1-quic_nkela@quicinc.com> <20230911194359.27547-5-quic_nkela@quicinc.com> MIME-Version: 1.0 In-Reply-To: <20230911194359.27547-5-quic_nkela@quicinc.com> User-Agent: Mutt/2.2.9 (2022-11-12) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231002_113420_272418_50838A8D X-CRM114-Status: GOOD ( 31.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 11, 2023 at 12:43:59PM -0700, Nikunj Kela wrote: > This change adds the support for SCMI message exchange on Qualcomm > virtual platforms. > > The hypervisor associates an object-id also known as capability-id > with each hvc doorbell object. The capability-id is used to identify the > doorbell from the VM's capability namespace, similar to a file-descriptor. > > The hypervisor, in addition to the function-id, expects the capability-id > to be passed in x1 register when HVC call is invoked. > > The function-id & capability-id are allocated by the hypervisor on bootup > and are stored in the shmem region by the firmware before starting Linux. > > Signed-off-by: Nikunj Kela > --- > drivers/firmware/arm_scmi/driver.c | 1 + > drivers/firmware/arm_scmi/smc.c | 47 ++++++++++++++++++++++++++---- > 2 files changed, 43 insertions(+), 5 deletions(-) > > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c > index 87383c05424b..ea344bc6ae49 100644 > --- a/drivers/firmware/arm_scmi/driver.c > +++ b/drivers/firmware/arm_scmi/driver.c > @@ -2915,6 +2915,7 @@ static const struct of_device_id scmi_of_match[] = { > #ifdef CONFIG_ARM_SCMI_TRANSPORT_SMC > { .compatible = "arm,scmi-smc", .data = &scmi_smc_desc}, > { .compatible = "arm,scmi-smc-param", .data = &scmi_smc_desc}, > + { .compatible = "qcom,scmi-hvc-shmem", .data = &scmi_smc_desc}, > #endif > #ifdef CONFIG_ARM_SCMI_TRANSPORT_VIRTIO > { .compatible = "arm,scmi-virtio", .data = &scmi_virtio_desc}, > diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c > index 0a0b7e401159..94ec07fdc14a 100644 > --- a/drivers/firmware/arm_scmi/smc.c > +++ b/drivers/firmware/arm_scmi/smc.c > @@ -50,6 +50,9 @@ > * @func_id: smc/hvc call function id > * @param_page: 4K page number of the shmem channel > * @param_offset: Offset within the 4K page of the shmem channel > + * @cap_id: hvc doorbell's capability id to be used on Qualcomm virtual > + * platforms > + * @qcom_xport: Flag to indicate the transport on Qualcomm virtual platforms > */ > > struct scmi_smc { > @@ -63,6 +66,8 @@ struct scmi_smc { > u32 func_id; > u32 param_page; > u32 param_offset; > + u64 cap_id; > + bool qcom_xport; > }; [snip] > static irqreturn_t smc_msg_done_isr(int irq, void *data) > @@ -129,6 +134,7 @@ static int smc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev, > struct resource res; > struct device_node *np; > u32 func_id; > + u64 cap_id; > int ret; [snip] > + func_id = readl((void __iomem *)(scmi_info->shmem) + size - 16); > +#ifdef CONFIG_ARM64 > + cap_id = readq((void __iomem *)(scmi_info->shmem) + size - 8); > +#else > + /* capability-id is 32 bit wide on 32bit machines */ > + cap_id = readl((void __iomem *)(scmi_info->shmem) + size - 8); > +#endif The 32 bit case is defined as a u64 in two places above. > + > + /* The func-id & capability-id are kept in last 16 bytes of shmem. > + * +-------+ > + * | | > + * | shmem | > + * | | > + * | | > + * +-------+ <-- (size - 16) > + * | funcId| > + * +-------+ <-- (size - 8) > + * | capId | > + * +-------+ <-- size > + */ Personally I'd add one more space to the right side of the table after funcId. > - arm_smccc_1_1_invoke(scmi_info->func_id, page, offset, 0, 0, 0, 0, 0, > - &res); > + if (scmi_info->qcom_xport) > + arm_smccc_1_1_hvc(scmi_info->func_id, cap_id, 0, 0, 0, 0, 0, 0, > + &res); > + else > + arm_smccc_1_1_invoke(scmi_info->func_id, page, offset, 0, 0, 0, > + 0, 0, &res); Does it make sense to call this variable qcom_xport? Would hvc_xport be a more appropriate name? Brian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel