Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 2020 14:25:36 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363390 - head/sys/dev/virtio/mmio
Message-ID:  <202007211425.06LEPaSR011623@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Tue Jul 21 14:25:36 2020
New Revision: 363390
URL: https://svnweb.freebsd.org/changeset/base/363390

Log:
  Only write to VIRTIO_MMIO_GUEST_PAGE_SIZE with virtio mmio version 1
  
  This register is only defined for the legacy v1 interface so only write
  to it when interacting with a legacy device.
  
  Sponsored by:	Innovate UK

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

Modified: head/sys/dev/virtio/mmio/virtio_mmio.c
==============================================================================
--- head/sys/dev/virtio/mmio/virtio_mmio.c	Tue Jul 21 14:17:35 2020	(r363389)
+++ head/sys/dev/virtio/mmio/virtio_mmio.c	Tue Jul 21 14:25:36 2020	(r363390)
@@ -491,8 +491,10 @@ vtmmio_alloc_virtqueues(device_t dev, int flags, int n
 	if (sc->vtmmio_vqs == NULL)
 		return (ENOMEM);
 
-	vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_PAGE_SIZE,
-	    (1 << PAGE_SHIFT));
+	if (sc->vtmmio_version == 1) {
+		vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_PAGE_SIZE,
+		    (1 << PAGE_SHIFT));
+	}
 
 	for (idx = 0; idx < nvqs; idx++) {
 		vqx = &sc->vtmmio_vqs[idx];
@@ -564,8 +566,10 @@ vtmmio_reinit(device_t dev, uint64_t features)
 
 	vtmmio_negotiate_features(dev, features);
 
-	vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_PAGE_SIZE,
-	    (1 << PAGE_SHIFT));
+	if (sc->vtmmio_version == 1) {
+		vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_PAGE_SIZE,
+		    (1 << PAGE_SHIFT));
+	}
 
 	for (idx = 0; idx < sc->vtmmio_nvqs; idx++) {
 		error = vtmmio_reinit_virtqueue(sc, idx);



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