Commit f44e58bb authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-linus-5.13b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:

 - two patches for error path fixes

 - a small series for fixing a regression with swiotlb with Xen on Arm

* tag 'for-linus-5.13b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen/swiotlb: check if the swiotlb has already been initialized
  arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required
  xen/arm: move xen_swiotlb_detect to arm/swiotlb-xen.h
  xen/unpopulated-alloc: fix error return code in fill_list()
  xen/gntdev: fix gntdev_mmap() error exit path
parents ccb013c2 97729b65
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -135,24 +135,18 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
	return;
}

int xen_swiotlb_detect(void)
{
	if (!xen_domain())
		return 0;
	if (xen_feature(XENFEAT_direct_mapped))
		return 1;
	/* legacy case */
	if (!xen_feature(XENFEAT_not_direct_mapped) && xen_initial_domain())
		return 1;
	return 0;
}

static int __init xen_mm_init(void)
{
	struct gnttab_cache_flush cflush;
	int rc;

	if (!xen_swiotlb_detect())
		return 0;
	xen_swiotlb_init();

	rc = xen_swiotlb_init();
	/* we can work with the default swiotlb */
	if (rc < 0 && rc != -EEXIST)
		return rc;

	cflush.op = 0;
	cflush.a.dev_bus_addr = 0;
+2 −1
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include <linux/sizes.h>
#include <asm/tlb.h>
#include <asm/alternative.h>
#include <asm/xen/swiotlb-xen.h>

/*
 * We need to be able to catch inadvertent references to memstart_addr
@@ -482,7 +483,7 @@ void __init mem_init(void)
	if (swiotlb_force == SWIOTLB_FORCE ||
	    max_pfn > PFN_DOWN(arm64_dma_phys_limit))
		swiotlb_init(1);
	else
	else if (!xen_swiotlb_detect())
		swiotlb_force = SWIOTLB_NO_FORCE;

	set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
+3 −1
Original line number Diff line number Diff line
@@ -1017,9 +1017,11 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
		err = mmu_interval_notifier_insert_locked(
			&map->notifier, vma->vm_mm, vma->vm_start,
			vma->vm_end - vma->vm_start, &gntdev_mmu_ops);
		if (err)
		if (err) {
			map->vma = NULL;
			goto out_unlock_put;
		}
	}
	mutex_unlock(&priv->lock);

	if (use_ptemod) {
+5 −0
Original line number Diff line number Diff line
@@ -164,6 +164,11 @@ int __ref xen_swiotlb_init(void)
	int rc = -ENOMEM;
	char *start;

	if (io_tlb_default_mem != NULL) {
		pr_warn("swiotlb buffer already initialized\n");
		return -EEXIST;
	}

retry:
	m_ret = XEN_SWIOTLB_ENOMEM;
	order = get_order(bytes);
+3 −1
Original line number Diff line number Diff line
@@ -39,8 +39,10 @@ static int fill_list(unsigned int nr_pages)
	}

	pgmap = kzalloc(sizeof(*pgmap), GFP_KERNEL);
	if (!pgmap)
	if (!pgmap) {
		ret = -ENOMEM;
		goto err_pgmap;
	}

	pgmap->type = MEMORY_DEVICE_GENERIC;
	pgmap->range = (struct range) {
Loading