From: Ian Campbell Subject: Re: [PATCH v2 03/15] arm/xen: move gic save and restore registers to gic driver Date: Thu, 10 Apr 2014 09:32:42 +0100 Message-ID: <1397118762.9862.27.camel@kazak.uk.xensource.com> References: <1396612593-443-1-git-send-email-vijay.kilari@gmail.com> <1396612593-443-4-git-send-email-vijay.kilari@gmail.com> <1397062280.6275.142.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Vijay Kilari Cc: Stefano Stabellini , Prasun Kapoor , Vijaya Kumar K , Julien Grall , xen-devel@lists.xen.org, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, 2014-04-10 at 10:20 +0530, Vijay Kilari wrote: > On Wed, Apr 9, 2014 at 10:21 PM, Ian Campbell wrote: > > On Fri, 2014-04-04 at 17:26 +0530, vijay.kilari@gmail.com wrote: > > > >> gic saved registers are moved to gic driver. > >> This required structure is allocated at runtime > >> and is saved & restored. > > > > I don't follow why this change required switch to allocating them > > dynamically. If it is a v2 vs v3 thing then I think a union in struct > > arch_vcpu would be fine, unless the v3 stuff is relatively enormous. > > > v2: > struct gic_state_data { > uint32_t gic_hcr, gic_vmcr; > uint32_t gic_apr; > uint32_t gic_lr[64]; > }; > > v3: > struct gic_state_data { > uint32_t gic_hcr, gic_vmcr; > uint32_t gic_apr0[4]; > uint32_t gic_apr1[4]; > uint64_t gic_lr[16]; > }; > > Except hcr & vmcr registers, v2 & v3 are different. looks like it is 268 bytes for v2 and 168 for v3 (surprised it gets smaller! Fewer LRs I suppose) > Does static allocation helps in caching the domain struct and > is this the reason for not choosing dynamic allocation? Right plus it avoids a pointer indirection. Maybe that's not so important, but it also reduces code complexity a bit and we can defer that complexity until the size of the vcpu struct gets too big. > If so, I would suggest to move this structure to gic.h without > dynamic allocation? Shouldn't they be in gic_v2_defs.h and gic_v3_defs.h respectively, adn with a distinct name? Then in struct arch_vcpu: union { struct gic_v2_state v2; struct gic_v3_state v3; } gic;