linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Matthew Rosato <mjrosato@linux.ibm.com>,
	joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
	gerald.schaefer@linux.ibm.com
Cc: hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com,
	svens@linux.ibm.com, borntraeger@linux.ibm.com, clg@redhat.com,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH v3 1/5] iommu/s390: set appropriate IOTA region type
Date: Tue, 11 Mar 2025 12:49:54 +0100	[thread overview]
Message-ID: <196e9ec24f59bd419abab314c41f95f1cb8b9545.camel@linux.ibm.com> (raw)
In-Reply-To: <20250228214456.440641-2-mjrosato@linux.ibm.com>

On Fri, 2025-02-28 at 16:44 -0500, Matthew Rosato wrote:
> When registering the I/O Translation Anchor, use the current table type
> stored in the s390_domain to set the appropriate region type
> indication.  For the moment, the table type will always be stored as
> region third.
> 
> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
>  drivers/iommu/s390-iommu.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
> index e1c76e0f9c2b..cad032d4c9a6 100644
> --- a/drivers/iommu/s390-iommu.c
> +++ b/drivers/iommu/s390-iommu.c
> @@ -31,6 +31,7 @@ struct s390_domain {
>  	unsigned long		*dma_table;
>  	spinlock_t		list_lock;
>  	struct rcu_head		rcu;
> +	u8			origin_type;
>  };
>  
>  static struct iommu_domain blocking_domain;
> @@ -345,6 +346,7 @@ static struct iommu_domain *s390_domain_alloc_paging(struct device *dev)
>  	s390_domain->domain.geometry.force_aperture = true;
>  	s390_domain->domain.geometry.aperture_start = 0;
>  	s390_domain->domain.geometry.aperture_end = ZPCI_TABLE_SIZE_RT - 1;
> +	s390_domain->origin_type = ZPCI_TABLE_TYPE_RTX;
>  
>  	spin_lock_init(&s390_domain->list_lock);
>  	INIT_LIST_HEAD_RCU(&s390_domain->devices);
> @@ -381,6 +383,21 @@ static void zdev_s390_domain_update(struct zpci_dev *zdev,
>  	spin_unlock_irqrestore(&zdev->dom_lock, flags);
>  }
>  
> +static u64 get_iota_region_flag(struct s390_domain *domain)
> +{
> +	switch (domain->origin_type) {
> +	case ZPCI_TABLE_TYPE_RTX:
> +		return ZPCI_IOTA_RTTO_FLAG;
> +	case ZPCI_TABLE_TYPE_RSX:
> +		return ZPCI_IOTA_RSTO_FLAG;
> +	case ZPCI_TABLE_TYPE_RFX:
> +		return ZPCI_IOTA_RFTO_FLAG;
> +	default:
> +		WARN_ONCE(1, "Invalid IOMMU table (%x)\n", domain->origin_type);
> +		return 0;
> +	}
> +}
> +
>  static int s390_iommu_domain_reg_ioat(struct zpci_dev *zdev,
>  				      struct iommu_domain *domain, u8 *status)
>  {
> @@ -399,7 +416,7 @@ static int s390_iommu_domain_reg_ioat(struct zpci_dev *zdev,
>  	default:
>  		s390_domain = to_s390_domain(domain);
>  		iota = virt_to_phys(s390_domain->dma_table) |
> -		       ZPCI_IOTA_RTTO_FLAG;
> +		       get_iota_region_flag(s390_domain);
>  		rc = zpci_register_ioat(zdev, 0, zdev->start_dma,
>  					zdev->end_dma, iota, status);
>  	}

Thanks for moving the table type into struct s390_domain I like how
this fits together with the identity domain support and overall
responsibilities now!

Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>

  reply	other threads:[~2025-03-11 11:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 21:44 [PATCH v3 0/5] iommu/s390: support additional table regions Matthew Rosato
2025-02-28 21:44 ` [PATCH v3 1/5] iommu/s390: set appropriate IOTA region type Matthew Rosato
2025-03-11 11:49   ` Niklas Schnelle [this message]
2025-02-28 21:44 ` [PATCH v3 2/5] iommu/s390: support cleanup of additional table regions Matthew Rosato
2025-03-11 12:01   ` Niklas Schnelle
2025-02-28 21:44 ` [PATCH v3 3/5] iommu/s390: support iova_to_phys for " Matthew Rosato
2025-03-11 14:19   ` Niklas Schnelle
2025-02-28 21:44 ` [PATCH v3 4/5] iommu/s390: support map/unmap " Matthew Rosato
2025-02-28 21:44 ` [PATCH v3 5/5] iommu/s390: allow larger region tables Matthew Rosato

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=196e9ec24f59bd419abab314c41f95f1cb8b9545.camel@linux.ibm.com \
    --to=schnelle@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjrosato@linux.ibm.com \
    --cc=robin.murphy@arm.com \
    --cc=svens@linux.ibm.com \
    --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;
as well as URLs for NNTP newsgroup(s).