diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-10-19 15:01:46 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2012-11-07 10:40:33 -0500 |
commit | 6d877e6b85691e0b2b22e90aeb9b86c3dafcfc6b (patch) | |
tree | f6902d9a2a84abc7d13203bf18b978f7ef1d16cc /include/xen | |
parent | cf47a83fb06e42ae1b572ed68326068c7feaceae (diff) |
xen/hvm: If we fail to fetch an HVM parameter print out which flag it is.
Makes it easier to troubleshoot in the field.
Acked-by: Ian Campbell <ian.campbell@citrix.com>
[v1: Use macro per Ian's suggestion]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'include/xen')
-rw-r--r-- | include/xen/hvm.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/include/xen/hvm.h b/include/xen/hvm.h index b193fa2f9fdd..13e43e41637d 100644 --- a/include/xen/hvm.h +++ b/include/xen/hvm.h | |||
@@ -5,6 +5,36 @@ | |||
5 | #include <xen/interface/hvm/params.h> | 5 | #include <xen/interface/hvm/params.h> |
6 | #include <asm/xen/hypercall.h> | 6 | #include <asm/xen/hypercall.h> |
7 | 7 | ||
8 | static const char *param_name(int op) | ||
9 | { | ||
10 | #define PARAM(x) [HVM_PARAM_##x] = #x | ||
11 | static const char *const names[] = { | ||
12 | PARAM(CALLBACK_IRQ), | ||
13 | PARAM(STORE_PFN), | ||
14 | PARAM(STORE_EVTCHN), | ||
15 | PARAM(PAE_ENABLED), | ||
16 | PARAM(IOREQ_PFN), | ||
17 | PARAM(BUFIOREQ_PFN), | ||
18 | PARAM(TIMER_MODE), | ||
19 | PARAM(HPET_ENABLED), | ||
20 | PARAM(IDENT_PT), | ||
21 | PARAM(DM_DOMAIN), | ||
22 | PARAM(ACPI_S_STATE), | ||
23 | PARAM(VM86_TSS), | ||
24 | PARAM(VPT_ALIGN), | ||
25 | PARAM(CONSOLE_PFN), | ||
26 | PARAM(CONSOLE_EVTCHN), | ||
27 | }; | ||
28 | #undef PARAM | ||
29 | |||
30 | if (op >= ARRAY_SIZE(names)) | ||
31 | return "unknown"; | ||
32 | |||
33 | if (!names[op]) | ||
34 | return "reserved"; | ||
35 | |||
36 | return names[op]; | ||
37 | } | ||
8 | static inline int hvm_get_parameter(int idx, uint64_t *value) | 38 | static inline int hvm_get_parameter(int idx, uint64_t *value) |
9 | { | 39 | { |
10 | struct xen_hvm_param xhv; | 40 | struct xen_hvm_param xhv; |
@@ -14,8 +44,8 @@ static inline int hvm_get_parameter(int idx, uint64_t *value) | |||
14 | xhv.index = idx; | 44 | xhv.index = idx; |
15 | r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); | 45 | r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); |
16 | if (r < 0) { | 46 | if (r < 0) { |
17 | printk(KERN_ERR "Cannot get hvm parameter %d: %d!\n", | 47 | printk(KERN_ERR "Cannot get hvm parameter %s (%d): %d!\n", |
18 | idx, r); | 48 | param_name(idx), idx, r); |
19 | return r; | 49 | return r; |
20 | } | 50 | } |
21 | *value = xhv.value; | 51 | *value = xhv.value; |