qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Christian Borntraeger <borntraeger@linux.ibm.com>,
	qemu-devel@nongnu.org,  Halil Pasic <pasic@linux.ibm.com>
Cc: qemu-s390x@nongnu.org, "David Hildenbrand" <david@redhat.com>,
	"Cédric Le Goater" <clegoate@redhat.com>
Subject: Re: [PATCH v2 2/2] target/s390x/kvm: Simplify the GPRs, ACRs, CRs and prefix synchronization code
Date: Tue, 10 Oct 2023 13:46:12 +0200	[thread overview]
Message-ID: <5696146e-a9d5-f09f-a5b3-7a8479fcd5ad@redhat.com> (raw)
In-Reply-To: <d21556f0-c551-cab0-4fc7-fadb7775bc79@linux.ibm.com>

On 10/10/2023 13.41, Christian Borntraeger wrote:
> 
> 
> Am 09.10.23 um 19:07 schrieb Thomas Huth:
> [...]
> 
>> @@ -483,20 +482,14 @@ int kvm_arch_put_registers(CPUState *cs, int level)
>>       cs->kvm_run->psw_addr = env->psw.addr;
>>       cs->kvm_run->psw_mask = env->psw.mask;
>> -    if (can_sync_regs(cs, KVM_SYNC_GPRS)) {
>> -        for (i = 0; i < 16; i++) {
>> -            cs->kvm_run->s.regs.gprs[i] = env->regs[i];
>> -            cs->kvm_run->kvm_dirty_regs |= KVM_SYNC_GPRS;
>> -        }
>> -    } else {
>> -        for (i = 0; i < 16; i++) {
>> -            regs.gprs[i] = env->regs[i];
>> -        }
>> -        r = kvm_vcpu_ioctl(cs, KVM_SET_REGS, &regs);
>> -        if (r < 0) {
>> -            return r;
>> -        }
>> -    }
>> +    g_assert((cs->kvm_run->kvm_valid_regs & KVM_SYNC_REQUIRED_BITS) ==
>> +             KVM_SYNC_REQUIRED_BITS);
>> +    cs->kvm_run->kvm_dirty_regs |= KVM_SYNC_REQUIRED_BITS;
>> +    memcpy(cs->kvm_run->s.regs.gprs, env->regs, 
>> sizeof(cs->kvm_run->s.regs.gprs));
> 
> 
>> +    memcpy(cs->kvm_run->s.regs.acrs, env->aregs, 
>> sizeof(cs->kvm_run->s.regs.acrs));
>> +    memcpy(cs->kvm_run->s.regs.crs, env->cregs, 
>> sizeof(cs->kvm_run->s.regs.crs));
>> +
>> +    cs->kvm_run->s.regs.prefix = env->psa;
> 
> These 3 have only been saved for level> KVM_PUT_RUNTIME_STATE. By moving the 
> memcpy
> into this position you would always write them. Probably ok but a change in
> behaviour. Was this intentional?

Oops, no, I missed that early return in the function. I'll fix it and send a v3.

  Thanks!
   Thomas



      reply	other threads:[~2023-10-10 11:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 17:07 [PATCH v2 0/2] target/s390x/kvm: Simplify the synchronization code Thomas Huth
2023-10-09 17:07 ` [PATCH v2 1/2] target/s390x/kvm: Turn KVM_CAP_SYNC_REGS into a hard requirement Thomas Huth
2023-10-10 11:02   ` Christian Borntraeger
2023-10-10 11:12     ` Thomas Huth
2023-10-10 11:36       ` Christian Borntraeger
2023-10-09 17:07 ` [PATCH v2 2/2] target/s390x/kvm: Simplify the GPRs, ACRs, CRs and prefix synchronization code Thomas Huth
2023-10-10 11:41   ` Christian Borntraeger
2023-10-10 11:46     ` Thomas Huth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5696146e-a9d5-f09f-a5b3-7a8479fcd5ad@redhat.com \
    --to=thuth@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clegoate@redhat.com \
    --cc=david@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).