Lines Matching +full:comp +full:- +full:disable

1 // SPDX-License-Identifier: MIT
37 * 1 - Xe submits a request to GSC asking for the message to CSME
38 * 2 - GSC replies with the proxy header + payload for CSME
39 * 3 - Xe sends the reply from GSC as-is to CSME via the mei proxy component
40 * 4 - CSME replies with the proxy header + payload for GSC
41 * 5 - Xe submits a request to GSC with the reply from CSME
42 * 6 - GSC replies either with a new header + payload (same as step 2, so we
68 u32 fwsts1 = xe_mmio_read32(&gt->mmio, HECI_FWSTS1(MTL_GSC_HECI1_BASE)); in xe_gsc_proxy_init_done()
81 xe_mmio_rmw32(&gt->mmio, HECI_H_CSR(MTL_GSC_HECI2_BASE), clr, set); in __gsc_proxy_irq_rmw()
101 struct i915_gsc_proxy_component *comp = gsc->proxy.component; in proxy_send_to_csme() local
104 ret = comp->ops->send(comp->mei_dev, gsc->proxy.to_csme, size); in proxy_send_to_csme()
110 ret = comp->ops->recv(comp->mei_dev, gsc->proxy.from_csme, GSC_PROXY_BUFFER_SIZE); in proxy_send_to_csme()
122 u64 addr_in = xe_bo_ggtt_addr(gsc->proxy.bo); in proxy_send_to_gsc()
129 return -EINVAL; in proxy_send_to_gsc()
145 u32 type = FIELD_GET(GSC_PROXY_TYPE, header->hdr); in validate_proxy_header()
146 u32 length = FIELD_GET(GSC_PROXY_PAYLOAD_LENGTH, header->hdr); in validate_proxy_header()
148 if (header->destination != dest || header->source != source) in validate_proxy_header()
149 return -ENOEXEC; in validate_proxy_header()
152 return -E2BIG; in validate_proxy_header()
160 return -EIO; in validate_proxy_header()
193 struct xe_gsc_proxy_header *to_csme_hdr = gsc->proxy.to_csme; in proxy_query()
194 void *to_csme_payload = gsc->proxy.to_csme + PROXY_HDR_SIZE; in proxy_query()
200 wr_offset = xe_gsc_emit_header(xe, &gsc->proxy.to_gsc, 0, in proxy_query()
202 wr_offset = emit_proxy_header(xe, &gsc->proxy.to_gsc, wr_offset); in proxy_query()
211 xe_gsc_poison_header(xe, &gsc->proxy.from_gsc, 0); in proxy_query()
219 ret = xe_gsc_read_out_header(xe, &gsc->proxy.from_gsc, 0, in proxy_query()
228 xe_map_memcpy_from(xe, to_csme_hdr, &gsc->proxy.from_gsc, in proxy_query()
232 if (FIELD_GET(GSC_PROXY_TYPE, to_csme_hdr->hdr) == GSC_PROXY_MSG_TYPE_PROXY_END) in proxy_query()
235 /* make sure the GSC-to-CSME proxy header is sane */ in proxy_query()
239 GSC_PROXY_BUFFER_SIZE - reply_offset); in proxy_query()
247 size = FIELD_GET(GSC_PROXY_PAYLOAD_LENGTH, to_csme_hdr->hdr); in proxy_query()
248 xe_map_memcpy_from(xe, to_csme_payload, &gsc->proxy.from_gsc, in proxy_query()
260 ret = -EPROTO; in proxy_query()
264 /* make sure the CSME-to-GSC proxy header is sane */ in proxy_query()
265 ret = validate_proxy_header(gsc->proxy.from_csme, in proxy_query()
268 GSC_PROXY_BUFFER_SIZE - reply_offset); in proxy_query()
275 wr_offset = xe_gsc_emit_header(xe, &gsc->proxy.to_gsc, 0, in proxy_query()
279 xe_map_memcpy_to(xe, &gsc->proxy.to_gsc, wr_offset, gsc->proxy.from_csme, size); in proxy_query()
294 if (!gsc->proxy.component_added) in xe_gsc_proxy_request_handler()
295 return -ENODEV; in xe_gsc_proxy_request_handler()
299 if (gsc->proxy.component) in xe_gsc_proxy_request_handler()
305 mutex_lock(&gsc->proxy.mutex); in xe_gsc_proxy_request_handler()
306 if (!gsc->proxy.component) { in xe_gsc_proxy_request_handler()
308 err = -EIO; in xe_gsc_proxy_request_handler()
317 mutex_unlock(&gsc->proxy.mutex); in xe_gsc_proxy_request_handler()
328 if (!gsc->proxy.component) { in xe_gsc_proxy_irq_handler()
333 spin_lock(&gsc->lock); in xe_gsc_proxy_irq_handler()
334 gsc->work_actions |= GSC_ACTION_SW_PROXY; in xe_gsc_proxy_irq_handler()
335 spin_unlock(&gsc->lock); in xe_gsc_proxy_irq_handler()
337 queue_work(gsc->wq, &gsc->work); in xe_gsc_proxy_irq_handler()
344 struct xe_gt *gt = xe->tiles[0].media_gt; in xe_gsc_proxy_component_bind()
345 struct xe_gsc *gsc = &gt->uc.gsc; in xe_gsc_proxy_component_bind()
347 mutex_lock(&gsc->proxy.mutex); in xe_gsc_proxy_component_bind()
348 gsc->proxy.component = data; in xe_gsc_proxy_component_bind()
349 gsc->proxy.component->mei_dev = mei_kdev; in xe_gsc_proxy_component_bind()
350 mutex_unlock(&gsc->proxy.mutex); in xe_gsc_proxy_component_bind()
359 struct xe_gt *gt = xe->tiles[0].media_gt; in xe_gsc_proxy_component_unbind()
360 struct xe_gsc *gsc = &gt->uc.gsc; in xe_gsc_proxy_component_unbind()
364 mutex_lock(&gsc->proxy.mutex); in xe_gsc_proxy_component_unbind()
365 gsc->proxy.component = NULL; in xe_gsc_proxy_component_unbind()
366 mutex_unlock(&gsc->proxy.mutex); in xe_gsc_proxy_component_unbind()
382 csme = drmm_kzalloc(&xe->drm, GSC_PROXY_CHANNEL_SIZE, GFP_KERNEL); in proxy_channel_alloc()
384 return -ENOMEM; in proxy_channel_alloc()
392 gsc->proxy.bo = bo; in proxy_channel_alloc()
393 gsc->proxy.to_gsc = IOSYS_MAP_INIT_OFFSET(&bo->vmap, 0); in proxy_channel_alloc()
394 gsc->proxy.from_gsc = IOSYS_MAP_INIT_OFFSET(&bo->vmap, GSC_PROXY_BUFFER_SIZE); in proxy_channel_alloc()
395 gsc->proxy.to_csme = csme; in proxy_channel_alloc()
396 gsc->proxy.from_csme = csme + GSC_PROXY_BUFFER_SIZE; in proxy_channel_alloc()
402 * xe_gsc_proxy_init() - init objects and MEI component required by GSC proxy
414 mutex_init(&gsc->proxy.mutex); in xe_gsc_proxy_init()
418 return -ENODEV; in xe_gsc_proxy_init()
421 /* no multi-tile devices with this feature yet */ in xe_gsc_proxy_init()
422 if (tile->id > 0) { in xe_gsc_proxy_init()
423 xe_gt_err(gt, "unexpected GSC proxy init on tile %u\n", tile->id); in xe_gsc_proxy_init()
424 return -EINVAL; in xe_gsc_proxy_init()
431 err = component_add_typed(xe->drm.dev, &xe_gsc_proxy_component_ops, in xe_gsc_proxy_init()
438 gsc->proxy.component_added = true; in xe_gsc_proxy_init()
446 * xe_gsc_proxy_remove() - remove the GSC proxy MEI component
455 if (!gsc->proxy.component_added) in xe_gsc_proxy_remove()
458 /* disable HECI2 IRQs */ in xe_gsc_proxy_remove()
462 xe_gt_err(gt, "failed to get forcewake to disable GSC interrupts\n"); in xe_gsc_proxy_remove()
464 /* try do disable irq even if forcewake failed */ in xe_gsc_proxy_remove()
472 component_del(xe->drm.dev, &xe_gsc_proxy_component_ops); in xe_gsc_proxy_remove()
473 gsc->proxy.component_added = false; in xe_gsc_proxy_remove()
477 * xe_gsc_proxy_start() - start the proxy by submitting the first request
499 return -EIO; in xe_gsc_proxy_start()