Re: [PATCH] fbdev: Fix invalid page access after closing deferred I/O devices

2023-01-28 Thread Patrik Jakobsson
On Fri, Jan 27, 2023 at 5:58 PM Takashi Iwai  wrote:
>
> When a fbdev with deferred I/O is once opened and closed, the dirty
> pages still remain queued in the pageref list, and eventually later
> those may be processed in the delayed work.  This may lead to a
> corruption of pages, hitting an Oops.
>
> This patch makes sure to cancel the delayed work and clean up the
> pageref list at closing the device for addressing the bug.  A part of
> the cleanup code is factored out as a new helper function that is
> called from the common fb_release().
>
> Cc: 
> Signed-off-by: Takashi Iwai 

For some reason my first review didn't make it to the list. Trying
again with my other email.

As kernel test robot says, we need to check CONFIG_FB_DEFERRED_IO
around access to info->fbdefio.

With that fixed:
Reviewed-by: Patrik Jakobsson 

> ---
>  drivers/video/fbdev/core/fb_defio.c | 10 +-
>  drivers/video/fbdev/core/fbmem.c|  2 ++
>  include/linux/fb.h  |  1 +
>  3 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/core/fb_defio.c 
> b/drivers/video/fbdev/core/fb_defio.c
> index c730253ab85c..583cbcf09446 100644
> --- a/drivers/video/fbdev/core/fb_defio.c
> +++ b/drivers/video/fbdev/core/fb_defio.c
> @@ -313,7 +313,7 @@ void fb_deferred_io_open(struct fb_info *info,
>  }
>  EXPORT_SYMBOL_GPL(fb_deferred_io_open);
>
> -void fb_deferred_io_cleanup(struct fb_info *info)
> +void fb_deferred_io_release(struct fb_info *info)
>  {
> struct fb_deferred_io *fbdefio = info->fbdefio;
> struct page *page;
> @@ -327,6 +327,14 @@ void fb_deferred_io_cleanup(struct fb_info *info)
> page = fb_deferred_io_page(info, i);
> page->mapping = NULL;
> }
> +}
> +EXPORT_SYMBOL_GPL(fb_deferred_io_release);
> +
> +void fb_deferred_io_cleanup(struct fb_info *info)
> +{
> +   struct fb_deferred_io *fbdefio = info->fbdefio;
> +
> +   fb_deferred_io_release(info);
>
> kvfree(info->pagerefs);
> mutex_destroy(>lock);
> diff --git a/drivers/video/fbdev/core/fbmem.c 
> b/drivers/video/fbdev/core/fbmem.c
> index 3a6c8458eb8d..78c4cb5ee7c9 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1454,6 +1454,8 @@ __releases(>lock)
> struct fb_info * const info = file->private_data;
>
> lock_fb_info(info);
> +   if (info->fbdefio)
> +   fb_deferred_io_release(info);
> if (info->fbops->fb_release)
> info->fbops->fb_release(info,1);
> module_put(info->fbops->owner);
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 96b96323e9cb..73eb1f85ea8e 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -662,6 +662,7 @@ extern int  fb_deferred_io_init(struct fb_info *info);
>  extern void fb_deferred_io_open(struct fb_info *info,
> struct inode *inode,
> struct file *file);
> +extern void fb_deferred_io_release(struct fb_info *info);
>  extern void fb_deferred_io_cleanup(struct fb_info *info);
>  extern int fb_deferred_io_fsync(struct file *file, loff_t start,
> loff_t end, int datasync);
> --
> 2.35.3
>


Re: [PATCH 08/32] drm/amdgpu: add gfx10 hw debug mode enable and disable calls

2023-01-28 Thread kernel test robot
Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on linus/master v6.2-rc5]
[cannot apply to drm-misc/drm-misc-next drm/drm-next drm-exynos/exynos-drm-next 
drm-intel/for-linux-next drm-intel/for-linux-next-fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Jonathan-Kim/drm-amdkfd-add-debug-and-runtime-enable-interface/20230128-092952
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:
https://lore.kernel.org/r/20230125195401.4183544-9-jonathan.kim%40amd.com
patch subject: [PATCH 08/32] drm/amdgpu: add gfx10 hw debug mode enable and 
disable calls
config: x86_64-allyesconfig 
(https://download.01.org/0day-ci/archive/20230129/202301291502.el73nchv-...@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# 
https://github.com/intel-lab-lkp/linux/commit/ca722ec7f4d749b61a30b4654fabf05f03d8d2cf
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Jonathan-Kim/drm-amdkfd-add-debug-and-runtime-enable-interface/20230128-092952
git checkout ca722ec7f4d749b61a30b4654fabf05f03d8d2cf
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash 
drivers/gpu/drm/amd/amdgpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:750:10: warning: no 
>> previous prototype for 'kgd_gfx_v10_enable_debug_trap' [-Wmissing-prototypes]
 750 | uint32_t kgd_gfx_v10_enable_debug_trap(struct amdgpu_device *adev,
 |  ^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:787:10: warning: no 
>> previous prototype for 'kgd_gfx_v10_disable_debug_trap' 
>> [-Wmissing-prototypes]
 787 | uint32_t kgd_gfx_v10_disable_debug_trap(struct amdgpu_device *adev,
 |  ^~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:36,
from 
drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30,
from 
drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64,
from drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:22:
   drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h:53:22: warning: 
'dp_hdmi_dongle_signature_str' defined but not used [-Wunused-const-variable=]
  53 | static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI 
ADAPTOR";
 |  ^~~~


vim +/kgd_gfx_v10_enable_debug_trap +750 
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c

   749  
 > 750  uint32_t kgd_gfx_v10_enable_debug_trap(struct amdgpu_device *adev,
   751  bool restore_dbg_registers,
   752  uint32_t vmid)
   753  {
   754  
   755  mutex_lock(>grbm_idx_mutex);
   756  
   757  kgd_gfx_v10_set_wave_launch_stall(adev, vmid, true);
   758  
   759  /* assume gfx off is disabled for the debug session if rlc 
restore not supported. */
   760  if (restore_dbg_registers) {
   761  uint32_t data = 0;
   762  
   763  data = REG_SET_FIELD(data, SPI_GDBG_TRAP_CONFIG,
   764  VMID_SEL, 1 << vmid);
   765  data = REG_SET_FIELD(data, SPI_GDBG_TRAP_CONFIG,
   766  TRAP_EN, 1);
   767  WREG32(SOC15_REG_OFFSET(GC, 0, mmSPI_GDBG_TRAP_CONFIG), 
data);
   768  WREG32(SOC15_REG_OFFSET(GC, 0, mmSPI_GDBG_TRAP_DATA0), 
0);
   769  WREG32(SOC15_REG_OFFSET(GC, 0, mmSPI_GDBG_TRAP_DATA1), 
0);
   770  
   771  kgd_gfx_v10_set_wave_launch_stall(adev, vmid, false);
   772  
   773  mutex_unlock(>grbm_idx_mutex);
   774  
   775  return 0;
   776  }
   777  
   778  WREG32(SOC15_REG_OFFSET(GC, 0, mmSPI_GDBG_TRAP_MASK), 0);
   779  
   780  kgd_gfx_v10_set_wave_launch_stall(adev, vmid, false);
   781  
   782  mutex_unlock(>grbm_idx_mutex);
   783  
   784  return 0;
   785  }
   786  
 > 787  uint32_t kgd_gfx_v10_disable_debug_trap(struct amdgpu_device *adev,
   788  bool keep_trap_enabled,
   789  

Re: [PATCH 07/32] drm/amdgpu: add gfx9.4.1 hw debug mode enable and disable calls

2023-01-28 Thread kernel test robot
Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on linus/master v6.2-rc5]
[cannot apply to drm-misc/drm-misc-next drm/drm-next drm-exynos/exynos-drm-next 
drm-intel/for-linux-next drm-intel/for-linux-next-fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Jonathan-Kim/drm-amdkfd-add-debug-and-runtime-enable-interface/20230128-092952
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:
https://lore.kernel.org/r/20230125195401.4183544-8-jonathan.kim%40amd.com
patch subject: [PATCH 07/32] drm/amdgpu: add gfx9.4.1 hw debug mode enable and 
disable calls
config: x86_64-allyesconfig 
(https://download.01.org/0day-ci/archive/20230129/202301291457.nbbgmbeg-...@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# 
https://github.com/intel-lab-lkp/linux/commit/3983dc0f35ebf17452f97c096b866e38c98318db
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Jonathan-Kim/drm-amdkfd-add-debug-and-runtime-enable-interface/20230128-092952
git checkout 3983dc0f35ebf17452f97c096b866e38c98318db
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash 
drivers/gpu/drm/amd/amdgpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c: In function 
'suspend_resume_compute_scheduler':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c:312:53: warning: 
>> implicit conversion from 'enum amd_hw_ip_block_type' to 'enum 
>> amd_ip_block_type' [-Wenum-conversion]
 312 | return amdgpu_device_ip_wait_for_idle(adev, GC_HWIP);
 | ^~~
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:36,
from 
drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:30,
from 
drivers/gpu/drm/amd/amdgpu/../include/dm_pp_interface.h:26,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64,
from drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c:26:
   At top level:
   drivers/gpu/drm/amd/amdgpu/../display/dc/dc_hdmi_types.h:53:22: warning: 
'dp_hdmi_dongle_signature_str' defined but not used [-Wunused-const-variable=]
  53 | static const uint8_t dp_hdmi_dongle_signature_str[] = "DP-HDMI 
ADAPTOR";
 |  ^~~~
--
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c:343: warning: This 
>> comment starts with '/**', but isn't a kernel-doc comment. Refer 
>> Documentation/doc-guide/kernel-doc.rst
* restore_dbg_reisters is ignored here but is a general interface 
requirement
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c:369: warning: This 
comment starts with '/**', but isn't a kernel-doc comment. Refer 
Documentation/doc-guide/kernel-doc.rst
* keep_trap_enabled is ignored here but is a general interface requirement


vim +312 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c

   281  
   282  /*
   283   * Helper used to suspend/resume gfx pipe for image post process work 
to set
   284   * barrier behaviour.
   285   */
   286  static int suspend_resume_compute_scheduler(struct amdgpu_device *adev, 
bool suspend)
   287  {
   288  int i, r = 0;
   289  
   290  for (i = 0; i < adev->gfx.num_compute_rings; i++) {
   291  struct amdgpu_ring *ring = >gfx.compute_ring[i];
   292  
   293  if (!(ring && ring->sched.thread))
   294  continue;
   295  
   296  /* stop secheduler and drain ring. */
   297  if (suspend) {
   298  drm_sched_stop(>sched, NULL);
   299  r = amdgpu_fence_wait_empty(ring);
   300  if (r)
   301  goto out;
   302  } else {
   303  drm_sched_start(>sched, false);
   304  }
   305  }
   306  
   307  out:
   308  /* return on resume or failure to drain rings. */
   309  if (!suspend || r)
   310  return r;
   311  
 > 312  return amdgpu_device_ip_wait_for_idle(adev, GC_HWIP);
   313  }
   314  
   315  static void set_barrier_auto_waitcnt(struct amdgpu_device *adev, bool 
ena

Re: [vmwgfx] crash upon vmw_open_channel() when booting on Oracle VM VirtualBox

2023-01-28 Thread Zack Rusin
On Sat, 2023-01-28 at 20:44 +0900, Tetsuo Handa wrote:
> Hello.
> 
> I noticed that a kernel built with vmwgfx driver fails to boot a Linux guest
> on Oracle VM VirtualBox 7.0.4 on Windows 11 on DELL Inspiron 14 5420.
> I didn't notice this problem when I booted an older kernel on an older version
> of Oracle VM VirtualBox on Windows 8.1 on an older PC.
> 
> The location that crashes is
> 
>     VMW_PORT(VMW_PORT_CMD_OPEN_CHANNEL,
>     (protocol | GUESTMSG_FLAG_COOKIE), si, di,
>     0,
>     VMW_HYPERVISOR_MAGIC,
>     eax, ebx, ecx, edx, si, di);
> 
> in vmw_open_channel(). It might be that some changes in VirtualBox side
> is conflicting with how VMware tries to test if the guest is VMware.
> How can I debug this problem?

You'd have to figure out what exactly is the problem. I couldn't reproduce it on
vmware hypervisors with your .config. FWIW that code has been there and hasn't 
been
changed in years. Oracle emulated svga device always had problems, was never
supported by vmwgfx and afaict is not maintained by Oracle so I'd strongly 
suggest
that you switch to some other graphics device on virtualbox.

In the meantime I think the attached patch should at least get you booting. You 
can
give it a try and if it works I can push it sometime this week.

z

From db6405fb221a9b8e8232dff8695775584d341ca8 Mon Sep 17 00:00:00 2001
From: Zack Rusin 
Date: Sun, 29 Jan 2023 00:42:20 -0500
Subject: [PATCH] drm/vmwgfx: Print errors when running on broken/unsupported
 configs

virtualbox implemented an incomplete version of the svga device which
they decided to drop soon after the initial release. The device was
always broken in various ways and never supported by vmwgfx.

vmwgfx should refuse to load on those configurations but currently
drm has no way of reloading fbdev when the specific pci driver refuses
to load, which would leave users without a usable fb. Instead of
refusing to load print an error and disable a bunch of functionality
that virtualbox never implemented to at least get fb to work on their
setup.

Signed-off-by: Zack Rusin 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 28 
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |  3 +++
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c |  2 +-
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 8e1cd9d6ced2..339a0725ed0c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -46,6 +46,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -898,6 +899,16 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
  cap2_names, ARRAY_SIZE(cap2_names));
 	}
 
+	if (!vmwgfx_supported(dev_priv)) {
+		vmw_msg_enabled = 0;
+		drm_err_once(
+			_priv->drm,
+			"vmwgfx seems to be running on an unsupported hypervisor. "
+			"This configuration is likely broken. "
+			"Please switch to a supported graphics device to avoid problems."
+			);
+	}
+
 	ret = vmw_dma_select_mode(dev_priv);
 	if (unlikely(ret != 0)) {
 		drm_info(_priv->drm,
@@ -1321,6 +1332,23 @@ static void vmw_master_drop(struct drm_device *dev,
 	vmw_kms_legacy_hotspot_clear(dev_priv);
 }
 
+
+bool vmwgfx_supported(struct vmw_private *vmw)
+{
+#if defined(__i386__) || defined(__x86_64__)
+	return hypervisor_is_type(X86_HYPER_VMWARE);
+#elif defined(__aarch64__)
+	/*
+	 * On aarch64 only svga3 is supported
+	 */
+	return vmw->pci_id == VMWGFX_PCI_ID_SVGA3;
+#else
+	drm_warn_once(>drm,
+		"vmwgfx is running on an unknown architecture.");
+	return false;
+#endif
+}
+
 /**
  * __vmw_svga_enable - Enable SVGA mode, FIFO and use of VRAM.
  *
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index c230cdfa1475..e436b8d042bc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -653,6 +653,8 @@ struct vmw_private {
 #endif
 };
 
+bool vmwgfx_supported(struct vmw_private *vmw);
+
 static inline struct vmw_surface *vmw_res_to_srf(struct vmw_resource *res)
 {
 	return container_of(res, struct vmw_surface, res);
@@ -1356,6 +1358,7 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,
 		struct vmw_diff_cpy *diff);
 
 /* Host messaging -vmwgfx_msg.c: */
+extern u32 vmw_msg_enabled;
 int vmw_host_get_guestinfo(const char *guest_info_param,
 			   char *buffer, size_t *length);
 __printf(1, 2) int vmw_host_printf(const char *fmt, ...);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index e76976a95a1e..1458e1ad967a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -67,7 +67,7 @@
 
 #define MAX_USER_MSG_LENGTH	PAGE_SIZE
 
-static u32 vmw_msg_enabled = 1;
+u32 vmw_msg_enabled = 1;
 
 enum rpc_msg_type {
 	MSG_TYPE_OPEN,
-- 
2.38.1



Re: [PATCH 06/32] drm/amdgpu: add gfx9 hw debug mode enable and disable calls

2023-01-28 Thread kernel test robot
Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on linus/master v6.2-rc5]
[cannot apply to drm-misc/drm-misc-next drm/drm-next drm-exynos/exynos-drm-next 
drm-intel/for-linux-next drm-intel/for-linux-next-fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Jonathan-Kim/drm-amdkfd-add-debug-and-runtime-enable-interface/20230128-092952
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:
https://lore.kernel.org/r/20230125195401.4183544-7-jonathan.kim%40amd.com
patch subject: [PATCH 06/32] drm/amdgpu: add gfx9 hw debug mode enable and 
disable calls
config: x86_64-allyesconfig 
(https://download.01.org/0day-ci/archive/20230129/202301291257.prqg0vpg-...@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# 
https://github.com/intel-lab-lkp/linux/commit/11bb8b2034cd92b687a2d5461298cc72d720d5c9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Jonathan-Kim/drm-amdkfd-add-debug-and-runtime-enable-interface/20230128-092952
git checkout 11bb8b2034cd92b687a2d5461298cc72d720d5c9
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash 
drivers/gpu/drm/amd/amdgpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:694: warning: This comment 
>> starts with '/**', but isn't a kernel-doc comment. Refer 
>> Documentation/doc-guide/kernel-doc.rst
* restore_dbg_reisters is ignored here but is a general interface 
requirement
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:718: warning: This comment 
starts with '/**', but isn't a kernel-doc comment. Refer 
Documentation/doc-guide/kernel-doc.rst
* keep_trap_enabled is ignored here but is a general interface requirement


vim +694 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c

   692  
   693  /**
 > 694   * restore_dbg_reisters is ignored here but is a general interface 
 > requirement
   695   * for devices that support GFXOFF and where the RLC save/restore list
   696   * does not support hw registers for debugging i.e. the driver has to 
manually
   697   * initialize the debug mode registers after it has disabled GFX off 
during the
   698   * debug session.
   699   */
   700  uint32_t kgd_gfx_v9_enable_debug_trap(struct amdgpu_device *adev,
   701  bool restore_dbg_registers,
   702  uint32_t vmid)
   703  {
   704  mutex_lock(>grbm_idx_mutex);
   705  
   706  kgd_gfx_v9_set_wave_launch_stall(adev, vmid, true);
   707  
   708  WREG32(SOC15_REG_OFFSET(GC, 0, mmSPI_GDBG_TRAP_MASK), 0);
   709  
   710  kgd_gfx_v9_set_wave_launch_stall(adev, vmid, false);
   711  
   712  mutex_unlock(>grbm_idx_mutex);
   713  
   714  return 0;
   715  }
   716  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


[syzbot] UBSAN: shift-out-of-bounds in fbcon_set_font

2023-01-28 Thread syzbot
Hello,

syzbot found the following issue on:

HEAD commit:691781f561e9 Add linux-next specific files for 20230123
git tree:   linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=148d181548
kernel config:  https://syzkaller.appspot.com/x/.config?x=804cddf7ddbc6c64
dashboard link: https://syzkaller.appspot.com/bug?extid=ac877d1de3aa7263e7f4
compiler:   gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for 
Debian) 2.35.2
syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=12b92cb948
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=169917fe48

Downloadable assets:
disk image: 
https://storage.googleapis.com/syzbot-assets/95b9320565c9/disk-691781f5.raw.xz
vmlinux: 
https://storage.googleapis.com/syzbot-assets/c5f3482fee79/vmlinux-691781f5.xz
kernel image: 
https://storage.googleapis.com/syzbot-assets/63516279b1a1/bzImage-691781f5.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+ac877d1de3aa7263e...@syzkaller.appspotmail.com


UBSAN: shift-out-of-bounds in drivers/video/fbdev/core/fbcon.c:2489:33
shift exponent 38 is too large for 32-bit type 'int'
CPU: 0 PID: 5087 Comm: syz-executor580 Not tainted 
6.2.0-rc5-next-20230123-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/12/2023
Call Trace:
 
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 ubsan_epilogue+0xa/0x31 lib/ubsan.c:151
 __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x187 lib/ubsan.c:321
 fbcon_set_font.cold+0x19/0x3c drivers/video/fbdev/core/fbcon.c:2489
 con_font_set drivers/tty/vt/vt.c:4624 [inline]
 con_font_op+0xb52/0xf10 drivers/tty/vt/vt.c:4671
 vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
 vt_ioctl+0x620/0x2df0 drivers/tty/vt/vt_ioctl.c:752
 tty_ioctl+0x762/0x1670 drivers/tty/tty_io.c:2777
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl fs/ioctl.c:856 [inline]
 __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fadea3c92c9
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 
89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 
c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:7ffeb231fd88 EFLAGS: 0246 ORIG_RAX: 0010
RAX: ffda RBX:  RCX: 7fadea3c92c9
RDX: 2040 RSI: 4b72 RDI: 0003
RBP: 7fadea38d0b0 R08: 000d R09: 
R10:  R11: 0246 R12: 7fadea38d140
R13:  R14:  R15: 
 



---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches


Re: [PATCH v2 8/9] dt-bindings: display: mediatek: Fix the fallback for mediatek,mt8186-disp-ccorr

2023-01-28 Thread Chun-Kuang Hu
Hi, Allen:

Allen-KH Cheng  於 2023年1月18日 週三 下午5:18寫道:
>
> The mt8186-disp-ccorr is not fully compatible with the mt8183-disp-ccorr
> implementation. It causes a crash when system resumes if it binds to the
> device.
>
> We should use mt8192-disp-ccorr as fallback of mt8186-disp-ccorr.

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Fixes: 8a26ea19d4dc ("dt-bindings: display: mediatek: add MT8186 SoC binding")
> Signed-off-by: Allen-KH Cheng 
> Reviewed-by: Rob Herring 
> ---
>  .../devicetree/bindings/display/mediatek/mediatek,ccorr.yaml| 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/mediatek/mediatek,ccorr.yaml 
> b/Documentation/devicetree/bindings/display/mediatek/mediatek,ccorr.yaml
> index 63fb02014a56..117e3db43f84 100644
> --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,ccorr.yaml
> +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,ccorr.yaml
> @@ -32,7 +32,7 @@ properties:
>- items:
>- enum:
>- mediatek,mt8186-disp-ccorr
> -  - const: mediatek,mt8183-disp-ccorr
> +  - const: mediatek,mt8192-disp-ccorr
>
>reg:
>  maxItems: 1
> --
> 2.18.0
>


Re: [PATCH] drm/mediatek: Remove unused GEM DMA header include

2023-01-28 Thread Chun-Kuang Hu
Hi, Rob:

Rob Clark  於 2023年1月28日 週六 上午12:54寫道:
>
> From: Rob Clark 
>
> No longer needed since the removal of dependency on DMA helper.

Applied to mediatek-drm-next [1], thanks.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Fixes: 2ea8aec56bf1 ("drm/mediatek: Remove dependency on GEM DMA helper")
> Signed-off-by: Rob Clark 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index cd5b18ef7951..7e2fad8e8444 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -20,8 +20,8 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> --
> 2.38.1
>


Re: [PATCH v3] drm/mediatek: Add support for AR30 and BA30

2023-01-28 Thread Chun-Kuang Hu
Hi, Justin:

Justin Green  於 2023年1月28日 週六 上午7:01寫道:
>
> Add support for AR30 and BA30 pixel formats to the Mediatek DRM driver.
>
> Tested using "modetest -P" on an MT8195.
>
> Signed-off-by: Justin Green 
> ---
> v2:
>  * Rebase and resolve merge conflicts with the AFBC patch.
> v3:
>  * Moved 10-bit support detection to mtk_disk_ovl.c
>
>  drivers/gpu/drm/mediatek/mtk_disp_drv.h |  1 +
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 37 +
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  3 +-
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |  1 +
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 10 ++
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c| 37 ++---
>  drivers/gpu/drm/mediatek/mtk_drm_plane.h|  2 +-
>  7 files changed, 84 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h 
> b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> index 33e61a136bbc..b75139da3032 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> @@ -96,6 +96,7 @@ void mtk_ovl_register_vblank_cb(struct device *dev,
>  void mtk_ovl_unregister_vblank_cb(struct device *dev);
>  void mtk_ovl_enable_vblank(struct device *dev);
>  void mtk_ovl_disable_vblank(struct device *dev);
> +int mtk_ovl_supports_10bit(struct device *dev);
>
>  void mtk_rdma_bypass_shadow(struct device *dev);
>  int mtk_rdma_clk_enable(struct device *dev);
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c 
> b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index 84daeaffab6a..412a749a509e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -41,6 +41,7 @@
>  #define DISP_REG_OVL_RDMA_CTRL(n)  (0x00c0 + 0x20 * (n))
>  #define DISP_REG_OVL_RDMA_GMC(n)   (0x00c8 + 0x20 * (n))
>  #define DISP_REG_OVL_ADDR_MT2701   0x0040
> +#define DISP_REG_OVL_CLRFMT_EXT0x02D0
>  #define DISP_REG_OVL_ADDR_MT8173   0x0f40
>  #define DISP_REG_OVL_ADDR(ovl, n)  ((ovl)->data->addr + 0x20 * 
> (n))
>  #define DISP_REG_OVL_HDR_ADDR(ovl, n)  ((ovl)->data->addr + 0x20 * 
> (n) + 0x04)
> @@ -61,6 +62,10 @@
> 0 : OVL_CON_CLRFMT_RGB)
>  #define OVL_CON_CLRFMT_RGB888(ovl) ((ovl)->data->fmt_rgb565_is_0 ? \
> OVL_CON_CLRFMT_RGB : 0)
> +#define OVL_CON_CLRFMT_BIT_DEPTH_MASK(ovl) (0xFF << 4 * (ovl))
> +#define OVL_CON_CLRFMT_BIT_DEPTH(depth, ovl)   (depth << 4 * (ovl))
> +#define OVL_CON_CLRFMT_8_BIT   0x00
> +#define OVL_CON_CLRFMT_10_BIT  0x01
>  #defineOVL_CON_AEN BIT(8)
>  #defineOVL_CON_ALPHA   0xff
>  #defineOVL_CON_VIRT_FLIP   BIT(9)
> @@ -73,6 +78,7 @@ struct mtk_disp_ovl_data {
> bool fmt_rgb565_is_0;
> bool smi_id_en;
> bool supports_afbc;
> +   bool supports_10bit;
>  };
>
>  /*
> @@ -188,6 +194,26 @@ static void mtk_ovl_set_afbc(struct mtk_disp_ovl *ovl, 
> struct cmdq_pkt *cmdq_pkt
>DISP_REG_OVL_DATAPATH_CON, OVL_LAYER_AFBC_EN(idx));
>  }
>
> +static void mtk_ovl_set_bit_depth(struct device *dev, int idx, u32 format,
> + struct cmdq_pkt *cmdq_pkt)
> +{
> +   struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
> +   unsigned int reg;
> +   unsigned int bit_depth = OVL_CON_CLRFMT_8_BIT;
> +
> +   reg = readl(ovl->regs + DISP_REG_OVL_CLRFMT_EXT);
> +   reg &= ~OVL_CON_CLRFMT_BIT_DEPTH_MASK(idx);
> +
> +   if (format == DRM_FORMAT_RGBA1010102 ||
> +   format == DRM_FORMAT_BGRA1010102 ||
> +   format == DRM_FORMAT_ARGB2101010)
> +   bit_depth = OVL_CON_CLRFMT_10_BIT;
> +
> +   reg |= OVL_CON_CLRFMT_BIT_DEPTH(bit_depth, idx);
> +
> +   mtk_ddp_write(cmdq_pkt, reg, >cmdq_reg, ovl->regs, 
> DISP_REG_OVL_CLRFMT_EXT);
> +}
> +
>  void mtk_ovl_config(struct device *dev, unsigned int w,
> unsigned int h, unsigned int vrefresh,
> unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
> @@ -216,6 +242,13 @@ unsigned int mtk_ovl_supported_rotations(struct device 
> *dev)
>DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
>  }
>
> +int mtk_ovl_supports_10bit(struct device *dev)
> +{
> +   struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
> +
> +   return ovl->data->supports_10bit;
> +}
> +
>  int mtk_ovl_layer_check(struct device *dev, unsigned int idx,
> struct mtk_plane_state *mtk_state)
>  {
> @@ -302,9 +335,11 @@ static unsigned int ovl_fmt_convert(struct mtk_disp_ovl 
> *ovl, unsigned int fmt)
> return OVL_CON_CLRFMT_ARGB;
> case DRM_FORMAT_BGRX:
> case DRM_FORMAT_BGRA:
> +   case DRM_FORMAT_BGRA1010102:
> return OVL_CON_CLRFMT_ARGB | OVL_CON_BYTE_SWAP;
> case DRM_FORMAT_XRGB:

Re: [PATCH] fbdev: Fix invalid page access after closing deferred I/O devices

2023-01-28 Thread kernel test robot
Hi Takashi,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.2-rc5 next-20230127]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Takashi-Iwai/fbdev-Fix-invalid-page-access-after-closing-deferred-I-O-devices/20230128-180330
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:https://lore.kernel.org/r/20230127165834.11387-1-tiwai%40suse.de
patch subject: [PATCH] fbdev: Fix invalid page access after closing deferred 
I/O devices
config: s390-defconfig 
(https://download.01.org/0day-ci/archive/20230129/202301290917.purynsug-...@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/f28e22b16f34068d07913fa5d4fb2c9683aa8dc4
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Takashi-Iwai/fbdev-Fix-invalid-page-access-after-closing-deferred-I-O-devices/20230128-180330
git checkout f28e22b16f34068d07913fa5d4fb2c9683aa8dc4
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 
O=build_dir ARCH=s390 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 
O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   drivers/video/fbdev/core/fbmem.c: In function 'fb_release':
>> drivers/video/fbdev/core/fbmem.c:1456:17: error: 'struct fb_info' has no 
>> member named 'fbdefio'
1456 | if (info->fbdefio)
 | ^~


vim +1456 drivers/video/fbdev/core/fbmem.c

  1447  
  1448  static int
  1449  fb_release(struct inode *inode, struct file *file)
  1450  __acquires(>lock)
  1451  __releases(>lock)
  1452  {
  1453  struct fb_info * const info = file->private_data;
  1454  
  1455  lock_fb_info(info);
> 1456  if (info->fbdefio)
  1457  fb_deferred_io_release(info);
  1458  if (info->fbops->fb_release)
  1459  info->fbops->fb_release(info,1);
  1460  module_put(info->fbops->owner);
  1461  unlock_fb_info(info);
  1462  put_fb_info(info);
  1463  return 0;
  1464  }
  1465  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


Re: [PATCH] drm/mediatek: Implement shutdown

2023-01-28 Thread Chun-Kuang Hu
Hi, Ricardo:

Ricardo Ribalda  於 2022年11月28日 週一 下午6:42寫道:
>
> Poweroff the device properly, otherwise the device will not come back
> from kexec().
>
> Signed-off-by: Ricardo Ribalda 
> ---
> To: Chun-Kuang Hu 
> To: Philipp Zabel 
> To: David Airlie 
> To: Daniel Vetter 
> To: Matthias Brugger 
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-media...@lists.infradead.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: linux-ker...@vger.kernel.org
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 91f58db5915f..51dbd85796e9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -829,6 +829,12 @@ static int mtk_drm_remove(struct platform_device *pdev)
> return 0;
>  }
>
> +static void mtk_drm_shutdown(struct platform_device *pdev)
> +{
> +   component_master_del(>dev, _drm_ops);
> +   pm_runtime_disable(>dev);
> +}

Would it be better to implement like rockchip [1]?

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/rockchip/rockchip_drm_drv.c?h=v6.2-rc5#n462

Regards,
Chun-Kuang.

> +
>  static int mtk_drm_sys_prepare(struct device *dev)
>  {
> struct mtk_drm_private *private = dev_get_drvdata(dev);
> @@ -856,6 +862,7 @@ static const struct dev_pm_ops mtk_drm_pm_ops = {
>  static struct platform_driver mtk_drm_platform_driver = {
> .probe  = mtk_drm_probe,
> .remove = mtk_drm_remove,
> +   .shutdown = mtk_drm_shutdown,
> .driver = {
> .name   = "mediatek-drm",
> .pm = _drm_pm_ops,
>
> ---
> base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4
> change-id: 20221128-mtk-drm-ca6c5ac6b389
>
> Best regards,
> --
> Ricardo Ribalda 


Re: [PATCH 4/4] DRM: BRIDGE: TFP410: If connected, use I2C for polled HPD status.

2023-01-28 Thread kernel test robot
Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 93f875a8526a291005e7f38478079526c843cbec]

url:
https://github.com/intel-lab-lkp/linux/commits/Jonathan-Cormier/dt-bindings-display-bridge-tfp410-Add-tfp410-i2c-example/20230128-183627
base:   93f875a8526a291005e7f38478079526c843cbec
patch link:
https://lore.kernel.org/r/20230125-tfp410_i2c-v1-4-66a4d4e390b7%40criticallink.com
patch subject: [PATCH 4/4] DRM: BRIDGE: TFP410: If connected, use I2C for 
polled HPD status.
config: i386-randconfig-a006 
(https://download.01.org/0day-ci/archive/20230129/202301290803.ous19eab-...@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project 
f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/c4659fa4c02b62087c095ca99978e5eac8b490de
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Jonathan-Cormier/dt-bindings-display-bridge-tfp410-Add-tfp410-i2c-example/20230128-183627
git checkout c4659fa4c02b62087c095ca99978e5eac8b490de
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/bridge/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/bridge/ti-tfp410.c:111:6: warning: unused variable 'val' 
>> [-Wunused-variable]
   u32 val;
   ^
   1 warning generated.


vim +/val +111 drivers/gpu/drm/bridge/ti-tfp410.c

   106  
   107  static enum drm_connector_status
   108  tfp410_connector_detect(struct drm_connector *connector, bool force)
   109  {
   110  struct tfp410 *dvi = drm_connector_to_tfp410(connector);
 > 111  u32 val;
   112  unsigned int ret;
   113  
   114  if (dvi->i2c) {
   115  ret = regmap_test_bits(dvi->regmap, 
TFP410_REG_CTL_2_MODE, TFP410_BIT_HTPLG);
   116  if (ret < 0)
   117  dev_err(dvi->dev, "%s failed to read HTPLG bit 
: %d\n", __func__, ret);
   118  else
   119  return ret ? connector_status_connected : 
connector_status_disconnected;
   120  }
   121  
   122  return drm_bridge_detect(dvi->next_bridge);
   123  }
   124  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


[PATCH v3 4/8] drm/i915/guc: Update GuC messages in intel_guc_ct.c

2023-01-28 Thread Michal Wajdeczko
Use new macros to have common prefix that also include GT#.

v2: drop unused helpers

Signed-off-by: Michal Wajdeczko 
Cc: John Harrison 
Reviewed-by: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 23 ---
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
index 2b22065e87bf..1803a633ed64 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
@@ -11,38 +11,23 @@
 
 #include "i915_drv.h"
 #include "intel_guc_ct.h"
-#include "gt/intel_gt.h"
+#include "intel_guc_print.h"
 
 static inline struct intel_guc *ct_to_guc(struct intel_guc_ct *ct)
 {
return container_of(ct, struct intel_guc, ct);
 }
 
-static inline struct intel_gt *ct_to_gt(struct intel_guc_ct *ct)
-{
-   return guc_to_gt(ct_to_guc(ct));
-}
-
-static inline struct drm_i915_private *ct_to_i915(struct intel_guc_ct *ct)
-{
-   return ct_to_gt(ct)->i915;
-}
-
-static inline struct drm_device *ct_to_drm(struct intel_guc_ct *ct)
-{
-   return _to_i915(ct)->drm;
-}
-
 #define CT_ERROR(_ct, _fmt, ...) \
-   drm_err(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__)
+   guc_err(ct_to_guc(_ct), "CT: " _fmt, ##__VA_ARGS__)
 #ifdef CONFIG_DRM_I915_DEBUG_GUC
 #define CT_DEBUG(_ct, _fmt, ...) \
-   drm_dbg(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__)
+   guc_dbg(ct_to_guc(_ct), "CT: " _fmt, ##__VA_ARGS__)
 #else
 #define CT_DEBUG(...)  do { } while (0)
 #endif
 #define CT_PROBE_ERROR(_ct, _fmt, ...) \
-   i915_probe_error(ct_to_i915(ct), "CT: " _fmt, ##__VA_ARGS__)
+   guc_probe_error(ct_to_guc(ct), "CT: " _fmt, ##__VA_ARGS__)
 
 /**
  * DOC: CTB Blob
-- 
2.25.1



[PATCH v3 7/8] drm/i915/guc: Update GuC messages in intel_guc_submission.c

2023-01-28 Thread Michal Wajdeczko
Use new macros to have common prefix that also include GT#.

v2: improve few existing messages

Signed-off-by: Michal Wajdeczko 
Cc: John Harrison 
Reviewed-by: John Harrison 
---
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 61 ---
 1 file changed, 26 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
index 2e6ab0bb5c2b..53f3ed3244d5 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
@@ -27,6 +27,7 @@
 
 #include "intel_guc_ads.h"
 #include "intel_guc_capture.h"
+#include "intel_guc_print.h"
 #include "intel_guc_submission.h"
 
 #include "i915_drv.h"
@@ -1443,8 +1444,7 @@ static void guc_init_engine_stats(struct intel_guc *guc)
int ret = guc_action_enable_usage_stats(guc);
 
if (ret)
-   drm_err(>i915->drm,
-   "Failed to enable usage stats: %d!\n", ret);
+   guc_err(guc, "Failed to enable usage stats: %pe\n", 
ERR_PTR(ret));
}
 }
 
@@ -3586,8 +3586,7 @@ static int guc_request_alloc(struct i915_request *rq)
intel_context_sched_disable_unpin(ce);
else if (intel_context_is_closed(ce))
if (wait_for(context_close_done(ce), 1500))
-   drm_warn(_to_gt(guc)->i915->drm,
-"timed out waiting on context sched close 
before realloc\n");
+   guc_warn(guc, "timed out waiting on context sched close 
before realloc\n");
/*
 * Call pin_guc_id here rather than in the pinning step as with
 * dma_resv, contexts can be repeatedly pinned / unpinned trashing the
@@ -4350,11 +4349,14 @@ static int __guc_action_set_scheduling_policies(struct 
intel_guc *guc,
 
ret = intel_guc_send(guc, (u32 *)>h2g,
 __guc_scheduling_policy_action_size(policy));
-   if (ret < 0)
+   if (ret < 0) {
+   guc_probe_error(guc, "Failed to configure global scheduling 
policies: %pe!\n",
+   ERR_PTR(ret));
return ret;
+   }
 
if (ret != policy->count) {
-   drm_warn(_to_gt(guc)->i915->drm, "GuC global scheduler 
policy processed %d of %d KLVs!",
+   guc_warn(guc, "global scheduler policy processed %d of %d 
KLVs!",
 ret, policy->count);
if (ret > policy->count)
return -EPROTO;
@@ -4368,7 +4370,7 @@ static int guc_init_global_schedule_policy(struct 
intel_guc *guc)
struct scheduling_policy policy;
struct intel_gt *gt = guc_to_gt(guc);
intel_wakeref_t wakeref;
-   int ret = 0;
+   int ret;
 
if (GUC_SUBMIT_VER(guc) < MAKE_GUC_VER(1, 1, 0))
return 0;
@@ -4386,10 +4388,6 @@ static int guc_init_global_schedule_policy(struct 
intel_guc *guc)
yield, ARRAY_SIZE(yield));
 
ret = __guc_action_set_scheduling_policies(guc, );
-   if (ret)
-   i915_probe_error(gt->i915,
-"Failed to configure global scheduling 
policies: %pe!\n",
-ERR_PTR(ret));
}
 
return ret;
@@ -4488,21 +4486,18 @@ g2h_context_lookup(struct intel_guc *guc, u32 ctx_id)
struct intel_context *ce;
 
if (unlikely(ctx_id >= GUC_MAX_CONTEXT_ID)) {
-   drm_err(_to_gt(guc)->i915->drm,
-   "Invalid ctx_id %u\n", ctx_id);
+   guc_err(guc, "Invalid ctx_id %u\n", ctx_id);
return NULL;
}
 
ce = __get_context(guc, ctx_id);
if (unlikely(!ce)) {
-   drm_err(_to_gt(guc)->i915->drm,
-   "Context is NULL, ctx_id %u\n", ctx_id);
+   guc_err(guc, "Context is NULL, ctx_id %u\n", ctx_id);
return NULL;
}
 
if (unlikely(intel_context_is_child(ce))) {
-   drm_err(_to_gt(guc)->i915->drm,
-   "Context is child, ctx_id %u\n", ctx_id);
+   guc_err(guc, "Context is child, ctx_id %u\n", ctx_id);
return NULL;
}
 
@@ -4517,7 +4512,7 @@ int intel_guc_deregister_done_process_msg(struct 
intel_guc *guc,
u32 ctx_id;
 
if (unlikely(len < 1)) {
-   drm_err(_to_gt(guc)->i915->drm, "Invalid length %u\n", len);
+   guc_err(guc, "Invalid length %u\n", len);
return -EPROTO;
}
ctx_id = msg[0];
@@ -4569,7 +4564,7 @@ int intel_guc_sched_done_process_msg(struct intel_guc 
*guc,
u32 ctx_id;
 
if (unlikely(len < 2)) {
-   drm_err(_to_gt(guc)->i915->drm, "Invalid length %u\n", len);
+   guc_err(guc, "Invalid length %u\n", len);
   

[PATCH v3 8/8] drm/i915/guc: Update GT/GuC messages in intel_uc.c

2023-01-28 Thread Michal Wajdeczko
Use new macros to have common prefix that also include GT#.

v2: pass gt to print_fw_ver
v3: prefer guc_dbg in suspend/resume logs

Signed-off-by: Michal Wajdeczko 
Cc: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/intel_uc.c | 80 +--
 1 file changed, 39 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc.c 
b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
index 9a8a1abf71d7..de7f987cf611 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_uc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_uc.c
@@ -6,11 +6,13 @@
 #include 
 
 #include "gt/intel_gt.h"
+#include "gt/intel_gt_print.h"
 #include "gt/intel_reset.h"
 #include "intel_gsc_fw.h"
 #include "intel_gsc_uc.h"
 #include "intel_guc.h"
 #include "intel_guc_ads.h"
+#include "intel_guc_print.h"
 #include "intel_guc_submission.h"
 #include "gt/intel_rps.h"
 #include "intel_uc.h"
@@ -67,14 +69,14 @@ static int __intel_uc_reset_hw(struct intel_uc *uc)
 
ret = intel_reset_guc(gt);
if (ret) {
-   DRM_ERROR("Failed to reset GuC, ret = %d\n", ret);
+   gt_err(gt, "Failed to reset GuC, ret = %d\n", ret);
return ret;
}
 
guc_status = intel_uncore_read(gt->uncore, GUC_STATUS);
-   WARN(!(guc_status & GS_MIA_IN_RESET),
-"GuC status: 0x%x, MIA core expected to be in reset\n",
-guc_status);
+   gt_WARN(gt, !(guc_status & GS_MIA_IN_RESET),
+   "GuC status: 0x%x, MIA core expected to be in reset\n",
+   guc_status);
 
return ret;
 }
@@ -252,15 +254,13 @@ static int guc_enable_communication(struct intel_guc *guc)
intel_guc_ct_event_handler(>ct);
spin_unlock_irq(gt->irq_lock);
 
-   drm_dbg(>drm, "GuC communication enabled\n");
+   guc_dbg(guc, "communication enabled\n");
 
return 0;
 }
 
 static void guc_disable_communication(struct intel_guc *guc)
 {
-   struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
-
/*
 * Events generated during or after CT disable are logged by guc in
 * via mmio. Make sure the register is clear before disabling CT since
@@ -280,11 +280,12 @@ static void guc_disable_communication(struct intel_guc 
*guc)
 */
guc_get_mmio_msg(guc);
 
-   drm_dbg(>drm, "GuC communication disabled\n");
+   guc_dbg(guc, "communication disabled\n");
 }
 
 static void __uc_fetch_firmwares(struct intel_uc *uc)
 {
+   struct intel_gt *gt = uc_to_gt(uc);
int err;
 
GEM_BUG_ON(!intel_uc_wants_guc(uc));
@@ -293,15 +294,13 @@ static void __uc_fetch_firmwares(struct intel_uc *uc)
if (err) {
/* Make sure we transition out of transient "SELECTED" state */
if (intel_uc_wants_huc(uc)) {
-   drm_dbg(_to_gt(uc)->i915->drm,
-   "Failed to fetch GuC: %d disabling HuC\n", err);
+   gt_dbg(gt, "Failed to fetch GuC fw (%pe) disabling 
HuC\n", ERR_PTR(err));
intel_uc_fw_change_status(>huc.fw,
  INTEL_UC_FIRMWARE_ERROR);
}
 
if (intel_uc_wants_gsc_uc(uc)) {
-   drm_dbg(_to_gt(uc)->i915->drm,
-   "Failed to fetch GuC: %d disabling GSC\n", err);
+   gt_dbg(gt, "Failed to fetch GuC fw (%pe) disabling 
GSC\n", ERR_PTR(err));
intel_uc_fw_change_status(>gsc.fw,
  INTEL_UC_FIRMWARE_ERROR);
}
@@ -382,7 +381,7 @@ static int uc_init_wopcm(struct intel_uc *uc)
int err;
 
if (unlikely(!base || !size)) {
-   i915_probe_error(gt->i915, "Unsuccessful WOPCM partitioning\n");
+   gt_probe_error(gt, "Unsuccessful WOPCM partitioning\n");
return -E2BIG;
}
 
@@ -413,13 +412,13 @@ static int uc_init_wopcm(struct intel_uc *uc)
return 0;
 
 err_out:
-   i915_probe_error(gt->i915, "Failed to init uC WOPCM registers!\n");
-   i915_probe_error(gt->i915, "%s(%#x)=%#x\n", "DMA_GUC_WOPCM_OFFSET",
-i915_mmio_reg_offset(DMA_GUC_WOPCM_OFFSET),
-intel_uncore_read(uncore, DMA_GUC_WOPCM_OFFSET));
-   i915_probe_error(gt->i915, "%s(%#x)=%#x\n", "GUC_WOPCM_SIZE",
-i915_mmio_reg_offset(GUC_WOPCM_SIZE),
-intel_uncore_read(uncore, GUC_WOPCM_SIZE));
+   gt_probe_error(gt, "Failed to init uC WOPCM registers!\n");
+   gt_probe_error(gt, "%s(%#x)=%#x\n", "DMA_GUC_WOPCM_OFFSET",
+  i915_mmio_reg_offset(DMA_GUC_WOPCM_OFFSET),
+  intel_uncore_read(uncore, DMA_GUC_WOPCM_OFFSET));
+   gt_probe_error(gt, "%s(%#x)=%#x\n", "GUC_WOPCM_SIZE",
+  i915_mmio_reg_offset(GUC_WOPCM_SIZE),
+  intel_uncore_read(uncore, GUC_WOPCM_SIZE));
 
return 

[PATCH v3 6/8] drm/i915/guc: Update GuC messages in intel_guc_log.c

2023-01-28 Thread Michal Wajdeczko
Use new macros to have common prefix that also include GT#.

v2: drop redundant GuC strings, minor improvements
v3: more message improvements

Signed-off-by: Michal Wajdeczko 
Cc: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_log.c | 38 +++---
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
index 68331c538b0a..c3792ddeec80 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_log.c
@@ -12,6 +12,7 @@
 #include "i915_memcpy.h"
 #include "intel_guc_capture.h"
 #include "intel_guc_log.h"
+#include "intel_guc_print.h"
 
 #if defined(CONFIG_DRM_I915_DEBUG_GUC)
 #define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE  SZ_2M
@@ -39,7 +40,6 @@ struct guc_log_section {
 static void _guc_log_init_sizes(struct intel_guc_log *log)
 {
struct intel_guc *guc = log_to_guc(log);
-   struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
static const struct guc_log_section sections[GUC_LOG_SECTIONS_LIMIT] = {
{
GUC_LOG_CRASH_MASK >> GUC_LOG_CRASH_SHIFT,
@@ -82,12 +82,12 @@ static void _guc_log_init_sizes(struct intel_guc_log *log)
}
 
if (!IS_ALIGNED(log->sizes[i].bytes, log->sizes[i].units))
-   drm_err(>drm, "Mis-aligned GuC log %s size: 0x%X 
vs 0x%X!",
+   guc_err(guc, "Mis-aligned log %s size: 0x%X vs 0x%X!\n",
sections[i].name, log->sizes[i].bytes, 
log->sizes[i].units);
log->sizes[i].count = log->sizes[i].bytes / log->sizes[i].units;
 
if (!log->sizes[i].count) {
-   drm_err(>drm, "Zero GuC log %s size!", 
sections[i].name);
+   guc_err(guc, "Zero log %s size!\n", sections[i].name);
} else {
/* Size is +1 unit */
log->sizes[i].count--;
@@ -95,14 +95,14 @@ static void _guc_log_init_sizes(struct intel_guc_log *log)
 
/* Clip to field size */
if (log->sizes[i].count > sections[i].max) {
-   drm_err(>drm, "GuC log %s size too large: %d vs 
%d!",
+   guc_err(guc, "log %s size too large: %d vs %d!\n",
sections[i].name, log->sizes[i].count + 1, 
sections[i].max + 1);
log->sizes[i].count = sections[i].max;
}
}
 
if (log->sizes[GUC_LOG_SECTIONS_CRASH].units != 
log->sizes[GUC_LOG_SECTIONS_DEBUG].units) {
-   drm_err(>drm, "Unit mis-match for GuC log crash and debug 
sections: %d vs %d!",
+   guc_err(guc, "Unit mismatch for crash and debug sections: %d vs 
%d!\n",
log->sizes[GUC_LOG_SECTIONS_CRASH].units,
log->sizes[GUC_LOG_SECTIONS_DEBUG].units);
log->sizes[GUC_LOG_SECTIONS_CRASH].units = 
log->sizes[GUC_LOG_SECTIONS_DEBUG].units;
@@ -374,6 +374,7 @@ size_t intel_guc_get_log_buffer_offset(struct intel_guc_log 
*log,
 
 static void _guc_log_copy_debuglogs_for_relay(struct intel_guc_log *log)
 {
+   struct intel_guc *guc = log_to_guc(log);
unsigned int buffer_size, read_offset, write_offset, bytes_to_copy, 
full_cnt;
struct guc_log_buffer_state *log_buf_state, *log_buf_snapshot_state;
struct guc_log_buffer_state log_buf_state_local;
@@ -383,7 +384,7 @@ static void _guc_log_copy_debuglogs_for_relay(struct 
intel_guc_log *log)
 
mutex_lock(>relay.lock);
 
-   if (WARN_ON(!intel_guc_log_relay_created(log)))
+   if (guc_WARN_ON(guc, !intel_guc_log_relay_created(log)))
goto out_unlock;
 
/* Get the pointer to shared GuC log buffer */
@@ -398,7 +399,7 @@ static void _guc_log_copy_debuglogs_for_relay(struct 
intel_guc_log *log)
 * Used rate limited to avoid deluge of messages, logs might be
 * getting consumed by User at a slow rate.
 */
-   DRM_ERROR_RATELIMITED("no sub-buffer to copy general logs\n");
+   guc_err_ratelimited(guc, "no sub-buffer to copy general 
logs\n");
log->relay.full_count++;
 
goto out_unlock;
@@ -451,7 +452,7 @@ static void _guc_log_copy_debuglogs_for_relay(struct 
intel_guc_log *log)
write_offset = buffer_size;
} else if (unlikely((read_offset > buffer_size) ||
(write_offset > buffer_size))) {
-   DRM_ERROR("invalid log buffer state\n");
+   guc_err(guc, "invalid log buffer state\n");
/* copy whole buffer as offsets are unreliable */
read_offset = 0;
write_offset = buffer_size;
@@ -547,7 +548,7 @@ static int guc_log_relay_create(struct intel_guc_log *log)
 

[PATCH v3 3/8] drm/i915/guc: Update GuC messages in intel_guc_ads.c

2023-01-28 Thread Michal Wajdeczko
Use new macros to have common prefix that also include GT#.

Signed-off-by: Michal Wajdeczko 
Cc: John Harrison 
Reviewed-by: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
index a7f737c4792e..69ce06faf8cd 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c
@@ -15,6 +15,7 @@
 #include "intel_guc_ads.h"
 #include "intel_guc_capture.h"
 #include "intel_guc_fwif.h"
+#include "intel_guc_print.h"
 #include "intel_uc.h"
 #include "i915_drv.h"
 
@@ -427,7 +428,7 @@ static long guc_mmio_reg_state_create(struct intel_guc *guc)
 
guc->ads_regset = temp_set.storage;
 
-   drm_dbg(_to_gt(guc)->i915->drm, "Used %zu KB for temporary ADS 
regset\n",
+   guc_dbg(guc, "Used %zu KB for temporary ADS regset\n",
(temp_set.storage_max * sizeof(struct guc_mmio_reg)) >> 10);
 
return total * sizeof(struct guc_mmio_reg);
@@ -621,7 +622,7 @@ static void guc_init_golden_context(struct intel_guc *guc)
 
engine = find_engine_state(gt, engine_class);
if (!engine) {
-   drm_err(>i915->drm, "No engine state recorded for 
class %d!\n",
+   guc_err(guc, "No engine state recorded for class %d!\n",
engine_class);
ads_blob_write(guc, ads.eng_state_size[guc_class], 0);
ads_blob_write(guc, ads.golden_context_lrca[guc_class], 
0);
@@ -646,7 +647,6 @@ static int
 guc_capture_prep_lists(struct intel_guc *guc)
 {
struct intel_gt *gt = guc_to_gt(guc);
-   struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
u32 ads_ggtt, capture_offset, null_ggtt, total_size = 0;
struct guc_gt_system_info local_info;
struct iosys_map info_map;
@@ -751,7 +751,7 @@ guc_capture_prep_lists(struct intel_guc *guc)
}
 
if (guc->ads_capture_size && guc->ads_capture_size != 
PAGE_ALIGN(total_size))
-   drm_warn(>drm, "GuC->ADS->Capture alloc size changed from 
%d to %d\n",
+   guc_warn(guc, "ADS capture alloc size changed from %d to %d\n",
 guc->ads_capture_size, PAGE_ALIGN(total_size));
 
return PAGE_ALIGN(total_size);
-- 
2.25.1



[PATCH v3 5/8] drm/i915/guc: Update GuC messages in intel_guc_fw.c

2023-01-28 Thread Michal Wajdeczko
Use new macros to have common prefix that also include GT#.

Signed-off-by: Michal Wajdeczko 
Cc: John Harrison 
Reviewed-by: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
index 5b86b2e286e0..3d2249bda368 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c
@@ -13,6 +13,7 @@
 #include "gt/intel_gt_mcr.h"
 #include "gt/intel_gt_regs.h"
 #include "intel_guc_fw.h"
+#include "intel_guc_print.h"
 #include "i915_drv.h"
 
 static void guc_prepare_xfer(struct intel_gt *gt)
@@ -103,8 +104,10 @@ static inline bool guc_ready(struct intel_uncore *uncore, 
u32 *status)
return uk_val == INTEL_GUC_LOAD_STATUS_READY;
 }
 
-static int guc_wait_ucode(struct intel_uncore *uncore)
+static int guc_wait_ucode(struct intel_guc *guc)
 {
+   struct intel_gt *gt = guc_to_gt(guc);
+   struct intel_uncore *uncore = gt->uncore;
u32 status;
int ret;
 
@@ -127,10 +130,8 @@ static int guc_wait_ucode(struct intel_uncore *uncore)
 */
ret = wait_for(guc_ready(uncore, ), 200);
if (ret) {
-   struct drm_device *drm = >i915->drm;
-
-   drm_info(drm, "GuC load failed: status = 0x%08X\n", status);
-   drm_info(drm, "GuC load failed: status: Reset = %d, "
+   guc_info(guc, "load failed: status = 0x%08X\n", status);
+   guc_info(guc, "load failed: status: Reset = %d, "
"BootROM = 0x%02X, UKernel = 0x%02X, "
"MIA = 0x%02X, Auth = 0x%02X\n",
REG_FIELD_GET(GS_MIA_IN_RESET, status),
@@ -140,12 +141,12 @@ static int guc_wait_ucode(struct intel_uncore *uncore)
REG_FIELD_GET(GS_AUTH_STATUS_MASK, status));
 
if ((status & GS_BOOTROM_MASK) == GS_BOOTROM_RSA_FAILED) {
-   drm_info(drm, "GuC firmware signature verification 
failed\n");
+   guc_info(guc, "firmware signature verification 
failed\n");
ret = -ENOEXEC;
}
 
if (REG_FIELD_GET(GS_UKERNEL_MASK, status) == 
INTEL_GUC_LOAD_STATUS_EXCEPTION) {
-   drm_info(drm, "GuC firmware exception. EIP: %#x\n",
+   guc_info(guc, "firmware exception. EIP: %#x\n",
 intel_uncore_read(uncore, SOFT_SCRATCH(13)));
ret = -ENXIO;
}
@@ -194,7 +195,7 @@ int intel_guc_fw_upload(struct intel_guc *guc)
if (ret)
goto out;
 
-   ret = guc_wait_ucode(uncore);
+   ret = guc_wait_ucode(guc);
if (ret)
goto out;
 
-- 
2.25.1



[PATCH v3 2/8] drm/i915/guc: Update GuC messages in intel_guc.c

2023-01-28 Thread Michal Wajdeczko
Use new macros to have common prefix that also include GT#.

v2: drop now redundant "GuC" word from the message

Signed-off-by: Michal Wajdeczko 
Cc: John Harrison 
Reviewed-by: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/intel_guc.c | 31 +-
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.c 
b/drivers/gpu/drm/i915/gt/uc/intel_guc.c
index 1bccc175f9e6..d76508fa3af7 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.c
@@ -11,6 +11,7 @@
 #include "intel_guc.h"
 #include "intel_guc_ads.h"
 #include "intel_guc_capture.h"
+#include "intel_guc_print.h"
 #include "intel_guc_slpc.h"
 #include "intel_guc_submission.h"
 #include "i915_drv.h"
@@ -94,8 +95,8 @@ static void gen9_enable_guc_interrupts(struct intel_guc *guc)
assert_rpm_wakelock_held(>i915->runtime_pm);
 
spin_lock_irq(gt->irq_lock);
-   WARN_ON_ONCE(intel_uncore_read(gt->uncore, GEN8_GT_IIR(2)) &
-gt->pm_guc_events);
+   guc_WARN_ON_ONCE(guc, intel_uncore_read(gt->uncore, GEN8_GT_IIR(2)) &
+gt->pm_guc_events);
gen6_gt_pm_enable_irq(gt, gt->pm_guc_events);
spin_unlock_irq(gt->irq_lock);
 
@@ -342,7 +343,7 @@ static void guc_init_params(struct intel_guc *guc)
params[GUC_CTL_DEVID] = guc_ctl_devid(guc);
 
for (i = 0; i < GUC_CTL_MAX_DWORDS; i++)
-   DRM_DEBUG_DRIVER("param[%2d] = %#x\n", i, params[i]);
+   guc_dbg(guc, "param[%2d] = %#x\n", i, params[i]);
 }
 
 /*
@@ -389,7 +390,6 @@ void intel_guc_dump_time_info(struct intel_guc *guc, struct 
drm_printer *p)
 
 int intel_guc_init(struct intel_guc *guc)
 {
-   struct intel_gt *gt = guc_to_gt(guc);
int ret;
 
ret = intel_uc_fw_init(>fw);
@@ -451,7 +451,7 @@ int intel_guc_init(struct intel_guc *guc)
intel_uc_fw_fini(>fw);
 out:
intel_uc_fw_change_status(>fw, INTEL_UC_FIRMWARE_INIT_FAIL);
-   i915_probe_error(gt->i915, "failed with %d\n", ret);
+   guc_probe_error(guc, "failed with %pe\n", ERR_PTR(ret));
return ret;
 }
 
@@ -480,7 +480,6 @@ void intel_guc_fini(struct intel_guc *guc)
 int intel_guc_send_mmio(struct intel_guc *guc, const u32 *request, u32 len,
u32 *response_buf, u32 response_buf_size)
 {
-   struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
struct intel_uncore *uncore = guc_to_gt(guc)->uncore;
u32 header;
int i;
@@ -515,7 +514,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 
*request, u32 len,
   10, 10, );
if (unlikely(ret)) {
 timeout:
-   drm_err(>drm, "mmio request %#x: no reply %x\n",
+   guc_err(guc, "mmio request %#x: no reply %x\n",
request[0], header);
goto out;
}
@@ -537,7 +536,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 
*request, u32 len,
if (FIELD_GET(GUC_HXG_MSG_0_TYPE, header) == 
GUC_HXG_TYPE_NO_RESPONSE_RETRY) {
u32 reason = FIELD_GET(GUC_HXG_RETRY_MSG_0_REASON, header);
 
-   drm_dbg(>drm, "mmio request %#x: retrying, reason %u\n",
+   guc_dbg(guc, "mmio request %#x: retrying, reason %u\n",
request[0], reason);
goto retry;
}
@@ -546,7 +545,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 
*request, u32 len,
u32 hint = FIELD_GET(GUC_HXG_FAILURE_MSG_0_HINT, header);
u32 error = FIELD_GET(GUC_HXG_FAILURE_MSG_0_ERROR, header);
 
-   drm_err(>drm, "mmio request %#x: failure %x/%u\n",
+   guc_err(guc, "mmio request %#x: failure %x/%u\n",
request[0], error, hint);
ret = -ENXIO;
goto out;
@@ -554,7 +553,7 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 
*request, u32 len,
 
if (FIELD_GET(GUC_HXG_MSG_0_TYPE, header) != 
GUC_HXG_TYPE_RESPONSE_SUCCESS) {
 proto:
-   drm_err(>drm, "mmio request %#x: unexpected reply %#x\n",
+   guc_err(guc, "mmio request %#x: unexpected reply %#x\n",
request[0], header);
ret = -EPROTO;
goto out;
@@ -597,9 +596,9 @@ int intel_guc_to_host_process_recv_msg(struct intel_guc 
*guc,
msg = payload[0] & guc->msg_enabled_mask;
 
if (msg & INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED)
-   drm_err(_to_gt(guc)->i915->drm, "Received early GuC crash 
dump notification!\n");
+   guc_err(guc, "Received early crash dump notification!\n");
if (msg & INTEL_GUC_RECV_MSG_EXCEPTION)
-   drm_err(_to_gt(guc)->i915->drm, "Received early GuC 
exception notification!\n");
+   guc_err(guc, "Received early exception notification!\n");
 
return 0;
 }
@@ -653,7 +652,8 @@ int intel_guc_suspend(struct 

[PATCH v3 1/8] drm/i915/guc: Add GuC oriented print macros

2023-01-28 Thread Michal Wajdeczko
While we do have GT oriented print macros, add few more GuC
specific to have common look and feel across all messages
related to the GuC and to avoid chasing the gt pointer.

We will use these macros shortly in upcoming patches.

Signed-off-by: Michal Wajdeczko 
Cc: Tvrtko Ursulin 
Cc: John Harrison 
Reviewed-by: John Harrison 
---
 drivers/gpu/drm/i915/gt/uc/intel_guc_print.h | 48 
 1 file changed, 48 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_print.h

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h 
b/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
new file mode 100644
index ..e75989d4ba06
--- /dev/null
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_print.h
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef __INTEL_GUC_PRINT__
+#define __INTEL_GUC_PRINT__
+
+#include "gt/intel_gt.h"
+#include "gt/intel_gt_print.h"
+
+#define guc_printk(_guc, _level, _fmt, ...) \
+   gt_##_level(guc_to_gt(_guc), "GUC: " _fmt, ##__VA_ARGS__)
+
+#define guc_err(_guc, _fmt, ...) \
+   guc_printk((_guc), err, _fmt, ##__VA_ARGS__)
+
+#define guc_warn(_guc, _fmt, ...) \
+   guc_printk((_guc), warn, _fmt, ##__VA_ARGS__)
+
+#define guc_notice(_guc, _fmt, ...) \
+   guc_printk((_guc), notice, _fmt, ##__VA_ARGS__)
+
+#define guc_info(_guc, _fmt, ...) \
+   guc_printk((_guc), info, _fmt, ##__VA_ARGS__)
+
+#define guc_dbg(_guc, _fmt, ...) \
+   guc_printk((_guc), dbg, _fmt, ##__VA_ARGS__)
+
+#define guc_err_ratelimited(_guc, _fmt, ...) \
+   guc_printk((_guc), err_ratelimited, _fmt, ##__VA_ARGS__)
+
+#define guc_probe_error(_guc, _fmt, ...) \
+   guc_printk((_guc), probe_error, _fmt, ##__VA_ARGS__)
+
+#define guc_WARN(_guc, _cond, _fmt, ...) \
+   gt_WARN(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__)
+
+#define guc_WARN_ONCE(_guc, _cond, _fmt, ...) \
+   gt_WARN_ONCE(guc_to_gt(_guc), _cond, "GUC: " _fmt, ##__VA_ARGS__)
+
+#define guc_WARN_ON(_guc, _cond) \
+   gt_WARN(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON", 
__stringify(_cond))
+
+#define guc_WARN_ON_ONCE(_guc, _cond) \
+   gt_WARN_ONCE(guc_to_gt(_guc), _cond, "%s(%s)", "guc_WARN_ON_ONCE", 
__stringify(_cond))
+
+#endif /* __INTEL_GUC_PRINT__ */
-- 
2.25.1



[PATCH v3 0/8] GuC oriented print macros

2023-01-28 Thread Michal Wajdeczko
This is a follow up series for existing commit 67804e48b494
("drm/i915/gt: Start adding module oriented dmesg output")
that was focusing just on the GT.

Now extend changes to uc/ folder and focus on the GuC.

v2: applying feedback from John
v3: more feedback from John

Cc: Tvrtko Ursulin 
Cc: John Harrison

Michal Wajdeczko (8):
  drm/i915/guc: Add GuC oriented print macros
  drm/i915/guc: Update GuC messages in intel_guc.c
  drm/i915/guc: Update GuC messages in intel_guc_ads.c
  drm/i915/guc: Update GuC messages in intel_guc_ct.c
  drm/i915/guc: Update GuC messages in intel_guc_fw.c
  drm/i915/guc: Update GuC messages in intel_guc_log.c
  drm/i915/guc: Update GuC messages in intel_guc_submission.c
  drm/i915/guc: Update GT/GuC messages in intel_uc.c

 drivers/gpu/drm/i915/gt/uc/intel_guc.c| 31 ---
 drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c|  8 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 23 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 17 ++--
 drivers/gpu/drm/i915/gt/uc/intel_guc_log.c| 38 -
 drivers/gpu/drm/i915/gt/uc/intel_guc_print.h  | 48 +++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 61 ++
 drivers/gpu/drm/i915/gt/uc/intel_uc.c | 80 +--
 8 files changed, 164 insertions(+), 142 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_print.h

-- 
2.25.1



Re: [PATCH 4/4] DRM: BRIDGE: TFP410: If connected, use I2C for polled HPD status.

2023-01-28 Thread kernel test robot
Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 93f875a8526a291005e7f38478079526c843cbec]

url:
https://github.com/intel-lab-lkp/linux/commits/Jonathan-Cormier/dt-bindings-display-bridge-tfp410-Add-tfp410-i2c-example/20230128-183627
base:   93f875a8526a291005e7f38478079526c843cbec
patch link:
https://lore.kernel.org/r/20230125-tfp410_i2c-v1-4-66a4d4e390b7%40criticallink.com
patch subject: [PATCH 4/4] DRM: BRIDGE: TFP410: If connected, use I2C for 
polled HPD status.
config: x86_64-allyesconfig 
(https://download.01.org/0day-ci/archive/20230129/202301290252.zgcweegx-...@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# 
https://github.com/intel-lab-lkp/linux/commit/c4659fa4c02b62087c095ca99978e5eac8b490de
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Jonathan-Cormier/dt-bindings-display-bridge-tfp410-Add-tfp410-i2c-example/20230128-183627
git checkout c4659fa4c02b62087c095ca99978e5eac8b490de
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/bridge/ti-tfp410.c: In function 'tfp410_connector_detect':
>> drivers/gpu/drm/bridge/ti-tfp410.c:111:13: warning: unused variable 'val' 
>> [-Wunused-variable]
 111 | u32 val;
 | ^~~


vim +/val +111 drivers/gpu/drm/bridge/ti-tfp410.c

   106  
   107  static enum drm_connector_status
   108  tfp410_connector_detect(struct drm_connector *connector, bool force)
   109  {
   110  struct tfp410 *dvi = drm_connector_to_tfp410(connector);
 > 111  u32 val;
   112  unsigned int ret;
   113  
   114  if (dvi->i2c) {
   115  ret = regmap_test_bits(dvi->regmap, 
TFP410_REG_CTL_2_MODE, TFP410_BIT_HTPLG);
   116  if (ret < 0)
   117  dev_err(dvi->dev, "%s failed to read HTPLG bit 
: %d\n", __func__, ret);
   118  else
   119  return ret ? connector_status_connected : 
connector_status_disconnected;
   120  }
   121  
   122  return drm_bridge_detect(dvi->next_bridge);
   123  }
   124  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


Re: [PATCH] backlight: ktz8866: Convert to i2c's .probe_new()

2023-01-28 Thread Jianhua Lu
On Sat, Jan 28, 2023 at 06:07:08PM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Sun, Jan 29, 2023 at 12:44:30AM +0800, Jianhua Lu wrote:
> > On Sat, Jan 28, 2023 at 05:16:13PM +0100, Uwe Kleine-König wrote:
> > > I don't want to squash the changes to the ktz8866 driver into the patch
> > > that modifies struct i2c_driver, as this needlessly clutters the commit,
> > > if it's that what you wanted. (There are more than 1000 i2c drivers and
> > > the others are not converted in a single lockstep, too.)
> > 
> > Do't squash this patch, I'd like you send a series patch instead of
> > a single patch.
> 
> This series was already sent before. However that happend based on a
> tree that didn't contain the ktz8866 backlight driver, so this patch
> came later (and I didn't resend the whole series for the two drivers
> that were added since then :-). See
> https://lore.kernel.org/lkml/20221118224540.619276-1-...@kleine-koenig.org.
> for the original post.
Thanks for explanation.
> 
> Letting this patch go in via the i2c tree together with the commit
> changing i2c_driver is fine for me, it won't be the only one.
I think so too.
> 
> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.   | Uwe Kleine-König|
> Industrial Linux Solutions | https://www.pengutronix.de/ |




Re: [PATCH] backlight: ktz8866: Convert to i2c's .probe_new()

2023-01-28 Thread Uwe Kleine-König
Hello,

On Sun, Jan 29, 2023 at 12:44:30AM +0800, Jianhua Lu wrote:
> On Sat, Jan 28, 2023 at 05:16:13PM +0100, Uwe Kleine-König wrote:
> > I don't want to squash the changes to the ktz8866 driver into the patch
> > that modifies struct i2c_driver, as this needlessly clutters the commit,
> > if it's that what you wanted. (There are more than 1000 i2c drivers and
> > the others are not converted in a single lockstep, too.)
> 
> Do't squash this patch, I'd like you send a series patch instead of
> a single patch.

This series was already sent before. However that happend based on a
tree that didn't contain the ktz8866 backlight driver, so this patch
came later (and I didn't resend the whole series for the two drivers
that were added since then :-). See
https://lore.kernel.org/lkml/20221118224540.619276-1-...@kleine-koenig.org.
for the original post.

Letting this patch go in via the i2c tree together with the commit
changing i2c_driver is fine for me, it won't be the only one.

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


Re: [PATCH] backlight: ktz8866: Convert to i2c's .probe_new()

2023-01-28 Thread Jianhua Lu
On Sat, Jan 28, 2023 at 05:16:13PM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Sat, Jan 28, 2023 at 10:14:09PM +0800, Jianhua Lu wrote:
> > On Sat, Jan 28, 2023 at 02:32:39PM +0100, Uwe Kleine-König wrote:
> > > On Sat, Jan 28, 2023 at 08:36:28AM +0800, Jianhua Lu wrote:
> > > > I prefer that you pack this commit to the i2c-tree commit that drops
> > > > old .probe(). 
> > > 
> > > That's fine for me. Can I interpret this as an Ack for this patch?
> > 
> > Yes, but can't get my A-b directly, this patch should be ignored and 
> > resend it within the i2c-tree patch series or split it to two patch
> > series.
> 
> I'm not sure if I understand you correctly. Up to know I though you want
> the patch as is go in together with the patch that modifies struct
> i2c_driver such that the PR has in two separate commits:
> 
>   i2c: Modify .probe() to not take an id parameter
>   backlight: ktz8866: Convert to i2c's .probe_new()
This is case 1, the case 2 should be:
Patch 1: i2c: Modify .probe() to not take an id parameter
Patch 2: backlight: ktz8866: Convert to i2c's .probe_new()
 'subsystem': 'i2c driver name': 
Convert to i2c's .probe_new()
 ...
> 
> Did I understand that right?
> 
> In that case an Ack by you would be fine and welcome.
> 
> I don't want to squash the changes to the ktz8866 driver into the patch
> that modifies struct i2c_driver, as this needlessly clutters the commit,
> if it's that what you wanted. (There are more than 1000 i2c drivers and
> the others are not converted in a single lockstep, too.)
Do't squash this patch, I'd like you send a series patch instead of
a single patch.
> 
> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.   | Uwe Kleine-König|
> Industrial Linux Solutions | https://www.pengutronix.de/ |




Re: [PATCH] backlight: ktz8866: Convert to i2c's .probe_new()

2023-01-28 Thread Uwe Kleine-König
Hello,

On Sat, Jan 28, 2023 at 10:14:09PM +0800, Jianhua Lu wrote:
> On Sat, Jan 28, 2023 at 02:32:39PM +0100, Uwe Kleine-König wrote:
> > On Sat, Jan 28, 2023 at 08:36:28AM +0800, Jianhua Lu wrote:
> > > I prefer that you pack this commit to the i2c-tree commit that drops
> > > old .probe(). 
> > 
> > That's fine for me. Can I interpret this as an Ack for this patch?
> 
> Yes, but can't get my A-b directly, this patch should be ignored and 
> resend it within the i2c-tree patch series or split it to two patch
> series.

I'm not sure if I understand you correctly. Up to know I though you want
the patch as is go in together with the patch that modifies struct
i2c_driver such that the PR has in two separate commits:

i2c: Modify .probe() to not take an id parameter
backlight: ktz8866: Convert to i2c's .probe_new()

Did I understand that right?

In that case an Ack by you would be fine and welcome.

I don't want to squash the changes to the ktz8866 driver into the patch
that modifies struct i2c_driver, as this needlessly clutters the commit,
if it's that what you wanted. (There are more than 1000 i2c drivers and
the others are not converted in a single lockstep, too.)

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


Re: [PATCH 6/7] drm/vmwgfx: Abstract placement selection

2023-01-28 Thread kernel test robot
Hi Zack,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next-fixes]
[also build test WARNING on linus/master v6.2-rc5]
[cannot apply to drm-misc/drm-misc-next drm/drm-next drm-exynos/exynos-drm-next 
drm-intel/for-linux-next drm-tip/drm-tip next-20230127]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:
https://github.com/intel-lab-lkp/linux/commits/Zack-Rusin/drm-vmwgfx-Use-the-common-gem-mmap-instead-of-the-custom-code/20230128-112136
base:   git://anongit.freedesktop.org/drm-intel for-linux-next-fixes
patch link:https://lore.kernel.org/r/20230126173813.602748-7-zack%40kde.org
patch subject: [PATCH 6/7] drm/vmwgfx: Abstract placement selection
config: i386-randconfig-a013 
(https://download.01.org/0day-ci/archive/20230128/202301282318.dooglmvq-...@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project 
f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/9083af8be713dc1052ca4bd2b39579979345e47b
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Zack-Rusin/drm-vmwgfx-Use-the-common-gem-mmap-instead-of-the-custom-code/20230128-112136
git checkout 9083af8be713dc1052ca4bd2b39579979345e47b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=i386 SHELL=/bin/bash drivers/cxl/ drivers/gpu/drm/vmwgfx/ 
kernel/entry/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:509:29: warning: variable 'dst_pitch' 
>> is uninitialized when used here [-Wuninitialized]
   src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp;
  ^
   drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c:492:26: note: initialize the variable 
'dst_pitch' to silence this warning
   s32 src_pitch, dst_pitch;
   ^
= 0
   1 warning generated.


vim +/dst_pitch +509 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

   475  
   476  
   477  /**
   478   * vmw_stdu_bo_cpu_commit - Callback to do a CPU blit from buffer object
   479   *
   480   * @dirty: The closure structure.
   481   *
   482   * For the special case when we cannot create a proxy surface in a
   483   * 2D VM, we have to do a CPU blit ourselves.
   484   */
   485  static void vmw_stdu_bo_cpu_commit(struct vmw_kms_dirty *dirty)
   486  {
   487  struct vmw_stdu_dirty *ddirty =
   488  container_of(dirty, struct vmw_stdu_dirty, base);
   489  struct vmw_screen_target_display_unit *stdu =
   490  container_of(dirty->unit, typeof(*stdu), base);
   491  s32 width, height;
   492  s32 src_pitch, dst_pitch;
   493  struct ttm_buffer_object *src_bo, *dst_bo;
   494  u32 src_offset, dst_offset;
   495  struct vmw_diff_cpy diff = 
VMW_CPU_BLIT_DIFF_INITIALIZER(stdu->cpp);
   496  
   497  if (!dirty->num_hits)
   498  return;
   499  
   500  width = ddirty->right - ddirty->left;
   501  height = ddirty->bottom - ddirty->top;
   502  
   503  if (width == 0 || height == 0)
   504  return;
   505  
   506  /* Assume we are blitting from Guest (bo) to Host (display_srf) 
*/
   507  src_pitch = stdu->display_srf->metadata.base_size.width * 
stdu->cpp;
   508  src_bo = >display_srf->res.backup->base;
 > 509  src_offset = ddirty->top * dst_pitch + ddirty->left * stdu->cpp;
   510  
   511  dst_pitch = ddirty->pitch;
   512  dst_bo = >buf->base;
   513  dst_offset = ddirty->fb_top * src_pitch + ddirty->fb_left * 
stdu->cpp;
   514  
   515  (void) vmw_bo_cpu_blit(dst_bo, dst_offset, dst_pitch,
   516 src_bo, src_offset, src_pitch,
   517 width * stdu->cpp, height, );
   518  }
   519  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests


Re: [PATCH] backlight: ktz8866: Convert to i2c's .probe_new()

2023-01-28 Thread Jianhua Lu
On Sat, Jan 28, 2023 at 02:32:39PM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Sat, Jan 28, 2023 at 08:36:28AM +0800, Jianhua Lu wrote:
> > On Fri, Jan 27, 2023 at 04:26:39PM +0100, Uwe Kleine-König wrote:
> > > The probe function doesn't make use of the i2c_device_id * parameter so
> > > it can be trivially converted.
> > > 
> > > Signed-off-by: Uwe Kleine-König 
> > > ---
> > > Hello,
> > > 
> > > there is an ongoing effort to convert all drivers to .probe_new to
> > > eventually drop .probe with the i2c_device_id parameter. This driver
> > > currently sits in next so wasn't on my radar before.
> > > 
> > > My plan is to tackle that after the next merge window. So I ask you to
> > > either apply this patch during the next merge window or accept that it
> > > will go in via the i2c tree together with the patch that drops .probe().
> > > 
> > > Best regards
> > > Uwe
> > > 
> > >  drivers/video/backlight/ktz8866.c | 5 ++---
> > >  1 file changed, 2 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/video/backlight/ktz8866.c 
> > > b/drivers/video/backlight/ktz8866.c
> > > index 97b723719e13..d38c13ad39c7 100644
> > > --- a/drivers/video/backlight/ktz8866.c
> > > +++ b/drivers/video/backlight/ktz8866.c
> > > @@ -124,8 +124,7 @@ static void ktz8866_init(struct ktz8866 *ktz)
> > >   ktz8866_write(ktz, LCD_BIAS_CFG1, LCD_BIAS_EN);
> > >  }
> > >  
> > > -static int ktz8866_probe(struct i2c_client *client,
> > > -  const struct i2c_device_id *id)
> > > +static int ktz8866_probe(struct i2c_client *client)
> > >  {
> > >   struct backlight_device *backlight_dev;
> > >   struct backlight_properties props;
> > > @@ -197,7 +196,7 @@ static struct i2c_driver ktz8866_driver = {
> > >   .name = "ktz8866",
> > >   .of_match_table = ktz8866_match_table,
> > >   },
> > > - .probe = ktz8866_probe,
> > > + .probe_new = ktz8866_probe,
> > 
> > I think .probe_new() will be renamed to new .probe() again when there are
> > patches dropping old .probe().
> 
> Right, the plan is to reintroduce .probe with the prototype that
> .probe_new has today.
> 
> > I prefer that you pack this commit to the i2c-tree commit that drops
> > old .probe(). 
> 
> That's fine for me. Can I interpret this as an Ack for this patch?
Yes, but can't get my A-b directly, this patch should be ignored and 
resend it within the i2c-tree patch series or split it to two patch
series.
> 
> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.   | Uwe Kleine-König|
> Industrial Linux Solutions | https://www.pengutronix.de/ |




Re: [PATCH] backlight: ktz8866: Convert to i2c's .probe_new()

2023-01-28 Thread Uwe Kleine-König
Hello,

On Sat, Jan 28, 2023 at 08:36:28AM +0800, Jianhua Lu wrote:
> On Fri, Jan 27, 2023 at 04:26:39PM +0100, Uwe Kleine-König wrote:
> > The probe function doesn't make use of the i2c_device_id * parameter so
> > it can be trivially converted.
> > 
> > Signed-off-by: Uwe Kleine-König 
> > ---
> > Hello,
> > 
> > there is an ongoing effort to convert all drivers to .probe_new to
> > eventually drop .probe with the i2c_device_id parameter. This driver
> > currently sits in next so wasn't on my radar before.
> > 
> > My plan is to tackle that after the next merge window. So I ask you to
> > either apply this patch during the next merge window or accept that it
> > will go in via the i2c tree together with the patch that drops .probe().
> > 
> > Best regards
> > Uwe
> > 
> >  drivers/video/backlight/ktz8866.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/video/backlight/ktz8866.c 
> > b/drivers/video/backlight/ktz8866.c
> > index 97b723719e13..d38c13ad39c7 100644
> > --- a/drivers/video/backlight/ktz8866.c
> > +++ b/drivers/video/backlight/ktz8866.c
> > @@ -124,8 +124,7 @@ static void ktz8866_init(struct ktz8866 *ktz)
> > ktz8866_write(ktz, LCD_BIAS_CFG1, LCD_BIAS_EN);
> >  }
> >  
> > -static int ktz8866_probe(struct i2c_client *client,
> > -const struct i2c_device_id *id)
> > +static int ktz8866_probe(struct i2c_client *client)
> >  {
> > struct backlight_device *backlight_dev;
> > struct backlight_properties props;
> > @@ -197,7 +196,7 @@ static struct i2c_driver ktz8866_driver = {
> > .name = "ktz8866",
> > .of_match_table = ktz8866_match_table,
> > },
> > -   .probe = ktz8866_probe,
> > +   .probe_new = ktz8866_probe,
> 
> I think .probe_new() will be renamed to new .probe() again when there are
> patches dropping old .probe().

Right, the plan is to reintroduce .probe with the prototype that
.probe_new has today.

> I prefer that you pack this commit to the i2c-tree commit that drops
> old .probe(). 

That's fine for me. Can I interpret this as an Ack for this patch?

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


[vmwgfx] crash upon vmw_open_channel() when booting on Oracle VM VirtualBox

2023-01-28 Thread Tetsuo Handa
Hello.

I noticed that a kernel built with vmwgfx driver fails to boot a Linux guest
on Oracle VM VirtualBox 7.0.4 on Windows 11 on DELL Inspiron 14 5420.
I didn't notice this problem when I booted an older kernel on an older version
of Oracle VM VirtualBox on Windows 8.1 on an older PC.

The location that crashes is

VMW_PORT(VMW_PORT_CMD_OPEN_CHANNEL,
(protocol | GUESTMSG_FLAG_COOKIE), si, di,
0,
VMW_HYPERVISOR_MAGIC,
eax, ebx, ecx, edx, si, di);

in vmw_open_channel(). It might be that some changes in VirtualBox side
is conflicting with how VMware tries to test if the guest is VMware.
How can I debug this problem?

Kernel config is at https://I-love.SAKURA.ne.jp/tmp/config-6.2.0-rc5-20230128 .

$ ./scripts/faddr2line vmlinux vmw_host_printf+0x31e/0x600
vmw_host_printf+0x31e/0x600:
vmw_open_channel at drivers/gpu/drm/vmwgfx/vmwgfx_msg.c:109
(inlined by) vmw_host_printf at drivers/gpu/drm/vmwgfx/vmwgfx_msg.c:530


[0.00][T0] Linux version 6.2.0-rc5-00199-g5af6ce704936 (root@fuzz) 
(Ubuntu clang version 14.0.0-1ubuntu1, Ubuntu LLD 14.0.0) #937 SMP 
PREEMPT_DYNAMIC Sat Jan 28 20:13:16 JST 2023
(...snipped...)
[   10.701088][T1] Linux agpgart interface v0.103
[   10.709269][T1] ACPI: bus type drm_connector registered
[   10.715161][T1] vmwgfx :00:02.0: vgaarb: deactivate vga console
[   10.722965][T1] Console: switching to colour dummy device 80x25
[   10.751077][T1] vmwgfx :00:02.0: [drm] FIFO at 0xf000 
size is 2048 kiB
[   10.751077][T1] vmwgfx :00:02.0: [drm] VRAM at 0xe000 
size is 16384 kiB
[   10.751077][T1] vmwgfx :00:02.0: [drm] Running on SVGA version 2.
[   10.751077][T1] vmwgfx :00:02.0: [drm] Capabilities: rect copy, 
cursor, cursor bypass, cursor bypass 2, alpha cursor, extended fifo, pitchlock, 
irq mask, gmr, traces, gmr2, screen object 2, command buffers, 
[   10.751077][T1] vmwgfx :00:02.0: [drm] DMA map mode: Caching DMA 
mappings.
[   10.751077][T1] vmwgfx :00:02.0: [drm] Legacy memory limits: VRAM = 
16384 kB, FIFO = 2048 kB, surface = 507904 kB
[   10.751077][T1] vmwgfx :00:02.0: [drm] MOB limits: max mob size = 0 
kB, max mob pages = 0
[   10.751077][T1] vmwgfx :00:02.0: [drm] Max GMR ids is 8192
[   10.751077][T1] vmwgfx :00:02.0: [drm] Max number of GMR pages is 
1048576
[   10.751077][T1] vmwgfx :00:02.0: [drm] Maximum display memory size 
is 16384 kiB
[   10.765114][T1] vmwgfx :00:02.0: [drm] Screen Object display unit 
initialized
[   10.774544][T1] vmwgfx :00:02.0: [drm] Fifo max 0x0020 min 
0x1000 cap 0x0355
[   10.779261][T1] vmwgfx :00:02.0: [drm] Using command buffers with 
DMA pool.
[   10.779261][T1] vmwgfx :00:02.0: [drm] Available shader model: 
Legacy.
[   10.779261][T1] BUG: unable to handle page fault for address: 
c943508a
[   10.779261][T1] #PF: supervisor write access in kernel mode
[   10.779261][T1] #PF: error_code(0x0002) - not-present page
[   10.779261][T1] PGD 0 P4D 0 
[   10.779261][T1] Oops: 0002 [#1] PREEMPT SMP
[   10.779261][T1] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 
6.2.0-rc5-00199-g5af6ce704936 #937
[   10.779261][T1] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS 
VirtualBox 12/01/2006
[   10.779261][T1] RIP: 0010:vmw_host_printf+0x31e/0x600
[   10.779261][T1] Code: 53 08 48 89 43 18 4c 89 63 20 bb 52 50 43 c9 b8 68 
58 4d 56 b9 1e 00 00 00 31 f6 31 ff 31 d2 66 ba 58 56 ed 49 89 cc 49 89 d7 <48> 
89 73 38 48 89 7b 40 49 c7 06 00 00 00 00 49 c7 46 08 00 00 00
[   10.779261][T1] RSP: :8881001c2fe0 EFLAGS: 00010246
[   10.779261][T1] RAX:  RBX: c9435052 RCX: 
001e
[   10.779261][T1] RDX: 5658 RSI:  RDI: 

[   10.779261][T1] RBP: 8881001c3130 R08: 864b246e R09: 
90bf0700
[   10.779261][T1] R10: 0012 R11: 8881208d8000 R12: 
001e
[   10.779261][T1] R13:  R14: 8881208d8b10 R15: 
5658
[   10.779261][T1] FS:  () GS:88821fa0() 
knlGS:
[   10.779261][T1] CS:  0010 DS:  ES:  CR0: 80050033
[   10.779261][T1] CR2: c943508a CR3: 12029000 CR4: 
000106e0
[   10.779261][T1] Call Trace:
[   10.779261][T1]  
[   10.779261][T1]  ? kmsan_get_shadow_origin_ptr+0x49/0xa0
[   10.779261][T1]  vmw_probe+0x6ecb/0x73e0
[   10.779261][T1]  ? rpm_resume+0x1730/0x2d70
[   10.779261][T1]  ? kmsan_get_shadow_origin_ptr+0x49/0xa0
[   10.779261][T1]  ? preempt_count_sub+0xf8/0x330
[   10.779261][T1]  ? _raw_spin_unlock_irqrestore+0x78/0xb0
[   10.779261][T1]  ? kmsan_get_shadow_origin_ptr+0x49/0xa0
[   10.779261][

Re: linux-6.2-rc4+ hangs on poweroff/reboot: Bisected

2023-01-28 Thread Chris Clayton



On 28/01/2023 05:42, Linux kernel regression tracking (Thorsten Leemhuis) wrote:
> On 27.01.23 20:46, Chris Clayton wrote:
>> [Resend because the mail client on my phone decided to turn HTML on behind 
>> my back, so my reply got bounced.]
>>
>> Thanks Thorsten.
>>
>> I did try to revert but it didnt revert cleanly and I don't have the 
>> knowledge to fix it up.
>>
>> The patch was part of a merge that included a number of related patches. 
>> Tomorrow, I'll try to revert the lot and report
>> back.
> 
> You are free to do so, but there is no need for that from my side. I
> only wanted to know if a simple revert would do the trick; if it
> doesn't, it in my experience often is best to leave things to the
> developers of the code in question, 

Sound advice, Thorsten. Way to many conflicts for me to resolve.

as they know it best and thus have a
> better idea which hidden side effect a more complex revert might have.
> 
> Ciao, Thorsten
> 
>> On 27/01/2023 11:20, Linux kernel regression tracking (Thorsten Leemhuis) 
>> wrote:
>>> Hi, this is your Linux kernel regression tracker. Top-posting for once,
>>> to make this easily accessible to everyone.
>>>
>>> @nouveau-maintainers, did anyone take a look at this? The report is
>>> already 8 days old and I don't see a single reply. Sure, we'll likely
>>> get a -rc8, but still it would be good to not fix this on the finish line.
>>>
>>> Chris, btw, did you try if you can revert the commit on top of latest
>>> mainline? And if so, does it fix the problem?
>>>
>>> Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat)
>>> --
>>> Everything you wanna know about Linux kernel regression tracking:
>>> https://linux-regtracking.leemhuis.info/about/#tldr
>>> If I did something stupid, please tell me, as explained on that page.
>>>
>>> #regzbot poke
>>>
>>> On 19.01.23 15:33, Linux kernel regression tracking (Thorsten Leemhuis)
>>> wrote:
 [adding various lists and the two other nouveau maintainers to the list
 of recipients]
>>>
 On 18.01.23 21:59, Chris Clayton wrote:
> Hi.
>
> I build and installed the lastest development kernel earlier this week. 
> I've found that when I try the laptop down (or
> reboot it), it hangs right at the end of closing the current session. The 
> last line I see on  the screen when rebooting is:
>
>   sd 4:0:0:0: [sda] Synchronising SCSI cache
>
> when closing down I see one additional line:
>
>   sd 4:0:0:0 [sda]Stopping disk
>
> In both cases the machine then hangs and I have to hold down the power 
> button fot a few seconds to switch it off.
>
> Linux 6.1 is OK but 6.2-rc1 hangs, so I bisected between this two and 
> landed on:
>
>   # first bad commit: [0e44c21708761977dcbea9b846b51a6fb684907a] 
> drm/nouveau/flcn: new code to load+boot simple HS FWs
> (VPR scrubber)
>
> I built and installed a kernel with 
> f15cde64b66161bfa74fb58f4e5697d8265b802e (the parent of the bad commit) 
> checked out
> and that shuts down and reboots fine. It the did the same with the bad 
> commit checked out and that does indeed hang, so
> I'm confident the bisect outcome is OK.
>
> Kernels 6.1.6 and 5.15.88 are also OK.
>
> My system had dual GPUs - one intel and one NVidia. Related extracts from 
> 'lscpi -v' is:
>
> 00:02.0 VGA compatible controller: Intel Corporation CometLake-H GT2 [UHD 
> Graphics] (rev 05) (prog-if 00 [VGA controller])
> Subsystem: CLEVO/KAPOK Computer CometLake-H GT2 [UHD Graphics]
>
> Flags: bus master, fast devsel, latency 0, IRQ 142
>
> Memory at c200 (64-bit, non-prefetchable) [size=16M]
>
> Memory at a000 (64-bit, prefetchable) [size=256M]
>
> I/O ports at 5000 [size=64]
>
> Expansion ROM at 000c [virtual] [disabled] [size=128K]
>
> Capabilities: [40] Vendor Specific Information: Len=0c 
>
> Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 
> 00
>
> Capabilities: [ac] MSI: Enable+ Count=1/1 Maskable- 64bit-
>
> Capabilities: [d0] Power Management version 2
>
> Kernel driver in use: i915
>
> Kernel modules: i915
>
>
> 01:00.0 VGA compatible controller: NVIDIA Corporation TU117M [GeForce GTX 
> 1650 Ti Mobile] (rev a1) (prog-if 00 [VGA
> controller])
> Subsystem: CLEVO/KAPOK Computer TU117M [GeForce GTX 1650 Ti 
> Mobile]
> Flags: bus master, fast devsel, latency 0, IRQ 141
> Memory at c400 (32-bit, non-prefetchable) [size=16M]
> Memory at b000 (64-bit, prefetchable) [size=256M]
> Memory at c000 (64-bit, prefetchable) [size=32M]
> I/O ports at 4000 [size=128]
> Expansion ROM at c300 [disabled] [size=512K]
>

Re: (subset) [PATCH 00/35] Documentation: correct lots of spelling errors (series 1)

2023-01-28 Thread Mark Brown
On Thu, 26 Jan 2023 22:39:30 -0800, Randy Dunlap wrote:
> Correct many spelling errors in Documentation/ as reported by codespell.
> 
> Maintainers of specific kernel subsystems are only Cc-ed on their
> respective patches, not the entire series. [if all goes well]
> 
> These patches are based on linux-next-20230125.
> 
> [...]

Applied to

   broonie/spi.git for-next

Thanks!

[27/35] Documentation: spi: correct spelling
commit: 0f6d2cee58f1ff2ebf66f0bceb113d79f66ecb07

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark



Re: [PATCH] backlight: ktz8866: Convert to i2c's .probe_new()

2023-01-28 Thread Jianhua Lu
On Fri, Jan 27, 2023 at 04:26:39PM +0100, Uwe Kleine-König wrote:
> The probe function doesn't make use of the i2c_device_id * parameter so
> it can be trivially converted.
> 
> Signed-off-by: Uwe Kleine-König 
> ---
> Hello,
> 
> there is an ongoing effort to convert all drivers to .probe_new to
> eventually drop .probe with the i2c_device_id parameter. This driver
> currently sits in next so wasn't on my radar before.
> 
> My plan is to tackle that after the next merge window. So I ask you to
> either apply this patch during the next merge window or accept that it
> will go in via the i2c tree together with the patch that drops .probe().
> 
> Best regards
> Uwe
> 
>  drivers/video/backlight/ktz8866.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/backlight/ktz8866.c 
> b/drivers/video/backlight/ktz8866.c
> index 97b723719e13..d38c13ad39c7 100644
> --- a/drivers/video/backlight/ktz8866.c
> +++ b/drivers/video/backlight/ktz8866.c
> @@ -124,8 +124,7 @@ static void ktz8866_init(struct ktz8866 *ktz)
>   ktz8866_write(ktz, LCD_BIAS_CFG1, LCD_BIAS_EN);
>  }
>  
> -static int ktz8866_probe(struct i2c_client *client,
> -  const struct i2c_device_id *id)
> +static int ktz8866_probe(struct i2c_client *client)
>  {
>   struct backlight_device *backlight_dev;
>   struct backlight_properties props;
> @@ -197,7 +196,7 @@ static struct i2c_driver ktz8866_driver = {
>   .name = "ktz8866",
>   .of_match_table = ktz8866_match_table,
>   },
> - .probe = ktz8866_probe,
> + .probe_new = ktz8866_probe,
I think .probe_new() will be renamed to new .probe() again when there are
patches dropping old .probe(). I prefer that you pack this commit to the
i2c-tree commit that drops old .probe(). 
>   .remove = ktz8866_remove,
>   .id_table = ktz8866_ids,
>  };
> 
> base-commit: 2241ab53cbb5cdb08a6b2d4688feb13971058f65
> prerequisite-patch-id: 2e7d7db8c0a90b8cd1deb6bbc51ead4c89c89b62
> -- 
> 2.39.0
> 


Re: [PATCH] dt-bindings: display: bridge: sil,sii8620: convert to dtschema

2023-01-28 Thread Krzysztof Kozlowski
On 28/01/2023 09:30, Laurent Pinchart wrote:
> Hi Krzysztof,
> 
> Thank you for the patch.
> 
> On Fri, Jan 27, 2023 at 09:35:25PM +0100, Krzysztof Kozlowski wrote:
>> Convert the Silicon Image SiI8620 HDMI/MHL bridge bindings to DT schema.
>>
>> Signed-off-by: Krzysztof Kozlowski 
>> ---
>>  .../bindings/display/bridge/sil,sii8620.yaml  | 107 ++
>>  .../bindings/display/bridge/sil-sii8620.txt   |  33 --
>>  2 files changed, 107 insertions(+), 33 deletions(-)
>>  create mode 100644 
>> Documentation/devicetree/bindings/display/bridge/sil,sii8620.yaml
>>  delete mode 100644 
>> Documentation/devicetree/bindings/display/bridge/sil-sii8620.txt
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/display/bridge/sil,sii8620.yaml 
>> b/Documentation/devicetree/bindings/display/bridge/sil,sii8620.yaml
>> new file mode 100644
>> index ..90532bb99161
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/display/bridge/sil,sii8620.yaml
>> @@ -0,0 +1,107 @@
>> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/display/bridge/sil,sii8620.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Silicon Image SiI8620 HDMI/MHL bridge
>> +
>> +maintainers:
>> +  - Krzysztof Kozlowski 
>> +
>> +properties:
>> +  compatible:
>> +const: sil,sii8620
>> +
>> +  reg:
>> +maxItems: 1
>> +
>> +  clocks:
>> +maxItems: 1
>> +
>> +  clock-names:
>> +items:
>> +  - const: xtal
>> +
>> +  cvcc10-supply:
>> +description: Digital Core Supply Voltage (1.0V)
>> +
>> +  interrupts:
>> +maxItems: 1
>> +
>> +  iovcc18-supply:
>> +description: I/O Supply Voltage (1.8V)
>> +
>> +  reset-gpios:
>> +maxItems: 1
>> +
>> +  ports:
>> +$ref: /schemas/graph.yaml#/properties/ports
>> +unevaluatedProperties: false
>> +
>> +properties:
>> +  port@0:
>> +$ref: /schemas/graph.yaml#/properties/port
>> +description:
>> +  Video port for HDMI (encoder) input
>> +
>> +  port@1:
>> +$ref: /schemas/graph.yaml#/properties/port
>> +description:
>> +  MHL to connector port
>> +
>> +required:
>> +  - port@0
> 
> Why port@0 only ?

I am not the author of the original binding, but when it was introduced,
I think it came without MHL port support - only HDMI. This probably is
incomplete but I guess can work due to some default settings. Shall we
make both required? I don't know, sounds reasonable...

Best regards,
Krzysztof



Re: [PATCH] dt-bindings: display: bridge: sil,sii8620: convert to dtschema

2023-01-28 Thread Laurent Pinchart
Hi Krzysztof,

Thank you for the patch.

On Fri, Jan 27, 2023 at 09:35:25PM +0100, Krzysztof Kozlowski wrote:
> Convert the Silicon Image SiI8620 HDMI/MHL bridge bindings to DT schema.
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  .../bindings/display/bridge/sil,sii8620.yaml  | 107 ++
>  .../bindings/display/bridge/sil-sii8620.txt   |  33 --
>  2 files changed, 107 insertions(+), 33 deletions(-)
>  create mode 100644 
> Documentation/devicetree/bindings/display/bridge/sil,sii8620.yaml
>  delete mode 100644 
> Documentation/devicetree/bindings/display/bridge/sil-sii8620.txt
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/bridge/sil,sii8620.yaml 
> b/Documentation/devicetree/bindings/display/bridge/sil,sii8620.yaml
> new file mode 100644
> index ..90532bb99161
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/sil,sii8620.yaml
> @@ -0,0 +1,107 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/bridge/sil,sii8620.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Silicon Image SiI8620 HDMI/MHL bridge
> +
> +maintainers:
> +  - Krzysztof Kozlowski 
> +
> +properties:
> +  compatible:
> +const: sil,sii8620
> +
> +  reg:
> +maxItems: 1
> +
> +  clocks:
> +maxItems: 1
> +
> +  clock-names:
> +items:
> +  - const: xtal
> +
> +  cvcc10-supply:
> +description: Digital Core Supply Voltage (1.0V)
> +
> +  interrupts:
> +maxItems: 1
> +
> +  iovcc18-supply:
> +description: I/O Supply Voltage (1.8V)
> +
> +  reset-gpios:
> +maxItems: 1
> +
> +  ports:
> +$ref: /schemas/graph.yaml#/properties/ports
> +unevaluatedProperties: false
> +
> +properties:
> +  port@0:
> +$ref: /schemas/graph.yaml#/properties/port
> +description:
> +  Video port for HDMI (encoder) input
> +
> +  port@1:
> +$ref: /schemas/graph.yaml#/properties/port
> +description:
> +  MHL to connector port
> +
> +required:
> +  - port@0

Why port@0 only ?

> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - cvcc10-supply
> +  - interrupts
> +  - iovcc18-supply
> +  - reset-gpios
> +  - ports
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +#include 
> +#include 
> +
> +i2c {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +
> +bridge@39 {
> +reg = <0x39>;
> +compatible = "sil,sii8620";
> +cvcc10-supply = <_reg>;
> +iovcc18-supply = <_reg>;
> +interrupt-parent = <>;
> +interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
> +reset-gpios = < 0 GPIO_ACTIVE_LOW>;
> +clocks = <_system_controller 0>;
> +clock-names = "xtal";
> +
> +ports {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +
> +port@0 {
> +reg = <0>;
> +mhl_to_hdmi: endpoint {
> +remote-endpoint = <_to_mhl>;
> +};
> +};
> +
> +port@1 {
> +reg = <1>;
> +mhl_to_musb_con: endpoint {
> +remote-endpoint = <_con_to_mhl>;
> +};
> +};
> +};
> +};
> +};
> diff --git a/Documentation/devicetree/bindings/display/bridge/sil-sii8620.txt 
> b/Documentation/devicetree/bindings/display/bridge/sil-sii8620.txt
> deleted file mode 100644
> index b05052f7d62f..
> --- a/Documentation/devicetree/bindings/display/bridge/sil-sii8620.txt
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -Silicon Image SiI8620 HDMI/MHL bridge bindings
> -
> -Required properties:
> - - compatible: "sil,sii8620"
> - - reg: i2c address of the bridge
> - - cvcc10-supply: Digital Core Supply Voltage (1.0V)
> - - iovcc18-supply: I/O Supply Voltage (1.8V)
> - - interrupts: interrupt specifier of INT pin
> - - reset-gpios: gpio specifier of RESET pin
> - - clocks, clock-names: specification and name of "xtal" clock
> - - video interfaces: Device node can contain video interface port
> - node for HDMI encoder according to [1].
> -
> -[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
> -
> -Example:
> - sii8620@39 {
> - reg = <0x39>;
> - compatible = "sil,sii8620";
> - cvcc10-supply = <_reg>;
> - iovcc18-supply = <_reg>;
> - interrupt-parent = <>;
> - interrupts = <2 0>;
> - reset-gpio = < 0 0>;
> - clocks = <_system_controller 0>;
> - clock-names = "xtal";
> -
> - port {
> - mhl_to_hdmi: endpoint {
> - remote-endpoint = <_to_mhl>;
> - };
> - };
> -   

Re: [PATCH 1/5] drm/amd/amdgpu revert "implement tdr advanced mode"

2023-01-28 Thread Yin, ZhenGuo (Chris)

Hi, Christian

A later bad compute job can block a good gfx job, so the original TDR 
design find a wrong guilty job(good gfx job).


Advanced TDR re-submits jobs in order to find the real guilty job(bad 
compute job).


After reverting this commit, how does the new gang-submit promise the 
isolation between compute jobs and gfx jobs?


On 10/26/2022 11:35 PM, Christian König wrote:

This reverts commit e6c6338f393b74ac0b303d567bb918b44ae7ad75.

This feature basically re-submits one job after another to
figure out which one was the one causing a hang.

This is obviously incompatible with gang-submit which requires
that multiple jobs run at the same time. It's also absolutely
not helpful to crash the hardware multiple times if a clean
recovery is desired.

For testing and debugging environments we should rather disable
recovery alltogether to be able to inspect the state with a hw
debugger.

Additional to that the sw implementation is clearly buggy and causes
reference count issues for the hardware fence.

Signed-off-by: Christian König 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 103 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c|   2 +-
  drivers/gpu/drm/scheduler/sched_main.c |  58 ++--
  include/drm/gpu_scheduler.h|   3 -
  4 files changed, 10 insertions(+), 156 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 6f958603c8cc..d4584e577b51 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -5070,94 +5070,6 @@ static int amdgpu_device_suspend_display_audio(struct 
amdgpu_device *adev)
return 0;
  }
  
-static void amdgpu_device_recheck_guilty_jobs(

-   struct amdgpu_device *adev, struct list_head *device_list_handle,
-   struct amdgpu_reset_context *reset_context)
-{
-   int i, r = 0;
-
-   for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
-   struct amdgpu_ring *ring = adev->rings[i];
-   int ret = 0;
-   struct drm_sched_job *s_job;
-
-   if (!ring || !ring->sched.thread)
-   continue;
-
-   s_job = list_first_entry_or_null(>sched.pending_list,
-   struct drm_sched_job, list);
-   if (s_job == NULL)
-   continue;
-
-   /* clear job's guilty and depend the folowing step to decide 
the real one */
-   drm_sched_reset_karma(s_job);
-   drm_sched_resubmit_jobs_ext(>sched, 1);
-
-   if (!s_job->s_fence->parent) {
-   DRM_WARN("Failed to get a HW fence for job!");
-   continue;
-   }
-
-   ret = dma_fence_wait_timeout(s_job->s_fence->parent, false, 
ring->sched.timeout);
-   if (ret == 0) { /* timeout */
-   DRM_ERROR("Found the real bad job! ring:%s, 
job_id:%llx\n",
-   ring->sched.name, s_job->id);
-
-
-   amdgpu_fence_driver_isr_toggle(adev, true);
-
-   /* Clear this failed job from fence array */
-   amdgpu_fence_driver_clear_job_fences(ring);
-
-   amdgpu_fence_driver_isr_toggle(adev, false);
-
-   /* Since the job won't signal and we go for
-* another resubmit drop this parent pointer
-*/
-   dma_fence_put(s_job->s_fence->parent);
-   s_job->s_fence->parent = NULL;
-
-   /* set guilty */
-   drm_sched_increase_karma(s_job);
-   amdgpu_reset_prepare_hwcontext(adev, reset_context);
-retry:
-   /* do hw reset */
-   if (amdgpu_sriov_vf(adev)) {
-   amdgpu_virt_fini_data_exchange(adev);
-   r = amdgpu_device_reset_sriov(adev, false);
-   if (r)
-   adev->asic_reset_res = r;
-   } else {
-   clear_bit(AMDGPU_SKIP_HW_RESET,
- _context->flags);
-   r = amdgpu_do_asic_reset(device_list_handle,
-reset_context);
-   if (r && r == -EAGAIN)
-   goto retry;
-   }
-
-   /*
-* add reset counter so that the following
-* resubmitted job could flush vmid
-*/
-   atomic_inc(>gpu_reset_counter);
-   continue;
-   }
-
-   /* got the hw fence, signal finished fence */
-   

Re: [PATCH] drm/nouveau/mmu: fix Use after Free bug in nvkm_vmm_node_split

2023-01-28 Thread Takashi Iwai
On Sat, 28 Jan 2023 03:17:15 +0100,
Danilo Krummrich wrote:
> 
> On Fri, Jan 27, 2023 at 01:10:46PM +0100, Takashi Iwai wrote:
> > On Tue, 03 Jan 2023 15:07:55 +0100,
> > Takashi Iwai wrote:
> > > 
> > > On Fri, 30 Dec 2022 08:27:58 +0100,
> > > Zheng Wang wrote:
> > > > 
> > > > Here is a function call chain.
> > > > nvkm_vmm_pfn_map->nvkm_vmm_pfn_split_merge->nvkm_vmm_node_split
> > > > If nvkm_vma_tail return NULL in nvkm_vmm_node_split, it will
> > > > finally invoke nvkm_vmm_node_merge->nvkm_vmm_node_delete, which
> > > > will free the vma. However, nvkm_vmm_pfn_map didn't notice that.
> > > > It goes into next label and UAF happens.
> > > > 
> > > > Fix it by returning the return-value of nvkm_vmm_node_merge
> > > > instead of NULL.
> > > > 
> > > > Signed-off-by: Zheng Wang 
> > > 
> > > FWIW, CVE-2023-0030 has been assigned to this bug.
> > > It's a question whether it really deserves as a security issue, but a
> > > bug is a bug...
> > > 
> > > Ben, could you review this please?
> > 
> > A gentle ping as reminder.  The bug is still present.
> 
> This was also reported in [1]. I had a closer look and FWICT this code is fine
> and there isn't a bug.
> 
> Zheng Wang, the reporter of the BZ, also confirmed this to be a false positive
> from CodeQL.
> 
> Anyway, here's the explaination I also posted in the BZ:
> 
> "In nvkm_vmm_node_merge() nvkm_vmm_node_delete() is only called when prev is
> set. However, prev is NULL unless we enter the "if (vma->addr != addr)" path 
> in
> nvkm_vmm_node_split(). In such a case the vma pointer, which is also passed to
> nvkm_vmm_node_merge(), is set to a freshly allocated struct nvkm_vma with
> nvkm_vma_tail() right before prev is set to the old vma pointer.
> 
> Hence, the only thing happening there when nvkm_vma_tail() fails in the
> "if (vma->size != size)" path is that either nvkm_vmm_node_merge() does 
> nothing
> in case prev wasn't set or it merges and frees the new vma created in the
> "if (vma->addr != addr)" path. Or in other words the proper cleanup for the
> error condition is done.
> 
> I can't see any case where the original vma pointer given by 
> nvkm_vmm_pfn_map()
> is actually freed."
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=2157041

Thanks for the information!  Then we should try to dispute the CVE.
I'll ask our security team.


Takashi

> 
> - Danilo
> 
> > 
> > 
> > thanks,
> > 
> > Takashi
> > 
> > > 
> > > 
> > > thanks,
> > > 
> > > Takashi
> > > 
> > > > ---
> > > >  drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c 
> > > > b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> > > > index ae793f400ba1..84d6fc87b2e8 100644
> > > > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> > > > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c
> > > > @@ -937,8 +937,8 @@ nvkm_vmm_node_split(struct nvkm_vmm *vmm,
> > > > if (vma->size != size) {
> > > > struct nvkm_vma *tmp;
> > > > if (!(tmp = nvkm_vma_tail(vma, vma->size - size))) {
> > > > -   nvkm_vmm_node_merge(vmm, prev, vma, NULL, 
> > > > vma->size);
> > > > -   return NULL;
> > > > +   tmp = nvkm_vmm_node_merge(vmm, prev, vma, NULL, 
> > > > vma->size);
> > > > +   return tmp;
> > > > }
> > > > tmp->part = true;
> > > > nvkm_vmm_node_insert(vmm, tmp);
> > > > -- 
> > > > 2.25.1
> > > > 
> > 
> 


Re: [PATCH] gpu: host1x: fix uninitialized variable use

2023-01-28 Thread Mikko Perttunen

On 1/28/23 01:18, Nathan Chancellor wrote:

On Fri, Jan 27, 2023 at 11:14:00PM +0100, Arnd Bergmann wrote:

From: Arnd Bergmann 

The error handling for platform_get_irq() failing no longer
works after a recent change, clang now points this out with
a warning:

drivers/gpu/host1x/dev.c:520:6: error: variable 'syncpt_irq' is uninitialized 
when used here [-Werror,-Wuninitialized]
 if (syncpt_irq < 0)
 ^~

Fix this by removing the variable and checking the correct
error status.

Fixes: 625d4ffb438c ("gpu: host1x: Rewrite syncpoint interrupt handling")
Signed-off-by: Arnd Bergmann 


I had the same diff pending but civic duty called today :)

Reviewed-by: Nathan Chancellor 


---
  drivers/gpu/host1x/dev.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 4872d183d860..aae2efeef503 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -487,7 +487,6 @@ static int host1x_get_resets(struct host1x *host)
  static int host1x_probe(struct platform_device *pdev)
  {
struct host1x *host;
-   int syncpt_irq;
int err;
  
  	host = devm_kzalloc(>dev, sizeof(*host), GFP_KERNEL);

@@ -517,8 +516,8 @@ static int host1x_probe(struct platform_device *pdev)
}
  
  	host->syncpt_irq = platform_get_irq(pdev, 0);

-   if (syncpt_irq < 0)
-   return syncpt_irq;
+   if (host->syncpt_irq < 0)
+   return host->syncpt_irq;
  
  	mutex_init(>devices_lock);

INIT_LIST_HEAD(>devices);
--
2.39.0



Thanks both for the fix :)

FWIW,

Reviewed-by: Mikko Perttunen