[PATCH v4 00/44] dma-mapping: Use unsigned long for dma_attrs

2016-06-10 Thread Krzysztof Kozlowski
Hi,


This is fourth approach for replacing struct dma_attrs with unsigned
long.

The main patch (1/44) doing the change is split into many subpatches
for easier review (2-42).  They should be squashed together when
applying.


*Important:* Patchset is tested on my ARM platforms and *only* build
tested on allyesconfigs: ARM, ARM64, i386, x86_64 and powerpc.
Please kindly provide reviewes and tests for other platforms.

Rebased on next-20160607.

For easier testing the patchset is available here:
repo:   https://github.com/krzk/linux
branch: for-next/dma-attrs-const-v4


Changes since v3

1. Collect some acks.
2. Drop wrong patch 1/45 ("powerpc: dma-mapping: Don't hard-code
   the value of DMA_ATTR_WEAK_ORDERING").
3. Minor fix pointed out by Michael Ellerman.


Changes since v2

1. Follow Christoph Hellwig's comments (don't use BIT add
   documentation, remove dma_get_attr).


Rationale
=
The dma-mapping core and the implementations do not change the
DMA attributes passed by pointer.  Thus the pointer can point to const
data.  However the attributes do not have to be a bitfield. Instead
unsigned long will do fine:

1. This is just simpler.  Both in terms of reading the code and setting
   attributes.  Instead of initializing local attributes on the stack
   and passing pointer to it to dma_set_attr(), just set the bits.

2. It brings safeness and checking for const correctness because the
   attributes are passed by value.


Best regards,
Krzysztof


Krzysztof Kozlowski (44):
  dma-mapping: Use unsigned long for dma_attrs
  alpha: dma-mapping: Use unsigned long for dma_attrs
  arc: dma-mapping: Use unsigned long for dma_attrs
  ARM: dma-mapping: Use unsigned long for dma_attrs
  arm64: dma-mapping: Use unsigned long for dma_attrs
  avr32: dma-mapping: Use unsigned long for dma_attrs
  blackfin: dma-mapping: Use unsigned long for dma_attrs
  c6x: dma-mapping: Use unsigned long for dma_attrs
  cris: dma-mapping: Use unsigned long for dma_attrs
  frv: dma-mapping: Use unsigned long for dma_attrs
  drm/exynos: dma-mapping: Use unsigned long for dma_attrs
  drm/mediatek: dma-mapping: Use unsigned long for dma_attrs
  drm/msm: dma-mapping: Use unsigned long for dma_attrs
  drm/nouveau: dma-mapping: Use unsigned long for dma_attrs
  drm/rockship: dma-mapping: Use unsigned long for dma_attrs
  infiniband: dma-mapping: Use unsigned long for dma_attrs
  iommu: dma-mapping: Use unsigned long for dma_attrs
  [media] dma-mapping: Use unsigned long for dma_attrs
  xen: dma-mapping: Use unsigned long for dma_attrs
  swiotlb: dma-mapping: Use unsigned long for dma_attrs
  powerpc: dma-mapping: Use unsigned long for dma_attrs
  video: dma-mapping: Use unsigned long for dma_attrs
  x86: dma-mapping: Use unsigned long for dma_attrs
  iommu: intel: dma-mapping: Use unsigned long for dma_attrs
  h8300: dma-mapping: Use unsigned long for dma_attrs
  hexagon: dma-mapping: Use unsigned long for dma_attrs
  ia64: dma-mapping: Use unsigned long for dma_attrs
  m68k: dma-mapping: Use unsigned long for dma_attrs
  metag: dma-mapping: Use unsigned long for dma_attrs
  microblaze: dma-mapping: Use unsigned long for dma_attrs
  mips: dma-mapping: Use unsigned long for dma_attrs
  mn10300: dma-mapping: Use unsigned long for dma_attrs
  nios2: dma-mapping: Use unsigned long for dma_attrs
  openrisc: dma-mapping: Use unsigned long for dma_attrs
  parisc: dma-mapping: Use unsigned long for dma_attrs
  misc: mic: dma-mapping: Use unsigned long for dma_attrs
  s390: dma-mapping: Use unsigned long for dma_attrs
  sh: dma-mapping: Use unsigned long for dma_attrs
  sparc: dma-mapping: Use unsigned long for dma_attrs
  tile: dma-mapping: Use unsigned long for dma_attrs
  unicore32: dma-mapping: Use unsigned long for dma_attrs
  xtensa: dma-mapping: Use unsigned long for dma_attrs
  dma-mapping: Remove dma_get_attr
  dma-mapping: Document the DMA attributes next to the declaration

 Documentation/DMA-API.txt  |  33 +++---
 Documentation/DMA-attributes.txt   |   2 +-
 arch/alpha/include/asm/dma-mapping.h   |   2 -
 arch/alpha/kernel/pci-noop.c   |   2 +-
 arch/alpha/kernel/pci_iommu.c  |  12 +-
 arch/arc/mm/dma.c  |  12 +-
 arch/arm/common/dmabounce.c|   4 +-
 arch/arm/include/asm/dma-mapping.h |  13 +--
 arch/arm/include/asm/xen/page-coherent.h   |  16 +--
 arch/arm/mm/dma-mapping.c  | 121 ++-
 arch/arm/xen/mm.c  |   8 +-
 arch/arm64/mm/dma-mapping.c|  67 +--
 arch/avr32/mm/dma-coherent.c   |  12 +-
 arch/blackfin/kernel/dma-mapping.c |   8 +-
 arch/c6x/include/asm/dma-mapping.h |   4 +-
 arch/c6x/kernel/dma.c  |   9 +-
 arch/c6x/mm/dma-coherent.c

[PATCH v4 03/44] arc: dma-mapping: Use unsigned long for dma_attrs

2016-06-10 Thread Krzysztof Kozlowski
Split out subsystem specific changes for easier reviews. This will be
squashed with main commit.

Signed-off-by: Krzysztof Kozlowski 
---
 arch/arc/mm/dma.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 73d7e4c75b7d..3d1f467d1792 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -22,7 +22,7 @@
 
 
 static void *arc_dma_alloc(struct device *dev, size_t size,
-   dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs)
+   dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
 {
unsigned long order = get_order(size);
struct page *page;
@@ -90,7 +90,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 }
 
 static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
