From c29681395ae2eff075f9c286ff5c6696a9df9453 Mon Sep 17 00:00:00 2001 From: "Lijian.Zhang" Date: Wed, 21 Aug 2019 17:51:16 +0800 Subject: tap: fix tap interface not working on Arm issue The VPP code tries to set all userspace memory in the table via IOCTL to VHOST_SET_MEM_TABLE. But on aarch64, the userspace address range is larger (48 bits) than that on x86 (47 bits). Below is an segment from /proc/[vpp]/maps. fffb41200000-fffb43a00000 rw-s 00000000 00:0e 532232 /anon_hugepage (deleted) Instead of setting all userspace memory space to vhost-net, will only set the address space reserved by pmalloc module during initialization. Type: fix Change-Id: I91cb35e990869b42094cf2cd0512593733d33677 Signed-off-by: Lijian Zhang Reviewed-by: Steve Capper (cherry picked from commit ba0da570f264785f6b50eff7829f6653c0924069) --- src/vnet/devices/tap/tap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/vnet/devices/tap/tap.c') diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index c2e2d754993..f2903a95adc 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -80,6 +81,7 @@ open_netns_fd (char *netns) void tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) { + vlib_physmem_main_t *vpm = &vm->physmem_main; vnet_main_t *vnm = vnet_get_main (); virtio_main_t *vim = &virtio_main; tap_main_t *tm = &tap_main; @@ -358,7 +360,10 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) vhost_mem = clib_mem_alloc (i); clib_memset (vhost_mem, 0, i); vhost_mem->nregions = 1; - vhost_mem->regions[0].memory_size = (1ULL << 47) - 4096; + vhost_mem->regions[0].memory_size = vpm->max_size; + vhost_mem->regions[0].guest_phys_addr = vpm->base_addr; + vhost_mem->regions[0].userspace_addr = + vhost_mem->regions[0].guest_phys_addr; _IOCTL (vif->fd, VHOST_SET_MEM_TABLE, vhost_mem); if ((args->error = -- cgit 1.2.3-korg