Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-29 Thread Jason Wang
在 2022/1/24 下午5:20, Eugenio Perez Martin 写道: On Mon, Jan 24, 2022 at 5:33 AM Peter Xu wrote: On Fri, Jan 21, 2022 at 09:27:23PM +0100, Eugenio Pérez wrote: +int iova_tree_alloc(IOVATree *tree, DMAMap *map, hwaddr iova_begin, I forgot to s/iova_tree_alloc/iova_tree_alloc_map/ here. +

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-27 Thread Eugenio Perez Martin
On Fri, Jan 28, 2022 at 6:56 AM Jason Wang wrote: > > > 在 2022/1/28 上午11:57, Peter Xu 写道: > > On Thu, Jan 27, 2022 at 10:24:27AM +0100, Eugenio Perez Martin wrote: > >> On Thu, Jan 27, 2022 at 9:06 AM Peter Xu wrote: > >>> On Tue, Jan 25, 2022 at 10:40:01AM +0100, Eugenio Perez Martin wrote: > >>

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-27 Thread Jason Wang
在 2022/1/28 上午11:57, Peter Xu 写道: On Thu, Jan 27, 2022 at 10:24:27AM +0100, Eugenio Perez Martin wrote: On Thu, Jan 27, 2022 at 9:06 AM Peter Xu wrote: On Tue, Jan 25, 2022 at 10:40:01AM +0100, Eugenio Perez Martin wrote: So I think that the first step to remove complexity from the old one

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-27 Thread Peter Xu
On Thu, Jan 27, 2022 at 10:24:27AM +0100, Eugenio Perez Martin wrote: > On Thu, Jan 27, 2022 at 9:06 AM Peter Xu wrote: > > > > On Tue, Jan 25, 2022 at 10:40:01AM +0100, Eugenio Perez Martin wrote: > > > So I think that the first step to remove complexity from the old one > > > is to remove iova_b

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-27 Thread Eugenio Perez Martin
On Thu, Jan 27, 2022 at 9:06 AM Peter Xu wrote: > > On Tue, Jan 25, 2022 at 10:40:01AM +0100, Eugenio Perez Martin wrote: > > So I think that the first step to remove complexity from the old one > > is to remove iova_begin and iova_end. > > > > As Jason points out, removing iova_end is easier. It

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-27 Thread Peter Xu
On Tue, Jan 25, 2022 at 10:40:01AM +0100, Eugenio Perez Martin wrote: > So I think that the first step to remove complexity from the old one > is to remove iova_begin and iova_end. > > As Jason points out, removing iova_end is easier. It has the drawback > of having to traverse all the list beyond

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-25 Thread Eugenio Perez Martin
On Mon, Jan 24, 2022 at 12:08 PM Peter Xu wrote: > > On Mon, Jan 24, 2022 at 10:20:55AM +0100, Eugenio Perez Martin wrote: > > On Mon, Jan 24, 2022 at 5:33 AM Peter Xu wrote: > > > > > > On Fri, Jan 21, 2022 at 09:27:23PM +0100, Eugenio Pérez wrote: > > > > +int iova_tree_alloc(IOVATree *tree, DM

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-24 Thread Peter Xu
On Mon, Jan 24, 2022 at 10:20:55AM +0100, Eugenio Perez Martin wrote: > On Mon, Jan 24, 2022 at 5:33 AM Peter Xu wrote: > > > > On Fri, Jan 21, 2022 at 09:27:23PM +0100, Eugenio Pérez wrote: > > > +int iova_tree_alloc(IOVATree *tree, DMAMap *map, hwaddr iova_begin, > > I forgot to s/iova_tree_all

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-24 Thread Eugenio Perez Martin
On Mon, Jan 24, 2022 at 5:33 AM Peter Xu wrote: > > On Fri, Jan 21, 2022 at 09:27:23PM +0100, Eugenio Pérez wrote: > > +int iova_tree_alloc(IOVATree *tree, DMAMap *map, hwaddr iova_begin, I forgot to s/iova_tree_alloc/iova_tree_alloc_map/ here. > > +hwaddr iova_last) > > +{ >

Re: [PATCH 21/31] util: Add iova_tree_alloc

2022-01-23 Thread Peter Xu
On Fri, Jan 21, 2022 at 09:27:23PM +0100, Eugenio Pérez wrote: > +int iova_tree_alloc(IOVATree *tree, DMAMap *map, hwaddr iova_begin, > +hwaddr iova_last) > +{ > +const DMAMapInternal *last, *i; > + > +assert(iova_begin < iova_last); > + > +/* > + * Find a valid

[PATCH 21/31] util: Add iova_tree_alloc

2022-01-21 Thread Eugenio Pérez
This iova tree function allows it to look for a hole in allocated regions and return a totally new translation for a given translated address. It's usage is mainly to allow devices to access qemu address space, remapping guest's one into a new iova space where qemu can add chunks of addresses. Si