Re: [PATCH v2 1/6] iommu/s390: add initial fields to track table size
From: Niklas Schnelle
Date: Wed Feb 05 2025 - 10:09:09 EST
On Fri, 2025-01-24 at 15:18 -0500, Matthew Rosato wrote:
> In preparation for allowing for additional table levels, add the
> necessary information to the zdev and s390 domain to track table
> type. For now, these values will always be set to signify a
> region third table which is what s390-iommu always uses today.
>
> Signed-off-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>
> ---
> arch/s390/include/asm/pci.h | 2 ++
> drivers/iommu/s390-iommu.c | 17 +++++++++++------
> 2 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
> index 474e1f8d1d3c..8f8ebaeec60a 100644
> --- a/arch/s390/include/asm/pci.h
> +++ b/arch/s390/include/asm/pci.h
> @@ -189,6 +189,8 @@ struct zpci_dev {
> struct kvm_zdev *kzdev;
> struct mutex kzdev_lock;
> spinlock_t dom_lock; /* protect s390_domain change */
> + u64 max_table_size;
> + u8 origin_type;
I think ideally we would keep the origin_type in the struct s390_domain
only. For max_table_size I think we could just have an inline helper
returning the max table size given its origin_type, especially in
struct zpci_dev it feels wasteful to use 8 bytes in an already large
struct for something we can recalculate and that doesn't even change
often.