From: Paolo Bonzini <pbonzini@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>, qemu-devel@nongnu.org
Cc: Michael Kinney <michael.d.kinney@intel.com>,
Jordan Justen <jordan.l.justen@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] hw/isa/lpc_ich9: inject the SMI on the VCPU that is writing to APM_CNT
Date: Wed, 21 Oct 2015 11:49:13 +0200 [thread overview]
Message-ID: <56275F99.6000008@redhat.com> (raw)
In-Reply-To: <1445364840-7056-1-git-send-email-lersek@redhat.com>
On 20/10/2015 20:14, Laszlo Ersek wrote:
> Commit 4d00636e97b7 ("ich9: Add the lpc chip", Nov 14 2012) added the
> ich9_apm_ctrl_changed() ioport write callback function such that it would
> inject the SMI, in response to a write to the APM_CNT register, on the
> first CPU, invariably.
>
> Since this register is used by guest code to trigger an SMI synchronously,
> the interrupt should be injected on the VCPU that is performing the write.
>
> apm_ioport_writeb() is the .write callback of the "apm_ops"
> MemoryRegionOps [hw/isa/apm.c]; it is parametrized to call
> ich9_apm_ctrl_changed() by ich9_lpc_init() [hw/isa/lpc_ich9.c], via
> apm_init(). Therefore this change affects no other board.
>
> ich9_generate_smi() is an unrelated function that is called by the TCO
> watchdog; a watchdog is likely in its right to (asynchronously) inject
> interrupts on the first CPU only.
>
> This patch allows the combined edk2/OVMF SMM driver stack to work with
> multiple VCPUs on TCG, using both qemu-system-i386 and qemu-system-x86_64.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Michael Kinney <michael.d.kinney@intel.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> hw/isa/lpc_ich9.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
> index 360699f..1ffc803 100644
> --- a/hw/isa/lpc_ich9.c
> +++ b/hw/isa/lpc_ich9.c
> @@ -394,7 +394,7 @@ static void ich9_apm_ctrl_changed(uint32_t val, void *arg)
>
> /* SMI_EN = PMBASE + 30. SMI control and enable register */
> if (lpc->pm.smi_en & ICH9_PMIO_SMI_EN_APMC_EN) {
> - cpu_interrupt(first_cpu, CPU_INTERRUPT_SMI);
> + cpu_interrupt(current_cpu, CPU_INTERRUPT_SMI);
> }
> }
>
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
The same issue happens on PIIX4. I can fix it as the change is a bit
more involved (it goes through a qemu_irq).
Paolo
next prev parent reply other threads:[~2015-10-21 9:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 18:14 [Qemu-devel] [PATCH] hw/isa/lpc_ich9: inject the SMI on the VCPU that is writing to APM_CNT Laszlo Ersek
2015-10-21 9:49 ` Paolo Bonzini [this message]
2015-10-21 10:29 ` Michael S. Tsirkin
2015-10-21 18:36 ` Jordan Justen
2015-10-22 8:40 ` Paolo Bonzini
2015-10-22 9:50 ` Laszlo Ersek
2015-10-22 9:54 ` Paolo Bonzini
2015-10-22 18:04 ` Kevin O'Connor
2015-10-22 19:46 ` Paolo Bonzini
2015-10-23 4:41 ` Jordan Justen
2015-10-23 7:26 ` Paolo Bonzini
2015-10-23 12:53 ` Laszlo Ersek
2015-10-23 18:20 ` Jordan Justen
2015-10-23 18:24 ` Paolo Bonzini
2015-10-23 21:25 ` Laszlo Ersek
2015-10-23 16:54 ` Kevin O'Connor
2015-10-23 17:00 ` Paolo Bonzini
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=56275F99.6000008@redhat.com \
--to=pbonzini@redhat.com \
--cc=jordan.l.justen@intel.com \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=michael.d.kinney@intel.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).