On Tue, Jul 11, 2023 at 7:52 AM Abhijit Gangurde <abhijit.gangu...@amd.com> wrote: > @@ -383,10 +384,12 @@ cdx_probe_one_driver(struct rte_cdx_driver *dr, > CDX_BUS_DEBUG(" probe device %s using driver: %s", dev_name, > dr->driver.name); > > - ret = cdx_vfio_map_resource(dev); > - if (ret != 0) { > - CDX_BUS_ERR("CDX map device failed: %d", ret); > - goto error_map_device; > + if (dr->drv_flags & RTE_CDX_DRV_NEED_MAPPING) { > + ret = cdx_vfio_map_resource(dev); > + if (ret != 0) { > + CDX_BUS_ERR("CDX map device failed: %d", ret); > + goto error_map_device; > + } > } > > /* call the driver probe() function */ > diff --git a/drivers/bus/cdx/rte_bus_cdx.h b/drivers/bus/cdx/rte_bus_cdx.h > new file mode 100644 > index 0000000000..4ca12f90c4 > --- /dev/null > +++ b/drivers/bus/cdx/rte_bus_cdx.h > @@ -0,0 +1,52 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright (C) 2023, Advanced Micro Devices, Inc. > + */ > + > +#ifndef RTE_BUS_CDX_H > +#define RTE_BUS_CDX_H > + > +/** > + * @file > + * CDX device & driver interface > + */ > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/* Forward declarations */ > +struct rte_cdx_device; > + > +/** > + * Map the CDX device resources in user space virtual memory address. > + * > + * Note that driver should not call this function when flag > + * RTE_CDX_DRV_NEED_MAPPING is set, as EAL will do that for > + * you when it's on.
Why should we export this function in the application ABI, if it is only used by drivers? > + * > + * @param dev > + * A pointer to a rte_cdx_device structure describing the device > + * to use. > + * > + * @return > + * 0 on success, negative on error and positive if no driver > + * is found for the device. > + */ > +__rte_experimental > +int rte_cdx_map_device(struct rte_cdx_device *dev); > -- David Marchand