qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] loongarch-to-apply queue
@ 2023-04-04 11:38 Song Gao
  2023-04-04 16:01 ` Peter Maydell
  0 siblings, 1 reply; 20+ messages in thread
From: Song Gao @ 2023-04-04 11:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, richard.henderson

The following changes since commit efcd0ec14b0fe9ee0ee70277763b2d538d19238d:

  Merge tag 'misc-fixes-20230330' of https://github.com/philmd/qemu into staging (2023-03-30 14:22:29 +0100)

are available in the Git repository at:

  https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20230404

for you to fetch changes up to ec28dd6c6fc1366504003c25828953cac49e2da7:

  target/loongarch: Enables plugins to get instruction codes (2023-04-04 19:33:23 +0800)

----------------------------------------------------------------
pull-loongarch-20230404

----------------------------------------------------------------
Tianrui Zhao (1):
      hw/loongarch/virt: Fix virt_to_phys_addr function

tanhongze (1):
      target/loongarch: Enables plugins to get instruction codes

 hw/loongarch/virt.c          | 2 +-
 target/loongarch/translate.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL 0/2] loongarch-to-apply queue
  2023-04-04 11:38 Song Gao
@ 2023-04-04 16:01 ` Peter Maydell
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2023-04-04 16:01 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel, richard.henderson

On Tue, 4 Apr 2023 at 12:38, Song Gao <gaosong@loongson.cn> wrote:
>
> The following changes since commit efcd0ec14b0fe9ee0ee70277763b2d538d19238d:
>
>   Merge tag 'misc-fixes-20230330' of https://github.com/philmd/qemu into staging (2023-03-30 14:22:29 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20230404
>
> for you to fetch changes up to ec28dd6c6fc1366504003c25828953cac49e2da7:
>
>   target/loongarch: Enables plugins to get instruction codes (2023-04-04 19:33:23 +0800)
>
> ----------------------------------------------------------------
> pull-loongarch-20230404
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2023-05-26  9:27 Song Gao
  2023-05-26 16:17 ` Richard Henderson
  0 siblings, 1 reply; 20+ messages in thread
From: Song Gao @ 2023-05-26  9:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

The following changes since commit a3cb6d5004ff638aefe686ecd540718a793bd1b1:

  Merge tag 'pull-tcg-20230525' of https://gitlab.com/rth7680/qemu into staging (2023-05-25 11:11:52 -0700)

are available in the Git repository at:

  https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20230526

for you to fetch changes up to 65bfaaae6ac79ebc623acc0ce28cc3bd4fe8b5e5:

  target/loongarch: Fix the vinsgr2vr/vpickve2gr instructions cause system coredump (2023-05-26 17:21:16 +0800)

----------------------------------------------------------------
pull-loongarch-20230526

----------------------------------------------------------------
Song Gao (2):
      target/loongarch: Fix LD/ST{LE/GT} instructions get wrong CSR_ERA and CSR_BADV
      target/loongarch: Fix the vinsgr2vr/vpickve2gr instructions cause system coredump

 target/loongarch/cpu.c                      |  2 +-
 target/loongarch/insn_trans/trans_lsx.c.inc | 39 +++++++++++++++++++----------
 target/loongarch/op_helper.c                |  6 +++--
 3 files changed, 31 insertions(+), 16 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL 0/2] loongarch-to-apply queue
  2023-05-26  9:27 Song Gao
@ 2023-05-26 16:17 ` Richard Henderson
  0 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2023-05-26 16:17 UTC (permalink / raw)
  To: Song Gao, qemu-devel

On 5/26/23 02:27, Song Gao wrote:
> The following changes since commit a3cb6d5004ff638aefe686ecd540718a793bd1b1:
> 
>    Merge tag 'pull-tcg-20230525' ofhttps://gitlab.com/rth7680/qemu  into staging (2023-05-25 11:11:52 -0700)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/gaosong/qemu.git  tags/pull-loongarch-20230526
> 
> for you to fetch changes up to 65bfaaae6ac79ebc623acc0ce28cc3bd4fe8b5e5:
> 
>    target/loongarch: Fix the vinsgr2vr/vpickve2gr instructions cause system coredump (2023-05-26 17:21:16 +0800)
> 
> ----------------------------------------------------------------
> pull-loongarch-20230526

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as appropriate.


r~



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2023-10-08  7:03 Song Gao
  0 siblings, 0 replies; 20+ messages in thread
From: Song Gao @ 2023-10-08  7:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

The following changes since commit 2f3913f4b2ad74baeb5a6f1d36efbd9ecdf1057d:

  Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging (2023-10-05 09:01:01 -0400)

are available in the Git repository at:

  https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20231008

for you to fetch changes up to e1fc0cf1fb65c5f049bef4661d0e3278e51e2560:

  target/loongarch: Add preldx instruction (2023-10-08 15:02:15 +0800)

----------------------------------------------------------------
pull-loongarch-20231008

----------------------------------------------------------------
Jiajie Chen (1):
      target/loongarch: fix ASXE flag conflict

Song Gao (1):
      target/loongarch: Add preldx instruction

 target/loongarch/cpu.h                         | 4 ++--
 target/loongarch/disas.c                       | 7 +++++++
 target/loongarch/insn_trans/trans_memory.c.inc | 5 +++++
 target/loongarch/insns.decode                  | 3 +++
 4 files changed, 17 insertions(+), 2 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2023-12-21  8:06 Song Gao
  2023-12-22 16:17 ` Stefan Hajnoczi
  0 siblings, 1 reply; 20+ messages in thread
From: Song Gao @ 2023-12-21  8:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, peter.maydell, richard.henderson

The following changes since commit 191710c221f65b1542f6ea7fa4d30dde6e134fd7:

  Merge tag 'pull-request-2023-12-20' of https://gitlab.com/thuth/qemu into staging (2023-12-20 09:40:16 -0500)

are available in the Git repository at:

  https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20231221

for you to fetch changes up to be45144bee708d3b84c3c474a4d4aeb7e5c4733a:

  target/loongarch: Add timer information dump support (2023-12-21 16:07:47 +0800)

----------------------------------------------------------------
pull-loongarch-20231221

----------------------------------------------------------------
Bibo Mao (2):
      hw/loongarch/virt: Align high memory base address with super page size
      target/loongarch: Add timer information dump support

 include/hw/loongarch/virt.h | 2 +-
 target/loongarch/cpu.c      | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL 0/2] loongarch-to-apply queue
  2023-12-21  8:06 Song Gao
@ 2023-12-22 16:17 ` Stefan Hajnoczi
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Hajnoczi @ 2023-12-22 16:17 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel, stefanha, peter.maydell, richard.henderson

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2024-01-05  1:17 Song Gao
  2024-01-05 13:34 ` Peter Maydell
  0 siblings, 1 reply; 20+ messages in thread
From: Song Gao @ 2024-01-05  1:17 UTC (permalink / raw)
  To: peter.maydell; +Cc: qemu-devel

The following changes since commit d328fef93ae757a0dd65ed786a4086e27952eef3:

  Merge tag 'pull-20231230' of https://gitlab.com/rth7680/qemu into staging (2024-01-04 10:23:34 +0000)

are available in the Git repository at:

  https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240105

for you to fetch changes up to 0cd8b379081fa71c23836052feb65da4685f8ec7:

  target/loongarch: move translate modules to tcg/ (2024-01-05 09:31:05 +0800)

----------------------------------------------------------------
pull-loongarch-20240105

----------------------------------------------------------------
Song Gao (2):
      target/loongarch/meson: move gdbstub.c to loongarch.ss
      target/loongarch: move translate modules to tcg/

 target/loongarch/meson.build                          | 15 +--------------
 target/loongarch/{ => tcg}/constant_timer.c           |  0
 target/loongarch/{ => tcg}/csr_helper.c               |  0
 target/loongarch/{ => tcg}/fpu_helper.c               |  0
 .../loongarch/{ => tcg}/insn_trans/trans_arith.c.inc  |  0
 .../loongarch/{ => tcg}/insn_trans/trans_atomic.c.inc |  0
 target/loongarch/{ => tcg}/insn_trans/trans_bit.c.inc |  0
 .../loongarch/{ => tcg}/insn_trans/trans_branch.c.inc |  0
 .../loongarch/{ => tcg}/insn_trans/trans_extra.c.inc  |  0
 .../loongarch/{ => tcg}/insn_trans/trans_farith.c.inc |  0
 .../loongarch/{ => tcg}/insn_trans/trans_fcmp.c.inc   |  0
 .../loongarch/{ => tcg}/insn_trans/trans_fcnv.c.inc   |  0
 .../{ => tcg}/insn_trans/trans_fmemory.c.inc          |  0
 .../loongarch/{ => tcg}/insn_trans/trans_fmov.c.inc   |  0
 .../loongarch/{ => tcg}/insn_trans/trans_memory.c.inc |  0
 .../{ => tcg}/insn_trans/trans_privileged.c.inc       |  0
 .../loongarch/{ => tcg}/insn_trans/trans_shift.c.inc  |  0
 target/loongarch/{ => tcg}/insn_trans/trans_vec.c.inc |  0
 target/loongarch/{ => tcg}/iocsr_helper.c             |  0
 target/loongarch/tcg/meson.build                      | 19 +++++++++++++++++++
 target/loongarch/{ => tcg}/op_helper.c                |  0
 target/loongarch/{ => tcg}/tlb_helper.c               |  0
 target/loongarch/{ => tcg}/translate.c                |  0
 target/loongarch/{ => tcg}/vec_helper.c               |  0
 24 files changed, 20 insertions(+), 14 deletions(-)
 rename target/loongarch/{ => tcg}/constant_timer.c (100%)
 rename target/loongarch/{ => tcg}/csr_helper.c (100%)
 rename target/loongarch/{ => tcg}/fpu_helper.c (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_arith.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_atomic.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_bit.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_branch.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_extra.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_farith.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_fcmp.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_fcnv.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_fmemory.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_fmov.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_memory.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_privileged.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_shift.c.inc (100%)
 rename target/loongarch/{ => tcg}/insn_trans/trans_vec.c.inc (100%)
 rename target/loongarch/{ => tcg}/iocsr_helper.c (100%)
 create mode 100644 target/loongarch/tcg/meson.build
 rename target/loongarch/{ => tcg}/op_helper.c (100%)
 rename target/loongarch/{ => tcg}/tlb_helper.c (100%)
 rename target/loongarch/{ => tcg}/translate.c (100%)
 rename target/loongarch/{ => tcg}/vec_helper.c (100%)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL 0/2] loongarch-to-apply queue
  2024-01-05  1:17 Song Gao
@ 2024-01-05 13:34 ` Peter Maydell
  2024-01-06  1:18   ` gaosong
  0 siblings, 1 reply; 20+ messages in thread
From: Peter Maydell @ 2024-01-05 13:34 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel

On Fri, 5 Jan 2024 at 01:30, Song Gao <gaosong@loongson.cn> wrote:
>
> The following changes since commit d328fef93ae757a0dd65ed786a4086e27952eef3:
>
>   Merge tag 'pull-20231230' of https://gitlab.com/rth7680/qemu into staging (2024-01-04 10:23:34 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240105
>
> for you to fetch changes up to 0cd8b379081fa71c23836052feb65da4685f8ec7:
>
>   target/loongarch: move translate modules to tcg/ (2024-01-05 09:31:05 +0800)
>
> ----------------------------------------------------------------
> pull-loongarch-20240105
>
> ----------------------------------------------------------------
> Song Gao (2):
>       target/loongarch/meson: move gdbstub.c to loongarch.ss
>       target/loongarch: move translate modules to tcg/

Hi; this fails to build, with

../target/loongarch/tcg/meson.build:1:3: ERROR: Unknown variable "config_all".

(eg https://gitlab.com/qemu-project/qemu/-/jobs/5868662017)

I think your pullreq has unfortunately got a conflict with the
meson cleanup patches that I just applied from Paolo.

Could you have a look at this and respin the pullreq, please?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL 0/2] loongarch-to-apply queue
  2024-01-05 13:34 ` Peter Maydell
@ 2024-01-06  1:18   ` gaosong
  0 siblings, 0 replies; 20+ messages in thread
From: gaosong @ 2024-01-06  1:18 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

在 2024/1/5 下午9:34, Peter Maydell 写道:
> On Fri, 5 Jan 2024 at 01:30, Song Gao <gaosong@loongson.cn> wrote:
>> The following changes since commit d328fef93ae757a0dd65ed786a4086e27952eef3:
>>
>>    Merge tag 'pull-20231230' of https://gitlab.com/rth7680/qemu into staging (2024-01-04 10:23:34 +0000)
>>
>> are available in the Git repository at:
>>
>>    https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240105
>>
>> for you to fetch changes up to 0cd8b379081fa71c23836052feb65da4685f8ec7:
>>
>>    target/loongarch: move translate modules to tcg/ (2024-01-05 09:31:05 +0800)
>>
>> ----------------------------------------------------------------
>> pull-loongarch-20240105
>>
>> ----------------------------------------------------------------
>> Song Gao (2):
>>        target/loongarch/meson: move gdbstub.c to loongarch.ss
>>        target/loongarch: move translate modules to tcg/
> Hi; this fails to build, with
>
> ../target/loongarch/tcg/meson.build:1:3: ERROR: Unknown variable "config_all".
>
> (eg https://gitlab.com/qemu-project/qemu/-/jobs/5868662017)
>
> I think your pullreq has unfortunately got a conflict with the
> meson cleanup patches that I just applied from Paolo.
>
> Could you have a look at this and respin the pullreq, please?
Sure, I will.

Thanks.
Song Gao.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2024-01-25  7:13 Song Gao
  0 siblings, 0 replies; 20+ messages in thread
From: Song Gao @ 2024-01-25  7:13 UTC (permalink / raw)
  Cc: qemu-devel, peter.maydell

The following changes since commit 4a4efae44f19528589204581e9e2fab69c5d39aa:

  Merge tag 'pull-hex-20240121' of https://github.com/quic/qemu into staging (2024-01-23 13:40:45 +0000)

are available in the Git repository at:

  https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240125

for you to fetch changes up to fc70099621fe7002d30fc1509456d1ae57264aa6:

  target/loongarch/kvm: Enable LSX/LASX extension (2024-01-25 15:25:31 +0800)

----------------------------------------------------------------
pull-loongarch-20240125

----------------------------------------------------------------
Bibo Mao (1):
      target/loongarch: Set cpuid CSR register only once with kvm mode

Song Gao (1):
      target/loongarch/kvm: Enable LSX/LASX extension

 linux-headers/asm-loongarch/kvm.h |  1 +
 target/loongarch/kvm/kvm.c        | 54 +++++++++++++++++++++++++++++++--------
 2 files changed, 45 insertions(+), 10 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2024-01-25  7:15 Song Gao
  0 siblings, 0 replies; 20+ messages in thread
From: Song Gao @ 2024-01-25  7:15 UTC (permalink / raw)
  Cc: qemu-devel, peter.maydell

The following changes since commit 4a4efae44f19528589204581e9e2fab69c5d39aa:

  Merge tag 'pull-hex-20240121' of https://github.com/quic/qemu into staging (2024-01-23 13:40:45 +0000)

are available in the Git repository at:

  https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240125

for you to fetch changes up to fc70099621fe7002d30fc1509456d1ae57264aa6:

  target/loongarch/kvm: Enable LSX/LASX extension (2024-01-25 15:25:31 +0800)

----------------------------------------------------------------
pull-loongarch-20240125

----------------------------------------------------------------
Bibo Mao (1):
      target/loongarch: Set cpuid CSR register only once with kvm mode

Song Gao (1):
      target/loongarch/kvm: Enable LSX/LASX extension

 linux-headers/asm-loongarch/kvm.h |  1 +
 target/loongarch/kvm/kvm.c        | 54 +++++++++++++++++++++++++++++++--------
 2 files changed, 45 insertions(+), 10 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2024-01-25  7:15 Song Gao
  2024-01-25  7:15 ` [PULL 1/2] target/loongarch: Set cpuid CSR register only once with kvm mode Song Gao
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Song Gao @ 2024-01-25  7:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

The following changes since commit 4a4efae44f19528589204581e9e2fab69c5d39aa:

  Merge tag 'pull-hex-20240121' of https://github.com/quic/qemu into staging (2024-01-23 13:40:45 +0000)

are available in the Git repository at:

  https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240125

for you to fetch changes up to fc70099621fe7002d30fc1509456d1ae57264aa6:

  target/loongarch/kvm: Enable LSX/LASX extension (2024-01-25 15:25:31 +0800)

----------------------------------------------------------------
pull-loongarch-20240125

----------------------------------------------------------------
Bibo Mao (1):
      target/loongarch: Set cpuid CSR register only once with kvm mode

Song Gao (1):
      target/loongarch/kvm: Enable LSX/LASX extension

 linux-headers/asm-loongarch/kvm.h |  1 +
 target/loongarch/kvm/kvm.c        | 54 +++++++++++++++++++++++++++++++--------
 2 files changed, 45 insertions(+), 10 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 1/2] target/loongarch: Set cpuid CSR register only once with kvm mode
  2024-01-25  7:15 [PULL 0/2] loongarch-to-apply queue Song Gao
@ 2024-01-25  7:15 ` Song Gao
  2024-01-25  7:15 ` [PULL 2/2] target/loongarch/kvm: Enable LSX/LASX extension Song Gao
  2024-01-26 13:09 ` [PULL 0/2] loongarch-to-apply queue Peter Maydell
  2 siblings, 0 replies; 20+ messages in thread
From: Song Gao @ 2024-01-25  7:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Bibo Mao

From: Bibo Mao <maobibo@loongson.cn>

CSR cpuid register is used for routing irq to different vcpus, its
value is kept unchanged since poweron. So it is not necessary to
set CSR cpuid register after system resets, and it is only set at
vm creation stage.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20240115085121.180524-1-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
 target/loongarch/kvm/kvm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index 84bcdf5f86..2230f029d0 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -250,7 +250,7 @@ static int kvm_loongarch_get_csr(CPUState *cs)
     return ret;
 }
 
-static int kvm_loongarch_put_csr(CPUState *cs)
+static int kvm_loongarch_put_csr(CPUState *cs, int level)
 {
     int ret = 0;
     LoongArchCPU *cpu = LOONGARCH_CPU(cs);
@@ -322,8 +322,11 @@ static int kvm_loongarch_put_csr(CPUState *cs)
     ret |= kvm_set_one_reg(cs, KVM_IOC_CSRID(LOONGARCH_CSR_RVACFG),
                            &env->CSR_RVACFG);
 
-    ret |= kvm_set_one_reg(cs, KVM_IOC_CSRID(LOONGARCH_CSR_CPUID),
+    /* CPUID is constant after poweron, it should be set only once */
+    if (level >= KVM_PUT_FULL_STATE) {
+        ret |= kvm_set_one_reg(cs, KVM_IOC_CSRID(LOONGARCH_CSR_CPUID),
                            &env->CSR_CPUID);
+    }
 
     ret |= kvm_set_one_reg(cs, KVM_IOC_CSRID(LOONGARCH_CSR_PRCFG1),
                            &env->CSR_PRCFG1);
@@ -598,7 +601,7 @@ int kvm_arch_put_registers(CPUState *cs, int level)
         return ret;
     }
 
-    ret = kvm_loongarch_put_csr(cs);
+    ret = kvm_loongarch_put_csr(cs, level);
     if (ret) {
         return ret;
     }
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PULL 2/2] target/loongarch/kvm: Enable LSX/LASX extension
  2024-01-25  7:15 [PULL 0/2] loongarch-to-apply queue Song Gao
  2024-01-25  7:15 ` [PULL 1/2] target/loongarch: Set cpuid CSR register only once with kvm mode Song Gao
