[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <671c6651-71b3-0e0d-8e87-191ca14fed50@oracle.com>
Date: Thu, 4 Oct 2018 13:17:26 -0400
From: James Puthukattukaran <james.puthukattukaran@...cle.com>
To: "Lendacky, Thomas" <thomas.lendacky@....com>,
"Singh, Brijesh" <brijesh.singh@....com>
Cc: gregkh@...uxfoundation.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH 0/1] drivers/char/mem.c: Disable encryption bit in page tables
for MMIO access
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(+)
Powered by blists - more mailing lists