irqchip/gicv3-its: Read typer register outside the loop
authorRobert Richter <[email protected]>
Mon, 21 Sep 2015 20:58:36 +0000 (22:58 +0200)
committerThomas Gleixner <[email protected]>
Tue, 29 Sep 2015 08:10:53 +0000 (10:10 +0200)
No need to read the typer register in the loop. Values do not change.

This patch is basically a prerequisite for a follow-on patch that adds
errata code for Cavium ThunderX. It moves the calculation of the
number of id entries to the beginning of the function close to other
setup values that are needed to allocate the its table. Now we have a
central location to modify the setup parameters and the errata code
can be implemented in a single block.

Signed-off-by: Robert Richter <[email protected]>
Acked-by: Marc Zyngier <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Cc: Tirumalesh Chalamarla <[email protected]>
Cc: [email protected]
Cc: Jason Cooper <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
drivers/irqchip/irq-gic-v3-its.c

index d9052fdf98d7f70e224062df36ce37b6d4f5d15d..549e71670f239f52d6cab8c9ddd395fe273aa3af 100644 (file)
@@ -815,6 +815,8 @@ static int its_alloc_tables(const char *node_name, struct its_node *its)
        int psz = SZ_64K;
        u64 shr = GITS_BASER_InnerShareable;
        u64 cache = GITS_BASER_WaWb;
+       u64 typer = readq_relaxed(its->base + GITS_TYPER);
+       u32 ids = GITS_TYPER_DEVBITS(typer);
 
        for (i = 0; i < GITS_BASER_NR_REGS; i++) {
                u64 val = readq_relaxed(its->base + GITS_BASER + i * 8);
@@ -838,9 +840,6 @@ static int its_alloc_tables(const char *node_name, struct its_node *its)
                 * For other tables, only allocate a single page.
                 */
                if (type == GITS_BASER_TYPE_DEVICE) {
-                       u64 typer = readq_relaxed(its->base + GITS_TYPER);
-                       u32 ids = GITS_TYPER_DEVBITS(typer);
-
                        /*
                         * 'order' was initialized earlier to the default page
                         * granule of the the ITS.  We can't have an allocation