Skip to content

Commit

Permalink
Adding PCI IDs for AWS F2 (#8361)
Browse files Browse the repository at this point in the history
Signed-off-by: rave <karthik>
Co-authored-by: rave <karthik>
  • Loading branch information
karthdmg-xilinx authored Aug 22, 2024
1 parent 2cbb080 commit f628037
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
14 changes: 13 additions & 1 deletion src/runtime_src/core/pcie/driver/aws/kernel/mgmt/mgmt-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,17 @@ static int bridge_mmap(struct file *file, struct vm_area_struct *vma)
/* prevent touching the pages (byte access) for swap-in,
and prevent the pages from being swapped out */
#ifndef VM_RESERVED
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
#else
vm_flags_set(vma, VM_IO | VM_DONTEXPAND | VM_DONTDUMP);
#endif
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)
vma->vm_flags |= VM_IO | VM_RESERVED;
#else
vm_flags_set(vma, VM_IO | VM_RESERVED);
#endif
#endif
/* make MMIO accessible to user space */
rc = io_remap_pfn_range(vma, vma->vm_start, phys >> PAGE_SHIFT,
Expand Down Expand Up @@ -844,7 +852,11 @@ static int __init awsmgmt_init(void)
int res;

printk(KERN_INFO DRV_NAME " init()\n");
awsmgmt_class = class_create(THIS_MODULE, DRV_NAME);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
xrt_class = class_create(THIS_MODULE, DRV_NAME);
#else
awsmgmt_class = class_create(DRV_NAME);
#endif
if (IS_ERR(awsmgmt_class))
return PTR_ERR(awsmgmt_class);
res = alloc_chrdev_region(&awsmgmt_devnode, AWSMGMT_MINOR_BASE,
Expand Down
24 changes: 24 additions & 0 deletions src/runtime_src/core/pcie/driver/linux/xocl/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ enum {

#define XOCL_DEVNAME(str) str SUBDEV_SUFFIX

/* AWS SHELL NAME Defines */
#define AWS_F1_XDMA_SHELL_NAME "xilinx_aws-vu9p-f1_shell-v04261818_201920_3"
#define AWS_F1_NODMA_SHELL_NAME "xilinx_aws-vu9p-f1_nodma-shell-v09142114_202120_1"
#define AWS_F1_DYNAMIC_SHELL_NAME "xilinx_aws-vu9p-f1_dynamic-shell"

#define AWS_F2_XDMA_SHELL_NAME "xilinx_aws-vu47p-f2_xdma-shell-v04052421_202410_1"

enum subdev_id {
XOCL_SUBDEV_FEATURE_ROM,
XOCL_SUBDEV_VERSION_CTRL,
Expand Down Expand Up @@ -1933,6 +1940,14 @@ struct xocl_subdev_map {
XOCL_DEVINFO_ERT_CTRL, \
})

#define USER_RES_AWS_F2_XDMA \
((struct xocl_subdev_info []) { \
XOCL_DEVINFO_FEATURE_ROM, \
XOCL_DEVINFO_XDMA, \
XOCL_DEVINFO_MAILBOX_USER_SOFTWARE, \
XOCL_DEVINFO_ICAP_USER, \
})

#define USER_RES_AWS_XDMA \
((struct xocl_subdev_info []) { \
XOCL_DEVINFO_FEATURE_ROM, \
Expand Down Expand Up @@ -2020,6 +2035,13 @@ struct xocl_subdev_map {
.subdev_num = ARRAY_SIZE(USER_RES_AWS_XDMA), \
}

#define XOCL_BOARD_USER_AWS_F2_XDMA \
(struct xocl_board_private){ \
.flags = 0, \
.subdev_info = USER_RES_AWS_F2_XDMA, \
.subdev_num = ARRAY_SIZE(USER_RES_AWS_F2_XDMA), \
}

#define XOCL_BOARD_USER_AWS_NODMA \
(struct xocl_board_private){ \
.flags = 0, \
Expand Down Expand Up @@ -3485,6 +3507,8 @@ struct xocl_subdev_map {
{ XOCL_PCI_DEVID(0x1D0F, 0x1042, PCI_ANY_ID, USER_AWS_XDMA) }, \
{ XOCL_PCI_DEVID(0x1D0F, 0xF010, PCI_ANY_ID, USER_AWS_XDMA) }, \
{ XOCL_PCI_DEVID(0x1D0F, 0xF011, PCI_ANY_ID, USER_AWS_NODMA) }, \
{ XOCL_PCI_DEVID(0x1D0F, 0x9048, PCI_ANY_ID, USER_AWS_F2_XDMA) }, \
{ XOCL_PCI_DEVID(0x1D0F, 0x9248, PCI_ANY_ID, USER_AWS_F2_XDMA) }, \
{ XOCL_PCI_DEVID(0x10EE, 0x5031, PCI_ANY_ID, USER_SMARTN) }, \
{ XOCL_PCI_DEVID(0x10EE, 0x5086, PCI_ANY_ID, X3522PV_USER_RAPTOR2) }, \
{ XOCL_PCI_DEVID(0x10EE, 0x5029, PCI_ANY_ID, USER_XDMA_VERSAL) },\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,10 +725,7 @@ static int get_header_from_iomem(struct feature_rom *rom)
if (val != MAGIC_NUM) {
vendor = XOCL_PL_TO_PCI_DEV(pdev)->vendor;
did = XOCL_PL_TO_PCI_DEV(pdev)->device;
if (vendor == 0x1d0f && (did == 0x1042 || did == 0xf010 || did == 0xf011)) { // MAGIC, we should define elsewhere
#define AWS_F1_XDMA_SHELL_NAME "xilinx_aws-vu9p-f1_shell-v04261818_201920_3"
#define AWS_F1_NODMA_SHELL_NAME "xilinx_aws-vu9p-f1_nodma-shell-v09142114_202120_1"
#define AWS_F1_DYNAMIC_SHELL_NAME "xilinx_aws-vu9p-f1_dynamic-shell"
if (vendor == 0x1d0f && (did == 0x1042 || did == 0xf010 || did == 0xf011 || did == 0x9048 || did == 0x9248)) {
xocl_dbg(&pdev->dev,
"Found AWS VU9P Device without featureROM");
/*
Expand All @@ -749,6 +746,9 @@ static int get_header_from_iomem(struct feature_rom *rom)
else if (did == 0xf011)
strncpy(rom->header.VBNVName,
AWS_F1_NODMA_SHELL_NAME, strlen(AWS_F1_NODMA_SHELL_NAME));
else if (did == 0x9048 || did == 0x9248)
strncpy(rom->header.VBNVName,
AWS_F2_XDMA_SHELL_NAME, strlen(AWS_F2_XDMA_SHELL_NAME));
else
strncpy(rom->header.VBNVName,
AWS_F1_DYNAMIC_SHELL_NAME, strlen(AWS_F1_DYNAMIC_SHELL_NAME));
Expand Down

0 comments on commit f628037

Please sign in to comment.