Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Aug 2015 18:38:40 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r286786 - in head/sys: dev/xen/netfront xen
Message-ID:  <201508141838.t7EIceUl094102@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Aug 14 18:38:39 2015
New Revision: 286786
URL: https://svnweb.freebsd.org/changeset/base/286786

Log:
  Remove another remnant of PV domU support and assume that we always run
  with an automatically translated physmap under XEN.
  
  Reviewed by:	royger (earlier version)
  Differential Revision:	https://reviews.freebsd.org/D3325

Modified:
  head/sys/dev/xen/netfront/netfront.c
  head/sys/xen/gnttab.h

Modified: head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- head/sys/dev/xen/netfront/netfront.c	Fri Aug 14 18:01:40 2015	(r286785)
+++ head/sys/dev/xen/netfront/netfront.c	Fri Aug 14 18:38:39 2015	(r286786)
@@ -280,8 +280,6 @@ struct netfront_info {
 	struct callout	        xn_stat_ch;
 
 	u_long			rx_pfn_array[NET_RX_RING_SIZE];
-	multicall_entry_t	rx_mcl[NET_RX_RING_SIZE+1];
-	mmu_update_t		rx_mmu[NET_RX_RING_SIZE];
 	struct ifmedia		sc_media;
 
 	bool			xn_resume;
@@ -882,13 +880,6 @@ refill:
 			gnttab_grant_foreign_transfer_ref(ref,
 			    otherend_id, pfn);
 			sc->rx_pfn_array[nr_flips] = pfn;
-			if (!xen_feature(XENFEAT_auto_translated_physmap)) {
-				/* Remove this page before passing
-				 * back to Xen.
-				 */
-				MULTI_update_va_mapping(&sc->rx_mcl[i],
-				    vaddr, 0, 0);
-			}
 			nr_flips++;
 		} else {
 			gnttab_grant_foreign_access_ref(ref,
@@ -918,25 +909,6 @@ refill:
 		reservation.extent_order = 0;
 		reservation.address_bits = 0;
 		reservation.domid        = DOMID_SELF;
-
-		if (!xen_feature(XENFEAT_auto_translated_physmap)) {
-			/* After all PTEs have been zapped, flush the TLB. */
-			sc->rx_mcl[i-1].args[MULTI_UVMFLAGS_INDEX] =
-			    UVMF_TLB_FLUSH|UVMF_ALL;
-	
-			/* Give away a batch of pages. */
-			sc->rx_mcl[i].op = __HYPERVISOR_memory_op;
-			sc->rx_mcl[i].args[0] = XENMEM_decrease_reservation;
-			sc->rx_mcl[i].args[1] =  (u_long)&reservation;
-			/* Zap PTEs and give away pages in one big multicall. */
-			(void)HYPERVISOR_multicall(sc->rx_mcl, i+1);
-
-			if (__predict_false(sc->rx_mcl[i].result != i ||
-			    HYPERVISOR_memory_op(XENMEM_decrease_reservation,
-			    &reservation) != i))
-				panic("%s: unable to reduce memory "
-				    "reservation\n", __func__);
-		}
 	} else {
 		wmb();
 	}
@@ -961,7 +933,6 @@ xn_rxeof(struct netfront_info *np)
 	struct netif_rx_response *rx = &rinfo.rx;
 	struct netif_extra_info *extras = rinfo.extras;
 	RING_IDX i, rp;
-	multicall_entry_t *mcl;
 	struct mbuf *m;
 	struct mbufq rxq, errq;
 	int err, pages_flipped = 0, work_to_do;
@@ -1022,19 +993,6 @@ xn_rxeof(struct netfront_info *np)
 #ifdef notyet
 			balloon_update_driver_allowance(-pages_flipped);
 #endif
-			/* Do all the remapping work, and M->P updates, in one big
-			 * hypercall.
-			 */
-			if (!!xen_feature(XENFEAT_auto_translated_physmap)) {
-				mcl = np->rx_mcl + pages_flipped;
-				mcl->op = __HYPERVISOR_mmu_update;
-				mcl->args[0] = (u_long)np->rx_mmu;
-				mcl->args[1] = pages_flipped;
-				mcl->args[2] = 0;
-				mcl->args[3] = DOMID_SELF;
-				(void)HYPERVISOR_multicall(np->rx_mcl,
-				    pages_flipped + 1);
-			}
 		}
 	
 		mbufq_drain(&errq);
