vmd: move pci_hook_device to vmd_dev_init_end_device
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I79c35600fc9a758bbd9d58393b7eb98c8ac82acc Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14257 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tom Nabarro <tom.nabarro@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
2dfd36772f
commit
35f8bd2a13
@ -865,8 +865,6 @@ vmd_dev_detach(struct spdk_pci_device *dev)
|
|||||||
static void
|
static void
|
||||||
vmd_dev_init(struct vmd_pci_device *dev)
|
vmd_dev_init(struct vmd_pci_device *dev)
|
||||||
{
|
{
|
||||||
uint8_t bdf[32];
|
|
||||||
|
|
||||||
dev->pci.addr.domain = dev->bus->vmd->domain;
|
dev->pci.addr.domain = dev->bus->vmd->domain;
|
||||||
dev->pci.addr.bus = dev->bus->bus_number;
|
dev->pci.addr.bus = dev->bus->bus_number;
|
||||||
dev->pci.addr.dev = dev->devfn;
|
dev->pci.addr.dev = dev->devfn;
|
||||||
@ -883,13 +881,6 @@ vmd_dev_init(struct vmd_pci_device *dev)
|
|||||||
if (dev->pcie_cap != NULL) {
|
if (dev->pcie_cap != NULL) {
|
||||||
dev->cached_slot_control = dev->pcie_cap->slot_control;
|
dev->cached_slot_control = dev->pcie_cap->slot_control;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vmd_is_supported_device(dev)) {
|
|
||||||
spdk_pci_addr_fmt(bdf, sizeof(bdf), &dev->pci.addr);
|
|
||||||
SPDK_INFOLOG(vmd, "Initializing NVMe device at %s\n", bdf);
|
|
||||||
dev->pci.parent = dev->bus->vmd->pci;
|
|
||||||
spdk_pci_hook_device(spdk_pci_nvme_get_driver(), &dev->pci);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -897,6 +888,7 @@ vmd_init_end_device(struct vmd_pci_device *dev)
|
|||||||
{
|
{
|
||||||
struct vmd_pci_bus *bus = dev->bus;
|
struct vmd_pci_bus *bus = dev->bus;
|
||||||
struct vmd_adapter *vmd;
|
struct vmd_adapter *vmd;
|
||||||
|
uint8_t bdf[32];
|
||||||
|
|
||||||
/* Attach the device to the current bus and assign base addresses */
|
/* Attach the device to the current bus and assign base addresses */
|
||||||
TAILQ_INSERT_TAIL(&bus->dev_list, dev, tailq);
|
TAILQ_INSERT_TAIL(&bus->dev_list, dev, tailq);
|
||||||
@ -905,6 +897,11 @@ vmd_init_end_device(struct vmd_pci_device *dev)
|
|||||||
vmd_setup_msix(dev, &bus->vmd->msix_table[0]);
|
vmd_setup_msix(dev, &bus->vmd->msix_table[0]);
|
||||||
vmd_dev_init(dev);
|
vmd_dev_init(dev);
|
||||||
if (vmd_is_supported_device(dev)) {
|
if (vmd_is_supported_device(dev)) {
|
||||||
|
spdk_pci_addr_fmt(bdf, sizeof(bdf), &dev->pci.addr);
|
||||||
|
SPDK_INFOLOG(vmd, "Initializing NVMe device at %s\n", bdf);
|
||||||
|
dev->pci.parent = dev->bus->vmd->pci;
|
||||||
|
spdk_pci_hook_device(spdk_pci_nvme_get_driver(), &dev->pci);
|
||||||
|
|
||||||
vmd = bus->vmd;
|
vmd = bus->vmd;
|
||||||
vmd->target[vmd->nvme_count] = dev;
|
vmd->target[vmd->nvme_count] = dev;
|
||||||
vmd->nvme_count++;
|
vmd->nvme_count++;
|
||||||
|
Loading…
Reference in New Issue
Block a user