From: James Puthukattukaran <james.puthukattukaran@oracle.com>
To: "Lendacky, Thomas" <thomas.lendacky@amd.com>,
"Singh, Brijesh" <brijesh.singh@amd.com>
Cc: gregkh@linuxfoundation.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 0/1] drivers/char/mem.c: Disable encryption bit in page tables for MMIO access
Date: Thu, 4 Oct 2018 13:17:26 -0400 [thread overview]
Message-ID: <671c6651-71b3-0e0d-8e87-191ca14fed50@oracle.com> (raw)
On AMD based systems, mmap'ing a PCI MMIO region does not return proper
values. This is because the mmap_mem function does not consider the fact
that IO regions are not to be encrypted.
In the failing kernel, here's the output --
[root@foo]# ./memaccess 0xd0000000 -t pmem -l 32
0 (0 ) : ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
10 (16 ) : ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
I instrumented the kernel to print out the PTE value --
Jun 20 11:46:35 bur-e1-2l-303 kernel: pfn = 0xfffffff80f0866b2, vma->pgoff = 0xd
0000, flags = 0x5044471, prot = 0x8000800000000025
Jun 20 11:46:35 bur-e1-2l-303 kernel: pte = 0x80008000d0000235, pfn = 0xd0000
Note that 0x8000800000000025 -- bit 47 is set. It should not be set for a
MMIO region.
When I disable memory encryption (mem_encrypt=off command line), things work
as they should.
[root@foo]# ./memaccess 0xd0000000 -t pmem -l 32
0 (0 ) : 20 00 00 01 40 08 00 04 f1 00 00 14 0a 00 ff 07
10 (16 ) : 65 f6 70 02 c0 05 00 00 a0 04 00 00 0b 00 00 00
James Puthukattukaran(1):
drivers/char/mem.c: Disable encryption bit in page tables for MMIO
access
drivers/char/mem.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
next reply other threads:[~2018-10-04 17:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-04 17:17 James Puthukattukaran [this message]
2018-10-04 17:18 ` [PATCH 1/1] drivers/char/mem.c: Disable encryption bit in page tables for, " James Puthukattukaran
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=671c6651-71b3-0e0d-8e87-191ca14fed50@oracle.com \
--to=james.puthukattukaran@oracle.com \
--cc=brijesh.singh@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.lendacky@amd.com \
/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
all inboxes | Powered by JetHome®