[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 01/17] hw/intc/loongson_ipi: Access memory in little endian
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v3 01/17] hw/intc/loongson_ipi: Access memory in little endian |
Date: |
Wed, 17 Jul 2024 23:46:52 +0200 |
From: Bibo Mao <maobibo@loongson.cn>
Loongson IPI is only available in little-endian,
so use that to access the guest memory (in case
we run on a big-endian host).
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Fixes: f6783e3438 ("hw/loongarch: Add LoongArch ipi interrupt support")
[PMD: Extracted from bigger commit, added commit description]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/intc/loongson_ipi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/intc/loongson_ipi.c b/hw/intc/loongson_ipi.c
index e6a7142480..e7979dbdd8 100644
--- a/hw/intc/loongson_ipi.c
+++ b/hw/intc/loongson_ipi.c
@@ -14,6 +14,7 @@
#include "qapi/error.h"
#include "qemu/log.h"
#include "exec/address-spaces.h"
+#include "exec/memory.h"
#include "migration/vmstate.h"
#ifdef TARGET_LOONGARCH64
#include "target/loongarch/cpu.h"
@@ -102,7 +103,7 @@ static MemTxResult send_ipi_data(CPUState *cpu, uint64_t
val, hwaddr addr,
* if the mask is 0, we need not to do anything.
*/
if ((val >> 27) & 0xf) {
- data = address_space_ldl(iocsr_as, addr, attrs, NULL);
+ data = address_space_ldl_le(iocsr_as, addr, attrs, NULL);
for (i = 0; i < 4; i++) {
/* get mask for byte writing */
if (val & (0x1 << (27 + i))) {
@@ -113,7 +114,7 @@ static MemTxResult send_ipi_data(CPUState *cpu, uint64_t
val, hwaddr addr,
data &= mask;
data |= (val >> 32) & ~mask;
- address_space_stl(iocsr_as, addr, data, attrs, NULL);
+ address_space_stl_le(iocsr_as, addr, data, attrs, NULL);
return MEMTX_OK;
}
--
2.41.0
- [PATCH v3 00/17] Reconstruct loongson ipi driver, Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 02/17] hw/intc/loongson_ipi: Rename LoongsonIPI -> LoongsonIPIState, Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 01/17] hw/intc/loongson_ipi: Access memory in little endian,
Philippe Mathieu-Daudé <=
- [PATCH v3 03/17] hw/intc/loongson_ipi: Extract loongson_ipi_common_finalize(), Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 04/17] hw/intc/loongson_ipi: Extract loongson_ipi_common_realize(), Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 05/17] hw/intc/loongson_ipi: Add TYPE_LOONGSON_IPI_COMMON stub, Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 06/17] hw/intc/loongson_ipi: Move common definitions to loongson_ipi_common.h, Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 07/17] hw/intc/loongson_ipi: Move IPICore::mmio_mem to LoongsonIPIState, Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 08/17] hw/intc/loongson_ipi: Move IPICore structure to loongson_ipi_common.h, Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 09/17] hw/intc/loongson_ipi: Pass LoongsonIPICommonState to send_ipi_data(), Philippe Mathieu-Daudé, 2024/07/17
- [PATCH v3 10/17] hw/intc/loongson_ipi: Add LoongsonIPICommonClass::get_iocsr_as handler, Philippe Mathieu-Daudé, 2024/07/17