Skip to content

Commit 55dfb8b

Browse files
Gautam Menghanimpe
authored andcommitted
KVM: PPC: Book3S HV nestedv2: Add DPDES support in helper library for Guest state buffer
Add support for using DPDES in the library for using guest state buffers. DPDES support is needed for enabling usage of doorbells in a L2 KVM on PAPR guest. Fixes: 6ccbbc3 ("KVM: PPC: Add helper library for Guest State Buffers") Cc: [email protected] # v6.7+ Signed-off-by: Gautam Menghani <[email protected]> Reviewed-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent e1f288d commit 55dfb8b

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

Documentation/arch/powerpc/kvm-nested.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,9 @@ table information.
546546
+--------+-------+----+--------+----------------------------------+
547547
| 0x1052 | 0x08 | RW | T | CTRL |
548548
+--------+-------+----+--------+----------------------------------+
549-
| 0x1053-| | | | Reserved |
549+
| 0x1053 | 0x08 | RW | T | DPDES |
550+
+--------+-------+----+--------+----------------------------------+
551+
| 0x1054-| | | | Reserved |
550552
| 0x1FFF | | | | |
551553
+--------+-------+----+--------+----------------------------------+
552554
| 0x2000 | 0x04 | RW | T | CR |

arch/powerpc/include/asm/guest-state-buffer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#define KVMPPC_GSID_HASHKEYR 0x1050
8282
#define KVMPPC_GSID_HASHPKEYR 0x1051
8383
#define KVMPPC_GSID_CTRL 0x1052
84+
#define KVMPPC_GSID_DPDES 0x1053
8485

8586
#define KVMPPC_GSID_CR 0x2000
8687
#define KVMPPC_GSID_PIDR 0x2001
@@ -110,7 +111,7 @@
110111
#define KVMPPC_GSE_META_COUNT (KVMPPC_GSE_META_END - KVMPPC_GSE_META_START + 1)
111112

112113
#define KVMPPC_GSE_DW_REGS_START KVMPPC_GSID_GPR(0)
113-
#define KVMPPC_GSE_DW_REGS_END KVMPPC_GSID_CTRL
114+
#define KVMPPC_GSE_DW_REGS_END KVMPPC_GSID_DPDES
114115
#define KVMPPC_GSE_DW_REGS_COUNT \
115116
(KVMPPC_GSE_DW_REGS_END - KVMPPC_GSE_DW_REGS_START + 1)
116117

arch/powerpc/include/asm/kvm_book3s.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ static inline u##size kvmppc_get_##reg(struct kvm_vcpu *vcpu) \
594594

595595

596596
KVMPPC_BOOK3S_VCORE_ACCESSOR(vtb, 64, KVMPPC_GSID_VTB)
597+
KVMPPC_BOOK3S_VCORE_ACCESSOR(dpdes, 64, KVMPPC_GSID_DPDES)
597598
KVMPPC_BOOK3S_VCORE_ACCESSOR_GET(arch_compat, 32, KVMPPC_GSID_LOGICAL_PVR)
598599
KVMPPC_BOOK3S_VCORE_ACCESSOR_GET(lpcr, 64, KVMPPC_GSID_LPCR)
599600
KVMPPC_BOOK3S_VCORE_ACCESSOR_SET(tb_offset, 64, KVMPPC_GSID_TB_OFFSET)

arch/powerpc/kvm/book3s_hv_nestedv2.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ static int gs_msg_ops_vcpu_fill_info(struct kvmppc_gs_buff *gsb,
311311
rc = kvmppc_gse_put_u64(gsb, iden,
312312
vcpu->arch.vcore->vtb);
313313
break;
314+
case KVMPPC_GSID_DPDES:
315+
rc = kvmppc_gse_put_u64(gsb, iden,
316+
vcpu->arch.vcore->dpdes);
317+
break;
314318
case KVMPPC_GSID_LPCR:
315319
rc = kvmppc_gse_put_u64(gsb, iden,
316320
vcpu->arch.vcore->lpcr);
@@ -543,6 +547,9 @@ static int gs_msg_ops_vcpu_refresh_info(struct kvmppc_gs_msg *gsm,
543547
case KVMPPC_GSID_VTB:
544548
vcpu->arch.vcore->vtb = kvmppc_gse_get_u64(gse);
545549
break;
550+
case KVMPPC_GSID_DPDES:
551+
vcpu->arch.vcore->dpdes = kvmppc_gse_get_u64(gse);
552+
break;
546553
case KVMPPC_GSID_LPCR:
547554
vcpu->arch.vcore->lpcr = kvmppc_gse_get_u64(gse);
548555
break;

arch/powerpc/kvm/test-guest-state-buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static void test_gs_bitmap(struct kunit *test)
151151
i++;
152152
}
153153

154-
for (u16 iden = KVMPPC_GSID_GPR(0); iden <= KVMPPC_GSID_CTRL; iden++) {
154+
for (u16 iden = KVMPPC_GSID_GPR(0); iden <= KVMPPC_GSE_DW_REGS_END; iden++) {
155155
kvmppc_gsbm_set(&gsbm, iden);
156156
kvmppc_gsbm_set(&gsbm1, iden);
157157
KUNIT_EXPECT_TRUE(test, kvmppc_gsbm_test(&gsbm, iden));

0 commit comments

Comments
 (0)