NetBSD Problem Report #52107

From martin@aprisoft.de  Thu Mar 23 16:09:22 2017
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 955AA7A167
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 23 Mar 2017 16:09:22 +0000 (UTC)
Message-Id: <20170323160909.B10935CC761@emmas.aprisoft.de>
Date: Thu, 23 Mar 2017 17:09:09 +0100 (CET)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: virtio does not work on sparc64
X-Send-Pr-Version: 3.95

>Number:         52107
>Category:       kern
>Synopsis:       virtio does not work on sparc64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 23 16:10:00 +0000 2017
>Closed-Date:    Sat Jun 16 13:31:26 +0000 2018
>Last-Modified:  Sat Jun 16 13:31:26 +0000 2018
>Originator:     Martin Husemann
>Release:        NetBSD 7.99.66
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD whoever-brings-the-night.aprisoft.de 7.99.66 NetBSD 7.99.66 (WHOEVER) #110: Tue Mar 21 11:42:55 CET 2017 martin@martins.aprisoft.de:/ssd/src/sys/arch/sparc64/compile/WHOEVER sparc64
Architecture: sparc64
Machine: sparc64
>Description:

I am trying to get virtio working in sparc64 kernels (tested against qemu).
This fails, and I am haven't read the virtio spec yet, so am filing this
here:

I added a few debug printfs, comments inline:

virtio0 at pci0 dev 6 function 0
virtio0: Virtio Block Device (rev. 0x00)
ld0 at virtio0: Features: 0x10000054<INDIRECT_DESC,BLK_SIZE,GEOMETRY,SEG_MAX>
MAXPHYS -> maxxfersize = 65536
VIRTIO_BLK_F_SEG_MAX -> maxnsegs = 2113929216

2113929216 is way too big, would we use that value to create the vq mapping,
we would crash later, so I am clamping it to the default value for now:

maxxfersize / page size would be: maxnsegs = 8
virtio: allocsize1: 4096, allocsize2: 4096, allocsize3: 20480
virtio: vq_indirectoffset: 8192, vq_indirect: 0x12cdcc000
vq_size: 128, vq_maxnsegs: 10
ld0: 128 PB, 26368 cyl, 16 head, 63 sec, 131072 bytes/sect x 42785295971647488 sectors

128 PB would be nice, but I only gave it 50MB....

virtio0: interrupting at ivec 1818


>How-To-Repeat:

add virtio devices to sparc64 kernel (exclude the baloon driver, it does not
like non-4k page sizes), boot kernel in qemu (avoid qemu 2.8, it has a 64bit
pci bug that makes the device not attach).

>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/52107: virtio does not work on sparc64
Date: Thu, 23 Mar 2017 17:13:08 +0000

 So we are still using virtion in legacy mode, which makes endianess of
 the PCI registers to be host byte order - and that won't fly well with
 our pci bus space implementation.

 We should update to non-legacy mode and probably not fight this while
 using legacy.

 Martin

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52107 CVS commit: src/sys/dev/pci
Date: Sat, 25 Mar 2017 13:05:09 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Mar 25 13:05:09 UTC 2017

 Modified Files:
 	src/sys/dev/pci: virtio.c

 Log Message:
 PR kern/52107: for now (while we still use the legacy virtio spec) at least
 hack around the endianess issues with that.


 To generate a diff of this commit:
 cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/virtio.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Sat, 16 Jun 2018 13:31:26 +0000
State-Changed-Why:
relevant virtio(4) devices are working on sparc64 for netbsd-8.  VIRTIO v1.0 support has been moved to kern/53372.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.