cleanup domain builder declarations and related users
PATCH 1/1 cleanup domain builder declarations and related users
There are several unused function and structure declarations in the hypervisor related to domain building. Remove them.
Use an enum for elf_dom_parms.pae instead of just hard coding the values when setting the information and adjust the code to use those instead of own macros (hypervisor and tools).
---
This is the merge of patches 1-3 of my former series "various cleanups" as requested by Jan. It contains additional cleanups as further suggested by Jan.
Patch 4 of this series has already been applied and patch 5 will be done on it's own as Jan's comment suggests it will no longer be a pure cleanup topic.
--- tools/libxc/xc_dom_binloader.c | 2 +- tools/libxc/xc_dom_elfloader.c | 8 ++++---- tools/libxc/xc_dom_x86.c | 6 +++--- tools/libxc/xg_private.h | 6 ------ xen/arch/x86/domain_build.c | 6 +++--- xen/common/libelf/libelf-dominfo.c | 8 ++++---- xen/include/xen/elf.h | 21 --------------------- xen/include/xen/libelf.h | 9 ++++++++- xen/include/xen/sched.h | 23 ----------------------- 9 files changed, 23 insertions(+), 66 deletions(-)
tools/libxc/xc_dom_binloader.c +1 -1
@@ -238,7 +238,7 @@ static int xc_dom_parse_bin_kernel(struct xc_dom_image *dom) {DOMPRINTF ("%s: PAE fixup" , __FUNCTION__); dom->guest_type ="xen-3.0-x86_32p" ; - dom->parms.pae =2 ; + dom->parms.pae =XEN_PAE_EXTCR3 ; }break ; }
tools/libxc/xc_dom_elfloader.c +4 -4
@@ -61,14 +61,14 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom,case EM_386 :switch ( dom->parms.pae ) { -case 3 /* PAEKERN_bimodal */ : +case XEN_PAE_BIMODAL :if (strstr (dom->xen_caps,"xen-3.0-x86_32p" ) )return "xen-3.0-x86_32p" ;return "xen-3.0-x86_32" ; -case PAEKERN_extended_cr3: -case PAEKERN_yes: +case XEN_PAE_EXTCR3 : +case XEN_PAE_YES :return "xen-3.0-x86_32p" ; -case PAEKERN_no: +case XEN_PAE_NO :default :return "xen-3.0-x86_32" ; }
tools/libxc/xc_dom_x86.c +3 -3
@@ -249,7 +249,7 @@ static int setup_pgtables_x86_32_pae(struct xc_dom_image *dom)xen_pfn_t pgpfn;xen_pfn_t l3mfn =xc_dom_p2m_guest (dom, l3pfn); -if ( dom->parms.pae ==1 ) +if ( dom->parms.pae ==XEN_PAE_YES ) {if ( l3mfn >=0x100000 ) l3mfn =move_l3_below_4G (dom, l3pfn, l3mfn);
@@ -602,8 +602,8 @@ static int vcpu_x86_32(struct xc_dom_image *dom, void *ptr) ctxt->user_regs.eflags =1 <<9 ;/* Interrupt Enable */ ctxt->flags = VGCF_in_kernel_X86_32 | VGCF_online_X86_32; -if ( dom->parms.pae ==2 /* extended_cr3 */ || - dom->parms.pae ==3 /* bimodal */ ) +if ( dom->parms.pae ==XEN_PAE_EXTCR3 || + dom->parms.pae ==XEN_PAE_BIMODAL ) ctxt->vm_assist |= (1UL << VMASST_TYPE_pae_extended_cr3); cr3_pfn =xc_dom_p2m_guest (dom, dom->pgtables_seg.pfn);
tools/libxc/xg_private.h +0 -6
@@ -165,12 +165,6 @@ static inline xen_pfn_t xc_pfn_to_mfn(xen_pfn_t pfn, xen_pfn_t *p2m,#define MFN_MASK_X86 ((1ULL << (MADDR_BITS_X86 - PAGE_SHIFT_X86)) - 1)#define MADDR_MASK_X86 (MFN_MASK_X86 << PAGE_SHIFT_X86) - -#define PAEKERN_no 0 -#define PAEKERN_yes 1 -#define PAEKERN_extended_cr3 2 -#define PAEKERN_bimodal 3 -int pin_table (xc_interface *xch,unsigned int type,unsigned long mfn,domid_t dom);
xen/arch/x86/domain_build.c +3 -3
@@ -953,8 +953,8 @@ int __init construct_dom0( compat32 =0 ; machine =elf_uval (&elf, elf.ehdr, e_machine);printk (" Xen kernel: 64-bit, lsb, compat32\n" ); -if (elf_32bit (&elf) && parms.pae == PAEKERN_bimodal) - parms.pae = PAEKERN_extended_cr3; +if (elf_32bit (&elf) && parms.pae ==XEN_PAE_BIMODAL ) + parms.pae =XEN_PAE_EXTCR3 ;if (elf_32bit (&elf) && parms.pae && machine ==EM_386 ) { compat32 =1 ;
@@ -1005,7 +1005,7 @@ int __init construct_dom0( nr_pages =compute_dom0_nr_pages (d, &parms, initrd_len); -if ( parms.pae == PAEKERN_extended_cr3 ) +if ( parms.pae ==XEN_PAE_EXTCR3 )set_bit (VMASST_TYPE_pae_extended_cr3, &d->vm_assist);if ( (parms.virt_hv_start_low !=UNSET_ADDR ) &&elf_32bit (&elf) )
xen/common/libelf/libelf-dominfo.c +4 -4
@@ -172,9 +172,9 @@ elf_errorstatus elf_xen_parse_note(struct elf_binary *elf,break ;case XEN_ELFNOTE_PAE_MODE :if ( !strcmp (str,"yes" ) ) - parms->pae =2 /* extended_cr3 */ ; + parms->pae =XEN_PAE_EXTCR3 ;if (strstr (str,"bimodal" ) ) - parms->pae =3 /* bimodal */ ; + parms->pae =XEN_PAE_BIMODAL ;break ;case XEN_ELFNOTE_BSD_SYMTAB :if ( !strcmp (str,"yes" ) )
@@ -317,9 +317,9 @@ elf_errorstatus elf_xen_parse_guest_info(struct elf_binary *elf,if ( !strcmp (name,"PAE" ) ) {if ( !strcmp (value,"yes[extended-cr3]" ) ) - parms->pae =2 /* extended_cr3 */ ; + parms->pae =XEN_PAE_EXTCR3 ;else if ( !strncmp (value,"yes" ,3 ) ) - parms->pae =1 /* yes */ ; + parms->pae =XEN_PAE_YES ; }if ( !strcmp (name,"BSD_SYMTAB" ) ) parms->bsd_symtab =1 ;
xen/include/xen/elf.h +0 -21
@@ -34,25 +34,4 @@#define ELFNOTE_DESC (_n_) (ELFNOTE_NAME(_n_) + ELFNOTE_ALIGN((_n_)->namesz))#define ELFNOTE_NEXT (_n_) ((Elf_Note *)(ELFNOTE_DESC(_n_) + ELFNOTE_ALIGN((_n_)->descsz))) -struct domain_setup_info ; -extern int loadelfimage (struct domain_setup_info *); -extern int parseelfimage (struct domain_setup_info *); - -extern unsigned long long xen_elfnote_numeric (struct domain_setup_info *dsi, -int type,int *defined); -extern const char *xen_elfnote_string (struct domain_setup_info *dsi,int type); - -#ifdef CONFIG_COMPAT -extern int elf32_sanity_check (const Elf32_Ehdr *ehdr); -extern int loadelf32image (struct domain_setup_info *); -extern int parseelf32image (struct domain_setup_info *); -extern unsigned long long xen_elf32note_numeric (struct domain_setup_info *, -int type,int *defined); -extern const char *xen_elf32note_string (struct domain_setup_info *,int type); -#endif - -#ifdef Elf_Ehdr -extern int elf_sanity_check (const Elf_Ehdr *ehdr); -#endif -#endif /* __XEN_ELF_H__ */
xen/include/xen/libelf.h +8 -1
@@ -393,6 +393,13 @@ enum xen_elfnote_type {XEN_ENT_STR =2 }; +enum xen_pae_type { +XEN_PAE_NO =0 , +XEN_PAE_YES =1 , +XEN_PAE_EXTCR3 =2 , +XEN_PAE_BIMODAL =3 +}; +struct xen_elfnote {enum xen_elfnote_type type;const char *name;
@@ -414,7 +421,7 @@ struct elf_dom_parms {char guest_ver[16 ];char xen_ver[16 ];char loader[16 ]; -int pae;/* some kind of enum apparently */ +enum xen_pae_type pae;bool bsd_symtab;uint64_t virt_base;uint64_t virt_entry;
xen/include/xen/sched.h +0 -23
@@ -463,29 +463,6 @@ struct domainstruct vnuma_info *vnuma; }; -struct domain_setup_info -{ -/* Initialised by caller. */ -unsigned long image_addr; -unsigned long image_len; -/* Initialised by loader: Public. */ -unsigned long v_start; -unsigned long v_end; -unsigned long v_kernstart; -unsigned long v_kernend; -unsigned long v_kernentry; -#define PAEKERN_no 0 -#define PAEKERN_yes 1 -#define PAEKERN_extended_cr3 2 -#define PAEKERN_bimodal 3 -unsigned int pae_kernel; -/* Initialised by loader: Private. */ -unsigned long elf_paddr_offset; -unsigned int load_symtab; -unsigned long symtab_addr; -unsigned long symtab_len; -}; -/* Protect updates/reads (resp.) of domain_list and domain_hash. */ extern spinlock_t domlist_update_lock;extern rcu_read_lock_t domlist_read_lock;
Signature · 1 line
2.1.4
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 28.09.15 at 07:02, <[email protected]> wrote:
There are several unused function and structure declarations in the hypervisor related to domain building. Remove them.
Use an enum for elf_dom_parms.pae instead of just hard coding the values when setting the information and adjust the code to use those instead of own macros (hypervisor and tools).
Signed-off-by Juergen Gross <[email protected]>
Quoted 9 lines · Juergen Gross
There are several unused function and structure declarations in the hypervisor related to domain building. Remove them.
Use an enum for elf_dom_parms.pae instead of just hard codiint pae; /* some kind of enum apparently */ ng the
values when setting the information and adjust the code to use those
instead of own macros (hypervisor and tools).Signed-off-by Juergen Gross <[email protected]>
Quoted 8 lines · Juergen Gross
There are several unused function and structure declarations in the hypervisor related to domain building. Remove them.
Use an enum for elf_dom_parms.pae instead of just hard coding the values when setting the information and adjust the code to use those instead of own macros (hypervisor and tools).
Signed-off-by Juergen Gross <[email protected]>
Tools bits: