Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1511098imm; Fri, 7 Sep 2018 01:16:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZkmq9GlMdXBJdYbxXr0yOH2SUp2dnP+D4w2XzCS8qCkmoiGSpNTB//srFX3vep2E2dS8OS X-Received: by 2002:a62:490e:: with SMTP id w14-v6mr7175841pfa.213.1536308213779; Fri, 07 Sep 2018 01:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536308213; cv=none; d=google.com; s=arc-20160816; b=edW2W8jiLUKFyveLw7Qebb8SUtM7eHHi+/3j3ZoJsmY2nu7kAz3+5V5iQLjMslOKJW 6tInKCkaeIP/ZhjBz47zxdTh3cOR0g8USkhWo21vF65Q71rIubibSNIqC7cQhexVB7Mn eQAPpyy71KApa6+t/9hz5RFdj7uXjxhrhVTRNlXfMTp7fXHtWDUBJ8zEP1TfCasayDiS KJGRSQXCQJDtbL40Vu944cgk8cKIOSVQQ9k/bs3cV9/tqm+DwworrBuuF56DCv787qmX ZXbaPVSzDvnX03R+gqK4XfPzkoWmXjIDPUpJyBwpr1iU3lr6/WscZGJHrWYet/9pJvNJ 2WIg== 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; bh=KS89FdKfy0eFfc3JCGt08Ga+wBVRMwStghUo7Nyjnv4=; b=P4okvll8luQ4YuNtBBLRXB02cHs9dUq7z+O6lRYw4GTqVb23b+VbQ+o4naNjdT+n48 DYg6zpgtWuTbv8jeZf7NR94eHQ92qU5feJjdJuw3ktshrb9HXfmGgYbmMz+4TLd8EHEm ZjlKxfLST3FGp4Z//ZNSI3zDLDXNXMo+JvYzT8czCE24zpskf24SMfh7pp+KRfB6GBM8 aoSwcCCBmJQ9DvmICUCUULI/WWk19C6O3E+zVG31MhDT85FoJ/Hq5uutE1jA57r/YWFA KgpSXC9ds6loLUuCuPrmAmeg5QOUdaDnkKQM1DEXYeb3pRxoZkrWATva+SfnbxCVoriJ o9tQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37-v6si8305406ple.491.2018.09.07.01.16.37; Fri, 07 Sep 2018 01:16:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728050AbeIGMyo (ORCPT + 99 others); Fri, 7 Sep 2018 08:54:44 -0400 Received: from mail-qt0-f178.google.com ([209.85.216.178]:42316 "EHLO mail-qt0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727093AbeIGMyo (ORCPT ); Fri, 7 Sep 2018 08:54:44 -0400 Received: by mail-qt0-f178.google.com with SMTP id z8-v6so15362832qto.9; Fri, 07 Sep 2018 01:14:56 -0700 (PDT) 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=KS89FdKfy0eFfc3JCGt08Ga+wBVRMwStghUo7Nyjnv4=; b=PuFNOfrGWk5WW9DatvpaAQyU4J/6JVgxSEmIf3Ea4OHJtTW2FejLuEhfQH8j6aP2A0 TND98l7acIZaz1kL2LfzokNeuo2pv+6QPJx2+TK/OWCGqmWn/D3EZhHk9Ca6LU8ThX/F 90DUyZGmK6E4RwOXgtTNNB+yeSVcbutfhcE45aAl6PQkppcBoRHvzYxRsv2PwhHtgA2g Q2iMovI5R0jch4ajy1KsHwzCiuj7fBIvut0n7ue3Jf2otJoJl4LJM0p/adI/0zrdNIsx 3B19qxzt4uHPJpNwCRXupxeqPlCjzQFJBInJmM7LPl0R7bA/RCI4lA0Xo7qaMC7N0Xur 8mEQ== X-Gm-Message-State: APzg51CjYQbw+rn5QYW4ltu/N2SRnpQEcJ/jaYM30RtxzbEy8z5SYN7z pEnvU/EsqbhDIduzcEyXpgBubWJsjgiyJYm481c= X-Received: by 2002:a0c:a8cc:: with SMTP id h12-v6mr5037925qvc.161.1536308095428; Fri, 07 Sep 2018 01:14:55 -0700 (PDT) MIME-Version: 1.0 References: <16105a3e54f1c4bb65a5ec81d77af7c176e705c6.1536138304.git.ren_guo@c-sky.com> <20180907030447.GA10434@guoren-Inspiron-7460> In-Reply-To: <20180907030447.GA10434@guoren-Inspiron-7460> From: Arnd Bergmann Date: Fri, 7 Sep 2018 10:14:38 +0200 Message-ID: Subject: Re: [PATCH V3 06/26] csky: Cache and TLB routines To: Guo Ren Cc: linux-arch , Linux Kernel Mailing List , Thomas Gleixner , Daniel Lezcano , Jason Cooper , c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, Thomas Petazzoni , wbx@uclibc-ng.org, Greentime Hu 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 Fri, Sep 7, 2018 at 5:04 AM Guo Ren wrote: > > On Thu, Sep 06, 2018 at 04:31:16PM +0200, Arnd Bergmann wrote: > > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > > Can you describe how C-Sky hardware implements MMIO? > Our mmio is uncachable and strong-order address, so there is no need > barriers for access these io addr. > > #define ioremap_wc ioremap_nocache > #define ioremap_wt ioremap_nocache > > Current ioremap_wc and ioremap_wt implementation are too simple and > we'll improve it in future. > > > In particular: > > > > - Is a read from uncached memory always serialized with DMA, and with > > other CPUs doing MMIO access to a different address? > CPU use ld.w to get data from uncached strong order memory. > Other CPUs use the same mmio vaddr to access the uncachable strong order > memory paddr. Ok, but what about the DMA? The most common requirement for serialization here is with a DMA transfer, where you first write into a buffer in memory, then write to an MMIO register to trigger a DMA-load, and then the device reads the data from memory. Without a barrier before the MMIO, the data may still be in a store queue of the CPU, and the DMA gets stale data. Similarly, an MMIO read may be used to see if a DMA has completed and the device register tells you that the DMA has left the device, but without a barrier, the CPU may have prefetched the DMA data while waiting for the MMIO-read to complete. The __io_ar() barrier() in asm-generic/io.h prevents the compiler from reordering the two reads, but if an weakly ordered read (in coherent DMA buffer) can bypass a strongly ordered read (MMIO), then it's still still broken. > > - How does endianess work? Are there any buses that flip bytes around > > when running big-endian, or do you always do that in software? > Currently we only support little-endian and soc will follow it. Ok, that makes it easier. If you think that you won't even need big-endian support in the long run, you could also remove your asm/byteorder.h header. If you're not sure, it doesn't hurt to keep it of course. Arnd