Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f386ac3 authored by David Howells's avatar David Howells
Browse files

MN10300: Create general kernel debugger cache flushing



Create general kernel debugger cache flushing for MN10300 and get rid of the
old stuff that gdbstub was using.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 792576b1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -14,6 +14,14 @@

#if defined(CONFIG_KERNEL_DEBUGGER)

#ifndef CONFIG_MN10300_DEBUGGER_CACHE_NO_FLUSH
extern void debugger_local_cache_flushinv(void);
extern void debugger_local_cache_flushinv_one(u8 *);
#else
static inline void debugger_local_cache_flushinv(void) {}
static inline void debugger_local_cache_flushinv_one(u8 *addr) {}
#endif

#else /* CONFIG_KERNEL_DEBUGGER */

#endif /* CONFIG_KERNEL_DEBUGGER */
+0 −4
Original line number Diff line number Diff line
@@ -21,10 +21,6 @@ obj-$(CONFIG_GDBSTUB) += gdb-stub.o gdb-low.o
obj-$(CONFIG_GDBSTUB_ON_TTYSx) += gdb-io-serial.o gdb-io-serial-low.o
obj-$(CONFIG_GDBSTUB_ON_TTYSMx) += gdb-io-ttysm.o gdb-io-ttysm-low.o

ifeq ($(CONFIG_MN10300_CACHE_ENABLED),y)
obj-$(CONFIG_GDBSTUB) += gdb-cache.o
endif

obj-$(CONFIG_MN10300_RTC) += rtc.o
obj-$(CONFIG_PROFILE) += profile.o profile-low.o
obj-$(CONFIG_MODULES) += module.o
+1 −30
Original line number Diff line number Diff line
@@ -306,36 +306,7 @@ ENTRY(nmi_handler)
	movbu	d0,(GxICR(GDB_NMI_IPI))
	movhu	(GxICR(GDB_NMI_IPI)),d0
	and	~EPSW_NMID,epsw		# enable NMI
#ifdef CONFIG_MN10300_CACHE_ENABLED
	mov	(gdbstub_nmi_opr_type),d0
	cmp	GDBSTUB_NMI_CACHE_PURGE,d0
	bne	4f			# if not gdb cache purge, jump

	# gdb cache purge nmi ipi
	add	-20,sp
	mov	d1,(4,sp)
	mov	a0,(8,sp)
	mov	a1,(12,sp)
	mov	mdr,d0
	mov	d0,(16,sp)
	call	gdbstub_local_purge_cache[],0
	mov	0x1,d0
	mov	(CPUID),d1
	asl	d1,d0
	mov	gdbstub_nmi_cpumask,a0
	bclr	d0,(a0)
	mov	(4,sp),d1
	mov	(8,sp),a0
	mov	(12,sp),a1
	mov	(16,sp),d0
	mov	d0,mdr
	add	20,sp
	mov	(sp),d0
	add	4,sp
	rti
4:
#endif /* CONFIG_MN10300_CACHE_ENABLED */
	# gdb wait nmi ipi

	mov     (sp),d0
	SAVE_ALL
	call    gdbstub_nmi_wait[],0

arch/mn10300/kernel/gdb-cache.S

deleted100644 → 0
+0 −105
Original line number Diff line number Diff line
###############################################################################
#
# MN10300 Low-level cache purging routines for gdbstub
#
# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
# Written by David Howells (dhowells@redhat.com)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licence
# as published by the Free Software Foundation; either version
# 2 of the Licence, or (at your option) any later version.
#
###############################################################################
#include <linux/sys.h>
#include <linux/linkage.h>
#include <asm/smp.h>
#include <asm/cache.h>
#include <asm/cpu-regs.h>
#include <asm/exceptions.h>
#include <asm/frame.inc>
#include <asm/serial-regs.h>

	.text

###############################################################################
#
# GDB stub cache purge
#
###############################################################################
	.type	gdbstub_purge_cache,@function
ENTRY(gdbstub_purge_cache)
	#######################################################################
	# read the addresses tagged in the cache's tag RAM and attempt to flush
	# those addresses specifically
	# - we rely on the hardware to filter out invalid tag entry addresses
	mov	DCACHE_TAG(0,0),a0		# dcache tag RAM access address
	mov	DCACHE_PURGE(0,0),a1		# dcache purge request address
	mov	L1_CACHE_NWAYS*L1_CACHE_NENTRIES,d1  # total number of entries

mn10300_dcache_flush_loop:
	mov	(a0),d0
	and	L1_CACHE_TAG_ADDRESS|L1_CACHE_TAG_ENTRY,d0
	or	L1_CACHE_TAG_VALID,d0		# retain valid entries in the
						# cache
	mov	d0,(a1)				# conditional purge

mn10300_dcache_flush_skip:
	add	L1_CACHE_BYTES,a0
	add	L1_CACHE_BYTES,a1
	add	-1,d1
	bne	mn10300_dcache_flush_loop

;; 	# unconditionally flush and invalidate the dcache
;; 	mov	DCACHE_PURGE(0,0),a1		# dcache purge request address
;; 	mov	L1_CACHE_NWAYS*L1_CACHE_NENTRIES,d1	# total number of
;;							# entries
;;
;; gdbstub_purge_cache__dcache_loop:
;; 	mov	(a1),d0				# unconditional purge
;;
;; 	add	L1_CACHE_BYTES,a1
;; 	add	-1,d1
;; 	bne	gdbstub_purge_cache__dcache_loop

	#######################################################################
	# now invalidate the icache
	mov	CHCTR,a0
	movhu	(a0),a1

	mov	epsw,d1
	and	~EPSW_IE,epsw
	nop
	nop

	# disable the icache
	and	~CHCTR_ICEN,d0
	movhu	d0,(a0)

	# and wait for it to calm down
	setlb
	movhu	(a0),d0
	btst	CHCTR_ICBUSY,d0
	lne

	# invalidate
	or	CHCTR_ICINV,d0
	movhu	d0,(a0)

	# wait for the cache to finish
	mov	CHCTR,a0
	setlb
	movhu	(a0),d0
	btst	CHCTR_ICBUSY,d0
	lne

	# and reenable it
	movhu	a1,(a0)
	movhu	(a0),d0			# read back to flush
					# (SIGILLs all over without this)

	mov	d1,epsw

	ret	[],0

	.size	gdbstub_purge_cache,.-gdbstub_purge_cache
+2 −2
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@
#include <asm/system.h>
#include <asm/gdb-stub.h>
#include <asm/exceptions.h>
#include <asm/cacheflush.h>
#include <asm/debugger.h>
#include <asm/serial-regs.h>
#include <asm/busctl-regs.h>
#include <unit/leds.h>
@@ -1665,7 +1665,7 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep)
	 * NB: We flush both caches, just to be sure...
	 */
	if (gdbstub_flush_caches)
		gdbstub_purge_cache();
		debugger_local_cache_flushinv();

	gdbstub_load_fpu();
	mn10300_set_gdbleds(0);
Loading