[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 1/3] pseries: Abolish envs array
From: |
David Gibson |
Subject: |
[Qemu-devel] Re: [PATCH 1/3] pseries: Abolish envs array |
Date: |
Tue, 5 Apr 2011 23:16:59 +1000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
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.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson