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=-16.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 CDCE4C4338F for ; Tue, 27 Jul 2021 18:24:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 7F6ED60F01 for ; Tue, 27 Jul 2021 18:24:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7F6ED60F01 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+0KZ2knJLqp0km9Op5DV1CF43XMLvpHO3EKKDX8S1fY=; b=BM7Sd/NzLz1RIT CRP/DrlgMMme5AwuB7I6bi1JE+4PXn03rbhSiimngOjiy1TnxL2cEnlM9xFA1byYMZjoiI+56vRR9 q9eJHcIEvejuJ+TDeaf/f/Ld0ovzi2kGXWpsqZFZIyRY/2etPBbBCloGpcG5JE9gUs832zD/6gGoD eJVJ1EC7Lh3lmCoyzwkGi81skUGGMeLfahSXrLmAov48hEcUZfQRHeo26dbfeay21myqlidQvoSuV 5oihswIOL98X4Uduv4FnpwIgXrJPvKUC6Toqm6v9VRRRGdYXJCdUBu119jSGIQVTNrP6Kidm08/JX ayZszdh87Wgoy60ND2kw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8RiZ-00FpUS-68; Tue, 27 Jul 2021 18:22:16 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m8RYn-00Fky7-AV for linux-arm-kernel@lists.infradead.org; Tue, 27 Jul 2021 18:12:10 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id DD3946056B; Tue, 27 Jul 2021 18:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627409529; bh=fUgkuFB9VQtgL1VRh8fF7edi9U2ibRcCUZV2oZL57h8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cpxx1nirtagKB64kip87dBNB4SjfC/kG0WM5+aseu385nTOwDTylRCPPxcHHEKwf4 S/qfl0CnSLCp9sK+uhtUVArERHSiTR7kkyPKN3sq91+Zg5hJSy5mlTys4lOcf64vbg Uzt9HkAx8h1hcXSUxH2ZVPiwZInxVvvWK6Yd2+f2RvEJSo7d4I04xtqexTPdTbtzSq 6pPq1ijZab66hHRoS6BHWS/xdQG0UfWek6Cq3yLNt+lx7b1GmqOeo3uT4+9QhCTbuj obYyb3hXWK+0f4QnJlejAIT2PVix0kDbobIpTmsJqi74OX4pei/3hFhpxQmVgnTisi P/T7JGHLrHYog== Date: Tue, 27 Jul 2021 19:12:04 +0100 From: Will Deacon To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, qperret@google.com, dbrazdil@google.com, Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH 12/16] mm/ioremap: Add arch-specific callbacks on ioremap/iounmap calls Message-ID: <20210727181203.GG19173@willie-the-truck> References: <20210715163159.1480168-1-maz@kernel.org> <20210715163159.1480168-13-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210715163159.1480168-13-maz@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210727_111209_508501_EE3DA60C X-CRM114-Status: GOOD ( 19.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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, Jul 15, 2021 at 05:31:55PM +0100, Marc Zyngier wrote: > Add a pair of hooks (ioremap_page_range_hook/iounmap_page_range_hook) > that can be implemented by an architecture. > > Signed-off-by: Marc Zyngier > --- > include/linux/io.h | 3 +++ > mm/ioremap.c | 13 ++++++++++++- > mm/vmalloc.c | 8 ++++++++ > 3 files changed, 23 insertions(+), 1 deletion(-) > > diff --git a/include/linux/io.h b/include/linux/io.h > index 9595151d800d..0ffc265f114c 100644 > --- a/include/linux/io.h > +++ b/include/linux/io.h > @@ -21,6 +21,9 @@ void __ioread32_copy(void *to, const void __iomem *from, size_t count); > void __iowrite64_copy(void __iomem *to, const void *from, size_t count); > > #ifdef CONFIG_MMU > +void ioremap_page_range_hook(unsigned long addr, unsigned long end, > + phys_addr_t phys_addr, pgprot_t prot); > +void iounmap_page_range_hook(phys_addr_t phys_addr, size_t size); > int ioremap_page_range(unsigned long addr, unsigned long end, > phys_addr_t phys_addr, pgprot_t prot); > #else Can we avoid these hooks by instead not registering the regions proactively in the guest and moving that logic to a fault handler which runs off the back of the injected data abort? From there, we could check if the faulting IPA is a memory address and register it as MMIO if not. Dunno, you've spent more time than me thinking about this, but just wondering if you'd had a crack at doing it that way, as it _seems_ simpler to my naive brain. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel