[Bug 216359] New: [amdgpu] ring gfx timeout after waking from suspend and exiting X

2022-08-13 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=216359

Bug ID: 216359
   Summary: [amdgpu] ring gfx timeout after waking from suspend
and exiting X
   Product: Drivers
   Version: 2.5
Kernel Version: 5.18.13, 5.19.1
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-...@kernel-bugs.osdl.org
  Reporter: shl...@fastmail.com
CC: alexdeuc...@gmail.com
Regression: Yes

After waking up from suspend and exiting X (and trying to switch to a different
tty, but I think the bug happens before that), I get:

Aug 14 08:27:21 up kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx
timeout, but soft recovered
Aug 14 08:27:31 up kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx
timeout, but soft recovered
Aug 14 08:27:42 up kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx
timeout, but soft recovered

The screen freezes, and I have to reboot to get a stable system.

Arch Linux 5.18.12.arch1-1 is good.
Arch Linux 5.18.14.arch1-1 is bad.
Arch Linux 5.18.15.arch1-1 is bad.
Arch Linux 5.18.16.arch1-1 is bad.
Arch Linux 5.19.1.arch2-1 is bad.

4ffcacab7145080187330accafae69e87a481eec is the first bad commit
commit 4ffcacab7145080187330accafae69e87a481eec
Author: Alex Deucher 
Date:   Tue Jun 21 10:10:37 2022 -0400

drm/amdgpu/display: disable prefer_shadow for generic fb helpers

[ Upstream commit 3a4b1cc28fbdc2325b3e3ed7d8024995a75f9216 ]

Seems to break hibernation.  Disable for now until we can root
cause it.

