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

Commit 06d38148 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'stable/vmalloc-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen

* 'stable/vmalloc-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  net: xen-netback: use API provided by xenbus module to map rings
  block: xen-blkback: use API provided by xenbus module to map rings
  xen: use generic functions instead of xen_{alloc, free}_vm_area()
parents 5d5a8d2d c9d63699
Loading
Loading
Loading
Loading
+0 −29
Original line number Diff line number Diff line
/******************************************************************************
 * arch/ia64/include/asm/xen/grant_table.h
 *
 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
 *                    VA Linux Systems Japan K.K.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ifndef _ASM_IA64_XEN_GRANT_TABLE_H
#define _ASM_IA64_XEN_GRANT_TABLE_H

struct vm_struct *xen_alloc_vm_area(unsigned long size);
void xen_free_vm_area(struct vm_struct *area);

#endif /* _ASM_IA64_XEN_GRANT_TABLE_H */
+0 −62
Original line number Diff line number Diff line
@@ -31,68 +31,6 @@

#include <asm/xen/hypervisor.h>

struct vm_struct *xen_alloc_vm_area(unsigned long size)
{
	int order;
	unsigned long virt;
	unsigned long nr_pages;
	struct vm_struct *area;

	order = get_order(size);
	virt = __get_free_pages(GFP_KERNEL, order);
	if (virt == 0)
		goto err0;
	nr_pages = 1 << order;
	scrub_pages(virt, nr_pages);

	area = kmalloc(sizeof(*area), GFP_KERNEL);
	if (area == NULL)
		goto err1;

	area->flags = VM_IOREMAP;
	area->addr = (void *)virt;
	area->size = size;
	area->pages = NULL;
	area->nr_pages = nr_pages;
	area->phys_addr = 0;	/* xenbus_map_ring_valloc uses this field!  */

	return area;

err1:
	free_pages(virt, order);
err0:
	return NULL;
}
EXPORT_SYMBOL_GPL(xen_alloc_vm_area);

void xen_free_vm_area(struct vm_struct *area)
{
	unsigned int order = get_order(area->size);
	unsigned long i;
	unsigned long phys_addr = __pa(area->addr);

	/* This area is used for foreign page mappping.
	 * So underlying machine page may not be assigned. */
	for (i = 0; i < (1 << order); i++) {
		unsigned long ret;
		unsigned long gpfn = (phys_addr >> PAGE_SHIFT) + i;
		struct xen_memory_reservation reservation = {
			.nr_extents   = 1,
			.address_bits = 0,
			.extent_order = 0,
			.domid        = DOMID_SELF
		};
		set_xen_guest_handle(reservation.extent_start, &gpfn);
		ret = HYPERVISOR_memory_op(XENMEM_populate_physmap,
					   &reservation);
		BUG_ON(ret != 1);
	}
	free_pages((unsigned long)area->addr, order);
	kfree(area);
}
EXPORT_SYMBOL_GPL(xen_free_vm_area);


/****************************************************************************
 * grant table hack
 * cmd: GNTTABOP_xxx
+0 −7
Original line number Diff line number Diff line
#ifndef _ASM_X86_XEN_GRANT_TABLE_H
#define _ASM_X86_XEN_GRANT_TABLE_H

#define xen_alloc_vm_area(size)	alloc_vm_area(size)
#define xen_free_vm_area(area)	free_vm_area(area)

#endif /* _ASM_X86_XEN_GRANT_TABLE_H */
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,

	if (shared == NULL) {
		struct vm_struct *area =
			xen_alloc_vm_area(PAGE_SIZE * max_nr_gframes);
			alloc_vm_area(PAGE_SIZE * max_nr_gframes);
		BUG_ON(area == NULL);
		shared = area->addr;
		*__shared = shared;
+1 −4
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ struct xen_blkif {
	enum blkif_protocol	blk_protocol;
	enum blkif_backend_type blk_backend_type;
	union blkif_back_rings	blk_rings;
	struct vm_struct	*blk_ring_area;
	void			*blk_ring;
	/* The VBD attached to this interface. */
	struct xen_vbd		vbd;
	/* Back pointer to the backend_info. */
@@ -198,9 +198,6 @@ struct xen_blkif {
	int			st_wr_sect;

	wait_queue_head_t	waiting_to_free;

	grant_handle_t		shmem_handle;
	grant_ref_t		shmem_ref;
};


Loading