From owner-freebsd-virtualization@freebsd.org Sat Jun 15 19:13:35 2019 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 7CB3715CDA62 for ; Sat, 15 Jun 2019 19:13:35 +0000 (UTC) (envelope-from amvandemore@gmail.com) Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 337E587EDB for ; Sat, 15 Jun 2019 19:13:34 +0000 (UTC) (envelope-from amvandemore@gmail.com) Received: by mail-io1-xd2a.google.com with SMTP id m24so13086653ioo.2 for ; Sat, 15 Jun 2019 12:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TQFajpsWbFqR4PvRmNjevkGOqyfD6+rWc+6cd6FGyAw=; b=nCpVS0UvzwRh2oY/Khi9cwQ3snVHsgdXlt19rJnJcbL2SYmLFgoVutJMZNXK1k5Vz/ CK47+jqTpAzDklzhujTFpHjW0/nsT8HCQhS0e5or5oEsbIjyz7sVJIdI4ZP7lprWWF9I SI+dOTq6X1wJ0f/rE4q6mLNYxrLqlJjvriKs0cf+Oy543lgc60P/yo12dV+36+7d7Y1l 2io767Q3QzrNKgnvzPU01aaseyPT24aJpXRad/yewhk6A4NTRaF7UYeEWb9z7GL6/Twy l2glMefFMsxIH1DxqaoMa8m4ybRCXjM1qBENnMzRZszg1M0bYG+8BlZsfOxjdQW6h5ka cihw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TQFajpsWbFqR4PvRmNjevkGOqyfD6+rWc+6cd6FGyAw=; b=hiz8nlxV9sAgFXYg6KjMvDdyNWAnhmfs8DS0fqU+1M+j/8iVVyrkf2ZFG2PbeDdBtt b/GOjV/fqqgH5/+Crrk8Opcu/wVk8dOT2dlGXg/Xd5l0w3PriViigkApKL4+10VMBbON A9SXNukA55Cav4XFkNLphvkY3Lyp2EeW3vcQ/V24vX1IgqqQGeir7O+PkdQxQgmM+8Yc 5grs6KO+Fdo4qD9C5JhU9sQH6i4OrBB+Tq3QwISGRoM0TsMT82BdhOZwSexwytPZrBj5 tZSpBMGbx57j0cMWwl9BfHozGUy0pMu8iyk9rMcucknCuVI7TvLNL9wQ26DEQXJiwbbv wcAA== X-Gm-Message-State: APjAAAW8Bee8ZKe3K5rwrpi88czgMkkNttM8pZshXSLQbt9GZLLDI7TO LtZ6RNC85oIsix7w9p82fzphD9SlvFyQsbEFAqU= X-Google-Smtp-Source: APXvYqz6Iq9xZe0PwQxqFdEwEyokOTtvPqQWjAoispbtwwAKmMXmVWmseOUTJ6xpP9pV0npxxiWCpI6ns9oCSnWKxDY= X-Received: by 2002:a5d:8844:: with SMTP id t4mr4619695ios.91.1560626013421; Sat, 15 Jun 2019 12:13:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Adam Date: Sat, 15 Jun 2019 14:13:22 -0500 Message-ID: Subject: Re: Bhyve GPU passthrough To: Robert Crowston Cc: FreeBSD virtualization X-Rspamd-Queue-Id: 337E587EDB X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=nCpVS0Uv; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of amvandemore@gmail.com designates 2607:f8b0:4864:20::d2a as permitted sender) smtp.mailfrom=amvandemore@gmail.com X-Spamd-Result: default: False [-6.78 / 15.00]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; FREEMAIL_TO(0.00)[protonmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_SHORT(-0.81)[-0.806,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-virtualization@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[a.2.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.96)[ip: (-9.28), ipnet: 2607:f8b0::/32(-3.17), asn: 15169(-2.31), country: US(-0.06)]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 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: Sat, 15 Jun 2019 19:13:35 -0000 On Sat, Jun 15, 2019 at 5:52 AM Robert Crowston wrote: > I think I am the most recent adventurer, but if you go back a couple of > years I am only building on material I found discussed in this mailing li= st. > > I do have an nVidia GPU working on Linux under the nouveau drivet. It > required some changes to the bhyve source; in particular I had to remap t= he > 64 bit PCI BAR allocations into the lower 4 GB of the guest=E2=80=99s add= ress > space. I am not sure if that is a quirk of the AMD processor I=E2=80=99m = using. > > I think there are a few things that prevent this from working in the > general case. Probably the most serious is bhyve doesn=E2=80=99t support = emulation > or passthrough of PCI ROMs. I am working on a hack to make that work in m= y > spare time. But I am not an official member of the project, just tinkerin= g. > :-) > > The nVidia Windows driver only checks the pending break enable bit on the > feature flags register to see if it is virtualized (or at least that was > the case about a year ago). You can readily change that to 0 in the bhyve > source code. But we are some way from that yet. > Hey yes your information both previous and current is helpful. nouveau doesn't get me anything so I didn't test it. Pretty much only goal is CUDA in the VM, but it seems you are right in that this is a ways off. There are some changes relative to my experience vs what you originally describe. Maybe part of that are the changes to bhyve 12-stable. The only thing that shows in the FreeBSD VM when trying nvidia-smi is: Jun 15 14:09:38 passthrough kernel: NVRM: GPU 0000:00:01.0: RmInitAdapter failed! (0x26:0x65:1133) Jun 15 14:09:38 passthrough kernel: nvidia0: NVRM: rm_init_adapter() failed= ! So I guess that is the PCI ROM issue. If you do work up some patches and need some other testing, let me know. --=20 Adam