@@ -416,6 +416,13 @@ Reads the general purpose registers from the vcpu.
416
416
__u64 pc;
417
417
};
418
418
419
+ /* LoongArch */
420
+ struct kvm_regs {
421
+ /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
422
+ unsigned long gpr[32];
423
+ unsigned long pc;
424
+ };
425
+
419
426
420
427
4.12 KVM_SET_REGS
421
428
-----------------
@@ -506,7 +513,7 @@ translation mode.
506
513
------------------
507
514
508
515
:Capability: basic
509
- :Architectures: x86, ppc, mips, riscv
516
+ :Architectures: x86, ppc, mips, riscv, loongarch
510
517
:Type: vcpu ioctl
511
518
:Parameters: struct kvm_interrupt (in)
512
519
:Returns: 0 on success, negative on failure.
@@ -592,6 +599,14 @@ b) KVM_INTERRUPT_UNSET
592
599
593
600
This is an asynchronous vcpu ioctl and can be invoked from any thread.
594
601
602
+ LOONGARCH:
603
+ ^^^^^^^^^^
604
+
605
+ Queues an external interrupt to be injected into the virtual CPU. A negative
606
+ interrupt number dequeues the interrupt.
607
+
608
+ This is an asynchronous vcpu ioctl and can be invoked from any thread.
609
+
595
610
596
611
4.17 KVM_DEBUG_GUEST
597
612
--------------------
@@ -737,7 +752,7 @@ signal mask.
737
752
----------------
738
753
739
754
:Capability: basic
740
- :Architectures: x86
755
+ :Architectures: x86, loongarch
741
756
:Type: vcpu ioctl
742
757
:Parameters: struct kvm_fpu (out)
743
758
:Returns: 0 on success, -1 on error
@@ -746,7 +761,7 @@ Reads the floating point state from the vcpu.
746
761
747
762
::
748
763
749
- /* for KVM_GET_FPU and KVM_SET_FPU */
764
+ /* x86: for KVM_GET_FPU and KVM_SET_FPU */
750
765
struct kvm_fpu {
751
766
__u8 fpr[8][16];
752
767
__u16 fcw;
@@ -761,12 +776,21 @@ Reads the floating point state from the vcpu.
761
776
__u32 pad2;
762
777
};
763
778
779
+ /* LoongArch: for KVM_GET_FPU and KVM_SET_FPU */
780
+ struct kvm_fpu {
781
+ __u32 fcsr;
782
+ __u64 fcc;
783
+ struct kvm_fpureg {
784
+ __u64 val64[4];
785
+ }fpr[32];
786
+ };
787
+
764
788
765
789
4.23 KVM_SET_FPU
766
790
----------------
767
791
768
792
:Capability: basic
769
- :Architectures: x86
793
+ :Architectures: x86, loongarch
770
794
:Type: vcpu ioctl
771
795
:Parameters: struct kvm_fpu (in)
772
796
:Returns: 0 on success, -1 on error
@@ -775,7 +799,7 @@ Writes the floating point state to the vcpu.
775
799
776
800
::
777
801
778
- /* for KVM_GET_FPU and KVM_SET_FPU */
802
+ /* x86: for KVM_GET_FPU and KVM_SET_FPU */
779
803
struct kvm_fpu {
780
804
__u8 fpr[8][16];
781
805
__u16 fcw;
@@ -790,6 +814,15 @@ Writes the floating point state to the vcpu.
790
814
__u32 pad2;
791
815
};
792
816
817
+ /* LoongArch: for KVM_GET_FPU and KVM_SET_FPU */
818
+ struct kvm_fpu {
819
+ __u32 fcsr;
820
+ __u64 fcc;
821
+ struct kvm_fpureg {
822
+ __u64 val64[4];
823
+ }fpr[32];
824
+ };
825
+
793
826
794
827
4.24 KVM_CREATE_IRQCHIP
795
828
-----------------------
@@ -1387,7 +1420,7 @@ documentation when it pops into existence).
1387
1420
-------------------
1388
1421
1389
1422
:Capability: KVM_CAP_ENABLE_CAP
1390
- :Architectures: mips, ppc, s390, x86
1423
+ :Architectures: mips, ppc, s390, x86, loongarch
1391
1424
:Type: vcpu ioctl
1392
1425
:Parameters: struct kvm_enable_cap (in)
1393
1426
:Returns: 0 on success; -1 on error
@@ -1442,7 +1475,7 @@ for vm-wide capabilities.
1442
1475
---------------------
1443
1476
1444
1477
:Capability: KVM_CAP_MP_STATE
1445
- :Architectures: x86, s390, arm64, riscv
1478
+ :Architectures: x86, s390, arm64, riscv, loongarch
1446
1479
:Type: vcpu ioctl
1447
1480
:Parameters: struct kvm_mp_state (out)
1448
1481
:Returns: 0 on success; -1 on error
@@ -1460,7 +1493,7 @@ Possible values are:
1460
1493
1461
1494
========================== ===============================================
1462
1495
KVM_MP_STATE_RUNNABLE the vcpu is currently running
1463
- [x86,arm64,riscv]
1496
+ [x86,arm64,riscv,loongarch ]
1464
1497
KVM_MP_STATE_UNINITIALIZED the vcpu is an application processor (AP)
1465
1498
which has not yet received an INIT signal [x86]
1466
1499
KVM_MP_STATE_INIT_RECEIVED the vcpu has received an INIT signal, and is
@@ -1516,11 +1549,14 @@ For riscv:
1516
1549
The only states that are valid are KVM_MP_STATE_STOPPED and
1517
1550
KVM_MP_STATE_RUNNABLE which reflect if the vcpu is paused or not.
1518
1551
1552
+ On LoongArch, only the KVM_MP_STATE_RUNNABLE state is used to reflect
1553
+ whether the vcpu is runnable.
1554
+
1519
1555
4.39 KVM_SET_MP_STATE
1520
1556
---------------------
1521
1557
1522
1558
:Capability: KVM_CAP_MP_STATE
1523
- :Architectures: x86, s390, arm64, riscv
1559
+ :Architectures: x86, s390, arm64, riscv, loongarch
1524
1560
:Type: vcpu ioctl
1525
1561
:Parameters: struct kvm_mp_state (in)
1526
1562
:Returns: 0 on success; -1 on error
@@ -1538,6 +1574,9 @@ For arm64/riscv:
1538
1574
The only states that are valid are KVM_MP_STATE_STOPPED and
1539
1575
KVM_MP_STATE_RUNNABLE which reflect if the vcpu should be paused or not.
1540
1576
1577
+ On LoongArch, only the KVM_MP_STATE_RUNNABLE state is used to reflect
1578
+ whether the vcpu is runnable.
1579
+
1541
1580
4.40 KVM_SET_IDENTITY_MAP_ADDR
1542
1581
------------------------------
1543
1582
@@ -2841,6 +2880,19 @@ Following are the RISC-V D-extension registers:
2841
2880
0x8020 0000 0600 0020 fcsr Floating point control and status register
2842
2881
======================= ========= =============================================
2843
2882
2883
+ LoongArch registers are mapped using the lower 32 bits. The upper 16 bits of
2884
+ that is the register group type.
2885
+
2886
+ LoongArch csr registers are used to control guest cpu or get status of guest
2887
+ cpu, and they have the following id bit patterns::
2888
+
2889
+ 0x9030 0000 0001 00 <reg:5> <sel:3> (64-bit)
2890
+
2891
+ LoongArch KVM control registers are used to implement some new defined functions
2892
+ such as set vcpu counter or reset vcpu, and they have the following id bit patterns::
2893
+
2894
+ 0x9030 0000 0002 <reg:16>
2895
+
2844
2896
2845
2897
4.69 KVM_GET_ONE_REG
2846
2898
--------------------
0 commit comments