head	1.4;
access;
symbols
	netbsd-11-0-RELEASE:1.2
	netbsd-11-0-RC7:1.2
	netbsd-11-0-RC6:1.2
	netbsd-11-0-RC5:1.2
	netbsd-11-0-RC4:1.2
	netbsd-11-0-RC3:1.2
	netbsd-11-0-RC2:1.2
	netbsd-11-0-RC1:1.2
	perseant-exfatfs:1.2.0.4
	perseant-exfatfs-base-20250801:1.2
	netbsd-11:1.2.0.2
	netbsd-11-base:1.2;
locks; strict;
comment	@.\" @;


1.4
date	2026.08.29.19.32.12;	author andvar;	state dead;
branches;
next	1.3;
commitid	1Ix1Yb0NhPPJizTG;

1.3
date	2026.02.17.20.07.21;	author khorben;	state Exp;
branches;
next	1.2;
commitid	bDbax46eocTRGLuG;

1.2
date	2025.01.15.13.31.07;	author wiz;	state Exp;
branches
	1.2.4.1;
next	1.1;
commitid	gvsAiPSRxFpXiAFF;

1.1
date	2025.01.15.13.16.22;	author imil;	state Exp;
branches;
next	;
commitid	DrfRFjAynasFbAFF;

1.2.4.1
date	2025.01.15.13.31.07;	author perseant;	state dead;
branches;
next	1.2.4.2;
commitid	23j6GFaDws3O875G;

1.2.4.2
date	2025.08.02.05.55.13;	author perseant;	state Exp;
branches;
next	;
commitid	23j6GFaDws3O875G;


desc
@@


1.4
log
@remove virtio_mmio.4, which was combined with virtio(4).
@
text
@.\"	$NetBSD: virtio_mmio.4,v 1.3 2026/02/17 20:07:21 khorben Exp $
.\"
.\" Copyright (c) 2024 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 15, 2025
.Dt VIRTIO_MMIO 4
.Os
.Sh NAME
.Nm virtio_mmio
.Nd VirtIO over memory mapped device
.Sh SYNOPSIS
.Cd "pv* at pv?"
.Cd "virtio* at pv?"
.Pp
.Cd "acpi0 at mainbus0"
.Cd "virtio* at acpi?"
.Sh DESCRIPTION
.Nm
can be used in virtual environments without
.Xr pci 4
support
.Pq a common situation in embedded devices models
might use simple memory mapped device
.Pq Nm
instead of the
.Xr pci 4
device.
.Pp
The memory mapped
.Xr virtio 4
device behavior is based on the
.Xr pci 4
device specification.
Therefore most operations including device initialization,
queues configuration and buffer transfers are nearly identical.
.Pp
Unlike
.Xr pci 4 ,
.Nm
provides no generic device discovery mechanism.
For each device, the guest OS will
need to know the location of the registers and interrupt(s) used.
.Pp
Device location can be read from either
.Xr acpi 4
or via kernel command line parameters, implemented as a
.Xr pv 4
virtual device.
.Sh SEE ALSO
.Xr acpi 4 ,
.Xr pv 4 ,
.Xr virtio 4
.Pp
.Rs
.%T Virtual I/O Device (VIRTIO) Version 1.2
.%U https://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html
.Re
@


1.3
log
@share/man/man4: use the correct bus in pv(4) and virtio_mmio(4)

While there, also link to a acpi(4) and pv(4) from virtio_mmio(4).

"Good catch" iMil@@
@
text
@d1 1
a1 1
.\"	$NetBSD: virtio_mmio.4,v 1.2 2025/01/15 13:31:07 wiz Exp $
@


1.2
log
@virtio_mmio(4): cleanups
@
text
@d1 1
a1 1
.\"	$NetBSD: virtio_mmio.4,v 1.1 2025/01/15 13:16:22 imil Exp $
d34 1
a34 1
.Cd "pv* at pvbus?"
d72 2
@


1.2.4.1
log
@file virtio_mmio.4 was added on branch perseant-exfatfs on 2025-08-02 05:55:13 +0000
@
text
@d1 77
@


1.2.4.2
log
@Sync with HEAD
@
text
@a0 77
.\"	$NetBSD: virtio_mmio.4,v 1.2 2025/01/15 13:31:07 wiz Exp $
.\"
.\" Copyright (c) 2024 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 15, 2025
.Dt VIRTIO_MMIO 4
.Os
.Sh NAME
.Nm virtio_mmio
.Nd VirtIO over memory mapped device
.Sh SYNOPSIS
.Cd "pv* at pvbus?"
.Cd "virtio* at pv?"
.Pp
.Cd "acpi0 at mainbus0"
.Cd "virtio* at acpi?"
.Sh DESCRIPTION
.Nm
can be used in virtual environments without
.Xr pci 4
support
.Pq a common situation in embedded devices models
might use simple memory mapped device
.Pq Nm
instead of the
.Xr pci 4
device.
.Pp
The memory mapped
.Xr virtio 4
device behavior is based on the
.Xr pci 4
device specification.
Therefore most operations including device initialization,
queues configuration and buffer transfers are nearly identical.
.Pp
Unlike
.Xr pci 4 ,
.Nm
provides no generic device discovery mechanism.
For each device, the guest OS will
need to know the location of the registers and interrupt(s) used.
.Pp
Device location can be read from either
.Xr acpi 4
or via kernel command line parameters, implemented as a
.Xr pv 4
virtual device.
.Sh SEE ALSO
.Xr virtio 4
.Pp
.Rs
.%T Virtual I/O Device (VIRTIO) Version 1.2
.%U https://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html
.Re
@


1.1
log
@Add support for command line MMIO devices, at least qemu and
Firecracker pass MMIO virtual devices mapping through the kernel
command line.
This driver is based on Colin Percival's FreeBSD virtio_mmio_cmdline.c
https://github.com/freebsd/freebsd-src/blob/main/sys/dev/virtio/mmio/virtio_mmio_cmdline.c

The following kernel options are needed

options MPBIOS
options MPTABLE_LINUX_BUG_COMPAT

As are these drivers

pv* at pvbus?
virtio* at pv?

Exemple qemu usage on a Linux host to boot a NetBSD guest:

qemu-system-x86_64 \
       -M microvm,x-option-roms=off,rtc=on,acpi=off,pic=off,accel=kvm \
       -m 256 -cpu host -kernel ${KERNEL} \
       -append "root=ld0a console=com rw -v" \
       -device virtio-blk-device,drive=hd0 \
       -drive file=${IMG},format=raw,id=hd0 \
       -device virtio-net-device,netdev=net0 \
       -netdev user,id=net0,ipv6=off,hostfwd=::2200-:22 \
       -global virtio-mmio.force-legacy=false -display none -serial stdio

A lightweight kernel configuration named MICROVM if available for this
use case.
@
text
@d1 1
a1 1
.\"	$NetBSD$
d27 1
a27 1
.Dd January 2024
d29 1
a29 1
.Os NetBSD
d32 1
a32 1
.Nd VirtIO over memory mapped device.
d53 1
a53 1
device behaviour is based on the
d55 2
a56 1
device specification. Therefore most operations including device initialization,
d62 2
a63 1
provides no generic device discovery mechanism. For each device, the guest OS will
@

