[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-1ad4fa41d99f606098fd7b90c1f5deb2b3dfae5d@git.kernel.org>
Date: Thu, 22 Nov 2018 13:48:16 -0800
From: tip-bot for Babu Moger <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: mingo@...nel.org, bp@...e.de, qianyue.zj@...baba-inc.com,
mingo@...hat.com, brijesh.singh@....com, Babu.Moger@....com,
chang.seok.bae@...el.com, linux-kernel@...r.kernel.org,
hpa@...or.com, tony.luck@...el.com, reinette.chatre@...el.com,
arnd@...db.de, tglx@...utronix.de, babu.moger@....com,
dima@...sta.com, rian@...m.mit.edu, dwmw2@...radead.org,
akpm@...ux-foundation.org, sherry.hurwitz@....com,
jpoimboe@...hat.com, pbonzini@...hat.com, peterz@...radead.org,
suravee.suthikulpanit@....com, vkuznets@...hat.com,
gregkh@...uxfoundation.org, jannh@...gle.com, rafael@...nel.org,
kirill.shutemov@...ux.intel.com, corbet@....net, jroedel@...e.de,
fenghua.yu@...el.com, xiaochen.shen@...el.com, puwen@...on.cn,
linux-doc@...r.kernel.org, mchehab+samsung@...nel.org,
luto@...nel.org, pombredanne@...b.com, davem@...emloft.net,
kstewart@...uxfoundation.org, Thomas.Lendacky@....com
Subject: [tip:x86/cache] x86/resctrl: Initialize the vendor-specific
resource functions
Commit-ID: 1ad4fa41d99f606098fd7b90c1f5deb2b3dfae5d
Gitweb: https://git.kernel.org/tip/1ad4fa41d99f606098fd7b90c1f5deb2b3dfae5d
Author: Babu Moger <Babu.Moger@....com>
AuthorDate: Wed, 21 Nov 2018 20:28:33 +0000
Committer: Borislav Petkov <bp@...e.de>
CommitDate: Thu, 22 Nov 2018 20:16:19 +0100
x86/resctrl: Initialize the vendor-specific resource functions
Initialize the resource functions that are different between the
vendors. Some features are initialized differently between the vendors.
Add _intel suffix to Intel-specific functions.
For example, the MBA feature varies significantly between Intel and AMD.
Separate the initialization of these resource functions. That way we can
easily add AMD's functions later.
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>
Link: https://lkml.kernel.org/r/20181121202811.4492-6-babu.moger@amd.com
---
arch/x86/kernel/cpu/resctrl/core.c | 34 ++++++++++++++++++++++++++-----
arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 4 ++--
arch/x86/kernel/cpu/resctrl/internal.h | 8 ++++++--
3 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index cf6491eeadc6..3bd245b057c4 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -57,7 +57,8 @@ int max_name_width, max_data_width;
bool rdt_alloc_capable;
static void
-mba_wrmsr(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r);
+mba_wrmsr_intel(struct rdt_domain *d, struct msr_param *m,
+ struct rdt_resource *r);
static void
cat_wrmsr(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r);
@@ -171,10 +172,7 @@ struct rdt_resource rdt_resources_all[] = {
.rid = RDT_RESOURCE_MBA,
.name = "MB",
.domains = domain_init(RDT_RESOURCE_MBA),
- .msr_base = MSR_IA32_MBA_THRTL_BASE,
- .msr_update = mba_wrmsr,
.cache_level = 3,
- .parse_ctrlval = parse_bw,
.format_str = "%d=%*u",
.fflags = RFTYPE_RES_MB,
},
@@ -357,7 +355,8 @@ u32 delay_bw_map(unsigned long bw, struct rdt_resource *r)
}
static void
-mba_wrmsr(struct rdt_domain *d, struct msr_param *m, struct rdt_resource *r)
+mba_wrmsr_intel(struct rdt_domain *d, struct msr_param *m,
+ struct rdt_resource *r)
{
unsigned int i;
@@ -874,6 +873,25 @@ static __init bool get_rdt_resources(void)
return (rdt_mon_capable || rdt_alloc_capable);
}
+static __init void rdt_init_res_defs_intel(void)
+{
+ struct rdt_resource *r;
+
+ for_each_rdt_resource(r) {
+ if (r->rid == RDT_RESOURCE_MBA) {
+ r->msr_base = MSR_IA32_MBA_THRTL_BASE;
+ r->msr_update = mba_wrmsr_intel;
+ r->parse_ctrlval = parse_bw_intel;
+ }
+ }
+}
+
+static __init void rdt_init_res_defs(void)
+{
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+ rdt_init_res_defs_intel();
+}
+
static enum cpuhp_state rdt_online;
static int __init resctrl_late_init(void)
@@ -881,6 +899,12 @@ static int __init resctrl_late_init(void)
struct rdt_resource *r;
int state, ret;
+ /*
+ * Initialize functions(or definitions) that are different
+ * between vendors here.
+ */
+ rdt_init_res_defs();
+
check_quirks();
if (!get_rdt_resources())
diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index 407d2179bfcb..a8ae87e756e9 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -64,8 +64,8 @@ static bool bw_validate(char *buf, unsigned long *data, struct rdt_resource *r)
return true;
}
-int parse_bw(struct rdt_parse_data *data, struct rdt_resource *r,
- struct rdt_domain *d)
+int parse_bw_intel(struct rdt_parse_data *data, struct rdt_resource *r,
+ struct rdt_domain *d)
{
unsigned long bw_val;
diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index fb26d347ae6c..9a643f444723 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -444,8 +444,8 @@ struct rdt_resource {
int parse_cbm(struct rdt_parse_data *data, struct rdt_resource *r,
struct rdt_domain *d);
-int parse_bw(struct rdt_parse_data *data, struct rdt_resource *r,
- struct rdt_domain *d);
+int parse_bw_intel(struct rdt_parse_data *data, struct rdt_resource *r,
+ struct rdt_domain *d);
extern struct mutex rdtgroup_mutex;
@@ -468,6 +468,10 @@ enum {
RDT_NUM_RESOURCES,
};
+#define for_each_rdt_resource(r) \
+ for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
+ r++)
+
#define for_each_capable_rdt_resource(r) \
for (r = rdt_resources_all; r < rdt_resources_all + RDT_NUM_RESOURCES;\
r++) \
Powered by blists - more mailing lists