In gve_verify_driver_compatibility(), the driver populates the
gve_driver_info buffer for the device to read. Sync this buffer with
BUS_DMASYNC_PREWRITE instead of BUS_DMASYNC_PREREAD before issuing
the command.
In gve_adminq_describe_device(), the device populates the
gve_device_descriptor buffer for the driver to read. Sync this buffer
with BUS_DMASYNC_PREREAD instead of BUS_DMASYNC_PREWRITE before
issuing the command.
In gve_adminq_get_ptype_map_dqo(), the device populates the
gve_ptype_map buffer for the driver to read. Add the missing
BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTREAD syncs around the
command.
In normal GCP environments this did not cause a functional failure
because the underlying platforms are DMA cache-coherent and
bus_dmamap_sync() inside gve_adminq_issue_cmd() still provided a
memory barrier before ringing the AdminQ doorbell. However, if bounce
buffers are used, the wrong or missing sync directions would cause the
OS to skip copying between the driver buffer and the bounce buffer in
the expected direction.
Fixes: 54dfc97b0bd9 ("Add gve, the driver for Google Virtual NIC (gVNIC)")
Fixes: d438b4ef0cfc ("gve: Add DQO RDA support")
Reviewed-by: Jasper Tran O'Leary <jtranoleary@google.com>
Signed-off-by: Tim Hostetler <thostet@google.com>