From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm@vger.kernel.org
Cc: Avi Kivity <avi@redhat.com>
Subject: qemu-kvm: testdev: add monitor device parameter
Date: Thu, 2 Sep 2010 20:45:07 -0300 [thread overview]
Message-ID: <20100902234507.GB30976@amt.cnet> (raw)
So we can connect this chardev to a monitor, for example using a socket.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
diff --git a/hw/testdev.c b/hw/testdev.c
index a8c49a3..2017798 100644
--- a/hw/testdev.c
+++ b/hw/testdev.c
@@ -5,6 +5,7 @@
struct testdev {
ISADevice dev;
CharDriverState *chr;
+ CharDriverState *mon;
};
static void test_device_serial_write(void *opaque, uint32_t addr, uint32_t data)
@@ -17,6 +18,16 @@ static void test_device_serial_write(void *opaque, uint32_t addr, uint32_t data)
}
}
+static void test_device_mon_write(void *opaque, uint32_t addr, uint32_t data)
+{
+ struct testdev *dev = opaque;
+ uint8_t buf[1] = { data };
+
+ if (dev->mon) {
+ qemu_chr_write(dev->mon, buf, 1);
+ }
+}
+
static void test_device_exit(void *opaque, uint32_t addr, uint32_t data)
{
exit(data);
@@ -96,6 +107,7 @@ static int init_test_device(ISADevice *isa)
int iomem;
register_ioport_write(0xf1, 1, 1, test_device_serial_write, dev);
+ register_ioport_write(0xf2, 1, 1, test_device_mon_write, dev);
register_ioport_write(0xf4, 1, 4, test_device_exit, dev);
register_ioport_read(0xd1, 1, 4, test_device_memsize_read, dev);
register_ioport_read(0xe0, 1, 1, test_device_ioport_read, dev);
@@ -117,6 +129,7 @@ static ISADeviceInfo testdev_info = {
.init = init_test_device,
.qdev.props = (Property[]) {
DEFINE_PROP_CHR("chardev", struct testdev, chr),
+ DEFINE_PROP_CHR("mon", struct testdev, mon),
DEFINE_PROP_END_OF_LIST(),
},
};
reply other threads:[~2010-09-03 17:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20100902234507.GB30976@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.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