From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7695CC433E7 for ; Thu, 8 Oct 2020 07:31:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24E512173E for ; Thu, 8 Oct 2020 07:31:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="dAa4Urod" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727208AbgJHHbw (ORCPT ); Thu, 8 Oct 2020 03:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726684AbgJHHbv (ORCPT ); Thu, 8 Oct 2020 03:31:51 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B28B9C061755 for ; Thu, 8 Oct 2020 00:31:49 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id q136so4179098oic.8 for ; Thu, 08 Oct 2020 00:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ogkw1NmOSWleETzvxYwVZZIizSINMS0qQkiw0aowwRQ=; b=dAa4UrodoeKqvvGBic2n/ikfUtGXIrA84JDvhHoeTG0wQyvzwM6zRb58ASAp90bOAP Z0Gq9W2/rAIbo9tt/Rdw3PX+Bn1vOefBbbpajIIFIeMsYr0JsELM1frkf/Q6RzY+4q6w KwDjwJvmHbSV+DyPoGD+FRH2axWgRzr70NSco= 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=ogkw1NmOSWleETzvxYwVZZIizSINMS0qQkiw0aowwRQ=; b=QN/V+oX2I4J3SWIPkbKrmXDiWwq8vkBgcRJktCxjhPxpkSCrbS20vnkEvGpe0KvT03 C5sLuOWnKf6N345osSsH7w6EtLLJfMSDYjBceltnyeQ1DXAIOOP5gcsZNWfQ0vnWLV2K i7mtx+5H1UL78x/y7xF2A34hRyh+BuiUOxJoz/E86o1zWoi1Tg8NcATmy9/sgAH+Nhov kkF3o88b2BVUzeY71VnTYBL7Wh9OHeTJzkOKG8g94pG06fb+p9dRxUykhux/hYElwGsX Bk3KJwOEh65AWcq4H/UEHxR1JqH7AWoVg1R4j2LBxBGpBIc37IappFO8wa248tT1ek2J /tBg== X-Gm-Message-State: AOAM531kjLztmiwZa0yOHHPogkW+sf6kVD27Vw2RyeWs93SzVKrt1Ykr WP+iJbJFF4s9u2gKaHS4AFqF+HAMRdHNmobiLFgzZQ== X-Google-Smtp-Source: ABdhPJx491RwkFJI9puzs4morldhkHhy8TQN885mw0wtSqvJNbvAlJbcViFwT+IWX3hheU/oD67HmER0Hab3kMQkGCo= X-Received: by 2002:aca:6083:: with SMTP id u125mr4379406oib.14.1602142309051; Thu, 08 Oct 2020 00:31:49 -0700 (PDT) MIME-Version: 1.0 References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-11-daniel.vetter@ffwll.ch> <20201007232448.GC5177@ziepe.ca> In-Reply-To: <20201007232448.GC5177@ziepe.ca> From: Daniel Vetter Date: Thu, 8 Oct 2020 09:31:37 +0200 Message-ID: Subject: Re: [PATCH 10/13] PCI: revoke mappings like devmem To: Jason Gunthorpe Cc: Dan Williams , DRI Development , LKML , KVM list , Linux MM , Linux ARM , linux-samsung-soc , "Linux-media@vger.kernel.org" , linux-s390 , Daniel Vetter , Kees Cook , Andrew Morton , John Hubbard , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Jan Kara , Bjorn Helgaas , Linux PCI Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 8, 2020 at 1:24 AM Jason Gunthorpe wrote: > > On Wed, Oct 07, 2020 at 12:33:06PM -0700, Dan Williams wrote: > > On Wed, Oct 7, 2020 at 11:11 AM Daniel Vetter wrote: > > > > > > Since 3234ac664a87 ("/dev/mem: Revoke mappings when a driver claims > > > the region") /dev/kmem zaps ptes when the kernel requests exclusive > > > acccess to an iomem region. And with CONFIG_IO_STRICT_DEVMEM, this is > > > the default for all driver uses. > > > > > > Except there's two more ways to access pci bars: sysfs and proc mmap > > > support. Let's plug that hole. > > > > Ooh, yes, lets. > > > > > > > > For revoke_devmem() to work we need to link our vma into the same > > > address_space, with consistent vma->vm_pgoff. ->pgoff is already > > > adjusted, because that's how (io_)remap_pfn_range works, but for the > > > mapping we need to adjust vma->vm_file->f_mapping. Usually that's done > > > at ->open time, but that's a bit tricky here with all the entry points > > > and arch code. So instead create a fake file and adjust vma->vm_file. > > > > I don't think you want to share the devmem inode for this, this should > > be based off the sysfs inode which I believe there is already only one > > instance per resource. In contrast /dev/mem can have multiple inodes > > because anyone can just mknod a new character device file, the same > > problem does not exist for sysfs. > > The inode does not come from the filesystem char/mem.c creates a > singular anon inode in devmem_init_inode() > > Seems OK to use this more widely, but it feels a bit weird to live in > char/memory.c. > > This is what got me thinking maybe this needs to be a bit bigger > generic infrastructure - eg enter this scheme from fops mmap and > everything else is in mm/user_iomem.c Yeah moving it to iomem and renaming it to have an iomem_prefix instead of devmem sounds like a good idea. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 452FFC04EBE for ; Thu, 8 Oct 2020 07:33:27 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD9DF2173E for ; Thu, 8 Oct 2020 07:33:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sFltce5y"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="dAa4Urod" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD9DF2173E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TMjw6ohYXVFlhPJD/7rPUKivqaZbofSZh0m7MXY9Udg=; b=sFltce5y0FzlVKhkQ4IyQyfmJ pU1vRGtgkluPS29skgpDzB6Pghpu18fHRmIfkZLOAr1NEph0M5SidUNzQJgJRKweknjjjBfKHTAk8 Fq6XzAqtU8Nj5s2lI5YY39jmM06TNOvSxI8XxIPDUROLtn/RjY9VinvCcdwz7IlLNAonnlRIk2Wu3 aC4iZl6vxDzCUao5gOQTNqsz0I84ywON5b46YpNKtxFMTdPHWwiaYG4xTx7g/0YlsjzOUCGG4NViJ +U8MYYQpPA2d1Tk0yTfxJWC0C0dalteG9+Z1YYJuNL7yNhu83RM9AwZGI9NP0TYsTBcvCySEdp1w7 7ddGmTthg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQQP3-00071U-PH; Thu, 08 Oct 2020 07:31:53 +0000 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQQP0-00070a-Vx for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 07:31:51 +0000 Received: by mail-oi1-x244.google.com with SMTP id x62so5318348oix.11 for ; Thu, 08 Oct 2020 00:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ogkw1NmOSWleETzvxYwVZZIizSINMS0qQkiw0aowwRQ=; b=dAa4UrodoeKqvvGBic2n/ikfUtGXIrA84JDvhHoeTG0wQyvzwM6zRb58ASAp90bOAP Z0Gq9W2/rAIbo9tt/Rdw3PX+Bn1vOefBbbpajIIFIeMsYr0JsELM1frkf/Q6RzY+4q6w KwDjwJvmHbSV+DyPoGD+FRH2axWgRzr70NSco= 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=ogkw1NmOSWleETzvxYwVZZIizSINMS0qQkiw0aowwRQ=; b=YpMDCUWAfl6KDo1TCGjDpgHJaQJhLyL0lCf4ct2Xlx4N9C1bErndhfhNXujGoL+/vX so5rQW43YsfIvSMAfSKRq3PuPcF7DGK3NNRfSS1TMJRe70WR6Udp/n3Zq5iphNlhPPhE BlCMLOlWu+6D8oMi497s3P86H6TjMZKYMPMgi8G1DQXEuGRjwozIiS+DvDr8BP1//MwS VeA1TzLqOH4aPg6ZsrHR2F43UK3BsmPrnnQAcvmWT1NLHUJMjjQfpFxnfsj9U026uUTK VBT0/d/8Gp8Ny7LQwsi8wkTU0EHA0+/eBIVUlo7tAWxh2PoH9InQ4MbRuI5917l28vtH HqQg== X-Gm-Message-State: AOAM530ct7NnUBx4Pr6LI9mCqnEc3nn3mTPqkpHIdM04yUkZL0ZSGrpH itVi9i3tJyVKmPuGSsWJrrfBkntOc/JkQmrcdZD2pA== X-Google-Smtp-Source: ABdhPJx491RwkFJI9puzs4morldhkHhy8TQN885mw0wtSqvJNbvAlJbcViFwT+IWX3hheU/oD67HmER0Hab3kMQkGCo= X-Received: by 2002:aca:6083:: with SMTP id u125mr4379406oib.14.1602142309051; Thu, 08 Oct 2020 00:31:49 -0700 (PDT) MIME-Version: 1.0 References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-11-daniel.vetter@ffwll.ch> <20201007232448.GC5177@ziepe.ca> In-Reply-To: <20201007232448.GC5177@ziepe.ca> From: Daniel Vetter Date: Thu, 8 Oct 2020 09:31:37 +0200 Message-ID: Subject: Re: [PATCH 10/13] PCI: revoke mappings like devmem To: Jason Gunthorpe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_033151_050489_EBB20B7C X-CRM114-Status: GOOD ( 25.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390 , linux-samsung-soc , Jan Kara , Kees Cook , KVM list , John Hubbard , LKML , DRI Development , Linux MM , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Linux PCI , Bjorn Helgaas , Daniel Vetter , Dan Williams , Andrew Morton , Linux ARM , "Linux-media@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 8, 2020 at 1:24 AM Jason Gunthorpe wrote: > > On Wed, Oct 07, 2020 at 12:33:06PM -0700, Dan Williams wrote: > > On Wed, Oct 7, 2020 at 11:11 AM Daniel Vetter wrote: > > > > > > Since 3234ac664a87 ("/dev/mem: Revoke mappings when a driver claims > > > the region") /dev/kmem zaps ptes when the kernel requests exclusive > > > acccess to an iomem region. And with CONFIG_IO_STRICT_DEVMEM, this is > > > the default for all driver uses. > > > > > > Except there's two more ways to access pci bars: sysfs and proc mmap > > > support. Let's plug that hole. > > > > Ooh, yes, lets. > > > > > > > > For revoke_devmem() to work we need to link our vma into the same > > > address_space, with consistent vma->vm_pgoff. ->pgoff is already > > > adjusted, because that's how (io_)remap_pfn_range works, but for the > > > mapping we need to adjust vma->vm_file->f_mapping. Usually that's done > > > at ->open time, but that's a bit tricky here with all the entry points > > > and arch code. So instead create a fake file and adjust vma->vm_file. > > > > I don't think you want to share the devmem inode for this, this should > > be based off the sysfs inode which I believe there is already only one > > instance per resource. In contrast /dev/mem can have multiple inodes > > because anyone can just mknod a new character device file, the same > > problem does not exist for sysfs. > > The inode does not come from the filesystem char/mem.c creates a > singular anon inode in devmem_init_inode() > > Seems OK to use this more widely, but it feels a bit weird to live in > char/memory.c. > > This is what got me thinking maybe this needs to be a bit bigger > generic infrastructure - eg enter this scheme from fops mmap and > everything else is in mm/user_iomem.c Yeah moving it to iomem and renaming it to have an iomem_prefix instead of devmem sounds like a good idea. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B384C47095 for ; Thu, 8 Oct 2020 07:31:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 35EC92184D for ; Thu, 8 Oct 2020 07:31:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="dAa4Urod" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35EC92184D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED6D26EA45; Thu, 8 Oct 2020 07:31:51 +0000 (UTC) Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id EAC0E6EA3C for ; Thu, 8 Oct 2020 07:31:50 +0000 (UTC) Received: by mail-oi1-x241.google.com with SMTP id 16so5327430oix.9 for ; Thu, 08 Oct 2020 00:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ogkw1NmOSWleETzvxYwVZZIizSINMS0qQkiw0aowwRQ=; b=dAa4UrodoeKqvvGBic2n/ikfUtGXIrA84JDvhHoeTG0wQyvzwM6zRb58ASAp90bOAP Z0Gq9W2/rAIbo9tt/Rdw3PX+Bn1vOefBbbpajIIFIeMsYr0JsELM1frkf/Q6RzY+4q6w KwDjwJvmHbSV+DyPoGD+FRH2axWgRzr70NSco= 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=ogkw1NmOSWleETzvxYwVZZIizSINMS0qQkiw0aowwRQ=; b=VIPCmIaBsW31a5xmyYDFkL6q8QSKMLNSqlBG9mdR4LYGF4jD3cdv49LGBpxIPSPxvq 1VZq8xF7I6gr+b/ZtQWbw8rEWjRQ7eCaJXPe/cNnMc9ql0XI4QCNBhG91X5/ifYeE/Tc 4LObYT/EDsNmASSJEYVleXN8buWA9tI4j7ROwrGmiK6uL7jPFS0dW85AaYA7UjNEWKRo zdeLGn8capXHGAejxT4oQFN5XAh3JGFBMMguSaWopjmsW//Ys4HLfYmmWH92t3L75IAb 0ejqXAOTP7nDCZdLsHzyuyTDbCpe8I1CvmrAILjukb2R9MO3zeJn19zItRka3mri43W9 ZX0g== X-Gm-Message-State: AOAM530zC2ehyfHmfVoBME1jcvNMbgLKY8aNOWnPK52rJj0Wqkn2H+Ih t3Cbe1QiuhEOoTeikH4+Jz5h19jQPk6bvJvo4hoLGg== X-Google-Smtp-Source: ABdhPJx491RwkFJI9puzs4morldhkHhy8TQN885mw0wtSqvJNbvAlJbcViFwT+IWX3hheU/oD67HmER0Hab3kMQkGCo= X-Received: by 2002:aca:6083:: with SMTP id u125mr4379406oib.14.1602142309051; Thu, 08 Oct 2020 00:31:49 -0700 (PDT) MIME-Version: 1.0 References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-11-daniel.vetter@ffwll.ch> <20201007232448.GC5177@ziepe.ca> In-Reply-To: <20201007232448.GC5177@ziepe.ca> From: Daniel Vetter Date: Thu, 8 Oct 2020 09:31:37 +0200 Message-ID: Subject: Re: [PATCH 10/13] PCI: revoke mappings like devmem To: Jason Gunthorpe X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390 , linux-samsung-soc , Jan Kara , Kees Cook , KVM list , John Hubbard , LKML , DRI Development , Linux MM , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Linux PCI , Bjorn Helgaas , Daniel Vetter , Dan Williams , Andrew Morton , Linux ARM , "Linux-media@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, Oct 8, 2020 at 1:24 AM Jason Gunthorpe wrote: > > On Wed, Oct 07, 2020 at 12:33:06PM -0700, Dan Williams wrote: > > On Wed, Oct 7, 2020 at 11:11 AM Daniel Vetter wrote: > > > > > > Since 3234ac664a87 ("/dev/mem: Revoke mappings when a driver claims > > > the region") /dev/kmem zaps ptes when the kernel requests exclusive > > > acccess to an iomem region. And with CONFIG_IO_STRICT_DEVMEM, this is > > > the default for all driver uses. > > > > > > Except there's two more ways to access pci bars: sysfs and proc mmap > > > support. Let's plug that hole. > > > > Ooh, yes, lets. > > > > > > > > For revoke_devmem() to work we need to link our vma into the same > > > address_space, with consistent vma->vm_pgoff. ->pgoff is already > > > adjusted, because that's how (io_)remap_pfn_range works, but for the > > > mapping we need to adjust vma->vm_file->f_mapping. Usually that's done > > > at ->open time, but that's a bit tricky here with all the entry points > > > and arch code. So instead create a fake file and adjust vma->vm_file. > > > > I don't think you want to share the devmem inode for this, this should > > be based off the sysfs inode which I believe there is already only one > > instance per resource. In contrast /dev/mem can have multiple inodes > > because anyone can just mknod a new character device file, the same > > problem does not exist for sysfs. > > The inode does not come from the filesystem char/mem.c creates a > singular anon inode in devmem_init_inode() > > Seems OK to use this more widely, but it feels a bit weird to live in > char/memory.c. > > This is what got me thinking maybe this needs to be a bit bigger > generic infrastructure - eg enter this scheme from fops mmap and > everything else is in mm/user_iomem.c Yeah moving it to iomem and renaming it to have an iomem_prefix instead of devmem sounds like a good idea. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel