From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: mst@redhat.com
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
thuth@linux.vnet.ibm.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/2] virtio-ccw: assure BE accesses
Date: Wed, 11 Mar 2015 10:57:50 +0100 [thread overview]
Message-ID: <1426067871-17693-2-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1426067871-17693-1-git-send-email-cornelia.huck@de.ibm.com>
In-Reply-To: <20150310180526.2149b5c2.cornelia.huck@de.ibm.com>
All fields in structures transmitted by ccws are big endian; assure
we handle them as such.
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
hw/s390x/virtio-ccw.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 8b6b2ab..60f8a14 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -589,7 +589,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
if (!ccw.cda) {
ret = -EFAULT;
} else {
- indicators = ldq_phys(&address_space_memory, ccw.cda);
+ indicators = ldq_be_phys(&address_space_memory, ccw.cda);
dev->indicators = get_indicator(indicators, sizeof(uint64_t));
sch->curr_status.scsw.count = ccw.count - sizeof(indicators);
ret = 0;
@@ -609,7 +609,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
if (!ccw.cda) {
ret = -EFAULT;
} else {
- indicators = ldq_phys(&address_space_memory, ccw.cda);
+ indicators = ldq_be_phys(&address_space_memory, ccw.cda);
dev->indicators2 = get_indicator(indicators, sizeof(uint64_t));
sch->curr_status.scsw.count = ccw.count - sizeof(indicators);
ret = 0;
@@ -629,11 +629,11 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
if (!ccw.cda) {
ret = -EFAULT;
} else {
- vq_config.index = lduw_phys(&address_space_memory, ccw.cda);
+ vq_config.index = lduw_be_phys(&address_space_memory, ccw.cda);
vq_config.num_max = virtio_queue_get_num(vdev,
vq_config.index);
- stw_phys(&address_space_memory,
- ccw.cda + sizeof(vq_config.index), vq_config.num_max);
+ stw_be_phys(&address_space_memory,
+ ccw.cda + sizeof(vq_config.index), vq_config.num_max);
sch->curr_status.scsw.count = ccw.count - sizeof(vq_config);
ret = 0;
}
@@ -661,13 +661,17 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
if (!thinint) {
ret = -EFAULT;
} else {
+ uint64_t ind_bit = ldq_be_p(&thinint->ind_bit);
+
len = hw_len;
dev->summary_indicator =
- get_indicator(thinint->summary_indicator, sizeof(uint8_t));
- dev->indicators = get_indicator(thinint->device_indicator,
- thinint->ind_bit / 8 + 1);
+ get_indicator(ldq_be_p(&thinint->summary_indicator),
+ sizeof(uint8_t));
+ dev->indicators =
+ get_indicator(ldq_be_p(&thinint->device_indicator),
+ ind_bit / 8 + 1);
dev->thinint_isc = thinint->isc;
- dev->routes.adapter.ind_offset = thinint->ind_bit;
+ dev->routes.adapter.ind_offset = ind_bit;
dev->routes.adapter.summary_offset = 7;
cpu_physical_memory_unmap(thinint, hw_len, 0, hw_len);
ret = css_register_io_adapter(CSS_IO_ADAPTER_VIRTIO,
--
2.1.4
next prev parent reply other threads:[~2015-03-11 9:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-10 13:32 [Qemu-devel] [PATCH] virtio: avoid leading underscores for helpers Cornelia Huck
2015-03-10 14:12 ` Michael S. Tsirkin
2015-03-10 14:22 ` Cornelia Huck
2015-03-10 14:27 ` Michael S. Tsirkin
2015-03-10 16:03 ` Cornelia Huck
2015-03-10 16:34 ` Michael S. Tsirkin
2015-03-10 17:05 ` Cornelia Huck
2015-03-10 17:22 ` [Qemu-devel] [PATCH] virtio: legacy features callback Cornelia Huck
2015-03-11 9:57 ` [Qemu-devel] [PATCH 0/2] virtio-ccw: be accesses Cornelia Huck
2015-03-11 9:57 ` Cornelia Huck [this message]
2015-03-13 9:44 ` [Qemu-devel] [PATCH 1/2] virtio-ccw: assure BE accesses Cornelia Huck
2015-03-11 9:57 ` [Qemu-devel] [PATCH 2/2] virtio-ccw: assure be accesses for set-revision Cornelia Huck
2015-03-11 12:39 ` Thomas Huth
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=1426067871-17693-2-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@linux.vnet.ibm.com \
/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).