Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp483750ybr; Fri, 22 May 2020 11:12:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOv7RckyJ+BJwCLvgZZPBymqe0q/NO6m2kCLnCgRE3qaeq97IMNPCKdYIcXhQ25M5vyDb+ X-Received: by 2002:a17:906:e211:: with SMTP id gf17mr9269458ejb.495.1590171137928; Fri, 22 May 2020 11:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590171137; cv=none; d=google.com; s=arc-20160816; b=sD7DB98CbvkMQYAE/E/73+QKNj+2GL1V0DgPayVy1mbL45gAISn75nLIplu0AGxTHg cNPMWQATmgigALBV1rIL5LoQD/ZJBg7ldx8MssSlseWLbAuXMNAbe7UXY0JgBrjetsLh f0QfINNuNUHw9pzDEY1vNqU8+ekMBgkfqzCJK9o1lL7Rfn9UFPaxEpTPr2R+IwNyVyN6 Q5z6E9z2NbOXx5cQ2ZLc4vPF9gUmBlBu5koc9hCM7Sls5IEDHp5Ezv7fwAmmyGGl0N+r f3fsm/SS3q04cIbbZhEAWJo71xPwof0ANhvt/tVzwQyhb6aSGmAKOcT4lE7HX7s8519T imbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=bK83LII32CYIXyNdBCoJRVs5oREoCEW0+9bccKTq9hk=; b=EZLZ03DLY/3JdGjXrcRI2aF70F9CLonQ9uEEpK4Bbycmkx4dK3C9ExkPokqYLF+m0p Iy5ojx8pZzBTi8mJLp7HprE4DTTU0ZJf5bD3nvFAc8SvBYPDvs68/LOyjOCBwoOeLZt/ K53lfjOb08RwxrSDpukvHGD9J1E+WZ/gZW0twgbtF5vcm5RrNB1vy+LIfq1BQxgTWJ8I v4iX9/2c5ELjt6gGl/SeDTNnySMtdYOZF/JWYEKeExHn7HVpdq1c5nFHPxvagW7QEpfC qwnVGV7kyg8+uoTqriQVJXlpTW2sV/zvypMNa7e73/d1P/+mP301sFiCHX6+EYdUmjGb 520A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=NVtj+Ij+; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kalray.eu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r6si4913893edq.553.2020.05.22.11.11.54; Fri, 22 May 2020 11:12:17 -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=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b=NVtj+Ij+; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=kalray.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730814AbgEVSKS (ORCPT + 99 others); Fri, 22 May 2020 14:10:18 -0400 Received: from zimbra2.kalray.eu ([92.103.151.219]:51130 "EHLO zimbra2.kalray.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726373AbgEVSKS (ORCPT ); Fri, 22 May 2020 14:10:18 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 002A727E06AA; Fri, 22 May 2020 20:10:16 +0200 (CEST) Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id R-U1f_76ElBJ; Fri, 22 May 2020 20:10:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 43C3A27E1552; Fri, 22 May 2020 20:10:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu 43C3A27E1552 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1590171015; bh=bK83LII32CYIXyNdBCoJRVs5oREoCEW0+9bccKTq9hk=; h=Date:From:To:Message-ID:MIME-Version; b=NVtj+Ij+ss4G7UKccUqDpaqJ6k3alv4FFmlutBMH6TKECR4B9pdEfjUey3hS29asP k4AzlgGLkGIHc7LSyAhWmtBYuCuO97RXvvmJInVeW9rkiPh625qIIX98U6vAdUaMxt abGB0OGkTCP4INpZmk7pAhPs1rTMvOKkR1/ZqyWw= X-Virus-Scanned: amavisd-new at zimbra2.kalray.eu Received: from zimbra2.kalray.eu ([127.0.0.1]) by localhost (zimbra2.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id efYqJTyB0HMQ; Fri, 22 May 2020 20:10:15 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 286DD27E06AA; Fri, 22 May 2020 20:10:15 +0200 (CEST) Date: Fri, 22 May 2020 20:10:14 +0200 (CEST) From: =?utf-8?Q?Cl=C3=A9ment?= Leger To: Bjorn Andersson Cc: s-anna , Rob Herring , Mathieu Poirier , Loic PALLARDY , Arnaud Pouliquen , Lokesh Vutla , linux-remoteproc , devicetree , linux-arm-kernel , linux-kernel Message-ID: <1334263091.4218509.1590171014972.JavaMail.zimbra@kalray.eu> In-Reply-To: <1739080680.4218297.1590170621467.JavaMail.zimbra@kalray.eu> References: <20200325204701.16862-1-s-anna@ti.com> <20200325204701.16862-4-s-anna@ti.com> <20200521180417.GJ408178@builder.lan> <997d6f9a-64ba-7a89-e909-9a5a474120b0@ti.com> <20200522173346.GJ11847@yoga> <1739080680.4218297.1590170621467.JavaMail.zimbra@kalray.eu> Subject: Re: [PATCH 3/4] remoteproc: add support for a new 64-bit trace version MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.40.202] X-Mailer: Zimbra 8.8.15_GA_3895 (ZimbraWebClient - GC81 (Linux)/8.8.15_GA_3895) Thread-Topic: remoteproc: add support for a new 64-bit trace version Thread-Index: L30XW51sgsk7NRKU7I+TV4VplJ8G6Xb707z7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On 22 May, 2020, at 20:03, Cl=C3=A9ment Leger cleger@kalray.eu wrote: > Hi Suman, >=20 > ----- On 22 May, 2020, at 19:33, Bjorn Andersson bjorn.andersson@linaro.o= rg > wrote: >=20 >> On Fri 22 May 09:54 PDT 2020, Suman Anna wrote: >>=20 >>> On 5/21/20 2:42 PM, Suman Anna wrote: >>> > Hi Bjorn, >>> >=20 >>> > On 5/21/20 1:04 PM, Bjorn Andersson wrote: >>> > > On Wed 25 Mar 13:47 PDT 2020, Suman Anna wrote: >> [..] >>> > > > diff --git a/include/linux/remoteproc.h b/include/linux/remotepro= c.h >> [..] >>> > > > +struct fw_rsc_trace2 { >>> > >=20 >>> > > Sounds more like fw_rsc_trace64 to me - in particular since the ver= sion >>> > > of trace2 is 1... >>> >=20 >>> > Yeah, will rename this. >>> >=20 >>> > >=20 >>> > > > +=C2=A0=C2=A0=C2=A0 u32 padding; >>> > > > +=C2=A0=C2=A0=C2=A0 u64 da; >>> > > > +=C2=A0=C2=A0=C2=A0 u32 len; >>> > > > +=C2=A0=C2=A0=C2=A0 u32 reserved; >>> > >=20 >>> > > What's the purpose of this reserved field? >>> >=20 >>> > Partly to make sure the entire resource is aligned on an 8-byte, and >>> > partly copied over from fw_rsc_trace entry. I guess 32-bits is alread= y >>> > large enough of a size for trace entries irrespective of 32-bit or >>> > 64-bit traces, so I doubt if we want to make the len field also a u64= . >>>=20 >>> Looking at this again, I can drop both padding and reserved fields, if = I >>> move the len field before da. Any preferences/comments? >=20 Sorry, my message went a bit too fast... So as I was saying: Not only the in-structure alignment matters but also in the resource table. Since the resource table is often packed (see [1] for instance), if a trace resource is embedded in the resource table after another resource aligned on 32 bits only, your 64 bits trace field will potentially end up misaligned. To overcome this, there is multiple solutions: - Split the 64 bits fields into 32bits low and high parts: Since all resources are aligned on 32bits, it will be ok - Use memcpy_from/to_io when reading/writing such fields As I said in a previous message this should probably be used since the memories that are accessed by rproc are io mem (ioremap in almost all drivers). Regards, Cl=C3=A9ment [1] https://github.com/OpenAMP/open-amp/blob/master/apps/machine/zynqmp_r5= /rsc_table.h >=20 >=20 >=20 >=20 >>>=20 >>=20 >> Sounds good to me. >>=20 >> Thanks, > > Bjorn