Actually, reading the specification a little more, the only fields which are documented as being smaller than 4-bytes are CAPLENGTH (1-byte) and HCIVERSION (2-bytes).
So maybe change impl.min_access_size to 1 and rely on the fact that traditionally callers haven't read less than 4-bytes for any of the 4-byte fields... Cameron Esfahani di...@apple.com "In the elder days of Art, Builders wrought with greatest care each minute and unseen part; For the gods see everywhere." "The Builders", H. W. Longfellow > On Mar 31, 2020, at 2:57 AM, Cameron Esfahani via <qemu-devel@nongnu.org> > wrote: > > Philippe - > From what I've seen, access size has nothing to do with alignment. > > What the code in access_with_adjusted_size() will do is make sure that "size" > is >= min_access_size and <= max_access_size. > > So reading 2-bytes from address 2 turns into reading 4-bytes from address 2: > xhci_cap_read() is called with reg 2, size 4. > > But, due to the fact our change to support reg 2 only returns back 2-bytes, > and how the loops work in access_with_adjusted_size(), we only call > xhci_cap_read() once. > > It seems like we should also change impl.min_access_size for xhci_cap_ops to > be 2. > > But, after that, to support people doing strange things like reading > traditionally 4-byte values as 2 2-byte values, we probably need to change > xhci_cap_read() to handle every memory range in steps of 2-bytes. > > But I'll defer to Gerd on this... >