[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181005205512.29545-4-babu.moger@amd.com>
Date: Fri, 5 Oct 2018 20:55:45 +0000
From: "Moger, Babu" <Babu.Moger@....com>
To: "tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"hpa@...or.com" <hpa@...or.com>,
"reinette.chatre@...el.com" <reinette.chatre@...el.com>,
"fenghua.yu@...el.com" <fenghua.yu@...el.com>,
"james.morse@....com" <james.morse@....com>,
"vikas.shivappa@...ux.intel.com" <vikas.shivappa@...ux.intel.com>,
"tony.luck@...el.com" <tony.luck@...el.com>
CC: "x86@...nel.org" <x86@...nel.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"Moger, Babu" <Babu.Moger@....com>,
"pombredanne@...b.com" <pombredanne@...b.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"kstewart@...uxfoundation.org" <kstewart@...uxfoundation.org>,
"bp@...e.de" <bp@...e.de>,
"rafael.j.wysocki@...el.com" <rafael.j.wysocki@...el.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"xiaochen.shen@...el.com" <xiaochen.shen@...el.com>,
"colin.king@...onical.com" <colin.king@...onical.com>,
"Hurwitz, Sherry" <sherry.hurwitz@....com>,
"Lendacky, Thomas" <Thomas.Lendacky@....com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"dwmw@...zon.co.uk" <dwmw@...zon.co.uk>,
"luto@...nel.org" <luto@...nel.org>,
"jroedel@...e.de" <jroedel@...e.de>,
"jannh@...gle.com" <jannh@...gle.com>,
"dima@...sta.com" <dima@...sta.com>,
"jpoimboe@...hat.com" <jpoimboe@...hat.com>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 03/11] arch/x86: Re-arrange 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.
Signed-off-by: Babu Moger <babu.moger@....com>
---
arch/x86/kernel/cpu/rdt.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/rdt.c b/arch/x86/kernel/cpu/rdt.c
index b361c63170d7..c3ac7f9a3a0f 100644
--- a/arch/x86/kernel/cpu/rdt.c
+++ b/arch/x86/kernel/cpu/rdt.c
@@ -789,6 +789,16 @@ static bool __init rdt_cpu_has(int flag)
return ret;
}
+static __init bool rdt_mba_config(void)
+{
+ if (rdt_cpu_has(X86_FEATURE_MBA)) {
+ if (rdt_get_mem_config(&rdt_resources_all[RDT_RESOURCE_MBA]))
+ return true;
+ }
+
+ return false;
+}
+
static __init bool get_rdt_alloc_resources(void)
{
bool ret = false;
@@ -813,10 +823,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 (rdt_mba_config())
+ ret = true;
+
return ret;
}
@@ -835,7 +844,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 rdt_quirks_intel(void)
{
switch (boot_cpu_data.x86_model) {
case INTEL_FAM6_HASWELL_X:
@@ -850,9 +859,14 @@ static __init void rdt_quirks(void)
}
}
+static __init void rdt_quirks(void)
+{
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+ rdt_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();
@@ -866,6 +880,9 @@ static int __init rdt_late_init(void)
struct rdt_resource *r;
int state, ret;
+ /* Run quirks first */
+ rdt_quirks();
+
if (!get_rdt_resources())
return -ENODEV;
--
2.17.1
Powered by blists - more mailing lists