From f774ee1fbade9d71120f07651e7396e454c4bf81 Mon Sep 17 00:00:00 2001 From: "Yan, Like" Date: Fri, 24 Apr 2020 09:59:15 +0800 Subject: [PATCH] HV: RDT: merge struct rdt_cache and rdt_membw in to a union A RDT resource could be CAT or MBA, so only one of struct rdt_cache and struct rdt_membw would be used at a time. They should be a union. This commit merge struct rdt_cache and struct rdt_membw in to a union res. Tracked-On: #4604 Signed-off-by: Yan, Like Reviewed-by: Vijay Dhanraj Acked-by: Eddie Dong clos_mask) >= res_cap_info[res].cache.cbm_len) || + if ((fls32(res_clos_info->clos_mask) >= res_cap_info[res].res.cache.cbm_len) || (res_clos_info->msr_index != (res_cap_info[res].msr_base + i))) { ret = false; pr_err("Fix CLOS %d mask=0x%x and(/or) MSR index=0x%x for Res_ID %d in board.c", @@ -162,7 +162,7 @@ static bool setup_res_clos_msr(uint16_t pcpu_id, uint16_t res, struct platform_c } break; case RDT_RESOURCE_MBA: - if ((res_clos_info->mba_delay > res_cap_info[res].membw.mba_max) || + if ((res_clos_info->mba_delay > res_cap_info[res].res.membw.mba_max) || (res_clos_info->msr_index != (res_cap_info[res].msr_base + i))) { ret = false; pr_err("Fix CLOS %d delay=0x%x and(/or) MSR index=0x%x for Res_ID %d in board.c", diff --git a/hypervisor/include/arch/x86/rdt.h b/hypervisor/include/arch/x86/rdt.h index 3817b16ba..98dfad0b5 100644 --- a/hypervisor/include/arch/x86/rdt.h +++ b/hypervisor/include/arch/x86/rdt.h @@ -23,21 +23,19 @@ enum { extern const uint16_t hv_clos; extern const uint16_t platform_clos_num; -struct rdt_cache { - uint32_t bitmask; /* A bitmask where each set bit indicates the corresponding cache way - may be used by other entities in the platform (e.g. GPU) */ - uint16_t cbm_len; /* Length of Cache mask in bits */ -}; - -struct rdt_membw { - uint16_t mba_max; /* Max MBA delay throttling value supported */ - bool delay_linear; /* True if memory B/W delay is in linear scale */ -}; - /* The intel Resource Director Tech(RDT) based Allocation Tech support */ struct rdt_info { - struct rdt_cache cache; - struct rdt_membw membw; + union { + struct { + uint32_t bitmask; /* A bitmask where each set bit indicates the corresponding cache way + may be used by other entities in the platform (e.g. GPU) */ + uint16_t cbm_len; /* Length of Cache mask in bits */ + } cache; + struct rdt_membw { + uint16_t mba_max; /* Max MBA delay throttling value supported */ + bool delay_linear; /* True if memory B/W delay is in linear scale */ + } membw; + } res; uint16_t clos_max; /* Maximum CLOS supported, 0 indicates resource is not supported.*/ uint32_t res_id; uint32_t msr_base; /* MSR base to program clos mask*/