Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/20250320194412.67983-4-shannon.nelson@amd.com
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Shannon Nelson and committed by
Jason Gunthorpe
7e9dd0d1 b699bdc7

+25 -3
+2 -2
drivers/net/ethernet/amd/pds_core/auxbus.c
··· 224 224 } 225 225 226 226 /* 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. 229 229 */ 230 230 vt_support = !!le16_to_cpu(pf->dev_ident.vif_types[vt]); 231 231 if (!(vt_support &&
+7
drivers/net/ethernet/amd/pds_core/core.c
··· 402 402 } 403 403 404 404 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 }, 405 408 [PDS_DEV_TYPE_VDPA] = { .name = PDS_DEV_TYPE_VDPA_STR, 406 409 .vif_id = PDS_DEV_TYPE_VDPA, 407 410 .dl_id = DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET }, ··· 431 428 432 429 /* See what the Core device has for support */ 433 430 vt_support = !!le16_to_cpu(pdsc->dev_ident.vif_types[vt]); 431 + 432 + if (vt == PDS_DEV_TYPE_FWCTL) 433 + pdsc->viftype_status[vt].enabled = true; 434 + 434 435 dev_dbg(pdsc->dev, "VIF %s is %ssupported\n", 435 436 pdsc->viftype_status[vt].name, 436 437 vt_support ? "" : "not ");
+1
drivers/net/ethernet/amd/pds_core/core.h
··· 156 156 struct dentry *dentry; 157 157 struct device *dev; 158 158 struct pdsc_dev_bar bars[PDS_CORE_BARS_MAX]; 159 + struct pds_auxiliary_dev *padev; 159 160 struct pdsc_vf *vfs; 160 161 int num_vfs; 161 162 int vf_id;
+13 -1
drivers/net/ethernet/amd/pds_core/main.c
··· 265 265 266 266 mutex_unlock(&pdsc->config_lock); 267 267 268 + err = pdsc_auxbus_dev_add(pdsc, pdsc, PDS_DEV_TYPE_FWCTL, &pdsc->padev); 269 + if (err) 270 + goto err_out_stop; 271 + 268 272 dl = priv_to_devlink(pdsc); 269 273 devl_lock(dl); 270 274 err = devl_params_register(dl, pdsc_dl_params, ··· 277 273 devl_unlock(dl); 278 274 dev_warn(pdsc->dev, "Failed to register devlink params: %pe\n", 279 275 ERR_PTR(err)); 280 - goto err_out_stop; 276 + goto err_out_del_dev; 281 277 } 282 278 283 279 hr = devl_health_reporter_create(dl, &pdsc_fw_reporter_ops, 0, pdsc); ··· 300 296 err_out_unreg_params: 301 297 devlink_params_unregister(dl, pdsc_dl_params, 302 298 ARRAY_SIZE(pdsc_dl_params)); 299 + err_out_del_dev: 300 + pdsc_auxbus_dev_del(pdsc, pdsc, &pdsc->padev); 303 301 err_out_stop: 304 302 pdsc_stop(pdsc); 305 303 err_out_teardown: ··· 433 427 * shut themselves down. 434 428 */ 435 429 pdsc_sriov_configure(pdev, 0); 430 + pdsc_auxbus_dev_del(pdsc, pdsc, &pdsc->padev); 436 431 437 432 timer_shutdown_sync(&pdsc->wdtimer); 438 433 if (pdsc->wq) ··· 492 485 if (!IS_ERR(pf)) 493 486 pdsc_auxbus_dev_del(pdsc, pf, 494 487 &pf->vfs[pdsc->vf_id].padev); 488 + } else { 489 + pdsc_auxbus_dev_del(pdsc, pdsc, &pdsc->padev); 495 490 } 496 491 497 492 pdsc_unmap_bars(pdsc); ··· 540 531 if (!IS_ERR(pf)) 541 532 pdsc_auxbus_dev_add(pdsc, pf, PDS_DEV_TYPE_VDPA, 542 533 &pf->vfs[pdsc->vf_id].padev); 534 + } else { 535 + pdsc_auxbus_dev_add(pdsc, pdsc, PDS_DEV_TYPE_FWCTL, 536 + &pdsc->padev); 543 537 } 544 538 } 545 539
+2
include/linux/pds/pds_common.h
··· 29 29 PDS_DEV_TYPE_ETH = 3, 30 30 PDS_DEV_TYPE_RDMA = 4, 31 31 PDS_DEV_TYPE_LM = 5, 32 + PDS_DEV_TYPE_FWCTL = 6, 32 33 33 34 /* new ones added before this line */ 34 35 PDS_DEV_TYPE_MAX = 16 /* don't change - used in struct size */ ··· 41 40 #define PDS_DEV_TYPE_ETH_STR "Eth" 42 41 #define PDS_DEV_TYPE_RDMA_STR "RDMA" 43 42 #define PDS_DEV_TYPE_LM_STR "LM" 43 + #define PDS_DEV_TYPE_FWCTL_STR "fwctl" 44 44 45 45 #define PDS_VDPA_DEV_NAME PDS_CORE_DRV_NAME "." PDS_DEV_TYPE_VDPA_STR 46 46 #define PDS_VFIO_LM_DEV_NAME PDS_CORE_DRV_NAME "." PDS_DEV_TYPE_LM_STR "." PDS_DEV_TYPE_VFIO_STR