From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoXuD-00070O-Hw for qemu-devel@nongnu.org; Thu, 05 Dec 2013 07:19:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoXu8-0002Hk-0G for qemu-devel@nongnu.org; Thu, 05 Dec 2013 07:19:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoXu7-0002Hf-OO for qemu-devel@nongnu.org; Thu, 05 Dec 2013 07:19:39 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB5CJcEV004980 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 5 Dec 2013 07:19:38 -0500 Message-ID: <52A06F58.2070005@redhat.com> Date: Thu, 05 Dec 2013 14:19:36 +0200 From: Uri Lublin MIME-Version: 1.0 References: <1385994239-19016-1-git-send-email-pbonzini@redhat.com> <1385995228-19585-1-git-send-email-pbonzini@redhat.com> In-Reply-To: <1385995228-19585-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/4] memory: cache min/max_access_size Reply-To: uril@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 12/02/2013 04:40 PM, Paolo Bonzini wrote: > This will simplify the code in the next patch. > > Signed-off-by: Paolo Bonzini > --- > include/exec/memory.h | 2 ++ > memory.c | 27 +++++++++++---------------- > 2 files changed, 13 insertions(+), 16 deletions(-) > > > typedef struct MemoryListener MemoryListener; > diff --git a/memory.c b/memory.c > index 28f6449..56e54aa 100644 > --- a/memory.c > +++ b/memory.c > @@ -443,8 +443,6 @@ static void memory_region_write_accessor(MemoryRegion *mr, > static void access_with_adjusted_size(hwaddr addr, > uint64_t *value, > unsigned size, > - unsigned access_size_min, > - unsigned access_size_max, > void (*access)(MemoryRegion *mr, > hwaddr addr, > uint64_t *value, > @@ -457,15 +455,8 @@ static void access_with_adjusted_size(hwaddr addr, > unsigned access_size; > unsigned i; > > - if (!access_size_min) { > - access_size_min = 1; > - } > - if (!access_size_max) { > - access_size_max = 4; > - } > - > /* FIXME: support unaligned access? */ > - access_size = MAX(MIN(size, access_size_max), access_size_min); > + access_size = MAX(MIN(size, mr->min_access_size), mr->min_access_size); Hi Paolo, Here it should be mr->max_access_size [ btw, MAX(MIN(a,b), b) = b ] Regards, Uri.