From: Laszlo Ersek <lersek@redhat.com>
To: qemu devel list <qemu-devel@nongnu.org>
Cc: Kevin O'Connor <kevin@koconnor.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH v3 for-2.9 1/3] hw/isa/apm: introduce callback for APM_STS_IOPORT writes
Date: Fri, 18 Nov 2016 11:36:57 +0100 [thread overview]
Message-ID: <20161118103659.10448-2-lersek@redhat.com> (raw)
In-Reply-To: <20161118103659.10448-1-lersek@redhat.com>
In the following patches we'll add custom handling for when APM_STS_IOPORT
is written. Introduce a dedicated callback similar to the one that is now
called for APM_CNT_IOPORT writes.
Cc: "Kevin O'Connor" <kevin@koconnor.net>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
Notes:
v3:
- feature negotiation is new in v3 [Paolo, Michael]
include/hw/isa/apm.h | 9 +++++----
hw/acpi/piix4.c | 2 +-
hw/isa/apm.c | 15 ++++++++++-----
hw/isa/lpc_ich9.c | 2 +-
hw/isa/vt82c686.c | 2 +-
5 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/include/hw/isa/apm.h b/include/hw/isa/apm.h
index 4839ff1df252..8fc83addde4e 100644
--- a/include/hw/isa/apm.h
+++ b/include/hw/isa/apm.h
@@ -5,19 +5,20 @@
#include "hw/hw.h"
#include "exec/memory.h"
-typedef void (*apm_ctrl_changed_t)(uint32_t val, void *arg);
+typedef void (*apm_reg_changed_t)(uint32_t val, void *arg);
typedef struct APMState {
uint8_t apmc;
uint8_t apms;
- apm_ctrl_changed_t callback;
+ apm_reg_changed_t cnt_callback;
+ apm_reg_changed_t sts_callback;
void *arg;
MemoryRegion io;
} APMState;
-void apm_init(PCIDevice *dev, APMState *s, apm_ctrl_changed_t callback,
- void *arg);
+void apm_init(PCIDevice *dev, APMState *s, apm_reg_changed_t cnt_callback,
+ apm_reg_changed_t sts_callback, void *arg);
extern const VMStateDescription vmstate_apm;
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 2adc246b0044..bc4087f5f6ef 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -493,7 +493,7 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)
pci_conf[0x3d] = 0x01; // interrupt pin 1
/* APM */
- apm_init(dev, &s->apm, apm_ctrl_changed, s);
+ apm_init(dev, &s->apm, apm_ctrl_changed, NULL, s);
if (!s->smm_enabled) {
/* Mark SMM as already inited to prevent SMM from running. KVM does not
diff --git a/hw/isa/apm.c b/hw/isa/apm.c
index e232b0da033a..67e05b9932d6 100644
--- a/hw/isa/apm.c
+++ b/hw/isa/apm.c
@@ -47,11 +47,15 @@ static void apm_ioport_writeb(void *opaque, hwaddr addr, uint64_t val,
if (addr == 0) {
apm->apmc = val;
- if (apm->callback) {
- (apm->callback)(val, apm->arg);
+ if (apm->cnt_callback) {
+ apm->cnt_callback(val, apm->arg);
}
} else {
apm->apms = val;
+
+ if (apm->sts_callback) {
+ apm->sts_callback(val, apm->arg);
+ }
}
}
@@ -90,10 +94,11 @@ static const MemoryRegionOps apm_ops = {
},
};
-void apm_init(PCIDevice *dev, APMState *apm, apm_ctrl_changed_t callback,
- void *arg)
+void apm_init(PCIDevice *dev, APMState *apm, apm_reg_changed_t cnt_callback,
+ apm_reg_changed_t sts_callback, void *arg)
{
- apm->callback = callback;
+ apm->cnt_callback = cnt_callback;
+ apm->sts_callback = sts_callback;
apm->arg = arg;
/* ioport 0xb2, 0xb3 */
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 10d1ee8b9310..e3556c9f9eae 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -634,7 +634,7 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
lpc->isa_bus = isa_bus;
ich9_cc_init(lpc);
- apm_init(d, &lpc->apm, ich9_apm_ctrl_changed, lpc);
+ apm_init(d, &lpc->apm, ich9_apm_ctrl_changed, NULL, lpc);
lpc->machine_ready.notify = ich9_lpc_machine_ready;
qemu_add_machine_init_done_notifier(&lpc->machine_ready);
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 41d5254f8e55..eb5258597b1d 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -365,7 +365,7 @@ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp)
pm_smbus_init(&s->dev.qdev, &s->smb);
memory_region_add_subregion(get_system_io(), s->smb_io_base, &s->smb.io);
- apm_init(dev, &s->apm, NULL, s);
+ apm_init(dev, &s->apm, NULL, NULL, s);
memory_region_init(&s->io, OBJECT(dev), "vt82c686-pm", 64);
memory_region_set_enabled(&s->io, false);
--
2.9.2
next prev parent reply other threads:[~2016-11-18 10:37 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-18 10:36 [Qemu-devel] [PATCH v3 for-2.9 0/3] q35: add negotiable broadcast SMI Laszlo Ersek
2016-11-18 10:36 ` Laszlo Ersek [this message]
2016-11-18 10:36 ` [Qemu-devel] [PATCH v3 for-2.9 2/3] hw/isa/lpc_ich9: add SMI feature negotiation via APM_STS Laszlo Ersek
2016-11-18 10:36 ` [Qemu-devel] [PATCH v3 for-2.9 3/3] hw/isa/lpc_ich9: ICH9_APM_STS_F_BROADCAST_SMI: inject SMI on all VCPUs Laszlo Ersek
2016-11-18 14:10 ` [Qemu-devel] [PATCH v3 for-2.9 0/3] q35: add negotiable broadcast SMI Michael S. Tsirkin
2016-11-23 15:48 ` Laszlo Ersek
2016-11-23 22:35 ` Paolo Bonzini
2016-11-24 0:01 ` Laszlo Ersek
2016-11-24 0:31 ` Laszlo Ersek
2016-11-24 0:38 ` Kevin O'Connor
2016-11-24 4:29 ` Michael S. Tsirkin
2016-11-24 8:37 ` Laszlo Ersek
2016-11-25 4:00 ` Michael S. Tsirkin
2016-11-25 12:31 ` Laszlo Ersek
2016-11-25 12:40 ` Laszlo Ersek
2016-11-28 9:01 ` Gerd Hoffmann
2016-11-28 10:22 ` Laszlo Ersek
2016-11-28 11:53 ` Paolo Bonzini
2016-11-25 14:22 ` Igor Mammedov
2016-11-24 14:55 ` Igor Mammedov
2016-11-24 17:05 ` Paolo Bonzini
2016-11-24 18:02 ` Igor Mammedov
2016-11-25 8:55 ` Paolo Bonzini
2016-11-25 14:10 ` Igor Mammedov
2016-11-28 9:41 ` Paolo Bonzini
2016-11-28 11:24 ` Igor Mammedov
2016-11-28 11:51 ` 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=20161118103659.10448-2-lersek@redhat.com \
--to=lersek@redhat.com \
--cc=kevin@koconnor.net \
--cc=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@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).