]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | Date: Wed, 4 Feb 2009 10:47:37 -0600 |
2 | From: Robin Holt <holt@sgi.com> | |
3 | Subject: bte_copy of BTE_MAX_XFER trips BUG_ON -V2 | |
4 | References: bnc#472894 | |
5 | ||
6 | BTE_MAX_XFER is wrong. It is one greater than the number of cache | |
7 | lines the BTE is actually able to transfer. If you request a transfer | |
8 | of exactly BTE_MAX_XFER size, you trip a very cryptic BUG_ON() which | |
9 | should certainly be made more clear. | |
10 | ||
11 | This patch fixes that constant and also cleans up the BUG_ON()s in | |
12 | arch/ia64/sn/kernel/bte.c to test one condition per line. | |
13 | ||
14 | Signed-off-by: Robin Holt <holt@sgi.com> | |
15 | Acked-by: Raymund Will <rw@suse.de> | |
16 | ||
17 | --- | |
18 | ||
19 | Changes since -V1: | |
20 | Base the BTE_LEN_MASK upon a 1UL instead of 1 for correctness. | |
21 | ||
22 | ||
23 | arch/ia64/include/asm/sn/bte.h | 4 ++-- | |
24 | arch/ia64/sn/kernel/bte.c | 7 ++++--- | |
25 | 2 files changed, 6 insertions(+), 5 deletions(-) | |
26 | ||
27 | Index: bte_fixup/arch/ia64/include/asm/sn/bte.h | |
28 | =================================================================== | |
29 | --- bte_fixup.orig/arch/ia64/include/asm/sn/bte.h 2009-02-04 10:37:29.594750841 -0600 | |
30 | +++ bte_fixup/arch/ia64/include/asm/sn/bte.h 2009-02-04 10:40:32.495791608 -0600 | |
31 | @@ -38,8 +38,8 @@ | |
32 | ||
33 | /* BTE status register only supports 16 bits for length field */ | |
34 | #define BTE_LEN_BITS (16) | |
35 | -#define BTE_LEN_MASK ((1 << BTE_LEN_BITS) - 1) | |
36 | -#define BTE_MAX_XFER ((1 << BTE_LEN_BITS) * L1_CACHE_BYTES) | |
37 | +#define BTE_LEN_MASK ((1UL << BTE_LEN_BITS) - 1) | |
38 | +#define BTE_MAX_XFER (BTE_LEN_MASK << L1_CACHE_SHIFT) | |
39 | ||
40 | ||
41 | /* Define hardware */ | |
42 | Index: bte_fixup/arch/ia64/sn/kernel/bte.c | |
43 | =================================================================== | |
44 | --- bte_fixup.orig/arch/ia64/sn/kernel/bte.c 2009-02-04 10:37:30.026753839 -0600 | |
45 | +++ bte_fixup/arch/ia64/sn/kernel/bte.c 2009-02-04 10:40:11.711701203 -0600 | |
46 | @@ -97,9 +97,10 @@ bte_result_t bte_copy(u64 src, u64 dest, | |
47 | return BTE_SUCCESS; | |
48 | } | |
49 | ||
50 | - BUG_ON((len & L1_CACHE_MASK) || | |
51 | - (src & L1_CACHE_MASK) || (dest & L1_CACHE_MASK)); | |
52 | - BUG_ON(!(len < ((BTE_LEN_MASK + 1) << L1_CACHE_SHIFT))); | |
53 | + BUG_ON(len & L1_CACHE_MASK); | |
54 | + BUG_ON(src & L1_CACHE_MASK); | |
55 | + BUG_ON(dest & L1_CACHE_MASK); | |
56 | + BUG_ON(len > BTE_MAX_XFER); | |
57 | ||
58 | /* | |
59 | * Start with interface corresponding to cpu number | |
60 | -- | |
61 | To unsubscribe from this list: send the line "unsubscribe linux-ia64" in | |
62 | the body of a message to majordomo@vger.kernel.org | |
63 | More majordomo info at http://vger.kernel.org/majordomo-info.html | |
64 |