mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-08-28 06:05:05 +00:00

The purpose of the GuC Buffer Cache is to maintain a set ofreusable buffers that could be used while sending some of the CTB H2G actions that require separate buffer with indirect data. Currently only few PF actions need this so initialize it only when running as a PF. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241220194205.995-9-michal.wajdeczko@intel.com
48 lines
1.5 KiB
C
48 lines
1.5 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2024 Intel Corporation
|
|
*/
|
|
|
|
#ifndef _XE_GUC_BUF_H_
|
|
#define _XE_GUC_BUF_H_
|
|
|
|
#include <linux/cleanup.h>
|
|
#include <linux/err.h>
|
|
|
|
#include "xe_guc_buf_types.h"
|
|
|
|
int xe_guc_buf_cache_init(struct xe_guc_buf_cache *cache);
|
|
u32 xe_guc_buf_cache_dwords(struct xe_guc_buf_cache *cache);
|
|
struct xe_guc_buf xe_guc_buf_reserve(struct xe_guc_buf_cache *cache, u32 dwords);
|
|
struct xe_guc_buf xe_guc_buf_from_data(struct xe_guc_buf_cache *cache,
|
|
const void *data, size_t size);
|
|
void xe_guc_buf_release(const struct xe_guc_buf buf);
|
|
|
|
/**
|
|
* xe_guc_buf_is_valid() - Check if a buffer reference is valid.
|
|
* @buf: the &xe_guc_buf reference to check
|
|
*
|
|
* Return: true if @ref represents a valid sub-allication.
|
|
*/
|
|
static inline bool xe_guc_buf_is_valid(const struct xe_guc_buf buf)
|
|
{
|
|
return !IS_ERR_OR_NULL(buf.sa);
|
|
}
|
|
|
|
void *xe_guc_buf_cpu_ptr(const struct xe_guc_buf buf);
|
|
u64 xe_guc_buf_flush(const struct xe_guc_buf buf);
|
|
u64 xe_guc_buf_gpu_addr(const struct xe_guc_buf buf);
|
|
u64 xe_guc_cache_gpu_addr_from_ptr(struct xe_guc_buf_cache *cache, const void *ptr, u32 size);
|
|
|
|
DEFINE_CLASS(xe_guc_buf, struct xe_guc_buf,
|
|
xe_guc_buf_release(_T),
|
|
xe_guc_buf_reserve(cache, num),
|
|
struct xe_guc_buf_cache *cache, u32 num);
|
|
|
|
DEFINE_CLASS(xe_guc_buf_from_data, struct xe_guc_buf,
|
|
xe_guc_buf_release(_T),
|
|
xe_guc_buf_from_data(cache, data, size),
|
|
struct xe_guc_buf_cache *cache, const void *data, size_t size);
|
|
|
|
#endif
|