The feature mask no_huge_pages, enabled for Xen due to
DMA address alignment issues with huge pages, did not apply
to allocation of CQs, RQs, and SQs, only to the tableworks.
This causes allocation of queues of these types
larger than 4M in total size to fail on Xen PV domains
such as dom0.
Orabug:
24683830
Signed-off-by: Knut Omang <knut.omang@oracle.com>
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
if (alloc_sz <= SIF_MAX_CONT)
cq->mem = sif_mem_create_dmacont(sdev, alloc_sz, GFP_KERNEL | __GFP_ZERO, DMA_BIDIRECTIONAL);
- else
+ else {
+ enum sif_mem_type memtype = sif_feature(no_huge_pages) ? SIFMT_4K : SIFMT_2M;
+
cq->mem = sif_mem_create(sdev, alloc_sz >> PMD_SHIFT,
- alloc_sz, SIFMT_2M, GFP_KERNEL | __GFP_ZERO, DMA_BIDIRECTIONAL);
+ alloc_sz, memtype, GFP_KERNEL | __GFP_ZERO, DMA_BIDIRECTIONAL);
+ }
if (!cq->mem) {
sif_log(sdev, SIF_INFO, "Failed to allocate %d CQ entries", entries);
ecq = ERR_PTR(-ENOMEM);
if (alloc_sz <= SIF_MAX_CONT)
rq->mem = sif_mem_create_dmacont(sdev, alloc_sz, GFP_KERNEL | __GFP_ZERO, DMA_BIDIRECTIONAL);
- else
+ else {
+ enum sif_mem_type memtype = sif_feature(no_huge_pages) ? SIFMT_4K : SIFMT_2M;
+
rq->mem = sif_mem_create(sdev, alloc_sz >> PMD_SHIFT,
- alloc_sz, SIFMT_2M, GFP_KERNEL | __GFP_ZERO, DMA_BIDIRECTIONAL);
+ alloc_sz, memtype, GFP_KERNEL | __GFP_ZERO, DMA_BIDIRECTIONAL);
+ }
if (!rq->mem) {
sif_log(sdev, SIF_INFO, "Failed RQ buffer pool allocation!");
ret = -ENOMEM;
if (alloc_sz <= SIF_MAX_CONT)
sq->mem = sif_mem_create_dmacont(sdev, alloc_sz, GFP_KERNEL, DMA_BIDIRECTIONAL);
else {
+ enum sif_mem_type memtype = sif_feature(no_huge_pages) ? SIFMT_4K : SIFMT_2M;
+
alloc_sz = (alloc_sz + ~PMD_MASK) & PMD_MASK;
sq->mem = sif_mem_create(sdev, alloc_sz >> PMD_SHIFT,
- alloc_sz, SIFMT_2M, GFP_KERNEL | __GFP_ZERO,
+ alloc_sz, memtype, GFP_KERNEL | __GFP_ZERO,
DMA_BIDIRECTIONAL);
}
if (!sq->mem) {