Skip to content

Commit

Permalink
arm64/kallsyms: use kallsym for gic_data_v3 as well
Browse files Browse the repository at this point in the history
It turns out we can figure it out at runtime with a little trick, and
the function that I could not figure how to tell which to use is
actually set in a proper global "__smp_cross_call" pointer so we can
use that instead.

Change-Id: I40bed957005fbe60fbdcebd7d1d979b2c56c9b00
  • Loading branch information
Dominique Martinet authored and Dominique Martinet committed Aug 22, 2018
1 parent f186deb commit 4e733a2
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 357 deletions.
7 changes: 0 additions & 7 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to address of kernel symbol gic_data_gicv3, or 0 if exported */
#undef IHK_KSYM_gic_data_gicv3

/* Define to address of kernel symbol gic_raise_softirq_gicv3, or 0 if
exported */
#undef IHK_KSYM_gic_raise_softirq_gicv3

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

Expand Down
132 changes: 0 additions & 132 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3115,134 +3115,6 @@ esac
KDIR="$WITH_KERNELSRC"
TARGET="$WITH_TARGET"

IHK_LINUX_SYMTAB=""
case "X$WITH_SYSTEM_MAP" in
Xyes | Xno | X)
IHK_LINUX_SYMTAB=""
;;
*)
IHK_LINUX_SYMTAB="$WITH_SYSTEM_MAP"
;;
esac

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for System.map" >&5
$as_echo_n "checking for System.map... " >&6; }
if test -r "$IHK_LINUX_SYMTAB"; then
IHK_LINUX_SYMTAB="$IHK_LINUX_SYMTAB"
elif test -r "/boot/System.map-`uname -r`"; then
IHK_LINUX_SYMTAB="/boot/System.map-`uname -r`"
elif test -r "$KDIR/System.map"; then
IHK_LINUX_SYMTAB="$KDIR/System.map"
fi

if test "$IHK_LINUX_SYMTAB" == ""; then
as_fn_error $? "could not find" "$LINENO" 5
fi

if test -z "`eval cat $IHK_LINUX_SYMTAB`"; then
as_fn_error $? "could not read System.map file, no read permission?" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $IHK_LINUX_SYMTAB" >&5
$as_echo "$IHK_LINUX_SYMTAB" >&6; }

IHK_LINUX_SYMTAB_CMD="cat $IHK_LINUX_SYMTAB"

# IHK_FIND_KSYM(SYMBOL)
# ------------------------------------------------------
# Search System.map for address of the given symbol and
# do one of three things in config.h:
# If not found, leave IHK_KSYM_foo undefined
# If found to be exported, "#define IHK_KSYM_foo 0"
# If found not to be exported, "#define IHK_KSYM_foo 0x<value>"

# POSTK_DEBUG_ARCH_DEP_10, Enhance IHK_FIND_KSYM macro feature.

# <older version>
# AC_DEFUN([IHK_FIND_KSYM],[
# AC_MSG_CHECKING([[System.map for symbol $1]])
# ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " $1\$" | cut -d\ -f1`
# if test -z $ihk_addr; then
# AC_MSG_RESULT([not found])
# else
# ihk_result=$ihk_addr
# ihk_addr="0x$ihk_addr"
# m4_ifval([$2],[],[
# if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_$1\$" >/dev/null`; then
# ihk_result="exported"
# ihk_addr="0"
# fi
# ])
# AC_MSG_RESULT([$ihk_result])
# AC_DEFINE_UNQUOTED(IHK_KSYM_[]$1,$ihk_addr,
# [Define to address of kernel symbol $1, or 0 if exported])
# fi
# ])

if test "$TARGET" = "smp-arm64"; then

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol gic_data" >&5
$as_echo_n "checking System.map for symbol gic_data... " >&6; }
symbol_src=irq-gic-v3.c
ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " gic_data\$" | cut -d\ -f1`
ihk_addr_array=($ihk_addr)
if test ${#ihk_addr_array[*]} -gt 1 ; then
for addr in $ihk_addr ; do
filename=`addr2line -e $KDIR/vmlinux ${addr} | cut -d ':' -f1 | rev | cut -d '/' -f1 | rev`
if test $filename = $symbol_src ; then
ihk_addr=$addr
break
fi
done
fi
if test -z $ihk_addr; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
else
ihk_result=$ihk_addr
ihk_addr="0x$ihk_addr"

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5
$as_echo "$ihk_result" >&6; }

cat >>confdefs.h <<_ACEOF
#define IHK_KSYM_gic_data_gicv3 $ihk_addr
_ACEOF

fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol gic_raise_softirq" >&5
$as_echo_n "checking System.map for symbol gic_raise_softirq... " >&6; }
symbol_src=irq-gic-v3.c
ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " gic_raise_softirq\$" | cut -d\ -f1`
ihk_addr_array=($ihk_addr)
if test ${#ihk_addr_array[*]} -gt 1 ; then
for addr in $ihk_addr ; do
filename=`addr2line -e $KDIR/vmlinux ${addr} | cut -d ':' -f1 | rev | cut -d '/' -f1 | rev`
if test $filename = $symbol_src ; then
ihk_addr=$addr
break
fi
done
fi
if test -z $ihk_addr; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
else
ihk_result=$ihk_addr
ihk_addr="0x$ihk_addr"

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5
$as_echo "$ihk_result" >&6; }

cat >>confdefs.h <<_ACEOF
#define IHK_KSYM_gic_raise_softirq_gicv3 $ihk_addr
_ACEOF

fi

fi

if test "x$ENABLE_MEMDUMP" != "xno" ; then
enableval=yes
# POSTK_DEBUG_ARCH_DEP_32, AC_CHECK_LIB for libiberty
Expand Down Expand Up @@ -3882,9 +3754,6 @@ case "$TARGET" in
smp*)
ac_config_headers="$ac_config_headers config.h"

arch=`echo "$ARCH"`
ac_config_headers="$ac_config_headers linux/driver/smp/arch/$arch/config-$arch.h"

;;
esac

Expand Down Expand Up @@ -4591,7 +4460,6 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"linux/driver/smp/arch/$arch/config-$arch.h") CONFIG_HEADERS="$CONFIG_HEADERS linux/driver/smp/arch/$arch/config-$arch.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"linux/core/Makefile") CONFIG_FILES="$CONFIG_FILES linux/core/Makefile" ;;
"linux/core/Makefile.module") CONFIG_FILES="$CONFIG_FILES linux/core/Makefile.module" ;;
Expand Down
97 changes: 0 additions & 97 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -230,101 +230,6 @@ esac
KDIR="$WITH_KERNELSRC"
TARGET="$WITH_TARGET"

IHK_LINUX_SYMTAB=""
case "X$WITH_SYSTEM_MAP" in
Xyes | Xno | X)
IHK_LINUX_SYMTAB=""
;;
*)
IHK_LINUX_SYMTAB="$WITH_SYSTEM_MAP"
;;
esac

AC_MSG_CHECKING([[for System.map]])
if test -r "$IHK_LINUX_SYMTAB"; then
IHK_LINUX_SYMTAB="$IHK_LINUX_SYMTAB"
elif test -r "/boot/System.map-`uname -r`"; then
IHK_LINUX_SYMTAB="/boot/System.map-`uname -r`"
elif test -r "$KDIR/System.map"; then
IHK_LINUX_SYMTAB="$KDIR/System.map"
fi

if test "$IHK_LINUX_SYMTAB" == ""; then
AC_MSG_ERROR([could not find])
fi

if test -z "`eval cat $IHK_LINUX_SYMTAB`"; then
AC_MSG_ERROR([could not read System.map file, no read permission?])
fi
AC_MSG_RESULT([$IHK_LINUX_SYMTAB])

IHK_LINUX_SYMTAB_CMD="cat $IHK_LINUX_SYMTAB"

# IHK_FIND_KSYM(SYMBOL)
# ------------------------------------------------------
# Search System.map for address of the given symbol and
# do one of three things in config.h:
# If not found, leave IHK_KSYM_foo undefined
# If found to be exported, "#define IHK_KSYM_foo 0"
# If found not to be exported, "#define IHK_KSYM_foo 0x<value>"

# POSTK_DEBUG_ARCH_DEP_10, Enhance IHK_FIND_KSYM macro feature.
AC_DEFUN([IHK_FIND_KSYM],[
AC_MSG_CHECKING([[System.map for symbol $1]])
symbol_src=$2
ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " $1\$" | cut -d\ -f1`
ihk_addr_array=($ihk_addr)
if test ${#ihk_addr_array[*]} -gt 1 ; then
for addr in $ihk_addr ; do
filename=`addr2line -e $KDIR/vmlinux ${addr} | cut -d ':' -f1 | rev | cut -d '/' -f1 | rev`
if test $filename = $symbol_src ; then
ihk_addr=$addr
break
fi
done
fi
if test -z $ihk_addr; then
AC_MSG_RESULT([not found])
else
ihk_result=$ihk_addr
ihk_addr="0x$ihk_addr"
m4_ifval([$2],[],[
if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_$1\$" >/dev/null`; then
ihk_result="exported"
ihk_addr="0"
fi
])
AC_MSG_RESULT([$ihk_result])
AC_DEFINE_UNQUOTED(IHK_KSYM_[]$1$3,$ihk_addr,
[Define to address of kernel symbol $1$3, or 0 if exported])
fi
])
# <older version>
# AC_DEFUN([IHK_FIND_KSYM],[
# AC_MSG_CHECKING([[System.map for symbol $1]])
# ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " $1\$" | cut -d\ -f1`
# if test -z $ihk_addr; then
# AC_MSG_RESULT([not found])
# else
# ihk_result=$ihk_addr
# ihk_addr="0x$ihk_addr"
# m4_ifval([$2],[],[
# if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_$1\$" >/dev/null`; then
# ihk_result="exported"
# ihk_addr="0"
# fi
# ])
# AC_MSG_RESULT([$ihk_result])
# AC_DEFINE_UNQUOTED(IHK_KSYM_[]$1,$ihk_addr,
# [Define to address of kernel symbol $1, or 0 if exported])
# fi
# ])

if test "$TARGET" = "smp-arm64"; then
IHK_FIND_KSYM([gic_data], [irq-gic-v3.c], [_gicv3])
IHK_FIND_KSYM([gic_raise_softirq], [irq-gic-v3.c], [_gicv3])
fi

if test "x$ENABLE_MEMDUMP" != "xno" ; then
enableval=yes
# POSTK_DEBUG_ARCH_DEP_32, AC_CHECK_LIB for libiberty
Expand Down Expand Up @@ -401,8 +306,6 @@ AC_SUBST(uncomment_if_ENABLE_MEMDUMP)
case "$TARGET" in
smp*)
AC_CONFIG_HEADERS([config.h])
arch=`echo "$ARCH"`
AC_CONFIG_HEADERS([linux/driver/smp/arch/$arch/config-$arch.h])
;;
esac

Expand Down
67 changes: 0 additions & 67 deletions linux/driver/smp/arch/arm64/config-arm64.h.in

This file was deleted.

Loading

0 comments on commit 4e733a2

Please sign in to comment.