From: Borislav Petkov <bp@alien8.de>
To: Linux EFI <linux-efi@vger.kernel.org>
Cc: Borislav Petkov <bp@suse.de>, Dave Young <dyoung@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Matt Fleming <matt@console-pimps.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Vivek Goyal <vgoyal@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, X86 ML <x86@kernel.org>
Subject: [PATCH 06/11] x86, pageattr: Add a PTE pagetable populating function
Date: Thu, 31 Oct 2013 17:25:04 +0100 [thread overview]
Message-ID: <1383236709-19716-7-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1383236709-19716-1-git-send-email-bp@alien8.de>
From: Borislav Petkov <bp@suse.de>
Handle last level by unconditionally writing the PTEs into the PTE page
while paying attention to the NX bit.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/mm/pageattr.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 968398b023c0..2a1308a8c072 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -686,7 +686,27 @@ static int alloc_pmd_page(pud_t *pud)
return 0;
}
-#define populate_pte(cpa, start, end, pages, pmd, pgprot) do {} while (0)
+static void populate_pte(struct cpa_data *cpa,
+ unsigned long start, unsigned long end,
+ unsigned num_pages, pmd_t *pmd, pgprot_t pgprot)
+{
+ pte_t *pte;
+
+ pte = pte_offset_kernel(pmd, start);
+
+ while (num_pages-- && start < end) {
+
+ /* deal with the NX bit */
+ if (!(pgprot_val(pgprot) & _PAGE_NX))
+ cpa->pfn &= ~_PAGE_NX;
+
+ set_pte(pte, pfn_pte(cpa->pfn >> PAGE_SHIFT, pgprot));
+
+ start += PAGE_SIZE;
+ cpa->pfn += PAGE_SIZE;
+ pte++;
+ }
+}
static int populate_pmd(struct cpa_data *cpa,
unsigned long start, unsigned long end,
--
1.8.4
next prev parent reply other threads:[~2013-10-31 16:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-31 16:24 [PATCH 00/11] EFI runtime services virtual mapping, vN++ Borislav Petkov
2013-10-31 16:24 ` [PATCH 01/11] efi: Simplify EFI_DEBUG Borislav Petkov
2013-10-31 16:25 ` [PATCH 02/11] x86, pageattr: Lookup address in an arbitrary PGD Borislav Petkov
2013-10-31 16:25 ` [PATCH 03/11] x86, pageattr: Add a PGD pagetable populating function Borislav Petkov
2013-10-31 16:25 ` [PATCH 04/11] x86, pageattr: Add a PUD " Borislav Petkov
2013-10-31 16:25 ` [PATCH 05/11] x86, pageattr: Add a PMD " Borislav Petkov
2013-10-31 16:25 ` Borislav Petkov [this message]
2013-10-31 16:25 ` [PATCH 07/11] x86, pageattr: Add a PUD error unwinding path Borislav Petkov
2013-10-31 16:25 ` [PATCH 08/11] x86, pageattr: Add last levels of error path Borislav Petkov
2013-10-31 16:25 ` [PATCH 09/11] x86, cpa: Map in an arbitrary pgd Borislav Petkov
2013-10-31 16:25 ` [PATCH 10/11] EFI: Runtime services virtual mapping Borislav Petkov
2013-11-01 3:25 ` Dave Young
2013-11-01 3:35 ` Dave Young
2013-11-01 12:50 ` Matt Fleming
2013-11-03 12:35 ` Dave Young
2013-11-03 12:31 ` Dave Young
2013-11-04 9:18 ` Matt Fleming
2013-10-31 16:25 ` [PATCH 11/11] efi: Check krealloc return value Borislav Petkov
2013-11-04 9:21 ` [PATCH 00/11] EFI runtime services virtual mapping, vN++ Matt Fleming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383236709-19716-7-git-send-email-bp@alien8.de \
--to=bp@alien8.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bp@suse.de \
--cc=dyoung@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@console-pimps.org \
--cc=mjg59@srcf.ucam.org \
--cc=vgoyal@redhat.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome