Commit 55dfb8be authored by Gautam Menghani's avatar Gautam Menghani Committed by Michael Ellerman
Browse files

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: 6ccbbc33 ("KVM: PPC: Add helper library for Guest State Buffers")
Cc: stable@vger.kernel.org # v6.7+
Signed-off-by: default avatarGautam Menghani <gautam@linux.ibm.com>
Reviewed-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240605113913.83715-2-gautam@linux.ibm.com
parent e1f288d2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -546,7 +546,9 @@ table information.
+--------+-------+----+--------+----------------------------------+
| 0x1052 | 0x08  | RW |   T    | CTRL                             |
+--------+-------+----+--------+----------------------------------+
| 0x1053-|       |    |        | Reserved                         |
| 0x1053 | 0x08  | RW |   T    | DPDES                            |
+--------+-------+----+--------+----------------------------------+
| 0x1054-|       |    |        | Reserved                         |
| 0x1FFF |       |    |        |                                  |
+--------+-------+----+--------+----------------------------------+
| 0x2000 | 0x04  | RW |   T    | CR                               |
+2 −1
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@
#define KVMPPC_GSID_HASHKEYR			0x1050
#define KVMPPC_GSID_HASHPKEYR			0x1051
#define KVMPPC_GSID_CTRL			0x1052
#define KVMPPC_GSID_DPDES			0x1053

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

#define KVMPPC_GSE_DW_REGS_START KVMPPC_GSID_GPR(0)
#define KVMPPC_GSE_DW_REGS_END KVMPPC_GSID_CTRL
#define KVMPPC_GSE_DW_REGS_END KVMPPC_GSID_DPDES
#define KVMPPC_GSE_DW_REGS_COUNT \
	(KVMPPC_GSE_DW_REGS_END - KVMPPC_GSE_DW_REGS_START + 1)

+1 −0
Original line number Diff line number Diff line
@@ -594,6 +594,7 @@ static inline u##size kvmppc_get_##reg(struct kvm_vcpu *vcpu) \


KVMPPC_BOOK3S_VCORE_ACCESSOR(vtb, 64, KVMPPC_GSID_VTB)
KVMPPC_BOOK3S_VCORE_ACCESSOR(dpdes, 64, KVMPPC_GSID_DPDES)
KVMPPC_BOOK3S_VCORE_ACCESSOR_GET(arch_compat, 32, KVMPPC_GSID_LOGICAL_PVR)
KVMPPC_BOOK3S_VCORE_ACCESSOR_GET(lpcr, 64, KVMPPC_GSID_LPCR)
KVMPPC_BOOK3S_VCORE_ACCESSOR_SET(tb_offset, 64, KVMPPC_GSID_TB_OFFSET)
+7 −0
Original line number Diff line number Diff line
@@ -311,6 +311,10 @@ static int gs_msg_ops_vcpu_fill_info(struct kvmppc_gs_buff *gsb,
			rc = kvmppc_gse_put_u64(gsb, iden,
						vcpu->arch.vcore->vtb);
			break;
		case KVMPPC_GSID_DPDES:
			rc = kvmppc_gse_put_u64(gsb, iden,
						vcpu->arch.vcore->dpdes);
			break;
		case KVMPPC_GSID_LPCR:
			rc = kvmppc_gse_put_u64(gsb, iden,
						vcpu->arch.vcore->lpcr);
@@ -543,6 +547,9 @@ static int gs_msg_ops_vcpu_refresh_info(struct kvmppc_gs_msg *gsm,
		case KVMPPC_GSID_VTB:
			vcpu->arch.vcore->vtb = kvmppc_gse_get_u64(gse);
			break;
		case KVMPPC_GSID_DPDES:
			vcpu->arch.vcore->dpdes = kvmppc_gse_get_u64(gse);
			break;
		case KVMPPC_GSID_LPCR:
			vcpu->arch.vcore->lpcr = kvmppc_gse_get_u64(gse);
			break;
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ static void test_gs_bitmap(struct kunit *test)
		i++;
	}

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