Linux IOMMU Development
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@redhat.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>,
	joro@8bytes.org, will@kernel.org, mst@redhat.com,
	jasowang@redhat.com
Cc: kevin.tian@intel.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, pasic@linux.ibm.com,
	iommu@lists.linux-foundation.org, sebastien.boeuf@intel.com
Subject: Re: [PATCH v2 3/5] iommu/virtio: Sort reserved regions
Date: Sat, 27 Nov 2021 18:09:45 +0100	[thread overview]
Message-ID: <96a911b2-abca-eee1-334b-52a5bb5a9b6e@redhat.com> (raw)
In-Reply-To: <20211123155301.1047943-4-jean-philippe@linaro.org>

Hi Jean,

On 11/23/21 4:53 PM, Jean-Philippe Brucker wrote:
> To ease identity mapping support, keep the list of reserved regions
> sorted.
>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>

Eric
> ---
>  drivers/iommu/virtio-iommu.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
> index ee8a7afd667b..d63ec4d11b00 100644
> --- a/drivers/iommu/virtio-iommu.c
> +++ b/drivers/iommu/virtio-iommu.c
> @@ -423,7 +423,7 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
>  	size_t size;
>  	u64 start64, end64;
>  	phys_addr_t start, end;
> -	struct iommu_resv_region *region = NULL;
> +	struct iommu_resv_region *region = NULL, *next;
>  	unsigned long prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
>  
>  	start = start64 = le64_to_cpu(mem->start);
> @@ -454,7 +454,12 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
>  	if (!region)
>  		return -ENOMEM;
>  
> -	list_add(&region->list, &vdev->resv_regions);
> +	/* Keep the list sorted */
> +	list_for_each_entry(next, &vdev->resv_regions, list) {
> +		if (next->start > region->start)
> +			break;
> +	}
> +	list_add_tail(&region->list, &next->list);
>  	return 0;
>  }
>  

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-11-27 17:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 15:52 [PATCH v2 0/5] iommu/virtio: Add identity domains Jean-Philippe Brucker
2021-11-23 15:52 ` [PATCH v2 1/5] iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG Jean-Philippe Brucker
2021-11-27  7:59   ` Eric Auger
2021-11-29 15:33     ` Jean-Philippe Brucker
2021-11-23 15:52 ` [PATCH v2 2/5] iommu/virtio: Support bypass domains Jean-Philippe Brucker
2021-11-27 16:18   ` Eric Auger
2021-11-29 15:36     ` Jean-Philippe Brucker
2021-11-23 15:53 ` [PATCH v2 3/5] iommu/virtio: Sort reserved regions Jean-Philippe Brucker
2021-11-27 17:09   ` Eric Auger [this message]
2021-11-23 15:53 ` [PATCH v2 4/5] iommu/virtio: Pass end address to viommu_add_mapping() Jean-Philippe Brucker
2021-11-27 17:09   ` Eric Auger
2021-11-27 23:09     ` Michael S. Tsirkin
2021-11-29 15:42       ` Jean-Philippe Brucker
2021-11-23 15:53 ` [PATCH v2 5/5] iommu/virtio: Support identity-mapped domains Jean-Philippe Brucker
2021-11-27 17:09   ` Eric Auger
2021-11-29 15:44     ` Jean-Philippe Brucker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96a911b2-abca-eee1-334b-52a5bb5a9b6e@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jasowang@redhat.com \
    --cc=jean-philippe@linaro.org \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=sebastien.boeuf@intel.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox