public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Xin Zeng <xin.zeng@intel.com>
Cc: herbert@gondor.apana.org.au, jgg@nvidia.com, yishaih@nvidia.com,
	shameerali.kolothum.thodi@huawei.com, kevin.tian@intel.com,
	linux-crypto@vger.kernel.org, kvm@vger.kernel.org,
	qat-linux@intel.com, Yahui Cao <yahui.cao@intel.com>
Subject: Re: [PATCH v4 10/10] vfio/qat: Add vfio_pci driver for Intel QAT VF devices
Date: Fri, 1 Mar 2024 16:58:48 -0700	[thread overview]
Message-ID: <20240301165848.37cfffaf.alex.williamson@redhat.com> (raw)
In-Reply-To: <20240228143402.89219-11-xin.zeng@intel.com>

On Wed, 28 Feb 2024 22:34:02 +0800
Xin Zeng <xin.zeng@intel.com> wrote:
> +static int
> +qat_vf_vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct qat_vf_core_device *qat_vdev;
> +	int ret;
> +
> +	if (!pci_match_id(id, pdev)) {
> +		pci_err(pdev, "Incompatible device, disallowing driver_override\n");
> +		return -ENODEV;
> +	}

I think the question of whether this is the right thing to do is still
up for debate, but as noted in the thread where I raised the question,
this mechanism doesn't actually work.

The probe callback is passed the matching ID from the set of dynamic
IDs added via new_id, the driver id_table, or pci_device_id_any for a
strictly driver_override match.  Any of those would satisfy
pci_match_id().

If we wanted the probe function to exclusively match devices in the
id_table, we should call this as:

	if (!pci_match_id(qat_vf_vfio_pci_table, pdev))...

If we wanted to still allow dynamic IDs, the test might be more like:

	if (id == &pci_device_id_any)...

Allowing dynamic IDs but failing driver_override requires a slightly
more sophisticated user, but is inconsistent.  Do we have any
consensus on this?  Thanks,

Alex


> +
> +	qat_vdev = vfio_alloc_device(qat_vf_core_device, core_device.vdev, dev, &qat_vf_pci_ops);
> +	if (IS_ERR(qat_vdev))
> +		return PTR_ERR(qat_vdev);
> +
> +	pci_set_drvdata(pdev, &qat_vdev->core_device);
> +	ret = vfio_pci_core_register_device(&qat_vdev->core_device);
> +	if (ret)
> +		goto out_put_device;
> +
> +	return 0;
> +
> +out_put_device:
> +	vfio_put_device(&qat_vdev->core_device.vdev);
> +	return ret;
> +}


  reply	other threads:[~2024-03-01 23:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 14:33 [PATCH v4 00/10] crypto: qat - enable QAT GEN4 SRIOV VF live migration for QAT GEN4 Xin Zeng
2024-02-28 14:33 ` [PATCH v4 01/10] crypto: qat - adf_get_etr_base() helper Xin Zeng
2024-03-04  9:18   ` Tian, Kevin
2024-02-28 14:33 ` [PATCH v4 02/10] crypto: qat - relocate and rename 4xxx PF2VM definitions Xin Zeng
2024-02-28 14:33 ` [PATCH v4 03/10] crypto: qat - move PFVF compat checker to a function Xin Zeng
2024-02-28 14:33 ` [PATCH v4 04/10] crypto: qat - relocate CSR access code Xin Zeng
2024-02-28 14:33 ` [PATCH v4 05/10] crypto: qat - rename get_sla_arr_of_type() Xin Zeng
2024-02-28 14:33 ` [PATCH v4 06/10] crypto: qat - expand CSR operations for QAT GEN4 devices Xin Zeng
2024-02-28 14:33 ` [PATCH v4 07/10] crypto: qat - add bank save and restore flows Xin Zeng
2024-02-28 14:34 ` [PATCH v4 08/10] crypto: qat - add interface for live migration Xin Zeng
2024-02-28 14:34 ` [PATCH v4 09/10] crypto: qat - implement " Xin Zeng
2024-02-28 14:34 ` [PATCH v4 10/10] vfio/qat: Add vfio_pci driver for Intel QAT VF devices Xin Zeng
2024-03-01 23:58   ` Alex Williamson [this message]
2024-03-04 11:10     ` Zeng, Xin
2024-03-05  7:43       ` Tian, Kevin
2024-03-05  7:37   ` Tian, Kevin
2024-03-06  2:47     ` Zeng, Xin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240301165848.37cfffaf.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=xin.zeng@intel.com \
    --cc=yahui.cao@intel.com \
    --cc=yishaih@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox