Page MenuHomeFreeBSD

D58579.diff
No OneTemporary

D58579.diff

diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h
--- a/usr.sbin/bhyve/pci_emul.h
+++ b/usr.sbin/bhyve/pci_emul.h
@@ -232,7 +232,7 @@
void pci_callback(void);
uint32_t pci_config_read_reg(const struct pci_conf *host_conf, nvlist_t *nvl,
uint32_t reg, uint8_t size, uint32_t def);
-int pci_emul_alloc_bar(struct pci_devinst *pdi, int idx,
+void pci_emul_alloc_bar(struct pci_devinst *pdi, int idx,
enum pcibar_type type, uint64_t size);
int pci_emul_alloc_rom(struct pci_devinst *const pdi, const uint64_t size,
void **const addr);
diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -795,7 +795,7 @@
register_bar(pi, idx);
}
-int
+void
pci_emul_alloc_bar(struct pci_devinst *pdi, int idx, enum pcibar_type type,
uint64_t size)
{
@@ -863,7 +863,7 @@
* ROM to handle this.
*/
if (!get_config_bool_default("pci.enable_bars", !bootrom_boot()))
- return (0);
+ return;
/*
* pci_passthru devices synchronize their physical and virtual command
@@ -886,8 +886,6 @@
const uint16_t cmd = pci_get_cfgdata16(pdi, PCIR_COMMAND);
pci_set_cfgdata16(pdi, PCIR_COMMAND, cmd | enbit);
-
- return (0);
}
static int
@@ -1027,10 +1025,7 @@
}
/* allocate ROM BAR */
- const int error = pci_emul_alloc_bar(pdi, PCI_ROM_IDX, PCIBAR_ROM,
- rom_size);
- if (error)
- return error;
+ pci_emul_alloc_bar(pdi, PCI_ROM_IDX, PCIBAR_ROM, rom_size);
/* return address */
*addr = pci_emul_rombase + pci_emul_romoffset;
@@ -2613,14 +2608,9 @@
error = pci_emul_add_msicap(pi, PCI_EMUL_MSI_MSGS);
assert(error == 0);
- error = pci_emul_alloc_bar(pi, 0, PCIBAR_IO, DIOSZ);
- assert(error == 0);
-
- error = pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, DMEMSZ);
- assert(error == 0);
-
- error = pci_emul_alloc_bar(pi, 2, PCIBAR_MEM32, DMEMSZ);
- assert(error == 0);
+ pci_emul_alloc_bar(pi, 0, PCIBAR_IO, DIOSZ);
+ pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, DMEMSZ);
+ pci_emul_alloc_bar(pi, 2, PCIBAR_MEM32, DMEMSZ);
return (0);
}
diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c
--- a/usr.sbin/bhyve/pci_fbuf.c
+++ b/usr.sbin/bhyve/pci_fbuf.c
@@ -409,11 +409,8 @@
goto done;
}
- error = pci_emul_alloc_bar(pi, 0, PCIBAR_MEM32, DMEMSZ);
- assert(error == 0);
-
- error = pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, FB_SIZE);
- assert(error == 0);
+ pci_emul_alloc_bar(pi, 0, PCIBAR_MEM32, DMEMSZ);
+ pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, FB_SIZE);
error = pci_emul_add_msicap(pi, PCI_FBUF_MSI_MSGS);
assert(error == 0);
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -3342,11 +3342,7 @@
DPRINTF("nvme membar size: %u", pci_membar_sz);
- error = pci_emul_alloc_bar(pi, 0, PCIBAR_MEM64, pci_membar_sz);
- if (error) {
- WPRINTF("%s pci alloc mem bar failed", __func__);
- goto done;
- }
+ pci_emul_alloc_bar(pi, 0, PCIBAR_MEM64, pci_membar_sz);
error = pci_emul_add_msixcap(pi, sc->max_queues + 1, NVME_MSIX_BAR);
if (error) {
diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c
--- a/usr.sbin/bhyve/pci_passthru.c
+++ b/usr.sbin/bhyve/pci_passthru.c
@@ -578,7 +578,7 @@
static int
cfginitbar(struct passthru_softc *sc)
{
- int i, error;
+ int i;
struct pci_devinst *pi;
struct pci_bar_io bar;
enum pcibar_type bartype;
@@ -632,9 +632,7 @@
sc->psc_bar[i].lobits = 0;
/* Allocate the BAR in the guest I/O or MMIO space */
- error = pci_emul_alloc_bar(pi, i, bartype, size);
- if (error)
- return (-1);
+ pci_emul_alloc_bar(pi, i, bartype, size);
/* Use same lobits as physical bar */
lobits = (uint8_t)passthru_read_config(&sc->psc_sel,

File Metadata

Mime Type
text/plain
Expires
Thu, Aug 6, 5:53 AM (12 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36002042
Default Alt Text
D58579.diff (3 KB)

Event Timeline