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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 267DCC433E9 for ; Wed, 13 Jan 2021 12:31:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E346D23359 for ; Wed, 13 Jan 2021 12:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725681AbhAMMbs (ORCPT ); Wed, 13 Jan 2021 07:31:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725613AbhAMMbs (ORCPT ); Wed, 13 Jan 2021 07:31:48 -0500 Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E2B6C061795 for ; Wed, 13 Jan 2021 04:31:08 -0800 (PST) Received: by mail-oi1-x22f.google.com with SMTP id p5so1886233oif.7 for ; Wed, 13 Jan 2021 04:31:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L67T/nYKVtEjbbPM5rtLIUM61GgZ56ZxUxoMAvJcZFk=; b=SxNFxWzn8He0hTvgFlvATpTluSyC3LzTIpeB6ST6+9zUhKAb5Nt96WkLqareaKSlzv 57wxPdcXBJuh4bfoqQPLCIFa1un3h0SDbKJ8maadnynJwVZrzNsSlXTbGJxqI0TOrWEC 2cbQXOK3iqx+Gb8+LAs5irToltc7e1UnbxT/hCWFmAXqaVTykvrZK/+n81rBQP/ABmzw 5aJnkmGh1DEMa44+YyG+aDNBAX9C2EUBzHMlnlXdOKpdbFW0iiZ/bKCyH8VTQhw5ovTs PZZDUGgEEIzkJTD/i2m1T/5D8LjkBKqDcrcxcteE1Gh+9Usn4ad0rXoSeAsMMPGgXWif fO+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L67T/nYKVtEjbbPM5rtLIUM61GgZ56ZxUxoMAvJcZFk=; b=amAi7Gj3h5HB3HAVllXya2E+aclD67PfzL6/7fYUTgeSfTJOg7WS9yXz2kWmYuZxMS 3ymb/O8YkwwC4Mv1ZZBZmUdx4BqGhEVIAt/ccTnfiyYld/AZo37En/PU8s5Tj1Pm1cml j3rgWU8xw1xw6GPbHlXf4Kk+2Ix01J3qphe1DJ1Sdc/kiCaQvfMLC8Mj7rVdbFSa9hrE LV1h/sZXmhEP36zAAmZljt327OtNjM3PqSELfxW8J799D1N6vR5tPWReOx6mEwGf5JnN aQgluRHJNmGm5F9zZ7znzC1GJuzXPbqbO8qOTXvDVNUXOYiMd3uiJ8bXSkspRoj9sXCZ GAyw== X-Gm-Message-State: AOAM532jvb5sI3+wOevIpi7GUHWjgRYwmbahg9fbKqeEFqnmSH87jESb W5n19yQ5KKpX25lvfq/jrf/WkqF5n1ksMzzwL47OGmn3DbMj9A== X-Google-Smtp-Source: ABdhPJyjzD9ejtEfz3/C2GI6syeQNvP+mVhqLM4bf9F+B5rFLb6Pdn2RNJXHcZSA36EriqK1fExgZnCGjfiPqvlGZEg= X-Received: by 2002:a54:4711:: with SMTP id k17mr962408oik.149.1610541067605; Wed, 13 Jan 2021 04:31:07 -0800 (PST) MIME-Version: 1.0 References: <20201204121137.2966778-1-sudeep.holla@arm.com> <20201204121137.2966778-7-sudeep.holla@arm.com> <20210113094408.pjkno4nalk5zizxa@bogus> In-Reply-To: <20210113094408.pjkno4nalk5zizxa@bogus> From: Jens Wiklander Date: Wed, 13 Jan 2021 13:30:56 +0100 Message-ID: Subject: Re: [PATCH v3 6/7] firmware: arm_ffa: Setup in-kernel users of FFA partitions To: Sudeep Holla Cc: Linux ARM , Devicetree List , Trilok Soni , arve@android.com, Andrew Walbran , David Hartley , Achin Gupta , Arunachalam Ganapathy Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, Jan 13, 2021 at 10:44 AM Sudeep Holla wrote: [...] > > > > +static int ffa_partition_probe(const char *uuid_str, > > > > + struct ffa_partition_info *buffer) > > > > +{ > > > > + int count; > > > > + uuid_t uuid; > > > > + u32 uuid0_4[4] = { 0 }; > > > > + > > > > + if (uuid_parse(uuid_str, &uuid)) { > > > > + pr_err("invalid uuid (%s)\n", uuid_str); > > > > + return -ENODEV; > > > > + } > > > > + > > > > + export_uuid((u8 *)uuid0_4, &uuid); > > > > + count = __ffa_partition_info_get(uuid0_4[0], uuid0_4[1], uuid0_4[2], > > > > + uuid0_4[3], &buffer); > > Wrong byte order? > > According to section 5.3 of the SMCCC, UUIDs are returned as a single > > 128-bit value using the SMC32 calling convention. This value is mapped > > to argument registers x0-x3 on AArch64 (resp. r0-r3 on AArch32). x0 > > for example shall hold bytes 0 to 3, with byte 0 in the low-order > > bits. > > > > I need to spend some time to understand the concern here. Initially I agreed > with your analysis and then a quick review make be realise it is all OK. > I need to check if my understanding is correct again. I thought I will > take example and check here itself. > > UUID: "fd02c9da-306c-48c7-a49c-bbd827ae86ee" > > UUID[0] UUID[1] UUID[2] UUID[3] (referring uuid0_4 above) > dac902fd c7486c30 d8bb9ca4 ee86ae27 > > It seems correct as per SMCCC convention to me, or am I missing something > obvious ? In this example I'd expect the first register to hold 0xfd02c9da regardless of the byte order of the machine. If there is a different byte order in the receiver it will still be received as 0xfd02c9da. That's how I've understood the specification. Cheers, Jens 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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92BA1C433DB for ; Wed, 13 Jan 2021 12:32:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37A4B23339 for ; Wed, 13 Jan 2021 12:32:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37A4B23339 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7d3NzM6tRo2yuFKaqVVe1WWvlJvdsKvZr7cNtU8TG9w=; b=qNVmcb8K7b3P4s+zK2NHrubXj wX9CZe+TmTkaEfciY4g1zH2vUeCXGFIx7/sFHF++L1bBZAyVI7CzWtxLMHdOyhIRVkyHREOQr4qu8 BLSo5SS1sYhH1/NLkkgwQXzKmFGYiAcYi4E2T1TxXH28sHuDm4rVvpjR3uEjc2U5zw+6AJ6sQ1TOH ADLQri1xvgEwH/xmTrX0RBwe3rystwRblazWqzlw7dRymGf99F5JPJdAl0ken6UGT7s8sncWTBKpU 2dAYGYRdCLGkapU3XHlwt7SgqFddvziWXfvE1zw2YcDpAoZ6LPwh0NJ1oq6v5DLnggwWlrA76vobv xtmp7bukg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzfIu-0005R4-Dx; Wed, 13 Jan 2021 12:31:12 +0000 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzfIr-0005Pz-IA for linux-arm-kernel@lists.infradead.org; Wed, 13 Jan 2021 12:31:10 +0000 Received: by mail-oi1-x229.google.com with SMTP id d189so1857739oig.11 for ; Wed, 13 Jan 2021 04:31:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L67T/nYKVtEjbbPM5rtLIUM61GgZ56ZxUxoMAvJcZFk=; b=SxNFxWzn8He0hTvgFlvATpTluSyC3LzTIpeB6ST6+9zUhKAb5Nt96WkLqareaKSlzv 57wxPdcXBJuh4bfoqQPLCIFa1un3h0SDbKJ8maadnynJwVZrzNsSlXTbGJxqI0TOrWEC 2cbQXOK3iqx+Gb8+LAs5irToltc7e1UnbxT/hCWFmAXqaVTykvrZK/+n81rBQP/ABmzw 5aJnkmGh1DEMa44+YyG+aDNBAX9C2EUBzHMlnlXdOKpdbFW0iiZ/bKCyH8VTQhw5ovTs PZZDUGgEEIzkJTD/i2m1T/5D8LjkBKqDcrcxcteE1Gh+9Usn4ad0rXoSeAsMMPGgXWif fO+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L67T/nYKVtEjbbPM5rtLIUM61GgZ56ZxUxoMAvJcZFk=; b=shQTYXsEjgXcBKMetE1C8alOyJ9G7wodRmwZ9e4TdUqFFUxPeuG/IBenRGZ9QajYwH kiGJYlx2/E0dGQtWOTkDDqsIWU9cApxEaIBIxZZ2idDudOan5RPPppAnZ9K4JUd2vMjI T0L64Q7iVdH5X1Jx9cfaOXHUGgKLyWpiIk8KHxzgZ2Dje4rr7DhQGeLcjTzsRYmRV4U6 JFEd4Eyshq+b/V5lMfcR8I9HM0G7LcrugQ1dolrSLJdL7eTNYvA7xNk9lQZ5ljrmT0yS WksY9Jy5hJIi8o+O1Ki2o9NaI7BASkyJIF67q4jPzVJb9GUTSDl86gKm24ICDKf/HeCb y4gA== X-Gm-Message-State: AOAM533UR3+/e7VIefABqBbNJSZbw7227T/PAe+CXFmZKqDopw7Ovy2x YrvhHMKXeTRz2yNebvlbdZbATUbuaqo5a/LY7SNv0A== X-Google-Smtp-Source: ABdhPJyjzD9ejtEfz3/C2GI6syeQNvP+mVhqLM4bf9F+B5rFLb6Pdn2RNJXHcZSA36EriqK1fExgZnCGjfiPqvlGZEg= X-Received: by 2002:a54:4711:: with SMTP id k17mr962408oik.149.1610541067605; Wed, 13 Jan 2021 04:31:07 -0800 (PST) MIME-Version: 1.0 References: <20201204121137.2966778-1-sudeep.holla@arm.com> <20201204121137.2966778-7-sudeep.holla@arm.com> <20210113094408.pjkno4nalk5zizxa@bogus> In-Reply-To: <20210113094408.pjkno4nalk5zizxa@bogus> From: Jens Wiklander Date: Wed, 13 Jan 2021 13:30:56 +0100 Message-ID: Subject: Re: [PATCH v3 6/7] firmware: arm_ffa: Setup in-kernel users of FFA partitions To: Sudeep Holla X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210113_073109_643902_DC5F1CBA X-CRM114-Status: GOOD ( 17.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Trilok Soni , Devicetree List , David Hartley , Andrew Walbran , Achin Gupta , arve@android.com, Arunachalam Ganapathy , Linux ARM 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 Wed, Jan 13, 2021 at 10:44 AM Sudeep Holla wrote: [...] > > > > +static int ffa_partition_probe(const char *uuid_str, > > > > + struct ffa_partition_info *buffer) > > > > +{ > > > > + int count; > > > > + uuid_t uuid; > > > > + u32 uuid0_4[4] = { 0 }; > > > > + > > > > + if (uuid_parse(uuid_str, &uuid)) { > > > > + pr_err("invalid uuid (%s)\n", uuid_str); > > > > + return -ENODEV; > > > > + } > > > > + > > > > + export_uuid((u8 *)uuid0_4, &uuid); > > > > + count = __ffa_partition_info_get(uuid0_4[0], uuid0_4[1], uuid0_4[2], > > > > + uuid0_4[3], &buffer); > > Wrong byte order? > > According to section 5.3 of the SMCCC, UUIDs are returned as a single > > 128-bit value using the SMC32 calling convention. This value is mapped > > to argument registers x0-x3 on AArch64 (resp. r0-r3 on AArch32). x0 > > for example shall hold bytes 0 to 3, with byte 0 in the low-order > > bits. > > > > I need to spend some time to understand the concern here. Initially I agreed > with your analysis and then a quick review make be realise it is all OK. > I need to check if my understanding is correct again. I thought I will > take example and check here itself. > > UUID: "fd02c9da-306c-48c7-a49c-bbd827ae86ee" > > UUID[0] UUID[1] UUID[2] UUID[3] (referring uuid0_4 above) > dac902fd c7486c30 d8bb9ca4 ee86ae27 > > It seems correct as per SMCCC convention to me, or am I missing something > obvious ? In this example I'd expect the first register to hold 0xfd02c9da regardless of the byte order of the machine. If there is a different byte order in the receiver it will still be received as 0xfd02c9da. That's how I've understood the specification. Cheers, Jens _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel