本文整理汇总了C++中xen_pv_domain函数的典型用法代码示例。如果您正苦于以下问题:C++ xen_pv_domain函数的具体用法?C++ xen_pv_domain怎么用?C++ xen_pv_domain使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xen_pv_domain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gnttab_setup
static int gnttab_setup(void)
{
int rc;
unsigned int max_nr_gframes;
max_nr_gframes = gnttab_max_grant_frames();
if (max_nr_gframes < nr_grant_frames)
return -ENOSYS;
if (xen_pv_domain() && xen_feature(XENFEAT_auto_translated_physmap) &&
!gnttab_shared.addr) {
rc = xlated_setup_gnttab_pages((unsigned long)max_nr_gframes,
&gnttab_shared.addr);
if (rc != 0)
return rc;
}
if (xen_pv_domain())
return gnttab_map(0, nr_grant_frames - 1);
if (gnttab_shared.addr == NULL) {
gnttab_shared.addr = xen_remap(xen_hvm_resume_frames,
PAGE_SIZE * max_nr_gframes);
if (gnttab_shared.addr == NULL) {
printk(KERN_WARNING
"Failed to ioremap gnttab share frames!");
return -ENOMEM;
}
}
gnttab_map(0, nr_grant_frames - 1);
return 0;
}
示例2: xen_hvm_disable_emulated_devices
static void
xen_hvm_disable_emulated_devices(void)
{
u_short disable_devs = 0;
if (xen_pv_domain()) {
/*
* No emulated devices in the PV case, so no need to unplug
* anything.
*/
if (xen_disable_pv_disks != 0 || xen_disable_pv_nics != 0)
printf("PV devices cannot be disabled in PV guests\n");
return;
}
if (inw(XEN_MAGIC_IOPORT) != XMI_MAGIC)
return;
if (xen_disable_pv_disks == 0) {
if (bootverbose)
printf("XEN: disabling emulated disks\n");
disable_devs |= XMI_UNPLUG_IDE_DISKS;
}
if (xen_disable_pv_nics == 0) {
if (bootverbose)
printf("XEN: disabling emulated nics\n");
disable_devs |= XMI_UNPLUG_NICS;
}
if (disable_devs != 0)
outw(XEN_MAGIC_IOPORT, disable_devs);
}
示例3: xen_hvm_init_shared_info_page
static void
xen_hvm_init_shared_info_page(void)
{
struct xen_add_to_physmap xatp;
if (xen_pv_domain()) {
/*
* Already setup in the PV case, shared_info is passed inside
* of the start_info struct at start of day.
*/
return;
}
if (HYPERVISOR_shared_info == NULL) {
HYPERVISOR_shared_info = malloc(PAGE_SIZE, M_XENHVM, M_NOWAIT);
if (HYPERVISOR_shared_info == NULL)
panic("Unable to allocate Xen shared info page");
}
xatp.domid = DOMID_SELF;
xatp.idx = 0;
xatp.space = XENMAPSPACE_shared_info;
xatp.gpfn = vtophys(HYPERVISOR_shared_info) >> PAGE_SHIFT;
if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
panic("HYPERVISOR_memory_op failed");
}
示例4: xen_hvm_guest_init
static void __init xen_hvm_guest_init(void)
{
if (xen_pv_domain())
return;
init_hvm_pv_info();
xen_hvm_init_shared_info();
xen_panic_handler_init();
if (xen_feature(XENFEAT_hvm_callback_vector))
xen_have_vector_callback = 1;
xen_hvm_smp_init();
WARN_ON(xen_cpuhp_setup(xen_cpu_up_prepare_hvm, xen_cpu_dead_hvm));
xen_unplug_emulated_devices();
x86_init.irqs.intr_init = xen_init_IRQ;
xen_hvm_init_time_ops();
xen_hvm_init_mmu_ops();
if (xen_pvh_domain())
machine_ops.emergency_restart = xen_emergency_restart;
#ifdef CONFIG_KEXEC_CORE
machine_ops.shutdown = xen_hvm_shutdown;
machine_ops.crash_shutdown = xen_hvm_crash_shutdown;
#endif
}
示例5: pci_xen_swiotlb_detect
/*
* pci_xen_swiotlb_detect - set xen_swiotlb to 1 if necessary
*
* This returns non-zero if we are forced to use xen_swiotlb (by the boot
* option).
*/
int __init pci_xen_swiotlb_detect(void)
{
if (!xen_pv_domain())
return 0;
/* If running as PV guest, either iommu=soft, or swiotlb=force will
* activate this IOMMU. If running as PV privileged, activate it
* irregardless.
*/
if ((xen_initial_domain() || swiotlb || swiotlb_force))
xen_swiotlb = 1;
/* If we are running under Xen, we MUST disable the native SWIOTLB.
* Don't worry about swiotlb_force flag activating the native, as
* the 'swiotlb' flag is the only one turning it on. */
swiotlb = 0;
#ifdef CONFIG_X86_64
/* pci_swiotlb_detect_4gb turns on native SWIOTLB if no_iommu == 0
* (so no iommu=X command line over-writes).
* Considering that PV guests do not want the *native SWIOTLB* but
* only Xen SWIOTLB it is not useful to us so set no_iommu=1 here.
*/
if (max_pfn > MAX_DMA32_PFN)
no_iommu = 1;
#endif
return xen_swiotlb;
}
示例6: gnttab_resume
int gnttab_resume(void)
{
unsigned int max_nr_gframes;
max_nr_gframes = gnttab_max_grant_frames();
if (max_nr_gframes < nr_grant_frames)
return -ENOSYS;
if (xen_pv_domain())
return gnttab_map(0, nr_grant_frames - 1);
if (!shared) {
shared = ioremap(xen_hvm_resume_frames, PAGE_SIZE * max_nr_gframes);
if (shared == NULL) {
#ifdef CONFIG_DEBUG_PRINTK
printk(KERN_WARNING
"Failed to ioremap gnttab share frames!");
#else
;
#endif
return -ENOMEM;
}
}
gnttab_map(0, nr_grant_frames - 1);
return 0;
}
示例7: xen_has_pv_devices
bool xen_has_pv_devices(void)
{
if (!xen_domain())
return false;
/* PV domains always have them. */
if (xen_pv_domain())
return true;
/* And user has xen_platform_pci=0 set in guest config as
* driver did not modify the value. */
if (xen_platform_pci_unplug == 0)
return false;
if (xen_platform_pci_unplug & XEN_UNPLUG_NEVER)
return false;
if (xen_platform_pci_unplug & XEN_UNPLUG_ALL)
return true;
/* This is an odd one - we are going to run legacy
* and PV drivers at the same time. */
if (xen_platform_pci_unplug & XEN_UNPLUG_UNNECESSARY)
return true;
/* And the caller has to follow with xen_pv_{disk,nic}_devices
* to be certain which driver can load. */
return false;
}
示例8: setup_cpu_watcher
static int setup_cpu_watcher(struct notifier_block *notifier,
unsigned long event, void *data)
{
int cpu;
static struct xenbus_watch cpu_watch = {
.node = "cpu",
.callback = handle_vcpu_hotplug_event};
(void)register_xenbus_watch(&cpu_watch);
for_each_possible_cpu(cpu) {
if (vcpu_online(cpu) == 0) {
(void)cpu_down(cpu);
set_cpu_present(cpu, false);
}
}
return NOTIFY_DONE;
}
static int __init setup_vcpu_hotplug_event(void)
{
static struct notifier_block xsn_cpu = {
.notifier_call = setup_cpu_watcher };
if (!xen_pv_domain())
return -ENODEV;
register_xenstore_notifier(&xsn_cpu);
return 0;
}
arch_initcall(setup_vcpu_hotplug_event);
示例9: gnttab_resume
int gnttab_resume(void)
{
unsigned int max_nr_gframes;
gnttab_request_version();
max_nr_gframes = gnttab_max_grant_frames();
if (max_nr_gframes < nr_grant_frames)
return -ENOSYS;
if (xen_pv_domain())
return gnttab_map(0, nr_grant_frames - 1);
if (gnttab_shared.addr == NULL) {
gnttab_shared.addr = ioremap(xen_hvm_resume_frames,
PAGE_SIZE * max_nr_gframes);
if (gnttab_shared.addr == NULL) {
printk(KERN_WARNING
"Failed to ioremap gnttab share frames!");
return -ENOMEM;
}
}
gnttab_map(0, nr_grant_frames - 1);
return 0;
}
示例10: xen_platform_hvm
static uint32_t __init xen_platform_hvm(void)
{
if (xen_pv_domain() || xen_nopv)
return 0;
return xen_cpuid_base();
}
示例11: xen_register_gsi
static int xen_register_gsi(u32 gsi, int gsi_override, int triggering, int polarity)
{
int rc, irq;
struct physdev_setup_gsi setup_gsi;
if (!xen_pv_domain())
return -1;
printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
gsi, triggering, polarity);
irq = xen_register_pirq(gsi, gsi_override, triggering, true);
setup_gsi.gsi = gsi;
setup_gsi.triggering = (triggering == ACPI_EDGE_SENSITIVE ? 0 : 1);
setup_gsi.polarity = (polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
rc = HYPERVISOR_physdev_op(PHYSDEVOP_setup_gsi, &setup_gsi);
if (rc == -EEXIST)
printk(KERN_INFO "Already setup the GSI :%d\n", gsi);
else if (rc) {
printk(KERN_ERR "Failed to setup GSI :%d, err_code:%d\n",
gsi, rc);
}
return irq;
}
示例12: xen_apic_probe_pv
static int xen_apic_probe_pv(void)
{
if (xen_pv_domain())
return 1;
return 0;
}
示例13: xen_arch_post_suspend
void xen_arch_post_suspend(int cancelled)
{
if (xen_pv_domain())
xen_pv_post_suspend(cancelled);
else
xen_hvm_post_suspend(cancelled);
}
示例14: xen_hvc_init
static int __init xen_hvc_init(void)
{
struct hvc_struct *hp;
struct hv_ops *ops;
if (!xen_pv_domain())
return -ENODEV;
if (xen_initial_domain()) {
ops = &dom0_hvc_ops;
xencons_irq = bind_virq_to_irq(VIRQ_CONSOLE, 0);
} else {
if (!xen_start_info->console.domU.evtchn)
return -ENODEV;
ops = &domU_hvc_ops;
xencons_irq = bind_evtchn_to_irq(xen_start_info->console.domU.evtchn);
}
if (xencons_irq < 0)
xencons_irq = 0; /* NO_IRQ */
else
irq_set_noprobe(xencons_irq);
hp = hvc_alloc(HVC_COOKIE, xencons_irq, ops, 256);
if (IS_ERR(hp))
return PTR_ERR(hp);
hvc = hp;
console_pfn = mfn_to_pfn(xen_start_info->console.domU.mfn);
return 0;
}
示例15: arch_gnttab_init
int arch_gnttab_init(unsigned long nr_shared)
{
if (!xen_pv_domain())
return 0;
return arch_gnttab_valloc(&gnttab_shared_vm_area, nr_shared);
}