Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion drivers/accel/amdxdna/amdxdna_pci_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ MODULE_FIRMWARE("amdnpu/1b0b_00/cert.dev.sbin");
#define AMDXDNA_DRIVER_MAJOR 0
#define AMDXDNA_DRIVER_MINOR 15

/* lockdep subclass for a VF's dev_lock, nested under the PF's default subclass. */
#define AMDXDNA_DEV_LOCK_SUBCLASS_VF 1

/*
* Bind the driver base on (vendor_id, device_id) pair and later use the
* (device_id, rev_id) pair as a key to select the devices. The devices with
Expand Down Expand Up @@ -457,7 +460,18 @@ static int amdxdna_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (ret)
return ret;

drmm_mutex_init(ddev, &xdna->dev_lock);
ret = drmm_mutex_init(ddev, &xdna->dev_lock);
if (ret)
return ret;

/*
* A VF's dev_lock is acquired in probe() while the PF still holds its
* own dev_lock across pci_enable_sriov(). They are distinct instances
* sharing one lock class, so nest the VF at a deeper subclass to keep
* lockdep from misreporting the hierarchical PF -> VF order.
*/
if (pdev->is_virtfn)
lockdep_set_subclass(&xdna->dev_lock, AMDXDNA_DEV_LOCK_SUBCLASS_VF);
init_rwsem(&xdna->notifier_lock);
INIT_LIST_HEAD(&xdna->client_list);
ida_init(&xdna->hwctx_ida);
Expand Down