From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTMEJ-0004qn-Ox for qemu-devel@nongnu.org; Wed, 23 Nov 2011 18:27:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTMEI-0004tQ-QW for qemu-devel@nongnu.org; Wed, 23 Nov 2011 18:27:51 -0500 Received: from mail-yw0-f45.google.com ([209.85.213.45]:35122) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTMEI-0004tL-O5 for qemu-devel@nongnu.org; Wed, 23 Nov 2011 18:27:50 -0500 Received: by ywf7 with SMTP id 7so2243714ywf.4 for ; Wed, 23 Nov 2011 15:27:49 -0800 (PST) Message-ID: <4ECD8172.2040405@codemonkey.ws> Date: Wed, 23 Nov 2011 17:27:46 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1322083230-853-1-git-send-email-sw@weilnetz.de> <20111123222616.GF29994@redhat.com> In-Reply-To: <20111123222616.GF29994@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1.0 (resend)] eepro100: Fix alignment requirement for statistical counters List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Stefan Weil , qemu-devel@nongnu.org On 11/23/2011 04:26 PM, Michael S. Tsirkin wrote: > On Wed, Nov 23, 2011 at 10:20:30PM +0100, Stefan Weil wrote: >> According to Intel's Open Source Software Developer Manual, >> the dump counters address must be Dword aligned. >> >> The new code enforces this alignment, so s->statsaddr may now >> be used with stw_le_pci_dma() and stl_le_pci_dma(). >> >> Signed-off-by: Stefan Weil > > Anthiny, coul you apply pls? Yup. Regards, Anthony Liguori > >> --- >> hw/eepro100.c | 10 +++++++++- >> 1 files changed, 9 insertions(+), 1 deletions(-) >> >> diff --git a/hw/eepro100.c b/hw/eepro100.c >> index 7d59e71..29ec5b4 100644 >> --- a/hw/eepro100.c >> +++ b/hw/eepro100.c >> @@ -976,7 +976,15 @@ static void eepro100_cu_command(EEPRO100State * s, uint8_t val) >> case CU_STATSADDR: >> /* Load dump counters address. */ >> s->statsaddr = e100_read_reg4(s, SCBPointer); >> - TRACE(OTHER, logout("val=0x%02x (status address)\n", val)); >> + TRACE(OTHER, logout("val=0x%02x (dump counters address)\n", val)); >> + if (s->statsaddr& 3) { >> + /* Memory must be Dword aligned. */ >> + logout("unaligned dump counters address\n"); >> + /* Handling of misaligned addresses is undefined. >> + * Here we align the address by ignoring the lower bits. */ >> + /* TODO: Test unaligned dump counter address on real hardware. */ >> + s->statsaddr&= ~3; >> + } >> break; >> case CU_SHOWSTATS: >> /* Dump statistical counters. */ >> -- >> 1.7.2.5 > >