WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [QEMU] Correct PAGE_MASK definition

To: "Ian Jackson" <Ian.Jackson@xxxxxxxxxxxxx>
Subject: RE: [Xen-devel] [QEMU] Correct PAGE_MASK definition
From: "Han, Weidong" <weidong.han@xxxxxxxxx>
Date: Tue, 13 Nov 2007 19:54:43 +0800
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 13 Nov 2007 03:55:44 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <18233.32080.390881.57670@xxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <08DF4D958216244799FC84F3514D70F0BB2513@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <18233.32080.390881.57670@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acgl4KAniQii0+D5TwOMsduiSLcekgACbIvg
Thread-topic: [Xen-devel] [QEMU] Correct PAGE_MASK definition
Ian Jackson wrote:
> Han, Weidong writes ("[Xen-devel] [QEMU] Correct PAGE_MASK
> definition"): 
>> In tools/ioemu/hw/iommu.c, I found #define PAGE_MASK  (PAGE_SIZE -
>> 1), I think it's not correct.
> 
> Well, yes, but just changing the definition isn't correct either.
> This particular definition is used in only one place, in
> iommu_translate_pa:
> 
>     pa = ((pa & IOPTE_PAGE) << 4) + (addr & PAGE_MASK);
> 
> So here it is used as `the part of the address which specifies the
> location within the page' rather than `which specifies the page'.
> This is both confusing and inconsistent with most of the other things
> called *PAGE_MASK.
> 
> grepping xen-unstable shows similar confusion here:
>  extras/mini-os/include/ia64/efi.h:#define EFI_PAGE_MASK   0xFFF
>  tools/libxc/xc_ptrace.h:#define BSD_PAGE_MASK (PAGE_SIZE-1)
> 
> This confusion seems to be present in linux-2.6.18-xen.hg too (and I
> imagine these came from upstream):
>  arch/mips/boot/addinitrd.c:#define MIPS_PAGE_MASK    
>  (MIPS_PAGE_SIZE-1) drivers/media/dvb/b2c2/flexcop-usb.h:#define
>  V8_MEMORY_PAGE_MASK     0x7FFF drivers/mtd/nand/nand_base.c:#define
>  BBT_PAGE_MASK    0xffffff3f drivers/w1/slaves/w1_ds2433.c:#define
> W1_PAGE_MASK            0x1F 
> 
> Under these circumstances it may be best to just leave things be
> rather than try to make this consistent.  In any case if you change
> the definition you must change the point of use too.
> 

Agree, but inconsistent usage is not good after all.

-- Weidong

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>