drm-intel-collector - update
Subsystems (3)
cover drm-intel-collector - update
This is another drm-intel-collector updated notice:
http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=drm-intel-collector
Here goes the update list in order for better reviewers assignment:
Patch drm/i915: Bring UP Power Wells before disabling RC6. - Reviewer:
Patch drm/i915: Add support for stealing purgable stolen pages - Reviewer:
Patch drm/i915: Do not allow a pending forcewake put to unbalance across reset - Reviewer:
Patch drm/i915: Don't save/restore RS when not used - Reviewer:
Patch drm/i915: add support for Z-order of planes - Reviewer:
Patch drm/i915: Validate VBT header before trusting it - Reviewer:
Patch drm/i915: Validate BDB section before reading - Reviewer:
Patch drm/i915: Upgrade execbuffer fail after resume failure to EIO - Reviewer:
Patch drm/i915: Add property to set HDMI aspect ratio - Reviewer:
Patch drm/i915: Prevent context obj from being corrupted - Reviewer:
Patch drm/i915/bdw: Add WT caching ability - Reviewer:
Patch drm/i915/bdw: enable eDRAM. - Reviewer:
Patch drm/i915/bdw: Disable idle DOP clock gating - Reviewer:
Patch drm/i915: honour forced connector modes - Reviewer:
Overall Process:
drm-intel-collector - review request
1. Daniel pushs drm-intel-testing (every 2 weeks)
2. I rebase drm-intel-collector onto drm-intel-testing
3. Add Reviewer: tag with voluntered reviewers. If you don't believe you should be assigned on a particular patch please don't get mad just tell you wont review or volunteer someone else.
4. I resubmit remaining patches for review without picking any new (drm-intel-collector - review request)
drm-intel-collector - updated
5. One week later I collect all simple (1-2) patches that wasn't yet reviewed and not queued by Daniel from one testing update until another.
6. Request automated QA's PRTS automated i-g-t tests comparing drm-intel-testing x drm-intel-collector
7. If tests are ok I send the update notification or the patches as a series to intel-gfx mailing list for better tracking and to be reviewed. (drm-intel-collector - updated)
8. Let me know volunteers for review new patches and also let me know if I've picked any patch that I shouldn't.
There are some reasons that some patches can be left behind:
1. Your patch didn't applied cleanly and I couldn't easily solve the conflicts.
2. Kernel didn't compiled with your patch.
3. I simply missed it. If you believe this is the case please warn me.
Please help me to get these patches reviewed and queued by Daniel.
Also, please let me know if you have further ideas how to improve this process.
Thanks in advance,
Rodrigo.
Ben Widawsky (5):
drm/i915: Don't save/restore RS when not used drm/i915: Prevent context obj from being corrupted drm/i915/bdw: Add WT caching ability drm/i915/bdw: enable eDRAM.
drm/i915/bdw: Disable idle DOP clock gating
Chris Wilson (6):
drm/i915: Add support for stealing purgable stolen pages drm/i915: Do not allow a pending forcewake put to unbalance across
reset
drm/i915: Validate VBT header before trusting it drm/i915: Validate BDB section before reading
drm/i915: Upgrade execbuffer fail after resume failure to EIO drm/i915: honour forced connector modes
Deepak S (1):
drm/i915: Bring UP Power Wells before disabling RC6.
Vandana Kannan (1):
drm/i915: Add property to set HDMI aspect ratio
Yu(Alex) Dai (1):
drm/i915: add support for Z-order of planes
drivers/gpu/drm/i915/i915_drv.h | 13 ++-- drivers/gpu/drm/i915/i915_gem_context.c | 68 +++++++++++++++-- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 14 +++- drivers/gpu/drm/i915/i915_gem_gtt.c | 17 ++++- drivers/gpu/drm/i915/i915_gem_stolen.c | 119 ++++++++++++++++++++++++++--- drivers/gpu/drm/i915/i915_reg.h | 5 +- drivers/gpu/drm/i915/intel_bios.c | 76 +++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 58 +++++++++++++- drivers/gpu/drm/i915/intel_drv.h | 8 ++ drivers/gpu/drm/i915/intel_fbdev.c | 15 +++- drivers/gpu/drm/i915/intel_hdmi.c | 12 +++ drivers/gpu/drm/i915/intel_modes.c | 28 +++++++ drivers/gpu/drm/i915/intel_pm.c | 10 +++ drivers/gpu/drm/i915/intel_sprite.c | 119 ++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_uncore.c | 7 +- include/uapi/drm/i915_drm.h | 6 ++ 16 files changed, 517 insertions(+), 58 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/14 drm/i915: Bring UP Power Wells before disabling RC6.
From: Deepak S <[email protected]>
We need do forcewake before Disabling RC6, This is what the BIOS expects while going into suspend.
v2: updated commit message. (Daniel)
--- drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -3243,8 +3243,14 @@ static void valleyview_disable_rps(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; +/* we're doing forcewake before Disabling RC6, +* This what the BIOS expects when going into suspend */ +gen6_gt_force_wake_get (dev_priv,FORCEWAKE_ALL ); +I915_WRITE (GEN6_RC_CONTROL ,0 ); +gen6_gt_force_wake_put (dev_priv,FORCEWAKE_ALL ); +gen6_disable_rps_interrupts (dev); }
Signature · 1 line
1.8.3.1
PATCH 2/14 drm/i915: Add support for stealing purgable stolen pages
In reply to Rodrigo ViviFrom: Chris Wilson <[email protected]>
If we run out of stolen memory when trying to allocate an object, see if we can reap enough purgeable objects to free up enough contiguous free space for the allocation. This is in principle very much like evicting objects to free up enough contiguous space in the vma when binding a new object - and you will be forgiven for thinking that the code looks very similar.
At the moment, we do not allow userspace to allocate objects in stolen, so there is neither the memory pressure to trigger stolen eviction nor any purgeable objects inside the stolen arena. However, this will change in the near future, and so better management and defragmentation of stolen memory will become a real issue.
--- drivers/gpu/drm/i915/i915_gem_stolen.c | 119 ++++++++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +108 -11
@@ -329,18 +329,25 @@ cleanup:return NULL ; } -struct drm_i915_gem_object * -i915_gem_object_create_stolen (struct drm_device *dev,u32 size) +static bool mark_free (struct drm_i915_gem_object *obj,struct list_head *unwind) +{ +if (obj->stolen ==NULL ) +return false; + +if (obj->madv !=I915_MADV_DONTNEED ) +return false; + +list_add (&obj->obj_exec_link, unwind); +return drm_mm_scan_add_block (obj->stolen); +} + +static struct drm_mm_node *stolen_alloc (struct drm_i915_private *dev_priv,u32 size) { -struct drm_i915_private *dev_priv = dev->dev_private; -struct drm_i915_gem_object *obj;struct drm_mm_node *stolen; +struct drm_i915_gem_object *obj; +struct list_head unwind, evict;int ret; -if (!drm_mm_initialized (&dev_priv->mm.stolen)) -return NULL ; - -DRM_DEBUG_KMS ("creating stolen object: size=%x\n" , size);if (size ==0 )return NULL ;
@@ -350,11 +357,101 @@ i915_gem_object_create_stolen(struct drm_device *dev, u32 size) ret =drm_mm_insert_node (&dev_priv->mm.stolen, stolen, size,4096 ,DRM_MM_SEARCH_DEFAULT ); -if (ret) { -kfree (stolen); -return NULL ; +if (ret ==0 ) +return stolen; + +/* No more stolen memory available, or too fragmented. +* Try evicting purgeable objects and search again. +*/ + +drm_mm_init_scan (&dev_priv->mm.stolen, size,4096 ,0 ); +INIT_LIST_HEAD (&unwind); + +list_for_each_entry (obj, &dev_priv->mm.unbound_list, global_list) +if (mark_free (obj, &unwind)) + goto found; + +list_for_each_entry (obj, &dev_priv->mm.bound_list, global_list) +if (mark_free (obj, &unwind)) + goto found; + +found: +INIT_LIST_HEAD (&evict); +while (!list_empty (&unwind)) { + obj =list_first_entry (&unwind, + struct drm_i915_gem_object, + obj_exec_link); +list_del_init (&obj->obj_exec_link); + +if (drm_mm_scan_remove_block (obj->stolen)) { +list_add (&obj->obj_exec_link, &evict); +drm_gem_object_reference (&obj->base); + } } + ret =0 ; +while (!list_empty (&evict)) { + obj =list_first_entry (&evict, + struct drm_i915_gem_object, + obj_exec_link); +list_del_init (&obj->obj_exec_link); + +if (ret ==0 ) { +struct i915_vma *vma, *vma_next; + +list_for_each_entry_safe (vma, vma_next, + &obj->vma_list, + vma_link) +if (i915_vma_unbind (vma)) +break ; + +/* Stolen pins its pages to prevent the +* normal shrinker from processing stolen +* objects. +*/ +i915_gem_object_unpin_pages (obj); + + ret =i915_gem_object_put_pages (obj); +if (ret ==0 ) { + obj->madv = __I915_MADV_PURGED; + +kfree (obj->stolen); + obj->stolen =NULL ; + }else +i915_gem_object_pin_pages (obj); + } + +drm_gem_object_unreference (&obj->base); + } + +if (ret ==0 ) + ret =drm_mm_insert_node (&dev_priv->mm.stolen, stolen, size, +4096 ,DRM_MM_SEARCH_DEFAULT ); +if (ret ==0 ) +return stolen; + +kfree (stolen); +return NULL ; +} + +struct drm_i915_gem_object * +i915_gem_object_create_stolen (struct drm_device *dev,u32 size) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_gem_object *obj; +struct drm_mm_node *stolen; + +lockdep_assert_held (&dev->struct_mutex); + +if (!drm_mm_initialized (&dev_priv->mm.stolen)) +return NULL ; + +DRM_DEBUG_KMS ("creating stolen object: size=%x\n" , size); + + stolen =stolen_alloc (dev_priv, size); +if (stolen ==NULL ) +return NULL ; + obj =_i915_gem_object_create_stolen (dev, stolen);if (obj)return obj;
Signature · 1 line
1.8.3.1
PATCH 3/14 drm/i915: Do not allow a pending forcewake put to unbalance across reset
In reply to Rodrigo ViviFrom: Chris Wilson <[email protected]>
Across a device reset, we try to restore and user forcewake reference counts. This is complicated by our deferred forcewake put adding an extra reference, that may or may not be flushed when we call del_timer_sync. So we have to take that pending reference into account when restoring the forcewake.
--- drivers/gpu/drm/i915/intel_uncore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_uncore.c +4 -1
@@ -317,8 +317,9 @@ static void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) {struct drm_i915_private *dev_priv = dev->dev_private;unsigned long irqflags; +int pending; -del_timer_sync (&dev_priv->uncore.force_wake_timer); + pending =del_timer_sync (&dev_priv->uncore.force_wake_timer);/* Hold uncore.lock across reset to prevent any register access * with forcewake not set correctly
@@ -336,6 +337,8 @@ static void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)if (restore) {/* If reset with a user forcewake, try to restore */ unsigned fw =0 ; + dev_priv->uncore.forcewake_count -= pending; +if (IS_VALLEYVIEW (dev)) {if (dev_priv->uncore.fw_rendercount) fw |=FORCEWAKE_RENDER ;
Signature · 1 line
1.8.3.1
PATCH 4/14 drm/i915: Don't save/restore RS when not used
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
--- drivers/gpu/drm/i915/i915_gem_context.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +7 -5
@@ -550,6 +550,7 @@ mi_set_context(struct intel_ring_buffer *ring, struct i915_hw_context *new_context, u32 hw_flags) { +u32 flags = hw_flags |MI_MM_SPACE_GTT ;int ret;/* w/a: If Flush TLB Invalidation Mode is enabled, driver must do a TLB
@@ -563,6 +564,10 @@ mi_set_context(struct intel_ring_buffer *ring,return ret; } +/* These flags are for resource streamer on HSW+ */ +if (!IS_HASWELL (ring->dev) &&INTEL_INFO (ring->dev)->gen <8 ) + flags |= (MI_SAVE_EXT_STATE_EN |MI_RESTORE_EXT_STATE_EN ); + ret =intel_ring_begin (ring,6 );if (ret)return ret;
@@ -575,11 +580,8 @@ mi_set_context(struct intel_ring_buffer *ring,intel_ring_emit (ring,MI_NOOP );intel_ring_emit (ring,MI_SET_CONTEXT ); -intel_ring_emit (ring,i915_gem_obj_ggtt_offset (new_context->obj) | -MI_MM_SPACE_GTT | -MI_SAVE_EXT_STATE_EN | -MI_RESTORE_EXT_STATE_EN | - hw_flags); +intel_ring_emit (ring, +i915_gem_obj_ggtt_offset (new_context->obj) | flags);/* * w/a: MI_SET_CONTEXT must always be followed by MI_NOOP * WaMiSetContext_Hang:snb,ivb,vlv
Signature · 1 line
1.8.3.1
PATCH 5/14 drm/i915: add support for Z-order of planes
In reply to Rodrigo ViviFrom: "Yu(Alex) Dai" <[email protected]>
Add "zorder" property to crtc to control Z-order of sprite and primary planes. The plane tag is packed into the 64 bits value in the order of from bottom (lower bits) to top (higher bits). Four bits are used for each plane tag. It can support up to 16 planes.
The alpha channel of the plane is set during Z-order change. If a plane is put to the bottom, its alpha channel is off. Otherwise, its alpha channel is on.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_display.c | 58 +++++++++++++++-- drivers/gpu/drm/i915/intel_drv.h | 6 ++ drivers/gpu/drm/i915/intel_sprite.c | 119 ++++++++++++++++++++++++++++++++++- include/uapi/drm/i915_drm.h | 6 ++ 6 files changed, 186 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2516,6 +2516,7 @@ int i915_reg_read_ioctl(struct drm_device *dev, void *data, struct drm_file *file);int i915_get_reset_stats_ioctl (struct drm_device *dev,void *data,struct drm_file *file); +extern int i915_set_plane_zorder (struct drm_crtc *crtc,uint64_t zorder);/* overlay */ extern struct intel_overlay_error_state *intel_overlay_capture_error_state (struct drm_device *dev);
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -3881,6 +3881,9 @@ enum punit_power_well {#define SPRITE_INT_GAMMA_ENABLE (1<<13)#define SPRITE_TILED (1<<10)#define SPRITE_DEST_KEY (1<<2) +#define SPRITE_FORCE_BOTTOM (1<<2) +#define SPRITE_ZORDER_ENABLE (1<<0) +#define _SPRA_LINOFF 0x70284#define _SPRA_STRIDE 0x70288#define _SPRA_POS 0x7028c
drivers/gpu/drm/i915/intel_display.c +54 -4
109 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +6 -0
@@ -387,6 +387,9 @@ struct intel_crtc {bool new_enabled;uint32_t ddi_pll_sel; +bool primary_alpha; +bool sprite0_alpha; +bool sprite1_alpha;/* reset counter value when the last flip was submitted */ unsigned int reset_counter;
@@ -400,6 +403,9 @@ struct intel_crtc {/* watermarks currently being used */ struct intel_pipe_wm active; } wm; + +struct drm_property *zorder_property; +uint64_t zorder; };struct intel_plane_wm_parameters {
drivers/gpu/drm/i915/intel_sprite.c +116 -3
151 lines not on this page · raw message
include/uapi/drm/i915_drm.h +6 -0
@@ -1050,4 +1050,10 @@ struct drm_i915_reset_stats { __u32 pad; }; +#define I915_PLANE_PRIMARY 0 +#define I915_PLANE_SPRITE_A 1 +#define I915_PLANE_SPRITE_B 2 +#define I915_PLANE_CURSOR 3 +#define I915_PLANE_MAX_NUM (I915_PLANE_CURSOR + 1) +#endif /* _UAPI_I915_DRM_H_ */
Signature · 1 line
1.8.3.1
PATCH 6/14 drm/i915: Validate VBT header before trusting it
In reply to Rodrigo ViviFrom: Chris Wilson <[email protected]>
Be we read and chase pointers from the VBT, it is prudent to make sure that those accesses are wholly contained within the MMIO region, or else we may cause a kernel panic during boot.
--- drivers/gpu/drm/i915/intel_bios.c | 68 ++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_bios.c +50 -18
@@ -1099,6 +1099,46 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = { { } }; +static struct bdb_header *validate_vbt (char *base,size_t size, +struct vbt_header *vbt, +const char *source) +{ +size_t offset; +struct bdb_header *bdb; + +if (vbt ==NULL ) { +DRM_DEBUG_DRIVER ("VBT signature missing\n" ); +return NULL ; + } + + offset = (char *)vbt - base; +if (offset +sizeof (struct vbt_header ) > size) { +DRM_DEBUG_DRIVER ("VBT header incomplete\n" ); +return NULL ; + } + +if (memcmp (vbt->signature,"$VBT" ,4 )) { +DRM_DEBUG_DRIVER ("VBT invalid signature\n" ); +return NULL ; + } + + offset += vbt->bdb_offset; +if (offset +sizeof (struct bdb_header ) > size) { +DRM_DEBUG_DRIVER ("BDB header incomplete\n" ); +return NULL ; + } + + bdb = (struct bdb_header *)(base + offset); +if (offset + bdb->bdb_size > size) { +DRM_DEBUG_DRIVER ("BDB incomplete\n" ); +return NULL ; + } + +DRM_DEBUG_KMS ("Using VBT from %s: %20s\n" , + source, vbt->signature); +return bdb; +} +/** * intel_parse_bios - find VBT and initialize settings from the BIOS * @dev: DRM device
@@ -1122,20 +1162,13 @@ intel_parse_bios(struct drm_device *dev)init_vbt_defaults (dev_priv);/* XXX Should this validation be moved to intel_opregion.c? */ -if (!dmi_check_system (intel_no_opregion_vbt) && dev_priv->opregion.vbt) { -struct vbt_header *vbt = dev_priv->opregion.vbt; -if (memcmp (vbt->signature,"$VBT" ,4 ) ==0 ) { -DRM_DEBUG_KMS ("Using VBT from OpRegion: %20s\n" , - vbt->signature); - bdb = (struct bdb_header *)((char *)vbt + vbt->bdb_offset); - }else - dev_priv->opregion.vbt =NULL ; - } +if (!dmi_check_system (intel_no_opregion_vbt) && dev_priv->opregion.vbt) + bdb =validate_vbt ((char *)dev_priv->opregion.header,OPREGION_SIZE , + (struct vbt_header *)dev_priv->opregion.vbt, +"OpRegion" );if (bdb ==NULL ) { -struct vbt_header *vbt =NULL ; -size_t size; -int i; +size_t i, size; bios =pci_map_rom (pdev, &size);if (!bios)
@@ -1143,19 +1176,18 @@ intel_parse_bios(struct drm_device *dev)/* Scour memory looking for the VBT signature */ for (i =0 ; i +4 < size; i++) { -if (!memcmp (bios + i,"$VBT" ,4 )) { - vbt = (struct vbt_header *)(bios + i); +if (memcmp (bios + i,"$VBT" ,4 ) ==0 ) { + bdb =validate_vbt (bios, size, + (struct vbt_header *)(bios + i), +"PCI ROM" );break ; } } -if (!vbt) { -DRM_DEBUG_DRIVER ("VBT signature missing\n" ); +if (!bdb) {pci_unmap_rom (pdev, bios);return -1 ; } - - bdb = (struct bdb_header *)(bios + i + vbt->bdb_offset); }/* Grab useful general definitions */
Signature · 1 line
1.8.3.1
Re: [PATCH 06/14] drm/i915: Validate VBT header before trusting it
Quoted 44 lines · Rodrigo Vivi
From: Chris Wilson <[email protected]>
Be we read and chase pointers from the VBT, it is prudent to make sure that those accesses are wholly contained within the MMIO region, or else we may cause a kernel panic during boot.
Signed-off-by Chris Wilson <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_bios.c | 68 ++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/intel_bios.c +24
-0@@ -1099,6 +1099,46 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = { { } }; +static struct bdb_header *validate_vbt (char *base,size_t size, +struct vbt_header *vbt, +const char *source) +{ +size_t offset; +struct bdb_header *bdb; + +if (vbt ==NULL ) { +DRM_DEBUG_DRIVER ("VBT signature missing\n" ); +return NULL ; + } + + offset = (char *)vbt - base; +if (offset +sizeof (struct vbt_header ) > size) { +DRM_DEBUG_DRIVER ("VBT header incomplete\n" ); +return NULL ; + } + +if (memcmp (vbt->signature,"$VBT" ,4 )) { +DRM_DEBUG_DRIVER ("VBT invalid signature\n" ); +return NULL ; + } + + offset += vbt->bdb_offset;
drivers/gpu/drm/i915/intel_bios.c static const struct dmi_system_id intel_no_opregion_vbt[] = { · line 1135
Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +10
-0+if (offset +sizeof (struct bdb_header ) > size) { +DRM_DEBUG_DRIVER ("BDB header incomplete\n" ); +return NULL ; + } + + bdb = (struct bdb_header *)(base + offset); +if (offset + bdb->bdb_size > size) { +DRM_DEBUG_DRIVER ("BDB incomplete\n" ); +return NULL ; + }
I know that BDB version check is really not enough and VBT should be forward compatible, but it would be good to have a version check in driver for the current BDB version the parser supports as well. Strictly speaking if we put this check we should ideally reject any newer versions, but putting an error log indicating mismatch might be a
good idea for debug.
Regards
Shobhit
Re: [PATCH 06/14] drm/i915: Validate VBT header before trusting it
Quoted 53 lines · Shobhit
Quoted 52 lines · Rodrigo Vivi
From: Chris Wilson <[email protected]>
Be we read and chase pointers from the VBT, it is prudent to make sure that those accesses are wholly contained within the MMIO region, or else we may cause a kernel panic during boot.
Signed-off-by Chris Wilson <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_bios.c | 68 ++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/intel_bios.c +32
-0@@ -1099,6 +1099,46 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = { { } }; +static struct bdb_header *validate_vbt (char *base,size_t size, +struct vbt_header *vbt, +const char *source) +{ +size_t offset; +struct bdb_header *bdb; + +if (vbt ==NULL ) { +DRM_DEBUG_DRIVER ("VBT signature missing\n" ); +return NULL ; + } + + offset = (char *)vbt - base; +if (offset +sizeof (struct vbt_header ) > size) { +DRM_DEBUG_DRIVER ("VBT header incomplete\n" ); +return NULL ; + } + +if (memcmp (vbt->signature,"$VBT" ,4 )) { +DRM_DEBUG_DRIVER ("VBT invalid signature\n" ); +return NULL ; + } + + offset += vbt->bdb_offset; +if (offset +sizeof (struct bdb_header ) > size) { +DRM_DEBUG_DRIVER ("BDB header incomplete\n" ); +return NULL ; + } + + bdb = (struct bdb_header *)(base + offset); +if (offset + bdb->bdb_size > size) { +DRM_DEBUG_DRIVER ("BDB incomplete\n" );
Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c static const struct dmi_system_id intel_no_opregion_vbt[] = { · line 1135
Quoted 2 lines
drivers/gpu/drm/i915/intel_bios.c +2
-0+return NULL ; + }I know that BDB version check is really not enough and VBT should be forward compatible, but it would be good to have a version check in driver for the current BDB version the parser supports as well. Strictly speaking if we put this check we should ideally reject any newer versions, but putting an error log indicating mismatch might be a good idea for debug.
Sounds more like an additional patch on top of this one here, so still r-b from your side for these changes here?
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Kumar, Shobhit
Reviewed-byRe: [PATCH 06/14] drm/i915: Validate VBT header before trusting it
Quoted 63 lines · Daniel Vetter
Quoted 53 lines · Shobhit
Quoted 52 lines · Rodrigo Vivi
From: Chris Wilson <[email protected]>
Be we read and chase pointers from the VBT, it is prudent to make sure that those accesses are wholly contained within the MMIO region, or else we may cause a kernel panic during boot.
Signed-off-by Chris Wilson <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_bios.c | 68 ++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/intel_bios.c +32
-0@@ -1099,6 +1099,46 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = { { } }; +static struct bdb_header *validate_vbt (char *base,size_t size, +struct vbt_header *vbt, +const char *source) +{ +size_t offset; +struct bdb_header *bdb; + +if (vbt ==NULL ) { +DRM_DEBUG_DRIVER ("VBT signature missing\n" ); +return NULL ; + } + + offset = (char *)vbt - base; +if (offset +sizeof (struct vbt_header ) > size) { +DRM_DEBUG_DRIVER ("VBT header incomplete\n" ); +return NULL ; + } + +if (memcmp (vbt->signature,"$VBT" ,4 )) { +DRM_DEBUG_DRIVER ("VBT invalid signature\n" ); +return NULL ; + } + + offset += vbt->bdb_offset; +if (offset +sizeof (struct bdb_header ) > size) { +DRM_DEBUG_DRIVER ("BDB header incomplete\n" ); +return NULL ; + } + + bdb = (struct bdb_header *)(base + offset); +if (offset + bdb->bdb_size > size) { +DRM_DEBUG_DRIVER ("BDB incomplete\n" );Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c static const struct dmi_system_id intel_no_opregion_vbt[] = { · line 1135
Quoted 2 lines
drivers/gpu/drm/i915/intel_bios.c +2
-0+return NULL ; + }I know that BDB version check is really not enough and VBT should be forward compatible, but it would be good to have a version check in driver for the current BDB version the parser supports as well. Strictly speaking if we put this check we should ideally reject any newer versions, but putting an error log indicating mismatch might be a good idea for debug.
Quoted 4 lines
Sounds more like an additional patch on top of this one here, so still r-b from your side for these changes here?
-Daniel
Hmm, I felt it is something which is missed as part of this patch while validating VBT. But yes if you feel that it is okay to be a separate patch then for these changes -
I will then push a new patch on version check.
Regards
Shobhit
Re: [PATCH 06/14] drm/i915: Validate VBT header before trusting it
Quoted 69 lines · Shobhit
Quoted 63 lines · Daniel Vetter
Quoted 53 lines · Shobhit
Quoted 52 lines · Rodrigo Vivi
From: Chris Wilson <[email protected]>
Be we read and chase pointers from the VBT, it is prudent to make sure that those accesses are wholly contained within the MMIO region, or else we may cause a kernel panic during boot.
Signed-off-by Chris Wilson <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_bios.c | 68 ++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/intel_bios.c +32
-0@@ -1099,6 +1099,46 @@ static const struct dmi_system_id intel_no_opregion_vbt[] = { { } }; +static struct bdb_header *validate_vbt (char *base,size_t size, +struct vbt_header *vbt, +const char *source) +{ +size_t offset; +struct bdb_header *bdb; + +if (vbt ==NULL ) { +DRM_DEBUG_DRIVER ("VBT signature missing\n" ); +return NULL ; + } + + offset = (char *)vbt - base; +if (offset +sizeof (struct vbt_header ) > size) { +DRM_DEBUG_DRIVER ("VBT header incomplete\n" ); +return NULL ; + } + +if (memcmp (vbt->signature,"$VBT" ,4 )) { +DRM_DEBUG_DRIVER ("VBT invalid signature\n" ); +return NULL ; + } + + offset += vbt->bdb_offset; +if (offset +sizeof (struct bdb_header ) > size) { +DRM_DEBUG_DRIVER ("BDB header incomplete\n" ); +return NULL ; + } + + bdb = (struct bdb_header *)(base + offset); +if (offset + bdb->bdb_size > size) { +DRM_DEBUG_DRIVER ("BDB incomplete\n" );Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c static const struct dmi_system_id intel_no_opregion_vbt[] = { · line 1135
Quoted 2 lines
drivers/gpu/drm/i915/intel_bios.c +2
-0+return NULL ; + }I know that BDB version check is really not enough and VBT should be forward compatible, but it would be good to have a version check in driver for the current BDB version the parser supports as well. Strictly speaking if we put this check we should ideally reject any newer versions, but putting an error log indicating mismatch might be a good idea for debug.
Quoted 4 lines
Sounds more like an additional patch on top of this one here, so still r-b from your side for these changes here?
-Daniel
Quoted 5 lines
Hmm, I felt it is something which is missed as part of this patch while validating VBT. But yes if you feel that it is okay to be a separate patch then for these changes -
Reviewed-by Shobhit Kumar <[email protected]>
Thanks, patch merged.
Quoted 1 line
I will then push a new patch on version check.
I've figured Chris could do it, but if you can take this over I don't think Chris will complain ;-)
Thanks, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 06/14] drm/i915: Validate VBT header before trusting it
Quoted 6 lines · Daniel Vetter
Quoted 2 lines · Shobhit
On 4/25/2014 1:32 PM, Daniel Vetter wrote:
I will then push a new patch on version check.I've figured Chris could do it, but if you can take this over I don't think Chris will complain ;-)
I hope that our parser is forward-compatabile and the VBT updates backwards-compatible...
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 06/14] drm/i915: Validate VBT header before trusting it
Quoted 10 lines · Chris Wilson
Quoted 6 lines · Daniel Vetter
Quoted 2 lines · Shobhit
On 4/25/2014 1:32 PM, Daniel Vetter wrote:
I will then push a new patch on version check.I've figured Chris could do it, but if you can take this over I don't think Chris will complain ;-)
I hope that our parser is forward-compatabile and the VBT updates backwards-compatible...
Yeah of-course, it should be like this.
Regards
Shobhit
PATCH 7/14 drm/i915: Validate BDB section before reading
In reply to Rodrigo ViviFrom: Chris Wilson <[email protected]>
Make sure that the whole BDB section is within the MMIO region prior to accessing it contents. That we don't read outside of the secion is left up to the individual section parsers.
--- drivers/gpu/drm/i915/intel_bios.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_bios.c +7 -1
@@ -49,13 +49,19 @@ find_section(struct bdb_header *bdb, int section_id) total = bdb->bdb_size;/* walk the sections looking for section_id */ -while (index < total) { +while (index +3 < total) { current_id = *(base + index); index++; + current_size = *((u16 *)(base + index)); index +=2 ; + +if (index + current_size > total) +return NULL ; +if (current_id == section_id)return base + index; + index += current_size; }
Signature · 1 line
1.8.3.1
Re: [PATCH 07/14] drm/i915: Validate BDB section before reading
Quoted 27 lines · Rodrigo Vivi
From: Chris Wilson <[email protected]>
Make sure that the whole BDB section is within the MMIO region prior to accessing it contents. That we don't read outside of the secion is left up to the individual section parsers.
Signed-off-by Chris Wilson <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_bios.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_bios.c +2
-1@@ -49,13 +49,19 @@ find_section(struct bdb_header *bdb, int section_id) total = bdb->bdb_size;/* walk the sections looking for section_id */ -while (index < total) { +while (index +3 < total) { current_id = *(base + index); index++; + current_size = *((u16 *)(base + index)); index +=2 ;
drivers/gpu/drm/i915/intel_bios.c find_section(struct bdb_header *bdb, int section_id) · line 67
Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +5
-0+ +if (index + current_size > total) +return NULL ; +if (current_id == section_id)return base + index; + index += current_size; }
Daniel Vetter
AppliedRe: [PATCH 07/14] drm/i915: Validate BDB section before reading
Quoted 32 lines · Shobhit
Quoted 31 lines · Rodrigo Vivi
From: Chris Wilson <[email protected]>
Make sure that the whole BDB section is within the MMIO region prior to accessing it contents. That we don't read outside of the secion is left up to the individual section parsers.
Signed-off-by Chris Wilson <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_bios.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_bios.c +6
-1@@ -49,13 +49,19 @@ find_section(struct bdb_header *bdb, int section_id) total = bdb->bdb_size;/* walk the sections looking for section_id */ -while (index < total) { +while (index +3 < total) { current_id = *(base + index); index++; + current_size = *((u16 *)(base + index)); index +=2 ; + +if (index + current_size > total) +return NULL ; +
Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c find_section(struct bdb_header *bdb, int section_id) · line 67
Quoted 6 lines
drivers/gpu/drm/i915/intel_bios.c +1
-0if (current_id == section_id)return base + index; + index += current_size; }Reviewed-by Shobhit Kumar <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 8/14 drm/i915: Upgrade execbuffer fail after resume failure to EIO
In reply to Rodrigo ViviFrom: Chris Wilson <[email protected]>
If we try to execute on a known ring, but it has failed to be initialised correctly, report that the GPU is hung rather than the command invalid. This leaves us reporting EINVAL only if the user requests execution on a ring that is not supported by the device.
This should prevent UXA from getting stuck in a null render loop after a failed resume.
References: https://bugs.freedesktop.org/show_bug.cgi?id=76554
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +13 -1
@@ -999,6 +999,18 @@ i915_reset_gen7_sol_offsets(struct drm_device *dev,return 0 ; } +static bool +intel_ring_valid (struct intel_ring_buffer *ring) +{ +switch (ring->id) { +case RCS :return true; +case VCS :return HAS_BSD (ring->dev); +case BCS :return HAS_BLT (ring->dev); +case VECS :return HAS_VEBOX (ring->dev); +default :return false; + } +} + static int i915_gem_do_execbuffer(struct drm_device *dev, void *data, struct drm_file *file,
@@ -1049,7 +1061,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,if (!intel_ring_initialized (ring)) {DRM_DEBUG ("execbuf with invalid ring: %d\n" , (int )(args->flags &I915_EXEC_RING_MASK )); -return -EINVAL ; +return intel_ring_valid (ring) ? -EIO : -EINVAL ; } mode = args->flags &I915_EXEC_CONSTANTS_MASK ;
Signature · 1 line
1.8.3.1
PATCH 9/14 drm/i915: Add property to set HDMI aspect ratio
In reply to Rodrigo ViviFrom: Vandana Kannan <[email protected]>
Added a property to enable user space to set aspect ratio for HDMI displays. If there is no user specified value, then PAR_NONE/Automatic option is set by default. User can select aspect ratio 4:3 or 16:9. The aspect ratio selected by user would come into effect with a mode set.
v2: Daniel's review comments incorporated.
Call for a mode set to update property.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 12 ++++++++++++ drivers/gpu/drm/i915/intel_modes.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1440,6 +1440,7 @@ struct drm_i915_private {struct drm_property *broadcast_rgb_property;struct drm_property *force_audio_property; +struct drm_property *aspect_ratio_property;uint32_t hw_context_size;struct list_head context_list;
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -485,6 +485,7 @@ struct intel_hdmi {bool has_audio;enum hdmi_force_audio force_audio;bool rgb_quant_range_selectable; +enum hdmi_picture_aspect aspect_ratio;void (*write_infoframe)(struct drm_encoder *encoder,enum hdmi_infoframe_type type,const void *frame,ssize_t len);
@@ -863,6 +864,7 @@ int intel_connector_update_modes(struct drm_connector *connector,int intel_ddc_get_modes (struct drm_connector *c,struct i2c_adapter *adapter);void intel_attach_force_audio_property (struct drm_connector *connector);void intel_attach_broadcast_rgb_property (struct drm_connector *connector); +void intel_attach_aspect_ratio_property (struct drm_connector *connector);/* intel_overlay.c */
drivers/gpu/drm/i915/intel_hdmi.c +12 -0
@@ -367,6 +367,9 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,union hdmi_infoframe frame;int ret; +/* Set user selected PAR to incoming mode's member */ + adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio; + ret =drm_hdmi_avi_infoframe_from_display_mode (&frame.avi, adjusted_mode);if (ret <0 ) {
@@ -1105,6 +1108,11 @@ intel_hdmi_set_property(struct drm_connector *connector, goto done; } +if (property == dev_priv->aspect_ratio_property) { + intel_hdmi->aspect_ratio = val; + goto done; + } +return -EINVAL ; done:
@@ -1253,6 +1261,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c {intel_attach_force_audio_property (connector);intel_attach_broadcast_rgb_property (connector); +intel_attach_aspect_ratio_property (connector); intel_hdmi->color_range_auto = true; }
@@ -1317,6 +1326,9 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, intel_connector->get_hw_state = intel_connector_get_hw_state; intel_connector->unregister = intel_connector_unregister; +/* Initialize aspect ratio member of intel_hdmi */ + intel_hdmi->aspect_ratio =HDMI_PICTURE_ASPECT_NONE ; +intel_hdmi_add_properties (intel_hdmi, connector);intel_connector_attach_encoder (intel_connector, intel_encoder);
drivers/gpu/drm/i915/intel_modes.c +28 -0
@@ -126,3 +126,31 @@ intel_attach_broadcast_rgb_property(struct drm_connector *connector)drm_object_attach_property (&connector->base, prop,0 ); } + +static const struct drm_prop_enum_list aspect_ratio_names[] = { + {HDMI_PICTURE_ASPECT_NONE ,"Automatic" }, + {HDMI_PICTURE_ASPECT_4_3 ,"4:3" }, + {HDMI_PICTURE_ASPECT_16_9 ,"16:9" }, +}; + +void +intel_attach_aspect_ratio_property (struct drm_connector *connector) +{ +struct drm_device *dev = connector->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_property *prop; + + prop = dev_priv->aspect_ratio_property; +if (prop ==NULL ) { + prop =drm_property_create_enum (dev,DRM_MODE_PROP_ENUM , +"HDMI aspect ratio" , + aspect_ratio_names, +ARRAY_SIZE (aspect_ratio_names)); +if (prop ==NULL ) +return ; + + dev_priv->aspect_ratio_property = prop; + } + +drm_object_attach_property (&connector->base, prop,0 ); +}
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/14 drm/i915: Prevent context obj from being corrupted
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
While the context is not being used, we can make the PTEs invalid, so nothing can accidentally corrupt it. Systems tend to have a lot of trouble when the context gets corrupted.
NOTE: This is a slightly different patch than what I posted to Bugzilla.
References: https://bugs.freedesktop.org/show_bug.cgi?id=75724
--- drivers/gpu/drm/i915/i915_gem_context.c | 56 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_reg.h | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +56 -0
@@ -545,6 +545,58 @@ i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id)return ctx; } +static void +_ctx_ptes (struct intel_ring_buffer *ring, +struct i915_hw_context *ctx, +bool valid) +{ +const size_t ptes = ctx->obj->base.size >>PAGE_SHIFT ; +const u32 base =i915_gem_obj_ggtt_offset (ctx->obj); +struct sg_page_iter sg_iter; +struct i915_address_space *vm = ctx->vm; +int i =0 ; + +BUG_ON (!i915_gem_obj_is_pinned (ctx->obj)); + +if (intel_ring_begin (ring,round_up (ptes *3 ,2 ))) { +DRM_ERROR ("Could not protect context object.\n" ); +return ; + } + +for_each_sg_page (ctx->obj->pages->sgl, &sg_iter, ctx->obj->pages->nents,0 ) { +u32 pte = vm->pte_encode (sg_page_iter_dma_address (&sg_iter), + ctx->obj->cache_level, + valid); +intel_ring_emit (ring,MI_UPDATE_GTT | (1 <<22 )); +/* The docs contradict themselves on the offset. They say dword +* offset, yet the low 12 bits MBZ. */ +intel_ring_emit (ring, (base &PAGE_MASK ) + i); +intel_ring_emit (ring, pte); + i+=PAGE_SIZE ; + } + +if (i &PAGE_SHIFT ) +intel_ring_emit (ring,MI_NOOP ); + +intel_ring_advance (ring); +} + +static void +enable_ctx_ptes (struct intel_ring_buffer *ring, +struct i915_hw_context *ctx) +{ +if (INTEL_INFO (ring->dev)->gen <8 ) +_ctx_ptes (ring, ctx, true); +} + +static void +disable_ctx_ptes (struct intel_ring_buffer *ring, +struct i915_hw_context *ctx) +{ +if (INTEL_INFO (ring->dev)->gen <8 ) +_ctx_ptes (ring, ctx, false); +} + static inline int mi_set_context(struct intel_ring_buffer *ring, struct i915_hw_context *new_context,
@@ -568,6 +620,8 @@ mi_set_context(struct intel_ring_buffer *ring,if (!IS_HASWELL (ring->dev) &&INTEL_INFO (ring->dev)->gen <8 ) flags |= (MI_SAVE_EXT_STATE_EN |MI_RESTORE_EXT_STATE_EN ); +enable_ctx_ptes (ring, new_context); + ret =intel_ring_begin (ring,6 );if (ret)return ret;
@@ -595,6 +649,8 @@ mi_set_context(struct intel_ring_buffer *ring,intel_ring_advance (ring); +disable_ctx_ptes (ring, new_context); +return ret; }
drivers/gpu/drm/i915/i915_reg.h +1 -1
@@ -368,7 +368,7 @@#define MI_TOPOLOGY_FILTER MI_INSTR(0x0D, 0)#define MI_LOAD_SCAN_LINES_EXCL MI_INSTR(0x13, 0)#define MI_URB_CLEAR MI_INSTR(0x19, 0) -#define MI_UPDATE_GTT MI_INSTR(0x23, 0) +#define MI_UPDATE_GTT MI_INSTR(0x23, 1)#define MI_CLFLUSH MI_INSTR(0x27, 0)#define MI_REPORT_PERF_COUNT MI_INSTR(0x28, 0)#define MI_REPORT_PERF_COUNT_GGTT (1<<0)
Signature · 1 line
1.8.3.1
PATCH 11/14 drm/i915/bdw: Add WT caching ability
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
I don't have any insight on what parts can do what. The docs do seem to suggest WT caching works in at least the same manner as it doesn't on Haswell.
The addr = 0 is to shut up GCC:drivers/gpu/drm/i915/i915_gem_gtt.c:80:7: warning: 'addr' may be used uninitialized in this function [-Wmaybe-uninitialized]
--- drivers/gpu/drm/i915/i915_drv.h | 11 ++++++----- drivers/gpu/drm/i915/i915_gem_gtt.c | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +6 -5
@@ -1835,11 +1835,12 @@ struct drm_i915_cmd_table {#define BSD_RING (1<<VCS)#define BLT_RING (1<<BCS)#define VEBOX_RING (1<<VECS) -#define HAS_BSD (dev) (INTEL_INFO(dev)->ring_mask & BSD_RING) -#define HAS_BLT (dev) (INTEL_INFO(dev)->ring_mask & BLT_RING) -#define HAS_VEBOX (dev) (INTEL_INFO(dev)->ring_mask & VEBOX_RING) -#define HAS_LLC (dev) (INTEL_INFO(dev)->has_llc) -#define HAS_WT (dev) (IS_HASWELL(dev) && to_i915(dev)->ellc_size) +#define HAS_BSD (dev) (INTEL_INFO(dev)->ring_mask & BSD_RING) +#define HAS_BLT (dev) (INTEL_INFO(dev)->ring_mask & BLT_RING) +#define HAS_VEBOX (dev) (INTEL_INFO(dev)->ring_mask & VEBOX_RING) +#define HAS_LLC (dev) (INTEL_INFO(dev)->has_llc) +#define HAS_WT (dev) ((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \ + to_i915(dev)->ellc_size)#define I915_NEED_GFX_HWS (dev) (INTEL_INFO(dev)->need_gfx_hws)#define HAS_HW_CONTEXTS (dev) (INTEL_INFO(dev)->gen >= 6)
drivers/gpu/drm/i915/i915_gem_gtt.c +13 -4
@@ -68,10 +68,19 @@ static inline gen8_gtt_pte_t gen8_pte_encode(dma_addr_t addr, {gen8_gtt_pte_t pte = valid ? _PAGE_PRESENT | _PAGE_RW :0 ; pte |= addr; -if (level !=I915_CACHE_NONE ) - pte |=PPAT_CACHED_INDEX ; -else + +switch (level) { +case I915_CACHE_NONE : pte |=PPAT_UNCACHED_INDEX ; +break ; +case I915_CACHE_WT : + pte |=PPAT_DISPLAY_ELLC_INDEX ; +break ; +default : + pte |=PPAT_CACHED_INDEX ; +break ; + } +return pte; }
@@ -1368,7 +1377,7 @@ static void gen8_ggtt_insert_entries(struct i915_address_space *vm, (gen8_gtt_pte_t __iomem *)dev_priv->gtt.gsm + first_entry;int i =0 ;struct sg_page_iter sg_iter; -dma_addr_t addr; +dma_addr_t addr =0 ;for_each_sg_page (st->sgl, &sg_iter, st->nents,0 ) { addr = sg_dma_address(sg_iter.sg) +
Signature · 1 line
1.8.3.1
Re: [PATCH 11/14] drm/i915/bdw: Add WT caching ability
Quoted 5 lines · Rodrigo Vivi
From: Ben Widawsky <[email protected]>
I don't have any insight on what parts can do what. The docs do seem to suggest WT caching works in at least the same manner as it doesn't on Haswell.
As Ben previously mentioned, s/doesn't/does. Other than that, looks good
Quoted 77 lines
The addr = 0 is to shut up GCC:
drivers/gpu/drm/i915/i915_gem_gtt.c:80:7: warning: 'addr' may be used uninitialized in this function [-Wmaybe-uninitialized]Signed-off-by Ben Widawsky <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 11 ++++++----- drivers/gpu/drm/i915/i915_gem_gtt.c | 17 +++++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/i915_drv.h +6
-5@@ -1835,11 +1835,12 @@ struct drm_i915_cmd_table {#define BSD_RING (1<<VCS)#define BLT_RING (1<<BCS)#define VEBOX_RING (1<<VECS) -#define HAS_BSD (dev) (INTEL_INFO(dev)->ring_mask & BSD_RING) -#define HAS_BLT (dev) (INTEL_INFO(dev)->ring_mask & BLT_RING) -#define HAS_VEBOX (dev) (INTEL_INFO(dev)->ring_mask & VEBOX_RING) -#define HAS_LLC (dev) (INTEL_INFO(dev)->has_llc) -#define HAS_WT (dev) (IS_HASWELL(dev) && to_i915(dev)->ellc_size) +#define HAS_BSD (dev) (INTEL_INFO(dev)->ring_mask & BSD_RING) +#define HAS_BLT (dev) (INTEL_INFO(dev)->ring_mask & BLT_RING) +#define HAS_VEBOX (dev) (INTEL_INFO(dev)->ring_mask & VEBOX_RING) +#define HAS_LLC (dev) (INTEL_INFO(dev)->has_llc) +#define HAS_WT (dev) ((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \ + to_i915(dev)->ellc_size)#define I915_NEED_GFX_HWS (dev) (INTEL_INFO(dev)->need_gfx_hws)#define HAS_HW_CONTEXTS (dev) (INTEL_INFO(dev)->gen >= 6)drivers/gpu/drm/i915/i915_gem_gtt.c +13
-4@@ -68,10 +68,19 @@ static inline gen8_gtt_pte_t gen8_pte_encode(dma_addr_t addr, {gen8_gtt_pte_t pte = valid ? _PAGE_PRESENT | _PAGE_RW :0 ; pte |= addr; -if (level !=I915_CACHE_NONE ) - pte |=PPAT_CACHED_INDEX ; -else + +switch (level) { +case I915_CACHE_NONE : pte |=PPAT_UNCACHED_INDEX ; +break ; +case I915_CACHE_WT : + pte |=PPAT_DISPLAY_ELLC_INDEX ; +break ; +default : + pte |=PPAT_CACHED_INDEX ; +break ; + } +return pte; }@@ -1368,7 +1377,7 @@ static void gen8_ggtt_insert_entries(struct i915_address_space *vm, (gen8_gtt_pte_t __iomem *)dev_priv->gtt.gsm + first_entry;int i =0 ;struct sg_page_iter sg_iter; -dma_addr_t addr; +dma_addr_t addr =0 ;for_each_sg_page (st->sgl, &sg_iter, st->nents,0 ) { addr = sg_dma_address(sg_iter.sg) +Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/14 drm/i915/bdw: enable eDRAM.
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
The same register exists for querying and programming eDRAM AKA eLLC. So we can simply use it. For now, use all the same defaults as we had for Haswell, since like Haswell, I have no further details.
I do not actually have a part with eDRAM, so I cannot test this.
--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -373,7 +373,7 @@ void intel_uncore_early_sanitize(struct drm_device *dev)if (HAS_FPGA_DBG_UNCLAIMED (dev))__raw_i915_write32 (dev_priv,FPGA_DBG ,FPGA_DBG_RM_NOCLAIM ); -if (IS_HASWELL (dev) && +if ((IS_HASWELL (dev) ||IS_BROADWELL (dev)) && (__raw_i915_read32 (dev_priv,HSW_EDRAM_PRESENT ) ==1 )) {/* The docs do not explain exactly how the calculation can be * made. It is somewhat guessable, but for now, it's always
Signature · 1 line
1.8.3.1
Re: [PATCH 12/14] drm/i915/bdw: enable eDRAM.
Quoted 34 lines · Rodrigo Vivi
From: Ben Widawsky <[email protected]>
The same register exists for querying and programming eDRAM AKA eLLC. So we can simply use it. For now, use all the same defaults as we had for Haswell, since like Haswell, I have no further details.
I do not actually have a part with eDRAM, so I cannot test this.
Signed-off-by Ben Widawsky <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_uncore.c +1
-1@@ -373,7 +373,7 @@ void intel_uncore_early_sanitize(struct drm_device *dev)if (HAS_FPGA_DBG_UNCLAIMED (dev))__raw_i915_write32 (dev_priv,FPGA_DBG ,FPGA_DBG_RM_NOCLAIM ); -if (IS_HASWELL (dev) && +if ((IS_HASWELL (dev) ||IS_BROADWELL (dev)) && (__raw_i915_read32 (dev_priv,HSW_EDRAM_PRESENT ) ==1 )) {/* The docs do not explain exactly how the calculation can be * made. It is somewhat guessable, but for now, it's always Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/14 drm/i915/bdw: Disable idle DOP clock gating
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
It seems we need this at least for the current platforms we have, but probably not later. In any event, it should cause too much harm as we do the same thing on several other platforms.
--- drivers/gpu/drm/i915/intel_pm.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +4 -0
@@ -4924,6 +4924,10 @@ static void gen8_init_clock_gating(struct drm_device *dev)I915_WRITE (GEN7_HALF_SLICE_CHICKEN1 ,_MASKED_BIT_ENABLE (GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE )); +/* WaDisableDopClockGating:bdw May not be needed for production */ +I915_WRITE (GEN7_ROW_CHICKEN2 , +_MASKED_BIT_ENABLE (DOP_CLOCK_GATING_DISABLE )); +/* WaSwitchSolVfFArbitrationPriority:bdw */ I915_WRITE (GAM_ECOCHK ,I915_READ (GAM_ECOCHK ) |HSW_ECOCHK_ARB_PRIO_SOL );
Signature · 1 line
1.8.3.1
Re: [PATCH 13/14] drm/i915/bdw: Disable idle DOP clock gating
Quoted 34 lines · Rodrigo Vivi
From: Ben Widawsky <[email protected]>
It seems we need this at least for the current platforms we have, but probably not later. In any event, it should cause too much harm as we do the same thing on several other platforms.
Signed-off-by Ben Widawsky <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/i915/intel_pm.c +4
-0@@ -4924,6 +4924,10 @@ static void gen8_init_clock_gating(struct drm_device *dev)I915_WRITE (GEN7_HALF_SLICE_CHICKEN1 ,_MASKED_BIT_ENABLE (GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE )); +/* WaDisableDopClockGating:bdw May not be needed for production */ +I915_WRITE (GEN7_ROW_CHICKEN2 , +_MASKED_BIT_ENABLE (DOP_CLOCK_GATING_DISABLE )); +/* WaSwitchSolVfFArbitrationPriority:bdw */ I915_WRITE (GAM_ECOCHK ,I915_READ (GAM_ECOCHK ) |HSW_ECOCHK_ARB_PRIO_SOL );Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 13/14] drm/i915/bdw: Disable idle DOP clock gating
Quoted 11 lines · Bradley D
Reviewed-by Brad Volkin <[email protected]>Quoted 8 lines · Rodrigo Vivi
From: Ben Widawsky <[email protected]>
It seems we need this at least for the current platforms we have, but probably not later. In any event, it should cause too much harm as we do the same thing on several other platforms.
Signed-off-by Ben Widawsky <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>
All three patches from Ben merged, thanks.
-Daniel
Quoted 30 lines
Quoted 26 lines
--- drivers/gpu/drm/i915/intel_pm.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/i915/intel_pm.c +4
-0@@ -4924,6 +4924,10 @@ static void gen8_init_clock_gating(struct drm_device *dev)I915_WRITE (GEN7_HALF_SLICE_CHICKEN1 ,_MASKED_BIT_ENABLE (GEN7_SINGLE_SUBSCAN_DISPATCH_ENABLE )); +/* WaDisableDopClockGating:bdw May not be needed for production */ +I915_WRITE (GEN7_ROW_CHICKEN2 , +_MASKED_BIT_ENABLE (DOP_CLOCK_GATING_DISABLE )); +/* WaSwitchSolVfFArbitrationPriority:bdw */ I915_WRITE (GAM_ECOCHK ,I915_READ (GAM_ECOCHK ) |HSW_ECOCHK_ARB_PRIO_SOL );Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 14/14 drm/i915: honour forced connector modes
In reply to Rodrigo ViviFrom: Chris Wilson <[email protected]>
In the move over to use BIOS connector configs, we lost the ability to force a specific set of connectors on or off. Try to remedy that by dropping back to the old behavior if we detect a hard coded connector config that tries to enable a connector (disabling is easy!).
Based on earlier patches by Jesse Barnes.
--- drivers/gpu/drm/i915/intel_fbdev.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_fbdev.c +12 -3
@@ -338,8 +338,18 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,continue ; } +if (connector->force ==DRM_FORCE_OFF ) { +DRM_DEBUG_KMS ("connector %d is disabled by user, skipping\n" , + connector->base.id); + enabled[i] = false; +continue ; + } + encoder = connector->encoder;if (!encoder ||WARN_ON (!encoder->crtc)) { +if (connector->force >DRM_FORCE_OFF ) + goto bail; +DRM_DEBUG_KMS ("connector %d has no encoder or crtc, skipping\n" , connector->base.id); enabled[i] = false;
@@ -358,8 +368,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,for (j =0 ; j < fb_helper->connector_count; j++) {if (crtcs[j] == new_crtc) {DRM_DEBUG_KMS ("fallback: cloned configuration\n" ); - fallback = true; - goto out; + goto bail; } }
@@ -417,8 +426,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, fallback = true; } -out:if (fallback) { +bail:DRM_DEBUG_KMS ("Not using firmware configuration\n" );memcpy (enabled, save_enabled, dev->mode_config.num_connector);kfree (save_enabled);
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Review assignments and drop suggestions below. Reviewers please complain if you can't do it in a timely fashion. Rodrigo: Can you please add an overall -collector item with the names of these people to the review board so that mangers can track this? Maybe discuss the overall approach with Paul first.
Thanks, Daniel
Quoted 3 lines
Here goes the update list in order for better reviewers assignment:
Patch drm/i915: Bring UP Power Wells before disabling RC6. - Reviewer:
Paulo
Quoted 1 line
Patch drm/i915: Add support for stealing purgable stolen pages - Reviewer:
Should be dropped and needs to be resend as part of the overall stolen enabling.
Quoted 2 lines
Patch drm/i915: Do not allow a pending forcewake put to unbalance across reset - Reviewer:
Patch drm/i915: Don't save/restore RS when not used - Reviewer:
Abdiel (Helsinki team)
Quoted 1 line
Patch drm/i915: add support for Z-order of planes - Reviewer:
Imo not -collector material, needs an overall approach. Also needs a testcase. Should be dropped.
Quoted 2 lines
Patch drm/i915: Validate VBT header before trusting it - Reviewer:
Patch drm/i915: Validate BDB section before reading - Reviewer:
Shobhit is signe dup already.
Quoted 1 line
Patch drm/i915: Upgrade execbuffer fail after resume failure to EIO - Reviewer:
Do we still need this on top of what I've merged. Chris?
Quoted 1 line
Patch drm/i915: Add property to set HDMI aspect ratio - Reviewer:
Ville
Quoted 1 line
Patch drm/i915: Prevent context obj from being corrupted - Reviewer:
Nacked, we simply need to fix up aliasing ppgtt
Quoted 3 lines
Patch drm/i915/bdw: Add WT caching ability - Reviewer:
Patch drm/i915/bdw: enable eDRAM. - Reviewer:
Patch drm/i915/bdw: Disable idle DOP clock gating - Reviewer:
Brad Volkin from vpg
Quoted 1 line
Patch drm/i915: honour forced connector modes - Reviewer:
Jesse
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 3 lines · Daniel Vetter
Quoted 1 line
Patch drm/i915: Upgrade execbuffer fail after resume failure to EIO - Reviewer:
Do we still need this on top of what I've merged. Chris?
Yes. We can still start the device without initializing all of the available rings and so hit this before we fail with an EIO. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 7 lines · Chris Wilson
Quoted 3 lines · Daniel Vetter
Quoted 1 line
Patch drm/i915: Upgrade execbuffer fail after resume failure to EIO - Reviewer:
Do we still need this on top of what I've merged. Chris?
Yes. We can still start the device without initializing all of the available rings and so hit this before we fail with an EIO.
Hm, so we'd need to adjust the commit message a bit since with
commit 5582e8c3c49150c0e7398688b5ed167d6c3d44fd
Author: Chris Wilson <[email protected]> Date: Wed Apr 9 09:19:41 2014 +0100
drm/i915: Preserve ring buffers objects across resume
this is just a driver load issue and no longer a resume issue. Or do I miss something else?
Or should we frob the ring init some more and simply leave the ring->obj hanging around, eat the -EIO and wedge the gpu?
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 15 lines · Daniel Vetter
Quoted 7 lines · Chris Wilson
Quoted 3 lines · Daniel Vetter
Quoted 1 line
Patch drm/i915: Upgrade execbuffer fail after resume failure to EIO - Reviewer:
Do we still need this on top of what I've merged. Chris?
Yes. We can still start the device without initializing all of the available rings and so hit this before we fail with an EIO.
Hm, so we'd need to adjust the commit message a bit since with
commit
5582e8c3c49150c0e7398688b5ed167d6c3d44fdAuthor: Chris Wilson <[email protected]> Date: Wed Apr 9 09:19:41 2014 +0100
Quoted 7 lines
drm/i915: Preserve ring buffers objects across resume
this is just a driver load issue and no longer a resume issue. Or do I miss something else?
Or should we frob the ring init some more and simply leave the
ring->objhanging around, eat the-EIOand wedge the gpu?
No, because we abort i915_gem_init_rings(). This is an exceptional error path and I think just fixing up the errno here is simplest. All other paths should barf before they touch the ring thanks to intel_ring_begin(). The only difficulty here is that we need to differentiate between two different types of error. (Note that even UXA should be checking for a dead GPU before it tries execbuffer, in this case, at least since it started trying to not die randomly.) So I am just arguing from an interface correctness pov.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 24 lines · Chris Wilson
Quoted 15 lines · Daniel Vetter
Quoted 7 lines · Chris Wilson
Quoted 3 lines · Daniel Vetter
Quoted 1 line
Patch drm/i915: Upgrade execbuffer fail after resume failure to EIO - Reviewer:
Do we still need this on top of what I've merged. Chris?
Yes. We can still start the device without initializing all of the available rings and so hit this before we fail with an EIO.
Hm, so we'd need to adjust the commit message a bit since with
commit
5582e8c3c49150c0e7398688b5ed167d6c3d44fdAuthor: Chris Wilson <[email protected]> Date: Wed Apr 9 09:19:41 2014 +0100Quoted 7 lines
drm/i915: Preserve ring buffers objects across resume
this is just a driver load issue and no longer a resume issue. Or do I miss something else?
Or should we frob the ring init some more and simply leave the
ring->objhanging around, eat the-EIOand wedge the gpu?
Quoted 8 lines
No, because we abort
i915_gem_init_rings(). This is an exceptional error path and I think just fixing up the errno here is simplest. All other paths should barf before they touch the ring thanks tointel_ring_begin(). The only difficulty here is that we need to differentiate between two different types of error. (Note that even UXA should be checking for a dead GPU before it tries execbuffer, in this case, at least since it started trying to not die randomly.) So I am just arguing from an interface correctness pov.
Yeah I've read around a bit in our gem_init_hw functions and this seems to be the sanest option. Can you please update the patch's commit message to reflect our discussion here? And maybe throw a t-b in in case we have that.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch