Commit Message

This will allow the APIC core to file a TPR access report. Depending on
the accelerator and kernel irqchip mode, it will either be delivered
right away or queued for later reporting.
In TCG mode, we can restart the triggering instruction and can therefore
forward the event directly. KVM does not allows us to restart, so we
postpone the delivery of events recording in the user space APIC until
the current instruction is completed.
Note that KVM without in-kernel irqchip will report the address after
the instruction that triggered a write access. In contrast, read
accesses will return the precise information.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
cpu-all.h | 3 ++-
hw/apic.h | 2 ++
hw/apic_common.c | 4 ++++
target-i386/cpu.h | 11 +++++++++++
target-i386/helper.c | 19 +++++++++++++++++++
target-i386/kvm.c | 24 ++++++++++++++++++++++--
6 files changed, 60 insertions(+), 3 deletions(-)

Comments

On 02/14/2012 05:13 PM, Jan Kiszka wrote:
> Note that KVM without in-kernel irqchip will report the address after> the instruction that triggered a write access. In contrast, read> accesses will return the precise information.>
Well this is wierd. We could retro-doc one or the other behaviour, but
this-on-read-but-that-on-write is just too strange.
The documented way of dealing with this is to queue a signal and reenter
the guest. kvm will perform anything it needs to complete the
instruction (perhaps issuing more mmio, say if someone used movsd to
read the APIC) and then exit on the signal. By then rip will point
exactly after the instruction.

On 2012-02-16 16:21, Avi Kivity wrote:
> On 02/14/2012 05:13 PM, Jan Kiszka wrote:>> Note that KVM without in-kernel irqchip will report the address after>> the instruction that triggered a write access. In contrast, read>> accesses will return the precise information.>>> > Well this is wierd. We could retro-doc one or the other behaviour, but> this-on-read-but-that-on-write is just too strange.> > The documented way of dealing with this is to queue a signal and reenter> the guest. kvm will perform anything it needs to complete the> instruction (perhaps issuing more mmio, say if someone used movsd to> read the APIC) and then exit on the signal. By then rip will point> exactly after the instruction.
Hmm, true. And can trivially be changed (I'm injecting the event after
instruction completion). Will role out a new version.
Jan