stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses" has been added to the 4.4-stable tree
@ 2017-05-16 10:53 gregkh
  2017-05-17  6:59 ` Marc Zyngier
  0 siblings, 1 reply; 6+ messages in thread
From: gregkh @ 2017-05-16 10:53 UTC (permalink / raw)
  To: marc.zyngier, cdall, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From c667186f1c01ca8970c785888868b7ffd74e51ee Mon Sep 17 00:00:00 2001
From: Marc Zyngier <marc.zyngier@arm.com>
Date: Thu, 27 Apr 2017 19:06:48 +0100
Subject: arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses

From: Marc Zyngier <marc.zyngier@arm.com>

commit c667186f1c01ca8970c785888868b7ffd74e51ee upstream.

Our 32bit CP14/15 handling inherited some of the ARMv7 code for handling
the trapped system registers, completely missing the fact that the
fields for Rt and Rt2 are now 5 bit wide, and not 4...

Let's fix it, and provide an accessor for the most common Rt case.

Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/include/asm/kvm_emulate.h |    6 ++++++
 arch/arm64/kvm/sys_regs.c            |    8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -217,6 +217,12 @@ static inline u8 kvm_vcpu_trap_get_fault
 	return kvm_vcpu_get_hsr(vcpu) & ESR_ELx_FSC_TYPE;
 }
 
+static inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu)
+{
+	u32 esr = kvm_vcpu_get_hsr(vcpu);
+	return (esr & ESR_ELx_SYS64_ISS_RT_MASK) >> ESR_ELx_SYS64_ISS_RT_SHIFT;
+}
+
 static inline unsigned long kvm_vcpu_get_mpidr_aff(struct kvm_vcpu *vcpu)
 {
 	return vcpu_sys_reg(vcpu, MPIDR_EL1) & MPIDR_HWID_BITMASK;
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -1054,8 +1054,8 @@ static int kvm_handle_cp_64(struct kvm_v
 {
 	struct sys_reg_params params;
 	u32 hsr = kvm_vcpu_get_hsr(vcpu);
-	int Rt = (hsr >> 5) & 0xf;
-	int Rt2 = (hsr >> 10) & 0xf;
+	int Rt = kvm_vcpu_sys_get_rt(vcpu);
+	int Rt2 = (hsr >> 10) & 0x1f;
 
 	params.is_aarch32 = true;
 	params.is_32bit = false;
@@ -1106,7 +1106,7 @@ static int kvm_handle_cp_32(struct kvm_v
 {
 	struct sys_reg_params params;
 	u32 hsr = kvm_vcpu_get_hsr(vcpu);
-	int Rt  = (hsr >> 5) & 0xf;
+	int Rt  = kvm_vcpu_sys_get_rt(vcpu);
 
 	params.is_aarch32 = true;
 	params.is_32bit = true;
@@ -1221,7 +1221,7 @@ int kvm_handle_sys_reg(struct kvm_vcpu *
 {
 	struct sys_reg_params params;
 	unsigned long esr = kvm_vcpu_get_hsr(vcpu);
-	int Rt = (esr >> 5) & 0x1f;
+	int Rt = kvm_vcpu_sys_get_rt(vcpu);
 	int ret;
 
 	trace_kvm_handle_sys_reg(esr);


Patches currently in stable-queue which might be from marc.zyngier@arm.com are

queue-4.4/arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
queue-4.4/kvm-arm-arm64-fix-races-in-kvm_psci_vcpu_on.patch

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses" has been added to the 4.4-stable tree
  2017-05-16 10:53 gregkh
@ 2017-05-17  6:59 ` Marc Zyngier
  2017-05-17  8:33   ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2017-05-17  6:59 UTC (permalink / raw)
  To: gregkh; +Cc: cdall, stable, stable-commits

Hi Greg,

On Tue, May 16 2017 at 11:53:26 AM, <gregkh@linuxfoundation.org> wrote:
> This is a note to let you know that I've just added the patch titled
>
>     arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
>
> to the 4.4-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>
> The filename of the patch is:
>      arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
> and it can be found in the queue-4.4 subdirectory.
>
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.

Please drop this patch from 4.4, it doesn't compile (missing crucial
dependencies, reported by the kbuild robot). I'll provide an updated
patch early next week (unless someone beats me to it -- I'm traveling
ATM).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses" has been added to the 4.4-stable tree
  2017-05-17  6:59 ` Marc Zyngier
@ 2017-05-17  8:33   ` Greg KH
  2017-05-18  7:07     ` Marc Zyngier
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2017-05-17  8:33 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: cdall, stable, stable-commits

On Wed, May 17, 2017 at 07:59:05AM +0100, Marc Zyngier wrote:
> Hi Greg,
> 
> On Tue, May 16 2017 at 11:53:26 AM, <gregkh@linuxfoundation.org> wrote:
> > This is a note to let you know that I've just added the patch titled
> >
> >     arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
> >
> > to the 4.4-stable tree which can be found at:
> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> >
> > The filename of the patch is:
> >      arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
> > and it can be found in the queue-4.4 subdirectory.
> >
> > If you, or anyone else, feels it should not be added to the stable tree,
> > please let <stable@vger.kernel.org> know about it.
> 
> Please drop this patch from 4.4, it doesn't compile (missing crucial
> dependencies, reported by the kbuild robot). I'll provide an updated
> patch early next week (unless someone beats me to it -- I'm traveling
> ATM).

Ok, now dropped, thanks for letting me know.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses" has been added to the 4.4-stable tree
  2017-05-17  8:33   ` Greg KH
@ 2017-05-18  7:07     ` Marc Zyngier
  2017-05-18  7:20       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2017-05-18  7:07 UTC (permalink / raw)
  To: Greg KH; +Cc: cdall, stable, stable-commits

On Wed, May 17 2017 at 09:33:22 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, May 17, 2017 at 07:59:05AM +0100, Marc Zyngier wrote:
>> Hi Greg,
>> 
>> On Tue, May 16 2017 at 11:53:26 AM, <gregkh@linuxfoundation.org> wrote:
>> > This is a note to let you know that I've just added the patch titled
>> >
>> >     arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
>> >
>> > to the 4.4-stable tree which can be found at:
>> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
>> >
>> > The filename of the patch is:
>> >      arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
>> > and it can be found in the queue-4.4 subdirectory.
>> >
>> > If you, or anyone else, feels it should not be added to the stable tree,
>> > please let <stable@vger.kernel.org> know about it.
>> 
>> Please drop this patch from 4.4, it doesn't compile (missing crucial
>> dependencies, reported by the kbuild robot). I'll provide an updated
>> patch early next week (unless someone beats me to it -- I'm traveling
>> ATM).
>
> Ok, now dropped, thanks for letting me know.

Here's the updated patch that compiles for 4.4.

Thanks,

	M.

>From 8cafd49862b5f88f68392c4623ec2d275b573d53 Mon Sep 17 00:00:00 2001
From: Marc Zyngier <marc.zyngier@arm.com>
Date: Thu, 27 Apr 2017 19:06:48 +0100
Subject: [PATCH] arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP
 accesses

commit c667186f1c01ca8970c785888868b7ffd74e51ee upstream.

Our 32bit CP14/15 handling inherited some of the ARMv7 code for handling
the trapped system registers, completely missing the fact that the
fields for Rt and Rt2 are now 5 bit wide, and not 4...

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 arch/arm64/kvm/sys_regs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index d2650e8..c2489f6 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -1054,8 +1054,8 @@ static int kvm_handle_cp_64(struct kvm_vcpu *vcpu,
 {
 	struct sys_reg_params params;
 	u32 hsr = kvm_vcpu_get_hsr(vcpu);
-	int Rt = (hsr >> 5) & 0xf;
-	int Rt2 = (hsr >> 10) & 0xf;
+	int Rt = (hsr >> 5) & 0x1f;
+	int Rt2 = (hsr >> 10) & 0x1f;
 
 	params.is_aarch32 = true;
 	params.is_32bit = false;
@@ -1106,7 +1106,7 @@ static int kvm_handle_cp_32(struct kvm_vcpu *vcpu,
 {
 	struct sys_reg_params params;
 	u32 hsr = kvm_vcpu_get_hsr(vcpu);
-	int Rt  = (hsr >> 5) & 0xf;
+	int Rt  = (hsr >> 5) & 0x1f;
 
 	params.is_aarch32 = true;
 	params.is_32bit = true;
-- 
2.7.4


-- 
Jazz is not dead. It just smells funny.

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: Patch "arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses" has been added to the 4.4-stable tree
  2017-05-18  7:07     ` Marc Zyngier
