Patchwork [v2,4/4] vga: compile cirrus_vga in hwlib

login
register
mail settings
Submitter Blue Swirl
Date Oct. 16, 2011, 4:51 p.m.
Message ID <CAAu8pHvcbjVJ3JgAT6JoLvrq5XXFYGm=JoQ0KBqVYbqEDuteLg@mail.gmail.com>
Download mbox | patch
Permalink /patch/120046/
State New
Headers show

Comments

Blue Swirl - Oct. 16, 2011, 4:51 p.m.
Remove target dependencies and compile Cirrus VGA in hwlib.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.objs   |    1 +
 Makefile.target |    1 -
 hw/cirrus_vga.c |    7 +++++--
 3 files changed, 6 insertions(+), 3 deletions(-)

     }
@@ -1897,7 +1900,7 @@ static void cirrus_mmio_blt_write(CirrusVGAState
* s, unsigned address,
  *
  *  write mode 4/5
  *
- * assume TARGET_PAGE_SIZE >= 16
+ * assume CIRRUS_PAGE_SIZE >= 16
  *
  ***************************************/
Avi Kivity - Oct. 16, 2011, 5:09 p.m.
On 10/16/2011 06:51 PM, Blue Swirl wrote:
> Remove target dependencies and compile Cirrus VGA in hwlib.
>
>
> +#define CIRRUS_PAGE_SIZE 4096
> +#define CIRRUS_PAGE_MASK (CIRRUS_PAGE_SIZE - 1)

This is inverted from TARGET_PAGE_MASK.

> +
>  #define BLTUNSAFE(s) \
>      ( \
>          ( /* check dst is within bounds */ \
> @@ -618,7 +621,7 @@ static void
> cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
>      for (y = 0; y < lines; y++) {
>  	off_cur = off_begin;
>  	off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask;
> -	off_cur &= TARGET_PAGE_MASK;
> +        off_cur &= CIRRUS_PAGE_MASK;
>          memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
>  	off_begin += off_pitch;
>      }

You can just drop this masking (and CIRRUS_PAGE_SIZE), provided that
cpu_physical_memory_range_set_dirty() accepts unaligned addresses.

Patch

From 11c65de30f7882b9acbaf2f47f181ed7f6344a2b Mon Sep 17 00:00:00 2001
Message-Id: <11c65de30f7882b9acbaf2f47f181ed7f6344a2b.1318783737.git.blauwirbel@gmail.com>
In-Reply-To: <b23f87c42ce7a6a5078ebb969bdb0dd8046f9578.1318783737.git.blauwirbel@gmail.com>
References: <b23f87c42ce7a6a5078ebb969bdb0dd8046f9578.1318783737.git.blauwirbel@gmail.com>
From: Blue Swirl <blauwirbel@gmail.com>
Date: Sun, 9 Oct 2011 09:58:00 +0000
Subject: [PATCH 4/4] vga: compile cirrus_vga in hwlib

Remove target dependencies and compile Cirrus VGA in hwlib.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.objs   |    1 +
 Makefile.target |    1 -
 hw/cirrus_vga.c |    7 +++++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile.objs b/Makefile.objs
index 44d9bb9..e98d74e 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -286,6 +286,7 @@  hw-obj-$(CONFIG_VGA_ISA) += vga-isa.o
 hw-obj-$(CONFIG_VGA_ISA_MM) += vga-isa-mm.o
 hw-obj-$(CONFIG_VMWARE_VGA) += vmware_vga.o
 hw-obj-$(CONFIG_VMMOUSE) += vmmouse.o
+hw-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o
 
 hw-obj-$(CONFIG_RC4030) += rc4030.o
 hw-obj-$(CONFIG_DP8393X) += dp8393x.o
diff --git a/Makefile.target b/Makefile.target
index b948acf..2401951 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -195,7 +195,6 @@  obj-$(CONFIG_KVM) += kvm.o kvm-all.o
 obj-$(CONFIG_NO_KVM) += kvm-stub.o
 obj-y += memory.o
 obj-$(CONFIG_VGA) += vga.o
-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o
 LIBS+=-lz
 
 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 846c8f5..709d89a 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -173,6 +173,9 @@ 
 
 #define CIRRUS_PNPMMIO_SIZE         0x1000
 
+#define CIRRUS_PAGE_SIZE 4096
+#define CIRRUS_PAGE_MASK (CIRRUS_PAGE_SIZE - 1)
+
 #define BLTUNSAFE(s) \
     ( \
         ( /* check dst is within bounds */ \
@@ -618,7 +621,7 @@  static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
     for (y = 0; y < lines; y++) {
 	off_cur = off_begin;
 	off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask;
-	off_cur &= TARGET_PAGE_MASK;
+        off_cur &= CIRRUS_PAGE_MASK;
         memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
 	off_begin += off_pitch;
     }
@@ -1897,7 +1900,7 @@  static void cirrus_mmio_blt_write(CirrusVGAState * s, unsigned address,
  *
  *  write mode 4/5
  *
- * assume TARGET_PAGE_SIZE >= 16
+ * assume CIRRUS_PAGE_SIZE >= 16
  *
  ***************************************/
 
-- 
1.7.2.5