[Bug 205277] [amd powerplay] vega10: soc voltage for power state 7 is not changed by overdrive.

2019-10-30 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205277

Pelle van Gils (pe...@vangils.xyz) changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |CODE_FIX

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

Re: Proposal to report GPU private memory allocations with sysfs nodes [plain text version]

2019-10-30 Thread Kenny Ho
Hi Yiwei,

I am not sure if you are aware, there is an ongoing RFC on adding drm
support in cgroup for the purpose of resource tracking.  One of the
resource is GPU memory.  It's not exactly the same as what you are
proposing (it doesn't track API usage, but it tracks the type of GPU
memory from kmd perspective) but perhaps it would be of interest to
you.  There are no consensus on it at this point.

(sorry for being late to the discussion.  I only noticed this thread
when one of the email got lucky and escape the spam folder.)

Regards,
Kenny

On Wed, Oct 30, 2019 at 4:14 AM Yiwei Zhang  wrote:
>
> Hi Jerome and all folks,
>
> In addition to my last reply, I just wanna get some more information 
> regarding this on the upstream side.
>
> 1. Do you think this(standardize a way to report GPU private allocations) is 
> going to be a useful thing on the upstream as well? It grants a lot benefits 
> for Android, but I'd like to get an idea for the non-Android world.
>
> 2. There might be some worries that upstream kernel driver has no idea 
> regarding the API. However, to achieve good fidelity around memory reporting, 
> we'd have to pass down certain metadata which is known only by the userland. 
> Consider this use case: on the upstream side, freedreno for example, some 
> memory buffer object(BO) during its own lifecycle could represent totally 
> different things, and kmd is not aware of that. When we'd like to take memory 
> snapshots at certain granularity, we have to know what that buffer represents 
> so that the snapshot can be meaningful and useful.
>
> If we just keep this Android specific, I'd worry some day the upstream has 
> standardized a way to report this and Android vendors have to take extra 
> efforts to migrate over. This is one of the main reasons we'd like to do this 
> on the upstream side.
>
> Timeline wise, Android has explicit deadlines for the next release and we 
> have to push hard towards those. Any prompt responses are very much 
> appreciated!
>
> Best regards,
> Yiwei
>
> On Mon, Oct 28, 2019 at 11:33 AM Yiwei Zhang  wrote:
>>
>> On Mon, Oct 28, 2019 at 8:26 AM Jerome Glisse  wrote:
>>>
>>> On Fri, Oct 25, 2019 at 11:35:32AM -0700, Yiwei Zhang wrote:
>>> > Hi folks,
>>> >
>>> > This is the plain text version of the previous email in case that was
>>> > considered as spam.
>>> >
>>> > --- Background ---
>>> > On the downstream Android, vendors used to report GPU private memory
>>> > allocations with debugfs nodes in their own formats. However, debugfs 
>>> > nodes
>>> > are getting deprecated in the next Android release.
>>>
>>> Maybe explain why it is useful first ?
>>
>>
>> Memory is precious on Android mobile platforms. Apps using a large amount of
>> memory, games, tend to maintain a table for the memory on different devices 
>> with
>> different prediction models. Private gpu memory allocations is currently 
>> semi-blind
>> to the apps and the platform as well.
>>
>> By having the data, the platform can do:
>> (1) GPU memory profiling as part of the huge Android profiler in progress.
>> (2) Android system health team can enrich the performance test coverage.
>> (3) We can collect filed metrics to detect any regression on the gpu private 
>> memory
>> allocations in the production population.
>> (4) Shell user can easily dump the allocations in a uniform way across 
>> vendors.
>> (5) Platform can feed the data to the apps so that apps can do memory 
>> allocations
>> in a more predictable way.
>>
>>>
>>> >
>>> > --- Proposal ---
>>> > We are taking the chance to unify all the vendors to migrate their 
>>> > existing
>>> > debugfs nodes into a standardized sysfs node structure. Then the platform
>>> > is able to do a bunch of useful things: memory profiling, system health
>>> > coverage, field metrics, local shell dump, in-app api, etc. This proposal
>>> > is better served upstream as all GPU vendors can standardize a gpu memory
>>> > structure and reduce fragmentation across Android and Linux that clients
>>> > can rely on.
>>> >
>>> > --- Detailed design ---
>>> > The sysfs node structure looks like below:
>>> > /sys/devices///
>>> > e.g. "/sys/devices/mali0/gpu_mem/606/gl_buffer" and the gl_buffer is a 
>>> > node
>>> > having the comma separated size values: "4096,81920,...,4096".
>>>
>>> How does kernel knows what API the allocation is use for ? With the
>>> open source driver you never specify what API is creating a gem object
>>> (opengl, vulkan, ...) nor what purpose (transient, shader, ...).
>>
>>
>> Oh, is this a hard requirement for the open source drivers to not bookkeep 
>> any
>> data from userland? I think the API is just some additional metadata passed 
>> down.
>>
>>>
>>>
>>> > For the top level root, vendors can choose their own names based on the
>>> > value of ro.gfx.sysfs.0 the vendors set. (1) For the multiple gpu driver
>>> > cases, we can use ro.gfx.sysfs.1, ro.gfx.sysfs.2 for the 2nd and 3rd KMDs.
>>> > (2) It's also allowed to put some sub-dir 

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

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

