git: 14c80457b0f6 - main - bhyve: add bus, slot and func to device name

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Mon, 19 Jun 2023 05:58:00 UTC
The branch main has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=14c80457b0f6a5eb6ff9a1db573462410c64a454

commit 14c80457b0f6a5eb6ff9a1db573462410c64a454
Author:     Vitaliy Gusev <gusev.vitaliy@gmail.com>
AuthorDate: 2023-05-15 14:28:45 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2023-06-19 05:57:04 +0000

    bhyve: add bus, slot and func to device name
    
    Each device needs a unique identifier to store and restore snapshots
    properly. Adding the pci bsf information to the device name creates a
    unique identifier as a bsf can't be occupied twice.
    
    Reviewed by:            corvink
    MFC after:              1 week
    Sponsored by:           vStack
    Differential Revision:  https://reviews.freebsd.org/D40107
---
 usr.sbin/bhyve/pci_emul.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
index ef98c459e327..6eb428e76817 100644
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -1029,7 +1029,8 @@ pci_emul_init(struct vmctx *ctx, struct pci_devemu *pde, int bus, int slot,
 	pdi->pi_lintr.pirq_pin = 0;
 	pdi->pi_lintr.ioapic_irq = 0;
 	pdi->pi_d = pde;
-	snprintf(pdi->pi_name, PI_NAMESZ, "%s-pci-%d", pde->pe_emu, slot);
+	snprintf(pdi->pi_name, PI_NAMESZ, "%s@pci.%d.%d.%d", pde->pe_emu, bus,
+	    slot, func);
 
 	/* Disable legacy interrupts */
 	pci_set_cfgdata8(pdi, PCIR_INTLINE, 255);