@ 2017-05-18  7:20       ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2017-05-18  7:20 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: cdall, stable, stable-commits

On Thu, May 18, 2017 at 08:07:27AM +0100, Marc Zyngier wrote:
> On Wed, May 17 2017 at 09:33:22 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, May 17, 2017 at 07:59:05AM +0100, Marc Zyngier wrote:
> >> Hi Greg,
> >> 
> >> On Tue, May 16 2017 at 11:53:26 AM, <gregkh@linuxfoundation.org> wrote:
> >> > This is a note to let you know that I've just added the patch titled
> >> >
> >> >     arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
> >> >
> >> > to the 4.4-stable tree which can be found at:
> >> >     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> >> >
> >> > The filename of the patch is:
> >> >      arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
> >> > and it can be found in the queue-4.4 subdirectory.
> >> >
> >> > If you, or anyone else, feels it should not be added to the stable tree,
> >> > please let <stable@vger.kernel.org> know about it.
> >> 
> >> Please drop this patch from 4.4, it doesn't compile (missing crucial
> >> dependencies, reported by the kbuild robot). I'll provide an updated
> >> patch early next week (unless someone beats me to it -- I'm traveling
> >> ATM).
> >
> > Ok, now dropped, thanks for letting me know.
> 
> Here's the updated patch that compiles for 4.4.

Thanks, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Patch "arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses" has been added to the 4.4-stable tree
@ 2017-05-18  7:20 gregkh
  0 siblings, 0 replies; 6+ messages in thread
From: gregkh @ 2017-05-18  7:20 UTC (permalink / raw)
  To: marc.zyngier, cdall, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From c667186f1c01ca8970c785888868b7ffd74e51ee Mon Sep 17 00:00:00 2001
From: Marc Zyngier <marc.zyngier@arm.com>
Date: Thu, 27 Apr 2017 19:06:48 +0100
Subject: arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses

From: Marc Zyngier <marc.zyngier@arm.com>

commit c667186f1c01ca8970c785888868b7ffd74e51ee upstream.

Our 32bit CP14/15 handling inherited some of the ARMv7 code for handling
the trapped system registers, completely missing the fact that the
fields for Rt and Rt2 are now 5 bit wide, and not 4...

Let's fix it, and provide an accessor for the most common Rt case.

Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kvm/sys_regs.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -1054,8 +1054,8 @@ static int kvm_handle_cp_64(struct kvm_v
 {
 	struct sys_reg_params params;
 	u32 hsr = kvm_vcpu_get_hsr(vcpu);
-	int Rt = (hsr >> 5) & 0xf;
-	int Rt2 = (hsr >> 10) & 0xf;
+	int Rt = (hsr >> 5) & 0x1f;
+	int Rt2 = (hsr >> 10) & 0x1f;
 
 	params.is_aarch32 = true;
 	params.is_32bit = false;
@@ -1106,7 +1106,7 @@ static int kvm_handle_cp_32(struct kvm_v
 {
 	struct sys_reg_params params;
 	u32 hsr = kvm_vcpu_get_hsr(vcpu);
-	int Rt  = (hsr >> 5) & 0xf;
+	int Rt  = (hsr >> 5) & 0x1f;
 
 	params.is_aarch32 = true;
 	params.is_32bit = true;


Patches currently in stable-queue which might be from marc.zyngier@arm.com are

queue-4.4/arm64-kvm-fix-decoding-of-rt-rt2-when-trapping-aarch32-cp-accesses.patch
queue-4.4/kvm-arm-arm64-fix-races-in-kvm_psci_vcpu_on.patch

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-18  7:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-18  7:20 Patch "arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses" has been added to the 4.4-stable tree gregkh
  -- strict thread matches above, loose matches on Subject: below --
2017-05-16 10:53 gregkh
2017-05-17  6:59 ` Marc Zyngier
2017-05-17  8:33   ` Greg KH
2017-05-18  7:07     ` Marc Zyngier
2017-05-18  7:20       ` Greg KH

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).