--- Comment #183 from Timur Kristóf  ---
(In reply to Jaap Buurman from comment #142)
> How can I set both AMD_DEBUG=nongg and AMD_DEBUG=nodma in the
> /etc/environment file? Do they need to be on two separate lines, or will the
> second line simply overwrite the first one by setting the same environment
> variable? Do they need to be comma separated maybe?

Add the following line to your /etc/environment

export AMD_DEBUG=nongg,nodma

(In reply to Pierre-Eric Pelloux-Prayer from comment #141)
> I don't think radv uses SDMA at all, so they cannot be affected by this
> issue. 

Correct, radv doesn't use the SDMA so is not affected by this problem. If you
see hangs in Vulkan games, it is currently most likely an LLVM problem. The
LLVM devs have fixed most of the problems in their latest master, but haven't
backported the fixes to LLVM 9 yet.

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

[radeon-alex:amd-mainline-dkms-5.2 1794/2647] configure: error: C compiler cannot create executables

2019-10-30 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: 4d49aa8a40ceecfd8a6b2d4e1b86396fbeedbb01 [1794/2647] 
drm/amdkcl/autoconf: generate config.h for in-tree build
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.4.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 4d49aa8a40ceecfd8a6b2d4e1b86396fbeedbb01
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=arm 

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

All errors (new ones prefixed by >>):

   configure: error: in `drivers/gpu/drm/scheduler/dkms':
>> configure: error: C compiler cannot create executables
   See `config.log' for more details
--
>> configure: error: in `drivers/gpu/drm/ttm/dkms':
>> configure: error: C compiler cannot create executables
   See `config.log' for more details

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2] drm/mediatek: support CMDQ interface in ddp component

2019-10-30 Thread CK Hu
Hi, Bibby:

On Fri, 2019-10-25 at 13:38 +0800, Bibby Hsieh wrote:
> The CMDQ (Command Queue) in MT8183 is used to help
> update all relevant display controller registers
> with critical time limation.
> This patch add cmdq interface in ddp_comp interface,
> let all ddp_comp interface can support cpu/cmdq function
> at the same time.

Please also send the patch which use cmdq interface so that I could
review this interface more completely.

Regards,
CK

> 
> This patch depends on ptach:
> add drm support for MT8183
> (https://patchwork.kernel.org/cover/11121519/)
> support gce on mt8183 platform
> (https://patchwork.kernel.org/cover/11208315/)
> 
> Changes since v1:
>  - remove unnecessary change
>  - fixup indent
> 
> Signed-off-by: YT Shen 
> Signed-off-by: CK Hu 
> Signed-off-by: Philipp Zabel 
> Signed-off-by: Bibby Hsieh 
> Signed-off-by: Yongqiang Niu 
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_color.c   |   7 +-
>  drivers/gpu/drm/mediatek/mtk_disp_ovl.c |  65 +--
>  drivers/gpu/drm/mediatek/mtk_disp_rdma.c|  43 
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 114 +---
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |  53 +
>  5 files changed, 176 insertions(+), 106 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_color.c 
> b/drivers/gpu/drm/mediatek/mtk_disp_color.c
> index 59de2a46aa49..6fb0d6983a4a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_color.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_color.c
> @@ -9,6 +9,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "mtk_drm_crtc.h"
>  #include "mtk_drm_ddp_comp.h"
> @@ -45,12 +46,12 @@ static inline struct mtk_disp_color *comp_to_color(struct 
> mtk_ddp_comp *comp)
>  
>  static void mtk_color_config(struct mtk_ddp_comp *comp, unsigned int w,
>unsigned int h, unsigned int vrefresh,
> -  unsigned int bpc)
> +  unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
>  {
>   struct mtk_disp_color *color = comp_to_color(comp);
>  
> - writel(w, comp->regs + DISP_COLOR_WIDTH(color));
> - writel(h, comp->regs + DISP_COLOR_HEIGHT(color));
> + mtk_ddp_write(cmdq_pkt, w, comp, DISP_COLOR_WIDTH(color));
> + mtk_ddp_write(cmdq_pkt, h, comp, DISP_COLOR_HEIGHT(color));
>  }
>  
>  static void mtk_color_start(struct mtk_ddp_comp *comp)
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c 
> b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> index d11c20f212e5..1a1b50f4e9ac 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> @@ -10,6 +10,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "mtk_drm_crtc.h"
>  #include "mtk_drm_ddp_comp.h"
> @@ -121,14 +122,15 @@ static void mtk_ovl_stop(struct mtk_ddp_comp *comp)
>  
>  static void mtk_ovl_config(struct mtk_ddp_comp *comp, unsigned int w,
>  unsigned int h, unsigned int vrefresh,
> -unsigned int bpc)
> +unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
>  {
>   if (w != 0 && h != 0)
> - writel_relaxed(h << 16 | w, comp->regs + DISP_REG_OVL_ROI_SIZE);
> - writel_relaxed(0x0, comp->regs + DISP_REG_OVL_ROI_BGCLR);
> + mtk_ddp_write_relaxed(cmdq_pkt, h << 16 | w, comp,
> +   DISP_REG_OVL_ROI_SIZE);
> + mtk_ddp_write_relaxed(cmdq_pkt, 0x0, comp, DISP_REG_OVL_ROI_BGCLR);
>  
> - writel(0x1, comp->regs + DISP_REG_OVL_RST);
> - writel(0x0, comp->regs + DISP_REG_OVL_RST);
> + mtk_ddp_write(cmdq_pkt, 0x1, comp, DISP_REG_OVL_RST);
> + mtk_ddp_write(cmdq_pkt, 0x0, comp, DISP_REG_OVL_RST);
>  }
>  
>  static unsigned int mtk_ovl_layer_nr(struct mtk_ddp_comp *comp)
> @@ -138,16 +140,16 @@ static unsigned int mtk_ovl_layer_nr(struct 
> mtk_ddp_comp *comp)
>   return ovl->data->layer_nr;
>  }
>  
> -static void mtk_ovl_layer_on(struct mtk_ddp_comp *comp, unsigned int idx)
> +static void mtk_ovl_layer_on(struct mtk_ddp_comp *comp, unsigned int idx,
> +  struct cmdq_pkt *cmdq_pkt)
>  {
> - unsigned int reg;
>   unsigned int gmc_thrshd_l;
>   unsigned int gmc_thrshd_h;
>   unsigned int gmc_value;
>   struct mtk_disp_ovl *ovl = comp_to_ovl(comp);
>  
> - writel(0x1, comp->regs + DISP_REG_OVL_RDMA_CTRL(idx));
> -
> + mtk_ddp_write(cmdq_pkt, 0x1, comp,
> +   DISP_REG_OVL_RDMA_CTRL(idx));
>   gmc_thrshd_l = GMC_THRESHOLD_LOW >>
> (GMC_THRESHOLD_BITS - ovl->data->gmc_bits);
>   gmc_thrshd_h = GMC_THRESHOLD_HIGH >>
> @@ -157,22 +159,19 @@ static void mtk_ovl_layer_on(struct mtk_ddp_comp *comp, 
> unsigned int idx)
>   else
>   gmc_value = gmc_thrshd_l | gmc_thrshd_l << 8 |
>   gmc_thrshd_h << 16 | gmc_thrshd_h << 24;
> - writel(gmc_value, comp->regs + DISP_REG_OVL_RDMA_GMC(idx));
> -
> - reg = 

Re: [PATCH] drm/mediatek: Add RGB[A] variants to published plane formats

2019-10-30 Thread CK Hu
Hi, Sean:

On Wed, 2019-10-23 at 15:51 -0400, Sean Paul wrote:
> From: Sean Paul 
> 
> These formats are handled in the rdma code, but for some reason they're
> not published as supported formats for the planes. So add them to the
> list.

Applied to mediatek-drm-fixes-5.4 [1], thanks.

[1]
https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-fixes-5.4

Regards,
CK

> 
> Cc: Nicolas Boichat 
> Cc: Daniele Castagna 
> Cc: Miguel Casas 
> Tested-by: Miguel Casas 
> Signed-off-by: Sean Paul 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_plane.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> index 584a9ecadce6..49d59470cc11 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
> @@ -20,6 +20,12 @@
>  static const u32 formats[] = {
>   DRM_FORMAT_XRGB,
>   DRM_FORMAT_ARGB,
> + DRM_FORMAT_BGRX,
> + DRM_FORMAT_BGRA,
> + DRM_FORMAT_ABGR,
> + DRM_FORMAT_XBGR,
> + DRM_FORMAT_RGB888,
> + DRM_FORMAT_BGR888,
>   DRM_FORMAT_RGB565,
>   DRM_FORMAT_UYVY,
>   DRM_FORMAT_YUYV,


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

Re: [PATCH V6 6/6] docs: sample driver to demonstrate how to implement virtio-mdev framework

2019-10-30 Thread Jason Wang


On 2019/10/31 上午5:23, Christoph Hellwig wrote:

On Wed, Oct 30, 2019 at 02:44:44PM +0800, Jason Wang wrote:

This sample driver creates mdev device that simulate virtio net device
over virtio mdev transport. The device is implemented through vringh
and workqueue. A device specific dma ops is to make sure HVA is used
directly as the IOVA. This should be sufficient for kernel virtio
driver to work.

Only 'virtio' type is supported right now. I plan to add 'vhost' type
on top which requires some virtual IOMMU implemented in this sample
driver.

Can we please submit a real driver for it?  A more or less useless
sample driver doesn't really qualify for our normal kernel requirements
that infrastructure should have a real user.



Intel posted a real driver here: https://lkml.org/lkml/2019/10/15/1226.

I plan to post another driver that wire virito-pci back to mdev bus on 
top of this series as well.


Thanks


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

linux-next: manual merge of the drm tree with the drm-intel-fixes tree

2019-10-30 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the drm tree got a conflict in:

  drivers/gpu/drm/i915/i915_drv.h

between commit:

  59cd826fb5e7 ("drm/i915: Fix PCH reference clock for FDI on HSW/BDW")

from the drm-intel-fixes tree and commit:

  7d423af9bfb1 ("drm/i915: Implement a better i945gm vblank irq vs. C-states 
workaround")

from the drm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/i915/i915_drv.h
index 953e1d12c23c,8882c0908c3b..
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@@ -1704,34 -1339,17 +1339,19 @@@ struct drm_i915_private 
struct {
struct notifier_block pm_notifier;
  
-   /**
-* We leave the user IRQ off as much as possible,
-* but this means that requests will finish and never
-* be retired once the system goes idle. Set a timer to
-* fire periodically while the ring is running. When it
-* fires, go retire requests.
-*/
-   struct delayed_work retire_work;
- 
-   /**
-* When we detect an idle GPU, we want to turn on
-* powersaving features. So once we see that there
-* are no more requests outstanding and no more
-* arrive within a small period of time, we fire
-* off the idle_work.
-*/
-   struct work_struct idle_work;
+   struct i915_gem_contexts {
+   spinlock_t lock; /* locks list */
+   struct list_head list;
+ 
+   struct llist_head free_list;
+   struct work_struct free_work;
+   } contexts;
} gem;
  
 +  u8 pch_ssc_use;
 +
-   /* For i945gm vblank irq vs. C3 workaround */
-   struct {
-   struct work_struct work;
-   struct pm_qos_request pm_qos;
-   u8 c3_disable_latency;
-   u8 enabled;
-   } i945gm_vblank;
+   /* For i915gm/i945gm vblank irq workaround */
+   u8 vblank_enabled;
  
/* perform PHY state sanity checks? */
bool chv_phy_assert[2];


pgpf1eJ6c107v.pgp
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[radeon-alex:amd-mainline-dkms-5.2 1264/2647] htmldocs: drivers/gpu/drm/drm_dp_mst_topology.c:1595: warning: Function parameter or member 'connector' not described in 'drm_dp_mst_connector_late_regist

2019-10-30 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.2
head:   b027ed8d9051470f4ed6bc071fcde172fe1fc595
commit: aad0eab4e8dd76d1ba5248f9278633829cbcec38 [1264/2647] drm/dp_mst: Enable 
registration of AUX devices for MST ports
reproduce: make htmldocs

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

All warnings (new ones prefixed by >>):

   Documentation/sphinx/kfigure.py:174: RemovedInSphinx20Warning: app.verbose() 
is now deprecated. Use sphinx.util.logging instead.
 app.verbose("kfigure: check installed tools ...")
   Documentation/sphinx/kfigure.py:182: RemovedInSphinx20Warning: app.warning() 
is now deprecated. Use sphinx.util.logging instead.
 app.warn("dot(1) not found, for better output quality install "
   WARNING: dot(1) not found, for better output quality install graphviz from 
http://www.graphviz.org
   Documentation/sphinx/kfigure.py:188: RemovedInSphinx20Warning: app.warning() 
is now deprecated. Use sphinx.util.logging instead.
 "convert(1) not found, for SVG to PDF conversion install "
   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick 
(https://www.imagemagick.org)
   Documentation/sphinx/kerneldoc.py:93: RemovedInSphinx20Warning: 
app.verbose() is now deprecated. Use sphinx.util.logging instead.
 env.app.verbose('calling kernel-doc \'%s\'' % (" ".join(cmd)))
   Documentation/sphinx/kerneldoc.py:125: RemovedInSphinx20Warning: 
AutodocReporter is now deprecated. Use 
sphinx.util.docutils.switch_source_input() instead.
 self.state.memo.reporter = AutodocReporter(result, 
self.state.memo.reporter)
   include/linux/generic-radix-tree.h:1: warning: no structured comments found
   lib/sort.c:59: warning: Excess function parameter 'size' description in 
'swap_words_32'
   lib/sort.c:83: warning: Excess function parameter 'size' description in 
'swap_words_64'
   lib/sort.c:110: warning: Excess function parameter 'size' description in 
'swap_bytes'
   block/genhd.c:540: warning: Function parameter or member 'devt' not 
described in 'blk_invalidate_devt'
   kernel/rcu/tree_plugin.h:1: warning: no structured comments found
   include/net/cfg80211.h:1074: warning: Function parameter or member 'txpwr' 
not described in 'station_parameters'
   include/net/mac80211.h:4037: warning: Function parameter or member 
'sta_set_txpwr' not described in 'ieee80211_ops'
   include/net/mac80211.h:2004: warning: Function parameter or member 'txpwr' 
not described in 'ieee80211_sta'
   kernel/rcu/tree_plugin.h:1: warning: no structured comments found
   include/linux/firmware/intel/stratix10-svc-client.h:1: warning: no 
structured comments found
   Error: Cannot open file drivers/counter/generic-counter.c
   Error: Cannot open file drivers/counter/generic-counter.c
   Documentation/sphinx/kerneldoc.py:103: RemovedInSphinx20Warning: 
app.warning() is now deprecated. Use sphinx.util.logging instead.
 env.app.warn('kernel-doc \'%s\' failed with return code %d' % (" 
".join(cmd), p.returncode))
   include/linux/gpio/driver.h:374: warning: Function parameter or member 
'init_valid_mask' not described in 'gpio_chip'
   include/linux/i2c.h:343: warning: Function parameter or member 'init_irq' 
not described in 'i2c_client'
   include/linux/iio/hw-consumer.h:1: warning: no structured comments found
   drivers/base/node.c:78: warning: Function parameter or member 'hmem_attrs' 
not described in 'node_access_nodes'
   drivers/base/node.c:690: warning: Function parameter or member 'mem_nid' not 
described in 'register_memory_node_under_compute_node'
   drivers/base/node.c:690: warning: Function parameter or member 'cpu_nid' not 
described in 'register_memory_node_under_compute_node'
   drivers/base/node.c:690: warning: Excess function parameter 'mem_node' 
description in 'register_memory_node_under_compute_node'
   drivers/base/node.c:690: warning: Excess function parameter 'cpu_node' 
description in 'register_memory_node_under_compute_node'
   include/linux/input/sparse-keymap.h:46: warning: Function parameter or 
member 'sw' not described in 'key_entry'
   include/linux/regulator/machine.h:199: warning: Function parameter or member 
'max_uV_step' not described in 'regulation_constraints'
   include/linux/regulator/driver.h:228: warning: Function parameter or member 
'resume' not described in 'regulator_ops'
   drivers/slimbus/stream.c:1: warning: no structured comments found
   include/linux/spi/spi.h:188: warning: Function parameter or member 
'driver_override' not described in 'spi_device'
   drivers/target/target_core_device.c:1: warning: no structured comments found
   drivers/usb/typec/bus.c:1: warning: no structured comments found
   drivers/usb/typec/class.c:1: warning: no structured comments found
   include/linux/w1.h:281: warning: Function parameter or member 
'of_match_table' not described in 'w1_family'
   fs/direct-io.c:257: warning: Excess function parameter 'offset' description 
in 'dio_complete'
   

[PATCH 2/2] drm/amd/display: Hook up drm interface for DP 1.4 edid corruption test

2019-10-30 Thread Jerry (Fangzhi) Zuo
Signed-off-by: Jerry (Fangzhi) Zuo 
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  | 35 +-
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index 11e5784aa62a..c430890085f6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -575,6 +575,7 @@ enum dc_edid_status dm_helpers_read_local_edid(
struct dc_sink *sink)
 {
struct amdgpu_dm_connector *aconnector = link->priv;
+   struct drm_connector *connector = >base;
struct i2c_adapter *ddc;
int retry = 3;
enum dc_edid_status edid_status;
@@ -592,6 +593,12 @@ enum dc_edid_status dm_helpers_read_local_edid(
 
edid = drm_get_edid(>base, ddc);
 
+   if (link->aux_mode && connector->edid_corrupt)
+   
drm_dp_send_bad_edid_checksum(>dm_dp_aux.aux, 
connector->bad_edid_checksum);
+
+   if (!edid && connector->edid_corrupt)
+   return EDID_BAD_CHECKSUM;
+
if (!edid)
return EDID_NO_RESPONSE;
 
@@ -612,34 +619,6 @@ enum dc_edid_status dm_helpers_read_local_edid(
DRM_ERROR("EDID err: %d, on connector: %s",
edid_status,
aconnector->base.name);
-   if (link->aux_mode) {
-   union test_request test_request = { {0} };
-   union test_response test_response = { {0} };
-
-   dm_helpers_dp_read_dpcd(ctx,
-   link,
-   DP_TEST_REQUEST,
-   _request.raw,
-   sizeof(union test_request));
-
-   if (!test_request.bits.EDID_READ)
-   return edid_status;
-
-   test_response.bits.EDID_CHECKSUM_WRITE = 1;
-
-   dm_helpers_dp_write_dpcd(ctx,
-   link,
-   DP_TEST_EDID_CHECKSUM,
-   
>dc_edid.raw_edid[sink->dc_edid.length-1],
-   1);
-
-   dm_helpers_dp_write_dpcd(ctx,
-   link,
-   DP_TEST_RESPONSE,
-   _response.raw,
-   sizeof(test_response));
-
-   }
 
return edid_status;
 }
-- 
2.14.1

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

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

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

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

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

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

___
dri-devel 

[PATCH 0/2] Changes for DP 1.4 Compliance test 4.2.2.6

2019-10-30 Thread Jerry (Fangzhi) Zuo
Unlike DP 1.2 Compliance test 4.2.2.6, DP 1.4 requires to calculate real
CRC value of the last edid data block, and write it back.

Current edid CRC calculate routine adds the last CRC byte, and check if
non-zero or not. Need to return the actual CRC value when corruption is
detected.

Jerry (Fangzhi) Zuo (2):
  drm: Add support for DP 1.4 Compliance edid corruption test 4.2.2.6
  drm/amd/display: Hook up drm interface for DP 1.4 edid corruption test

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  | 35 +
 drivers/gpu/drm/drm_dp_helper.c| 36 ++
 drivers/gpu/drm/drm_edid.c | 15 +++--
 include/drm/drm_connector.h|  7 +
 include/drm/drm_dp_helper.h|  3 ++
 5 files changed, 65 insertions(+), 31 deletions(-)

-- 
2.14.1

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

Re: [PATCH 0/5] Revert "DMA-BUF Heaps (destaging ION)"

2019-10-30 Thread Sean Paul
On Wed, Oct 30, 2019 at 4:30 PM Sean Paul  wrote:
>
> From: Sean Paul 
>
> While the kernel set has a solid number of r-b's and acks, the
> userspace component does not meet the drm requirements of being
> "reviewed and ready for merging into a suitable and canonical upstream
> project".
>
> Once the userspace portion has been reviewed, let's try again.
>

Pushed to drm-misc-next.

Sean

> Sean
>
> [1] 
> https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements
>
> Sean Paul (5):
>   Revert "kselftests: Add dma-heap test"
>   Revert "dma-buf: heaps: Add CMA heap to dmabuf heaps"
>   Revert "dma-buf: heaps: Add system heap to dmabuf heaps"
>   Revert "dma-buf: heaps: Add heap helpers"
>   Revert "dma-buf: Add dma-buf heaps framework"
>
>  MAINTAINERS   |  18 --
>  drivers/dma-buf/Kconfig   |  11 -
>  drivers/dma-buf/Makefile  |   2 -
>  drivers/dma-buf/dma-heap.c| 269 --
>  drivers/dma-buf/heaps/Kconfig |  14 -
>  drivers/dma-buf/heaps/Makefile|   4 -
>  drivers/dma-buf/heaps/cma_heap.c  | 178 
>  drivers/dma-buf/heaps/heap-helpers.c  | 268 -
>  drivers/dma-buf/heaps/heap-helpers.h  |  55 
>  drivers/dma-buf/heaps/system_heap.c   | 124 
>  include/linux/dma-heap.h  |  59 
>  include/uapi/linux/dma-heap.h |  55 
>  tools/testing/selftests/dmabuf-heaps/Makefile |   9 -
>  .../selftests/dmabuf-heaps/dmabuf-heap.c  | 238 
>  14 files changed, 1304 deletions(-)
>  delete mode 100644 drivers/dma-buf/dma-heap.c
>  delete mode 100644 drivers/dma-buf/heaps/Kconfig
>  delete mode 100644 drivers/dma-buf/heaps/Makefile
>  delete mode 100644 drivers/dma-buf/heaps/cma_heap.c
>  delete mode 100644 drivers/dma-buf/heaps/heap-helpers.c
>  delete mode 100644 drivers/dma-buf/heaps/heap-helpers.h
>  delete mode 100644 drivers/dma-buf/heaps/system_heap.c
>  delete mode 100644 include/linux/dma-heap.h
>  delete mode 100644 include/uapi/linux/dma-heap.h
>  delete mode 100644 tools/testing/selftests/dmabuf-heaps/Makefile
>  delete mode 100644 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
>
> --
> Sean Paul, Software Engineer, Google / Chromium OS
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH 5/5] Revert "dma-buf: Add dma-buf heaps framework"

2019-10-30 Thread Sean Paul
From: Sean Paul 

This reverts commit a69b0e855d3fd278ff6f09a23e1edf929538e304.

This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.

[1]- 
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Fixes: a69b0e855d3f ("dma-buf: Add dma-buf heaps framework")
Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Hillf Danton 
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey 
Cc: John Stultz 
Cc: Mauro Carvalho Chehab 
Cc: "David S. Miller" 
Cc: Greg Kroah-Hartman 
Cc: Rob Herring 
Cc: Jonathan Cameron 
Cc: "Paul E. McKenney" 
Cc: Sean Paul 
Cc: "Andrew F. Davis" 
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Sean Paul 
---
 MAINTAINERS   |  18 ---
 drivers/dma-buf/Kconfig   |   9 --
 drivers/dma-buf/Makefile  |   1 -
 drivers/dma-buf/dma-heap.c| 269 --
 include/linux/dma-heap.h  |  59 
 include/uapi/linux/dma-heap.h |  55 ---
 6 files changed, 411 deletions(-)
 delete mode 100644 drivers/dma-buf/dma-heap.c
 delete mode 100644 include/linux/dma-heap.h
 delete mode 100644 include/uapi/linux/dma-heap.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 5f39067caa7c..b63c291ad029 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4942,24 +4942,6 @@ F:   include/linux/*fence.h
 F: Documentation/driver-api/dma-buf.rst
 T: git git://anongit.freedesktop.org/drm/drm-misc
 
-DMA-BUF HEAPS FRAMEWORK
-M: Sumit Semwal 
-R: Andrew F. Davis 
-R: Benjamin Gaignard 
-R: Liam Mark 
-R: Laura Abbott 
-R: Brian Starkey 
-R: John Stultz 
-S: Maintained
-L: linux-me...@vger.kernel.org
-L: dri-devel@lists.freedesktop.org
-L: linaro-mm-...@lists.linaro.org (moderated for non-subscribers)
-F: include/uapi/linux/dma-heap.h
-F: include/linux/dma-heap.h
-F: drivers/dma-buf/dma-heap.c
-F: drivers/dma-buf/heaps/*
-T: git git://anongit.freedesktop.org/drm/drm-misc
-
 DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
 M: Vinod Koul 
 L: dmaeng...@vger.kernel.org
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index bffa58fc3e6e..a23b6752d11a 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -44,13 +44,4 @@ config DMABUF_SELFTESTS
default n
depends on DMA_SHARED_BUFFER
 
-menuconfig DMABUF_HEAPS
-   bool "DMA-BUF Userland Memory Heaps"
-   select DMA_SHARED_BUFFER
-   help
- Choose this option to enable the DMA-BUF userland memory heaps.
- This options creates per heap chardevs in /dev/dma_heap/ which
- allows userspace to allocate dma-bufs that can be shared
- between drivers.
-
 endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index caee5eb3d351..03479da06422 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
 dma-resv.o seqno-fence.o
-obj-$(CONFIG_DMABUF_HEAPS) += dma-heap.o
 obj-$(CONFIG_SYNC_FILE)+= sync_file.o
 obj-$(CONFIG_SW_SYNC)  += sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)  += udmabuf.o
diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
deleted file mode 100644
index 9a41b73e54b4..
--- a/drivers/dma-buf/dma-heap.c
+++ /dev/null
@@ -1,269 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Framework for userspace DMA-BUF allocations
- *
- * Copyright (C) 2011 Google, Inc.
- * Copyright (C) 2019 Linaro Ltd.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define DEVNAME "dma_heap"
-
-#define NUM_HEAP_MINORS 128
-
-/**
- * struct dma_heap - represents a dmabuf heap in the system
- * @name:  used for debugging/device-node name
- * @ops:   ops struct for this heap
- * @minor  minor number of this heap device
- * @heap_devt  heap device node
- * @heap_cdev  heap char device
- *
- * Represents a heap of memory from which buffers can be made.
- */
-struct dma_heap {
-   const char *name;
-   const struct dma_heap_ops *ops;
-   void *priv;
-   unsigned int minor;
-   dev_t heap_devt;
-   struct list_head list;
-   struct cdev heap_cdev;
-};
-
-static LIST_HEAD(heap_list);
-static DEFINE_MUTEX(heap_list_lock);
-static dev_t dma_heap_devt;
-static struct class *dma_heap_class;
-static DEFINE_XARRAY_ALLOC(dma_heap_minors);
-
-static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
-   

[PATCH 2/5] Revert "dma-buf: heaps: Add CMA heap to dmabuf heaps"

2019-10-30 Thread Sean Paul
From: Sean Paul 

This reverts commit 43d7238fb9ac897b29912368b3359e72bae469c4.

This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.

[1]- 
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Fixes: 43d7238fb9ac ("dma-buf: heaps: Add CMA heap to dmabuf heaps")
Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Hillf Danton 
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey 
Cc: John Stultz 
Cc: "Andrew F. Davis" 
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Sean Paul 
---
 drivers/dma-buf/heaps/Kconfig|   8 --
 drivers/dma-buf/heaps/Makefile   |   1 -
 drivers/dma-buf/heaps/cma_heap.c | 178 ---
 3 files changed, 187 deletions(-)
 delete mode 100644 drivers/dma-buf/heaps/cma_heap.c

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

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

2019-10-30 Thread Sean Paul
From: Sean Paul 

This reverts commit 47a32f9c12266d450b92089148c6039591bd9909.

This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.

[1]- 
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Hillf Danton 
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey 
Cc: John Stultz 
Cc: "Andrew F. Davis" 
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Sean Paul 
---
 drivers/dma-buf/Kconfig |   2 -
 drivers/dma-buf/heaps/Kconfig   |   6 --
 drivers/dma-buf/heaps/Makefile  |   1 -
 drivers/dma-buf/heaps/system_heap.c | 124 
 4 files changed, 133 deletions(-)
 delete mode 100644 drivers/dma-buf/heaps/Kconfig
 delete mode 100644 drivers/dma-buf/heaps/system_heap.c

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

[PATCH 1/5] Revert "kselftests: Add dma-heap test"

2019-10-30 Thread Sean Paul
From: Sean Paul 

This reverts commit ab87cc9754cdeb373c8ac030ac7aed92f450b767.

This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.

[1]- 
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Fixes: ab87cc9754cd ("kselftests: Add dma-heap test")
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Hillf Danton 
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey 
Cc: Laura Abbott 
Cc: John Stultz 
Cc: Sean Paul 
Signed-off-by: Sean Paul 
---
 tools/testing/selftests/dmabuf-heaps/Makefile |   9 -
 .../selftests/dmabuf-heaps/dmabuf-heap.c  | 238 --
 2 files changed, 247 deletions(-)
 delete mode 100644 tools/testing/selftests/dmabuf-heaps/Makefile
 delete mode 100644 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c

diff --git a/tools/testing/selftests/dmabuf-heaps/Makefile 
b/tools/testing/selftests/dmabuf-heaps/Makefile
deleted file mode 100644
index 8c4c36e2972d..
--- a/tools/testing/selftests/dmabuf-heaps/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-CFLAGS += -static -O3 -Wl,-no-as-needed -Wall
-#LDLIBS += -lrt -lpthread -lm
-
-# these are all "safe" tests that don't modify
-# system time or require escalated privileges
-TEST_GEN_PROGS = dmabuf-heap
-
-include ../lib.mk
diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c 
b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
deleted file mode 100644
index b36dd9f35c19..
--- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
+++ /dev/null
@@ -1,238 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-#include "../../../../include/uapi/linux/dma-heap.h"
-
-#define DEVPATH "/dev/dma_heap"
-
-static int check_vgem(int fd)
-{
-   drm_version_t version = { 0 };
-   char name[5];
-   int ret;
-
-   version.name_len = 4;
-   version.name = name;
-
-   ret = ioctl(fd, DRM_IOCTL_VERSION, );
-   if (ret)
-   return 0;
-
-   return !strcmp(name, "vgem");
-}
-
-static int open_vgem(void)
-{
-   int i, fd;
-   const char *drmstr = "/dev/dri/card";
-
-   fd = -1;
-   for (i = 0; i < 16; i++) {
-   char name[80];
-
-   snprintf(name, 80, "%s%u", drmstr, i);
-
-   fd = open(name, O_RDWR);
-   if (fd < 0)
-   continue;
-
-   if (!check_vgem(fd)) {
-   close(fd);
-   fd = -1;
-   continue;
-   } else {
-   break;
-   }
-   }
-   return fd;
-}
-
-static int import_vgem_fd(int vgem_fd, int dma_buf_fd, uint32_t *handle)
-{
-   struct drm_prime_handle import_handle = {
-   .fd = dma_buf_fd,
-   .flags = 0,
-   .handle = 0,
-};
-   int ret;
-
-   ret = ioctl(vgem_fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, _handle);
-   if (ret == 0)
-   *handle = import_handle.handle;
-   return ret;
-}
-
-static void close_handle(int vgem_fd, uint32_t handle)
-{
-   struct drm_gem_close close = {
-   .handle = handle,
-   };
-
-   ioctl(vgem_fd, DRM_IOCTL_GEM_CLOSE, );
-}
-
-static int dmabuf_heap_open(char *name)
-{
-   int ret, fd;
-   char buf[256];
-
-   ret = snprintf(buf, 256, "%s/%s", DEVPATH, name);
-   if (ret < 0) {
-   printf("snprintf failed!\n");
-   return ret;
-   }
-
-   fd = open(buf, O_RDWR);
-   if (fd < 0)
-   printf("open %s failed!\n", buf);
-   return fd;
-}
-
-static int dmabuf_heap_alloc(int fd, size_t len, unsigned int flags,
-int *dmabuf_fd)
-{
-   struct dma_heap_allocation_data data = {
-   .len = len,
-   .fd_flags = O_RDWR | O_CLOEXEC,
-   .heap_flags = flags,
-   };
-   int ret;
-
-   if (!dmabuf_fd)
-   return -EINVAL;
-
-   ret = ioctl(fd, DMA_HEAP_IOC_ALLOC, );
-   if (ret < 0)
-   return ret;
-   *dmabuf_fd = (int)data.fd;
-   return ret;
-}
-
-static void dmabuf_sync(int fd, int start_stop)
-{
-   struct dma_buf_sync sync = {
-   .flags = start_stop | DMA_BUF_SYNC_RW,
-   };
-   int ret;
-
-   ret = ioctl(fd, DMA_BUF_IOCTL_SYNC, );
-   if (ret)
-   printf("sync failed %d\n", errno);
-}
-
-#define ONE_MEG (1024 * 1024)
-
-static int do_test(char *heap_name)
-{
-   int heap_fd = -1, dmabuf_fd = -1, importer_fd = -1;
-  

[PATCH 4/5] Revert "dma-buf: heaps: Add heap helpers"

2019-10-30 Thread Sean Paul
From: Sean Paul 

This reverts commit 7b87ea704fd9606eaafa9150116536d72f5c4b1f.

This patchset doesn't meet the UAPI requirements set out in [1] for the DRM
subsystem. Once the userspace component is reviewed and ready for merge
we can try again.

[1]- 
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Fixes: 7b87ea704fd9 ("dma-buf: heaps: Add heap helpers")
Cc: Laura Abbott 
Cc: Benjamin Gaignard 
Cc: Sumit Semwal 
Cc: Liam Mark 
Cc: Pratik Patel 
Cc: Brian Starkey 
Cc: Vincent Donnefort 
Cc: Sudipto Paul 
Cc: Andrew F. Davis 
Cc: Christoph Hellwig 
Cc: Chenbo Feng 
Cc: Alistair Strachan 
Cc: Hridya Valsaraju 
Cc: Hillf Danton 
Cc: dri-devel@lists.freedesktop.org
Cc: Brian Starkey 
Cc: John Stultz 
Cc: "Andrew F. Davis" 
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
Signed-off-by: Sean Paul 
---
 drivers/dma-buf/Makefile |   1 -
 drivers/dma-buf/heaps/Makefile   |   2 -
 drivers/dma-buf/heaps/heap-helpers.c | 268 ---
 drivers/dma-buf/heaps/heap-helpers.h |  55 --
 4 files changed, 326 deletions(-)
 delete mode 100644 drivers/dma-buf/heaps/Makefile
 delete mode 100644 drivers/dma-buf/heaps/heap-helpers.c
 delete mode 100644 drivers/dma-buf/heaps/heap-helpers.h

diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index 9c190026bfab..caee5eb3d351 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -2,7 +2,6 @@
 obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \
 dma-resv.o seqno-fence.o
 obj-$(CONFIG_DMABUF_HEAPS) += dma-heap.o
-obj-$(CONFIG_DMABUF_HEAPS) += heaps/
 obj-$(CONFIG_SYNC_FILE)+= sync_file.o
 obj-$(CONFIG_SW_SYNC)  += sw_sync.o sync_debug.o
 obj-$(CONFIG_UDMABUF)  += udmabuf.o
diff --git a/drivers/dma-buf/heaps/Makefile b/drivers/dma-buf/heaps/Makefile
deleted file mode 100644
index de49898112db..
--- a/drivers/dma-buf/heaps/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-obj-y  += heap-helpers.o
diff --git a/drivers/dma-buf/heaps/heap-helpers.c 
b/drivers/dma-buf/heaps/heap-helpers.c
deleted file mode 100644
index 750bef4e902d..
--- a/drivers/dma-buf/heaps/heap-helpers.c
+++ /dev/null
@@ -1,268 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "heap-helpers.h"
-
-void init_heap_helper_buffer(struct heap_helper_buffer *buffer,
-void (*free)(struct heap_helper_buffer *))
-{
-   buffer->priv_virt = NULL;
-   mutex_init(>lock);
-   buffer->vmap_cnt = 0;
-   buffer->vaddr = NULL;
-   buffer->pagecount = 0;
-   buffer->pages = NULL;
-   INIT_LIST_HEAD(>attachments);
-   buffer->free = free;
-}
-
-struct dma_buf *heap_helper_export_dmabuf(struct heap_helper_buffer *buffer,
- int fd_flags)
-{
-   DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
-
-   exp_info.ops = _helper_ops;
-   exp_info.size = buffer->size;
-   exp_info.flags = fd_flags;
-   exp_info.priv = buffer;
-
-   return dma_buf_export(_info);
-}
-
-static void *dma_heap_map_kernel(struct heap_helper_buffer *buffer)
-{
-   void *vaddr;
-
-   vaddr = vmap(buffer->pages, buffer->pagecount, VM_MAP, PAGE_KERNEL);
-   if (!vaddr)
-   return ERR_PTR(-ENOMEM);
-
-   return vaddr;
-}
-
-static void dma_heap_buffer_destroy(struct heap_helper_buffer *buffer)
-{
-   if (buffer->vmap_cnt > 0) {
-   WARN("%s: buffer still mapped in the kernel\n", __func__);
-   vunmap(buffer->vaddr);
-   }
-
-   buffer->free(buffer);
-}
-
-static void *dma_heap_buffer_vmap_get(struct heap_helper_buffer *buffer)
-{
-   void *vaddr;
-
-   if (buffer->vmap_cnt) {
-   buffer->vmap_cnt++;
-   return buffer->vaddr;
-   }
-   vaddr = dma_heap_map_kernel(buffer);
-   if (IS_ERR(vaddr))
-   return vaddr;
-   buffer->vaddr = vaddr;
-   buffer->vmap_cnt++;
-   return vaddr;
-}
-
-static void dma_heap_buffer_vmap_put(struct heap_helper_buffer *buffer)
-{
-   if (!--buffer->vmap_cnt) {
-   vunmap(buffer->vaddr);
-   buffer->vaddr = NULL;
-   }
-}
-
-struct dma_heaps_attachment {
-   struct device *dev;
-   struct sg_table table;
-   struct list_head list;
-};
-
-static int dma_heap_attach(struct dma_buf *dmabuf,
-  struct dma_buf_attachment *attachment)
-{
-   struct dma_heaps_attachment *a;
-   struct heap_helper_buffer *buffer = dmabuf->priv;
-   int ret;
-
-   a = kzalloc(sizeof(*a), GFP_KERNEL);
-   if (!a)
-   return -ENOMEM;
-
-   ret = sg_alloc_table_from_pages(>table, buffer->pages,
-   

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

2019-10-30 Thread Sean Paul
From: Sean Paul 

While the kernel set has a solid number of r-b's and acks, the
userspace component does not meet the drm requirements of being
"reviewed and ready for merging into a suitable and canonical upstream
project".

Once the userspace portion has been reviewed, let's try again.

Sean

[1] 
https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Sean Paul (5):
  Revert "kselftests: Add dma-heap test"
  Revert "dma-buf: heaps: Add CMA heap to dmabuf heaps"
  Revert "dma-buf: heaps: Add system heap to dmabuf heaps"
  Revert "dma-buf: heaps: Add heap helpers"
  Revert "dma-buf: Add dma-buf heaps framework"

 MAINTAINERS   |  18 --
 drivers/dma-buf/Kconfig   |  11 -
 drivers/dma-buf/Makefile  |   2 -
 drivers/dma-buf/dma-heap.c| 269 --
 drivers/dma-buf/heaps/Kconfig |  14 -
 drivers/dma-buf/heaps/Makefile|   4 -
 drivers/dma-buf/heaps/cma_heap.c  | 178 
 drivers/dma-buf/heaps/heap-helpers.c  | 268 -
 drivers/dma-buf/heaps/heap-helpers.h  |  55 
 drivers/dma-buf/heaps/system_heap.c   | 124 
 include/linux/dma-heap.h  |  59 
 include/uapi/linux/dma-heap.h |  55 
 tools/testing/selftests/dmabuf-heaps/Makefile |   9 -
 .../selftests/dmabuf-heaps/dmabuf-heap.c  | 238 
 14 files changed, 1304 deletions(-)
 delete mode 100644 drivers/dma-buf/dma-heap.c
 delete mode 100644 drivers/dma-buf/heaps/Kconfig
 delete mode 100644 drivers/dma-buf/heaps/Makefile
 delete mode 100644 drivers/dma-buf/heaps/cma_heap.c
 delete mode 100644 drivers/dma-buf/heaps/heap-helpers.c
 delete mode 100644 drivers/dma-buf/heaps/heap-helpers.h
 delete mode 100644 drivers/dma-buf/heaps/system_heap.c
 delete mode 100644 include/linux/dma-heap.h
 delete mode 100644 include/uapi/linux/dma-heap.h
 delete mode 100644 tools/testing/selftests/dmabuf-heaps/Makefile
 delete mode 100644 tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c

-- 
Sean Paul, Software Engineer, Google / Chromium OS

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

Re: [PATCH 1/3 v4] drm/panel: Add generic DSI panel YAML bindings

2019-10-30 Thread Rob Herring
On Wed, Oct 30, 2019 at 8:50 AM Linus Walleij  wrote:
>
> On Fri, Oct 25, 2019 at 9:20 PM Rob Herring  wrote:
>
> > [Me]
> > > +dsi-controller@55aa55aa {
> > > +  compatible = "acme,foo";
> >
> > Eventually, I want to start reporting if compatible strings aren't
> > documented (i.e. matched to a schema). This will break then...
>
> OK I drop this.
>
> > > +  reg = <0x55aa55aa>;
> >
> > This will fail because a size cell is expected.
>
> Do you mean it will fail the day we actually check reg properties to
> be properly formed under the circumstances?
>
> Because:
>   HOSTLD  scripts/dtc/dtc
>   CHKDT   Documentation/devicetree/bindings/display/panel/sony,acx424akp.yaml
>   CHKDT   Documentation/devicetree/bindings/display/dsi-controller.yaml
>   SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
> (...)
>
> It passes just fine.

Yes, but the examples are built and validated after this. With the
other errors currently, you're erroring out before this happens.

> I get a bit nervous since the schema is all about being strict about
> stuff so I get the feeling that "should have failed".

It's actually dtc that will complain here because it's aware of
#*-cells values. Can't do that with schema.

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

[radeon-alex:amd-mainline-dkms-5.0 3711/4200] drivers/gpu/drm/ttm/ttm_bo_vm.c:137:44: error: 'struct vm_fault' has no member named 'virtual_address'

2019-10-30 Thread kbuild test robot
Hi Flora,

FYI, the error/warning still remains.

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.0
head:   52f70af32a6cef1ec5735145486d9154ab1248ac
commit: 5165cd1453625e59650a1ed9b0f269b41529e421 [3711/4200] Revert "Revert 
"drm/amd/autoconf: Test whether vm_fault->{address/vma} is available""
config: i386-randconfig-f002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout 5165cd1453625e59650a1ed9b0f269b41529e421
# save the attached .config to linux build tree
make ARCH=i386 

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

All errors (new ones prefixed by >>):

from :0:
   include/linux/sched/mm.h:234:20: note: previous definition of 
'memalloc_nofs_restore' was here
static inline void memalloc_nofs_restore(unsigned int flags)
   ^
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_mm.h:61:21: error: redefinition of 'kvmalloc'
static inline void *kvmalloc(size_t size, gfp_t flags)
^~~~
   In file included from include/linux/scatterlist.h:8:0,
from include/linux/dma-mapping.h:11,
from include/drm/drmP.h:37,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/linux/mm.h:602:21: note: previous definition of 'kvmalloc' was here
static inline void *kvmalloc(size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_mm.h:71:21: error: redefinition of 'kvzalloc'
static inline void *kvzalloc(size_t size, gfp_t flags)
^~~~
   In file included from include/linux/scatterlist.h:8:0,
from include/linux/dma-mapping.h:11,
from include/drm/drmP.h:37,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/linux/mm.h:610:21: note: previous definition of 'kvzalloc' was here
static inline void *kvzalloc(size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_mm.h:81:20: error: static declaration of 'kvfree' follows 
non-static declaration
static inline void kvfree(const void *addr)
   ^~
   In file included from include/linux/scatterlist.h:8:0,
from include/linux/dma-mapping.h:11,
from include/drm/drmP.h:37,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/linux/mm.h:630:13: note: previous declaration of 'kvfree' was here
extern void kvfree(const void *addr);
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_mm.h:101:21: error: redefinition of 'kvmalloc_array'
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from include/linux/scatterlist.h:8:0,
from include/linux/dma-mapping.h:11,
from include/drm/drmP.h:37,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/linux/mm.h:615:21: note: previous definition of 'kvmalloc_array' was 
here
static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
^~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_mm.h:114:21: error: redefinition of 'kvcalloc'
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
^~~~
   In file included from include/linux/scatterlist.h:8:0,
from include/linux/dma-mapping.h:11,
from include/drm/drmP.h:37,
from include/kcl/kcl_drm.h:6,
from drivers/gpu/drm/ttm/backport/backport.h:6,
from :0:
   include/linux/mm.h:625:21: note: previous definition of 'kvcalloc' was here
static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
^~~~
   In file included from drivers/gpu/drm/ttm/backport/backport.h:11:0,
from :0:
   include/kcl/kcl_mm.h:121:20: error: redefinition of 'mmgrab'
static inline void mmgrab(struct mm_struct *mm)
   ^~
   In file included from include/kcl/kcl_mm.h:6:0,
   

Re: [PATCH 2/3 v4] drm/panel: Add DT bindings for Sony ACX424AKP

2019-10-30 Thread Rob Herring
On Wed, Oct 30, 2019 at 11:38 AM Linus Walleij  wrote:
>
> On Fri, Oct 25, 2019 at 9:25 PM Rob Herring  wrote:
> > On Thu, Oct 24, 2019 at 01:43:04PM +0200, Linus Walleij wrote:
> > > This adds device tree bindings for the Sony ACX424AKP panel.
> > > Let's use YAML.
> >
> > Also broken. Run 'make dt_binding_check'.
>
> That is what I'm doing.
>
> make -f Makefile -j5 -l4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
> KBUILD_OUTPUT=/home/linus/linux-stericsson/build-ux500
> dt_binding_check
>   CHKDT   Documentation/devicetree/bindings/display/panel/sony,acx424akp.yaml
>   CHKDT   Documentation/devicetree/bindings/display/dsi-controller.yaml
>   SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
> (...)
>
> I'm a bit unsure how this thing works. Are the several passes?
> Because later on this breaks because of an unrelated error in
> the bindings upstream:
> /home/linus/linux-stericsson/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml:
> properties:compatible:enum:0: {'const': 'regulator-fixed'} is not of
> type 'string'
> /home/linus/linux-stericsson/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml:
> properties:compatible:enum:1: {'const': 'regulator-fixed-clock'} is
> not of type 'string'
> (...)
>
> This is v5.4-rc1.
>
> Is there any way I can selectively make dt_bindings_check just target
> the files I wanna check as any brokenness upstream cause problems
> like this? (And I assume that will keep happening.)

I pass '-k' to make so we don't stop. You can also set DT_SCHEMA_FILES
to the file you want to check. Linus' tree is fixed now (and next just
broke :( ).

Yes, it will keep happening as long as maintainers don't run checks
and/or take patches before I review them.

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

[PATCH 09/13] drm/amd/display: Validate DSC caps on MST endpoints

2019-10-30 Thread mikita.lipski
From: David Francis 

During MST mode enumeration, if a new dc_sink is created,
populate it with dsc caps as appropriate.

Use drm_dp_mst_dsc_aux_for_port to get the raw caps,
then parse them onto dc_sink with dc_dsc_parse_dsc_dpcd.

Reviewed-by: Wenjing Liu 
Signed-off-by: David Francis 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  3 ++
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 31 ++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 910c8598faf9..37ca191a5b1c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -279,6 +279,9 @@ struct amdgpu_dm_connector {
struct drm_dp_mst_port *port;
struct amdgpu_dm_connector *mst_port;
struct amdgpu_encoder *mst_encoder;
+#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
+   struct drm_dp_aux *dsc_aux;
+#endif
 
/* TODO see if we can merge with ddc_bus or make a dm_connector */
struct amdgpu_i2c_adapter *i2c;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 1a17ea1b42e0..804a00082bee 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -25,6 +25,7 @@
 
 #include 
 #include 
+#include 
 #include "dm_services.h"
 #include "amdgpu.h"
 #include "amdgpu_dm.h"
@@ -188,6 +189,28 @@ static const struct drm_connector_funcs 
dm_dp_mst_connector_funcs = {
.early_unregister = amdgpu_dm_mst_connector_early_unregister,
 };
 
+#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
+static bool validate_dsc_caps_on_connector(struct amdgpu_dm_connector 
*aconnector)
+{
+   struct dc_sink *dc_sink = aconnector->dc_sink;
+   struct drm_dp_mst_port *port = aconnector->port;
+   u8 dsc_caps[16] = { 0 };
+
+   aconnector->dsc_aux = drm_dp_mst_dsc_aux_for_port(port);
+
+   if (!aconnector->dsc_aux)
+   return false;
+
+   if (drm_dp_dpcd_read(aconnector->dsc_aux, DP_DSC_SUPPORT, dsc_caps, 16) 
< 0)
+   return false;
+
+   if (!dc_dsc_parse_dsc_dpcd(dsc_caps, NULL, 
_sink->sink_dsc_caps.dsc_dec_caps))
+   return false;
+
+   return true;
+}
+#endif
+
 static int dm_dp_mst_get_modes(struct drm_connector *connector)
 {
struct amdgpu_dm_connector *aconnector = 
to_amdgpu_dm_connector(connector);
@@ -230,10 +253,16 @@ static int dm_dp_mst_get_modes(struct drm_connector 
*connector)
/* dc_link_add_remote_sink returns a new reference */
aconnector->dc_sink = dc_sink;
 
-   if (aconnector->dc_sink)
+   if (aconnector->dc_sink) {
amdgpu_dm_update_freesync_caps(
connector, aconnector->edid);
 
+#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
+   if (!validate_dsc_caps_on_connector(aconnector))
+   memset(>dc_sink->sink_dsc_caps,
+  0, 
sizeof(aconnector->dc_sink->sink_dsc_caps));
+#endif
+   }
}
 
drm_connector_update_edid_property(
-- 
2.17.1

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

[PATCH 06/13] drm/dp_mst: Add helpers for MST DSC and virtual DPCD aux

2019-10-30 Thread mikita.lipski
From: David Francis 

Add drm_dp_mst_dsc_aux_for_port. To enable DSC, the DSC_ENABLED
register might have to be written on the leaf port's DPCD,
its parent's DPCD, or the MST manager's DPCD. This function
finds the correct aux for the job.

As part of this, add drm_dp_mst_is_virtual_dpcd. Virtual DPCD
is a DP feature new in DP v1.4, which exposes certain DPCD
registers on virtual ports.

v2: Remember to unlock mutex on all paths
v3: Refactor to match coding style and increase brevity

Reviewed-by: Lyude Paul 
Reviewed-by: Wenjing Liu 
Signed-off-by: David Francis 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 127 ++
 include/drm/drm_dp_mst_helper.h   |   2 +
 2 files changed, 129 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 502923c24450..d8f9ba27b559 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -4150,3 +4150,130 @@ static void drm_dp_mst_unregister_i2c_bus(struct 
drm_dp_aux *aux)
 {
i2c_del_adapter(>ddc);
 }
+
+/**
+ * drm_dp_mst_is_virtual_dpcd() - Is the given port a virtual DP Peer Device
+ * @port: The port to check
+ *
+ * A single physical MST hub object can be represented in the topology
+ * by multiple branches, with virtual ports between those branches.
+ *
+ * As of DP1.4, An MST hub with internal (virtual) ports must expose
+ * certain DPCD registers over those ports. See sections 2.6.1.1.1
+ * and 2.6.1.1.2 of Display Port specification v1.4 for details.
+ *
+ * May acquire mgr->lock
+ *
+ * Returns:
+ * true if the port is a virtual DP peer device, false otherwise
+ */
+static bool drm_dp_mst_is_virtual_dpcd(struct drm_dp_mst_port *port)
+{
+   struct drm_dp_mst_port *downstream_port;
+
+   if (!port || port->dpcd_rev < DP_DPCD_REV_14)
+   return false;
+
+   /* Virtual DP Sink (Internal Display Panel) */
+   if (port->port_num >= 8)
+   return true;
+
+   /* DP-to-HDMI Protocol Converter */
+   if (port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV &&
+   !port->mcs &&
+   port->ldps)
+   return true;
+
+   /* DP-to-DP */
+   mutex_lock(>mgr->lock);
+   if (port->pdt == DP_PEER_DEVICE_MST_BRANCHING &&
+   port->mstb &&
+   port->mstb->num_ports == 2) {
+   list_for_each_entry(downstream_port, >mstb->ports, next) {
+   if (downstream_port->pdt == DP_PEER_DEVICE_SST_SINK &&
+   !downstream_port->input) {
+   mutex_unlock(>mgr->lock);
+   return true;
+   }
+   }
+   }
+   mutex_unlock(>mgr->lock);
+
+   return false;
+}
+
+/**
+ * drm_dp_mst_dsc_aux_for_port() - Find the correct aux for DSC
+ * @port: The port to check. A leaf of the MST tree with an attached display.
+ *
+ * Depending on the situation, DSC may be enabled via the endpoint aux,
+ * the immediately upstream aux, or the connector's physical aux.
+ *
+ * This is both the correct aux to read DSC_CAPABILITY and the
+ * correct aux to write DSC_ENABLED.
+ *
+ * This operation can be expensive (up to four aux reads), so
+ * the caller should cache the return.
+ *
+ * Returns:
+ * NULL if DSC cannot be enabled on this port, otherwise the aux device
+ */
+struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct drm_dp_mst_port *port)
+{
+   struct drm_dp_mst_port *immediate_upstream_port;
+   struct drm_dp_mst_port *fec_port;
+
+   if (!port)
+   return NULL;
+
+   if (port->parent)
+   immediate_upstream_port = port->parent->port_parent;
+   else
+   immediate_upstream_port = NULL;
+
+   fec_port = immediate_upstream_port;
+   while (fec_port) {
+   /*
+* Each physical link (i.e. not a virtual port) between the
+* output and the primary device must support FEC
+*/
+   if (!drm_dp_mst_is_virtual_dpcd(fec_port) &&
+   !fec_port->fec_capable)
+   return NULL;
+
+   fec_port = fec_port->parent->port_parent;
+   }
+
+   /* DP-to-DP peer device */
+   if (drm_dp_mst_is_virtual_dpcd(immediate_upstream_port)) {
+   u8 upstream_dsc;
+   u8 endpoint_dsc;
+   u8 endpoint_fec;
+
+   if (drm_dp_dpcd_read(>aux,
+DP_DSC_SUPPORT, _dsc, 1) < 0)
+   return NULL;
+   if (drm_dp_dpcd_read(>aux,
+DP_FEC_CAPABILITY, _fec, 1) < 0)
+   return NULL;
+   if (drm_dp_dpcd_read(_upstream_port->aux,
+DP_DSC_SUPPORT, _dsc, 1) < 0)
+   return NULL;
+
+   /* Enpoint decompression with DP-to-DP peer device */
+   if 

[PATCH v4 00/13] DSC MST support for AMDGPU

2019-10-30 Thread mikita.lipski
From: Mikita Lipski 


This set of patches is a continuation of DSC enablement
patches for AMDGPU. This set enables DSC on MST. It also
contains implementation of both encoder and connector
atomic check routines.

First 10 patches have been introduced in multiple
iterations to the mailing list before. These patches were
developed by David Francis as part of his work on DSC.

Other 3 patches add atomic check functionality to
encoder and connector to allocate and release VCPI
slots on each state atomic check. These changes
utilize newly added drm_mst_helper functions for
better tracking of VCPI slots.

v2: squashed previously 3 separate atomic check patches,
separate atomic check for dsc connectors, track vcpi and
pbn on connectors.

v3: Moved modeset trigger on affected MST displays to DRM

v4: Fix warnings, use current mode's bpc rather than display's
maximum capable one

David Francis (10):
  drm/dp_mst: Add PBN calculation for DSC modes
  drm/dp_mst: Parse FEC capability on MST ports
  drm/dp_mst: Add MST support to DP DPCD R/W functions
  drm/dp_mst: Fill branch->num_ports
  drm/dp_mst: Add helpers for MST DSC and virtual DPCD aux
  drm/amd/display: Initialize DSC PPS variables to 0
  drm/amd/display: Validate DSC caps on MST endpoints
  drm/amd/display: Write DSC enable to MST DPCD
  drm/amd/display: MST DSC compute fair share
  drm/dp_mst: Add new quirk for Synaptics MST hubs

Mikita Lipski (3):
  drm/amd/display: Add MST atomic routines
  drm/dp_mst: Add DSC enablement helpers to DRM
  drm/amd/display: Recalculate VCPI slots for new DSC connectors

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 109 -
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   5 +
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |  70 ++-
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 449 +-
 .../display/amdgpu_dm/amdgpu_dm_mst_types.h   |   4 +
 .../drm/amd/display/dc/core/dc_link_hwss.c|   3 +
 .../gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c  |   3 +
 .../drm/amd/display/dc/dcn20/dcn20_resource.c |   7 +-
 .../drm/amd/display/dc/dcn20/dcn20_resource.h |   1 +
 drivers/gpu/drm/drm_dp_aux_dev.c  |  12 +-
 drivers/gpu/drm/drm_dp_helper.c   |  33 +-
 drivers/gpu/drm/drm_dp_mst_topology.c | 277 ++-
 drivers/gpu/drm/i915/display/intel_dp_mst.c   |   3 +-
 drivers/gpu/drm/nouveau/dispnv50/disp.c   |   3 +-
 drivers/gpu/drm/radeon/radeon_dp_mst.c|   2 +-
 include/drm/drm_dp_helper.h   |   7 +
 include/drm/drm_dp_mst_helper.h   |  12 +-
 17 files changed, 925 insertions(+), 75 deletions(-)

-- 
2.17.1

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

[PATCH 11/13] drm/amd/display: MST DSC compute fair share

2019-10-30 Thread mikita.lipski
From: David Francis 

If there is limited link bandwidth on a MST network,
it must be divided fairly between the streams on that network

Implement an algorithm to determine the correct DSC config
for each stream

The algorithm:
This
 [   ]  ( )
represents the range of bandwidths possible for a given stream.
The [] area represents the range of DSC configs, and the ()
represents no DSC. The bandwidth used increases from left to right.

First, try disabling DSC on all streams
 [  ]  (|)
 [ ](|)
Check this against the bandwidth limits of the link and each branch
(including each endpoint). If it passes, the job is done

Second, try maximum DSC compression on all streams
that support DSC
 [| ]( )
 [|] ( )
If this does not pass, then enabling this combination of streams
is impossible

Otherwise, divide the remaining bandwidth evenly amongst the streams
 [|  ] ( )
 [|  ]( )

If one or more of the streams reach minimum compression, evenly
divide the reamining bandwidth amongst the remaining streams
 [|] ( )
 [   |]   ( )
 [ |   ]   ( )
 [ |  ]  ( )

If all streams can reach minimum compression, disable compression
greedily
 [  |]  ( )
 [|]( )
 [ ](|)

Perform this algorithm on each full update, on each MST link
with at least one DSC stream on it

After the configs are computed, call
dcn20_add_dsc_to_stream_resource on each stream with DSC enabled.
It is only after all streams are created that we can know which
of them will need DSC.

Do all of this at the end of amdgpu atomic check.  If it fails,
fail check; This combination of timings cannot be supported.

Reviewed-by: Wenjing Liu 
Signed-off-by: David Francis 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   4 +
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 386 ++
 .../display/amdgpu_dm/amdgpu_dm_mst_types.h   |   4 +
 .../drm/amd/display/dc/dcn20/dcn20_resource.c |   7 +-
 .../drm/amd/display/dc/dcn20/dcn20_resource.h |   1 +
 5 files changed, 400 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1309e9cfdea3..1bbdf29f3c7d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -7780,6 +7780,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
if (ret)
goto fail;
 
+#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
+   if (!compute_mst_dsc_configs_for_state(dm_state->context))
+   goto fail;
+#endif
if (dc_validate_global_state(dc, dm_state->context, false) != 
DC_OK) {
ret = -EINVAL;
goto fail;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 804a00082bee..c58cf41f3086 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -38,6 +38,8 @@
 
 #include "i2caux_interface.h"
 
+#include "dc/dcn20/dcn20_resource.h"
+
 /* #define TRACE_DPCD */
 
 #ifdef TRACE_DPCD
@@ -491,3 +493,387 @@ void amdgpu_dm_initialize_dp_connector(struct 
amdgpu_display_manager *dm,
aconnector->connector_id);
 }
 
+#ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
+struct dsc_mst_fairness_params {
+   struct dc_crtc_timing *timing;
+   struct dc_sink *sink;
+   struct dc_dsc_bw_range bw_range;
+   bool compression_possible;
+   struct drm_dp_mst_port *port;
+};
+
+struct dsc_mst_fairness_vars {
+   int pbn;
+   bool dsc_enabled;
+   int bpp_x16;
+};
+
+static bool port_downstream_of_branch(struct drm_dp_mst_port *port,
+   struct drm_dp_mst_branch *branch)
+{
+   while (port->parent) {
+   if (port->parent == branch)
+   return true;
+
+   if (port->parent->port_parent)
+   port = port->parent->port_parent;
+   else
+   break;
+   }
+   return false;
+}
+
+static bool check_pbn_limit_on_branch(struct drm_dp_mst_branch *branch,
+   struct dsc_mst_fairness_params *params,
+   struct dsc_mst_fairness_vars *vars, int count)
+{
+   struct drm_dp_mst_port *port;
+   int i;
+   int pbn_limit = 0;
+   int pbn_used = 0;
+
+   list_for_each_entry(port, >ports, next) {
+   if (port->mstb)
+   if (!check_pbn_limit_on_branch(port->mstb, params, 
vars, count))
+   return false;
+
+   if 

[PATCH 05/13] drm/dp_mst: Fill branch->num_ports

2019-10-30 Thread mikita.lipski
From: David Francis 

This field on drm_dp_mst_branch was never filled

It is initialized to zero when the port is kzallocced.
When a port is added to the list, increment num_ports,
and when a port is removed from the list, decrement num_ports.

v2: remember to decrement on port removal
v3: don't explicitly init to 0

Reviewed-by: Lyude Paul 
Reviewed-by: Harry Wentland 
Signed-off-by: David Francis 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 9f3604355705..502923c24450 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1669,6 +1669,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch 
*mstb,
mutex_lock(>mgr->lock);
drm_dp_mst_topology_get_port(port);
list_add(>next, >ports);
+   mstb->num_ports++;
mutex_unlock(>mgr->lock);
}
 
@@ -1703,6 +1704,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch 
*mstb,
/* remove it from the port list */
mutex_lock(>mgr->lock);
list_del(>next);
+   mstb->num_ports--;
mutex_unlock(>mgr->lock);
/* drop port list reference */
drm_dp_mst_topology_put_port(port);
-- 
2.17.1

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

[PATCH 10/13] drm/amd/display: Write DSC enable to MST DPCD

2019-10-30 Thread mikita.lipski
From: David Francis 

Rework the dm_helpers_write_dsc_enable callback to
handle the MST case.

Use the cached dsc_aux field.

Reviewed-by: Wenjing Liu 
Signed-off-by: David Francis 
---
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index 1b2cc85b4815..2144b65f4806 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -37,6 +37,7 @@
 #include "dc.h"
 #include "amdgpu_dm.h"
 #include "amdgpu_dm_irq.h"
+#include "amdgpu_dm_mst_types.h"
 
 #include "dm_helpers.h"
 
@@ -521,8 +522,24 @@ bool dm_helpers_dp_write_dsc_enable(
 )
 {
uint8_t enable_dsc = enable ? 1 : 0;
+   struct amdgpu_dm_connector *aconnector;
+
+   if (!stream)
+   return false;
+
+   if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
+   aconnector = (struct amdgpu_dm_connector 
*)stream->dm_stream_context;
+
+   if (!aconnector->dsc_aux)
+   return false;
+
+   return (drm_dp_dpcd_write(aconnector->dsc_aux, DP_DSC_ENABLE, 
_dsc, 1) >= 0);
+   }
+
+   if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT)
+   return dm_helpers_dp_write_dpcd(ctx, stream->link, 
DP_DSC_ENABLE, _dsc, 1);
 
-   return dm_helpers_dp_write_dpcd(ctx, stream->sink->link, DP_DSC_ENABLE, 
_dsc, 1);
+   return false;
 }
 #endif
 
-- 
2.17.1

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

[PATCH 08/13] drm/amd/display: Initialize DSC PPS variables to 0

2019-10-30 Thread mikita.lipski
From: David Francis 

For DSC MST, sometimes monitors would break out
in full-screen static. The issue traced back to the
PPS generation code, where these variables were being used
uninitialized and were picking up garbage.

memset to 0 to avoid this

Reviewed-by: Nicholas Kazlauskas 
Signed-off-by: David Francis 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 3 +++
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
index a519dbc5ecb6..5d6cbaebebc0 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
@@ -496,6 +496,9 @@ bool dp_set_dsc_pps_sdp(struct pipe_ctx *pipe_ctx, bool 
enable)
struct dsc_config dsc_cfg;
uint8_t dsc_packed_pps[128];
 
+   memset(_cfg, 0, sizeof(dsc_cfg));
+   memset(dsc_packed_pps, 0, 128);
+
/* Enable DSC hw block */
dsc_cfg.pic_width = stream->timing.h_addressable + 
stream->timing.h_border_left + stream->timing.h_border_right;
dsc_cfg.pic_height = stream->timing.v_addressable + 
stream->timing.v_border_top + stream->timing.v_border_bottom;
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c 
b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
index 63eb377ed9c0..296eeff00296 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.c
@@ -207,6 +207,9 @@ static bool dsc2_get_packed_pps(struct 
display_stream_compressor *dsc, const str
struct dsc_reg_values dsc_reg_vals;
struct dsc_optc_config dsc_optc_cfg;
 
+   memset(_reg_vals, 0, sizeof(dsc_reg_vals));
+   memset(_optc_cfg, 0, sizeof(dsc_optc_cfg));
+
DC_LOG_DSC("Getting packed DSC PPS for DSC Config:");
dsc_config_log(dsc, dsc_cfg);
DC_LOG_DSC("DSC Picture Parameter Set (PPS):");
-- 
2.17.1

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

[PATCH 12/13] drm/dp_mst: Add DSC enablement helpers to DRM

2019-10-30 Thread mikita.lipski
From: Mikita Lipski 

Adding the following elements to add MST DSC support to DRM:

- dsc_enable boolean flag to drm_dp_vcpi_allocation structure to signal,
which port got DSC enabled

- function drm_dp_helper_update_vcpi_slots_for_dsc allows reallocation
of newly recalculated VCPI slots and raises dsc_enable flag on the port.

- function drm_dp_mst_update_dsc_crtcs is called in drm_dp_mst_atomic_check,
its purpose is to iterate through all the ports in the topology and set
mode_changed flag on crtc if DSC has been enabled.

Cc: Harry Wentland 
Cc: Lyude Paul 
Signed-off-by: Mikita Lipski 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 103 +-
 include/drm/drm_dp_mst_helper.h   |   4 +
 2 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index d5df02315e14..4f2f09fe32f8 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -73,6 +73,7 @@ static bool drm_dp_validate_guid(struct 
drm_dp_mst_topology_mgr *mgr,
 static int drm_dp_mst_register_i2c_bus(struct drm_dp_aux *aux);
 static void drm_dp_mst_unregister_i2c_bus(struct drm_dp_aux *aux);
 static void drm_dp_mst_kick_tx(struct drm_dp_mst_topology_mgr *mgr);
+static void drm_dp_mst_update_dsc_crtcs(struct drm_dp_mst_topology_state 
*mst_state);
 
 #define DP_STR(x) [DP_ ## x] = #x
 
@@ -3293,6 +3294,65 @@ int drm_dp_atomic_find_vcpi_slots(struct 
drm_atomic_state *state,
 }
 EXPORT_SYMBOL(drm_dp_atomic_find_vcpi_slots);
 
+/**
+ * drm_dp_helper_update_vcpi_slots_for_dsc() - Update VCPI slots with new on 
the state
+ *
+ * @state: global atomic state
+ * @port: port to find vcpi slots
+ * @pbn: updated bandwidth required for the mode in PBN
+ *
+ * Function reallocates VCPI slots to the @port by calling
+ * drm_dp_atomic_find_vcpi_slots. The assumption is that VCPI slots
+ * have already been allocated and this is second call overwritting
+ * initial values. After the VCPI is allocated dsc_enable flag is set to
+ * true for atomic check.
+ *
+ * It is driver's responsibility to call this function after it decides
+ * to enable DSC.
+ *
+ * See also:
+ * drm_dp_mst_update_dsc_crtcs()
+ *
+ * Returns:
+ * Total slots in the atomic state assigned for this port, or a negative error
+ * code if the port no longer exists or vcpi slots haven't been assigned.
+ */
+int drm_dp_helper_update_vcpi_slots_for_dsc(struct drm_atomic_state *state,
+   struct drm_dp_mst_port *port,
+   int pbn)
+{
+   struct drm_dp_mst_topology_state *topology_state;
+   struct drm_dp_vcpi_allocation *pos;
+   bool found = false;
+   int vcpi = 0;
+
+   topology_state = drm_atomic_get_mst_topology_state(state, port->mgr);
+
+   if (IS_ERR(topology_state))
+   return PTR_ERR(topology_state);
+
+   list_for_each_entry(pos, _state->vcpis, next) {
+   if (pos->port == port) {
+   found = true;
+   break;
+   }
+   }
+
+   if (!found || !pos->vcpi)
+   return -EINVAL;
+
+   vcpi = drm_dp_atomic_find_vcpi_slots(state, port->mgr,
+port, pbn);
+
+   if (vcpi < 0)
+   return -EINVAL;
+
+   pos->dsc_enable = true;
+
+   return vcpi;
+}
+
+EXPORT_SYMBOL(drm_dp_helper_update_vcpi_slots_for_dsc);
 /**
  * drm_dp_atomic_release_vcpi_slots() - Release allocated vcpi slots
  * @state: global atomic state
@@ -3871,6 +3931,46 @@ drm_dp_mst_atomic_check_topology_state(struct 
drm_dp_mst_topology_mgr *mgr,
return 0;
 }
 
+/**
+ * drm_dp_mst_update_dsc_crtcs - Set mode change flag on CRTCs which
+ * just got DSC enabled
+ * @state: Pointer to the new  drm_dp_mst_topology_state
+ *
+ * Itearate through all the ports in MST topology to check if DSC
+ * has been enabled on any of them. Set mode_changed to true on
+ * crtc state that just got DSC enabled.
+ *
+ * See also:
+ * drm_dp_helper_update_vcpi_slots_for_dsc()
+ */
+static void
+drm_dp_mst_update_dsc_crtcs(struct drm_dp_mst_topology_state *mst_state)
+{
+   struct drm_dp_vcpi_allocation *pos;
+   struct drm_dp_mst_port *port;
+   struct drm_connector_state *conn_state;
+   struct drm_crtc *crtc;
+   struct drm_crtc_state *crtc_state;
+
+   list_for_each_entry(pos, _state->vcpis, next) {
+
+   port = pos->port;
+   conn_state = 
drm_atomic_get_connector_state(mst_state->base.state,
+   port->connector);
+   crtc = conn_state->crtc;
+   if (!crtc)
+   continue;
+
+   crtc_state = drm_atomic_get_crtc_state(mst_state->base.state, 
crtc);
+   if (port->vcpi.vcpi == pos->vcpi)
+   continue;
+
+   if (pos->dsc_enable) {
+ 

[PATCH 13/13] drm/amd/display: Recalculate VCPI slots for new DSC connectors

2019-10-30 Thread mikita.lipski
From: Mikita Lipski 

Since for DSC MST connector's PBN is claculated differently
due to compression, we have to recalculate both PBN and
VCPI slots for that connector.

The function iterates through all the active streams to
find, which have DSC enabled, then recalculates PBN for
it and calls drm_dp_helper_update_vcpi_slots_for_dsc to
update connector's VCPI slots.

Cc: Jerry Zuo 
Cc: Harry Wentland 
Cc: Lyude Paul 
Signed-off-by: Mikita Lipski 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 50 +--
 1 file changed, 45 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1bbdf29f3c7d..1bc02957cd18 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4674,6 +4674,43 @@ const struct drm_encoder_helper_funcs 
amdgpu_dm_encoder_helper_funcs = {
.atomic_check = dm_encoder_helper_atomic_check
 };
 
+static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state,
+   struct dc_state *dc_state)
+{
+   struct dc_stream_state *stream;
+   struct amdgpu_dm_connector *aconnector;
+   struct dm_connector_state *dm_conn_state;
+   int i = 0, clock = 0, bpp = 0;
+
+   for (i = 0; i < dc_state->stream_count; i++) {
+
+   stream = dc_state->streams[i];
+
+   if (!stream)
+   continue;
+
+   aconnector = (struct amdgpu_dm_connector 
*)stream->dm_stream_context;
+   dm_conn_state = to_dm_connector_state(aconnector->base.state);
+
+   if (!aconnector->port)
+   continue;
+
+   if (stream->timing.flags.DSC != 1)
+   continue;
+
+   bpp = 
convert_dc_color_depth_into_bpc(stream->timing.display_color_depth)* 3;
+   clock = stream->timing.pix_clk_100hz / 10;
+
+   dm_conn_state->pbn =  drm_dp_calc_pbn_mode(clock, bpp, true);
+
+   dm_conn_state->vcpi_slots = 
drm_dp_helper_update_vcpi_slots_for_dsc(state, aconnector->port, 
dm_conn_state->pbn);
+
+   if (dm_conn_state->vcpi_slots < 0)
+   return dm_conn_state->vcpi_slots;
+   }
+   return 0;
+}
+
 static void dm_drm_plane_reset(struct drm_plane *plane)
 {
struct dm_plane_state *amdgpu_state = NULL;
@@ -7707,11 +7744,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
if (ret)
goto fail;
 
-   /* Perform validation of MST topology in the state*/
-   ret = drm_dp_mst_atomic_check(state);
-   if (ret)
-   goto fail;
-
if (state->legacy_cursor_update) {
/*
 * This is a fast cursor update coming from the plane update
@@ -7783,6 +7815,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
 #ifdef CONFIG_DRM_AMD_DC_DSC_SUPPORT
if (!compute_mst_dsc_configs_for_state(dm_state->context))
goto fail;
+
+   ret = dm_update_mst_vcpi_slots_for_dsc(state, 
dm_state->context);
+   if (ret)
+   goto fail;
 #endif
if (dc_validate_global_state(dc, dm_state->context, false) != 
DC_OK) {
ret = -EINVAL;
@@ -7812,6 +7848,10 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
dc_retain_state(old_dm_state->context);
}
}
+   /* Perform validation of MST topology in the state*/
+   ret = drm_dp_mst_atomic_check(state);
+   if (ret)
+   goto fail;
 
/* Store the overall update type for use later in atomic check. */
for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
-- 
2.17.1

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

[PATCH 04/13] drm/dp_mst: Add MST support to DP DPCD R/W functions

2019-10-30 Thread mikita.lipski
From: David Francis 

Instead of having drm_dp_dpcd_read/write and
drm_dp_mst_dpcd_read/write as entry points into the
aux code, have drm_dp_dpcd_read/write handle both.

This means that DRM drivers can make MST DPCD read/writes.

v2: Fix spacing
v3: Dump dpcd access on MST read/writes
v4: Fix calling wrong function on DPCD write

Reviewed-by: Lyude Paul 
Reviewed-by: Harry Wentland 
Signed-off-by: David Francis 
Signed-off-by: Mikita Lipski 
---
 drivers/gpu/drm/drm_dp_aux_dev.c | 12 ++--
 drivers/gpu/drm/drm_dp_helper.c  | 31 +--
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c b/drivers/gpu/drm/drm_dp_aux_dev.c
index 0cfb386754c3..2510717d5a08 100644
--- a/drivers/gpu/drm/drm_dp_aux_dev.c
+++ b/drivers/gpu/drm/drm_dp_aux_dev.c
@@ -163,11 +163,7 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb, struct 
iov_iter *to)
break;
}
 
-   if (aux_dev->aux->is_remote)
-   res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf,
-  todo);
-   else
-   res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+   res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
 
if (res <= 0)
break;
@@ -215,11 +211,7 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb, 
struct iov_iter *from)
break;
}
 
-   if (aux_dev->aux->is_remote)
-   res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf,
-   todo);
-   else
-   res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+   res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
 
if (res <= 0)
break;
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index ffc68d305afe..af1cd968adfd 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -32,6 +32,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "drm_crtc_helper_internal.h"
 
@@ -251,7 +253,7 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 
request,
 
 /**
  * drm_dp_dpcd_read() - read a series of bytes from the DPCD
- * @aux: DisplayPort AUX channel
+ * @aux: DisplayPort AUX channel (SST or MST)
  * @offset: address of the (first) register to read
  * @buffer: buffer to store the register values
  * @size: number of bytes in @buffer
@@ -280,13 +282,18 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned 
int offset,
 * We just have to do it before any DPCD access and hope that the
 * monitor doesn't power down exactly after the throw away read.
 */
-   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, buffer,
-1);
-   if (ret != 1)
-   goto out;
+   if (!aux->is_remote) {
+   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV,
+buffer, 1);
+   if (ret != 1)
+   goto out;
+   }
 
-   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer,
-size);
+   if (aux->is_remote)
+   ret = drm_dp_mst_dpcd_read(aux, offset, buffer, size);
+   else
+   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset,
+buffer, size);
 
 out:
drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret);
@@ -296,7 +303,7 @@ EXPORT_SYMBOL(drm_dp_dpcd_read);
 
 /**
  * drm_dp_dpcd_write() - write a series of bytes to the DPCD
- * @aux: DisplayPort AUX channel
+ * @aux: DisplayPort AUX channel (SST or MST)
  * @offset: address of the (first) register to write
  * @buffer: buffer containing the values to write
  * @size: number of bytes in @buffer
@@ -313,8 +320,12 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned 
int offset,
 {
int ret;
 
-   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer,
-size);
+   if (aux->is_remote)
+   ret = drm_dp_mst_dpcd_write(aux, offset, buffer, size);
+   else
+   ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset,
+buffer, size);
+
drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret);
return ret;
 }
-- 
2.17.1

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

[PATCH 03/13] drm/dp_mst: Parse FEC capability on MST ports

2019-10-30 Thread mikita.lipski
From: David Francis 

As of DP1.4, ENUM_PATH_RESOURCES returns a bit indicating
if FEC can be supported up to that point in the MST network.

The bit is the first byte of the ENUM_PATH_RESOURCES ack reply,
bottom-most bit (refer to section 2.11.9.4 of DP standard,
v1.4)

That value is needed for FEC and DSC support

Store it on drm_dp_mst_port

Reviewed-by: Lyude Paul 
Reviewed-by: Harry Wentland 
Signed-off-by: David Francis 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 2 ++
 include/drm/drm_dp_mst_helper.h   | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 3e7b7553cf4d..9f3604355705 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -553,6 +553,7 @@ static bool 
drm_dp_sideband_parse_enum_path_resources_ack(struct drm_dp_sideband
 {
int idx = 1;
repmsg->u.path_resources.port_number = (raw->msg[idx] >> 4) & 0xf;
+   repmsg->u.path_resources.fec_capable = raw->msg[idx] & 0x1;
idx++;
if (idx > raw->curlen)
goto fail_len;
@@ -2183,6 +2184,7 @@ static int drm_dp_send_enum_path_resources(struct 
drm_dp_mst_topology_mgr *mgr,
DRM_DEBUG_KMS("enum path resources %d: %d %d\n", 
txmsg->reply.u.path_resources.port_number, 
txmsg->reply.u.path_resources.full_payload_bw_number,
   
txmsg->reply.u.path_resources.avail_payload_bw_number);
port->available_pbn = 
txmsg->reply.u.path_resources.avail_payload_bw_number;
+   port->fec_capable = 
txmsg->reply.u.path_resources.fec_capable;
}
}
 
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
index 9116b2c95239..f113ae04fa88 100644
--- a/include/drm/drm_dp_mst_helper.h
+++ b/include/drm/drm_dp_mst_helper.h
@@ -108,6 +108,8 @@ struct drm_dp_mst_port {
 * audio-capable.
 */
bool has_audio;
+
+   bool fec_capable;
 };
 
 /**
@@ -312,6 +314,7 @@ struct drm_dp_port_number_req {
 
 struct drm_dp_enum_path_resources_ack_reply {
u8 port_number;
+   bool fec_capable;
u16 full_payload_bw_number;
u16 avail_payload_bw_number;
 };
-- 
2.17.1

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

[PATCH 07/13] drm/dp_mst: Add new quirk for Synaptics MST hubs

2019-10-30 Thread mikita.lipski
From: Mikita Lipski 

Synaptics DP1.4 hubs (BRANCH_ID 0x90CC24) do not
support virtual DPCD registers, but do support DSC.
The DSC caps can be read from the physical aux,
like in SST DSC. These hubs have many different
DEVICE_IDs.  Add a new quirk to detect this case.

Reviewed-by: Wenjing Liu 
Reviewed-by: Lyude Paul 
Signed-off-by: David Francis 
---
 drivers/gpu/drm/drm_dp_helper.c   |  2 ++
 drivers/gpu/drm/drm_dp_mst_topology.c | 27 +++
 include/drm/drm_dp_helper.h   |  7 +++
 3 files changed, 36 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index af1cd968adfd..02fa8c3d9a82 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -1271,6 +1271,8 @@ static const struct dpcd_quirk dpcd_quirk_list[] = {
{ OUI(0x00, 0x10, 0xfa), DEVICE_ID_ANY, false, 
BIT(DP_DPCD_QUIRK_NO_PSR) },
/* CH7511 seems to leave SINK_COUNT zeroed */
{ OUI(0x00, 0x00, 0x00), DEVICE_ID('C', 'H', '7', '5', '1', '1'), 
false, BIT(DP_DPCD_QUIRK_NO_SINK_COUNT) },
+   /* Synaptics DP1.4 MST hubs can support DSC without virtual DPCD */
+   { OUI(0x90, 0xCC, 0x24), DEVICE_ID_ANY, true, 
BIT(DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) },
 };
 
 #undef OUI
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index d8f9ba27b559..d5df02315e14 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -4222,6 +4222,7 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct 
drm_dp_mst_port *port)
 {
struct drm_dp_mst_port *immediate_upstream_port;
struct drm_dp_mst_port *fec_port;
+   struct drm_dp_desc desc = { 0 };
 
if (!port)
return NULL;
@@ -4274,6 +4275,32 @@ struct drm_dp_aux *drm_dp_mst_dsc_aux_for_port(struct 
drm_dp_mst_port *port)
if (drm_dp_mst_is_virtual_dpcd(port))
return >aux;
 
+   /*
+* Synaptics quirk
+* Applies to ports for which:
+* - Physical aux has Synaptics OUI
+* - DPv1.4 or higher
+* - Port is on primary branch device
+* - Not a VGA adapter (DP_DWN_STRM_PORT_TYPE_ANALOG)
+*/
+   if (!drm_dp_read_desc(port->mgr->aux, , true))
+   return NULL;
+
+   if (drm_dp_has_quirk(, DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD) &&
+   port->mgr->dpcd[DP_DPCD_REV] >= DP_DPCD_REV_14 &&
+   port->parent == port->mgr->mst_primary) {
+   u8 downstreamport;
+
+   if (drm_dp_dpcd_read(>aux, DP_DOWNSTREAMPORT_PRESENT,
+, 1) < 0)
+   return NULL;
+
+   if ((downstreamport & DP_DWN_STRM_PORT_PRESENT) &&
+  ((downstreamport & DP_DWN_STRM_PORT_TYPE_MASK)
+!= DP_DWN_STRM_PORT_TYPE_ANALOG))
+   return port->mgr->aux;
+   }
+
return NULL;
 }
 EXPORT_SYMBOL(drm_dp_mst_dsc_aux_for_port);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 6e17410a0417..61ef351c5fca 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -1460,6 +1460,13 @@ enum drm_dp_quirk {
 * The driver should ignore SINK_COUNT during detection.
 */
DP_DPCD_QUIRK_NO_SINK_COUNT,
+   /**
+* @DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD:
+*
+* The device supports MST DSC despite not supporting Virtual DPCD.
+* The DSC caps can be read from the physical aux instead.
+*/
+   DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD,
 };
 
 /**
-- 
2.17.1

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

[PATCH 01/13] drm/amd/display: Add MST atomic routines

2019-10-30 Thread mikita.lipski
From: Mikita Lipski 

- Adding encoder atomic check to find vcpi slots for a connector
- Using DRM helper functions to calculate PBN
- Adding connector atomic check to release vcpi slots if connector
loses CRTC
- Calculate  PBN and VCPI slots only once during atomic
check and store them on crtc_state to eliminate
redundant calculation
- Call drm_dp_mst_atomic_check to verify validity of MST topology
during state atomic check

v2: squashed previous 3 separate patches, removed DSC PBN calculation,
and added PBN and VCPI slots properties to amdgpu connector

v3:
- moved vcpi_slots and pbn properties to dm_crtc_state and dc_stream_state
- updates stream's vcpi_slots and pbn on commit
- separated patch from the DSC MST series

v4:
- set vcpi_slots and pbn properties to dm_connector_state
- copy porperties from connector state on to crtc state

v5:
- keep the pbn and vcpi values only on connnector state
- added a void pointer to the stream state instead on two ints,
because dc_stream_state is OS agnostic. Pointer points to the
current dm_connector_state.

v6:
- Remove new param from stream

v7:
- Fix error with using max capable bpc

Cc: Jun Lei 
Cc: Jerry Zuo 
Cc: Harry Wentland 
Cc: Nicholas Kazlauskas 
Cc: Lyude Paul 
Signed-off-by: Mikita Lipski 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 65 ++-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  2 +
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 51 ---
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 32 +
 4 files changed, 109 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 48f5b43e2698..d75726013436 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4180,7 +4180,8 @@ void amdgpu_dm_connector_funcs_reset(struct drm_connector 
*connector)
state->underscan_hborder = 0;
state->underscan_vborder = 0;
state->base.max_requested_bpc = 8;
-
+   state->vcpi_slots = 0;
+   state->pbn = 0;
if (connector->connector_type == DRM_MODE_CONNECTOR_eDP)
state->abm_level = amdgpu_dm_abm_level;
 
@@ -4209,7 +4210,8 @@ amdgpu_dm_connector_atomic_duplicate_state(struct 
drm_connector *connector)
new_state->underscan_enable = state->underscan_enable;
new_state->underscan_hborder = state->underscan_hborder;
new_state->underscan_vborder = state->underscan_vborder;
-
+   new_state->vcpi_slots = state->vcpi_slots;
+   new_state->pbn = state->pbn;
return _state->base;
 }
 
@@ -4606,10 +4608,64 @@ static void dm_encoder_helper_disable(struct 
drm_encoder *encoder)
 
 }
 
+static int convert_dc_color_depth_into_bpc (enum dc_color_depth 
display_color_depth)
+{
+   switch (display_color_depth) {
+   case COLOR_DEPTH_666:
+   return 6;
+   case COLOR_DEPTH_888:
+   return 8;
+   case COLOR_DEPTH_101010:
+   return 10;
+   case COLOR_DEPTH_121212:
+   return 12;
+   case COLOR_DEPTH_141414:
+   return 14;
+   case COLOR_DEPTH_161616:
+   return 16;
+   default:
+   break;
+   }
+   return 0;
+}
+
 static int dm_encoder_helper_atomic_check(struct drm_encoder *encoder,
  struct drm_crtc_state *crtc_state,
  struct drm_connector_state 
*conn_state)
 {
+   struct drm_atomic_state *state = crtc_state->state;
+   struct drm_connector *connector = conn_state->connector;
+   struct amdgpu_dm_connector *aconnector = 
to_amdgpu_dm_connector(connector);
+   struct dm_connector_state *dm_new_connector_state = 
to_dm_connector_state(conn_state);
+   const struct drm_display_mode *adjusted_mode = 
_state->adjusted_mode;
+   struct drm_dp_mst_topology_mgr *mst_mgr;
+   struct drm_dp_mst_port *mst_port;
+   enum dc_color_depth color_depth;
+   int clock, bpp = 0;
+
+   if (!aconnector->port || !aconnector->dc_sink)
+   return 0;
+
+   mst_port = aconnector->port;
+   mst_mgr = >mst_port->mst_mgr;
+
+   if (!crtc_state->connectors_changed && !crtc_state->mode_changed)
+   return 0;
+
+   if (!state->duplicated) {
+   color_depth = convert_color_depth_from_display_info(connector, 
conn_state);
+   bpp = convert_dc_color_depth_into_bpc(color_depth) * 3;
+   clock = adjusted_mode->clock;
+   dm_new_connector_state->pbn = drm_dp_calc_pbn_mode(clock, bpp);
+   }
+   dm_new_connector_state->vcpi_slots = 
drm_dp_atomic_find_vcpi_slots(state,
+

[PATCH 02/13] drm/dp_mst: Add PBN calculation for DSC modes

2019-10-30 Thread mikita.lipski
From: David Francis 

With DSC, bpp can be fractional in multiples of 1/16.

Change drm_dp_calc_pbn_mode to reflect this, adding a new
parameter bool dsc. When this parameter is true, treat the
bpp parameter as having units not of bits per pixel, but
1/16 of a bit per pixel

v2: Don't add separate function for this

Reviewed-by: Manasi Navare 
Reviewed-by: Lyude Paul 
Reviewed-by: Harry Wentland 
Signed-off-by: David Francis 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c|  2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c| 16 
 drivers/gpu/drm/i915/display/intel_dp_mst.c  |  3 ++-
 drivers/gpu/drm/nouveau/dispnv50/disp.c  |  3 ++-
 drivers/gpu/drm/radeon/radeon_dp_mst.c   |  2 +-
 include/drm/drm_dp_mst_helper.h  |  3 +--
 6 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index d75726013436..1309e9cfdea3 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4656,7 +4656,7 @@ static int dm_encoder_helper_atomic_check(struct 
drm_encoder *encoder,
color_depth = convert_color_depth_from_display_info(connector, 
conn_state);
bpp = convert_dc_color_depth_into_bpc(color_depth) * 3;
clock = adjusted_mode->clock;
-   dm_new_connector_state->pbn = drm_dp_calc_pbn_mode(clock, bpp);
+   dm_new_connector_state->pbn = drm_dp_calc_pbn_mode(clock, bpp, 
false);
}
dm_new_connector_state->vcpi_slots = 
drm_dp_atomic_find_vcpi_slots(state,
   
mst_mgr,
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 82add736e17d..3e7b7553cf4d 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -3534,10 +3534,11 @@ EXPORT_SYMBOL(drm_dp_check_act_status);
  * drm_dp_calc_pbn_mode() - Calculate the PBN for a mode.
  * @clock: dot clock for the mode
  * @bpp: bpp for the mode.
+ * @dsc: DSC mode. If true, bpp has units of 1/16 of a bit per pixel
  *
  * This uses the formula in the spec to calculate the PBN value for a mode.
  */
-int drm_dp_calc_pbn_mode(int clock, int bpp)
+int drm_dp_calc_pbn_mode(int clock, int bpp, bool dsc)
 {
u64 kbps;
s64 peak_kbps;
@@ -3555,11 +3556,18 @@ int drm_dp_calc_pbn_mode(int clock, int bpp)
 * peak_kbps *= (1006/1000)
 * peak_kbps *= (64/54)
 * peak_kbps *= 8convert to bytes
+*
+* If the bpp is in units of 1/16, further divide by 16. Put this
+* factor in the numerator rather than the denominator to avoid
+* integer overflow
 */
 
numerator = 64 * 1006;
denominator = 54 * 8 * 1000 * 1000;
 
+   if (dsc)
+   numerator /= 16;
+
kbps *= numerator;
peak_kbps = drm_fixp_from_fraction(kbps, denominator);
 
@@ -3570,19 +3578,19 @@ EXPORT_SYMBOL(drm_dp_calc_pbn_mode);
 static int test_calc_pbn_mode(void)
 {
int ret;
-   ret = drm_dp_calc_pbn_mode(154000, 30);
+   ret = drm_dp_calc_pbn_mode(154000, 30, false);
if (ret != 689) {
DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, 
expected PBN %d, actual PBN %d.\n",
154000, 30, 689, ret);
return -EINVAL;
}
-   ret = drm_dp_calc_pbn_mode(234000, 30);
+   ret = drm_dp_calc_pbn_mode(234000, 30, false);
if (ret != 1047) {
DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, 
expected PBN %d, actual PBN %d.\n",
234000, 30, 1047, ret);
return -EINVAL;
}
-   ret = drm_dp_calc_pbn_mode(297000, 24);
+   ret = drm_dp_calc_pbn_mode(297000, 24, false);
if (ret != 1063) {
DRM_ERROR("PBN calculation test failed - clock %d, bpp %d, 
expected PBN %d, actual PBN %d.\n",
297000, 24, 1063, ret);
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c 
b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 2c5ac3dd647f..dfac450841df 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -61,7 +61,8 @@ static int intel_dp_mst_compute_link_config(struct 
intel_encoder *encoder,
crtc_state->pipe_bpp = bpp;
 
crtc_state->pbn = 
drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock,
-  crtc_state->pipe_bpp);
+  crtc_state->pipe_bpp,
+  false);
 
slots = drm_dp_atomic_find_vcpi_slots(state, _dp->mst_mgr,
  port, 

Re: [PATCH] Drivers: gpu: drm: amd: display: amdgpu_dm: amdgpu_dm.h: Fixed a documentation warning

2019-10-30 Thread Alex Deucher
On Mon, Oct 28, 2019 at 4:25 AM  wrote:
>
> From: Madhuparna Bhowmik 
>
> This patch fixes the following  warning: Incorrect use of
>  kernel-doc format:  * @atomic_obj
> by adding a colon after @atomic_obj.
>
> Signed-off-by: Madhuparna Bhowmik 

Thanks for the patch.  This as already fixed by Harry.

Alex

> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> index c8c525a2b505..80d53d095773 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
> @@ -128,7 +128,7 @@ struct amdgpu_display_manager {
> u16 display_indexes_num;
>
> /**
> -* @atomic_obj
> +* @atomic_obj:
>  *
>  * In combination with _atomic_state it helps manage
>  * global atomic state that doesn't map cleanly into existing
> --
> 2.17.1
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PULL] drm-misc-fixes

2019-10-30 Thread Maxime Ripard
Hi Daniel, Dave,

Here is this week's round of fixes for drm-misc.

Thanks!
Maxime

drm-misc-fixes-2019-10-30-1:
 - three fixes for panfrost, one to silence a warning, one to fix
   runtime_pm and one to prevent bogus pointer dereferences
 - one fix for a memleak in v3d
The following changes since commit 8ae501e295cce9bc6e0dd82d5204a1d5faef44f8:

  drm/komeda: Fix typos in komeda_splitter_validate (2019-10-21 14:50:51 +0100)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-fixes-2019-10-30-1

for you to fetch changes up to f70744c68779c8a72a0c82294e3233b994af656d:

  drm/panfrost: Don't dereference bogus MMU pointers (2019-10-29 13:18:17 -0500)


 - three fixes for panfrost, one to silence a warning, one to fix
   runtime_pm and one to prevent bogus pointer dereferences
 - one fix for a memleak in v3d


Navid Emamdoost (1):
  drm/v3d: Fix memory leak in v3d_submit_cl_ioctl

Robin Murphy (1):
  drm/panfrost: Don't dereference bogus MMU pointers

Tomeu Vizoso (1):
  panfrost: Properly undo pm_runtime_enable when deferring a probe

Yi Wang (1):
  drm/panfrost: fix -Wmissing-prototypes warnings

 drivers/gpu/drm/panfrost/panfrost_drv.c |  2 +-
 drivers/gpu/drm/panfrost/panfrost_mmu.c | 15 ---
 drivers/gpu/drm/panfrost/panfrost_perfcnt.c |  1 +
 drivers/gpu/drm/v3d/v3d_gem.c   |  5 -
 4 files changed, 14 insertions(+), 9 deletions(-)


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

Re: [PULL] topic/mst-suspend-resume-reprobe-2019-10-29-2

2019-10-30 Thread Daniel Vetter
On Wed, Oct 30, 2019 at 7:23 PM Lyude Paul  wrote:
>
> On Wed, 2019-10-30 at 10:21 +0100, Daniel Vetter wrote:
> > On Tue, Oct 29, 2019 at 11:06 PM Lyude Paul  wrote:
> > > topic/mst-suspend-resume-reprobe-2019-10-29-2:
> > > UAPI Changes:
> > >
> > > Cross-subsystem Changes:
> > >
> > > Core Changes:
> > > * Handle UP requests asynchronously in the DP MST helpers, fixing
> > >   hotplug notifications and allowing us to implement suspend/resume
> > >   reprobing
> > > * Add basic suspend/resume reprobing to the DP MST helpers
> > > * Improve locking for link address reprobing and connection status
> > >   request handling in the DP MST helpers
> > > * Miscellaneous refactoring in the DP MST helpers
> > > * Add a Kconfig option to the DP MST helpers to enable tracking of
> > >   gets/puts for topology references for debugging purposes
> > >
> > > Driver Changes:
> > > * nouveau: Resume hotplug interrupts earlier, so that sideband
> > >   messages may be transmitted during resume and thus allow
> > >   suspend/resume reprobing for DP MST to work
> > > * nouveau: Avoid grabbing runtime PM references when handling short DP
> > >   pulses, so that handling sideband messages in resume codepaths with the
> > >   DP MST helpers doesn't deadlock us
> > > * i915, nouveau, amdgpu, radeon: Use detect_ctx for probing MST
> > >   connectors, so that we can grab the topology manager's atomic lock
> > >
> > > Note: there's some amdgpu patches that I didn't realize were pushed
> > > upstream already when creating this topic branch. When they fail to
> > > apply, you can just ignore and skip them.
> > > The following changes since commit
> > > 2e79e22e092acd55da0b2db066e4826d7d152c41:
> >
> > Out of curiosity, why did you go with a topic branch here? Usually we
> > only do those if there's a serious cross-tree coordination problem,
> > that can't be solved with some acks for merging the patches through
> > the unusual tree. Plus then some notes in the pull requests why and
> > who should pull this in. These one here doesn't seem like this is
> > necessary, and the standard approach of stuffing it all into
> > drm-misc-next should be good enough. Also rule of thumb maintainers do
> > the topic branch stuff with merges and prep and everything.
> >
> > I'm also confused with your "when they fail to apply", topic branches
> > are only ever merged, not applied individually.
> Ah sorry, I'm still a bit new to this. The reason I didn't want to just push
> this into drm-misc is because without some of the nouveau and amdgpu patches
> coming before the suspend/resume stuff there would have been regressions, and
> I didn't want to push a bunch of unrelated patches into drm-misc and cause
> issues like what happened the last time I merged a large MST series like this.

Hm, what kind of mess happened?

In general, all the tricks just move around where/who resolves the
conflicts, if there's conflicts between trees and ongoing work you
can't really avoid that. Approaches, sorted from most preferred to
least:
- Just smash it all into one tree, with maintainer acks for all the
patches that go through the "wrong" tree. Committers get to sort out
conflicts as they push new patches, maintainers get to bake them with
a backmerge. Might not be the best around merge window where there's 4
weeks of no backmerging. But even then generally not a big deal.
- 1) merge core patches 2) wait 3) merge driver patches 4)
more waiting and backmerge 5) merge cleanups. Here author resolves
conflicts when resubmitting.
- do a topic branch if the above isn't fast enough (mostly that's for
when the conflict is with a non-drm tree, where the waiting would be a
full merge window). Here maintainers resolve conflicts when applying
the topic pull request to each of their tree.

More dance than the first option is imo only warranted if there's a
known conflict looming, not "just in case".
-Daniel


> > -Daniel
> >
> > >   Merge v5.4-rc4 into drm-next (2019-10-23 12:10:05 +0200)
> > >
> > > are available in the Git repository at:
> > >
> > >   git://anongit.freedesktop.org/drm/drm-misc tags/topic/mst-suspend-
> > > resume-reprobe-2019-10-29-2
> > >
> > > for you to fetch changes up to 12a280c7286857119cf0d88c487f695e3a1c0912:
> > >
> > >   drm/dp_mst: Add topology ref history tracking for debugging (2019-10-24
> > > 14:36:13 -0400)
> > >
> > > 
> > > UAPI Changes:
> > >
> > > Cross-subsystem Changes:
> > >
> > > Core Changes:
> > > * Handle UP requests asynchronously in the DP MST helpers, fixing
> > >   hotplug notifications and allowing us to implement suspend/resume
> > >   reprobing
> > > * Add basic suspend/resume reprobing to the DP MST helpers
> > > * Improve locking for link address reprobing and connection status
> > >   request handling in the DP MST helpers
> > > * Miscellaneous refactoring in the DP MST helpers
> > > * Add a Kconfig option to the DP MST helpers to enable tracking of
> > >   

Re: [PULL] topic/mst-suspend-resume-reprobe-2019-10-29-2

2019-10-30 Thread Lyude Paul
On Wed, 2019-10-30 at 10:21 +0100, Daniel Vetter wrote:
> On Tue, Oct 29, 2019 at 11:06 PM Lyude Paul  wrote:
> > topic/mst-suspend-resume-reprobe-2019-10-29-2:
> > UAPI Changes:
> > 
> > Cross-subsystem Changes:
> > 
> > Core Changes:
> > * Handle UP requests asynchronously in the DP MST helpers, fixing
> >   hotplug notifications and allowing us to implement suspend/resume
> >   reprobing
> > * Add basic suspend/resume reprobing to the DP MST helpers
> > * Improve locking for link address reprobing and connection status
> >   request handling in the DP MST helpers
> > * Miscellaneous refactoring in the DP MST helpers
> > * Add a Kconfig option to the DP MST helpers to enable tracking of
> >   gets/puts for topology references for debugging purposes
> > 
> > Driver Changes:
> > * nouveau: Resume hotplug interrupts earlier, so that sideband
> >   messages may be transmitted during resume and thus allow
> >   suspend/resume reprobing for DP MST to work
> > * nouveau: Avoid grabbing runtime PM references when handling short DP
> >   pulses, so that handling sideband messages in resume codepaths with the
> >   DP MST helpers doesn't deadlock us
> > * i915, nouveau, amdgpu, radeon: Use detect_ctx for probing MST
> >   connectors, so that we can grab the topology manager's atomic lock
> > 
> > Note: there's some amdgpu patches that I didn't realize were pushed
> > upstream already when creating this topic branch. When they fail to
> > apply, you can just ignore and skip them.
> > The following changes since commit
> > 2e79e22e092acd55da0b2db066e4826d7d152c41:
> 
> Out of curiosity, why did you go with a topic branch here? Usually we
> only do those if there's a serious cross-tree coordination problem,
> that can't be solved with some acks for merging the patches through
> the unusual tree. Plus then some notes in the pull requests why and
> who should pull this in. These one here doesn't seem like this is
> necessary, and the standard approach of stuffing it all into
> drm-misc-next should be good enough. Also rule of thumb maintainers do
> the topic branch stuff with merges and prep and everything.
> 
> I'm also confused with your "when they fail to apply", topic branches
> are only ever merged, not applied individually.
Ah sorry, I'm still a bit new to this. The reason I didn't want to just push
this into drm-misc is because without some of the nouveau and amdgpu patches
coming before the suspend/resume stuff there would have been regressions, and
I didn't want to push a bunch of unrelated patches into drm-misc and cause
issues like what happened the last time I merged a large MST series like this.
> -Daniel
> 
> >   Merge v5.4-rc4 into drm-next (2019-10-23 12:10:05 +0200)
> > 
> > are available in the Git repository at:
> > 
> >   git://anongit.freedesktop.org/drm/drm-misc tags/topic/mst-suspend-
> > resume-reprobe-2019-10-29-2
> > 
> > for you to fetch changes up to 12a280c7286857119cf0d88c487f695e3a1c0912:
> > 
> >   drm/dp_mst: Add topology ref history tracking for debugging (2019-10-24
> > 14:36:13 -0400)
> > 
> > 
> > UAPI Changes:
> > 
> > Cross-subsystem Changes:
> > 
> > Core Changes:
> > * Handle UP requests asynchronously in the DP MST helpers, fixing
> >   hotplug notifications and allowing us to implement suspend/resume
> >   reprobing
> > * Add basic suspend/resume reprobing to the DP MST helpers
> > * Improve locking for link address reprobing and connection status
> >   request handling in the DP MST helpers
> > * Miscellaneous refactoring in the DP MST helpers
> > * Add a Kconfig option to the DP MST helpers to enable tracking of
> >   gets/puts for topology references for debugging purposes
> > 
> > Driver Changes:
> > * nouveau: Resume hotplug interrupts earlier, so that sideband
> >   messages may be transmitted during resume and thus allow
> >   suspend/resume reprobing for DP MST to work
> > * nouveau: Avoid grabbing runtime PM references when handling short DP
> >   pulses, so that handling sideband messages in resume codepaths with the
> >   DP MST helpers doesn't deadlock us
> > * i915, nouveau, amdgpu, radeon: Use detect_ctx for probing MST
> >   connectors, so that we can grab the topology manager's atomic lock
> > 
> > Note: there's some amdgpu patches that I didn't realize were pushed
> > upstream already when creating this topic branch. When they fail to
> > apply, you can just ignore and skip them.
> > 
> > 
> > Lyude Paul (14):
> >   drm/dp_mst: Destroy MSTBs asynchronously
> >   drm/dp_mst: Remove PDT teardown in drm_dp_destroy_port() and
> > refactor
> >   drm/dp_mst: Refactor pdt setup/teardown, add more locking
> >   drm/dp_mst: Handle UP requests asynchronously
> >   drm/dp_mst: Add probe_lock
> >   drm/dp_mst: Protect drm_dp_mst_port members with locking
> >   drm/dp_mst: Don't forget to update port->input in
> > 

Re: [PATCH] drm/i915: Program LUT before intel_color_commit() if LUT was not previously set v2

2019-10-30 Thread Ville Syrjälä
On Mon, Oct 28, 2019 at 07:58:51PM +0100, Hans de Goede wrote:
> Since commit 051a6d8d3ca0 ("drm/i915: Move LUT programming to happen after
> vblank waits"), I am seeing an ugly colored flash of the first few display
> lines on 2 Cherry Trail devices when the gamma table gets set for the first
> time. A blue flash on a GPD win and a yellow flash on an Asus T100HA.
> 
> The problem is that since this change, the LUT is programmed after the
> write *and latching* of the double-buffered register which causes the LUT
> to be used starting at the next frame. This means that the old LUT is still
> used for the first couple of lines of the display. If no LUT was in use
> before then the LUT registers may contain bogus values. This leads to
> messed up colors until the new LUT values are written. At least on CHT DSI
> panels this causes messed up colors on the first few lines.
> 
> This commit fixes this by adding a load_lut_before_commit boolean,
> modifying commit_pipe_config() to load the luts earlier if this is set.
> and setting this from intel_color_check when enabling gamma (rather then
> updating an existing gamma table).
> 
> Changes in v2:
> -Simply check for setting load_lut_before_commit to:
>  if (!old_crtc_state->gamma_enable && new_crtc_state->gamma_enable)
> 
> Fixes: 051a6d8d3ca0 ("drm/i915: Move LUT programming to happen after vblank 
> waits")
> Signed-off-by: Hans de Goede 
> ---
>  drivers/gpu/drm/i915/display/intel_color.c | 14 ++
>  drivers/gpu/drm/i915/display/intel_display.c   |  6 +-
>  drivers/gpu/drm/i915/display/intel_display_types.h |  3 +++
>  3 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c 
> b/drivers/gpu/drm/i915/display/intel_color.c
> index fa44eb73d088..954a232c15d1 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -1063,6 +1063,8 @@ intel_color_add_affected_planes(struct intel_crtc_state 
> *new_crtc_state)
>   intel_atomic_get_old_crtc_state(state, crtc);
>   struct intel_plane *plane;
>  
> + new_crtc_state->load_lut_before_commit = false;
> +
>   if (!new_crtc_state->base.active ||
>   drm_atomic_crtc_needs_modeset(_crtc_state->base))
>   return 0;
> @@ -1071,6 +1073,18 @@ intel_color_add_affected_planes(struct 
> intel_crtc_state *new_crtc_state)
>   new_crtc_state->csc_enable == old_crtc_state->csc_enable)
>   return 0;
>  
> + /*
> +  * Normally we load the LUTs after vblank / after the double-buffer
> +  * registers written by commit have been latched, this avoids a
> +  * gamma change mid-way the screen. This does mean that the first
> +  * few lines of the display will (sometimes) still use the old
> +  * table. This is fine when changing an existing LUT, but if this
> +  * is the first time the LUT gets loaded, then the hw may contain
> +  * random values, causing the first lines to have funky colors.
> +  */
> + if (!old_crtc_state->gamma_enable && new_crtc_state->gamma_enable)
> + new_crtc_state->load_lut_before_commit = true;

Unfortunately gamma_enable is not abstract enough to cover all
platforms.

> +
>   for_each_intel_plane_on_crtc(_priv->drm, crtc, plane) {
>   struct intel_plane_state *plane_state;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
> b/drivers/gpu/drm/i915/display/intel_display.c
> index cbf9cf30050c..6b1dc5a5aeb1 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14168,8 +14168,11 @@ static void commit_pipe_config(struct 
> intel_atomic_state *state,
>*/
>   if (!modeset) {
>   if (new_crtc_state->base.color_mgmt_changed ||
> - new_crtc_state->update_pipe)
> + new_crtc_state->update_pipe) {
> + if (new_crtc_state->load_lut_before_commit)
> + intel_color_load_luts(new_crtc_state);

We don't want to do this from within the vblank evade critical
section, so needs to be moved earlier.

Lemme try to cook up something...

>   intel_color_commit(new_crtc_state);
> + }
>  
>   if (INTEL_GEN(dev_priv) >= 9)
>   skl_detach_scalers(new_crtc_state);
> @@ -14717,6 +14720,7 @@ static void intel_atomic_commit_tail(struct 
> intel_atomic_state *state)
>   for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
>   if (new_crtc_state->base.active &&
>   !needs_modeset(new_crtc_state) &&
> + !new_crtc_state->load_lut_before_commit &&
>   (new_crtc_state->base.color_mgmt_changed ||
>new_crtc_state->update_pipe))
>   intel_color_load_luts(new_crtc_state);
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h 

Re: [PATCH v2 2/3] drm: Measure Self Refresh Entry/Exit times to avoid thrashing

2019-10-30 Thread Enric Balletbo Serra
Hi Sean,

Since 5.4-rc1 my Samsung Chromebook Plus (kevin) doesn't
suspend/resume correctly, at least once every ten suspend/resume
cycles the display doesn't turn on, and when this happens the kernel
log message reports:

[   60.420230] PM: suspend exit
[   60.463866] rockchip-dp ff97.edp: AUX CH cmd reply timeout!
[   60.971653] rockchip-dp ff97.edp: AUX CH enable timeout!
[   61.478668] rockchip-dp ff97.edp: AUX CH enable timeout!
[   61.985661] rockchip-dp ff97.edp: AUX CH enable timeout!
[   62.492644] rockchip-dp ff97.edp: AUX CH enable timeout!
[   62.999617] rockchip-dp ff97.edp: AUX CH enable timeout!
[   63.506595] rockchip-dp ff97.edp: AUX CH enable timeout!
[   64.013678] rockchip-dp ff97.edp: AUX CH enable timeout!
[   64.522856] rockchip-dp ff97.edp: AUX CH enable timeout!
[   60.463866] rockchip-dp ff97.edp: AUX CH cmd reply timeout!
[   60.971653] rockchip-dp ff97.edp: AUX CH enable timeout!
[   61.478668] rockchip-dp ff97.edp: AUX CH enable timeout!
[   61.985661] rockchip-dp ff97.edp: AUX CH enable timeout!
[   62.492644] rockchip-dp ff97.edp: AUX CH enable timeout!
...

Today I bisected the problem and pointed me to this commit. Reverting
the commit fixes the issue, but from I quick look I don't see any
obvious problem. I'll spend more time tomorrow looking at this but any
idea will be welcome.

Thanks,
 Enric

Missatge de Sean Paul  del dia dj., 19 de set. 2019 a
les 16:14:
>
> On Wed, Sep 18, 2019 at 04:07:29PM -0400, Sean Paul wrote:
> > From: Sean Paul 
> >
> > Currently the self refresh idle timer is a const set by the crtc. This
> > is fine if the self refresh entry/exit times are well-known for all
> > panels used on that crtc. However panels and workloads can vary quite a
> > bit, and a timeout which works well for one doesn't work well for
> > another.
> >
> > In the extreme, if the timeout is too short we could get in a situation
> > where the self refresh exits are taking so long we queue up a self refresh
> > entry before the exit commit is even finished.
> >
> > This patch changes the idle timeout to a moving average of the entry
> > times + a moving average of exit times + the crtc constant.
> >
> > This patch was tested on rockchip, with a kevin CrOS panel the idle
> > delay averages out to about ~235ms (35 entry + 100 exit + 100 const). On
> > the same board, the bob panel idle delay lands around ~340ms (90 entry
> > + 150 exit + 100 const).
> >
> > WRT the dedicated mutex in self_refresh_data, it would be nice if we
> > could rely on drm_crtc.mutex to protect the average times, but there are
> > a few reasons why a separate lock is a better choice:
> > - We can't rely on drm_crtc.mutex being held if we're doing a nonblocking
> >   commit
> > - We can't grab drm_crtc.mutex since drm_modeset_lock() doesn't tell us
> >   whether the lock was already held in the acquire context (it eats
> >   -EALREADY), so we can't tell if we should drop it or not
> > - We don't need such a heavy-handed lock for what we're trying to do,
> >   commit ordering doesn't matter, so a point-of-use lock will be less
> >   contentious
> >
> > Reviewed-by: Daniel Vetter 
>
> Pushed the first 2 to drm-misc-next-fixes to fix the gru-bob regression. I'll
> fix up the 3rd patch separately.
>
> Thank you for the reviews!
>
> Sean
>
> > Signed-off-by: Sean Paul 
> > Link to v1: 
> > https://patchwork.freedesktop.org/patch/msgid/20190917200443.64481-2-s...@poorly.run
> >
> > Changes in v2:
> > - Migrate locking explanation from comment to commit msg (Daniel)
> > - Turf constant entry delay and multiply the avg times by 2 (Daniel)
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 20 ++
> >  drivers/gpu/drm/drm_self_refresh_helper.c   | 72 +++--
> >  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  5 +-
> >  include/drm/drm_self_refresh_helper.h   |  6 +-
> >  4 files changed, 90 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> > b/drivers/gpu/drm/drm_atomic_helper.c
> > index 9d7e4da6c292..3f13fa9a9e24 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -26,6 +26,7 @@
> >   */
> >
> >  #include 
> > +#include 
> >
> >  #include 
> >  #include 
> > @@ -1570,9 +1571,23 @@ static void commit_tail(struct drm_atomic_state 
> > *old_state)
> >  {
> >   struct drm_device *dev = old_state->dev;
> >   const struct drm_mode_config_helper_funcs *funcs;
> > + ktime_t start;
> > + s64 commit_time_ms;
> >
> >   funcs = dev->mode_config.helper_private;
> >
> > + /*
> > +  * We're measuring the _entire_ commit, so the time will vary 
> > depending
> > +  * on how many fences and objects are involved. For the purposes of 
> > self
> > +  * refresh, this is desirable since it'll give us an idea of how
> > +  * congested things are. This will inform our decision on how often we
> > +  * should enter 

Re: [PATCH 2/3 v4] drm/panel: Add DT bindings for Sony ACX424AKP

2019-10-30 Thread Linus Walleij
On Fri, Oct 25, 2019 at 9:25 PM Rob Herring  wrote:
> On Thu, Oct 24, 2019 at 01:43:04PM +0200, Linus Walleij wrote:
> > This adds device tree bindings for the Sony ACX424AKP panel.
> > Let's use YAML.
>
> Also broken. Run 'make dt_binding_check'.

That is what I'm doing.

make -f Makefile -j5 -l4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
KBUILD_OUTPUT=/home/linus/linux-stericsson/build-ux500
dt_binding_check
  CHKDT   Documentation/devicetree/bindings/display/panel/sony,acx424akp.yaml
  CHKDT   Documentation/devicetree/bindings/display/dsi-controller.yaml
  SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
(...)

I'm a bit unsure how this thing works. Are the several passes?
Because later on this breaks because of an unrelated error in
the bindings upstream:
/home/linus/linux-stericsson/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml:
properties:compatible:enum:0: {'const': 'regulator-fixed'} is not of
type 'string'
/home/linus/linux-stericsson/Documentation/devicetree/bindings/regulator/fixed-regulator.yaml:
properties:compatible:enum:1: {'const': 'regulator-fixed-clock'} is
not of type 'string'
(...)

This is v5.4-rc1.

Is there any way I can selectively make dt_bindings_check just target
the files I wanna check as any brokenness upstream cause problems
like this? (And I assume that will keep happening.)

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

[GIT PULL] etnaviv-fixes for 5.4

2019-10-30 Thread Lucas Stach
Hi Dave, hi Daniel,

a few small fixes for the etnaviv driver.

One memory corruption fix in the MMUv2 GPU coredump code, a deadlock
fix also in the coredump code and reintroduction of a helpful message,
which got dropped by accident in this cycle.

Regards,
Lucas

The following changes since commit 54ecb8f7028c5eb3d740bb82b0f1d90f2df63c5c:

  Linux 5.4-rc1 (2019-09-30 10:35:40 -0700)

are available in the Git repository at:

  https://git.pengutronix.de/git/lst/linux etnaviv/fixes

for you to fetch changes up to a2f10d4a3069fee666dab20fab5458757ba1f22d:

  drm/etnaviv: fix dumping of iommuv2 (2019-10-29 18:12:24 +0100)


Christian Gmeiner (1):
  drm/etnaviv: fix dumping of iommuv2

Lucas Stach (2):
  drm/etnaviv: fix deadlock in GPU coredump
  drm/etnaviv: reinstate MMUv1 command buffer window check

 drivers/gpu/drm/etnaviv/etnaviv_dump.c |  4 ++--
 drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c |  6 --
 drivers/gpu/drm/etnaviv/etnaviv_mmu.c  | 17 ++---
 3 files changed, 20 insertions(+), 7 deletions(-)

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

[PATCH] dma-buf: heaps: Fix redundant assignment to variable ret in system_heap.c

2019-10-30 Thread John Stultz
Colin King reported a coverity error:
 The variable ret is being assigned with a value that is never
 read, it is being re-assigned the same value on the err0 exit
 path. The assignment is redundant and hence can be removed.

He had a fix, but Andrew Davis suggested a better solution
(actually returning ret), so this patch implements that fix.

Cc: Colin King 
Cc: Sumit Semwal 
Cc: Benjamin Gaignard 
Cc: Liam Mark 
Cc: Laura Abbott 
Cc: Brian Starkey 
Cc: Andrew F. Davis 
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-...@lists.linaro.org
Cc: kernel-janit...@vger.kernel.org
Addresses-Coverity: ("Unused value")
Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
Reported-by: Colin Ian King 
Suggested-by: Andrew F. Davis 
Signed-off-by: John Stultz 
---
 drivers/dma-buf/heaps/system_heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/heaps/system_heap.c 
b/drivers/dma-buf/heaps/system_heap.c
index 455782efbb32..9a56393e40b4 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -98,7 +98,7 @@ static int system_heap_allocate(struct dma_heap *heap,
 err0:
kfree(helper_buffer);
 
-   return -ENOMEM;
+   return ret;
 }
 
 static const struct dma_heap_ops system_heap_ops = {
-- 
2.17.1

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

[pull] amdgpu, radeon, gpu scheduler drm-fixes-5.4

2019-10-30 Thread Alex Deucher
Hi Dave, Daniel,

Misc fixes for 5.4.

The following changes since commit 2a3608409f46e0bae5b6b1a77ddf4c42116698da:

  Merge tag 'drm-fixes-5.4-2019-10-23' of 
git://people.freedesktop.org/~agd5f/linux into drm-fixes (2019-10-25 14:48:53 
+1000)

are available in the Git repository at:

  git://people.freedesktop.org/~agd5f/linux tags/drm-fixes-5.4-2019-10-30

for you to fetch changes up to e8a170ff9a3576730e43c0dbdd27b7cd3dc56848:

  drm/amdgpu: enable -msse2 for GCC 7.1+ users (2019-10-30 11:56:20 -0400)


drm-fixes-5.4-2019-10-30:

amdgpu:
- clang fixes
- Updated golden settings
- GPUVM fixes for navi
- Navi sdma fix
- Navi display fixes
- Freesync fix
- Gamma fix for DCN
- DP dongle detection fix
- Fix for undervolting on vega10

radeon:
- enable kexec fix for PPC

scheduler:
- set an error on fence if hw job failed


Aidan Yang (1):
  drm/amd/display: Allow inverted gamma

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

Andrey Grodzovsky (2):
  drm/sched: Set error to s_fence if HW job submission failed.
  drm/amdgpu: If amdgpu_ib_schedule fails return back the error.

Jun Lei (2):
  drm/amd/display: do not synchronize "drr" displays
  drm/amd/display: add 50us buffer as WA for pstate switch in active

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

Michael Strauss (1):
  drm/amd/display: Passive DP->HDMI dongle detection fix

Nick Desaulniers (3):
  drm/amdgpu: fix stack alignment ABI mismatch for Clang
  drm/amdgpu: fix stack alignment ABI mismatch for GCC 7.1+
  drm/amdgpu: enable -msse2 for GCC 7.1+ users

Pelle van Gils (1):
  drm/amdgpu/powerplay/vega10: allow undervolting in p7

Pierre-Eric Pelloux-Prayer (1):
  drm/amdgpu/sdma5: do not execute 0-sized IBs (v2)

Tianci.Yin (3):
  drm/amdgpu/gfx10: update gfx golden settings
  drm/amdgpu/gfx10: update gfx golden settings for navi14
  drm/amdgpu/gfx10: update gfx golden settings for navi12

Zhan liu (2):
  drm/amd/display: Change Navi14's DWB flag to 1
  drm/amd/display: setting the DIG_MODE to the correct value.

chen gong (1):
  drm/amdgpu: Fix SDMA hang when performing VKexample test

zhongshiqi (1):
  dc.c:use kzalloc without test

 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c|  4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c |  6 +++---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c   |  9 
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c |  1 +
 drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c|  9 
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c |  1 +
 drivers/gpu/drm/amd/display/dc/calcs/Makefile  | 19 ++---
 drivers/gpu/drm/amd/display/dc/core/dc.c   |  4 
 drivers/gpu/drm/amd/display/dc/core/dc_link.c  |  9 
 drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c  | 24 --
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  6 ++
 .../gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 22 
 drivers/gpu/drm/amd/display/dc/dcn20/Makefile  | 19 ++---
 .../gpu/drm/amd/display/dc/dcn20/dcn20_resource.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/dcn21/Makefile  | 19 ++---
 drivers/gpu/drm/amd/display/dc/dml/Makefile| 19 ++---
 .../amd/display/dc/dml/dcn20/display_mode_vba_20.c |  3 ++-
 drivers/gpu/drm/amd/display/dc/dsc/Makefile| 19 ++---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c |  4 +---
 drivers/gpu/drm/radeon/radeon_drv.c| 14 +
 drivers/gpu/drm/scheduler/sched_main.c | 19 ++---
 21 files changed, 165 insertions(+), 67 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH][next] dma-buf: heaps: remove redundant assignment to variable ret

2019-10-30 Thread John Stultz
On Wed, Oct 30, 2019 at 8:45 AM Andrew F. Davis  wrote:
>
> On 10/30/19 11:02 AM, Colin King wrote:
> > From: Colin Ian King 
> >
> > The variable ret is being assigned with a value that is never
> > read, it is being re-assigned the same value on the err0 exit
> > path. The assignment is redundant and hence can be removed.
> >
> > Addresses-Coverity: ("Unused value")
> > Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
> > Signed-off-by: Colin Ian King 
> > ---
>
>
> The root of the issue is that ret is not used in the error path, it
> should be, I suggest this fix:
>
> > --- a/drivers/dma-buf/heaps/system_heap.c
> > +++ b/drivers/dma-buf/heaps/system_heap.c
> > @@ -98,7 +98,7 @@ static int system_heap_allocate(struct dma_heap *heap,
> >  err0:
> > kfree(helper_buffer);
> >
> > -   return -ENOMEM;
> > +   return ret;
> >  }

Sounds good! If its ok I'll generate a commit crediting Colin for
reporting the issue and Andrew for the fix and submit it to Sumit.

Many thanks to you both!
-john
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] dma-buf: Fix a warning message in dma_heap_buffer_destroy()

2019-10-30 Thread John Stultz
On Tue, Oct 29, 2019 at 11:31 AM Dan Carpenter  wrote:
>
> The first argument of WARN() is a condition so this will just print the
> function name instead of the whole warning message.
>
> Fixes: 7b87ea704fd9 ("dma-buf: heaps: Add heap helpers")
> Signed-off-by: Dan Carpenter 
> ---
>  drivers/dma-buf/heaps/heap-helpers.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/heaps/heap-helpers.c 
> b/drivers/dma-buf/heaps/heap-helpers.c
> index 750bef4e902d..a31684c0d5b2 100644
> --- a/drivers/dma-buf/heaps/heap-helpers.c
> +++ b/drivers/dma-buf/heaps/heap-helpers.c
> @@ -52,7 +52,7 @@ static void *dma_heap_map_kernel(struct heap_helper_buffer 
> *buffer)
>  static void dma_heap_buffer_destroy(struct heap_helper_buffer *buffer)
>  {
> if (buffer->vmap_cnt > 0) {
> -   WARN("%s: buffer still mapped in the kernel\n", __func__);
> +   WARN(1, "%s: buffer still mapped in the kernel\n", __func__);
> vunmap(buffer->vaddr);
> }

Thanks for catching and reporting this!

Acked-by: John Stultz 

Sumit, do you mind picking this up for drm-misc-next?

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

[PATCH AUTOSEL 4.19 25/38] drm/amdgpu: fix potential VM faults

2019-10-30 Thread Sasha Levin
From: Christian König 

[ Upstream commit 3122051edc7c27cc08534be730f4c7c180919b8a ]

When we allocate new page tables under memory
pressure we should not evict old ones.

Signed-off-by: Christian König 
Acked-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index b0e14a3d54efd..b14ce112703f0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -428,7 +428,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
.interruptible = (bp->type != ttm_bo_type_kernel),
.no_wait_gpu = false,
.resv = bp->resv,
-   .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT
+   .flags = bp->type != ttm_bo_type_kernel ?
+   TTM_OPT_FLAG_ALLOW_RES_EVICT : 0
};
struct amdgpu_bo *bo;
unsigned long page_align, size = bp->size;
-- 
2.20.1

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

[PATCH AUTOSEL 5.3 55/81] drm/amdgpu: fix potential VM faults

2019-10-30 Thread Sasha Levin
From: Christian König 

[ Upstream commit 3122051edc7c27cc08534be730f4c7c180919b8a ]

When we allocate new page tables under memory
pressure we should not evict old ones.

Signed-off-by: Christian König 
Acked-by: Alex Deucher 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index bea6f298dfdc5..0ff786dec8c4a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -421,7 +421,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
.interruptible = (bp->type != ttm_bo_type_kernel),
.no_wait_gpu = false,
.resv = bp->resv,
-   .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT
+   .flags = bp->type != ttm_bo_type_kernel ?
+   TTM_OPT_FLAG_ALLOW_RES_EVICT : 0
};
struct amdgpu_bo *bo;
unsigned long page_align, size = bp->size;
-- 
2.20.1

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

[PATCH AUTOSEL 5.3 56/81] drm/amdgpu: fix error handling in amdgpu_bo_list_create

2019-10-30 Thread Sasha Levin
From: Christian König 

[ Upstream commit de51a5019ff32960218da8fd899fa3f361b031e9 ]

We need to drop normal and userptr BOs separately.

Signed-off-by: Christian König 
Acked-by: Huang Rui 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
index 7bcf86c619995..d4c4785ab5256 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -140,7 +140,12 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, 
struct drm_file *filp,
return 0;
 
 error_free:
-   while (i--) {
+   for (i = 0; i < last_entry; ++i) {
+   struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
+
+   amdgpu_bo_unref();
+   }
+   for (i = first_userptr; i < num_entries; ++i) {
struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
 
amdgpu_bo_unref();
-- 
2.20.1

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

Re: [PATCH][next] dma-buf: heaps: remove redundant assignment to variable ret

2019-10-30 Thread Andrew F. Davis
On 10/30/19 11:02 AM, Colin King wrote:
> From: Colin Ian King 
> 
> The variable ret is being assigned with a value that is never
> read, it is being re-assigned the same value on the err0 exit
> path. The assignment is redundant and hence can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
> Signed-off-by: Colin Ian King 
> ---


The root of the issue is that ret is not used in the error path, it
should be, I suggest this fix:

> --- a/drivers/dma-buf/heaps/system_heap.c
> +++ b/drivers/dma-buf/heaps/system_heap.c
> @@ -98,7 +98,7 @@ static int system_heap_allocate(struct dma_heap *heap,
>  err0:
> kfree(helper_buffer);
>  
> -   return -ENOMEM;
> +   return ret;
>  }
>  
>  static const struct dma_heap_ops system_heap_ops = {

Andrew


>  drivers/dma-buf/heaps/system_heap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/dma-buf/heaps/system_heap.c 
> b/drivers/dma-buf/heaps/system_heap.c
> index 455782efbb32..817a1667bd57 100644
> --- a/drivers/dma-buf/heaps/system_heap.c
> +++ b/drivers/dma-buf/heaps/system_heap.c
> @@ -55,10 +55,8 @@ static int system_heap_allocate(struct dma_heap *heap,
>   helper_buffer->pages = kmalloc_array(helper_buffer->pagecount,
>sizeof(*helper_buffer->pages),
>GFP_KERNEL);
> - if (!helper_buffer->pages) {
> - ret = -ENOMEM;
> + if (!helper_buffer->pages)
>   goto err0;
> - }
>  
>   for (pg = 0; pg < helper_buffer->pagecount; pg++) {
>   /*
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH][next] dma-buf: heaps: remove redundant assignment to variable ret

2019-10-30 Thread Colin King
From: Colin Ian King 

The variable ret is being assigned with a value that is never
read, it is being re-assigned the same value on the err0 exit
path. The assignment is redundant and hence can be removed.

Addresses-Coverity: ("Unused value")
Fixes: 47a32f9c1226 ("dma-buf: heaps: Add system heap to dmabuf heaps")
Signed-off-by: Colin Ian King 
---
 drivers/dma-buf/heaps/system_heap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/dma-buf/heaps/system_heap.c 
b/drivers/dma-buf/heaps/system_heap.c
index 455782efbb32..817a1667bd57 100644
--- a/drivers/dma-buf/heaps/system_heap.c
+++ b/drivers/dma-buf/heaps/system_heap.c
@@ -55,10 +55,8 @@ static int system_heap_allocate(struct dma_heap *heap,
helper_buffer->pages = kmalloc_array(helper_buffer->pagecount,
 sizeof(*helper_buffer->pages),
 GFP_KERNEL);
-   if (!helper_buffer->pages) {
-   ret = -ENOMEM;
+   if (!helper_buffer->pages)
goto err0;
-   }
 
for (pg = 0; pg < helper_buffer->pagecount; pg++) {
/*
-- 
2.20.1

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

[radeon-alex:amd-mainline-dkms-5.0 3698/4200] include/kcl/kcl_fence.h:142:20: error: redefinition of 'dma_fence_set_error'

2019-10-30 Thread kbuild test robot
Hi Flora,

FYI, the error/warning still remains.

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-mainline-dkms-5.0
head:   52f70af32a6cef1ec5735145486d9154ab1248ac
commit: a5784d79d1577c00e6e81f892cde52593546a5f4 [3698/4200] drm/amdkcl: drop 
kcl_dma_fence_set_error
config: i386-randconfig-f002-201943 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
git checkout a5784d79d1577c00e6e81f892cde52593546a5f4
# save the attached .config to linux build tree
make ARCH=i386 

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

All errors (new ones prefixed by >>):

   In file included from drivers/gpu//drm/ttm/backport/backport.h:5:0,
from :0:
>> include/kcl/kcl_fence.h:142:20: error: redefinition of 'dma_fence_set_error'
static inline void dma_fence_set_error(struct dma_fence *fence,
   ^~~
   In file included from include/kcl/kcl_fence.h:9:0,
from drivers/gpu//drm/ttm/backport/backport.h:5,
from :0:
   include/linux/dma-fence.h:508:20: note: previous definition of 
'dma_fence_set_error' was here
static inline void dma_fence_set_error(struct dma_fence *fence,
   ^~~
   In file included from drivers/gpu//drm/ttm/backport/backport.h:5:0,
from :0:
   include/kcl/kcl_fence.h: In function 'dma_fence_set_error':
   include/kcl/kcl_fence.h:148:7: error: 'struct dma_fence' has no member named 
'status'
 fence->status = error;
  ^~
   In file included from drivers/gpu//drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: At top level:
   include/kcl/kcl_drm.h:167:1: error: redefinition of 
'drm_fb_helper_remove_conflicting_pci_framebuffers'
drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
^
   In file included from include/kcl/kcl_drm.h:7:0,
from drivers/gpu//drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_fb_helper.h:641:1: note: previous definition of 
'drm_fb_helper_remove_conflicting_pci_framebuffers' was here
drm_fb_helper_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
^
   In file included from drivers/gpu//drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_encoder_init':
   include/kcl/kcl_drm.h:307:9: error: too few arguments to function 
'drm_encoder_init'
 return drm_encoder_init(dev, encoder, funcs,
^~~~
   In file included from include/drm/drm_modeset_helper_vtables.h:33:0,
from include/drm/drm_atomic_helper.h:32,
from include/kcl/kcl_drm.h:11,
from drivers/gpu//drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_encoder.h:183:5: note: declared here
int drm_encoder_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu//drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_crtc_init_with_planes':
   include/kcl/kcl_drm.h:322:10: error: too few arguments to function 
'drm_crtc_init_with_planes'
  return drm_crtc_init_with_planes(dev, crtc, primary,
 ^
   In file included from include/drm/drmP.h:69:0,
from include/kcl/kcl_drm.h:6,
from drivers/gpu//drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_crtc.h:1120:5: note: declared here
int drm_crtc_init_with_planes(struct drm_device *dev,
^
   In file included from drivers/gpu//drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h: In function 'kcl_drm_universal_plane_init':
   include/kcl/kcl_drm.h:343:29: error: incompatible type for argument 7 of 
'drm_universal_plane_init'
 formats, format_count, type);
^~~~
   In file included from include/drm/drm_crtc.h:45:0,
from include/drm/drmP.h:69,
from include/kcl/kcl_drm.h:6,
from drivers/gpu//drm/ttm/backport/backport.h:6,
from :0:
   include/drm/drm_plane.h:713:5: note: expected 'const uint64_t * {aka const 
long long unsigned int *}' but argument is of type 'enum drm_plane_type'
int drm_universal_plane_init(struct drm_device *dev,
^~~~
   In file included from drivers/gpu//drm/ttm/backport/backport.h:6:0,
from :0:
   include/kcl/kcl_drm.h:342:10: error: too few arguments to function 
'drm_universal_plane_init'
  return drm_universal_plane_init(dev, plane, possible_crtcs, funcs,
 ^~~~
   In file 

Re: [PATCH V5 1/3] drm/panel: simple: Add Logic PD Type 28 display support

2019-10-30 Thread Adam Ford
On Wed, Oct 16, 2019 at 8:52 AM Adam Ford  wrote:
>
> Previously, there was an omap panel-dpi driver that would
> read generic timings from the device tree and set the display
> timing accordingly.  This driver was removed so the screen
> no longer functions.  This patch modifies the panel-simple
> file to setup the timings to the same values previously used.
>
> Fixes: 8bf4b1621178 ("drm/omap: Remove panel-dpi driver")
>

Will this be able to make it into linux-next for the 5.5 merge window?
 I believe Tony has picked up the device tree portion in his omap
tree, but I haven't seen any notifications on this series on whether
or not it's being applied.  I also don't know which tree I need to
look if it's already been applied.

This fixes a regression introduced a while ago where the driver I was
using for the display was removed.

thank you,

adam

> Signed-off-by: Adam Ford 
> Reviewed-by: Sam Ravnborg 
> ---
> V5:  No Change
> V4:  No Change
> V3:  No Change
> V2:  No Change
>
> diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> b/drivers/gpu/drm/panel/panel-simple.c
> index 5d487686d25c..72f69709f349 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -2061,6 +2061,40 @@ static const struct drm_display_mode 
> mitsubishi_aa070mc01_mode = {
> .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
>  };
>
> +static const struct drm_display_mode logicpd_type_28_mode = {
> +   .clock = 9000,
> +   .hdisplay = 480,
> +   .hsync_start = 480 + 3,
> +   .hsync_end = 480 + 3 + 42,
> +   .htotal = 480 + 3 + 42 + 2,
> +
> +   .vdisplay = 272,
> +   .vsync_start = 272 + 2,
> +   .vsync_end = 272 + 2 + 11,
> +   .vtotal = 272 + 2 + 11 + 3,
> +   .vrefresh = 60,
> +   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
> +};
> +
> +static const struct panel_desc logicpd_type_28 = {
> +   .modes = _type_28_mode,
> +   .num_modes = 1,
> +   .bpc = 8,
> +   .size = {
> +   .width = 105,
> +   .height = 67,
> +   },
> +   .delay = {
> +   .prepare = 200,
> +   .enable = 200,
> +   .unprepare = 200,
> +   .disable = 200,
> +   },
> +   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> +   .bus_flags = DRM_BUS_FLAG_DE_HIGH | 
> DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
> +DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
> +};
> +
>  static const struct panel_desc mitsubishi_aa070mc01 = {
> .modes = _aa070mc01_mode,
> .num_modes = 1,
> @@ -3287,6 +3321,9 @@ static const struct of_device_id platform_of_match[] = {
> }, {
> .compatible = "lg,lp129qe",
> .data = _lp129qe,
> +   }, {
> +   .compatible = "logicpd,type28",
> +   .data = _type_28,
> }, {
> .compatible = "mitsubishi,aa070mc01-ca1",
> .data = _aa070mc01,
> --
> 2.17.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 3/3] dt-bindings: display: panel: add bindings for logic technologies displays

2019-10-30 Thread Rob Herring
On Sun, Oct 27, 2019 at 03:26:09PM +0100, Marcel Ziswiler wrote:
> From: Marcel Ziswiler 
> 
> Add bindings for the following 3 previously added display panels
> manufactured by Logic Technologies Limited:
> 
> - LT161010-2NHC e.g. as found in the Toradex Capacitive Touch Display
> 7" Parallel [1]
> - LT161010-2NHR e.g. as found in the Toradex Resistive Touch Display 7"
> Parallel [2]
> - LT170410-2WHC e.g. as found in the Toradex Capacitive Touch Display
> 10.1" LVDS [3]
> 
> Those panels may also be distributed by Endrich Bauelemente Vertriebs
> GmbH [4].
> 
> [1] 
> https://docs.toradex.com/104497-7-inch-parallel-capacitive-touch-display-800x480-datasheet.pdf
> [2] 
> https://docs.toradex.com/104498-7-inch-parallel-resistive-touch-display-800x480.pdf
> [3] 
> https://docs.toradex.com/105952-10-1-inch-lvds-capacitive-touch-display-1280x800-datasheet.pdf
> [4] https://www.endrich.com/isi50_isi30_tft-displays/lt170410-1whc_isi30
> 
> Signed-off-by: Marcel Ziswiler 
> 
> ---
> 
> Changes in v2:
> - New patch adding display panel bindings as well as suggested by Rob.
> 
>  .../panel/logictechno,lt161010-2nhc.yaml  | 44 +++
>  .../panel/logictechno,lt161010-2nhr.yaml  | 44 +++
>  .../panel/logictechno,lt170410-2whc.yaml  | 44 +++
>  3 files changed, 132 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/logictechno,lt161010-2nhc.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/logictechno,lt161010-2nhr.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/logictechno,lt170410-2whc.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/logictechno,lt161010-2nhc.yaml
>  
> b/Documentation/devicetree/bindings/display/panel/logictechno,lt161010-2nhc.yaml
> new file mode 100644
> index ..0dfe94d38a47
> --- /dev/null
> +++ 
> b/Documentation/devicetree/bindings/display/panel/logictechno,lt161010-2nhc.yaml
> @@ -0,0 +1,44 @@
> +# SPDX-License-Identifier: GPL-2.0

Except the license for new bindings should be: 

(GPL-2.0-only OR BSD-2-Clause)

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

Re: [PATCH v2 3/3] dt-bindings: display: panel: add bindings for logic technologies displays

2019-10-30 Thread Rob Herring
On Sun, Oct 27, 2019 at 03:26:09PM +0100, Marcel Ziswiler wrote:
> From: Marcel Ziswiler 
> 
> Add bindings for the following 3 previously added display panels
> manufactured by Logic Technologies Limited:
> 
> - LT161010-2NHC e.g. as found in the Toradex Capacitive Touch Display
> 7" Parallel [1]
> - LT161010-2NHR e.g. as found in the Toradex Resistive Touch Display 7"
> Parallel [2]
> - LT170410-2WHC e.g. as found in the Toradex Capacitive Touch Display
> 10.1" LVDS [3]
> 
> Those panels may also be distributed by Endrich Bauelemente Vertriebs
> GmbH [4].
> 
> [1] 
> https://docs.toradex.com/104497-7-inch-parallel-capacitive-touch-display-800x480-datasheet.pdf
> [2] 
> https://docs.toradex.com/104498-7-inch-parallel-resistive-touch-display-800x480.pdf
> [3] 
> https://docs.toradex.com/105952-10-1-inch-lvds-capacitive-touch-display-1280x800-datasheet.pdf
> [4] https://www.endrich.com/isi50_isi30_tft-displays/lt170410-1whc_isi30
> 
> Signed-off-by: Marcel Ziswiler 
> 
> ---
> 
> Changes in v2:
> - New patch adding display panel bindings as well as suggested by Rob.
> 
>  .../panel/logictechno,lt161010-2nhc.yaml  | 44 +++
>  .../panel/logictechno,lt161010-2nhr.yaml  | 44 +++
>  .../panel/logictechno,lt170410-2whc.yaml  | 44 +++
>  3 files changed, 132 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/logictechno,lt161010-2nhc.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/logictechno,lt161010-2nhr.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/logictechno,lt170410-2whc.yaml

I would just put these into 1 document as the compatible is the only 
difference. Either way:

Reviewed-by: Rob Herring 

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

Re: [PATCH 2/2] drm/fb-helper: Remove drm_fb_helper_fbdev_{setup,teardown}()

2019-10-30 Thread Noralf Trønnes


Den 29.10.2019 08.06, skrev Thomas Zimmermann:
> Both functions are unused and can be removed. Drivers should use
> drm_fbdev_generic_setup() instead.
> 
> Signed-off-by: Thomas Zimmermann 
> ---
>  drivers/gpu/drm/drm_fb_helper.c | 109 +---
>  include/drm/drm_fb_helper.h |  25 
>  2 files changed, 1 insertion(+), 133 deletions(-)
> 

Thanks for the cleanup:

Reviewed-by: Noralf Trønnes 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 1/2] drm/todo: Convert drivers to generic fbdev emulation

2019-10-30 Thread Noralf Trønnes


Den 29.10.2019 08.06, skrev Thomas Zimmermann:
> This replaces the orignal TODO item for drm_fb_helper_fbdev_setup() and
> _teardown(), which are deprecated.
> 
> Signed-off-by: Thomas Zimmermann 
> ---
>  Documentation/gpu/todo.rst | 15 +++
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> index 6792fa9b6b6b..4aa767461e0e 100644
> --- a/Documentation/gpu/todo.rst
> +++ b/Documentation/gpu/todo.rst
> @@ -171,10 +171,10 @@ Contact: Maintainer of the driver you plan to convert
>  
>  Level: Intermediate
>  
> -Convert drivers to use drm_fb_helper_fbdev_setup/teardown()
> 
> +Convert drivers to use drm_fbdev_generic_setup()
> +
>  
> -Most drivers can use drm_fb_helper_fbdev_setup() except maybe:
> +Most drivers can use drm_fbdev_generic_setup() except maybe:
>  
>  - amdgpu which has special logic to decide whether to call
>drm_helper_disable_unused_functions()
> @@ -184,8 +184,10 @@ Most drivers can use drm_fb_helper_fbdev_setup() except 
> maybe:
>  
>  - i915 which calls drm_fb_helper_initial_config() in a worker
>  
> -Drivers that use drm_framebuffer_remove() to clean up the fbdev framebuffer 
> can
> -probably use drm_fb_helper_fbdev_teardown().
> +Current generic fbdev emulation expects the framebuffer in system
> +memory (or system-like memory). This might be a problem for certain
> +drivers. Generic fbdev emulation should have a way of operating on
> +I/O memory.
>  
>  Contact: Maintainer of the driver you plan to convert
>  

I think you can just delete the entire _setup/_teardown entry including
the list of drivers. Many more drivers have issues with the generic
emulation so no point in listing individual drivers at this early stage.
You can add that the driver has to be atomic and that it needs to
support prime vmap/mmap. Maybe also the current shadow buffer
performance penalty for shmem backed buffers.

> @@ -328,9 +330,6 @@ drm_fb_helper tasks
>these igt tests need to be fixed: kms_fbcon_fbt@psr and
>kms_fbcon_fbt@psr-suspend.
>  
> -- The max connector argument for drm_fb_helper_init() and
> -  drm_fb_helper_fbdev_setup() isn't used anymore and can be removed.
> -

This entry is still valid for drm_fb_helper_init().

Noralf.

>  - The helper doesn't keep an array of connectors anymore so these can be
>removed: drm_fb_helper_single_add_all_connectors(),
>drm_fb_helper_add_one_connector() and drm_fb_helper_remove_one_connector().
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH -next] drm/amd/display: Add a conversion function for transmitter and phy_id enums

2019-10-30 Thread Alex Deucher
On Wed, Oct 30, 2019 at 8:33 AM Kazlauskas, Nicholas
 wrote:
>
> On 2019-10-30 2:04 a.m., Nathan Chancellor wrote:
> > Clang warns:
> >
> > ../drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:2520:42:
> > error: implicit conversion from enumeration type 'enum transmitter' to
> > different enumeration type 'enum physical_phy_id'
> > [-Werror,-Wenum-conversion]
> >  psr_context->smuPhyId = link->link_enc->transmitter;
> >~ ^~~
> > 1 error generated.
> >
> > As the comment above this assignment states, this is intentional. To
> > match previous warnings of this nature, add a conversion function that
> > explicitly converts between the enums and warns when there is a
> > mismatch.
> >
> > See commit 828cfa29093f ("drm/amdgpu: Fix amdgpu ras to ta enums
> > conversion") and commit d9ec5cfd5a2e ("drm/amd/display: Use switch table
> > for dc_to_smu_clock_type") for previous examples of this.
> >
> > Fixes: e0d08a40a63b ("drm/amd/display: Add debugfs entry for reading psr 
> > state")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/758
> > Signed-off-by: Nathan Chancellor 
>
> Reviewed-by: Nicholas Kazlauskas 
>
> With the small nitpick that maybe the default case should be
> PHYLD_UNKNOWN, but well get the warning if that happens anyway.
>

Applied with that change.

Thanks!

Alex

> Nicholas Kazlauskas
>
> > ---
> >   drivers/gpu/drm/amd/display/dc/core/dc_link.c | 38 ++-
> >   1 file changed, 37 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
> > b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> > index 7b18087be585..38dfe460e13b 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> > @@ -2447,6 +2447,41 @@ bool dc_link_get_psr_state(const struct dc_link 
> > *link, uint32_t *psr_state)
> >   return true;
> >   }
> >
> > +static inline enum physical_phy_id
> > +transmitter_to_phy_id(enum transmitter transmitter_value)
> > +{
> > + switch (transmitter_value) {
> > + case TRANSMITTER_UNIPHY_A:
> > + return PHYLD_0;
> > + case TRANSMITTER_UNIPHY_B:
> > + return PHYLD_1;
> > + case TRANSMITTER_UNIPHY_C:
> > + return PHYLD_2;
> > + case TRANSMITTER_UNIPHY_D:
> > + return PHYLD_3;
> > + case TRANSMITTER_UNIPHY_E:
> > + return PHYLD_4;
> > + case TRANSMITTER_UNIPHY_F:
> > + return PHYLD_5;
> > + case TRANSMITTER_NUTMEG_CRT:
> > + return PHYLD_6;
> > + case TRANSMITTER_TRAVIS_CRT:
> > + return PHYLD_7;
> > + case TRANSMITTER_TRAVIS_LCD:
> > + return PHYLD_8;
> > + case TRANSMITTER_UNIPHY_G:
> > + return PHYLD_9;
> > + case TRANSMITTER_COUNT:
> > + return PHYLD_COUNT;
> > + case TRANSMITTER_UNKNOWN:
> > + return PHYLD_UNKNOWN;
> > + default:
> > + WARN_ONCE(1, "Unknown transmitter value %d\n",
> > +   transmitter_value);
> > + return PHYLD_0;
> > + }
> > +}
> > +
> >   bool dc_link_setup_psr(struct dc_link *link,
> >   const struct dc_stream_state *stream, struct psr_config 
> > *psr_config,
> >   struct psr_context *psr_context)
> > @@ -2517,7 +2552,8 @@ bool dc_link_setup_psr(struct dc_link *link,
> >   /* Hardcoded for now.  Can be Pcie or Uniphy (or Unknown)*/
> >   psr_context->phyType = PHY_TYPE_UNIPHY;
> >   /*PhyId is associated with the transmitter id*/
> > - psr_context->smuPhyId = link->link_enc->transmitter;
> > + psr_context->smuPhyId =
> > + transmitter_to_phy_id(link->link_enc->transmitter);
> >
> >   psr_context->crtcTimingVerticalTotal = stream->timing.v_total;
> >   psr_context->vsyncRateHz = div64_u64(div64_u64((stream->
> >
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/amd/display: remove redundant null pointer check before kfree

2019-10-30 Thread Alex Deucher
On Wed, Oct 30, 2019 at 9:36 AM Harry Wentland  wrote:
>
> On 2019-10-29 9:57 p.m., zhong jiang wrote:
> > kfree has taken null pointer into account. hence it is safe to remove
> > the unnecessary check.
> >
> > Signed-off-by: zhong jiang 
>
> Reviewed-by: Harry Wentland 
>

Applied.  thanks!

Alex

> Harry
>
> > ---
> >  drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c 
> > b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> > index cf6ef38..6f730b5 100644
> > --- a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> > +++ b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> > @@ -174,9 +174,7 @@ static bool hdmi_14_process_transaction(
> >   link->ctx,
> >   link,
> >   _command);
> > -
> > - if (buff)
> > - kfree(buff);
> > + kfree(buff);
> >
> >   return result;
> >  }
> >
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 1/3 v4] drm/panel: Add generic DSI panel YAML bindings

2019-10-30 Thread Linus Walleij
On Fri, Oct 25, 2019 at 9:20 PM Rob Herring  wrote:

> [Me]
> > +dsi-controller@55aa55aa {
> > +  compatible = "acme,foo";
>
> Eventually, I want to start reporting if compatible strings aren't
> documented (i.e. matched to a schema). This will break then...

OK I drop this.

> > +  reg = <0x55aa55aa>;
>
> This will fail because a size cell is expected.

Do you mean it will fail the day we actually check reg properties to
be properly formed under the circumstances?

Because:
  HOSTLD  scripts/dtc/dtc
  CHKDT   Documentation/devicetree/bindings/display/panel/sony,acx424akp.yaml
  CHKDT   Documentation/devicetree/bindings/display/dsi-controller.yaml
  SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
(...)

It passes just fine.

I get a bit nervous since the schema is all about being strict about
stuff so I get the feeling that "should have failed".

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

Re: [PATCH] drm/amd/display: remove redundant null pointer check before kfree

2019-10-30 Thread Harry Wentland
On 2019-10-29 9:57 p.m., zhong jiang wrote:
> kfree has taken null pointer into account. hence it is safe to remove
> the unnecessary check.
> 
> Signed-off-by: zhong jiang 

Reviewed-by: Harry Wentland 

Harry

> ---
>  drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c 
> b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> index cf6ef38..6f730b5 100644
> --- a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> +++ b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
> @@ -174,9 +174,7 @@ static bool hdmi_14_process_transaction(
>   link->ctx,
>   link,
>   _command);
> -
> - if (buff)
> - kfree(buff);
> + kfree(buff);
>  
>   return result;
>  }
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [RFC][PATCH 1/3] dt-bindings: dma-buf: heaps: Describe CMA regions to be added to dmabuf heaps interface.

2019-10-30 Thread Rob Herring
On Fri, Oct 25, 2019 at 04:55:35PM -0700, John Stultz wrote:
> On Fri, Oct 25, 2019 at 4:32 PM Rob Herring  wrote:
> >
> > On Fri, Oct 25, 2019 at 5:51 PM John Stultz  wrote:
> > >
> > > This binding specifies which CMA regions should be added to the
> > > dmabuf heaps interface.
> >
> > Is this an ION DT binding in disguise? I thought I killed that. ;)
> 
> Maybe? I may not have been paying attention back then.  :)
> 
> > > +Example:
> > > +This example has a camera CMA node in reserved memory, which is then
> > > +referenced by the dmabuf-heap-cma node.
> > > +
> > > +
> > > +   reserved-memory {
> > > +   #address-cells = <2>;
> > > +   #size-cells = <2>;
> > > +   ranges;
> > > +   ...
> > > +   cma_camera: cma-camera {
> > > +   compatible = "shared-dma-pool";
> > > +   reg = <0x0 0x24C0 0x0 0x400>;
> > > +   reusable;
> > > +   };
> > > +   ...
> > > +   };
> > > +
> > > +   cma_heap {
> > > +   compatible = "dmabuf-heap-cma";
> > > +   memory-region = <_camera>;
> >
> > Why the indirection here? Can't you just add a flag property to
> > reserved-memory nodes like we do to flag CMA nodes?
> 
> Happy to try. Do you mean like with the "reuasable" tag?  Or more like
> the "linux,cma-default" tag?

Probably like "linux,cma-default" as it is a hint for who to manage it 
rather than a characteristic of the region.
 
> Do you have a preference for the flag name here?

Not really.


> > As I suspected, it's because in patch 2 you're just abusing DT to
> > instantiate platform devices. We already support binding drivers to
> > reserved-memory nodes directly.
> 
> Sorry, one of those "when all you know how to do is hammer, everything
> looks like a nail" issues.
> Is there a specific example for binding drivers to reserved-memory
> nodes I can try to follow?

ramoops and I think there's a QCom driver.

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

[Bug 111232] 3200 Memory Crash My System

2019-10-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=111232

bibitocarlos  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #12 from bibitocarlos  ---
Fixed with latest firmware

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

Re: Unexpected screen flicker during i915 initialization

2019-10-30 Thread Jani Nikula
On Wed, 30 Oct 2019, Chris Chiu  wrote:
> Hi guys,
> We have 2 laptops, ASUS Z406MA and Acer TravelMate B118, both
> powered by the same Intel N5000 GemniLake CPU. On the Acer laptop, the
> panel will blink once during boot which never happens on the ASUS
> laptop. It caught my attention and I find the difference between them
> but I need help for more information,
>
> The major difference happens in bxt_sanitize_cdclk() on the
> following condition check.
> if (cdctl == expected)
> /* All well; nothing to sanitize */
> return;
>
> On the problematic Acer laptop, the value of cdctl is 0x27a while
> the same cdctl is 0x278 on ASUS machine. Due to the 0x27a is not equal
> to the expected value 0x278 so it needs to be sanitized by assigning
> -1 to  dev_priv->cdclk.hw.vco. Then the consequent bxt_set_cdclk()
> will force the full PLL disable and enable. And that's the flicker
> (blink) we observed during boot.
>
> Although I can't find the definition about the BIT(2) of CDCLK_CTL
> which cause this difference. Can anyone suggest what exactly the
> problem is and how should we deal with it? Thanks.

The 11 least significant bits of that register are the cdclk frequency
in 10.1 fixed point format. Apparently the Acer BIOS or GOP has a
different idea of how to calculate the value from what i915 and the Asus
think.

To handle this in i915, we'd need to allow some deviation from the
expected value, and only switch to use our value at the next modeset. We
do need the sanitization though, because sometimes there have been
completely bogus values to begin with.

Please file a bug over at [1] and reference this thread.

BR,
Jani.


[1] https://bugs.freedesktop.org/enter_bug.cgi?product=DRI=DRM/Intel


-- 
Jani Nikula, Intel Open Source Graphics Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH -next] drm/amd/display: Add a conversion function for transmitter and phy_id enums

2019-10-30 Thread Kazlauskas, Nicholas
On 2019-10-30 2:04 a.m., Nathan Chancellor wrote:
> Clang warns:
> 
> ../drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:2520:42:
> error: implicit conversion from enumeration type 'enum transmitter' to
> different enumeration type 'enum physical_phy_id'
> [-Werror,-Wenum-conversion]
>  psr_context->smuPhyId = link->link_enc->transmitter;
>~ ^~~
> 1 error generated.
> 
> As the comment above this assignment states, this is intentional. To
> match previous warnings of this nature, add a conversion function that
> explicitly converts between the enums and warns when there is a
> mismatch.
> 
> See commit 828cfa29093f ("drm/amdgpu: Fix amdgpu ras to ta enums
> conversion") and commit d9ec5cfd5a2e ("drm/amd/display: Use switch table
> for dc_to_smu_clock_type") for previous examples of this.
> 
> Fixes: e0d08a40a63b ("drm/amd/display: Add debugfs entry for reading psr 
> state")
> Link: https://github.com/ClangBuiltLinux/linux/issues/758
> Signed-off-by: Nathan Chancellor 

Reviewed-by: Nicholas Kazlauskas 

With the small nitpick that maybe the default case should be 
PHYLD_UNKNOWN, but well get the warning if that happens anyway.

Nicholas Kazlauskas

> ---
>   drivers/gpu/drm/amd/display/dc/core/dc_link.c | 38 ++-
>   1 file changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
> b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> index 7b18087be585..38dfe460e13b 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
> @@ -2447,6 +2447,41 @@ bool dc_link_get_psr_state(const struct dc_link *link, 
> uint32_t *psr_state)
>   return true;
>   }
>   
> +static inline enum physical_phy_id
> +transmitter_to_phy_id(enum transmitter transmitter_value)
> +{
> + switch (transmitter_value) {
> + case TRANSMITTER_UNIPHY_A:
> + return PHYLD_0;
> + case TRANSMITTER_UNIPHY_B:
> + return PHYLD_1;
> + case TRANSMITTER_UNIPHY_C:
> + return PHYLD_2;
> + case TRANSMITTER_UNIPHY_D:
> + return PHYLD_3;
> + case TRANSMITTER_UNIPHY_E:
> + return PHYLD_4;
> + case TRANSMITTER_UNIPHY_F:
> + return PHYLD_5;
> + case TRANSMITTER_NUTMEG_CRT:
> + return PHYLD_6;
> + case TRANSMITTER_TRAVIS_CRT:
> + return PHYLD_7;
> + case TRANSMITTER_TRAVIS_LCD:
> + return PHYLD_8;
> + case TRANSMITTER_UNIPHY_G:
> + return PHYLD_9;
> + case TRANSMITTER_COUNT:
> + return PHYLD_COUNT;
> + case TRANSMITTER_UNKNOWN:
> + return PHYLD_UNKNOWN;
> + default:
> + WARN_ONCE(1, "Unknown transmitter value %d\n",
> +   transmitter_value);
> + return PHYLD_0;
> + }
> +}
> +
>   bool dc_link_setup_psr(struct dc_link *link,
>   const struct dc_stream_state *stream, struct psr_config 
> *psr_config,
>   struct psr_context *psr_context)
> @@ -2517,7 +2552,8 @@ bool dc_link_setup_psr(struct dc_link *link,
>   /* Hardcoded for now.  Can be Pcie or Uniphy (or Unknown)*/
>   psr_context->phyType = PHY_TYPE_UNIPHY;
>   /*PhyId is associated with the transmitter id*/
> - psr_context->smuPhyId = link->link_enc->transmitter;
> + psr_context->smuPhyId =
> + transmitter_to_phy_id(link->link_enc->transmitter);
>   
>   psr_context->crtcTimingVerticalTotal = stream->timing.v_total;
>   psr_context->vsyncRateHz = div64_u64(div64_u64((stream->
> 

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

Re: [PATCH 1/4] drm/msm: fix memleak on release

2019-10-30 Thread Johan Hovold
On Thu, Oct 10, 2019 at 03:13:30PM +0200, Johan Hovold wrote:
> If a process is interrupted while accessing the "gpu" debugfs file and
> the drm device struct_mutex is contended, release() could return early
> and fail to free related resources.
> 
> Note that the return value from release() is ignored.
> 
> Fixes: 4f776f4511c7 ("drm/msm/gpu: Convert the GPU show function to use the 
> GPU state")
> Cc: stable  # 4.18
> Cc: Jordan Crouse 
> Cc: Rob Clark 
> Signed-off-by: Johan Hovold 
> ---

Rob, Sean,

Sending a reminder about this one, which is not yet in linux-next.

Perhaps Daniel can pick it up otherwise?

Thanks,
Johan

>  drivers/gpu/drm/msm/msm_debugfs.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_debugfs.c 
> b/drivers/gpu/drm/msm/msm_debugfs.c
> index 6be879578140..1c74381a4fc9 100644
> --- a/drivers/gpu/drm/msm/msm_debugfs.c
> +++ b/drivers/gpu/drm/msm/msm_debugfs.c
> @@ -47,12 +47,8 @@ static int msm_gpu_release(struct inode *inode, struct 
> file *file)
>   struct msm_gpu_show_priv *show_priv = m->private;
>   struct msm_drm_private *priv = show_priv->dev->dev_private;
>   struct msm_gpu *gpu = priv->gpu;
> - int ret;
> -
> - ret = mutex_lock_interruptible(_priv->dev->struct_mutex);
> - if (ret)
> - return ret;
>  
> + mutex_lock(_priv->dev->struct_mutex);
>   gpu->funcs->gpu_state_put(show_priv->state);
>   mutex_unlock(_priv->dev->struct_mutex);
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PULL] topic/mst-suspend-resume-reprobe-2019-10-29-2

2019-10-30 Thread Daniel Vetter
On Tue, Oct 29, 2019 at 11:06 PM Lyude Paul  wrote:
>
> topic/mst-suspend-resume-reprobe-2019-10-29-2:
> UAPI Changes:
>
> Cross-subsystem Changes:
>
> Core Changes:
> * Handle UP requests asynchronously in the DP MST helpers, fixing
>   hotplug notifications and allowing us to implement suspend/resume
>   reprobing
> * Add basic suspend/resume reprobing to the DP MST helpers
> * Improve locking for link address reprobing and connection status
>   request handling in the DP MST helpers
> * Miscellaneous refactoring in the DP MST helpers
> * Add a Kconfig option to the DP MST helpers to enable tracking of
>   gets/puts for topology references for debugging purposes
>
> Driver Changes:
> * nouveau: Resume hotplug interrupts earlier, so that sideband
>   messages may be transmitted during resume and thus allow
>   suspend/resume reprobing for DP MST to work
> * nouveau: Avoid grabbing runtime PM references when handling short DP
>   pulses, so that handling sideband messages in resume codepaths with the
>   DP MST helpers doesn't deadlock us
> * i915, nouveau, amdgpu, radeon: Use detect_ctx for probing MST
>   connectors, so that we can grab the topology manager's atomic lock
>
> Note: there's some amdgpu patches that I didn't realize were pushed
> upstream already when creating this topic branch. When they fail to
> apply, you can just ignore and skip them.
> The following changes since commit 2e79e22e092acd55da0b2db066e4826d7d152c41:

Out of curiosity, why did you go with a topic branch here? Usually we
only do those if there's a serious cross-tree coordination problem,
that can't be solved with some acks for merging the patches through
the unusual tree. Plus then some notes in the pull requests why and
who should pull this in. These one here doesn't seem like this is
necessary, and the standard approach of stuffing it all into
drm-misc-next should be good enough. Also rule of thumb maintainers do
the topic branch stuff with merges and prep and everything.

I'm also confused with your "when they fail to apply", topic branches
are only ever merged, not applied individually.
-Daniel

>
>   Merge v5.4-rc4 into drm-next (2019-10-23 12:10:05 +0200)
>
> are available in the Git repository at:
>
>   git://anongit.freedesktop.org/drm/drm-misc 
> tags/topic/mst-suspend-resume-reprobe-2019-10-29-2
>
> for you to fetch changes up to 12a280c7286857119cf0d88c487f695e3a1c0912:
>
>   drm/dp_mst: Add topology ref history tracking for debugging (2019-10-24 
> 14:36:13 -0400)
>
> 
> UAPI Changes:
>
> Cross-subsystem Changes:
>
> Core Changes:
> * Handle UP requests asynchronously in the DP MST helpers, fixing
>   hotplug notifications and allowing us to implement suspend/resume
>   reprobing
> * Add basic suspend/resume reprobing to the DP MST helpers
> * Improve locking for link address reprobing and connection status
>   request handling in the DP MST helpers
> * Miscellaneous refactoring in the DP MST helpers
> * Add a Kconfig option to the DP MST helpers to enable tracking of
>   gets/puts for topology references for debugging purposes
>
> Driver Changes:
> * nouveau: Resume hotplug interrupts earlier, so that sideband
>   messages may be transmitted during resume and thus allow
>   suspend/resume reprobing for DP MST to work
> * nouveau: Avoid grabbing runtime PM references when handling short DP
>   pulses, so that handling sideband messages in resume codepaths with the
>   DP MST helpers doesn't deadlock us
> * i915, nouveau, amdgpu, radeon: Use detect_ctx for probing MST
>   connectors, so that we can grab the topology manager's atomic lock
>
> Note: there's some amdgpu patches that I didn't realize were pushed
> upstream already when creating this topic branch. When they fail to
> apply, you can just ignore and skip them.
>
> 
> Lyude Paul (14):
>   drm/dp_mst: Destroy MSTBs asynchronously
>   drm/dp_mst: Remove PDT teardown in drm_dp_destroy_port() and refactor
>   drm/dp_mst: Refactor pdt setup/teardown, add more locking
>   drm/dp_mst: Handle UP requests asynchronously
>   drm/dp_mst: Add probe_lock
>   drm/dp_mst: Protect drm_dp_mst_port members with locking
>   drm/dp_mst: Don't forget to update port->input in 
> drm_dp_mst_handle_conn_stat()
>   drm/dp_mst: Lessen indenting in drm_dp_mst_topology_mgr_resume()
>   drm/nouveau: Don't grab runtime PM refs for HPD IRQs
>   drm/nouveau: Resume hotplug interrupts earlier
>   drm/amdgpu: Iterate through DRM connectors correctly
>   drm/amdgpu/dm: Resume short HPD IRQs before resuming MST topology
>   drm/dp_mst: Add basic topology reprobing when resuming
>   drm/dp_mst: Add topology ref history tracking for debugging
>
>  drivers/gpu/drm/Kconfig|   14 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |   13 +-
>  

Re: [PATCH v9 5/6] ARM: dts: rockchip: Add HDMI support to rk3288-veyron-analog-audio

2019-10-30 Thread Heiko Stuebner
Hi,

Am Mittwoch, 30. Oktober 2019, 10:09:46 CET schrieb Tzung-Bi Shih:
> This series has 6 patches.  We noticed you have merged the first 4
> patches (includes the DT binding one:
> https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/157668.html).
> 
> There are 2 DTS patches are still on the list:
> - [PATCH v9 5/6] ARM: dts: rockchip: Add HDMI support to
> rk3288-veyron-analog-audio
> https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/157499.html
> - [PATCH v9 6/6] ARM: dts: rockchip: Add HDMI audio support to
> rk3288-veyron-mickey.dts
> https://mailman.alsa-project.org/pipermail/alsa-devel/2019-October/157500.html
> 
> Are you waiting for other maintainers' acknowledgement?  Or do we need
> to resend them with maybe some modifications?

nope all good like it is, ideally driver-changes (including the binding)
and the devicetree-changes itself go through my tree in this case, as
otherwise we would often run into conflicts if dts change go through
vastly different maintainer trees.

Of course dts changes can only get applied after the driver side is happy,
so I'll be picking up these 2 changes (hopefully shortly)


Heiko



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

RE: [PATCH v2 2/5] drm/dsi: add missing DSI data types

2019-10-30 Thread Kulkarni, Vandita
> -Original Message-
> From: Jani Nikula 
> Sent: Monday, October 28, 2019 8:31 PM
> To: dri-devel@lists.freedesktop.org
> Cc: intel-...@lists.freedesktop.org; Nikula, Jani ;
> Kulkarni, Vandita 
> Subject: [PATCH v2 2/5] drm/dsi: add missing DSI data types
> 
> Add execute queue and compressed pixel stream packet data types for
> completeness.
> 
> Cc: Vandita Kulkarni 

Looks good to me.
Reviewed-by: Vandita Kulkarni 

> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 2 ++
>  include/video/mipi_display.h   | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c
> b/drivers/gpu/drm/drm_mipi_dsi.c index f237d80828c3..3f33f02571fd
> 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -388,6 +388,7 @@ bool mipi_dsi_packet_format_is_short(u8 type)
>   case MIPI_DSI_DCS_SHORT_WRITE:
>   case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
>   case MIPI_DSI_DCS_READ:
> + case MIPI_DSI_EXECUTE_QUEUE:
>   case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
>   return true;
>   }
> @@ -411,6 +412,7 @@ bool mipi_dsi_packet_format_is_long(u8 type)
>   case MIPI_DSI_GENERIC_LONG_WRITE:
>   case MIPI_DSI_DCS_LONG_WRITE:
>   case MIPI_DSI_PICTURE_PARAMETER_SET:
> + case MIPI_DSI_COMPRESSED_PIXEL_STREAM:
>   case MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20:
>   case MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24:
>   case MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16:
> diff --git a/include/video/mipi_display.h b/include/video/mipi_display.h
> index 79fd71cf4934..6b6390dfa203 100644
> --- a/include/video/mipi_display.h
> +++ b/include/video/mipi_display.h
> @@ -37,6 +37,7 @@ enum {
>   MIPI_DSI_DCS_SHORT_WRITE_PARAM  = 0x15,
> 
>   MIPI_DSI_DCS_READ   = 0x06,
> + MIPI_DSI_EXECUTE_QUEUE  = 0x16,
> 
>   MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE =
> 0x37,
> 
> @@ -46,6 +47,7 @@ enum {
>   MIPI_DSI_DCS_LONG_WRITE = 0x39,
> 
>   MIPI_DSI_PICTURE_PARAMETER_SET  = 0x0a,
> + MIPI_DSI_COMPRESSED_PIXEL_STREAM= 0x0b,
> 
>   MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20= 0x0c,
>   MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24= 0x1c,
> --
> 2.20.1

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

[PATCH] drm/amd/display: remove redundant null pointer check before kfree

2019-10-30 Thread zhong jiang
kfree has taken null pointer into account. hence it is safe to remove
the unnecessary check.

Signed-off-by: zhong jiang 
---
 drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c 
b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
index cf6ef38..6f730b5 100644
--- a/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
+++ b/drivers/gpu/drm/amd/display/dc/hdcp/hdcp_msg.c
@@ -174,9 +174,7 @@ static bool hdmi_14_process_transaction(
link->ctx,
link,
_command);
-
-   if (buff)
-   kfree(buff);
+   kfree(buff);
 
return result;
 }
-- 
1.7.12.4

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

[PATCH v2] drm: sun4i: Add support for suspending the display driver

2019-10-30 Thread Ondrej Jirman
Shut down the display engine during suspend.

Signed-off-by: Ondrej Jirman 
---
Changes in v2:
- spaces -> tabs

 drivers/gpu/drm/sun4i/sun4i_drv.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c 
b/drivers/gpu/drm/sun4i/sun4i_drv.c
index a5757b11b730..c519d7cfcf43 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -346,6 +346,27 @@ static int sun4i_drv_add_endpoints(struct device *dev,
return count;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int sun4i_drv_drm_sys_suspend(struct device *dev)
+{
+   struct drm_device *drm = dev_get_drvdata(dev);
+
+   return drm_mode_config_helper_suspend(drm);
+}
+
+static int sun4i_drv_drm_sys_resume(struct device *dev)
+{
+   struct drm_device *drm = dev_get_drvdata(dev);
+
+   return drm_mode_config_helper_resume(drm);
+}
+#endif
+
+static const struct dev_pm_ops sun4i_drv_drm_pm_ops = {
+   SET_SYSTEM_SLEEP_PM_OPS(sun4i_drv_drm_sys_suspend,
+   sun4i_drv_drm_sys_resume)
+};
+
 static int sun4i_drv_probe(struct platform_device *pdev)
 {
struct component_match *match = NULL;
@@ -418,6 +439,7 @@ static struct platform_driver sun4i_drv_platform_driver = {
.driver = {
.name   = "sun4i-drm",
.of_match_table = sun4i_drv_of_table,
+   .pm = _drv_drm_pm_ops,
},
 };
 module_platform_driver(sun4i_drv_platform_driver);
-- 
2.23.0

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

[PATCH -next] drm/amd/display: Add a conversion function for transmitter and phy_id enums

2019-10-30 Thread Nathan Chancellor
Clang warns:

../drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link.c:2520:42:
error: implicit conversion from enumeration type 'enum transmitter' to
different enumeration type 'enum physical_phy_id'
[-Werror,-Wenum-conversion]
psr_context->smuPhyId = link->link_enc->transmitter;
  ~ ^~~
1 error generated.

As the comment above this assignment states, this is intentional. To
match previous warnings of this nature, add a conversion function that
explicitly converts between the enums and warns when there is a
mismatch.

See commit 828cfa29093f ("drm/amdgpu: Fix amdgpu ras to ta enums
conversion") and commit d9ec5cfd5a2e ("drm/amd/display: Use switch table
for dc_to_smu_clock_type") for previous examples of this.

Fixes: e0d08a40a63b ("drm/amd/display: Add debugfs entry for reading psr state")
Link: https://github.com/ClangBuiltLinux/linux/issues/758
Signed-off-by: Nathan Chancellor 
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 38 ++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 7b18087be585..38dfe460e13b 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -2447,6 +2447,41 @@ bool dc_link_get_psr_state(const struct dc_link *link, 
uint32_t *psr_state)
return true;
 }
 
+static inline enum physical_phy_id
+transmitter_to_phy_id(enum transmitter transmitter_value)
+{
+   switch (transmitter_value) {
+   case TRANSMITTER_UNIPHY_A:
+   return PHYLD_0;
+   case TRANSMITTER_UNIPHY_B:
+   return PHYLD_1;
+   case TRANSMITTER_UNIPHY_C:
+   return PHYLD_2;
+   case TRANSMITTER_UNIPHY_D:
+   return PHYLD_3;
+   case TRANSMITTER_UNIPHY_E:
+   return PHYLD_4;
+   case TRANSMITTER_UNIPHY_F:
+   return PHYLD_5;
+   case TRANSMITTER_NUTMEG_CRT:
+   return PHYLD_6;
+   case TRANSMITTER_TRAVIS_CRT:
+   return PHYLD_7;
+   case TRANSMITTER_TRAVIS_LCD:
+   return PHYLD_8;
+   case TRANSMITTER_UNIPHY_G:
+   return PHYLD_9;
+   case TRANSMITTER_COUNT:
+   return PHYLD_COUNT;
+   case TRANSMITTER_UNKNOWN:
+   return PHYLD_UNKNOWN;
+   default:
+   WARN_ONCE(1, "Unknown transmitter value %d\n",
+ transmitter_value);
+   return PHYLD_0;
+   }
+}
+
 bool dc_link_setup_psr(struct dc_link *link,
const struct dc_stream_state *stream, struct psr_config 
*psr_config,
struct psr_context *psr_context)
@@ -2517,7 +2552,8 @@ bool dc_link_setup_psr(struct dc_link *link,
/* Hardcoded for now.  Can be Pcie or Uniphy (or Unknown)*/
psr_context->phyType = PHY_TYPE_UNIPHY;
/*PhyId is associated with the transmitter id*/
-   psr_context->smuPhyId = link->link_enc->transmitter;
+   psr_context->smuPhyId =
+   transmitter_to_phy_id(link->link_enc->transmitter);
 
psr_context->crtcTimingVerticalTotal = stream->timing.v_total;
psr_context->vsyncRateHz = div64_u64(div64_u64((stream->
-- 
2.24.0.rc1

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

[PATCH v4 1/7] drm/bridge: move ANA78xx driver to analogix subdirectory

2019-10-30 Thread Torsten Duwe
From: Icenowy Zheng 

As ANA78xx chips are designed and produced by Analogix Semiconductor,
Inc, move their driver codes into analogix subdirectory.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
Reviewed-by: Laurent Pinchart 
Signed-off-by: Torsten Duwe 
Reviewed-by: Andrzej Hajda 
---
 drivers/gpu/drm/bridge/Kconfig   | 10 --
 drivers/gpu/drm/bridge/Makefile  |  4 ++--
 drivers/gpu/drm/bridge/analogix/Kconfig  | 10 ++
 drivers/gpu/drm/bridge/analogix/Makefile |  1 +
 drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c |  0
 drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h |  0
 6 files changed, 13 insertions(+), 12 deletions(-)
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (100%)
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h (100%)

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 1cc9f502c1f2..6c48722130fd 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -16,16 +16,6 @@ config DRM_PANEL_BRIDGE
 menu "Display Interface Bridges"
depends on DRM && DRM_BRIDGE
 
-config DRM_ANALOGIX_ANX78XX
-   tristate "Analogix ANX78XX bridge"
-   select DRM_KMS_HELPER
-   select REGMAP_I2C
-   ---help---
- ANX78XX is an ultra-low power Full-HD SlimPort transmitter
- designed for portable devices. The ANX78XX transforms
- the HDMI output of an application processor to MyDP
- or DisplayPort.
-
 config DRM_CDNS_DSI
tristate "Cadence DPI/DSI bridge"
select DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf5a6f8..a6c7dd7727ea 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
@@ -12,8 +11,9 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o
 obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
-obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
+
+obj-y += analogix/
 obj-y += synopsys/
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index e930ff9b5cd4..29ba1b21019e 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,4 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0-only
+config DRM_ANALOGIX_ANX78XX
+   tristate "Analogix ANX78XX bridge"
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ ANX78XX is an ultra-low power Full-HD SlimPort transmitter
+ designed for portable devices. The ANX78XX transforms
+ the HDMI output of an application processor to MyDP
+ or DisplayPort.
+
 config DRM_ANALOGIX_DP
tristate
depends on DRM
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index fdbf3fd2f087..6fcbfd3ee560 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
similarity index 100%
rename from drivers/gpu/drm/bridge/analogix-anx78xx.c
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
similarity index 100%
rename from drivers/gpu/drm/bridge/analogix-anx78xx.h
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
-- 
2.16.4

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

[PATCH v4 6/7] dt-bindings: Add ANX6345 DP/eDP transmitter binding

2019-10-30 Thread Torsten Duwe
The anx6345 is an ultra-low power DisplayPort/eDP transmitter designed
for portable devices.

Add a binding document for it.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
Reviewed-by: Rob Herring 
Signed-off-by: Torsten Duwe 
Reviewed-by: Laurent Pinchart 
---
 .../bindings/display/bridge/anx6345.yaml   | 92 ++
 1 file changed, 92 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/anx6345.yaml

diff --git a/Documentation/devicetree/bindings/display/bridge/anx6345.yaml 
b/Documentation/devicetree/bindings/display/bridge/anx6345.yaml
new file mode 100644
index ..094e8e8a5faa
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/anx6345.yaml
@@ -0,0 +1,92 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/bridge/anx6345.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analogix ANX6345 eDP Transmitter Device Tree Bindings
+
+maintainers:
+  - Torsten Duwe 
+
+description: |
+  The ANX6345 is an ultra-low power Full-HD eDP transmitter designed for
+  portable devices.
+
+properties:
+  compatible:
+const: analogix,anx6345
+
+  reg:
+maxItems: 1
+description: base I2C address of the device
+
+  reset-gpios:
+maxItems: 1
+description: GPIO connected to active low reset
+
+  dvdd12-supply:
+maxItems: 1
+description: Regulator for 1.2V digital core power.
+
+  dvdd25-supply:
+maxItems: 1
+description: Regulator for 2.5V digital core power.
+
+  ports:
+anyOf:
+  - port@0:
+description: Video port for LVTTL input
+  - port@1:
+description: Video port for eDP output (panel or connector).
+ May be omitted if EDID works reliably.
+required:
+  - port@0
+
+required:
+  - compatible
+  - reg
+  - reset-gpios
+  - dvdd12-supply
+  - dvdd25-supply
+  - ports
+
+examples:
+  - |
+i2c0 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  anx6345: anx6345@38 {
+compatible = "analogix,anx6345";
+reg = <0x38>;
+reset-gpios = < 1 /* GPIO_ACTIVE_LOW */>;
+dvdd25-supply = <_dldo2>;
+dvdd12-supply = <_fldo1>;
+
+ports {
+  #address-cells = <1>;
+  #size-cells = <0>;
+
+  anx6345_in: port@0 {
+#address-cells = <1>;
+#size-cells = <0>;
+reg = <0>;
+anx6345_in_tcon0: endpoint@0 {
+  reg = <0>;
+  remote-endpoint = <_out_anx6345>;
+};
+  };
+
+  anx6345_out: port@1 {
+#address-cells = <1>;
+#size-cells = <0>;
+reg = <1>;
+anx6345_out_panel: endpoint@0 {
+  reg = <0>;
+  remote-endpoint = <_in_edp>;
+};
+  };
+};
+  };
+};
-- 
2.16.4

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

Re: [PATCH v4 1/2] dt-bindings: backlight: lm3630a: add enable_gpios

2019-10-30 Thread Andreas Kemnade
Hi,

On Mon, 28 Oct 2019 18:25:56 -0500
Rob Herring  wrote:

> On Thu, Sep 12, 2019 at 4:33 PM Andreas Kemnade  wrote:
> >
> > add enable-gpios to describe HWEN pin
> >
> > Signed-off-by: Andreas Kemnade 
> > Acked-by: Daniel Thompson   
> 
> This breaking linux-next now...
> 
oops, sorry. 

> > ---
> > changes in v2: added example
> > changes in v3: added Acked-by
> > changes in v4: moved enable-gpios to the right position
> >   in the example
> >  .../bindings/leds/backlight/lm3630a-backlight.yaml   | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml 
> > b/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml
> > index dc129d9a329e..c8470628fe02 100644
> > --- 
> > a/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml
> > +++ 
> > b/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml
> > @@ -29,6 +29,10 @@ properties:
> >'#size-cells':
> >  const: 0
> >
> > +  enable-gpios:
> > +description: GPIO to use to enable/disable the backlight (HWEN pin).
> > +maxItems: 1
> > +
> >  required:
> >- compatible
> >- reg
> > @@ -96,6 +100,7 @@ examples:
> >  led-controller@38 {
> >  compatible = "ti,lm3630a";
> >  reg = <0x38>;
> > +enable-gpios = < 5 GPIO_ACTIVE_HIGH>;  
> 
> Error: 
> Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.example.dts:24.46-47
> syntax error
> FATAL ERROR: Unable to parse input tree
> make[1]: *** 
> [Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.example.dt.yaml]
> Error 1
> scripts/Makefile.lib:314: recipe for target
> 'Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.example.dt.yaml'
> failed
> 
> You need the include for the define.

gpio/gpio.h is missing.
Yes, was not aware of that these things will be compiled and the automatic
check did not work on my system at all. So I decided not to fix that for just
this simple thing which was a not so good idea.
Will send a fixup.

Regards,
Andreas


pgpK_PlxUAPL4.pgp
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2 13/15] drm/amdgpu: Use mmu_range_insert instead of hmm_mirror

2019-10-30 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 10:14:29PM +, Kuehling, Felix wrote:

> > +static const struct mmu_range_notifier_ops amdgpu_mn_hsa_ops = {
> > +   .invalidate = amdgpu_mn_invalidate_hsa,
> > +};
> > +
> > +static int amdgpu_mn_sync_pagetables(struct hmm_mirror *mirror,
> > +const struct mmu_notifier_range *update)
> >   {
> > struct amdgpu_mn *amn = container_of(mirror, struct amdgpu_mn, mirror);
> > -   unsigned long start = update->start;
> > -   unsigned long end = update->end;
> > -   bool blockable = mmu_notifier_range_blockable(update);
> > -   struct interval_tree_node *it;
> >   
> > -   /* notification is exclusive, but interval is inclusive */
> > -   end -= 1;
> > -
> > -   if (amdgpu_mn_read_lock(amn, blockable))
> > -   return -EAGAIN;
> > -
> > -   it = interval_tree_iter_first(>objects, start, end);
> > -   while (it) {
> > -   struct amdgpu_mn_node *node;
> > -   struct amdgpu_bo *bo;
> > -
> > -   if (!blockable) {
> > -   amdgpu_mn_read_unlock(amn);
> > -   return -EAGAIN;
> > -   }
> > -
> > -   node = container_of(it, struct amdgpu_mn_node, it);
> > -   it = interval_tree_iter_next(it, start, end);
> > -
> > -   list_for_each_entry(bo, >bos, mn_list) {
> > -   struct kgd_mem *mem = bo->kfd_bo;
> > -
> > -   if (amdgpu_ttm_tt_affect_userptr(bo->tbo.ttm,
> > -start, end))
> > -   amdgpu_amdkfd_evict_userptr(mem, amn->mm);
> > -   }
> > -   }
> > -
> > -   amdgpu_mn_read_unlock(amn);
> > +   if (!mmu_notifier_range_blockable(update))
> > +   return false;
> 
> This should return -EAGAIN. Not sure it matters much, because this whole 
> function disappears in the next commit in the series. It seems to be 
> only vestigial at this point.

Right, the only reason it is still here is that I couldn't really tell
if this:

> > +   down_read(>lock);
> > +   up_read(>lock);
> > return 0;
> >   }

Was serving as the 'driver lock' in the hmm scheme... If not then the
whole thing should just be deleted at this point.

I fixed the EAGAIN though

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

Re: [PATCH v3] drm/tegra: Do not use ->load() and ->unload() callbacks

2019-10-30 Thread Dmitry Osipenko
28.10.2019 15:16, Thierry Reding пишет:
> From: Thierry Reding 
> 
> The ->load() and ->unload() drivers are midlayers and should be avoided
> in modern drivers. Fix this by moving the code into the driver ->probe()
> and ->remove() implementations, respectively.
> 
> v2: kick out conflicting framebuffers before initializing fbdev
> v3: rebase onto drm/tegra/for-next
> 
> Signed-off-by: Thierry Reding 
> ---
>  drivers/gpu/drm/tegra/drm.c | 321 +---
>  1 file changed, 154 insertions(+), 167 deletions(-)

Hello Thierry,

I tried a bit harder and managed to get simple-framebuffer working, the
bootloader's FB handover works fine for me before and after this patch.
Thanks!

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

[PATCH v4 5/7] drm/bridge: Add Analogix anx6345 support

2019-10-30 Thread Torsten Duwe
From: Icenowy Zheng 

The ANX6345 is an ultra-low power DisplayPower/eDP transmitter designed
for portable devices. This driver adds initial support for RGB to eDP
mode, without HPD and interrupts.

This is a configuration usually seen in eDP applications.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
Signed-off-by: Torsten Duwe 
---
 drivers/gpu/drm/bridge/analogix/Kconfig|  12 +
 drivers/gpu/drm/bridge/analogix/Makefile   |   1 +
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 793 +
 3 files changed, 806 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c

diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index 29ba1b21019e..1425a96a28c3 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,6 +1,18 @@
 # SPDX-License-Identifier: GPL-2.0-only
+config DRM_ANALOGIX_ANX6345
+   tristate "Analogix ANX6345 bridge"
+   select DRM_ANALOGIX_DP
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ ANX6345 is an ultra-low Full-HD DisplayPort/eDP
+ transmitter designed for portable devices. The
+ ANX6345 transforms the LVTTL RGB output of an
+ application processor to eDP or DisplayPort.
+
 config DRM_ANALOGIX_ANX78XX
tristate "Analogix ANX78XX bridge"
+   select DRM_ANALOGIX_DP
select DRM_KMS_HELPER
select REGMAP_I2C
help
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index 7623b9b80167..97669b374098 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
new file mode 100644
index ..af09a61eb472
--- /dev/null
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -0,1 +1,793 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright(c) 2016, Analogix Semiconductor.
+ * Copyright(c) 2017, Icenowy Zheng 
+ *
+ * Based on anx7808 driver obtained from chromeos with copyright:
+ * Copyright(c) 2013, Google Inc.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "analogix-i2c-dptx.h"
+#include "analogix-i2c-txcommon.h"
+
+#define POLL_DELAY 5 /* us */
+#define POLL_TIMEOUT   500 /* us */
+
+#define I2C_IDX_DPTX   0
+#define I2C_IDX_TXCOM  1
+
+static const u8 anx6345_i2c_addresses[] = {
+   [I2C_IDX_DPTX]  = ANALOGIX_I2C_DPTX,
+   [I2C_IDX_TXCOM] = ANALOGIX_I2C_TXCOMMON,
+};
+#define I2C_NUM_ADDRESSES  ARRAY_SIZE(anx6345_i2c_addresses)
+
+struct anx6345 {
+   struct drm_dp_aux aux;
+   struct drm_bridge bridge;
+   struct i2c_client *client;
+   struct edid *edid;
+   struct drm_connector connector;
+   struct drm_dp_link link;
+   struct drm_panel *panel;
+   struct regulator *dvdd12;
+   struct regulator *dvdd25;
+   struct gpio_desc *gpiod_reset;
+   struct mutex lock;  /* protect EDID access */
+
+   /* I2C Slave addresses of ANX6345 are mapped as DPTX and SYS */
+   struct i2c_client *i2c_clients[I2C_NUM_ADDRESSES];
+   struct regmap *map[I2C_NUM_ADDRESSES];
+
+   u16 chipid;
+   u8 dpcd[DP_RECEIVER_CAP_SIZE];
+
+   bool powered;
+};
+
+static inline struct anx6345 *connector_to_anx6345(struct drm_connector *c)
+{
+   return container_of(c, struct anx6345, connector);
+}
+
+static inline struct anx6345 *bridge_to_anx6345(struct drm_bridge *bridge)
+{
+   return container_of(bridge, struct anx6345, bridge);
+}
+
+static int anx6345_set_bits(struct regmap *map, u8 reg, u8 mask)
+{
+   return regmap_update_bits(map, reg, mask, mask);
+}
+
+static int anx6345_clear_bits(struct regmap *map, u8 reg, u8 mask)
+{
+   return regmap_update_bits(map, reg, mask, 0);
+}
+
+static ssize_t anx6345_aux_transfer(struct drm_dp_aux *aux,
+   struct drm_dp_aux_msg *msg)
+{
+   struct anx6345 *anx6345 = container_of(aux, struct anx6345, aux);
+
+   return anx_dp_aux_transfer(anx6345->map[I2C_IDX_DPTX], msg);
+}
+
+static int anx6345_dp_link_training(struct anx6345 *anx6345)
+{
+   unsigned int value;
+   u8 dp_bw;
+   int err;
+
+   err = anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM],
+SP_POWERDOWN_CTRL_REG,
+

[PATCH v4] drm/panfrost: fix -Wmissing-prototypes warnings

2019-10-30 Thread Yi Wang
We get these warnings when build kernel W=1:
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:35:6: warning: no previous 
prototype for ‘panfrost_perfcnt_clean_cache_done’ [-Wmissing-prototypes]
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:40:6: warning: no previous 
prototype for ‘panfrost_perfcnt_sample_done’ [-Wmissing-prototypes]
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:190:5: warning: no previous 
prototype for ‘panfrost_ioctl_perfcnt_enable’ [-Wmissing-prototypes]
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:218:5: warning: no previous 
prototype for ‘panfrost_ioctl_perfcnt_dump’ [-Wmissing-prototypes]
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:250:6: warning: no previous 
prototype for ‘panfrost_perfcnt_close’ [-Wmissing-prototypes]
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:264:5: warning: no previous 
prototype for ‘panfrost_perfcnt_init’ [-Wmissing-prototypes]
drivers/gpu/drm/panfrost/panfrost_perfcnt.c:320:6: warning: no previous 
prototype for ‘panfrost_perfcnt_fini’ [-Wmissing-prototypes]
drivers/gpu/drm/panfrost/panfrost_mmu.c:227:6: warning: no previous prototype 
for ‘panfrost_mmu_flush_range’ [-Wmissing-prototypes]
drivers/gpu/drm/panfrost/panfrost_mmu.c:435:5: warning: no previous prototype 
for ‘panfrost_mmu_map_fault_addr’ [-Wmissing-prototypes]

For file panfrost_mmu.c, make functions static to fix this.
For file panfrost_perfcnt.c, include header file can fix this.

Signed-off-by: Yi Wang 
Reviewed-by: Steven Price 
---

v4: make the parameters aligned.

v3: using tab size of 8 other than 4.

v2: align parameter line and modify comment. Thanks to Steve.
---
 drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 +
 drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c 
b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index bdd9905..87e7963 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -224,9 +224,9 @@ static size_t get_pgsize(u64 addr, size_t size)
return SZ_2M;
 }
 
-void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
- struct panfrost_mmu *mmu,
- u64 iova, size_t size)
+static void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
+struct panfrost_mmu *mmu,
+u64 iova, size_t size)
 {
if (mmu->as < 0)
return;
@@ -432,7 +432,8 @@ void panfrost_mmu_pgtable_free(struct panfrost_file_priv 
*priv)
 
 #define NUM_FAULT_PAGES (SZ_2M / PAGE_SIZE)
 
-int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as, u64 
addr)
+static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
+  u64 addr)
 {
int ret, i;
struct panfrost_gem_object *bo;
diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c 
b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
index 83c57d3..2dba192 100644
--- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
+++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
@@ -16,6 +16,7 @@
 #include "panfrost_issues.h"
 #include "panfrost_job.h"
 #include "panfrost_mmu.h"
+#include "panfrost_perfcnt.h"
 #include "panfrost_regs.h"
 
 #define COUNTERS_PER_BLOCK 64
-- 
1.8.3.1

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

Re: [PATCH v2 02/15] mm/mmu_notifier: add an interval tree notifier

2019-10-30 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 10:04:45PM +, Kuehling, Felix wrote:

> >* because mm->mm_users > 0 during mmu_notifier_register and exit_mmap
> > @@ -52,17 +286,24 @@ struct mmu_notifier_mm {
> >* can't go away from under us as exit_mmap holds an mm_count pin
> >* itself.
> >*/
> > -void __mmu_notifier_release(struct mm_struct *mm)
> > +static void mn_hlist_release(struct mmu_notifier_mm *mmn_mm,
> > +struct mm_struct *mm)
> >   {
> > struct mmu_notifier *mn;
> > int id;
> >   
> > +   if (mmn_mm->has_interval)
> > +   mn_itree_release(mmn_mm, mm);
> > +
> > +   if (hlist_empty(_mm->list))
> > +   return;
> 
> This seems to duplicate the conditions in __mmu_notifier_release. See my 
> comments below, I think one of them is wrong. I suspect this one, 
> because __mmu_notifier_release follows the same pattern as the other 
> notifiers.

Yep, this is a rebasing error from a earlier version, the above two
lines should be deleted.

I think it is harmless so it should not impact any testing.

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

[PATCH v4 7/7] arm64: dts: allwinner: a64: enable ANX6345 bridge on Teres-I

2019-10-30 Thread Torsten Duwe
Teres-I has an anx6345 bridge connected to the RGB666 LCD output, and
the I2C controlling signals are connected to I2C0 bus.

Enable it in the device tree, and enable the display engine, video mixer
and tcon0 as well.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Torsten Duwe 
---
 .../boot/dts/allwinner/sun50i-a64-teres-i.dts  | 45 --
 1 file changed, 41 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
index 1069e7012c9c..970415106dcf 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
@@ -100,18 +100,41 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
 
 
-/* The ANX6345 eDP-bridge is on i2c0. There is no linux (mainline)
- * driver for this chip at the moment, the bootloader initializes it.
- * However it can be accessed with the i2c-dev driver from user space.
- */
  {
clock-frequency = <10>;
status = "okay";
+
+   anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_dldo3>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   anx6345_in: endpoint {
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
  {
@@ -319,6 +342,20 @@
status = "okay";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_rgb666_pins>;
+
+   status = "okay";
+};
+
+_out {
+   tcon0_out_anx6345: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in>;
+   };
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
2.16.4

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

Re: [PATCH] fbdev: potential information leak in do_fb_ioctl()

2019-10-30 Thread Eric W. Biederman
Dan Carpenter  writes:

> The "fix" struct has a 2 byte hole after ->ywrapstep and the
> "fix = info->fix;" assignment doesn't necessarily clear it.  It depends
> on the compiler.
>
> Fixes: 1f5e31d7e55a ("fbmem: don't call copy_from/to_user() with mutex held")
> Signed-off-by: Dan Carpenter 
> ---
> I have 13 more similar places to patch...  I'm not totally sure I
> understand all the issues involved.

What I have done in a similar situation with struct siginfo, is that
where the structure first appears I have initialized it with memset,
and then field by field.

Then when the structure is copied I copy the structure with memcpy.

That ensures all of the bytes in the original structure are initialized
and that all of the bytes are copied.

The goal is to avoid memory that has values of the previous users of
that memory region from leaking to userspace.  Which depending on who
the previous user of that memory region is could tell userspace
information about what the kernel is doing that it should not be allowed
to find out.

I tried to trace through where "info" and thus presumably "info->fix" is
coming from and only made it as far as  register_framebuffer.  Given
that I suspect a local memset, and then a field by field copy right
before copy_to_user might be a sound solution.  But ick.  That is a lot
of fields to copy.


Eric



>  drivers/video/fbdev/core/fbmem.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/video/fbdev/core/fbmem.c 
> b/drivers/video/fbdev/core/fbmem.c
> index 6f6fc785b545..b4ce6a28aed9 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1109,6 +1109,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned 
> int cmd,
>   ret = -EFAULT;
>   break;
>   case FBIOGET_FSCREENINFO:
> + memset(, 0, sizeof(fix));
>   lock_fb_info(info);
>   fix = info->fix;
>   if (info->flags & FBINFO_HIDE_SMEM_START)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v4 0/7] Add anx6345 DP/eDP bridge for Olimex Teres-I

2019-10-30 Thread Torsten Duwe

ANX6345 LVTTL->eDP video bridge, driver with device tree bindings.
Long time, few but important changes.

Changes since v3:

* converted binding schema file to json-schema ("YAML")
  It now validates (itself and the dts) like a charm ;-)
  Input port0 is mandatory, output port1 is optional.

* Enric Balletbo i Serra waived analogix-anx6345 module ownership to icenowy
  
  Since they both agree, I won't interfere.

Changes from v2:

* use SPDX-IDs throughout

* removed the panel output again, as it was not what Maxime had in mind.
  At least the Teres-I does very well without.

* binding clarifications and cosmetic changes as suggested by Andrzej

Changes from v1:

* fixed up copyright information. Most code changes are only moves and thus
  retain copyright and module ownership. Even the new analogix-anx6345.c 
originates
  from the old 1495-line analogix-anx78xx.c, with 306 insertions and 987 
deletions
  (ignoring the trivial anx78xx -> anx6345 replacements) 306 new vs. 508 old...

* fixed all minor formatting issues brought up

* merged previously separate new analogix_dp_i2c module into existing 
analogix_dp

* split additional defines into a preparatory patch

* renamed the factored-out common functions anx_aux_* -> anx_dp_aux_*, because
  anx_...aux_transfer was exported globally. Besides, it is now GPL-only 
exported.

* moved chip ID read into a separate function.

* keep the chip powered after a successful probe.
  (There's a good chance that this is the only display during boot!)

* updated the binding document: LVTTL input is now required, only the output 
side
  description is optional.

 Laurent: I have also looked into the drm_panel_bridge infrastructure,
 but it's not that trivial to convert these drivers to it.

Changes from the respective previous versions:

* the reset polarity is corrected in DT and the driver;
  things should be clearer now.

* as requested, add a panel (the known innolux,n116bge) and connect
  the ports.

* renamed dvdd?? to *-supply to match the established scheme

* trivial update to the #include list, to make it compile in 5.2


Icenowy Zheng (4):
  drm/bridge: move ANA78xx driver to analogix subdirectory
  drm/bridge: split some definitions of ANX78xx to dedicated headers
  drm/bridge: extract some Analogix I2C DP common code
  drm/bridge: Add Analogix anx6345 support

Torsten Duwe (3):
  drm/bridge: Prepare Analogix anx6345 support
  dt-bindings: Add ANX6345 DP/eDP transmitter binding
  arm64: dts: allwinner: a64: enable ANX6345 bridge on Teres-I

 .../bindings/display/bridge/anx6345.yaml   |  92 +++
 .../boot/dts/allwinner/sun50i-a64-teres-i.dts  |  45 +-
 drivers/gpu/drm/bridge/Kconfig |  10 -
 drivers/gpu/drm/bridge/Makefile|   4 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.h  | 710 --
 drivers/gpu/drm/bridge/analogix/Kconfig|  22 +
 drivers/gpu/drm/bridge/analogix/Makefile   |   4 +-
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 793 +
 .../drm/bridge/{ => analogix}/analogix-anx78xx.c   | 146 +---
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h | 255 +++
 .../gpu/drm/bridge/analogix/analogix-i2c-dptx.c| 165 +
 .../gpu/drm/bridge/analogix/analogix-i2c-dptx.h| 258 +++
 .../drm/bridge/analogix/analogix-i2c-txcommon.h| 236 ++
 13 files changed, 1868 insertions(+), 872 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/anx6345.yaml
 delete mode 100644 drivers/gpu/drm/bridge/analogix-anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (90%)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h

-- 
2.16.4

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

Re:[PATCH v3] drm/panfrost: fix -Wmissing-prototypes warnings

2019-10-30 Thread wang.yi59
> On Mon, Oct 28, 2019 at 09:27:33AM +, wang.y...@zte.com.cn wrote:
> > Hi Steve,
> >
> > Thanks a lot for your time and patience :)
> >
> > > On 25/10/2019 02:30, Yi Wang wrote:
> > > > We get these warnings when build kernel W=1:
> > > > drivers/gpu/drm/panfrost/panfrost_perfcnt.c:35:6: warning: no previous 
> > > > prototype for ‘panfrost_perfcnt_clean_cache_done’ [-Wmissing-prototypes]
> > > > drivers/gpu/drm/panfrost/panfrost_perfcnt.c:40:6: warning: no previous 
> > > > prototype for ‘panfrost_perfcnt_sample_done’ [-Wmissing-prototypes]
> > > > drivers/gpu/drm/panfrost/panfrost_perfcnt.c:190:5: warning: no previous 
> > > > prototype for ‘panfrost_ioctl_perfcnt_enable’ [-Wmissing-prototypes]
> > > > drivers/gpu/drm/panfrost/panfrost_perfcnt.c:218:5: warning: no previous 
> > > > prototype for ‘panfrost_ioctl_perfcnt_dump’ [-Wmissing-prototypes]
> > > > drivers/gpu/drm/panfrost/panfrost_perfcnt.c:250:6: warning: no previous 
> > > > prototype for ‘panfrost_perfcnt_close’ [-Wmissing-prototypes]
> > > > drivers/gpu/drm/panfrost/panfrost_perfcnt.c:264:5: warning: no previous 
> > > > prototype for ‘panfrost_perfcnt_init’ [-Wmissing-prototypes]
> > > > drivers/gpu/drm/panfrost/panfrost_perfcnt.c:320:6: warning: no previous 
> > > > prototype for ‘panfrost_perfcnt_fini’ [-Wmissing-prototypes]
> > > > drivers/gpu/drm/panfrost/panfrost_mmu.c:227:6: warning: no previous 
> > > > prototype for ‘panfrost_mmu_flush_range’ [-Wmissing-prototypes]
> > > > drivers/gpu/drm/panfrost/panfrost_mmu.c:435:5: warning: no previous 
> > > > prototype for ‘panfrost_mmu_map_fault_addr’ [-Wmissing-prototypes]
> > > >
> > > > For file panfrost_mmu.c, make functions static to fix this.
> > > > For file panfrost_perfcnt.c, include header file can fix this.
> > > >
> > > > Signed-off-by: Yi Wang 
> > > > Reviewed-by: Steven Price 
> > > > ---
> > > >
> > > > v3: using tab size of 8 other than 4.
> > > >
> > > > v2: align parameter line and modify comment. Thanks to Steve.
> > > > ---
> > > >  drivers/gpu/drm/panfrost/panfrost_mmu.c | 9 +
> > > >  drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 1 +
> > > >  2 files changed, 6 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c 
> > > > b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> > > > index bdd9905..871574c 100644
> > > > --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
> > > > +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> > > > @@ -224,9 +224,9 @@ static size_t get_pgsize(u64 addr, size_t size)
> > > >  return SZ_2M;
> > > >  }
> > > >
> > > > -void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
> > > > -  struct panfrost_mmu *mmu,
> > > > -  u64 iova, size_t size)
> > > > +static void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
> > > > +struct panfrost_mmu *mmu,
> > > > +u64 iova, size_t size)
> > >
> > > Ok, I'll admit I wouldn't have spotted this unless I'd double checked by
> > > applying the patch, but you still seem to have something misconfigured
> > > in your editor. This is out by one character:
> > >
> > > static void panfrost_mmu_flush_range(struct panfrost_device *pfdev,
> > > >--->--->--->---struct panfrost_mmu *mmu,
> > > >--->--->--->---u64 iova, size_t size)
> > >
> > > There should be an extra space to align correctly.
> >
> > According to [Linux kernel coding 
> > style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html):
> > > Outside of comments, documentation and except in Kconfig, spaces are
> > > never used for indentation, and the above example is deliberately broken.
> >
> > If I understand corretly, the tab is enough for indentation :-)
>
> There's a (subtle) difference between indentation and alignment.
> Indentation is where the code is moved over because it is contained
> within an outer statement (e.g. an 'if' or 'while'). The Linux coding
> style is that this should be done with only tabs as you quote.

Ok, I got it.

>
> However when the line is a continuation of the previous line, like in
> the example here, then we often need a combination of tabs/spaces to
> align correctly. The desire here is that the continuation lines all
> start straight after the "(" on the first line. Since that is 37
> characters from the start we need 4 tabs + 5 spaces (4*8+5=37), whereas
> you had 4 tabs + 4 spaces. My guess is this is because you've got the
> following vim configuration:
>
>  tabstop = 8
>  softtabstop = 4
>  noexpandtab
>
> This means that pressing  moves you along only 4 columns (i.e.
> inserts 4 spaces), a second  will then replace the spaces with a
> real tab character (i.e. move another 4 columns for a total of 8).
>
> It's probably best to set "softtabstop = 0" so that  always inserts
> a real tab character. You might also find it useful to make tabs
> visible:
>
>  set list
>  set listchars=tab:>-
>
> That way you can easily see where you 

[PATCH v4 2/7] drm/bridge: split some definitions of ANX78xx to dedicated headers

2019-10-30 Thread Torsten Duwe
From: Icenowy Zheng 

Some definitions currently in analogix-anx78xx.h are not restricted to
the ANX78xx series, but also applicable to other DisplayPort
transmitters by Analogix.

Split out them to dedicated headers, and make analogix-anx78xx.h include
them.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
Signed-off-by: Torsten Duwe 
Reviewed-by: Andrzej Hajda 
---
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h | 465 +
 .../gpu/drm/bridge/analogix/analogix-i2c-dptx.h| 247 +++
 .../drm/bridge/analogix/analogix-i2c-txcommon.h| 233 +++
 3 files changed, 485 insertions(+), 460 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
index 25e063bcecbc..be68afc955c9 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
@@ -2,13 +2,15 @@
 /*
  * Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
  */
-
 #ifndef __ANX78xx_H
 #define __ANX78xx_H
 
-#define TX_P0  0x70
+#include "analogix-i2c-dptx.h"
+#include "analogix-i2c-txcommon.h"
+
+#define TX_P0  ANALOGIX_I2C_DPTX
 #define TX_P1  0x7a
-#define TX_P2  0x72
+#define TX_P2  ANALOGIX_I2C_TXCOMMON
 
 #define RX_P0  0x7e
 #define RX_P1  0x80
@@ -216,463 +218,6 @@
 #define SP_CLEAR_AVMUTEBIT(4)
 #define SP_SET_AVMUTE  BIT(0)
 
-/***/
-/* Register definition of device address 0x70  */
-/***/
-
-/* HDCP Status Register */
-#define SP_TX_HDCP_STATUS_REG  0x00
-#define SP_AUTH_FAIL   BIT(5)
-#define SP_AUTHEN_PASS BIT(1)
-
-/* HDCP Control Register 0 */
-#define SP_HDCP_CTRL0_REG  0x01
-#define SP_RX_REPEATER BIT(6)
-#define SP_RE_AUTH BIT(5)
-#define SP_SW_AUTH_OK  BIT(4)
-#define SP_HARD_AUTH_ENBIT(3)
-#define SP_HDCP_ENC_EN BIT(2)
-#define SP_BKSV_SRM_PASS   BIT(1)
-#define SP_KSVLIST_VLD BIT(0)
-/* HDCP Function Enabled */
-#define SP_HDCP_FUNCTION_ENABLED   (BIT(0) | BIT(1) | BIT(2) | BIT(3))
-
-/* HDCP Receiver BSTATUS Register 0 */
-#defineSP_HDCP_RX_BSTATUS0_REG 0x1b
-/* HDCP Receiver BSTATUS Register 1 */
-#defineSP_HDCP_RX_BSTATUS1_REG 0x1c
-
-/* HDCP Embedded "Blue Screen" Content Registers */
-#define SP_HDCP_VID0_BLUE_SCREEN_REG   0x2c
-#define SP_HDCP_VID1_BLUE_SCREEN_REG   0x2d
-#define SP_HDCP_VID2_BLUE_SCREEN_REG   0x2e
-
-/* HDCP Wait R0 Timing Register */
-#define SP_HDCP_WAIT_R0_TIME_REG   0x40
-
-/* HDCP Link Integrity Check Timer Register */
-#define SP_HDCP_LINK_CHECK_TIMER_REG   0x41
-
-/* HDCP Repeater Ready Wait Timer Register */
-#define SP_HDCP_RPTR_RDY_WAIT_TIME_REG 0x42
-
-/* HDCP Auto Timer Register */
-#define SP_HDCP_AUTO_TIMER_REG 0x51
-
-/* HDCP Key Status Register */
-#define SP_HDCP_KEY_STATUS_REG 0x5e
-
-/* HDCP Key Command Register */
-#define SP_HDCP_KEY_COMMAND_REG0x5f
-#define SP_DISABLE_SYNC_HDCP   BIT(2)
-
-/* OTP Memory Key Protection Registers */
-#define SP_OTP_KEY_PROTECT1_REG0x60
-#define SP_OTP_KEY_PROTECT2_REG0x61
-#define SP_OTP_KEY_PROTECT3_REG0x62
-#define SP_OTP_PSW10xa2
-#define SP_OTP_PSW20x7e
-#define SP_OTP_PSW30xc6
-
-/* DP System Control Registers */
-#define SP_DP_SYSTEM_CTRL_BASE (0x80 - 1)
-/* Bits for DP System Control Register 2 */
-#define SP_CHA_STA BIT(2)
-/* Bits for DP System Control Register 3 */
-#define SP_HPD_STATUS  BIT(6)
-#define SP_STRM_VALID  BIT(2)
-/* Bits for DP System Control Register 4 */
-#define SP_ENHANCED_MODE   BIT(3)
-
-/* DP Video Control Register */
-#define SP_DP_VIDEO_CTRL_REG   0x84
-#define SP_COLOR_F_MASK0x06
-#define SP_COLOR_F_SHIFT   1
-#define SP_BPC_MASK0xe0
-#define SP_BPC_SHIFT   5
-#  define SP_BPC_6BITS 0x00
-#  define SP_BPC_8BITS 0x01
-#  define SP_BPC_10BITS0x02
-#  define SP_BPC_12BITS0x03
-
-/* DP Audio Control Register */
-#define SP_DP_AUDIO_CTRL_REG   0x87
-#define SP_AUD_EN  BIT(0)
-
-/* 10us Pulse Generate Timer Registers */
-#define 

[RESEND PATCH 2/2] drm: bridge: adv7511: Extend list of audio sample rates

2019-10-30 Thread Bogdan Togorean
ADV7511 support sample rates up to 192kHz. CTS and N parameters should
be computed accordingly so this commit extend the list up to maximum
supported sample rate.

Signed-off-by: Bogdan Togorean 
---
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c 
b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index 1e9b128d229b..13e8cee6e827 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -27,6 +27,18 @@ static void adv7511_calc_cts_n(unsigned int f_tmds, unsigned 
int fs,
case 48000:
*n = 6144;
break;
+   case 88200:
+   *n = 12544;
+   break;
+   case 96000:
+   *n = 12288;
+   break;
+   case 176400:
+   *n = 25088;
+   break;
+   case 192000:
+   *n = 24576;
+   break;
}
 
*cts = ((f_tmds * *n) / (128 * fs)) * 1000;
-- 
2.23.0

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

Re: [PATCH v2] kernel-doc: rename the kernel-doc directive 'functions' to 'identifiers'

2019-10-30 Thread Changbin Du
On Mon, Oct 28, 2019 at 11:24:22AM +0200, Jani Nikula wrote:
> On Fri, 25 Oct 2019, Changbin Du  wrote:
> > On Fri, Oct 25, 2019 at 09:57:48AM +0300, Jani Nikula wrote:
> >> On Thu, 24 Oct 2019, Jonathan Corbet  wrote:
> >> > On Sun, 20 Oct 2019 21:17:17 +0800
> >> > Changbin Du  wrote:
> >> >
> >> >> The 'functions' directive is not only for functions, but also works for
> >> >> structs/unions. So the name is misleading. This patch renames it to
> >> >> 'identifiers', which specific the functions/types to be included in
> >> >> documentation. We keep the old name as an alias of the new one before
> >> >> all documentation are updated.
> >> >> 
> >> >> Signed-off-by: Changbin Du 
> >> >
> >> > So I think this is basically OK, but I have one more request...
> >> >
> >> > [...]
> >> >
> >> >> diff --git a/Documentation/sphinx/kerneldoc.py 
> >> >> b/Documentation/sphinx/kerneldoc.py
> >> >> index 1159405cb920..0689f9c37f1e 100644
> >> >> --- a/Documentation/sphinx/kerneldoc.py
> >> >> +++ b/Documentation/sphinx/kerneldoc.py
> >> >> @@ -59,9 +59,10 @@ class KernelDocDirective(Directive):
> >> >>  optional_arguments = 4
> >> >>  option_spec = {
> >> >>  'doc': directives.unchanged_required,
> >> >> -'functions': directives.unchanged,
> >> >>  'export': directives.unchanged,
> >> >>  'internal': directives.unchanged,
> >> >> +'identifiers': directives.unchanged,
> >> >> +'functions': directives.unchanged,  # alias of 'identifiers'
> >> >>  }
> >> >>  has_content = False
> >> >>  
> >> >> @@ -71,6 +72,7 @@ class KernelDocDirective(Directive):
> >> >>  
> >> >>  filename = env.config.kerneldoc_srctree + '/' + 
> >> >> self.arguments[0]
> >> >>  export_file_patterns = []
> >> >> +identifiers = None
> >> >>  
> >> >>  # Tell sphinx of the dependency
> >> >>  env.note_dependency(os.path.abspath(filename))
> >> >> @@ -86,19 +88,22 @@ class KernelDocDirective(Directive):
> >> >>  export_file_patterns = 
> >> >> str(self.options.get('internal')).split()
> >> >>  elif 'doc' in self.options:
> >> >>  cmd += ['-function', str(self.options.get('doc'))]
> >> >> +elif 'identifiers' in self.options:
> >> >> +identifiers = self.options.get('identifiers').split()
> >> >>  elif 'functions' in self.options:
> >> >> -functions = self.options.get('functions').split()
> >> >> -if functions:
> >> >> -for f in functions:
> >> >> -cmd += ['-function', f]
> >> >> -else:
> >> >> -cmd += ['-no-doc-sections']
> >> >> +identifiers = self.options.get('functions').split()
> >> >
> >> > Rather than do this, can you just change the elif line to read:
> >> >
> >> > elif ('identifiers' in self.options) or ('functions' in 
> >> > self.options):
> >> >
> >> > ...then leave the rest of the code intact?  It keeps the logic together,
> >> > and avoids the confusing distinction between identifiers=='' and
> >> > identifiers==None .
> >> 
> >> I think the problem is you still need to distinguish between the two for
> >> the get('functions') part.
> >> 
> >> One option is to rename 'functions' to 'identifiers' in the above block,
> >> and put something like this above the whole if ladder (untested):
> >> 
> >> # backward compat
> >> if 'functions' in self.options:
> >> if 'identifiers' in self.options:
> >> kernellog.warn(env.app, "fail")
> > This will miss the content of 'functions' directive if both exist in
> > same doc.
> 
> Did you not notice your patch does the same, except silently, while this
> would produce a warning? Which one is less surprising?
>
yes, my mistake. Mine does the same thing.

> >
> >> else:
> >> self.options.set('identifiers', 
> >> self.options.get('functions'))
> >> 
> >> BR,
> >> Jani.
> >>
> > After comparing, I still perfer my original code which is simpler. :)
> 
> But is it, really? I agree with Jon about the distinction between None
> and '' being confusing.
>
Here python is different from C. Both empty string and None are False in python.
Note such condition is common in python.

Again, I am ok with both.

> 
> BR,
> Jani.
> 
> 
> 
> >
> >> 
> >> -- 
> >> Jani Nikula, Intel Open Source Graphics Center
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

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

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

2019-10-30 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 07:22:37PM +, Yang, Philip wrote:
> Hi Jason,
> 
> I did quick test after merging amd-staging-drm-next with the 
> mmu_notifier branch, which includes this set changes. The test result 
> has different failures, app stuck intermittently, GUI no display etc. I 
> am understanding the changes and will try to figure out the cause.

Thanks! I'm not surprised by this given how difficult this patch was
to make. Let me know if I can assist in any way

Please ensure to run with lockdep enabled.. Your symptops sounds sort
of like deadlocking?

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

Re: [PATCH v2 12/15] drm/amdgpu: Call find_vma under mmap_sem

2019-10-30 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 04:28:43PM +, Kuehling, Felix wrote:
> On 2019-10-28 4:10 p.m., Jason Gunthorpe wrote:
> > From: Jason Gunthorpe 
> >
> > find_vma() must be called under the mmap_sem, reorganize this code to
> > do the vma check after entering the lock.
> >
> > Further, fix the unlocked use of struct task_struct's mm, instead use
> > the mm from hmm_mirror which has an active mm_grab. Also the mm_grab
> > must be converted to a mm_get before acquiring mmap_sem or calling
> > find_vma().
> >
> > Fixes: 66c45500bfdc ("drm/amdgpu: use new HMM APIs and helpers")
> > Fixes: 0919195f2b0d ("drm/amdgpu: Enable amdgpu_ttm_tt_get_user_pages in 
> > worker threads")
> > Cc: Alex Deucher 
> > Cc: Christian König 
> > Cc: David (ChunMing) Zhou 
> > Cc: amd-...@lists.freedesktop.org
> > Signed-off-by: Jason Gunthorpe 
> 
> One question inline to confirm my understanding. Otherwise this patch is
> 
> Reviewed-by: Felix Kuehling 

Thanks

> > -   if (unlikely((gtt->userflags & AMDGPU_GEM_USERPTR_ANONONLY) &&
> > -   vma->vm_file)) {
> > -   r = -EPERM;
> > -   goto out;
> > -   }
> > +   mm = mirror->hmm->mmu_notifier.mm;
> > +   if (!mmget_not_zero(mm)) /* Happens during process shutdown */
> 
> This works because mirror->hmm->mmu_notifier holds an mmgrab reference 
> to the mm?

Yes, this makes sure the mm pointer remains valid

> So the MM will not just go away, but if the mmget refcount is 0, it
> means the mm is marked for destruction and shouldn't be used any
> more.

Not just marked for destruction, but that another thread is
progressing or finished release().

The other detail here is that in general you can't get the mmap_sem
without also having a mmget as exit_mmap() does not lock the mmap_sem
in some places where it alters the datastructures. ie racing
find_vma() with exit_mmap() is not allowed.

This means we have to hold the mmget across the hmm_range_fault(), but
we can drop the mmget and then test mmu_range_read_retry() under the
driver lock. It will return true if the mmget refcount has gone to
zero in the mean time.

But I think this is probably a poor driver design, a driver should
just hold the mmget() until it has completed establishing the shadow
PTEs, as it is hard to see a reason not to..

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

[PATCH next] dt-bindings: backlight: lm3630a: fix missing include

2019-10-30 Thread Andreas Kemnade
example failed to compile due to undefined GPIO_ACTIVE_HIGH
fix that by adding the needed #include to the exammple

Fixes: ae92365cdd75 ("dt-bindings: backlight: lm3630a: Add enable-gpios to 
describe HWEN pin")
Signed-off-by: Andreas Kemnade 
---
 .../devicetree/bindings/leds/backlight/lm3630a-backlight.yaml| 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml 
b/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml
index c8470628fe02..08fe5cf8614a 100644
--- a/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml
+++ b/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml
@@ -93,6 +93,7 @@ additionalProperties: false
 
 examples:
   - |
+#include 
 i2c {
 #address-cells = <1>;
 #size-cells = <0>;
-- 
2.20.1

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

[RESEND PATCH 1/2] drm: bridge: adv7511: Enable SPDIF DAI

2019-10-30 Thread Bogdan Togorean
ADV7511 support I2S or SPDIF as audio input interfaces. This commit
enable support for SPDIF.

Signed-off-by: Bogdan Togorean 
Reviewed-by: Andrzej Hajda 
---
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c 
b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index a428185be2c1..1e9b128d229b 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -119,6 +119,9 @@ int adv7511_hdmi_hw_params(struct device *dev, void *data,
audio_source = ADV7511_AUDIO_SOURCE_I2S;
i2s_format = ADV7511_I2S_FORMAT_LEFT_J;
break;
+   case HDMI_SPDIF:
+   audio_source = ADV7511_AUDIO_SOURCE_SPDIF;
+   break;
default:
return -EINVAL;
}
@@ -175,11 +178,21 @@ static int audio_startup(struct device *dev, void *data)
/* use Audio infoframe updated info */
regmap_update_bits(adv7511->regmap, ADV7511_REG_GC(1),
BIT(5), 0);
+   /* enable SPDIF receiver */
+   if (adv7511->audio_source == ADV7511_AUDIO_SOURCE_SPDIF)
+   regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CONFIG,
+  BIT(7), BIT(7));
+
return 0;
 }
 
 static void audio_shutdown(struct device *dev, void *data)
 {
+   struct adv7511 *adv7511 = dev_get_drvdata(dev);
+
+   if (adv7511->audio_source == ADV7511_AUDIO_SOURCE_SPDIF)
+   regmap_update_bits(adv7511->regmap, ADV7511_REG_AUDIO_CONFIG,
+  BIT(7), 0);
 }
 
 static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
@@ -213,6 +226,7 @@ static const struct hdmi_codec_pdata codec_data = {
.ops = _codec_ops,
.max_i2s_channels = 2,
.i2s = 1,
+   .spdif = 1,
 };
 
 int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511)
-- 
2.23.0

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

[PATCH v4 4/7] drm/bridge: Prepare Analogix anx6345 support

2019-10-30 Thread Torsten Duwe
Add bit definitions required for the anx6345 and add a
sanity check in anx_dp_aux_transfer.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
Signed-off-by: Torsten Duwe 
Reviewed-by: Andrzej Hajda 
---
 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c | 2 +-
 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h | 8 
 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h | 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c 
b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
index 60707bb5afe7..fe40bab21530 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
@@ -116,7 +116,7 @@ ssize_t anx_dp_aux_transfer(struct regmap *map_dptx,
else/* For non-zero-sized set the length field. */
ctrl1 |= (msg->size - 1) << SP_AUX_LENGTH_SHIFT;
 
-   if ((msg->request & DP_AUX_I2C_READ) == 0) {
+   if ((msg->size > 0) && ((msg->request & DP_AUX_I2C_READ) == 0)) {
/* When WRITE | MOT write values to data buffer */
err = regmap_bulk_write(map_dptx,
SP_DP_BUF_DATA0_REG, buffer,
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
index 430a039c10cd..24bc67ac5479 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
@@ -74,7 +74,11 @@
 #define SP_CHA_STA BIT(2)
 /* Bits for DP System Control Register 3 */
 #define SP_HPD_STATUS  BIT(6)
+#define SP_HPD_FORCE   BIT(5)
+#define SP_HPD_CTRLBIT(4)
 #define SP_STRM_VALID  BIT(2)
+#define SP_STRM_FORCE  BIT(1)
+#define SP_STRM_CTRL   BIT(0)
 /* Bits for DP System Control Register 4 */
 #define SP_ENHANCED_MODE   BIT(3)
 
@@ -119,6 +123,9 @@
 #define SP_LINK_BW_SET_MASK0x1f
 #define SP_INITIAL_SLIM_M_AUD_SEL  BIT(5)
 
+/* DP Lane Count Setting Register */
+#define SP_DP_LANE_COUNT_SET_REG   0xa1
+
 /* DP Training Pattern Set Register */
 #define SP_DP_TRAINING_PATTERN_SET_REG 0xa2
 
@@ -132,6 +139,7 @@
 
 /* DP Link Training Control Register */
 #define SP_DP_LT_CTRL_REG  0xa8
+#define SP_DP_LT_INPROGRESS0x80
 #define SP_LT_ERROR_TYPE_MASK  0x70
 #  define SP_LT_NO_ERROR   0x00
 #  define SP_LT_AUX_WRITE_ERROR0x01
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h 
b/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
index c1030e0f74cc..9fa6f426f990 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
@@ -179,6 +179,9 @@
 #define SP_VBITBIT(1)
 #define SP_AUDIO_LAYOUTBIT(0)
 
+/* Analog Debug Register 1 */
+#define SP_ANALOG_DEBUG1_REG   0xdc
+
 /* Analog Debug Register 2 */
 #define SP_ANALOG_DEBUG2_REG   0xdd
 #define SP_FORCE_SW_OFF_BYPASS 0x20
-- 
2.16.4

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

Re: [PATCH V5 4/6] mdev: introduce virtio device and its device ops

2019-10-30 Thread Zhu Lingshan

On 10/29/2019 6:42 PM, Jason Wang wrote:

On 2019/10/29 下午3:42, Zhu Lingshan wrote:

+    void (*set_status)(struct mdev_device *mdev, u8 status);

Hi Jason

Is it possible to make set_status() return an u8 or bool, because this
may fail in real hardware. Without a returned code, I am not sure
whether it is a good idea to set the status | NEED_RESET when fail.

Thanks,
BR
Zhu Lingshan


Hi:


It's possible but I'm not sure whether any user will care about it. E.g
see virtio_add_status():

void virtio_add_status(struct virtio_device *dev, unsigned int status)
{
     might_sleep();
     dev->config->set_status(dev, dev->config->get_status(dev) | status);
}
EXPORT_SYMBOL_GPL(virtio_add_status);

And I believe how it work should be:

virtio_add_status(xyz);

status = virtio_get_status();

if (!(status & xyz))

     error;

Thanks


Thanks Jason, then I believe upper layer can handle this well.



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

[PATCH] drm: amd: amdgpu: Remove NULL check not needed before freeing functions

2019-10-30 Thread Saurav Girepunje
Remove unneeded NULL check before freeing functions
kfree and debugfs_remove.

Signed-off-by: Saurav Girepunje 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index 5652cc72ed3a..cb94627fc0f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -1077,8 +1077,7 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val)
 
ttm_bo_unlock_delayed_workqueue(>mman.bdev, resched);
 
-   if (fences)
-   kfree(fences);
+   kfree(fences);
 
return 0;
 }
@@ -1103,8 +1102,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
 
 void amdgpu_debugfs_preempt_cleanup(struct amdgpu_device *adev)
 {
-   if (adev->debugfs_preempt)
-   debugfs_remove(adev->debugfs_preempt);
+   debugfs_remove(adev->debugfs_preempt);
 }
 
 #else
-- 
2.20.1

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

Re: [PATCH v8 3/6] ASoC: rockchip_max98090: Optionally support HDMI use case

2019-10-30 Thread Cheng-yi Chiang
On Tue, Oct 29, 2019 at 3:10 AM kbuild test robot  wrote:
>
> Hi Cheng-Yi,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on rockchip/for-next]
> [also build test ERROR on v5.4-rc5 next-20191028]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see 
> https://stackoverflow.com/a/37406982]
>
> url:
> https://github.com/0day-ci/linux/commits/Cheng-Yi-Chiang/Add-HDMI-jack-support-on-RK3288/20191028-212502
> base:   
> https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git 
> for-next
> config: i386-allmodconfig (attached as .config)
> compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=i386
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot 
>
> All errors (new ones prefixed by >>):
>
>sound/soc/rockchip/snd-soc-rockchip-max98090: struct of_device_id is 196 
> bytes.  The last of 3 is:
>0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x72 0x6f 0x63 0x6b 0x63 0x68 0x69 0x70 0x2c 0x72 0x6f 
> 0x63 0x6b 0x63 0x68 0x69 0x70 0x2d 0x61 0x75 0x64 0x69 0x6f 0x2d 0x6d 0x61 
> 0x78 0x39 0x38 0x30 0x39 0x30 0x2d 0x68 0x64 0x6d 0x69 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
> 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x10 0x00 0x00 
> 0x00
> >> FATAL: sound/soc/rockchip/snd-soc-rockchip-max98090: struct of_device_id 
> >> is not terminated with a NULL entry!

Please ignore this error for v8 patch series because the change in
rockchip_max98090.c of of_device_id is removed in v9 patch series.
Thanks!

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

Re: [PATCH V5 4/6] mdev: introduce virtio device and its device ops

2019-10-30 Thread Zhu Lingshan


On 10/23/2019 9:07 PM, Jason Wang wrote:

This patch implements basic support for mdev driver that supports
virtio transport for kernel virtio driver.

Signed-off-by: Jason Wang 
---
  drivers/vfio/mdev/mdev_core.c|  20 
  drivers/vfio/mdev/mdev_private.h |   2 +
  include/linux/mdev.h |   6 ++
  include/linux/virtio_mdev_ops.h  | 159 +++
  4 files changed, 187 insertions(+)
  create mode 100644 include/linux/virtio_mdev_ops.h

diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c
index 555bd61d8c38..9b00c3513120 100644
--- a/drivers/vfio/mdev/mdev_core.c
+++ b/drivers/vfio/mdev/mdev_core.c
@@ -76,6 +76,26 @@ const struct vfio_mdev_device_ops *mdev_get_vfio_ops(struct 
mdev_device *mdev)
  }
  EXPORT_SYMBOL(mdev_get_vfio_ops);
  
+/* Specify the virtio device ops for the mdev device, this

+ * must be called during create() callback for virtio mdev device.
+ */
+void mdev_set_virtio_ops(struct mdev_device *mdev,
+const struct virtio_mdev_device_ops *virtio_ops)
+{
+   mdev_set_class(mdev, MDEV_CLASS_ID_VIRTIO);
+   mdev->virtio_ops = virtio_ops;
+}
+EXPORT_SYMBOL(mdev_set_virtio_ops);
+
+/* Get the virtio device ops for the mdev device. */
+const struct virtio_mdev_device_ops *
+mdev_get_virtio_ops(struct mdev_device *mdev)
+{
+   WARN_ON(mdev->class_id != MDEV_CLASS_ID_VIRTIO);
+   return mdev->virtio_ops;
+}
+EXPORT_SYMBOL(mdev_get_virtio_ops);
+
  struct device *mdev_dev(struct mdev_device *mdev)
  {
return >dev;
diff --git a/drivers/vfio/mdev/mdev_private.h b/drivers/vfio/mdev/mdev_private.h
index 0770410ded2a..7b47890c34e7 100644
--- a/drivers/vfio/mdev/mdev_private.h
+++ b/drivers/vfio/mdev/mdev_private.h
@@ -11,6 +11,7 @@
  #define MDEV_PRIVATE_H
  
  #include 

+#include 
  
  int  mdev_bus_register(void);

  void mdev_bus_unregister(void);
@@ -38,6 +39,7 @@ struct mdev_device {
u16 class_id;
union {
const struct vfio_mdev_device_ops *vfio_ops;
+   const struct virtio_mdev_device_ops *virtio_ops;
};
  };
  
diff --git a/include/linux/mdev.h b/include/linux/mdev.h

index 4625f1a11014..9b69b0bbebfd 100644
--- a/include/linux/mdev.h
+++ b/include/linux/mdev.h
@@ -17,6 +17,7 @@
  
  struct mdev_device;

  struct vfio_mdev_device_ops;
+struct virtio_mdev_device_ops;
  
  /*

   * Called by the parent device driver to set the device which represents
@@ -112,6 +113,10 @@ void mdev_set_class(struct mdev_device *mdev, u16 id);
  void mdev_set_vfio_ops(struct mdev_device *mdev,
   const struct vfio_mdev_device_ops *vfio_ops);
  const struct vfio_mdev_device_ops *mdev_get_vfio_ops(struct mdev_device 
*mdev);
+void mdev_set_virtio_ops(struct mdev_device *mdev,
+const struct virtio_mdev_device_ops *virtio_ops);
+const struct virtio_mdev_device_ops *
+mdev_get_virtio_ops(struct mdev_device *mdev);
  
  extern struct bus_type mdev_bus_type;
  
@@ -127,6 +132,7 @@ struct mdev_device *mdev_from_dev(struct device *dev);
  
  enum {

MDEV_CLASS_ID_VFIO = 1,
+   MDEV_CLASS_ID_VIRTIO = 2,
/* New entries must be added here */
  };
  
diff --git a/include/linux/virtio_mdev_ops.h b/include/linux/virtio_mdev_ops.h

new file mode 100644
index ..d417b41f2845
--- /dev/null
+++ b/include/linux/virtio_mdev_ops.h
@@ -0,0 +1,159 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Virtio mediated device driver
+ *
+ * Copyright 2019, Red Hat Corp.
+ * Author: Jason Wang 
+ */
+#ifndef _LINUX_VIRTIO_MDEV_H
+#define _LINUX_VIRTIO_MDEV_H
+
+#include 
+#include 
+#include 
+
+#define VIRTIO_MDEV_DEVICE_API_STRING  "virtio-mdev"
+#define VIRTIO_MDEV_F_VERSION_1 0x1
+
+struct virtio_mdev_callback {
+   irqreturn_t (*callback)(void *data);
+   void *private;
+};
+
+/**
+ * struct vfio_mdev_device_ops - Structure to be registered for each
+ * mdev device to register the device for virtio/vhost drivers.
+ *
+ * The device ops that is supported by VIRTIO_MDEV_F_VERSION_1, the
+ * callbacks are mandatory unless explicity mentioned.
+ *
+ * @set_vq_address:Set the address of virtqueue
+ * @mdev: mediated device
+ * @idx: virtqueue index
+ * @desc_area: address of desc area
+ * @driver_area: address of driver area
+ * @device_area: address of device area
+ * Returns integer: success (0) or error (< 0)
+ * @set_vq_num:Set the size of virtqueue
+ * @mdev: mediated device
+ * @idx: virtqueue index
+ * @num: the size of virtqueue
+ * @kick_vq:   Kick the virtqueue
+ * @mdev: mediated device
+ * @idx: virtqueue index
+ * 

Re: [PATCH v2 06/15] RDMA/hfi1: Use mmu_range_notifier_inset for user_exp_rcv

2019-10-30 Thread Jason Gunthorpe
On Tue, Oct 29, 2019 at 08:19:20AM -0400, Dennis Dalessandro wrote:
> On 10/28/2019 4:10 PM, Jason Gunthorpe wrote:
> > From: Jason Gunthorpe 
> > 
> > This converts one of the two users of mmu_notifiers to use the new API.
> > The conversion is fairly straightforward, however the existing use of
> > notifiers here seems to be racey.
> > 
> > Cc: Mike Marciniszyn 
> > Cc: Dennis Dalessandro 
> > Signed-off-by: Jason Gunthorpe 
> 
> I tested v1, and replied to it [1]. I can re-test with this version if you
> like as well.
> 
> [1] https://marc.info/?l=linux-rdma=157235130606412=2

I think it is fine, nothing really changed in v2, thanks

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

Re: [PATCH] fbdev: potential information leak in do_fb_ioctl()

2019-10-30 Thread Andrea Righi
On Tue, Oct 29, 2019 at 02:02:11PM -0500, Eric W. Biederman wrote:
> Dan Carpenter  writes:
> 
> > The "fix" struct has a 2 byte hole after ->ywrapstep and the
> > "fix = info->fix;" assignment doesn't necessarily clear it.  It depends
> > on the compiler.
> >
> > Fixes: 1f5e31d7e55a ("fbmem: don't call copy_from/to_user() with mutex 
> > held")
> > Signed-off-by: Dan Carpenter 
> > ---
> > I have 13 more similar places to patch...  I'm not totally sure I
> > understand all the issues involved.
> 
> What I have done in a similar situation with struct siginfo, is that
> where the structure first appears I have initialized it with memset,
> and then field by field.
> 
> Then when the structure is copied I copy the structure with memcpy.
> 
> That ensures all of the bytes in the original structure are initialized
> and that all of the bytes are copied.
> 
> The goal is to avoid memory that has values of the previous users of
> that memory region from leaking to userspace.  Which depending on who
> the previous user of that memory region is could tell userspace
> information about what the kernel is doing that it should not be allowed
> to find out.
> 
> I tried to trace through where "info" and thus presumably "info->fix" is
> coming from and only made it as far as  register_framebuffer.  Given
> that I suspect a local memset, and then a field by field copy right
> before copy_to_user might be a sound solution.  But ick.  That is a lot
> of fields to copy.

I know it might sound quite inefficient, but what about making struct
fb_fix_screeninfo __packed?

This doesn't solve other potential similar issues, but for this
particular case it could be a reasonable and simple fix.

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

  1   2   >