All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented
@ 2020-02-18  0:15 Julien Freche
  2020-02-18 15:31 ` [Bug 1863685] " Richard Henderson
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Julien Freche @ 2020-02-18  0:15 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to "Trap
data or unified cache maintenance instructions that operate by Set/Way."
Quoting the ARM manual:

If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

However, QEMU does not trap those instructions/registers. This was
tested on the branch master of the git repo.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  New

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

* [Bug 1863685] Re: ARM: HCR.TSW traps are not implemented
  2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
@ 2020-02-18 15:31 ` Richard Henderson
  2020-02-18 16:56 ` Richard Henderson
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2020-02-18 15:31 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: New => In Progress

** Changed in: qemu
     Assignee: (unassigned) => Richard Henderson (rth)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  In Progress

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

* [Bug 1863685] Re: ARM: HCR.TSW traps are not implemented
  2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
  2020-02-18 15:31 ` [Bug 1863685] " Richard Henderson
@ 2020-02-18 16:56 ` Richard Henderson
  2020-02-18 20:06 ` Julien Freche
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2020-02-18 16:56 UTC (permalink / raw)
  To: qemu-devel

Patch posted:
https://patchew.org/QEMU/20200218164717.12842-1-richard.henderson@linaro.org/

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  In Progress

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

* [Bug 1863685] Re: ARM: HCR.TSW traps are not implemented
  2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
  2020-02-18 15:31 ` [Bug 1863685] " Richard Henderson
  2020-02-18 16:56 ` Richard Henderson
@ 2020-02-18 20:06 ` Julien Freche
  2020-02-18 20:20 ` Julien Freche
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Julien Freche @ 2020-02-18 20:06 UTC (permalink / raw)
  To: qemu-devel

Thanks for the quick turn around! I tested both your patches together
(it's useful to have both to emulate set/way flushing inside a guest)
and I am getting something unexpected. At some point, we are trapping on
an access to DACR but ESR_EL2 doesn't seem to make a lot of sense:
0xfe00dc0. I am running a 32-bit Linux inside a VM.

Decoding it: Rt is set to 0xe which is LR_usr. Also, this is a read
operation. So, essentially the guest seems to try to set DACR to LR_usr
which seems unreasonable.

It could be an issue with the hypervisor on my side (I am running some
custom code). But, it's not obvious to me and the code behaves fine on
bare-metal. Is there a chance that ESR is not populated correctly?

In any case, I do see traps for set/way instructions so, from that point
of view, the patch is good.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  In Progress

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

* [Bug 1863685] Re: ARM: HCR.TSW traps are not implemented
  2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
                   ` (2 preceding siblings ...)
  2020-02-18 20:06 ` Julien Freche
@ 2020-02-18 20:20 ` Julien Freche
  2020-02-18 20:41 ` Richard Henderson
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Julien Freche @ 2020-02-18 20:20 UTC (permalink / raw)
  To: qemu-devel

Sorry, I meant the operation is a write (TVM is on). The result of the
operation is setting DACR to 0 so the guest stops progressing after
that.

Anyway, since the issue could also be on my side, I don't want to block
you with this.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  In Progress

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

* [Bug 1863685] Re: ARM: HCR.TSW traps are not implemented
  2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
                   ` (3 preceding siblings ...)
  2020-02-18 20:20 ` Julien Freche
@ 2020-02-18 20:41 ` Richard Henderson
  2020-02-18 21:03 ` Julien Freche
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2020-02-18 20:41 UTC (permalink / raw)
  To: qemu-devel

I can't think of any reason that DACR would have an incorrect
register value.  It would be treated as any other system register,
and there's only one code path involved.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  In Progress

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

* [Bug 1863685] Re: ARM: HCR.TSW traps are not implemented
  2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
                   ` (4 preceding siblings ...)
  2020-02-18 20:41 ` Richard Henderson
@ 2020-02-18 21:03 ` Julien Freche
  2020-03-10  9:05 ` Laurent Vivier
  2020-04-30 13:29 ` Laurent Vivier
  7 siblings, 0 replies; 9+ messages in thread
From: Julien Freche @ 2020-02-18 21:03 UTC (permalink / raw)
  To: qemu-devel

Makes sense. Debugging is on me then :) Both patches behave as expected,
thanks!

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  In Progress

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

* [Bug 1863685] Re: ARM: HCR.TSW traps are not implemented
  2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
                   ` (5 preceding siblings ...)
  2020-02-18 21:03 ` Julien Freche
@ 2020-03-10  9:05 ` Laurent Vivier
  2020-04-30 13:29 ` Laurent Vivier
  7 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2020-03-10  9:05 UTC (permalink / raw)
  To: qemu-devel

Fixed here:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=1803d2713b29

** Changed in: qemu
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  Fix Committed

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

* [Bug 1863685] Re: ARM: HCR.TSW traps are not implemented
  2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
                   ` (6 preceding siblings ...)
  2020-03-10  9:05 ` Laurent Vivier
@ 2020-04-30 13:29 ` Laurent Vivier
  7 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2020-04-30 13:29 UTC (permalink / raw)
  To: qemu-devel

** Changed in: qemu
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1863685

Title:
  ARM: HCR.TSW traps are not implemented

Status in QEMU:
  Fix Released

Bug description:
  On 32-bit and 64-bit ARM platforms, setting HCR.TSW is supposed to
  "Trap data or unified cache maintenance instructions that operate by
  Set/Way." Quoting the ARM manual:

  If EL1 is using AArch64 state, accesses to DC ISW, DC CSW, DC CISW are trapped to EL2, reported using EC syndrome value 0x18.
  If EL1 is using AArch32 state, accesses to DCISW, DCCSW, DCCISW are trapped to EL2, reported using EC syndrome value 0x03.

  However, QEMU does not trap those instructions/registers. This was
  tested on the branch master of the git repo.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1863685/+subscriptions


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

end of thread, other threads:[~2020-04-30 13:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18  0:15 [Bug 1863685] [NEW] ARM: HCR.TSW traps are not implemented Julien Freche
2020-02-18 15:31 ` [Bug 1863685] " Richard Henderson
2020-02-18 16:56 ` Richard Henderson
2020-02-18 20:06 ` Julien Freche
2020-02-18 20:20 ` Julien Freche
2020-02-18 20:41 ` Richard Henderson
2020-02-18 21:03 ` Julien Freche
2020-03-10  9:05 ` Laurent Vivier
2020-04-30 13:29 ` Laurent Vivier

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.