Fixes: 087451f372bf ("drm/amdgpu: use generic fb helpers instead of setting
up AMD own's.")
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=216119
Acked-by: Evan Quan 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 

 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c  | 3 ++-
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c| 3 ++-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c| 3 ++-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 3 ++-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 6 files changed, 12 insertions(+), 6 deletions(-)

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

Re: [PATCH 1/1] tee: new ioctl to a register tee_shm from a dmabuf file descriptor

2022-08-13 Thread kernel test robot
Hi Olivier,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.19 next-20220812]
[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/Olivier-Masse/tee-Add-tee_shm_register_fd/20220812-223302
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
config: arm-randconfig-r026-20220814 
(https://download.01.org/0day-ci/archive/20220814/202208140900.tnsqfbzy-...@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 
3329cec2f79185bafd678f310fafadba2a8c76d2)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# 
https://github.com/intel-lab-lkp/linux/commit/994ce362c3244904f79f1e7d4cb436ea162421d1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Olivier-Masse/tee-Add-tee_shm_register_fd/20220812-223302
git checkout 994ce362c3244904f79f1e7d4cb436ea162421d1
# 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=arm 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 >>, old ones prefixed by <<):

ERROR: modpost: "__aeabi_uldivmod" [drivers/mtd/mtdswap.ko] undefined!
>> ERROR: modpost: module tee uses symbol dma_buf_get from namespace DMA_BUF, 
>> but does not import it.
>> ERROR: modpost: module tee uses symbol dma_buf_attach from namespace 
>> DMA_BUF, but does not import it.
>> ERROR: modpost: module tee uses symbol dma_buf_map_attachment from namespace 
>> DMA_BUF, but does not import it.
>> ERROR: modpost: module tee uses symbol dma_buf_unmap_attachment from 
>> namespace DMA_BUF, but does not import it.
>> ERROR: modpost: module tee uses symbol dma_buf_detach from namespace 
>> DMA_BUF, but does not import it.
>> ERROR: modpost: module tee uses symbol dma_buf_put from namespace DMA_BUF, 
>> but does not import it.

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

2022-08-13 Thread kernel test robot
Hi Markuss,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on efi/next staging/staging-testing usb/usb-testing 
linus/master v5.19 next-20220812]
[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/Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git 
tty-testing
config: loongarch-randconfig-s031-20220807 
(https://download.01.org/0day-ci/archive/20220814/202208140705.bu9i1c1t-...@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# 
https://github.com/intel-lab-lkp/linux/commit/97dfc2aa69b065de769a191352afe2099c52fedb
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
git checkout 97dfc2aa69b065de769a191352afe2099c52fedb
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch 
SHELL=/bin/bash drivers/video/console/

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

sparse warnings: (new ones prefixed by >>)
>> drivers/video/console/earlycon.c:43:24: sparse: sparse: incorrect type in 
>> assignment (different address spaces) @@ expected void [noderef] __iomem 
>> *static [toplevel] virt_base @@ got void * @@
   drivers/video/console/earlycon.c:43:24: sparse: expected void [noderef] 
__iomem *static [toplevel] virt_base
   drivers/video/console/earlycon.c:43:24: sparse: got void *
>> drivers/video/console/earlycon.c:53:30: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@ expected void *addr @@ got 
>> void [noderef] __iomem *static [toplevel] virt_base @@
   drivers/video/console/earlycon.c:53:30: sparse: expected void *addr
   drivers/video/console/earlycon.c:53:30: sparse: got void [noderef] 
__iomem *static [toplevel] virt_base
>> drivers/video/console/earlycon.c:63:39: sparse: sparse: incorrect type in 
>> return expression (different address spaces) @@ expected void * @@ 
>> got void [noderef] __iomem * @@
   drivers/video/console/earlycon.c:63:39: sparse: expected void *
   drivers/video/console/earlycon.c:63:39: sparse: got void [noderef] 
__iomem *
>> drivers/video/console/earlycon.c:74:24: sparse: sparse: incorrect type in 
>> argument 1 (different address spaces) @@ expected void [noderef] __iomem 
>> *addr @@ got void *addr @@
   drivers/video/console/earlycon.c:74:24: sparse: expected void [noderef] 
__iomem *addr
   drivers/video/console/earlycon.c:74:24: sparse: got void *addr

vim +43 drivers/video/console/earlycon.c

29  
30  static int __init simplefb_earlycon_remap_fb(void)
31  {
32  unsigned long mapping;
33  /* bail if there is no bootconsole or it has been disabled 
already */
34  if (!earlycon_console || !(earlycon_console->flags & 
CON_ENABLED))
35  return 0;
36  
37  if (region_intersects(info.phys_base, info.size,
38IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE) 
== REGION_INTERSECTS) 
39  mapping = MEMREMAP_WB;
40  else
41  mapping = MEMREMAP_WC;
42  
  > 43  info.virt_base = memremap(info.phys_base, info.size, mapping);
44  
45  return info.virt_base ? 0 : -ENOMEM;
46  }
47  early_initcall(simplefb_earlycon_remap_fb);
48  
49  static int __init simplefb_earlycon_unmap_fb(void)
50  {
51  /* unmap the bootconsole fb unless keep_bootcon has left it 
enabled */
52  if (info.virt_base && !(earlycon_console->flags & CON_ENABLED))
  > 53  memunmap(info.virt_base);
54  return 0;
55  }
56  late_initcall(simplefb_earlycon_unmap_fb);
57  
58  static __ref void *simplefb_earlycon_map(unsigned long start, unsigned 
long len)
59  {
60  pgprot_t fb_prot;
61  
62  if (info.virt_base)
  > 63  return info.virt_base + start;
64  
65  fb_prot = PAGE_KERNEL;
66  return early_memremap_prot(info.phys_base + start, len, 

[PATCH] checkpatch: Add kmap and kmap_atomic to the deprecated list

2022-08-13 Thread ira . weiny
From: Ira Weiny 

kmap() and kmap_atomic() are being deprecated in favor of
kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead
as mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when
the kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

kmap_local_page() is safe from any context and is therefore redundant
with kmap_atomic() with the exception of any pagefault or preemption
disable requirements.  However, using kmap_atomic() for these side
effects makes the code less clear.  So any requirement for pagefault or
preemption disable should be made explicitly.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again,
the kernel virtual addresses are restored.

Suggested-by: Thomas Gleixner 
Suggested-by: Fabio M. De Francesco 
Signed-off-by: Ira Weiny 

---
Suggested by credits.
Thomas: Idea to keep from growing more kmap/kmap_atomic calls.
Fabio: Stole some of his boiler plate commit message.

Notes on tree-wide conversions:

I've cc'ed mailing lists for subsystems which currently contains either kmap()
or kmap_atomic() calls.  As some of you already know Fabio and I have been
working through converting kmap() calls to kmap_local_page().  But there is a
lot more work to be done.  Help from the community is always welcome,
especially with kmap_atomic() conversions.  To keep from stepping on each
others toes I've created a spreadsheet of the current calls[1].  Please let me
or Fabio know if you plan on tacking one of the conversions so we can mark it
off the list.

[1] 
https://docs.google.com/spreadsheets/d/1i_ckZ10p90bH_CkxD2bYNi05S2Qz84E2OFPv8zq__0w/edit#gid=1679714357

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543..9ff219e0a9d5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -807,6 +807,8 @@ our %deprecated_apis = (
"rcu_barrier_sched" => "rcu_barrier",
"get_state_synchronize_sched"   => "get_state_synchronize_rcu",
"cond_synchronize_sched"=> "cond_synchronize_rcu",
+   "kmap"  => "kmap_local_page",
+   "kmap_atomic"   => "kmap_local_page",
 );
 
 #Create a search pattern for all these strings to speed up a loop below

base-commit: 4a9350597aff50bbd0f4b80ccf49d2e02df5
-- 
2.35.3



[drm-misc:drm-misc-next 2/18] drivers/gpu/drm/tiny/simpledrm.c:514:32: sparse: sparse: incorrect type in initializer (different address spaces)

2022-08-13 Thread kernel test robot
tree:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head:   3bd86801c84f66b4abedde4078e5237937b7576b
commit: 71bf55872cbe035820a87b2aa5fc1dc60678abfa [2/18] drm/format-helper: 
Provide drm_fb_blit()
config: x86_64-randconfig-s022 
(https://download.01.org/0day-ci/archive/20220814/202208140534.aujeaya5-...@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
git remote add drm-misc git://anongit.freedesktop.org/drm/drm-misc
git fetch --no-tags drm-misc drm-misc-next
git checkout 71bf55872cbe035820a87b2aa5fc1dc60678abfa
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir 
ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/tiny/

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

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/tiny/simpledrm.c:514:32: sparse: sparse: incorrect type in 
>> initializer (different address spaces) @@ expected void *vaddr @@ 
>> got void [noderef] __iomem *screen_base @@
   drivers/gpu/drm/tiny/simpledrm.c:514:32: sparse: expected void *vaddr
   drivers/gpu/drm/tiny/simpledrm.c:514:32: sparse: got void [noderef] 
__iomem *screen_base

vim +514 drivers/gpu/drm/tiny/simpledrm.c

   504  
   505  static void simpledrm_primary_plane_helper_atomic_update(struct 
drm_plane *plane,
   506   struct 
drm_atomic_state *old_state)
   507  {
   508  struct drm_plane_state *plane_state = plane->state;
   509  struct drm_plane_state *old_plane_state = 
drm_atomic_get_old_plane_state(old_state, plane);
   510  struct drm_shadow_plane_state *shadow_plane_state = 
to_drm_shadow_plane_state(plane_state);
   511  struct drm_framebuffer *fb = plane_state->fb;
   512  struct drm_device *dev = plane->dev;
   513  struct simpledrm_device *sdev = simpledrm_device_of_dev(dev);
 > 514  struct iosys_map dst = IOSYS_MAP_INIT_VADDR(sdev->screen_base);
   515  struct drm_rect src_clip, dst_clip;
   516  int idx;
   517  
   518  if (!fb)
   519  return;
   520  
   521  if (!drm_atomic_helper_damage_merged(old_plane_state, 
plane_state, _clip))
   522  return;
   523  
   524  dst_clip = plane_state->dst;
   525  if (!drm_rect_intersect(_clip, _clip))
   526  return;
   527  
   528  if (!drm_dev_enter(dev, ))
   529  return;
   530  
   531  iosys_map_incr(, drm_fb_clip_offset(sdev->pitch, 
sdev->format, _clip));
   532  drm_fb_blit(, >pitch, sdev->format->format, 
shadow_plane_state->data, fb,
   533  _clip);
   534  
   535  drm_dev_exit(idx);
   536  }
   537  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


Re: [PATCH v7 06/13] dt-bindings: mfd: Add MediaTek MT6370

2022-08-13 Thread Jonathan Cameron
On Tue, 9 Aug 2022 14:14:14 +0100
Lee Jones  wrote:

> On Fri, 05 Aug 2022, ChiaEn Wu wrote:
> 
> > From: ChiYuan Huang 
> > 
> > Add MediaTek MT6370 binding documentation.
> > 
> > Reviewed-by: Krzysztof Kozlowski 
> > Signed-off-by: ChiYuan Huang 
> > Signed-off-by: ChiaEn Wu 
> > ---
> >  .../devicetree/bindings/mfd/mediatek,mt6370.yaml   | 280 
> > +
> >  include/dt-bindings/iio/adc/mediatek,mt6370_adc.h  |  18 ++
> >  2 files changed, 298 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/mfd/mediatek,mt6370.yaml
> >  create mode 100644 include/dt-bindings/iio/adc/mediatek,mt6370_adc.h  
> 
> Applied, thanks.
> 
Hi Lee,

The iio: adc: patch is dependent on this (due to the binding header) -
so either you should pick that up as well, or it'll get delayed until what
you've picked up is available upstream - or I guess some hackery to allow them
to go via different trees and flip to the header only once all the prior steps
are in place.

Note I'd messed up sending an Ack on the ADC patch which I've now fixed.

Thanks,

Jonathan




Re: [PATCH v7 09/13] iio: adc: mt6370: Add MediaTek MT6370 support

2022-08-13 Thread Jonathan Cameron
On Fri, 5 Aug 2022 12:54:04 +0200
Andy Shevchenko  wrote:

> On Fri, Aug 5, 2022 at 9:07 AM ChiaEn Wu  wrote:
> >
> > From: ChiaEn Wu 
> >
> > MediaTek MT6370 is a SubPMIC consisting of a single cell battery charger
> > with ADC monitoring, RGB LEDs, dual channel flashlight, WLED backlight
> > driver, display bias voltage supply, one general purpose LDO, and the
> > USB Type-C & PD controller complies with the latest USB Type-C and PD
> > standards.
> >
> > Add a support for the MT6370 ADC driver for system monitoring, including
> > charger current, voltage, and temperature.  
> 
> On Fri, Aug 5, 2022 at 9:07 AM ChiaEn Wu  wrote:
> >
> > From: ChiYuan Huang 
> >
> > The MediaTek MT6370 is a highly-integrated smart power management IC,
> > which includes a single cell Li-Ion/Li-Polymer switching battery
> > charger, a USB Type-C & Power Delivery (PD) controller, dual
> > Flash LED current sources, a RGB LED driver, a backlight WLED driver,
> > a display bias driver and a general LDO for portable devices.
> >
> > Add a support for the Type-C & Power Delivery controller in
> > MediaTek MT6370 IC.  
> 
> Reviewed-by: Andy Shevchenko 
Oops. I just noticed I replied only to Andy due to a misclick.

Acked-by: Jonathan Cameron 

I took a quick glance through, and with Andy's comments now all answered
to his satisfaction I'm fine with this going through the MFD tree
(or another path if one makes more sense).

Thanks to Andy for his reviewing effort on this one!

Note that because of the bindings header I think this has a build dependency on 
the
MFD binding patch.

Jonathan


> 
> > Reviewed-by: AngeloGioacchino Del Regno 
> > 
> > Signed-off-by: ChiaEn Wu 
> > ---
> >
> > v7
> > - Add AICR(100mA ~ 350mA), ICHG(100mA ~ 800mA) macros
> > - Remove 400mA AICR and 900mA ICHG macros
> > - Revise using 'if-else' to 'switch-case' in mt6370_adc_read_scale()
> >   where the adc channel is ibus or ibat
> > ---
> >  drivers/iio/adc/Kconfig  |  12 ++
> >  drivers/iio/adc/Makefile |   1 +
> >  drivers/iio/adc/mt6370-adc.c | 305 
> > +++
> >  3 files changed, 318 insertions(+)
> >  create mode 100644 drivers/iio/adc/mt6370-adc.c
> >
> > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> > index 7fe5930..995cbb5 100644
> > --- a/drivers/iio/adc/Kconfig
> > +++ b/drivers/iio/adc/Kconfig
> > @@ -736,6 +736,18 @@ config MEDIATEK_MT6360_ADC
> >   is used in smartphones and tablets and supports a 11 channel
> >   general purpose ADC.
> >
> > +config MEDIATEK_MT6370_ADC
> > +   tristate "MediaTek MT6370 ADC driver"
> > +   depends on MFD_MT6370
> > +   help
> > + Say yes here to enable MediaTek MT6370 ADC support.
> > +
> > + This ADC driver provides 9 channels for system monitoring (charger
> > + current, voltage, and temperature).
> > +
> > + This driver can also be built as a module. If so, the module
> > + will be called "mt6370-adc".
> > +
> >  config MEDIATEK_MT6577_AUXADC
> > tristate "MediaTek AUXADC driver"
> > depends on ARCH_MEDIATEK || COMPILE_TEST
> > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
> > index 1772a54..c6bc35f 100644
> > --- a/drivers/iio/adc/Makefile
> > +++ b/drivers/iio/adc/Makefile
> > @@ -68,6 +68,7 @@ obj-$(CONFIG_MCP320X) += mcp320x.o
> >  obj-$(CONFIG_MCP3422) += mcp3422.o
> >  obj-$(CONFIG_MCP3911) += mcp3911.o
> >  obj-$(CONFIG_MEDIATEK_MT6360_ADC) += mt6360-adc.o
> > +obj-$(CONFIG_MEDIATEK_MT6370_ADC) += mt6370-adc.o
> >  obj-$(CONFIG_MEDIATEK_MT6577_AUXADC) += mt6577_auxadc.o
> >  obj-$(CONFIG_MEN_Z188_ADC) += men_z188_adc.o
> >  obj-$(CONFIG_MESON_SARADC) += meson_saradc.o
> > diff --git a/drivers/iio/adc/mt6370-adc.c b/drivers/iio/adc/mt6370-adc.c
> > new file mode 100644
> > index 000..2a46471
> > --- /dev/null
> > +++ b/drivers/iio/adc/mt6370-adc.c
> > @@ -0,0 +1,305 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Copyright (C) 2022 Richtek Technology Corp.
> > + *
> > + * Author: ChiaEn Wu 
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include 
> > +
> > +#define MT6370_REG_CHG_CTRL3   0x113
> > +#define MT6370_REG_CHG_CTRL7   0x117
> > +#define MT6370_REG_CHG_ADC 0x121
> > +#define MT6370_REG_ADC_DATA_H  0x14C
> > +
> > +#define MT6370_ADC_START_MASK  BIT(0)
> > +#define MT6370_ADC_IN_SEL_MASK GENMASK(7, 4)
> > +#define MT6370_AICR_ICHG_MASK  GENMASK(7, 2)
> > +
> > +#define MT6370_AICR_100_mA 0x0
> > +#define MT6370_AICR_150_mA 0x1
> > +#define MT6370_AICR_200_mA 0x2
> > +#define MT6370_AICR_250_mA 0x3
> > +#define MT6370_AICR_300_mA 0x4
> > +#define MT6370_AICR_350_mA 0x5
> > +
> > +#define MT6370_ICHG_100_mA 0x0
> > 

[PATCH] drm/amd/display: Unneeded semicolon

2022-08-13 Thread min tang
There is no semicolon after '}' in line 510.

Signed-off-by: min tang 
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c 
b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
index 27501b735a9c..c87cf8771c6d 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
@@ -505,7 +505,7 @@ static void dcn315_clk_mgr_helper_populate_bw_params(
bw_params->clk_table.entries[i].dispclk_mhz = 
clock_table->DispClocks[i];
bw_params->clk_table.entries[i].dppclk_mhz = 
clock_table->DppClocks[i];
bw_params->clk_table.entries[i].wck_ratio = 1;
-   };
+   }
 
/* Make sure to include at least one entry and highest pstate */
if (max_pstate != min_pstate || i == 0) {
-- 
2.17.1



[PATCH] drm/i915/gt: Unneeded semicolon

2022-08-13 Thread min tang
There is no semicolon after '}' in line 648.

Signed-off-by: min tang 
---
 drivers/gpu/drm/i915/gt/intel_migrate.c | 2 +-
 tools/power/x86/intel-speed-select/hfi-events.c | 2 +-
 tools/testing/selftests/timers/nanosleep.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c 
b/drivers/gpu/drm/i915/gt/intel_migrate.c
index 2c35324b5f68..a69b244f14d0 100644
--- a/drivers/gpu/drm/i915/gt/intel_migrate.c
+++ b/drivers/gpu/drm/i915/gt/intel_migrate.c
@@ -645,7 +645,7 @@ static int scatter_list_length(struct scatterlist *sg)
while (sg && sg_dma_len(sg)) {
len += sg_dma_len(sg);
sg = sg_next(sg);
-   };
+   }
 
return len;
 }
diff --git a/tools/power/x86/intel-speed-select/hfi-events.c 
b/tools/power/x86/intel-speed-select/hfi-events.c
index 761375062505..f0ed69721308 100644
--- a/tools/power/x86/intel-speed-select/hfi-events.c
+++ b/tools/power/x86/intel-speed-select/hfi-events.c
@@ -144,7 +144,7 @@ static int family_handler(struct nl_msg *msg, void *arg)
continue;
res->id = nla_get_u32(tb2[CTRL_ATTR_MCAST_GRP_ID]);
break;
-   };
+   }
 
return 0;
 }
