mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 00:28:20 +00:00
[module] AMD SEV support
This commit is contained in:
parent
a3045e0b4a
commit
e6aa2b85a9
1
AUTHORS
1
AUTHORS
@ -66,3 +66,4 @@ David Meier <meier_david_91@hotmail.com> (Kenny.ch)
|
|||||||
Daniel Cordero <looking-glass@0xdc.io> (0xdc)
|
Daniel Cordero <looking-glass@0xdc.io> (0xdc)
|
||||||
esi <git@esibun.net> (esibun)
|
esi <git@esibun.net> (esibun)
|
||||||
MakiseKurisu <saberconer@gmail.com> (MakiseKurisu)
|
MakiseKurisu <saberconer@gmail.com> (MakiseKurisu)
|
||||||
|
Zenithal <i@zenithal.me> (ZenithalHourlyRate)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Looking Glass
|
* Looking Glass
|
||||||
* Copyright © 2017-2022 The Looking Glass Authors
|
* Copyright © 2017-2023 The Looking Glass Authors
|
||||||
* https://looking-glass.io
|
* https://looking-glass.io
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
@ -33,6 +33,10 @@
|
|||||||
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_AMD_MEM_ENCRYPT
|
||||||
|
#include <asm/mem_encrypt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "kvmfr.h"
|
#include "kvmfr.h"
|
||||||
|
|
||||||
DEFINE_MUTEX(minor_lock);
|
DEFINE_MUTEX(minor_lock);
|
||||||
@ -321,6 +325,25 @@ static int device_mmap(struct file * filp, struct vm_area_struct * vma)
|
|||||||
switch (kdev->type)
|
switch (kdev->type)
|
||||||
{
|
{
|
||||||
case KVMFR_TYPE_PCI:
|
case KVMFR_TYPE_PCI:
|
||||||
|
#ifdef CONFIG_AMD_MEM_ENCRYPT
|
||||||
|
/* Clear C-bit for ivshmem when mapped
|
||||||
|
* as normal memory to the userspace
|
||||||
|
*
|
||||||
|
* devm_memremap below will "hotplug" the ivshmem as normal mem,
|
||||||
|
* when sev and/or sev-snp is effective,
|
||||||
|
* ivshmem will be encrypted and private memory.
|
||||||
|
*
|
||||||
|
* However, this is not the intention of ivshmem, as it
|
||||||
|
* is meant to be shared with other VMs and the hypervisor.
|
||||||
|
*
|
||||||
|
* Mapping ivshmem as iomem could resolve the sev/sev-snp issue,
|
||||||
|
* but it then will not be cached and the performance is low.
|
||||||
|
*
|
||||||
|
* To maintain high performance yet make it shared, we should
|
||||||
|
* clear the C-bit for ivshmem.
|
||||||
|
*/
|
||||||
|
vma->vm_page_prot.pgprot &= ~(sme_me_mask);
|
||||||
|
#endif
|
||||||
vma->vm_ops = &pci_mmap_ops;
|
vma->vm_ops = &pci_mmap_ops;
|
||||||
vma->vm_private_data = kdev;
|
vma->vm_private_data = kdev;
|
||||||
return 0;
|
return 0;
|
||||||
@ -626,7 +649,7 @@ MODULE_DEVICE_TABLE(pci, kvmfr_pci_ids);
|
|||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
MODULE_AUTHOR("Geoffrey McRae <geoff@hostfission.com>");
|
MODULE_AUTHOR("Geoffrey McRae <geoff@hostfission.com>");
|
||||||
MODULE_AUTHOR("Guanzhong Chen <quantum2048@gmail.com>");
|
MODULE_AUTHOR("Guanzhong Chen <quantum2048@gmail.com>");
|
||||||
MODULE_VERSION("0.0.8");
|
MODULE_VERSION("0.0.9");
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
|
||||||
MODULE_IMPORT_NS(DMA_BUF);
|
MODULE_IMPORT_NS(DMA_BUF);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user