frno7 / linux

Linux 2.2, 2.6, 3.x, 4.x and 5.x kernels for the PlayStation 2.
Other
86 stars 5 forks source link

Transfer USB OHCI data via subsystem interface (SIF) DMA #17

Open frno7 opened 5 years ago

frno7 commented 5 years ago

USB OHCI bounce buffers are currently allocated in input/output processor (IOP) local memory. This simple approach supports basic USB devices such as keyboards, but there are two severe drawbacks:

  1. IOP local memory is limited to 2 MiB, of which only 256 KiB is available for all connected USB device drivers in total. See the implementation details in commit e85d1709bbe554ccf48eb5ae94c3d2ff6b9db7cc. Many complex USB device drivers need much larger buffers to operate. For example, commit 0b3a20caae720fc746cda7420f1a226074f17b56 reduces the memory requirements for wireless rt2x00 devices. In addition, mass storage device drivers may busy-loop waiting for buffer memory to become available. This is inefficient and a potential deadlock.

  2. Bounce buffers for USB OHCI data is very slow, and relies on misuse of kernel interfaces. The drivers drivers/usb/host/ohci-sm501.c and drivers/usb/host/ohci-tmio.c seem to do this too, and they appear to be unmaintained.

Is it possible to transfer USB OHCI data via subsystem interface (SIF) DMA, for main memory buffers?

See also #2 and #11.

sp193 commented 5 years ago

As I wrote in the other thread, there is no documentation for such a function by the hardware. Otherwise everything would have been easier and better, even for Sony.

Even if it does exist, nobody knows how to use it. So the best alternative at this point, is to plan how you will use the IOP's resources and to write the necessary code.

frno7 commented 5 years ago

This topic certainly requires some research, especially regarding the capabilities of the IOP. I hope we can design things better than Sony ever did, and honestly that is a rather fun part of this project, but I also recognise that it will not be particularly easy. I also think that sharing resources such as IRX modules with PS2SDK is very valuable, whenever it makes sense.

My personal focus at the moment is to prepare #1 along with the necessary tooling and documentation. The MIPS architecture in general is no longer maintained at the level it once was, which is unfortunate, but nevertheless I think it is good to have a set of solid PlayStation 2 Linux kernel base patches.