|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 1/5] x86: allow reading MSR_IA32_TSC with XENPF_resource_op
Memory bandwidth monitoring requires timestamp returned along with the
monitoring counter to verify the correctness of the counter value.
Allow MSR_IA32_TSC to be read and increase RESOURCE_ACCESS_MAX_ENTRIES
to 3.
Signed-off-by: Chao Peng <chao.p.peng@xxxxxxxxxxxxxxx>
---
xen/arch/x86/platform_hypercall.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/platform_hypercall.c
b/xen/arch/x86/platform_hypercall.c
index 32f39b2..e80b857 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -61,14 +61,14 @@ long cpu_down_helper(void *data);
long core_parking_helper(void *data);
uint32_t get_cur_idle_nums(void);
-#define RESOURCE_ACCESS_MAX_ENTRIES 2
+#define RESOURCE_ACCESS_MAX_ENTRIES 3
struct xen_resource_access {
unsigned int nr_done;
unsigned int nr_entries;
xenpf_resource_entry_t *entries;
};
-static bool_t allow_access_msr(unsigned int msr)
+static bool_t allow_access_msr(unsigned int msr, unsigned int cmd)
{
switch ( msr )
{
@@ -76,6 +76,8 @@ static bool_t allow_access_msr(unsigned int msr)
case MSR_IA32_CMT_EVTSEL:
case MSR_IA32_CMT_CTR:
return 1;
+ case MSR_IA32_TSC:
+ return cmd == XEN_RESOURCE_OP_MSR_READ;
}
return 0;
@@ -102,7 +104,7 @@ static void check_resource_access(struct
xen_resource_access *ra)
case XEN_RESOURCE_OP_MSR_WRITE:
if ( entry->idx >> 32 )
ret = -EINVAL;
- else if ( !allow_access_msr(entry->idx) )
+ else if ( !allow_access_msr(entry->idx, entry->u.cmd) )
ret = -EACCES;
break;
default:
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |