Re: [PATCH v3 1/5] iommu/s390: set appropriate IOTA region type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxx>





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux