lib/vmd: Replace spdk_vmd_probe(bdf) with spdk_vmd_init()
spdk_vmd_init() will attach all VMD devices that were unbinded from system. There is not need to specify VMD bdf in VMD public interface since it can be controlled by setup.sh script. Change-Id: Ifc45c32dc7e11b59429a41ddfdd596db30e27731 Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456631 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
fa64709373
commit
4a3d5418c5
@ -62,9 +62,8 @@ parse_args(int argc, char **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct spdk_env_opts opts;
|
||||
size_t vmd_cnt;
|
||||
|
||||
int rc = parse_args(argc, argv);
|
||||
|
||||
if (rc != 0) {
|
||||
return rc;
|
||||
}
|
||||
@ -77,9 +76,9 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
vmd_cnt = spdk_vmd_probe(&g_probe_addr);
|
||||
rc = spdk_vmd_init();
|
||||
|
||||
if (vmd_cnt == 0) {
|
||||
if (rc) {
|
||||
SPDK_ERRLOG("No VMD Controllers found\n");
|
||||
}
|
||||
|
||||
|
@ -51,15 +51,11 @@ extern "C" {
|
||||
#define MAX_VMD_TARGET 24
|
||||
|
||||
/*
|
||||
* Takes an input VMD D-BDF, probes it and attaches to it. The resulting vmd
|
||||
* adapter is placed in a vmd container. If input BDF is NULL, then all VMD
|
||||
* probed is consumed in the application VMD container list.
|
||||
* Enumerate VMD devices and hook them into the spdk pci subsystem
|
||||
*
|
||||
* \param vmd_bdf VMD BDF
|
||||
*
|
||||
* \return number of VMD devices available in the system
|
||||
* \return 0 on success, -1 on failure
|
||||
*/
|
||||
int spdk_vmd_probe(struct spdk_pci_addr *vmd_bdf);
|
||||
int spdk_vmd_init(void);
|
||||
|
||||
/*
|
||||
* Returns a list of nvme devices found on the given vmd pci BDF.
|
||||
|
@ -55,8 +55,6 @@ static unsigned char *device_type[] = {
|
||||
*/
|
||||
struct vmd_container {
|
||||
uint32_t count;
|
||||
/* can target specific vmd or all vmd when null */
|
||||
struct spdk_pci_addr *vmd_target_addr;
|
||||
struct vmd_adapter vmd[MAX_VMD_SUPPORTED];
|
||||
};
|
||||
|
||||
@ -833,14 +831,6 @@ vmd_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
|
||||
struct vmd_container *vmd_c = ctx;
|
||||
size_t i;
|
||||
|
||||
/*
|
||||
* If vmd target addr is NULL, then all spdk returned devices are consumed
|
||||
*/
|
||||
if (vmd_c->vmd_target_addr &&
|
||||
spdk_pci_addr_compare(&pci_dev->addr, vmd_c->vmd_target_addr)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
spdk_pci_device_cfg_read32(pci_dev, &cmd_reg, 4);
|
||||
cmd_reg |= 0x6; /* PCI bus master/memory enable. */
|
||||
spdk_pci_device_cfg_write32(pci_dev, cmd_reg, 4);
|
||||
@ -909,13 +899,9 @@ spdk_vmd_pci_device_list(struct spdk_pci_addr vmd_addr, struct spdk_pci_device *
|
||||
}
|
||||
|
||||
int
|
||||
spdk_vmd_probe(struct spdk_pci_addr *vmd_bdf)
|
||||
spdk_vmd_init(void)
|
||||
{
|
||||
g_vmd_container.vmd_target_addr = vmd_bdf;
|
||||
spdk_pci_enumerate(spdk_pci_vmd_get_driver(), vmd_enum_cb, &g_vmd_container);
|
||||
g_vmd_container.vmd_target_addr = NULL;
|
||||
|
||||
return g_vmd_container.count;
|
||||
return spdk_pci_enumerate(spdk_pci_vmd_get_driver(), vmd_enum_cb, &g_vmd_container);
|
||||
}
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT("vmd", SPDK_LOG_VMD)
|
||||
|
Loading…
Reference in New Issue
Block a user