Re: [RFC v4 6/8] crypto: hisilicon/qm: Add helper to retrieve the PF qm data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 08, 2022 at 01:34:23PM +0000, Shameer Kolothum wrote:

> +struct hisi_qm *hisi_qm_get_pf_qm(struct pci_dev *pdev)
> +{
> +	struct hisi_qm	*pf_qm;
> +	struct pci_driver *(*fn)(void) = NULL;
> +
> +	if (!pdev->is_virtfn)
> +		return NULL;
> +
> +	switch (pdev->device) {
> +	case PCI_DEVICE_ID_HUAWEI_SEC_VF:
> +		fn = symbol_get(hisi_sec_get_pf_driver);
> +		break;
> +	case PCI_DEVICE_ID_HUAWEI_HPRE_VF:
> +		fn = symbol_get(hisi_hpre_get_pf_driver);
> +		break;
> +	case PCI_DEVICE_ID_HUAWEI_ZIP_VF:
> +		fn = symbol_get(hisi_zip_get_pf_driver);
> +		break;
> +	default:
> +		return NULL;
> +	}
> +
> +	if (!fn)
> +		return NULL;
> +
> +	pf_qm = pci_iov_get_pf_drvdata(pdev, fn());
> +
> +	if (pdev->device == PCI_DEVICE_ID_HUAWEI_SEC_VF)
> +		symbol_put(hisi_sec_get_pf_driver);
> +	else if (pdev->device == PCI_DEVICE_ID_HUAWEI_HPRE_VF)
> +		symbol_put(hisi_hpre_get_pf_driver);
> +	else
> +		symbol_put(hisi_zip_get_pf_driver);
> +
> +	return !IS_ERR(pf_qm) ? pf_qm : NULL;
> +}
> +EXPORT_SYMBOL_GPL(hisi_qm_get_pf_qm);

Why put this in this driver, why not in the vfio driver? And why use
symbol_get ?

Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux