Re: [PATCH v4 1/4] drm/xe/guc: Add KUNIT stub for xe_guc_mmio_send_recv()
Michal Wajdeczko <[email protected]> Wed, 5 Aug 2026 13:03:48 +0200
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
nit: we are not adding any "stub" in this patch, we are just preparing xe_guc_mmio_send_recv() function to be replaced by the test specific stub/mock in the follow up patch On 7/28/2026 11:50 AM, Satyanarayana K V P wrote: > Add a KUNIT_STATIC_STUB_REDIRECT() to xe_guc_mmio_send_recv() so that > KUnit tests can mock the GuC MMIO query response and exercise VF KLV > query error paths without talking to real hardware. nit: the macro name 'KUNIT_STATIC_STUB_REDIRECT' might be not known to all maybe just say: "Allow to replace xe_guc_mmio_send_recv() with the stub so we can exercise more code paths on the fake xe device during kunit tests." [1] https://docs.kernel.org/process/submitting-patches.html#describe-your-changes > > Signed-off-by: Satyanarayana K V P <[email protected]> > Cc: Michal Wajdeczko <[email protected]> > --- > V3 -> V4: nit: this is new patch, it shouldn't have this log (prev patch was just dropped) > - Added stub for xe_guc_mmio_send_recv(). (Michal W) > - Removed stub for guc_action_query_single_klv32() and > guc_action_query_single_klv64(). (Michal W) > > V2 -> V3: > - Added stub to guc_action_query_single_klv32() and > guc_action_query_single_klv64(). > --- > drivers/gpu/drm/xe/xe_guc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c > index 4286bd05c686..c7e28f5c3b7c 100644 > --- a/drivers/gpu/drm/xe/xe_guc.c > +++ b/drivers/gpu/drm/xe/xe_guc.c > @@ -9,6 +9,7 @@ > #include <drm/drm_managed.h> > > #include <generated/xe_wa_oob.h> > +#include <kunit/static_stub.h> nit: usually we place <kunit> headers right after <linux> and before <drm> > > #include "abi/guc_actions_abi.h" > #include "abi/guc_errors_abi.h" > @@ -1497,6 +1498,8 @@ int xe_guc_auth_huc(struct xe_guc *guc, u32 rsa_addr) > int xe_guc_mmio_send_recv(struct xe_guc *guc, const u32 *request, > u32 len, u32 *response_buf) > { > + KUNIT_STATIC_STUB_REDIRECT(xe_guc_mmio_send_recv, guc, request, len, > + response_buf); shouldn't we place this statement *after* local variables declaration block? > struct xe_device *xe = guc_to_xe(guc); > struct xe_gt *gt = guc_to_gt(guc); > struct xe_mmio *mmio = >->mmio;