Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5829025imd; Wed, 31 Oct 2018 02:42:10 -0700 (PDT) X-Google-Smtp-Source: AJdET5d4zicxKaxasTvqCTWrYoyHdDKu3k94smuOQjWXNEHf0uzJ8tqqRMCIXbAjd54pib94c7gg X-Received: by 2002:a65:620f:: with SMTP id d15-v6mr2512182pgv.120.1540978930097; Wed, 31 Oct 2018 02:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540978930; cv=none; d=google.com; s=arc-20160816; b=dC+Z/cSU4Hrlsl8kQTwVWx4kMH3m17xOHKoKAdlaf6svwf8xeIzdm7h68KV3cpBBWr l0NbAHicHkfIqG7U1+iukvR0MG+E/YJGMzR2+dkBjYi2mRbMFZGy+TUK/ala5c/HjR9O taUuT9OPK4V5enuTkTxXIpRGJPpP5bA1RJ05vytLmTrrxHLabTRPuE1WdRFBjsE83Dxh wHP7IBbDQOB+w0wdxr07R+mxMiR+F4FUsfIq6zfLJ9qIShwd8iTliynSktQZGqfO0qMB lPvPzmfkwML+MOWsAw8Ru1qoyWtrCMhvhYeONElXnv12V3ML5S9XmUfywmFLdC4ybewU K3sQ== 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=2CQy1/VUW6sK32rDRikKm2BgIyWxCsrT0BkLa04nM8g=; b=gjUNk8hkDO3xLyh2s/par5t+qpeABCPRJz+DcLr6rbhYJ80UbAvfCbzD0mwyJB2r9+ +99RH0UDxNxe7Y5FLiaHfJlkZh5NPJU2PIW1AWrUpjDb80vhG1McyzkagzODwI3xQyiC eZPpAkvKzjTGd1Dp8cBRpvCfBbnDecTy2JjR9XudJu80jxmN7p4KuqyFUPhRe2DQt+DQ 6QDfwTcmWSzrp8HNkG42e0lCyB5BwlLPRbaEcN3Dnxwncwk2MLYI1VV8cdjKOSj8Qwuf fh34n8fVq80DwTCK+ysPjp4h55lKWW01y1dOnYp0yPCO4itLecuwrWVMUdhsc2GIWUK0 g9ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qu5lXJXB; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 144si979695pga.322.2018.10.31.02.41.55; Wed, 31 Oct 2018 02:42:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qu5lXJXB; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728072AbeJaShY (ORCPT + 99 others); Wed, 31 Oct 2018 14:37:24 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:45322 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727436AbeJaShY (ORCPT ); Wed, 31 Oct 2018 14:37:24 -0400 Received: by mail-vs1-f68.google.com with SMTP id 124so9562373vsp.12 for ; Wed, 31 Oct 2018 02:40:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2CQy1/VUW6sK32rDRikKm2BgIyWxCsrT0BkLa04nM8g=; b=Qu5lXJXBK9RNONC3MZlwsOXW1RJ15EZzd5fy3kXLq9ahNLw9yuMxp+9qccNdFQ0+yv HrUbCdQyy7qVrHquqd4k+pwee89htv6ObzCJsa9VTIof1yJh0RkUKR2pAwzg9mpDpK20 2hQn9c/V9GwfHv8dIpbazyl1dXhwqzQ6C8TK9HJTOrP1/CPCjcGClNjJYHbOppqx6c60 OsdOts5ijX6sU8CPwqZnBO7rhuH1+sDumxaXJT1DmahW+1ZT9KmiXFxZ0wfqCLFveRlh zSKXYxYbDEjYRZ+JqD1dRl3MbT5FYeFnuLejU7SeGXrBt5+s4SgickLgccAXwKyc1yqO eQ+w== 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=2CQy1/VUW6sK32rDRikKm2BgIyWxCsrT0BkLa04nM8g=; b=VWj3GSpEgTA9lS/G6h+lju8Io+bWt6zaRvKXooOf04VZKYYsOhlmCeGgerJmAuFRpE XvuDpBLI0loYWgvl+NtCHrIyTlZ+iyyQLTI1T+jvIawVbw4N9L5AdRyneM/TjitVo0+z eH0vOiZ4J9uVaAangLsAGePB18hRfUsx7UgDrtwfn3Tzq3lG4GAHnwXRCu93rW/x4clv 2KOmkVK316ld3SRcw9sp6GURU3HOjvbsFokIpsAL8/QH02/aSMV9UikDsUh7+rvzF3DQ hrRvTM1xEo3cXJ66yV3n/PWza1TIezbi2nDdpr9zjtYeaJA739mPJ2UANBxQE0m1oBnU LOsg== X-Gm-Message-State: AGRZ1gI14msHzRgKaN3SGBpN1p2llm07ih4iWAz5kRX85BnJ95Vcrr8w ywbs6G+ofovov2+gVQn2Q9yymgm0XQ1clRrS3zw= X-Received: by 2002:a67:41db:: with SMTP id x88mr939034vsf.138.1540978801689; Wed, 31 Oct 2018 02:40:01 -0700 (PDT) MIME-Version: 1.0 References: <20181025183739.9375-1-robert.foss@collabora.com> <20181025183739.9375-3-robert.foss@collabora.com> In-Reply-To: <20181025183739.9375-3-robert.foss@collabora.com> From: Emil Velikov Date: Wed, 31 Oct 2018 09:38:43 +0000 Message-ID: Subject: Re: [PATCH 2/5] drm/virtio: add uapi for in and out explicit fences To: Robert Foss Cc: David Airlie , Gerd Hoffmann , ML dri-devel , "open list:VIRTIO GPU DRIVER" , "Linux-Kernel@Vger. Kernel. Org" , Rob Herring , Gustavo Padovan , Emil Velikov 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 Hi Rob, On Thu, 25 Oct 2018 at 19:38, Robert Foss wrote: > > Add a new field called fence_fd that will be used by userspace to send > in-fences to the kernel and receive out-fences created by the kernel. > > This uapi enables virtio to take advantage of explicit synchronization of > dma-bufs. > > There are two new flags: > > * VIRTGPU_EXECBUF_FENCE_FD_IN to be used when passing an in-fence fd. > * VIRTGPU_EXECBUF_FENCE_FD_OUT to be used when requesting an out-fence fd > > The execbuffer IOCTL is now read-write to allow the userspace to read the > out-fence. > > On error -1 should be returned in the fence_fd field. > > Signed-off-by: Gustavo Padovan > Signed-off-by: Robert Foss > --- > Changes since v2: > - Since exbuf-flags is a new flag, check that unsupported > flags aren't set. > > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++++ > include/uapi/drm/virtgpu_drm.h | 13 ++++++++++--- > 2 files changed, 15 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > index d01a9ed100d1..1af289b28fc4 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c > @@ -116,9 +116,14 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, > struct ww_acquire_ctx ticket; > void *buf; > > + exbuf->fence_fd = -1; > + Move this after the sanity checking. > if (vgdev->has_virgl_3d == false) > return -ENOSYS; > > + if ((exbuf->flags & ~VIRTGPU_EXECBUF_FLAGS)) > + return -EINVAL; > + I assume this did this trigger when using old userspace? With those the patch is Reviewed-by: Emil Velikov Thanks Emil