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

Re: [PATCH v2 13/18] VT-d: allow use of superpage mappings


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 13 Dec 2021 12:54:15 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=GKgfQrXxZQAc0PxZZGbMy6H/JYMU6Jt1L+VZcUzZB/c=; b=NRQMyhXZ8VgZXkt9LmhPmRUjGkji7OErVIiE0NN5I1iHwivyficfGRXuIrZm8ZCPB92GxWgWDcLiEbJ8PjUqnKl4Ku+e1L925Paab2VOq1sJXQb4xxtg/a5VwfJBBs8dERtHFirrJxnkyxvQzJVsNgZeU69JsMcAG9efwt7BCBg9mnhnhryFnJivWY+I0yNlyjUoOl2HZWLR0/9aIhI8t+36CKNt8IounPVPe3jbSspzO1TSRmM4Z9zSHQ00Ulhziag/i3ef2PF//Hx3y7ndUmGzdBgc8hwxDrT7t1iri0W1pkUoG8Za8qe5rGsUwrrJjvlUuJU/xZvBKNS1F4tL0Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ARDvnfxHyjacoLiJLgW9TTSA8gwRALPPTLpDvJtI9m16h3J9kqzgNoS/XG2A8RpVzxyPCFnVBQcRL4NuEuTi/E4YTWSZCHUMfB7ZUtzMsFuQsE7vqXlxtrKppoaxPkuCpjXnOWO2OnU8LXnlgcdy2i25LUjnKK6uggKpFwrcFnM7sP9BhJ6+UQInoDR8+/FT5ravafK5kTjuPXXXTGnqA+t66Z4KSQ78Xmpadgmtyw84SmirbXXSclwgD/zik4cbgWFfIdF8iIE4iTNiEcGMyK0Pz+otitxJtOXJNlfi+QFdhSbozSAHBz5hPlXhxI4RLtLvivtprh15smITv6FEUg==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>
  • Delivery-date: Mon, 13 Dec 2021 11:54:46 +0000
  • Ironport-data: A9a23:OeitRa6OIcK87A0ZN4G0vQxRtNvAchMFZxGqfqrLsTDasY5as4F+v jFLWWDSOK6JZ2D1fI0lbIW+pEsGupeHz99hSQM9/y1kHi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuV3zyIQUBUjclkfJKlYAL/En03FV8MpBsJ00o5wrdj29Uw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Zz tBor4K1YgsSIaDmnfVMfRxFDjBiFPgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALNs7kMZlZonh95TrYEewnUdbIRKCiCdpwgWZg2JARRKe2i 8wxVWpAUAjAMj12HWweFq8dpreQt2n8fGgNwL6SjfVuuDWCpOBr65D1OcfRUsyHQ4NShEnwj mHL4WX/RA0bPdq3yDyZ/3bqjejK9Qv5Uo8PELyz9tZxnUaegGcUDXU+RVa95PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yENopTZFBYAWSbdjrljQl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0EcMqyPMbEZt7eC3ODQKb9Jq7PmgcOVbKXlvg9QpGlRGt5dBmxCe2Cm+yNNNW177c1TLu vh2iMLnUvqRZxRBf7LdEUtbqzmnZnmhZjmaRkJC1oO7xSPtyqh7PrfHwKD1hkTfjtTyfN6mF K13jDR1+GGibWW2xXc32jc49B/n8bg8MJKAIiphtIOIjvhpw60bMBKWqGEvhoyvOazgWxa2u XkklMFBYBe+nnRdma6rV/E3BTh6i8n7zvYxVqRkRLY0LrEbQN/L/AEqZNScxPf5UZllsp7yr h302WQsIcSJQ/cnQzmjuK4GS1Cpw6Rmz4PgOQTh3tQXc81c7lKt7ES+0tTDdMpAD/60oY6C+ NjZfusq8q+SWnqL0wxg1Mfg+BFBh8Ib1W7qwk5y4CoOgFt7TFEJxBy/r1bop8CnKhNPKWsqd 60dpiAr4s+PvP+W5gNcNvpcfHHe1Alfii8Q156AW6XXZ3vaEi946Ie3t0OlZSXkdozvdwPpK g=
  • Ironport-sdr: UdBEoqjDEU86UIvVU6iq0F9U26YPRaON3LotSysxMdat4Fs5Eyh+98tAK6eXwnO3hW4coFQSUi wNFeIN5EsQy6D2FVthLwtOMqxUsM/7m60tYHCMmmspHue9yeF6PuIAz0zngtHKXU93cHd8g/JU q8/yv5716V1PiYjbejfmB9ITBJx8ja4DFVTYj6q4ppcLyBtCnwVvUNvrkiV4y6cSoy6WbOyQvI Ks1oDUN7p6HWU1VHYUNWz2ALF/z0DlMzXRvS6PWjsEgl5JWDltzFDn0MxuoBmnK5nwfMx0DNfw KnaCQTTKdqnUVqJBD1/qDYte
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Sep 24, 2021 at 11:52:47AM +0200, Jan Beulich wrote:
> ... depending on feature availability (and absence of quirks).
> 
> Also make the page table dumping function aware of superpages.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Just some minor nits.

> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -743,18 +743,37 @@ static int __must_check iommu_flush_iotl
>      return iommu_flush_iotlb(d, INVALID_DFN, 0, 0);
>  }
>  
> +static void queue_free_pt(struct domain *d, mfn_t mfn, unsigned int 
> next_level)

Same comment as the AMD side patch, about naming the parameter just
level.

> @@ -1901,13 +1926,15 @@ static int __must_check intel_iommu_map_
>      }
>  
>      page = (struct dma_pte *)map_vtd_domain_page(pg_maddr);
> -    pte = &page[dfn_x(dfn) & LEVEL_MASK];
> +    pte = &page[address_level_offset(dfn_to_daddr(dfn), level)];
>      old = *pte;
>  
>      dma_set_pte_addr(new, mfn_to_maddr(mfn));
>      dma_set_pte_prot(new,
>                       ((flags & IOMMUF_readable) ? DMA_PTE_READ  : 0) |
>                       ((flags & IOMMUF_writable) ? DMA_PTE_WRITE : 0));
> +    if ( IOMMUF_order(flags) )

You seem to use level > 1 in other places to check for whether the
entry is intended to be a super-page. Is there any reason to use
IOMMUF_order here instead?


> @@ -2328,6 +2361,11 @@ static int __init vtd_setup(void)
>                 cap_sps_2mb(iommu->cap) ? ", 2MB" : "",
>                 cap_sps_1gb(iommu->cap) ? ", 1GB" : "");
>  
> +        if ( !cap_sps_2mb(iommu->cap) )
> +            large_sizes &= ~PAGE_SIZE_2M;
> +        if ( !cap_sps_1gb(iommu->cap) )
> +            large_sizes &= ~PAGE_SIZE_1G;
> +
>  #ifndef iommu_snoop
>          if ( iommu_snoop && !ecap_snp_ctl(iommu->ecap) )
>              iommu_snoop = false;
> @@ -2399,6 +2437,9 @@ static int __init vtd_setup(void)
>      if ( ret )
>          goto error;
>  
> +    ASSERT(iommu_ops.page_sizes & PAGE_SIZE_4K);

Since you are adding the assert, it might be more complete to check no
other page sizes are set, iommu_ops.page_sizes == PAGE_SIZE_4K?

Thanks, Roger.



 


Rackspace

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