提交 3573602b 编写于 作者: D David Hildenbrand 提交者: Christian Borntraeger

KVM: s390: vsie: support setting the ibc

As soon as we forward an ibc to guest 2 (indicated via
kvm->arch.model.ibc), he can also use it for guest 3. Let's properly round
the ibc up/down, so we avoid any potential validity icpts from the
underlying SIE, if it doesn't simply round the values.
Acked-by: NChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: NDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
上级 06d68a6c
...@@ -102,6 +102,26 @@ static int prepare_cpuflags(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) ...@@ -102,6 +102,26 @@ static int prepare_cpuflags(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
return 0; return 0;
} }
/* shadow (round up/down) the ibc to avoid validity icpt */
static void prepare_ibc(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
{
struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;
__u64 min_ibc = (sclp.ibc >> 16) & 0x0fffU;
scb_s->ibc = 0;
/* ibc installed in g2 and requested for g3 */
if (vcpu->kvm->arch.model.ibc && (scb_o->ibc & 0x0fffU)) {
scb_s->ibc = scb_o->ibc & 0x0fffU;
/* takte care of the minimum ibc level of the machine */
if (scb_s->ibc < min_ibc)
scb_s->ibc = min_ibc;
/* take care of the maximum ibc level set for the guest */
if (scb_s->ibc > vcpu->kvm->arch.model.ibc)
scb_s->ibc = vcpu->kvm->arch.model.ibc;
}
}
/* unshadow the scb, copying parameters back to the real scb */ /* unshadow the scb, copying parameters back to the real scb */
static void unshadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) static void unshadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
{ {
...@@ -214,6 +234,7 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) ...@@ -214,6 +234,7 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
/* MVPG and Protection Exception Interpretation are always available */ /* MVPG and Protection Exception Interpretation are always available */
scb_s->eca |= scb_o->eca & 0x01002000U; scb_s->eca |= scb_o->eca & 0x01002000U;
prepare_ibc(vcpu, vsie_page);
out: out:
if (rc) if (rc)
unshadow_scb(vcpu, vsie_page); unshadow_scb(vcpu, vsie_page);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册