qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/3] pseries: Abolish envs array
Date: Tue, 5 Apr 2011 23:16:59 +1000	[thread overview]
Message-ID: <20110405131659.GA21368@yookeroo> (raw)
In-Reply-To: <3B32EEE0-E931-43A0-8949-D91EF1589AF8@suse.de>

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

  reply	other threads:[~2011-04-05 13:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05  5:12 [Qemu-devel] [0/3] pSeries machine improvements David Gibson
2011-04-05  5:12 ` [Qemu-devel] [PATCH 1/3] pseries: Abolish envs array David Gibson
2011-04-05  8:05   ` [Qemu-devel] " Alexander Graf
2011-04-05 13:16     ` David Gibson [this message]
2011-04-05 13:55       ` Alexander Graf
2011-04-05  5:12 ` [Qemu-devel] [PATCH 2/3] Delay creation of pseries device tree until reset David Gibson
2011-04-05  5:12 ` [Qemu-devel] [PATCH 3/3] Use existing helper function to implement popcntd instruction David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110405131659.GA21368@yookeroo \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).