Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5563891imm; Mon, 23 Jul 2018 01:50:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfo51J7xlZDATDo6O/zzsgKJ8y/cJPAccsNCh8N2o1ZpZ1qQyOcRr2MXaX6HDEZ7B+FcBnm X-Received: by 2002:a63:a347:: with SMTP id v7-v6mr11100112pgn.182.1532335859561; Mon, 23 Jul 2018 01:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532335859; cv=none; d=google.com; s=arc-20160816; b=thqLr2VVUSVJvO/r3Ikx64/iI+HtgCLkgblZyMIXsJ+/TaL5idnjZlOgum7VeD9rj0 LN1dS4qvJlgS9oXExNNGB4g9T7FL4Vsp9omIM+z5JSD6E4KLpSSdmhZlqpj9amxdjlei 09Wl2xsNj0wvNkdfhIS7sYFUwG8oxIlyToWZfTVBedLP5gtd/K76UFMPtrz1ObmUjo9K 5a1ut/+9Rh2MwtmhXp5wSsQC2lRq/vFZDpwQvOXogMlzX22OPU1V6xsUqwW+brhFRefQ nPwJvOlzbgbrTCo5EO7NMZDUxi+pjDV2YYiBQjuvlKzLTbXJNnEyWurtzSh4FO1JdI2i HzFQ== 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:arc-authentication-results; bh=Y3gEY2CxvXNh09RfS+F0kJfVDZ/7N1a2XoHJIdBLzFc=; b=pTsYLNW0HES9vWG0RdG1DY0iOff6wXaexVl1WpQYZXl4L5dZpfAxqydgFe2oQ7yXY8 hOGrfcrPXMRGuhHZJdre/7f2Ho5HU5hVv/178v/1duzMf+ku7c7R8/72vxyi96xrzCZ9 J6M8+oEL9RZiAsd/XBjCbgPiqqXsKLUcJsJ+LG8BCCUhSj61zTL3NTaluV4HKmZE5k57 OCY2GTWEf+Yu4PHsS0GQ5uTfbO8RQol0bE1+AF0saa3FsttNjaHLtIBiSIM0xcuDWrar IR5A1xdTobqQkFoAENBqKbWaeY6OoONY4TqpwyzB57Yv1AYUsrE/X1dQ67MqkBl7mQcV zntw== 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 f10-v6si4245594pfn.85.2018.07.23.01.50.43; Mon, 23 Jul 2018 01:50:59 -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 S2388059AbeGWJuA (ORCPT + 99 others); Mon, 23 Jul 2018 05:50:00 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:39485 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387951AbeGWJuA (ORCPT ); Mon, 23 Jul 2018 05:50:00 -0400 Received: by mail-vk0-f65.google.com with SMTP id e139-v6so8848753vkf.6; Mon, 23 Jul 2018 01:49:51 -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=Y3gEY2CxvXNh09RfS+F0kJfVDZ/7N1a2XoHJIdBLzFc=; b=hwwxZyND+1dXzlmOgE8memhIjE14S9EIlLetSxf+mPWISEJhDqoDsfrGz7aVXTDXpJ xaS0RRM3vvjQrvgONoltWqXhBckvqXynLt2xl+aW6Hf4wC7/jCrMf7xOFgr7IxQDSFgI PCjNbYXBbcKpmZ7vMK7g9Z6mGpRjQtIu9VXuWR24Ng2KNtwvkvTj2JllOKIdipHjgzSG YPTiSeSK8wIuX1rMuoARWF73VimIvecIu5tz8Ub1quKY0Bh0DubZ13BffUmhD4GAyCn+ yKXGKt04M+3FlLaPcr3lrgH0n89qFIEyi6WsaG7CSJ/bdm4PRIKMLST8vobA0IJIeqlZ qIbQ== X-Gm-Message-State: AOUpUlHnxFqQ0x4HQn+9HjYW4OT/kTFQWdU9G1jmr8zAndjzc2KOiqR8 aUnJvYbfXTwaC2VFW6kv0DNduxj0U6gX0NT02XU= X-Received: by 2002:a1f:8ad3:: with SMTP id m202-v6mr7092750vkd.9.1532335791483; Mon, 23 Jul 2018 01:49:51 -0700 (PDT) MIME-Version: 1.0 References: <20180719130516.1989-1-hch@lst.de> <20180719130516.1989-5-hch@lst.de> <20180723084207.GI6784@w540> In-Reply-To: <20180723084207.GI6784@w540> From: Geert Uytterhoeven Date: Mon, 23 Jul 2018 10:49:39 +0200 Message-ID: Subject: Re: [PATCH 4/5] sh: split arch/sh/mm/consistent.c To: Jacopo Mondi Cc: Christoph Hellwig , Yoshinori Sato , Rich Felker , Jacopo Mondi , Thomas Petazzoni , Linux-sh list , Linux IOMMU , Linux Kernel Mailing List 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 Hi Jacopo, On Mon, Jul 23, 2018 at 10:42 AM jacopo mondi wrote: > I have a single comment on something I noticed which might be an > implementation bug. On the overall patch architecture, it's very hard > for me to provide a valuable opinion as it's all relatively new for me > here :) > > On Thu, Jul 19, 2018 at 06:05:15AM -0700, Christoph Hellwig wrote: > > Half of the file just contains platform device memory setup code which > > is required for all builds, and half contains helpers for dma coherent > > allocation, which is only needed if CONFIG_DMA_NONCOHERENT is enabled. > > > > Signed-off-by: Christoph Hellwig > > --- /dev/null > > +++ b/arch/sh/kernel/dma-coherent.c > > @@ -0,0 +1,85 @@ > > +/* > > + * Copyright (C) 2004 - 2007 Paul Mundt > > + * > > + * This file is subject to the terms and conditions of the GNU General Public > > + * License. See the file "COPYING" in the main directory of this archive > > + * for more details. > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +void *dma_generic_alloc_coherent(struct device *dev, size_t size, > > + dma_addr_t *dma_handle, gfp_t gfp, > > + unsigned long attrs) > > +{ > > + void *ret, *ret_nocache; > > + int order = get_order(size); > > + > > + gfp |= __GFP_ZERO; > > + > > + ret = (void *)__get_free_pages(gfp, order); > > + if (!ret) > > + return NULL; > > + > > + /* > > + * Pages from the page allocator may have data present in > > + * cache. So flush the cache before using uncached memory. > > + */ > > + sh_sync_dma_for_device(ret, size, DMA_BIDIRECTIONAL); > > + > > + ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size); > > + if (!ret_nocache) { > > + free_pages((unsigned long)ret, order); > > + return NULL; > > + } > > + > > + split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order); > > + > > + *dma_handle = virt_to_phys(ret); > > + if (!WARN_ON(!dev)) > > + *dma_handle - PFN_PHYS(dev->dma_pfn_offset); > > I guess this comes from below... > > - *dma_handle = virt_to_phys(ret); > > - if (!WARN_ON(!dev)) > > - *dma_handle -= PFN_PHYS(dev->dma_pfn_offset); > > ... here > > Is the s/-=/- intended? > > Snippets copied here below: > > > + *dma_handle = virt_to_phys(ret); > > + if (!WARN_ON(!dev)) > > + *dma_handle - PFN_PHYS(dev->dma_pfn_offset); > vs > > - *dma_handle = virt_to_phys(ret); > > - if (!WARN_ON(!dev)) > > - *dma_handle -= PFN_PHYS(dev->dma_pfn_offset); Doesn't look right to me, neither. No complaints for 0day? My gcc says: error: statement with no effect [-Werror=unused-value] Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds