return PAGE_ALIGN(xe_bo_size(bo));
}
+/**
+ * xe_bo_has_valid_ccs_bb - Check if CCS's BBs were setup for the BO.
+ * @bo: the &xe_bo to check
+ *
+ * The CCS's BBs should only be setup by the driver VF, but it is safe
+ * to call this function also by non-VF driver.
+ *
+ * Return: true iff the CCS's BBs are setup, false otherwise.
+ */
+static inline bool xe_bo_has_valid_ccs_bb(struct xe_bo *bo)
+{
+ return bo->bb_ccs[XE_SRIOV_VF_CCS_READ_CTX] &&
+ bo->bb_ccs[XE_SRIOV_VF_CCS_WRITE_CTX];
+}
+
static inline bool xe_bo_has_pages(struct xe_bo *bo)
{
if ((bo->ttm.ttm && ttm_tt_is_populated(bo->ttm.ttm)) ||
xe_assert(xe, IS_VF_CCS_READY(xe));
- if (!IS_VF_CCS_BB_VALID(xe, bo))
+ if (!xe_bo_has_valid_ccs_bb(bo))
return 0;
for_each_ccs_rw_ctx(ctx_id) {
XE_SRIOV_VF_CCS_CTX_COUNT
};
-#define IS_VF_CCS_BB_VALID(xe, bo) ({ \
- struct xe_device *___xe = (xe); \
- struct xe_bo *___bo = (bo); \
- IS_SRIOV_VF(___xe) && \
- ___bo->bb_ccs[XE_SRIOV_VF_CCS_READ_CTX] && \
- ___bo->bb_ccs[XE_SRIOV_VF_CCS_WRITE_CTX]; \
- })
-
struct xe_migrate;
struct xe_sa_manager;