From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bug-guix-bounces+larch=yhetil.org@gnu.org>
Received: from mp2.migadu.com ([2001:41d0:403:58f0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms13.migadu.com with LMTPS
	id MByyCwS9iWa5YAEAe85BDQ:P1
	(envelope-from <bug-guix-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 06 Jul 2024 21:54:12 +0000
Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp2.migadu.com with LMTPS
	id MByyCwS9iWa5YAEAe85BDQ
	(envelope-from <bug-guix-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 06 Jul 2024 23:54:12 +0200
X-Envelope-To: larch@yhetil.org
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=vDTrqQXW;
	dmarc=pass (policy=none) header.from=gnu.org;
	spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1720302852;
	h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:resent-cc:
	 resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=1Vvcneqpzkq6DMTG6vwNLTjVJvOPVUdAB04JipMpacU=;
	b=m3R3a/VLFAzlZHVVd4VoZw7xd9awGb9h8V0szbp0EKnA7Fc2S9soBy+kCSjhYwx9qtpm08
	cw4Z7fEHlgxETNmN5z7RFLxY1XgxirDxibCQvO/MVxNVu+4Qj8ykHNt2lEQEIEIo7z1+dd
	xWHLhXDJ1yHTrN/Z2Hnrxf2UBgKuvQboPUeRv+xNrAWwomq+OKz2P7Bisc7yESZLq2Byib
	yV+mM0cMFOdIXIxPQF0DQtinP2RCeu7QwpLIl2zhFtllXRbox/eZXqL7WdnGD1y3bI9BJz
	Vy9ExhP6OE9waLSvE2n7GjnhA6aLChsl8CiqZ0NCzwK8WNffuVBEE0wGgL3g4Q==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1720302852; a=rsa-sha256; cv=none;
	b=eD63IjM2dlCiiMy4vWxRCVFtTZxZgiYbBoEeKynv7ngBoJCSHS6YOhj18Qnd35+zlkoY+0
	Muh3ZnWGcBOCugErzNgcHShsWh7w3atQLPFu/3++zdvFM0k+EnTafTWUL8shAUjLcOHee5
	cVRDrA6/iYXJq2PrDyPVpBB/2EsAiiNqf1zl053TpKdyISFL21A2/dFXHHYrpxJJCBTOyl
	TCcAaH9H6tZ8+4B3ft5zYVF4JvUOtVnMoru9drFKpbRplUxsLXFH/qoDKf/LTJdT2P/RF3
	aQSPu6yU5S8WXqsI3kkNpr3wyxvQ1hhZ1W6k/mpjcWDCX+XniQppaADb10Q4Aw==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=protonmail.com header.s=protonmail3 header.b=vDTrqQXW;
	dmarc=pass (policy=none) header.from=gnu.org;
	spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id E97B971506
	for <larch@yhetil.org>; Sat, 06 Jul 2024 23:54:11 +0200 (CEST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-guix-bounces@gnu.org>)
	id 1sQDLf-0000WN-4x; Sat, 06 Jul 2024 17:53:39 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1sPaZA-00022g-0s
 for bug-guix@gnu.org; Fri, 05 Jul 2024 00:29:00 -0400
Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1sPaZ9-0006vJ-Ox
 for bug-guix@gnu.org; Fri, 05 Jul 2024 00:28:59 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1sPaZC-0003Zy-GF
 for bug-guix@gnu.org; Fri, 05 Jul 2024 00:29:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: bug#55907: VFIO kernel module fails to capture PCI device
References: <ed5747f5-eaa6-4ae5-8434-d9db467079b5@www.fastmail.com>
In-Reply-To: <ed5747f5-eaa6-4ae5-8434-d9db467079b5@www.fastmail.com>
Resent-From: Nikola =?UTF-8?Q?Brkovi=C4=87?= <nikolabrk@protonmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-guix@gnu.org
Resent-Date: Fri, 05 Jul 2024 04:29:02 +0000
Resent-Message-ID: <handler.55907.B55907.172015373613742@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 55907
X-GNU-PR-Package: guix
X-GNU-PR-Keywords: 
To: "55907@debbugs.gnu.org" <55907@debbugs.gnu.org>
Received: via spool by 55907-submit@debbugs.gnu.org id=B55907.172015373613742
 (code B ref 55907); Fri, 05 Jul 2024 04:29:02 +0000
Received: (at 55907) by debbugs.gnu.org; 5 Jul 2024 04:28:56 +0000
Received: from localhost ([127.0.0.1]:43349 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1sPaZ5-0003ZY-E3
 for submit@debbugs.gnu.org; Fri, 05 Jul 2024 00:28:56 -0400
Received: from mail-4322.protonmail.ch ([185.70.43.22]:30443)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nikolabrk@protonmail.com>) id 1sPU94-00011m-7r
 for 55907@debbugs.gnu.org; Thu, 04 Jul 2024 17:37:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1720129049; x=1720388249;
 bh=1Vvcneqpzkq6DMTG6vwNLTjVJvOPVUdAB04JipMpacU=;
 h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:
 Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector;
 b=vDTrqQXWAhmClj8/Xwym1Zzp2SGiCCOd9XxeT9zaveR5VX4iGKNZ2WtSSvKnVy0ip
 U0RbFHz18JGd3O7w9r+iWY5JB/YU16dWr7l+015qrTRcf6sRrPKoqPnkc2ziRbakBi
 xHc6zQWMb4aCFRcJ91rKw2+1d3cAFK9OYwKQlSPgDvpnm5pKSZTyGRKZJ6p3SCnh+J
 2Jaf7r6FQ7Pi+tZScUm2GR17YlJAcIlG1wypob8bAapzd8xvzMKQyuaJybb9wSjjqP
 PWO7gANkfO2wYa7LarS7PQsogNFYp9xU27PLUYt7QWPOtRSkuQo+FYOqekwVOBByA7
 qtcJdFLXedLVw==
Date: Thu, 04 Jul 2024 21:37:24 +0000
Message-ID: <VuGXUGjGQnHxEiL7CJApZEAU1eqUAndvtqNH7YqDhdef982qR0yMCHqTd8DcAWFXTueEcXdK3sHbxtYvGAjW4g0L_3eERvp1mXX_RjZztSA=@protonmail.com>
Feedback-ID: 32797663:user:proton
X-Pm-Message-ID: e4f19ad6230013e445430ba64e9a367962531ef6
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Mailman-Approved-At: Fri, 05 Jul 2024 00:28:54 -0400
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-Mailman-Approved-At: Sat, 06 Jul 2024 17:53:37 -0400
X-BeenThere: bug-guix@gnu.org
List-Id: Bug reports for GNU Guix <bug-guix.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-guix>,
 <mailto:bug-guix-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-guix>
List-Post: <mailto:bug-guix@gnu.org>
List-Help: <mailto:bug-guix-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-guix>,
 <mailto:bug-guix-request@gnu.org?subject=subscribe>
Reply-to:  Nikola =?UTF-8?Q?Brkovi=C4=87?= <nikolabrk@protonmail.com>
From:  Nikola =?UTF-8?Q?Brkovi=C4=87?= via Bug reports for GNU Guix <bug-guix@gnu.org>
Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org
Sender: bug-guix-bounces+larch=yhetil.org@gnu.org
X-Migadu-Flow: FLOW_IN
X-Migadu-Country: US
X-Migadu-Spam-Score: -2.89
X-Spam-Score: -2.89
X-Migadu-Queue-Id: E97B971506
X-Migadu-Scanner: mx11.migadu.com
X-TUID: 35h/2pTf5AGk

I have managed to get VFIO working by creating a service of boot-service-ty=
pe which overrides the GPU driver with vfio-pci and binds the GPU to VFIO:

>(simple-service 'vfio-override=C2=A0boot-service-type
>=C2=A0 =C2=A0 '(and (call-with-output-file "/sys/bus/pci/devices/0000:04:0=
0.0/driver_override"
>=C2=A0 =C2=A0   (lambda (p)
>=C2=A0 =C2=A0 =C2=A0  (display "vfio-pci" p)))
>=C2=A0    (call-with-output-file "/sys/bus/pci/drivers/vfio-pci/new_id"
>=C2=A0 =C2=A0   (lambda (p)
>=C2=A0 =C2=A0 =C2=A0  (display "1002 665f" p)))
>=C2=A0 )
>)

Sorry for the hard-coded IDs, you should replace them with your own. You mi=
ght need to unbind the GPU's audio card from its driver as well, after you'=
re fully booted. QEMU will refuse to pass-through the GPU if the audio card=
 is in the same IOMMU group and not using vfio-pci.

In my case, the service runs early enough in the boot process where amdgpu =
has not initialized the GPU yet. There might be a better way to accomplish =
this, I'm still new to Guix and Scheme.

Thanks,
Nikola