* [PATCH] KVM: PPC: BookE: Include trap in pt_regs
@ 2012-05-16 13:25 Alexander Graf
2012-05-17 16:37 ` Scott Wood
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Graf @ 2012-05-16 13:25 UTC (permalink / raw)
To: kvm-ppc; +Cc: kvm list
When reinjecting host interrupt requests in the exit handler code,
let's also tell the interrupt handler which interrupt number we're
coming from.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
arch/powerpc/kvm/booke.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 72f13f4..0512bd7 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -596,7 +596,8 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
}
}
-static void kvmppc_fill_pt_regs(struct pt_regs *regs)
+static void kvmppc_fill_pt_regs(struct pt_regs *regs,
+ int exit_nr)
{
ulong r1, ip, msr, lr;
@@ -610,6 +611,7 @@ static void kvmppc_fill_pt_regs(struct pt_regs *regs)
regs->nip = ip;
regs->msr = msr;
regs->link = lr;
+ regs->trap = exit_nr;
}
static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
@@ -619,16 +621,16 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
switch (exit_nr) {
case BOOKE_INTERRUPT_EXTERNAL:
- kvmppc_fill_pt_regs(®s);
+ kvmppc_fill_pt_regs(®s, exit_nr);
do_IRQ(®s);
break;
case BOOKE_INTERRUPT_DECREMENTER:
- kvmppc_fill_pt_regs(®s);
+ kvmppc_fill_pt_regs(®s, exit_nr);
timer_interrupt(®s);
break;
#if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_BOOK3E_64)
case BOOKE_INTERRUPT_DOORBELL:
- kvmppc_fill_pt_regs(®s);
+ kvmppc_fill_pt_regs(®s, exit_nr);
doorbell_exception(®s);
break;
#endif
@@ -636,7 +638,7 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
/* FIXME */
break;
case BOOKE_INTERRUPT_PERFORMANCE_MONITOR:
- kvmppc_fill_pt_regs(®s);
+ kvmppc_fill_pt_regs(®s, exit_nr);
performance_monitor_exception(®s);
break;
}
--
1.6.0.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: PPC: BookE: Include trap in pt_regs
2012-05-16 13:25 [PATCH] KVM: PPC: BookE: Include trap in pt_regs Alexander Graf
@ 2012-05-17 16:37 ` Scott Wood
2012-05-17 20:56 ` Alexander Graf
0 siblings, 1 reply; 6+ messages in thread
From: Scott Wood @ 2012-05-17 16:37 UTC (permalink / raw)
To: Alexander Graf; +Cc: kvm-ppc, kvm list
On 05/16/2012 08:25 AM, Alexander Graf wrote:
> When reinjecting host interrupt requests in the exit handler code,
> let's also tell the interrupt handler which interrupt number we're
> coming from.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
> arch/powerpc/kvm/booke.c | 12 +++++++-----
> 1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 72f13f4..0512bd7 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -596,7 +596,8 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
> }
> }
>
> -static void kvmppc_fill_pt_regs(struct pt_regs *regs)
> +static void kvmppc_fill_pt_regs(struct pt_regs *regs,
> + int exit_nr)
> {
> ulong r1, ip, msr, lr;
>
> @@ -610,6 +611,7 @@ static void kvmppc_fill_pt_regs(struct pt_regs *regs)
> regs->nip = ip;
> regs->msr = msr;
> regs->link = lr;
> + regs->trap = exit_nr;
> }
>
> static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
> @@ -619,16 +621,16 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>
> switch (exit_nr) {
> case BOOKE_INTERRUPT_EXTERNAL:
> - kvmppc_fill_pt_regs(®s);
> + kvmppc_fill_pt_regs(®s, exit_nr);
> do_IRQ(®s);
> break;
exit_nr is not the same as the trap number that the rest of the kernel
wants to see.
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: PPC: BookE: Include trap in pt_regs
2012-05-17 16:37 ` Scott Wood
@ 2012-05-17 20:56 ` Alexander Graf
2012-05-17 20:58 ` Scott Wood
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Graf @ 2012-05-17 20:56 UTC (permalink / raw)
To: Scott Wood; +Cc: kvm-ppc, kvm list
On 17.05.2012, at 18:37, Scott Wood wrote:
> On 05/16/2012 08:25 AM, Alexander Graf wrote:
>> When reinjecting host interrupt requests in the exit handler code,
>> let's also tell the interrupt handler which interrupt number we're
>> coming from.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> ---
>> arch/powerpc/kvm/booke.c | 12 +++++++-----
>> 1 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
>> index 72f13f4..0512bd7 100644
>> --- a/arch/powerpc/kvm/booke.c
>> +++ b/arch/powerpc/kvm/booke.c
>> @@ -596,7 +596,8 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
>> }
>> }
>>
>> -static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>> +static void kvmppc_fill_pt_regs(struct pt_regs *regs,
>> + int exit_nr)
>> {
>> ulong r1, ip, msr, lr;
>>
>> @@ -610,6 +611,7 @@ static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>> regs->nip = ip;
>> regs->msr = msr;
>> regs->link = lr;
>> + regs->trap = exit_nr;
>> }
>>
>> static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>> @@ -619,16 +621,16 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>>
>> switch (exit_nr) {
>> case BOOKE_INTERRUPT_EXTERNAL:
>> - kvmppc_fill_pt_regs(®s);
>> + kvmppc_fill_pt_regs(®s, exit_nr);
>> do_IRQ(®s);
>> break;
>
> exit_nr is not the same as the trap number that the rest of the kernel
> wants to see.
It's not? What does the kernel want to see then?
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: PPC: BookE: Include trap in pt_regs
2012-05-17 20:56 ` Alexander Graf
@ 2012-05-17 20:58 ` Scott Wood
2012-05-17 21:03 ` Alexander Graf
0 siblings, 1 reply; 6+ messages in thread
From: Scott Wood @ 2012-05-17 20:58 UTC (permalink / raw)
To: Alexander Graf; +Cc: kvm-ppc, kvm list
On 05/17/2012 03:56 PM, Alexander Graf wrote:
>
> On 17.05.2012, at 18:37, Scott Wood wrote:
>
>> On 05/16/2012 08:25 AM, Alexander Graf wrote:
>>> When reinjecting host interrupt requests in the exit handler code,
>>> let's also tell the interrupt handler which interrupt number we're
>>> coming from.
>>>
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>> ---
>>> arch/powerpc/kvm/booke.c | 12 +++++++-----
>>> 1 files changed, 7 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
>>> index 72f13f4..0512bd7 100644
>>> --- a/arch/powerpc/kvm/booke.c
>>> +++ b/arch/powerpc/kvm/booke.c
>>> @@ -596,7 +596,8 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
>>> }
>>> }
>>>
>>> -static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>>> +static void kvmppc_fill_pt_regs(struct pt_regs *regs,
>>> + int exit_nr)
>>> {
>>> ulong r1, ip, msr, lr;
>>>
>>> @@ -610,6 +611,7 @@ static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>>> regs->nip = ip;
>>> regs->msr = msr;
>>> regs->link = lr;
>>> + regs->trap = exit_nr;
>>> }
>>>
>>> static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>>> @@ -619,16 +621,16 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>>>
>>> switch (exit_nr) {
>>> case BOOKE_INTERRUPT_EXTERNAL:
>>> - kvmppc_fill_pt_regs(®s);
>>> + kvmppc_fill_pt_regs(®s, exit_nr);
>>> do_IRQ(®s);
>>> break;
>>
>> exit_nr is not the same as the trap number that the rest of the kernel
>> wants to see.
>
> It's not? What does the kernel want to see then?
Remember the commit message in the e500mc patchset about an
undocumented, unnamed mess of magic numbers?
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: PPC: BookE: Include trap in pt_regs
2012-05-17 20:58 ` Scott Wood
@ 2012-05-17 21:03 ` Alexander Graf
2012-05-17 21:08 ` Scott Wood
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Graf @ 2012-05-17 21:03 UTC (permalink / raw)
To: Scott Wood; +Cc: kvm-ppc, kvm list
On 17.05.2012, at 22:58, Scott Wood wrote:
> On 05/17/2012 03:56 PM, Alexander Graf wrote:
>>
>> On 17.05.2012, at 18:37, Scott Wood wrote:
>>
>>> On 05/16/2012 08:25 AM, Alexander Graf wrote:
>>>> When reinjecting host interrupt requests in the exit handler code,
>>>> let's also tell the interrupt handler which interrupt number we're
>>>> coming from.
>>>>
>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>> ---
>>>> arch/powerpc/kvm/booke.c | 12 +++++++-----
>>>> 1 files changed, 7 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
>>>> index 72f13f4..0512bd7 100644
>>>> --- a/arch/powerpc/kvm/booke.c
>>>> +++ b/arch/powerpc/kvm/booke.c
>>>> @@ -596,7 +596,8 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
>>>> }
>>>> }
>>>>
>>>> -static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>>>> +static void kvmppc_fill_pt_regs(struct pt_regs *regs,
>>>> + int exit_nr)
>>>> {
>>>> ulong r1, ip, msr, lr;
>>>>
>>>> @@ -610,6 +611,7 @@ static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>>>> regs->nip = ip;
>>>> regs->msr = msr;
>>>> regs->link = lr;
>>>> + regs->trap = exit_nr;
>>>> }
>>>>
>>>> static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>>>> @@ -619,16 +621,16 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>>>>
>>>> switch (exit_nr) {
>>>> case BOOKE_INTERRUPT_EXTERNAL:
>>>> - kvmppc_fill_pt_regs(®s);
>>>> + kvmppc_fill_pt_regs(®s, exit_nr);
>>>> do_IRQ(®s);
>>>> break;
>>>
>>> exit_nr is not the same as the trap number that the rest of the kernel
>>> wants to see.
>>
>> It's not? What does the kernel want to see then?
>
> Remember the commit message in the e500mc patchset about an
> undocumented, unnamed mess of magic numbers?
Yeah. So in KVM we're using the IVOR numbers, right? Any reason we can't do the same for the generic handler? That should simplify the code significantly, no?
I guess I should've checked on this a bit deeper - book3s does the above already :).
Alex
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: PPC: BookE: Include trap in pt_regs
2012-05-17 21:03 ` Alexander Graf
@ 2012-05-17 21:08 ` Scott Wood
0 siblings, 0 replies; 6+ messages in thread
From: Scott Wood @ 2012-05-17 21:08 UTC (permalink / raw)
To: Alexander Graf; +Cc: kvm-ppc, kvm list
On 05/17/2012 04:03 PM, Alexander Graf wrote:
>
> On 17.05.2012, at 22:58, Scott Wood wrote:
>
>> On 05/17/2012 03:56 PM, Alexander Graf wrote:
>>>
>>> On 17.05.2012, at 18:37, Scott Wood wrote:
>>>
>>>> On 05/16/2012 08:25 AM, Alexander Graf wrote:
>>>>> When reinjecting host interrupt requests in the exit handler code,
>>>>> let's also tell the interrupt handler which interrupt number we're
>>>>> coming from.
>>>>>
>>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>> ---
>>>>> arch/powerpc/kvm/booke.c | 12 +++++++-----
>>>>> 1 files changed, 7 insertions(+), 5 deletions(-)
>>>>>
>>>>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
>>>>> index 72f13f4..0512bd7 100644
>>>>> --- a/arch/powerpc/kvm/booke.c
>>>>> +++ b/arch/powerpc/kvm/booke.c
>>>>> @@ -596,7 +596,8 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
>>>>> }
>>>>> }
>>>>>
>>>>> -static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>>>>> +static void kvmppc_fill_pt_regs(struct pt_regs *regs,
>>>>> + int exit_nr)
>>>>> {
>>>>> ulong r1, ip, msr, lr;
>>>>>
>>>>> @@ -610,6 +611,7 @@ static void kvmppc_fill_pt_regs(struct pt_regs *regs)
>>>>> regs->nip = ip;
>>>>> regs->msr = msr;
>>>>> regs->link = lr;
>>>>> + regs->trap = exit_nr;
>>>>> }
>>>>>
>>>>> static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>>>>> @@ -619,16 +621,16 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>>>>>
>>>>> switch (exit_nr) {
>>>>> case BOOKE_INTERRUPT_EXTERNAL:
>>>>> - kvmppc_fill_pt_regs(®s);
>>>>> + kvmppc_fill_pt_regs(®s, exit_nr);
>>>>> do_IRQ(®s);
>>>>> break;
>>>>
>>>> exit_nr is not the same as the trap number that the rest of the kernel
>>>> wants to see.
>>>
>>> It's not? What does the kernel want to see then?
>>
>> Remember the commit message in the e500mc patchset about an
>> undocumented, unnamed mess of magic numbers?
>
> Yeah. So in KVM we're using the IVOR numbers, right? Any reason we can't do the same for the generic handler? That should simplify the code significantly, no?
Yeah, I had that as a FIXME on the original patch. You just need to
make sure all users are updated, which is more difficult due to the fact
that they're just numbers and not symbolic names.
-Scott
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-17 21:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-16 13:25 [PATCH] KVM: PPC: BookE: Include trap in pt_regs Alexander Graf
2012-05-17 16:37 ` Scott Wood
2012-05-17 20:56 ` Alexander Graf
2012-05-17 20:58 ` Scott Wood
2012-05-17 21:03 ` Alexander Graf
2012-05-17 21:08 ` Scott Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox