From nobody Tue May 7 14:18:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1597299713; cv=none; d=zohomail.com; s=zohoarc; b=SoNixfurN0DlgFno/5l668Ik0RzP5ETX4YwB95ThTG6h+h8Xb2wDTi/E3w0UZEcKvc5wuOrTLJnV5haSgOLIC+OpRxQ2IEdIxvuLsAcXSiljCpNwR9yuFYFKetPdFmpf+wEoKE7d4jKanjJt6Wc30btf+99n6MESigmPJz+Ynqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597299713; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=C9rQWo6syT3cF37ubQbW7IMBpmbXyJ1+Ny4Hmm3+D9g=; b=PxCXEEeT4BUpqc5XzHAog54wCJfIRUOlz2k9uZB7w7bLGaIaXIUkrUrrsj9bCK14yMLKG7mL/EywwnF9w4CFTviD1xqq8fRWwcucVob/AygCJVbNI2Qe1TJdBcRg/ItqGaNMhYKm+o2FIRZOKkyHZVRyJX4N8zt9w+uB4kM8HWQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1597299713198183.25441791116407; Wed, 12 Aug 2020 23:21:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66c8-00026F-4w; Thu, 13 Aug 2020 06:21:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66c7-00025f-5K for xen-devel@lists.xenproject.org; Thu, 13 Aug 2020 06:21:23 +0000 Received: from mail-lj1-x243.google.com (unknown [2a00:1450:4864:20::243]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f6652202-d1b8-4314-92bd-23d5f617ab86; Thu, 13 Aug 2020 06:21:18 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id z14so4921460ljm.1 for ; Wed, 12 Aug 2020 23:21:18 -0700 (PDT) Received: from a2klaptop.localdomain ([185.199.97.5]) by smtp.gmail.com with ESMTPSA id f14sm964060lfd.2.2020.08.12.23.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 23:21:16 -0700 (PDT) X-Inumbo-ID: f6652202-d1b8-4314-92bd-23d5f617ab86 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=C9rQWo6syT3cF37ubQbW7IMBpmbXyJ1+Ny4Hmm3+D9g=; b=IdrdS+jhl4Oa2APlUEh5hsmWHLnjlvcEeLbNwd/9wCAajQpSXHE0zHJiFdgcdiK26J WFO1pugdzNj04qdFOagFuIp86Sv+478MpJWML1/H1kFhojn/ZOWrcGdudLoSBrsxQlzR EcAC59A3E3nwwwp9ENtv3ctQM7YTyIq69C2d3wIoR6R4PQMfsF7LGC2lLBut5bKO3Zu/ 4WoL1gVFon0Xdx/deulTB/UQkk/ztsecEql/JO68s3NP1mEPDzfT/LNeQz9VllyIv0PT 9Tj8AssK9SOO8AwcvjXm8WGOQKyaIJFbORNO4CgMimKGYH01+Ebjmr55PZr3TuSs8iQd jupg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=C9rQWo6syT3cF37ubQbW7IMBpmbXyJ1+Ny4Hmm3+D9g=; b=gwVgcolGLpiZfwKKl4BDnOtpUyCvhJl3HzTlEku1LA8pFE9jQSJF05FNj6VBIUmfEr 6KP61ADiitUy0GNZmA0eCYEWOawIgoRS1+kySaHYx4s91n30/rfXDSFJtA4fIssVcKE3 Wlm3dGtZW2ALBTW4Lr1/hOZoC04LZUPxUibeDA4D3DIpg/wFFewLRGjdQ+TKH8m8eL7m ZRtJCqg4ewQzit3jrNZd+ApymA8frWzpUeA/aCgOPEtQD9qzjbhONbUY/RgUflr8eJNc hOwCL9d8S29ZXHVeIHOLkdP2fo0RnUuF7u5+fW+fXBFFYhygw3iDqtzcU0bRM5H5iyc3 gFlg== X-Gm-Message-State: AOAM531fHde+L7Cg305ENj/4FSZRQUs2q3GzgxtmbU7lkmFZ8Pi8+Hqu ZpUq/Q6jKHcS4VAigqbSGYL/tx/vORk= X-Google-Smtp-Source: ABdhPJw/Ec8BtgwxAUxLq9z6Cta34KMASOkvjBC0EU4THFS9zVDqv01yrhycLJUzJXCaRxXFKv6jLg== X-Received: by 2002:a2e:8098:: with SMTP id i24mr1308903ljg.50.1597299676613; Wed, 12 Aug 2020 23:21:16 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com, airlied@linux.ie, daniel@ffwll.ch Cc: sstabellini@kernel.org, dan.carpenter@oracle.com, intel-gfx@lists.freedesktop.org, Oleksandr Andrushchenko , stable@vger.kernel.org Subject: [PATCH v2 1/5] xen/gntdev: Fix dmabuf import with non-zero sgt offset Date: Thu, 13 Aug 2020 09:21:09 +0300 Message-Id: <20200813062113.11030-2-andr2000@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200813062113.11030-1-andr2000@gmail.com> References: <20200813062113.11030-1-andr2000@gmail.com> X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko It is possible that the scatter-gather table during dmabuf import has non-zero offset of the data, but user-space doesn't expect that. Fix this by failing the import, so user-space doesn't access wrong data. Fixes: bf8dc55b1358 ("xen/gntdev: Implement dma-buf import functionality") Signed-off-by: Oleksandr Andrushchenko Acked-by: Juergen Gross Cc: --- drivers/xen/gntdev-dmabuf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c index 75d3bb948bf3..b1b6eebafd5d 100644 --- a/drivers/xen/gntdev-dmabuf.c +++ b/drivers/xen/gntdev-dmabuf.c @@ -613,6 +613,14 @@ dmabuf_imp_to_refs(struct gntdev_dmabuf_priv *priv, st= ruct device *dev, goto fail_detach; } =20 + /* Check that we have zero offset. */ + if (sgt->sgl->offset) { + ret =3D ERR_PTR(-EINVAL); + pr_debug("DMA buffer has %d bytes offset, user-space expects 0\n", + sgt->sgl->offset); + goto fail_unmap; + } + /* Check number of pages that imported buffer has. */ if (attach->dmabuf->size !=3D gntdev_dmabuf->nr_pages << PAGE_SHIFT) { ret =3D ERR_PTR(-EINVAL); --=20 2.17.1 From nobody Tue May 7 14:18:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1597299713; cv=none; d=zohomail.com; s=zohoarc; b=CxVKFYCgnGdispy5wOl6KeA69+kjXbbCNU8h/Ubyqa7Yp01nZrFZgiLjnJvNrNYh8SYtuzWQTvLtdC2YWt5BmUDQQOv+9j38DF1oNJiLH620icv1PrT6f+i4cPlcsX9WEJrMPMz+GwiqNPmBJxbn6OrbFzKHRtvDf9hNTpPnV6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597299713; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=J4NK2JZREwBhnLoP8/oKs+IVAcm9xle+iSBy8U4z3uI=; b=Cu945QANkik0V8PF9pIfq56eZU282LmpaMcnsWx2nVdkFxsHiANe5PK3f2SZDuS/X2u1/SkdsjDdQ2V4z1CFpumhZHXZle+R4+R1IfX3cbBMKmayD9XTW2hm2fyjR6J5Mb+YMTpNv9BIbuz9haXZYIZqTLe+qTTJtEPyZY4bZuc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1597299713082625.6421769680182; Wed, 12 Aug 2020 23:21:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66cD-00026f-Dq; Thu, 13 Aug 2020 06:21:29 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66cC-00025f-5U for xen-devel@lists.xenproject.org; Thu, 13 Aug 2020 06:21:28 +0000 Received: from mail-lj1-x243.google.com (unknown [2a00:1450:4864:20::243]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0134c6c2-0204-4790-b0da-f0f69c597350; Thu, 13 Aug 2020 06:21:19 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id g6so4870003ljn.11 for ; Wed, 12 Aug 2020 23:21:19 -0700 (PDT) Received: from a2klaptop.localdomain ([185.199.97.5]) by smtp.gmail.com with ESMTPSA id f14sm964060lfd.2.2020.08.12.23.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 23:21:17 -0700 (PDT) X-Inumbo-ID: 0134c6c2-0204-4790-b0da-f0f69c597350 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=J4NK2JZREwBhnLoP8/oKs+IVAcm9xle+iSBy8U4z3uI=; b=aMsveTfmby4Jw6uZ+ZeNPtXeBO0gQ0qkTmqC/9GrQOVuWB2lYmn7iPmMxxLa9ydpUl 1ylGuVEH+1dx7jR4VZAnJ0/IqCUZA0kh2ntvDKRpJX7EAS7PKDZO25kQN0OBiSsLWgqk 6ep8OJjrrrgUCkcHjNkEeZKLo1g1yDwBhwP188aNxjstn2flQIKvfiD5B0G03ZEem1wP gFvA3eKEh+C2hudMtuVXaSRwDie8PLK8REizod4HzNkbb64NndYRRu8+JKDmQPqsVGV9 Oafv3T6RBhtsBy13Uy8ZNETtPfwU8vvpoLLHBukwgbdFMCEWpOI2QP+FIC4g+yctIKkV FJhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=J4NK2JZREwBhnLoP8/oKs+IVAcm9xle+iSBy8U4z3uI=; b=oxad2HosmwNszq0p+KDFp+X2SF6zDXj0rnOULJ2ab/yR9VgRKh5RKbPeJNr7rCF5cm oLJOnvjTuL9YfI+B8Gwg7uFK4mZgEk7GMnKJA24z31Ov0CyffzlopIFhRz/55eTsMyqN EbnK4HwzUIjhQKUDr+dyj3iZ+rRg1egcBYlSJq+/cfXcYAL7zFz6BWI3bOOzUM3Ta0eP y2nmuEsjl/5utv8FlO4OcygV894xswIDXgpyPHaYSMqbivcp9FO+a+SHNfgpbE2yAz/u FrmMqw93+ZWN27ghDtclG2Xx6NEs5Vw75qzzFveG/n66bewancmexv7X+Nrpozx3/7aq FZog== X-Gm-Message-State: AOAM53282fbpKDMSxSZJRGPreDQ0ZJOT9UgKCJ7Y+CA2bqFPLqgfhkdF FZWfCvL3iapf8i6iwjy4bGnK7EbcRWc= X-Google-Smtp-Source: ABdhPJzAgt09V5g8MNNXCmLRERCspKuYMmlsFKj8ZycK52qZyUCILtyFM0t9o9rPEpdwEPlvkRh5Zg== X-Received: by 2002:a2e:3615:: with SMTP id d21mr1286683lja.333.1597299677965; Wed, 12 Aug 2020 23:21:17 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com, airlied@linux.ie, daniel@ffwll.ch Cc: sstabellini@kernel.org, dan.carpenter@oracle.com, intel-gfx@lists.freedesktop.org, Oleksandr Andrushchenko , stable@vger.kernel.org Subject: [PATCH v2 2/5] drm/xen-front: Fix misused IS_ERR_OR_NULL checks Date: Thu, 13 Aug 2020 09:21:10 +0300 Message-Id: <20200813062113.11030-3-andr2000@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200813062113.11030-1-andr2000@gmail.com> References: <20200813062113.11030-1-andr2000@gmail.com> X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko The patch c575b7eeb89f: "drm/xen-front: Add support for Xen PV display frontend" from Apr 3, 2018, leads to the following static checker warning: drivers/gpu/drm/xen/xen_drm_front_gem.c:140 xen_drm_front_gem_create() warn: passing zero to 'ERR_CAST' drivers/gpu/drm/xen/xen_drm_front_gem.c 133 struct drm_gem_object *xen_drm_front_gem_create(struct drm_device *= dev, 134 size_t size) 135 { 136 struct xen_gem_object *xen_obj; 137 138 xen_obj =3D gem_create(dev, size); 139 if (IS_ERR_OR_NULL(xen_obj)) 140 return ERR_CAST(xen_obj); Fix this and the rest of misused places with IS_ERR_OR_NULL in the driver. Fixes: c575b7eeb89f: "drm/xen-front: Add support for Xen PV display fronte= nd" Signed-off-by: Oleksandr Andrushchenko Reported-by: Dan Carpenter Reviewed-by: Dan Carpenter Cc: --- drivers/gpu/drm/xen/xen_drm_front.c | 4 ++-- drivers/gpu/drm/xen/xen_drm_front_gem.c | 8 ++++---- drivers/gpu/drm/xen/xen_drm_front_kms.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_= drm_front.c index 1fd458e877ca..51818e76facd 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.c +++ b/drivers/gpu/drm/xen/xen_drm_front.c @@ -400,8 +400,8 @@ static int xen_drm_drv_dumb_create(struct drm_file *fil= p, args->size =3D args->pitch * args->height; =20 obj =3D xen_drm_front_gem_create(dev, args->size); - if (IS_ERR_OR_NULL(obj)) { - ret =3D PTR_ERR_OR_ZERO(obj); + if (IS_ERR(obj)) { + ret =3D PTR_ERR(obj); goto fail; } =20 diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/= xen_drm_front_gem.c index f0b85e094111..4ec8a49241e1 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c @@ -83,7 +83,7 @@ static struct xen_gem_object *gem_create(struct drm_devic= e *dev, size_t size) =20 size =3D round_up(size, PAGE_SIZE); xen_obj =3D gem_create_obj(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return xen_obj; =20 if (drm_info->front_info->cfg.be_alloc) { @@ -117,7 +117,7 @@ static struct xen_gem_object *gem_create(struct drm_dev= ice *dev, size_t size) */ xen_obj->num_pages =3D DIV_ROUND_UP(size, PAGE_SIZE); xen_obj->pages =3D drm_gem_get_pages(&xen_obj->base); - if (IS_ERR_OR_NULL(xen_obj->pages)) { + if (IS_ERR(xen_obj->pages)) { ret =3D PTR_ERR(xen_obj->pages); xen_obj->pages =3D NULL; goto fail; @@ -136,7 +136,7 @@ struct drm_gem_object *xen_drm_front_gem_create(struct = drm_device *dev, struct xen_gem_object *xen_obj; =20 xen_obj =3D gem_create(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return ERR_CAST(xen_obj); =20 return &xen_obj->base; @@ -194,7 +194,7 @@ xen_drm_front_gem_import_sg_table(struct drm_device *de= v, =20 size =3D attach->dmabuf->size; xen_obj =3D gem_create_obj(dev, size); - if (IS_ERR_OR_NULL(xen_obj)) + if (IS_ERR(xen_obj)) return ERR_CAST(xen_obj); =20 ret =3D gem_alloc_pages_array(xen_obj, size); diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/= xen_drm_front_kms.c index 78096bbcd226..ef11b1e4de39 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c @@ -60,7 +60,7 @@ fb_create(struct drm_device *dev, struct drm_file *filp, int ret; =20 fb =3D drm_gem_fb_create_with_funcs(dev, filp, mode_cmd, &fb_funcs); - if (IS_ERR_OR_NULL(fb)) + if (IS_ERR(fb)) return fb; =20 gem_obj =3D fb->obj[0]; --=20 2.17.1 From nobody Tue May 7 14:18:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1597299713; cv=none; d=zohomail.com; s=zohoarc; b=ew02gA5IRFmiZylsqsr3uag3QUaWwp7/ciFYLThaSUu2kCt7s36JtnGUjEvU19pI5xgKps1pF6X0riNUqp775ZKeVu/6q0I48P6HEQrVdNHJ19+132enN0GIjns0b9aaADBT4EhKgh6AMZlcBjLxg74G6sB78gjhh4DFMtKBPpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597299713; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mV6j1YOlt73/vZbx39+AFv7LWnETp8Vud91G3AB3D38=; b=aUYv8lpiioazJ/69/g/zowsJosg9AoFnPpa3qfYRGQut42U/OZHNM3hKUv25PJs+1Sx2NJPPjEevGIfEbG8lerAnUvxGp7sePlvm1MAiN24A4ZG9ilrDRki2fEgv7NVrhSXKz5+Cqpnfl7zCEwO4xzT3lETpDkPTdixBzA2Ieo0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1597299713084101.34760444890446; Wed, 12 Aug 2020 23:21:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66cI-00027K-Ms; Thu, 13 Aug 2020 06:21:34 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66cH-00025f-5Z for xen-devel@lists.xenproject.org; Thu, 13 Aug 2020 06:21:33 +0000 Received: from mail-lj1-x244.google.com (unknown [2a00:1450:4864:20::244]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3877cb2f-ec08-4066-bb57-2f82414a8bb1; Thu, 13 Aug 2020 06:21:20 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id t6so4887021ljk.9 for ; Wed, 12 Aug 2020 23:21:20 -0700 (PDT) Received: from a2klaptop.localdomain ([185.199.97.5]) by smtp.gmail.com with ESMTPSA id f14sm964060lfd.2.2020.08.12.23.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 23:21:18 -0700 (PDT) X-Inumbo-ID: 3877cb2f-ec08-4066-bb57-2f82414a8bb1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mV6j1YOlt73/vZbx39+AFv7LWnETp8Vud91G3AB3D38=; b=X1HwcSp96q0CP6XQhQs1GPo4nvPWoE+L2nDF9ZIDpZERw+rLiB/bEU8Te/A/TZJwkY mzhpjqBC43Z7FmQs5BkoYUSqU00bNuiM9TP22ps5RBUCgoV4ZKi60dhMorf9RPuguvA6 4fJcM/d1wkeekHTE4FSDqDmLHrjLrQIS3JmTLdjKyngRnCxATKCAbkC3rOV0A8YSslEe TwMAWkKQvK3XwuP5Np6ZFuqdw+2z2u6WSfh88ZM2rvbGA9OIbIlxxnOWSJYEK8z1AU4o xnKrJYGQ/x7V3n1WM+bFyErLhocUGoQ8HA9vmdK2oTnr1U1XZiQuXYUXxCIbxRnGYR7N tvDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mV6j1YOlt73/vZbx39+AFv7LWnETp8Vud91G3AB3D38=; b=j2axyh9ypdAcFawTB0yzZICWl5YGZhuytNTNoq6j/QB4b9xnlYqg+kyKo/jyxxxlmm eS04uKP7g/vPXIU7sVCeB2M1z7276xlvRZN/m0xRz5Nq+9orEZ51EL26d1tTiPzKXquM U0WA4hO3iYQIpNEvld3QKsMxWeFcEMkkjWT7QlNEEH+2hW63wYyfFi+JVmriLNUXuPyc ZXsz32i52+BXFNT+2z3ffwoNfYsM7YJxqUDYcPvXI6TqPNl473yveqCviyrJYUalYWoL vCjfUVGU6n7PA0+4IL/bfA6oTML5I7EB/Z8bXWe77OwesT++Ok0fx0Ble1WJJTuvcIlU aSQA== X-Gm-Message-State: AOAM532qAzeZyIRossfhDyLURlfXnarln1DCRXm2aki1lHSE2iA+pNG+ BqnKBLcHCetQFw4vnEKey7WsRgX9HZA= X-Google-Smtp-Source: ABdhPJyccRfWxWmuepWebwNoe1LCZJoc+bCL+PgtqKkfshXws5t6wobDOmvACsoPZG83M+Ft4/SImQ== X-Received: by 2002:a2e:3c03:: with SMTP id j3mr1259425lja.397.1597299679335; Wed, 12 Aug 2020 23:21:19 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com, airlied@linux.ie, daniel@ffwll.ch Cc: sstabellini@kernel.org, dan.carpenter@oracle.com, intel-gfx@lists.freedesktop.org, Oleksandr Andrushchenko Subject: [PATCH v2 3/5] drm/xen-front: Add YUYV to supported formats Date: Thu, 13 Aug 2020 09:21:11 +0300 Message-Id: <20200813062113.11030-4-andr2000@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200813062113.11030-1-andr2000@gmail.com> References: <20200813062113.11030-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) From: Oleksandr Andrushchenko Add YUYV to supported formats, so the frontend can work with the formats used by cameras and other HW. Signed-off-by: Oleksandr Andrushchenko Acked-by: Noralf Tr=C3=B8nnes --- drivers/gpu/drm/xen/xen_drm_front_conn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/xen/xen_drm_front_conn.c b/drivers/gpu/drm/xen= /xen_drm_front_conn.c index 459702fa990e..44f1f70c0aed 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_conn.c +++ b/drivers/gpu/drm/xen/xen_drm_front_conn.c @@ -33,6 +33,7 @@ static const u32 plane_formats[] =3D { DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555, DRM_FORMAT_ARGB1555, + DRM_FORMAT_YUYV, }; =20 const u32 *xen_drm_front_conn_get_formats(int *format_count) --=20 2.17.1 From nobody Tue May 7 14:18:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1597299715; cv=none; d=zohomail.com; s=zohoarc; b=eJoyL10hnMZO7o6xL8HAtArRypJstGOxB/B0tHlCwMzUk9tCXc8SWXGxTOkWAqpqRcZO7Qx9YYB1DGpg+K8NUMI/nhROS1RHwkFw18AKeEpF63VqaAFNc8JiYm/8FK7AiYVtsS+oUzz8VD13UaAiBiHN/hgme73VpfL4MFrgn+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597299715; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=IH75Bnms5DPUZxVd4scsKK5yOA6U4dgdsyqfLFTRRs0=; b=DJxpuuxeMFKyeWbHXPM+azZ8agoiX/S5KoyghgOnhmmVfWPXGYOafmt/J4cn6ALdZk/73ZOcIZF7OUCM5RnD+oJDE5pEUJ0nmYk5tDuimcaPNg62m4AHkvU12ZPiPhMixy21QT2YVfwqX5HygRCT6TqR2+CkSrk76fWQzd+J5zk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1597299715610664.7455470229271; Wed, 12 Aug 2020 23:21:55 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66cO-00029S-0V; Thu, 13 Aug 2020 06:21:40 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66cM-00025f-5i for xen-devel@lists.xenproject.org; Thu, 13 Aug 2020 06:21:38 +0000 Received: from mail-lj1-x22a.google.com (unknown [2a00:1450:4864:20::22a]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ce68b61a-6bc4-4276-8496-256b8c641462; Thu, 13 Aug 2020 06:21:22 +0000 (UTC) Received: by mail-lj1-x22a.google.com with SMTP id g6so4870133ljn.11 for ; Wed, 12 Aug 2020 23:21:22 -0700 (PDT) Received: from a2klaptop.localdomain ([185.199.97.5]) by smtp.gmail.com with ESMTPSA id f14sm964060lfd.2.2020.08.12.23.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 23:21:20 -0700 (PDT) X-Inumbo-ID: ce68b61a-6bc4-4276-8496-256b8c641462 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IH75Bnms5DPUZxVd4scsKK5yOA6U4dgdsyqfLFTRRs0=; b=QKKKrIiwcWdX5YYhi+IBDzFnMzjp6BoSprArgCKJGaFTAFllL2t0ucD3tGKgBwpFvN in6kuJpiVUtaHTQ3TW4R/yzg0P2l0ntv2OQXzVQGcjgkUhOYlrGRAGy8n/Iyk8q8BFeu 0S/pdYd7UYA/6paTgZms7xIXYMQgqQ9+8vtFqsuCQljaX/b4OSlc1s21jKsJqgd6jG+K StlWFVqsso5qkm3ZKbZfI/OYTvxWcpOjGenmx423rC41g52XKhksvmFWK7vYLG9BZ0oN hbwz5PzY8SVWx8BqvGgFNteRAgZmgIGQ7p1Pkkaxh+eqmGutPo5m7+oEyxVuY+ptdRtO 4biQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IH75Bnms5DPUZxVd4scsKK5yOA6U4dgdsyqfLFTRRs0=; b=seAuTcz/LsJwNipPJMGbkz05lwl1+cf++5GPbZTz6LZby4BGt36kZT++TQhbud4hw6 r/Pw+9l8PDCYMzUUzaTJNvKVfcONC6Dx3PZGtyFbq+fiAqGPf77XcwChEZzoiiak2y8+ u7LfbpVxnJsQt66kYElHy/mfCvkyne94Iio5+xw9F/fyevzHk0BZ12E8BdGHL0kVg/zs onCoSp3UQprQBl7prfzlQ9Z9M5h029WmbQXE6QZbnY0a4DgidBac/+Qg66LaQSoeIAvh diRCpGLdDfdQwqHL4bJ/LpiD/a4gAIzDA2AZp7mrZplUlrIuaIAeKyaUz5JAcotOHREN LAyA== X-Gm-Message-State: AOAM531iqKphUIQhWyHlMYVXo4tU9hJxBMMzgOYgIETQ6Hp5h/MGPIup blHV+MN3ytCf/vpuijEHiB7bY5Ecwno= X-Google-Smtp-Source: ABdhPJzZ/6L5Z/fBwUE4Dex+np7ONiwAFJpUyzfR48jKW7Q6gk4iOCDuNNlT3JqaSw4e0sXtMyhQ8w== X-Received: by 2002:a2e:804b:: with SMTP id p11mr1352175ljg.221.1597299680641; Wed, 12 Aug 2020 23:21:20 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com, airlied@linux.ie, daniel@ffwll.ch Cc: sstabellini@kernel.org, dan.carpenter@oracle.com, intel-gfx@lists.freedesktop.org, Oleksandr Andrushchenko Subject: [PATCH v2 4/5] xen: Sync up with the canonical protocol definition in Xen Date: Thu, 13 Aug 2020 09:21:12 +0300 Message-Id: <20200813062113.11030-5-andr2000@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200813062113.11030-1-andr2000@gmail.com> References: <20200813062113.11030-1-andr2000@gmail.com> X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Oleksandr Andrushchenko This is the sync up with the canonical definition of the display protocol in Xen. 1. Add protocol version as an integer Version string, which is in fact an integer, is hard to handle in the code that supports different protocol versions. To simplify that also add the version as an integer. 2. Pass buffer offset with XENDISPL_OP_DBUF_CREATE There are cases when display data buffer is created with non-zero offset to the data start. Handle such cases and provide that offset while creating a display buffer. 3. Add XENDISPL_OP_GET_EDID command Add an optional request for reading Extended Display Identification Data (EDID) structure which allows better configuration of the display connectors over the configuration set in XenStore. With this change connectors may have multiple resolutions defined with respect to detailed timing definitions and additional properties normally provided by displays. If this request is not supported by the backend then visible area is defined by the relevant XenStore's "resolution" property. If backend provides extended display identification data (EDID) with XENDISPL_OP_GET_EDID request then EDID values must take precedence over the resolutions defined in XenStore. 4. Bump protocol version to 2. Signed-off-by: Oleksandr Andrushchenko Reviewed-by: Juergen Gross --- include/xen/interface/io/displif.h | 91 +++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 3 deletions(-) diff --git a/include/xen/interface/io/displif.h b/include/xen/interface/io/= displif.h index fdc279dc4a88..d43ca0361f86 100644 --- a/include/xen/interface/io/displif.h +++ b/include/xen/interface/io/displif.h @@ -38,7 +38,8 @@ * Protocol version *************************************************************************= ***** */ -#define XENDISPL_PROTOCOL_VERSION "1" +#define XENDISPL_PROTOCOL_VERSION "2" +#define XENDISPL_PROTOCOL_VERSION_INT 2 =20 /* *************************************************************************= ***** @@ -202,6 +203,9 @@ * Width and height of the connector in pixels separated by * XENDISPL_RESOLUTION_SEPARATOR. This defines visible area of the * display. + * If backend provides extended display identification data (EDID) wi= th + * XENDISPL_OP_GET_EDID request then EDID values must take precedence + * over the resolutions defined here. * *------------------ Connector Request Transport Parameters --------------= ----- * @@ -349,6 +353,8 @@ #define XENDISPL_OP_FB_DETACH 0x13 #define XENDISPL_OP_SET_CONFIG 0x14 #define XENDISPL_OP_PG_FLIP 0x15 +/* The below command is available in protocol version 2 and above. */ +#define XENDISPL_OP_GET_EDID 0x16 =20 /* *************************************************************************= ***** @@ -377,6 +383,10 @@ #define XENDISPL_FIELD_BE_ALLOC "be-alloc" #define XENDISPL_FIELD_UNIQUE_ID "unique-id" =20 +#define XENDISPL_EDID_BLOCK_SIZE 128 +#define XENDISPL_EDID_BLOCK_COUNT 256 +#define XENDISPL_EDID_MAX_SIZE (XENDISPL_EDID_BLOCK_SIZE * XENDISPL_EDID_= BLOCK_COUNT) + /* *************************************************************************= ***** * STATUS RETURN CODES @@ -451,7 +461,9 @@ * +----------------+----------------+----------------+----------------+ * | gref_directory | 40 * +----------------+----------------+----------------+----------------+ - * | reserved | 44 + * | data_ofs | 44 + * +----------------+----------------+----------------+----------------+ + * | reserved | 48 * +----------------+----------------+----------------+----------------+ * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| * +----------------+----------------+----------------+----------------+ @@ -494,6 +506,7 @@ * buffer size (buffer_sz) exceeds what can be addressed by this single = page, * then reference to the next page must be supplied (see gref_dir_next_p= age * below) + * data_ofs - uint32_t, offset of the data in the buffer, octets */ =20 #define XENDISPL_DBUF_FLG_REQ_ALLOC (1 << 0) @@ -506,6 +519,7 @@ struct xendispl_dbuf_create_req { uint32_t buffer_sz; uint32_t flags; grant_ref_t gref_directory; + uint32_t data_ofs; }; =20 /* @@ -731,6 +745,44 @@ struct xendispl_page_flip_req { uint64_t fb_cookie; }; =20 +/* + * Request EDID - request EDID describing current connector: + * 0 1 2 3 oct= et + * +----------------+----------------+----------------+----------------+ + * | id | _OP_GET_EDID | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | buffer_sz | 8 + * +----------------+----------------+----------------+----------------+ + * | gref_directory | 12 + * +----------------+----------------+----------------+----------------+ + * | reserved | 16 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 64 + * +----------------+----------------+----------------+----------------+ + * + * Notes: + * - This command is not available in protocol version 1 and should be + * ignored. + * - This request is optional and if not supported then visible area + * is defined by the relevant XenStore's "resolution" property. + * - Shared buffer, allocated for EDID storage, must not be less then + * XENDISPL_EDID_MAX_SIZE octets. + * + * buffer_sz - uint32_t, buffer size to be allocated, octets + * gref_directory - grant_ref_t, a reference to the first shared page + * describing EDID buffer references. See XENDISPL_OP_DBUF_CREATE for + * grant page directory structure (struct xendispl_page_directory). + * + * See response format for this request. + */ + +struct xendispl_get_edid_req { + uint32_t buffer_sz; + grant_ref_t gref_directory; +}; + /* *---------------------------------- Responses ---------------------------= ----- * @@ -753,6 +805,35 @@ struct xendispl_page_flip_req { * id - uint16_t, private guest value, echoed from request * status - int32_t, response status, zero on success and -XEN_EXX on fail= ure * + * + * Get EDID response - response for XENDISPL_OP_GET_EDID: + * 0 1 2 3 oct= et + * +----------------+----------------+----------------+----------------+ + * | id | operation | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | status | 8 + * +----------------+----------------+----------------+----------------+ + * | edid_sz | 12 + * +----------------+----------------+----------------+----------------+ + * | reserved | 16 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 64 + * +----------------+----------------+----------------+----------------+ + * + * Notes: + * - This response is not available in protocol version 1 and should be + * ignored. + * + * edid_sz - uint32_t, size of the EDID, octets + */ + +struct xendispl_get_edid_resp { + uint32_t edid_sz; +}; + +/* *----------------------------------- Events -----------------------------= ----- * * Events are sent via a shared page allocated by the front and propagated= by @@ -804,6 +885,7 @@ struct xendispl_req { struct xendispl_fb_detach_req fb_detach; struct xendispl_set_config_req set_config; struct xendispl_page_flip_req pg_flip; + struct xendispl_get_edid_req get_edid; uint8_t reserved[56]; } op; }; @@ -813,7 +895,10 @@ struct xendispl_resp { uint8_t operation; uint8_t reserved; int32_t status; - uint8_t reserved1[56]; + union { + struct xendispl_get_edid_resp get_edid; + uint8_t reserved1[56]; + } op; }; =20 struct xendispl_evt { --=20 2.17.1 From nobody Tue May 7 14:18:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1597299720; cv=none; d=zohomail.com; s=zohoarc; b=brGm1njhFNwx7lAI6tCG+HD/p5zQME/4jGMbM5JOjGJWL3nv5j52MH2LwUAHKyTPb/SI4I7LnJNKKaJ4JKYy3vf+h5Fbr2/JG0nyyknqlZOhnhHPXjuDbOAwEkf/1tG8VlZLOvxGOiHphq/rXl+rKw30wOQEPX0vmsj11bqa+yg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597299720; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ic1tOm+qheUq6zWKsHFH8/lisv9bz4c0DNj333ORfFc=; b=eNlJ2MRTgAxZ4U8XE6fNM4O5gawKfgvCl7H/zAraOMBBlwE8xGZYvSFiF6rsdGwiofxc4GpQF+523WoKK+154ogvRft21F/l0l54fcY+u4bEXPWnJ4tmL+2h2QLuFHluruw9SxgbIwEJsekA1b/3Y1QX2KqwrdzA6XjyP3xKq44= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1597299720395334.7519646273005; Wed, 12 Aug 2020 23:22:00 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66cT-0002B7-AH; Thu, 13 Aug 2020 06:21:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k66cR-00025f-61 for xen-devel@lists.xenproject.org; Thu, 13 Aug 2020 06:21:43 +0000 Received: from mail-lj1-x242.google.com (unknown [2a00:1450:4864:20::242]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8ddc9c75-aeb6-4b75-a122-e52647d5a2af; Thu, 13 Aug 2020 06:21:23 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id 185so4895523ljj.7 for ; Wed, 12 Aug 2020 23:21:23 -0700 (PDT) Received: from a2klaptop.localdomain ([185.199.97.5]) by smtp.gmail.com with ESMTPSA id f14sm964060lfd.2.2020.08.12.23.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 23:21:21 -0700 (PDT) X-Inumbo-ID: 8ddc9c75-aeb6-4b75-a122-e52647d5a2af DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ic1tOm+qheUq6zWKsHFH8/lisv9bz4c0DNj333ORfFc=; b=O9T+cO7yS6RByinXxGlmLnMuw8UB7Uq04JQ4MQH8ZaRBOREswU+LwInwis5NeFpWMP 6b4afB4V0u8+vl74/ktAUqv/5NLckdOirqGtDWy0DnfLDzw0F9uS9oFATKIZak9LD0cR EIe1i7j7ul/9h7WHFujo40DWgSI49tHQOpChP2CPy1NIu2Q0p4IeMhjKIPe7GW9sQJzq d5c/3lf54qiYjopAmeFXxgIvsdX3ue0RCxavzsT6hs7ZHte2Ni4c0+gpVNyxj8MAJSIz jWGfGy0Vt9wMXRy75BmyDOX3dfHEFPWVj3RohotOBYiovpXcbaa+zZho0FsfhquQPZ8v IpYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ic1tOm+qheUq6zWKsHFH8/lisv9bz4c0DNj333ORfFc=; b=D9Wt5NU+eRaCf2UCGiyIoC6I1ZaRb49WLNY+/ButAJL8bzHtKytug3+FgmEyGhM55c S+08QL3pUryhpJa1IZmsnBCvS7D9aI29f4pdWklNUFh6D3GTAfRb3Nlt1miIy/5IZwKo 2SnynZxmAf7G9qSGF9okac2D8a5D+Jwc86BlDe/4WH+5Vw8/XBX/jTy31df4wlhFT3tB 5SQ9HyLsAykFTHu8tUMUIkYilkA5ApIfRw5ADgV0SfmrOviG47bNuKlAJto+zLH3NsFE OvXwJ+MJht5vFcMlQq2qf3cgTyJQbvQrB3LJ5xpYfYe8HTWxjIvDbE2r5eBRP3M4J/R8 6iGQ== X-Gm-Message-State: AOAM53167P9qQfZyOPwOBqRw+o1sYk1V5rxJvAi/qdCsjXufCb6yAMR+ agAXUZ3DnUhv27cjuIbwVxdpf4P45Yw= X-Google-Smtp-Source: ABdhPJyX+MvFXLa7uDXAhUUkCxsqv4e8xQyC/os7RXs2QYFFoTANe4fzaGRUHzioE6sQe5EkReoukQ== X-Received: by 2002:a2e:8144:: with SMTP id t4mr1368074ljg.100.1597299682024; Wed, 12 Aug 2020 23:21:22 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, boris.ostrovsky@oracle.com, jgross@suse.com, airlied@linux.ie, daniel@ffwll.ch Cc: sstabellini@kernel.org, dan.carpenter@oracle.com, intel-gfx@lists.freedesktop.org, Oleksandr Andrushchenko Subject: [PATCH v2 5/5] drm/xen-front: Pass dumb buffer data offset to the backend Date: Thu, 13 Aug 2020 09:21:13 +0300 Message-Id: <20200813062113.11030-6-andr2000@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200813062113.11030-1-andr2000@gmail.com> References: <20200813062113.11030-1-andr2000@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) From: Oleksandr Andrushchenko While importing a dmabuf it is possible that the data of the buffer is put with offset which is indicated by the SGT offset. Respect the offset value and forward it to the backend. Signed-off-by: Oleksandr Andrushchenko Acked-by: Noralf Tr=C3=B8nnes --- drivers/gpu/drm/xen/xen_drm_front.c | 6 ++++-- drivers/gpu/drm/xen/xen_drm_front.h | 2 +- drivers/gpu/drm/xen/xen_drm_front_gem.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_= drm_front.c index 51818e76facd..3dd56794593a 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.c +++ b/drivers/gpu/drm/xen/xen_drm_front.c @@ -157,7 +157,8 @@ int xen_drm_front_mode_set(struct xen_drm_front_drm_pip= eline *pipeline, =20 int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info, u64 dbuf_cookie, u32 width, u32 height, - u32 bpp, u64 size, struct page **pages) + u32 bpp, u64 size, u32 offset, + struct page **pages) { struct xen_drm_front_evtchnl *evtchnl; struct xen_drm_front_dbuf *dbuf; @@ -194,6 +195,7 @@ int xen_drm_front_dbuf_create(struct xen_drm_front_info= *front_info, req->op.dbuf_create.gref_directory =3D xen_front_pgdir_shbuf_get_dir_start(&dbuf->shbuf); req->op.dbuf_create.buffer_sz =3D size; + req->op.dbuf_create.data_ofs =3D offset; req->op.dbuf_create.dbuf_cookie =3D dbuf_cookie; req->op.dbuf_create.width =3D width; req->op.dbuf_create.height =3D height; @@ -408,7 +410,7 @@ static int xen_drm_drv_dumb_create(struct drm_file *fil= p, ret =3D xen_drm_front_dbuf_create(drm_info->front_info, xen_drm_front_dbuf_to_cookie(obj), args->width, args->height, args->bpp, - args->size, + args->size, 0, xen_drm_front_gem_get_pages(obj)); if (ret) goto fail_backend; diff --git a/drivers/gpu/drm/xen/xen_drm_front.h b/drivers/gpu/drm/xen/xen_= drm_front.h index f92c258350ca..54486d89650e 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.h +++ b/drivers/gpu/drm/xen/xen_drm_front.h @@ -145,7 +145,7 @@ int xen_drm_front_mode_set(struct xen_drm_front_drm_pip= eline *pipeline, =20 int xen_drm_front_dbuf_create(struct xen_drm_front_info *front_info, u64 dbuf_cookie, u32 width, u32 height, - u32 bpp, u64 size, struct page **pages); + u32 bpp, u64 size, u32 offset, struct page **pages); =20 int xen_drm_front_fb_attach(struct xen_drm_front_info *front_info, u64 dbuf_cookie, u64 fb_cookie, u32 width, diff --git a/drivers/gpu/drm/xen/xen_drm_front_gem.c b/drivers/gpu/drm/xen/= xen_drm_front_gem.c index 4ec8a49241e1..39ff95b75357 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_gem.c +++ b/drivers/gpu/drm/xen/xen_drm_front_gem.c @@ -210,7 +210,8 @@ xen_drm_front_gem_import_sg_table(struct drm_device *de= v, =20 ret =3D xen_drm_front_dbuf_create(drm_info->front_info, xen_drm_front_dbuf_to_cookie(&xen_obj->base), - 0, 0, 0, size, xen_obj->pages); + 0, 0, 0, size, sgt->sgl->offset, + xen_obj->pages); if (ret < 0) return ERR_PTR(ret); =20 --=20 2.17.1