* [Qemu-devel] [PATCH] ahci: fix lst+fis mapping
@ 2010-11-19 23:06 Gerd Hoffmann
2010-11-21 2:04 ` [Qemu-devel] " Alexander Graf
0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2010-11-19 23:06 UTC (permalink / raw)
To: qemu-devel; +Cc: agraf, Gerd Hoffmann
The ahci map_page() function checks whenever it got a full page mapped.
This is wrong. The data structures are much smaller: command list is
1k and fis is 256 bytes. Checking whenever we can access that much
bytes without crossing a page border is good enougth.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/ahci.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/ahci.c b/hw/ahci.c
index 0ee021e..fdd5572 100644
--- a/hw/ahci.c
+++ b/hw/ahci.c
@@ -411,16 +411,16 @@ static void ahci_check_irq(AHCIState *s)
}
}
-static void map_page(uint8_t **ptr, uint64_t addr)
+static void map_page(uint8_t **ptr, uint64_t addr, uint32_t wanted)
{
- target_phys_addr_t len = 4096;
+ target_phys_addr_t len = wanted;
if (*ptr) {
cpu_physical_memory_unmap(*ptr, 1, len, len);
}
*ptr = cpu_physical_memory_map(addr, &len, 1);
- if (len < 4096) {
+ if (len < wanted) {
*ptr = NULL;
}
}
@@ -435,22 +435,22 @@ static void ahci_port_write(AHCIState *s, int port, int offset, uint32_t val)
case PORT_LST_ADDR:
pr->lst_addr = val;
map_page(&s->dev[port].lst,
- ((uint64_t)pr->lst_addr_hi << 32) | pr->lst_addr);
+ ((uint64_t)pr->lst_addr_hi << 32) | pr->lst_addr, 1024);
break;
case PORT_LST_ADDR_HI:
pr->lst_addr_hi = val;
map_page(&s->dev[port].lst,
- ((uint64_t)pr->lst_addr_hi << 32) | pr->lst_addr);
+ ((uint64_t)pr->lst_addr_hi << 32) | pr->lst_addr, 1024);
break;
case PORT_FIS_ADDR:
pr->fis_addr = val;
map_page(&s->dev[port].res_fis,
- ((uint64_t)pr->fis_addr_hi << 32) | pr->fis_addr);
+ ((uint64_t)pr->fis_addr_hi << 32) | pr->fis_addr, 256);
break;
case PORT_FIS_ADDR_HI:
pr->fis_addr_hi = val;
map_page(&s->dev[port].res_fis,
- ((uint64_t)pr->fis_addr_hi << 32) | pr->fis_addr);
+ ((uint64_t)pr->fis_addr_hi << 32) | pr->fis_addr, 256);
break;
case PORT_IRQ_STAT:
pr->irq_stat &= ~val;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] ahci: fix lst+fis mapping
2010-11-19 23:06 [Qemu-devel] [PATCH] ahci: fix lst+fis mapping Gerd Hoffmann
@ 2010-11-21 2:04 ` Alexander Graf
2010-11-22 9:14 ` Gerd Hoffmann
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2010-11-21 2:04 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On 20.11.2010, at 00:06, Gerd Hoffmann wrote:
> The ahci map_page() function checks whenever it got a full page mapped.
> This is wrong. The data structures are much smaller: command list is
> 1k and fis is 256 bytes. Checking whenever we can access that much
> bytes without crossing a page border is good enougth.
Looks good :). Do you want me to incorporate this with the next revision of my patch set or keep it separate?
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] Re: [PATCH] ahci: fix lst+fis mapping
2010-11-21 2:04 ` [Qemu-devel] " Alexander Graf
@ 2010-11-22 9:14 ` Gerd Hoffmann
0 siblings, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2010-11-22 9:14 UTC (permalink / raw)
To: Alexander Graf; +Cc: qemu-devel
On 11/21/10 03:04, Alexander Graf wrote:
>
> On 20.11.2010, at 00:06, Gerd Hoffmann wrote:
>
>> The ahci map_page() function checks whenever it got a full page
>> mapped. This is wrong. The data structures are much smaller:
>> command list is 1k and fis is 256 bytes. Checking whenever we can
>> access that much bytes without crossing a page border is good
>> enougth.
>
> Looks good :). Do you want me to incorporate this with the next
> revision of my patch set or keep it separate?
Feel free to squash it in.
cheers,
Gerd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-22 9:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-19 23:06 [Qemu-devel] [PATCH] ahci: fix lst+fis mapping Gerd Hoffmann
2010-11-21 2:04 ` [Qemu-devel] " Alexander Graf
2010-11-22 9:14 ` Gerd Hoffmann
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).