Re: [PATCH v7 2/5] USB: use genalloc for USB HCs with local memory

From: Greg KH
Date: Wed May 29 2019 - 07:27:03 EST


On Wed, May 29, 2019 at 11:15:54AM +0000, Laurentiu Tudor wrote:
>
>
> On 29.05.2019 13:38, Greg KH wrote:
> > On Wed, May 29, 2019 at 01:28:40PM +0300, laurentiu.tudor@xxxxxxx wrote:
> >> From: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>
> >>
> >> For HCs that have local memory, replace the current DMA API usage
> >> with a genalloc generic allocator to manage the mappings for these
> >> devices. To help users, introduce a new HCD API,
> >> usb_hcd_setup_local_mem() that will setup up the genalloc backing
> >> up the device local memory. It will be used in subsequent patches.
> >> This is in preparation for dropping the existing "coherent" dma
> >> mem declaration APIs. Current implementation was relying on a short
> >> circuit in the DMA API that in the end, was acting as an allocator
> >> for these type of devices.
> >> For sh arch to compile GENERIC_ALLOCATOR needs to be selected in
> >> Kconfig.
> >>
> >> For context, see thread here: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flkml.org%2Flkml%2F2019%2F4%2F22%2F357&amp;data=02%7C01%7Claurentiu.tudor%40nxp.com%7Cade28e1f322c4502cd4808d6e421d0ba%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636947231220264072&amp;sdata=xvmzDztMbeD9GwlcAfx7bBoxhARWgB3vmQkqiE81Lbg%3D&amp;reserved=0
> >>
> >> Signed-off-by: Laurentiu Tudor <laurentiu.tudor@xxxxxxx>
> >> Signed-off-by: Fredrik Noring <noring@xxxxxxxxxx>
> >> Tested-by: Fredrik Noring <noring@xxxxxxxxxx>
> >> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> >> ---
> >> drivers/usb/Kconfig | 1 +
> >> drivers/usb/core/buffer.c | 9 +++++++++
> >> drivers/usb/core/hcd.c | 36 ++++++++++++++++++++++++++++++++++++
> >> drivers/usb/host/ohci-hcd.c | 23 ++++++++++++++++++-----
> >> drivers/usb/host/ohci-mem.c | 35 +++++++++++++++++++++++++++++++----
> >> drivers/usb/host/ohci.h | 2 ++
> >> include/linux/usb/hcd.h | 5 +++++
> >> 7 files changed, 102 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
> >> index e4b27413f528..389c57d8eba7 100644
> >> --- a/drivers/usb/Kconfig
> >> +++ b/drivers/usb/Kconfig
> >> @@ -45,6 +45,7 @@ config USB_ARCH_HAS_HCD
> >> config USB
> >> tristate "Support for Host-side USB"
> >> depends on USB_ARCH_HAS_HCD
> >> + select GENERIC_ALLOCATOR
> >
> > Are there any arches that does not have GENERIC_ALLOCATOR? I don't want
> > to suddenly cut off a bunch of working systems from having USB support.
> >
>
> lkp report mentions only sh, but even if there are others, I think that
> now having the explicit select should cover them, right?

As long as GENERIC_ALLOCATOR works on all arches, yes, that's fine, but
please verify that this is the case.

thanks,

greg k-h