lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220208142525.GE4160@nvidia.com>
Date:   Tue, 8 Feb 2022 10:25:25 -0400
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Shameer Kolothum <shameerali.kolothum.thodi@...wei.com>
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-crypto@...r.kernel.org, alex.williamson@...hat.com,
        cohuck@...hat.com, mgurtovoy@...dia.com, yishaih@...dia.com,
        linuxarm@...wei.com, liulongfang@...wei.com,
        prime.zeng@...ilicon.com, jonathan.cameron@...wei.com,
        wangzhou1@...ilicon.com
Subject: Re: [RFC v4 6/8] crypto: hisilicon/qm: Add helper to retrieve the PF
 qm data

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