Netdev List
 help / color / mirror / Atom feed
From: Brett Creeley <bcreeley@amd.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Brett Creeley <brett.creeley@amd.com>,
	kvm@vger.kernel.org, netdev@vger.kernel.org, jgg@nvidia.com,
	yishaih@nvidia.com, shameerali.kolothum.thodi@huawei.com,
	kevin.tian@intel.com, shannon.nelson@amd.com
Subject: Re: [PATCH v5 vfio 3/7] vfio/pds: register with the pds_core PF
Date: Mon, 27 Mar 2023 09:19:01 -0700	[thread overview]
Message-ID: <c273282e-6719-6ea8-bf3b-1d470f4751b4@amd.com> (raw)
In-Reply-To: <20230324164711.6aeb40b2.alex.williamson@redhat.com>

On 3/24/2023 3:47 PM, Alex Williamson wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> On Fri, 24 Mar 2023 15:36:57 -0700
> Brett Creeley <bcreeley@amd.com> wrote:
> 
>> On 3/24/2023 3:02 PM, Alex Williamson wrote:
>>> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>>>
>>>
>>> On Wed, 22 Mar 2023 13:34:38 -0700
>>> Brett Creeley <brett.creeley@amd.com> wrote:
>>>
>>>> The pds_core driver will supply adminq services, so find the PF
>>>> and register with the DSC services.
>>>>
>>>> Use the following commands to enable a VF:
>>>> echo 1 > /sys/bus/pci/drivers/pds_core/$PF_BDF/sriov_numvfs
>>>>
>>>> Signed-off-by: Brett Creeley <brett.creeley@amd.com>
>>>> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
>>>> ---
>>>>    drivers/vfio/pci/pds/Makefile   |  1 +
>>>>    drivers/vfio/pci/pds/cmds.c     | 67 +++++++++++++++++++++++++++++++++
>>>>    drivers/vfio/pci/pds/cmds.h     | 12 ++++++
>>>>    drivers/vfio/pci/pds/pci_drv.c  | 16 +++++++-
>>>>    drivers/vfio/pci/pds/pci_drv.h  |  9 +++++
>>>>    drivers/vfio/pci/pds/vfio_dev.c |  5 +++
>>>>    drivers/vfio/pci/pds/vfio_dev.h |  2 +
>>>>    include/linux/pds/pds_lm.h      | 12 ++++++
>>>>    8 files changed, 123 insertions(+), 1 deletion(-)
>>>>    create mode 100644 drivers/vfio/pci/pds/cmds.c
>>>>    create mode 100644 drivers/vfio/pci/pds/cmds.h
>>>>    create mode 100644 drivers/vfio/pci/pds/pci_drv.h
>>>>    create mode 100644 include/linux/pds/pds_lm.h
>>>>
>>>> diff --git a/drivers/vfio/pci/pds/Makefile b/drivers/vfio/pci/pds/Makefile
>>>> index e1a55ae0f079..87581111fa17 100644
>>>> --- a/drivers/vfio/pci/pds/Makefile
>>>> +++ b/drivers/vfio/pci/pds/Makefile
>>>> @@ -4,5 +4,6 @@
>>>>    obj-$(CONFIG_PDS_VFIO_PCI) += pds_vfio.o
>>>>
>>>>    pds_vfio-y := \
>>>> +     cmds.o          \
>>>>         pci_drv.o       \
>>>>         vfio_dev.o
>>>> diff --git a/drivers/vfio/pci/pds/cmds.c b/drivers/vfio/pci/pds/cmds.c
>>>> new file mode 100644
>>>> index 000000000000..26e383ec4544
>>>> --- /dev/null
>>>> +++ b/drivers/vfio/pci/pds/cmds.c
>>>> @@ -0,0 +1,67 @@
>>>> +// SPDX-License-Identifier: GPL-2.0
>>>> +/* Copyright(c) 2023 Advanced Micro Devices, Inc. */
>>>> +
>>>> +#include <linux/io.h>
>>>> +#include <linux/types.h>
>>>> +
>>>> +#include <linux/pds/pds_common.h>
>>>> +#include <linux/pds/pds_core_if.h>
>>>> +#include <linux/pds/pds_adminq.h>
>>>> +#include <linux/pds/pds_lm.h>
>>>> +
>>>> +#include "vfio_dev.h"
>>>> +#include "cmds.h"
>>>> +
>>>> +int
>>>> +pds_vfio_register_client_cmd(struct pds_vfio_pci_device *pds_vfio)
>>>> +{
>>>> +     union pds_core_adminq_comp comp = { 0 };
>>>> +     union pds_core_adminq_cmd cmd = { 0 };
>>>> +     struct device *dev;
>>>> +     int err, id;
>>>> +     u16 ci;
>>>> +
>>>> +     id = PCI_DEVID(pds_vfio->pdev->bus->number,
>>>> +                    pci_iov_virtfn_devfn(pds_vfio->pdev, pds_vfio->vf_id));
>>>> +
>>>> +     dev = &pds_vfio->pdev->dev;
>>>> +     cmd.client_reg.opcode = PDS_AQ_CMD_CLIENT_REG;
>>>> +     snprintf(cmd.client_reg.devname, sizeof(cmd.client_reg.devname),
>>>> +              "%s.%d", PDS_LM_DEV_NAME, id);
>>>
>>> Does this devname need to be unique, and if so should it factor in
>>> pci_domain_nr()?  The array seems to be wide enough to easily hold the
>>> VF dev_name() but I haven't followed if there are additional
>>> constraints.  Thanks,
>>>
>>> Alex
>>>
>>>> +
>>
>> Hey Alex,
>>
>> We used the PCI_DEVID (id) as the suffix, which should be good enough to
>> provide uniqueness for each devname.
> 
> But PCI_DEVID is not unique unless this device is guaranteed never to
> run on a system with multiple PCI segments, including cases where these
> PFs and VFs might be assigned to multi-segment VMs.  Thanks,
> 
> Alex

Okay, that makes sense. Thanks for the feedback. We will rework the 
devname and repost.

Thanks,

Brett

  reply	other threads:[~2023-03-27 16:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 20:34 [PATCH v5 vfio 0/7] pds_vfio driver Brett Creeley
2023-03-22 20:34 ` [PATCH v5 vfio 1/7] vfio: Commonize combine_ranges for use in other VFIO drivers Brett Creeley
2023-03-22 20:34 ` [PATCH v5 vfio 2/7] vfio/pds: Initial support for pds_vfio VFIO driver Brett Creeley
2023-03-22 20:34 ` [PATCH v5 vfio 3/7] vfio/pds: register with the pds_core PF Brett Creeley
2023-03-24 22:02   ` Alex Williamson
2023-03-24 22:36     ` Brett Creeley
2023-03-24 22:47       ` Alex Williamson
2023-03-27 16:19         ` Brett Creeley [this message]
2023-03-22 20:34 ` [PATCH v5 vfio 4/7] vfio/pds: Add VFIO live migration support Brett Creeley
2023-03-22 20:34 ` [PATCH v5 vfio 5/7] vfio/pds: Add support for dirty page tracking Brett Creeley
2023-03-22 20:34 ` [PATCH v5 vfio 6/7] vfio/pds: Add support for firmware recovery Brett Creeley
2023-03-22 20:34 ` [PATCH v5 vfio 7/7] vfio/pds: Add Kconfig and documentation Brett Creeley

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=c273282e-6719-6ea8-bf3b-1d470f4751b4@amd.com \
    --to=bcreeley@amd.com \
    --cc=alex.williamson@redhat.com \
    --cc=brett.creeley@amd.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=shannon.nelson@amd.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