Skip to content

Commit

Permalink
XRT Support for EEMI based PMC SRST (system reset) CR-1183722 (#8096)
Browse files Browse the repository at this point in the history
* XRT Reset Initial Changes

Signed-off-by: bisingha <[email protected]>

* destroy subdevs before SRST

Signed-off-by: bisingha <[email protected]>

* set boot config for eemi reset

Signed-off-by: bisingha <[email protected]>

---------

Signed-off-by: bisingha <[email protected]>
Co-authored-by: bisingha <[email protected]>
  • Loading branch information
karthdmg-xilinx and bisingha-xilinx authored Apr 25, 2024
1 parent 295276b commit da80098
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/runtime_src/core/include/xgq_cmd_vmr.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ enum xgq_cmd_vmr_control_type {
XGQ_CMD_BOOT_BACKUP = 0x2,
XGQ_CMD_PROGRAM_SC = 0x3,
XGQ_CMD_VMR_DEBUG = 0x4,
XGQ_CMD_VMR_EEMI_SRST = 0x5, /* Request VMR to perform SRST using EEMI based PMC API request */
};

/**
Expand Down Expand Up @@ -248,7 +249,8 @@ struct xgq_cmd_vmr_control_payload {
uint32_t req_type:8;
uint32_t debug_level:3;
uint32_t debug_type:5;
uint32_t rsvd:16;
uint32_t eemi_boot_from_backup:1;
uint32_t rsvd:15;
};

/**
Expand Down
4 changes: 3 additions & 1 deletion src/runtime_src/core/pcie/driver/linux/xocl/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ enum {
XOCL_DSAFLAG_MPSOC = (1 << 12),
XOCL_DSAFLAG_CUSTOM_DTB = (1 << 13),
XOCL_DSAFLAG_VERSAL_ES3 = (1 << 14),
XOCL_DSAFLAG_EEMI_API_SRST = (1 << 15),
};

/* sysmon flags */
Expand Down Expand Up @@ -2897,7 +2898,8 @@ struct xocl_subdev_map {
(struct xocl_board_private){ \
.flags = XOCL_DSAFLAG_VERSAL | \
XOCL_DSAFLAG_FIXED_INTR | \
XOCL_DSAFLAG_DYNAMIC_IP, \
XOCL_DSAFLAG_DYNAMIC_IP | \
XOCL_DSAFLAG_EEMI_API_SRST, \
.subdev_info = RES_MGMT_VSEC, \
.subdev_num = ARRAY_SIZE(RES_MGMT_VSEC), \
.flash_type = FLASH_TYPE_OSPI_VERSAL, \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ int xclmgmt_xclbin_fetch_and_download(struct xclmgmt_dev *lro,
/* bifurcation-reset.c */
long xclmgmt_hot_reset_bifurcation(struct xclmgmt_dev *lro,
struct xclmgmt_dev *buddy_lro, bool force);
int xclmgmt_eemi_pmc_srst(struct xclmgmt_dev *lro, bool force);
/* firewall.c */
void init_firewall(struct xclmgmt_dev *lro);
void xclmgmt_killall_processes(struct xclmgmt_dev *lro);
Expand Down
21 changes: 16 additions & 5 deletions src/runtime_src/core/pcie/driver/linux/xocl/mgmtpf/mgmt-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,22 @@ long xclmgmt_hot_reset(struct xclmgmt_dev *lro, bool force)

xocl_thread_stop(lro);

err = xocl_enable_vmr_boot(lro);
if (err) {
mgmt_err(lro, "enable reset failed");
err = -ENODEV;
goto failed;
if (XOCL_DSA_EEMI_API_SRST(lro)) {
xocl_subdev_destroy_by_level(lro, XOCL_SUBDEV_LEVEL_URP);
err = xocl_vmr_eemi_pmc_srst(lro);
if (err) {
mgmt_err(lro, "EMMI PMC SRST Failed. err: %ld", err);
goto failed;
}
return 0;
}
else {
err = xocl_enable_vmr_boot(lro);
if (err) {
mgmt_err(lro, "enable reset failed");
err = -ENODEV;
goto failed;
}
}

if (!force && xrt_reset_syncup) {
Expand Down
7 changes: 7 additions & 0 deletions src/runtime_src/core/pcie/driver/linux/xocl/subdev/xgq_vmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1923,6 +1923,7 @@ static int vmr_control_op(struct platform_device *pdev,
payload->req_type = req_type;
payload->debug_level = xgq->xgq_vmr_debug_level;
payload->debug_type = xgq->xgq_vmr_debug_type;
payload->eemi_boot_from_backup = xgq->xgq_boot_from_backup;

hdr = &(cmd->xgq_cmd_entry.hdr);
hdr->opcode = XGQ_CMD_OP_VMR_CONTROL;
Expand Down Expand Up @@ -2220,6 +2221,11 @@ static int vmr_enable_multiboot(struct platform_device *pdev)
xgq->xgq_boot_from_backup ? XGQ_CMD_BOOT_BACKUP : XGQ_CMD_BOOT_DEFAULT);
}

static int vmr_eemi_pmc_srst(struct platform_device *pdev)
{
return vmr_control_op(pdev, XGQ_CMD_VMR_EEMI_SRST);
}

static int xgq_collect_sensors(struct platform_device *pdev, int aid, int sid,
char *data_buf, uint32_t len, uint8_t sensor_id)
{
Expand Down Expand Up @@ -3610,6 +3616,7 @@ static struct xocl_xgq_vmr_funcs xgq_vmr_ops = {
.xgq_collect_all_inst_sensors = xgq_collect_all_inst_sensors,
.vmr_load_firmware = xgq_log_page_metadata,
.vmr_status = xgq_status,
.vmr_eemi_pmc_srst = vmr_eemi_pmc_srst,
};

static const struct file_operations xgq_vmr_fops = {
Expand Down
7 changes: 7 additions & 0 deletions src/runtime_src/core/pcie/driver/linux/xocl/xocl_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,9 @@ struct xocl_dev_core {
#define XOCL_DSA_NO_KDMA(xdev_hdl) \
(((struct xocl_dev_core *)xdev_hdl)->priv.flags & \
XOCL_DSAFLAG_NO_KDMA)
#define XOCL_DSA_EEMI_API_SRST(xdev_hdl) \
(((struct xocl_dev_core *)xdev_hdl)->priv.flags & \
XOCL_DSAFLAG_EEMI_API_SRST)

#define XOCL_DSA_XPR_ON(xdev_hdl) \
(((struct xocl_dev_core *)xdev_hdl)->priv.xpr)
Expand Down Expand Up @@ -2209,6 +2212,7 @@ struct xocl_xgq_vmr_funcs {
uint8_t id, uint32_t len);
int (*vmr_load_firmware)(struct platform_device *pdev, char **fw, size_t *fw_size);
int (*vmr_status)(struct platform_device *pdev, struct VmrStatus *vmr_status_ptr);
int (*vmr_eemi_pmc_srst)(struct platform_device *pdev);
};
#define XGQ_DEV(xdev) \
(SUBDEV(xdev, XOCL_SUBDEV_XGQ_VMR) ? \
Expand Down Expand Up @@ -2260,6 +2264,9 @@ struct xocl_xgq_vmr_funcs {
#define xocl_vmr_status(xdev, vmr_status_ptr) \
(XGQ_CB(xdev, vmr_load_firmware) ? \
XGQ_OPS(xdev)->vmr_status(XGQ_DEV(xdev), vmr_status_ptr) : -ENODEV)
#define xocl_vmr_eemi_pmc_srst(xdev) \
(XGQ_CB(xdev, vmr_eemi_pmc_srst) ? \
XGQ_OPS(xdev)->vmr_eemi_pmc_srst(XGQ_DEV(xdev)) : -ENODEV)

struct xocl_sdm_funcs {
struct xocl_subdev_funcs common_funcs;
Expand Down

0 comments on commit da80098

Please sign in to comment.