Patchwork cirrus_vga: reset lfb_addr after a pci config write if the BAR is unmapped

login
register
mail settings
Submitter Stefano Stabellini
Date June 3, 2011, 3:56 p.m.
Message ID <1307116614-11775-2-git-send-email-stefano.stabellini@eu.citrix.com>
Download mbox | patch
Permalink /patch/98603/
State New
Headers show

Comments

Stefano Stabellini - June 3, 2011, 3:56 p.m.
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

If the cirrus_vga PCI BAR is unmapped than we should not only reset
map_addr but also lfb_addr, otherwise we'll keep trying to map
the old lfb_addr in map_linear_vram.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/cirrus_vga.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
Alexander Graf - June 14, 2011, 1:54 p.m.
On 06/03/2011 05:56 PM, stefano.stabellini@eu.citrix.com wrote:
> From: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
>
> If the cirrus_vga PCI BAR is unmapped than we should not only reset
> map_addr but also lfb_addr, otherwise we'll keep trying to map
> the old lfb_addr in map_linear_vram.

The patch looks good to me, but I'd love to get an ack from someone who 
knows the cirrus code before committing it.


Alex

> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
> ---
>   hw/cirrus_vga.c |    5 ++++-
>   1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
> index 722cac7..3c5043e 100644
> --- a/hw/cirrus_vga.c
> +++ b/hw/cirrus_vga.c
> @@ -3088,8 +3088,11 @@ static void pci_cirrus_write_config(PCIDevice *d,
>       CirrusVGAState *s =&pvs->cirrus_vga;
>
>       pci_default_write_config(d, address, val, len);
> -    if (s->vga.map_addr&&  d->io_regions[0].addr == PCI_BAR_UNMAPPED)
> +    if (s->vga.map_addr&&  d->io_regions[0].addr == PCI_BAR_UNMAPPED) {
>           s->vga.map_addr = 0;
> +        s->vga.lfb_addr = 0;
> +        s->vga.lfb_end = 0;
> +    }
>       cirrus_update_memory_access(s);
>   }
>
Jan Kiszka - June 14, 2011, 4:25 p.m.
On 2011-06-14 15:54, Alexander Graf wrote:
> On 06/03/2011 05:56 PM, stefano.stabellini@eu.citrix.com wrote:
>> From: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
>>
>> If the cirrus_vga PCI BAR is unmapped than we should not only reset
>> map_addr but also lfb_addr, otherwise we'll keep trying to map
>> the old lfb_addr in map_linear_vram.
> 
> The patch looks good to me, but I'd love to get an ack from someone who
> knows the cirrus code before committing it.
> 

I'm not claiming to be the cirrus expert, but I've just walked through
all this vga mapping stuff: patch is correct.

Acked-by: Jan Kiszka <jan.kiszka@siemens.com>

> 
> Alex
> 
>> Signed-off-by: Stefano Stabellini<stefano.stabellini@eu.citrix.com>
>> ---
>>   hw/cirrus_vga.c |    5 ++++-
>>   1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
>> index 722cac7..3c5043e 100644
>> --- a/hw/cirrus_vga.c
>> +++ b/hw/cirrus_vga.c
>> @@ -3088,8 +3088,11 @@ static void pci_cirrus_write_config(PCIDevice *d,
>>       CirrusVGAState *s =&pvs->cirrus_vga;
>>
>>       pci_default_write_config(d, address, val, len);
>> -    if (s->vga.map_addr&&  d->io_regions[0].addr == PCI_BAR_UNMAPPED)
>> +    if (s->vga.map_addr&&  d->io_regions[0].addr == PCI_BAR_UNMAPPED) {
>>           s->vga.map_addr = 0;
>> +        s->vga.lfb_addr = 0;
>> +        s->vga.lfb_end = 0;
>> +    }
>>       cirrus_update_memory_access(s);
>>   }
>>

Patch

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 722cac7..3c5043e 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -3088,8 +3088,11 @@  static void pci_cirrus_write_config(PCIDevice *d,
     CirrusVGAState *s = &pvs->cirrus_vga;
 
     pci_default_write_config(d, address, val, len);
-    if (s->vga.map_addr && d->io_regions[0].addr == PCI_BAR_UNMAPPED)
+    if (s->vga.map_addr && d->io_regions[0].addr == PCI_BAR_UNMAPPED) {
         s->vga.map_addr = 0;
+        s->vga.lfb_addr = 0;
+        s->vga.lfb_end = 0;
+    }
     cirrus_update_memory_access(s);
 }