NetBSD Problem Report #56390

From kawamoto@white.tenjin.org  Mon Sep  6 09:08:15 2021
Return-Path: <kawamoto@white.tenjin.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id AD2001A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  6 Sep 2021 09:08:15 +0000 (UTC)
Message-Id: <20210906090809.D5CF272085A@white.tenjin.org>
Date: Mon,  6 Sep 2021 09:08:09 +0000 (UTC)
From: Yoshihisa Kawamoto <kawamoto@NetBSD.org>
Reply-To: kawamoto@NetBSD.org
To: gnats-bugs@NetBSD.org
Cc: kawamoto@NetBSD.org
Subject: vioif config error on evbarm/aarch64/Parallels Desktop for M1 Mac 17
X-Send-Pr-Version: 3.95

>Number:         56390
>Category:       kern
>Synopsis:       vioif config error on evbarm/aarch64/Parallels Desktop for M1 Mac 17
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 06 09:10:00 +0000 2021
>Originator:     Yoshihisa Kawamoto
>Release:        NetBSD 9.99.88
>Organization:
>Environment:
System: NetBSD white.tenjin.org 9.99.88 NetBSD 9.99.88 (GENERIC64) #10: Sun Sep 5 10:17:02 UTC 2021 kawamoto@white.tenjin.org:/usr/obj/obj.aarch64/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:
NetBSD-current works as an evbarm/aarch64 VM on Parallels Desktop for M1 Mac 17,
but a virtio network driver(vioif) has a configuration error and does not work.
> virtio0 at pci0 dev 5 function 0
> virtio0: network device (rev. 0x00)
> pci_io_find: expected type i/o, found mem
> virtio0: autoconfiguration error: can't map i/o space
> virtio0: autoconfiguration error: cannot attach (5)
In virtio_pci.c:virtio_pci_attach_09(), the code requests a port-mapped I/O,
but there are no port-mapped I/O in arm afaik, so that fails.

>How-To-Repeat:
Boot NetBSD-current on Parallels Desktop for Mac with M1 Mac.
>Fix:
I attached a quick patch and this works well. This calls also requesting
a memory-mapped I/O after failing an original request.
But I wonder if this is a right way to fix this issue or not.

Index: virtio_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/virtio_pci.c,v
retrieving revision 1.30
diff -u -r1.30 virtio_pci.c
--- virtio_pci.c	7 Aug 2021 16:19:14 -0000	1.30
+++ virtio_pci.c	5 Sep 2021 11:40:40 -0000
@@ -337,6 +337,8 @@

 	/* complete IO region */
 	if (pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_IO, 0,
+			   &psc->sc_iot, &psc->sc_ioh, NULL, &psc->sc_iosize) &&
+	    pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_MEM, 0,
 			   &psc->sc_iot, &psc->sc_ioh, NULL, &psc->sc_iosize)) {
 		aprint_error_dev(self, "can't map i/o space\n");
 		return EIO;

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.