[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-1.7 v2 1/8] exec: declare TARGET_PHYS_ADDR_S
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH for-1.7 v2 1/8] exec: declare TARGET_PHYS_ADDR_SPACE_MAX to limit memory regions rendered by exec |
Date: |
Thu, 7 Nov 2013 14:04:08 +0200 |
On Thu, Nov 07, 2013 at 10:49:50AM +0000, Peter Maydell wrote:
> On 7 November 2013 10:41, Marcel Apfelbaum <address@hidden> wrote:
> > The page table logic in exec.c assumes
> > that memory addresses are at most TARGET_PHYS_ADDR_SPACE_BITS.
> > Use TARGET_PHYS_ADDR_SPACE_MAX as max size for memory regions
> > rendered by exec.
> >
> > Signed-off-by: Marcel Apfelbaum <address@hidden>
> > ---
> > include/exec/address-spaces.h | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h
> > index 3d12cdd..174cc05 100644
> > --- a/include/exec/address-spaces.h
> > +++ b/include/exec/address-spaces.h
> > @@ -23,6 +23,10 @@
> >
> > #ifndef CONFIG_USER_ONLY
> >
> > +#define TARGET_PHYS_ADDR_SPACE_MAX \
> > + (TARGET_PHYS_ADDR_SPACE_BITS == 64 ? \
> > + UINT64_MAX : (0x1ULL << TARGET_PHYS_ADDR_SPACE_BITS))
> > +
>
> I think it's worth adding a comment that this is a
> size intended for use in memory_region_init() calls and
> so follows the odd convention used by that API that
> it is a size in bytes with the exception that UINT64_MAX
> represents 2^64.
>
> (it follows from this that using the #define anywhere
> except in a memory_region_init() call is probably a bug)
>
> -- PMM
BTW how about we change the API to pass in int128?
Not for 1.7 of course.
This will help make sure it's only used for MRs.
--
MST
[Qemu-devel] [PATCH for-1.7 v2 3/8] hw/ppc: limit iommu-spapr memory size, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 4/8] exec: don't ignore high address bits on lookup, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 5/8] pci: fix address space size for bridge, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 7/8] pc: s/INT64_MAX/UINT64_MAX/, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 8/8] spapr_pci: s/INT64_MAX/UINT64_MAX/, Marcel Apfelbaum, 2013/11/07
[Qemu-devel] [PATCH for-1.7 v2 2/8] hw/alpha: limit iommu-typhoon memory size, Marcel Apfelbaum, 2013/11/07