Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1423870ybt; Thu, 25 Jun 2020 05:55:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylP9OPFYfkrL+U1FdZSxk+OAyXOBxD62uYqorRmbyrGNJVVSWsSh79NAcYBjHqLrPqoRoR X-Received: by 2002:a17:906:d9c4:: with SMTP id qk4mr2970194ejb.100.1593089748870; Thu, 25 Jun 2020 05:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593089748; cv=none; d=google.com; s=arc-20160816; b=baBZ9vZdVJjirlMMtqCGe9u9vuu/MNm/Xxu+paquet7S8CCsTUSBtJGlIPUtG10ksv RNOH6/Go5CfJgNks+nbzV2pgwTwdemrJdNhv1/7uf+e3vb46rchEUj/naFDdUYTC+p0R kIuz/IuxrFcv+nVx34Tv4Fk80MnBEOsrH4U8wTaggn+P0XpQYxljWRheGXe0ox0mjyXO w3saSsMtTCYudBME1GodHY0/nFCejm8ndQf+EfeN3XogGT57HF/VcgmhtvAIkXw3VDWW 9Haj8Lu1yuBsYvD/IhEJr9Xxu/05dSrqPtKwMudMgNu+Sd7p+u5J54MRbbSjcA/fD344 k9Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=yLpKlluK0xCTBNxUab3MgIjNtLTLogp4EiKdanHoPqo=; b=KOR+ydOTXoKKS3qSMJN8XRYmRUNNB/2v/SSFxAuTCcX6jTwjdk0U6bbgi58cZORSZO gZC9mZ79P0jNvqUJI/2e8udV2gNRBKlmVp3XKZVKDkl5JH+ehle14pLodSr1vu3u+o+l EbEMXVFsbgSxT6LMAbsXSL5hS8myQYCVZf2U4pjVydDn9HvT5Q4dHKyndZDPapJ+3rj/ ZAYhnFJc4l+jyBU+K+ti8exXk/WQB4OTSrQuoJfLZGWUQNz3V7350f90m4OxzrlOD5GR GSghb1q/DC4nVCbt7drPDUnvoK9Pk2VWe7p9MNXzE+dEfLkEaWR+GouW4fq6GIwQSFrT jKZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LaVKGeIp; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lj9si8580838ejb.507.2020.06.25.05.55.25; Thu, 25 Jun 2020 05:55:48 -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=@linaro.org header.s=google header.b=LaVKGeIp; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404799AbgFYMwD (ORCPT + 99 others); Thu, 25 Jun 2020 08:52:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404650AbgFYMwC (ORCPT ); Thu, 25 Jun 2020 08:52:02 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A209C061573 for ; Thu, 25 Jun 2020 05:52:02 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id w2so2440420pgg.10 for ; Thu, 25 Jun 2020 05:52:02 -0700 (PDT) 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=yLpKlluK0xCTBNxUab3MgIjNtLTLogp4EiKdanHoPqo=; b=LaVKGeIpgQB6AcB2k7QauLya2rwFxGE0cxGYK8YnyRUcSnTUIt9ac3qq/6Vs8rJZl4 pH5/eDXD0qr681ZEAwW1NJIIqUaRyklOsZLzlXoMwQTj6GhuLgHr8/YBlzaB8TmVYxKB AFXKuayvQCPMDgCsswT+soxzKkmojkzz+vK5gy6LuH6dd8wlqh5rvcNWwSCRqAiKyVGp K2mxL62ylVzJxdCTpNvTfiyz1qOQLGNZfUyT3G7WEXbAxTaO811xprhOBLBYff1nydql pxdcd5uSzzg3CtvXyCISy69c+faxyW3QnPOKtIG6vspEUxdbMegp5QoKYj+mrOA4IEgi C6PQ== 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=yLpKlluK0xCTBNxUab3MgIjNtLTLogp4EiKdanHoPqo=; b=pCkuktSKRGqotQAMs5w4q9iz38SzGIdMzaMRJX9Hxyv70MpoJofGg5+aQ9CPIJEeMa b2ZAxfu5VfLhAiXYgOa6r8ChyxzoTB8nAlFyq7VvcqsPJ0RveC0w8IOeyF6d2fRu0IM6 mTSQe7A7uyxRM16AvXKcKEFCPqIX7nKm56jmYQOoAg8Eq4mMERWZoDtcEVkf75koz5An 9ia1bh0N+8Sf6xiYjj0AlZ0xeq8aG9ftOhJjG8vpLhZ2Er6A4acusasVrhbXrToMn1fu 5+lJtNg8jD9oG/QBXok6mVYG37H+j+Ppm4GLxQE7kB2Tm183fBXKwJaBwQYcydbdgLTw 6Iww== X-Gm-Message-State: AOAM530I49x6KtYpi6x4L2MS1j1p9i8HJHXq4tyDU2vcqFlhbmGx4GUZ nNjgOYt4Qw8tZX1b786fc0diM2WCQBVrRDKTmavDDKfCEB0= X-Received: by 2002:aa7:9910:: with SMTP id z16mr32601525pff.53.1593089521686; Thu, 25 Jun 2020 05:52:01 -0700 (PDT) MIME-Version: 1.0 References: <20200604175851.758-1-maxim.uvarov@linaro.org> <20200604175851.758-2-maxim.uvarov@linaro.org> <1592507935.15159.5.camel@HansenPartnership.com> <1592578844.4369.5.camel@HansenPartnership.com> <1593012069.28403.11.camel@HansenPartnership.com> <3aa8705a-0342-25ea-00c4-d5370d91ddb4@forissier.org> In-Reply-To: <3aa8705a-0342-25ea-00c4-d5370d91ddb4@forissier.org> From: Maxim Uvarov Date: Thu, 25 Jun 2020 15:51:50 +0300 Message-ID: Subject: Re: [Tee-dev] [PATCHv8 1/3] optee: use uuid for sysfs driver entry To: Jerome Forissier Cc: James Bottomley , Sumit Garg , Greg Kroah-Hartman , Linux Kernel Mailing List , Jarkko Sakkinen , Arnd Bergmann , "tee-dev @ lists . linaro . org" , Jason Gunthorpe , linux-integrity@vger.kernel.org, peterhuewe@gmx.de Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 Jun 2020 at 18:44, Jerome Forissier wrote: > > > > On 6/24/20 5:21 PM, James Bottomley wrote: > > On Wed, 2020-06-24 at 16:17 +0530, Sumit Garg wrote: > >> Apologies for delay in my reply as I was busy with some other stuff. > >> > >> On Fri, 19 Jun 2020 at 20:30, James Bottomley > >> wrote: > > [...] > >>> it's about consistency with what the kernel types mean. When some > >>> checker detects your using little endian operations on a big endian > >>> structure (like in the prink for instance) they're going to keep > >>> emailing you about it. > >> > >> As mentioned above, using different terminology is meant to cause > >> more confusion than just difference in endianness which is manageable > >> inside TEE. > >> > >> And I think it's safe to say that the kernel implements UUID in big > >> endian format and thus uses %pUb whereas OP-TEE implements UUID in > >> little endian format and thus uses %pUl. > > > > So what I think you're saying is that if we still had uuid_be and > > uuid_le you'd use uuid_le, because that's exactly the structure > > described in the docs. But because we renamed > > > > uuid_be -> uuid_t > > uuid_le -> guid_t > > > > You can't use guid_t as a kernel type because it has the wrong name? > > Let me try to clear the confusion that I introduce myself I believe :-/ > IMO: > > - optee_register_device(const uuid_t *device_uuid) *is* the correct > prototype. > - device_uuid is *guaranteed* to be BE because OP-TEE makes this > guarantee (it converts from its internal LE representation to BE when > enumerating the devices, but it doesn't matter to the kernel). > - Therefore %pUb is the correct format. > > I'm sorry for doubting the BE order initially. I am so used to OP-TEE > using LE internally, that I missed the fact that we have an explicit > conversion... > > Does this sound good? > > Thanks, > -- > Jerome I think your description is correct. But I think this problem would be solved outside of the current patchset. All places should use one single format (LE): - internal optee representation; - device enumeration pta; - this kernel driver which creates sysfs entry and sets uid_copy(&optee_device->id.uuid, device_uuid); - matching function; - drivers use UUID_INIT(); In that way everything will be consistent. But it will require changing other pieces, not just the kernel. While these patches add functionality to support current device enumeration in optee os. So I think this version is ok to be applied. Regards, Maxim.