This patch adds a helper function whether a queue can merge the segments by the DMA MAP layer (e.g. via IOMMU).
Unified · Split
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/lcm.h> | 12 | #include <linux/lcm.h> |
| 13 | #include <linux/jiffies.h> | 13 | #include <linux/jiffies.h> |
| 14 | #include <linux/gfp.h> | 14 | #include <linux/gfp.h> |
| 15 | #include <linux/dma-mapping.h> | ||
| 15 | 16 | ||
| 16 | #include "blk.h" | 17 | #include "blk.h" |
| 17 | #include "blk-wbt.h" | 18 | #include "blk-wbt.h" |
| @@ -832,6 +833,28 @@ void blk_queue_write_cache(struct request_queue *q, bool wc, bool fua) · 814 unmodified lines | |||
| 832 | } | 833 | } |
| 833 | EXPORT_SYMBOL_GPL(blk_queue_write_cache); | 834 | EXPORT_SYMBOL_GPL(blk_queue_write_cache); |
| 834 | 835 | ||
| 836 | /** | ||
| 837 | * blk_queue_can_use_dma_map_merging - configure queue for merging segments. | ||
| 838 | * @q: the request queue for the device | ||
| 839 | * @dev: the device pointer for dma | ||
| 840 | * | ||
| 841 | * Tell the block layer about merging the segments by dma map of @q. | ||
| 842 | */ | ||
| 843 | bool blk_queue_can_use_dma_map_merging(struct request_queue *q, | ||
| 844 | struct device *dev) | ||
| 845 | { | ||
| 846 | unsigned long boundary = dma_get_merge_boundary(dev); | ||
| 847 | |||
| 848 | if (!boundary) | ||
| 849 | return false; | ||
| 850 | |||
| 851 | /* No need to update max_segment_size. see blk_queue_virt_boundary() */ | ||
| 852 | blk_queue_virt_boundary(q, boundary); | ||
| 853 | |||
| 854 | return true; | ||
| 855 | } | ||
| 856 | EXPORT_SYMBOL_GPL(blk_queue_can_use_dma_map_merging); | ||
| 857 | |||
| 835 | static int __init blk_settings_init(void) | 858 | static int __init blk_settings_init(void) |
| 836 | { | 859 | { |
| 837 | blk_max_low_pfn = max_low_pfn - 1; | 860 | blk_max_low_pfn = max_low_pfn - 1; |
| @@ -1085,6 +1085,8 @@ extern void blk_queue_dma_alignment(struct request_queue *, int); · 1084 unmodified lines | |||
| 1085 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); | 1085 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); |
| 1086 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); | 1086 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); |
| 1087 | extern void blk_queue_write_cache(struct request_queue *q, bool enabled, bool fua); | 1087 | extern void blk_queue_write_cache(struct request_queue *q, bool enabled, bool fua); |
| 1088 | extern bool blk_queue_can_use_dma_map_merging(struct request_queue *q, | ||
| 1089 | struct device *dev); | ||
| 1088 | 1090 | ||
| 1089 | /* | 1091 | /* |
| 1090 | * Number of physical segments as sent to the device. | 1092 | * Number of physical segments as sent to the device. |