With function helper_invtlb_page_asid_or_g(), one TLB entry in
LoongArch emulated TLB is invalidated. Also invalidate_tlb_entry()
can be called so that only one QEMU TLB entry will be flushed.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 2 +-
1 file changed, 1 insertion
With function helper_invtlb_page_asid_or_g(), currently it is to
search TLB entry one by one. Instead STLB can be searched at first
with hash method, and then MTLB.
Here common API loongarch_tlb_search_cb() is used in function
helper_invtlb_page_asid_or_g().
Signed-off-by: Bibo Mao
---
target
With function helper_invtlb_page_asid(), one TLB entry in LoongArch
emulated TLB is invalidated if found. Also invalidate_tlb_entry()
can be called so that only one QEMU TLB entry will be flushed.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 8 ++--
1 file changed, 6
With function loongarch_tlb_search(), it is to search TLB entry with
speficied virtual address, the difference is selection with asid and
global bit. Here add callback with selection with asid and global bit.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 19
Common API loongarch_tlb_search_cb() is added here to search TLB entry
with specified address.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 19 ++-
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target
.
Also there is optimization with qemu TLB flush, invalidate_tlb_entry()
is used to flush one TLB entry rather than flush all TLB entries.
This patchset is based on patch sent at
https://lore.kernel.org/qemu-devel/20250730030202.3425934-1-maob...@loongson.cn/
Bibo Mao (6):
target/loongarch
With function helper_invtlb_page_asid(), currently it is to search
TLB entry one by one. Instead STLB can be searched at first with hash
method, and then MTLB.
Here common API loongarch_tlb_search_cb() is used in function
helper_invtlb_page_asid()
Signed-off-by: Bibo Mao
---
target/loongarch
RY ... PCH_PIC_ROUTE_ENTRY_END:
-ptemp = (uint64_t *)(s->route_entry + addr - PCH_PIC_ROUTE_ENTRY);
-*ptemp = (*ptemp & ~mask) | data;
+ptemp = (uint64_t *)&s->route_entry[addr - PCH_PIC_ROUTE_ENTRY];
+stq_le_p(ptemp, (ldq_le_p(ptemp) & ~mask) | data);
break;
default:
qemu_log_mask(LOG_GUEST_ERROR,
Reviewed-by: Bibo Mao
skipped if both are the same or newly added.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 33 ++-
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index 888a008944
be selected secondly
3. random method is used by last.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 49 ++-
1 file changed, 42 insertions(+), 7 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index
With function fill_tlb_entry(), it will update LoongArch emulated
TLB information. Here parameter tlb pointer is added so that TLB
entry will be updated based on relative TLB CSR registers.
Signed-off-by: Bibo Mao
Reviewed-by: Richard Henderson
---
target/loongarch/tcg/tlb_helper.c | 7
added to
flush tlb.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 13 +++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index cf661aaeff..da2618ec62 100644
--- a/target/loongarch/tcg
With tlb_flush_range_by_mmuidx(), the virtual address is 64 bit.
However on LoongArch TLB emulation system, virtual address is
48 bit. It is necessary to signed-extend 48 bit address to 64 bit when
flush tlb, also fix address calculation issue with odd page.
Signed-off-by: Bibo Mao
---
target
.
Here field KM is added in LoongArch TLB entry to track whether the
lo0/lo1 pte entry is accessed in kernel mode. If set, when LoongArch
TLB is flushed, need flush QEMU TLB with mmu idx MMU_KERNEL_IDX.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 2 ++
target/loongarch/cpu.h
With function get_physical_address(), parameter MMUContext is added
and remove parameter address, prot and address.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 3 +--
target/loongarch/cpu_helper.c | 32 ---
target/loongarch/tcg/tlb_helper.c
Enum type MMUAccessType is used in function loongarch_map_tlb_entry()
rather than int type, and keep consistent with its caller function.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/loongarch/tcg
With function loongarch_map_tlb_entry(), parameter MMUConext is added
and remove parameter physical, prot and address.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 33 +++
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/target
Common function loongarch_check_pte() is to check tlb entry, return
the physical address and access priviledge if found. Also it can be
used with page table entry, which is used in page table walker.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 10 +
target/loongarch
With function loongarch_map_address(), parameter MMUContext is added
and remove parameter address, prot and address.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c | 32 ++--
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/target/loongarch
-by: Bibo Mao
Reviewed-by: Richard Henderson
---
target/loongarch/cpu.c | 180 -
target/loongarch/cpu.h | 2 -
2 files changed, 90 insertions(+), 92 deletions(-)
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index abad84c054..b96429ffb1
New header file cpu-mmu.h is added and move mmu relative function
declaration to this file.
Signed-off-by: Bibo Mao
Reviewed-by: Richard Henderson
---
target/loongarch/cpu-mmu.h| 30 ++
target/loongarch/cpu.c| 1 +
target/loongarch/cpu_helper.c
fine-grained tlb flush method
3. Fix some issues in function invalidate_tlb_entry() to flush tlb,
such as bitmap method with mmu idx, page size and address
calculation
---
---
Bibo Mao (19):
target/loongarch: Move some function definition to kvm directory
target/loongarch: Define
Move function definition specified with kvm to the corresponding
directory. Also remove header file "cpu.h" including outside of
macro QEMU_KVM_LOONGARCH_H.
Signed-off-by: Bibo Mao
Reviewed-by: Richard Henderson
---
hw/loongarch/virt.c | 1 +
target/loong
There is mixed usage between enum variable TLBRET_xxx and int type,
here add enum type TLBRet definition and replace int type variable
with enum type TLBRet in some functions.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h | 27 ++-
target/loongarch
With function loongarch_get_addr_from_tlb(), parameter MMUContext
is added and remove parameter physical, prot and address.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c| 7 +--
target/loongarch/tcg/tcg_loongarch.h | 4 ++--
target/loongarch/tcg/tlb_helper.c| 18
Function loongarch_check_pte() can get physical address and access
priviledge, it works on both TLB entry and pte entry. It can be used
in function loongarch_page_table_walker() also.
Signed-off-by: Bibo Mao
Reviewed-by: Richard Henderson
---
target/loongarch/cpu_helper.c | 42
Replace target_ulong type with vaddr in function get_physical_address()
and the same with its calling functions.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 2 +-
target/loongarch/cpu_helper.c | 9 -
target/loongarch/tcg/tlb_helper.c | 11 ++-
3 files
entries, even with
STLB. It is convenient with TLB maintainance operation.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 41 ---
1 file changed, 10 insertions(+), 31 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg
On 2025/7/28 下午1:09, Richard Henderson wrote:
On 7/27/25 17:22, Bibo Mao wrote:
+static inline target_ulong __vaddr(target_ulong addr)
+{
+ target_ulong high;
+
+ high = -(addr >> (TARGET_VIRT_ADDR_SPACE_BITS - 1));
+ return addr + (high << TARGET_VIRT_ADDR_SPACE_BITS)
amp;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);
}
}
Reviewed-by: Bibo Mao
On 2025/7/26 上午9:45, Richard Henderson wrote:
On 7/24/25 15:37, Bibo Mao wrote:
With tlb_flush_range_by_mmuidx(), the virtual address is 64 bit.
However on LoongArch TLB emulation system, virtual address is
48 bit. It is necessary to convert 48 bit address to 64 bit when
flush tlb, also fix
On 2025/7/26 上午9:19, Richard Henderson wrote:
On 7/24/25 15:37, Bibo Mao wrote:
Common function loongarch_check_pte() is to check tlb entry, return
the physical address and access priviledge. Also it can be used with
page table entry, which is used in page table walker.
Signed-off-by: Bibo
On 2025/7/26 上午9:31, Richard Henderson wrote:
On 7/24/25 15:37, Bibo Mao wrote:
@@ -191,8 +187,7 @@ static int loongarch_map_address(CPULoongArchState
*env, hwaddr *physical,
* legal mapping, even if the mapping is not yet in TLB.
return 0 if
* there is a valid map
On 2025/7/26 上午9:16, Richard Henderson wrote:
On 7/24/25 15:37, Bibo Mao wrote:
+enum {
+ TLBRET_MATCH = 0,
+ TLBRET_BADADDR = 1,
+ TLBRET_NOMATCH = 2,
+ TLBRET_INVALID = 3,
+ TLBRET_DIRTY = 4,
+ TLBRET_RI = 5,
+ TLBRET_XI = 6,
+ TLBRET_PE = 7,
+};
For a follow-up
*ctx, arg_##NAME * a) \
+{ return avail_64(ctx) && avail_##AVAIL(ctx) && FUNC(ctx, a, __VA_ARGS__);
}
+
#define avail_ALL(C) true
#define avail_64(C)(FIELD_EX32((C)->cpucfg1, CPUCFG1, ARCH) == \
CPUCFG1_ARCH_LA64)
Reviewed-by: Bibo Mao
hardware with LSX/LASX comes out.
BTW do you think when the 32-bit hardware with LSX/LASX will come out?
one year later or two years...
Regards
Bibo Mao
On 2025/7/24 下午3:20, WANG Rui wrote:
This patch replaces uses of the generic TRANS macro with TRANS64 for
instructions that are only valid when
other ASID can be selected secondly
3. random method is used by last.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 50 ++-
1 file changed, 42 insertions(+), 8 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg
skipped if both are the same or newly added.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 36 ++-
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index 1ed2471e0a
With function fill_tlb_entry(), it will update LoongArch emulated
TLB information. Here parameter tlb pointer is added so that TLB
entry will be updated based on relative TLB CSR registers.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 7 +++
1 file changed, 3 insertions
calculation
---
Bibo Mao (17):
target/loongarch: Move some function definition to kvm directory
target/loongarch: Define function loongarch_cpu_post_init as static
target/loongarch: Set page size in TLB misc with STLB
target/loongarch: Add header file cpu-mmu.h
target/loongarch: Add common
Function loongarch_check_pte() can get physical address and access
priviledge, it works on both TLB entry and pte entry. It can be used
at page table walking.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c | 38 +--
1 file changed, 14 insertions(+), 24
-by: Bibo Mao
---
target/loongarch/cpu.c | 180 -
target/loongarch/cpu.h | 2 -
2 files changed, 90 insertions(+), 92 deletions(-)
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index abad84c054..b96429ffb1 100644
--- a/target/loongarch
.
Here field KM is added in TLB MISC to track whether the lo0/lo1 pte
entry is accessed in kernel mode. If set, when LoongArch TLB is
flushed, need flush QEMU TLB with mmu idx MMU_KERNEL_IDX.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 2 ++
target/loongarch/cpu.h
With tlb_flush_range_by_mmuidx(), the virtual address is 64 bit.
However on LoongArch TLB emulation system, virtual address is
48 bit. It is necessary to convert 48 bit address to 64 bit when
flush tlb, also fix address calculation issue with odd page.
Signed-off-by: Bibo Mao
---
target
New header file cpu-mmu.h is added and move mmu relative function
declaration to this file.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 30 ++
target/loongarch/cpu.c| 1 +
target/loongarch/cpu_helper.c | 1 +
target/loongarch
should be added
to flush tlb.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 19 +--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index 61cc19610e..d18b382e56 100644
--- a/target
With function loongarch_map_tlb_entry(), parameter mmu_context is added
and remove parameter physical and prot.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 31 +++
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/target/loongarch
With function loongarch_get_addr_from_tlb(), parameter mmu_context
is added and remove parameter physical and prot.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c| 7 +--
target/loongarch/tcg/tcg_loongarch.h | 4 ++--
target/loongarch/tcg/tlb_helper.c| 16
With function loongarch_page_table_walker(), some output parameters
such as physical address and prot can be moved to structure mmu_context.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c | 27 +++
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git
With function get_physical_address(), parameter mmu_context is added
and remove parameter address, prot and address.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 3 +--
target/loongarch/cpu_helper.c | 31 ---
target/loongarch/tcg/tlb_helper.c
Common function loongarch_check_pte() is to check tlb entry, return
the physical address and access priviledge. Also it can be used with
page table entry, which is used in page table walker.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 10 +
target/loongarch/cpu_helper.c
Move function definition specified with kvm to the corresponding
directory. Also remove header file "cpu.h" including outside of
macro QEMU_KVM_LOONGARCH_H.
Signed-off-by: Bibo Mao
---
hw/loongarch/virt.c | 1 +
target/loongarch/cpu.h | 9 ---
entries, even with
STLB, it is convenient with TLB maintainance operation.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 41 ---
1 file changed, 10 insertions(+), 31 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg
With function loongarch_map_address(), parameter mmu_context is added
and remove parameter address, prot and address.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c | 24
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/target/loongarch
e since cpu is used in loop sentence already?
for (cpu = 0; cpu < ipi->num_cpu; cpu++)
Here modification with cpu will change loop sentence flow.
Or direct use attr = (core->cpu->cpu_index << 16) | CORE_STATUS_OFF;
Regards
Bibo Mao
+
attr = (cpu << 16) | CO
New header file cpu-mmu.h is added and move mmu relative function
declaration to this file.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 30 ++
target/loongarch/cpu.c| 1 +
target/loongarch/cpu_helper.c | 1 +
target/loongarch
Function loongarch_check_pte() can get physical address and access
priviledge, it works on both TLB entry and pte entry. It can be used
at page table walking.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c | 35 ++-
1 file changed, 10 insertions(+), 25
On LoongArch system, there are two pages with one TLB entry. If the
whole TLB entry is flushed, two pages will be flushed. Otherwise if
tlb is flushed one by one, page size is one page at a time.
Also virtual address of odd page is fixed here.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg
Qemu TCG provides some tlb flushing API, tlb can be flushed with
specified mmu idx and virtual address. Here fine-grained tlb flush
method is used.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 19 +++
1 file changed, 15 insertions(+), 4 deletions(-)
diff
With API tlb_flush_range_by_mmuidx(), bitmap method of mmu idx should
be used rather than itself. Also mmu idx comes from page table entry
information rather current running mode. With page table entry,
global bit for MMU_KERNEL_IDX, otherwise it is MMU_USER_IDX.
Signed-off-by: Bibo Mao
-by: Bibo Mao
---
target/loongarch/cpu.c | 180 -
target/loongarch/cpu.h | 2 -
2 files changed, 90 insertions(+), 92 deletions(-)
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index abad84c054..b96429ffb1 100644
--- a/target/loongarch
bitmap method with mmu idx, page size and address
calculation
---
Bibo Mao (9):
target/loongarch: Move some function definition to kvm directory
target/loongarch: Define function loongarch_cpu_post_init as static
target/loongarch: Set page size in TLB misc with STLB
target/loongarch: Add
Move function definition specified with kvm to the corresponding
directory. Also remove header file "cpu.h" including outside of
macro QEMU_KVM_LOONGARCH_H.
Signed-off-by: Bibo Mao
---
hw/loongarch/virt.c | 1 +
target/loongarch/cpu.h | 9 ---
entries, even with
STLB, it is convenient with TLB maintainance operation.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 41 ---
1 file changed, 10 insertions(+), 31 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg
Common function loongarch_check_pte() is to check tlb entry, return
the physical address and access priviledge. Also it can be used with
page table entry, which is used in page table walker.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 8
target/loongarch/cpu_helper.c
l be better if tcg_enabled() is used here, since
CONFIG_TCG and CONFIG_KVM is enabled by default. It should be supported
in KVM mode now. It is suggested in V4 review process :)
Regards
Bibo Mao
+object_class_property_add(oc, "avecintc", "OnOffAuto",
+
inal sentence work?
env->CSR_ESTAT = deposit64(env->CSR_ESTAT, irq, 1, level != 0);
This piece of code is a little strange.
Regards
Bibo Mao
+} else {
+env->CSR_ESTAT = deposit64(env->CSR_ESTAT, irq, 1, level != 0);
+}
if (FIELD_EX64
range to declare new variable between sentences, I think it
should be put in the beginning of function.
Regards
Bibo Mao
+for (int cpu = 0; cpu < ms->smp.cpus; cpu++) {
+cpu_state = qemu_get_cpu(cpu);
+cpudev = DEVICE(cpu_state);
+
GARCH_AVEC(opaque);
+uint64_t msg_addr = addr + VIRT_AVEC_BASE;
+cpu_num = FIELD_EX64(msg_addr, MSG_ADDR, CPU_NUM);
Here is physical cpuid rather than logic cpu index. We need convert
physical cpuid to logic cpu index.
Regards
Bibo Mao
+irq_num = FIELD_EX64(msg_addr, MSG_ADDR, IRQ_NUM
VMSTATE_UINT64_ARRAY(env.CSR_MSGIS, LoongArchCPU, 4),
ditto, it will be better if there is macro replaced with 4.
Regards
Bibo Mao
+VMSTATE_UINT64(env.CSR_MSGIR, LoongArchCPU),
+VMSTATE_UINT64(env.CSR_MSGIE, LoongArchCPU),
+VMSTATE_END_OF_LIST()
+},
+};
+
static co
val;
addr = malloc(100);
*(int *)addr = 1;
addr1 = 0xULL + addr;
val = *(int *)addr1;
printf("val %d \n", val);
}
Cc: qemu-sta...@nongnu.org
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c | 4 ++--
1 file changed, 2
The following changes since commit df6fe2abf2e990f767ce755d426bc439c7bba336:
Merge tag 'pull-target-arm-20250704' of https://gitlab.com/pm215/qemu into
staging (2025-07-07 09:22:41 -0400)
are available in the Git repository at:
https://github.com/bibo-mao/qemu.git tags/pull
unnecessary in tlb entry fill path.
Signed-off-by: Bibo Mao
Reviewed-by: Song Gao
---
target/loongarch/tcg/tlb_helper.c | 27 ++-
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index
Memory about LoongArchExtIOICommonState::cpu is allocated in common
code, it had better be freed in common code also.
Signed-off-by: Bibo Mao
Reviewed-by: Song Gao
---
hw/intc/loongarch_extioi.c| 9 -
hw/intc/loongarch_extioi_common.c | 9 +
include/hw
Function helper_csrwr_stlbps() is emulation with CSR STLBPS register
write operation. However there is only parameter checking action, and
no register updating action. Here update value of CSR_STLBPS when
parameter passes to check.
Signed-off-by: Bibo Mao
Reviewed-by: Song Gao
---
target
There is small typo issue in function helper_csrwr_pwcl(), this patch
corrects this issue.
Signed-off-by: Bibo Mao
Reviewed-by: Song Gao
---
target/loongarch/tcg/csr_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/loongarch/tcg/csr_helper.c
b/target
On 2025/7/10 下午8:43, Stefan Hajnoczi wrote:
On Thu, Jul 10, 2025 at 5:34 AM Bibo Mao wrote:
The following changes since commit df6fe2abf2e990f767ce755d426bc439c7bba336:
Merge tag 'pull-target-arm-20250704' of https://gitlab.com/pm215/qemu into
staging (2025-07-07 09:22:41 -
Function helper_csrwr_stlbps() is emulation with CSR STLBPS register
write operation. However there is only parameter checking action, and
no register updating action. Here update value of CSR_STLBPS when
parameter passes to check.
Signed-off-by: Bibo Mao
Reviewed-by: Song Gao
---
target
The following changes since commit df6fe2abf2e990f767ce755d426bc439c7bba336:
Merge tag 'pull-target-arm-20250704' of https://gitlab.com/pm215/qemu into
staging (2025-07-07 09:22:41 -0400)
are available in the Git repository at:
https://github.com/bibo-mao/qemu.git tags/pull
unnecessary in tlb entry fill path.
Signed-off-by: Bibo Mao
Reviewed-by: Song Gao
---
target/loongarch/tcg/tlb_helper.c | 24
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg/tlb_helper.c
index dc48b0f4d2
Memory about LoongArchExtIOICommonState::cpu is allocated in common
code, it had better be freed in common code also.
Signed-off-by: Bibo Mao
Reviewed-by: Song Gao
---
hw/intc/loongarch_extioi.c| 9 -
hw/intc/loongarch_extioi_common.c | 9 +
include/hw
There is small typo issue in function helper_csrwr_pwcl(), this patch
corrects this issue.
Signed-off-by: Bibo Mao
Reviewed-by: Song Gao
---
target/loongarch/tcg/csr_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/loongarch/tcg/csr_helper.c
b/target
irq = -1;
How about irq = BIT(31), the other bits keeps zero except bit 31?
Regards
Bibo Mao
+}
+
+return irq;
+}
+
target_ulong helper_csrwr_estat(CPULoongArchState *env, target_ulong val)
{
int64_t old_v = env->CSR_ESTAT;
diff --git a/target/loongarch/tcg/helper.h b/targe
+}
+
if (kvm_enabled()) {
kvm_loongarch_set_interrupt(cpu, irq, level);
} else if (tcg_enabled()) {
modification estat should be put here.
Regards
Bibo Mao
num / 64]);
+qemu_set_irq(s->cpu[cpu_num].parent_irq, 1);
+}
+qemu_set_irq(s->cpu[cpu_num].parent_irq, level);
There is double function call with qemu_set_irq().
Regards
Bibo Mao
+}
+
static void loongarch_avec_mem_write(void *opaque, hwaddr addr,
be renamed as virt_has_avecintc()?
Regards
Bibo Mao
+ret |= BIT(IOCSRF_AVEC);
+}
if (kvm_enabled()) {
ret |= BIT(IOCSRF_VM);
}
@@ -624,6 +631,10 @@ static MemTxResult virt_iocsr_misc_read(void *opaque,
hwaddr addr,
if (
re & BIT(IOCSRF_AVEC))) {
+return false;
+}
There had better be one empty line, however it is up to you since I am
not good at coding style.
Regards
Bibo Mao
+return true;
+}
+
static inline bool virt_is_veiointc_enabled(LoongArchVirtMachineState *lvms)
{
if (lvms->veiointc == ON_OFF_AUTO_OFF) {
e, %s/dfine/define/
"move some machine dfine to virt.h"
otherwise look good to me.
Reviewed-by: Bibo Mao
-by: Bibo Mao
---
target/loongarch/cpu.c | 180 -
target/loongarch/cpu.h | 2 -
2 files changed, 90 insertions(+), 92 deletions(-)
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index abad84c054..b96429ffb1 100644
--- a/target/loongarch
entries, even with
STLB, it is convenient with TLB maintainance operation.
Signed-off-by: Bibo Mao
---
target/loongarch/tcg/tlb_helper.c | 41 ---
1 file changed, 10 insertions(+), 31 deletions(-)
diff --git a/target/loongarch/tcg/tlb_helper.c
b/target/loongarch/tcg
New header file cpu-mmu.h is added and move mmu relative function
declaration to this file.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 30 ++
target/loongarch/cpu.c| 1 +
target/loongarch/cpu_helper.c | 1 +
target/loongarch
Function loongarch_check_pte() can get physical address and access
priviledge, it works on both TLB entry and pte entry. It can be used
at page table walking.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu_helper.c | 35 ++-
1 file changed, 10 insertions(+), 25
table walk emluation in future.
Bibo Mao (6):
target/loongarch: Move some function definition to kvm directory
target/loongarch: Define function loongarch_cpu_post_init as static
target/loongarch: Set page size in TLB misc with STLB
target/loongarch: Add header file cpu-mmu.h
target
Common function loongarch_check_pte() is to check tlb entry, return
the physical address and access priviledge. Also it can be used with
page table entry, which is used in page table walker.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 9 +
target/loongarch/cpu_helper.c
Move function definition specified with kvm to the corresponding
directory. Also remove header file "cpu.h" including outside of
macro QEMU_KVM_LOONGARCH_H.
Signed-off-by: Bibo Mao
---
hw/loongarch/virt.c | 1 +
target/loongarch/cpu.h | 9 ---
New header file cpu-mmu.h is added and move mmu relative function
declaration to this file.
Signed-off-by: Bibo Mao
---
target/loongarch/cpu-mmu.h| 30 ++
target/loongarch/cpu.c| 1 +
target/loongarch/cpu_helper.c | 1 +
target/loongarch
table walk emluation in future.
Bibo Mao (6):
target/loongarch: Move some function definition to kvm directory
target/loongarch: Define function loongarch_cpu_post_init as static
target/loongarch: Set page size in TLB misc with STLB
target/loongarch: Add header file cpu-mmu.h
target
On 2025/7/7 下午2:36, lixianglai wrote:
Hi Bibo Mao:
On 2025/6/13 上午9:31, Xianglai Li wrote:
The expire time is sent to the timer only
when the expire Time is greater than 0 or
greater than now. Otherwise, the timer
will trigger interruption continuously.
Timer interrupts are sent using
On 2025/7/2 下午3:21, gaosong wrote:
在 2025/7/2 上午11:15, Bibo Mao 写道:
On 2025/6/27 上午11:01, Song Gao wrote:
Implement avec set irq and update CSR_MSIS and CSR_MSGIR.
Signed-off-by: Song Gao
---
hw/intc/loongarch_avec.c | 44 ++--
1 file changed, 42
On 2025/7/2 下午3:10, gaosong wrote:
在 2025/7/2 上午10:03, Bibo Mao 写道:
On 2025/6/27 上午11:01, Song Gao wrote:
LoongArchVirtMachinState adds avecintc features, and
it use to check whether virt machine support advance interrupt
controller
and default set avecintc = ON_OFF_AUTO_ON
1 - 100 of 949 matches
Mail list logo