sdk/linux_kernel_drivers/xocl/xocl_exec.c
/**
 * configure() - Configure the scheduler
 *
 * Process the configure command sent from user space. Only one process can
 * configure the scheduler, so if scheduler is already configured, the
 * function should verify that another process doesn't expect different
 * configuration.
 *
 * Future may need ability to query current configuration so as to keep
 * multiple processes in sync.
 *
 * Return: 0 on success, 1 on failure
 */
Configure the scheduler
Process the configure command sent from user space. Only one process can
configure the scheduler, so if scheduler is already configured, the
function should verify that another process doesn't expect different
configuration.

Future may need ability to query current configuration so as to keep
multiple processes in sync.

0 on success, 1 on failure
Configure the scheduler Process the configure command sent from user space . Only one process can configure the scheduler so if scheduler is already configured the function should verify that another process doesn ' t expect different configuration . Future may need ability to query current configuration so as to keep multiple processes in sync . 0 on success 1 on failure
static int
configure(struct xocl_cmd *xcmd)
{
	struct drm_xocl_dev *xdev=xcmd->xdev;
	struct ert_configure_cmd *cfg;
	if (sched_error_on(xdev,opcode(xcmd)!=ERT_CONFIGURE,"expected configure command"))
		return 1;
	cfg = (struct ert_configure_cmd *)(xcmd->packet);
	if (xdev->exec.configured==0) {
		SCHED_DEBUG("configuring scheduler\n");
		xdev->exec.num_slots = ERT_CQ_SIZE / cfg->slot_size;
		xdev->exec.num_cus = cfg->num_cus;
		xdev->exec.cu_shift_offset = cfg->cu_shift;
		xdev->exec.cu_base_addr = cfg->cu_base_addr;
		xdev->exec.num_cu_masks = ((xdev->exec.num_cus-1)>>5) + 1;
		if (cfg->ert) {
			SCHED_DEBUG("++ configuring embedded scheduler mode\n");
			xdev->exec.ops = &mb_ops;
			xdev->exec.polling_mode = cfg->polling;
			xdev->exec.cq_interrupt = cfg->cq_int;
		}
		else {
			SCHED_DEBUG("++ configuring penguin scheduler mode\n");
			xdev->exec.ops = &penguin_ops;
			xdev->exec.polling_mode = 1;
		}
		DRM_INFO("scheduler config ert(%d) slots(%d), cus(%d), cu_shift(%d), cu_base(0x%x), cu_masks(%d)\n"
			 ,is_ert(xdev)
			 ,xdev->exec.num_slots
			 ,xdev->exec.num_cus
			 ,xdev->exec.cu_shift_offset
			 ,xdev->exec.cu_base_addr
			 ,xdev->exec.num_cu_masks);
		return 0;
	}
	DRM_INFO("reconfiguration of scheduler not supported\n");
	return 1;
}
static int configure ( struct xocl_cmd * xcmd ) { struct drm_xocl_dev * xdev = xcmd -> xdev ; struct ert_configure_cmd * cfg ; if ( sched_error_on ( xdev , opcode ( xcmd ) != ERT_CONFIGURE , " " ) ) return 1 ; cfg = ( struct ert_configure_cmd * ) ( xcmd -> packet ) ; if ( xdev -> exec . configured == 0 ) { SCHED_DEBUG ( " \n " ) ; xdev -> exec . num_slots = ERT_CQ_SIZE / cfg -> slot_size ; xdev -> exec . num_cus = cfg -> num_cus ; xdev -> exec . cu_shift_offset = cfg -> cu_shift ; xdev -> exec . cu_base_addr = cfg -> cu_base_addr ; xdev -> exec . num_cu_masks = ( ( xdev -> exec . num_cus - 1 ) >> 5 ) + 1 ; if ( cfg -> ert ) { SCHED_DEBUG ( " \n " ) ; xdev -> exec . ops = & mb_ops ; xdev -> exec . polling_mode = cfg -> polling ; xdev -> exec . cq_interrupt = cfg -> cq_int ; } else { SCHED_DEBUG ( " \n " ) ; xdev -> exec . ops = & penguin_ops ; xdev -> exec . polling_mode = 1 ; } DRM_INFO ( " \n " , is_ert ( xdev ) , xdev -> exec . num_slots , xdev -> exec . num_cus , xdev -> exec . cu_shift_offset , xdev -> exec . cu_base_addr , xdev -> exec . num_cu_masks ) ; return 0 ; } DRM_INFO ( " \n " ) ; return 1 ; }
configure() - Configure the scheduler
 Process the configure command sent from user space.
configure () - Configure the scheduler Process the configure command sent from user space .