diff --git a/tools/testing/selftests/timers/nanosleep.c 
b/tools/testing/selftests/timers/nanosleep.c
index 71b5441c2fd9..433a09676aeb 100644
--- a/tools/testing/selftests/timers/nanosleep.c
+++ b/tools/testing/selftests/timers/nanosleep.c
@@ -72,7 +72,7 @@ char *clockstring(int clockid)
return "CLOCK_BOOTTIME_ALARM";
case CLOCK_TAI:
return "CLOCK_TAI";
-   };
+   }
return "UNKNOWN_CLOCKID";
 }
 
-- 
2.17.1



[PATCH] drm/amd/display: Fix comment typo

2022-08-13 Thread min tang
The double `aligned' is duplicated in line 1070, remove one.

Signed-off-by: min tang 
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
index b1671b00ce40..0844b3eeb291 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_optc.c
@@ -1066,7 +1066,7 @@ static void optc1_set_test_pattern(
src_color[index] >> (src_bpc - dst_bpc);
/* CRTC_TEST_PATTERN_DATA has 16 bits,
 * lowest 6 are hardwired to ZERO
-* color bits should be left aligned aligned to MSB
+* color bits should be left aligned to MSB
 * XX00 for 10 bit,
 *  for 8 bit and XX00 for 6
 */
-- 
2.17.1



Re: [PATCH AUTOSEL 5.10 05/46] drm/panfrost: Handle HW_ISSUE_TTRX_2968_TTRX_3162

2022-08-13 Thread Pavel Machek
Hi!

> From: Alyssa Rosenzweig 
> 
> [ Upstream commit 382435709516c1a7dc3843872792abf95e786c83 ]
> 
> Add handling for the HW_ISSUE_TTRX_2968_TTRX_3162 quirk. Logic ported
> from kbase. kbase lists this workaround as used on Mali-G57.

AFAICT this quirk is not used anywhere in 5.10, and its users are not
queued. We don't need this in 5.10.

Best regards,
Pavel
-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


signature.asc
Description: PGP signature


Re: [syzbot] BUG: unable to handle kernel paging request in bitfill_aligned (3)

2022-08-13 Thread syzbot
syzbot has found a reproducer for the following issue on:

HEAD commit:7ebfc85e2cd7 Merge tag 'net-6.0-rc1' of git://git.kernel.o..
git tree:   upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=179c3aa508
kernel config:  https://syzkaller.appspot.com/x/.config?x=20bc0b329895d963
dashboard link: https://syzkaller.appspot.com/bug?extid=a168dbeaaa7778273c1b
compiler:   Debian clang version 
13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU 
Binutils for Debian) 2.35.2
syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=16e0ef4b08
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11a1183d08

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

BUG: unable to handle page fault for address: c900043a1000
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 1267 P4D 1267 PUD 121c9067 PMD 14733a067 PTE 0
Oops: 0002 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 3633 Comm: syz-executor339 Not tainted 
5.19.0-syzkaller-13930-g7ebfc85e2cd7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
07/22/2022
RIP: 0010:memset64 arch/x86/include/asm/string_64.h:49 [inline]
RIP: 0010:memset_l include/linux/string.h:128 [inline]
RIP: 0010:bitfill_aligned+0x1ad/0x270 drivers/video/fbdev/core/sysfillrect.c:53
Code: 08 49 31 ef eb 66 e8 52 38 03 fd 45 89 e6 4c 8b 64 24 10 44 89 f0 31 d2 
f7 f3 89 c3 48 8b 6c 24 08 48 89 e8 4c 89 e7 48 89 d9  48 ab 31 ff 44 89 ee 
e8 46 3c 03 fd 4d 85 ed 74 5f 4d 8d 24 dc
RSP: 0018:c90003a6f7e8 EFLAGS: 00010246
RAX:  RBX: 0ffc RCX: 01fc
RDX:  RSI:  RDI: c900043a1000
RBP:  R08: 848659ae R09: 0040
R10: 0002 R11: 888021ffd880 R12: c9000439a000
R13:  R14: 0003ff00 R15: 
FS:  56df7300() GS:8880b9b0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: c900043a1000 CR3: 72ba CR4: 003506e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 
 sys_fillrect+0x5ce/0x7f0 drivers/video/fbdev/core/sysfillrect.c:281
 drm_fb_helper_sys_fillrect drivers/gpu/drm/drm_fb_helper.c:807 [inline]
 drm_fbdev_fb_fillrect+0x163/0x300 drivers/gpu/drm/drm_fb_helper.c:2322
 bit_clear_margins+0x3f1/0x6e0 drivers/video/fbdev/core/bitblit.c:232
 fbcon_clear_margins drivers/video/fbdev/core/fbcon.c:1306 [inline]
 fbcon_do_set_font+0xd7c/0x1330 drivers/video/fbdev/core/fbcon.c:2431
 fbcon_set_font+0xc29/0xf70 drivers/video/fbdev/core/fbcon.c:2519
 con_font_set drivers/tty/vt/vt.c:4666 [inline]
 con_font_op+0xbe8/0x1070 drivers/tty/vt/vt.c:4710
 vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
 vt_ioctl+0x172e/0x1d00 drivers/tty/vt/vt_ioctl.c:752
 tty_ioctl+0x874/0xc60 drivers/tty/tty_io.c:2778
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7efe5924e239
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 00 00 90 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:7fffba970648 EFLAGS: 0246 ORIG_RAX: 0010
RAX: ffda RBX: 0001 RCX: 7efe5924e239
RDX: 2000 RSI: 4b72 RDI: 0004
RBP: 7fffba970660 R08: 0001 R09: 
R10:  R11: 0246 R12: 0005
R13: 7fffba97065c R14: 7fffba970680 R15: 7fffba970670
 
Modules linked in:
CR2: c900043a1000
---[ end trace  ]---
RIP: 0010:memset64 arch/x86/include/asm/string_64.h:49 [inline]
RIP: 0010:memset_l include/linux/string.h:128 [inline]
RIP: 0010:bitfill_aligned+0x1ad/0x270 drivers/video/fbdev/core/sysfillrect.c:53
Code: 08 49 31 ef eb 66 e8 52 38 03 fd 45 89 e6 4c 8b 64 24 10 44 89 f0 31 d2 
f7 f3 89 c3 48 8b 6c 24 08 48 89 e8 4c 89 e7 48 89 d9  48 ab 31 ff 44 89 ee 
e8 46 3c 03 fd 4d 85 ed 74 5f 4d 8d 24 dc
RSP: 0018:c90003a6f7e8 EFLAGS: 00010246
RAX:  RBX: 0ffc RCX: 01fc
RDX:  RSI:  RDI: c900043a1000
RBP:  R08: 848659ae R09: 0040
R10: 0002 R11: 888021ffd880 R12: c9000439a000
R13:  R14: 0003ff00 R15: 
FS:  56df7300() GS:8880b9b0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: c900043a1000 CR3: 

Patch "drm/hyperv-drm: Include framebuffer and EDID headers" has been added to the 5.19-stable tree

2022-08-13 Thread gregkh


This is a note to let you know that I've just added the patch titled

drm/hyperv-drm: Include framebuffer and EDID headers

to the 5.19-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 drm-hyperv-drm-include-framebuffer-and-edid-headers.patch
and it can be found in the queue-5.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From 009a3a52791f31c57d755a73f6bc66fbdd8bd76c Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann 
Date: Wed, 22 Jun 2022 10:34:13 +0200
Subject: drm/hyperv-drm: Include framebuffer and EDID headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Thomas Zimmermann 

commit 009a3a52791f31c57d755a73f6bc66fbdd8bd76c upstream.

Fix a number of compile errors by including the correct header
files. Examples are shown below.

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 
'hyperv_blit_to_vram_rect':
  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:25:48: error: invalid use of 
undefined type 'struct drm_framebuffer'
   25 | struct hyperv_drm_device *hv = to_hv(fb->dev);
  |^~

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 
'hyperv_connector_get_modes':
  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:59:17: error: implicit 
declaration of function 'drm_add_modes_noedid' 
[-Werror=implicit-function-declaration]
   59 | count = drm_add_modes_noedid(connector,
  | ^~~~

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:62:9: error: implicit 
declaration of function 'drm_set_preferred_mode'; did you mean 
'drm_mm_reserve_node'? [-Werror=implicit-function-declaration]
   62 | drm_set_preferred_mode(connector, hv->preferred_width,
  | ^~

Signed-off-by: Thomas Zimmermann 
Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video 
device")
Fixes: 720cf96d8fec ("drm: Drop drm_framebuffer.h from drm_crtc.h")
Fixes: 255490f9150d ("drm: Drop drm_edid.h from drm_crtc.h")
Cc: Deepak Rawat 
Cc: Thomas Zimmermann 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: linux-hyp...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc:  # v5.14+
Acked-by: Maxime Ripard 
Reviewed-by: Ville Syrjälä 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20220622083413.12573-1-tzimmerm...@suse.de
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/gpu/drm/hyperv/hyperv_drm_modeset.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
@@ -7,9 +7,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


Patches currently in stable-queue which might be from tzimmerm...@suse.de are

queue-5.19/drm-hyperv-drm-include-framebuffer-and-edid-headers.patch
queue-5.19/drm-fb-helper-fix-out-of-bounds-access.patch


Patch "drm/hyperv-drm: Include framebuffer and EDID headers" has been added to the 5.18-stable tree

2022-08-13 Thread gregkh


This is a note to let you know that I've just added the patch titled

drm/hyperv-drm: Include framebuffer and EDID headers

to the 5.18-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 drm-hyperv-drm-include-framebuffer-and-edid-headers.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From 009a3a52791f31c57d755a73f6bc66fbdd8bd76c Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann 
Date: Wed, 22 Jun 2022 10:34:13 +0200
Subject: drm/hyperv-drm: Include framebuffer and EDID headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Thomas Zimmermann 

commit 009a3a52791f31c57d755a73f6bc66fbdd8bd76c upstream.

Fix a number of compile errors by including the correct header
files. Examples are shown below.

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 
'hyperv_blit_to_vram_rect':
  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:25:48: error: invalid use of 
undefined type 'struct drm_framebuffer'
   25 | struct hyperv_drm_device *hv = to_hv(fb->dev);
  |^~

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 
'hyperv_connector_get_modes':
  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:59:17: error: implicit 
declaration of function 'drm_add_modes_noedid' 
[-Werror=implicit-function-declaration]
   59 | count = drm_add_modes_noedid(connector,
  | ^~~~

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:62:9: error: implicit 
declaration of function 'drm_set_preferred_mode'; did you mean 
'drm_mm_reserve_node'? [-Werror=implicit-function-declaration]
   62 | drm_set_preferred_mode(connector, hv->preferred_width,
  | ^~

Signed-off-by: Thomas Zimmermann 
Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video 
device")
Fixes: 720cf96d8fec ("drm: Drop drm_framebuffer.h from drm_crtc.h")
Fixes: 255490f9150d ("drm: Drop drm_edid.h from drm_crtc.h")
Cc: Deepak Rawat 
Cc: Thomas Zimmermann 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: linux-hyp...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc:  # v5.14+
Acked-by: Maxime Ripard 
Reviewed-by: Ville Syrjälä 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20220622083413.12573-1-tzimmerm...@suse.de
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/gpu/drm/hyperv/hyperv_drm_modeset.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
@@ -7,9 +7,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


Patches currently in stable-queue which might be from tzimmerm...@suse.de are

queue-5.18/drm-hyperv-drm-include-framebuffer-and-edid-headers.patch


Patch "drm/hyperv-drm: Include framebuffer and EDID headers" has been added to the 5.15-stable tree

2022-08-13 Thread gregkh


This is a note to let you know that I've just added the patch titled

drm/hyperv-drm: Include framebuffer and EDID headers

to the 5.15-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
 drm-hyperv-drm-include-framebuffer-and-edid-headers.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let  know about it.


>From 009a3a52791f31c57d755a73f6bc66fbdd8bd76c Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann 
Date: Wed, 22 Jun 2022 10:34:13 +0200
Subject: drm/hyperv-drm: Include framebuffer and EDID headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Thomas Zimmermann 

commit 009a3a52791f31c57d755a73f6bc66fbdd8bd76c upstream.

Fix a number of compile errors by including the correct header
files. Examples are shown below.

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 
'hyperv_blit_to_vram_rect':
  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:25:48: error: invalid use of 
undefined type 'struct drm_framebuffer'
   25 | struct hyperv_drm_device *hv = to_hv(fb->dev);
  |^~

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 
'hyperv_connector_get_modes':
  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:59:17: error: implicit 
declaration of function 'drm_add_modes_noedid' 
[-Werror=implicit-function-declaration]
   59 | count = drm_add_modes_noedid(connector,
  | ^~~~

  ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:62:9: error: implicit 
declaration of function 'drm_set_preferred_mode'; did you mean 
'drm_mm_reserve_node'? [-Werror=implicit-function-declaration]
   62 | drm_set_preferred_mode(connector, hv->preferred_width,
  | ^~

Signed-off-by: Thomas Zimmermann 
Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video 
device")
Fixes: 720cf96d8fec ("drm: Drop drm_framebuffer.h from drm_crtc.h")
Fixes: 255490f9150d ("drm: Drop drm_edid.h from drm_crtc.h")
Cc: Deepak Rawat 
Cc: Thomas Zimmermann 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: linux-hyp...@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc:  # v5.14+
Acked-by: Maxime Ripard 
Reviewed-by: Ville Syrjälä 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20220622083413.12573-1-tzimmerm...@suse.de
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/gpu/drm/hyperv/hyperv_drm_modeset.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
@@ -7,9 +7,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


Patches currently in stable-queue which might be from tzimmerm...@suse.de are

queue-5.15/drm-hyperv-drm-include-framebuffer-and-edid-headers.patch


Re: [PATCH v2 4/4] drm/format-helper: Add KUnit tests for drm_fb_xrgb8888_to_rgb565()

2022-08-13 Thread José Expósito
On Wed, Aug 10, 2022 at 09:41:18AM -0700, Daniel Latypov wrote:
> On Sun, Jul 17, 2022 at 10:01 AM José Expósito
>  wrote:
> >
> > José Expósito  wrote:
> > > I already fixed the warning and added the reviewed by tags, however, I
> > > noticed that rebasing the series on the latest drm-misc-next show this
> > > error:
> > > [...]
> >
> > Sorry for the extra email. I forgot to mention that the error is only
> > present in UML. Running in other architectures works as expected.
> > Tested on x86_64 and PowerPC.
> 
> Can you take a look at the raw output?
> 
> It would be .kunit/test.log (or replace .kunit with w/e --build_dir
> you're using).
> You could also run the test with --raw_output to have kunit.py print
> that out instead.
> We might want to compare the output on UML vs x86 and see what looks 
> suspicious.
> 
> These errors
>   [ERROR] Test: xrgb_to_rgb332_test: missing subtest result line!
> means that kunit.py can't parse the KTAP output.
> 
> It could be that the output is mangled for some reason.
> I recall running into a UML-specific issue with output mangling on an
> old kernel fork. I doubt it's related to this one, but it shows that
> it's possible there could be something going on.
> 
> -Daniel

Hi!

Sorry for not clarifying the error in this thread.
I fixed it in v3 (already merged).

The issue was in my implementation. I was overwriting a few bytes of
memory due to an out of bounds bug. Thanks to the crash I mentioned,
I detected it before the code got merged.

Thanks a lot for the pointers Daniel, the next time I'll check
.kunit/test.log for usefull information.

Jose


Re: [PATCH 0/1] tee: Add tee_shm_register_fd

2022-08-13 Thread Sumit Garg
Hi Olivier,

On Thu, 11 Aug 2022 at 19:26, Olivier Masse  wrote:
>
> Add a new ioctl called TEE_IOC_SHM_REGISTER_FD to register a
> shared memory from a dmabuf file descriptor.
>

IIRC, here you are trying to fill the gap for OP-TEE SDP use-case. But
the use-case should be described here, its current status with OP-TEE
upstream and which platform you have tested this interface with?

-Sumit

> Etienne Carriere (1):
>   tee: new ioctl to a register tee_shm from a dmabuf file descriptor
>
>  drivers/tee/tee_core.c   | 38 +++
>  drivers/tee/tee_shm.c| 99 +++-
>  include/linux/tee_drv.h  | 11 +
>  include/uapi/linux/tee.h | 29 
>  4 files changed, 175 insertions(+), 2 deletions(-)
>
> --
> 2.25.0
>


Re: [PATCH 1/1] tee: new ioctl to a register tee_shm from a dmabuf file descriptor

2022-08-13 Thread Sumit Garg
Hi Olivier,

On Thu, 11 Aug 2022 at 19:26, Olivier Masse  wrote:
>
> From: Etienne Carriere 
>
> This change allows userland to create a tee_shm object that refers
> to a dmabuf reference.
>
> Userland provides a dmabuf file descriptor as buffer reference.
> The created tee_shm object exported as a brand new dmabuf reference
> used to provide a clean fd to userland. Userland shall closed this new
> fd to release the tee_shm object resources. The initial dmabuf resources
> are tracked independently through original dmabuf file descriptor.
>
> Once the buffer is registered and until it is released, TEE driver
> keeps a refcount on the registered dmabuf structure.
>
> This change only support dmabuf references that relates to physically
> contiguous memory buffers.

What limits you to extend this feature to non-contiguous memory
buffers? I believe that should be possible with OP-TEE dynamic shared
memory which gives you the granularity to register a list of pages.

-Sumit

>
> New tee_shm flag to identify tee_shm objects built from a registered
> dmabuf: TEE_SHM_EXT_DMA_BUF. Such tee_shm structures are flagged with
> TEE_SHM_EXT_DMA_BUF.
>
> Co-Developed-by: Etienne Carriere 
> Signed-off-by: Olivier Masse 
> From: https://github.com/linaro-swg/linux.git
> (cherry picked from commit 41e21e5c405530590dc2dd10b2a8dbe64589840f)
> ---
>  drivers/tee/tee_core.c   | 38 +++
>  drivers/tee/tee_shm.c| 99 +++-
>  include/linux/tee_drv.h  | 11 +
>  include/uapi/linux/tee.h | 29 
>  4 files changed, 175 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
> index 8aa1a4836b92..7c45cbf85eb9 100644
> --- a/drivers/tee/tee_core.c
> +++ b/drivers/tee/tee_core.c
> @@ -355,6 +355,42 @@ tee_ioctl_shm_register(struct tee_context *ctx,
> return ret;
>  }
>
> +static int tee_ioctl_shm_register_fd(struct tee_context *ctx,
> +struct tee_ioctl_shm_register_fd_data 
> __user *udata)
> +{
> +   struct tee_ioctl_shm_register_fd_data data;
> +   struct tee_shm *shm;
> +   long ret;
> +
> +   if (copy_from_user(, udata, sizeof(data)))
> +   return -EFAULT;
> +
> +   /* Currently no input flags are supported */
> +   if (data.flags)
> +   return -EINVAL;
> +
> +   shm = tee_shm_register_fd(ctx, data.fd);
> +   if (IS_ERR(shm))
> +   return -EINVAL;
> +
> +   data.id = shm->id;
> +   data.flags = shm->flags;
> +   data.size = shm->size;
> +
> +   if (copy_to_user(udata, , sizeof(data)))
> +   ret = -EFAULT;
> +   else
> +   ret = tee_shm_get_fd(shm);
> +
> +   /*
> +* When user space closes the file descriptor the shared memory
> +* should be freed or if tee_shm_get_fd() failed then it will
> +* be freed immediately.
> +*/
> +   tee_shm_put(shm);
> +   return ret;
> +}
> +
>  static int params_from_user(struct tee_context *ctx, struct tee_param 
> *params,
> size_t num_params,
> struct tee_ioctl_param __user *uparams)
> @@ -829,6 +865,8 @@ static long tee_ioctl(struct file *filp, unsigned int 
> cmd, unsigned long arg)
> return tee_ioctl_shm_alloc(ctx, uarg);
> case TEE_IOC_SHM_REGISTER:
> return tee_ioctl_shm_register(ctx, uarg);
> +   case TEE_IOC_SHM_REGISTER_FD:
> +   return tee_ioctl_shm_register_fd(ctx, uarg);
> case TEE_IOC_OPEN_SESSION:
> return tee_ioctl_open_session(ctx, uarg);
> case TEE_IOC_INVOKE:
> diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
> index 836872467dc6..55a3fbbb022e 100644
> --- a/drivers/tee/tee_shm.c
> +++ b/drivers/tee/tee_shm.c
> @@ -4,6 +4,7 @@
>   */
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -12,6 +13,14 @@
>  #include 
>  #include "tee_private.h"
>
> +/* extra references appended to shm object for registered shared memory */
> +struct tee_shm_dmabuf_ref {
> + struct tee_shm shm;
> + struct dma_buf *dmabuf;
> + struct dma_buf_attachment *attach;
> + struct sg_table *sgt;
> +};
> +
>  static void shm_put_kernel_pages(struct page **pages, size_t page_count)
>  {
> size_t n;
> @@ -71,7 +80,16 @@ static void release_registered_pages(struct tee_shm *shm)
>
>  static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm)
>  {
> -   if (shm->flags & TEE_SHM_POOL) {
> +   if (shm->flags & TEE_SHM_EXT_DMA_BUF) {
> +   struct tee_shm_dmabuf_ref *ref;
> +
> +   ref = container_of(shm, struct tee_shm_dmabuf_ref, shm);
> +   dma_buf_unmap_attachment(ref->attach, ref->sgt,
> +DMA_BIDIRECTIONAL);
> +
> +   dma_buf_detach(ref->dmabuf, ref->attach);
> +   dma_buf_put(ref->dmabuf);
> + 

Re: [PATCH 3/3] drm: omapdrm: Do no allocate non-scanout GEMs through DMM/TILER

2022-08-13 Thread Ivaylo Dimitrov

Hi Liu,

On 12.08.22 г. 7:35 ч., Yongqin Liu wrote:

Hi, Ivaylo, Tomi

We have one X15 Android AOSP master build, it could not have the home
screen displayed
on the hdmi monitor connected with this change, with the following
message printed on the serial console
 [  607.404205] omapdrm omapdrm.0: Failed to setup plane plane-0
 [  607.410522] omapdrm omapdrm.0: Failed to setup plane plane-1
 [  607.416381] omapdrm omapdrm.0: Failed to setup plane plane-2
 [  607.422088] omapdrm omapdrm.0: Failed to setup plane plane-3

# for details, please check the link here: http://ix.io/47m1

It will work with home screen displayed on the hdmi monitor if this
change is reverted.

Is this the broken problem you talked about here?

And could you please give some suggestions on how to have the x15
Android build work with this change?



Make sure scanout (i.e. those to be displayed) buffers are actually 
allocated as such - OMAP_BO_SCANOUT flag must be set when calling 
omap_bo_new().


Regards,
Ivo.



Thanks,
Yongqin Liu
On Thu, 17 Feb 2022 at 23:29, Ivaylo Dimitrov
 wrote:




On 17.02.22 г. 14:46 ч., Tomi Valkeinen wrote:

Hi,

On 19/01/2022 12:23, Ivaylo Dimitrov wrote:

On devices with DMM, all allocations are done through either DMM or
TILER.
DMM/TILER being a limited resource means that such allocations will start
to fail before actual free memory is exhausted. What is even worse is
that
with time DMM/TILER space gets fragmented to the point that even if we
have
enough free DMM/TILER space and free memory, allocation fails because
there
is no big enough free block in DMM/TILER space.

Such failures can be easily observed with OMAP xorg DDX, for example -
starting few GUI applications (so buffers for their windows are
allocated)
and then rotating landscape<->portrait while closing and opening new
windows soon results in allocation failures.

Fix that by mapping buffers through DMM/TILER only when really needed,
like, for scanout buffers.


Doesn't this break users that get a buffer from omapdrm and expect it to
be contiguous?



If you mean dumb buffer, then no, this does not break users as dumb
buffers are allocated as scanout:

https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/omapdrm/omap_gem.c#L603

If you mean omap_bo allocated buffers, then if users want
linear(scanout) buffer, then they request it explicitly by passing
OMAP_BO_SCANOUT.

Ivo