Page MenuHomeFreeBSD

Updated the blkfront driver to use the Xen-specific dma implementation
Needs ReviewPublic

Authored by pratyush on Dec 14 2018, 1:26 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 24, 1:06 AM
Unknown Object (File)
Dec 23 2023, 9:04 AM
Unknown Object (File)
Dec 10 2023, 9:11 PM
Unknown Object (File)
Nov 8 2023, 11:52 PM
Unknown Object (File)
Sep 3 2023, 7:33 AM
Unknown Object (File)
Aug 11 2023, 7:27 PM
Unknown Object (File)
Jun 26 2023, 11:07 PM
Unknown Object (File)
Jun 15 2023, 7:08 PM
Subscribers

Details

Reviewers
royger
Summary

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

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Fixed xbd_max_request_segments being incorrectly set to 0

When the allocation of indirection pages fails, we should set xbd_max_reqeust_indirectpages to 0 but I was incorrectly setting xbd_max_request_segments as 0.