* Re: [PATCH 29/44] staging: nvec: Register with kernel poweroff handler
From: Greg Kroah-Hartman @ 2014-10-07 16:23 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja, linux-mips, linux-efi, linux-ia64, linux-xtensa,
devel, linux-s390, lguest, linux-c6x-dev, linux-hexagon, linux-sh,
linux-acpi, xen-devel, devicetree, user-mode-linux-devel,
linux-pm, Julian Andres Klode, adi-buildroot-devel, linux-m68k,
linux-am33-list, linux-tegra, openipmi-developer, linux-metag,
linux-arm-kernel, linux-parisc, linux-cris-kernel, linux-kernel,
linux-alpha, linuxppc-dev
In-Reply-To: <1412659726-29957-30-git-send-email-linux@roeck-us.net>
On Mon, Oct 06, 2014 at 10:28:31PM -0700, Guenter Roeck wrote:
> Register with kernel poweroff handler instead of setting pm_power_off
> directly. Register with default priority value of 128 since we don't know
> any better.
>
> Cc: Julian Andres Klode <jak@jak-linux.org>
> Cc: Marc Dietrich <marvin24@gmx.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/staging/nvec/nvec.c | 24 +++++++++++++++---------
> drivers/staging/nvec/nvec.h | 2 ++
> 2 files changed, 17 insertions(+), 9 deletions(-)
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply
* Re: [PATCH 05/44] mfd: as3722: Drop reference to pm_power_off from devicetree bindings
From: Rob Landley @ 2014-10-07 16:21 UTC (permalink / raw)
To: Guenter Roeck, linux-kernel
Cc: linux-m32r-ja, linux-mips, linux-efi, linux-ia64, linux-xtensa,
Mark Rutland, devel, linux-s390, lguest, linux-c6x-dev,
linux-hexagon, linux-sh, linux-acpi, Pawel Moll, xen-devel,
devicetree, user-mode-linux-devel, linux-pm, adi-buildroot-devel,
linux-m68k, linux-am33-list, linux-tegra, openipmi-developer,
linux-metag, linux-arm-kernel, linux-parisc, linux-cris-kernel,
Rob Herring, linux-alpha, linuxppc-dev
In-Reply-To: <1412659726-29957-6-git-send-email-linux@roeck-us.net>
On 10/07/14 00:28, Guenter Roeck wrote:
> Devicetree bindings are supposed to be operating system independent
> and should thus not describe how a specific functionality is implemented
> in Linux.
So your argument is that linux/Documentation/devicetree/bindings should
not be specific to Linux. Merely hosted in the Linux kernel source
repository.
Well that's certainly a point of view.
Rob
^ permalink raw reply
* Re: [PATCH 20/44] power/reset: restart-poweroff: Register with kernel poweroff handler
From: Andrew Lunn @ 2014-10-07 16:06 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja, linux-mips, linux-efi, linux-ia64, linux-sh,
Sebastian Reichel, devicetree, devel, linux-s390, lguest,
linux-c6x-dev, Dmitry Eremin-Solenikov, linux-hexagon, linux-acpi,
xen-devel, linux-xtensa, user-mode-linux-devel, linux-pm,
adi-buildroot-devel, linux-m68k, linux-am33-list, linux-tegra,
openipmi-developer, linux-metag, linux-arm-kernel,
linux-cris-kernel, linux-parisc, linuxppc-dev, linux-kernel,
linux-alpha, David Woodhouse
In-Reply-To: <1412659726-29957-21-git-send-email-linux@roeck-us.net>
On Mon, Oct 06, 2014 at 10:28:22PM -0700, Guenter Roeck wrote:
> Register with kernel poweroff handler instead of seting pm_power_off
> directly. Register as poweroff handler of last resort since the driver
> does not really power off the system but executes a restart.
I would not say last resort, this is how it is designed to work. There
is no way to turn the power off from with linux, it is designed that
u-boot will put the hardware into minimal power consumption until the
"power" button is pressed.
Other than that,
Acked-by: Andrew Lunn <andrew@lunn.ch>
Thanks
Andrew
>
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/power/reset/restart-poweroff.c | 25 ++++++++++++-------------
> 1 file changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/power/reset/restart-poweroff.c b/drivers/power/reset/restart-poweroff.c
> index edd707e..5437697 100644
> --- a/drivers/power/reset/restart-poweroff.c
> +++ b/drivers/power/reset/restart-poweroff.c
> @@ -12,35 +12,34 @@
> */
> #include <linux/kernel.h>
> #include <linux/init.h>
> +#include <linux/notifier.h>
> #include <linux/platform_device.h>
> #include <linux/of_platform.h>
> #include <linux/module.h>
> +#include <linux/pm.h>
> #include <linux/reboot.h>
> -#include <asm/system_misc.h>
>
> -static void restart_poweroff_do_poweroff(void)
> +static int restart_poweroff_do_poweroff(struct notifier_block *this,
> + unsigned long unused1, void *unused2)
> {
> reboot_mode = REBOOT_HARD;
> machine_restart(NULL);
> +
> + return NOTIFY_DONE;
> }
>
> +static struct notifier_block restart_poweroff_handler = {
> + .notifier_call = restart_poweroff_do_poweroff,
> +};
> +
> static int restart_poweroff_probe(struct platform_device *pdev)
> {
> - /* If a pm_power_off function has already been added, leave it alone */
> - if (pm_power_off != NULL) {
> - dev_err(&pdev->dev,
> - "pm_power_off function already registered");
> - return -EBUSY;
> - }
> -
> - pm_power_off = &restart_poweroff_do_poweroff;
> - return 0;
> + return register_poweroff_handler(&restart_poweroff_handler);
> }
>
> static int restart_poweroff_remove(struct platform_device *pdev)
> {
> - if (pm_power_off == &restart_poweroff_do_poweroff)
> - pm_power_off = NULL;
> + unregister_poweroff_handler(&restart_poweroff_handler);
>
> return 0;
> }
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 23/44] power/reset: qnap-poweroff: Register with kernel poweroff handler
From: Andrew Lunn @ 2014-10-07 16:02 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja, linux-mips, linux-efi, linux-ia64, linux-sh,
Sebastian Reichel, devicetree, devel, linux-s390, lguest,
linux-c6x-dev, Dmitry Eremin-Solenikov, linux-hexagon, linux-acpi,
xen-devel, linux-xtensa, user-mode-linux-devel, linux-pm,
adi-buildroot-devel, linux-m68k, linux-am33-list, linux-tegra,
openipmi-developer, linux-metag, linux-arm-kernel,
linux-cris-kernel, linux-parisc, linuxppc-dev, linux-kernel,
linux-alpha, David Woodhouse
In-Reply-To: <1412659726-29957-24-git-send-email-linux@roeck-us.net>
On Mon, Oct 06, 2014 at 10:28:25PM -0700, Guenter Roeck wrote:
> Register with kernel poweroff handler instead of setting pm_power_off
> directly. Register with default priority value of 128 to reflect that
> the original code generates an error if another poweroff handler has
> already been registered when the driver is loaded.
>
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Thanks
Andrew
> ---
> drivers/power/reset/qnap-poweroff.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/power/reset/qnap-poweroff.c b/drivers/power/reset/qnap-poweroff.c
> index a75db7f..c474980 100644
> --- a/drivers/power/reset/qnap-poweroff.c
> +++ b/drivers/power/reset/qnap-poweroff.c
> @@ -16,7 +16,9 @@
>
> #include <linux/kernel.h>
> #include <linux/module.h>
> +#include <linux/notifier.h>
> #include <linux/platform_device.h>
> +#include <linux/pm.h>
> #include <linux/serial_reg.h>
> #include <linux/kallsyms.h>
> #include <linux/of.h>
> @@ -55,7 +57,8 @@ static void __iomem *base;
> static unsigned long tclk;
> static const struct power_off_cfg *cfg;
>
> -static void qnap_power_off(void)
> +static int qnap_power_off(struct notifier_block *this, unsigned long unused1,
> + void *unused2)
> {
> const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud));
>
> @@ -72,14 +75,20 @@ static void qnap_power_off(void)
>
> /* send the power-off command to PIC */
> writel(cfg->cmd, UART1_REG(TX));
> +
> + return NOTIFY_DONE;
> }
>
> +static struct notifier_block qnap_poweroff_nb = {
> + .notifier_call = qnap_power_off,
> + .priority = 128,
> +};
> +
> static int qnap_power_off_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> struct resource *res;
> struct clk *clk;
> - char symname[KSYM_NAME_LEN];
>
> const struct of_device_id *match =
> of_match_node(qnap_power_off_of_match_table, np);
> @@ -106,22 +115,13 @@ static int qnap_power_off_probe(struct platform_device *pdev)
>
> tclk = clk_get_rate(clk);
>
> - /* Check that nothing else has already setup a handler */
> - if (pm_power_off) {
> - lookup_symbol_name((ulong)pm_power_off, symname);
> - dev_err(&pdev->dev,
> - "pm_power_off already claimed %p %s",
> - pm_power_off, symname);
> - return -EBUSY;
> - }
> - pm_power_off = qnap_power_off;
> -
> - return 0;
> + return register_poweroff_handler(&qnap_poweroff_nb);
> }
>
> static int qnap_power_off_remove(struct platform_device *pdev)
> {
> - pm_power_off = NULL;
> + unregister_poweroff_handler(&qnap_poweroff_nb);
> +
> return 0;
> }
>
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 21/44] power/reset: gpio-poweroff: Register with kernel poweroff handler
From: Andrew Lunn @ 2014-10-07 16:00 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja, linux-mips, linux-efi, linux-ia64, linux-sh,
Sebastian Reichel, devicetree, devel, linux-s390, lguest,
linux-c6x-dev, Dmitry Eremin-Solenikov, linux-hexagon, linux-acpi,
xen-devel, linux-xtensa, user-mode-linux-devel, linux-pm,
adi-buildroot-devel, linux-m68k, linux-am33-list, linux-tegra,
openipmi-developer, linux-metag, linux-arm-kernel,
linux-cris-kernel, linux-parisc, linuxppc-dev, linux-kernel,
linux-alpha, David Woodhouse
In-Reply-To: <1412659726-29957-22-git-send-email-linux@roeck-us.net>
On Mon, Oct 06, 2014 at 10:28:23PM -0700, Guenter Roeck wrote:
> Register with kernel poweroff handler instead of setting pm_power_off
> directly. Register with a low priority value of 64 to reflect that
> the original code only sets pm_power_off if it was not already set.
>
> Other changes:
>
> Drop note that there can not be an additional instance of this driver.
> The original reason no longer applies, it should be obvious that there
> can only be one instance of the driver if static variables are used to
> reflect its state, and support for multiple instances can now be added
> easily if needed by avoiding static variables.
>
> Do not create an error message if another poweroff handler has already been
> registered. This is perfectly normal and acceptable.
>
> Do not display a warning traceback if the poweroff handler fails to
> power off the system. There may be other poweroff handlers.
I would prefer to keep the warning traceback. We found on some
hardware the GPIO transitions were too fast and it failed to power
off. Seeing the traceback gives an idea where to go look for the
problem.
Other than that,
Acked-by: Andrew Lunn <andrew@lunn.ch>
>
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/power/reset/gpio-poweroff.c | 36 ++++++++++++++++++------------------
> 1 file changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
> index ce849bc..e95a7a1 100644
> --- a/drivers/power/reset/gpio-poweroff.c
> +++ b/drivers/power/reset/gpio-poweroff.c
> @@ -14,18 +14,18 @@
> #include <linux/kernel.h>
> #include <linux/init.h>
> #include <linux/delay.h>
> +#include <linux/notifier.h>
> +#include <linux/pm.h>
> #include <linux/platform_device.h>
> #include <linux/gpio/consumer.h>
> #include <linux/of_platform.h>
> #include <linux/module.h>
>
> -/*
> - * Hold configuration here, cannot be more than one instance of the driver
> - * since pm_power_off itself is global.
> - */
> static struct gpio_desc *reset_gpio;
>
> -static void gpio_poweroff_do_poweroff(void)
> +static int gpio_poweroff_do_poweroff(struct notifier_block *this,
> + unsigned long unused1, void *unused2)
> +
> {
> BUG_ON(!reset_gpio);
>
> @@ -42,20 +42,18 @@ static void gpio_poweroff_do_poweroff(void)
> /* give it some time */
> mdelay(3000);
>
> - WARN_ON(1);
> + return NOTIFY_DONE;
> }
>
> +static struct notifier_block gpio_poweroff_nb = {
> + .notifier_call = gpio_poweroff_do_poweroff,
> + .priority = 64,
> +};
> +
> static int gpio_poweroff_probe(struct platform_device *pdev)
> {
> bool input = false;
> -
> - /* If a pm_power_off function has already been added, leave it alone */
> - if (pm_power_off != NULL) {
> - dev_err(&pdev->dev,
> - "%s: pm_power_off function already registered",
> - __func__);
> - return -EBUSY;
> - }
> + int err;
>
> reset_gpio = devm_gpiod_get(&pdev->dev, NULL);
> if (IS_ERR(reset_gpio))
> @@ -77,14 +75,16 @@ static int gpio_poweroff_probe(struct platform_device *pdev)
> }
> }
>
> - pm_power_off = &gpio_poweroff_do_poweroff;
> - return 0;
> + err = register_poweroff_handler(&gpio_poweroff_nb);
> + if (err)
> + dev_err(&pdev->dev, "Failed to register poweroff handler\n");
> +
> + return err;
> }
>
> static int gpio_poweroff_remove(struct platform_device *pdev)
> {
> - if (pm_power_off == &gpio_poweroff_do_poweroff)
> - pm_power_off = NULL;
> + unregister_poweroff_handler(&gpio_poweroff_nb);
>
> return 0;
> }
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 07/44] qnap-poweroff: Drop reference to pm_power_off from devicetree bindings
From: Guenter Roeck @ 2014-10-07 15:57 UTC (permalink / raw)
To: Mark Rutland
Cc: linux-m32r-ja@ml.linux-m32r.org, linux-mips@linux-mips.org,
linux-m68k@vger.kernel.org, linux-efi@vger.kernel.org,
linux-ia64@vger.kernel.org, linux-xtensa@linux-xtensa.org,
devel@driverdev.osuosl.org, linux-s390@vger.kernel.org,
lguest@lists.ozlabs.org, linux-c6x-dev@linux-c6x.org,
linux-hexagon@vger.kernel.org, linux-sh@vger.kernel.org,
linux-acpi@vger.kernel.org, Pawel Moll,
xen-devel@lists.xenproject.org, devicetree@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net,
linux-pm@vger.kernel.org,
adi-buildroot-devel@lists.sourceforge.net,
linux-am33-list@redhat.com, linux-tegra@vger.kernel.org,
openipmi-developer@lists.sourceforge.net,
linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com,
linux-kernel@vger.kernel.org, Rob Herring,
linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20141007110219.GE24725@leverpostej>
On Tue, Oct 07, 2014 at 12:02:19PM +0100, Mark Rutland wrote:
> On Tue, Oct 07, 2014 at 06:28:09AM +0100, Guenter Roeck wrote:
> > Replace reference to pm_power_off (which is an implementation detail)
> > and replace it with a more generic description of the driver's functionality.
> >
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Pawel Moll <pawel.moll@arm.com>
> > Cc: Mark Rutland <mark.rutland@arm.com>
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> > index af25e77..1e2260a 100644
> > --- a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> > +++ b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> > @@ -3,8 +3,8 @@
> > QNAP NAS devices have a microcontroller controlling the main power
> > supply. This microcontroller is connected to UART1 of the Kirkwood and
> > Orion5x SoCs. Sending the character 'A', at 19200 baud, tells the
> > -microcontroller to turn the power off. This driver adds a handler to
> > -pm_power_off which is called to turn the power off.
> > +microcontroller to turn the power off. This driver installs a handler
> > +to power off the system.
>
> I'd remove the last sentence -- the driver is also independent of the
> HW, and the description of how the power off works at the HW level is
> sufficient.
>
Done.
> With that:
>
> Acked-by: Mark Rutland <mark.rutland@arm.com>
>
Thanks!
Guenter
^ permalink raw reply
* Re: [PATCH 07/44] qnap-poweroff: Drop reference to pm_power_off from devicetree bindings
From: Andrew Lunn @ 2014-10-07 15:51 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja, linux-mips, linux-efi, linux-ia64, linux-sh,
devicetree, Mark Rutland, devel, linux-s390, lguest,
linux-c6x-dev, linux-hexagon, linux-acpi, xen-devel, linux-xtensa,
Pawel Moll, linux-pm, adi-buildroot-devel, linux-m68k,
linux-am33-list, linux-tegra, openipmi-developer, linux-metag,
linux-arm-kernel, linux-cris-kernel, linux-parisc, linux-kernel,
Rob Herring, linux-alpha, user-mode-linux-devel, linuxppc-dev
In-Reply-To: <1412659726-29957-8-git-send-email-linux@roeck-us.net>
On Mon, Oct 06, 2014 at 10:28:09PM -0700, Guenter Roeck wrote:
> Replace reference to pm_power_off (which is an implementation detail)
> and replace it with a more generic description of the driver's functionality.
Acked-by: Andrew Lunn <andrew@lunn.ch>
Thanks
Andrew
>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> index af25e77..1e2260a 100644
> --- a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> +++ b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> @@ -3,8 +3,8 @@
> QNAP NAS devices have a microcontroller controlling the main power
> supply. This microcontroller is connected to UART1 of the Kirkwood and
> Orion5x SoCs. Sending the character 'A', at 19200 baud, tells the
> -microcontroller to turn the power off. This driver adds a handler to
> -pm_power_off which is called to turn the power off.
> +microcontroller to turn the power off. This driver installs a handler
> +to power off the system.
>
> Synology NAS devices use a similar scheme, but a different baud rate,
> 9600, and a different character, '1'.
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 06/44] gpio-poweroff: Drop reference to pm_power_off from devicetree bindings
From: Andrew Lunn @ 2014-10-07 15:50 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja, linux-mips, linux-efi, linux-ia64, linux-sh,
devicetree, Mark Rutland, devel, linux-s390, lguest,
linux-c6x-dev, linux-hexagon, linux-acpi, xen-devel, linux-xtensa,
Pawel Moll, linux-pm, adi-buildroot-devel, linux-m68k,
linux-am33-list, linux-tegra, openipmi-developer, linux-metag,
linux-arm-kernel, linux-cris-kernel, linux-parisc, linux-kernel,
Rob Herring, linux-alpha, user-mode-linux-devel, linuxppc-dev
In-Reply-To: <1412659726-29957-7-git-send-email-linux@roeck-us.net>
On Mon, Oct 06, 2014 at 10:28:08PM -0700, Guenter Roeck wrote:
> pm_power_off is an implementation detail. Replace it with a more generic
> description of the driver's functionality.
>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Thanks
Andrew
> ---
> Documentation/devicetree/bindings/gpio/gpio-poweroff.txt | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
> index d4eab92..c95a1a6 100644
> --- a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
> +++ b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
> @@ -2,12 +2,12 @@ Driver a GPIO line that can be used to turn the power off.
>
> The driver supports both level triggered and edge triggered power off.
> At driver load time, the driver will request the given gpio line and
> -install a pm_power_off handler. If the optional properties 'input' is
> -not found, the GPIO line will be driven in the inactive
> +install a handler to power off the system. If the optional properties
> +'input' is not found, the GPIO line will be driven in the inactive
> state. Otherwise its configured as an input.
>
> -When the pm_power_off is called, the gpio is configured as an output,
> -and drive active, so triggering a level triggered power off
> +When the the poweroff handler is called, the gpio is configured as an
> +output, and drive active, so triggering a level triggered power off
> condition. This will also cause an inactive->active edge condition, so
> triggering positive edge triggered power off. After a delay of 100ms,
> the GPIO is set to inactive, thus causing an active->inactive edge,
> @@ -24,7 +24,7 @@ Required properties:
>
> Optional properties:
> - input : Initially configure the GPIO line as an input. Only reconfigure
> - it to an output when the pm_power_off function is called. If this optional
> + it to an output when the poweroff handler is called. If this optional
> property is not specified, the GPIO is initialized as an output in its
> inactive state.
>
> --
> 1.9.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [RFC PATCH v3 1/3] powerpc: Fix warning reported by verify_cpu_node_mapping()
From: Nishanth Aravamudan @ 2014-10-07 15:33 UTC (permalink / raw)
To: Michael Ellerman; +Cc: paulus, linuxppc-dev, Li Zhong, Nathan Fontenot
In-Reply-To: <1412663318.10747.2.camel@concordia>
On 07.10.2014 [17:28:38 +1100], Michael Ellerman wrote:
> On Fri, 2014-10-03 at 16:26 -0700, Nishanth Aravamudan wrote:
> > On 03.10.2014 [10:50:20 +1000], Michael Ellerman wrote:
> > > On Thu, 2014-10-02 at 14:13 -0700, Nishanth Aravamudan wrote:
> > > > Ben & Michael,
> > > >
> > > > What's the status of these patches?
> > >
> > > Been in my next for a week :)
> > >
> > > https://git.kernel.org/cgit/linux/kernel/git/mpe/linux.git/log/?h=next
> >
> > Ah ok, thanks -- I wasn't following your tree, my fault.
>
> Not really your fault, I hadn't announced my trees existence :)
>
> > Do we want these to go back to 3.17-stable, as they fix some annoying splats
> > during boot (non-fatal afaict, though)?
>
> Up to you really, I don't know how often/bad they were. I haven't added CC
> stable tags to the commits, so if you want them in stable you should send them
> explicitly.
I think they occur every boot, unconditionally, on pseries. Doesn't
prevent boot, just really noisy. I think it'd be good to get them into
-stable.
Li Zhong, can you push them once they get sent upstream?
Thanks,
Nish
^ permalink raw reply
* [PATCH] mpc85xx: dts: Remove SPI and NAND partition from bsc9131rdb.dtsi
From: Ashish Kumar @ 2014-10-07 12:34 UTC (permalink / raw)
To: linuxppc-dev; +Cc: b07421, b01044, Ashish Kumar
* Run "mtdparts default" on u-boot to create dynamic partitions
* Or use dynamic mtd partition with the help of bootargs in u-boot
Append bootargs with:
"mtdparts=ff800000.flash:1m(nand_uboot),512K(nand_dtb),8m(nand_kernel),-(fs);\
spiff707000.0:1m(spi_uboot),4m(spi_kernel),512k(spi_dtb),-(fs)'"
Signed-off-by: Ashish Kumar <Ashish.Kumar@freescale.com>
---
arch/powerpc/boot/dts/bsc9131rdb.dtsi | 50 ---------------------------------
1 files changed, 0 insertions(+), 50 deletions(-)
diff --git a/arch/powerpc/boot/dts/bsc9131rdb.dtsi b/arch/powerpc/boot/dts/bsc9131rdb.dtsi
index 9e6c013..45efcba 100644
--- a/arch/powerpc/boot/dts/bsc9131rdb.dtsi
+++ b/arch/powerpc/boot/dts/bsc9131rdb.dtsi
@@ -40,31 +40,6 @@
compatible = "fsl,ifc-nand";
reg = <0x0 0x0 0x4000>;
- partition@0 {
- /* This location must not be altered */
- /* 3MB for u-boot Bootloader Image */
- reg = <0x0 0x00300000>;
- label = "NAND U-Boot Image";
- read-only;
- };
-
- partition@300000 {
- /* 1MB for DTB Image */
- reg = <0x00300000 0x00100000>;
- label = "NAND DTB Image";
- };
-
- partition@400000 {
- /* 8MB for Linux Kernel Image */
- reg = <0x00400000 0x00800000>;
- label = "NAND Linux Kernel Image";
- };
-
- partition@c00000 {
- /* Rest space for Root file System Image */
- reg = <0x00c00000 0x07400000>;
- label = "NAND RFS Image";
- };
};
};
@@ -82,31 +57,6 @@
reg = <0>;
spi-max-frequency = <50000000>;
- /* 512KB for u-boot Bootloader Image */
- partition@0 {
- reg = <0x0 0x00080000>;
- label = "SPI Flash U-Boot Image";
- read-only;
- };
-
- /* 512KB for DTB Image */
- partition@80000 {
- reg = <0x00080000 0x00080000>;
- label = "SPI Flash DTB Image";
- };
-
- /* 4MB for Linux Kernel Image */
- partition@100000 {
- reg = <0x00100000 0x00400000>;
- label = "SPI Flash Kernel Image";
- };
-
- /*11MB for RFS Image */
- partition@500000 {
- reg = <0x00500000 0x00B00000>;
- label = "SPI Flash RFS Image";
- };
-
};
};
--
1.7.6.GIT
^ permalink raw reply related
* Re: [PATCH 08/44] kernel: Move pm_power_off to common code
From: Richard Weinberger @ 2014-10-07 13:58 UTC (permalink / raw)
To: Guenter Roeck, linux-kernel
Cc: Jonas Bonn, linux-mips, linux-efi, linux-ia64, Steven Miao,
linux-xtensa, Boris Ostrovsky, Catalin Marinas, Will Deacon,
David Howells, Max Filippov, Paul Mackerras, Ralf Baechle,
Pavel Machek, H. Peter Anvin, Guan Xuetao, Thomas Gleixner,
Lennox Wu, Hans-Christian Egtvedt, devel, linux-s390,
Jesper Nilsson, lguest, Russell King, linux-c6x-dev, Len Brown,
David S. Miller, linux-hexagon, Hirokazu Takata, linux-sh,
James E.J. Bottomley, linux-acpi, Ingo Molnar, Geert Uytterhoeven,
Mark Salter, xen-devel, Matt Turner, Chen Liqin,
Haavard Skinnemoen, devicetree, James Hogan,
user-mode-linux-devel, linux-pm, Aurelien Jacquiot,
Heiko Carstens, Jeff Dike, adi-buildroot-devel, Chris Metcalf,
Konrad Rzeszutek Wilk, Mikael Starvik, linux-m68k,
linux-am33-list, Ivan Kokshaysky, linux-tegra, openipmi-developer,
linux-metag, linux-arm-kernel, Richard Henderson, Chris Zankel,
Michal Simek, Tony Luck, linux-parisc, linux-cris-kernel,
Vineet Gupta, Rafael J. Wysocki, Fenghua Yu, Richard Kuo,
David Vrabel, linux-alpha, Martin Schwidefsky, Koichi Yasutake,
linuxppc-dev, Helge Deller
In-Reply-To: <1412659726-29957-9-git-send-email-linux@roeck-us.net>
Am 07.10.2014 07:28, schrieb Guenter Roeck:
> arch/um/kernel/reboot.c | 2 --
Acked-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
^ permalink raw reply
* [PATCH 2/2] net: fs_enet: Add NAPI TX
From: Christophe Leroy @ 2014-10-07 13:05 UTC (permalink / raw)
To: Pantelis Antoniou, Vitaly Bordug; +Cc: netdev, linuxppc-dev, linux-kernel
When using a MPC8xx as a router, 'perf' shows a significant time spent in
fs_enet_interrupt() and fs_enet_start_xmit().
'perf annotate' shows that the time spent in fs_enet_start_xmit is indeed spent
between spin_unlock_irqrestore() and the following instruction, hence in
interrupt handling. This is due to the TX complete interrupt that fires after
each transmitted packet.
This patch modifies the handling of TX complete to use NAPI.
With this patch, my NAT router offers a throughput improved by 21%
Original performance:
[root@localhost tmp]# scp toto pgs:/tmp
toto 100% 256MB 2.8MB/s 01:31
Performance with the patch:
[root@localhost tmp]# scp toto pgs:/tmp
toto 100% 256MB 3.4MB/s 01:16
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
.../net/ethernet/freescale/fs_enet/fs_enet-main.c | 47 +++++++++++++++++-----
drivers/net/ethernet/freescale/fs_enet/fs_enet.h | 9 ++++-
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c | 29 +++++++++++++
drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 29 +++++++++++++
drivers/net/ethernet/freescale/fs_enet/mac-scc.c | 29 +++++++++++++
5 files changed, 132 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 71a25b4..c92c3b7 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -215,17 +215,23 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
return received;
}
-static void fs_enet_tx(struct net_device *dev)
+static int fs_enet_tx_napi(struct napi_struct *napi, int budget)
{
- struct fs_enet_private *fep = netdev_priv(dev);
+ struct fs_enet_private *fep = container_of(napi, struct fs_enet_private,
+ napi_tx);
+ struct net_device *dev = fep->ndev;
cbd_t __iomem *bdp;
struct sk_buff *skb;
int dirtyidx, do_wake, do_restart;
u16 sc;
+ int has_tx_work = 0;
spin_lock(&fep->tx_lock);
bdp = fep->dirty_tx;
+ /* clear TX status bits for napi*/
+ (*fep->ops->napi_clear_tx_event)(dev);
+
do_wake = do_restart = 0;
while (((sc = CBDR_SC(bdp)) & BD_ENET_TX_READY) == 0) {
dirtyidx = bdp - fep->tx_bd_base;
@@ -278,7 +284,7 @@ static void fs_enet_tx(struct net_device *dev)
/*
* Free the sk buffer associated with this last transmit.
*/
- dev_kfree_skb_irq(skb);
+ dev_kfree_skb(skb);
fep->tx_skbuff[dirtyidx] = NULL;
/*
@@ -295,6 +301,7 @@ static void fs_enet_tx(struct net_device *dev)
*/
if (!fep->tx_free++)
do_wake = 1;
+ has_tx_work = 1;
}
fep->dirty_tx = bdp;
@@ -302,10 +309,19 @@ static void fs_enet_tx(struct net_device *dev)
if (do_restart)
(*fep->ops->tx_restart)(dev);
+ if (!has_tx_work) {
+ napi_complete(napi);
+ (*fep->ops->napi_enable_tx)(dev);
+ }
+
spin_unlock(&fep->tx_lock);
if (do_wake)
netif_wake_queue(dev);
+
+ if (has_tx_work)
+ return budget;
+ return 0;
}
/*
@@ -350,8 +366,17 @@ fs_enet_interrupt(int irq, void *dev_id)
__napi_schedule(&fep->napi);
}
- if (int_events & fep->ev_tx)
- fs_enet_tx(dev);
+ if (int_events & fep->ev_tx) {
+ napi_ok = napi_schedule_prep(&fep->napi_tx);
+
+ (*fep->ops->napi_disable_tx)(dev);
+ (*fep->ops->clear_int_events)(dev, fep->ev_napi_tx);
+
+ /* NOTE: it is possible for FCCs in NAPI mode */
+ /* to submit a spurious interrupt while in poll */
+ if (napi_ok)
+ __napi_schedule(&fep->napi_tx);
+ }
}
handled = nr > 0;
@@ -484,7 +509,6 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
cbd_t __iomem *bdp;
int curidx;
u16 sc;
- unsigned long flags;
#ifdef CONFIG_FS_ENET_MPC5121_FEC
if (((unsigned long)skb->data) & 0x3) {
@@ -499,7 +523,7 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
}
#endif
- spin_lock_irqsave(&fep->tx_lock, flags);
+ spin_lock(&fep->tx_lock);
/*
* Fill in a Tx ring entry
@@ -508,7 +532,7 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (!fep->tx_free || (CBDR_SC(bdp) & BD_ENET_TX_READY)) {
netif_stop_queue(dev);
- spin_unlock_irqrestore(&fep->tx_lock, flags);
+ spin_unlock(&fep->tx_lock);
/*
* Ooops. All transmit buffers are full. Bail out.
@@ -564,7 +588,7 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
(*fep->ops->tx_kickstart)(dev);
- spin_unlock_irqrestore(&fep->tx_lock, flags);
+ spin_unlock(&fep->tx_lock);
return NETDEV_TX_OK;
}
@@ -685,6 +709,7 @@ static int fs_enet_open(struct net_device *dev)
fs_init_bds(fep->ndev);
napi_enable(&fep->napi);
+ napi_enable(&fep->napi_tx);
/* Install our interrupt handler. */
r = request_irq(fep->interrupt, fs_enet_interrupt, IRQF_SHARED,
@@ -692,6 +717,7 @@ static int fs_enet_open(struct net_device *dev)
if (r != 0) {
dev_err(fep->dev, "Could not allocate FS_ENET IRQ!");
napi_disable(&fep->napi);
+ napi_disable(&fep->napi_tx);
return -EINVAL;
}
@@ -699,6 +725,7 @@ static int fs_enet_open(struct net_device *dev)
if (err) {
free_irq(fep->interrupt, dev);
napi_disable(&fep->napi);
+ napi_disable(&fep->napi_tx);
return err;
}
phy_start(fep->phydev);
@@ -716,6 +743,7 @@ static int fs_enet_close(struct net_device *dev)
netif_stop_queue(dev);
netif_carrier_off(dev);
napi_disable(&fep->napi);
+ napi_disable(&fep->napi_tx);
phy_stop(fep->phydev);
spin_lock_irqsave(&fep->lock, flags);
@@ -971,6 +999,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
ndev->netdev_ops = &fs_enet_netdev_ops;
ndev->watchdog_timeo = 2 * HZ;
netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi, fpi->napi_weight);
+ netif_napi_add(ndev, &fep->napi_tx, fs_enet_tx_napi, 2);
ndev->ethtool_ops = &fs_ethtool_ops;
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet.h b/drivers/net/ethernet/freescale/fs_enet/fs_enet.h
index 1ece4b1..3a4b49e 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet.h
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet.h
@@ -84,6 +84,9 @@ struct fs_ops {
void (*napi_clear_rx_event)(struct net_device *dev);
void (*napi_enable_rx)(struct net_device *dev);
void (*napi_disable_rx)(struct net_device *dev);
+ void (*napi_clear_tx_event)(struct net_device *dev);
+ void (*napi_enable_tx)(struct net_device *dev);
+ void (*napi_disable_tx)(struct net_device *dev);
void (*rx_bd_done)(struct net_device *dev);
void (*tx_kickstart)(struct net_device *dev);
u32 (*get_int_events)(struct net_device *dev);
@@ -119,6 +122,7 @@ struct phy_info {
struct fs_enet_private {
struct napi_struct napi;
+ struct napi_struct napi_tx;
struct device *dev; /* pointer back to the device (must be initialized first) */
struct net_device *ndev;
spinlock_t lock; /* during all ops except TX pckt processing */
@@ -149,6 +153,7 @@ struct fs_enet_private {
/* event masks */
u32 ev_napi_rx; /* mask of NAPI rx events */
+ u32 ev_napi_tx; /* mask of NAPI rx events */
u32 ev_rx; /* rx event mask */
u32 ev_tx; /* tx event mask */
u32 ev_err; /* error event mask */
@@ -191,8 +196,8 @@ void fs_cleanup_bds(struct net_device *dev);
#define DRV_MODULE_NAME "fs_enet"
#define PFX DRV_MODULE_NAME ": "
-#define DRV_MODULE_VERSION "1.0"
-#define DRV_MODULE_RELDATE "Aug 8, 2005"
+#define DRV_MODULE_VERSION "1.1"
+#define DRV_MODULE_RELDATE "Sep 22, 2014"
/***************************************************************************/
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
index f5383ab..2c578db 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
@@ -125,6 +125,7 @@ out:
}
#define FCC_NAPI_RX_EVENT_MSK (FCC_ENET_RXF | FCC_ENET_RXB)
+#define FCC_NAPI_TX_EVENT_MSK (FCC_ENET_TXF | FCC_ENET_TXB)
#define FCC_RX_EVENT (FCC_ENET_RXF)
#define FCC_TX_EVENT (FCC_ENET_TXB)
#define FCC_ERR_EVENT_MSK (FCC_ENET_TXE)
@@ -137,6 +138,7 @@ static int setup_data(struct net_device *dev)
return -EINVAL;
fep->ev_napi_rx = FCC_NAPI_RX_EVENT_MSK;
+ fep->ev_napi_tx = FCC_NAPI_TX_EVENT_MSK;
fep->ev_rx = FCC_RX_EVENT;
fep->ev_tx = FCC_TX_EVENT;
fep->ev_err = FCC_ERR_EVENT_MSK;
@@ -446,6 +448,30 @@ static void napi_disable_rx(struct net_device *dev)
C16(fccp, fcc_fccm, FCC_NAPI_RX_EVENT_MSK);
}
+static void napi_clear_tx_event(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ fcc_t __iomem *fccp = fep->fcc.fccp;
+
+ W16(fccp, fcc_fcce, FCC_NAPI_TX_EVENT_MSK);
+}
+
+static void napi_enable_tx(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ fcc_t __iomem *fccp = fep->fcc.fccp;
+
+ S16(fccp, fcc_fccm, FCC_NAPI_TX_EVENT_MSK);
+}
+
+static void napi_disable_tx(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ fcc_t __iomem *fccp = fep->fcc.fccp;
+
+ C16(fccp, fcc_fccm, FCC_NAPI_TX_EVENT_MSK);
+}
+
static void rx_bd_done(struct net_device *dev)
{
/* nothing */
@@ -572,6 +598,9 @@ const struct fs_ops fs_fcc_ops = {
.napi_clear_rx_event = napi_clear_rx_event,
.napi_enable_rx = napi_enable_rx,
.napi_disable_rx = napi_disable_rx,
+ .napi_clear_tx_event = napi_clear_tx_event,
+ .napi_enable_tx = napi_enable_tx,
+ .napi_disable_tx = napi_disable_tx,
.rx_bd_done = rx_bd_done,
.tx_kickstart = tx_kickstart,
.get_int_events = get_int_events,
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
index 1eedfba2..3d4e08b 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
@@ -110,6 +110,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
}
#define FEC_NAPI_RX_EVENT_MSK (FEC_ENET_RXF | FEC_ENET_RXB)
+#define FEC_NAPI_TX_EVENT_MSK (FEC_ENET_TXF | FEC_ENET_TXB)
#define FEC_RX_EVENT (FEC_ENET_RXF)
#define FEC_TX_EVENT (FEC_ENET_TXF)
#define FEC_ERR_EVENT_MSK (FEC_ENET_HBERR | FEC_ENET_BABR | \
@@ -126,6 +127,7 @@ static int setup_data(struct net_device *dev)
fep->fec.htlo = 0;
fep->ev_napi_rx = FEC_NAPI_RX_EVENT_MSK;
+ fep->ev_napi_tx = FEC_NAPI_TX_EVENT_MSK;
fep->ev_rx = FEC_RX_EVENT;
fep->ev_tx = FEC_TX_EVENT;
fep->ev_err = FEC_ERR_EVENT_MSK;
@@ -415,6 +417,30 @@ static void napi_disable_rx(struct net_device *dev)
FC(fecp, imask, FEC_NAPI_RX_EVENT_MSK);
}
+static void napi_clear_tx_event(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ struct fec __iomem *fecp = fep->fec.fecp;
+
+ FW(fecp, ievent, FEC_NAPI_TX_EVENT_MSK);
+}
+
+static void napi_enable_tx(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ struct fec __iomem *fecp = fep->fec.fecp;
+
+ FS(fecp, imask, FEC_NAPI_TX_EVENT_MSK);
+}
+
+static void napi_disable_tx(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ struct fec __iomem *fecp = fep->fec.fecp;
+
+ FC(fecp, imask, FEC_NAPI_TX_EVENT_MSK);
+}
+
static void rx_bd_done(struct net_device *dev)
{
struct fs_enet_private *fep = netdev_priv(dev);
@@ -487,6 +513,9 @@ const struct fs_ops fs_fec_ops = {
.napi_clear_rx_event = napi_clear_rx_event,
.napi_enable_rx = napi_enable_rx,
.napi_disable_rx = napi_disable_rx,
+ .napi_clear_tx_event = napi_clear_tx_event,
+ .napi_enable_tx = napi_enable_tx,
+ .napi_disable_tx = napi_disable_tx,
.rx_bd_done = rx_bd_done,
.tx_kickstart = tx_kickstart,
.get_int_events = get_int_events,
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
index 90b3b19..41aa0b4 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
@@ -116,6 +116,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
}
#define SCC_NAPI_RX_EVENT_MSK (SCCE_ENET_RXF | SCCE_ENET_RXB)
+#define SCC_NAPI_TX_EVENT_MSK (SCCE_ENET_TXF | SCCE_ENET_TXB)
#define SCC_RX_EVENT (SCCE_ENET_RXF)
#define SCC_TX_EVENT (SCCE_ENET_TXB)
#define SCC_ERR_EVENT_MSK (SCCE_ENET_TXE | SCCE_ENET_BSY)
@@ -130,6 +131,7 @@ static int setup_data(struct net_device *dev)
fep->scc.htlo = 0;
fep->ev_napi_rx = SCC_NAPI_RX_EVENT_MSK;
+ fep->ev_napi_tx = SCC_NAPI_TX_EVENT_MSK;
fep->ev_rx = SCC_RX_EVENT;
fep->ev_tx = SCC_TX_EVENT | SCCE_ENET_TXE;
fep->ev_err = SCC_ERR_EVENT_MSK;
@@ -398,6 +400,30 @@ static void napi_disable_rx(struct net_device *dev)
C16(sccp, scc_sccm, SCC_NAPI_RX_EVENT_MSK);
}
+static void napi_clear_tx_event(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ scc_t __iomem *sccp = fep->scc.sccp;
+
+ W16(sccp, scc_scce, SCC_NAPI_TX_EVENT_MSK);
+}
+
+static void napi_enable_tx(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ scc_t __iomem *sccp = fep->scc.sccp;
+
+ S16(sccp, scc_sccm, SCC_NAPI_TX_EVENT_MSK);
+}
+
+static void napi_disable_tx(struct net_device *dev)
+{
+ struct fs_enet_private *fep = netdev_priv(dev);
+ scc_t __iomem *sccp = fep->scc.sccp;
+
+ C16(sccp, scc_sccm, SCC_NAPI_TX_EVENT_MSK);
+}
+
static void rx_bd_done(struct net_device *dev)
{
/* nothing */
@@ -471,6 +497,9 @@ const struct fs_ops fs_scc_ops = {
.napi_clear_rx_event = napi_clear_rx_event,
.napi_enable_rx = napi_enable_rx,
.napi_disable_rx = napi_disable_rx,
+ .napi_clear_tx_event = napi_clear_tx_event,
+ .napi_enable_tx = napi_enable_tx,
+ .napi_disable_tx = napi_disable_tx,
.rx_bd_done = rx_bd_done,
.tx_kickstart = tx_kickstart,
.get_int_events = get_int_events,
--
2.1.0
^ permalink raw reply related
* [PATCH 1/2] net: fs_enet: Remove non NAPI RX
From: Christophe Leroy @ 2014-10-07 13:04 UTC (permalink / raw)
To: Pantelis Antoniou, Vitaly Bordug; +Cc: netdev, linuxppc-dev, linux-kernel
In the probe function, use_napi is inconditionnaly set to 1. This patch removes
all the code which is conditional to !use_napi, and removes use_napi which has
then become useless.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
.../net/ethernet/freescale/fs_enet/fs_enet-main.c | 164 ++-------------------
include/linux/fs_enet_pd.h | 1 -
2 files changed, 15 insertions(+), 150 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 748fd24..71a25b4 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -215,128 +215,6 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
return received;
}
-/* non NAPI receive function */
-static int fs_enet_rx_non_napi(struct net_device *dev)
-{
- struct fs_enet_private *fep = netdev_priv(dev);
- const struct fs_platform_info *fpi = fep->fpi;
- cbd_t __iomem *bdp;
- struct sk_buff *skb, *skbn, *skbt;
- int received = 0;
- u16 pkt_len, sc;
- int curidx;
- /*
- * First, grab all of the stats for the incoming packet.
- * These get messed up if we get called due to a busy condition.
- */
- bdp = fep->cur_rx;
-
- while (((sc = CBDR_SC(bdp)) & BD_ENET_RX_EMPTY) == 0) {
-
- curidx = bdp - fep->rx_bd_base;
-
- /*
- * Since we have allocated space to hold a complete frame,
- * the last indicator should be set.
- */
- if ((sc & BD_ENET_RX_LAST) == 0)
- dev_warn(fep->dev, "rcv is not +last\n");
-
- /*
- * Check for errors.
- */
- if (sc & (BD_ENET_RX_LG | BD_ENET_RX_SH | BD_ENET_RX_CL |
- BD_ENET_RX_NO | BD_ENET_RX_CR | BD_ENET_RX_OV)) {
- fep->stats.rx_errors++;
- /* Frame too long or too short. */
- if (sc & (BD_ENET_RX_LG | BD_ENET_RX_SH))
- fep->stats.rx_length_errors++;
- /* Frame alignment */
- if (sc & (BD_ENET_RX_NO | BD_ENET_RX_CL))
- fep->stats.rx_frame_errors++;
- /* CRC Error */
- if (sc & BD_ENET_RX_CR)
- fep->stats.rx_crc_errors++;
- /* FIFO overrun */
- if (sc & BD_ENET_RX_OV)
- fep->stats.rx_crc_errors++;
-
- skb = fep->rx_skbuff[curidx];
-
- dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
- L1_CACHE_ALIGN(PKT_MAXBUF_SIZE),
- DMA_FROM_DEVICE);
-
- skbn = skb;
-
- } else {
-
- skb = fep->rx_skbuff[curidx];
-
- dma_unmap_single(fep->dev, CBDR_BUFADDR(bdp),
- L1_CACHE_ALIGN(PKT_MAXBUF_SIZE),
- DMA_FROM_DEVICE);
-
- /*
- * Process the incoming frame.
- */
- fep->stats.rx_packets++;
- pkt_len = CBDR_DATLEN(bdp) - 4; /* remove CRC */
- fep->stats.rx_bytes += pkt_len + 4;
-
- if (pkt_len <= fpi->rx_copybreak) {
- /* +2 to make IP header L1 cache aligned */
- skbn = netdev_alloc_skb(dev, pkt_len + 2);
- if (skbn != NULL) {
- skb_reserve(skbn, 2); /* align IP header */
- skb_copy_from_linear_data(skb,
- skbn->data, pkt_len);
- /* swap */
- skbt = skb;
- skb = skbn;
- skbn = skbt;
- }
- } else {
- skbn = netdev_alloc_skb(dev, ENET_RX_FRSIZE);
-
- if (skbn)
- skb_align(skbn, ENET_RX_ALIGN);
- }
-
- if (skbn != NULL) {
- skb_put(skb, pkt_len); /* Make room */
- skb->protocol = eth_type_trans(skb, dev);
- received++;
- netif_rx(skb);
- } else {
- fep->stats.rx_dropped++;
- skbn = skb;
- }
- }
-
- fep->rx_skbuff[curidx] = skbn;
- CBDW_BUFADDR(bdp, dma_map_single(fep->dev, skbn->data,
- L1_CACHE_ALIGN(PKT_MAXBUF_SIZE),
- DMA_FROM_DEVICE));
- CBDW_DATLEN(bdp, 0);
- CBDW_SC(bdp, (sc & ~BD_ENET_RX_STATS) | BD_ENET_RX_EMPTY);
-
- /*
- * Update BD pointer to next entry.
- */
- if ((sc & BD_ENET_RX_WRAP) == 0)
- bdp++;
- else
- bdp = fep->rx_bd_base;
-
- (*fep->ops->rx_bd_done)(dev);
- }
-
- fep->cur_rx = bdp;
-
- return 0;
-}
-
static void fs_enet_tx(struct net_device *dev)
{
struct fs_enet_private *fep = netdev_priv(dev);
@@ -453,8 +331,7 @@ fs_enet_interrupt(int irq, void *dev_id)
nr++;
int_clr_events = int_events;
- if (fpi->use_napi)
- int_clr_events &= ~fep->ev_napi_rx;
+ int_clr_events &= ~fep->ev_napi_rx;
(*fep->ops->clear_int_events)(dev, int_clr_events);
@@ -462,19 +339,15 @@ fs_enet_interrupt(int irq, void *dev_id)
(*fep->ops->ev_error)(dev, int_events);
if (int_events & fep->ev_rx) {
- if (!fpi->use_napi)
- fs_enet_rx_non_napi(dev);
- else {
- napi_ok = napi_schedule_prep(&fep->napi);
-
- (*fep->ops->napi_disable_rx)(dev);
- (*fep->ops->clear_int_events)(dev, fep->ev_napi_rx);
-
- /* NOTE: it is possible for FCCs in NAPI mode */
- /* to submit a spurious interrupt while in poll */
- if (napi_ok)
- __napi_schedule(&fep->napi);
- }
+ napi_ok = napi_schedule_prep(&fep->napi);
+
+ (*fep->ops->napi_disable_rx)(dev);
+ (*fep->ops->clear_int_events)(dev, fep->ev_napi_rx);
+
+ /* NOTE: it is possible for FCCs in NAPI mode */
+ /* to submit a spurious interrupt while in poll */
+ if (napi_ok)
+ __napi_schedule(&fep->napi);
}
if (int_events & fep->ev_tx)
@@ -811,24 +684,21 @@ static int fs_enet_open(struct net_device *dev)
/* not doing this, will cause a crash in fs_enet_rx_napi */
fs_init_bds(fep->ndev);
- if (fep->fpi->use_napi)
- napi_enable(&fep->napi);
+ napi_enable(&fep->napi);
/* Install our interrupt handler. */
r = request_irq(fep->interrupt, fs_enet_interrupt, IRQF_SHARED,
"fs_enet-mac", dev);
if (r != 0) {
dev_err(fep->dev, "Could not allocate FS_ENET IRQ!");
- if (fep->fpi->use_napi)
- napi_disable(&fep->napi);
+ napi_disable(&fep->napi);
return -EINVAL;
}
err = fs_init_phy(dev);
if (err) {
free_irq(fep->interrupt, dev);
- if (fep->fpi->use_napi)
- napi_disable(&fep->napi);
+ napi_disable(&fep->napi);
return err;
}
phy_start(fep->phydev);
@@ -845,8 +715,7 @@ static int fs_enet_close(struct net_device *dev)
netif_stop_queue(dev);
netif_carrier_off(dev);
- if (fep->fpi->use_napi)
- napi_disable(&fep->napi);
+ napi_disable(&fep->napi);
phy_stop(fep->phydev);
spin_lock_irqsave(&fep->lock, flags);
@@ -1022,7 +891,6 @@ static int fs_enet_probe(struct platform_device *ofdev)
fpi->rx_ring = 32;
fpi->tx_ring = 32;
fpi->rx_copybreak = 240;
- fpi->use_napi = 1;
fpi->napi_weight = 17;
fpi->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0);
if (!fpi->phy_node && of_phy_is_fixed_link(ofdev->dev.of_node)) {
@@ -1102,9 +970,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
ndev->netdev_ops = &fs_enet_netdev_ops;
ndev->watchdog_timeo = 2 * HZ;
- if (fpi->use_napi)
- netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi,
- fpi->napi_weight);
+ netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi, fpi->napi_weight);
ndev->ethtool_ops = &fs_ethtool_ops;
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index efb0596..77d783f 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -139,7 +139,6 @@ struct fs_platform_info {
int rx_ring, tx_ring; /* number of buffers on rx */
__u8 macaddr[ETH_ALEN]; /* mac address */
int rx_copybreak; /* limit we copy small frames */
- int use_napi; /* use NAPI */
int napi_weight; /* NAPI weight */
int use_rmii; /* use RMII mode */
--
2.1.0
^ permalink raw reply related
* [PATCH 0/2] net: fs_enet: Remove non NAPI RX and add NAPI for TX
From: Christophe Leroy @ 2014-10-07 13:04 UTC (permalink / raw)
To: Pantelis Antoniou, Vitaly Bordug; +Cc: netdev, linuxppc-dev, linux-kernel
When using a MPC8xx as a router, 'perf' shows a significant time spent in
fs_enet_interrupt() and fs_enet_start_xmit().
'perf annotate' shows that the time spent in fs_enet_start_xmit is indeed spent
between spin_unlock_irqrestore() and the following instruction, hence in
interrupt handling. This is due to the TX complete interrupt that fires after
each transmitted packet.
This patchset first remove all non NAPI handling as NAPI has become the only
mode for RX, then adds NAPI for handling TX complete.
This improves NAT TCP throughput by 21% on MPC885 with FEC.
Tested on MPC885 with FEC.
[PATCH 1/2] net: fs_enet: Remove non NAPI RX
[PATCH 2/2] net: fs_enet: Add NAPI TX
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
.../net/ethernet/freescale/fs_enet/fs_enet-main.c | 211 ++++++---------------
.../net/ethernet/freescale/fs_enet/fs_enet.h | 9 +-
.../net/ethernet/freescale/fs_enet/mac-fcc.c | 29 +++
.../net/ethernet/freescale/fs_enet/mac-fec.c | 29 +++
.../net/ethernet/freescale/fs_enet/mac-scc.c | 29 +++
linux/include/linux/fs_enet_pd.h | 1 -
6 files changed, 147 insertions(+), 161 deletions(-)
^ permalink raw reply
* Re: [PATCH V3 0/3] Add new PowerPC specific ELF core notes
From: Anshuman Khandual @ 2014-10-07 12:35 UTC (permalink / raw)
To: Sam Bobroff, linux-kernel, linuxppc-dev, peterz, akpm, tglx
Cc: mikey, james.hogan, avagin, Paul.Clothier, palves, oleg, dhowells,
davej, davem
In-Reply-To: <53D0AD2B.4050004@au1.ibm.com>
On 07/24/2014 12:22 PM, Sam Bobroff wrote:
>> Outstanding Issues
>> ==================
>> (1) Running DSCR register value inside a transaction does not seem to be saved
>> at thread.dscr when the process stops for ptrace examination.
>
> Since this is fixed by 96d016108640bc2b7fb0ee800737f80923847294, which
> is already upstream, you might want to rebase and re-test. It should
> pass and then you can remove the outstanding issues :-)
Sure will do that.
>
>>
>> Test programs
>
> program
>
> When I posted the patch I mentioned above, I was asked to move the test
> code into the powerpc kernel selftests so you may want to do this too.
Yes, I will add these ptrace related tests as tm/tm-ptrace.c test case.
>
> Also, your test program covers everything mine did and more so you might
> want to remove mine if you do add this to the selftests.
The new one will be more ptrace specific, so wont remove yours which tests
the context saved DSCR value.
>
>> =============
>> #include <unistd.h>
>> #include <stdlib.h>
>> #include <string.h>
>> #include <malloc.h>
>> #include <errno.h>
>> #include <sys/ptrace.h>
>> #include <sys/uio.h>
>> #include <sys/types.h>
>> #include <sys/signal.h>
>> #include <sys/user.h>
>
> You should include sys/wait.h for waitpid().
Will do.
> status, i and flags are all unused.
Will remove them.
>> else
>> printf("DSCR FAILED\n");
>>
>> /* TM checkpointed GPR */
>> iov.iov_base = (struct pt_regs *) malloc(sizeof(struct pt_regs));;
>> iov.iov_len = sizeof(struct pt_regs);
>> ret = ptrace(PTRACE_GETREGSET, child, NT_PPC_TM_CGPR, &iov);
>> if (ret == -1) {
>> printf("PTRACE_GETREGSET: NT_PPC_TM_CGPR failed: %s\n", strerror(errno));
>> exit(-1);
>> }
>>
>> if (iov.iov_len != sizeof(struct pt_regs)) {
>> printf("NT_PPC_TM_CGPR: Length returned is wrong\n");
>> exit(-1);
>> }
>>
>> pregs1 = iov.iov_base;
>> printf("-------TM checkpointed GPR-----\n");
>> printf("TM CH GPR[1]: %x\n", pregs1->gpr[1]);
>> printf("TM CH GPR[2]: %x\n", pregs1->gpr[2]);
>> printf("TM CH NIP: %x\n", pregs1->nip);
>> printf("TM CH LINK: %x\n", pregs1->link);
>> printf("TM CH CCR: %x\n", pregs1->ccr);
>
> I get a compiler warning for these printfs: they should be "%lx".
Okay.
>
>>
>> if (pregs1->gpr[1] == VAL1)
>> printf("GPR[1] PASSED\n");
>> else
>> printf("GPR[1] FAILED\n");
>>
>> if (pregs1->gpr[2] == VAL2)
>> printf("GPR[2] PASSED\n");
>> else
>> printf("GPR[2] FAILED\n");
>>
>> /* TM running GPR */
>> ret = ptrace(PTRACE_GETREGS, child, NULL, pregs2);
>> if (ret == -1) {
>> printf("PTRACE_GETREGS fail: %s\n", strerror(errno));
>> exit(-1);
>> }
>>
>> printf("-------TM running GPR-----\n");
>> printf("TM RN GPR[1]: %x\n", pregs2->gpr[1]);
>> printf("TM RN GPR[2]: %x\n", pregs2->gpr[2]);
>> printf("TM RN NIP: %x\n", pregs2->nip);
>> printf("TM RN LINK: %x\n", pregs2->link);
>> printf("TM RN CCR: %x\n", pregs2->ccr);
>
> Same as above, I get warnings and they should be "%lx".
Okay. Will fix them.
^ permalink raw reply
* Re: [PATCH] powerpc: fix sys_call_table declaration
From: Michael Ellerman @ 2014-10-07 12:15 UTC (permalink / raw)
To: Romeo Cane; +Cc: Paul Mackerras, linuxppc-dev, linux-kernel
In-Reply-To: <20141003100046.GB2144@rcane-VirtualBox>
On Fri, 2014-10-03 at 11:00 +0100, Romeo Cane wrote:
> On Fri, Oct 03, 2014 at 07:34:34AM +1000, Benjamin Herrenschmidt wrote:
> > On Thu, 2014-10-02 at 15:41 +0100, Romeo Cane wrote:
> > > Declaring sys_call_table as a pointer causes the compiler to generate the wrong lookup code in arch_syscall_addr
> >
> > Care to elaborate ?
> >
> > > diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
> > > index b54b2ad..528ba9d 100644
> > > --- a/arch/powerpc/include/asm/syscall.h
> > > +++ b/arch/powerpc/include/asm/syscall.h
> > > @@ -17,7 +17,7 @@
> > >
> > > /* ftrace syscalls requires exporting the sys_call_table */
> > > #ifdef CONFIG_FTRACE_SYSCALLS
> > > -extern const unsigned long *sys_call_table;
> > > +extern const unsigned long sys_call_table[];
> > > #endif /* CONFIG_FTRACE_SYSCALLS */
> > >
> > > static inline long syscall_get_nr(struct task_struct *task,
>
> Hi Ben,
>
> this is the arch_syscall_addr function from kernel/trace/trace_syscalls.c:
>
> unsigned long __init __weak arch_syscall_addr(int nr)
> {
> return (unsigned long)sys_call_table[nr];
> }
>
> on my platform (E500MC) the generated assembly code is as follows:
>
> without the patch:
> <arch_syscall_addr>:
> lis r9,-16384
> rlwinm r3,r3,2,0,29
> lwz r11,30640(r9)
> lwzx r3,r11,r3
> blr
>
> with the patch:
> <arch_syscall_addr>:
> lis r9,-16384
> rlwinm r3,r3,2,0,29
> addi r9,r9,30640
> lwzx r3,r9,r3
> blr
>
>
> the goal of the function is to retrieve the n-th element of the table (i.e.
> the address of a syscall)
> Without the patch, the returned value is in fact the memory content pointed
> by the address of the first syscall plus an offset, that is not what we want.
> The consequence is that ftrace of syscalls doesn't work.
>
> That table has always been declared as a pointer since the support for
> syscalls tracing has been introduced for powerpc years ago, so I'm wondering
> why nobody else had this problem before.
> Other architectures are not affected since in their includes the table is
> already declared as an array.
Yeah looks like you're right.
I've only ever used the raw_syscall tracing, which does work.
Worringly we also use sys_call_table as extern unsigned long * in vdso.c, so I
wonder if that is also broken.
cheers
^ permalink raw reply
* Re: [PATCH 00/20] powerpc: Convert power off logic to pm_power_off
From: Alexander Graf @ 2014-10-07 11:35 UTC (permalink / raw)
To: Michael Ellerman
Cc: Arnd Bergmann, Geoff Levand, Alistair Popple, Scott Wood,
Anatolij Gustschin, linuxppc-dev, Guenter Roeck
In-Reply-To: <1412663147.10747.1.camel@concordia>
On 07.10.14 08:25, Michael Ellerman wrote:
> On Mon, 2014-10-06 at 12:00 +0200, Alexander Graf wrote:
>>
>> On 03.10.14 06:42, Michael Ellerman wrote:
>>> On Wed, 2014-10-01 at 15:27 +0200, Alexander Graf wrote:
>>>> The generic Linux framework to power off the machine is a function pointer
>>>> called pm_power_off. The trick about this pointer is that device drivers can
>>>> potentially implement it rather than board files.
>>>>
>>>> Today on PowerPC we set pm_power_off to invoke our generic full machine power
>>>> off logic which then calls ppc_md.power_off to invoke machine specific power
>>>> off.
>>>>
>>>> To fix this up, let's get rid of the ppc_md.power_off logic and just always use
>>>> pm_power_off as was intended. Then individual drivers such as the GPIO power off
>>>> driver can implement power off logic via that function pointer.
>>>
>>> This looks OK to me with one caveat.
>>>
>>> In several of the patches you're replacing a static initialisation with a
>>> runtime one, and you're doing the runtime initialisation in xxx_setup_arch().
>>> That's reasonably late, so I'd prefer you did it in xxx_probe().
>>
>> Heh, I had it in xxx_probe() originally and then realized that
>>
>> a) the power off function is basically a driver. Driver initialization
>> happens in xxx_setup_arch() and
>>
>> b) the maple target already does overwrite its power_off callback in
>> xxx_setup_arch and
>>
>> c) on all targets xxx_probe() is very slim and doesn't do much
>>
>> but I'll happily change it back to put the bits in xxx_probe() instead.
>
> Thanks.
>
> That way you shouldn't be changing behaviour.
>
> It may still be the case that some power off routines don't actually work until
> later, but that's an existing problem. Some power off routines *do* work before
> setup_arch(), so they will continue to work.
Ok, works for me :). Just wanted to make sure you're aware of the
reasoning why I didn't do it in probe().
> Also, how does your series interact with Guenter's that removes pm_power_off ?
> It seems at the moment they are unaware of each other.
Guenters patches convert users of pm_power_off to his new scheme. We're
not even at that stage at all yet in the powerpc tree. Converting
everything to pm_power_off is basically a first step. His patch set
maintains pm_power_off, so there shouldn't be nasty conflicts.
Once we converted from ppc_md tables to actual code, we can just run a
simple coccinelle patch to convert from pm_power_off to his new scheme
later.
Alex
^ permalink raw reply
* Re: [PATCH v3 01/16] powerpc/cell: Move spu_handle_mm_fault() out of cell platform
From: Michael Neuling @ 2014-10-07 11:34 UTC (permalink / raw)
To: Stephen Rothwell
Cc: cbe-oss-dev, arnd, greg, imunsie, linux-kernel, linuxppc-dev,
Aneesh Kumar K.V, anton, jk
In-Reply-To: <20141007220855.75b64a57@canb.auug.org.au>
> > +int copro_data_segment(struct mm_struct *mm, u64 ea, u64 *esid, u64 *v=
sid);
>=20
> This function is otherwise not included in this patch, so it should
> probably be removed (as the next patch removes it anyway).
Yeah, looks like I screwed it up slightly in the packing of these
patches.
Thanks.
Mikey
^ permalink raw reply
* Re: [PATCH v3 01/16] powerpc/cell: Move spu_handle_mm_fault() out of cell platform
From: Stephen Rothwell @ 2014-10-07 11:08 UTC (permalink / raw)
To: Michael Neuling
Cc: cbe-oss-dev, arnd, greg, imunsie, linux-kernel, linuxppc-dev,
Aneesh Kumar K.V, anton, jk
In-Reply-To: <1412678902-18672-2-git-send-email-mikey@neuling.org>
[-- Attachment #1: Type: text/plain, Size: 1112 bytes --]
Hi Mikey,
On Tue, 7 Oct 2014 21:48:07 +1100 Michael Neuling <mikey@neuling.org> wrote:
>
> diff --git a/arch/powerpc/include/asm/copro.h b/arch/powerpc/include/asm/copro.h
> new file mode 100644
> index 0000000..2858108
> --- /dev/null
> +++ b/arch/powerpc/include/asm/copro.h
> @@ -0,0 +1,18 @@
> +/*
> + * Copyright 2014 IBM Corp.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#ifndef _ASM_POWERPC_COPRO_H
> +#define _ASM_POWERPC_COPRO_H
> +
> +int copro_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
> + unsigned long dsisr, unsigned *flt);
> +
> +int copro_data_segment(struct mm_struct *mm, u64 ea, u64 *esid, u64 *vsid);
This function is otherwise not included in this patch, so it should
probably be removed (as the next patch removes it anyway).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH 06/44] gpio-poweroff: Drop reference to pm_power_off from devicetree bindings
From: Mark Rutland @ 2014-10-07 11:03 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja@ml.linux-m32r.org, linux-mips@linux-mips.org,
linux-m68k@vger.kernel.org, linux-efi@vger.kernel.org,
linux-ia64@vger.kernel.org, linux-xtensa@linux-xtensa.org,
devel@driverdev.osuosl.org, linux-s390@vger.kernel.org,
lguest@lists.ozlabs.org, linux-c6x-dev@linux-c6x.org,
linux-hexagon@vger.kernel.org, linux-sh@vger.kernel.org,
linux-acpi@vger.kernel.org, Pawel Moll,
xen-devel@lists.xenproject.org, devicetree@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net,
linux-pm@vger.kernel.org,
adi-buildroot-devel@lists.sourceforge.net,
linux-am33-list@redhat.com, linux-tegra@vger.kernel.org,
openipmi-developer@lists.sourceforge.net,
linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com,
linux-kernel@vger.kernel.org, Rob Herring,
linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <1412659726-29957-7-git-send-email-linux@roeck-us.net>
On Tue, Oct 07, 2014 at 06:28:08AM +0100, Guenter Roeck wrote:
> pm_power_off is an implementation detail. Replace it with a more generic
> description of the driver's functionality.
>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Documentation/devicetree/bindings/gpio/gpio-poweroff.txt | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
> index d4eab92..c95a1a6 100644
> --- a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
> +++ b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
> @@ -2,12 +2,12 @@ Driver a GPIO line that can be used to turn the power off.
>
> The driver supports both level triggered and edge triggered power off.
> At driver load time, the driver will request the given gpio line and
> -install a pm_power_off handler. If the optional properties 'input' is
> -not found, the GPIO line will be driven in the inactive
> +install a handler to power off the system. If the optional properties
> +'input' is not found, the GPIO line will be driven in the inactive
> state. Otherwise its configured as an input.
>
> -When the pm_power_off is called, the gpio is configured as an output,
> -and drive active, so triggering a level triggered power off
> +When the the poweroff handler is called, the gpio is configured as an
> +output, and drive active, so triggering a level triggered power off
> condition. This will also cause an inactive->active edge condition, so
> triggering positive edge triggered power off. After a delay of 100ms,
> the GPIO is set to inactive, thus causing an active->inactive edge,
> @@ -24,7 +24,7 @@ Required properties:
>
> Optional properties:
> - input : Initially configure the GPIO line as an input. Only reconfigure
> - it to an output when the pm_power_off function is called. If this optional
> + it to an output when the poweroff handler is called. If this optional
> property is not specified, the GPIO is initialized as an output in its
> inactive state.
>
> --
> 1.9.1
>
>
^ permalink raw reply
* Re: [PATCH 07/44] qnap-poweroff: Drop reference to pm_power_off from devicetree bindings
From: Mark Rutland @ 2014-10-07 11:02 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja@ml.linux-m32r.org, linux-mips@linux-mips.org,
linux-m68k@vger.kernel.org, linux-efi@vger.kernel.org,
linux-ia64@vger.kernel.org, linux-xtensa@linux-xtensa.org,
devel@driverdev.osuosl.org, linux-s390@vger.kernel.org,
lguest@lists.ozlabs.org, linux-c6x-dev@linux-c6x.org,
linux-hexagon@vger.kernel.org, linux-sh@vger.kernel.org,
linux-acpi@vger.kernel.org, Pawel Moll,
xen-devel@lists.xenproject.org, devicetree@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net,
linux-pm@vger.kernel.org,
adi-buildroot-devel@lists.sourceforge.net,
linux-am33-list@redhat.com, linux-tegra@vger.kernel.org,
openipmi-developer@lists.sourceforge.net,
linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com,
linux-kernel@vger.kernel.org, Rob Herring,
linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <1412659726-29957-8-git-send-email-linux@roeck-us.net>
On Tue, Oct 07, 2014 at 06:28:09AM +0100, Guenter Roeck wrote:
> Replace reference to pm_power_off (which is an implementation detail)
> and replace it with a more generic description of the driver's functionality.
>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> index af25e77..1e2260a 100644
> --- a/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> +++ b/Documentation/devicetree/bindings/power_supply/qnap-poweroff.txt
> @@ -3,8 +3,8 @@
> QNAP NAS devices have a microcontroller controlling the main power
> supply. This microcontroller is connected to UART1 of the Kirkwood and
> Orion5x SoCs. Sending the character 'A', at 19200 baud, tells the
> -microcontroller to turn the power off. This driver adds a handler to
> -pm_power_off which is called to turn the power off.
> +microcontroller to turn the power off. This driver installs a handler
> +to power off the system.
I'd remove the last sentence -- the driver is also independent of the
HW, and the description of how the power off works at the HW level is
sufficient.
With that:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Thanks,
Mark.
^ permalink raw reply
* Re: [PATCH 05/44] mfd: as3722: Drop reference to pm_power_off from devicetree bindings
From: Mark Rutland @ 2014-10-07 10:59 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-m32r-ja@ml.linux-m32r.org, linux-mips@linux-mips.org,
linux-m68k@vger.kernel.org, linux-efi@vger.kernel.org,
linux-ia64@vger.kernel.org, linux-xtensa@linux-xtensa.org,
devel@driverdev.osuosl.org, linux-s390@vger.kernel.org,
lguest@lists.ozlabs.org, linux-c6x-dev@linux-c6x.org,
linux-hexagon@vger.kernel.org, linux-sh@vger.kernel.org,
linux-acpi@vger.kernel.org, Pawel Moll,
xen-devel@lists.xenproject.org, devicetree@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net,
linux-pm@vger.kernel.org,
adi-buildroot-devel@lists.sourceforge.net,
linux-am33-list@redhat.com, linux-tegra@vger.kernel.org,
openipmi-developer@lists.sourceforge.net,
linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com,
linux-kernel@vger.kernel.org, Rob Herring,
linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <1412659726-29957-6-git-send-email-linux@roeck-us.net>
On Tue, Oct 07, 2014 at 06:28:07AM +0100, Guenter Roeck wrote:
> Devicetree bindings are supposed to be operating system independent
> and should thus not describe how a specific functionality is implemented
> in Linux.
>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Documentation/devicetree/bindings/mfd/as3722.txt | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Thanks for the fix-up!
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
>
> diff --git a/Documentation/devicetree/bindings/mfd/as3722.txt b/Documentation/devicetree/bindings/mfd/as3722.txt
> index 4f64b2a..0b2a609 100644
> --- a/Documentation/devicetree/bindings/mfd/as3722.txt
> +++ b/Documentation/devicetree/bindings/mfd/as3722.txt
> @@ -122,8 +122,7 @@ Following are properties of regulator subnode.
>
> Power-off:
> =========
> -AS3722 supports the system power off by turning off all its rail. This
> -is provided through pm_power_off.
> +AS3722 supports the system power off by turning off all its rails.
> The device node should have the following properties to enable this
> functionality
> ams,system-power-controller: Boolean, to enable the power off functionality
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* [PATCH v3 16/16] cxl: Add documentation for userspace APIs
From: Michael Neuling @ 2014-10-07 10:48 UTC (permalink / raw)
To: greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, Aneesh Kumar K.V, imunsie, linux-kernel,
linuxppc-dev, jk, anton
In-Reply-To: <1412678902-18672-1-git-send-email-mikey@neuling.org>
From: Ian Munsie <imunsie@au1.ibm.com>
This documentation gives an overview of the hardware architecture, userspace
APIs via /dev/cxl/afu0.0 and the syfs files. It also adds a MAINTAINERS file
entry for cxl.
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
Documentation/ABI/testing/sysfs-class-cxl | 142 ++++++++++++
Documentation/ioctl/ioctl-number.txt | 1 +
Documentation/powerpc/00-INDEX | 2 +
Documentation/powerpc/cxl.txt | 346 ++++++++++++++++++++++++++++++
MAINTAINERS | 7 +
5 files changed, 498 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-class-cxl
create mode 100644 Documentation/powerpc/cxl.txt
diff --git a/Documentation/ABI/testing/sysfs-class-cxl b/Documentation/ABI/testing/sysfs-class-cxl
new file mode 100644
index 0000000..ca429fc
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-cxl
@@ -0,0 +1,142 @@
+Slave contexts (eg. /sys/class/cxl/afu0.0):
+
+What: /sys/class/cxl/<afu>/irqs_max
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Maximum number of interrupts that can be requested by userspace.
+ The default on probe is the maximum that hardware can support
+ (eg. 2037). Write values will limit userspace applications to
+ that many userspace interrupts. Must be >= irqs_min.
+
+What: /sys/class/cxl/<afu>/irqs_min
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ The minimum number of interrupts that userspace must request
+ on a CXL_START_WORK ioctl. Userspace may omit the
+ num_interrupts field in the START_WORK IOCTL to get this
+ minimum automatically.
+
+What: /sys/class/cxl/<afu>/mmio_size
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Size of the MMIO space that may be mmaped by userspace.
+
+
+What: /sys/class/cxl/<afu>/models_supported
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ List of the models this AFU supports.
+ Valid entries are: "dedicated_process" and "afu_directed"
+
+What: /sys/class/cxl/<afu>/model
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read/write
+ The current model the AFU is using. Will be one of the models
+ given in models_supported. Writing will change the model
+ provided that no user contexts are attached.
+
+
+What: /sys/class/cxl/<afu>/prefault_mode
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read/write
+ Set the mode for prefaulting in segments into the segment table
+ when performing the START_WORK ioctl. Possible values:
+ none: No prefaulting (default)
+ wed: Treat the wed as an effective address and prefault it
+ all: all segments this process currently maps
+
+What: /sys/class/cxl/<afu>/reset
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: write only
+ Reset the AFU.
+
+What: /sys/class/cxl/<afu>/api_version
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ List the current version of the kernel/user API.
+
+What: /sys/class/cxl/<afu>/api_version_com
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ List the lowest version the kernel/user API this
+ kernel is compatible with.
+
+
+
+Master contexts (eg. /sys/class/cxl/afu0.0m)
+
+What: /sys/class/cxl/<afu>m/mmio_size
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Size of the MMIO space that may be mmaped by userspace. This
+ includes all slave contexts space also.
+
+What: /sys/class/cxl/<afu>m/pp_mmio_len
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Per Process MMIO space length.
+
+What: /sys/class/cxl/<afu>m/pp_mmio_off
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Per Process MMIO space offset.
+
+
+Card info (eg. /sys/class/cxl/card0)
+
+What: /sys/class/cxl/<card>/caia_version
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Identifies the CAIA Version the card implements.
+
+What: /sys/class/cxl/<card>/psl_version
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Identifies the revision level of the PSL.
+
+What: /sys/class/cxl/<card>/base_image
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Identifies the revision level of the base image for devices
+ that support load-able PSLs. For FPGAs this field identifies
+ the image contained in the on-adapter flash which is loaded
+ during the initial program load
+
+What: /sys/class/cxl/<card>/image_loaded
+Date: September 2014
+Contact: Ian Munsie <imunsie@au1.ibm.com>,
+ Michael Neuling <mikey@neuling.org>
+Description: read only
+ Will return "user" or "factory" depending on the image loaded
+ onto the card
+
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
index 7e240a7..8136e1f 100644
--- a/Documentation/ioctl/ioctl-number.txt
+++ b/Documentation/ioctl/ioctl-number.txt
@@ -313,6 +313,7 @@ Code Seq#(hex) Include File Comments
0xB1 00-1F PPPoX <mailto:mostrows@styx.uwaterloo.ca>
0xB3 00 linux/mmc/ioctl.h
0xC0 00-0F linux/usb/iowarrior.h
+0xCA 00-0F uapi/misc/cxl.h
0xCB 00-1F CBM serial IEC bus in development:
<mailto:michael.klein@puffin.lb.shuttle.de>
0xCD 01 linux/reiserfs_fs.h
diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX
index a68784d..116d94d 100644
--- a/Documentation/powerpc/00-INDEX
+++ b/Documentation/powerpc/00-INDEX
@@ -28,3 +28,5 @@ ptrace.txt
- Information on the ptrace interfaces for hardware debug registers.
transactional_memory.txt
- Overview of the Power8 transactional memory support.
+cxl.txt
+ - Overview of the CXL driver.
diff --git a/Documentation/powerpc/cxl.txt b/Documentation/powerpc/cxl.txt
new file mode 100644
index 0000000..36f7ba4
--- /dev/null
+++ b/Documentation/powerpc/cxl.txt
@@ -0,0 +1,346 @@
+Coherent Accelerator Interface (CXL)
+====================================
+
+Introduction
+============
+
+ The coherent accelerator interface is designed to allow the
+ coherent connection of FPGA based accelerators (and other devices)
+ to a POWER system. These devices need to adhere to the Coherent
+ Accelerator Interface Architecture (CAIA).
+
+ IBM refers to this as the Coherent Accelerator Processor Interface
+ or CAPI. In the kernel it's referred to by the name CXL to avoid
+ confusion with the ISDN CAPI subsystem.
+
+Hardware overview
+=================
+
+ POWER8 FPGA
+ +----------+ +---------+
+ | | | |
+ | CPU | | AFU |
+ | | | |
+ | | | |
+ | | | |
+ +----------+ +---------+
+ | | | |
+ | CAPP +--------+ PSL |
+ | | PCIe | |
+ +----------+ +---------+
+
+ The POWER8 chip has a Coherently Attached Processor Proxy (CAPP)
+ unit which is part of the PCIe Host Bridge (PHB). This is managed
+ by Linux by calls into OPAL. Linux doesn't directly program the
+ CAPP.
+
+ The FPGA (or coherently attached device) consists of two parts.
+ The POWER Service Layer (PSL) and the Accelerator Function Unit
+ (AFU). AFU is used to implement specific functionality behind
+ the PSL. The PSL, among other things, provides memory address
+ translation services to allow each AFU direct access to userspace
+ memory.
+
+ The AFU is the core part of the accelerator (eg. the compression,
+ crypto etc function). The kernel has no knowledge of the function
+ of the AFU. Only userspace interacts directly with the AFU.
+
+ The PSL provides the translation and interrupt services that the
+ AFU needs. This is what the kernel interacts with. For example,
+ if the AFU needs to read a particular virtual address, it sends
+ that address to the PSL, the PSL then translates it, fetches the
+ data from memory and returns it to the AFU. If the PSL has a
+ translation miss, it interrupts the kernel and the kernel services
+ the fault. The context to which this fault is serviced is based
+ on who owns that acceleration function.
+
+AFU Models
+==========
+
+ There are two programming models supported by the AFU. Dedicated
+ and AFU directed. AFU may support one or both models.
+
+ In dedicated model only one MMU context is supported. In this
+ model, only one userspace process can use the accelerator at time.
+
+ In AFU directed model, up to 16K simultaneous contexts can be
+ supported. This means up to 16K simultaneous userspace
+ applications may use the accelerator (although specific AFUs may
+ support less). In this mode, the AFU sends a 16 bit context ID
+ with each of its requests. This tells the PSL which context is
+ associated with this operation. If the PSL can't translate a
+ request, the ID can also be accessed by the kernel so it can
+ determine the associated userspace context to service this
+ translation with.
+
+MMIO space
+==========
+
+ A portion of the FPGA MMIO space can be directly mapped from the
+ AFU to userspace. Either the whole space can be mapped (master
+ context), or just a per context portion (slave context). The
+ hardware is self describing, hence the kernel can determine the
+ offset and size of the per context portion.
+
+Interrupts
+==========
+
+ AFUs may generate interrupts that are destined for userspace. These
+ are received by the kernel as hardware interrupts and passed onto
+ userspace.
+
+ Data storage faults and error interrupts are handled by the kernel
+ driver.
+
+Work Element Descriptor (WED)
+=============================
+
+ The WED is a 64bit parameter passed to the AFU when a context is
+ started. Its format is up to the AFU hence the kernel has no
+ knowledge of what it represents. Typically it will be a virtual
+ address pointer to a work queue where the AFU and userspace can
+ share control and status information or work queues.
+
+
+
+
+User API
+========
+
+ For AFUs operating in the AFU directed model, the driver will
+ create two character devices per AFU under /dev/cxl. One for
+ master and one for slave contexts.
+
+ The master context (eg. /dev/cxl/afu0.0m), has access to all of
+ the MMIO space that an AFU provides. The slave context
+ (eg. /dev/cxl/afu0.0) has access to only the per process MMIO
+ space an AFU provides (AFU directed only).
+
+ For AFUs operating in the dedicated process model, the driver will
+ only create a single character device per AFU (e.g.
+ /dev/cxl/afu0.0), which has access to the entire MMIO space that
+ the AFU provides.
+
+ The following file operations are supported on both slave and
+ master devices:
+
+ open
+
+ Opens the device and allocates a file descriptor to be used
+ with the rest of the API.
+
+ A dedicated model AFU only has one context and hence only
+ allows this device to be opened once.
+
+ An AFU directed model AFU can have many contexts and hence
+ this device can be opened by as many contexts as available.
+
+ Note: IRQs also need to be allocated per context, which may
+ also limit the number of contexts that can be allocated,
+ and hence how many times the device may be opened. The
+ POWER8 CAPP supports 2040 IRQs and 3 are used by the
+ kernel, so 2037 are left. If 1 IRQ is needed per
+ context, then only 2037 contexts can be allocated. If 4
+ IRQs are needed per context, then only 2037/4 = 509
+ contexts can be allocated.
+
+ ioctl
+
+ CXL_IOCTL_START_WORK:
+ Starts the AFU context and associates it with the process
+ memory. Once this ioctl is successfully executed, all
+ memory mapped into this process is accessible to this AFU
+ context using the same virtual addresses. No additional
+ calls are required to map/unmap memory. The AFU memory
+ context will be updated as userspace allocates and frees
+ memory. This ioctl returns once the AFU context is
+ started.
+
+ Takes a pointer to a struct cxl_ioctl_start_work
+ struct cxl_ioctl_start_work {
+ __u64 flags;
+ __u64 wed;
+ __u64 amr;
+ __s16 num_interrupts;
+ __s16 reserved1;
+ __s32 reserved2;
+ __u64 reserved3;
+ __u64 reserved4;
+ __u64 reserved5;
+ __u64 reserved6;
+ };
+
+ flags:
+ Indicates which optional fields (e.g. amr,
+ num_interrupts) in the structure are valid.
+
+ wed:
+ The Work Element Descriptor (WED) is a 64bit
+ argument defined by the AFU. Typically this is an
+ virtual address pointing to an AFU specific
+ structure describing what work to perform.
+
+ amr:
+ Authority Mask Register (AMR), same as the powerpc
+ AMR.
+
+ num_interrupt:
+ Number of userspace interrupts to request. If not
+ specified the minimum number required will be
+ automatically allocated. The min and max number
+ can be obtained from sysfs.
+
+ reserved fields:
+ For ABI padding and future extensions
+
+ CXL_IOCTL_GET_PROCESS_ELEMENT:
+ Get info on current context id. This info is returned
+ from the kernel as an int.
+
+ Written by the kernel with the context id (AKA process
+ element) it has allocated. Slave contexts may want to
+ communicate this to a master process.
+
+ mmap
+
+ An AFU may have a MMIO space to facilitate communication with
+ the AFU and mmap allows access to this. The size and contents
+ of this area are specific to the particular AFU. The size can
+ be discovered via sysfs.
+
+ In the AFU directed model, master contexts will get all of the
+ MMIO space and slave contexts will get only the per process
+ space associated with its context. In the dedicated process
+ model the entire MMIO space is always mapped.
+
+ This mmap call must be done after the IOCTL is started.
+
+ Care should be taken when accessing MMIO space. Only 32 and
+ 64bit accesses are supported by POWER8. Also, the AFU will be
+ designed with a specific endian, so all MMIO access should
+ consider endian (recommend endian(3) variants like: le64toh(),
+ be64toh() etc). These endian issues equally apply to shared
+ memory queues the WED may describe.
+
+ read
+
+ Reads an event from the AFU. Will return -EINVAL if the user
+ supplied buffer to read into is less than 4096 bytes. Blocks
+ if no events are pending (unless O_NONBLOCK is supplied). Will
+ return -EIO in the case of an unrecoverable error or if the
+ card is removed.
+
+ A read may return multiple events. A read will return the
+ length of the buffer written and it will be a integral number
+ of events up to the buffer size. Users must supply a buffer
+ size of at least 4K bytes.
+
+ All events will be return a struct cxl_event which varies in
+ size.
+
+ struct cxl_event {
+ struct cxl_event_header header;
+ union {
+ struct cxl_event_afu_interrupt irq;
+ struct cxl_event_data_storage fault;
+ struct cxl_event_afu_error afu_err;
+ };
+ };
+
+ A struct cxl_event_header at the start gives:
+ struct cxl_event_header {
+ __u16 type;
+ __u16 size;
+ __u16 process_element;
+ __u16 reserved1;
+ };
+
+ type:
+ This gives the type of event. The type determines how
+ the rest of the event will be structured. These types
+ are shown below.
+
+ size:
+ This is the size of the event in bytes including the
+ header. The start of the next event can be found at
+ this offset from the start of the current event.
+
+ process_element:
+ Context ID of the event. Currently this will always
+ be the current context. Future work may allow
+ interrupts from one context to be routed to another
+ (eg. a master contexts handling error interrupts on
+ behalf of a slave).
+
+ reserved field:
+ For future extensions and padding.
+
+ If an AFU interrupt event is received, the full structure received is:
+ struct cxl_event_afu_interrupt {
+ __u16 flags;
+ __u16 irq; /* Raised AFU interrupt number */
+ __u32 reserved1;
+ };
+
+ flags:
+ These flags indicate which optional fields are present
+ in this struct. Currently all fields are Mandatory.
+
+ irq:
+ The IRQ number sent by the AFU.
+
+ reserved field:
+ For future extensions and padding.
+
+ If a data storage event is received, the full structure received is:
+ struct cxl_event_data_storage {
+ __u16 flags;
+ __u16 reserved1;
+ __u32 reserved2;
+ __u64 addr;
+ __u64 dsisr;
+ __u64 reserved3;
+ };
+
+ flags:
+ These flags indicate which optional fields are present
+ in this struct. Currently all fields are Mandatory.
+
+ address: Mandatory
+ Address of the data storage trying to be accessed by
+ the AFU. Valid accesses will handled transparently by
+ the kernel but invalid access will generate this
+ event.
+
+ dsisr: Manditory
+ These fields give information on the type of
+ fault. Copy of the DSISR from PSL hardware when
+ address fault occured.
+
+ reserved fields:
+ For future extensions
+
+ If an AFU error event is received, the full structure received is:
+ struct cxl_event_afu_error {
+ __u16 flags;
+ __u16 reserved1;
+ __u32 reserved2;
+ __u64 err;
+ };
+
+ flags: Mandatory
+ These flags indicate which optional fields are present
+ in this struct. Currently all fields are Mandatory.
+
+ err:
+ Error status from the AFU. AFU defined.
+
+ reserved fields:
+ For future extensions and padding
+
+Sysfs Class
+===========
+
+ A cxl sysfs class is added under /sys/class/cxl to facilitate
+ enumeration and tuning of the accelerators. Its layout is
+ described in Documentation/ABI/testing/sysfs-class-cxl
diff --git a/MAINTAINERS b/MAINTAINERS
index 809ecd6..c972be3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2711,6 +2711,13 @@ W: http://www.chelsio.com
S: Supported
F: drivers/net/ethernet/chelsio/cxgb4vf/
+CXL (IBM Coherent Accelerator Processor Interface CAPI) DRIVER
+M: Ian Munsie <imunsie@au1.ibm.com>
+M: Michael Neuling <mikey@neuling.org>
+L: linuxppc-dev@lists.ozlabs.org
+S: Supported
+F: drivers/misc/cxl/
+
STMMAC ETHERNET DRIVER
M: Giuseppe Cavallaro <peppe.cavallaro@st.com>
L: netdev@vger.kernel.org
--
1.9.1
^ permalink raw reply related
* [PATCH v3 15/16] cxl: Add driver to Kbuild and Makefiles
From: Michael Neuling @ 2014-10-07 10:48 UTC (permalink / raw)
To: greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, Aneesh Kumar K.V, imunsie, linux-kernel,
linuxppc-dev, jk, anton
In-Reply-To: <1412678902-18672-1-git-send-email-mikey@neuling.org>
From: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
drivers/misc/cxl/Kconfig | 10 ++++++++++
drivers/misc/cxl/Makefile | 2 ++
2 files changed, 12 insertions(+)
diff --git a/drivers/misc/cxl/Kconfig b/drivers/misc/cxl/Kconfig
index 5cdd319..585d6e3 100644
--- a/drivers/misc/cxl/Kconfig
+++ b/drivers/misc/cxl/Kconfig
@@ -6,3 +6,13 @@ config CXL_BASE
bool
default n
select PPC_COPRO_BASE
+
+config CXL
+ tristate "Support for IBM Coherent Accelerators (CXL)"
+ depends on PPC_POWERNV && PCI_MSI
+ select CXL_BASE
+ default m
+ help
+ Select this option to enable userspace driver support for IBM
+ Coherent Accelerators (CXL). CXL is otherwise known as Coherent
+ Accelerator Processor Interface (CAPI).
diff --git a/drivers/misc/cxl/Makefile b/drivers/misc/cxl/Makefile
index e30ad0a..165e98f 100644
--- a/drivers/misc/cxl/Makefile
+++ b/drivers/misc/cxl/Makefile
@@ -1 +1,3 @@
+cxl-y += main.o file.o irq.o fault.o native.o context.o sysfs.o debugfs.o pci.o
+obj-$(CONFIG_CXL) += cxl.o
obj-$(CONFIG_CXL_BASE) += base.o
--
1.9.1
^ permalink raw reply related
* [PATCH v3 14/16] cxl: Userspace header file.
From: Michael Neuling @ 2014-10-07 10:48 UTC (permalink / raw)
To: greg, arnd, mpe, benh
Cc: cbe-oss-dev, mikey, Aneesh Kumar K.V, imunsie, linux-kernel,
linuxppc-dev, jk, anton
In-Reply-To: <1412678902-18672-1-git-send-email-mikey@neuling.org>
From: Ian Munsie <imunsie@au1.ibm.com>
This defines structs and magic numbers required for userspace to interact with
the kernel cxl driver via /dev/cxl/afu0.0.
It adds this header file Kbuild so it's exported when doing make
headers_installs.
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
include/uapi/Kbuild | 1 +
include/uapi/misc/Kbuild | 2 ++
include/uapi/misc/cxl.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+)
create mode 100644 include/uapi/misc/Kbuild
create mode 100644 include/uapi/misc/cxl.h
diff --git a/include/uapi/Kbuild b/include/uapi/Kbuild
index 81d2106..245aa6e 100644
--- a/include/uapi/Kbuild
+++ b/include/uapi/Kbuild
@@ -12,3 +12,4 @@ header-y += video/
header-y += drm/
header-y += xen/
header-y += scsi/
+header-y += misc/
diff --git a/include/uapi/misc/Kbuild b/include/uapi/misc/Kbuild
new file mode 100644
index 0000000..e96cae7
--- /dev/null
+++ b/include/uapi/misc/Kbuild
@@ -0,0 +1,2 @@
+# misc Header export list
+header-y += cxl.h
diff --git a/include/uapi/misc/cxl.h b/include/uapi/misc/cxl.h
new file mode 100644
index 0000000..0aaecf3
--- /dev/null
+++ b/include/uapi/misc/cxl.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2014 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _UAPI_ASM_CXL_H
+#define _UAPI_ASM_CXL_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* Structs for IOCTLS for userspace to talk to the kernel */
+struct cxl_ioctl_start_work {
+ __u64 flags;
+ __u64 wed;
+ __u64 amr;
+ __s16 num_interrupts;
+ __s16 reserved1;
+ __s32 reserved2;
+ __u64 reserved3;
+ __u64 reserved4;
+ __u64 reserved5;
+ __u64 reserved6;
+};
+#define CXL_START_WORK_AMR 0x0000000000000001ULL
+#define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL
+#define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\
+ CXL_START_WORK_NUM_IRQS)
+
+/* IOCTL numbers */
+#define CXL_MAGIC 0xCA
+#define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work)
+#define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, int)
+
+/* Events from read() */
+#define CXL_READ_MIN_SIZE 0x1000 /* 4K */
+enum cxl_event_type {
+ CXL_EVENT_RESERVED = 0,
+ CXL_EVENT_AFU_INTERRUPT = 1,
+ CXL_EVENT_DATA_STORAGE = 2,
+ CXL_EVENT_AFU_ERROR = 3,
+};
+
+struct cxl_event_header {
+ __u16 type;
+ __u16 size;
+ __u16 process_element;
+ __u16 reserved1;
+};
+
+struct cxl_event_afu_interrupt {
+ __u16 flags;
+ __u16 irq; /* Raised AFU interrupt number */
+ __u32 reserved1;
+};
+
+struct cxl_event_data_storage {
+ __u16 flags;
+ __u16 reserved1;
+ __u32 reserved2;
+ __u64 addr;
+ __u64 dsisr;
+ __u64 reserved3;
+};
+
+struct cxl_event_afu_error {
+ __u16 flags;
+ __u16 reserved1;
+ __u32 reserved2;
+ __u64 err;
+};
+
+struct cxl_event {
+ struct cxl_event_header header;
+ union {
+ struct cxl_event_afu_interrupt irq;
+ struct cxl_event_data_storage fault;
+ struct cxl_event_afu_error afu_err;
+ };
+};
+
+#endif
--
1.9.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox