本文整理汇总了C++中HYPERVISOR_event_channel_op函数的典型用法代码示例。如果您正苦于以下问题:C++ HYPERVISOR_event_channel_op函数的具体用法?C++ HYPERVISOR_event_channel_op怎么用?C++ HYPERVISOR_event_channel_op使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HYPERVISOR_event_channel_op函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unbind_all_ports
void unbind_all_ports(void)
{
int i;
int cpu = 0;
shared_info_t *s = HYPERVISOR_shared_info;
vcpu_info_t *vcpu_info = &s->vcpu_info[cpu];
int rc;
for ( i = 0; i < NR_EVS; i++ )
{
if ( i == start_info.console.domU.evtchn ||
i == start_info.store_evtchn)
continue;
if ( test_and_clear_bit(i, bound_ports) )
{
struct evtchn_close close;
printk("port %d still bound!\n", i);
mask_evtchn(i);
close.port = i;
rc = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
if ( rc )
printk("WARN: close_port %s failed rc=%d. ignored\n", i, rc);
clear_evtchn(i);
}
}
vcpu_info->evtchn_upcall_pending = 0;
vcpu_info->evtchn_pending_sel = 0;
}
示例2: xenstored_local_init
/* Set up event channel for xenstored which is run as a local process
* (this is normally used only in dom0)
*/
static int __init xenstored_local_init(void)
{
int err = 0;
unsigned long page = 0;
struct evtchn_alloc_unbound alloc_unbound;
/* Allocate Xenstore page */
page = get_zeroed_page(GFP_KERNEL);
if (!page)
goto out_err;
xen_store_gfn = xen_start_info->store_mfn = virt_to_gfn((void *)page);
/* Next allocate a local port which xenstored can bind to */
alloc_unbound.dom = DOMID_SELF;
alloc_unbound.remote_dom = DOMID_SELF;
err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
&alloc_unbound);
if (err == -ENOSYS)
goto out_err;
BUG_ON(err);
xen_store_evtchn = xen_start_info->store_evtchn =
alloc_unbound.port;
return 0;
out_err:
if (page != 0)
free_page(page);
return err;
}
示例3: bind_virq_to_irq
static int
bind_virq_to_irq(unsigned int virq, unsigned int cpu)
{
struct evtchn_bind_virq bind_virq;
int evtchn = 0, irq;
mtx_lock_spin(&irq_mapping_update_lock);
if ((irq = pcpu_find(cpu)->pc_virq_to_irq[virq]) == -1) {
if ((irq = find_unbound_irq()) < 0)
goto out;
bind_virq.virq = virq;
bind_virq.vcpu = cpu;
HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, &bind_virq);
evtchn = bind_virq.port;
evtchn_to_irq[evtchn] = irq;
irq_info[irq] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
pcpu_find(cpu)->pc_virq_to_irq[virq] = irq;
bind_evtchn_to_cpu(evtchn, cpu);
}
irq_bindcount[irq]++;
unmask_evtchn(evtchn);
out:
mtx_unlock_spin(&irq_mapping_update_lock);
return irq;
}
示例4: bind_local_port_to_irq
static int
bind_local_port_to_irq(unsigned int local_port)
{
int irq;
mtx_lock_spin(&irq_mapping_update_lock);
KASSERT(evtchn_to_irq[local_port] == -1,
("evtchn_to_irq inconsistent"));
if ((irq = find_unbound_irq()) < 0) {
struct evtchn_close close = { .port = local_port };
HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
goto out;
}
evtchn_to_irq[local_port] = irq;
irq_info[irq] = mk_irq_info(IRQT_LOCAL_PORT, 0, local_port);
irq_bindcount[irq]++;
unmask_evtchn(local_port);
out:
mtx_unlock_spin(&irq_mapping_update_lock);
return irq;
}
示例5: bind_ipi_to_irq
int
bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
{
struct evtchn_bind_ipi bind_ipi;
int irq;
int evtchn = 0;
mtx_lock_spin(&irq_mapping_update_lock);
if ((irq = pcpu_find(cpu)->pc_ipi_to_irq[ipi]) == -1) {
if ((irq = find_unbound_irq()) < 0)
goto out;
bind_ipi.vcpu = cpu;
HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi, &bind_ipi);
evtchn = bind_ipi.port;
evtchn_to_irq[evtchn] = irq;
irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn);
pcpu_find(cpu)->pc_ipi_to_irq[ipi] = irq;
bind_evtchn_to_cpu(evtchn, cpu);
}
irq_bindcount[irq]++;
unmask_evtchn(evtchn);
out:
mtx_unlock_spin(&irq_mapping_update_lock);
return irq;
}
示例6: unbind_from_irq
static void
unbind_from_irq(int irq)
{
struct evtchn_close close;
int evtchn = evtchn_from_irq(irq);
int cpu;
mtx_lock_spin(&irq_mapping_update_lock);
if ((--irq_bindcount[irq] == 0) && VALID_EVTCHN(evtchn)) {
close.port = evtchn;
HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
switch (type_from_irq(irq)) {
case IRQT_VIRQ:
cpu = cpu_from_evtchn(evtchn);
pcpu_find(cpu)->pc_virq_to_irq[index_from_irq(irq)] = -1;
break;
case IRQT_IPI:
cpu = cpu_from_evtchn(evtchn);
pcpu_find(cpu)->pc_ipi_to_irq[index_from_irq(irq)] = -1;
break;
default:
break;
}
/* Closed ports are implicitly re-bound to VCPU0. */
bind_evtchn_to_cpu(evtchn, 0);
evtchn_to_irq[evtchn] = -1;
irq_info[irq] = IRQ_UNBOUND;
}
mtx_unlock_spin(&irq_mapping_update_lock);
}
示例7: bind_ipi_to_irq
static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
{
struct evtchn_bind_ipi bind_ipi;
int evtchn, irq;
spin_lock(&irq_mapping_update_lock);
if ((irq = per_cpu(ipi_to_irq, cpu)[ipi]) == -1) {
if ((irq = find_unbound_irq()) < 0)
goto out;
bind_ipi.vcpu = cpu;
if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
&bind_ipi) != 0)
BUG();
evtchn = bind_ipi.port;
evtchn_to_irq[evtchn] = irq;
irq_info[irq] = mk_irq_info(IRQT_IPI, ipi, evtchn);
per_cpu(ipi_to_irq, cpu)[ipi] = irq;
bind_evtchn_to_cpu(evtchn, cpu);
}
irq_bindcount[irq]++;
out:
spin_unlock(&irq_mapping_update_lock);
return irq;
}
示例8: evtchn_bind_to_user
static int evtchn_bind_to_user(struct per_user_data *u, int port)
{
int rc = 0;
/*
* Ports are never reused, so every caller should pass in a
* unique port.
*
* (Locking not necessary because we haven't registered the
* interrupt handler yet, and our caller has already
* serialized bind operations.)
*/
BUG_ON(get_port_user(port) != NULL);
set_port_user(port, u);
set_port_enabled(port, true); /* start enabled */
rc = bind_evtchn_to_irqhandler(port, evtchn_interrupt, IRQF_DISABLED,
u->name, (void *)(unsigned long)port);
if (rc >= 0)
rc = evtchn_make_refcounted(port);
else {
/* bind failed, should close the port now */
struct evtchn_close close;
close.port = port;
if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
BUG();
set_port_user(port, NULL);
}
return rc;
}
示例9: evtchn_release
static int evtchn_release(struct inode *inode, struct file *filp)
{
int i;
struct per_user_data *u = filp->private_data;
struct evtchn_close close;
spin_lock_irq(&port_user_lock);
free_page((unsigned long)u->ring);
for (i = 0; i < NR_EVENT_CHANNELS; i++) {
int ret;
if (port_user[i] != u)
continue;
port_user[i] = NULL;
mask_evtchn(i);
rebind_evtchn_to_cpu(i, 0);
close.port = i;
ret = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
BUG_ON(ret);
}
spin_unlock_irq(&port_user_lock);
kfree(u);
return 0;
}
示例10: rebind_evtchn_to_cpu
void rebind_evtchn_to_cpu(int port, unsigned int cpu)
{
struct evtchn_bind_vcpu ebv = { .port = port, .vcpu = cpu };
int masked;
masked = test_and_set_evtchn_mask(port);
if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_vcpu, &ebv) == 0)
bind_evtchn_to_cpu(port, cpu);
if (!masked)
unmask_evtchn(port);
}
示例11: bind_listening_port_to_irq
static int bind_listening_port_to_irq(unsigned int remote_domain)
{
struct evtchn_alloc_unbound alloc_unbound;
int err;
alloc_unbound.dom = DOMID_SELF;
alloc_unbound.remote_dom = remote_domain;
err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
&alloc_unbound);
return err ? : bind_local_port_to_irq(alloc_unbound.port);
}
示例12: unbind_evtchn
void unbind_evtchn(evtchn_port_t port)
{
struct evtchn_close close;
int rc;
mask_evtchn(port);
clear_evtchn(port);
close.port = port;
rc = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
if ( rc )
printk("WARN: close_port %s failed rc=%d. ignored\n", port, rc);
}
示例13: xenbus_free_evtchn
/**
* Free an existing event channel. Returns 0 on success or -errno on error.
*/
int xenbus_free_evtchn(struct xenbus_device *dev, int port)
{
struct evtchn_close close;
int err;
close.port = port;
err = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
if (err)
xenbus_dev_error(dev, err, "freeing event channel %d", port);
return err;
}
示例14: gnt_init
int gnt_init(void)
{
int mfn;
int err;
struct as_sring *sring;
struct evtchn_alloc_unbound alloc_unbound;
printk(KERN_INFO "gnt_init\n");
page = __get_free_pages(GFP_KERNEL, 0);
if (page == 0) {
printk(KERN_DEBUG "\nxen:DomU:could not get free page");
return 0;
}
sring = (struct as_sring *)page;
SHARED_RING_INIT(sring);
FRONT_RING_INIT(&(info.ring), sring, PAGE_SIZE);
mfn = virt_to_mfn(page);
printk(KERN_INFO "grant foreign access\n");
info.gref = gnttab_grant_foreign_access(DOM0_ID, mfn, 0);
if (info.gref < 0) {
printk(KERN_DEBUG "\nxen:could not grant foreign access");
free_page((unsigned long)page);
info.ring.sring = NULL;
return 0;
}
printk(KERN_DEBUG "\n gref = %d", info.gref);
alloc_unbound.dom = DOMID_SELF;
alloc_unbound.remote_dom = DOM0_ID;
err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &alloc_unbound);
if (err) {
printk(KERN_DEBUG "\nalloc unbound port failure");
return err;
}
err = bind_evtchn_to_irqhandler(alloc_unbound.port, as_int, 0, "xen-eg", &info);
if (err < 0) {
printk(KERN_DEBUG "\nbind evtchn to irqhandler failure");
return err;
}
info.irq = err;
info.port = alloc_unbound.port;
printk(KERN_DEBUG " interrupt = %d, local_port = %d", info.irq, info.port);
printk("...\n...");
create_procfs_entry();
return 0;
}
示例15: bind_interdomain_evtchn_to_irq
static int bind_interdomain_evtchn_to_irq(unsigned int remote_domain,
unsigned int remote_port)
{
struct evtchn_bind_interdomain bind_interdomain;
int err;
bind_interdomain.remote_dom = remote_domain;
bind_interdomain.remote_port = remote_port;
err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain,
&bind_interdomain);
return err ? : bind_local_port_to_irq(bind_interdomain.local_port);
}