Re: [PATCH v2 6/7] misc: bcm-vk: add Broadcom VK driver

From: Scott Branden
Date: Fri Feb 21 2020 - 13:19:59 EST




On 2020-02-19 11:47 p.m., Greg Kroah-Hartman wrote:
On Wed, Feb 19, 2020 at 04:48:24PM -0800, Scott Branden wrote:
Add Broadcom VK driver offload engine.
This driver interfaces to the VK PCIe offload engine to perform
should offload functions as video transcoding on multiple streams
in parallel. VK device is booted from files loaded using
request_firmware_into_buf mechanism. After booted card status is updated
and messages can then be sent to the card.
Such messages contain scatter gather list of addresses
to pull data from the host to perform operations on.
Why is this a tty driver?
We have a tty driver here as there are (multiple) console interfaces to the card.
The only viable interface to the card is through the PCIe bus. We can't hook up cables to the card to get at the consoles.
As such we implemented a tty driver to access the console via a circular buffer in PCIe BAR space.

It is extremely useful. You get console access to virtual serial ports connected to each processor inside the VK SoC.
Future enhancement is to connect the tty driver to use an MSIX interrupt rather than polling.
Once that is done lrz/sz transfers will be much quicker. I'd also look at if I could use ser2net to get network access
for the processors on the VK SoC over this interface as well.

Have you worked with the V4L developers to tie this into the proper
in-kernel apis for this type of functionality?
We looked at the V4L model doesn't have any support for anything we are doing in this driver.
We also want a driver that doesn't care about video. It could be offloading crypto or other operations.
We talked with Olof about all of this previously and he said leave it as a misc driver for now.
He was going to discuss at linux plumbers conference that we need some sort of offload engine model that such devices could fit into.
Using a tty driver seems like the totally incorrect way to do this, what
am I missing?
tty driver is used to provide console access to the processors running on vk.
Data is sent using the bcm_vk_msg interface by read/write operations from user space.
VK then gets the messages and DMA's the data to/from host memory when needed to process.

Also, do not make up random error values, you return "-1" a lot here,
that is not ok. Please fix up to return the correct -Ewhatever values
instead.
OK.

thanks,

greg k-h