From: Paolo Bonzini <pbonzini@redhat.com>
To: Wei Wang <wei.w.wang@intel.com>, kvm@vger.kernel.org
Cc: alex.williamson@redhat.com, Yang Zhang <yang.z.zhang@intel.com>
Subject: Re: [PATCH] KVM: x86: sync old tmr with ioapic to update
Date: Tue, 26 Aug 2014 12:58:56 +0200 [thread overview]
Message-ID: <53FC6870.3050303@redhat.com> (raw)
In-Reply-To: <1409070441-31239-1-git-send-email-wei.w.wang@intel.com>
Il 26/08/2014 18:27, Wei Wang ha scritto:
> kvm_ioapic_scan_entry() needs to update tmr. The previous lapic tmr value
> (old_tmr) needs to sync with ioapic to get an accurate updated tmr
> value before the updating work.
> + u32 irr[8];
> + u32 isr[8];
> + u32 old_tmr[8];
These do not need to be arrays. You can use a single variable for each
of irr, isr and old_tmr.
> int i;
>
> - for (i = 0; i < 8; i++)
> + for (i = 0; i < 8; i++) {
> + irr[i] = kvm_apic_get_reg(apic, APIC_IRR + 0x10 * i);
> + isr[i] = kvm_apic_get_reg(apic, APIC_ISR + 0x10 * i);
> + old_tmr[i] = kvm_apic_get_reg(apic, APIC_TMR + 0x10 * i);
> + tmr[i] = (~(irr[i] | isr[i]) & tmr[i])
> + | ((irr[i] | isr[i]) & old_tmr[i]);
Please do not modify the tmr array. Instead, use kvm_apic_get_reg in
the next patch to read the TMR.
Also, please add a comment about how the code works and why the old TMR
is used if IRR=1 || ISR=1.
Paolo
> apic_set_reg(apic, APIC_TMR + 0x10 * i, tmr[i]);
prev parent reply other threads:[~2014-08-26 10:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 16:27 [PATCH] KVM: x86: sync old tmr with ioapic to update Wei Wang
2014-08-26 10:58 ` Paolo Bonzini [this message]
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=53FC6870.3050303@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=wei.w.wang@intel.com \
--cc=yang.z.zhang@intel.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