Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp61732imm; Thu, 30 Aug 2018 08:19:29 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZBrpbM+lfLD5zQ8uRK87O+R6wzYIE0pleQxxg2lW9KbVUlaEj9pyyn9Y7DnYh8a+ANr9HE X-Received: by 2002:a63:d401:: with SMTP id a1-v6mr7976556pgh.414.1535642369116; Thu, 30 Aug 2018 08:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535642369; cv=none; d=google.com; s=arc-20160816; b=CSqYbDYY1GWV5ij6VfvLxqvyZv7Q2IN0fiOztqcu0ZT1yQaAljrR6b06vM0RRMH2TM Ejv+EIIK/hn0aRvq2KgshojhgW6rCGEXw6qid05ZVpV4UCXHYDgPHVfIeqOGTZkgN/sV BGKAyPMDoc/IwZYIGqsZrmCmiSfPqdNnH1JCj08MERm2k07qS/yLjVcqYgp8E2aOipLL SefnqjpbxLwsi0fJjVMk0rUbtwQlGcTU1ZTQ73g45xU7bKqlMR512N2dVnIsNIVgMvvk EscbK56AYWuDdcaExKvg9ylQTD5etbahPRzoG3N9oFlPxbxKsIJ33EESRSO+XVuj8ovG xeSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=g3p1bfIXsSB7Z2hjpqnQyMGSmdXU4Ji6V9Vdh9jtn/k=; b=lle5HKSMcariIY00X7K52Mx53TgbUo/xYmnu14OEFTEOGayP90KyRNpsUoUhLGfooH jAThWUNWeqXNzswg3gl/NIzeKb+yuPgiVDl8fkFj2AsLuWbU9ZsA7jj5PTUA9WCQgb/M 7fLr84hneapezfJCDsqcdB+V/qpQZIa5CNwdCneULEyUYaI1hcUDBaeSn4GGfcSBde8Z qdF+waCUGtnZ1j12zIT7NFblqX2VcY79+AcjF9sG7FmeER9coPrbe5ktw1qwsx5X4oM9 g1V2uBnNw8DboOUOCxnUI6fFzFVcQukkazgcSurCTP1uzSEn5AvErhSWLu8Wgyz51+Dq kK+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20-v6si6780275pgi.184.2018.08.30.08.19.13; Thu, 30 Aug 2018 08:19:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727227AbeH3TUR (ORCPT + 99 others); Thu, 30 Aug 2018 15:20:17 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:37284 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbeH3TUR (ORCPT ); Thu, 30 Aug 2018 15:20:17 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tomeu) with ESMTPSA id 562F9263ABC Subject: Re: [PATCH v6] Add udmabuf misc device To: Gerd Hoffmann Cc: dri-devel@lists.freedesktop.org, David Airlie , Laurent Pinchart , Jonathan Corbet , Sumit Semwal , Shuah Khan , "open list:DOCUMENTATION" , open list , "open list:DMA BUFFER SHARING FRAMEWORK" , "moderated list:DMA BUFFER SHARING FRAMEWORK" , "open list:KERNEL SELFTEST FRAMEWORK" , Zach Reizner , Daniel Stone References: <20180703075359.30349-1-kraxel@redhat.com> <20180703083757.GG7880@phenom.ffwll.local> <20180704055338.n3b7oexltaejqmcd@sirius.home.kraxel.org> <9818b301-9c9d-c703-d4fe-7c2d4d43ed66@collabora.com> <20180704080005.juutrwri4kxm7yim@sirius.home.kraxel.org> From: Tomeu Vizoso Message-ID: <06d8aa8d-5eac-64e2-f21e-43fe7ca96cc2@collabora.com> Date: Thu, 30 Aug 2018 17:17:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180704080005.juutrwri4kxm7yim@sirius.home.kraxel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/04/2018 10:00 AM, Gerd Hoffmann wrote: > On Wed, Jul 04, 2018 at 09:26:39AM +0200, Tomeu Vizoso wrote: >> On 07/04/2018 07:53 AM, Gerd Hoffmann wrote: >>> On Tue, Jul 03, 2018 at 10:37:57AM +0200, Daniel Vetter wrote: >>>> On Tue, Jul 03, 2018 at 09:53:58AM +0200, Gerd Hoffmann wrote: >>>>> A driver to let userspace turn memfd regions into dma-bufs. >>>>> >>>>> Use case: Allows qemu create dmabufs for the vga framebuffer or >>>>> virtio-gpu ressources. Then they can be passed around to display >>>>> those guest things on the host. To spice client for classic full >>>>> framebuffer display, and hopefully some day to wayland server for >>>>> seamless guest window display. >>>>> >>>>> qemu test branch: >>>>> https://git.kraxel.org/cgit/qemu/log/?h=sirius/udmabuf >>>>> >>>>> Cc: David Airlie >>>>> Cc: Tomeu Vizoso >>>>> Cc: Laurent Pinchart >>>>> Cc: Daniel Vetter >>>>> Signed-off-by: Gerd Hoffmann >>>> >>>> I think some ack for a 2nd use-case, like virtio-wl or whatever would be >>>> really cool. To give us some assurance that this is generically useful. >>> >>> Tomeu? Laurent? >> >> Sorry, but I think I will need some help to understand how this could help >> in the virtio-wl case [adding Zach Reizner to CC]. >> >> Any graphics buffers that are allocated with memfd will be shared with the >> compositor via wl_shm, without need for dmabufs. > > Within one machine, yes. Once virtualization is added to the mix things > become more complicated ... > > When using virtio-gpu the guest will allocate graphics buffers from > normal (guest) ram, then register these buffers (which are allowed to be > scattered) with the host as resource. > > qemu can use memfd to allocate guest ram. Now, with the help of > udmabuf, qemu can create a *host* dma-buf for the *guest* graphics > buffer. Guess each physical address in the iovec in VIRTIO_GPU_CMD_RESOURCE_ATTACH_BACKING can be passed as the offset in the udmabuf_create_item struct? > That dma-buf can be used by qemu internally (mmap it to get a linear > mapping of the resource, to avoid copying). It can be passed on to > spice-client, to display the guest framebuffer. > > And I think it could also be quite useful to pass guest wayland windows > to the host compositor, without mapping host-allocated buffers into the > guest, so we don't have do deal with the "find some address space for > the mapping" issue in the first place. Sounds good to me if the answer to the above is "yes". > There are more things needed to > complete this of course, but it's a building block ... Are you thinking of anything else besides passing the winsrv protocol across the guest/host boundary? Just wondering if I'm missing something. Thanks, Tomeu