From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60314 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q76jO-0008Lq-K6 for qemu-devel@nongnu.org; Tue, 05 Apr 2011 09:55:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q76jI-0008M8-JR for qemu-devel@nongnu.org; Tue, 05 Apr 2011 09:55:42 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53786 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q76jI-0008L3-E3 for qemu-devel@nongnu.org; Tue, 05 Apr 2011 09:55:36 -0400 Message-ID: <4D9B1F4A.9030204@suse.de> Date: Tue, 05 Apr 2011 15:55:22 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1301980331-21179-1-git-send-email-david@gibson.dropbear.id.au> <1301980331-21179-2-git-send-email-david@gibson.dropbear.id.au> <3B32EEE0-E931-43A0-8949-D91EF1589AF8@suse.de> <20110405131659.GA21368@yookeroo> In-Reply-To: <20110405131659.GA21368@yookeroo> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/3] pseries: Abolish envs array List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: David Gibson On 04/05/2011 03:16 PM, David Gibson wrote: > On Tue, Apr 05, 2011 at 10:05:12AM +0200, Alexander Graf wrote: >> On 05.04.2011, at 07:12, David Gibson wrote: > [snip] >>> +struct icp_state *xics_system_init(int nr_irqs) >>> { >>> + CPUState *env; >>> + int max_server_num; >>> int i; >>> struct icp_state *icp; >>> struct ics_state *ics; >>> >>> + max_server_num = -1; >>> + for (env = first_cpu; env != NULL; env = env->next_cpu) { >>> + if (env->cpu_index> max_server_num) { >>> + max_server_num = env->cpu_index; >>> + } >>> + } >>> + >>> icp = qemu_mallocz(sizeof(*icp)); >>> - icp->nr_servers = nr_servers; >>> - icp->ss = qemu_mallocz(nr_servers * sizeof(struct icp_server_state)); >>> + icp->nr_servers = max_server_num + 1; >>> + icp->ss = qemu_mallocz(icp->nr_servers*sizeof(struct icp_server_state)); >>> + >>> + for (i = 0; i< icp->nr_servers; i++) { >>> + icp->ss[i].mfrr = 0xff; >> Is ss always big enough to hold all CPUs + 1? > Well, it should be. We allocated it just above based on > icp->nr_servers, and nr_servers is the largest cpu_index + 1, computer > just above that Ah, there it is :). I missed that part. Will apply the patches to my tree. Alex