Re: [Intel-gfx] [PATCH 1/2] Revert "drm/i915: Introduce private PAT management"

2019-07-12 Thread Wang, Zhi A
It's quite a long time ago. I cannot fully remember the whole picture now. I 
remembered the last status was to push some unit tests and with the last part 
of patch. Currently I think you can revert this if it causes troubles, we can 
purpose this again if we need this in future.

Thanks,
Zhi.

-Original Message-
From: Zhenyu Wang [mailto:zhen...@linux.intel.com] 
Sent: Friday, July 12, 2019 11:29 AM
To: Joonas Lahtinen 
Cc: Winiarski, Michal ; Chris Wilson 
; intel-gfx@lists.freedesktop.org; Zhenyu Wang 
; Vivi, Rodrigo ; Wang, Zhi A 

Subject: Re: [PATCH 1/2] Revert "drm/i915: Introduce private PAT management"

On 2019.07.12 11:06:01 +0300, Joonas Lahtinen wrote:
> + Zhenyu as FYI
>
> Quoting Chris Wilson (2019-07-02 14:56:04)
> > Quoting Michał Winiarski (2019-07-02 12:31:48)
> > > This reverts commit 4395890a48551982549d222d1923e2833dac47cf.
> > > 
> > > It's been over a year since this was merged, and the actual users 
> > > of intel_ppat_get / intel_ppat_put never materialized.
> > > 
> > > Time to remove it!
> > > 
> > > v2: Unbreak suspend (Chris)
> > > v3: Rebase, drop fixes tag to avoid confusion
> > > 
> > > Signed-off-by: Michał Winiarski 
> > > Cc: Chris Wilson 
> > > Cc: Joonas Lahtinen 
> > > Cc: Rodrigo Vivi 
> > > Cc: Zhi Wang 
> > Reviewed-by: Chris Wilson 
> > 
> > While I would appreciate an ack from Zhi (being the original 
> > author), since we've already sent this a few times, there's no 
> > reason to delay waiting for a response.

Well I also depend on Zhi for comment here, as previous idea was to manage PPAT 
allocation between VM/host, but I'm not sure what's left work status there..

--
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH 1/2] Revert "drm/i915: Introduce private PAT management"

2019-07-12 Thread Zhenyu Wang
On 2019.07.12 11:06:01 +0300, Joonas Lahtinen wrote:
> + Zhenyu as FYI
>
> Quoting Chris Wilson (2019-07-02 14:56:04)
> > Quoting Michał Winiarski (2019-07-02 12:31:48)
> > > This reverts commit 4395890a48551982549d222d1923e2833dac47cf.
> > > 
> > > It's been over a year since this was merged, and the actual users of
> > > intel_ppat_get / intel_ppat_put never materialized.
> > > 
> > > Time to remove it!
> > > 
> > > v2: Unbreak suspend (Chris)
> > > v3: Rebase, drop fixes tag to avoid confusion
> > > 
> > > Signed-off-by: Michał Winiarski 
> > > Cc: Chris Wilson 
> > > Cc: Joonas Lahtinen 
> > > Cc: Rodrigo Vivi 
> > > Cc: Zhi Wang 
> > Reviewed-by: Chris Wilson 
> > 
> > While I would appreciate an ack from Zhi (being the original author),
> > since we've already sent this a few times, there's no reason to delay
> > waiting for a response.

Well I also depend on Zhi for comment here, as previous idea was to
manage PPAT allocation between VM/host, but I'm not sure what's left
work status there..

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827


signature.asc
Description: PGP signature
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH 1/2] Revert "drm/i915: Introduce private PAT management"

2019-07-12 Thread Joonas Lahtinen
+ Zhenyu as FYI

Quoting Chris Wilson (2019-07-02 14:56:04)
> Quoting Michał Winiarski (2019-07-02 12:31:48)
> > This reverts commit 4395890a48551982549d222d1923e2833dac47cf.
> > 
> > It's been over a year since this was merged, and the actual users of
> > intel_ppat_get / intel_ppat_put never materialized.
> > 
> > Time to remove it!
> > 
> > v2: Unbreak suspend (Chris)
> > v3: Rebase, drop fixes tag to avoid confusion
> > 
> > Signed-off-by: Michał Winiarski 
> > Cc: Chris Wilson 
> > Cc: Joonas Lahtinen 
> > Cc: Rodrigo Vivi 
> > Cc: Zhi Wang 
> Reviewed-by: Chris Wilson 
> 
> While I would appreciate an ack from Zhi (being the original author),
> since we've already sent this a few times, there's no reason to delay
> waiting for a response.
> -Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH 1/2] Revert "drm/i915: Introduce private PAT management"

2019-07-02 Thread Chris Wilson
Quoting Michał Winiarski (2019-07-02 12:31:48)
> This reverts commit 4395890a48551982549d222d1923e2833dac47cf.
> 
> It's been over a year since this was merged, and the actual users of
> intel_ppat_get / intel_ppat_put never materialized.
> 
> Time to remove it!
> 
> v2: Unbreak suspend (Chris)
> v3: Rebase, drop fixes tag to avoid confusion
> 
> Signed-off-by: Michał Winiarski 
> Cc: Chris Wilson 
> Cc: Joonas Lahtinen 
> Cc: Rodrigo Vivi 
> Cc: Zhi Wang 
Reviewed-by: Chris Wilson 

While I would appreciate an ack from Zhi (being the original author),
since we've already sent this a few times, there's no reason to delay
waiting for a response.
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH 1/2] Revert "drm/i915: Introduce private PAT management"

2019-07-02 Thread Michał Winiarski
This reverts commit 4395890a48551982549d222d1923e2833dac47cf.

It's been over a year since this was merged, and the actual users of
intel_ppat_get / intel_ppat_put never materialized.

Time to remove it!

v2: Unbreak suspend (Chris)
v3: Rebase, drop fixes tag to avoid confusion

Signed-off-by: Michał Winiarski 
Cc: Chris Wilson 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Zhi Wang 
---
 drivers/gpu/drm/i915/i915_drv.h |   2 -
 drivers/gpu/drm/i915/i915_gem_gtt.c | 279 +---
 drivers/gpu/drm/i915/i915_gem_gtt.h |  36 
 3 files changed, 42 insertions(+), 275 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 02dd9f9f3a89..09e09d26e67d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1489,8 +1489,6 @@ struct drm_i915_private {
DECLARE_HASHTABLE(mm_structs, 7);
struct mutex mm_lock;
 
-   struct intel_ppat ppat;
-
/* Kernel Modesetting */
 
struct intel_crtc *plane_to_crtc_mapping[I915_MAX_PIPES];
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/i915_gem_gtt.c
index ff1d5008a256..30e14eac47ac 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3028,203 +3028,26 @@ static int ggtt_probe_common(struct i915_ggtt *ggtt, 
u64 size)
return 0;
 }
 
-static struct intel_ppat_entry *
-__alloc_ppat_entry(struct intel_ppat *ppat, unsigned int index, u8 value)
+static void cnl_setup_private_ppat(struct drm_i915_private *dev_priv)
 {
-   struct intel_ppat_entry *entry = >entries[index];
-
-   GEM_BUG_ON(index >= ppat->max_entries);
-   GEM_BUG_ON(test_bit(index, ppat->used));
-
-   entry->ppat = ppat;
-   entry->value = value;
-   kref_init(>ref);
-   set_bit(index, ppat->used);
-   set_bit(index, ppat->dirty);
-
-   return entry;
-}
-
-static void __free_ppat_entry(struct intel_ppat_entry *entry)
-{
-   struct intel_ppat *ppat = entry->ppat;
-   unsigned int index = entry - ppat->entries;
-
-   GEM_BUG_ON(index >= ppat->max_entries);
-   GEM_BUG_ON(!test_bit(index, ppat->used));
-
-   entry->value = ppat->clear_value;
-   clear_bit(index, ppat->used);
-   set_bit(index, ppat->dirty);
-}
-
-/**
- * intel_ppat_get - get a usable PPAT entry
- * @i915: i915 device instance
- * @value: the PPAT value required by the caller
- *
- * The function tries to search if there is an existing PPAT entry which
- * matches with the required value. If perfectly matched, the existing PPAT
- * entry will be used. If only partially matched, it will try to check if
- * there is any available PPAT index. If yes, it will allocate a new PPAT
- * index for the required entry and update the HW. If not, the partially
- * matched entry will be used.
- */
-const struct intel_ppat_entry *
-intel_ppat_get(struct drm_i915_private *i915, u8 value)
-{
-   struct intel_ppat *ppat = >ppat;
-   struct intel_ppat_entry *entry = NULL;
-   unsigned int scanned, best_score;
-   int i;
-
-   GEM_BUG_ON(!ppat->max_entries);
-
-   scanned = best_score = 0;
-   for_each_set_bit(i, ppat->used, ppat->max_entries) {
-   unsigned int score;
-
-   score = ppat->match(ppat->entries[i].value, value);
-   if (score > best_score) {
-   entry = >entries[i];
-   if (score == INTEL_PPAT_PERFECT_MATCH) {
-   kref_get(>ref);
-   return entry;
-   }
-   best_score = score;
-   }
-   scanned++;
-   }
-
-   if (scanned == ppat->max_entries) {
-   if (!entry)
-   return ERR_PTR(-ENOSPC);
-
-   kref_get(>ref);
-   return entry;
-   }
-
-   i = find_first_zero_bit(ppat->used, ppat->max_entries);
-   entry = __alloc_ppat_entry(ppat, i, value);
-   ppat->update_hw(i915);
-   return entry;
-}
-
-static void release_ppat(struct kref *kref)
-{
-   struct intel_ppat_entry *entry =
-   container_of(kref, struct intel_ppat_entry, ref);
-   struct drm_i915_private *i915 = entry->ppat->i915;
-
-   __free_ppat_entry(entry);
-   entry->ppat->update_hw(i915);
-}
-
-/**
- * intel_ppat_put - put back the PPAT entry got from intel_ppat_get()
- * @entry: an intel PPAT entry
- *
- * Put back the PPAT entry got from intel_ppat_get(). If the PPAT index of the
- * entry is dynamically allocated, its reference count will be decreased. Once
- * the reference count becomes into zero, the PPAT index becomes free again.
- */
-void intel_ppat_put(const struct intel_ppat_entry *entry)
-{
-   struct intel_ppat *ppat = entry->ppat;
-   unsigned int index = entry - ppat->entries;
-
-   GEM_BUG_ON(!ppat->max_entries);
-
-   kref_put(>entries[index].ref, release_ppat);
-}
-
-static void