Message ID | 20220506205605.359830-16-nikos.nikoleris@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | EFI and ACPI support for arm64 | expand |
On Fri, May 06, 2022 at 09:55:57PM +0100, Nikos Nikoleris wrote: > From: Andrew Jones <drjones@redhat.com> > > This will be used by future change to add PTE entries for special EFI > memory regions. > > Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com> > --- > lib/arm/asm/setup.h | 1 + > lib/arm/mmu.c | 4 ++++ > 2 files changed, 5 insertions(+) > > diff --git a/lib/arm/asm/setup.h b/lib/arm/asm/setup.h > index f0e70b1..64cd379 100644 > --- a/lib/arm/asm/setup.h > +++ b/lib/arm/asm/setup.h > @@ -15,6 +15,7 @@ extern int nr_cpus; > > #define MR_F_IO (1U << 0) > #define MR_F_CODE (1U << 1) > +#define MR_F_RESERVED (1U << 2) > #define MR_F_UNKNOWN (1U << 31) > > struct mem_region { > diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c > index e1a72fe..931be98 100644 > --- a/lib/arm/mmu.c > +++ b/lib/arm/mmu.c > @@ -174,6 +174,10 @@ void *setup_mmu(phys_addr_t phys_end, void *unused) > for (r = mem_regions; r->end; ++r) { > if (r->flags & MR_F_IO) { > continue; > + } else if (r->flags & MR_F_RESERVED) { > + /* Reserved pages need to be writable for whatever reserved them */ > + mmu_set_range_ptes(mmu_idmap, r->start, r->start, r->end, > + __pgprot(PTE_WBWA)); > } else if (r->flags & MR_F_CODE) { > /* armv8 requires code shared between EL1 and EL0 to be read-only */ > mmu_set_range_ptes(mmu_idmap, r->start, r->start, r->end, > -- > 2.25.1 > Reviewed-by: Ricardo Koller <ricarkol@google.com>
diff --git a/lib/arm/asm/setup.h b/lib/arm/asm/setup.h index f0e70b1..64cd379 100644 --- a/lib/arm/asm/setup.h +++ b/lib/arm/asm/setup.h @@ -15,6 +15,7 @@ extern int nr_cpus; #define MR_F_IO (1U << 0) #define MR_F_CODE (1U << 1) +#define MR_F_RESERVED (1U << 2) #define MR_F_UNKNOWN (1U << 31) struct mem_region { diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c index e1a72fe..931be98 100644 --- a/lib/arm/mmu.c +++ b/lib/arm/mmu.c @@ -174,6 +174,10 @@ void *setup_mmu(phys_addr_t phys_end, void *unused) for (r = mem_regions; r->end; ++r) { if (r->flags & MR_F_IO) { continue; + } else if (r->flags & MR_F_RESERVED) { + /* Reserved pages need to be writable for whatever reserved them */ + mmu_set_range_ptes(mmu_idmap, r->start, r->start, r->end, + __pgprot(PTE_WBWA)); } else if (r->flags & MR_F_CODE) { /* armv8 requires code shared between EL1 and EL0 to be read-only */ mmu_set_range_ptes(mmu_idmap, r->start, r->start, r->end,