Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1226400 > unrolled thread
| Started by | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| First post | 2015-09-16 21:10 +0200 |
| Last post | 2015-09-16 21:10 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 0/7] arm64: Use contigous PTE bit for the kernel linear mapping Jeremy Linton <jeremy.linton@arm.com> - 2015-09-16 21:10 +0200
[PATCH 7/7] arm64: Mark kernel page ranges contiguous Jeremy Linton <jeremy.linton@arm.com> - 2015-09-16 21:10 +0200
Re: [PATCH 7/7] arm64: Mark kernel page ranges contiguous Steve Capper <steve.capper@linaro.org> - 2015-09-17 19:30 +0200
RE: [PATCH 7/7] arm64: Mark kernel page ranges contiguous Jeremy Linton <Jeremy.Linton@arm.com> - 2015-09-17 19:40 +0200
[PATCH 5/7] arm64: Default kernel pages should be contiguous Jeremy Linton <jeremy.linton@arm.com> - 2015-09-16 21:10 +0200
[PATCH 3/7] arm64: PTE/PMD contiguous bit definition Jeremy Linton <jeremy.linton@arm.com> - 2015-09-16 21:10 +0200
[PATCH 4/7] arm64: Macros to check/set/unset the contiguous bit Jeremy Linton <jeremy.linton@arm.com> - 2015-09-16 21:10 +0200
| From | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| Date | 2015-09-16 21:10 +0200 |
| Subject | [PATCH 0/7] arm64: Use contigous PTE bit for the kernel linear mapping |
| Message-ID | <q9qfE-4Y7-3@gated-at.bofh.it> |
When running 64k pages it became apparent that it was possible that the kernel could create more TLB pressure in certain circumstances when compared to the 4k page kernel. This is due to the fact that large portions of the 4k kernel can be mapped with 2M blocks. While the larger block size for 64k pages is 512M, it frequently won't be used for assorted reasons. ARMv8 has a contiguous PTE bit that allows the TLBs to map a range larger than a single PTE if the range is physically contiguous. So its a good idea to use this where appropriate for the kernel mapping. This patch adds the definitions for the contiguous bit, updates the kernel page range dump to understand them (and block translations), and updates the code in mmu.c to use the contiguous bit where appropriate for the kernel linear mapping. Jeremy Linton (7): arm64: Add contiguous page flag shifts and constants arm64: Shorten lines which exceed 80 characters arm64: PTE/PMD contiguous bit definition arm64: Macros to check/set/unset the contiguous bit arm64: Default kernel pages should be contiguous arm64: Make the kernel page dump utility aware of the CONT bit arm64: Mark kernel page ranges contiguous arch/arm64/include/asm/page.h | 8 +++- arch/arm64/include/asm/pgtable-hwdef.h | 25 ++++++++---- arch/arm64/include/asm/pgtable.h | 13 +++++++ arch/arm64/mm/dump.c | 18 ++++++++- arch/arm64/mm/mmu.c | 70 ++++++++++++++++++++++++++++++---- 5 files changed, 116 insertions(+), 18 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| Date | 2015-09-16 21:10 +0200 |
| Subject | [PATCH 7/7] arm64: Mark kernel page ranges contiguous |
| Message-ID | <q9qfE-4Y7-19@gated-at.bofh.it> |
| In reply to | #1226400 |
With 64k pages, the next larger segment size is 512M. The linux
kernel also uses different protection flags to cover its code and data.
Because of this requirement, the vast majority of the kernel code and
data structures end up being mapped with 64k pages instead of the larger
pages common with a 4k page kernel.
Recent ARM processors support a contiguous bit in the
page tables which allows the a TLB to cover a range larger than a
single PTE if that range is mapped into physically contiguous
ram.
So, for the kernel its a good idea to set this flag. Some basic
micro benchmarks show it can significantly reduce the number of
L1 dTLB refills.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
arch/arm64/mm/mmu.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 62 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 9211b85..c7abbcc 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -80,19 +80,55 @@ static void split_pmd(pmd_t *pmd, pte_t *pte)
do {
/*
* Need to have the least restrictive permissions available
- * permissions will be fixed up later
+ * permissions will be fixed up later. Default the new page
+ * range as contiguous ptes.
*/
- set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC));
+ set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC_CONT));
pfn++;
} while (pte++, i++, i < PTRS_PER_PTE);
}
+/*
+ * Given a PTE with the CONT bit set, determine where the CONT range
+ * starts, and clear the entire range of PTE CONT bits.
+ */
+static void clear_cont_pte_range(pte_t *pte, unsigned long addr)
+{
+ int i;
+
+ pte -= CONT_RANGE_OFFSET(addr);
+ for (i = 0; i < CONT_RANGE; i++) {
+ set_pte(pte, pte_mknoncont(*pte));
+ pte++;
+ }
+ flush_tlb_all();
+}
+
+/*
+ * Given a range of PTEs set the pfn and provided page protection flags
+ */
+static void __populate_init_pte(pte_t *pte, unsigned long addr,
+ unsigned long end, phys_addr_t phys,
+ pgprot_t prot)
+{
+ unsigned long pfn = __phys_to_pfn(phys);
+
+ do {
+ /* clear all the bits except the pfn, then apply the prot */
+ set_pte(pte, pfn_pte(pfn, prot));
+ pte++;
+ pfn++;
+ addr += PAGE_SIZE;
+ } while (addr != end);
+}
+
static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
- unsigned long end, unsigned long pfn,
+ unsigned long end, phys_addr_t phys,
pgprot_t prot,
void *(*alloc)(unsigned long size))
{
pte_t *pte;
+ unsigned long next;
if (pmd_none(*pmd) || pmd_sect(*pmd)) {
pte = alloc(PTRS_PER_PTE * sizeof(pte_t));
@@ -105,9 +141,28 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
pte = pte_offset_kernel(pmd, addr);
do {
- set_pte(pte, pfn_pte(pfn, prot));
- pfn++;
- } while (pte++, addr += PAGE_SIZE, addr != end);
+ next = min(end, (addr + CONT_SIZE) & CONT_MASK);
+ if (((addr | next | phys) & CONT_RANGE_MASK) == 0) {
+ /* a block of CONT_RANGE_SIZE PTEs */
+ __populate_init_pte(pte, addr, next, phys,
+ prot | __pgprot(PTE_CONT));
+ pte += CONT_RANGE;
+ } else {
+ /*
+ * If the range being split is already inside of a
+ * contiguous range but this PTE isn't going to be
+ * contiguous, then we want to unmark the adjacent
+ * ranges, then update the portion of the range we
+ * are interrested in.
+ */
+ clear_cont_pte_range(pte, addr);
+ __populate_init_pte(pte, addr, next, phys, prot);
+ pte += CONT_RANGE_OFFSET(next - addr);
+ }
+
+ phys += next - addr;
+ addr = next;
+ } while (addr != end);
}
void split_pud(pud_t *old_pud, pmd_t *pmd)
@@ -168,8 +223,7 @@ static void alloc_init_pmd(struct mm_struct *mm, pud_t *pud,
}
}
} else {
- alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys),
- prot, alloc);
+ alloc_init_pte(pmd, addr, next, phys, prot, alloc);
}
phys += next - addr;
} while (pmd++, addr = next, addr != end);
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Steve Capper <steve.capper@linaro.org> |
|---|---|
| Date | 2015-09-17 19:30 +0200 |
| Subject | Re: [PATCH 7/7] arm64: Mark kernel page ranges contiguous |
| Message-ID | <q9Lap-1Wz-3@gated-at.bofh.it> |
| In reply to | #1226402 |
Hi Jeremy,
One quick comment for now below.
I ran into a problem testing this on my Seattle board, and needed the fix below.
Cheers,
--
Steve
On 16 September 2015 at 20:03, Jeremy Linton <jeremy.linton@arm.com> wrote:
> With 64k pages, the next larger segment size is 512M. The linux
> kernel also uses different protection flags to cover its code and data.
> Because of this requirement, the vast majority of the kernel code and
> data structures end up being mapped with 64k pages instead of the larger
> pages common with a 4k page kernel.
>
> Recent ARM processors support a contiguous bit in the
> page tables which allows the a TLB to cover a range larger than a
> single PTE if that range is mapped into physically contiguous
> ram.
>
> So, for the kernel its a good idea to set this flag. Some basic
> micro benchmarks show it can significantly reduce the number of
> L1 dTLB refills.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
> arch/arm64/mm/mmu.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 62 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 9211b85..c7abbcc 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -80,19 +80,55 @@ static void split_pmd(pmd_t *pmd, pte_t *pte)
> do {
> /*
> * Need to have the least restrictive permissions available
> - * permissions will be fixed up later
> + * permissions will be fixed up later. Default the new page
> + * range as contiguous ptes.
> */
> - set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC));
> + set_pte(pte, pfn_pte(pfn, PAGE_KERNEL_EXEC_CONT));
> pfn++;
> } while (pte++, i++, i < PTRS_PER_PTE);
> }
>
> +/*
> + * Given a PTE with the CONT bit set, determine where the CONT range
> + * starts, and clear the entire range of PTE CONT bits.
> + */
> +static void clear_cont_pte_range(pte_t *pte, unsigned long addr)
> +{
> + int i;
> +
> + pte -= CONT_RANGE_OFFSET(addr);
> + for (i = 0; i < CONT_RANGE; i++) {
> + set_pte(pte, pte_mknoncont(*pte));
> + pte++;
> + }
> + flush_tlb_all();
> +}
> +
> +/*
> + * Given a range of PTEs set the pfn and provided page protection flags
> + */
> +static void __populate_init_pte(pte_t *pte, unsigned long addr,
> + unsigned long end, phys_addr_t phys,
> + pgprot_t prot)
> +{
> + unsigned long pfn = __phys_to_pfn(phys);
> +
> + do {
> + /* clear all the bits except the pfn, then apply the prot */
> + set_pte(pte, pfn_pte(pfn, prot));
> + pte++;
> + pfn++;
> + addr += PAGE_SIZE;
> + } while (addr != end);
> +}
> +
> static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
> - unsigned long end, unsigned long pfn,
> + unsigned long end, phys_addr_t phys,
> pgprot_t prot,
> void *(*alloc)(unsigned long size))
> {
> pte_t *pte;
> + unsigned long next;
>
> if (pmd_none(*pmd) || pmd_sect(*pmd)) {
> pte = alloc(PTRS_PER_PTE * sizeof(pte_t));
> @@ -105,9 +141,28 @@ static void alloc_init_pte(pmd_t *pmd, unsigned long addr,
>
> pte = pte_offset_kernel(pmd, addr);
> do {
> - set_pte(pte, pfn_pte(pfn, prot));
> - pfn++;
> - } while (pte++, addr += PAGE_SIZE, addr != end);
> + next = min(end, (addr + CONT_SIZE) & CONT_MASK);
> + if (((addr | next | phys) & CONT_RANGE_MASK) == 0) {
> + /* a block of CONT_RANGE_SIZE PTEs */
> + __populate_init_pte(pte, addr, next, phys,
> + prot | __pgprot(PTE_CONT));
> + pte += CONT_RANGE;
> + } else {
> + /*
> + * If the range being split is already inside of a
> + * contiguous range but this PTE isn't going to be
> + * contiguous, then we want to unmark the adjacent
> + * ranges, then update the portion of the range we
> + * are interrested in.
> + */
> + clear_cont_pte_range(pte, addr);
> + __populate_init_pte(pte, addr, next, phys, prot);
> + pte += CONT_RANGE_OFFSET(next - addr);
I think this should instead be:
pte += (next - addr) >> PAGE_SHIFT;
Without the above change, I get panics on boot with my Seattle board
when efi_rtc is initialised.
(I think the EFI runtime stuff exacerbates the non-contiguous code
path hence I notice it on my system).
> + }
> +
> + phys += next - addr;
> + addr = next;
> + } while (addr != end);
> }
>
> void split_pud(pud_t *old_pud, pmd_t *pmd)
> @@ -168,8 +223,7 @@ static void alloc_init_pmd(struct mm_struct *mm, pud_t *pud,
> }
> }
> } else {
> - alloc_init_pte(pmd, addr, next, __phys_to_pfn(phys),
> - prot, alloc);
> + alloc_init_pte(pmd, addr, next, phys, prot, alloc);
> }
> phys += next - addr;
> } while (pmd++, addr = next, addr != end);
> --
> 2.4.3
>
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jeremy Linton <Jeremy.Linton@arm.com> |
|---|---|
| Date | 2015-09-17 19:40 +0200 |
| Subject | RE: [PATCH 7/7] arm64: Mark kernel page ranges contiguous |
| Message-ID | <q9Lk6-286-13@gated-at.bofh.it> |
| In reply to | #1227233 |
fEhpIEplcmVteSwNCnxPbmUgcXVpY2sgY29tbWVudCBmb3Igbm93IGJlbG93Lg0KfEkgcmFuIGlu dG8gYSBwcm9ibGVtIHRlc3RpbmcgdGhpcyBvbiBteSBTZWF0dGxlIGJvYXJkLCBhbmQgbmVlZGVk IHRoZSBmaXgNCnxiZWxvdy4NCjxzbmlwPg0KfD4gLSAgICAgICB9IHdoaWxlIChwdGUrKywgYWRk ciArPSBQQUdFX1NJWkUsIGFkZHIgIT0gZW5kKTsNCnw+ICsgICAgICAgICAgICAgICBuZXh0ID0g bWluKGVuZCwgKGFkZHIgKyBDT05UX1NJWkUpICYgQ09OVF9NQVNLKTsNCnw+ICsgICAgICAgICAg ICAgICBpZiAoKChhZGRyIHwgbmV4dCB8IHBoeXMpICYgQ09OVF9SQU5HRV9NQVNLKSA9PSAwKSB7 DQp8PiArICAgICAgICAgICAgICAgICAgICAgICAvKiBhIGJsb2NrIG9mIENPTlRfUkFOR0VfU0la RSBQVEVzICovDQp8PiArICAgICAgICAgICAgICAgICAgICAgICBfX3BvcHVsYXRlX2luaXRfcHRl KHB0ZSwgYWRkciwgbmV4dCwgcGh5cywNCnw+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgcHJvdCB8IF9fcGdwcm90KFBURV9DT05UKSk7DQp8PiArICAgICAgICAg ICAgICAgICAgICAgICBwdGUgKz0gQ09OVF9SQU5HRTsNCnw+ICsgICAgICAgICAgICAgICB9IGVs c2Ugew0KfD4gKyAgICAgICAgICAgICAgICAgICAgICAgLyoNCnw+ICsgICAgICAgICAgICAgICAg ICAgICAgICAqIElmIHRoZSByYW5nZSBiZWluZyBzcGxpdCBpcyBhbHJlYWR5IGluc2lkZSBvZiBh DQp8PiArICAgICAgICAgICAgICAgICAgICAgICAgKiBjb250aWd1b3VzIHJhbmdlIGJ1dCB0aGlz IFBURSBpc24ndCBnb2luZyB0byBiZQ0KfD4gKyAgICAgICAgICAgICAgICAgICAgICAgICogY29u dGlndW91cywgdGhlbiB3ZSB3YW50IHRvIHVubWFyayB0aGUgYWRqYWNlbnQNCnw+ICsgICAgICAg ICAgICAgICAgICAgICAgICAqIHJhbmdlcywgdGhlbiB1cGRhdGUgdGhlIHBvcnRpb24gb2YgdGhl IHJhbmdlIHdlDQp8PiArICAgICAgICAgICAgICAgICAgICAgICAgKiBhcmUgaW50ZXJyZXN0ZWQg aW4uDQp8PiArICAgICAgICAgICAgICAgICAgICAgICAgKi8NCnw+ICsgICAgICAgICAgICAgICAg ICAgICAgICBjbGVhcl9jb250X3B0ZV9yYW5nZShwdGUsIGFkZHIpOw0KfD4gKyAgICAgICAgICAg ICAgICAgICAgICAgIF9fcG9wdWxhdGVfaW5pdF9wdGUocHRlLCBhZGRyLCBuZXh0LCBwaHlzLCBw cm90KTsNCnw+ICsgICAgICAgICAgICAgICAgICAgICAgICBwdGUgKz0gQ09OVF9SQU5HRV9PRkZT RVQobmV4dCAtIGFkZHIpOw0KfA0KfEkgdGhpbmsgdGhpcyBzaG91bGQgaW5zdGVhZCBiZToNCnxw dGUgKz0gKG5leHQgLSBhZGRyKSA+PiBQQUdFX1NISUZUOw0KfA0KfFdpdGhvdXQgdGhlIGFib3Zl IGNoYW5nZSwgSSBnZXQgcGFuaWNzIG9uIGJvb3Qgd2l0aCBteSBTZWF0dGxlIGJvYXJkIHdoZW4N CnxlZmlfcnRjIGlzIGluaXRpYWxpc2VkLg0KfChJIHRoaW5rIHRoZSBFRkkgcnVudGltZSBzdHVm ZiBleGFjZXJiYXRlcyB0aGUgbm9uLWNvbnRpZ3VvdXMgY29kZSBwYXRoDQp8aGVuY2UgSSBub3Rp Y2UgaXQgb24gbXkgc3lzdGVtKS4NCg0KSSB0aGluayB0aGF0IGltcGxpZXMgeW91IGhhdmUgbGlu ZWFyIG1hcHBpbmdzID49IDJNIHRoYXQgYXJlbuKAmXQgYWxpZ25lZC4gT2ssIGJ1dCB0aGF0IGFs bW9zdCBzb3VuZHMgbGlrZSBzb21ldGhpbmcgd2Ugd2FudCB0byBjb21wbGFpbiBhYm91dCBpZiB3 ZSBkZXRlY3QgaXQuDQoNCg0KDQoNCg0KDQotLSBJTVBPUlRBTlQgTk9USUNFOiBUaGUgY29udGVu dHMgb2YgdGhpcyBlbWFpbCBhbmQgYW55IGF0dGFjaG1lbnRzIGFyZSBjb25maWRlbnRpYWwgYW5k IG1heSBhbHNvIGJlIHByaXZpbGVnZWQuIElmIHlvdSBhcmUgbm90IHRoZSBpbnRlbmRlZCByZWNp cGllbnQsIHBsZWFzZSBub3RpZnkgdGhlIHNlbmRlciBpbW1lZGlhdGVseSBhbmQgZG8gbm90IGRp c2Nsb3NlIHRoZSBjb250ZW50cyB0byBhbnkgb3RoZXIgcGVyc29uLCB1c2UgaXQgZm9yIGFueSBw dXJwb3NlLCBvciBzdG9yZSBvciBjb3B5IHRoZSBpbmZvcm1hdGlvbiBpbiBhbnkgbWVkaXVtLiAg VGhhbmsgeW91Lg0KDQpBUk0gTGltaXRlZCwgUmVnaXN0ZXJlZCBvZmZpY2UgMTEwIEZ1bGJvdXJu IFJvYWQsIENhbWJyaWRnZSBDQjEgOU5KLCBSZWdpc3RlcmVkIGluIEVuZ2xhbmQgJiBXYWxlcywg Q29tcGFueSBObzogIDI1NTc1OTANCkFSTSBIb2xkaW5ncyBwbGMsIFJlZ2lzdGVyZWQgb2ZmaWNl IDExMCBGdWxib3VybiBSb2FkLCBDYW1icmlkZ2UgQ0IxIDlOSiwgUmVnaXN0ZXJlZCBpbiBFbmds YW5kICYgV2FsZXMsIENvbXBhbnkgTm86ICAyNTQ4NzgyDQo= -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| Date | 2015-09-16 21:10 +0200 |
| Subject | [PATCH 5/7] arm64: Default kernel pages should be contiguous |
| Message-ID | <q9qfF-4Y7-29@gated-at.bofh.it> |
| In reply to | #1226400 |
The default page attributes for a PMD being broken should have the CONT bit set. Create a new definition for an early boot range of PTE's that are contiguous. Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> --- arch/arm64/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index d43e1d1..252499e 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -76,6 +76,8 @@ extern void __pgd_error(const char *file, int line, unsigned long val); #define PAGE_KERNEL __pgprot(_PAGE_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE) #define PAGE_KERNEL_EXEC __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | PTE_WRITE) +#define PAGE_KERNEL_EXEC_CONT __pgprot(_PAGE_DEFAULT | PTE_UXN | PTE_DIRTY | \ + PTE_WRITE | PTE_CONT) #define PAGE_HYP __pgprot(_PAGE_DEFAULT | PTE_HYP) #define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| Date | 2015-09-16 21:10 +0200 |
| Subject | [PATCH 3/7] arm64: PTE/PMD contiguous bit definition |
| Message-ID | <q9qfF-4Y7-35@gated-at.bofh.it> |
| In reply to | #1226400 |
Define the bit positions in the PTE and PMD for the contiguous bit. Signed-off-by: Jeremy Linton <jeremy.linton@arm.com> --- arch/arm64/include/asm/pgtable-hwdef.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h index 4489cf6..80eeebf 100644 --- a/arch/arm64/include/asm/pgtable-hwdef.h +++ b/arch/arm64/include/asm/pgtable-hwdef.h @@ -55,6 +55,13 @@ #define SECTION_MASK (~(SECTION_SIZE-1)) /* + * Contiguous page definitions. + */ +#define CONT_RANGE (_AC(1, UL) << CONT_SHIFT) +#define CONT_RANGE_MASK ((CONT_RANGE-1) << PAGE_SHIFT) +#define CONT_RANGE_OFFSET(addr) (((addr)>>PAGE_SHIFT)&(CONT_RANGE-1)) + +/* * Hardware page table definitions. * * Level 1 descriptor (PUD). @@ -83,6 +90,7 @@ #define PMD_SECT_S (_AT(pmdval_t, 3) << 8) #define PMD_SECT_AF (_AT(pmdval_t, 1) << 10) #define PMD_SECT_NG (_AT(pmdval_t, 1) << 11) +#define PMD_SECT_CONT (_AT(pmdval_t, 1) << 52) #define PMD_SECT_PXN (_AT(pmdval_t, 1) << 53) #define PMD_SECT_UXN (_AT(pmdval_t, 1) << 54) @@ -105,6 +113,7 @@ #define PTE_AF (_AT(pteval_t, 1) << 10) /* Access Flag */ #define PTE_NG (_AT(pteval_t, 1) << 11) /* nG */ #define PTE_DBM (_AT(pteval_t, 1) << 51) /* Dirty Bit Mgmt */ +#define PTE_CONT (_AT(pteval_t, 1) << 52) /* Contiguous range */ #define PTE_PXN (_AT(pteval_t, 1) << 53) /* Privileged XN */ #define PTE_UXN (_AT(pteval_t, 1) << 54) /* User XN */ -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Jeremy Linton <jeremy.linton@arm.com> |
|---|---|
| Date | 2015-09-16 21:10 +0200 |
| Subject | [PATCH 4/7] arm64: Macros to check/set/unset the contiguous bit |
| Message-ID | <q9qfF-4Y7-37@gated-at.bofh.it> |
| In reply to | #1226400 |
Add the supporting macros to check if the contiguous bit
is set, set the bit, or clear it in a PTE entry.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
arch/arm64/include/asm/pgtable.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 6900b2d9..d43e1d1 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -144,6 +144,7 @@ extern struct page *empty_zero_page;
#define pte_special(pte) (!!(pte_val(pte) & PTE_SPECIAL))
#define pte_write(pte) (!!(pte_val(pte) & PTE_WRITE))
#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN))
+#define pte_cont(pte) (!!(pte_val(pte) & PTE_CONT))
#ifdef CONFIG_ARM64_HW_AFDBM
#define pte_hw_dirty(pte) (!(pte_val(pte) & PTE_RDONLY))
@@ -206,6 +207,16 @@ static inline pte_t pte_mkspecial(pte_t pte)
return set_pte_bit(pte, __pgprot(PTE_SPECIAL));
}
+static inline pte_t pte_mkcont(pte_t pte)
+{
+ return set_pte_bit(pte, __pgprot(PTE_CONT));
+}
+
+static inline pte_t pte_mknoncont(pte_t pte)
+{
+ return clear_pte_bit(pte, __pgprot(PTE_CONT));
+}
+
static inline void set_pte(pte_t *ptep, pte_t pte)
{
*ptep = pte;
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web