@ 2024-01-25  7:15 ` Song Gao
  2024-01-26 13:09 ` [PULL 0/2] loongarch-to-apply queue Peter Maydell
  2 siblings, 0 replies; 20+ messages in thread
From: Song Gao @ 2024-01-25  7:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Bibo Mao

The kernel had already support LSX and LASX [1],
but QEMU is disable LSX/LASX for kvm. This patch adds
kvm_check_cpucfg2() to check CPUCFG2.

[1]: https://lore.kernel.org/all/CABgObfZHRf7E_7Jk4uPRmSyxTy3EiuuYwHC35jQncNL9s-zTDA@mail.gmail.com/

Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Message-Id: <20240122090206.1083584-1-gaosong@loongson.cn>
---
 linux-headers/asm-loongarch/kvm.h |  1 +
 target/loongarch/kvm/kvm.c        | 45 ++++++++++++++++++++++++++-----
 2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/linux-headers/asm-loongarch/kvm.h b/linux-headers/asm-loongarch/kvm.h
index c6ad2ee610..923d0bd382 100644
--- a/linux-headers/asm-loongarch/kvm.h
+++ b/linux-headers/asm-loongarch/kvm.h
@@ -79,6 +79,7 @@ struct kvm_fpu {
 #define LOONGARCH_REG_64(TYPE, REG)	(TYPE | KVM_REG_SIZE_U64 | (REG << LOONGARCH_REG_SHIFT))
 #define KVM_IOC_CSRID(REG)		LOONGARCH_REG_64(KVM_REG_LOONGARCH_CSR, REG)
 #define KVM_IOC_CPUCFG(REG)		LOONGARCH_REG_64(KVM_REG_LOONGARCH_CPUCFG, REG)
+#define KVM_LOONGARCH_VCPU_CPUCFG	0
 
 struct kvm_debug_exit_arch {
 };
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index 2230f029d0..c19978a970 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -540,6 +540,38 @@ static int kvm_loongarch_get_cpucfg(CPUState *cs)
     return ret;
 }
 
+static int kvm_check_cpucfg2(CPUState *cs)
+{
+    int ret;
+    uint64_t val;
+    struct kvm_device_attr attr = {
+        .group = KVM_LOONGARCH_VCPU_CPUCFG,
+        .attr = 2,
+        .addr = (uint64_t)&val,
+    };
+    LoongArchCPU *cpu = LOONGARCH_CPU(cs);
+    CPULoongArchState *env = &cpu->env;
+
+    ret = kvm_vcpu_ioctl(cs, KVM_HAS_DEVICE_ATTR, &attr);
+
+    if (!ret) {
+        kvm_vcpu_ioctl(cs, KVM_GET_DEVICE_ATTR, &attr);
+        env->cpucfg[2] &= val;
+
+        if (FIELD_EX32(env->cpucfg[2], CPUCFG2, FP)) {
+            /* The FP minimal version is 1. */
+            env->cpucfg[2] = FIELD_DP32(env->cpucfg[2], CPUCFG2, FP_VER, 1);
+        }
+
+        if (FIELD_EX32(env->cpucfg[2], CPUCFG2, LLFTP)) {
+            /* The LLFTP minimal version is 1. */
+            env->cpucfg[2] = FIELD_DP32(env->cpucfg[2], CPUCFG2, LLFTP_VER, 1);
+        }
+    }
+
+    return ret;
+}
+
 static int kvm_loongarch_put_cpucfg(CPUState *cs)
 {
     int i, ret = 0;
@@ -548,14 +580,13 @@ static int kvm_loongarch_put_cpucfg(CPUState *cs)
     uint64_t val;
 
     for (i = 0; i < 21; i++) {
+	if (i == 2) {
+            ret = kvm_check_cpucfg2(cs);
+            if (ret) {
+                return ret;
+            }
+	}
         val = env->cpucfg[i];
-        /* LSX and LASX and LBT are not supported in kvm now */
-        if (i == 2) {
-            val &= ~(BIT(R_CPUCFG2_LSX_SHIFT) | BIT(R_CPUCFG2_LASX_SHIFT));
-            val &= ~(BIT(R_CPUCFG2_LBT_X86_SHIFT) |
-                     BIT(R_CPUCFG2_LBT_ARM_SHIFT) |
-                     BIT(R_CPUCFG2_LBT_MIPS_SHIFT));
-        }
         ret = kvm_set_one_reg(cs, KVM_IOC_CPUCFG(i), &val);
         if (ret < 0) {
             trace_kvm_failed_put_cpucfg(strerror(errno));
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PULL 0/2] loongarch-to-apply queue
  2024-01-25  7:15 [PULL 0/2] loongarch-to-apply queue Song Gao
  2024-01-25  7:15 ` [PULL 1/2] target/loongarch: Set cpuid CSR register only once with kvm mode Song Gao
  2024-01-25  7:15 ` [PULL 2/2] target/loongarch/kvm: Enable LSX/LASX extension Song Gao
@ 2024-01-26 13:09 ` Peter Maydell
  2 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2024-01-26 13:09 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel

On Thu, 25 Jan 2024 at 07:31, Song Gao <gaosong@loongson.cn> wrote:
>
> The following changes since commit 4a4efae44f19528589204581e9e2fab69c5d39aa:
>
>   Merge tag 'pull-hex-20240121' of https://github.com/quic/qemu into staging (2024-01-23 13:40:45 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/gaosong/qemu.git tags/pull-loongarch-20240125
>
> for you to fetch changes up to fc70099621fe7002d30fc1509456d1ae57264aa6:
>
>   target/loongarch/kvm: Enable LSX/LASX extension (2024-01-25 15:25:31 +0800)
>
> ----------------------------------------------------------------
> pull-loongarch-20240125
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/9.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2025-07-31  8:53 Song Gao
  2025-08-01 19:34 ` Stefan Hajnoczi
  0 siblings, 1 reply; 20+ messages in thread
From: Song Gao @ 2025-07-31  8:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, qemu-stable

The following changes since commit 4e06566dbd1b1251c2788af26a30bd148d4eb6c1:

  Merge tag 'pull-riscv-to-apply-20250730-2' of https://github.com/alistair23/qemu into staging (2025-07-30 09:59:30 -0400)

are available in the Git repository at:

  https://github.com/gaosong715/qemu.git tags/pull-loongarch-20250731

for you to fetch changes up to 31995cc4087123a13e9345153e0c39ffb44b9277:

  hw/intc/loongarch_ipi: Fix start fail with smp cpu < smp maxcpus on KVM (2025-07-31 16:57:01 +0800)

----------------------------------------------------------------
pull-loongarch-2025-0731-for-10.1

----------------------------------------------------------------
Bibo Mao (1):
      target/loongarch: Fix valid virtual address checking

Song Gao (1):
      hw/intc/loongarch_ipi: Fix start fail with smp cpu < smp maxcpus on KVM

 hw/intc/loongarch_ipi_kvm.c   | 27 ++++++++++++++++-----------
 target/loongarch/cpu_helper.c |  4 ++--
 2 files changed, 18 insertions(+), 13 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL 0/2] loongarch-to-apply queue
  2025-07-31  8:53 Song Gao
@ 2025-08-01 19:34 ` Stefan Hajnoczi
  0 siblings, 0 replies; 20+ messages in thread
From: Stefan Hajnoczi @ 2025-08-01 19:34 UTC (permalink / raw)
  To: Song Gao; +Cc: qemu-devel, stefanha, qemu-stable

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/10.1 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PULL 0/2] loongarch-to-apply queue
@ 2025-08-28 12:02 Song Gao
  2025-08-29  8:28 ` Richard Henderson
  0 siblings, 1 reply; 20+ messages in thread
From: Song Gao @ 2025-08-28 12:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

The following changes since commit ca18b336e12c8433177a3cd639c5bf757952adaa:

  Merge tag 'pull-lu-20250828' of https://gitlab.com/rth7680/qemu into staging (2025-08-28 09:24:36 +1000)

are available in the Git repository at:

  https://github.com/gaosong715/qemu.git tags/pull-loongarch-20250828

for you to fetch changes up to 86bca40402316891b8b9a920c2e3bf8cf37ba9a4:

  hw/intc/loongarch_pch_pic: Fix ubsan warning and endianness issue (2025-08-28 20:06:27 +0800)

----------------------------------------------------------------
pull-loongarch-20250828

----------------------------------------------------------------
Thomas Huth (1):
      hw/intc/loongarch_pch_pic: Fix ubsan warning and endianness issue

WANG Rui (1):
      target/loongarch: Guard 64-bit-only insn translation with TRANS64 macro

 hw/intc/loongarch_pch_pic.c                        | 15 ++++-----
 target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 36 +++++++++++-----------
 target/loongarch/tcg/insn_trans/trans_extra.c.inc  |  8 +++--
 target/loongarch/tcg/insn_trans/trans_farith.c.inc |  8 ++---
 target/loongarch/tcg/insn_trans/trans_fcnv.c.inc   |  4 +--
 .../loongarch/tcg/insn_trans/trans_fmemory.c.inc   | 16 +++++-----
 .../tcg/insn_trans/trans_privileged.c.inc          |  4 +--
 target/loongarch/tcg/insn_trans/trans_shift.c.inc  |  4 +--
 target/loongarch/translate.h                       |  4 +++
 9 files changed, 54 insertions(+), 45 deletions(-)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PULL 0/2] loongarch-to-apply queue
  2025-08-28 12:02 Song Gao
@ 2025-08-29  8:28 ` Richard Henderson
  0 siblings, 0 replies; 20+ messages in thread
From: Richard Henderson @ 2025-08-29  8:28 UTC (permalink / raw)
  To: qemu-devel

On 8/28/25 22:02, Song Gao wrote:
> The following changes since commit ca18b336e12c8433177a3cd639c5bf757952adaa:
> 
>    Merge tag 'pull-lu-20250828' of https://gitlab.com/rth7680/qemu into staging (2025-08-28 09:24:36 +1000)
> 
> are available in the Git repository at:
> 
>    https://github.com/gaosong715/qemu.git tags/pull-loongarch-20250828
> 
> for you to fetch changes up to 86bca40402316891b8b9a920c2e3bf8cf37ba9a4:
> 
>    hw/intc/loongarch_pch_pic: Fix ubsan warning and endianness issue (2025-08-28 20:06:27 +0800)
> 
> ----------------------------------------------------------------
> pull-loongarch-20250828


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.

r~



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2025-08-30 15:27 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-25  7:15 [PULL 0/2] loongarch-to-apply queue Song Gao
2024-01-25  7:15 ` [PULL 1/2] target/loongarch: Set cpuid CSR register only once with kvm mode Song Gao
2024-01-25  7:15 ` [PULL 2/2] target/loongarch/kvm: Enable LSX/LASX extension Song Gao
2024-01-26 13:09 ` [PULL 0/2] loongarch-to-apply queue Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2025-08-28 12:02 Song Gao
2025-08-29  8:28 ` Richard Henderson
2025-07-31  8:53 Song Gao
2025-08-01 19:34 ` Stefan Hajnoczi
2024-01-25  7:15 Song Gao
2024-01-25  7:13 Song Gao
2024-01-05  1:17 Song Gao
2024-01-05 13:34 ` Peter Maydell
2024-01-06  1:18   ` gaosong
2023-12-21  8:06 Song Gao
2023-12-22 16:17 ` Stefan Hajnoczi
2023-10-08  7:03 Song Gao
2023-05-26  9:27 Song Gao
2023-05-26 16:17 ` Richard Henderson
2023-04-04 11:38 Song Gao
2023-04-04 16:01 ` Peter Maydell

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).