From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] stdvga cache always on
Date: Mon, 05 May 2008 16:40:06 +0100 [thread overview]
Message-ID: <481F2A56.601@eu.citrix.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 496 bytes --]
Hi all,
currently the hypervisor vga cache (stdvga.c) enables itself only in
graphical mode and in the a0000h-affffh range.
However there is no reason for this: it already allocates enought memory
to map the whole vram.
I am attaching a patch that implements the bank switching mechanism in
stdvga.c, allowing the cache to be always enabled when the emulated
graphic card is in VGA mode.
Best Regards,
Stefano Stabellini
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
[-- Attachment #2: stdvga-always-on --]
[-- Type: text/plain, Size: 3289 bytes --]
diff -r 483d006cc607 xen/arch/x86/hvm/stdvga.c
--- a/xen/arch/x86/hvm/stdvga.c Fri Apr 25 13:46:27 2008 +0100
+++ b/xen/arch/x86/hvm/stdvga.c Mon May 05 16:10:37 2008 +0100
@@ -132,13 +132,12 @@ static int stdvga_outb(uint64_t addr, ui
/* When in standard vga mode, emulate here all writes to the vram buffer
* so we can immediately satisfy reads without waiting for qemu. */
s->stdvga =
- (s->sr[7] == 0x00) && /* standard vga mode */
- (s->gr[6] == 0x05); /* misc graphics register w/ MemoryMapSelect=1
- * 0xa0000-0xaffff (64k region), AlphaDis=1 */
+ (s->sr[7] == 0x00); /* standard vga mode */
if ( !prev_stdvga && s->stdvga )
{
- s->cache = 1; /* (re)start caching video buffer */
+ s->cache = 1; /* (re)start caching video buffer.
+ * XXX In case of a restart the cache could be unsynced */
gdprintk(XENLOG_INFO, "entering stdvga and caching modes\n");
}
else if ( prev_stdvga && !s->stdvga )
@@ -187,13 +186,33 @@ static uint8_t stdvga_mem_readb(uint64_t
static uint8_t stdvga_mem_readb(uint64_t addr)
{
struct hvm_hw_stdvga *s = ¤t->domain->arch.hvm_domain.stdvga;
- int plane;
+ int memory_map_mode, plane;
uint32_t ret, *vram_l;
uint8_t *vram_b;
+ /* convert to VGA memory offset */
+ memory_map_mode = (s->gr[6] >> 2) & 3;
addr &= 0x1ffff;
- if ( addr >= 0x10000 )
- return 0xff;
+ switch(memory_map_mode) {
+ case 0:
+ break;
+ case 1:
+ if (addr >= 0x10000)
+ return 0xff;
+ addr += 0; // assume bank_offset == 0;
+ break;
+ case 2:
+ addr -= 0x10000;
+ if (addr >= 0x8000)
+ return 0xff;
+ break;
+ default:
+ case 3:
+ addr -= 0x18000;
+ if (addr >= 0x8000)
+ return 0xff;
+ break;
+ }
if ( s->sr[4] & 0x08 )
{
@@ -269,13 +288,33 @@ static void stdvga_mem_writeb(uint64_t a
static void stdvga_mem_writeb(uint64_t addr, uint32_t val)
{
struct hvm_hw_stdvga *s = ¤t->domain->arch.hvm_domain.stdvga;
- int plane, write_mode, b, func_select, mask;
+ int memory_map_mode, plane, write_mode, b, func_select, mask;
uint32_t write_mask, bit_mask, set_mask, *vram_l;
uint8_t *vram_b;
+ /* convert to VGA memory offset */
+ memory_map_mode = (s->gr[6] >> 2) & 3;
addr &= 0x1ffff;
- if ( addr >= 0x10000 )
- return;
+ switch(memory_map_mode) {
+ case 0:
+ break;
+ case 1:
+ if (addr >= 0x10000)
+ return;
+ addr += 0; // assume bank_offset == 0;
+ break;
+ case 2:
+ addr -= 0x10000;
+ if (addr >= 0x8000)
+ return;
+ break;
+ default:
+ case 3:
+ addr -= 0x18000;
+ if (addr >= 0x8000)
+ return;
+ break;
+ }
if ( s->sr[4] & 0x08 )
{
@@ -531,7 +570,7 @@ void stdvga_init(struct domain *d)
register_portio_handler(d, 0x3ce, 2, stdvga_intercept_pio);
/* MMIO. */
register_buffered_io_handler(
- d, 0xa0000, 0x10000, stdvga_intercept_mmio);
+ d, 0xa0000, 0x20000, stdvga_intercept_mmio);
}
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2008-05-05 15:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=481F2A56.601@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.