* [PATCH] Fix interrupt handling in MPC8xxx GPIO driver
From: Felix Radensky @ 2011-10-11 8:24 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Felix Radensky, stable
Interrupt handler in MPC8xxx GPIO driver is missing the call
to PIC EOI (end of interrupt) handler. As a result, at least
on 85XX systems, GPIO interrupt is delivered only once. This
patch adds the missing EOI call. Tested on custom P1022 board.
Signed-off-by: Felix Radensky <felix@embedded-sol.com>
---
arch/powerpc/sysdev/mpc8xxx_gpio.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/mpc8xxx_gpio.c b/arch/powerpc/sysdev/mpc8xxx_gpio.c
index fb4963a..d2e0e1c 100644
--- a/arch/powerpc/sysdev/mpc8xxx_gpio.c
+++ b/arch/powerpc/sysdev/mpc8xxx_gpio.c
@@ -153,6 +153,7 @@ static void mpc8xxx_gpio_irq_cascade(unsigned int irq, struct irq_desc *desc)
if (mask)
generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
32 - ffs(mask)));
+ desc->chip->eoi(irq);
}
static void mpc8xxx_irq_unmask(struct irq_data *d)
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH v14 02/10] USB/ppc4xx: Add Synopsys DesignWare HS USB OTG driver framework
From: Kassey Lee @ 2011-10-11 8:57 UTC (permalink / raw)
To: tmarri; +Cc: Mark Miesfeld, greg, linux-usb, linuxppc-dev, Fushen Chen
In-Reply-To: <1317954632-11768-1-git-send-email-tmarri@apm.com>
hi, Tirumala:
I did find any private info for ppc in
drivers/usb/dwc/apmppc.c
do you want make it generic driver ? if yes, it could be a
generic name too.
thanks !
2011/10/7 <tmarri@apm.com>:
> From: Tirumala Marri <tmarri@apm.com>
>
> Platform probing is in apmppc.c.
> Driver parameter and parameter checking are in param.c.
>
> Signed-off-by: Tirumala R Marri<tmarri@apm.com>
> Signed-off-by: Fushen Chen <fchen@apm.com>
> Signed-off-by: Mark Miesfeld <mmiesfeld@apm.com>
> ---
> =A0drivers/usb/dwc/apmppc.c | =A0353 ++++++++++++++++++++++++++++++++++++=
++++++++++
> =A0drivers/usb/dwc/driver.h | =A0 76 ++++++++++
> =A0drivers/usb/dwc/param.c =A0| =A0180 +++++++++++++++++++++++
> =A03 files changed, 609 insertions(+), 0 deletions(-)
> =A0create mode 100644 drivers/usb/dwc/apmppc.c
> =A0create mode 100644 drivers/usb/dwc/driver.h
> =A0create mode 100644 drivers/usb/dwc/param.c
>
> diff --git a/drivers/usb/dwc/apmppc.c b/drivers/usb/dwc/apmppc.c
> new file mode 100644
> index 0000000..5053c6a
> --- /dev/null
> +++ b/drivers/usb/dwc/apmppc.c
> @@ -0,0 +1,353 @@
> +/*
> + * DesignWare HS OTG controller driver
> + * Copyright (C) 2006 Synopsys, Inc.
> + * Portions Copyright (C) 2010 Applied Micro Circuits Corporation.
> + *
> + * This program is free software: you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License version 2 for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see http://www.gnu.org/licenses
> + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
> + * Suite 500, Boston, MA 02110-1335 USA.
> + *
> + * Based on Synopsys driver version 2.60a
> + * Modified by Mark Miesfeld <mmiesfeld@apm.com>
> + * Modified by Stefan Roese <sr@denx.de>, DENX Software Engineering
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO T=
HE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL SYNOPSYS, INC. BE LIABLE FOR ANY DI=
RECT,
> + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES
> + * (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SER=
VICES;
> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUS=
ED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR =
TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE=
OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + */
> +
> +/*
> + * The dwc_otg module provides the initialization and cleanup entry
> + * points for the dwcotg driver. This module will be dynamically install=
ed
> + * after Linux is booted using the insmod command. When the module is
> + * installed, the dwc_otg_driver_init function is called. When the modul=
e is
> + * removed (using rmmod), the dwc_otg_driver_cleanup function is called.
> + *
> + * This module also defines a data structure for the dwc_otg driver, whi=
ch is
> + * used in conjunction with the standard device structure. These
> + * structures allow the OTG driver to comply with the standard Linux dri=
ver
> + * model in which devices and drivers are registered with a bus driver. =
This
> + * has the benefit that Linux can expose attributes of the driver and de=
vice
> + * in its special sysfs file system. Users can then read or write files =
in
> + * this file system to perform diagnostics on the driver components or t=
he
> + * device.
> + */
> +
> +#include <linux/of_platform.h>
> +
> +#include "driver.h"
> +
> +#define DWC_DRIVER_VERSION =A0 =A0 =A0 =A0 =A0 =A0 "1.05"
> +#define DWC_DRIVER_DESC =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"=
HS OTG USB Controller driver"
> +static const char dwc_driver_name[] =3D "dwc_otg";
> +
> +static irqreturn_t dwc_otg_common_irq(int _irq, void *dev)
> +{
> + =A0 =A0 =A0 struct dwc_otg_device *dwc_dev =3D dev;
> + =A0 =A0 =A0 int retval;
> + =A0 =A0 =A0 struct dwc_hcd *dwc_hcd;
> +
> + =A0 =A0 =A0 dwc_hcd =3D dwc_dev->hcd;
> + =A0 =A0 =A0 spin_lock(&dwc_hcd->lock);
> + =A0 =A0 =A0 retval =3D dwc_otg_handle_common_intr(dwc_dev->core_if);
> + =A0 =A0 =A0 spin_unlock(&dwc_hcd->lock);
> + =A0 =A0 =A0 return IRQ_RETVAL(retval);
> +}
> +
> +static irqreturn_t dwc_otg_externalchgpump_irq(int _irq, void *dev)
> +{
> + =A0 =A0 =A0 struct dwc_otg_device *dwc_dev =3D dev;
> +
> + =A0 =A0 =A0 if (dwc_otg_is_host_mode(dwc_dev->core_if)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct dwc_hcd *dwc_hcd;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 u32 hprt0 =3D 0;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_hcd =3D dwc_dev->hcd;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 spin_lock(&dwc_hcd->lock);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_hcd->flags.b.port_over_current_change =
=3D 1;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 hprt0 =3D DWC_HPRT0_PRT_PWR_RW(hprt0, 0);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_reg_write(dwc_dev->core_if->host_if->hp=
rt0, 0, hprt0);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 spin_unlock(&dwc_hcd->lock);
> + =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Device mode - This int is n/a for device=
mode */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_dbg(dev, "DeviceMode: OTG OverCurrent D=
etected\n");
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 return IRQ_HANDLED;
> +}
> +
> +static int __devexit dwc_otg_driver_remove(struct platform_device *ofdev=
)
> +{
> + =A0 =A0 =A0 struct device *dev =3D &ofdev->dev;
> + =A0 =A0 =A0 struct dwc_otg_device *dwc_dev =3D dev_get_drvdata(dev);
> +
> + =A0 =A0 =A0 /* Memory allocation for dwc_otg_device may have failed. */
> + =A0 =A0 =A0 if (!dwc_dev)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
> +
> + =A0 =A0 =A0 /* Free the IRQ */
> + =A0 =A0 =A0 free_irq(dwc_dev->irq, dwc_dev);
> + =A0 =A0 =A0 /* Free external charge pump irq */
> + =A0 =A0 =A0 free_irq(dwc_dev->hcd->cp_irq, dwc_dev);
> +
> + =A0 =A0 =A0 if (dwc_dev->hcd)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_otg_hcd_remove(dev);
> +
> + =A0 =A0 =A0 if (dwc_dev->pcd)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_otg_pcd_remove(dev);
> +
> + =A0 =A0 =A0 if (dwc_dev->core_if)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_otg_cil_remove(dwc_dev->core_if);
> +
> + =A0 =A0 =A0 /* Return the memory. */
> + =A0 =A0 =A0 if (dwc_dev->base)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 iounmap(dwc_dev->base);
> +
> + =A0 =A0 =A0 if (dwc_dev->phys_addr)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 release_mem_region(dwc_dev->phys_addr, dwc_=
dev->base_len);
> +
> + =A0 =A0 =A0 otg_put_transceiver(dwc_dev->core_if->xceiv);
> + =A0 =A0 =A0 dwc_dev->core_if->xceiv =3D NULL;
> +
> + =A0 =A0 =A0 kfree(dwc_dev);
> +
> + =A0 =A0 =A0 /* Clear the drvdata pointer. */
> + =A0 =A0 =A0 dev_set_drvdata(dev, NULL);
> + =A0 =A0 =A0 return 0;
> +}
> +
> +static int __devinit dwc_otg_driver_probe(struct platform_device *ofdev)
> +{
> + =A0 =A0 =A0 int retval;
> + =A0 =A0 =A0 struct dwc_otg_device *dwc_dev;
> + =A0 =A0 =A0 struct device *dev =3D &ofdev->dev;
> + =A0 =A0 =A0 struct resource res;
> + =A0 =A0 =A0 ulong gusbcfg_addr;
> + =A0 =A0 =A0 u32 usbcfg =3D 0;
> +
> + =A0 =A0 =A0 dwc_dev =3D kzalloc(sizeof(*dwc_dev), GFP_KERNEL);
> + =A0 =A0 =A0 if (!dwc_dev) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "kmalloc of dwc_otg_device fai=
led\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -ENOMEM;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_dwc_dev;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 /* Retrieve the memory and IRQ resources. */
> + =A0 =A0 =A0 dwc_dev->irq =3D irq_of_parse_and_map(ofdev->dev.of_node, 0=
);
> + =A0 =A0 =A0 if (dwc_dev->irq =3D=3D NO_IRQ) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "no device irq\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -ENODEV;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_of_irq;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 if (of_address_to_resource(ofdev->dev.of_node, 0, &res)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "%s: Can't get USB-OTG registe=
r address\n",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 __func__);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -ENOMEM;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_of_irq;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 dwc_dev->phys_addr =3D res.start;
> + =A0 =A0 =A0 dwc_dev->base_len =3D res.end - res.start + 1;
> + =A0 =A0 =A0 if (!request_mem_region(dwc_dev->phys_addr,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_dev->ba=
se_len, dwc_driver_name)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "request_mem_region failed\n")=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -EBUSY;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_of_irq;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 /* Map the DWC_otg Core memory into virtual address space. =
*/
> + =A0 =A0 =A0 dwc_dev->base =3D ioremap(dwc_dev->phys_addr, dwc_dev->base=
_len);
> + =A0 =A0 =A0 if (!dwc_dev->base) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "ioremap() failed\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -ENOMEM;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_ioremap;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 dev_dbg(dev, "mapped base=3D0x%08x\n", (__force u32)dwc_dev=
->base);
> +
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* Initialize driver data to point to the global DWC_otg
> + =A0 =A0 =A0 =A0* Device structure.
> + =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 dev_set_drvdata(dev, dwc_dev);
> +
> + =A0 =A0 =A0 dwc_dev->core_if =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_otg_cil_init(dwc_dev->base, &dwc_otg_module_par=
ams);
> + =A0 =A0 =A0 if (!dwc_dev->core_if) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "CIL initialization failed!\n"=
);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -ENOMEM;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_cil_init;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* Validate parameter values after dwc_otg_cil_init.
> + =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 if (check_parameters(dwc_dev->core_if)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -EINVAL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_check_param;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 usb_nop_xceiv_register();
> + =A0 =A0 =A0 dwc_dev->core_if->xceiv =3D otg_get_transceiver();
> + =A0 =A0 =A0 if (!dwc_dev->core_if->xceiv) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -ENODEV;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_xceiv;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 dwc_set_feature(dwc_dev->core_if);
> +
> + =A0 =A0 =A0 /* Initialize the DWC_otg core. */
> + =A0 =A0 =A0 dwc_otg_core_init(dwc_dev->core_if);
> +
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* Disable the global interrupt until all the interrupt
> + =A0 =A0 =A0 =A0* handlers are installed.
> + =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 dwc_otg_disable_global_interrupts(dwc_dev->core_if);
> +
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* Install the interrupt handler for the common interrupt=
s before
> + =A0 =A0 =A0 =A0* enabling common interrupts in core_init below.
> + =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 retval =3D request_irq(dwc_dev->irq, dwc_otg_common_irq,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0IRQF_SHARED, "dw=
c_otg", dwc_dev);
> + =A0 =A0 =A0 if (retval) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "request of irq%d failed retva=
l: %d\n",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_dev->irq, retval);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D -EBUSY;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_req_irq;
> + =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_dev->common_irq_installed =3D 1;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 if (!dwc_has_feature(dwc_dev->core_if, DWC_HOST_ONLY)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Initialize the PCD */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D dwc_otg_pcd_init(dev);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (retval) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "dwc_otg_pcd_i=
nit failed\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_dev->pcd =3D NULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_req_irq;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 gusbcfg_addr =3D (ulong) (dwc_dev->core_if->core_global_reg=
s)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 + DWC_GUSBCFG;
> + =A0 =A0 =A0 if (!dwc_has_feature(dwc_dev->core_if, DWC_DEVICE_ONLY)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Initialize the HCD and force_host_mode *=
/
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 usbcfg =3D dwc_reg_read(gusbcfg_addr, 0);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 usbcfg |=3D DWC_USBCFG_FRC_HST_MODE;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_reg_write(gusbcfg_addr, 0, usbcfg);
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D dwc_otg_hcd_init(dev, dwc_dev);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (retval) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev, "dwc_otg_hcd_i=
nit failed\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_dev->hcd =3D NULL;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_hcd;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* configure chargepump interrupt */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_dev->hcd->cp_irq =3D irq_of_parse_and_m=
ap(ofdev->dev.of_node,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 3);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (dwc_dev->hcd->cp_irq) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D request_irq(dwc_=
dev->hcd->cp_irq,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0dwc_otg_externalchgpump_irq,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0IRQF_SHARED,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0 =A0"dwc_otg_ext_chg_pump", dwc_dev);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (retval) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_err(dev=
,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 "request of irq failed retval: %d\n",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 retval);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 retval =3D =
-EBUSY;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto fail_h=
cd;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dev_dbg(dev=
, "%s: ExtChgPump Detection "
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 "IRQ registered\n", dwc_driver_name);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* Enable the global interrupt after all the interrupt
> + =A0 =A0 =A0 =A0* handlers are installed.
> + =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 dwc_otg_enable_global_interrupts(dwc_dev->core_if);
> +
> + =A0 =A0 =A0 usbcfg =3D dwc_reg_read(gusbcfg_addr, 0);
> + =A0 =A0 =A0 usbcfg &=3D ~DWC_USBCFG_FRC_HST_MODE;
> + =A0 =A0 =A0 dwc_reg_write(gusbcfg_addr, 0, usbcfg);
> +
> + =A0 =A0 =A0 return 0;
> +fail_hcd:
> + =A0 =A0 =A0 free_irq(dwc_dev->irq, dwc_dev);
> + =A0 =A0 =A0 if (!dwc_has_feature(dwc_dev->core_if, DWC_HOST_ONLY)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (dwc_dev->pcd)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwc_otg_pcd_remove(dev);
> + =A0 =A0 =A0 }
> +fail_req_irq:
> + =A0 =A0 =A0 otg_put_transceiver(dwc_dev->core_if->xceiv);
> +fail_xceiv:
> + =A0 =A0 =A0 usb_nop_xceiv_unregister();
> +fail_check_param:
> + =A0 =A0 =A0 dwc_otg_cil_remove(dwc_dev->core_if);
> +fail_cil_init:
> + =A0 =A0 =A0 dev_set_drvdata(dev, NULL);
> + =A0 =A0 =A0 iounmap(dwc_dev->base);
> +fail_ioremap:
> + =A0 =A0 =A0 release_mem_region(dwc_dev->phys_addr, dwc_dev->base_len);
> +fail_of_irq:
> + =A0 =A0 =A0 kfree(dwc_dev);
> +fail_dwc_dev:
> + =A0 =A0 =A0 return retval;
> +}
> +
> +static const struct of_device_id dwc_otg_match[] =3D {
> + =A0 =A0 =A0 {.compatible =3D "amcc,dwc-otg",},
> + =A0 =A0 =A0 {}
> +};
> +
> +MODULE_DEVICE_TABLE(of, dwc_otg_match);
> +
> +static struct platform_driver dwc_otg_driver =3D {
> + =A0 =A0 =A0 .probe =3D dwc_otg_driver_probe,
> + =A0 =A0 =A0 .remove =3D __devexit_p(dwc_otg_driver_remove),
> + =A0 =A0 =A0 .driver =3D {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 .name =3D "dwc_otg",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 .owner =3D THIS_MODULE,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 .of_match_table =3D dwc_otg_match,
> + =A0 =A0 =A0 },
> +};
> +
> +static int __init dwc_otg_driver_init(void)
> +{
> +
> + =A0 =A0 =A0 return platform_driver_register(&dwc_otg_driver);
> +}
> +
> +module_init(dwc_otg_driver_init);
> +
> +static void __exit dwc_otg_driver_cleanup(void)
> +{
> + =A0 =A0 =A0 platform_driver_unregister(&dwc_otg_driver);
> +}
> +
> +module_exit(dwc_otg_driver_cleanup);
> +
> +MODULE_DESCRIPTION(DWC_DRIVER_DESC);
> +MODULE_AUTHOR("Mark Miesfeld <mmiesfeld@apm.com");
> +MODULE_LICENSE("GPL");
> diff --git a/drivers/usb/dwc/driver.h b/drivers/usb/dwc/driver.h
> new file mode 100644
> index 0000000..a86532b
> --- /dev/null
> +++ b/drivers/usb/dwc/driver.h
> @@ -0,0 +1,76 @@
> +/*
> + * DesignWare HS OTG controller driver
> + * Copyright (C) 2006 Synopsys, Inc.
> + * Portions Copyright (C) 2010 Applied Micro Circuits Corporation.
> + *
> + * This program is free software: you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License version 2 for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see http://www.gnu.org/licenses
> + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
> + * Suite 500, Boston, MA 02110-1335 USA.
> + *
> + * Based on Synopsys driver version 2.60a
> + * Modified by Mark Miesfeld <mmiesfeld@apm.com>
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO T=
HE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL SYNOPSYS, INC. BE LIABLE FOR ANY DI=
RECT,
> + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES
> + * (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SER=
VICES;
> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUS=
ED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR =
TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE=
OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + */
> +
> +#if !defined(__DWC_OTG_DRIVER_H__)
> +#define __DWC_OTG_DRIVER_H__
> +
> +/*
> + * This file contains the interface to the Linux driver.
> + */
> +#include "cil.h"
> +
> +/*
> + * This structure is a wrapper that encapsulates the driver components u=
sed to
> + * manage a single DWC_otg controller.
> + */
> +struct dwc_otg_device {
> + =A0 =A0 =A0 /* Base address returned from ioremap() */
> + =A0 =A0 =A0 __iomem void *base;
> +
> + =A0 =A0 =A0 /* Pointer to the core interface structure. */
> + =A0 =A0 =A0 struct core_if *core_if;
> +
> + =A0 =A0 =A0 /* Pointer to the PCD structure. */
> + =A0 =A0 =A0 struct dwc_pcd *pcd;
> +
> + =A0 =A0 =A0 /* Pointer to the HCD structure. */
> + =A0 =A0 =A0 struct dwc_hcd *hcd;
> +
> + =A0 =A0 =A0 /* Flag to indicate whether the common IRQ handler is insta=
lled. */
> + =A0 =A0 =A0 u8 common_irq_installed;
> +
> + =A0 =A0 =A0 /* Interrupt request number. */
> + =A0 =A0 =A0 unsigned int irq;
> +
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* Physical address of Control and Status registers, used=
by
> + =A0 =A0 =A0 =A0* release_mem_region().
> + =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 resource_size_t phys_addr;
> +
> + =A0 =A0 =A0 /* Length of memory region, used by release_mem_region(). *=
/
> + =A0 =A0 =A0 unsigned long base_len;
> +};
> +#endif
> diff --git a/drivers/usb/dwc/param.c b/drivers/usb/dwc/param.c
> new file mode 100644
> index 0000000..afae800
> --- /dev/null
> +++ b/drivers/usb/dwc/param.c
> @@ -0,0 +1,180 @@
> +/*
> + * DesignWare HS OTG controller driver
> + * Copyright (C) 2006 Synopsys, Inc.
> + * Portions Copyright (C) 2010 Applied Micro Circuits Corporation.
> + *
> + * This program is free software: you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License version 2 for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, see http://www.gnu.org/licenses
> + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
> + * Suite 500, Boston, MA 02110-1335 USA.
> + *
> + * Based on Synopsys driver version 2.60a
> + * Modified by Mark Miesfeld <mmiesfeld@apm.com>
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "=
AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO T=
HE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PU=
RPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL SYNOPSYS, INC. BE LIABLE FOR ANY DI=
RECT,
> + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES
> + * (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SER=
VICES;
> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUS=
ED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR =
TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE=
OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + */
> +
> +/*
> + * This file provides dwc_otg driver parameter and parameter checking.
> + */
> +
> +#include "cil.h"
> +
> +/*
> + * Encapsulate the module parameter settings
> + */
> +struct core_params dwc_otg_module_params =3D {
> + =A0 =A0 =A0 .otg_cap =3D -1,
> + =A0 =A0 =A0 .dma_enable =3D -1,
> + =A0 =A0 =A0 .dma_burst_size =3D -1,
> + =A0 =A0 =A0 .speed =3D -1,
> + =A0 =A0 =A0 .host_support_fs_ls_low_power =3D -1,
> + =A0 =A0 =A0 .host_ls_low_power_phy_clk =3D -1,
> + =A0 =A0 =A0 .enable_dynamic_fifo =3D -1,
> + =A0 =A0 =A0 .dev_rx_fifo_size =3D -1,
> + =A0 =A0 =A0 .dev_nperio_tx_fifo_size =3D -1,
> + =A0 =A0 =A0 .dev_perio_tx_fifo_size =3D {-1, -1, -1, -1, -1, -1, -1, -1=
,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 -1, -1, -1, -1, -1, -1, -1}, =A0 =A0/* 15 *=
/
> + =A0 =A0 =A0 .host_rx_fifo_size =3D -1,
> + =A0 =A0 =A0 .host_nperio_tx_fifo_size =3D -1,
> + =A0 =A0 =A0 .host_perio_tx_fifo_size =3D -1,
> + =A0 =A0 =A0 .max_transfer_size =3D -1,
> + =A0 =A0 =A0 .max_packet_count =3D -1,
> + =A0 =A0 =A0 .host_channels =3D -1,
> + =A0 =A0 =A0 .dev_endpoints =3D -1,
> + =A0 =A0 =A0 .phy_type =3D -1,
> + =A0 =A0 =A0 .phy_utmi_width =3D -1,
> + =A0 =A0 =A0 .phy_ulpi_ddr =3D -1,
> + =A0 =A0 =A0 .phy_ulpi_ext_vbus =3D -1,
> + =A0 =A0 =A0 .i2c_enable =3D -1,
> + =A0 =A0 =A0 .ulpi_fs_ls =3D -1,
> + =A0 =A0 =A0 .ts_dline =3D -1,
> + =A0 =A0 =A0 .en_multiple_tx_fifo =3D -1,
> + =A0 =A0 =A0 .dev_tx_fifo_size =3D {-1, -1, -1, -1, -1, -1, -1, -1, -1,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 -1, -1, -1, -1, -1, -1}, =A0 =A0 =A0 =A0/* =
15 */
> + =A0 =A0 =A0 .thr_ctl =3D -1,
> + =A0 =A0 =A0 .tx_thr_length =3D -1,
> + =A0 =A0 =A0 .rx_thr_length =3D -1,
> +};
> +
> +/**
> + * Checks that parameter settings for the periodic Tx FIFO sizes are cor=
rect
> + * according to the hardware configuration. Sets the size to the hardwar=
e
> + * configuration if an incorrect size is detected.
> + */
> +static int set_valid_perio_tx_fifo_sizes(struct core_if *core_if)
> +{
> + =A0 =A0 =A0 ulong regs =3D (u32) core_if->core_global_regs;
> + =A0 =A0 =A0 u32 *param_size =3D &dwc_otg_module_params.dev_perio_tx_fif=
o_size[0];
> + =A0 =A0 =A0 u32 i, size;
> +
> + =A0 =A0 =A0 for (i =3D 0; i < MAX_PERIO_FIFOS; i++, param_size++) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 size =3D dwc_reg_read(regs, DWC_DPTX_FSIZ_D=
IPTXF(i));
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *param_size =3D size;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 return 0;
> +}
> +
> +/**
> + * Checks that parameter settings for the Tx FIFO sizes are correct acco=
rding to
> + * the hardware configuration. =A0Sets the size to the hardware configur=
ation if
> + * an incorrect size is detected.
> + */
> +static int set_valid_tx_fifo_sizes(struct core_if *core_if)
> +{
> + =A0 =A0 =A0 ulong regs =3D (u32) core_if->core_global_regs;
> + =A0 =A0 =A0 u32 *param_size =3D &dwc_otg_module_params.dev_tx_fifo_size=
[0];
> + =A0 =A0 =A0 u32 i, size;
> +
> + =A0 =A0 =A0 for (i =3D 0; i < MAX_TX_FIFOS; i++, param_size) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 size =3D dwc_reg_read(regs, =A0DWC_DPTX_FSI=
Z_DIPTXF(i));
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *param_size =3D size;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 return 0;
> +}
> +
> +/**
> + * This function is called during module intialization to verify that
> + * the module parameters are in a valid state.
> + */
> +int __devinit check_parameters(struct core_if *core_if)
> +{
> + =A0 =A0 =A0 /* Default values */
> + =A0 =A0 =A0 dwc_otg_module_params.otg_cap =3D dwc_param_otg_cap_default=
;
> + =A0 =A0 =A0 dwc_otg_module_params.dma_enable =3D dwc_param_dma_enable_d=
efault;
> + =A0 =A0 =A0 dwc_otg_module_params.speed =3D dwc_param_speed_default;
> + =A0 =A0 =A0 dwc_otg_module_params.host_support_fs_ls_low_power =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_param_host_support_fs_ls_low_power_default;
> + =A0 =A0 =A0 dwc_otg_module_params.host_ls_low_power_phy_clk =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_param_host_ls_low_power_phy_clk_default;
> + =A0 =A0 =A0 dwc_otg_module_params.phy_type =3D dwc_param_phy_type_defau=
lt;
> + =A0 =A0 =A0 dwc_otg_module_params.phy_ulpi_ddr =3D dwc_param_phy_ulpi_d=
dr_default;
> + =A0 =A0 =A0 dwc_otg_module_params.phy_ulpi_ext_vbus =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_param_phy_ulpi_ext_vbus_default;
> + =A0 =A0 =A0 dwc_otg_module_params.i2c_enable =3D dwc_param_i2c_enable_d=
efault;
> + =A0 =A0 =A0 dwc_otg_module_params.ulpi_fs_ls =3D dwc_param_ulpi_fs_ls_d=
efault;
> + =A0 =A0 =A0 dwc_otg_module_params.ts_dline =3D dwc_param_ts_dline_defau=
lt;
> +
> + =A0 =A0 =A0 dwc_otg_module_params.dma_burst_size =3D dwc_param_dma_burs=
t_size_default;
> + =A0 =A0 =A0 dwc_otg_module_params.phy_utmi_width =3D dwc_param_phy_utmi=
_width_default;
> + =A0 =A0 =A0 dwc_otg_module_params.thr_ctl =3D dwc_param_thr_ctl_default=
;
> + =A0 =A0 =A0 dwc_otg_module_params.tx_thr_length =3D dwc_param_tx_thr_le=
ngth_default;
> + =A0 =A0 =A0 dwc_otg_module_params.rx_thr_length =3D dwc_param_rx_thr_le=
ngth_default;
> +
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* Hardware configurations of the OTG core.
> + =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 dwc_otg_module_params.enable_dynamic_fifo =3D
> + =A0 =A0 =A0 =A0 =A0 DWC_HWCFG2_DYN_FIFO_RD(core_if->hwcfg2);
> + =A0 =A0 =A0 dwc_otg_module_params.dev_rx_fifo_size =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_reg_read(core_if->core_global_regs, DWC_GRXFSIZ=
);
> + =A0 =A0 =A0 dwc_otg_module_params.dev_nperio_tx_fifo_size =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_reg_read(core_if->core_global_regs, DWC_GNPTXFS=
IZ) >> 16;
> +
> + =A0 =A0 =A0 dwc_otg_module_params.host_rx_fifo_size =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_reg_read(core_if->core_global_regs, DWC_GRXFSIZ=
);
> + =A0 =A0 =A0 dwc_otg_module_params.host_nperio_tx_fifo_size =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_reg_read(core_if->core_global_regs, DWC_GNPTXFS=
IZ) >> 16;
> + =A0 =A0 =A0 dwc_otg_module_params.host_perio_tx_fifo_size =3D
> + =A0 =A0 =A0 =A0 =A0 dwc_reg_read(core_if->core_global_regs, DWC_HPTXFSI=
Z) >> 16;
> + =A0 =A0 =A0 dwc_otg_module_params.max_transfer_size =3D
> + =A0 =A0 =A0 =A0 =A0 (1 << (DWC_HWCFG3_XFERSIZE_CTR_WIDTH_RD(core_if->hw=
cfg3) + 11))
> + =A0 =A0 =A0 =A0 =A0 - 1;
> + =A0 =A0 =A0 dwc_otg_module_params.max_packet_count =3D
> + =A0 =A0 =A0 =A0 =A0 (1 << (DWC_HWCFG3_PKTSIZE_CTR_WIDTH_RD(core_if->hwc=
fg3) + 4))
> + =A0 =A0 =A0 =A0 =A0 - 1;
> +
> + =A0 =A0 =A0 dwc_otg_module_params.host_channels =3D
> + =A0 =A0 =A0 =A0 =A0 DWC_HWCFG2_NO_HST_CHAN_RD(core_if->hwcfg2) + 1;
> + =A0 =A0 =A0 dwc_otg_module_params.dev_endpoints =3D
> + =A0 =A0 =A0 =A0 =A0 DWC_HWCFG2_NO_DEV_EP_RD(core_if->hwcfg2);
> + =A0 =A0 =A0 dwc_otg_module_params.en_multiple_tx_fifo =3D
> + =A0 =A0 =A0 =A0 =A0 (DWC_HWCFG4_DED_FIFO_ENA_RD(core_if->hwcfg4) =3D=3D=
0)
> + =A0 =A0 =A0 =A0 =A0 ? 0 : 1, 0;
> + =A0 =A0 =A0 set_valid_perio_tx_fifo_sizes(core_if);
> + =A0 =A0 =A0 set_valid_tx_fifo_sizes(core_if);
> +
> + =A0 =A0 =A0 return 0;
> +}
> +
> +module_param_named(dma_enable, dwc_otg_module_params.dma_enable, bool, 0=
444);
> +MODULE_PARM_DESC(dma_enable, "DMA Mode 0=3DSlave 1=3DDMA enabled");
> --
> 1.6.1.rc3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>
--=20
Best regards
Kassey
Intel Mobile Communication =A0Xi'an, China PRC
^ permalink raw reply
* Re: [PATCH 0/3] 8xx: Large page(8MB) support for 2.4
From: Joakim Tjernlund @ 2011-10-11 7:42 UTC (permalink / raw)
To: Dan Malek; +Cc: Scott Wood, linuxppc-dev, Willy Tarreau
In-Reply-To: <9CE82FAD-2451-4253-B304-CF8BE5AC8CAC@digitaldans.com>
Dan Malek <ppc6dev@digitaldans.com> wrote on 2011/10/10 20:03:53:
>
>
> On Oct 10, 2011, at 9:45 AM, Joakim Tjernlund wrote:
>
> > That is an easy port but I will have to do that blind. Would you
> > mind take this for a spin on 2.4 first?
>
> My current system is running 2.6, so I don't have much
> interested in testing 2.4
Too bad as I won't be able to run 2.6 at all.
However, I just sent you a dry port to 3.0 of the large page stuff to
you. Happy testing.
>
> > The more interesting part is if one should use other sized(16K or
> > 512K) large pages too?
>
> My thought long ago was most of the 8xx systems have rather small
> real memories, so the larger pages, especially 512K may be too wasteful.
> I've always been a fan of keeping the TLB handlers tiny and simple,
> rather then spending the instructions doing complex replacements.
> Remember, this also affects the I- and D-cache, so a more frequent
> and trivial PTE update could very well gain larger system performance
> than the management of larger pages with more complex code.
> With all of the bug fix code in the handlers, maybe a larger page would
> be better.
>
> > Those should be useful for user space but it is a lot of work. I
> > haven't checked
> > what large page support for user space is in 2.6 for ppc though.
>
> The 2.6/3.0 kernel supports different, but fixed, page sizes. IIRC,
> anything
> over 64K may require distribution rebuilding to realign code/data
> sections
> to more restrictive boundaries. Maybe a 16K page would show some
> benefit.
> I'll try to make some time to play with it.
Unfortunately 3.0 does not have any free PTE bits now. I had to move
_PAGE_SPECIAL to the last available one as the new _PAGE_PSE needed its place.
Don't know what _PAGE_SPECIAL is but if it cannot be removed one can always skip
_PAGE_WRITETHRU again.
Jocke
^ permalink raw reply
* [PATCH] powerpc: e500mc: Fix: use CONFIG_PPC_E500MC in idle_e500.S
From: Bharat Bhushan @ 2011-10-11 5:56 UTC (permalink / raw)
To: galak; +Cc: Bharat Bhushan, linuxppc-dev, bharatb.yadav
It is wrongly using undefined CONFIG_E500MC.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
arch/powerpc/kernel/idle_e500.S | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/kernel/idle_e500.S b/arch/powerpc/kernel/idle_e500.S
index 3e2b95c..4f0ab85 100644
--- a/arch/powerpc/kernel/idle_e500.S
+++ b/arch/powerpc/kernel/idle_e500.S
@@ -26,7 +26,7 @@ _GLOBAL(e500_idle)
ori r4,r4,_TLF_NAPPING /* so when we take an exception */
stw r4,TI_LOCAL_FLAGS(r3) /* it will return to our caller */
-#ifdef CONFIG_E500MC
+#ifdef CONFIG_PPC_E500MC
wrteei 1
1: wait
--
1.7.0.4
^ permalink raw reply related
* [PATCH 13/13] powerpc: Enable hugetlb by default for corenet64 platforms
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798902823-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/configs/corenet64_smp_defconfig | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index 782822c..53741f4 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -81,6 +81,7 @@ CONFIG_EXT3_FS=y
# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
CONFIG_PROC_KCORE=y
CONFIG_TMPFS=y
+CONFIG_HUGETLBFS=y
# CONFIG_MISC_FILESYSTEMS is not set
CONFIG_PARTITION_ADVANCED=y
CONFIG_MAC_PARTITION=y
--
1.5.6.5
^ permalink raw reply related
* [PATCH 12/13] powerpc: Update corenet64_smp_defconfig
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798892145-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
Updates from make savedefconfig.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/configs/corenet64_smp_defconfig | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index c92c204..782822c 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -11,10 +11,8 @@ CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_BLK_DEV_INITRD=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_EXPERT=y
CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_EXTRA_PASS=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
@@ -25,7 +23,6 @@ CONFIG_P5020_DS=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_BINFMT_MISC=m
-# CONFIG_PCI is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
@@ -93,10 +90,8 @@ CONFIG_CRC_T10DIF=y
CONFIG_CRC_ITU_T=m
CONFIG_FRAME_WARN=1024
CONFIG_DEBUG_FS=y
-CONFIG_DEBUG_KERNEL=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEBUG_INFO=y
-# CONFIG_RCU_CPU_STALL_DETECTOR is not set
CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_VIRQ_DEBUG=y
CONFIG_CRYPTO_PCBC=m
--
1.5.6.5
^ permalink raw reply related
* [PATCH 11/13] powerpc: Enable Hugetlb by default for 32-bit 85xx/corenet
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798883685-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/configs/corenet32_smp_defconfig | 1 +
arch/powerpc/configs/mpc85xx_defconfig | 1 +
arch/powerpc/configs/mpc85xx_smp_defconfig | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig
index ab4db40..1c328da 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -154,6 +154,7 @@ CONFIG_VFAT_FS=y
CONFIG_NTFS_FS=y
CONFIG_PROC_KCORE=y
CONFIG_TMPFS=y
+CONFIG_HUGETLBFS=y
CONFIG_JFFS2_FS=y
CONFIG_CRAMFS=y
CONFIG_NFS_FS=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index a1e5a17..542eaa1 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -182,6 +182,7 @@ CONFIG_VFAT_FS=y
CONFIG_NTFS_FS=y
CONFIG_PROC_KCORE=y
CONFIG_TMPFS=y
+CONFIG_HUGETLBFS=y
CONFIG_ADFS_FS=m
CONFIG_AFFS_FS=m
CONFIG_HFS_FS=m
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index dd1e413..c0a9574 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -183,6 +183,7 @@ CONFIG_VFAT_FS=y
CONFIG_NTFS_FS=y
CONFIG_PROC_KCORE=y
CONFIG_TMPFS=y
+CONFIG_HUGETLBFS=y
CONFIG_ADFS_FS=m
CONFIG_AFFS_FS=m
CONFIG_HFS_FS=m
--
1.5.6.5
^ permalink raw reply related
* [PATCH 10/13] powerpc: Update mpc85xx/corenet 32-bit defconfigs
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <1318279885811-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
Results from updates via make savedefconfig.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/configs/corenet32_smp_defconfig | 8 --------
arch/powerpc/configs/mpc85xx_defconfig | 5 +----
arch/powerpc/configs/mpc85xx_smp_defconfig | 6 +-----
3 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig
index 4311d02..ab4db40 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -12,9 +12,7 @@ CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_BLK_DEV_INITRD=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_EXTRA_PASS=y
CONFIG_EMBEDDED=y
CONFIG_PERF_EVENTS=y
CONFIG_SLAB=y
@@ -69,7 +67,6 @@ CONFIG_IPV6=y
CONFIG_IP_SCTP=m
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_MTD=y
-CONFIG_MTD_PARTITIONS=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
@@ -107,7 +104,6 @@ CONFIG_FSL_PQ_MDIO=y
# CONFIG_INPUT_MOUSE is not set
CONFIG_SERIO_LIBPS2=y
# CONFIG_LEGACY_PTYS is not set
-CONFIG_PPC_EPAPR_HV_BYTECHAN=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_EXTENDED=y
@@ -136,8 +132,6 @@ CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
CONFIG_USB_STORAGE=y
CONFIG_MMC=y
CONFIG_MMC_SDHCI=y
-CONFIG_MMC_SDHCI_OF=y
-CONFIG_MMC_SDHCI_OF_ESDHC=y
CONFIG_EDAC=y
CONFIG_EDAC_MM_EDAC=y
CONFIG_EDAC_MPC85XX=y
@@ -146,7 +140,6 @@ CONFIG_RTC_DRV_DS3232=y
CONFIG_RTC_DRV_CMOS=y
CONFIG_UIO=y
CONFIG_STAGING=y
-# CONFIG_STAGING_EXCLUDE_BUILD is not set
CONFIG_VIRT_DRIVERS=y
CONFIG_FSL_HV_MANAGER=y
CONFIG_EXT2_FS=y
@@ -173,7 +166,6 @@ CONFIG_MAC_PARTITION=y
CONFIG_NLS_ISO8859_1=y
CONFIG_NLS_UTF8=m
CONFIG_MAGIC_SYSRQ=y
-CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_SHIRQ=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEBUG_INFO=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index 2500912..a1e5a17 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -10,10 +10,8 @@ CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_BLK_DEV_INITRD=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_EXPERT=y
CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_EXTRA_PASS=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
@@ -41,7 +39,6 @@ CONFIG_TQM8560=y
CONFIG_SBC8548=y
CONFIG_QUICC_ENGINE=y
CONFIG_QE_GPIO=y
-CONFIG_GPIO_MPC8XXX=y
CONFIG_HIGHMEM=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
@@ -123,6 +120,7 @@ CONFIG_NVRAM=y
CONFIG_I2C=y
CONFIG_I2C_CPM=m
CONFIG_I2C_MPC=y
+CONFIG_GPIO_MPC8XXX=y
# CONFIG_HWMON is not set
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
@@ -206,7 +204,6 @@ CONFIG_PARTITION_ADVANCED=y
CONFIG_MAC_PARTITION=y
CONFIG_CRC_T10DIF=y
CONFIG_DEBUG_FS=y
-CONFIG_DEBUG_KERNEL=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEBUG_INFO=y
CONFIG_SYSCTL_SYSCALL_CHECK=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index a4ba13b..dd1e413 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -12,10 +12,8 @@ CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_BLK_DEV_INITRD=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_EXPERT=y
CONFIG_KALLSYMS_ALL=y
-CONFIG_KALLSYMS_EXTRA_PASS=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
@@ -42,7 +40,6 @@ CONFIG_TQM8560=y
CONFIG_SBC8548=y
CONFIG_QUICC_ENGINE=y
CONFIG_QE_GPIO=y
-CONFIG_GPIO_MPC8XXX=y
CONFIG_HIGHMEM=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
@@ -124,6 +121,7 @@ CONFIG_NVRAM=y
CONFIG_I2C=y
CONFIG_I2C_CPM=m
CONFIG_I2C_MPC=y
+CONFIG_GPIO_MPC8XXX=y
# CONFIG_HWMON is not set
CONFIG_VIDEO_OUTPUT_CONTROL=y
CONFIG_FB=y
@@ -207,10 +205,8 @@ CONFIG_PARTITION_ADVANCED=y
CONFIG_MAC_PARTITION=y
CONFIG_CRC_T10DIF=y
CONFIG_DEBUG_FS=y
-CONFIG_DEBUG_KERNEL=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEBUG_INFO=y
-# CONFIG_RCU_CPU_STALL_DETECTOR is not set
CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_VIRQ_DEBUG=y
CONFIG_CRYPTO_PCBC=m
--
1.5.6.5
^ permalink raw reply related
* [PATCH 09/13] powerpc: Kconfig updates for FSL BookE HUGETLB 64-bit
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <1318279883564-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
Allow hugetlb to be enabled on 64b FSL_BOOK3E. No platforms enable
it by default yet.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/platforms/Kconfig.cputype | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index a85990c..7e47fd4 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -174,7 +174,6 @@ config BOOKE
config FSL_BOOKE
bool
depends on (E200 || E500) && PPC32
- select SYS_SUPPORTS_HUGETLBFS if PHYS_64BIT
default y
# this is for common code between PPC32 & PPC64 FSL BOOKE
@@ -182,6 +181,7 @@ config PPC_FSL_BOOK3E
bool
select FSL_EMB_PERFMON
select PPC_SMP_MUXED_IPI
+ select SYS_SUPPORTS_HUGETLBFS if PHYS_64BIT || PPC64
default y if FSL_BOOKE
config PTE_64BIT
@@ -298,7 +298,7 @@ config PPC_BOOK3E_MMU
config PPC_MM_SLICES
bool
- default y if (PPC64 && HUGETLB_PAGE) || (PPC_STD_MMU_64 && PPC_64K_PAGES)
+ default y if (!PPC_FSL_BOOK3E && PPC64 && HUGETLB_PAGE) || (PPC_STD_MMU_64 && PPC_64K_PAGES)
default n
config VIRT_CPU_ACCOUNTING
--
1.5.6.5
^ permalink raw reply related
* [PATCH 08/13] powerpc: Add gpages reservation code for 64-bit FSL BOOKE
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798791090-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
For 64-bit FSL_BOOKE implementations, gigantic pages need to be
reserved at boot time by the memblock code based on the command line.
This adds the call that handles the reservation, and fixes some code
comments.
It also removes the previous pr_err when reserve_hugetlb_gpages
is called on a system without hugetlb enabled - the way the code is
structured, the call is unconditional and the resulting error message
spurious and confusing.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/include/asm/hugetlb.h | 19 ++++++++++++++-----
arch/powerpc/kernel/setup_64.c | 10 ++++++++++
arch/powerpc/mm/hugetlbpage.c | 8 ++++----
3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index 273acfa..555044c 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -5,7 +5,6 @@
#include <asm/page.h>
extern struct kmem_cache *hugepte_cache;
-extern void __init reserve_hugetlb_gpages(void);
static inline pte_t *hugepd_page(hugepd_t hpd)
{
@@ -153,14 +152,24 @@ static inline void arch_release_hugepage(struct page *page)
}
#else /* ! CONFIG_HUGETLB_PAGE */
-static inline void reserve_hugetlb_gpages(void)
-{
- pr_err("Cannot reserve gpages without hugetlb enabled\n");
-}
static inline void flush_hugetlb_page(struct vm_area_struct *vma,
unsigned long vmaddr)
{
}
+#endif /* CONFIG_HUGETLB_PAGE */
+
+
+/*
+ * FSL Book3E platforms require special gpage handling - the gpages
+ * are reserved early in the boot process by memblock instead of via
+ * the .dts as on IBM platforms.
+ */
+#if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_PPC_FSL_BOOK3E)
+extern void __init reserve_hugetlb_gpages(void);
+#else
+static inline void reserve_hugetlb_gpages(void)
+{
+}
#endif
#endif /* _ASM_POWERPC_HUGETLB_H */
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index d4168c9..2e334d4 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -35,6 +35,8 @@
#include <linux/pci.h>
#include <linux/lockdep.h>
#include <linux/memblock.h>
+#include <linux/hugetlb.h>
+
#include <asm/io.h>
#include <asm/kdump.h>
#include <asm/prom.h>
@@ -64,6 +66,7 @@
#include <asm/mmu_context.h>
#include <asm/code-patching.h>
#include <asm/kvm_ppc.h>
+#include <asm/hugetlb.h>
#include "setup.h"
@@ -217,6 +220,13 @@ void __init early_setup(unsigned long dt_ptr)
/* Initialize the hash table or TLB handling */
early_init_mmu();
+ /*
+ * Reserve any gigantic pages requested on the command line.
+ * memblock needs to have been initialized by the time this is
+ * called since this will reserve memory.
+ */
+ reserve_hugetlb_gpages();
+
DBG(" <- early_setup()\n");
}
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 9a34606..51855a0 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -28,10 +28,10 @@ unsigned int HPAGE_SHIFT;
/*
* Tracks gpages after the device tree is scanned and before the
- * huge_boot_pages list is ready. On 64-bit implementations, this is
- * just used to track 16G pages and so is a single array. 32-bit
- * implementations may have more than one gpage size due to limitations
- * of the memory allocators, so we need multiple arrays
+ * huge_boot_pages list is ready. On non-Freescale implementations, this is
+ * just used to track 16G pages and so is a single array. FSL-based
+ * implementations may have more than one gpage size, so we need multiple
+ * arrays
*/
#ifdef CONFIG_PPC_FSL_BOOK3E
#define MAX_NUMBER_GPAGES 128
--
1.5.6.5
^ permalink raw reply related
* [PATCH 07/13] powerpc: Add hugepage support to 64-bit tablewalk code for FSL_BOOK3E
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798761457-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
Before hugetlb, at each level of the table, we test for
!0 to determine if we have a valid table entry. With hugetlb, this
compare becomes:
< 0 is a normal entry
0 is an invalid entry
> 0 is huge
This works because the hugepage code pulls the top bit off the entry
(which for non-huge entries always has the top bit set) as an
indicator that we have a hugepage.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/mm/tlb_low_64e.S | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index 71d5d9a..ff672bd 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -136,22 +136,22 @@ ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV)
#ifndef CONFIG_PPC_64K_PAGES
rldicl r15,r16,64-PUD_SHIFT+3,64-PUD_INDEX_SIZE-3
clrrdi r15,r15,3
- cmlpdi cr0,r14,0
- beq tlb_miss_fault_bolted /* Bad pgd entry */
+ cmpdi cr0,r14,0
+ bge tlb_miss_fault_bolted /* Bad pgd entry or hugepage; bail */
ldx r14,r14,r15 /* grab pud entry */
#endif /* CONFIG_PPC_64K_PAGES */
rldicl r15,r16,64-PMD_SHIFT+3,64-PMD_INDEX_SIZE-3
clrrdi r15,r15,3
- cmpldi cr0,r14,0
- beq tlb_miss_fault_bolted
+ cmpdi cr0,r14,0
+ bge tlb_miss_fault_bolted
ldx r14,r14,r15 /* Grab pmd entry */
rldicl r15,r16,64-PAGE_SHIFT+3,64-PTE_INDEX_SIZE-3
clrrdi r15,r15,3
- cmpldi cr0,r14,0
- beq tlb_miss_fault_bolted
- ldx r14,r14,r15 /* Grab PTE */
+ cmpdi cr0,r14,0
+ bge tlb_miss_fault_bolted
+ ldx r14,r14,r15 /* Grab PTE, normal (!huge) page */
/* Check if required permissions are met */
andc. r15,r11,r14
--
1.5.6.5
^ permalink raw reply related
* [PATCH 06/13] powerpc: Whitespace/comment changes to tlb_low_64e.S
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798731357-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
I happened to comment this code while I was digging through it;
we might as well commit that. I also made some whitespace
changes - the existing code had a lot of unnecessary newlines
that I found annoying when I was working on my tiny laptop.
No functional changes.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/mm/tlb_low_64e.S | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index dc4a5f3..71d5d9a 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -94,11 +94,11 @@
srdi r15,r16,60 /* get region */
rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4
- bne- dtlb_miss_fault_bolted
+ bne- dtlb_miss_fault_bolted /* Bail if fault addr is invalid */
rlwinm r10,r11,32-19,27,27
rlwimi r10,r11,32-16,19,19
- cmpwi r15,0
+ cmpwi r15,0 /* user vs kernel check */
ori r10,r10,_PAGE_PRESENT
oris r11,r10,_PAGE_ACCESSED@h
@@ -120,44 +120,38 @@ tlb_miss_common_bolted:
rldicl r15,r16,64-PGDIR_SHIFT+3,64-PGD_INDEX_SIZE-3
cmpldi cr0,r14,0
clrrdi r15,r15,3
- beq tlb_miss_fault_bolted
+ beq tlb_miss_fault_bolted /* No PGDIR, bail */
BEGIN_MMU_FTR_SECTION
/* Set the TLB reservation and search for existing entry. Then load
* the entry.
*/
PPC_TLBSRX_DOT(0,r16)
- ldx r14,r14,r15
- beq normal_tlb_miss_done
+ ldx r14,r14,r15 /* grab pgd entry */
+ beq normal_tlb_miss_done /* tlb exists already, bail */
MMU_FTR_SECTION_ELSE
- ldx r14,r14,r15
+ ldx r14,r14,r15 /* grab pgd entry */
ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_USE_TLBRSRV)
#ifndef CONFIG_PPC_64K_PAGES
rldicl r15,r16,64-PUD_SHIFT+3,64-PUD_INDEX_SIZE-3
clrrdi r15,r15,3
-
- cmpldi cr0,r14,0
- beq tlb_miss_fault_bolted
-
- ldx r14,r14,r15
+ cmlpdi cr0,r14,0
+ beq tlb_miss_fault_bolted /* Bad pgd entry */
+ ldx r14,r14,r15 /* grab pud entry */
#endif /* CONFIG_PPC_64K_PAGES */
rldicl r15,r16,64-PMD_SHIFT+3,64-PMD_INDEX_SIZE-3
clrrdi r15,r15,3
-
cmpldi cr0,r14,0
beq tlb_miss_fault_bolted
-
- ldx r14,r14,r15
+ ldx r14,r14,r15 /* Grab pmd entry */
rldicl r15,r16,64-PAGE_SHIFT+3,64-PTE_INDEX_SIZE-3
clrrdi r15,r15,3
-
cmpldi cr0,r14,0
beq tlb_miss_fault_bolted
-
- ldx r14,r14,r15
+ ldx r14,r14,r15 /* Grab PTE */
/* Check if required permissions are met */
andc. r15,r11,r14
--
1.5.6.5
^ permalink raw reply related
* [PATCH 05/13] powerpc: hugetlb: modify include usage for FSL BookE code
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <1318279870278-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
The original 32-bit hugetlb implementation used PPC64 vs PPC32 to
determine which code path to take. However, the final hugetlb
implementation for 64-bit FSL ended up shared with the FSL
32-bit code so the actual check needs to be FSL_BOOK3E vs
everything else. This patch changes the include protections to
reflect this.
There are also a couple of related comment fixes.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/include/asm/hugetlb.h | 6 ++--
arch/powerpc/mm/hugetlbpage.c | 54 ++++++++++++++++-------------------
arch/powerpc/mm/tlb_nohash.c | 2 +-
3 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index 70f9885..273acfa 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -22,14 +22,14 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
unsigned pdshift)
{
/*
- * On 32-bit, we have multiple higher-level table entries that point to
- * the same hugepte. Just use the first one since they're all
+ * On FSL BookE, we have multiple higher-level table entries that
+ * point to the same hugepte. Just use the first one since they're all
* identical. So for that case, idx=0.
*/
unsigned long idx = 0;
pte_t *dir = hugepd_page(*hpdp);
-#ifdef CONFIG_PPC64
+#ifndef CONFIG_PPC_FSL_BOOK3E
idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(*hpdp);
#endif
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index b4a4884..9a34606 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -33,17 +33,17 @@ unsigned int HPAGE_SHIFT;
* implementations may have more than one gpage size due to limitations
* of the memory allocators, so we need multiple arrays
*/
-#ifdef CONFIG_PPC64
-#define MAX_NUMBER_GPAGES 1024
-static u64 gpage_freearray[MAX_NUMBER_GPAGES];
-static unsigned nr_gpages;
-#else
+#ifdef CONFIG_PPC_FSL_BOOK3E
#define MAX_NUMBER_GPAGES 128
struct psize_gpages {
u64 gpage_list[MAX_NUMBER_GPAGES];
unsigned int nr_gpages;
};
static struct psize_gpages gpage_freearray[MMU_PAGE_COUNT];
+#else
+#define MAX_NUMBER_GPAGES 1024
+static u64 gpage_freearray[MAX_NUMBER_GPAGES];
+static unsigned nr_gpages;
#endif
static inline int shift_to_mmu_psize(unsigned int shift)
@@ -114,12 +114,12 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
struct kmem_cache *cachep;
pte_t *new;
-#ifdef CONFIG_PPC64
- cachep = PGT_CACHE(pdshift - pshift);
-#else
+#ifdef CONFIG_PPC_FSL_BOOK3E
int i;
int num_hugepd = 1 << (pshift - pdshift);
cachep = hugepte_cache;
+#else
+ cachep = PGT_CACHE(pdshift - pshift);
#endif
new = kmem_cache_zalloc(cachep, GFP_KERNEL|__GFP_REPEAT);
@@ -131,12 +131,7 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
return -ENOMEM;
spin_lock(&mm->page_table_lock);
-#ifdef CONFIG_PPC64
- if (!hugepd_none(*hpdp))
- kmem_cache_free(cachep, new);
- else
- hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift;
-#else
+#ifdef CONFIG_PPC_FSL_BOOK3E
/*
* We have multiple higher-level entries that point to the same
* actual pte location. Fill in each as we go and backtrack on error.
@@ -215,7 +210,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
return hugepte_offset(hpdp, addr, pdshift);
}
-#ifdef CONFIG_PPC32
+#ifdef CONFIG_PPC_FSL_BOOK3E
/* Build list of addresses of gigantic pages. This function is used in early
* boot before the buddy or bootmem allocator is setup.
*/
@@ -335,7 +330,7 @@ void __init reserve_hugetlb_gpages(void)
}
}
-#else /* PPC64 */
+#else /* !PPC_FSL_BOOK3E */
/* Build list of addresses of gigantic pages. This function is used in early
* boot before the buddy or bootmem allocator is setup.
@@ -373,7 +368,7 @@ int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
return 0;
}
-#ifdef CONFIG_PPC32
+#ifdef CONFIG_PPC_FSL_BOOK3E
#define HUGEPD_FREELIST_SIZE \
((PAGE_SIZE - sizeof(struct hugepd_freelist)) / sizeof(pte_t))
@@ -433,11 +428,11 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif
unsigned long pdmask = ~((1UL << pdshift) - 1);
unsigned int num_hugepd = 1;
-#ifdef CONFIG_PPC64
- unsigned int shift = hugepd_shift(*hpdp);
-#else
- /* Note: On 32-bit the hpdp may be the first of several */
+#ifdef CONFIG_PPC_FSL_BOOK3E
+ /* Note: On fsl the hpdp may be the first of several */
num_hugepd = (1 << (hugepd_shift(*hpdp) - pdshift));
+#else
+ unsigned int shift = hugepd_shift(*hpdp);
#endif
start &= pdmask;
@@ -455,10 +450,11 @@ static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshif
hpdp->pd = 0;
tlb->need_flush = 1;
-#ifdef CONFIG_PPC64
- pgtable_free_tlb(tlb, hugepte, pdshift - shift);
-#else
+
+#ifdef CONFIG_PPC_FSL_BOOK3E
hugepd_free(tlb, hugepte);
+#else
+ pgtable_free_tlb(tlb, hugepte, pdshift - shift);
#endif
}
@@ -590,12 +586,12 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb,
continue;
hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling);
} else {
-#ifdef CONFIG_PPC32
+#ifdef CONFIG_PPC_FSL_BOOK3E
/*
* Increment next by the size of the huge mapping since
- * on 32-bit there may be more than one entry at the pgd
- * level for a single hugepage, but all of them point to
- * the same kmem cache that holds the hugepte.
+ * there may be more than one entry at the pgd level
+ * for a single hugepage, but all of them point to the
+ * same kmem cache that holds the hugepte.
*/
next = addr + (1 << hugepd_shift(*(hugepd_t *)pgd));
#endif
@@ -806,7 +802,7 @@ static int __init hugepage_setup_sz(char *str)
}
__setup("hugepagesz=", hugepage_setup_sz);
-#ifdef CONFIG_FSL_BOOKE
+#ifdef CONFIG_PPC_FSL_BOOK3E
struct kmem_cache *hugepte_cache;
static int __init hugetlbpage_init(void)
{
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index afc95c7..c02901f 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -51,7 +51,7 @@
* indirect page table entries.
*/
#ifdef CONFIG_PPC_BOOK3E_MMU
-#ifdef CONFIG_FSL_BOOKE
+#ifdef CONFIG_PPC_FSL_BOOK3E
struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT] = {
[MMU_PAGE_4K] = {
.shift = 12,
--
1.5.6.5
^ permalink raw reply related
* [PATCH 04/13] powerpc: Update hugetlb huge_pte_alloc and tablewalk code for FSL BOOKE
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798681100-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
This updates the hugetlb page table code to handle 64-bit FSL_BOOKE.
The previous 32-bit work counted on the inner levels of the page table
collapsing.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/mm/hugetlbpage.c | 48 +++++++++++++++++++++++++++++++++++-----
1 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 71c6533..b4a4884 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -155,11 +155,28 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
hpdp->pd = 0;
kmem_cache_free(cachep, new);
}
+#else
+ if (!hugepd_none(*hpdp))
+ kmem_cache_free(cachep, new);
+ else
+ hpdp->pd = ((unsigned long)new & ~PD_HUGE) | pshift;
#endif
spin_unlock(&mm->page_table_lock);
return 0;
}
+/*
+ * These macros define how to determine which level of the page table holds
+ * the hpdp.
+ */
+#ifdef CONFIG_PPC_FSL_BOOK3E
+#define HUGEPD_PGD_SHIFT PGDIR_SHIFT
+#define HUGEPD_PUD_SHIFT PUD_SHIFT
+#else
+#define HUGEPD_PGD_SHIFT PUD_SHIFT
+#define HUGEPD_PUD_SHIFT PMD_SHIFT
+#endif
+
pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz)
{
pgd_t *pg;
@@ -172,12 +189,13 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz
addr &= ~(sz-1);
pg = pgd_offset(mm, addr);
- if (pshift >= PUD_SHIFT) {
+
+ if (pshift >= HUGEPD_PGD_SHIFT) {
hpdp = (hugepd_t *)pg;
} else {
pdshift = PUD_SHIFT;
pu = pud_alloc(mm, pg, addr);
- if (pshift >= PMD_SHIFT) {
+ if (pshift >= HUGEPD_PUD_SHIFT) {
hpdp = (hugepd_t *)pu;
} else {
pdshift = PMD_SHIFT;
@@ -453,14 +471,23 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
unsigned long start;
start = addr;
- pmd = pmd_offset(pud, addr);
do {
+ pmd = pmd_offset(pud, addr);
next = pmd_addr_end(addr, end);
if (pmd_none(*pmd))
continue;
+#ifdef CONFIG_PPC_FSL_BOOK3E
+ /*
+ * Increment next by the size of the huge mapping since
+ * there may be more than one entry at this level for a
+ * single hugepage, but all of them point to
+ * the same kmem cache that holds the hugepte.
+ */
+ next = addr + (1 << hugepd_shift(*(hugepd_t *)pmd));
+#endif
free_hugepd_range(tlb, (hugepd_t *)pmd, PMD_SHIFT,
addr, next, floor, ceiling);
- } while (pmd++, addr = next, addr != end);
+ } while (addr = next, addr != end);
start &= PUD_MASK;
if (start < floor)
@@ -487,8 +514,8 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
unsigned long start;
start = addr;
- pud = pud_offset(pgd, addr);
do {
+ pud = pud_offset(pgd, addr);
next = pud_addr_end(addr, end);
if (!is_hugepd(pud)) {
if (pud_none_or_clear_bad(pud))
@@ -496,10 +523,19 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
hugetlb_free_pmd_range(tlb, pud, addr, next, floor,
ceiling);
} else {
+#ifdef CONFIG_PPC_FSL_BOOK3E
+ /*
+ * Increment next by the size of the huge mapping since
+ * there may be more than one entry at this level for a
+ * single hugepage, but all of them point to
+ * the same kmem cache that holds the hugepte.
+ */
+ next = addr + (1 << hugepd_shift(*(hugepd_t *)pud));
+#endif
free_hugepd_range(tlb, (hugepd_t *)pud, PUD_SHIFT,
addr, next, floor, ceiling);
}
- } while (pud++, addr = next, addr != end);
+ } while (addr = next, addr != end);
start &= PGDIR_MASK;
if (start < floor)
--
1.5.6.5
^ permalink raw reply related
* [PATCH 03/13] powerpc: Fix booke hugetlb preload code for PPC_MM_SLICES and 64-bit
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798643553-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
This patch does 2 things: It corrects the code that determines the
size to write into MAS1 for the PPC_MM_SLICES case (this originally
came from David Gibson and I had incorrectly altered it), and it
changes the methodolody used to calculate the size for !PPC_MM_SLICES
to work for 64-bit as well as 32-bit.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
arch/powerpc/mm/hugetlbpage-book3e.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/mm/hugetlbpage-book3e.c b/arch/powerpc/mm/hugetlbpage-book3e.c
index 343ad0b..4d6d849 100644
--- a/arch/powerpc/mm/hugetlbpage-book3e.c
+++ b/arch/powerpc/mm/hugetlbpage-book3e.c
@@ -45,23 +45,20 @@ void book3e_hugetlb_preload(struct mm_struct *mm, unsigned long ea, pte_t pte)
unsigned long flags;
#ifdef CONFIG_PPC_FSL_BOOK3E
- int index, lz, ncams;
- struct vm_area_struct *vma;
+ int index, ncams;
#endif
if (unlikely(is_kernel_addr(ea)))
return;
#ifdef CONFIG_PPC_MM_SLICES
- psize = mmu_get_tsize(get_slice_psize(mm, ea));
- tsize = mmu_get_psize(psize);
+ psize = get_slice_psize(mm, ea);
+ tsize = mmu_get_tsize(psize);
shift = mmu_psize_defs[psize].shift;
#else
- vma = find_vma(mm, ea);
- psize = vma_mmu_pagesize(vma); /* returns actual size in bytes */
- asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (psize));
- shift = 31 - lz;
- tsize = 21 - lz;
+ psize = vma_mmu_pagesize(find_vma(mm, ea));
+ shift = __ilog2(psize);
+ tsize = shift - 10;
#endif
/*
--
1.5.6.5
^ permalink raw reply related
* [PATCH 02/13] powerpc: hugetlb: fix huge_ptep_set_access_flags return value
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <13182798624083-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
There was an unconditional return of "1" in the original code
from David Gibson, and I dropped it because it wasn't needed
for FSL BOOKE 32-bit. However, not all systems (including 64-bit
FSL BOOKE) do loading of the hpte from the fault handler asm
and depend on this function returning 1, which causes a call
to update_mmu_cache() that writes an entry into the tlb.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
arch/powerpc/include/asm/hugetlb.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index 8600493..70f9885 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -124,7 +124,18 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep,
pte_t pte, int dirty)
{
+#if defined(CONFIG_PPC_MMU_NOHASH) && \
+ !(defined(CONFIG_PPC_FSL_BOOK3E) && defined(CONFIG_PPC32))
+ /*
+ * The "return 1" forces a call of update_mmu_cache, which will write a
+ * TLB entry. Without this, platforms that don't do a write of the TLB
+ * entry in the TLB miss handler asm will fault ad infinitum.
+ */
+ ptep_set_access_flags(vma, addr, ptep, pte, dirty);
+ return 1;
+#else
return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
+#endif
}
static inline pte_t huge_ptep_get(pte_t *ptep)
--
1.5.6.5
^ permalink raw reply related
* [PATCH 01/13] powerpc: Only define HAVE_ARCH_HUGETLB_UNMAPPED_AREA if PPC_MM_SLICES
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
In-Reply-To: <1318279848494-git-send-email-beckyb@kernel.crashing.org>
From: Becky Bruce <beckyb@kernel.crashing.org>
If we don't have slices, we should be able to use the generic
hugetlb_get_unmapped_area() code
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
---
arch/powerpc/include/asm/page_64.h | 2 ++
arch/powerpc/mm/hugetlbpage.c | 6 ++----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h
index fb40ede..fed85e6 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
@@ -130,7 +130,9 @@ do { \
#ifdef CONFIG_HUGETLB_PAGE
+#ifdef CONFIG_PPC_MM_SLICES
#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
+#endif
#endif /* !CONFIG_HUGETLB_PAGE */
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 48b65be..71c6533 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -686,19 +686,17 @@ int gup_hugepd(hugepd_t *hugepd, unsigned pdshift,
return 1;
}
+#ifdef CONFIG_PPC_MM_SLICES
unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
unsigned long len, unsigned long pgoff,
unsigned long flags)
{
-#ifdef CONFIG_PPC_MM_SLICES
struct hstate *hstate = hstate_file(file);
int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate));
return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1, 0);
-#else
- return get_unmapped_area(file, addr, len, pgoff, flags);
-#endif
}
+#endif
unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
{
--
1.5.6.5
^ permalink raw reply related
* [PATCH 0/13] Hugetlb for 64-bit Freescale Book3E
From: Becky Bruce @ 2011-10-10 20:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: david
This series of patches contains mostly cleanup code that allows
the enablement of hugetlb for 64-bit Freescale BookE processors.
There are also some bits that I dropped from the 32-bit release
that are added back, as they are needed by other implementations.
Otherwise, it's mostly a bunch of code rearrangement, changes
in #include protections, and Kconfig changes.
Cheers,
Becky
arch/powerpc/configs/corenet32_smp_defconfig | 9 +--
arch/powerpc/configs/corenet64_smp_defconfig | 6 +-
arch/powerpc/configs/mpc85xx_defconfig | 6 +-
arch/powerpc/configs/mpc85xx_smp_defconfig | 7 +-
arch/powerpc/include/asm/hugetlb.h | 36 ++++++--
arch/powerpc/include/asm/page_64.h | 2 +
arch/powerpc/kernel/setup_64.c | 10 ++
arch/powerpc/mm/hugetlbpage-book3e.c | 15 ++--
arch/powerpc/mm/hugetlbpage.c | 116 ++++++++++++++++----------
arch/powerpc/mm/tlb_low_64e.S | 36 ++++-----
arch/powerpc/mm/tlb_nohash.c | 2 +-
arch/powerpc/platforms/Kconfig.cputype | 4 +-
12 files changed, 143 insertions(+), 106 deletions(-)
^ permalink raw reply
* Re: [PATCH] mlx4_en: fix endianness with blue frame support
From: David Miller @ 2011-10-10 18:10 UTC (permalink / raw)
To: cascardo; +Cc: netdev, linuxppc-dev, eli, yevgenyp
In-Reply-To: <20111010164654.GA3648@oc1711230544.ibm.com>
From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Date: Mon, 10 Oct 2011 13:46:54 -0300
> On Mon, Oct 10, 2011 at 01:42:23PM -0300, Thadeu Lima de Souza Cascardo wrote:
>> The doorbell register was being unconditionally swapped. In x86, that
>> meant it was being swapped to BE and written to the descriptor and to
>> memory, depending on the case of blue frame support or writing to
>> doorbell register. On PPC, this meant it was being swapped to LE and
>> then swapped back to BE while writing to the register. But in the blue
>> frame case, it was being written as LE to the descriptor.
>>
>> The fix is not to swap doorbell unconditionally, write it to the
>> register as BE and convert it to BE when writing it to the descriptor.
>>
>> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
>> Reported-by: Richard Hendrickson <richhend@us.ibm.com>
>> Cc: Eli Cohen <eli@dev.mellanox.co.il>
>> Cc: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> ---
>
> So I tested this patch and it works for me. Thanks Ben and Eli for
> finding out the problem with doorbell in the descriptor.
Applied, thanks everyone.
^ permalink raw reply
* Re: [PATCH 0/3] 8xx: Large page(8MB) support for 2.4
From: Dan Malek @ 2011-10-10 18:03 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: Scott Wood, linuxppc-dev, Willy Tarreau
In-Reply-To: <OFAF68F93F.57D058F1-ONC1257925.005B7C6F-C1257925.005C10D7@transmode.se>
On Oct 10, 2011, at 9:45 AM, Joakim Tjernlund wrote:
> That is an easy port but I will have to do that blind. Would you
> mind take this for a spin on 2.4 first?
My current system is running 2.6, so I don't have much
interested in testing 2.4
> The more interesting part is if one should use other sized(16K or
> 512K) large pages too?
My thought long ago was most of the 8xx systems have rather small
real memories, so the larger pages, especially 512K may be too wasteful.
I've always been a fan of keeping the TLB handlers tiny and simple,
rather then spending the instructions doing complex replacements.
Remember, this also affects the I- and D-cache, so a more frequent
and trivial PTE update could very well gain larger system performance
than the management of larger pages with more complex code.
With all of the bug fix code in the handlers, maybe a larger page would
be better.
> Those should be useful for user space but it is a lot of work. I
> haven't checked
> what large page support for user space is in 2.6 for ppc though.
The 2.6/3.0 kernel supports different, but fixed, page sizes. IIRC,
anything
over 64K may require distribution rebuilding to realign code/data
sections
to more restrictive boundaries. Maybe a 16K page would show some
benefit.
I'll try to make some time to play with it.
Thanks.
-- Dan
^ permalink raw reply
* Re: [PATCH 2/3] [44x] Enable CONFIG_RELOCATABLE for PPC44x
From: Scott Wood @ 2011-10-10 18:00 UTC (permalink / raw)
To: Suzuki K. Poulose
Cc: Michal Simek, tmarri, Mahesh Jagannath Salgaonkar, Dave Hansen,
David Laight, Paul Mackerras, linux ppc dev, Vivek Goyal
In-Reply-To: <20111010095514.16589.85241.stgit@suzukikp.in.ibm.com>
On 10/10/2011 04:56 AM, Suzuki K. Poulose wrote:
> #if defined(CONFIG_RELOCATABLE) && defined(CONFIG_44x)
> #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) - PHYSICAL_START + (KERNELBASE + RELOC_OFFSET)))
> #define __pa(x) ((unsigned long)(x) + PHYSICAL_START - (KERNELBASE + RELOC_OFFSET))
> #endif
Why is this 44x-specific?
-Scott
^ permalink raw reply
* Re: [PATCH 1/3] [powerpc32] Process dynamic relocations for kernel
From: Scott Wood @ 2011-10-10 17:55 UTC (permalink / raw)
To: Suzuki Poulose
Cc: Michal Simek, tmarri, Mahesh Jagannath Salgaonkar, Dave Hansen,
David Laight, Paul Mackerras, Alan Modra, linux ppc dev,
Vivek Goyal
In-Reply-To: <4E932897.2060907@in.ibm.com>
On 10/10/2011 12:17 PM, Suzuki Poulose wrote:
> On 10/10/11 20:45, Scott Wood wrote:
>> On 10/10/2011 04:55 AM, Suzuki K. Poulose wrote:
>>> The following patch implements the dynamic relocation processing for
>>> PPC32 kernel. relocate() accepts the target virtual address and
>>> relocates
>>> the kernel image to the same.
>>
>> How much overhead is involved in a true relocatable kernel? Is it worth
>> preserving the old "relocatable" booke behavior under a different name?
>
> There are '75782' on an ebony kernel with minimal config. So thats a
> pretty big
> number for small embedded chips. I guess, preserving the 'old
> relocatable' (page
> aligned approach) would be a good idea for the architectures which can
> afford it.
> e.g, places where TLB size is 64M or less.
The systems we've been using this option on aren't *that* small -- I was
thinking more about runtime overhead (beyond the time taken at boot to
process relocations).
-Scott
^ permalink raw reply
* Re: [PATCH 1/3] [powerpc32] Process dynamic relocations for kernel
From: Suzuki Poulose @ 2011-10-10 17:17 UTC (permalink / raw)
To: Scott Wood
Cc: Michal Simek, tmarri, Mahesh Jagannath Salgaonkar, Dave Hansen,
David Laight, Paul Mackerras, Alan Modra, linux ppc dev,
Vivek Goyal
In-Reply-To: <4E930BFA.5030701@freescale.com>
On 10/10/11 20:45, Scott Wood wrote:
> On 10/10/2011 04:55 AM, Suzuki K. Poulose wrote:
>> The following patch implements the dynamic relocation processing for
>> PPC32 kernel. relocate() accepts the target virtual address and relocates
>> the kernel image to the same.
>
> How much overhead is involved in a true relocatable kernel? Is it worth
> preserving the old "relocatable" booke behavior under a different name?
There are '75782' on an ebony kernel with minimal config. So thats a pretty big
number for small embedded chips. I guess, preserving the 'old relocatable' (page
aligned approach) would be a good idea for the architectures which can afford it.
e.g, places where TLB size is 64M or less.
Thanks
Suzuki
^ permalink raw reply
* Re: [PATCH 0/3] 8xx: Large page(8MB) support for 2.4
From: Joakim Tjernlund @ 2011-10-10 16:45 UTC (permalink / raw)
To: Dan Malek; +Cc: Scott Wood, linuxppc-dev, Willy Tarreau
In-Reply-To: <39B024CE-70A2-4D32-A29C-5702C7D2D6CF@digitaldans.com>
Dan Malek <ppc6dev@digitaldans.com> wrote on 2011/10/10 18:22:09:
>
>
> Hi Joakim.
>
> On Oct 10, 2011, at 4:38 AM, Joakim Tjernlund wrote:
>
> > This adds Large page support for 8xx and uses it
> > for all kernel RAM....
>
> > - Dan, what do you think :)
>
> Since you asked, yes it looks great :-) Now, can we
> get this into a more contemporary kernel? I'm
> actually working on an 8xx project that may have
> a few years of life left.
That is an easy port but I will have to do that blind. Would you
mind take this for a spin on 2.4 first?
The more interesting part is if one should use other sized(16K or 512K) large pages too?
Those should be useful for user space but it is a lot of work. I haven't checked
what large page support for user space is in 2.6 for ppc though.
Jocke
^ permalink raw reply
* Re: [PATCH] mlx4_en: fix endianness with blue frame support
From: Thadeu Lima de Souza Cascardo @ 2011-10-10 16:46 UTC (permalink / raw)
To: netdev; +Cc: Eli Cohen, linuxppc-dev, Yevgeny Petrilin
In-Reply-To: <1318264943-10009-1-git-send-email-cascardo@linux.vnet.ibm.com>
On Mon, Oct 10, 2011 at 01:42:23PM -0300, Thadeu Lima de Souza Cascardo wrote:
> The doorbell register was being unconditionally swapped. In x86, that
> meant it was being swapped to BE and written to the descriptor and to
> memory, depending on the case of blue frame support or writing to
> doorbell register. On PPC, this meant it was being swapped to LE and
> then swapped back to BE while writing to the register. But in the blue
> frame case, it was being written as LE to the descriptor.
>
> The fix is not to swap doorbell unconditionally, write it to the
> register as BE and convert it to BE when writing it to the descriptor.
>
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
> Reported-by: Richard Hendrickson <richhend@us.ibm.com>
> Cc: Eli Cohen <eli@dev.mellanox.co.il>
> Cc: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
So I tested this patch and it works for me. Thanks Ben and Eli for
finding out the problem with doorbell in the descriptor.
Regards,
Cascardo.
> drivers/net/mlx4/en_tx.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
> index 6e03de0..f76ab6b 100644
> --- a/drivers/net/mlx4/en_tx.c
> +++ b/drivers/net/mlx4/en_tx.c
> @@ -172,7 +172,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv,
> memset(ring->buf, 0, ring->buf_size);
>
> ring->qp_state = MLX4_QP_STATE_RST;
> - ring->doorbell_qpn = swab32(ring->qp.qpn << 8);
> + ring->doorbell_qpn = ring->qp.qpn << 8;
>
> mlx4_en_fill_qp_context(priv, ring->size, ring->stride, 1, 0, ring->qpn,
> ring->cqn, &ring->context);
> @@ -791,7 +791,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
> skb_orphan(skb);
>
> if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tag) {
> - *(u32 *) (&tx_desc->ctrl.vlan_tag) |= ring->doorbell_qpn;
> + *(__be32 *) (&tx_desc->ctrl.vlan_tag) |= cpu_to_be32(ring->doorbell_qpn);
> op_own |= htonl((bf_index & 0xffff) << 8);
> /* Ensure new descirptor hits memory
> * before setting ownership of this descriptor to HW */
> @@ -812,7 +812,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
> wmb();
> tx_desc->ctrl.owner_opcode = op_own;
> wmb();
> - writel(ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL);
> + iowrite32be(ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL);
> }
>
> /* Poll CQ here */
> --
> 1.7.4.4
>
^ permalink raw reply
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