From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <1428549459.18187.56.camel@kernel.crashing.org> Subject: Re: [PATCH 3/3] PCI: Set pref for mem64 resource of pcie device From: Benjamin Herrenschmidt To: Yinghai Lu Cc: Bjorn Helgaas , David Miller , David Ahern , "linux-pci@vger.kernel.org" , "sparclinux@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Date: Thu, 09 Apr 2015 13:17:39 +1000 In-Reply-To: References: <1427857069-6789-1-git-send-email-yinghai@kernel.org> <1427857069-6789-4-git-send-email-yinghai@kernel.org> <20150406220638.GH10892@google.com> <20150406.203533.1356187749826485194.davem@davemloft.net> <20150408154759.GN10892@google.com> <1428527527.18187.28.camel@kernel.crashing.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: On Wed, 2015-04-08 at 17:06 -0700, Yinghai Lu wrote: > On Wed, Apr 8, 2015 at 2:12 PM, Benjamin Herrenschmidt > wrote: > > > Thanks Bjorn. We can fix Yinghai patch for 4.2, it would be indeed handy > > even for us to be able to support putting 64-bit NP BARs in prefetch > > windows (For some SR-IOV adapters for example) too, but we need to do it > > right. > > Please check if you are ok with attached. I'll let Bjorn be the final judge here but I am not fan of the way you set/clear/set/clear the IORESOURCE_PREFETCH bit with pci_set_pref_under_pref(). It's error prone and confusing, the code is already barely readable as it is ... I would rather you replace those various masks compares with a helper that does something like pci_resource_compatible(parent_res, child_res), which has the logic to test. That or a helper that does something like pci_calc_compatible_res_flags() which returns a "flags" that has PREFETCH set, which you use in place of res->flags in the various allocation path. As-is, your patch looks like a band-aid and smells like a hack :-) Ben.