Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1708862ybk; Mon, 11 May 2020 02:18:15 -0700 (PDT) X-Google-Smtp-Source: APiQypJE9vvABlO4cdZtf2D1FQWnvFWsiCEGL7mSQfHDVsgHpDmQbLdQOwM3LcJ7tVAvOovoW8fE X-Received: by 2002:a17:906:7f01:: with SMTP id d1mr12132866ejr.49.1589188695145; Mon, 11 May 2020 02:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589188695; cv=none; d=google.com; s=arc-20160816; b=i0dTD4l/BnWQ5j9m1LraeFN+qm9LWufJkfsYISKimeB30DSb+jwyZlIhi0xquD0x4c MhrgpmJKH0IFuHo5nn4appdQCs89aTG7EI9BElUG/acO12uS9W1LC/vtJ9QN77J4XNGf EOjV2MIxNQKBGGqgj9DTLNWt3b7o2kz+nT980OL0HcDtaZIR0Ufg1tRflb9JCQxD06rL 2Wy50TT/s+8C0gtMgs6XK/YPKloPSZ6YuYiWhzd+iET3CN+T3SutlIvAFW/ENwbrHJu9 lbaR1NFspDGCyk8w4jAFKYP1VpyrSjjikujU+vfhKAQrD8FuKjvA6fmP1gz2H6jR7vx5 Zr/g== 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=1E0dJW1iWPRM52gggcDmbsBZvxVR2MdnQlbb2736LeU=; b=JYHuSUPf6LT5pNi0w4yV9dVFFA5VmzMF4/XQwkwdjw/Hwlb2cVRrg+p+AtKgMXlYES ttLOz2DfH/78e5NyjoOVQeQo0aJMncUweZC7zPouSlg7oMUEpjJ2hxGfz5dsOVDmOAL5 aMinI+pCjdKt4Jb3d7gdBlVbzRVIxDZpBjkjAKSm4IsKVmAkZjgIAcyjvT3vFQpjiXI/ 8sWcoh02MNNGTtu0GPLZ1+ms5fGAvsFqOHQCNovUmlN+UD9GQQQPQ8d5DC1RHg0/gs/U 941VBpBOQfRl/5ejT8S4fyFcXaVbuTUtyDVUTbFwpyxnINWMWpLDqHEVxkACJn1dPvxQ 5NiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kalray.eu header.s=32AE1B44-9502-11E5-BA35-3734643DEF29 header.b="h0D7i/uh"; 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 q10si6004966eju.123.2020.05.11.02.17.52; Mon, 11 May 2020 02:18:15 -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="h0D7i/uh"; 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 S1728711AbgEKJPn (ORCPT + 99 others); Mon, 11 May 2020 05:15:43 -0400 Received: from zimbra2.kalray.eu ([92.103.151.219]:60634 "EHLO zimbra2.kalray.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbgEKJPn (ORCPT ); Mon, 11 May 2020 05:15:43 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id 78E6827E02D1; Mon, 11 May 2020 11:15:41 +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 WDeo-rWdb0Zi; Mon, 11 May 2020 11:15:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id DD1DA27E053C; Mon, 11 May 2020 11:15:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra2.kalray.eu DD1DA27E053C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1589188540; bh=1E0dJW1iWPRM52gggcDmbsBZvxVR2MdnQlbb2736LeU=; h=Date:From:To:Message-ID:MIME-Version; b=h0D7i/uhQ8BxlWA9ortvEs7mvNZz1J1xZrXrcTSUUzgDAIdsRlyhBxkQjTsH1/4N9 6eLECjkLpZVnXfY64hL/eo6O0YUkbbVBbLevpkH+fWogwIQTo4qtHD5wLyC5iPC0Bu KhWwgRNh10gyWQqAKQBmpIKvgxDD5m3QXWKiJsXQ= 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 kRPqEYn9ZcLd; Mon, 11 May 2020 11:15:40 +0200 (CEST) Received: from zimbra2.kalray.eu (localhost [127.0.0.1]) by zimbra2.kalray.eu (Postfix) with ESMTP id C6F1427E02D1; Mon, 11 May 2020 11:15:40 +0200 (CEST) Date: Mon, 11 May 2020 11:15:40 +0200 (CEST) From: =?utf-8?Q?Cl=C3=A9ment?= Leger To: s-anna Cc: Peng Fan , Bjorn Andersson , Ohad Ben-Cohen , linux-remoteproc , linux-kernel , NXP Linux Team Message-ID: <1847639658.1891474.1589188540520.JavaMail.zimbra@kalray.eu> In-Reply-To: References: <1586420572-28353-1-git-send-email-peng.fan@nxp.com> <20200410012034.GU20625@builder.lan> <20200411015104.GJ576963@builder.lan> <07eb5b9f-60cd-6555-1904-7b348bdc43f2@ti.com> Subject: Re: [PATCH 1/2] remoteproc: drop memset when loading elf segments 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: drop memset when loading elf segments Thread-Index: biEmLGpskBEqbrR8acDJ7LHDqg0/VA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On 21 Apr, 2020, at 20:25, s-anna s-anna@ti.com wrote: >>> >>> Hi Peng, >>> >>> The trick is to use the ioremap_wc() variant instead of ioremap() in yo= ur >>> platform driver while mapping the TCMs. I know multiple folks have run = into >>> this issue. This is what most of the remoteproc drivers use, and mmio-s= ram >>> driver also uses the same. >>=20 >> TCM is different from OCRAM in i.MX chips. >> ioremap_wc not work for TCM memory, I just tried that. >=20 > What ARM core is this? Is it a standard ARM TCM memory? The TCM > interfaces from standard ARM cores in general are treated as normal > memory, so write combine should be ok on them. When you say it doesn't > work, whats not working - the memcpy/memset or the remoteproc doesn't boo= t? >=20 >> I am thinking we change memset/memcpy to use >> memset_io/memcpy_fromio/memcpy_toio for remoteproc common code, >=20 > This has other implications. Not everything is IO memory to make this > change in the common core. Hi Suman, AFAIK, most (if not all) the drivers are using ioremap to expose the remoteproc memories. Since these are IO memories, then care should be taken when writing/reading from them and memset_io/memcpy_fromio /memcpy_toio should be used (or ioread/write). Currently, this is not the case in the remoteproc driver and it works because everything is aligned and there is no misaligned access. IMHO, as suggested by Peng, remoteproc core should use such accessors. We (at Kalray) have some modifications to do that since there were some misalignment after modifying the resource table (64 bits fields). The only drawback that I can see using io memcpy is potentially a loss of performance for processors not requiring any alignement check. But other than that, it seems safer for everyon and performance in init does not seems really critical. >=20 > If this is a custom memory interface requiring specific handling, then > one option is to provide and use your own ops->load function within the > driver. This is what I do for one of our remoteprocs that requires a > specific memcpy handling semantics. This does not only apply to firmware loading. This applies to all the resource table accesses which are currently done using direct accesses to members. They should also used io memcpy. Regards, Cl=C3=A9ment >=20 > regards > Suman