mirror of https://gitee.com/openkylin/linux.git
drm/i915: s/for_each_sgt_dma/for_each_sgt_daddr/
The sg_table for our backing store might contain addresses from stolen-memory or in the future local-memory, at which point this is no longer a dma-iterator. As a consequence we should now break on NULL iter.sgp, instead of dmap == 0 which is considered an invalid dma address. As a bonus, gcc much prefers this construct, Function old new delta gen8_ggtt_insert_entries 211 192 -19 gen6_ggtt_insert_entries 292 262 -30 i915_error_object_create 996 954 -42 Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20190829201919.21493-1-matthew.auld@intel.com
This commit is contained in:
parent
9be02fde93
commit
31444afb46
|
@ -2208,7 +2208,7 @@ static void gen8_ggtt_insert_entries(struct i915_address_space *vm,
|
|||
|
||||
gtt_entries = (gen8_pte_t __iomem *)ggtt->gsm;
|
||||
gtt_entries += vma->node.start / I915_GTT_PAGE_SIZE;
|
||||
for_each_sgt_dma(addr, sgt_iter, vma->pages)
|
||||
for_each_sgt_daddr(addr, sgt_iter, vma->pages)
|
||||
gen8_set_pte(gtt_entries++, pte_encode | addr);
|
||||
|
||||
/*
|
||||
|
@ -2249,7 +2249,7 @@ static void gen6_ggtt_insert_entries(struct i915_address_space *vm,
|
|||
unsigned int i = vma->node.start / I915_GTT_PAGE_SIZE;
|
||||
struct sgt_iter iter;
|
||||
dma_addr_t addr;
|
||||
for_each_sgt_dma(addr, iter, vma->pages)
|
||||
for_each_sgt_daddr(addr, iter, vma->pages)
|
||||
iowrite32(vm->pte_encode(addr, level, flags), &entries[i++]);
|
||||
|
||||
/*
|
||||
|
|
|
@ -148,8 +148,8 @@ typedef u64 gen8_pte_t;
|
|||
#define GEN8_PDE_IPS_64K BIT(11)
|
||||
#define GEN8_PDE_PS_2M BIT(7)
|
||||
|
||||
#define for_each_sgt_dma(__dmap, __iter, __sgt) \
|
||||
__for_each_sgt_dma(__dmap, __iter, __sgt, I915_GTT_PAGE_SIZE)
|
||||
#define for_each_sgt_daddr(__dp, __iter, __sgt) \
|
||||
__for_each_sgt_daddr(__dp, __iter, __sgt, I915_GTT_PAGE_SIZE)
|
||||
|
||||
struct intel_remapped_plane_info {
|
||||
/* in gtt pages */
|
||||
|
|
|
@ -990,7 +990,7 @@ i915_error_object_create(struct drm_i915_private *i915,
|
|||
dst->unused = 0;
|
||||
|
||||
ret = -EINVAL;
|
||||
for_each_sgt_dma(dma, iter, vma->pages) {
|
||||
for_each_sgt_daddr(dma, iter, vma->pages) {
|
||||
void __iomem *s;
|
||||
|
||||
ggtt->vm.insert_page(&ggtt->vm, dma, slot, I915_CACHE_NONE, 0);
|
||||
|
|
|
@ -67,15 +67,15 @@ static inline struct scatterlist *__sg_next(struct scatterlist *sg)
|
|||
}
|
||||
|
||||
/**
|
||||
* __for_each_sgt_dma - iterate over the DMA addresses of the given sg_table
|
||||
* @__dmap: DMA address (output)
|
||||
* __for_each_sgt_daddr - iterate over the device addresses of the given sg_table
|
||||
* @__dp: Device address (output)
|
||||
* @__iter: 'struct sgt_iter' (iterator state, internal)
|
||||
* @__sgt: sg_table to iterate over (input)
|
||||
* @__step: step size
|
||||
*/
|
||||
#define __for_each_sgt_dma(__dmap, __iter, __sgt, __step) \
|
||||
#define __for_each_sgt_daddr(__dp, __iter, __sgt, __step) \
|
||||
for ((__iter) = __sgt_iter((__sgt)->sgl, true); \
|
||||
((__dmap) = (__iter).dma + (__iter).curr); \
|
||||
((__dp) = (__iter).dma + (__iter).curr), (__iter).sgp; \
|
||||
(((__iter).curr += (__step)) >= (__iter).max) ? \
|
||||
(__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0 : 0)
|
||||
|
||||
|
|
|
@ -623,7 +623,7 @@ static bool assert_partial(struct drm_i915_gem_object *obj,
|
|||
struct sgt_iter sgt;
|
||||
dma_addr_t dma;
|
||||
|
||||
for_each_sgt_dma(dma, sgt, vma->pages) {
|
||||
for_each_sgt_daddr(dma, sgt, vma->pages) {
|
||||
dma_addr_t src;
|
||||
|
||||
if (!size) {
|
||||
|
|
Loading…
Reference in New Issue