-
Notifications
You must be signed in to change notification settings - Fork 50
Fix pciedriver and portalmem to support newest kernel versions
#198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
0afe2bb
aacc176
2ab6a30
3551006
4d6b4a7
d481d2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,3 +62,7 @@ kc705g2 | |
| ac701g2 | ||
| *.ltx | ||
| zedboard_ubuntu | ||
| driverversion.h | ||
| *.o | ||
| *.d | ||
| *.mod | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,8 +187,8 @@ void* PortalPoller::event(void) | |
| if (rc < 0) | ||
| fprintf(stderr, "[%s:%d] read error %d\n", __FUNCTION__, __LINE__, errno); | ||
| for (int i = 0; i < numWrappers; i++) { | ||
| if (!portal_wrappers) | ||
| fprintf(stderr, "Poller: No portal_instances revents=%d\n", portal_fds[i].revents); | ||
| // if (!portal_wrappers) | ||
|
||
| // fprintf(stderr, "Poller: No portal_instances revents=%d\n", portal_fds[i].revents); | ||
| Portal *instance = portal_wrappers[i]; | ||
| if (trace_poller) | ||
| fprintf(stderr, "Poller: event tile %d fpga%d fd %d handler %p parent %p\n", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,9 @@ | |
| #include <linux/poll.h> /* poll_table, etc. */ | ||
| #include <asm/uaccess.h> /* copy_to_user, copy_from_user */ | ||
| #include <linux/dma-buf.h> | ||
| // #include <linux/dma-mapping.h> | ||
|
||
| // #include <linux/dma-direction.h> | ||
| #include <linux/pci_regs.h> | ||
| #include "driverversion.h" | ||
|
|
||
| #include "pcieportal.h" | ||
|
|
@@ -356,7 +359,11 @@ static int portal_mmap(struct file *filp, struct vm_area_struct *vma) | |
| //vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | ||
| off = this_portal->extra->dma_handle; | ||
| } | ||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(6,3,0) | ||
| vma->vm_flags |= VM_IO; | ||
| #else | ||
| vm_flags_set(vma, VM_IO); | ||
| #endif | ||
| if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | ||
| vma->vm_end - vma->vm_start, vma->vm_page_prot)) | ||
| return -EAGAIN; | ||
|
|
@@ -424,7 +431,11 @@ static int portal_dma_pcis_mmap(struct file *filp, struct vm_area_struct *vma) | |
| vma->vm_pgoff = off >> PAGE_SHIFT; | ||
| //vma->vm_flags |= VM_IO | VM_RESERVED; | ||
|
|
||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(6,3,0) | ||
| vma->vm_flags |= VM_IO; | ||
| #else | ||
| vm_flags_set(vma, VM_IO); | ||
| #endif | ||
| if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, | ||
| vma->vm_end - vma->vm_start, vma->vm_page_prot)) | ||
| return -EAGAIN; | ||
|
|
@@ -590,8 +601,13 @@ printk("[%s:%d]\n", __FUNCTION__, __LINE__); | |
| printk("config block ID %x\n", ioread32(this_board->bar2io + 0x3000)); | ||
| } | ||
| /* set DMA mask */ | ||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(5,18,0) | ||
| if (pci_set_dma_mask(dev, DMA_BIT_MASK(48))) { | ||
| printk(KERN_ERR "%s: pci_set_dma_mask failed for 48-bit DMA\n", DEV_NAME); | ||
| printk(KERN_ERR "%s: pci_dma_set_mask failed for 48-bit DMA\n", DEV_NAME); | ||
| #else | ||
| if (dma_set_mask(&dev->dev, DMA_BIT_MASK(48))) { | ||
| printk(KERN_ERR "%s: dma_set_mask failed for 48-bit DMA\n", DEV_NAME); | ||
| #endif | ||
| err = -EIO; | ||
| goto BARS_MAPPED_label; | ||
| } | ||
|
|
@@ -839,7 +855,7 @@ static | |
|
|
||
| MODULE_DEVICE_TABLE(pci, pcieportal_id_table); | ||
|
|
||
| static pci_ers_result_t pcieportal_error_detected(struct pci_dev *pdev, enum pci_channel_state error) | ||
| static pci_ers_result_t pcieportal_error_detected(struct pci_dev *pdev, pci_channel_state_t error) | ||
| { | ||
| printk(KERN_ERR "%s:%s: pcie error %d\n", DEV_NAME, __FUNCTION__, error); | ||
| return PCI_ERS_RESULT_CAN_RECOVER; | ||
|
|
@@ -904,7 +920,12 @@ static int pcieportal_init(void) | |
| int status; | ||
|
|
||
| printk("[%s:%d]\n", __FUNCTION__, __LINE__); | ||
| pcieportal_class = class_create(THIS_MODULE, "Connectal"); | ||
| #if LINUX_VERSION_CODE < KERNEL_VERSION(6,4,0) | ||
| pcieportal_class = class_create(THIS_MODULE, "Connectal"); | ||
| #else | ||
| pcieportal_class = class_create("Connectal"); | ||
| #endif | ||
|
|
||
| if (IS_ERR(pcieportal_class)) { | ||
| printk(KERN_ERR "%s: failed to create class Connectal\n", DEV_NAME); | ||
| return PTR_ERR(pcieportal_class); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ | |
| from __future__ import print_function | ||
|
|
||
| import fcntl, glob, json, struct, subprocess, sys | ||
| from gmpy import mpz | ||
| from gmpy2 import mpz | ||
| BNOC_TRACE = 0xc008b508 | ||
| Trace_len = 144 | ||
| struct_traceData = '@ L I I 16I 16I' | ||
|
|
@@ -415,7 +415,7 @@ if __name__ == '__main__': | |
| base = int(tlpfirst[0:16],16) | ||
| base = int(tlpfirst[0:8],16) | ||
| else: | ||
| fd = open(devfilenames[0], 'rw') | ||
| fd = open(devfilenames[0], 'w') | ||
| try: | ||
| while 1: | ||
| buf = fcntl.ioctl(fd, PCIE_CHANGE_ENTRY, ' ' * ChangeEntry_len) | ||
|
|
@@ -441,7 +441,7 @@ if __name__ == '__main__': | |
| buf = fcntl.ioctl(fd, BNOC_GET_TLP, ' ' * Tlp_len) | ||
| foo = '' | ||
| for x in buf: | ||
|
||
| foo = "%02x" % ord( x ) + foo | ||
| foo = "%02x" % x + foo | ||
| tlplog.append(foo) | ||
| fcntl.ioctl(fd, BNOC_ENABLE_TRACE, 1) | ||
| #for foo in tlplog: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/usr/bin/env python33 | ||
| #!/usr/bin/env python3 | ||
|
|
||
| # Amazon FPGA Hardware Development Kit | ||
| # | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this was ever really debugged, but it's good to fix the typo