From 26ecc5ebdeabdaa0a412a40be0852d9831f01fd1 Mon Sep 17 00:00:00 2001 From: Dominique Martinet Date: Fri, 3 Aug 2018 15:26:19 +0900 Subject: [PATCH] ihk-smp: lookup unexported symbols at runtime The only symbols still looked up at configure time are the arm64 gic_data and gic_raise_softirq symbols, because there are two with the same name. gic_data could be worked around and found with kallsyms_on_each_symbol() because the gic_data_v2 structure is full of zeroes if not used, but gic_raise_softirq is a function and both cannot be told appart easily.... This means kaslr is not supported on arm right now, a future patch will need to compute the offset and add that to the symbols from System.map at run-time, or a smarter way needs to be found. Change-Id: Ib6b4c8f24ef4a33b1d9e6690e2a338cedaa3a559 --- config.h.in | 99 -- configure | 1237 +---------------- configure.ac | 34 +- linux/driver/smp/arch/arm64/smp-arch-driver.c | 260 ++-- .../driver/smp/arch/x86_64/smp-arch-driver.c | 205 +-- linux/driver/smp/smp-arch-driver.h | 1 + linux/driver/smp/smp-driver.c | 5 + 7 files changed, 213 insertions(+), 1628 deletions(-) diff --git a/config.h.in b/config.h.in index 3137c5d4..1b9e978f 100644 --- a/config.h.in +++ b/config.h.in @@ -45,112 +45,13 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define to address of kernel symbol __cpu_logical_map, or 0 if exported */ -#undef IHK_KSYM___cpu_logical_map - -/* Define to address of kernel symbol __default_send_IPI_dest_field, or 0 if - exported */ -#undef IHK_KSYM___default_send_IPI_dest_field - -/* Define to address of kernel symbol __invoke_psci_fn_hvc, or 0 if exported - */ -#undef IHK_KSYM___invoke_psci_fn_hvc - -/* Define to address of kernel symbol __invoke_psci_fn_smc, or 0 if exported - */ -#undef IHK_KSYM___invoke_psci_fn_smc - -/* Define to address of kernel symbol __irq_domain_alloc_irqs, or 0 if - exported */ -#undef IHK_KSYM___irq_domain_alloc_irqs - -/* Define to address of kernel symbol __irq_set_affinity, or 0 if exported */ -#undef IHK_KSYM___irq_set_affinity - -/* Define to address of kernel symbol __oprofile_cpu_pmu, or 0 if exported */ -#undef IHK_KSYM___oprofile_cpu_pmu - -/* Define to address of kernel symbol acpi_gic_ver, or 0 if exported */ -#undef IHK_KSYM_acpi_gic_ver - -/* Define to address of kernel symbol alloc_desc, or 0 if exported */ -#undef IHK_KSYM_alloc_desc - -/* Define to address of kernel symbol arch_timer_rate, or 0 if exported */ -#undef IHK_KSYM_arch_timer_rate - -/* Define to address of kernel symbol arch_timer_use_virtual, or 0 if exported - */ -#undef IHK_KSYM_arch_timer_use_virtual - -/* Define to address of kernel symbol arch_timer_uses_ppi, or 0 if exported */ -#undef IHK_KSYM_arch_timer_uses_ppi - -/* Define to address of kernel symbol cpu_pmu, or 0 if exported */ -#undef IHK_KSYM_cpu_pmu - -/* Define to address of kernel symbol dummy_irq_chip, or 0 if exported */ -#undef IHK_KSYM_dummy_irq_chip - -/* Define to address of kernel symbol get_uv_system_type, or 0 if exported */ -#undef IHK_KSYM_get_uv_system_type - -/* Define to address of kernel symbol gic_data_gicv2, or 0 if exported */ -#undef IHK_KSYM_gic_data_gicv2 - /* 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_gicv2, or 0 if - exported */ -#undef IHK_KSYM_gic_raise_softirq_gicv2 - /* Define to address of kernel symbol gic_raise_softirq_gicv3, or 0 if exported */ #undef IHK_KSYM_gic_raise_softirq_gicv3 -/* Define to address of kernel symbol init_deasserted, or 0 if exported */ -#undef IHK_KSYM_init_deasserted - -/* Define to address of kernel symbol invoke_psci_fn, or 0 if exported */ -#undef IHK_KSYM_invoke_psci_fn - -/* Define to address of kernel symbol irq_desc_tree, or 0 if exported */ -#undef IHK_KSYM_irq_desc_tree - -/* Define to address of kernel symbol irq_domain_free_irqs, or 0 if exported - */ -#undef IHK_KSYM_irq_domain_free_irqs - -/* Define to address of kernel symbol irq_to_desc, or 0 if exported */ -#undef IHK_KSYM_irq_to_desc - -/* Define to address of kernel symbol irq_to_desc_alloc_node, or 0 if exported - */ -#undef IHK_KSYM_irq_to_desc_alloc_node - -/* Define to address of kernel symbol lapic_get_maxlvt, or 0 if exported */ -#undef IHK_KSYM_lapic_get_maxlvt - -/* Define to address of kernel symbol per_cpu__vector_irq, or 0 if exported */ -#undef IHK_KSYM_per_cpu__vector_irq - -/* Define to address of kernel symbol psci_ops, or 0 if exported */ -#undef IHK_KSYM_psci_ops - -/* Define to address of kernel symbol real_mode_header, or 0 if exported */ -#undef IHK_KSYM_real_mode_header - -/* Define to address of kernel symbol vector_irq, or 0 if exported */ -#undef IHK_KSYM_vector_irq - -/* Define to address of kernel symbol wakeup_secondary_cpu_via_init, or 0 if - exported */ -#undef IHK_KSYM_wakeup_secondary_cpu_via_init - -/* Define to address of kernel symbol x86_trampoline_base, or 0 if exported */ -#undef IHK_KSYM_x86_trampoline_base - /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT diff --git a/configure b/configure index 0a9e11bd..7840091f 100755 --- a/configure +++ b/configure @@ -3178,1217 +3178,12 @@ IHK_LINUX_SYMTAB_CMD="cat $IHK_LINUX_SYMTAB" # fi # ]) -if test "$TARGET" = "smp-x86"; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol x86_trampoline_base" >&5 -$as_echo_n "checking System.map for symbol x86_trampoline_base... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " x86_trampoline_base\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_x86_trampoline_base\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_x86_trampoline_base $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol real_mode_header" >&5 -$as_echo_n "checking System.map for symbol real_mode_header... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " real_mode_header\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_real_mode_header\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_real_mode_header $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol per_cpu__vector_irq" >&5 -$as_echo_n "checking System.map for symbol per_cpu__vector_irq... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " per_cpu__vector_irq\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_per_cpu__vector_irq\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_per_cpu__vector_irq $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol vector_irq" >&5 -$as_echo_n "checking System.map for symbol vector_irq... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " vector_irq\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_vector_irq\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_vector_irq $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol lapic_get_maxlvt" >&5 -$as_echo_n "checking System.map for symbol lapic_get_maxlvt... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " lapic_get_maxlvt\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_lapic_get_maxlvt\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_lapic_get_maxlvt $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol init_deasserted" >&5 -$as_echo_n "checking System.map for symbol init_deasserted... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " init_deasserted\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_init_deasserted\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_init_deasserted $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol irq_to_desc" >&5 -$as_echo_n "checking System.map for symbol irq_to_desc... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " irq_to_desc\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_irq_to_desc\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_irq_to_desc $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol alloc_desc" >&5 -$as_echo_n "checking System.map for symbol alloc_desc... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " alloc_desc\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_alloc_desc\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_alloc_desc $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol irq_desc_tree" >&5 -$as_echo_n "checking System.map for symbol irq_desc_tree... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " irq_desc_tree\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_irq_desc_tree\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_irq_desc_tree $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol irq_to_desc_alloc_node" >&5 -$as_echo_n "checking System.map for symbol irq_to_desc_alloc_node... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " irq_to_desc_alloc_node\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_irq_to_desc_alloc_node\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_irq_to_desc_alloc_node $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol dummy_irq_chip" >&5 -$as_echo_n "checking System.map for symbol dummy_irq_chip... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " dummy_irq_chip\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_dummy_irq_chip\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_dummy_irq_chip $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol get_uv_system_type" >&5 -$as_echo_n "checking System.map for symbol get_uv_system_type... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " get_uv_system_type\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_get_uv_system_type\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_get_uv_system_type $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol wakeup_secondary_cpu_via_init" >&5 -$as_echo_n "checking System.map for symbol wakeup_secondary_cpu_via_init... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " wakeup_secondary_cpu_via_init\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_wakeup_secondary_cpu_via_init\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_wakeup_secondary_cpu_via_init $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol __default_send_IPI_dest_field" >&5 -$as_echo_n "checking System.map for symbol __default_send_IPI_dest_field... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " __default_send_IPI_dest_field\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab___default_send_IPI_dest_field\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM___default_send_IPI_dest_field $ihk_addr -_ACEOF - - fi - -elif 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.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_gicv2 $ihk_addr -_ACEOF - - fi - - - { $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.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_gicv2 $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 - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol __irq_domain_alloc_irqs" >&5 -$as_echo_n "checking System.map for symbol __irq_domain_alloc_irqs... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " __irq_domain_alloc_irqs\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab___irq_domain_alloc_irqs\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM___irq_domain_alloc_irqs $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol irq_domain_free_irqs" >&5 -$as_echo_n "checking System.map for symbol irq_domain_free_irqs... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " irq_domain_free_irqs\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_irq_domain_free_irqs\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_irq_domain_free_irqs $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol irq_to_desc" >&5 -$as_echo_n "checking System.map for symbol irq_to_desc... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " irq_to_desc\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_irq_to_desc\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_irq_to_desc $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol alloc_desc" >&5 -$as_echo_n "checking System.map for symbol alloc_desc... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " alloc_desc\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_alloc_desc\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_alloc_desc $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol irq_desc_tree" >&5 -$as_echo_n "checking System.map for symbol irq_desc_tree... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " irq_desc_tree\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_irq_desc_tree\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_irq_desc_tree $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol irq_to_desc_alloc_node" >&5 -$as_echo_n "checking System.map for symbol irq_to_desc_alloc_node... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " irq_to_desc_alloc_node\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_irq_to_desc_alloc_node\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_irq_to_desc_alloc_node $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol psci_ops" >&5 -$as_echo_n "checking System.map for symbol psci_ops... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " psci_ops\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_psci_ops\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_psci_ops $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol __cpu_logical_map" >&5 -$as_echo_n "checking System.map for symbol __cpu_logical_map... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " __cpu_logical_map\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab___cpu_logical_map\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM___cpu_logical_map $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol invoke_psci_fn" >&5 -$as_echo_n "checking System.map for symbol invoke_psci_fn... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " invoke_psci_fn\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_invoke_psci_fn\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_invoke_psci_fn $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol __invoke_psci_fn_hvc" >&5 -$as_echo_n "checking System.map for symbol __invoke_psci_fn_hvc... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " __invoke_psci_fn_hvc\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab___invoke_psci_fn_hvc\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM___invoke_psci_fn_hvc $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol __invoke_psci_fn_smc" >&5 -$as_echo_n "checking System.map for symbol __invoke_psci_fn_smc... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " __invoke_psci_fn_smc\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab___invoke_psci_fn_smc\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM___invoke_psci_fn_smc $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol acpi_gic_ver" >&5 -$as_echo_n "checking System.map for symbol acpi_gic_ver... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " acpi_gic_ver\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_acpi_gic_ver\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_acpi_gic_ver $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol cpu_pmu" >&5 -$as_echo_n "checking System.map for symbol cpu_pmu... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " cpu_pmu\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_cpu_pmu\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_cpu_pmu $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol __oprofile_cpu_pmu" >&5 -$as_echo_n "checking System.map for symbol __oprofile_cpu_pmu... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " __oprofile_cpu_pmu\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab___oprofile_cpu_pmu\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM___oprofile_cpu_pmu $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol __irq_set_affinity" >&5 -$as_echo_n "checking System.map for symbol __irq_set_affinity... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " __irq_set_affinity\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab___irq_set_affinity\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM___irq_set_affinity $ihk_addr -_ACEOF - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol arch_timer_use_virtual" >&5 -$as_echo_n "checking System.map for symbol arch_timer_use_virtual... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " arch_timer_use_virtual\$" | 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" - - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_arch_timer_use_virtual\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 -$as_echo "$ihk_result" >&6; } - -cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_arch_timer_use_virtual $ihk_addr -_ACEOF - - fi - +if test "$TARGET" = "smp-arm64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol arch_timer_uses_ppi" >&5 -$as_echo_n "checking System.map for symbol arch_timer_uses_ppi... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " arch_timer_uses_ppi\$" | cut -d\ -f1` + { $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 @@ -4406,25 +3201,20 @@ $as_echo "not found" >&6; } ihk_result=$ihk_addr ihk_addr="0x$ihk_addr" - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_arch_timer_uses_ppi\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 $as_echo "$ihk_result" >&6; } cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_arch_timer_uses_ppi $ihk_addr +#define IHK_KSYM_gic_data_gicv3 $ihk_addr _ACEOF fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking System.map for symbol arch_timer_rate" >&5 -$as_echo_n "checking System.map for symbol arch_timer_rate... " >&6; } - symbol_src= - ihk_addr=`eval $IHK_LINUX_SYMTAB_CMD | grep " arch_timer_rate\$" | cut -d\ -f1` + { $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 @@ -4442,16 +3232,11 @@ $as_echo "not found" >&6; } ihk_result=$ihk_addr ihk_addr="0x$ihk_addr" - if `eval $IHK_LINUX_SYMTAB_CMD | grep " __ksymtab_arch_timer_rate\$" >/dev/null`; then - ihk_result="exported" - ihk_addr="0" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ihk_result" >&5 $as_echo "$ihk_result" >&6; } cat >>confdefs.h <<_ACEOF -#define IHK_KSYM_arch_timer_rate $ihk_addr +#define IHK_KSYM_gic_raise_softirq_gicv3 $ihk_addr _ACEOF fi diff --git a/configure.ac b/configure.ac index 18108ea8..9a79ef7d 100644 --- a/configure.ac +++ b/configure.ac @@ -320,41 +320,9 @@ AC_DEFUN([IHK_FIND_KSYM],[ # fi # ]) -if test "$TARGET" = "smp-x86"; then - IHK_FIND_KSYM([x86_trampoline_base]) - IHK_FIND_KSYM([real_mode_header]) - IHK_FIND_KSYM([per_cpu__vector_irq]) - IHK_FIND_KSYM([vector_irq]) - IHK_FIND_KSYM([lapic_get_maxlvt]) - IHK_FIND_KSYM([init_deasserted]) - IHK_FIND_KSYM([alloc_desc]) - IHK_FIND_KSYM([irq_desc_tree]) - IHK_FIND_KSYM([irq_to_desc_alloc_node]) - IHK_FIND_KSYM([get_uv_system_type]) - IHK_FIND_KSYM([wakeup_secondary_cpu_via_init]) - IHK_FIND_KSYM([__default_send_IPI_dest_field]) -elif test "$TARGET" = "smp-arm64"; then - IHK_FIND_KSYM([gic_data], [irq-gic.c], [_gicv2]) +if test "$TARGET" = "smp-arm64"; then IHK_FIND_KSYM([gic_data], [irq-gic-v3.c], [_gicv3]) - IHK_FIND_KSYM([gic_raise_softirq], [irq-gic.c], [_gicv2]) IHK_FIND_KSYM([gic_raise_softirq], [irq-gic-v3.c], [_gicv3]) - IHK_FIND_KSYM([__irq_domain_alloc_irqs]) - IHK_FIND_KSYM([irq_domain_free_irqs]) - IHK_FIND_KSYM([alloc_desc]) - IHK_FIND_KSYM([irq_desc_tree]) - IHK_FIND_KSYM([irq_to_desc_alloc_node]) - IHK_FIND_KSYM([psci_ops]) - IHK_FIND_KSYM([__cpu_logical_map]) - IHK_FIND_KSYM([invoke_psci_fn]) - IHK_FIND_KSYM([__invoke_psci_fn_hvc]) - IHK_FIND_KSYM([__invoke_psci_fn_smc]) - IHK_FIND_KSYM([acpi_gic_ver]) - IHK_FIND_KSYM([cpu_pmu]) - IHK_FIND_KSYM([__oprofile_cpu_pmu]) - IHK_FIND_KSYM([__irq_set_affinity]) - IHK_FIND_KSYM([arch_timer_use_virtual]) - IHK_FIND_KSYM([arch_timer_uses_ppi]) - IHK_FIND_KSYM([arch_timer_rate]) fi if test "x$ENABLE_MEMDUMP" != "xno" ; then diff --git a/linux/driver/smp/arch/arm64/smp-arch-driver.c b/linux/driver/smp/arch/arm64/smp-arch-driver.c index 36194238..579d0240 100644 --- a/linux/driver/smp/arch/arm64/smp-arch-driver.c +++ b/linux/driver/smp/arch/arm64/smp-arch-driver.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -35,148 +36,6 @@ #include "smp-arch-driver.h" #include "smp-defines-driver.h" -/* - * IHK-SMP unexported kernel symbols - */ -#ifdef IHK_KSYM_gic_data_gicv3 -#if IHK_KSYM_gic_data_gicv3 -struct gic_chip_data_v3 *ihk_gic_data_v3 = - (struct gic_chip_data_v3 *) - IHK_KSYM_gic_data_gicv3; -#endif -#endif - -#ifdef IHK_KSYM_gic_raise_softirq_gicv3 -#if IHK_KSYM_gic_raise_softirq_gicv3 -static void (*ihk___smp_cross_call_gicv3)(const struct cpumask *, unsigned int) = - (void *) - IHK_KSYM_gic_raise_softirq_gicv3; -#endif -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) -#ifdef IHK_KSYM___irq_domain_alloc_irqs -#if IHK_KSYM___irq_domain_alloc_irqs -static int (*ihk___irq_domain_alloc_irqs)(struct irq_domain *domain, - int irq_base, unsigned int nr_irqs, - int node, void *arg, bool realloc) = - (void *) - IHK_KSYM___irq_domain_alloc_irqs; -#endif -#endif - -#ifdef IHK_KSYM_irq_domain_free_irqs -#if IHK_KSYM_irq_domain_free_irqs -static int (*ihk_irq_domain_free_irqs)(unsigned int virq, unsigned int nr_irqs) = - (void *) - IHK_KSYM_irq_domain_free_irqs; -#endif -#endif -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) */ - -#ifdef IHK_KSYM_psci_ops -#if IHK_KSYM_psci_ops -struct psci_operations *ihk_psci_ops = - (struct psci_operations *) - IHK_KSYM_psci_ops; -#endif -#endif - -#ifdef IHK_KSYM___cpu_logical_map -#if IHK_KSYM___cpu_logical_map -static size_t ihk___cpu_logical_map_size = NR_CPUS; -u64 *ihk___cpu_logical_map = - (u64 *) - IHK_KSYM___cpu_logical_map; -#endif -#endif - -#ifdef IHK_KSYM_invoke_psci_fn -unsigned long *ihk_invoke_psci_fn = (unsigned long *)IHK_KSYM_invoke_psci_fn; -#else -unsigned long *ihk_invoke_psci_fn = NULL; -#endif - -#ifdef IHK_KSYM___invoke_psci_fn_hvc -unsigned long ihk___invoke_psci_fn_hvc = (unsigned long)IHK_KSYM___invoke_psci_fn_hvc; -#else -unsigned long ihk___invoke_psci_fn_hvc = 0; -#endif - -#ifdef IHK_KSYM___invoke_psci_fn_smc -unsigned long ihk___invoke_psci_fn_smc = (unsigned long)IHK_KSYM___invoke_psci_fn_smc; -#else -unsigned long ihk___invoke_psci_fn_smc = 0; -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) -# -# ifdef IHK_KSYM_cpu_pmu -static struct arm_pmu **ihk_cpu_pmu = (struct arm_pmu**)IHK_KSYM_cpu_pmu; -# else -# error "'struct arm_pmu cpu_pmu' address is unknown." -# endif -# -#else -# -# ifdef IHK_KSYM___oprofile_cpu_pmu -static struct arm_pmu **ihk_cpu_pmu = (struct arm_pmu**)IHK_KSYM___oprofile_cpu_pmu; -# else -# error "'struct arm_pmu cpu_pmu' address is unknown." -# endif -# -#endif - -#ifdef IHK_KSYM___irq_set_affinity -int (*ihk___irq_set_affinity)(unsigned int irq, const struct cpumask *mask, bool force) = (void*)IHK_KSYM___irq_set_affinity; -#else -# error "'__irq_set_affinity' address is unknown." -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) && !defined(CONFIG_ARM64) -#ifdef IHK_KSYM_arch_timer_use_virtual -static unsigned long is_arch_timer_use_virt(void) -{ - bool *arch_timer_use = (bool *)IHK_KSYM_arch_timer_use_virtual; - return (unsigned long)*arch_timer_use; -} -#else -#error "'arch_timer_use_virtual' address is unknown." -#endif - -#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) */ -#ifdef IHK_KSYM_arch_timer_uses_ppi -static unsigned long is_arch_timer_use_virt(void) -{ - enum ppi_nr { - PHYS_SECURE_PPI, - PHYS_NONSECURE_PPI, - VIRT_PPI, - HYP_PPI, - MAX_TIMER_PPI - }; - enum ppi_nr *arch_timer_use = (enum ppi_nr *)IHK_KSYM_arch_timer_uses_ppi; - - if (*arch_timer_use == VIRT_PPI) { - return 1UL; - } else if (MAX_TIMER_PPI > *arch_timer_use) { - return 0UL; - } else { - return ULONG_MAX; - } -} -#else -#error "'arch_timer_uses_ppi' address is unknown." -#endif - -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,6,0) */ - -#ifdef IHK_KSYM_arch_timer_rate -u32 *ihk_arch_timer_rate = (u32 *)IHK_KSYM_arch_timer_rate; -#else -#error "'arch_timer_rate' address is unknown." -#endif - /* ----------------------------------------------- */ static unsigned int ihk_start_irq = 0; @@ -326,6 +185,123 @@ static unsigned long ihk_smp_psci_method = PSCI_METHOD_INVALID; /* psci_method v /* ----------------------------------------------- */ +/* + * IHK-SMP unexported kernel symbols + */ +static struct gic_chip_data_v3 *ihk_gic_data_v3; +static void (*ihk___smp_cross_call_gicv3)(const struct cpumask *, unsigned int); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +static int (*ihk___irq_domain_alloc_irqs)(struct irq_domain *domain, + int irq_base, unsigned int nr_irqs, + int node, void *arg, bool realloc); +static int (*ihk_irq_domain_free_irqs)(unsigned int virq, + unsigned int nr_irqs); +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) */ +static struct psci_operations *ihk_psci_ops; + +static size_t ihk___cpu_logical_map_size = NR_CPUS; +static u64 *ihk___cpu_logical_map; + +static uintptr_t *ihk_invoke_psci_fn; +static uintptr_t ihk___invoke_psci_fn_hvc; +static uintptr_t ihk___invoke_psci_fn_smc; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +static struct arm_pmu **ihk_cpu_pmu; +#else +static struct arm_pmu **ihk_cpu_pmu; +#endif + +int (*ihk___irq_set_affinity)(unsigned int irq, const struct cpumask *mask, + bool force); + +enum ppi_nr { + PHYS_SECURE_PPI, + PHYS_NONSECURE_PPI, + VIRT_PPI, + HYP_PPI, + MAX_TIMER_PPI +}; + +enum ppi_nr *ihk_arch_timer_uses_ppi; + +u32 *ihk_arch_timer_rate; + +int ihk_smp_arch_symbols_init(void) +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) + ihk___irq_domain_alloc_irqs = + (void *) kallsyms_lookup_name("__irq_domain_alloc_irqs"); + if (WARN_ON(!ihk___irq_domain_alloc_irqs)) + return -EFAULT; + + ihk_irq_domain_free_irqs = + (void *) kallsyms_lookup_name("irq_domain_free_irqs"); + if (WARN_ON(!ihk_irq_domain_free_irqs)) + return -EFAULT; +#endif + ihk_psci_ops = (void *) kallsyms_lookup_name("psci_ops"); + if (WARN_ON(!ihk_psci_ops)) + return -EFAULT; + + ihk___cpu_logical_map = + (void *) kallsyms_lookup_name("__cpu_logical_map"); + if (WARN_ON(!ihk___cpu_logical_map)) + return -EFAULT; + + ihk_invoke_psci_fn = (void *) kallsyms_lookup_name("invoke_psci_fn"); + if (WARN_ON(!ihk_invoke_psci_fn)) + return -EFAULT; + + ihk___invoke_psci_fn_hvc = + (uintptr_t) kallsyms_lookup_name("__invoke_psci_fn_hvc"); + if (WARN_ON(!ihk___invoke_psci_fn_hvc)) + return -EFAULT; + + ihk___invoke_psci_fn_smc = + (uintptr_t) kallsyms_lookup_name("__invoke_psci_fn_smc"); + if (WARN_ON(!ihk___invoke_psci_fn_smc)) + return -EFAULT; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) + ihk_cpu_pmu = (void *) kallsyms_lookup_name("cpu_pmu"); +#else + ihk_cpu_pmu = (void *) kallsyms_lookup_name("__oprofile_cpu_pmu"); +#endif + if (WARN_ON(!ihk_cpu_pmu)) + return -EFAULT; + + ihk___irq_set_affinity = + (void *) kallsyms_lookup_name("__irq_set_affinity"); + if (WARN_ON(!ihk___irq_set_affinity)) + return -EFAULT; + + ihk_arch_timer_uses_ppi = + (void *) kallsyms_lookup_name("arch_timer_uses_ppi"); + if (WARN_ON(!ihk_arch_timer_uses_ppi)) + return -EFAULT; + + ihk_arch_timer_rate = + (void *) kallsyms_lookup_name("arch_timer_rate"); + if (WARN_ON(!ihk_arch_timer_rate)) + return -EFAULT; + + return 0; +} + + +static unsigned long is_arch_timer_use_virt(void) +{ + if (*ihk_arch_timer_uses_ppi == VIRT_PPI) { + return 1UL; + } else if (MAX_TIMER_PPI > *ihk_arch_timer_uses_ppi) { + return 0UL; + } else { + return ULONG_MAX; + } +} + /* @ref.impl arch/arm64/kernel/perf_event.c:armpmu_reserve_hardware */ static int ihk_armpmu_get_irq_affinity(int irqs[], const struct arm_pmu *armpmu, const struct smp_os_data *os) diff --git a/linux/driver/smp/arch/x86_64/smp-arch-driver.c b/linux/driver/smp/arch/x86_64/smp-arch-driver.c index ce50cf8a..7263f245 100644 --- a/linux/driver/smp/arch/x86_64/smp-arch-driver.c +++ b/linux/driver/smp/arch/x86_64/smp-arch-driver.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #if defined(RHEL_RELEASE_CODE) || (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) @@ -37,121 +38,6 @@ #include "smp-arch-driver.h" #include "smp-defines-driver.h" -/* - * IHK-SMP unexported kernel symbols - */ - -#ifdef IHK_KSYM_real_mode_header -#if IHK_KSYM_real_mode_header -struct real_mode_header *real_mode_header = - (void *) - IHK_KSYM_real_mode_header; -#endif -#endif - -#ifdef IHK_KSYM_per_cpu__vector_irq -#if IHK_KSYM_per_cpu__vector_irq -void *_per_cpu__vector_irq = - (void *) - IHK_KSYM_per_cpu__vector_irq; -#endif -#endif - -#ifdef IHK_KSYM_vector_irq -#if IHK_KSYM_vector_irq -void *_vector_irq = - (void *) - IHK_KSYM_vector_irq; -#endif -#endif - -#ifdef IHK_KSYM_lapic_get_maxlvt -#if IHK_KSYM_lapic_get_maxlvt -typedef int (*int_star_fn_void_t)(void); -int (*_lapic_get_maxlvt)(void) = - (int_star_fn_void_t) - IHK_KSYM_lapic_get_maxlvt; -#endif -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) -#ifdef IHK_KSYM_init_deasserted -#if IHK_KSYM_init_deasserted -atomic_t *_init_deasserted = - (atomic_t *) - IHK_KSYM_init_deasserted; -#endif -#endif -#endif - -#ifdef IHK_KSYM_irq_to_desc_alloc_node -#if IHK_KSYM_irq_to_desc_alloc_node -typedef struct irq_desc *(*irq_desc_star_fn_int_int_t)(unsigned int, int); -struct irq_desc *(*_irq_to_desc_alloc_node)(unsigned int irq, int node) = - (irq_desc_star_fn_int_int_t) - IHK_KSYM_irq_to_desc_alloc_node; -#endif -#endif - -#ifdef IHK_KSYM_alloc_desc -#if IHK_KSYM_alloc_desc -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ - (defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 5)) -typedef struct irq_desc *(*irq_desc_star_fn_int_int_int_cpumask_star_module_star_t) - (int, int, unsigned int, const struct cpumask *, struct module*); -struct irq_desc *(*_alloc_desc)(int irq, int node, unsigned int flags, - const struct cpumask *affinity, - struct module *owner) = - (irq_desc_star_fn_int_int_int_cpumask_star_module_star_t) - IHK_KSYM_alloc_desc; -#else -typedef struct irq_desc *(*irq_desc_star_fn_int_int_module_star_t) - (int, int, struct module*); -struct irq_desc *(*_alloc_desc)(int irq, int node, struct module *owner) = - (irq_desc_star_fn_int_int_module_star_t) IHK_KSYM_alloc_desc; -#endif -#endif -#endif - -#ifdef IHK_KSYM_irq_desc_tree -#if IHK_KSYM_irq_desc_tree -struct radix_tree_root *_irq_desc_tree = - (struct radix_tree_root *) - IHK_KSYM_irq_desc_tree; -#endif -#endif - -#ifdef IHK_KSYM_get_uv_system_type -#if IHK_KSYM_get_uv_system_type -typedef enum uv_system_type (*uv_system_type_star_fn_void_t)(void); -enum uv_system_type (*_get_uv_system_type)(void) = - (uv_system_type_star_fn_void_t) - IHK_KSYM_get_uv_system_type; -#endif -#else /* static */ -#define _get_uv_system_type get_uv_system_type -#endif - -#ifdef IHK_KSYM_wakeup_secondary_cpu_via_init -#if IHK_KSYM_wakeup_secondary_cpu_via_init -int (*_wakeup_secondary_cpu_via_init)(int phys_apicid, - unsigned long start_eip) = - IHK_KSYM_wakeup_secondary_cpu_via_init; -#endif -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) -#ifdef IHK_KSYM___default_send_IPI_dest_field -#if IHK_KSYM___default_send_IPI_dest_field -typedef void (*void_fn_unsigned_int_int_unsigned_int_t)(void); -void (*___default_send_IPI_dest_field)(unsigned int mask, - int vector, unsigned int dest) - = (void_fn_unsigned_int_int_unsigned_int_t) - IHK_KSYM___default_send_IPI_dest_field; -#endif -#endif -#endif - /* ----------------------------------------------- */ static unsigned int ihk_start_irq = 0; @@ -199,6 +85,79 @@ struct ihk_smp_trampoline_header { /* ----------------------------------------------- */ + +/* + * IHK-SMP unexported kernel symbols + */ + +static struct real_mode_header *_real_mode_header; +static void *_vector_irq; +static int (*_lapic_get_maxlvt)(void); +static struct radix_tree_root *_irq_desc_tree; +static enum uv_system_type (*_get_uv_system_type)(void); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) +static atomic_t *_init_deasserted; +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ + (defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 5)) +static struct irq_desc *(*_alloc_desc)(int irq, int node, unsigned int flags, + const struct cpumask *affinity, + struct module *owner); +#else +static struct irq_desc *(*_alloc_desc)(int irq, int node, + struct module *owner); +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) +static void (*___default_send_IPI_dest_field)(unsigned int mask, int vector, + unsigned int dest); +#endif + +int ihk_smp_arch_symbols_init(void) +{ + _real_mode_header = (void *) kallsyms_lookup_name("real_mode_header"); + if (WARN_ON(!_real_mode_header)) + return -EFAULT; + + _vector_irq = (void *) kallsyms_lookup_name("vector_irq"); + if (WARN_ON(!_vector_irq)) + return -EFAULT; + + _lapic_get_maxlvt = (void *) kallsyms_lookup_name("lapic_get_maxlvt"); + if (WARN_ON(!_lapic_get_maxlvt)) + return -EFAULT; + + _irq_desc_tree = (void *) kallsyms_lookup_name("irq_desc_tree"); + if (WARN_ON(!_irq_desc_tree)) + return -EFAULT; + + _get_uv_system_type = + (void *) kallsyms_lookup_name("get_uv_system_type"); + if (WARN_ON(!_get_uv_system_type)) + return -EFAULT; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) + _init_deasserted = (void *) kallsyms_lookup_name("init_deasserted"); + if (WARN_ON(!_init_deasserted)) + return -EFAULT; +#endif + + _alloc_desc = (void *) kallsyms_lookup_name("alloc_desc"); + if (WARN_ON(!_alloc_desc)) + return -EFAULT; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) + ___default_send_IPI_dest_field = + (void *) kallsyms_lookup_name("__default_send_IPI_dest_field"); + if (WARN_ON(!___default_send_IPI_dest_field)) + return -EFAULT; +#endif + + return 0; +} + int ihk_smp_get_hw_id(int cpu) { return per_cpu(x86_cpu_to_apicid, cpu); @@ -896,13 +855,10 @@ vector_is_used(int vector, int core) { /* As of 4.3.0, vector_irq is an array of struct irq_desc pointers */ struct irq_desc **vectors = (*SHIFT_PERCPU_PTR((vector_irq_t *)_vector_irq, per_cpu_offset(core))); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) +#else /* TODO: find out where exactly between 2.6.32 and 3.0.0 vector_irq was changed */ int *vectors = (*SHIFT_PERCPU_PTR((vector_irq_t *)_vector_irq, per_cpu_offset(core))); -#else - int *vectors = (*SHIFT_PERCPU_PTR((vector_irq_t *)_per_cpu__vector_irq, - per_cpu_offset(core))); #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) @@ -927,12 +883,9 @@ set_vector(int vector, int core) { /* As of 4.3.0, vector_irq is an array of struct irq_desc pointers */ struct irq_desc **vectors = (*SHIFT_PERCPU_PTR((vector_irq_t *)_vector_irq, per_cpu_offset(core))); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) +#else int *vectors = (*SHIFT_PERCPU_PTR((vector_irq_t *)_vector_irq, per_cpu_offset(core))); -#else - int *vectors = (*SHIFT_PERCPU_PTR((vector_irq_t *)_per_cpu__vector_irq, - per_cpu_offset(core))); #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) @@ -1022,11 +975,7 @@ int smp_ihk_arch_init(void) if (!trampoline_page || page_to_phys(trampoline_page) > 0xFF000) { using_linux_trampoline = 1; printk("IHK-SMP: warning: allocating trampoline_page failed, using Linux'\n"); -#ifdef IHK_KSYM_real_mode_header -#if IHK_KSYM_real_mode_header - trampoline_phys = real_mode_header->trampoline_start; -#endif -#endif + trampoline_phys = _real_mode_header->trampoline_start; trampoline_va = __va(trampoline_phys); } else { diff --git a/linux/driver/smp/smp-arch-driver.h b/linux/driver/smp/smp-arch-driver.h index fd397dea..501d6575 100644 --- a/linux/driver/smp/smp-arch-driver.h +++ b/linux/driver/smp/smp-arch-driver.h @@ -55,6 +55,7 @@ int smp_ihk_unmap_memory(ihk_device_t ihk_dev, void *priv, unsigned long local_phys, unsigned long size); int smp_ihk_arch_init(void); +int ihk_smp_arch_symbols_init(void); int ihk_smp_reset_cpu(int hw_id); void smp_ihk_arch_exit(void); int smp_ihk_os_send_nmi(ihk_os_t ihk_os, void *priv, int mode); diff --git a/linux/driver/smp/smp-driver.c b/linux/driver/smp/smp-driver.c index baf8d3dc..fe7faa6b 100644 --- a/linux/driver/smp/smp-driver.c +++ b/linux/driver/smp/smp-driver.c @@ -4112,9 +4112,14 @@ static struct ihk_register_device_data builtin_dev_reg_data = { static int __init smp_module_init(void) { ihk_device_t ihkd; + int ret; printk(KERN_INFO "IHK-SMP: initializing...\n"); + if ((ret = ihk_smp_arch_symbols_init())) { + return ret; + } + spin_lock_init(&builtin_data.lock); if (!(ihkd = ihk_register_device(&builtin_dev_reg_data))) {