From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
qemu-block@nongnu.org, "Paul Burton" <paulburton@kernel.org>,
libvir-list@redhat.com,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Euler Robot" <euler.robot@huawei.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
AlexChen <alex.chen@huawei.com>,
"Huacai Chen" <chenhc@lemote.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"John Snow" <jsnow@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PULL 4/6] hw/intc/loongson: Fix incorrect 'core' calculation in liointc_read/write
Date: Tue, 3 Nov 2020 18:31:25 +0100 [thread overview]
Message-ID: <20201103173127.2704256-5-f4bug@amsat.org> (raw)
In-Reply-To: <20201103173127.2704256-1-f4bug@amsat.org>
From: AlexChen <alex.chen@huawei.com>
According to the loongson spec
(http://www.loongson.cn/uploadfile/cpu/3B1500/Loongson_3B1500_cpu_user_1.pdf)
and the macro definition(#define R_PERCORE_ISR(x) (0x40 + 0x8 * x)), we know
that the ISR size per CORE is 8, so here we need to divide
(addr - R_PERCORE_ISR(0)) by 8, not 4.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <5FA12391.8090400@huawei.com>
[PMD: Shortened subject]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/intc/loongson_liointc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/intc/loongson_liointc.c b/hw/intc/loongson_liointc.c
index 30fb375b721..fbbfb57ee9c 100644
--- a/hw/intc/loongson_liointc.c
+++ b/hw/intc/loongson_liointc.c
@@ -130,7 +130,7 @@ liointc_read(void *opaque, hwaddr addr, unsigned int size)
if (addr >= R_PERCORE_ISR(0) &&
addr < R_PERCORE_ISR(NUM_CORES)) {
- int core = (addr - R_PERCORE_ISR(0)) / 4;
+ int core = (addr - R_PERCORE_ISR(0)) / 8;
r = p->per_core_isr[core];
goto out;
}
@@ -173,7 +173,7 @@ liointc_write(void *opaque, hwaddr addr,
if (addr >= R_PERCORE_ISR(0) &&
addr < R_PERCORE_ISR(NUM_CORES)) {
- int core = (addr - R_PERCORE_ISR(0)) / 4;
+ int core = (addr - R_PERCORE_ISR(0)) / 8;
p->per_core_isr[core] = value;
goto out;
}
--
2.26.2
next prev parent reply other threads:[~2020-11-03 17:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 17:31 [PULL 0/6] Mips fixes patches Philippe Mathieu-Daudé
2020-11-03 17:31 ` [PULL 1/6] hw/mips: Remove the 'r4k' machine Philippe Mathieu-Daudé
2020-11-03 17:31 ` [PULL 2/6] hw/mips: Fix Lesser GPL version number Philippe Mathieu-Daudé
2020-11-03 17:31 ` [PULL 3/6] hw/mips/boston: " Philippe Mathieu-Daudé
2020-11-03 17:31 ` Philippe Mathieu-Daudé [this message]
2020-11-03 17:31 ` [PULL 5/6] target/mips: " Philippe Mathieu-Daudé
2020-11-03 17:31 ` [PULL 6/6] target/mips: Add unaligned access support for MIPS64R6 and Loongson-3 Philippe Mathieu-Daudé
2020-11-04 11:24 ` [PULL 0/6] Mips fixes patches Peter Maydell
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=20201103173127.2704256-5-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=alex.chen@huawei.com \
--cc=aurelien@aurel32.net \
--cc=chenhc@lemote.com \
--cc=euler.robot@huawei.com \
--cc=jiaxun.yang@flygoat.com \
--cc=jsnow@redhat.com \
--cc=libvir-list@redhat.com \
--cc=lvivier@redhat.com \
--cc=paulburton@kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).