|
|
4ec855 |
From b150f14fa8adcfe255c0380427e31d033bd44789 Mon Sep 17 00:00:00 2001
|
|
|
4ec855 |
From: Alex Williamson <alex.williamson@redhat.com>
|
|
|
4ec855 |
Date: Mon, 22 Jul 2019 18:09:47 +0100
|
|
|
4ec855 |
Subject: [PATCH 21/39] target/i386: sev: Do not unpin ram device memory region
|
|
|
4ec855 |
|
|
|
4ec855 |
RH-Author: Alex Williamson <alex.williamson@redhat.com>
|
|
|
4ec855 |
Message-id: <156381893103.14196.5165276806848335745.stgit@gimli.home>
|
|
|
4ec855 |
Patchwork-id: 89617
|
|
|
4ec855 |
O-Subject: [RHEL-8.1 qemu-kvm PATCH] target/i386: sev: Do not unpin ram device memory region
|
|
|
4ec855 |
Bugzilla: 1728958
|
|
|
4ec855 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1728958
|
|
|
4ec855 |
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=22722091
|
|
|
4ec855 |
Branch: rhel-8.1.0
|
|
|
4ec855 |
|
|
|
4ec855 |
The commit referenced below skipped pinning ram device memory when
|
|
|
4ec855 |
ram blocks are added, we need to do the same when they're removed.
|
|
|
4ec855 |
|
|
|
4ec855 |
Cc: Brijesh Singh <brijesh.singh@amd.com>
|
|
|
4ec855 |
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
4ec855 |
Fixes: cedc0ad539af ("target/i386: sev: Do not pin the ram device memory region")
|
|
|
4ec855 |
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
|
|
|
4ec855 |
Message-Id: <156320087103.2556.10983987500488190423.stgit@gimli.home>
|
|
|
4ec855 |
Reviewed-by: Singh, Brijesh <brijesh.singh@amd.com>
|
|
|
4ec855 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
4ec855 |
(cherry picked from commit 56e2ec9488b3b281130e064929f8ae5595d6ac39)
|
|
|
4ec855 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
4ec855 |
---
|
|
|
4ec855 |
target/i386/sev.c | 11 +++++++++++
|
|
|
4ec855 |
1 file changed, 11 insertions(+)
|
|
|
4ec855 |
|
|
|
4ec855 |
diff --git a/target/i386/sev.c b/target/i386/sev.c
|
|
|
4ec855 |
index b8009b0..7051a30 100644
|
|
|
4ec855 |
--- a/target/i386/sev.c
|
|
|
4ec855 |
+++ b/target/i386/sev.c
|
|
|
4ec855 |
@@ -159,6 +159,17 @@ sev_ram_block_removed(RAMBlockNotifier *n, void *host, size_t size)
|
|
|
4ec855 |
{
|
|
|
4ec855 |
int r;
|
|
|
4ec855 |
struct kvm_enc_region range;
|
|
|
4ec855 |
+ ram_addr_t offset;
|
|
|
4ec855 |
+ MemoryRegion *mr;
|
|
|
4ec855 |
+
|
|
|
4ec855 |
+ /*
|
|
|
4ec855 |
+ * The RAM device presents a memory region that should be treated
|
|
|
4ec855 |
+ * as IO region and should not have been pinned.
|
|
|
4ec855 |
+ */
|
|
|
4ec855 |
+ mr = memory_region_from_host(host, &offset);
|
|
|
4ec855 |
+ if (mr && memory_region_is_ram_device(mr)) {
|
|
|
4ec855 |
+ return;
|
|
|
4ec855 |
+ }
|
|
|
4ec855 |
|
|
|
4ec855 |
range.addr = (__u64)(unsigned long)host;
|
|
|
4ec855 |
range.size = size;
|
|
|
4ec855 |
--
|
|
|
4ec855 |
1.8.3.1
|
|
|
4ec855 |
|