[PATCH v4 3/6] drm/dsi: Try to match non-DT dsi devices

2016-01-26 Thread Archit Taneja


On 1/21/2016 9:35 PM, Thierry Reding wrote:
> On Thu, Dec 10, 2015 at 06:11:37PM +0530, Archit Taneja wrote:
>> Add a device name field in mipi_dsi_device. This name is different from
>> the actual dev name (which is of the format "hostname.reg"). When the
>> device is created via DT, this name is set to the modalias string.
>
> Why? What's the use of setting this to the modalias string?

There is no use to set it in the DT case. It's just set for the sake
of consistency between the non-DT and DT devices. For now, dsi->name
is just used for device/driver matching for non-DT devices. There's
no harm in setting it to a valid name for DT devices.

>
>> In the non-DT case, the driver creating the DSI device provides the
>> name by populating a filed in mipi_dsi_device_info.
>>
>> Matching for DT case would be as it was before. For the non-DT case,
>> we compare the device and driver names. Other buses (like i2c/spi)
>
> "I2C" and "SPI", please.
>
>> perform a non-DT match by comparing the device name and entries in the
>> driver's id_table. Such a mechanism isn't used for the dsi bus.
>
> "DSI", please.
>
>>
>> Reviewed-by: Andrzej Hajda 
>> Signed-off-by: Archit Taneja 
>> ---
>>   drivers/gpu/drm/drm_mipi_dsi.c | 25 -
>>   include/drm/drm_mipi_dsi.h |  6 ++
>>   2 files changed, 30 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
>> index 9434585..5a46802 100644
>> --- a/drivers/gpu/drm/drm_mipi_dsi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
>> @@ -45,9 +45,26 @@
>>* subset of the MIPI DCS command set.
>>*/
>>
>> +static const struct device_type mipi_dsi_device_type;
>> +
>>   static int mipi_dsi_device_match(struct device *dev, struct device_driver 
>> *drv)
>>   {
>> -return of_driver_match_device(dev, drv);
>> +struct mipi_dsi_device *dsi;
>> +
>> +if (dev->type == &mipi_dsi_device_type)
>> +dsi = to_mipi_dsi_device(dev);
>> +else
>> +return 0;
>
> I think this check is redundant. I'm not aware of any case where the bus
> ->match() callback is called on a device that isn't on said bus.

You're right. I'll drop this.

>
>> +/* attempt OF style match */
>> +if (of_driver_match_device(dev, drv))
>> +return 1;
>> +
>> +/* compare dsi device and driver names */
>
> "DSI", please.
>
>> +if (!strcmp(dsi->name, drv->name))
>> +return 1;
>> +
>> +return 0;
>>   }
>>
>>   static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
>> @@ -125,6 +142,7 @@ struct mipi_dsi_device *mipi_dsi_device_new(struct 
>> mipi_dsi_host *host,
>>  dsi->dev.type = &mipi_dsi_device_type;
>>  dsi->dev.of_node = info->node;
>>  dsi->channel = info->reg;
>> +strlcpy(dsi->name, info->type, sizeof(dsi->name));
>
> Don't you need to check info->type != NULL before doing this?

It's not needed with the way struct mipi_dsi_device_info is currently
defined.

>
>>
>>  dev_set_name(&dsi->dev, "%s.%d", dev_name(host->dev), info->reg);
>>
>> @@ -148,6 +166,11 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, 
>> struct device_node *node)
>>  int ret;
>>  u32 reg;
>>
>> +if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
>> +dev_err(dev, "modalias failure on %s\n", node->full_name);
>> +return ERR_PTR(-EINVAL);
>> +}
>> +
>>  ret = of_property_read_u32(node, "reg", ®);
>>  if (ret) {
>>  dev_err(dev, "device node %s has no valid reg property: %d\n",
>> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
>> index 90f4f3c..cb084af 100644
>> --- a/include/drm/drm_mipi_dsi.h
>> +++ b/include/drm/drm_mipi_dsi.h
>> @@ -139,8 +139,11 @@ enum mipi_dsi_pixel_format {
>>  MIPI_DSI_FMT_RGB565,
>>   };
>>
>> +#define DSI_DEV_NAME_SIZE   20
>> +
>>   /**
>>* struct mipi_dsi_device_info - template for creating a mipi_dsi_device
>> + * @type: dsi peripheral chip type
>>* @reg: DSI virtual channel assigned to peripheral
>>* @node: pointer to OF device node
>>*
>> @@ -148,6 +151,7 @@ enum mipi_dsi_pixel_format {
>>* DSI device
>>*/
>>   struct mipi_dsi_device_info {
>> +char type[DSI_DEV_NAME_SIZE];
>
> Why limit ourselves to 20 characters? And why even so complicated? Isn't
> the type always static when someone specifies this? Couldn't we simply
> use a const char *name here instead?

In the case where the device is registered via DT, we would need
space allocated for 'type' to copy the modalias string into it.
Having const char *type would make it a bit complicated for the
DT path.

The mipi_dsi_device_info struct was based on
the i2c_board_info/spi_board_info structs, and they have
type/modalias members declared as array of chars. I kind of
followed suit without putting to much thought on member type.

Archit

>
> Thierry
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative

[Bug 93764] [PATCH] Fix building on musl-libc

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93764

Emil Velikov  changed:

   What|Removed |Added

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

--- Comment #3 from Emil Velikov  ---
All the fixes should be in master now. Thanks again and let us know if we ever
goof up on the musl front :-)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/74ccb1fe/attachment.html>


Problem with component helpers and probe deferral in 4.5-rc1

2016-01-26 Thread Russell King - ARM Linux
On Tue, Jan 26, 2016 at 05:59:13PM +, Jon Medhurst (Tixy) wrote:
> I believe I've found a problem with the component helpers and/or how
> drivers use them. I discovered this whilst trying to get ARM's HDLCD
> driver [1] working on 4.5-rc1, however I believe that code is following
> a pattern used by drivers already in 4.5 and the problem isn't specific
> to it. This is what I have observed...

Hmm, it all looks plausible, and I'm again left wondering how the code
passed testing over the last year (I've been running this code for
ages both on iMX6 and Dove, where deferred probing does happen.)

Your patch looks like the right thing to do, so I'll add it to the
component tree shortly - it should end up in linux-next in a few days
time.

Thanks.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH v4 2/6] drm/dsi: Refactor device creation

2016-01-26 Thread Archit Taneja


On 1/21/2016 9:16 PM, Thierry Reding wrote:
> On Thu, Dec 10, 2015 at 06:11:36PM +0530, Archit Taneja wrote:
>> Simplify the mipi dsi device creation process. device_initialize and
>
> "MIPI" and "DSI", please.

Sure, I'll replace with these and in the other patches.

>
>> device_add don't need to be called separately when creating
>> mipi_dsi_device's. Use device_register instead to simplify things.
>>
>> Create a helper function mipi_dsi_device_new which takes in struct
>> mipi_dsi_device_info and mipi_dsi_host. It clubs the functions
>> mipi_dsi_device_alloc and mipi_dsi_device_add into one.
>>
>> mipi_dsi_device_info acts as a template to populate the dsi device
>> information. This is populated by of_mipi_dsi_device_add and passed to
>> mipi_dsi_device_new.
>>
>> Later on, we'll provide mipi_dsi_device_new as a standalone way to create
>> a dsi device not available via DT.
>>
>> The new device creation process tries to closely follow what's been done
>> in i2c_new_device in i2c-core.
>>
>> Reviewed-by: Andrzej Hajda 
>> Signed-off-by: Archit Taneja 
>> ---
>>   drivers/gpu/drm/drm_mipi_dsi.c | 61 
>> +-
>>   include/drm/drm_mipi_dsi.h | 15 +++
>>   2 files changed, 40 insertions(+), 36 deletions(-)
>
> To be honest, I'm not sure I like this. If you want to have a simpler
> helper, why not implement it using the lower-level helpers. Really the
> only thing you're doing here is add a high-level helper that takes an
> info struct, whereas previously the same would be done by storing the
> info directly in the structure between allocation and addition of the
> device.
>
> Initially the implementation was following that of platform devices, I
> see no reason to deviate from that. What you want here can easily be

I don't see why we need to call device_initialize and device_add
separately for DSI devices. From my (limited) understanding, we should
call these separately if we want to take a reference (using 
get_device()), or set up some private data before the bus's
notifier kicks in.

Since the main purpose of the series is not to simplify the device
creation code, I can drop this.

> done by something like:
>
>   struct mipi_dsi_device *
>   mipi_dsi_device_register_full(struct mipi_dsi_host *host,
> const struct mipi_dsi_device_info *info)
>   {
>   struct mipi_dsi_device *dsi;
>
>   dsi = mipi_dsi_device_alloc(host);
>   if (IS_ERR(dsi))
>   return dsi;
>
>   dsi->dev.of_node = info->node;
>   dsi->channel = info->channel;
>
>   err = mipi_dsi_device_add(dsi);
>   if (err < 0) {
>   ...
>   }
>
>   return dsi;
>   }
>
> Thierry
>

This does look less intrusive. I'll consider switching to this.

Thanks,
Archit

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


[PATCH] Fix building on musl-libc

2016-01-26 Thread Emil Velikov
On 20 January 2016 at 03:34, Kylie McClain  wrote:
> libdrm git master fails to compile due to undefined functions/constants
> on musl libc. The attached patches fix it. (I've attached them rather than
> included them in the message since gmail is really bad about ruining patch
> formatting.)
>
> I originally posted these to 
> https://bugs.freedesktop.org/show_bug.cgi?id=93764
> in a different form, and have modified them to Emil's comments on the
> bugzilla entry.
>
> commit 6ec5d220184e46135109923d252ae619068b7eb2
> Author: Kylie McClain 
> Date:   Tue Jan 19 22:27:28 2016 -0500
>
> tests: Include poll.h rather than sys/poll.h
>
> sys/poll.h is a non-standard location of the poll.h header, and is
> incorrect on non-glibc libcs. poll.h, however, is defined in SUS (v2)
> and is more portable.
>
> http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.h.html
>
> commit 6e7f12f1977bd13d10d99bc7826c54b692284c38
> Author: Kylie McClain 
> Date:   Tue Jan 19 22:24:15 2016 -0500
>
> kms-steal-crtc: Make use of sys/select.h if available
>
> On systems using musl libc, FD_ZERO, FD_SET, select, etc. are defined
> in sys/select.h. This behavior is defined in IEEE Std 1003.1, 2000,
> http://pubs.opengroup.org/onlinepubs/009696899/basedefs/sys/select.h.html
> and fixes building kms-steal-crtc on musl libc systems.

Thanks for the patches Kyle. I've scooped the poll.h one and picked a
slightly more extensive fix for the other issue by Raj.

-Emil


[RESEND,V2] drm: fsl-dcu: Fix no fb check bug

2016-01-26 Thread Emil Velikov
On 14 January 2016 at 08:23, Meng Yi  wrote:
>> >> switch (fb->pixel_format) {
>> >> case DRM_FORMAT_RGB565:
>> >> case DRM_FORMAT_RGB888:
>> >> @@ -85,9 +88,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct
>> drm_plane *plane,
>> >> unsigned int alpha, bpp;
>> >> int index, ret;
>> >>
>> >> -   if (!fb)
>> >> -   return;
>> >> -
>> > ... which no longer has the !fb check, and we'll crash with null deref
>> > a few lines below ?
>>
>>
>> If there is a legitimate situation where fb is null which also ultimately 
>> leads to a
>> atomic_commit, I guess we should keep the return here...
>
> I think I made a mistake here, fb check should not be removed . As Stefan 
> mentioned, if fb check in fsl_dcu_drm_plane_atomic_check return 0, 
> fsl_dcu_drm_plane_atomic_update will ultimately called, and we'll crash since 
> plane->state->fb is NULL.
>
I believe you meant "Emil" in the above ;-) But seriously... afaict a
fair few drivers do a similar !fb (even !state->crtc) check(s)...
which makes me wonder if core DRM isn't the better place for it ? Or
perhaps that's intentional as core provides the flexibility for each
driver to mangle with the fb between .check and .disable ?

Cheers
Emil

P.S. Please don't top post, use interleaved style [1]

[1] https://en.wikipedia.org/wiki/Posting_style#Interleaved_style


[PATCH V2] tests: Include sys/select.h

2016-01-26 Thread Emil Velikov
Hi Raj,

On 20 January 2016 at 05:35, Khem Raj  wrote:
> Used in compliance with POSIX 2001/2008
>
> Fixes errors e.g.
> error: implicit declaration of function 'select'
>
> and helps with missing definitions of FD_* defines
>
Thanks for updating the patch. I've added a line of commit history and
I'll push this shortly.

-Emil


[PATCH libdrm] tests: util: Fixup util_open() parameter order

2016-01-26 Thread Emil Velikov
On 5 January 2016 at 14:21, Thierry Reding  wrote:
> From: Thierry Reding 
>
> util_open() takes a device parameter, followed by a module parameter.
> The existing tests used the drmOpen() function, which uses a different
> ordering of the parameters, and the old ordering was accidentally kept
> during the conversion.
>
> Signed-off-by: Thierry Reding 
> ---
> Evidently I didn't properly test this. Things do work in most cases
> with the current code because of the auto-detection, but there will
> be cases where it fails.
>
Having the module name identical to the device name also helps ;-)
But seriously - nicely spotted. I'll going through the list and I'll
push this out shortly.

-Emil


Re: [PATCH libdrm] Synchronize drm/drm_fourcc.h with Linux’ version

2016-01-26 Thread Emil Velikov
On 11 January 2016 at 19:32, Emmanuel Gil Peyrot
 wrote:
> This adds R8, RG88 and GR88, as well as the non-subsampled NV24/NV42 formats.
>
Err... please don't copy/paste 'random' hunks here. These headers
should be imported from the kernel with the commit message mentioning
the sha of their origin.

I've been procrastinating^Wwaiting on some upstream changes to land
and with those in place I'll update the Makefile to import things
properly.

-Emil


[PATCH libdrm 2/2] tests: add fsl-dcu-drm to modules

2016-01-26 Thread Emil Velikov
On 20 December 2015 at 05:52, Stefan Agner  wrote:
> Signed-off-by: Stefan Agner 
> ---
>  tests/util/kms.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tests/util/kms.c b/tests/util/kms.c
> index 57b0191..dcd5a8e 100644
> --- a/tests/util/kms.c
> +++ b/tests/util/kms.c
> @@ -139,6 +139,7 @@ static const char * const modules[] = {
> "imx-drm",
> "rockchip",
> "atmel-hlcdc",
> +   "fsl-dcu-drm",

Thanks for the patches Stefan. I'll do a quick test and push them out shortly.
Although please take a look at adding platform device support to the
drm*Device API - if anything is unclear do ask. I won't bite :-)

-Emil


[PATCH v4 1/6] drm/dsi: check for CONFIG_OF when defining of_mipi_dsi_device_add

2016-01-26 Thread Archit Taneja


On 1/21/2016 9:01 PM, Thierry Reding wrote:
> On Thu, Dec 10, 2015 at 06:11:35PM +0530, Archit Taneja wrote:
>> of_mipi_dsi_device_add is used only when CONFIG_OF is enabled. It
>> currently works if OF support is disabled, but this will change
>> when we add more functionality to it.
>>
>> Define the original func if CONFIG_OF is enabled. Define a dummy func
>> otherwise.
>>
>> Signed-off-by: Archit Taneja 
>> ---
>>   drivers/gpu/drm/drm_mipi_dsi.c | 8 
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
>> index 2d5ca8ee..bced235 100644
>> --- a/drivers/gpu/drm/drm_mipi_dsi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
>> @@ -129,6 +129,7 @@ static int mipi_dsi_device_add(struct mipi_dsi_device 
>> *dsi)
>>  return device_add(&dsi->dev);
>>   }
>>
>> +#if IS_ENABLED(CONFIG_OF)
>>   static struct mipi_dsi_device *
>>   of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node 
>> *node)
>>   {
>> @@ -170,6 +171,13 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, 
>> struct device_node *node)
>>
>>  return dsi;
>>   }
>> +#else
>> +static struct mipi_dsi_device *
>> +of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
>> +{
>> +return NULL;
>> +}
>> +#endif
>
> The OF implementation of this function never returns NULL, so perhaps
> this should return an ERR_PTR()-encoded error code instead? This isn't
> really important because we never check the return value in the one
> call-site that we have, which I guess could be an argument for removing
> the return value altogether...

You're right. I'll replace this with ERR_PTR(-ENODEV). Maybe we could
keep the return value in case we use it in the future.

Thanks,
Archit

>
> Thierry
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


[PATCH v2 3/3] drm/etnaviv: call correct function when trying to vmap a DMABUF

2016-01-26 Thread Lucas Stach
When trying to get the vmap address of an imported buffer, we must
call into the appropriate helper function, to allow the exporter to
establish the vmap, instead of trying to vmap the buffer on our own.

Add an indirection through etnaviv_gem_ops to allow the correct
implementation to be called.

Signed-off-by: Lucas Stach 
---
 drivers/gpu/drm/etnaviv/etnaviv_gem.c   | 36 -
 drivers/gpu/drm/etnaviv/etnaviv_gem.h   |  1 +
 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c |  8 +++
 3 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index 1da3d48054c2..4b519e4309b2 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -357,23 +357,35 @@ void *etnaviv_gem_vmap(struct drm_gem_object *obj)
 {
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);

-   mutex_lock(&etnaviv_obj->lock);
-   if (!etnaviv_obj->vaddr) {
-   struct page **pages = etnaviv_gem_get_pages(etnaviv_obj);
-
-   if (IS_ERR(pages)) {
-   mutex_unlock(&etnaviv_obj->lock);
-   return NULL;
-   }
+   if (etnaviv_obj->vaddr)
+   return etnaviv_obj->vaddr;

-   etnaviv_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
-   VM_MAP, pgprot_writecombine(PAGE_KERNEL));
-   }
+   mutex_lock(&etnaviv_obj->lock);
+   /*
+* Need to check again, as we might have raced with another thread
+* while waiting for the mutex.
+*/
+   if (!etnaviv_obj->vaddr)
+   etnaviv_obj->vaddr = etnaviv_obj->ops->vmap(etnaviv_obj);
mutex_unlock(&etnaviv_obj->lock);

return etnaviv_obj->vaddr;
 }

+static void *etnaviv_gem_vmap_impl(struct etnaviv_gem_object *obj)
+{
+   struct page **pages;
+
+   lockdep_assert_held(&obj->lock);
+
+   pages = etnaviv_gem_get_pages(obj);
+   if (IS_ERR(pages))
+   return NULL;
+
+   return vmap(pages, obj->base.size >> PAGE_SHIFT,
+   VM_MAP, pgprot_writecombine(PAGE_KERNEL));
+}
+
 static inline enum dma_data_direction etnaviv_op_to_dma_dir(u32 op)
 {
if (op & ETNA_PREP_READ)
@@ -524,6 +536,7 @@ static void etnaviv_gem_shmem_release(struct 
etnaviv_gem_object *etnaviv_obj)
 static const struct etnaviv_gem_ops etnaviv_gem_shmem_ops = {
.get_pages = etnaviv_gem_shmem_get_pages,
.release = etnaviv_gem_shmem_release,
+   .vmap = etnaviv_gem_vmap_impl,
 };

 void etnaviv_gem_free_object(struct drm_gem_object *obj)
@@ -868,6 +881,7 @@ static void etnaviv_gem_userptr_release(struct 
etnaviv_gem_object *etnaviv_obj)
 static const struct etnaviv_gem_ops etnaviv_gem_userptr_ops = {
.get_pages = etnaviv_gem_userptr_get_pages,
.release = etnaviv_gem_userptr_release,
+   .vmap = etnaviv_gem_vmap_impl,
 };

 int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h 
b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
index a300b4b3d545..ab5df8147a5f 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
@@ -78,6 +78,7 @@ struct etnaviv_gem_object *to_etnaviv_bo(struct 
drm_gem_object *obj)
 struct etnaviv_gem_ops {
int (*get_pages)(struct etnaviv_gem_object *);
void (*release)(struct etnaviv_gem_object *);
+   void *(*vmap)(struct etnaviv_gem_object *);
 };

 static inline bool is_active(struct etnaviv_gem_object *etnaviv_obj)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
index 9c054b6c24d6..4e67395f5fa1 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
@@ -77,9 +77,17 @@ static void etnaviv_gem_prime_release(struct 
etnaviv_gem_object *etnaviv_obj)
drm_prime_gem_destroy(&etnaviv_obj->base, etnaviv_obj->sgt);
 }

+static void *etnaviv_gem_prime_vmap_impl(struct etnaviv_gem_object 
*etnaviv_obj)
+{
+   lockdep_assert_held(&etnaviv_obj->lock);
+
+   return dma_buf_vmap(etnaviv_obj->base.import_attach->dmabuf);
+}
+
 static const struct etnaviv_gem_ops etnaviv_gem_prime_ops = {
/* .get_pages should never be called */
.release = etnaviv_gem_prime_release,
+   .vmap = etnaviv_gem_prime_vmap_impl,
 };

 struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device 
*dev,
-- 
2.7.0.rc3



[PATCH v2 2/3] drm/etnaviv: rename etnaviv_gem_vaddr to etnaviv_gem_vmap

2016-01-26 Thread Lucas Stach
This function follows the semantics of vmap() by returning
NULL in case of an error. To make things less confusing
rename it to make make both functions more closely related.

Signed-off-by: Lucas Stach 
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.h   | 2 +-
 drivers/gpu/drm/etnaviv/etnaviv_dump.c  | 2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem.c   | 2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.h 
b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
index d6bd438bd5be..1cd6046e76b1 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
@@ -85,7 +85,7 @@ struct drm_gem_object 
*etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
struct dma_buf_attachment *attach, struct sg_table *sg);
 int etnaviv_gem_prime_pin(struct drm_gem_object *obj);
 void etnaviv_gem_prime_unpin(struct drm_gem_object *obj);
-void *etnaviv_gem_vaddr(struct drm_gem_object *obj);
+void *etnaviv_gem_vmap(struct drm_gem_object *obj);
 int etnaviv_gem_cpu_prep(struct drm_gem_object *obj, u32 op,
struct timespec *timeout);
 int etnaviv_gem_cpu_fini(struct drm_gem_object *obj);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c 
b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
index 09a759e69dd2..4a29eeadbf1e 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
@@ -215,7 +215,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)

iter.hdr->iova = cpu_to_le64(vram->iova);

-   vaddr = etnaviv_gem_vaddr(&obj->base);
+   vaddr = etnaviv_gem_vmap(&obj->base);
if (vaddr)
memcpy(iter.data, vaddr, obj->base.size);

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index b22712fdd31e..1da3d48054c2 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -353,7 +353,7 @@ void etnaviv_gem_put_iova(struct etnaviv_gpu *gpu, struct 
drm_gem_object *obj)
drm_gem_object_unreference_unlocked(obj);
 }

-void *etnaviv_gem_vaddr(struct drm_gem_object *obj)
+void *etnaviv_gem_vmap(struct drm_gem_object *obj)
 {
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
index e94db4f95770..9c054b6c24d6 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
@@ -31,7 +31,7 @@ struct sg_table *etnaviv_gem_prime_get_sg_table(struct 
drm_gem_object *obj)

 void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj)
 {
-   return etnaviv_gem_vaddr(obj);
+   return etnaviv_gem_vmap(obj);
 }

 void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
-- 
2.7.0.rc3



[PATCH v2 1/3] drm/etnaviv: fix get pages error path in etnaviv_gem_vaddr

2016-01-26 Thread Lucas Stach
In case that etnaviv_gem_get_pages is unable to get the required
pages the object mutex needs to be unlocked. Also return NULL in
this case instead of propagating the error, as callers of this
function might not be prepared to handle a pointer error, but
expect this call to follow the semantics of a plain vmap to return
NULL in case of an error.

Signed-off-by: Lucas Stach 
---
 drivers/gpu/drm/etnaviv/etnaviv_dump.c | 2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem.c  | 6 --
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c 
b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
index fd7d3e989e79..09a759e69dd2 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
@@ -216,7 +216,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
iter.hdr->iova = cpu_to_le64(vram->iova);

vaddr = etnaviv_gem_vaddr(&obj->base);
-   if (vaddr && !IS_ERR(vaddr))
+   if (vaddr)
memcpy(iter.data, vaddr, obj->base.size);

etnaviv_core_dump_header(&iter, ETDUMP_BUF_BO, iter.data +
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index 9f77c3b94cc6..b22712fdd31e 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -361,8 +361,10 @@ void *etnaviv_gem_vaddr(struct drm_gem_object *obj)
if (!etnaviv_obj->vaddr) {
struct page **pages = etnaviv_gem_get_pages(etnaviv_obj);

-   if (IS_ERR(pages))
-   return ERR_CAST(pages);
+   if (IS_ERR(pages)) {
+   mutex_unlock(&etnaviv_obj->lock);
+   return NULL;
+   }

etnaviv_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
VM_MAP, pgprot_writecombine(PAGE_KERNEL));
-- 
2.7.0.rc3



[PATCH 09/11] dma-buf/sync_timeline: de-stage sync_timeline

2016-01-26 Thread Gustavo Padovan
2016-01-26 Gustavo Padovan :

> From: Gustavo Padovan 
> 
> De-stage the remaining bit of sync framework: sync_timeline and sw_sync
> plus some debugging routines.
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/dma-buf/Kconfig|  10 +
>  drivers/dma-buf/Makefile   |   3 +-
>  drivers/dma-buf/sw_sync.h  |  32 +++
>  drivers/dma-buf/sync_debug.c   | 374 
> +
>  drivers/dma-buf/sync_debug.h   |  35 +++
>  drivers/dma-buf/sync_timeline.c| 222 +++
>  drivers/staging/android/Kconfig|  20 --
>  drivers/staging/android/sync.c | 221 ---
>  drivers/staging/android/sync.h | 130 
>  drivers/staging/android/sync_debug.c   | 373 
>  drivers/staging/android/trace/sync.h   |  32 ---
>  drivers/staging/android/uapi/sw_sync.h |  32 ---
>  include/linux/sync_timeline.h  | 114 ++
>  include/trace/events/sync_timeline.h   |  31 +++
>  14 files changed, 820 insertions(+), 809 deletions(-)
>  create mode 100644 drivers/dma-buf/sw_sync.h
>  create mode 100644 drivers/dma-buf/sync_debug.c
>  create mode 100644 drivers/dma-buf/sync_debug.h
>  create mode 100644 drivers/dma-buf/sync_timeline.c
>  delete mode 100644 drivers/staging/android/sync.c
>  delete mode 100644 drivers/staging/android/sync.h
>  delete mode 100644 drivers/staging/android/sync_debug.c
>  delete mode 100644 drivers/staging/android/trace/sync.h
>  delete mode 100644 drivers/staging/android/uapi/sw_sync.h
>  create mode 100644 include/linux/sync_timeline.h
>  create mode 100644 include/trace/events/sync_timeline.h

Seems I forgot git format-patch -M. I'll resend the series.

Gustavo


[BUG/REGRESSION] Kernel 4.5-rc1 on Acube Sam460ex AMCC 460ex Power PC motherboards

2016-01-26 Thread Dan Williams
On Mon, Jan 25, 2016 at 12:35 PM, Julian Margetson  wrote:
> On 1/25/2016 3:20 PM, Dan Williams wrote:
[..]
> Hmm, this commit could only cause a behavior change if it modifies the
> value of the pfn as seen by insert_pfn().  Can you try the attached
> debug patch to see if that assumption is being violated?
>
> Had to manually delete the lines in the second part of the patch.

Sorry about that I had based direct on that failing commit rather than
4.5-rc1.  A reflowed version in the attached.

> [   42.557813] Oops: Machine check, sig: 7 [#1]
> [   42.562350] PREEMPT Canyonlands
> [   42.565692] Modules linked in:
> [   42.568933] CPU: 0 PID: 495 Comm: Xorg Tainted: GW
> 4.5.0-rc1-Sam460ex #1
> [   42.577291] task: ee3adcc0 ti: ee26 task.ti: ee26
> [   42.582984] NIP: 1ff72480 LR: 1ff72404 CTR: 1ff724d0
> [   42.588220] REGS: ee261f10 TRAP: 0214   Tainted: GW
> (4.5.0-rc1-Sam460ex)
> [   42.596663] MSR: 0002d000   CR: 24004242  XER: 
> [   42.603512]
> GPR00: 1f436134 bfc4dac0 b79cb6f0 b718dffc b69a4008 0780 0004
> 
> GPR08:  b718dffc  bfc4da70 1ff72404 2080dff4 
> 0780
> GPR16:  0020   1e00 20aaa620 0438
> b69a4008
> GPR24: 0780 bfc4db18 20a94760 b718e000 b718e000 b69a4008 2007aff4
> 1e00
> [   42.635363] NIP [1ff72480] 0x1ff72480
> [   42.639225] LR [1ff72404] 0x1ff72404
> [   42.642991] Call Trace:
> [   42.798393] ---[ end trace 8fcfa5f0e9942055 ]---

I'm not familiar with powerpc crash dumps, so there's not much
information I can glean from this.  Any folks on the cc can translate
a powerpc "Machine check"?

I'm down to looking a differences between the passing and failing
case.  Can you print out the value the pte entry and the in
insert_pfn, like the following:

diff --git a/mm/memory.c b/mm/memory.c
index 30991f83d0bf..c44e387130b2 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1521,6 +1521,8 @@ static int insert_pfn(struct vm_area_struct
*vma, unsigned long addr,
   entry = pte_mkdevmap(pfn_t_pte(pfn, prot));
   else
   entry = pte_mkspecial(pfn_t_pte(pfn, prot));
+   pr_info("%s: entry: %#llx pfn: %#lx\n", __func__,
+   (unsigned long long) entry, pfn_t_to_pfn(pfn));
   set_pte_at(mm, addr, pte, entry);
   update_mmu_cache(vma, addr, pte); /* XXX: why not for insert_page? */

...of course for the passing case you'll need to drop the call to
pfn_t_to_pfn() and just print the pfn directly.

Thank you for the help tracking this down, it's much appreciated.
-- next part --
A non-text attachment was scrubbed...
Name: pfn-debug.patch
Type: text/x-patch
Size: 1477 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/0394bc53/attachment.bin>


[PATCH v7 0/2] Add Rockchip Inno-HDMI driver

2016-01-26 Thread Caesar Wang
Hi,

在 2016年01月26日 10:59, Yakir Yang 写道:
> Here are a brief introduction to Innosilicon HDMI IP:
>- Support HDMI 1.4a, HDCP 1.2 and DVI 1.0 standard compliant transmitter
>- Support HDMI1.4 a/b 3D function defined in HDMI 1.4 a/b spec
>- Digital video interface supports a pixel size of 24, 30, 36, 48bits 
> color depth in RGB
>- S/PDIF output supports PCM, Dolby Digital, DTS digital audio transmission
>  (32-192kHz Fs) using IEC60958 and IEC 61937
>- The EDID and CEC function are also supported by Innosilicon HDMI 
> Transmitter Controlle
>
> Changes in v7:
> - Correct the module licnese statement (Paul)
>   - MODULE_LICENSE("GPL");
>   + MODULE_LICENSE("GPL v2");
> - Start indentation with tabs and fix the misspell in Kconfig (Paul)
> - Carry the lost device-binding document (Heiko)
>
> Changes in v6:
> - Rebase the Makefile/Kconfig files which add by Chris's rockchip-mipi driver 
> (Caeser)
>
> Changes in v5:
> - Use hdmi_infoframe helper functions to packed the infoframe (Russell)
> - Remove the unused double wait_for_completion_timeout for ddc transfer 
> (Russell)
> - Remove the unused local variable in "inno_hdmi_i2c_write()" function 
> (Russell)
>
> Changes in v4:
> - Modify the commit title "drm/rockchip: hdmi: ..." (Mark)
> - Correct the "DKMS" to "DPMS" (Mark)
> - Fix over 80 characters problems (Mark)
> - Remove encoder .prepare/.commit helper functions, and move the vop mode
> configure function into encoder .enable helper functions. (Mark)
>
> Changes in v3:
> - Use encoder enable/disable function, and remove the encoder DPMS function
> - Keep HDMI PLL power on in standby mode
>
> Changes in v2:
> - Using DRM atomic helper functions for connector init (Mark)
> - Remove "hdmi->connector.encoder = encoder;" (Mark)
> - Add the Acked-by tags from Rob
> - Correct the misspell "rk3036-dw-hdmi" (Heiko)
>
> Yakir Yang (2):
>drm/rockchip: hdmi: add Innosilicon HDMI support
>dt-bindings: add document for Innosilicon HDMI on Rockchip platform
>
>   .../display/rockchip/inno_hdmi-rockchip.txt|  50 ++
>   drivers/gpu/drm/rockchip/Kconfig   |   8 +
>   drivers/gpu/drm/rockchip/Makefile  |   1 +
>   drivers/gpu/drm/rockchip/inno_hdmi.c   | 941 
> +
>   drivers/gpu/drm/rockchip/inno_hdmi.h   | 362 
>   5 files changed, 1362 insertions(+)
>   create mode 100644 
> Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt
>   create mode 100644 drivers/gpu/drm/rockchip/inno_hdmi.c
>   create mode 100644 drivers/gpu/drm/rockchip/inno_hdmi.h
The inno hdmi driver is verified by on my work branch.
(https://github.com/Caesar-github/rockchip/commits/kylin/next)

929605e arm: config: support the inno hdmi for rk3036 SoCs
aac426e FROMLIST: ARM: dts: rockchip: add hdmi/vop device node for rk3036
7d96943 FROMLIST: dt-bindings: add document for Innosilicon HDMI on 
Rockchip platform
f7751f2 FROMLIST: drm/rockchip: hdmi: add Innosilicon HDMI support



>


-- 
Thanks,
Caesar



[PATCH] mm: fix pfn_t to page conversion in vm_insert_mixed

2016-01-26 Thread Julian Margetson
On 1/26/2016 4:34 PM, Dan Williams wrote:
> On Tue, Jan 26, 2016 at 11:46 AM, Julian Margetson  
> wrote:
>> On 1/26/2016 2:37 PM, Dan Williams wrote:
>>
>> pfn_t_to_page() honors the flags in the pfn_t value to determine if a
>> pfn is backed by a page.  However, vm_insert_mixed() was originally
>> written to use pfn_valid() to make this determination.  To restore the
>> old/correct behavior, ignore the pfn_t flags in the !pfn_t_devmap() case
>> and fallback to trusting pfn_valid().
>>
>> Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
>> Cc: Dave Hansen 
>> Cc: David Airlie 
>> Reported-by: Julian Margetson 
>> Reported-by: Tomi Valkeinen 
>> Signed-off-by: Dan Williams 
>> ---
>>   mm/memory.c |9 +++--
>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/memory.c b/mm/memory.c
>> index 30991f83d0bf..93ce37989471 100644
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -1591,10 +1591,15 @@ int vm_insert_mixed(struct vm_area_struct *vma,
>> unsigned long addr,
>>* than insert_pfn).  If a zero_pfn were inserted into a VM_MIXEDMAP
>>* without pte special, it would there be refcounted as a normal page.
>>*/
>> - if (!HAVE_PTE_SPECIAL && pfn_t_valid(pfn)) {
>> + if (!HAVE_PTE_SPECIAL && !pfn_t_devmap(pfn) && pfn_t_valid(pfn)) {
>>struct page *page;
>>
>> - page = pfn_t_to_page(pfn);
>> + /*
>> + * At this point we are committed to insert_page()
>> + * regardless of whether the caller specified flags that
>> + * result in pfn_t_has_page() == false.
>> + */
>> + page = pfn_to_page(pfn_t_to_pfn(pfn));
>>return insert_page(vma, addr, page, vma->vm_page_prot);
>>}
>>return insert_pfn(vma, addr, pfn, vma->vm_page_prot);
>>
>>
>>
>> [   16.503323] systemd[1]: Mounting FUSE Control File System...
>> [   42.703092] Oops: Machine check, sig: 7 [#1]
>> [   42.707624] PREEMPT Canyonlands
>> [   42.710959] Modules linked in:
>> [   42.714201] CPU: 0 PID: 553 Comm: Xorg Not tainted 4.5.0-rc1-Sam460ex #1
>> [   42.721283] task: ee1e45c0 ti: ecd46000 task.ti: ecd46000
>> [   42.726983] NIP: 1fed2480 LR: 1fed2404 CTR: 1fed24d0
>> [   42.732227] REGS: ecd47f10 TRAP: 0214   Not tainted  (4.5.0-rc1-Sam460ex)
>> [   42.739395] MSR: 0002d000   CR: 28004262  XER: 
>> [   42.746244]
>> GPR00: 1f396134 bfcb0970 b77fc6f0 b6fbeffc b67d5008 0780 0004
>> 
>> GPR08:  b6fbeffc  bfcb0920 1fed2404 2076dff4 
>> 0780
>> GPR16:  0020   1e00 209be650 0438
>> b67d5008
>> GPR24: 0780 bfcb09c8 209a8728 b6fbf000 b6fbf000 b67d5008 1ffdaff4
>> 1e00
>> [   42.778096] NIP [1fed2480] 0x1fed2480
>> [   42.781967] LR [1fed2404] 0x1fed2404
>> [   42.785741] Call Trace:
>> [   42.943688] ---[ end trace 5d20a91d2d30d9d6 ]---
>> [   42.948311]
>> [   46.641774] Machine check in kernel mode.
>> [   46.645805] Data Write PLB Error
>> [   46.649031] Machine Check exception is imprecise
>> [   46.653658] Vector: 214  at [eccfbf10]
>> [   46.657408] pc: 1ffa9480
>> [   46.660325] lr: 1ffa9404
>> [   46.663241] sp: bf9252b0
>> [   46.666123]msr: 2d000
>> [   46.668746]   current = 0xee1e73c0
>> [   46.672149] pid   = 663, comm = Xorg
>> [   46.676074] Linux version 4.5.0-rc1-Sam460ex (root at julian-VirtualBox)
> Ok, I think the patch is still needed for the issue Tomi reported,
> this appears to be a separate bug.
>
> Can you send me your kernel config?
>
>

-- next part --
#
# Automatically generated file; DO NOT EDIT.
# Linux/powerpc 4.5.0-rc1 Kernel Configuration
#
# CONFIG_PPC64 is not set

#
# Processor support
#
# CONFIG_PPC_BOOK3S_32 is not set
# CONFIG_PPC_85xx is not set
# CONFIG_PPC_8xx is not set
# CONFIG_40x is not set
CONFIG_44x=y
# CONFIG_E200 is not set
CONFIG_PPC_FPU=y
CONFIG_4xx=y
CONFIG_BOOKE=y
CONFIG_PTE_64BIT=y
CONFIG_PHYS_64BIT=y
CONFIG_PPC_MMU_NOHASH=y
# CONFIG_PPC_MM_SLICES is not set
CONFIG_NOT_COHERENT_CACHE=y
# CONFIG_PPC_DOORBELL is not set
CONFIG_VDSO32=y
CONFIG_CPU_BIG_ENDIAN=y
CONFIG_PPC32=y
CONFIG_32BIT=y
CONFIG_WORD_SIZE=32
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_MMU=y
# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
CONFIG_NR_IRQS=512
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK=y
CONFIG_PPC=y
# CONFIG_GENERIC_CSUM is not set
CONFIG_EARLY_PRINTK=y
CONFIG_PANIC_TIMEOUT=180
CONFIG_GENERIC_NVRAM=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_UDBG_16550=y
# CONFIG_GENERIC_TBSYNC is not set
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
# CONFIG_EPAPR_BOOT is not set
# CONFIG_DEFAULT_UIMAGE is not set
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_PPC_DCR_NATIVE=y
# CONFIG_PPC_DCR_MMIO is not set
CONFIG_PPC_DCR=y
CONFIG_ARCH_SUPPORTS_DEBU

[PATCH 2/2] drm/etnaviv: call correct function when trying to vmap a DMABUF

2016-01-26 Thread Russell King - ARM Linux
On Tue, Jan 26, 2016 at 04:45:26PM +0100, Lucas Stach wrote:
> When trying to get the vmap address of an imported buffer, we must
> call into the appropriate helper function, to allow the exporter to
> establish the vmap, instead of trying to vmap the buffer on our own.

Rather than this way, please add a vmap() method to struct etnaviv_gem_ops
and indirect through that.

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH 1/2] drm/etnaviv: fix get pages error path in etnaviv_gem_vaddr

2016-01-26 Thread Russell King - ARM Linux
On Tue, Jan 26, 2016 at 04:45:25PM +0100, Lucas Stach wrote:
> In case that etnaviv_gem_get_pages is unable to get the required
> pages the object mutex needs to be unlocked. Also return NULL in
> this case instead of propagating the error, as callers of this
> function might not be prepared to handle a pointer error, but
> expect this call to follow the semantics of a plain vmap to return
> NULL in case of an error.

If we're giving it vmap() semantics, then let's add another patch
which calls this function etnaviv_gem_vmap()...

-- 
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH 2/2] drm/etnaviv: call correct function when trying to vmap a DMABUF

2016-01-26 Thread Lucas Stach
When trying to get the vmap address of an imported buffer, we must
call into the appropriate helper function, to allow the exporter to
establish the vmap, instead of trying to vmap the buffer on our own.

Signed-off-by: Lucas Stach 
---
 drivers/gpu/drm/etnaviv/etnaviv_gem.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index b22712fdd31e..ce458d8473fe 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -14,6 +14,7 @@
  * this program.  If not, see .
  */

+#include 
 #include 
 #include 

@@ -357,8 +358,14 @@ void *etnaviv_gem_vaddr(struct drm_gem_object *obj)
 {
struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);

+   if (etnaviv_obj->vaddr)
+   return etnaviv_obj->vaddr;
+
mutex_lock(&etnaviv_obj->lock);
-   if (!etnaviv_obj->vaddr) {
+   if (etnaviv_obj->base.import_attach) {
+   etnaviv_obj->vaddr =
+   dma_buf_vmap(etnaviv_obj->base.import_attach->dmabuf);
+   } else {
struct page **pages = etnaviv_gem_get_pages(etnaviv_obj);

if (IS_ERR(pages)) {
-- 
2.7.0.rc3



[PATCH 1/2] drm/etnaviv: fix get pages error path in etnaviv_gem_vaddr

2016-01-26 Thread Lucas Stach
In case that etnaviv_gem_get_pages is unable to get the required
pages the object mutex needs to be unlocked. Also return NULL in
this case instead of propagating the error, as callers of this
function might not be prepared to handle a pointer error, but
expect this call to follow the semantics of a plain vmap to return
NULL in case of an error.

Signed-off-by: Lucas Stach 
---
 drivers/gpu/drm/etnaviv/etnaviv_dump.c | 2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem.c  | 6 --
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c 
b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
index fd7d3e989e79..09a759e69dd2 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
@@ -216,7 +216,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
iter.hdr->iova = cpu_to_le64(vram->iova);

vaddr = etnaviv_gem_vaddr(&obj->base);
-   if (vaddr && !IS_ERR(vaddr))
+   if (vaddr)
memcpy(iter.data, vaddr, obj->base.size);

etnaviv_core_dump_header(&iter, ETDUMP_BUF_BO, iter.data +
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index 9f77c3b94cc6..b22712fdd31e 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -361,8 +361,10 @@ void *etnaviv_gem_vaddr(struct drm_gem_object *obj)
if (!etnaviv_obj->vaddr) {
struct page **pages = etnaviv_gem_get_pages(etnaviv_obj);

-   if (IS_ERR(pages))
-   return ERR_CAST(pages);
+   if (IS_ERR(pages)) {
+   mutex_unlock(&etnaviv_obj->lock);
+   return NULL;
+   }

etnaviv_obj->vaddr = vmap(pages, obj->size >> PAGE_SHIFT,
VM_MAP, pgprot_writecombine(PAGE_KERNEL));
-- 
2.7.0.rc3



[PATCH 11/11] dma-buf/sync_file: bring sync_dump() back

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

During the de-stage of sync framework it was easy to keep sync_dump() out
to avoid an early de-stage of all debug code, but now that sync_debug.c
was de-staged bring sync_dump() back.

Signed-off-by: Gustavo Padovan 
---
 drivers/dma-buf/sync_file.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index aa1215d..fd7e3b9 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -218,15 +218,19 @@ int sync_file_wait(struct sync_file *sync_file, long 
timeout)
if (ret < 0) {
return ret;
} else if (ret == 0) {
-   if (timeout)
+   if (timeout) {
pr_info("sync_file timeout on [%p] after %dms\n",
sync_file, jiffies_to_msecs(timeout));
+   sync_dump();
+   }
return -ETIME;
}

ret = atomic_read(&sync_file->status);
-   if (ret)
+   if (ret) {
pr_info("sync_file error %ld on [%p]\n", ret, sync_file);
+   sync_dump();
+   }

return ret;
 }
-- 
2.5.0



[PATCH 10/11] dma-buf/sync_file: bring debug back to sync file

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

Enable reports of sync_files through /sync/info

Signed-off-by: Gustavo Padovan 
---
 drivers/dma-buf/sync_file.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 92474dd..aa1215d 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -29,6 +29,8 @@
 #define CREATE_TRACE_POINTS
 #include 

+#include "sync_debug.h"
+
 static const struct file_operations sync_file_fops;

 static struct sync_file *sync_file_alloc(int size, const char *name)
@@ -87,6 +89,8 @@ struct sync_file *sync_file_create(const char *name, struct 
fence *fence)
   fence_check_cb_func))
atomic_dec(&sync_file->status);

+   sync_file_debug_add(sync_file);
+
return sync_file;
 }
 EXPORT_SYMBOL(sync_file_create);
@@ -188,6 +192,7 @@ struct sync_file *sync_file_merge(const char *name,
atomic_sub(num_fences - i, &sync_file->status);
sync_file->num_fences = i;

+   sync_file_debug_add(sync_file);
return sync_file;
 }
 EXPORT_SYMBOL(sync_file_merge);
@@ -246,6 +251,8 @@ static int sync_file_release(struct inode *inode, struct 
file *file)
 {
struct sync_file *sync_file = file->private_data;

+   sync_file_debug_remove(sync_file);
+
kref_put(&sync_file->kref, sync_file_free);
return 0;
 }
-- 
2.5.0



[PATCH 09/11] dma-buf/sync_timeline: de-stage sync_timeline

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

De-stage the remaining bit of sync framework: sync_timeline and sw_sync
plus some debugging routines.

Signed-off-by: Gustavo Padovan 
---
 drivers/dma-buf/Kconfig|  10 +
 drivers/dma-buf/Makefile   |   3 +-
 drivers/dma-buf/sw_sync.h  |  32 +++
 drivers/dma-buf/sync_debug.c   | 374 +
 drivers/dma-buf/sync_debug.h   |  35 +++
 drivers/dma-buf/sync_timeline.c| 222 +++
 drivers/staging/android/Kconfig|  20 --
 drivers/staging/android/sync.c | 221 ---
 drivers/staging/android/sync.h | 130 
 drivers/staging/android/sync_debug.c   | 373 
 drivers/staging/android/trace/sync.h   |  32 ---
 drivers/staging/android/uapi/sw_sync.h |  32 ---
 include/linux/sync_timeline.h  | 114 ++
 include/trace/events/sync_timeline.h   |  31 +++
 14 files changed, 820 insertions(+), 809 deletions(-)
 create mode 100644 drivers/dma-buf/sw_sync.h
 create mode 100644 drivers/dma-buf/sync_debug.c
 create mode 100644 drivers/dma-buf/sync_debug.h
 create mode 100644 drivers/dma-buf/sync_timeline.c
 delete mode 100644 drivers/staging/android/sync.c
 delete mode 100644 drivers/staging/android/sync.h
 delete mode 100644 drivers/staging/android/sync_debug.c
 delete mode 100644 drivers/staging/android/trace/sync.h
 delete mode 100644 drivers/staging/android/uapi/sw_sync.h
 create mode 100644 include/linux/sync_timeline.h
 create mode 100644 include/trace/events/sync_timeline.h

diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
index 9824bc4..73df024 100644
--- a/drivers/dma-buf/Kconfig
+++ b/drivers/dma-buf/Kconfig
@@ -8,4 +8,14 @@ config SYNC_FILE
---help---
  This option enables the fence framework synchronization to export
  sync_files to userspace that can represent one or more fences.
+
+config SW_SYNC
+   bool "Software synchronization objects"
+   default n
+   depends on SYNC_FILE
+   ---help---
+ A sync object driver that uses a 32bit counter to coordinate
+ synchronization. Useful when there is no hardware primitive backing
+ the synchronization.
+
 endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index 4a424ec..78d8ec4 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1,2 +1,3 @@
 obj-y := dma-buf.o fence.o reservation.o seqno-fence.o
-obj-$(CONFIG_SYNC_FILE)+= sync_file.o
+obj-$(CONFIG_SYNC_FILE)+= sync_file.o sync_debug.o
+obj-$(CONFIG_SW_SYNC)  += sync_timeline.o
diff --git a/drivers/dma-buf/sw_sync.h b/drivers/dma-buf/sw_sync.h
new file mode 100644
index 000..9b5d486
--- /dev/null
+++ b/drivers/dma-buf/sw_sync.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ *
+ */
+
+#ifndef _UAPI_LINUX_SW_SYNC_H
+#define _UAPI_LINUX_SW_SYNC_H
+
+#include 
+
+struct sw_sync_create_fence_data {
+   __u32   value;
+   charname[32];
+   __s32   fence; /* fd of new fence */
+};
+
+#define SW_SYNC_IOC_MAGIC  'W'
+
+#define SW_SYNC_IOC_CREATE_FENCE   _IOWR(SW_SYNC_IOC_MAGIC, 0,\
+   struct sw_sync_create_fence_data)
+#define SW_SYNC_IOC_INC_IOW(SW_SYNC_IOC_MAGIC, 1, 
__u32)
+
+#endif /* _UAPI_LINUX_SW_SYNC_H */
diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
new file mode 100644
index 000..7da9ff5
--- /dev/null
+++ b/drivers/dma-buf/sync_debug.c
@@ -0,0 +1,374 @@
+/*
+ * drivers/base/sync.c
+ *
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sync_debug.h"
+#include "sw_sync.h"
+
+#ifdef CONFIG_DEBUG_FS
+
+static struct dentry *dbgfs;
+
+static LIST_HEAD(sync_timeline_list_head);
+static DEFINE_SPINLOCK(sync_timeline_list_lock);
+static LIST_HE

[PATCH 08/11] staging/android: rename android_fence to timeline_fence

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

We are moving out of staging/adroid so rename it to a name that is not
related to android anymore.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sync.c | 40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 07fe995..ea816dd 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -28,7 +28,7 @@
 #define CREATE_TRACE_POINTS
 #include "trace/sync.h"

-static const struct fence_ops android_fence_ops;
+static const struct fence_ops timeline_fence_ops;

 struct sync_timeline *sync_timeline_create(int size, const char *drv_name,
   const char *name)
@@ -126,7 +126,7 @@ struct fence *sync_pt_create(struct sync_timeline *obj, int 
size,

spin_lock_irqsave(&obj->child_list_lock, flags);
sync_timeline_get(obj);
-   fence_init(fence, &android_fence_ops, &obj->child_list_lock,
+   fence_init(fence, &timeline_fence_ops, &obj->child_list_lock,
   obj->context, value);
list_add_tail(&fence->child_list, &obj->child_list_head);
INIT_LIST_HEAD(&fence->active_list);
@@ -135,21 +135,21 @@ struct fence *sync_pt_create(struct sync_timeline *obj, 
int size,
 }
 EXPORT_SYMBOL(sync_pt_create);

-static const char *android_fence_get_driver_name(struct fence *fence)
+static const char *timeline_fence_get_driver_name(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);

return parent->drv_name;
 }

-static const char *android_fence_get_timeline_name(struct fence *fence)
+static const char *timeline_fence_get_timeline_name(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);

return parent->name;
 }

-static void android_fence_release(struct fence *fence)
+static void timeline_fence_release(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
unsigned long flags;
@@ -164,25 +164,25 @@ static void android_fence_release(struct fence *fence)
fence_free(fence);
 }

-static bool android_fence_signaled(struct fence *fence)
+static bool timeline_fence_signaled(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);

return (fence->seqno > parent->value) ? false : true;
 }

-static bool android_fence_enable_signaling(struct fence *fence)
+static bool timeline_fence_enable_signaling(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);

-   if (android_fence_signaled(fence))
+   if (timeline_fence_signaled(fence))
return false;

list_add_tail(&fence->active_list, &parent->active_list_head);
return true;
 }

-static int android_fence_fill_driver_data(struct fence *fence,
+static int timeline_fence_fill_driver_data(struct fence *fence,
  void *data, int size)
 {
if (size < sizeof(fence->seqno))
@@ -193,13 +193,13 @@ static int android_fence_fill_driver_data(struct fence 
*fence,
return sizeof(fence->seqno);
 }

-static void android_fence_value_str(struct fence *fence,
+static void timeline_fence_value_str(struct fence *fence,
char *str, int size)
 {
snprintf(str, size, "%d", fence->seqno);
 }

-static void android_fence_timeline_value_str(struct fence *fence,
+static void timeline_fence_timeline_value_str(struct fence *fence,
 char *str, int size)
 {
struct sync_timeline *parent = fence_parent(fence);
@@ -207,15 +207,15 @@ static void android_fence_timeline_value_str(struct fence 
*fence,
snprintf(str, size, "%d", parent->value);
 }

-static const struct fence_ops android_fence_ops = {
-   .get_driver_name = android_fence_get_driver_name,
-   .get_timeline_name = android_fence_get_timeline_name,
-   .enable_signaling = android_fence_enable_signaling,
-   .signaled = android_fence_signaled,
+static const struct fence_ops timeline_fence_ops = {
+   .get_driver_name = timeline_fence_get_driver_name,
+   .get_timeline_name = timeline_fence_get_timeline_name,
+   .enable_signaling = timeline_fence_enable_signaling,
+   .signaled = timeline_fence_signaled,
.wait = fence_default_wait,
-   .release = android_fence_release,
-   .fill_driver_data = android_fence_fill_driver_data,
-   .fence_value_str = android_fence_value_str,
-   .timeline_value_str = android_fence_timeline_value_str,
+   .release = timeline_fence_release,
+   .fill_driver_data = timeline_fence_fill_driver_data,
+   .fence_value_str = timeline_fence_value_str,
+   .timeline_value_str = timeline_fence_timeline_value_str,
 };

-- 
2.5.0



[PATCH 07/11] staging/android: remove sw_sync.[ch] files

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

We can glue the sw_sync file operations directly on the sync framework
without the need to pass through sw_sync wrappers.

It only builds sw_sync debugfs file support if CONFIG_SW_SYNC is enabled.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/Makefile |  1 -
 drivers/staging/android/sw_sync.c| 45 --
 drivers/staging/android/sw_sync.h| 47 
 drivers/staging/android/sync_debug.c | 17 ++---
 4 files changed, 13 insertions(+), 97 deletions(-)
 delete mode 100644 drivers/staging/android/sw_sync.c
 delete mode 100644 drivers/staging/android/sw_sync.h

diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile
index c7b6c99..2c1d97f 100644
--- a/drivers/staging/android/Makefile
+++ b/drivers/staging/android/Makefile
@@ -7,4 +7,3 @@ obj-$(CONFIG_ANDROID_TIMED_OUTPUT)  += timed_output.o
 obj-$(CONFIG_ANDROID_TIMED_GPIO)   += timed_gpio.o
 obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)+= lowmemorykiller.o
 obj-$(CONFIG_SYNC) += sync.o sync_debug.o
-obj-$(CONFIG_SW_SYNC)  += sw_sync.o
diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
deleted file mode 100644
index 461dbd9..000
--- a/drivers/staging/android/sw_sync.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * drivers/base/sw_sync.c
- *
- * Copyright (C) 2012 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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 
-#include 
-#include 
-#include 
-#include 
-
-#include "sw_sync.h"
-
-struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value)
-{
-   return sync_pt_create(obj, sizeof(struct fence), value);
-}
-EXPORT_SYMBOL(sw_sync_pt_create);
-
-struct sync_timeline *sw_sync_timeline_create(const char *name)
-{
-   return sync_timeline_create(sizeof(struct sync_timeline),
-   "sw_sync", name);
-}
-EXPORT_SYMBOL(sw_sync_timeline_create);
-
-void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
-{
-   sync_timeline_signal(obj, inc);
-}
-EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sw_sync.h 
b/drivers/staging/android/sw_sync.h
deleted file mode 100644
index 9f26c62..000
--- a/drivers/staging/android/sw_sync.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * include/linux/sw_sync.h
- *
- * Copyright (C) 2012 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- *
- */
-
-#ifndef _LINUX_SW_SYNC_H
-#define _LINUX_SW_SYNC_H
-
-#include 
-#include 
-#include "sync.h"
-#include "uapi/sw_sync.h"
-
-#if IS_ENABLED(CONFIG_SW_SYNC)
-struct sync_timeline *sw_sync_timeline_create(const char *name);
-void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc);
-
-struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value);
-#else
-static inline struct sync_timeline *sw_sync_timeline_create(const char *name)
-{
-   return NULL;
-}
-
-static inline void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
-{
-}
-
-static inline struct fence *sw_sync_pt_create(struct sync_timeline *obj,
- u32 value)
-{
-   return NULL;
-}
-#endif /* IS_ENABLED(CONFIG_SW_SYNC) */
-
-#endif /* _LINUX_SW_SYNC_H */
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index e984955..9312e6f 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -28,7 +28,11 @@
 #include 
 #include 
 #include 
-#include "sw_sync.h"
+#include 
+#include 
+
+#include "uapi/sw_sync.h"
+#include "sync.h"

 #ifdef CONFIG_DEBUG_FS

@@ -202,6 +206,7 @@ static const struct file_operations sync_info_debugfs_fops 
= {
.release= single_release,
 };

+#if IS_ENABLED(CONFIG_SW_SYNC)
 /*
  * *WARNING*
  *
@@ -216,7 +221,7 @@ static int sw_sync_debugfs_open(struct inode *inode, struct 
file *file)

get_task_comm(task_comm, current);

-   obj = sw_sync_timeline_create(task_comm);
+   obj = sync_timeline_create(sizeof(*obj), "sw_sync", task_comm);
if (!obj)
  

[PATCH 06/11] staging/android: remove sw_sync_timeline and sw_sync_pt

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

As we moved value storage to sync_timeline and fence those two structs
became useless and can be removed now.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c| 24 +++-
 drivers/staging/android/sw_sync.h| 24 ++--
 drivers/staging/android/sync_debug.c | 12 ++--
 3 files changed, 19 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index c5e92c6..461dbd9 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -25,31 +25,21 @@

 #include "sw_sync.h"

-struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value)
+struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value)
 {
-   struct sw_sync_pt *pt;
-
-   pt = (struct sw_sync_pt *)
-   sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt), value);
-
-   pt->value = value;
-
-   return (struct fence *)pt;
+   return sync_pt_create(obj, sizeof(struct fence), value);
 }
 EXPORT_SYMBOL(sw_sync_pt_create);

-struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
+struct sync_timeline *sw_sync_timeline_create(const char *name)
 {
-   struct sw_sync_timeline *obj = (struct sw_sync_timeline *)
-   sync_timeline_create(sizeof(struct sw_sync_timeline),
-"sw_sync", name);
-
-   return obj;
+   return sync_timeline_create(sizeof(struct sync_timeline),
+   "sw_sync", name);
 }
 EXPORT_SYMBOL(sw_sync_timeline_create);

-void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
+void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
 {
-   sync_timeline_signal(&obj->obj, inc);
+   sync_timeline_signal(obj, inc);
 }
 EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sw_sync.h 
b/drivers/staging/android/sw_sync.h
index e18667b..9f26c62 100644
--- a/drivers/staging/android/sw_sync.h
+++ b/drivers/staging/android/sw_sync.h
@@ -22,34 +22,22 @@
 #include "sync.h"
 #include "uapi/sw_sync.h"

-struct sw_sync_timeline {
-   struct  sync_timeline   obj;
-
-   u32 value;
-};
-
-struct sw_sync_pt {
-   struct fencept;
-
-   u32 value;
-};
-
 #if IS_ENABLED(CONFIG_SW_SYNC)
-struct sw_sync_timeline *sw_sync_timeline_create(const char *name);
-void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc);
+struct sync_timeline *sw_sync_timeline_create(const char *name);
+void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc);

-struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, u32 value);
+struct fence *sw_sync_pt_create(struct sync_timeline *obj, u32 value);
 #else
-static inline struct sw_sync_timeline *sw_sync_timeline_create(const char 
*name)
+static inline struct sync_timeline *sw_sync_timeline_create(const char *name)
 {
return NULL;
 }

-static inline void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
+static inline void sw_sync_timeline_inc(struct sync_timeline *obj, u32 inc)
 {
 }

-static inline struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj,
+static inline struct fence *sw_sync_pt_create(struct sync_timeline *obj,
  u32 value)
 {
return NULL;
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index 26ba9e86..e984955 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -211,7 +211,7 @@ static const struct file_operations sync_info_debugfs_fops 
= {
 /* opening sw_sync create a new sync obj */
 static int sw_sync_debugfs_open(struct inode *inode, struct file *file)
 {
-   struct sw_sync_timeline *obj;
+   struct sync_timeline *obj;
char task_comm[TASK_COMM_LEN];

get_task_comm(task_comm, current);
@@ -227,13 +227,13 @@ static int sw_sync_debugfs_open(struct inode *inode, 
struct file *file)

 static int sw_sync_debugfs_release(struct inode *inode, struct file *file)
 {
-   struct sw_sync_timeline *obj = file->private_data;
+   struct sync_timeline *obj = file->private_data;

-   sync_timeline_destroy(&obj->obj);
+   sync_timeline_destroy(obj);
return 0;
 }

-static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
+static long sw_sync_ioctl_create_fence(struct sync_timeline *obj,
   unsigned long arg)
 {
int fd = get_unused_fd_flags(O_CLOEXEC);
@@ -280,7 +280,7 @@ err:
return err;
 }

-static long sw_sync_ioctl_inc(struct sw_sync_timeline *obj, unsigned long arg)
+static long sw_sync_ioctl_inc(struct sync_timeline *obj, unsigned long arg)
 {
u32 value;

@@ -295,7 +295,7 @@ static long sw_sync_ioctl_inc(struct sw_sync_timeline *obj, 
unsigned long arg)
 static long sw_sync_ioctl(struct file *file, unsigned int

[PATCH 05/11] staging/android: remove struct sync_timeline_ops

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

Move drv_name, the last field of sync_timeline_ops, to sync_timeline
and remove sync_timeline_ops.

struct sync_timeline_ops was just an extra abstraction on top of
fence_ops, and in the last few commits we removed all it ops in favor
of cleaner fence_ops.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c|  9 ++---
 drivers/staging/android/sync.c   |  8 
 drivers/staging/android/sync.h   | 28 +---
 drivers/staging/android/sync_debug.c |  3 +--
 4 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index 4200b12..c5e92c6 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,16 +38,11 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline 
*obj, u32 value)
 }
 EXPORT_SYMBOL(sw_sync_pt_create);

-static struct sync_timeline_ops sw_sync_timeline_ops = {
-   .driver_name = "sw_sync",
-};
-
 struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
 {
struct sw_sync_timeline *obj = (struct sw_sync_timeline *)
-   sync_timeline_create(&sw_sync_timeline_ops,
-sizeof(struct sw_sync_timeline),
-name);
+   sync_timeline_create(sizeof(struct sw_sync_timeline),
+"sw_sync", name);

return obj;
 }
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index f2d298c..07fe995 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -30,8 +30,8 @@

 static const struct fence_ops android_fence_ops;

-struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
-  int size, const char *name)
+struct sync_timeline *sync_timeline_create(int size, const char *drv_name,
+  const char *name)
 {
struct sync_timeline *obj;

@@ -43,9 +43,9 @@ struct sync_timeline *sync_timeline_create(const struct 
sync_timeline_ops *ops,
return NULL;

kref_init(&obj->kref);
-   obj->ops = ops;
obj->context = fence_context_alloc(1);
strlcpy(obj->name, name, sizeof(obj->name));
+   strlcpy(obj->drv_name, drv_name, sizeof(obj->drv_name));

INIT_LIST_HEAD(&obj->child_list_head);
INIT_LIST_HEAD(&obj->active_list_head);
@@ -139,7 +139,7 @@ static const char *android_fence_get_driver_name(struct 
fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);

-   return parent->ops->driver_name;
+   return parent->drv_name;
 }

 static const char *android_fence_get_timeline_name(struct fence *fence)
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index b1a4b06..be94a80 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -22,20 +22,10 @@
 #include 
 #include 

-struct sync_timeline;
-
-/**
- * struct sync_timeline_ops - sync object implementation ops
- * @driver_name:   name of the implementation
- */
-struct sync_timeline_ops {
-   const char *driver_name;
-};
-
 /**
  * struct sync_timeline - sync object
  * @kref:  reference count on fence.
- * @ops:   ops that define the implementation of the sync_timeline
+ * @drv_name:  drv_name of the driver using the sync_timeline
  * @name:  name of the sync_timeline. Useful for debugging
  * @destroyed: set when sync_timeline is destroyed
  * @child_list_head:   list of children sync_pts for this sync_timeline
@@ -46,7 +36,7 @@ struct sync_timeline_ops {
  */
 struct sync_timeline {
struct kref kref;
-   const struct sync_timeline_ops  *ops;
+   chardrv_name[32];
charname[32];

/* protected by child_list_lock */
@@ -75,17 +65,17 @@ static inline struct sync_timeline *fence_parent(struct 
fence *fence)

 /**
  * sync_timeline_create() - creates a sync object
- * @ops:   specifies the implementation ops for the object
  * @size:  size to allocate for this obj
+ * @drv_name:  sync_timeline driver name
  * @name:  sync_timeline name
  *
- * Creates a new sync_timeline which will use the implementation specified by
- * @ops.  @size bytes will be allocated allowing for implementation specific
- * data to be kept after the generic sync_timeline struct. Returns the
- * sync_timeline object or NULL in case of error.
+ * Creates a new sync_timeline. @size bytes will be allocated allowing
+ * for implementation specific data to be kept after the generic
+ * sync_timeline struct. Returns the sync_timeline object or NULL in
+ * case of error.
  */
-struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
-  int size, const char *name);
+stru

[PATCH 04/11] staging/android: remove .{fence, timeline}_value_str() from timeline_ops

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

Now that the value of fence and the timeline are not stored by sw_sync
anymore we can remove this extra abstraction to retrieve this data.

This patch changes both fence_ops (.fence_value_str and
.timeline_value_str) to return the str directly.

It also clean up struct sync_timeline_ops by removing both ops from there.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c| 17 -
 drivers/staging/android/sync.c   | 16 ++--
 drivers/staging/android/sync.h   |  9 -
 drivers/staging/android/sync_debug.c | 12 ++--
 drivers/staging/android/trace/sync.h | 12 +++-
 5 files changed, 7 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index 428e22c..4200b12 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,25 +38,8 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline 
*obj, u32 value)
 }
 EXPORT_SYMBOL(sw_sync_pt_create);

