Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1030632imu; Wed, 9 Jan 2019 10:19:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN4tqik+U4NvoMNn4f34fXjmz8l3XPUuk/Z+ja0rWi25lMWA7gyPAKfZcFN5ZXrrHZp5ovND X-Received: by 2002:a63:df13:: with SMTP id u19mr4185985pgg.294.1547057960253; Wed, 09 Jan 2019 10:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547057960; cv=none; d=google.com; s=arc-20160816; b=NfkcrTM9Fl+T1nDNtD77szO1Emfjdu0IpLpX8QnfgYHAMMH0Iun45tR/h4S5Q8bpTm 5cmDR2uXCtfd8Abl6CAhwYhM62Ip961WkqadEw/AFIsbjOYxMq/hKtOg7Bx+clX9AA6v MLeZwSEw/TDVmsjnSFftFvBZ8svne5ed7LQkM4OU0sShlk7aeyNrl08TA5MEIchDT/WS +Td7YlsImkLmRffiW5ECseJz0RhjRPALD2xpbBwp9JNZRSZP9524aS8bGAMHljl5GsvQ 068X/PQU3zGOSyTU+FDLh5Fih9Q6+osTPZPZiadUvejutbSjSKtLDGkavjrn9y262UPD PzWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=YUKfVyNlL9qZuc2QLDERIoYCjpm0wqKMkb6P4H4Z4a4=; b=J6tqEC3Bi8ErsBFSHxGrdY9KrfS1aqu7EoqT2CC/l8slck9yinIaN7N9MS1Z5UeMQP tpb8uGMmnFbsnQDgXnHMuL4YIt3H9TPsZofRr2xu2aK+9I1+H47iZOD/pd5HQccvg5bN MnX3VRjP6xe/VBiodu1jUIrJdsUU1CaksytEIRX0Y0VtGFGKsEA/ldbJzMetIqNP+/vK lfoPJvJtJ1CYW9bz0Gs8PkCWeusmo0tL9VP1tnkvIMesxSuSS2Dgz+7vMyFHxONBE4w0 pbumGqE1xs5nq0IzB53udf77ewYVDSugyH7aaHv9clVmhOifdnEwMGT0pnJ8b96sVv9Q 0bBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=jaCwocTt; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 133si74388143pfc.61.2019.01.09.10.19.05; Wed, 09 Jan 2019 10:19:20 -0800 (PST) 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; dkim=pass header.i=@ffwll.ch header.s=google header.b=jaCwocTt; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbfAIRgB (ORCPT + 99 others); Wed, 9 Jan 2019 12:36:01 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:37820 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727015AbfAIRgA (ORCPT ); Wed, 9 Jan 2019 12:36:00 -0500 Received: by mail-it1-f196.google.com with SMTP id b5so12193314iti.2 for ; Wed, 09 Jan 2019 09:36:00 -0800 (PST) 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=YUKfVyNlL9qZuc2QLDERIoYCjpm0wqKMkb6P4H4Z4a4=; b=jaCwocTt/bPE2YdhrAPxiUeNvnFkpM3FCu1zORaUkMPgY0me3m3AMXuRQN6t8JY42i /QzxphzoDqZfBSFP2A57JMII0J/PQgerGYgb8Lvm3K8Uize7LjeJCbhKhMzNIAH3+UrI CO73+b7WsFDYjKbFFBpUAm3JaVXU8J4eWAwpk= 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=YUKfVyNlL9qZuc2QLDERIoYCjpm0wqKMkb6P4H4Z4a4=; b=rgggXJS7swoTZdcUSOj6uyNZZzNW7XHS3edShtU+2Nqif3THD5talVC00J5NIu125w 1DVqouQ4RrJb4pefRzbwKjutZVzMkSDgLcE75Dm4cmq/uYFUm6Ho7f5FkBqC5rqyxBnr 4VEry686bk6+9kGj5zH5N6kdfBViiSpYxF0zwMvJ7EEsJhELGV+jjqvPobvuQxRbHwnf bUEHOExoPBkWmPXGOrsVdg338a5Tu7fpey2UCbnB+fu2khEhz4B3YrpCxRfHUe7gguGA ZHjlD1BiFAiKOggzq0vNaFI3W2TOxG9lcgnDZLRuANCA0Ya7VKSiTpSYjjhUDVMtyAjV ahHA== X-Gm-Message-State: AJcUukfy7n9d/Cv9QhtZf9IKQmj9jhMN2TCNTPPMKSrO+xsoWyhEpWam OGsPdjAuUePCCy7DYzZMEA+0ggcw3ENBFOOJPLiKhQ== X-Received: by 2002:a05:660c:344:: with SMTP id b4mr4755784itl.51.1547055359510; Wed, 09 Jan 2019 09:35:59 -0800 (PST) MIME-Version: 1.0 References: <20190108112519.27473-1-kraxel@redhat.com> <20190108112519.27473-16-kraxel@redhat.com> <20190109101044.GS21184@phenom.ffwll.local> <20190109145443.l5yus2pgvxcl4zbt@sirius.home.kraxel.org> In-Reply-To: <20190109145443.l5yus2pgvxcl4zbt@sirius.home.kraxel.org> From: Daniel Vetter Date: Wed, 9 Jan 2019 18:35:47 +0100 Message-ID: Subject: Re: [PATCH v2 15/15] drm/bochs: reserve bo for pin/unpin To: Gerd Hoffmann Cc: dri-devel , David Airlie , Oleksandr Andrushchenko , David Airlie , open list , "open list:DRM DRIVER FOR BOCHS VIRTUAL GPU" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 9, 2019 at 3:54 PM Gerd Hoffmann wrote: > > On Wed, Jan 09, 2019 at 11:10:44AM +0100, Daniel Vetter wrote: > > On Tue, Jan 08, 2019 at 12:25:19PM +0100, Gerd Hoffmann wrote: > > > The buffer object must be reserved before calling > > > ttm_bo_validate for pinning/unpinning. > > > > > > Signed-off-by: Gerd Hoffmann > > > > Seems a bit a bisect fumble in your series here: legacy kms code reserved > > the ttm bo before calling boch_bo_pin/unpin, your atomic code doesn't. I > > think pushing this into bochs_bo_pin/unpin makes sense for atomic, but to > > avoid bisect fail I think you need to have these temporarily in your > > cleanup/prepare_plane functions too. > > I think I've sorted that. Have some other changes too, will probably > send v3 tomorrow. > > > Looked through the entire series, this here is the only issue I think > > should be fixed before merging (making atomic_enable optional can be done > > as a follow-up if you feel like it). With that addressed on the series: > > > > Acked-by: Daniel Vetter > > Thanks. > > While being at it: I'm also looking at dma-buf export and import > support for the qemu drivers. > > Right now both qxl and virtio have gem_prime_get_sg_table and > gem_prime_import_sg_table handlers which throw a WARN_ONCE() and return > an error. > > If I understand things correctly it is valid to set all import/export > callbacks (prime_handle_to_fd, prime_fd_to_handle, > gem_prime_get_sg_table, gem_prime_import_sg_table) to NULL when not > supporting dma-buf import/export and still advertise DRIVER_PRIME to > indicate the other prime callbacks are supported (so generic fbdev > emulation can use gem_prime_vmap etc). Is that correct? I'm not sure how much that's a good idea ... Never thought about it tbh. All the fbdev/dma-buf stuff has plenty of hacks and inconsistencies still, so I guess we can't make it much worse really. > On exporting: > > TTM_PL_TT should be easy, just pin the buffer, grab the pages list and > feed that into drm_prime_pages_to_sg. Didn't try yet though. Is that > approach correct? > > Is it possible to export TTM_PL_VRAM objects (with backing storage being > a pci memory bar)? If so, how? Not really in general. amdgpu upcasts to amdgpu_bo (if it's amgpu BO) and then knows the internals so it can do a proper pci peer2peer mapping. Or at least there's been lots of patches floating around to make that happen. I think other drivers migrate the bo out of VRAM. > On importing: > > Importing into TTM_PL_TT object looks easy again, at least when the > object is actually stored in RAM. What if not? They are all supposed to be stored in RAM. Note that all current ttm importers totally break the abstraction, by taking the sg list, throwing the dma mapping away and assuming there's a struct page backing it. Would be good if we could stop spreading that abuse - the dma-buf interfaces have been modelled after the ttm bo interfaces, so shouldn't be too hard to wire this up correctly. > Importing into TTM_PL_VRAM: Impossible I think, without copying over > the data. Should that be done? If so, how? Or is it better to just > not support import then? Hm, since you ask about TTM concepts and not what this means in terms of dma-buf: As long as you upcast to the ttm_bo you can do whatever you want to really. But with plain dma-buf this doesn't work right now (least because ttm assumes it gets system RAM on import, in theory you could put the peer2peer dma mapping into the sg list and it should work). -Daniel > > thanks, > Gerd > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch