···2121- fsl,qe-num-snums: define how many serial number(SNUM) the QE can use for the2222 threads.23232424+Optional properties:2525+- fsl,firmware-phandle:2626+ Usage: required only if there is no fsl,qe-firmware child node2727+ Value type: <phandle>2828+ Definition: Points to a firmware node (see "QE Firmware Node" below)2929+ that contains the firmware that should be uploaded for this QE.3030+ The compatible property for the firmware node should say,3131+ "fsl,qe-firmware".3232+2433Recommended properties2534- brg-frequency : the internal clock source frequency for baud-rate2635 generators in Hz.···6859 reg = <0 c000>;6960 };7061 };6262+6363+* QE Firmware Node6464+6565+This node defines a firmware binary that is embedded in the device tree, for6666+the purpose of passing the firmware from bootloader to the kernel, or from6767+the hypervisor to the guest.6868+6969+The firmware node itself contains the firmware binary contents, a compatible7070+property, and any firmware-specific properties. The node should be placed7171+inside a QE node that needs it. Doing so eliminates the need for a7272+fsl,firmware-phandle property. Other QE nodes that need the same firmware7373+should define an fsl,firmware-phandle property that points to the firmware node7474+in the first QE node.7575+7676+The fsl,firmware property can be specified in the DTS (possibly using incbin)7777+or can be inserted by the boot loader at boot time.7878+7979+Required properties:8080+ - compatible8181+ Usage: required8282+ Value type: <string>8383+ Definition: A standard property. Specify a string that indicates what8484+ kind of firmware it is. For QE, this should be "fsl,qe-firmware".8585+8686+ - fsl,firmware8787+ Usage: required8888+ Value type: <prop-encoded-array>, encoded as an array of bytes8989+ Definition: A standard property. This property contains the firmware9090+ binary "blob".9191+9292+Example:9393+ qe1@e0080000 {9494+ compatible = "fsl,qe";9595+ qe_firmware:qe-firmware {9696+ compatible = "fsl,qe-firmware";9797+ fsl,firmware = [0x70 0xcd 0x00 0x00 0x01 0x46 0x45 ...];9898+ };9999+ ...100100+ };101101+102102+ qe2@e0090000 {103103+ compatible = "fsl,qe";104104+ fsl,firmware-phandle = <&qe_firmware>;105105+ ...106106+ };
+10
MAINTAINERS
···32703270F: include/linux/kexec.h32713271F: kernel/kexec.c3272327232733273+KEYS/KEYRINGS:32743274+M: David Howells <dhowells@redhat.com>32753275+L: keyrings@linux-nfs.org32763276+S: Maintained32773277+F: Documentation/keys.txt32783278+F: include/linux/key.h32793279+F: include/linux/key-type.h32803280+F: include/keys/32813281+F: security/keys/32823282+32733283KGDB32743284M: Jason Wessel <jason.wessel@windriver.com>32753285L: kgdb-bugreport@lists.sourceforge.net
···11+/*22+ * arch/arm/include/asm/outercache.h33+ *44+ * Copyright (C) 2010 ARM Ltd.55+ * Written by Catalin Marinas <catalin.marinas@arm.com>66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License version 2 as99+ * published by the Free Software Foundation.1010+ *1111+ * This program is distributed in the hope that it will be useful,1212+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1313+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+ * GNU General Public License for more details.1515+ *1616+ * You should have received a copy of the GNU General Public License1717+ * along with this program; if not, write to the Free Software1818+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA1919+ */2020+2121+#ifndef __ASM_OUTERCACHE_H2222+#define __ASM_OUTERCACHE_H2323+2424+struct outer_cache_fns {2525+ void (*inv_range)(unsigned long, unsigned long);2626+ void (*clean_range)(unsigned long, unsigned long);2727+ void (*flush_range)(unsigned long, unsigned long);2828+#ifdef CONFIG_OUTER_CACHE_SYNC2929+ void (*sync)(void);3030+#endif3131+};3232+3333+#ifdef CONFIG_OUTER_CACHE3434+3535+extern struct outer_cache_fns outer_cache;3636+3737+static inline void outer_inv_range(unsigned long start, unsigned long end)3838+{3939+ if (outer_cache.inv_range)4040+ outer_cache.inv_range(start, end);4141+}4242+static inline void outer_clean_range(unsigned long start, unsigned long end)4343+{4444+ if (outer_cache.clean_range)4545+ outer_cache.clean_range(start, end);4646+}4747+static inline void outer_flush_range(unsigned long start, unsigned long end)4848+{4949+ if (outer_cache.flush_range)5050+ outer_cache.flush_range(start, end);5151+}5252+5353+#else5454+5555+static inline void outer_inv_range(unsigned long start, unsigned long end)5656+{ }5757+static inline void outer_clean_range(unsigned long start, unsigned long end)5858+{ }5959+static inline void outer_flush_range(unsigned long start, unsigned long end)6060+{ }6161+6262+#endif6363+6464+#ifdef CONFIG_OUTER_CACHE_SYNC6565+static inline void outer_sync(void)6666+{6767+ if (outer_cache.sync)6868+ outer_cache.sync();6969+}7070+#else7171+static inline void outer_sync(void)7272+{ }7373+#endif7474+7575+#endif /* __ASM_OUTERCACHE_H */
+10-6
arch/arm/include/asm/system.h
···6060#include <linux/linkage.h>6161#include <linux/irqflags.h>62626363+#include <asm/outercache.h>6464+6365#define __exception __attribute__((section(".exception.text")))64666567struct thread_info;···139137#define dmb() __asm__ __volatile__ ("" : : : "memory")140138#endif141139142142-#if __LINUX_ARM_ARCH__ >= 7 || defined(CONFIG_SMP)143143-#define mb() dmb()140140+#ifdef CONFIG_ARCH_HAS_BARRIERS141141+#include <mach/barriers.h>142142+#elif __LINUX_ARM_ARCH__ >= 7 || defined(CONFIG_SMP)143143+#define mb() do { dsb(); outer_sync(); } while (0)144144#define rmb() dmb()145145-#define wmb() dmb()145145+#define wmb() mb()146146#else147147#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)148148#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)···156152#define smp_rmb() barrier()157153#define smp_wmb() barrier()158154#else159159-#define smp_mb() mb()160160-#define smp_rmb() rmb()161161-#define smp_wmb() wmb()155155+#define smp_mb() dmb()156156+#define smp_rmb() dmb()157157+#define smp_wmb() dmb()162158#endif163159164160#define read_barrier_depends() do { } while(0)
+9-1
arch/arm/kernel/kprobes.c
···394394 /*395395 * Setup an empty pt_regs. Fill SP and PC fields as396396 * they're needed by longjmp_break_handler.397397+ *398398+ * We allocate some slack between the original SP and start of399399+ * our fabricated regs. To be precise we want to have worst case400400+ * covered which is STMFD with all 16 regs so we allocate 2 *401401+ * sizeof(struct_pt_regs)).402402+ *403403+ * This is to prevent any simulated instruction from writing404404+ * over the regs when they are accessing the stack.397405 */398406 "sub sp, %0, %1 \n\t"399407 "ldr r0, ="__stringify(JPROBE_MAGIC_ADDR)"\n\t"···419411 "ldmia sp, {r0 - pc} \n\t"420412 :421413 : "r" (kcb->jprobe_saved_regs.ARM_sp),422422- "I" (sizeof(struct pt_regs)),414414+ "I" (sizeof(struct pt_regs) * 2),423415 "J" (offsetof(struct pt_regs, ARM_sp)),424416 "J" (offsetof(struct pt_regs, ARM_pc)),425417 "J" (offsetof(struct pt_regs, ARM_cpsr))
···736736config OUTER_CACHE737737 bool738738739739+config OUTER_CACHE_SYNC740740+ bool741741+ help742742+ The outer cache has a outer_cache_fns.sync function pointer743743+ that can be used to drain the write buffer of the outer cache.744744+739745config CACHE_FEROCEON_L2740746 bool "Enable the Feroceon L2 cache controller"741747 depends on ARCH_KIRKWOOD || ARCH_MV78XX0···763757 REALVIEW_EB_A9MP || ARCH_MX35 || ARCH_MX31 || MACH_REALVIEW_PBX || ARCH_NOMADIK || ARCH_OMAP4764758 default y765759 select OUTER_CACHE760760+ select OUTER_CACHE_SYNC766761 help767762 This option enables the L2x0 PrimeCell.768763···788781 int789782 default 6 if ARM_L1_CACHE_SHIFT_6790783 default 5784784+785785+config ARCH_HAS_BARRIERS786786+ bool787787+ help788788+ This option allows the use of custom mandatory barriers789789+ included via the mach/barriers.h file.
···11-/*22- * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>33- * Copyright (C) 2008-2009 PetaLogix44- * Copyright (C) 2006 Atmark Techno, Inc.55- *66- * This file is subject to the terms and conditions of the GNU General Public77- * License. See the file "COPYING" in the main directory of this archive88- * for more details.99- */1010-1111-#ifndef _ASM_MICROBLAZE_SEGMENT_H1212-#define _ASM_MICROBLAZE_SEGMENT_H1313-1414-# ifndef __ASSEMBLY__1515-1616-typedef struct {1717- unsigned long seg;1818-} mm_segment_t;1919-2020-/*2121- * On Microblaze the fs value is actually the top of the corresponding2222- * address space.2323- *2424- * The fs value determines whether argument validity checking should be2525- * performed or not. If get_fs() == USER_DS, checking is performed, with2626- * get_fs() == KERNEL_DS, checking is bypassed.2727- *2828- * For historical reasons, these macros are grossly misnamed.2929- *3030- * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal.3131- */3232-# define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })3333-3434-# ifndef CONFIG_MMU3535-# define KERNEL_DS MAKE_MM_SEG(0)3636-# define USER_DS KERNEL_DS3737-# else3838-# define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)3939-# define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)4040-# endif4141-4242-# define get_ds() (KERNEL_DS)4343-# define get_fs() (current_thread_info()->addr_limit)4444-# define set_fs(val) (current_thread_info()->addr_limit = (val))4545-4646-# define segment_eq(a, b) ((a).seg == (b).seg)4747-4848-# endif /* __ASSEMBLY__ */4949-#endif /* _ASM_MICROBLAZE_SEGMENT_H */
+4-1
arch/microblaze/include/asm/thread_info.h
···1919#ifndef __ASSEMBLY__2020# include <linux/types.h>2121# include <asm/processor.h>2222-# include <asm/segment.h>23222423/*2524 * low level task data that entry.S needs immediate access to···5859 __u32 esr;5960 __u32 fsr;6061};6262+6363+typedef struct {6464+ unsigned long seg;6565+} mm_segment_t;61666267struct thread_info {6368 struct task_struct *task; /* main task structure */
···2222#include <asm/mmu.h>2323#include <asm/page.h>2424#include <asm/pgtable.h>2525-#include <asm/segment.h>2625#include <linux/string.h>27262827#define VERIFY_READ 02928#define VERIFY_WRITE 130293131-#define __clear_user(addr, n) (memset((void *)(addr), 0, (n)), 0)3030+/*3131+ * On Microblaze the fs value is actually the top of the corresponding3232+ * address space.3333+ *3434+ * The fs value determines whether argument validity checking should be3535+ * performed or not. If get_fs() == USER_DS, checking is performed, with3636+ * get_fs() == KERNEL_DS, checking is bypassed.3737+ *3838+ * For historical reasons, these macros are grossly misnamed.3939+ *4040+ * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal.4141+ */4242+# define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })4343+4444+# ifndef CONFIG_MMU4545+# define KERNEL_DS MAKE_MM_SEG(0)4646+# define USER_DS KERNEL_DS4747+# else4848+# define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)4949+# define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)5050+# endif5151+5252+# define get_ds() (KERNEL_DS)5353+# define get_fs() (current_thread_info()->addr_limit)5454+# define set_fs(val) (current_thread_info()->addr_limit = (val))5555+5656+# define segment_eq(a, b) ((a).seg == (b).seg)5757+5858+/*5959+ * The exception table consists of pairs of addresses: the first is the6060+ * address of an instruction that is allowed to fault, and the second is6161+ * the address at which the program should continue. No registers are6262+ * modified, so it is entirely up to the continuation code to figure out6363+ * what to do.6464+ *6565+ * All the routines below use bits of fixup code that are out of line6666+ * with the main instruction path. This means when everything is well,6767+ * we don't even have to jump over them. Further, they do not intrude6868+ * on our cache or tlb entries.6969+ */7070+struct exception_table_entry {7171+ unsigned long insn, fixup;7272+};7373+7474+/* Returns 0 if exception not found and fixup otherwise. */7575+extern unsigned long search_exception_table(unsigned long);32763377#ifndef CONFIG_MMU34783535-extern int ___range_ok(unsigned long addr, unsigned long size);7979+/* Check against bounds of physical memory */8080+static inline int ___range_ok(unsigned long addr, unsigned long size)8181+{8282+ return ((addr < memory_start) ||8383+ ((addr + size) > memory_end));8484+}36853786#define __range_ok(addr, size) \3887 ___range_ok((unsigned long)(addr), (unsigned long)(size))39884089#define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0)4141-#define __access_ok(add, size) (__range_ok((addr), (size)) == 0)42904343-/* Undefined function to trigger linker error */4444-extern int bad_user_access_length(void);4545-4646-/* FIXME this is function for optimalization -> memcpy */4747-#define __get_user(var, ptr) \4848-({ \4949- int __gu_err = 0; \5050- switch (sizeof(*(ptr))) { \5151- case 1: \5252- case 2: \5353- case 4: \5454- (var) = *(ptr); \5555- break; \5656- case 8: \5757- memcpy((void *) &(var), (ptr), 8); \5858- break; \5959- default: \6060- (var) = 0; \6161- __gu_err = __get_user_bad(); \6262- break; \6363- } \6464- __gu_err; \6565-})6666-6767-#define __get_user_bad() (bad_user_access_length(), (-EFAULT))6868-6969-/* FIXME is not there defined __pu_val */7070-#define __put_user(var, ptr) \7171-({ \7272- int __pu_err = 0; \7373- switch (sizeof(*(ptr))) { \7474- case 1: \7575- case 2: \7676- case 4: \7777- *(ptr) = (var); \7878- break; \7979- case 8: { \8080- typeof(*(ptr)) __pu_val = (var); \8181- memcpy(ptr, &__pu_val, sizeof(__pu_val)); \8282- } \8383- break; \8484- default: \8585- __pu_err = __put_user_bad(); \8686- break; \8787- } \8888- __pu_err; \8989-})9090-9191-#define __put_user_bad() (bad_user_access_length(), (-EFAULT))9292-9393-#define put_user(x, ptr) __put_user((x), (ptr))9494-#define get_user(x, ptr) __get_user((x), (ptr))9595-9696-#define copy_to_user(to, from, n) (memcpy((to), (from), (n)), 0)9797-#define copy_from_user(to, from, n) (memcpy((to), (from), (n)), 0)9898-9999-#define __copy_to_user(to, from, n) (copy_to_user((to), (from), (n)))100100-#define __copy_from_user(to, from, n) (copy_from_user((to), (from), (n)))101101-#define __copy_to_user_inatomic(to, from, n) \102102- (__copy_to_user((to), (from), (n)))103103-#define __copy_from_user_inatomic(to, from, n) \104104- (__copy_from_user((to), (from), (n)))105105-106106-static inline unsigned long clear_user(void *addr, unsigned long size)107107-{108108- if (access_ok(VERIFY_WRITE, addr, size))109109- size = __clear_user(addr, size);110110- return size;111111-}112112-113113-/* Returns 0 if exception not found and fixup otherwise. */114114-extern unsigned long search_exception_table(unsigned long);115115-116116-extern long strncpy_from_user(char *dst, const char *src, long count);117117-extern long strnlen_user(const char *src, long count);118118-119119-#else /* CONFIG_MMU */9191+#else1209212193/*12294 * Address is valid if:···101129/* || printk("access_ok failed for %s at 0x%08lx (size %d), seg 0x%08x\n",102130 type?"WRITE":"READ",addr,size,get_fs().seg)) */103131104104-/*105105- * All the __XXX versions macros/functions below do not perform106106- * access checking. It is assumed that the necessary checks have been107107- * already performed before the finction (macro) is called.132132+#endif133133+134134+#ifdef CONFIG_MMU135135+# define __FIXUP_SECTION ".section .fixup,\"ax\"\n"136136+# define __EX_TABLE_SECTION ".section __ex_table,\"a\"\n"137137+#else138138+# define __FIXUP_SECTION ".section .discard,\"ax\"\n"139139+# define __EX_TABLE_SECTION ".section .discard,\"a\"\n"140140+#endif141141+142142+extern unsigned long __copy_tofrom_user(void __user *to,143143+ const void __user *from, unsigned long size);144144+145145+/* Return: number of not copied bytes, i.e. 0 if OK or non-zero if fail. */146146+static inline unsigned long __must_check __clear_user(void __user *to,147147+ unsigned long n)148148+{149149+ /* normal memset with two words to __ex_table */150150+ __asm__ __volatile__ ( \151151+ "1: sb r0, %2, r0;" \152152+ " addik %0, %0, -1;" \153153+ " bneid %0, 1b;" \154154+ " addik %2, %2, 1;" \155155+ "2: " \156156+ __EX_TABLE_SECTION \157157+ ".word 1b,2b;" \158158+ ".previous;" \159159+ : "=r"(n) \160160+ : "0"(n), "r"(to)161161+ );162162+ return n;163163+}164164+165165+static inline unsigned long __must_check clear_user(void __user *to,166166+ unsigned long n)167167+{168168+ might_sleep();169169+ if (unlikely(!access_ok(VERIFY_WRITE, to, n)))170170+ return n;171171+172172+ return __clear_user(to, n);173173+}174174+175175+/* put_user and get_user macros */176176+extern long __user_bad(void);177177+178178+#define __get_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \179179+({ \180180+ __asm__ __volatile__ ( \181181+ "1:" insn " %1, %2, r0;" \182182+ " addk %0, r0, r0;" \183183+ "2: " \184184+ __FIXUP_SECTION \185185+ "3: brid 2b;" \186186+ " addik %0, r0, %3;" \187187+ ".previous;" \188188+ __EX_TABLE_SECTION \189189+ ".word 1b,3b;" \190190+ ".previous;" \191191+ : "=&r"(__gu_err), "=r"(__gu_val) \192192+ : "r"(__gu_ptr), "i"(-EFAULT) \193193+ ); \194194+})195195+196196+/**197197+ * get_user: - Get a simple variable from user space.198198+ * @x: Variable to store result.199199+ * @ptr: Source address, in user space.200200+ *201201+ * Context: User context only. This function may sleep.202202+ *203203+ * This macro copies a single simple variable from user space to kernel204204+ * space. It supports simple types like char and int, but not larger205205+ * data types like structures or arrays.206206+ *207207+ * @ptr must have pointer-to-simple-variable type, and the result of208208+ * dereferencing @ptr must be assignable to @x without a cast.209209+ *210210+ * Returns zero on success, or -EFAULT on error.211211+ * On error, the variable @x is set to zero.108212 */109109-110110-#define get_user(x, ptr) \111111-({ \112112- access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \113113- ? __get_user((x), (ptr)) : -EFAULT; \114114-})115115-116116-#define put_user(x, ptr) \117117-({ \118118- access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \119119- ? __put_user((x), (ptr)) : -EFAULT; \120120-})121213122214#define __get_user(x, ptr) \123215({ \···199163 __get_user_asm("lw", (ptr), __gu_val, __gu_err); \200164 break; \201165 default: \202202- __gu_val = 0; __gu_err = -EINVAL; \166166+ /* __gu_val = 0; __gu_err = -EINVAL;*/ __gu_err = __user_bad();\203167 } \204168 x = (__typeof__(*(ptr))) __gu_val; \205169 __gu_err; \206170})207171208208-#define __get_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \172172+173173+#define get_user(x, ptr) \209174({ \210210- __asm__ __volatile__ ( \211211- "1:" insn " %1, %2, r0; \212212- addk %0, r0, r0; \213213- 2: \214214- .section .fixup,\"ax\"; \215215- 3: brid 2b; \216216- addik %0, r0, %3; \217217- .previous; \218218- .section __ex_table,\"a\"; \219219- .word 1b,3b; \220220- .previous;" \221221- : "=r"(__gu_err), "=r"(__gu_val) \222222- : "r"(__gu_ptr), "i"(-EFAULT) \223223- ); \175175+ access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) \176176+ ? __get_user((x), (ptr)) : -EFAULT; \224177})178178+179179+#define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \180180+({ \181181+ __asm__ __volatile__ ( \182182+ "1:" insn " %1, %2, r0;" \183183+ " addk %0, r0, r0;" \184184+ "2: " \185185+ __FIXUP_SECTION \186186+ "3: brid 2b;" \187187+ " addik %0, r0, %3;" \188188+ ".previous;" \189189+ __EX_TABLE_SECTION \190190+ ".word 1b,3b;" \191191+ ".previous;" \192192+ : "=&r"(__gu_err) \193193+ : "r"(__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \194194+ ); \195195+})196196+197197+#define __put_user_asm_8(__gu_ptr, __gu_val, __gu_err) \198198+({ \199199+ __asm__ __volatile__ (" lwi %0, %1, 0;" \200200+ "1: swi %0, %2, 0;" \201201+ " lwi %0, %1, 4;" \202202+ "2: swi %0, %2, 4;" \203203+ " addk %0, r0, r0;" \204204+ "3: " \205205+ __FIXUP_SECTION \206206+ "4: brid 3b;" \207207+ " addik %0, r0, %3;" \208208+ ".previous;" \209209+ __EX_TABLE_SECTION \210210+ ".word 1b,4b,2b,4b;" \211211+ ".previous;" \212212+ : "=&r"(__gu_err) \213213+ : "r"(&__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \214214+ ); \215215+})216216+217217+/**218218+ * put_user: - Write a simple value into user space.219219+ * @x: Value to copy to user space.220220+ * @ptr: Destination address, in user space.221221+ *222222+ * Context: User context only. This function may sleep.223223+ *224224+ * This macro copies a single simple value from kernel space to user225225+ * space. It supports simple types like char and int, but not larger226226+ * data types like structures or arrays.227227+ *228228+ * @ptr must have pointer-to-simple-variable type, and @x must be assignable229229+ * to the result of dereferencing @ptr.230230+ *231231+ * Returns zero on success, or -EFAULT on error.232232+ */225233226234#define __put_user(x, ptr) \227235({ \···275195 case 1: \276196 __put_user_asm("sb", (ptr), __gu_val, __gu_err); \277197 break; \278278- case 2: \198198+ case 2: \279199 __put_user_asm("sh", (ptr), __gu_val, __gu_err); \280200 break; \281201 case 4: \···285205 __put_user_asm_8((ptr), __gu_val, __gu_err); \286206 break; \287207 default: \288288- __gu_err = -EINVAL; \208208+ /*__gu_err = -EINVAL;*/ __gu_err = __user_bad(); \289209 } \290210 __gu_err; \291211})292212293293-#define __put_user_asm_8(__gu_ptr, __gu_val, __gu_err) \294294-({ \295295-__asm__ __volatile__ (" lwi %0, %1, 0; \296296- 1: swi %0, %2, 0; \297297- lwi %0, %1, 4; \298298- 2: swi %0, %2, 4; \299299- addk %0,r0,r0; \300300- 3: \301301- .section .fixup,\"ax\"; \302302- 4: brid 3b; \303303- addik %0, r0, %3; \304304- .previous; \305305- .section __ex_table,\"a\"; \306306- .word 1b,4b,2b,4b; \307307- .previous;" \308308- : "=&r"(__gu_err) \309309- : "r"(&__gu_val), \310310- "r"(__gu_ptr), "i"(-EFAULT) \311311- ); \213213+#ifndef CONFIG_MMU214214+215215+#define put_user(x, ptr) __put_user((x), (ptr))216216+217217+#else /* CONFIG_MMU */218218+219219+#define put_user(x, ptr) \220220+({ \221221+ access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) \222222+ ? __put_user((x), (ptr)) : -EFAULT; \312223})224224+#endif /* CONFIG_MMU */313225314314-#define __put_user_asm(insn, __gu_ptr, __gu_val, __gu_err) \315315-({ \316316- __asm__ __volatile__ ( \317317- "1:" insn " %1, %2, r0; \318318- addk %0, r0, r0; \319319- 2: \320320- .section .fixup,\"ax\"; \321321- 3: brid 2b; \322322- addik %0, r0, %3; \323323- .previous; \324324- .section __ex_table,\"a\"; \325325- .word 1b,3b; \326326- .previous;" \327327- : "=r"(__gu_err) \328328- : "r"(__gu_val), "r"(__gu_ptr), "i"(-EFAULT) \329329- ); \330330-})331331-332332-/*333333- * Return: number of not copied bytes, i.e. 0 if OK or non-zero if fail.334334- */335335-static inline int clear_user(char *to, int size)336336-{337337- if (size && access_ok(VERIFY_WRITE, to, size)) {338338- __asm__ __volatile__ (" \339339- 1: \340340- sb r0, %2, r0; \341341- addik %0, %0, -1; \342342- bneid %0, 1b; \343343- addik %2, %2, 1; \344344- 2: \345345- .section __ex_table,\"a\"; \346346- .word 1b,2b; \347347- .section .text;" \348348- : "=r"(size) \349349- : "0"(size), "r"(to)350350- );351351- }352352- return size;353353-}354354-355355-#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n))226226+/* copy_to_from_user */227227+#define __copy_from_user(to, from, n) \228228+ __copy_tofrom_user((__force void __user *)(to), \229229+ (void __user *)(from), (n))356230#define __copy_from_user_inatomic(to, from, n) \357231 copy_from_user((to), (from), (n))358232359359-#define copy_to_user(to, from, n) \360360- (access_ok(VERIFY_WRITE, (to), (n)) ? \361361- __copy_tofrom_user((void __user *)(to), \362362- (__force const void __user *)(from), (n)) \363363- : -EFAULT)233233+static inline long copy_from_user(void *to,234234+ const void __user *from, unsigned long n)235235+{236236+ might_sleep();237237+ if (access_ok(VERIFY_READ, from, n))238238+ return __copy_from_user(to, from, n);239239+ return n;240240+}364241365365-#define __copy_to_user(to, from, n) copy_to_user((to), (from), (n))242242+#define __copy_to_user(to, from, n) \243243+ __copy_tofrom_user((void __user *)(to), \244244+ (__force const void __user *)(from), (n))366245#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n))367246368368-#define copy_from_user(to, from, n) \369369- (access_ok(VERIFY_READ, (from), (n)) ? \370370- __copy_tofrom_user((__force void __user *)(to), \371371- (void __user *)(from), (n)) \372372- : -EFAULT)373373-374374-extern int __strncpy_user(char *to, const char __user *from, int len);375375-extern int __strnlen_user(const char __user *sstr, int len);376376-377377-#define strncpy_from_user(to, from, len) \378378- (access_ok(VERIFY_READ, from, 1) ? \379379- __strncpy_user(to, from, len) : -EFAULT)380380-#define strnlen_user(str, len) \381381- (access_ok(VERIFY_READ, str, 1) ? __strnlen_user(str, len) : 0)382382-383383-#endif /* CONFIG_MMU */384384-385385-extern unsigned long __copy_tofrom_user(void __user *to,386386- const void __user *from, unsigned long size);247247+static inline long copy_to_user(void __user *to,248248+ const void *from, unsigned long n)249249+{250250+ might_sleep();251251+ if (access_ok(VERIFY_WRITE, to, n))252252+ return __copy_to_user(to, from, n);253253+ return n;254254+}387255388256/*389389- * The exception table consists of pairs of addresses: the first is the390390- * address of an instruction that is allowed to fault, and the second is391391- * the address at which the program should continue. No registers are392392- * modified, so it is entirely up to the continuation code to figure out393393- * what to do.394394- *395395- * All the routines below use bits of fixup code that are out of line396396- * with the main instruction path. This means when everything is well,397397- * we don't even have to jump over them. Further, they do not intrude398398- * on our cache or tlb entries.257257+ * Copy a null terminated string from userspace.399258 */400400-struct exception_table_entry {401401- unsigned long insn, fixup;402402-};259259+extern int __strncpy_user(char *to, const char __user *from, int len);260260+261261+#define __strncpy_from_user __strncpy_user262262+263263+static inline long264264+strncpy_from_user(char *dst, const char __user *src, long count)265265+{266266+ if (!access_ok(VERIFY_READ, src, 1))267267+ return -EFAULT;268268+ return __strncpy_from_user(dst, src, count);269269+}270270+271271+/*272272+ * Return the size of a string (including the ending 0)273273+ *274274+ * Return 0 on exception, a value greater than N if too long275275+ */276276+extern int __strnlen_user(const char __user *sstr, int len);277277+278278+static inline long strnlen_user(const char __user *src, long n)279279+{280280+ if (!access_ok(VERIFY_READ, src, 1))281281+ return 0;282282+ return __strnlen_user(src, n);283283+}403284404285#endif /* __ASSEMBLY__ */405286#endif /* __KERNEL__ */
+1-1
arch/microblaze/kernel/dma.c
···38383939static unsigned long get_dma_direct_offset(struct device *dev)4040{4141- if (dev)4141+ if (likely(dev))4242 return (unsigned long)dev->archdata.dma_data;43434444 return PCI_DRAM_OFFSET; /* FIXME Not sure if is correct */
+9-3
arch/microblaze/kernel/head.S
···51515252 .text5353ENTRY(_start)5454+#if CONFIG_KERNEL_BASE_ADDR == 05555+ brai TOPHYS(real_start)5656+ .org 0x1005757+real_start:5858+#endif5959+5460 mfs r1, rmsr5561 andi r1, r1, ~25662 mts rmsr, r1···10599 tophys(r4,r4) /* convert to phys address */106100 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */107101_copy_command_line:108108- lbu r2, r5, r6 /* r7=r5+r6 - r5 contain pointer to command line */109109- sb r2, r4, r6 /* addr[r4+r6]= r7*/102102+ lbu r2, r5, r6 /* r2=r5+r6 - r5 contain pointer to command line */103103+ sb r2, r4, r6 /* addr[r4+r6]= r2*/110104 addik r6, r6, 1 /* increment counting */111105 bgtid r3, _copy_command_line /* loop for all entries */112106 addik r3, r3, -1 /* descrement loop */···134128 * virtual to physical.135129 */136130 nop137137- addik r3, r0, 63 /* Invalidate all TLB entries */131131+ addik r3, r0, MICROBLAZE_TLB_SIZE -1 /* Invalidate all TLB entries */138132_invalidate:139133 mts rtlbx, r3140134 mts rtlbhi, r0 /* flush: ensure V is clear */
+48-64
arch/microblaze/kernel/hw_exception_handler.S
···313313 mfs r5, rmsr;314314 nop315315 swi r5, r1, 0;316316- mfs r3, resr316316+ mfs r4, resr317317 nop318318- mfs r4, rear;318318+ mfs r3, rear;319319 nop320320321321#ifndef CONFIG_MMU322322- andi r5, r3, 0x1000; /* Check ESR[DS] */322322+ andi r5, r4, 0x1000; /* Check ESR[DS] */323323 beqi r5, not_in_delay_slot; /* Branch if ESR[DS] not set */324324 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */325325 nop···327327 swi r17, r1, PT_R17328328#endif329329330330- andi r5, r3, 0x1F; /* Extract ESR[EXC] */330330+ andi r5, r4, 0x1F; /* Extract ESR[EXC] */331331332332#ifdef CONFIG_MMU333333 /* Calculate exception vector offset = r5 << 2 */334334 addk r6, r5, r5; /* << 1 */335335 addk r6, r6, r6; /* << 2 */336336337337+#ifdef DEBUG337338/* counting which exception happen */338339 lwi r5, r0, 0x200 + TOPHYS(r0_ram)339340 addi r5, r5, 1···342341 lwi r5, r6, 0x200 + TOPHYS(r0_ram)343342 addi r5, r5, 1344343 swi r5, r6, 0x200 + TOPHYS(r0_ram)344344+#endif345345/* end */346346 /* Load the HW Exception vector */347347 lwi r6, r6, TOPHYS(_MB_HW_ExceptionVectorTable)···378376 swi r18, r1, PT_R18379377380378 or r5, r1, r0381381- andi r6, r3, 0x1F; /* Load ESR[EC] */379379+ andi r6, r4, 0x1F; /* Load ESR[EC] */382380 lwi r7, r0, PER_CPU(KM) /* MS: saving current kernel mode to regs */383381 swi r7, r1, PT_MODE384382 mfs r7, rfsr···428426 */429427handle_unaligned_ex:430428 /* Working registers already saved: R3, R4, R5, R6431431- * R3 = ESR432432- * R4 = EAR429429+ * R4 = ESR430430+ * R3 = EAR433431 */434432#ifdef CONFIG_MMU435435- andi r6, r3, 0x1000 /* Check ESR[DS] */433433+ andi r6, r4, 0x1000 /* Check ESR[DS] */436434 beqi r6, _no_delayslot /* Branch if ESR[DS] not set */437435 mfs r17, rbtr; /* ESR[DS] set - return address in BTR */438436 nop···441439 RESTORE_STATE;442440 bri unaligned_data_trap443441#endif444444- andi r6, r3, 0x3E0; /* Mask and extract the register operand */442442+ andi r6, r4, 0x3E0; /* Mask and extract the register operand */445443 srl r6, r6; /* r6 >> 5 */446444 srl r6, r6;447445 srl r6, r6;···450448 /* Store the register operand in a temporary location */451449 sbi r6, r0, TOPHYS(ex_reg_op);452450453453- andi r6, r3, 0x400; /* Extract ESR[S] */451451+ andi r6, r4, 0x400; /* Extract ESR[S] */454452 bnei r6, ex_sw;455453ex_lw:456456- andi r6, r3, 0x800; /* Extract ESR[W] */454454+ andi r6, r4, 0x800; /* Extract ESR[W] */457455 beqi r6, ex_lhw;458458- lbui r5, r4, 0; /* Exception address in r4 */456456+ lbui r5, r3, 0; /* Exception address in r3 */459457 /* Load a word, byte-by-byte from destination address460458 and save it in tmp space */461459 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);462462- lbui r5, r4, 1;460460+ lbui r5, r3, 1;463461 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);464464- lbui r5, r4, 2;462462+ lbui r5, r3, 2;465463 sbi r5, r0, TOPHYS(ex_tmp_data_loc_2);466466- lbui r5, r4, 3;464464+ lbui r5, r3, 3;467465 sbi r5, r0, TOPHYS(ex_tmp_data_loc_3);468468- /* Get the destination register value into r3 */469469- lwi r3, r0, TOPHYS(ex_tmp_data_loc_0);466466+ /* Get the destination register value into r4 */467467+ lwi r4, r0, TOPHYS(ex_tmp_data_loc_0);470468 bri ex_lw_tail;471469ex_lhw:472472- lbui r5, r4, 0; /* Exception address in r4 */470470+ lbui r5, r3, 0; /* Exception address in r3 */473471 /* Load a half-word, byte-by-byte from destination474472 address and save it in tmp space */475473 sbi r5, r0, TOPHYS(ex_tmp_data_loc_0);476476- lbui r5, r4, 1;474474+ lbui r5, r3, 1;477475 sbi r5, r0, TOPHYS(ex_tmp_data_loc_1);478478- /* Get the destination register value into r3 */479479- lhui r3, r0, TOPHYS(ex_tmp_data_loc_0);476476+ /* Get the destination register value into r4 */477477+ lhui r4, r0, TOPHYS(ex_tmp_data_loc_0);480478ex_lw_tail:481479 /* Get the destination register number into r5 */482480 lbui r5, r0, TOPHYS(ex_reg_op);···504502 andi r6, r6, 0x800; /* Extract ESR[W] */505503 beqi r6, ex_shw;506504 /* Get the word - delay slot */507507- swi r3, r0, TOPHYS(ex_tmp_data_loc_0);505505+ swi r4, r0, TOPHYS(ex_tmp_data_loc_0);508506 /* Store the word, byte-by-byte into destination address */509509- lbui r3, r0, TOPHYS(ex_tmp_data_loc_0);510510- sbi r3, r4, 0;511511- lbui r3, r0, TOPHYS(ex_tmp_data_loc_1);512512- sbi r3, r4, 1;513513- lbui r3, r0, TOPHYS(ex_tmp_data_loc_2);514514- sbi r3, r4, 2;515515- lbui r3, r0, TOPHYS(ex_tmp_data_loc_3);516516- sbi r3, r4, 3;507507+ lbui r4, r0, TOPHYS(ex_tmp_data_loc_0);508508+ sbi r4, r3, 0;509509+ lbui r4, r0, TOPHYS(ex_tmp_data_loc_1);510510+ sbi r4, r3, 1;511511+ lbui r4, r0, TOPHYS(ex_tmp_data_loc_2);512512+ sbi r4, r3, 2;513513+ lbui r4, r0, TOPHYS(ex_tmp_data_loc_3);514514+ sbi r4, r3, 3;517515 bri ex_handler_done;518516519517ex_shw:520518 /* Store the lower half-word, byte-by-byte into destination address */521521- swi r3, r0, TOPHYS(ex_tmp_data_loc_0);522522- lbui r3, r0, TOPHYS(ex_tmp_data_loc_2);523523- sbi r3, r4, 0;524524- lbui r3, r0, TOPHYS(ex_tmp_data_loc_3);525525- sbi r3, r4, 1;519519+ swi r4, r0, TOPHYS(ex_tmp_data_loc_0);520520+ lbui r4, r0, TOPHYS(ex_tmp_data_loc_2);521521+ sbi r4, r3, 0;522522+ lbui r4, r0, TOPHYS(ex_tmp_data_loc_3);523523+ sbi r4, r3, 1;526524ex_sw_end: /* Exception handling of store word, ends. */527525528526ex_handler_done:···562560 */563561 mfs r11, rpid564562 nop565565- bri 4566566- mfs r3, rear /* Get faulting address */567567- nop568563 /* If we are faulting a kernel address, we have to use the569564 * kernel page tables.570565 */571571- ori r4, r0, CONFIG_KERNEL_START572572- cmpu r4, r3, r4573573- bgti r4, ex3566566+ ori r5, r0, CONFIG_KERNEL_START567567+ cmpu r5, r3, r5568568+ bgti r5, ex3574569 /* First, check if it was a zone fault (which means a user575570 * tried to access a kernel or read-protected page - always576571 * a SEGV). All other faults here must be stores, so no577572 * need to check ESR_S as well. */578578- mfs r4, resr579579- nop580573 andi r4, r4, 0x800 /* ESR_Z - zone protection */581574 bnei r4, ex2582575···586589 * tried to access a kernel or read-protected page - always587590 * a SEGV). All other faults here must be stores, so no588591 * need to check ESR_S as well. */589589- mfs r4, resr590590- nop591592 andi r4, r4, 0x800 /* ESR_Z */592593 bnei r4, ex2593594 /* get current task address */···660665 * R3 = ESR661666 */662667663663- mfs r3, rear /* Get faulting address */664664- nop665668 RESTORE_STATE;666669 bri page_fault_instr_trap667670···670677 */671678 handle_data_tlb_miss_exception:672679 /* Working registers already saved: R3, R4, R5, R6673673- * R3 = ESR680680+ * R3 = EAR, R4 = ESR674681 */675682 mfs r11, rpid676676- nop677677- bri 4678678- mfs r3, rear /* Get faulting address */679683 nop680684681685 /* If we are faulting a kernel address, we have to use the682686 * kernel page tables. */683683- ori r4, r0, CONFIG_KERNEL_START684684- cmpu r4, r3, r4687687+ ori r6, r0, CONFIG_KERNEL_START688688+ cmpu r4, r3, r6685689 bgti r4, ex5686690 ori r4, r0, swapper_pg_dir687691 mts rpid, r0 /* TLB will have 0 TID */···721731 * Many of these bits are software only. Bits we don't set722732 * here we (properly should) assume have the appropriate value.723733 */734734+ brid finish_tlb_load724735 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */725725-726726- bri finish_tlb_load727736 ex7:728737 /* The bailout. Restore registers to pre-exception conditions729738 * and call the heavyweights to help us out.···742753 * R3 = ESR743754 */744755 mfs r11, rpid745745- nop746746- bri 4747747- mfs r3, rear /* Get faulting address */748756 nop749757750758 /* If we are faulting a kernel address, we have to use the···778792 lwi r4, r5, 0 /* Get Linux PTE */779793780794 andi r6, r4, _PAGE_PRESENT781781- beqi r6, ex7795795+ beqi r6, ex10782796783797 ori r4, r4, _PAGE_ACCESSED784798 swi r4, r5, 0···791805 * Many of these bits are software only. Bits we don't set792806 * here we (properly should) assume have the appropriate value.793807 */808808+ brid finish_tlb_load794809 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */795795-796796- bri finish_tlb_load797810 ex10:798811 /* The bailout. Restore registers to pre-exception conditions799812 * and call the heavyweights to help us out.···822837 andi r5, r5, (MICROBLAZE_TLB_SIZE-1)823838 ori r6, r0, 1824839 cmp r31, r5, r6825825- blti r31, sem840840+ blti r31, ex12826841 addik r5, r6, 1827827- sem:842842+ ex12:828843 /* MS: save back current TLB index */829844 swi r5, r0, TOPHYS(tlb_index)830845···844859 nop845860846861 /* Done...restore registers and get out of here. */847847- ex12:848862 mts rpid, r11849863 nop850864 bri 4
+13-2
arch/microblaze/kernel/misc.S
···2626 * We avoid flushing the pinned 0, 1 and possibly 2 entries.2727 */2828.globl _tlbia;2929+.type _tlbia, @function2930.align 4;3031_tlbia:3131- addik r12, r0, 63 /* flush all entries (63 - 3) */3232+ addik r12, r0, MICROBLAZE_TLB_SIZE - 1 /* flush all entries (63 - 3) */3233 /* isync */3334_tlbia_1:3435 mts rtlbx, r12···4241 /* sync */4342 rtsd r15, 84443 nop4444+ .size _tlbia, . - _tlbia45454646/*4747 * Flush MMU TLB for a particular address (in r5)4848 */4949.globl _tlbie;5050+.type _tlbie, @function5051.align 4;5152_tlbie:5253 mts rtlbsx, r5 /* look up the address in TLB */···6259 rtsd r15, 86360 nop64616262+ .size _tlbie, . - _tlbie6363+6564/*6665 * Allocate TLB entry for early console6766 */6867.globl early_console_reg_tlb_alloc;6868+.type early_console_reg_tlb_alloc, @function6969.align 4;7070early_console_reg_tlb_alloc:7171 /*7272 * Load a TLB entry for the UART, so that microblaze_progress() can use7373 * the UARTs nice and early. We use a 4k real==virtual mapping.7474 */7575- ori r4, r0, 637575+ ori r4, r0, MICROBLAZE_TLB_SIZE - 17676 mts rtlbx, r4 /* TLB slot 2 */77777878 or r4,r5,r0···9185 nop9286 rtsd r15, 89387 nop8888+8989+ .size early_console_reg_tlb_alloc, . - early_console_reg_tlb_alloc94909591/*9692 * Copy a whole page (4096 bytes).···112104#define DCACHE_LINE_BYTES (4 * 4)113105114106.globl copy_page;107107+.type copy_page, @function115108.align 4;116109copy_page:117110 ori r11, r0, (PAGE_SIZE/DCACHE_LINE_BYTES) - 1···127118 addik r11, r11, -1128119 rtsd r15, 8129120 nop121121+122122+ .size copy_page, . - copy_page
+6-4
arch/microblaze/kernel/process.c
···1515#include <linux/bitops.h>1616#include <asm/system.h>1717#include <asm/pgalloc.h>1818+#include <asm/uaccess.h> /* for USER_DS macros */1819#include <asm/cacheflush.h>19202021void show_regs(struct pt_regs *regs)···75747675void default_idle(void)7776{7878- if (!hlt_counter) {7777+ if (likely(hlt_counter)) {7878+ while (!need_resched())7979+ cpu_relax();8080+ } else {7981 clear_thread_flag(TIF_POLLING_NRFLAG);8082 smp_mb__after_clear_bit();8183 local_irq_disable();···8682 cpu_sleep();8783 local_irq_enable();8884 set_thread_flag(TIF_POLLING_NRFLAG);8989- } else9090- while (!need_resched())9191- cpu_relax();8585+ }9286}93879488void cpu_idle(void)
+15-9
arch/microblaze/kernel/setup.c
···9292}9393#endif /* CONFIG_MTD_UCLINUX_EBSS */94949595+#if defined(CONFIG_EARLY_PRINTK) && defined(CONFIG_SERIAL_UARTLITE_CONSOLE)9696+#define eprintk early_printk9797+#else9898+#define eprintk printk9999+#endif100100+95101void __init machine_early_init(const char *cmdline, unsigned int ram,96102 unsigned int fdt, unsigned int msr)97103{···145139 setup_early_printk(NULL);146140#endif147141148148- early_printk("Ramdisk addr 0x%08x, ", ram);142142+ eprintk("Ramdisk addr 0x%08x, ", ram);149143 if (fdt)150150- early_printk("FDT at 0x%08x\n", fdt);144144+ eprintk("FDT at 0x%08x\n", fdt);151145 else152152- early_printk("Compiled-in FDT at 0x%08x\n",146146+ eprintk("Compiled-in FDT at 0x%08x\n",153147 (unsigned int)_fdt_start);154148155149#ifdef CONFIG_MTD_UCLINUX156156- early_printk("Found romfs @ 0x%08x (0x%08x)\n",150150+ eprintk("Found romfs @ 0x%08x (0x%08x)\n",157151 romfs_base, romfs_size);158158- early_printk("#### klimit %p ####\n", old_klimit);152152+ eprintk("#### klimit %p ####\n", old_klimit);159153 BUG_ON(romfs_size < 0); /* What else can we do? */160154161161- early_printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n",155155+ eprintk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n",162156 romfs_size, romfs_base, (unsigned)&_ebss);163157164164- early_printk("New klimit: 0x%08x\n", (unsigned)klimit);158158+ eprintk("New klimit: 0x%08x\n", (unsigned)klimit);165159#endif166160167161#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR168162 if (msr)169169- early_printk("!!!Your kernel has setup MSR instruction but "163163+ eprintk("!!!Your kernel has setup MSR instruction but "170164 "CPU don't have it %d\n", msr);171165#else172166 if (!msr)173173- early_printk("!!!Your kernel not setup MSR instruction but "167167+ eprintk("!!!Your kernel not setup MSR instruction but "174168 "CPU have it %d\n", msr);175169#endif176170
+2-4
arch/microblaze/kernel/traps.c
···2222 __enable_hw_exceptions();2323}24242525-static int kstack_depth_to_print = 24;2525+static unsigned long kstack_depth_to_print = 24;26262727static int __init kstack_setup(char *s)2828{2929- kstack_depth_to_print = strict_strtoul(s, 0, NULL);3030-3131- return 1;2929+ return !strict_strtoul(s, 0, &kstack_depth_to_print);3230}3331__setup("kstack=", kstack_setup);3432
···5353 const uint32_t *i_src;5454 uint32_t *i_dst;55555656- if (c >= 4) {5656+ if (likely(c >= 4)) {5757 unsigned value, buf_hold;58585959 /* Align the dstination to a word boundry. */
+8-7
arch/microblaze/lib/memset.c
···3333#ifdef __HAVE_ARCH_MEMSET3434void *memset(void *v_src, int c, __kernel_size_t n)3535{3636-3736 char *src = v_src;3837#ifdef CONFIG_OPT_LIB_FUNCTION3938 uint32_t *i_src;4040- uint32_t w32;3939+ uint32_t w32 = 0;4140#endif4241 /* Truncate c to 8 bits */4342 c = (c & 0xFF);44434544#ifdef CONFIG_OPT_LIB_FUNCTION4646- /* Make a repeating word out of it */4747- w32 = c;4848- w32 |= w32 << 8;4949- w32 |= w32 << 16;4545+ if (unlikely(c)) {4646+ /* Make a repeating word out of it */4747+ w32 = c;4848+ w32 |= w32 << 8;4949+ w32 |= w32 << 16;5050+ }50515151- if (n >= 4) {5252+ if (likely(n >= 4)) {5253 /* Align the destination to a word boundary */5354 /* This is done in an endian independant manner */5455 switch ((unsigned) src & 3) {
-48
arch/microblaze/lib/uaccess.c
···11-/*22- * Copyright (C) 2006 Atmark Techno, Inc.33- *44- * This file is subject to the terms and conditions of the GNU General Public55- * License. See the file "COPYING" in the main directory of this archive66- * for more details.77- */88-99-#include <linux/string.h>1010-#include <asm/uaccess.h>1111-1212-#include <asm/bug.h>1313-1414-long strnlen_user(const char __user *src, long count)1515-{1616- return strlen(src) + 1;1717-}1818-1919-#define __do_strncpy_from_user(dst, src, count, res) \2020- do { \2121- char *tmp; \2222- strncpy(dst, src, count); \2323- for (tmp = dst; *tmp && count > 0; tmp++, count--) \2424- ; \2525- res = (tmp - dst); \2626- } while (0)2727-2828-long __strncpy_from_user(char *dst, const char __user *src, long count)2929-{3030- long res;3131- __do_strncpy_from_user(dst, src, count, res);3232- return res;3333-}3434-3535-long strncpy_from_user(char *dst, const char __user *src, long count)3636-{3737- long res = -EFAULT;3838- if (access_ok(VERIFY_READ, src, 1))3939- __do_strncpy_from_user(dst, src, count, res);4040- return res;4141-}4242-4343-unsigned long __copy_tofrom_user(void __user *to,4444- const void __user *from, unsigned long size)4545-{4646- memcpy(to, from, size);4747- return 0;4848-}
···106106 regs->esr = error_code;107107108108 /* On a kernel SLB miss we can only check for a valid exception entry */109109- if (kernel_mode(regs) && (address >= TASK_SIZE)) {109109+ if (unlikely(kernel_mode(regs) && (address >= TASK_SIZE))) {110110 printk(KERN_WARNING "kernel task_size exceed");111111 _exception(SIGSEGV, regs, code, address);112112 }···122122 }123123#endif /* CONFIG_KGDB */124124125125- if (in_atomic() || !mm) {125125+ if (unlikely(in_atomic() || !mm)) {126126 if (kernel_mode(regs))127127 goto bad_area_nosemaphore;128128···150150 * source. If this is invalid we can skip the address space check,151151 * thus avoiding the deadlock.152152 */153153- if (!down_read_trylock(&mm->mmap_sem)) {153153+ if (unlikely(!down_read_trylock(&mm->mmap_sem))) {154154 if (kernel_mode(regs) && !search_exception_tables(regs->pc))155155 goto bad_area_nosemaphore;156156···158158 }159159160160 vma = find_vma(mm, address);161161- if (!vma)161161+ if (unlikely(!vma))162162 goto bad_area;163163164164 if (vma->vm_start <= address)165165 goto good_area;166166167167- if (!(vma->vm_flags & VM_GROWSDOWN))167167+ if (unlikely(!(vma->vm_flags & VM_GROWSDOWN)))168168 goto bad_area;169169170170- if (!is_write)170170+ if (unlikely(!is_write))171171 goto bad_area;172172173173 /*···179179 * before setting the user r1. Thus we allow the stack to180180 * expand to 1MB without further checks.181181 */182182- if (address + 0x100000 < vma->vm_end) {182182+ if (unlikely(address + 0x100000 < vma->vm_end)) {183183184184 /* get user regs even if this fault is in kernel mode */185185 struct pt_regs *uregs = current->thread.regs;···209209 code = SEGV_ACCERR;210210211211 /* a write */212212- if (is_write) {213213- if (!(vma->vm_flags & VM_WRITE))212212+ if (unlikely(is_write)) {213213+ if (unlikely(!(vma->vm_flags & VM_WRITE)))214214 goto bad_area;215215 /* a read */216216 } else {217217 /* protection fault */218218- if (error_code & 0x08000000)218218+ if (unlikely(error_code & 0x08000000))219219 goto bad_area;220220- if (!(vma->vm_flags & (VM_READ | VM_EXEC)))220220+ if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC))))221221 goto bad_area;222222 }223223···235235 goto do_sigbus;236236 BUG();237237 }238238- if (fault & VM_FAULT_MAJOR)238238+ if (unlikely(fault & VM_FAULT_MAJOR))239239 current->maj_flt++;240240 else241241 current->min_flt++;
-9
arch/microblaze/mm/init.c
···166166 for (addr = begin; addr < end; addr += PAGE_SIZE) {167167 ClearPageReserved(virt_to_page(addr));168168 init_page_count(virt_to_page(addr));169169- memset((void *)addr, 0xcc, PAGE_SIZE);170169 free_page(addr);171170 totalram_pages++;172171 }···208209}209210210211#ifndef CONFIG_MMU211211-/* Check against bounds of physical memory */212212-int ___range_ok(unsigned long addr, unsigned long size)213213-{214214- return ((addr < memory_start) ||215215- ((addr + size) > memory_end));216216-}217217-EXPORT_SYMBOL(___range_ok);218218-219212int page_is_ram(unsigned long pfn)220213{221214 return __range_ok(pfn, 0);
+1-1
arch/microblaze/mm/pgtable.c
···154154 err = 0;155155 set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT,156156 __pgprot(flags)));157157- if (mem_init_done)157157+ if (unlikely(mem_init_done))158158 flush_HPTE(0, va, pmd_val(*pd));159159 /* flush_HPTE(0, va, pg); */160160 }
-2
arch/powerpc/kernel/misc.S
···128128 /* place holder */129129 blr130130131131-#ifdef CONFIG_EVENT_TRACING132131/*133132 * Get a minimal set of registers for our caller's nth caller.134133 * r3 = regs pointer, r5 = n.···153154 PPC_STL r4,_NIP-STACK_FRAME_OVERHEAD(r3)154155 PPC_STL r7,_LINK-STACK_FRAME_OVERHEAD(r3)155156 blr156156-#endif /* CONFIG_EVENT_TRACING */
+2
arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
···481481 if (rc)482482 goto err_bcom_rx_irq;483483484484+ lpbfifo.dma_irqs_enabled = 1;485485+484486 /* Request the Bestcomm transmit (memory --> fifo) task and IRQ */485487 lpbfifo.bcom_tx_task =486488 bcom_gen_bd_tx_init(2, res.start + LPBFIFO_REG_FIFO_DATA,
+190-46
arch/sh/configs/ecovec24_defconfig
···11#22# Automatically generated make config: don't edit33-# Linux kernel version: 2.6.33-rc244-# Mon Jan 4 11:20:36 201033+# Linux kernel version: 2.6.34-rc244+# Mon Mar 29 02:21:58 201055#66CONFIG_SUPERH=y77CONFIG_SUPERH32=y···1313CONFIG_GENERIC_HWEIGHT=y1414CONFIG_GENERIC_HARDIRQS=y1515CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y1616-CONFIG_GENERIC_IRQ_PROBE=y1716CONFIG_IRQ_PER_CPU=y1717+CONFIG_SPARSE_IRQ=y1818CONFIG_GENERIC_GPIO=y1919CONFIG_GENERIC_TIME=y2020CONFIG_GENERIC_CLOCKEVENTS=y···3232CONFIG_ARCH_HAS_DEFAULT_IDLE=y3333CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y3434CONFIG_DMA_NONCOHERENT=y3535+CONFIG_NEED_DMA_MAP_STATE=y3536CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"3637CONFIG_CONSTRUCTORS=y3738···4847CONFIG_HAVE_KERNEL_GZIP=y4948CONFIG_HAVE_KERNEL_BZIP2=y5049CONFIG_HAVE_KERNEL_LZMA=y5050+CONFIG_HAVE_KERNEL_LZO=y5151CONFIG_KERNEL_GZIP=y5252# CONFIG_KERNEL_BZIP2 is not set5353# CONFIG_KERNEL_LZMA is not set5454+# CONFIG_KERNEL_LZO is not set5455CONFIG_SWAP=y5556CONFIG_SYSVIPC=y5657CONFIG_SYSVIPC_SYSCTL=y···7471# CONFIG_TREE_RCU_TRACE is not set7572# CONFIG_IKCONFIG is not set7673CONFIG_LOG_BUF_SHIFT=147777-CONFIG_GROUP_SCHED=y7878-CONFIG_FAIR_GROUP_SCHED=y7979-# CONFIG_RT_GROUP_SCHED is not set8080-CONFIG_USER_SCHED=y8181-# CONFIG_CGROUP_SCHED is not set8274# CONFIG_CGROUPS is not set8383-CONFIG_SYSFS_DEPRECATED=y8484-CONFIG_SYSFS_DEPRECATED_V2=y7575+# CONFIG_SYSFS_DEPRECATED_V2 is not set8576# CONFIG_RELAY is not set8677# CONFIG_NAMESPACES is not set8778# CONFIG_BLK_DEV_INITRD is not set···104107#105108# Kernel Performance Events And Counters106109#107107-# CONFIG_PERF_EVENTS is not set110110+CONFIG_PERF_EVENTS=y108111# CONFIG_PERF_COUNTERS is not set109112CONFIG_VM_EVENT_COUNTERS=y110113CONFIG_COMPAT_BRK=y···113116# CONFIG_SLOB is not set114117# CONFIG_PROFILING is not set115118CONFIG_HAVE_OPROFILE=y116116-CONFIG_HAVE_IOREMAP_PROT=y117119CONFIG_HAVE_KPROBES=y118120CONFIG_HAVE_KRETPROBES=y119121CONFIG_HAVE_ARCH_TRACEHOOK=y120122CONFIG_HAVE_DMA_ATTRS=y121123CONFIG_HAVE_CLK=y122124CONFIG_HAVE_DMA_API_DEBUG=y125125+CONFIG_HAVE_HW_BREAKPOINT=y123126124127#125128# GCOV-based kernel profiling···231234CONFIG_QUICKLIST=y232235CONFIG_MMU=y233236CONFIG_PAGE_OFFSET=0x80000000234234-CONFIG_FORCE_MAX_ZONEORDER=11237237+CONFIG_FORCE_MAX_ZONEORDER=12235238CONFIG_MEMORY_START=0x08000000236239CONFIG_MEMORY_SIZE=0x10000000237240CONFIG_29BIT=y238238-# CONFIG_PMB_ENABLE is not set239239-# CONFIG_X2TLB is not set241241+# CONFIG_PMB is not set242242+CONFIG_X2TLB=y240243CONFIG_VSYSCALL=y241244CONFIG_ARCH_FLATMEM_ENABLE=y242245CONFIG_ARCH_SPARSEMEM_ENABLE=y···244247CONFIG_MAX_ACTIVE_REGIONS=1245248CONFIG_ARCH_POPULATES_NODE_MAP=y246249CONFIG_ARCH_SELECT_MEMORY_MODEL=y250250+CONFIG_IOREMAP_FIXED=y251251+CONFIG_UNCACHED_MAPPING=y247252CONFIG_PAGE_SIZE_4KB=y248253# CONFIG_PAGE_SIZE_8KB is not set249254# CONFIG_PAGE_SIZE_16KB is not set···261262CONFIG_SPLIT_PTLOCK_CPUS=4262263# CONFIG_PHYS_ADDR_T_64BIT is not set263264CONFIG_ZONE_DMA_FLAG=0264264-CONFIG_NR_QUICK=2265265+CONFIG_NR_QUICK=1265266# CONFIG_KSM is not set266267CONFIG_DEFAULT_MMAP_MIN_ADDR=4096267268···336337# CONFIG_PREEMPT_VOLUNTARY is not set337338CONFIG_PREEMPT=y338339CONFIG_GUSA=y339339-# CONFIG_SPARSE_IRQ is not set340340341341#342342# Boot options···345347CONFIG_ENTRY_OFFSET=0x00001000346348CONFIG_CMDLINE_OVERWRITE=y347349# CONFIG_CMDLINE_EXTEND is not set348348-CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=120M memchunk.vpu=4m"350350+CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=248M memchunk.vpu=8m memchunk.veu0=4m"349351350352#351353# Bus options···371373CONFIG_SUSPEND_FREEZER=y372374# CONFIG_HIBERNATION is not set373375CONFIG_PM_RUNTIME=y376376+CONFIG_PM_OPS=y374377# CONFIG_CPU_IDLE is not set375378CONFIG_NET=y376379···379380# Networking options380381#381382CONFIG_PACKET=y382382-# CONFIG_PACKET_MMAP is not set383383CONFIG_UNIX=y384384# CONFIG_NET_KEY is not set385385CONFIG_INET=y···443445# CONFIG_NET_PKTGEN is not set444446# CONFIG_HAMRADIO is not set445447# CONFIG_CAN is not set446446-# CONFIG_IRDA is not set448448+CONFIG_IRDA=y449449+450450+#451451+# IrDA protocols452452+#453453+# CONFIG_IRLAN is not set454454+# CONFIG_IRCOMM is not set455455+# CONFIG_IRDA_ULTRA is not set456456+457457+#458458+# IrDA options459459+#460460+# CONFIG_IRDA_CACHE_LAST_LSAP is not set461461+# CONFIG_IRDA_FAST_RR is not set462462+# CONFIG_IRDA_DEBUG is not set463463+464464+#465465+# Infrared-port device drivers466466+#467467+468468+#469469+# SIR device drivers470470+#471471+# CONFIG_IRTTY_SIR is not set472472+473473+#474474+# Dongle support475475+#476476+CONFIG_SH_SIR=y477477+# CONFIG_KINGSUN_DONGLE is not set478478+# CONFIG_KSDAZZLE_DONGLE is not set479479+# CONFIG_KS959_DONGLE is not set480480+481481+#482482+# FIR device drivers483483+#484484+# CONFIG_USB_IRDA is not set485485+# CONFIG_SIGMATEL_FIR is not set486486+# CONFIG_MCS_FIR is not set447487# CONFIG_BT is not set448488# CONFIG_AF_RXRPC is not set449489CONFIG_WIRELESS=y···592556# CONFIG_MTD_NAND_NANDSIM is not set593557# CONFIG_MTD_NAND_PLATFORM is not set594558# CONFIG_MTD_ALAUDA is not set559559+# CONFIG_MTD_NAND_SH_FLCTL is not set595560# CONFIG_MTD_ONENAND is not set596561597562#···634597# CONFIG_ICS932S401 is not set635598# CONFIG_ENCLOSURE_SERVICES is not set636599# CONFIG_ISL29003 is not set600600+# CONFIG_SENSORS_TSL2550 is not set637601# CONFIG_DS1682 is not set638602# CONFIG_TI_DAC7512 is not set639603# CONFIG_C2PORT is not set···654616#655617# SCSI device support656618#619619+CONFIG_SCSI_MOD=y657620# CONFIG_RAID_ATTRS is not set658621CONFIG_SCSI=y659622CONFIG_SCSI_DMA=y···807768# CONFIG_INPUT_MOUSE is not set808769# CONFIG_INPUT_JOYSTICK is not set809770# CONFIG_INPUT_TABLET is not set810810-# CONFIG_INPUT_TOUCHSCREEN is not set771771+CONFIG_INPUT_TOUCHSCREEN=y772772+# CONFIG_TOUCHSCREEN_ADS7846 is not set773773+# CONFIG_TOUCHSCREEN_AD7877 is not set774774+# CONFIG_TOUCHSCREEN_AD7879_I2C is not set775775+# CONFIG_TOUCHSCREEN_AD7879_SPI is not set776776+# CONFIG_TOUCHSCREEN_AD7879 is not set777777+# CONFIG_TOUCHSCREEN_DYNAPRO is not set778778+# CONFIG_TOUCHSCREEN_EETI is not set779779+# CONFIG_TOUCHSCREEN_FUJITSU is not set780780+# CONFIG_TOUCHSCREEN_GUNZE is not set781781+# CONFIG_TOUCHSCREEN_ELO is not set782782+# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set783783+# CONFIG_TOUCHSCREEN_MCS5000 is not set784784+# CONFIG_TOUCHSCREEN_MTOUCH is not set785785+# CONFIG_TOUCHSCREEN_INEXIO is not set786786+# CONFIG_TOUCHSCREEN_MK712 is not set787787+# CONFIG_TOUCHSCREEN_PENMOUNT is not set788788+# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set789789+# CONFIG_TOUCHSCREEN_TOUCHWIN is not set790790+# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set791791+# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set792792+CONFIG_TOUCHSCREEN_TSC2007=y793793+# CONFIG_TOUCHSCREEN_W90X900 is not set811794# CONFIG_INPUT_MISC is not set812795813796#···863802CONFIG_SERIAL_SH_SCI_CONSOLE=y864803CONFIG_SERIAL_CORE=y865804CONFIG_SERIAL_CORE_CONSOLE=y805805+# CONFIG_SERIAL_TIMBERDALE is not set866806CONFIG_UNIX98_PTYS=y867807# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set868868-CONFIG_LEGACY_PTYS=y869869-CONFIG_LEGACY_PTY_COUNT=256808808+# CONFIG_LEGACY_PTYS is not set870809# CONFIG_IPMI_HANDLER is not set871810CONFIG_HW_RANDOM=y872811# CONFIG_HW_RANDOM_TIMERIOMEM is not set···891830# CONFIG_I2C_OCORES is not set892831CONFIG_I2C_SH_MOBILE=y893832# CONFIG_I2C_SIMTEC is not set833833+# CONFIG_I2C_XILINX is not set894834895835#896836# External I2C/SMBus adapter drivers···905843#906844# CONFIG_I2C_PCA_PLATFORM is not set907845# CONFIG_I2C_STUB is not set908908-909909-#910910-# Miscellaneous I2C Chip support911911-#912912-# CONFIG_SENSORS_TSL2550 is not set913846# CONFIG_I2C_DEBUG_CORE is not set914847# CONFIG_I2C_DEBUG_ALGO is not set915848# CONFIG_I2C_DEBUG_BUS is not set916916-# CONFIG_I2C_DEBUG_CHIP is not set917849CONFIG_SPI=y918850CONFIG_SPI_MASTER=y919851···938882#939883# Memory mapped GPIO expanders:940884#885885+# CONFIG_GPIO_IT8761E is not set941886942887#943888# I2C GPIO expanders:944889#890890+# CONFIG_GPIO_MAX7300 is not set945891# CONFIG_GPIO_MAX732X is not set946892# CONFIG_GPIO_PCA953X is not set947893# CONFIG_GPIO_PCF857X is not set894894+# CONFIG_GPIO_ADP5588 is not set948895949896#950897# PCI GPIO expanders:···978919#979920# Multifunction device drivers980921#981981-# CONFIG_MFD_CORE is not set922922+CONFIG_MFD_CORE=y923923+# CONFIG_MFD_88PM860X is not set982924# CONFIG_MFD_SM501 is not set983983-# CONFIG_MFD_SH_MOBILE_SDHI is not set925925+CONFIG_MFD_SH_MOBILE_SDHI=y984926# CONFIG_HTC_PASIC3 is not set927927+# CONFIG_HTC_I2CPLD is not set985928# CONFIG_TPS65010 is not set986929# CONFIG_TWL4030_CORE is not set987930# CONFIG_MFD_TMIO is not set988931# CONFIG_PMIC_DA903X is not set989932# CONFIG_PMIC_ADP5520 is not set933933+# CONFIG_MFD_MAX8925 is not set990934# CONFIG_MFD_WM8400 is not set991935# CONFIG_MFD_WM831X is not set992936# CONFIG_MFD_WM8350_I2C is not set937937+# CONFIG_MFD_WM8994 is not set993938# CONFIG_MFD_PCF50633 is not set994939# CONFIG_MFD_MC13783 is not set995940# CONFIG_AB3100_CORE is not set996941# CONFIG_EZX_PCAP is not set997997-# CONFIG_MFD_88PM8607 is not set998942# CONFIG_AB4500_CORE is not set999943# CONFIG_REGULATOR is not set1000944CONFIG_MEDIA_SUPPORT=y···1047985# CONFIG_SOC_CAMERA_MT9M001 is not set1048986# CONFIG_SOC_CAMERA_MT9M111 is not set1049987# CONFIG_SOC_CAMERA_MT9T031 is not set10501050-# CONFIG_SOC_CAMERA_MT9T112 is not set988988+CONFIG_SOC_CAMERA_MT9T112=y1051989# CONFIG_SOC_CAMERA_MT9V022 is not set1052990# CONFIG_SOC_CAMERA_RJ54N1 is not set10531053-# CONFIG_SOC_CAMERA_TW9910 is not set991991+CONFIG_SOC_CAMERA_TW9910=y1054992# CONFIG_SOC_CAMERA_PLATFORM is not set1055993# CONFIG_SOC_CAMERA_OV772X is not set1056994# CONFIG_SOC_CAMERA_OV9640 is not set···10631001# CONFIG_RADIO_SI470X is not set10641002# CONFIG_USB_MR800 is not set10651003# CONFIG_RADIO_TEA5764 is not set10041004+# CONFIG_RADIO_SAA7706H is not set10661005# CONFIG_RADIO_TEF6862 is not set10671006# CONFIG_DAB is not set10681007···10971034#10981035# CONFIG_FB_S1D13XXX is not set10991036CONFIG_FB_SH_MOBILE_LCDC=y10371037+# CONFIG_FB_TMIO is not set11001038# CONFIG_FB_VIRTUAL is not set11011039# CONFIG_FB_METRONOME is not set11021040# CONFIG_FB_MB862XX is not set···11261062# CONFIG_LOGO_SUPERH_MONO is not set11271063# CONFIG_LOGO_SUPERH_VGA16 is not set11281064CONFIG_LOGO_SUPERH_CLUT224=y11291129-# CONFIG_SOUND is not set10651065+CONFIG_SOUND=y10661066+CONFIG_SOUND_OSS_CORE=y10671067+CONFIG_SOUND_OSS_CORE_PRECLAIM=y10681068+CONFIG_SND=y10691069+CONFIG_SND_TIMER=y10701070+CONFIG_SND_PCM=y10711071+CONFIG_SND_JACK=y10721072+CONFIG_SND_SEQUENCER=y10731073+CONFIG_SND_SEQ_DUMMY=y10741074+CONFIG_SND_OSSEMUL=y10751075+CONFIG_SND_MIXER_OSS=y10761076+CONFIG_SND_PCM_OSS=y10771077+CONFIG_SND_PCM_OSS_PLUGINS=y10781078+# CONFIG_SND_SEQUENCER_OSS is not set10791079+# CONFIG_SND_DYNAMIC_MINORS is not set10801080+CONFIG_SND_SUPPORT_OLD_API=y10811081+CONFIG_SND_VERBOSE_PROCFS=y10821082+# CONFIG_SND_VERBOSE_PRINTK is not set10831083+# CONFIG_SND_DEBUG is not set10841084+# CONFIG_SND_RAWMIDI_SEQ is not set10851085+# CONFIG_SND_OPL3_LIB_SEQ is not set10861086+# CONFIG_SND_OPL4_LIB_SEQ is not set10871087+# CONFIG_SND_SBAWE_SEQ is not set10881088+# CONFIG_SND_EMU10K1_SEQ is not set10891089+# CONFIG_SND_DRIVERS is not set10901090+# CONFIG_SND_SPI is not set10911091+CONFIG_SND_SUPERH=y10921092+# CONFIG_SND_USB is not set10931093+CONFIG_SND_SOC=y10941094+10951095+#10961096+# SoC Audio support for SuperH10971097+#10981098+CONFIG_SND_SOC_SH4_FSI=y10991099+# CONFIG_SND_FSI_AK4642 is not set11001100+CONFIG_SND_FSI_DA7210=y11011101+CONFIG_SND_SOC_I2C_AND_SPI=y11021102+# CONFIG_SND_SOC_ALL_CODECS is not set11031103+CONFIG_SND_SOC_DA7210=y11041104+# CONFIG_SOUND_PRIME is not set11301105CONFIG_HID_SUPPORT=y11311106CONFIG_HID=y11321107# CONFIG_HIDRAW is not set···11801077#11811078# Special HID drivers11821079#10801080+# CONFIG_HID_3M_PCT is not set11831081# CONFIG_HID_A4TECH is not set11841082# CONFIG_HID_APPLE is not set11851083# CONFIG_HID_BELKIN is not set···11951091# CONFIG_HID_KENSINGTON is not set11961092# CONFIG_HID_LOGITECH is not set11971093# CONFIG_HID_MICROSOFT is not set10941094+# CONFIG_HID_MOSART is not set11981095# CONFIG_HID_MONTEREY is not set11991096# CONFIG_HID_NTRIG is not set10971097+# CONFIG_HID_ORTEK is not set12001098# CONFIG_HID_PANTHERLORD is not set12011099# CONFIG_HID_PETALYNX is not set11001100+# CONFIG_HID_QUANTA is not set12021101# CONFIG_HID_SAMSUNG is not set12031102# CONFIG_HID_SONY is not set11031103+# CONFIG_HID_STANTUM is not set12041104# CONFIG_HID_SUNPLUS is not set12051105# CONFIG_HID_GREENASIA is not set12061106# CONFIG_HID_SMARTJOYPLUS is not set···12441136# CONFIG_USB_SL811_HCD is not set12451137CONFIG_USB_R8A66597_HCD=y12461138# CONFIG_USB_HWA_HCD is not set11391139+# CONFIG_USB_GADGET_MUSB_HDRC is not set1247114012481141#12491142# USB Device Class drivers···12971188# CONFIG_USB_RIO500 is not set12981189# CONFIG_USB_LEGOTOWER is not set12991190# CONFIG_USB_LCD is not set13001300-# CONFIG_USB_BERRY_CHARGE is not set13011191# CONFIG_USB_LED is not set13021192# CONFIG_USB_CYPRESS_CY7C63 is not set13031193# CONFIG_USB_CYTHERM is not set···13081200# CONFIG_USB_IOWARRIOR is not set13091201# CONFIG_USB_TEST is not set13101202# CONFIG_USB_ISIGHTFW is not set13111311-# CONFIG_USB_VST is not set13121312-# CONFIG_USB_GADGET is not set12031203+CONFIG_USB_GADGET=y12041204+# CONFIG_USB_GADGET_DEBUG_FILES is not set12051205+# CONFIG_USB_GADGET_DEBUG_FS is not set12061206+CONFIG_USB_GADGET_VBUS_DRAW=212071207+CONFIG_USB_GADGET_SELECTED=y12081208+# CONFIG_USB_GADGET_AT91 is not set12091209+# CONFIG_USB_GADGET_ATMEL_USBA is not set12101210+# CONFIG_USB_GADGET_FSL_USB2 is not set12111211+# CONFIG_USB_GADGET_LH7A40X is not set12121212+# CONFIG_USB_GADGET_OMAP is not set12131213+# CONFIG_USB_GADGET_PXA25X is not set12141214+CONFIG_USB_GADGET_R8A66597=y12151215+CONFIG_USB_R8A66597=y12161216+# CONFIG_USB_GADGET_PXA27X is not set12171217+# CONFIG_USB_GADGET_S3C_HSOTG is not set12181218+# CONFIG_USB_GADGET_IMX is not set12191219+# CONFIG_USB_GADGET_S3C2410 is not set12201220+# CONFIG_USB_GADGET_M66592 is not set12211221+# CONFIG_USB_GADGET_AMD5536UDC is not set12221222+# CONFIG_USB_GADGET_FSL_QE is not set12231223+# CONFIG_USB_GADGET_CI13XXX is not set12241224+# CONFIG_USB_GADGET_NET2280 is not set12251225+# CONFIG_USB_GADGET_GOKU is not set12261226+# CONFIG_USB_GADGET_LANGWELL is not set12271227+# CONFIG_USB_GADGET_DUMMY_HCD is not set12281228+CONFIG_USB_GADGET_DUALSPEED=y12291229+# CONFIG_USB_ZERO is not set12301230+# CONFIG_USB_AUDIO is not set12311231+# CONFIG_USB_ETH is not set12321232+# CONFIG_USB_GADGETFS is not set12331233+CONFIG_USB_FILE_STORAGE=m12341234+# CONFIG_USB_FILE_STORAGE_TEST is not set12351235+# CONFIG_USB_MASS_STORAGE is not set12361236+# CONFIG_USB_G_SERIAL is not set12371237+# CONFIG_USB_MIDI_GADGET is not set12381238+# CONFIG_USB_G_PRINTER is not set12391239+# CONFIG_USB_CDC_COMPOSITE is not set12401240+# CONFIG_USB_G_NOKIA is not set12411241+# CONFIG_USB_G_MULTI is not set1313124213141243#13151244# OTG and related infrastructure···13691224# MMC/SD/SDIO Host Controller Drivers13701225#13711226# CONFIG_MMC_SDHCI is not set13721372-# CONFIG_MMC_AT91 is not set13731373-# CONFIG_MMC_ATMELMCI is not set13741227CONFIG_MMC_SPI=y13751375-# CONFIG_MMC_TMIO is not set12281228+CONFIG_MMC_TMIO=y13761229# CONFIG_MEMSTICK is not set13771230# CONFIG_NEW_LEDS is not set13781231# CONFIG_ACCESSIBILITY is not set···13961253# CONFIG_RTC_DRV_DS1374 is not set13971254# CONFIG_RTC_DRV_DS1672 is not set13981255# CONFIG_RTC_DRV_MAX6900 is not set13991399-# CONFIG_RTC_DRV_RS5C372 is not set12561256+CONFIG_RTC_DRV_RS5C372=y14001257# CONFIG_RTC_DRV_ISL1208 is not set14011258# CONFIG_RTC_DRV_X1205 is not set14021402-CONFIG_RTC_DRV_PCF8563=y12591259+# CONFIG_RTC_DRV_PCF8563 is not set14031260# CONFIG_RTC_DRV_PCF8583 is not set14041261# CONFIG_RTC_DRV_M41T80 is not set14051262# CONFIG_RTC_DRV_BQ32K is not set···14461303CONFIG_UIO=y14471304# CONFIG_UIO_PDRV is not set14481305CONFIG_UIO_PDRV_GENIRQ=y14491449-# CONFIG_UIO_SMX is not set14501450-# CONFIG_UIO_SERCOS3 is not set1451130614521307#14531308# TI VLYNQ···15311390# CONFIG_EFS_FS is not set15321391# CONFIG_JFFS2_FS is not set15331392# CONFIG_UBIFS_FS is not set13931393+# CONFIG_LOGFS is not set15341394# CONFIG_CRAMFS is not set15351395# CONFIG_SQUASHFS is not set15361396# CONFIG_VXFS_FS is not set···15601418# CONFIG_RPCSEC_GSS_KRB5 is not set15611419# CONFIG_RPCSEC_GSS_SPKM3 is not set15621420# CONFIG_SMB_FS is not set14211421+# CONFIG_CEPH_FS is not set15631422# CONFIG_CIFS is not set15641423# CONFIG_NCP_FS is not set15651424# CONFIG_CODA_FS is not set···16301487CONFIG_DEBUG_BUGVERBOSE=y16311488# CONFIG_DEBUG_MEMORY_INIT is not set16321489# CONFIG_RCU_CPU_STALL_DETECTOR is not set14901490+# CONFIG_LKDTM is not set16331491# CONFIG_LATENCYTOP is not set16341492CONFIG_SYSCTL_SYSCALL_CHECK=y16351493CONFIG_HAVE_FUNCTION_TRACER=y···17621618#17631619CONFIG_BITREVERSE=y17641620CONFIG_GENERIC_FIND_LAST_BIT=y17651765-# CONFIG_CRC_CCITT is not set16211621+CONFIG_CRC_CCITT=y17661622# CONFIG_CRC16 is not set17671623CONFIG_CRC_T10DIF=y17681624CONFIG_CRC_ITU_T=y
···99 * for more details.1010 */1111#include <linux/kernel.h>1212+#include <linux/module.h>1213#include <asm/dwarf.h>13141415#ifdef CONFIG_DWARF_UNWINDER···5352}54535554#endif5555+5656+EXPORT_SYMBOL_GPL(return_address);
···7777 __raw_writel(asid, MMU_ITLB_ADDRESS_ARRAY2 | MMU_PAGE_ASSOC_BIT);7878 back_to_cached();7979}8080+8181+void local_flush_tlb_all(void)8282+{8383+ unsigned long flags, status;8484+ int i;8585+8686+ /*8787+ * Flush all the TLB.8888+ */8989+ local_irq_save(flags);9090+ jump_to_uncached();9191+9292+ status = __raw_readl(MMUCR);9393+ status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT);9494+9595+ if (status == 0)9696+ status = MMUCR_URB_NENTRIES;9797+9898+ for (i = 0; i < status; i++)9999+ __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8));100100+101101+ for (i = 0; i < 4; i++)102102+ __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8));103103+104104+ back_to_cached();105105+ ctrl_barrier();106106+ local_irq_restore(flags);107107+}
+19
arch/sh/mm/tlb-sh3.c
···7777 for (i = 0; i < ways; i++)7878 __raw_writel(data, addr + (i << 8));7979}8080+8181+void local_flush_tlb_all(void)8282+{8383+ unsigned long flags, status;8484+8585+ /*8686+ * Flush all the TLB.8787+ *8888+ * Write to the MMU control register's bit:8989+ * TF-bit for SH-3, TI-bit for SH-4.9090+ * It's same position, bit #2.9191+ */9292+ local_irq_save(flags);9393+ status = __raw_readl(MMUCR);9494+ status |= 0x04;9595+ __raw_writel(status, MMUCR);9696+ ctrl_barrier();9797+ local_irq_restore(flags);9898+}
+28
arch/sh/mm/tlb-sh4.c
···8080 __raw_writel(data, addr);8181 back_to_cached();8282}8383+8484+void local_flush_tlb_all(void)8585+{8686+ unsigned long flags, status;8787+ int i;8888+8989+ /*9090+ * Flush all the TLB.9191+ */9292+ local_irq_save(flags);9393+ jump_to_uncached();9494+9595+ status = __raw_readl(MMUCR);9696+ status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT);9797+9898+ if (status == 0)9999+ status = MMUCR_URB_NENTRIES;100100+101101+ for (i = 0; i < status; i++)102102+ __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8));103103+104104+ for (i = 0; i < 4; i++)105105+ __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8));106106+107107+ back_to_cached();108108+ ctrl_barrier();109109+ local_irq_restore(flags);110110+}
+17-5
arch/sh/mm/tlb-urb.c
···24242525 local_irq_save(flags);26262727- /* Load the entry into the TLB */2828- __update_tlb(vma, addr, pte);2929-3030- /* ... and wire it up. */3127 status = __raw_readl(MMUCR);3228 urb = (status & MMUCR_URB) >> MMUCR_URB_SHIFT;3333- status &= ~MMUCR_URB;2929+ status &= ~MMUCR_URC;34303531 /*3632 * Make sure we're not trying to wire the last TLB entry slot.···35393640 urb = urb % MMUCR_URB_NENTRIES;37414242+ /*4343+ * Insert this entry into the highest non-wired TLB slot (via4444+ * the URC field).4545+ */4646+ status |= (urb << MMUCR_URC_SHIFT);4747+ __raw_writel(status, MMUCR);4848+ ctrl_barrier();4949+5050+ /* Load the entry into the TLB */5151+ __update_tlb(vma, addr, pte);5252+5353+ /* ... and wire it up. */5454+ status = __raw_readl(MMUCR);5555+5656+ status &= ~MMUCR_URB;3857 status |= (urb << MMUCR_URB_SHIFT);5858+3959 __raw_writel(status, MMUCR);4060 ctrl_barrier();4161
-28
arch/sh/mm/tlbflush_32.c
···119119 local_irq_restore(flags);120120 }121121}122122-123123-void local_flush_tlb_all(void)124124-{125125- unsigned long flags, status;126126- int i;127127-128128- /*129129- * Flush all the TLB.130130- */131131- local_irq_save(flags);132132- jump_to_uncached();133133-134134- status = __raw_readl(MMUCR);135135- status = ((status & MMUCR_URB) >> MMUCR_URB_SHIFT);136136-137137- if (status == 0)138138- status = MMUCR_URB_NENTRIES;139139-140140- for (i = 0; i < status; i++)141141- __raw_writel(0x0, MMU_UTLB_ADDRESS_ARRAY | (i << 8));142142-143143- for (i = 0; i < 4; i++)144144- __raw_writel(0x0, MMU_ITLB_ADDRESS_ARRAY | (i << 8));145145-146146- back_to_cached();147147- ctrl_barrier();148148- local_irq_restore(flags);149149-}
+16-12
arch/sparc/configs/sparc64_defconfig
···11#22# Automatically generated make config: don't edit33-# Linux kernel version: 2.6.3344-# Wed Mar 3 02:54:29 201033+# Linux kernel version: 2.6.34-rc344+# Sat Apr 3 15:49:56 201055#66CONFIG_64BIT=y77CONFIG_SPARC=y···2323CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y2424CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y2525CONFIG_MMU=y2626+CONFIG_NEED_DMA_MAP_STATE=y2627CONFIG_ARCH_NO_VIRT_TO_BUS=y2728CONFIG_OF=y2829CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y···440439# CONFIG_ENCLOSURE_SERVICES is not set441440# CONFIG_HP_ILO is not set442441# CONFIG_ISL29003 is not set442442+# CONFIG_SENSORS_TSL2550 is not set443443# CONFIG_DS1682 is not set444444# CONFIG_C2PORT is not set445445···513511#514512# SCSI device support515513#514514+CONFIG_SCSI_MOD=y516515CONFIG_RAID_ATTRS=m517516CONFIG_SCSI=y518517CONFIG_SCSI_DMA=y···891888CONFIG_SERIAL_CORE=y892889CONFIG_SERIAL_CORE_CONSOLE=y893890# CONFIG_SERIAL_JSM is not set891891+# CONFIG_SERIAL_TIMBERDALE is not set894892# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set895893CONFIG_UNIX98_PTYS=y896894# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set···939935#940936# CONFIG_I2C_OCORES is not set941937# CONFIG_I2C_SIMTEC is not set938938+# CONFIG_I2C_XILINX is not set942939943940#944941# External I2C/SMBus adapter drivers···953948#954949# CONFIG_I2C_PCA_PLATFORM is not set955950# CONFIG_I2C_STUB is not set956956-957957-#958958-# Miscellaneous I2C Chip support959959-#960960-# CONFIG_SENSORS_TSL2550 is not set961951# CONFIG_I2C_DEBUG_CORE is not set962952# CONFIG_I2C_DEBUG_ALGO is not set963953# CONFIG_I2C_DEBUG_BUS is not set964964-# CONFIG_I2C_DEBUG_CHIP is not set965954# CONFIG_SPI is not set966955967956#···981982# CONFIG_SENSORS_ADM1029 is not set982983# CONFIG_SENSORS_ADM1031 is not set983984# CONFIG_SENSORS_ADM9240 is not set985985+# CONFIG_SENSORS_ADT7411 is not set984986# CONFIG_SENSORS_ADT7462 is not set985987# CONFIG_SENSORS_ADT7470 is not set986986-# CONFIG_SENSORS_ADT7473 is not set987988# CONFIG_SENSORS_ADT7475 is not set989989+# CONFIG_SENSORS_ASC7621 is not set988990# CONFIG_SENSORS_ATXP1 is not set989991# CONFIG_SENSORS_DS1621 is not set990992# CONFIG_SENSORS_I5K_AMB is not set···10521052# Multifunction device drivers10531053#10541054# CONFIG_MFD_CORE is not set10551055+# CONFIG_MFD_88PM860X is not set10551056# CONFIG_MFD_SM501 is not set10561057# CONFIG_HTC_PASIC3 is not set10571058# CONFIG_TWL4030_CORE is not set10581059# CONFIG_MFD_TMIO is not set10591060# CONFIG_PMIC_DA903X is not set10601061# CONFIG_PMIC_ADP5520 is not set10621062+# CONFIG_MFD_MAX8925 is not set10611063# CONFIG_MFD_WM8400 is not set10621064# CONFIG_MFD_WM831X is not set10631065# CONFIG_MFD_WM8350_I2C is not set10661066+# CONFIG_MFD_WM8994 is not set10641067# CONFIG_MFD_PCF50633 is not set10651068# CONFIG_AB3100_CORE is not set10661066-# CONFIG_MFD_88PM8607 is not set10691069+# CONFIG_LPC_SCH is not set10671070# CONFIG_REGULATOR is not set10681071# CONFIG_MEDIA_SUPPORT is not set10691072···11161113# CONFIG_FB_LEO is not set11171114CONFIG_FB_XVR500=y11181115CONFIG_FB_XVR2500=y11161116+CONFIG_FB_XVR1000=y11191117# CONFIG_FB_S1D13XXX is not set11201118# CONFIG_FB_NVIDIA is not set11211119# CONFIG_FB_RIVA is not set···14341430# CONFIG_USB_RIO500 is not set14351431# CONFIG_USB_LEGOTOWER is not set14361432# CONFIG_USB_LCD is not set14371437-# CONFIG_USB_BERRY_CHARGE is not set14381433# CONFIG_USB_LED is not set14391434# CONFIG_USB_CYPRESS_CY7C63 is not set14401435# CONFIG_USB_CYTHERM is not set···14461443# CONFIG_USB_IOWARRIOR is not set14471444# CONFIG_USB_TEST is not set14481445# CONFIG_USB_ISIGHTFW is not set14491449-# CONFIG_USB_VST is not set14501446# CONFIG_USB_GADGET is not set1451144714521448#···16121610# CONFIG_BEFS_FS is not set16131611# CONFIG_BFS_FS is not set16141612# CONFIG_EFS_FS is not set16131613+# CONFIG_LOGFS is not set16151614# CONFIG_CRAMFS is not set16161615# CONFIG_SQUASHFS is not set16171616# CONFIG_VXFS_FS is not set···16271624# CONFIG_NFS_FS is not set16281625# CONFIG_NFSD is not set16291626# CONFIG_SMB_FS is not set16271627+# CONFIG_CEPH_FS is not set16301628# CONFIG_CIFS is not set16311629# CONFIG_NCP_FS is not set16321630# CONFIG_CODA_FS is not set
+75
arch/sparc/kernel/helpers.S
···4646 nop4747 .size stack_trace_flush,.-stack_trace_flush48484949+#ifdef CONFIG_PERF_EVENTS5050+ .globl perf_arch_fetch_caller_regs5151+ .type perf_arch_fetch_caller_regs,#function5252+perf_arch_fetch_caller_regs:5353+ /* We always read the %pstate into %o5 since we will use5454+ * that to construct a fake %tstate to store into the regs.5555+ */5656+ rdpr %pstate, %o55757+ brz,pn %o2, 50f5858+ mov %o2, %g75959+6060+ /* Turn off interrupts while we walk around the register6161+ * window by hand.6262+ */6363+ wrpr %o5, PSTATE_IE, %pstate6464+6565+ /* The %canrestore tells us how many register windows are6666+ * still live in the chip above us, past that we have to6767+ * walk the frame as saved on the stack. We stash away6868+ * the %cwp in %g1 so we can return back to the original6969+ * register window.7070+ */7171+ rdpr %cwp, %g17272+ rdpr %canrestore, %g27373+ sub %g1, 1, %g37474+7575+ /* We have the skip count in %g7, if it hits zero then7676+ * %fp/%i7 are the registers we need. Otherwise if our7777+ * %canrestore count maintained in %g2 hits zero we have7878+ * to start traversing the stack.7979+ */8080+10: brz,pn %g2, 4f8181+ sub %g2, 1, %g28282+ wrpr %g3, %cwp8383+ subcc %g7, 1, %g78484+ bne,pt %xcc, 10b8585+ sub %g3, 1, %g38686+8787+ /* We found the values we need in the cpu's register8888+ * windows.8989+ */9090+ mov %fp, %g39191+ ba,pt %xcc, 3f9292+ mov %i7, %g29393+9494+50: mov %fp, %g39595+ ba,pt %xcc, 2f9696+ mov %i7, %g29797+9898+ /* We hit the end of the valid register windows in the9999+ * cpu, start traversing the stack frame.100100+ */101101+4: mov %fp, %g3102102+103103+20: ldx [%g3 + STACK_BIAS + RW_V9_I7], %g2104104+ subcc %g7, 1, %g7105105+ bne,pn %xcc, 20b106106+ ldx [%g3 + STACK_BIAS + RW_V9_I6], %g3107107+108108+ /* Restore the current register window position and109109+ * re-enable interrupts.110110+ */111111+3: wrpr %g1, %cwp112112+ wrpr %o5, %pstate113113+114114+2: stx %g3, [%o0 + PT_V9_FP]115115+ sllx %o5, 8, %o5116116+ stx %o5, [%o0 + PT_V9_TSTATE]117117+ stx %g2, [%o0 + PT_V9_TPC]118118+ add %g2, 4, %g2119119+ retl120120+ stx %g2, [%o0 + PT_V9_TNPC]121121+ .size perf_arch_fetch_caller_regs,.-perf_arch_fetch_caller_regs122122+#endif /* CONFIG_PERF_EVENTS */123123+49124#ifdef CONFIG_SMP50125 .globl hard_smp_processor_id51126 .type hard_smp_processor_id,#function
+4
arch/sparc/kernel/ptrace_32.c
···6565 *k++ = regs->u_regs[pos++];66666767 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];6868+ reg_window -= 16;6869 for (; count > 0 && pos < 32; count--) {6970 if (get_user(*k++, ®_window[pos++]))7071 return -EFAULT;···7776 }78777978 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];7979+ reg_window -= 16;8080 for (; count > 0 && pos < 32; count--) {8181 if (get_user(reg, ®_window[pos++]) ||8282 put_user(reg, u++))···143141 regs->u_regs[pos++] = *k++;144142145143 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];144144+ reg_window -= 16;146145 for (; count > 0 && pos < 32; count--) {147146 if (put_user(*k++, ®_window[pos++]))148147 return -EFAULT;···156153 }157154158155 reg_window = (unsigned long __user *) regs->u_regs[UREG_I6];156156+ reg_window -= 16;159157 for (; count > 0 && pos < 32; count--) {160158 if (get_user(reg, u++) ||161159 put_user(reg, ®_window[pos++]))
···313313#define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)314314static void __init relocate_initrd(void)315315{316316-316316+ /* Assume only end is not page aligned */317317 u64 ramdisk_image = boot_params.hdr.ramdisk_image;318318 u64 ramdisk_size = boot_params.hdr.ramdisk_size;319319+ u64 area_size = PAGE_ALIGN(ramdisk_size);319320 u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT;320321 u64 ramdisk_here;321322 unsigned long slop, clen, mapaddr;322323 char *p, *q;323324324325 /* We need to move the initrd down into lowmem */325325- ramdisk_here = find_e820_area(0, end_of_lowmem, ramdisk_size,326326+ ramdisk_here = find_e820_area(0, end_of_lowmem, area_size,326327 PAGE_SIZE);327328328329 if (ramdisk_here == -1ULL)···332331333332 /* Note: this includes all the lowmem currently occupied by334333 the initrd, we rely on that fact to keep the data intact. */335335- reserve_early(ramdisk_here, ramdisk_here + ramdisk_size,334334+ reserve_early(ramdisk_here, ramdisk_here + area_size,336335 "NEW RAMDISK");337336 initrd_start = ramdisk_here + PAGE_OFFSET;338337 initrd_end = initrd_start + ramdisk_size;···376375377376static void __init reserve_initrd(void)378377{378378+ /* Assume only end is not page aligned */379379 u64 ramdisk_image = boot_params.hdr.ramdisk_image;380380 u64 ramdisk_size = boot_params.hdr.ramdisk_size;381381- u64 ramdisk_end = ramdisk_image + ramdisk_size;381381+ u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size);382382 u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT;383383384384 if (!boot_params.hdr.type_of_loader ||
+2-2
arch/x86/kernel/smpboot.c
···243243 end_local_APIC_setup();244244 map_cpu_to_logical_apicid();245245246246- notify_cpu_starting(cpuid);247247-248246 /*249247 * Need to setup vector mappings before we enable interrupts.250248 */···262264 * Save our processor parameters263265 */264266 smp_store_cpu_info(cpuid);267267+268268+ notify_cpu_starting(cpuid);265269266270 /*267271 * Allow the master to continue.
···332332333333void free_init_pages(char *what, unsigned long begin, unsigned long end)334334{335335- unsigned long addr = begin;335335+ unsigned long addr;336336+ unsigned long begin_aligned, end_aligned;336337337337- if (addr >= end)338338+ /* Make sure boundaries are page aligned */339339+ begin_aligned = PAGE_ALIGN(begin);340340+ end_aligned = end & PAGE_MASK;341341+342342+ if (WARN_ON(begin_aligned != begin || end_aligned != end)) {343343+ begin = begin_aligned;344344+ end = end_aligned;345345+ }346346+347347+ if (begin >= end)338348 return;349349+350350+ addr = begin;339351340352 /*341353 * If debugging page accesses then do not free this memory but···356344 */357345#ifdef CONFIG_DEBUG_PAGEALLOC358346 printk(KERN_INFO "debug: unmapping init memory %08lx..%08lx\n",359359- begin, PAGE_ALIGN(end));347347+ begin, end);360348 set_memory_np(begin, (end - begin) >> PAGE_SHIFT);361349#else362350 /*···371359 for (; addr < end; addr += PAGE_SIZE) {372360 ClearPageReserved(virt_to_page(addr));373361 init_page_count(virt_to_page(addr));374374- memset((void *)(addr & ~(PAGE_SIZE-1)),375375- POISON_FREE_INITMEM, PAGE_SIZE);362362+ memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);376363 free_page(addr);377364 totalram_pages++;378365 }···388377#ifdef CONFIG_BLK_DEV_INITRD389378void free_initrd_mem(unsigned long start, unsigned long end)390379{391391- free_init_pages("initrd memory", start, end);380380+ /*381381+ * end could be not aligned, and We can not align that,382382+ * decompresser could be confused by aligned initrd_end383383+ * We already reserve the end partial page before in384384+ * - i386_start_kernel()385385+ * - x86_64_start_kernel()386386+ * - relocate_initrd()387387+ * So here We can do PAGE_ALIGN() safely to get partial page to be freed388388+ */389389+ free_init_pages("initrd memory", start, PAGE_ALIGN(end));392390}393391#endif
···681681extern int nouveau_vram_pushbuf;682682extern int nouveau_vram_notify;683683extern int nouveau_fbpercrtc;684684+extern int nouveau_tv_disable;684685extern char *nouveau_tv_norm;685686extern int nouveau_reg_debug;686687extern char *nouveau_vbios;···689688extern int nouveau_ignorelid;690689extern int nouveau_nofbaccel;691690extern int nouveau_noaccel;691691+extern int nouveau_override_conntype;692692693693extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state);694694extern int nouveau_pci_resume(struct pci_dev *pdev);···927925extern void nv40_fb_takedown(struct drm_device *);928926extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t,929927 uint32_t, uint32_t);928928+929929+/* nv50_fb.c */930930+extern int nv50_fb_init(struct drm_device *);931931+extern void nv50_fb_takedown(struct drm_device *);930932931933/* nv04_fifo.c */932934extern int nv04_fifo_init(struct drm_device *);
+561-48
drivers/gpu/drm/nouveau/nouveau_irq.c
···311311#define nouveau_print_bitfield_names(val, namelist) \312312 nouveau_print_bitfield_names_((val), (namelist), ARRAY_SIZE(namelist))313313314314+struct nouveau_enum_names {315315+ uint32_t value;316316+ const char *name;317317+};318318+319319+static void320320+nouveau_print_enum_names_(uint32_t value,321321+ const struct nouveau_enum_names *namelist,322322+ const int namelist_len)323323+{324324+ /*325325+ * Caller must have already printed the KERN_* log level for us.326326+ * Also the caller is responsible for adding the newline.327327+ */328328+ int i;329329+ for (i = 0; i < namelist_len; ++i) {330330+ if (value == namelist[i].value) {331331+ printk("%s", namelist[i].name);332332+ return;333333+ }334334+ }335335+ printk("unknown value 0x%08x", value);336336+}337337+#define nouveau_print_enum_names(val, namelist) \338338+ nouveau_print_enum_names_((val), (namelist), ARRAY_SIZE(namelist))314339315340static int316341nouveau_graph_chid_from_grctx(struct drm_device *dev)···452427 struct drm_nouveau_private *dev_priv = dev->dev_private;453428 uint32_t nsource = trap->nsource, nstatus = trap->nstatus;454429455455- NV_INFO(dev, "%s - nSource:", id);456456- nouveau_print_bitfield_names(nsource, nsource_names);457457- printk(", nStatus:");458458- if (dev_priv->card_type < NV_10)459459- nouveau_print_bitfield_names(nstatus, nstatus_names);460460- else461461- nouveau_print_bitfield_names(nstatus, nstatus_names_nv10);462462- printk("\n");430430+ if (dev_priv->card_type < NV_50) {431431+ NV_INFO(dev, "%s - nSource:", id);432432+ nouveau_print_bitfield_names(nsource, nsource_names);433433+ printk(", nStatus:");434434+ if (dev_priv->card_type < NV_10)435435+ nouveau_print_bitfield_names(nstatus, nstatus_names);436436+ else437437+ nouveau_print_bitfield_names(nstatus, nstatus_names_nv10);438438+ printk("\n");439439+ }463440464441 NV_INFO(dev, "%s - Ch %d/%d Class 0x%04x Mthd 0x%04x "465442 "Data 0x%08x:0x%08x\n",···605578}606579607580static void581581+nv50_pfb_vm_trap(struct drm_device *dev, int display, const char *name)582582+{583583+ struct drm_nouveau_private *dev_priv = dev->dev_private;584584+ uint32_t trap[6];585585+ int i, ch;586586+ uint32_t idx = nv_rd32(dev, 0x100c90);587587+ if (idx & 0x80000000) {588588+ idx &= 0xffffff;589589+ if (display) {590590+ for (i = 0; i < 6; i++) {591591+ nv_wr32(dev, 0x100c90, idx | i << 24);592592+ trap[i] = nv_rd32(dev, 0x100c94);593593+ }594594+ for (ch = 0; ch < dev_priv->engine.fifo.channels; ch++) {595595+ struct nouveau_channel *chan = dev_priv->fifos[ch];596596+597597+ if (!chan || !chan->ramin)598598+ continue;599599+600600+ if (trap[1] == chan->ramin->instance >> 12)601601+ break;602602+ }603603+ NV_INFO(dev, "%s - VM: Trapped %s at %02x%04x%04x status %08x %08x channel %d\n",604604+ name, (trap[5]&0x100?"read":"write"),605605+ trap[5]&0xff, trap[4]&0xffff,606606+ trap[3]&0xffff, trap[0], trap[2], ch);607607+ }608608+ nv_wr32(dev, 0x100c90, idx | 0x80000000);609609+ } else if (display) {610610+ NV_INFO(dev, "%s - no VM fault?\n", name);611611+ }612612+}613613+614614+static struct nouveau_enum_names nv50_mp_exec_error_names[] =615615+{616616+ { 3, "STACK_UNDERFLOW" },617617+ { 4, "QUADON_ACTIVE" },618618+ { 8, "TIMEOUT" },619619+ { 0x10, "INVALID_OPCODE" },620620+ { 0x40, "BREAKPOINT" },621621+};622622+623623+static void624624+nv50_pgraph_mp_trap(struct drm_device *dev, int tpid, int display)625625+{626626+ struct drm_nouveau_private *dev_priv = dev->dev_private;627627+ uint32_t units = nv_rd32(dev, 0x1540);628628+ uint32_t addr, mp10, status, pc, oplow, ophigh;629629+ int i;630630+ int mps = 0;631631+ for (i = 0; i < 4; i++) {632632+ if (!(units & 1 << (i+24)))633633+ continue;634634+ if (dev_priv->chipset < 0xa0)635635+ addr = 0x408200 + (tpid << 12) + (i << 7);636636+ else637637+ addr = 0x408100 + (tpid << 11) + (i << 7);638638+ mp10 = nv_rd32(dev, addr + 0x10);639639+ status = nv_rd32(dev, addr + 0x14);640640+ if (!status)641641+ continue;642642+ if (display) {643643+ nv_rd32(dev, addr + 0x20);644644+ pc = nv_rd32(dev, addr + 0x24);645645+ oplow = nv_rd32(dev, addr + 0x70);646646+ ophigh= nv_rd32(dev, addr + 0x74);647647+ NV_INFO(dev, "PGRAPH_TRAP_MP_EXEC - "648648+ "TP %d MP %d: ", tpid, i);649649+ nouveau_print_enum_names(status,650650+ nv50_mp_exec_error_names);651651+ printk(" at %06x warp %d, opcode %08x %08x\n",652652+ pc&0xffffff, pc >> 24,653653+ oplow, ophigh);654654+ }655655+ nv_wr32(dev, addr + 0x10, mp10);656656+ nv_wr32(dev, addr + 0x14, 0);657657+ mps++;658658+ }659659+ if (!mps && display)660660+ NV_INFO(dev, "PGRAPH_TRAP_MP_EXEC - TP %d: "661661+ "No MPs claiming errors?\n", tpid);662662+}663663+664664+static void665665+nv50_pgraph_tp_trap(struct drm_device *dev, int type, uint32_t ustatus_old,666666+ uint32_t ustatus_new, int display, const char *name)667667+{668668+ struct drm_nouveau_private *dev_priv = dev->dev_private;669669+ int tps = 0;670670+ uint32_t units = nv_rd32(dev, 0x1540);671671+ int i, r;672672+ uint32_t ustatus_addr, ustatus;673673+ for (i = 0; i < 16; i++) {674674+ if (!(units & (1 << i)))675675+ continue;676676+ if (dev_priv->chipset < 0xa0)677677+ ustatus_addr = ustatus_old + (i << 12);678678+ else679679+ ustatus_addr = ustatus_new + (i << 11);680680+ ustatus = nv_rd32(dev, ustatus_addr) & 0x7fffffff;681681+ if (!ustatus)682682+ continue;683683+ tps++;684684+ switch (type) {685685+ case 6: /* texture error... unknown for now */686686+ nv50_pfb_vm_trap(dev, display, name);687687+ if (display) {688688+ NV_ERROR(dev, "magic set %d:\n", i);689689+ for (r = ustatus_addr + 4; r <= ustatus_addr + 0x10; r += 4)690690+ NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,691691+ nv_rd32(dev, r));692692+ }693693+ break;694694+ case 7: /* MP error */695695+ if (ustatus & 0x00010000) {696696+ nv50_pgraph_mp_trap(dev, i, display);697697+ ustatus &= ~0x00010000;698698+ }699699+ break;700700+ case 8: /* TPDMA error */701701+ {702702+ uint32_t e0c = nv_rd32(dev, ustatus_addr + 4);703703+ uint32_t e10 = nv_rd32(dev, ustatus_addr + 8);704704+ uint32_t e14 = nv_rd32(dev, ustatus_addr + 0xc);705705+ uint32_t e18 = nv_rd32(dev, ustatus_addr + 0x10);706706+ uint32_t e1c = nv_rd32(dev, ustatus_addr + 0x14);707707+ uint32_t e20 = nv_rd32(dev, ustatus_addr + 0x18);708708+ uint32_t e24 = nv_rd32(dev, ustatus_addr + 0x1c);709709+ nv50_pfb_vm_trap(dev, display, name);710710+ /* 2d engine destination */711711+ if (ustatus & 0x00000010) {712712+ if (display) {713713+ NV_INFO(dev, "PGRAPH_TRAP_TPDMA_2D - TP %d - Unknown fault at address %02x%08x\n",714714+ i, e14, e10);715715+ NV_INFO(dev, "PGRAPH_TRAP_TPDMA_2D - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n",716716+ i, e0c, e18, e1c, e20, e24);717717+ }718718+ ustatus &= ~0x00000010;719719+ }720720+ /* Render target */721721+ if (ustatus & 0x00000040) {722722+ if (display) {723723+ NV_INFO(dev, "PGRAPH_TRAP_TPDMA_RT - TP %d - Unknown fault at address %02x%08x\n",724724+ i, e14, e10);725725+ NV_INFO(dev, "PGRAPH_TRAP_TPDMA_RT - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n",726726+ i, e0c, e18, e1c, e20, e24);727727+ }728728+ ustatus &= ~0x00000040;729729+ }730730+ /* CUDA memory: l[], g[] or stack. */731731+ if (ustatus & 0x00000080) {732732+ if (display) {733733+ if (e18 & 0x80000000) {734734+ /* g[] read fault? */735735+ NV_INFO(dev, "PGRAPH_TRAP_TPDMA - TP %d - Global read fault at address %02x%08x\n",736736+ i, e14, e10 | ((e18 >> 24) & 0x1f));737737+ e18 &= ~0x1f000000;738738+ } else if (e18 & 0xc) {739739+ /* g[] write fault? */740740+ NV_INFO(dev, "PGRAPH_TRAP_TPDMA - TP %d - Global write fault at address %02x%08x\n",741741+ i, e14, e10 | ((e18 >> 7) & 0x1f));742742+ e18 &= ~0x00000f80;743743+ } else {744744+ NV_INFO(dev, "PGRAPH_TRAP_TPDMA - TP %d - Unknown CUDA fault at address %02x%08x\n",745745+ i, e14, e10);746746+ }747747+ NV_INFO(dev, "PGRAPH_TRAP_TPDMA - TP %d - e0c: %08x, e18: %08x, e1c: %08x, e20: %08x, e24: %08x\n",748748+ i, e0c, e18, e1c, e20, e24);749749+ }750750+ ustatus &= ~0x00000080;751751+ }752752+ }753753+ break;754754+ }755755+ if (ustatus) {756756+ if (display)757757+ NV_INFO(dev, "%s - TP%d: Unhandled ustatus 0x%08x\n", name, i, ustatus);758758+ }759759+ nv_wr32(dev, ustatus_addr, 0xc0000000);760760+ }761761+762762+ if (!tps && display)763763+ NV_INFO(dev, "%s - No TPs claiming errors?\n", name);764764+}765765+766766+static void767767+nv50_pgraph_trap_handler(struct drm_device *dev)768768+{769769+ struct nouveau_pgraph_trap trap;770770+ uint32_t status = nv_rd32(dev, 0x400108);771771+ uint32_t ustatus;772772+ int display = nouveau_ratelimit();773773+774774+775775+ if (!status && display) {776776+ nouveau_graph_trap_info(dev, &trap);777777+ nouveau_graph_dump_trap_info(dev, "PGRAPH_TRAP", &trap);778778+ NV_INFO(dev, "PGRAPH_TRAP - no units reporting traps?\n");779779+ }780780+781781+ /* DISPATCH: Relays commands to other units and handles NOTIFY,782782+ * COND, QUERY. If you get a trap from it, the command is still stuck783783+ * in DISPATCH and you need to do something about it. */784784+ if (status & 0x001) {785785+ ustatus = nv_rd32(dev, 0x400804) & 0x7fffffff;786786+ if (!ustatus && display) {787787+ NV_INFO(dev, "PGRAPH_TRAP_DISPATCH - no ustatus?\n");788788+ }789789+790790+ /* Known to be triggered by screwed up NOTIFY and COND... */791791+ if (ustatus & 0x00000001) {792792+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_DISPATCH_FAULT");793793+ nv_wr32(dev, 0x400500, 0);794794+ if (nv_rd32(dev, 0x400808) & 0x80000000) {795795+ if (display) {796796+ if (nouveau_graph_trapped_channel(dev, &trap.channel))797797+ trap.channel = -1;798798+ trap.class = nv_rd32(dev, 0x400814);799799+ trap.mthd = nv_rd32(dev, 0x400808) & 0x1ffc;800800+ trap.subc = (nv_rd32(dev, 0x400808) >> 16) & 0x7;801801+ trap.data = nv_rd32(dev, 0x40080c);802802+ trap.data2 = nv_rd32(dev, 0x400810);803803+ nouveau_graph_dump_trap_info(dev,804804+ "PGRAPH_TRAP_DISPATCH_FAULT", &trap);805805+ NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_FAULT - 400808: %08x\n", nv_rd32(dev, 0x400808));806806+ NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_FAULT - 400848: %08x\n", nv_rd32(dev, 0x400848));807807+ }808808+ nv_wr32(dev, 0x400808, 0);809809+ } else if (display) {810810+ NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_FAULT - No stuck command?\n");811811+ }812812+ nv_wr32(dev, 0x4008e8, nv_rd32(dev, 0x4008e8) & 3);813813+ nv_wr32(dev, 0x400848, 0);814814+ ustatus &= ~0x00000001;815815+ }816816+ if (ustatus & 0x00000002) {817817+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_DISPATCH_QUERY");818818+ nv_wr32(dev, 0x400500, 0);819819+ if (nv_rd32(dev, 0x40084c) & 0x80000000) {820820+ if (display) {821821+ if (nouveau_graph_trapped_channel(dev, &trap.channel))822822+ trap.channel = -1;823823+ trap.class = nv_rd32(dev, 0x400814);824824+ trap.mthd = nv_rd32(dev, 0x40084c) & 0x1ffc;825825+ trap.subc = (nv_rd32(dev, 0x40084c) >> 16) & 0x7;826826+ trap.data = nv_rd32(dev, 0x40085c);827827+ trap.data2 = 0;828828+ nouveau_graph_dump_trap_info(dev,829829+ "PGRAPH_TRAP_DISPATCH_QUERY", &trap);830830+ NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_QUERY - 40084c: %08x\n", nv_rd32(dev, 0x40084c));831831+ }832832+ nv_wr32(dev, 0x40084c, 0);833833+ } else if (display) {834834+ NV_INFO(dev, "PGRAPH_TRAP_DISPATCH_QUERY - No stuck command?\n");835835+ }836836+ ustatus &= ~0x00000002;837837+ }838838+ if (ustatus && display)839839+ NV_INFO(dev, "PGRAPH_TRAP_DISPATCH - Unhandled ustatus 0x%08x\n", ustatus);840840+ nv_wr32(dev, 0x400804, 0xc0000000);841841+ nv_wr32(dev, 0x400108, 0x001);842842+ status &= ~0x001;843843+ }844844+845845+ /* TRAPs other than dispatch use the "normal" trap regs. */846846+ if (status && display) {847847+ nouveau_graph_trap_info(dev, &trap);848848+ nouveau_graph_dump_trap_info(dev,849849+ "PGRAPH_TRAP", &trap);850850+ }851851+852852+ /* M2MF: Memory to memory copy engine. */853853+ if (status & 0x002) {854854+ ustatus = nv_rd32(dev, 0x406800) & 0x7fffffff;855855+ if (!ustatus && display) {856856+ NV_INFO(dev, "PGRAPH_TRAP_M2MF - no ustatus?\n");857857+ }858858+ if (ustatus & 0x00000001) {859859+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_NOTIFY");860860+ ustatus &= ~0x00000001;861861+ }862862+ if (ustatus & 0x00000002) {863863+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_IN");864864+ ustatus &= ~0x00000002;865865+ }866866+ if (ustatus & 0x00000004) {867867+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_M2MF_OUT");868868+ ustatus &= ~0x00000004;869869+ }870870+ NV_INFO (dev, "PGRAPH_TRAP_M2MF - %08x %08x %08x %08x\n",871871+ nv_rd32(dev, 0x406804),872872+ nv_rd32(dev, 0x406808),873873+ nv_rd32(dev, 0x40680c),874874+ nv_rd32(dev, 0x406810));875875+ if (ustatus && display)876876+ NV_INFO(dev, "PGRAPH_TRAP_M2MF - Unhandled ustatus 0x%08x\n", ustatus);877877+ /* No sane way found yet -- just reset the bugger. */878878+ nv_wr32(dev, 0x400040, 2);879879+ nv_wr32(dev, 0x400040, 0);880880+ nv_wr32(dev, 0x406800, 0xc0000000);881881+ nv_wr32(dev, 0x400108, 0x002);882882+ status &= ~0x002;883883+ }884884+885885+ /* VFETCH: Fetches data from vertex buffers. */886886+ if (status & 0x004) {887887+ ustatus = nv_rd32(dev, 0x400c04) & 0x7fffffff;888888+ if (!ustatus && display) {889889+ NV_INFO(dev, "PGRAPH_TRAP_VFETCH - no ustatus?\n");890890+ }891891+ if (ustatus & 0x00000001) {892892+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_VFETCH_FAULT");893893+ NV_INFO (dev, "PGRAPH_TRAP_VFETCH_FAULT - %08x %08x %08x %08x\n",894894+ nv_rd32(dev, 0x400c00),895895+ nv_rd32(dev, 0x400c08),896896+ nv_rd32(dev, 0x400c0c),897897+ nv_rd32(dev, 0x400c10));898898+ ustatus &= ~0x00000001;899899+ }900900+ if (ustatus && display)901901+ NV_INFO(dev, "PGRAPH_TRAP_VFETCH - Unhandled ustatus 0x%08x\n", ustatus);902902+ nv_wr32(dev, 0x400c04, 0xc0000000);903903+ nv_wr32(dev, 0x400108, 0x004);904904+ status &= ~0x004;905905+ }906906+907907+ /* STRMOUT: DirectX streamout / OpenGL transform feedback. */908908+ if (status & 0x008) {909909+ ustatus = nv_rd32(dev, 0x401800) & 0x7fffffff;910910+ if (!ustatus && display) {911911+ NV_INFO(dev, "PGRAPH_TRAP_STRMOUT - no ustatus?\n");912912+ }913913+ if (ustatus & 0x00000001) {914914+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_STRMOUT_FAULT");915915+ NV_INFO (dev, "PGRAPH_TRAP_STRMOUT_FAULT - %08x %08x %08x %08x\n",916916+ nv_rd32(dev, 0x401804),917917+ nv_rd32(dev, 0x401808),918918+ nv_rd32(dev, 0x40180c),919919+ nv_rd32(dev, 0x401810));920920+ ustatus &= ~0x00000001;921921+ }922922+ if (ustatus && display)923923+ NV_INFO(dev, "PGRAPH_TRAP_STRMOUT - Unhandled ustatus 0x%08x\n", ustatus);924924+ /* No sane way found yet -- just reset the bugger. */925925+ nv_wr32(dev, 0x400040, 0x80);926926+ nv_wr32(dev, 0x400040, 0);927927+ nv_wr32(dev, 0x401800, 0xc0000000);928928+ nv_wr32(dev, 0x400108, 0x008);929929+ status &= ~0x008;930930+ }931931+932932+ /* CCACHE: Handles code and c[] caches and fills them. */933933+ if (status & 0x010) {934934+ ustatus = nv_rd32(dev, 0x405018) & 0x7fffffff;935935+ if (!ustatus && display) {936936+ NV_INFO(dev, "PGRAPH_TRAP_CCACHE - no ustatus?\n");937937+ }938938+ if (ustatus & 0x00000001) {939939+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_CCACHE_FAULT");940940+ NV_INFO (dev, "PGRAPH_TRAP_CCACHE_FAULT - %08x %08x %08x %08x %08x %08x %08x\n",941941+ nv_rd32(dev, 0x405800),942942+ nv_rd32(dev, 0x405804),943943+ nv_rd32(dev, 0x405808),944944+ nv_rd32(dev, 0x40580c),945945+ nv_rd32(dev, 0x405810),946946+ nv_rd32(dev, 0x405814),947947+ nv_rd32(dev, 0x40581c));948948+ ustatus &= ~0x00000001;949949+ }950950+ if (ustatus && display)951951+ NV_INFO(dev, "PGRAPH_TRAP_CCACHE - Unhandled ustatus 0x%08x\n", ustatus);952952+ nv_wr32(dev, 0x405018, 0xc0000000);953953+ nv_wr32(dev, 0x400108, 0x010);954954+ status &= ~0x010;955955+ }956956+957957+ /* Unknown, not seen yet... 0x402000 is the only trap status reg958958+ * remaining, so try to handle it anyway. Perhaps related to that959959+ * unknown DMA slot on tesla? */960960+ if (status & 0x20) {961961+ nv50_pfb_vm_trap(dev, display, "PGRAPH_TRAP_UNKC04");962962+ ustatus = nv_rd32(dev, 0x402000) & 0x7fffffff;963963+ if (display)964964+ NV_INFO(dev, "PGRAPH_TRAP_UNKC04 - Unhandled ustatus 0x%08x\n", ustatus);965965+ nv_wr32(dev, 0x402000, 0xc0000000);966966+ /* no status modifiction on purpose */967967+ }968968+969969+ /* TEXTURE: CUDA texturing units */970970+ if (status & 0x040) {971971+ nv50_pgraph_tp_trap (dev, 6, 0x408900, 0x408600, display,972972+ "PGRAPH_TRAP_TEXTURE");973973+ nv_wr32(dev, 0x400108, 0x040);974974+ status &= ~0x040;975975+ }976976+977977+ /* MP: CUDA execution engines. */978978+ if (status & 0x080) {979979+ nv50_pgraph_tp_trap (dev, 7, 0x408314, 0x40831c, display,980980+ "PGRAPH_TRAP_MP");981981+ nv_wr32(dev, 0x400108, 0x080);982982+ status &= ~0x080;983983+ }984984+985985+ /* TPDMA: Handles TP-initiated uncached memory accesses:986986+ * l[], g[], stack, 2d surfaces, render targets. */987987+ if (status & 0x100) {988988+ nv50_pgraph_tp_trap (dev, 8, 0x408e08, 0x408708, display,989989+ "PGRAPH_TRAP_TPDMA");990990+ nv_wr32(dev, 0x400108, 0x100);991991+ status &= ~0x100;992992+ }993993+994994+ if (status) {995995+ if (display)996996+ NV_INFO(dev, "PGRAPH_TRAP - Unknown trap 0x%08x\n",997997+ status);998998+ nv_wr32(dev, 0x400108, status);999999+ }10001000+}10011001+10021002+/* There must be a *lot* of these. Will take some time to gather them up. */10031003+static struct nouveau_enum_names nv50_data_error_names[] =10041004+{10051005+ { 4, "INVALID_VALUE" },10061006+ { 5, "INVALID_ENUM" },10071007+ { 8, "INVALID_OBJECT" },10081008+ { 0xc, "INVALID_BITFIELD" },10091009+ { 0x28, "MP_NO_REG_SPACE" },10101010+ { 0x2b, "MP_BLOCK_SIZE_MISMATCH" },10111011+};10121012+10131013+static void6081014nv50_pgraph_irq_handler(struct drm_device *dev)6091015{10161016+ struct nouveau_pgraph_trap trap;10171017+ int unhandled = 0;6101018 uint32_t status;61110196121020 while ((status = nv_rd32(dev, NV03_PGRAPH_INTR))) {613613- uint32_t nsource = nv_rd32(dev, NV03_PGRAPH_NSOURCE);614614-10211021+ /* NOTIFY: You've set a NOTIFY an a command and it's done. */6151022 if (status & 0x00000001) {616616- nouveau_pgraph_intr_notify(dev, nsource);10231023+ nouveau_graph_trap_info(dev, &trap);10241024+ if (nouveau_ratelimit())10251025+ nouveau_graph_dump_trap_info(dev,10261026+ "PGRAPH_NOTIFY", &trap);6171027 status &= ~0x00000001;6181028 nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000001);6191029 }6201030621621- if (status & 0x00000010) {622622- nouveau_pgraph_intr_error(dev, nsource |623623- NV03_PGRAPH_NSOURCE_ILLEGAL_MTHD);10311031+ /* COMPUTE_QUERY: Purpose and exact cause unknown, happens10321032+ * when you write 0x200 to 0x50c0 method 0x31c. */10331033+ if (status & 0x00000002) {10341034+ nouveau_graph_trap_info(dev, &trap);10351035+ if (nouveau_ratelimit())10361036+ nouveau_graph_dump_trap_info(dev,10371037+ "PGRAPH_COMPUTE_QUERY", &trap);10381038+ status &= ~0x00000002;10391039+ nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000002);10401040+ }624104110421042+ /* Unknown, never seen: 0x4 */10431043+10441044+ /* ILLEGAL_MTHD: You used a wrong method for this class. */10451045+ if (status & 0x00000010) {10461046+ nouveau_graph_trap_info(dev, &trap);10471047+ if (nouveau_pgraph_intr_swmthd(dev, &trap))10481048+ unhandled = 1;10491049+ if (unhandled && nouveau_ratelimit())10501050+ nouveau_graph_dump_trap_info(dev,10511051+ "PGRAPH_ILLEGAL_MTHD", &trap);6251052 status &= ~0x00000010;6261053 nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000010);6271054 }628105510561056+ /* ILLEGAL_CLASS: You used a wrong class. */10571057+ if (status & 0x00000020) {10581058+ nouveau_graph_trap_info(dev, &trap);10591059+ if (nouveau_ratelimit())10601060+ nouveau_graph_dump_trap_info(dev,10611061+ "PGRAPH_ILLEGAL_CLASS", &trap);10621062+ status &= ~0x00000020;10631063+ nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000020);10641064+ }10651065+10661066+ /* DOUBLE_NOTIFY: You tried to set a NOTIFY on another NOTIFY. */10671067+ if (status & 0x00000040) {10681068+ nouveau_graph_trap_info(dev, &trap);10691069+ if (nouveau_ratelimit())10701070+ nouveau_graph_dump_trap_info(dev,10711071+ "PGRAPH_DOUBLE_NOTIFY", &trap);10721072+ status &= ~0x00000040;10731073+ nv_wr32(dev, NV03_PGRAPH_INTR, 0x00000040);10741074+ }10751075+10761076+ /* CONTEXT_SWITCH: PGRAPH needs us to load a new context */6291077 if (status & 0x00001000) {6301078 nv_wr32(dev, 0x400500, 0x00000000);6311079 nv_wr32(dev, NV03_PGRAPH_INTR,···1115613 status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;1116614 }111761511181118- if (status & 0x00100000) {11191119- nouveau_pgraph_intr_error(dev, nsource |11201120- NV03_PGRAPH_NSOURCE_DATA_ERROR);616616+ /* BUFFER_NOTIFY: Your m2mf transfer finished */617617+ if (status & 0x00010000) {618618+ nouveau_graph_trap_info(dev, &trap);619619+ if (nouveau_ratelimit())620620+ nouveau_graph_dump_trap_info(dev,621621+ "PGRAPH_BUFFER_NOTIFY", &trap);622622+ status &= ~0x00010000;623623+ nv_wr32(dev, NV03_PGRAPH_INTR, 0x00010000);624624+ }1121625626626+ /* DATA_ERROR: Invalid value for this method, or invalid627627+ * state in current PGRAPH context for this operation */628628+ if (status & 0x00100000) {629629+ nouveau_graph_trap_info(dev, &trap);630630+ if (nouveau_ratelimit()) {631631+ nouveau_graph_dump_trap_info(dev,632632+ "PGRAPH_DATA_ERROR", &trap);633633+ NV_INFO (dev, "PGRAPH_DATA_ERROR - ");634634+ nouveau_print_enum_names(nv_rd32(dev, 0x400110),635635+ nv50_data_error_names);636636+ printk("\n");637637+ }1122638 status &= ~0x00100000;1123639 nv_wr32(dev, NV03_PGRAPH_INTR, 0x00100000);1124640 }1125641642642+ /* TRAP: Something bad happened in the middle of command643643+ * execution. Has a billion types, subtypes, and even644644+ * subsubtypes. */1126645 if (status & 0x00200000) {11271127- int r;11281128-11291129- nouveau_pgraph_intr_error(dev, nsource |11301130- NV03_PGRAPH_NSOURCE_PROTECTION_ERROR);11311131-11321132- NV_ERROR(dev, "magic set 1:\n");11331133- for (r = 0x408900; r <= 0x408910; r += 4)11341134- NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,11351135- nv_rd32(dev, r));11361136- nv_wr32(dev, 0x408900,11371137- nv_rd32(dev, 0x408904) | 0xc0000000);11381138- for (r = 0x408e08; r <= 0x408e24; r += 4)11391139- NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,11401140- nv_rd32(dev, r));11411141- nv_wr32(dev, 0x408e08,11421142- nv_rd32(dev, 0x408e08) | 0xc0000000);11431143-11441144- NV_ERROR(dev, "magic set 2:\n");11451145- for (r = 0x409900; r <= 0x409910; r += 4)11461146- NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,11471147- nv_rd32(dev, r));11481148- nv_wr32(dev, 0x409900,11491149- nv_rd32(dev, 0x409904) | 0xc0000000);11501150- for (r = 0x409e08; r <= 0x409e24; r += 4)11511151- NV_ERROR(dev, "\t0x%08x: 0x%08x\n", r,11521152- nv_rd32(dev, r));11531153- nv_wr32(dev, 0x409e08,11541154- nv_rd32(dev, 0x409e08) | 0xc0000000);11551155-646646+ nv50_pgraph_trap_handler(dev);1156647 status &= ~0x00200000;11571157- nv_wr32(dev, NV03_PGRAPH_NSOURCE, nsource);1158648 nv_wr32(dev, NV03_PGRAPH_INTR, 0x00200000);1159649 }650650+651651+ /* Unknown, never seen: 0x00400000 */652652+653653+ /* SINGLE_STEP: Happens on every method if you turned on654654+ * single stepping in 40008c */655655+ if (status & 0x01000000) {656656+ nouveau_graph_trap_info(dev, &trap);657657+ if (nouveau_ratelimit())658658+ nouveau_graph_dump_trap_info(dev,659659+ "PGRAPH_SINGLE_STEP", &trap);660660+ status &= ~0x01000000;661661+ nv_wr32(dev, NV03_PGRAPH_INTR, 0x01000000);662662+ }663663+664664+ /* 0x02000000 happens when you pause a ctxprog...665665+ * but the only way this can happen that I know is by666666+ * poking the relevant MMIO register, and we don't667667+ * do that. */11606681161669 if (status) {1162670 NV_INFO(dev, "Unhandled PGRAPH_INTR - 0x%08x\n",···1184672 }11856731186674 nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING);11871187- nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31));675675+ if (nv_rd32(dev, 0x400824) & (1 << 31))676676+ nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31));1188677}11896781190679static void
···522522 }523523524524 for (i = 0 ; i < dcb->connector.entries; i++) {525525- if (i != 0 && dcb->connector.entry[i].index ==526526- dcb->connector.entry[i - 1].index)525525+ if (i != 0 && dcb->connector.entry[i].index2 ==526526+ dcb->connector.entry[i - 1].index2)527527 continue;528528 nouveau_connector_create(dev, &dcb->connector.entry[i]);529529 }
+32
drivers/gpu/drm/nouveau/nv50_fb.c
···11+#include "drmP.h"22+#include "drm.h"33+#include "nouveau_drv.h"44+#include "nouveau_drm.h"55+66+int77+nv50_fb_init(struct drm_device *dev)88+{99+ /* This is needed to get meaningful information from 100c901010+ * on traps. No idea what these values mean exactly. */1111+ struct drm_nouveau_private *dev_priv = dev->dev_private;1212+1313+ switch (dev_priv->chipset) {1414+ case 0x50:1515+ nv_wr32(dev, 0x100c90, 0x0707ff);1616+ break;1717+ case 0xa5:1818+ case 0xa8:1919+ nv_wr32(dev, 0x100c90, 0x0d0fff);2020+ break;2121+ default:2222+ nv_wr32(dev, 0x100c90, 0x1d07ff);2323+ break;2424+ }2525+2626+ return 0;2727+}2828+2929+void3030+nv50_fb_takedown(struct drm_device *dev)3131+{3232+}
···353353 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);354354}355355356356+static void atombios_disable_ss(struct drm_crtc *crtc)357357+{358358+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);359359+ struct drm_device *dev = crtc->dev;360360+ struct radeon_device *rdev = dev->dev_private;361361+ u32 ss_cntl;362362+363363+ if (ASIC_IS_DCE4(rdev)) {364364+ switch (radeon_crtc->pll_id) {365365+ case ATOM_PPLL1:366366+ ss_cntl = RREG32(EVERGREEN_P1PLL_SS_CNTL);367367+ ss_cntl &= ~EVERGREEN_PxPLL_SS_EN;368368+ WREG32(EVERGREEN_P1PLL_SS_CNTL, ss_cntl);369369+ break;370370+ case ATOM_PPLL2:371371+ ss_cntl = RREG32(EVERGREEN_P2PLL_SS_CNTL);372372+ ss_cntl &= ~EVERGREEN_PxPLL_SS_EN;373373+ WREG32(EVERGREEN_P2PLL_SS_CNTL, ss_cntl);374374+ break;375375+ case ATOM_DCPLL:376376+ case ATOM_PPLL_INVALID:377377+ return;378378+ }379379+ } else if (ASIC_IS_AVIVO(rdev)) {380380+ switch (radeon_crtc->pll_id) {381381+ case ATOM_PPLL1:382382+ ss_cntl = RREG32(AVIVO_P1PLL_INT_SS_CNTL);383383+ ss_cntl &= ~1;384384+ WREG32(AVIVO_P1PLL_INT_SS_CNTL, ss_cntl);385385+ break;386386+ case ATOM_PPLL2:387387+ ss_cntl = RREG32(AVIVO_P2PLL_INT_SS_CNTL);388388+ ss_cntl &= ~1;389389+ WREG32(AVIVO_P2PLL_INT_SS_CNTL, ss_cntl);390390+ break;391391+ case ATOM_DCPLL:392392+ case ATOM_PPLL_INVALID:393393+ return;394394+ }395395+ }396396+}397397+398398+356399union atom_enable_ss {357400 ENABLE_LVDS_SS_PARAMETERS legacy;358401 ENABLE_SPREAD_SPECTRUM_ON_PPLL_PS_ALLOCATION v1;359402};360403361361-static void atombios_set_ss(struct drm_crtc *crtc, int enable)404404+static void atombios_enable_ss(struct drm_crtc *crtc)362405{363406 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);364407 struct drm_device *dev = crtc->dev;···430387 step = dig->ss->step;431388 delay = dig->ss->delay;432389 range = dig->ss->range;433433- } else if (enable)390390+ } else434391 return;435435- } else if (enable)392392+ } else436393 return;437394 break;438395 }···449406 args.v1.ucSpreadSpectrumDelay = delay;450407 args.v1.ucSpreadSpectrumRange = range;451408 args.v1.ucPpll = radeon_crtc->crtc_id ? ATOM_PPLL2 : ATOM_PPLL1;452452- args.v1.ucEnable = enable;409409+ args.v1.ucEnable = ATOM_ENABLE;453410 } else {454411 args.legacy.usSpreadSpectrumPercentage = cpu_to_le16(percentage);455412 args.legacy.ucSpreadSpectrumType = type;456413 args.legacy.ucSpreadSpectrumStepSize_Delay = (step & 3) << 2;457414 args.legacy.ucSpreadSpectrumStepSize_Delay |= (delay & 7) << 4;458458- args.legacy.ucEnable = enable;415415+ args.legacy.ucEnable = ATOM_ENABLE;459416 }460417 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);461418}···521478 /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */522479 if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)523480 adjusted_clock = mode->clock * 2;524524- /* LVDS PLL quirks */525525- if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) {526526- struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;527527- pll->algo = dig->pll_algo;528528- }529481 } else {530482 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC)531483 pll->flags |= RADEON_PLL_NO_ODD_POST_DIV;···541503 int index;542504543505 index = GetIndexIntoMasterTable(COMMAND, AdjustDisplayPll);544544- atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev,545545- &crev);506506+ if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev,507507+ &crev))508508+ return adjusted_clock;546509547510 memset(&args, 0, sizeof(args));548511···581542 }582543 } else if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {583544 /* may want to enable SS on DP/eDP eventually */584584- args.v3.sInput.ucDispPllConfig |=585585- DISPPLL_CONFIG_SS_ENABLE;586586- if (mode->clock > 165000)545545+ /*args.v3.sInput.ucDispPllConfig |=546546+ DISPPLL_CONFIG_SS_ENABLE;*/547547+ if (encoder_mode == ATOM_ENCODER_MODE_DP)587548 args.v3.sInput.ucDispPllConfig |=588588- DISPPLL_CONFIG_DUAL_LINK;549549+ DISPPLL_CONFIG_COHERENT_MODE;550550+ else {551551+ if (mode->clock > 165000)552552+ args.v3.sInput.ucDispPllConfig |=553553+ DISPPLL_CONFIG_DUAL_LINK;554554+ }589555 }590556 atom_execute_table(rdev->mode_info.atom_context,591557 index, (uint32_t *)&args);···636592 memset(&args, 0, sizeof(args));637593638594 index = GetIndexIntoMasterTable(COMMAND, SetPixelClock);639639- atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev,640640- &crev);595595+ if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev,596596+ &crev))597597+ return;641598642599 switch (frev) {643600 case 1:···712667 &ref_div, &post_div);713668714669 index = GetIndexIntoMasterTable(COMMAND, SetPixelClock);715715- atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev,716716- &crev);670670+ if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev,671671+ &crev))672672+ return;717673718674 switch (frev) {719675 case 1:···1129108311301084 /* TODO color tiling */1131108511321132- /* pick pll */11331133- radeon_crtc->pll_id = radeon_atom_pick_pll(crtc);11341134-11351135- atombios_set_ss(crtc, 0);10861086+ atombios_disable_ss(crtc);11361087 /* always set DCPLL */11371088 if (ASIC_IS_DCE4(rdev))11381089 atombios_crtc_set_dcpll(crtc);11391090 atombios_crtc_set_pll(crtc, adjusted_mode);11401140- atombios_set_ss(crtc, 1);10911091+ atombios_enable_ss(crtc);1141109211421093 if (ASIC_IS_DCE4(rdev))11431094 atombios_set_crtc_dtd_timing(crtc, adjusted_mode);···1163112011641121static void atombios_crtc_prepare(struct drm_crtc *crtc)11651122{11231123+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);11241124+11251125+ /* pick pll */11261126+ radeon_crtc->pll_id = radeon_atom_pick_pll(crtc);11271127+11661128 atombios_lock_crtc(crtc, ATOM_ENABLE);11671129 atombios_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);11681130}
+3-3
drivers/gpu/drm/radeon/atombios_dp.c
···745745 >> DP_TRAIN_PRE_EMPHASIS_SHIFT);746746747747 /* disable the training pattern on the sink */748748+ dp_set_training(radeon_connector, DP_TRAINING_PATTERN_DISABLE);749749+750750+ /* disable the training pattern on the source */748751 if (ASIC_IS_DCE4(rdev))749752 atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_LINK_TRAINING_COMPLETE);750753 else751754 radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_TRAINING_COMPLETE,752755 dig_connector->dp_clock, enc_id, 0);753753-754754- radeon_dp_encoder_service(rdev, ATOM_DP_ACTION_TRAINING_COMPLETE,755755- dig_connector->dp_clock, enc_id, 0);756756}757757758758int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
+4-7
drivers/gpu/drm/radeon/evergreen.c
···2626#include <linux/slab.h>2727#include "drmP.h"2828#include "radeon.h"2929+#include "radeon_asic.h"2930#include "radeon_drm.h"3031#include "rv770d.h"3132#include "atom.h"···438437439438int evergreen_mc_init(struct radeon_device *rdev)440439{441441- fixed20_12 a;442440 u32 tmp;443441 int chansize, numchan;444442···482482 rdev->mc.real_vram_size = rdev->mc.aper_size;483483 }484484 r600_vram_gtt_location(rdev, &rdev->mc);485485- /* FIXME: we should enforce default clock in case GPU is not in486486- * default setup487487- */488488- a.full = rfixed_const(100);489489- rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk);490490- rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);485485+ radeon_update_bandwidth_info(rdev);486486+491487 return 0;492488}493489···743747744748void evergreen_fini(struct radeon_device *rdev)745749{750750+ radeon_pm_fini(rdev);746751 evergreen_suspend(rdev);747752#if 0748753 r600_blit_fini(rdev);
···182182}183183184184/*185185- * determin how the encoders and audio interface is wired together186186- */187187-int r600_audio_tmds_index(struct drm_encoder *encoder)188188-{189189- struct drm_device *dev = encoder->dev;190190- struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);191191- struct drm_encoder *other;192192-193193- switch (radeon_encoder->encoder_id) {194194- case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:195195- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:196196- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:197197- return 0;198198-199199- case ENCODER_OBJECT_ID_INTERNAL_LVTM1:200200- /* special case check if an TMDS1 is present */201201- list_for_each_entry(other, &dev->mode_config.encoder_list, head) {202202- if (to_radeon_encoder(other)->encoder_id ==203203- ENCODER_OBJECT_ID_INTERNAL_TMDS1)204204- return 1;205205- }206206- return 0;207207-208208- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:209209- case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:210210- return 1;211211-212212- default:213213- DRM_ERROR("Unsupported encoder type 0x%02X\n",214214- radeon_encoder->encoder_id);215215- return -1;216216- }217217-}218218-219219-/*220185 * atach the audio codec to the clock source of the encoder221186 */222187void r600_audio_set_clock(struct drm_encoder *encoder, int clock)···189224 struct drm_device *dev = encoder->dev;190225 struct radeon_device *rdev = dev->dev_private;191226 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);227227+ struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;192228 int base_rate = 48000;193229194230 switch (radeon_encoder->encoder_id) {···197231 case ENCODER_OBJECT_ID_INTERNAL_LVTM1:198232 WREG32_P(R600_AUDIO_TIMING, 0, ~0x301);199233 break;200200-201234 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:202235 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:203236 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:204237 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:205238 WREG32_P(R600_AUDIO_TIMING, 0x100, ~0x301);206239 break;207207-208240 default:209241 DRM_ERROR("Unsupported encoder type 0x%02X\n",210242 radeon_encoder->encoder_id);211243 return;212244 }213245214214- switch (r600_audio_tmds_index(encoder)) {246246+ switch (dig->dig_encoder) {215247 case 0:216216- WREG32(R600_AUDIO_PLL1_MUL, base_rate*50);217217- WREG32(R600_AUDIO_PLL1_DIV, clock*100);248248+ WREG32(R600_AUDIO_PLL1_MUL, base_rate * 50);249249+ WREG32(R600_AUDIO_PLL1_DIV, clock * 100);218250 WREG32(R600_AUDIO_CLK_SRCSEL, 0);219251 break;220252221253 case 1:222222- WREG32(R600_AUDIO_PLL2_MUL, base_rate*50);223223- WREG32(R600_AUDIO_PLL2_DIV, clock*100);254254+ WREG32(R600_AUDIO_PLL2_MUL, base_rate * 50);255255+ WREG32(R600_AUDIO_PLL2_DIV, clock * 100);224256 WREG32(R600_AUDIO_CLK_SRCSEL, 1);225257 break;258258+ default:259259+ dev_err(rdev->dev, "Unsupported DIG on encoder 0x%02X\n",260260+ radeon_encoder->encoder_id);261261+ return;226262 }227263}228264
+35
drivers/gpu/drm/radeon/r600_blit_shaders.c
···11+/*22+ * Copyright 2009 Advanced Micro Devices, Inc.33+ *44+ * Permission is hereby granted, free of charge, to any person obtaining a55+ * copy of this software and associated documentation files (the "Software"),66+ * to deal in the Software without restriction, including without limitation77+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,88+ * and/or sell copies of the Software, and to permit persons to whom the99+ * Software is furnished to do so, subject to the following conditions:1010+ *1111+ * The above copyright notice and this permission notice (including the next1212+ * paragraph) shall be included in all copies or substantial portions of the1313+ * Software.1414+ *1515+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR1616+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,1717+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL1818+ * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR1919+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,2020+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER2121+ * DEALINGS IN THE SOFTWARE.2222+ *2323+ * Authors:2424+ * Alex Deucher <alexander.deucher@amd.com>2525+ */126227#include <linux/types.h>328#include <linux/kernel.h>2929+3030+/*3131+ * R6xx+ cards need to use the 3D engine to blit data which requires3232+ * quite a bit of hw state setup. Rather than pull the whole 3D driver3333+ * (which normally generates the 3D state) into the DRM, we opt to use3434+ * statically generated state tables. The regsiter state and shaders3535+ * were hand generated to support blitting functionality. See the 3D3636+ * driver or documentation for descriptions of the registers and3737+ * shader instructions.3838+ */439540const u32 r6xx_default_state[] =641{
···4545 u32 nbanks;4646 u32 npipes;4747 /* value we track */4848+ u32 sq_config;4849 u32 nsamples;4950 u32 cb_color_base_last[8];5051 struct radeon_bo *cb_color_bo[8];···142141{143142 int i;144143144144+ /* assume DX9 mode */145145+ track->sq_config = DX9_CONSTS;145146 for (i = 0; i < 8; i++) {146147 track->cb_color_base_last[i] = 0;147148 track->cb_color_size[i] = 0;···718715 tmp =radeon_get_ib_value(p, idx);719716 ib[idx] = 0;720717 break;718718+ case SQ_CONFIG:719719+ track->sq_config = radeon_get_ib_value(p, idx);720720+ break;721721 case R_028800_DB_DEPTH_CONTROL:722722 track->db_depth_control = radeon_get_ib_value(p, idx);723723 break;···875869 case SQ_PGM_START_VS:876870 case SQ_PGM_START_GS:877871 case SQ_PGM_START_PS:872872+ case SQ_ALU_CONST_CACHE_GS_0:873873+ case SQ_ALU_CONST_CACHE_GS_1:874874+ case SQ_ALU_CONST_CACHE_GS_2:875875+ case SQ_ALU_CONST_CACHE_GS_3:876876+ case SQ_ALU_CONST_CACHE_GS_4:877877+ case SQ_ALU_CONST_CACHE_GS_5:878878+ case SQ_ALU_CONST_CACHE_GS_6:879879+ case SQ_ALU_CONST_CACHE_GS_7:880880+ case SQ_ALU_CONST_CACHE_GS_8:881881+ case SQ_ALU_CONST_CACHE_GS_9:882882+ case SQ_ALU_CONST_CACHE_GS_10:883883+ case SQ_ALU_CONST_CACHE_GS_11:884884+ case SQ_ALU_CONST_CACHE_GS_12:885885+ case SQ_ALU_CONST_CACHE_GS_13:886886+ case SQ_ALU_CONST_CACHE_GS_14:887887+ case SQ_ALU_CONST_CACHE_GS_15:888888+ case SQ_ALU_CONST_CACHE_PS_0:889889+ case SQ_ALU_CONST_CACHE_PS_1:890890+ case SQ_ALU_CONST_CACHE_PS_2:891891+ case SQ_ALU_CONST_CACHE_PS_3:892892+ case SQ_ALU_CONST_CACHE_PS_4:893893+ case SQ_ALU_CONST_CACHE_PS_5:894894+ case SQ_ALU_CONST_CACHE_PS_6:895895+ case SQ_ALU_CONST_CACHE_PS_7:896896+ case SQ_ALU_CONST_CACHE_PS_8:897897+ case SQ_ALU_CONST_CACHE_PS_9:898898+ case SQ_ALU_CONST_CACHE_PS_10:899899+ case SQ_ALU_CONST_CACHE_PS_11:900900+ case SQ_ALU_CONST_CACHE_PS_12:901901+ case SQ_ALU_CONST_CACHE_PS_13:902902+ case SQ_ALU_CONST_CACHE_PS_14:903903+ case SQ_ALU_CONST_CACHE_PS_15:904904+ case SQ_ALU_CONST_CACHE_VS_0:905905+ case SQ_ALU_CONST_CACHE_VS_1:906906+ case SQ_ALU_CONST_CACHE_VS_2:907907+ case SQ_ALU_CONST_CACHE_VS_3:908908+ case SQ_ALU_CONST_CACHE_VS_4:909909+ case SQ_ALU_CONST_CACHE_VS_5:910910+ case SQ_ALU_CONST_CACHE_VS_6:911911+ case SQ_ALU_CONST_CACHE_VS_7:912912+ case SQ_ALU_CONST_CACHE_VS_8:913913+ case SQ_ALU_CONST_CACHE_VS_9:914914+ case SQ_ALU_CONST_CACHE_VS_10:915915+ case SQ_ALU_CONST_CACHE_VS_11:916916+ case SQ_ALU_CONST_CACHE_VS_12:917917+ case SQ_ALU_CONST_CACHE_VS_13:918918+ case SQ_ALU_CONST_CACHE_VS_14:919919+ case SQ_ALU_CONST_CACHE_VS_15:878920 r = r600_cs_packet_next_reloc(p, &reloc);879921 if (r) {880922 dev_warn(p->dev, "bad SET_CONTEXT_REG "···12801226 }12811227 break;12821228 case PACKET3_SET_ALU_CONST:12831283- start_reg = (idx_value << 2) + PACKET3_SET_ALU_CONST_OFFSET;12841284- end_reg = 4 * pkt->count + start_reg - 4;12851285- if ((start_reg < PACKET3_SET_ALU_CONST_OFFSET) ||12861286- (start_reg >= PACKET3_SET_ALU_CONST_END) ||12871287- (end_reg >= PACKET3_SET_ALU_CONST_END)) {12881288- DRM_ERROR("bad SET_ALU_CONST\n");12891289- return -EINVAL;12291229+ if (track->sq_config & DX9_CONSTS) {12301230+ start_reg = (idx_value << 2) + PACKET3_SET_ALU_CONST_OFFSET;12311231+ end_reg = 4 * pkt->count + start_reg - 4;12321232+ if ((start_reg < PACKET3_SET_ALU_CONST_OFFSET) ||12331233+ (start_reg >= PACKET3_SET_ALU_CONST_END) ||12341234+ (end_reg >= PACKET3_SET_ALU_CONST_END)) {12351235+ DRM_ERROR("bad SET_ALU_CONST\n");12361236+ return -EINVAL;12371237+ }12901238 }12911239 break;12921240 case PACKET3_SET_BOOL_CONST:
+127-76
drivers/gpu/drm/radeon/r600_hdmi.c
···4242 */4343enum r600_hdmi_iec_status_bits {4444 AUDIO_STATUS_DIG_ENABLE = 0x01,4545- AUDIO_STATUS_V = 0x02,4646- AUDIO_STATUS_VCFG = 0x04,4545+ AUDIO_STATUS_V = 0x02,4646+ AUDIO_STATUS_VCFG = 0x04,4747 AUDIO_STATUS_EMPHASIS = 0x08,4848 AUDIO_STATUS_COPYRIGHT = 0x10,4949 AUDIO_STATUS_NONAUDIO = 0x20,5050 AUDIO_STATUS_PROFESSIONAL = 0x40,5151- AUDIO_STATUS_LEVEL = 0x805151+ AUDIO_STATUS_LEVEL = 0x805252};53535454struct {···8585static void r600_hdmi_calc_CTS(uint32_t clock, int *CTS, int N, int freq)8686{8787 if (*CTS == 0)8888- *CTS = clock*N/(128*freq)*1000;8888+ *CTS = clock * N / (128 * freq) * 1000;8989 DRM_DEBUG("Using ACR timing N=%d CTS=%d for frequency %d\n",9090 N, *CTS, freq);9191}···131131 uint8_t length,132132 uint8_t *frame)133133{134134- int i;135135- frame[0] = packetType + versionNumber + length;136136- for (i = 1; i <= length; i++)137137- frame[0] += frame[i];138138- frame[0] = 0x100 - frame[0];134134+ int i;135135+ frame[0] = packetType + versionNumber + length;136136+ for (i = 1; i <= length; i++)137137+ frame[0] += frame[i];138138+ frame[0] = 0x100 - frame[0];139139}140140141141/*···417417 WREG32_P(offset+R600_HDMI_CNTL, 0x04000000, ~0x04000000);418418}419419420420-/*421421- * enable/disable the HDMI engine422422- */423423-void r600_hdmi_enable(struct drm_encoder *encoder, int enable)420420+static int r600_hdmi_find_free_block(struct drm_device *dev)421421+{422422+ struct radeon_device *rdev = dev->dev_private;423423+ struct drm_encoder *encoder;424424+ struct radeon_encoder *radeon_encoder;425425+ bool free_blocks[3] = { true, true, true };426426+427427+ list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {428428+ radeon_encoder = to_radeon_encoder(encoder);429429+ switch (radeon_encoder->hdmi_offset) {430430+ case R600_HDMI_BLOCK1:431431+ free_blocks[0] = false;432432+ break;433433+ case R600_HDMI_BLOCK2:434434+ free_blocks[1] = false;435435+ break;436436+ case R600_HDMI_BLOCK3:437437+ free_blocks[2] = false;438438+ break;439439+ }440440+ }441441+442442+ if (rdev->family == CHIP_RS600 || rdev->family == CHIP_RS690) {443443+ return free_blocks[0] ? R600_HDMI_BLOCK1 : 0;444444+ } else if (rdev->family >= CHIP_R600) {445445+ if (free_blocks[0])446446+ return R600_HDMI_BLOCK1;447447+ else if (free_blocks[1])448448+ return R600_HDMI_BLOCK2;449449+ }450450+ return 0;451451+}452452+453453+static void r600_hdmi_assign_block(struct drm_encoder *encoder)424454{425455 struct drm_device *dev = encoder->dev;426456 struct radeon_device *rdev = dev->dev_private;427457 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);428428- uint32_t offset = to_radeon_encoder(encoder)->hdmi_offset;458458+ struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;429459430430- if (!offset)460460+ if (!dig) {461461+ dev_err(rdev->dev, "Enabling HDMI on non-dig encoder\n");431462 return;463463+ }432464433433- DRM_DEBUG("%s HDMI interface @ 0x%04X\n", enable ? "Enabling" : "Disabling", offset);434434-435435- /* some version of atombios ignore the enable HDMI flag436436- * so enabling/disabling HDMI was moved here for TMDS1+2 */437437- switch (radeon_encoder->encoder_id) {438438- case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:439439- WREG32_P(AVIVO_TMDSA_CNTL, enable ? 0x4 : 0x0, ~0x4);440440- WREG32(offset+R600_HDMI_ENABLE, enable ? 0x101 : 0x0);441441- break;442442-443443- case ENCODER_OBJECT_ID_INTERNAL_LVTM1:444444- WREG32_P(AVIVO_LVTMA_CNTL, enable ? 0x4 : 0x0, ~0x4);445445- WREG32(offset+R600_HDMI_ENABLE, enable ? 0x105 : 0x0);446446- break;447447-448448- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:449449- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:450450- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:451451- case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:452452- /* This part is doubtfull in my opinion */453453- WREG32(offset+R600_HDMI_ENABLE, enable ? 0x110 : 0x0);454454- break;455455-456456- default:457457- DRM_ERROR("unknown HDMI output type\n");458458- break;465465+ if (ASIC_IS_DCE4(rdev)) {466466+ /* TODO */467467+ } else if (ASIC_IS_DCE3(rdev)) {468468+ radeon_encoder->hdmi_offset = dig->dig_encoder ?469469+ R600_HDMI_BLOCK3 : R600_HDMI_BLOCK1;470470+ if (ASIC_IS_DCE32(rdev))471471+ radeon_encoder->hdmi_config_offset = dig->dig_encoder ?472472+ R600_HDMI_CONFIG2 : R600_HDMI_CONFIG1;473473+ } else if (rdev->family >= CHIP_R600) {474474+ radeon_encoder->hdmi_offset = r600_hdmi_find_free_block(dev);459475 }460476}461477462478/*463463- * determin at which register offset the HDMI encoder is479479+ * enable the HDMI engine464480 */465465-void r600_hdmi_init(struct drm_encoder *encoder)481481+void r600_hdmi_enable(struct drm_encoder *encoder)466482{483483+ struct drm_device *dev = encoder->dev;484484+ struct radeon_device *rdev = dev->dev_private;467485 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);468486469469- switch (radeon_encoder->encoder_id) {470470- case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:471471- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:472472- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:473473- radeon_encoder->hdmi_offset = R600_HDMI_TMDS1;474474- break;475475-476476- case ENCODER_OBJECT_ID_INTERNAL_LVTM1:477477- switch (r600_audio_tmds_index(encoder)) {478478- case 0:479479- radeon_encoder->hdmi_offset = R600_HDMI_TMDS1;480480- break;481481- case 1:482482- radeon_encoder->hdmi_offset = R600_HDMI_TMDS2;483483- break;484484- default:485485- radeon_encoder->hdmi_offset = 0;486486- break;487487+ if (!radeon_encoder->hdmi_offset) {488488+ r600_hdmi_assign_block(encoder);489489+ if (!radeon_encoder->hdmi_offset) {490490+ dev_warn(rdev->dev, "Could not find HDMI block for "491491+ "0x%x encoder\n", radeon_encoder->encoder_id);492492+ return;487493 }488488- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:489489- radeon_encoder->hdmi_offset = R600_HDMI_TMDS2;490490- break;491491-492492- case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:493493- radeon_encoder->hdmi_offset = R600_HDMI_DIG;494494- break;495495-496496- default:497497- radeon_encoder->hdmi_offset = 0;498498- break;499494 }500495501501- DRM_DEBUG("using HDMI engine at offset 0x%04X for encoder 0x%x\n",502502- radeon_encoder->hdmi_offset, radeon_encoder->encoder_id);496496+ if (ASIC_IS_DCE32(rdev) && !ASIC_IS_DCE4(rdev)) {497497+ WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0x1, ~0x1);498498+ } else if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) {499499+ int offset = radeon_encoder->hdmi_offset;500500+ switch (radeon_encoder->encoder_id) {501501+ case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:502502+ WREG32_P(AVIVO_TMDSA_CNTL, 0x4, ~0x4);503503+ WREG32(offset + R600_HDMI_ENABLE, 0x101);504504+ break;505505+ case ENCODER_OBJECT_ID_INTERNAL_LVTM1:506506+ WREG32_P(AVIVO_LVTMA_CNTL, 0x4, ~0x4);507507+ WREG32(offset + R600_HDMI_ENABLE, 0x105);508508+ break;509509+ default:510510+ dev_err(rdev->dev, "Unknown HDMI output type\n");511511+ break;512512+ }513513+ }503514504504- /* TODO: make this configureable */505505- radeon_encoder->hdmi_audio_workaround = 0;515515+ DRM_DEBUG("Enabling HDMI interface @ 0x%04X for encoder 0x%x\n",516516+ radeon_encoder->hdmi_offset, radeon_encoder->encoder_id);517517+}518518+519519+/*520520+ * disable the HDMI engine521521+ */522522+void r600_hdmi_disable(struct drm_encoder *encoder)523523+{524524+ struct drm_device *dev = encoder->dev;525525+ struct radeon_device *rdev = dev->dev_private;526526+ struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);527527+528528+ if (!radeon_encoder->hdmi_offset) {529529+ dev_err(rdev->dev, "Disabling not enabled HDMI\n");530530+ return;531531+ }532532+533533+ DRM_DEBUG("Disabling HDMI interface @ 0x%04X for encoder 0x%x\n",534534+ radeon_encoder->hdmi_offset, radeon_encoder->encoder_id);535535+536536+ if (ASIC_IS_DCE32(rdev) && !ASIC_IS_DCE4(rdev)) {537537+ WREG32_P(radeon_encoder->hdmi_config_offset + 0x4, 0, ~0x1);538538+ } else if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) {539539+ int offset = radeon_encoder->hdmi_offset;540540+ switch (radeon_encoder->encoder_id) {541541+ case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:542542+ WREG32_P(AVIVO_TMDSA_CNTL, 0, ~0x4);543543+ WREG32(offset + R600_HDMI_ENABLE, 0);544544+ break;545545+ case ENCODER_OBJECT_ID_INTERNAL_LVTM1:546546+ WREG32_P(AVIVO_LVTMA_CNTL, 0, ~0x4);547547+ WREG32(offset + R600_HDMI_ENABLE, 0);548548+ break;549549+ default:550550+ dev_err(rdev->dev, "Unknown HDMI output type\n");551551+ break;552552+ }553553+ }554554+555555+ radeon_encoder->hdmi_offset = 0;556556+ radeon_encoder->hdmi_config_offset = 0;506557}
···531531 case CHIP_RS300:532532 switch (ddc_line) {533533 case RADEON_GPIO_DVI_DDC:534534- /* in theory this should be hw capable,535535- * but it doesn't seem to work536536- */537537- i2c.hw_capable = false;534534+ i2c.hw_capable = true;538535 break;539536 default:540537 i2c.hw_capable = false;···630633 p1pll->reference_div = RBIOS16(pll_info + 0x10);631634 p1pll->pll_out_min = RBIOS32(pll_info + 0x12);632635 p1pll->pll_out_max = RBIOS32(pll_info + 0x16);636636+ p1pll->lcd_pll_out_min = p1pll->pll_out_min;637637+ p1pll->lcd_pll_out_max = p1pll->pll_out_max;633638634639 if (rev > 9) {635640 p1pll->pll_in_min = RBIOS32(pll_info + 0x36);
+1-1
drivers/gpu/drm/radeon/radeon_connectors.c
···940940 if (radeon_connector->edid)941941 kfree(radeon_connector->edid);942942 if (radeon_dig_connector->dp_i2c_bus)943943- radeon_i2c_destroy_dp(radeon_dig_connector->dp_i2c_bus);943943+ radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus);944944 kfree(radeon_connector->con_priv);945945 drm_sysfs_connector_remove(connector);946946 drm_connector_cleanup(connector);
+7-4
drivers/gpu/drm/radeon/radeon_cs.c
···193193 radeon_bo_list_fence(&parser->validated, parser->ib->fence);194194 }195195 radeon_bo_list_unreserve(&parser->validated);196196- for (i = 0; i < parser->nrelocs; i++) {197197- if (parser->relocs[i].gobj)198198- drm_gem_object_unreference_unlocked(parser->relocs[i].gobj);196196+ if (parser->relocs != NULL) {197197+ for (i = 0; i < parser->nrelocs; i++) {198198+ if (parser->relocs[i].gobj)199199+ drm_gem_object_unreference_unlocked(parser->relocs[i].gobj);200200+ }199201 }200202 kfree(parser->track);201203 kfree(parser->relocs);···245243 }246244 r = radeon_cs_parser_relocs(&parser);247245 if (r) {248248- DRM_ERROR("Failed to parse relocation !\n");246246+ if (r != -ERESTARTSYS)247247+ DRM_ERROR("Failed to parse relocation %d!\n", r);249248 radeon_cs_parser_fini(&parser, r);250249 mutex_unlock(&rdev->cs_mutex);251250 return r;
+38-199
drivers/gpu/drm/radeon/radeon_device.c
···3434#include <linux/vga_switcheroo.h>3535#include "radeon_reg.h"3636#include "radeon.h"3737-#include "radeon_asic.h"3837#include "atom.h"39384039/*···242243243244}244245246246+void radeon_update_bandwidth_info(struct radeon_device *rdev)247247+{248248+ fixed20_12 a;249249+ u32 sclk, mclk;250250+251251+ if (rdev->flags & RADEON_IS_IGP) {252252+ sclk = radeon_get_engine_clock(rdev);253253+ mclk = rdev->clock.default_mclk;254254+255255+ a.full = rfixed_const(100);256256+ rdev->pm.sclk.full = rfixed_const(sclk);257257+ rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);258258+ rdev->pm.mclk.full = rfixed_const(mclk);259259+ rdev->pm.mclk.full = rfixed_div(rdev->pm.mclk, a);260260+261261+ a.full = rfixed_const(16);262262+ /* core_bandwidth = sclk(Mhz) * 16 */263263+ rdev->pm.core_bandwidth.full = rfixed_div(rdev->pm.sclk, a);264264+ } else {265265+ sclk = radeon_get_engine_clock(rdev);266266+ mclk = radeon_get_memory_clock(rdev);267267+268268+ a.full = rfixed_const(100);269269+ rdev->pm.sclk.full = rfixed_const(sclk);270270+ rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);271271+ rdev->pm.mclk.full = rfixed_const(mclk);272272+ rdev->pm.mclk.full = rfixed_div(rdev->pm.mclk, a);273273+ }274274+}275275+245276bool radeon_boot_test_post_card(struct radeon_device *rdev)246277{247278 if (radeon_card_posted(rdev))···317288 rdev->dummy_page.page = NULL;318289}319290320320-321321-/*322322- * Registers accessors functions.323323- */324324-uint32_t radeon_invalid_rreg(struct radeon_device *rdev, uint32_t reg)325325-{326326- DRM_ERROR("Invalid callback to read register 0x%04X\n", reg);327327- BUG_ON(1);328328- return 0;329329-}330330-331331-void radeon_invalid_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)332332-{333333- DRM_ERROR("Invalid callback to write register 0x%04X with 0x%08X\n",334334- reg, v);335335- BUG_ON(1);336336-}337337-338338-void radeon_register_accessor_init(struct radeon_device *rdev)339339-{340340- rdev->mc_rreg = &radeon_invalid_rreg;341341- rdev->mc_wreg = &radeon_invalid_wreg;342342- rdev->pll_rreg = &radeon_invalid_rreg;343343- rdev->pll_wreg = &radeon_invalid_wreg;344344- rdev->pciep_rreg = &radeon_invalid_rreg;345345- rdev->pciep_wreg = &radeon_invalid_wreg;346346-347347- /* Don't change order as we are overridding accessor. */348348- if (rdev->family < CHIP_RV515) {349349- rdev->pcie_reg_mask = 0xff;350350- } else {351351- rdev->pcie_reg_mask = 0x7ff;352352- }353353- /* FIXME: not sure here */354354- if (rdev->family <= CHIP_R580) {355355- rdev->pll_rreg = &r100_pll_rreg;356356- rdev->pll_wreg = &r100_pll_wreg;357357- }358358- if (rdev->family >= CHIP_R420) {359359- rdev->mc_rreg = &r420_mc_rreg;360360- rdev->mc_wreg = &r420_mc_wreg;361361- }362362- if (rdev->family >= CHIP_RV515) {363363- rdev->mc_rreg = &rv515_mc_rreg;364364- rdev->mc_wreg = &rv515_mc_wreg;365365- }366366- if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) {367367- rdev->mc_rreg = &rs400_mc_rreg;368368- rdev->mc_wreg = &rs400_mc_wreg;369369- }370370- if (rdev->family == CHIP_RS690 || rdev->family == CHIP_RS740) {371371- rdev->mc_rreg = &rs690_mc_rreg;372372- rdev->mc_wreg = &rs690_mc_wreg;373373- }374374- if (rdev->family == CHIP_RS600) {375375- rdev->mc_rreg = &rs600_mc_rreg;376376- rdev->mc_wreg = &rs600_mc_wreg;377377- }378378- if ((rdev->family >= CHIP_R600) && (rdev->family <= CHIP_RV740)) {379379- rdev->pciep_rreg = &r600_pciep_rreg;380380- rdev->pciep_wreg = &r600_pciep_wreg;381381- }382382-}383383-384384-385385-/*386386- * ASIC387387- */388388-int radeon_asic_init(struct radeon_device *rdev)389389-{390390- radeon_register_accessor_init(rdev);391391- switch (rdev->family) {392392- case CHIP_R100:393393- case CHIP_RV100:394394- case CHIP_RS100:395395- case CHIP_RV200:396396- case CHIP_RS200:397397- rdev->asic = &r100_asic;398398- break;399399- case CHIP_R200:400400- case CHIP_RV250:401401- case CHIP_RS300:402402- case CHIP_RV280:403403- rdev->asic = &r200_asic;404404- break;405405- case CHIP_R300:406406- case CHIP_R350:407407- case CHIP_RV350:408408- case CHIP_RV380:409409- if (rdev->flags & RADEON_IS_PCIE)410410- rdev->asic = &r300_asic_pcie;411411- else412412- rdev->asic = &r300_asic;413413- break;414414- case CHIP_R420:415415- case CHIP_R423:416416- case CHIP_RV410:417417- rdev->asic = &r420_asic;418418- break;419419- case CHIP_RS400:420420- case CHIP_RS480:421421- rdev->asic = &rs400_asic;422422- break;423423- case CHIP_RS600:424424- rdev->asic = &rs600_asic;425425- break;426426- case CHIP_RS690:427427- case CHIP_RS740:428428- rdev->asic = &rs690_asic;429429- break;430430- case CHIP_RV515:431431- rdev->asic = &rv515_asic;432432- break;433433- case CHIP_R520:434434- case CHIP_RV530:435435- case CHIP_RV560:436436- case CHIP_RV570:437437- case CHIP_R580:438438- rdev->asic = &r520_asic;439439- break;440440- case CHIP_R600:441441- case CHIP_RV610:442442- case CHIP_RV630:443443- case CHIP_RV620:444444- case CHIP_RV635:445445- case CHIP_RV670:446446- case CHIP_RS780:447447- case CHIP_RS880:448448- rdev->asic = &r600_asic;449449- break;450450- case CHIP_RV770:451451- case CHIP_RV730:452452- case CHIP_RV710:453453- case CHIP_RV740:454454- rdev->asic = &rv770_asic;455455- break;456456- case CHIP_CEDAR:457457- case CHIP_REDWOOD:458458- case CHIP_JUNIPER:459459- case CHIP_CYPRESS:460460- case CHIP_HEMLOCK:461461- rdev->asic = &evergreen_asic;462462- break;463463- default:464464- /* FIXME: not supported yet */465465- return -EINVAL;466466- }467467-468468- if (rdev->flags & RADEON_IS_IGP) {469469- rdev->asic->get_memory_clock = NULL;470470- rdev->asic->set_memory_clock = NULL;471471- }472472-473473- return 0;474474-}475475-476476-477477-/*478478- * Wrapper around modesetting bits.479479- */480480-int radeon_clocks_init(struct radeon_device *rdev)481481-{482482- int r;483483-484484- r = radeon_static_clocks_init(rdev->ddev);485485- if (r) {486486- return r;487487- }488488- DRM_INFO("Clocks initialized !\n");489489- return 0;490490-}491491-492492-void radeon_clocks_fini(struct radeon_device *rdev)493493-{494494-}495291496292/* ATOM accessor methods */497293static uint32_t cail_pll_read(struct card_info *info, uint32_t reg)···420566 VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;421567 else422568 return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;423423-}424424-425425-void radeon_agp_disable(struct radeon_device *rdev)426426-{427427- rdev->flags &= ~RADEON_IS_AGP;428428- if (rdev->family >= CHIP_R600) {429429- DRM_INFO("Forcing AGP to PCIE mode\n");430430- rdev->flags |= RADEON_IS_PCIE;431431- } else if (rdev->family >= CHIP_RV515 ||432432- rdev->family == CHIP_RV380 ||433433- rdev->family == CHIP_RV410 ||434434- rdev->family == CHIP_R423) {435435- DRM_INFO("Forcing AGP to PCIE mode\n");436436- rdev->flags |= RADEON_IS_PCIE;437437- rdev->asic->gart_tlb_flush = &rv370_pcie_gart_tlb_flush;438438- rdev->asic->gart_set_page = &rv370_pcie_gart_set_page;439439- } else {440440- DRM_INFO("Forcing AGP to PCI mode\n");441441- rdev->flags |= RADEON_IS_PCI;442442- rdev->asic->gart_tlb_flush = &r100_pci_gart_tlb_flush;443443- rdev->asic->gart_set_page = &r100_pci_gart_set_page;444444- }445445- rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;446569}447570448571void radeon_check_arguments(struct radeon_device *rdev)···562731 if (r)563732 return r;564733 radeon_check_arguments(rdev);734734+735735+ /* all of the newer IGP chips have an internal gart736736+ * However some rs4xx report as AGP, so remove that here.737737+ */738738+ if ((rdev->family >= CHIP_RS400) &&739739+ (rdev->flags & RADEON_IS_IGP)) {740740+ rdev->flags &= ~RADEON_IS_AGP;741741+ }565742566743 if (rdev->flags & RADEON_IS_AGP && radeon_agpmode == -1) {567744 radeon_agp_disable(rdev);
+51-17
drivers/gpu/drm/radeon/radeon_display.c
···368368369369 if (rdev->bios) {370370 if (rdev->is_atom_bios) {371371- if (rdev->family >= CHIP_R600)371371+ ret = radeon_get_atom_connector_info_from_supported_devices_table(dev);372372+ if (ret == false)372373 ret = radeon_get_atom_connector_info_from_object_table(dev);373373- else374374- ret = radeon_get_atom_connector_info_from_supported_devices_table(dev);375374 } else {376375 ret = radeon_get_legacy_connector_info_from_bios(dev);377376 if (ret == false)···468469 uint32_t best_error = 0xffffffff;469470 uint32_t best_vco_diff = 1;470471 uint32_t post_div;472472+ u32 pll_out_min, pll_out_max;471473472474 DRM_DEBUG("PLL freq %llu %u %u\n", freq, pll->min_ref_div, pll->max_ref_div);473475 freq = freq * 1000;476476+477477+ if (pll->flags & RADEON_PLL_IS_LCD) {478478+ pll_out_min = pll->lcd_pll_out_min;479479+ pll_out_max = pll->lcd_pll_out_max;480480+ } else {481481+ pll_out_min = pll->pll_out_min;482482+ pll_out_max = pll->pll_out_max;483483+ }474484475485 if (pll->flags & RADEON_PLL_USE_REF_DIV)476486 min_ref_div = max_ref_div = pll->reference_div;···544536 tmp = (uint64_t)pll->reference_freq * feedback_div;545537 vco = radeon_div(tmp, ref_div);546538547547- if (vco < pll->pll_out_min) {539539+ if (vco < pll_out_min) {548540 min_feed_div = feedback_div + 1;549541 continue;550550- } else if (vco > pll->pll_out_max) {542542+ } else if (vco > pll_out_max) {551543 max_feed_div = feedback_div;552544 continue;553545 }···683675{684676 fixed20_12 ffreq, max_error, error, pll_out, a;685677 u32 vco;678678+ u32 pll_out_min, pll_out_max;679679+680680+ if (pll->flags & RADEON_PLL_IS_LCD) {681681+ pll_out_min = pll->lcd_pll_out_min;682682+ pll_out_max = pll->lcd_pll_out_max;683683+ } else {684684+ pll_out_min = pll->pll_out_min;685685+ pll_out_max = pll->pll_out_max;686686+ }686687687688 ffreq.full = rfixed_const(freq);688689 /* max_error = ffreq * 0.0025; */···703686 vco = pll->reference_freq * (((*fb_div) * 10) + (*fb_div_frac));704687 vco = vco / ((*ref_div) * 10);705688706706- if ((vco < pll->pll_out_min) || (vco > pll->pll_out_max))689689+ if ((vco < pll_out_min) || (vco > pll_out_max))707690 continue;708691709692 /* pll_out = vco / post_div; */···731714{732715 u32 fb_div = 0, fb_div_frac = 0, post_div = 0, ref_div = 0;733716 u32 best_freq = 0, vco_frequency;717717+ u32 pll_out_min, pll_out_max;718718+719719+ if (pll->flags & RADEON_PLL_IS_LCD) {720720+ pll_out_min = pll->lcd_pll_out_min;721721+ pll_out_max = pll->lcd_pll_out_max;722722+ } else {723723+ pll_out_min = pll->pll_out_min;724724+ pll_out_max = pll->pll_out_max;725725+ }734726735727 /* freq = freq / 10; */736728 do_div(freq, 10);···750724 goto done;751725752726 vco_frequency = freq * post_div;753753- if ((vco_frequency < pll->pll_out_min) || (vco_frequency > pll->pll_out_max))727727+ if ((vco_frequency < pll_out_min) || (vco_frequency > pll_out_max))754728 goto done;755729756730 if (pll->flags & RADEON_PLL_USE_REF_DIV) {···775749 continue;776750777751 vco_frequency = freq * post_div;778778- if ((vco_frequency < pll->pll_out_min) || (vco_frequency > pll->pll_out_max))752752+ if ((vco_frequency < pll_out_min) || (vco_frequency > pll_out_max))779753 continue;780754 if (pll->flags & RADEON_PLL_USE_REF_DIV) {781755 ref_div = pll->reference_div;···971945 return 0;972946}973947948948+void radeon_update_display_priority(struct radeon_device *rdev)949949+{950950+ /* adjustment options for the display watermarks */951951+ if ((radeon_disp_priority == 0) || (radeon_disp_priority > 2)) {952952+ /* set display priority to high for r3xx, rv515 chips953953+ * this avoids flickering due to underflow to the954954+ * display controllers during heavy acceleration.955955+ */956956+ if (ASIC_IS_R300(rdev) || (rdev->family == CHIP_RV515))957957+ rdev->disp_priority = 2;958958+ else959959+ rdev->disp_priority = 0;960960+ } else961961+ rdev->disp_priority = radeon_disp_priority;962962+963963+}964964+974965int radeon_modeset_init(struct radeon_device *rdev)975966{976967 int i;···1017974 if (!rdev->is_atom_bios) {1018975 /* check for hardcoded EDID in BIOS */1019976 radeon_combios_check_hardcoded_edid(rdev);10201020- }10211021-10221022- if (rdev->flags & RADEON_SINGLE_CRTC)10231023- rdev->num_crtc = 1;10241024- else {10251025- if (ASIC_IS_DCE4(rdev))10261026- rdev->num_crtc = 6;10271027- else10281028- rdev->num_crtc = 2;1029977 }10309781031979 /* allocate crtcs */
···107107 * 1.30- Add support for occlusion queries108108 * 1.31- Add support for num Z pipes from GET_PARAM109109 * 1.32- fixes for rv740 setup110110+ * 1.33- Add r6xx/r7xx const buffer support110111 */111112#define DRIVER_MAJOR 1112112-#define DRIVER_MINOR 32113113+#define DRIVER_MINOR 33113114#define DRIVER_PATCHLEVEL 0114115115116enum radeon_cp_microcode_version {
+64-57
drivers/gpu/drm/radeon/radeon_encoders.c
···302302 }303303304304 if (ASIC_IS_DCE3(rdev) &&305305- (radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT))) {305305+ (radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT))) {306306 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);307307 radeon_dp_set_link_config(connector, mode);308308 }···519519 break;520520 }521521522522- atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev);522522+ if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))523523+ return;523524524525 switch (frev) {525526 case 1:···594593 }595594596595 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);597597- r600_hdmi_enable(encoder, hdmi_detected);598596}599597600598int···708708 struct radeon_connector_atom_dig *dig_connector =709709 radeon_get_atom_connector_priv_from_encoder(encoder);710710 union dig_encoder_control args;711711- int index = 0, num = 0;711711+ int index = 0;712712 uint8_t frev, crev;713713714714 if (!dig || !dig_connector)···724724 else725725 index = GetIndexIntoMasterTable(COMMAND, DIG1EncoderControl);726726 }727727- num = dig->dig_encoder + 1;728727729729- atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev);728728+ if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))729729+ return;730730731731 args.v1.ucAction = action;732732 args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10);···785785 struct drm_connector *connector;786786 struct radeon_connector *radeon_connector;787787 union dig_transmitter_control args;788788- int index = 0, num = 0;788788+ int index = 0;789789 uint8_t frev, crev;790790 bool is_dp = false;791791 int pll_id = 0;···814814 }815815 }816816817817- atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev);817817+ if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))818818+ return;818819819820 args.v1.ucAction = action;820821 if (action == ATOM_TRANSMITTER_ACTION_INIT) {···861860 switch (radeon_encoder->encoder_id) {862861 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:863862 args.v3.acConfig.ucTransmitterSel = 0;864864- num = 0;865863 break;866864 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:867865 args.v3.acConfig.ucTransmitterSel = 1;868868- num = 1;869866 break;870867 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:871868 args.v3.acConfig.ucTransmitterSel = 2;872872- num = 2;873869 break;874870 }875871···877879 args.v3.acConfig.fCoherentMode = 1;878880 }879881 } else if (ASIC_IS_DCE32(rdev)) {880880- if (dig->dig_encoder == 1)881881- args.v2.acConfig.ucEncoderSel = 1;882882+ args.v2.acConfig.ucEncoderSel = dig->dig_encoder;882883 if (dig_connector->linkb)883884 args.v2.acConfig.ucLinkSel = 1;884885885886 switch (radeon_encoder->encoder_id) {886887 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:887888 args.v2.acConfig.ucTransmitterSel = 0;888888- num = 0;889889 break;890890 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:891891 args.v2.acConfig.ucTransmitterSel = 1;892892- num = 1;893892 break;894893 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:895894 args.v2.acConfig.ucTransmitterSel = 2;896896- num = 2;897895 break;898896 }899897···907913 else908914 args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_DIG1_ENCODER;909915910910- switch (radeon_encoder->encoder_id) {911911- case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:912912- if (rdev->flags & RADEON_IS_IGP) {913913- if (radeon_encoder->pixel_clock > 165000) {914914- if (dig_connector->igp_lane_info & 0x3)915915- args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_7;916916- else if (dig_connector->igp_lane_info & 0xc)917917- args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_15;918918- } else {919919- if (dig_connector->igp_lane_info & 0x1)920920- args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_3;921921- else if (dig_connector->igp_lane_info & 0x2)922922- args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_4_7;923923- else if (dig_connector->igp_lane_info & 0x4)924924- args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_11;925925- else if (dig_connector->igp_lane_info & 0x8)926926- args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_12_15;927927- }916916+ if ((rdev->flags & RADEON_IS_IGP) &&917917+ (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_UNIPHY)) {918918+ if (is_dp || (radeon_encoder->pixel_clock <= 165000)) {919919+ if (dig_connector->igp_lane_info & 0x1)920920+ args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_3;921921+ else if (dig_connector->igp_lane_info & 0x2)922922+ args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_4_7;923923+ else if (dig_connector->igp_lane_info & 0x4)924924+ args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_11;925925+ else if (dig_connector->igp_lane_info & 0x8)926926+ args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_12_15;927927+ } else {928928+ if (dig_connector->igp_lane_info & 0x3)929929+ args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_0_7;930930+ else if (dig_connector->igp_lane_info & 0xc)931931+ args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LANE_8_15;928932 }929929- break;930933 }931931-932932- if (radeon_encoder->pixel_clock > 165000)933933- args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_8LANE_LINK;934934935935 if (dig_connector->linkb)936936 args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_LINKB;···936948 else if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) {937949 if (dig->coherent_mode)938950 args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_COHERENT;951951+ if (radeon_encoder->pixel_clock > 165000)952952+ args.v1.ucConfig |= ATOM_TRANSMITTER_CONFIG_8LANE_LINK;939953 }940954 }941955···10441054 if (is_dig) {10451055 switch (mode) {10461056 case DRM_MODE_DPMS_ON:10471047- atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);10481048- {10571057+ if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) {10491058 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);10591059+10501060 dp_link_train(encoder, connector);10611061+ if (ASIC_IS_DCE4(rdev))10621062+ atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON);10511063 }10641064+ if (!ASIC_IS_DCE4(rdev))10651065+ atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);10521066 break;10531067 case DRM_MODE_DPMS_STANDBY:10541068 case DRM_MODE_DPMS_SUSPEND:10551069 case DRM_MODE_DPMS_OFF:10561056- atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0);10701070+ if (!ASIC_IS_DCE4(rdev))10711071+ atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0);10721072+ if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_DP) {10731073+ if (ASIC_IS_DCE4(rdev))10741074+ atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF);10751075+ }10571076 break;10581077 }10591078 } else {···1103110411041105 memset(&args, 0, sizeof(args));1105110611061106- atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev);11071107+ if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))11081108+ return;1107110911081110 switch (frev) {11091111 case 1:···12161216 }1217121712181218 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);12191219+12201220+ /* update scratch regs with new routing */12211221+ radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);12191222}1220122312211224static void···13291326 struct drm_device *dev = encoder->dev;13301327 struct radeon_device *rdev = dev->dev_private;13311328 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);13321332- struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);1333132913341334- if (radeon_encoder->active_device &13351335- (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) {13361336- struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;13371337- if (dig)13381338- dig->dig_encoder = radeon_atom_pick_dig_encoder(encoder);13391339- }13401330 radeon_encoder->pixel_clock = adjusted_mode->clock;13411341-13421342- radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);13431343- atombios_set_encoder_crtc_source(encoder);1344133113451332 if (ASIC_IS_AVIVO(rdev)) {13461333 if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT))···13891396 }13901397 atombios_apply_encoder_quirks(encoder, adjusted_mode);1391139813921392- /* XXX */13931393- if (!ASIC_IS_DCE4(rdev))13991399+ if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) {14001400+ r600_hdmi_enable(encoder);13941401 r600_hdmi_setmode(encoder, adjusted_mode);14021402+ }13951403}1396140413971405static bool···1412141814131419 memset(&args, 0, sizeof(args));1414142014151415- atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev);14211421+ if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))14221422+ return false;1416142314171424 args.sDacload.ucMisc = 0;14181425···1487149214881493static void radeon_atom_encoder_prepare(struct drm_encoder *encoder)14891494{14951495+ struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);14961496+14971497+ if (radeon_encoder->active_device &14981498+ (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) {14991499+ struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;15001500+ if (dig)15011501+ dig->dig_encoder = radeon_atom_pick_dig_encoder(encoder);15021502+ }15031503+14901504 radeon_atom_output_lock(encoder, true);14911505 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);15061506+15071507+ /* this is needed for the pll/ss setup to work correctly in some cases */15081508+ atombios_set_encoder_crtc_source(encoder);14921509}1493151014941511static void radeon_atom_encoder_commit(struct drm_encoder *encoder)···15161509 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);1517151015181511 if (radeon_encoder_is_digital(encoder)) {15121512+ if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI)15131513+ r600_hdmi_disable(encoder);15191514 dig = radeon_encoder->enc_priv;15201515 dig->dig_encoder = -1;15211516 }···16681659 drm_encoder_helper_add(encoder, &radeon_atom_dig_helper_funcs);16691660 break;16701661 }16711671-16721672- r600_hdmi_init(encoder);16731662}
+73-80
drivers/gpu/drm/radeon/radeon_i2c.c
···5959 return false;6060}61616262+/* bit banging i2c */62636364static void radeon_i2c_do_lock(struct radeon_i2c_chan *i2c, int lock_state)6465{···182181 WREG32(rec->en_data_reg, val);183182}184183184184+static int pre_xfer(struct i2c_adapter *i2c_adap)185185+{186186+ struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap);187187+188188+ radeon_i2c_do_lock(i2c, 1);189189+190190+ return 0;191191+}192192+193193+static void post_xfer(struct i2c_adapter *i2c_adap)194194+{195195+ struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap);196196+197197+ radeon_i2c_do_lock(i2c, 0);198198+}199199+200200+/* hw i2c */201201+185202static u32 radeon_get_i2c_prescale(struct radeon_device *rdev)186203{187187- struct radeon_pll *spll = &rdev->clock.spll;188204 u32 sclk = radeon_get_engine_clock(rdev);189205 u32 prescale = 0;190190- u32 n, m;191191- u8 loop;206206+ u32 nm;207207+ u8 n, m, loop;192208 int i2c_clock;193209194210 switch (rdev->family) {···221203 case CHIP_R300:222204 case CHIP_R350:223205 case CHIP_RV350:224224- n = (spll->reference_freq) / (4 * 6);206206+ i2c_clock = 60;207207+ nm = (sclk * 10) / (i2c_clock * 4);225208 for (loop = 1; loop < 255; loop++) {226226- if ((loop * (loop - 1)) > n)209209+ if ((nm / loop) < loop)227210 break;228211 }229229- m = loop - 1;230230- prescale = m | (loop << 8);212212+ n = loop - 1;213213+ m = loop - 2;214214+ prescale = m | (n << 8);231215 break;232216 case CHIP_RV380:233217 case CHIP_RS400:···237217 case CHIP_R420:238218 case CHIP_R423:239219 case CHIP_RV410:240240- sclk = radeon_get_engine_clock(rdev);241220 prescale = (((sclk * 10)/(4 * 128 * 100) + 1) << 8) + 128;242221 break;243222 case CHIP_RS600:···251232 case CHIP_RV570:252233 case CHIP_R580:253234 i2c_clock = 50;254254- sclk = radeon_get_engine_clock(rdev);255235 if (rdev->family == CHIP_R520)256236 prescale = (127 << 8) + ((sclk * 10) / (4 * 127 * i2c_clock));257237 else···309291 prescale = radeon_get_i2c_prescale(rdev);310292311293 reg = ((prescale << RADEON_I2C_PRESCALE_SHIFT) |294294+ RADEON_I2C_DRIVE_EN |312295 RADEON_I2C_START |313296 RADEON_I2C_STOP |314297 RADEON_I2C_GO);···776757 return ret;777758}778759779779-static int radeon_sw_i2c_xfer(struct i2c_adapter *i2c_adap,760760+static int radeon_hw_i2c_xfer(struct i2c_adapter *i2c_adap,780761 struct i2c_msg *msgs, int num)781781-{782782- struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap);783783- int ret;784784-785785- radeon_i2c_do_lock(i2c, 1);786786- ret = i2c_transfer(&i2c->algo.radeon.bit_adapter, msgs, num);787787- radeon_i2c_do_lock(i2c, 0);788788-789789- return ret;790790-}791791-792792-static int radeon_i2c_xfer(struct i2c_adapter *i2c_adap,793793- struct i2c_msg *msgs, int num)794762{795763 struct radeon_i2c_chan *i2c = i2c_get_adapdata(i2c_adap);796764 struct radeon_device *rdev = i2c->dev->dev_private;797765 struct radeon_i2c_bus_rec *rec = &i2c->rec;798798- int ret;766766+ int ret = 0;799767800768 switch (rdev->family) {801769 case CHIP_R100:···803797 case CHIP_RV410:804798 case CHIP_RS400:805799 case CHIP_RS480:806806- if (rec->hw_capable)807807- ret = r100_hw_i2c_xfer(i2c_adap, msgs, num);808808- else809809- ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num);800800+ ret = r100_hw_i2c_xfer(i2c_adap, msgs, num);810801 break;811802 case CHIP_RS600:812803 case CHIP_RS690:813804 case CHIP_RS740:814805 /* XXX fill in hw i2c implementation */815815- ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num);816806 break;817807 case CHIP_RV515:818808 case CHIP_R520:···816814 case CHIP_RV560:817815 case CHIP_RV570:818816 case CHIP_R580:819819- if (rec->hw_capable) {820820- if (rec->mm_i2c)821821- ret = r100_hw_i2c_xfer(i2c_adap, msgs, num);822822- else823823- ret = r500_hw_i2c_xfer(i2c_adap, msgs, num);824824- } else825825- ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num);817817+ if (rec->mm_i2c)818818+ ret = r100_hw_i2c_xfer(i2c_adap, msgs, num);819819+ else820820+ ret = r500_hw_i2c_xfer(i2c_adap, msgs, num);826821 break;827822 case CHIP_R600:828823 case CHIP_RV610:829824 case CHIP_RV630:830825 case CHIP_RV670:831826 /* XXX fill in hw i2c implementation */832832- ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num);833827 break;834828 case CHIP_RV620:835829 case CHIP_RV635:···836838 case CHIP_RV710:837839 case CHIP_RV740:838840 /* XXX fill in hw i2c implementation */839839- ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num);840841 break;841842 case CHIP_CEDAR:842843 case CHIP_REDWOOD:···843846 case CHIP_CYPRESS:844847 case CHIP_HEMLOCK:845848 /* XXX fill in hw i2c implementation */846846- ret = radeon_sw_i2c_xfer(i2c_adap, msgs, num);847849 break;848850 default:849851 DRM_ERROR("i2c: unhandled radeon chip\n");···853857 return ret;854858}855859856856-static u32 radeon_i2c_func(struct i2c_adapter *adap)860860+static u32 radeon_hw_i2c_func(struct i2c_adapter *adap)857861{858862 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;859863}860864861865static const struct i2c_algorithm radeon_i2c_algo = {862862- .master_xfer = radeon_i2c_xfer,863863- .functionality = radeon_i2c_func,866866+ .master_xfer = radeon_hw_i2c_xfer,867867+ .functionality = radeon_hw_i2c_func,864868};865869866870struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,867871 struct radeon_i2c_bus_rec *rec,868872 const char *name)869873{874874+ struct radeon_device *rdev = dev->dev_private;870875 struct radeon_i2c_chan *i2c;871876 int ret;872877···875878 if (i2c == NULL)876879 return NULL;877880878878- /* set the internal bit adapter */879879- i2c->algo.radeon.bit_adapter.owner = THIS_MODULE;880880- i2c_set_adapdata(&i2c->algo.radeon.bit_adapter, i2c);881881- sprintf(i2c->algo.radeon.bit_adapter.name, "Radeon internal i2c bit bus %s", name);882882- i2c->algo.radeon.bit_adapter.algo_data = &i2c->algo.radeon.bit_data;883883- i2c->algo.radeon.bit_data.setsda = set_data;884884- i2c->algo.radeon.bit_data.setscl = set_clock;885885- i2c->algo.radeon.bit_data.getsda = get_data;886886- i2c->algo.radeon.bit_data.getscl = get_clock;887887- i2c->algo.radeon.bit_data.udelay = 20;888888- /* vesa says 2.2 ms is enough, 1 jiffy doesn't seem to always889889- * make this, 2 jiffies is a lot more reliable */890890- i2c->algo.radeon.bit_data.timeout = 2;891891- i2c->algo.radeon.bit_data.data = i2c;892892- ret = i2c_bit_add_bus(&i2c->algo.radeon.bit_adapter);893893- if (ret) {894894- DRM_ERROR("Failed to register internal bit i2c %s\n", name);895895- goto out_free;896896- }897897- /* set the radeon i2c adapter */898898- i2c->dev = dev;899881 i2c->rec = *rec;900882 i2c->adapter.owner = THIS_MODULE;883883+ i2c->dev = dev;901884 i2c_set_adapdata(&i2c->adapter, i2c);902902- sprintf(i2c->adapter.name, "Radeon i2c %s", name);903903- i2c->adapter.algo_data = &i2c->algo.radeon;904904- i2c->adapter.algo = &radeon_i2c_algo;905905- ret = i2c_add_adapter(&i2c->adapter);906906- if (ret) {907907- DRM_ERROR("Failed to register i2c %s\n", name);908908- goto out_free;885885+ if (rec->mm_i2c ||886886+ (rec->hw_capable &&887887+ radeon_hw_i2c &&888888+ ((rdev->family <= CHIP_RS480) ||889889+ ((rdev->family >= CHIP_RV515) && (rdev->family <= CHIP_R580))))) {890890+ /* set the radeon hw i2c adapter */891891+ sprintf(i2c->adapter.name, "Radeon i2c hw bus %s", name);892892+ i2c->adapter.algo = &radeon_i2c_algo;893893+ ret = i2c_add_adapter(&i2c->adapter);894894+ if (ret) {895895+ DRM_ERROR("Failed to register hw i2c %s\n", name);896896+ goto out_free;897897+ }898898+ } else {899899+ /* set the radeon bit adapter */900900+ sprintf(i2c->adapter.name, "Radeon i2c bit bus %s", name);901901+ i2c->adapter.algo_data = &i2c->algo.bit;902902+ i2c->algo.bit.pre_xfer = pre_xfer;903903+ i2c->algo.bit.post_xfer = post_xfer;904904+ i2c->algo.bit.setsda = set_data;905905+ i2c->algo.bit.setscl = set_clock;906906+ i2c->algo.bit.getsda = get_data;907907+ i2c->algo.bit.getscl = get_clock;908908+ i2c->algo.bit.udelay = 20;909909+ /* vesa says 2.2 ms is enough, 1 jiffy doesn't seem to always910910+ * make this, 2 jiffies is a lot more reliable */911911+ i2c->algo.bit.timeout = 2;912912+ i2c->algo.bit.data = i2c;913913+ ret = i2c_bit_add_bus(&i2c->adapter);914914+ if (ret) {915915+ DRM_ERROR("Failed to register bit i2c %s\n", name);916916+ goto out_free;917917+ }909918 }910919911920 return i2c;···956953{957954 if (!i2c)958955 return;959959- i2c_del_adapter(&i2c->algo.radeon.bit_adapter);960960- i2c_del_adapter(&i2c->adapter);961961- kfree(i2c);962962-}963963-964964-void radeon_i2c_destroy_dp(struct radeon_i2c_chan *i2c)965965-{966966- if (!i2c)967967- return;968968-969956 i2c_del_adapter(&i2c->adapter);970957 kfree(i2c);971958}
+11-9
drivers/gpu/drm/radeon/radeon_irq_kms.c
···67676868 /* Disable *all* interrupts */6969 rdev->irq.sw_int = false;7070- for (i = 0; i < 2; i++) {7070+ for (i = 0; i < rdev->num_crtc; i++)7171 rdev->irq.crtc_vblank_int[i] = false;7272- }7272+ for (i = 0; i < 6; i++)7373+ rdev->irq.hpd[i] = false;7374 radeon_irq_set(rdev);7475 /* Clear bits */7576 radeon_irq_process(rdev);···9695 }9796 /* Disable *all* interrupts */9897 rdev->irq.sw_int = false;9999- for (i = 0; i < 2; i++) {9898+ for (i = 0; i < rdev->num_crtc; i++)10099 rdev->irq.crtc_vblank_int[i] = false;100100+ for (i = 0; i < 6; i++)101101 rdev->irq.hpd[i] = false;102102- }103102 radeon_irq_set(rdev);104103}105104106105int radeon_irq_kms_init(struct radeon_device *rdev)107106{108107 int r = 0;109109- int num_crtc = 2;110108111111- if (rdev->flags & RADEON_SINGLE_CRTC)112112- num_crtc = 1;113109 spin_lock_init(&rdev->irq.sw_lock);114114- r = drm_vblank_init(rdev->ddev, num_crtc);110110+ r = drm_vblank_init(rdev->ddev, rdev->num_crtc);115111 if (r) {116112 return r;117113 }118114 /* enable msi */119115 rdev->msi_enabled = 0;120120- if (rdev->family >= CHIP_RV380) {116116+ /* MSIs don't seem to work reliably on all IGP117117+ * chips. Disable MSI on them for now.118118+ */119119+ if ((rdev->family >= CHIP_RV380) &&120120+ (!(rdev->flags & RADEON_IS_IGP))) {121121 int ret = pci_enable_msi(rdev->pdev);122122 if (!ret) {123123 rdev->msi_enabled = 1;
+8
drivers/gpu/drm/radeon/radeon_legacy_crtc.c
···603603 ? RADEON_CRTC2_INTERLACE_EN604604 : 0));605605606606+ /* rs4xx chips seem to like to have the crtc enabled when the timing is set */607607+ if ((rdev->family == CHIP_RS400) || (rdev->family == CHIP_RS480))608608+ crtc2_gen_cntl |= RADEON_CRTC2_EN;609609+606610 disp2_merge_cntl = RREG32(RADEON_DISP2_MERGE_CNTL);607611 disp2_merge_cntl &= ~RADEON_DISP2_RGB_OFFSET_EN;608612···633629 | ((mode->flags & DRM_MODE_FLAG_INTERLACE)634630 ? RADEON_CRTC_INTERLACE_EN635631 : 0));632632+633633+ /* rs4xx chips seem to like to have the crtc enabled when the timing is set */634634+ if ((rdev->family == CHIP_RS400) || (rdev->family == CHIP_RS480))635635+ crtc_gen_cntl |= RADEON_CRTC_EN;636636637637 crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);638638 crtc_ext_cntl |= (RADEON_XCRT_CNT_EN |
···186186 return 0;187187 }188188 radeon_ttm_placement_from_domain(bo, domain);189189- /* force to pin into visible video ram */190190- bo->placement.lpfn = bo->rdev->mc.visible_vram_size >> PAGE_SHIFT;189189+ if (domain == RADEON_GEM_DOMAIN_VRAM) {190190+ /* force to pin into visible video ram */191191+ bo->placement.lpfn = bo->rdev->mc.visible_vram_size >> PAGE_SHIFT;192192+ }191193 for (i = 0; i < bo->placement.num_placement; i++)192194 bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;193195 r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
+37-9
drivers/gpu/drm/radeon/radeon_pm.c
···2828#define RADEON_RECLOCK_DELAY_MS 2002929#define RADEON_WAIT_VBLANK_TIMEOUT 20030303131+static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);3132static void radeon_pm_set_clocks_locked(struct radeon_device *rdev);3233static void radeon_pm_set_clocks(struct radeon_device *rdev);3334static void radeon_pm_idle_work_handler(struct work_struct *work);···180179 rdev->pm.requested_power_state->non_clock_info.pcie_lanes);181180}182181182182+static inline void radeon_sync_with_vblank(struct radeon_device *rdev)183183+{184184+ if (rdev->pm.active_crtcs) {185185+ rdev->pm.vblank_sync = false;186186+ wait_event_timeout(187187+ rdev->irq.vblank_queue, rdev->pm.vblank_sync,188188+ msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT));189189+ }190190+}191191+183192static void radeon_set_power_state(struct radeon_device *rdev)184193{185194 /* if *_clock_mode are the same, *_power_state are as well */···200189 rdev->pm.requested_clock_mode->sclk,201190 rdev->pm.requested_clock_mode->mclk,202191 rdev->pm.requested_power_state->non_clock_info.pcie_lanes);192192+203193 /* set pcie lanes */194194+ /* TODO */195195+204196 /* set voltage */197197+ /* TODO */198198+205199 /* set engine clock */200200+ radeon_sync_with_vblank(rdev);201201+ radeon_pm_debug_check_in_vbl(rdev, false);206202 radeon_set_engine_clock(rdev, rdev->pm.requested_clock_mode->sclk);203203+ radeon_pm_debug_check_in_vbl(rdev, true);204204+205205+#if 0207206 /* set memory clock */207207+ if (rdev->asic->set_memory_clock) {208208+ radeon_sync_with_vblank(rdev);209209+ radeon_pm_debug_check_in_vbl(rdev, false);210210+ radeon_set_memory_clock(rdev, rdev->pm.requested_clock_mode->mclk);211211+ radeon_pm_debug_check_in_vbl(rdev, true);212212+ }213213+#endif208214209215 rdev->pm.current_power_state = rdev->pm.requested_power_state;210216 rdev->pm.current_clock_mode = rdev->pm.requested_clock_mode;···257229 return 0;258230}259231232232+void radeon_pm_fini(struct radeon_device *rdev)233233+{234234+ if (rdev->pm.i2c_bus)235235+ radeon_i2c_destroy(rdev->pm.i2c_bus);236236+}237237+260238void radeon_pm_compute_clocks(struct radeon_device *rdev)261239{262240 struct drm_device *ddev = rdev->ddev;···279245 list_for_each_entry(connector,280246 &ddev->mode_config.connector_list, head) {281247 if (connector->encoder &&282282- connector->dpms != DRM_MODE_DPMS_OFF) {248248+ connector->encoder->crtc &&249249+ connector->dpms != DRM_MODE_DPMS_OFF) {283250 radeon_crtc = to_radeon_crtc(connector->encoder->crtc);284251 rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id);285252 ++count;···368333 break;369334 }370335371371- /* check if we are in vblank */372372- radeon_pm_debug_check_in_vbl(rdev, false);373336 radeon_set_power_state(rdev);374374- radeon_pm_debug_check_in_vbl(rdev, true);375337 rdev->pm.planned_action = PM_ACTION_NONE;376338}377339···385353 rdev->pm.req_vblank |= (1 << 1);386354 drm_vblank_get(rdev->ddev, 1);387355 }388388- if (rdev->pm.active_crtcs)389389- wait_event_interruptible_timeout(390390- rdev->irq.vblank_queue, 0,391391- msecs_to_jiffies(RADEON_WAIT_VBLANK_TIMEOUT));356356+ radeon_pm_set_clocks_locked(rdev);392357 if (rdev->pm.req_vblank & (1 << 0)) {393358 rdev->pm.req_vblank &= ~(1 << 0);394359 drm_vblank_put(rdev->ddev, 0);···395366 drm_vblank_put(rdev->ddev, 1);396367 }397368398398- radeon_pm_set_clocks_locked(rdev);399369 mutex_unlock(&rdev->cp.mutex);400370}401371
···295295 /* On x86 a breakpoint stop requires it to be decremented */296296 if (addr + 1 == kgdbts_regs.ip)297297 offset = -1;298298+#elif defined(CONFIG_SUPERH)299299+ /* On SUPERH a breakpoint stop requires it to be decremented */300300+ if (addr + 2 == kgdbts_regs.pc)301301+ offset = -2;298302#endif299303 if (strcmp(arg, "silent") &&300304 instruction_pointer(&kgdbts_regs) + offset != addr) {···309305#ifdef CONFIG_X86310306 /* On x86 adjust the instruction pointer if needed */311307 kgdbts_regs.ip += offset;308308+#elif defined(CONFIG_SUPERH)309309+ kgdbts_regs.pc += offset;312310#endif313311 return 0;314312}
+5-2
drivers/of/fdt.c
···376376 if (!np->type)377377 np->type = "<NULL>";378378 }379379- while (tag == OF_DT_BEGIN_NODE) {380380- mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);379379+ while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) {380380+ if (tag == OF_DT_NOP)381381+ *p += 4;382382+ else383383+ mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);381384 tag = be32_to_cpup((__be32 *)(*p));382385 }383386 if (tag != OF_DT_END_NODE) {
+3-33
drivers/pci/quirks.c
···21232123 }21242124}21252125DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi);21262126+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x9602, quirk_disable_msi);21272127+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASUSTEK, 0x9602, quirk_disable_msi);21282128+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AI, 0x9602, quirk_disable_msi);21262129DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0xa238, quirk_disable_msi);2127213021282131/* Go through the list of Hypertransport capabilities and···24972494 quirk_msi_intx_disable_bug);24982495DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375,24992496 quirk_msi_intx_disable_bug);25002500-25012501-/*25022502- * MSI does not work with the AMD RS780/RS880 internal graphics and HDMI audio25032503- * devices unless the BIOS has initialized the nb_cntl.strap_msi_enable bit.25042504- */25052505-static void __init rs780_int_gfx_disable_msi(struct pci_dev *int_gfx_bridge)25062506-{25072507- u32 nb_cntl;25082508-25092509- if (!int_gfx_bridge->subordinate)25102510- return;25112511-25122512- pci_bus_write_config_dword(int_gfx_bridge->bus, PCI_DEVFN(0, 0),25132513- 0x60, 0);25142514- pci_bus_read_config_dword(int_gfx_bridge->bus, PCI_DEVFN(0, 0),25152515- 0x64, &nb_cntl);25162516-25172517- if (!(nb_cntl & BIT(10))) {25182518- dev_warn(&int_gfx_bridge->dev,25192519- FW_WARN "RS780: MSI for internal graphics disabled\n");25202520- int_gfx_bridge->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;25212521- }25222522-}25232523-25242524-#define PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX 0x960225252525-25262526-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD,25272527- PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX,25282528- rs780_int_gfx_disable_msi);25292529-/* wrong vendor ID on M4A785TD motherboard: */25302530-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASUSTEK,25312531- PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX,25322532- rs780_int_gfx_disable_msi);2533249725342498#endif /* CONFIG_PCI_MSI */25352499
+10
drivers/platform/x86/Kconfig
···385385386386 If you have an Eee PC laptop, say Y or M here.387387388388+config EEEPC_WMI389389+ tristate "Eee PC WMI Hotkey Driver (EXPERIMENTAL)"390390+ depends on ACPI_WMI391391+ depends on INPUT392392+ depends on EXPERIMENTAL393393+ ---help---394394+ Say Y here if you want to support WMI-based hotkeys on Eee PC laptops.395395+396396+ To compile this driver as a module, choose M here: the module will397397+ be called eeepc-wmi.388398389399config ACPI_WMI390400 tristate "WMI"
···11+/*22+ * Eee PC WMI hotkey driver33+ *44+ * Copyright(C) 2010 Intel Corporation.55+ *66+ * Portions based on wistron_btns.c:77+ * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>88+ * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>99+ * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>1010+ *1111+ * This program is free software; you can redistribute it and/or modify1212+ * it under the terms of the GNU General Public License as published by1313+ * the Free Software Foundation; either version 2 of the License, or1414+ * (at your option) any later version.1515+ *1616+ * This program is distributed in the hope that it will be useful,1717+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1818+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1919+ * GNU General Public License for more details.2020+ *2121+ * You should have received a copy of the GNU General Public License2222+ * along with this program; if not, write to the Free Software2323+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA2424+ */2525+2626+#include <linux/kernel.h>2727+#include <linux/module.h>2828+#include <linux/init.h>2929+#include <linux/types.h>3030+#include <linux/input.h>3131+#include <linux/input/sparse-keymap.h>3232+#include <acpi/acpi_bus.h>3333+#include <acpi/acpi_drivers.h>3434+3535+MODULE_AUTHOR("Yong Wang <yong.y.wang@intel.com>");3636+MODULE_DESCRIPTION("Eee PC WMI Hotkey Driver");3737+MODULE_LICENSE("GPL");3838+3939+#define EEEPC_WMI_EVENT_GUID "ABBC0F72-8EA1-11D1-00A0-C90629100000"4040+4141+MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID);4242+4343+#define NOTIFY_BRNUP_MIN 0x114444+#define NOTIFY_BRNUP_MAX 0x1f4545+#define NOTIFY_BRNDOWN_MIN 0x204646+#define NOTIFY_BRNDOWN_MAX 0x2e4747+4848+static const struct key_entry eeepc_wmi_keymap[] = {4949+ /* Sleep already handled via generic ACPI code */5050+ { KE_KEY, 0x5d, { KEY_WLAN } },5151+ { KE_KEY, 0x32, { KEY_MUTE } },5252+ { KE_KEY, 0x31, { KEY_VOLUMEDOWN } },5353+ { KE_KEY, 0x30, { KEY_VOLUMEUP } },5454+ { KE_IGNORE, NOTIFY_BRNDOWN_MIN, { KEY_BRIGHTNESSDOWN } },5555+ { KE_IGNORE, NOTIFY_BRNUP_MIN, { KEY_BRIGHTNESSUP } },5656+ { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } },5757+ { KE_END, 0},5858+};5959+6060+static struct input_dev *eeepc_wmi_input_dev;6161+6262+static void eeepc_wmi_notify(u32 value, void *context)6363+{6464+ struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };6565+ union acpi_object *obj;6666+ acpi_status status;6767+ int code;6868+6969+ status = wmi_get_event_data(value, &response);7070+ if (status != AE_OK) {7171+ pr_err("EEEPC WMI: bad event status 0x%x\n", status);7272+ return;7373+ }7474+7575+ obj = (union acpi_object *)response.pointer;7676+7777+ if (obj && obj->type == ACPI_TYPE_INTEGER) {7878+ code = obj->integer.value;7979+8080+ if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX)8181+ code = NOTIFY_BRNUP_MIN;8282+ else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX)8383+ code = NOTIFY_BRNDOWN_MIN;8484+8585+ if (!sparse_keymap_report_event(eeepc_wmi_input_dev,8686+ code, 1, true))8787+ pr_info("EEEPC WMI: Unknown key %x pressed\n", code);8888+ }8989+9090+ kfree(obj);9191+}9292+9393+static int eeepc_wmi_input_setup(void)9494+{9595+ int err;9696+9797+ eeepc_wmi_input_dev = input_allocate_device();9898+ if (!eeepc_wmi_input_dev)9999+ return -ENOMEM;100100+101101+ eeepc_wmi_input_dev->name = "Eee PC WMI hotkeys";102102+ eeepc_wmi_input_dev->phys = "wmi/input0";103103+ eeepc_wmi_input_dev->id.bustype = BUS_HOST;104104+105105+ err = sparse_keymap_setup(eeepc_wmi_input_dev, eeepc_wmi_keymap, NULL);106106+ if (err)107107+ goto err_free_dev;108108+109109+ err = input_register_device(eeepc_wmi_input_dev);110110+ if (err)111111+ goto err_free_keymap;112112+113113+ return 0;114114+115115+err_free_keymap:116116+ sparse_keymap_free(eeepc_wmi_input_dev);117117+err_free_dev:118118+ input_free_device(eeepc_wmi_input_dev);119119+ return err;120120+}121121+122122+static int __init eeepc_wmi_init(void)123123+{124124+ int err;125125+ acpi_status status;126126+127127+ if (!wmi_has_guid(EEEPC_WMI_EVENT_GUID)) {128128+ pr_warning("EEEPC WMI: No known WMI GUID found\n");129129+ return -ENODEV;130130+ }131131+132132+ err = eeepc_wmi_input_setup();133133+ if (err)134134+ return err;135135+136136+ status = wmi_install_notify_handler(EEEPC_WMI_EVENT_GUID,137137+ eeepc_wmi_notify, NULL);138138+ if (ACPI_FAILURE(status)) {139139+ sparse_keymap_free(eeepc_wmi_input_dev);140140+ input_unregister_device(eeepc_wmi_input_dev);141141+ pr_err("EEEPC WMI: Unable to register notify handler - %d\n",142142+ status);143143+ return -ENODEV;144144+ }145145+146146+ return 0;147147+}148148+149149+static void __exit eeepc_wmi_exit(void)150150+{151151+ wmi_remove_notify_handler(EEEPC_WMI_EVENT_GUID);152152+ sparse_keymap_free(eeepc_wmi_input_dev);153153+ input_unregister_device(eeepc_wmi_input_dev);154154+}155155+156156+module_init(eeepc_wmi_init);157157+module_exit(eeepc_wmi_exit);
···8181 prefetchw(&bvec->bv_page->flags);82828383 end_page_writeback(page);8484+ page_cache_release(page);8485 } while (bvec >= bio->bi_io_vec);8586 bio_put(bio);8687 if (atomic_dec_and_test(&super->s_pending_writes))···9998 unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9);10099 int i;101100101101+ if (max_pages > BIO_MAX_PAGES)102102+ max_pages = BIO_MAX_PAGES;102103 bio = bio_alloc(GFP_NOFS, max_pages);103103- BUG_ON(!bio); /* FIXME: handle this */104104+ BUG_ON(!bio);104105105106 for (i = 0; i < nr_pages; i++) {106107 if (i >= max_pages) {···195192 unsigned int max_pages = queue_max_hw_sectors(q) >> (PAGE_SHIFT - 9);196193 int i;197194195195+ if (max_pages > BIO_MAX_PAGES)196196+ max_pages = BIO_MAX_PAGES;198197 bio = bio_alloc(GFP_NOFS, max_pages);199199- BUG_ON(!bio); /* FIXME: handle this */198198+ BUG_ON(!bio);200199201200 for (i = 0; i < nr_pages; i++) {202201 if (i >= max_pages) {
···15951595 return ret;15961596}1597159715981598-/* Rewrite cannot mark the inode dirty but has to write it immediatly. */15991598int logfs_rewrite_block(struct inode *inode, u64 bix, u64 ofs,16001599 gc_level_t gc_level, long flags)16011600{···16111612 if (level != 0)16121613 alloc_indirect_block(inode, page, 0);16131614 err = logfs_write_buf(inode, page, flags);16151615+ if (!err && shrink_level(gc_level) == 0) {16161616+ /* Rewrite cannot mark the inode dirty but has to16171617+ * write it immediatly.16181618+ * Q: Can't we just create an alias for the inode16191619+ * instead? And if not, why not?16201620+ */16211621+ if (inode->i_ino == LOGFS_INO_MASTER)16221622+ logfs_write_anchor(inode->i_sb);16231623+ else {16241624+ err = __logfs_write_inode(inode, flags);16251625+ }16261626+ }16141627 }16151628 logfs_put_write_page(page);16161629 return err;
+31-23
fs/logfs/segment.c
···9494 } while (len);9595}96969797-/*9898- * bdev_writeseg will write full pages. Memset the tail to prevent data leaks.9999- */100100-static void pad_wbuf(struct logfs_area *area, int final)9797+static void pad_partial_page(struct logfs_area *area)10198{10299 struct super_block *sb = area->a_sb;103103- struct logfs_super *super = logfs_super(sb);104100 struct page *page;105101 u64 ofs = dev_ofs(sb, area->a_segno, area->a_used_bytes);106102 pgoff_t index = ofs >> PAGE_SHIFT;107103 long offset = ofs & (PAGE_SIZE-1);108104 u32 len = PAGE_SIZE - offset;109105110110- if (len == PAGE_SIZE) {111111- /* The math in this function can surely use some love */112112- len = 0;113113- }114114- if (len) {115115- BUG_ON(area->a_used_bytes >= super->s_segsize);116116-117117- page = get_mapping_page(area->a_sb, index, 0);106106+ if (len % PAGE_SIZE) {107107+ page = get_mapping_page(sb, index, 0);118108 BUG_ON(!page); /* FIXME: reserve a pool */119109 memset(page_address(page) + offset, 0xff, len);120110 SetPagePrivate(page);121111 page_cache_release(page);122112 }113113+}123114124124- if (!final)125125- return;115115+static void pad_full_pages(struct logfs_area *area)116116+{117117+ struct super_block *sb = area->a_sb;118118+ struct logfs_super *super = logfs_super(sb);119119+ u64 ofs = dev_ofs(sb, area->a_segno, area->a_used_bytes);120120+ u32 len = super->s_segsize - area->a_used_bytes;121121+ pgoff_t index = PAGE_CACHE_ALIGN(ofs) >> PAGE_CACHE_SHIFT;122122+ pgoff_t no_indizes = len >> PAGE_CACHE_SHIFT;123123+ struct page *page;126124127127- area->a_used_bytes += len;128128- for ( ; area->a_used_bytes < super->s_segsize;129129- area->a_used_bytes += PAGE_SIZE) {130130- /* Memset another page */131131- index++;132132- page = get_mapping_page(area->a_sb, index, 0);125125+ while (no_indizes) {126126+ page = get_mapping_page(sb, index, 0);133127 BUG_ON(!page); /* FIXME: reserve a pool */134134- memset(page_address(page), 0xff, PAGE_SIZE);128128+ SetPageUptodate(page);129129+ memset(page_address(page), 0xff, PAGE_CACHE_SIZE);135130 SetPagePrivate(page);136131 page_cache_release(page);132132+ index++;133133+ no_indizes--;137134 }135135+}136136+137137+/*138138+ * bdev_writeseg will write full pages. Memset the tail to prevent data leaks.139139+ * Also make sure we allocate (and memset) all pages for final writeout.140140+ */141141+static void pad_wbuf(struct logfs_area *area, int final)142142+{143143+ pad_partial_page(area);144144+ if (final)145145+ pad_full_pages(area);138146}139147140148/*···692684 return 0;693685}694686695695-static void freeseg(struct super_block *sb, u32 segno)687687+void freeseg(struct super_block *sb, u32 segno)696688{697689 struct logfs_super *super = logfs_super(sb);698690 struct address_space *mapping = super->s_mapping_inode->i_mapping;
+7-8
fs/logfs/super.c
···278278 }279279 if (valid0 && valid1 && ds_cmp(ds0, ds1)) {280280 printk(KERN_INFO"Superblocks don't match - fixing.\n");281281- return write_one_sb(sb, super->s_devops->find_last_sb);281281+ return logfs_write_sb(sb);282282 }283283 /* If neither is valid now, something's wrong. Didn't we properly284284 * check them before?!? */···290290{291291 int err;292292293293+ err = logfs_open_segfile(sb);294294+ if (err)295295+ return err;296296+293297 /* Repair any broken superblock copies */294298 err = logfs_recover_sb(sb);295299 if (err)···301297302298 /* Check areas for trailing unaccounted data */303299 err = logfs_check_areas(sb);304304- if (err)305305- return err;306306-307307- err = logfs_open_segfile(sb);308300 if (err)309301 return err;310302···329329330330 sb->s_root = d_alloc_root(rootdir);331331 if (!sb->s_root)332332- goto fail;332332+ goto fail2;333333334334 super->s_erase_page = alloc_pages(GFP_KERNEL, 0);335335 if (!super->s_erase_page)···573573 return 0;574574575575err1:576576- up_write(&sb->s_umount);577577- deactivate_super(sb);576576+ deactivate_locked_super(sb);578577 return err;579578err0:580579 kfree(super);
+3-2
fs/proc/base.c
···443443unsigned long badness(struct task_struct *p, unsigned long uptime);444444static int proc_oom_score(struct task_struct *task, char *buffer)445445{446446- unsigned long points;446446+ unsigned long points = 0;447447 struct timespec uptime;448448449449 do_posix_clock_monotonic_gettime(&uptime);450450 read_lock(&tasklist_lock);451451- points = badness(task->group_leader, uptime.tv_sec);451451+ if (pid_alive(task))452452+ points = badness(task, uptime.tv_sec);452453 read_unlock(&tasklist_lock);453454 return sprintf(buffer, "%lu\n", points);454455}
+37-48
fs/proc/task_mmu.c
···407407408408 memset(&mss, 0, sizeof mss);409409 mss.vma = vma;410410+ /* mmap_sem is held in m_start */410411 if (vma->vm_mm && !is_vm_hugetlb_page(vma))411412 walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk);412413···554553};555554556555struct pagemapread {557557- u64 __user *out, *end;556556+ int pos, len;557557+ u64 *buffer;558558};559559560560#define PM_ENTRY_BYTES sizeof(u64)···578576static int add_to_pagemap(unsigned long addr, u64 pfn,579577 struct pagemapread *pm)580578{581581- if (put_user(pfn, pm->out))582582- return -EFAULT;583583- pm->out++;584584- if (pm->out >= pm->end)579579+ pm->buffer[pm->pos++] = pfn;580580+ if (pm->pos >= pm->len)585581 return PM_END_OF_BUFFER;586582 return 0;587583}···721721 * determine which areas of memory are actually mapped and llseek to722722 * skip over unmapped regions.723723 */724724+#define PAGEMAP_WALK_SIZE (PMD_SIZE)724725static ssize_t pagemap_read(struct file *file, char __user *buf,725726 size_t count, loff_t *ppos)726727{727728 struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);728728- struct page **pages, *page;729729- unsigned long uaddr, uend;730729 struct mm_struct *mm;731730 struct pagemapread pm;732732- int pagecount;733731 int ret = -ESRCH;734732 struct mm_walk pagemap_walk = {};735733 unsigned long src;736734 unsigned long svpfn;737735 unsigned long start_vaddr;738736 unsigned long end_vaddr;737737+ int copied = 0;739738740739 if (!task)741740 goto out;···757758 if (!mm)758759 goto out_task;759760760760-761761- uaddr = (unsigned long)buf & PAGE_MASK;762762- uend = (unsigned long)(buf + count);763763- pagecount = (PAGE_ALIGN(uend) - uaddr) / PAGE_SIZE;764764- ret = 0;765765- if (pagecount == 0)766766- goto out_mm;767767- pages = kcalloc(pagecount, sizeof(struct page *), GFP_KERNEL);761761+ pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT);762762+ pm.buffer = kmalloc(pm.len, GFP_TEMPORARY);768763 ret = -ENOMEM;769769- if (!pages)764764+ if (!pm.buffer)770765 goto out_mm;771771-772772- down_read(¤t->mm->mmap_sem);773773- ret = get_user_pages(current, current->mm, uaddr, pagecount,774774- 1, 0, pages, NULL);775775- up_read(¤t->mm->mmap_sem);776776-777777- if (ret < 0)778778- goto out_free;779779-780780- if (ret != pagecount) {781781- pagecount = ret;782782- ret = -EFAULT;783783- goto out_pages;784784- }785785-786786- pm.out = (u64 __user *)buf;787787- pm.end = (u64 __user *)(buf + count);788766789767 pagemap_walk.pmd_entry = pagemap_pte_range;790768 pagemap_walk.pte_hole = pagemap_pte_hole;···784808 * user buffer is tracked in "pm", and the walk785809 * will stop when we hit the end of the buffer.786810 */787787- ret = walk_page_range(start_vaddr, end_vaddr, &pagemap_walk);788788- if (ret == PM_END_OF_BUFFER)789789- ret = 0;790790- /* don't need mmap_sem for these, but this looks cleaner */791791- *ppos += (char __user *)pm.out - buf;792792- if (!ret)793793- ret = (char __user *)pm.out - buf;811811+ ret = 0;812812+ while (count && (start_vaddr < end_vaddr)) {813813+ int len;814814+ unsigned long end;794815795795-out_pages:796796- for (; pagecount; pagecount--) {797797- page = pages[pagecount-1];798798- if (!PageReserved(page))799799- SetPageDirty(page);800800- page_cache_release(page);816816+ pm.pos = 0;817817+ end = start_vaddr + PAGEMAP_WALK_SIZE;818818+ /* overflow ? */819819+ if (end < start_vaddr || end > end_vaddr)820820+ end = end_vaddr;821821+ down_read(&mm->mmap_sem);822822+ ret = walk_page_range(start_vaddr, end, &pagemap_walk);823823+ up_read(&mm->mmap_sem);824824+ start_vaddr = end;825825+826826+ len = min(count, PM_ENTRY_BYTES * pm.pos);827827+ if (copy_to_user(buf, pm.buffer, len) < 0) {828828+ ret = -EFAULT;829829+ goto out_free;830830+ }831831+ copied += len;832832+ buf += len;833833+ count -= len;801834 }835835+ *ppos += copied;836836+ if (!ret || ret == PM_END_OF_BUFFER)837837+ ret = copied;838838+802839out_free:803803- kfree(pages);840840+ kfree(pm.buffer);804841out_mm:805842 mmput(mm);806843out_task:
+4-6
fs/reiserfs/super.c
···16191619 save_mount_options(s, data);1620162016211621 sbi = kzalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);16221622- if (!sbi) {16231623- errval = -ENOMEM;16241624- goto error_alloc;16251625- }16221622+ if (!sbi)16231623+ return -ENOMEM;16261624 s->s_fs_info = sbi;16271625 /* Set default values for options: non-aggressive tails, RO on errors */16281626 REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL);···18771879 return (0);1878188018791881error:18801880- reiserfs_write_unlock(s);18811881-error_alloc:18821882 if (jinit_done) { /* kill the commit thread, free journal ram */18831883 journal_release_error(NULL, s);18841884 }18851885+18861886+ reiserfs_write_unlock(s);1885188718861888 reiserfs_free_bitmap_cache(s);18871889 if (SB_BUFFER_WITH_SB(s))
···333333 struct early_res *r;334334 int i;335335336336+ if (start == end)337337+ return;338338+339339+ if (WARN_ONCE(start > end, " wrong range [%#llx, %#llx]\n", start, end))340340+ return;341341+336342try_next:337343 i = find_overlapped_early(start, end);338344 if (i >= max_early_res)
+103-102
kernel/kgdb.c
···6969 struct pt_regs *linux_regs;7070};71717272+/* Exception state values */7373+#define DCPU_WANT_MASTER 0x1 /* Waiting to become a master kgdb cpu */7474+#define DCPU_NEXT_MASTER 0x2 /* Transition from one master cpu to another */7575+#define DCPU_IS_SLAVE 0x4 /* Slave cpu enter exception */7676+#define DCPU_SSTEP 0x8 /* CPU is single stepping */7777+7278static struct debuggerinfo_struct {7379 void *debuggerinfo;7480 struct task_struct *task;8181+ int exception_state;7582} kgdb_info[NR_CPUS];76837784/**···398391399392/*400393 * Copy the binary array pointed to by buf into mem. Fix $, #, and401401- * 0x7d escaped with 0x7d. Return a pointer to the character after402402- * the last byte written.394394+ * 0x7d escaped with 0x7d. Return -EFAULT on failure or 0 on success.395395+ * The input buf is overwitten with the result to write to mem.403396 */404397static int kgdb_ebin2mem(char *buf, char *mem, int count)405398{406406- int err = 0;407407- char c;399399+ int size = 0;400400+ char *c = buf;408401409402 while (count-- > 0) {410410- c = *buf++;411411- if (c == 0x7d)412412- c = *buf++ ^ 0x20;413413-414414- err = probe_kernel_write(mem, &c, 1);415415- if (err)416416- break;417417-418418- mem++;403403+ c[size] = *buf++;404404+ if (c[size] == 0x7d)405405+ c[size] = *buf++ ^ 0x20;406406+ size++;419407 }420408421421- return err;409409+ return probe_kernel_write(mem, c, size);422410}423411424412/*···563561 */564562 return find_task_by_pid_ns(tid, &init_pid_ns);565563}566566-567567-/*568568- * CPU debug state control:569569- */570570-571571-#ifdef CONFIG_SMP572572-static void kgdb_wait(struct pt_regs *regs)573573-{574574- unsigned long flags;575575- int cpu;576576-577577- local_irq_save(flags);578578- cpu = raw_smp_processor_id();579579- kgdb_info[cpu].debuggerinfo = regs;580580- kgdb_info[cpu].task = current;581581- /*582582- * Make sure the above info reaches the primary CPU before583583- * our cpu_in_kgdb[] flag setting does:584584- */585585- smp_wmb();586586- atomic_set(&cpu_in_kgdb[cpu], 1);587587-588588- /* Disable any cpu specific hw breakpoints */589589- kgdb_disable_hw_debug(regs);590590-591591- /* Wait till primary CPU is done with debugging */592592- while (atomic_read(&passive_cpu_wait[cpu]))593593- cpu_relax();594594-595595- kgdb_info[cpu].debuggerinfo = NULL;596596- kgdb_info[cpu].task = NULL;597597-598598- /* fix up hardware debug registers on local cpu */599599- if (arch_kgdb_ops.correct_hw_break)600600- arch_kgdb_ops.correct_hw_break();601601-602602- /* Signal the primary CPU that we are done: */603603- atomic_set(&cpu_in_kgdb[cpu], 0);604604- touch_softlockup_watchdog_sync();605605- clocksource_touch_watchdog();606606- local_irq_restore(flags);607607-}608608-#endif609564610565/*611566 * Some architectures need cache flushes when we set/clear a···13591400 return 1;13601401}1361140213621362-/*13631363- * kgdb_handle_exception() - main entry point from a kernel exception13641364- *13651365- * Locking hierarchy:13661366- * interface locks, if any (begin_session)13671367- * kgdb lock (kgdb_active)13681368- */13691369-int13701370-kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs)14031403+static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs)13711404{13721372- struct kgdb_state kgdb_var;13731373- struct kgdb_state *ks = &kgdb_var;13741405 unsigned long flags;13751406 int sstep_tries = 100;13761407 int error = 0;13771408 int i, cpu;13781378-13791379- ks->cpu = raw_smp_processor_id();13801380- ks->ex_vector = evector;13811381- ks->signo = signo;13821382- ks->ex_vector = evector;13831383- ks->err_code = ecode;13841384- ks->kgdb_usethreadid = 0;13851385- ks->linux_regs = regs;13861386-13871387- if (kgdb_reenter_check(ks))13881388- return 0; /* Ouch, double exception ! */13891389-14091409+ int trace_on = 0;13901410acquirelock:13911411 /*13921412 * Interrupts will be restored by the 'trap return' code, except when···13731435 */13741436 local_irq_save(flags);1375143713761376- cpu = raw_smp_processor_id();14381438+ cpu = ks->cpu;14391439+ kgdb_info[cpu].debuggerinfo = regs;14401440+ kgdb_info[cpu].task = current;14411441+ /*14421442+ * Make sure the above info reaches the primary CPU before14431443+ * our cpu_in_kgdb[] flag setting does:14441444+ */14451445+ atomic_inc(&cpu_in_kgdb[cpu]);1377144613781447 /*13791379- * Acquire the kgdb_active lock:14481448+ * CPU will loop if it is a slave or request to become a kgdb14491449+ * master cpu and acquire the kgdb_active lock:13801450 */13811381- while (atomic_cmpxchg(&kgdb_active, -1, cpu) != -1)14511451+ while (1) {14521452+ if (kgdb_info[cpu].exception_state & DCPU_WANT_MASTER) {14531453+ if (atomic_cmpxchg(&kgdb_active, -1, cpu) == cpu)14541454+ break;14551455+ } else if (kgdb_info[cpu].exception_state & DCPU_IS_SLAVE) {14561456+ if (!atomic_read(&passive_cpu_wait[cpu]))14571457+ goto return_normal;14581458+ } else {14591459+return_normal:14601460+ /* Return to normal operation by executing any14611461+ * hw breakpoint fixup.14621462+ */14631463+ if (arch_kgdb_ops.correct_hw_break)14641464+ arch_kgdb_ops.correct_hw_break();14651465+ if (trace_on)14661466+ tracing_on();14671467+ atomic_dec(&cpu_in_kgdb[cpu]);14681468+ touch_softlockup_watchdog_sync();14691469+ clocksource_touch_watchdog();14701470+ local_irq_restore(flags);14711471+ return 0;14721472+ }13821473 cpu_relax();14741474+ }1383147513841476 /*13851477 * For single stepping, try to only enter on the processor···14431475 if (kgdb_io_ops->pre_exception)14441476 kgdb_io_ops->pre_exception();1445147714461446- kgdb_info[ks->cpu].debuggerinfo = ks->linux_regs;14471447- kgdb_info[ks->cpu].task = current;14481448-14491478 kgdb_disable_hw_debug(ks->linux_regs);1450147914511480 /*···14511486 */14521487 if (!kgdb_single_step) {14531488 for (i = 0; i < NR_CPUS; i++)14541454- atomic_set(&passive_cpu_wait[i], 1);14891489+ atomic_inc(&passive_cpu_wait[i]);14551490 }14561456-14571457- /*14581458- * spin_lock code is good enough as a barrier so we don't14591459- * need one here:14601460- */14611461- atomic_set(&cpu_in_kgdb[ks->cpu], 1);1462149114631492#ifdef CONFIG_SMP14641493 /* Signal the other CPUs to enter kgdb_wait() */···14771518 kgdb_single_step = 0;14781519 kgdb_contthread = current;14791520 exception_level = 0;15211521+ trace_on = tracing_is_on();15221522+ if (trace_on)15231523+ tracing_off();1480152414811525 /* Talk to debugger with gdbserial protocol */14821526 error = gdb_serial_stub(ks);···14881526 if (kgdb_io_ops->post_exception)14891527 kgdb_io_ops->post_exception();1490152814911491- kgdb_info[ks->cpu].debuggerinfo = NULL;14921492- kgdb_info[ks->cpu].task = NULL;14931493- atomic_set(&cpu_in_kgdb[ks->cpu], 0);15291529+ atomic_dec(&cpu_in_kgdb[ks->cpu]);1494153014951531 if (!kgdb_single_step) {14961532 for (i = NR_CPUS-1; i >= 0; i--)14971497- atomic_set(&passive_cpu_wait[i], 0);15331533+ atomic_dec(&passive_cpu_wait[i]);14981534 /*14991535 * Wait till all the CPUs have quit15001536 * from the debugger.···15111551 else15121552 kgdb_sstep_pid = 0;15131553 }15541554+ if (trace_on)15551555+ tracing_on();15141556 /* Free kgdb_active */15151557 atomic_set(&kgdb_active, -1);15161558 touch_softlockup_watchdog_sync();···15221560 return error;15231561}1524156215631563+/*15641564+ * kgdb_handle_exception() - main entry point from a kernel exception15651565+ *15661566+ * Locking hierarchy:15671567+ * interface locks, if any (begin_session)15681568+ * kgdb lock (kgdb_active)15691569+ */15701570+int15711571+kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs)15721572+{15731573+ struct kgdb_state kgdb_var;15741574+ struct kgdb_state *ks = &kgdb_var;15751575+ int ret;15761576+15771577+ ks->cpu = raw_smp_processor_id();15781578+ ks->ex_vector = evector;15791579+ ks->signo = signo;15801580+ ks->ex_vector = evector;15811581+ ks->err_code = ecode;15821582+ ks->kgdb_usethreadid = 0;15831583+ ks->linux_regs = regs;15841584+15851585+ if (kgdb_reenter_check(ks))15861586+ return 0; /* Ouch, double exception ! */15871587+ kgdb_info[ks->cpu].exception_state |= DCPU_WANT_MASTER;15881588+ ret = kgdb_cpu_enter(ks, regs);15891589+ kgdb_info[ks->cpu].exception_state &= ~DCPU_WANT_MASTER;15901590+ return ret;15911591+}15921592+15251593int kgdb_nmicallback(int cpu, void *regs)15261594{15271595#ifdef CONFIG_SMP15961596+ struct kgdb_state kgdb_var;15971597+ struct kgdb_state *ks = &kgdb_var;15981598+15991599+ memset(ks, 0, sizeof(struct kgdb_state));16001600+ ks->cpu = cpu;16011601+ ks->linux_regs = regs;16021602+15281603 if (!atomic_read(&cpu_in_kgdb[cpu]) &&15291529- atomic_read(&kgdb_active) != cpu &&15301530- atomic_read(&cpu_in_kgdb[atomic_read(&kgdb_active)])) {15311531- kgdb_wait((struct pt_regs *)regs);16041604+ atomic_read(&kgdb_active) != -1 &&16051605+ atomic_read(&kgdb_active) != cpu) {16061606+ kgdb_info[cpu].exception_state |= DCPU_IS_SLAVE;16071607+ kgdb_cpu_enter(ks, regs);16081608+ kgdb_info[cpu].exception_state &= ~DCPU_IS_SLAVE;15321609 return 0;15331610 }15341611#endif···17431742 */17441743void kgdb_breakpoint(void)17451744{17461746- atomic_set(&kgdb_setting_breakpoint, 1);17451745+ atomic_inc(&kgdb_setting_breakpoint);17471746 wmb(); /* Sync point before breakpoint */17481747 arch_kgdb_breakpoint();17491748 wmb(); /* Sync point after breakpoint */17501750- atomic_set(&kgdb_setting_breakpoint, 0);17491749+ atomic_dec(&kgdb_setting_breakpoint);17511750}17521751EXPORT_SYMBOL_GPL(kgdb_breakpoint);17531752
+14-8
kernel/perf_event.c
···11651165 struct perf_event_context *ctx = task->perf_event_ctxp;11661166 struct perf_event_context *next_ctx;11671167 struct perf_event_context *parent;11681168- struct pt_regs *regs;11691168 int do_switch = 1;1170116911711171- regs = task_pt_regs(task);11721172- perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, regs, 0);11701170+ perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);1173117111741172 if (likely(!ctx || !cpuctx->task_ctx))11751173 return;···27852787 return NULL;27862788}2787278927882788-#ifdef CONFIG_EVENT_TRACING27892790__weak27902791void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip)27912792{27922793}27932793-#endif27942794+2794279527952796/*27962797 * Output···33763379 struct perf_task_event *task_event)33773380{33783381 struct perf_output_handle handle;33793379- int size;33803382 struct task_struct *task = task_event->task;33813381- int ret;33833383+ unsigned long flags;33843384+ int size, ret;33853385+33863386+ /*33873387+ * If this CPU attempts to acquire an rq lock held by a CPU spinning33883388+ * in perf_output_lock() from interrupt context, it's game over.33893389+ */33903390+ local_irq_save(flags);3382339133833392 size = task_event->event_id.header.size;33843393 ret = perf_output_begin(&handle, event, size, 0, 0);3385339433863386- if (ret)33953395+ if (ret) {33963396+ local_irq_restore(flags);33873397 return;33983398+ }3388339933893400 task_event->event_id.pid = perf_event_pid(event, task);33903401 task_event->event_id.ppid = perf_event_pid(event, current);···34033398 perf_output_put(&handle, task_event->event_id);3404339934053400 perf_output_end(&handle);34013401+ local_irq_restore(flags);34063402}3407340334083404static int perf_event_task_match(struct perf_event *event)
+2-3
kernel/power/process.c
···8888 printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "8989 "(%d tasks refusing to freeze):\n",9090 elapsed_csecs / 100, elapsed_csecs % 100, todo);9191- show_state();9291 read_lock(&tasklist_lock);9392 do_each_thread(g, p) {9493 task_lock(p);9594 if (freezing(p) && !freezer_should_skip(p))9696- printk(KERN_ERR " %s\n", p->comm);9595+ sched_show_task(p);9796 cancel_freezing(p);9897 task_unlock(p);9998 } while_each_thread(g, p);···144145 if (nosig_only && should_send_signal(p))145146 continue;146147147147- if (cgroup_frozen(p))148148+ if (cgroup_freezing_or_frozen(p))148149 continue;149150150151 thaw_process(p);
···8484 int this_cpu;8585 u64 now;86868787- raw_local_irq_save(flags);8787+ local_irq_save(flags);88888989 this_cpu = raw_smp_processor_id();9090 now = cpu_clock(this_cpu);···110110 arch_spin_unlock(&trace_clock_struct.lock);111111112112 out:113113- raw_local_irq_restore(flags);113113+ local_irq_restore(flags);114114115115 return now;116116}
+9-2
kernel/trace/trace_event_perf.c
···1717static char *perf_trace_buf;1818static char *perf_trace_buf_nmi;19192020-typedef typeof(char [PERF_MAX_TRACE_SIZE]) perf_trace_t ;2020+/*2121+ * Force it to be aligned to unsigned long to avoid misaligned accesses2222+ * suprises2323+ */2424+typedef typeof(unsigned long [PERF_MAX_TRACE_SIZE / sizeof(unsigned long)])2525+ perf_trace_t;21262227/* Count the events in use (per event id, not per instance) */2328static int total_ref_count;···135130 char *trace_buf, *raw_data;136131 int pc, cpu;137132133133+ BUILD_BUG_ON(PERF_MAX_TRACE_SIZE % sizeof(unsigned long));134134+138135 pc = preempt_count();139136140137 /* Protect the per cpu buffer, begin the rcu read side */···159152 raw_data = per_cpu_ptr(trace_buf, cpu);160153161154 /* zero the dead bytes from align to not leak stack to user */162162- *(u64 *)(&raw_data[size - sizeof(u64)]) = 0ULL;155155+ memset(&raw_data[size - sizeof(u64)], 0, sizeof(u64));163156164157 entry = (struct trace_entry *)raw_data;165158 tracing_generic_entry_update(entry, *irq_flags, pc);