From: Julien Grall <julien.grall@arm.com>
To: Shanker Donthineni <shankerd@codeaurora.org>,
xen-devel <xen-devel@lists.xensource.com>,
Stefano Stabellini <sstabellini@kernel.org>
Cc: Philip Elcan <pelcan@codeaurora.org>,
Vikram Sethi <vikrams@codeaurora.org>
Subject: Re: [PATCH V2 05/10] xen/arm: vgic: Use dynamic memory allocation for vgic_rdist_region
Date: Mon, 27 Jun 2016 13:38:44 +0100 [thread overview]
Message-ID: <57711E54.1030508@arm.com> (raw)
In-Reply-To: <1466963303-10850-6-git-send-email-shankerd@codeaurora.org>
Hi Shanker,
On 26/06/16 18:48, Shanker Donthineni wrote:
> The number of Re-distributor regions allowed for dom0 is hardcoded
s/Re-distributor/Redistributor/
> to a compile time macro MAX_RDIST_COUNT which is 4. On some systems,
s/a compile time macro/a define/
s/On some/Some/
> especially latest server chips might have more than 4 redistributors.
I would add a comma after 'chips'.
NIT: s/redistributors/Redistributors/
> Either we have to increase MAX_RDIST_COUNT to a bigger number or
> allocate memory based on number of redistributors that are found in
s/based on number/based on the number/
> MADT table. In the worst case scenario, the macro MAX_RDIST_COUNT
> should be equal to CONFIG_NR_CPUS in order to support per CPU
> Redistributors.
>
> Increasing MAX_RDIST_COUNT has side effect, it blows 'struct domain'
s/has side/has a/
> size and hits BUILD_BUG_ON() in domain build code path.
>
> struct domain *alloc_domain_struct(void)
> {
> struct domain *d;
> BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
> d = alloc_xenheap_pages(0, 0);
> if ( d == NULL )
> return NULL;
> ...
>
> This patch uses the second approach to fix the BUILD_BUG().
>
> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
> ---
> Changes since v1:
> Keep 'struct vgic_rdist_region' definition inside 'struct arch_domain'.
>
> xen/arch/arm/vgic-v2.c | 6 ++++++
> xen/arch/arm/vgic-v3.c | 22 +++++++++++++++++++---
> xen/arch/arm/vgic.c | 1 +
> xen/include/asm-arm/domain.h | 2 +-
> xen/include/asm-arm/vgic.h | 2 ++
> 5 files changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
> index 9adb4a9..f5778e6 100644
> --- a/xen/arch/arm/vgic-v2.c
> +++ b/xen/arch/arm/vgic-v2.c
> @@ -699,9 +699,15 @@ static int vgic_v2_domain_init(struct domain *d)
> return 0;
> }
>
> +static void vgic_v2_domain_free(struct domain *d)
> +{
> + /* Nothing to be cleanup for this driver */
> +}
> +
> static const struct vgic_ops vgic_v2_ops = {
> .vcpu_init = vgic_v2_vcpu_init,
> .domain_init = vgic_v2_domain_init,
> + .domain_free = vgic_v2_domain_free,
> .max_vcpus = 8,
> };
>
> diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
> index b37a7c0..e877e9e 100644
> --- a/xen/arch/arm/vgic-v3.c
> +++ b/xen/arch/arm/vgic-v3.c
> @@ -1393,7 +1393,19 @@ static int vgic_v3_vcpu_init(struct vcpu *v)
>
> static int vgic_v3_domain_init(struct domain *d)
> {
> - int i;
> + struct vgic_rdist_region *rdist_regions;
> + int rdist_count, i;
> +
> + /* Allocate memory for Re-distributor regions */
> + rdist_count = is_hardware_domain(d) ? vgic_v3_hw.nr_rdist_regions :
> + GUEST_GICV3_RDIST_REGIONS;
I would directly introduce the inline helper in this patch, rather than
in patch #10.
> +
> + rdist_regions = xzalloc_array(struct vgic_rdist_region, rdist_count);
> + if ( !rdist_regions )
> + return -ENOMEM;
> +
> + d->arch.vgic.nr_regions = rdist_count;
> + d->arch.vgic.rdist_regions = rdist_regions;
>
> /*
> * Domain 0 gets the hardware address.
[...]
> diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
> index a2fccc0..fbb763a 100644
> --- a/xen/include/asm-arm/vgic.h
> +++ b/xen/include/asm-arm/vgic.h
> @@ -128,6 +128,8 @@ struct vgic_ops {
> int (*vcpu_init)(struct vcpu *v);
> /* Domain specific initialization of vGIC */
> int (*domain_init)(struct domain *d);
> + /* Release resources that are allocated by domain_init */
s/are/were/
> + void (*domain_free)(struct domain *d);
> /* vGIC sysreg emulation */
> int (*emulate_sysreg)(struct cpu_user_regs *regs, union hsr hsr);
> /* Maximum number of vCPU supported */
>
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-27 12:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-26 17:48 [PATCH V2 00/10] Add support for parsing per CPU Redistributor entry Shanker Donthineni
2016-06-26 17:48 ` [PATCH V2 01/10] arm/gic-v3: Fix bug in function cmp_rdist() Shanker Donthineni
2016-06-27 11:03 ` Julien Grall
2016-06-27 13:41 ` Shanker Donthineni
2016-06-26 17:48 ` [PATCH V2 02/10] arm/gic-v3: Do early GICD ioremap and clean up Shanker Donthineni
2016-06-27 11:08 ` Julien Grall
2016-06-26 17:48 ` [PATCH V2 03/10] arm/gic-v3: Fold GICR subtable parsing into a new function Shanker Donthineni
2016-06-27 11:26 ` Julien Grall
2016-06-27 13:50 ` Shanker Donthineni
2016-06-27 15:40 ` Shanker Donthineni
2016-06-27 15:41 ` Julien Grall
2016-06-27 16:07 ` Shanker Donthineni
2016-06-27 16:09 ` Julien Grall
2016-06-27 16:17 ` Shanker Donthineni
2016-06-27 16:20 ` Julien Grall
2016-06-26 17:48 ` [PATCH V2 04/10] arm/gic-v3: Parse per-cpu redistributor entry in GICC subtable Shanker Donthineni
2016-06-27 11:47 ` Julien Grall
2016-06-27 14:17 ` Shanker Donthineni
2016-06-27 15:13 ` Julien Grall
2016-06-26 17:48 ` [PATCH V2 05/10] xen/arm: vgic: Use dynamic memory allocation for vgic_rdist_region Shanker Donthineni
2016-06-27 12:38 ` Julien Grall [this message]
2016-06-27 12:43 ` Andrew Cooper
2016-06-27 14:28 ` Shanker Donthineni
2016-06-26 17:48 ` [PATCH V2 06/10] arm/gic-v3: Remove an unused macro MAX_RDIST_COUNT Shanker Donthineni
2016-06-27 13:52 ` Julien Grall
2016-06-26 17:48 ` [PATCH V2 07/10] arm: vgic: Split vgic_domain_init() functionality into two functions Shanker Donthineni
2016-06-27 12:45 ` Julien Grall
2016-06-26 17:48 ` [PATCH V2 08/10] arm/io: Use separate memory allocation for mmio handlers Shanker Donthineni
2016-06-27 13:55 ` Julien Grall
2016-06-26 17:48 ` [PATCH V2 09/10] xen/arm: io: Use binary search for mmio handler lookup Shanker Donthineni
2016-06-27 13:31 ` Julien Grall
2016-06-27 14:50 ` Shanker Donthineni
2016-06-27 15:27 ` Julien Grall
2016-06-26 17:48 ` [PATCH V2 10/10] arm/vgic: Change fixed number of mmio handlers to variable number Shanker Donthineni
2016-06-27 13:35 ` Julien Grall
2016-06-27 15:02 ` Shanker Donthineni
2016-06-28 10:51 ` Julien Grall
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=57711E54.1030508@arm.com \
--to=julien.grall@arm.com \
--cc=pelcan@codeaurora.org \
--cc=shankerd@codeaurora.org \
--cc=sstabellini@kernel.org \
--cc=vikrams@codeaurora.org \
--cc=xen-devel@lists.xensource.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).