1* Import drivers using VCHI. 2 3VCHI is just a tool to let drivers talk to the firmware. Here are 4some of the ones we want: 5 6 - vc_mem (https://github.com/raspberrypi/linux/blob/rpi-4.4.y/drivers/char/broadcom/vc_mem.c) 7 8 This driver is what the vcdbg userspace program uses to set up its 9 requests to the firmware, which are transmitted across VCHIQ. vcdbg 10 is really useful for debugging firmware interactions. 11 12 - VCSM (https://github.com/raspberrypi/linux/tree/rpi-4.4.y/drivers/char/broadcom/vc_sm) 13 14 This driver is used for talking about regions of VC memory across 15 firmware protocols including VCHI. We'll want to extend this driver 16 to manage these buffers as dmabufs so that we can zero-copy import 17 camera images into vc4 for rendering/display. 18 19* Fix kernel module support 20 21Even the VPU firmware doesn't support a VCHI re-connect, the driver 22should properly handle a module unload. This also includes that all 23resources must be freed (kthreads, debugfs entries, ...) and global 24variables avoided. 25 26* Cleanup logging mechanism 27 28The driver should probably be using the standard kernel logging mechanisms 29such as dev_info, dev_dbg, and friends. 30 31* Documentation 32 33A short top-down description of this driver's architecture (function of 34kthreads, userspace, limitations) could be very helpful for reviewers. 35 36* Review and comment memory barriers 37 38There is a heavy use of memory barriers in this driver, it would be very 39beneficial to go over all of them and, if correct, comment on their merits. 40Extra points to whomever confidently reviews the remote_event_*() family of 41functions. 42 43* Get rid of custom function return values 44 45Most functions use a custom set of return values, we should force proper Linux 46error numbers. Special care is needed for VCHIQ_RETRY. 47 48* Reformat core code with more sane indentations 49 50The code follows the 80 characters limitation yet tends to go 3 or 4 levels of 51indentation deep making it very unpleasant to read. This is specially relevant 52in the character driver ioctl code and in the core thread functions. 53 54* Get rid of all non essential global structures and create a proper per 55device structure 56 57The first thing one generally sees in a probe function is a memory allocation 58for all the device specific data. This structure is then passed all over the 59driver. This is good practice since it makes the driver work regardless of the 60number of devices probed. 61 62* Clean up Sparse warnings from __user annotations. See 63vchiq_irq_queue_bulk_tx_rx(). Ensure that the address of "&waiter->bulk_waiter" 64is never disclosed to userspace. 65 66* Fix behavior of message handling 67 68The polling behavior of vchiq_bulk_transmit(), vchiq_bulk_receive() and 69vchiq_queue_kernel_message() looks broken. A possible signal should be 70propagated back to user space to let the calling task handle it before 71retrying. Hopefully these msleep(1) shouldn't be necessary anymore. 72 73https://lore.kernel.org/linux-staging/CAK8P3a3HGm1cPo4sW9fOY4E8AN8yAq3tevXxU5m8bmtmsU8WKw@mail.gmail.com/ 74