Lines Matching full:gt
23 static void pf_init_versions(struct xe_gt *gt) in pf_init_versions() argument
29 gt->sriov.pf.service.version.base.major = GUC_RELAY_VERSION_BASE_MAJOR; in pf_init_versions()
30 gt->sriov.pf.service.version.base.minor = GUC_RELAY_VERSION_BASE_MINOR; in pf_init_versions()
33 gt->sriov.pf.service.version.latest.major = GUC_RELAY_VERSION_LATEST_MAJOR; in pf_init_versions()
34 gt->sriov.pf.service.version.latest.minor = GUC_RELAY_VERSION_LATEST_MINOR; in pf_init_versions()
38 static int pf_negotiate_version(struct xe_gt *gt, in pf_negotiate_version() argument
42 struct xe_gt_sriov_pf_service_version base = gt->sriov.pf.service.version.base; in pf_negotiate_version()
43 struct xe_gt_sriov_pf_service_version latest = gt->sriov.pf.service.version.latest; in pf_negotiate_version()
45 xe_gt_assert(gt, base.major); in pf_negotiate_version()
46 xe_gt_assert(gt, base.major <= latest.major); in pf_negotiate_version()
47 xe_gt_assert(gt, (base.major < latest.major) || (base.minor <= latest.minor)); in pf_negotiate_version()
73 xe_gt_assert(gt, base.major == latest.major); in pf_negotiate_version()
83 static void pf_connect(struct xe_gt *gt, u32 vfid, u32 major, u32 minor) in pf_connect() argument
85 xe_gt_sriov_pf_assert_vfid(gt, vfid); in pf_connect()
86 xe_gt_assert(gt, major || minor); in pf_connect()
88 gt->sriov.pf.vfs[vfid].version.major = major; in pf_connect()
89 gt->sriov.pf.vfs[vfid].version.minor = minor; in pf_connect()
92 static void pf_disconnect(struct xe_gt *gt, u32 vfid) in pf_disconnect() argument
94 xe_gt_sriov_pf_assert_vfid(gt, vfid); in pf_disconnect()
96 gt->sriov.pf.vfs[vfid].version.major = 0; in pf_disconnect()
97 gt->sriov.pf.vfs[vfid].version.minor = 0; in pf_disconnect()
100 static bool pf_is_negotiated(struct xe_gt *gt, u32 vfid, u32 major, u32 minor) in pf_is_negotiated() argument
102 xe_gt_sriov_pf_assert_vfid(gt, vfid); in pf_is_negotiated()
104 return major == gt->sriov.pf.vfs[vfid].version.major && in pf_is_negotiated()
105 minor <= gt->sriov.pf.vfs[vfid].version.minor; in pf_is_negotiated()
206 static int pf_alloc_runtime_info(struct xe_gt *gt) in pf_alloc_runtime_info() argument
208 struct xe_device *xe = gt_to_xe(gt); in pf_alloc_runtime_info()
213 xe_gt_assert(gt, IS_SRIOV_PF(xe)); in pf_alloc_runtime_info()
214 xe_gt_assert(gt, !gt->sriov.pf.service.runtime.size); in pf_alloc_runtime_info()
215 xe_gt_assert(gt, !gt->sriov.pf.service.runtime.regs); in pf_alloc_runtime_info()
216 xe_gt_assert(gt, !gt->sriov.pf.service.runtime.values); in pf_alloc_runtime_info()
229 gt->sriov.pf.service.runtime.size = size; in pf_alloc_runtime_info()
230 gt->sriov.pf.service.runtime.regs = regs; in pf_alloc_runtime_info()
231 gt->sriov.pf.service.runtime.values = values; in pf_alloc_runtime_info()
236 static void read_many(struct xe_gt *gt, unsigned int count, in read_many() argument
240 *values++ = xe_mmio_read32(gt, *regs++); in read_many()
243 static void pf_prepare_runtime_info(struct xe_gt *gt) in pf_prepare_runtime_info() argument
249 if (!gt->sriov.pf.service.runtime.size) in pf_prepare_runtime_info()
252 size = gt->sriov.pf.service.runtime.size; in pf_prepare_runtime_info()
253 regs = gt->sriov.pf.service.runtime.regs; in pf_prepare_runtime_info()
254 values = gt->sriov.pf.service.runtime.values; in pf_prepare_runtime_info()
256 read_many(gt, size, regs, values); in pf_prepare_runtime_info()
259 struct drm_printer p = xe_gt_info_printer(gt); in pf_prepare_runtime_info()
261 xe_gt_sriov_pf_service_print_runtime(gt, &p); in pf_prepare_runtime_info()
266 * xe_gt_sriov_pf_service_init - Early initialization of the GT SR-IOV PF services.
267 * @gt: the &xe_gt to initialize
269 * Performs early initialization of the GT SR-IOV PF services, including preparation
274 int xe_gt_sriov_pf_service_init(struct xe_gt *gt) in xe_gt_sriov_pf_service_init() argument
278 pf_init_versions(gt); in xe_gt_sriov_pf_service_init()
280 err = pf_alloc_runtime_info(gt); in xe_gt_sriov_pf_service_init()
286 xe_gt_sriov_err(gt, "Failed to initialize service (%pe)\n", ERR_PTR(err)); in xe_gt_sriov_pf_service_init()
292 * @gt: the &xe_gt to update
299 void xe_gt_sriov_pf_service_update(struct xe_gt *gt) in xe_gt_sriov_pf_service_update() argument
301 pf_prepare_runtime_info(gt); in xe_gt_sriov_pf_service_update()
306 * @gt: the &xe_gt
315 void xe_gt_sriov_pf_service_reset(struct xe_gt *gt, unsigned int vfid) in xe_gt_sriov_pf_service_reset() argument
317 pf_disconnect(gt, vfid); in xe_gt_sriov_pf_service_reset()
321 static int pf_process_handshake(struct xe_gt *gt, u32 vfid, in pf_process_handshake() argument
327 xe_gt_sriov_dbg_verbose(gt, "VF%u wants ABI version %u.%u\n", in pf_process_handshake()
330 err = pf_negotiate_version(gt, wanted_major, wanted_minor, major, minor); in pf_process_handshake()
333 xe_gt_sriov_notice(gt, "VF%u failed to negotiate ABI %u.%u (%pe)\n", in pf_process_handshake()
335 pf_disconnect(gt, vfid); in pf_process_handshake()
337 xe_gt_sriov_dbg(gt, "VF%u negotiated ABI version %u.%u\n", in pf_process_handshake()
339 pf_connect(gt, vfid, *major, *minor); in pf_process_handshake()
346 static int pf_process_handshake_msg(struct xe_gt *gt, u32 origin, in pf_process_handshake_msg() argument
364 err = pf_process_handshake(gt, origin, wanted_major, wanted_minor, &major, &minor); in pf_process_handshake_msg()
368 xe_gt_assert(gt, major || minor); in pf_process_handshake_msg()
369 xe_gt_assert(gt, size >= VF2PF_HANDSHAKE_RESPONSE_MSG_LEN); in pf_process_handshake_msg()
387 static int pf_service_runtime_query(struct xe_gt *gt, u32 start, u32 limit, in pf_service_runtime_query() argument
394 xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); in pf_service_runtime_query()
396 runtime = >->sriov.pf.service.runtime; in pf_service_runtime_query()
405 data->offset = xe_mmio_adjusted_addr(gt, addr); in pf_service_runtime_query()
414 static int pf_process_runtime_query_msg(struct xe_gt *gt, u32 origin, in pf_process_runtime_query_msg() argument
423 if (!pf_is_negotiated(gt, origin, 1, 0)) in pf_process_runtime_query_msg()
440 ret = pf_service_runtime_query(gt, start, limit, reg_data_buf, &remaining); in pf_process_runtime_query_msg()
453 * xe_gt_sriov_pf_service_process_request - Service GT level SR-IOV request message from the VF.
454 * @gt: the &xe_gt that provides the service
465 int xe_gt_sriov_pf_service_process_request(struct xe_gt *gt, u32 origin, in xe_gt_sriov_pf_service_process_request() argument
472 xe_gt_assert(gt, msg_len >= GUC_HXG_MSG_MIN_LEN); in xe_gt_sriov_pf_service_process_request()
473 xe_gt_assert(gt, FIELD_GET(GUC_HXG_MSG_0_TYPE, msg[0]) == GUC_HXG_TYPE_REQUEST); in xe_gt_sriov_pf_service_process_request()
477 xe_gt_sriov_dbg_verbose(gt, "service action %#x:%u from VF%u\n", in xe_gt_sriov_pf_service_process_request()
482 ret = pf_process_handshake_msg(gt, origin, msg, msg_len, response, resp_size); in xe_gt_sriov_pf_service_process_request()
485 ret = pf_process_runtime_query_msg(gt, origin, msg, msg_len, response, resp_size); in xe_gt_sriov_pf_service_process_request()
497 * @gt: the &xe_gt
502 int xe_gt_sriov_pf_service_print_runtime(struct xe_gt *gt, struct drm_printer *p) in xe_gt_sriov_pf_service_print_runtime() argument
508 xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt))); in xe_gt_sriov_pf_service_print_runtime()
510 size = gt->sriov.pf.service.runtime.size; in xe_gt_sriov_pf_service_print_runtime()
511 regs = gt->sriov.pf.service.runtime.regs; in xe_gt_sriov_pf_service_print_runtime()
512 values = gt->sriov.pf.service.runtime.values; in xe_gt_sriov_pf_service_print_runtime()
516 xe_mmio_adjusted_addr(gt, regs->addr), *values); in xe_gt_sriov_pf_service_print_runtime()
524 * @gt: the &xe_gt
529 int xe_gt_sriov_pf_service_print_version(struct xe_gt *gt, struct drm_printer *p) in xe_gt_sriov_pf_service_print_version() argument
531 struct xe_device *xe = gt_to_xe(gt); in xe_gt_sriov_pf_service_print_version()
535 xe_gt_assert(gt, IS_SRIOV_PF(xe)); in xe_gt_sriov_pf_service_print_version()
538 version = >->sriov.pf.vfs[n].version; in xe_gt_sriov_pf_service_print_version()