Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-26 Thread David Gibson
On Sat, May 25, 2013 at 10:23:32AM +0100, Peter Maydell wrote: > On 25 May 2013 04:44, David Gibson wrote: > > On Fri, May 24, 2013 at 11:52:17AM +0100, Peter Maydell wrote: > >> So when *is* it a good idea to use this API? In real > >> hardware you don't usually get a "tell me whether this > >> a

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-25 Thread Peter Maydell
On 25 May 2013 04:44, David Gibson wrote: > On Fri, May 24, 2013 at 11:52:17AM +0100, Peter Maydell wrote: >> So when *is* it a good idea to use this API? In real >> hardware you don't usually get a "tell me whether this >> access would succeed if I did it" bus operation -- you >> just do the oper

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread David Gibson
On Fri, May 24, 2013 at 11:52:17AM +0100, Peter Maydell wrote: > On 24 May 2013 09:02, Paolo Bonzini wrote: > > Il 23/05/2013 20:04, Peter Maydell ha scritto: > >> Shouldn't we be calling the MemoryRegionOps > >> accepts() callback here? What about access alignment constraints > >> and access size

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Peter Maydell
On 24 May 2013 14:33, Paolo Bonzini wrote: > Il 24/05/2013 15:27, Peter Maydell ha scritto: >> On 24 May 2013 13:58, Paolo Bonzini wrote: >>> If it's okay >>> for you, I'll send a pull request up to "memory: clean up phys_page_find" >>> and go on with the next series. >> >> That's fine with me, b

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Paolo Bonzini
Il 24/05/2013 15:27, Peter Maydell ha scritto: > On 24 May 2013 13:58, Paolo Bonzini wrote: >> If it's okay >> for you, I'll send a pull request up to "memory: clean up phys_page_find" >> and go on with the next series. > > That's fine with me, but please don't forget to fix up > the doc comment

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Peter Maydell
On 24 May 2013 13:58, Paolo Bonzini wrote: > If it's okay > for you, I'll send a pull request up to "memory: clean up phys_page_find" > and go on with the next series. That's fine with me, but please don't forget to fix up the doc comment for memory_region_find() (see comments on patch 6/30). You

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Paolo Bonzini
Il 24/05/2013 12:52, Peter Maydell ha scritto: > On 24 May 2013 09:02, Paolo Bonzini wrote: >> Il 23/05/2013 20:04, Peter Maydell ha scritto: >>> Shouldn't we be calling the MemoryRegionOps >>> accepts() callback here? What about access alignment constraints >>> and access size restrictions? >> >>

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Jan Kiszka
On 2013-05-24 12:50, Peter Maydell wrote: > On 24 May 2013 07:13, Jan Kiszka wrote: >> I'll also have a use for it: replace isa_is_ioport_assigned. > > That seems like it's something different: it's asking > "has some other bit of QEMU registered a handler for > this ioport?", not "at this moment

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Peter Maydell
On 24 May 2013 09:02, Paolo Bonzini wrote: > Il 23/05/2013 20:04, Peter Maydell ha scritto: >> Shouldn't we be calling the MemoryRegionOps >> accepts() callback here? What about access alignment constraints >> and access size restrictions? > > Yes, we should. > >> What if the validity of the range

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Peter Maydell
On 24 May 2013 07:13, Jan Kiszka wrote: > I'll also have a use for it: replace isa_is_ioport_assigned. That seems like it's something different: it's asking "has some other bit of QEMU registered a handler for this ioport?", not "at this moment in time if I make an I/O access will it succeed?" (w

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Jan Kiszka
On 2013-05-24 08:13, Jan Kiszka wrote: > On 2013-05-23 20:04, Peter Maydell wrote: >> On 21 May 2013 11:57, Paolo Bonzini wrote: >>> +bool address_space_valid(AddressSpace *as, hwaddr addr, int len, bool >>> is_write) >>> +{ >>> +AddressSpaceDispatch *d = as->dispatch; >>> +MemoryRegionSe

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-24 Thread Paolo Bonzini
Il 23/05/2013 20:04, Peter Maydell ha scritto: > Shouldn't we be calling the MemoryRegionOps > accepts() callback here? What about access alignment constraints > and access size restrictions? Yes, we should. > What if the validity of the range > changes between the time you asked and when you act

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-23 Thread Jan Kiszka
On 2013-05-23 20:04, Peter Maydell wrote: > On 21 May 2013 11:57, Paolo Bonzini wrote: >> +bool address_space_valid(AddressSpace *as, hwaddr addr, int len, bool >> is_write) >> +{ >> +AddressSpaceDispatch *d = as->dispatch; >> +MemoryRegionSection *section; >> +int l; >> +hwaddr p

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-23 Thread Peter Maydell
On 21 May 2013 11:57, Paolo Bonzini wrote: > +bool address_space_valid(AddressSpace *as, hwaddr addr, int len, bool > is_write) > +{ > +AddressSpaceDispatch *d = as->dispatch; > +MemoryRegionSection *section; > +int l; > +hwaddr page; > + > +while (len > 0) { > +page =

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-23 Thread Paolo Bonzini
Il 23/05/2013 16:22, Jan Kiszka ha scritto: >>> >> The old-style IOMMU lets you check whether an access is valid in a >>> >> given DMAContext. There is no equivalent for AddressSpace in the >>> >> memory API, implement it with a lookup of the dispatch tree. >> > >> > I don't love the name - "addr

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-23 Thread Jan Kiszka
On 2013-05-23 14:05, David Gibson wrote: > On Tue, May 21, 2013 at 12:57:16PM +0200, Paolo Bonzini wrote: >> The old-style IOMMU lets you check whether an access is valid in a >> given DMAContext. There is no equivalent for AddressSpace in the >> memory API, implement it with a lookup of the dispa

Re: [Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-23 Thread David Gibson
On Tue, May 21, 2013 at 12:57:16PM +0200, Paolo Bonzini wrote: > The old-style IOMMU lets you check whether an access is valid in a > given DMAContext. There is no equivalent for AddressSpace in the > memory API, implement it with a lookup of the dispatch tree. I don't love the name - "address_sp

[Qemu-devel] [PATCH 15/30] memory: add address_space_valid

2013-05-21 Thread Paolo Bonzini
The old-style IOMMU lets you check whether an access is valid in a given DMAContext. There is no equivalent for AddressSpace in the memory API, implement it with a lookup of the dispatch tree. Signed-off-by: Paolo Bonzini --- dma-helpers.c | 5 + exec.c| 25