From owner-svn-src-head@freebsd.org Tue Jul 21 14:25:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 089B335E316; Tue, 21 Jul 2020 14:25:37 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BB18w6Srxz3St6; Tue, 21 Jul 2020 14:25:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C18851F6D2; Tue, 21 Jul 2020 14:25:36 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06LEPaBZ011624; Tue, 21 Jul 2020 14:25:36 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06LEPaSR011623; Tue, 21 Jul 2020 14:25:36 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202007211425.06LEPaSR011623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 21 Jul 2020 14:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363390 - head/sys/dev/virtio/mmio X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/virtio/mmio X-SVN-Commit-Revision: 363390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2020 14:25:37 -0000 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);