Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cef36a5 authored by Konrad Rzeszutek Wilk's avatar Konrad Rzeszutek Wilk
Browse files

xen/swiotlb: Move the nr_tbl determination in its own function.



Moving the function out of the way to prepare for the late
SWIOTLB init.

Acked-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 74838b75
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -144,25 +144,26 @@ xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
	} while (i < nslabs);
	} while (i < nslabs);
	return 0;
	return 0;
}
}
static unsigned long xen_set_nslabs(unsigned long nr_tbl)
{
	if (!nr_tbl) {
		xen_io_tlb_nslabs = (64 * 1024 * 1024 >> IO_TLB_SHIFT);
		xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, IO_TLB_SEGSIZE);
	} else
		xen_io_tlb_nslabs = nr_tbl;


	return xen_io_tlb_nslabs << IO_TLB_SHIFT;
}
void __init xen_swiotlb_init(int verbose)
void __init xen_swiotlb_init(int verbose)
{
{
	unsigned long bytes;
	unsigned long bytes;
	int rc = -ENOMEM;
	int rc = -ENOMEM;
	unsigned long nr_tbl;
	char *m = NULL;
	char *m = NULL;
	unsigned int repeat = 3;
	unsigned int repeat = 3;


	nr_tbl = swiotlb_nr_tbl();
	xen_io_tlb_nslabs = swiotlb_nr_tbl();
	if (nr_tbl)
		xen_io_tlb_nslabs = nr_tbl;
	else {
		xen_io_tlb_nslabs = (64 * 1024 * 1024 >> IO_TLB_SHIFT);
		xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, IO_TLB_SEGSIZE);
	}
retry:
retry:
	bytes = xen_io_tlb_nslabs << IO_TLB_SHIFT;
	bytes = xen_set_nslabs(xen_io_tlb_nslabs);

	/*
	/*
	 * Get IO TLB memory from any location.
	 * Get IO TLB memory from any location.
	 */
	 */