diff options
| author | Stefan Hajnoczi <stefanha@redhat.com> | 2025-08-01 10:45:51 -0400 |
|---|---|---|
| committer | Stefan Hajnoczi <stefanha@redhat.com> | 2025-08-01 10:45:51 -0400 |
| commit | 2b290d67f0beaf5d259f26fcd2864d8af8dd08af (patch) | |
| tree | 15a3940390ffc4735e0a41c418aaf8ee6761cdd1 | |
| parent | 4e06566dbd1b1251c2788af26a30bd148d4eb6c1 (diff) | |
| parent | 31995cc4087123a13e9345153e0c39ffb44b9277 (diff) | |
| download | focaccia-qemu-2b290d67f0beaf5d259f26fcd2864d8af8dd08af.tar.gz focaccia-qemu-2b290d67f0beaf5d259f26fcd2864d8af8dd08af.zip | |
Merge tag 'pull-loongarch-20250731' of https://github.com/gaosong715/qemu into staging
pull-loongarch-2025-0731-for 10.1 # -----BEGIN PGP SIGNATURE----- # # iLMEAAEIAB0WIQTKRzxE1qCcGJoZP81FK5aFKyaCFgUCaIszPgAKCRBFK5aFKyaC # FpqqA/99JIEREUkjaHVVO6Skk89+uYjeIFG6NqY0BwMV1mUT9w+P2Jkcx/pzAWGg # zYrzH9SqjLkmKnjCNlPsuRBD9Ug82CzPOKZ+KBwhqfD6T2YzfjuEvSeq/6kAQmC1 # SWugBYXJGkcDqOPhxkUAS+JEkBj4RqNdPLK2wJxnpJsKc5KG5g== # =wpZU # -----END PGP SIGNATURE----- # gpg: Signature made Thu 31 Jul 2025 05:11:26 EDT # gpg: using RSA key CA473C44D6A09C189A193FCD452B96852B268216 # gpg: Good signature from "Song Gao <gaosong@loongson.cn>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: CA47 3C44 D6A0 9C18 9A19 3FCD 452B 9685 2B26 8216 * tag 'pull-loongarch-20250731' of https://github.com/gaosong715/qemu: hw/intc/loongarch_ipi: Fix start fail with smp cpu < smp maxcpus on KVM target/loongarch: Fix valid virtual address checking Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
| -rw-r--r-- | hw/intc/loongarch_ipi_kvm.c | 27 | ||||
| -rw-r--r-- | target/loongarch/cpu_helper.c | 4 |
2 files changed, 18 insertions, 13 deletions
diff --git a/hw/intc/loongarch_ipi_kvm.c b/hw/intc/loongarch_ipi_kvm.c index 4cb3acc921..dd4c367abf 100644 --- a/hw/intc/loongarch_ipi_kvm.c +++ b/hw/intc/loongarch_ipi_kvm.c @@ -23,36 +23,41 @@ static void kvm_ipi_access_regs(void *opaque, bool write) LoongarchIPIState *lis = LOONGARCH_IPI(opaque); IPICore *core; uint64_t attr; - int cpu, fd = lis->dev_fd; + int i, cpu_index, fd = lis->dev_fd; if (fd == 0) { return; } - for (cpu = 0; cpu < ipi->num_cpu; cpu++) { - core = &ipi->cpu[cpu]; - attr = (cpu << 16) | CORE_STATUS_OFF; + for (i = 0; i < ipi->num_cpu; i++) { + core = &ipi->cpu[i]; + if (core->cpu == NULL) { + continue; + } + cpu_index = i; + + attr = (cpu_index << 16) | CORE_STATUS_OFF; kvm_ipi_access_reg(fd, attr, &core->status, write); - attr = (cpu << 16) | CORE_EN_OFF; + attr = (cpu_index << 16) | CORE_EN_OFF; kvm_ipi_access_reg(fd, attr, &core->en, write); - attr = (cpu << 16) | CORE_SET_OFF; + attr = (cpu_index << 16) | CORE_SET_OFF; kvm_ipi_access_reg(fd, attr, &core->set, write); - attr = (cpu << 16) | CORE_CLEAR_OFF; + attr = (cpu_index << 16) | CORE_CLEAR_OFF; kvm_ipi_access_reg(fd, attr, &core->clear, write); - attr = (cpu << 16) | CORE_BUF_20; + attr = (cpu_index << 16) | CORE_BUF_20; kvm_ipi_access_reg(fd, attr, &core->buf[0], write); - attr = (cpu << 16) | CORE_BUF_28; + attr = (cpu_index << 16) | CORE_BUF_28; kvm_ipi_access_reg(fd, attr, &core->buf[2], write); - attr = (cpu << 16) | CORE_BUF_30; + attr = (cpu_index << 16) | CORE_BUF_30; kvm_ipi_access_reg(fd, attr, &core->buf[4], write); - attr = (cpu << 16) | CORE_BUF_38; + attr = (cpu_index << 16) | CORE_BUF_38; kvm_ipi_access_reg(fd, attr, &core->buf[6], write); } } diff --git a/target/loongarch/cpu_helper.c b/target/loongarch/cpu_helper.c index e172b11ce1..b5f732f15b 100644 --- a/target/loongarch/cpu_helper.c +++ b/target/loongarch/cpu_helper.c @@ -196,8 +196,8 @@ int get_physical_address(CPULoongArchState *env, hwaddr *physical, } /* Check valid extension */ - addr_high = sextract64(address, TARGET_VIRT_ADDR_SPACE_BITS, 16); - if (!(addr_high == 0 || addr_high == -1)) { + addr_high = (int64_t)address >> (TARGET_VIRT_ADDR_SPACE_BITS - 1); + if (!(addr_high == 0 || addr_high == -1ULL)) { return TLBRET_BADADDR; } |