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]
Date:   Mon, 28 Jan 2019 09:44:25 +0200
From:   Oded Gabbay <oded.gabbay@...il.com>
To:     Mike Rapoport <rppt@...ux.ibm.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Linux-Kernel@...r. Kernel. Org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 03/15] habanalabs: add basic Goya support

On Sun, Jan 27, 2019 at 8:39 AM Mike Rapoport <rppt@...ux.ibm.com> wrote:
>
> On Fri, Jan 25, 2019 at 10:32:55PM +0200, Oded Gabbay wrote:
> > On Wed, Jan 23, 2019 at 2:28 PM Mike Rapoport <rppt@...ux.ibm.com> wrote:
> > >
> > > On Wed, Jan 23, 2019 at 02:00:45AM +0200, Oded Gabbay wrote:
> > > > This patch adds a basic support for the Goya device. The code initializes
> > > > the device's PCI controller and PCI bars. It also initializes various S/W
> > > > structures and adds some basic helper functions.
> > > >
> > > > Signed-off-by: Oded Gabbay <oded.gabbay@...il.com>
> > > > ---
> > > >  drivers/misc/habanalabs/Makefile            |   5 +-
> > > >  drivers/misc/habanalabs/device.c            |  71 +++
> > > >  drivers/misc/habanalabs/goya/Makefile       |   3 +
> > > >  drivers/misc/habanalabs/goya/goya.c         | 633 ++++++++++++++++++++
> > > >  drivers/misc/habanalabs/goya/goyaP.h        | 125 ++++
> > > >  drivers/misc/habanalabs/habanalabs.h        | 131 ++++
> > > >  drivers/misc/habanalabs/habanalabs_drv.c    |   3 +
> > > >  drivers/misc/habanalabs/include/goya/goya.h | 115 ++++
> > > >  8 files changed, 1085 insertions(+), 1 deletion(-)
> > > >  create mode 100644 drivers/misc/habanalabs/goya/Makefile
> > > >  create mode 100644 drivers/misc/habanalabs/goya/goya.c
> > > >  create mode 100644 drivers/misc/habanalabs/goya/goyaP.h
> > > >  create mode 100644 drivers/misc/habanalabs/include/goya/goya.h
>
> [ ... ]
>
> > > > +
> > > > +/**
> > > > + * goya_sw_init - Goya software initialization code
> > > > + *
> > > > + * @hdev: pointer to hl_device structure
> > > > + *
> > > > + */
> > > > +static int goya_sw_init(struct hl_device *hdev)
> > > > +{
> > > > +     struct goya_device *goya;
> > > > +     int rc;
> > > > +
> > > > +     /* Allocate device structure */
> > > > +     goya = kzalloc(sizeof(*goya), GFP_KERNEL);
> > >
> > > Consider using devm_k[mz]alloc() for memory allocations throughout the
> > > driver. I didn't check all the spots where it can be applicable.
> > I honestly wasn't aware of that. We never used that in AMD drivers
> > (which where I spent most of my kernel time).
> > I'll look into that offline but for now I don't really want to change
> > into it blindly in all locations, unless there is some hard kernel
> > rule for using that in drivers.
>
> AFAIK, there's no such rule. It's just supposed to make driver
> developer/maintainer life easier ;-)
>
> > >
> > > > +     if (!goya)
> > > > +             return -ENOMEM;
> > > > +
> > > > +     /* according to goya_init_iatu */
> > > > +     goya->ddr_bar_cur_addr = DRAM_PHYS_BASE;
> > > > +     hdev->asic_specific = goya;
> > > > +
> > > > +     /* Create DMA pool for small allocations */
> > > > +     hdev->dma_pool = dma_pool_create(dev_name(hdev->dev),
> > > > +                     &hdev->pdev->dev, GOYA_DMA_POOL_BLK_SIZE, 8, 0);
> > > > +     if (!hdev->dma_pool) {
> > > > +             dev_err(hdev->dev, "failed to create DMA pool\n");
> > > > +             rc = -ENOMEM;
> > > > +             goto free_goya_device;
> > > > +     }
> > > > +
>
> [ ... ]
>
> > > > +
> > > > +static const struct hl_asic_funcs goya_funcs = {
> > > > +     .early_init = goya_early_init,
> > > > +     .early_fini = goya_early_fini,
> > > > +     .sw_init = goya_sw_init,
> > > > +     .sw_fini = goya_sw_fini,
> > > > +     .suspend = goya_suspend,
> > > > +     .resume = goya_resume,
> > > > +     .dma_alloc_coherent = goya_dma_alloc_coherent,
> > > > +     .dma_free_coherent = goya_dma_free_coherent,
> > >
> > > Is there any additional functionality that is planned in goya or gaudi in
> > > these two functions?
> > > It seems like they are not really needed, at least at the moment and for
> > > sure that don't need to be part of ASIC ops.
> >
> > So this relates to the simulator support, because there the
> > implementation of these two functions is totally different as I don't
> > have pci device.
>
> Can you please add a comment about it here?
Of course, done.
Thanks,
Oded

>
> --
> Sincerely yours,
> Mike.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