Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755871AbbDUTZT (ORCPT ); Tue, 21 Apr 2015 15:25:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58882 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755286AbbDUTZQ (ORCPT ); Tue, 21 Apr 2015 15:25:16 -0400 Date: Tue, 21 Apr 2015 21:25:05 +0200 From: "Michael S. Tsirkin" To: Bjorn Helgaas Cc: "Luis R. Rodriguez" , Andy Lutomirski , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , jgross@suse.com, Jan Beulich , Borislav Petkov , Suresh Siddha , venkatesh.pallipadi@intel.com, Dave Airlie , "linux-kernel@vger.kernel.org" , linux-fbdev@vger.kernel.org, "x86@kernel.org" , "xen-devel@lists.xenproject.org" , "Luis R. Rodriguez" , Ingo Molnar , Daniel Vetter , Antonino Daplas , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Dave Hansen , Arnd Bergmann , Stefan Bader , Konrad Rzeszutek Wilk , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , David Vrabel , Toshi Kani , Roger Pau =?iso-8859-1?Q?Monn=E9?= , xen-devel Subject: Re: [PATCH v1 05/47] pci: add pci_iomap_wc() variants Message-ID: <20150421211557-mutt-send-email-mst@redhat.com> References: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com> <1426893517-2511-6-git-send-email-mcgrof@do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1168 Lines: 32 On Mon, Mar 23, 2015 at 12:20:47PM -0500, Bjorn Helgaas wrote: > pci_iomap_range() already makes a cacheable mapping if > IORESOURCE_CACHEABLE; I'm guessing that you would like it to > automatically use WC if the BAR if IORESOURCE_PREFETCH, e.g., > > if (flags & IORESOURCE_CACHEABLE) > return ioremap(start, len); > if (flags & IORESOURCE_PREFETCH) > return ioremap_wc(start, len); > return ioremap_nocache(start, len); > > Is there a reason not to do that? I think that's wrong and will break a bunch of things. PCI prefetch bit merely means bridges can combine writes and prefetch reads. Prefetch does not affect ordering rules and does not allow writes to be collapsed. WC is stronger: it allows collapsing and changes ordering rules. WC can also hurt latency as small writes are buffered. To summarise, driver needs to know what it's doing, we can't set WC in the pci core automatically. -- MST -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/