mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/1] drivers/char/mem.c: Disable encryption bit in page tables for MMIO access
@ 2018-10-04 17:17 James Puthukattukaran
  2018-10-04 17:18 ` [PATCH 1/1] drivers/char/mem.c: Disable encryption bit in page tables for, " James Puthukattukaran
  0 siblings, 1 reply; 2+ messages in thread
From: James Puthukattukaran @ 2018-10-04 17:17 UTC (permalink / raw)
  To: Lendacky, Thomas, Singh, Brijesh; +Cc: gregkh, Linux Kernel Mailing List

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(+)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-04 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 17:17 [PATCH 0/1] drivers/char/mem.c: Disable encryption bit in page tables for MMIO access James Puthukattukaran
2018-10-04 17:18 ` [PATCH 1/1] drivers/char/mem.c: Disable encryption bit in page tables for, " James Puthukattukaran

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®