diff options
author | Alex Williamson <alex.williamson@hp.com> | 2007-12-30 13:02:16 -0700 |
---|---|---|
committer | Alex Williamson <alex.williamson@hp.com> | 2007-12-30 13:02:16 -0700 |
commit | 35bcc2fe20cc3ce1091dd82a181a21c61298d19c (patch) | |
tree | e1d0b464e6edeef999eb3b308997099ff7c95ef2 | |
parent | 3be10ebb0105449915b29d3fa393cc5b07b1b7ca (diff) | |
download | xen-35bcc2fe20cc3ce1091dd82a181a21c61298d19c.tar.gz xen-35bcc2fe20cc3ce1091dd82a181a21c61298d19c.tar.bz2 xen-35bcc2fe20cc3ce1091dd82a181a21c61298d19c.zip |
[IA64] Sort out the XEN_IA64_OPTF_IDENT_MAP_REG[457] constants confusion
Currently the constants are used for two different purpose.
one is for the OPTF hypercall sub command.
another is bit flag for struct opt_feature::mask.
They are different spaces, split them out.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
-rw-r--r-- | xen/arch/ia64/vmx/mmio.c | 6 | ||||
-rw-r--r-- | xen/arch/ia64/vmx/vmx_fault.c | 8 | ||||
-rw-r--r-- | xen/arch/ia64/xen/domain.c | 24 | ||||
-rw-r--r-- | xen/arch/ia64/xen/vcpu.c | 2 | ||||
-rw-r--r-- | xen/include/asm-ia64/domain.h | 23 | ||||
-rw-r--r-- | xen/include/public/arch-ia64.h | 14 |
6 files changed, 56 insertions, 21 deletions
diff --git a/xen/arch/ia64/vmx/mmio.c b/xen/arch/ia64/vmx/mmio.c index c496d3fe64..287e7a19f7 100644 --- a/xen/arch/ia64/vmx/mmio.c +++ b/xen/arch/ia64/vmx/mmio.c @@ -253,11 +253,11 @@ static int vmx_identity_mappings_save(struct domain *d, const struct opt_feature *optf = &d->arch.opt_feature; struct hvm_hw_ia64_identity_mappings im_save; - __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4, + __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4_FLG, &optf->im_reg4, &im_save.im_reg4); - __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5, + __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5_FLG, &optf->im_reg5, &im_save.im_reg5); - __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7, + __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7_FLG, &optf->im_reg7, &im_save.im_reg7); return hvm_save_entry(OPT_FEATURE_IDENTITY_MAPPINGS, 0, h, &im_save); diff --git a/xen/arch/ia64/vmx/vmx_fault.c b/xen/arch/ia64/vmx/vmx_fault.c index a06cae80b3..dbb4a07712 100644 --- a/xen/arch/ia64/vmx/vmx_fault.c +++ b/xen/arch/ia64/vmx/vmx_fault.c @@ -392,7 +392,7 @@ try_again: if (!vhpt_enabled(v, vadr, misr.rs ? RSE_REF : DATA_REF)) { /* windows use region 4 and 5 for identity mapping */ - if ((optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4) && + if ((optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4_FLG) && REGION_NUMBER(vadr) == 4 && !(regs->cr_ipsr & IA64_PSR_CPL) && REGION_OFFSET(vadr) <= _PAGE_PPN_MASK) { @@ -402,7 +402,7 @@ try_again: goto try_again; return IA64_NO_FAULT; } - if ((optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5) && + if ((optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5_FLG) && REGION_NUMBER(vadr) == 5 && !(regs->cr_ipsr & IA64_PSR_CPL) && REGION_OFFSET(vadr) <= _PAGE_PPN_MASK) { @@ -428,8 +428,8 @@ try_again: } /* avoid recursively walking (short format) VHPT */ - if (!(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4) && - !(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5) && + if (!(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4_FLG) && + !(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5_FLG) && (((vadr ^ vpta.val) << 3) >> (vpta.size + 3)) == 0) { goto inject_dtlb_fault; } diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index 2ed034079c..c0a94e5df8 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -2277,16 +2277,36 @@ custom_param("dom0_mem", parse_dom0_mem); * Helper function for the optimization stuff handling the identity mapping * feature. */ +static inline unsigned long +optf_identity_mapping_cmd_to_flg(unsigned long cmd) +{ + switch(cmd) { + case XEN_IA64_OPTF_IDENT_MAP_REG7: + return XEN_IA64_OPTF_IDENT_MAP_REG7_FLG; + case XEN_IA64_OPTF_IDENT_MAP_REG4: + return XEN_IA64_OPTF_IDENT_MAP_REG4_FLG; + case XEN_IA64_OPTF_IDENT_MAP_REG5: + return XEN_IA64_OPTF_IDENT_MAP_REG5_FLG; + default: + BUG(); + return 0; + } + + /* NOTREACHED */ +} + static inline void optf_set_identity_mapping(unsigned long* mask, struct identity_mapping* im, struct xen_ia64_opt_feature* f) { + unsigned long flag = optf_identity_mapping_cmd_to_flg(f->cmd); + if (f->on) { - *mask |= f->cmd; + *mask |= flag; im->pgprot = f->pgprot; im->key = f->key; } else { - *mask &= ~(f->cmd); + *mask &= ~flag; im->pgprot = 0; im->key = 0; } diff --git a/xen/arch/ia64/xen/vcpu.c b/xen/arch/ia64/xen/vcpu.c index 9e0569aab3..36c9bb2d81 100644 --- a/xen/arch/ia64/xen/vcpu.c +++ b/xen/arch/ia64/xen/vcpu.c @@ -1779,7 +1779,7 @@ IA64FAULT vcpu_translate(VCPU * vcpu, u64 address, BOOLEAN is_data, struct opt_feature* optf = &(vcpu->domain->arch.opt_feature); /* Optimization for identity mapped region 7 OS (linux) */ - if (optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7 && + if (optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7_FLG && region == 7 && ia64_psr(regs)->cpl == CONFIG_CPL0_EMUL) { pte.val = address & _PAGE_PPN_MASK; pte.val = pte.val | optf->im_reg7.pgprot; diff --git a/xen/include/asm-ia64/domain.h b/xen/include/asm-ia64/domain.h index 97f6c8f821..ec0616b0a6 100644 --- a/xen/include/asm-ia64/domain.h +++ b/xen/include/asm-ia64/domain.h @@ -93,6 +93,29 @@ struct identity_mapping { unsigned long key; /* A protection key. */ }; +/* opt_feature mask */ +/* + * If this feature is switched on, the hypervisor inserts the + * tlb entries without calling the guests traphandler. + * This is useful in guests using region 7 for identity mapping + * like the linux kernel does. + */ +#define XEN_IA64_OPTF_IDENT_MAP_REG7_FLG_BIT 0 +#define XEN_IA64_OPTF_IDENT_MAP_REG7_FLG \ + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG7_FLG_BIT) + +/* Identity mapping of region 4 addresses in HVM. */ +#define XEN_IA64_OPTF_IDENT_MAP_REG4_FLG_BIT \ + (XEN_IA64_OPTF_IDENT_MAP_REG7_FLG_BIT + 1) +#define XEN_IA64_OPTF_IDENT_MAP_REG4_FLG \ + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG4_FLG_BIT) + +/* Identity mapping of region 5 addresses in HVM. */ +#define XEN_IA64_OPTF_IDENT_MAP_REG5_FLG_BIT \ + (XEN_IA64_OPTF_IDENT_MAP_REG7_FLG_BIT + 2) +#define XEN_IA64_OPTF_IDENT_MAP_REG5_FLG \ + (1UL << XEN_IA64_OPTF_IDENT_MAP_REG5_FLG_BIT) + /* Central structure for optimzation features used by the hypervisor. */ struct opt_feature { unsigned long mask; /* For every feature one bit. */ diff --git a/xen/include/public/arch-ia64.h b/xen/include/public/arch-ia64.h index dda3de6a67..9940d93eba 100644 --- a/xen/include/public/arch-ia64.h +++ b/xen/include/public/arch-ia64.h @@ -604,21 +604,13 @@ struct xen_ia64_boot_param { * This is useful in guests using region 7 for identity mapping * like the linux kernel does. */ -#define XEN_IA64_OPTF_IDENT_MAP_REG7_BIT 0 -#define XEN_IA64_OPTF_IDENT_MAP_REG7 \ - (1UL << XEN_IA64_OPTF_IDENT_MAP_REG7_BIT) +#define XEN_IA64_OPTF_IDENT_MAP_REG7 1 /* Identity mapping of region 4 addresses in HVM. */ -#define XEN_IA64_OPTF_IDENT_MAP_REG4_BIT \ - (XEN_IA64_OPTF_IDENT_MAP_REG7_BIT + 1) -#define XEN_IA64_OPTF_IDENT_MAP_REG4 \ - (1UL << XEN_IA64_OPTF_IDENT_MAP_REG4_BIT) +#define XEN_IA64_OPTF_IDENT_MAP_REG4 2 /* Identity mapping of region 5 addresses in HVM. */ -#define XEN_IA64_OPTF_IDENT_MAP_REG5_BIT \ - (XEN_IA64_OPTF_IDENT_MAP_REG7_BIT + 2) -#define XEN_IA64_OPTF_IDENT_MAP_REG5 \ - (1UL << XEN_IA64_OPTF_IDENT_MAP_REG5_BIT) +#define XEN_IA64_OPTF_IDENT_MAP_REG5 3 #define XEN_IA64_OPTF_IDENT_MAP_NOT_SET (0) |