提交 c8aac234 编写于 作者: J Janosch Frank 提交者: Christian Borntraeger

KVM: s390: protvirt: Add new gprs location handling

Guest registers for protected guests are stored at offset 0x380.  We
will copy those to the usual places.  Long term we could refactor this
or use register access functions.
Signed-off-by: NJanosch Frank <frankja@linux.ibm.com>
Reviewed-by: NThomas Huth <thuth@redhat.com>
Reviewed-by: NCornelia Huck <cohuck@redhat.com>
Reviewed-by: NDavid Hildenbrand <david@redhat.com>
[borntraeger@de.ibm.com: patch merging, splitting, fixing]
Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
上级 e663df91
...@@ -343,7 +343,9 @@ struct kvm_s390_itdb { ...@@ -343,7 +343,9 @@ struct kvm_s390_itdb {
struct sie_page { struct sie_page {
struct kvm_s390_sie_block sie_block; struct kvm_s390_sie_block sie_block;
struct mcck_volatile_info mcck_info; /* 0x0200 */ struct mcck_volatile_info mcck_info; /* 0x0200 */
__u8 reserved218[1000]; /* 0x0218 */ __u8 reserved218[360]; /* 0x0218 */
__u64 pv_grregs[16]; /* 0x0380 */
__u8 reserved400[512]; /* 0x0400 */
struct kvm_s390_itdb itdb; /* 0x0600 */ struct kvm_s390_itdb itdb; /* 0x0600 */
__u8 reserved700[2304]; /* 0x0700 */ __u8 reserved700[2304]; /* 0x0700 */
}; };
......
...@@ -4059,6 +4059,7 @@ static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason) ...@@ -4059,6 +4059,7 @@ static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
static int __vcpu_run(struct kvm_vcpu *vcpu) static int __vcpu_run(struct kvm_vcpu *vcpu)
{ {
int rc, exit_reason; int rc, exit_reason;
struct sie_page *sie_page = (struct sie_page *)vcpu->arch.sie_block;
/* /*
* We try to hold kvm->srcu during most of vcpu_run (except when run- * We try to hold kvm->srcu during most of vcpu_run (except when run-
...@@ -4080,8 +4081,18 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) ...@@ -4080,8 +4081,18 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
guest_enter_irqoff(); guest_enter_irqoff();
__disable_cpu_timer_accounting(vcpu); __disable_cpu_timer_accounting(vcpu);
local_irq_enable(); local_irq_enable();
if (kvm_s390_pv_cpu_is_protected(vcpu)) {
memcpy(sie_page->pv_grregs,
vcpu->run->s.regs.gprs,
sizeof(sie_page->pv_grregs));
}
exit_reason = sie64a(vcpu->arch.sie_block, exit_reason = sie64a(vcpu->arch.sie_block,
vcpu->run->s.regs.gprs); vcpu->run->s.regs.gprs);
if (kvm_s390_pv_cpu_is_protected(vcpu)) {
memcpy(vcpu->run->s.regs.gprs,
sie_page->pv_grregs,
sizeof(sie_page->pv_grregs));
}
local_irq_disable(); local_irq_disable();
__enable_cpu_timer_accounting(vcpu); __enable_cpu_timer_accounting(vcpu);
guest_exit_irqoff(); guest_exit_irqoff();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册