[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-0f00717ecce4b366b3f530153e982cb2eeadafd1@git.kernel.org>
Date: Thu, 22 Nov 2018 13:47:07 -0800
From: tip-bot for Babu Moger <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: x86@...nel.org, mingo@...hat.com, arnd@...db.de,
linux-kernel@...r.kernel.org, mingo@...nel.org, bp@...e.de,
davem@...emloft.net, linux-doc@...r.kernel.org,
kstewart@...uxfoundation.org, dwmw2@...radead.org, hpa@...or.com,
babu.moger@....com, Thomas.Lendacky@....com,
gregkh@...uxfoundation.org, jpoimboe@...hat.com,
reinette.chatre@...el.com, brijesh.singh@....com,
tglx@...utronix.de, qianyue.zj@...baba-inc.com,
kirill.shutemov@...ux.intel.com, tony.luck@...el.com,
dima@...sta.com, rafael@...nel.org, chang.seok.bae@...el.com,
xiaochen.shen@...el.com, puwen@...on.cn, pbonzini@...hat.com,
sherry.hurwitz@....com, fenghua.yu@...el.com, rian@...m.mit.edu,
jroedel@...e.de, akpm@...ux-foundation.org, peterz@...radead.org,
jannh@...gle.com, Babu.Moger@....com, corbet@....net,
luto@...nel.org, vkuznets@...hat.com,
suravee.suthikulpanit@....com, pombredanne@...b.com,
mchehab+samsung@...nel.org
Subject: [tip:x86/cache] x86/resctrl: Re-arrange the RDT init code
Commit-ID: 0f00717ecce4b366b3f530153e982cb2eeadafd1
Gitweb: https://git.kernel.org/tip/0f00717ecce4b366b3f530153e982cb2eeadafd1
Author: Babu Moger <Babu.Moger@....com>
AuthorDate: Wed, 21 Nov 2018 20:28:29 +0000
Committer: Borislav Petkov <bp@...e.de>
CommitDate: Thu, 22 Nov 2018 20:16:19 +0100
x86/resctrl: Re-arrange the RDT init code
Separate the call sequence for rdt_quirks and MBA feature. This is in
preparation to handle vendor differences in these call sequences. Rename
the functions to make the flow a bit more meaningful.
Signed-off-by: Babu Moger <babu.moger@....com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Brijesh Singh <brijesh.singh@....com>
Cc: "Chang S. Bae" <chang.seok.bae@...el.com>
Cc: David Miller <davem@...emloft.net>
Cc: David Woodhouse <dwmw2@...radead.org>
Cc: Dmitry Safonov <dima@...sta.com>
Cc: Fenghua Yu <fenghua.yu@...el.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Jann Horn <jannh@...gle.com>
Cc: Joerg Roedel <jroedel@...e.de>
Cc: Jonathan Corbet <corbet@....net>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Kate Stewart <kstewart@...uxfoundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: <linux-doc@...r.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+samsung@...nel.org>
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Philippe Ombredanne <pombredanne@...b.com>
Cc: Pu Wen <puwen@...on.cn>
Cc: <qianyue.zj@...baba-inc.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Reinette Chatre <reinette.chatre@...el.com>
Cc: Rian Hunter <rian@...m.mit.edu>
Cc: Sherry Hurwitz <sherry.hurwitz@....com>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Thomas Lendacky <Thomas.Lendacky@....com>
Cc: Tony Luck <tony.luck@...el.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: <xiaochen.shen@...el.com>
Cc: x86-ml <x86@...nel.org>
Link: https://lkml.kernel.org/r/20181121202811.4492-4-babu.moger@amd.com
---
arch/x86/kernel/cpu/resctrl/core.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 0cf890ae0de2..40380731c588 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -259,7 +259,7 @@ static inline bool rdt_get_mb_table(struct rdt_resource *r)
return false;
}
-static bool rdt_get_mem_config(struct rdt_resource *r)
+static bool __get_mem_config(struct rdt_resource *r)
{
union cpuid_0x10_3_eax eax;
union cpuid_0x10_x_edx edx;
@@ -794,6 +794,14 @@ static bool __init rdt_cpu_has(int flag)
return ret;
}
+static __init bool get_mem_config(void)
+{
+ if (rdt_cpu_has(X86_FEATURE_MBA))
+ return __get_mem_config(&rdt_resources_all[RDT_RESOURCE_MBA]);
+
+ return false;
+}
+
static __init bool get_rdt_alloc_resources(void)
{
bool ret = false;
@@ -818,10 +826,9 @@ static __init bool get_rdt_alloc_resources(void)
ret = true;
}
- if (rdt_cpu_has(X86_FEATURE_MBA)) {
- if (rdt_get_mem_config(&rdt_resources_all[RDT_RESOURCE_MBA]))
- ret = true;
- }
+ if (get_mem_config())
+ ret = true;
+
return ret;
}
@@ -840,7 +847,7 @@ static __init bool get_rdt_mon_resources(void)
return !rdt_get_mon_l3_config(&rdt_resources_all[RDT_RESOURCE_L3]);
}
-static __init void rdt_quirks(void)
+static __init void __check_quirks_intel(void)
{
switch (boot_cpu_data.x86_model) {
case INTEL_FAM6_HASWELL_X:
@@ -855,9 +862,14 @@ static __init void rdt_quirks(void)
}
}
+static __init void check_quirks(void)
+{
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+ __check_quirks_intel();
+}
+
static __init bool get_rdt_resources(void)
{
- rdt_quirks();
rdt_alloc_capable = get_rdt_alloc_resources();
rdt_mon_capable = get_rdt_mon_resources();
@@ -871,6 +883,8 @@ static int __init resctrl_late_init(void)
struct rdt_resource *r;
int state, ret;
+ check_quirks();
+
if (!get_rdt_resources())
return -ENODEV;
Powered by blists - more mailing lists