drm/i915/ggtt: Move ballooning support to i915_ggtt
Subsystems (2)
PATCH 1/1 drm/i915/ggtt: Move ballooning support to i915_ggtt
Today VGT implements GGTT ballooning on its own, using some private static structure to hold info about reserved GGTT nodes and then manually update vm.reserved size owned by i915_ggtt.
As i915_ggtt already manages some custom reserved nodes (like uc_fw) move VGT ballooning support to i915_ggtt and make it more generic for possible future reuse in other scenarios.
As a bonus we can drop another place in driver that uses static data.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 47 +++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.h | 18 ++++++++ drivers/gpu/drm/i915/i915_vgpu.c | 72 ++++++----------------------- 3 files changed, 78 insertions(+), 59 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +47 -0
@@ -3827,6 +3827,53 @@ int i915_gem_gtt_insert(struct i915_address_space *vm, start, end, DRM_MM_INSERT_EVICT); } +int i915_ggtt_balloon_space (struct i915_ggtt *ggtt, +enum i915_ggtt_balloon_id id, +u64 start,u64 end) +{ +struct drm_mm_node *node = &ggtt->balloon[id]; +u64 size = end - start; +int ret; + +GEM_BUG_ON (id <0 || id >=ARRAY_SIZE (ggtt->balloon)); +GEM_BUG_ON (start >= end); +DRM_DEV_DEBUG_DRIVER (ggtt->vm.i915->drm.dev, +"%sGGTT [%#llx-%#llx] %lluK\n" , +"ballooning " , start, end, size /SZ_1K ); + + ret =i915_gem_gtt_reserve (&ggtt->vm, node, size, start, +I915_COLOR_UNEVICTABLE ,PIN_NOEVICT ); +if (unlikely (ret)) { +DRM_DEV_ERROR (ggtt->vm.i915->drm.dev, +"%sGGTT [%#llx-%#llx] %lluK\n" , +"Failed to balloon " , node->start, + node->start + node->size, node->size /SZ_1K ); + }else { + ggtt->vm.reserved += node->size; + } + +return ret; +} + +void i915_ggtt_deballoon_space (struct i915_ggtt *ggtt, +enum i915_ggtt_balloon_id id) +{ +struct drm_mm_node *node = &ggtt->balloon[id]; + +GEM_BUG_ON (id <0 || id >=ARRAY_SIZE (ggtt->balloon)); +if (!drm_mm_node_allocated (node)) +return ; + +DRM_DEV_DEBUG_DRIVER (ggtt->vm.i915->drm.dev, +"%sGGTT [%#llx-%#llx] %lluK\n" , +"deballooning " , node->start, + node->start + node->size, node->size /SZ_1K ); + +GEM_BUG_ON (ggtt->vm.reserved < node->size); + ggtt->vm.reserved -= node->size; +drm_mm_remove_node (node); +} +#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )#include "selftests/mock_gtt.c" #include "selftests/i915_gem_gtt.c"
drivers/gpu/drm/i915/i915_gem_gtt.h +18 -0
@@ -432,6 +432,12 @@ struct i915_ggtt {struct drm_mm_node error_capture;struct drm_mm_node uc_fw; + +/* +* There might be up to 4 regions ballooned. +* (2 for mappable and 2 for unmappable graphic memory) +*/ +struct drm_mm_node balloon[4 ]; };struct i915_ppgtt {
@@ -649,6 +655,18 @@ int i915_gem_gtt_insert(struct i915_address_space *vm, u64 size, u64 alignment, unsigned long color, u64 start, u64 end, unsigned int flags); +enum i915_ggtt_balloon_id { +I915_GGTT_BALLOON0 , +I915_GGTT_BALLOON1 , +I915_GGTT_BALLOON2 , +I915_GGTT_BALLOON3 , +}; + +int i915_ggtt_balloon_space (struct i915_ggtt *ggtt, +enum i915_ggtt_balloon_id id,u64 start,u64 end); +void i915_ggtt_deballoon_space (struct i915_ggtt *ggtt, +enum i915_ggtt_balloon_id id); +/* Flags used by pin/bind&friends. */ #define PIN_NOEVICT BIT_ULL(0)#define PIN_NOSEARCH BIT_ULL(1)
drivers/gpu/drm/i915/i915_vgpu.c +13 -59
116 lines not on this page · raw message
Signature · 6 lines
2.19.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Michal Wajdeczko (2019-11-21 17:58:50)
Quoted 25 lines
Today VGT implements GGTT ballooning on its own, using some private static structure to hold info about reserved GGTT nodes and then manually update vm.reserved size owned by
i915_ggtt.As
i915_ggttalready manages some custom reserved nodes (likeuc_fw) move VGT ballooning support toi915_ggttand make it more generic for possible future reuse in other scenarios.As a bonus we can drop another place in driver that uses static data.
Signed-off-by Michal Wajdeczko <[email protected]>Cc Xiong Zhang <[email protected]>Cc Chris Wilson <[email protected]>Cc Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 47 +++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.h | 18 ++++++++ drivers/gpu/drm/i915/i915_vgpu.c | 72 ++++++----------------------- 3 files changed, 78 insertions(+), 59 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0
drivers/gpu/drm/i915/i915_gem_gtt.c int i915_gem_gtt_insert(struct i915_address_space *vm, · line 3831
Quoted 5 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0@@ -3827,6 +3827,53 @@ int i915_gem_gtt_insert(struct i915_address_space *vm, start, end, DRM_MM_INSERT_EVICT); } +int i915_ggtt_balloon_space(struct i915_ggtt *ggtt, + enum i915_ggtt_balloon_id id,
Do we want to use a fixed number of slots?
So what exactly is wrong with the clients reserving nodes themselves?
I'm not seeing why exactly we want to move to a much more centralised system and argue over ownership of i915_ggtt_balloon_id. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 31 lines · Chris Wilson
Quoting Michal Wajdeczko (2019-11-21 17:58:50)
Quoted 30 lines
Today VGT implements GGTT ballooning on its own, using some private static structure to hold info about reserved GGTT nodes and then manually update vm.reserved size owned by
i915_ggtt.As
i915_ggttalready manages some custom reserved nodes (likeuc_fw) move VGT ballooning support toi915_ggttand make it more generic for possible future reuse in other scenarios.As a bonus we can drop another place in driver that uses static data.
Signed-off-by Michal Wajdeczko <[email protected]>Cc Xiong Zhang <[email protected]>Cc Chris Wilson <[email protected]>Cc Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 47 +++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.h | 18 ++++++++ drivers/gpu/drm/i915/i915_vgpu.c | 72 ++++++----------------------- 3 files changed, 78 insertions(+), 59 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -3827,6 +3827,53 @@ int i915_gem_gtt_insert(structi915_address_space *vm, start, end, DRM_MM_INSERT_EVICT); }
Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c int i915_gem_gtt_insert(struct i915_address_space *vm, · line 3831
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0+int i915_ggtt_balloon_space(struct i915_ggtt *ggtt, + enum i915_ggtt_balloon_id id,Do we want to use a fixed number of slots?
Probably not, enum was just used as a starting point to provide explicit name each of the available node and to avoid adding GEM_BUG_ON while accessing fixed size array.
Quoted 2 lines
So what exactly is wrong with the clients reserving nodes themselves?
They still reserve nodes themselves. But now they will not do that in a shadow and not use static data to hold actual nodes.
Quoted 3 lines
I'm not seeing why exactly we want to move to a much more centralised system
I wanted to make it clear to all clients that i915_ggtt is a good place to keep list of reserved some (instead of hiding them in private places)
And to provide wrapper function that can be easily reused and that each ballooning behaves in the same way.
Extra bonus is that we have all such balloon tweaks in one place (both code and data nodes).
Quoted 1 line
and argue over ownership of
i915_ggtt_balloon_id.
Now it's first come, first served order, but we should already know all current usages and in case of clash either pick different id or add the new one.
Note that today some scenarios are exclusive (gvt won't work with guc) so some node placeholders can be shared - but this can be equally done without enums but with union of explicit node definitions.
I915_GGTT_BALLOON_GUC_TOP = I915_GGTT_BALLOON3,
I915_GGTT_BALLOON_VGT_UNMAP_TOP = I915_GGTT_BALLOON3,
union {
struct {
struct drm_mm_node uc_fw;
} guc;
struct {
struct drm_mm_node space[4];
} vgt;
} balloons;but direct access to nodes can be also wrapped into:
struct drm_mm_node *i915_ggtt_get_uc_fw_node(i915_ggtt *ggtt)
{
return ggtt->balloon[I915_GGTT_BALLOON_GUC_TOP];
}Michal
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Michal Wajdeczko (2019-11-21 19:10:46)
Quoted 45 lines
Quoted 32 lines · Chris Wilson
Quoting Michal Wajdeczko (2019-11-21 17:58:50)
Quoted 31 lines
Today VGT implements GGTT ballooning on its own, using some private static structure to hold info about reserved GGTT nodes and then manually update vm.reserved size owned by
i915_ggtt.As
i915_ggttalready manages some custom reserved nodes (likeuc_fw) move VGT ballooning support toi915_ggttand make it more generic for possible future reuse in other scenarios.As a bonus we can drop another place in driver that uses static data.
Signed-off-by Michal Wajdeczko <[email protected]>Cc Xiong Zhang <[email protected]>Cc Chris Wilson <[email protected]>Cc Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 47 +++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.h | 18 ++++++++ drivers/gpu/drm/i915/i915_vgpu.c | 72 ++++++----------------------- 3 files changed, 78 insertions(+), 59 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +0
-0@@ -3827,6 +3827,53 @@ int i915_gem_gtt_insert(structi915_address_space *vm, start, end, DRM_MM_INSERT_EVICT); }Quoted 4 lines
drivers/gpu/drm/i915/i915_gem_gtt.c int i915_gem_gtt_insert(struct i915_address_space *vm, · line 3831
Quoted 2 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +2
-0+int i915_ggtt_balloon_space(struct i915_ggtt *ggtt, + enum i915_ggtt_balloon_id id,Do we want to use a fixed number of slots?
Probably not, enum was just used as a starting point to provide explicit name each of the available node and to avoid adding
GEM_BUG_ONwhile accessing fixed size array.Quoted 1 line
Quoted 4 lines
Quoted 1 line
So what exactly is wrong with the clients reserving nodes themselves?
They still reserve nodes themselves. But now they will not do that in a shadow and not use static data to hold actual nodes.
But that's their decision, all we provide is the service to dole out the ggtt (or not depending on our whim). If they use a static allocation for their nodes and not kmalloc -- we don't care, why should we as long as their code is correct?
Quoted 11 lines
Quoted 2 lines
I'm not seeing why exactly we want to move to a much more centralised system
I wanted to make it clear to all clients that
i915_ggttis a good place to keep list of reserved some (instead of hiding them in private places)And to provide wrapper function that can be easily reused and that each ballooning behaves in the same way.
Extra bonus is that we have all such balloon tweaks in one place (both code and data nodes).
So I think you would be happy with just a
struct i915_ggtt_balloon (or whatever) {
struct dma_mm_node node;
struct list_head link;
void *private;
} *i915_ggtt_reserve_balloon(i915/ggtt, u64 bottom, u64 top);... but you are already past the point where you might as well just let the client allocate their own struct and pass us the drm_mm_node. So
i915_ggtt_reserve(i915/ggtt, drm_mm_node, u64 bottom, u64 top, flags?)
Quoted 22 lines
Quoted 1 line
and argue over ownership of
i915_ggtt_balloon_id.Now it's first come, first served order, but we should already know all current usages and in case of clash either pick different id or add the new one.
Note that today some scenarios are exclusive (gvt won't work with guc) so some node placeholders can be shared - but this can be equally done without enums but with union of explicit node definitions.
I915_GGTT_BALLOON_GUC_TOP = I915_GGTT_BALLOON3, I915_GGTT_BALLOON_VGT_UNMAP_TOP = I915_GGTT_BALLOON3, union { struct { struct drm_mm_node uc_fw; } guc; struct { struct drm_mm_node space[4]; } vgt; } balloons;
Quoted 6 lines
but direct access to nodes can be also wrapped into:
struct
drm_mm_node*i915_ggtt_get_uc_fw_node(i915_ggtt *ggtt){ return ggtt->balloon[I915_GGTT_BALLOON_GUC_TOP]; }
I am not yet sold on putting an array of nodes here, we already have a list of them all :-p
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/ggtt: Move ballooning support to i915_ggtt
In reply to Michal Wajdeczko== Series Details ==
== Series Details ==
Series: drm/i915/ggtt: Move ballooning support to i915_ggtt
URL : https://patchwork.freedesktop.org/series/69844/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_7401 -> Patchwork_15381
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15381/index.html
Known issues
------------
Here are the changes found in Patchwork_15381 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-kbl-r: [PASS][1] -> [INCOMPLETE][2] ([fdo#111975])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7401/fi-kbl-r/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15381/fi-kbl-r/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live_blt:
- fi-hsw-peppy: [DMESG-FAIL][3] ([fdo#112147]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7401/fi-hsw-peppy/igt@i915_selftest@live_blt.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15381/fi-hsw-peppy/igt@i915_selftest@live_blt.html
* igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy: [DMESG-WARN][5] ([fdo#102614]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7401/fi-hsw-peppy/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15381/fi-hsw-peppy/igt@[email protected]
[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#111975]: https://bugs.freedesktop.org/show_bug.cgi?id=111975
[fdo#112147]: https://bugs.freedesktop.org/show_bug.cgi?id=112147
Participating hosts (51 -> 42)
------------------------------
Missing (9): fi-hsw-4770r fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7401 -> Patchwork_15381
CI-20190529: 20190529
CI_DRM_7401: 242d04c5d3993e9f0cd025ac9a73a2e81d4206de @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5299: 65fed6a79adea14f7bef6d55530da47d7731d370 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_15381: b3d9ade8837296f4b02b5ed82504ed31656ea3f6 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
b3d9ade88372 drm/i915/ggtt: Move ballooning support to i915_ggtt
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15381/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 10 lines · Michal Wajdeczko
Today VGT implements GGTT ballooning on its own, using some private static structure to hold info about reserved GGTT nodes and then manually update vm.reserved size owned by
i915_ggtt.As
i915_ggttalready manages some custom reserved nodes (likeuc_fw) move VGT ballooning support toi915_ggttand make it more generic for possible future reuse in other scenarios.As a bonus we can drop another place in driver that uses static data.
Quoted 7 lines
Signed-off-by Michal Wajdeczko <[email protected]>Cc Xiong Zhang <[email protected]>Cc Chris Wilson <[email protected]>Cc Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 47 +++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.h | 18 ++++++++
Maybe not part of this patch, but should we start moving this stuff out of the top level instead of addming more?
BR,
Jani.
Quoted 221 lines
drivers/gpu/drm/i915/i915_vgpu.c | 72 ++++++----------------------- 3 files changed, 78 insertions(+), 59 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +47
-0@@ -3827,6 +3827,53 @@ int i915_gem_gtt_insert(struct i915_address_space *vm, start, end, DRM_MM_INSERT_EVICT); } +int i915_ggtt_balloon_space (struct i915_ggtt *ggtt, +enum i915_ggtt_balloon_id id, +u64 start,u64 end) +{ +struct drm_mm_node *node = &ggtt->balloon[id]; +u64 size = end - start; +int ret; + +GEM_BUG_ON (id <0 || id >=ARRAY_SIZE (ggtt->balloon)); +GEM_BUG_ON (start >= end); +DRM_DEV_DEBUG_DRIVER (ggtt->vm.i915->drm.dev, +"%sGGTT [%#llx-%#llx] %lluK\n" , +"ballooning " , start, end, size /SZ_1K ); + + ret =i915_gem_gtt_reserve (&ggtt->vm, node, size, start, +I915_COLOR_UNEVICTABLE ,PIN_NOEVICT ); +if (unlikely (ret)) { +DRM_DEV_ERROR (ggtt->vm.i915->drm.dev, +"%sGGTT [%#llx-%#llx] %lluK\n" , +"Failed to balloon " , node->start, + node->start + node->size, node->size /SZ_1K ); + }else { + ggtt->vm.reserved += node->size; + } + +return ret; +} + +void i915_ggtt_deballoon_space (struct i915_ggtt *ggtt, +enum i915_ggtt_balloon_id id) +{ +struct drm_mm_node *node = &ggtt->balloon[id]; + +GEM_BUG_ON (id <0 || id >=ARRAY_SIZE (ggtt->balloon)); +if (!drm_mm_node_allocated (node)) +return ; + +DRM_DEV_DEBUG_DRIVER (ggtt->vm.i915->drm.dev, +"%sGGTT [%#llx-%#llx] %lluK\n" , +"deballooning " , node->start, + node->start + node->size, node->size /SZ_1K ); + +GEM_BUG_ON (ggtt->vm.reserved < node->size); + ggtt->vm.reserved -= node->size; +drm_mm_remove_node (node); +} +#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )#include "selftests/mock_gtt.c" #include "selftests/i915_gem_gtt.c" drivers/gpu/drm/i915/i915_gem_gtt.h +18
-0@@ -432,6 +432,12 @@ struct i915_ggtt {struct drm_mm_node error_capture;struct drm_mm_node uc_fw; + +/* +* There might be up to 4 regions ballooned. +* (2 for mappable and 2 for unmappable graphic memory) +*/ +struct drm_mm_node balloon[4 ]; };struct i915_ppgtt {@@ -649,6 +655,18 @@ int i915_gem_gtt_insert(struct i915_address_space *vm, u64 size, u64 alignment, unsigned long color, u64 start, u64 end, unsigned int flags); +enum i915_ggtt_balloon_id { +I915_GGTT_BALLOON0 , +I915_GGTT_BALLOON1 , +I915_GGTT_BALLOON2 , +I915_GGTT_BALLOON3 , +}; + +int i915_ggtt_balloon_space (struct i915_ggtt *ggtt, +enum i915_ggtt_balloon_id id,u64 start,u64 end); +void i915_ggtt_deballoon_space (struct i915_ggtt *ggtt, +enum i915_ggtt_balloon_id id); +/* Flags used by pin/bind&friends. */ #define PIN_NOEVICT BIT_ULL(0)#define PIN_NOSEARCH BIT_ULL(1)drivers/gpu/drm/i915/i915_vgpu.c +13
-59@@ -106,32 +106,6 @@ bool intel_vgpu_has_full_ppgtt(struct drm_i915_private *dev_priv)return dev_priv->vgpu.caps &VGT_CAPS_FULL_PPGTT ; } -struct _balloon_info_ { -/* -* There are up to 2 regions per mappable/unmappable graphic -* memory that might be ballooned. Here, index 0/1 is for mappable -* graphic memory, 2/3 for unmappable graphic memory. -*/ -struct drm_mm_node space[4 ]; -}; - -static struct _balloon_info_ bl_info; - -static void vgt_deballoon_space (struct i915_ggtt *ggtt, -struct drm_mm_node *node) -{ -if (!drm_mm_node_allocated (node)) -return ; - -DRM_DEBUG_DRIVER ("deballoon space: range [0x%llx - 0x%llx] %llu KiB.\n" , - node->start, - node->start + node->size, - node->size /1024 ); - - ggtt->vm.reserved -= node->size; -drm_mm_remove_node (node); -} -/** * intel_vgt_deballoon - deballoon reserved graphics address trunks * @ggtt: the global GGTT from which we reserved earlier @@ -149,28 +123,7 @@ void intel_vgt_deballoon(struct i915_ggtt *ggtt)DRM_DEBUG ("VGT deballoon.\n" );for (i =0 ; i <4 ; i++) -vgt_deballoon_space (ggtt, &bl_info.space[i]); -} - -static int vgt_balloon_space (struct i915_ggtt *ggtt, -struct drm_mm_node *node, -unsigned long start,unsigned long end) -{ -unsigned long size = end - start; -int ret; - -if (start >= end) -return -EINVAL ; - -DRM_INFO ("balloon space: range [ 0x%lx - 0x%lx ] %lu KiB.\n" , - start, end, size /1024 ); - ret =i915_gem_gtt_reserve (&ggtt->vm, node, - size, start,I915_COLOR_UNEVICTABLE , -0 ); -if (!ret) - ggtt->vm.reserved += size; - -return ret; +i915_ggtt_deballoon_space (ggtt,I915_GGTT_BALLOON0 + i); }/** @@ -256,32 +209,33 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)/* Unmappable graphic memory ballooning */ if (unmappable_base > ggtt->mappable_end) { - ret =vgt_balloon_space (ggtt, &bl_info.space[2 ], - ggtt->mappable_end, unmappable_base); + ret =i915_ggtt_balloon_space (ggtt,I915_GGTT_BALLOON2 , + ggtt->mappable_end, + unmappable_base);if (ret) goto err; }if (unmappable_end < ggtt_end) { - ret =vgt_balloon_space (ggtt, &bl_info.space[3 ], - unmappable_end, ggtt_end); + ret =i915_ggtt_balloon_space (ggtt,I915_GGTT_BALLOON3 , + unmappable_end, ggtt_end);if (ret) goto err_upon_mappable; }/* Mappable graphic memory ballooning */ if (mappable_base) { - ret =vgt_balloon_space (ggtt, &bl_info.space[0 ], -0 , mappable_base); + ret =i915_ggtt_balloon_space (ggtt,I915_GGTT_BALLOON0 , +0 , mappable_base);if (ret) goto err_upon_unmappable; }if (mappable_end < ggtt->mappable_end) { - ret =vgt_balloon_space (ggtt, &bl_info.space[1 ], - mappable_end, ggtt->mappable_end); + ret =i915_ggtt_balloon_space (ggtt,I915_GGTT_BALLOON1 , + mappable_end, ggtt->mappable_end);if (ret) goto err_below_mappable;@@ -291,11 +245,11 @@ int intel_vgt_balloon(struct i915_ggtt *ggtt)return 0 ; err_below_mappable: -vgt_deballoon_space (ggtt, &bl_info.space[0 ]); +i915_ggtt_deballoon_space (ggtt,I915_GGTT_BALLOON0 ); err_upon_unmappable: -vgt_deballoon_space (ggtt, &bl_info.space[3 ]); +i915_ggtt_deballoon_space (ggtt,I915_GGTT_BALLOON3 ); err_upon_mappable: -vgt_deballoon_space (ggtt, &bl_info.space[2 ]); +i915_ggtt_deballoon_space (ggtt,I915_GGTT_BALLOON2 ); err:DRM_ERROR ("VGT balloon fail\n" );return ret;
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Jani Nikula (2019-11-25 10:51:53)
Quoted 19 lines · Michal Wajdeczko
Quoted 10 lines
Today VGT implements GGTT ballooning on its own, using some private static structure to hold info about reserved GGTT nodes and then manually update vm.reserved size owned by
i915_ggtt.As
i915_ggttalready manages some custom reserved nodes (likeuc_fw) move VGT ballooning support toi915_ggttand make it more generic for possible future reuse in other scenarios.As a bonus we can drop another place in driver that uses static data.
Quoted 7 lines
Signed-off-by Michal Wajdeczko <[email protected]>Cc Xiong Zhang <[email protected]>Cc Chris Wilson <[email protected]>Cc Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 47 +++++++++++++++++++ drivers/gpu/drm/i915/i915_gem_gtt.h | 18 ++++++++
Quoted 2 lines
Maybe not part of this patch, but should we start moving this stuff out of the top level instead of addming more?
It's on my todo list to split this between the HW pagetable management and GEM and other interfaces on top.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx