From: Alexander Gordeev <agordeev@linux.ibm.com>
To: kexec@lists.infradead.org
Subject: [PATCH 1/2] s390x: fix virtual vs physical address confusion
Date: Wed, 29 Nov 2023 13:50:11 +0100 [thread overview]
Message-ID: <d3b09ef4a138e8a8b8bfaa710cdc4ebce03cef81.1701261329.git.agordeev@linux.ibm.com> (raw)
In-Reply-To: <cover.1701261329.git.agordeev@linux.ibm.com>
Physical and virtual addresses are the same on S390X.
That led to misuse of readmem() address type.
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
arch/s390x.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/arch/s390x.c b/arch/s390x.c
index c4fed6f..a01f164 100644
--- a/arch/s390x.c
+++ b/arch/s390x.c
@@ -167,7 +167,7 @@ _kl_rsg_table_deref_s390x(unsigned long vaddr, unsigned long table,
return 0;
}
- if (!readmem(VADDR, table + offset, &entry, sizeof(entry))) {
+ if (!readmem(PADDR, table + offset, &entry, sizeof(entry))) {
if (level)
ERRMSG("Can't read region table %d entry\n", level);
else
@@ -201,7 +201,7 @@ static ulong _kl_pg_table_deref_s390x(unsigned long vaddr, unsigned long table)
unsigned long offset, entry;
offset = pte_offset(vaddr);
- readmem(VADDR, table + offset, &entry, sizeof(entry));
+ readmem(PADDR, table + offset, &entry, sizeof(entry));
/*
* Check if the page table entry could be read and doesn't have
* the reserved bit set.
@@ -227,17 +227,22 @@ static unsigned long long
vtop_s390x(unsigned long vaddr)
{
unsigned long long paddr = NOT_PADDR;
+ unsigned long long swapper_pg_dir;
unsigned long table, entry;
int level, len;
- if (SYMBOL(swapper_pg_dir) == NOT_FOUND_SYMBOL) {
+ swapper_pg_dir = SYMBOL(swapper_pg_dir);
+ if (swapper_pg_dir == NOT_FOUND_SYMBOL) {
ERRMSG("Can't get the symbol of swapper_pg_dir.\n");
return NOT_PADDR;
}
- table = SYMBOL(swapper_pg_dir);
+ table = vaddr_to_paddr(swapper_pg_dir);
/* Read the first entry to find the number of page table levels. */
- readmem(VADDR, table, &entry, sizeof(entry));
+ if (!readmem(PADDR, table, &entry, sizeof(entry))) {
+ ERRMSG("Can't read swapper_pg_dir entry.\n");
+ return NOT_PADDR;
+ }
level = TABLE_LEVEL(entry);
len = TABLE_LENGTH(entry);
--
2.40.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2023-11-29 12:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 12:50 [PATCH 0/2] s390x: uncouple physical and virtual memory spaces Alexander Gordeev
2023-11-29 12:50 ` Alexander Gordeev [this message]
2023-11-29 12:50 ` [PATCH 2/2] s390x: uncouple virtual and physical address spaces Alexander Gordeev
2023-12-05 7:24 ` HAGIO KAZUHITO(萩尾 一仁)
2023-12-05 15:01 ` Alexander Gordeev
2023-12-05 15:01 ` [PATCH v2 " Alexander Gordeev
2023-12-06 4:56 ` HAGIO KAZUHITO(萩尾 一仁)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d3b09ef4a138e8a8b8bfaa710cdc4ebce03cef81.1701261329.git.agordeev@linux.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=kexec@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox