Page MenuHomeFreeBSD

bhyve: Drop volatile qualifiers from xhci hw struct fields
ClosedPublic

Authored by markj on Nov 6 2022, 7:36 PM.
Tags
None
Referenced Files
F97060650: D37290.diff
Fri, Sep 27, 3:25 PM
Unknown Object (File)
Sun, Sep 22, 5:23 PM
Unknown Object (File)
Wed, Sep 18, 7:20 PM
Unknown Object (File)
Tue, Sep 17, 4:38 PM
Unknown Object (File)
Tue, Sep 17, 7:47 AM
Unknown Object (File)
Tue, Sep 17, 4:12 AM
Unknown Object (File)
Mon, Sep 16, 10:44 PM
Unknown Object (File)
Aug 21 2024, 3:23 PM
Subscribers

Details

Summary

This fixes a warning raised by the removal of the volatile qualifier
from &trb->qwTrb0 in the following snippet:

xfer_block = usb_data_xfer_append(xfer,

	     (void *)(trbflags & XHCI_TRB_3_IDT_BIT ?
		 &trb->qwTrb0 : XHCI_GADDR(sc, trb->qwTrb0)),
	     trb->dwTrb2 & 0x1FFFF, (void *)addr, ccs);

The use of volatile appears to be inherited from the kernel driver's
definitions of the same structures. It makes some sense, since USB TRBs
and related structures live in guest memory, but bhyve device models
generally don't volatile-qualify accesses to guest memory and I can't
see how they are required for correctness here. Moreover, XHCI_GADDR
does not return volatile pointers so we're already being inconsistent.
So just drop the qualifiers to address the warning.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 48194
Build 45081: arc lint + arc unit