Skip to contentSkip to conversation

KVM: PPC: Book3S HV: Reject mflags=2 (LPCR[AIL]=2) ADDR_TRANS_MODE mode

PATCH In review Nicholas Piggin 2 participants 3 messages May 20, 2019 – Jun 19, 2019

Subsystems (2)
lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

PATCH 5/5 KVM: PPC: Book3S HV: Reject mflags=2 (LPCR[AIL]=2) ADDR_TRANS_MODE mode

AIL=2 mode has no known users, so is not well tested or supported. Disallow guests from selecting this mode because it may become deprecated in future versions of the architecture.

---
 arch/powerpc/kvm/book3s_hv.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/powerpc/kvm/book3s_hv.c +5 -0
index 36d16740748a..4295ccdbee26 100644
@@ -784,6 +784,11 @@ static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
 		vcpu->arch.dawr  = value1;
 		vcpu->arch.dawrx = value2;
 		return H_SUCCESS;
+	case H_SET_MODE_RESOURCE_ADDR_TRANS_MODE:
+		/* KVM does not support mflags=2 (AIL=2) */
+		if (mflags != 0 && mflags != 3)
+			return H_UNSUPPORTED_FLAG_START;
+		return H_TOO_HARD;
 	default:
 		return H_TOO_HARD;
 	}
Signature · 1 line
2.20.1
#1 lore raw
Quoted 5 lines · Nicholas Piggin

AIL=2 mode has no known users, so is not well tested or supported. Disallow guests from selecting this mode because it may become deprecated in future versions of the architecture.

Given that H_SET_MODE_RESOURCE_ADDR_TRANS_MODE gets punted to userspace (QEMU), why are we enforcing this here rather than in QEMU?

If there is a reason to do this here rather than in QEMU, then the patch description should really comment on why we're rejecting AIL=1 as well as AIL=2.

Quoted 22 lines
---
 arch/powerpc/kvm/book3s_hv.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/powerpc/kvm/book3s_hv.c +5 -0
index 36d16740748a..4295ccdbee26 100644
@@ -784,6 +784,11 @@ static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
 		vcpu->arch.dawr  = value1;
 		vcpu->arch.dawrx = value2;
 		return H_SUCCESS;
+	case H_SET_MODE_RESOURCE_ADDR_TRANS_MODE:
+		/* KVM does not support mflags=2 (AIL=2) */
+		if (mflags != 0 && mflags != 3)
+			return H_UNSUPPORTED_FLAG_START;
+		return H_TOO_HARD;
 	default:
 		return H_TOO_HARD;
 	}
Signature · 1 line
2.20.1

Paul.

author reviewer
#2 lore raw
In reply to Nicholas Piggin

Paul Mackerras's on June 17, 2019 3:58 pm:

Quoted 9 lines · Nicholas Piggin
Quoted 5 lines

AIL=2 mode has no known users, so is not well tested or supported. Disallow guests from selecting this mode because it may become deprecated in future versions of the architecture.

Given that H_SET_MODE_RESOURCE_ADDR_TRANS_MODE gets punted to userspace (QEMU), why are we enforcing this here rather than in QEMU?

QEMU (appears to) support AIL=2. I don't propose to remove that support (which could in theory be a regression for users). It can't have ever worked properly for KVM guests though AFAIKS. Is that reasonable?

Quoted 3 lines

If there is a reason to do this here rather than in QEMU, then the patch description should really comment on why we're rejecting AIL=1 as well as AIL=2.

Sure.

Thanks for review of the other patches as well, I think all your points were valid so I'll fix them up before reposting.

Thanks,
Nick

Quoted 26 lines
Quoted 23 lines
---
 arch/powerpc/kvm/book3s_hv.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/powerpc/kvm/book3s_hv.c +5 -0
index 36d16740748a..4295ccdbee26 100644
@@ -784,6 +784,11 @@ static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
 		vcpu->arch.dawr  = value1;
 		vcpu->arch.dawrx = value2;
 		return H_SUCCESS;
+	case H_SET_MODE_RESOURCE_ADDR_TRANS_MODE:
+		/* KVM does not support mflags=2 (AIL=2) */
+		if (mflags != 0 && mflags != 3)
+			return H_UNSUPPORTED_FLAG_START;
+		return H_TOO_HARD;
 	default:
 		return H_TOO_HARD;
 	}
Signature · 1 line
2.20.1

Paul.