From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [V8 PATCH 7/8] pvh dom0: add check for pvh in vioapic_range Date: Tue, 1 Apr 2014 15:40:29 +0100 Message-ID: <533ACFDD.8010504@eu.citrix.com> References: <1395452357-1598-1-git-send-email-mukesh.rathor@oracle.com> <1395452357-1598-8-git-send-email-mukesh.rathor@oracle.com> <53300A4102000078000013D1@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WUzre-00040c-AA for xen-devel@lists.xenproject.org; Tue, 01 Apr 2014 14:40:34 +0000 In-Reply-To: <53300A4102000078000013D1@nat28.tlf.novell.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: Jan Beulich , Mukesh Rathor Cc: xen-devel@lists.xenproject.org, keir.xen@gmail.com, eddie.dong@intel.com, jun.nakajima@intel.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org On 03/24/2014 09:34 AM, Jan Beulich wrote: >>>> On 22.03.14 at 02:39, wrote: >> --- a/xen/arch/x86/hvm/vioapic.c >> +++ b/xen/arch/x86/hvm/vioapic.c >> @@ -238,8 +238,13 @@ static int vioapic_write( >> >> static int vioapic_range(struct vcpu *v, unsigned long addr) >> { >> - struct hvm_hw_vioapic *vioapic = domain_vioapic(v->domain); >> + struct hvm_hw_vioapic *vioapic; >> + >> + /* pvh uses event channel callback */ >> + if ( is_pvh_vcpu(v) ) >> + return 0; >> >> + vioapic = domain_vioapic(v->domain); > > I can see why the extra check is needed, but I can't see why you > convert the initializer to an assignment: Afaict domain_vioapic() is > safe even if d->arch.hvm_domain.vioapic == NULL. Or better yet, just make it something like: return vioapic && ((addr >= [...original range check])) That way we don't have to have a PVH-specific hook at all. If a domain doesn't have a vioapic for any reason, return 0. -George