From: Shanker Donthineni <shankerd@codeaurora.org>
To: xen-devel <xen-devel@lists.xensource.com>,
Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>
Cc: Philip Elcan <pelcan@codeaurora.org>,
Shanker Donthineni <shankerd@codeaurora.org>,
Vikram Sethi <vikrams@codeaurora.org>
Subject: [PATCH 2/8] arm/gic-v3: Fold GICR subtable parsing into a new function
Date: Sat, 18 Jun 2016 18:45:15 -0500 [thread overview]
Message-ID: <1466293521-32746-3-git-send-email-shankerd@codeaurora.org> (raw)
In-Reply-To: <1466293521-32746-1-git-send-email-shankerd@codeaurora.org>
Add a new function for parsing GICR subtable and move the code
that is specific to GICR table to new function without changing
the function gicv3_acpi_init() behavior.
Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
xen/arch/arm/gic-v3.c | 64 +++++++++++++++++++++++++++++++++------------------
1 file changed, 42 insertions(+), 22 deletions(-)
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index ab1f380..af12ebc 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1387,6 +1387,36 @@ gic_acpi_parse_madt_distributor(struct acpi_subtable_header *header,
return 0;
}
+
+static int __init
+gic_acpi_parse_madt_redistributor(struct acpi_subtable_header *header,
+ const unsigned long end)
+{
+ struct acpi_madt_generic_redistributor *rdist;
+ struct rdist_region *region;
+
+ region = gicv3.rdist_regions + gicv3.rdist_count;
+ rdist = (struct acpi_madt_generic_redistributor *)header;
+ if ( BAD_MADT_ENTRY(rdist, end) )
+ return -EINVAL;
+
+ if ( !rdist->base_address || !rdist->length )
+ return -EINVAL;
+
+ region->base = rdist->base_address;
+ region->size = rdist->length;
+
+ region->map_base = ioremap_nocache(region->base, region->size);
+ if ( !region->map_base )
+ {
+ printk("Unable to map GICR registers\n");
+ return -ENOMEM;
+ }
+ gicv3.rdist_count++;
+
+ return 0;
+}
+
static int __init
gic_acpi_get_madt_redistributor_num(struct acpi_subtable_header *header,
const unsigned long end)
@@ -1402,7 +1432,7 @@ static void __init gicv3_acpi_init(void)
struct acpi_table_header *table;
struct rdist_region *rdist_regs;
acpi_status status;
- int count, i;
+ int count;
status = acpi_get_table(ACPI_SIG_MADT, 0, &table);
@@ -1433,37 +1463,27 @@ static void __init gicv3_acpi_init(void)
if ( count <= 0 )
panic("GICv3: No valid GICR entries exists");
- gicv3.rdist_count = count;
-
- if ( gicv3.rdist_count > MAX_RDIST_COUNT )
+ if ( count > MAX_RDIST_COUNT )
panic("GICv3: Number of redistributor regions is more than"
"%d (Increase MAX_RDIST_COUNT!!)\n", MAX_RDIST_COUNT);
- rdist_regs = xzalloc_array(struct rdist_region, gicv3.rdist_count);
+ rdist_regs = xzalloc_array(struct rdist_region, count);
if ( !rdist_regs )
panic("GICv3: Failed to allocate memory for rdist regions\n");
- for ( i = 0; i < gicv3.rdist_count; i++ )
- {
- struct acpi_subtable_header *header;
- struct acpi_madt_generic_redistributor *gic_rdist;
-
- header = acpi_table_get_entry_madt(ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR,
- i);
- if ( !header )
- panic("GICv3: Can't get GICR entry");
-
- gic_rdist =
- container_of(header, struct acpi_madt_generic_redistributor, header);
- rdist_regs[i].base = gic_rdist->base_address;
- rdist_regs[i].size = gic_rdist->length;
- }
+ gicv3.rdist_regions = rdist_regs;
+
+ /* Parse always-on power domain Re-distributor entries */
+ count = acpi_parse_entries(ACPI_SIG_MADT,
+ sizeof(struct acpi_table_madt),
+ gic_acpi_parse_madt_redistributor, table,
+ ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR, count);
+ if ( count <= 0 )
+ panic("GICv3: Can't get Redistributor entry");
/* The vGIC code requires the region to be sorted */
sort(rdist_regs, gicv3.rdist_count, sizeof(*rdist_regs), cmp_rdist, NULL);
- gicv3.rdist_regions= rdist_regs;
-
/* Collect CPU base addresses */
count = acpi_parse_entries(ACPI_SIG_MADT, sizeof(struct acpi_table_madt),
gic_acpi_parse_madt_cpu, table,
--
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-18 23:45 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-18 23:45 [PATCH 0/8] Add support for parsing per CPU Redistributor entry Shanker Donthineni
2016-06-18 23:45 ` [PATCH 1/8] arm/gic-v3: Add a separate function for mapping GICD region Shanker Donthineni
2016-06-21 9:42 ` Julien Grall
2016-06-18 23:45 ` Shanker Donthineni [this message]
2016-06-21 10:17 ` [PATCH 2/8] arm/gic-v3: Fold GICR subtable parsing into a new function Julien Grall
2016-06-21 14:02 ` Shanker Donthineni
2016-06-18 23:45 ` [PATCH 3/8] arm/gic-v3: Parse per-cpu redistributor entry in GICC subtable Shanker Donthineni
2016-06-21 10:16 ` Julien Grall
2016-06-21 13:52 ` Shanker Donthineni
2016-06-22 13:06 ` Julien Grall
2016-06-18 23:45 ` [PATCH 4/8] xen/arm: vgic: Use dynamic memory allocation for vgic_rdist_region Shanker Donthineni
2016-06-21 10:26 ` Julien Grall
2016-06-18 23:45 ` [PATCH 5/8] arm/gic-v3: Remove an unused macro MAX_RDIST_COUNT Shanker Donthineni
2016-06-18 23:45 ` [PATCH 6/8] arm: vgic: Split vgic_domain_init() functionality into two functions Shanker Donthineni
2016-06-21 10:49 ` Julien Grall
2016-06-21 14:36 ` Shanker Donthineni
2016-06-21 14:48 ` Julien Grall
2016-06-21 15:09 ` Shanker Donthineni
2016-06-18 23:45 ` [PATCH 7/8] arm/mmio: Use separate memory allocation for mmio handlers Shanker Donthineni
2016-06-18 23:45 ` [PATCH 8/8] arm/vgic: Change fixed number of mmio handlers to variable number Shanker Donthineni
2016-06-21 9:28 ` [PATCH 0/8] Add support for parsing per CPU Redistributor entry Julien Grall
2016-06-21 13:37 ` Shanker Donthineni
2016-06-21 13:50 ` Julien Grall
2016-06-21 14:16 ` Shanker Donthineni
2016-06-21 14:44 ` 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=1466293521-32746-3-git-send-email-shankerd@codeaurora.org \
--to=shankerd@codeaurora.org \
--cc=julien.grall@arm.com \
--cc=pelcan@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).