|
From: | Stefan Weil |
Subject: | Re: [Qemu-devel] [PATCH 05/14] eepro100: Use PCI DMA stub functions |
Date: | Sat, 05 Nov 2011 09:32:42 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15 |
On Wed, Nov 02, 2011 at 09:16:34AM +0200, Michael S. Tsirkin wrote:
On Mon, Oct 31, 2011 at 05:06:49PM +1100, David Gibson wrote:From: Eduard - Gabriel Munteanu <address@hidden>
[snip]
@@ -744,21 +713,26 @@ static void dump_statistics(EEPRO100State * s) * values which really matter. * Number of data should check configuration!!! */ - cpu_physical_memory_write(s->statsaddr, &s->statistics, s->stats_size); - e100_stl_le_phys(s->statsaddr + 0, s->statistics.tx_good_frames); - e100_stl_le_phys(s->statsaddr + 36, s->statistics.rx_good_frames); - e100_stl_le_phys(s->statsaddr + 48, s->statistics.rx_resource_errors);- e100_stl_le_phys(s->statsaddr + 60, s->statistics.rx_short_frame_errors);+ pci_dma_write(&s->dev, s->statsaddr, + (uint8_t *) &s->statistics, s->stats_size); + stl_le_pci_dma(&s->dev, s->statsaddr + 0, + s->statistics.tx_good_frames); + stl_le_pci_dma(&s->dev, s->statsaddr + 36, + s->statistics.rx_good_frames); + stl_le_pci_dma(&s->dev, s->statsaddr + 48, + s->statistics.rx_resource_errors); + stl_le_pci_dma(&s->dev, s->statsaddr + 60, + s->statistics.rx_short_frame_errors);This might introduce a bug: stlXX APIs assume aligned addresses, an address in statsaddr is user-controlled so I'm not sure it's always aligned. Why isn't the patch simply replacing cpu_physical_memory_read with pci_XXX ? Any cleanups should be done separately.
Hello, I just sent a patch for eepro100.c which enforces aligned addresses for s->statsaddr, so most of David's changes are now safe. Please include the patch in QEMU 1.0. Thanks, Stefan Weil
[Prev in Thread] | Current Thread | [Next in Thread] |