Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-27 Thread Peter Maydell
On 27 May 2013 11:45, Paolo Bonzini wrote: > It is possible to do it. > As in other cases, I prefer no code to untested code. The design is > sane (it isn't mine, so I can say it :)) and we know it can be done. Agreed; we're a long way from being able to make use of this. > Almost, I have an a

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-27 Thread Paolo Bonzini
Il 27/05/2013 12:33, Peter Maydell ha scritto: > On 27 May 2013 09:19, Paolo Bonzini wrote: >> Il 27/05/2013 09:23, Jan Kiszka ha scritto: >>> Err, why? Will we emulate IOMMUs for TCG differently? >> >> Because IOMMUs should never be added to address_space_memory. >> >> TCG should only encounter a

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-27 Thread Peter Maydell
On 27 May 2013 09:19, Paolo Bonzini wrote: > Il 27/05/2013 09:23, Jan Kiszka ha scritto: >> Err, why? Will we emulate IOMMUs for TCG differently? > > Because IOMMUs should never be added to address_space_memory. > > TCG should only encounter an IOMMU during device emulation (DMA), not > because of

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-27 Thread Jan Kiszka
On 2013-05-27 10:19, Paolo Bonzini wrote: > Il 27/05/2013 09:23, Jan Kiszka ha scritto: >> On 2013-05-27 09:20, Paolo Bonzini wrote: >>> Il 26/05/2013 11:02, Jan Kiszka ha scritto: >> >> Nice patches. Only one thing, how is .impl.unaligned different >> from the existing .valid.unaligne

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-27 Thread Paolo Bonzini
Il 27/05/2013 09:23, Jan Kiszka ha scritto: > On 2013-05-27 09:20, Paolo Bonzini wrote: >> Il 26/05/2013 11:02, Jan Kiszka ha scritto: > > Nice patches. Only one thing, how is .impl.unaligned different > from the existing .valid.unaligned? >>> See memory.h: valid controls is an unalign

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-27 Thread Jan Kiszka
On 2013-05-27 09:20, Paolo Bonzini wrote: > Il 26/05/2013 11:02, Jan Kiszka ha scritto: Nice patches. Only one thing, how is .impl.unaligned different from the existing .valid.unaligned? >> See memory.h: valid controls is an unaligned access traps or gets >> processed, impl manages

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-27 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 26/05/2013 11:02, Jan Kiszka ha scritto: >>> >>> Nice patches. Only one thing, how is .impl.unaligned different >>> from the existing .valid.unaligned? > See memory.h: valid controls is an unaligned access traps or gets > processed, impl manages

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-26 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 26/05/2013 11:12, Jan Kiszka ha scritto: > On 2013-05-26 11:01, Paolo Bonzini wrote: >> Il 25/05/2013 13:30, Jan Kiszka ha scritto: >>> On 2013-05-25 13:20, Paolo Bonzini wrote: Il 25/05/2013 12:19, Jan Kiszka ha scritto: > addr -= section-

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-26 Thread Jan Kiszka
On 2013-05-26 11:01, Paolo Bonzini wrote: > Il 25/05/2013 13:30, Jan Kiszka ha scritto: >> On 2013-05-25 13:20, Paolo Bonzini wrote: >>> Il 25/05/2013 12:19, Jan Kiszka ha scritto: addr -= section->offset_within_address_space; -len = MIN(section->size - addr, len); >>> ^^^

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-26 Thread Jan Kiszka
On 2013-05-26 10:56, Paolo Bonzini wrote: > Il 25/05/2013 13:30, Jan Kiszka ha scritto: >> On 2013-05-25 13:20, Paolo Bonzini wrote: >>> Il 25/05/2013 12:19, Jan Kiszka ha scritto: addr -= section->offset_within_address_space; -len = MIN(section->size - addr, len); >>> ^^^

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-26 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 25/05/2013 13:30, Jan Kiszka ha scritto: > On 2013-05-25 13:20, Paolo Bonzini wrote: >> Il 25/05/2013 12:19, Jan Kiszka ha scritto: >>> addr -= section->offset_within_address_space; -len = >>> MIN(section->size - addr, len); >> ^

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-26 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 25/05/2013 13:30, Jan Kiszka ha scritto: > On 2013-05-25 13:20, Paolo Bonzini wrote: >> Il 25/05/2013 12:19, Jan Kiszka ha scritto: >>> addr -= section->offset_within_address_space; -len = >>> MIN(section->size - addr, len); >> ^

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-25 Thread Jan Kiszka
On 2013-05-25 13:20, Paolo Bonzini wrote: > Il 25/05/2013 12:19, Jan Kiszka ha scritto: >> addr -= section->offset_within_address_space; >> -len = MIN(section->size - addr, len); > ^ > > This is the size of a section minus an offset in the s

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-25 Thread Paolo Bonzini
Il 25/05/2013 12:19, Jan Kiszka ha scritto: > addr -= section->offset_within_address_space; > -len = MIN(section->size - addr, len); ^ This is the size of a section minus an offset in the section. > +diff = int128_sub(section->mr->s

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-25 Thread Jan Kiszka
On 2013-05-25 09:47, Paolo Bonzini wrote: > Il 25/05/2013 08:40, Jan Kiszka ha scritto: >> On 2013-05-21 12:57, Paolo Bonzini wrote: >>> Using phys_page_find to translate an AddressSpace to a >>> MemoryRegionSection is unwieldy. It requires to pass the page >>> index rather than the address, and l

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-25 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 25/05/2013 08:40, Jan Kiszka ha scritto: > On 2013-05-21 12:57, Paolo Bonzini wrote: >> Using phys_page_find to translate an AddressSpace to a >> MemoryRegionSection is unwieldy. It requires to pass the page >> index rather than the address, and la

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-24 Thread Jan Kiszka
On 2013-05-21 12:57, Paolo Bonzini wrote: > Using phys_page_find to translate an AddressSpace to a MemoryRegionSection > is unwieldy. It requires to pass the page index rather than the address, > and later memory_region_section_addr has to be called. Replace > memory_region_section_addr with a fu

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-23 Thread Peter Maydell
On 21 May 2013 11:57, Paolo Bonzini wrote: > Using phys_page_find to translate an AddressSpace to a MemoryRegionSection > is unwieldy. It requires to pass the page index rather than the address, > and later memory_region_section_addr has to be called. Replace > memory_region_section_addr with a

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-23 Thread Paolo Bonzini
Il 23/05/2013 15:06, liu ping fan ha scritto: >> The idea is that address_space_translate gets a ref to the MemoryRegion, >> and the ref is then released by the caller of address_space_translate. >> > This will require subpage hold a reference to real mr. Hmm, that's right. Jan, that could be a c

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-23 Thread liu ping fan
On Thu, May 23, 2013 at 5:59 PM, Paolo Bonzini wrote: > Il 23/05/2013 09:09, liu ping fan ha scritto: >>> > void address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, >>> >int len, bool is_write) >>> > { >>> > -AddressSpaceDispatch *d = as->dispatch; >>> > -

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-23 Thread Paolo Bonzini
Il 23/05/2013 09:09, liu ping fan ha scritto: >> > void address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf, >> >int len, bool is_write) >> > { >> > -AddressSpaceDispatch *d = as->dispatch; >> > -int l; >> > +hwaddr l; >> > uint8_t *ptr; >> >

Re: [Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-23 Thread liu ping fan
On Tue, May 21, 2013 at 6:57 PM, Paolo Bonzini wrote: > Using phys_page_find to translate an AddressSpace to a MemoryRegionSection > is unwieldy. It requires to pass the page index rather than the address, > and later memory_region_section_addr has to be called. Replace > memory_region_section_a

[Qemu-devel] [PATCH 17/30] memory: add address_space_translate

2013-05-21 Thread Paolo Bonzini
Using phys_page_find to translate an AddressSpace to a MemoryRegionSection is unwieldy. It requires to pass the page index rather than the address, and later memory_region_section_addr has to be called. Replace memory_region_section_addr with a function that does all of it: call phys_page_find, c