All of lore.kernel.org
 help / color / mirror / Atom feed
* Libxc code to get MTRR memory type for physical address pa
@ 2012-12-13 15:13 Razvan Cojocaru
  2012-12-13 17:21 ` Tim Deegan
  0 siblings, 1 reply; 3+ messages in thread
From: Razvan Cojocaru @ 2012-12-13 15:13 UTC (permalink / raw)
  To: xen-devel@lists.xen.org

Hello,

what would be the libxc-based equivalent of get_mtrr_type(struct 
mtrr_state *m, paddr_t pa) (from xen/arch/x86/hvm/mtrr.c)?

I've searched the source code and found this:

struct hvm_hw_mtrr {
#define MTRR_VCNT 8
#define NUM_FIXED_MSR 11
     uint64_t msr_pat_cr;
     /* mtrr physbase & physmask msr pair*/
     uint64_t msr_mtrr_var[MTRR_VCNT*2];
     uint64_t msr_mtrr_fixed[NUM_FIXED_MSR];
     uint64_t msr_mtrr_cap;
     uint64_t msr_mtrr_def_type;
};

in xen/include/public/arch-x86/hvm/save.h. I can retrieve that using
xc_domain_hvm_getcontext_partial(), but what would the the best way to 
get the uint8_t result, for a given 'pa', that get_mtrr_type() returns?

Thanks,
Razvan Cojocaru

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Libxc code to get MTRR memory type for physical address pa
  2012-12-13 15:13 Libxc code to get MTRR memory type for physical address pa Razvan Cojocaru
@ 2012-12-13 17:21 ` Tim Deegan
  2012-12-13 17:32   ` Razvan Cojocaru
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Deegan @ 2012-12-13 17:21 UTC (permalink / raw)
  To: Razvan Cojocaru; +Cc: xen-devel@lists.xen.org

At 17:13 +0200 on 13 Dec (1355418813), Razvan Cojocaru wrote:
> Hello,
> 
> what would be the libxc-based equivalent of get_mtrr_type(struct 
> mtrr_state *m, paddr_t pa) (from xen/arch/x86/hvm/mtrr.c)?
> 
> I've searched the source code and found this:
> 
> struct hvm_hw_mtrr {
> #define MTRR_VCNT 8
> #define NUM_FIXED_MSR 11
>     uint64_t msr_pat_cr;
>     /* mtrr physbase & physmask msr pair*/
>     uint64_t msr_mtrr_var[MTRR_VCNT*2];
>     uint64_t msr_mtrr_fixed[NUM_FIXED_MSR];
>     uint64_t msr_mtrr_cap;
>     uint64_t msr_mtrr_def_type;
> };
> 
> in xen/include/public/arch-x86/hvm/save.h. I can retrieve that using
> xc_domain_hvm_getcontext_partial(), but what would the the best way to 
> get the uint8_t result, for a given 'pa', that get_mtrr_type() returns?

I think you'd have to write some code to decode the MTRRs, by copying
the logic that Xen uses in get_mtrr_type (or by following the processor
manuals).

If you do, please send a patch to add it to libxc for the next person!

Tim.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Libxc code to get MTRR memory type for physical address pa
  2012-12-13 17:21 ` Tim Deegan
@ 2012-12-13 17:32   ` Razvan Cojocaru
  0 siblings, 0 replies; 3+ messages in thread
From: Razvan Cojocaru @ 2012-12-13 17:32 UTC (permalink / raw)
  To: Tim Deegan; +Cc: xen-devel@lists.xen.org

> I think you'd have to write some code to decode the MTRRs, by copying
> the logic that Xen uses in get_mtrr_type (or by following the processor
> manuals).
>
> If you do, please send a patch to add it to libxc for the next person!

Ah, I thought it might come to this. :) Of course, if I end up doing it 
I'll happily contribute the patch.

Thanks,
Razvan Cojocaru

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-13 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13 15:13 Libxc code to get MTRR memory type for physical address pa Razvan Cojocaru
2012-12-13 17:21 ` Tim Deegan
2012-12-13 17:32   ` Razvan Cojocaru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.