From: Scott Wood <scottwood@freescale.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 3/5] KVM: PPC: Paravirtualize SPRG4-7, ESR, PIR, MASn
Date: Thu, 15 Sep 2011 18:26:18 +0000 [thread overview]
Message-ID: <4E72434A.7080109@freescale.com> (raw)
In-Reply-To: <20110826233142.GC30607@schlenkerla.am.freescale.net>
On 09/05/2011 05:28 PM, Alexander Graf wrote:
>> + /*
>> + * SPRG4-7 are user-readable, so we can't keep these
>> + * consistent between the magic page and the real
>> + * registers. We provide space in case the guest
>> + * can deal with this.
>> + *
>> + * This also applies to SPRG3 on some chips.
>> + */
>> + __u64 sprg4;
>> + __u64 sprg5;
>> + __u64 sprg6;
>> + __u64 sprg7;
>
> Hrm. You're touching sprg4-7 but don't remove the fields from vcpu->arch. That sounds wrong. Also, the entry/exit code needs to use these now instead of the vcpu struct fields to restore the correct values.
The original idea, as the comment states, was just to provide an area
that the guest could use for this, as we can't keep it fully synced with
the hardware registers since the hw regs don't trap on read, and the
paravirt doesn't trap on write.
However, I think it could work reasonably well to use this as the
backing store instead of vcpu->arch.sprg4-7. The guest would still see
inconsistency if it writes to paravirt and then reads from the hw reg
without an intervening exit, so that restriction on use still applies,
but qemu would see the right thing in sregs, and we wouldn't have the
duplication.
>> diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
>> index 5f078bc..34da20d 100644
>> --- a/arch/powerpc/kernel/asm-offsets.c
>> +++ b/arch/powerpc/kernel/asm-offsets.c
>> @@ -431,6 +431,15 @@ int main(void)
>> DEFINE(VCPU_SHARED_MSR, offsetof(struct kvm_vcpu_arch_shared, msr));
>> DEFINE(VCPU_SHADOW_MSR, offsetof(struct kvm_vcpu, arch.shadow_msr));
>>
>> +#ifdef CONFIG_FSL_BOOKE
>> + DEFINE(VCPU_SHARED_MAS0, offsetof(struct kvm_vcpu_arch_shared, mas0));
>> + DEFINE(VCPU_SHARED_MAS1, offsetof(struct kvm_vcpu_arch_shared, mas1));
>> + DEFINE(VCPU_SHARED_MAS2, offsetof(struct kvm_vcpu_arch_shared, mas2));
>> + DEFINE(VCPU_SHARED_MAS7_3, offsetof(struct kvm_vcpu_arch_shared, mas7_3));
>> + DEFINE(VCPU_SHARED_MAS4, offsetof(struct kvm_vcpu_arch_shared, mas4));
>> + DEFINE(VCPU_SHARED_MAS6, offsetof(struct kvm_vcpu_arch_shared, mas6));
>> +#endif
>
> While I agree that they only make sense on BookE, the fields in the ABI are not #ifdef'ed, so I don't see why the asm-offsets fields should be.
OK.
>> +#define SPR_FROM 0
>> +#define SPR_TO 0x100
>> +
>> +#define KVM_INST_SPR(sprn, moveto) (0x7c0002a6 | \
>> + (((sprn) & 0x1f) << 16) | \
>> + (((sprn) & 0x3e0) << 6) | \
>> + (moveto))
>
> #define KVM_INST_MFSPR(sprn) KVM_INST_MFSPR(sprn, SPR_FROM)
> #define KVM_INST_MTSPR(sprn) KVM_INST_MFSPR(sprn, SPR_TO)
>
> makes it more readable really :)
OK.
>> @@ -618,6 +618,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
>> vcpu->arch.pc = 0;
>> vcpu->arch.shared->msr = 0;
>> vcpu->arch.shadow_msr = MSR_USER | MSR_DE | MSR_IS | MSR_DS;
>> + vcpu->arch.shared->pir = vcpu->vcpu_id;
>
> That one rings a bell. Are you sure this patch set is on top of the other one that fixes PIR?
Yes. Now that it's paravirted we need to store it somewhere other than
just vcpu->vcpu_id.
-Scott
next prev parent reply other threads:[~2011-09-15 18:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-26 23:31 [PATCH 3/5] KVM: PPC: Paravirtualize SPRG4-7, ESR, PIR, MASn Scott Wood
2011-09-05 22:28 ` Alexander Graf
2011-09-15 18:26 ` Scott Wood [this message]
2011-09-19 9:23 ` Alexander Graf
2011-09-19 16:05 ` Scott Wood
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=4E72434A.7080109@freescale.com \
--to=scottwood@freescale.com \
--cc=kvm-ppc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.