Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jul 2019 19:16:02 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350364 - in head/sys/dev/virtio: mmio pci
Message-ID:  <201907261916.x6QJG297001816@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Fri Jul 26 19:16:02 2019
New Revision: 350364
URL: https://svnweb.freebsd.org/changeset/base/350364

Log:
  virtio: Fix running on machines with memory above 0xffffffff
  
  We want to allocate a contiguous memory block anywhere in memory, but
  expressed this as having to be between 0 and 0xffffffff. This limits us
  on 64-bit machines, and outright breaks on machines where memory is
  mapped above that address range.
  
  Allow the full address range to be used for this allocation.
  
  Sponsored by:	Axiado

Modified:
  head/sys/dev/virtio/mmio/virtio_mmio.c
  head/sys/dev/virtio/pci/virtio_pci.c

Modified: head/sys/dev/virtio/mmio/virtio_mmio.c
==============================================================================
--- head/sys/dev/virtio/mmio/virtio_mmio.c	Fri Jul 26 19:14:12 2019	(r350363)
+++ head/sys/dev/virtio/mmio/virtio_mmio.c	Fri Jul 26 19:16:02 2019	(r350364)
@@ -440,7 +440,7 @@ vtmmio_alloc_virtqueues(device_t dev, int flags, int n
 		size = vtmmio_read_config_4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX);
 
 		error = virtqueue_alloc(dev, idx, size,
-		    VIRTIO_MMIO_VRING_ALIGN, 0xFFFFFFFFUL, info, &vq);
+		    VIRTIO_MMIO_VRING_ALIGN, ~(vm_paddr_t)0, info, &vq);
 		if (error) {
 			device_printf(dev,
 			    "cannot allocate virtqueue %d: %d\n",

Modified: head/sys/dev/virtio/pci/virtio_pci.c
==============================================================================
--- head/sys/dev/virtio/pci/virtio_pci.c	Fri Jul 26 19:14:12 2019	(r350363)
+++ head/sys/dev/virtio/pci/virtio_pci.c	Fri Jul 26 19:16:02 2019	(r350364)
@@ -505,7 +505,7 @@ vtpci_alloc_virtqueues(device_t dev, int flags, int nv
 		size = vtpci_read_config_2(sc, VIRTIO_PCI_QUEUE_NUM);
 
 		error = virtqueue_alloc(dev, idx, size, VIRTIO_PCI_VRING_ALIGN,
-		    0xFFFFFFFFUL, info, &vq);
+		    ~(vm_paddr_t)0, info, &vq);
 		if (error) {
 			device_printf(dev,
 			    "cannot allocate virtqueue %d: %d\n", idx, error);



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