@@ -7,12 +7,44 @@
#include "target/i386/cpu.h"
#include "hw/isa/isa.h"
+/* Max counts for allocation masks or CBMs. In other words, the size of respective MSRs*/
+#define MAX_L3_MASK_COUNT 128
+#define MAX_L2_MASK_COUNT 48
+#define MAX_MBA_THRTL_COUNT 31
+
#define TYPE_RDT "rdt"
+#define RDT_NUM_RMID_PROP "rmids"
OBJECT_DECLARE_TYPE(RDTState, RDTStateClass, RDT);
+struct RDTMonitor {
+ uint64_t count_local;
+ uint64_t count_remote;
+ uint64_t count_l3;
+};
+
+struct RDTAllocation {
+ uint32_t active_cos;
+};
+
+struct RDTStateInstance {
+ uint32_t active_rmid;
+ GArray *monitors;
+
+ RDTState *rdtstate;
+};
+
struct RDTState {
ISADevice parent;
+
+ uint32_t rmids;
+
+ GArray *rdtInstances;
+ GArray *allocations;
+
+ uint32_t msr_L3_ia32_mask_n[MAX_L3_MASK_COUNT];
+ uint32_t msr_L2_ia32_mask_n[MAX_L2_MASK_COUNT];
+ uint32_t ia32_L2_qos_ext_bw_thrtl_n[MAX_MBA_THRTL_COUNT];
};
struct RDTStateClass { };
@@ -20,6 +52,7 @@ struct RDTStateClass { };
OBJECT_DEFINE_TYPE(RDTState, rdt, RDT, ISA_DEVICE);
static Property rdt_properties[] = {
+ DEFINE_PROP_UINT32(RDT_NUM_RMID_PROP, RDTState, rmids, 256),
DEFINE_PROP_END_OF_LIST(),
};
@@ -1987,6 +1987,8 @@ typedef struct CPUArchState {
struct kvm_msrs;
+struct RDTState;
+struct rdtStateInstance;
/**
* X86CPU:
* @env: #CPUX86State
@@ -2143,6 +2145,9 @@ struct ArchCPU {
struct MemoryRegion *cpu_as_root, *cpu_as_mem, *smram;
Notifier machine_done;
+ /* Help the RDT MSRs find the RDT device */
+ struct RDTStateInstance *rdt;
+
struct kvm_msrs *kvm_msr_buf;
int32_t node_id; /* NUMA node this CPU belongs to */