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

Re: [PATCH v2 03/18] IOMMU: have vendor code announce supported page sizes


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Tue, 21 Dec 2021 09:26:26 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nZCDI1ymsMQl9AbLjmEaUHlkqY8TSvs+a5ArH8SKz8s=; b=k2ND4x2z3MW/KdNH0dmC/CgoSQhfXqX3I2csmWyZClGX7PzTjkZC6d2e/Khbw2ql6cb7RK7UI00Gxr5JJOS0YwjN/HtTPsYvZ0evKtDf/TOQ27lAARlirvYuiwmYdIWjeAdLm8fagOe26egCrUQg+XPppbKd5i2JjP/99x9FNe9OmzaaIQJ9LuTxcxHQ0izRBc1i9taEx/eGlgUWLMSOLaxDtK5pnAxeDD+MHCHRWs9Q7uQExwqYK07rRkcw4+nh+fKFpPT5lLmENeswEqrIFbccwyA5IUD/sPxUkeQ0Pu7Qy2RVYoEZFmXhrUrL3qXZtjgNywnoLaIbSb1RqlSa+A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i4DXEOHbzQu0FbXlwpwox6HzHl5Txctnn5a/JKL0xChPMsb958iyPeXX0OZ0tWNu3Dg4oOHxthGZHXMOxe5eef7t4F0SgfeNDLFoEyCE0zX25dRtmDZJh2ftrGhZY6ZY2IJQT+vuLgOMXmq5dL92/f2K1UU9vAyB6b3AwhuzXBAyxCt6QOVLgbF1iEpOOOGdVozSrvqd9jGbFQW7dGLePgmehc0HNIaiSmkugZqmXneRRj0qC2APlnYNaItSZMJP7vuvE02CxLX8L5CHwrQ0u74D6Cph4DT4HIN+tQ/WcyO6Yc0OpqYUPm/Uv/027YLHU8LZ9tmWMu62b4bEKksqAg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Delivery-date: Tue, 21 Dec 2021 09:26:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXsSi8nS3gY9fgEUm/NXnQX6ocmqw9N1SA
  • Thread-topic: [PATCH v2 03/18] IOMMU: have vendor code announce supported page sizes

Hi Jan,

> On 24 Sep 2021, at 10:43 am, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> Generic code will use this information to determine what order values
> can legitimately be passed to the ->{,un}map_page() hooks. For now all
> ops structures simply get to announce 4k mappings (as base page size),
> and there is (and always has been) an assumption that this matches the
> CPU's MMU base page size (eventually we will want to permit IOMMUs with
> a base page size smaller than the CPU MMU's).
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx>

Regards,
Rahul
> 
> --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
> +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
> @@ -629,6 +629,7 @@ static void amd_dump_page_tables(struct
> }
> 
> static const struct iommu_ops __initconstrel _iommu_ops = {
> +    .page_sizes = PAGE_SIZE_4K,
>     .init = amd_iommu_domain_init,
>     .hwdom_init = amd_iommu_hwdom_init,
>     .quarantine_init = amd_iommu_quarantine_init,
> --- a/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> +++ b/xen/drivers/passthrough/arm/ipmmu-vmsa.c
> @@ -1298,6 +1298,7 @@ static void ipmmu_iommu_domain_teardown(
> 
> static const struct iommu_ops ipmmu_iommu_ops =
> {
> +    .page_sizes      = PAGE_SIZE_4K,
>     .init            = ipmmu_iommu_domain_init,
>     .hwdom_init      = ipmmu_iommu_hwdom_init,
>     .teardown        = ipmmu_iommu_domain_teardown,
> --- a/xen/drivers/passthrough/arm/smmu.c
> +++ b/xen/drivers/passthrough/arm/smmu.c
> @@ -2873,6 +2873,7 @@ static void arm_smmu_iommu_domain_teardo
> }
> 
> static const struct iommu_ops arm_smmu_iommu_ops = {
> +    .page_sizes = PAGE_SIZE_4K,
>     .init = arm_smmu_iommu_domain_init,
>     .hwdom_init = arm_smmu_iommu_hwdom_init,
>     .add_device = arm_smmu_dt_add_device_generic,
> --- a/xen/drivers/passthrough/arm/smmu-v3.c
> +++ b/xen/drivers/passthrough/arm/smmu-v3.c
> @@ -3426,7 +3426,8 @@ static void arm_smmu_iommu_xen_domain_te
> }
> 
> static const struct iommu_ops arm_smmu_iommu_ops = {
> -     .init           = arm_smmu_iommu_xen_domain_init,
> +     .page_sizes             = PAGE_SIZE_4K,
> +     .init                   = arm_smmu_iommu_xen_domain_init,
>       .hwdom_init             = arm_smmu_iommu_hwdom_init,
>       .teardown               = arm_smmu_iommu_xen_domain_teardown,
>       .iotlb_flush            = arm_smmu_iotlb_flush,
> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -470,7 +470,17 @@ int __init iommu_setup(void)
> 
>     if ( iommu_enable )
>     {
> +        const struct iommu_ops *ops = NULL;
> +
>         rc = iommu_hardware_setup();
> +        if ( !rc )
> +            ops = iommu_get_ops();
> +        if ( ops && (ops->page_sizes & -ops->page_sizes) != PAGE_SIZE )
> +        {
> +            printk(XENLOG_ERR "IOMMU: page size mask %lx unsupported\n",
> +                   ops->page_sizes);
> +            rc = ops->page_sizes ? -EPERM : -ENODATA;
> +        }
>         iommu_enabled = (rc == 0);
>     }
> 
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -2806,6 +2806,7 @@ static int __init intel_iommu_quarantine
> }
> 
> static struct iommu_ops __initdata vtd_ops = {
> +    .page_sizes = PAGE_SIZE_4K,
>     .init = intel_iommu_domain_init,
>     .hwdom_init = intel_iommu_hwdom_init,
>     .quarantine_init = intel_iommu_quarantine_init,
> --- a/xen/include/xen/iommu.h
> +++ b/xen/include/xen/iommu.h
> @@ -231,6 +231,7 @@ struct page_info;
> typedef int iommu_grdm_t(xen_pfn_t start, xen_ulong_t nr, u32 id, void *ctxt);
> 
> struct iommu_ops {
> +    unsigned long page_sizes;
>     int (*init)(struct domain *d);
>     void (*hwdom_init)(struct domain *d);
>     int (*quarantine_init)(struct domain *d);
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.