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 48165EB64DC for ; Mon, 3 Jul 2023 09:55:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2E87385CB5; Mon, 3 Jul 2023 11:55:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id C2B3485CB5; Mon, 3 Jul 2023 11:55:25 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 409BA84728 for ; Mon, 3 Jul 2023 11:55:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=abdellatif.elkhlifi@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 A45611FB; Mon, 3 Jul 2023 02:55:54 -0700 (PDT) Received: from e130802.arm.com (unknown [10.57.77.143]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 379353F762; Mon, 3 Jul 2023 02:55:11 -0700 (PDT) Date: Mon, 3 Jul 2023 10:55:07 +0100 From: Abdellatif El Khlifi To: Ilias Apalodimas Cc: nd@arm.com, u-boot@lists.denx.de Subject: Re: [PATCH v13 05/10] arm_ffa: introduce armffa command Message-ID: <20230703095507.GA54322@e130802.arm.com> References: <20230606134856.GA1871110@bill-the-cat> <20230616152817.319869-1-abdellatif.elkhlifi@arm.com> <20230616152817.319869-6-abdellatif.elkhlifi@arm.com> 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 Hi Ilias, On Tue, Jun 20, 2023 at 05:25:51PM +0300, Ilias Apalodimas wrote: > [...] > > +int do_ffa_ping(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) > > +{ > > + struct ffa_send_direct_data msg = { > > + .data0 = 0xaaaaaaaa, > > + .data1 = 0xbbbbbbbb, > > + .data2 = 0xcccccccc, > > + .data3 = 0xdddddddd, > > + .data4 = 0xeeeeeeee, > > + }; > > + u16 part_id; > > + int ret; > > + struct udevice *dev; > > + > > + if (argc != 2) { > > + log_err("Missing argument\n"); > > + return CMD_RET_USAGE; > > + } > > + > > + errno = 0; > > + part_id = strtoul(argv[1], NULL, 16); > > + > > + if (errno) { > > Is errno used in strtoul? Yes, please refer to [1]. [1]: https://man7.org/linux/man-pages/man3/strtoul.3.html > Does FF-A have any limits regarding the partition id? If yes, it would > be saner to check against that. The only value that would be invalid is 0. I'll add a check for that in v14. > > > + log_err("Invalid partition ID\n"); > > + return CMD_RET_USAGE; > > + } > > + > > + ret = ffa_get_dev(&dev); > > + if (ret) > > + return CMD_RET_FAILURE; > > + > > + ret = ffa_sync_send_receive(dev, part_id, &msg, 1); > > + if (!ret) { > > + u8 cnt; > > + > > + log_info("SP response:\n[LSB]\n"); > > + for (cnt = 0; > > + cnt < sizeof(struct ffa_send_direct_data) / sizeof(u64); > > + cnt++) > > + log_info("%llx\n", ((u64 *)&msg)[cnt]); > > I am not sure I understand why we print it like this. We would like to show the data received from secure world and in which order. example: corstone1000# armffa ping 0x8003 SP response: [LSB] fffffffe 0 0 0 0 > > > + return CMD_RET_SUCCESS; > > + } > > + > > + log_err("Sending direct request error (%d)\n", ret); > > + return CMD_RET_FAILURE; > > +} > > + > > +/** > > + *do_ffa_devlist() - implementation of the devlist subcommand > > + * @cmdtp: [in] Command Table > > + * @flag: flags > > + * @argc: number of arguments > > + * @argv: arguments > > + * > > + * Query the device belonging to the UCLASS_FFA > > + * class. > > + * > > + * Return: > > + * > > + * CMD_RET_SUCCESS: on success, otherwise failure > > + */ > > +int do_ffa_devlist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) > > +{ > > + struct udevice *dev; > > + int ret; > > + > > + ret = ffa_get_dev(&dev); > > + if (ret) > > + return CMD_RET_FAILURE; > > + > > + log_info("device name %s, dev %p, driver name %s, ops %p\n", > > + dev->name, > > + (void *)map_to_sysmem(dev), > > + dev->driver->name, > > + (void *)map_to_sysmem(dev->driver->ops)); > > Isn't it more useful to print the physical address map_to_sysmem() retuns? That's what map_to_sysmem() does, it returns a physical address and it's shown in the log. Cheers, Abdellatif