lkml.org 
[lkml]   [2018]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/1] drivers/char/mem.c: Disable encryption bit in page tables for MMIO access
Date
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(+)

\
 
 \ /
  Last update: 2018-10-04 19:18    [W:0.119 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site