[radeon-alex:amd-mainline-dkms-5.2 2158/2647] drivers/gpu/drm/ttm/ttm_bo_vm.c:128:6: error: 'vma' undeclared; did you mean 'vmf'?

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: 607b18ba116eb1642b01fb9d38a164cc492e9044 [2158/2647] drm/amdkcl: Test 
whether vm_fault->{address/vma} is available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 607b18ba116eb1642b01fb9d38a164cc492e9044
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

from include/drm/drm_print.h:32,
from include/drm/drm_mm.h:49,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/kref.h:36:28: note: previous definition of 'kref_read' was here
static inline unsigned int kref_read(const struct kref *kref)
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_kref.h: In function 'kref_read':
   include/kcl/kcl_kref.h:9:21: error: passing argument 1 of 'atomic_read' from 
incompatible pointer type [-Werror=incompatible-pointer-types]
 return atomic_read(>refcount);
^
   In file included from arch/x86/include/asm/atomic.h:265:0,
from include/linux/atomic.h:7,
from include/linux/rcupdate.h:25,
from include/linux/rbtree.h:34,
from include/drm/drm_mm.h:41,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/asm-generic/atomic-instrumented.h:24:1: note: expected 'const 
atomic_t * {aka const struct  *}' but argument is of type 'const 
refcount_t * {aka const struct refcount_struct *}'
atomic_read(const atomic_t *v)
^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h: At top level:
   include/kcl/kcl_mm_types.h:10:3: error: conflicting types for 'pfn_t'
} pfn_t;
  ^
   In file included from include/asm-generic/memory_model.h:5:0,
from arch/x86/include/asm/page.h:76,
from arch/x86/include/asm/thread_info.h:12,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/rcupdate.h:27,
from include/linux/rbtree.h:34,
from include/drm/drm_mm.h:41,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/pfn.h:15:3: note: previous declaration of 'pfn_t' was here
} pfn_t;
  ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h:33:13: error: conflicting types for 'vm_fault_t'
typedef int vm_fault_t;
^~
   In file included from include/drm/drm_mm.h:43:0,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm_types.h:631:32: note: previous declaration of 'vm_fault_t' 
was here
typedef __bitwise unsigned int vm_fault_t;
   ^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h:35:26: error: conflicting types for 
'vmf_insert_mixed'
static inline vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma,
 ^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:2587:12: note: previous declaration of 'vmf_insert_mixed' 
was here
vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
   ^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h: In function 'vmf_insert_mixed':
   include/kcl/kcl_mm_types.h:41:8: error: implicit declaration of function 
'vm_insert_mixed'; did you mean 'vmf_insert_mixed'? 

[Bug 111482] Sapphire Pulse RX 5700 XT power consumption

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111482

--- Comment #30 from Andrew Sheldon  ---
(In reply to Shmerl from comment #29)

> Which one exactly did you set it at?
> 
> I have 2560x1440 / 144 Hz monitor (LG 27GL850) and Sapphire Pulse RX 5700 XT
> (hardware switch set to higher performance BIOS) and in general I noticed a
> similar thing. During normal idle KDE operation, power stays at around 32 W
> or so.
> 
> If I suspend and resume, power drops to 11 W and the monitor starts
> flickering wildly. I tried to do:
> 
> echo "low" > /sys/class/drm/card0/device/power_dpm_force_performance_level
> 
> But that didn't really help with flickering.

You may have to first set it to "high", then back to "low".

It will also stop working once a fix that adds "smu->disable_uclk_switch = 0;"
in amdgpu_smu.c filters down to the mainline kernels.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2129/2647] drivers/gpu/drm/ttm/ttm_bo_util.c:265:57: error: 'KM_USER0' undeclared; did you mean 'SI_USER'?

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: f2d51786363ee2a72c55570835e4c79066af2782 [2129/2647] drm/amdkcl: Test 
whether kmap_atomic() wants one argument
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout f2d51786363ee2a72c55570835e4c79066af2782
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

from include/drm/drm_print.h:32,
from include/drm/drm_mm.h:49,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/kref.h:36:28: note: previous definition of 'kref_read' was here
static inline unsigned int kref_read(const struct kref *kref)
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_kref.h: In function 'kref_read':
   include/kcl/kcl_kref.h:9:21: error: passing argument 1 of 'atomic_read' from 
incompatible pointer type [-Werror=incompatible-pointer-types]
 return atomic_read(>refcount);
^
   In file included from arch/x86/include/asm/atomic.h:265:0,
from include/linux/atomic.h:7,
from include/linux/rcupdate.h:25,
from include/linux/rbtree.h:34,
from include/drm/drm_mm.h:41,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/asm-generic/atomic-instrumented.h:24:1: note: expected 'const 
atomic_t * {aka const struct  *}' but argument is of type 'const 
refcount_t * {aka const struct refcount_struct *}'
atomic_read(const atomic_t *v)
^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h: At top level:
   include/kcl/kcl_mm_types.h:10:3: error: conflicting types for 'pfn_t'
} pfn_t;
  ^
   In file included from include/asm-generic/memory_model.h:5:0,
from arch/x86/include/asm/page.h:76,
from arch/x86/include/asm/thread_info.h:12,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/rcupdate.h:27,
from include/linux/rbtree.h:34,
from include/drm/drm_mm.h:41,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/pfn.h:15:3: note: previous declaration of 'pfn_t' was here
} pfn_t;
  ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h:33:13: error: conflicting types for 'vm_fault_t'
typedef int vm_fault_t;
^~
   In file included from include/drm/drm_mm.h:43:0,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm_types.h:631:32: note: previous declaration of 'vm_fault_t' 
was here
typedef __bitwise unsigned int vm_fault_t;
   ^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h:35:26: error: conflicting types for 
'vmf_insert_mixed'
static inline vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma,
 ^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:2587:12: note: previous declaration of 'vmf_insert_mixed' 
was here
vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
   ^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h: In function 'vmf_insert_mixed':
   include/kcl/kcl_mm_types.h:41:8: error: implicit declaration of function 
'vm_insert_mixed'; did you mean 'vmf_insert_mixed'? 

[radeon-alex:amd-mainline-dkms-5.2 2121/2647] include/kcl/kcl_drm.h:104:1: error: redefinition of 'drm_fb_helper_remove_conflicting_pci_framebuffers'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: a54762aadc4f9bc23849aa01cac1ed8ad158ca3a [2121/2647] drm/amdkcl: 
refactor drm_fb_helper_remove_conflicting_pci_framebuffers() check
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout a54762aadc4f9bc23849aa01cac1ed8ad158ca3a
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
>> include/kcl/kcl_drm.h:104:1: error: redefinition of 
>> 'drm_fb_helper_remove_conflicting_pci_framebuffers'
drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
^
   In file included from include/kcl/kcl_drm.h:7:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_fb_helper.h:612:1: note: previous definition of 
'drm_fb_helper_remove_conflicting_pci_framebuffers' was here
drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_encoder_init':
   include/kcl/kcl_drm.h:202:9: error: too few arguments to function 
'drm_encoder_init'
 return drm_encoder_init(dev, encoder, funcs,
^~~~
   In file included from include/drm/drm_modeset_helper_vtables.h:33:0,
from include/drm/drm_atomic_helper.h:32,
from include/kcl/kcl_drm.h:10,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_encoder.h:183:5: note: declared here
int drm_encoder_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_crtc_init_with_planes':
   include/kcl/kcl_drm.h:217:10: error: too few arguments to function 
'drm_crtc_init_with_planes'
  return drm_crtc_init_with_planes(dev, crtc, primary,
 ^
   In file included from include/drm/drmP.h:68:0,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_crtc.h:1120:5: note: declared here
int drm_crtc_init_with_planes(struct drm_device *dev,
^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_universal_plane_init':
   include/kcl/kcl_drm.h:238:29: error: incompatible type for argument 7 of 
'drm_universal_plane_init'
 formats, format_count, type);
^~~~
   In file included from include/drm/drm_crtc.h:45:0,
from include/drm/drmP.h:68,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_plane.h:713:5: note: expected 'const uint64_t * {aka const 
long long unsigned int *}' but argument is of type 'enum drm_plane_type'
int drm_universal_plane_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:237:10: error: too few arguments to function 
'drm_universal_plane_init'
  return drm_universal_plane_init(dev, plane, possible_crtcs, funcs,
 ^~~~
   In file included from include/drm/drm_crtc.h:45:0,
from include/drm/drmP.h:68,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_plane.h:713:5: note: declared here
int drm_universal_plane_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_gem_object_lookup':
   include/kcl/kcl_drm.h:249:32: error: passing argument 1 of 
'drm_gem_object_lookup' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  return drm_gem_object_lookup(dev, filp, handle);
   ^~~
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: expected 

Re: Individuals interested in VESA memberships?

2019-11-01 Thread Luc Verhaegen
On Fri, Nov 01, 2019 at 04:06:40PM -0400, Lyude Paul wrote:
> Hi! Recently I've been working with the rest of the X.Org board to try to get
> X.org access to VESA memberships so that contributors that don't have an
> employer who is able/willing to join VESA can potentially get access to the
> various benefits of a VESA membership, such as access to DisplayPort
> specifications. Since I need to gather a list of interested X.org members, I'd
> like to know who all might be interested in a membership like this. There are
> no costs involved, as the VESA membership we're looking at in particular comes
> at no cost to us since we're a non-profit.
> 
> The current plan is to extend VESA membership to X.Org members who
> specifically request it. If you think you'd be at all interested in this, or
> know any projects or contributors who would be, please feel free to respond to
> this message and let me know!

Is this a one time thing?
Is this something that can be requested at any time or at specific, 
regular, intervals?

Luc Verhaegen.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/mediatek: Support reflect-y plane rotation

2019-11-01 Thread CK Hu
Hi, Sean:

On Fri, 2019-11-01 at 09:26 -0400, Sean Paul wrote:
> From: Sean Paul 
> 
> Expose the rotation property and handle REFLECT_Y rotations.
> 
> Cc: Fritz Koenig 
> Cc: Daniele Castagna 
> Cc: Miguel Casas 
> Cc: Mark Yacoub 
> Signed-off-by: Sean Paul 
> ---
> 
> The hardware also supports REFLECT_X, but I just could not figure out
> how to get it working. If someone is interested in getting this going,
> I'm happy to share notes and my WIP patch. For now, though, I actually
> only need y-flip so I'm giving up on x-flip.

Does [1] give you any hint for x-flip, or that patch is incorrect?

[1]
https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1533519

> 
> 
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  6 ++
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c | 11 ++-
>  drivers/gpu/drm/mediatek/mtk_drm_plane.h |  1 +
>  3 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c 
> b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index 14878ebf59d7..6505479ee506 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -50,6 +50,7 @@
>   OVL_CON_CLRFMT_RGB : 0)
>  #define  OVL_CON_AEN BIT(8)
>  #define  OVL_CON_ALPHA   0xff
> +#define  OVL_CON_VIRT_FLIP   BIT(9)
>  
>  struct mtk_disp_ovl_data {
>   unsigned int addr;
> @@ -229,6 +230,11 @@ static void mtk_ovl_layer_config(struct mtk_ddp_comp 
> *comp, unsigned int idx,
>   if (idx != 0)
>   con |= OVL_CON_AEN | OVL_CON_ALPHA;
>  
> + if (pending->rotation & DRM_MODE_REFLECT_Y) {
> + con |= OVL_CON_VIRT_FLIP;
> + addr += (pending->height - 1) * pending->pitch;
> + }
> +
>   writel_relaxed(con, comp->regs + DISP_REG_OVL_CON(idx));
>   writel_relaxed(pitch, comp->regs + DISP_REG_OVL_PITCH(idx));
>   writel_relaxed(src_size, comp->regs + DISP_REG_OVL_SRC_SIZE(idx));
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> index 584a9ecadce6..4d8f2b55334b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> @@ -88,6 +88,9 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
>   if (!fb)
>   return 0;
>  
> + if (fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0) != 0)
> + return -EINVAL;

If this patch does not support all color format, please describe what
color format does this patch support, so others could try to make the
rest color format work.

Regards,
CK

> +
>   if (!state->crtc)
>   return 0;
>  
> @@ -132,6 +135,7 @@ static void mtk_plane_atomic_update(struct drm_plane 
> *plane,
>   state->pending.y = plane->state->dst.y1;
>   state->pending.width = drm_rect_width(>state->dst);
>   state->pending.height = drm_rect_height(>state->dst);
> + state->pending.rotation = plane->state->rotation;
>   wmb(); /* Make sure the above parameters are set before update */
>   state->pending.dirty = true;
>  }
> @@ -166,7 +170,12 @@ int mtk_plane_init(struct drm_device *dev, struct 
> drm_plane *plane,
>   return err;
>   }
>  
> - drm_plane_helper_add(plane, _plane_helper_funcs);
> + err = drm_plane_create_rotation_property(plane, 0,
> +  DRM_MODE_ROTATE_0 |
> +  DRM_MODE_REFLECT_Y);
> + if (err)
> + DRM_INFO("Create rotation property failed, continuing...\n");
>  
> + drm_plane_helper_add(plane, _plane_helper_funcs);
>   return 0;
>  }
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.h 
> b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> index 6f842df722c7..83b634a997cc 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> @@ -20,6 +20,7 @@ struct mtk_plane_pending_state {
>   unsigned inty;
>   unsigned intwidth;
>   unsigned intheight;
> + unsigned introtation;
>   booldirty;
>  };
>  


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2114/2647] include/kcl/kcl_drm.h:486:34: error: redefinition of 'drm_debug_printer'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: 57d7e98d0257bd9795dd3f438d19aa5476554685 [2114/2647] drm/amdkcl: Test 
whether drm_{mm_print/debug_printer} is available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 57d7e98d0257bd9795dd3f438d19aa5476554685
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

from :0:
   include/drm/drm_crtc.h:1120:5: note: declared here
int drm_crtc_init_with_planes(struct drm_device *dev,
^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_universal_plane_init':
   include/kcl/kcl_drm.h:249:29: error: incompatible type for argument 7 of 
'drm_universal_plane_init'
 formats, format_count, type);
^~~~
   In file included from include/drm/drm_crtc.h:45:0,
from include/drm/drmP.h:68,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_plane.h:713:5: note: expected 'const uint64_t * {aka const 
long long unsigned int *}' but argument is of type 'enum drm_plane_type'
int drm_universal_plane_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:248:10: error: too few arguments to function 
'drm_universal_plane_init'
  return drm_universal_plane_init(dev, plane, possible_crtcs, funcs,
 ^~~~
   In file included from include/drm/drm_crtc.h:45:0,
from include/drm/drmP.h:68,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_plane.h:713:5: note: declared here
int drm_universal_plane_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_gem_object_lookup':
   include/kcl/kcl_drm.h:260:32: error: passing argument 1 of 
'drm_gem_object_lookup' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  return drm_gem_object_lookup(dev, filp, handle);
   ^~~
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: expected 'struct drm_file *' but 
argument is of type 'struct drm_device *'
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:260:37: warning: passing argument 2 of 
'drm_gem_object_lookup' makes integer from pointer without a cast 
[-Wint-conversion]
  return drm_gem_object_lookup(dev, filp, handle);
^~~~
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: expected 'u32 {aka unsigned int}' but 
argument is of type 'struct drm_file *'
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:260:10: error: too many arguments to function 
'drm_gem_object_lookup'
  return drm_gem_object_lookup(dev, filp, handle);
 ^
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: declared here
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: At top level:
   include/kcl/kcl_drm.h:269:8: error: redefinition of 'struct 
drm_format_name_buf'
struct drm_format_name_buf {
   ^~~
   In file included from include/drm/drmP.h:69:0,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
 

Re: [PATCH] drm/mediatek: Support reflect-y plane rotation

2019-11-01 Thread Mark Yacoub
Tested it on my end and confirmed that it works as intended.

On Fri, Nov 1, 2019 at 9:26 AM Sean Paul  wrote:
>
> From: Sean Paul 
>
> Expose the rotation property and handle REFLECT_Y rotations.
>
> Cc: Fritz Koenig 
> Cc: Daniele Castagna 
> Cc: Miguel Casas 
> Cc: Mark Yacoub 
> Signed-off-by: Sean Paul 
> ---
>
> The hardware also supports REFLECT_X, but I just could not figure out
> how to get it working. If someone is interested in getting this going,
> I'm happy to share notes and my WIP patch. For now, though, I actually
> only need y-flip so I'm giving up on x-flip.
>
>
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  6 ++
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c | 11 ++-
>  drivers/gpu/drm/mediatek/mtk_drm_plane.h |  1 +
>  3 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c 
> b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index 14878ebf59d7..6505479ee506 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -50,6 +50,7 @@
> OVL_CON_CLRFMT_RGB : 0)
>  #defineOVL_CON_AEN BIT(8)
>  #defineOVL_CON_ALPHA   0xff
> +#defineOVL_CON_VIRT_FLIP   BIT(9)
>
>  struct mtk_disp_ovl_data {
> unsigned int addr;
> @@ -229,6 +230,11 @@ static void mtk_ovl_layer_config(struct mtk_ddp_comp 
> *comp, unsigned int idx,
> if (idx != 0)
> con |= OVL_CON_AEN | OVL_CON_ALPHA;
>
> +   if (pending->rotation & DRM_MODE_REFLECT_Y) {
> +   con |= OVL_CON_VIRT_FLIP;
> +   addr += (pending->height - 1) * pending->pitch;
> +   }
> +
> writel_relaxed(con, comp->regs + DISP_REG_OVL_CON(idx));
> writel_relaxed(pitch, comp->regs + DISP_REG_OVL_PITCH(idx));
> writel_relaxed(src_size, comp->regs + DISP_REG_OVL_SRC_SIZE(idx));
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> index 584a9ecadce6..4d8f2b55334b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> @@ -88,6 +88,9 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
> if (!fb)
> return 0;
>
> +   if (fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0) != 0)
> +   return -EINVAL;
> +
> if (!state->crtc)
> return 0;
>
> @@ -132,6 +135,7 @@ static void mtk_plane_atomic_update(struct drm_plane 
> *plane,
> state->pending.y = plane->state->dst.y1;
> state->pending.width = drm_rect_width(>state->dst);
> state->pending.height = drm_rect_height(>state->dst);
> +   state->pending.rotation = plane->state->rotation;
> wmb(); /* Make sure the above parameters are set before update */
> state->pending.dirty = true;
>  }
> @@ -166,7 +170,12 @@ int mtk_plane_init(struct drm_device *dev, struct 
> drm_plane *plane,
> return err;
> }
>
> -   drm_plane_helper_add(plane, _plane_helper_funcs);
> +   err = drm_plane_create_rotation_property(plane, 0,
> +DRM_MODE_ROTATE_0 |
> +DRM_MODE_REFLECT_Y);
> +   if (err)
> +   DRM_INFO("Create rotation property failed, continuing...\n");
>
> +   drm_plane_helper_add(plane, _plane_helper_funcs);
> return 0;
>  }
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.h 
> b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> index 6f842df722c7..83b634a997cc 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
> @@ -20,6 +20,7 @@ struct mtk_plane_pending_state {
> unsigned inty;
> unsigned intwidth;
> unsigned intheight;
> +   unsigned introtation;
> booldirty;
>  };
>
> --
> Sean Paul, Software Engineer, Google / Chromium OS
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/edid: fixup EDID 1.3 and 1.4 judge reduced-blanking timings logic

2019-11-01 Thread allen
According to VESA ENHANCED EXTENDED DISPLAY IDENTIFICATION DATA STANDARD
(Defines EDID Structure Version 1, Revision 4) page: 39
How to determine whether the monitor support RB timing or not?
EDID 1.4
First:  read detailed timing descriptor and make sure byte0 = 0,
byte1 = 0, byte2 = 0 and byte3 = 0xFD
Second: read detailed timing descriptor byte10 = 0x04 and
EDID byte18h bit0 = 1
Third:  if EDID byte18h bit0 == 1 && byte10 == 0x04,
then we can check byte15, if byte15 bit4 =1 is support RB
if EDID byte18h bit0 != 1 || byte10 != 0x04,
then byte15 can not be used

The linux code is_rb function not follow the VESA's rule

EDID 1.3
LCD flat panels do not require long blanking intervals as a retrace
period so default support reduced-blanking timings.

Signed-off-by: Allen Chen 
---
 drivers/gpu/drm/drm_edid.c | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index e5e7e65..08e914d 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -93,6 +93,11 @@ struct detailed_mode_closure {
int modes;
 };
 
+struct edid_support_rb_closure {
+   struct edid *edid;
+   u8 support_rb;
+};
+
 #define LEVEL_DMT  0
 #define LEVEL_GTF  1
 #define LEVEL_GTF2 2
@@ -2018,22 +2023,31 @@ struct drm_display_mode *drm_mode_find_dmt(struct 
drm_device *dev,
 is_rb(struct detailed_timing *t, void *data)
 {
u8 *r = (u8 *)t;
-   if (r[3] == EDID_DETAIL_MONITOR_RANGE)
-   if (r[15] & 0x10)
-   *(bool *)data = true;
+   struct edid_support_rb_closure *closure = data;
+   struct edid *edid = closure->edid;
+
+   if (!r[0] && !r[1] && !r[2] && r[3] == EDID_DETAIL_MONITOR_RANGE) {
+   if (edid->features & BIT(0) && r[10] == BIT(2))
+   closure->support_rb = (r[15] & 0x10) ? 1 : 0;
+   }
 }
 
 /* EDID 1.4 defines this explicitly.  For EDID 1.3, we guess, badly. */
 static bool
 drm_monitor_supports_rb(struct edid *edid)
 {
+   struct edid_support_rb_closure closure = {
+   .edid = edid,
+   .support_rb = -1,
+   };
+
if (edid->revision >= 4) {
-   bool ret = false;
-   drm_for_each_detailed_block((u8 *)edid, is_rb, );
-   return ret;
+   drm_for_each_detailed_block((u8 *)edid, is_rb, );
+   if (closure.support_rb >= 0)
+   return closure.support_rb;
}
 
-   return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0);
+   return true;
 }
 
 static void
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 2/2] drm/atomic: clear new_state pointers at hw_done

2019-11-01 Thread Rob Clark
On Fri, Nov 1, 2019 at 11:33 AM Maarten Lankhorst
 wrote:
>
> Op 01-11-2019 om 19:07 schreef Rob Clark:
> > From: Rob Clark 
> >
> > The new state should not be accessed after this point.  Clear the
> > pointers to make that explicit.
> >
> > This makes the error corrected in the previous patch more obvious.
> >
> > Signed-off-by: Rob Clark 
>
> Would be nice if you could cc intel-...@lists.freedesktop.org next time, so I 
> know our CI infrastructure is happy;
>
> It wouldn't surprise me if it catches 1 or 2 abuses in i915.
>
> Otherwise Reviewed-by: Maarten Lankhorst 
>
> Perhaps you could mail this to version to 
> intel-gfx-try...@lists.freedesktop.org using git-send-email so we at least 
> get i915 results?

ok, I sent both patches to trybot, hopefully it tries them together,
as this patch without the self-refresh fix will definitely fall over

BR,
-R
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH -next] drm/vmwgfx: remove set but not used variable 'srf'

2019-11-01 Thread YueHaibing
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c:339:22:
 warning: variable srf set but not used [-Wunused-but-set-variable]

'srf' is never used, so can be removed.

Signed-off-by: YueHaibing 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 29d8794..de0530b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -336,7 +336,6 @@ static void vmw_hw_surface_destroy(struct vmw_resource *res)
 {
 
struct vmw_private *dev_priv = res->dev_priv;
-   struct vmw_surface *srf;
void *cmd;
 
if (res->func->destroy == vmw_gb_surface_destroy) {
@@ -360,7 +359,6 @@ static void vmw_hw_surface_destroy(struct vmw_resource *res)
 */
 
mutex_lock(_priv->cmdbuf_mutex);
-   srf = vmw_res_to_srf(res);
dev_priv->used_memory_size -= res->backup_size;
mutex_unlock(_priv->cmdbuf_mutex);
}
-- 
2.7.4


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH -next] gpu: host1x: Fix compile test failure

2019-11-01 Thread Yuehaibing
On 2019/11/1 17:47, Thierry Reding wrote:
> On Thu, Oct 31, 2019 at 09:33:38PM +0800, Yuehaibing wrote:
>> On 2019/10/31 6:26, Dmitry Osipenko wrote:
>>> 30.10.2019 16:54, YueHaibing пишет:
 If IOMMU_SUPPORT is not set, but IOMMU_IOVA is m and
 COMPILE_TEST is y, building fails:

 drivers/gpu/host1x/dev.o: In function `host1x_remove':
 dev.c:(.text+0x624): undefined reference to `put_iova_domain'
 dev.c:(.text+0x624): relocation truncated to fit: R_AARCH64_CALL26 against 
 undefined symbol `put_iova_domain'
 dev.c:(.text+0x62c): undefined reference to `iova_cache_put'
 dev.c:(.text+0x62c): relocation truncated to fit: R_AARCH64_CALL26 against 
 undefined symbol `iova_cache_put'

 Select IOMMU_IOVA while COMPILE_TEST is set to fix this.

 Reported-by: Hulk Robot 
 Fixes: 52499a6ad2ae ("gpu: host1x: select IOMMU_IOVA")
 Signed-off-by: YueHaibing 
 ---
  drivers/gpu/host1x/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
 index cf987a3..354232d 100644
 --- a/drivers/gpu/host1x/Kconfig
 +++ b/drivers/gpu/host1x/Kconfig
 @@ -2,7 +2,7 @@
  config TEGRA_HOST1X
tristate "NVIDIA Tegra host1x driver"
depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
 -  select IOMMU_IOVA if IOMMU_SUPPORT
 +  select IOMMU_IOVA if (IOMMU_SUPPORT || COMPILE_TEST)
help
  Driver for the NVIDIA Tegra host1x hardware.
  

>>>
>>> It should be better to unconditionally select IOMMU_IOVA here.
>>>
>>> The same could be done for drivers/staging/media/tegra-vde/ and
>>> drivers/gpu/host1x/, please see [1].
>>
>> Yep, I will repost, thanks!
> 
> No need to resend, I already have patches for that.

Ok, thanks!

> 
> Thierry
> 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [Lkcamp] [PATCH] drm/doc: Adding VKMS module description and use to "Testing and Validation"

2019-11-01 Thread André Almeida
Hi Gabriela!

On 11/1/19 1:27 AM, Gabriela Bittencourt wrote:
> Add a description on VKMS module and the cases in which it should be used.
> There's a brief explanation on how to set it and use it in a VM, along with
> an example of running an igt-test.
>
> Signed-off-by: Gabriela Bittencourt 
>
> ---
>
> Hi DRM-community,
> this is my first (of many, I hope)  patch in this subsystem. I hope to have
> a lot of learning (and fun :)) working with you guys.
> I'm starting by documenting the VKMS driver in "Userland interfaces", if I
> have been inaccurate in my description or if I misunderstood some concept,
> please let me know.
Cool! It would be nice also to know if you have tested this patch and
checked the output .html file.
> ---
>  Documentation/gpu/drm-uapi.rst | 38 ++
>  1 file changed, 38 insertions(+)
>
> diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
> index 94f90521f58c..7d6c86b7af76 100644
> --- a/Documentation/gpu/drm-uapi.rst
> +++ b/Documentation/gpu/drm-uapi.rst
> @@ -285,6 +285,44 @@ run-tests.sh is a wrapper around piglit that will 
> execute the tests matching
>  the -t options. A report in HTML format will be available in
>  ./results/html/index.html. Results can be compared with piglit.
>  
> +Using VKMS to test DRM API
> +--
> +
> +VKMS is a software-only model of a KMS driver that is useful for testing
> +and for running compositors. VKMS aims to enable a virtual display without
> +the need for a hardware display capability. These characteristics made VKMS
> +a perfect tool for validating the DRM core behavior and also support the
> +compositor developer. VKMS helps us to test DRM core function in a virtual
> +machine, which makes it easy to test some of the core changes.
"test DRM core function" ... "test some of the core changes", maybe this
can be reworded to avoid repetition.
> +
> +To Validate changes in DRM API with VKMS, start setting the kernel. The
> +VKMS module is not enabled by defaut, so enable it in the menuconfig::
> +
> + $ make menuconfig
> +
Not sure if we need to teach people how to enable a module.
> +Compile the kernel with the VKMS enabled and install it in the target
> +machine. VKMS can be run in a Virtual Machine (QEMU, virtme or similar).
> +It's recommended the use of KVM with the minimum of 1GB of RAM and four
> +cores.
> +
> +It's possible to run the IGT-tests in a VM in two ways:
> +1. Use IGT inside a VM
> +2. Use IGT from the host machine and write the results in a shared directory.
> +
> +As follow, there is an example of using a VM with a shared directory with
> +the host machine to run igt-tests. As example it's used virtme::
> +
> + $ virtme-run --rwdir /path/for/shared_dir 
> --kdir=path/for/kernel/directory --mods=auto
> +
> +Run the igt-tests, as example it's ran the 'kms_flip' tests::
> +
> + $ /path/for/igt-gpu-tools/scripts/run-tests.sh -p -s -t "kms_flip.*" -v
Should we run this command at the host or guest?
> +
> +In this example instead of build the igt_runner it's used Piglit

I'm feeling that there should be more commas in this sentence. How about
"In this example, instead of building igt_runner, Piglit is used"

> +(-p option); it's created html summary of the tests results and it's saved
> +in the folder "igt-gpu-tools/results"; it's executed only the igt-tests
> +matching the -t option.
> +
>  Display CRC Support
>  ---
>  
Thanks,
    André

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drivers: gpu: amdgpu: Remove @dev from amdgpu_gem_prime_export documentation

2019-11-01 Thread Jaskaran Singh
The function does not have a "dev" argument, so remove it from
the documentation. This fixes the following documentation
build warning:

./drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c:335:
warning: Excess function parameter 'dev' description in
'amdgpu_gem_prime_export'

Signed-off-by: Jaskaran Singh 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index 61f108ec2b5c..4917b548b7f2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -321,7 +321,6 @@ const struct dma_buf_ops amdgpu_dmabuf_ops = {
 
 /**
  * amdgpu_gem_prime_export - _driver.gem_prime_export implementation
- * @dev: DRM device
  * @gobj: GEM BO
  * @flags: Flags such as DRM_CLOEXEC and DRM_RDWR.
  *
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 2/2] drm/atomic: clear new_state pointers at hw_done

2019-11-01 Thread Rob Clark
On Fri, Nov 1, 2019 at 12:25 PM Ville Syrjälä
 wrote:
>
> On Fri, Nov 01, 2019 at 11:07:13AM -0700, Rob Clark wrote:
> > From: Rob Clark 
> >
> > The new state should not be accessed after this point.  Clear the
> > pointers to make that explicit.
> >
> > This makes the error corrected in the previous patch more obvious.
> >
> > Signed-off-by: Rob Clark 
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 29 +
> >  1 file changed, 29 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> > b/drivers/gpu/drm/drm_atomic_helper.c
> > index 732bd0ce9241..176831df8163 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2234,13 +2234,42 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> >   */
> >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> >  {
> > + struct drm_connector *connector;
> > + struct drm_connector_state *old_conn_state, *new_conn_state;
> >   struct drm_crtc *crtc;
> >   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > + struct drm_plane *plane;
> > + struct drm_plane_state *old_plane_state, *new_plane_state;
> >   struct drm_crtc_commit *commit;
> > + struct drm_private_obj *obj;
> > + struct drm_private_state *old_obj_state, *new_obj_state;
> >   int i;
> >
> > + /*
> > +  * After this point, drivers should not access the permanent modeset
> > +  * state, so we also clear the new_state pointers to make this
> > +  * restriction explicit.
> > +  *
> > +  * For the CRTC state, we do this in the same loop where we signal
> > +  * hw_done, since we still need to new_crtc_state to fish out the
> > +  * commit.
> > +  */
> > +
> > + for_each_oldnew_connector_in_state(old_state, connector, 
> > old_conn_state, new_conn_state, i) {
> > + old_state->connectors[i].new_state = NULL;
> > + }
> > +
> > + for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, 
> > new_plane_state, i) {
> > + old_state->planes[i].new_state = NULL;
> > + }
> > +
> > + for_each_oldnew_private_obj_in_state(old_state, obj, old_obj_state, 
> > new_obj_state, i) {
> > + old_state->private_objs[i].new_state = NULL;
> > + }
> > +
> >   for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, 
> > new_crtc_state, i) {
> >   old_state->crtcs[i].new_self_refresh_active = 
> > new_crtc_state->self_refresh_active;
> > + old_state->crtcs[i].new_state = NULL;
>
> That's going to be a real PITA when doing programming after the fact from
> a vblank worker. It's already a pain that the new_crtc_state->state is
> getting NULLed somewhere.
>

I think you already have that problem, this just makes it explicit.

BR,
-R
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] gpu: ipu-v3: prg: add missed clk_disable_unprepare in remove

2019-11-01 Thread Chuhong Yuan
The driver forgets to disable and unprepare clks when remove.
Add the calls to clk_disable_unprepare to fix the problem.

Signed-off-by: Chuhong Yuan 
---
 drivers/gpu/ipu-v3/ipu-prg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/ipu-v3/ipu-prg.c b/drivers/gpu/ipu-v3/ipu-prg.c
index 196797c1b4b3..6ae6d634c983 100644
--- a/drivers/gpu/ipu-v3/ipu-prg.c
+++ b/drivers/gpu/ipu-v3/ipu-prg.c
@@ -430,6 +430,8 @@ static int ipu_prg_remove(struct platform_device *pdev)
list_del(>list);
mutex_unlock(_prg_list_mutex);
 
+   clk_disable_unprepare(prg->clk_axi);
+   clk_disable_unprepare(prg->clk_ipg);
return 0;
 }
 
-- 
2.23.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 02:42:21PM -0300, Jason Gunthorpe wrote:
> On Fri, Nov 01, 2019 at 03:59:26PM +, Yang, Philip wrote:
> > > This test for range_blockable should be before mutex_lock, I can move
> > > it up
> > > 
> > yes, thanks.
> 
> Okay, I wrote it like this:
> 
>   if (mmu_notifier_range_blockable(range))
>   mutex_lock(>notifier_lock);
>   else if (!mutex_trylock(>notifier_lock))
>   return false;

Never mind, this routine sleeps for other reasons it should just be as
it was:

if (!mmu_notifier_range_blockable(range))
return false;

mutex_lock(>notifier_lock);

Jason
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 00/15] Consolidate the mmu notifier interval_tree and locking

2019-11-01 Thread Jason Gunthorpe
On Mon, Oct 28, 2019 at 05:10:17PM -0300, Jason Gunthorpe wrote:
> From: Jason Gunthorpe 
> 
> 8 of the mmu_notifier using drivers (i915_gem, radeon_mn, umem_odp, hfi1,
> scif_dma, vhost, gntdev, hmm) drivers are using a common pattern where
> they only use invalidate_range_start/end and immediately check the
> invalidating range against some driver data structure to tell if the
> driver is interested. Half of them use an interval_tree, the others are
> simple linear search lists.

Now that we have the most of the driver changes tested and reviewed
I'm going to move this series into linux-next via the hmm tree, minus
the xen gntdev patches as they are not working yet.

I will keep collecting acks and any additional changes.

Thanks,
Jason
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 02:44:51PM +, Yang, Philip wrote:
> 
> 
> On 2019-10-29 3:25 p.m., Jason Gunthorpe wrote:
> > On Tue, Oct 29, 2019 at 07:22:37PM +, Yang, Philip wrote:
> >> Hi Jason,
> >>
> >> I did quick test after merging amd-staging-drm-next with the
> >> mmu_notifier branch, which includes this set changes. The test result
> >> has different failures, app stuck intermittently, GUI no display etc. I
> >> am understanding the changes and will try to figure out the cause.
> > 
> > Thanks! I'm not surprised by this given how difficult this patch was
> > to make. Let me know if I can assist in any way
> > 
> > Please ensure to run with lockdep enabled.. Your symptops sounds sort
> > of like deadlocking?
> > 
> Hi Jason,
> 
> Attached patch fix several issues in amdgpu driver, maybe you can squash 
> this into patch 14. With this is done, patch 12, 13, 14 is Reviewed-by 
> and Tested-by Philip Yang 

Wow, this is great thanks! Can you clarify what the problems you found
were? Was the bug the 'return !r' below?

I'll also add your signed off by

Here are some remarks:

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> index cb718a064eb4..c8bbd06f1009 100644
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> @@ -67,21 +67,15 @@ static bool amdgpu_mn_invalidate_gfx(struct 
> mmu_range_notifier *mrn,
>   struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
>   long r;
>  
> - /*
> -  * FIXME: Must hold some lock shared with
> -  * amdgpu_ttm_tt_get_user_pages_done()
> -  */
> - mmu_range_set_seq(mrn, cur_seq);
> + mutex_lock(>notifier_lock);
>  
> - /* FIXME: Is this necessary? */
> - if (!amdgpu_ttm_tt_affect_userptr(bo->tbo.ttm, range->start,
> -   range->end))
> - return true;
> + mmu_range_set_seq(mrn, cur_seq);
>  
> - if (!mmu_notifier_range_blockable(range))
> + if (!mmu_notifier_range_blockable(range)) {
> + mutex_unlock(>notifier_lock);
>   return false;

This test for range_blockable should be before mutex_lock, I can move
it up

Also, do you know if notifier_lock is held while calling
amdgpu_ttm_tt_get_user_pages_done()? Can we add a 'lock assert held'
to amdgpu_ttm_tt_get_user_pages_done()?

> @@ -854,12 +853,20 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, 
> struct page **pages)
>   r = -EPERM;
>   goto out_unlock;
>   }
> + up_read(>mmap_sem);
> + timeout = jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
> +
> +retry:
> + range->notifier_seq = mmu_range_read_begin(>notifier);
>  
> + down_read(>mmap_sem);
>   r = hmm_range_fault(range, 0);
>   up_read(>mmap_sem);
> -
> - if (unlikely(r < 0))
> + if (unlikely(r <= 0)) {
> + if ((r == 0 || r == -EBUSY) && !time_after(jiffies, timeout))
> + goto retry;
>   goto out_free_pfns;
> + }

This isn't really right, a retry loop like this needs to go all the
way to mmu_range_read_retry() and done under the notifier_lock. ie
mmu_range_read_retry() can fail just as likely as hmm_range_fault()
can, and drivers are supposed to retry in both cases, with a single
timeout.

AFAICT it is a major bug that many places ignore the return code of
amdgpu_ttm_tt_get_user_pages_done() ???

However, this is all pre-existing bugs, so I'm OK go ahead with this
patch as modified. I advise AMD to make a followup patch ..

I'll add a FIXME note to this effect.

>   for (i = 0; i < ttm->num_pages; i++) {
>   pages[i] = hmm_device_entry_to_page(range, range->pfns[i]);
> @@ -916,7 +923,7 @@ bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt *ttm)
>   gtt->range = NULL;
>   }
>  
> - return r;
> + return !r;

Ah is this the major error? hmm_range_valid() is inverted vs
mmu_range_read_retry()?

>  }
>  #endif
>  
> @@ -997,10 +1004,18 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt 
> *ttm)
>   sg_free_table(ttm->sg);
>  
>  #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
> - if (gtt->range &&
> - ttm->pages[0] == hmm_device_entry_to_page(gtt->range,
> -   gtt->range->pfns[0]))
> - WARN_ONCE(1, "Missing get_user_page_done\n");
> + if (gtt->range) {
> + unsigned long i;
> +
> + for (i = 0; i < ttm->num_pages; i++) {
> + if (ttm->pages[i] !=
> + hmm_device_entry_to_page(gtt->range,
> +   gtt->range->pfns[i]))
> + break;
> + }
> +
> + WARN((i == ttm->num_pages), "Missing get_user_page_done\n");
> + }

Is this related/necessary? I can put it in another patch if it is just
debugging improvement? Please advise

Thanks a lot,
Jason
___
dri-devel 

[PATCH v2a 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
Convert the collision-retry lock around hmm_range_fault to use the one now
provided by the mmu_range notifier.

Although this driver does not seem to use the collision retry lock that
hmm provides correctly, it can still be converted over to use the
mmu_range_notifier api instead of hmm_mirror without too much trouble.

This also deletes another place where a driver is associating additional
data (struct amdgpu_mn) with a mmu_struct.

Signed-off-by: Philip Yang 
Reviewed-by: Philip Yang 
Tested-by: Philip Yang 
Signed-off-by: Jason Gunthorpe 
---
 .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c  |   4 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c|  14 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c| 150 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h|  49 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c   | 116 +-
 5 files changed, 96 insertions(+), 237 deletions(-)

Philip, here is what it loos like after combining the two patches, thanks

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 47700302a08b7f..1bcedb9b477dce 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1738,6 +1738,10 @@ static int update_invalid_user_pages(struct 
amdkfd_process_info *process_info,
return ret;
}
 
+   /*
+* FIXME: Cannot ignore the return code, must hold
+* notifier_lock
+*/
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm);
 
/* Mark the BO as valid unless it was invalidated
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 82823d9a8ba887..22c989bca7514c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -603,8 +603,6 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
e->tv.num_shared = 2;
 
amdgpu_bo_list_get_list(p->bo_list, >validated);
-   if (p->bo_list->first_userptr != p->bo_list->num_entries)
-   p->mn = amdgpu_mn_get(p->adev, AMDGPU_MN_TYPE_GFX);
 
INIT_LIST_HEAD();
amdgpu_vm_get_pd_bo(>vm, >validated, >vm_pd);
@@ -1287,11 +1285,11 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
if (r)
goto error_unlock;
 
-   /* No memory allocation is allowed while holding the mn lock.
-* p->mn is hold until amdgpu_cs_submit is finished and fence is added
-* to BOs.
+   /* No memory allocation is allowed while holding the notifier lock.
+* The lock is held until amdgpu_cs_submit is finished and fence is
+* added to BOs.
 */
-   amdgpu_mn_lock(p->mn);
+   mutex_lock(>adev->notifier_lock);
 
/* If userptr are invalidated after amdgpu_cs_parser_bos(), return
 * -EAGAIN, drmIoctl in libdrm will restart the amdgpu_cs_ioctl.
@@ -1334,13 +1332,13 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
amdgpu_vm_move_to_lru_tail(p->adev, >vm);
 
ttm_eu_fence_buffer_objects(>ticket, >validated, p->fence);
-   amdgpu_mn_unlock(p->mn);
+   mutex_unlock(>adev->notifier_lock);
 
return 0;
 
 error_abort:
drm_sched_job_cleanup(>base);
-   amdgpu_mn_unlock(p->mn);
+   mutex_unlock(>adev->notifier_lock);
 
 error_unlock:
amdgpu_job_free(job);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index ac74320b71e4e7..f7be34907e54f5 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -50,28 +50,6 @@
 #include "amdgpu.h"
 #include "amdgpu_amdkfd.h"
 
-/**
- * amdgpu_mn_lock - take the write side lock for this notifier
- *
- * @mn: our notifier
- */
-void amdgpu_mn_lock(struct amdgpu_mn *mn)
-{
-   if (mn)
-   down_write(>lock);
-}
-
-/**
- * amdgpu_mn_unlock - drop the write side lock for this notifier
- *
- * @mn: our notifier
- */
-void amdgpu_mn_unlock(struct amdgpu_mn *mn)
-{
-   if (mn)
-   up_write(>lock);
-}
-
 /**
  * amdgpu_mn_invalidate_gfx - callback to notify about mm change
  *
@@ -82,16 +60,20 @@ void amdgpu_mn_unlock(struct amdgpu_mn *mn)
  * potentially dirty.
  */
 static bool amdgpu_mn_invalidate_gfx(struct mmu_range_notifier *mrn,
-const struct mmu_notifier_range *range)
+const struct mmu_notifier_range *range,
+unsigned long cur_seq)
 {
struct amdgpu_bo *bo = container_of(mrn, struct amdgpu_bo, notifier);
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
long r;
 
-   if (!mmu_notifier_range_blockable(range))
+   if (mmu_notifier_range_blockable(range))
+   mutex_lock(>notifier_lock);
+   else if 

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 03:59:26PM +, Yang, Philip wrote:
> > This test for range_blockable should be before mutex_lock, I can move
> > it up
> > 
> yes, thanks.

Okay, I wrote it like this:

if (mmu_notifier_range_blockable(range))
mutex_lock(>notifier_lock);
else if (!mutex_trylock(>notifier_lock))
return false;

> > Also, do you know if notifier_lock is held while calling
> > amdgpu_ttm_tt_get_user_pages_done()? Can we add a 'lock assert held'
> > to amdgpu_ttm_tt_get_user_pages_done()?
> 
> gpu side hold notifier_lock but kfd side doesn't. kfd side doesn't check 
> amdgpu_ttm_tt_get_user_pages_done/mmu_range_read_retry return value but 
> check mem->invalid flag which is updated from invalidate callback. It 
> takes more time to change, I will come to another patch to fix it later.

Ah.. confusing, OK, I'll let you sort that

> > However, this is all pre-existing bugs, so I'm OK go ahead with this
> > patch as modified. I advise AMD to make a followup patch ..
> > 
> yes, I will.

While you are here, this is also wrong:

int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
{
down_read(>mmap_sem);
r = hmm_range_fault(range, 0);
up_read(>mmap_sem);
if (unlikely(r <= 0)) {
if ((r == 0 || r == -EBUSY) && !time_after(jiffies, timeout))
goto retry;
goto out_free_pfns;
}

for (i = 0; i < ttm->num_pages; i++) {
pages[i] = hmm_device_entry_to_page(range, range->pfns[i]);

It is not allowed to read the results of hmm_range_fault() outside
locking, and in particular, we can't convert to a struct page.

This must be done inside the notifier_lock, after checking
mmu_range_read_retry(), all handling of the struct page must be
structured like that.

> >> @@ -997,10 +1004,18 @@ static void amdgpu_ttm_tt_unpin_userptr(struct 
> >> ttm_tt *ttm)
> >>sg_free_table(ttm->sg);
> >>   
> >>   #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
> >> -  if (gtt->range &&
> >> -  ttm->pages[0] == hmm_device_entry_to_page(gtt->range,
> >> -gtt->range->pfns[0]))
> >> -  WARN_ONCE(1, "Missing get_user_page_done\n");
> >> +  if (gtt->range) {
> >> +  unsigned long i;
> >> +
> >> +  for (i = 0; i < ttm->num_pages; i++) {
> >> +  if (ttm->pages[i] !=
> >> +  hmm_device_entry_to_page(gtt->range,
> >> +gtt->range->pfns[i]))
> >> +  break;
> >> +  }
> >> +
> >> +  WARN((i == ttm->num_pages), "Missing get_user_page_done\n");
> >> +  }
> > 
> > Is this related/necessary? I can put it in another patch if it is just
> > debugging improvement? Please advise
> > 
> I see this WARN backtrace now, but I didn't see it before. This is 
> somehow related.

Hm, might be instructive to learn what is going on..

Thanks,
Jason
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 07:45:22PM +, Yang, Philip wrote:

> > This must be done inside the notifier_lock, after checking
> > mmu_range_read_retry(), all handling of the struct page must be
> > structured like that.
> > 
> Below change will fix this, then driver will call mmu_range_read_retry 
> second time using same range->notifier_seq to check if range is 
> invalidated inside amdgpu_cs_submit, this looks ok for me.

Lets defer this to some patch trying to fix it, I find it hard to
follow..

> @@ -868,6 +869,13 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo 
> *bo, struct page **pages)
>  goto out_free_pfns;
>  }
> 
> +   mutex_lock(>notifier_lock);
> +
> +   if (mmu_range_read_retry(>notifier, range->notifier_seq)) {
> +   mutex_unlock(>notifier_lock);
> +   goto retry;
> +   }
> +
>  for (i = 0; i < ttm->num_pages; i++) {
>  pages[i] = hmm_device_entry_to_page(range, range->pfns[i]);
>  if (unlikely(!pages[i])) {
> @@ -875,10 +883,12 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo 
> *bo, struct page **pages)
> i, range->pfns[i]);
>  r = -ENOMEM;
> 
> +   mutex_unlock(>notifier_lock);
>  goto out_free_pfns;
>  }
>  }

Well, maybe? 

The question now is what happens to 'pages' ? With this arrangment the
driver cannot touch 'pages' without also again going under the lock
and checking retry. 

If it doesn't touch it, then lets just move this device_entry_to_page
to a more appropriate place?

I'd prefer it if the driver could be structured in the normal way,
with a clear locked region where the page list is handled..

Jason
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Jason Gunthorpe
On Fri, Nov 01, 2019 at 02:44:51PM +, Yang, Philip wrote:
> @@ -854,12 +853,20 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, 
> struct page **pages)
>   r = -EPERM;
>   goto out_unlock;
>   }
> + up_read(>mmap_sem);
> + timeout = jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
> +
> +retry:
> + range->notifier_seq = mmu_range_read_begin(>notifier);
>  
> + down_read(>mmap_sem);
>   r = hmm_range_fault(range, 0);
>   up_read(>mmap_sem);
> -
> - if (unlikely(r < 0))
> + if (unlikely(r <= 0)) {
> + if ((r == 0 || r == -EBUSY) && !time_after(jiffies, timeout))
> + goto retry;
>   goto out_free_pfns;
> + }

I was reflecting on why this suddently became necessary, and I think
what might be happening is that hmm_range_fault() is trigging
invalidations as it runs (ie it is faulting in pages or something) and
that in turn causes the mrn to need retry.

The hmm version of this had a bug where a full
invalidate_range_start/end pair would not trigger retry, so this this
didn't happen.

This is unfortunate as the retry is unnecessary, but at this time I
can't think of a good way to separate an ignorable synchronous
invalidation caused by hmm_range_fault from an async one that cannot
be ignored..

A basic fix would be to not update the mrq seq in the notifier if
the invalidate is triggered by hmm_range_fault, but that seems
difficult to determine..

Any thoughts Jerome?

Jason
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/vkms: Update VKMS documentation

2019-11-01 Thread Gabriela Bittencourt
Small changes in the driver documentation, clarifing the description.

Signed-off-by: Gabriela Bittencourt 

---

Tested using: make htmldocs
---
 drivers/gpu/drm/vkms/vkms_drv.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 80524a22412a..52e761bd6c2d 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -3,10 +3,10 @@
 /**
  * DOC: vkms (Virtual Kernel Modesetting)
  *
- * vkms is a software-only model of a kms driver that is useful for testing,
- * or for running X (or similar) on headless machines and be able to still
- * use the GPU. vkms aims to enable a virtual display without the need for
- * a hardware display capability.
+ * VKMS is a software-only model of a KMS driver that is useful for testing
+ * and for running X (or similar) on headless machines. VKMS aims to enable
+ * a virtual display with no need of a hardware display capability, releasing
+ * the GPU in DRM API tests.
  */
 
 #include 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 2/2] drm/atomic: clear new_state pointers at hw_done

2019-11-01 Thread Rob Clark
On Fri, Nov 1, 2019 at 2:44 PM Ville Syrjälä
 wrote:
>
> On Fri, Nov 01, 2019 at 12:49:02PM -0700, Rob Clark wrote:
> > On Fri, Nov 1, 2019 at 12:25 PM Ville Syrjälä
> >  wrote:
> > >
> > > On Fri, Nov 01, 2019 at 11:07:13AM -0700, Rob Clark wrote:
> > > > From: Rob Clark 
> > > >
> > > > The new state should not be accessed after this point.  Clear the
> > > > pointers to make that explicit.
> > > >
> > > > This makes the error corrected in the previous patch more obvious.
> > > >
> > > > Signed-off-by: Rob Clark 
> > > > ---
> > > >  drivers/gpu/drm/drm_atomic_helper.c | 29 +
> > > >  1 file changed, 29 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> > > > b/drivers/gpu/drm/drm_atomic_helper.c
> > > > index 732bd0ce9241..176831df8163 100644
> > > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > > @@ -2234,13 +2234,42 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> > > >   */
> > > >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state 
> > > > *old_state)
> > > >  {
> > > > + struct drm_connector *connector;
> > > > + struct drm_connector_state *old_conn_state, *new_conn_state;
> > > >   struct drm_crtc *crtc;
> > > >   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > > + struct drm_plane *plane;
> > > > + struct drm_plane_state *old_plane_state, *new_plane_state;
> > > >   struct drm_crtc_commit *commit;
> > > > + struct drm_private_obj *obj;
> > > > + struct drm_private_state *old_obj_state, *new_obj_state;
> > > >   int i;
> > > >
> > > > + /*
> > > > +  * After this point, drivers should not access the permanent 
> > > > modeset
> > > > +  * state, so we also clear the new_state pointers to make this
> > > > +  * restriction explicit.
> > > > +  *
> > > > +  * For the CRTC state, we do this in the same loop where we signal
> > > > +  * hw_done, since we still need to new_crtc_state to fish out the
> > > > +  * commit.
> > > > +  */
> > > > +
> > > > + for_each_oldnew_connector_in_state(old_state, connector, 
> > > > old_conn_state, new_conn_state, i) {
> > > > + old_state->connectors[i].new_state = NULL;
> > > > + }
> > > > +
> > > > + for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, 
> > > > new_plane_state, i) {
> > > > + old_state->planes[i].new_state = NULL;
> > > > + }
> > > > +
> > > > + for_each_oldnew_private_obj_in_state(old_state, obj, 
> > > > old_obj_state, new_obj_state, i) {
> > > > + old_state->private_objs[i].new_state = NULL;
> > > > + }
> > > > +
> > > >   for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, 
> > > > new_crtc_state, i) {
> > > >   old_state->crtcs[i].new_self_refresh_active = 
> > > > new_crtc_state->self_refresh_active;
> > > > + old_state->crtcs[i].new_state = NULL;
> > >
> > > That's going to be a real PITA when doing programming after the fact from
> > > a vblank worker. It's already a pain that the new_crtc_state->state is
> > > getting NULLed somewhere.
> > >
> >
> > I think you already have that problem, this just makes it explicit.
>
> I don't yet. Except on a branch where I have my vblank workers.
> And I think the only problem is having the helpers/core clobber
> the pointers when it should not. I don't see why it can't just
> leave them be and let me use them.
>

I guess it comes down to what assumptions you can make in driver
backend.  But if you can, for example, move planes between crtcs, I
think you can't make assumptions about the order in which things
complete even if you don't have commits overtaking each other on a
single crtc..

BR,
-R
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2104/2647] drivers/gpu/drm/ttm/ttm_bo_manager.c:60:7: error: variable 'sflags' has initializer but incomplete type

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: 769e4dc19ad658720b779070764db2fc10a0bbac [2104/2647] drm/amdkcl: Test 
whether drm_mm_insert_mode is available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 769e4dc19ad658720b779070764db2fc10a0bbac
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

from include/drm/drm_print.h:32,
from include/drm/drm_mm.h:49,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/kref.h:36:28: note: previous definition of 'kref_read' was here
static inline unsigned int kref_read(const struct kref *kref)
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_kref.h: In function 'kref_read':
   include/kcl/kcl_kref.h:9:21: error: passing argument 1 of 'atomic_read' from 
incompatible pointer type [-Werror=incompatible-pointer-types]
 return atomic_read(>refcount);
^
   In file included from arch/x86/include/asm/atomic.h:265:0,
from include/linux/atomic.h:7,
from include/linux/rcupdate.h:25,
from include/linux/rbtree.h:34,
from include/drm/drm_mm.h:41,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/asm-generic/atomic-instrumented.h:24:1: note: expected 'const 
atomic_t * {aka const struct  *}' but argument is of type 'const 
refcount_t * {aka const struct refcount_struct *}'
atomic_read(const atomic_t *v)
^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h: At top level:
   include/kcl/kcl_mm_types.h:10:3: error: conflicting types for 'pfn_t'
} pfn_t;
  ^
   In file included from include/asm-generic/memory_model.h:5:0,
from arch/x86/include/asm/page.h:76,
from arch/x86/include/asm/thread_info.h:12,
from include/linux/thread_info.h:38,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:78,
from include/linux/rcupdate.h:27,
from include/linux/rbtree.h:34,
from include/drm/drm_mm.h:41,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/pfn.h:15:3: note: previous declaration of 'pfn_t' was here
} pfn_t;
  ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h:33:13: error: conflicting types for 'vm_fault_t'
typedef int vm_fault_t;
^~
   In file included from include/drm/drm_mm.h:43:0,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm_types.h:631:32: note: previous declaration of 'vm_fault_t' 
was here
typedef __bitwise unsigned int vm_fault_t;
   ^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h:35:26: error: conflicting types for 
'vmf_insert_mixed'
static inline vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma,
 ^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:2587:12: note: previous declaration of 'vmf_insert_mixed' 
was here
vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
   ^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:12:0,
from :0:
   include/kcl/kcl_mm_types.h: In function 'vmf_insert_mixed':
   include/kcl/kcl_mm_types.h:41:8: error: implicit declaration of function 
'vm_insert_mixed'; did you mean 'vmf_insert_mixed'? 

[PATCH v2 VKMS 0/2] drm/vkms: Changing some words in 'blend' function documentation

2019-11-01 Thread Gabriela Bittencourt
Changes in v2:
- Add fixing typo in word 'destination'
- Add change of the preposition
- In v1 the name of the function was wrong, fix it in this version
- Add the patch changing the word 'TODO'

I've tested the patches using kernel-doc

Gabriela Bittencourt (2):
  drm/vkms: Fix typo and preposion in function documentation
  drm/vkms: Changing a 'Todo' to a 'TODO' in code comment

 drivers/gpu/drm/vkms/vkms_composer.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 VKMS 2/2] drm/vkms: Changing a 'Todo' to a 'TODO' in code comment

2019-11-01 Thread Gabriela Bittencourt
Changing the task introduction for the word 'TODO'. With the TODO word all
in uppercase, as is the standard, it's easier to find the tasks that have
to be done throughout the code.

Signed-off-by: Gabriela Bittencourt 
---
 drivers/gpu/drm/vkms/vkms_composer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vkms/vkms_composer.c 
b/drivers/gpu/drm/vkms/vkms_composer.c
index 88890ddfc4bd..4af2f19480f4 100644
--- a/drivers/gpu/drm/vkms/vkms_composer.c
+++ b/drivers/gpu/drm/vkms/vkms_composer.c
@@ -54,7 +54,7 @@ static uint32_t compute_crc(void *vaddr_out, struct 
vkms_composer *composer)
  * at vaddr_dst using buffer's metadata to locate the new values
  * from vaddr_src and their destination at vaddr_dst.
  *
- * Todo: Use the alpha value to blend vaddr_src with vaddr_dst
+ * TODO: Use the alpha value to blend vaddr_src with vaddr_dst
  *  instead of overwriting it.
  */
 static void blend(void *vaddr_dst, void *vaddr_src,
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 VKMS 1/2] drm/vkms: Fix typo and preposion in function documentation

2019-11-01 Thread Gabriela Bittencourt
Fix typo in word 'blend' and in the word 'destination' and change
preposition 'at' to 'of' in function 'blend' documentation.

Signed-off-by: Gabriela Bittencourt 

---

Changes in v2:
- Add fixing typo in word 'destination'
- Add change of the preposition
- In v1 the name of the function was wrong, fix it in this version
---
 drivers/gpu/drm/vkms/vkms_composer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_composer.c 
b/drivers/gpu/drm/vkms/vkms_composer.c
index d5585695c64d..88890ddfc4bd 100644
--- a/drivers/gpu/drm/vkms/vkms_composer.c
+++ b/drivers/gpu/drm/vkms/vkms_composer.c
@@ -43,16 +43,16 @@ static uint32_t compute_crc(void *vaddr_out, struct 
vkms_composer *composer)
 }
 
 /**
- * blend - belnd value at vaddr_src with value at vaddr_dst
+ * blend - blend value at vaddr_src with value at vaddr_dst
  * @vaddr_dst: destination address
  * @vaddr_src: source address
  * @dest_composer: destination framebuffer's metadata
  * @src_composer: source framebuffer's metadata
  *
  * Blend value at vaddr_src with value at vaddr_dst.
- * Currently, this function write value at vaddr_src on value
+ * Currently, this function write value of vaddr_src on value
  * at vaddr_dst using buffer's metadata to locate the new values
- * from vaddr_src and their distenation at vaddr_dst.
+ * from vaddr_src and their destination at vaddr_dst.
  *
  * Todo: Use the alpha value to blend vaddr_src with vaddr_dst
  *  instead of overwriting it.
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 2/2] drm/atomic: clear new_state pointers at hw_done

2019-11-01 Thread Ville Syrjälä
On Fri, Nov 01, 2019 at 12:49:02PM -0700, Rob Clark wrote:
> On Fri, Nov 1, 2019 at 12:25 PM Ville Syrjälä
>  wrote:
> >
> > On Fri, Nov 01, 2019 at 11:07:13AM -0700, Rob Clark wrote:
> > > From: Rob Clark 
> > >
> > > The new state should not be accessed after this point.  Clear the
> > > pointers to make that explicit.
> > >
> > > This makes the error corrected in the previous patch more obvious.
> > >
> > > Signed-off-by: Rob Clark 
> > > ---
> > >  drivers/gpu/drm/drm_atomic_helper.c | 29 +
> > >  1 file changed, 29 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> > > b/drivers/gpu/drm/drm_atomic_helper.c
> > > index 732bd0ce9241..176831df8163 100644
> > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > @@ -2234,13 +2234,42 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
> > >   */
> > >  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> > >  {
> > > + struct drm_connector *connector;
> > > + struct drm_connector_state *old_conn_state, *new_conn_state;
> > >   struct drm_crtc *crtc;
> > >   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> > > + struct drm_plane *plane;
> > > + struct drm_plane_state *old_plane_state, *new_plane_state;
> > >   struct drm_crtc_commit *commit;
> > > + struct drm_private_obj *obj;
> > > + struct drm_private_state *old_obj_state, *new_obj_state;
> > >   int i;
> > >
> > > + /*
> > > +  * After this point, drivers should not access the permanent modeset
> > > +  * state, so we also clear the new_state pointers to make this
> > > +  * restriction explicit.
> > > +  *
> > > +  * For the CRTC state, we do this in the same loop where we signal
> > > +  * hw_done, since we still need to new_crtc_state to fish out the
> > > +  * commit.
> > > +  */
> > > +
> > > + for_each_oldnew_connector_in_state(old_state, connector, 
> > > old_conn_state, new_conn_state, i) {
> > > + old_state->connectors[i].new_state = NULL;
> > > + }
> > > +
> > > + for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, 
> > > new_plane_state, i) {
> > > + old_state->planes[i].new_state = NULL;
> > > + }
> > > +
> > > + for_each_oldnew_private_obj_in_state(old_state, obj, old_obj_state, 
> > > new_obj_state, i) {
> > > + old_state->private_objs[i].new_state = NULL;
> > > + }
> > > +
> > >   for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, 
> > > new_crtc_state, i) {
> > >   old_state->crtcs[i].new_self_refresh_active = 
> > > new_crtc_state->self_refresh_active;
> > > + old_state->crtcs[i].new_state = NULL;
> >
> > That's going to be a real PITA when doing programming after the fact from
> > a vblank worker. It's already a pain that the new_crtc_state->state is
> > getting NULLed somewhere.
> >
> 
> I think you already have that problem, this just makes it explicit.

I don't yet. Except on a branch where I have my vblank workers.
And I think the only problem is having the helpers/core clobber
the pointers when it should not. I don't see why it can't just
leave them be and let me use them.

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v14 2/5] dma-buf: heaps: Add heap helpers

2019-11-01 Thread John Stultz
Add generic helper dmabuf ops for dma heaps, so we can reduce
the amount of duplicative code for the exported dmabufs.

This code is an evolution of the Android ION implementation, so
thanks to its original authors and maintainters:
  Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Sandeep Patil 
Cc: Hillf Danton 
Cc: Dave Airlie 
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard 
Reviewed-by: Brian Starkey 
Acked-by: Laura Abbott 
Tested-by: Ayan Kumar Halder 
Signed-off-by: John Stultz 
---
v2:
* Removed cache management performance hack that I had
  accidentally folded in.
* Removed stats code that was in helpers
* Lots of checkpatch cleanups
v3:
* Uninline INIT_HEAP_HELPER_BUFFER (suggested by Christoph)
* Switch to WARN on buffer destroy failure (suggested by Brian)
* buffer->kmap_cnt decrementing cleanup (suggested by Christoph)
* Extra buffer->vaddr checking in dma_heap_dma_buf_kmap
  (suggested by Brian)
* Switch to_helper_buffer from macro to inline function
  (suggested by Benjamin)
* Rename kmap->vmap (folded in from Andrew)
* Use vmap for vmapping - not begin_cpu_access (folded in from
  Andrew)
* Drop kmap for now, as its optional (folded in from Andrew)
* Fold dma_heap_map_user into the single caller (foled in from
  Andrew)
* Folded in patch from Andrew to track page list per heap not
  sglist, which simplifies the tracking logic
v4:
* Moved dma-heap.h change out to previous patch
v6:
* Minor cleanups and typo fixes suggested by Brian
v7:
* Removed stray ;
* Make init_heap_helper_buffer lowercase, as suggested by Christoph
* Add dmabuf export helper to reduce boilerplate code
v8:
* Remove unused private_flags value
* Condense dma_heap_buffer and heap_helper_buffer (suggested by
  Christoph)
* Fix indentation by using shorter argument names (suggested by
  Christoph)
* Add flush_kernel_vmap_range/invalidate_kernel_vmap_range calls
  (suggested by Christoph)
* Checkpatch whitespace fixups
v9:
* Minor cleanups suggested by Brian Starkey
v10:
* Fix missing vmalloc.h inclusion in heap helpers (found by
  kbuild test robot )
v12:
* Add symbol exports for heaps as modules
v13:
* Re-remove symbol exports, per discussion with Brian, as I'll
  resubmit the change for review independently.
v14:
* Fix missing argment to WARN() in dma_heap_buffer_destroy()
  found and fixed by Dan Carpenter 
* Add check in fault hanlder that pgoff isn't larger then
  pagecount, reported by Dan Carpenter

---
 drivers/dma-buf/Makefile |   1 +
 drivers/dma-buf/heaps/Makefile   |   2 +
 drivers/dma-buf/heaps/heap-helpers.c | 271 +++
 drivers/dma-buf/heaps/heap-helpers.h |  55 ++
 4 files changed, 329 insertions(+)
 create mode 100644 drivers/dma-buf/heaps/Makefile
 create mode 100644 drivers/dma-buf/heaps/heap-helpers.c
 create mode 100644 drivers/dma-buf/heaps/heap-helpers.h

diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index caee5eb3d351..9c190026bfab 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -2,6 +2,7 @@
 obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
 dma-resv.o seqno-fence.o
 obj-$(CONFIG_DMABUF_HEAPS) += dma-heap.o
+obj-$(CONFIG_DMABUF_HEAPS) += heaps/
 obj-$(CONFIG_SYNC_FILE)+= sync_file.o
 obj-$(CONFIG_SW_SYNC)  += sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)  += udmabuf.o
diff --git a/drivers/dma-buf/heaps/Makefile b/drivers/dma-buf/heaps/Makefile
new file mode 100644
index ..de49898112db
--- /dev/null
+++ b/drivers/dma-buf/heaps/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-y  += heap-helpers.o
diff --git a/drivers/dma-buf/heaps/heap-helpers.c 
b/drivers/dma-buf/heaps/heap-helpers.c
new file mode 100644
index ..9f964ca3f59c
--- /dev/null
+++ b/drivers/dma-buf/heaps/heap-helpers.c
@@ -0,0 +1,271 @@
+// SPDX-License-Identifier: GPL-2.0
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "heap-helpers.h"
+
+void init_heap_helper_buffer(struct heap_helper_buffer *buffer,
+void (*free)(struct heap_helper_buffer *))
+{
+   buffer->priv_virt = NULL;
+   mutex_init(>lock);
+   buffer->vmap_cnt = 0;
+   buffer->vaddr = NULL;
+   buffer->pagecount = 0;
+   buffer->pages = NULL;
+   INIT_LIST_HEAD(>attachments);
+   buffer->free = free;
+}
+
+struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer,
+ int fd_flags)
+{
+   DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
+
+   exp_info.ops = _helper_ops;
+   

[PATCH v14 4/5] dma-buf: heaps: Add CMA heap to dmabuf heaps

2019-11-01 Thread John Stultz
This adds a CMA heap, which allows userspace to allocate
a dma-buf of contiguous memory out of a CMA region.

This code is an evolution of the Android ION implementation, so
thanks to its original author and maintainters:
  Benjamin Gaignard, Laura Abbott, and others!

NOTE: This patch only adds the default CMA heap. We will enable
selectively adding other CMA memory regions to the dmabuf heaps
interface with a later patch (which requires a dt binding)

Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Sandeep Patil 
Cc: Hillf Danton 
Cc: Dave Airlie 
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard 
Reviewed-by: Brian Starkey 
Acked-by: Laura Abbott 
Tested-by: Ayan Kumar Halder 
Signed-off-by: John Stultz 
---
v2:
* Switch allocate to return dmabuf fd
* Simplify init code
* Checkpatch fixups
v3:
* Switch to inline function for to_cma_heap()
* Minor cleanups suggested by Brian
* Fold in new registration style from Andrew
* Folded in changes from Andrew to use simplified page list
  from the heap helpers
v4:
* Use the fd_flags when creating dmabuf fd (Suggested by
  Benjamin)
* Use precalculated pagecount (Suggested by Andrew)
v6:
* Changed variable names to improve clarity, as suggested
  by Brian
v7:
* Use newly lower-cased init_heap_helper_buffer helper
* Use new dmabuf export helper
v8:
* Make struct dma_heap_ops const (Suggested by Christoph)
* Condense dma_heap_buffer and heap_helper_buffer (suggested by
  Christoph)
* Checkpatch whitespace fixups
v9:
* Removing needless check noted by Brian Starkey
* Rename dma_heap_get_data->dma_heap_get_drvdata suggested
  by Hilf Danton
* Check signals after clearing memory pages to avoid doing
  needless work if the task is killed as suggested by Hilf
v12:
* Rework to only add the default CMA heap
---
 drivers/dma-buf/heaps/Kconfig|   8 ++
 drivers/dma-buf/heaps/Makefile   |   1 +
 drivers/dma-buf/heaps/cma_heap.c | 178 +++
 3 files changed, 187 insertions(+)
 create mode 100644 drivers/dma-buf/heaps/cma_heap.c

diff --git a/drivers/dma-buf/heaps/Kconfig b/drivers/dma-buf/heaps/Kconfig
index 205052744169..a5eef06c4226 100644
--- a/drivers/dma-buf/heaps/Kconfig
+++ b/drivers/dma-buf/heaps/Kconfig
@@ -4,3 +4,11 @@ config DMABUF_HEAPS_SYSTEM
help
  Choose this option to enable the system dmabuf heap. The system heap
  is backed by pages from the buddy allocator. If in doubt, say Y.
+
+config DMABUF_HEAPS_CMA
+   bool "DMA-BUF CMA Heap"
+   depends on DMABUF_HEAPS && DMA_CMA
+   help
+ Choose this option to enable dma-buf CMA heap. This heap is backed
+ by the Contiguous Memory Allocator (CMA). If your system has these
+ regions, you should say Y here.
diff --git a/drivers/dma-buf/heaps/Makefile b/drivers/dma-buf/heaps/Makefile
index d1808eca2581..6e54cdec3da0 100644
--- a/drivers/dma-buf/heaps/Makefile
+++ b/drivers/dma-buf/heaps/Makefile
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-y  += heap-helpers.o
 obj-$(CONFIG_DMABUF_HEAPS_SYSTEM)  += system_heap.o
+obj-$(CONFIG_DMABUF_HEAPS_CMA) += cma_heap.o
diff --git a/drivers/dma-buf/heaps/cma_heap.c b/drivers/dma-buf/heaps/cma_heap.c
new file mode 100644
index ..064926b5d735
--- /dev/null
+++ b/drivers/dma-buf/heaps/cma_heap.c
@@ -0,0 +1,178 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * DMABUF CMA heap exporter
+ *
+ * Copyright (C) 2012, 2019 Linaro Ltd.
+ * Author:  for ST-Ericsson.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "heap-helpers.h"
+
+struct cma_heap {
+   struct dma_heap *heap;
+   struct cma *cma;
+};
+
+static void cma_heap_free(struct heap_helper_buffer *buffer)
+{
+   struct cma_heap *cma_heap = dma_heap_get_drvdata(buffer->heap);
+   unsigned long nr_pages = buffer->pagecount;
+   struct page *cma_pages = buffer->priv_virt;
+
+   /* free page list */
+   kfree(buffer->pages);
+   /* release memory */
+   cma_release(cma_heap->cma, cma_pages, nr_pages);
+   kfree(buffer);
+}
+
+/* dmabuf heap CMA operations functions */
+static int cma_heap_allocate(struct dma_heap *heap,
+unsigned long len,
+unsigned long fd_flags,
+unsigned long heap_flags)
+{
+   struct cma_heap *cma_heap = dma_heap_get_drvdata(heap);
+   struct heap_helper_buffer *helper_buffer;
+   struct page *cma_pages;
+   size_t size = PAGE_ALIGN(len);
+   unsigned long nr_pages = size >> PAGE_SHIFT;
+   unsigned long align = get_order(size);
+   struct dma_buf *dmabuf;
+   int ret = -ENOMEM;
+  

[PATCH v14 3/5] dma-buf: heaps: Add system heap to dmabuf heaps

2019-11-01 Thread John Stultz
This patch adds system heap to the dma-buf heaps framework.

This allows applications to get a page-allocator backed dma-buf
for non-contiguous memory.

This code is an evolution of the Android ION implementation, so
thanks to its original authors and maintainters:
  Rebecca Schultz Zavin, Colin Cross, Laura Abbott, and others!

Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Sandeep Patil 
Cc: Hillf Danton 
Cc: Dave Airlie 
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard 
Reviewed-by: Brian Starkey 
Acked-by: Laura Abbott 
Tested-by: Ayan Kumar Halder 
Signed-off-by: John Stultz 
---
v2:
* Switch allocate to return dmabuf fd
* Simplify init code
* Checkpatch fixups
* Droped dead system-contig code
v3:
* Whitespace fixups from Benjamin
* Make sure we're zeroing the allocated pages (from Liam)
* Use PAGE_ALIGN() consistently (suggested by Brian)
* Fold in new registration style from Andrew
* Avoid needless dynamic allocation of sys_heap (suggested by
  Christoph)
* Minor cleanups
* Folded in changes from Andrew to use simplified page list
  from the heap helpers
v4:
* Optimization to allocate pages in chunks, similar to old
  pagepool code
* Use fd_flags when creating dmabuf fd (Suggested by Benjamin)
v5:
* Back out large order page allocations (was leaking memory,
  as the page array didn't properly track order size)
v6:
* Minor whitespace change suggested by Brian
* Remove unused variable
v7:
* Use newly lower-cased init_heap_helper_buffer helper
* Add system heap DOS avoidance suggested by Laura from ION code
* Use new dmabuf export helper
v8:
* Make struct dma_heap_ops consts (suggested by Christoph)
* Get rid of needless struct system_heap (suggested by Christoph)
* Condense dma_heap_buffer and heap_helper_buffer (suggested by
  Christoph)
* Add forgotten include file to fix build issue on x86
v12:
* Minor tweaks to prep loading heap from module
v14:
* Fix "redundant assignment to variable ret" issue reported
  by Colin King and fixed by Andrew Davis
---
 drivers/dma-buf/Kconfig |   2 +
 drivers/dma-buf/heaps/Kconfig   |   6 ++
 drivers/dma-buf/heaps/Makefile  |   1 +
 drivers/dma-buf/heaps/system_heap.c | 124 
 4 files changed, 133 insertions(+)
 create mode 100644 drivers/dma-buf/heaps/Kconfig
 create mode 100644 drivers/dma-buf/heaps/system_heap.c

diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index bffa58fc3e6e..0613bb7770f5 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -53,4 +53,6 @@ menuconfig DMABUF_HEAPS
  allows userspace to allocate dma-bufs that can be shared
  between drivers.
 
+source "drivers/dma-buf/heaps/Kconfig"
+
 endmenu
diff --git a/drivers/dma-buf/heaps/Kconfig b/drivers/dma-buf/heaps/Kconfig
new file mode 100644
index ..205052744169
--- /dev/null
+++ b/drivers/dma-buf/heaps/Kconfig
@@ -0,0 +1,6 @@
+config DMABUF_HEAPS_SYSTEM
+   bool "DMA-BUF System Heap"
+   depends on DMABUF_HEAPS
+   help
+ Choose this option to enable the system dmabuf heap. The system heap
+ is backed by pages from the buddy allocator. If in doubt, say Y.
diff --git a/drivers/dma-buf/heaps/Makefile b/drivers/dma-buf/heaps/Makefile
index de49898112db..d1808eca2581 100644
--- a/drivers/dma-buf/heaps/Makefile
+++ b/drivers/dma-buf/heaps/Makefile
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-y  += heap-helpers.o
+obj-$(CONFIG_DMABUF_HEAPS_SYSTEM)  += system_heap.o
diff --git a/drivers/dma-buf/heaps/system_heap.c 
b/drivers/dma-buf/heaps/system_heap.c
new file mode 100644
index ..9a56393e40b4
--- /dev/null
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -0,0 +1,124 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * DMABUF System heap exporter
+ *
+ * Copyright (C) 2011 Google, Inc.
+ * Copyright (C) 2019 Linaro Ltd.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "heap-helpers.h"
+
+struct dma_heap *sys_heap;
+
+static void system_heap_free(struct heap_helper_buffer *buffer)
+{
+   pgoff_t pg;
+
+   for (pg = 0; pg < buffer->pagecount; pg++)
+   __free_page(buffer->pages[pg]);
+   kfree(buffer->pages);
+   kfree(buffer);
+}
+
+static int system_heap_allocate(struct dma_heap *heap,
+   unsigned long len,
+   unsigned long fd_flags,
+   unsigned long heap_flags)
+{
+   struct heap_helper_buffer *helper_buffer;
+   struct dma_buf *dmabuf;
+   int ret = -ENOMEM;
+   pgoff_t pg;
+
+   helper_buffer = kzalloc(sizeof(*helper_buffer), GFP_KERNEL);
+   if (!helper_buffer)
+  

[PATCH v14 1/5] dma-buf: Add dma-buf heaps framework

2019-11-01 Thread John Stultz
From: "Andrew F. Davis" 

This framework allows a unified userspace interface for dma-buf
exporters, allowing userland to allocate specific types of memory
for use in dma-buf sharing.

Each heap is given its own device node, which a user can allocate
a dma-buf fd from using the DMA_HEAP_IOC_ALLOC.

Additionally should the interface grow in the future, we have a
DMA_HEAP_IOC_GET_FEATURES ioctl which can return future feature
flags.

This code is an evoluiton of the Android ION implementation,
and a big thanks is due to its authors/maintainers over time
for their effort:
  Rebecca Schultz Zavin, Colin Cross, Benjamin Gaignard,
  Laura Abbott, and many other contributors!

Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Sandeep Patil 
Cc: Hillf Danton 
Cc: Dave Airlie 
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Andrew F. Davis 
Signed-off-by: John Stultz 
---
v2:
* Folded down fixes I had previously shared in implementing
  heaps
* Make flags a u64 (Suggested by Laura)
* Add PAGE_ALIGN() fix to the core alloc funciton
* IOCTL fixups suggested by Brian
* Added fixes suggested by Benjamin
* Removed core stats mgmt, as that should be implemented by
  per-heap code
* Changed alloc to return a dma-buf fd, rather than a buffer
  (as it simplifies error handling)
v3:
* Removed scare-quotes in MAINTAINERS email address
* Get rid of .release function as it didn't do anything (from
  Christoph)
* Renamed filp to file (suggested by Christoph)
* Split out ioctl handling to separate function (suggested by
  Christoph)
* Add comment documenting PAGE_ALIGN usage (suggested by Brian)
* Switch from idr to Xarray (suggested by Brian)
* Fixup cdev creation (suggested by Brian)
* Avoid EXPORT_SYMBOL until we finalize modules (suggested by
  Brian)
* Make struct dma_heap internal only (folded in from Andrew)
* Small cleanups suggested by GregKH
* Provide class->devnode callback to get consistent /dev/
  subdirectory naming (Suggested by Bjorn)
v4:
* Folded down dma-heap.h change that was in a following patch
* Added fd_flags entry to allocation structure and pass it
  through to heap code for use on dma-buf fd creation (suggested
  by Benjamin)
v5:
* Minor cleanups
v6:
* Improved error path handling, minor whitespace fixes, both
  suggested by Brian
v7:
* Longer Kconfig description to quiet checkpatch warnings
* Re-add compat_ioctl bits (Hridya noticed 32bit userland wasn't
  working)
v8:
* Make struct dma_heap_ops consts (Suggested by Christoph)
* Checkpatch whitespace fixups
v9:
* Minor cleanups suggested by Brian Starkey
* Rename dma_heap_get_data->dma_heap_get_drvdata suggested
  by Hilf Danton
v11:
* Kconfig text improvements suggested by Randy Dunlap
v12:
* Add logic to prevent duplicately named heaps being added
* Add symbol exports for heaps as modules
v13:
* Re-remove symbol exports per discussion w/ Brian. Will
  resubmit in a separte patch for review
v14:
* Reworked ioctl handler to zero fill any difference in
  structure size, similar to what the DRM core does, as
  suggested by Dave Airlie
* Removed now unnecessary reserved bits in allocate_data
* Added get_features ioctl as suggested by Dave Airlie
* Removed pr_warn_once messages as requested by Dave
  Airlie
---
 MAINTAINERS   |  18 ++
 drivers/dma-buf/Kconfig   |   9 +
 drivers/dma-buf/Makefile  |   1 +
 drivers/dma-buf/dma-heap.c| 313 ++
 include/linux/dma-heap.h  |  59 +++
 include/uapi/linux/dma-heap.h |  77 +
 6 files changed, 477 insertions(+)
 create mode 100644 drivers/dma-buf/dma-heap.c
 create mode 100644 include/linux/dma-heap.h
 create mode 100644 include/uapi/linux/dma-heap.h

diff --git a/MAINTAINERS b/MAINTAINERS
index c6c34d04ce95..77c3e993fb2f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4940,6 +4940,24 @@ F:   include/linux/*fence.h
 F: Documentation/driver-api/dma-buf.rst
 T: git git://anongit.freedesktop.org/drm/drm-misc
 
+DMA-BUF HEAPS FRAMEWORK
+M: Sumit Semwal 
+R: Andrew F. Davis 
+R: Benjamin Gaignard 
+R: Liam Mark 
+R: Laura Abbott 
+R: Brian Starkey 
+R: John Stultz 
+S: Maintained
+L: linux-me...@vger.kernel.org
+L: dri-devel@lists.freedesktop.org
+L: linaro-mm-...@lists.linaro.org (moderated for non-subscribers)
+F: include/uapi/linux/dma-heap.h
+F: include/linux/dma-heap.h
+F: drivers/dma-buf/dma-heap.c
+F: drivers/dma-buf/heaps/*
+T: git git://anongit.freedesktop.org/drm/drm-misc
+
 DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
 M: Vinod Koul 
 L: dmaeng...@vger.kernel.org
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index a23b6752d11a..bffa58fc3e6e 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -44,4 +44,13 @@ config 

[PATCH v14 5/5] kselftests: Add dma-heap test

2019-11-01 Thread John Stultz
Add very trivial allocation and import test for dma-heaps,
utilizing the vgem driver as a test importer.

A good chunk of this code taken from:
  tools/testing/selftests/android/ion/ionmap_test.c
  Originally by Laura Abbott 

Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Sandeep Patil 
Cc: Hillf Danton 
Cc: Dave Airlie 
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Benjamin Gaignard 
Reviewed-by: Brian Starkey 
Acked-by: Laura Abbott 
Tested-by: Ayan Kumar Halder 
Signed-off-by: John Stultz 
---
v2:
* Switched to use reworked dma-heap apis
v3:
* Add simple mmap
* Utilize dma-buf testdev to test importing
v4:
* Rework to use vgem
* Pass in fd_flags to match interface changes
* Skip . and .. dirs
v6:
* Number of style/cleanups suggested by Brian
v7:
* Whitespace fixup for checkpatch
v8:
* More checkpatch whitespace fixups
v9:
* Better handling error returns out to main, suggested
  by Brian Starkey
* Switch to using snprintf, suggested by Brian
v14:
* Fix a missing return value
* Add calls to test the GET_FEATURES ioctl
* Build fix reported by kernel test robot 
  and fixed by Xiao Yang 
* Minor Makefile cleanups
---
 tools/testing/selftests/dmabuf-heaps/Makefile |   6 +
 .../selftests/dmabuf-heaps/dmabuf-heap.c  | 255 ++
 2 files changed, 261 insertions(+)
 create mode 100644 tools/testing/selftests/dmabuf-heaps/Makefile
 create mode 100644 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c

diff --git a/tools/testing/selftests/dmabuf-heaps/Makefile 
b/tools/testing/selftests/dmabuf-heaps/Makefile
new file mode 100644
index ..607c2acd2082
--- /dev/null
+++ b/tools/testing/selftests/dmabuf-heaps/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+CFLAGS += -static -O3 -Wl,-no-as-needed -Wall -I../../../../usr/include
+
+TEST_GEN_PROGS = dmabuf-heap
+
+include ../lib.mk
diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c 
b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
new file mode 100644
index ..ec47901ef2e2
--- /dev/null
+++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
@@ -0,0 +1,255 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "../../../../include/uapi/linux/dma-heap.h"
+
+#define DEVPATH "/dev/dma_heap"
+
+static int check_vgem(int fd)
+{
+   drm_version_t version = { 0 };
+   char name[5];
+   int ret;
+
+   version.name_len = 4;
+   version.name = name;
+
+   ret = ioctl(fd, DRM_IOCTL_VERSION, );
+   if (ret)
+   return 0;
+
+   return !strcmp(name, "vgem");
+}
+
+static int open_vgem(void)
+{
+   int i, fd;
+   const char *drmstr = "/dev/dri/card";
+
+   fd = -1;
+   for (i = 0; i < 16; i++) {
+   char name[80];
+
+   snprintf(name, 80, "%s%u", drmstr, i);
+
+   fd = open(name, O_RDWR);
+   if (fd < 0)
+   continue;
+
+   if (!check_vgem(fd)) {
+   close(fd);
+   fd = -1;
+   continue;
+   } else {
+   break;
+   }
+   }
+   return fd;
+}
+
+static int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
+{
+   struct drm_prime_handle import_handle = {
+   .fd = dma_buf_fd,
+   .flags = 0,
+   .handle = 0,
+};
+   int ret;
+
+   ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, _handle);
+   if (ret == 0)
+   *handle = import_handle.handle;
+   return ret;
+}
+
+static void close_handle(int vgem_fd, uint32_t handle)
+{
+   struct drm_gem_close close = {
+   .handle = handle,
+   };
+
+   ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, );
+}
+
+static int dmabuf_heap_open(char *name)
+{
+   int ret, fd;
+   char buf[256];
+
+   ret = snprintf(buf, 256, "%s/%s", DEVPATH, name);
+   if (ret < 0) {
+   printf("snprintf failed!\n");
+   return ret;
+   }
+
+   fd = open(buf, O_RDWR);
+   if (fd < 0)
+   printf("open %s failed!\n", buf);
+   return fd;
+}
+
+static int dmabuf_heap_get_features(int fd, unsigned long long *features)
+{
+   struct dma_heap_get_features_data data = {0};
+   int ret;
+
+   ret = ioctl(fd, DMA_HEAP_IOC_GET_FEATURES, );
+   if (ret < 0)
+   return ret;
+
+   *features = (int)data.features;
+   return ret;
+}
+
+static int dmabuf_heap_alloc(int fd, size_t len, unsigned int flags,
+int *dmabuf_fd)
+{
+   struct dma_heap_allocation_data data = {
+   .len = len,
+  

[PATCH v14 0/5] DMA-BUF Heaps (destaging ION)

2019-11-01 Thread John Stultz
This again? I know!

Apologies to all who hoped I'd stop bothering them with this
patch set, but I ran afoul of the DRM tree rules by not
getting the userland patches properly reviewed prior to the
patches landing (I mistakenly was waiting for the patches to
land upstream before pushing the userland patches). Thus,
these were correctly reverted from the drm-misc-next tree.

My attempts to quickly fix the userland review issue didn't get
very far, as the revert brought additional eyes to the patchset,
and further interface changes were requested (comically, which
is the exact reason I was waiting to push the userland changes
:)

So like groundhog day, here we are again, with v14:

This patchset implements per-heap devices which can be opened
directly and then an ioctl is used to allocate a dmabuf from the
heap.

The interface is similar, but much simpler then IONs, only
providing an ALLOC ioctl (and a GET_FEATURES interface to help
with any future changes to the interface).

Also, I've provided relatively simple system and cma heaps.

I've booted and tested these patches with AOSP on the HiKey960
using the kernel tree here:
  
https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/dma-buf-heap

And the userspace changes here:
  https://android-review.googlesource.com/c/device/linaro/hikey/+/909436

Compared to ION, this patchset is missing the system-contig,
carveout and chunk heaps, as I don't have a device that uses
those, so I'm unable to do much useful validation there.
Additionally we have no upstream users of chunk or carveout,
and the system-contig has been deprecated in the common/andoid-*
kernels, so this should be ok.

I've also removed the stats accounting, since any such
accounting should be implemented by dma-buf core or the heaps
themselves.

New in v14:
* Reworked ioctl handler to zero fill any difference in
  structure size, similar to what the DRM core does, as
  suggested by Dave Airlie
* Removed now unnecessary reserved bits in allocate_data
* Added get_features ioctl as suggested by Dave Airlie
* Removed pr_warn_once messages as requested by Dave
  Airlie
* Fix missing argment to WARN() in dma_heap_buffer_destroy()
  found and fixed by Dan Carpenter 
* Add check in fault hanlder that pgoff isn't larger then
  pagecount, reported by Dan Carpenter
* Fix "redundant assignment to variable ret" issue reported
  by Colin King and fixed by Andrew Davis
* Fix a missing return value in kselftest
* Add calls to test the GET_FEATURES ioctl in ksefltest
* Build fix reported by kernel test robot 
  and fixed by Xiao Yang  for kselftest
* Minor kselftest Makefile cleanups

Many thanks again to the folks above who found and submitted
fixes to small issues while the patches were in -next! I've
folded them in to the patch set here.

The ioctl rework to avoid reserved fields, was mostly duplicated
from the DRM core, but it does add some complexity to the ioctl
handler so I'd appreciate extra review.

It felt substantial enough that I've removed the previous reviewed
by and acked-by tags, but please let me know if you'd like me to
re-add yours back.

Apologies again for my flub and the extra noise here!
I really appreciate everyone's patience with with me.

thanks
-john


Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Sandeep Patil 
Cc: Hillf Danton 
Cc: Dave Airlie 
Cc: dri-devel@lists.freedesktop.org

Andrew F. Davis (1):
  dma-buf: Add dma-buf heaps framework

John Stultz (4):
  dma-buf: heaps: Add heap helpers
  dma-buf: heaps: Add system heap to dmabuf heaps
  dma-buf: heaps: Add CMA heap to dmabuf heaps
  kselftests: Add dma-heap test

 MAINTAINERS   |  18 +
 drivers/dma-buf/Kconfig   |  11 +
 drivers/dma-buf/Makefile  |   2 +
 drivers/dma-buf/dma-heap.c| 313 ++
 drivers/dma-buf/heaps/Kconfig |  14 +
 drivers/dma-buf/heaps/Makefile|   4 +
 drivers/dma-buf/heaps/cma_heap.c  | 178 ++
 drivers/dma-buf/heaps/heap-helpers.c  | 271 +++
 drivers/dma-buf/heaps/heap-helpers.h  |  55 +++
 drivers/dma-buf/heaps/system_heap.c   | 124 +++
 include/linux/dma-heap.h  |  59 
 include/uapi/linux/dma-heap.h |  77 +
 tools/testing/selftests/dmabuf-heaps/Makefile |   6 +
 .../selftests/dmabuf-heaps/dmabuf-heap.c  | 255 ++
 14 files changed, 1387 insertions(+)
 create mode 100644 drivers/dma-buf/dma-heap.c
 create mode 100644 drivers/dma-buf/heaps/Kconfig
 create mode 100644 drivers/dma-buf/heaps/Makefile
 create mode 100644 drivers/dma-buf/heaps/cma_heap.c
 create mode 100644 drivers/dma-buf/heaps/heap-helpers.c
 create mode 100644 

[Bug 110381] Failed to updateMST allocation table forpipe idx:0

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=110381

--- Comment #11 from carben...@outlook.com ---
Seems to happen as well on 5.3.7 when waking two daisy-chained monitors from
sleep.

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI]
Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev ef)


[ 4511.360909] WARNING: CPU: 5 PID: 1848 at
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:2462
update_mst_stream_alloc_table.cold+0x15/0x28 [amdgpu]
[ 4511.360910] Modules linked in: uinput xt_CHECKSUM xt_MASQUERADE nf_nat_tftp
nf_conntrack_tftp tun bridge stp llc nf_conntrack_netbios_ns
nf_conntrack_broadcast xt_CT ip6t_REJECT nf_reject_ipv6 ip6t_rpfilter
ipt_REJECT nf_reject_ipv4 xt_conntrack ebtable_nat ebtable_broute ip6table_nat
ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat
iptable_mangle iptable_raw iptable_security nf_conntrack nf_defrag_ipv6
nf_defrag_ipv4 libcrc32c ip_set nfnetlink ebtable_filter ebtables
ip6table_filter ip6_tables iptable_filter sunrpc intel_rapl_msr
intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm
irqbypass ipmi_ssif snd_hda_codec_hdmi snd_hda_intel crct10dif_pclmul iTCO_wdt
crc32_pclmul iTCO_vendor_support snd_hda_codec ghash_clmulni_intel intel_cstate
snd_hda_core snd_hwdep snd_seq intel_uncore snd_seq_device intel_rapl_perf
i2c_i801 intel_pch_thermal snd_pcm mei_me joydev lpc_ich snd_timer mei snd
soundcore ipmi_si ipmi_devintf ipmi_msghandler ie31200_edac
[ 4511.360925]  acpi_pad binfmt_misc ip_tables hid_logitech_hidpp hid_corsair
hid_logitech_dj uas usb_storage amdgpu amd_iommu_v2 gpu_sched ttm
drm_kms_helper drm igb crc32c_intel dca i2c_algo_bit video fuse
[ 4511.360931] CPU: 5 PID: 1848 Comm: gnome-shell Tainted: GW
5.3.7-301.fc31.x86_64 #1
[ 4511.360932] Hardware name: Supermicro PIO-518D-TLN4F-ST031/X10SLM+-LN4F,
BIOS 3.2a 05/31/2019
[ 4511.360976] RIP: 0010:update_mst_stream_alloc_table.cold+0x15/0x28 [amdgpu]
[ 4511.360977] Code: fd ff 48 c7 c7 70 fc a2 c0 e8 63 d9 7d f3 0f 0b e9 0b 06
fd ff 48 c7 c7 b8 fd a2 c0 48 89 14 24 48 89 74 24 08 e8 47 d9 7d f3 <0f> 0b 48
8b 14 24 48 8b 74 24 08 44 8b 32 e9 a6 06 fd ff 48 c7 c7
[ 4511.360978] RSP: 0018:b88400b5f630 EFLAGS: 00010246
[ 4511.360978] RAX: 0024 RBX: a04003a72000 RCX:

[ 4511.360979] RDX:  RSI: a0400fb57908 RDI:
a0400fb57908
[ 4511.360979] RBP: b88400b5f6d0 R08: a0400fb57908 R09:
04b1
[ 4511.360980] R10: 0001a4b8 R11: 0003 R12:
b88400b5f640
[ 4511.360980] R13: a0400a675800 R14: 0002 R15:
a04003a72000
[ 4511.360981] FS:  7f8e2aa65d00() GS:a0400fb4()
knlGS:
[ 4511.360981] CS:  0010 DS:  ES:  CR0: 80050033
[ 4511.360982] CR2: 7fb99e333c88 CR3: 00040bf04005 CR4:
001606e0
[ 4511.360982] Call Trace:
[ 4511.361026]  core_link_enable_stream+0x665/0x870 [amdgpu]
[ 4511.361068]  ? dce110_apply_ctx_to_hw+0x4b0/0x530 [amdgpu]
[ 4511.361108]  dce110_apply_ctx_to_hw+0x4b0/0x530 [amdgpu]
[ 4511.361149]  dc_commit_state+0x280/0x5c0 [amdgpu]
[ 4511.361190]  amdgpu_dm_atomic_commit_tail+0xcfc/0x1c40 [amdgpu]
[ 4511.361216]  ? amdgpu_move_blit.constprop.0+0x9c/0x110 [amdgpu]
[ 4511.361242]  ? amdgpu_bo_move+0x142/0x280 [amdgpu]
[ 4511.361244]  ? ttm_bo_handle_move_mem+0x10b/0x4f0 [ttm]
[ 4511.361247]  ? ttm_bo_validate+0x11b/0x130 [ttm]
[ 4511.361272]  ? amdgpu_bo_pin_restricted+0x62/0x270 [amdgpu]
[ 4511.361274]  ? ttm_eu_backoff_reservation+0x44/0x80 [ttm]
[ 4511.361315]  ? dm_plane_helper_prepare_fb+0x16a/0x2a0 [amdgpu]
[ 4511.361318]  ? _cond_resched+0x15/0x30
[ 4511.361319]  ? wait_for_completion_timeout+0x38/0x170
[ 4511.361326]  ? commit_tail+0x3c/0x70 [drm_kms_helper]
[ 4511.361367]  ? amdgpu_dm_audio_eld_notify+0x60/0x60 [amdgpu]
[ 4511.361371]  commit_tail+0x3c/0x70 [drm_kms_helper]
[ 4511.361375]  drm_atomic_helper_commit+0x108/0x110 [drm_kms_helper]
[ 4511.361379]  drm_atomic_helper_set_config+0x81/0x90 [drm_kms_helper]
[ 4511.361390]  drm_mode_setcrtc+0x194/0x6a0 [drm]
[ 4511.361397]  ? drm_mode_getcrtc+0x180/0x180 [drm]
[ 4511.361402]  drm_ioctl_kernel+0xaa/0xf0 [drm]
[ 4511.361408]  drm_ioctl+0x208/0x390 [drm]
[ 4511.361414]  ? drm_mode_getcrtc+0x180/0x180 [drm]
[ 4511.361437]  amdgpu_drm_ioctl+0x49/0x80 [amdgpu]
[ 4511.361440]  do_vfs_ioctl+0x405/0x660
[ 4511.361441]  ksys_ioctl+0x5e/0x90
[ 4511.361442]  __x64_sys_ioctl+0x16/0x20
[ 4511.361444]  do_syscall_64+0x5f/0x1a0
[ 4511.361446]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 4511.361447] RIP: 0033:0x7f8e2e72a2fb
[ 4511.361448] Code: 0f 1e fa 48 8b 05 8d 9b 0c 00 64 c7 00 26 00 00 00 48 c7
c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01
f0 ff ff 73 01 c3 48 8b 0d 5d 9b 0c 00 f7 d8 64 89 01 48
[ 4511.361449] RSP: 002b:7ffed440abf8 EFLAGS: 0246 ORIG_RAX:
0010
[ 4511.361450] RAX: ffda RBX: 7ffed440ac30 RCX:

Re: [PATCH v2 1/2] drm: Add support for DP 1.4 Compliance edid corruption test 4.2.2.6

2019-11-01 Thread Harry Wentland
On 2019-11-01 3:38 p.m., Jerry (Fangzhi) Zuo wrote:
> DP 1.4 edid corruption test requires source DUT to write calculated
> CRC, not the corrupted CRC from reference sink.
> 
> Return the calculated CRC back, and initiate the required sequence.
> 
> -v2: Have separate routine for returning real CRC
> 
> Signed-off-by: Jerry (Fangzhi) Zuo 
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 36 
>  drivers/gpu/drm/drm_edid.c  | 14 ++
>  include/drm/drm_connector.h |  7 +++
>  include/drm/drm_dp_helper.h |  3 +++
>  4 files changed, 60 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index ffc68d305afe..75dbd30c62a7 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -336,6 +336,42 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
>  }
>  EXPORT_SYMBOL(drm_dp_dpcd_read_link_status);
>  
> +/**
> +  * drm_dp_send_bad_edid_checksum() - send back real edid checksum value
> +  * @aux: DisplayPort AUX channel
> +  * @bad_edid_checksum: real edid checksum for the last block
> +  *
> +  * Returns true on success
> +  */
> +bool drm_dp_send_bad_edid_checksum(struct drm_dp_aux *aux,
> +u8 bad_edid_checksum)
> +{
> +u8 link_edid_read = 0, auto_test_req = 0;
> +u8 test_resp = 0;
> +
> +drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, _test_req, 
> 1);
> +auto_test_req &= DP_AUTOMATED_TEST_REQUEST;
> +
> +drm_dp_dpcd_read(aux, DP_TEST_REQUEST, _edid_read, 1);
> +link_edid_read &= DP_TEST_LINK_EDID_READ;
> +
> +if (!auto_test_req || !link_edid_read) {
> +DRM_DEBUG_KMS("Source DUT does not support 
> TEST_EDID_READ\n");
> +return false;
> +}
> +
> +drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, _test_req, 
> 1);
> +
> +/* send back checksum for the last edid extension block data */
> +drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM, _edid_checksum, 1);
> +
> +test_resp |= DP_TEST_EDID_CHECKSUM_WRITE;
> +drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, _resp, 1);
> +
> +return true;
> +}
> +EXPORT_SYMBOL(drm_dp_send_bad_edid_checksum);
> +
>  /**
>   * drm_dp_link_probe() - probe a DisplayPort link for capabilities
>   * @aux: DisplayPort AUX channel
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 82a4ceed3fcf..0598314e3f46 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1354,6 +1354,17 @@ static int drm_edid_block_checksum(const u8 *raw_edid)
>   return csum;
>  }
>  
> +static int drm_edid_block_real_checksum(const u8 *raw_edid)
> +{
> + int i;
> + u8 csum = 0;
> +
> + for (i = 0; i < EDID_LENGTH - 1; i++)
> + csum += raw_edid[i];
> +
> + return (0x100 - csum);
> +}
> +
>  static bool drm_edid_is_zero(const u8 *in_edid, int length)
>  {
>   if (memchr_inv(in_edid, 0, length))
> @@ -1572,6 +1583,9 @@ static void connector_bad_edid(struct drm_connector 
> *connector,
>  prefix, DUMP_PREFIX_NONE, 16, 1,
>  block, EDID_LENGTH, false);
>   }
> +
> + /* Calculate real checksum for the last edid extension block data */
> + connector->bad_edid_checksum = drm_edid_block_real_checksum(edid + 
> edid[0x7e] * EDID_LENGTH);
>  }
>  
>  /* Get override or firmware EDID */
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 681cb590f952..8442461542b9 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -1345,6 +1345,13 @@ struct drm_connector {
>* rev1.1 4.2.2.6
>*/
>   bool edid_corrupt;
> + /**
> + * @bad_edid_checksum: real edid checksum value for corrupted edid 
> block.
> + * Required in Displayport 1.4 compliance testing
> + * rev1.1 4.2.2.6
> + */
> +uint8_t bad_edid_checksum;


This variable name confused me a bit. Maybe name this
"computed_edid_checksum" to clarify that this is the EDID checksum that
we've computed for the EDID, i.e. the correct one.

> +
>  
>   /** @debugfs_entry: debugfs directory for this connector */
>   struct dentry *debugfs_entry;
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 5a795075d5da..2a7e54bebb18 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -1383,6 +1383,9 @@ static inline ssize_t drm_dp_dpcd_writeb(struct 
> drm_dp_aux *aux,
>  int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
>u8 status[DP_LINK_STATUS_SIZE]);
>  
> +bool drm_dp_send_bad_edid_checksum(struct drm_dp_aux *aux,

Same as before, might be good to name this
drm_dp_send_computed_edid_checksum or something similar.

Harry

> + u8 bad_edid_checksum);
> +
>  /*
>   * DisplayPort 

Re: [PATCH v2 00/15] Consolidate the mmu notifier interval_tree and locking

2019-11-01 Thread Ralph Campbell


On 10/28/19 1:10 PM, Jason Gunthorpe wrote:

From: Jason Gunthorpe 

8 of the mmu_notifier using drivers (i915_gem, radeon_mn, umem_odp, hfi1,
scif_dma, vhost, gntdev, hmm) drivers are using a common pattern where
they only use invalidate_range_start/end and immediately check the
invalidating range against some driver data structure to tell if the
driver is interested. Half of them use an interval_tree, the others are
simple linear search lists.

Of the ones I checked they largely seem to have various kinds of races,
bugs and poor implementation. This is a result of the complexity in how
the notifier interacts with get_user_pages(). It is extremely difficult to
use it correctly.

Consolidate all of this code together into the core mmu_notifier and
provide a locking scheme similar to hmm_mirror that allows the user to
safely use get_user_pages() and reliably know if the page list still
matches the mm.

This new arrangment plays nicely with the !blockable mode for
OOM. Scanning the interval tree is done such that the intersection test
will always succeed, and since there is no invalidate_range_end exposed to
drivers the scheme safely allows multiple drivers to be subscribed.

Four places are converted as an example of how the new API is used.
Four are left for future patches:
  - i915_gem has complex locking around destruction of a registration,
needs more study
  - hfi1 (2nd user) needs access to the rbtree
  - scif_dma has a complicated logic flow
  - vhost's mmu notifiers are already being rewritten

This series, and the other code it depends on is available on my github:

https://github.com/jgunthorpe/linux/commits/mmu_notifier

v2 changes:
- Add mmu_range_set_seq() to set the mrn sequence number under the driver
   lock and make the locking more understandable
- Add some additional comments around locking/READ_ONCe
- Make the WARN_ON flow in mn_itree_invalidate a bit easier to follow
- Fix wrong WARN_ON

Jason Gunthorpe (15):
   mm/mmu_notifier: define the header pre-processor parts even if
 disabled
   mm/mmu_notifier: add an interval tree notifier
   mm/hmm: allow hmm_range to be used with a mmu_range_notifier or
 hmm_mirror
   mm/hmm: define the pre-processor related parts of hmm.h even if
 disabled
   RDMA/odp: Use mmu_range_notifier_insert()
   RDMA/hfi1: Use mmu_range_notifier_inset for user_exp_rcv
   drm/radeon: use mmu_range_notifier_insert
   xen/gntdev: Use select for DMA_SHARED_BUFFER
   xen/gntdev: use mmu_range_notifier_insert
   nouveau: use mmu_notifier directly for invalidate_range_start
   nouveau: use mmu_range_notifier instead of hmm_mirror
   drm/amdgpu: Call find_vma under mmap_sem
   drm/amdgpu: Use mmu_range_insert instead of hmm_mirror
   drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror
   mm/hmm: remove hmm_mirror and related

  Documentation/vm/hmm.rst  | 105 +---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h   |   2 +
  .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c  |   9 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c|  14 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c|   1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c| 457 +++
  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h|  53 --
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h|  13 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c   | 111 ++--
  drivers/gpu/drm/nouveau/nouveau_svm.c | 231 +---
  drivers/gpu/drm/radeon/radeon.h   |   9 +-
  drivers/gpu/drm/radeon/radeon_mn.c| 219 ++-
  drivers/infiniband/core/device.c  |   1 -
  drivers/infiniband/core/umem_odp.c| 288 +
  drivers/infiniband/hw/hfi1/file_ops.c |   2 +-
  drivers/infiniband/hw/hfi1/hfi.h  |   2 +-
  drivers/infiniband/hw/hfi1/user_exp_rcv.c | 146 ++---
  drivers/infiniband/hw/hfi1/user_exp_rcv.h |   3 +-
  drivers/infiniband/hw/mlx5/mlx5_ib.h  |   7 +-
  drivers/infiniband/hw/mlx5/mr.c   |   3 +-
  drivers/infiniband/hw/mlx5/odp.c  |  50 +-
  drivers/xen/Kconfig   |   3 +-
  drivers/xen/gntdev-common.h   |   8 +-
  drivers/xen/gntdev.c  | 180 ++
  include/linux/hmm.h   | 195 +--
  include/linux/mmu_notifier.h  | 144 -
  include/rdma/ib_umem_odp.h|  65 +--
  include/rdma/ib_verbs.h   |   2 -
  kernel/fork.c |   1 -
  mm/Kconfig|   2 +-
  mm/hmm.c  | 275 +
  mm/mmu_notifier.c | 546 +-
  32 files changed, 1225 insertions(+), 1922 deletions(-)



You can add my Tested-by for the mm and nouveau changes.
IOW, patches 1-4, 10-11, and 15.

Tested-by: Ralph Campbell 
___
dri-devel mailing list

Re: [Intel-gfx] [PATCH RESEND 8/8] drm/print: introduce new struct drm_device based logging macros

2019-11-01 Thread Rodrigo Vivi
On Mon, Oct 28, 2019 at 12:38:22PM +0200, Jani Nikula wrote:
> Add new struct drm_device based logging macros modeled after the core
> kernel device based logging macros. These would be preferred over the
> drm printk and struct device based macros in drm code, where possible.
> 
> We have existing drm specific struct device based logging functions, but
> they are too verbose to use for two main reasons:
> 
>  * The names are unnecessarily long, for example DRM_DEV_DEBUG_KMS().
> 
>  * The use of struct device over struct drm_device is too generic for
>most users, leading to an extra dereference.
> 
> For example:
> 
>   DRM_DEV_DEBUG_KMS(drm->dev, "Hello, world\n");
> 
> vs.
> 
>   drm_dbg_kms(drm, "Hello, world\n");
> 
> It's a matter of taste, but the SHOUTING UPPERCASE has been argued to be
> less readable than lowercase.

I also prefer the short lowercase one...

Reviewed-by: Rodrigo Vivi 

> 
> Some names are changed from old DRM names to be based on the core kernel
> logging functions. For example, NOTE -> notice, ERROR -> err, DEBUG ->
> dbg.
> 
> Due to the conflation of DRM_DEBUG and DRM_DEBUG_DRIVER macro use
> (DRM_DEBUG is used widely in drivers though it's supposed to be a core
> debugging category), they are named as drm_dbg_core and drm_dbg,
> respectively.
> 
> The drm_err and _once/_ratelimited variants no longer include the
> function name in order to be able to use the core device based logging
> macros. Arguably this is not a significant change; error messages should
> not be so common to be only distinguishable by the function name.
> 
> Ratelimited debug logging macros are to be added later.
> 
> Cc: Sam Ravnborg 
> Signed-off-by: Jani Nikula 
> 
> ---
> 
> With something like this, I think i915 could start migrating to
> drm_device based logging. I have a hard time convincing myself or anyone
> about migrating to the DRM_DEV_* variants.
> ---
>  include/drm/drm_print.h | 65 +
>  1 file changed, 65 insertions(+)
> 
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 085a9685270c..e4040dea0d8c 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -322,6 +322,8 @@ static inline bool drm_debug_enabled(enum 
> drm_debug_category category)
>  
>  /*
>   * struct device based logging
> + *
> + * Prefer drm_device based logging over device or prink based logging.
>   */
>  
>  __printf(3, 4)
> @@ -417,8 +419,71 @@ void drm_dev_dbg(const struct device *dev, enum 
> drm_debug_category category,
>   _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_PRIME,\
> fmt, ##__VA_ARGS__)
>  
> +/*
> + * struct drm_device based logging
> + *
> + * Prefer drm_device based logging over device or prink based logging.
> + */
> +
> +/* Helper for struct drm_device based logging. */
> +#define __drm_printk(drm, level, type, fmt, ...) \
> + dev_##level##type(drm->dev, "[drm] " fmt, ##__VA_ARGS__)
> +
> +
> +#define drm_info(drm, fmt, ...)  \
> + __drm_printk(drm, info,, fmt, ##__VA_ARGS__)
> +
> +#define drm_notice(drm, fmt, ...)\
> + __drm_printk(drm, notice,, fmt, ##__VA_ARGS__)
> +
> +#define drm_warn(drm, fmt, ...)  \
> + __drm_printk(drm, warn,, fmt, ##__VA_ARGS__)
> +
> +#define drm_err(drm, fmt, ...)   \
> + __drm_printk(drm, err,, "*ERROR* " fmt, ##__VA_ARGS__)
> +
> +
> +#define drm_info_once(drm, fmt, ...) \
> + __drm_printk(drm, info, _once, fmt, ##__VA_ARGS__)
> +
> +#define drm_notice_once(drm, fmt, ...)   \
> + __drm_printk(drm, notice, _once, fmt, ##__VA_ARGS__)
> +
> +#define drm_warn_once(drm, fmt, ...) \
> + __drm_printk(drm, warn, _once, fmt, ##__VA_ARGS__)
> +
> +#define drm_err_once(drm, fmt, ...)  \
> + __drm_printk(drm, err, _once, "*ERROR* " fmt, ##__VA_ARGS__)
> +
> +
> +#define drm_err_ratelimited(drm, fmt, ...)   \
> + __drm_printk(drm, err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
> +
> +
> +#define drm_dbg_core(drm, fmt, ...)  \
> + drm_dev_dbg(drm->dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> +#define drm_dbg(drm, fmt, ...)   
> \
> + drm_dev_dbg(drm->dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> +#define drm_dbg_kms(drm, fmt, ...)   \
> + drm_dev_dbg(drm->dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> +#define drm_dbg_prime(drm, fmt, ...) \
> + drm_dev_dbg(drm->dev, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> +#define drm_dbg_atomic(drm, fmt, ...)
> \
> + drm_dev_dbg(drm->dev, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> +#define drm_dbg_vbl(drm, fmt, 

Re: [PATCH RESEND 7/8] drm/print: group logging functions by prink or device based

2019-11-01 Thread Rodrigo Vivi
On Mon, Oct 28, 2019 at 12:38:21PM +0200, Jani Nikula wrote:
> In preparation for adding struct drm_device based logging, group the
> existing functions by prink or struct device based logging. No
> functional changes.
> 
> Signed-off-by: Jani Nikula 
> ---
>  include/drm/drm_print.h | 135 ++--
>  1 file changed, 74 insertions(+), 61 deletions(-)
> 
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 13f65394376e..085a9685270c 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -320,6 +320,10 @@ static inline bool drm_debug_enabled(enum 
> drm_debug_category category)
>   return unlikely(__drm_debug & category);
>  }
>  
> +/*
> + * struct device based logging
> + */
> +
>  __printf(3, 4)
>  void drm_dev_printk(const struct device *dev, const char *level,
>   const char *format, ...);
> @@ -327,30 +331,6 @@ __printf(3, 4)
>  void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>const char *format, ...);
>  
> -__printf(2, 3)
> -void __drm_dbg(enum drm_debug_category category, const char *format, ...);
> -__printf(1, 2)
> -void __drm_err(const char *format, ...);
> -
> -/* Macros to make printk easier */
> -
> -#define _DRM_PRINTK(once, level, fmt, ...)   \
> - printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO(fmt, ...)   \
> - _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> -#define DRM_NOTE(fmt, ...)   \
> - _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> -#define DRM_WARN(fmt, ...)   \
> - _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO_ONCE(fmt, ...)  
> \
> - _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> -#define DRM_NOTE_ONCE(fmt, ...)  
> \
> - _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> -#define DRM_WARN_ONCE(fmt, ...)  
> \
> - _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> -
>  /**
>   * Error output.
>   *
> @@ -359,8 +339,6 @@ void __drm_err(const char *format, ...);
>   */
>  #define DRM_DEV_ERROR(dev, fmt, ...) \
>   drm_dev_printk(dev, KERN_ERR, "*ERROR* " fmt, ##__VA_ARGS__)
> -#define DRM_ERROR(fmt, ...)  \
> - __drm_err(fmt, ##__VA_ARGS__)
>  
>  /**
>   * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> @@ -377,10 +355,8 @@ void __drm_err(const char *format, ...);
>   if (__ratelimit(&_rs))  \
>   DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__); \
>  })
> -#define DRM_ERROR_RATELIMITED(fmt, ...)  
> \
> - DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
>  
> -#define DRM_DEV_INFO(dev, fmt, ...)  \
> +#define DRM_DEV_INFO(dev, fmt, ...)  \

I believe you could skip this chunk...

other than this:
Reviewed-by: Rodrigo Vivi 

>   drm_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
>  
>  #define DRM_DEV_INFO_ONCE(dev, fmt, ...) \
> @@ -400,41 +376,18 @@ void __drm_err(const char *format, ...);
>   */
>  #define DRM_DEV_DEBUG(dev, fmt, ...) \
>   drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG(fmt, ...)  \
> - __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)  \
>   drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_DRIVER(fmt, ...)   \
> - __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_KMS(dev, fmt, ...) \
>   drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_KMS(fmt, ...)  
> \
> - __drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_PRIME(dev, fmt, ...)   \
>   drm_dev_dbg(dev, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_PRIME(fmt, ...)\
> - __drm_dbg(DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, ...)  \
>   drm_dev_dbg(dev, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_ATOMIC(fmt, ...)   \
> - __drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_VBL(dev, fmt, ...) \
>   drm_dev_dbg(dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_VBL(fmt, ...)  
> 

[Bug 111481] AMD Navi GPU frequent freezes on both Manjaro/Ubuntu with kernel 5.3 and mesa 19.2 -git/llvm9

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111481

--- Comment #192 from Seba Pe  ---
(In reply to L.S.S. from comment #188)
> Not sure where the problem might be.
> 
> After installing 5.4-rc5, in addition to amdgpu-pro-libgl (and other
> amdgpu-pro related stuffs), I stopped encountering those dreaded "ring sdma0
> timeout" freezes when using Nemo. I think amdgpu-pro stuffs might be what
> "fixed" it.
> 
> I'll test this for the time being. I cannot be confident that it would be
> completely fixed this way, but at least the situation has been improved to
> the point that Nemo is now usable again.

As I said in comment #149
(https://bugs.freedesktop.org/show_bug.cgi?id=111481#c149), amdgpu-pro does not
exhibit freezes or timeouts.

This appears to point to a problem in the generated instructions from libgl (or
potentially a combination of that plus an underlying issue in the kernel
driver).

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [Intel-gfx] [PATCH RESEND 5/8] drm/print: underscore prefix functions that should be private to print

2019-11-01 Thread Rodrigo Vivi
On Mon, Oct 28, 2019 at 12:38:19PM +0200, Jani Nikula wrote:
> We don't want people calling the functions directly. No functional
> changes.
> 
> Signed-off-by: Jani Nikula 

Reviewed-by: Rodrigo Vivi 

> ---
>  drivers/gpu/drm/drm_print.c |  8 
>  include/drm/drm_print.h | 22 +++---
>  2 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index a0d1cde9888a..703b126dd074 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -280,7 +280,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int 
> category,
>  }
>  EXPORT_SYMBOL(drm_dev_dbg);
>  
> -void drm_dbg(unsigned int category, const char *format, ...)
> +void __drm_dbg(unsigned int category, const char *format, ...)
>  {
>   struct va_format vaf;
>   va_list args;
> @@ -297,9 +297,9 @@ void drm_dbg(unsigned int category, const char *format, 
> ...)
>  
>   va_end(args);
>  }
> -EXPORT_SYMBOL(drm_dbg);
> +EXPORT_SYMBOL(__drm_dbg);
>  
> -void drm_err(const char *format, ...)
> +void __drm_err(const char *format, ...)
>  {
>   struct va_format vaf;
>   va_list args;
> @@ -313,7 +313,7 @@ void drm_err(const char *format, ...)
>  
>   va_end(args);
>  }
> -EXPORT_SYMBOL(drm_err);
> +EXPORT_SYMBOL(__drm_err);
>  
>  /**
>   * drm_print_regset32 - print the contents of registers to a
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 77fef2c7e312..ce45ec46202a 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -307,9 +307,9 @@ void drm_dev_dbg(const struct device *dev, unsigned int 
> category,
>const char *format, ...);
>  
>  __printf(2, 3)
> -void drm_dbg(unsigned int category, const char *format, ...);
> +void __drm_dbg(unsigned int category, const char *format, ...);
>  __printf(1, 2)
> -void drm_err(const char *format, ...);
> +void __drm_err(const char *format, ...);
>  
>  /* Macros to make printk easier */
>  
> @@ -339,7 +339,7 @@ void drm_err(const char *format, ...);
>  #define DRM_DEV_ERROR(dev, fmt, ...) \
>   drm_dev_printk(dev, KERN_ERR, "*ERROR* " fmt, ##__VA_ARGS__)
>  #define DRM_ERROR(fmt, ...)  \
> - drm_err(fmt, ##__VA_ARGS__)
> + __drm_err(fmt, ##__VA_ARGS__)
>  
>  /**
>   * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> @@ -380,40 +380,40 @@ void drm_err(const char *format, ...);
>  #define DRM_DEV_DEBUG(dev, fmt, ...) \
>   drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
>  #define DRM_DEBUG(fmt, ...)  \
> - drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
> + __drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
>  
>  #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)  \
>   drm_dev_dbg(dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
>  #define DRM_DEBUG_DRIVER(fmt, ...)   \
> - drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> + __drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
>  
>  #define DRM_DEV_DEBUG_KMS(dev, fmt, ...) \
>   drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
>  #define DRM_DEBUG_KMS(fmt, ...)  
> \
> - drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
> + __drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
>  
>  #define DRM_DEV_DEBUG_PRIME(dev, fmt, ...)   \
>   drm_dev_dbg(dev, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
>  #define DRM_DEBUG_PRIME(fmt, ...)\
> - drm_dbg(DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> + __drm_dbg(DRM_UT_PRIME, fmt, ##__VA_ARGS__)
>  
>  #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, ...)  \
>   drm_dev_dbg(dev, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
>  #define DRM_DEBUG_ATOMIC(fmt, ...)   \
> - drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> + __drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
>  
>  #define DRM_DEV_DEBUG_VBL(dev, fmt, ...) \
>   drm_dev_dbg(dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
>  #define DRM_DEBUG_VBL(fmt, ...)  
> \
> - drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
> + __drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
>  
>  #define DRM_DEBUG_LEASE(fmt, ...)\
> - drm_dbg(DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> + __drm_dbg(DRM_UT_LEASE, fmt, ##__VA_ARGS__)
>  
>  #define  DRM_DEV_DEBUG_DP(dev, fmt, ...) 
> \
>   drm_dev_dbg(dev, DRM_UT_DP, fmt, ## __VA_ARGS__)
>  #define DRM_DEBUG_DP(fmt, ...)   
> \
> - drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
> + __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
>  
>  #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, category, fmt, ...)   

Individuals interested in VESA memberships?

2019-11-01 Thread Lyude Paul
Hi! Recently I've been working with the rest of the X.Org board to try to get
X.org access to VESA memberships so that contributors that don't have an
employer who is able/willing to join VESA can potentially get access to the
various benefits of a VESA membership, such as access to DisplayPort
specifications. Since I need to gather a list of interested X.org members, I'd
like to know who all might be interested in a membership like this. There are
no costs involved, as the VESA membership we're looking at in particular comes
at no cost to us since we're a non-profit.

The current plan is to extend VESA membership to X.Org members who
specifically request it. If you think you'd be at all interested in this, or
know any projects or contributors who would be, please feel free to respond to
this message and let me know!
-- 
Cheers,
Lyude Paul

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 1/2] drm/atomic: fix self-refresh helpers crtc state dereference

2019-11-01 Thread Sean Paul
On Fri, Nov 1, 2019 at 2:09 PM Rob Clark  wrote:
>
> From: Rob Clark 
>
> drm_self_refresh_helper_update_avg_times() was incorrectly accessing the
> new incoming state after drm_atomic_helper_commit_hw_done().  But this
> state might have already been superceeded by an !nonblock atomic update
> resulting in dereferencing an already free'd crtc_state.
>
> Fixes: d4da4e33341c ("drm: Measure Self Refresh Entry/Exit times to avoid 
> thrashing")
> Cc: Sean Paul 
> Signed-off-by: Rob Clark 
> ---
> TODO I *think* this will more or less do the right thing.. althought I'm
> not 100% sure if, for example, we enter psr in a nonblock commit, and
> then leave psr in a !nonblock commit that overtakes the completion of
> the nonblock commit.  Not sure if this sort of scenario can happen in
> practice.  But not crashing is better than crashing, so I guess we
> should either take this patch or rever the self-refresh helpers until
> Sean can figure out a better solution.
>
>  drivers/gpu/drm/drm_atomic_helper.c   |  2 ++
>  drivers/gpu/drm/drm_self_refresh_helper.c | 11 ++-
>  include/drm/drm_atomic.h  |  8 
>  3 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index 3ef2ac52ce94..732bd0ce9241 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2240,6 +2240,8 @@ void drm_atomic_helper_commit_hw_done(struct 
> drm_atomic_state *old_state)
> int i;
>
> for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, 
> new_crtc_state, i) {
> +   old_state->crtcs[i].new_self_refresh_active = 
> new_crtc_state->self_refresh_active;
> +
> commit = new_crtc_state->commit;
> if (!commit)
> continue;
> diff --git a/drivers/gpu/drm/drm_self_refresh_helper.c 
> b/drivers/gpu/drm/drm_self_refresh_helper.c
> index 68f4765a5896..77b9079fa578 100644
> --- a/drivers/gpu/drm/drm_self_refresh_helper.c
> +++ b/drivers/gpu/drm/drm_self_refresh_helper.c
> @@ -143,19 +143,20 @@ void drm_self_refresh_helper_update_avg_times(struct 
> drm_atomic_state *state,
>   unsigned int commit_time_ms)
>  {
> struct drm_crtc *crtc;
> -   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> +   struct drm_crtc_state *old_crtc_state;
> int i;
>
> -   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
> - new_crtc_state, i) {
> +   for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
> +   bool new_self_refresh_active =
> +   state->crtcs[i].new_self_refresh_active;
> struct drm_self_refresh_data *sr_data = 
> crtc->self_refresh_data;
> struct ewma_psr_time *time;
>
> if (old_crtc_state->self_refresh_active ==
> -   new_crtc_state->self_refresh_active)
> +   new_self_refresh_active)
> continue;
>
> -   if (new_crtc_state->self_refresh_active)
> +   if (new_self_refresh_active)
> time = _data->entry_avg_ms;
> else
> time = _data->exit_avg_ms;
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index 927e1205d7aa..86baf2b38bb3 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -155,6 +155,14 @@ struct __drm_crtcs_state {
> struct drm_crtc *ptr;
> struct drm_crtc_state *state, *old_state, *new_state;
>
> +   /**
> +* @new_self_refresh_active:
> +*
> +* drm_atomic_helper_commit_hw_done() stashes 
> new_crtc_state->self_refresh_active
> +* so that it can be accessed late in 
> drm_self_refresh_helper_update_avg_times().
> +*/
> +   bool new_self_refresh_active;
> +

Instead of stashing this in crtc, we could generate a bitmask local to
commit_tail and pass that to calc_avg_times? That way we don't have to
worry about someone using this when they shouldn't

Sean

> /**
>  * @commit:
>  *
> --
> 2.21.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Yang, Philip
Sorry, resend patch, the one in previous email missed couple of lines 
duo to copy/paste.

On 2019-11-01 3:45 p.m., Yang, Philip wrote:
> 
> 
> On 2019-11-01 1:42 p.m., Jason Gunthorpe wrote:
>> On Fri, Nov 01, 2019 at 03:59:26PM +, Yang, Philip wrote:
 This test for range_blockable should be before mutex_lock, I can move
 it up

>>> yes, thanks.
>>
>> Okay, I wrote it like this:
>>
>>  if (mmu_notifier_range_blockable(range))
>>  mutex_lock(>notifier_lock);
>>  else if (!mutex_trylock(>notifier_lock))
>>  return false;
>>
 Also, do you know if notifier_lock is held while calling
 amdgpu_ttm_tt_get_user_pages_done()? Can we add a 'lock assert held'
 to amdgpu_ttm_tt_get_user_pages_done()?
>>>
>>> gpu side hold notifier_lock but kfd side doesn't. kfd side doesn't check
>>> amdgpu_ttm_tt_get_user_pages_done/mmu_range_read_retry return value but
>>> check mem->invalid flag which is updated from invalidate callback. It
>>> takes more time to change, I will come to another patch to fix it later.
>>
>> Ah.. confusing, OK, I'll let you sort that
>>
 However, this is all pre-existing bugs, so I'm OK go ahead with this
 patch as modified. I advise AMD to make a followup patch ..

>>> yes, I will.
>>
>> While you are here, this is also wrong:
>>
>> int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
>> {
>>  down_read(>mmap_sem);
>>  r = hmm_range_fault(range, 0);
>>  up_read(>mmap_sem);
>>  if (unlikely(r <= 0)) {
>>  if ((r == 0 || r == -EBUSY) && !time_after(jiffies, timeout))
>>  goto retry;
>>  goto out_free_pfns;
>>  }
>>
>>  for (i = 0; i < ttm->num_pages; i++) {
>>  pages[i] = hmm_device_entry_to_page(range, range->pfns[i]);
>>
>> It is not allowed to read the results of hmm_range_fault() outside
>> locking, and in particular, we can't convert to a struct page.
>>
>> This must be done inside the notifier_lock, after checking
>> mmu_range_read_retry(), all handling of the struct page must be
>> structured like that.
>>
> Below change will fix this, then driver will call mmu_range_read_retry
> second time using same range->notifier_seq to check if range is
> invalidated inside amdgpu_cs_submit, this looks ok for me.
> 
@@ -797,6 +797,7 @@ static const uint64_t 
hmm_range_values[HMM_PFN_VALUE_MAX] = {
   */
  int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page 
**pages)
  {
+   struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
 struct ttm_tt *ttm = bo->tbo.ttm;
 struct amdgpu_ttm_tt *gtt = (void *)ttm;
 unsigned long start = gtt->userptr;
@@ -868,6 +869,13 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo 
*bo, struct page **pages)
 goto out_free_pfns;
 }

+   mutex_lock(>notifier_lock);
+
+   if (mmu_range_read_retry(>notifier, range->notifier_seq)) {
+   mutex_unlock(>notifier_lock);
+   goto retry;
+   }
+
 for (i = 0; i < ttm->num_pages; i++) {
 pages[i] = hmm_device_entry_to_page(range, range->pfns[i]);
 if (unlikely(!pages[i])) {
@@ -875,10 +883,12 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo 
*bo, struct page **pages)
i, range->pfns[i]);
 r = -ENOMEM;

+   mutex_unlock(>notifier_lock);
 goto out_free_pfns;
 }
 }

+   mutex_unlock(>notifier_lock);
 gtt->range = range;
 mmput(mm);

> 
> Philip
> 
> @@ -997,10 +1004,18 @@ static void amdgpu_ttm_tt_unpin_userptr(struct 
> ttm_tt *ttm)
>   sg_free_table(ttm->sg);
> 
> #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
> - if (gtt->range &&
> - ttm->pages[0] == hmm_device_entry_to_page(gtt->range,
> -   gtt->range->pfns[0]))
> - WARN_ONCE(1, "Missing get_user_page_done\n");
> + if (gtt->range) {
> + unsigned long i;
> +
> + for (i = 0; i < ttm->num_pages; i++) {
> + if (ttm->pages[i] !=
> + hmm_device_entry_to_page(gtt->range,
> +   gtt->range->pfns[i]))
> + break;
> + }
> +
> + WARN((i == ttm->num_pages), "Missing get_user_page_done\n");
> + }

 Is this related/necessary? I can put it in another patch if it is just
 debugging improvement? Please advise

>>> I see this WARN backtrace now, but I didn't see it before. This is
>>> somehow related.
>>
>> Hm, might be instructive to learn what is going on..
>>
>> Thanks,
>> Jason
>>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> 

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Yang, Philip


On 2019-11-01 1:42 p.m., Jason Gunthorpe wrote:
> On Fri, Nov 01, 2019 at 03:59:26PM +, Yang, Philip wrote:
>>> This test for range_blockable should be before mutex_lock, I can move
>>> it up
>>>
>> yes, thanks.
> 
> Okay, I wrote it like this:
> 
>   if (mmu_notifier_range_blockable(range))
>   mutex_lock(>notifier_lock);
>   else if (!mutex_trylock(>notifier_lock))
>   return false;
> 
>>> Also, do you know if notifier_lock is held while calling
>>> amdgpu_ttm_tt_get_user_pages_done()? Can we add a 'lock assert held'
>>> to amdgpu_ttm_tt_get_user_pages_done()?
>>
>> gpu side hold notifier_lock but kfd side doesn't. kfd side doesn't check
>> amdgpu_ttm_tt_get_user_pages_done/mmu_range_read_retry return value but
>> check mem->invalid flag which is updated from invalidate callback. It
>> takes more time to change, I will come to another patch to fix it later.
> 
> Ah.. confusing, OK, I'll let you sort that
> 
>>> However, this is all pre-existing bugs, so I'm OK go ahead with this
>>> patch as modified. I advise AMD to make a followup patch ..
>>>
>> yes, I will.
> 
> While you are here, this is also wrong:
> 
> int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
> {
>   down_read(>mmap_sem);
>   r = hmm_range_fault(range, 0);
>   up_read(>mmap_sem);
>   if (unlikely(r <= 0)) {
>   if ((r == 0 || r == -EBUSY) && !time_after(jiffies, timeout))
>   goto retry;
>   goto out_free_pfns;
>   }
> 
>   for (i = 0; i < ttm->num_pages; i++) {
>   pages[i] = hmm_device_entry_to_page(range, range->pfns[i]);
> 
> It is not allowed to read the results of hmm_range_fault() outside
> locking, and in particular, we can't convert to a struct page.
> 
> This must be done inside the notifier_lock, after checking
> mmu_range_read_retry(), all handling of the struct page must be
> structured like that.
> 
Below change will fix this, then driver will call mmu_range_read_retry 
second time using same range->notifier_seq to check if range is 
invalidated inside amdgpu_cs_submit, this looks ok for me.

@@ -868,6 +869,13 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo 
*bo, struct page **pages)
 goto out_free_pfns;
 }

+   mutex_lock(>notifier_lock);
+
+   if (mmu_range_read_retry(>notifier, range->notifier_seq)) {
+   mutex_unlock(>notifier_lock);
+   goto retry;
+   }
+
 for (i = 0; i < ttm->num_pages; i++) {
 pages[i] = hmm_device_entry_to_page(range, range->pfns[i]);
 if (unlikely(!pages[i])) {
@@ -875,10 +883,12 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo 
*bo, struct page **pages)
i, range->pfns[i]);
 r = -ENOMEM;

+   mutex_unlock(>notifier_lock);
 goto out_free_pfns;
 }
 }

+   mutex_unlock(>notifier_lock);
 gtt->range = range;
 mmput(mm);

Philip

 @@ -997,10 +1004,18 @@ static void amdgpu_ttm_tt_unpin_userptr(struct 
 ttm_tt *ttm)
sg_free_table(ttm->sg);

#if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
 -  if (gtt->range &&
 -  ttm->pages[0] == hmm_device_entry_to_page(gtt->range,
 -gtt->range->pfns[0]))
 -  WARN_ONCE(1, "Missing get_user_page_done\n");
 +  if (gtt->range) {
 +  unsigned long i;
 +
 +  for (i = 0; i < ttm->num_pages; i++) {
 +  if (ttm->pages[i] !=
 +  hmm_device_entry_to_page(gtt->range,
 +gtt->range->pfns[i]))
 +  break;
 +  }
 +
 +  WARN((i == ttm->num_pages), "Missing get_user_page_done\n");
 +  }
>>>
>>> Is this related/necessary? I can put it in another patch if it is just
>>> debugging improvement? Please advise
>>>
>> I see this WARN backtrace now, but I didn't see it before. This is
>> somehow related.
> 
> Hm, might be instructive to learn what is going on..
> 
> Thanks,
> Jason
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2 1/2] drm: Add support for DP 1.4 Compliance edid corruption test 4.2.2.6

2019-11-01 Thread Jerry (Fangzhi) Zuo
DP 1.4 edid corruption test requires source DUT to write calculated
CRC, not the corrupted CRC from reference sink.

Return the calculated CRC back, and initiate the required sequence.

-v2: Have separate routine for returning real CRC

Signed-off-by: Jerry (Fangzhi) Zuo 
---
 drivers/gpu/drm/drm_dp_helper.c | 36 
 drivers/gpu/drm/drm_edid.c  | 14 ++
 include/drm/drm_connector.h |  7 +++
 include/drm/drm_dp_helper.h |  3 +++
 4 files changed, 60 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index ffc68d305afe..75dbd30c62a7 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -336,6 +336,42 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
 }
 EXPORT_SYMBOL(drm_dp_dpcd_read_link_status);
 
+/**
+  * drm_dp_send_bad_edid_checksum() - send back real edid checksum value
+  * @aux: DisplayPort AUX channel
+  * @bad_edid_checksum: real edid checksum for the last block
+  *
+  * Returns true on success
+  */
+bool drm_dp_send_bad_edid_checksum(struct drm_dp_aux *aux,
+u8 bad_edid_checksum)
+{
+u8 link_edid_read = 0, auto_test_req = 0;
+u8 test_resp = 0;
+
+drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, _test_req, 1);
+auto_test_req &= DP_AUTOMATED_TEST_REQUEST;
+
+drm_dp_dpcd_read(aux, DP_TEST_REQUEST, _edid_read, 1);
+link_edid_read &= DP_TEST_LINK_EDID_READ;
+
+if (!auto_test_req || !link_edid_read) {
+DRM_DEBUG_KMS("Source DUT does not support TEST_EDID_READ\n");
+return false;
+}
+
+drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, _test_req, 
1);
+
+/* send back checksum for the last edid extension block data */
+drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM, _edid_checksum, 1);
+
+test_resp |= DP_TEST_EDID_CHECKSUM_WRITE;
+drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, _resp, 1);
+
+return true;
+}
+EXPORT_SYMBOL(drm_dp_send_bad_edid_checksum);
+
 /**
  * drm_dp_link_probe() - probe a DisplayPort link for capabilities
  * @aux: DisplayPort AUX channel
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 82a4ceed3fcf..0598314e3f46 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1354,6 +1354,17 @@ static int drm_edid_block_checksum(const u8 *raw_edid)
return csum;
 }
 
+static int drm_edid_block_real_checksum(const u8 *raw_edid)
+{
+   int i;
+   u8 csum = 0;
+
+   for (i = 0; i < EDID_LENGTH - 1; i++)
+   csum += raw_edid[i];
+
+   return (0x100 - csum);
+}
+
 static bool drm_edid_is_zero(const u8 *in_edid, int length)
 {
if (memchr_inv(in_edid, 0, length))
@@ -1572,6 +1583,9 @@ static void connector_bad_edid(struct drm_connector 
*connector,
   prefix, DUMP_PREFIX_NONE, 16, 1,
   block, EDID_LENGTH, false);
}
+
+   /* Calculate real checksum for the last edid extension block data */
+   connector->bad_edid_checksum = drm_edid_block_real_checksum(edid + 
edid[0x7e] * EDID_LENGTH);
 }
 
 /* Get override or firmware EDID */
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 681cb590f952..8442461542b9 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -1345,6 +1345,13 @@ struct drm_connector {
 * rev1.1 4.2.2.6
 */
bool edid_corrupt;
+   /**
+ * @bad_edid_checksum: real edid checksum value for corrupted edid 
block.
+ * Required in Displayport 1.4 compliance testing
+ * rev1.1 4.2.2.6
+ */
+uint8_t bad_edid_checksum;
+
 
/** @debugfs_entry: debugfs directory for this connector */
struct dentry *debugfs_entry;
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 5a795075d5da..2a7e54bebb18 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -1383,6 +1383,9 @@ static inline ssize_t drm_dp_dpcd_writeb(struct 
drm_dp_aux *aux,
 int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
 u8 status[DP_LINK_STATUS_SIZE]);
 
+bool drm_dp_send_bad_edid_checksum(struct drm_dp_aux *aux,
+   u8 bad_edid_checksum);
+
 /*
  * DisplayPort link
  */
-- 
2.14.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2094/2647] include/kcl/kcl_mm.h:124:20: error: redefinition of 'mmgrab'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: 8aff76ca3bf3120204c9ec521ebe96a5133e92f3 [2094/2647] drm/amdkcl: Test 
whether mmgrab is available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 8aff76ca3bf3120204c9ec521ebe96a5133e92f3
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

void drm_dev_put(struct drm_device *dev);
 ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'drm_dev_put':
   include/kcl/kcl_drm.h:539:9: error: implicit declaration of function 
'drm_dev_unref'; did you mean 'drm_dev_enter'? 
[-Werror=implicit-function-declaration]
 return drm_dev_unref(dev);
^
drm_dev_enter
   include/kcl/kcl_drm.h:539:9: warning: 'return' with a value, in function 
returning void
 return drm_dev_unref(dev);
^~
   include/kcl/kcl_drm.h:537:20: note: declared here
static inline void drm_dev_put(struct drm_device *dev)
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h: At top level:
   include/kcl/kcl_mm.h:53:28: error: redefinition of 'memalloc_nofs_save'
static inline unsigned int memalloc_nofs_save(void)
   ^~
   In file included from include/kcl/kcl_mm.h:5:0,
from drivers/gpu/drm/ttm/backport/backport.h:8,
from :0:
   include/linux/sched/mm.h:248:28: note: previous definition of 
'memalloc_nofs_save' was here
static inline unsigned int memalloc_nofs_save(void)
   ^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:58:20: error: redefinition of 'memalloc_nofs_restore'
static inline void memalloc_nofs_restore(unsigned int flags)
   ^
   In file included from include/kcl/kcl_mm.h:5:0,
from drivers/gpu/drm/ttm/backport/backport.h:8,
from :0:
   include/linux/sched/mm.h:263:20: note: previous definition of 
'memalloc_nofs_restore' was here
static inline void memalloc_nofs_restore(unsigned int flags)
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:64:21: error: redefinition of 'kvmalloc'
static inline void *kvmalloc(size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:635:21: note: previous definition of 'kvmalloc' was here
static inline void *kvmalloc(size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:74:21: error: redefinition of 'kvzalloc'
static inline void *kvzalloc(size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:643:21: note: previous definition of 'kvzalloc' was here
static inline void *kvzalloc(size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:84:20: error: static declaration of 'kvfree' follows 
non-static declaration
static inline void kvfree(const void *addr)
   ^~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:663:13: note: previous declaration of 'kvfree' was here
extern void kvfree(const void *addr);
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:104:21: error: redefinition of 'kvmalloc_array'
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from include/drm/drm_vma_manager.h:27:0,
from 

Re: [bug report] dma-buf: heaps: Add heap helpers

2019-11-01 Thread John Stultz
On Thu, Oct 31, 2019 at 4:07 AM Dan Carpenter  wrote:
> The patch 7b87ea704fd9: "dma-buf: heaps: Add heap helpers" from Oct
> 21, 2019, leads to the following static checker warning:
>
> drivers/dma-buf/heaps/heap-helpers.c:165 dma_heap_vm_fault()
> warn: uncapped user index 'buffer->pages[vmf->pgoff]'
>
> drivers/dma-buf/heaps/heap-helpers.c
>160  static vm_fault_t dma_heap_vm_fault(struct vm_fault *vmf)
>161  {
>162  struct vm_area_struct *vma = vmf->vma;
>163  struct heap_helper_buffer *buffer = vma->vm_private_data;
>164
>165  vmf->page = buffer->pages[vmf->pgoff];
>   ^^
> Smatch for some reason thinks this needs to be checked.  Smatch also
> gets confused by these fault handlers and thinks there is some recursion
> involved...

Hrm, I'm not totally sure I grok what it's looking for, but I'm
guessing it's suggesting we check that pgoff isn't larger then the
pagecount?
I'll add that check in, but let me know if I've misunderstood.

Thanks for the report!
-john
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 2/2] drm/atomic: clear new_state pointers at hw_done

2019-11-01 Thread Ville Syrjälä
On Fri, Nov 01, 2019 at 11:07:13AM -0700, Rob Clark wrote:
> From: Rob Clark 
> 
> The new state should not be accessed after this point.  Clear the
> pointers to make that explicit.
> 
> This makes the error corrected in the previous patch more obvious.
> 
> Signed-off-by: Rob Clark 
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 29 +
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index 732bd0ce9241..176831df8163 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2234,13 +2234,42 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
>   */
>  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
>  {
> + struct drm_connector *connector;
> + struct drm_connector_state *old_conn_state, *new_conn_state;
>   struct drm_crtc *crtc;
>   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> + struct drm_plane *plane;
> + struct drm_plane_state *old_plane_state, *new_plane_state;
>   struct drm_crtc_commit *commit;
> + struct drm_private_obj *obj;
> + struct drm_private_state *old_obj_state, *new_obj_state;
>   int i;
>  
> + /*
> +  * After this point, drivers should not access the permanent modeset
> +  * state, so we also clear the new_state pointers to make this
> +  * restriction explicit.
> +  *
> +  * For the CRTC state, we do this in the same loop where we signal
> +  * hw_done, since we still need to new_crtc_state to fish out the
> +  * commit.
> +  */
> +
> + for_each_oldnew_connector_in_state(old_state, connector, 
> old_conn_state, new_conn_state, i) {
> + old_state->connectors[i].new_state = NULL;
> + }
> +
> + for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, 
> new_plane_state, i) {
> + old_state->planes[i].new_state = NULL;
> + }
> +
> + for_each_oldnew_private_obj_in_state(old_state, obj, old_obj_state, 
> new_obj_state, i) {
> + old_state->private_objs[i].new_state = NULL;
> + }
> +
>   for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, 
> new_crtc_state, i) {
>   old_state->crtcs[i].new_self_refresh_active = 
> new_crtc_state->self_refresh_active;
> + old_state->crtcs[i].new_state = NULL;

That's going to be a real PITA when doing programming after the fact from
a vblank worker. It's already a pain that the new_crtc_state->state is
getting NULLed somewhere.

>  
>   commit = new_crtc_state->commit;
>   if (!commit)
> -- 
> 2.21.0
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 111481] AMD Navi GPU frequent freezes on both Manjaro/Ubuntu with kernel 5.3 and mesa 19.2 -git/llvm9

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111481

--- Comment #191 from wychuchol  ---
Oh and music player kept working, played next track from playlist and I managed
to reset with REISUB.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 111481] AMD Navi GPU frequent freezes on both Manjaro/Ubuntu with kernel 5.3 and mesa 19.2 -git/llvm9

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111481

--- Comment #190 from wychuchol  ---
Added AMD_DEBUG="nongg,nodma" to /etc/environment but it happened while opening
a webm file in a new tab in Palemoon.
Nov  1 20:10:30 pop-os kernel: [24044.197839]
[drm:amdgpu_dm_commit_planes.constprop.0 [amdgpu]] *ERROR* Waiting for fences
timed out!
Nov  1 20:10:30 pop-os kernel: [24049.317800] [drm:amdgpu_job_timedout
[amdgpu]] *ERROR* ring sdma0 timeout, signaled seq=3673639, emitted seq=3673641
Nov  1 20:10:30 pop-os kernel: [24049.317836] [drm:amdgpu_job_timedout
[amdgpu]] *ERROR* Process information: process Xorg pid 2350 thread Xorg:cs0
pid 2351
Nov  1 20:10:30 pop-os kernel: [24049.317838] [drm] GPU recovery disabled.

I'd think it happens less though.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[pull] amdgpu, amdkfd drm-next-5.5

2019-11-01 Thread Alex Deucher
Hi Dave, Daniel,

More stuff for 5.5.  Mostly bug fixes and cleanups at this point.

The following changes since commit 0e04ad7d1857670944786a8465930a049aaf995f:

  drm/amdgpu/powerplay: use local renoir array sizes for clock fetching 
(2019-10-25 16:48:14 -0400)

are available in the Git repository at:

  git://people.freedesktop.org/~agd5f/linux tags/drm-next-5.5-2019-11-01

for you to fetch changes up to 5ab5e4e60accd13b0a505a4a34b6feafde2c8fbf:

  drm/amd/display: Add a conversion function for transmitter and phy_id enums 
(2019-10-30 11:07:13 -0400)


drm-next-5.5-2019-11-01:

amdgpu:
- Add EEPROM support for Arcturus
- Enable VCN encode support for Arcturus
- Misc PSP fixes
- Misc DC fixes
- swSMU cleanup

amdkfd:
- Misc cleanups
- Fix typo in cu bitmap parsing


Aidan Yang (2):
  drm/amd/display: Don't use optimized gamma22 with eetf
  drm/amd/display: Allow inverted gamma

Alex Deucher (1):
  drm/amdgpu/gmc10: properly set BANK_SELECT and FRAGMENT_SIZE

Alex Sierra (1):
  drm/amdkfd: bug fix for out of bounds mem on gpu cache filling info

Alvin Lee (1):
  drm/amd/display: Update min dcfclk

Andrey Grodzovsky (6):
  drm/amd/powerplay: Add interface for I2C transactions to SMU.
  drm/amd/powerplay: Add EEPROM I2C read/write support to Arcturus.
  drm/amdgpu: Use ARCTURUS in RAS EEPROM.
  drm/amdgpu: Move amdgpu_ras_recovery_init to after SMU ready.
  drm/sched: Set error to s_fence if HW job submission failed.
  drm/amdgpu: If amdgpu_ib_schedule fails return back the error.

Anthony Koo (2):
  drm/amd/display: correctly populate dpp refclk in fpga
  drm/amd/display: Proper return of result when aux engine acquire fails

Aric Cyr (2):
  drm/amd/display: 3.2.55
  drm/amd/display: 3.2.56

Chenwandun (1):
  drm/amd/display: remove gcc warning Wunused-but-set-variable

Colin Ian King (1):
  drm/amdgpu/psp: fix spelling mistake "initliaze" -> "initialize"

Dmytro Laktyushkin (8):
  drm/amd/display: remove unused code
  drm/amd/display: split dcn20 fast validate into more functions
  drm/amd/display: correctly initialize dml odm variables
  drm/amd/display: move dispclk vco freq to clk mgr base
  drm/amd/display: remove unnecessary assert
  drm/amd/display: fix number of dcn21 dpm clock levels
  drm/amd/display: add embedded flag to dml
  drm/amd/display: fix avoid_split for dcn2+ validation

Eric Yang (2):
  drm/amd/display: move wm ranges reporting to end of init hw
  drm/amd/display: fix hubbub deadline programing

Evan Quan (6):
  drm/amd/powerplay: update Arcturus driver smu interface XGMI link part
  drm/amd/powerplay: add lock protection for swSMU APIs V2
  drm/amd/powerplay: split out those internal used swSMU APIs V2
  drm/amd/powerplay: clear the swSMU code layer
  drm/amd/powerplay: skip unsupported clock limit settings on Arcturus V2
  drm/amd/powerplay: correct current clock level label for Arcturus

Geert Uytterhoeven (1):
  drm/amdgpu: Remove superfluous void * cast in debugfs_create_file() call

Guchun Chen (2):
  drm/amdgpu: refine reboot debugfs operation in ras case (v3)
  drm/amdgpu: define macros for retire page reservation

HaiJun Chang (1):
  drm/amdgpu: fix gfx VF FLR test fail on navi

James Zhu (1):
  drm/amdgpu/vcn: Enable VCN2.5 encoding

Jane Jian (1):
  drm/amdgpu: add VCN0 and VCN1 needed headers

Jiange Zhao (1):
  drm/amdgpu/SRIOV: SRIOV VF doesn't support BACO

Jordan Lazare (1):
  drm/amd/display: Remove superfluous assert

Joshua Aberback (1):
  drm/amd/display: Apply vactive dram clock change workaround to dcn2 DMLv2

Jun Lei (4):
  drm/amd/display: add 50us buffer as WA for pstate switch in active
  drm/amd/display: add odm visual confirm
  drm/amd/display: add flag to allow diag to force enumerate edp
  drm/amd/display: do not synchronize "drr" displays

Krunoslav Kovac (1):
  drm/amd/display: Only use EETF when maxCL > max display

Kyle Mahlkuch (1):
  drm/radeon: Fix EEH during kexec

Le Ma (3):
  drm/amdgpu: clear UVD VCPU buffer when err_event_athub generated
  drm/amdgpu: bypass some cleanup work after err_event_athub (v2)
  drm/amdgpu: fix no ACK from LDS read during stress test for Arcturus

Leo Li (1):
  drm/amdgpu: Add DC feature mask to disable fractional pwm

Lewis Huang (1):
  drm/amd/display: take signal type from link

Marek Olšák (1):
  drm/amdgpu: Allow reading more status registers on si/cik

Michael Strauss (3):
  drm/amd/display: Fix MPO & pipe split on 3-pipe dcn2x
  drm/amd/display: Passive DP->HDMI dongle detection fix
  drm/amd/display: Disable force_single_disp_pipe_split on DCN2+

Nathan Chancellor (1):
  drm/amd/display: Add a conversion function for transmitter and phy_id 
enums


Re: [PATCH 2/2] drm/atomic: clear new_state pointers at hw_done

2019-11-01 Thread Maarten Lankhorst
Op 01-11-2019 om 19:07 schreef Rob Clark:
> From: Rob Clark 
>
> The new state should not be accessed after this point.  Clear the
> pointers to make that explicit.
>
> This makes the error corrected in the previous patch more obvious.
>
> Signed-off-by: Rob Clark 

Would be nice if you could cc intel-...@lists.freedesktop.org next time, so I 
know our CI infrastructure is happy;

It wouldn't surprise me if it catches 1 or 2 abuses in i915.

Otherwise Reviewed-by: Maarten Lankhorst 

Perhaps you could mail this to version to 
intel-gfx-try...@lists.freedesktop.org using git-send-email so we at least get 
i915 results?

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 29 +
>  1 file changed, 29 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index 732bd0ce9241..176831df8163 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2234,13 +2234,42 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
>   */
>  void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
>  {
> + struct drm_connector *connector;
> + struct drm_connector_state *old_conn_state, *new_conn_state;
>   struct drm_crtc *crtc;
>   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> + struct drm_plane *plane;
> + struct drm_plane_state *old_plane_state, *new_plane_state;
>   struct drm_crtc_commit *commit;
> + struct drm_private_obj *obj;
> + struct drm_private_state *old_obj_state, *new_obj_state;
>   int i;
>  
> + /*
> +  * After this point, drivers should not access the permanent modeset
> +  * state, so we also clear the new_state pointers to make this
> +  * restriction explicit.
> +  *
> +  * For the CRTC state, we do this in the same loop where we signal
> +  * hw_done, since we still need to new_crtc_state to fish out the
> +  * commit.
> +  */
> +
> + for_each_oldnew_connector_in_state(old_state, connector, 
> old_conn_state, new_conn_state, i) {
> + old_state->connectors[i].new_state = NULL;
> + }
> +
> + for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, 
> new_plane_state, i) {
> + old_state->planes[i].new_state = NULL;
> + }
> +
> + for_each_oldnew_private_obj_in_state(old_state, obj, old_obj_state, 
> new_obj_state, i) {
> + old_state->private_objs[i].new_state = NULL;
> + }
> +
>   for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, 
> new_crtc_state, i) {
>   old_state->crtcs[i].new_self_refresh_active = 
> new_crtc_state->self_refresh_active;
> + old_state->crtcs[i].new_state = NULL;
>  
>   commit = new_crtc_state->commit;
>   if (!commit)


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/vkms: Fix typo in function documentation

2019-11-01 Thread Manasi Navare
On Fri, Nov 01, 2019 at 03:21:02PM -0300, Gabriela Bittencourt wrote:
> Fix typo in word 'blend' in function 'compute_crc' documentation.
> 
> Signed-off-by: Gabriela Bittencourt 

Reviewed-by: Manasi Navare 

Manasi

> ---
>  drivers/gpu/drm/vkms/vkms_composer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c 
> b/drivers/gpu/drm/vkms/vkms_composer.c
> index d5585695c64d..15efccdcce1b 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -43,7 +43,7 @@ static uint32_t compute_crc(void *vaddr_out, struct 
> vkms_composer *composer)
>  }
>  
>  /**
> - * blend - belnd value at vaddr_src with value at vaddr_dst
> + * blend - blend value at vaddr_src with value at vaddr_dst
>   * @vaddr_dst: destination address
>   * @vaddr_src: source address
>   * @dest_composer: destination framebuffer's metadata
> -- 
> 2.20.1
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/vkms: Fix typo in function documentation

2019-11-01 Thread Gabriela Bittencourt
Fix typo in word 'blend' in function 'compute_crc' documentation.

Signed-off-by: Gabriela Bittencourt 
---
 drivers/gpu/drm/vkms/vkms_composer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vkms/vkms_composer.c 
b/drivers/gpu/drm/vkms/vkms_composer.c
index d5585695c64d..15efccdcce1b 100644
--- a/drivers/gpu/drm/vkms/vkms_composer.c
+++ b/drivers/gpu/drm/vkms/vkms_composer.c
@@ -43,7 +43,7 @@ static uint32_t compute_crc(void *vaddr_out, struct 
vkms_composer *composer)
 }
 
 /**
- * blend - belnd value at vaddr_src with value at vaddr_dst
+ * blend - blend value at vaddr_src with value at vaddr_dst
  * @vaddr_dst: destination address
  * @vaddr_src: source address
  * @dest_composer: destination framebuffer's metadata
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 2/2] drm/atomic: clear new_state pointers at hw_done

2019-11-01 Thread Rob Clark
From: Rob Clark 

The new state should not be accessed after this point.  Clear the
pointers to make that explicit.

This makes the error corrected in the previous patch more obvious.

Signed-off-by: Rob Clark 
---
 drivers/gpu/drm/drm_atomic_helper.c | 29 +
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 732bd0ce9241..176831df8163 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2234,13 +2234,42 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);
  */
 void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
 {
+   struct drm_connector *connector;
+   struct drm_connector_state *old_conn_state, *new_conn_state;
struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
+   struct drm_plane *plane;
+   struct drm_plane_state *old_plane_state, *new_plane_state;
struct drm_crtc_commit *commit;
+   struct drm_private_obj *obj;
+   struct drm_private_state *old_obj_state, *new_obj_state;
int i;
 
+   /*
+* After this point, drivers should not access the permanent modeset
+* state, so we also clear the new_state pointers to make this
+* restriction explicit.
+*
+* For the CRTC state, we do this in the same loop where we signal
+* hw_done, since we still need to new_crtc_state to fish out the
+* commit.
+*/
+
+   for_each_oldnew_connector_in_state(old_state, connector, 
old_conn_state, new_conn_state, i) {
+   old_state->connectors[i].new_state = NULL;
+   }
+
+   for_each_oldnew_plane_in_state(old_state, plane, old_plane_state, 
new_plane_state, i) {
+   old_state->planes[i].new_state = NULL;
+   }
+
+   for_each_oldnew_private_obj_in_state(old_state, obj, old_obj_state, 
new_obj_state, i) {
+   old_state->private_objs[i].new_state = NULL;
+   }
+
for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, 
new_crtc_state, i) {
old_state->crtcs[i].new_self_refresh_active = 
new_crtc_state->self_refresh_active;
+   old_state->crtcs[i].new_state = NULL;
 
commit = new_crtc_state->commit;
if (!commit)
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 1/2] drm/atomic: fix self-refresh helpers crtc state dereference

2019-11-01 Thread Rob Clark
From: Rob Clark 

drm_self_refresh_helper_update_avg_times() was incorrectly accessing the
new incoming state after drm_atomic_helper_commit_hw_done().  But this
state might have already been superceeded by an !nonblock atomic update
resulting in dereferencing an already free'd crtc_state.

Fixes: d4da4e33341c ("drm: Measure Self Refresh Entry/Exit times to avoid 
thrashing")
Cc: Sean Paul 
Signed-off-by: Rob Clark 
---
TODO I *think* this will more or less do the right thing.. althought I'm
not 100% sure if, for example, we enter psr in a nonblock commit, and
then leave psr in a !nonblock commit that overtakes the completion of
the nonblock commit.  Not sure if this sort of scenario can happen in
practice.  But not crashing is better than crashing, so I guess we
should either take this patch or rever the self-refresh helpers until
Sean can figure out a better solution.

 drivers/gpu/drm/drm_atomic_helper.c   |  2 ++
 drivers/gpu/drm/drm_self_refresh_helper.c | 11 ++-
 include/drm/drm_atomic.h  |  8 
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 3ef2ac52ce94..732bd0ce9241 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2240,6 +2240,8 @@ void drm_atomic_helper_commit_hw_done(struct 
drm_atomic_state *old_state)
int i;
 
for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, 
new_crtc_state, i) {
+   old_state->crtcs[i].new_self_refresh_active = 
new_crtc_state->self_refresh_active;
+
commit = new_crtc_state->commit;
if (!commit)
continue;
diff --git a/drivers/gpu/drm/drm_self_refresh_helper.c 
b/drivers/gpu/drm/drm_self_refresh_helper.c
index 68f4765a5896..77b9079fa578 100644
--- a/drivers/gpu/drm/drm_self_refresh_helper.c
+++ b/drivers/gpu/drm/drm_self_refresh_helper.c
@@ -143,19 +143,20 @@ void drm_self_refresh_helper_update_avg_times(struct 
drm_atomic_state *state,
  unsigned int commit_time_ms)
 {
struct drm_crtc *crtc;
-   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
+   struct drm_crtc_state *old_crtc_state;
int i;
 
-   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
- new_crtc_state, i) {
+   for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
+   bool new_self_refresh_active =
+   state->crtcs[i].new_self_refresh_active;
struct drm_self_refresh_data *sr_data = crtc->self_refresh_data;
struct ewma_psr_time *time;
 
if (old_crtc_state->self_refresh_active ==
-   new_crtc_state->self_refresh_active)
+   new_self_refresh_active)
continue;
 
-   if (new_crtc_state->self_refresh_active)
+   if (new_self_refresh_active)
time = _data->entry_avg_ms;
else
time = _data->exit_avg_ms;
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 927e1205d7aa..86baf2b38bb3 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -155,6 +155,14 @@ struct __drm_crtcs_state {
struct drm_crtc *ptr;
struct drm_crtc_state *state, *old_state, *new_state;
 
+   /**
+* @new_self_refresh_active:
+*
+* drm_atomic_helper_commit_hw_done() stashes 
new_crtc_state->self_refresh_active
+* so that it can be accessed late in 
drm_self_refresh_helper_update_avg_times().
+*/
+   bool new_self_refresh_active;
+
/**
 * @commit:
 *
-- 
2.21.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2082/2647] include/kcl/kcl_mm_types.h:10:3: error: conflicting types for 'pfn_t'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: 3ba40228e28c15ca2dfec398cd7e5ebebdb5a9c2 [2082/2647] drm/amdkcl: Test 
whether vmf_insert_*() functions are available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 3ba40228e28c15ca2dfec398cd7e5ebebdb5a9c2
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

from :0:
   include/linux/mm.h:663:13: note: previous declaration of 'kvfree' was here
extern void kvfree(const void *addr);
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:104:21: error: redefinition of 'kvmalloc_array'
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:648:21: note: previous definition of 'kvmalloc_array' was 
here
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:117:21: error: redefinition of 'kvcalloc'
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:658:21: note: previous definition of 'kvcalloc' was here
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:9:0,
from :0:
   include/kcl/kcl_fence.h:161:20: error: redefinition of 'dma_fence_set_error'
static inline void dma_fence_set_error(struct dma_fence *fence,
   ^~~
   In file included from include/drm/drmP.h:58:0,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/linux/dma-fence.h:517:20: note: previous definition of 
'dma_fence_set_error' was here
static inline void dma_fence_set_error(struct dma_fence *fence,
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:9:0,
from :0:
   include/kcl/kcl_fence.h: In function 'dma_fence_set_error':
   include/kcl/kcl_fence.h:167:7: error: 'struct dma_fence' has no member named 
'status'
 fence->status = error;
  ^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:10:0,
from :0:
   include/kcl/kcl_list.h: At top level:
   include/kcl/kcl_list.h:6:20: error: redefinition of 'list_bulk_move_tail'
static inline void list_bulk_move_tail(struct list_head *head,
   ^~~
   In file included from include/linux/preempt.h:11:0,
from include/linux/rcupdate.h:27,
from include/linux/rbtree.h:34,
from include/drm/drm_mm.h:41,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/list.h:212:20: note: previous definition of 
'list_bulk_move_tail' was here
static inline void list_bulk_move_tail(struct list_head *head,
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_kref.h:7:28: error: redefinition of 'kref_read'
static inline unsigned int kref_read(const struct kref *kref)
   ^
   In file included from include/linux/kobject.h:23:0,
from include/linux/device.h:16,
from include/drm/drm_print.h:32,
from include/drm/drm_mm.h:49,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/kref.h:36:28: note: previous definition of 'kref_read' was here
static inline unsigned int kref_read(const struct kref *kref)
  

[Bug 112192] regression: modesetting does not work with my Radeon R5 230

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=112192

Alex Deucher  changed:

   What|Removed |Added

 Resolution|--- |NOTABUG
 Status|NEW |RESOLVED

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [git pull] drm fixes for 5.4-rc6

2019-11-01 Thread pr-tracker-bot
The pull request you sent on Fri, 1 Nov 2019 15:21:49 +1000:

> git://anongit.freedesktop.org/drm/drm tags/drm-fixes-2019-11-01

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/146162449186f95bf123f59fa57a2c28a8a075e5

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2081/2647] include/kcl/kcl_mm.h:53:28: error: redefinition of 'memalloc_nofs_save'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: efcd1418868bc7be0eb22a57497ac20eeb831ff1 [2081/2647] drm/amdkcl: Test 
whether memalloc_nofs_save() and memalloc_nofs_restore() functions are available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout efcd1418868bc7be0eb22a57497ac20eeb831ff1
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:260:10: error: too many arguments to function 
'drm_gem_object_lookup'
  return drm_gem_object_lookup(dev, filp, handle);
 ^
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: declared here
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: At top level:
   include/kcl/kcl_drm.h:269:8: error: redefinition of 'struct 
drm_format_name_buf'
struct drm_format_name_buf {
   ^~~
   In file included from include/drm/drmP.h:69:0,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_fourcc.h:142:8: note: originally defined here
struct drm_format_name_buf {
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_gem_object_put_unlocked':
   include/kcl/kcl_drm.h:301:9: error: implicit declaration of function 
'drm_gem_object_unreference_unlocked'; did you mean 
'drm_gem_object_put_unlocked'? [-Werror=implicit-function-declaration]
 return drm_gem_object_unreference_unlocked(obj);
^~~
drm_gem_object_put_unlocked
   include/kcl/kcl_drm.h:301:9: warning: 'return' with a value, in function 
returning void
 return drm_gem_object_unreference_unlocked(obj);
^~~~
   include/kcl/kcl_drm.h:298:20: note: declared here
static inline void kcl_drm_gem_object_put_unlocked(struct drm_gem_object 
*obj)
   ^~~
   include/kcl/kcl_drm.h: In function 
'kcl_drm_atomic_get_old_crtc_state_before_commit':
   include/kcl/kcl_drm.h:325:43: error: invalid type argument of '->' (have 
'struct __drm_crtcs_state')
 return state->crtcs[drm_crtc_index(crtc)]->state;
  ^~
   include/kcl/kcl_drm.h: In function 
'kcl_drm_atomic_get_new_crtc_state_after_commit':
   include/kcl/kcl_drm.h:360:43: error: invalid type argument of '->' (have 
'struct __drm_crtcs_state')
 return state->crtcs[drm_crtc_index(crtc)]->state;
  ^~
   include/kcl/kcl_drm.h: At top level:
   include/kcl/kcl_drm.h:465:8: error: redefinition of 'struct drm_printer'
struct drm_printer {
   ^~~
   In file included from include/drm/drm_mm.h:49:0,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/drm/drm_print.h:70:8: note: originally defined here
struct drm_printer {
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:471:6: error: conflicting types for 'drm_printf'
void drm_printf(struct drm_printer *p, const char *f, ...);
 ^~
   In file included from include/drm/drm_mm.h:49:0,
from include/drm/drm_vma_manager.h:26,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/drm/drm_print.h:86:6: note: previous declaration of 'drm_printf' was 
here
void drm_printf(struct drm_printer *p, const char *f, ...);
 ^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:537:20: error: static declaration of 'drm_dev_put' 
follows non-static declaration
static inline 

[Bug 111481] AMD Navi GPU frequent freezes on both Manjaro/Ubuntu with kernel 5.3 and mesa 19.2 -git/llvm9

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111481

--- Comment #189 from wychuchol  ---
(In reply to Konstantin Pereiaslov from comment #187)
> As recommended here I added AMD_DEBUG="nongg,nodma" to /etc/environment and
> additionally added export AMD_DEBUG="nongg,nodma" to ~/.profile just to be
> sure and for 5 days since that I only had one system freeze and it had a
> different journalctl message, so it did help me help with sdma0 timeout
> issue!

Thank you very much. I was afraid to try this since someone mentioned
performance drops but I haven't noticed any in applications I use.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 111763] ring_gfx hangs/freezes on Navi gpus

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111763

--- Comment #17 from wychuchol  ---
(In reply to Andrew Sheldon from comment #16)
> (In reply to wychuchol from comment #14)
> > RX 5700 XT Pop OS 19.10 latest Oibaf mesa not sure what llvm
> > Anomaly 1.5.0 update 3 standalone 64 bit mod for S.T.A.L.K.E.R. Call of
> > Pripyat running under wine d3dx11_43->dxvk (winetricks dxvk d3dcompiler_43
> > d3dx11_43)
> > 
> > Oct 30 02:49:30 pop-os kernel: [ 4864.627343]
> > [drm:amdgpu_dm_commit_planes.constprop.0 [amdgpu]] *ERROR* Waiting for
> > fences timed out!
> > Oct 30 02:49:30 pop-os kernel: [ 4869.231450] [drm:amdgpu_job_timedout
> > [amdgpu]] *ERROR* ring gfx_0.0.0 timeout, signaled seq=2626284, emitted
> > seq=2626286
> > Oct 30 02:49:30 pop-os kernel: [ 4869.231486] [drm:amdgpu_job_timedout
> > [amdgpu]] *ERROR* Process information: process AnomalyDX11.exe pid 5791
> > thread AnomalyDX11.exe pid 5791
> > Oct 30 02:49:30 pop-os kernel: [ 4869.231487] [drm] GPU recovery disabled.
> > 
> > Happens at random. Sometimes hangs straight away, sometimes can go over an
> > hour without crash. Complete crash, no option available besides hard reset.
> > Not even mouse pointer would move (as with sdma0 hang).
> > 
> > I'm sorry if it's not the right place to report this, I'm somewhat new to
> > all of this.
> 
> Ring gfx type hangs tend to be in Mesa. Report here:
> https://gitlab.freedesktop.org/mesa/mesa/issues
> 
> Also I'm not sure how up to date the Oibaf repo is, but Mesa git landed ACO
> recently for Navi cards. You can try with RADV_PERFTEST=aco environment
> variable set if your Mesa is new enough, and you might have better luck with
> hangs.

Thank you so very much, no way to be sure since they seemed to happen at random
but I think I'd experience at least 2 or 3 hangs in the time I've tested it but
smooth ride so far. No performance impact either but running this game as I do
I'm supposedly laying most of the calculations on CPU not GPU.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 107296] WARNING: CPU: 0 PID: 370 at drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.c:1355 dcn_bw_update_from_pplib+0x16b/0x280 [amdgpu]

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107296

Janpieter Sollie  changed:

   What|Removed |Added

 Resolution|--- |WORKSFORME
 Status|NEW |RESOLVED

--- Comment #22 from Janpieter Sollie  ---
using kernel 5.3.8 + firmware 22/10 instead of 5.3.6 with GCC 8.3.0 instead of
9.2.0:
[3.421856] [drm] use_doorbell being set to: [true]
[3.421888] amdgpu: [powerplay] hwmgr_sw_init smu backed is smu10_smu
[3.423662] [drm] Found VCN firmware Version: 1.73 Family ID: 18
[3.423667] [drm] PSP loading VCN firmware
[3.444352] [drm] reserve 0x40 from 0xf400c0 for PSP TMR
[3.458608] usb 1-5: reset high-speed USB device number 2 using xhci_hcd
[3.620099] [drm] DM_PPLIB: values for F clock
[3.620101] [drm] DM_PPLIB:   40 in kHz, 3649 in mV
[3.620102] [drm] DM_PPLIB:   933000 in kHz, 3974 in mV
[3.620102] [drm] DM_PPLIB:   1067000 in kHz, 4174 in mV
[3.620103] [drm] DM_PPLIB:   120 in kHz, 4325 in mV
[3.620104] [drm] DM_PPLIB: values for DCF clock
[3.620105] [drm] DM_PPLIB:   30 in kHz, 3649 in mV
[3.620106] [drm] DM_PPLIB:   60 in kHz, 3974 in mV
[3.620107] [drm] DM_PPLIB:   626000 in kHz, 4174 in mV
[3.620107] [drm] DM_PPLIB:   654000 in kHz, 4325 in mV
[3.708441] [drm] Display Core initialized with v3.2.35!
[3.733737] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[3.733738] [drm] Driver supports precise vblank timestamp query.
[3.735809] usb 2-1: reset SuperSpeed Gen 1 USB device number 2 using
xhci_hcd
[3.745448] [drm] VCN decode and encode initialized successfully(under SPG
Mode).
[3.746451] kfd kfd: Allocated 3969056 bytes on gart
[3.747092] Topology: Add APU node [0x15dd:0x1002]
[3.747094] kfd kfd: added device 1002:15dd
[3.748312] [drm] fb mappable at 0xA100
[3.748313] [drm] vram apper at 0xA000
[3.748314] [drm] size 8294400
[3.748314] [drm] fb depth is 24
[3.748315] [drm]pitch is 7680
[3.748384] fbcon: amdgpudrmfb (fb0) is primary device
[3.794386] Console: switching to colour frame buffer device 240x67
[3.816030] amdgpu :29:00.0: fb0: amdgpudrmfb frame buffer device
[3.830110] amdgpu :29:00.0: ring gfx uses VM inv eng 0 on hub 0
[3.830113] amdgpu :29:00.0: ring comp_1.0.0 uses VM inv eng 1 on hub 0
[3.830115] amdgpu :29:00.0: ring comp_1.1.0 uses VM inv eng 4 on hub 0
[3.830117] amdgpu :29:00.0: ring comp_1.2.0 uses VM inv eng 5 on hub 0
[3.830120] amdgpu :29:00.0: ring comp_1.3.0 uses VM inv eng 6 on hub 0
[3.830121] amdgpu :29:00.0: ring comp_1.0.1 uses VM inv eng 7 on hub 0
[3.830123] amdgpu :29:00.0: ring comp_1.1.1 uses VM inv eng 8 on hub 0
[3.830125] amdgpu :29:00.0: ring comp_1.2.1 uses VM inv eng 9 on hub 0
[3.830127] amdgpu :29:00.0: ring comp_1.3.1 uses VM inv eng 10 on hub 0
[3.830129] amdgpu :29:00.0: ring kiq_2.1.0 uses VM inv eng 11 on hub 0
[3.830131] amdgpu :29:00.0: ring sdma0 uses VM inv eng 0 on hub 1
[3.830132] amdgpu :29:00.0: ring vcn_dec uses VM inv eng 1 on hub 1
[3.830134] amdgpu :29:00.0: ring vcn_enc0 uses VM inv eng 4 on hub 1
[3.830136] amdgpu :29:00.0: ring vcn_enc1 uses VM inv eng 5 on hub 1
[3.830138] amdgpu :29:00.0: ring vcn_jpeg uses VM inv eng 6 on hub 1
[3.843923] [drm] Initialized amdgpu 3.33.0 20150101 for :29:00.0 on
minor 0

Looks good, doesn't it? I don't know what actually changed the behaviour, but
it seems to work

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/atomic: swap_state should stall on cleanup_done

2019-11-01 Thread Maarten Lankhorst
Op 01-11-2019 om 15:59 schreef Rob Clark:
> On Fri, Nov 1, 2019 at 7:47 AM Maarten Lankhorst
>  wrote:
>> Op 31-10-2019 om 23:36 schreef Rob Clark:
>>> From: Rob Clark 
>>>
>>> Stalling on cleanup_done ensures that any atomic state related to a
>>> nonblock commit no longer has dangling references to per-object state
>>> that can be freed.
>>>
>>> Otherwise, if a !nonblock commit completes after a nonblock commit has
>>> swapped state (ie. the synchronous part of the nonblock commit comes
>>> before the !nonblock commit), but before the asynchronous part of the
>>> nonblock commit completes, what was the new per-object state in the
>>> nonblock commit can be freed.
>>>
>>> This shows up with the new self-refresh helper, as _update_avg_times()
>>> dereferences the original old and new crtc_state.
>>>
>>> Fixes: d4da4e33341c ("drm: Measure Self Refresh Entry/Exit times to avoid 
>>> thrashing")
>>> Cc: Sean Paul 
>>> Signed-off-by: Rob Clark 
>>> ---
>>> Other possibilities:
>>> 1) maybe block later before freeing atomic state?
>>> 2) refcount individual per-object state
>>>
>>>  drivers/gpu/drm/drm_atomic_helper.c | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
>>> b/drivers/gpu/drm/drm_atomic_helper.c
>>> index 3ef2ac52ce94..a5d95429f91b 100644
>>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>>> @@ -2711,7 +2711,7 @@ int drm_atomic_helper_swap_state(struct 
>>> drm_atomic_state *state,
>>>   if (!commit)
>>>   continue;
>>>
>>> - ret = 
>>> wait_for_completion_interruptible(>hw_done);
>>> + ret = 
>>> wait_for_completion_interruptible(>cleanup_done);
>>>   if (ret)
>>>   return ret;
>>>   }
>>> @@ -2722,7 +2722,7 @@ int drm_atomic_helper_swap_state(struct 
>>> drm_atomic_state *state,
>>>   if (!commit)
>>>   continue;
>>>
>>> - ret = 
>>> wait_for_completion_interruptible(>hw_done);
>>> + ret = 
>>> wait_for_completion_interruptible(>cleanup_done);
>>>   if (ret)
>>>   return ret;
>>>   }
>>> @@ -2733,7 +2733,7 @@ int drm_atomic_helper_swap_state(struct 
>>> drm_atomic_state *state,
>>>   if (!commit)
>>>   continue;
>>>
>>> - ret = 
>>> wait_for_completion_interruptible(>hw_done);
>>> + ret = 
>>> wait_for_completion_interruptible(>cleanup_done);
>>>   if (ret)
>>>   return ret;
>>>   }
>> Nack, hw_done means all new_crtc_state (from the old commit pov) 
>> dereferences are done.
>>
> hmm, it would be nice if the for_each_blah_in_state() iterators would
> splat on incorrect usage, then..  it tool a while to track down what
> was going wrong.  And Sean claimed the self refresh helpers worked for
> him on rockchip/i915 (although I'm starting to suspect maybe he just
> didn't have enough debug options enabled to poison freed memory?)
Could do a memset on the new arrays after hw_done?
>> Self refresh helpers should be fixed. :)
> Looks like what they need out of crtc_state is pretty minimal, maybe
> they could extract out crtc_state->self_refresh_active earlier..

Yeah, something like that would work. :)

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Yang, Philip


On 2019-11-01 11:12 a.m., Jason Gunthorpe wrote:
> On Fri, Nov 01, 2019 at 02:44:51PM +, Yang, Philip wrote:
>>
>>
>> On 2019-10-29 3:25 p.m., Jason Gunthorpe wrote:
>>> On Tue, Oct 29, 2019 at 07:22:37PM +, Yang, Philip wrote:
 Hi Jason,

 I did quick test after merging amd-staging-drm-next with the
 mmu_notifier branch, which includes this set changes. The test result
 has different failures, app stuck intermittently, GUI no display etc. I
 am understanding the changes and will try to figure out the cause.
>>>
>>> Thanks! I'm not surprised by this given how difficult this patch was
>>> to make. Let me know if I can assist in any way
>>>
>>> Please ensure to run with lockdep enabled.. Your symptops sounds sort
>>> of like deadlocking?
>>>
>> Hi Jason,
>>
>> Attached patch fix several issues in amdgpu driver, maybe you can squash
>> this into patch 14. With this is done, patch 12, 13, 14 is Reviewed-by
>> and Tested-by Philip Yang 
> 
> Wow, this is great thanks! Can you clarify what the problems you found
> were? Was the bug the 'return !r' below?
> 
Yes. return !r is critical one, and retry if hmm_range_fault return 
-EBUSY is needed too.

> I'll also add your signed off by
> 
> Here are some remarks:
> 
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>> index cb718a064eb4..c8bbd06f1009 100644
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>> @@ -67,21 +67,15 @@ static bool amdgpu_mn_invalidate_gfx(struct 
>> mmu_range_notifier *mrn,
>>  struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
>>  long r;
>>   
>> -/*
>> - * FIXME: Must hold some lock shared with
>> - * amdgpu_ttm_tt_get_user_pages_done()
>> - */
>> -mmu_range_set_seq(mrn, cur_seq);
>> +mutex_lock(>notifier_lock);
>>   
>> -/* FIXME: Is this necessary? */
>> -if (!amdgpu_ttm_tt_affect_userptr(bo->tbo.ttm, range->start,
>> -  range->end))
>> -return true;
>> +mmu_range_set_seq(mrn, cur_seq);
>>   
>> -if (!mmu_notifier_range_blockable(range))
>> +if (!mmu_notifier_range_blockable(range)) {
>> +mutex_unlock(>notifier_lock);
>>  return false;
> 
> This test for range_blockable should be before mutex_lock, I can move
> it up
> 
yes, thanks.
> Also, do you know if notifier_lock is held while calling
> amdgpu_ttm_tt_get_user_pages_done()? Can we add a 'lock assert held'
> to amdgpu_ttm_tt_get_user_pages_done()?
> 
gpu side hold notifier_lock but kfd side doesn't. kfd side doesn't check 
amdgpu_ttm_tt_get_user_pages_done/mmu_range_read_retry return value but 
check mem->invalid flag which is updated from invalidate callback. It 
takes more time to change, I will come to another patch to fix it later.

>> @@ -854,12 +853,20 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, 
>> struct page **pages)
>>  r = -EPERM;
>>  goto out_unlock;
>>  }
>> +up_read(>mmap_sem);
>> +timeout = jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
>> +
>> +retry:
>> +range->notifier_seq = mmu_range_read_begin(>notifier);
>>   
>> +down_read(>mmap_sem);
>>  r = hmm_range_fault(range, 0);
>>  up_read(>mmap_sem);
>> -
>> -if (unlikely(r < 0))
>> +if (unlikely(r <= 0)) {
>> +if ((r == 0 || r == -EBUSY) && !time_after(jiffies, timeout))
>> +goto retry;
>>  goto out_free_pfns;
>> +}
> 
> This isn't really right, a retry loop like this needs to go all the
> way to mmu_range_read_retry() and done under the notifier_lock. ie
> mmu_range_read_retry() can fail just as likely as hmm_range_fault()
> can, and drivers are supposed to retry in both cases, with a single
> timeout.
> 
For gpu, check mmu_range_read_retry return value under the notifier_lock 
to do retry is in seperate location, not in same retry loop.

> AFAICT it is a major bug that many places ignore the return code of
> amdgpu_ttm_tt_get_user_pages_done() ???
>
For kfd, explained above.

> However, this is all pre-existing bugs, so I'm OK go ahead with this
> patch as modified. I advise AMD to make a followup patch ..
> 
yes, I will.
> I'll add a FIXME note to this effect.
> 
>>  for (i = 0; i < ttm->num_pages; i++) {
>>  pages[i] = hmm_device_entry_to_page(range, range->pfns[i]);
>> @@ -916,7 +923,7 @@ bool amdgpu_ttm_tt_get_user_pages_done(struct ttm_tt 
>> *ttm)
>>  gtt->range = NULL;
>>  }
>>   
>> -return r;
>> +return !r;
> 
> Ah is this the major error? hmm_range_valid() is inverted vs
> mmu_range_read_retry()?
> 
yes.
>>   }
>>   #endif
>>   
>> @@ -997,10 +1004,18 @@ static void amdgpu_ttm_tt_unpin_userptr(struct ttm_tt 
>> *ttm)
>>  sg_free_table(ttm->sg);
>>   
>>   #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR)
>> -if (gtt->range &&
>> -ttm->pages[0] == hmm_device_entry_to_page(gtt->range,
>> -

[PATCH v2] drm/doc: Adding VKMS module description and use to "Testing and Validation"

2019-11-01 Thread Gabriela Bittencourt
Add a description on VKMS module and the cases in which it should be used.
There's a brief explanation on how to set it and use it in a VM, along with
an example of running an igt-test.

Signed-off-by: Gabriela Bittencourt 

---

Changes in v2:
- Avoid repetition of words in the same sentence;
- Make the explanation on 'setting the kernel' shorter, eliminate the
'make menuconfig' command;
- Add tab on enumeration to have one line per item;
- Clarify from each machine igt-tests commands should be ran on.

Tested the patch using 'make htmldocs' to make sure the output .html is
correct.

Hi DRM-community,
this is my first (of many, I hope)  patch in this subsystem. I hope to have
a lot of learning (and fun :)) working with you guys.
I'm starting by documenting the VKMS driver in "Userland interfaces", if I
have been inaccurate in my description or if I misunderstood some concept,
please let me know.
---
 Documentation/gpu/drm-uapi.rst | 36 ++
 1 file changed, 36 insertions(+)

diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
index 94f90521f58c..1586cbba05d0 100644
--- a/Documentation/gpu/drm-uapi.rst
+++ b/Documentation/gpu/drm-uapi.rst
@@ -285,6 +285,42 @@ run-tests.sh is a wrapper around piglit that will execute 
the tests matching
 the -t options. A report in HTML format will be available in
 ./results/html/index.html. Results can be compared with piglit.
 
+Using VKMS to test DRM API
+--
+
+VKMS is a software-only model of a KMS driver that is useful for testing
+and for running compositors. VKMS aims to enable a virtual display without
+the need for a hardware display capability. These characteristics made VKMS
+a perfect tool for validating the DRM core behavior and also support the
+compositor developer. VKMS makes it possible to test DRM functions in a
+virtual machine without display, simplifing the validation of some of the
+core changes.
+
+To Validate changes in DRM API with VKMS, start setting the kernel: make
+sure to enable VKMS module; compile the kernel with the VKMS enabled and
+install it in the target machine. VKMS can be run in a Virtual Machine
+(QEMU, virtme or similar). It's recommended the use of KVM with the minimum
+of 1GB of RAM and four cores.
+
+It's possible to run the IGT-tests in a VM in two ways:
+   1. Use IGT inside a VM
+   2. Use IGT from the host machine and write the results in a shared 
directory.
+
+As follow, there is an example of using a VM with a shared directory with
+the host machine to run igt-tests. As example it's used virtme::
+
+   $ virtme-run --rwdir /path/for/shared_dir 
--kdir=path/for/kernel/directory --mods=auto
+
+Run the igt-tests in the guest machine, as example it's ran the 'kms_flip'
+tests::
+
+   $ /path/for/igt-gpu-tools/scripts/run-tests.sh -p -s -t "kms_flip.*" -v
+
+In this example, instead of build the igt_runner, Piglit is used
+(-p option); it's created html summary of the tests results and it's saved
+in the folder "igt-gpu-tools/results"; it's executed only the igt-tests
+matching the -t option.
+
 Display CRC Support
 ---
 
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v7 0/9] backlight: gpio: simplify the driver

2019-11-01 Thread Jacopo Mondi
Hello,
  as promised...

On Fri, Nov 01, 2019 at 08:58:03AM +, Lee Jones wrote:
> On Thu, 24 Oct 2019, Jacopo Mondi wrote:
>
> > Hello,
> >
> > On Thu, Oct 24, 2019 at 07:47:26AM +0100, Lee Jones wrote:
> > > On Wed, 23 Oct 2019, Daniel Thompson wrote:
> > >
> > > > On Tue, Oct 22, 2019 at 11:29:54AM +0200, Bartosz Golaszewski wrote:
> > > > > wt., 22 paź 2019 o 10:36 Bartosz Golaszewski  
> > > > > napisał(a):
> > > > > >
> > > > > > From: Bartosz Golaszewski 
> > > > > >
> > > > > > While working on my other series related to gpio-backlight[1] I 
> > > > > > noticed
> > > > > > that we could simplify the driver if we made the only user of 
> > > > > > platform
> > > > > > data use GPIO lookups and device properties. This series tries to do
> > > > > > that.
> > > > > >
> > > > > > First two patches contain minor fixes. Third patch makes the driver
> > > > > > explicitly drive the GPIO line. Fourth patch adds all necessary data
> > > > > > structures to ecovec24. Patch 5/9 unifies much of the code for both
> > > > > > pdata and non-pdata cases. Patches 6-7/9 remove unused platform data
> > > > > > fields. Last two patches contain additional improvements for the 
> > > > > > GPIO
> > > > > > backlight driver while we're already modifying it.
> > > > > >
> > > > > > I don't have access to this HW but hopefully this works. Only 
> > > > > > compile
> > > > > > tested.
> > > > > >
> > > > > > [1] https://lkml.org/lkml/2019/6/25/900
> > > > > >
> > > > > > v1 -> v2:
> > > > > > - rebased on top of v5.3-rc1 and adjusted to the recent changes 
> > > > > > from Andy
> > > > > > - added additional two patches with minor improvements
> > > > > >
> > > > > > v2 -> v3:
> > > > > > - in patch 7/7: used initializers to set values for pdata and dev 
> > > > > > local vars
> > > > > >
> > > > > > v3 -> v4:
> > > > > > - rebased on top of v5.4-rc1
> > > > > > - removed changes that are no longer relevant after commit 
> > > > > > ec665b756e6f
> > > > > >   ("backlight: gpio-backlight: Correct initial power state 
> > > > > > handling")
> > > > > > - added patch 7/7
> > > > > >
> > > > > > v4 -> v5:
> > > > > > - in patch 7/7: added a comment replacing the name of the function 
> > > > > > being
> > > > > >   pulled into probe()
> > > > > >
> > > > > > v5 -> v6:
> > > > > > - added a patch making the driver explicitly set the direction of 
> > > > > > the GPIO
> > > > > >   to output
> > > > > > - added a patch removing a redundant newline
> > > > > >
> > > > > > v6 -> v7:
> > > > > > - renamed the function calculating the new GPIO value for status 
> > > > > > update
> > > > > > - collected more tags
> > > > > >
> > > > > > Bartosz Golaszewski (9):
> > > > > >   backlight: gpio: remove unneeded include
> > > > > >   backlight: gpio: remove stray newline
> > > > > >   backlight: gpio: explicitly set the direction of the GPIO
> > > > > >   sh: ecovec24: add additional properties to the backlight device
> > > > > >   backlight: gpio: simplify the platform data handling
> > > > > >   sh: ecovec24: don't set unused fields in platform data
> > > > > >   backlight: gpio: remove unused fields from platform data
> > > > > >   backlight: gpio: use a helper variable for >dev
> > > > > >   backlight: gpio: pull gpio_backlight_initial_power_state() into 
> > > > > > probe
> > > > > >
> > > > > >  arch/sh/boards/mach-ecovec24/setup.c |  33 +++--
> > > > > >  drivers/video/backlight/gpio_backlight.c | 128 
> > > > > > +++
> > > > > >  include/linux/platform_data/gpio_backlight.h |   3 -
> > > > > >  3 files changed, 69 insertions(+), 95 deletions(-)
> > > > > >
> > > > > >
> > > > >
> > > > > Lee, Daniel, Jingoo,
> > > > >
> > > > > Jacopo is travelling until November 1st and won't be able to test this
> > > > > again before this date. Do you think you can pick it up and in case
> > > > > anything's broken on SH, we can fix it after v5.5-rc1, so that it
> > > > > doesn't miss another merge window?
> > >
> > > November 1st (-rc6) will be fine.
> > >
> > > I'd rather apply it late-tested than early-non-tested.
> > >
> > > Hopefully Jacopo can prioritise testing this on Thursday or Friday,
> > > since Monday will be -rc7 which is really cutting it fine.
> >
> > I'll do my best, I'll get home Friday late afternoon :)
>
> Welcome home!
>
> Just a little reminder in your inbox. TIA. :)

For the ecovec part:
Tested-by: Jacopo Mondi 

Thanks
   j


>
> --
> Lee Jones [李琼斯]
> Linaro Services Technical Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/shmem: Add docbook comments for drm_gem_shmem_object madvise fields

2019-11-01 Thread Rob Herring
Add missing docbook comments to madvise fields in struct
drm_gem_shmem_object which fixes these warnings:

include/drm/drm_gem_shmem_helper.h:87: warning: Function parameter or member 
'madv' not described in 'drm_gem_shmem_object'
include/drm/drm_gem_shmem_helper.h:87: warning: Function parameter or member 
'madv_list' not described in 'drm_gem_shmem_object'

Fixes: 17acb9f35ed7 ("drm/shmem: Add madvise state and purge helpers")
Reported-by: Sean Paul 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: David Airlie 
Cc: Daniel Vetter 
Signed-off-by: Rob Herring 
---
 include/drm/drm_gem_shmem_helper.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/include/drm/drm_gem_shmem_helper.h 
b/include/drm/drm_gem_shmem_helper.h
index e2e9947b4770..901eafb09209 100644
--- a/include/drm/drm_gem_shmem_helper.h
+++ b/include/drm/drm_gem_shmem_helper.h
@@ -44,7 +44,20 @@ struct drm_gem_shmem_object {
 */
unsigned int pages_use_count;
 
+   /**
+* @madv: State for madvise
+*
+* 0 is active/inuse.
+* A negative value is the object is purged.
+* Positive values are driver specific and not used by the helpers.
+*/
int madv;
+
+   /**
+* @madv_list: List entry for madvise tracking
+*
+* Typically used by drivers to track purgeable objects
+*/
struct list_head madv_list;
 
/**
-- 
2.20.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/atomic: swap_state should stall on cleanup_done

2019-11-01 Thread Rob Clark
On Fri, Nov 1, 2019 at 7:47 AM Maarten Lankhorst
 wrote:
>
> Op 31-10-2019 om 23:36 schreef Rob Clark:
> > From: Rob Clark 
> >
> > Stalling on cleanup_done ensures that any atomic state related to a
> > nonblock commit no longer has dangling references to per-object state
> > that can be freed.
> >
> > Otherwise, if a !nonblock commit completes after a nonblock commit has
> > swapped state (ie. the synchronous part of the nonblock commit comes
> > before the !nonblock commit), but before the asynchronous part of the
> > nonblock commit completes, what was the new per-object state in the
> > nonblock commit can be freed.
> >
> > This shows up with the new self-refresh helper, as _update_avg_times()
> > dereferences the original old and new crtc_state.
> >
> > Fixes: d4da4e33341c ("drm: Measure Self Refresh Entry/Exit times to avoid 
> > thrashing")
> > Cc: Sean Paul 
> > Signed-off-by: Rob Clark 
> > ---
> > Other possibilities:
> > 1) maybe block later before freeing atomic state?
> > 2) refcount individual per-object state
> >
> >  drivers/gpu/drm/drm_atomic_helper.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> > b/drivers/gpu/drm/drm_atomic_helper.c
> > index 3ef2ac52ce94..a5d95429f91b 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2711,7 +2711,7 @@ int drm_atomic_helper_swap_state(struct 
> > drm_atomic_state *state,
> >   if (!commit)
> >   continue;
> >
> > - ret = 
> > wait_for_completion_interruptible(>hw_done);
> > + ret = 
> > wait_for_completion_interruptible(>cleanup_done);
> >   if (ret)
> >   return ret;
> >   }
> > @@ -2722,7 +2722,7 @@ int drm_atomic_helper_swap_state(struct 
> > drm_atomic_state *state,
> >   if (!commit)
> >   continue;
> >
> > - ret = 
> > wait_for_completion_interruptible(>hw_done);
> > + ret = 
> > wait_for_completion_interruptible(>cleanup_done);
> >   if (ret)
> >   return ret;
> >   }
> > @@ -2733,7 +2733,7 @@ int drm_atomic_helper_swap_state(struct 
> > drm_atomic_state *state,
> >   if (!commit)
> >   continue;
> >
> > - ret = 
> > wait_for_completion_interruptible(>hw_done);
> > + ret = 
> > wait_for_completion_interruptible(>cleanup_done);
> >   if (ret)
> >   return ret;
> >   }
>
> Nack, hw_done means all new_crtc_state (from the old commit pov) dereferences 
> are done.
>

hmm, it would be nice if the for_each_blah_in_state() iterators would
splat on incorrect usage, then..  it tool a while to track down what
was going wrong.  And Sean claimed the self refresh helpers worked for
him on rockchip/i915 (although I'm starting to suspect maybe he just
didn't have enough debug options enabled to poison freed memory?)

> Self refresh helpers should be fixed. :)

Looks like what they need out of crtc_state is pretty minimal, maybe
they could extract out crtc_state->self_refresh_active earlier..

BR,
-R
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/atomic: swap_state should stall on cleanup_done

2019-11-01 Thread Maarten Lankhorst
Op 31-10-2019 om 23:36 schreef Rob Clark:
> From: Rob Clark 
>
> Stalling on cleanup_done ensures that any atomic state related to a
> nonblock commit no longer has dangling references to per-object state
> that can be freed.
>
> Otherwise, if a !nonblock commit completes after a nonblock commit has
> swapped state (ie. the synchronous part of the nonblock commit comes
> before the !nonblock commit), but before the asynchronous part of the
> nonblock commit completes, what was the new per-object state in the
> nonblock commit can be freed.
>
> This shows up with the new self-refresh helper, as _update_avg_times()
> dereferences the original old and new crtc_state.
>
> Fixes: d4da4e33341c ("drm: Measure Self Refresh Entry/Exit times to avoid 
> thrashing")
> Cc: Sean Paul 
> Signed-off-by: Rob Clark 
> ---
> Other possibilities:
> 1) maybe block later before freeing atomic state?
> 2) refcount individual per-object state
>
>  drivers/gpu/drm/drm_atomic_helper.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index 3ef2ac52ce94..a5d95429f91b 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2711,7 +2711,7 @@ int drm_atomic_helper_swap_state(struct 
> drm_atomic_state *state,
>   if (!commit)
>   continue;
>  
> - ret = 
> wait_for_completion_interruptible(>hw_done);
> + ret = 
> wait_for_completion_interruptible(>cleanup_done);
>   if (ret)
>   return ret;
>   }
> @@ -2722,7 +2722,7 @@ int drm_atomic_helper_swap_state(struct 
> drm_atomic_state *state,
>   if (!commit)
>   continue;
>  
> - ret = 
> wait_for_completion_interruptible(>hw_done);
> + ret = 
> wait_for_completion_interruptible(>cleanup_done);
>   if (ret)
>   return ret;
>   }
> @@ -2733,7 +2733,7 @@ int drm_atomic_helper_swap_state(struct 
> drm_atomic_state *state,
>   if (!commit)
>   continue;
>  
> - ret = 
> wait_for_completion_interruptible(>hw_done);
> + ret = 
> wait_for_completion_interruptible(>cleanup_done);
>   if (ret)
>   return ret;
>   }

From setup_commit():

 * Completion of the hardware commit step must be signalled using
 * drm_atomic_helper_commit_hw_done(). After this step the driver is not allowed
 * to read or change any permanent software or hardware modeset state. The only
 * exception is state protected by other means than _modeset_lock locks.
 * Only the free standing @state with pointers to the old state structures can
 * be inspected, e.g. to clean up old buffers using
 * drm_atomic_helper_cleanup_planes().

And the hw_done function says pretty much the same thing. :)

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [Freedreno] [PATCH RESEND] drm/msm/adreno: Do not print error on "qcom, gpu-pwrlevels" absence

2019-11-01 Thread Jordan Crouse
On Thu, Oct 31, 2019 at 07:03:59PM -0300, Fabio Estevam wrote:
> Hi Rob,
> 
> On Tue, Oct 15, 2019 at 11:19 AM Jeffrey Hugo  
> wrote:
> >
> > On Tue, Oct 15, 2019 at 7:40 AM Fabio Estevam  wrote:
> > >
> > > Booting the adreno driver on a imx53 board leads to the following
> > > error message:
> > >
> > > adreno 3000.gpu: [drm:adreno_gpu_init] *ERROR* Could not find the GPU 
> > > powerlevels
> > >
> > > As the "qcom,gpu-pwrlevels" property is optional and never present on
> > > i.MX5, turn the message into debug level instead.
> > >
> > > Signed-off-by: Fabio Estevam 
> >
> > Seems reasonable.  Reviewed-by: Jeffrey Hugo 
> 
> Any comments, please?
> 
> Just wanted to get rid of this misleading error message on i.MX5.

I'm good with this. This really should only be around for
compatibility with downstream device tree files which should mean nothing for
I.MX5.

Jordan

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/atomic: swap_state should stall on cleanup_done

2019-11-01 Thread Maarten Lankhorst
Op 31-10-2019 om 23:36 schreef Rob Clark:
> From: Rob Clark 
>
> Stalling on cleanup_done ensures that any atomic state related to a
> nonblock commit no longer has dangling references to per-object state
> that can be freed.
>
> Otherwise, if a !nonblock commit completes after a nonblock commit has
> swapped state (ie. the synchronous part of the nonblock commit comes
> before the !nonblock commit), but before the asynchronous part of the
> nonblock commit completes, what was the new per-object state in the
> nonblock commit can be freed.
>
> This shows up with the new self-refresh helper, as _update_avg_times()
> dereferences the original old and new crtc_state.
>
> Fixes: d4da4e33341c ("drm: Measure Self Refresh Entry/Exit times to avoid 
> thrashing")
> Cc: Sean Paul 
> Signed-off-by: Rob Clark 
> ---
> Other possibilities:
> 1) maybe block later before freeing atomic state?
> 2) refcount individual per-object state
>
>  drivers/gpu/drm/drm_atomic_helper.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index 3ef2ac52ce94..a5d95429f91b 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2711,7 +2711,7 @@ int drm_atomic_helper_swap_state(struct 
> drm_atomic_state *state,
>   if (!commit)
>   continue;
>  
> - ret = 
> wait_for_completion_interruptible(>hw_done);
> + ret = 
> wait_for_completion_interruptible(>cleanup_done);
>   if (ret)
>   return ret;
>   }
> @@ -2722,7 +2722,7 @@ int drm_atomic_helper_swap_state(struct 
> drm_atomic_state *state,
>   if (!commit)
>   continue;
>  
> - ret = 
> wait_for_completion_interruptible(>hw_done);
> + ret = 
> wait_for_completion_interruptible(>cleanup_done);
>   if (ret)
>   return ret;
>   }
> @@ -2733,7 +2733,7 @@ int drm_atomic_helper_swap_state(struct 
> drm_atomic_state *state,
>   if (!commit)
>   continue;
>  
> - ret = 
> wait_for_completion_interruptible(>hw_done);
> + ret = 
> wait_for_completion_interruptible(>cleanup_done);
>   if (ret)
>   return ret;
>   }

Nack, hw_done means all new_crtc_state (from the old commit pov) dereferences 
are done.

Self refresh helpers should be fixed. :)

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 14/15] drm/amdgpu: Use mmu_range_notifier instead of hmm_mirror

2019-11-01 Thread Yang, Philip


On 2019-10-29 3:25 p.m., Jason Gunthorpe wrote:
> On Tue, Oct 29, 2019 at 07:22:37PM +, Yang, Philip wrote:
>> Hi Jason,
>>
>> I did quick test after merging amd-staging-drm-next with the
>> mmu_notifier branch, which includes this set changes. The test result
>> has different failures, app stuck intermittently, GUI no display etc. I
>> am understanding the changes and will try to figure out the cause.
> 
> Thanks! I'm not surprised by this given how difficult this patch was
> to make. Let me know if I can assist in any way
> 
> Please ensure to run with lockdep enabled.. Your symptops sounds sort
> of like deadlocking?
> 
Hi Jason,

Attached patch fix several issues in amdgpu driver, maybe you can squash 
this into patch 14. With this is done, patch 12, 13, 14 is Reviewed-by 
and Tested-by Philip Yang 

Regards,
Philip

> Regards,
> Jason
> 
From 5a0bd4d8cef8472fe2904550142d288feed8cd81 Mon Sep 17 00:00:00 2001
From: Philip Yang 
Date: Thu, 31 Oct 2019 09:10:30 -0400
Subject: [PATCH] drm/amdgpu: issues with new mmu_range_notifier api

put mmu_range_set_seq under the same lock which is used to call
mmu_range_read_retry.

fix amdgpu_ttm_tt_get_user_pages_done return value, because
mmu_range_read_retry means !hmm_range_valid

retry if hmm_range_fault return -EBUSY

fix false WARN for missing get_user_page_done, we should check all
pages not just the first page, don't understand why this issue is
triggered by this change.

Signed-off-by: Philip Yang 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c  | 32 +++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 37 +
 2 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index cb718a064eb4..c8bbd06f1009 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -67,21 +67,15 @@ static bool amdgpu_mn_invalidate_gfx(struct mmu_range_notifier *mrn,
 	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
 	long r;
 
-	/*
-	 * FIXME: Must hold some lock shared with
-	 * amdgpu_ttm_tt_get_user_pages_done()
-	 */
-	mmu_range_set_seq(mrn, cur_seq);
+	mutex_lock(>notifier_lock);
 
-	/* FIXME: Is this necessary? */
-	if (!amdgpu_ttm_tt_affect_userptr(bo->tbo.ttm, range->start,
-	  range->end))
-		return true;
+	mmu_range_set_seq(mrn, cur_seq);
 
-	if (!mmu_notifier_range_blockable(range))
+	if (!mmu_notifier_range_blockable(range)) {
+		mutex_unlock(>notifier_lock);
 		return false;
+	}
 
-	mutex_lock(>notifier_lock);
 	r = dma_resv_wait_timeout_rcu(bo->tbo.base.resv, true, false,
   MAX_SCHEDULE_TIMEOUT);
 	mutex_unlock(>notifier_lock);
@@ -110,21 +104,15 @@ static bool amdgpu_mn_invalidate_hsa(struct mmu_range_notifier *mrn,
 	struct amdgpu_bo *bo = container_of(mrn, struct amdgpu_bo, notifier);
 	struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
 
-	/*
-	 * FIXME: Must hold some lock shared with
-	 * amdgpu_ttm_tt_get_user_pages_done()
-	 */
-	mmu_range_set_seq(mrn, cur_seq);
+	mutex_lock(>notifier_lock);
 
-	/* FIXME: Is this necessary? */
-	if (!amdgpu_ttm_tt_affect_userptr(bo->tbo.ttm, range->start,
-	  range->end))
-		return true;
+	mmu_range_set_seq(mrn, cur_seq);
 
-	if (!mmu_notifier_range_blockable(range))
+	if (!mmu_notifier_range_blockable(range)) {
+		mutex_unlock(>notifier_lock);
 		return false;
+	}
 
-	mutex_lock(>notifier_lock);
 	amdgpu_amdkfd_evict_userptr(bo->kfd_bo, bo->notifier.mm);
 	mutex_unlock(>notifier_lock);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index a38437fd290a..56fde43d5efa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -799,10 +799,11 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
 {
 	struct ttm_tt *ttm = bo->tbo.ttm;
 	struct amdgpu_ttm_tt *gtt = (void *)ttm;
-	struct mm_struct *mm;
-	struct hmm_range *range;
 	unsigned long start = gtt->userptr;
 	struct vm_area_struct *vma;
+	struct hmm_range *range;
+	unsigned long timeout;
+	struct mm_struct *mm;
 	unsigned long i;
 	int r = 0;
 
@@ -841,8 +842,6 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
 		goto out_free_ranges;
 	}
 
-	range->notifier_seq = mmu_range_read_begin(>notifier);
-
 	down_read(>mmap_sem);
 	vma = find_vma(mm, start);
 	if (unlikely(!vma || start < vma->vm_start)) {
@@ -854,12 +853,20 @@ int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages)
 		r = -EPERM;
 		goto out_unlock;
 	}
+	up_read(>mmap_sem);
+	timeout = jiffies + msecs_to_jiffies(HMM_RANGE_DEFAULT_TIMEOUT);
+
+retry:
+	range->notifier_seq = mmu_range_read_begin(>notifier);
 
+	down_read(>mmap_sem);
 	r = hmm_range_fault(range, 0);
 	up_read(>mmap_sem);
-
-	if (unlikely(r < 0))
+	if (unlikely(r <= 0)) {
+		if ((r == 0 || r == -EBUSY) && !time_after(jiffies, timeout))
+			goto retry;
 		goto out_free_pfns;
+	}
 
 	for 

[Bug 112192] regression: modesetting does not work with my Radeon R5 230

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=112192

--- Comment #9 from Elmar Stellnberger  ---
  Ahh, I should have known. That is a detriment with the Debian live dvd.
Basically I could install the firmware with hindsight and then restart the
X-server. 
  There is another bug with the VESA driver which has gone unreported yet. If
the DPMS standbys the screen then the color palette is wrong on resume (no
s2ram, only a display standby). I wonder if anyone cares to still support the
VESA driver.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 111481] AMD Navi GPU frequent freezes on both Manjaro/Ubuntu with kernel 5.3 and mesa 19.2 -git/llvm9

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111481

--- Comment #188 from L.S.S.  ---
Not sure where the problem might be.

After installing 5.4-rc5, in addition to amdgpu-pro-libgl (and other amdgpu-pro
related stuffs), I stopped encountering those dreaded "ring sdma0 timeout"
freezes when using Nemo. I think amdgpu-pro stuffs might be what "fixed" it.

I'll test this for the time being. I cannot be confident that it would be
completely fixed this way, but at least the situation has been improved to the
point that Nemo is now usable again.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 112192] regression: modesetting does not work with my Radeon R5 230

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=112192

--- Comment #8 from Alex Deucher  ---
You need to install the firmware package:
[1.629363] [drm:radeon_pci_probe [radeon]] *ERROR* radeon kernel
modesetting for R600 or later requires firmware installed

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2080/2647] include/kcl/kcl_kref.h:7:28: error: redefinition of 'kref_read'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: b35c23a557bb753b64082a4aa4057374bcbcca74 [2080/2647] drm/amdkcl: Test 
whether kref_read() function is available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout b35c23a557bb753b64082a4aa4057374bcbcca74
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

static inline void drm_dev_put(struct drm_device *dev)
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h: At top level:
   include/kcl/kcl_mm.h:65:21: error: redefinition of 'kvmalloc'
static inline void *kvmalloc(size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:635:21: note: previous definition of 'kvmalloc' was here
static inline void *kvmalloc(size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:75:21: error: redefinition of 'kvzalloc'
static inline void *kvzalloc(size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:643:21: note: previous definition of 'kvzalloc' was here
static inline void *kvzalloc(size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:85:20: error: static declaration of 'kvfree' follows 
non-static declaration
static inline void kvfree(const void *addr)
   ^~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:663:13: note: previous declaration of 'kvfree' was here
extern void kvfree(const void *addr);
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:105:21: error: redefinition of 'kvmalloc_array'
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:648:21: note: previous definition of 'kvmalloc_array' was 
here
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:118:21: error: redefinition of 'kvcalloc'
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:658:21: note: previous definition of 'kvcalloc' was here
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:9:0,
from :0:
   include/kcl/kcl_fence.h:161:20: error: redefinition of 'dma_fence_set_error'
static inline void dma_fence_set_error(struct dma_fence *fence,
   ^~~
   In file included from include/drm/drmP.h:58:0,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/linux/dma-fence.h:517:20: note: previous definition of 
'dma_fence_set_error' was here
static inline void dma_fence_set_error(struct dma_fence *fence,
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:9:0,
from :0:
   include/kcl/kcl_fence.h: In function 'dma_fence_set_error':
   include/kcl/kcl_fence.h:167:7: error: 'struct dma_fence' has no member 

Re: [PATCH v11 4/7] drm/sun4i: dsi: Handle bus clock explicitly

2019-11-01 Thread Jagan Teki
Hi Maxime,

On Tue, Oct 29, 2019 at 2:24 PM Maxime Ripard  wrote:
>
> On Tue, Oct 29, 2019 at 04:03:56AM +0530, Jagan Teki wrote:
> > > > explicit handling of common clock would require since the A64
> > > > doesn't need to mention the clock-names explicitly in dts since it
> > > > support only one bus clock.
> > > >
> > > > Also pass clk_id NULL instead "bus" to regmap clock init function
> > > > since the single clock variants no need to mention clock-names
> > > > explicitly.
> > >
> > > You don't need explicit clock handling. Passing NULL as the argument
> > > in regmap_init_mmio_clk will make it use the first clock, which is the
> > > bus clock.
> >
> > Indeed I tried that, since NULL clk_id wouldn't enable the bus clock
> > during regmap_mmio_gen_context code, passing NULL triggering vblank
> > timeout.
>
> There's a bunch of users of NULL in tree, so finding out why NULL
> doesn't work is the way forward.

I'd have looked the some of the users before checking the code as
well. As I said passing NULL clk_id to devm_regmap_init_mmio_clk =>
__devm_regmap_init_mmio_clk would return before processing the clock.

Here is the code snippet on the tree just to make sure I'm on the same
page or not.

static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev,
const char *clk_id,
void __iomem *regs,
const struct regmap_config *config)
{
---
--
if (clk_id == NULL)
return ctx;

ctx->clk = clk_get(dev, clk_id);
if (IS_ERR(ctx->clk)) {
ret = PTR_ERR(ctx->clk);
goto err_free;
}

ret = clk_prepare(ctx->clk);
if (ret < 0) {
clk_put(ctx->clk);
goto err_free;
}
-
---
}

Yes, I did check on the driver in the tree before committing explicit
clock handle, which make similar requirements like us in [1]. this
imx2 wdt driver is handling the explicit clock as well. I'm sure this
driver is updated as I have seen few changes related to this driver in
ML.

Let me know if I still miss any key change or note here, I will dig
further on this for sure.

[1] 
https://elixir.bootlin.com/linux/v5.4-rc4/source/drivers/watchdog/imx2_wdt.c#L264

thanks,
Jagan.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 1/2] drm: Add support for DP 1.4 Compliance edid corruption test 4.2.2.6

2019-11-01 Thread Jani Nikula
On Wed, 30 Oct 2019, "Jerry (Fangzhi) Zuo"  wrote:
> DP 1.4 edid corruption test requires source DUT to write calculated
> CRC, not the corrupted CRC from reference sink.
>
> Return the calculated CRC back, and initiate the required sequence.
>
> Signed-off-by: Jerry (Fangzhi) Zuo 
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 36 
>  drivers/gpu/drm/drm_edid.c  | 15 ---
>  include/drm/drm_connector.h |  7 +++
>  include/drm/drm_dp_helper.h |  3 +++
>  4 files changed, 58 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index ffc68d305afe..75dbd30c62a7 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -336,6 +336,42 @@ int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
>  }
>  EXPORT_SYMBOL(drm_dp_dpcd_read_link_status);
>  
> +/**
> +  * drm_dp_send_bad_edid_checksum() - send back real edid checksum value
> +  * @aux: DisplayPort AUX channel
> +  * @bad_edid_checksum: real edid checksum for the last block
> +  *
> +  * Returns true on success
> +  */
> +bool drm_dp_send_bad_edid_checksum(struct drm_dp_aux *aux,
> +u8 bad_edid_checksum)
> +{
> +u8 link_edid_read = 0, auto_test_req = 0;
> +u8 test_resp = 0;
> +
> +drm_dp_dpcd_read(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, _test_req, 
> 1);
> +auto_test_req &= DP_AUTOMATED_TEST_REQUEST;
> +
> +drm_dp_dpcd_read(aux, DP_TEST_REQUEST, _edid_read, 1);
> +link_edid_read &= DP_TEST_LINK_EDID_READ;
> +
> +if (!auto_test_req || !link_edid_read) {
> +DRM_DEBUG_KMS("Source DUT does not support 
> TEST_EDID_READ\n");
> +return false;
> +}
> +
> +drm_dp_dpcd_write(aux, DP_DEVICE_SERVICE_IRQ_VECTOR, _test_req, 
> 1);
> +
> +/* send back checksum for the last edid extension block data */
> +drm_dp_dpcd_write(aux, DP_TEST_EDID_CHECKSUM, _edid_checksum, 1);
> +
> +test_resp |= DP_TEST_EDID_CHECKSUM_WRITE;
> +drm_dp_dpcd_write(aux, DP_TEST_RESPONSE, _resp, 1);
> +
> +return true;
> +}
> +EXPORT_SYMBOL(drm_dp_send_bad_edid_checksum);
> +
>  /**
>   * drm_dp_link_probe() - probe a DisplayPort link for capabilities
>   * @aux: DisplayPort AUX channel
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 82a4ceed3fcf..400064dcc010 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1344,13 +1344,19 @@ static void drm_get_displayid(struct drm_connector 
> *connector,
> struct edid *edid);
>  static int validate_displayid(u8 *displayid, int length, int idx);
>  
> -static int drm_edid_block_checksum(const u8 *raw_edid)
> +static int drm_edid_block_checksum(const u8 *raw_edid, bool c)
>  {
>   int i;
>   u8 csum = 0;
> - for (i = 0; i < EDID_LENGTH; i++)
> + u8 len;
> +
> + len = c ? EDID_LENGTH : (EDID_LENGTH - 1);
> +
> + for (i = 0; i < len; i++)
>   csum += raw_edid[i];
>  
> + csum = c ? csum : (0x100 - csum);
> +
>   return csum;
>  }

I think a mysterious boolean 'c' argument just makes this more
confusing.

Please split the function to two, one that calculates the checksum (c ==
false case) and another that uses the function (c == true case). The
latter would return the same value as the above.

Please do this as a prep patch without any of the other modifications.

BR,
Jani.



>  
> @@ -1408,7 +1414,7 @@ bool drm_edid_block_valid(u8 *raw_edid, int block, bool 
> print_bad_edid,
>   }
>   }
>  
> - csum = drm_edid_block_checksum(raw_edid);
> + csum = drm_edid_block_checksum(raw_edid, true);
>   if (csum) {
>   if (edid_corrupt)
>   *edid_corrupt = true;
> @@ -1572,6 +1578,9 @@ static void connector_bad_edid(struct drm_connector 
> *connector,
>  prefix, DUMP_PREFIX_NONE, 16, 1,
>  block, EDID_LENGTH, false);
>   }
> +
> + /* Calculate real checksum for the last edid extension block data */
> + connector->bad_edid_checksum = drm_edid_block_checksum(edid + 
> edid[0x7e] * EDID_LENGTH, false);
>  }
>  
>  /* Get override or firmware EDID */
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 681cb590f952..8442461542b9 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -1345,6 +1345,13 @@ struct drm_connector {
>* rev1.1 4.2.2.6
>*/
>   bool edid_corrupt;
> + /**
> + * @bad_edid_checksum: real edid checksum value for corrupted edid 
> block.
> + * Required in Displayport 1.4 compliance testing
> + * rev1.1 4.2.2.6
> + */
> +uint8_t bad_edid_checksum;
> +
>  
>   /** @debugfs_entry: debugfs directory for this connector */
>   struct dentry *debugfs_entry;
> 

[Bug 112192] regression: modesetting does not work with my Radeon R5 230

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=112192

--- Comment #7 from Elmar Stellnberger  ---
Created attachment 145869
  --> https://bugs.freedesktop.org/attachment.cgi?id=145869=edit
dmesg from another boot with the same Debian Live CD

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Bug 112192] regression: modesetting does not work with my Radeon R5 230

2019-11-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=112192

Michel Dänzer  changed:

   What|Removed |Added

Product|xorg|DRI
  Component|Driver/AMDgpu   |DRM/AMDgpu
 QA Contact|xorg-t...@lists.x.org   |
   Assignee|xorg-driver-...@lists.x.org |dri-devel@lists.freedesktop
   ||.org

--- Comment #6 from Michel Dänzer  ---
> [  2141.996] (II) AMDGPU(0): [KMS] drm report modesetting isn't supported.

means the amdgpu kernel driver didn't initialize. Please attach the output of
dmesg.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 4/5] drm/panfrost: remove DRM_AUTH and respective comment

2019-11-01 Thread Steven Price
On 01/11/2019 13:03, Emil Velikov wrote:
> From: Emil Velikov 
> 
> As of earlier commit we have address space separation. Yet we forgot to
> remove the respective comment and DRM_AUTH in the ioctl declaration.
> 
> Cc: Tomeu Vizoso 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Robin Murphy 
> Cc: Steven Price 
> Fixes: 7282f7645d06 ("drm/panfrost: Implement per FD address spaces")
> Signed-off-by: Emil Velikov 

Reviewed-by: Steven Price 

I'm not sure DRM_AUTH provided us with much in the first place (because
render nodes could snoop/affect the primary node), but since we have
address space separation it's clearly not required now.

Steve

> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c 
> b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index bc2ddeb55f5d..c677b2c9e409 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -451,15 +451,11 @@ panfrost_postclose(struct drm_device *dev, struct 
> drm_file *file)
>   kfree(panfrost_priv);
>  }
>  
> -/* DRM_AUTH is required on SUBMIT for now, while all clients share a single
> - * address space.  Note that render nodes would be able to submit jobs that
> - * could access BOs from clients authenticated with the master node.
> - */
>  static const struct drm_ioctl_desc panfrost_drm_driver_ioctls[] = {
>  #define PANFROST_IOCTL(n, func, flags) \
>   DRM_IOCTL_DEF_DRV(PANFROST_##n, panfrost_ioctl_##func, flags)
>  
> - PANFROST_IOCTL(SUBMIT,  submit, DRM_RENDER_ALLOW | 
> DRM_AUTH),
> + PANFROST_IOCTL(SUBMIT,  submit, DRM_RENDER_ALLOW),
>   PANFROST_IOCTL(WAIT_BO, wait_bo,DRM_RENDER_ALLOW),
>   PANFROST_IOCTL(CREATE_BO,   create_bo,  DRM_RENDER_ALLOW),
>   PANFROST_IOCTL(MMAP_BO, mmap_bo,DRM_RENDER_ALLOW),
> 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/mediatek: Support reflect-y plane rotation

2019-11-01 Thread Sean Paul
From: Sean Paul 

Expose the rotation property and handle REFLECT_Y rotations.

Cc: Fritz Koenig 
Cc: Daniele Castagna 
Cc: Miguel Casas 
Cc: Mark Yacoub 
Signed-off-by: Sean Paul 
---

The hardware also supports REFLECT_X, but I just could not figure out
how to get it working. If someone is interested in getting this going,
I'm happy to share notes and my WIP patch. For now, though, I actually
only need y-flip so I'm giving up on x-flip.


 drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  6 ++
 drivers/gpu/drm/mediatek/mtk_drm_plane.c | 11 ++-
 drivers/gpu/drm/mediatek/mtk_drm_plane.h |  1 +
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c 
b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
index 14878ebf59d7..6505479ee506 100644
--- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
+++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
@@ -50,6 +50,7 @@
OVL_CON_CLRFMT_RGB : 0)
 #defineOVL_CON_AEN BIT(8)
 #defineOVL_CON_ALPHA   0xff
+#defineOVL_CON_VIRT_FLIP   BIT(9)
 
 struct mtk_disp_ovl_data {
unsigned int addr;
@@ -229,6 +230,11 @@ static void mtk_ovl_layer_config(struct mtk_ddp_comp 
*comp, unsigned int idx,
if (idx != 0)
con |= OVL_CON_AEN | OVL_CON_ALPHA;
 
+   if (pending->rotation & DRM_MODE_REFLECT_Y) {
+   con |= OVL_CON_VIRT_FLIP;
+   addr += (pending->height - 1) * pending->pitch;
+   }
+
writel_relaxed(con, comp->regs + DISP_REG_OVL_CON(idx));
writel_relaxed(pitch, comp->regs + DISP_REG_OVL_PITCH(idx));
writel_relaxed(src_size, comp->regs + DISP_REG_OVL_SRC_SIZE(idx));
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c 
b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
index 584a9ecadce6..4d8f2b55334b 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
@@ -88,6 +88,9 @@ static int mtk_plane_atomic_check(struct drm_plane *plane,
if (!fb)
return 0;
 
+   if (fb->format->is_yuv && (state->rotation & ~DRM_MODE_ROTATE_0) != 0)
+   return -EINVAL;
+
if (!state->crtc)
return 0;
 
@@ -132,6 +135,7 @@ static void mtk_plane_atomic_update(struct drm_plane *plane,
state->pending.y = plane->state->dst.y1;
state->pending.width = drm_rect_width(>state->dst);
state->pending.height = drm_rect_height(>state->dst);
+   state->pending.rotation = plane->state->rotation;
wmb(); /* Make sure the above parameters are set before update */
state->pending.dirty = true;
 }
@@ -166,7 +170,12 @@ int mtk_plane_init(struct drm_device *dev, struct 
drm_plane *plane,
return err;
}
 
-   drm_plane_helper_add(plane, _plane_helper_funcs);
+   err = drm_plane_create_rotation_property(plane, 0,
+DRM_MODE_ROTATE_0 |
+DRM_MODE_REFLECT_Y);
+   if (err)
+   DRM_INFO("Create rotation property failed, continuing...\n");
 
+   drm_plane_helper_add(plane, _plane_helper_funcs);
return 0;
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.h 
b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
index 6f842df722c7..83b634a997cc 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
@@ -20,6 +20,7 @@ struct mtk_plane_pending_state {
unsigned inty;
unsigned intwidth;
unsigned intheight;
+   unsigned introtation;
booldirty;
 };
 
-- 
Sean Paul, Software Engineer, Google / Chromium OS

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 1/5] drm/vmwgfx: move the require_exist handling together

2019-11-01 Thread Emil Velikov
From: Emil Velikov 

Move the render_client hunk for require_exist alongside the rest.
Keeping all the reasons why an existing object is needed, in a single
place makes it easier to follow.

Cc: VMware Graphics 
Cc: Thomas Hellstrom 
Signed-off-by: Emil Velikov 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 29d8794f0421..1f989f3605c8 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -909,16 +909,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
uint32_t handle;
struct ttm_base_object *base;
int ret;
-   bool require_exist = false;
 
if (handle_type == DRM_VMW_HANDLE_PRIME) {
ret = ttm_prime_fd_to_handle(tfile, u_handle, );
if (unlikely(ret != 0))
return ret;
} else {
-   if (unlikely(drm_is_render_client(file_priv)))
-   require_exist = true;
-
handle = u_handle;
}
 
@@ -935,6 +931,8 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
}
 
if (handle_type != DRM_VMW_HANDLE_PRIME) {
+   bool require_exist = false;
+
user_srf = container_of(base, struct vmw_user_surface,
prime.base);
 
@@ -946,6 +944,9 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
user_srf->master != file_priv->master)
require_exist = true;
 
+   if (unlikely(drm_is_render_client(file_priv)))
+   require_exist = true;
+
ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL,
 require_exist);
if (unlikely(ret != 0)) {
-- 
2.23.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 5/5] drm: drop DRM_AUTH from PRIME_TO/FROM_HANDLE ioctls

2019-11-01 Thread Emil Velikov
From: Emil Velikov 

As mentioned by Christian, for drivers which support only primary nodes
this changes the returned error from -EACCES into -EOPNOTSUPP/-ENOSYS.

For others, this check in particular will be a noop. So let's remove it
as suggested by Christian.

Cc: Alex Deucher 
Cc: amd-...@lists.freedesktop.org
Cc: Daniel Vetter 
Cc: Sean Paul 
Acked-by: Christian König 
Signed-off-by: Emil Velikov 
---
 drivers/gpu/drm/drm_ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index fcd728d7cf72..5afb39688b55 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -652,8 +652,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 
DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, 0),
 
-   DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, 
drm_prime_handle_to_fd_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
-   DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, 
drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, 
drm_prime_handle_to_fd_ioctl, DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, 
drm_prime_fd_to_handle_ioctl, DRM_RENDER_ALLOW),
 
DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, 
0),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, 0),
-- 
2.23.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 3/5] drm/vmwgfx: drop DRM_AUTH for render ioctls

2019-11-01 Thread Emil Velikov
From: Emil Velikov 

With earlier commit 9c84aeba67cc ("drm/vmwgfx: Kill unneeded legacy
security features") we removed the no longer applicable validation, as
we now have isolation of primary clients from different master realms.

As of last commit, we're explicitly checking for authentication in the
only render ioctls which care about one.

With those in place, the DRM_AUTH token serves no real purpose. Let's
drop it.

Cc: VMware Graphics 
Cc: Thomas Hellstrom 
Signed-off-by: Emil Velikov 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 81a95651643f..253fae160175 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -165,9 +165,9 @@
 
 static const struct drm_ioctl_desc vmw_ioctls[] = {
VMW_IOCTL_DEF(VMW_GET_PARAM, vmw_getparam_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_ALLOC_DMABUF, vmw_bo_alloc_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_UNREF_DMABUF, vmw_bo_unref_ioctl,
  DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_CURSOR_BYPASS,
@@ -182,16 +182,16 @@ static const struct drm_ioctl_desc vmw_ioctls[] = {
  DRM_MASTER),
 
VMW_IOCTL_DEF(VMW_CREATE_CONTEXT, vmw_context_define_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_UNREF_CONTEXT, vmw_context_destroy_ioctl,
  DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_CREATE_SURFACE, vmw_surface_define_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_UNREF_SURFACE, vmw_surface_destroy_ioctl,
  DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_REF_SURFACE, vmw_surface_reference_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
-   VMW_IOCTL_DEF(VMW_EXECBUF, vmw_execbuf_ioctl, DRM_AUTH |
+ DRM_RENDER_ALLOW),
+   VMW_IOCTL_DEF(VMW_EXECBUF, vmw_execbuf_ioctl,
  DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_FENCE_WAIT, vmw_fence_obj_wait_ioctl,
  DRM_RENDER_ALLOW),
@@ -201,9 +201,9 @@ static const struct drm_ioctl_desc vmw_ioctls[] = {
VMW_IOCTL_DEF(VMW_FENCE_UNREF, vmw_fence_obj_unref_ioctl,
  DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_FENCE_EVENT, vmw_fence_event_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_GET_3D_CAP, vmw_get_cap_3d_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
 
/* these allow direct access to the framebuffers mark as master only */
VMW_IOCTL_DEF(VMW_PRESENT, vmw_present_ioctl,
@@ -221,28 +221,28 @@ static const struct drm_ioctl_desc vmw_ioctls[] = {
  DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_CREATE_SHADER,
  vmw_shader_define_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_UNREF_SHADER,
  vmw_shader_destroy_ioctl,
  DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_GB_SURFACE_CREATE,
  vmw_gb_surface_define_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_GB_SURFACE_REF,
  vmw_gb_surface_reference_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_SYNCCPU,
  vmw_user_bo_synccpu_ioctl,
  DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_CREATE_EXTENDED_CONTEXT,
  vmw_extended_context_define_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_GB_SURFACE_CREATE_EXT,
  vmw_gb_surface_define_ext_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
VMW_IOCTL_DEF(VMW_GB_SURFACE_REF_EXT,
  vmw_gb_surface_reference_ext_ioctl,
- DRM_AUTH | DRM_RENDER_ALLOW),
+ DRM_RENDER_ALLOW),
 };
 
 static const struct pci_device_id vmw_pci_id_list[] = {
-- 
2.23.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 4/5] drm/panfrost: remove DRM_AUTH and respective comment

2019-11-01 Thread Emil Velikov
From: Emil Velikov 

As of earlier commit we have address space separation. Yet we forgot to
remove the respective comment and DRM_AUTH in the ioctl declaration.

Cc: Tomeu Vizoso 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Robin Murphy 
Cc: Steven Price 
Fixes: 7282f7645d06 ("drm/panfrost: Implement per FD address spaces")
Signed-off-by: Emil Velikov 
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c 
b/drivers/gpu/drm/panfrost/panfrost_drv.c
index bc2ddeb55f5d..c677b2c9e409 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -451,15 +451,11 @@ panfrost_postclose(struct drm_device *dev, struct 
drm_file *file)
kfree(panfrost_priv);
 }
 
-/* DRM_AUTH is required on SUBMIT for now, while all clients share a single
- * address space.  Note that render nodes would be able to submit jobs that
- * could access BOs from clients authenticated with the master node.
- */
 static const struct drm_ioctl_desc panfrost_drm_driver_ioctls[] = {
 #define PANFROST_IOCTL(n, func, flags) \
DRM_IOCTL_DEF_DRV(PANFROST_##n, panfrost_ioctl_##func, flags)
 
-   PANFROST_IOCTL(SUBMIT,  submit, DRM_RENDER_ALLOW | 
DRM_AUTH),
+   PANFROST_IOCTL(SUBMIT,  submit, DRM_RENDER_ALLOW),
PANFROST_IOCTL(WAIT_BO, wait_bo,DRM_RENDER_ALLOW),
PANFROST_IOCTL(CREATE_BO,   create_bo,  DRM_RENDER_ALLOW),
PANFROST_IOCTL(MMAP_BO, mmap_bo,DRM_RENDER_ALLOW),
-- 
2.23.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 2/5] drm/vmwgfx: check master authentication in surface_ref ioctls

2019-11-01 Thread Emil Velikov
From: Emil Velikov 

With later commit we'll rework DRM authentication handling. Namely
DRM_AUTH will not be a requirement for DRM_RENDER_ALLOW ioctls.

Since vmwgfx does isolation for primary clients in different master
realms, the DRM_AUTH can be dropped.

The only place where authentication matters, is surface_reference ioctls
whenever a legacy (non-prime) handle is used. For those ioctls we call
vmw_surface_handle_reference(), where we explicitly check if the client
is both a) master and b) unauthenticated - bailing out as result.

Otherwise the usual isolation path kicks in and we're all good.

v2: Reword commit message, since the isolation work has landed.

Cc: VMware Graphics 
Cc: Thomas Hellstrom 
Signed-off-by: Emil Velikov 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 1f989f3605c8..596e5c1bc2c1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -936,6 +936,13 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
user_srf = container_of(base, struct vmw_user_surface,
prime.base);
 
+   /* Error out if we are unauthenticated master */
+   if (drm_is_primary_client(file_priv) &&
+   !file_priv->authenticated) {
+   ret = -EACCES;
+   goto out_bad_resource;
+   }
+
/*
 * Make sure the surface creator has the same
 * authenticating master, or is already registered with us.
-- 
2.23.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2071/2647] include/kcl/kcl_list.h:6:20: error: redefinition of 'list_bulk_move_tail'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: 034972ea50d821bd2596276c956b39f0ed9ca2dd [2071/2647] drm/amdkcl: Test 
whether list_bulk_move_tail() is available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 034972ea50d821bd2596276c956b39f0ed9ca2dd
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_drv.h:739:6: note: previous declaration of 'drm_dev_put' was 
here
void drm_dev_put(struct drm_device *dev);
 ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'drm_dev_put':
   include/kcl/kcl_drm.h:539:9: error: implicit declaration of function 
'drm_dev_unref'; did you mean 'drm_dev_enter'? 
[-Werror=implicit-function-declaration]
 return drm_dev_unref(dev);
^
drm_dev_enter
   include/kcl/kcl_drm.h:539:9: warning: 'return' with a value, in function 
returning void
 return drm_dev_unref(dev);
^~
   include/kcl/kcl_drm.h:537:20: note: declared here
static inline void drm_dev_put(struct drm_device *dev)
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h: At top level:
   include/kcl/kcl_mm.h:65:21: error: redefinition of 'kvmalloc'
static inline void *kvmalloc(size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:635:21: note: previous definition of 'kvmalloc' was here
static inline void *kvmalloc(size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:75:21: error: redefinition of 'kvzalloc'
static inline void *kvzalloc(size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:643:21: note: previous definition of 'kvzalloc' was here
static inline void *kvzalloc(size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:85:20: error: static declaration of 'kvfree' follows 
non-static declaration
static inline void kvfree(const void *addr)
   ^~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:663:13: note: previous declaration of 'kvfree' was here
extern void kvfree(const void *addr);
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:105:21: error: redefinition of 'kvmalloc_array'
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:648:21: note: previous definition of 'kvmalloc_array' was 
here
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:8:0,
from :0:
   include/kcl/kcl_mm.h:118:21: error: redefinition of 'kvcalloc'
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
^~~~
   In file included from include/drm/drm_vma_manager.h:27:0,
from include/kcl/kcl_drm_vma_manager.h:8,
from drivers/gpu/drm/ttm/backport/backport.h:5,
from :0:
   include/linux/mm.h:658:21: note: previous definition of 'kvcalloc' was here
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:9:0,
   

[drm-intel:drm-intel-next-queued 2/2] drivers/gpu/drm/i915/i915_perf.c:2442:85: sparse: sparse: dubious: x | !y

2019-11-01 Thread kbuild test robot
tree:   git://anongit.freedesktop.org/drm-intel drm-intel-next-queued
head:   00a7f0d7155c28ab18600bcf3f62d7cade2a870d
commit: 00a7f0d7155c28ab18600bcf3f62d7cade2a870d [2/2] drm/i915/tgl: Add perf 
support on TGL
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-dirty
git checkout 00a7f0d7155c28ab18600bcf3f62d7cade2a870d
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 


sparse warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/i915/i915_perf.c:2442:85: sparse: sparse: dubious: x | !y

vim +2442 drivers/gpu/drm/i915/i915_perf.c

  2430  
  2431  static int gen12_enable_metric_set(struct i915_perf_stream *stream)
  2432  {
  2433  struct intel_uncore *uncore = stream->uncore;
  2434  struct i915_oa_config *oa_config = stream->oa_config;
  2435  bool periodic = stream->periodic;
  2436  u32 period_exponent = stream->period_exponent;
  2437  int ret;
  2438  
  2439  intel_uncore_write(uncore, GEN12_OAG_OA_DEBUG,
  2440 /* Disable clk ratio reports, like previous 
Gens. */
  2441 
_MASKED_BIT_ENABLE(GEN12_OAG_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS |
> 2442
> GEN12_OAG_OA_DEBUG_INCLUDE_CLK_RATIO) |
  2443 /*
  2444  * If the user didn't require OA reports, 
instruct the
  2445  * hardware not to emit ctx switch reports.
  2446  */
  2447 !(stream->sample_flags & SAMPLE_OA_REPORT) ?
  2448 
_MASKED_BIT_ENABLE(GEN12_OAG_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS) :
  2449 
_MASKED_BIT_DISABLE(GEN12_OAG_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS));
  2450  
  2451  intel_uncore_write(uncore, GEN12_OAG_OAGLBCTXCTRL, periodic ?
  2452 (GEN12_OAG_OAGLBCTXCTRL_COUNTER_RESUME |
  2453  GEN12_OAG_OAGLBCTXCTRL_TIMER_ENABLE |
  2454  (period_exponent << 
GEN12_OAG_OAGLBCTXCTRL_TIMER_PERIOD_SHIFT))
  2455  : 0);
  2456  
  2457  /*
  2458   * Update all contexts prior writing the mux configurations as 
we need
  2459   * to make sure all slices/subslices are ON before writing to 
NOA
  2460   * registers.
  2461   */
  2462  ret = lrc_configure_all_contexts(stream, oa_config);
  2463  if (ret)
  2464  return ret;
  2465  
  2466  /*
  2467   * For Gen12, performance counters are context
  2468   * saved/restored. Only enable it for the context that
  2469   * requested this.
  2470   */
  2471  if (stream->ctx) {
  2472  ret = gen12_emit_oar_config(stream->pinned_ctx,
  2473  oa_config != NULL);
  2474  if (ret)
  2475  return ret;
  2476  }
  2477  
  2478  return emit_oa_config(stream, oa_config, oa_context(stream));
  2479  }
  2480  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 2055/2647] include/kcl/kcl_drm.h:571:20: error: static declaration of 'drm_dev_put' follows non-static declaration

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: 8d660d16d64cb75fab00f3e78409a93394cb7d29 [2055/2647] drm/amdkcl: Test 
whether drm_dev_put is available
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 8d660d16d64cb75fab00f3e78409a93394cb7d29
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_plane.h:713:5: note: declared here
int drm_universal_plane_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_gem_object_lookup':
   include/kcl/kcl_drm.h:260:32: error: passing argument 1 of 
'drm_gem_object_lookup' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  return drm_gem_object_lookup(dev, filp, handle);
   ^~~
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: expected 'struct drm_file *' but 
argument is of type 'struct drm_device *'
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:260:37: warning: passing argument 2 of 
'drm_gem_object_lookup' makes integer from pointer without a cast 
[-Wint-conversion]
  return drm_gem_object_lookup(dev, filp, handle);
^~~~
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: expected 'u32 {aka unsigned int}' but 
argument is of type 'struct drm_file *'
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:260:10: error: too many arguments to function 
'drm_gem_object_lookup'
  return drm_gem_object_lookup(dev, filp, handle);
 ^
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: declared here
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: At top level:
   include/kcl/kcl_drm.h:303:8: error: redefinition of 'struct 
drm_format_name_buf'
struct drm_format_name_buf {
   ^~~
   In file included from include/drm/drmP.h:69:0,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_fourcc.h:142:8: note: originally defined here
struct drm_format_name_buf {
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_gem_object_put_unlocked':
   include/kcl/kcl_drm.h:335:9: error: implicit declaration of function 
'drm_gem_object_unreference_unlocked'; did you mean 
'drm_gem_object_put_unlocked'? [-Werror=implicit-function-declaration]
 return drm_gem_object_unreference_unlocked(obj);
^~~
drm_gem_object_put_unlocked
   include/kcl/kcl_drm.h:335:9: warning: 'return' with a value, in function 
returning void
 return drm_gem_object_unreference_unlocked(obj);
^~~~
   include/kcl/kcl_drm.h:332:20: note: declared here
static inline void kcl_drm_gem_object_put_unlocked(struct drm_gem_object 
*obj)
   ^~~
   include/kcl/kcl_drm.h: In function 
'kcl_drm_atomic_get_old_crtc_state_before_commit':
   include/kcl/kcl_drm.h:359:43: error: invalid type argument of '->' (have 
'struct __drm_crtcs_state')
 return state->crtcs[drm_crtc_index(crtc)]->state;
  ^~
   include/kcl/kcl_drm.h: In function 
'kcl_drm_atomic_get_new_crtc_state_after_commit':
   include/kcl/kcl_drm.h:394:43: error: invalid type 

[PULL] drm-intel-next

2019-11-01 Thread Joonas Lahtinen
_lrc.c (Tvrtko)
- Describe perf/wakeref structure members in documentation (Anna)
- Update renamed header files names in documentation (Anna)
- Add debugs to distingiush a cd2x update from a full cdclk pll update (Ville)
- Rework atomic global state locking (Ville)
- Allow planes to declare their minimum acceptable cdclk (Ville)
- Eliminate skl_check_pipe_max_pixel_rate() and simplify skl_max_scale() (Ville)
- Making loglevel of PSR2/SU logs same (Ap)
- Capture aux page table error register (Lionel)
- Add is_dgfx to device info (Jose)
- Split gen11_irq_handler to make it shareable (Lucas)
- Encapsulate kconfig constant values inside boolean predicates (Chris)
- Split memory_region initialisation into its own file (Chris)
- Use _PICK() for CHICKEN_TRANS() and add CHICKEN_TRANS_D (Ville)
- Add perf helper macros for comparing with whitelisted registers (Umesh)
- Fix i915_inject_load_error() name to read *_probe_* (Janusz)
- Drop unused AUX register offsets (Matt R)
- Provide more information on DP AUX failures (Matt R)
- Add GAM/SFC instdone to error state (Mika)
- Always track callers to intel_rps_mark_interactive() (Chris)
- Nuke 'mode' argument to intel_get_load_detect_pipe() (Ville)
- Simplify LVDS crtc_mask and pipe_mask setup (Ville)
- Stop frobbing crtc->base.mode (Ville)
- Do s/crtc_mask/pipe_mask/ (Ville)
- Split detaching and removing the vma (Chris)

- Selftest improvements (Chris, Tvrtko, Mika, Matt A, Lionel)
- GuC code improvements (Rob, Andi, Daniele)

The following changes since commit ce53908bba6fa6e905d8fe81da4591d3e7a65878:

  drm/i915: Update DRIVER_DATE to 20191021 (2019-10-21 12:56:07 +0300)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-next-2019-11-01-1

for you to fetch changes up to 1883e2999f045e1fd6f76a7f30288a5312085289:

  drm/i915: Update DRIVER_DATE to 20191101 (2019-11-01 12:41:13 +0200)


Driver Changes:

- Check against i915_selftest only under CONFIG_SELFTEST (Chris)
- Refine occupancy test in kill_context() (Chris)
- Start kthreads before stopping (Chris)


Abdiel Janulgue (2):
  drm/i915: setup io-mapping for LMEM
  drm/i915/lmem: support kernel mapping

Andi Shyti (2):
  drm/i915: Extract GT render power state management
  drm/i915: Extract the GuC interrupt handlers

Anna Karas (4):
  drm/i915/perf: Describe structure members in documentation
  doc: Update header files names
  drm/i915: Describe structure member in documentation
  drm/i915/tgl: Fix doc not corresponding to code

Ap Kamal (1):
  drm/i915: Making loglevel of PSR2/SU logs same.

Chris Wilson (52):
  drm/i915: Don't set queue_priority_hint if we don't kick the submission
  drm/i915/selftests: Use all physical engines for i915_active
  drm/i915/gt: Introduce barrier pulses along engines
  drm/i915: Lift i915_vma_parked() onto the gt
  drm/i915: Remove pm park/unpark notifications
  drm/i915/selftests: Set vm->gt backpointer for mock_ppgtt
  drm/i915/selftests: Make the mman object busy everywhere
  drm/i915: Drop assertion that ce->pin_mutex guards state updates
  drm/i915/gem: Distinguish each object type
  drm/i915: Teach record_defaults to operate on the intel_gt
  drm/i915/selftests: Teach switch_to_context() to use the context
  drm/i915/selftests: Move uncore fw selftests to operate on intel_gt
  drm/i915/selftests: Synchronize checking active status with retirement
  drm/i915/selftests: Release ctx->engine_mutex after iteration
  drm/i915/gt: Try to more gracefully quiesce the system before resets
  drm/i915/execlists: Force preemption
  drm/i915/execlists: Cancel banned contexts on schedule-out
  drm/i915/gem: Cancel contexts when hangchecking is disabled
  drm/i915/gt: Replace hangcheck by heartbeats
  drm/i915/selftests: Flush interrupts before disabling tasklets
  drm/i915/selftests: Flush any i915_active callback work as well
  drm/i915/gt: Split intel_ring_submission
  drm/i915/selftests: Tweak the default subtest runtime
  drm/i915/selftests: Force ordering of context switches
  drm/i915/pmu: Initialise the spinlock before registering
  drm/i915: Encapsulate kconfig constant values inside boolean predicates
  drm/i915/tgl: Adjust the location of RING_MI_MODE in the context image
  drm/i915: Split memory_region initialisation into its own file
  drm/i915: Put future HW and their uAPIs under STAGING & BROKEN
  drm/i915/rps: Flip interpretation of ips fmin/fmax to max rps
  drm/i915/selftests: Measure basic throughput of blit routines
  drm/i915/selftests: Drop global engine lookup for gt selftests
  drm/i915/selftests: Check all blitter engines for client blt
  drm/i915/selftests: Use a random engine for GEM coherency tests
  drm/i91

[radeon-alex:amd-mainline-dkms-5.2 2031/2647] include/kcl/kcl_mm.h:60:21: error: redefinition of 'kvmalloc'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: f12f9b802b6dd80fdee0b7c601b8b9d59a967556 [2031/2647] drm/amdkcl: Test 
if linux/overflow.h and struct_size exists
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout f12f9b802b6dd80fdee0b7c601b8b9d59a967556
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_plane.h:713:5: note: declared here
int drm_universal_plane_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_gem_object_lookup':
   include/kcl/kcl_drm.h:252:32: error: passing argument 1 of 
'drm_gem_object_lookup' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  return drm_gem_object_lookup(dev, filp, handle);
   ^~~
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: expected 'struct drm_file *' but 
argument is of type 'struct drm_device *'
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:252:37: warning: passing argument 2 of 
'drm_gem_object_lookup' makes integer from pointer without a cast 
[-Wint-conversion]
  return drm_gem_object_lookup(dev, filp, handle);
^~~~
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: expected 'u32 {aka unsigned int}' but 
argument is of type 'struct drm_file *'
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:252:10: error: too many arguments to function 
'drm_gem_object_lookup'
  return drm_gem_object_lookup(dev, filp, handle);
 ^
   In file included from include/kcl/kcl_drm.h:9:0,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_gem.h:386:24: note: declared here
struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 
handle);
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: At top level:
   include/kcl/kcl_drm.h:295:8: error: redefinition of 'struct 
drm_format_name_buf'
struct drm_format_name_buf {
   ^~~
   In file included from include/drm/drmP.h:69:0,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_fourcc.h:142:8: note: originally defined here
struct drm_format_name_buf {
   ^~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_gem_object_put_unlocked':
   include/kcl/kcl_drm.h:327:9: error: implicit declaration of function 
'drm_gem_object_unreference_unlocked'; did you mean 
'drm_gem_object_put_unlocked'? [-Werror=implicit-function-declaration]
 return drm_gem_object_unreference_unlocked(obj);
^~~
drm_gem_object_put_unlocked
   include/kcl/kcl_drm.h:327:9: warning: 'return' with a value, in function 
returning void
 return drm_gem_object_unreference_unlocked(obj);
^~~~
   include/kcl/kcl_drm.h:324:20: note: declared here
static inline void kcl_drm_gem_object_put_unlocked(struct drm_gem_object 
*obj)
   ^~~
   include/kcl/kcl_drm.h: In function 
'kcl_drm_atomic_get_old_crtc_state_before_commit':
   include/kcl/kcl_drm.h:351:43: error: invalid type argument of '->' (have 
'struct __drm_crtcs_state')
 return state->crtcs[drm_crtc_index(crtc)]->state;
  ^~
   include/kcl/kcl_drm.h: In function 
'kcl_drm_atomic_get_new_crtc_state_after_commit':
   include/kcl/kcl_drm.h:386:43: error: 

[radeon-alex:amd-mainline-dkms-5.2 2027/2647] include/kcl/kcl_fence.h:129:20: error: redefinition of 'dma_fence_set_error'

2019-11-01 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: c53ae0e01db63d1b142681add947781668e3319c [2027/2647] drm/amdkcl: drop 
kcl_dma_fence_set_error
config: x86_64-randconfig-g002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout c53ae0e01db63d1b142681add947781668e3319c
# save the attached .config to linux build tree
make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   In file included from drivers/gpu/drm/scheduler/backport/backport.h:5:0,
from :0:
   include/kcl/kcl_fence.h: In function 'kcl_fence_get_rcu_safe':
   include/kcl/kcl_fence.h:124:32: error: passing argument 1 of 
'dma_fence_get_rcu_safe' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 return dma_fence_get_rcu_safe(fencep);
   ^~
   In file included from include/kcl/kcl_fence.h:9:0,
from drivers/gpu/drm/scheduler/backport/backport.h:5,
from :0:
   include/linux/dma-fence.h:315:1: note: expected 'struct dma_fence **' but 
argument is of type 'struct fence **'
dma_fence_get_rcu_safe(struct dma_fence __rcu **fencep)
^~
   In file included from drivers/gpu/drm/scheduler/backport/backport.h:5:0,
from :0:
   include/kcl/kcl_fence.h:124:9: error: return from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 return dma_fence_get_rcu_safe(fencep);
^~
   include/kcl/kcl_fence.h: At top level:
>> include/kcl/kcl_fence.h:129:20: error: redefinition of 'dma_fence_set_error'
static inline void dma_fence_set_error(struct dma_fence *fence,
   ^~~
   In file included from include/kcl/kcl_fence.h:9:0,
from drivers/gpu/drm/scheduler/backport/backport.h:5,
from :0:
   include/linux/dma-fence.h:517:20: note: previous definition of 
'dma_fence_set_error' was here
static inline void dma_fence_set_error(struct dma_fence *fence,
   ^~~
   In file included from drivers/gpu/drm/scheduler/backport/backport.h:5:0,
from :0:
   include/kcl/kcl_fence.h: In function 'dma_fence_set_error':
>> include/kcl/kcl_fence.h:135:7: error: 'struct dma_fence' has no member named 
>> 'status'
 fence->status = error;
  ^~
   cc1: some warnings being treated as errors

vim +/dma_fence_set_error +129 include/kcl/kcl_fence.h

 3  
 4  #include 
 5  #if !defined(HAVE_DMA_FENCE_DEFINED)
 6  #include 
 7  #include 
 8  #else
   > 9  #include 
10  #include 
11  #endif
12  
13  #if !defined(HAVE_DMA_FENCE_DEFINED)
14  #define dma_fence_cb fence_cb
15  #define dma_fence_ops fence_ops
16  #define dma_fence_array fence_array
17  #define dma_fence fence
18  #define DMA_FENCE_TRACE FENCE_TRACE
19  #define DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT FENCE_FLAG_ENABLE_SIGNAL_BIT
20  #define DMA_FENCE_FLAG_SIGNALED_BIT FENCE_FLAG_SIGNALED_BIT
21  #define dma_fence_wait fence_wait
22  #define dma_fence_get fence_get
23  #define dma_fence_put fence_put
24  #define dma_fence_is_signaled fence_is_signaled
25  #define dma_fence_signal fence_signal
26  #define dma_fence_signal_locked fence_signal_locked
27  #define dma_fence_get_rcu fence_get_rcu
28  #define dma_fence_array_create fence_array_create
29  #define dma_fence_add_callback fence_add_callback
30  #define dma_fence_remove_callback fence_remove_callback
31  #define dma_fence_default_wait fence_default_wait
32  #define dma_fence_enable_sw_signaling fence_enable_sw_signaling
33  typedef struct fence kcl_fence_t;
34  typedef struct fence_ops kcl_fence_ops_t;
35  #endif
36  
37  #if !defined(HAVE_DMA_FENCE_DEFINED)
38  extern struct fence * _kcl_fence_get_rcu_safe(struct fence * __rcu 
*fencep);
39  extern u64 _kcl_fence_context_alloc(unsigned num);
40  extern void _kcl_fence_init(struct fence *fence, const struct fence_ops 
*ops,
41   spinlock_t *lock, u64 context, unsigned seqno);
42  extern signed long _kcl_fence_wait_timeout(struct fence *fence, bool 
intr,
43  signed long timeout);
44  #endif
45  
46  /* commit v4.5-rc3-715-gb47bcb93bbf2
47   * fall back to HAVE_DMA_FENCE_DEFINED check directly
48   * as it's hard to detect the implementation in kernel
49   */
50  #if !defined(HAVE_DMA_FENCE_DEFINED)
51  static inline bool dma_fence_is_later(struct dma_fence *f1, struct 
dma_fence *f2)
52  {
53  if (WARN_ON(f1->context != f2->context))
54  return false;
55  
56  return 

Re: [PATCH 01/12] memory: tegra: Add gr2d and gr3d to DRM IOMMU group

2019-11-01 Thread Thierry Reding
On Wed, Oct 30, 2019 at 06:05:48PM +0300, Dmitry Osipenko wrote:
> 28.10.2019 15:37, Thierry Reding пишет:
> > From: Thierry Reding 
> > 
> > All of the devices making up the Tegra DRM device want to share a single
> > IOMMU domain. Put them into a single group to allow them to do that.
> > 
> > Signed-off-by: Thierry Reding 
> > ---
> >  drivers/memory/tegra/tegra114.c | 10 ++
> >  drivers/memory/tegra/tegra124.c |  8 +---
> >  drivers/memory/tegra/tegra30.c  | 11 +++
> >  3 files changed, 18 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/memory/tegra/tegra114.c 
> > b/drivers/memory/tegra/tegra114.c
> > index ac8351b5beeb..48ef01c3ff90 100644
> > --- a/drivers/memory/tegra/tegra114.c
> > +++ b/drivers/memory/tegra/tegra114.c
> > @@ -909,16 +909,18 @@ static const struct tegra_smmu_swgroup 
> > tegra114_swgroups[] = {
> > { .name = "tsec",  .swgroup = TEGRA_SWGROUP_TSEC,  .reg = 0x294 
> > },
> >  };
> >  
> > -static const unsigned int tegra114_group_display[] = {
> > +static const unsigned int tegra114_group_drm[] = {
> > TEGRA_SWGROUP_DC,
> > TEGRA_SWGROUP_DCB,
> > +   TEGRA_SWGROUP_G2,
> > +   TEGRA_SWGROUP_NV,
> >  };
> >  
> >  static const struct tegra_smmu_group_soc tegra114_groups[] = {
> > {
> > -   .name = "display",
> > -   .swgroups = tegra114_group_display,
> > -   .num_swgroups = ARRAY_SIZE(tegra114_group_display),
> > +   .name = "drm",
> > +   .swgroups = tegra114_group_drm,
> > +   .num_swgroups = ARRAY_SIZE(tegra114_group_drm),
> > },
> >  };
> >  
> > diff --git a/drivers/memory/tegra/tegra124.c 
> > b/drivers/memory/tegra/tegra124.c
> > index 5d0ccb2be206..62b30b1b9677 100644
> > --- a/drivers/memory/tegra/tegra124.c
> > +++ b/drivers/memory/tegra/tegra124.c
> > @@ -974,16 +974,18 @@ static const struct tegra_smmu_swgroup 
> > tegra124_swgroups[] = {
> > { .name = "vi",.swgroup = TEGRA_SWGROUP_VI,.reg = 0x280 
> > },
> >  };
> >  
> > -static const unsigned int tegra124_group_display[] = {
> > +static const unsigned int tegra124_group_drm[] = {
> > TEGRA_SWGROUP_DC,
> > TEGRA_SWGROUP_DCB,
> > +   TEGRA_SWGROUP_GPU,
> > +   TEGRA_SWGROUP_VIC,
> >  };
> >  
> >  static const struct tegra_smmu_group_soc tegra124_groups[] = {
> > {
> > .name = "display",
> > -   .swgroups = tegra124_group_display,
> > -   .num_swgroups = ARRAY_SIZE(tegra124_group_display),
> > +   .swgroups = tegra124_group_drm,
> > +   .num_swgroups = ARRAY_SIZE(tegra124_group_drm),
> > },
> 
> The "display" -> "drm" group's renaming is missed for T124.

Good catch! Fixed now.

Thanks,
Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH -next] gpu: host1x: Fix compile test failure

2019-11-01 Thread Thierry Reding
On Thu, Oct 31, 2019 at 09:33:38PM +0800, Yuehaibing wrote:
> On 2019/10/31 6:26, Dmitry Osipenko wrote:
> > 30.10.2019 16:54, YueHaibing пишет:
> >> If IOMMU_SUPPORT is not set, but IOMMU_IOVA is m and
> >> COMPILE_TEST is y, building fails:
> >>
> >> drivers/gpu/host1x/dev.o: In function `host1x_remove':
> >> dev.c:(.text+0x624): undefined reference to `put_iova_domain'
> >> dev.c:(.text+0x624): relocation truncated to fit: R_AARCH64_CALL26 against 
> >> undefined symbol `put_iova_domain'
> >> dev.c:(.text+0x62c): undefined reference to `iova_cache_put'
> >> dev.c:(.text+0x62c): relocation truncated to fit: R_AARCH64_CALL26 against 
> >> undefined symbol `iova_cache_put'
> >>
> >> Select IOMMU_IOVA while COMPILE_TEST is set to fix this.
> >>
> >> Reported-by: Hulk Robot 
> >> Fixes: 52499a6ad2ae ("gpu: host1x: select IOMMU_IOVA")
> >> Signed-off-by: YueHaibing 
> >> ---
> >>  drivers/gpu/host1x/Kconfig | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/host1x/Kconfig b/drivers/gpu/host1x/Kconfig
> >> index cf987a3..354232d 100644
> >> --- a/drivers/gpu/host1x/Kconfig
> >> +++ b/drivers/gpu/host1x/Kconfig
> >> @@ -2,7 +2,7 @@
> >>  config TEGRA_HOST1X
> >>tristate "NVIDIA Tegra host1x driver"
> >>depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
> >> -  select IOMMU_IOVA if IOMMU_SUPPORT
> >> +  select IOMMU_IOVA if (IOMMU_SUPPORT || COMPILE_TEST)
> >>help
> >>  Driver for the NVIDIA Tegra host1x hardware.
> >>  
> >>
> > 
> > It should be better to unconditionally select IOMMU_IOVA here.
> > 
> > The same could be done for drivers/staging/media/tegra-vde/ and
> > drivers/gpu/host1x/, please see [1].
> 
> Yep, I will repost, thanks!

No need to resend, I already have patches for that.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/etnaviv: correct ETNA_MAX_PIPE define

2019-11-01 Thread Christian Gmeiner
etnaviv supports the following pipe types:

ETNA_PIPE_3D  0x00
ETNA_PIPE_2D  0x01
ETNA_PIPE_VG  0x02

The current used value of 4 for ETNA_MAX_PIPES is wrong and
caueses some troubles in the combination with perf counters.

Lets have a look at the function etnaviv_pm_query_dom(..):
If domain->pipe is 3 then we are one element beyond the end
of the array.

The easiest way to fix this issue is to provide a correct value
for ETNA_MAX_PIPES.

Reported-by: Dan Carpenter 
Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver")
Cc: sta...@vger.kernel.org
Signed-off-by: Christian Gmeiner 
---
 include/uapi/drm/etnaviv_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/drm/etnaviv_drm.h b/include/uapi/drm/etnaviv_drm.h
index 09d0df8b71c5..5a62228298d1 100644
--- a/include/uapi/drm/etnaviv_drm.h
+++ b/include/uapi/drm/etnaviv_drm.h
@@ -75,7 +75,7 @@ struct drm_etnaviv_timespec {
 #define ETNAVIV_PARAM_GPU_NUM_VARYINGS  0x1a
 #define ETNAVIV_PARAM_SOFTPIN_START_ADDR0x1b
 
-#define ETNA_MAX_PIPES 4
+#define ETNA_MAX_PIPES 3
 
 struct drm_etnaviv_param {
__u32 pipe;   /* in */
-- 
2.23.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  1   2   >