* Re: [PATCH RFC V2 3/5] kvm hypervisor : Add two hypercalls to support pv-ticketlock
From: Raghavendra K T @ 2011-10-24 11:20 UTC (permalink / raw)
To: Avi Kivity
Cc: Raghavendra K T, Greg Kroah-Hartman, H. Peter Anvin, Gleb Natapov,
Virtualization, Jeremy Fitzhardinge, x86, KVM, Dave Jiang,
Thomas Gleixner, Stefano Stabellini, Xen, Sedat Dilek, Yinghai Lu,
Marcelo Tosatti, Ingo Molnar, Rik van Riel, Konrad Rzeszutek Wilk,
LKML, Suzuki Poulose, Srivatsa Vaddagiri, Peter Zijlstra
In-Reply-To: <4EA53A7D.300@redhat.com>
On 10/24/2011 03:44 PM, Avi Kivity wrote:
> On 10/23/2011 09:05 PM, Raghavendra K T wrote:
>> Add two hypercalls to KVM hypervisor to support pv-ticketlocks.
>> +
>> +end_wait:
>> + finish_wait(&vcpu->wq,&wait);
>> +}
>
> This hypercall can be replaced by a HLT instruction, no?
>
> I'm pretty sure this misses a lot of stuff from kvm_vcpu_block().
Yes.. agree. HLT sounds better idea. 'll try this out.
>
>> + if (vcpu) {
>> + vcpu->kicked = 1;
>
> Need to use smp memory barriers here.
Agree.
>
>> + wake_up_interruptible(&vcpu->wq);
>> + }
>> +}
>> +
>> int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
>> {
>> unsigned long nr, a0, a1, a2, a3, ret;
>>
>
^ permalink raw reply
* [PATCH 1/3] NFSD: Added fault injection
From: bjschuma @ 2011-10-24 11:20 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Bryan Schumaker
From: Bryan Schumaker <bjschuma@netapp.com>
Fault injection on the NFS server makes it easier to test the client's
state manager and recovery threads. Simulating errors on the server is
easier than finding the right conditions that cause them naturally.
This patch uses debugfs to add a simple framework for fault injection to
the server. This framework is a config option, and can be enabled
through CONFIG_NFSD_FAULT_INJECTION. Assuming you have debugfs mounted
to /sys/debug, a set of files will be created in /sys/debug/nfsd/.
Writing to any of these files will cause the corresponding action and
write a log entry to dmesg.
Changes in v5:
- Fill out inject_ops[] array without a macro
- Simplify debug messages and file creation
Changes in v4:
- Move fault injection function declarations to a new .h file
- Use the Makefile to selectively compile fault_injection.c
- Add copyright notices to top of files
Changes in v3:
- Code cleanup and better use of generic functions
- Allow the user to input the number of state objects to delete
- Remove "forget_everything()" since forgetting a client is basically
the same thing
Changes in v2:
- Replaced "forget all state owners" with "forget all open owners"
- Include fs/nfsd/fault_inject.c in the patch
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
---
fs/nfsd/Kconfig | 10 ++++
fs/nfsd/Makefile | 1 +
fs/nfsd/fault_inject.c | 90 +++++++++++++++++++++++++++++++++++++
fs/nfsd/fault_inject.h | 28 ++++++++++++
fs/nfsd/nfs4state.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++
fs/nfsd/nfsctl.c | 7 +++
6 files changed, 251 insertions(+), 0 deletions(-)
create mode 100644 fs/nfsd/fault_inject.c
create mode 100644 fs/nfsd/fault_inject.h
diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig
index 10e6366..8df1ea4 100644
--- a/fs/nfsd/Kconfig
+++ b/fs/nfsd/Kconfig
@@ -80,3 +80,13 @@ config NFSD_V4
available from http://linux-nfs.org/.
If unsure, say N.
+
+config NFSD_FAULT_INJECTION
+ bool "NFS server manual fault injection"
+ depends on NFSD_V4 && DEBUG_KERNEL
+ help
+ This option enables support for manually injecting faults
+ into the NFS server. This is intended to be used for
+ testing error recovery on the NFS client.
+
+ If unsure, say N.
diff --git a/fs/nfsd/Makefile b/fs/nfsd/Makefile
index 9b118ee..af32ef0 100644
--- a/fs/nfsd/Makefile
+++ b/fs/nfsd/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_NFSD) += nfsd.o
nfsd-y := nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
export.o auth.o lockd.o nfscache.o nfsxdr.o stats.o
+nfsd-$(CONFIG_NFSD_FAULT_INJECTION) += fault_inject.o
nfsd-$(CONFIG_NFSD_V2_ACL) += nfs2acl.o
nfsd-$(CONFIG_NFSD_V3) += nfs3proc.o nfs3xdr.o
nfsd-$(CONFIG_NFSD_V3_ACL) += nfs3acl.o
diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c
new file mode 100644
index 0000000..1ac4134
--- /dev/null
+++ b/fs/nfsd/fault_inject.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2011 Bryan Schumaker <bjschuma@netapp.com>
+ *
+ * Uses debugfs to create fault injection points for client testing
+ */
+
+#include <linux/types.h>
+#include <linux/fs.h>
+#include <linux/debugfs.h>
+#include <linux/module.h>
+
+#include "state.h"
+#include "fault_inject.h"
+
+struct nfsd_fault_inject_op {
+ char *file;
+ void (*func)(u64);
+};
+
+static struct nfsd_fault_inject_op inject_ops[] = {
+ {
+ .file = "forget_clients",
+ .func = nfsd_forget_clients,
+ },
+ {
+ .file = "forget_locks",
+ .func = nfsd_forget_locks,
+ },
+ {
+ .file = "forget_openowners",
+ .func = nfsd_forget_openowners,
+ },
+ {
+ .file = "forget_delegations",
+ .func = nfsd_forget_delegations,
+ },
+ {
+ .file = "recall_delegations",
+ .func = nfsd_recall_delegations,
+ },
+};
+
+static long int NUM_INJECT_OPS = sizeof(inject_ops) / sizeof(struct nfsd_fault_inject_op);
+static struct dentry *debug_dir;
+
+static int nfsd_inject_set(void *op_ptr, u64 val)
+{
+ struct nfsd_fault_inject_op *op = op_ptr;
+
+ if (val == 0)
+ printk(KERN_INFO "NFSD Fault Injection: %s (all)", op->file);
+ else
+ printk(KERN_INFO "NFSD Fault Injection: %s (n = %llu)", op->file, val);
+
+ op->func(val);
+ return 0;
+}
+
+static int nfsd_inject_get(void *data, u64 *val)
+{
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(fops_nfsd, nfsd_inject_get, nfsd_inject_set, "%llu\n");
+
+void nfsd_fault_inject_cleanup(void)
+{
+ debugfs_remove_recursive(debug_dir);
+}
+
+int nfsd_fault_inject_init(void)
+{
+ unsigned int i;
+ struct nfsd_fault_inject_op *op;
+ mode_t mode = S_IFREG | S_IRUSR | S_IWUSR;
+
+ debug_dir = debugfs_create_dir("nfsd", NULL);
+ if (!debug_dir)
+ goto fail;
+
+ for (i = 0; i < NUM_INJECT_OPS; i++) {
+ op = &inject_ops[i];
+ debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd);
+ }
+ return 0;
+
+fail:
+ nfsd_fault_inject_cleanup();
+ return -ENOMEM;
+}
diff --git a/fs/nfsd/fault_inject.h b/fs/nfsd/fault_inject.h
new file mode 100644
index 0000000..90bd057
--- /dev/null
+++ b/fs/nfsd/fault_inject.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011 Bryan Schumaker <bjschuma@netapp.com>
+ *
+ * Function definitions for fault injection
+ */
+
+#ifndef LINUX_NFSD_FAULT_INJECT_H
+#define LINUX_NFSD_FAULT_INJECT_H
+
+#ifdef CONFIG_NFSD_FAULT_INJECTION
+int nfsd_fault_inject_init(void);
+void nfsd_fault_inject_cleanup(void);
+void nfsd_forget_clients(u64);
+void nfsd_forget_locks(u64);
+void nfsd_forget_openowners(u64);
+void nfsd_forget_delegations(u64);
+void nfsd_recall_delegations(u64);
+#else /* CONFIG_NFSD_FAULT_INJECTION */
+static inline int nfsd_fault_inject_init(void) { return 0; }
+static inline void nfsd_fault_inject_cleanup(void) {}
+static inline void nfsd_forget_clients(u64 num) {}
+static inline void nfsd_forget_locks(u64 num) {}
+static inline void nfsd_forget_openowners(u64 num) {}
+static inline void nfsd_forget_delegations(u64 num) {}
+static inline void nfsd_recall_delegations(u64 num) {}
+#endif /* CONFIG_NFSD_FAULT_INJECTION */
+
+#endif /* LINUX_NFSD_FAULT_INJECT_H */
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 05f4c69..64fa6b0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4358,6 +4358,121 @@ nfs4_check_open_reclaim(clientid_t *clid)
return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad;
}
+#ifdef CONFIG_NFSD_FAULT_INJECTION
+
+void nfsd_forget_clients(u64 num)
+{
+ struct nfs4_client *clp, *next;
+ int count = 0;
+
+ nfs4_lock_state();
+ list_for_each_entry_safe(clp, next, &client_lru, cl_lru) {
+ nfsd4_remove_clid_dir(clp);
+ expire_client(clp);
+ if (++count == num)
+ break;
+ }
+ nfs4_unlock_state();
+
+ printk(KERN_INFO "NFSD: Forgot %d clients", count);
+}
+
+static void release_lockowner_sop(struct nfs4_stateowner *sop)
+{
+ release_lockowner(lockowner(sop));
+}
+
+static void release_openowner_sop(struct nfs4_stateowner *sop)
+{
+ release_openowner(openowner(sop));
+}
+
+static int nfsd_release_n_owners(u64 num,
+ struct list_head hashtbl[],
+ unsigned int hashtbl_size,
+ void (*release_sop)(struct nfs4_stateowner *))
+{
+ int i, count = 0;
+ struct nfs4_stateowner *sop, *next;
+
+ for (i = 0; i < hashtbl_size; i++) {
+ list_for_each_entry_safe(sop, next, &hashtbl[i], so_strhash) {
+ release_sop(sop);
+ if (++count == num)
+ return count;
+ }
+ }
+ return count;
+}
+
+void nfsd_forget_locks(u64 num)
+{
+ int count;
+
+ nfs4_lock_state();
+ count = nfsd_release_n_owners(num, lock_ownerstr_hashtbl,
+ LOCK_HASH_SIZE, release_lockowner_sop);
+ nfs4_unlock_state();
+
+ printk(KERN_INFO "NFSD: Forgot %d locks", count);
+}
+
+void nfsd_forget_openowners(u64 num)
+{
+ int count;
+
+ nfs4_lock_state();
+ count = nfsd_release_n_owners(num, open_ownerstr_hashtbl,
+ OPEN_OWNER_HASH_SIZE, release_openowner_sop);
+ nfs4_unlock_state();
+
+ printk(KERN_INFO "NFSD: Forgot %d open owners", count);
+}
+
+int nfsd_process_n_delegations(u64 num, void (*deleg_func)(struct nfs4_delegation *))
+{
+ int i, count = 0;
+ struct nfs4_file *fp;
+ struct nfs4_delegation *dp, *next;
+
+ for (i = 0; i < FILE_HASH_SIZE; i++) {
+ list_for_each_entry(fp, &file_hashtbl[i], fi_hash) {
+ list_for_each_entry_safe(dp, next, &fp->fi_delegations, dl_perfile) {
+ deleg_func(dp);
+ if (++count == num)
+ return count;
+ }
+ }
+ }
+ return count;
+}
+
+void nfsd_forget_delegations(u64 num)
+{
+ unsigned int count;
+
+ nfs4_lock_state();
+ count = nfsd_process_n_delegations(num, unhash_delegation);
+ nfs4_unlock_state();
+
+ printk(KERN_INFO "NFSD: Forgot %d delegations", count);
+}
+
+void nfsd_recall_delegations(u64 num)
+{
+ unsigned int count;
+
+ nfs4_lock_state();
+ spin_lock(&recall_lock);
+ count = nfsd_process_n_delegations(num, nfsd_break_one_deleg);
+ spin_unlock(&recall_lock);
+ nfs4_unlock_state();
+
+ printk(KERN_INFO "NFSD: Recalled %d delegations", count);
+}
+
+#endif /* CONFIG_NFSD_FAULT_INJECTION */
+
/* initialization to perform at module load time: */
int
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index db34a58..e67f30c 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -17,6 +17,7 @@
#include "idmap.h"
#include "nfsd.h"
#include "cache.h"
+#include "fault_inject.h"
/*
* We have a single directory with several nodes in it.
@@ -1130,6 +1131,9 @@ static int __init init_nfsd(void)
retval = nfs4_state_init(); /* nfs4 locking state */
if (retval)
return retval;
+ retval = nfsd_fault_inject_init(); /* nfsd fault injection controls */
+ if (retval)
+ goto out_cleanup_fault_injection;
nfsd_stat_init(); /* Statistics */
retval = nfsd_reply_cache_init();
if (retval)
@@ -1161,6 +1165,8 @@ out_free_cache:
out_free_stat:
nfsd_stat_shutdown();
nfsd4_free_slabs();
+out_cleanup_fault_injection:
+ nfsd_fault_inject_cleanup();
return retval;
}
@@ -1174,6 +1180,7 @@ static void __exit exit_nfsd(void)
nfsd_lockd_shutdown();
nfsd_idmap_shutdown();
nfsd4_free_slabs();
+ nfsd_fault_inject_cleanup();
unregister_filesystem(&nfsd_fs_type);
}
--
1.7.7
^ permalink raw reply related
* [PATCH 2/3] NFSD: Added fault injection script
From: bjschuma @ 2011-10-24 11:20 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Bryan Schumaker
In-Reply-To: <1319455259-3136-1-git-send-email-bjschuma@netapp.com>
From: Bryan Schumaker <bjschuma@netapp.com>
This script provides a convenient way to use the NFSD fault injection
framework. Fault injection writes to dmesg using the KERN_INFO flag, so
this script will compare the before and after output of `dmesg` to show
the user what happened
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
---
tools/nfsd/inject_fault.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
create mode 100755 tools/nfsd/inject_fault.sh
diff --git a/tools/nfsd/inject_fault.sh b/tools/nfsd/inject_fault.sh
new file mode 100755
index 0000000..06a399a
--- /dev/null
+++ b/tools/nfsd/inject_fault.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Copyright (c) 2011 Bryan Schumaker <bjschuma@netapp.com>
+#
+# Script for easier NFSD fault injection
+
+# Check that debugfs has been mounted
+DEBUGFS=`cat /proc/mounts | grep debugfs`
+if [ "$DEBUGFS" == "" ]; then
+ echo "debugfs does not appear to be mounted!"
+ echo "Please mount debugfs and try again"
+ exit 1
+fi
+
+# Check that the fault injection directory exists
+DEBUGDIR=`echo $DEBUGFS | awk '{print $2}'`/nfsd
+if [ ! -d "$DEBUGDIR" ]; then
+ echo "$DEBUGDIR does not exist"
+ echo "Check that your .config selects CONFIG_NFSD_FAULT_INJECTION"
+ exit 1
+fi
+
+function help()
+{
+ echo "Usage $0 injection_type [count]"
+ echo ""
+ echo "Injection types are:"
+ ls $DEBUGDIR
+ exit 1
+}
+
+if [ $# == 0 ]; then
+ help
+elif [ ! -f $DEBUGDIR/$1 ]; then
+ help
+elif [ $# != 2 ]; then
+ COUNT=0
+else
+ COUNT=$2
+fi
+
+BEFORE=`mktemp`
+AFTER=`mktemp`
+dmesg > $BEFORE
+echo $COUNT > $DEBUGDIR/$1
+dmesg > $AFTER
+# Capture lines that only exist in the $AFTER file
+diff $BEFORE $AFTER | grep ">"
+rm -f $BEFORE $AFTER
--
1.7.7
^ permalink raw reply related
* [PATCH 3/3] NFSD: Added fault injection documentation
From: bjschuma @ 2011-10-24 11:20 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs, Bryan Schumaker
In-Reply-To: <1319455259-3136-1-git-send-email-bjschuma@netapp.com>
From: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
---
Documentation/filesystems/nfs/00-INDEX | 2 +
Documentation/filesystems/nfs/fault_injection.txt | 69 +++++++++++++++++++++
2 files changed, 71 insertions(+), 0 deletions(-)
create mode 100644 Documentation/filesystems/nfs/fault_injection.txt
diff --git a/Documentation/filesystems/nfs/00-INDEX b/Documentation/filesystems/nfs/00-INDEX
index a57e124..1716874 100644
--- a/Documentation/filesystems/nfs/00-INDEX
+++ b/Documentation/filesystems/nfs/00-INDEX
@@ -2,6 +2,8 @@
- this file (nfs-related documentation).
Exporting
- explanation of how to make filesystems exportable.
+fault_injection.txt
+ - information for using fault injection on the server
knfsd-stats.txt
- statistics which the NFS server makes available to user space.
nfs.txt
diff --git a/Documentation/filesystems/nfs/fault_injection.txt b/Documentation/filesystems/nfs/fault_injection.txt
new file mode 100644
index 0000000..426d166
--- /dev/null
+++ b/Documentation/filesystems/nfs/fault_injection.txt
@@ -0,0 +1,69 @@
+
+Fault Injection
+===============
+Fault injection is a method for forcing errors that may not normally occur, or
+may be difficult to reproduce. Forcing these errors in a controlled environment
+can help the developer find and fix bugs before their code is shipped in a
+production system. Injecting an error on the Linux NFS server will allow us to
+observe how the client reacts and if it manages to recover its state correctly.
+
+NFSD_FAULT_INJECTION must be selected when configuring the kernel to use this
+feature.
+
+
+Using Fault Injection
+=====================
+On the client, mount the fault injection server through NFS v4.0+ and do some
+work over NFS (open files, take locks, ...).
+
+On the server, mount the debugfs filesystem to <debug_dir> and ls
+<debug_dir>/nfsd. This will show a list of files that will be used for
+injecting faults on the NFS server. As root, write a number n to the file
+corresponding to the action you want the server to take. The server will then
+process the first n items it finds. So if you want to forget 5 locks, echo '5'
+to <debug_dir>/nfsd/forget_locks. A value of 0 will tell the server to forget
+all corresponding items. A log message will be created containing the number
+of items forgotten (check dmesg).
+
+Go back to work on the client and check if the client recovered from the error
+correctly.
+
+
+Available Faults
+================
+forget_clients:
+ The NFS server keeps a list of clients that have placed a mount call. If
+ this list is cleared, the server will have no knowledge of who the client
+ is, forcing the client to reauthenticate with the server.
+
+forget_openowners:
+ The NFS server keeps a list of what files are currently opened and who
+ they were opened by. Clearing this list will force the client to reopen
+ its files.
+
+forget_locks:
+ The NFS server keeps a list of what files are currently locked in the VFS.
+ Clearing this list will force the client to reclaim its locks (files are
+ unlocked through the VFS as they are cleared from this list).
+
+forget_delegations:
+ A delegation is used to assure the client that a file, or part of a file,
+ has not changed since the delegation was awarded. Clearing this list will
+ force the client to reaquire its delegation before accessing the file
+ again.
+
+recall_delegations:
+ Delegations can be recalled by the server when another client attempts to
+ access a file. This test will notify the client that its delegation has
+ been revoked, forcing the client to reaquire the delegation before using
+ the file again.
+
+
+tools/nfs/inject_faults.sh script
+=================================
+This script has been created to ease the fault injection process. This script
+will detect the mounted debugfs directory and write to the files located there
+based on the arguments passed by the user. For example, running
+`inject_faults.sh forget_locks 1` as root will instruct the server to forget
+one lock. Running `inject_faults forget_locks` will instruct the server to
+forgetall locks.
--
1.7.7
^ permalink raw reply related
* [U-Boot] [PATCH 0/3] M28 USB Support
From: Marek Vasut @ 2011-10-24 11:21 UTC (permalink / raw)
To: u-boot
This set of patches enables the EHCI USB host support in the iMX28 CPU and
enables the port on the M28EVK board.
Marek Vasut (3):
iMX28: Add USB and USB PHY register definitions
iMX28: Add USB HOST driver
M28EVK: Enable USB HOST support
arch/arm/include/asm/arch-mx28/regs-usb.h | 178 ++++++++++++++++++++++++++
arch/arm/include/asm/arch-mx28/regs-usbphy.h | 151 ++++++++++++++++++++++
board/denx/m28evk/m28evk.c | 7 +
drivers/usb/host/Makefile | 1 +
drivers/usb/host/ehci-mxs.c | 154 ++++++++++++++++++++++
include/configs/m28evk.h | 12 ++
6 files changed, 503 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/include/asm/arch-mx28/regs-usb.h
create mode 100644 arch/arm/include/asm/arch-mx28/regs-usbphy.h
create mode 100644 drivers/usb/host/ehci-mxs.c
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
--
1.7.6.3
^ permalink raw reply
* [U-Boot] [PATCH 1/3] iMX28: Add USB and USB PHY register definitions
From: Marek Vasut @ 2011-10-24 11:21 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1319455296-15996-1-git-send-email-marek.vasut@gmail.com>
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
---
arch/arm/include/asm/arch-mx28/regs-usb.h | 178 ++++++++++++++++++++++++++
arch/arm/include/asm/arch-mx28/regs-usbphy.h | 151 ++++++++++++++++++++++
2 files changed, 329 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/include/asm/arch-mx28/regs-usb.h
create mode 100644 arch/arm/include/asm/arch-mx28/regs-usbphy.h
diff --git a/arch/arm/include/asm/arch-mx28/regs-usb.h b/arch/arm/include/asm/arch-mx28/regs-usb.h
new file mode 100644
index 0000000..ea61de8
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx28/regs-usb.h
@@ -0,0 +1,178 @@
+/*
+ * Freescale i.MX28 USB OTG Register Definitions
+ *
+ * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __REGS_USB_H__
+#define __REGS_USB_H__
+
+struct mx28_usb_regs {
+ uint32_t hw_usbctrl_id; /* 0x000 */
+ uint32_t hw_usbctrl_hwgeneral; /* 0x004 */
+ uint32_t hw_usbctrl_hwhost; /* 0x008 */
+ uint32_t hw_usbctrl_hwdevice; /* 0x00c */
+ uint32_t hw_usbctrl_hwtxbuf; /* 0x010 */
+ uint32_t hw_usbctrl_hwrxbuf; /* 0x014 */
+
+ uint32_t reserved1[26];
+
+ uint32_t hw_usbctrl_gptimer0ld; /* 0x080 */
+ uint32_t hw_usbctrl_gptimer0ctrl; /* 0x084 */
+ uint32_t hw_usbctrl_gptimer1ld; /* 0x088 */
+ uint32_t hw_usbctrl_gptimer1ctrl; /* 0x08c */
+ uint32_t hw_usbctrl_sbuscfg; /* 0x090 */
+
+ uint32_t reserved2[27];
+
+ uint32_t hw_usbctrl_caplength; /* 0x100 */
+ uint32_t hw_usbctrl_hcsparams; /* 0x104 */
+ uint32_t hw_usbctrl_hccparams; /* 0x108 */
+
+ uint32_t reserved3[5];
+
+ uint32_t hw_usbctrl_dciversion; /* 0x120 */
+ uint32_t hw_usbctrl_dccparams; /* 0x124 */
+
+ uint32_t reserved4[6];
+
+ uint32_t hw_usbctrl_usbcmd; /* 0x140 */
+ uint32_t hw_usbctrl_usbsts; /* 0x144 */
+ uint32_t hw_usbctrl_usbintr; /* 0x148 */
+ uint32_t hw_usbctrl_frindex; /* 0x14c */
+
+ uint32_t reserved5;
+
+ union {
+ uint32_t hw_usbctrl_periodiclistbase; /* 0x154 */
+ uint32_t hw_usbctrl_deviceaddr; /* 0x154 */
+ };
+ union {
+ uint32_t hw_usbctrl_asynclistaddr; /* 0x158 */
+ uint32_t hw_usbctrl_endpointlistaddr; /* 0x158 */
+ };
+
+ uint32_t hw_usbctrl_ttctrl; /* 0x15c */
+ uint32_t hw_usbctrl_burstsize; /* 0x160 */
+ uint32_t hw_usbctrl_txfilltuning; /* 0x164 */
+
+ uint32_t reserved6;
+
+ uint32_t hw_usbctrl_ic_usb; /* 0x16c */
+ uint32_t hw_usbctrl_ulpi; /* 0x170 */
+
+ uint32_t reserved7;
+
+ uint32_t hw_usbctrl_endptnak; /* 0x178 */
+ uint32_t hw_usbctrl_endptnaken; /* 0x17c */
+
+ uint32_t reserved8;
+
+ uint32_t hw_usbctrl_portsc1; /* 0x184 */
+
+ uint32_t reserved9[7];
+
+ uint32_t hw_usbctrl_otgsc; /* 0x1a4 */
+ uint32_t hw_usbctrl_usbmode; /* 0x1a8 */
+ uint32_t hw_usbctrl_endptsetupstat; /* 0x1ac */
+ uint32_t hw_usbctrl_endptprime; /* 0x1b0 */
+ uint32_t hw_usbctrl_endptflush; /* 0x1b4 */
+ uint32_t hw_usbctrl_endptstat; /* 0x1b8 */
+ uint32_t hw_usbctrl_endptcomplete; /* 0x1bc */
+ uint32_t hw_usbctrl_endptctrl0; /* 0x1c0 */
+ uint32_t hw_usbctrl_endptctrl1; /* 0x1c4 */
+ uint32_t hw_usbctrl_endptctrl2; /* 0x1c8 */
+ uint32_t hw_usbctrl_endptctrl3; /* 0x1cc */
+ uint32_t hw_usbctrl_endptctrl4; /* 0x1d0 */
+ uint32_t hw_usbctrl_endptctrl5; /* 0x1d4 */
+ uint32_t hw_usbctrl_endptctrl6; /* 0x1d8 */
+ uint32_t hw_usbctrl_endptctrl7; /* 0x1dc */
+};
+
+#define CLKCTRL_PLL0CTRL0_LFR_SEL_MASK (0x3 << 28)
+
+#define HW_USBCTRL_ID_CIVERSION_OFFSET 29
+#define HW_USBCTRL_ID_CIVERSION_MASK (0x7 << 29)
+#define HW_USBCTRL_ID_VERSION_OFFSET 25
+#define HW_USBCTRL_ID_VERSION_MASK (0xf << 25)
+#define HW_USBCTRL_ID_REVISION_OFFSET 21
+#define HW_USBCTRL_ID_REVISION_MASK (0xf << 21)
+#define HW_USBCTRL_ID_TAG_OFFSET 16
+#define HW_USBCTRL_ID_TAG_MASK (0x1f << 16)
+#define HW_USBCTRL_ID_NID_OFFSET 8
+#define HW_USBCTRL_ID_NID_MASK (0x3f << 8)
+#define HW_USBCTRL_ID_ID_OFFSET 0
+#define HW_USBCTRL_ID_ID_MASK (0x3f << 0)
+
+#define HW_USBCTRL_HWGENERAL_SM_OFFSET 9
+#define HW_USBCTRL_HWGENERAL_SM_MASK (0x3 << 9)
+#define HW_USBCTRL_HWGENERAL_PHYM_OFFSET 6
+#define HW_USBCTRL_HWGENERAL_PHYM_MASK (0x7 << 6)
+#define HW_USBCTRL_HWGENERAL_PHYW_OFFSET 4
+#define HW_USBCTRL_HWGENERAL_PHYW_MASK (0x3 << 4)
+#define HW_USBCTRL_HWGENERAL_BWT (1 << 3)
+#define HW_USBCTRL_HWGENERAL_CLKC_OFFSET 1
+#define HW_USBCTRL_HWGENERAL_CLKC_MASK (0x3 << 1)
+#define HW_USBCTRL_HWGENERAL_RT (1 << 0)
+
+#define HW_USBCTRL_HWHOST_TTPER_OFFSET 24
+#define HW_USBCTRL_HWHOST_TTPER_MASK (0xff << 24)
+#define HW_USBCTRL_HWHOST_TTASY_OFFSET 16
+#define HW_USBCTRL_HWHOST_TTASY_MASK (0xff << 19)
+#define HW_USBCTRL_HWHOST_NPORT_OFFSET 1
+#define HW_USBCTRL_HWHOST_NPORT_MASK (0x7 << 1)
+#define HW_USBCTRL_HWHOST_HC (1 << 0)
+
+#define HW_USBCTRL_HWDEVICE_DEVEP_OFFSET 1
+#define HW_USBCTRL_HWDEVICE_DEVEP_MASK (0x1f << 1)
+#define HW_USBCTRL_HWDEVICE_DC (1 << 0)
+
+#define HW_USBCTRL_HWTXBUF_TXLCR (1 << 31)
+#define HW_USBCTRL_HWTXBUF_TXCHANADD_OFFSET 16
+#define HW_USBCTRL_HWTXBUF_TXCHANADD_MASK (0xff << 16)
+#define HW_USBCTRL_HWTXBUF_TXADD_OFFSET 8
+#define HW_USBCTRL_HWTXBUF_TXADD_MASK (0xff << 8)
+#define HW_USBCTRL_HWTXBUF_TXBURST_OFFSET 0
+#define HW_USBCTRL_HWTXBUF_TXBURST_MASK 0xff
+
+#define HW_USBCTRL_HWRXBUF_RXADD_OFFSET 8
+#define HW_USBCTRL_HWRXBUF_RXADD_MASK (0xff << 8)
+#define HW_USBCTRL_HWRXBUF_RXBURST_OFFSET 0
+#define HW_USBCTRL_HWRXBUF_RXBURST_MASK 0xff
+
+#define HW_USBCTRL_GPTIMERLD_GPTLD_OFFSET 0
+#define HW_USBCTRL_GPTIMERLD_GPTLD_MASK 0xffffff
+
+#define HW_USBCTRL_GPTIMERCTRL_GPTRUN (1 << 31)
+#define HW_USBCTRL_GPTIMERCTRL_GPTRST (1 << 30)
+#define HW_USBCTRL_GPTIMERCTRL_GPTMODE (1 << 24)
+#define HW_USBCTRL_GPTIMERCTRL_GPTCNT_OFFSET 0
+#define HW_USBCTRL_GPTIMERCTRL_GPTCNT_MASK 0xffffff
+
+#define HW_USBCTRL_SBUSCFG_AHBBURST_OFFSET 0
+#define HW_USBCTRL_SBUSCFG_AHBBURST_MASK 0x7
+#define HW_USBCTRL_SBUSCFG_AHBBURST_U_INCR 0x0
+#define HW_USBCTRL_SBUSCFG_AHBBURST_S_INCR4 0x1
+#define HW_USBCTRL_SBUSCFG_AHBBURST_S_INCR8 0x2
+#define HW_USBCTRL_SBUSCFG_AHBBURST_S_INCR16 0x3
+#define HW_USBCTRL_SBUSCFG_AHBBURST_U_INCR4 0x5
+#define HW_USBCTRL_SBUSCFG_AHBBURST_U_INCR8 0x6
+#define HW_USBCTRL_SBUSCFG_AHBBURST_U_INCR16 0x7
+
+#endif /* __REGS_USB_H__ */
diff --git a/arch/arm/include/asm/arch-mx28/regs-usbphy.h b/arch/arm/include/asm/arch-mx28/regs-usbphy.h
new file mode 100644
index 0000000..e823e19
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx28/regs-usbphy.h
@@ -0,0 +1,151 @@
+/*
+ * Freescale i.MX28 USB PHY Register Definitions
+ *
+ * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __REGS_USBPHY_H__
+#define __REGS_USBPHY_H__
+
+struct mx28_usbphy_regs {
+ mx28_reg(hw_usbphy_pwd)
+ mx28_reg(hw_usbphy_tx)
+ mx28_reg(hw_usbphy_rx)
+ mx28_reg(hw_usbphy_ctrl)
+ mx28_reg(hw_usbphy_status)
+ mx28_reg(hw_usbphy_debug)
+ mx28_reg(hw_usbphy_debug0_status)
+ mx28_reg(hw_usbphy_debug1)
+ mx28_reg(hw_usbphy_version)
+ mx28_reg(hw_usbphy_ip)
+};
+
+#define USBPHY_PWD_RXPWDRX (1 << 20)
+#define USBPHY_PWD_RXPWDDIFF (1 << 19)
+#define USBPHY_PWD_RXPWD1PT1 (1 << 18)
+#define USBPHY_PWD_RXPWDENV (1 << 17)
+#define USBPHY_PWD_TXPWDV2I (1 << 12)
+#define USBPHY_PWD_TXPWDIBIAS (1 << 11)
+#define USBPHY_PWD_TXPWDFS (1 << 10)
+
+#define USBPHY_TX_USBPHY_TX_EDGECTRL_OFFSET 26
+#define USBPHY_TX_USBPHY_TX_EDGECTRL_MASK (0x7 << 26)
+#define USBPHY_TX_USBPHY_TX_SYNC_INVERT (1 << 25)
+#define USBPHY_TX_USBPHY_TX_SYNC_MUX (1 << 24)
+#define USBPHY_TX_TXENCAL45DP (1 << 21)
+#define USBPHY_TX_TXCAL45DP_OFFSET 16
+#define USBPHY_TX_TXCAL45DP_MASK (0xf << 16)
+#define USBPHY_TX_TXENCAL45DM (1 << 13)
+#define USBPHY_TX_TXCAL45DM_OFFSET 8
+#define USBPHY_TX_TXCAL45DM_MASK (0xf << 8)
+#define USBPHY_TX_D_CAL_OFFSET 0
+#define USBPHY_TX_D_CAL_MASK 0xf
+
+#define USBPHY_RX_RXDBYPASS (1 << 22)
+#define USBPHY_RX_DISCONADJ_OFFSET 4
+#define USBPHY_RX_DISCONADJ_MASK (0x7 << 4)
+#define USBPHY_RX_ENVADJ_OFFSET 0
+#define USBPHY_RX_ENVADJ_MASK 0x7
+
+#define USBPHY_CTRL_SFTRST (1 << 31)
+#define USBPHY_CTRL_CLKGATE (1 << 30)
+#define USBPHY_CTRL_UTMI_SUSPENDM (1 << 29)
+#define USBPHY_CTRL_HOST_FORCE_LS_SE0 (1 << 28)
+#define USBPHY_CTRL_ENAUTOSET_USBCLKS (1 << 26)
+#define USBPHY_CTRL_ENAUTOCLR_USBCLKGATE (1 << 25)
+#define USBPHY_CTRL_FSDLL_RST_EN (1 << 24)
+#define USBPHY_CTRL_ENVBUSCHG_WKUP (1 << 23)
+#define USBPHY_CTRL_ENIDCHG_WKUP (1 << 22)
+#define USBPHY_CTRL_ENDPDMCHG_WKUP (1 << 21)
+#define USBPHY_CTRL_ENAUTOCLR_PHY_PWD (1 << 20)
+#define USBPHY_CTRL_ENAUTOCLR_CLKGATE (1 << 19)
+#define USBPHY_CTRL_ENAUTO_PWRON_PLL (1 << 18)
+#define USBPHY_CTRL_WAKEUP_IRQ (1 << 17)
+#define USBPHY_CTRL_ENIRQWAKEUP (1 << 16)
+#define USBPHY_CTRL_ENUTMILEVEL3 (1 << 15)
+#define USBPHY_CTRL_ENUTMILEVEL2 (1 << 14)
+#define USBPHY_CTRL_DATA_ON_LRADC (1 << 13)
+#define USBPHY_CTRL_DEVPLUGIN_IRQ (1 << 12)
+#define USBPHY_CTRL_ENIRQDEVPLUGIN (1 << 11)
+#define USBPHY_CTRL_RESUME_IRQ (1 << 10)
+#define USBPHY_CTRL_ENIRQRESUMEDETECT (1 << 9)
+#define USBPHY_CTRL_RESUMEIRQSTICKY (1 << 8)
+#define USBPHY_CTRL_ENOTGIDDETECT (1 << 7)
+#define USBPHY_CTRL_DEVPLUGIN_POLARITY (1 << 5)
+#define USBPHY_CTRL_ENDEVPLUGINDETECT (1 << 4)
+#define USBPHY_CTRL_HOSTDISCONDETECT_IRQ (1 << 3)
+#define USBPHY_CTRL_ENIRQHOSTDISCON (1 << 2)
+#define USBPHY_CTRL_ENHOSTDISCONDETECT (1 << 1)
+
+#define USBPHY_STATUS_RESUME_STATUS (1 << 10)
+#define USBPHY_STATUS_OTGID_STATUS (1 << 8)
+#define USBPHY_STATUS_DEVPLUGIN_STATUS (1 << 6)
+#define USBPHY_STATUS_HOSTDISCONDETECT_STATUS (1 << 3)
+
+#define USBPHY_DEBUG_CLKGATE (1 << 30)
+#define USBPHY_DEBUG_HOST_RESUME_DEBUG (1 << 29)
+#define USBPHY_DEBUG_SQUELCHRESETLENGTH_OFFSET 25
+#define USBPHY_DEBUG_SQUELCHRESETLENGTH_MASK (0xf << 25)
+#define USBPHY_DEBUG_ENSQUELCHRESET (1 << 24)
+#define USBPHY_DEBUG_SQUELCHRESETCOUNT_OFFSET 16
+#define USBPHY_DEBUG_SQUELCHRESETCOUNT_MASK (0x1f << 16)
+#define USBPHY_DEBUG_ENTX2RXCOUNT (1 << 12)
+#define USBPHY_DEBUG_TX2RXCOUNT_OFFSET 8
+#define USBPHY_DEBUG_TX2RXCOUNT_MASK (0xf << 8)
+#define USBPHY_DEBUG_ENHSTPULLDOWN_OFFSET 4
+#define USBPHY_DEBUG_ENHSTPULLDOWN_MASK (0x3 << 4)
+#define USBPHY_DEBUG_HSTPULLDOWN_OFFSET 2
+#define USBPHY_DEBUG_HSTPULLDOWN_MASK (0x3 << 2)
+#define USBPHY_DEBUG_DEBUG_INTERFACE_HOLD (1 << 1)
+#define USBPHY_DEBUG_OTGIDPIDLOCK (1 << 0)
+
+#define USBPHY_DEBUG0_STATUS_SQUELCH_COUNT_OFFSET 26
+#define USBPHY_DEBUG0_STATUS_SQUELCH_COUNT_MASK (0x3f << 26)
+#define USBPHY_DEBUG0_STATUS_UTMI_RXERROR_OFFSET 16
+#define USBPHY_DEBUG0_STATUS_UTMI_RXERROR_MASK (0x3ff << 16)
+#define USBPHY_DEBUG0_STATUS_LOOP_BACK_OFFSET 0
+#define USBPHY_DEBUG0_STATUS_LOOP_BACK_MASK 0xffff
+
+#define USBPHY_DEBUG1_ENTAILADJVD_OFFSET 13
+#define USBPHY_DEBUG1_ENTAILADJVD_MASK (0x3 << 13)
+#define USBPHY_DEBUG1_ENTX2TX (1 << 12)
+#define USBPHY_DEBUG1_DBG_ADDRESS_OFFSET 0
+#define USBPHY_DEBUG1_DBG_ADDRESS_MASK 0xf
+
+#define USBPHY_VERSION_MAJOR_MASK (0xff << 24)
+#define USBPHY_VERSION_MAJOR_OFFSET 24
+#define USBPHY_VERSION_MINOR_MASK (0xff << 16)
+#define USBPHY_VERSION_MINOR_OFFSET 16
+#define USBPHY_VERSION_STEP_MASK 0xffff
+#define USBPHY_VERSION_STEP_OFFSET 0
+
+#define USBPHY_IP_DIV_SEL_OFFSET 23
+#define USBPHY_IP_DIV_SEL_MASK (0x3 << 23)
+#define USBPHY_IP_LFR_SEL_OFFSET 21
+#define USBPHY_IP_LFR_SEL_MASK (0x3 << 21)
+#define USBPHY_IP_CP_SEL_OFFSET 19
+#define USBPHY_IP_CP_SEL_MASK (0x3 << 19)
+#define USBPHY_IP_TSTI_TX_DP (1 << 18)
+#define USBPHY_IP_TSTI_TX_DM (1 << 17)
+#define USBPHY_IP_ANALOG_TESTMODE (1 << 16)
+#define USBPHY_IP_EN_USB_CLKS (1 << 2)
+#define USBPHY_IP_PLL_LOCKED (1 << 1)
+#define USBPHY_IP_PLL_POWER (1 << 0)
+
+#endif /* __REGS_USBPHY_H__ */
--
1.7.6.3
^ permalink raw reply related
* [U-Boot] [PATCH 2/3] iMX28: Add USB HOST driver
From: Marek Vasut @ 2011-10-24 11:21 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1319455296-15996-1-git-send-email-marek.vasut@gmail.com>
This driver supports both EHCI ports on the i.MX28 CPU.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
---
drivers/usb/host/Makefile | 1 +
drivers/usb/host/ehci-mxs.c | 154 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 155 insertions(+), 0 deletions(-)
create mode 100644 drivers/usb/host/ehci-mxs.c
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 51b2494..09abb75 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -41,6 +41,7 @@ else
COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
endif
COBJS-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
+COBJS-$(CONFIG_USB_EHCI_MXS) += ehci-mxs.o
COBJS-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o
diff --git a/drivers/usb/host/ehci-mxs.c b/drivers/usb/host/ehci-mxs.c
new file mode 100644
index 0000000..c795f23
--- /dev/null
+++ b/drivers/usb/host/ehci-mxs.c
@@ -0,0 +1,154 @@
+/*
+ * Freescale i.MX28 USB Host driver
+ *
+ * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
+ * on behalf of DENX Software Engineering GmbH
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/regs-common.h>
+#include <asm/arch/regs-base.h>
+#include <asm/arch/regs-clkctrl.h>
+#include <asm/arch/regs-usb.h>
+#include <asm/arch/regs-usbphy.h>
+
+#include "ehci-core.h"
+#include "ehci.h"
+
+#if (CONFIG_EHCI_MXS_PORT != 0) && (CONFIG_EHCI_MXS_PORT != 1)
+#error "MXS EHCI: Invalid port selected!"
+#endif
+
+#ifndef CONFIG_EHCI_MXS_PORT
+#error "MXS EHCI: Please define correct port using CONFIG_EHCI_MXS_PORT!"
+#endif
+
+static struct ehci_mxs {
+ struct mx28_usb_regs *usb_regs;
+ struct mx28_usbphy_regs *phy_regs;
+} ehci_mxs;
+
+int mxs_ehci_get_port(struct ehci_mxs *mxs_usb, int port)
+{
+ uint32_t usb_base, phy_base;
+ switch (port) {
+ case 0:
+ usb_base = MXS_USBCTRL0_BASE;
+ phy_base = MXS_USBPHY0_BASE;
+ break;
+ case 1:
+ usb_base = MXS_USBCTRL1_BASE;
+ phy_base = MXS_USBPHY1_BASE;
+ break;
+ default:
+ printf("CONFIG_EHCI_MXS_PORT (port = %d)\n", port);
+ return -1;
+ }
+
+ mxs_usb->usb_regs = (struct mx28_usb_regs *)usb_base;
+ mxs_usb->phy_regs = (struct mx28_usbphy_regs *)phy_base;
+ return 0;
+}
+
+/* This DIGCTL register ungates clock to USB */
+#define HW_DIGCTL_CTRL 0x8001c000
+#define HW_DIGCTL_CTRL_USB0_CLKGATE (1 << 2)
+#define HW_DIGCTL_CTRL_USB1_CLKGATE (1 << 16)
+
+int ehci_hcd_init(void)
+{
+
+ int ret;
+ uint32_t usb_base, cap_base;
+ struct mx28_register *digctl_ctrl =
+ (struct mx28_register *)HW_DIGCTL_CTRL;
+ struct mx28_clkctrl_regs *clkctrl_regs =
+ (struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE;
+
+ ret = mxs_ehci_get_port(&ehci_mxs, CONFIG_EHCI_MXS_PORT);
+ if (ret)
+ return ret;
+
+ /* Reset the PHY block */
+ writel(USBPHY_CTRL_SFTRST, &ehci_mxs.phy_regs->hw_usbphy_ctrl_set);
+ udelay(10);
+ writel(USBPHY_CTRL_SFTRST | USBPHY_CTRL_CLKGATE,
+ &ehci_mxs.phy_regs->hw_usbphy_ctrl_clr);
+
+ /* Enable USB clock */
+ writel(CLKCTRL_PLL0CTRL0_EN_USB_CLKS | CLKCTRL_PLL0CTRL0_POWER,
+ &clkctrl_regs->hw_clkctrl_pll0ctrl0_set);
+ writel(CLKCTRL_PLL1CTRL0_EN_USB_CLKS | CLKCTRL_PLL1CTRL0_POWER,
+ &clkctrl_regs->hw_clkctrl_pll1ctrl0_set);
+
+ writel(HW_DIGCTL_CTRL_USB0_CLKGATE | HW_DIGCTL_CTRL_USB1_CLKGATE,
+ &digctl_ctrl->reg_clr);
+
+ /* Start USB PHY */
+ writel(0, &ehci_mxs.phy_regs->hw_usbphy_pwd);
+
+ /* Enable UTMI+ Level 2 and Level 3 compatibility */
+ writel(USBPHY_CTRL_ENUTMILEVEL3 | USBPHY_CTRL_ENUTMILEVEL2 | 1,
+ &ehci_mxs.phy_regs->hw_usbphy_ctrl_set);
+
+ usb_base = ((uint32_t)ehci_mxs.usb_regs) + 0x100;
+ hccr = (struct ehci_hccr *)usb_base;
+
+ cap_base = ehci_readl(&hccr->cr_capbase);
+ hcor = (struct ehci_hcor *)(usb_base + HC_LENGTH(cap_base));
+
+ return 0;
+}
+
+int ehci_hcd_stop(void)
+{
+ int ret;
+ uint32_t tmp;
+ struct mx28_register *digctl_ctrl =
+ (struct mx28_register *)HW_DIGCTL_CTRL;
+ struct mx28_clkctrl_regs *clkctrl_regs =
+ (struct mx28_clkctrl_regs *)MXS_CLKCTRL_BASE;
+
+ ret = mxs_ehci_get_port(&ehci_mxs, CONFIG_EHCI_MXS_PORT);
+ if (ret)
+ return ret;
+
+ /* Stop the USB port */
+ tmp = ehci_readl(&hcor->or_usbcmd);
+ tmp &= ~CMD_RUN;
+ ehci_writel(tmp, &hcor->or_usbcmd);
+
+ /* Disable the PHY */
+ tmp = USBPHY_PWD_RXPWDRX | USBPHY_PWD_RXPWDDIFF |
+ USBPHY_PWD_RXPWD1PT1 | USBPHY_PWD_RXPWDENV |
+ USBPHY_PWD_TXPWDV2I | USBPHY_PWD_TXPWDIBIAS |
+ USBPHY_PWD_TXPWDFS;
+ writel(tmp, &ehci_mxs.phy_regs->hw_usbphy_pwd);
+
+ /* Disable USB clock */
+ writel(CLKCTRL_PLL0CTRL0_EN_USB_CLKS,
+ &clkctrl_regs->hw_clkctrl_pll0ctrl0_clr);
+ writel(CLKCTRL_PLL1CTRL0_EN_USB_CLKS,
+ &clkctrl_regs->hw_clkctrl_pll1ctrl0_clr);
+
+ /* Gate off the USB clock */
+ writel(HW_DIGCTL_CTRL_USB0_CLKGATE | HW_DIGCTL_CTRL_USB1_CLKGATE,
+ &digctl_ctrl->reg_set);
+
+ return 0;
+}
--
1.7.6.3
^ permalink raw reply related
* [U-Boot] [PATCH 3/3] M28EVK: Enable USB HOST support
From: Marek Vasut @ 2011-10-24 11:21 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1319455296-15996-1-git-send-email-marek.vasut@gmail.com>
This enables the second port, aka. the port with the USB connector on the
M28EVK.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
---
board/denx/m28evk/m28evk.c | 7 +++++++
include/configs/m28evk.h | 12 ++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c
index 168ceeb..8cf3dc9 100644
--- a/board/denx/m28evk/m28evk.c
+++ b/board/denx/m28evk/m28evk.c
@@ -52,6 +52,13 @@ int board_early_init_f(void)
/* SSP2 clock at 96MHz */
mx28_set_sspclk(MXC_SSPCLK2, 96000, 0);
+#ifdef CONFIG_CMD_USB
+ mxs_iomux_setup_pad(MX28_PAD_SSP2_SS1__USB1_OVERCURRENT);
+ mxs_iomux_setup_pad(MX28_PAD_AUART3_TX__GPIO_3_13 |
+ MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_PULLUP);
+ gpio_direction_output(MX28_PAD_AUART3_TX__GPIO_3_13, 0);
+#endif
+
return 0;
}
diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
index c8b0cf5..52dcd4a 100644
--- a/include/configs/m28evk.h
+++ b/include/configs/m28evk.h
@@ -75,6 +75,7 @@
#define CONFIG_CMD_SETEXPR
#define CONFIG_CMD_SF
#define CONFIG_CMD_SPI
+#define CONFIG_CMD_USB
/*
* Memory configurations
@@ -218,6 +219,17 @@
#endif
/*
+ * USB
+ */
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MXS
+#define CONFIG_EHCI_MXS_PORT 1
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#endif
+
+/*
* SPI
*/
#ifdef CONFIG_CMD_SPI
--
1.7.6.3
^ permalink raw reply related
* [GIT] Security subsystem updates for 3.2
From: James Morris @ 2011-10-24 11:21 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-security-module, linux-kernel
Hi Linus,
The most significant item here is the inclusion of EVM:
https://lkml.org/lkml/2011/6/29/419
There are also enhancements to Smack and Tomoyo, as well as general
cleanups and fixes across the subsystem.
Please pull.
The following changes since commit c3b92c8787367a8bb53d57d9789b558f1295cc96:
Linus Torvalds (1):
Linux 3.1
are available in the git repository at:
git://selinuxproject.org/~jmorris/linux-security next
Axel Lin (1):
CRED: fix build error due to 'tgcred' undeclared
Casey Schaufler (4):
Smack: Rule list lookup performance
Smack: Repair processing of fcntl
Smack: Clean up comments
Smack: Provide information for UDS getsockopt(SO_PEERCRED)
David Howells (8):
KEYS: If install_session_keyring() is given a keyring, it should install it
KEYS: keyctl_get_keyring_ID() should create a session keyring if create flag set
KEYS: __key_link() should use the RCU deref wrapper for keyring payloads
CRED: Fix prepare_kernel_cred() to provide a new thread_group_cred struct
KEYS: Move the unreferenced key reaper to the keys garbage collector file
KEYS: Make the key reaper non-reentrant
KEYS: The dead key link reaper should be non-reentrant
KEYS: Correctly destroy key payloads when their keytype is removed
Dmitry Kasatkin (6):
evm: add support for different security.evm data types
evm: crypto hash replaced by shash
evm: additional parameter to pass integrity cache entry 'iint'
evm: evm_verify_hmac must not return INTEGRITY_UNKNOWN
evm: replace hmac_status with evm_status
evm: clean verification status
James Morris (23):
Merge branch 'linus'; commit 'v3.1-rc1' into next
Merge branch 'next-queue' into next
Merge branch 'next-evm' of git://git.kernel.org/.../zohar/ima-2.6 into next
EVM: ensure trusted and encypted key symbols are available to EVM
integrity: sparse fix: move iint_initialized to integrity.h
apparmor: sparse fix: make aa_create_aafs static
selinux: sparse fix: make selinux_secmark_refcount static
selinux: sparse fix: move selinux_complete_init
selinux: sparse fix: declare selinux_disable() in security.h
apparmor: sparse fix: include ipc.h
apparmor: sparse fix: add apparmor.h to lib.c
apparmor: sparse fix: rename shadowed variables in policy_unpack.c
apparmor: sparse fix: include procattr.h in procattr.c
ima: sparse fix: make ima_open_policy static
ima: sparse fix: include linux/ima.h in ima_main.c
selinux: sparse fix: eliminate warnings for selinuxfs
selinux: sparse fix: fix warnings in netlink code
selinux: sparse fix: include selinux.h in exports.c
selinux: sparse fix: fix several warnings in the security server code
security: sparse fix: Move security_fixup_op to security.h
Merge branch 'next-evm' of git://github.com/mzohar/linux-evm into next
Merge branch 'next-hex2bin' of git://github.com/mzohar/linux-evm into next
Merge branch 'master' of git://gitorious.org/smack-next/kernel into next
Jarkko Sakkinen (6):
Smack: check permissions from user space (v2)
Smack: domain transition protections (v3)
Smack: fix for /smack/access output, use string instead of byte
Smack: compilation fix
Smack: fix: invalid length set for the result of /smack/access
Smack: allow to access /smack/access as normal user
Mimi Zohar (28):
security: new security_inode_init_security API adds function callback
integrity: move ima inode integrity data management
xattr: define vfs_getxattr_alloc and vfs_xattr_cmp
evm: re-release
security: imbed evm calls in security hooks
evm: evm_inode_post_removexattr
evm: imbed evm_inode_post_setattr
evm: add evm_inode_init_security to initialize new files
evm: call evm_inode_init_security from security_inode_init_security
evm: permit only valid security.evm xattrs to be updated
evm: add evm_inode_setattr to prevent updating an invalid security.evm
evm: building without EVM enabled fixes
evm: fix evm_inode_init_security return code
CIFS: remove local xattr definitions
evm: fix build problems
evm: add Kconfig TCG_TPM dependency
evm: add MAINTAINERS entry
encrypted-keys: create encrypted-keys directory
encrypted-keys: remove trusted-keys dependency
evm: remove TCG_TPM dependency
evm: fix security/security_old_init_security return code
evm: limit verifying current security.evm integrity
evm: posix acls modify i_mode
evm: permit mode bits to be updated
lib: add error checking to hex2bin
trusted-keys: check hex2bin result
encrypted-keys: check hex2bin result
target: check hex2bin result
Oleg Nesterov (1):
tomoyo: remove tomoyo_gc_thread()->daemonize()
Paul Moore (2):
doc: Update the MAINTAINERS info for Paul Moore
doc: Update the email address for Paul Moore in various source files
Serge Hallyn (1):
capabilities: initialize has_cap
Stefan Berger (1):
tpm: suppress durations sysfs output if not read
Stephen Rothwell (1):
encrypted-keys: IS_ERR need include/err.h
Tetsuo Handa (16):
TOMOYO: Fix incorrect enforce mode.
TOMOYO: Add environment variable name restriction support.
TOMOYO: Add socket operation restriction support.
TOMOYO: Allow controlling generation of access granted logs for per an entry basis.
TOMOYO: Allow domain transition without execve().
TOMOYO: Avoid race when retrying "file execute" permission check.
TOMOYO: Bump version.
TOMOYO: Allow specifying domain transition preference.
TOMOYO: Fix make namespacecheck warnings.
TOMOYO: Simplify garbage collector.
TOMOYO: Remove tomoyo_policy_memory_lock spinlock.
TOMOYO: Fix domain transition failure warning.
TOMOYO: Remove redundant tasklist_lock.
TOMOYO: Fix quota and garbage collector.
TOMOYO: Fix unused kernel config option.
TOMOYO: Fix incomplete read after seek.
Zhi Li (1):
capabilities: do not grant full privs for setuid w/ file caps + no effective caps
rongqing.li@windriver.com (1):
security: Fix a typo
Documentation/ABI/testing/evm | 23 +
Documentation/kernel-parameters.txt | 6 +
MAINTAINERS | 7 +-
drivers/char/tpm/tpm.c | 3 +
drivers/target/target_core_fabric_lib.c | 12 +-
fs/attr.c | 5 +-
fs/btrfs/xattr.c | 50 +-
fs/cifs/xattr.c | 40 +-
fs/ext2/xattr_security.c | 34 +-
fs/ext3/xattr_security.c | 36 +-
fs/ext4/xattr_security.c | 36 +-
fs/gfs2/inode.c | 38 +-
fs/jffs2/security.c | 35 +-
fs/jfs/xattr.c | 57 +-
fs/ocfs2/xattr.c | 38 +-
fs/reiserfs/xattr_security.c | 4 +-
fs/xattr.c | 63 ++-
fs/xfs/linux-2.6/xfs_iops.c | 39 +-
include/linux/evm.h | 100 +++
include/linux/ima.h | 13 -
include/linux/integrity.h | 39 +
include/linux/kernel.h | 2 +-
include/linux/security.h | 32 +-
include/linux/xattr.h | 19 +-
kernel/cred.c | 18 +-
lib/hexdump.c | 15 +-
mm/shmem.c | 4 +-
security/Kconfig | 6 +-
security/Makefile | 4 +-
security/apparmor/apparmorfs.c | 2 +-
security/apparmor/ipc.c | 1 +
security/apparmor/lib.c | 1 +
security/apparmor/policy_unpack.c | 12 +-
security/apparmor/procattr.c | 1 +
security/commoncap.c | 16 +-
security/integrity/Kconfig | 7 +
security/integrity/Makefile | 12 +
security/integrity/evm/Kconfig | 13 +
security/integrity/evm/Makefile | 7 +
security/integrity/evm/evm.h | 38 +
security/integrity/evm/evm_crypto.c | 216 ++++++
security/integrity/evm/evm_main.c | 384 ++++++++++
security/integrity/evm/evm_posix_acl.c | 26 +
security/integrity/evm/evm_secfs.c | 108 +++
security/integrity/iint.c | 172 +++++
security/integrity/ima/Kconfig | 1 +
security/integrity/ima/Makefile | 2 +-
security/integrity/ima/ima.h | 30 +-
security/integrity/ima/ima_api.c | 7 +-
security/integrity/ima/ima_fs.c | 2 +-
security/integrity/ima/ima_iint.c | 169 -----
security/integrity/ima/ima_main.c | 13 +-
security/integrity/integrity.h | 50 ++
security/keys/Makefile | 2 +-
security/keys/encrypted-keys/Makefile | 6 +
.../keys/{ => encrypted-keys}/ecryptfs_format.c | 0
.../keys/{ => encrypted-keys}/ecryptfs_format.h | 0
security/keys/{ => encrypted-keys}/encrypted.c | 49 +-
security/keys/{ => encrypted-keys}/encrypted.h | 11 +
security/keys/encrypted-keys/masterkey_trusted.c | 45 ++
security/keys/gc.c | 386 +++++++---
security/keys/internal.h | 4 +
security/keys/key.c | 121 +---
security/keys/keyring.c | 3 +-
security/keys/process_keys.c | 16 +-
security/keys/trusted.c | 19 +-
security/security.c | 76 ++-
security/selinux/exports.c | 1 +
security/selinux/hooks.c | 13 +-
security/selinux/include/avc_ss.h | 6 +
security/selinux/include/security.h | 8 +
security/selinux/netlink.c | 2 +
security/selinux/nlmsgtab.c | 1 +
security/selinux/selinuxfs.c | 5 +-
security/selinux/ss/conditional.c | 2 +-
security/selinux/ss/conditional.h | 1 +
security/selinux/ss/policydb.c | 2 -
security/selinux/ss/services.c | 3 -
security/smack/smack.h | 24 +-
security/smack/smack_access.c | 134 ++--
security/smack/smack_lsm.c | 266 +++++---
security/smack/smackfs.c | 277 ++++++--
security/tomoyo/Kconfig | 2 +
security/tomoyo/Makefile | 4 +-
security/tomoyo/audit.c | 7 +-
security/tomoyo/common.c | 228 +++++--
security/tomoyo/common.h | 189 +++++-
security/tomoyo/condition.c | 71 ++-
security/tomoyo/domain.c | 209 +++++-
security/tomoyo/environ.c | 122 +++
security/tomoyo/file.c | 42 +-
security/tomoyo/gc.c | 540 ++++++--------
security/tomoyo/group.c | 61 ++-
security/tomoyo/memory.c | 39 +-
security/tomoyo/network.c | 771 ++++++++++++++++++++
security/tomoyo/realpath.c | 32 +-
security/tomoyo/securityfs_if.c | 123 +++-
security/tomoyo/tomoyo.c | 62 ++
security/tomoyo/util.c | 80 ++-
99 files changed, 4701 insertions(+), 1432 deletions(-)
create mode 100644 Documentation/ABI/testing/evm
create mode 100644 include/linux/evm.h
create mode 100644 include/linux/integrity.h
create mode 100644 security/integrity/Kconfig
create mode 100644 security/integrity/Makefile
create mode 100644 security/integrity/evm/Kconfig
create mode 100644 security/integrity/evm/Makefile
create mode 100644 security/integrity/evm/evm.h
create mode 100644 security/integrity/evm/evm_crypto.c
create mode 100644 security/integrity/evm/evm_main.c
create mode 100644 security/integrity/evm/evm_posix_acl.c
create mode 100644 security/integrity/evm/evm_secfs.c
create mode 100644 security/integrity/iint.c
delete mode 100644 security/integrity/ima/ima_iint.c
create mode 100644 security/integrity/integrity.h
create mode 100644 security/keys/encrypted-keys/Makefile
rename security/keys/{ => encrypted-keys}/ecryptfs_format.c (100%)
rename security/keys/{ => encrypted-keys}/ecryptfs_format.h (100%)
rename security/keys/{ => encrypted-keys}/encrypted.c (96%)
rename security/keys/{ => encrypted-keys}/encrypted.h (81%)
create mode 100644 security/keys/encrypted-keys/masterkey_trusted.c
create mode 100644 security/tomoyo/environ.c
create mode 100644 security/tomoyo/network.c
--
James Morris
<jmorris@namei.org>
^ permalink raw reply
* Re: NFS4 BAD_STATEID loop (kernel 3.0)
From: Trond Myklebust @ 2011-10-24 11:22 UTC (permalink / raw)
To: David Flynn; +Cc: linux-nfs
In-Reply-To: <20111024104042.GD32587@rd.bbc.co.uk>
On Mon, 2011-10-24 at 10:40 +0000, David Flynn wrote:
> Dear All,
>
> On a system running kernel 3.0, mounting a Solaris NFS4 export, we
> observe a continuous 20Mbit/sec exchange between client and server that had
> been occurring for 10 days.
<snip>
> No. Time Source Destination Protocol Size Info
> 9880 11:40:12.833617 172.29.190.21 172.29.120.140 NFS 1122 V4 COMPOUND Call (Reply In 9881) <EMPTY> PUTFH;WRITE;GETATTR
>
> Frame 9880: 1122 bytes on wire (8976 bits), 1122 bytes captured (8976 bits)
> Arrival Time: Oct 17, 2011 11:40:12.833617000 BST
> Frame Length: 1122 bytes (8976 bits)
> Capture Length: 1122 bytes (8976 bits)
> Ethernet II, Src: ChelsioC_06:68:f9 (00:07:43:06:68:f9), Dst: All-HSRP-routers_be (00:00:0c:07:ac:be)
> Internet Protocol, Src: 172.29.190.21 (172.29.190.21), Dst: 172.29.120.140 (172.29.120.140)
> Transmission Control Protocol, Src Port: 816 (816), Dst Port: nfs (2049), Seq: 5199745, Ack: 275801, Len: 1056
> Remote Procedure Call, Type:Call XID:0x5daa6e93
> Network File System
> [Program Version: 4]
> [V4 Procedure: COMPOUND (1)]
> Tag: <EMPTY>
> length: 0
> contents: <EMPTY>
> minorversion: 0
> Operations (count: 3)
> Opcode: PUTFH (22)
> filehandle
> length: 36
> [hash (CRC-32): 0x6e4b15f3]
> decode type as: unknown
> filehandle: 7df3a75d5e1cd908000ab44c5b000000efc80200000a0300...
> Opcode: WRITE (38)
> stateid
> seqid: 0x00000000
> Data: 4e06f15b800f82e300000000
> offset: 11392
> stable: FILE_SYNC4 (2)
> Write length: 814
> Data: <DATA>
> length: 814
> contents: <DATA>
> fill bytes: opaque data
> Opcode: GETATTR (9)
> GETATTR4args
> attr_request
> bitmap[0] = 0x00000018
> [2 attributes requested]
> mand_attr: FATTR4_CHANGE (3)
> mand_attr: FATTR4_SIZE (4)
> bitmap[1] = 0x00300000
> [2 attributes requested]
> recc_attr: FATTR4_TIME_METADATA (52)
> recc_attr: FATTR4_TIME_MODIFY (53)
>
> No. Time Source Destination Protocol Size Info
> 9881 11:40:12.833956 172.29.120.140 172.29.190.21 NFS 122 V4 COMPOUND Reply (Call In 9880) <EMPTY> PUTFH;WRITE
>
> Frame 9881: 122 bytes on wire (976 bits), 122 bytes captured (976 bits)
> Arrival Time: Oct 17, 2011 11:40:12.833956000 BST
> [Time delta from previous captured frame: 0.000339000 seconds]
> Frame Length: 122 bytes (976 bits)
> Capture Length: 122 bytes (976 bits)
> Ethernet II, Src: Cisco_1e:f7:80 (00:13:5f:1e:f7:80), Dst: ChelsioC_06:68:f9 (00:07:43:06:68:f9)
> Internet Protocol, Src: 172.29.120.140 (172.29.120.140), Dst: 172.29.190.21 (172.29.190.21)
> Transmission Control Protocol, Src Port: nfs (2049), Dst Port: 816 (816), Seq: 275801, Ack: 5200801, Len: 56
> Remote Procedure Call, Type:Reply XID:0x5daa6e93
> Network File System
> [Program Version: 4]
> [V4 Procedure: COMPOUND (1)]
> Status: NFS4ERR_BAD_STATEID (10025)
> Tag: <EMPTY>
> length: 0
> contents: <EMPTY>
> Operations (count: 2)
> Opcode: PUTFH (22)
> Status: NFS4_OK (0)
> Opcode: WRITE (38)
> Status: NFS4ERR_BAD_STATEID (10025)
We should in principle be able to recover a BAD_STATEID error by running
the state recovery thread. It's a shame that the machine was rebooted,
but does your syslog trace perhaps show any state recovery thread
errors?
Cheers
Trond
--
Trond Myklebust
Linux NFS client maintainer
NetApp
Trond.Myklebust@netapp.com
www.netapp.com
^ permalink raw reply
* Re: Kernel BUG unable to handle kernel NULL pointer dereference
From: David Sterba @ 2011-10-24 11:22 UTC (permalink / raw)
To: Leonidas Spyropoulos; +Cc: Mitch Harder, linux-btrfs
In-Reply-To: <CAAeznTpDmT7NgZdAHh7uVPBnKtitr=SmLRvfFKrd_exG6XLE9w@mail.gmail.com>
On Sun, Oct 23, 2011 at 07:24:42PM +0100, Leonidas Spyropoulos wrote:
> On Sun, Oct 23, 2011 at 4:37 PM, Mitch Harder
> <mitch.harder@sabayonlinux.org> wrote:
> > A patch was submitted by Sergei Trofimovich to address the issue with
> > handling a NULL pointer in btrfs_print_leaf.
> >
> > http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg12021.html
afaik the patch should be enqueued for 3.2
> How can I track down the real problem? Any suggestions?
The preceding function in the stack was __btrfs_free_extent, there are 3
instances of btrfs_print_leaf() in that function, 2 of them relevant:
4470 printk(KERN_ERR "umm, got %d back from search"
4471 ", was looking for %llu\n", ret,
4472 (unsigned long long)bytenr);
4494 #ifdef BTRFS_COMPAT_EXTENT_TREE_V0
...
4511 printk(KERN_ERR "umm, got %d back from search"
4512 ", was looking for %llu\n", ret,
4513 (unsigned long long)bytenr);
4514 btrfs_print_leaf(extent_root, path->nodes[0]);
...
#endif
and the third one without a pre-message
4481 btrfs_print_leaf(extent_root, path->nodes[0]);
4482 WARN_ON(1);
4483 printk(KERN_ERR "btrfs unable to find ref byte nr %llu "
4484 "parent %llu root %llu owner %llu offset %llu\n",
4485 (unsigned long long)bytenr,
4486 (unsigned long long)parent,
4487 (unsigned long long)root_objectid,
4488 (unsigned long long)owner_objectid,
4489 (unsigned long long)owner_offset);
your original report does not contain any messages before the BUG
listing, so I'm not sure which one it is.
Supposed it's the 3rd, it's resulting from an error returned by
4429 ret = lookup_extent_backref(trans, extent_root, path, &iref,
4430 bytenr, num_bytes, parent,
4431 root_objectid, owner_objectid,
4432 owner_offset);
ret != 0 -> print leaf etc, a missing backref could be the problem here.
Are you able to trigger the BUG() repeatedly?
david
^ permalink raw reply
* Re: Building for TI 8148 EVM
From: Koen Kooi @ 2011-10-24 11:22 UTC (permalink / raw)
To: Rainer Koenig; +Cc: meta-ti
In-Reply-To: <4EA52A6E.2090904@ts.fujitsu.com>
Op 24 okt. 2011, om 11:05 heeft Rainer Koenig het volgende geschreven:
> Koen,
> Am 24.10.2011 10:58, schrieb Koen Kooi:
>>
>> Op 24 okt. 2011, om 10:48 heeft Rainer Koenig het volgende geschreven:
>>>> Please follow the instructions detailed in the meta-ti README: http://git.angstrom-distribution.org/cgi-bin/cgit.cgi/meta-texasinstruments/tree/README
>
>>> Tried this over the weekend on my home PC. Yes, works. But I was just
>>> able to build a console image. The build of systemd-gnome-image fails
>>> with the error that nothing provides "DRI". MACHINE=dm8148-evm.
>>
>> I'm not seeing that with this set of metadata:
>
>> Could you please share your version of that so we can see if there are fixes missing?
>
> Difficult at the moment because now I'm back to work and the data is at
> home. :-) But I will setup this again on my work machine and see that I
> get the firewall-issues solved, so I should be able to reproduce my
> results.
Roger provided a log with a related looking bug, which should get solved Real Soon(TM) when the following gets applied:
http://patchwork.openembedded.org/patch/13783/
In the mean time you should be able to get around it by doing 'bitbake mesa-dri' manually.
regards,
Koen
^ permalink raw reply
* [Buildroot] GnuPG
From: Gustavo Zacarias @ 2011-10-24 11:23 UTC (permalink / raw)
To: buildroot
In-Reply-To: <32709446.post@talk.nabble.com>
On 24.10.2011 08:12, ilranzani wrote:
> Nobody?
>
> (in buildroot there's already libgcrypt)
>
> UP UP UP ! :)
It's not too hard, you just need to add a couple of extra libraries
(packages) that it needs, IIRC libassuan and libksba.
The rest of the mandatory dependencies are already available
(libgpg-error & libgcrypt).
Regards.
^ permalink raw reply
* Re: [PATCH] ALSA: HDA: Add new revision for ALC662
From: Takashi Iwai @ 2011-10-24 11:24 UTC (permalink / raw)
To: David Henningsson; +Cc: ALSA Development Mailing List, kailang
In-Reply-To: <4E9E9D53.1030502@canonical.com>
At Wed, 19 Oct 2011 11:50:11 +0200,
David Henningsson wrote:
>
> We found a new chip, with Vendor Id: 0x10ec0662 and Revision Id:
> 0x100300. It seems to work well with patch_alc662, but I don't know if
> patch_alc882 had been better, and actually, I don't know if there's much
> of a difference between the two patch functions these days anyway.
>
> I'm cc:ing Kailang in case there's more to it (codec renaming,
> processing coefficients etc) that we don't know of.
OK, now I committed with the ack by Kailang.
thanks,
Takashi
^ permalink raw reply
* [U-Boot] [PATCH] Update s3c24x0 timer implementation
From: Mark Norman @ 2011-10-24 11:27 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20111023172248.4AB611408771@gemini.denx.de>
Dear Wolfgang Denk,
Thank you for your response.
>> ?Since the .rel.text section is required by the relocation code, I
>> assume that .bss global variables cannot be used until after
>> relocation?
>
> Why do you have to make such assumptions? ?That's documented
> behaviour. ?Didn't you RTFM?
>
I thought I had done a thorough search previously but after receiving
your response I managed to find some of the details outlined in the
README file.
I have attached an updated patch below which hopefully addresses the
other issues you highlighted.
Kind Regards,
Mark Norman
The s3c24x0 timer has been updated to use the global_data struct.
Restructured code based on other timer.c files.
Updated comments and several parameters.
Signed-off-by: Mark Norman <mpnorman@gmail.com>
---
arch/arm/cpu/arm920t/s3c24x0/timer.c | 155 +++++++++++++--------------------
arch/arm/include/asm/global_data.h | 4 +
2 files changed, 65 insertions(+), 94 deletions(-)
diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c
b/arch/arm/cpu/arm920t/s3c24x0/timer.c
index 9571870..5695c62 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/timer.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/timer.c
@@ -35,142 +35,109 @@
#include <asm/io.h>
#include <asm/arch/s3c24x0_cpu.h>
-int timer_load_val = 0;
-static ulong timer_clk;
+DECLARE_GLOBAL_DATA_PTR;
-/* macro to read the 16 bit timer */
-static inline ulong READ_TIMER(void)
+/* Read the 16 bit timer */
+static inline ulong read_timer(void)
{
struct s3c24x0_timers *timers = s3c24x0_get_base_timers();
return readl(&timers->tcnto4) & 0xffff;
}
-static ulong timestamp;
-static ulong lastdec;
-
int timer_init(void)
{
+ /*
+ * PWM Timer 4 is used because it has no output.
+ * Prescaler is hard fixed at 250, divider at 2.
+ * This generates a Timer clock frequency of 100kHz (@PCLK=50MHz) and
+ * therefore 10us timer ticks.
+ */
+ const ulong prescaler = 250;
struct s3c24x0_timers *timers = s3c24x0_get_base_timers();
ulong tmr;
- /* use PWM Timer 4 because it has no output */
- /* prescaler for Timer 4 is 16 */
- writel(0x0f00, &timers->tcfg0);
- if (timer_load_val == 0) {
- /*
- * for 10 ms clock period @ PCLK with 4 bit divider = 1/2
- * (default) and prescaler = 16. Should be 10390
- * @33.25MHz and 15625 @ 50 MHz
- */
- timer_load_val = get_PCLK() / (2 * 16 * 100);
- timer_clk = get_PCLK() / (2 * 16);
- }
- /* load value for 10 ms timeout */
- lastdec = timer_load_val;
- writel(timer_load_val, &timers->tcntb4);
- /* auto load, manual update of timer 4 */
+ /* Set prescaler for Timer 4 */
+ writel((prescaler-1) << 8, &timers->tcfg0);
+
+ /* Calculate timer freq, approx 100kHz @ PCLK=50MHz. */
+ gd->timer_rate_hz = get_PCLK() / (2 * prescaler);
+
+ /* Set timer for 0.5s timeout (50000 ticks @ 10us ticks). */
+ gd->timer_reset_value = 50000;
+ writel(gd->timer_reset_value, &timers->tcntb4);
+ gd->lastdec = gd->timer_reset_value;
+
+ /* Load the initial timer 4 count value using the manual update bit. */
tmr = (readl(&timers->tcon) & ~0x0700000) | 0x0600000;
writel(tmr, &timers->tcon);
- /* auto load, start timer 4 */
+
+ /* Configure timer 4 for auto reload and start it. */
tmr = (tmr & ~0x0700000) | 0x0500000;
writel(tmr, &timers->tcon);
- timestamp = 0;
+
+ gd->timestamp = 0;
return (0);
}
/*
- * timer without interrupts
+ * Get the number of ticks (in CONFIG_SYS_HZ resolution)
*/
-ulong get_timer(ulong base)
+unsigned long long get_ticks(void)
{
- return get_timer_masked() - base;
+ return get_timer(0);
}
-void __udelay (unsigned long usec)
+unsigned long get_timer_raw(void)
{
- ulong tmo;
- ulong start = get_ticks();
+ ulong now = read_timer();
- tmo = usec / 1000;
- tmo *= (timer_load_val * 100);
- tmo /= 1000;
+ if (gd->lastdec >= now) {
+ /* normal mode */
+ gd->timestamp += gd->lastdec - now;
+ } else {
+ /* we have an overflow ... */
+ gd->timestamp += gd->lastdec + gd->timer_reset_value - now;
+ }
+ gd->lastdec = now;
- while ((ulong) (get_ticks() - start) < tmo)
- /*NOP*/;
+ return gd->timestamp;
}
-ulong get_timer_masked(void)
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
{
- ulong tmr = get_ticks();
-
- return tmr / (timer_clk / CONFIG_SYS_HZ);
+ return CONFIG_SYS_HZ;
}
-void udelay_masked(unsigned long usec)
+ulong get_timer_masked(void)
{
- ulong tmo;
- ulong endtime;
- signed long diff;
-
- if (usec >= 1000) {
- tmo = usec / 1000;
- tmo *= (timer_load_val * 100);
- tmo /= 1000;
- } else {
- tmo = usec * (timer_load_val * 100);
- tmo /= (1000 * 1000);
- }
+ unsigned long tmr = get_timer_raw();
- endtime = get_ticks() + tmo;
+ return (tmr * CONFIG_SYS_HZ) / gd->timer_rate_hz;
+}
- do {
- ulong now = get_ticks();
- diff = endtime - now;
- } while (diff >= 0);
+ulong get_timer(ulong base)
+{
+ return get_timer_masked() - base;
}
-/*
- * This function is derived from PowerPC code (read timebase as long long).
- * On ARM it just returns the timer value.
- */
-unsigned long long get_ticks(void)
+void __udelay(unsigned long usec)
{
- ulong now = READ_TIMER();
+ unsigned long tmp;
+ unsigned long tmo;
- if (lastdec >= now) {
- /* normal mode */
- timestamp += lastdec - now;
- } else {
- /* we have an overflow ... */
- timestamp += lastdec + timer_load_val - now;
- }
- lastdec = now;
+ /* convert usec to ticks. */
+ tmo = ((gd->timer_rate_hz / 1000) * usec) / 1000;
- return timestamp;
-}
+ tmp = get_timer_raw() + tmo; /* get current timestamp */
-/*
- * This function is derived from PowerPC code (timebase clock frequency).
- * On ARM it returns the number of timer ticks per second.
- */
-ulong get_tbclk(void)
-{
- ulong tbclk;
-
-#if defined(CONFIG_SMDK2400)
- tbclk = timer_load_val * 100;
-#elif defined(CONFIG_SBC2410X) || \
- defined(CONFIG_SMDK2410) || \
- defined(CONFIG_S3C2440) || \
- defined(CONFIG_VCMA9)
- tbclk = CONFIG_SYS_HZ;
-#else
-# error "tbclk not configured"
-#endif
-
- return tbclk;
+ while (get_timer_raw() < tmp) /* loop till event */
+ /*NOP*/;
}
/*
diff --git a/arch/arm/include/asm/global_data.h
b/arch/arm/include/asm/global_data.h
index fac98d5..b836915 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -67,6 +67,10 @@ typedef struct global_data {
#ifdef CONFIG_IXP425
unsigned long timestamp;
#endif
+#ifdef CONFIG_S3C24X0
+ unsigned long lastdec;
+ unsigned long timestamp;
+#endif
unsigned long relocaddr; /* Start address of U-Boot in RAM */
phys_size_t ram_size; /* RAM size */
unsigned long mon_len; /* monitor len */
--
1.7.1
^ permalink raw reply related
* [PATCH] gpiolib: Provide a definition of struct gpio for the stub gpiolib
From: Mark Brown @ 2011-10-24 11:27 UTC (permalink / raw)
To: Grant Likely; +Cc: linux-kernel, Mark Brown
This makes the stub gpio_request_array() much more usable as drivers can
declare struct gpio variables.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
include/linux/gpio.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 17b5a0d..e885103 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -24,7 +24,6 @@
#include <linux/errno.h>
struct device;
-struct gpio;
struct gpio_chip;
/*
@@ -36,6 +35,12 @@ struct gpio_chip;
* warning when something is wrongly called.
*/
+struct gpio {
+ unsigned gpio;
+ unsigned long flags;
+ const char *label;
+};
+
static inline bool gpio_is_valid(int number)
{
return false;
--
1.7.6.3
^ permalink raw reply related
* Re: [PATCH 1/2] mac80211: fix remain_off_channel regression
From: Stanislaw Gruszka @ 2011-10-24 11:27 UTC (permalink / raw)
To: Eliad Peller, John W. Linville; +Cc: Johannes Berg, linux-wireless
In-Reply-To: <1319130350-15514-1-git-send-email-eliad@wizery.com>
On Thu, Oct 20, 2011 at 07:05:49PM +0200, Eliad Peller wrote:
> The offchannel code is currently broken - we should
> remain_off_channel if the work was started, and
> the work's channel and channel_type are the same
> as local->tmp_channel and local->tmp_channel_type.
>
> However, if wk->chan_type and local->tmp_channel_type
> coexist (e.g. have the same channel type), we won't
> remain_off_channel.
>
> This behavior was introduced by commit da2fd1f
> ("mac80211: Allow work items to use existing
> channel type.")
>
> Tested-by: Ben Greear <greearb@candelatech.com>
> Signed-off-by: Eliad Peller <eliad@wizery.com>
Both patches fixes serious bugs, should be marked
Cc: stable@kernel.org # 2.6.39+
I believe there is no need to repost, once informed
John would take care of process patches properly.
Stanislaw
^ permalink raw reply
* Re: Problem with TeVii S-470
From: Josu Lazkano @ 2011-10-24 11:29 UTC (permalink / raw)
To: Mike Mironov; +Cc: Linux Media Mailing List
In-Reply-To: <4EA54389.9040505@darkmike.ru>
2011/10/24 Mike Mironov <subscribe@darkmike.ru>:
> Hello!
>
> I have this card http://www.linuxtv.org/wiki/index.php/TeVii_S470
>
> I try to use it under Debian Squeeze, but I can't get channel data from it.
>
> I try to use drivers from 2.6.38, 2.6.39 kernels, s2-liplianin drivers with
> 2.6.32 kernel, last linux-media drivers with 2.6.32
>
> With all drivers I can scan channels, but then a I'll try to lock channel I
> get some error in syslog (module cx23885 loaded with debug=1)
>
> cx23885[0]/0: [f373ec80/27] cx23885_buf_queue - append to active
> cx23885[0]/0: [f373ebc0/28] wakeup reg=477 buf=477
> cx23885[0]/0: queue is not empty - append to active
>
> and finally a lot of
>
> cx23885[0]/0: [f42c4240/6] timeout - dma=0x03c5c000
> cx23885[0]/0: [f42c4180/7] timeout - dma=0x3322b000
> cx23885[0]/0: [f4374440/8] timeout - dma=0x33048000
> cx23885[0]/0: [f4374140/9] timeout - dma=0x03d68000
>
> In other machine this work under Windows. Under Linux I have same effects.
>
> It's problem in drivers or in card? That addition information need to
> resolve this problem?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Hello Mike, I have same device on same OS, try this:
mkdir /usr/local/src/dvbcd /usr/local/src/dvbwget
http://tevii.com/100315_Beta_linux_tevii_ds3000.rarunrar x
100315_Beta_linux_tevii_ds3000.rarcp dvb-fe-ds3000.fw
/lib/firmware/tar xjvf linux-tevii-ds3000.tar.bz2cd
linux-tevii-ds3000make && make install
Regards.
--
Josu Lazkano
^ permalink raw reply
* Re: [Qemu-devel] qemu-kvm guest which won't 'cont' (emulation failure?)
From: Chris Webb @ 2011-10-24 11:29 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, kvm
In-Reply-To: <4EA5497F.3030507@redhat.com>
Kevin Wolf <kwolf@redhat.com> writes:
> In qemu 1.0 we'll have an extended 'info status' that includes the stop
> reason, but 0.14 doesn't have this yet (was committed to git master only
> recently).
Right, okay. I might take a look at cherry-picking and back-porting that to
our version of qemu-kvm if it's not too entangled with other changes. It
would be very useful in these situations.
> If you attach a QMP monitor (see QMP/README, don't forget to send the
> capabilities command, it's part of creating the connection) you will
> receive messages for I/O errors, though.
Thanks. I don't think I can do this with an already-running qemu-kvm that's
in a stopped state can I, only with a new qemu-kvm invocation and wait to
try to catch the problem again?
Cheers,
Chris.
^ permalink raw reply
* Re: Re: PCI passthrough stopped working, brainache!
From: Andy Burns @ 2011-10-24 11:30 UTC (permalink / raw)
To: xen-devel
In-Reply-To: <CAE1-PRe3FZknxdCLkhkGbzd-i=y5eGMAwY+yoa36j61oHNcRSw@mail.gmail.com>
On 15 October 2011 12:27, Andy Burns <xen.lists@burns.me.uk> wrote:
> On 15 October 2011 11:36, Ian Campbell <Ian.Campbell@citrix.com> wrote:
>
>> I think you've got 8G of RAM so one thing which might be worth trying is
>> to give "mem=2G"
>
> A coconut for the gentleman!
I can see that the devs have been busy getting their ducks in a row
for when the 3.2 merge window opens (3.1 is released now) so not
wanted to pester about this as it's OK for now with the workarounds.
Initially I tried mem=2G, with dom0_mem=512M and two domUs of 512M and
1G respectively, I presume this caused a bit of ballooning in dom0 as
I caught it with 400M'ish at one point and I had a little instability.
I pushed it up to mem=3G and at the same time added irqpoll for dom0
and the pci domU (because I was seeing a few "nobody cared" messages
in the domU at bootup and in the dom0 after shutting down the domU)
those changes so far have resulted in a stable setup.
Not wanting to reboot the dom0 just yet (would like to see how stable
it really is) but want to think about things to try when I *do* reboot
it,
I'm assuming the DMA problem will rear its head again if I try mem >=
4G, I haven't tried anything with dma_bits yet either, anything other
suggestions or logging that might help?
^ permalink raw reply
* Re: [RFC] [PATCH -rt 5/5] cpufreq: get rid of get_online_cpus()/put_online_cpus()
From: Yong Zhang @ 2011-10-24 11:30 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: linux-kernel, linux-rt-users
In-Reply-To: <alpine.LFD.2.02.1110241123190.2642@ionos>
On Mon, Oct 24, 2011 at 11:24:51AM +0200, Thomas Gleixner wrote:
>
>
> On Mon, 24 Oct 2011, Yong Zhang wrote:
>
> > On Wed, Oct 19, 2011 at 11:12:20AM +0200, Thomas Gleixner wrote:
> > > On Sun, 16 Oct 2011, Yong Zhang wrote:
> > >
> > > > Fix below false positive (seems this is not a real deadlock scenario)
> > > > lockdep warning:
> > >
> > > This looks like you caused it with patch 1.
> >
> > Hmmm, yup.
> > CPU_DOWN_PREPARE will be under cpu_hotplug.lock.
> >
> > > Both need a bit more
> > > thought, but thanks for catching that.
> >
> > No sure whether it's big issue or not.
> > Mind showing more about your concern?
>
> This is probably not the only place which will run into that issue and
> I have not much interest to patch all those sites.
If so, I think that kind of violation has been caught in mainline,
because mainline has had CPU_DOWN_PREPARE called under
cpu_hotplug.lock, right?
Or am I missing something?
Thanks,
Yong
^ permalink raw reply
* [Qemu-devel] [PATCH v2] fw_cfg: Use g_file_get_contents instead of multiple fread() calls
From: Pavel Borzenkov @ 2011-10-24 11:31 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
---
hw/fw_cfg.c | 102 ++++++++++++++++++++++-------------------------------------
1 files changed, 38 insertions(+), 64 deletions(-)
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 8df265c..dbcb888 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -60,71 +60,55 @@ struct FWCfgState {
#define JPG_FILE 0
#define BMP_FILE 1
-static FILE *probe_splashfile(char *filename, int *file_sizep, int *file_typep)
+static char *read_splashfile(char *filename, int *file_sizep, int *file_typep)
{
- FILE *fp = NULL;
- int fop_ret;
- int file_size;
+ GError *err = NULL;
+ gboolean res;
+ gchar *content;
int file_type = -1;
- unsigned char buf[2] = {0, 0};
- unsigned int filehead_value = 0;
+ unsigned int filehead = 0;
int bmp_bpp;
- fp = fopen(filename, "rb");
- if (fp == NULL) {
- error_report("failed to open file '%s'.", filename);
- return fp;
+ res = g_file_get_contents(filename, &content, (gsize *)file_sizep, &err);
+ if (res == FALSE) {
+ error_report("failed to read splash file '%s'", filename);
+ g_error_free(err);
+ return NULL;
}
+
/* check file size */
- fseek(fp, 0L, SEEK_END);
- file_size = ftell(fp);
- if (file_size < 2) {
- error_report("file size is less than 2 bytes '%s'.", filename);
- fclose(fp);
- fp = NULL;
- return fp;
+ if (*file_sizep < 30) {
+ goto error;
}
+
/* check magic ID */
- fseek(fp, 0L, SEEK_SET);
- fop_ret = fread(buf, 1, 2, fp);
- if (fop_ret != 2) {
- error_report("Could not read header from '%s': %s",
- filename, strerror(errno));
- fclose(fp);
- fp = NULL;
- return fp;
- }
- filehead_value = (buf[0] + (buf[1] << 8)) & 0xffff;
- if (filehead_value == 0xd8ff) {
+ filehead = ((content[0] & 0xff) + (content[1] << 8)) & 0xffff;
+ if (filehead == 0xd8ff) {
file_type = JPG_FILE;
+ } else if (filehead == 0x4d42) {
+ file_type = BMP_FILE;
} else {
- if (filehead_value == 0x4d42) {
- file_type = BMP_FILE;
- }
- }
- if (file_type < 0) {
- error_report("'%s' not jpg/bmp file,head:0x%x.",
- filename, filehead_value);
- fclose(fp);
- fp = NULL;
- return fp;
+ goto error;
}
+
/* check BMP bpp */
if (file_type == BMP_FILE) {
- fseek(fp, 28, SEEK_SET);
- fop_ret = fread(buf, 1, 2, fp);
- bmp_bpp = (buf[0] + (buf[1] << 8)) & 0xffff;
+ bmp_bpp = (content[28] + (content[29] << 8)) & 0xffff;
if (bmp_bpp != 24) {
- error_report("only 24bpp bmp file is supported.");
- fclose(fp);
- fp = NULL;
- return fp;
+ goto error;
}
}
+
/* return values */
- *file_sizep = file_size;
*file_typep = file_type;
- return fp;
+
+ return content;
+
+error:
+ error_report("splash file '%s' format not recognized; must be JPEG "
+ "or 24 bit BMP", filename);
+ g_free(content);
+ return NULL;
}
static void fw_cfg_bootsplash(FWCfgState *s)
@@ -132,9 +116,7 @@ static void fw_cfg_bootsplash(FWCfgState *s)
int boot_splash_time = -1;
const char *boot_splash_filename = NULL;
char *p;
- char *filename;
- FILE *fp;
- int fop_ret;
+ char *filename, *file_data;
int file_size;
int file_type = -1;
const char *temp;
@@ -174,27 +156,19 @@ static void fw_cfg_bootsplash(FWCfgState *s)
error_report("failed to find file '%s'.", boot_splash_filename);
return;
}
- /* probing the file */
- fp = probe_splashfile(filename, &file_size, &file_type);
- if (fp == NULL) {
+
+ /* loading file data */
+ file_data = read_splashfile(filename, &file_size, &file_type);
+ if (file_data == NULL) {
g_free(filename);
return;
}
- /* loading file data */
if (boot_splash_filedata != NULL) {
g_free(boot_splash_filedata);
}
- boot_splash_filedata = g_malloc(file_size);
+ boot_splash_filedata = (uint8_t *)file_data;
boot_splash_filedata_size = file_size;
- fseek(fp, 0L, SEEK_SET);
- fop_ret = fread(boot_splash_filedata, 1, file_size, fp);
- if (fop_ret != file_size) {
- error_report("failed to read data from '%s'.",
- boot_splash_filename);
- fclose(fp);
- return;
- }
- fclose(fp);
+
/* insert data */
if (file_type == JPG_FILE) {
fw_cfg_add_file(s, "bootsplash.jpg",
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH] mmc: core: Assemble the codes of related to eMMC4.5
From: Girish K S @ 2011-10-24 11:32 UTC (permalink / raw)
To: Chris Ball; +Cc: Seungwon Jeon, linux-mmc, linux-samsung-soc, kgene.kim, dh.han
In-Reply-To: <m2obx64pes.fsf@bob.laptop.org>
On 24 October 2011 16:39, Chris Ball <cjb@laptop.org> wrote:
> Hi Seungwon,
>
> On Mon, Oct 24 2011, Seungwon Jeon wrote:
>> Code cleanup. The codes of related to eMMC4.5 are scattered.
>> This patch removes a duplicate if-statement and assembles all.
>>
>> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
>> ---
>> drivers/mmc/core/mmc.c | 20 +++++++++-----------
>> 1 files changed, 9 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>> index fb5bf01..3627044 100644
>> --- a/drivers/mmc/core/mmc.c
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -467,29 +467,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
>> card->ext_csd.rst_n_function = ext_csd[EXT_CSD_RST_N_FUNCTION];
>> }
>>
>> - /* eMMC v4.5 or later */
>> - if (card->ext_csd.rev >= 6)
>> - card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
>> -
>> card->ext_csd.raw_erased_mem_count = ext_csd[EXT_CSD_ERASED_MEM_CONT];
>> if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
>> card->erased_byte = 0xFF;
>> else
>> card->erased_byte = 0x0;
>>
>> + /* eMMC v4.5 or later */
>> if (card->ext_csd.rev >= 6) {
>> + card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
>> +
>> card->ext_csd.generic_cmd6_time = 10 *
>> ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
>> card->ext_csd.power_off_longtime = 10 *
>> ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
>> - } else
>> - card->ext_csd.generic_cmd6_time = 0;
>
> Your patch removes this line completely. Why is that? You should
> explain it in the commit message.
By tracing the code what i understand is mmc_read_ext_csd is called
from mmc_card_init. In the init function the card instance is created.
When the card instance is created kzalloc is used. This will
initialize all the card structure members to 0.
So the deleted line is implicit.
>
>>
>> - card->ext_csd.cache_size =
>> - ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
>> - ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
>> - ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
>> - ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
>> + card->ext_csd.cache_size =
>> + ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
>> + ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
>> + ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
>> + ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
>> + }
>>
>> out:
>> return err;
>
> The rest looks good, thanks,
>
> - Chris.
> --
> Chris Ball <cjb@laptop.org> <http://printf.net/>
> One Laptop Per Child
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: Kernel BUG unable to handle kernel NULL pointer dereference
From: Leonidas Spyropoulos @ 2011-10-24 11:33 UTC (permalink / raw)
To: dsterba; +Cc: Mitch Harder, linux-btrfs
In-Reply-To: <20111024112259.GE26547@ds.suse.cz>
On Mon, Oct 24, 2011 at 12:22 PM, David Sterba <dsterba@suse.cz> wrote:
> On Sun, Oct 23, 2011 at 07:24:42PM +0100, Leonidas Spyropoulos wrote:
>> On Sun, Oct 23, 2011 at 4:37 PM, Mitch Harder
>> <mitch.harder@sabayonlinux.org> wrote:
>> > A patch was submitted by Sergei Trofimovich to address the issue w=
ith
>> > handling a NULL pointer in btrfs_print_leaf.
>> >
>> > http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg12021.h=
tml
>
> afaik the patch should be enqueued for 3.2
>
>> How can I track down the real problem? Any suggestions?
>
> The preceding function in the stack was __btrfs_free_extent, there ar=
e 3
> instances of btrfs_print_leaf() in that function, 2 of them relevant:
>
> 4470 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
printk(KERN_ERR "umm, got %d back from search"
> 4471 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0", was looking for %llu\n", ret,
> 4472 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0(unsigned long long)bytenr);
>
>
> 4494 #ifdef BTRFS_COMPAT_EXTENT_TREE_V0
> ...
> 4511 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_ERR =
"umm, got %d back from search"
> 4512 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"=
, was looking for %llu\n", ret,
> 4513 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(=
unsigned long long)bytenr);
> 4514 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 btrfs_print_leaf=
(extent_root, path->nodes[0]);
> ...
> =A0 =A0 #endif
>
> and the third one without a pre-message
>
> 4481 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 btrfs_print_leaf(extent_root, pa=
th->nodes[0]);
> 4482 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 WARN_ON(1);
> 4483 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_ERR "btrfs unable to=
find ref byte nr %llu "
> 4484 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"parent %llu root=
%llu =A0owner %llu offset %llu\n",
> 4485 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long lo=
ng)bytenr,
> 4486 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long lo=
ng)parent,
> 4487 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long lo=
ng)root_objectid,
> 4488 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long lo=
ng)owner_objectid,
> 4489 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long lo=
ng)owner_offset);
>
>
> your original report does not contain any messages before the BUG
> listing, so I'm not sure which one it is.
I got the whole log somwehre lying arround, let me find it and give a
pastbin link
Here is it, it's big and contains usless information..
http://paste.pocoo.org/show/497299/
>
> Supposed it's the 3rd, it's resulting from an error returned by
>
> 4429 =A0 =A0 =A0 =A0 ret =3D lookup_extent_backref(trans, extent_root=
, path, &iref,
> 4430 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 bytenr, num_bytes, parent,
> 4431 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 root_objectid, owner_objectid,
> 4432 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 owner_offset);
>
> ret !=3D 0 -> print leaf etc, a missing backref could be the problem =
here.
>
> Are you able to trigger the BUG() repeatedly?
No I cannot reproduce it intentionally, it was quite random, while
playing something in the SMPlayer - think it was a movie. The movie
kept playing, and I can start programs (that was on the memory I
assume), couldn't access the FS at all. ls failed for example.
So I just hard-reboot and hoped all was alright.
So far I didn't see any problems after that.
>
>
> david
>
Thanks for checking it
Regards
Leonidas
--=20
Caution: breathing may be hazardous to your health.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re:Fantastic! Have you ever dream about visiting really interesting site? Your dream will come true now!
From: bfeely @ 2011-10-24 11:32 UTC (permalink / raw)
To: lighth7015, linux-kernel, listserv, literature, lpulsifer
...Don�t waste your time!
http://www.rotabrasil.com.br/com.friend.php?ylink_friend_id=64hj1
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
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.