All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Berger <robert.karl.berger@gmail.com>
To: linuxppc-dev@ozlabs.org
Cc: mla@apm.com, Robert Berger <robert.karl.berger@gmail.com>, wd@denx.de
Subject: Re: ELDK 4.2/kilauea/3.5+ kernel broken
Date: Thu, 18 Oct 2012 20:45:04 +0300	[thread overview]
Message-ID: <50804020.30505@gmail.com> (raw)
In-Reply-To: <50802F4C.3000309__36526.1883860969$1350578085$gmane$org@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

FYI:

When I replace arch/powerpc/sysdev/ppc4xx_msi.c from a 3.6 kernel with a
ppc4xx_msi.c from 47da421981571c69ef29740cc55fa7248682e167 it boots from
nfs with a defconfig, so this seems to be the guilty one.

Please find attached the difference between the good and bad
ppc4xx_msi.c files.

I'll be happy to test your patches;)

Regards,

Robert

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 4209 bytes --]

diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/sysdev/ppc4xx_msi.c
index 82c6702..1c2d7af 100644
--- a/arch/powerpc/sysdev/ppc4xx_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_msi.c
@@ -28,11 +28,10 @@
 #include <linux/of_platform.h>
 #include <linux/interrupt.h>
 #include <linux/export.h>
-#include <linux/kernel.h>
 #include <asm/prom.h>
 #include <asm/hw_irq.h>
 #include <asm/ppc-pci.h>
-#include <asm/dcr.h>
+#include <boot/dcr.h>
 #include <asm/dcr-regs.h>
 #include <asm/msi_bitmap.h>
 
@@ -44,14 +43,13 @@
 #define PEIH_FLUSH0	0x30
 #define PEIH_FLUSH1	0x38
 #define PEIH_CNTRST	0x48
-
-static int msi_irqs;
+#define NR_MSI_IRQS	4
 
 struct ppc4xx_msi {
 	u32 msi_addr_lo;
 	u32 msi_addr_hi;
 	void __iomem *msi_regs;
-	int *msi_virqs;
+	int msi_virqs[NR_MSI_IRQS];
 	struct msi_bitmap bitmap;
 	struct device_node *msi_dev;
 };
@@ -63,7 +61,7 @@ static int ppc4xx_msi_init_allocator(struct platform_device *dev,
 {
 	int err;
 
-	err = msi_bitmap_alloc(&msi_data->bitmap, msi_irqs,
+	err = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS,
 			      dev->dev.of_node);
 	if (err)
 		return err;
@@ -85,11 +83,6 @@ static int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 	struct msi_desc *entry;
 	struct ppc4xx_msi *msi_data = &ppc4xx_msi;
 
-	msi_data->msi_virqs = kmalloc((msi_irqs) * sizeof(int),
-					    GFP_KERNEL);
-	if (!msi_data->msi_virqs)
-		return -ENOMEM;
-
 	list_for_each_entry(entry, &dev->msi_list, list) {
 		int_no = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
 		if (int_no >= 0)
@@ -157,11 +150,12 @@ static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
 	if (!sdr_addr)
 		return -1;
 
-	mtdcri(SDR0, *sdr_addr, upper_32_bits(res.start));	/*HIGH addr */
-	mtdcri(SDR0, *sdr_addr + 1, lower_32_bits(res.start));	/* Low addr */
+	SDR0_WRITE(sdr_addr, (u64)res.start >> 32);	 /*HIGH addr */
+	SDR0_WRITE(sdr_addr + 1, res.start & 0xFFFFFFFF); /* Low addr */
+
 
 	msi->msi_dev = of_find_node_by_name(NULL, "ppc4xx-msi");
-	if (!msi->msi_dev)
+	if (msi->msi_dev)
 		return -ENODEV;
 
 	msi->msi_regs = of_iomap(msi->msi_dev, 0);
@@ -173,12 +167,9 @@ static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
 		(u32) (msi->msi_regs + PEIH_TERMADH), (u32) (msi->msi_regs));
 
 	msi_virt = dma_alloc_coherent(&dev->dev, 64, &msi_phys, GFP_KERNEL);
-	if (!msi_virt)
-		return -ENOMEM;
-	msi->msi_addr_hi = upper_32_bits(msi_phys);
-	msi->msi_addr_lo = lower_32_bits(msi_phys & 0xffffffff);
-	dev_dbg(&dev->dev, "PCIE-MSI: msi address high 0x%x, low 0x%x\n",
-		msi->msi_addr_hi, msi->msi_addr_lo);
+	msi->msi_addr_hi = 0x0;
+	msi->msi_addr_lo = (u32) msi_phys;
+	dev_dbg(&dev->dev, "PCIE-MSI: msi address 0x%x\n", msi->msi_addr_lo);
 
 	/* Progam the Interrupt handler Termination addr registers */
 	out_be32(msi->msi_regs + PEIH_TERMADH, msi->msi_addr_hi);
@@ -194,8 +185,6 @@ static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
 	out_be32(msi->msi_regs + PEIH_MSIED, *msi_data);
 	out_be32(msi->msi_regs + PEIH_MSIMK, *msi_mask);
 
-	dma_free_coherent(&dev->dev, 64, msi_virt, msi_phys);
-
 	return 0;
 }
 
@@ -205,7 +194,7 @@ static int ppc4xx_of_msi_remove(struct platform_device *dev)
 	int i;
 	int virq;
 
-	for (i = 0; i < msi_irqs; i++) {
+	for (i = 0; i < NR_MSI_IRQS; i++) {
 		virq = msi->msi_virqs[i];
 		if (virq != NO_IRQ)
 			irq_dispose_mapping(virq);
@@ -226,6 +215,8 @@ static int __devinit ppc4xx_msi_probe(struct platform_device *dev)
 	struct resource res;
 	int err = 0;
 
+	msi = &ppc4xx_msi;/*keep the msi data for further use*/
+
 	dev_dbg(&dev->dev, "PCIE-MSI: Setting up MSI support...\n");
 
 	msi = kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL);
@@ -243,10 +234,6 @@ static int __devinit ppc4xx_msi_probe(struct platform_device *dev)
 		goto error_out;
 	}
 
-	msi_irqs = of_irq_count(dev->dev.of_node);
-	if (!msi_irqs)
-		return -ENODEV;
-
 	if (ppc4xx_setup_pcieh_hw(dev, res, msi))
 		goto error_out;
 
@@ -255,7 +242,6 @@ static int __devinit ppc4xx_msi_probe(struct platform_device *dev)
 		dev_err(&dev->dev, "Error allocating MSI bitmap\n");
 		goto error_out;
 	}
-	ppc4xx_msi = *msi;
 
 	ppc_md.setup_msi_irqs = ppc4xx_setup_msi_irqs;
 	ppc_md.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;

  parent reply	other threads:[~2012-10-18 17:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <507EF5AD.5070203__24977.4320669987$1350497770$gmane$org@gmail.com>
2012-10-18 16:27 ` ELDK 4.2/kilauea/3.5+ kernel broken Robert Berger
2012-10-18 16:33 ` Robert Berger
     [not found] ` <50802F4C.3000309__36526.1883860969$1350578085$gmane$org@gmail.com>
2012-10-18 17:45   ` Robert Berger [this message]
2012-10-18 19:03     ` Benjamin Herrenschmidt
2012-10-18 20:05       ` Robert Berger
2012-10-19  3:16         ` Mai La
2012-10-19  6:35           ` Robert Berger
     [not found]     ` <1350587006.2476.12.camel__24873.815305955$1350587085$gmane$org@pasglop>
2012-10-21 15:35       ` Robert Berger
2012-10-21 20:01         ` Benjamin Herrenschmidt
     [not found]         ` <1350849666.2476.138.camel__11705.9888471433$1350849778$gmane$org@pasglop>
2012-10-24  5:45           ` Robert Berger
2013-01-04  4:08             ` Benjamin Herrenschmidt
2012-10-21 15:39       ` Robert Berger
2012-10-17 18:15 Robert Berger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50804020.30505@gmail.com \
    --to=robert.karl.berger@gmail.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mla@apm.com \
    --cc=wd@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.