From: Alex Williamson <alex.williamson@redhat.com>
To: alex.williamson@redhat.com, kvm@vger.kernel.org
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] vfio-pci: [NOT FOR COMMIT] Hack around HD5450 I/O port backdoor
Date: Mon, 07 Jan 2013 15:22:13 -0700 [thread overview]
Message-ID: <20130107222213.9460.44737.stgit@bling.home> (raw)
In-Reply-To: <20130107221001.9460.85677.stgit@bling.home>
This is a hack specific to my system which I haven't even attempted
to generalize yet. The ATI/AMD Radeon HD5450 VGA BIOS appears to have
a backdoor to determine the physical address of the device. It reads
a value matching the top byte of the I/O Port BAR from a register in
VGA I/O port space then uses in/out to that address during BIOS
execution. On my setup the I/O port BAR is at 0x4000 physically and
emulated for the guest at 0xc0000. So I simply look for this access
and replace 0x40 with 0xc0. That's enough for it to get through BIOS
init, but it's still only partially functional (no VGA text mode).
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio_pci.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/hw/vfio_pci.c b/hw/vfio_pci.c
index 846e8de..5db076f 100644
--- a/hw/vfio_pci.c
+++ b/hw/vfio_pci.c
@@ -1041,6 +1041,15 @@ static uint64_t vfio_legacy_read(void *opaque, hwaddr addr, unsigned size)
break;
}
+ /* XXX - Complete hardcoded hack, need to figure out how common this is and
+ * come up with a device quirk and match host phys to guest phys. This is
+ * only known to be needed for an ATI/AMD Radeon HD5450 which stores the
+ * upper byte of the I/O port address in this unused VGA I/O port register.
+ */
+ if (io->region_offset == 0x3c0 && addr == 3 && size == 1 && data == 0x40) {
+ data = 0xc0;
+ }
+
DPRINTF("%s(0x%"HWADDR_PRIx", %d) = 0x%"PRIx64"\n",
__func__, io->region_offset + addr, size, data);
prev parent reply other threads:[~2013-01-07 22:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-07 22:21 [Qemu-devel] [PATCH 0/3] Towards vfio-base VGA device assignment Alex Williamson
2013-01-07 22:22 ` [Qemu-devel] [PATCH 1/3] qemu: [NOT FOR COMMIT] Update linux headers for vfio VGA Alex Williamson
2013-01-07 22:22 ` [Qemu-devel] [PATCH 2/3] vfio-pci: [NOT FOR COMMIT] Add support for VGA MMIO and I/O port access Alex Williamson
2013-01-07 22:22 ` Alex Williamson [this message]
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=20130107222213.9460.44737.stgit@bling.home \
--to=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.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).