From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 17CFD1FF173
	for <inbox@lore.proxmox.com>; Mon, 10 Feb 2025 13:27:24 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 3C114B7B8;
	Mon, 10 Feb 2025 13:27:22 +0100 (CET)
From: Hannes Duerr <h.duerr@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Mon, 10 Feb 2025 13:27:06 +0100
Message-Id: <20250210122707.177085-5-h.duerr@proxmox.com>
X-Mailer: git-send-email 2.39.5
In-Reply-To: <20250210122707.177085-1-h.duerr@proxmox.com>
References: <20250210122707.177085-1-h.duerr@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.025 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH pve-nvidia-vgpu-helper v4 4/4] debian: add and
 install pve-nvidia-sriov systemd template unit file
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

SR-IOV must be enabled each time the system is restarted.
This systemd service should take over this task and enable SR-IOV per
pci-id/gpu after a system restart.

Signed-off-by: Hannes Duerr <h.duerr@proxmox.com>
---

Notes:
    Changes in v4:
    * Change nvidia-vgpud.service nvidia-vgpu-mgr.service to `Before=`
      targets and remove the 5 seconds sleep in `ExecStartPre=` because it
      is not needed anymore

 debian/pve-nvidia-sriov@.service | 12 ++++++++++++
 debian/rules                     |  3 +++
 2 files changed, 15 insertions(+)
 create mode 100644 debian/pve-nvidia-sriov@.service

diff --git a/debian/pve-nvidia-sriov@.service b/debian/pve-nvidia-sriov@.service
new file mode 100644
index 0000000..f2e4c83
--- /dev/null
+++ b/debian/pve-nvidia-sriov@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Enable NVIDIA SR-IOV for PCI ID %i
+ConditionPathExists=/usr/lib/nvidia/sriov-manage
+After=network.target 
+Before=pve-guests.service nvidia-vgpud.service nvidia-vgpu-mgr.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/lib/nvidia/sriov-manage -e %i
+
+[Install]
+WantedBy=multi-user.target
diff --git a/debian/rules b/debian/rules
index 218df65..d5fe1f6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,3 +6,6 @@
 
 %:
 	dh $@
+
+override_dh_installsystemd:
+	dh_installsystemd --no-start --no-enable --name pve-nvidia-sriov@ pve-nvidia-sriov@.service
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel