|
|
ae23c9 |
From 660e7dc57899e79e85c19baa93be009b0382ae8e Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Gary R Hook <ghook@redhat.com>
|
|
|
ae23c9 |
Date: Wed, 10 Apr 2019 00:08:03 +0100
|
|
|
ae23c9 |
Subject: [PATCH 3/5] target/i386: sev: Do not pin the ram device memory region
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Gary R Hook <ghook@redhat.com>
|
|
|
ae23c9 |
Message-id: <20190410000803.1744-3-ghook@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 85542
|
|
|
ae23c9 |
O-Subject: [RHEL-8.1 virt 2/2] target/i386: sev: Do not pin the ram device memory region
|
|
|
ae23c9 |
Bugzilla: 1667249
|
|
|
ae23c9 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
BZ: 1667249
|
|
|
ae23c9 |
Branch: rhel-8.1.0
|
|
|
ae23c9 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1667249
|
|
|
ae23c9 |
Upstream Status: 4.0.0-rc1
|
|
|
ae23c9 |
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=20980582
|
|
|
ae23c9 |
Conflicts: None
|
|
|
ae23c9 |
|
|
|
ae23c9 |
commit cedc0ad539afbbb669dba9e73dfad2915bc1c25b
|
|
|
ae23c9 |
Author: Singh, Brijesh <brijesh.singh@amd.com>
|
|
|
ae23c9 |
Date: Mon Feb 4 22:23:40 2019 +0000
|
|
|
ae23c9 |
|
|
|
ae23c9 |
target/i386: sev: Do not pin the ram device memory region
|
|
|
ae23c9 |
|
|
|
ae23c9 |
The RAM device presents a memory region that should be handled
|
|
|
ae23c9 |
as an IO region and should not be pinned.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
In the case of the vfio-pci, RAM device represents a MMIO BAR
|
|
|
ae23c9 |
and the memory region is not backed by pages hence
|
|
|
ae23c9 |
KVM_MEMORY_ENCRYPT_REG_REGION fails to lock the memory range.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1667249
|
|
|
ae23c9 |
Cc: Alex Williamson <alex.williamson@redhat.com>
|
|
|
ae23c9 |
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
|
|
|
ae23c9 |
Message-Id: <20190204222322.26766-3-brijesh.singh@amd.com>
|
|
|
ae23c9 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
ae23c9 |
Cc: Richard Henderson <rth@twiddle.net>
|
|
|
ae23c9 |
Cc: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
ae23c9 |
Cc: qemu-devel@nongnu.org
|
|
|
ae23c9 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
target/i386/sev.c | 11 +++++++++++
|
|
|
ae23c9 |
1 file changed, 11 insertions(+)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/target/i386/sev.c b/target/i386/sev.c
|
|
|
ae23c9 |
index 2395171..b8009b0 100644
|
|
|
ae23c9 |
--- a/target/i386/sev.c
|
|
|
ae23c9 |
+++ b/target/i386/sev.c
|
|
|
ae23c9 |
@@ -130,6 +130,17 @@ sev_ram_block_added(RAMBlockNotifier *n, void *host, size_t size)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
int r;
|
|
|
ae23c9 |
struct kvm_enc_region range;
|
|
|
ae23c9 |
+ ram_addr_t offset;
|
|
|
ae23c9 |
+ MemoryRegion *mr;
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ /*
|
|
|
ae23c9 |
+ * The RAM device presents a memory region that should be treated
|
|
|
ae23c9 |
+ * as IO region and should not be pinned.
|
|
|
ae23c9 |
+ */
|
|
|
ae23c9 |
+ mr = memory_region_from_host(host, &offset);
|
|
|
ae23c9 |
+ if (mr && memory_region_is_ram_device(mr)) {
|
|
|
ae23c9 |
+ return;
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
|
|
|
ae23c9 |
range.addr = (__u64)(unsigned long)host;
|
|
|
ae23c9 |
range.size = size;
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|