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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD6A8C433EF for ; Tue, 26 Oct 2021 19:05:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 2ED2460EC0 for ; Tue, 26 Oct 2021 19:05:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2ED2460EC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=movementarian.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:42752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfRlE-0001P1-5h for qemu-devel@archiver.kernel.org; Tue, 26 Oct 2021 15:05:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfRhi-0007ZJ-Ba for qemu-devel@nongnu.org; Tue, 26 Oct 2021 15:01:47 -0400 Received: from ssh.movementarian.org ([139.162.205.133]:48686 helo=movementarian.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfRhf-0000GD-1b for qemu-devel@nongnu.org; Tue, 26 Oct 2021 15:01:44 -0400 Received: from movement by movementarian.org with local (Exim 4.94) (envelope-from ) id 1mfRhb-0027Fj-Gr; Tue, 26 Oct 2021 20:01:39 +0100 Date: Tue, 26 Oct 2021 20:01:39 +0100 From: John Levon To: Elena Subject: Re: MMIO/PIO dispatch file descriptors (ioregionfd) design discussion Message-ID: References: <88ca79d2e378dcbfb3988b562ad2c16c4f929ac7.camel@gmail.com> <20211025152122.GA25901@nuker> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211025152122.GA25901@nuker> X-Url: http://www.movementarian.org/ Received-SPF: pass client-ip=139.162.205.133; envelope-from=movement@movementarian.org; helo=movementarian.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: john.g.johnson@oracle.com, jag.raman@oracle.com, kvm@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, qemu-devel@nongnu.org, eafanasova@gmail.com, Stefan Hajnoczi , felipe@nutanix.com, dinechin@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Mon, Oct 25, 2021 at 08:21:22AM -0700, Elena wrote: > > I'm curious what approach you want to propose for QEMU integration. A > > while back I thought about the QEMU API. It's possible to implement it > > along the lines of the memory_region_add_eventfd() API where each > > ioregionfd is explicitly added by device emulation code. An advantage of > > this approach is that a MemoryRegion can have multiple ioregionfds, but > > I'm not sure if that is a useful feature. > > > > This is the approach that is currently in the works. Agree, I dont see > much of the application here at this point to have multiple ioregions > per MemoryRegion. > I added Memory API/eventfd approach to the vfio-user as well to try > things out. > > > An alternative is to cover the entire MemoryRegion with one ioregionfd. > > That way the device emulation code can use ioregionfd without much fuss > > since there is a 1:1 mapping between MemoryRegions, which are already > > there in existing devices. There is no need to think deeply about which > > ioregionfds to create for a device. > > > > A new API called memory_region_set_aio_context(MemoryRegion *mr, > > AioContext *ctx) would cause ioregionfd (or a userspace fallback for > > non-KVM cases) to execute the MemoryRegion->read/write() accessors from > > the given AioContext. The details of ioregionfd are hidden behind the > > memory_region_set_aio_context() API, so the device emulation code > > doesn't need to know the capabilities of ioregionfd. > > > > > The second approach seems promising if we want more devices to use > > ioregionfd inside QEMU because it requires less ioregionfd-specific > > code. > > > I like this approach as well. > As you have mentioned, the device emulation code with first approach > does have to how to handle the region accesses. The second approach will > make things more transparent. Let me see how can I modify what there is > there now and may ask further questions. Sorry I'm a bit late to this discussion, I'm not clear on the above WRT vfio-user. If an ioregionfd has to cover a whole BAR0 (?), how would this interact with partly-mmap()able regions like we do with SPDK/vfio-user/NVMe? thanks john