Message ID | 1450768223-10860-1-git-send-email-majun258@huawei.com |
---|---|
State | New |
Headers | show |
Hi Marc: 在 2015/12/24 21:48, Marc Zyngier 写道: > On Tue, 22 Dec 2015 15:10:23 +0800 > MaJun <majun258@huawei.com> wrote: > [...] > > diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c > index e23d1d1..3447549 100644 > --- a/drivers/irqchip/irq-gic-v3-its.c > +++ b/drivers/irqchip/irq-gic-v3-its.c > @@ -875,6 +875,7 @@ static int its_alloc_tables(const char *node_name, struct its_node *its) > } > > alloc_size = (1 << order) * PAGE_SIZE; > +retry_alloc_baser: > alloc_pages = (alloc_size / psz); > if (alloc_pages > GITS_BASER_PAGES_MAX) { > alloc_pages = GITS_BASER_PAGES_MAX; > @@ -938,13 +939,16 @@ retry_baser: > * size and retry. If we reach 4K, then > * something is horribly wrong... > */ > + free_pages((unsigned long)base, order); > + its->tables[i] = NULL; > + > switch (psz) { > case SZ_16K: > psz = SZ_4K; > - goto retry_baser; > + goto retry_alloc_baser; > case SZ_64K: > psz = SZ_16K; > - goto retry_baser; > + goto retry_alloc_baser; > } > } > > > > I haven't tested it, but it looks less invasive. Care to give it a go? > This patch works fine on my board. Tested-by: Ma Jun <majun258@huawei.com> Thanks Ma Jun > Thanks, > > M. >
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index e23d1d1..100181b 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -879,7 +879,7 @@ static int its_alloc_tables(const char *node_name, struct its_node *its) if (alloc_pages > GITS_BASER_PAGES_MAX) { alloc_pages = GITS_BASER_PAGES_MAX; order = get_order(GITS_BASER_PAGES_MAX * psz); - pr_warn("%s: Device Table too large, reduce its page order to %u (%u pages)\n", + pr_warn("%s: Table too large, reduce its page order to %u (%u pages)\n", node_name, order, alloc_pages); } @@ -911,6 +911,13 @@ retry_baser: break; } + alloc_pages = (alloc_size / psz); + if (alloc_pages > GITS_BASER_PAGES_MAX) { + alloc_pages = GITS_BASER_PAGES_MAX; + pr_warn("%s: Table too large, reduce its page number to %u pages\n", + node_name, alloc_pages); + } + val |= alloc_pages - 1; writeq_relaxed(val, its->base + GITS_BASER + i * 8);