Skip to content

Commit

Permalink
x86/resctrl: Add Hygon QoS support
Browse files Browse the repository at this point in the history
Severity: Important

Add support for Hygon QoS feature.

Signed-off-by: fuhao <[email protected]>
Signed-off-by: WangYuli <[email protected]>
  • Loading branch information
fuhao87 authored and Avenger-285714 committed May 11, 2024
1 parent 18c986e commit 57df8d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions arch/x86/kernel/cpu/hygon.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <asm/cacheinfo.h>
#include <asm/spec-ctrl.h>
#include <asm/delay.h>
#include <asm/resctrl.h>

#include "cpu.h"

Expand Down Expand Up @@ -242,6 +243,7 @@ static void bsp_init_hygon(struct cpuinfo_x86 *c)
x86_amd_ls_cfg_ssbd_mask = 1ULL << 10;
}
}
resctrl_cpu_detect(c);
}

static void early_init_hygon(struct cpuinfo_x86 *c)
Expand Down
10 changes: 7 additions & 3 deletions arch/x86/kernel/cpu/resctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,8 @@ static __init bool get_mem_config(void)

if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
return __get_mem_config_intel(&hw_res->r_resctrl);
else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
return __rdt_get_mem_config_amd(&hw_res->r_resctrl);

return false;
Expand Down Expand Up @@ -907,7 +908,8 @@ static __init void rdt_init_res_defs(void)
{
if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
rdt_init_res_defs_intel();
else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
else if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
rdt_init_res_defs_amd();
}

Expand Down Expand Up @@ -938,7 +940,9 @@ void resctrl_cpu_detect(struct cpuinfo_x86 *c)
c->x86_cache_occ_scale = ebx;
c->x86_cache_mbm_width_offset = eax & 0xff;

if (c->x86_vendor == X86_VENDOR_AMD && !c->x86_cache_mbm_width_offset)
if ((c->x86_vendor == X86_VENDOR_AMD ||
c->x86_vendor == X86_VENDOR_HYGON) &&
!c->x86_cache_mbm_width_offset)
c->x86_cache_mbm_width_offset = MBM_CNTR_WIDTH_OFFSET_AMD;
}
}
Expand Down

0 comments on commit 57df8d3

Please sign in to comment.