Merge branches 'fiq' (early part), 'fixes', 'l2c' (early part) and 'misc' into for-next
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
* This code is not portable to processors with late data abort handling.
|
||||
*/
|
||||
#define CODING_BITS(i) (i & 0x0e000000)
|
||||
#define COND_BITS(i) (i & 0xf0000000)
|
||||
|
||||
#define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */
|
||||
#define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */
|
||||
@@ -821,6 +822,8 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
|
||||
break;
|
||||
|
||||
case 0x04000000: /* ldr or str immediate */
|
||||
if (COND_BITS(instr) == 0xf0000000) /* NEON VLDn, VSTn */
|
||||
goto bad;
|
||||
offset.un = OFFSET_BITS(instr);
|
||||
handler = do_alignment_ldrstr;
|
||||
break;
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
@@ -945,6 +946,98 @@ static int l2_wt_override;
|
||||
* pass it though the device tree */
|
||||
static u32 cache_id_part_number_from_dt;
|
||||
|
||||
/**
|
||||
* l2x0_cache_size_of_parse() - read cache size parameters from DT
|
||||
* @np: the device tree node for the l2 cache
|
||||
* @aux_val: pointer to machine-supplied auxilary register value, to
|
||||
* be augmented by the call (bits to be set to 1)
|
||||
* @aux_mask: pointer to machine-supplied auxilary register mask, to
|
||||
* be augmented by the call (bits to be set to 0)
|
||||
* @associativity: variable to return the calculated associativity in
|
||||
* @max_way_size: the maximum size in bytes for the cache ways
|
||||
*/
|
||||
static void __init l2x0_cache_size_of_parse(const struct device_node *np,
|
||||
u32 *aux_val, u32 *aux_mask,
|
||||
u32 *associativity,
|
||||
u32 max_way_size)
|
||||
{
|
||||
u32 mask = 0, val = 0;
|
||||
u32 cache_size = 0, sets = 0;
|
||||
u32 way_size_bits = 1;
|
||||
u32 way_size = 0;
|
||||
u32 block_size = 0;
|
||||
u32 line_size = 0;
|
||||
|
||||
of_property_read_u32(np, "cache-size", &cache_size);
|
||||
of_property_read_u32(np, "cache-sets", &sets);
|
||||
of_property_read_u32(np, "cache-block-size", &block_size);
|
||||
of_property_read_u32(np, "cache-line-size", &line_size);
|
||||
|
||||
if (!cache_size || !sets)
|
||||
return;
|
||||
|
||||
/* All these l2 caches have the same line = block size actually */
|
||||
if (!line_size) {
|
||||
if (block_size) {
|
||||
/* If linesize if not given, it is equal to blocksize */
|
||||
line_size = block_size;
|
||||
} else {
|
||||
/* Fall back to known size */
|
||||
pr_warn("L2C OF: no cache block/line size given: "
|
||||
"falling back to default size %d bytes\n",
|
||||
CACHE_LINE_SIZE);
|
||||
line_size = CACHE_LINE_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
if (line_size != CACHE_LINE_SIZE)
|
||||
pr_warn("L2C OF: DT supplied line size %d bytes does "
|
||||
"not match hardware line size of %d bytes\n",
|
||||
line_size,
|
||||
CACHE_LINE_SIZE);
|
||||
|
||||
/*
|
||||
* Since:
|
||||
* set size = cache size / sets
|
||||
* ways = cache size / (sets * line size)
|
||||
* way size = cache size / (cache size / (sets * line size))
|
||||
* way size = sets * line size
|
||||
* associativity = ways = cache size / way size
|
||||
*/
|
||||
way_size = sets * line_size;
|
||||
*associativity = cache_size / way_size;
|
||||
|
||||
if (way_size > max_way_size) {
|
||||
pr_err("L2C OF: set size %dKB is too large\n", way_size);
|
||||
return;
|
||||
}
|
||||
|
||||
pr_info("L2C OF: override cache size: %d bytes (%dKB)\n",
|
||||
cache_size, cache_size >> 10);
|
||||
pr_info("L2C OF: override line size: %d bytes\n", line_size);
|
||||
pr_info("L2C OF: override way size: %d bytes (%dKB)\n",
|
||||
way_size, way_size >> 10);
|
||||
pr_info("L2C OF: override associativity: %d\n", *associativity);
|
||||
|
||||
/*
|
||||
* Calculates the bits 17:19 to set for way size:
|
||||
* 512KB -> 6, 256KB -> 5, ... 16KB -> 1
|
||||
*/
|
||||
way_size_bits = ilog2(way_size >> 10) - 3;
|
||||
if (way_size_bits < 1 || way_size_bits > 6) {
|
||||
pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n",
|
||||
way_size);
|
||||
return;
|
||||
}
|
||||
|
||||
mask |= L2C_AUX_CTRL_WAY_SIZE_MASK;
|
||||
val |= (way_size_bits << L2C_AUX_CTRL_WAY_SIZE_SHIFT);
|
||||
|
||||
*aux_val &= ~mask;
|
||||
*aux_val |= val;
|
||||
*aux_mask &= ~mask;
|
||||
}
|
||||
|
||||
static void __init l2x0_of_parse(const struct device_node *np,
|
||||
u32 *aux_val, u32 *aux_mask)
|
||||
{
|
||||
@@ -952,6 +1045,7 @@ static void __init l2x0_of_parse(const struct device_node *np,
|
||||
u32 tag = 0;
|
||||
u32 dirty = 0;
|
||||
u32 val = 0, mask = 0;
|
||||
u32 assoc;
|
||||
|
||||
of_property_read_u32(np, "arm,tag-latency", &tag);
|
||||
if (tag) {
|
||||
@@ -974,6 +1068,15 @@ static void __init l2x0_of_parse(const struct device_node *np,
|
||||
val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT;
|
||||
}
|
||||
|
||||
l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K);
|
||||
if (assoc > 8) {
|
||||
pr_err("l2x0 of: cache setting yield too high associativity\n");
|
||||
pr_err("l2x0 of: %d calculated, max 8\n", assoc);
|
||||
} else {
|
||||
mask |= L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
val |= (assoc << L2X0_AUX_CTRL_ASSOC_SHIFT);
|
||||
}
|
||||
|
||||
*aux_val &= ~mask;
|
||||
*aux_val |= val;
|
||||
*aux_mask &= ~mask;
|
||||
@@ -1021,6 +1124,7 @@ static void __init l2c310_of_parse(const struct device_node *np,
|
||||
u32 data[3] = { 0, 0, 0 };
|
||||
u32 tag[3] = { 0, 0, 0 };
|
||||
u32 filter[2] = { 0, 0 };
|
||||
u32 assoc;
|
||||
|
||||
of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));
|
||||
if (tag[0] && tag[1] && tag[2])
|
||||
@@ -1047,6 +1151,23 @@ static void __init l2c310_of_parse(const struct device_node *np,
|
||||
writel_relaxed((filter[0] & ~(SZ_1M - 1)) | L310_ADDR_FILTER_EN,
|
||||
l2x0_base + L310_ADDR_FILTER_START);
|
||||
}
|
||||
|
||||
l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K);
|
||||
switch (assoc) {
|
||||
case 16:
|
||||
*aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
*aux_val |= L310_AUX_CTRL_ASSOCIATIVITY_16;
|
||||
*aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
break;
|
||||
case 8:
|
||||
*aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
*aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
break;
|
||||
default:
|
||||
pr_err("PL310 OF: cache setting yield illegal associativity\n");
|
||||
pr_err("PL310 OF: %d calculated, only 8 and 16 legal\n", assoc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct l2c_init_data of_l2c310_data __initconst = {
|
||||
|
@@ -27,7 +27,7 @@ static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end,
|
||||
if (pud_none_or_clear_bad(pud) || (pud_val(*pud) & L_PGD_SWAPPER)) {
|
||||
pmd = pmd_alloc_one(&init_mm, addr);
|
||||
if (!pmd) {
|
||||
pr_warning("Failed to allocate identity pmd.\n");
|
||||
pr_warn("Failed to allocate identity pmd.\n");
|
||||
return;
|
||||
}
|
||||
/*
|
||||
|
@@ -636,6 +636,11 @@ static int keep_initrd;
|
||||
void free_initrd_mem(unsigned long start, unsigned long end)
|
||||
{
|
||||
if (!keep_initrd) {
|
||||
if (start == initrd_start)
|
||||
start = round_down(start, PAGE_SIZE);
|
||||
if (end == initrd_end)
|
||||
end = round_up(end, PAGE_SIZE);
|
||||
|
||||
poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
|
||||
free_reserved_area((void *)start, (void *)end, -1, "initrd");
|
||||
}
|
||||
|
@@ -223,13 +223,13 @@ early_param("ecc", early_ecc);
|
||||
|
||||
static int __init early_cachepolicy(char *p)
|
||||
{
|
||||
pr_warning("cachepolicy kernel parameter not supported without cp15\n");
|
||||
pr_warn("cachepolicy kernel parameter not supported without cp15\n");
|
||||
}
|
||||
early_param("cachepolicy", early_cachepolicy);
|
||||
|
||||
static int __init noalign_setup(char *__unused)
|
||||
{
|
||||
pr_warning("noalign kernel parameter not supported without cp15\n");
|
||||
pr_warn("noalign kernel parameter not supported without cp15\n");
|
||||
}
|
||||
__setup("noalign", noalign_setup);
|
||||
|
||||
|
@@ -146,7 +146,6 @@ ENDPROC(cpu_v7_set_pte_ext)
|
||||
mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits
|
||||
mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits
|
||||
addls \ttbr1, \ttbr1, #TTBR1_OFFSET
|
||||
adcls \tmp, \tmp, #0
|
||||
mcrr p15, 1, \ttbr1, \tmp, c2 @ load TTBR1
|
||||
mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits
|
||||
mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits
|
||||
@@ -158,9 +157,9 @@ ENDPROC(cpu_v7_set_pte_ext)
|
||||
* TFR EV X F IHD LR S
|
||||
* .EEE ..EE PUI. .TAT 4RVI ZWRS BLDP WCAM
|
||||
* rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced
|
||||
* 11 0 110 1 0011 1100 .111 1101 < we want
|
||||
* 11 0 110 0 0011 1100 .111 1101 < we want
|
||||
*/
|
||||
.align 2
|
||||
.type v7_crval, #object
|
||||
v7_crval:
|
||||
crval clear=0x0120c302, mmuset=0x30c23c7d, ucset=0x00c01c7c
|
||||
crval clear=0x0122c302, mmuset=0x30c03c7d, ucset=0x00c01c7c
|
||||
|
@@ -570,7 +570,7 @@ __v7_ca15mp_proc_info:
|
||||
__v7_b15mp_proc_info:
|
||||
.long 0x420f00f0
|
||||
.long 0xff0ffff0
|
||||
__v7_proc __v7_b15mp_setup, hwcaps = HWCAP_IDIV
|
||||
__v7_proc __v7_b15mp_setup
|
||||
.size __v7_b15mp_proc_info, . - __v7_b15mp_proc_info
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user