xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Shanker Donthineni <shankerd@codeaurora.org>
To: Julien Grall <julien.grall@arm.com>,
	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 03/10] arm/gic-v3: Fold GICR subtable parsing into a new function
Date: Mon, 27 Jun 2016 10:40:26 -0500	[thread overview]
Message-ID: <577148EA.1080102@codeaurora.org> (raw)
In-Reply-To: <57710D83.6090001@arm.com>



On 06/27/2016 06:26 AM, Julien Grall wrote:
> Hi Shanker,
>
> Title: I think you want to say "Move GICR..." rather than "Fold GICR...".
>
> On 26/06/16 18:48, Shanker Donthineni wrote:
>> Add a new function for parsing GICR subtable and move the code
>
> Add a new function to parse GICR...
>
>> that is specific to GICR table to new function without changing
>
> to a new function
>
>> the function gicv3_acpi_init() behavior.
>>
>> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
>> ---
>> Changes since v1:
>>    Removed the unnecessary GICR ioremap operation inside GICR table
> parse code.
>>
>>   xen/arch/arm/gic-v3.c | 61
> ++++++++++++++++++++++++++++++++-------------------
>>   1 file changed, 39 insertions(+), 22 deletions(-)
>>
>> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
>> index 542c4f3..0471fea 100644
>> --- a/xen/arch/arm/gic-v3.c
>> +++ b/xen/arch/arm/gic-v3.c
>> @@ -1282,6 +1282,14 @@ static int gicv3_iomem_deny_access(const struct
> domain *d)
>>   }
>>
>>   #ifdef CONFIG_ACPI
>> +static void __init gic_acpi_add_rdist_region(u64 base_addr, u32 size)
>
> Please use paddr_t for both parameter. Also the suffix _addr is 
> pointless.
>
>> +{
>> +    unsigned int idx = gicv3.rdist_count++;
>> +
>> +    gicv3.rdist_regions[idx].base = base_addr;
>> +    gicv3.rdist_regions[idx].size = size;
>> +}
>> +
>>   static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
>>   {
>>       struct acpi_subtable_header *header;
>> @@ -1387,6 +1395,25 @@ 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;
>> +
>> +    rdist = (struct acpi_madt_generic_redistributor *)header;
>> +    if ( BAD_MADT_ENTRY(rdist, end) )
>> +        return -EINVAL;
>> +
>> +    if ( !rdist->base_address || !rdist->length )
>> +        return -EINVAL;
>
> In the commit message you said that the behavior is unchanged, however 
> this check is not part of the previous code.
>
> Anyway, I don't think this check is necessary.
>
>> +
>> +    gic_acpi_add_rdist_region(rdist->base_address, rdist->length);
>> +
>> +    return 0;
>> +}
>> +
>>   static int __init
>>   gic_acpi_get_madt_redistributor_num(struct acpi_subtable_header
> *header,
>> const unsigned long end)
>> @@ -1402,7 +1429,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 +1460,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);
>
> Please use acpi_table_parse_madt here.
>

How do we pass MADT table pointer that we are using to a function 
acpi_table_parse_madt()?  We have already obtained  the MADT table 
address by calling  acpi_get_table() at the beginning of the function 
gicv3_acpi_init().


>> +    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,
>>
>
> Regards,
>

-- 
Shanker Donthineni
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

  parent reply	other threads:[~2016-06-27 15:40 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 [this message]
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
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=577148EA.1080102@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).