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 AD2CDC001E0 for ; Thu, 27 Jul 2023 11:27:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4E6048683A; Thu, 27 Jul 2023 13:27:29 +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="VhdIMxIV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6901386842; Thu, 27 Jul 2023 13:27:27 +0200 (CEST) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 A1E3E86834 for ; Thu, 27 Jul 2023 13:27:24 +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=ilias.apalodimas@linaro.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fbd33a57b6so9076905e9.2 for ; Thu, 27 Jul 2023 04:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690457244; x=1691062044; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9g90wWEVVsv94HbGlbH7VX79/JGHLZLeTPAsUiAPp7s=; b=VhdIMxIVN6Ba0hdowNkUIlpCjL6LjzQEQ35Q8qJ1nsKh2e863HsvSrAIQn0u1+/KU5 NAxECEpXuh5+QGhppwNttcA/uRrcmDgXEcnZSnSo7OoZRE73f5NBnakO5WpPgx2e5MDB ZT4m0rFd7XuOpDhmNnIm6qzdLptmaV69UvuO3YAqYAO6KcQq/V/21i/fByoVAc3wvnjg vNCwWtWhDnGScMY0177KGM9dkeoSqOqln4pcopRbEF7u+MeLlY/6aaF29t2hzp6aleRS HM9CtUP+DaXNjkK6WHuqFLBaUyVowvSccMH8kwt8UVKuBQpGy/Wx8yxj1CnaV0cFL4Kl kUbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690457244; x=1691062044; h=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=9g90wWEVVsv94HbGlbH7VX79/JGHLZLeTPAsUiAPp7s=; b=gwpzrYHaUPTS0pL1BQDlvZ6aIaSXhityLOJaI11vIVeOOMcXD7E5v0i4Z1jzKfaSYw 42A7e9KA4mHdew2OOZw/RfyJcWi5JDFvo//9JpYIKdx5AE/neL0swLpoB12DCTyUsO7U bczDBak2Knv4x2/uAFavJIzOSH1MKlaBC65th5zHznrYivBFERJHPDEAfiCUeqlagVtU eiwTPt0f88tn+ta/pQsQGaTBgyHx777ZPv7qi5aMe+GRthNJWXgO+7EvIBCwDgaQFCBs wozd9xczlNrqFX0NMPdq1exOBVH+XGAmLOTGFHAIuXS91TDIZY/UZmR6nJlSnYXLCh4X nwZw== X-Gm-Message-State: ABy/qLbj3qUgLNNqYptfmt3OR0l6Q7DwQjPtdIO4Fp+JM3f+M0/jiXte GzxtGseKzT3F1AI+uaiyZw7fgQ== X-Google-Smtp-Source: APBJJlE7PG6FiHo88cYPt+44u6ZaRiaFEr8pyh2eTEtpAYkz/8C/y5yAblg82BYkq2vxzFTgbuQPxQ== X-Received: by 2002:adf:ef04:0:b0:317:60fc:d3c8 with SMTP id e4-20020adfef04000000b0031760fcd3c8mr1659172wro.71.1690457243768; Thu, 27 Jul 2023 04:27:23 -0700 (PDT) Received: from hades (ppp089210088142.access.hol.gr. [89.210.88.142]) by smtp.gmail.com with ESMTPSA id l18-20020a05600012d200b0031753073abcsm1795729wrx.36.2023.07.27.04.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 04:27:23 -0700 (PDT) Date: Thu, 27 Jul 2023 14:27:21 +0300 From: Ilias Apalodimas To: Abdellatif El Khlifi Cc: trini@konsulko.com, nd@arm.com, u-boot@lists.denx.de, Gowtham Suresh Kumar , Simon Glass , Jens Wiklander Subject: Re: [PATCH v16 09/10] arm_ffa: efi: introduce FF-A MM communication Message-ID: References: <20230725185246.GE3630934@bill-the-cat> <20230726094503.100497-1-abdellatif.elkhlifi@arm.com> <20230726094503.100497-10-abdellatif.elkhlifi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230726094503.100497-10-abdellatif.elkhlifi@arm.com> 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 Hi Abdellatif, [...] > +} > + > +/** > + * get_mm_comms() - detect the available MM transport > + * > + * Make sure the FF-A bus is probed successfully > + * which means FF-A communication with secure world works and ready > + * for use. > + * > + * If FF-A bus is not ready, use OPTEE comms. > + * > + * Return: > + * > + * MM_COMMS_FFA or MM_COMMS_OPTEE > + */ > +static enum mm_comms_select get_mm_comms(void) > +{ > + struct udevice *dev; > + int ret; > + > + ret = uclass_first_device_err(UCLASS_FFA, &dev); > + if (ret) { > + log_err("EFI: Cannot find FF-A bus device, trying Optee comms\n"); This isn't an error. If you mark it as one it will pollute the console every time you try to decide if it's an FFA or an SMC call to op-tee. So either remote this or switch it to log_debug or something. While at it, any reason why we need to keep probing the ffa bus? Can't we just run this once during init? > + return MM_COMMS_OPTEE; > + } > + > + return MM_COMMS_FFA; > +} > + > +/** > + * mm_communicate() - Adjust the communication buffer to the MM SP and send > * it to OP-TEE > * > - * @comm_buf: locally allocted communcation buffer > + * @comm_buf: locally allocated communication buffer > * @dsize: buffer size > + * > + * The SP (also called partition) can be any MM SP such as StandAlonneMM or smm-gateway. > + * The comm_buf format is the same for both partitions. > + * When using the u-boot OP-TEE driver, StandAlonneMM is supported. > + * When using the u-boot FF-A driver, any MM SP is supported. > + * > * Return: status code > */ > static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize) > { > efi_status_t ret; > + enum mm_comms_select mm_comms; > struct efi_mm_communicate_header *mm_hdr; > struct smm_variable_communicate_header *var_hdr; > > @@ -162,7 +404,12 @@ static efi_status_t mm_communicate(u8 *comm_buf, efi_uintn_t dsize) > mm_hdr = (struct efi_mm_communicate_header *)comm_buf; > var_hdr = (struct smm_variable_communicate_header *)mm_hdr->data; > > - ret = optee_mm_communicate(comm_buf, dsize); > + mm_comms = get_mm_comms(); > + if (mm_comms == MM_COMMS_FFA) > + ret = ffa_mm_communicate(comm_buf, dsize); > + else > + ret = optee_mm_communicate(comm_buf, dsize); > + > if (ret != EFI_SUCCESS) { > log_err("%s failed!\n", __func__); > return ret; > @@ -697,7 +944,7 @@ void efi_variables_boot_exit_notify(void) > ret = EFI_NOT_FOUND; > > if (ret != EFI_SUCCESS) > - log_err("Unable to notify StMM for ExitBootServices\n"); > + log_err("Unable to notify the MM partition for ExitBootServices\n"); > free(comm_buf); > > /* > -- > 2.25.1 > Thanks /Ilias