From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
Mark Cave-Ayland <mark.cave-ayland@ilade.co.uk>
Subject: [Qemu-devel] [PATCH for-2.3 6/6] ioport: reserve the whole range of an I/O port in the AddressSpace
Date: Mon, 30 Mar 2015 13:45:18 +0200 [thread overview]
Message-ID: <1427715918-25768-7-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1427715918-25768-1-git-send-email-pbonzini@redhat.com>
When an I/O port is more than 1 byte long, ioport.c is currently
creating "short" regions, for example 0x1ce-0x1ce for the 16-bit
Bochs index port. When I/O ports are memory mapped, and thus
accessed via a subpage_ops memory region, subpage_accepts gets
confused because it finds a hole at 0x1cf and rejects the access.
In order to fix this, modify registration of the region to cover
the whole size of the I/O port. Attempts to access an invalid
port will be blocked by find_portio returning NULL.
This only affects the VBE DISPI regions. For all other cases,
the MemoryRegionPortio entries for 2- or 4-byte accesses overlap
an entry for 1-byte accesses, thus the size of the memory region
is not affected.
Reported-by: Zoltan Balaton <balaton@eik.bme.hu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
ioport.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ioport.c b/ioport.c
index 090c262..304d5d6 100644
--- a/ioport.c
+++ b/ioport.c
@@ -269,7 +269,7 @@ void portio_list_add(PortioList *piolist,
/* Handle the first entry specially. */
off_last = off_low = pio_start->offset;
- off_high = off_low + pio_start->len;
+ off_high = off_low + pio_start->len + pio_start->size - 1;
count = 1;
for (pio = pio_start + 1; pio->size != 0; pio++, count++) {
@@ -284,10 +284,10 @@ void portio_list_add(PortioList *piolist,
/* ... and start collecting anew. */
pio_start = pio;
off_low = off_last;
- off_high = off_low + pio->len;
+ off_high = off_low + pio->len + pio_start->size - 1;
count = 0;
} else if (off_last + pio->len > off_high) {
- off_high = off_last + pio->len;
+ off_high = off_last + pio->len + pio_start->size - 1;
}
}
--
2.3.4
next prev parent reply other threads:[~2015-03-30 11:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-30 11:45 [Qemu-devel] [PATCH for-2.3 0/3] ioport fixes Paolo Bonzini
2015-03-30 11:45 ` [Qemu-devel] [PATCH for-2.3 1/6] sb16: remove useless mixer_write_indexw Paolo Bonzini
2015-03-31 11:19 ` Andreas Färber
2015-03-31 11:21 ` Paolo Bonzini
2015-03-30 11:45 ` [Qemu-devel] [PATCH for-2.3 2/6] gus: clean up MemoryRegionPortio Paolo Bonzini
2015-03-30 11:45 ` [Qemu-devel] [PATCH for-2.3 3/6] ide: there is only one data port Paolo Bonzini
2015-03-30 11:45 ` [Qemu-devel] [PATCH for-2.3 4/6] ioport: remove wrong comment Paolo Bonzini
2015-03-30 11:45 ` [Qemu-devel] [PATCH for-2.3 5/6] ioport: loosen assertions on emulation of 16-bit ports Paolo Bonzini
2015-03-30 11:45 ` Paolo Bonzini [this message]
2015-03-31 21:47 ` [Qemu-devel] [PATCH for-2.3 0/3] ioport fixes Mark Cave-Ayland
2015-04-01 9:10 ` Peter Maydell
2015-04-01 9:22 ` 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=1427715918-25768-7-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=mark.cave-ayland@ilade.co.uk \
--cc=peter.maydell@linaro.org \
--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).