Commit 8e58006
swiotlb, hyperv: add dedicated swiotlb pool for Hyper-V VPCI devices
Add swiotlb_create_pool(), a new API that creates a standalone swiotlb
bounce buffer pool backed by a caller-specified physical memory region.
This is similar to CONFIG_DMA_RESTRICTED_POOL but does not require
Device Tree or OF support.
Use this in the Hyper-V PCI frontend driver (pci-hyperv) to allow
dedicating a specific RAM region for streaming DMA bounce buffering of
all VPCI devices. This is useful when VPCI devices can only DMA via a
specific portion of guest RAM determined at boot time.
The pool is configured via the hv_pci module parameter 'swiotlb', and
the corresponding memory must be reserved so the kernel does not use it
for general allocations. This is done with a command line parameter as
shown in the example below. The 'swiotlb=force' is added to enable the
use of swiotlb.
Sample kernel command line:
swiotlb=force hv_pci_swiotlb=0x100000000,64M
This reserves 64MB at the 4GB mark and directs the Hyper-V PCI driver
to create a swiotlb pool there. All VPCI devices will then bounce
their streaming DMA through that region. Coherent DMA allocations
(dma_alloc_coherent) are not affected and continue to use normal memory.1 parent 7d0a66e commit 8e58006
3 files changed
Lines changed: 116 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
468 | 470 | | |
469 | 471 | | |
470 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
471 | 489 | | |
472 | 490 | | |
473 | 491 | | |
| |||
2502 | 2520 | | |
2503 | 2521 | | |
2504 | 2522 | | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
2505 | 2542 | | |
2506 | 2543 | | |
2507 | 2544 | | |
| |||
2525 | 2562 | | |
2526 | 2563 | | |
2527 | 2564 | | |
| 2565 | + | |
2528 | 2566 | | |
2529 | 2567 | | |
2530 | 2568 | | |
| |||
2795 | 2833 | | |
2796 | 2834 | | |
2797 | 2835 | | |
| 2836 | + | |
2798 | 2837 | | |
2799 | 2838 | | |
2800 | 2839 | | |
| |||
4213 | 4252 | | |
4214 | 4253 | | |
4215 | 4254 | | |
| 4255 | + | |
| 4256 | + | |
| 4257 | + | |
| 4258 | + | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
| 4262 | + | |
| 4263 | + | |
| 4264 | + | |
| 4265 | + | |
4216 | 4266 | | |
4217 | 4267 | | |
4218 | 4268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1881 | 1881 | | |
1882 | 1882 | | |
1883 | 1883 | | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
0 commit comments