Skip to content

Commit 7e9dd0d

Browse files
emuslnjgunthorpe
authored andcommitted
pds_core: add new fwctl auxiliary_device
Add support for a new fwctl-based auxiliary_device for creating a channel for fwctl support into the AMD/Pensando DSC. Link: https://patch.msgid.link/r/[email protected] Reviewed-by: Leon Romanovsky <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Shannon Nelson <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent b699bdc commit 7e9dd0d

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

drivers/net/ethernet/amd/pds_core/auxbus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ int pdsc_auxbus_dev_add(struct pdsc *cf, struct pdsc *pf,
224224
}
225225

226226
/* Verify that the type is supported and enabled. It is not
227-
* an error if there is no auxbus device support for this
228-
* VF, it just means something else needs to happen with it.
227+
* an error if the firmware doesn't support the feature, the
228+
* driver just won't set up an auxiliary_device for it.
229229
*/
230230
vt_support = !!le16_to_cpu(pf->dev_ident.vif_types[vt]);
231231
if (!(vt_support &&

drivers/net/ethernet/amd/pds_core/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ static int pdsc_core_init(struct pdsc *pdsc)
402402
}
403403

404404
static struct pdsc_viftype pdsc_viftype_defaults[] = {
405+
[PDS_DEV_TYPE_FWCTL] = { .name = PDS_DEV_TYPE_FWCTL_STR,
406+
.vif_id = PDS_DEV_TYPE_FWCTL,
407+
.dl_id = -1 },
405408
[PDS_DEV_TYPE_VDPA] = { .name = PDS_DEV_TYPE_VDPA_STR,
406409
.vif_id = PDS_DEV_TYPE_VDPA,
407410
.dl_id = DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET },
@@ -428,6 +431,10 @@ static int pdsc_viftypes_init(struct pdsc *pdsc)
428431

429432
/* See what the Core device has for support */
430433
vt_support = !!le16_to_cpu(pdsc->dev_ident.vif_types[vt]);
434+
435+
if (vt == PDS_DEV_TYPE_FWCTL)
436+
pdsc->viftype_status[vt].enabled = true;
437+
431438
dev_dbg(pdsc->dev, "VIF %s is %ssupported\n",
432439
pdsc->viftype_status[vt].name,
433440
vt_support ? "" : "not ");

drivers/net/ethernet/amd/pds_core/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct pdsc {
156156
struct dentry *dentry;
157157
struct device *dev;
158158
struct pdsc_dev_bar bars[PDS_CORE_BARS_MAX];
159+
struct pds_auxiliary_dev *padev;
159160
struct pdsc_vf *vfs;
160161
int num_vfs;
161162
int vf_id;

drivers/net/ethernet/amd/pds_core/main.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ static int pdsc_init_pf(struct pdsc *pdsc)
265265

266266
mutex_unlock(&pdsc->config_lock);
267267

268+
err = pdsc_auxbus_dev_add(pdsc, pdsc, PDS_DEV_TYPE_FWCTL, &pdsc->padev);
269+
if (err)
270+
goto err_out_stop;
271+
268272
dl = priv_to_devlink(pdsc);
269273
devl_lock(dl);
270274
err = devl_params_register(dl, pdsc_dl_params,
@@ -273,7 +277,7 @@ static int pdsc_init_pf(struct pdsc *pdsc)
273277
devl_unlock(dl);
274278
dev_warn(pdsc->dev, "Failed to register devlink params: %pe\n",
275279
ERR_PTR(err));
276-
goto err_out_stop;
280+
goto err_out_del_dev;
277281
}
278282

279283
hr = devl_health_reporter_create(dl, &pdsc_fw_reporter_ops, 0, pdsc);
@@ -296,6 +300,8 @@ static int pdsc_init_pf(struct pdsc *pdsc)
296300
err_out_unreg_params:
297301
devlink_params_unregister(dl, pdsc_dl_params,
298302
ARRAY_SIZE(pdsc_dl_params));
303+
err_out_del_dev:
304+
pdsc_auxbus_dev_del(pdsc, pdsc, &pdsc->padev);
299305
err_out_stop:
300306
pdsc_stop(pdsc);
301307
err_out_teardown:
@@ -427,6 +433,7 @@ static void pdsc_remove(struct pci_dev *pdev)
427433
* shut themselves down.
428434
*/
429435
pdsc_sriov_configure(pdev, 0);
436+
pdsc_auxbus_dev_del(pdsc, pdsc, &pdsc->padev);
430437

431438
timer_shutdown_sync(&pdsc->wdtimer);
432439
if (pdsc->wq)
@@ -485,6 +492,8 @@ static void pdsc_reset_prepare(struct pci_dev *pdev)
485492
if (!IS_ERR(pf))
486493
pdsc_auxbus_dev_del(pdsc, pf,
487494
&pf->vfs[pdsc->vf_id].padev);
495+
} else {
496+
pdsc_auxbus_dev_del(pdsc, pdsc, &pdsc->padev);
488497
}
489498

490499
pdsc_unmap_bars(pdsc);
@@ -531,6 +540,9 @@ static void pdsc_reset_done(struct pci_dev *pdev)
531540
if (!IS_ERR(pf))
532541
pdsc_auxbus_dev_add(pdsc, pf, PDS_DEV_TYPE_VDPA,
533542
&pf->vfs[pdsc->vf_id].padev);
543+
} else {
544+
pdsc_auxbus_dev_add(pdsc, pdsc, PDS_DEV_TYPE_FWCTL,
545+
&pdsc->padev);
534546
}
535547
}
536548

include/linux/pds/pds_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum pds_core_vif_types {
2929
PDS_DEV_TYPE_ETH = 3,
3030
PDS_DEV_TYPE_RDMA = 4,
3131
PDS_DEV_TYPE_LM = 5,
32+
PDS_DEV_TYPE_FWCTL = 6,
3233

3334
/* new ones added before this line */
3435
PDS_DEV_TYPE_MAX = 16 /* don't change - used in struct size */
@@ -40,6 +41,7 @@ enum pds_core_vif_types {
4041
#define PDS_DEV_TYPE_ETH_STR "Eth"
4142
#define PDS_DEV_TYPE_RDMA_STR "RDMA"
4243
#define PDS_DEV_TYPE_LM_STR "LM"
44+
#define PDS_DEV_TYPE_FWCTL_STR "fwctl"
4345

4446
#define PDS_VDPA_DEV_NAME PDS_CORE_DRV_NAME "." PDS_DEV_TYPE_VDPA_STR
4547
#define PDS_VFIO_LM_DEV_NAME PDS_CORE_DRV_NAME "." PDS_DEV_TYPE_LM_STR "." PDS_DEV_TYPE_VFIO_STR

0 commit comments

Comments
 (0)