On Mon, Nov 17, 2025 at 03:18:32PM +0100, Loktionov, Aleksandr wrote:
> 
> 
> > -----Original Message-----
> > From: Intel-wired-lan <[email protected]> On Behalf
> > Of Larysa Zaremba
> > Sent: Monday, November 17, 2025 2:49 PM
> > To: [email protected]; Nguyen, Anthony L
> > <[email protected]>
> > Cc: Lobakin, Aleksander <[email protected]>; Samudrala,
> > Sridhar <[email protected]>; Singhai, Anjali
> > <[email protected]>; Michal Swiatkowski
> > <[email protected]>; Zaremba, Larysa
> > <[email protected]>; Fijalkowski, Maciej
> > <[email protected]>; Tantilov, Emil S
> > <[email protected]>; Chittim, Madhu <[email protected]>;
> > Hay, Joshua A <[email protected]>; Keller, Jacob E
> > <[email protected]>; Shanmugam, Jayaprakash
> > <[email protected]>; Wochtman, Natalia
> > <[email protected]>; Jiri Pirko <[email protected]>; David S.
> > Miller <[email protected]>; Eric Dumazet <[email protected]>;
> > Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>;
> > Simon Horman <[email protected]>; Jonathan Corbet <[email protected]>;
> > Richard Cochran <[email protected]>; Kitszel, Przemyslaw
> > <[email protected]>; Andrew Lunn <[email protected]>;
> > [email protected]; [email protected]; linux-
> > [email protected]
> > Subject: [Intel-wired-lan] [PATCH iwl-next v5 12/15] ixd: add basic
> > driver framework for Intel(R) Control Plane Function
> > 
> > Add module register and probe functionality. Add the required support
> > to register IXD PCI driver, as well as probe and remove call backs.
> > Enable the PCI device and request the kernel to reserve the memory
> > resources that will be used by the driver. Finally map the BAR0
> > address space.
> > 
> > For now, use devm_alloc() to allocate adapter, as it requires the
> > least amount of code. In a later commit, it will be replaced with a
> > devlink alternative.
> > 
> > Co-developed-by: Amritha Nambiar <[email protected]>
> > Signed-off-by: Amritha Nambiar <[email protected]>
> > Reviewed-by: Maciej Fijalkowski <[email protected]>
> > Signed-off-by: Larysa Zaremba <[email protected]>
> > ---
> >  .../device_drivers/ethernet/index.rst         |   1 +
> >  .../device_drivers/ethernet/intel/ixd.rst     |  39 ++++++
> >  drivers/net/ethernet/intel/Kconfig            |   2 +
> >  drivers/net/ethernet/intel/Makefile           |   1 +
> >  drivers/net/ethernet/intel/ixd/Kconfig        |  13 ++
> >  drivers/net/ethernet/intel/ixd/Makefile       |   8 ++
> >  drivers/net/ethernet/intel/ixd/ixd.h          |  28 +++++
> >  drivers/net/ethernet/intel/ixd/ixd_lan_regs.h |  28 +++++
> >  drivers/net/ethernet/intel/ixd/ixd_main.c     | 112
> > ++++++++++++++++++
> >  9 files changed, 232 insertions(+)
> >  create mode 100644
> > Documentation/networking/device_drivers/ethernet/intel/ixd.rst
> >  create mode 100644 drivers/net/ethernet/intel/ixd/Kconfig
> >  create mode 100644 drivers/net/ethernet/intel/ixd/Makefile
> >  create mode 100644 drivers/net/ethernet/intel/ixd/ixd.h
> >  create mode 100644 drivers/net/ethernet/intel/ixd/ixd_lan_regs.h
> >  create mode 100644 drivers/net/ethernet/intel/ixd/ixd_main.c
> > 
> > diff --git
> > a/Documentation/networking/device_drivers/ethernet/index.rst
> > b/Documentation/networking/device_drivers/ethernet/index.rst
> > index bcc02355f828..b73d13a2f748 100644
> > --- a/Documentation/networking/device_drivers/ethernet/index.rst
> > +++ b/Documentation/networking/device_drivers/ethernet/index.rst
> > @@ -38,6 +38,7 @@ Contents:
> >     intel/igbvf
> >     intel/ixgbe
> >     intel/ixgbevf
> > +   intel/ixd
> >     intel/i40e
> >     intel/iavf
> >     intel/ice
> > diff --git
> > a/Documentation/networking/device_drivers/ethernet/intel/ixd.rst
> > b/Documentation/networking/device_drivers/ethernet/intel/ixd.rst
> > new file mode 100644
> > index 000000000000..1387626e5d20
> > --- /dev/null
> > +++ b/Documentation/networking/device_drivers/ethernet/intel/ixd.rst
> > @@ -0,0 +1,39 @@
> > +.. SPDX-License-Identifier: GPL-2.0+
> 
> ...
> 
> > +/**
> > + * ixd_probe - probe a CPF PCI device
> > + * @pdev: corresponding PCI device
> > + * @ent: entry in ixd_pci_tbl
> > + *
> > + * Returns: %0 on success, negative errno code on failure  */ static
> > +int ixd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> > {
> > +   struct ixd_adapter *adapter;
> > +   int err;
> > +
> > +   adapter = devm_kzalloc(&pdev->dev, sizeof(*adapter),
> > GFP_KERNEL);
> > +   if (!adapter)
> > +           return -ENOMEM;
> > +   adapter->hw.pdev = pdev;
> > +   INIT_LIST_HEAD(&adapter->hw.mmio_list);
> > +
> > +   err = libie_pci_init_dev(pdev);
> > +   if (err)
> > +           return err;
> On libie_pci_init_dev() failure, no cleanup of mapped regions.

No regions are mapped at this point. If you mean requested regions, they are 
cleaned up automatically by the means of pcim_*.

> 
> > +
> > +   pci_set_drvdata(pdev, adapter);
> > +
> > +   return ixd_iomap_regions(adapter);
> > +}
> It looks like missed pci_set_master() in probe.

This is done by libie_pci_init_dev().

> After successful init, DMA may fail without enabling bus mastering.
> 
> > +
> > +static const struct pci_device_id ixd_pci_tbl[] = {
> > +   { PCI_VDEVICE(INTEL, IXD_DEV_ID_CPF) },
> > +   { }
> > +};
> > +MODULE_DEVICE_TABLE(pci, ixd_pci_tbl);
> > +
> > +static struct pci_driver ixd_driver = {
> > +   .name                   = KBUILD_MODNAME,
> > +   .id_table               = ixd_pci_tbl,
> > +   .probe                  = ixd_probe,
> > +   .remove                 = ixd_remove,
> > +   .shutdown               = ixd_shutdown,
> > +};
> > +module_pci_driver(ixd_driver);
> > --
> > 2.47.0
> 

Reply via email to