From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2085B1D698; Fri, 8 Mar 2024 17:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709917338; cv=none; b=cdDmrmtAryO7mj/CB7Y5U7ef1QTETHnw5PLK1WlIjs5CjKKLFjQN8TMSpRjnTys5tmQWi31ClVkj8UUhmvzAdFTZ9Fr8UQfbTHS0vrENyLzaQxyJ/dPBAtOUAA9mHbzUsxfqHskqISXxZHl1AxWrxuks+KfUQ/YtFBlX+bCun5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709917338; c=relaxed/simple; bh=EJfinzrUbLD4sEKSlrZWMhsgaO5WiyaoMvgJl2gYYYY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=s/L5WCdAmUpn/ej8EIIbnGQs75mjy2lsumk5+tuRrWnxW/YWQpIJsFJFHlVjUETxmV+xOyjKYjQNKYt+p/dyr9R7tP0DDPdGNLvcp6lQYeWsBX1YFE2swhctKbW0X2EplfWisruGQXvItAGJynEfaaXT0Kl2QdKYnnj8No1ranI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=SjKkr9M7; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="SjKkr9M7" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4qt6B2DEelMk3i3au76miwVYGuqD69MMNvsQhf9L6eU=; b=SjKkr9M7HMCTOJeUS7mscRYx5K lu8Smc7Bhj+S8mDp4VsgDShum2AAGcEXflC1jcpUhkEKrYpF7Bbp4xI42lx8mhtr+euAwApC5Z2z8 3ffgWeSG/txUpX5DOj1uG/xkuo05nYQLUhkPFHxvw0tRJoronxRdMYz6DJ92mTWRVW4HkkMFhA3RH QhOXe42tfkLsAn5aZr8HjFlGiilvCmARmuR1YxooOxh8Nt64TfxiAb9obIMj1KEYClj//0VG669Ps eZLe3sQOoNSqU+vWomQSz11n0w3kQAOd38T37PSYk2o7kMWG0sbtdtNNYnZInnflW4kpZfEPTMu8N qwnrrJ+g==; Received: from hch by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1ridbo-0000000AMNk-086d; Fri, 08 Mar 2024 17:02:12 +0000 Date: Fri, 8 Mar 2024 09:02:11 -0800 From: Christoph Hellwig To: Alexei Starovoitov Cc: Christoph Hellwig , Miguel Ojeda , Linus Torvalds , linux-mm , Andrew Morton , Catalin Marinas , Will Deacon , Linux ARM , Daniel Borkmann , bpf , Bjorn Helgaas , linux-pci@vger.kernel.org Subject: Re: vm_area at addr ffffffffc0800000 is not marked as VM_IOREMAP Message-ID: References: Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Fri, Mar 08, 2024 at 08:33:18AM -0800, Alexei Starovoitov wrote: > vmap_range_noflush() is static in mm/vmalloc.c > There is vmap_pages_range_noflush() that is in mm/internal.h, > but it needs pages instead of phys_addr_t. > Newly introduced vm_area_map_pages() needs struct vm_struct *area > and struct page **pages. > In this PCI case there is no vm_struct and no pages. > ioremap_page_range() is the only api that fits. afaict. Except that we want to enforce a vm_area with the ioremap flag for ioremap_page_range, and just adding a NULL check defeats that. The right long term thing would be to actually create a vm_area for the PCI_IOBASE region, but until then we just need a lower level API. That's why I suggest to add a vmap_range() that is basically the ioremap_page_range before you added the checks, and make ioremap_page_range a wrapper around that that checks the area. If/when we get PCI_IOBASE handling converted to the proper vmalloc/ioremap areas we can remove that again as well as vunmap_range which is just used for PCI_IOBASE and other equivalent ISA_IO_BASE in powerpc and somewhat unusual case in arm64 that I need to look into a bit more.