From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/7] kvmtool: convert console backend to support bi-endianness
Date: Fri, 11 Oct 2013 15:36:31 +0100 [thread overview]
Message-ID: <1381502195-8263-4-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1381502195-8263-1-git-send-email-marc.zyngier@arm.com>
Advertise bi-endianness support in the feature flags, and provide
byte-swapping of the config structure depending on the guest selection.
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
tools/kvm/virtio/console.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/tools/kvm/virtio/console.c b/tools/kvm/virtio/console.c
index f982dab7..ac041df 100644
--- a/tools/kvm/virtio/console.c
+++ b/tools/kvm/virtio/console.c
@@ -126,12 +126,19 @@ static u8 *get_config(struct kvm *kvm, void *dev)
static u32 get_host_features(struct kvm *kvm, void *dev)
{
- return 0;
+ return VIRTIO_RING_ENDIAN;
}
static void set_guest_features(struct kvm *kvm, void *dev, u32 features)
{
- /* Unused */
+ struct con_dev *cdev = dev;
+ struct virtio_console_config *conf = &cdev->config;
+
+ cdev->features = features;
+
+ conf->cols = htole16(conf->cols);
+ conf->rows = htole16(conf->rows);
+ conf->max_nr_ports = htole32(conf->max_nr_ports);
}
static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 page_size, u32 align,
@@ -149,6 +156,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 page_size, u32 align,
p = virtio_get_vq(kvm, queue->pfn, page_size);
vring_init(&queue->vring, VIRTIO_CONSOLE_QUEUE_SIZE, p, align);
+ virt_queue__init(queue, cdev.features);
if (vq == VIRTIO_CONSOLE_TX_QUEUE) {
thread_pool__init_job(&cdev.jobs[vq], kvm, virtio_console_handle_callback, queue);
--
1.8.2.3
next prev parent reply other threads:[~2013-10-11 14:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 14:36 [PATCH 0/7] kvmtool: handle guests of a different endianness Marc Zyngier
2013-10-11 14:36 ` [PATCH 1/7] kvmtool: virt_queue configuration based on endianness Marc Zyngier
2013-10-11 14:36 ` [PATCH 2/7] kvmtool: virt_queue: handle guest endianness Marc Zyngier
2013-10-11 14:50 ` Will Deacon
2013-10-11 16:54 ` Robin Murphy
2013-10-11 14:36 ` Marc Zyngier [this message]
2013-10-11 14:36 ` [PATCH 4/7] kvmtool: convert 9p backend to support bi-endianness Marc Zyngier
2013-10-11 14:36 ` [PATCH 5/7] kvmtool: convert blk " Marc Zyngier
2013-10-11 14:36 ` [PATCH 6/7] kvmtool: convert net " Marc Zyngier
2013-10-11 14:36 ` [PATCH 7/7] kvmtool: virtio: enable arm/arm64 support for bi-endianness Marc Zyngier
2013-10-14 13:05 ` Paolo Bonzini
2013-10-14 13:17 ` Marc Zyngier
2013-10-11 14:54 ` [PATCH 0/7] kvmtool: handle guests of a different endianness Will Deacon
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=1381502195-8263-4-git-send-email-marc.zyngier@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).