Skip to content

Commit

Permalink
Revert "drm/amdkcl: Test whether smca_get_bank_type() has two arguments"
Browse files Browse the repository at this point in the history
This reverts commit 8ebcaa1.
  • Loading branch information
Asher Song authored and Asher Song committed Aug 26, 2022
1 parent 8ebcaa1 commit cd584f0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 70 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
Original file line number Diff line number Diff line change
Expand Up @@ -2851,7 +2851,7 @@ static int amdgpu_bad_page_notifier(struct notifier_block *nb,
* and error occurred in DramECC (Extended error code = 0) then only
* process the error, else bail out.
*/
if (!m || !((kcl_smca_get_bank_type(m->extcpu, m->bank) == SMCA_UMC_V2) &&
if (!m || !((smca_get_bank_type(m->extcpu, m->bank) == SMCA_UMC_V2) &&
(XEC(m->status, 0x3f) == 0x0)))
return NOTIFY_DONE;

Expand Down
29 changes: 5 additions & 24 deletions drivers/gpu/drm/amd/amdkcl/kcl_mce_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,10 @@
#ifdef CONFIG_X86_MCE_AMD
#include <asm/mce.h>

#if defined(HAVE_SMCA_GET_BANK_TYPE_WITH_TWO_ARGUMENTS)
enum smca_bank_types kcl_smca_get_bank_type(unsigned int cpu, unsigned int bank)
{
return smca_get_bank_type(cpu, bank);
}
#elif defined(HAVE_SMCA_GET_BANK_TYPE_WITH_ONE_ARGUMENTS)
enum smca_bank_types kcl_smca_get_bank_type(unsigned int cpu, unsigned int bank)
{
return smca_get_bank_type(bank);
}
#ifndef HAVE_SMCA_GET_BANK_TYPE

/* Copied from v5.15-rc2-452-gf38ce910d8df:arch/x86/kernel/cpu/mce/amd.c and modified for KCL */
#elif defined(HAVE_SMCA_BANK_STRUCT)
#ifdef HAVE_SMCA_BANK_STRUCT
enum smca_bank_types smca_get_bank_type(unsigned int bank)
{
struct smca_bank *b;
Expand All @@ -38,24 +29,14 @@ enum smca_bank_types smca_get_bank_type(unsigned int bank)

return b->hwid->bank_type;
}
enum smca_bank_types kcl_smca_get_bank_type(unsigned int cpu, unsigned int bank)
{
return smca_get_bank_type(bank);
}

#else
int smca_get_bank_type(unsigned int bank)
{
pr_warn_once("smca_get_bank_type is not supported\n");
return 0;
}

int kcl_smca_get_bank_type(unsigned int cpu, unsigned int bank)
{
return smca_get_bank_type(bank);
}

#endif
EXPORT_SYMBOL_GPL(kcl_smca_get_bank_type);
#endif /* HAVE_SMCA_BANK_STRUCT */
EXPORT_SYMBOL_GPL(smca_get_bank_type);
#endif /* HAVE_SMCA_GET_BANK_TYPE */

#endif /* CONFIG_X86_MCE_AMD */
7 changes: 2 additions & 5 deletions drivers/gpu/drm/amd/dkms/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,8 @@
/* whether si_mem_available() is available */
#define HAVE_SI_MEM_AVAILABLE 1

/* smca_get_bank_type(x) is available */
/* #undef HAVE_SMCA_GET_BANK_TYPE_WITH_ONE_ARGUMENT */

/* whether smca_get_bank_type(x, x) is available */
#define HAVE_SMCA_GET_BANK_TYPE_WITH_TWO_ARGUMENTS 1
/* smca_get_bank_type() is available */
#define HAVE_SMCA_GET_BANK_TYPE 1

/* is_smca_umc_v2() is available */
/* #undef HAVE_SMCA_UMC_V2 */
Expand Down
52 changes: 15 additions & 37 deletions drivers/gpu/drm/amd/dkms/m4/smca_get_bank_type.m4
Original file line number Diff line number Diff line change
@@ -1,49 +1,27 @@
dnl #
dnl # v5.16-rc1-22-g91f75eb481cf x86/MCE/AMD, EDAC/mce_amd: Support non-uniform MCA bank type enumeration
dnl #
dnl # v5.15-rc2-452-gf38ce910d8df x86/MCE/AMD: Export smca_get_bank_type symbol
dnl #
AC_DEFUN([AC_AMDGPU_SMCA_GET_BANK_TYPE], [
AC_KERNEL_DO_BACKGROUND([
AC_KERNEL_TRY_COMPILE([
#include <linux/limits.h>
#include <asm/mce.h>
],[
unsigned int a = 0, b = 0;
enum smca_bank_types bank_type;
bank_type = smca_get_bank_type(a, b);
],[
AC_DEFINE(HAVE_SMCA_GET_BANK_TYPE_WITH_TWO_ARGUMENTS, 1,
[whether smca_get_bank_type(x, x) is available])
],[
AC_KERNEL_CHECK_SYMBOL_EXPORT([smca_get_bank_type],
[arch/x86/kernel/cpu/mce/amd.c], [
AC_DEFINE(HAVE_SMCA_GET_BANK_TYPE, 1,
[smca_get_bank_type() is available])
], [
dnl #
dnl #
dnl # v5.15-rc2-452-gf38ce910d8df x86/MCE/AMD: Export smca_get_bank_type symbol
dnl # v4.9-rc4-4-g79349f529ab1 x86/RAS: Simplify SMCA bank descriptor struct
dnl #
AC_KERNEL_TRY_COMPILE([
#include <linux/limits.h>
#include <asm/mce.h>
],[
unsigned int a = 0;
enum smca_bank_types bank_type;
bank_type = smca_get_bank_type(a);
],[
AC_DEFINE(HAVE_SMCA_GET_BANK_TYPE_WITH_ONE_ARGUMENT, 1,
[smca_get_bank_type(x) is available])
],[
dnl #
dnl # v4.9-rc4-4-g79349f529ab1 x86/RAS: Simplify SMCA bank descriptor struct
dnl #
AC_KERNEL_TRY_COMPILE([
#include <linux/limits.h>
#include <asm/mce.h>
],[
struct smca_bank *b = NULL;
b->id = 0;
], [
AC_DEFINE(HAVE_STRUCT_SMCA_BANK, 1,
[struct smca_bank is available])
])
], [
struct smca_bank *b = NULL;
b->id = 0;
], [
AC_DEFINE(HAVE_STRUCT_SMCA_BANK, 1,
[struct smca_bank is available])
])
])
])
])
8 changes: 5 additions & 3 deletions include/kcl/kcl_mce.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
#define XEC(x, mask) (((x) >> 16) & mask)
#endif

#if defined(HAVE_SMCA_GET_BANK_TYPE_WITH_TWO_ARGUMENTS) || defined(HAVE_SMCA_GET_BANK_TYPE_WITH_ONE_ARGUMENT) || defined(HAVE_SMCA_BANK_STRUCT)
enum smca_bank_types kcl_smca_get_bank_type(unsigned int bank);
#if !defined(HAVE_SMCA_GET_BANK_TYPE)
#ifdef HAVE_SMCA_BANK_STRUCT
enum smca_bank_types smca_get_bank_type(unsigned int bank);
#else
int kcl_smca_get_bank_type(unsigned int cpu, unsigned int bank);
int smca_get_bank_type(unsigned int bank);
#endif
#endif

#ifndef HAVE_MCE_PRIO_UC
Expand Down

0 comments on commit cd584f0

Please sign in to comment.