From owner-svn-src-head@freebsd.org Fri Jul 3 14:13:17 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E25929948A3; Fri, 3 Jul 2015 14:13:17 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9A9C2777; Fri, 3 Jul 2015 14:13:17 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t63EDHdZ039050; Fri, 3 Jul 2015 14:13:17 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t63EDH4S039047; Fri, 3 Jul 2015 14:13:17 GMT (envelope-from br@FreeBSD.org) Message-Id: <201507031413.t63EDH4S039047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 3 Jul 2015 14:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285091 - head/sys/dev/virtio/mmio X-SVN-Group: head 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.20 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: Fri, 03 Jul 2015 14:13:18 -0000 Author: br Date: Fri Jul 3 14:13:16 2015 New Revision: 285091 URL: https://svnweb.freebsd.org/changeset/base/285091 Log: Add 'prewrite' method allowing us to run some platform-specific code before each write happens, e.g. write-back caches. This will help booting in Bluespec simulator of CHERI processor. Modified: head/sys/dev/virtio/mmio/virtio_mmio.c head/sys/dev/virtio/mmio/virtio_mmio_if.m Modified: head/sys/dev/virtio/mmio/virtio_mmio.c ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio.c Fri Jul 3 14:11:01 2015 (r285090) +++ head/sys/dev/virtio/mmio/virtio_mmio.c Fri Jul 3 14:13:16 2015 (r285091) @@ -138,18 +138,24 @@ static void vtmmio_vq_intr(void *); */ #define vtmmio_write_config_1(sc, o, v) \ do { \ + if (sc->platform != NULL) \ + VIRTIO_MMIO_PREWRITE(sc->platform, (o), (v)); \ bus_write_1((sc)->res[0], (o), (v)); \ if (sc->platform != NULL) \ VIRTIO_MMIO_NOTE(sc->platform, (o), (v)); \ } while (0) #define vtmmio_write_config_2(sc, o, v) \ do { \ + if (sc->platform != NULL) \ + VIRTIO_MMIO_PREWRITE(sc->platform, (o), (v)); \ bus_write_2((sc)->res[0], (o), (v)); \ if (sc->platform != NULL) \ VIRTIO_MMIO_NOTE(sc->platform, (o), (v)); \ } while (0) #define vtmmio_write_config_4(sc, o, v) \ do { \ + if (sc->platform != NULL) \ + VIRTIO_MMIO_PREWRITE(sc->platform, (o), (v)); \ bus_write_4((sc)->res[0], (o), (v)); \ if (sc->platform != NULL) \ VIRTIO_MMIO_NOTE(sc->platform, (o), (v)); \ Modified: head/sys/dev/virtio/mmio/virtio_mmio_if.m ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio_if.m Fri Jul 3 14:11:01 2015 (r285090) +++ head/sys/dev/virtio/mmio/virtio_mmio_if.m Fri Jul 3 14:13:16 2015 (r285091) @@ -42,6 +42,13 @@ INTERFACE virtio_mmio; CODE { static int + virtio_mmio_prewrite(device_t dev, size_t offset, int val) + { + + return (1); + } + + static int virtio_mmio_note(device_t dev, size_t offset, int val) { @@ -58,6 +65,15 @@ CODE { }; # +# Inform backend we are going to write data at offset. +# +METHOD int prewrite { + device_t dev; + size_t offset; + int val; +} DEFAULT virtio_mmio_prewrite; + +# # Inform backend we have data wrotten to offset. # METHOD int note {