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: <DM2PR0201MB076772D0D335A1C6A9F07CB2B8160@DM2PR0201MB0767.namprd02.prod.outlook.com>
Date:   Thu, 11 Jan 2018 00:35:43 +0000
From:   Jolly Shah <JOLLYS@...inx.com>
To:     Sudeep Holla <sudeep.holla@....com>,
        "ard.biesheuvel@...aro.org" <ard.biesheuvel@...aro.org>,
        "mingo@...nel.org" <mingo@...nel.org>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "matt@...eblueprint.co.uk" <matt@...eblueprint.co.uk>,
        "hkallweit1@...il.com" <hkallweit1@...il.com>,
        "keescook@...omium.org" <keescook@...omium.org>,
        "dmitry.torokhov@...il.com" <dmitry.torokhov@...il.com>,
        "michal.simek@...inx.com" <michal.simek@...inx.com>
CC:     "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Rajan Vaja <RAJANV@...inx.com>
Subject: RE: [PATCH] drivers: firmware: xilinx: Add ZynqMP firmware driver

Hi Sudeep,
Thanks for the review,

> -----Original Message-----
> From: Sudeep Holla [mailto:sudeep.holla@....com]
> Sent: Tuesday, January 09, 2018 6:40 AM
> To: Jolly Shah <JOLLYS@...inx.com>; ard.biesheuvel@...aro.org;
> mingo@...nel.org; gregkh@...uxfoundation.org; matt@...eblueprint.co.uk;
> hkallweit1@...il.com; keescook@...omium.org;
> dmitry.torokhov@...il.com; michal.simek@...inx.com
> Cc: Sudeep Holla <sudeep.holla@....com>; linux-arm-
> kernel@...ts.infradead.org; linux-kernel@...r.kernel.org; Jolly Shah
> <JOLLYS@...inx.com>; Rajan Vaja <RAJANV@...inx.com>
> Subject: Re: [PATCH] drivers: firmware: xilinx: Add ZynqMP firmware driver
> 
> 
> 
> On 08/01/18 22:07, Jolly Shah wrote:
> > This patch is adding communication layer with firmware.
> > Firmware driver provides an interface to firmware APIs.
> > Interface APIs can be used by any driver to communicate to
> > PMUFW(Platform Management Unit). All requests go through ATF.
> > Firmware-debug provides debugfs interface to all APIs.
> > Firmware-ggs provides read/write interface to global storage
> > registers.
> >
> > Signed-off-by: Jolly Shah <jollys@...inx.com>
> > Signed-off-by: Rajan Vaja <rajanv@...inx.com>
> > ---
> >  .../firmware/xilinx/xlnx,zynqmp-firmware.txt       |   16 +
> >  arch/arm64/Kconfig.platforms                       |    1 +
> >  drivers/firmware/Kconfig                           |    1 +
> >  drivers/firmware/Makefile                          |    1 +
> >  drivers/firmware/xilinx/Kconfig                    |    4 +
> >  drivers/firmware/xilinx/Makefile                   |    4 +
> >  drivers/firmware/xilinx/zynqmp/Kconfig             |   23 +
> >  drivers/firmware/xilinx/zynqmp/Makefile            |    5 +
> >  drivers/firmware/xilinx/zynqmp/firmware-debug.c    |  540 +++++++++++
> >  drivers/firmware/xilinx/zynqmp/firmware-ggs.c      |  298 ++++++
> >  drivers/firmware/xilinx/zynqmp/firmware.c          | 1024
> ++++++++++++++++++++
> >  .../linux/firmware/xilinx/zynqmp/firmware-debug.h  |   32 +
> >  include/linux/firmware/xilinx/zynqmp/firmware.h    |  573 +++++++++++
> >  13 files changed, 2522 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmware
> > .txt  create mode 100644 drivers/firmware/xilinx/Kconfig  create mode
> > 100644 drivers/firmware/xilinx/Makefile  create mode 100644
> > drivers/firmware/xilinx/zynqmp/Kconfig
> >  create mode 100644 drivers/firmware/xilinx/zynqmp/Makefile
> >  create mode 100644 drivers/firmware/xilinx/zynqmp/firmware-debug.c
> >  create mode 100644 drivers/firmware/xilinx/zynqmp/firmware-ggs.c
> >  create mode 100644 drivers/firmware/xilinx/zynqmp/firmware.c
> >  create mode 100644
> > include/linux/firmware/xilinx/zynqmp/firmware-debug.h
> >  create mode 100644 include/linux/firmware/xilinx/zynqmp/firmware.h
> >
> > diff --git
> > a/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa
> > re.txt
> > b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-firmwa
> > re.txt
> > new file mode 100644
> > index 0000000..ace111c
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/firmware/xilinx/xlnx,zynqmp-fi
> > +++ rmware.txt
> > @@ -0,0 +1,16 @@
> > +Xilinx Zynq MPSoC Firmware Device Tree Bindings
> > +
> > +The zynqmp-firmware node describes the interface to platform firmware.
> > +
> > +Required properties:
> > + - compatible:	Must contain:  "xlnx,zynqmp-firmware"
> > + - method:	The method of calling the PM-API firmware layer.
> > +		Permitted values are:
> > +		 - "smc" : To be used in configurations without a hypervisor
> > +		 - "hvc" : To be used when hypervisor is present
> > +
> 
> If we are having a mailbox using smc/hvc, then it can be made generic rather
> than xilinx specific. I can see other user of the same. As Jassi pointed out in
> some other thread, Andre has some generic implementation.
> Please see how it can be reused.
> 

