Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'riscv-for-linus-5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:
"I have a few KGDB-related fixes. They're mostly fixes for build
warnings, but there's also:

- Support for the qSupported and qXfer packets, which are necessary
to pass around GDB XML information which we need for the RISC-V GDB
port to fully function.

- Users can now select STRICT_KERNEL_RWX instead of forcing it on"

* tag 'riscv-for-linus-5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
riscv: Avoid kgdb.h including gdb_xml.h to solve unused-const-variable warning
kgdb: Move the extern declaration kgdb_has_hit_break() to generic kgdb.h
riscv: Fix "no previous prototype" compile warning in kgdb.c file
riscv: enable the Kconfig prompt of STRICT_KERNEL_RWX
kgdb: enable arch to support XML packet.

+41 -9
+2
arch/riscv/Kconfig
··· 23 23 select ARCH_HAS_SET_DIRECT_MAP 24 24 select ARCH_HAS_SET_MEMORY 25 25 select ARCH_HAS_STRICT_KERNEL_RWX if MMU 26 + select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX 27 + select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 26 28 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU 27 29 select ARCH_WANT_FRAME_POINTERS 28 30 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
+1 -2
arch/riscv/include/asm/gdb_xml.h
··· 3 3 #ifndef __ASM_GDB_XML_H_ 4 4 #define __ASM_GDB_XML_H_ 5 5 6 - #define kgdb_arch_gdb_stub_feature riscv_gdb_stub_feature 7 - static const char riscv_gdb_stub_feature[64] = 6 + const char riscv_gdb_stub_feature[64] = 8 7 "PacketSize=800;qXfer:features:read+;"; 9 8 10 9 static const char gdb_xfer_read_target[31] = "qXfer:features:read:target.xml:";
+3 -2
arch/riscv/include/asm/kgdb.h
··· 19 19 20 20 #ifndef __ASSEMBLY__ 21 21 22 - extern int kgdb_has_hit_break(unsigned long addr); 23 22 extern unsigned long kgdb_compiled_break; 24 23 25 24 static inline void arch_kgdb_breakpoint(void) ··· 105 106 #define DBG_REG_BADADDR_OFF 34 106 107 #define DBG_REG_CAUSE_OFF 35 107 108 108 - #include <asm/gdb_xml.h> 109 + extern const char riscv_gdb_stub_feature[64]; 110 + 111 + #define kgdb_arch_gdb_stub_feature riscv_gdb_stub_feature 109 112 110 113 #endif 111 114 #endif
+5 -5
arch/riscv/kernel/kgdb.c
··· 44 44 DECLARE_INSN(c_bnez, MATCH_C_BNEZ, MASK_C_BNEZ) 45 45 DECLARE_INSN(sret, MATCH_SRET, MASK_SRET) 46 46 47 - int decode_register_index(unsigned long opcode, int offset) 47 + static int decode_register_index(unsigned long opcode, int offset) 48 48 { 49 49 return (opcode >> offset) & 0x1F; 50 50 } 51 51 52 - int decode_register_index_short(unsigned long opcode, int offset) 52 + static int decode_register_index_short(unsigned long opcode, int offset) 53 53 { 54 54 return ((opcode >> offset) & 0x7) + 8; 55 55 } 56 56 57 57 /* Calculate the new address for after a step */ 58 - int get_step_address(struct pt_regs *regs, unsigned long *next_addr) 58 + static int get_step_address(struct pt_regs *regs, unsigned long *next_addr) 59 59 { 60 60 unsigned long pc = regs->epc; 61 61 unsigned long *regs_ptr = (unsigned long *)regs; ··· 136 136 return 0; 137 137 } 138 138 139 - int do_single_step(struct pt_regs *regs) 139 + static int do_single_step(struct pt_regs *regs) 140 140 { 141 141 /* Determine where the target instruction will send us to */ 142 142 unsigned long addr = 0; ··· 320 320 return err; 321 321 } 322 322 323 - int kgdb_riscv_kgdbbreak(unsigned long addr) 323 + static int kgdb_riscv_kgdbbreak(unsigned long addr) 324 324 { 325 325 if (stepped_address == addr) 326 326 return KGDB_SW_SINGLE_STEP;
+12
include/linux/kgdb.h
··· 177 177 struct pt_regs *regs); 178 178 179 179 /** 180 + * kgdb_arch_handle_qxfer_pkt - Handle architecture specific GDB XML 181 + * packets. 182 + * @remcom_in_buffer: The buffer of the packet we have read. 183 + * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into. 184 + */ 185 + 186 + extern void 187 + kgdb_arch_handle_qxfer_pkt(char *remcom_in_buffer, 188 + char *remcom_out_buffer); 189 + 190 + /** 180 191 * kgdb_call_nmi_hook - Call kgdb_nmicallback() on the current CPU 181 192 * @ignored: This parameter is only here to match the prototype. 182 193 * ··· 325 314 326 315 extern int kgdb_isremovedbreak(unsigned long addr); 327 316 extern void kgdb_schedule_breakpoint(void); 317 + extern int kgdb_has_hit_break(unsigned long addr); 328 318 329 319 extern int 330 320 kgdb_handle_exception(int ex_vector, int signo, int err_code,
+13
kernel/debug/gdbstub.c
··· 792 792 } 793 793 break; 794 794 #endif 795 + #ifdef CONFIG_HAVE_ARCH_KGDB_QXFER_PKT 796 + case 'S': 797 + if (!strncmp(remcom_in_buffer, "qSupported:", 11)) 798 + strcpy(remcom_out_buffer, kgdb_arch_gdb_stub_feature); 799 + break; 800 + case 'X': 801 + if (!strncmp(remcom_in_buffer, "qXfer:", 6)) 802 + kgdb_arch_handle_qxfer_pkt(remcom_in_buffer, 803 + remcom_out_buffer); 804 + break; 805 + #endif 806 + default: 807 + break; 795 808 } 796 809 } 797 810
+5
lib/Kconfig.kgdb
··· 3 3 config HAVE_ARCH_KGDB 4 4 bool 5 5 6 + # set if architecture has the its kgdb_arch_handle_qxfer_pkt 7 + # function to enable gdb stub to address XML packet sent from GDB. 8 + config HAVE_ARCH_KGDB_QXFER_PKT 9 + bool 10 + 6 11 menuconfig KGDB 7 12 bool "KGDB: kernel debugger" 8 13 depends on HAVE_ARCH_KGDB