From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758635AbcEFS0G (ORCPT ); Fri, 6 May 2016 14:26:06 -0400 Received: from mail.kernel.org ([198.145.29.136]:39168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758224AbcEFS0E (ORCPT ); Fri, 6 May 2016 14:26:04 -0400 Date: Fri, 6 May 2016 13:26:00 -0500 From: Bjorn Helgaas To: Yinghai Lu Cc: Benjamin Herrenschmidt , David Miller , Bjorn Helgaas , Linus Torvalds , Wei Yang , TJ , Yijing Wang , Khalid Aziz , "linux-pci@vger.kernel.org" , Linux Kernel Mailing List , Michael Ellerman Subject: Re: [PATCH v11 04/60] sparc/PCI: Use correct offset for bus address to resource Message-ID: <20160506182600.GA22909@localhost> References: <1462322260.30470.76.camel@kernel.crashing.org> <20160504012531.GB17170@localhost> <20160504151722.GA22051@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 05, 2016 at 08:53:14AM -0700, Yinghai Lu wrote: > On Wed, May 4, 2016 at 5:25 PM, Yinghai Lu wrote: > > On Wed, May 4, 2016 at 11:46 AM, Yinghai Lu wrote: > >> On Wed, May 4, 2016 at 8:17 AM, Bjorn Helgaas wrote: > >>> My goal is to make pci_mmap_resource() and proc_bus_pci_mmap() look > >>> very similar, e.g., > >>> > >>> /* locate resource */ > >>> pci_user_to_resource() # only in proc_bus_pci_mmap() > >>> if (!pci_mmap_fits()) { > >>> WARN(...); > >>> return -EINVAL; > >>> } > >>> pci_mmap_page_range(); > > > > v3, that have more change to pass *res to make powerpc prot setting simple. This looks corrupted. On v4.6-rc2: $ stg import -M m/yh3 Checking for changes in the working directory ... done Importing patch "re-patch-v11-04-60-sparc-pci" ... fatal: corrupt patch at line 266 stg import: Diff does not apply cleanly > ... > Subject: [RFC PATCH v3 2/2] PCI: Let pci_mmap_page_range() take resource addr > > In 8c05cd08a7 ("PCI: fix offset check for sysfs mmapped files"), try > to check exposed value with resource start/end in proc mmap path. > | start = vma->vm_pgoff; > | size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; > | pci_start = (mmap_api == PCI_MMAP_PROCFS) ? > | pci_resource_start(pdev, resno) >> PAGE_SHIFT : 0; > | if (start >= pci_start && start < pci_start + size && > | start + nr <= pci_start + size) > > That would break sparc that exposed value is still BAR value. > > In the patch: > 1. in proc path: proc_bus_pci_mmap, try convert back to resource > before calling pci_mmap_page_range > 2. in sysfs path: pci_mmap_resource will just offset with resource start. > 3. all pci_mmap_page_range will all have vma->vm_pgoff with in resource > range instead of BAR value. > 4. remove __pci_mmap_make_offset, as the checking is done > in pci_mmap_fits(). This looks like it could possibly be split into several patches. I think it's too big to apply as-is. I'm not sure what bug this is fixing or what improvement it's making.