-static void sw_sync_timeline_value_str(struct sync_timeline *sync_timeline,
-  char *str, int size)
-{
-   struct sw_sync_timeline *timeline =
-   (struct sw_sync_timeline *)sync_timeline;
-   snprintf(str, size, "%d", timeline->value);
-}
-
-static void sw_sync_fence_value_str(struct fence *fence, char *str, int size)
-{
-   struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-
-   snprintf(str, size, "%d", pt->value);
-}
-
 static struct sync_timeline_ops sw_sync_timeline_ops = {
.driver_name = "sw_sync",
-   .timeline_value_str = sw_sync_timeline_value_str,
-   .fence_value_str = sw_sync_fence_value_str,
 };

 struct sw_sync_timeline *sw_sync_timeline_create(const char *name)
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 39af5fb..f2d298c 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -196,14 +196,7 @@ static int android_fence_fill_driver_data(struct fence 
*fence,
 static void android_fence_value_str(struct fence *fence,
char *str, int size)
 {
-   struct sync_timeline *parent = fence_parent(fence);
-
-   if (!parent->ops->fence_value_str) {
-   if (size)
-   *str = 0;
-   return;
-   }
-   parent->ops->fence_value_str(fence, str, size);
+   snprintf(str, size, "%d", fence->seqno);
 }

 static void android_fence_timeline_value_str(struct fence *fence,
@@ -211,12 +204,7 @@ static void android_fence_timeline_value_str(struct fence 
*fence,
 {
struct sync_timeline *parent = fence_parent(fence);

-   if (!parent->ops->timeline_value_str) {
-   if (size)
-   *str = 0;
-   return;
-   }
-   parent->ops->timeline_value_str(parent, str, size);
+   snprintf(str, size, "%d", parent->value);
 }

 static const struct fence_ops android_fence_ops = {
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 500838b..b1a4b06 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,18 +27,9 @@ struct sync_timeline;
 /**
  * struct sync_timeline_ops - sync object implementation ops
  * @driver_name:   name of the implementation
- * @timeline_value_str: fill str with the value of the sync_timeline's counter
- * @fence_value_str:   fill str with the value of the fence
  */
 struct sync_timeline_ops {
const char *driver_name;
-
-   /* optional */
-   void (*timeline_value_str)(struct sync_timeline *timeline, char *str,
-  int size);
-
-   /* optional */
-   void (*fence_value_str)(struct fence *fence, char *str, int size);
 };

 /**
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index b37412d..7517fb3 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -134,16 +134,8 @@ static void sync_print_obj(struct seq_file *s, struct 
sync_timeline *obj)
struct list_head *pos;
unsigned long flags;

-   seq_printf(s, "%s %s", obj->name, obj->ops->driver_name);
-
-   if (obj->ops->timeline_value_str) {
-   char value[64];
-
-   obj->ops->timeline_value_str(obj, value, sizeof(value));
-   seq_printf(s, ": %s", value);
-   }
-
-   seq_puts(s, "\n");
+   seq_printf(s, "%s %s: %d\n", obj->name, obj->ops->driver_name,
+  obj->value);

spin_lock_irqsave(&obj->child_list_lock, flags);
list_for_each(pos, &obj->child_list_head) {
diff --git a/drivers/staging/android/trace/sync.h 
b/drivers/staging/android/trace/sync.h
index a0f80f4..d7f6457f 100644
--- a/drivers/staging/android/trace/sync.h
+++ b/drivers/staging/android/trace/sync.h
@@ -15,21 +15,15 @@ TRACE_EVENT(sync_timeline,

TP_STRUCT__en

[PATCH 03/11] staging/android: remove .fill_driver_data() timeline ops

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

The .fill_driver_data() ops was just a useless abstraction for
fence_ops op of the same name.

Now that we use fence->seqno to store the value it is cleaner to
remove the abstraction and fill the data directly.

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c | 14 --
 drivers/staging/android/sync.c|  9 +
 drivers/staging/android/sync.h|  7 ---
 3 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index b9d53d3..428e22c 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -38,19 +38,6 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline 
*obj, u32 value)
 }
 EXPORT_SYMBOL(sw_sync_pt_create);

-static int sw_sync_fill_driver_data(struct fence *fence,
-   void *data, int size)
-{
-   struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-
-   if (size < sizeof(pt->value))
-   return -ENOMEM;
-
-   memcpy(data, &pt->value, sizeof(pt->value));
-
-   return sizeof(pt->value);
-}
-
 static void sw_sync_timeline_value_str(struct sync_timeline *sync_timeline,
   char *str, int size)
 {
@@ -68,7 +55,6 @@ static void sw_sync_fence_value_str(struct fence *fence, char 
*str, int size)

 static struct sync_timeline_ops sw_sync_timeline_ops = {
.driver_name = "sw_sync",
-   .fill_driver_data = sw_sync_fill_driver_data,
.timeline_value_str = sw_sync_timeline_value_str,
.fence_value_str = sw_sync_fence_value_str,
 };
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 4eea5c3..39af5fb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -185,11 +185,12 @@ static bool android_fence_enable_signaling(struct fence 
*fence)
 static int android_fence_fill_driver_data(struct fence *fence,
  void *data, int size)
 {
-   struct sync_timeline *parent = fence_parent(fence);
+   if (size < sizeof(fence->seqno))
+   return -ENOMEM;
+
+   memcpy(data, &fence->seqno, sizeof(fence->seqno));

-   if (!parent->ops->fill_driver_data)
-   return 0;
-   return parent->ops->fill_driver_data(fence, data, size);
+   return sizeof(fence->seqno);
 }

 static void android_fence_value_str(struct fence *fence,
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 4d3dfbf..500838b 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,10 +27,6 @@ struct sync_timeline;
 /**
  * struct sync_timeline_ops - sync object implementation ops
  * @driver_name:   name of the implementation
- * @fill_driver_data:  write implementation specific driver data to data.
- *   should return an error if there is not enough room
- *   as specified by size.  This information is returned
- *   to userspace by SYNC_IOC_FENCE_INFO.
  * @timeline_value_str: fill str with the value of the sync_timeline's counter
  * @fence_value_str:   fill str with the value of the fence
  */
@@ -38,9 +34,6 @@ struct sync_timeline_ops {
const char *driver_name;

/* optional */
-   int (*fill_driver_data)(struct fence *fence, void *data, int size);
-
-   /* optional */
void (*timeline_value_str)(struct sync_timeline *timeline, char *str,
   int size);

-- 
2.5.0



[PATCH 02/11] staging/android: store last signaled value on sync timeline

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

Now fence timeline is aware of the last signaled fence, as it
receives the increment to the current value in sync_timeline_signal().

That allow us to remove .has_signaled() from timeline_ops as we can
directly compare using timeline->value and fence->seqno in sync.c

Signed-off-by: Gustavo Padovan 
---
 drivers/staging/android/sw_sync.c | 16 ++--
 drivers/staging/android/sync.c| 15 +++
 drivers/staging/android/sync.h| 14 +-
 3 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index 3bee959..b9d53d3 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -30,7 +30,7 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline *obj, 
u32 value)
struct sw_sync_pt *pt;

pt = (struct sw_sync_pt *)
-   sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt));
+   sync_pt_create(&obj->obj, sizeof(struct sw_sync_pt), value);

pt->value = value;

@@ -38,15 +38,6 @@ struct fence *sw_sync_pt_create(struct sw_sync_timeline 
*obj, u32 value)
 }
 EXPORT_SYMBOL(sw_sync_pt_create);

-static int sw_sync_fence_has_signaled(struct fence *fence)
-{
-   struct sw_sync_pt *pt = (struct sw_sync_pt *)fence;
-   struct sw_sync_timeline *obj =
-   (struct sw_sync_timeline *)fence_parent(fence);
-
-   return (pt->value > obj->value) ? 0 : 1;
-}
-
 static int sw_sync_fill_driver_data(struct fence *fence,
void *data, int size)
 {
@@ -77,7 +68,6 @@ static void sw_sync_fence_value_str(struct fence *fence, char 
*str, int size)

 static struct sync_timeline_ops sw_sync_timeline_ops = {
.driver_name = "sw_sync",
-   .has_signaled = sw_sync_fence_has_signaled,
.fill_driver_data = sw_sync_fill_driver_data,
.timeline_value_str = sw_sync_timeline_value_str,
.fence_value_str = sw_sync_fence_value_str,
@@ -96,8 +86,6 @@ EXPORT_SYMBOL(sw_sync_timeline_create);

 void sw_sync_timeline_inc(struct sw_sync_timeline *obj, u32 inc)
 {
-   obj->value += inc;
-
-   sync_timeline_signal(&obj->obj);
+   sync_timeline_signal(&obj->obj, inc);
 }
 EXPORT_SYMBOL(sw_sync_timeline_inc);
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 1e1c009..4eea5c3 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -90,7 +90,7 @@ void sync_timeline_destroy(struct sync_timeline *obj)
 }
 EXPORT_SYMBOL(sync_timeline_destroy);

-void sync_timeline_signal(struct sync_timeline *obj)
+void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
 {
unsigned long flags;
struct fence *fence, *next;
@@ -99,6 +99,8 @@ void sync_timeline_signal(struct sync_timeline *obj)

spin_lock_irqsave(&obj->child_list_lock, flags);

+   obj->value += inc;
+
list_for_each_entry_safe(fence, next, &obj->active_list_head,
 active_list) {
if (fence_is_signaled_locked(fence))
@@ -109,7 +111,8 @@ void sync_timeline_signal(struct sync_timeline *obj)
 }
 EXPORT_SYMBOL(sync_timeline_signal);

-struct fence *sync_pt_create(struct sync_timeline *obj, int size)
+struct fence *sync_pt_create(struct sync_timeline *obj, int size,
+unsigned int value)
 {
unsigned long flags;
struct fence *fence;
@@ -124,7 +127,7 @@ struct fence *sync_pt_create(struct sync_timeline *obj, int 
size)
spin_lock_irqsave(&obj->child_list_lock, flags);
sync_timeline_get(obj);
fence_init(fence, &android_fence_ops, &obj->child_list_lock,
-  obj->context, ++obj->value);
+  obj->context, value);
list_add_tail(&fence->child_list, &obj->child_list_head);
INIT_LIST_HEAD(&fence->active_list);
spin_unlock_irqrestore(&obj->child_list_lock, flags);
@@ -164,12 +167,8 @@ static void android_fence_release(struct fence *fence)
 static bool android_fence_signaled(struct fence *fence)
 {
struct sync_timeline *parent = fence_parent(fence);
-   int ret;

-   ret = parent->ops->has_signaled(fence);
-   if (ret < 0)
-   fence->status = ret;
-   return ret;
+   return (fence->seqno > parent->value) ? false : true;
 }

 static bool android_fence_enable_signaling(struct fence *fence)
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index fb209fc..4d3dfbf 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -27,10 +27,6 @@ struct sync_timeline;
 /**
  * struct sync_timeline_ops - sync object implementation ops
  * @driver_name:   name of the implementation
- * @has_signaled:  returns:
- *   1 if pt has signaled
- *   0 if pt has not signaled
- *  <0 on error
  * @fill_driver_data:  write i

[PATCH 01/11] dma-buf/sync_file: de-stage sync_file

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

sync_file is useful to connect one or more fences to the file. The file is
used by userspace to track fences.

Signed-off-by: Gustavo Padovan 
---
 drivers/Kconfig  |   2 +
 drivers/dma-buf/Kconfig  |  11 +
 drivers/dma-buf/Makefile |   1 +
 drivers/dma-buf/sync_file.c  | 440 +++
 drivers/staging/android/Kconfig  |   1 +
 drivers/staging/android/sync.c   | 419 -
 drivers/staging/android/sync.h   | 105 +
 drivers/staging/android/sync_debug.c |   1 +
 drivers/staging/android/trace/sync.h |  44 
 drivers/staging/android/uapi/sync.h  |  97 
 include/linux/sync_file.h| 123 ++
 include/trace/events/sync_file.h |  57 +
 include/uapi/linux/sync.h|  97 
 13 files changed, 735 insertions(+), 663 deletions(-)
 create mode 100644 drivers/dma-buf/Kconfig
 create mode 100644 drivers/dma-buf/sync_file.c
 delete mode 100644 drivers/staging/android/uapi/sync.h
 create mode 100644 include/linux/sync_file.h
 create mode 100644 include/trace/events/sync_file.h
 create mode 100644 include/uapi/linux/sync.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index d2ac339..430f761 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -114,6 +114,8 @@ source "drivers/rtc/Kconfig"

 source "drivers/dma/Kconfig"

+source "drivers/dma-buf/Kconfig"
+
 source "drivers/dca/Kconfig"

 source "drivers/auxdisplay/Kconfig"
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
new file mode 100644
index 000..9824bc4
--- /dev/null
+++ b/drivers/dma-buf/Kconfig
@@ -0,0 +1,11 @@
+menu "DMABUF options"
+
+config SYNC_FILE
+   bool "sync_file support for fences"
+   default n
+   select ANON_INODES
+   select DMA_SHARED_BUFFER
+   ---help---
+ This option enables the fence framework synchronization to export
+ sync_files to userspace that can represent one or more fences.
+endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index 57a675f..4a424ec 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1 +1,2 @@
 obj-y := dma-buf.o fence.o reservation.o seqno-fence.o
+obj-$(CONFIG_SYNC_FILE)+= sync_file.o
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
new file mode 100644
index 000..92474dd
--- /dev/null
+++ b/drivers/dma-buf/sync_file.c
@@ -0,0 +1,440 @@
+/*
+ * drivers/dma-buf/sync_file.c
+ *
+ * Copyright (C) 2012 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CREATE_TRACE_POINTS
+#include 
+
+static const struct file_operations sync_file_fops;
+
+static struct sync_file *sync_file_alloc(int size, const char *name)
+{
+   struct sync_file *sync_file;
+
+   sync_file = kzalloc(size, GFP_KERNEL);
+   if (!sync_file)
+   return NULL;
+
+   sync_file->file = anon_inode_getfile("sync_file", &sync_file_fops,
+sync_file, 0);
+   if (IS_ERR(sync_file->file))
+   goto err;
+
+   kref_init(&sync_file->kref);
+   strlcpy(sync_file->name, name, sizeof(sync_file->name));
+
+   init_waitqueue_head(&sync_file->wq);
+
+   return sync_file;
+
+err:
+   kfree(sync_file);
+   return NULL;
+}
+
+static void fence_check_cb_func(struct fence *f, struct fence_cb *cb)
+{
+   struct sync_file_cb *check;
+   struct sync_file *sync_file;
+
+   check = container_of(cb, struct sync_file_cb, cb);
+   sync_file = check->sync_file;
+
+   if (atomic_dec_and_test(&sync_file->status))
+   wake_up_all(&sync_file->wq);
+}
+
+/* TODO: implement a create which takes more that one fence */
+struct sync_file *sync_file_create(const char *name, struct fence *fence)
+{
+   struct sync_file *sync_file;
+
+   sync_file = sync_file_alloc(offsetof(struct sync_file, cbs[1]),
+   name);
+   if (!sync_file)
+   return NULL;
+
+   sync_file->num_fences = 1;
+   atomic_set(&sync_file->status, 1);
+
+   sync_file->cbs[0].fence = fence;
+   sync_file->cbs[0].sync_file = sync_file;
+   if (fence_add_callback(fence, &sync_file->cbs[0].cb,
+  fence_check_cb_func))
+   atomic_dec(&sync_file->status);
+
+   return sync_file;
+}
+EXPORT_

[PATCH 00/11] sync framework de-staging: part 2 - de-stage

2016-01-26 Thread Gustavo Padovan
From: Gustavo Padovan 

This patch series de-stage the sync framework and it a follow up on the 
clean up series I've sent last week:

http://thread.gmane.org/gmane.comp.video.dri.devel/145509   

Now in part 2 we finish the de-stage of the sync framework. It start with the   
move of sync_file from staging to drivers/dma-buf, followed by a bunch of clean 
ups on sync_timeline and sw_sync. Finally we de-stage the later two plus the
debug routines.

Gustavo Padovan (11):
  dma-buf/sync_file: de-stage sync_file
  staging/android: store last signaled value on sync timeline
  staging/android: remove .fill_driver_data() timeline ops
  staging/android: remove .{fence,timeline}_value_str() from
timeline_ops
  staging/android: remove struct sync_timeline_ops
  staging/android: remove sw_sync_timeline and sw_sync_pt
  staging/android: remove sw_sync.[ch] files
  staging/android: rename android_fence to timeline_fence
  dma-buf/sync_timeline: de-stage sync_timeline
  dma-buf/sync_file: bring debug back to sync file
  dma-buf/sync_file: bring sync_dump() back

 drivers/Kconfig|   2 +
 drivers/dma-buf/Kconfig|  21 ++
 drivers/dma-buf/Makefile   |   2 +
 drivers/dma-buf/sw_sync.h  |  32 ++
 drivers/dma-buf/sync_debug.c   | 374 +++
 drivers/dma-buf/sync_debug.h   |  35 ++
 drivers/dma-buf/sync_file.c| 451 +++
 drivers/dma-buf/sync_timeline.c| 222 +++
 drivers/staging/android/Kconfig|  19 -
 drivers/staging/android/Makefile   |   1 -
 drivers/staging/android/sw_sync.c  | 103 --
 drivers/staging/android/sw_sync.h  |  59 ---
 drivers/staging/android/sync.c | 652 -
 drivers/staging/android/sync.h | 261 -
 drivers/staging/android/sync_debug.c   | 372 ---
 drivers/staging/android/trace/sync.h   |  82 -
 drivers/staging/android/uapi/sw_sync.h |  32 --
 drivers/staging/android/uapi/sync.h|  97 -
 include/linux/sync_file.h  | 123 +++
 include/linux/sync_timeline.h  | 114 ++
 include/trace/events/sync_file.h   |  57 +++
 include/trace/events/sync_timeline.h   |  31 ++
 include/uapi/linux/sync.h  |  97 +
 23 files changed, 1561 insertions(+), 1678 deletions(-)
 create mode 100644 drivers/dma-buf/Kconfig
 create mode 100644 drivers/dma-buf/sw_sync.h
 create mode 100644 drivers/dma-buf/sync_debug.c
 create mode 100644 drivers/dma-buf/sync_debug.h
 create mode 100644 drivers/dma-buf/sync_file.c
 create mode 100644 drivers/dma-buf/sync_timeline.c
 delete mode 100644 drivers/staging/android/sw_sync.c
 delete mode 100644 drivers/staging/android/sw_sync.h
 delete mode 100644 drivers/staging/android/sync.c
 delete mode 100644 drivers/staging/android/sync.h
 delete mode 100644 drivers/staging/android/sync_debug.c
 delete mode 100644 drivers/staging/android/trace/sync.h
 delete mode 100644 drivers/staging/android/uapi/sw_sync.h
 delete mode 100644 drivers/staging/android/uapi/sync.h
 create mode 100644 include/linux/sync_file.h
 create mode 100644 include/linux/sync_timeline.h
 create mode 100644 include/trace/events/sync_file.h
 create mode 100644 include/trace/events/sync_timeline.h
 create mode 100644 include/uapi/linux/sync.h

-- 
2.5.0



[Bug 93649] [radeonsi] Graphics lockup while playing tf2

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93649

--- Comment #9 from Matthew Dawson  ---
(In reply to pc.jago1337 from comment #8)
> Also, this could be a duplicate of bug #92912 - random lockups in TF2, all
> with radeon.

I was asked to file this bug separately.  Also that covers R600, a different
GPU the GCN.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/a2263ca5/attachment.html>


[Bug 93649] [radeonsi] Graphics lockup while playing tf2

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93649

--- Comment #8 from pc.jago1337 at gmail.com ---
Also, this could be a duplicate of bug #92912 - random lockups in TF2, all with
radeon.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/ab7b0977/attachment.html>


[PATCH] mm: fix pfn_t to page conversion in vm_insert_mixed

2016-01-26 Thread Julian Margetson
PT Tue Jan 26 15:40:11 
AST 2016
[   51.337370] enter ? for help
[   51.340256] mon>  
[   53.343544] Oops: Machine check, sig: 7 [#3]
[   53.348067] PREEMPT Canyonlands
[   53.351411] Modules linked in:
[   53.354653] CPU: 0 PID: 680 Comm: Xorg Tainted: G  D 
4.5.0-rc1-Sam460ex #1
[   53.363019] task: ecce2840 ti: ee224000 task.ti: ee224000
[   53.368720] NIP: 1fc2e480 LR: 1fc2e404 CTR: 1fc2e4d0
[   53.373963] REGS: ee225f10 TRAP: 0214   Tainted: G  D  
(4.5.0-rc1-Sam460ex)
[   53.382415] MSR: 0002f900   CR: 28004262  XER: 
[   53.389560]
GPR00: 1f0f2134 bfbd0390 b7fad6f0 b776fffc b6f86008 0780 0004 
GPR08:  b776fffc  bfbd0340 1fc2e404 204c9ff4  0780
GPR16:  0020   1e00 206f7650 0438 b6f86008
GPR24: 0780 bfbd03e8 206e1760 b777 b777 b6f86008 1fd36ff4 1e00
[   53.421412] NIP [1fc2e480] 0x1fc2e480
[   53.425283] LR [1fc2e404] 0x1fc2e404
[   53.429057] Call Trace:
[   53.431641] ---[ end trace 5d20a91d2d30d9d8 ]---
[   53.436261]
[   56.443200] Machine check in kernel mode.
[   56.447237] Data Write PLB Error
[   56.450463] Machine Check exception is imprecise
[   56.455091] Vector: 214  at [ecc07f10]
[   56.458841] pc: 1fa8a484
[   56.461757] lr: 1fa8a404
[   56.464674] sp: bffd7a20
[   56.467556]msr: 2f900
[   56.470178]   current = 0xeced1140
[   56.473581] pid   = 693, comm = Xorg
[   56.477506] Linux version 4.5.0-rc1-Sam460ex (root at julian-VirtualBox) 
(gcc version 4.8.2 (Ubuntu 4.8.2-16ubuntu3) ) #1 PREEMPT Tue Jan 26 15:40:11 
AST 2016
[   56.491432] enter ? for help
[   56.494310] mon>  

-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/21f92102/attachment.html>


[PATCH] drm/exynos: fix building without CONFIG_PM_SLEEP

2016-01-26 Thread Inki Dae
Hi Arnd,

Sorry for late.

2015년 11월 18일 00:08에 Arnd Bergmann 이(가) 쓴 글:
> The runtime PM operations use the suspend/resume functions
> even when CONFIG_PM_SLEEP is not set, but this now fails
> for the exynos DRM driver:
> 
> exynos_mixer.c:1289:61: error: 'exynos_mixer_resume' undeclared here (not in 
> a function)
>   SET_RUNTIME_PM_OPS(exynos_mixer_suspend, exynos_mixer_resume, NULL)
> 
> This removes the #ifdef and instead marks the functions as
> __maybe_unused, which does the right thing in all cases and
> also looks nicer.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: ("drm/exynos: add pm_runtime to Mixer")
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 7498c6e76a53..fcaf71df77c1 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -1230,8 +1230,7 @@ static int mixer_remove(struct platform_device *pdev)
>   return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP

How about just changing it to CONFIG_PM for consistency of other kms drivers?
Actually, I had modified it to PM since original auther, Gustavo Padovan, 
posted runtime pm support.
However, it seems missing this one.

Thanks,
Inki Dae

> -static int exynos_mixer_suspend(struct device *dev)
> +static int __maybe_unused exynos_mixer_suspend(struct device *dev)
>  {
>   struct mixer_context *ctx = dev_get_drvdata(dev);
>   struct mixer_resources *res = &ctx->mixer_res;
> @@ -1247,7 +1246,7 @@ static int exynos_mixer_suspend(struct device *dev)
>   return 0;
>  }
>  
> -static int exynos_mixer_resume(struct device *dev)
> +static int __maybe_unused exynos_mixer_resume(struct device *dev)
>  {
>   struct mixer_context *ctx = dev_get_drvdata(dev);
>   struct mixer_resources *res = &ctx->mixer_res;
> @@ -1283,7 +1282,6 @@ static int exynos_mixer_resume(struct device *dev)
>  
>   return 0;
>  }
> -#endif
>  
>  static const struct dev_pm_ops exynos_mixer_pm_ops = {
>   SET_RUNTIME_PM_OPS(exynos_mixer_suspend, exynos_mixer_resume, NULL)
> 
> 


[Bug 111271] Black stripe on screen with MGAG200 (PowerEdge R320) and modesetting

2016-01-26 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=111271

--- Comment #7 from Jean-Yves Faye  ---
Created attachment 202021
  --> https://bugzilla.kernel.org/attachment.cgi?id=202021&action=edit
dumb patch

Some experimentation lead me to this patch, this seems to resolve the problem,
but I have no idead what this function should write in the register so I'm
hoping for someone here to explain the problem.

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


[PATCH] drm/exynos: fix building without CONFIG_PM_SLEEP

2016-01-26 Thread Arnd Bergmann
On Tuesday 26 January 2016 15:21:41 Inki Dae wrote:
> > -#ifdef CONFIG_PM_SLEEP
> 
> How about just changing it to CONFIG_PM for consistency of other kms drivers?
> Actually, I had modified it to PM since original auther, Gustavo Padovan, 
> posted runtime pm support.
> However, it seems missing this one.

Everybody gets the #ifdef's wrong, so the __maybe_unused approach is
being used increasingly all over the kernel.

Arnd


[PATCH] drm/exynos: fix building without CONFIG_PM_SLEEP

2016-01-26 Thread Inki Dae


2016년 01월 26일 08:40에 Krzysztof Kozlowski 이(가) 쓴 글:
> 2015-11-18 0:08 GMT+09:00 Arnd Bergmann :
>> The runtime PM operations use the suspend/resume functions
>> even when CONFIG_PM_SLEEP is not set, but this now fails
>> for the exynos DRM driver:
>>
>> exynos_mixer.c:1289:61: error: 'exynos_mixer_resume' undeclared here (not in 
>> a function)
>>   SET_RUNTIME_PM_OPS(exynos_mixer_suspend, exynos_mixer_resume, NULL)
>>
>> This removes the #ifdef and instead marks the functions as
>> __maybe_unused, which does the right thing in all cases and
>> also looks nicer.
>>
>> Signed-off-by: Arnd Bergmann 
>> Fixes:   ("drm/exynos: add pm_runtime to Mixer")
> 
> Dear Inki,
> 
> Ping? On 4.5-rc1 this is still broken. Can you apply this for fixes
> for current rc-cycle?

Got it.

Thanks,
Inki Dae

> 
> Reviewed-by: Krzysztof Kozlowski 
> 
> Best regards,
> Krzysztof
> 
> 
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
>> b/drivers/gpu/drm/exynos/exynos_mixer.c
>> index 7498c6e76a53..fcaf71df77c1 100644
>> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
>> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
>> @@ -1230,8 +1230,7 @@ static int mixer_remove(struct platform_device *pdev)
>> return 0;
>>  }
>>
>> -#ifdef CONFIG_PM_SLEEP
>> -static int exynos_mixer_suspend(struct device *dev)
>> +static int __maybe_unused exynos_mixer_suspend(struct device *dev)
>>  {
>> struct mixer_context *ctx = dev_get_drvdata(dev);
>> struct mixer_resources *res = &ctx->mixer_res;
>> @@ -1247,7 +1246,7 @@ static int exynos_mixer_suspend(struct device *dev)
>> return 0;
>>  }
>>
>> -static int exynos_mixer_resume(struct device *dev)
>> +static int __maybe_unused exynos_mixer_resume(struct device *dev)
>>  {
>> struct mixer_context *ctx = dev_get_drvdata(dev);
>> struct mixer_resources *res = &ctx->mixer_res;
>> @@ -1283,7 +1282,6 @@ static int exynos_mixer_resume(struct device *dev)
>>
>> return 0;
>>  }
>> -#endif
>>
>>  static const struct dev_pm_ops exynos_mixer_pm_ops = {
>> SET_RUNTIME_PM_OPS(exynos_mixer_suspend, exynos_mixer_resume, NULL)
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
>> in
>> the body of a message to majordomo at vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


[Bug 111271] Black stripe on screen with MGAG200 (PowerEdge R320) and modesetting

2016-01-26 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=111271

Jean-Yves Faye  changed:

   What|Removed |Added

 Attachment #201421|0   |1
is obsolete||

--- Comment #6 from Jean-Yves Faye  ---
Created attachment 202001
  --> https://bugzilla.kernel.org/attachment.cgi?id=202001&action=edit
bisect log

After trying to printk around this commit, I noticed some strange behavior,
just adding debug statements making the stripe disappear. I suspected some side
effects in the compilation process.

I've redone the bisect using mrproper instead of make clean between builds,
copying my .config each time. I use make -j20 too.

Bisect results makes much more send now

Author: Christopher Harvey 
Date:   Wed Jun 5 15:24:26 2013 -0400

drm/mgag200: Hardware cursor support

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


gpu: kmalloc size WARNING in vga_arb_write

2016-01-26 Thread Daniel Vetter
On Tue, Jan 26, 2016 at 11:26:29AM +0100, Dmitry Vyukov wrote:
> Hello,
> 
> I've hit the following warning while running syzkaller fuzzer:
> 
> [ cut here ]
> WARNING: CPU: 2 PID: 29322 at mm/page_alloc.c:2999
> __alloc_pages_nodemask+0x7d2/0x1760()
> Modules linked in:
> CPU: 2 PID: 29322 Comm: syz-executor Tainted: GB   4.5.0-rc1+ #283
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
>   880069eff670 8299a06d 
>  8800658a4740 864985a0 880069eff6b0 8134fcf9
>  8166de32 864985a0 0bb7 024040c0
> Call Trace:
>  [< inline >] __dump_stack lib/dump_stack.c:15
>  [] dump_stack+0x6f/0xa2 lib/dump_stack.c:50
>  [] warn_slowpath_common+0xd9/0x140 kernel/panic.c:482
>  [] warn_slowpath_null+0x29/0x30 kernel/panic.c:515
>  [< inline >] __alloc_pages_slowpath mm/page_alloc.c:2999
>  [] __alloc_pages_nodemask+0x7d2/0x1760 mm/page_alloc.c:3253
>  [] alloc_pages_current+0xe9/0x450 mm/mempolicy.c:2090
>  [< inline >] alloc_pages include/linux/gfp.h:459
>  [] alloc_kmem_pages+0x16/0x100 mm/page_alloc.c:3433
>  [] kmalloc_order+0x1f/0x80 mm/slab_common.c:1008
>  [] kmalloc_order_trace+0x1f/0x140 mm/slab_common.c:1019
>  [< inline >] kmalloc_large include/linux/slab.h:395
>  [] __kmalloc+0x2f4/0x340 mm/slub.c:3557
>  [< inline >] kmalloc include/linux/slab.h:468
>  [] vga_arb_write+0xd4/0xe40 drivers/gpu/vga/vgaarb.c:926
>  [] do_loop_readv_writev+0x141/0x1e0 fs/read_write.c:719
>  [] do_readv_writev+0x5f8/0x6e0 fs/read_write.c:849
>  [] vfs_writev+0x86/0xc0 fs/read_write.c:886
>  [< inline >] SYSC_writev fs/read_write.c:919
>  [] SyS_writev+0x111/0x2b0 fs/read_write.c:911
>  [] entry_SYSCALL_64_fastpath+0x16/0x7a
> arch/x86/entry/entry_64.S:185
> ---[ end trace d543527022b589ec ]---
> 
> 
> vga_arb_write does:
> 
> kbuf = kmalloc(count + 1, GFP_KERNEL);
> 
> The kmalloc should use GFP_USER|__GFP_NOWARN flags since the size is
> user-controlled.
> 
> On commit 92e963f50fc74041b5e9e744c330dca48e04f08d.

Care to create a patch for this and submit it please? You've done all the
debug work, might as well take credit ;-)

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH] mm: fix pfn_t to page conversion in vm_insert_mixed

2016-01-26 Thread Dan Williams
On Tue, Jan 26, 2016 at 11:46 AM, Julian Margetson  wrote:
> On 1/26/2016 2:37 PM, Dan Williams wrote:
>
> pfn_t_to_page() honors the flags in the pfn_t value to determine if a
> pfn is backed by a page.  However, vm_insert_mixed() was originally
> written to use pfn_valid() to make this determination.  To restore the
> old/correct behavior, ignore the pfn_t flags in the !pfn_t_devmap() case
> and fallback to trusting pfn_valid().
>
> Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
> Cc: Dave Hansen 
> Cc: David Airlie 
> Reported-by: Julian Margetson 
> Reported-by: Tomi Valkeinen 
> Signed-off-by: Dan Williams 
> ---
>  mm/memory.c |9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 30991f83d0bf..93ce37989471 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1591,10 +1591,15 @@ int vm_insert_mixed(struct vm_area_struct *vma,
> unsigned long addr,
>   * than insert_pfn).  If a zero_pfn were inserted into a VM_MIXEDMAP
>   * without pte special, it would there be refcounted as a normal page.
>   */
> - if (!HAVE_PTE_SPECIAL && pfn_t_valid(pfn)) {
> + if (!HAVE_PTE_SPECIAL && !pfn_t_devmap(pfn) && pfn_t_valid(pfn)) {
>   struct page *page;
>
> - page = pfn_t_to_page(pfn);
> + /*
> + * At this point we are committed to insert_page()
> + * regardless of whether the caller specified flags that
> + * result in pfn_t_has_page() == false.
> + */
> + page = pfn_to_page(pfn_t_to_pfn(pfn));
>   return insert_page(vma, addr, page, vma->vm_page_prot);
>   }
>   return insert_pfn(vma, addr, pfn, vma->vm_page_prot);
>
>
>
> [   16.503323] systemd[1]: Mounting FUSE Control File System...
> [   42.703092] Oops: Machine check, sig: 7 [#1]
> [   42.707624] PREEMPT Canyonlands
> [   42.710959] Modules linked in:
> [   42.714201] CPU: 0 PID: 553 Comm: Xorg Not tainted 4.5.0-rc1-Sam460ex #1
> [   42.721283] task: ee1e45c0 ti: ecd46000 task.ti: ecd46000
> [   42.726983] NIP: 1fed2480 LR: 1fed2404 CTR: 1fed24d0
> [   42.732227] REGS: ecd47f10 TRAP: 0214   Not tainted  (4.5.0-rc1-Sam460ex)
> [   42.739395] MSR: 0002d000   CR: 28004262  XER: 
> [   42.746244]
> GPR00: 1f396134 bfcb0970 b77fc6f0 b6fbeffc b67d5008 0780 0004
> 
> GPR08:  b6fbeffc  bfcb0920 1fed2404 2076dff4 
> 0780
> GPR16:  0020   1e00 209be650 0438
> b67d5008
> GPR24: 0780 bfcb09c8 209a8728 b6fbf000 b6fbf000 b67d5008 1ffdaff4
> 1e00
> [   42.778096] NIP [1fed2480] 0x1fed2480
> [   42.781967] LR [1fed2404] 0x1fed2404
> [   42.785741] Call Trace:
> [   42.943688] ---[ end trace 5d20a91d2d30d9d6 ]---
> [   42.948311]
> [   46.641774] Machine check in kernel mode.
> [   46.645805] Data Write PLB Error
> [   46.649031] Machine Check exception is imprecise
> [   46.653658] Vector: 214  at [eccfbf10]
> [   46.657408] pc: 1ffa9480
> [   46.660325] lr: 1ffa9404
> [   46.663241] sp: bf9252b0
> [   46.666123]msr: 2d000
> [   46.668746]   current = 0xee1e73c0
> [   46.672149] pid   = 663, comm = Xorg
> [   46.676074] Linux version 4.5.0-rc1-Sam460ex (root at julian-VirtualBox)

Ok, I think the patch is still needed for the issue Tomi reported,
this appears to be a separate bug.

Can you send me your kernel config?


[Intel-gfx] [PATCH 0/6] Pipe level color management

2016-01-26 Thread Daniel Stone
Hi,

On 22 January 2016 at 15:04, Daniel Stone  wrote:
> On 21 January 2016 at 15:03, Lionel Landwerlin
>  wrote:
>> Hi,
>>
>> This serie introduces pipe level color management through a set of properties
>> attached to the CRTC. It also provides an implementation for some Intel
>> platforms.
>>
>> This serie is based of a previous set of patches by Shashank Sharma and takes
>> into account of the comments by Daniel Stone & Daniel Vetter.
>
> This is a lot more tractable than previous series, thanks!

One subtlety which did just come up on IRC and should probably be
documented, is the interaction with the 'Broadcast Mode' property.
Currently, Broadcast Mode logically sits on top of colour management:
all tables passed into CM are assumed to be for 0-255 colour ranges,
and setting limited BM instead clamps these tables at apply time to
16-235 (by manually adjusting them in the driver).

It'd be nice to document this, so someone doesn't implement this the
other way around, or assuming that CM trumps BM, or ...

Cheers,
Daniel


[PATCH 3/3] vc4: Add headers and .pc files for VC4 userspace development.

2016-01-26 Thread Eric Anholt
Ilia Mirkin  writes:

> On Mon, Jan 25, 2016 at 2:27 PM, Eric Anholt  wrote:
>> The headers were originally written in Mesa, imported to the kernel,
>> and improved upon in vc4-gpu-tools.  These come from the v-g-t copies
>> and will replace the Mesa and v-g-t copies, and hopefully be used from
>> new tests in igt, as well.
>>
>> Signed-off-by: Eric Anholt 
>> ---
>> --- /dev/null
>> +++ b/vc4/libdrm_vc4.pc.in
>> @@ -0,0 +1,11 @@
>> +prefix=@prefix@
>> +exec_prefix=@exec_prefix@
>> +libdir=@libdir@
>> +includedir=@includedir@
>> +
>> +Name: libdrm_vc4
>> +Description: Userspace interface to vc4 kernel DRM services
>> +Version: @PACKAGE_VERSION@
>> +Requires: libdrm
>> +Libs: -L${libdir} -ldrm_intel
>
> This probably wants to be -ldrm_vc4? Or nothing if there's no such lib yet?

Fixed to be -ldrm until we start building a libdrm_vc4.so.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/17c38df0/attachment.sig>


[PATCH 4/4] drm/layerscape: Add HDMI driver for freescale DCU

2016-01-26 Thread Meng Yi
DCU is the shortcut of 'display controller unit', some HDMI transmitter
attached to DCU, such as sii9022a, and this driver add the relavent
functions to DRM framewrok.

Signed-off-by: Meng Yi 
---
 .../bindings/display/bridge/sil,sii9022a.txt   |  40 +++
 drivers/gpu/drm/fsl-dcu/Makefile   |   1 +
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h  |   1 +
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c | 271 +
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c  |  10 +
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h   |  11 +
 6 files changed, 334 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/sil,sii9022a.txt
 create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c

diff --git a/Documentation/devicetree/bindings/display/bridge/sil,sii9022a.txt 
b/Documentation/devicetree/bindings/display/bridge/sil,sii9022a.txt
new file mode 100644
index 000..32a726a
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/sil,sii9022a.txt
@@ -0,0 +1,40 @@
+Device-Tree bindings for the SiI902x hdmi transmitter.
+-
+
+The SiI9022A is an ultra low-power HDMI transmitter. It supports resolutions 
from
+standard definition 480i/p and 576i/p all the way to high-definition 720p, 
1080i,
+and 1080p, the highest resolution supported by HDTVs today. It also supports 
all
+PC resolutions up to UXGA for netbooks
+
+Required properties:
+- compatible:  Should be "sil,sii9022a".
+- reg: The I2C address of the device.
+- interrupts:  Interrupt number to the cpu.
+
+Required nodes:
+
+The sii9022 has one video ports. Its connection is modelled using the OF
+graph bindings specified in Documentation/devicetree/bindings/graph.txt.
+
+- Video port 0 for the HDMI output
+
+Example:
+---
+
+sii9022: hdmi at 39 {
+compatible = "sil,sii9022a";
+reg = <0x39>;
+interrupts = ;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port at 0 {
+reg = <1>;
+sii9022_out: endpoint {
+remote-endpoint = <&hdmi_con>;
+};
+};
+};
+};
diff --git a/drivers/gpu/drm/fsl-dcu/Makefile b/drivers/gpu/drm/fsl-dcu/Makefile
index 6ea1523..98cacc2 100644
--- a/drivers/gpu/drm/fsl-dcu/Makefile
+++ b/drivers/gpu/drm/fsl-dcu/Makefile
@@ -1,6 +1,7 @@
 fsl-dcu-drm-y := fsl_dcu_drm_drv.o \
 fsl_dcu_drm_kms.o \
 fsl_dcu_drm_rgb.o \
+fsl_dcu_drm_hdmi.o \
 fsl_dcu_drm_plane.o \
 fsl_dcu_drm_crtc.o \
 fsl_dcu_drm_fbdev.o
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
index 579b9e4..3c85072 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -187,6 +187,7 @@ struct fsl_dcu_drm_device {
struct drm_fbdev_cma *fbdev;
struct drm_crtc crtc;
struct drm_encoder encoder;
+   struct drm_encoder_slave *slave;
struct fsl_dcu_drm_connector connector;
const struct fsl_dcu_soc_data *soc;
 };
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c
new file mode 100644
index 000..0b06060
--- /dev/null
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c
@@ -0,0 +1,271 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * Freescale DCU drm device driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "fsl_dcu_drm_drv.h"
+#include "fsl_dcu_drm_output.h"
+
+#define to_drm_encoder_slave(e) \
+   container_of(e, struct drm_encoder_slave, base)
+#define to_slave_funcs(e)  (to_drm_encoder_slave(e)->slave_funcs)
+static void fsl_dcu_drm_hdmienc_mode_set(struct drm_encoder *encoder,
+struct drm_display_mode *mode,
+struct drm_display_mode *adjusted_mode)
+{
+   const struct drm_encoder_slave_funcs *sfuncs = to_slave_funcs(encoder);
+
+   if (sfuncs->mode_set)
+   sfuncs->mode_set(encoder, mode, adjusted_mode);
+
+}
+
+static int
+fsl_dcu_drm_hdmienc_atomic_check(struct drm_encoder *encoder,
+struct drm_crtc_state *crtc_state,
+struct drm_connector_state *conn_state)
+{
+

[PATCH 3/4] drm/layerscape: Add sii9022a driver

2016-01-26 Thread Meng Yi
The SiI9022A is an ultra low-power HDMI transmitter. It supports
resolutions from standard definition 480i/p and 576i/p all the way
to high-definition 720p, 1080i, and 1080p, the highest resolution
supported by HDTVs today. It also supports all PC resolutions up
to UXGA for netbooks

Signed-off-by: Meng Yi 
---
 drivers/gpu/drm/i2c/Kconfig   |   6 +
 drivers/gpu/drm/i2c/Makefile  |   3 +
 drivers/gpu/drm/i2c/sii9022_drv.c | 449 ++
 3 files changed, 458 insertions(+)
 create mode 100644 drivers/gpu/drm/i2c/sii9022_drv.c

diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
index 22c7ed6..8646729 100644
--- a/drivers/gpu/drm/i2c/Kconfig
+++ b/drivers/gpu/drm/i2c/Kconfig
@@ -31,4 +31,10 @@ config DRM_I2C_NXP_TDA998X
help
  Support for NXP Semiconductors TDA998X HDMI encoders.

+config DRM_I2C_SII9022
+   tristate "Silicon Image sii9022 TMDS transmitter"
+   help
+ Support for sii9022 and similar single-link (or dual-link
+ when used in pairs) TMDS transmitters.
+
 endmenu
diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
index 2c72eb5..cf2e8b9 100644
--- a/drivers/gpu/drm/i2c/Makefile
+++ b/drivers/gpu/drm/i2c/Makefile
@@ -10,3 +10,6 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o

 tda998x-y := tda998x_drv.o
 obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
+
+sii9022-y := sii9022_drv.o
+obj-$(CONFIG_DRM_I2C_SII9022) +=sii9022.o
diff --git a/drivers/gpu/drm/i2c/sii9022_drv.c 
b/drivers/gpu/drm/i2c/sii9022_drv.c
new file mode 100644
index 000..bc49cad
--- /dev/null
+++ b/drivers/gpu/drm/i2c/sii9022_drv.c
@@ -0,0 +1,449 @@
+/*
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * Freescale DCU drm device driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#define SII902X_INPUT_BUS_FMT  0x08
+#define SII902X_TPI_AVI_INPUT_FMT  0x09
+#define SII902X_TPI_AVI_OUTPUT_FMT 0x0A
+#define SII902X_SYS_CONTROL0x1A
+#define SII902X_SYS_CTR_DDC_REQBIT(2)
+#define SII902X_SYS_CTR_DDC_BUS_AVAI   (BIT(2) | BIT(1))
+#define SII902X_TPI_FAMILY_DEV_ID  0x1B
+#define SII902X_TPI_DEV_REV_ID 0x1C
+#define SII902X_TPI_REV_LEVEL_ID   0x1D
+#define SII902X_POWER_STATE0x1E
+#define SII902X_TPI_AUDIO_CFG0 0x24
+#define SII902X_TPI_AUDIO_CFG1 0x25
+#define SII902X_TPI_AUDIO_CFG2 0x26
+#define SII902X_TPI_AUDIO_CFG3 0x27
+#define SII902X_TPI_HDCP_REV   0x30
+#define SII902X_TPI_INT_ENABLE 0x3C
+#define SII902X_TPI_INT_STATUS 0x3D
+#define SII902X_TPI_INT_PLUG_INBIT(2)
+#define SII902X_GENERAL_PURPOSE_IO00xBC
+#define SII902X_GENERAL_PURPOSE_IO10xBD
+#define SII902X_GENERAL_PURPOSE_IO20xBE
+#define SII902X_TRANS_MODE_DIFF0xC7
+
+bool g_enable_hdmi;
+
+struct sii902x_data {
+   struct i2c_client *client;
+   struct delayed_work det_work;
+   struct fb_info *fbi;
+} *sii902x;
+
+#define to_sii902x_data(x) \
+   ((struct sii902x_data *)to_encoder_slave(x)->slave_priv)
+
+static struct i2c_client *sii902x_to_i2c(struct sii902x_data *sii902x)
+{
+   return sii902x->client;
+}
+
+/* HW access functions */
+static s32 sii902x_write(const struct i2c_client *client,
+u8 command, u8 value)
+{
+   return i2c_smbus_write_byte_data(client, command, value);
+}
+
+static s32 sii902x_read(const struct i2c_client *client, u8 command)
+{
+   int val;
+
+   val = i2c_smbus_read_word_data(client, command);
+
+   return val & 0xff;
+}
+
+static void sii902x_poweron(void)
+{
+   /* Turn on DVI or HDMI */
+   sii902x_write(sii902x->client, SII902X_SYS_CONTROL, 0x00);
+}
+
+static void sii902x_poweroff(void)
+{
+   /* disable tmds before changing resolution */
+   sii902x_write(sii902x->client, SII902X_SYS_CONTROL, 0x10);
+}
+
+
+static void sii902x_chip_id(struct sii902x_data *sii902x)
+{
+   struct i2c_client *client = sii902x_to_i2c(sii902x);
+   int val;
+
+   /* read device ID */
+   val = sii902x_read(client, SII902X_TPI_FAMILY_DEV_ID);
+   pr_info("Sii902x: read id = 0x%02X", val);
+   val = sii902x_read(client, SII902X_TPI_DEV_REV_ID);
+   pr_info("-0x%02X", val);
+   val = sii902x_read(client, SII902X_TPI_REV_LEVEL_ID);
+   pr_info("-0x%02X", val);
+   val = sii902x_read(client, SII902X_TPI_HDCP_REV);
+   pr_info("-0x%02X\n", val);
+}
+
+static int sii902x_initialize(struct sii902x_data *sii902x)
+{
+   struct i2c_client *client = sii902x_to_i2c(sii902x);
+   int ret, cnt;
+
+   for (cnt = 0; cnt < 5; cnt++) {
+ 

[PATCH 2/4] arm:dts:ls1021a: Add sii9022a dts node

2016-01-26 Thread Meng Yi
The SiI9022A is an ultra low-power HDMI transmitter. It supports
resolutions from standard definition 480i/p and 576i/p all the way
to high-definition 720p, 1080i, and 1080p, the highest resolution
supported by HDTVs today. It also supports all PC resolutions up
to UXGA for netbooks

Signed-off-by: Meng Yi 
---
 arch/arm/boot/dts/ls1021a-twr.dts | 29 +
 1 file changed, 29 insertions(+)

diff --git a/arch/arm/boot/dts/ls1021a-twr.dts 
b/arch/arm/boot/dts/ls1021a-twr.dts
index fad2e3b..462b6a1 100644
--- a/arch/arm/boot/dts/ls1021a-twr.dts
+++ b/arch/arm/boot/dts/ls1021a-twr.dts
@@ -57,6 +57,17 @@
enet1_sgmii_phy = &sgmii_phy0;
};

+   hdmi-out {
+   compatible = "hdmi-connector";
+   type = "a";
+
+   port {
+   hdmi_con: endpoint {
+   remote-endpoint = <&sii9022a_out>;
+   };
+   };
+   };
+
sys_mclk: clock-mclk {
compatible = "fixed-clock";
#clock-cells = <0>;
@@ -180,6 +191,24 @@
VDDIO-supply = <®_3p3v>;
clocks = <&sys_mclk 1>;
};
+
+   sii9022a: hdmi at 39 {
+   compatible = "sil,sii9022a";
+   reg = <0x39>;
+   interrupts = ;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port at 0 {
+   reg = <1>;
+   sii9022a_out: endpoint {
+   remote-endpoint = <&hdmi_con>;
+   };
+   };
+   };
+   };
 };

 &ifc {
-- 
2.1.0.27.g96db324



[PATCH 1/4] drm/fsl-dcu: Cleanup vblank interrupt mask and status setting code

2016-01-26 Thread Meng Yi
From: Jianwei Wang 

Switch update interrupt mask bit with regmap_update_bits, and clear
interrupt status by writing 1 to relevant bit before setting mask in
fsl_dcu_drm_irq_init function.

Signed-off-by: JianWei Wang 
Signed-off-by: Meng Yi 
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 +++---
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c 
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index fca97d3..cbef47c 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -38,21 +38,17 @@ static const struct regmap_config fsl_dcu_regmap_config = {
 static int fsl_dcu_drm_irq_init(struct drm_device *dev)
 {
struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-   unsigned int value;
int ret;

ret = drm_irq_install(dev, fsl_dev->irq);
if (ret < 0)
dev_err(dev->dev, "failed to install IRQ handler\n");

-   ret = regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0);
+   ret = regmap_write(fsl_dev->regmap, DCU_INT_STATUS, 0x);
if (ret)
dev_err(dev->dev, "set DCU_INT_STATUS failed\n");
-   ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
-   if (ret)
-   dev_err(dev->dev, "read DCU_INT_MASK failed\n");
-   value &= DCU_INT_MASK_VBLANK;
-   ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
+   ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK,
+DCU_INT_MASK_VBLANK, ~DCU_INT_MASK_VBLANK);
if (ret)
dev_err(dev->dev, "set DCU_INT_MASK failed\n");
ret = regmap_write(fsl_dev->regmap, DCU_UPDATE_MODE,
@@ -143,14 +139,10 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
 static int fsl_dcu_drm_enable_vblank(struct drm_device *dev, unsigned int pipe)
 {
struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-   unsigned int value;
int ret;

-   ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
-   if (ret)
-   dev_err(dev->dev, "read DCU_INT_MASK failed\n");
-   value &= ~DCU_INT_MASK_VBLANK;
-   ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
+   ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK,
+DCU_INT_MASK_VBLANK, ~DCU_INT_MASK_VBLANK);
if (ret)
dev_err(dev->dev, "set DCU_INT_MASK failed\n");
return 0;
@@ -160,14 +152,10 @@ static void fsl_dcu_drm_disable_vblank(struct drm_device 
*dev,
   unsigned int pipe)
 {
struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-   unsigned int value;
int ret;

-   ret = regmap_read(fsl_dev->regmap, DCU_INT_MASK, &value);
-   if (ret)
-   dev_err(dev->dev, "read DCU_INT_MASK failed\n");
-   value |= DCU_INT_MASK_VBLANK;
-   ret = regmap_write(fsl_dev->regmap, DCU_INT_MASK, value);
+   ret = regmap_update_bits(fsl_dev->regmap, DCU_INT_MASK,
+DCU_INT_MASK_VBLANK, DCU_INT_MASK_VBLANK);
if (ret)
dev_err(dev->dev, "set DCU_INT_MASK failed\n");
 }
-- 
2.1.0.27.g96db324



gpu: kmalloc size WARNING in vga_arb_write

2016-01-26 Thread Dmitry Vyukov
Hello,

I've hit the following warning while running syzkaller fuzzer:

[ cut here ]
WARNING: CPU: 2 PID: 29322 at mm/page_alloc.c:2999
__alloc_pages_nodemask+0x7d2/0x1760()
Modules linked in:
CPU: 2 PID: 29322 Comm: syz-executor Tainted: GB   4.5.0-rc1+ #283
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
  880069eff670 8299a06d 
 8800658a4740 864985a0 880069eff6b0 8134fcf9
 8166de32 864985a0 0bb7 024040c0
Call Trace:
 [< inline >] __dump_stack lib/dump_stack.c:15
 [] dump_stack+0x6f/0xa2 lib/dump_stack.c:50
 [] warn_slowpath_common+0xd9/0x140 kernel/panic.c:482
 [] warn_slowpath_null+0x29/0x30 kernel/panic.c:515
 [< inline >] __alloc_pages_slowpath mm/page_alloc.c:2999
 [] __alloc_pages_nodemask+0x7d2/0x1760 mm/page_alloc.c:3253
 [] alloc_pages_current+0xe9/0x450 mm/mempolicy.c:2090
 [< inline >] alloc_pages include/linux/gfp.h:459
 [] alloc_kmem_pages+0x16/0x100 mm/page_alloc.c:3433
 [] kmalloc_order+0x1f/0x80 mm/slab_common.c:1008
 [] kmalloc_order_trace+0x1f/0x140 mm/slab_common.c:1019
 [< inline >] kmalloc_large include/linux/slab.h:395
 [] __kmalloc+0x2f4/0x340 mm/slub.c:3557
 [< inline >] kmalloc include/linux/slab.h:468
 [] vga_arb_write+0xd4/0xe40 drivers/gpu/vga/vgaarb.c:926
 [] do_loop_readv_writev+0x141/0x1e0 fs/read_write.c:719
 [] do_readv_writev+0x5f8/0x6e0 fs/read_write.c:849
 [] vfs_writev+0x86/0xc0 fs/read_write.c:886
 [< inline >] SYSC_writev fs/read_write.c:919
 [] SyS_writev+0x111/0x2b0 fs/read_write.c:911
 [] entry_SYSCALL_64_fastpath+0x16/0x7a
arch/x86/entry/entry_64.S:185
---[ end trace d543527022b589ec ]---


vga_arb_write does:

kbuf = kmalloc(count + 1, GFP_KERNEL);

The kmalloc should use GFP_USER|__GFP_NOWARN flags since the size is
user-controlled.

On commit 92e963f50fc74041b5e9e744c330dca48e04f08d.


[PATCH v7 2/2] dt-bindings: add document for Innosilicon HDMI on Rockchip platform

2016-01-26 Thread Yakir Yang
Signed-off-by: Yakir Yang 

Signed-off-by: Yakir Yang 
Acked-by: Rob Herring 
---
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2:
- Add the Acked-by tags from Rob
- Correct the misspell "rk3036-dw-hdmi" (Heiko)

 .../display/rockchip/inno_hdmi-rockchip.txt| 50 ++
 1 file changed, 50 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt
new file mode 100644
index 000..8096a29
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt
@@ -0,0 +1,50 @@
+Rockchip specific extensions to the Innosilicon HDMI
+
+
+Required properties:
+- compatible:
+   "rockchip,rk3036-inno-hdmi";
+- reg:
+   Physical base address and length of the controller's registers.
+- clocks, clock-names:
+   Phandle to hdmi controller clock, name should be "pclk"
+- interrupts:
+   HDMI interrupt number
+- ports:
+   Contain one port node with endpoint definitions as defined in
+   Documentation/devicetree/bindings/graph.txt.
+- pinctrl-0, pinctrl-name:
+   Switch the iomux of HPD/CEC pins to HDMI function.
+
+Example:
+hdmi: hdmi at 20034000 {
+   compatible = "rockchip,rk3036-inno-hdmi";
+   reg = <0x20034000 0x4000>;
+   interrupts = ;
+   clocks = <&cru  PCLK_HDMI>;
+   clock-names = "pclk";
+   pinctrl-names = "default";
+   pinctrl-0 = <&hdmi_ctl>;
+   status = "disabled";
+
+   hdmi_in: port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   hdmi_in_lcdc: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <&lcdc_out_hdmi>;
+   };
+   };
+};
+
+&pinctrl {
+   hdmi {
+   hdmi_ctl: hdmi-ctl {
+   rockchip,pins = <1 8  RK_FUNC_1 &pcfg_pull_none>,
+   <1 9  RK_FUNC_1 &pcfg_pull_none>,
+   <1 10 RK_FUNC_1 &pcfg_pull_none>,
+   <1 11 RK_FUNC_1 &pcfg_pull_none>;
+   };
+   };
+
+};
-- 
1.9.1




[PATCH v7 1/2] drm/rockchip: hdmi: add Innosilicon HDMI support

2016-01-26 Thread Yakir Yang
The Innosilicon HDMI is a low power HDMI 1.4 transmitter
IP, and it have been integrated on some rockchip CPUs
(like RK3036, RK312x).

Signed-off-by: Yakir Yang 
---
Changes in v7:
- Correct the module licnese statement (Paul)
 - MODULE_LICENSE("GPL");
 + MODULE_LICENSE("GPL v2");
- Start indentation with tabs and fix the misspell in Kconfig (Paul)
- Carry the lost device-binding document (Heiko)

Changes in v6:
- Rebase the Makefile/Kconfig files which add by Chris's rockchip-mipi driver 
(Caeser)

Changes in v5:
- Use hdmi_infoframe helper functions to packed the infoframe (Russell)
- Remove the unused double wait_for_completion_timeout for ddc transfer 
(Russell)
- Remove the unused local variable in "inno_hdmi_i2c_write()" function (Russell)

Changes in v4:
- Modify the commit title "drm/rockchip: hdmi: ..." (Mark)
- Correct the "DKMS" to "DPMS" (Mark)
- Fix over 80 characters problems (Mark)
- Remove encoder .prepare/.commit helper functions, and move the vop mode
configure function into encoder .enable helper functions. (Mark)

Changes in v3:
- Use encoder enable/disable function, and remove the encoder DPMS function
- Keep HDMI PLL power on in standby mode

Changes in v2:
- Using DRM atomic helper functions for connector init (Mark)
- Remove "hdmi->connector.encoder = encoder;" (Mark)

 drivers/gpu/drm/rockchip/Kconfig |   8 +
 drivers/gpu/drm/rockchip/Makefile|   1 +
 drivers/gpu/drm/rockchip/inno_hdmi.c | 941 +++
 drivers/gpu/drm/rockchip/inno_hdmi.h | 362 ++
 4 files changed, 1312 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/inno_hdmi.c
 create mode 100644 drivers/gpu/drm/rockchip/inno_hdmi.h

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 8573985..76b3362 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -35,3 +35,11 @@ config ROCKCHIP_DW_MIPI_DSI
 for the Synopsys DesignWare HDMI driver. If you want to
 enable MIPI DSI on RK3288 based SoC, you should selet this
 option.
+
+config ROCKCHIP_INNO_HDMI
+   tristate "Rockchip specific extensions for Innosilicon HDMI"
+   depends on DRM_ROCKCHIP
+   help
+ This selects support for Rockchip SoC specific extensions
+ for the Innosilicon HDMI driver. If you want to enable
+ HDMI on RK3036 based SoC, you should select this option.
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index f6a809a..df8fbef 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -8,5 +8,6 @@ rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += 
rockchip_drm_fbdev.o

 obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
 obj-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o
+obj-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o

 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_vop_reg.o
diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c 
b/drivers/gpu/drm/rockchip/inno_hdmi.c
new file mode 100644
index 000..086c710
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -0,0 +1,941 @@
+/*
+ * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
+ *Zheng Yang 
+ *Yakir Yang 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"
+
+#include "inno_hdmi.h"
+
+#define to_inno_hdmi(x)container_of(x, struct inno_hdmi, x)
+
+struct hdmi_data_info {
+   int vic;
+   bool sink_is_hdmi;
+   bool sink_has_audio;
+   unsigned int enc_in_format;
+   unsigned int enc_out_format;
+   unsigned int colorimetry;
+};
+
+struct inno_hdmi_i2c {
+   struct i2c_adapter adap;
+
+   u8 ddc_addr;
+   u8 segment_addr;
+
+   struct mutex lock;
+   struct completion cmp;
+};
+
+struct inno_hdmi {
+   struct device *dev;
+   struct drm_device *drm_dev;
+
+   int irq;
+   struct clk *pclk;
+   void __iomem *regs;
+
+   struct drm_connectorconnector;
+   struct drm_encoder  encoder;
+
+   struct inno_hdmi_i2c *i2c;
+   struct i2c_adapter *ddc;
+
+   unsigned int tmds_rate;
+
+   struct hdmi_data_info   hdmi_data;
+   struct drm_display_mode previous_mode;
+};
+
+enum {
+   CSC_ITU601_16_235_TO_RGB_0_255_8BIT,
+   CSC_ITU601_0_255_TO_RGB_0_255_8BIT,
+   CSC_ITU709_16_235_TO_RGB_0

[PATCH v7 0/2] Add Rockchip Inno-HDMI driver

2016-01-26 Thread Yakir Yang

Here are a brief introduction to Innosilicon HDMI IP:
  - Support HDMI 1.4a, HDCP 1.2 and DVI 1.0 standard compliant transmitter
  - Support HDMI1.4 a/b 3D function defined in HDMI 1.4 a/b spec
  - Digital video interface supports a pixel size of 24, 30, 36, 48bits color 
depth in RGB
  - S/PDIF output supports PCM, Dolby Digital, DTS digital audio transmission
(32-192kHz Fs) using IEC60958 and IEC 61937
  - The EDID and CEC function are also supported by Innosilicon HDMI 
Transmitter Controlle

Changes in v7:
- Correct the module licnese statement (Paul)
 - MODULE_LICENSE("GPL");
 + MODULE_LICENSE("GPL v2");
- Start indentation with tabs and fix the misspell in Kconfig (Paul)
- Carry the lost device-binding document (Heiko)

Changes in v6:
- Rebase the Makefile/Kconfig files which add by Chris's rockchip-mipi driver 
(Caeser)

Changes in v5:
- Use hdmi_infoframe helper functions to packed the infoframe (Russell)
- Remove the unused double wait_for_completion_timeout for ddc transfer 
(Russell)
- Remove the unused local variable in "inno_hdmi_i2c_write()" function (Russell)

Changes in v4:
- Modify the commit title "drm/rockchip: hdmi: ..." (Mark)
- Correct the "DKMS" to "DPMS" (Mark)
- Fix over 80 characters problems (Mark)
- Remove encoder .prepare/.commit helper functions, and move the vop mode
configure function into encoder .enable helper functions. (Mark)

Changes in v3:
- Use encoder enable/disable function, and remove the encoder DPMS function
- Keep HDMI PLL power on in standby mode

Changes in v2:
- Using DRM atomic helper functions for connector init (Mark)
- Remove "hdmi->connector.encoder = encoder;" (Mark)
- Add the Acked-by tags from Rob
- Correct the misspell "rk3036-dw-hdmi" (Heiko)

Yakir Yang (2):
  drm/rockchip: hdmi: add Innosilicon HDMI support
  dt-bindings: add document for Innosilicon HDMI on Rockchip platform

 .../display/rockchip/inno_hdmi-rockchip.txt|  50 ++
 drivers/gpu/drm/rockchip/Kconfig   |   8 +
 drivers/gpu/drm/rockchip/Makefile  |   1 +
 drivers/gpu/drm/rockchip/inno_hdmi.c   | 941 +
 drivers/gpu/drm/rockchip/inno_hdmi.h   | 362 
 5 files changed, 1362 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt
 create mode 100644 drivers/gpu/drm/rockchip/inno_hdmi.c
 create mode 100644 drivers/gpu/drm/rockchip/inno_hdmi.h

-- 
1.9.1




[PATCH] mm: fix pfn_t to page conversion in vm_insert_mixed

2016-01-26 Thread Dan Williams
pfn_t_to_page() honors the flags in the pfn_t value to determine if a
pfn is backed by a page.  However, vm_insert_mixed() was originally
written to use pfn_valid() to make this determination.  To restore the
old/correct behavior, ignore the pfn_t flags in the !pfn_t_devmap() case
and fallback to trusting pfn_valid().

Fixes: 01c8f1c44b83 ("mm, dax, gpu: convert vm_insert_mixed to pfn_t")
Cc: Dave Hansen 
Cc: David Airlie 
Reported-by: Julian Margetson 
Reported-by: Tomi Valkeinen 
Signed-off-by: Dan Williams 
---
 mm/memory.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 30991f83d0bf..93ce37989471 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1591,10 +1591,15 @@ int vm_insert_mixed(struct vm_area_struct *vma, 
unsigned long addr,
 * than insert_pfn).  If a zero_pfn were inserted into a VM_MIXEDMAP
 * without pte special, it would there be refcounted as a normal page.
 */
-   if (!HAVE_PTE_SPECIAL && pfn_t_valid(pfn)) {
+   if (!HAVE_PTE_SPECIAL && !pfn_t_devmap(pfn) && pfn_t_valid(pfn)) {
struct page *page;

-   page = pfn_t_to_page(pfn);
+   /*
+* At this point we are committed to insert_page()
+* regardless of whether the caller specified flags that
+* result in pfn_t_has_page() == false.
+*/
+   page = pfn_to_page(pfn_t_to_pfn(pfn));
return insert_page(vma, addr, page, vma->vm_page_prot);
}
return insert_pfn(vma, addr, pfn, vma->vm_page_prot);



[PATCH v6 0/1] Introduce Innosilicon HDMI driver on Rockchip platforms

2016-01-26 Thread Yakir Yang
Hi Heiko,

On 01/25/2016 08:47 PM, Heiko Stübner wrote:
> Am Montag, 25. Januar 2016, 09:43:17 schrieb Yakir Yang:
>> Here are a brief introduction to Innosilicon HDMI IP:
>>- Support HDMI 1.4a, HDCP 1.2 and DVI 1.0 standard compliant transmitter
>>- Support HDMI1.4 a/b 3D function defined in HDMI 1.4 a/b spec
>>- Digital video interface supports a pixel size of 24, 30, 36, 48bits
>> color depth in RGB - S/PDIF output supports PCM, Dolby Digital, DTS digital
>> audio transmission (32-192kHz Fs) using IEC60958 and IEC 61937
>>- The EDID and CEC function are also supported by Innosilicon HDMI
>> Transmitter Controlle
> have you lost separate the devicetree-binding patch somewhere?
>
> I don't remember it getting applied and Mark may miss it if it's only
> contained in some old series.

Ops, I may misunderstand the rule, I thought if patch was acked by 
maintainer, then I should keep it no changed. Hmmm, so not Acked but 
Applied, thanks, I would update now.

Yakir
>
> Heiko
>
>
>




[PATCH v6] drm/rockchip: hdmi: add Innosilicon HDMI support

2016-01-26 Thread Yakir Yang
Hi Paul,

On 01/26/2016 08:45 AM, Paul Bolle wrote:
> On ma, 2016-01-25 at 09:47 +0800, Yakir Yang wrote:
>> --- a/drivers/gpu/drm/rockchip/Kconfig
>> +++ b/drivers/gpu/drm/rockchip/Kconfig
>> +config ROCKCHIP_INNO_HDMI
>> +tristate "Rockchip specific extensions for Innosilicon HDMI"
>> +depends on DRM_ROCKCHIP
>> +help
>> +  This selects support for Rockchip SoC specific extensions
>> +  for the Innosilicon HDMI driver. If you want to enable
>> +  HDMI on RK3036 based SoC, you should selet this option.
> (Really trivial: start indentation with tabs only, please. And
> s/selet/select/.)
Got it
>> --- /dev/null
>> +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
>> + * This software is licensed under the terms of the GNU General
>> Public
>> + * License version 2, as published by the Free Software Foundation,
>> and
>> + * may be copied, distributed, and modified under those terms.
> This states this file is licensed GPL v2 only.
>
>> +MODULE_LICENSE("GPL");
> And, according to include/linux/module.h, this means "GNU Public License
> v2 or later".
>
> So I think there's a (subtle) mismatch between the license ident used
> for this driver and the comment above.

Ah, thanks.

- Yakir

> Thanks,
>
>
> Paul Bolle
>
>
>




omapdrm broken on v4.5-rc1, bisected to "mm, dax, gpu: convert vm_insert_mixed to pfn_t"

2016-01-26 Thread Tomi Valkeinen
0 34325241 34325258 00054180 
34324258 0780
[   22.855072] 3fe0:  bebe9278 00038aac 00038ab4 800c0110 
[   22.855072]  r8:10c5387d r7:10c5387d r6: r5:800c0110 r4:00038ab4
[   22.855072] Code: e92dd9f0 e24cb004 e24dd014 e1a04002 (e5922014) 
[   22.888793] ---[ end trace b07c2ddadd5dfa33 ]---

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/d9d3de05/attachment.sig>


[Bug 93649] [radeonsi] Graphics lockup while playing tf2

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93649

--- Comment #7 from pc.jago1337 at gmail.com ---
CPU: FX 8350
GPU: R9 390
MB: Asrock 970 Extreme4

Software: 

Kernel: 4.3.3-3-ARCH x86_64
Mesa: 11.1.1
DRM: 2.43.0
LLVM: 3.7.0
X: 1.18.0


As mentioned above, I get the crash with TF2, but *NOT* CS:GO.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/a9ca0985/attachment.html>


omapdrm broken on v4.5-rc1, bisected to "mm, dax, gpu: convert vm_insert_mixed to pfn_t"

2016-01-26 Thread Dan Williams
On Tue, Jan 26, 2016 at 12:24 AM, Tomi Valkeinen  
wrote:
> Hi Dan,
>
> omapdrm crashes on v4.5-rc1, and I bisected the problem to:
>
> 01c8f1c44b83a0825b573e7c723b033cece37b86 ("mm, dax, gpu: convert 
> vm_insert_mixed to pfn_t").
>
> Below is the crash dump. Any ideas?

Thanks for this.  I think I see the problem in vm_insert_mixed(), I'll
send a fix to test shortly.


[Bug 93360] [radeonsi/llvm] Segfault in CS:GO

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93360

Michel D�nzer  changed:

   What|Removed |Added

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/ac56131a/attachment.html>


[PATCH] drm/exynos: fix building without CONFIG_PM_SLEEP

2016-01-26 Thread Krzysztof Kozlowski
2015-11-18 0:08 GMT+09:00 Arnd Bergmann :
> The runtime PM operations use the suspend/resume functions
> even when CONFIG_PM_SLEEP is not set, but this now fails
> for the exynos DRM driver:
>
> exynos_mixer.c:1289:61: error: 'exynos_mixer_resume' undeclared here (not in 
> a function)
>   SET_RUNTIME_PM_OPS(exynos_mixer_suspend, exynos_mixer_resume, NULL)
>
> This removes the #ifdef and instead marks the functions as
> __maybe_unused, which does the right thing in all cases and
> also looks nicer.
>
> Signed-off-by: Arnd Bergmann 
> Fixes:   ("drm/exynos: add pm_runtime to Mixer")

Dear Inki,

Ping? On 4.5-rc1 this is still broken. Can you apply this for fixes
for current rc-cycle?

Reviewed-by: Krzysztof Kozlowski 

Best regards,
Krzysztof


>
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 7498c6e76a53..fcaf71df77c1 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -1230,8 +1230,7 @@ static int mixer_remove(struct platform_device *pdev)
> return 0;
>  }
>
> -#ifdef CONFIG_PM_SLEEP
> -static int exynos_mixer_suspend(struct device *dev)
> +static int __maybe_unused exynos_mixer_suspend(struct device *dev)
>  {
> struct mixer_context *ctx = dev_get_drvdata(dev);
> struct mixer_resources *res = &ctx->mixer_res;
> @@ -1247,7 +1246,7 @@ static int exynos_mixer_suspend(struct device *dev)
> return 0;
>  }
>
> -static int exynos_mixer_resume(struct device *dev)
> +static int __maybe_unused exynos_mixer_resume(struct device *dev)
>  {
> struct mixer_context *ctx = dev_get_drvdata(dev);
> struct mixer_resources *res = &ctx->mixer_res;
> @@ -1283,7 +1282,6 @@ static int exynos_mixer_resume(struct device *dev)
>
> return 0;
>  }
> -#endif
>
>  static const struct dev_pm_ops exynos_mixer_pm_ops = {
> SET_RUNTIME_PM_OPS(exynos_mixer_suspend, exynos_mixer_resume, NULL)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 93862] [Bisected] "drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2" is bad

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93862

--- Comment #5 from Michel D�nzer  ---
The kernel change is correct, it merely exposed bugs in Mesa
(https://patchwork.freedesktop.org/patch/71628/) and xf86-video-amdgpu
(http://lists.x.org/archives/xorg-driver-ati/2016-January/028475.html).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/8bba3fad/attachment-0001.html>


[PATCH 1/2] drm/panel: simple: Add support for Sharp LQ101K1LY04

2016-01-26 Thread Joshua Clayton
On Tuesday, January 12, 2016 01:55:35 PM Joshua Clayton wrote:
> Add simple-panel support for the  Sharp LQ101K1LY04i, which  is
> a 10 inch WXGA (1280x800) lvds panel.
> 
> Signed-off-by: Joshua Clayton 
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 27 +++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> b/drivers/gpu/drm/panel/panel-simple.c
> index f97b73e..e01eacb 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -1073,6 +1073,30 @@ static const struct panel_desc samsung_ltn140at29_301 
> = {
>   },
>  };
>  
> +static const struct display_timing sharp_lq101k1ly04_timing = {
> + .pixelclock = { 6000, 6500, 8000 },
> + .hactive = { 1280, 1280, 1280 },
> + .hfront_porch = { 20, 20, 20 },
> + .hback_porch = { 20, 20, 20 },
> + .hsync_len = { 10, 10, 10 },
> + .vactive = { 800, 800, 800 },
> + .vfront_porch = { 4, 4, 4 },
> + .vback_porch = { 4, 4, 4 },
> + .vsync_len = { 4, 4, 4 },
> + .flags = DISPLAY_FLAGS_PIXDATA_POSEDGE,
> +};
> +
> +static const struct panel_desc sharp_lq101k1ly04 = {
> + .timings = &sharp_lq101k1ly04_timing,
> + .num_timings = 1,
> + .bpc = 8,
> + .size = {
> + .width = 217,
> + .height = 136,
> + },
> + .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
> +};
> +
>  static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
>   .clock = 33300,
>   .hdisplay = 800,
> @@ -1188,6 +1212,9 @@ static const struct of_device_id platform_of_match[] = {
>   .compatible = "samsung,ltn140at29-301",
>   .data = &samsung_ltn140at29_301,
>   }, {
> + .compatible = "sharp,lq101k1ly04",
> + .data = &sharp_lq101k1ly04,
> + }, {
>   .compatible = "shelly,sca07010-bfn-lnn",
>   .data = &shelly_sca07010_bfn_lnn,
>   }, {
Ping? This panel is needed for a system I am working to get upstreamed.
I can confirm that the timings are in use several months and well tested.



[Bug 93649] [radeonsi] Graphics lockup while playing tf2

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93649

--- Comment #6 from Matthew Dawson  ---
Created attachment 121293
  --> https://bugs.freedesktop.org/attachment.cgi?id=121293&action=edit
Second patch to fix system lockup after gpu reset

This is already taken accepted from the mailing list, including here for
completeness.

If anyone is experiencing this issue, can you please try with all of these
patches applied?  For now, X should die and restart without acceleration, but
getting a dmesg out or restarting should be fine.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/4aa8fc38/attachment.html>


[Bug 93649] [radeonsi] Graphics lockup while playing tf2

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93649

--- Comment #5 from pc.jago1337 at gmail.com ---
Can confirm, I have either the same or a similar problem on my R9 390 (using
radeon, with DPM disabled). It doesn't just crash X though, it completely locks
up and I have to reboot to even use TTY. Happens after 10-20 mins of TF2.

Running Arch Linux with everything up to date but no AUR packages, will post
specifics later.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/59ac2b73/attachment-0001.html>


[Bug 93862] [Bisected] "drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2" is bad

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93862

--- Comment #4 from Ernst Sj�strand  ---
Created attachment 121292
  --> https://bugs.freedesktop.org/attachment.cgi?id=121292&action=edit
dmesg

Full of:
[  240.780604] amdgpu :01:00.0: 8800a8c31c00 pin failed
[  240.780630] [drm:amdgpu_crtc_page_flip [amdgpu]] *ERROR* failed to pin new
rbo buffer before flip
[  240.859165] amdgpu :01:00.0: 8800a8c31c00 pin failed
[  240.859186] [drm:amdgpu_crtc_page_flip [amdgpu]] *ERROR* failed to pin new
rbo buffer before flip

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/60c7c25b/attachment.html>


[Bug 93862] [Bisected] "drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2" is bad

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93862

--- Comment #3 from Ernst Sj�strand  ---
Created attachment 121291
  --> https://bugs.freedesktop.org/attachment.cgi?id=121291&action=edit
glxinfo

Glxinfo is identical before and after the revert.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/f2e7bc29/attachment.html>


[Bug 93862] [Bisected] "drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2" is bad

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93862

--- Comment #2 from Ernst Sj�strand  ---
Created attachment 121290
  --> https://bugs.freedesktop.org/attachment.cgi?id=121290&action=edit
Xorg.0.log

Full of
[40.002] (WW) AMDGPU(0): flip queue failed: Invalid argument
[40.002] (WW) AMDGPU(0): Page flip failed: Invalid argument
[40.002] (EE) AMDGPU(0): present flip failed

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/3557e2fb/attachment.html>


[Bug 93360] [radeonsi/llvm] Segfault in CS:GO

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93360

--- Comment #8 from sarnex  ---
(In reply to Tobias Droste from comment #7)
> Because bug 92944 was magically fixed I just tested again with everything
> set to high and it looks like this is not crashing anymore. This was with
> LLVM svn trunk and mesa git from 2 days ago.
> 
> Though the image looks wrong with everything set to high. The lighting is
> doesn't seem to be rendered correctly. 
> 
> Sarnex is it working for you?

Hi Tobias,

Yeah, it seems to be working for me also. I guess the underlying bug was fixed.
Great works guys at AMD.

Thanks,
sarnex

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/a3857e38/attachment.html>


[PATCH v2] drm/i915: refine qemu south bridge detection

2016-01-26 Thread Bruno Wolff III
On Mon, Jan 25, 2016 at 12:02:28 +0100,
  Gerd Hoffmann  wrote:
>
>Refine the check by additionally verifying the pci
>subsystem id to see whenever it *really* is qemu.
>
>[ v2: fix subvendor tyops ]

I tested this patch on my laptop that was getting a black screen part way 
through the boot process and it fixed things.


[Bug 91880] Radeonsi on Grenada cards (r9 390) exceptionally unstable and poorly performing

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=91880

--- Comment #78 from Ioannis Panagiotopoulos  ---
(In reply to Julian from comment #76)
> (In reply to Ioannis Panagiotopoulos from comment #75)
> > Also tried this since I have the same problem, compiled the new_smc branch,
> > installed the kernel and the firmware, however the problem persists if I
> > boot it without radeon.dpm=0.
> 
> What card do you have?
> 
> You can try this as well: download and move the hawaii_k_smc.bin firmware
> image into /lib/firmware/radeon and rename it to hawaii_smc.bin (backup or
> delete the existing file). Boot into your normal unpatched Kernel and see if
> it works. That's what I'm doing right now and it works for me.
> 
> Just keep in mind that this might break your Linux install if it doesn't
> work (so having a live USB/CD and the backuped firmware file is handy).

I replaced the firmware file and run update-initramfs -u
The system still hangs when it starts X-server on boot.
My gpu is Club3D R9 390

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/bc8735d0/attachment-0001.html>


[PATCH v6] drm/rockchip: hdmi: add Innosilicon HDMI support

2016-01-26 Thread Paul Bolle
On ma, 2016-01-25 at 09:47 +0800, Yakir Yang wrote:
> --- a/drivers/gpu/drm/rockchip/Kconfig
> +++ b/drivers/gpu/drm/rockchip/Kconfig

> +config ROCKCHIP_INNO_HDMI
> + tristate "Rockchip specific extensions for Innosilicon HDMI"
> +depends on DRM_ROCKCHIP
> +help
> +   This selects support for Rockchip SoC specific extensions
> +   for the Innosilicon HDMI driver. If you want to enable
> +   HDMI on RK3036 based SoC, you should selet this option.

(Really trivial: start indentation with tabs only, please. And
s/selet/select/.)

> --- /dev/null
> +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c

> + * This software is licensed under the terms of the GNU General
> Public
> + * License version 2, as published by the Free Software Foundation,
> and
> + * may be copied, distributed, and modified under those terms.

This states this file is licensed GPL v2 only.

> +MODULE_LICENSE("GPL");

And, according to include/linux/module.h, this means "GNU Public License
v2 or later".

So I think there's a (subtle) mismatch between the license ident used
for this driver and the comment above.

Thanks,


Paul Bolle


[Bug 93862] [Bisected] "drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2" is bad

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93862

--- Comment #1 from Michel D�nzer  ---
(In reply to Ernst Sj�strand from comment #0)
> Updating to the latest drm-next-4.6-wip I could no longer log in to Gnome
> through GDM, I just got a black screen after entering my passwd. startx +
> gnome-session worked though.

Please attach the Xorg log and output of dmesg captured after getting the black
screen.

Please also attach the output of glxinfo.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/96d442ea/attachment.html>


[Bug 93178] Textures are filled with garbage

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93178

Nicolai H�hnle  changed:

   What|Removed |Added

 Resolution|--- |NOTOURBUG
 Status|NEW |RESOLVED

--- Comment #5 from Nicolai H�hnle  ---
This is a game bug.

The game tries to be clever by uploading some of its textures from a different
OpenGL context, but never uses any kind of synchronization between the texture
upload and the main context, so the texture upload never actually happens. This
is a serious programming mistake, and it is merely by chance that this works on
other drivers.

For your own purposes, you can work around the game bug in the driver by
applying the following patch:

 SNIP 
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -105,6 +105,7 @@ static void r600_copy_from_staging_texture(struct
pipe_context *ctx, struct r600
rctx->dma_copy(ctx, dst, transfer->level,
   transfer->box.x, transfer->box.y, transfer->box.z,
   src, 0, &sbox);
+   rctx->b.flush(&rctx->b, NULL, 0);
 }

 static unsigned r600_texture_get_offset(struct r600_texture *rtex, unsigned
level,
 SNIP 

However, doing this seriously hurts the performance of games that are
programmed properly. I encourage you to forward this message to the developers,
telling them they should take a look at Section 5.3.1 of the OpenGL 4.5
(Compatibility Profile) specification, specifically the part about using Finish
or FenceSync/WaitSync.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/8e0f24c1/attachment.html>


[PATCH] drm/radeon: only init fbdev if we have connectors

2016-01-26 Thread Alex Deucher
On Mon, Jan 25, 2016 at 6:06 PM, Rob Clark  wrote:
> This fixes an issue that was noticed on an optimus/prime laptop with
> a kernel that was old enough to not support the integrated intel gfx
> (which was driving all the outputs), but did have support for the
> discrete radeon gpu.  The end result was not falling back to VESA and
> leaving the user with a black screen.
>
> (Plus it is kind of silly to create an framebuffer device if there
> are no outputs hooked up to the gpu.)
>
> Signed-off-by: Rob Clark 

Applied. thanks!

Alex


> ---
>  drivers/gpu/drm/radeon/radeon_display.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
> b/drivers/gpu/drm/radeon/radeon_display.c
> index 1eca0ac..f8e776c 100644
> --- a/drivers/gpu/drm/radeon/radeon_display.c
> +++ b/drivers/gpu/drm/radeon/radeon_display.c
> @@ -1670,8 +1670,10 @@ int radeon_modeset_init(struct radeon_device *rdev)
> /* setup afmt */
> radeon_afmt_init(rdev);
>
> -   radeon_fbdev_init(rdev);
> -   drm_kms_helper_poll_init(rdev->ddev);
> +   if (!list_empty(&rdev->ddev->mode_config.connector_list)) {
> +   radeon_fbdev_init(rdev);
> +   drm_kms_helper_poll_init(rdev->ddev);
> +   }
>
> /* do pm late init */
> ret = radeon_pm_late_init(rdev);
> --
> 2.5.0
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/radeon: only init fbdev if we have connectors

2016-01-26 Thread Alex Deucher
On Mon, Jan 25, 2016 at 7:49 PM, Rob Clark  wrote:
> from a quick look, I think so..
>
> It was something I ran across on an older kernel which didn't have
> amdgpu, but I don't see anything obvious that would cause
> drm_fb_helper_init() to be skipped in amdgpu if there are no
> connectors..  (but nouveau seems to check for
> dev->mode_config.num_crtc, for (I assume) similar reasons)

We don't enable fbdev on amdgpu if the chip in question has no display
block, but we still could enable it if the chip has a display block,
but no connectors.  The same may be true in nouveau so the check for
num_crtc may not be enough.  Attached patch should rectify that.

Alex


>
> BR,
> -R
>
> On Mon, Jan 25, 2016 at 6:57 PM, Mike Lothian  wrote:
>> Is something similar required for AMDGPU too?
>>
>> On Mon, 25 Jan 2016 at 23:06 Rob Clark  wrote:
>>>
>>> This fixes an issue that was noticed on an optimus/prime laptop with
>>> a kernel that was old enough to not support the integrated intel gfx
>>> (which was driving all the outputs), but did have support for the
>>> discrete radeon gpu.  The end result was not falling back to VESA and
>>> leaving the user with a black screen.
>>>
>>> (Plus it is kind of silly to create an framebuffer device if there
>>> are no outputs hooked up to the gpu.)
>>>
>>> Signed-off-by: Rob Clark 
>>> ---
>>>  drivers/gpu/drm/radeon/radeon_display.c | 6 --
>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/radeon/radeon_display.c
>>> b/drivers/gpu/drm/radeon/radeon_display.c
>>> index 1eca0ac..f8e776c 100644
>>> --- a/drivers/gpu/drm/radeon/radeon_display.c
>>> +++ b/drivers/gpu/drm/radeon/radeon_display.c
>>> @@ -1670,8 +1670,10 @@ int radeon_modeset_init(struct radeon_device *rdev)
>>> /* setup afmt */
>>> radeon_afmt_init(rdev);
>>>
>>> -   radeon_fbdev_init(rdev);
>>> -   drm_kms_helper_poll_init(rdev->ddev);
>>> +   if (!list_empty(&rdev->ddev->mode_config.connector_list)) {
>>> +   radeon_fbdev_init(rdev);
>>> +   drm_kms_helper_poll_init(rdev->ddev);
>>> +   }
>>>
>>> /* do pm late init */
>>> ret = radeon_pm_late_init(rdev);
>>> --
>>> 2.5.0
>>>
>>> ___
>>> dri-devel mailing list
>>> dri-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
-- next part --
A non-text attachment was scrubbed...
Name: 0001-drm-amdgpu-don-t-init-fbdev-if-we-don-t-have-any-con.patch
Type: text/x-diff
Size: 1236 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/29ac9a86/attachment.patch>


[Bug 91880] Radeonsi on Grenada cards (r9 390) exceptionally unstable and poorly performing

2016-01-26 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=91880

--- Comment #77 from Thomas DEBESSE  ---
Hi, I've not found the time to recompile anything yet, but I confirm that
http://people.freedesktop.org/~agd5f/radeon_ucode/k/hawaii_k_smc.bin works with
my MSI Radeon R9 390x. I just renamed it as "hawaii_smc.bin" so the vanilla
code loads it without modification. I'm running "auto/balanced" DPM profile
right now and was able to run the Unigine Valley Benchmark without issues (if
there were issues, I will have had a lockup before anything would have been
displayed).

Sorry for not having tested it before, it looks like I never received a
notification for comment 32.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160126/34362af6/attachment.html>