Changes:
sys/dev/xen/blkfront/block.h:
- Removed xbd_command's cm_gref_head because it is not needed anymore to
allocate grant refs.
- Changed cm_indirectionrefs from array to pointer to array. The grant
references are allocated in cm_indirectionmap, and it should
point to there. Keeping two copies is a waste of memory.
- Added an entry in xbd_command for the dma map used to map grant refs
to the indirection pages.
sys/dev/xen/blkfront/blkfront.c:
- Updated the xbd_command indirection pages to use the Xen-specific dma
implementation.
- Introduced xbd_indirectpage_cb(), which is the callback recieved from
the dma load.
- Updated xbd_mksegarray() to use the xen-specific busdma
implementation.
- The grant references are no longer allocated by xbd_mksegarray().
They are allocated by the dma load, and xbd_mksegarray() simply uses
them.
- Removed xbd_command's cm_gref_head. It is no longer needed because the
allocation of grant refs now happens through the busdma interface.
- Removed grant allocation from xbd_bio_command() and xbd_dump(). When
the load is called, the refs will get allocated.
- Removed gnttab_end_foreign_access_references() from xbd_int(). The map
unload will take care of that.
Reasoning:
- xbd_queue_cb() and xbd_mksegarray() do what the new busdma
implementation does: load pages then grant foreign access to those
pages. So, all that was needed here was to remove the granting of
foreign access.
- The other area changed is the indirection pages. This is
straightforward. The pages are loaded, and then the corresponding grant
references are extracted and saved in an array for later use.
This driver uses the Xen-specific bus_dma(9) implementation. It is
located in sys/xen/busdma_xen.h and sys/x86/xen/busdma_xen.c