Andre's mailbox implementation in not in kernel yet. We can change later if it 
satisfies our use case.

> Also please keep any bindings separate from the driver changes so that it can be
> reviewed separately.

Sure. Will do it in next version.

> 
> > +Examples:
> > +	firmware: firmware {
> > +		compatible = "xlnx,zynqmp-firmware";
> > +		method = "smc";
> 
> Ideally this should point to mailbox if we move to using smc/hvc based mailbox.
> 
> [...]
> 
> > +
> > +config ZYNQMP_FIRMWARE_DEBUG
> > +	bool "Enable Xilinx Zynq MPSoC firmware debug APIs"
> > +	depends on ARCH_ZYNQMP && DEBUG_FS
> 
> Do you need a separate Kconfig option, can't you just use DEBUG_FS ?
> 
> [...]
> 

As its zynqmp specific, we wanted to keep an option to enable/disable it separately.
It can be combined as ZYNQMP FIRMWARE+DEBUG_FS instead of a separate Kconfig.


> > +
> > +	if (strncasecmp(pm_api_req, "REQUEST_SUSPEND", 15) == 0)
> > +		pm_id = REQUEST_SUSPEND;
> > +	else if (strncasecmp(pm_api_req, "SELF_SUSPEND", 12) == 0)
> > +		pm_id = SELF_SUSPEND;
> > +	else if (strncasecmp(pm_api_req, "FORCE_POWERDOWN", 15) == 0)
> > +		pm_id = FORCE_POWERDOWN;
> > +	else if (strncasecmp(pm_api_req, "ABORT_SUSPEND", 13) == 0)
> > +		pm_id = ABORT_SUSPEND;
> 
> 
> Can this be changed to a loop with a static structure array containing {pm_id,
> pm_string, strlen(pm_string)} ?

Will fix it in next version

> 
> Also I see hard-coded string length is wrong in some cases like IOCTL.
> Isn't it better to just use strlen("..") instead ?
> 

Will fix it in next version

> I will stop here as the patch can be easily split and several features can be added
> incrementally making the base patch simpler and shorter.

Sure. Will break it into a few patches in next version

Thanks,
Jolly Shah

> 
> --
> Regards,
> Sudeep

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