[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/23] target/i386: sev: Do not pin the ram device me
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 05/23] target/i386: sev: Do not pin the ram device memory region |
Date: |
Wed, 27 Mar 2019 13:37:43 +0100 |
From: "Singh, Brijesh" <address@hidden>
The RAM device presents a memory region that should be handled
as an IO region and should not be pinned.
In the case of the vfio-pci, RAM device represents a MMIO BAR
and the memory region is not backed by pages hence
KVM_MEMORY_ENCRYPT_REG_REGION fails to lock the memory range.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1667249
Cc: Alex Williamson <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Signed-off-by: Brijesh Singh <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target/i386/sev.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 20b2d32..cd77f6b 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -131,6 +131,17 @@ sev_ram_block_added(RAMBlockNotifier *n, void *host,
size_t size)
{
int r;
struct kvm_enc_region range;
+ ram_addr_t offset;
+ MemoryRegion *mr;
+
+ /*
+ * The RAM device presents a memory region that should be treated
+ * as IO region and should not be pinned.
+ */
+ mr = memory_region_from_host(host, &offset);
+ if (mr && memory_region_is_ram_device(mr)) {
+ return;
+ }
range.addr = (__u64)(unsigned long)host;
range.size = size;
--
1.8.3.1
- [Qemu-devel] [PULL 00/23] Misc patches for QEMU 4.0-rc, mostly Kconfig refinements, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 03/23] kconfig: add dependencies on CONFIG_MSI_NONBROKEN, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 01/23] riscv: plic: Set msi_nonbroken as true, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 05/23] target/i386: sev: Do not pin the ram device memory region,
Paolo Bonzini <=
- [Qemu-devel] [PULL 04/23] memory: Fix the memory region type assignment order, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 06/23] hw/char/parallel: Make it possible to compile also without CONFIG_PARALLEL, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 02/23] kconfig: add CONFIG_MSI_NONBROKEN, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 08/23] prep: do not select I82374, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 07/23] hw/i386/Kconfig: PC uses I8257, not I82374, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 10/23] hw/isa/Kconfig: PIIX4 southbridge requires USB UHCI, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 11/23] hw/i386/Kconfig: enable devices that can be created by default, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 13/23] hw/mips/Kconfig: Fulong 2e board requires ati-vga/rtl8139 PCI devices, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 12/23] hw/mips/Kconfig: Malta machine requires the pcnet network card, Paolo Bonzini, 2019/03/27
- [Qemu-devel] [PULL 09/23] hw/isa/Kconfig: i82378 SuperIO requires PC speaker device, Paolo Bonzini, 2019/03/27