summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDietmar Eggemann <dietmar.eggemann@arm.com>2012-02-09 17:47:19 +0000
committerDietmar Eggemann <dietmar.eggemann@arm.com>2012-02-09 17:47:19 +0000
commitf75e1ae6bba93ce80284f0651e09d98508ffe362 (patch)
tree306d7573476d1946c8b7e64456799b6fb16aa43f
parent50201c5436d6aa184c500bb6738708da43342bb0 (diff)
Bugfix: Create second 4KB 2nd stage mapping for VGIC.
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
-rwxr-xr-xbig-little/common/pagetable_setup.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/big-little/common/pagetable_setup.c b/big-little/common/pagetable_setup.c
index 3a505f1..0746800 100755
--- a/big-little/common/pagetable_setup.c
+++ b/big-little/common/pagetable_setup.c
@@ -146,7 +146,7 @@ unsigned long long stage2_l3_so_pt[512] __attribute__ ((aligned(4096)));
* Map the physical cpu interface to the virtual
* cpu interface for OS use.
*/
-static void Add4KMapping(four_kb_pt_desc * l3_mapping, unsigned level,
+static void CreateL3PageTable(four_kb_pt_desc * l3_mapping, unsigned level,
unsigned long long *base_pt_addr)
{
unsigned one_gb_index = l3_mapping->pa >> 30;
@@ -201,6 +201,23 @@ static void Add4KMapping(four_kb_pt_desc * l3_mapping, unsigned level,
return;
}
+/*
+ * Add an 4KB mapping to an existing L3 page table.
+ */
+static void Add4KMapping(four_kb_pt_desc * l3_mapping)
+{
+ unsigned pa_4k_index = ((l3_mapping->pa << 11) >> 11) >> 12;
+ unsigned long long *l3_pt_addr = l3_mapping->pt_addr;
+
+ /*
+ * Replace the existing descriptor with new mapping and attributes
+ */
+ l3_pt_addr[pa_4k_index] =
+ l3_mapping->va | l3_mapping->attrs | VALID_MAPPING;
+
+ return;
+}
+
void CreateHypModePageTables(void)
{
unsigned num_l1_descs = 0, num_l2_descs = 0;
@@ -265,7 +282,7 @@ void CreateHypModePageTables(void)
ACCESS_FLAG | HMAIR0_DEVICE_MEM_ATTR_IDX | SHAREABILITY(0x3) |
AP(KERN_RW);
l3_desc.pt_addr = hyp_l3_so_pt;
- Add4KMapping(&l3_desc, LEVEL1, (unsigned long long *)hyp_l1_pagetable);
+ CreateL3PageTable(&l3_desc, LEVEL1, (unsigned long long *)hyp_l1_pagetable);
return;
}
@@ -341,15 +358,23 @@ void Create2ndStagePageTables(void)
}
- /* Map PCPUIF to the VCPUIF for the payload software */
+ /* First 4KB Mapping PCPUIF to the VCPUIF for the payload software */
l3_desc.va = VGIC_VM_PHY_BASE;
l3_desc.pa = GIC_IC_PHY_BASE;
l3_desc.attrs =
ACCESS_FLAG | SHAREABILITY(0x3) | ACCESS_PERM(0x3) | MEM_ATTR(0x1);
l3_desc.pt_addr = stage2_l3_cpuif_pt;
- Add4KMapping(&l3_desc, LEVEL2,
+ CreateL3PageTable(&l3_desc, LEVEL2,
(unsigned long long *)stage2_l2_pagetable);
+ /* Second 4KB Mapping PCPUIF to the VCPUIF for the payload software */
+ l3_desc.va = VGIC_VM_PHY_BASE + 0x1000;
+ l3_desc.pa = GIC_IC_PHY_BASE + 0x1000;
+ l3_desc.attrs =
+ ACCESS_FLAG | SHAREABILITY(0x3) | ACCESS_PERM(0x3) | MEM_ATTR(0x1);
+ l3_desc.pt_addr = stage2_l3_cpuif_pt;
+ Add4KMapping(&l3_desc);
+
/*
* Create a mapping for a device page to be used
* for Locks, Events & anything that is shared when both
@@ -360,7 +385,7 @@ void Create2ndStagePageTables(void)
l3_desc.attrs =
ACCESS_FLAG | SHAREABILITY(0x3) | ACCESS_PERM(0x3) | MEM_ATTR(0x1);
l3_desc.pt_addr = stage2_l3_so_pt;
- Add4KMapping(&l3_desc, LEVEL2,
+ CreateL3PageTable(&l3_desc, LEVEL2,
(unsigned long long *)stage2_l2_pagetable);
return;