Hi Greg,
On 1/28/24 02:50, Greg KH wrote:
On Sun, Nov 05, 2023 at 07:20:47PM +0100, Milan Broz wrote:
The USB mass storage quirks flags can be stored in driver_info in
a 32-bit integer (unsigned long on 32-bit platforms).
As this attribute cannot be enlarged, we need to use some form
of translation of 64-bit quirk bits.
This problem was discussed on the USB list
https://lore.kernel.org/linux-usb/f9e8acb5-32d5-4a30-859f-d4336a86b31a@xxxxxxxxx/
The initial solution to use a static array extensively increased the size
of the kernel module, so I decided to try the second suggested solution:
generate a table by host-compiled program and use bit 31 to indicate
that the value is an index, not the actual value.
This patch adds a host-compiled program that processes unusual_devs.h
(and unusual_uas.h) and generates files usb-ids.c and usb-ids-uas.c
(for pre-processed USB device table with 32-bit device info).
These files also contain a generated translation table for driver_info
to 64-bit values.
The translation function is used only in usb-storage and uas modules; all
other USB storage modules store flags directly, using only 32-bit flags.
For 64-bit platforms, where unsigned long is 64-bit, we do not need to
convert quirk flags to 32-bit index; the translation function there uses
flags directly.
Signed-off-by: Milan Broz <gmazyland@xxxxxxxxx>
I see the need for this, but why now? We haven't run out of ids yet
have we? Do we need to add another one?
I had a patchset that needed a new flag; that was the motivation.
However, after a discussion with SCSI people, it needed to be done differently,
and I had no time to rewrite it yet.
In the meantime, the flag transition patch was split from the series.
If you want to merge it now, I can easily rebase & fix gitignore issue.
Or it can wait for the next first real user.
Just I have spent a lot of time with this, so no need to repeat this exercise, though :-)
Thanks,
Milan
Also, after building, I get the following files marked by git as needed
to be added to the tree, so perhaps you also need a .gitignore file:
$ git status
On branch work-testing
Untracked files:
(use "git add <file>..." to include in what will be committed)
drivers/usb/storage/mkflags
drivers/usb/storage/usb-ids-uas.c
drivers/usb/storage/usb-ids.c
thanks,
greg k-h