All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 1/6] KVM: PPC: Book3S PR: Ignore PMU SPRs
Date: Wed, 07 May 2014 07:09:52 +0000	[thread overview]
Message-ID: <20140507070952.GA1463@iris.ozlabs.ibm.com> (raw)
In-Reply-To: <536358BD.9030304@suse.de>

On Fri, May 02, 2014 at 10:35:09AM +0200, Alexander Graf wrote:
> On 05/01/2014 12:12 AM, Paul Mackerras wrote:
> >On Tue, Apr 29, 2014 at 06:17:37PM +0200, Alexander Graf wrote:
> >>When we expose a POWER8 CPU into the guest, it will start accessing PMU SPRs
> >>that we don't emulate. Just ignore accesses to them.
> >>
> >>Signed-off-by: Alexander Graf <agraf@suse.de>
> >This patch is OK as it stands, but in fact the architecture says that
> >kernel accesses to unimplemented SPRs are mostly supposed to be no-ops
> >rather than causing a trap (mostly = excluding mtspr to 0 or mfspr
> >from 0, 4, 5 or 6).  I have a patch to implement that, which I'll
> >post.
> 
> I think what we want is a flag similar to x86 where we can force
> ignore unknown SPRs, but leave it at triggering an interrupt as
> default. We usually have to be at least aware of unknown SPRs and
> check that not implementing them is ok for the guest.
> 
> Debugging a program interrupt because of an unknown SPR is usually a
> lot easier than debugging a breaking guest because it was using the
> SPR as storage and we didn't back it by anything.

That has not been my experience, for accesses by the Linux kernel
early in the boot process; usually we end up in a loop of ISI
interrupts because the HPT isn't set up yet, with the original
interrupt cause (and PC) lost long ago.

The Power ISA was changed in version 2.05 (POWER6) to specify that
accesses to unimplemented SPRs by privileged code must be no-ops on
server processors.  Before that the architecture allowed either an
illegal instruction interrupt or "boundedly undefined" behaviour
(which would include a no-op).

So, if we're emulating POWERx for x >= 6, to be correct we need to do
the no-op behaviour, even if we retain the option of making them trap
for debugging purposes.  Of course at the moment we basically never
look at what specific CPU we're emulating, but maybe now we have to.

Regards,
Paul.

WARNING: multiple messages have this Message-ID (diff)
From: Paul Mackerras <paulus@samba.org>
To: Alexander Graf <agraf@suse.de>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 1/6] KVM: PPC: Book3S PR: Ignore PMU SPRs
Date: Wed, 7 May 2014 17:09:52 +1000	[thread overview]
Message-ID: <20140507070952.GA1463@iris.ozlabs.ibm.com> (raw)
In-Reply-To: <536358BD.9030304@suse.de>

On Fri, May 02, 2014 at 10:35:09AM +0200, Alexander Graf wrote:
> On 05/01/2014 12:12 AM, Paul Mackerras wrote:
> >On Tue, Apr 29, 2014 at 06:17:37PM +0200, Alexander Graf wrote:
> >>When we expose a POWER8 CPU into the guest, it will start accessing PMU SPRs
> >>that we don't emulate. Just ignore accesses to them.
> >>
> >>Signed-off-by: Alexander Graf <agraf@suse.de>
> >This patch is OK as it stands, but in fact the architecture says that
> >kernel accesses to unimplemented SPRs are mostly supposed to be no-ops
> >rather than causing a trap (mostly == excluding mtspr to 0 or mfspr
> >from 0, 4, 5 or 6).  I have a patch to implement that, which I'll
> >post.
> 
> I think what we want is a flag similar to x86 where we can force
> ignore unknown SPRs, but leave it at triggering an interrupt as
> default. We usually have to be at least aware of unknown SPRs and
> check that not implementing them is ok for the guest.
> 
> Debugging a program interrupt because of an unknown SPR is usually a
> lot easier than debugging a breaking guest because it was using the
> SPR as storage and we didn't back it by anything.

That has not been my experience, for accesses by the Linux kernel
early in the boot process; usually we end up in a loop of ISI
interrupts because the HPT isn't set up yet, with the original
interrupt cause (and PC) lost long ago.

The Power ISA was changed in version 2.05 (POWER6) to specify that
accesses to unimplemented SPRs by privileged code must be no-ops on
server processors.  Before that the architecture allowed either an
illegal instruction interrupt or "boundedly undefined" behaviour
(which would include a no-op).

So, if we're emulating POWERx for x >= 6, to be correct we need to do
the no-op behaviour, even if we retain the option of making them trap
for debugging purposes.  Of course at the moment we basically never
look at what specific CPU we're emulating, but maybe now we have to.

Regards,
Paul.

  reply	other threads:[~2014-05-07  7:09 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29 16:17 [PATCH 0/6] KVM: PPC: Book3S PR: Add POWER8 support Alexander Graf
2014-04-29 16:17 ` Alexander Graf
2014-04-29 16:17 ` [PATCH 1/6] KVM: PPC: Book3S PR: Ignore PMU SPRs Alexander Graf
2014-04-29 16:17   ` Alexander Graf
2014-04-30 22:12   ` Paul Mackerras
2014-04-30 22:12     ` Paul Mackerras
2014-05-02  8:35     ` Alexander Graf
2014-05-02  8:35       ` Alexander Graf
2014-05-07  7:09       ` Paul Mackerras [this message]
2014-05-07  7:09         ` Paul Mackerras
2014-05-08 12:11         ` Alexander Graf
2014-05-08 12:11           ` Alexander Graf
2014-04-29 16:17 ` [PATCH 2/6] KVM: PPC: Book3S PR: Emulate TIR register Alexander Graf
2014-04-29 16:17   ` Alexander Graf
2014-04-30  5:51   ` Michael Neuling
2014-04-30  5:51     ` Michael Neuling
2014-04-30 10:06     ` Alexander Graf
2014-04-30 10:06       ` Alexander Graf
2014-04-29 16:17 ` [PATCH 3/6] KVM: PPC: Book3S PR: Handle Facility interrupt and FSCR Alexander Graf
2014-04-29 16:17   ` Alexander Graf
2014-04-29 16:17 ` [PATCH 4/6] KVM: PPC: Book3S PR: Expose TAR facility to guest Alexander Graf
2014-04-29 16:17   ` Alexander Graf
2014-04-29 16:17 ` [PATCH 5/6] KVM: PPC: Book3S PR: Expose EBB registers Alexander Graf
2014-04-29 16:17   ` Alexander Graf
2014-04-29 16:17 ` [PATCH 6/6] KVM: PPC: Book3S PR: Expose TM registers Alexander Graf
2014-04-29 16:17   ` Alexander Graf
2014-05-17  6:20   ` Paul Mackerras
2014-05-17  6:20     ` Paul Mackerras
2014-05-19 13:09     ` Alexander Graf
2014-05-19 13:09       ` Alexander Graf
2014-05-20  9:59       ` Paul Mackerras
2014-05-20  9:59         ` Paul Mackerras
2014-05-20 11:49         ` Alexander Graf
2014-05-20 11:49           ` Alexander Graf
2014-05-04 16:36 ` [PATCH 0/6] KVM: PPC: Book3S PR: Add POWER8 support Aneesh Kumar K.V
2014-05-04 16:48   ` Aneesh Kumar K.V
2014-05-05 11:18   ` Alexander Graf
2014-05-05 11:18     ` Alexander Graf
2014-05-05 14:38     ` Aneesh Kumar K.V
2014-05-05 14:50       ` Aneesh Kumar K.V
2014-05-05 14:42       ` Alexander Graf
2014-05-05 14:42         ` Alexander Graf
2014-05-05 14:48         ` Aneesh Kumar K.V
2014-05-05 14:48           ` Aneesh Kumar K.V

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=20140507070952.GA1463@iris.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@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.