From patchwork Tue Oct 20 18:14:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 55334 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f72.google.com (mail-lf0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 2BF5423024 for ; Tue, 20 Oct 2015 18:14:41 +0000 (UTC) Received: by lfaz124 with SMTP id z124sf8385878lfa.0 for ; Tue, 20 Oct 2015 11:14:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=dsws6s4eOgvv162x7tcWW8deKuZk1c6aTRUtBnnS9ts=; b=KMUL5+rxRSQSX1z3WaNltN1RpHupVifc/Iv4stnG4hbgsshvB4aT4+COMM/sm8Wv30 QJfdasXJoBwI4fn9E8gP7vFiWakq1SKZQ8UZaHUcCyH3dfHTnVD9xQQvBp/c0F2XkmLF 35M2ij1x9pDpYLKqY3tjuRtZKRmQND57vLlmL75etQ1RaovAvKnm/WkLHIgkKaNEQq4X Z2mcA5+kZ4/fc/wmkiaAWovqQim0Wq0rcfK343pk3VsAndST9+05sQwwZaUH8S6JSR4k w6COUwYqCxAE6RDT8uzMlXBf0uYs4zF8mkWiXiyguTPPUyWdT0LKWpqcjWAuJHFj9YiH 17BQ== X-Gm-Message-State: ALoCoQmeEfN5uCKL+qEtyHa4fJtNtZAzKyOz5Jlao4sV1EPjNYJFW3F1uGUfkWx/awn/9pxDFck8 X-Received: by 10.112.198.33 with SMTP id iz1mr972996lbc.8.1445364879964; Tue, 20 Oct 2015 11:14:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.141.198 with SMTP id p189ls111967lfd.79.gmail; Tue, 20 Oct 2015 11:14:39 -0700 (PDT) X-Received: by 10.25.206.199 with SMTP id e190mr1750529lfg.39.1445364879520; Tue, 20 Oct 2015 11:14:39 -0700 (PDT) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id z128si3277033lfd.36.2015.10.20.11.14.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 11:14:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lffv3 with SMTP id v3so9987068lff.0 for ; Tue, 20 Oct 2015 11:14:39 -0700 (PDT) X-Received: by 10.25.38.9 with SMTP id m9mr1761254lfm.112.1445364879360; Tue, 20 Oct 2015 11:14:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2233901lbq; Tue, 20 Oct 2015 11:14:38 -0700 (PDT) X-Received: by 10.140.233.213 with SMTP id e204mr6136583qhc.43.1445364878523; Tue, 20 Oct 2015 11:14:38 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a77si3884225qge.70.2015.10.20.11.14.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 20 Oct 2015 11:14:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:47428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZobQk-0005KJ-7d for patch@linaro.org; Tue, 20 Oct 2015 14:14:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZobQI-00052S-3s for qemu-devel@nongnu.org; Tue, 20 Oct 2015 14:14:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZobQE-0002Et-Tq for qemu-devel@nongnu.org; Tue, 20 Oct 2015 14:14:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZobQE-0002Eo-O8 for qemu-devel@nongnu.org; Tue, 20 Oct 2015 14:14:06 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id C6B008E70B; Tue, 20 Oct 2015 18:14:05 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-48.phx2.redhat.com [10.3.113.48]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9KIE3e0012756; Tue, 20 Oct 2015 14:14:04 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org Date: Tue, 20 Oct 2015 20:14:00 +0200 Message-Id: <1445364840-7056-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Michael Kinney , Paolo Bonzini , "Michael S. Tsirkin" , Gerd Hoffmann , Jordan Justen Subject: [Qemu-devel] [PATCH] hw/isa/lpc_ich9: inject the SMI on the VCPU that is writing to APM_CNT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Cc: Gerd Hoffmann Cc: Jordan Justen Cc: Michael Kinney Cc: "Michael S. Tsirkin" Signed-off-by: Laszlo Ersek Reviewed-by: Paolo Bonzini --- 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); } }