@@ -1273,8 +1231,6 @@ xennet_get_responses(struct netfront_inf
 	int *pages_flipped_p)
 {
 	int pages_flipped = *pages_flipped_p;
-	struct mmu_update *mmu;
-	struct multicall_entry *mcl;
 	struct netif_rx_response *rx = &rinfo->rx;
 	struct netif_extra_info *extras = rinfo->extras;
 	struct mbuf *m, *m0, *m_prev;
@@ -1346,22 +1302,6 @@ xennet_get_responses(struct netfront_inf
 				goto next;
 			}
 
-			if (!xen_feature( XENFEAT_auto_translated_physmap)) {
-				/* Remap the page. */
-				void *vaddr = mtod(m, void *);
-				uint32_t pfn;
-
-				mcl = np->rx_mcl + pages_flipped;
-				mmu = np->rx_mmu + pages_flipped;
-
-				MULTI_update_va_mapping(mcl, (u_long)vaddr,
-				    (((vm_paddr_t)mfn) << PAGE_SHIFT) | PG_RW |
-				    PG_V | PG_M | PG_A, 0);
-				pfn = (uintptr_t)m->m_ext.ext_arg1;
-				mmu->ptr = ((vm_paddr_t)mfn << PAGE_SHIFT) |
-				    MMU_MACHPHYS_UPDATE;
-				mmu->val = pfn;
-			}
 			pages_flipped++;
 		} else {
 			ret = gnttab_end_foreign_access_ref(ref);

Modified: head/sys/xen/gnttab.h
==============================================================================
--- head/sys/xen/gnttab.h	Fri Aug 14 18:01:40 2015	(r286785)
+++ head/sys/xen/gnttab.h	Fri Aug 14 18:38:39 2015	(r286786)
@@ -126,10 +126,8 @@ gnttab_set_map_op(struct gnttab_map_gran
 {
 	if (flags & GNTMAP_contains_pte)
 		map->host_addr = addr;
-	else if (xen_feature(XENFEAT_auto_translated_physmap))
-		map->host_addr = vtophys(addr);
 	else
-		map->host_addr = addr;
+		map->host_addr = vtophys(addr);
 
 	map->flags = flags;
 	map->ref = ref;
@@ -142,10 +140,8 @@ gnttab_set_unmap_op(struct gnttab_unmap_
 {
 	if (flags & GNTMAP_contains_pte)
 		unmap->host_addr = addr;
-	else if (xen_feature(XENFEAT_auto_translated_physmap))
-		unmap->host_addr = vtophys(addr);
 	else
-		unmap->host_addr = addr;
+		unmap->host_addr = vtophys(addr);
 
 	unmap->handle = handle;
 	unmap->dev_bus_addr = 0;
@@ -155,13 +151,8 @@ static inline void
 gnttab_set_replace_op(struct gnttab_unmap_and_replace *unmap, vm_paddr_t addr,
 		      vm_paddr_t new_addr, grant_handle_t handle)
 {
-	if (xen_feature(XENFEAT_auto_translated_physmap)) {
-		unmap->host_addr = vtophys(addr);
-		unmap->new_addr = vtophys(new_addr);
-	} else {
-		unmap->host_addr = addr;
-		unmap->new_addr = new_addr;
-	}
+	unmap->host_addr = vtophys(addr);
+	unmap->new_addr = vtophys(new_addr);
 
 	unmap->handle = handle;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508141838.t7EIceUl094102>