Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2588195pxb; Mon, 19 Apr 2021 09:02:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySmYiBxQkY/gAgfjHLBVucssMMMjIDrrfnc9Lif1pvNbnDs2rhZ1kYbH499J8i3iRD7po5 X-Received: by 2002:a17:906:d110:: with SMTP id b16mr22858394ejz.146.1618848172799; Mon, 19 Apr 2021 09:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618848172; cv=none; d=google.com; s=arc-20160816; b=c36OKPrePO1CpUkce+vBVKz5CCuSbT6nfpIjQqVOFrEx0lsdQ1znhWrd/zXcKqcRpv F3BER/FwuqbVymQAUwG1ABmCGShyx3HclKf5PbyhJZOHMCgklQXpaLuTvThymqVbrWWA i/YNT5eYf4UNo1HnK29WFzDfELFgceRYyXAxDHTVNYkSU//CBZmClo3LAd8NomHvD6kr YpZBtxouAwbtvEqiAExPh1rrb9sWeOXirdBl3oRPXu2p9CqI9JoYMlGfSg8mnrJzdUMp mQ8veL0Fn8wiVV4Bh6a/WuhoAaa1TXvCfpR5bn4UdCeJuaD3jl6Pvk+Ze2DUQnkVTo/T O3SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=NEYzb8rRhegA9r1XKxsspQ9rFJwcyg5L2UyEin8OE4c=; b=GeK8uXYEQO6vKpDgTK1oW9Kxx2hg/G/3YWAMdxQjfaK1YBXnalASG6yG5dZF12eZCg Z259X5WJmxsSi24MeB6eOdCMINbT7ewuV+Gw1oPh21w93CtBvZLd0+gISF2IaXEBWlrl vnVajBWhM+jgXnnMyhXOBQmpsn9SOsvuWY3uBSRJnWUVoy0b32eDmvQUZD0bRvDEKNZo mMs3c/2TPB4RnkLW1PPTwgicC5hlBXoTcFySi2EgywMQSY7hznmsovVWYiRy63OF648A bZumYdBQL//g4K+e8HUvcdBmYdrsIKDKjUCeOgPd/vZsazgI4fYoyYA3AaxGmhrVemsB qoHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ItJ0Wr2B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o19si1879883edc.529.2021.04.19.09.02.24; Mon, 19 Apr 2021 09:02:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ItJ0Wr2B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240376AbhDSNmI (ORCPT + 99 others); Mon, 19 Apr 2021 09:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243529AbhDSNlS (ORCPT ); Mon, 19 Apr 2021 09:41:18 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066E9C06174A for ; Mon, 19 Apr 2021 06:40:46 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id u15so9163497plf.10 for ; Mon, 19 Apr 2021 06:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NEYzb8rRhegA9r1XKxsspQ9rFJwcyg5L2UyEin8OE4c=; b=ItJ0Wr2Brx0XkXV8dYQOcWQxMHetwGHfb/5o+qpiB7SF+7lm2x3vL4V6R4fTMh23yQ 62s+l5tK871iHS9uUOwkoi+kQ8qbyNvnd5rTw33FZensKVWia7yCBBsFryePIydDcq4N XwLg/ka9XmJ0h4JZj4AZnlVbT5I6LB5JgLNcAG5xlqIWrPA7Zckg5F6SC/3KzISv7meZ IdGU1aK5kTjU1QQdZcLMXfmwmprKhr8eZvCi8QTRnsCaiYgiLur1Rg0DV+m9WJB0mk1c hHwEVcKl4IgllOv8UxVkL48vKyDopRblpoEjhRwSL5nO4XqqyS+8WqC9YOHnzpqic/JR iwUA== 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=NEYzb8rRhegA9r1XKxsspQ9rFJwcyg5L2UyEin8OE4c=; b=DCrd1d6iCSYcmBoUKFZMCFJCdu2btXrL2UcOQjEs5i4FtoEHxdIIrU9ZXfyFeGICms kZtsIKI2RP+aezeo0WKOfSleNEU9ZA2bJdA7BoYMCsybJG2qsOu+xDl9luIiR1IY3f2R o+b+xqQWmV7zxrDATvgOJAeJXUMcO9xyTLjnPaMSwOcoIml7zeKmjVdMFSJxY+KuEkkk hCtBiQKChuj8fNNYG5YrN1uHqhCC0MK8vegcDVAkOxmXXXkczguj3Q9vfCnkbxkHhLpB wTLi2B8xQd+lKi7MVzV7/LC78AYwxK8XAuBVaZjDp4h5fLSh+V9Q3lTdDdprYx5tv+Qh Ck7Q== X-Gm-Message-State: AOAM5328Qj0lk/l3QbQC6FLUdJcAFCTxMJqBYO4dflF3gb0Oe+Gphm2F jIASu8/GQYTcJqhsL92NnlN3arMRvUzJcEJNdFD4Z2P5a07AMA== X-Received: by 2002:a17:902:a406:b029:e6:78c4:71c8 with SMTP id p6-20020a170902a406b02900e678c471c8mr22979199plq.17.1618839645839; Mon, 19 Apr 2021 06:40:45 -0700 (PDT) MIME-Version: 1.0 References: <20210415145857.34183-1-andriy.shevchenko@linux.intel.com> In-Reply-To: From: Andy Shevchenko Date: Mon, 19 Apr 2021 16:40:29 +0300 Message-ID: Subject: Re: [PATCH v1 1/1] tee: optee: Provide special parameter field for UUID values To: Jens Wiklander Cc: Andy Shevchenko , OP-TEE TrustedFirmware , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 19, 2021 at 4:30 PM Jens Wiklander wrote: > On Mon, Apr 19, 2021 at 2:01 PM Andy Shevchenko > wrote: > > > > On Mon, Apr 19, 2021 at 01:35:51PM +0200, Jens Wiklander wrote: > > > On Thu, Apr 15, 2021 at 4:58 PM Andy Shevchenko > > > wrote: > > > > Thanks for review, my answer below. > > > > > > struct optee_msg_param_tmem tmem; > > > > struct optee_msg_param_rmem rmem; > > > > struct optee_msg_param_value value; > > > > + uuid_t uuid; > > > > > > It's nice to get rid of the cast above, but I'm not that keen on the > > > change in this struct. This file defines the ABI towards Secure world > > > and adding dependencies on external complex types is a larger problem > > > than the cast above in my opinion. > > > > I understand. > > > > So, the cast is simply wrong there. Can you add a comment above that cast to > > explain that and make it is marked as FIXME? Because there is no guarantee that > > internal Linux types can be 1:1 mapped to the ABI of something. > > We might as well fix it directly instead. How about storing the > intermediate result in a proper uuid_t and then export it as: > export_uuid((u8 *)&msg_arg->params[1].u.uuid, &myuuid); Still a casting here. With u64 members you have a (potential) endianness issue (consider BE-32 platform). Also you never know that a b c translates properly to byte array. I would rather see a custom function optee_import_uuid(param, uuid_t *uuid) { u8 uuid_raw[UUID_SIZE]; put_unaligned_le64(&uuid_raw[0], param.a); // not sure about endianness put_unaligned_le64(&uuid_raw[0], param.b); // ditto import_uuid(); } > > What you need, perhaps, is a middle layer function that will copy u64 data > > to uuid_t or so. Also, u64 is not an ABI type, why the respective __uXX > > variants are not in use? > > Does it make any difference? The file isn't shared with user space and > I need to sync the file manually anyway since OP-TEE doesn't have the > same include files. Yes. It gives a hint that these are ABI (that's why I felt free to add a member to the union. I have no idea that's an ABI). Optionally a comment suggesting that. Besides the above mentioned issues. -- With Best Regards, Andy Shevchenko