[Intel-gfx] [PATCH 3/5] drm/i915/guc: Move guc_{send, recv}() to intel_uc.c

Chris Wilson chris at chris-wilson.co.uk
Fri Nov 25 12:18:20 UTC 2016


On Fri, Nov 25, 2016 at 11:23:19AM +0000, Chris Wilson wrote:
> > +int intel_guc_logging_control(struct intel_guc *guc, u32 control_val)
> > +{
> > +	u32 data[2];
> > +
> > +	data[0] = INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING;
> > +	data[1] = control_val;
> > +
> > +	return intel_guc_send(guc, data, 2);
> 
> 	u32 pkt[] = {
> 		INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING,
> 		control_val,
> 	};
> 	return intel_guc_send(guc, pkt, ARRAY_SIZE(pkt);
> 
> Or being fancy
> 	return intel_guc_send_cmd(guc, {
> 				  INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING,
> 				  control_val
> 				  });
> 
> #define intel_guc_send_cmd(G, PKT) ({ \
> 	u32 pkt__[] = PKT;\
> 	intel_guc_send(G, pkt__, ARRAY_SIZE(pkt__)); \
> )}
> 
> or intel_guc_send_pkt

#define intel_guc_send_pkt(G, PKT...) ({ \
        u32 pkt__[] = { PKT }; \
        host2guc_action((G), pkt__, ARRAY_SIZE(pkt__)); \
})

static int host2guc_allocate_doorbell(struct intel_guc *guc,
                                      struct i915_guc_client *client)
{
        return intel_guc_send_pkt(guc,
                                  HOST2GUC_ACTION_ALLOCATE_DOORBELL,
                                  client->ctx_index);
}

At which point, you may want to call that intel_guc_send() and rename the
 other __intel_guc_send() :)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list