Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources
On Thu, 6 Dec 2007, Benjamin Herrenschmidt wrote: On Wed, 2007-12-05 at 22:39 -0800, Greg KH wrote: that is it can be either unsigned int, unsigned long or unsigned long long... and we have no way to reliably printk that. We do this already just fine. Take a look in the kernel, I think we just always cast it to long long to be uniform. I wanted to avoid that for two reasons: - casts are fugly - it adds support code to cast handle 64 bits to 32 bits platforms that wouldn't normally need it Indeed. I still have a few places to fix it up in the Zorro bus code and drivers. Everything is 32 bit, but allyesconfig sets CONFIG_RESOURCES_64BIT... In some way I liked the recent suggestion to make CONFIG_RESOURCES_64BIT depend on something... Now, if you really think that's the way to go, I'll respin with casts (I've used cast in subsequent patches merging bits pieces of the powerpc 32 and 64 bits PCI code too in fact). And casting to `unsigned long' for Zorro bus may sound fine, except what if one day we'll need 64-bit resources for one platform? I was just hoping somebody had a better idea, like a way to add a new format specifier to printk without losing gcc type checking :-) #define PRI* (...) ;-) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [EMAIL PROTECTED] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources
On Thu, Dec 06, 2007 at 06:58:54PM +1100, Benjamin Herrenschmidt wrote: I was just hoping somebody had a better idea, like a way to add a new format specifier to printk without losing gcc type checking :-) It's been discussed before. Some of the solutions discussed: - Add something like PRI_RES which can be concatenated into a printk. Ugly. - Patch gcc to allow user-definable types. I think OpenBSD has a patch for this. Then we have to get that patch propagated to all the people who compile the kernel. Unappetising. - Disable gcc's printk checking, teach sparse to typecheck printk. Most people don't run sparse yet. -- Intel are signing my paycheques ... these opinions are still mine Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
proc/bus.usb regression in : [NETNS]: Fix /proc/net breakage
Andrew Morton wrote: On Mon, 3 Dec 2007 19:00:25 GMT Linux Kernel Mailing List linux-kernel@vger.kernel.org wrote: Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b1e300a9dfc3196ccddf6f1d74b91b7af55e416 Commit: 2b1e300a9dfc3196ccddf6f1d74b91b7af55e416 Parent: e03ba84adb62fbc6049325a5bc00ef6932fa5e39 Author: Eric W. Biederman [EMAIL PROTECTED] AuthorDate: Sun Dec 2 00:33:17 2007 +1100 Committer: Herbert Xu [EMAIL PROTECTED] CommitDate: Sun Dec 2 00:33:17 2007 +1100 [NETNS]: Fix /proc/net breakage Well I clearly goofed when I added the initial network namespace support for /proc/net. Currently things work but there are odd details visible to user space, even when we have a single network namespace. Since we do not cache proc_dir_entry dentries at the moment we can just modify -lookup to return a different directory inode depending on the network namespace of the process looking at /proc/net, replacing the current technique of using a magic and fragile follow_link method. To accomplish that this patch: - introduces a shadow_proc method to allow different dentries to be returned from proc_lookup. - Removes the old /proc/net follow_link magic - Fixes a weakness in our not caching of proc generic dentries. As shadow_proc uses a task struct to decided which dentry to return we can go back later and fix the proc generic caching without modifying any code that uses the shadow_proc method. This patch caused the binfmt_misc regression reported in http://bugzilla.kernel.org/show_bug.cgi?id=9504 This patch also doesn't allow to mount /proc/bus/usb ciao cate -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: proc/bus.usb regression in : [NETNS]: Fix /proc/net breakage
On Thu, 06 Dec 2007 09:21:53 +0100 Giacomo Catenazzi [EMAIL PROTECTED] wrote: Andrew Morton wrote: On Mon, 3 Dec 2007 19:00:25 GMT Linux Kernel Mailing List linux-kernel@vger.kernel.org wrote: Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b1e300a9dfc3196ccddf6f1d74b91b7af55e416 Commit: 2b1e300a9dfc3196ccddf6f1d74b91b7af55e416 Parent: e03ba84adb62fbc6049325a5bc00ef6932fa5e39 Author: Eric W. Biederman [EMAIL PROTECTED] AuthorDate: Sun Dec 2 00:33:17 2007 +1100 Committer: Herbert Xu [EMAIL PROTECTED] CommitDate: Sun Dec 2 00:33:17 2007 +1100 [NETNS]: Fix /proc/net breakage Well I clearly goofed when I added the initial network namespace support for /proc/net. Currently things work but there are odd details visible to user space, even when we have a single network namespace. Since we do not cache proc_dir_entry dentries at the moment we can just modify -lookup to return a different directory inode depending on the network namespace of the process looking at /proc/net, replacing the current technique of using a magic and fragile follow_link method. To accomplish that this patch: - introduces a shadow_proc method to allow different dentries to be returned from proc_lookup. - Removes the old /proc/net follow_link magic - Fixes a weakness in our not caching of proc generic dentries. As shadow_proc uses a task struct to decided which dentry to return we can go back later and fix the proc generic caching without modifying any code that uses the shadow_proc method. This patch caused the binfmt_misc regression reported in http://bugzilla.kernel.org/show_bug.cgi?id=9504 This patch also doesn't allow to mount /proc/bus/usb Does Denis's patch fix it? Thanks. From: Denis V. Lunev [EMAIL PROTECTED] /proc/sys/fs/binfmt_misc dentry disappeared during d_revalidate. d_revalidate only dentries from shadowed one and below. http://bugzilla.kernel.org/show_bug.cgi?id=9504 Cc: Eric W. Biederman [EMAIL PROTECTED] Cc: Marcus Better [EMAIL PROTECTED] Signed-off-by: Denis V. Lunev [EMAIL PROTECTED] Cc: Marcus Better [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] --- fs/proc/generic.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff -puN fs/proc/generic.c~lost-content-of-proc-sys-fs-binfmt_misc fs/proc/generic.c --- a/fs/proc/generic.c~lost-content-of-proc-sys-fs-binfmt_misc +++ a/fs/proc/generic.c @@ -380,12 +380,17 @@ static int proc_revalidate_dentry(struct return 0; } -static struct dentry_operations proc_dentry_operations = +static struct dentry_operations proc_dentry_shadow_operations = { .d_delete = proc_delete_dentry, .d_revalidate = proc_revalidate_dentry, }; +static struct dentry_operations proc_dentry_operations = +{ + .d_delete = proc_delete_dentry, +}; + /* * Don't create negative dentries here, return -ENOENT by hand * instead. @@ -394,6 +399,7 @@ struct dentry *proc_lookup(struct inode { struct inode *inode = NULL; struct proc_dir_entry * de; + int use_shadow = 0; int error = -ENOENT; lock_kernel(); @@ -406,8 +412,10 @@ struct dentry *proc_lookup(struct inode if (!memcmp(dentry-d_name.name, de-name, de-namelen)) { unsigned int ino; - if (de-shadow_proc) + if (de-shadow_proc) { de = de-shadow_proc(current, de); + use_shadow = 1; + } ino = de-low_ino; de_get(de); spin_unlock(proc_subdir_lock); @@ -423,6 +431,8 @@ struct dentry *proc_lookup(struct inode if (inode) { dentry-d_op = proc_dentry_operations; + dentry-d_op = use_shadow ? + proc_dentry_shadow_operations : dentry-d_parent-d_op; d_add(dentry, inode); return NULL; } _ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] capabilities: introduce per-process capability bounding set (v10)
Andrew Morgan wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 KaiGai Kohei wrote: BTW, could you tell me your intention about pam_cap.c is implemented with pam_sm_authenticate() and pam_sm_setcred()? I think it can be done with pam_sm_open_session(), and this approach enables to reduce the iteration of reading /etc/security/capability.conf. How do you think the idea? Good question! If you want to add session support you can. I'd prefer it if you retained support for the auth/cred API too: admin choice and all that. To remove the second read of the file, you can use a PAM data item to cache the desired capability info after the first read of the file. I added session API support with retaining auth/cred API, and PAM data item caching feature using pam_(get|set)_data. It enables to kill the seconf read of the configuration file. Thanks for your suggestion. Followings are detailed explanation and the patch. I implemented it as a credential module (which has to get the authentication return code right to make the credential stack execute correctly) because I think of capabilities as credentials. That being said, the credentials vs. session thing is not well delineated by many applications, so it is arguably useful to provide both interfaces for the admin to make use of on a per application basis. The attached patch provides several improvement for pam_cap module. 1. It enables pam_cap to drop capabilities from process'es capability bounding set. 2. It enables to specify allowing inheritable capability set or dropping bounding capability set for groups, not only users. 3. It provide pam_sm_session() method, not only pam_sm_authenticate() and pam_sm_setcred(). A system administrator can select more appropriate mode for his purpose. 4. In the auth/cred mode, it enables to cache the configuration file, to avoid read and analyze it twice. (Therefore, most of the part in the original one got replaced) The default configuration file is /etc/security/capability.conf. You can describe as follows: # kaigai get cap_net_raw and cap_kill, tak get cap_sys_pacct pI. # We can omit i: in the head of each line. i:cap_net_raw,cap_kill kaigai cap_sys_pacct tak # ymj and tak lost cap_sys_chroot from cap_bset b:cap_sys_chroot ymj tak # Any user within webadm group get cap_net_bind_service pI. i:cap_net_bind_service @webadm # Any user within users group lost cap_sys_module from cap_bset b:cap_sys_module @users When a user or groups he belongs is on several lines, all configurations are simplly compounded. In the above example, if tak belongs to webadm and users group, he will get cap_sys_pacct and cap_net_bind_service pI, and lost cap_sys_chroot and cap_sys_module from his cap_bset. Thanks, -- OSS Platform Development Division, NEC KaiGai Kohei [EMAIL PROTECTED] Signed-off-by: KaiGai Kohei [EMAIL PROTECTED] -- pam_cap/capability.conf |6 + pam_cap/pam_cap.c | 495 --- 2 files changed, 305 insertions(+), 196 deletions(-) diff --git a/pam_cap/capability.conf b/pam_cap/capability.conf index b543142..707cdc3 100644 --- a/pam_cap/capability.conf +++ b/pam_cap/capability.conf @@ -24,6 +24,12 @@ cap_setfcap morgan ## 'everyone else' gets no inheritable capabilities none * +# user 'kaigai' lost CAP_NET_RAW capability from bounding set +b:cap_net_raw kaigai + +# group 'acctadm' get CAP_SYS_PACCT inheritable capability +i:cap_sys_pacct @acctadm + ## if there is no '*' entry, all users not explicitly mentioned will ## get all available capabilities. This is a permissive default, and ## probably not what you want... diff --git a/pam_cap/pam_cap.c b/pam_cap/pam_cap.c index 94c5ebc..a917d5c 100644 --- a/pam_cap/pam_cap.c +++ b/pam_cap/pam_cap.c @@ -1,5 +1,6 @@ /* * Copyright (c) 1999,2007 Andrew G. Morgan [EMAIL PROTECTED] + * Copyright (c) 2007 KaiGai Kohei [EMAIL PROTECTED] * * The purpose of this module is to enforce inheritable capability sets * for a specified user. @@ -13,298 +14,400 @@ #include stdarg.h #include stdlib.h #include syslog.h +#include pwd.h +#include grp.h #include sys/capability.h +#include sys/prctl.h #include security/pam_modules.h #include security/_pam_macros.h +#define MODULE_NAMEpam_cap #define USER_CAP_FILE /etc/security/capability.conf #define CAP_FILE_BUFFER_SIZE4096 #define CAP_FILE_DELIMITERS \t\n -#define CAP_COMBINED_FORMAT %s all-i %s+i -#define CAP_DROP_ALL%s all-i + +#ifndef PR_CAPBSET_DROP +#define PR_CAPBSET_DROP24 +#endif + +extern char const *_cap_names[]; struct pam_cap_s { int debug; const char *user; const char *conf_filename; +/* set in read_capabilities_for_user() */ +cap_t result; +int do_set_inh : 1; +int do_set_bset : 1; }; -/* obtain the
Re: proc/bus.usb regression in : [NETNS]: Fix /proc/net breakage
Giacomo Catenazzi [EMAIL PROTECTED] writes: Andrew Morton wrote: On Mon, 3 Dec 2007 19:00:25 GMT Linux Kernel Mailing List linux-kernel@vger.kernel.org wrote: Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2b1e300a9dfc3196ccddf6f1d74b91b7af55e416 Commit: 2b1e300a9dfc3196ccddf6f1d74b91b7af55e416 Parent: e03ba84adb62fbc6049325a5bc00ef6932fa5e39 Author: Eric W. Biederman [EMAIL PROTECTED] AuthorDate: Sun Dec 2 00:33:17 2007 +1100 Committer: Herbert Xu [EMAIL PROTECTED] CommitDate: Sun Dec 2 00:33:17 2007 +1100 [NETNS]: Fix /proc/net breakage Well I clearly goofed when I added the initial network namespace support for /proc/net. Currently things work but there are odd details visible to user space, even when we have a single network namespace. Since we do not cache proc_dir_entry dentries at the moment we can just modify -lookup to return a different directory inode depending on the network namespace of the process looking at /proc/net, replacing the current technique of using a magic and fragile follow_link method. To accomplish that this patch: - introduces a shadow_proc method to allow different dentries to be returned from proc_lookup. - Removes the old /proc/net follow_link magic - Fixes a weakness in our not caching of proc generic dentries. As shadow_proc uses a task struct to decided which dentry to return we can go back later and fix the proc generic caching without modifying any code that uses the shadow_proc method. This patch caused the binfmt_misc regression reported in http://bugzilla.kernel.org/show_bug.cgi?id=9504 This patch also doesn't allow to mount /proc/bus/usb Agreed. Strictly speaking the mounts work but we just can't find them. It is equally bad either way. Eric -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] ext2: xip check fix
Nick Piggin wrote: Xip does only work, if both do match PAGE_SIZE because it does'nt support multiple calls to direct_access in the get_xip_page address space operation. Thus we check both here, actually this was changed from how it looks after your patch as a bugfix where our tester tried a 4k filesystem on a 2k blockdev. Did I miss something? However, the bdev block size may be changed with sb_set_blocksize. It doesn't actually have to match the hardware sector size -- if this does matter for XIP, then I think you need some other check here. Hhh. For a bdev with PAGE_SIZE hardsect size, there is no other valid value then PAGE_SIZE that one could set it to. Or can it indeed be changed to a value greater then PAGE_SIZE or smaller then hardsect size? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: sockets affected by IPsec always block (2.6.23)
Am Donnerstag, 6. Dezember 2007 03:25 schrieb David Miller: POSIX says nothing about the semantics of route resolution. Of course not. Applications must not care about what happens at the transport layer. Non-blocking doesn't mean cannot sleep no matter what. ... and as O_CREAT on open() isn't specifically documented to apply to filenames starting with 'a', it is perfectly normal that echo x ash always fails since 2.6.22. To revert to the old behaviour, please do echo 1 /proc/sys/fs/allow_a_file_creation. Ok, irony aside. Just have a look at http://www.opengroup.org/onlinepubs/009695399/functions/connect.html (I hope 009695399 is not a personalition cookie ;-) If the connection cannot be established immediately and O_NONBLOCK is set for the file descriptor for the socket, connect() shall fail and set errno to [EINPROGRESS], but the connection request shall not be aborted, and the connection shall be established asynchronously. I think the words shall fail and immediately are quite clear. If this is changed for some IP sockets, event-driven applications will randomly and subtly break. If this was such a clear cut case we'd have changed things a long time ago, but it isn't so don't pretend this is the case. Well, the only reason this doesn't break on a daily basis is because the code isn't in the kernel that long and not many people run applications on an IPSEC gateway. This will change if kernel based IPSEC is used for roadwarrior connections or dnssec based anonymous IPSEC someday. Trust me, you will revert this misbehaviour in -stable then. For some real life applications that break when nonblocking connect() blocks, please look f.e. at squid or mozilla firefox. Stefan -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] ext2: xip check fix
On Thu, Dec 06, 2007 at 09:43:27AM +0100, Carsten Otte wrote: Nick Piggin wrote: Xip does only work, if both do match PAGE_SIZE because it does'nt support multiple calls to direct_access in the get_xip_page address space operation. Thus we check both here, actually this was changed from how it looks after your patch as a bugfix where our tester tried a 4k filesystem on a 2k blockdev. Did I miss something? However, the bdev block size may be changed with sb_set_blocksize. It doesn't actually have to match the hardware sector size -- if this does matter for XIP, then I think you need some other check here. Hhh. For a bdev with PAGE_SIZE hardsect size, there is no other valid value then PAGE_SIZE that one could set it to. Or can it indeed be changed to a value greater then PAGE_SIZE or smaller then hardsect size? It can't be made smaller (or larger, in current kernels). But you already get all that checking done for you -- both by checking that the filesystem blocksize == PAGE_SIZE, and by the error checking in sb_set_blocksize. After my patch, we can do XIP in a hardsect size PAGE_SIZE block device -- this seems to be a fine thing to do at least for the ramdisk code. Would this situation be problematic for existing drivers, and if so, in what way? Thanks, Nick -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: sockets affected by IPsec always block (2.6.23)
From: Stefan Rompf [EMAIL PROTECTED] Date: Thu, 6 Dec 2007 09:49:01 +0100 If the connection cannot be established immediately and O_NONBLOCK is set for the file descriptor for the socket, connect() shall fail and set errno to [EINPROGRESS], but the connection request shall not be aborted, and the connection shall be established asynchronously. I think the words shall fail and immediately are quite clear. They are, but the context in which they apply is vague. I can equally generate examples where the non-blocking behavior you are a proponent of would break non-blocking UDP apps during a sendmsg() call when we hit IPSEC resolution. Yet similar language on blocking semantics exists for sendmsg() in the standards. The world is shades of gray, implying anything else is foolhardy and that's how I'm handling this. Well, the only reason this doesn't break on a daily basis is because the code isn't in the kernel that long and not many people run applications on an IPSEC gateway. This will change if kernel based IPSEC is used for roadwarrior connections or dnssec based anonymous IPSEC someday. Trust me, you will revert this misbehaviour in -stable then. I use IPSEC every single day in this fashion, and I haven't. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
man-pages-2.70 is released
Gidday, Some news: * man-pages now has an (irregularly updated) blog: http://linux-man-pages.blogspot.com/ * Since man-pages-2.69, each man page now includes a COLOPHON section at the end of the page which indicates the version of man-pages in which this page is released, and also contains a pointer to the man-pages web site. Repeating some old news: * man-pages now has a website: http://www.kernel.org/doc/man-pages The site includes HTML versions of the current set of man-pages. * The list [EMAIL PROTECTED] has been created for the purpose of discussing Linux man page bugs, patches, and maintenance. To subscribe, send a message to [EMAIL PROTECTED], with the body: subscribe linux-man Back to the news as usual... I recently released man-pages-2.70. This release is now available for download at: http://www.kernel.org/pub/linux/docs/man-pages or ftp://ftp.kernel.org/pub/linux/docs/man-pages (Note the s/manpages/man-pages/ in these paths; a symlink with the old path will exist for a limited time.) Changes in this release consist primarily of formatting and consistency fixes. Cheers, Michael (man-pages maintenance is supported by Google, as a Google engineer 20% project.) -- Michael Kerrisk Maintainer of the Linux man-pages project http://www.kernel.org/doc/man-pages/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 27/28] blk_end_request: changing scsi mid-layer for bidi (take 3)
On Thu, Dec 06 2007 at 2:26 +0200, Kiyoshi Ueda [EMAIL PROTECTED] wrote: Hi Boaz, On Tue, 04 Dec 2007 15:39:12 +0200, Boaz Harrosh [EMAIL PROTECTED] wrote: On Sat, Dec 01 2007 at 1:35 +0200, Kiyoshi Ueda [EMAIL PROTECTED] wrote: This patch converts bidi of scsi mid-layer to use blk_end_request(). rq-next_rq represents a pair of bidi requests. (There are no other use of 'next_rq' of struct request.) For both requests in the pair, end_that_request_chunk() should be called before end_that_request_last() is called for one of them. Since the calls to end_that_request_first()/chunk() and end_that_request_last() are packaged into blk_end_request(), the handling of next_rq completion has to be moved into blk_end_request(), too. Bidi sets its specific value to rq-data_len before the request is completed so that upper-layer can read it. This setting must be between end_that_request_chunk() and end_that_request_last(), because rq-data_len may be used in end_that_request_chunk() by blk_trace and so on. To satisfy the requirement, use blk_end_request_callback() which is added in PATCH 25 only for the tricky drivers. If bidi didn't reuse rq-data_len and added new members to request for the specific value, it could set before end_that_request_chunk() and use the standard blk_end_request() like below. void scsi_end_bidi_request(struct scsi_cmnd *cmd) { struct request *req = cmd-request; rq-resid = scsi_out(cmd)-resid; rq-next_rq-resid = scsi_in(cmd)-resid; if (blk_end_request(req, 1, req-data_len)) BUG(); scsi_release_buffers(cmd); scsi_next_command(cmd); } ... snip ... rq-data_len = scsi_out(cmd)-resid is Not Just a problem of bidi it is a General problem of scsi residual handling, and user code. Even today before any bidi. at scsi_lib.c at scsi_io_completion() we do req-data_len = scsi_get_resid(cmd); ( or: req-data_len = cmd-resid; depends which version you look) And then call scsi_end_request() which calls __end_that_request_first/last So it is assumed even today that req-data_len is not touched by __end_that_request_first/last unless __end_that_request_first returned that there is more work to do and the command is resubmitted in which case the resid information is discarded. So if the regular resid handling is acceptable - Set req-data_len before the call to __end_that_request_first/last, or blk_end_request() in your case, then here goes your second client of the _callback and it can be removed. But if it is found that req-data_len is touched and the resid information gets lost, than it should be fixed for the common uni-io case, by - for example - pass resid to the blk_end_request() function. (So in any way the _callback can go) Thank you for the explanation of scsi's rq-data_len usage. I see that scsi usually uses rq-data_len for cmd-resid. I have investigated the possibility of setting data_len before the call to blk_end_request. But no matter whether data_len is touched or not, we need a callback for bidi. So I would like to go with the current patch. I explained the reason and some details below. As far as I can see, rq-data_len is just referenced by blk_add_trace_rq() in __end_that_request_first(), not modified. And I don't change any logic around there in the block-layer. So there shouldn't be any critical problem for scsi residual handing. (although I'm not sure that scsi expectes cmd-resid to be traced by blk_trace.) Anyway, I see that it is no critical problem for bidi to set cmd-resid to rq-data_len before blk_end_request() call. But if I do that, blk_end_request() can't get the next_rq's size to complete in its code below. +/* Bidi request must be completed as a whole */ +if (blk_bidi_rq(rq) +__end_that_request_first(rq-next_rq, uptodate, + blk_rq_bytes(rq-next_rq))) +return 1; So I will have to move next_rq completion to bidi and use _callback() anyway like the following. - static int dummy_cb(struct request *rq) { return 1; } void scsi_end_bidi_request(struct scsi_cmnd *cmd) { struct request *req = cmd-request; unsigned int dlen = req-data_len; unsigned int next_dlen = req-next_rq-data_len; req-data_len = scsi_out(cmd)-resid; req-next_rq-data_len = scsi_in(cmd)-resid; /* Complete only DATA of next_rq using _callback and dummy function */ if (!blk_end_request_callback(req-next_rq, 1, next_dlen, dummy_cb)) BUG(); if (blk_end_request(req, 1, dlen)) BUG(); scsi_release_buffers(cmd); scsi_next_command(cmd); } - I prefer the current patch rather than the code like above, since the code calls
Re: Reproducible data corruption with sendfile+vsftp - splice regression?
On Wed, 05 Dec 2007 23:54:29 +0100, Francois Romieu wrote: Holger Hoffstaette [EMAIL PROTECTED] : [...] Should I file this in bugzilla? Yes. Thanks for responding - will do. I verified with 2.6.24-rc4 (same bug) and have some new information about this. Despite my previous posting the corruption is NOT triggered by NAPI. It may be related, but even without NAPI but tso on again I got corruption, now also on the gbit client (Thinkpad T60). When ftp'ing to ramdisk with full speed (at a reasonable ~77 MB/sec) it often works, but intermediate writes that cause the ftp to temporarily slow down reliably cause corrupted files, so I guess tso gets confused when some kind of throttling sets in during transfer. That is probably why I first noticed it on the slow 100mbit client. Maybe turning off sendfile or NAPI just lead to random success - so far it really looks like tso on the r8169 is the common cause. thank you Holger -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] POWERPC: don't cast a pointer to pointer of list_head
The casting is safe only when the list_head member is the first member of the structure. Signed-off-by: Li Zefan [EMAIL PROTECTED] --- arch/ppc/syslib/ocp.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c index 3f5be2c..d42d408 100644 --- a/arch/ppc/syslib/ocp.c +++ b/arch/ppc/syslib/ocp.c @@ -376,7 +376,7 @@ ocp_remove_one_device(unsigned int vendor, unsigned int function, int index) down_write(ocp_devices_sem); dev = __ocp_find_device(vendor, function, index); - list_del((struct list_head *)dev); + list_del(dev-link); up_write(ocp_devices_sem); DBG((ocp: ocp_remove_one_device(vendor: %x, function: %x, index: %d)... done.\n, vendor, function, index)); -- 1.5.3.rc7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] DRM: don't cast a pointer to pointer of list_head
The casting is safe only when the list_head member is the first member of the structure. Signed-off-by: Li Zefan [EMAIL PROTECTED] --- drivers/char/drm/i915_irq.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index a443f4a..e9e8522 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c @@ -555,7 +555,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, spin_lock_irqsave(dev_priv-swaps_lock, irqflags); - list_add_tail((struct list_head *)vbl_swap, dev_priv-vbl_swaps.head); + list_add_tail(vbl_swap-head, dev_priv-vbl_swaps.head); dev_priv-swaps_pending++; spin_unlock_irqrestore(dev_priv-swaps_lock, irqflags); -- 1.5.3.rc7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] iwlwifi3945/4965 - fix rate control algo reference leak
Hi Thomas, could you test this one please. --- From: Cyrill Gorcunov [EMAIL PROTECTED] Subject: [PATCH] iwlwifi3945/4965 - fix rate control algo reference leak This patch does fix rate control algo reference leak in case if network device has been failed to register. In this case special flag priv-mac80211_registered is not set and the rate algo reference is not freeing on module unload. That leads to OOPs in further ieee80211 rate register/unregister procedure (by any callee). It should fix the bug #9470 http://bugzilla.kernel.org/show_bug.cgi?id=9470 Signed-off-by: Cyrill Gorcunov [EMAIL PROTECTED] --- drivers/net/wireless/iwlwifi/iwl3945-base.c |1 + drivers/net/wireless/iwlwifi/iwl4965-base.c |1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 465da4f..c222bec 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -6167,6 +6167,7 @@ static void iwl_alive_start(struct iwl_priv *priv) mutex_lock(priv-mutex); if (rc) { + iwl_rate_control_unregister(priv-hw); IWL_ERROR(Failed to register network device (error %d)\n, rc); return; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 9918780..9295755 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -6523,6 +6523,7 @@ static void iwl_alive_start(struct iwl_priv *priv) mutex_lock(priv-mutex); if (rc) { + iwl_rate_control_unregister(priv-hw); IWL_ERROR(Failed to register network device (error %d)\n, rc); return; -- 1.5.3.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] zfcp: add some internal zfcp adapter statistics
On Monday 26 November 2007 11:23, Swen Schillig wrote: On Sunday 25 November 2007 12:16, James Bottomley wrote: On Wed, 2007-10-31 at 11:33 +0100, Swen Schillig wrote: From: Swen Schillig [EMAIL PROTECTED] add some statistics provided by the zFCP adapter to the sysfs The new zFCP adapter statistics provide a variety of information about the virtual adapter (subchannel). In order to collect this information the zFCP driver is extended on one side to query the adapter and on the other side summarize certain values which can then be fetched on demand. This information is made available via files(attributes) in the sysfs filesystem. The information provided by the new zFCP adapter statistics can be fetched by reading from the following files in the sysfs filesystem /sys/class/scsi_host/hostn/seconds_active /sys/class/scsi_host/hostn/requests /sys/class/scsi_host/hostn/megabytes /sys/class/scsi_host/hostn/utilization This lot all look like they belong in the FC transport class statistics (some even already exist there). They might look alike but they are not the same. The values provided through the FC transport class always refer to the physical port whereas the new values here refer to a virtual adapter or subchannel. The attributes provided here are all new and not covered or displayed anywhere else ! These are the statistics on a virtual adapter (subchannel) level. In addition latency information is provided on a SCSI device level (LUN) which can be found at the following location /sys/class/scsi_device/H:C:T:L/device/cmd_latency /sys/class/scsi_device/H:C:T:L/device/read_latency /sys/class/scsi_device/H:C:T:L/device/write_latency These look to duplicate to some degree the figures in /sys/block/dev/stat. Isn't the block device the best place to gather these, if they're useful? Since user latencies should probably include elevator times. Actually no, the latencies covered here are channel- and fabric-latencies grouped by scsi-devices and not device-, scsi- or block-latencies. In contrast to the stats provided by the block-layer structure, tape devices will be covered here as well . James Cheers Swen James were my answers, comments sufficient enough to apply my patch or is there still something missing required ? Thanks Cheers Swen -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
2.6.23.9: x86_64: floppy not working: p35 chipset
Trying to format a floppy (2-3 of them) on a GA-P35-DS4 2.0 with a regular Sony floppy on Debian x86_64 with kernel 2.6.23.9: # fdformat /dev/fd0 Could not determine current format type: No such device # mformat a: mformat: Could not get geometry of device (No such device) # # cat /proc/interrupts |grep floppy 6: 38 37 39 41 IO-APIC-edge floppy # dmesg|grep -A1 fd0 [ 52.689487] Floppy drive(s): fd0 is 1.44M [ 52.704661] FDC 0 is a post-1991 82077 During the 'attempted format' [34324.175770] floppy0: probe failed... [34324.575342] floppy0: probe failed... [34324.974733] floppy0: probe failed... [34325.374302] floppy0: probe failed... [34325.773746] floppy0: probe failed... [34326.173312] floppy0: probe failed... [34326.572734] floppy0: probe failed... [34326.972241] floppy0: probe failed... [34327.371739] floppy0: probe failed... [34327.771344] floppy0: probe failed... [34328.170727] floppy0: probe failed... [34328.570283] floppy0: probe failed... [34328.969717] floppy0: probe failed... [34329.369275] floppy0: probe failed... [34329.768691] floppy0: probe failed... [34330.168197] floppy0: probe failed... [34330.168257] end_request: I/O error, dev fd0, sector 0 I've tried a few different floppies, the result is the same. The system is 64-bit only, no 32-bit emulation is enabled using a strict 64-bit-only userland. Has anyone else gotten their floppy drive to work under 64-bit? Is this just a case of a DOA floppy drive or is something else wrong? Justin. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 00/11] Text Edit Lock for 2.6.24-rc4-git3
On Wed, Dec 05, 2007 at 09:02:46PM -0500, Mathieu Desnoyers wrote: Hi, Here is a repost of the text edit lock for 2.6.24-rc4-mm3. It is useful to coordinate modification of live kernel code patching. It includes a modification to kprobes (its first user) and is useful for the Immediate Values. It could be interesting to queue it for 2.6.25. Everytime I see your huge patchset I'm wondering what it is good for and give up since the patch set is large. It would be very helpful if your patch descriptions would not only describe what you do but also why you do it. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] [PATCH] A clean approach to writeout throttling
On Wednesday 05 December 2007 23:31, Andrew Morton wrote: Rather than asking the stack how much memory will this request consume you could instead ask how much memory are you currently using. ie: on entry to the stack, do current-account_block_allocations = 1; make_request(...); rq-used_memory += current-pages_used_for_block_allocations; and in the page allocator do if (!in_interrupt() current-account_block_allocations) current-pages_used_for_block_allocations++; and then somehow handle deallocation too ;) Ah, and how do you ensure that you do not deadlock while making this inquiry? It isn't an inquiry - it's a plain old submit_bio() and it runs to completion in the usual fashion. Thing is, we wouldn't have called it at all if this queue was already over its allocation limit. IOW, we know that it's below its allocation limit, so we know it won't deadlock. Given, of course, reasonably pessimistc error margins. OK, I see what you are suggesting. Yes, one could set the inflight limit very low and the reserve very high, and run a bio through the stack (what I meant by inquiry) to discover the actual usage, then shrink the reserve accordingly. By also running a real bio through the stack we can discover something about the latency. So we would then know roughly how high the inflight limit should be set and how much the memalloc reserve should be increased to handle that particular driver instance. The big fly in this ointment is that we cannot possibly know that our bio followed the worst case resource consumption path, whereas it is fairly easy (hopefully) for a programmer to determine this statically. Which margins can even be observed at runtime: keep a running max of this stack's most-ever memory consumption (for a single call), and only submit a bio into it when its current allocation is less than (limit - that-max). Actually, your mechanism would always have to be operable at runtime, since inserting a new driver while the system is under heavy memory load is a perfectly valid operation and has to be reliable. Anyway, even if you run a bio through the stack lots of times (insert definition of lots here) you still cannot be sure that it has explored the worst case path. To put this in perspective, some of the deadlocks we have hunted down recently have taken days to manifest under artificially high load. It just takes that long to randomly explore a sufficient number of corner cases. Perhaps send a dummy transaction down the pipe? Even so, deadlock is possible, quite evidently so in the real life example I have at hand. Yours is essentially one of the strategies I had in mind, the other major one being simply to examine the whole stack, which presupposes some as-yet-nonexistant kernel wide method of representing block device stacks in all there glorious possible topology variations. We already have that, I think: blk_run_backing_dev(). One could envisage a similar thing which runs up and down the stack accumulating how much memory do you need for this request data, but I think that would be hard to implement and plain dumb. I don't think I quite communicated there. We don't actually have any generic notion of the block device stack. Device mapper has its own model, md has another model, and other stacking devices may have no model at all, just some through-coded hack. It would be worth fixing this problem as part of an effort to generalize the block IO model and make block devices in general look more like device mapper devices. But that would be a pretty big project, the need for which is not generally recognized. ...Something like automatically determining a workable locking strategy by analyzing running code, wouldn't that be a treat? I will hope for one of those under my tree at Christmas. I don't see any unviability. A small matter of coding. It would be a legendary hack. ...number of requests does not map well to the amount of resources consumed. In ddsnap for example, the amount of memory used by the userspace ddsnapd is roughly linear vs the number of pages transferred, not the number of requests. Yeah, one would need to be pretty pessimal. Perhaps unacceptably inaccurate, dunno. Orders of magnitude more reserve would need to be allocated in the case of ddsnap, since bio payload can vary through a big range, which is expected to get bigger as time goes by. So the few lines of extra code and the extra bio field needed to get a better fit is well worth the effort, or even indispensable. @@ -3221,6 +3221,13 @@ static inline void __generic_make_reques if (bio_check_eod(bio, nr_sectors)) goto end_io; + if (q q-metric !bio-bi_queue) { + int need = bio-bi_throttle = q-metric(bio); + bio-bi_queue = q; + /* FIXME: potential race if
Re: [patch] ext2: xip check fix
Nick Piggin wrote: After my patch, we can do XIP in a hardsect size PAGE_SIZE block device -- this seems to be a fine thing to do at least for the ramdisk code. Would this situation be problematic for existing drivers, and if so, in what way? I have done some archeology, and our ancient CVS logs show this check was introduced in early 2005 into our 2.6.x. codebase. However, it existed way before, and was copied from our prehistorical ext2 split named xip2 back in the old days of 2.4.x where we did not really have a block device behind because that one was scamped into the file system in a very queer way. After all, I don't see any risk in removing the check. The only driver we have that does direct_access is drivers/s390/block/dcssblk.c, and that one only supports block_size == PAGE_SIZE. I think the patch should go into mainline. Acked-by: Carsten Otte [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] wireless/libertas: don't cast a pointer to pointer of list_head
Don't cast struct foo * to struct list_head *, it's safe only when the list member is the first member of struct foo. Also don't cast struct list_head * to struct foo *. BTW: I'm not so sure where this patch should go to. Signed-off-by: Li Zefan [EMAIL PROTECTED] --- drivers/net/wireless/libertas/cmd.c | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index be5cfd8..0fce9bb 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -946,11 +946,10 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u spin_lock_irqsave(adapter-driver_lock, flags); if (addtail) { - list_add_tail((struct list_head *)cmdnode, - adapter-cmdpendingq); + list_add_tail(cmdnode-list, adapter-cmdpendingq); adapter-nr_cmd_pending++; } else - list_add((struct list_head *)cmdnode, adapter-cmdpendingq); + list_add(cmdnode-list, adapter-cmdpendingq); spin_unlock_irqrestore(adapter-driver_lock, flags); @@ -1068,7 +1067,7 @@ void __libertas_cleanup_and_insert_cmd(wlan_private * priv, struct cmd_ctrl_node return; cleanup_cmdnode(ptempcmd); - list_add_tail((struct list_head *)ptempcmd, adapter-cmdfreeq); + list_add_tail(ptempcmd-list, adapter-cmdfreeq); } static void libertas_cleanup_and_insert_cmd(wlan_private * priv, struct cmd_ctrl_node *ptempcmd) @@ -1558,8 +1557,9 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv) spin_lock_irqsave(adapter-driver_lock, flags); if (!list_empty(adapter-cmdfreeq)) { - tempnode = (struct cmd_ctrl_node *)adapter-cmdfreeq.next; - list_del((struct list_head *)tempnode); + tempnode = list_first_entry(adapter-cmdfreeq, + struct cmd_ctrl_node, list); + list_del(tempnode-list); } else { lbs_deb_host(GET_CMD_NODE: cmd_ctrl_node is not available\n); tempnode = NULL; @@ -1656,8 +1656,8 @@ int libertas_execute_next_command(wlan_private * priv) } if (!list_empty(adapter-cmdpendingq)) { - cmdnode = (struct cmd_ctrl_node *) - adapter-cmdpendingq.next; + cmdnode = list_first_entry(adapter-cmdpendingq, + struct cmd_ctrl_node, list); } spin_unlock_irqrestore(adapter-driver_lock, flags); @@ -1721,7 +1721,7 @@ int libertas_execute_next_command(wlan_private * priv) cpu_to_le16(CMD_SUBCMD_EXIT_PS)) { lbs_deb_host( EXEC_NEXT_CMD: ignore ENTER_PS cmd\n); - list_del((struct list_head *)cmdnode); + list_del(cmdnode-list); libertas_cleanup_and_insert_cmd(priv, cmdnode); ret = 0; @@ -1732,7 +1732,7 @@ int libertas_execute_next_command(wlan_private * priv) (adapter-psstate == PS_STATE_PRE_SLEEP)) { lbs_deb_host( EXEC_NEXT_CMD: ignore EXIT_PS cmd in sleep\n); - list_del((struct list_head *)cmdnode); + list_del(cmdnode-list); libertas_cleanup_and_insert_cmd(priv, cmdnode); adapter-needtowakeup = 1; @@ -1744,7 +1744,7 @@ int libertas_execute_next_command(wlan_private * priv) EXEC_NEXT_CMD: sending EXIT_PS\n); } } - list_del((struct list_head *)cmdnode); + list_del(cmdnode-list); lbs_deb_host(EXEC_NEXT_CMD: sending command 0x%04x\n, le16_to_cpu(cmdptr-command)); DownloadcommandToStation(priv, cmdnode); -- 1.5.3.rc7 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH 0/5] Union Mount: A Directory listing approach with lseek support
On Wed, Dec 05, Dave Hansen wrote: I think the key here is what kind of consistency we're trying to provide. If a directory is being changed underneath a reader, what kinds of guarantees do they get about the contents of their directory read? When do those guarantees start? Are there any at open() time? But we still want to be compliant to what POSIX defines. The problem isn't the consistency of the readdir result but the seekdir/telldir interface. IMHO that interface is totally broken: you need to be able to find every offset given by telldir since the last open. The problem is that seekdir isn't able to return errors. Otherwise you could just forbid seeking on union directories. Rather than give each _dirent_ an offset, could we give each sub-mount an offset? Let's say we have three members comprising a union mount directory. The first has 100 dirents, the second 200, and the third 10,000. When the first readdir is done, we populate the table like this: mount_offset[0] = 0; mount_offset[1] = 100; mount_offset[2] = 300; If someone seeks back to 150, then we subtrack the mount[1]'s offset (100), and realize that we want the 50th dirent from mount[1]. Yes, that is a nice idea and it is exactly what I have implemented in my patch series. But you forgot one thing: directories are not flat files. The dentry offset in a directory is a random cookie. Therefore it is not possible to have a linear mapping without allocating memory. I don't know whether we're bound to this: http://www.opengroup.org/onlinepubs/007908775/xsh/readdir.html If a file is removed from or added to the directory after the most recent call to opendir() or rewinddir(), whether a subsequent call to readdir() returns an entry for that file is unspecified. But that would seem to tell me that once you populate a table such as the one I've described and create it at open(dir) time, you don't actually ever need to update it. Yes, I'm using such a patch on our S390 buildservers to work around some readdir/seek/rm problem with old glibc versions. It seems to work but on the other hand this are really huge systems and I haven't run out of memory while doing a readdir yet ;) The proper way to implement this would be to cache the offsets on a per inode base. Otherwise the user could easily DoS this by opening a number of directories and never close them. Regards, Jan -- Jan Blunck [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: PS3: trouble with SPARSEMEM_VMEMMAP and kexec
On Thu, 6 Dec 2007, Geert Uytterhoeven wrote: On Thu, 6 Dec 2007, Yasunori Goto wrote: I'll try Milton's suggestion to pre-allocate the memory early. It seems that should work as long as nothing else before the hot-plug mem is added needs a large chunk. Hello. Geoff-san. Sorry for late response. Could you tell me the value of the following page_size calculation in vmemmap_populate()? I think this page_size may be too big value. -- int __meminit vmemmap_populate(struct page *start_page, unsigned long nr_pages, int node) : : unsigned long page_size = 1 mmu_psize_defs[mmu_linear_psize].shift; : --- 24 MiB Bummer, messing up bits and MiB. 16 MiB of course. With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone:+32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [EMAIL PROTECTED] Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
Re: PS3: trouble with SPARSEMEM_VMEMMAP and kexec
On Thu, 6 Dec 2007, Yasunori Goto wrote: I'll try Milton's suggestion to pre-allocate the memory early. It seems that should work as long as nothing else before the hot-plug mem is added needs a large chunk. Hello. Geoff-san. Sorry for late response. Could you tell me the value of the following page_size calculation in vmemmap_populate()? I think this page_size may be too big value. -- int __meminit vmemmap_populate(struct page *start_page, unsigned long nr_pages, int node) : : unsigned long page_size = 1 mmu_psize_defs[mmu_linear_psize].shift; : --- 24 MiB In addition, I remember that current add_memory() is designed for only 1 section's addition. (See: memory_probe_store() and sparse_mem_map_populate(). they require only for 1 section's mem_map by specifing PAGES_PER_SECTION.) The 1 section size for normal powerpc box is only 16MB. (IA64 - 1GB, x86-64 - 128MB). But, if my understanding is correct, PS3's add_memory() requires all of total memory. I'm afraid something other problems might be hidden in this issue yet. (However, I think Milton-san's suggestion is very desirable. If preallocation of hotadd works on ia64 too, I'm very glad.) PS3 initially starts with 128 MiB. Later hotplug is used to add the remaining memory (96 or 112 MIB, IIRC). With kind regards, Geert Uytterhoeven Software Architect Sony Network and Software Technology Center Europe The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium Phone:+32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [EMAIL PROTECTED] Internet: http://www.sony-europe.com/ Sony Network and Software Technology Center Europe A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
Re: [patch-early-RFC 00/10] LTTng architecture dependent instrumentation
hi Mathieu, * Mathieu Desnoyers [EMAIL PROTECTED] wrote: Hi, Here is the architecture dependent instrumentation for LTTng. [...] A fundamental observation about markers, and i raised this point many many months ago already, so it might sound repetitive, but i'm unsure wether it's addressed. Documentation/markers.txt still says: | * Purpose of markers | | A marker placed in code provides a hook to call a function (probe) | that you can provide at runtime. A marker can be on (a probe is | connected to it) or off (no probe is attached). When a marker is | off it has no effect, except for adding a tiny time penalty | (checking a condition for a branch) and space penalty (adding a few | bytes for the function call at the end of the instrumented function | and adds a data structure in a separate section). could you please eliminate the checking of the flag, and insert a pure NOP sequence by default (no extra branches), which is then patched in with a function call instruction sequence, when the trace point is turned on? (on architectures that have code patching infrastructure - such as x86) Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: bonding sysfs output
Jean Delvare [EMAIL PROTECTED] writes: On Mon, 26 Nov 2007 09:29:40 +0100, Wagner Ferenc wrote: On the policy side: some files are not applicable to some types of bonds, and return a single linefeed in that case. Except for one single case, which returns 'NA\n'. The patch changes these cases into emtpy files. IMHO a better approach would be to not create the files at all when they make no sense for a given type of bond. That would require much more in-depth changes in the sysfs code, I'm afraid. But see also the 5th patch in the series, which reponds to Jay's suggestion. And as such, goes in the opposite direction. -- Thanks, Feri. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] lost content of /proc/sys/fs/binfmt_misc
Denis V. Lunev [EMAIL PROTECTED] writes: /proc/sys/fs/binfmt_misc dentry disappeared during d_revalidate. d_revalidate only dentries from shadowed one and below. http://bugzilla.kernel.org/show_bug.cgi?id=9504 Denis this is decent except it doesn't completely close the possibility of leaking mounts. It just refuses to leak mounts on everything except /proc/net. Eric -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] ext2: xip check fix
On Thu, Dec 06, 2007 at 10:59:02AM +0100, Carsten Otte wrote: Nick Piggin wrote: After my patch, we can do XIP in a hardsect size PAGE_SIZE block device -- this seems to be a fine thing to do at least for the ramdisk code. Would this situation be problematic for existing drivers, and if so, in what way? I have done some archeology, and our ancient CVS logs show this check was introduced in early 2005 into our 2.6.x. codebase. However, it existed way before, and was copied from our prehistorical ext2 split named xip2 back in the old days of 2.4.x where we did not really have a block device behind because that one was scamped into the file system in a very queer way. OK, thanks for taking a look at that. It will be helpful for testing XIP with my new ramdisk driver (did you see the patch?). After all, I don't see any risk in removing the check. The only driver we have that does direct_access is drivers/s390/block/dcssblk.c, and that one only supports block_size == PAGE_SIZE. I think the patch should go into mainline. Actually another one's recently sprung up too (arch/powerpc/sysdev/axonram.c) but it looks like that one should be fine as it looks to be all simply memory mapped. Acked-by: Carsten Otte [EMAIL PROTECTED] Thanks! Andrew, would you queue this up for 2.6.25 please? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] stopmachine semaphore to mutex
* Daniel Walker [EMAIL PROTECTED] wrote: It's called stopmachine_mutex now, but it's a semaphore. So make it a struct mutex . Signed-off-by: Daniel Walker [EMAIL PROTECTED] Acked-by: Ingo Molnar [EMAIL PROTECTED] Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] printer port driver: semaphore to mutex
* Daniel Walker [EMAIL PROTECTED] wrote: The port_mutex is actually a semaphore, so easily converted to a struct mutex. Signed-off-by: Daniel Walker [EMAIL PROTECTED] Acked-by: Ingo Molnar [EMAIL PROTECTED] cool. How far away are we from being able to remove all the semaphore code? :-) Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] ext2: xip check fix
Nick Piggin wrote: OK, thanks for taking a look at that. It will be helpful for testing XIP with my new ramdisk driver (did you see the patch?). I have'nt looked at it yet. I do appreciate it, I think it might broaden the user-base of this feature which is up to now s390 only due to the fact that the flash memory extensions have not been implemented (yet?). And it enables testing xip on other platforms. The patch is on my must-read list. Actually another one's recently sprung up too (arch/powerpc/sysdev/axonram.c) but it looks like that one should be fine as it looks to be all simply memory mapped. Oh I know, the author's office is aproximately 500 meters away from mine, next building. I have'nt heared of anyone actually using that one lately. cheers, Carsten -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] proc: Do not invalidate dentries with submounts
If the dcache path to a mount point is ever broken it becomes impossible to unmount it, and we leak a vfsmount. Therefore it is not valid to invalidate dentries with mount points at or below them. This patch uses the have_submounts test as the other network filesystem revalidate routines do. Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/proc/base.c|9 + fs/proc/generic.c |5 + 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 0e71707..552d752 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1216,6 +1216,9 @@ static int pid_revalidate(struct dentry *dentry, struct nameidata *nd) put_task_struct(task); return 1; } + /* Force validity if something is mounted under us */ + if (inode S_ISDIR(inode-i_mode) have_submounts(dentry)) + return 1; d_drop(dentry); return 0; } @@ -1393,6 +1396,9 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) } put_task_struct(task); } + /* Force validity if something is mounted under us */ + if (inode S_ISDIR(inode-i_mode) have_submounts(dentry)) + return 1; d_drop(dentry); return 0; } @@ -2056,6 +2062,9 @@ static int proc_base_revalidate(struct dentry *dentry, struct nameidata *nd) put_task_struct(task); return 1; } + /* Force validity if something is mounted under us */ + if (inode S_ISDIR(inode-i_mode) have_submounts(dentry)) + return 1; d_drop(dentry); return 0; } diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 4abd568..233dcdc 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -370,6 +370,11 @@ static int proc_delete_dentry(struct dentry * dentry) static int proc_revalidate_dentry(struct dentry *dentry, struct nameidata *nd) { + struct inode *inode = dentry-d_inode; + + /* Force validity if something is mounted under us */ + if (inode S_ISDIR(inode-i_mode) have_submounts(dentry)) + return 1; d_drop(dentry); return 0; } -- 1.5.3.rc6.17.g1911 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: suspend-related lockdep warning
On Thu, 2007-12-06 at 01:21 +0100, Rafael J. Wysocki wrote: On Tuesday, 4 of December 2007, Andrew Morton wrote: [ 34.455096] ipw2200: Failed to send WEP_KEY: Command timed out. [ 34.911876] Syncing filesystems ... done. [ 34.934526] Freezing user space processes ... WARNING: at kernel/lockdep.c:2662 check_flags() [ 34.934917] Pid: 1922, comm: dbus-daemon Not tainted 2.6.24-rc3-mm3 #2 [ 34.935036] [c0104853] show_trace_log_lvl+0x12/0x25 [ 34.935142] [c010506c] show_trace+0xd/0x10 [ 34.935231] [c0105850] dump_stack+0x55/0x5d [ 34.935322] [c0136125] check_flags+0x7f/0x11a [ 34.935417] [c0139210] lock_acquire+0x3a/0x86 [ 34.935511] [c0318faf] _spin_lock+0x1c/0x49 [ 34.935603] [c0140fc7] refrigerator+0x13/0xc8 [ 34.935697] [c01270ac] get_signal_to_deliver+0x34/0x2e8 [ 34.935807] [c0102edc] do_notify_resume+0x8c/0x6fe [ 34.935907] [c0103a2c] work_notifysig+0x13/0x1b [ 34.936004] === [ 34.936072] irq event stamp: 253 [ 34.936133] hardirqs last enabled at (253): [c0103a8d] syscall_exit_work+0x11/0x26 [ 34.936294] hardirqs last disabled at (252): [c0103956] syscall_exit+0x14/0x25 [ 34.936446] softirqs last enabled at (0): [c011baf9] copy_process+0x300/0x1246 [ 34.936599] softirqs last disabled at (0): [] 0x0 [ 34.954308] (elapsed 0.01 seconds) done. [ 34.954389] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Hmm, do I understand correctly that lockdep expects us to disable interrupts before acquiring the task lock in refrigerator()? That would be strange. Ingo, can you have a look at this, please? No its complaining that the IRQ state changed without anybody telling it about it. Usually an unannotated cli/sti. The particular line it warns, (lockdep.c:2662), suggests... /me grabs a copy of 24-rc3-mm2 ... that hardirqs are disabled, but irq tracking thinks they are still enabled. So that would be an unannotated cli. signature.asc Description: This is a digitally signed message part
Re: [PATCH] proc: Do not invalidate dentries with submounts
you have changed the behavior of revalidation by shadows. I think it will be better to restore it and keep new one for shadows (and below) only, which has been done by my yesterday patch. Regards, Den Eric W. Biederman wrote: If the dcache path to a mount point is ever broken it becomes impossible to unmount it, and we leak a vfsmount. Therefore it is not valid to invalidate dentries with mount points at or below them. This patch uses the have_submounts test as the other network filesystem revalidate routines do. Signed-off-by: Eric W. Biederman [EMAIL PROTECTED] --- fs/proc/base.c|9 + fs/proc/generic.c |5 + 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 0e71707..552d752 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1216,6 +1216,9 @@ static int pid_revalidate(struct dentry *dentry, struct nameidata *nd) put_task_struct(task); return 1; } + /* Force validity if something is mounted under us */ + if (inode S_ISDIR(inode-i_mode) have_submounts(dentry)) + return 1; d_drop(dentry); return 0; } @@ -1393,6 +1396,9 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd) } put_task_struct(task); } + /* Force validity if something is mounted under us */ + if (inode S_ISDIR(inode-i_mode) have_submounts(dentry)) + return 1; d_drop(dentry); return 0; } @@ -2056,6 +2062,9 @@ static int proc_base_revalidate(struct dentry *dentry, struct nameidata *nd) put_task_struct(task); return 1; } + /* Force validity if something is mounted under us */ + if (inode S_ISDIR(inode-i_mode) have_submounts(dentry)) + return 1; d_drop(dentry); return 0; } diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 4abd568..233dcdc 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -370,6 +370,11 @@ static int proc_delete_dentry(struct dentry * dentry) static int proc_revalidate_dentry(struct dentry *dentry, struct nameidata *nd) { + struct inode *inode = dentry-d_inode; + + /* Force validity if something is mounted under us */ + if (inode S_ISDIR(inode-i_mode) have_submounts(dentry)) + return 1; d_drop(dentry); return 0; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Possible bug from kernel 2.6.22 and above, 2.6.24-rc4
* Jie Chen [EMAIL PROTECTED] wrote: not BARRIER time. I've re-read the discussion and found no hint about how to build and run a barrier test. Either i missed it or it's so obvious to you that you didnt mention it :-) Ingo Hi, Ingo: Did you do configure --enable-public-release? My qmt is for qcd calculation (one type of physics code) [...] yes, i did exactly as instructed. [...]. Without the above flag one can only test PARALLEL overhead. Actually the PARALLEL benchmark has the same behavior as the BARRIER. Thanks. hm, but PARALLEL does not seem to do that much context switching. So basically you create the threads and do a few short runs to establish overhead? Threads do not get fork-balanced at the moment - but turning it on would be easy. Could you try the patch below - how does it impact your results? (and please keep affinity setting off) Ingo --- Subject: sched: reactivate fork balancing From: Ingo Molnar [EMAIL PROTECTED] reactivate fork balancing. Signed-off-by: Ingo Molnar [EMAIL PROTECTED] --- include/linux/topology.h |3 +++ 1 file changed, 3 insertions(+) Index: linux/include/linux/topology.h === --- linux.orig/include/linux/topology.h +++ linux/include/linux/topology.h @@ -103,6 +103,7 @@ .forkexec_idx = 0,\ .flags = SD_LOAD_BALANCE \ | SD_BALANCE_NEWIDLE\ + | SD_BALANCE_FORK \ | SD_BALANCE_EXEC \ | SD_WAKE_AFFINE\ | SD_WAKE_IDLE \ @@ -134,6 +135,7 @@ .forkexec_idx = 1,\ .flags = SD_LOAD_BALANCE \ | SD_BALANCE_NEWIDLE\ + | SD_BALANCE_FORK \ | SD_BALANCE_EXEC \ | SD_WAKE_AFFINE\ | SD_WAKE_IDLE \ @@ -165,6 +167,7 @@ .forkexec_idx = 1,\ .flags = SD_LOAD_BALANCE \ | SD_BALANCE_NEWIDLE\ + | SD_BALANCE_FORK \ | SD_BALANCE_EXEC \ | SD_WAKE_AFFINE\ | BALANCE_FOR_PKG_POWER,\ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] wireless/libertas: don't cast a pointer to pointer of list_head
BTW: I'm not so sure where this patch should go to. To [EMAIL PROTECTED], as Dan Williams (libertas maintainer) monitors this list. The wireless development tree is wireless-2.6, branch everything. You patch doesn't apply to this tree currently, but it's easy to fix. I'll bring it in shape, and resubmit. As a side note: if you want to make comments, put them below --- under your Signed-off-by line. Your BTW-Line would have ended up in the output of git log. libertas: fixes blah mumpf worps This fixes the worps feature. Signed-of-by: Donald Duck [EMAIL PROTECTED] --- Here you can put any comments about your patch that should not end up in the history of git that you can see with git log. [patch comes here] -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: PS3: trouble with SPARSEMEM_VMEMMAP and kexec
On Thu, 6 Dec 2007, Geert Uytterhoeven wrote: On Thu, 6 Dec 2007, Yasunori Goto wrote: I'll try Milton's suggestion to pre-allocate the memory early. It seems that should work as long as nothing else before the hot-plug mem is added needs a large chunk. Hello. Geoff-san. Sorry for late response. Could you tell me the value of the following page_size calculation in vmemmap_populate()? I think this page_size may be too big value. -- int __meminit vmemmap_populate(struct page *start_page, unsigned long nr_pages, int node) : : unsigned long page_size = 1 mmu_psize_defs[mmu_linear_psize].shift; : --- 24 MiB Bummer, messing up bits and MiB. 16 MiB of course. 16 MiB is not page size. It is section size. IIRC, powerpc's page size must be 4K (or 64K). If page size is 4k, vmemmap_alloc_block will call the order 12 page. Is it really correct value for vmemmap population? PS3 initially starts with 128 MiB. Later hotplug is used to add the remaining memory (96 or 112 MIB, IIRC). Ok. Then, add_memory() must be called 6 or 7 times for each sections. Thanks. -- Yasunori Goto -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH Latency Tracer] don't panic on failed bootmem alloc
* Steven Rostedt [EMAIL PROTECTED] wrote: Ingo, This patch prevents a panic on a failed bootmem alloc in the initialization of the tracer buffers. thanks, good catch! Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: sockets affected by IPsec always block (2.6.23)
Am Donnerstag, 6. Dezember 2007 09:53 schrieb David Miller: I think the words shall fail and immediately are quite clear. They are, but the context in which they apply is vague. socket is connection-mode = SOCK_STREAM I can equally generate examples where the non-blocking behavior you are a proponent of would break non-blocking UDP apps during a sendmsg() call when we hit IPSEC resolution. Yet similar language on blocking semantics exists for sendmsg() in the standards. I am not a good enough kernel hacker to exactly understand the code flow in udp_sendmsg(). However, it seems that it first checks destination validity via ip_route_output_flow() and queues the message then. The sendmsg() documentation only talks about buffer space. I can see your dilemma. The reason why I'm pushing this issue another time is that I know quite a bit about system level application development. A very typical design pattern for non-naive single or multi threaded programs is that they set all communication sockets to be nonblocking and use a select()/epoll() based loop to dispatch IO. This often includes initiating a TCP connect() and asynchronously waiting for it to finish or fail from the main loop. The dangerous situation here is that in 99% of all cases things will just work because the phase 2 SA exists. In 0.8%, the SA will be established in 1 sec. However, in the rest of time the server application that you have considered to be stable will end up sleeping with all threads in a connect() call that is supposed to return immediatly. The world is shades of gray, implying anything else is foolhardy and that's how I'm handling this. Even though I consider programmers that ignore the result code on a nonblocking UDP sendmsg() fools, I agree. May be the best compromise is what Herbert Xu suggested in [EMAIL PROTECTED] in this thread: At least, for connect() O_NONBLOCK ist ALWAYS respected. Because this is where the chance for breakage is highest. Stefan -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[Patch] net/xfrm/xfrm_policy.c: Some small improvements
This patch contains the following changes. - Use 'bool' instead of 'int' for booleans. - Use 'size_t' instead of 'int' for 'sizeof' return value. - Some style fixes. Cc: Herbert Xu [EMAIL PROTECTED] Cc: David Miller [EMAIL PROTECTED] Signed-off-by: WANG Cong [EMAIL PROTECTED] --- net/xfrm/xfrm_policy.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 5d6a81d..311b08f 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -476,17 +476,17 @@ static u32 xfrm_gen_index(u8 type, int dir) struct hlist_head *list; struct xfrm_policy *p; u32 idx; - int found; + bool found; idx = (idx_generator | dir); idx_generator += 8; if (idx == 0) idx = 8; list = xfrm_policy_byidx + idx_hash(idx); - found = 0; + found = false; hlist_for_each_entry(p, entry, list, byidx) { if (p-index == idx) { - found = 1; + found = true; break; } } @@ -499,8 +499,8 @@ static inline int selector_cmp(struct xfrm_selector *s1, struct xfrm_selector *s { u32 *p1 = (u32 *) s1; u32 *p2 = (u32 *) s2; - int len = sizeof(struct xfrm_selector) / sizeof(u32); - int i; + size_t len = sizeof(struct xfrm_selector) / sizeof(u32); + size_t i; for (i = 0; i len; i++) { if (p1[i] != p2[i]) @@ -953,7 +953,7 @@ static int xfrm_policy_lookup(struct flowi *fl, u16 family, u8 dir, #ifdef CONFIG_XFRM_SUB_POLICY end: #endif - if ((*objp = (void *) pol) != NULL) + if ((*objp = pol) != NULL) *obj_refp = pol-refcnt; return err; } @@ -1137,7 +1137,7 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl, xfrm_address_t *saddr = xfrm_flowi_saddr(fl, family); xfrm_address_t tmp; - for (nx=0, i = 0; i policy-xfrm_nr; i++) { + for (nx = 0, i = 0; i policy-xfrm_nr; i++) { struct xfrm_state *x; xfrm_address_t *remote = daddr; xfrm_address_t *local = saddr; @@ -1395,7 +1395,7 @@ free_dst: } static int inline -xfrm_dst_alloc_copy(void **target, void *src, int size) +xfrm_dst_alloc_copy(void **target, void *src, size_t size) { if (!*target) { *target = kmalloc(size, GFP_ATOMIC); @@ -1554,7 +1554,7 @@ restart: #endif nx = xfrm_tmpl_resolve(pols, npols, fl, xfrm, family); - if (unlikely(nx0)) { + if (unlikely(nx 0)) { err = nx; if (err == -EAGAIN sysctl_xfrm_larval_drop) { /* EREMOTE tells the caller to generate @@ -1688,7 +1688,8 @@ xfrm_state_ok(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short family) { if (xfrm_state_kern(x)) - return tmpl-optional !xfrm_state_addr_cmp(tmpl, x, tmpl-encap_family); + return tmpl-optional + !xfrm_state_addr_cmp(tmpl, x, tmpl-encap_family); return x-id.proto == tmpl-id.proto (x-id.spi == tmpl-id.spi || !tmpl-id.spi) (x-props.reqid == tmpl-reqid || !tmpl-reqid) @@ -1777,7 +1778,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, if (skb-sp) { int i; - for (i=skb-sp-len-1; i=0; i--) { + for (i = skb-sp-len-1; i = 0; i--) { struct xfrm_state *x = skb-sp-xvec[i]; if (!xfrm_selector_match(x-sel, fl, family)) return 0; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] usb: at91_udc: correct hanging while disconnecting usb cable
Correct hanging while disconnecting the USB device cable. Prevent a race between vbus and UDP interrupts. This bug was tracked on at91sam9260ek boards. Signed-off-by: Nicolas Ferre [EMAIL PROTECTED] --- A usb resume interrupt was firing after the vbus interrupt : the IP was then already stoped and not able to deal with it (no more clock). A simple interrupt disabling is ok as the end of bus reset irq is non maskable and ok to resume the USB device IP. --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -908,6 +908,7 @@ static void pullup(struct at91_udc *udc, if (is_on) { clk_on(udc); + at91_udp_write(udc, AT91_UDP_ICR, AT91_UDP_RXRSM); at91_udp_write(udc, AT91_UDP_TXVC, 0); if (cpu_is_at91rm9200()) at91_set_gpio_value(udc-board.pullup_pin, 1); @@ -925,6 +926,7 @@ static void pullup(struct at91_udc *udc, } } else { stop_activity(udc); + at91_udp_write(udc, AT91_UDP_IDR, AT91_UDP_RXRSM); at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); if (cpu_is_at91rm9200()) at91_set_gpio_value(udc-board.pullup_pin, 0); -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: sockets affected by IPsec always block (2.6.23)
From: Stefan Rompf [EMAIL PROTECTED] Date: Thu, 6 Dec 2007 11:56:48 +0100 Am Donnerstag, 6. Dezember 2007 09:53 schrieb David Miller: I think the words shall fail and immediately are quite clear. They are, but the context in which they apply is vague. socket is connection-mode = SOCK_STREAM I meant whether immediately mean in reference to socket state or includes auxiliary things like route lookups. When you do a non-blocking write on a socket, things like memory allocations can block, potentially for a long time. It is an example where there are definite boundaries to where the non-blocking'ness applies. And therefore it is not so cut and dry and you present this issue. The reason why I'm pushing this issue another time is that I know quite a bit about system level application development. A very typical design pattern for non-naive single or multi threaded programs is that they set all communication sockets to be nonblocking and use a select()/epoll() based loop to dispatch IO. This often includes initiating a TCP connect() and asynchronously waiting for it to finish or fail from the main loop. The dangerous situation here is that in 99% of all cases things will just work because the phase 2 SA exists. In 0.8%, the SA will be established in 1 sec. However, in the rest of time the server application that you have considered to be stable will end up sleeping with all threads in a connect() call that is supposed to return immediatly. And that connect() call can hang for a long time due to any memory allocation done in the connect() path. You are not avoiding blocking by setting O_NONBLOCK on the socket, it is quite foolhardy to think that it does so unilaterally. And that's why this is a grey area. Why is waiting for memory allocation on a O_NONBLOCK socket OK but waiting for IPSEC route resolution is not? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Patch] net/xfrm/xfrm_policy.c: Some small improvements
From: WANG Cong [EMAIL PROTECTED] Date: Thu, 6 Dec 2007 19:01:23 +0800 This patch contains the following changes. - Use 'bool' instead of 'int' for booleans. - Use 'size_t' instead of 'int' for 'sizeof' return value. - Some style fixes. Cc: Herbert Xu [EMAIL PROTECTED] Cc: David Miller [EMAIL PROTECTED] Signed-off-by: WANG Cong [EMAIL PROTECTED] Normally I would let a patch like this sit in my mailbox for a week and then delete it. But this time I'll just let you know up front that I don't see much value in this patch. It is not a clear improvement to replace int's with bool's in my mind and the other changes are just whitespace changes. And thus I can delete the patch from my mailbox immediately :-) Sorry. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: sockets affected by IPsec always block (2.6.23)
Am Donnerstag, 6. Dezember 2007 12:13 schrieb David Miller: And that's why this is a grey area. Why is waiting for memory allocation on a O_NONBLOCK socket OK but waiting for IPSEC route resolution is not? Because you just will put enough RAM modules into you server when setting up a scalable system. Local resource, managable by the admin. What you cannot control in many cases is the network connection to the remote node. Simon Arlott has been talking about an 8 hour network outage. Stefan -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: sockets affected by IPsec always block (2.6.23)
From: Stefan Rompf [EMAIL PROTECTED] Date: Thu, 6 Dec 2007 12:35:05 +0100 Because you just will put enough RAM modules into you server when setting up a scalable system. This suggestion is avoiding the important semantic issue, and won't lead to a real discussion of the core problem. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: REGRESSION: 2.6.24: false double-clicks from USB mouse
Jiri Kosina ha scritto: My USB mouse recently started giving me phantom scrolls (movements of the mouse wheel, even I made sure the wheel was in a resting position) in recently kernels. It happened too infrequently for me to care. Did this also start in 2.6.24, as in Mark's case? It happens to me, too. Wireless mouse, gives some wheel up signals when going into powersave state. Kernel is 2.6.22-tmb-laptop-2mdv (Mandriva Cooker). T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0 D: Ver= 1.10 Cls=00(ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=062a ProdID= Rev= 0.00 C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=10ms Maybe a more-or-less undocumented sequence to tell the host it's going to sleep? BYtE, Diego. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: FW: Guidance on resources for User Space Device Drivers on 2.6 kernel
On Wed, Dec 05, 2007 at 01:29:23AM -0500, Jaursch, Bill wrote: I have am in the process of writing a driver that is software only. I would like to avoid the caveats of a kernel mode installable module. ... What is a driver that is software only (all kernel code is also software only...)? You must describe what you want to do for people being able to actually help you. Thanks, Bill cu Adrian -- Is there not promise of rain? Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. Only a promise, Lao Er said. Pearl S. Buck - Dragon Seed -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.24-rc4-mm1
On Tue, 04 Dec 2007 21:17:01 PST, Andrew Morton said: ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc4/2.6.24-rc4-mm1/ Something in here broke LVM support - an initrd that has worked fine for quite some time suddenly couldn't mount /dev/VolGroup00/root so we get the infamous Kernel panic - not syncing: Attempted to kill init! when we fall off the end of the initrd and haven't pivoted to the real disk. It finds the disk OK: [ 81.202310] sd 0:0:0:0: [sda] 156301488 512-byte hardware sectors (80026 MB) [ 81.214466] sd 0:0:0:0: [sda] Write Protect is off [ 81.226467] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00 [ 81.238436] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 81.250780] sda: sda1 sda2 [ 75.396119] sd 0:0:0:0: [sda] Attached SCSI disk but then the lvm command says it can't find the volume group VolGroup00 (which is actually sda2 - sda1 is a small /boot partition, rest of disk is LVM). A quick look at the rc4-mm1 announcement doesn't have any obviously tempting patch names to start at, so it looks like it's time to play mm-bisect. It may take me a day or two, as I have some time management issues this week... pgpprNpqbdWxF.pgp Description: PGP signature
Re: [RFC] [PATCH] A clean approach to writeout throttling
On Thu, 6 Dec 2007 01:48:52 -0800 Daniel Phillips [EMAIL PROTECTED] wrote: On Wednesday 05 December 2007 23:31, Andrew Morton wrote: Rather than asking the stack how much memory will this request consume you could instead ask how much memory are you currently using. ie: on entry to the stack, do current-account_block_allocations = 1; make_request(...); rq-used_memory += current-pages_used_for_block_allocations; and in the page allocator do if (!in_interrupt() current-account_block_allocations) current-pages_used_for_block_allocations++; and then somehow handle deallocation too ;) Ah, and how do you ensure that you do not deadlock while making this inquiry? It isn't an inquiry - it's a plain old submit_bio() and it runs to completion in the usual fashion. Thing is, we wouldn't have called it at all if this queue was already over its allocation limit. IOW, we know that it's below its allocation limit, so we know it won't deadlock. Given, of course, reasonably pessimistc error margins. OK, I see what you are suggesting. Yes, one could set the inflight limit very low and the reserve very high, and run a bio through the stack (what I meant by inquiry) to discover the actual usage, then shrink the reserve accordingly. By also running a real bio through the stack we can discover something about the latency. So we would then know roughly how high the inflight limit should be set and how much the memalloc reserve should be increased to handle that particular driver instance. The big fly in this ointment is that we cannot possibly know that our bio followed the worst case resource consumption path, whereas it is fairly easy (hopefully) for a programmer to determine this statically. nonono... Consider an example. - We a-priori decide to limit a particular stack's peak memory usage to 1MB - We empirically discover that the maximum amount of memory which is allocated by that stack on behalf of a single BIO is 16kb. (ie: that's the most it has ever used for a single BIO). - Now, we refuse to feed any more BIOs into the stack when its instantaneous memory usage exceeds (1MB - 16kb). Of course, the _average_ memory-per-BIO is much less than 16kb. So there are a lot of BIOs in flight - probably hundreds, but a minimum of 63. There is a teeny so-small-it-doesn't-matter chance that the stack will exceed the 1MB limit. If it happens to be at its (1MB-16kb) limit and all the memory in the machine is AWOL and then someone throws a never-seen-before twirly BIO at it. Not worth worrying about, surely. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: suspend-related lockdep warning
On Thu, 06 Dec 2007 11:31:28 +0100 Peter Zijlstra [EMAIL PROTECTED] wrote: On Thu, 2007-12-06 at 01:21 +0100, Rafael J. Wysocki wrote: On Tuesday, 4 of December 2007, Andrew Morton wrote: [ 34.455096] ipw2200: Failed to send WEP_KEY: Command timed out. [ 34.911876] Syncing filesystems ... done. [ 34.934526] Freezing user space processes ... WARNING: at kernel/lockdep.c:2662 check_flags() [ 34.934917] Pid: 1922, comm: dbus-daemon Not tainted 2.6.24-rc3-mm3 #2 [ 34.935036] [c0104853] show_trace_log_lvl+0x12/0x25 [ 34.935142] [c010506c] show_trace+0xd/0x10 [ 34.935231] [c0105850] dump_stack+0x55/0x5d [ 34.935322] [c0136125] check_flags+0x7f/0x11a [ 34.935417] [c0139210] lock_acquire+0x3a/0x86 [ 34.935511] [c0318faf] _spin_lock+0x1c/0x49 [ 34.935603] [c0140fc7] refrigerator+0x13/0xc8 [ 34.935697] [c01270ac] get_signal_to_deliver+0x34/0x2e8 [ 34.935807] [c0102edc] do_notify_resume+0x8c/0x6fe [ 34.935907] [c0103a2c] work_notifysig+0x13/0x1b [ 34.936004] === [ 34.936072] irq event stamp: 253 [ 34.936133] hardirqs last enabled at (253): [c0103a8d] syscall_exit_work+0x11/0x26 [ 34.936294] hardirqs last disabled at (252): [c0103956] syscall_exit+0x14/0x25 [ 34.936446] softirqs last enabled at (0): [c011baf9] copy_process+0x300/0x1246 [ 34.936599] softirqs last disabled at (0): [] 0x0 [ 34.954308] (elapsed 0.01 seconds) done. [ 34.954389] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Hmm, do I understand correctly that lockdep expects us to disable interrupts before acquiring the task lock in refrigerator()? That would be strange. Ingo, can you have a look at this, please? No its complaining that the IRQ state changed without anybody telling it about it. Usually an unannotated cli/sti. The particular line it warns, (lockdep.c:2662), suggests... /me grabs a copy of 24-rc3-mm2 ... that hardirqs are disabled, but irq tracking thinks they are still enabled. So that would be an unannotated cli. It would be nice to make that warning tell us that - we've hit it a few times and I never knew this was the reason. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: suspend-related lockdep warning
On Thu, 2007-12-06 at 04:01 -0800, Andrew Morton wrote: On Thu, 06 Dec 2007 11:31:28 +0100 Peter Zijlstra [EMAIL PROTECTED] wrote: On Thu, 2007-12-06 at 01:21 +0100, Rafael J. Wysocki wrote: On Tuesday, 4 of December 2007, Andrew Morton wrote: [ 34.455096] ipw2200: Failed to send WEP_KEY: Command timed out. [ 34.911876] Syncing filesystems ... done. [ 34.934526] Freezing user space processes ... WARNING: at kernel/lockdep.c:2662 check_flags() [ 34.934917] Pid: 1922, comm: dbus-daemon Not tainted 2.6.24-rc3-mm3 #2 [ 34.935036] [c0104853] show_trace_log_lvl+0x12/0x25 [ 34.935142] [c010506c] show_trace+0xd/0x10 [ 34.935231] [c0105850] dump_stack+0x55/0x5d [ 34.935322] [c0136125] check_flags+0x7f/0x11a [ 34.935417] [c0139210] lock_acquire+0x3a/0x86 [ 34.935511] [c0318faf] _spin_lock+0x1c/0x49 [ 34.935603] [c0140fc7] refrigerator+0x13/0xc8 [ 34.935697] [c01270ac] get_signal_to_deliver+0x34/0x2e8 [ 34.935807] [c0102edc] do_notify_resume+0x8c/0x6fe [ 34.935907] [c0103a2c] work_notifysig+0x13/0x1b [ 34.936004] === [ 34.936072] irq event stamp: 253 [ 34.936133] hardirqs last enabled at (253): [c0103a8d] syscall_exit_work+0x11/0x26 [ 34.936294] hardirqs last disabled at (252): [c0103956] syscall_exit+0x14/0x25 [ 34.936446] softirqs last enabled at (0): [c011baf9] copy_process+0x300/0x1246 [ 34.936599] softirqs last disabled at (0): [] 0x0 [ 34.954308] (elapsed 0.01 seconds) done. [ 34.954389] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done. Hmm, do I understand correctly that lockdep expects us to disable interrupts before acquiring the task lock in refrigerator()? That would be strange. Ingo, can you have a look at this, please? No its complaining that the IRQ state changed without anybody telling it about it. Usually an unannotated cli/sti. The particular line it warns, (lockdep.c:2662), suggests... /me grabs a copy of 24-rc3-mm2 ... that hardirqs are disabled, but irq tracking thinks they are still enabled. So that would be an unannotated cli. It would be nice to make that warning tell us that - we've hit it a few times and I never knew this was the reason. Ingo just did that, patch should be coming to a lockdep repo near you soon :-) signature.asc Description: This is a digitally signed message part
Re: 2.6.24-rc4-mm1: hostbyte=0x01 driverbyte=0x00 (now bisected)
On Thu, Dec 06 2007, Hannes Reinecke wrote: Alexey Dobriyan wrote: git-scsi-misc.patch Apologies for not looking into the problem earlier. See http://marc.info/?t=11962802235r=1w=2 2.6.24-rc3-mm2: Result: hostbyte=0x01 driverbyte=0x00\nend_request: I/O error for previous installment. I've bisected it to the following patch in git-scsi-misc branch. Revert on top of 2.6.24-rc4-mm1 also helps. commit 8655a546c83fc43f0a73416bbd126d02de7ad6c0 Author: Hannes Reinecke [EMAIL PROTECTED] Date: Tue Nov 6 09:23:40 2007 +0100 [SCSI] Do not requeue requests if REQ_FAILFAST is set Any requests with the REQ_FAILFAST flag set should not be requeued to the requeust queue, but rather terminated directly. Otherwise the multipath failover will stall until the command timeout triggers. Signed-off-by: Hannes Reinecke [EMAIL PROTECTED] Signed-off-by: James Bottomley [EMAIL PROTECTED] diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 0f44bdb..0da0dd0 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1286,6 +1286,11 @@ int scsi_prep_state_check(struct scsi_device *sdev, struct request *req) */ if (!(req-cmd_flags REQ_PREEMPT)) ret = BLKPREP_DEFER; + /* +* Return failfast requests immediately +*/ + if (req-cmd_flags REQ_FAILFAST) + ret = BLKPREP_KILL; break; default: /* @@ -1414,6 +1419,17 @@ static inline int scsi_host_queue_ready(struct request_queue *q, return 1; } +static void __scsi_kill_request(struct request *req) +{ + struct scsi_cmnd *cmd = req-special; + struct scsi_device *sdev = cmd-device; + + cmd-result = DID_NO_CONNECT 16; + atomic_inc(cmd-device-iorequest_cnt); + sdev-device_busy--; + __scsi_done(cmd); +} + /* * Kill a request for a dead device */ @@ -1527,8 +1543,16 @@ static void scsi_request_fn(struct request_queue *q) * accept it. */ req = elv_next_request(q); - if (!req || !scsi_dev_queue_ready(q, sdev)) + if (!req) + break; + + if (!scsi_dev_queue_ready(q, sdev)) { + if (req-cmd_flags REQ_FAILFAST) { + scsi_kill_request(req, q); + continue; + } break; + } if (unlikely(!scsi_device_online(sdev))) { sdev_printk(KERN_ERR, sdev, @@ -1609,8 +1633,12 @@ static void scsi_request_fn(struct request_queue *q) * later time. */ spin_lock_irq(q-queue_lock); - blk_requeue_request(q, req); - sdev-device_busy--; + if (unlikely(req-cmd_flags REQ_FAILFAST)) + __scsi_kill_request(req); + else { + blk_requeue_request(q, req); + sdev-device_busy--; + } if(sdev-device_busy == 0) blk_plug_device(q); out: Yeah, sorry. That patch was bad. Please use the attached one instead. Andrew, can you replace them? Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage [EMAIL PROTECTED] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 13e7e09..9ec1566 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1284,13 +1284,15 @@ int scsi_prep_state_check(struct scsi_device *sdev, struct request *req) /* * If the devices is blocked we defer normal commands. */ - if (!(req-cmd_flags REQ_PREEMPT)) - ret = BLKPREP_DEFER; - /* - * Return failfast requests immediately - */ - if (req-cmd_flags REQ_FAILFAST) - ret = BLKPREP_KILL; + if (!(req-cmd_flags REQ_PREEMPT)) { + /* + * Return failfast requests immediately + */ + if (req-cmd_flags REQ_FAILFAST) + ret = BLKPREP_KILL; + else + ret = BLKPREP_DEFER; + } break; default: /* can we please stick to using blk_noretry_request() consistently, instead of thwrowing REQ_FAILFAST tests in there? -- Jens Axboe -- To
Re: suspend-related lockdep warning
* Andrew Morton [EMAIL PROTECTED] wrote: It would be nice to make that warning tell us that - we've hit it a few times and I never knew this was the reason. i'm a mind-reader and a time-traveler as well, so i've got the patch below lined up in my sched.git queue already :-) Ingo -- Subject: lockdep: make cli/sti annotation warnings clearer From: Ingo Molnar [EMAIL PROTECTED] make cli/sti annotation warnings easier to interpret. Signed-off-by: Ingo Molnar [EMAIL PROTECTED] Signed-off-by: Peter Zijlstra [EMAIL PROTECTED] --- kernel/lockdep.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) Index: linux/kernel/lockdep.c === --- linux.orig/kernel/lockdep.c +++ linux/kernel/lockdep.c @@ -2654,10 +2654,15 @@ static void check_flags(unsigned long fl if (!debug_locks) return; - if (irqs_disabled_flags(flags)) - DEBUG_LOCKS_WARN_ON(current-hardirqs_enabled); - else - DEBUG_LOCKS_WARN_ON(!current-hardirqs_enabled); + if (irqs_disabled_flags(flags)) { + if (DEBUG_LOCKS_WARN_ON(current-hardirqs_enabled)) { + printk(possible reason: unannotated irqs-off.\n); + } + } else { + if (DEBUG_LOCKS_WARN_ON(!current-hardirqs_enabled)) { + printk(possible reason: unannotated irqs-on.\n); + } + } /* * We dont accurately track softirq state in e.g. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.24-rc4-mm1
On Thu, 06 Dec 2007 06:49:24 -0500 [EMAIL PROTECTED] wrote: On Tue, 04 Dec 2007 21:17:01 PST, Andrew Morton said: ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc4/2.6.24-rc4-mm1/ Something in here broke LVM support - an initrd that has worked fine for quite some time suddenly couldn't mount /dev/VolGroup00/root so we get the infamous Kernel panic - not syncing: Attempted to kill init! when we fall off the end of the initrd and haven't pivoted to the real disk. It finds the disk OK: [ 81.202310] sd 0:0:0:0: [sda] 156301488 512-byte hardware sectors (80026 MB) [ 81.214466] sd 0:0:0:0: [sda] Write Protect is off [ 81.226467] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00 [ 81.238436] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 81.250780] sda: sda1 sda2 [ 75.396119] sd 0:0:0:0: [sda] Attached SCSI disk but then the lvm command says it can't find the volume group VolGroup00 (which is actually sda2 - sda1 is a small /boot partition, rest of disk is LVM). A quick look at the rc4-mm1 announcement doesn't have any obviously tempting patch names to start at, so it looks like it's time to play mm-bisect. It may take me a day or two, as I have some time management issues this week... OK, thanks. First step would be to eliminate rewrite-rd.patch: maybe the ramdisk driver in which that initrd resides is bust. After that, agk-dm-dm-*.patch are of course the ones to look at. Please keep [EMAIL PROTECTED] cc'ed. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: REGRESSION: 2.6.24: false double-clicks from USB mouse
On Thu, 6 Dec 2007, Diego Zuccato wrote: It happens to me, too. Wireless mouse, gives some wheel up signals when going into powersave state. Kernel is 2.6.22-tmb-laptop-2mdv (Mandriva Cooker). Is this a regression for you? Are you able to say which kernel first exposed this behavior in your case? Maybe a more-or-less undocumented sequence to tell the host it's going to sleep? usbmon and/or HID_DEBUG output would be interesting to see (how to produce HID debugging output has been explained earlier in this thread, for usbmon please look in Documentation/usb/usbmon.txt). Thanks, -- Jiri Kosina SUSE Labs -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: FW: Guidance on resources for User Space Device Drivers on 2.6 kernel
If you have any other suggestions on projects, articles, etc. on Linux User Space Device Drivers, I would greatly appreciate the information. A suggestion: UIO: user-space drivers, since kernel version 2.6.21 http://lwn.net/Articles/232575/ Regards, -- Leon -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: sockets affected by IPsec always block (2.6.23)
Am Donnerstag, 6. Dezember 2007 12:39 schrieb David Miller: Because you just will put enough RAM modules into you server when setting up a scalable system. This suggestion is avoiding the important semantic issue, and won't lead to a real discussion of the core problem. When writing applications for unix operating systems, it is known since ages that stuff can be swapped out and that even things like memory accesses can block. So it does not really surprise when a system call has to wait for memory - just imagine the kernel code for connect() could be and has been swapped out. Even with moderate swap activity, this memory should be available in much less than one second. If on the other hand the system is already threshing, it is no difference if it does so within connect() or while reaching the connect() system call in the application flow. Btw, this is where admin responsibility to size their systems kicks in. So where I would draw the line: connect() is clearly a network related function. Therefore, if a nonblocking connect() has to sleep for a local, controllable resource like memory to become available, this is ok. Maybe it shouldn't wait for a 128MB buffer if someone configured such an abonimation, haven't thought deeply about that. But when being told not to wait the connection to complete, it should never ever wait for another network related activity like IPSEC SA setup to complete, especially not for hours. IMHO this is what developers expect, and is also consistent with the fact that POSIX does not define O_NONBLOCK behaviour for local files. Stefan -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Possibility to adjust the only-root-can-bind-to-port-under-1024 limit
Casey Schaufler skrev: How do you protect ports greater than 1024 from any user binding to them? E.g. port 1080. Should the OS manage port number allocations? I don't think so based on the notion of ports being names in an uncontrolled flat namespace. The whole problem is that people want to make assumptions about the applications providing services on a particular port, and no amount of OS control is going to solve that one. This means that the OS should allow any user to bind to all ports, even those 1024. /Mikael -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Please revert: PCI: fix IDE legacy mode resources
On Thu, Dec 06, 2007 at 02:58:13PM +0900, Yoichi Yuasa wrote: What I don't understand is thus why you are calling resource_to_bus on 0x1f0 which is -not- a resource value, but is already a BAR value... 0x1f0 is resource value on MIPS Cobalt. All RAW BAR values contain the offset(0x1000) on it. In arch/mips/cobalt/pci.c: static struct resource cobalt_io_resource = { .start = 0x1000, .end= GT_DEF_PCI0_IO_SIZE - 1, .name = PCI I/O, .flags = IORESOURCE_IO, }; static struct pci_controller cobalt_pci_controller = { [...] .io_resource= cobalt_io_resource, .io_offset = 0 - GT_DEF_PCI0_IO_BASE, }; The .io_offset initialization looks odd; no other platform is trying to use a negative offset here. I think there was something odd with the Galileo GT-64111 which (unlike its later sucessors such as the GT-64120) passes memory accesses in the range 0x1000 ... 0x11ff to the PCI bus unmodified. That is for example a load or store to physical address 0x13f8 will become an I/O port access to 0x13f8. I hope this is just a missconfiguration of the GT-64111, time for manual reading. Ralf -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: FW: Guidance on resources for User Space Device Drivers on 2.6 kernel
Adrian Bunk wrote: On Wed, Dec 05, 2007 at 01:29:23AM -0500, Jaursch, Bill wrote: I have am in the process of writing a driver that is software only. I would like to avoid the caveats of a kernel mode installable module. ... What is a driver that is software only (all kernel code is also software only...)? You must describe what you want to do for people being able to actually help you. Although software only is a wrong term here, it's certainly clear from context what he meant. However, what's missing is information about the kind of device he plans to support. Is it a USB device or is it sitting behind a similar bus? Or is it a device on a local bus like PCI? In the latter case, is DMA involved? I found FUSD (http://svn.xiph.org/trunk/fusd/), but would like to know if this is a stable project. This question should be directed to the authors or maintainers of FUSD. Note, AFAIU from its documentation, FUSD is not a means to implement arbitrary kinds of device drivers in userspace. It allows for proxying *device file* callbacks into user-space, allowing *device files* to be implemented by userspace programs (emphasis is mine). I.e. FUSD gives userspace programs only the ability to supply a character special file to other userspace programs. In order to drive real hardware, the FUSD client would additionally need to access other userspace interfaces of the kernel, provided by actual kernelspace drivers. -- Stefan Richter -=-=-=== ==-- --==- http://arcgraph.de/sr/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 00/47] CRIS patches for CRISv32 EtraxFS and ARTPEC-3
Hi, This patchset contains the differences to add support for the EtraxFS and ARTPEC-3 CPUs, both of the CRISv32 family. Both chips can now be compiled with minimal configs. To compile you'll need the Axis gcc cross port for CRISv32, it is mentioned in http://marc.info/?l=linux-kernelm=119337976126184w=2 how to get this. Still missing to allow full compile is include/linux/mtd/mtdram.h, see http://marc.info/?l=linux-kernelm=119373777301863w=2 This is step two in syncing the Axis internal changes with mainline Linux, with the final goal being getting the CRIS port to the same level as the rest of the kernel. I've tried to remove as much checkpatch warnings and errors as possible, but some remain, mostly (I think you'll agree) spurious warnings, although there's also a bunch of generated files which don't conform, but I hope to fix this at the source later on. I realise this is a hefty chunk of code to review, but any suggestions on improvements are thankfully received. The changes are also available in the export2 branch at git://www.jni.nu/axis.git Best regards, /^JN - Jesper Nilsson -- Jesper Nilsson -- [EMAIL PROTECTED] -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 02/47] Add new driver files for Artpec-3.
Adds gpio and nandflash handling for Artpec-3. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/drivers/mach-a3/Makefile|6 + arch/cris/arch-v32/drivers/mach-a3/gpio.c | 984 arch/cris/arch-v32/drivers/mach-a3/nandflash.c | 178 + 3 files changed, 1168 insertions(+), 0 deletions(-) create mode 100644 arch/cris/arch-v32/drivers/mach-a3/Makefile create mode 100644 arch/cris/arch-v32/drivers/mach-a3/gpio.c create mode 100644 arch/cris/arch-v32/drivers/mach-a3/nandflash.c diff --git a/arch/cris/arch-v32/drivers/mach-a3/Makefile b/arch/cris/arch-v32/drivers/mach-a3/Makefile new file mode 100644 index 000..5c6d2a2 --- /dev/null +++ b/arch/cris/arch-v32/drivers/mach-a3/Makefile @@ -0,0 +1,6 @@ +# +# Makefile for Etrax-specific drivers +# + +obj-$(CONFIG_ETRAX_NANDFLASH) += nandflash.o +obj-$(CONFIG_ETRAX_GPIO)+= gpio.o diff --git a/arch/cris/arch-v32/drivers/mach-a3/gpio.c b/arch/cris/arch-v32/drivers/mach-a3/gpio.c new file mode 100644 index 000..4c48065 --- /dev/null +++ b/arch/cris/arch-v32/drivers/mach-a3/gpio.c @@ -0,0 +1,984 @@ +/* + * Artec-3 general port I/O device + * + * Copyright (c) 2007 Axis Communications AB + * + * Authors:Bjorn Wesen (initial version) + * Ola Knutsson (LED handling) + * Johan Adolfsson (read/set directions, write, port G, + * port to ETRAX FS. + * Ricard Wanderlof (PWM for Artpec-3) + * + */ + +#include linux/module.h +#include linux/sched.h +#include linux/slab.h +#include linux/ioport.h +#include linux/errno.h +#include linux/kernel.h +#include linux/fs.h +#include linux/string.h +#include linux/poll.h +#include linux/init.h +#include linux/interrupt.h +#include linux/spinlock.h + +#include asm/etraxgpio.h +#include hwregs/reg_map.h +#include hwregs/reg_rdwr.h +#include hwregs/gio_defs.h +#include hwregs/intr_vect_defs.h +#include asm/io.h +#include asm/system.h +#include asm/irq.h +#include asm/arch/mach/pinmux.h + +#ifdef CONFIG_ETRAX_VIRTUAL_GPIO +#include ../i2c.h + +#define VIRT_I2C_ADDR 0x40 +#endif + +/* The following gio ports on ARTPEC-3 is available: + * pa 32 bits + * pb 32 bits + * pc 16 bits + * each port has a rw_px_dout, r_px_din and rw_px_oe register. + */ + +#define GPIO_MAJOR 120 /* experimental MAJOR number */ + +#define I2C_INTERRUPT_BITS 0x300 /* i2c0_done and i2c1_done bits */ + +#define D(x) + +#if 0 +static int dp_cnt; +#define DP(x) \ + do { \ + dp_cnt++; \ + if (dp_cnt % 1000 == 0) \ + x; \ + } while (0) +#else +#define DP(x) +#endif + +static char gpio_name[] = etrax gpio; + +#ifdef CONFIG_ETRAX_VIRTUAL_GPIO +static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, + unsigned long arg); +#endif +static int gpio_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg); +static ssize_t gpio_write(struct file *file, const char *buf, size_t count, + loff_t *off); +static int gpio_open(struct inode *inode, struct file *filp); +static int gpio_release(struct inode *inode, struct file *filp); +static unsigned int gpio_poll(struct file *filp, + struct poll_table_struct *wait); + +/* private data per open() of this driver */ + +struct gpio_private { + struct gpio_private *next; + /* The IO_CFG_WRITE_MODE_VALUE only support 8 bits: */ + unsigned char clk_mask; + unsigned char data_mask; + unsigned char write_msb; + unsigned char pad1; + /* These fields are generic */ + unsigned long highalarm, lowalarm; + wait_queue_head_t alarm_wq; + int minor; +}; + +static void gpio_set_alarm(struct gpio_private *priv); + +/* linked list of alarms to check for */ + +static struct gpio_private *alarmlist; + +static int wanted_interrupts; + +static DEFINE_SPINLOCK(alarm_lock); + +#define NUM_PORTS (GPIO_MINOR_LAST+1) +#define GIO_REG_RD_ADDR(reg) \ + (volatile unsigned long *)(regi_gio + REG_RD_ADDR_gio_##reg) +#define GIO_REG_WR_ADDR(reg) \ + (volatile unsigned long *)(regi_gio + REG_WR_ADDR_gio_##reg) +unsigned long led_dummy; +unsigned long port_d_dummy;/* Only input on Artpec-3 */ +unsigned long port_e_dummy;/* Non existent on Artpec-3 */ +#ifdef CONFIG_ETRAX_VIRTUAL_GPIO +static unsigned long virtual_dummy; +static unsigned long virtual_rw_pv_oe = CONFIG_ETRAX_DEF_GIO_PV_OE; +static unsigned short cached_virtual_gpio_read; +#endif + +static volatile unsigned long *data_out[NUM_PORTS] = { + GIO_REG_WR_ADDR(rw_pa_dout), + GIO_REG_WR_ADDR(rw_pb_dout), + led_dummy, + GIO_REG_WR_ADDR(rw_pc_dout), + port_d_dummy, +#ifdef CONFIG_ETRAX_VIRTUAL_GPIO + port_e_dummy, + virtual_dummy, +#endif +}; + +static volatile unsigned long *data_in[NUM_PORTS] = { + GIO_REG_RD_ADDR(r_pa_din), +
[PATCH 03/47] Add new driver files for Etrax-FS
Adds gpio and nandflash handling for Etrax-FS Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/drivers/mach-fs/Makefile|6 + arch/cris/arch-v32/drivers/mach-fs/gpio.c | 971 arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 172 + 3 files changed, 1149 insertions(+), 0 deletions(-) create mode 100644 arch/cris/arch-v32/drivers/mach-fs/Makefile create mode 100644 arch/cris/arch-v32/drivers/mach-fs/gpio.c create mode 100644 arch/cris/arch-v32/drivers/mach-fs/nandflash.c diff --git a/arch/cris/arch-v32/drivers/mach-fs/Makefile b/arch/cris/arch-v32/drivers/mach-fs/Makefile new file mode 100644 index 000..5c6d2a2 --- /dev/null +++ b/arch/cris/arch-v32/drivers/mach-fs/Makefile @@ -0,0 +1,6 @@ +# +# Makefile for Etrax-specific drivers +# + +obj-$(CONFIG_ETRAX_NANDFLASH) += nandflash.o +obj-$(CONFIG_ETRAX_GPIO)+= gpio.o diff --git a/arch/cris/arch-v32/drivers/mach-fs/gpio.c b/arch/cris/arch-v32/drivers/mach-fs/gpio.c new file mode 100644 index 000..56caafd --- /dev/null +++ b/arch/cris/arch-v32/drivers/mach-fs/gpio.c @@ -0,0 +1,971 @@ +/* + * ETRAX CRISv32 general port I/O device + * + * Copyright (c) 1999-2006 Axis Communications AB + * + * Authors:Bjorn Wesen (initial version) + * Ola Knutsson (LED handling) + * Johan Adolfsson (read/set directions, write, port G, + * port to ETRAX FS. + * + */ + +#include linux/module.h +#include linux/sched.h +#include linux/slab.h +#include linux/ioport.h +#include linux/errno.h +#include linux/kernel.h +#include linux/fs.h +#include linux/string.h +#include linux/poll.h +#include linux/init.h +#include linux/interrupt.h +#include linux/spinlock.h + +#include asm/etraxgpio.h +#include hwregs/reg_map.h +#include hwregs/reg_rdwr.h +#include hwregs/gio_defs.h +#include hwregs/intr_vect_defs.h +#include asm/io.h +#include asm/system.h +#include asm/irq.h + +#ifdef CONFIG_ETRAX_VIRTUAL_GPIO +#include ../i2c.h + +#define VIRT_I2C_ADDR 0x40 +#endif + +/* The following gio ports on ETRAX FS is available: + * pa 8 bits, supports interrupts off, hi, low, set, posedge, negedge anyedge + * pb 18 bits + * pc 18 bits + * pd 18 bits + * pe 18 bits + * each port has a rw_px_dout, r_px_din and rw_px_oe register. + */ + +#define GPIO_MAJOR 120 /* experimental MAJOR number */ + +#define D(x) + +#if 0 +static int dp_cnt; +#define DP(x) \ + do { \ + dp_cnt++; \ + if (dp_cnt % 1000 == 0) \ + x; \ + } while (0) +#else +#define DP(x) +#endif + +static char gpio_name[] = etrax gpio; + +#if 0 +static wait_queue_head_t *gpio_wq; +#endif + +#ifdef CONFIG_ETRAX_VIRTUAL_GPIO +static int virtual_gpio_ioctl(struct file *file, unsigned int cmd, + unsigned long arg); +#endif +static int gpio_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg); +static ssize_t gpio_write(struct file *file, const char *buf, size_t count, + loff_t *off); +static int gpio_open(struct inode *inode, struct file *filp); +static int gpio_release(struct inode *inode, struct file *filp); +static unsigned int gpio_poll(struct file *filp, + struct poll_table_struct *wait); + +/* private data per open() of this driver */ + +struct gpio_private { + struct gpio_private *next; + /* The IO_CFG_WRITE_MODE_VALUE only support 8 bits: */ + unsigned char clk_mask; + unsigned char data_mask; + unsigned char write_msb; + unsigned char pad1; + /* These fields are generic */ + unsigned long highalarm, lowalarm; + wait_queue_head_t alarm_wq; + int minor; +}; + +/* linked list of alarms to check for */ + +static struct gpio_private *alarmlist; + +static int gpio_some_alarms; /* Set if someone uses alarm */ +static unsigned long gpio_pa_high_alarms; +static unsigned long gpio_pa_low_alarms; + +static DEFINE_SPINLOCK(alarm_lock); + +#define NUM_PORTS (GPIO_MINOR_LAST+1) +#define GIO_REG_RD_ADDR(reg) \ + (volatile unsigned long *)(regi_gio + REG_RD_ADDR_gio_##reg) +#define GIO_REG_WR_ADDR(reg) \ + (volatile unsigned long *)(regi_gio + REG_RD_ADDR_gio_##reg) +unsigned long led_dummy; +#ifdef CONFIG_ETRAX_VIRTUAL_GPIO +static unsigned long virtual_dummy; +static unsigned long virtual_rw_pv_oe = CONFIG_ETRAX_DEF_GIO_PV_OE; +static unsigned short cached_virtual_gpio_read; +#endif + +static volatile unsigned long *data_out[NUM_PORTS] = { + GIO_REG_WR_ADDR(rw_pa_dout), + GIO_REG_WR_ADDR(rw_pb_dout), + led_dummy, + GIO_REG_WR_ADDR(rw_pc_dout), + GIO_REG_WR_ADDR(rw_pd_dout), + GIO_REG_WR_ADDR(rw_pe_dout), +#ifdef CONFIG_ETRAX_VIRTUAL_GPIO + virtual_dummy, +#endif +}; + +static volatile unsigned long *data_in[NUM_PORTS] = { + GIO_REG_RD_ADDR(r_pa_din), + GIO_REG_RD_ADDR(r_pb_din), + led_dummy, + GIO_REG_RD_ADDR(r_pc_din), +
[PATCH 07/47] Add L2 cache initialization code.
Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/mm/l2cache.c | 29 + 1 files changed, 29 insertions(+), 0 deletions(-) create mode 100644 arch/cris/arch-v32/mm/l2cache.c diff --git a/arch/cris/arch-v32/mm/l2cache.c b/arch/cris/arch-v32/mm/l2cache.c new file mode 100644 index 000..332ff10 --- /dev/null +++ b/arch/cris/arch-v32/mm/l2cache.c @@ -0,0 +1,29 @@ +#include linux/init.h +#include linux/kernel.h +#include linux/string.h +#include memmap.h +#include hwregs/reg_map.h +#include hwregs/reg_rdwr.h +#include hwregs/l2cache_defs.h +#include asm/io.h + +#define L2CACHE_SIZE 64 + +int __init l2cache_init(void) +{ + reg_l2cache_rw_ctrl ctrl = {0}; + reg_l2cache_rw_cfg cfg = {.en = regk_l2cache_yes}; + + ctrl.csize = L2CACHE_SIZE; + ctrl.cbase = L2CACHE_SIZE / 4 + (L2CACHE_SIZE % 4 ? 1 : 0); + REG_WR(l2cache, regi_l2cache, rw_ctrl, ctrl); + + /* Flush the tag memory */ + memset((void *)(MEM_INTMEM_START | MEM_NON_CACHEABLE), 0, 2*1024); + + /* Enable the cache */ + REG_WR(l2cache, regi_l2cache, rw_cfg, cfg); + + return 0; +} + -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 08/47] Add SECOND_WORD_SYNC, used in CRISv32 version of sync_serial.
Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- include/asm-cris/sync_serial.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/include/asm-cris/sync_serial.h b/include/asm-cris/sync_serial.h index f930b6e..d87c24d 100644 --- a/include/asm-cris/sync_serial.h +++ b/include/asm-cris/sync_serial.h @@ -67,6 +67,7 @@ /* Values for SSP_FRAME_SYNC */ #define NORMAL_SYNC1 #define EARLY_SYNC 2 +#define SECOND_WORD_SYNC 0x4 #define BIT_SYNC 4 #define WORD_SYNC 8 -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 09/47] Update CRISv32 synchronous serial driver.
Now uses a DMA descriptor ring, which should avoid any unnecessary pauses in the streams. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/drivers/sync_serial.c | 940 +++--- 1 files changed, 599 insertions(+), 341 deletions(-) diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c index d581b0a..eddb987 100644 --- a/arch/cris/arch-v32/drivers/sync_serial.c +++ b/arch/cris/arch-v32/drivers/sync_serial.c @@ -1,5 +1,5 @@ /* - * Simple synchronous serial port driver for ETRAX FS. + * Simple synchronous serial port driver for ETRAX FS and Artpec-3. * * Copyright (c) 2005 Axis Communications AB * @@ -21,17 +21,18 @@ #include linux/spinlock.h #include asm/io.h -#include asm/arch/dma.h -#include asm/arch/pinmux.h -#include asm/arch/hwregs/reg_rdwr.h -#include asm/arch/hwregs/sser_defs.h -#include asm/arch/hwregs/dma_defs.h -#include asm/arch/hwregs/dma.h -#include asm/arch/hwregs/intr_vect_defs.h -#include asm/arch/hwregs/intr_vect.h -#include asm/arch/hwregs/reg_map.h +#include dma.h +#include pinmux.h +#include hwregs/reg_rdwr.h +#include hwregs/sser_defs.h +#include hwregs/dma_defs.h +#include hwregs/dma.h +#include hwregs/intr_vect_defs.h +#include hwregs/intr_vect.h +#include hwregs/reg_map.h #include asm/sync_serial.h + /* The receiver is a bit tricky beacuse of the continuous stream of data.*/ /* */ /* Three DMA descriptors are linked together. Each DMA descriptor is */ @@ -63,8 +64,10 @@ /* words can be handled */ #define IN_BUFFER_SIZE 12288 #define IN_DESCR_SIZE 256 -#define NUM_IN_DESCR (IN_BUFFER_SIZE/IN_DESCR_SIZE) -#define OUT_BUFFER_SIZE 4096 +#define NBR_IN_DESCR (IN_BUFFER_SIZE/IN_DESCR_SIZE) + +#define OUT_BUFFER_SIZE 1024*8 +#define NBR_OUT_DESCR 8 #define DEFAULT_FRAME_RATE 0 #define DEFAULT_WORD_RATE 7 @@ -78,6 +81,8 @@ #define DEBUGPOLL(x) #define DEBUGRXINT(x) #define DEBUGTXINT(x) +#define DEBUGTRDMA(x) +#define DEBUGOUTBUF(x) typedef struct sync_port { @@ -97,10 +102,11 @@ typedef struct sync_port int output; int input; - volatile unsigned int out_count; /* Remaining bytes for current transfer */ - unsigned char* outp; /* Current position in out_buffer */ - volatile unsigned char* volatile readp; /* Next byte to be read by application */ - volatile unsigned char* volatile writep; /* Next byte to be written by etrax */ + /* Next byte to be read by application */ + volatile unsigned char *volatile readp; + /* Next byte to be written by etrax */ + volatile unsigned char *volatile writep; + unsigned int in_buffer_size; unsigned int inbufchunk; unsigned char out_buffer[OUT_BUFFER_SIZE] __attribute__ ((aligned(32))); @@ -108,11 +114,30 @@ typedef struct sync_port unsigned char flip[IN_BUFFER_SIZE] __attribute__ ((aligned(32))); struct dma_descr_data* next_rx_desc; struct dma_descr_data* prev_rx_desc; + + /* Pointer to the first available descriptor in the ring, +* unless active_tr_descr == catch_tr_descr and a dma +* transfer is active */ + struct dma_descr_data *active_tr_descr; + + /* Pointer to the first allocated descriptor in the ring */ + struct dma_descr_data *catch_tr_descr; + + /* Pointer to the descriptor with the current end-of-list */ + struct dma_descr_data *prev_tr_descr; int full; - dma_descr_data in_descr[NUM_IN_DESCR] __attribute__ ((__aligned__(16))); + /* Pointer to the first byte being read by DMA +* or current position in out_buffer if not using DMA. */ + unsigned char *out_rd_ptr; + + /* Number of bytes currently locked for being read by DMA */ + int out_buf_count; + + dma_descr_data in_descr[NBR_IN_DESCR] __attribute__ ((__aligned__(16))); dma_descr_context in_context __attribute__ ((__aligned__(32))); - dma_descr_data out_descr __attribute__ ((__aligned__(16))); + dma_descr_data out_descr[NBR_OUT_DESCR] + __attribute__ ((__aligned__(16))); dma_descr_context out_context __attribute__ ((__aligned__(32))); wait_queue_head_t out_wait_q; wait_queue_head_t in_wait_q; @@ -121,7 +146,9 @@ typedef struct sync_port } sync_port; static int etrax_sync_serial_init(void); +#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1) static void initialize_port(int portnbr); +#endif static inline int sync_data_avail(struct sync_port *port); static int sync_serial_open(struct inode *, struct file*); @@ -143,11 +170,11 @@ static ssize_t sync_serial_read(struct file *file, char *buf, #endif static void send_word(sync_port* port); -static void start_dma(struct sync_port *port, const char* data, int count); +static void start_dma_out(struct sync_port *port, const char *data, int count); static void
[PATCH 10/47] Merge axisflashmap.h with Axis internal changes.
- Add partition table struct to be used to parse partition table in flash. - Add JFFS2 as a type, and add readoly flag. - Improve some comments. - Lindent has been run, fixing whitespace and formatting issues. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- include/asm-cris/axisflashmap.h | 39 +++ 1 files changed, 27 insertions(+), 12 deletions(-) diff --git a/include/asm-cris/axisflashmap.h b/include/asm-cris/axisflashmap.h index 7a8d311..015ca54 100644 --- a/include/asm-cris/axisflashmap.h +++ b/include/asm-cris/axisflashmap.h @@ -10,23 +10,23 @@ */ #define PARTITION_TABLE_OFFSET 10 -#define PARTITION_TABLE_MAGIC 0xbeef /* Not a good magic */ +#define PARTITION_TABLE_MAGIC 0xbeef /* Not a good magic */ /* The partitiontable_head is located at offset +10: */ struct partitiontable_head { - __u16 magic; /* PARTITION_TABLE_MAGIC */ - __u16 size; /* Length of ptable block (not header) */ - __u32 checksum; /* simple longword sum */ + __u16 magic;/* PARTITION_TABLE_MAGIC */ + __u16 size; /* Length of ptable block (entries + end marker) */ + __u32 checksum; /* simple longword sum, over entries + end marker */ }; /* And followed by partition table entries */ struct partitiontable_entry { - __u32 offset; /* Offset is relative to the sector the ptable is in */ - __u32 size; - __u32 checksum; /* simple longword sum */ - __u16 type; - __u16 flags; /* bit 0: ro/rw = 1/0 */ - __u32 future0; /* 16 bytes reserved for future use */ + __u32 offset; /* relative to the sector the ptable is in */ + __u32 size; /* in bytes */ + __u32 checksum; /* simple longword sum */ + __u16 type; /* see type codes below */ + __u16 flags;/* bit 0: ro/rw = 1/0 */ + __u32 future0; /* 16 bytes reserved for future use */ __u32 future1; __u32 future2; __u32 future3; @@ -35,12 +35,27 @@ struct partitiontable_entry { #define PARTITIONTABLE_END_MARKER 0x #define PARTITIONTABLE_END_MARKER_SIZE 4 -/*#define PARTITION_TYPE_RESCUE 0x?*/ /* Not used, maybe it should? */ +#define PARTITIONTABLE_END_PAD 10 + +/* Complete structure for whole partition table */ +/* note that table may end before CONFIG_ETRAX_PTABLE_ENTRIES by setting + * offset of the last entry + 1 to PARTITIONTABLE_END_MARKER. + */ +struct partitiontable { + __u8 skip[PARTITION_TABLE_OFFSET]; + struct partitiontable_head head; + struct partitiontable_entry entries[]; +}; + #define PARTITION_TYPE_PARAM 0x0001 #define PARTITION_TYPE_KERNEL 0x0002 #define PARTITION_TYPE_JFFS 0x0003 +#define PARTITION_TYPE_JFFS2 0x + +#definePARTITION_FLAGS_READONLY_MASK 0x0001 +#definePARTITION_FLAGS_READONLY0x0001 /* The master mtd for the entire flash. */ -extern struct mtd_info* axisflash_mtd; +extern struct mtd_info *axisflash_mtd; #endif -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 11/47] Minor fixes to CRISv32 irq defines.
- Include files using - Change NR_REAL_IRQS to be calculated from the other defines. - Set MACH_IRQS depending on the value of NR_REAL_IRQS. - Remove unused mask parameter to BUILD_IRQ macro. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- include/asm-cris/arch-v32/irq.h | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/asm-cris/arch-v32/irq.h b/include/asm-cris/arch-v32/irq.h index bac94ee..9e4c9fb 100644 --- a/include/asm-cris/arch-v32/irq.h +++ b/include/asm-cris/arch-v32/irq.h @@ -1,12 +1,17 @@ #ifndef _ASM_ARCH_IRQ_H #define _ASM_ARCH_IRQ_H -#include hwregs/intr_vect.h +#include hwregs/intr_vect.h /* Number of non-cpu interrupts. */ -#define NR_IRQS 0x50 /* Exceptions + IRQs */ -#define NR_REAL_IRQS 0x20 /* IRQs */ +#define NR_IRQS NBR_INTR_VECT /* Exceptions + IRQs */ #define FIRST_IRQ 0x31 /* Exception number for first IRQ */ +#define NR_REAL_IRQS (NBR_INTR_VECT - FIRST_IRQ) /* IRQs */ +#if NR_REAL_IRQS 32 +#define MACH_IRQS 64 +#else +#define MACH_IRQS 32 +#endif #ifndef __ASSEMBLY__ /* Global IRQ vector. */ @@ -73,7 +78,7 @@ void set_exception_vector(int n, irqvectptr addr); * which will acknowledge the interrupt, is run. The actual blocking is made * by crisv32_do_IRQ. */ -#define BUILD_IRQ(nr, mask)\ +#define BUILD_IRQ(nr) \ void IRQ_NAME(nr); \ __asm__ ( \ .text\n\t \ @@ -81,7 +86,7 @@ __asm__ ( \ SAVE_ALL\ KGDB_FIXUP \ move.d #nr,$r10\n\t \ - move.d $sp,$r12\n\t \ + move.d $sp, $r12\n\t \ jsr crisv32_do_IRQ\n\t\ moveq 1, $r11\n\t \ jump ret_from_intr\n\t\ -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 12/47] Remove unnecessary CVS log from cris/mm/init.c
Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/mm/init.c | 111 --- 1 files changed, 0 insertions(+), 111 deletions(-) diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c index 0c833d1..4207a2b 100644 --- a/arch/cris/mm/init.c +++ b/arch/cris/mm/init.c @@ -6,117 +6,6 @@ * * Authors: Bjorn Wesen ([EMAIL PROTECTED]) * - * $Log: init.c,v $ - * Revision 1.11 2004/05/28 09:28:56 starvik - * Calculation of loops_per_usec moved because initialization order has changed - * in Linux 2.6. - * - * Revision 1.10 2004/05/14 07:58:05 starvik - * Merge of changes from 2.4 - * - * Revision 1.9 2003/07/04 08:27:54 starvik - * Merge of Linux 2.5.74 - * - * Revision 1.8 2003/04/09 05:20:48 starvik - * Merge of Linux 2.5.67 - * - * Revision 1.7 2003/01/22 06:48:38 starvik - * Fixed warnings issued by GCC 3.2.1 - * - * Revision 1.6 2002/12/11 14:44:48 starvik - * Extracted v10 (ETRAX 100LX) specific stuff to arch/cris/arch-v10/mm - * - * Revision 1.5 2002/11/18 07:37:37 starvik - * Added cache bug workaround (from Linux 2.4) - * - * Revision 1.4 2002/11/13 15:40:24 starvik - * Removed the page table cache stuff (as done in other archs) - * - * Revision 1.3 2002/11/05 06:45:13 starvik - * Merge of Linux 2.5.45 - * - * Revision 1.2 2001/12/18 13:35:22 bjornw - * Applied the 2.4.13-2.4.16 CRIS patch to 2.5.1 (is a copy of 2.4.15). - * - * Revision 1.31 2001/11/13 16:22:00 bjornw - * Skip calculating totalram and sharedram in si_meminfo - * - * Revision 1.30 2001/11/12 19:02:10 pkj - * Fixed compiler warnings. - * - * Revision 1.29 2001/07/25 16:09:50 bjornw - * val-sharedram will stay 0 - * - * Revision 1.28 2001/06/28 16:30:17 bjornw - * Oops. This needs to wait until 2.4.6 is merged - * - * Revision 1.27 2001/06/28 14:04:07 bjornw - * Fill in sharedram - * - * Revision 1.26 2001/06/18 06:36:02 hp - * Enable free_initmem of __init-type pages - * - * Revision 1.25 2001/06/13 00:02:23 bjornw - * Use a separate variable to store the current pgd to avoid races in schedule - * - * Revision 1.24 2001/05/15 00:52:20 hp - * Only map segment 0xa as seg if CONFIG_JULIETTE - * - * Revision 1.23 2001/04/04 14:35:40 bjornw - * * Removed get_pte_slow and friends (2.4.3 change) - * * Removed bad_pmd handling (2.4.3 change) - * - * Revision 1.22 2001/04/04 13:38:04 matsfg - * Moved ioremap to a separate function instead - * - * Revision 1.21 2001/03/27 09:28:33 bjornw - * ioremap used too early - lets try it in mem_init instead - * - * Revision 1.20 2001/03/23 07:39:21 starvik - * Corrected according to review remarks - * - * Revision 1.19 2001/03/15 14:25:17 bjornw - * More general shadow registers and ioremaped addresses for external I/O - * - * Revision 1.18 2001/02/23 12:46:44 bjornw - * * 0xc was not CSE1; 0x8 is, same as uncached flash, so we move the uncached - *flash during CRIS_LOW_MAP from 0xe to 0x8 so both the flash and the I/O - *is mapped straight over (for !CRIS_LOW_MAP the uncached flash is still 0xe) - * - * Revision 1.17 2001/02/22 15:05:21 bjornw - * Map 0x9 straight over during LOW_MAP to allow for memory mapped LEDs - * - * Revision 1.16 2001/02/22 15:02:35 bjornw - * Map 0xc straight over during LOW_MAP to allow for memory mapped I/O - * - * Revision 1.15 2001/01/10 21:12:10 bjornw - * loops_per_sec - loops_per_jiffy - * - * Revision 1.14 2000/11/22 16:23:20 bjornw - * Initialize totalhigh counters to 0 to make /proc/meminfo look nice. - * - * Revision 1.13 2000/11/21 16:37:51 bjornw - * Temporarily disable initmem freeing - * - * Revision 1.12 2000/11/21 13:55:07 bjornw - * Use CONFIG_CRIS_LOW_MAP for the low VM map instead of explicit CPU type - * - * Revision 1.11 2000/10/06 12:38:22 bjornw - * Cast empty_bad_page correctly (should really be of * type from the start.. - * - * Revision 1.10 2000/10/04 16:53:57 bjornw - * Fix memory-map due to LX features - * - * Revision 1.9 2000/09/13 15:47:49 bjornw - * Wrong count in reserved-pages loop - * - * Revision 1.8 2000/09/13 14:35:10 bjornw - * 2.4.0-test8 added a new arg to free_area_init_node - * - * Revision 1.7 2000/08/17 15:35:55 bjornw - * 2.4.0-test6 removed MAP_NR and inserted virt_to_page - * - * */ #include linux/init.h -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 13/47] Add prototypes for cache flushing on CRISv32
We need these to work around some cache bugs in CRISv32 chips. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- include/asm-cris/arch-v32/cache.h | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/include/asm-cris/arch-v32/cache.h b/include/asm-cris/arch-v32/cache.h index 80b236b..b3d752d 100644 --- a/include/asm-cris/arch-v32/cache.h +++ b/include/asm-cris/arch-v32/cache.h @@ -1,8 +1,19 @@ #ifndef _ASM_CRIS_ARCH_CACHE_H #define _ASM_CRIS_ARCH_CACHE_H +#include asm/arch/hwregs/dma.h + /* A cache-line is 32 bytes. */ #define L1_CACHE_BYTES 32 #define L1_CACHE_SHIFT 5 +void flush_dma_list(dma_descr_data *descr); +void flush_dma_descr(dma_descr_data *descr, int flush_buf); + +#define flush_dma_context(c) \ + flush_dma_list(phys_to_virt((c)-saved_data)); + +void cris_flush_cache_range(void *buf, unsigned long len); +void cris_flush_cache(void); + #endif /* _ASM_CRIS_ARCH_CACHE_H */ -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 14/47] Add headers for CRISv32 chips EtraxFS and Artpec-3.
Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- include/asm-cris/Kbuild |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/include/asm-cris/Kbuild b/include/asm-cris/Kbuild index 14498d5..7ce0692 100644 --- a/include/asm-cris/Kbuild +++ b/include/asm-cris/Kbuild @@ -1,5 +1,8 @@ include include/asm-generic/Kbuild.asm +header-$(CONFIG_ETRAX_ARCH_V10) += arch-v10/ +header-$(CONFIG_ETRAX_ARCH_V32) += arch-v32/ + header-y += arch-v10/ arch-v32/ unifdef-y += rs485.h -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 18/47] Remove define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY from CRIS.
Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- include/asm-cris/dma-mapping.h | 11 --- 1 files changed, 0 insertions(+), 11 deletions(-) diff --git a/include/asm-cris/dma-mapping.h b/include/asm-cris/dma-mapping.h index 662cea7..edc8d1b 100644 --- a/include/asm-cris/dma-mapping.h +++ b/include/asm-cris/dma-mapping.h @@ -164,16 +164,5 @@ dma_cache_sync(struct device *dev, void *vaddr, size_t size, { } -#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY -extern int -dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, - dma_addr_t device_addr, size_t size, int flags); - -extern void -dma_release_declared_memory(struct device *dev); - -extern void * -dma_mark_declared_memory_occupied(struct device *dev, - dma_addr_t device_addr, size_t size); #endif -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 15/47] Minor fixes to mm/fault.c for CRIS.
- Only disallow oops if we're in_interrupt context (was in_atomic before) - Use the generic oops_in_progress instead of the raw_printk hack. - Fix whitespace/formatting. - Remove CVS log entries. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/mm/fault.c | 169 - 1 files changed, 28 insertions(+), 141 deletions(-) diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c index 3034f3f..c4c76db 100644 --- a/arch/cris/mm/fault.c +++ b/arch/cris/mm/fault.c @@ -1,130 +1,9 @@ /* * linux/arch/cris/mm/fault.c * - * Copyright (C) 2000, 2001 Axis Communications AB - * - * Authors: Bjorn Wesen - * - * $Log: fault.c,v $ - * Revision 1.20 2005/03/04 08:16:18 starvik - * Merge of Linux 2.6.11. - * - * Revision 1.19 2005/01/14 10:07:59 starvik - * Fixed warning. - * - * Revision 1.18 2005/01/12 08:10:14 starvik - * Re-added the change of frametype when handling kernel page fault fixup - * for v10. This is necessary to avoid that the CPU remakes the faulting - * access. - * - * Revision 1.17 2005/01/11 13:53:05 starvik - * Use raw_printk. - * - * Revision 1.16 2004/12/17 11:39:41 starvik - * SMP support. - * - * Revision 1.15 2004/11/23 18:36:18 starvik - * Stack is now non-executable. - * Signal handler trampolines are placed in a reserved page mapped into all - * processes. - * - * Revision 1.14 2004/11/23 07:10:21 starvik - * Moved find_fixup_code to generic code. - * - * Revision 1.13 2004/11/23 07:00:54 starvik - * Actually use the execute permission bit in the MMU. This makes it possible - * to prevent e.g. attacks where executable code is put on the stack. - * - * Revision 1.12 2004/09/29 06:16:04 starvik - * Use instruction_pointer - * - * Revision 1.11 2004/05/14 07:58:05 starvik - * Merge of changes from 2.4 - * - * Revision 1.10 2003/10/27 14:51:24 starvik - * Removed debugcode - * - * Revision 1.9 2003/10/27 14:50:42 starvik - * Changed do_page_fault signature - * - * Revision 1.8 2003/07/04 13:02:48 tobiasa - * Moved code snippet from arch/cris/mm/fault.c that searches for fixup code - * to separate function in arch-specific files. - * - * Revision 1.7 2003/01/22 06:48:38 starvik - * Fixed warnings issued by GCC 3.2.1 - * - * Revision 1.6 2003/01/09 14:42:52 starvik - * Merge of Linux 2.5.55 - * - * Revision 1.5 2002/12/11 14:44:48 starvik - * Extracted v10 (ETRAX 100LX) specific stuff to arch/cris/arch-v10/mm - * - * Revision 1.4 2002/11/13 15:10:28 starvik - * pte_offset has been renamed to pte_offset_kernel - * - * Revision 1.3 2002/11/05 06:45:13 starvik - * Merge of Linux 2.5.45 - * - * Revision 1.2 2001/12/18 13:35:22 bjornw - * Applied the 2.4.13-2.4.16 CRIS patch to 2.5.1 (is a copy of 2.4.15). - * - * Revision 1.20 2001/11/22 13:34:06 bjornw - * * Bug workaround (LX TR89): force a rerun of the whole of an interrupted - *unaligned write, because the second half of the write will be corrupted - *otherwise. Affected unaligned writes spanning not-yet mapped pages. - * * Optimization: use the wr_rd bit in R_MMU_CAUSE to know whether a miss - *was due to a read or a write (before we didn't know this until the next - *restart of the interrupted instruction, thus wasting one fault-irq) - * - * Revision 1.19 2001/11/12 19:02:10 pkj - * Fixed compiler warnings. - * - * Revision 1.18 2001/07/18 22:14:32 bjornw - * Enable interrupts in the bulk of do_page_fault - * - * Revision 1.17 2001/07/18 13:07:23 bjornw - * * Detect non-existant PTE's in vmalloc pmd synchronization - * * Remove comment about fast-paths for VMALLOC_START etc, because all that - *was totally bogus anyway it turned out :) - * * Fix detection of vmalloc-area synchronization - * * Add some comments - * - * Revision 1.16 2001/06/13 00:06:08 bjornw - * current_pgd should be volatile - * - * Revision 1.15 2001/06/13 00:02:23 bjornw - * Use a separate variable to store the current pgd to avoid races in schedule - * - * Revision 1.14 2001/05/16 17:41:07 hp - * Last comment tweak further tweaked. - * - * Revision 1.13 2001/05/15 00:58:44 hp - * Expand a bit on the comment why we compare address = TASK_SIZE rather - * than = VMALLOC_START. - * - * Revision 1.12 2001/04/04 10:51:14 bjornw - * mmap_sem is grabbed for reading - * - * Revision 1.11 2001/03/23 07:36:07 starvik - * Corrected according to review remarks - * - * Revision 1.10 2001/03/21 16:10:11 bjornw - * CRIS_FRAME_FIXUP not needed anymore, use FRAME_NORMAL - * - * Revision 1.9 2001/03/05 13:22:20 bjornw - * Spell-fix and fix in vmalloc_fault handling - * - * Revision 1.8 2000/11/22 14:45:31 bjornw - * * 2.4.0-test10 removed the set_pgdir instantaneous kernel global mapping - *into all processes. Instead we fill in the missing PTE entries on demand. - * - * Revision 1.7 2000/11/21 16:39:09 bjornw - * fixup switches frametype - * - * Revision 1.6
[PATCH 16/47] Minor CRIS generic kernel/traps.c changes.
- Collect extern declarations at top of file. - Change raw_printk to printk, use oops_in_progress instead. - Fix formatting and whitespace. - Allow the watchdog to be disabled during oops. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/kernel/traps.c | 226 -- 1 files changed, 139 insertions(+), 87 deletions(-) diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c index 520d922..541efbf 100644 --- a/arch/cris/kernel/traps.c +++ b/arch/cris/kernel/traps.c @@ -1,66 +1,78 @@ -/* $Id: traps.c,v 1.11 2005/01/24 16:03:19 orjanf Exp $ - * +/* * linux/arch/cris/traps.c * - * Here we handle the break vectors not used by the system call - * mechanism, as well as some general stack/register dumping + * Here we handle the break vectors not used by the system call + * mechanism, as well as some general stack/register dumping * things. - * - * Copyright (C) 2000-2002 Axis Communications AB + * + * Copyright (C) 2000-2007 Axis Communications AB * * Authors: Bjorn Wesen - *Hans-Peter Nilsson + * Hans-Peter Nilsson * */ #include linux/init.h #include linux/module.h + #include asm/pgtable.h #include asm/uaccess.h +extern void arch_enable_nmi(void); +extern void stop_watchdog(void); +extern void reset_watchdog(void); +extern void show_registers(struct pt_regs *regs); + +#ifdef CONFIG_DEBUG_BUGVERBOSE +extern void handle_BUG(struct pt_regs *regs); +#else +#define handle_BUG(regs) +#endif + static int kstack_depth_to_print = 24; -extern int raw_printk(const char *fmt, ...); +void (*nmi_handler)(struct pt_regs *); -void show_trace(unsigned long * stack) +void +show_trace(unsigned long *stack) { unsigned long addr, module_start, module_end; extern char _stext, _etext; int i; -raw_printk(\nCall Trace: ); + printk(\nCall Trace: ); -i = 1; -module_start = VMALLOC_START; -module_end = VMALLOC_END; + i = 1; + module_start = VMALLOC_START; + module_end = VMALLOC_END; -while (((long) stack (THREAD_SIZE-1)) != 0) { - if (__get_user (addr, stack)) { + while (((long)stack (THREAD_SIZE-1)) != 0) { + if (__get_user(addr, stack)) { /* This message matches failing address marked s390 in ksymoops, so lines containing it will not be filtered out by ksymoops. */ - raw_printk (Failing address 0x%lx\n, (unsigned long)stack); + printk(Failing address 0x%lx\n, (unsigned long)stack); break; } stack++; -/* - * If the address is either in the text segment of the - * kernel, or in the region which contains vmalloc'ed - * memory, it *may* be the address of a calling - * routine; if so, print it so that someone tracing - * down the cause of the crash will be able to figure - * out the call path that was taken. - */ -if (((addr = (unsigned long) _stext) - (addr = (unsigned long) _etext)) || -((addr = module_start) (addr = module_end))) { -if (i ((i % 8) == 0)) -raw_printk(\n ); -raw_printk([%08lx] , addr); -i++; -} -} + /* +* If the address is either in the text segment of the +* kernel, or in the region which contains vmalloc'ed +* memory, it *may* be the address of a calling +* routine; if so, print it so that someone tracing +* down the cause of the crash will be able to figure +* out the call path that was taken. +*/ + if (((addr = (unsigned long)_stext) +(addr = (unsigned long)_etext)) || + ((addr = module_start) (addr = module_end))) { + if (i ((i % 8) == 0)) + printk(\n ); + printk([%08lx] , addr); + i++; + } + } } /* @@ -78,109 +90,149 @@ void show_trace(unsigned long * stack) * with the ksymoops maintainer. */ -void +void show_stack(struct task_struct *task, unsigned long *sp) { -unsigned long *stack, addr; -int i; + unsigned long *stack, addr; + int i; /* * debugging aid: show_stack(NULL); prints a * back trace. */ -if(sp == NULL) { + if (sp == NULL) { if (task) sp = (unsigned long*)task-thread.ksp; else sp = (unsigned
[PATCH 17/47] Add handling of PTRACE_DETATCH for CRISv32. Whitespace and formatting changes to avoid checkpatch errors.
Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/kernel/ptrace.c | 13 + arch/cris/arch-v32/mm/Makefile |3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c index 2df6052..87014db 100644 --- a/arch/cris/arch-v32/kernel/ptrace.c +++ b/arch/cris/arch-v32/kernel/ptrace.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003, Axis Communications AB. + * Copyright (C) 2000-2007, Axis Communications AB. */ #include linux/kernel.h @@ -149,7 +149,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) ret = generic_ptrace_pokedata(child, addr, data); break; - /* Write the word at location address in the USER area. */ + /* Write the word at location address in the USER area. */ case PTRACE_POKEUSR: ret = -EIO; if ((addr 3) || addr 0 || addr PT_MAX 2) @@ -201,7 +201,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; - /* Make the child exit by sending it a sigkill. */ + /* Make the child exit by sending it a sigkill. */ case PTRACE_KILL: ret = 0; @@ -245,9 +245,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; } + case PTRACE_DETACH: + ret = ptrace_detach(child, data); + break; + /* Get all GP registers from the child. */ case PTRACE_GETREGS: { - int i; + int i; unsigned long tmp; for (i = 0; i = PT_MAX; i++) { @@ -294,6 +298,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) break; } +out_tsk: return ret; } diff --git a/arch/cris/arch-v32/mm/Makefile b/arch/cris/arch-v32/mm/Makefile index 9146f88..0b801f2 100644 --- a/arch/cris/arch-v32/mm/Makefile +++ b/arch/cris/arch-v32/mm/Makefile @@ -1,3 +1,4 @@ # Makefile for the Linux/cris parts of the memory manager. -obj-y := mmu.o init.o tlb.o intmem.o +obj-y += mmu.o init.o tlb.o intmem.o +obj-$(CONFIG_ETRAX_L2CACHE)+= l2cache.o -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 19/47] Update CRISv32 entry.S to working order.
- Remove oldset parameter. - Utilise delay-slot for parameter moving. - Add kernel_execve as break 13. - Add new kernel syscalls. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/kernel/entry.S | 82 + 1 files changed, 64 insertions(+), 18 deletions(-) diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S index f9d2780..596184c 100644 --- a/arch/cris/arch-v32/kernel/entry.S +++ b/arch/cris/arch-v32/kernel/entry.S @@ -10,7 +10,7 @@ * after a timer-interrupt and after each system call. * * Stack layout in 'ret_from_system_call': - * ptrace needs to have all regs on the stack. + * ptrace needs to have all regs on the stack. * if the order here is changed, it needs to be * updated in fork.c:copy_process, signal.c:do_signal, * ptrace.c and ptrace.h @@ -281,12 +281,10 @@ _work_notifysig: ;; Deal with pending signals and notify-resume requests. addoq +TI_flags, $r0, $acr - move.d [$acr], $r13; The thread_info_flags parameter. - move.d $r9, $r10 ; do_notify_resume syscall/irq param. - moveq 0, $r11 ; oldset param - 0 in this case. - move.d $sp, $r12 ; The regs param. + move.d [$acr], $r12; The thread_info_flags parameter. + move.d $sp, $r11 ; The regs param. jsr do_notify_resume - nop + move.d $r9, $r10 ; do_notify_resume syscall/irq param. ba _Rexit nop @@ -396,7 +394,7 @@ nmi_interrupt: btstq REG_BIT(intr_vect, r_nmi, watchdog), $r0 bpl 1f nop - jsr handle_watchdog_bite; In time.c. + jsr handle_watchdog_bite; In time.c. move.d $sp, $r10 ; Pointer to registers 1: btstq REG_BIT(intr_vect, r_nmi, ext), $r0 bpl 1f @@ -515,6 +513,13 @@ _ugdb_handle_exception: ba do_sigtrap ; SIGTRAP the offending process. move.d [$sp+], $r0 ; Restore R0 in delay slot. + .global kernel_execve +kernel_execve: + move.d __NR_execve, $r9 + break 13 + ret + nop + .data .section .rodata,a @@ -778,21 +783,21 @@ sys_call_table: .long sys_epoll_ctl /* 255 */ .long sys_epoll_wait .long sys_remap_file_pages - .long sys_set_tid_address - .long sys_timer_create - .long sys_timer_settime /* 260 */ - .long sys_timer_gettime - .long sys_timer_getoverrun - .long sys_timer_delete - .long sys_clock_settime - .long sys_clock_gettime /* 265 */ - .long sys_clock_getres - .long sys_clock_nanosleep + .long sys_set_tid_address + .long sys_timer_create + .long sys_timer_settime /* 260 */ + .long sys_timer_gettime + .long sys_timer_getoverrun + .long sys_timer_delete + .long sys_clock_settime + .long sys_clock_gettime /* 265 */ + .long sys_clock_getres + .long sys_clock_nanosleep .long sys_statfs64 .long sys_fstatfs64 .long sys_tgkill/* 270 */ .long sys_utimes - .long sys_fadvise64_64 + .long sys_fadvise64_64 .long sys_ni_syscall/* sys_vserver */ .long sys_ni_syscall/* sys_mbind */ .long sys_ni_syscall/* 275 sys_get_mempolicy */ @@ -805,6 +810,47 @@ sys_call_table: .long sys_mq_getsetattr .long sys_ni_syscall/* reserved for kexec */ .long sys_waitid + .long sys_ni_syscall/* 285 */ /* available */ + .long sys_add_key + .long sys_request_key + .long sys_keyctl + .long sys_ioprio_set + .long sys_ioprio_get/* 290 */ + .long sys_inotify_init + .long sys_inotify_add_watch + .long sys_inotify_rm_watch + .long sys_migrate_pages + .long sys_openat/* 295 */ + .long sys_mkdirat + .long sys_mknodat + .long sys_fchownat + .long sys_futimesat + .long sys_fstatat64 /* 300 */ + .long sys_unlinkat + .long sys_renameat + .long sys_linkat + .long sys_symlinkat + .long sys_readlinkat/* 305 */ + .long sys_fchmodat + .long sys_faccessat + .long sys_pselect6 + .long sys_ppoll + .long sys_unshare /* 310 */ + .long sys_set_robust_list + .long sys_set_robust_list + .long sys_get_robust_list + .long sys_splice + .long sys_sync_file_range + .long sys_tee /* 315 */ + .long sys_vmsplice + .long sys_move_pages + .long sys_getcpu + .long sys_epoll_pwait + .long sys_utimensat /* 320 */ + .long sys_signalfd + .long sys_timerfd + .long
[PATCH 20/47] Fixup CRISv32 kernel Makefile.
- Remove CRISv32 common arbiter, dma, io and pinmux files, they are now defined in machine dependent directories. - Add cache and cacheflush files for working around cache problems in CRISv32 chips. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/kernel/Makefile |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/cris/arch-v32/kernel/Makefile b/arch/cris/arch-v32/kernel/Makefile index 5d5b613..993d987 100644 --- a/arch/cris/arch-v32/kernel/Makefile +++ b/arch/cris/arch-v32/kernel/Makefile @@ -1,4 +1,3 @@ -# $Id: Makefile,v 1.11 2004/12/17 10:16:13 starvik Exp $ # # Makefile for the linux kernel. # @@ -6,9 +5,9 @@ extra-y:= head.o -obj-y := entry.o traps.o irq.o debugport.o dma.o pinmux.o \ +obj-y := entry.o traps.o irq.o debugport.o \ process.o ptrace.o setup.o signal.o traps.o time.o \ - arbiter.o io.o + cache.o cacheflush.o obj-$(CONFIG_ETRAXFS_SIM) += vcs_hook.o -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 21/47] New version of CRISv32 I2C driver.
- Add i2c_write and i2c_read as functions. - Use spinlocks for critical regions. - Add config item to set I2C data and clock port. - Put unneeded testcode inside #if 0. - Remove CVS id tag. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/drivers/i2c.c | 199 +++--- arch/cris/arch-v32/drivers/i2c.h |2 + 2 files changed, 187 insertions(+), 14 deletions(-) diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c index f1edd2e..4eda323 100644 --- a/arch/cris/arch-v32/drivers/i2c.c +++ b/arch/cris/arch-v32/drivers/i2c.c @@ -19,10 +19,10 @@ *! *! --- *! -*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN +*! (C) Copyright 1999-2007 Axis Communications AB, LUND, SWEDEN *! *!***/ -/* $Id: i2c.c,v 1.2 2005/05/09 15:29:49 starvik Exp $ */ + /** INCLUDE FILES SECTION ***/ #include linux/module.h @@ -79,6 +79,8 @@ static const char i2c_name[] = i2c; #define i2c_delay(usecs) udelay(usecs) +static DEFINE_SPINLOCK(i2c_lock); /* Protect directions etc */ + /** VARIABLE SECTION / static struct crisv32_iopin cris_i2c_clk; @@ -252,6 +254,7 @@ i2c_getack(void) * generate ACK clock pulse */ i2c_clk(I2C_CLOCK_HIGH); +#if 0 /* * Use PORT PB instead of I2C * for input. (I2C not working) @@ -264,6 +267,8 @@ i2c_getack(void) i2c_data(1); i2c_disable(); i2c_dir_in(); +#endif + /* * now wait for ack */ @@ -271,11 +276,11 @@ i2c_getack(void) /* * check for ack */ - if(i2c_getbit()) + if (i2c_getbit()) ack = 0; i2c_delay(CLOCK_HIGH_TIME/2); - if(!ack){ - if(!i2c_getbit()) /* receiver pulled SDA low */ + if (!ack) { + if (!i2c_getbit()) /* receiver pulld SDA low */ ack = 1; i2c_delay(CLOCK_HIGH_TIME/2); } @@ -285,6 +290,7 @@ i2c_getack(void) * before we enable our output. If we keep data high * and enable output, we would generate a stop condition. */ +#if 0 i2c_data(I2C_DATA_LOW); /* @@ -292,6 +298,7 @@ i2c_getack(void) */ i2c_enable(); i2c_dir_out(); +#endif i2c_clk(I2C_CLOCK_LOW); i2c_delay(CLOCK_HIGH_TIME/4); /* @@ -375,6 +382,137 @@ i2c_sendnack(void) /*#--- *# +*# FUNCTION NAME: i2c_write +*# +*# DESCRIPTION : Writes a value to an I2C device +*# +*#--*/ +int +i2c_write(unsigned char theSlave, void *data, size_t nbytes) +{ + int error, cntr = 3; + unsigned char bytes_wrote = 0; + unsigned char value; + unsigned long flags; + + spin_lock(i2c_lock); + + do { + error = 0; + /* +* we don't like to be interrupted +*/ + local_irq_save(flags); + + i2c_start(); + /* +* send slave address +*/ + i2c_outbyte((theSlave 0xfe)); + /* +* wait for ack +*/ + if (!i2c_getack()) + error = 1; + /* +* send data +*/ + for (bytes_wrote = 0; bytes_wrote nbytes; bytes_wrote++) { + memcpy(value, data + bytes_wrote, sizeof value); + i2c_outbyte(value); + /* +* now it's time to wait for ack +*/ + if (!i2c_getack()) + error |= 4; + } + /* +* end byte stream +*/ + i2c_stop(); + /* +* enable interrupt again +*/ + local_irq_restore(flags); + + } while (error cntr--); + + i2c_delay(CLOCK_LOW_TIME); + + spin_unlock(i2c_lock); + + return -error; +} + +/*#--- +*# +*# FUNCTION NAME: i2c_read +*# +*# DESCRIPTION : Reads a value from an I2C device +*# +*#--*/ +int +i2c_read(unsigned char theSlave, void *data, size_t nbytes) +{ + unsigned char b = 0; + unsigned char bytes_read = 0; + int error, cntr = 3; + unsigned long flags; + + spin_lock(i2c_lock); + + do { + error = 0; + memset(data, 0, nbytes);
[PATCH 22/47] Update and improve axisflashmap for CRISv32.
- Use default partition table when no partition is found (for initial tests) - Add config ETRAX_AXISFLASHMAP_MTD0WHOLE to allow whole flash as mtd0. - Add config for VCS simulator connection. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/drivers/axisflashmap.c | 488 - 1 files changed, 345 insertions(+), 143 deletions(-) diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c index c5ff95e..51e1e85 100644 --- a/arch/cris/arch-v32/drivers/axisflashmap.c +++ b/arch/cris/arch-v32/drivers/axisflashmap.c @@ -1,7 +1,7 @@ /* * Physical mapping layer for MTD using the Axis partitiontable format * - * Copyright (c) 2001, 2002, 2003 Axis Communications AB + * Copyright (c) 2001-2007 Axis Communications AB * * This file is under the GPL. * @@ -10,9 +10,6 @@ * tells us what other partitions to define. If there isn't, we use a default * partition split defined below. * - * Copy of os/lx25/arch/cris/arch-v10/drivers/axisflashmap.c 1.5 - * with minor changes. - * */ #include linux/module.h @@ -27,7 +24,8 @@ #include linux/mtd/mtdram.h #include linux/mtd/partitions.h -#include asm/arch/hwregs/config_defs.h +#include linux/cramfs_fs.h + #include asm/axisflashmap.h #include asm/mmu.h @@ -37,16 +35,24 @@ #define FLASH_UNCACHED_ADDR KSEG_E #define FLASH_CACHED_ADDRKSEG_F +#define PAGESIZE (512) + #if CONFIG_ETRAX_FLASH_BUSWIDTH==1 #define flash_data __u8 #elif CONFIG_ETRAX_FLASH_BUSWIDTH==2 #define flash_data __u16 #elif CONFIG_ETRAX_FLASH_BUSWIDTH==4 -#define flash_data __u16 +#define flash_data __u32 #endif /* From head.S */ -extern unsigned long romfs_start, romfs_length, romfs_in_flash; +extern unsigned long romfs_in_flash; /* 1 when romfs_start, _length in flash */ +extern unsigned long romfs_start, romfs_length; +extern unsigned long nand_boot; /* 1 when booted from nand flash */ + +struct partition_name { + char name[6]; +}; /* The master mtd for the entire flash. */ struct mtd_info* axisflash_mtd = NULL; @@ -112,32 +118,20 @@ static struct map_info map_cse1 = { .map_priv_1 = FLASH_UNCACHED_ADDR + MEM_CSE0_SIZE }; -/* If no partition-table was found, we use this default-set. */ -#define MAX_PARTITIONS 7 -#define NUM_DEFAULT_PARTITIONS 3 +#define MAX_PARTITIONS 7 +#ifdef CONFIG_ETRAX_NANDBOOT +#define NUM_DEFAULT_PARTITIONS 4 +#define DEFAULT_ROOTFS_PARTITION_NO2 +#define DEFAULT_MEDIA_SIZE 0x200 /* 32 megs */ +#else +#define NUM_DEFAULT_PARTITIONS 3 +#define DEFAULT_ROOTFS_PARTITION_NO(-1) +#define DEFAULT_MEDIA_SIZE 0x80 /* 8 megs */ +#endif -/* - * Default flash size is 2MB. CONFIG_ETRAX_PTABLE_SECTOR is most likely the - * size of one flash block and filesystem-partition needs 5 blocks to be able - * to use JFFS. - */ -static struct mtd_partition axis_default_partitions[NUM_DEFAULT_PARTITIONS] = { - { - .name = boot firmware, - .size = CONFIG_ETRAX_PTABLE_SECTOR, - .offset = 0 - }, - { - .name = kernel, - .size = 0x20 - (6 * CONFIG_ETRAX_PTABLE_SECTOR), - .offset = CONFIG_ETRAX_PTABLE_SECTOR - }, - { - .name = filesystem, - .size = 5 * CONFIG_ETRAX_PTABLE_SECTOR, - .offset = 0x20 - (5 * CONFIG_ETRAX_PTABLE_SECTOR) - } -}; +#if (MAX_PARTITIONS NUM_DEFAULT_PARTITIONS) +#error MAX_PARTITIONS must be = than NUM_DEFAULT_PARTITIONS +#endif /* Initialize the ones normally used. */ static struct mtd_partition axis_partitions[MAX_PARTITIONS] = { @@ -178,6 +172,56 @@ static struct mtd_partition axis_partitions[MAX_PARTITIONS] = { }, }; + +/* If no partition-table was found, we use this default-set. + * Default flash size is 8MB (NOR). CONFIG_ETRAX_PTABLE_SECTOR is most + * likely the size of one flash block and filesystem-partition needs + * to be =5 blocks to be able to use JFFS. + */ +static struct mtd_partition axis_default_partitions[NUM_DEFAULT_PARTITIONS] = { + { + .name = boot firmware, + .size = CONFIG_ETRAX_PTABLE_SECTOR, + .offset = 0 + }, + { + .name = kernel, + .size = 10 * CONFIG_ETRAX_PTABLE_SECTOR, + .offset = CONFIG_ETRAX_PTABLE_SECTOR + }, +#define FILESYSTEM_SECTOR (11 * CONFIG_ETRAX_PTABLE_SECTOR) +#ifdef CONFIG_ETRAX_NANDBOOT + { + .name = rootfs, + .size = 10 * CONFIG_ETRAX_PTABLE_SECTOR, + .offset = FILESYSTEM_SECTOR + }, +#undef FILESYSTEM_SECTOR +#define FILESYSTEM_SECTOR (21 * CONFIG_ETRAX_PTABLE_SECTOR) +#endif + { + .name = rwfs, + .size = DEFAULT_MEDIA_SIZE - FILESYSTEM_SECTOR, + .offset = FILESYSTEM_SECTOR + } +}; + +#ifdef
[PATCH 23/47] Update CRIS main Kbuild makefile.
- Remove old and non-generic targets, use generic ones instead. - Add sub-arch as mach-fs or mach-a3 for EtraxFS and Artpec-3 respectively. - Add links to sub-arch directories, and erase before trying to create them. - Include from sub-arch specific include directory mach. - Add files to be cleaned in CLEAN_FILES instead of as archclean target. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/Makefile | 139 ++-- 1 files changed, 70 insertions(+), 69 deletions(-) diff --git a/arch/cris/Makefile b/arch/cris/Makefile index e6bf00c..838cd2a 100644 --- a/arch/cris/Makefile +++ b/arch/cris/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.28 2005/03/17 10:44:37 larsv Exp $ +# # cris/Makefile # # This file is included by the global makefile so that you can add your own @@ -10,28 +10,36 @@ # License. See the file COPYING in the main directory of this archive # for more details. -# A bug in ld prevents us from having a (constant-value) symbol in a -# ORIGIN = or LENGTH = expression. - arch-y := v10 arch-$(CONFIG_ETRAX_ARCH_V10) := v10 arch-$(CONFIG_ETRAX_ARCH_V32) := v32 -# No config avaiable for make clean etc +# No config available for make clean etc +mach-y := fs +mach-$(CONFIG_CRIS_MACH_ARTPEC3) := a3 +mach-$(CONFIG_ETRAXFS) := fs + ifneq ($(arch-y),) SARCH := arch-$(arch-y) else SARCH := endif +ifneq ($(mach-y),) +MACH := mach-$(mach-y) +else +MACH := +endif + LD = $(CROSS_COMPILE)ld -mcrislinux OBJCOPYFLAGS := -O binary -R .note -R .comment -S CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) -KBUILD_AFLAGS += -mlinux -KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe +KBUILD_AFLAGS += -mlinux -march=$(arch-y) -Iinclude/asm/arch/mach -Iinclude/asm/arch + +KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe -Iinclude/asm/arch/mach -Iinclude/asm/arch ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g @@ -44,6 +52,9 @@ LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a) core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/ +ifdef CONFIG_ETRAX_ARCH_V32 +core-y += arch/$(ARCH)/$(SARCH)/$(MACH)/ +endif drivers-y += arch/$(ARCH)/$(SARCH)/drivers/ libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC) @@ -52,79 +63,69 @@ SRC_ARCH = $(srctree)/arch/$(ARCH) # cris object files path OBJ_ARCH = $(objtree)/arch/$(ARCH) -target_boot_arch_dir = $(OBJ_ARCH)/$(SARCH)/boot -target_boot_dir = $(OBJ_ARCH)/boot -src_boot_dir = $(SRC_ARCH)/boot -target_compressed_dir = $(OBJ_ARCH)/boot/compressed -src_compressed_dir= $(SRC_ARCH)/boot/compressed -target_rescue_dir = $(OBJ_ARCH)/boot/rescue -src_rescue_dir= $(SRC_ARCH)/boot/rescue - -export target_boot_arch_dir target_boot_dir src_boot_dir target_compressed_dir src_compressed_dir target_rescue_dir src_rescue_dir - -vmlinux.bin: vmlinux - $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin - -timage: vmlinux.bin - cat vmlinux.bin cramfs.img timage - -simimage: timage - cp vmlinux.bin simvmlinux.bin - -# the following will remake timage without compiling the kernel -# it does of course require that all object files exist... - -cramfs: -## cramfs - Creates a cramfs image - mkcramfs -b 8192 -m romfs_meta.txt root cramfs.img - cat vmlinux.bin cramfs.img timage +boot := arch/$(ARCH)/boot +MACHINE := arch/$(ARCH)/$(SARCH) -clinux: vmlinux.bin decompress.bin rescue.bin +all: zImage -decompress.bin: $(target_boot_dir) - @$(MAKE) -f $(src_compressed_dir)/Makefile $(target_compressed_dir)/decompress.bin +zImage Image: vmlinux + $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ -$(target_rescue_dir)/rescue.bin: $(target_boot_dir) - @$(MAKE) -f $(src_rescue_dir)/Makefile $(target_rescue_dir)/rescue.bin - -zImage: $(target_boot_dir) vmlinux.bin $(target_rescue_dir)/rescue.bin -## zImage - Compressed kernel (gzip) - @$(MAKE) -f $(src_boot_dir)/Makefile zImage - -$(target_boot_dir): $(target_boot_arch_dir) - ln -sfn $ $@ - -$(target_boot_arch_dir): - mkdir -p $@ - -compressed: zImage - -archmrproper: -archclean: - @if [ -d arch/$(ARCH)/boot ]; then \ - $(MAKE) $(clean)=arch/$(ARCH)/boot ; \ - fi - rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img - rm -rf $(LD_SCRIPT).tmp - -archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch +archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch FORCE # Create some links to make all tools happy $(SRC_ARCH)/.links: @rm -rf $(SRC_ARCH)/drivers - @ln -sfn $(SRC_ARCH)/$(SARCH)/drivers $(SRC_ARCH)/drivers + @ln -sfn $(SARCH)/drivers $(SRC_ARCH)/drivers @rm -rf $(SRC_ARCH)/boot - @ln -sfn $(SRC_ARCH)/$(SARCH)/boot $(SRC_ARCH)/boot +
[PATCH 24/47] Update CRISv10 boot Kbuild makefile.
- Remove old specific targets, use more generic ones instead. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v10/boot/Makefile | 24 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile index e5b1058..20c83a5 100644 --- a/arch/cris/arch-v10/boot/Makefile +++ b/arch/cris/arch-v10/boot/Makefile @@ -1,13 +1,21 @@ # -# arch/cris/boot/Makefile +# arch/cris/arch-v10/boot/Makefile # -target = $(target_boot_dir) -src= $(src_boot_dir) -zImage: compressed/vmlinuz +OBJCOPY = objcopy-cris +OBJCOPYFLAGS = -O binary --remove-section=.bss -compressed/vmlinuz: - @$(MAKE) -f $(src)/compressed/Makefile $(target_compressed_dir)/vmlinuz +subdir- := compressed rescue +targets := Image -clean: - @$(MAKE) -f $(src)/compressed/Makefile clean +$(obj)/Image: vmlinux FORCE + $(call if_changed,objcopy) + @echo ' Kernel: $@ is ready' + +$(obj)/compressed/vmlinux: $(obj)/Image FORCE + $(Q)$(MAKE) $(build)=$(obj)/compressed $@ + $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin + +$(obj)/zImage: $(obj)/compressed/vmlinux + @cp $ $@ + @echo ' Kernel: $@ is ready' -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 25/47] Update CRISv10 boot compressed Kbuild makefile.
- Remove old specific targets, use more generic ones instead. - Use if_changed to avoid creating new images when no change. - Use EXTRA_CFLAGS instead of CFLAGS. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v10/boot/compressed/Makefile | 48 ++ 1 files changed, 19 insertions(+), 29 deletions(-) diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile index 6584a44..17ba271 100644 --- a/arch/cris/arch-v10/boot/compressed/Makefile +++ b/arch/cris/arch-v10/boot/compressed/Makefile @@ -1,45 +1,35 @@ # -# create a compressed vmlinuz image from the binary vmlinux.bin file +# arch/cris/arch-v10/boot/compressed/Makefile # -target = $(target_compressed_dir) -src= $(src_compressed_dir) CC = gcc-cris -melf $(LINUXINCLUDE) -CFLAGS = -O2 +EXTRA_CFLAGS = -O2 LD = ld-cris +LDFLAGS = -T $(obj)/decompress.ld +OBJECTS = $(obj)/head.o $(obj)/misc.o OBJCOPY = objcopy-cris OBJCOPYFLAGS = -O binary --remove-section=.bss -OBJECTS = $(target)/head.o $(target)/misc.o -# files to compress -SYSTEM = $(objtree)/vmlinux.bin +quiet_cmd_image = BUILD $@ +cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz $@ -all: $(target_compressed_dir)/vmlinuz +targets := vmlinux piggy.gz decompress.o decompress.bin -$(target)/decompress.bin: $(OBJECTS) - $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS) - $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin +$(obj)/decompress.o: $(OBJECTS) FORCE + $(call if_changed,ld) -# Create vmlinuz image in top-level build directory -$(target_compressed_dir)/vmlinuz: $(target) piggy.img $(target)/decompress.bin - @echo COMPR vmlinux.bin -- vmlinuz - @cat $(target)/decompress.bin piggy.img $(target_compressed_dir)/vmlinuz - @rm -f piggy.img +$(obj)/decompress.bin: $(obj)/decompress.o FORCE + $(call if_changed,objcopy) -$(target)/head.o: $(src)/head.S - $(CC) -D__ASSEMBLY__ -traditional -c $ -o $@ +$(obj)/head.o: $(obj)/head.S .config + @$(CC) -D__ASSEMBLY__ -traditional -c $ -o $@ -$(target)/misc.o: $(src)/misc.c - $(CC) -D__KERNEL__ -c $ -o $@ +$(obj)/misc.o: $(obj)/misc.c .config + @$(CC) -D__KERNEL__ -c $ -o $@ -# gzip the kernel image +$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE + $(call if_changed,image) -piggy.img: $(SYSTEM) - @cat $(SYSTEM) | gzip -f -9 piggy.img - -$(target): - mkdir -p $(target) - -clean: - rm -f piggy.img $(objtree)/vmlinuz +$(obj)/piggy.gz: $(obj)/../Image FORCE + $(call if_changed,gzip) -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 26/47] Update CRISv10 rescue Kbuild makefile.
- Remove old specific targets, use more generic ones instead. - Use if_changed to avoid creating new images when no change. Removes a lot of cruft. - Use EXTRA_CFLAGS instead of CFLAGS. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v10/boot/rescue/Makefile | 56 ++ 1 files changed, 19 insertions(+), 37 deletions(-) diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile index 8be9b31..911c894 100644 --- a/arch/cris/arch-v10/boot/rescue/Makefile +++ b/arch/cris/arch-v10/boot/rescue/Makefile @@ -1,56 +1,38 @@ # -# Makefile for rescue code +# Makefile for rescue (bootstrap) code # -target = $(target_rescue_dir) -src= $(src_rescue_dir) CC = gcc-cris -mlinux $(LINUXINCLUDE) -CFLAGS = -O2 +EXTRA_CFLAGS = -O2 +AFLAGS = -traditional LD = gcc-cris -mlinux -nostdlib +LDFLAGS = -T $(obj)/rescue.ld OBJCOPY = objcopy-cris OBJCOPYFLAGS = -O binary --remove-section=.bss +obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o +OBJECT := $(obj)/head.o -all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin +targets := rescue.o rescue.bin -$(target)/rescue.bin: $(target) $(target)/head.o - $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o - $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin -# Place a copy in top-level build directory - cp -p $(target)/rescue.bin $(objtree) +$(obj)/rescue.o: $(OBJECT) FORCE + $(call if_changed,ld) -$(target)/testrescue.bin: $(target) $(target)/testrescue.o - $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin +$(obj)/rescue.bin: $(obj)/rescue.o FORCE + $(call if_changed,objcopy) + cp -p $(obj)/rescue.bin $(objtree) + +$(obj)/testrescue.bin: $(obj)/testrescue.o + $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin # Pad it to 784 bytes dd if=/dev/zero of=tmp2423 bs=1 count=784 cat tr.bin tmp2423 testrescue_tmp.bin - dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784 + dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784 rm tr.bin tmp2423 testrescue_tmp.bin -$(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o - $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin +$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o + $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin # Pad it to 784 bytes, that's what the rescue loader expects dd if=/dev/zero of=tmp2423 bs=1 count=784 cat ktr.bin tmp2423 kimagerescue_tmp.bin - dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784 + dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784 rm ktr.bin tmp2423 kimagerescue_tmp.bin - -$(target): - mkdir -p $(target) - -$(target)/head.o: $(src)/head.S - $(CC) -D__ASSEMBLY__ -traditional -c $ -o $*.o - -$(target)/testrescue.o: $(src)/testrescue.S - $(CC) -D__ASSEMBLY__ -traditional -c $ -o $*.o - -$(target)/kimagerescue.o: $(src)/kimagerescue.S - $(CC) -D__ASSEMBLY__ -traditional -c $ -o $*.o - -clean: - rm -f $(target)/*.o $(target)/*.bin - -fastdep: - -modules: - -modules-install: -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 27/47] Update CRISv10 rescue head.s
- Correct whitespace problems. - Add ifdef for ETRAX_AXISFLASHMAP to avoid compile error when not set. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v10/boot/rescue/head.S | 117 + 1 files changed, 61 insertions(+), 56 deletions(-) diff --git a/arch/cris/arch-v10/boot/rescue/head.S b/arch/cris/arch-v10/boot/rescue/head.S index f223cc0..cf644e2 100644 --- a/arch/cris/arch-v10/boot/rescue/head.S +++ b/arch/cris/arch-v10/boot/rescue/head.S @@ -1,5 +1,4 @@ -/* $Id: head.S,v 1.7 2005/03/07 12:11:06 starvik Exp $ - * +/* * Rescue code, made to reside at the beginning of the * flash-memory. when it starts, it checks a partition * table at the first sector after the rescue sector. @@ -23,20 +22,20 @@ * Partition table format: * * Code transparency: - * + * * 2 bytes[opcode 'nop'] * 2 bytes[opcode 'di'] * 4 bytes[opcode 'ba offset', 8-bit or 16-bit version] * 2 bytes[opcode 'nop', delay slot] * - * Table validation (at +10): - * + * Table validation (at +10): + * * 2 bytes[magic/version word for partitiontable - 0xef, 0xbe] * 2 bytes[length of all entries plus the end marker] * 4 bytes[checksum for the partitiontable itself] * - * Entries, each with the following format, last has offset -1: - * + * Entries, each with the following format, last has offset -1: + * *4 bytes[offset in bytes, from start of flash] *4 bytes[length in bytes of partition] *4 bytes[checksum, simple longword sum] @@ -47,9 +46,9 @@ * End marker * *4 bytes[-1] - * + * * 10 bytes[0, padding] - * + * * Bit 0 in flags signifies RW or RO. The rescue code only bothers * to check the checksum for RO partitions, since the others will * change their data without updating the checksums. A 1 in bit 0 @@ -59,16 +58,18 @@ * * During the wait for serial input, the status LED will flash so the * user knows something went wrong. - * - * Copyright (C) 1999, 2000, 2001, 2002, 2003 Axis Communications AB + * + * Copyright (C) 1999-2007 Axis Communications AB */ +#ifdef CONFIG_ETRAX_AXISFLASHMAP + #define ASSEMBLER_MACROS_ONLY #include asm/arch/sv_addr_ag.h ;; The partitiontable is looked for at the first sector after the boot ;; sector. Sector size is 65536 bytes in all flashes we use. - + #define PTABLE_START CONFIG_ETRAX_PTABLE_SECTOR #define PTABLE_MAGIC 0xbeef @@ -78,7 +79,7 @@ ;; having setup the DRAM etc). It is the same length as the on-chip ;; ROM loads, so the same host loader can be used to load a rescued ;; product as well as one booted through the Etrax serial boot code. - + #define CODE_START 0x4000 #define CODE_LENGTH 784 @@ -102,7 +103,7 @@ #define SERRECC R_SERIAL2_REC_CTRL #define SERRDAT R_SERIAL2_REC_DATA #define SERSTAT R_SERIAL2_STATUS -#endif +#endif #ifdef CONFIG_ETRAX_RESCUE_SER3 #define SERXOFF R_SERIAL3_XOFF #define SERBAUD R_SERIAL3_BAUD @@ -115,60 +116,61 @@ #define RAM_INIT_MAGIC 0x56902387 .text - + ;; This is the entry point of the rescue code ;; 0x8000 if loaded in flash (as it should be) - ;; since etrax actually starts at address 2 when booting from flash, we + ;; Since etrax actually starts at address 2 when booting from flash, we ;; put a nop (2 bytes) here first so we dont accidentally skip the di - nop + nop di jumpin_cache; enter cached area instead in_cache: - ;; first put a jump test to give a possibility of upgrading the rescue code - ;; without erasing/reflashing the sector. we put a longword of -1 here and if - ;; it is not -1, we jump using the value as jump target. since we can always - ;; change 1's to 0's without erasing the sector, it is possible to add new + ;; First put a jump test to give a possibility of upgrading the + ;; rescue code without erasing/reflashing the sector. + ;; We put a longword of -1 here and if it is not -1, we jump using + ;; the value as jump target. Since we can always change 1's to 0's + ;; without erasing the sector, it is possible to add new ;; code after this and altering the jumptarget in an upgrade. jtcd: move.d [jumptarget], $r0 cmp.d 0x, $r0 beq no_newjump nop - + jump[$r0] -jumptarget: +jumptarget: .dword 0x ; can be overwritten later to insert new code - + no_newjump: -#ifdef CONFIG_ETRAX_ETHERNET +#ifdef CONFIG_ETRAX_ETHERNET ;; Start MII clock to make sure it is running when tranceiver is reset move.d 0x3, $r0; enable = on, phy = mii_clk move.d $r0, [R_NETWORK_GEN_CONFIG] #endif - + ;; We
[PATCH 28/47] Update and improve CRISv10 axisflashmap.c
- Add config to use mtd0 as whole flash device. - Fix whitespace errors. - Remove braces around single statement ifs. - Break long lines. - Remove unnecessary CVS log. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v10/drivers/axisflashmap.c | 181 ++--- 1 files changed, 37 insertions(+), 144 deletions(-) diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c index ea3cf2e..b3bdda9 100644 --- a/arch/cris/arch-v10/drivers/axisflashmap.c +++ b/arch/cris/arch-v10/drivers/axisflashmap.c @@ -10,129 +10,6 @@ * tells us what other partitions to define. If there isn't, we use a default * partition split defined below. * - * $Log: axisflashmap.c,v $ - * Revision 1.11 2004/11/15 10:27:14 starvik - * Corrected typo (Thanks to Milton Miller [EMAIL PROTECTED]). - * - * Revision 1.10 2004/08/16 12:37:22 starvik - * Merge of Linux 2.6.8 - * - * Revision 1.8 2004/05/14 07:58:03 starvik - * Merge of changes from 2.4 - * - * Revision 1.6 2003/07/04 08:27:37 starvik - * Merge of Linux 2.5.74 - * - * Revision 1.5 2002/12/11 13:13:57 starvik - * Added arch/ to v10 specific includes - * Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer) - * - * Revision 1.4 2002/11/20 11:56:10 starvik - * Merge of Linux 2.5.48 - * - * Revision 1.3 2002/11/13 14:54:13 starvik - * Copied from linux 2.4 - * - * Revision 1.28 2002/10/01 08:08:43 jonashg - * The first partition ends at the start of the partition table. - * - * Revision 1.27 2002/08/21 09:23:13 jonashg - * Speling. - * - * Revision 1.26 2002/08/21 08:35:20 jonashg - * Cosmetic change to printouts. - * - * Revision 1.25 2002/08/21 08:15:42 jonashg - * Made it compile even without CONFIG_MTD_CONCAT defined. - * - * Revision 1.24 2002/08/20 13:12:35 jonashg - * * New approach to probing. Probe cse0 and cse1 separately and (mtd)concat - * the results. - * * Removed compile time tests concerning how the mtdram driver has been - * configured. The user will know about the misconfiguration at runtime - * instead. (The old approach made it impossible to use mtdram for anything - * else than RAM boot). - * - * Revision 1.23 2002/05/13 12:12:28 johana - * Allow compile without CONFIG_MTD_MTDRAM but warn at compiletime and - * be informative at runtime. - * - * Revision 1.22 2002/05/13 10:24:44 johana - * Added #if checks on MTDRAM CONFIG - * - * Revision 1.21 2002/05/06 16:05:20 johana - * Removed debug printout. - * - * Revision 1.20 2002/05/06 16:03:00 johana - * No more cramfs as root hack in generic code. - * It's handled by axisflashmap using mtdram. - * - * Revision 1.19 2002/03/15 17:10:28 bjornw - * Changed comment about cached access since we changed this before - * - * Revision 1.18 2002/03/05 17:06:15 jonashg - * Try amd_flash probe before cfi_probe since amd_flash driver can handle two - * (or more) flash chips of different model and the cfi driver cannot. - * - * Revision 1.17 2001/11/12 19:42:38 pkj - * Fixed compiler warnings. - * - * Revision 1.16 2001/11/08 11:18:58 jonashg - * Always read from uncached address to avoid problems with flushing - * cachelines after write and MTD-erase. No performance loss have been - * seen yet. - * - * Revision 1.15 2001/10/19 12:41:04 jonashg - * Name of probe has changed in MTD. - * - * Revision 1.14 2001/09/21 07:14:10 jonashg - * Made root filesystem (cramfs) use mtdblock driver when booting from flash. - * - * Revision 1.13 2001/08/15 13:57:35 jonashg - * Entire MTD updated to the linux 2.4.7 version. - * - * Revision 1.12 2001/06/11 09:50:30 jonashg - * Oops, 2MB is 0x20 bytes. - * - * Revision 1.11 2001/06/08 11:39:44 jonashg - * Changed sizes and offsets in axis_default_partitions to use - * CONFIG_ETRAX_PTABLE_SECTOR. - * - * Revision 1.10 2001/05/29 09:42:03 jonashg - * Use macro for end marker length instead of sizeof. - * - * Revision 1.9 2001/05/29 08:52:52 jonashg - * Gave names to the magic fours (size of the ptable end marker). - * - * Revision 1.8 2001/05/28 15:36:20 jonashg - * * Removed old comment about ptable location in flash (it's a CONFIG_ option). - * * Variable ptable was initialized twice to the same value. - * - * Revision 1.7 2001/04/05 13:41:46 markusl - * Updated according to review remarks - * - * Revision 1.6 2001/03/07 09:21:21 bjornw - * No need to waste .data - * - * Revision 1.5 2001/03/06 16:27:01 jonashg - * Probe the entire flash area for flash devices. - * - * Revision 1.4 2001/02/23 12:47:15 bjornw - * Uncached flash in LOW_MAP moved from 0xe to 0x8 - * - * Revision 1.3 2001/02/16 12:11:45 jonashg - * MTD driver amd_flash is now included in MTD CVS repository. - * (It's now in drivers/mtd). - * - * Revision 1.2 2001/02/09 11:12:22 jonashg - * Support for AMD compatible non-CFI flash chips. - * Only tested with Toshiba TC58FVT160 so far. - * - * Revision 1.1 2001/01/12 17:01:18 bjornw - * * Added axisflashmap.c, a
[PATCH 29/47] Update CRISv32 traps.c
- Remove raw_prink hack, use oops_in_progress instead. - When ETRAX_WATCHDOG_NICE_DOGGY is set, loop in trap after oops dump instead of rebooting. - Break long lines to less than 80 chars. - Fix whitespace errors. - Remove unnecessary comments. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v10/kernel/traps.c | 198 ++--- 1 files changed, 95 insertions(+), 103 deletions(-) diff --git a/arch/cris/arch-v10/kernel/traps.c b/arch/cris/arch-v10/kernel/traps.c index 4becc1b..9eada5d 100644 --- a/arch/cris/arch-v10/kernel/traps.c +++ b/arch/cris/arch-v10/kernel/traps.c @@ -1,13 +1,10 @@ -/* $Id: traps.c,v 1.4 2005/04/24 18:47:55 starvik Exp $ +/* + * Helper functions for trap handlers * - * linux/arch/cris/arch-v10/traps.c + * Copyright (C) 2000-2007, Axis Communications AB. * - * Heler functions for trap handlers - * - * Copyright (C) 2000-2002 Axis Communications AB - * - * Authors: Bjorn Wesen - *Hans-Peter Nilsson + * Authors: Bjorn Wesen + *Hans-Peter Nilsson * */ @@ -15,124 +12,119 @@ #include asm/uaccess.h #include asm/arch/sv_addr_ag.h -extern int raw_printk(const char *fmt, ...); - -void -show_registers(struct pt_regs * regs) +void +show_registers(struct pt_regs *regs) { - /* We either use rdusp() - the USP register, which might not - correspond to the current process for all cases we're called, - or we use the current-thread.usp, which is not up to date for - the current process. Experience shows we want the USP - register. */ + /* +* It's possible to use either the USP register or current-thread.usp. +* USP might not correspond to the current process for all cases this +* function is called, and current-thread.usp isn't up to date for the +* current process. Experience shows that using USP is the way to go. +*/ unsigned long usp = rdusp(); - raw_printk(IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n, - regs-irp, regs-srp, regs-dccr, usp, regs-mof ); - raw_printk( r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n, + printk(IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n, + regs-irp, regs-srp, regs-dccr, usp, regs-mof); + + printk( r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n, regs-r0, regs-r1, regs-r2, regs-r3); - raw_printk( r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n, + + printk( r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n, regs-r4, regs-r5, regs-r6, regs-r7); - raw_printk( r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n, + + printk( r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n, regs-r8, regs-r9, regs-r10, regs-r11); - raw_printk(r12: %08lx r13: %08lx oR10: %08lx sp: %08lx\n, - regs-r12, regs-r13, regs-orig_r10, regs); - raw_printk(R_MMU_CAUSE: %08lx\n, (unsigned long)*R_MMU_CAUSE); - raw_printk(Process %s (pid: %d, stackpage=%08lx)\n, + + printk(r12: %08lx r13: %08lx oR10: %08lx sp: %08lx\n, + regs-r12, regs-r13, regs-orig_r10, (long unsigned)regs); + + printk(R_MMU_CAUSE: %08lx\n, (unsigned long)*R_MMU_CAUSE); + + printk(Process %s (pid: %d, stackpage=%08lx)\n, current-comm, current-pid, (unsigned long)current); /* - * When in-kernel, we also print out the stack and code at the - * time of the fault.. - */ -if (! user_mode(regs)) { - int i; +* When in-kernel, we also print out the stack and code at the +* time of the fault.. +*/ + if (!user_mode(regs)) { + int i; -show_stack(NULL, (unsigned long*)usp); + show_stack(NULL, (unsigned long *)usp); - /* Dump kernel stack if the previous dump wasn't one. */ + /* +* If the previous stack-dump wasn't a kernel one, dump the +* kernel stack now. +*/ if (usp != 0) - show_stack (NULL, NULL); - -raw_printk(\nCode: ); -if(regs-irp PAGE_OFFSET) -goto bad; - - /* Often enough the value at regs-irp does not point to - the interesting instruction, which is most often the - _previous_ instruction. So we dump at an offset large - enough that instruction decoding should be in sync at - the interesting point, but small enough to fit on a row - (sort of). We point out the regs-irp location in a - ksymoops-friendly way by wrapping the byte for that - address in parentheses. */ -for(i = -12; i 12; i++) -{ -unsigned char c; -if(__get_user(c,
[PATCH 36/47] Update CRISv32 boot/rescue/head.S code.
- Add ifdef for ETRAX_AXISFLASHMAP to avoid compiling file unless it is set. - Use assembler macros for setting up clocks. - Don't copy image, just jump to it (only works for NOR flash) Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/boot/rescue/head.S | 42 +++- 1 files changed, 15 insertions(+), 27 deletions(-) diff --git a/arch/cris/arch-v32/boot/rescue/head.S b/arch/cris/arch-v32/boot/rescue/head.S index 8cdb401..5f846b7 100644 --- a/arch/cris/arch-v32/boot/rescue/head.S +++ b/arch/cris/arch-v32/boot/rescue/head.S @@ -1,38 +1,26 @@ -/* $Id: head.S,v 1.4 2004/11/01 16:10:28 starvik Exp $ +/* + * Just get started by jumping to CONFIG_ETRAX_PTABLE_SECTOR to start + * kernel decompressor. + * + * In practice, this only works for NOR flash (or some convoluted RAM boot) + * and hence is not really useful for Artpec-3, so it's Etrax FS / NOR only. * - * This used to be the rescue code but now that is handled by the - * RedBoot based RFL instead. Nothing to see here, move along. */ -#include asm/arch/hwregs/reg_map_asm.h -#include asm/arch/hwregs/config_defs_asm.h +#include mach/startup.inc - .text +#ifdef CONFIG_ETRAX_AXISFLASHMAP - ;; Start clocks for used blocks. - move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1 - move.d [$r1], $r0 - or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \ - REG_STATE(config, rw_clk_ctrl, bif, yes) | \ - REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0 - move.d $r0, [$r1] +;; Code - ;; Copy 68KB NAND flash to Internal RAM (if NAND boot) - move.d 0x38004000, $r10 - move.d 0x8000, $r11 - move.d 0x11000, $r12 - move.d copy_complete, $r13 - and.d 0x000f, $r13 - or.d 0x3800, $r13 + .text +start: -#include ../../lib/nand_init.S + ;; Start clocks for used blocks. + START_CLOCKS - ;; No NAND found move.d CONFIG_ETRAX_PTABLE_SECTOR, $r10 - jump$r10 ; Jump to decompresser + jump$r10; Jump to decompressor nop -copy_complete: - move.d 0x3800 + CONFIG_ETRAX_PTABLE_SECTOR, $r10 - jump$r10 ; Jump to decompresser - nop +#endif -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 37/47] Update CRISv32 debugport.
- Shorten include paths to machine dependent headers. - Add support for fifth serial port. - Remove CONFIG_ETRAXFS_SIM and CONFIG_ETRAX_DEBUG_PORT_NULL, no longer used. - Remove raw_printk and stupid_debug hack, no longer needed. - Remove dummy console stuff, no longer needed. - Correct some register type names. - Correct some whitespace errors and formatting. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/kernel/debugport.c | 342 1 files changed, 43 insertions(+), 299 deletions(-) diff --git a/arch/cris/arch-v32/kernel/debugport.c b/arch/cris/arch-v32/kernel/debugport.c index d1272ad..15af4c2 100644 --- a/arch/cris/arch-v32/kernel/debugport.c +++ b/arch/cris/arch-v32/kernel/debugport.c @@ -4,17 +4,12 @@ #include linux/console.h #include linux/init.h -#include linux/major.h -#include linux/delay.h -#include linux/tty.h #include asm/system.h -#include asm/io.h -#include asm/arch/hwregs/ser_defs.h -#include asm/arch/hwregs/dma_defs.h -#include asm/arch/pinmux.h - -#include asm/irq.h -#include asm/arch/hwregs/intr_vect_defs.h +#include hwregs/reg_rdwr.h +#include hwregs/reg_map.h +#include hwregs/ser_defs.h +#include hwregs/dma_defs.h +#include asm/arch/mach/pinmux.h struct dbg_port { @@ -59,45 +54,50 @@ struct dbg_port ports[] = 115200, 'N', 8 - } + }, +#if CONFIG_ETRAX_SERIAL_PORTS == 5 + { +4, +regi_ser4, +0, +115200, +'N', +8 + }, +#endif }; static struct dbg_port *port = #if defined(CONFIG_ETRAX_DEBUG_PORT0) -ports[0]; + ports[0]; #elif defined(CONFIG_ETRAX_DEBUG_PORT1) -ports[1]; + ports[1]; #elif defined(CONFIG_ETRAX_DEBUG_PORT2) -ports[2]; + ports[2]; #elif defined(CONFIG_ETRAX_DEBUG_PORT3) -ports[3]; + ports[3]; +#elif defined(CONFIG_ETRAX_DEBUG_PORT4) + ports[4]; #else -NULL; + NULL; #endif #ifdef CONFIG_ETRAX_KGDB static struct dbg_port *kgdb_port = #if defined(CONFIG_ETRAX_KGDB_PORT0) -ports[0]; + ports[0]; #elif defined(CONFIG_ETRAX_KGDB_PORT1) -ports[1]; + ports[1]; #elif defined(CONFIG_ETRAX_KGDB_PORT2) -ports[2]; + ports[2]; #elif defined(CONFIG_ETRAX_KGDB_PORT3) -ports[3]; + ports[3]; +#elif defined(CONFIG_ETRAX_KGDB_PORT4) + ports[4]; #else -NULL; + NULL; #endif #endif -#ifdef CONFIG_ETRAXFS_SIM -extern void print_str( const char *str ); -static char buffer[1024]; -static char msg[] = Debug: ; -static int buffer_pos = sizeof(msg) - 1; -#endif - -extern struct tty_driver *serial_driver; - static void start_port(struct dbg_port* p) { @@ -114,6 +114,10 @@ start_port(struct dbg_port* p) crisv32_pinmux_alloc_fixed(pinmux_ser2); else if (p-nbr == 3) crisv32_pinmux_alloc_fixed(pinmux_ser3); +#if CONFIG_ETRAX_SERIAL_PORTS == 5 + else if (p-nbr == 4) + crisv32_pinmux_alloc_fixed(pinmux_ser4); +#endif /* Set up serial port registers */ reg_ser_rw_tr_ctrl tr_ctrl = {0}; @@ -156,124 +160,21 @@ start_port(struct dbg_port* p) REG_WR (ser, p-instance, rw_rec_ctrl, rec_ctrl); } -/* No debug */ -#ifdef CONFIG_ETRAX_DEBUG_PORT_NULL - -static void -console_write(struct console *co, const char *buf, unsigned int len) -{ - return; -} - -/* Target debug */ -#elif !defined(CONFIG_ETRAXFS_SIM) - -static void -console_write_direct(struct console *co, const char *buf, unsigned int len) -{ - int i; - reg_ser_r_stat_din stat; - reg_ser_rw_tr_dma_en tr_dma_en, old; - - /* Switch to manual mode */ - tr_dma_en = old = REG_RD (ser, port-instance, rw_tr_dma_en); - if (tr_dma_en.en == regk_ser_yes) { - tr_dma_en.en = regk_ser_no; - REG_WR(ser, port-instance, rw_tr_dma_en, tr_dma_en); - } - - /* Send data */ - for (i = 0; i len; i++) { - /* LF - CRLF */ - if (buf[i] == '\n') { - do { - stat = REG_RD (ser, port-instance, r_stat_din); - } while (!stat.tr_rdy); - REG_WR_INT (ser, port-instance, rw_dout, '\r'); - } - /* Wait until transmitter is ready and send.*/ - do { - stat = REG_RD (ser, port-instance, r_stat_din); - } while (!stat.tr_rdy); - REG_WR_INT (ser, port-instance, rw_dout, buf[i]); - } - - /* Restore mode */ - if (tr_dma_en.en != old.en) - REG_WR(ser, port-instance, rw_tr_dma_en, old); -} - -static void -console_write(struct console *co, const char *buf, unsigned int len) -{ - if (!port) - return; -console_write_direct(co, buf, len); -} - - - -#else - -/* VCS debug */ - -static void -console_write(struct console *co, const char *buf, unsigned int len) -{ - char* pos; - pos = memchr(buf, '\n', len); - if (pos) { - int l = ++pos -
[PATCH 39/47] Update and improve CRISv32 fasttimer.c
- Change include path to machine dependent header files. - Remove __INLINE__, it expands to inline anyway. - Don't initialize static variables. - Change timers to use fasttimer_t instead of timevals. - Change name of timeval_cmp to fasttime_cmp to highlight this. - Register name for first timer is regi_timer0, not regi_timer. - Whitespace and formatting changes. - Don't return if we're blocking interrupts, goto done and restore interrupts. - Disable interrupts while walking the fasttimer list, only restore while doing the callback. - Remove #ifdef DECLARE_WAITQUEUE, this code won't be used in another OS. - Remove CVS log. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/kernel/fasttimer.c | 519 1 files changed, 195 insertions(+), 324 deletions(-) diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c index b40551f..3051462 100644 --- a/arch/cris/arch-v32/kernel/fasttimer.c +++ b/arch/cris/arch-v32/kernel/fasttimer.c @@ -1,110 +1,9 @@ -/* $Id: fasttimer.c,v 1.11 2005/01/04 11:15:46 starvik Exp $ +/* * linux/arch/cris/kernel/fasttimer.c * * Fast timers for ETRAX FS - * This may be useful in other OS than Linux so use 2 space indentation... - * - * $Log: fasttimer.c,v $ - * Revision 1.11 2005/01/04 11:15:46 starvik - * Don't share timer IRQ. - * - * Revision 1.10 2004/12/07 09:19:38 starvik - * Corrected includes. - * Use correct interrupt macros. - * - * Revision 1.9 2004/05/14 10:18:58 starvik - * Export fast_timer_list - * - * Revision 1.8 2004/05/14 07:58:03 starvik - * Merge of changes from 2.4 - * - * Revision 1.7 2003/07/10 12:06:14 starvik - * Return IRQ_NONE if irq wasn't handled - * - * Revision 1.6 2003/07/04 08:27:49 starvik - * Merge of Linux 2.5.74 - * - * Revision 1.5 2003/06/05 10:16:22 johana - * New INTR_VECT macros. - * - * Revision 1.4 2003/06/03 08:49:45 johana - * Fixed typo. - * - * Revision 1.3 2003/06/02 12:51:27 johana - * Now compiles. - * Commented some include files that probably can be removed. - * - * Revision 1.2 2003/06/02 12:09:41 johana - * Ported to ETRAX FS using the trig interrupt instead of timer1. - * - * Revision 1.3 2002/12/12 08:26:32 starvik - * Don't use C-comments inside CVS comments - * - * Revision 1.2 2002/12/11 15:42:02 starvik - * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/ - * - * Revision 1.1 2002/11/18 07:58:06 starvik - * Fast timers (from Linux 2.4) * - * Revision 1.5 2002/10/15 06:21:39 starvik - * Added call to init_waitqueue_head - * - * Revision 1.4 2002/05/28 17:47:59 johana - * Added del_fast_timer() - * - * Revision 1.3 2002/05/28 16:16:07 johana - * Handle empty fast_timer_list - * - * Revision 1.2 2002/05/27 15:38:42 johana - * Made it compile without warnings on Linux 2.4. - * (includes, wait_queue, PROC_FS and snprintf) - * - * Revision 1.1 2002/05/27 15:32:25 johana - * arch/etrax100/kernel/fasttimer.c v1.8 from the elinux tree. - * - * Revision 1.8 2001/11/27 13:50:40 pkj - * Disable interrupts while stopping the timer and while modifying the - * list of active timers in timer1_handler() as it may be interrupted - * by other interrupts (e.g., the serial interrupt) which may add fast - * timers. - * - * Revision 1.7 2001/11/22 11:50:32 pkj - * * Only store information about the last 16 timers. - * * proc_fasttimer_read() now uses an allocated buffer, since it - * requires more space than just a page even for only writing the - * last 16 timers. The buffer is only allocated on request, so - * unless /proc/fasttimer is read, it is never allocated. - * * Renamed fast_timer_started to fast_timers_started to match - * fast_timers_added and fast_timers_expired. - * * Some clean-up. - * - * Revision 1.6 2000/12/13 14:02:08 johana - * Removed volatile for fast_timer_list - * - * Revision 1.5 2000/12/13 13:55:35 johana - * Added DEBUG_LOG, added som cli() and cleanup - * - * Revision 1.4 2000/12/05 13:48:50 johana - * Added range check when writing proc file, modified timer int handling - * - * Revision 1.3 2000/11/23 10:10:20 johana - * More debug/logging possibilities. - * Moved GET_JIFFIES_USEC() to timex.h and time.c - * - * Revision 1.2 2000/11/01 13:41:04 johana - * Clean up and bugfixes. - * Created new do_gettimeofday_fast() that gets a timeval struct - * with time based on jiffies and *R_TIMER0_DATA, uses a table - * for fast conversion of timer value to microseconds. - * (Much faster the standard do_gettimeofday() and we don't really - * want to use the true time - we want the uptime so timers don't screw up - * when we change the time. - * TODO: Add efficient support for continuous timers as well. - * - * Revision 1.1 2000/10/26 15:49:16 johana - * Added fasttimer, highresolution timers. - * - * Copyright (C) 2000,2001 2002, 2003 Axis Communications AB, Lund, Sweden + * Copyright (C) 2000-2006 Axis Communications AB, Lund, Sweden */ #include
[PATCH 30/47] Update CRISv32 boot Kbuild makefile.
- Remove old specific targets, use more generic ones instead. - Use if_changed to avoid creating new images when no change. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/boot/Makefile | 23 +++ 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/cris/arch-v32/boot/Makefile b/arch/cris/arch-v32/boot/Makefile index 26f293a..3f91349 100644 --- a/arch/cris/arch-v32/boot/Makefile +++ b/arch/cris/arch-v32/boot/Makefile @@ -1,14 +1,21 @@ # # arch/cris/arch-v32/boot/Makefile # -target = $(target_boot_dir) -src= $(src_boot_dir) -zImage: compressed/vmlinuz +OBJCOPY = objcopy-cris +OBJCOPYFLAGS = -O binary -R .note -R .comment -compressed/vmlinuz: $(objtree)/vmlinux - @$(MAKE) -f $(src)/compressed/Makefile $(objtree)/vmlinuz +subdir- := compressed rescue +targets := Image -clean: - rm -f zImage tools/build compressed/vmlinux.out - @$(MAKE) -f $(src)/compressed/Makefile clean +$(obj)/Image: vmlinux FORCE + $(call if_changed,objcopy) + @echo ' Kernel: $@ is ready' + +$(obj)/compressed/vmlinux: $(obj)/Image FORCE + $(Q)$(MAKE) $(build)=$(obj)/compressed $@ + $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin + +$(obj)/zImage: $(obj)/compressed/vmlinux + @cp $ $@ + @echo ' Kernel: $@ is ready' -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 31/47] Update CRISv32 boot compressed Kbuild makefile.
- Remove old specific targets, use more generic ones instead. - Use if_changed to avoid creating new images when no change. - Use KBUILD_CFLAGS instead of CFLAGS. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/boot/compressed/Makefile | 47 ++ 1 files changed, 18 insertions(+), 29 deletions(-) diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile index 9f77eda..b9e6b23 100644 --- a/arch/cris/arch-v32/boot/compressed/Makefile +++ b/arch/cris/arch-v32/boot/compressed/Makefile @@ -1,41 +1,30 @@ # -# lx25/arch/cris/arch-v32/boot/compressed/Makefile +# arch/cris/arch-v32/boot/compressed/Makefile # -# create a compressed vmlinux image from the original vmlinux files and romfs -# - -target = $(target_compressed_dir) -src= $(src_compressed_dir) -CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include -CFLAGS = -O2 +CC = gcc-cris -mlinux -march=v32 -I $(srctree)/include +AFLAGS += -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch +KBUILD_CFLAGS += -O2 -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch LD = gcc-cris -mlinux -march=v32 -nostdlib +LDFLAGS = -T $(obj)/decompress.ld +obj-y = head.o misc.o +OBJECTS = $(obj)/head.o $(obj)/misc.o OBJCOPY = objcopy-cris OBJCOPYFLAGS = -O binary --remove-section=.bss -OBJECTS = $(target)/head.o $(target)/misc.o - -# files to compress -SYSTEM = $(objtree)/vmlinux.bin - -all: vmlinuz - -$(target)/decompress.bin: $(OBJECTS) - $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS) - $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin -$(objtree)/vmlinuz: $(target) piggy.img $(target)/decompress.bin - cat $(target)/decompress.bin piggy.img $(objtree)/vmlinuz - rm -f piggy.img - cp $(objtree)/vmlinuz $(src) +quiet_cmd_image = BUILD $@ +cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz $@ -$(target)/head.o: $(src)/head.S - $(CC) -D__ASSEMBLY__ -c $ -o $@ +targets := vmlinux piggy.gz decompress.o decompress.bin -# gzip the kernel image +$(obj)/decompress.o: $(OBJECTS) FORCE + $(call if_changed,ld) -piggy.img: $(SYSTEM) - cat $(SYSTEM) | gzip -f -9 piggy.img +$(obj)/decompress.bin: $(obj)/decompress.o FORCE + $(call if_changed,objcopy) -clean: - rm -f piggy.img $(objtree)/vmlinuz vmlinuz.o decompress.o decompress.bin $(OBJECTS) +$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE + $(call if_changed,image) +$(obj)/piggy.gz: $(obj)/../Image FORCE + $(call if_changed,gzip) -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 34/47] Update CRISv32 compressed head.S
- Fixes for NAND and NOR flash booting. - Use assembler macros for common tasks (clocks, general io etc) - Use (EtraxFS or Artpec-3) machine specific include for dram and hardware init. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/boot/compressed/head.S | 137 1 files changed, 39 insertions(+), 98 deletions(-) diff --git a/arch/cris/arch-v32/boot/compressed/head.S b/arch/cris/arch-v32/boot/compressed/head.S index 34cea10..f86208c 100644 --- a/arch/cris/arch-v32/boot/compressed/head.S +++ b/arch/cris/arch-v32/boot/compressed/head.S @@ -2,13 +2,12 @@ * Code that sets up the DRAM registers, calls the * decompressor to unpack the piggybacked kernel, and jumps. * - * Copyright (C) 1999 - 2003, Axis Communications AB + * Copyright (C) 1999 - 2006, Axis Communications AB */ #define ASSEMBLER_MACROS_ONLY -#include asm/arch/hwregs/asm/reg_map_asm.h -#include asm/arch/hwregs/asm/gio_defs_asm.h -#include asm/arch/hwregs/asm/config_defs_asm.h +#include hwregs/asm/reg_map_asm.h +#include asm/arch/mach/startup.inc #define RAM_INIT_MAGIC 0x56902387 #define COMMAND_LINE_MAGIC 0x87109563 @@ -22,114 +21,49 @@ start: di ;; Start clocks for used blocks. - move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1 - move.d [$r1], $r0 - or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \ - REG_STATE(config, rw_clk_ctrl, bif, yes) | \ - REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0 - move.d $r0, [$r1] - - ;; If booting from NAND flash we first have to copy some - ;; data from NAND flash to internal RAM to get the code - ;; that initializes the SDRAM. Lets copy 20 KB. This - ;; code executes at 0x3801 if booting from NAND and - ;; we are guaranted that at least 0x200 bytes are good so - ;; lets start from there. The first 8192 bytes in the nand - ;; flash is spliced with zeroes and is thus 16384 bytes. - move.d 0x38010200, $r10 - move.d 0x14200, $r11; Start offset in NAND flash 0x10200 + 16384 - move.d 0x5000, $r12 ; Length of copy - - ;; Before this code the tools add a partitiontable so the PC - ;; has an offset from the linked address. -offset1: - lapcq ., $r13 ; get PC - add.d first_copy_complete-offset1, $r13 - -#include ../../lib/nand_init.S - -first_copy_complete: - ;; Initialze the DRAM registers. + START_CLOCKS + + ;; Initialize the DRAM registers. cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized? beq dram_init_finished nop -#include ../../lib/dram_init.S +#include ../../mach/dram_init.S dram_init_finished: - lapcq ., $r13 ; get PC - add.d second_copy_complete-dram_init_finished, $r13 - - move.d REG_ADDR(config, regi_config, r_bootsel), $r0 - move.d [$r0], $r0 - and.d REG_MASK(config, r_bootsel, boot_mode), $r0 - cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0 - bne second_copy_complete ; No NAND boot - nop - - ;; Copy 2MB from NAND flash to SDRAM (at 2-4MB into the SDRAM) - move.d 0x40204000, $r10 - move.d 0x8000, $r11 - move.d 0x20, $r12 - ba copy_nand_to_ram - nop -second_copy_complete: - - ;; Initiate the PA port. - move.d CONFIG_ETRAX_DEF_GIO_PA_OUT, $r0 - move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r1 - move.d $r0, [$r1] - - move.d CONFIG_ETRAX_DEF_GIO_PA_OE, $r0 - move.d REG_ADDR(gio, regi_gio, rw_pa_oe), $r1 - move.d $r0, [$r1] + GIO_INIT ;; Setup the stack to a suitably high address. ;; We assume 8 MB is the minimum DRAM and put ;; the SP at the top for now. move.d 0x4080, $sp - ;; Figure out where the compressed piggyback image is - ;; in the flash (since we wont try to copy it to DRAM - ;; before unpacking). It is at _edata, but in flash. + ;; Figure out where the compressed piggyback image is. + ;; It is either in [NOR] flash (we don't want to copy it + ;; to DRAM before unpacking), or copied to DRAM + ;; by the [NAND] flash boot loader. + ;; The piggyback image is at _edata, but relative to where the + ;; image is actually located in memory, not where it is linked + ;; (the decompressor is linked at 0x4070+ and runs there). ;; Use (_edata - herami) as offset to the current PC. - move.d REG_ADDR(config, regi_config, r_bootsel), $r0 - move.d [$r0], $r0 - and.d REG_MASK(config, r_bootsel, boot_mode), $r0 - cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0 - beq hereami2 - nop hereami: lapcq ., $r5 ; get PC and.d 0x7fff, $r5 ; strip any non-cache bit - move.d $r5, $r0; save for later - flash address of 'herami' + move.d $r5, $r0
[PATCH 33/47] Remove CRISv32 common gpio and nandflash, add mach-fs and mach-a3 as subdirs.
Also add board_mmcspi to build if ETRAX_SPI_MMC_BOARD is set. (Generic MMC SPI implementation) Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/drivers/Makefile |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/cris/arch-v32/drivers/Makefile b/arch/cris/arch-v32/drivers/Makefile index a359cd2..e8c0243 100644 --- a/arch/cris/arch-v32/drivers/Makefile +++ b/arch/cris/arch-v32/drivers/Makefile @@ -4,10 +4,11 @@ obj-$(CONFIG_ETRAX_STREAMCOPROC)+= cryptocop.o obj-$(CONFIG_ETRAX_AXISFLASHMAP)+= axisflashmap.o -obj-$(CONFIG_ETRAX_NANDFLASH) += nandflash.o -obj-$(CONFIG_ETRAX_GPIO) += gpio.o +obj-$(CONFIG_ETRAXFS) += mach-fs/ +obj-$(CONFIG_CRIS_MACH_ARTPEC3) += mach-a3/ obj-$(CONFIG_ETRAX_IOP_FW_LOAD) += iop_fw_load.o obj-$(CONFIG_ETRAX_PCF8563)+= pcf8563.o obj-$(CONFIG_ETRAX_I2C)+= i2c.o obj-$(CONFIG_ETRAX_SYNCHRONOUS_SERIAL) += sync_serial.o obj-$(CONFIG_PCI) += pci/ +obj-$(CONFIG_ETRAX_SPI_MMC_BOARD) += board_mmcspi.o -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 32/47] Update CRISv32 boot rescue Kbuild makefile.
- Remove old specific targets, use more generic ones instead. - Use if_changed to avoid creating new images when no change. - Use EXTRA_CFLAGS instead of CFLAGS. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/boot/rescue/Makefile | 41 --- 1 files changed, 16 insertions(+), 25 deletions(-) diff --git a/arch/cris/arch-v32/boot/rescue/Makefile b/arch/cris/arch-v32/boot/rescue/Makefile index f668a81..43260e7 100644 --- a/arch/cris/arch-v32/boot/rescue/Makefile +++ b/arch/cris/arch-v32/boot/rescue/Makefile @@ -1,36 +1,27 @@ # -# Makefile for rescue code +# Makefile for rescue (bootstrap) code # -target = $(target_rescue_dir) -src= $(src_rescue_dir) CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE) -CFLAGS = -O2 +EXTRA_CFLAGS = -O2 +AFLAGS += -I $(TOPDIR)/include/asm/arch/mach/ -I $(TOPDIR)/include/asm/arch +EXTRA_CFLAGS += -I $(TOPDIR)/include/asm/arch/mach/ -I $(TOPDIR)/include/asm/arch LD = gcc-cris -mlinux -march=v32 -nostdlib +LDFLAGS = -T $(obj)/rescue.ld +LDPOSTFLAGS = -lgcc OBJCOPY = objcopy-cris OBJCOPYFLAGS = -O binary --remove-section=.bss +obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o +OBJECT := $(obj)/head.o -all: $(target)/rescue.bin +targets := rescue.o rescue.bin -rescue: rescue.bin - # do nothing +quiet_cmd_ldlibgcc = LD $@ +cmd_ldlibgcc = $(LD) $(LDFLAGS) $(filter-out FORCE,$^) $(LDPOSTFLAGS) -o $@ -$(target)/rescue.bin: $(target) $(target)/head.o - $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o - $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin - cp -p $(target)/rescue.bin $(objtree) +$(obj)/rescue.o: $(OBJECTS) FORCE + $(call if_changed,ldlibgcc) -$(target): - mkdir -p $(target) - -$(target)/head.o: $(src)/head.S - $(CC) -D__ASSEMBLY__ -c $ -o $*.o - -clean: - rm -f $(target)/*.o $(target)/*.bin - -fastdep: - -modules: - -modules-install: +$(obj)/rescue.bin: $(obj)/rescue.o FORCE + $(call if_changed,objcopy) + cp -p $(obj)/rescue.bin $(objtree) -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 38/47] Include path fix for CRISv32 timex.h
- Shorten include path for machine dependent header files. - Correct some formatting issues. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- include/asm-cris/arch-v32/timex.h |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/asm-cris/arch-v32/timex.h b/include/asm-cris/arch-v32/timex.h index 5a4aa28..2591d3c 100644 --- a/include/asm-cris/arch-v32/timex.h +++ b/include/asm-cris/arch-v32/timex.h @@ -1,9 +1,9 @@ #ifndef _ASM_CRIS_ARCH_TIMEX_H #define _ASM_CRIS_ARCH_TIMEX_H -#include asm/arch/hwregs/reg_map.h -#include asm/arch/hwregs/reg_rdwr.h -#include asm/arch/hwregs/timer_defs.h +#include hwregs/reg_map.h +#include hwregs/reg_rdwr.h +#include hwregs/timer_defs.h /* * The clock runs at 100MHz, we divide it by 100. If you change anything @@ -18,7 +18,7 @@ /* Convert the value in step of 10 ns to 1us without overflow: */ #define GET_JIFFIES_USEC() \ - ( (TIMER0_DIV - REG_RD(timer, regi_timer, r_tmr0_data)) /100 ) + ((TIMER0_DIV - REG_RD(timer, regi_timer0, r_tmr0_data)) / 100) extern unsigned long get_ns_in_jiffie(void); -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 35/47] Update CRISv32 boot/compressed/misc.c
- Shorten include paths to machine specific headers. - Remove fill_inbuf, not defined here. - Return __dest as value from memcpy. - Enable serial port hardware transmitter and receiver in serial_setup. - Correct baudrate divisor calculation, changed from 4800 to 115200. - Add support for Artpec-3 specific serial port setup. - Initialize pinmux for the correct serial port. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/boot/compressed/misc.c | 72 + 1 files changed, 53 insertions(+), 19 deletions(-) diff --git a/arch/cris/arch-v32/boot/compressed/misc.c b/arch/cris/arch-v32/boot/compressed/misc.c index 0169ba1..55b2695 100644 --- a/arch/cris/arch-v32/boot/compressed/misc.c +++ b/arch/cris/arch-v32/boot/compressed/misc.c @@ -1,8 +1,6 @@ /* * misc.c * - * $Id: misc.c,v 1.8 2005/04/24 18:34:29 starvik Exp $ - * * This is a collection of several routines from gzip-1.0.3 * adapted for Linux. * @@ -22,9 +20,13 @@ #include linux/types.h -#include asm/arch/hwregs/reg_rdwr.h -#include asm/arch/hwregs/reg_map.h -#include asm/arch/hwregs/ser_defs.h +#include hwregs/reg_rdwr.h +#include hwregs/reg_map.h +#include hwregs/ser_defs.h +#include hwregs/pinmux_defs.h +#ifdef CONFIG_CRIS_MACH_ARTPEC3 +#include hwregs/clkgen_defs.h +#endif /* * gzip declarations @@ -85,7 +87,6 @@ static unsigned outcnt = 0; /* bytes in output buffer */ # define Tracecv(c,x) #endif -static int fill_inbuf(void); static void flush_window(void); static void error(char *m); static void gzip_mark(void **); @@ -186,6 +187,8 @@ memset(void* s, int c, size_t n) char *ss = (char*)s; for (i=0;in;i++) ss[i] = c; + + return s; } void* @@ -196,6 +199,8 @@ memcpy(void* __dest, __const void* __src, char *d = (char *)__dest, *s = (char *)__src; for (i=0;i__n;i++) d[i] = s[i]; + + return __dest; } /* === @@ -225,15 +230,15 @@ flush_window() static void error(char *x) { - puts(\n\n); + puts(\r\n\n); puts(x); - puts(\n\n -- System halted\n); + puts(\r\n\n -- System halted\n); while(1); /* Halt */ } void -setup_normal_output_buffer() +setup_normal_output_buffer(void) { output_data = (char *)KERNEL_LOAD_ADR; } @@ -262,15 +267,17 @@ serial_setup(reg_scope_instances regi_ser) rec_baud = REG_RD(ser, regi_ser, rw_rec_baud_div); tr_ctrl.stop_bits = 1; /* 2 stop bits. */ + tr_ctrl.en = 1; /* enable transmitter */ + rec_ctrl.en = 1; /* enabler receiver */ /* -* The baudrate setup is a bit fishy, but in the end the transceiver is -* set to 4800 and the receiver to 115200. The magic value is -* 29.493 MHz. +* The baudrate setup used to be a bit fishy, but now transmitter and +* receiver are both set to the intended baud rate, 115200. +* The magic value is 29.493 MHz. */ tr_ctrl.base_freq = regk_ser_f29_493; rec_ctrl.base_freq = regk_ser_f29_493; - tr_baud.div = (29493000 / 8) / 4800; + tr_baud.div = (29493000 / 8) / 115200; rec_baud.div = (29493000 / 8) / 115200; REG_WR(ser, regi_ser, rw_tr_ctrl, tr_ctrl); @@ -280,25 +287,52 @@ serial_setup(reg_scope_instances regi_ser) } void -decompress_kernel() +decompress_kernel(void) { char revision; - /* input_data is set in head.S */ - inbuf = input_data; +#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \ +defined(CONFIG_ETRAX_DEBUG_PORT2) || \ +defined(CONFIG_ETRAX_DEBUG_PORT3) + reg_pinmux_rw_hwprot hwprot; + +#ifdef CONFIG_CRIS_MACH_ARTPEC3 + reg_clkgen_rw_clk_ctrl clk_ctrl; + + /* Enable corresponding clock region when serial 1..3 selected */ + + clk_ctrl = REG_RD(clkgen, regi_clkgen, rw_clk_ctrl); + clk_ctrl.sser_ser_dma6_7 = regk_clkgen_yes; + REG_WR(clkgen, regi_clkgen, rw_clk_ctrl, clk_ctrl); +#endif + + /* pinmux setup for ports 1..3 */ + hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot); +#endif #ifdef CONFIG_ETRAX_DEBUG_PORT0 serial_setup(regi_ser0); #endif #ifdef CONFIG_ETRAX_DEBUG_PORT1 + hwprot.ser1 = regk_pinmux_yes; serial_setup(regi_ser1); #endif #ifdef CONFIG_ETRAX_DEBUG_PORT2 + hwprot.ser2 = regk_pinmux_yes; serial_setup(regi_ser2); #endif #ifdef CONFIG_ETRAX_DEBUG_PORT3 + hwprot.ser3 = regk_pinmux_yes; serial_setup(regi_ser3); #endif +#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \ +defined(CONFIG_ETRAX_DEBUG_PORT2) || \ +defined(CONFIG_ETRAX_DEBUG_PORT3) + REG_WR(pinmux, regi_pinmux, rw_hwprot, hwprot); +#endif + + /* input_data is set in head.S */ + inbuf = input_data; setup_normal_output_buffer(); @@ -307,11 +341,11 @@ decompress_kernel() __asm__ volatile (move $vr,%0 : =rm (revision)); if (revision 32)
[PATCH 40/47] Update CRISv32 kernel/head.S
- Shorten include paths for machine specific header files. - Add magic for booting NAND flash. - Change CONFIG_ETRAXFS_SIM to CONFIG_ETRAX_VCS_SIM. - Use assembler macros for initializing hardware (clocks) - Add stubs for SMP slave CPUs. - Search for cramfs or jffs2 if no romfs found. - Initialize l2cache. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/kernel/head.S | 202 +- 1 files changed, 114 insertions(+), 88 deletions(-) diff --git a/arch/cris/arch-v32/kernel/head.S b/arch/cris/arch-v32/kernel/head.S index 20bd80a..96ad000 100644 --- a/arch/cris/arch-v32/kernel/head.S +++ b/arch/cris/arch-v32/kernel/head.S @@ -4,22 +4,25 @@ * Copyright (C) 2003, Axis Communications AB */ - #define ASSEMBLER_MACROS_ONLY /* * The macros found in mmu_defs_asm.h uses the ## concatenation operator, so * -traditional must not be used when assembling this file. */ -#include asm/arch/hwregs/reg_rdwr.h -#include asm/arch/hwregs/asm/mmu_defs_asm.h -#include asm/arch/hwregs/asm/reg_map_asm.h -#include asm/arch/hwregs/asm/config_defs_asm.h -#include asm/arch/hwregs/asm/bif_core_defs_asm.h +#include hwregs/reg_rdwr.h +#include asm/arch/memmap.h +#include hwregs/intr_vect.h +#include hwregs/asm/mmu_defs_asm.h +#include hwregs/asm/reg_map_asm.h +#include asm/arch/mach/startup.inc #define CRAMFS_MAGIC 0x28cd3d45 +#define JHEAD_MAGIC 0x1FF528A6 +#define JHEAD_SIZE 8 #define RAM_INIT_MAGIC 0x56902387 #define COMMAND_LINE_MAGIC 0x87109563 +#define NAND_BOOT_MAGIC 0x9a9db001 ;; NOTE: R8 and R9 carry information from the decompressor (if the ;; kernel was compressed). They must not be used in the code below @@ -30,12 +33,11 @@ .global romfs_start .global romfs_length .global romfs_in_flash + .global nand_boot .global swapper_pg_dir - .global crisv32_nand_boot - .global crisv32_nand_cramfs_offset ;; Dummy section to make it bootable with current VCS simulator -#ifdef CONFIG_ETRAXFS_SIM +#ifdef CONFIG_ETRAX_VCS_SIM .section .boot, ax ba tstart nop @@ -51,33 +53,13 @@ tstart: ;; di - ;; Start clocks for used blocks. - move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1 - move.d [$r1], $r0 - or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \ - REG_STATE(config, rw_clk_ctrl, bif, yes) | \ - REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0 - move.d $r0, [$r1] - - ;; Set up waitstates etc - move.d REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg), $r0 - move.d CONFIG_ETRAX_MEM_GRP1_CONFIG, $r1 - move.d $r1, [$r0] - move.d REG_ADDR(bif_core, regi_bif_core, rw_grp2_cfg), $r0 - move.d CONFIG_ETRAX_MEM_GRP2_CONFIG, $r1 - move.d $r1, [$r0] - move.d REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg), $r0 - move.d CONFIG_ETRAX_MEM_GRP3_CONFIG, $r1 - move.d $r1, [$r0] - move.d REG_ADDR(bif_core, regi_bif_core, rw_grp4_cfg), $r0 - move.d CONFIG_ETRAX_MEM_GRP4_CONFIG, $r1 - move.d $r1, [$r0] - -#ifdef CONFIG_ETRAXFS_SIM - ;; Set up minimal flash waitstates - move.d 0, $r10 - move.d REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg), $r11 - move.d $r10, [$r11] + START_CLOCKS + + SETUP_WAIT_STATES + +#ifdef CONFIG_SMP +secondary_cpu_entry: /* Entry point for secondary CPUs */ + di #endif ;; Setup and enable the MMU. Use same configuration for both the data @@ -85,7 +67,7 @@ tstart: ;; ;; Note; 3 cycles is needed for a bank-select to take effect. Further; ;; bank 1 is the instruction MMU, bank 2 is the data MMU. -#ifndef CONFIG_ETRAXFS_SIM +#ifndef CONFIG_ETRAX_VCS_SIM move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \ | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \ | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0 @@ -93,7 +75,7 @@ tstart: ;; Map the virtual DRAM to the RW eprom area at address 0. ;; Also map 0xa for the hook calls, move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \ - | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0) \ + | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \ | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) \ | REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0xa), $r0 #endif @@ -104,7 +86,7 @@ tstart: ;; Enable certain page protections and setup linear mapping ;; for f,e,c,b,4,0. -#ifndef CONFIG_ETRAXFS_SIM +#ifndef CONFIG_ETRAX_VCS_SIM move.d REG_STATE(mmu, rw_mm_cfg, we, on) \ | REG_STATE(mmu, rw_mm_cfg, acc, on)\ | REG_STATE(mmu, rw_mm_cfg, ex, on) \ @@ -183,17 +165,11 @@ tstart: nop nop nop - move$s10, $r0 + move$s12, $r0
[PATCH 41/47] Update and simplify CRISv32 kernel/irq.c.
- First timer register has changed name to timer0. - Build IRQs with only IRQ number, mask bit will be calculated instead. - Add more IRQs, up to 64 supported. - Use arrays to hold which IRQs triggered instead of trying to do magic with two 32 bit values now that more than 32 IRQs are supported. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/kernel/irq.c | 274 +++ 1 files changed, 193 insertions(+), 81 deletions(-) diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c index a9acaa2..173c141 100644 --- a/arch/cris/arch-v32/kernel/irq.c +++ b/arch/cris/arch-v32/kernel/irq.c @@ -15,15 +15,21 @@ #include linux/threads.h #include linux/spinlock.h #include linux/kernel_stat.h -#include asm/arch/hwregs/reg_map.h -#include asm/arch/hwregs/reg_rdwr.h -#include asm/arch/hwregs/intr_vect.h -#include asm/arch/hwregs/intr_vect_defs.h +#include hwregs/reg_map.h +#include hwregs/reg_rdwr.h +#include hwregs/intr_vect.h +#include hwregs/intr_vect_defs.h #define CPU_FIXED -1 /* IRQ masks (refer to comment for crisv32_do_multiple) */ -#define TIMER_MASK (1 (TIMER_INTR_VECT - FIRST_IRQ)) +#if TIMER0_INTR_VECT - FIRST_IRQ 32 +#define TIMER_MASK (1 (TIMER0_INTR_VECT - FIRST_IRQ)) +#undef TIMER_VECT1 +#else +#define TIMER_MASK (1 (TIMER0_INTR_VECT - FIRST_IRQ - 32)) +#define TIMER_VECT1 +#endif #ifdef CONFIG_ETRAX_KGDB #if defined(CONFIG_ETRAX_KGDB_PORT0) #define IGNOREMASK (1 (SER0_INTR_VECT - FIRST_IRQ)) @@ -44,8 +50,8 @@ struct cris_irq_allocation cpumask_t mask; /* The CPUs to which the IRQ may be allocated. */ }; -struct cris_irq_allocation irq_allocations[NR_IRQS] = - {[0 ... NR_IRQS - 1] = {0, CPU_MASK_ALL}}; +struct cris_irq_allocation irq_allocations[NR_REAL_IRQS] = + { [0 ... NR_REAL_IRQS - 1] = {0, CPU_MASK_ALL} }; static unsigned long irq_regs[NR_CPUS] = { @@ -55,6 +61,12 @@ static unsigned long irq_regs[NR_CPUS] = #endif }; +#if NR_REAL_IRQS 32 +#define NBR_REGS 2 +#else +#define NBR_REGS 1 +#endif + unsigned long cpu_irq_counters[NR_CPUS]; unsigned long irq_counters[NR_REAL_IRQS]; @@ -79,45 +91,81 @@ extern void d_mmu_write(void); extern void kgdb_init(void); extern void breakpoint(void); +/* From traps.c. */ +extern void breakh_BUG(void); + /* - * Build the IRQ handler stubs using macros from irq.h. First argument is the - * IRQ number, the second argument is the corresponding bit in - * intr_rw_vect_mask found in asm/arch/hwregs/intr_vect_defs.h. + * Build the IRQ handler stubs using macros from irq.h. */ -BUILD_IRQ(0x31, (1 0)) /* memarb */ -BUILD_IRQ(0x32, (1 1)) /* gen_io */ -BUILD_IRQ(0x33, (1 2)) /* iop0 */ -BUILD_IRQ(0x34, (1 3)) /* iop1 */ -BUILD_IRQ(0x35, (1 4)) /* iop2 */ -BUILD_IRQ(0x36, (1 5)) /* iop3 */ -BUILD_IRQ(0x37, (1 6)) /* dma0 */ -BUILD_IRQ(0x38, (1 7)) /* dma1 */ -BUILD_IRQ(0x39, (1 8)) /* dma2 */ -BUILD_IRQ(0x3a, (1 9)) /* dma3 */ -BUILD_IRQ(0x3b, (1 10)) /* dma4 */ -BUILD_IRQ(0x3c, (1 11)) /* dma5 */ -BUILD_IRQ(0x3d, (1 12)) /* dma6 */ -BUILD_IRQ(0x3e, (1 13)) /* dma7 */ -BUILD_IRQ(0x3f, (1 14)) /* dma8 */ -BUILD_IRQ(0x40, (1 15)) /* dma9 */ -BUILD_IRQ(0x41, (1 16)) /* ata */ -BUILD_IRQ(0x42, (1 17)) /* sser0 */ -BUILD_IRQ(0x43, (1 18)) /* sser1 */ -BUILD_IRQ(0x44, (1 19)) /* ser0 */ -BUILD_IRQ(0x45, (1 20)) /* ser1 */ -BUILD_IRQ(0x46, (1 21)) /* ser2 */ -BUILD_IRQ(0x47, (1 22)) /* ser3 */ -BUILD_IRQ(0x48, (1 23)) -BUILD_IRQ(0x49, (1 24)) /* eth0 */ -BUILD_IRQ(0x4a, (1 25)) /* eth1 */ -BUILD_TIMER_IRQ(0x4b, (1 26))/* timer */ -BUILD_IRQ(0x4c, (1 27)) /* bif_arb */ -BUILD_IRQ(0x4d, (1 28)) /* bif_dma */ -BUILD_IRQ(0x4e, (1 29)) /* ext */ -BUILD_IRQ(0x4f, (1 29)) /* ipi */ +BUILD_IRQ(0x31) +BUILD_IRQ(0x32) +BUILD_IRQ(0x33) +BUILD_IRQ(0x34) +BUILD_IRQ(0x35) +BUILD_IRQ(0x36) +BUILD_IRQ(0x37) +BUILD_IRQ(0x38) +BUILD_IRQ(0x39) +BUILD_IRQ(0x3a) +BUILD_IRQ(0x3b) +BUILD_IRQ(0x3c) +BUILD_IRQ(0x3d) +BUILD_IRQ(0x3e) +BUILD_IRQ(0x3f) +BUILD_IRQ(0x40) +BUILD_IRQ(0x41) +BUILD_IRQ(0x42) +BUILD_IRQ(0x43) +BUILD_IRQ(0x44) +BUILD_IRQ(0x45) +BUILD_IRQ(0x46) +BUILD_IRQ(0x47) +BUILD_IRQ(0x48) +BUILD_IRQ(0x49) +BUILD_IRQ(0x4a) +BUILD_IRQ(0x4b) +BUILD_IRQ(0x4c) +BUILD_IRQ(0x4d) +BUILD_IRQ(0x4e) +BUILD_IRQ(0x4f) +BUILD_IRQ(0x50) +#if MACH_IRQS 32 +BUILD_IRQ(0x51) +BUILD_IRQ(0x52) +BUILD_IRQ(0x53) +BUILD_IRQ(0x54) +BUILD_IRQ(0x55) +BUILD_IRQ(0x56) +BUILD_IRQ(0x57) +BUILD_IRQ(0x58) +BUILD_IRQ(0x59) +BUILD_IRQ(0x5a) +BUILD_IRQ(0x5b) +BUILD_IRQ(0x5c) +BUILD_IRQ(0x5d) +BUILD_IRQ(0x5e) +BUILD_IRQ(0x5f) +BUILD_IRQ(0x60) +BUILD_IRQ(0x61) +BUILD_IRQ(0x62) +BUILD_IRQ(0x63) +BUILD_IRQ(0x64) +BUILD_IRQ(0x65) +BUILD_IRQ(0x66) +BUILD_IRQ(0x67) +BUILD_IRQ(0x68) +BUILD_IRQ(0x69) +BUILD_IRQ(0x6a) +BUILD_IRQ(0x6b) +BUILD_IRQ(0x6c) +BUILD_IRQ(0x6d) +BUILD_IRQ(0x6e) +BUILD_IRQ(0x6f) +BUILD_IRQ(0x70) +#endif /* Pointers to the low-level
[PATCH 42/47] Minor updates to CRISv32 kernel/process.c
- Shorten include paths for machine dependent header files. - Remove unused extern declaration of etrax_gpio_wake_up_check. - Register name for first timer is now regi_timer0. Signed-off-by: Jesper Nilsson [EMAIL PROTECTED] --- arch/cris/arch-v32/kernel/process.c | 16 ++-- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c index b72a155..3933c04 100644 --- a/arch/cris/arch-v32/kernel/process.c +++ b/arch/cris/arch-v32/kernel/process.c @@ -12,17 +12,13 @@ #include linux/err.h #include linux/fs.h #include linux/slab.h -#include asm/arch/hwregs/reg_rdwr.h -#include asm/arch/hwregs/reg_map.h -#include asm/arch/hwregs/timer_defs.h -#include asm/arch/hwregs/intr_vect_defs.h +#include hwregs/reg_rdwr.h +#include hwregs/reg_map.h +#include hwregs/timer_defs.h +#include hwregs/intr_vect_defs.h extern void stop_watchdog(void); -#ifdef CONFIG_ETRAX_GPIO -extern void etrax_gpio_wake_up_check(void); /* Defined in drivers/gpio.c. */ -#endif - extern int cris_hlt_counter; /* We use this if we don't have any better idle routine. */ @@ -82,7 +78,7 @@ hard_reset_now(void) wd_ctrl.cmd = regk_timer_start; arch_enable_nmi(); - REG_WR(timer, regi_timer, rw_wd_ctrl, wd_ctrl); + REG_WR(timer, regi_timer0, rw_wd_ctrl, wd_ctrl); } #endif @@ -162,7 +158,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp, /* Put the switch stack right below the pt_regs. */ swstack = ((struct switch_stack *) childregs) - 1; - /* Parameter to ret_from_sys_call. 0 is don't restart the syscall. */ + /* Paramater to ret_from_sys_call. 0 is don't restart the syscall. */ swstack-r9 = 0; /* -- 1.5.3.6.970.gd25430 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/