* madness, was Re: [PATCH 2/2] Macintosh: fix coding style issues in adb.c This is a patch to the adb.c file that cleans up many warnings found by the checkpatch.pl tool
From: fthain @ 2010-03-10 3:48 UTC (permalink / raw)
To: Michael Beardsworth
Cc: monstr, linux-kernel, linuxppc-dev, geert, Nick Savage
In-Reply-To: <1268172438-76422-1-git-send-email-mbeards2@uoregon.edu>
On Tue, 9 Mar 2010, Michael Beardsworth wrote:
> - /* If a probe is in progress or we are sleeping, wait for it to complete */
> + /* If a probe is in progress or we are sleeping, wait until complete */
If you must "fix" what aint broke, please try not to damage it. I'm sorry
if your VT52 is limited to 80 cols, but IMNSHO this sort of effort is
misguided.
Maybe I could point out again (I do this periodically) that checkpatch.pl
is great but code that fails it is NOT always wrong.
"Check patch" is a good idea but "check existing code" is a waste of
everyone's time.
Finn
^ permalink raw reply
* [PATCH] Macintosh: fix brace and trailing statement coding style issues in adb-iop.c This is a patch to the adb-iop.c file that cleans up brace and trailing statement warnings found by the checkpatch.pl tool. Signed-off-by: Michael Beardsworth <mbeards2@uoregon.edu>
From: Michael Beardsworth @ 2010-03-09 21:46 UTC (permalink / raw)
To: benh, mbeards2; +Cc: linuxppc-dev, linux-kernel, Michael Beardsworth
From: Michael Beardsworth <mbeards@mbeards-mbp.lulzzzzzzz.info>
---
drivers/macintosh/adb-iop.c | 41 +++++++++++++++++++++++------------------
1 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c
index 4446966..e813589 100644
--- a/drivers/macintosh/adb-iop.c
+++ b/drivers/macintosh/adb-iop.c
@@ -19,13 +19,13 @@
#include <linux/init.h>
#include <linux/proc_fs.h>
-#include <asm/macintosh.h>
-#include <asm/macints.h>
+#include <asm/macintosh.h>
+#include <asm/macints.h>
#include <asm/mac_iop.h>
#include <asm/mac_oss.h>
#include <asm/adb_iop.h>
-#include <linux/adb.h>
+#include <linux/adb.h>
/*#define DEBUG_ADB_IOP*/
@@ -67,7 +67,8 @@ static void adb_iop_end_req(struct adb_request *req, int state)
{
req->complete = 1;
current_req = req->next;
- if (req->done) (*req->done)(req);
+ if (req->done)
+ (*req->done)(req);
adb_iop_state = state;
}
@@ -85,9 +86,8 @@ static void adb_iop_complete(struct iop_msg *msg)
local_irq_save(flags);
req = current_req;
- if ((adb_iop_state == sending) && req && req->reply_expected) {
+ if ((adb_iop_state == sending) && req && req->reply_expected)
adb_iop_state = awaiting_reply;
- }
local_irq_restore(flags);
}
@@ -113,8 +113,8 @@ static void adb_iop_listen(struct iop_msg *msg)
req = current_req;
#ifdef DEBUG_ADB_IOP
- printk("adb_iop_listen %p: rcvd packet, %d bytes: %02X %02X", req,
- (uint) amsg->count + 2, (uint) amsg->flags, (uint) amsg->cmd);
+ printk(KERN_WARNING "adb_iop_listen %p: rcvd packet, %d bytes: %02X %02X",
+ req, (uint) amsg->count + 2, (uint) amsg->flags, (uint) amsg->cmd);
for (i = 0; i < amsg->count; i++)
printk(" %02X", (uint) amsg->data[i]);
printk("\n");
@@ -130,9 +130,8 @@ static void adb_iop_listen(struct iop_msg *msg)
msg->reply[0] = ADB_IOP_TIMEOUT | ADB_IOP_AUTOPOLL;
msg->reply[1] = 0;
msg->reply[2] = 0;
- if (req && (adb_iop_state != idle)) {
+ if (req && (adb_iop_state != idle))
adb_iop_end_req(req, idle);
- }
} else {
/* TODO: is it possible for more than one chunk of data */
/* to arrive before the timeout? If so we need to */
@@ -169,12 +168,13 @@ static void adb_iop_start(void)
/* get the packet to send */
req = current_req;
- if (!req) return;
+ if (!req)
+ return;
local_irq_save(flags);
#ifdef DEBUG_ADB_IOP
- printk("adb_iop_start %p: sending packet, %d bytes:", req, req->nbytes);
+ printk(KERN_WARNING "adb_iop_start %p: sending packet, %d bytes:", req, req->nbytes);
for (i = 0 ; i < req->nbytes ; i++)
printk(" %02X", (uint) req->data[i]);
printk("\n");
@@ -203,13 +203,14 @@ static void adb_iop_start(void)
int adb_iop_probe(void)
{
- if (!iop_ism_present) return -ENODEV;
+ if (!iop_ism_present)
+ return -ENODEV;
return 0;
}
int adb_iop_init(void)
{
- printk("adb: IOP ISM driver v0.4 for Unified ADB.\n");
+ printk(KERN_MESSAGE "adb: IOP ISM driver v0.4 for Unified ADB.\n");
iop_listen(ADB_IOP, ADB_CHAN, adb_iop_listen, "ADB");
return 0;
}
@@ -219,10 +220,12 @@ int adb_iop_send_request(struct adb_request *req, int sync)
int err;
err = adb_iop_write(req);
- if (err) return err;
+ if (err)
+ return err;
if (sync) {
- while (!req->complete) adb_iop_poll();
+ while (!req->complete)
+ adb_iop_poll();
}
return 0;
}
@@ -252,7 +255,8 @@ static int adb_iop_write(struct adb_request *req)
}
local_irq_restore(flags);
- if (adb_iop_state == idle) adb_iop_start();
+ if (adb_iop_state == idle)
+ adb_iop_start();
return 0;
}
@@ -264,7 +268,8 @@ int adb_iop_autopoll(int devs)
void adb_iop_poll(void)
{
- if (adb_iop_state == idle) adb_iop_start();
+ if (adb_iop_state == idle)
+ adb_iop_start();
iop_ism_irq(0, (void *) ADB_IOP);
}
--
1.6.5
^ permalink raw reply related
* [PATCH 2/2] Macintosh: fix coding style issues in adb.c This is a patch to the adb.c file that cleans up many warnings found by the checkpatch.pl tool. Signed-off-by: Michael Beardsworth <mbeards2@uoregon.edu>
From: Michael Beardsworth @ 2010-03-09 22:07 UTC (permalink / raw)
To: mbeards2, benh, fthain, grant.likely, geert, monstr
Cc: linuxppc-dev, linux-kernel
---
drivers/macintosh/adb.c | 73 +++++++++++++++++++++++------------------------
1 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 1c4ee6e..1f7a4f6 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -115,27 +115,27 @@ static DEFINE_RWLOCK(adb_handler_lock);
#if 0
static void printADBreply(struct adb_request *req)
{
- int i;
+ int i;
- printk("adb reply (%d)", req->reply_len);
- for(i = 0; i < req->reply_len; i++)
- printk(" %x", req->reply[i]);
- printk("\n");
+ printk("adb reply (%d)", req->reply_len);
+ for (i = 0; i < req->reply_len; i++)
+ printk(" %x", req->reply[i]);
+ printk("\n");
}
#endif
static int adb_scan_bus(void)
{
- int i, highFree=0, noMovement;
+ int i, highFree = 0, noMovement;
int devmask = 0;
struct adb_request req;
-
+
/* assumes adb_handler[] is all zeroes at this point */
for (i = 1; i < 16; i++) {
/* see if there is anything at address i */
adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
- (i << 4) | 0xf);
+ (i << 4) | 0xf);
if (req.reply_len > 1)
/* one or more devices at this address */
adb_handler[i].original_address = i;
@@ -161,7 +161,7 @@ static int adb_scan_bus(void)
* this only moves one device.
*/
adb_request(&req, NULL, ADBREQ_SYNC, 3,
- (i<< 4) | 0xb, (highFree | 0x60), 0xfe);
+ (i << 4) | 0xb, (highFree | 0x60), 0xfe);
/*
* See if anybody actually moved. This is suggested
* by HW TechNote 01:
@@ -170,7 +170,8 @@ static int adb_scan_bus(void)
*/
adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
(highFree << 4) | 0xf);
- if (req.reply_len <= 1) continue;
+ if (req.reply_len <= 1)
+ continue;
/*
* Test whether there are any device(s) left
* at address i.
@@ -193,8 +194,7 @@ static int adb_scan_bus(void)
break;
noMovement = 0;
- }
- else {
+ } else {
/*
* No devices left at address i; move the
* one(s) we moved to `highFree' back to i.
@@ -203,7 +203,7 @@ static int adb_scan_bus(void)
(highFree << 4) | 0xb,
(i | 0x60), 0xfe);
}
- }
+ }
}
/* Now fill in the handler_id field of the adb_handler entries. */
@@ -307,7 +307,7 @@ static int __init adb_init(void)
if (adb_inited)
return 0;
adb_inited = 1;
-
+
adb_controller = NULL;
i = 0;
@@ -341,10 +341,10 @@ static int
do_adb_reset_bus(void)
{
int ret;
-
+
if (adb_controller == NULL)
return -ENXIO;
-
+
if (adb_controller->autopoll)
adb_controller->autopoll(0);
@@ -381,14 +381,14 @@ do_adb_reset_bus(void)
blocking_notifier_call_chain(&adb_client_list,
ADB_MSG_POST_RESET, NULL);
-
+
return ret;
}
void
adb_poll(void)
{
- if ((adb_controller == NULL)||(adb_controller->poll == NULL))
+ if ((adb_controller == NULL) || (adb_controller->poll == NULL))
return;
adb_controller->poll();
}
@@ -459,7 +459,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids,
ids->nids = 0;
for (i = 1; i < 16; i++) {
if ((adb_handler[i].original_address == default_id) &&
- (!handler_id || (handler_id == adb_handler[i].handler_id) ||
+ (!handler_id || (handler_id == adb_handler[i].handler_id) ||
try_handler_change(i, handler_id))) {
if (adb_handler[i].handler != 0) {
printk(KERN_ERR
@@ -485,7 +485,7 @@ adb_unregister(int index)
mutex_lock(&adb_handler_mutex);
write_lock_irq(&adb_handler_lock);
if (adb_handler[index].handler) {
- while(adb_handler[index].busy) {
+ while (adb_handler[index].busy) {
write_unlock_irq(&adb_handler_lock);
yield();
write_lock_irq(&adb_handler_lock);
@@ -504,7 +504,7 @@ adb_input(unsigned char *buf, int nb, int autopoll)
int i, id;
static int dump_adb_input = 0;
unsigned long flags;
-
+
void (*handler)(unsigned char *, int, int);
/* We skip keystrokes and mouse moves when the sleep process
@@ -512,7 +512,7 @@ adb_input(unsigned char *buf, int nb, int autopoll)
*/
if (adb_got_sleep)
return;
-
+
id = buf[0] >> 4;
if (dump_adb_input) {
printk(KERN_INFO "adb packet: ");
@@ -530,7 +530,7 @@ adb_input(unsigned char *buf, int nb, int autopoll)
wmb();
adb_handler[id].busy = 0;
}
-
+
}
/* Try to change handler to new_id. Will return 1 if successful. */
@@ -539,15 +539,15 @@ static int try_handler_change(int address, int new_id)
struct adb_request req;
if (adb_handler[address].handler_id == new_id)
- return 1;
+ return 1;
adb_request(&req, NULL, ADBREQ_SYNC, 3,
ADB_WRITEREG(address, 3), address | 0x20, new_id);
adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
ADB_READREG(address, 3));
if (req.reply_len < 2)
- return 0;
+ return 0;
if (req.reply[2] != new_id)
- return 0;
+ return 0;
adb_handler[address].handler_id = req.reply[2];
return 1;
@@ -586,7 +586,7 @@ struct adbdev_state {
spinlock_t lock;
atomic_t n_pending;
struct adb_request *completed;
- wait_queue_head_t wait_queue;
+ wait_queue_head_t wait_queue;
int inuse;
};
@@ -624,8 +624,7 @@ do_adb_query(struct adb_request *req)
{
int ret = -EINVAL;
- switch(req->data[1])
- {
+ switch (req->data[1]) {
case ADB_QUERY_GETDEVINFO:
if (req->nbytes < 3)
break;
@@ -697,7 +696,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
int ret = 0;
struct adbdev_state *state = file->private_data;
struct adb_request *req;
- wait_queue_t wait = __WAITQUEUE_INITIALIZER(wait,current);
+ wait_queue_t wait = __WAITQUEUE_INITIALIZER(wait, current);
unsigned long flags;
if (count < 2)
@@ -720,7 +719,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
ret = -EIO;
if (req != NULL || ret != 0)
break;
-
+
if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
@@ -737,7 +736,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
current->state = TASK_RUNNING;
remove_wait_queue(&state->wait_queue, &wait);
spin_unlock_irqrestore(&state->lock, flags);
-
+
if (ret)
return ret;
@@ -774,14 +773,14 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
req->done = adb_write_done;
req->arg = (void *) state;
req->complete = 0;
-
+
ret = -EFAULT;
if (copy_from_user(req->data, buf, count))
goto out;
atomic_inc(&state->n_pending);
- /* If a probe is in progress or we are sleeping, wait for it to complete */
+ /* If a probe is in progress or we are sleeping, wait until complete */
down(&adb_probe_mutex);
/* Queries are special requests sent to the ADB driver itself */
@@ -794,15 +793,15 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
}
/* Special case for ADB_BUSRESET request, all others are sent to
the controller */
- else if ((req->data[0] == ADB_PACKET)&&(count > 1)
- &&(req->data[1] == ADB_BUSRESET)) {
+ else if ((req->data[0] == ADB_PACKET) && (count > 1)
+ && (req->data[1] == ADB_BUSRESET)) {
ret = do_adb_reset_bus();
up(&adb_probe_mutex);
atomic_dec(&state->n_pending);
if (ret == 0)
ret = count;
goto out;
- } else {
+ } else {
req->reply_expected = ((req->data[1] & 0xc) == 0xc);
if (adb_controller && adb_controller->send_request)
ret = adb_controller->send_request(req, 0);
--
1.6.5
^ permalink raw reply related
* [PATCH] PPC: Skip over OF_DT_NOP when unflattening the device tree
From: Jason Gunthorpe @ 2010-03-09 19:30 UTC (permalink / raw)
To: linuxppc-dev; +Cc: linux-kernel
NOPs within the property section are skipped, but NOPs between
OF_DT_END_NODE and OF_DT_BEGIN_NODE were not. My firmware NOPs out
entire nodes depending on various environment parameters.
of_scan_flat_dt already handles NOP more generally..
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
arch/powerpc/kernel/prom.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 4ec3008..92137b2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -408,8 +408,11 @@ static unsigned long __init unflatten_dt_node(unsigned long mem,
if (!np->type)
np->type = "<NULL>";
}
- while (tag == OF_DT_BEGIN_NODE) {
- mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
+ while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) {
+ if (tag == OF_DT_NOP)
+ *p += 4;
+ else
+ mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
tag = *((u32 *)(*p));
}
if (tag != OF_DT_END_NODE) {
--
1.5.4.2
^ permalink raw reply related
* [PATCH] PPC32: Fixup pmd_page to work when ARCH_PFN_OFFSET is non-zero
From: Jason Gunthorpe @ 2010-03-09 19:35 UTC (permalink / raw)
To: linuxppc-dev; +Cc: linux-kernel
Instead of referencing mem_map directly, use pfn_to_page. Otherwise
the kernel crashes when trying to start userspace if ARCH_PFN_OFFSET is
non-zero and CONFIG_BOOKE is not defined
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
arch/powerpc/include/asm/pgtable-ppc32.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
For reference, on powerpc 32 with CONFIG_FLATMEM:
#define pfn_to_page __pfn_to_page
#define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
So the below patch has no effect if ARCH_PFN_OFFEST is 0.
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
index 55646ad..a7db96f 100644
--- a/arch/powerpc/include/asm/pgtable-ppc32.h
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -287,7 +287,7 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry)
#define pmd_page_vaddr(pmd) \
((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
#define pmd_page(pmd) \
- (mem_map + (pmd_val(pmd) >> PAGE_SHIFT))
+ pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)
#else
#define pmd_page_vaddr(pmd) \
((unsigned long) (pmd_val(pmd) & PAGE_MASK))
--
1.5.4.2
^ permalink raw reply related
* [PATCH] TPM: Provide a tpm_tis OF driver
From: Jason Gunthorpe @ 2010-03-09 20:01 UTC (permalink / raw)
To: tpmdd-devel; +Cc: linuxppc-dev, linux-kernel
This provides an open firwmare driver binding for tpm_tis. OF
is useful on arches where PNP is not used.
Allow the tpm_tis driver to be selected if PNP or OF are compiled in.
Tested on a PPC405 with a winbond LPC TPM.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
drivers/char/tpm/Kconfig | 2 +-
drivers/char/tpm/tpm_tis.c | 75 +++++++++++++++++++++++++++++++++++++++----
2 files changed, 69 insertions(+), 8 deletions(-)
I had previously sent a patch to make the platform device more useful,
but this one is better for PPC...
Thanks
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
index f5fc64f..e4ab74f 100644
--- a/drivers/char/tpm/Kconfig
+++ b/drivers/char/tpm/Kconfig
@@ -24,7 +24,7 @@ if TCG_TPM
config TCG_TIS
tristate "TPM Interface Specification 1.2 Interface"
- depends on PNP
+ depends on PNP || OF
---help---
If you have a TPM security chip that is compliant with the
TCG TIS 1.2 TPM specification say Yes and it will be accessible
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 2405f17..37e45f1 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -24,6 +24,7 @@
#include <linux/pnp.h>
#include <linux/interrupt.h>
#include <linux/wait.h>
+#include <linux/of_platform.h>
#include "tpm.h"
#define TPM_HEADER_SIZE 10
@@ -439,7 +440,7 @@ module_param(interrupts, bool, 0444);
MODULE_PARM_DESC(interrupts, "Enable interrupts");
static int tpm_tis_init(struct device *dev, resource_size_t start,
- resource_size_t len, unsigned int irq)
+ resource_size_t len, int irq)
{
u32 vendor, intfcaps, intmask;
int rc, i;
@@ -515,9 +516,11 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
iowrite32(intmask,
chip->vendor.iobase +
TPM_INT_ENABLE(chip->vendor.locality));
- if (interrupts)
+ if (!interrupts)
+ irq = -1;
+ if (irq != -1)
chip->vendor.irq = irq;
- if (interrupts && !chip->vendor.irq) {
+ if (irq == 0) {
chip->vendor.irq =
ioread8(chip->vendor.iobase +
TPM_INT_VECTOR(chip->vendor.locality));
@@ -598,11 +601,12 @@ out_err:
return rc;
}
+#ifdef CONFIG_PNP
static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
const struct pnp_device_id *pnp_id)
{
resource_size_t start, len;
- unsigned int irq = 0;
+ int irq = 0;
start = pnp_mem_start(pnp_dev, 0);
len = pnp_mem_len(pnp_dev, 0);
@@ -610,7 +614,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
if (pnp_irq_valid(pnp_dev, 0))
irq = pnp_irq(pnp_dev, 0);
else
- interrupts = 0;
+ irq = -1;
return tpm_tis_init(&pnp_dev->dev, start, len, irq);
}
@@ -662,6 +666,7 @@ static struct pnp_driver tis_pnp_driver = {
module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);
MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe");
+#endif
static int tpm_tis_suspend(struct platform_device *dev, pm_message_t msg)
{
@@ -683,6 +688,45 @@ static struct platform_driver tis_drv = {
static struct platform_device *pdev;
+#ifdef CONFIG_OF
+static int __devinit tis_of_init_one(struct of_device *ofdev,
+ const struct of_device_id *match)
+{
+ struct resource res;
+ int ret;
+ int irq;
+
+ ret = of_address_to_resource(ofdev->node, 0, &res);
+ if (ret)
+ return ret;
+
+ irq = irq_of_parse_and_map(ofdev->node, 0);
+ if (irq == NO_IRQ)
+ irq = -1;
+ return tpm_tis_init(&ofdev->dev, res.start, res.end - res.start + 1, irq);
+}
+
+static int __devexit tis_of_remove_one(struct of_device *odev)
+{
+ struct tpm_chip *chip = dev_get_drvdata(&odev->dev);
+ tpm_dev_vendor_release(chip);
+ kfree(chip);
+ return 0;
+}
+
+static struct of_device_id tis_of_platform_match[] = {
+ {.compatible = "tcg,tpm_tis"},
+ {},
+};
+static struct of_platform_driver tis_of_driver = {
+ .name = "tpm_tis",
+ .match_table = tis_of_platform_match,
+ .probe = tis_of_init_one,
+ .remove = __devexit_p(tis_of_remove_one)
+};
+
+#endif
+
static int force;
module_param(force, bool, 0444);
MODULE_PARM_DESC(force, "Force device probe rather than using ACPI entry");
@@ -703,7 +747,17 @@ static int __init init_tis(void)
return rc;
}
- return pnp_register_driver(&tis_pnp_driver);
+#ifdef CONFIG_OF
+ rc = of_register_platform_driver(&tis_of_driver);
+ if (rc)
+ return rc;
+#endif
+#ifdef CONFIG_PNP
+ rc = pnp_register_driver(&tis_pnp_driver);
+ if (rc)
+ return rc;
+#endif
+ return 0;
}
static void __exit cleanup_tis(void)
@@ -728,11 +782,18 @@ static void __exit cleanup_tis(void)
}
spin_unlock(&tis_lock);
+#ifdef CONFIG_OF
+ of_unregister_platform_driver(&tis_of_driver);
+#endif
+
if (force) {
platform_device_unregister(pdev);
platform_driver_unregister(&tis_drv);
- } else
+ } else {
+#ifdef CONFIG_PNP
pnp_unregister_driver(&tis_pnp_driver);
+#endif
+ }
}
module_init(init_tis);
--
1.5.4.2
^ permalink raw reply related
* [PATCH] Staging: macintosh: fix whitespace and style in adb.c This is a patch to the adb.c file, fixing the formatting of braces and tabs. Signed-off-by: Nick Savage
From: Nick Savage @ 2010-03-09 19:28 UTC (permalink / raw)
To: benh, fthain, grant.likely, geert, monstr
Cc: linuxppc-dev, linux-kernel, Nick Savage
---
drivers/macintosh/adb.c | 71 +++++++++++++++++++++++------------------------
1 files changed, 35 insertions(+), 36 deletions(-)
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 1c4ee6e..89891bb 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -115,27 +115,27 @@ static DEFINE_RWLOCK(adb_handler_lock);
#if 0
static void printADBreply(struct adb_request *req)
{
- int i;
+ int i;
- printk("adb reply (%d)", req->reply_len);
- for(i = 0; i < req->reply_len; i++)
- printk(" %x", req->reply[i]);
- printk("\n");
+ printk("adb reply (%d)", req->reply_len);
+ for (i = 0; i < req->reply_len; i++)
+ printk(" %x", req->reply[i]);
+ printk("\n");
}
#endif
static int adb_scan_bus(void)
{
- int i, highFree=0, noMovement;
+ int i, highFree = 0, noMovement;
int devmask = 0;
struct adb_request req;
-
+
/* assumes adb_handler[] is all zeroes at this point */
for (i = 1; i < 16; i++) {
/* see if there is anything at address i */
adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
- (i << 4) | 0xf);
+ (i << 4) | 0xf);
if (req.reply_len > 1)
/* one or more devices at this address */
adb_handler[i].original_address = i;
@@ -161,7 +161,7 @@ static int adb_scan_bus(void)
* this only moves one device.
*/
adb_request(&req, NULL, ADBREQ_SYNC, 3,
- (i<< 4) | 0xb, (highFree | 0x60), 0xfe);
+ (i << 4) | 0xb, (highFree | 0x60), 0xfe);
/*
* See if anybody actually moved. This is suggested
* by HW TechNote 01:
@@ -170,7 +170,8 @@ static int adb_scan_bus(void)
*/
adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
(highFree << 4) | 0xf);
- if (req.reply_len <= 1) continue;
+ if (req.reply_len <= 1)
+ continue;
/*
* Test whether there are any device(s) left
* at address i.
@@ -193,8 +194,7 @@ static int adb_scan_bus(void)
break;
noMovement = 0;
- }
- else {
+ } else {
/*
* No devices left at address i; move the
* one(s) we moved to `highFree' back to i.
@@ -203,7 +203,7 @@ static int adb_scan_bus(void)
(highFree << 4) | 0xb,
(i | 0x60), 0xfe);
}
- }
+ }
}
/* Now fill in the handler_id field of the adb_handler entries. */
@@ -307,7 +307,7 @@ static int __init adb_init(void)
if (adb_inited)
return 0;
adb_inited = 1;
-
+
adb_controller = NULL;
i = 0;
@@ -341,10 +341,10 @@ static int
do_adb_reset_bus(void)
{
int ret;
-
+
if (adb_controller == NULL)
return -ENXIO;
-
+
if (adb_controller->autopoll)
adb_controller->autopoll(0);
@@ -381,14 +381,14 @@ do_adb_reset_bus(void)
blocking_notifier_call_chain(&adb_client_list,
ADB_MSG_POST_RESET, NULL);
-
+
return ret;
}
void
adb_poll(void)
{
- if ((adb_controller == NULL)||(adb_controller->poll == NULL))
+ if ((adb_controller == NULL) || (adb_controller->poll == NULL))
return;
adb_controller->poll();
}
@@ -459,7 +459,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids,
ids->nids = 0;
for (i = 1; i < 16; i++) {
if ((adb_handler[i].original_address == default_id) &&
- (!handler_id || (handler_id == adb_handler[i].handler_id) ||
+ (!handler_id || (handler_id == adb_handler[i].handler_id) ||
try_handler_change(i, handler_id))) {
if (adb_handler[i].handler != 0) {
printk(KERN_ERR
@@ -485,7 +485,7 @@ adb_unregister(int index)
mutex_lock(&adb_handler_mutex);
write_lock_irq(&adb_handler_lock);
if (adb_handler[index].handler) {
- while(adb_handler[index].busy) {
+ while (adb_handler[index].busy) {
write_unlock_irq(&adb_handler_lock);
yield();
write_lock_irq(&adb_handler_lock);
@@ -504,7 +504,7 @@ adb_input(unsigned char *buf, int nb, int autopoll)
int i, id;
static int dump_adb_input = 0;
unsigned long flags;
-
+
void (*handler)(unsigned char *, int, int);
/* We skip keystrokes and mouse moves when the sleep process
@@ -512,7 +512,7 @@ adb_input(unsigned char *buf, int nb, int autopoll)
*/
if (adb_got_sleep)
return;
-
+
id = buf[0] >> 4;
if (dump_adb_input) {
printk(KERN_INFO "adb packet: ");
@@ -530,7 +530,7 @@ adb_input(unsigned char *buf, int nb, int autopoll)
wmb();
adb_handler[id].busy = 0;
}
-
+
}
/* Try to change handler to new_id. Will return 1 if successful. */
@@ -539,15 +539,15 @@ static int try_handler_change(int address, int new_id)
struct adb_request req;
if (adb_handler[address].handler_id == new_id)
- return 1;
+ return 1;
adb_request(&req, NULL, ADBREQ_SYNC, 3,
ADB_WRITEREG(address, 3), address | 0x20, new_id);
adb_request(&req, NULL, ADBREQ_SYNC | ADBREQ_REPLY, 1,
ADB_READREG(address, 3));
if (req.reply_len < 2)
- return 0;
+ return 0;
if (req.reply[2] != new_id)
- return 0;
+ return 0;
adb_handler[address].handler_id = req.reply[2];
return 1;
@@ -586,7 +586,7 @@ struct adbdev_state {
spinlock_t lock;
atomic_t n_pending;
struct adb_request *completed;
- wait_queue_head_t wait_queue;
+ wait_queue_head_t wait_queue;
int inuse;
};
@@ -624,8 +624,7 @@ do_adb_query(struct adb_request *req)
{
int ret = -EINVAL;
- switch(req->data[1])
- {
+ switch (req->data[1]) {
case ADB_QUERY_GETDEVINFO:
if (req->nbytes < 3)
break;
@@ -697,7 +696,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
int ret = 0;
struct adbdev_state *state = file->private_data;
struct adb_request *req;
- wait_queue_t wait = __WAITQUEUE_INITIALIZER(wait,current);
+ wait_queue_t wait = __WAITQUEUE_INITIALIZER(wait, current);
unsigned long flags;
if (count < 2)
@@ -720,7 +719,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
ret = -EIO;
if (req != NULL || ret != 0)
break;
-
+
if (file->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
break;
@@ -737,7 +736,7 @@ static ssize_t adb_read(struct file *file, char __user *buf,
current->state = TASK_RUNNING;
remove_wait_queue(&state->wait_queue, &wait);
spin_unlock_irqrestore(&state->lock, flags);
-
+
if (ret)
return ret;
@@ -774,7 +773,7 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
req->done = adb_write_done;
req->arg = (void *) state;
req->complete = 0;
-
+
ret = -EFAULT;
if (copy_from_user(req->data, buf, count))
goto out;
@@ -794,15 +793,15 @@ static ssize_t adb_write(struct file *file, const char __user *buf,
}
/* Special case for ADB_BUSRESET request, all others are sent to
the controller */
- else if ((req->data[0] == ADB_PACKET)&&(count > 1)
- &&(req->data[1] == ADB_BUSRESET)) {
+ else if ((req->data[0] == ADB_PACKET) && (count > 1)
+ && (req->data[1] == ADB_BUSRESET)) {
ret = do_adb_reset_bus();
up(&adb_probe_mutex);
atomic_dec(&state->n_pending);
if (ret == 0)
ret = count;
goto out;
- } else {
+ } else {
req->reply_expected = ((req->data[1] & 0xc) == 0xc);
if (adb_controller && adb_controller->send_request)
ret = adb_controller->send_request(req, 0);
--
1.7.0.1
^ permalink raw reply related
* Re: [LKML] [RFC PATCH v3 05/11] swiotlb: add swiotlb_set_default_size()
From: Albert Herranz @ 2010-03-09 18:38 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: x86, linux-ia64, linux-usb, linuxppc-dev, linux-kernel
In-Reply-To: <20100308165940.GC4568@phenom.dumpdata.com>
Konrad Rzeszutek Wilk wrote:
> On Sun, Mar 07, 2010 at 01:11:46PM +0100, Albert Herranz wrote:
>> The current SWIOTLB code uses a default of 64MB for the IO TLB area.
>> This size can be influenced using a kernel command line parameter "swiotlb".
>> Unfortunately, the parsing of the kernel command line is done _after_ the
>> swiotlb is initialized on some architectures.
>
> Why can't it be moved up? I mean move the parsing of the kernel
> parameters before the PCI subsystem?
(In my case there's no PCI subsystem, this is an embedded platform without PCI support).
Currently, in the PowerPC tree a platform wanting to use the swiotlb just sets the global ppc_swiotlb_enable variable to true in its setup_arch() function.
The PowerPC setup code then calls swiotlb_init(1) just after setup_arch() when SWIOTLB and ppc_swiotlb_enable is true.
At this point the kernel command line is not yet parsed.
So, at least in PowerPC linux, the early swiotlb initialization is not influenced by the kernel command line.
Maybe switching swiotlb from __setup to early_param would help too.
>> This patch adds a new function swiotlb_set_default_size() which can be used
>> before swiotlb_init() to indicate the desired IO TLB area size in bytes.
>>
>> This will be used later to implement a smaller IO TLB on the Nintendo Wii
>> video game console which just comes with 24MB + 64MB of RAM.
>
> Use the io_tlb_nslabs, which is what swiotlb_init_with_default_size uses
> (the passed in argument is only used if io_tlb_nslabs is not set).
>
True, thanks.
Cheers,
Albert
^ permalink raw reply
* Re: [LKML] [RFC PATCH v3 04/11] swiotlb: support NOT_COHERENT_CACHE PowerPC platforms
From: Albert Herranz @ 2010-03-09 18:07 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: x86, linux-ia64, linux-usb, linuxppc-dev, linux-kernel
In-Reply-To: <20100308165500.GB4568@phenom.dumpdata.com>
Konrad Rzeszutek Wilk wrote:
> Hey Albert,
>
> I've been doing some posting in this area to split the physical / bus
> address translation so that multiple platforms can utilize it. I was
> wondering if it makes sense to utilize some of those concepts (ie, extend it
> for DMA coherency) for your code:
>
> https://lists.linux-foundation.org/pipermail/iommu/2010-February/002066.html
>
> And here is the git tree that goes on top of those patches:
> git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb-2.6.git xen-swiotlb-0.5
>
Hi Konrad,
Thanks for your comments.
In my case, I'd like to re-use as much code from swiotlb as possible.
Adding a few function calls at strategic spots (which are optimized out for cache coherent platforms) to maintain cache coherency is currently enough for me if that's acceptable.
A more general approach would involve making swiotlb_bounce() platform-dependent (or at least the actual code for copying the buffers), and re-implementing map_page, sync_single and map_sg at the platform DMA code again.
I've whipped through your patches. If I undestood them, you make available a kind of swiotlb "library" core on top of which you can build alternate swiotlb-based dma ops.
Wouldn't it be a good idea to split the "library" code from the default swiotlb dma ops?
A(n embedded) platform may just want the "library" code to implement its own dma ops, without having to pay for the extra default swiotlb dma ops implementation.
Thanks,
Albert
^ permalink raw reply
* Re: cross-compiling Linux for PowerPC e200 core?
From: Detlev Zundel @ 2010-03-09 14:24 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <53452.84.105.60.153.1268080871.squirrel__48847.2990495667$1268080944$gmane$org@gate.crashing.org>
Hi Segher,
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=33d9e9b
>
> There is no obvious way to get there via clicking afaics, the "commit"
> search box doesn't work at least. Hrm.
It works, but not like one would expect, i.e. check out the help:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=search_help
Last I checked the gitweb code, there was no easy way other than what
you did by manipulating the URL directly.
Cheers
Detlev
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu@denx.de
^ permalink raw reply
* Re: [LKML] [RFC PATCH v3 05/11] swiotlb: add swiotlb_set_default_size()
From: Konrad Rzeszutek Wilk @ 2010-03-08 16:59 UTC (permalink / raw)
To: Albert Herranz; +Cc: x86, linux-ia64, linux-usb, linuxppc-dev, linux-kernel
In-Reply-To: <1267963912-984-6-git-send-email-albert_herranz@yahoo.es>
On Sun, Mar 07, 2010 at 01:11:46PM +0100, Albert Herranz wrote:
> The current SWIOTLB code uses a default of 64MB for the IO TLB area.
> This size can be influenced using a kernel command line parameter "swiotlb".
> Unfortunately, the parsing of the kernel command line is done _after_ the
> swiotlb is initialized on some architectures.
Why can't it be moved up? I mean move the parsing of the kernel
parameters before the PCI subsystem?
>
> This patch adds a new function swiotlb_set_default_size() which can be used
> before swiotlb_init() to indicate the desired IO TLB area size in bytes.
>
> This will be used later to implement a smaller IO TLB on the Nintendo Wii
> video game console which just comes with 24MB + 64MB of RAM.
Use the io_tlb_nslabs, which is what swiotlb_init_with_default_size uses
(the passed in argument is only used if io_tlb_nslabs is not set).
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> CC: linuxppc-dev@lists.ozlabs.org
> CC: linux-kernel@vger.kernel.org
> CC: x86@kernel.org
> CC: linux-ia64@vger.kernel.org
> ---
> include/linux/swiotlb.h | 2 ++
> lib/swiotlb.c | 27 ++++++++++++++++++++++++++-
> 2 files changed, 28 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
> index 3954228..2af6a45 100644
> --- a/include/linux/swiotlb.h
> +++ b/include/linux/swiotlb.h
> @@ -22,6 +22,8 @@ extern int swiotlb_force;
> */
> #define IO_TLB_SHIFT 11
>
> +extern size_t __init swiotlb_set_default_size(size_t size);
> +
> extern void swiotlb_init(int verbose);
>
> extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs);
> diff --git a/lib/swiotlb.c b/lib/swiotlb.c
> index 8f2dad9..c99512d 100644
> --- a/lib/swiotlb.c
> +++ b/lib/swiotlb.c
> @@ -73,6 +73,11 @@ static char *io_tlb_start, *io_tlb_end;
> static unsigned long io_tlb_nslabs;
>
> /*
> + * Default size for the IO TLB (64MB).
> + */
> +static __initdata size_t io_tlb_default_size = 64 * (1<<20);
> +
> +/*
> * When the IOMMU overflows we return a fallback buffer. This sets the size.
> */
> static unsigned long io_tlb_overflow = 32*1024;
> @@ -117,6 +122,26 @@ setup_io_tlb_npages(char *str)
> __setup("swiotlb=", setup_io_tlb_npages);
> /* make io_tlb_overflow tunable too? */
>
> +/**
> + * swiotlb_set_default_size() - set the default size for the IO TLB
> + * @size: size in bytes of the IO TLB
> + *
> + * A platform can use this function to change the default size of the
> + * IO TLB when the default of 64MB is not suitable.
> + * This function must be called before swiotlb_init().
> + *
> + * Note that on some platforms this is the only way to influence the
> + * size of the IO TLB, as the command line may be parsed _after_ the
> + * IO TLB is initialized.
> + */
> +size_t __init swiotlb_set_default_size(size_t size)
> +{
> + size_t previous_size = io_tlb_default_size;
> +
> + io_tlb_default_size = size;
> + return previous_size;
> +}
> +
> void * __weak __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
> {
> return alloc_bootmem_low_pages(size);
> @@ -193,7 +218,7 @@ swiotlb_init_with_default_size(size_t default_size, int verbose)
> void __init
> swiotlb_init(int verbose)
> {
> - swiotlb_init_with_default_size(64 * (1<<20), verbose); /* default to 64MB */
> + swiotlb_init_with_default_size(io_tlb_default_size, verbose);
> }
>
> /*
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [LKML] [RFC PATCH v3 04/11] swiotlb: support NOT_COHERENT_CACHE PowerPC platforms
From: Konrad Rzeszutek Wilk @ 2010-03-08 16:55 UTC (permalink / raw)
To: Albert Herranz; +Cc: x86, linux-ia64, linux-usb, linuxppc-dev, linux-kernel
In-Reply-To: <1267963912-984-5-git-send-email-albert_herranz@yahoo.es>
On Sun, Mar 07, 2010 at 01:11:45PM +0100, Albert Herranz wrote:
> The current SWIOTLB code does not support NOT_COHERENT_CACHE platforms.
> This patch adds support for NOT_COHERENT_CACHE platforms to SWIOTLB by
> adding two platform specific functions swiotlb_dma_sync_page() and
> swiotlb_dma_sync() which can be used to explicitly manage cache coherency.
Hey Albert,
I've been doing some posting in this area to split the physical / bus
address translation so that multiple platforms can utilize it. I was
wondering if it makes sense to utilize some of those concepts (ie, extend it
for DMA coherency) for your code:
https://lists.linux-foundation.org/pipermail/iommu/2010-February/002066.html
And here is the git tree that goes on top of those patches:
git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb-2.6.git xen-swiotlb-0.5
>
> On PowerPC these functions are mapped to their corresponding
> __dma_sync_page() and __dma_sync() functions.
> On other architectures using SWIOTLB these functions are optimized out.
>
> This will be used later to support SWIOTLB on the Nintendo Wii video game
> console.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> CC: linuxppc-dev@lists.ozlabs.org
> CC: linux-kernel@vger.kernel.org
> CC: x86@kernel.org
> CC: linux-ia64@vger.kernel.org
> ---
> arch/ia64/include/asm/swiotlb.h | 10 ++++++++++
> arch/powerpc/include/asm/swiotlb.h | 3 +++
> arch/x86/include/asm/swiotlb.h | 10 ++++++++++
> lib/swiotlb.c | 30 ++++++++++++++++++++++++------
> 4 files changed, 47 insertions(+), 6 deletions(-)
>
> diff --git a/arch/ia64/include/asm/swiotlb.h b/arch/ia64/include/asm/swiotlb.h
> index f0acde6..6722090 100644
> --- a/arch/ia64/include/asm/swiotlb.h
> +++ b/arch/ia64/include/asm/swiotlb.h
> @@ -14,4 +14,14 @@ static inline void pci_swiotlb_init(void)
> }
> #endif
>
> +static inline void swiotlb_dma_sync_page(struct page *page,
> + unsigned long offset,
> + size_t size, int direction)
> +{
> +}
> +
> +static inline void swiotlb_dma_sync(void *vaddr, size_t size, int direction)
> +{
> +}
> +
> #endif /* ASM_IA64__SWIOTLB_H */
> diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
> index 8979d4c..603b343 100644
> --- a/arch/powerpc/include/asm/swiotlb.h
> +++ b/arch/powerpc/include/asm/swiotlb.h
> @@ -22,4 +22,7 @@ int __init swiotlb_setup_bus_notifier(void);
>
> extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
>
> +#define swiotlb_dma_sync_page __dma_sync_page
> +#define swiotlb_dma_sync __dma_sync
> +
> #endif /* __ASM_SWIOTLB_H */
> diff --git a/arch/x86/include/asm/swiotlb.h b/arch/x86/include/asm/swiotlb.h
> index 8085277..e5f6d9c 100644
> --- a/arch/x86/include/asm/swiotlb.h
> +++ b/arch/x86/include/asm/swiotlb.h
> @@ -20,4 +20,14 @@ static inline void pci_swiotlb_init(void)
>
> static inline void dma_mark_clean(void *addr, size_t size) {}
>
> +static inline void swiotlb_dma_sync_page(struct page *page,
> + unsigned long offset,
> + size_t size, int direction)
> +{
> +}
> +
> +static inline void swiotlb_dma_sync(void *vaddr, size_t size, int direction)
> +{
> +}
> +
> #endif /* _ASM_X86_SWIOTLB_H */
> diff --git a/lib/swiotlb.c b/lib/swiotlb.c
> index 94db5df..8f2dad9 100644
> --- a/lib/swiotlb.c
> +++ b/lib/swiotlb.c
> @@ -346,10 +346,13 @@ static void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
> local_irq_save(flags);
> buffer = kmap_atomic(pfn_to_page(pfn),
> KM_BOUNCE_READ);
> - if (dir == DMA_TO_DEVICE)
> + if (dir == DMA_TO_DEVICE) {
> memcpy(dma_addr, buffer + offset, sz);
> - else
> + swiotlb_dma_sync(dma_addr, sz, dir);
> + } else {
> + swiotlb_dma_sync(dma_addr, sz, dir);
> memcpy(buffer + offset, dma_addr, sz);
> + }
> kunmap_atomic(buffer, KM_BOUNCE_READ);
> local_irq_restore(flags);
>
> @@ -359,10 +362,14 @@ static void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
> offset = 0;
> }
> } else {
> - if (dir == DMA_TO_DEVICE)
> + if (dir == DMA_TO_DEVICE) {
> memcpy(dma_addr, phys_to_virt(phys), size);
> - else
> + swiotlb_dma_sync(dma_addr, size, dir);
> +
> + } else {
> + swiotlb_dma_sync(dma_addr, size, dir);
> memcpy(phys_to_virt(phys), dma_addr, size);
> + }
> }
> }
>
> @@ -542,6 +549,8 @@ sync_single(struct device *hwdev, char *dma_addr, size_t size,
> }
> }
>
> +#ifndef CONFIG_NOT_COHERENT_CACHE
> +
> void *
> swiotlb_alloc_coherent(struct device *hwdev, size_t size,
> dma_addr_t *dma_handle, gfp_t flags)
> @@ -606,6 +615,8 @@ swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
> }
> EXPORT_SYMBOL(swiotlb_free_coherent);
>
> +#endif /* !CONFIG_NOT_COHERENT_CACHE */
> +
> static void
> swiotlb_full(struct device *dev, size_t size, int dir, int do_panic)
> {
> @@ -652,8 +663,10 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
> * we can safely return the device addr and not worry about bounce
> * buffering it.
> */
> - if (dma_capable(dev, dev_addr, size) && !swiotlb_force)
> + if (dma_capable(dev, dev_addr, size) && !swiotlb_force) {
> + swiotlb_dma_sync_page(page, offset, size, dir);
> return dev_addr;
> + }
>
> /*
> * Oh well, have to allocate and map a bounce buffer.
> @@ -739,6 +752,8 @@ swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr,
> return;
> }
>
> + swiotlb_dma_sync(phys_to_virt(paddr), size, dir);
> +
> if (dir != DMA_FROM_DEVICE)
> return;
>
> @@ -835,8 +850,11 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
> return 0;
> }
> sg->dma_address = swiotlb_virt_to_bus(hwdev, map);
> - } else
> + } else {
> + swiotlb_dma_sync_page(sg_page(sg), sg->offset,
> + sg->length, dir);
> sg->dma_address = dev_addr;
> + }
> sg->dma_length = sg->length;
> }
> return nelems;
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: BUG: Bad page map in process mm2
From: Steven A. Falco @ 2010-03-09 14:48 UTC (permalink / raw)
To: Jake Magee; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <a8142e731003081726j1b60e9dfyeead2e89bc51a5e5@mail.gmail.com>
Jake Magee wrote:
> Steven,
>
> Try these patches...
> http://patchwork.ozlabs.org/patch/34047/
> http://patchwork.ozlabs.org/patch/34113/
>
Thanks for the pointer. I just tried 34047 and
it fixed the problem.
Steve
> Both patches work for my situation, but I went with the second set as a
> final patch(34113).
>
>
> On Mon, Mar 8, 2010 at 3:32 PM, Steven A. Falco <sfalco@harris.com
> <mailto:sfalco@harris.com>> wrote:
>
> Steven A. Falco wrote:
>
> Apologies - previous crash dump was mangled by the
> interspersed program output. Here is one showing
> just the crash dump.
>
> Interestingly, the program does produce correct output,
> as verified by dd'ing from /dev/mem to a file, then
> doing "od" on the result. So in some sense, the error
> is spurious.
>
> Steve
>
> # ./mm2 > foo 2>&1
> BUG: Bad page map in process mm2 pte:00000452 pmd:0f6c8400
> page:c0396000 flags:00000404 count:1 mapcount:-1 mapping:(null) index:0
> addr:4801f000 vm_flags:400844fb anon_vma:(null) mapping:cea78430 index:0
> vma->vm_ops->fault: 0x0
> vma->vm_file->f_op->mmap: mmap_mem+0x0/0xa4
> Call Trace:
> [cf4c5d90] [c0006cf4] show_stack+0x44/0x16c (unreliable)
> [cf4c5dd0] [c0067800] print_bad_pte+0x140/0x1cc
> [cf4c5e00] [c0068640] unmap_vmas+0x41c/0x594
> [cf4c5e80] [c006c8f0] exit_mmap+0xb8/0x150
> [cf4c5ea0] [c0020948] mmput+0x50/0xe0
> [cf4c5eb0] [c0024504] exit_mm+0xec/0x10c
> [cf4c5ee0] [c0025bd0] do_exit+0xc4/0x5d4
> [cf4c5f20] [c0026124] do_group_exit+0x44/0xa4
> [cf4c5f30] [c0026198] sys_exit_group+0x14/0x28
> [cf4c5f40] [c000edcc] ret_from_syscall+0x0/0x3c
> Disabling lock debugging due to kernel taint
> BUG: Bad page state in process mm2 pfn:00000
> page:c0396000 flags:00000404 count:0 mapcount:-1 mapping:(null) index:0
> Call Trace:
> [cf4c5d80] [c0006cf4] show_stack+0x44/0x16c (unreliable)
> [cf4c5dc0] [c00585bc] bad_page+0x94/0x12c
> [cf4c5de0] [c005d234] put_page+0x4c/0x170
> [cf4c5df0] [c0073e54] free_page_and_swap_cache+0x34/0x8c
> [cf4c5e00] [c0068490] unmap_vmas+0x26c/0x594
> [cf4c5e80] [c006c8f0] exit_mmap+0xb8/0x150
> [cf4c5ea0] [c0020948] mmput+0x50/0xe0
> [cf4c5eb0] [c0024504] exit_mm+0xec/0x10c
> [cf4c5ee0] [c0025bd0] do_exit+0xc4/0x5d4
> [cf4c5f20] [c0026124] do_group_exit+0x44/0xa4
> [cf4c5f30] [c0026198] sys_exit_group+0x14/0x28
> [cf4c5f40] [c000edcc] ret_from_syscall+0x0/0x3c
> # cat foo
> 00000000: 7c7f1b78 7c9e2378 7cbd2b78 7cdc3378
> 00000010: 7cfb3b78 480022ad 3c000002 60001032
> 00000020: 7c1b03a6 3c00c000 60002210 7c1a03a6
> 00000030: 4c000064 48000000 00000000 00000000
> # dd count=1 if=/dev/mem of=goo
> # od -X goo
> 0000000 7c7f1b78 7c9e2378 7cbd2b78 7cdc3378
> 0000020 7cfb3b78 480022ad 3c000002 60001032
> 0000040 7c1b03a6 3c00c000 60002210 7c1a03a6
> 0000060 4c000064 48000000 00000000 00000000
> 0000100
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org <mailto:Linuxppc-dev@lists.ozlabs.org>
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
>
^ permalink raw reply
* Re: cross-compiling Linux for PowerPC e200 core?
From: Grant Likely @ 2010-03-09 7:35 UTC (permalink / raw)
To: Németh Márton; +Cc: linuxppc-dev
In-Reply-To: <4B95F298.5040000@freemail.hu>
2010/3/9 N=E9meth M=E1rton <nm127@freemail.hu>:
> Hi,
> Grant Likely wrote:
>> 2010/3/8 N=E9meth M=E1rton <nm127@freemail.hu>:
>>> Grant Likely wrote:
>>>> 2010/3/6 N=E9meth M=E1rton <nm127@freemail.hu>:
>>>>> Hi,
>>>>>
>>>>> I'm trying to cross-compile Linux 2.6.33 for Freescale MPC5554 [1][2]=
. This
>>>>> microcontroller is based on the e200z6 core. I could build the cross-=
development
>>>>> tools, but I could miss something because I get an error message when=
building
>>>>> Linux for PowerPC e200 core. Here are the steps I used:
>>>> I doubt you'll have much luck with the mpc5554. =A0Linux doesn't inclu=
de
>>>> any support for the MPC5554, and I don't think anybody is working on
>>>> it. =A0Any of the mpc5554 systems I've see don't have enough ram to ru=
n
>>>> Linux well.
>>> I'm ready to work a bit more than just compiling the kernel and run it =
on MPC5554.
>>> On my target system there is a possibility to use external RAM connecte=
d to the
>>> External Bus Interface, so I don't see this would be a problem in my ca=
se.
>>>
>>> However, I have not much experience running Linux on PowerPC environmen=
t. Could
>>> you suggest a PowerPC port which would be a good starting point to make=
support
>>> for MPC5554?
>>
>> I'd use the MPC5200 board support as a starting point
>> (arch/powerpc/platforms/52xx). =A0Create yourself a new directory for
>> this platform (arch/powerpc/platforms/55xx)
>>
>>> As far as I could find out I'll need to create a device tree as documen=
ted in
>>> the linux/Documentation/powerpc/booting-without-of.txt file.
>>
>> Yes, you'll need to create a device tree file for the board. =A0Again,
>> start from an existing 5200 .dts file. =A0You won't need very much in it
>> to get started. =A0I'd be happy to help you get the structure right.
>
> I tried to create a first draft of the deveice tree for MPC5554. It is
> compilable with dtc. I based this .dts file on Figure 1-1 on page 1-3 and
> Table 1-2 on page 1-21 of http://www.freescale.com/files/32bit/doc/ref_ma=
nual/MPC5553_MPC5554_RM.pdf .
>
> I'm not sure about the following points:
> 1. Where should be the on-chip FLASH described? This memory is read-only =
from
> =A0 view of software and can be used to store read-only data or execute c=
ode directly
> =A0 from there.
Hang it off the xbar node. Name it flash@<address>, and use
'compatible =3D "fsl,mpc5554-flash";'
>
> 2. Should the co-processor (eTPU in this case) also listed in section "cp=
us"
> =A0 or not? This co-processor is not able to run code like the e200z6.
No, this is a device. Hang it off the peripheral bridge a node.
> 3. There are three on-chip buses on MPC5554:
> =A0 - Crossbar Switch (XBAR)
> =A0 - Peripheral Bridge A (PBRIDGE_A)
> =A0 - Peripheral Bridge B (PBRIDGE_B)
> =A0 I used PBRIDGE_A and PRIDGE_B to create two /soc<SOCname> entries. Is=
this possible?
the soc5200 naming was poorly chosen when the 5200 device tree was
written. Use something like this:
xbar@<control-regs-base-address> {
compatible =3D "fsl,mpc5554-xbar";
#address-cells =3D <1>;
#size-cells =3D <1>;
ranges =3D <[put the translation ranges in here]>;
reg =3D <address and size of xbar control registers>;
bridge@<bridgea-base-address> {
compatible =3D "fsl,mpc5554-pbridge-a";
#address-cells =3D <1>;
#size-cells =3D <1>;
ranges =3D <[put the translation ranges in here]>;
reg =3D <address and size of bridge control registers>;
[... child device nodes ...]
};
bridge@<bridgea-base-address> {
compatible =3D "fsl,mpc5554-pbridge-b";
#address-cells =3D <1>;
#size-cells =3D <1>;
ranges =3D <[put the translation ranges in here]>;
reg =3D <address and size of bridge control registers>;
[... child device nodes ...]
};
};
The idea is to use generic names for the node names, and identify
exactly what the device is by using the "compatible" property. Also,
the aim is to build up a tree describing the interconnection of device
from the perspective of the OS on the CPU. ie. the full physical
address space is represented by the root node of the tree, and
everything else hangs off that.
> 4. There are modules which have multiple instances at different base addr=
esses. These
> =A0 are DSPI, SCI and FlexCAN. I used the same name for them but with dif=
ferent addresses.
> =A0 Is this correct?
yes.
> +/ {
> + =A0 =A0 =A0 model =3D "MPC5554";
> + =A0 =A0 =A0 compatible =3D "MPC5554";
Use the board name here in the form "<manufacturer>,<board>", not the SoC n=
ame.
> + =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 #size-cells =3D <1>;
> +
> + =A0 =A0 =A0 cpus {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #size-cells =3D <0>;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PowerPC,5554@0 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_type =3D "cpu";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 d-cache-line-size =3D <32>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 i-cache-line-size =3D <32>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 d-cache-size =3D <0x8000>; =
=A0 =A0 =A0 =A0// L1, 32KiB
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 i-cache-size =3D <0x8000>; =
=A0 =A0 =A0 =A0// L1, 32KiB
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 timebase-frequency =3D <0>;=
=A0 =A0 =A0 // from bootloader
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bus-frequency =3D <0>; =A0 =
=A0 =A0 =A0 =A0 =A0// from bootloader
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 clock-frequency =3D <0>; =
=A0 =A0 =A0 =A0 =A0// from bootloader
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 flash { // read-only FLASH
flash@0
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_type =3D "memory";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x00000000 0x200000>; =A0 =A0// 2M=
iB internal FLASH
> + =A0 =A0 =A0 };
remove device_type from this node. Only a few special nodes should
have device_type. Make the flash node a child of the xbar node.
> +
> + =A0 =A0 =A0 memory {
memory@400000000
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_type =3D "memory";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x40000000 0x10000>; =A0 =A0 // 32=
KiB internal SRAM
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 soc5554BridgeA@c0000000 {
bridge@c0000000
Make this node a child of the xbar node.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #size-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554-bridgea";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ranges =3D <0 0xc0000000 0x20000000>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0xc0000000 0x20000000>;
The reg property here should only cover the bridge's control register.
Not the whole range of the bridge.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bus-frequency =3D <0>; =A0 =A0 =A0 =A0 =A0 =
=A0// from bootloader
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 system-frequency =3D <0>; =A0 =A0 =A0 =A0 /=
/ from bootloader
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bridgea@3f00000 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-bridgea";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03f00000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fmpll@3f80000 { =A0 =A0 =A0 =A0 // Frequenc=
y Modulated PLL
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-fmpll";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03f80000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 flashconfig@3f88000 { =A0 // Flash Configur=
ation
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-flashconfig";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03f88000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 siu@3f89000 { =A0 =A0 =A0 =A0 =A0 // System=
Integration Unit
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-siu";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03f90000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 emios@3fa0000 { =A0 =A0 =A0 =A0 // Modular =
Timer System
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-emios";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03fa0000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 etpu@3fc0000 { =A0 =A0 =A0 =A0 =A0// Enhanc=
ed Time Processing Unit
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-etpu";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03fc0000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 etpudata@3fc8000 { =A0 =A0 =A0// eTPU Share=
d Data Memory (Parameter RAM)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-etpudata";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03fc8000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 etpudata@3fcc000 { =A0 =A0 =A0// eTPU Share=
d Data Memory (Parameter RAM) mirror
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-etpudata";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03fcc000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 etpucode@3fd0000 { =A0 =A0 =A0 =A0 =A0 =A0 =
=A0// eTPU Shared Code RAM
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-etpucode";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x03fd0000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 soc5554BridgeB@e0000000 {
bridge@e0000000
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #size-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554-bridgeb";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ranges =3D <0 0xe0000000 0x20000000>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0xe0000000 0x20000000>;
ditto on comment from bridge a
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bus-frequency =3D <0>; =A0 =A0 =A0 =A0 =A0 =
=A0// from bootloader
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 system-frequency =3D <0>; =A0 =A0 =A0 =A0 /=
/ from bootloader
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bridgeb@1ff00000 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-bridgeb";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff00000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 xbar@1ff04000 { =A0 =A0 =A0 =A0 // System B=
us Crossbar Switch (XBAR)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-xbar";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff04000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
The block diagram seems to suggest that the xbar should be the root of
the tree, and the peripheral bridges should be children of it.
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ecsm@1ff40000 { =A0 =A0 =A0 =A0 // Error Co=
rrection Status Module (ECSM)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-ecsm";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff40000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 edma@1ff44000 { =A0 =A0 =A0 =A0 // Enhanced=
DMA Controller (eDMA)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-edma";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff44000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 intc@1ff48000 { =A0 =A0 =A0 =A0 // Interrup=
t Controller (INTC)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-intc";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff48000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 eqadc@1ff80000 { =A0 =A0 =A0 =A0// Enhanced=
Queued Analog-to-Digital Converter (eQADC)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-eqacd";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff80000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dspi@1ff90000 { =A0 =A0 =A0 =A0 // Deserial=
Serial Peripheral Interface (DSPI_A)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-dspi";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff90000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dspi@1ff94000 { =A0 =A0 =A0 =A0 // Deserial=
Serial Peripheral Interface (DSPI_B)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-dspi";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff94000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dspi@1ff98000 { =A0 =A0 =A0 =A0 // Deserial=
Serial Peripheral Interface (DSPI_C)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-dspi";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff98000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 dspi@1ff9c000 { =A0 =A0 =A0 =A0 // Deserial=
Serial Peripheral Interface (DSPI_D)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-dspi";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ff9c000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sci@1ffb0000 { =A0 =A0 =A0 =A0 =A0// Serial=
Communications Interface (SCI_A)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-sci";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ffb0000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sci@1ffb4000 { =A0 =A0 =A0 =A0 =A0// Serial=
Communications Interface (SCI_A)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-sci";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ffb4000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 can@1ffc0000 { =A0 =A0 =A0 =A0 =A0// Contro=
ller Area Network (FlexCAN_A)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-flexcan";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ffc0000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 can@1ffc4000 { =A0 =A0 =A0 =A0 =A0// Contro=
ller Area Network (FlexCAN_B)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-flexcan";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ffc4000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 can@1ffc8000 { =A0 =A0 =A0 =A0 =A0// Contro=
ller Area Network (FlexCAN_C)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-flexcan";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1ffc8000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bam@1fffc000 { =A0 =A0 =A0 =A0 =A0// Boot A=
ssist Module (BAM)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "fsl,mpc5554=
-bam";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x1fffc000 0x4000>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 };
> +
> +};
>
>
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply
* Re: cross-compiling Linux for PowerPC e200 core?
From: Németh Márton @ 2010-03-09 7:02 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev
In-Reply-To: <fa686aa41003081108v31e73660pa817863e5aa73653@mail.gmail.com>
Hi,
Grant Likely wrote:
> 2010/3/8 Németh Márton <nm127@freemail.hu>:
>> Grant Likely wrote:
>>> 2010/3/6 Németh Márton <nm127@freemail.hu>:
>>>> Hi,
>>>>
>>>> I'm trying to cross-compile Linux 2.6.33 for Freescale MPC5554 [1][2]. This
>>>> microcontroller is based on the e200z6 core. I could build the cross-development
>>>> tools, but I could miss something because I get an error message when building
>>>> Linux for PowerPC e200 core. Here are the steps I used:
>>> I doubt you'll have much luck with the mpc5554. Linux doesn't include
>>> any support for the MPC5554, and I don't think anybody is working on
>>> it. Any of the mpc5554 systems I've see don't have enough ram to run
>>> Linux well.
>> I'm ready to work a bit more than just compiling the kernel and run it on MPC5554.
>> On my target system there is a possibility to use external RAM connected to the
>> External Bus Interface, so I don't see this would be a problem in my case.
>>
>> However, I have not much experience running Linux on PowerPC environment. Could
>> you suggest a PowerPC port which would be a good starting point to make support
>> for MPC5554?
>
> I'd use the MPC5200 board support as a starting point
> (arch/powerpc/platforms/52xx). Create yourself a new directory for
> this platform (arch/powerpc/platforms/55xx)
>
>> As far as I could find out I'll need to create a device tree as documented in
>> the linux/Documentation/powerpc/booting-without-of.txt file.
>
> Yes, you'll need to create a device tree file for the board. Again,
> start from an existing 5200 .dts file. You won't need very much in it
> to get started. I'd be happy to help you get the structure right.
I tried to create a first draft of the deveice tree for MPC5554. It is
compilable with dtc. I based this .dts file on Figure 1-1 on page 1-3 and
Table 1-2 on page 1-21 of http://www.freescale.com/files/32bit/doc/ref_manual/MPC5553_MPC5554_RM.pdf .
I'm not sure about the following points:
1. Where should be the on-chip FLASH described? This memory is read-only from
view of software and can be used to store read-only data or execute code directly
from there.
2. Should the co-processor (eTPU in this case) also listed in section "cpus"
or not? This co-processor is not able to run code like the e200z6.
3. There are three on-chip buses on MPC5554:
- Crossbar Switch (XBAR)
- Peripheral Bridge A (PBRIDGE_A)
- Peripheral Bridge B (PBRIDGE_B)
I used PBRIDGE_A and PRIDGE_B to create two /soc<SOCname> entries. Is this possible?
4. There are modules which have multiple instances at different base addresses. These
are DSPI, SCI and FlexCAN. I used the same name for them but with different addresses.
Is this correct?
Regards,
Márton Németh
---
From: Márton Németh <nm127@freemail.hu>
Add device tree for Freescale MPC5554.
Signed-off-by: Márton Németh <nm127@freemail.hu>
---
diff -uprN linux-2.6.33.orig/arch/powerpc/boot/dts/mpc5554.dts linux/arch/powerpc/boot/dts/mpc5554.dts
--- linux-2.6.33.orig/arch/powerpc/boot/dts/mpc5554.dts 1970-01-01 01:00:00.000000000 +0100
+++ linux/arch/powerpc/boot/dts/mpc5554.dts 2010-03-09 07:40:46.000000000 +0100
@@ -0,0 +1,197 @@
+/*
+ * Freescale MPC5554 Device Tree Source
+ *
+ * Based on MPC5553/5554 Microcontroller Reference Manual, Rev. 4.0, 04/2007
+ * http://www.freescale.com/files/32bit/doc/ref_manual/MPC5553_MPC5554_RM.pdf
+ *
+ * Copyright 2010 Márton Németh
+ * Márton Németh <nm127@freemail.hu>
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+/ {
+ model = "MPC5554";
+ compatible = "MPC5554";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ PowerPC,5554@0 {
+ device_type = "cpu";
+ reg = <0>;
+ d-cache-line-size = <32>;
+ i-cache-line-size = <32>;
+ d-cache-size = <0x8000>; // L1, 32KiB
+ i-cache-size = <0x8000>; // L1, 32KiB
+ timebase-frequency = <0>; // from bootloader
+ bus-frequency = <0>; // from bootloader
+ clock-frequency = <0>; // from bootloader
+ };
+ };
+
+ flash { // read-only FLASH
+ device_type = "memory";
+ reg = <0x00000000 0x200000>; // 2MiB internal FLASH
+ };
+
+ memory {
+ device_type = "memory";
+ reg = <0x40000000 0x10000>; // 32KiB internal SRAM
+ };
+
+ soc5554BridgeA@c0000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,mpc5554-bridgea";
+ ranges = <0 0xc0000000 0x20000000>;
+ reg = <0xc0000000 0x20000000>;
+ bus-frequency = <0>; // from bootloader
+ system-frequency = <0>; // from bootloader
+
+ bridgea@3f00000 {
+ compatible = "fsl,mpc5554-bridgea";
+ reg = <0x03f00000 0x4000>;
+ };
+
+ fmpll@3f80000 { // Frequency Modulated PLL
+ compatible = "fsl,mpc5554-fmpll";
+ reg = <0x03f80000 0x4000>;
+ };
+
+ flashconfig@3f88000 { // Flash Configuration
+ compatible = "fsl,mpc5554-flashconfig";
+ reg = <0x03f88000 0x4000>;
+ };
+
+ siu@3f89000 { // System Integration Unit
+ compatible = "fsl,mpc5554-siu";
+ reg = <0x03f90000 0x4000>;
+ };
+
+ emios@3fa0000 { // Modular Timer System
+ compatible = "fsl,mpc5554-emios";
+ reg = <0x03fa0000 0x4000>;
+ };
+
+ etpu@3fc0000 { // Enhanced Time Processing Unit
+ compatible = "fsl,mpc5554-etpu";
+ reg = <0x03fc0000 0x4000>;
+ };
+
+ etpudata@3fc8000 { // eTPU Shared Data Memory (Parameter RAM)
+ compatible = "fsl,mpc5554-etpudata";
+ reg = <0x03fc8000 0x4000>;
+ };
+
+ etpudata@3fcc000 { // eTPU Shared Data Memory (Parameter RAM) mirror
+ compatible = "fsl,mpc5554-etpudata";
+ reg = <0x03fcc000 0x4000>;
+ };
+
+ etpucode@3fd0000 { // eTPU Shared Code RAM
+ compatible = "fsl,mpc5554-etpucode";
+ reg = <0x03fd0000 0x4000>;
+ };
+ };
+
+ soc5554BridgeB@e0000000 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,mpc5554-bridgeb";
+ ranges = <0 0xe0000000 0x20000000>;
+ reg = <0xe0000000 0x20000000>;
+ bus-frequency = <0>; // from bootloader
+ system-frequency = <0>; // from bootloader
+
+ bridgeb@1ff00000 {
+ compatible = "fsl,mpc5554-bridgeb";
+ reg = <0x1ff00000 0x4000>;
+ };
+
+ xbar@1ff04000 { // System Bus Crossbar Switch (XBAR)
+ compatible = "fsl,mpc5554-xbar";
+ reg = <0x1ff04000 0x4000>;
+ };
+
+ ecsm@1ff40000 { // Error Correction Status Module (ECSM)
+ compatible = "fsl,mpc5554-ecsm";
+ reg = <0x1ff40000 0x4000>;
+ };
+
+ edma@1ff44000 { // Enhanced DMA Controller (eDMA)
+ compatible = "fsl,mpc5554-edma";
+ reg = <0x1ff44000 0x4000>;
+ };
+
+ intc@1ff48000 { // Interrupt Controller (INTC)
+ compatible = "fsl,mpc5554-intc";
+ reg = <0x1ff48000 0x4000>;
+ };
+
+ eqadc@1ff80000 { // Enhanced Queued Analog-to-Digital Converter (eQADC)
+ compatible = "fsl,mpc5554-eqacd";
+ reg = <0x1ff80000 0x4000>;
+ };
+
+ dspi@1ff90000 { // Deserial Serial Peripheral Interface (DSPI_A)
+ compatible = "fsl,mpc5554-dspi";
+ reg = <0x1ff90000 0x4000>;
+ };
+
+ dspi@1ff94000 { // Deserial Serial Peripheral Interface (DSPI_B)
+ compatible = "fsl,mpc5554-dspi";
+ reg = <0x1ff94000 0x4000>;
+ };
+
+ dspi@1ff98000 { // Deserial Serial Peripheral Interface (DSPI_C)
+ compatible = "fsl,mpc5554-dspi";
+ reg = <0x1ff98000 0x4000>;
+ };
+
+ dspi@1ff9c000 { // Deserial Serial Peripheral Interface (DSPI_D)
+ compatible = "fsl,mpc5554-dspi";
+ reg = <0x1ff9c000 0x4000>;
+ };
+
+ sci@1ffb0000 { // Serial Communications Interface (SCI_A)
+ compatible = "fsl,mpc5554-sci";
+ reg = <0x1ffb0000 0x4000>;
+ };
+
+ sci@1ffb4000 { // Serial Communications Interface (SCI_A)
+ compatible = "fsl,mpc5554-sci";
+ reg = <0x1ffb4000 0x4000>;
+ };
+
+ can@1ffc0000 { // Controller Area Network (FlexCAN_A)
+ compatible = "fsl,mpc5554-flexcan";
+ reg = <0x1ffc0000 0x4000>;
+ };
+
+ can@1ffc4000 { // Controller Area Network (FlexCAN_B)
+ compatible = "fsl,mpc5554-flexcan";
+ reg = <0x1ffc4000 0x4000>;
+ };
+
+ can@1ffc8000 { // Controller Area Network (FlexCAN_C)
+ compatible = "fsl,mpc5554-flexcan";
+ reg = <0x1ffc8000 0x4000>;
+ };
+
+ bam@1fffc000 { // Boot Assist Module (BAM)
+ compatible = "fsl,mpc5554-bam";
+ reg = <0x1fffc000 0x4000>;
+ };
+
+ };
+
+};
^ permalink raw reply
* Re: [PATCH 0/4] 8xx: Optimize TLB Miss code.
From: Wolfgang Denk @ 2010-03-09 6:30 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: Scott Wood, hs, linuxppc-dev
In-Reply-To: <OF1413A940.58E7B20E-ONC12576E0.003A9000-C12576E0.003ACFB7@transmode.se>
Dear Joakim Tjernlund,
In message <OF1413A940.58E7B20E-ONC12576E0.003A9000-C12576E0.003ACFB7@transmode.se> you wrote:
>
> > I use NFS.
>
> Then I think it is possible NFS gets in the way for stable measurements. Anyone
> have experience with running lmbench on NFS?
NFS may have some influence here, but I doubt it is the primary cause
for these variations. The network where Heiko is running these tests
is mostly idle, so it should provide fairly constant conditions. Of
coursem the use of the network on the MPC8xx itself will add to the
variation, but again I would not expect so big differences.
Heiko - there is a 10 GB disk attached to the "tqm8xx" system; I
think there should be a usable root file system on it, but I cannot
remember the actual state. Maybe we can use that. Please contact me
on jabber this afternoon!
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Living on Earth may be expensive, but it includes an annual free trip
around the Sun.
^ permalink raw reply
* [git pull] Please pull powerpc.git merge branch
From: Benjamin Herrenschmidt @ 2010-03-09 2:33 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linuxppc-dev list, Andrew Morton, Linux Kernel list
Hi Linus !
Ideally this should have reached you earlier last week but I was
bogged down in meetings and then away on an extended week-end.
It's mostly a few bug fixes, some trivial raw spinlock conversions,
and a couple of "features" that I didn't have in my previous merge
request for all the wrong reasons, which are the e500 perf support
and the dynamic PACA stuff from Michael.
Cheers,
Ben.
The following changes since commit 57d54889cd00db2752994b389ba714138652e60c:
Linus Torvalds (1):
Linux 2.6.34-rc1
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge
Adam Lackorzynski (1):
powerpc: Fix SMP build with disabled CPU hotplugging.
Andrea Gelmini (1):
powerpc/cpm2: Checkpatch cleanup
Anton Vorontsov (4):
powerpc/85xx: Convert socrates_fpga_pic_lock to raw_spinlock
powerpc/82xx: Convert pci_pic_lock to raw_spinlock
powerpc/qe: Convert qe_ic_lock to raw_spinlock
powerpc/86xx: Convert gef_pic_lock to raw_spinlock
Benjamin Herrenschmidt (1):
Merge commit 'kumar/next' into merge
Dave Kleikamp (2):
powerpc/booke: Fix a couple typos in the advanced ptrace code
powerpc/booke: Fix breakpoint/watchpoint one-shot behavior
Josh Boyer (1):
powerpc: Fix G5 thermal shutdown
Mark Nelson (1):
powerpc/pseries: Pass CPPR value to H_XIRR hcall
Martyn Welch (1):
powerpc/86xx: Renaming following split of GE Fanuc joint venture
Michael Ellerman (1):
powerpc: Dynamically allocate pacas
Scott Wood (2):
powerpc/perf: Build callchain code regardless of hardware event support.
powerpc/perf: e500 support
Vaidyanathan Srinivasan (3):
powerpc: Reset kernel stack on cpu online from cede state
powerpc: Move checks in pseries_mach_cpu_die()
powerpc: Reduce printk from pseries_mach_cpu_die()
arch/powerpc/boot/dts/gef_ppc9a.dts | 4 +-
arch/powerpc/boot/dts/gef_sbc310.dts | 4 +-
arch/powerpc/boot/dts/gef_sbc610.dts | 4 +-
arch/powerpc/include/asm/paca.h | 18 +-
arch/powerpc/include/asm/perf_event.h | 109 +----
arch/powerpc/include/asm/perf_event_fsl_emb.h | 50 ++
arch/powerpc/include/asm/perf_event_server.h | 110 ++++
arch/powerpc/include/asm/reg_booke.h | 4 +-
arch/powerpc/include/asm/reg_fsl_emb.h | 2 +-
arch/powerpc/kernel/Makefile | 7 +-
arch/powerpc/kernel/cputable.c | 2 +-
arch/powerpc/kernel/e500-pmu.c | 129 +++++
arch/powerpc/kernel/head_64.S | 17 +-
arch/powerpc/kernel/paca.c | 93 +++-
arch/powerpc/kernel/perf_event_fsl_emb.c | 654 +++++++++++++++++++++++
arch/powerpc/kernel/prom.c | 3 +
arch/powerpc/kernel/ptrace.c | 12 +-
arch/powerpc/kernel/setup-common.c | 3 +
arch/powerpc/kernel/setup_64.c | 12 +-
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | 10 +-
arch/powerpc/platforms/85xx/socrates_fpga_pic.c | 34 +-
arch/powerpc/platforms/86xx/Kconfig | 12 +-
arch/powerpc/platforms/86xx/gef_gpio.c | 10 +-
arch/powerpc/platforms/86xx/gef_pic.c | 20 +-
arch/powerpc/platforms/86xx/gef_ppc9a.c | 12 +-
arch/powerpc/platforms/86xx/gef_sbc310.c | 12 +-
arch/powerpc/platforms/86xx/gef_sbc610.c | 12 +-
arch/powerpc/platforms/Kconfig.cputype | 10 +
arch/powerpc/platforms/iseries/exception.S | 25 +-
arch/powerpc/platforms/pseries/hotplug-cpu.c | 42 +-
arch/powerpc/platforms/pseries/offline_states.h | 23 +-
arch/powerpc/platforms/pseries/plpar_wrappers.h | 4 +-
arch/powerpc/platforms/pseries/xics.c | 7 +-
arch/powerpc/sysdev/cpm2_pic.h | 2 +-
arch/powerpc/sysdev/qe_lib/qe_ic.c | 10 +-
drivers/macintosh/therm_pm72.c | 30 +-
drivers/macintosh/therm_pm72.h | 2 +-
37 files changed, 1250 insertions(+), 264 deletions(-)
create mode 100644 arch/powerpc/include/asm/perf_event_fsl_emb.h
create mode 100644 arch/powerpc/include/asm/perf_event_server.h
create mode 100644 arch/powerpc/kernel/e500-pmu.c
create mode 100644 arch/powerpc/kernel/perf_event_fsl_emb.c
^ permalink raw reply
* Re: [Patch 1/1] PPC64-HWBKPT: Implement hw-breakpoints for PPC64
From: K.Prasad @ 2010-03-09 2:14 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Michael Neuling, Benjamin Herrenschmidt, shaggy,
Mahesh Salgaonkar, Will Deacon, David Gibson, linuxppc-dev,
Alan Stern, paulus, Roland McGrath
In-Reply-To: <20100226015807.GF5592@nowhere>
On Fri, Feb 26, 2010 at 02:58:12AM +0100, Frederic Weisbecker wrote:
> On Mon, Feb 22, 2010 at 06:47:46PM +0530, K.Prasad wrote:
> > The 'name' field here is actually a legacy inherited from x86 code. It
> > is part of x86's arch-specific hw-breakpoint structure since:
> > - inspired by the kprobe implementation which accepts symbol name as
> > input.
> > - kallsyms_lookup_name() was 'unexported' and a module could not resolve
> > symbol names externally, so the core-infrastructure had to provide
> > such facilities.
> > - I wasn't sure about the discussions behind 'unexporting' of
> > kallsyms_lookup_name(), so did not venture to export them again (which
> > you rightfully did :-)
> >
> > Having said that, I'll be glad to remove this field (along with that in
> > x86),
>
> Cool, I'll integrate the x86 name field removal to the .24 series
>
I've removed the .name field in the latest version of the patch sent
(linuxppc-dev message-id: 20100308181232.GA3406@in.ibm.com).
> > > > +void ptrace_triggered(struct perf_event *bp, int nmi,
> > > > + struct perf_sample_data *data, struct pt_regs *regs)
> > > > +{
> > > > + struct perf_event_attr attr;
> > > > +
> > > > + /*
> > > > + * Disable the breakpoint request here since ptrace has defined a
> > > > + * one-shot behaviour for breakpoint exceptions in PPC64.
> > > > + * The SIGTRAP signal is generated automatically for us in do_dabr().
> > > > + * We don't have to do anything about that here
> > > > + */
> > >
> > >
> > > Oh, why does ptrace use a one-shot behaviour in ppc? Breakpoints
> > > only trigger once?
> > >
> >
> > Yes, ptrace breakpoints on PPC64 are designed to trigger once and this
> > patch retains that behaviour. It is very convenient to use one-shot
> > behaviour on archs where exceptions are triggered-before-execute.
>
> Ah, Why?
>
Because we don't have to create the single_step_dabr_instruction()
function :-)
With one-shot behaviour, the hw_breakpoint_handler() doesn't have to
worry about entering into an infinite-loop (since exceptions are
triggered before instruction execution, and if breakpoints are still
active every attempt to execute the causative instruction raises the
breakpoint exception). To circumvent infinite looping, we temporarily
disable the breakpoints, enable single-stepping (to single-step over
the causative instruction) and re-enable them inside single-step
exception handler. For the one-shot type breakpoint, the pain of
re-registration is left to the end-user.
I've wondered why PowerPC was designed to be 'trigger-before-execute'
when handling the exception can grow complex as this. Perhaps it is
meant to give absolute control over the data value (stored in the target
address) before the instruction gets to see it. For instance,
breakpoints can be used to change the data to a 'desirable' value before
actually being 'seen' by instructions.
Thanks,
K.Prasad
^ permalink raw reply
* Re: BUG: Bad page map in process mm2
From: Jake Magee @ 2010-03-09 1:26 UTC (permalink / raw)
To: Steven A. Falco; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <4B956CD9.9090401@harris.com>
[-- Attachment #1: Type: text/plain, Size: 2916 bytes --]
Steven,
Try these patches...
http://patchwork.ozlabs.org/patch/34047/
http://patchwork.ozlabs.org/patch/34113/
Both patches work for my situation, but I went with the second set as a
final patch(34113).
On Mon, Mar 8, 2010 at 3:32 PM, Steven A. Falco <sfalco@harris.com> wrote:
> Steven A. Falco wrote:
>
> Apologies - previous crash dump was mangled by the
> interspersed program output. Here is one showing
> just the crash dump.
>
> Interestingly, the program does produce correct output,
> as verified by dd'ing from /dev/mem to a file, then
> doing "od" on the result. So in some sense, the error
> is spurious.
>
> Steve
>
> # ./mm2 > foo 2>&1
> BUG: Bad page map in process mm2 pte:00000452 pmd:0f6c8400
> page:c0396000 flags:00000404 count:1 mapcount:-1 mapping:(null) index:0
> addr:4801f000 vm_flags:400844fb anon_vma:(null) mapping:cea78430 index:0
> vma->vm_ops->fault: 0x0
> vma->vm_file->f_op->mmap: mmap_mem+0x0/0xa4
> Call Trace:
> [cf4c5d90] [c0006cf4] show_stack+0x44/0x16c (unreliable)
> [cf4c5dd0] [c0067800] print_bad_pte+0x140/0x1cc
> [cf4c5e00] [c0068640] unmap_vmas+0x41c/0x594
> [cf4c5e80] [c006c8f0] exit_mmap+0xb8/0x150
> [cf4c5ea0] [c0020948] mmput+0x50/0xe0
> [cf4c5eb0] [c0024504] exit_mm+0xec/0x10c
> [cf4c5ee0] [c0025bd0] do_exit+0xc4/0x5d4
> [cf4c5f20] [c0026124] do_group_exit+0x44/0xa4
> [cf4c5f30] [c0026198] sys_exit_group+0x14/0x28
> [cf4c5f40] [c000edcc] ret_from_syscall+0x0/0x3c
> Disabling lock debugging due to kernel taint
> BUG: Bad page state in process mm2 pfn:00000
> page:c0396000 flags:00000404 count:0 mapcount:-1 mapping:(null) index:0
> Call Trace:
> [cf4c5d80] [c0006cf4] show_stack+0x44/0x16c (unreliable)
> [cf4c5dc0] [c00585bc] bad_page+0x94/0x12c
> [cf4c5de0] [c005d234] put_page+0x4c/0x170
> [cf4c5df0] [c0073e54] free_page_and_swap_cache+0x34/0x8c
> [cf4c5e00] [c0068490] unmap_vmas+0x26c/0x594
> [cf4c5e80] [c006c8f0] exit_mmap+0xb8/0x150
> [cf4c5ea0] [c0020948] mmput+0x50/0xe0
> [cf4c5eb0] [c0024504] exit_mm+0xec/0x10c
> [cf4c5ee0] [c0025bd0] do_exit+0xc4/0x5d4
> [cf4c5f20] [c0026124] do_group_exit+0x44/0xa4
> [cf4c5f30] [c0026198] sys_exit_group+0x14/0x28
> [cf4c5f40] [c000edcc] ret_from_syscall+0x0/0x3c
> # cat foo
> 00000000: 7c7f1b78 7c9e2378 7cbd2b78 7cdc3378
> 00000010: 7cfb3b78 480022ad 3c000002 60001032
> 00000020: 7c1b03a6 3c00c000 60002210 7c1a03a6
> 00000030: 4c000064 48000000 00000000 00000000
> # dd count=1 if=/dev/mem of=goo
> # od -X goo
> 0000000 7c7f1b78 7c9e2378 7cbd2b78 7cdc3378
> 0000020 7cfb3b78 480022ad 3c000002 60001032
> 0000040 7c1b03a6 3c00c000 60002210 7c1a03a6
> 0000060 4c000064 48000000 00000000 00000000
> 0000100
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
[-- Attachment #2: Type: text/html, Size: 3796 bytes --]
^ permalink raw reply
* Re: [Patch 1/1] PPC64-HWBKPT: Implement hw-breakpoints for PPC64
From: David Gibson @ 2010-03-08 23:57 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Michael Neuling, Benjamin Herrenschmidt, shaggy,
Mahesh Salgaonkar, Will Deacon, linuxppc-dev, Alan Stern, paulus,
K.Prasad, Roland McGrath
In-Reply-To: <20100226015807.GF5592@nowhere>
On Fri, Feb 26, 2010 at 02:58:12AM +0100, Frederic Weisbecker wrote:
> On Mon, Feb 22, 2010 at 06:47:46PM +0530, K.Prasad wrote:
[snip]
> > > Oh, why does ptrace use a one-shot behaviour in ppc? Breakpoints
> > > only trigger once?
> > >
> >
> > Yes, ptrace breakpoints on PPC64 are designed to trigger once and this
> > patch retains that behaviour. It is very convenient to use one-shot
> > behaviour on archs where exceptions are triggered-before-execute.
>
> Ah, Why?
Because otherwise you have jump through some tricky hoops so that when
gdb (or whatever) resumes after the breakpoint, you don't immediately
retrap in the same place. I gather x86 has hardware assistance to do
this, but powerpc doesn't.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* [patch] powerpc: pika_wdt ident cannot be const
From: Sean MacLennan @ 2010-03-09 0:46 UTC (permalink / raw)
To: linuxppc-dev
The watchdog_info struct cannot be a const since we dynamically fill
in the firmware version.
Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>
---
diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c
index 435ec2a..2d22e99 100644
--- a/drivers/watchdog/pika_wdt.c
+++ b/drivers/watchdog/pika_wdt.c
@@ -52,7 +52,7 @@ static struct {
struct timer_list timer; /* The timer that pings the watchdog */
} pikawdt_private;
-static const struct watchdog_info ident = {
+static struct watchdog_info ident = {
.identity = DRV_NAME,
.options = WDIOF_CARDRESET |
WDIOF_SETTIMEOUT |
^ permalink raw reply related
* Re: BUG: Bad page map in process mm2
From: Steven A. Falco @ 2010-03-08 21:32 UTC (permalink / raw)
To: linuxppc-dev@ozlabs.org
In-Reply-To: <4B956156.8010807@harris.com>
Steven A. Falco wrote:
Apologies - previous crash dump was mangled by the
interspersed program output. Here is one showing
just the crash dump.
Interestingly, the program does produce correct output,
as verified by dd'ing from /dev/mem to a file, then
doing "od" on the result. So in some sense, the error
is spurious.
Steve
# ./mm2 > foo 2>&1
BUG: Bad page map in process mm2 pte:00000452 pmd:0f6c8400
page:c0396000 flags:00000404 count:1 mapcount:-1 mapping:(null) index:0
addr:4801f000 vm_flags:400844fb anon_vma:(null) mapping:cea78430 index:0
vma->vm_ops->fault: 0x0
vma->vm_file->f_op->mmap: mmap_mem+0x0/0xa4
Call Trace:
[cf4c5d90] [c0006cf4] show_stack+0x44/0x16c (unreliable)
[cf4c5dd0] [c0067800] print_bad_pte+0x140/0x1cc
[cf4c5e00] [c0068640] unmap_vmas+0x41c/0x594
[cf4c5e80] [c006c8f0] exit_mmap+0xb8/0x150
[cf4c5ea0] [c0020948] mmput+0x50/0xe0
[cf4c5eb0] [c0024504] exit_mm+0xec/0x10c
[cf4c5ee0] [c0025bd0] do_exit+0xc4/0x5d4
[cf4c5f20] [c0026124] do_group_exit+0x44/0xa4
[cf4c5f30] [c0026198] sys_exit_group+0x14/0x28
[cf4c5f40] [c000edcc] ret_from_syscall+0x0/0x3c
Disabling lock debugging due to kernel taint
BUG: Bad page state in process mm2 pfn:00000
page:c0396000 flags:00000404 count:0 mapcount:-1 mapping:(null) index:0
Call Trace:
[cf4c5d80] [c0006cf4] show_stack+0x44/0x16c (unreliable)
[cf4c5dc0] [c00585bc] bad_page+0x94/0x12c
[cf4c5de0] [c005d234] put_page+0x4c/0x170
[cf4c5df0] [c0073e54] free_page_and_swap_cache+0x34/0x8c
[cf4c5e00] [c0068490] unmap_vmas+0x26c/0x594
[cf4c5e80] [c006c8f0] exit_mmap+0xb8/0x150
[cf4c5ea0] [c0020948] mmput+0x50/0xe0
[cf4c5eb0] [c0024504] exit_mm+0xec/0x10c
[cf4c5ee0] [c0025bd0] do_exit+0xc4/0x5d4
[cf4c5f20] [c0026124] do_group_exit+0x44/0xa4
[cf4c5f30] [c0026198] sys_exit_group+0x14/0x28
[cf4c5f40] [c000edcc] ret_from_syscall+0x0/0x3c
# cat foo
00000000: 7c7f1b78 7c9e2378 7cbd2b78 7cdc3378
00000010: 7cfb3b78 480022ad 3c000002 60001032
00000020: 7c1b03a6 3c00c000 60002210 7c1a03a6
00000030: 4c000064 48000000 00000000 00000000
# dd count=1 if=/dev/mem of=goo
# od -X goo
0000000 7c7f1b78 7c9e2378 7cbd2b78 7cdc3378
0000020 7cfb3b78 480022ad 3c000002 60001032
0000040 7c1b03a6 3c00c000 60002210 7c1a03a6
0000060 4c000064 48000000 00000000 00000000
0000100
^ permalink raw reply
* BUG: Bad page map in process mm2
From: Steven A. Falco @ 2010-03-08 20:43 UTC (permalink / raw)
To: linuxppc-dev@ozlabs.org
[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]
I've written a simple program to mmap /dev/mem (attached).
It just displays a little physical memory beginning at
address 0. I wrote this as a test case - I'm trying to
debug a user-space driver, but I wanted to post the
simplest example that illustrates the problem.
This program runs properly on a PPC440EPx, (and on an
Intel desktop), but crashes on a PPC405EX. Kernel version
on both PPC boards (sequoia and kilauea) is a fairly
vanilla 2.6.30.3.
Has anyone seen anything similar? If you have a similar
eval board, and you are willing to run the program, I'd be
very interested in your results. Finally, any suggestions
as to how to debug this would be appreciated! I'm not sure
yet how to interpret the dump:
BUG: Bad page map in process mm2 pte:00000452 pmd:0f6ba400
78 7c9e2378 7cbdpage:c0396000 flags:00000404 count:1 mapcount:-1 mapping:(null) index:0
2b78 7cdc3378
addr:4801f000 vm_flags:400844fb anon_vma:(null) mapping:ce399430 index:0
00000010: 7cfb3bvma->vm_ops->fault: 0x0
78 480022ad 3c00vma->vm_file->f_op->mmap: mmap_mem+0x0/0xa4
0002 60001032
Call Trace:
00000020: 7c1b03[cf4c5d90] [c0006cf4] show_stack+0x44/0x16ca6 3c00c000 6000 (unreliable)2210 7c1a03a6
00000030: 4c0000[cf4c5dd0] [c0067800] print_bad_pte+0x140/0x1cc64 48000000 0000
0000 00000000
[cf4c5e00] [c0068640] unmap_vmas+0x41c/0x594
[cf4c5e80] [c006c8f0] exit_mmap+0xb8/0x150
[cf4c5ea0] [c0020948] mmput+0x50/0xe0
[cf4c5eb0] [c0024504] exit_mm+0xec/0x10c
[cf4c5ee0] [c0025bd0] do_exit+0xc4/0x5d4
[cf4c5f20] [c0026124] do_group_exit+0x44/0xa4
[cf4c5f30] [c0026198] sys_exit_group+0x14/0x28
[cf4c5f40] [c000edcc] ret_from_syscall+0x0/0x3c
Disabling lock debugging due to kernel taint
BUG: Bad page state in process mm2 pfn:00000
page:c0396000 flags:00000404 count:0 mapcount:-1 mapping:(null) index:0
Call Trace:
[cf4c5d80] [c0006cf4] show_stack+0x44/0x16c (unreliable)
[cf4c5dc0] [c00585bc] bad_page+0x94/0x12c
[cf4c5de0] [c005d234] put_page+0x4c/0x170
[cf4c5df0] [c0073e54] free_page_and_swap_cache+0x34/0x8c
[cf4c5e00] [c0068490] unmap_vmas+0x26c/0x594
[cf4c5e80] [c006c8f0] exit_mmap+0xb8/0x150
[cf4c5ea0] [c0020948] mmput+0x50/0xe0
[cf4c5eb0] [c0024504] exit_mm+0xec/0x10c
[cf4c5ee0] [c0025bd0] do_exit+0xc4/0x5d4
[cf4c5f20] [c0026124] do_group_exit+0x44/0xa4
[cf4c5f30] [c0026198] sys_exit_group+0x14/0x28
[cf4c5f40] [c000edcc] ret_from_syscall+0x0/0x3c
[-- Attachment #2: mm2.c --]
[-- Type: text/x-csrc, Size: 1554 bytes --]
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#define MAP_SIZE 4096UL
#define MAP_MASK (MAP_SIZE - 1)
#define DEV_MEM "/dev/mem"
static unsigned long addr = 0;
static unsigned long len = 0x10;
int main()
{
int ii;
int fd;
unsigned long paddr = 0;
unsigned long offset;
unsigned long *map_lbase;
if(getpagesize() != MAP_SIZE) {
fprintf(stderr, "Incorrect page size\n");
exit(1);
}
if((fd = open(DEV_MEM, O_RDWR | O_SYNC)) == -1) {
fprintf(stderr, "cannot open %s - are you root?\n", DEV_MEM);
exit(1);
}
// Calculate the page number, and the offset within the page.
paddr = addr & ~MAP_MASK;
offset = addr & MAP_MASK;
// Map that page.
map_lbase = (unsigned long *)mmap(NULL, MAP_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, paddr);
if((long)map_lbase == -1) {
perror("cannot mmap");
exit(1);
}
// Get a pointer to the offset within the page.
map_lbase += offset / 4;
// Dump the requested bytes.
for(ii = 0; ii < len; ii++) {
if(ii % 4 == 0) {
printf("%08lx: ", addr + (ii * sizeof(unsigned long)));
}
printf("%08lx ", map_lbase[ii]);
if(ii % 4 == 3) {
printf("\n");
}
}
if((ii % 4) != 0) {
printf("\n");
}
exit(0);
}
/*
* Local Variables:
* mode: c
* tab-width: 8
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*
* vim:ts=8:sw=4:sts=4
*/
^ permalink raw reply
* Re: cross-compiling Linux for PowerPC e200 core?
From: Segher Boessenkool @ 2010-03-08 20:41 UTC (permalink / raw)
To: Németh Márton; +Cc: linuxppc-dev Development
In-Reply-To: <4B9546CD.1000008@freemail.hu>
>>> Assembler messages:
>>> Error: invalid switch -me200
>>> Error: unrecognized option -me200
>>
>> No version of mainline binutils supports this.
>>
>> This kernel code was added in 2005, in 33d9e9b, by FSL; perhaps
>> they have a fork of binutils that supports it, maybe they forgot
>> to submit the changes upstream?
>
> I'm a bit new on the topic, could you please describe what FSL means?
Freescale
> I'm also having problems finding the commit 33d9e9b in the git repository
> at http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git .
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=33d9e9b
There is no obvious way to get there via clicking afaics, the "commit"
search box doesn't work at least. Hrm.
Segher
^ permalink raw reply
* Re: [RFC] powerpc: add support for new hcall H_BEST_ENERGY
From: Dipankar Sarma @ 2010-03-08 19:28 UTC (permalink / raw)
To: Vaidyanathan Srinivasan; +Cc: Paul Mackerras, Anton Blanchard, linuxppc-dev
In-Reply-To: <20100308065006.GA6281@dirshya.in.ibm.com>
On Mon, Mar 08, 2010 at 12:20:06PM +0530, Vaidyanathan Srinivasan wrote:
> * Dipankar Sarma <dipankar@in.ibm.com> [2010-03-06 00:48:11]:
>
> > Shouldn't we create this only for supported platforms ?
>
> Hi Dipankar,
>
> Yes we will need a check like
> firmware_has_feature(FW_FEATURE_BEST_ENERGY) to avoid sysfs files in
> unsupported platforms. I will add that check in the next iteration.
Also, given that this module isn't likely to provide anything on
older platforms, it should get loaded only on newer platforms.
Thanks
Dipankar
^ 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