Skip to content

Commit a96016d

Browse files
Johan Hedbergstephanosio
Johan Hedberg
authored andcommitted
drivers: ivshmem: Remove unnecessary BDF lookup code
There was a bunch of BDF lookup code in the ivshmem driver originating from issues with not being able to have multiple PCIE_BDF_NONE entries in DTS. Now that devices are always looked up based on VID/DID this should not be an issue, and hence the additional code is not needed. Signed-off-by: Johan Hedberg <[email protected]>
1 parent 909185f commit a96016d

File tree

2 files changed

+3
-20
lines changed

2 files changed

+3
-20
lines changed

drivers/virtualization/virt_ivshmem.c

+3-17
Original file line numberDiff line numberDiff line change
@@ -225,27 +225,13 @@ static const struct ivshmem_driver_api ivshmem_api = {
225225
static int ivshmem_init(const struct device *dev)
226226
{
227227
struct ivshmem *data = dev->data;
228-
static bool bdf_lookup_done;
229228

230-
if ((data->pcie->bdf == PCIE_BDF_NONE) && bdf_lookup_done) {
231-
LOG_ERR("One instance of ivshmem with pcie_bdf_lookup() already initialized.\n"
232-
"Using more than one with PCIE_BDF_NONE parameter might conflict\n"
233-
"with already initialized instances.");
229+
if (data->pcie->bdf == PCIE_BDF_NONE) {
230+
LOG_WRN("ivshmem device not found");
234231
return -ENOTSUP;
235232
}
236-
if ((data->pcie->bdf == PCIE_BDF_NONE) && !bdf_lookup_done) {
237-
if (data->pcie->id == PCIE_ID_NONE) {
238-
data->pcie->id = PCIE_ID(IVSHMEM_VENDOR_ID,
239-
IVSHMEM_DEVICE_ID);
240-
data->pcie->bdf = pcie_bdf_lookup(data->pcie->id);
241-
}
242-
if (data->pcie->bdf == PCIE_BDF_NONE) {
243-
LOG_WRN("ivshmem device not found");
244-
return -ENOTSUP;
245-
}
246-
}
233+
247234
LOG_DBG("ivshmem found at bdf 0x%x", data->pcie->bdf);
248-
bdf_lookup_done = true;
249235

250236
if (!ivshmem_configure(dev)) {
251237
return -EIO;

drivers/virtualization/virt_ivshmem.h

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#include <zephyr/drivers/pcie/pcie.h>
1111
#include <zephyr/drivers/pcie/msi.h>
1212

13-
#define IVSHMEM_VENDOR_ID 0x1AF4
14-
#define IVSHMEM_DEVICE_ID 0x1110
15-
1613
#define IVSHMEM_PCIE_REG_BAR_IDX 0
1714
#define IVSHMEM_PCIE_SHMEM_BAR_IDX 2
1815

0 commit comments

Comments
 (0)