fixes for 4.0: ohci and ati-vga

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJcmjG0AAoJEEy22O7T6HE4SQ0P/1gAKVtOJxlmDGkxjtDB8mse
 1euAPsPiYzz5kdEJvbt392iUBPT9K0YdV4kknYV5d9r4i51WlBLsQ6EJI7YCFn33
 fqkuvoUW2E0Nnbqtft0RG34sncitZ0Gf8SSXwd7R9tjdAec7Xujpm1Xxgh90exBf
 O7VmXGorhNgtrDaMroHtdGEA4QbYDSG/qqzdOe+WO4weVHnVOUjpnaI3zHcMDkKz
 cpuY6egtzsUuK8+4UmUZAbt62Nww9LvIfzT15JDvh4lFoEz7RumeAskW1R/PDeU1
 tMS9c2SBSY8Ow7bVyHZRGuG7+e9CGZW6/EuBfJfS6KgOcd13k73oDxDgXb+tkGMQ
 321V0bYKwGSdIudVvHMVt4Q8mo5eN9YREZ2A2MnnSqzRQrS37stWaXDFhImIl+5m
 s44wFbVLvNE3banH/U8g/pnwxbT6ly1XMp6sg45GxBgJgdHhbnY6ukjNIQV8B9E/
 ABY0oi2DA6LVKGJyDPgLwTpOTpN/68x2kg48g2CXhyPN8Os7NhMh0q9NcTczGdMv
 +a/wxFVF9TKy3ppdjQcWbVqYPEXZ6WH/wd/HaPrrcS5lP6JUkCBiwP2qfOlQFPbx
 uMo/2bht6Jm0yxsbS9rC+Jdi5YZB2SxWwMnxrwQDKIEH7k2eBQdVwoQwPtRHXTWC
 q/acSeoRs4sT8WofM6cZ
 =kkCx
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20190326-pull-request' into staging

fixes for 4.0: ohci and ati-vga

# gpg: Signature made Tue 26 Mar 2019 14:05:40 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/fixes-20190326-pull-request:
  ati-vga: Fix indexed access to video memory
  ohci: don't die on ED_LINK_LIMIT overflow

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-03-26 14:11:00 +00:00
commit 905870b53c
2 changed files with 7 additions and 18 deletions

View File

@ -235,12 +235,9 @@ static uint64_t ati_mm_read(void *opaque, hwaddr addr, unsigned int size)
case MM_DATA ... MM_DATA + 3:
/* indexed access to regs or memory */
if (s->regs.mm_index & BIT(31)) {
if (s->regs.mm_index <= s->vga.vram_size - size) {
int i = size - 1;
while (i >= 0) {
val <<= 8;
val |= s->vga.vram_ptr[s->regs.mm_index + i--];
}
uint32_t idx = s->regs.mm_index & ~BIT(31);
if (idx <= s->vga.vram_size - size) {
val = ldn_le_p(s->vga.vram_ptr + idx, size);
}
} else {
val = ati_mm_read(s, s->regs.mm_index + addr - MM_DATA, size);
@ -434,12 +431,9 @@ static void ati_mm_write(void *opaque, hwaddr addr,
case MM_DATA ... MM_DATA + 3:
/* indexed access to regs or memory */
if (s->regs.mm_index & BIT(31)) {
if (s->regs.mm_index <= s->vga.vram_size - size) {
int i = 0;
while (i < size) {
s->vga.vram_ptr[s->regs.mm_index + i] = data & 0xff;
data >>= 8;
}
uint32_t idx = s->regs.mm_index & ~BIT(31);
if (idx <= s->vga.vram_size - size) {
stn_le_p(s->vga.vram_ptr + idx, size, data);
}
} else {
ati_mm_write(s, s->regs.mm_index + addr - MM_DATA, data, size);

View File

@ -1200,7 +1200,7 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion)
if (head == 0)
return 0;
for (cur = head; cur; cur = next_ed) {
for (cur = head; cur && link_cnt++ < ED_LINK_LIMIT; cur = next_ed) {
if (ohci_read_ed(ohci, cur, &ed)) {
trace_usb_ohci_ed_read_error(cur);
ohci_die(ohci);
@ -1209,11 +1209,6 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head, int completion)
next_ed = ed.next & OHCI_DPTR_MASK;
if (++link_cnt > ED_LINK_LIMIT) {
ohci_die(ohci);
return 0;
}
if ((ed.head & OHCI_ED_H) || (ed.flags & OHCI_ED_K)) {
uint32_t addr;
/* Cancel pending packets for ED that have been paused. */