Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Dec 2013 19:54:37 +0100
From:      Roger Pau Monne <roger.pau@citrix.com>
To:        <freebsd-xen@freebsd.org>, <freebsd-current@freebsd.org>, <xen-devel@lists.xen.org>, <gibbs@freebsd.org>, <jhb@freebsd.org>, <kib@freebsd.org>, <julien.grall@citrix.com>
Subject:   [PATCH v7 00/19] FreeBSD PVH DomU support
Message-ID:  <1387479296-33389-1-git-send-email-roger.pau@citrix.com>

next in thread | raw e-mail | index | archive | help
This series is a split of the previous patch "Xen x86 DomU PVH 
support", with the aim to make the review of the code easier.

The series can also be found on my git repo:

git://xenbits.xen.org/people/royger/freebsd.git pvh_v7

or

http://xenbits.xen.org/gitweb/?p=people/royger/freebsd.git;a=shortlog;h=refs/heads/pvh_v7

PVH mode is basically a PV guest inside an HVM container, and shares
a great amount of code with PVHVM. The main difference is the way the
guest is started, PVH uses the PV start sequence, jumping directly
into the kernel entry point in long mode and with page tables set.
The main work of this patch consists in setting the environment as
similar as possible to what native FreeBSD expects, and then adding
hooks to the PV ops when necessary.

sys/amd64/amd64/locore.S:
 * Add PV entry point, hypervisor_page and the necessary elfnotes.

sys/amd64/amd64/machdep.c:
 * Add hooks to replace bare metal operations that should use a PV
  helper, this includes:
   - Preload metadata
   - i8254_init and i8254_delay
   - Fetching the e820 memory map
   - Reserve of the MP bootstrap region

 * Create a DELAY function that uses the PV hooks.
 * Introduce a new hammer_time_xen that sets the necessary stuff when
   running in PVH mode.

sys/amd64/amd64/mp_machdep.c:
 * Introduce a hook to replace start_all_aps.
 * Use lapic_disabled variable to prevent polluting the code
   with xen specific gates.

sys/amd64/include/asmacros.h:
 * Copy the ELFNOTE macro from the i386 Xen PV port.

sys/amd64/include/clock.h:
sys/i386/include/clock.h:
 * Prototypes for the xen early delay initialization and usage.

sys/amd64/include/cpu.h:
 * Introduce a new cpu hook to init APs.

sys/amd64/include/sysarch.h:
 * Declare the init_ops structure.

sys/amd64/include/xen/hypercall.h:
sys/i386/include/xen/hypercall.h
 * Switch to the PV style hypercall mechanism for HVM also.

sys/conf/files:
 * Make the PV console available on XENHVM also.

sys/conf/files.amd64:
 * Include the new files for the PVH port.

sys/dev/xen/console/console.c:
sys/dev/xen/console/xencons_ring.c:
 * Remove the identify method and instead add the device from
   nexus_xen.
 * Use HYPERVISOR_start_info instead of xen_start_info.
 * Use HYPERVISOR_event_channel_op to kick the event channel before
   xen interrupts are setup.
 * Copy the xc_printf debug function from xen_machdep.c

sys/dev/xen/control/control.c:
 * Use the PV shutdown on PVH.

sys/dev/xen/timer/timer.c:
 * Pass a vcpu_info to xen_fetch_vcpu_time, this allows using this
   function at very early init, before per-cpu vcpu_info is set.
 * Remove critical_{enter/exit} from xen_fetch_vcpu_time so it can be
   used at early boot, instead place them on the callers.
 * Introduce two new functions, xen_delay_init and xen_delay that can
   be used at early boot to implement the generic DELAY function.
 * Remove the identify method that used to add the device, now it is
   manually added from either xenpci (HVM) or nexus_xen (PV).

sys/i386/i386/locore.s:
 * Reserve space for the hypercall page.

sys/i386/i386/machdep.c:
 * Create a generic DELAY function.

sys/i386/xen/xen_machdep.c:
 * Set HYPERVISOR_start_info.
 * Move and rename xc_printf debug function to xen console.c

sys/x86/isa/clock.c:
 * Rename the generic DELAY function to i8254_delay.

sys/x86/x86/delay.c:
 * Put generic delay helpers here, get_tsc and delay_tc.

sys/x86/x86/local_apic.c:
 * Prevent the local apic from attaching when running on PVH mode.

sys/x86/xen/hvm.c:
 * Set the start_all_aps hook.
 * Fix the setting of the hypercall page now that we are using the
   same mechanism as the PV port.
 * Initialize Xen CPU hooks for the PVH port.
 * Initialize APs before SI_SUB_SMP (SI_SUB_SMP-1).

sys/x86/xen/mptable.c:
 * Create a dummy PV CPU enumerator for the PVH port.

sys/x86/xen/pv.c:
 * Implement the PV functions for the early boot hooks,
   parse_preload_data and fetch_e820_map.
 * Implement the PV function for the start_all_aps hook.

sys/x86/xen/pvcpu.c:
 * Dummy Xen PV CPU device, that we use to set the per-cpu pc_device.

sys/xen/gnttab.c:
 * Allocate resume_frames for the PVH port.

sys/xen/pv.h:
 * Header that exports the specific PV functions.

sys/xen/xen-os.h:
 * Declare prototypes for the newly added functions.
 * Include new xen_initial_domain function.

sys/xen/xenstore/xenstore.c:
 * Make the xenstore driver hang from both xenpci and the nexus when
   running XENHVM, this is because we don't have a xenpci device on
   the PVH port.
 * Remove the identify routine that added the device, instead add it
   from either xenpci (HVM) or nexus_xen (PV).

sys/dev/xen/xenpci/xenpci.c:
 * Add the xenstore and xen_et devices on succesful attach.

sys/x86/xen/xen_nexus.c:
 * Create a specific nexus for Xen PV guests that takes care of adding
   the top level Xen PV devices.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1387479296-33389-1-git-send-email-roger.pau>