qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 1/3] pseries: Abolish envs array


From: Alexander Graf
Subject: [Qemu-devel] Re: [PATCH 1/3] pseries: Abolish envs array
Date: Tue, 05 Apr 2011 15:55:22 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]