|
|
62547e |
From b56c362132baef40cc25d910c1e0d217d83cfe44 Mon Sep 17 00:00:00 2001
|
|
|
62547e |
From: Janosch Frank <frankja@linux.ibm.com>
|
|
|
62547e |
Date: Thu, 11 Aug 2022 12:10:57 +0000
|
|
|
62547e |
Subject: [PATCH 25/42] dump: Rework get_start_block
|
|
|
62547e |
MIME-Version: 1.0
|
|
|
62547e |
Content-Type: text/plain; charset=UTF-8
|
|
|
62547e |
Content-Transfer-Encoding: 8bit
|
|
|
62547e |
|
|
|
62547e |
RH-Author: Cédric Le Goater <clg@redhat.com>
|
|
|
62547e |
RH-MergeRequest: 226: s390: Enhanced Interpretation for PCI Functions and Secure Execution guest dump
|
|
|
62547e |
RH-Bugzilla: 1664378 2043909
|
|
|
62547e |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
62547e |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
62547e |
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
|
|
|
62547e |
RH-Commit: [25/41] c93842a1aaeadcc11e91c194452fcd05d163b3ca
|
|
|
62547e |
|
|
|
62547e |
get_start_block() returns the start address of the first memory block
|
|
|
62547e |
or -1.
|
|
|
62547e |
|
|
|
62547e |
With the GuestPhysBlock iterator conversion we don't need to set the
|
|
|
62547e |
start address and can therefore remove that code and the "start"
|
|
|
62547e |
DumpState struct member. The only functionality left is the validation
|
|
|
62547e |
of the start block so it only makes sense to re-name the function to
|
|
|
62547e |
validate_start_block()
|
|
|
62547e |
|
|
|
62547e |
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
|
|
62547e |
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
62547e |
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
|
|
|
62547e |
Message-Id: <20220811121111.9878-5-frankja@linux.ibm.com>
|
|
|
62547e |
(cherry picked from commit 0c2994ac9009577b967529ce18e269da5b280351)
|
|
|
62547e |
Signed-off-by: Cédric Le Goater <clg@redhat.com>
|
|
|
62547e |
---
|
|
|
62547e |
dump/dump.c | 20 ++++++--------------
|
|
|
62547e |
include/sysemu/dump.h | 2 --
|
|
|
62547e |
2 files changed, 6 insertions(+), 16 deletions(-)
|
|
|
62547e |
|
|
|
62547e |
diff --git a/dump/dump.c b/dump/dump.c
|
|
|
62547e |
index d981e843dd..e6aa037f59 100644
|
|
|
62547e |
--- a/dump/dump.c
|
|
|
62547e |
+++ b/dump/dump.c
|
|
|
62547e |
@@ -1509,30 +1509,22 @@ static void create_kdump_vmcore(DumpState *s, Error **errp)
|
|
|
62547e |
}
|
|
|
62547e |
}
|
|
|
62547e |
|
|
|
62547e |
-static ram_addr_t get_start_block(DumpState *s)
|
|
|
62547e |
+static int validate_start_block(DumpState *s)
|
|
|
62547e |
{
|
|
|
62547e |
GuestPhysBlock *block;
|
|
|
62547e |
|
|
|
62547e |
if (!s->has_filter) {
|
|
|
62547e |
- s->next_block = QTAILQ_FIRST(&s->guest_phys_blocks.head);
|
|
|
62547e |
return 0;
|
|
|
62547e |
}
|
|
|
62547e |
|
|
|
62547e |
QTAILQ_FOREACH(block, &s->guest_phys_blocks.head, next) {
|
|
|
62547e |
+ /* This block is out of the range */
|
|
|
62547e |
if (block->target_start >= s->begin + s->length ||
|
|
|
62547e |
block->target_end <= s->begin) {
|
|
|
62547e |
- /* This block is out of the range */
|
|
|
62547e |
continue;
|
|
|
62547e |
}
|
|
|
62547e |
-
|
|
|
62547e |
- s->next_block = block;
|
|
|
62547e |
- if (s->begin > block->target_start) {
|
|
|
62547e |
- s->start = s->begin - block->target_start;
|
|
|
62547e |
- } else {
|
|
|
62547e |
- s->start = 0;
|
|
|
62547e |
- }
|
|
|
62547e |
- return s->start;
|
|
|
62547e |
- }
|
|
|
62547e |
+ return 0;
|
|
|
62547e |
+ }
|
|
|
62547e |
|
|
|
62547e |
return -1;
|
|
|
62547e |
}
|
|
|
62547e |
@@ -1679,8 +1671,8 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
|
|
62547e |
goto cleanup;
|
|
|
62547e |
}
|
|
|
62547e |
|
|
|
62547e |
- s->start = get_start_block(s);
|
|
|
62547e |
- if (s->start == -1) {
|
|
|
62547e |
+ /* Is the filter filtering everything? */
|
|
|
62547e |
+ if (validate_start_block(s) == -1) {
|
|
|
62547e |
error_setg(errp, QERR_INVALID_PARAMETER, "begin");
|
|
|
62547e |
goto cleanup;
|
|
|
62547e |
}
|
|
|
62547e |
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
|
|
|
62547e |
index ffc2ea1072..7fce1d4af6 100644
|
|
|
62547e |
--- a/include/sysemu/dump.h
|
|
|
62547e |
+++ b/include/sysemu/dump.h
|
|
|
62547e |
@@ -166,8 +166,6 @@ typedef struct DumpState {
|
|
|
62547e |
hwaddr memory_offset;
|
|
|
62547e |
int fd;
|
|
|
62547e |
|
|
|
62547e |
- GuestPhysBlock *next_block;
|
|
|
62547e |
- ram_addr_t start;
|
|
|
62547e |
bool has_filter;
|
|
|
62547e |
int64_t begin;
|
|
|
62547e |
int64_t length;
|
|
|
62547e |
--
|
|
|
62547e |
2.37.3
|
|
|
62547e |
|