[PATCH] make intel_chipset.h public

2016-10-27 Thread Gurchetan Singh
This file has useful information regarding the pci-id --> gen conversion. The gen determines which scanout formats a chipset supports (for example, the SKL display engine can scanout Y-tiled formats). This would be useful for the ozone-gbm interface. Signed-off-by: Gurchetan Singh --- in

[Intel-gfx] [PATCH] make intel_chipset.h public

2016-11-10 Thread Gurchetan Singh
: > On 28 October 2016 at 04:38, Gurchetan Singh > wrote: > > This file has useful information regarding the pci-id --> gen > > conversion. The gen determines which scanout formats a chipset > > supports (for example, the SKL display engine can scanout Y-tiled > >

[PATCH] xf86drm: continue after drmProcessPlatformDevice failure

2017-07-19 Thread Gurchetan Singh
On ChromeOS devices, readdir() processes the directory in the following order: -NAME- -TYPE- .n/a .. n/a vgem n/a card1 DRM_BUS_PLATFORM renderD129 DRM_BUS_PLATFORM card0 DRM_BUS_PCI renderD128

[PATCH 2/2] drm: clean up internally created framebuffer on CRTC disable

2017-12-06 Thread Gurchetan Singh
When a CRTC is disabled and we used an internally created framebuffer, this patch disables the cursor plane and drops the reference that was introduced when we called drm_internal_framebuffer_create. Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/drm/drm_crtc

Re: [PATCH 3/4] drm: add ARM flush implementations

2018-01-18 Thread Gurchetan Singh
On Wed, Jan 17, 2018 at 11:42 PM, Daniel Vetter <dan...@ffwll.ch> wrote: > On Wed, Jan 17, 2018 at 11:46 PM, Gurchetan Singh > <gurchetansi...@chromium.org> wrote: > >> dma api just isn't quite sufficient for implementing fast gpu drivers. > > > > >

Re: [PATCH 4/4] drm/vgem: flush page during page fault

2018-01-18 Thread Gurchetan Singh
On Wed, Jan 17, 2018 at 11:38 PM, Daniel Vetter <dan...@ffwll.ch> wrote: > On Wed, Jan 17, 2018 at 11:49 PM, Gurchetan Singh > <gurchetansi...@chromium.org> wrote: > > > > On Wed, Jan 17, 2018 at 12:39 AM, Daniel Vetter <dan...@ffwll.ch> wrote: > >>

Re: [PATCH 2/5] drm: add ARM flush implementation

2018-01-24 Thread Gurchetan Singh
On Wed, Jan 24, 2018 at 4:45 AM, Russell King - ARM Linux < li...@armlinux.org.uk> wrote: > On Tue, Jan 23, 2018 at 06:56:03PM -0800, Gurchetan Singh wrote: > > The dma_cache_maint_page function is important for cache maintenance on > > ARM32 (this was determined via testi

Re: [PATCH 1/5] drm: rename {drm_clflush_sg, drm_clflush_pages}

2018-01-24 Thread Gurchetan Singh
On Wed, Jan 24, 2018 at 1:14 AM, Chris Wilson <ch...@chris-wilson.co.uk> wrote: > Quoting Gurchetan Singh (2018-01-24 02:55:30) > > Since clfush is an x86-only instruction, these function names won't > > make much sense if we start adding cases for other architectures. >

[PATCH 2/4] drm: add additional parameter in drm_flush_pages() and drm_flush_sg()

2018-01-16 Thread Gurchetan Singh
We've found the DMA API is effective for flushing the cache on ARM devices, and it requires a struct device *. Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/drm/drm_cache.c | 5 +++-- drivers/gpu/drm/i915/i915_gem.c | 2 +- drivers/gpu/dr

[PATCH 1/4] drm: rename {drm_clflush_sg, drm_clflush_pages}

2018-01-16 Thread Gurchetan Singh
Since clfush is an x86-only instruction, these function names won't make much sense if we start adding cases for other architectures. Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/drm/drm_cache.c | 12 ++-- drivers/gpu/drm/i915/i915

[PATCH 3/4] drm: add ARM flush implementations

2018-01-16 Thread Gurchetan Singh
The DMA API can be used to flush scatter gather tables and physical pages on ARM devices. Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/drm/drm_cache.c | 17 + drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 7 ++- drivers/g

[PATCH 4/4] drm/vgem: flush page during page fault

2018-01-16 Thread Gurchetan Singh
This is required to use buffers allocated by vgem on AMD and ARM devices. We're experiencing a case where eviction of the cache races with userspace writes. To fix this, flush the cache after retrieving a page. Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/dr

Re: [PATCH 3/4] drm: add ARM flush implementations

2018-01-18 Thread Gurchetan Singh
sembly (__dma_map_area) after a little indirection. Why do you think that's inefficient? On Wed, Jan 17, 2018 at 12:31 AM, Daniel Vetter <dan...@ffwll.ch> wrote: > On Tue, Jan 16, 2018 at 04:35:58PM -0800, Gurchetan Singh wrote: > > The DMA API can be used to flush scatter gathe

Re: [PATCH 4/4] drm/vgem: flush page during page fault

2018-01-18 Thread Gurchetan Singh
On Wed, Jan 17, 2018 at 12:39 AM, Daniel Vetter <dan...@ffwll.ch> wrote: > On Tue, Jan 16, 2018 at 04:35:59PM -0800, Gurchetan Singh wrote: > > This is required to use buffers allocated by vgem on AMD and ARM devices. > > We're experiencing a case where evicti

Re: [PATCH 2/5] drm: add ARM flush implementation

2018-01-24 Thread Gurchetan Singh
On Wed, Jan 24, 2018 at 11:26 AM, Russell King - ARM Linux <li...@armlinux.org.uk> wrote: > On Wed, Jan 24, 2018 at 10:45:28AM -0800, Gurchetan Singh wrote: >> On Wed, Jan 24, 2018 at 4:45 AM, Russell King - ARM Linux < >> li...@armlinux.org.uk> wrote: >> &

Re: [PATCH 4/4] drm/vgem: flush page during page fault

2018-01-30 Thread Gurchetan Singh
On Tue, Jan 30, 2018 at 1:14 AM, Daniel Vetter <dan...@ffwll.ch> wrote: > > On Thu, Jan 18, 2018 at 09:23:31AM -0800, Gurchetan Singh wrote: > > On Wed, Jan 17, 2018 at 11:38 PM, Daniel Vetter <dan...@ffwll.ch> wrote: > > > > > On Wed, Jan 17, 2018 at 11:49

Re: [PATCH 0/7] drm/virtio: Checkpatch cleanup for virtio

2018-02-22 Thread Gurchetan Singh
Patches 1 to 7 are: Reviewed-by: Gurchetan Singh <gurchetansi...@chromium.org> On Thu, Feb 22, 2018 at 3:59 PM, Rodrigo Siqueira <rodrigosiqueiram...@gmail.com> wrote: > This patchset fixes warnings and errors found by checkpatch.pl in the > drm/virtio: > > * Removes r

[PATCH 1/5] drm: rename {drm_clflush_sg, drm_clflush_pages}

2018-01-23 Thread Gurchetan Singh
Since clfush is an x86-only instruction, these function names won't make much sense if we start adding cases for other architectures. Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/drm/drm_cache.c | 12 ++-- drivers/gpu/drm/i915/i915

[PATCH 3/5] drm: add ARM64 flush implementations

2018-01-23 Thread Gurchetan Singh
This patch uses the __dma_map_area function to flush the cache on ARM64. v2: Don't use DMA API, call functions directly (Daniel) Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/drm/drm_cache.c | 13 + 1 file changed, 13 insertions(+) diff

[PATCH 5/5] drm: use drm_flush_sg where possible

2018-01-23 Thread Gurchetan Singh
We should use our common cache maintenance functions when possible. Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 7 ++- drivers/gpu/drm/tegra/gem.c | 7 ++- 2 files changed, 4 insertions(+), 10 del

[PATCH 2/5] drm: add ARM flush implementation

2018-01-23 Thread Gurchetan Singh
-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/drm/drm_cache.c | 61 + 1 file changed, 61 insertions(+) diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 89cdd32fe1f3..5124582451c6 100644 --- a/drive

[PATCH 4/5] drm/vgem: flush page during page fault

2018-01-23 Thread Gurchetan Singh
This is required to use buffers allocated by vgem on AMD and ARM devices. We're experiencing a case where eviction of the cache races with userspace writes. To fix this, flush the cache after retrieving a page. Signed-off-by: Gurchetan Singh <gurchetansi...@chromium.org> --- drivers/gpu/dr

[PATCH] udmabuf: set read/write flag when exporting

2018-10-29 Thread Gurchetan Singh
Otherwise, mmap fails when done with PROT_WRITE. --- drivers/dma-buf/udmabuf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 5b44ef226904..fc359ca4503d 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@

[PATCH] udmabuf: set read/write flag when exporting

2018-10-30 Thread Gurchetan Singh
Otherwise, mmap fails when done with PROT_WRITE. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 5b44ef226904..fc359ca4503d 100644 --- a/drivers/dma-buf/udmabuf.c +++ b

Re: [PATCH] udmabuf: set read/write flag when exporting

2018-11-15 Thread Gurchetan Singh
Reviewed-by: Gurchetan Singh Tested-by: Gurchetan Singh On Wed, Nov 14, 2018 at 4:20 AM Gerd Hoffmann wrote: > > Otherwise, mmap fails when done with PROT_WRITE. > > Suggested-by: Gurchetan Singh > Signed-off-by: Gerd Hoffmann > --- > drivers/dma-buf/udmabuf.c | 1 +

Re: [v7] Add udmabuf misc device

2018-09-12 Thread Gurchetan Singh
On Wed, Sep 12, 2018 at 12:03 AM Yann Droneaud wrote: > > Hi, > > Le lundi 27 août 2018 à 11:34 +0200, Gerd Hoffmann a écrit : > > 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

Re: [v7] Add udmabuf misc device

2018-09-14 Thread Gurchetan Singh
On Wed, Sep 12, 2018 at 11:44 PM Gerd Hoffmann wrote: > > On Wed, Sep 12, 2018 at 08:24:00PM -0700, Gurchetan Singh wrote: > > On Wed, Sep 12, 2018 at 12:03 AM Yann Droneaud wrote: > > > > > > Hi, > > > > > > Le lundi 27 août 2018 à 11:34 +0200,

Re: [PATCH] virtgpu: Update kernel header

2019-04-01 Thread Gurchetan Singh
On Mon, Mar 4, 2019 at 12:26 AM Robert Foss wrote: > Hey Gurchetan, > > Thanks for sending this in! > > Reviewed-by: Robert Foss > > Thanks for the review! Ping committers for merge ... > On 2/28/19 1:52 AM, Gurchetan Singh wrote: > > Genera

[PATCH] virtgpu: Update kernel header

2019-02-27 Thread Gurchetan Singh
Generated using make headers_install. This brings in the in/out fence support for explicit synchronization. Signed-off-by: Gurchetan Singh --- include/drm/virtgpu_drm.h | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/drm/virtgpu_drm.h b/include/drm

[PATCH] virtgpu: Update kernel header

2019-02-27 Thread Gurchetan Singh
Generated using make headers_install. This brings in the in/out fence support for explicit synchronization. v2: don't use experimental kernel branch Signed-off-by: Gurchetan Singh --- include/drm/virtgpu_drm.h | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git

Re: [PATCH v2 5/6] drm/virtio: drop fencing in virtio_gpu_resource_create_ioctl

2019-01-31 Thread Gurchetan Singh
On Wed, Jan 30, 2019 at 1:43 AM Gerd Hoffmann wrote: > > There is no need to wait for completion here. > > The host will process commands in submit order, so commands can > reference the new resource just fine even when queued up before > completion. Does virtio_gpu_execbuffer_ioctl also wait

Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2

2019-04-10 Thread Gurchetan Singh
On Wed, Apr 10, 2019 at 4:42 AM Gerd Hoffmann wrote: > Add new command VIRTIO_GPU_CMD_RESOURCE_CREATE_V2 to create resources. > It adds (a) support planar resources and (b) returns stride and size of > the resource planes. The later will be needed in case we support > mapping host resources

Re: [PATCH 1/3] virtio-gpu api: comment feature flags

2019-04-10 Thread Gurchetan Singh
On Wed, Apr 10, 2019 at 4:42 AM Gerd Hoffmann wrote: > Add comments to the existing feature flags, > documenting which commands belong to them. > > Signed-off-by: Gerd Hoffmann > This patch is: Reviewed-by: Gurchetan Singh > --- > include/uapi/linux/virtio_gpu.h |

Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2

2019-04-11 Thread Gurchetan Singh
On Wed, Apr 10, 2019 at 10:03 PM Gerd Hoffmann wrote: > > > > +/* VIRTIO_GPU_CMD_RESOURCE_CREATE_V2 */ > > > +struct virtio_gpu_cmd_resource_create_v2 { > > > + struct virtio_gpu_ctrl_hdr hdr; > > > + __le32 resource_id; > > > + __le32 format; > > > + __le32 width; > > > +

Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2

2019-04-12 Thread Gurchetan Singh
On Thu, Apr 11, 2019 at 10:49 PM Gerd Hoffmann wrote: > > On Thu, Apr 11, 2019 at 06:36:15PM -0700, Gurchetan Singh wrote: > > On Wed, Apr 10, 2019 at 10:03 PM Gerd Hoffmann wrote: > > > > > > > > +/* VIRTIO_GPU_CMD_RESOURCE_CREATE_V2 */ > > >

[PATCH] drm/virtio: use u64_to_user_ptr macro

2019-06-04 Thread Gurchetan Singh
Other DRM drivers use it too. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c index b7f9dfe61d1c

Re: [PATCH v6 16/18] drm/virtio: rework virtio_gpu_cmd_context_{attach, detach}_resource

2019-07-02 Thread Gurchetan Singh
On Tue, Jul 2, 2019 at 7:19 AM Gerd Hoffmann wrote: > Switch to the virtio_gpu_array_* helper workflow. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 4 ++-- > drivers/gpu/drm/virtio/virtgpu_gem.c | 24 +++- >

Re: [PATCH 3/3] virtio-gpu api: VIRTIO_GPU_F_RESSOURCE_V2

2019-04-22 Thread Gurchetan Singh
On Wed, Apr 17, 2019 at 2:57 AM Gerd Hoffmann wrote: > > On Fri, Apr 12, 2019 at 04:34:20PM -0700, Chia-I Wu wrote: > > Hi, > > > > I am still new to virgl, and missed the last round of discussion about > > resource_create_v2. > > > > From the discussion below, semantically resource_create_v2

Re: [PATCH v5 09/12] drm/virtio: rework virtio_gpu_object_create fencing

2019-07-01 Thread Gurchetan Singh
On Fri, Jun 28, 2019 at 5:14 AM Gerd Hoffmann wrote: > > Use gem reservation helpers and direct reservation_object_* calls > instead of ttm. > > v5: fix fencing (Chia-I Wu). > v3: Due to using the gem reservation object it is initialized and ready > for use before calling ttm_bo_init, so we can

Re: [RFC 2/6] udmabuf: add ability to set access flags on udmabuf

2019-08-02 Thread Gurchetan Singh
On Wed, Jul 31, 2019 at 11:40 PM Gerd Hoffmann wrote: > > On Wed, Jul 31, 2019 at 07:25:13PM -0700, Gurchetan Singh wrote: > > The main use for udmabuf is sending guest memory pages > > to the host. > > > > It's generally a bad idea to have to separate mappings

[RFC 6/6] udmabuf: implement begin_cpu_access/end_cpu_access hooks

2019-07-31 Thread Gurchetan Singh
With the misc device, we should end up using dma direct ops. This can allow us to have WC mappings in the guest after some synchronization, if we disallow cached mappings in the host. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 39 +++ 1

[RFC 3/6] udmabuf: enforce access flags

2019-07-31 Thread Gurchetan Singh
Enforce the access flags that were added earlier. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 4ecf2a94fed3..134e53d24c2b 100644 --- a/drivers/dma-buf

[RFC 0/6] udmabuf guest <--> host interaction model

2019-07-31 Thread Gurchetan Singh
either. So we need to map write-combine in the guest. One way to achieve this is to synchronize on the host. [warning] -- only compile tested at this point to get feedback Gurchetan Singh (6): udmabuf: use cache_sgt_mapping option udmabuf: add ability to set access flags on udmabuf udmabuf

[RFC 4/6] udmabuf: add a pointer to the miscdevice in dma-buf private data

2019-07-31 Thread Gurchetan Singh
Will be used later. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 134e53d24c2b..47003abbf4c2 100644 --- a/drivers/dma-buf/udmabuf.c +++ b

[RFC 2/6] udmabuf: add ability to set access flags on udmabuf

2019-07-31 Thread Gurchetan Singh
for the specific use case. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c| 7 ++- include/uapi/linux/udmabuf.h | 5 - 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index b345e91d831a..4ecf2a94fed3

[RFC 5/6] udmabuf: separate out creating/destroying scatter-table

2019-07-31 Thread Gurchetan Singh
Reused later. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 47003abbf4c2..5f8bee1862de 100644 --- a/drivers/dma-buf

[RFC 1/6] udmabuf: use cache_sgt_mapping option

2019-07-31 Thread Gurchetan Singh
The GEM prime helpers do it, so should we. It's also possible to make it optional later. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index

[PATCH 2/2] [RFC] drm/virtgpu: modify uapi with stride/layer_stride fix

2019-10-01 Thread Gurchetan Singh
/mesa/merge_requests/2129 Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8 +++- include/uapi/drm/virtgpu_drm.h | 4 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio

[PATCH 1/2] drm/virtgpu: plumb fix for virtgpu_drm.h / virtio_gpu.h discrepancy

2019-10-01 Thread Gurchetan Singh
we don't forget. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 9 ++--- drivers/gpu/drm/virtio/virtgpu_vq.c| 6 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/virtio

Re: [PATCH 2/2] [RFC] drm/virtgpu: modify uapi with stride/layer_stride fix

2019-10-02 Thread Gurchetan Singh
On Wed, Oct 2, 2019 at 1:49 AM Gerd Hoffmann wrote: > > On Tue, Oct 01, 2019 at 06:49:35PM -0700, Gurchetan Singh wrote: > > This doesn't really break userspace, since it always passes down > > 0 for stride/layer_stride currently. We could: > > > &g

Re: [PATCH v2 0/3] drm/virtio: various cleanups

2019-11-13 Thread Gurchetan Singh
; - drop merged patches (#1 + #2). > > please review, Series is: Reviewed-by: Gurchetan Singh > Gerd > > Gerd Hoffmann (3): > drm/virtio: fix byteorder handling in > virtio_gpu_cmd_transfer_{from,to}_host_3d functions > drm/virtio: Simplify virtio_gpu_primary_p

Re: [PATCH 2/5] udmabuf: allow userspace to set map attributes

2019-12-02 Thread Gurchetan Singh
On Thu, Nov 28, 2019 at 3:48 AM Gerd Hoffmann wrote: > > Hi, > > > diff --git a/include/uapi/linux/udmabuf.h b/include/uapi/linux/udmabuf.h > > index 46b6532ed855..f90831f2bb0d 100644 > > --- a/include/uapi/linux/udmabuf.h > > +++ b/include/uapi/linux/udmabuf.h > > @@ -6,6 +6,8 @@ > > #include

[PATCH 4/4] udmabuf: implement begin_cpu_access/end_cpu_access hooks

2019-12-02 Thread Gurchetan Singh
With the misc device, we should end up using the result of get_arch_dma_ops(..) or dma-direct ops. This can allow us to have WC mappings in the guest after synchronization. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 39 +++ 1 file changed

[PATCH 1/4] udmabuf: use cache_sgt_mapping option

2019-12-02 Thread Gurchetan Singh
The GEM prime helpers do it, so should we. It's also possible to make it optional later. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index

[PATCH 2/4] udmabuf: add a pointer to the miscdevice in dma-buf private data

2019-12-02 Thread Gurchetan Singh
Will be used later. v2: rename 'udmabuf_misc' to 'device' (kraxel) Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index be15eb6b0586..f0bf3ba7441e

[PATCH 3/4] udmabuf: separate out creating/destroying scatter-table

2019-12-02 Thread Gurchetan Singh
These are nice functions and can be re-used. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index f0bf3ba7441e..0a610e09ae23 100644

Re: [PATCH] drm/virtio: fix mmap page attributes

2019-12-10 Thread Gurchetan Singh
On Tue, Dec 10, 2019 at 12:58 AM Gerd Hoffmann wrote: > > virtio-gpu uses cached mappings. shmem helpers use writecombine though. > So roll our own mmap function, wrapping drm_gem_shmem_mmap(), to tweak > vm_page_prot accordingly. > > Reported-by: Gurchetan Singh > Signed-

[PATCH] udmabuf: fix dma-buf cpu access

2019-12-13 Thread Gurchetan Singh
I'm just going to put Chia's review comment here since it sums the issue rather nicely: "(1) Semantically, a dma-buf is in DMA domain. CPU access from the importer must be surrounded by {begin,end}_cpu_access. This gives the exporter a chance to move the buffer to the CPU domain temporarily.

[PATCH] udmabuf: fix dma-buf cpu access

2019-12-17 Thread Gurchetan Singh
ess to avoid cache issues." Reported-by: Chia-I Wu Suggested-by: Chia-I Wu Fixes: 284562e1f348 ("udmabuf: implement begin_cpu_access/end_cpu_access hooks") Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-)

[PATCH 5/9] drm/virtio: remove virtgpu_gem_prime_import_sg_table

2019-12-17 Thread Gurchetan Singh
Sharing memory between virtio devices is ill-defined, so until we have something let's get rid of this. drm_gem_prime_import_dev returns an error if the callback is NULL. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/Makefile| 2 +- drivers/gpu/drm/virtio/virtgpu_drv.c

[PATCH 8/9] drm/virtio: split out vq functions from virtgpu_drv.h

2019-12-17 Thread Gurchetan Singh
virtgpu_drv.h is getting very big, let's try to split it into smaller header files. Start with virtgpu_vq. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_display.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 79 -- drivers/gpu/drm/virtio

[PATCH 7/9] drm/virtio: move drm_connector_to_virtio_gpu_output to virtgpu_display

2019-12-17 Thread Gurchetan Singh
That's the only file that uses it. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_display.c | 3 +++ drivers/gpu/drm/virtio/virtgpu_drv.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm

[PATCH 9/9] drm/virtio: split out gem functions from virtgpu_drv.h

2019-12-17 Thread Gurchetan Singh
virtgpu_drv.h is getting very big, let's try to split it into smaller header files. This time, GEM functions. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.c| 1 + drivers/gpu/drm/virtio/virtgpu_drv.h| 34 drivers/gpu/drm/virtio/virtgpu_gem.c

[PATCH 1/9] drm/virtio: static-ify virtio_fence_signaled

2019-12-17 Thread Gurchetan Singh
Not used anywhere else. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_fence.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH 0/9] *** virtgpu cleanups ***

2019-12-17 Thread Gurchetan Singh
With so many new features on the horizon, perhaps it's time to do a little "winter cleaning" beforehand. Enjoy! Gurchetan Singh (9): drm/virtio: static-ify virtio_fence_signaled drm/virtio: static-ify virtio_gpu_framebuffer_init drm/virtio: get rid of drm_encoder_to_virtio_gpu_ou

[PATCH 2/9] drm/virtio: static-ify virtio_gpu_framebuffer_init

2019-12-17 Thread Gurchetan Singh
Not used anywhere else. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_display.c | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 4 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio

[PATCH 4/9] drm/virtio: simplify getting fake offset

2019-12-17 Thread Gurchetan Singh
This is a little simpler. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 8 +--- drivers/gpu/drm/virtio/virtgpu_gem.c | 4 +--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio

[PATCH 3/9] drm/virtio: get rid of drm_encoder_to_virtio_gpu_output

2019-12-17 Thread Gurchetan Singh
Not used anywhere. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index b2270153528c..45b4c3324b2c 100644 --- a/drivers/gpu/drm/virtio

[PATCH 6/9] drm/virtio: move to_virtio_fence inside virtgpu_fence

2019-12-17 Thread Gurchetan Singh
That's the only file that uses it. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 -- drivers/gpu/drm/virtio/virtgpu_fence.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio

[PATCH] drm/vram: remove unused definition

2019-11-26 Thread Gurchetan Singh
Commit b0e40e ("vram: Have VRAM MM call GEM VRAM functions directly") removed this. Signed-off-by: Gurchetan Singh --- include/drm/drm_gem_vram_helper.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h index e0

[PATCH 1/5] udmabuf: use cache_sgt_mapping option

2019-11-25 Thread Gurchetan Singh
The GEM prime helpers do it, so should we. It's also possible to make it optional later. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index

[PATCH 2/5] udmabuf: allow userspace to set map attributes

2019-11-25 Thread Gurchetan Singh
The main use for udmabuf is sending guest memory pages to the host. It's generally a bad idea to have to separate mappings with different attributes. For example, a WC mapping the guest kernel and cached mapping on the host is problematic. v2: Cache attribute flags instead of read/write flags

[PATCH 4/5] udmabuf: separate out creating/destroying scatter-table

2019-11-25 Thread Gurchetan Singh
These are nice functions and can be re-used. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 9e6fdd2bc979..67e89bb034c5 100644

[PATCH 3/5] udmabuf: add a pointer to the miscdevice in dma-buf private data

2019-11-25 Thread Gurchetan Singh
Will be used later. v2: rename 'udmabuf_misc' to 'device' (kraxel) Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index ce9c9e4b

[PATCH 5/5] udmabuf: implement begin_cpu_access/end_cpu_access hooks

2019-11-25 Thread Gurchetan Singh
With the misc device, we should end up using the result of get_arch_dma_ops(..) or dma-direct ops. This can allow us to have WC mappings in the guest after synchronization. Signed-off-by: Gurchetan Singh --- drivers/dma-buf/udmabuf.c | 40 +++ 1 file changed

[PATCH 1/6] drm/virtio: static-ify virtio_fence_signaled

2019-12-18 Thread Gurchetan Singh
Not used anywhere else. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_fence.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h

[PATCH 6/6] drm/virtio: move drm_connector_to_virtio_gpu_output to virtgpu_display

2019-12-18 Thread Gurchetan Singh
That's the only file that uses it. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_display.c | 3 +++ drivers/gpu/drm/virtio/virtgpu_drv.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm

[PATCH 2/6] drm/virtio: static-ify virtio_gpu_framebuffer_init

2019-12-18 Thread Gurchetan Singh
Not used anywhere else. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_display.c | 2 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 4 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio

[PATCH 3/6] drm/virtio: get rid of drm_encoder_to_virtio_gpu_output

2019-12-18 Thread Gurchetan Singh
Not used anywhere. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index cf09e4af2fc5..3e0580a8d818 100644 --- a/drivers/gpu/drm/virtio

[PATCH 4/6] drm/virtio: simplify getting fake offset

2019-12-18 Thread Gurchetan Singh
This is a little simpler. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 8 +--- drivers/gpu/drm/virtio/virtgpu_gem.c | 4 +--- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio

[PATCH 5/6] drm/virtio: move to_virtio_fence inside virtgpu_fence

2019-12-18 Thread Gurchetan Singh
That's the only file that uses it. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 -- drivers/gpu/drm/virtio/virtgpu_fence.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio

[PATCH v7 1/4] drm/virtio: use consistent names for drm_files

2020-02-24 Thread Gurchetan Singh
Minor cleanup, change: - file_priv--> file, - drm_file --> file. Reviewed-by: Chia-I Wu Reviewed-by: Emil Velikov Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drive

[PATCH v7 2/4] drm/virtio: factor out context create hypercall

2020-02-24 Thread Gurchetan Singh
initialization. v2: Move context handle initialization too (olv) v6: Remove redundant 3D check (emil.velikov) Reviewed-by: Chia-I Wu Reviewed-by: Emil Velikov Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 13

[PATCH v7 3/4] drm/virtio: track whether or not a context has been initiated

2020-02-24 Thread Gurchetan Singh
Use an boolean variable to track whether a context has been initiated. v5: Fix possible race and sleep via mutex (olv) Reviewed-by: Chia-I Wu Reviewed-by: Emil Velikov Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 ++ drivers/gpu/drm/virtio/virtgpu_ioctl.c | 8

[PATCH v7 4/4] drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl

2020-02-24 Thread Gurchetan Singh
in resource create v7: Remove check when getting capabilities Reviewed-by: Chia-I Wu Reviewed-by: Emil Velikov Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 -- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 29 ++ drivers/gpu/drm/virtio

[RFC PATCH 8/8] drm/virtio: rename virtio_gpu_object to virtio_gpu_shmem

2020-02-26 Thread Gurchetan Singh
This renames struct virtio_gpu_object to struct virtio_gpu_shmem. This will go in line with the planned struct virtio_gpu_vram. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 22 ++--- drivers/gpu/drm/virtio/virtgpu_gem.c| 12 +-- drivers/gpu/drm/virtio

[RFC PATCH 6/8] drm/virtio: rename virtio_gpu_object_array to virtio_gpu_gem_array

2020-02-26 Thread Gurchetan Singh
The plan is to use this array with VRAM objects too. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 36 drivers/gpu/drm/virtio/virtgpu_gem.c| 116 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 32 +++ drivers/gpu/drm/virtio

[RFC PATCH 2/8] drm/virtio: add virtio_gpu_is_shmem helper

2020-02-26 Thread Gurchetan Singh
to kraxel for suggesting this approach on Gitlab. Suggested by: Gerd Hoffman Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 3 +++ drivers/gpu/drm/virtio/virtgpu_object.c | 9 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/

[RFC PATCH 0/8] *** Refactor struct virtgpu_object ***

2020-02-26 Thread Gurchetan Singh
; ??// or *drm_gem_vram_object ?? ?? uint32_t hw_res_handle; ?? ?? {offset, range}; ?? ?? (...) }; Sending this out to solicit feedback on this approach. ??Whichever approach we decide, landing incremental changes to internal structures is reduces rebasing costs and avoids mega-changes. Gurchetan Singh (8): drm

[RFC PATCH 1/8] drm/virtio: make mmap callback consistent with callbacks

2020-02-26 Thread Gurchetan Singh
This is a very, very minor cleanup. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 3d2a6d489bfc..07de3260118a

[RFC PATCH 3/8] drm/virtio: add virtio_gpu_get_handle function

2020-02-26 Thread Gurchetan Singh
Whether the resource is a shmem based resource or a (planned) vram based resource, it will have a resource handle associated with it. Since the hypercall interface works on resource handles, add a function that returns the handle given a GEM object. Signed-off-by: Gurchetan Singh --- drivers

[RFC PATCH 4/8] drm/virtio: make RESOURCE_UNREF use virtio_gpu_get_handle(..)

2020-02-26 Thread Gurchetan Singh
This hypercall is reusable for both shmem and (planned) vram based virtgpu objects. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 2 +- drivers/gpu/drm/virtio/virtgpu_object.c | 2 +- drivers/gpu/drm/virtio/virtgpu_vq.c | 17 +++-- 3 files

[RFC PATCH 7/8] drm/virtio: rename virtio_gpu_object_params to virtio_gpu_create_params

2020-02-26 Thread Gurchetan Singh
Currently, struct virtio_gpu_object refers to the SHMEM based object, which is fair. We want to expand that a bit, so let's expand the creation params too. Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 10 +- drivers/gpu/drm/virtio/virtgpu_gem.c| 4

[PATCH v3 1/2] drm/virtio: factor out the sg_table from virtio_gpu_object

2020-03-04 Thread Gurchetan Singh
A resource will be a shmem based resource or a (planned) vram based resource, so it makes sense to factor out common fields (resource handle, dumb). v2: move mapped field to shmem object Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 13 +++ drivers/gpu

[PATCH v3 2/2] drm/virtio: add case for shmem objects in virtio_gpu_cleanup_object(..)

2020-03-04 Thread Gurchetan Singh
This function can be reused for hostmem objects. v2: move virtio_gpu_is_shmem() check to virtio_gpu_cleanup_object() v3: use-after free fix Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 2 +- drivers/gpu/drm/virtio/virtgpu_object.c | 33

Re: [virtio-dev] [PATCH v2 4/4] drm/virtio: Support virtgpu exported resources

2020-03-02 Thread Gurchetan Singh
On Mon, Mar 2, 2020 at 4:15 AM David Stevens wrote: > > Add support for UUID-based resource sharing mechanism to virtgpu. This > implements the new virtgpu commands and hooks them up to dma-buf's > get_uuid callback. > > Signed-off-by: David Stevens > --- > drivers/gpu/drm/virtio/virtgpu_drv.c

[PATCH v2 2/2] drm/virtio: add case for shmem objects in virtio_gpu_cleanup_object(..)

2020-03-03 Thread Gurchetan Singh
This function can be reused for hostmem objects. v2: move virtio_gpu_is_shmem() check to virtio_gpu_cleanup_object() Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 2 +- drivers/gpu/drm/virtio/virtgpu_object.c | 32 +++-- 2 files changed, 20

[PATCH v2 1/2] drm/virtio: factor out the sg_table from virtio_gpu_object

2020-03-03 Thread Gurchetan Singh
A resource will be a shmem based resource or a (planned) vram based resource, so it makes sense to factor out common fields (resource handle, dumb). v2: move mapped field to shmem object Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/virtio/virtgpu_drv.h| 13 +++ drivers/gpu

Re: [PATCH 1/2] drm/virtio: factor out the sg_table from virtio_gpu_object

2020-03-03 Thread Gurchetan Singh
On Tue, Mar 3, 2020 at 1:56 AM Gerd Hoffmann wrote: > Hi, > > > struct virtio_gpu_object { > > struct drm_gem_shmem_object base; > > uint32_t hw_res_handle; > > - > > - struct sg_table *pages; > > uint32_t mapped; > > - > > bool dumb; > > bool created; > >

Re: [RFC PATCH 0/8] *** Refactor struct virtgpu_object ***

2020-02-27 Thread Gurchetan Singh
On Wed, Feb 26, 2020 at 11:23 PM Gerd Hoffmann wrote: > > On Wed, Feb 26, 2020 at 04:25:53PM -0800, Gurchetan Singh wrote: > > The main motivation behind this is to have eventually have something like > > this: > > > > struct virtio_gpu_shmem { > >

  1   2   3   4   >