From owner-freebsd-virtualization@freebsd.org Tue May 22 20:13:35 2018 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C8C7EAE1AE for ; Tue, 22 May 2018 20:13:35 +0000 (UTC) (envelope-from lobo@bsd.com.br) Received: from mail-ot0-x235.google.com (mail-ot0-x235.google.com [IPv6:2607:f8b0:4003:c0f::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E7D8B87747 for ; Tue, 22 May 2018 20:13:34 +0000 (UTC) (envelope-from lobo@bsd.com.br) Received: by mail-ot0-x235.google.com with SMTP id m11-v6so22513705otf.3 for ; Tue, 22 May 2018 13:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsd.com.br; s=capeta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=d3d2XTAr5GGAXjh27GtK73HYbEA32fkGqPWacB338lk=; b=Jpp1MXx7vwyzo/X+wpD6wKbLDvbTbGBD6wCW4fpcCfPlMLKjtpqOM9kCDFAm7jSto3 IO7dj7Eyp5qqitpBmPCp+9l9uIlvbsQnnl7aslJ/gPd5S6d9SOmxNM8FRQSm5KQm1Rfa KC1rycc8mMQgjyBhfqYMDp2GBC4SVcsRzdcZA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=d3d2XTAr5GGAXjh27GtK73HYbEA32fkGqPWacB338lk=; b=eJVB0m1VJnPdYkX5Sg2TAKS7mNK2y+NpnlkMj0NL+sKOyNC7pJ3OtlZ3Hcta8CHd7f T9MvOfyKBnvhuVYBlHt/FcGJNIlc8sBlFpMPdI/dQ0N2u7uX9qyDXuJY5rFcMA0t5ZD3 PuY3rnPsCGqeiDIROW+408wmd1ZOxVWyDxMmjwQS8Tbs0EzJKL7mJ6+rFgiWGOn50fT4 v/FYyajR1l8bQZ97fPx5N3R/pBymI2ZCJNYF26E9emtVdP1/LMAGrNMVQPwr39lZBb1N 0Ta3IPoqCfurkwbWLeCa9BECz8IkEDHq9dlLjoKXoTRY9KZuajmQUaIOjmVgvj+qPF26 Srcw== X-Gm-Message-State: ALKqPwfoib/GK6TdKyYuDlB4er8S1tXSNGZ+xN0nG/MwVkM/o9GXvJBD TrNv9QB0b4FNp0ggUgi+bvX8BccfFjZMVoKyMGlYNQ== X-Google-Smtp-Source: AB8JxZoQnNlghuRp2caKIXuai4M1b/Q10XSAUbgcsS8AqafPlNj79n/hCM5YDFbO3NN6/X8NYhjwRtsodL5u8urQMp4= X-Received: by 2002:a9d:1535:: with SMTP id u50-v6mr18447950otf.197.1527020013951; Tue, 22 May 2018 13:13:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac9:1341:0:0:0:0:0 with HTTP; Tue, 22 May 2018 13:13:33 -0700 (PDT) In-Reply-To: References: <7167ea46-ee07-8ffa-615e-0f3d3eb92e64@palmen-it.de> From: Mario Lobo Date: Tue, 22 May 2018 17:13:33 -0300 Message-ID: Subject: Re: bhyve: passthrough of PCIe device without MSI possible? To: Neel Natu Cc: "freebsd-virtualization@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 20:13:35 -0000 2018-05-22 16:43 GMT-03:00 Neel Natu : > On Sun, May 20, 2018 at 12:04 PM, Mario Lobo wrote: > > Hi Felix; > > > > I had the same impression and I was attempting to do the same with no > > success. > > > > Have you managed to make it work? > > > > 2018-05-11 12:26 GMT-03:00 Felix Palmen : > > > >> I have the following PCIe card on a host running 11.1-RELEASE: > >> > >> | ppt0@pci0:5:0:0: class=0x078000 card=0x00011b74 chip=0x08101b74 > >> rev=0x14 hdr=0x00 > >> | vendor = 'OpenVox Communication Co. Ltd.' > >> | class = simple comms > >> > >> it doesn't support MSI according to `pciconf -lbc`: > >> > >> | ppt0@pci0:5:0:0: class=0x078000 card=0x00011b74 chip=0x08101b74 > >> rev=0x14 hdr=0x00 > >> | bar [10] = type Memory, range 32, base 0xdfe00000, size 524288, > >> enabled > >> > >> Trying to pass this card to a guest using `vm-bhyve` gives me the > >> following in `bhyve.log`: > >> > >> | bhyve: failed to initialize MSI for PCI 5/0/0 > >> > >> and this in `vm-byve.log`: > >> > >> | [bhyve options: -c 2 -m 2G -Hwl bootrom,/usr/local/share/uefi- > firmware/BHYVE_UEFI.fd > >> -U 9f2546f5-5464-11e8-8b52-d05099c0f275 -S] > >> | [bhyve devices: -s 0,hostbridge -s 31,lpc -s > >> 4:0,virtio-blk,/dev/zvol/zroot/vm/pbx/disk0 -s > >> 5:0,virtio-net,tap2,mac=58:9c:fc:00:d7:6b -s 6:0,passthru,5/0/0 -s > >> 7:0,fbuf,tcp=0.0.0.0:5900] > >> | [bhyve console: -l com1,/dev/nmdm0A] > >> | [bhyve iso device: -s 3:0,ahci-cd,/var/vm/.config/null.iso] > >> | starting bhyve (run 1) > >> | bhyve exited with status 1 > >> > >> Now .. is it actually possible to pass such a device to a bhyve guest? > >> From the code comment here: > >> >> ve/pci_passthru.c#L257> > >> I assumed MSI would be "emulated" if necessary? > >> > > I suspect that your PCI device does not advertise the capabilities bit > in its status register. > > MSI emulation depends on this bit being set: > https://github.com/freebsd/freebsd/blob/master/usr.sbin/ > bhyve/pci_passthru.c#L263 > > I can't see any reason this wouldn't work by emulating that bit and > the capabilities pointer in config space. > > best > Neel > > > Could you give us some hint on how the capabilities bit could be "faked"? Thanks, -- Mario Lobo http://www.mallavoodoo.com.br FreeBSD since version 2.2.8 [not Pro-Audio.... YET!!]