From: David Daney <ddaney.cavm@gmail.com>
To: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org, Paolo Bonzini <pbonzini@redhat.com>,
Gleb Natapov <gleb@kernel.org>,
kvm@vger.kernel.org, Ralf Baechle <ralf@linux-mips.org>,
David Daney <david.daney@cavium.com>,
Sanjay Lal <sanjayl@kymasys.com>
Subject: Re: [PATCH 05/21] MIPS: KVM: Add CP0_EPC KVM register access
Date: Fri, 25 Apr 2014 14:45:07 -0700 [thread overview]
Message-ID: <535AD763.1040604@gmail.com> (raw)
In-Reply-To: <10468933.5AvfRZXSN7@radagast>
On 04/25/2014 01:29 PM, James Hogan wrote:
> Hi David,
>
> On Friday 25 April 2014 09:44:17 David Daney wrote:
>> On 04/25/2014 08:19 AM, James Hogan wrote:
>>> Contrary to the comment, the guest CP0_EPC register cannot be set via
>>> kvm_regs, since it is distinct from the guest PC. Add the EPC register
>>> to the KVM_{GET,SET}_ONE_REG ioctl interface.
>>>
>>> Signed-off-by: James Hogan <james.hogan@imgtec.com>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Cc: Gleb Natapov <gleb@kernel.org>
>>> Cc: kvm@vger.kernel.org
>>> Cc: Ralf Baechle <ralf@linux-mips.org>
>>> Cc: linux-mips@linux-mips.org
>>> Cc: David Daney <david.daney@cavium.com>
>>> Cc: Sanjay Lal <sanjayl@kymasys.com>
>>
>> NACK...
>>
>>> ---
>>>
>>> arch/mips/kvm/kvm_mips.c | 9 ++++++++-
>>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
>>> index 46cea0bad518..db41876cbac5 100644
>>> --- a/arch/mips/kvm/kvm_mips.c
>>> +++ b/arch/mips/kvm/kvm_mips.c
>>> @@ -512,6 +512,7 @@ kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
>>>
>>> #define KVM_REG_MIPS_CP0_COMPARE MIPS_CP0_32(11, 0)
>>> #define KVM_REG_MIPS_CP0_STATUS MIPS_CP0_32(12, 0)
>>> #define KVM_REG_MIPS_CP0_CAUSE MIPS_CP0_32(13, 0)
>>>
>>> +#define KVM_REG_MIPS_CP0_EPC MIPS_CP0_64(14, 0)
>>
>> This is already called KVM_REG_MIPS_PC, you cannot change that.
>
> KVM_REG_MIPS_PC gets you vcpu->arch.pc, i.e. the next address of guest
> execution.
>
> KVM_REG_MIPS_CP0_EPC gets you the guest's CP0 EPC register which is the PC of
> the last guest exception.
>
> They are quite distinct state, even though vcpu->arch.pc is read from the
> *root context*'s CP0 EPC register after an exception or interrupt.
>
Sorry, my mistake. I was confusing Root/Host and Guest state.
I remove my objection.
David Daney
> Cheers
> James
>
>>
>>> #define KVM_REG_MIPS_CP0_EBASE MIPS_CP0_32(15, 1)
>>> #define KVM_REG_MIPS_CP0_CONFIG MIPS_CP0_32(16, 0)
>>> #define KVM_REG_MIPS_CP0_CONFIG1 MIPS_CP0_32(16, 1)
>>>
>>> @@ -567,7 +568,7 @@ static u64 kvm_mips_get_one_regs[] = {
>>>
>>> KVM_REG_MIPS_CP0_ENTRYHI,
>>> KVM_REG_MIPS_CP0_STATUS,
>>> KVM_REG_MIPS_CP0_CAUSE,
>>>
>>> - /* EPC set via kvm_regs, et al. */
>>> + KVM_REG_MIPS_CP0_EPC,
>>>
>>> KVM_REG_MIPS_CP0_CONFIG,
>>> KVM_REG_MIPS_CP0_CONFIG1,
>>> KVM_REG_MIPS_CP0_CONFIG2,
>>>
>>> @@ -620,6 +621,9 @@ static int kvm_mips_get_reg(struct kvm_vcpu *vcpu,
>>>
>>> case KVM_REG_MIPS_CP0_CAUSE:
>>> v = (long)kvm_read_c0_guest_cause(cop0);
>>> break;
>>>
>>> + case KVM_REG_MIPS_CP0_EPC:
>>> + v = (long)kvm_read_c0_guest_epc(cop0);
>>> + break;
>>>
>>> case KVM_REG_MIPS_CP0_ERROREPC:
>>> v = (long)kvm_read_c0_guest_errorepc(cop0);
>>> break;
>>>
>>> @@ -716,6 +720,9 @@ static int kvm_mips_set_reg(struct kvm_vcpu *vcpu,
>>>
>>> case KVM_REG_MIPS_CP0_CAUSE:
>>> kvm_write_c0_guest_cause(cop0, v);
>>> break;
>>>
>>> + case KVM_REG_MIPS_CP0_EPC:
>>> + kvm_write_c0_guest_epc(cop0, v);
>>> + break;
>>>
>>> case KVM_REG_MIPS_CP0_ERROREPC:
>>> kvm_write_c0_guest_errorepc(cop0, v);
>>> break;
next prev parent reply other threads:[~2014-04-25 21:45 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-25 15:19 [PATCH 00/21] MIPS: KVM: Fixes and guest timer rewrite James Hogan
2014-04-25 15:19 ` [PATCH 01/21] MIPS: KVM: Allocate at least 16KB for exception handlers James Hogan
2014-04-25 15:19 ` [PATCH 02/21] MIPS: KVM: Use local_flush_icache_range to fix RI on XBurst James Hogan
2014-04-25 15:19 ` [PATCH 03/21] MIPS: KVM: Use tlb_write_random James Hogan
2014-04-25 15:19 ` [PATCH 04/21] MIPS: KVM: Fix CP0_EBASE KVM register id James Hogan
2014-04-25 16:36 ` David Daney
2014-04-25 19:22 ` James Hogan
2014-04-25 15:19 ` [PATCH 05/21] MIPS: KVM: Add CP0_EPC KVM register access James Hogan
2014-04-25 16:44 ` David Daney
2014-04-25 20:29 ` James Hogan
2014-04-25 21:45 ` David Daney [this message]
2014-04-25 15:19 ` [PATCH 06/21] MIPS: KVM: Move KVM_{GET,SET}_ONE_REG definitions into kvm_host.h James Hogan
2014-04-25 15:19 ` [PATCH 07/21] MIPS: KVM: Add CP0_Count/Compare KVM register access James Hogan
2014-04-25 15:19 ` [PATCH 08/21] MIPS: KVM: Deliver guest interrupts after local_irq_disable() James Hogan
2014-04-25 15:19 ` [PATCH 09/21] MIPS: KVM: Fix timer race modifying guest CP0_Cause James Hogan
2014-04-25 16:55 ` David Daney
2014-04-25 20:42 ` James Hogan
2014-04-25 15:19 ` [PATCH 10/21] MIPS: KVM: Migrate hrtimer to follow VCPU James Hogan
2014-04-25 15:19 ` [PATCH 11/21] MIPS: KVM: Rewrite count/compare timer emulation James Hogan
2014-04-25 17:00 ` David Daney
2014-04-25 21:05 ` James Hogan
2014-04-25 15:19 ` [PATCH 12/21] MIPS: KVM: Override guest kernel timer frequency directly James Hogan
2014-04-25 15:19 ` [PATCH 13/21] MIPS: KVM: Add master disable count interface James Hogan
2014-04-25 15:19 ` [PATCH 14/21] MIPS: KVM: Add nanosecond count bias KVM register James Hogan
2014-04-25 17:27 ` David Daney
2014-04-25 22:34 ` James Hogan
2014-04-26 9:37 ` Paolo Bonzini
2014-05-28 14:21 ` James Hogan
2014-05-28 16:24 ` Paolo Bonzini
2014-04-28 12:01 ` Paolo Bonzini
2014-04-28 15:17 ` James Hogan
2014-04-28 15:42 ` Paolo Bonzini
2014-04-25 15:19 ` [PATCH 15/21] MIPS: KVM: Add count frequency " James Hogan
2014-04-25 15:19 ` [PATCH 16/21] MIPS: KVM: Make kvm_mips_comparecount_{func,wakeup} static James Hogan
2014-04-25 15:20 ` [PATCH 17/21] MIPS: KVM: Whitespace fixes in kvm_mips_callbacks James Hogan
2014-04-25 15:20 ` [PATCH 18/21] MIPS: KVM: Fix kvm_debug bit-rottage James Hogan
2014-04-25 15:20 ` [PATCH 19/21] MIPS: KVM: Remove ifdef DEBUG around kvm_debug James Hogan
2014-04-25 15:20 ` [PATCH 20/21] MIPS: KVM: Quieten kvm_info() logging James Hogan
2014-04-25 15:20 ` [PATCH 21/21] MIPS: KVM: Remove redundant NULL checks before kfree() James Hogan
2014-04-28 12:02 ` [PATCH 00/21] MIPS: KVM: Fixes and guest timer rewrite Paolo Bonzini
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=535AD763.1040604@gmail.com \
--to=ddaney.cavm@gmail.com \
--cc=david.daney@cavium.com \
--cc=gleb@kernel.org \
--cc=james.hogan@imgtec.com \
--cc=kvm@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=pbonzini@redhat.com \
--cc=ralf@linux-mips.org \
--cc=sanjayl@kymasys.com \
/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