-   dma_addr_t dma_handle, struct dma_attrs *attrs)
+   dma_addr_t dma_handle, unsigned long attrs)
 {
struct page *page = virt_to_page(dma_handle);
int is_non_coh = 1;
@@ -129,7 +129,7 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size,
 
 static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size, enum dma_data_direction dir,
-   struct dma_attrs *attrs)
+   unsigned long attrs)
 {
phys_addr_t paddr = page_to_phys(page) + offset;
_dma_cache_sync(paddr, size, dir);
@@ -137,7 +137,7 @@ static dma_addr_t arc_dma_map_page(struct device *dev, 
struct page *page,
 }
 
 static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
-  int nents, enum dma_data_direction dir, struct dma_attrs *attrs)
+  int nents, enum dma_data_direction dir, unsigned long attrs)
 {
struct scatterlist *s;
int i;
-- 
1.9.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v4 43/44] dma-mapping: Remove dma_get_attr

2016-06-10 Thread Krzysztof Kozlowski
After switching DMA attributes to unsigned long it is easier to just
compare the bits.

Signed-off-by: Krzysztof Kozlowski 
[for avr32]
Acked-by: Hans-Christian Noren Egtvedt 
---
 Documentation/DMA-API.txt  |  4 +--
 arch/arc/mm/dma.c  |  4 +--
 arch/arm/mm/dma-mapping.c  | 36 --
 arch/arm/xen/mm.c  |  4 +--
 arch/arm64/mm/dma-mapping.c| 10 +++
 arch/avr32/mm/dma-coherent.c   |  4 +--
 arch/ia64/sn/pci/pci_dma.c | 10 ++-
 arch/metag/kernel/dma.c|  2 +-
 arch/mips/mm/dma-default.c |  6 ++---
 arch/openrisc/kernel/dma.c |  4 +--
 arch/parisc/kernel/pci-dma.c   |  2 +-
 arch/powerpc/platforms/cell/iommu.c| 12 -
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c|  2 +-
 drivers/iommu/dma-iommu.c  |  2 +-
 drivers/media/v4l2-core/videobuf2-dma-contig.c |  2 +-
 include/linux/dma-mapping.h| 10 ---
 16 files changed, 47 insertions(+), 67 deletions(-)

diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index 24f9688bb98a..1d26eeb6b5f6 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -422,9 +422,7 @@ void whizco_dma_map_sg_attrs(struct device *dev, dma_addr_t 
dma_addr,
 unsigned long attrs)
 {

-   int foo =  dma_get_attr(DMA_ATTR_FOO, attrs);
-   
-   if (foo)
+   if (attrs & DMA_ATTR_FOO)
/* twizzle the frobnozzle */

 
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 3d1f467d1792..74bbe68dce9d 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -46,7 +46,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 *   (vs. always going to memory - thus are faster)
 */
if ((is_isa_arcv2() && ioc_exists) ||
-   dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs))
+   (attrs & DMA_ATTR_NON_CONSISTENT))
need_coh = 0;
 
/*
@@ -95,7 +95,7 @@ static void arc_dma_free(struct device *dev, size_t size, 
void *vaddr,
struct page *page = virt_to_page(dma_handle);
int is_non_coh = 1;
 
-   is_non_coh = dma_get_attr(DMA_ATTR_NON_CONSISTENT, attrs) ||
+   is_non_coh = (attrs & DMA_ATTR_NON_CONSISTENT) ||
(is_isa_arcv2() && ioc_exists);
 
if (PageHighMem(page) || !is_non_coh)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ebb3fde99043..43e03b5293d0 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -126,7 +126,7 @@ static dma_addr_t arm_dma_map_page(struct device *dev, 
struct page *page,
 unsigned long offset, size_t size, enum dma_data_direction dir,
 unsigned long attrs)
 {
-   if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
+   if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
__dma_page_cpu_to_dev(page, offset, size, dir);
return pfn_to_dma(dev, page_to_pfn(page)) + offset;
 }
@@ -155,7 +155,7 @@ static dma_addr_t arm_coherent_dma_map_page(struct device 
*dev, struct page *pag
 static void arm_dma_unmap_page(struct device *dev, dma_addr_t handle,
size_t size, enum dma_data_direction dir, unsigned long attrs)
 {
-   if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
+   if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
__dma_page_dev_to_cpu(pfn_to_page(dma_to_pfn(dev, handle)),
  handle & ~PAGE_MASK, size, dir);
 }
@@ -622,9 +622,9 @@ static void __free_from_contiguous(struct device *dev, 
struct page *page,
 
 static inline pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot)
 {
-   prot = dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs) ?
-   pgprot_writecombine(prot) :
-   pgprot_dmacoherent(prot);
+   prot = (attrs & DMA_ATTR_WRITE_COMBINE) ?
+   pgprot_writecombine(prot) :
+   pgprot_dmacoherent(prot);
return prot;
 }
 
@@ -744,7 +744,7 @@ static void *__dma_alloc(struct device *dev, size_t size, 
dma_addr_t *handle,
.gfp = gfp,
.prot = prot,
.caller = caller,
-   .want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs),
+   .want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0),
};
 
 #ifdef CONFIG_DMA_API_DEBUG
@@ -887,7 +887,7 @@ static void __arm_dma_free(struct device *dev, size_t size, 
void *cpu_addr,
.size = PAGE_ALIGN(size),
.cpu_addr = cpu_addr,
.page = page,
-   .want_vaddr = !dma_get_attr(DMA_ATTR_NO_KERNEL_MAPPING, attrs),
+   .want_vaddr = ((attrs & DMA_ATTR_NO_KERNEL_MAPPING) == 0),
};
 
  

Re: [RFC v3 20/45] xen: dma-mapping: Use unsigned long for dma_attrs

2016-06-10 Thread David Vrabel
On 02/06/16 16:39, Krzysztof Kozlowski wrote:
> Split out subsystem specific changes for easier reviews. This will be
> squashed with main commit.

Acked-by: David Vrabel 

David

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v4 03/44] arc: dma-mapping: Use unsigned long for dma_attrs

2016-06-10 Thread Vineet Gupta
On Friday 10 June 2016 03:41 PM, Krzysztof Kozlowski wrote:
> Split out subsystem specific changes for easier reviews. This will be
> squashed with main commit.
> 
> Signed-off-by: Krzysztof Kozlowski 

Acked-by: Vineet Gupta 

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v4 43/44] dma-mapping: Remove dma_get_attr

2016-06-10 Thread Vineet Gupta
On Friday 10 June 2016 03:44 PM, Krzysztof Kozlowski wrote:
> After switching DMA attributes to unsigned long it is easier to just
> compare the bits.
>
> Signed-off-by: Krzysztof Kozlowski 
> [for avr32]
> Acked-by: Hans-Christian Noren Egtvedt 

Acked-by: Vineet Gupta#for arch/arc

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v4 43/44] dma-mapping: Remove dma_get_attr

2016-06-10 Thread Robin Murphy

On 10/06/16 11:12, Krzysztof Kozlowski wrote:

After switching DMA attributes to unsigned long it is easier to just
compare the bits.

Signed-off-by: Krzysztof Kozlowski 
[for avr32]
Acked-by: Hans-Christian Noren Egtvedt 
---

[...]

  arch/arm64/mm/dma-mapping.c| 10 +++

[...]

  drivers/iommu/dma-iommu.c  |  2 +-

[...]

diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a7686028dfeb..06c068ca3541 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -32,7 +32,7 @@
  static pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot,
 bool coherent)
  {
-   if (!coherent || dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs))
+   if (!coherent || (attrs & DMA_ATTR_WRITE_COMBINE))
return pgprot_writecombine(prot);
return prot;
  }
@@ -702,7 +702,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, 
struct page *page,
dma_addr_t dev_addr = iommu_dma_map_page(dev, page, offset, size, prot);

if (!iommu_dma_mapping_error(dev, dev_addr) &&
-   !dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
+   (attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
__iommu_sync_single_for_device(dev, dev_addr, size, dir);

return dev_addr;
@@ -712,7 +712,7 @@ static void __iommu_unmap_page(struct device *dev, 
dma_addr_t dev_addr,
   size_t size, enum dma_data_direction dir,
   unsigned long attrs)
  {
-   if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
+   if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
__iommu_sync_single_for_cpu(dev, dev_addr, size, dir);

iommu_dma_unmap_page(dev, dev_addr, size, dir, attrs);
@@ -752,7 +752,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct 
scatterlist *sgl,
  {
bool coherent = is_device_dma_coherent(dev);

-   if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
+   if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
__iommu_sync_sg_for_device(dev, sgl, nelems, dir);

return iommu_dma_map_sg(dev, sgl, nelems,
@@ -764,7 +764,7 @@ static void __iommu_unmap_sg_attrs(struct device *dev,
   enum dma_data_direction dir,
   unsigned long attrs)
  {
-   if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
+   if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
__iommu_sync_sg_for_cpu(dev, sgl, nelems, dir);

iommu_dma_unmap_sg(dev, sgl, nelems, dir, attrs);

[...]

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 6c1bda504fb1..08a1e2f3690f 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -306,7 +306,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t 
size, gfp_t gfp,
} else {
size = ALIGN(size, min_size);
}
-   if (dma_get_attr(DMA_ATTR_ALLOC_SINGLE_PAGES, attrs))
+   if (attrs & DMA_ATTR_ALLOC_SINGLE_PAGES)
alloc_sizes = min_size;

count = PAGE_ALIGN(size) >> PAGE_SHIFT;

[...]

These all look appropriate to me; thanks!

For arm64 and dma-iommu:

Acked-by: Robin Murphy 

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 03/27] drm/arc: Actually bother with handling atomic events.

2016-06-10 Thread Alexey Brodkin
Hi Daniel,

On Thu, 2016-06-09 at 16:37 +0200, Daniel Vetter wrote:
> On Thu, Jun 9, 2016 at 4:31 PM, Daniel Vetter  wrote:
> > 
> > On Thu, Jun 9, 2016 at 4:29 PM, Alexey Brodkin
> >  wrote:
> > > 
> > > Hi Daniel,
> > > 
> > > On Thu, 2016-06-09 at 15:52 +0200, Daniel Vetter wrote:
> > > > 
> > > > 
> > > > The fake implementation is fundamentally racy, and I don't want to write
> > > > helpers which can't be used correctly. Anyway I think without this patch
> > > > (or something similar) arcpgu will stall badly with the new nonblocking
> > > > helpers, because arcpgu didn't bother at all to implement nonblocking. 
> > > > Can
> > > > you pls ack this, or even better, test the entire patch series? The
> > > > helpers themselves should work, but in all 5 drivers tested thus far 
> > > > they
> > > > discovered some bugs.
> > > Sure I will happily test this series.
> > > The only question then is what should I use as a proper base?
> > It should apply on drm-next from Dave.
>
> And indeed it won't work at all because arcpgu doesn't call
> drm_crtc_handle_vblank anywhere. So you need to add your patch to
> enable vblank interrupts somewhere. Note that as long as you leave
> max_vblank_counter as 0, the only bits you need is drm_vblank_init and
> drm_crtc_handle_vblanke() from the irq handler.

So is there any sense in testing that series if vblank interrupt is not yet
supported (I'm looking forward to implementing it sometime soon but definitely
I'm not there yet)?

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 03/27] drm/arc: Actually bother with handling atomic events.

2016-06-10 Thread Daniel Vetter
On Fri, Jun 10, 2016 at 01:23:22PM +, Alexey Brodkin wrote:
> Hi Daniel,
> 
> On Thu, 2016-06-09 at 16:37 +0200, Daniel Vetter wrote:
> > On Thu, Jun 9, 2016 at 4:31 PM, Daniel Vetter  wrote:
> > > 
> > > On Thu, Jun 9, 2016 at 4:29 PM, Alexey Brodkin
> > >  wrote:
> > > > 
> > > > Hi Daniel,
> > > > 
> > > > On Thu, 2016-06-09 at 15:52 +0200, Daniel Vetter wrote:
> > > > > 
> > > > > 
> > > > > The fake implementation is fundamentally racy, and I don't want to 
> > > > > write
> > > > > helpers which can't be used correctly. Anyway I think without this 
> > > > > patch
> > > > > (or something similar) arcpgu will stall badly with the new 
> > > > > nonblocking
> > > > > helpers, because arcpgu didn't bother at all to implement 
> > > > > nonblocking. Can
> > > > > you pls ack this, or even better, test the entire patch series? The
> > > > > helpers themselves should work, but in all 5 drivers tested thus far 
> > > > > they
> > > > > discovered some bugs.
> > > > Sure I will happily test this series.
> > > > The only question then is what should I use as a proper base?
> > > It should apply on drm-next from Dave.
> >
> > And indeed it won't work at all because arcpgu doesn't call
> > drm_crtc_handle_vblank anywhere. So you need to add your patch to
> > enable vblank interrupts somewhere. Note that as long as you leave
> > max_vblank_counter as 0, the only bits you need is drm_vblank_init and
> > drm_crtc_handle_vblanke() from the irq handler.
> 
> So is there any sense in testing that series if vblank interrupt is not yet
> supported (I'm looking forward to implementing it sometime soon but definitely
> I'm not there yet)?

Well, it might break your driver, so yes. I'm ofc happy to help unbreak it,
but without someone who tests there's not much I can do, so will just go
ahead and apply and hope it works.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/3 v2] drm/arcpgu: Make ARC PGU usable on simulation platforms

2016-06-10 Thread Alexey Brodkin
From: Ruud Derwig 

In case of simulation there's no real encoder/transmitter device
because in the model's virtual LCD  we're rendering whatever
appears in frame-buffer memory.

Signed-off-by: Ruud Derwig 
Signed-off-by: Alexey Brodkin 
---

Changes v1 -> v2:
 * Got rid of dummy arcpgu_drm_encoder_helper_funcs and now rely on default
   best encoder

 drivers/gpu/drm/arc/Makefile |   2 +-
 drivers/gpu/drm/arc/arcpgu.h |   1 +
 drivers/gpu/drm/arc/arcpgu_drv.c |  15 ++---
 drivers/gpu/drm/arc/arcpgu_sim.c | 128 +++
 4 files changed, 138 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/arc/arcpgu_sim.c

diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile
index d48fda7..73de56a 100644
--- a/drivers/gpu/drm/arc/Makefile
+++ b/drivers/gpu/drm/arc/Makefile
@@ -1,2 +1,2 @@
-arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_drv.o
+arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o
 obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o
diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h
index 86574b6..329ac75 100644
--- a/drivers/gpu/drm/arc/arcpgu.h
+++ b/drivers/gpu/drm/arc/arcpgu.h
@@ -43,6 +43,7 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private 
*arcpgu,
 
 int arc_pgu_setup_crtc(struct drm_device *dev);
 int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
+int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np);
 struct drm_fbdev_cma *arcpgu_fbdev_cma_init(struct drm_device *dev,
unsigned int preferred_bpp, unsigned int num_crtc,
unsigned int max_conn_count);
diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 7675bbc..07c1bde 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -149,15 +149,16 @@ static int arcpgu_load(struct drm_device *drm)
 
/* find the encoder node and initialize it */
encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0);
-   if (!encoder_node) {
-   dev_err(drm->dev, "failed to get an encoder slave node\n");
-   return -ENODEV;
+   if (encoder_node) {
+   ret = arcpgu_drm_hdmi_init(drm, encoder_node);
+   if (ret < 0)
+   return ret;
+   } else {
+   ret = arcpgu_drm_sim_init(drm, 0);
+   if (ret < 0)
+   return ret;
}
 
-   ret = arcpgu_drm_hdmi_init(drm, encoder_node);
-   if (ret < 0)
-   return ret;
-
drm_mode_config_reset(drm);
drm_kms_helper_poll_init(drm);
 
diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c
new file mode 100644
index 000..2bf06d7
--- /dev/null
+++ b/drivers/gpu/drm/arc/arcpgu_sim.c
@@ -0,0 +1,128 @@
+/*
+ * ARC PGU DRM driver.
+ *
+ * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include 
+#include 
+#include 
+
+#include "arcpgu.h"
+
+#define XRES_DEF   640
+#define YRES_DEF   480
+
+#define XRES_MAX   8192
+#define YRES_MAX   8192
+
+
+struct arcpgu_drm_connector {
+   struct drm_connector connector;
+   struct drm_encoder_slave *encoder_slave;
+};
+
+static int arcpgu_drm_connector_get_modes(struct drm_connector *connector)
+{
+   int count;
+
+   count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX);
+   drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF);
+   return count;
+}
+
+static enum drm_connector_status
+arcpgu_drm_connector_detect(struct drm_connector *connector, bool force)
+{
+   return connector_status_connected;
+}
+
+static void arcpgu_drm_connector_destroy(struct drm_connector *connector)
+{
+   drm_connector_unregister(connector);
+   drm_connector_cleanup(connector);
+}
+
+static const struct drm_connector_helper_funcs
+arcpgu_drm_connector_helper_funcs = {
+   .get_modes = arcpgu_drm_connector_get_modes,
+};
+
+static const struct drm_connector_funcs arcpgu_drm_connector_funcs = {
+   .dpms = drm_helper_connector_dpms,
+   .reset = drm_atomic_helper_connector_reset,
+   .detect = arcpgu_drm_connector_detect,
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .destroy = arcpgu_drm_connector_destroy,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+};
+
+static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = {
+   .de

[PATCH 0/3 v2] Make ARC PGU usable on sim platforms

2016-06-10 Thread Alexey Brodkin
Initially ARC PGU required real encoder/trnasmitter to exist.
That was fine for real HW such as ARC SDP boards.

But on some simulaiton platroms like ARC VDK or nSIM OSCI we have model
of the same ARC PGU and ability to output video data in a virtual LCD.

To make ARC PGU driver usable in those virtual platforms we need to istantiate
virtual encoder instead of a real one. And that all is done in the first patch
of the series.

Subsequent patches just update configs of both VDK and nSIM OSCI boards
with enabling ARC PGU driver and adding required fixups in their DT
descriptions.

Changes v1 -> v2:
 * Got rid of dummy arcpgu_drm_encoder_helper_funcs and now rely on default
   best encoder

Alexey Brodkin (2):
  ARCv2: [vdk] Enable ARC PGU on HS38 VDK
  ARC: [nsimosci] Enable ARC PGU on nSIM OSCI virtual platforms

Ruud Derwig (1):
  drm/arcpgu: Make ARC PGU usable on simulation platforms

 arch/arc/boot/dts/nsimosci.dts |  14 +++-
 arch/arc/boot/dts/nsimosci_hs.dts  |  14 +++-
 arch/arc/boot/dts/nsimosci_hs_idu.dts  |  14 +++-
 arch/arc/boot/dts/vdk_axs10x_mb.dtsi   |  13 ++-
 arch/arc/boot/dts/vdk_hs38_smp.dts |   2 +-
 arch/arc/configs/nsimosci_defconfig|   3 +-
 arch/arc/configs/nsimosci_hs_defconfig |   3 +-
 arch/arc/configs/nsimosci_hs_smp_defconfig |   3 +-
 arch/arc/configs/vdk_hs38_smp_defconfig|   7 +-
 drivers/gpu/drm/arc/Makefile   |   2 +-
 drivers/gpu/drm/arc/arcpgu.h   |   1 +
 drivers/gpu/drm/arc/arcpgu_drv.c   |  15 ++--
 drivers/gpu/drm/arc/arcpgu_sim.c   | 128 +
 13 files changed, 189 insertions(+), 30 deletions(-)
 create mode 100644 drivers/gpu/drm/arc/arcpgu_sim.c

-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/3 v2] ARCv2: [vdk] Enable ARC PGU on HS38 VDK

2016-06-10 Thread Alexey Brodkin
With required ARC PGU updates that allow it to be used on simulation
platforms we may finally utilize ARC PGU in HS38 VDK with modern
Linux kernels.

Signed-off-by: Alexey Brodkin 
---

No changes in v2.

 arch/arc/boot/dts/vdk_axs10x_mb.dtsi| 13 +
 arch/arc/boot/dts/vdk_hs38_smp.dts  |  2 +-
 arch/arc/configs/vdk_hs38_smp_defconfig |  7 ++-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/arc/boot/dts/vdk_axs10x_mb.dtsi 
b/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
index 45cd665..99498a4 100644
--- a/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
+++ b/arch/arc/boot/dts/vdk_axs10x_mb.dtsi
@@ -23,6 +23,11 @@
#clock-cells = <0>;
};
 
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <25175000>;
+   };
};
 
ethernet@0x18000 {
@@ -75,11 +80,11 @@
};
 
 /* PGU output directly sent to virtual LCD screen; hdmi controller not 
modelled */
-   pgu@0x17000 {
-   compatible = "snps,arcpgufb";
+   pgu@17000 {
+   compatible = "snps,arcpgu";
reg = <0x17000 0x400>;
-   clock-frequency = <5100>; /* PGU'clock is initated 
in init function */
-   /* interrupts = <5>;   PGU interrupts not used, this 
vector is used for ps2 below */
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
};
 
 /* VDK has additional ps2 keyboard/mouse interface integrated in LCD screen 
model */
diff --git a/arch/arc/boot/dts/vdk_hs38_smp.dts 
b/arch/arc/boot/dts/vdk_hs38_smp.dts
index 031a5bc..2ba60c39 100644
--- a/arch/arc/boot/dts/vdk_hs38_smp.dts
+++ b/arch/arc/boot/dts/vdk_hs38_smp.dts
@@ -16,6 +16,6 @@
compatible = "snps,axs103";
 
chosen {
-   bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 
console=tty0 console=ttyS3,115200n8 consoleblank=0";
+   bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 
console=tty0 console=ttyS3,115200n8 consoleblank=0 video=640x480-24";
};
 };
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig 
b/arch/arc/configs/vdk_hs38_smp_defconfig
index 52ec315..969b206 100644
--- a/arch/arc/configs/vdk_hs38_smp_defconfig
+++ b/arch/arc/configs/vdk_hs38_smp_defconfig
@@ -63,12 +63,9 @@ CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
-CONFIG_ARCPGU_RGB888=y
-CONFIG_ARCPGU_DISPTYPE=0
-# CONFIG_VGA_CONSOLE is not set
+CONFIG_DRM=y
+CONFIG_DRM_ARCPGU=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 CONFIG_LOGO=y
 # CONFIG_LOGO_LINUX_MONO is not set
 # CONFIG_LOGO_LINUX_VGA16 is not set
-- 
2.5.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/3] ARC: [nsimosci] Enable ARC PGU on nSIM OSCI virtual platforms

2016-06-10 Thread Alexey Brodkin
With required ARC PGU updates that allow it to be used on simulation
platforms we may finally utilize ARC PGU in nSIM OSCI virtual platforms
with modern Linux kernels.

Signed-off-by: Alexey Brodkin 
---

No changes in v2.

 arch/arc/boot/dts/nsimosci.dts | 14 +++---
 arch/arc/boot/dts/nsimosci_hs.dts  | 14 +++---
 arch/arc/boot/dts/nsimosci_hs_idu.dts  | 14 +++---
 arch/arc/configs/nsimosci_defconfig|  3 ++-
 arch/arc/configs/nsimosci_hs_defconfig |  3 ++-
 arch/arc/configs/nsimosci_hs_smp_defconfig |  3 ++-
 6 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/arch/arc/boot/dts/nsimosci.dts b/arch/arc/boot/dts/nsimosci.dts
index b5b060a..37c416d 100644
--- a/arch/arc/boot/dts/nsimosci.dts
+++ b/arch/arc/boot/dts/nsimosci.dts
@@ -20,7 +20,7 @@
/* this is for console on PGU */
/* bootargs = "console=tty0 consoleblank=0"; */
/* this is for console on serial */
-   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug";
+   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug video=640x480-24";
};
 
aliases {
@@ -58,9 +58,17 @@
no-loopback-test = <1>;
};
 
-   pgu0: pgu@f900 {
-   compatible = "snps,arcpgufb";
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <25175000>;
+   };
+
+   pgu@f900 {
+   compatible = "snps,arcpgu";
reg = <0xf900 0x400>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
};
 
ps2: ps2@f9001000 {
diff --git a/arch/arc/boot/dts/nsimosci_hs.dts 
b/arch/arc/boot/dts/nsimosci_hs.dts
index 325e730..f2a22c4 100644
--- a/arch/arc/boot/dts/nsimosci_hs.dts
+++ b/arch/arc/boot/dts/nsimosci_hs.dts
@@ -20,7 +20,7 @@
/* this is for console on PGU */
/* bootargs = "console=tty0 consoleblank=0"; */
/* this is for console on serial */
-   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug";
+   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug video=640x480-24";
};
 
aliases {
@@ -58,9 +58,17 @@
no-loopback-test = <1>;
};
 
-   pgu0: pgu@f900 {
-   compatible = "snps,arcpgufb";
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <25175000>;
+   };
+
+   pgu@f900 {
+   compatible = "snps,arcpgu";
reg = <0xf900 0x400>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
};
 
ps2: ps2@f9001000 {
diff --git a/arch/arc/boot/dts/nsimosci_hs_idu.dts 
b/arch/arc/boot/dts/nsimosci_hs_idu.dts
index ee03d71..34457a5 100644
--- a/arch/arc/boot/dts/nsimosci_hs_idu.dts
+++ b/arch/arc/boot/dts/nsimosci_hs_idu.dts
@@ -18,7 +18,7 @@
 
chosen {
/* this is for console on serial */
-   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblan=0 debug";
+   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblan=0 debug video=640x480-24";
};
 
aliases {
@@ -77,9 +77,17 @@
no-loopback-test = <1>;
};
 
-   pgu0: pgu@f900 {
-   compatible = "snps,arcpgufb";
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <25175000>;
+   };
+
+   pgu@f900 {
+   compatible = "snps,arcpgu";
reg = <0xf900 0x400>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
};
 
ps2: ps2@f9001000 {
diff --git a/arch/arc/configs/nsimosci_defconfig 
b/arch/arc/configs/nsimosci_defconfig
index 42bafa5..98cf209 100644
--- a/arch/arc/configs/nsimosci_defconfig
+++ b/arch/arc/configs/nsimosci_defconfig
@@ -58,7 +58,8 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
+CONFIG_DRM=y
+CONFIG_DRM_ARCPGU=y
 CONFI

[PATCH 3/3 v2] ARC: [nsimosci] Enable ARC PGU on nSIM OSCI virtual platforms

2016-06-10 Thread Alexey Brodkin
With required ARC PGU updates that allow it to be used on simulation
platforms we may finally utilize ARC PGU in nSIM OSCI virtual platforms
with modern Linux kernels.

Signed-off-by: Alexey Brodkin 
---

No changes in v2.

 arch/arc/boot/dts/nsimosci.dts | 14 +++---
 arch/arc/boot/dts/nsimosci_hs.dts  | 14 +++---
 arch/arc/boot/dts/nsimosci_hs_idu.dts  | 14 +++---
 arch/arc/configs/nsimosci_defconfig|  3 ++-
 arch/arc/configs/nsimosci_hs_defconfig |  3 ++-
 arch/arc/configs/nsimosci_hs_smp_defconfig |  3 ++-
 6 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/arch/arc/boot/dts/nsimosci.dts b/arch/arc/boot/dts/nsimosci.dts
index b5b060a..37c416d 100644
--- a/arch/arc/boot/dts/nsimosci.dts
+++ b/arch/arc/boot/dts/nsimosci.dts
@@ -20,7 +20,7 @@
/* this is for console on PGU */
/* bootargs = "console=tty0 consoleblank=0"; */
/* this is for console on serial */
-   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug";
+   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug video=640x480-24";
};
 
aliases {
@@ -58,9 +58,17 @@
no-loopback-test = <1>;
};
 
-   pgu0: pgu@f900 {
-   compatible = "snps,arcpgufb";
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <25175000>;
+   };
+
+   pgu@f900 {
+   compatible = "snps,arcpgu";
reg = <0xf900 0x400>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
};
 
ps2: ps2@f9001000 {
diff --git a/arch/arc/boot/dts/nsimosci_hs.dts 
b/arch/arc/boot/dts/nsimosci_hs.dts
index 325e730..f2a22c4 100644
--- a/arch/arc/boot/dts/nsimosci_hs.dts
+++ b/arch/arc/boot/dts/nsimosci_hs.dts
@@ -20,7 +20,7 @@
/* this is for console on PGU */
/* bootargs = "console=tty0 consoleblank=0"; */
/* this is for console on serial */
-   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug";
+   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblank=0 debug video=640x480-24";
};
 
aliases {
@@ -58,9 +58,17 @@
no-loopback-test = <1>;
};
 
-   pgu0: pgu@f900 {
-   compatible = "snps,arcpgufb";
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <25175000>;
+   };
+
+   pgu@f900 {
+   compatible = "snps,arcpgu";
reg = <0xf900 0x400>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
};
 
ps2: ps2@f9001000 {
diff --git a/arch/arc/boot/dts/nsimosci_hs_idu.dts 
b/arch/arc/boot/dts/nsimosci_hs_idu.dts
index ee03d71..34457a5 100644
--- a/arch/arc/boot/dts/nsimosci_hs_idu.dts
+++ b/arch/arc/boot/dts/nsimosci_hs_idu.dts
@@ -18,7 +18,7 @@
 
chosen {
/* this is for console on serial */
-   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblan=0 debug";
+   bootargs = "earlycon=uart8250,mmio32,0xf000,115200n8 
console=tty0 console=ttyS0,115200n8 consoleblan=0 debug video=640x480-24";
};
 
aliases {
@@ -77,9 +77,17 @@
no-loopback-test = <1>;
};
 
-   pgu0: pgu@f900 {
-   compatible = "snps,arcpgufb";
+   pguclk: pguclk {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <25175000>;
+   };
+
+   pgu@f900 {
+   compatible = "snps,arcpgu";
reg = <0xf900 0x400>;
+   clocks = <&pguclk>;
+   clock-names = "pxlclk";
};
 
ps2: ps2@f9001000 {
diff --git a/arch/arc/configs/nsimosci_defconfig 
b/arch/arc/configs/nsimosci_defconfig
index 42bafa5..98cf209 100644
--- a/arch/arc/configs/nsimosci_defconfig
+++ b/arch/arc/configs/nsimosci_defconfig
@@ -58,7 +58,8 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1
 CONFIG_SERIAL_OF_PLATFORM=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
-CONFIG_FB=y
+CONFIG_DRM=y
+CONFIG_DRM_ARCPGU=y
 CONFI

Re: [PATCH 03/27] drm/arc: Actually bother with handling atomic events.

2016-06-10 Thread Daniel Vetter
On Fri, Jun 10, 2016 at 04:19:27PM +0200, Daniel Vetter wrote:
> On Fri, Jun 10, 2016 at 01:23:22PM +, Alexey Brodkin wrote:
> > Hi Daniel,
> > 
> > On Thu, 2016-06-09 at 16:37 +0200, Daniel Vetter wrote:
> > > On Thu, Jun 9, 2016 at 4:31 PM, Daniel Vetter  wrote:
> > > > 
> > > > On Thu, Jun 9, 2016 at 4:29 PM, Alexey Brodkin
> > > >  wrote:
> > > > > 
> > > > > Hi Daniel,
> > > > > 
> > > > > On Thu, 2016-06-09 at 15:52 +0200, Daniel Vetter wrote:
> > > > > > 
> > > > > > 
> > > > > > The fake implementation is fundamentally racy, and I don't want to 
> > > > > > write
> > > > > > helpers which can't be used correctly. Anyway I think without this 
> > > > > > patch
> > > > > > (or something similar) arcpgu will stall badly with the new 
> > > > > > nonblocking
> > > > > > helpers, because arcpgu didn't bother at all to implement 
> > > > > > nonblocking. Can
> > > > > > you pls ack this, or even better, test the entire patch series? The
> > > > > > helpers themselves should work, but in all 5 drivers tested thus 
> > > > > > far they
> > > > > > discovered some bugs.
> > > > > Sure I will happily test this series.
> > > > > The only question then is what should I use as a proper base?
> > > > It should apply on drm-next from Dave.
> > >
> > > And indeed it won't work at all because arcpgu doesn't call
> > > drm_crtc_handle_vblank anywhere. So you need to add your patch to
> > > enable vblank interrupts somewhere. Note that as long as you leave
> > > max_vblank_counter as 0, the only bits you need is drm_vblank_init and
> > > drm_crtc_handle_vblanke() from the irq handler.
> > 
> > So is there any sense in testing that series if vblank interrupt is not yet
> > supported (I'm looking forward to implementing it sometime soon but 
> > definitely
> > I'm not there yet)?
> 
> Well, it might break your driver, so yes. I'm ofc happy to help unbreak it,
> but without someone who tests there's not much I can do, so will just go
> ahead and apply and hope it works.

Ok I went ahead and pushed a slight revised version of that patch which
just unconditionally sends out the event. That's not correct, but at least
that way the nonblocking changes won't totally break arcpgu and I can move
ahead with those.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 03/27] drm/arc: Actually bother with handling atomic events.

2016-06-10 Thread Alexey Brodkin
Hi Daniel,

On Fri, 2016-06-10 at 16:54 +0200, Daniel Vetter wrote:
> On Fri, Jun 10, 2016 at 04:19:27PM +0200, Daniel Vetter wrote:
> > 
> > On Fri, Jun 10, 2016 at 01:23:22PM +, Alexey Brodkin wrote:
> > > 
> > > Hi Daniel,
> > > 
> > > On Thu, 2016-06-09 at 16:37 +0200, Daniel Vetter wrote:
> > > > 
> > > > On Thu, Jun 9, 2016 at 4:31 PM, Daniel Vetter  wrote:
> > > > > 
> > > > > 
> > > > > On Thu, Jun 9, 2016 at 4:29 PM, Alexey Brodkin
> > > > >  wrote:
> > > > > > 
> > > > > > 
> > > > > > Hi Daniel,
> > > > > > 
> > > > > > On Thu, 2016-06-09 at 15:52 +0200, Daniel Vetter wrote:
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > The fake implementation is fundamentally racy, and I don't want 
> > > > > > > to write
> > > > > > > helpers which can't be used correctly. Anyway I think without 
> > > > > > > this patch
> > > > > > > (or something similar) arcpgu will stall badly with the new 
> > > > > > > nonblocking
> > > > > > > helpers, because arcpgu didn't bother at all to implement 
> > > > > > > nonblocking. Can
> > > > > > > you pls ack this, or even better, test the entire patch series? 
> > > > > > > The
> > > > > > > helpers themselves should work, but in all 5 drivers tested thus 
> > > > > > > far they
> > > > > > > discovered some bugs.
> > > > > > Sure I will happily test this series.
> > > > > > The only question then is what should I use as a proper base?
> > > > > It should apply on drm-next from Dave.
> > > > And indeed it won't work at all because arcpgu doesn't call
> > > > drm_crtc_handle_vblank anywhere. So you need to add your patch to
> > > > enable vblank interrupts somewhere. Note that as long as you leave
> > > > max_vblank_counter as 0, the only bits you need is drm_vblank_init and
> > > > drm_crtc_handle_vblanke() from the irq handler.
> > > So is there any sense in testing that series if vblank interrupt is not 
> > > yet
> > > supported (I'm looking forward to implementing it sometime soon but 
> > > definitely
> > > I'm not there yet)?
> > Well, it might break your driver, so yes. I'm ofc happy to help unbreak it,
> > but without someone who tests there's not much I can do, so will just go
> > ahead and apply and hope it works.
>
> Ok I went ahead and pushed a slight revised version of that patch which
> just unconditionally sends out the event. That's not correct, but at least
> that way the nonblocking changes won't totally break arcpgu and I can move
> ahead with those.

Thanks for that.
In the meantime I tried previously sent patches:
--->8-
9267484 drm/arc: Actually bother with handling atomic events.
cf4a489 drm/arc: Nuke event_list
9c3152e drm/atomic-helper: Massage swap_state signature somewhat
--->8-
and on both boards (axs103 and nSIM OSCI) video works quite fine.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v2 02/20] drm: arc: Rely on the default ->best_encoder() behavior

2016-06-10 Thread Alexey Brodkin
Hi Boris,

On Tue, 2016-06-07 at 13:47 +0200, Boris Brezillon wrote:
> We have a 1:1 relationship between connectors and encoders and the
> driver is relying on the atomic helpers: we can drop the custom
> ->best_encoder(), and let the core call drm_atomic_helper_best_encoder()
> for us.
> 
> Signed-off-by: Boris Brezillon 
> ---

Acked-by: Alexey Brodkin 
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 03/27] drm/arc: Actually bother with handling atomic events.

2016-06-10 Thread Daniel Vetter
On Fri, Jun 10, 2016 at 03:01:03PM +, Alexey Brodkin wrote:
> Hi Daniel,
> 
> On Fri, 2016-06-10 at 16:54 +0200, Daniel Vetter wrote:
> > On Fri, Jun 10, 2016 at 04:19:27PM +0200, Daniel Vetter wrote:
> > > 
> > > On Fri, Jun 10, 2016 at 01:23:22PM +, Alexey Brodkin wrote:
> > > > 
> > > > Hi Daniel,
> > > > 
> > > > On Thu, 2016-06-09 at 16:37 +0200, Daniel Vetter wrote:
> > > > > 
> > > > > On Thu, Jun 9, 2016 at 4:31 PM, Daniel Vetter  wrote:
> > > > > > 
> > > > > > 
> > > > > > On Thu, Jun 9, 2016 at 4:29 PM, Alexey Brodkin
> > > > > >  wrote:
> > > > > > > 
> > > > > > > 
> > > > > > > Hi Daniel,
> > > > > > > 
> > > > > > > On Thu, 2016-06-09 at 15:52 +0200, Daniel Vetter wrote:
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > The fake implementation is fundamentally racy, and I don't want 
> > > > > > > > to write
> > > > > > > > helpers which can't be used correctly. Anyway I think without 
> > > > > > > > this patch
> > > > > > > > (or something similar) arcpgu will stall badly with the new 
> > > > > > > > nonblocking
> > > > > > > > helpers, because arcpgu didn't bother at all to implement 
> > > > > > > > nonblocking. Can
> > > > > > > > you pls ack this, or even better, test the entire patch series? 
> > > > > > > > The
> > > > > > > > helpers themselves should work, but in all 5 drivers tested 
> > > > > > > > thus far they
> > > > > > > > discovered some bugs.
> > > > > > > Sure I will happily test this series.
> > > > > > > The only question then is what should I use as a proper base?
> > > > > > It should apply on drm-next from Dave.
> > > > > And indeed it won't work at all because arcpgu doesn't call
> > > > > drm_crtc_handle_vblank anywhere. So you need to add your patch to
> > > > > enable vblank interrupts somewhere. Note that as long as you leave
> > > > > max_vblank_counter as 0, the only bits you need is drm_vblank_init and
> > > > > drm_crtc_handle_vblanke() from the irq handler.
> > > > So is there any sense in testing that series if vblank interrupt is not 
> > > > yet
> > > > supported (I'm looking forward to implementing it sometime soon but 
> > > > definitely
> > > > I'm not there yet)?
> > > Well, it might break your driver, so yes. I'm ofc happy to help unbreak 
> > > it,
> > > but without someone who tests there's not much I can do, so will just go
> > > ahead and apply and hope it works.
> >
> > Ok I went ahead and pushed a slight revised version of that patch which
> > just unconditionally sends out the event. That's not correct, but at least
> > that way the nonblocking changes won't totally break arcpgu and I can move
> > ahead with those.
> 
> Thanks for that.
> In the meantime I tried previously sent patches:
> --->8-
> 9267484 drm/arc: Actually bother with handling atomic events.
> cf4a489 drm/arc: Nuke event_list
> 9c3152e drm/atomic-helper: Massage swap_state signature somewhat
> --->8-
> and on both boards (axs103 and nSIM OSCI) video works quite fine.

The possible breakage only starts when you move further into the series,
up to patch 10. That implements generic nonblocking commit, but that
support relies upon crtc_state->event being signalled. Anyway I'm pulling
it all into drm-misc now, so you can just test that branch (or linux-next
when it's rebuild next week).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 03/27] drm/arc: Actually bother with handling atomic events.

2016-06-10 Thread Alexey Brodkin
Hi Daniel,

On Fri, 2016-06-10 at 17:09 +0200, Daniel Vetter wrote:
> On Fri, Jun 10, 2016 at 03:01:03PM +, Alexey Brodkin wrote:
> > 
> > > Ok I went ahead and pushed a slight revised version of that patch which
> > > just unconditionally sends out the event. That's not correct, but at least
> > > that way the nonblocking changes won't totally break arcpgu and I can move
> > > ahead with those.
> > Thanks for that.
> > In the meantime I tried previously sent patches:
> > --->8-
> > 9267484 drm/arc: Actually bother with handling atomic events.
> > cf4a489 drm/arc: Nuke event_list
> > 9c3152e drm/atomic-helper: Massage swap_state signature somewhat
> > --->8-
> > and on both boards (axs103 and nSIM OSCI) video works quite fine.
>
> The possible breakage only starts when you move further into the series,
> up to patch 10. That implements generic nonblocking commit, but that
> support relies upon crtc_state->event being signalled. Anyway I'm pulling
> it all into drm-misc now, so you can just test that branch (or linux-next
> when it's rebuild next week).

Ok thanks anyways.
I'll try linux-next once it gets updated with your changes.

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc