From: Ian Campbell Subject: Re: [PATCH] xen: Fix BUFIOREQ evtchn init for a stubdom. Date: Tue, 26 Jun 2012 11:54:31 +0100 Message-ID: <1340708071.3832.68.camel@zakaz.uk.xensource.com> References: <1340707524-27665-1-git-send-email-anthony.perard@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1340707524-27665-1-git-send-email-anthony.perard@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Anthony PERARD Cc: Stefano Stabellini , Xen Devel List-Id: xen-devel@lists.xenproject.org On Tue, 2012-06-26 at 11:45 +0100, Anthony PERARD wrote: > This is a missing part from the previous patch that add the BUFIOREQ_EVTCHN > parameter. This patch changes the ownership of the buifioreq event channel to > the stubdom (when HVM_PARAM_DM_DOMAIN is set within the stubdom). > > This fix the initialization of QEMU inside the stubdomain. > > Signed-off-by: Anthony PERARD This fixes stub domains for me, thanks. The user of this field (hvm_buffered_io_send) takes iorp->lock so we probably want to put the update inside that too, just like for the non-buffered case? It would be nice to extract the alloc&replace functionality into a helper. Ian. > --- > xen/arch/x86/hvm/hvm.c | 16 ++++++++++++++++ > 1 files changed, 16 insertions(+), 0 deletions(-) > > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c > index e0d495d..9ff1ded 100644 > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -3788,6 +3788,22 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg) > /* xchg() ensures that only we free_xen_event_channel() */ > old_port = xchg(&v->arch.hvm_vcpu.xen_port, new_port); > free_xen_event_channel(v, old_port); > + > + if ( v->vcpu_id == 0 ) > + { > + new_port = alloc_unbound_xen_event_channel( > + v, a.value, NULL); > + if ( new_port < 0 ) > + { > + rc = new_port; > + break; > + } > + old_port = xchg( > + &v->domain->arch.hvm_domain.params[HVM_PARAM_BUFIOREQ_EVTCHN], > + new_port); > + free_xen_event_channel(v, old_port); > + } > + > spin_lock(&iorp->lock); > if ( iorp->va != NULL ) > get_ioreq(v)->vp_eport = v->arch.hvm_vcpu.xen_port;