[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-14 Thread Rob Clark
On Fri, Sep 11, 2015 at 10:10 AM, Lucas Stach  wrote:
> From: Christian Gmeiner 
>
> This is a squashed commit of the complete etnaviv DRM driver in order
> to make it easy for people to review the code by seeing the driver as a
> whole and is not intended for merging in this form.
>
> If you are interested in the history of individual commits:
> git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream
>
> Signed-off-by: Christian Gmeiner 
> Signed-off-by: Russell King 
> Signed-off-by: Lucas Stach 
> ---
>  drivers/staging/Kconfig  |2 +
>  drivers/staging/Makefile |1 +
>  drivers/staging/etnaviv/Kconfig  |   20 +
>  drivers/staging/etnaviv/Makefile |   18 +
>  drivers/staging/etnaviv/cmdstream.xml.h  |  218 
>  drivers/staging/etnaviv/common.xml.h |  249 +
>  drivers/staging/etnaviv/etnaviv_buffer.c |  271 +
>  drivers/staging/etnaviv/etnaviv_cmd_parser.c |  119 +++
>  drivers/staging/etnaviv/etnaviv_drv.c|  705 +
>  drivers/staging/etnaviv/etnaviv_drv.h|  138 +++
>  drivers/staging/etnaviv/etnaviv_gem.c|  887 
>  drivers/staging/etnaviv/etnaviv_gem.h|  141 +++
>  drivers/staging/etnaviv/etnaviv_gem_prime.c  |  121 +++
>  drivers/staging/etnaviv/etnaviv_gem_submit.c |  421 
>  drivers/staging/etnaviv/etnaviv_gpu.c| 1468 
> ++
>  drivers/staging/etnaviv/etnaviv_gpu.h|  198 
>  drivers/staging/etnaviv/etnaviv_iommu.c  |  221 
>  drivers/staging/etnaviv/etnaviv_iommu.h  |   28 +
>  drivers/staging/etnaviv/etnaviv_iommu_v2.c   |   33 +
>  drivers/staging/etnaviv/etnaviv_iommu_v2.h   |   25 +
>  drivers/staging/etnaviv/etnaviv_mmu.c|  282 +
>  drivers/staging/etnaviv/etnaviv_mmu.h|   58 +
>  drivers/staging/etnaviv/state.xml.h  |  351 ++
>  drivers/staging/etnaviv/state_hi.xml.h   |  407 +++
>  include/uapi/drm/etnaviv_drm.h   |  215 
>  25 files changed, 6597 insertions(+)
>  create mode 100644 drivers/staging/etnaviv/Kconfig
>  create mode 100644 drivers/staging/etnaviv/Makefile
>  create mode 100644 drivers/staging/etnaviv/cmdstream.xml.h
>  create mode 100644 drivers/staging/etnaviv/common.xml.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_buffer.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_cmd_parser.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_drv.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_drv.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gem.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gem.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gem_prime.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gem_submit.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gpu.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gpu.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu_v2.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu_v2.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_mmu.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_mmu.h
>  create mode 100644 drivers/staging/etnaviv/state.xml.h
>  create mode 100644 drivers/staging/etnaviv/state_hi.xml.h
>  create mode 100644 include/uapi/drm/etnaviv_drm.h
>
> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> index 7f6cae5beb90..5446fe4859ce 100644
> --- a/drivers/staging/Kconfig
> +++ b/drivers/staging/Kconfig
> @@ -112,4 +112,6 @@ source "drivers/staging/fsl-mc/Kconfig"
>
>  source "drivers/staging/wilc1000/Kconfig"
>
> +source "drivers/staging/etnaviv/Kconfig"
> +
>  endif # STAGING
> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> index 347f6477aa3e..9fd3c06b6bfd 100644
> --- a/drivers/staging/Makefile
> +++ b/drivers/staging/Makefile
> @@ -48,3 +48,4 @@ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/
>  obj-$(CONFIG_FB_TFT)   += fbtft/
>  obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
>  obj-$(CONFIG_WILC1000) += wilc1000/
> +obj-$(CONFIG_DRM_ETNAVIV)  += etnaviv/
> diff --git a/drivers/staging/etnaviv/Kconfig b/drivers/staging/etnaviv/Kconfig
> new file mode 100644
> index ..6f034eda914c
> --- /dev/null
> +++ b/drivers/staging/etnaviv/Kconfig
> @@ -0,0 +1,20 @@
> +
> +config DRM_ETNAVIV
> +   tristate "etnaviv DRM"
> +   depends on DRM
> +   select SHMEM
> +   select TMPFS
> +   select IOMMU_API
> +   select IOMMU_SUPPORT
> +   default y
> +   help
> + DRM driver for Vivante GPUs.
> +
> +config DRM_ETNAVIV_REGISTER_LOGGING
> +   bool "etnaviv DRM register logging"
> +   depends on DRM_ETNAVIV
> +   default n
> +   help
> + Compile in support for logging register reads/writes in a format
> + th

[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Russell King - ARM Linux
On Wed, Sep 16, 2015 at 08:11:54AM +0200, Christian Gmeiner wrote:
> Hi Lucas
> 
> 
> 2015-09-11 16:10 GMT+02:00 Lucas Stach :
> > From: Christian Gmeiner 
> >
> > This is a squashed commit of the complete etnaviv DRM driver in order
> > to make it easy for people to review the code by seeing the driver as a
> > whole and is not intended for merging in this form.
> >
> > If you are interested in the history of individual commits:
> > git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream
> >
> > Signed-off-by: Christian Gmeiner 
> > Signed-off-by: Russell King 
> > Signed-off-by: Lucas Stach 
> > ---

[ cut thousands of lines ]

If there was some comments in this, I don't know where they are.  Expecting
people to read through thousands of lines to find where you've commented
is unreasonable.  Please trim appropriately, according to standard email
etiquette.  (it also helps to get this patch through mailing lists as it
then won't hit the size filters, and moderators don't have to keep
approving stuff.)

Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Russell King - ARM Linux
On Mon, Sep 14, 2015 at 09:16:01AM -0400, Rob Clark wrote:
> On Fri, Sep 11, 2015 at 10:10 AM, Lucas Stach  
> wrote:
> > From: Christian Gmeiner 
> >
> > This is a squashed commit of the complete etnaviv DRM driver in order
> > to make it easy for people to review the code by seeing the driver as a
> > whole and is not intended for merging in this form.
> >
> > If you are interested in the history of individual commits:
> > git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream
> >
> > Signed-off-by: Christian Gmeiner 
> > Signed-off-by: Russell King 
> > Signed-off-by: Lucas Stach 
> > ---
> >  drivers/staging/Kconfig  |2 +
> >  drivers/staging/Makefile |1 +
> >  drivers/staging/etnaviv/Kconfig  |   20 +
> >  drivers/staging/etnaviv/Makefile |   18 +
> >  drivers/staging/etnaviv/cmdstream.xml.h  |  218 
> >  drivers/staging/etnaviv/common.xml.h |  249 +
> >  drivers/staging/etnaviv/etnaviv_buffer.c |  271 +
> >  drivers/staging/etnaviv/etnaviv_cmd_parser.c |  119 +++
> >  drivers/staging/etnaviv/etnaviv_drv.c|  705 +
> >  drivers/staging/etnaviv/etnaviv_drv.h|  138 +++
> >  drivers/staging/etnaviv/etnaviv_gem.c|  887 
> >  drivers/staging/etnaviv/etnaviv_gem.h|  141 +++
> >  drivers/staging/etnaviv/etnaviv_gem_prime.c  |  121 +++
> >  drivers/staging/etnaviv/etnaviv_gem_submit.c |  421 
> >  drivers/staging/etnaviv/etnaviv_gpu.c| 1468 
> > ++
> >  drivers/staging/etnaviv/etnaviv_gpu.h|  198 
> >  drivers/staging/etnaviv/etnaviv_iommu.c  |  221 
> >  drivers/staging/etnaviv/etnaviv_iommu.h  |   28 +
> >  drivers/staging/etnaviv/etnaviv_iommu_v2.c   |   33 +
> >  drivers/staging/etnaviv/etnaviv_iommu_v2.h   |   25 +
> >  drivers/staging/etnaviv/etnaviv_mmu.c|  282 +
> >  drivers/staging/etnaviv/etnaviv_mmu.h|   58 +
> >  drivers/staging/etnaviv/state.xml.h  |  351 ++
> >  drivers/staging/etnaviv/state_hi.xml.h   |  407 +++
> >  include/uapi/drm/etnaviv_drm.h   |  215 
> >  25 files changed, 6597 insertions(+)
> >  create mode 100644 drivers/staging/etnaviv/Kconfig
> >  create mode 100644 drivers/staging/etnaviv/Makefile
> >  create mode 100644 drivers/staging/etnaviv/cmdstream.xml.h
> >  create mode 100644 drivers/staging/etnaviv/common.xml.h
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_buffer.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_cmd_parser.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_drv.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_drv.h
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_gem.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_gem.h
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_gem_prime.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_gem_submit.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_gpu.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_gpu.h
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu.h
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu_v2.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu_v2.h
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_mmu.c
> >  create mode 100644 drivers/staging/etnaviv/etnaviv_mmu.h
> >  create mode 100644 drivers/staging/etnaviv/state.xml.h
> >  create mode 100644 drivers/staging/etnaviv/state_hi.xml.h
> >  create mode 100644 include/uapi/drm/etnaviv_drm.h
> >
> > diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> > index 7f6cae5beb90..5446fe4859ce 100644
> > --- a/drivers/staging/Kconfig
> > +++ b/drivers/staging/Kconfig
> > @@ -112,4 +112,6 @@ source "drivers/staging/fsl-mc/Kconfig"
> >
> >  source "drivers/staging/wilc1000/Kconfig"
> >
> > +source "drivers/staging/etnaviv/Kconfig"
> > +
> >  endif # STAGING
> > diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> > index 347f6477aa3e..9fd3c06b6bfd 100644
> > --- a/drivers/staging/Makefile
> > +++ b/drivers/staging/Makefile
> > @@ -48,3 +48,4 @@ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/
> >  obj-$(CONFIG_FB_TFT)   += fbtft/
> >  obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
> >  obj-$(CONFIG_WILC1000) += wilc1000/
> > +obj-$(CONFIG_DRM_ETNAVIV)  += etnaviv/
> > diff --git a/drivers/staging/etnaviv/Kconfig 
> > b/drivers/staging/etnaviv/Kconfig
> > new file mode 100644
> > index ..6f034eda914c
> > --- /dev/null
> > +++ b/drivers/staging/etnaviv/Kconfig
> > @@ -0,0 +1,20 @@
> > +
> > +config DRM_ETNAVIV
> > +   tristate "etnaviv DRM"
> > +   depends on DRM
> > +   select SHMEM
> > +   select TMPFS
> > +   select IOMMU_API
> > +   select IOMMU_SUPPORT
> > +   default y
> > +   help
> > + DRM dr

[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Russell King - ARM Linux
On Fri, Sep 11, 2015 at 04:10:13PM +0200, Lucas Stach wrote:
> From: Christian Gmeiner 
> 
> This is a squashed commit of the complete etnaviv DRM driver in order
> to make it easy for people to review the code by seeing the driver as a
> whole and is not intended for merging in this form.
> 
> If you are interested in the history of individual commits:
> git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream
> 
> Signed-off-by: Christian Gmeiner 
> Signed-off-by: Russell King 
> Signed-off-by: Lucas Stach 

Lucas,

I know that the previous round, people said that they didn't like the
individual patches posted, but squashing everything together into one
patch is also not good.

It would make more sense (at least for me) if you squashed the work
that has already been done into one patch, and then post your updates
as individual patches.  That way, Christian and myself can see what
the changes are against some known without having to dig through your
git tree, and those who complained about all the patches last time
have fewer patches to look at.

Expecting those in the project to page through thousands of lines that
they already know about, hoping to spot the changes you've made is
really very unreasonable and error prone.  I will _NOT_ be wasting my
time reviewing this mega-patch exactly because of that.

I _might_, if I get time, pull a copy of your git tree to look at the
individual patches, but I'm not going to reply quoting bits of this
patch - I may reply with comments but without any context.

Sorry.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Christian Gmeiner
2015-09-16 10:04 GMT+02:00 Russell King - ARM Linux :
> On Fri, Sep 11, 2015 at 04:10:13PM +0200, Lucas Stach wrote:
>> From: Christian Gmeiner 
>>
>> This is a squashed commit of the complete etnaviv DRM driver in order
>> to make it easy for people to review the code by seeing the driver as a
>> whole and is not intended for merging in this form.
>>
>> If you are interested in the history of individual commits:
>> git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream
>>
>> Signed-off-by: Christian Gmeiner 
>> Signed-off-by: Russell King 
>> Signed-off-by: Lucas Stach 
>
> Lucas,
>
> I know that the previous round, people said that they didn't like the
> individual patches posted, but squashing everything together into one
> patch is also not good.
>
> It would make more sense (at least for me) if you squashed the work
> that has already been done into one patch, and then post your updates
> as individual patches.  That way, Christian and myself can see what
> the changes are against some known without having to dig through your
> git tree, and those who complained about all the patches last time
> have fewer patches to look at.
>
> Expecting those in the project to page through thousands of lines that
> they already know about, hoping to spot the changes you've made is
> really very unreasonable and error prone.  I will _NOT_ be wasting my
> time reviewing this mega-patch exactly because of that.
>

Yep it quite hard to review it that way - I only had a look at the
user space <-> kernel space api/abi.

greets
--
Christian Gmeiner, MSc

https://soundcloud.com/christian-gmeiner


[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Christian Gmeiner
Hi Lucas


2015-09-11 16:10 GMT+02:00 Lucas Stach :
> From: Christian Gmeiner 
>
> This is a squashed commit of the complete etnaviv DRM driver in order
> to make it easy for people to review the code by seeing the driver as a
> whole and is not intended for merging in this form.
>
> If you are interested in the history of individual commits:
> git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream
>
> Signed-off-by: Christian Gmeiner 
> Signed-off-by: Russell King 
> Signed-off-by: Lucas Stach 
> ---
>  drivers/staging/Kconfig  |2 +
>  drivers/staging/Makefile |1 +
>  drivers/staging/etnaviv/Kconfig  |   20 +
>  drivers/staging/etnaviv/Makefile |   18 +
>  drivers/staging/etnaviv/cmdstream.xml.h  |  218 
>  drivers/staging/etnaviv/common.xml.h |  249 +
>  drivers/staging/etnaviv/etnaviv_buffer.c |  271 +
>  drivers/staging/etnaviv/etnaviv_cmd_parser.c |  119 +++
>  drivers/staging/etnaviv/etnaviv_drv.c|  705 +
>  drivers/staging/etnaviv/etnaviv_drv.h|  138 +++
>  drivers/staging/etnaviv/etnaviv_gem.c|  887 
>  drivers/staging/etnaviv/etnaviv_gem.h|  141 +++
>  drivers/staging/etnaviv/etnaviv_gem_prime.c  |  121 +++
>  drivers/staging/etnaviv/etnaviv_gem_submit.c |  421 
>  drivers/staging/etnaviv/etnaviv_gpu.c| 1468 
> ++
>  drivers/staging/etnaviv/etnaviv_gpu.h|  198 
>  drivers/staging/etnaviv/etnaviv_iommu.c  |  221 
>  drivers/staging/etnaviv/etnaviv_iommu.h  |   28 +
>  drivers/staging/etnaviv/etnaviv_iommu_v2.c   |   33 +
>  drivers/staging/etnaviv/etnaviv_iommu_v2.h   |   25 +
>  drivers/staging/etnaviv/etnaviv_mmu.c|  282 +
>  drivers/staging/etnaviv/etnaviv_mmu.h|   58 +
>  drivers/staging/etnaviv/state.xml.h  |  351 ++
>  drivers/staging/etnaviv/state_hi.xml.h   |  407 +++
>  include/uapi/drm/etnaviv_drm.h   |  215 
>  25 files changed, 6597 insertions(+)
>  create mode 100644 drivers/staging/etnaviv/Kconfig
>  create mode 100644 drivers/staging/etnaviv/Makefile
>  create mode 100644 drivers/staging/etnaviv/cmdstream.xml.h
>  create mode 100644 drivers/staging/etnaviv/common.xml.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_buffer.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_cmd_parser.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_drv.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_drv.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gem.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gem.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gem_prime.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gem_submit.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gpu.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_gpu.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu_v2.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_iommu_v2.h
>  create mode 100644 drivers/staging/etnaviv/etnaviv_mmu.c
>  create mode 100644 drivers/staging/etnaviv/etnaviv_mmu.h
>  create mode 100644 drivers/staging/etnaviv/state.xml.h
>  create mode 100644 drivers/staging/etnaviv/state_hi.xml.h
>  create mode 100644 include/uapi/drm/etnaviv_drm.h
>
> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> index 7f6cae5beb90..5446fe4859ce 100644
> --- a/drivers/staging/Kconfig
> +++ b/drivers/staging/Kconfig
> @@ -112,4 +112,6 @@ source "drivers/staging/fsl-mc/Kconfig"
>
>  source "drivers/staging/wilc1000/Kconfig"
>
> +source "drivers/staging/etnaviv/Kconfig"
> +
>  endif # STAGING
> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> index 347f6477aa3e..9fd3c06b6bfd 100644
> --- a/drivers/staging/Makefile
> +++ b/drivers/staging/Makefile
> @@ -48,3 +48,4 @@ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/
>  obj-$(CONFIG_FB_TFT)   += fbtft/
>  obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
>  obj-$(CONFIG_WILC1000) += wilc1000/
> +obj-$(CONFIG_DRM_ETNAVIV)  += etnaviv/
> diff --git a/drivers/staging/etnaviv/Kconfig b/drivers/staging/etnaviv/Kconfig
> new file mode 100644
> index ..6f034eda914c
> --- /dev/null
> +++ b/drivers/staging/etnaviv/Kconfig
> @@ -0,0 +1,20 @@
> +
> +config DRM_ETNAVIV
> +   tristate "etnaviv DRM"
> +   depends on DRM
> +   select SHMEM
> +   select TMPFS
> +   select IOMMU_API
> +   select IOMMU_SUPPORT
> +   default y
> +   help
> + DRM driver for Vivante GPUs.
> +
> +config DRM_ETNAVIV_REGISTER_LOGGING
> +   bool "etnaviv DRM register logging"
> +   depends on DRM_ETNAVIV
> +   default n
> +   help
> + Compile in support for logging register reads/writes in a format
> + that

[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Eric Anholt
Lucas Stach  writes:

> From: Christian Gmeiner 

> +static bool etnaviv_validate_load_state(struct etnaviv_gpu *gpu, u32 *buf,
> + unsigned int state, unsigned int num)
> +{
> + return true;
> + if (0x1200 - state < num * 4)
> + return false;
> + if (0x1228 - state < num * 4)
> + return false;
> + if (0x1238 - state < num * 4)
> + return false;
> + if (0x1284 - state < num * 4)
> + return false;
> + if (0x128c - state < num * 4)
> + return false;
> + if (0x1304 - state < num * 4)
> + return false;
> + if (0x1310 - state < num * 4)
> + return false;
> + if (0x1318 - state < num * 4)
> + return false;
> + if (0x1280c - state < num * 4 + 0x0c)
> + return false;
> + if (0x128ac - state < num * 4 + 0x0c)
> + return false;
> + if (0x128cc - state < num * 4 + 0x0c)
> + return false;
> + if (0x1297c - state < num * 4 + 0x0c)
> + return false;
> + return true;
> +}

I was browsing the code, and noticed that it looks like you've got a
debugging early return in your validation function here.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: 



[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Lucas Stach
Am Mittwoch, den 16.09.2015, 08:11 +0200 schrieb Christian Gmeiner:
> Hi Lucas
> 
> 
> 2015-09-11 16:10 GMT+02:00 Lucas Stach :
> > From: Christian Gmeiner 
> > 
> > This is a squashed commit of the complete etnaviv DRM driver in
> > order
> > to make it easy for people to review the code by seeing the driver
> > as a
> > whole and is not intended for merging in this form.
> > 
> > If you are interested in the history of individual commits:
> > git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream
> > 
> > Signed-off-by: Christian Gmeiner 
> > Signed-off-by: Russell King 
> > Signed-off-by: Lucas Stach 
> > ---

[...]

> > +/*
> > + * Cmdstream Submission:
> > + */
> > +
> > +/* The value written into the cmdstream is logically:
> > + * relocbuf->gpuaddr + reloc_offset
> > + *
> > + * NOTE that reloc's must be sorted by order of increasing
> > submit_offset,
> > + * otherwise EINVAL.
> > + */
> > +struct drm_etnaviv_gem_submit_reloc {
> > +   __u32 submit_offset;  /* in, offset from submit_bo */
> > +   __u32 reloc_idx;  /* in, index of reloc_bo buffer */
> > +   __u64 reloc_offset;   /* in, offset from start of reloc_bo
> > */
> > +};
> > +
> > +/* Each buffer referenced elsewhere in the cmdstream submit (ie.
> > the
> > + * cmdstream buffer(s) themselves or reloc entries) has one (and
> > only
> > + * one) entry in the submit->bos[] table.
> > + *
> > + * As a optimization, the current buffer (gpu virtual address) can
> > be
> > + * passed back through the 'presumed' field.  If on a subsequent
> > reloc,
> > + * userspace passes back a 'presumed' address that is still valid,
> > + * then patching the cmdstream for this entry is skipped.  This
> > can
> > + * avoid kernel needing to map/access the cmdstream bo in the
> > common
> > + * case.
> > + */
> > +#define ETNA_SUBMIT_BO_READ 0x0001
> > +#define ETNA_SUBMIT_BO_WRITE0x0002
> > +struct drm_etnaviv_gem_submit_bo {
> > +   __u32 flags;  /* in, mask of ETNA_SUBMIT_BO_x */
> > +   __u32 handle; /* in, GEM handle */
> > +   __u64 presumed;   /* in/out, presumed buffer address */
> > +};
> > +=
> 
> As presumed never gets used in the driver itself and I am not a big
> fan of it,
> can we remove it? Do you see any usecase for it?
> 
I think it could be useful to skip cmdstream patching on MMUv2. But to
be honest I don't know how much of a difference this will make, now
that we are operating on cached memory for the command stream as long
as possible. I'll try to get some performance profile, but at this
point I think it makes sense to get rid of it.

Regards
Lucas


[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Lucas Stach
Am Mittwoch, den 16.09.2015, 09:04 +0100 schrieb Russell King - ARM
Linux:
> On Fri, Sep 11, 2015 at 04:10:13PM +0200, Lucas Stach wrote:
> > From: Christian Gmeiner 
> > 
> > This is a squashed commit of the complete etnaviv DRM driver in
> > order
> > to make it easy for people to review the code by seeing the driver
> > as a
> > whole and is not intended for merging in this form.
> > 
> > If you are interested in the history of individual commits:
> > git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream
> > 
> > Signed-off-by: Christian Gmeiner 
> > Signed-off-by: Russell King 
> > Signed-off-by: Lucas Stach 
> 
> Lucas,
> 
> I know that the previous round, people said that they didn't like the
> individual patches posted, but squashing everything together into one
> patch is also not good.
> 
I still think it's useful for those that haven't looked at that code
yet.

> It would make more sense (at least for me) if you squashed the work
> that has already been done into one patch, and then post your updates
> as individual patches.  That way, Christian and myself can see what
> the changes are against some known without having to dig through your
> git tree, and those who complained about all the patches last time
> have fewer patches to look at.
> 
> Expecting those in the project to page through thousands of lines
> that
> they already know about, hoping to spot the changes you've made is
> really very unreasonable and error prone.  I will _NOT_ be wasting my
> time reviewing this mega-patch exactly because of that.
> 
Sure, I will follow up with a partially squashed version to get you the
changes from RFCv1. If you have any comments before that I'm totally
fine with you posting them out of context. I'll take care of mapping
them back to patches.

Regards,
Lucas


[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Russell King - ARM Linux
On Wed, Sep 16, 2015 at 11:05:11AM -0400, Eric Anholt wrote:
> Lucas Stach  writes:
> 
> > From: Christian Gmeiner 
> 
> > +static bool etnaviv_validate_load_state(struct etnaviv_gpu *gpu, u32 *buf,
> > +   unsigned int state, unsigned int num)
> > +{
> > +   return true;
...
> > +}
> 
> I was browsing the code, and noticed that it looks like you've got a
> debugging early return in your validation function here.

That's because it's not quite ready to be enabled yet - the code as
it stands in my tree doesn't have the infrastructure to validate that
a LOADSTATE which touches an address register (or similar) has a
relocation appropriately marked, due to the way things happen.
Hopefully, when the user/kernel API is sorted, this can be resolved.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-16 Thread Eric Anholt
Russell King - ARM Linux  writes:

> On Wed, Sep 16, 2015 at 11:05:11AM -0400, Eric Anholt wrote:
>> Lucas Stach  writes:
>> 
>> > From: Christian Gmeiner 
>> 
>> > +static bool etnaviv_validate_load_state(struct etnaviv_gpu *gpu, u32 *buf,
>> > +  unsigned int state, unsigned int num)
>> > +{
>> > +  return true;
> ...
>> > +}
>> 
>> I was browsing the code, and noticed that it looks like you've got a
>> debugging early return in your validation function here.
>
> That's because it's not quite ready to be enabled yet - the code as
> it stands in my tree doesn't have the infrastructure to validate that
> a LOADSTATE which touches an address register (or similar) has a
> relocation appropriately marked, due to the way things happen.
> Hopefully, when the user/kernel API is sorted, this can be resolved.

OK.  Validation code is painful to write, so I was just browsing what
was in here to see if I could pick up anything useful.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: 



[PATCH RFCv2 3/4] staging: etnaviv: add drm driver

2015-09-11 Thread Lucas Stach
From: Christian Gmeiner 

This is a squashed commit of the complete etnaviv DRM driver in order
to make it easy for people to review the code by seeing the driver as a
whole and is not intended for merging in this form.

If you are interested in the history of individual commits:
git://git.pengutronix.de/git/lst/linux.git etnaviv-for-upstream

Signed-off-by: Christian Gmeiner 
Signed-off-by: Russell King 
Signed-off-by: Lucas Stach 
---
 drivers/staging/Kconfig  |2 +
 drivers/staging/Makefile |1 +
 drivers/staging/etnaviv/Kconfig  |   20 +
 drivers/staging/etnaviv/Makefile |   18 +
 drivers/staging/etnaviv/cmdstream.xml.h  |  218 
 drivers/staging/etnaviv/common.xml.h |  249 +
 drivers/staging/etnaviv/etnaviv_buffer.c |  271 +
 drivers/staging/etnaviv/etnaviv_cmd_parser.c |  119 +++
 drivers/staging/etnaviv/etnaviv_drv.c|  705 +
 drivers/staging/etnaviv/etnaviv_drv.h|  138 +++
 drivers/staging/etnaviv/etnaviv_gem.c|  887 
 drivers/staging/etnaviv/etnaviv_gem.h|  141 +++
 drivers/staging/etnaviv/etnaviv_gem_prime.c  |  121 +++
 drivers/staging/etnaviv/etnaviv_gem_submit.c |  421 
 drivers/staging/etnaviv/etnaviv_gpu.c| 1468 ++
 drivers/staging/etnaviv/etnaviv_gpu.h|  198 
 drivers/staging/etnaviv/etnaviv_iommu.c  |  221 
 drivers/staging/etnaviv/etnaviv_iommu.h  |   28 +
 drivers/staging/etnaviv/etnaviv_iommu_v2.c   |   33 +
 drivers/staging/etnaviv/etnaviv_iommu_v2.h   |   25 +
 drivers/staging/etnaviv/etnaviv_mmu.c|  282 +
 drivers/staging/etnaviv/etnaviv_mmu.h|   58 +
 drivers/staging/etnaviv/state.xml.h  |  351 ++
 drivers/staging/etnaviv/state_hi.xml.h   |  407 +++
 include/uapi/drm/etnaviv_drm.h   |  215 
 25 files changed, 6597 insertions(+)
 create mode 100644 drivers/staging/etnaviv/Kconfig
 create mode 100644 drivers/staging/etnaviv/Makefile
 create mode 100644 drivers/staging/etnaviv/cmdstream.xml.h
 create mode 100644 drivers/staging/etnaviv/common.xml.h
 create mode 100644 drivers/staging/etnaviv/etnaviv_buffer.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_cmd_parser.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_drv.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_drv.h
 create mode 100644 drivers/staging/etnaviv/etnaviv_gem.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_gem.h
 create mode 100644 drivers/staging/etnaviv/etnaviv_gem_prime.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_gem_submit.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_gpu.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_gpu.h
 create mode 100644 drivers/staging/etnaviv/etnaviv_iommu.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_iommu.h
 create mode 100644 drivers/staging/etnaviv/etnaviv_iommu_v2.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_iommu_v2.h
 create mode 100644 drivers/staging/etnaviv/etnaviv_mmu.c
 create mode 100644 drivers/staging/etnaviv/etnaviv_mmu.h
 create mode 100644 drivers/staging/etnaviv/state.xml.h
 create mode 100644 drivers/staging/etnaviv/state_hi.xml.h
 create mode 100644 include/uapi/drm/etnaviv_drm.h

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 7f6cae5beb90..5446fe4859ce 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -112,4 +112,6 @@ source "drivers/staging/fsl-mc/Kconfig"

 source "drivers/staging/wilc1000/Kconfig"

+source "drivers/staging/etnaviv/Kconfig"
+
 endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 347f6477aa3e..9fd3c06b6bfd 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -48,3 +48,4 @@ obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/
 obj-$(CONFIG_FB_TFT)   += fbtft/
 obj-$(CONFIG_FSL_MC_BUS)   += fsl-mc/
 obj-$(CONFIG_WILC1000) += wilc1000/
+obj-$(CONFIG_DRM_ETNAVIV)  += etnaviv/
diff --git a/drivers/staging/etnaviv/Kconfig b/drivers/staging/etnaviv/Kconfig
new file mode 100644
index ..6f034eda914c
--- /dev/null
+++ b/drivers/staging/etnaviv/Kconfig
@@ -0,0 +1,20 @@
+
+config DRM_ETNAVIV
+   tristate "etnaviv DRM"
+   depends on DRM
+   select SHMEM
+   select TMPFS
+   select IOMMU_API
+   select IOMMU_SUPPORT
+   default y
+   help
+ DRM driver for Vivante GPUs.
+
+config DRM_ETNAVIV_REGISTER_LOGGING
+   bool "etnaviv DRM register logging"
+   depends on DRM_ETNAVIV
+   default n
+   help
+ Compile in support for logging register reads/writes in a format
+ that can be parsed by envytools demsm tool.  If enabled, register
+ logging can be switched on via etnaviv.reglog=y module param.
diff --git a/drivers/staging/etnaviv/Makefile b/drivers/staging/etnaviv/Makefile
new file mode 100644
index ..2b71c31b6