linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Nathan Fontenot <nfont@austin.ibm.com>
Cc: linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] dynamic logical partitioning infrastructure
Date: Wed, 16 Sep 2009 11:33:36 +1000	[thread overview]
Message-ID: <1253064816.5600.103.camel@concordia> (raw)
In-Reply-To: <4AAABCE3.5090702@austin.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 2793 bytes --]

On Fri, 2009-09-11 at 16:10 -0500, Nathan Fontenot wrote:
> This patch provides the kernel DLPAR infrastructure in a new filed named
> dlpar.c.  The functionality provided is for acquiring and releasing a 
> resource from firmware and the parsing of information returned from the
> ibm,configure-connector rtas call.  Additionally this exports the 
> pSeries reconfiguration notifier chain so that it can be invoked when
> device tree updates are made.
> 
> Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
> ---
> 
> Index: powerpc/arch/powerpc/platforms/pseries/dlpar.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ powerpc/arch/powerpc/platforms/pseries/dlpar.c	2009-09-11 12:51:52.000000000 -0500
> @@ -0,0 +1,416 @@
> +/*
> + * dlpar.c - support for dynamic reconfiguration (including PCI
> + * Hotplug and Dynamic Logical Partitioning on RPA platforms).
> + *
> + * Copyright (C) 2009 Nathan Fontenot
> + * Copyright (C) 2009 IBM Corporation
> + *
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version
> + * 2 as published by the Free Software Foundation.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/kref.h>
> +#include <linux/notifier.h>
> +#include <linux/proc_fs.h>
> +#include <linux/spinlock.h>
> +
> +#include <asm/prom.h>
> +#include <asm/machdep.h>
> +#include <asm/uaccess.h>
> +#include <asm/rtas.h>
> +#include <asm/pSeries_reconfig.h>
> +
> +#define CFG_CONN_WORK_SIZE	4096
> +static char workarea[CFG_CONN_WORK_SIZE];
> +spinlock_t workarea_lock;
> +
> +static struct property *parse_cc_property(char *workarea)
> +{
> +	struct property *prop;
> +	u32 *work_ints;
> +	char *name;
> +	char *value;
> +
> +	prop = kzalloc(sizeof(*prop), GFP_KERNEL);
> +	if (!prop)
> +		return NULL;
> +
> +	work_ints = (u32 *)workarea;
> +	name = workarea + work_ints[2];
> +	prop->name = kzalloc(strlen(name) + 1, GFP_KERNEL);
> +	if (!prop->name) {
> +		kfree(prop);
> +		return NULL;
> +	}
> +
> +	strcpy(prop->name, name);
> +
> +	prop->length = work_ints[3];
> +	value = workarea + work_ints[4];
> +	prop->value = kzalloc(prop->length, GFP_KERNEL);


The use of work_ints is a bit opaque, it might be clearer if you define
a struct, something like:

struct cc_prop {
	u32 ?;
	u32 ?;
	u32 name_offset;
	u32 length;
	u32 value_offset;
};

cc = (struct cc_prop *)workarea;

name = workarea + cc->name_offset;
..
prop->length = cc->length;
value = workarea + cc->value_offset;

etc.


Also I don't see any checking of the offsets into workarea (for name &
value), vs the size of workarea.

cheers


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2009-09-16  1:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11 21:08 [PATCH 0/5] kernel handling of dynamic logical partitioning Nathan Fontenot
2009-09-11 21:10 ` [PATCH 1/5] dynamic logical partitioning infrastructure Nathan Fontenot
2009-09-14 18:30   ` Brian King
2009-09-15 14:15     ` Nathan Fontenot
2009-09-16  1:33   ` Michael Ellerman [this message]
2009-09-17 14:45     ` Nathan Fontenot
2009-09-11 21:12 ` [PATCH 2/5] move of_drconf_cell definition to prom.h Nathan Fontenot
2009-09-15 14:38   ` Brian King
2009-09-11 21:13 ` [PATCH 3/5] Export memory_sysdev_class Nathan Fontenot
2009-09-11 21:14 ` [PATCH 4/5] kernel handling of memory DLPAR Nathan Fontenot
2009-09-14  6:39   ` Andrey Panin
2009-09-14 18:18     ` Nathan Fontenot
2009-09-11 21:15 ` [PATCH 5/5] kernel handling of CPU DLPAR Nathan Fontenot
2009-09-14  6:41   ` Andrey Panin
2009-09-14 18:20     ` Nathan Fontenot
2009-09-15 14:48   ` Brian King
2009-09-11 21:23 ` [PATCH 0/5] kernel handling of dynamic logical partitioning Daniel Walker
2009-09-14 18:22   ` Nathan Fontenot
2009-09-14 18:24     ` Daniel Walker

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=1253064816.5600.103.camel@concordia \
    --to=michael@ellerman.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=nfont@austin.ibm.com \
    /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).