KastnerRG / riffa

The RIFFA development repository
https://riffa.ucsd.edu
Other
766 stars 313 forks source link

Fix driver for linux >= 4.8 #18

Closed marzoul closed 2 years ago

marzoul commented 7 years ago

This fixes driver compilation for at least Linux 4.8.13. This preprocessor check: LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0) solves this issue but the exact Linux minor version which removed macro DEFINE_PCI_DEVICE_TABLE is unknown. But I think it's no big deal.

marzoul commented 7 years ago

Note about compilation for Linux >= 4.9 Information about the fix can be found here: http://rglinuxtech.com/?p=1838

buttercutter commented 5 years ago
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
> +static DEFINE_PCI_DEVICE_TABLE(fpga_ids) =
> +#else
> +static const struct pci_device_id fpga_ids[] =
> +#endif
> +     {
> +             { PCI_DEVICE(VENDOR_ID0, PCI_ANY_ID) },
> +             { PCI_DEVICE(VENDOR_ID1, PCI_ANY_ID) },
> +             { 0 },
> +     };
> +
> +MODULE_DEVICE_TABLE(pci, fpga_ids);

You are grabbing ALL pci devices from these two vendors (Xilinx and
Altera).  That will instantly break any of the existing kernel drivers
for any random device from those vendors by having this driver bind to
the device instead.  And that's not ok, you can not break working
systems, sorry.

Please be very specific and only have the driver bind to the correct
hardware devices.

@marzoul I believe you had reason to add these few lines, but a linux kernel developer told me the above...

Edit: I just realized that you only added the ifdef define syntax, but what do you think about overlapping PCI_ANY_ID in the current context ?

marzoul commented 3 years ago

Note about compilation for Linux >= 5.8 Information about the fix can be found here: https://lkml.org/lkml/2020/6/4/180

marzoul commented 2 years ago

Fix compilation for Linux >= 5.18

The following functions are no longer defined: pci_alloc_consistent() pci_free_consistent() pci_set_dma_mask() pci_set_consistent_dma_mask()

Sources for the patches : https://github.com/archlinux/svntogit-community/blob/packages/broadcom-wl-dkms/trunk/013-linux518.patch https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1013359

drichmond commented 2 years ago

I am more than happy to cede some responsibility for this repo if you'd like to continue updating it and there is value

marzoul commented 2 years ago

Thank you, I would be pleased to accept. We can discuss further by email.

drichmond commented 2 years ago

This all looks good to me, please move forward with merging this at your convenience