Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935120Ab3DHR3j (ORCPT ); Mon, 8 Apr 2013 13:29:39 -0400 Received: from mail-ob0-f177.google.com ([209.85.214.177]:64175 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935014Ab3DHR3h (ORCPT ); Mon, 8 Apr 2013 13:29:37 -0400 MIME-Version: 1.0 In-Reply-To: <1365238164.2787.6.camel@dabdike> References: <20130321043449.7229.81056.stgit@amt.stowe> <20130321043502.7229.43877.stgit@amt.stowe> <514BAB13.3000101@gmail.com> <1365238164.2787.6.camel@dabdike> From: Bjorn Helgaas Date: Mon, 8 Apr 2013 11:29:17 -0600 Message-ID: Subject: Re: [PATCH 2/3] PCI: Handle device quirks when accessing sysfs resource entries To: James Bottomley Cc: Robert Hancock , Myron Stowe , "linux-pci@vger.kernel.org" , Xiangliang Yu , xiangliang yu , Greg Kroah-Hartman , "alex.williamson@redhat.com" , Kay Sievers , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2001 Lines: 40 On Sat, Apr 6, 2013 at 2:49 AM, James Bottomley wrote: > On Thu, 2013-04-04 at 12:06 -0600, Bjorn Helgaas wrote: >> On Thu, Mar 21, 2013 at 6:51 PM, Robert Hancock wrote: >> > -Reconsider whether supporting read/write on the resource files for IO port >> > regions like these makes any sense. Obviously mmap isn't very practical for >> > IO port access on x86 but you could even do something like an ioctl for this >> > purpose. Not very many pieces of software would need to access these files >> > so it's likely OK if the API is a bit ugly. That would prevent something >> > like grepping through sysfs from generating port accesses to random devices. >> >> This is the approach I'd like to push on for a kernel fix. > > Me too. I think the quirks approach is unsupportable. Worst case I > think we should have an ability for the *driver* to mark the region as > having strange access rules. > >> I'm not a >> VM person, but if it were possible to support .mmap() in such a way >> that a handler would be called for every access to the region, we >> could easily support I/O port access that way. > > We could ... the OS could trigger a page fault on every access using the > COW mechanism ... however, that mechanism wasn't intended for write > combining, so although it's theoretically possible to add it, I'd be a > bit wary. The current problem case is only I/O port accesses, so we only have to support 1/2/4-byte accesses, and I don't think write combining is an issue. But it still sounds like COW might be trying to force a square peg into a round hole. Maybe there are other approaches. I just thought of .mmap() because that's already used for MEM space accesses. Bjorn -- 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/