@@ -305,6 +305,8 @@ bool ttm_resource_compatible(struct ttm_resource *res,
struct ttm_placement *placement,
bool evicting)
{
+ const u32 incompatible_flag = evicting ? TTM_PL_FLAG_DESIRED :
+ TTM_PL_FLAG_FALLBACK;
struct ttm_buffer_object *bo = res->bo;
struct ttm_device *bdev = bo->bdev;
unsigned i;
@@ -316,11 +318,14 @@ bool ttm_resource_compatible(struct ttm_resource *res,
const struct ttm_place *place = &placement->placement[i];
struct ttm_resource_manager *man;
- if (res->mem_type != place->mem_type)
- continue;
+ if (res->mem_type != place->mem_type) {
+ if (place->flags & TTM_PL_FLAG_PREFERRED)
+ return false;
+ else
+ continue;
+ }
- if (place->flags & (evicting ? TTM_PL_FLAG_DESIRED :
- TTM_PL_FLAG_FALLBACK))
+ if (place->flags & incompatible_flag)
continue;
if (place->flags & TTM_PL_FLAG_CONTIGUOUS &&
@@ -70,6 +70,9 @@
/* Placement is only used during eviction */
#define TTM_PL_FLAG_FALLBACK (1 << 4)
+/* Placement is only used during eviction */
+#define TTM_PL_FLAG_PREFERRED (1 << 5)
+
/**
* struct ttm_place
*