Re: [PATCH v3 04/18] nitro_enclaves: Init PCI device driver

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

 



On Tue, May 26, 2020 at 09:35:33PM +0300, Paraschiv, Andra-Irina wrote:
> 
> 
> On 26/05/2020 09:48, Greg KH wrote:
> > On Tue, May 26, 2020 at 01:13:20AM +0300, Andra Paraschiv wrote:
> > > The Nitro Enclaves PCI device is used by the kernel driver as a means of
> > > communication with the hypervisor on the host where the primary VM and
> > > the enclaves run. It handles requests with regard to enclave lifetime.
> > > 
> > > Setup the PCI device driver and add support for MSI-X interrupts.
> > > 
> > > Signed-off-by: Alexandru-Catalin Vasile <lexnv@xxxxxxxxxx>
> > > Signed-off-by: Alexandru Ciobotaru <alcioa@xxxxxxxxxx>
> > > Signed-off-by: Andra Paraschiv <andraprs@xxxxxxxxxx>
> > > ---
> > > Changelog
> > > 
> > > v2 -> v3
> > > 
> > > * Remove the GPL additional wording as SPDX-License-Identifier is already in
> > > place.
> > > * Remove the WARN_ON calls.
> > > * Remove linux/bug include that is not needed.
> > > * Update static calls sanity checks.
> > > * Remove "ratelimited" from the logs that are not in the ioctl call paths.
> > > * Update kzfree() calls to kfree().
> > > 
> > > v1 -> v2
> > > 
> > > * Add log pattern for NE.
> > > * Update PCI device setup functions to receive PCI device data structure and
> > > then get private data from it inside the functions logic.
> > > * Remove the BUG_ON calls.
> > > * Add teardown function for MSI-X setup.
> > > * Update goto labels to match their purpose.
> > > * Implement TODO for NE PCI device disable state check.
> > > * Update function name for NE PCI device probe / remove.
> > > ---
> > >   drivers/virt/nitro_enclaves/ne_pci_dev.c | 252 +++++++++++++++++++++++
> > >   1 file changed, 252 insertions(+)
> > >   create mode 100644 drivers/virt/nitro_enclaves/ne_pci_dev.c
> > > 
> > > diff --git a/drivers/virt/nitro_enclaves/ne_pci_dev.c b/drivers/virt/nitro_enclaves/ne_pci_dev.c
> > > new file mode 100644
> > > index 000000000000..0b66166787b6
> > > --- /dev/null
> > > +++ b/drivers/virt/nitro_enclaves/ne_pci_dev.c
> > > @@ -0,0 +1,252 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
> > > + */
> > > +
> > > +/* Nitro Enclaves (NE) PCI device driver. */
> > > +
> > > +#include <linux/delay.h>
> > > +#include <linux/device.h>
> > > +#include <linux/list.h>
> > > +#include <linux/mutex.h>
> > > +#include <linux/module.h>
> > > +#include <linux/nitro_enclaves.h>
> > > +#include <linux/pci.h>
> > > +#include <linux/types.h>
> > > +#include <linux/wait.h>
> > > +
> > > +#include "ne_misc_dev.h"
> > > +#include "ne_pci_dev.h"
> > > +
> > > +#define DEFAULT_TIMEOUT_MSECS (120000) /* 120 sec */
> > > +
> > > +#define NE "nitro_enclaves: "
> > Why is this needed?  The dev_* functions should give you all the
> > information that you need to properly describe the driver and device in
> > question.  No extra "prefixes" should be needed at all.
> 
> This was needed to have an identifier for the overall NE logic - PCI dev,
> ioctl and misc dev.

Why?  They are all different "devices", and refer to different
interfaces.  Stick to what the dev_* gives you for them.  You probably
want to stick with the pci dev for almost all of those anyway.

> The ioctl and misc dev logic has pr_* logs, but I can update them to dev_*
> with misc dev, then remove this prefix.

That would be good, thanks.

greg k-h



[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