[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH 08/11] swiotlb: make the swiotlb_init interface more useful
- To: Christoph Hellwig <hch@xxxxxx>, "iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx" <iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- From: "Michael Kelley (LINUX)" <mikelley@xxxxxxxxxxxxx>
- Date: Mon, 28 Feb 2022 02:53:39 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.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=cUQzgDhFXj39UwjsoncgNcIWa1l4ZcVYsMn1FkSIhVs=; b=KuABfYBu8dRbhpq/Ms8IkUlKlVTgZlgCCxlFYN0GSr+Cuo8MOH0L/PqrVUXDP07RxO1lgq9DbGDcho3sjJs5/1vu2/nfoU5fxB3j3WuePzpwfjtSJ4R2TYxoJ+GJvoVd6Qn3ognoByz/TtOoAsDllrz3LL1E/mhXUu11kUMghzkIxCmHhkFMGhr+fkqlS7nSKawXUhTTzulsdZIvshYviBGj72mhvdldLlbVkITesqF+zDsA17Tk/GLl48cx/pUrwzyiidxv9XKlJGmpTjphHdSPPR+r4c7VPEjdXw+gtIgZC3drdIIGE3WfMFTQhvvONb+YpgxyYXiFNiXsHqc40w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uxr/H+0VHYjtixcCNiJhNVsAkUTVHABVRiEjtjIlwufEjFxZ8Eh0ltsXlBE8Oqw2JxNZUNmgPXtOdjO502CC4IgYnJ6SLY0VEtialT9getwLzbPg7hcoWvgrwJhUaWT773wjlSGb+QSfqweOI31hR8H6HEtWz0lGqpetZF5GBQM4BF4mHGLHS7GuL9tSm7sFgNC76chJcMQHb3wPonQQw8lQ5ArllHB3jOY6CvmQl+Rj2QDQV3RS4xSarhc5s5BxT83HiHD+sFG6cnxcvfjfDzJEoZqUB5u8XKXfxs1zbDa9pe1ElQSZzHySpGgyZyZrLSNNBlNkpY0Ih7Q+hRb5ww==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com;
- Cc: "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>, Anshuman Khandual <anshuman.khandual@xxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Joerg Roedel <joro@xxxxxxxxxx>, David Woodhouse <dwmw2@xxxxxxxxxxxxx>, Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>, Robin Murphy <robin.murphy@xxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "linux-ia64@xxxxxxxxxxxxxxx" <linux-ia64@xxxxxxxxxxxxxxx>, "linux-mips@xxxxxxxxxxxxxxx" <linux-mips@xxxxxxxxxxxxxxx>, "linuxppc-dev@xxxxxxxxxxxxxxxx" <linuxppc-dev@xxxxxxxxxxxxxxxx>, "linux-riscv@xxxxxxxxxxxxxxxxxxx" <linux-riscv@xxxxxxxxxxxxxxxxxxx>, "linux-s390@xxxxxxxxxxxxxxx" <linux-s390@xxxxxxxxxxxxxxx>, "linux-hyperv@xxxxxxxxxxxxxxx" <linux-hyperv@xxxxxxxxxxxxxxx>, "tboot-devel@xxxxxxxxxxxxxxxxxxxxx" <tboot-devel@xxxxxxxxxxxxxxxxxxxxx>, "linux-pci@xxxxxxxxxxxxxxx" <linux-pci@xxxxxxxxxxxxxxx>
- Delivery-date: Mon, 28 Feb 2022 02:54:03 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=54503504-d8f3-4c3e-a3cf-4bee18dc2a5e;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2022-02-28T02:46:33Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;
- Thread-index: AQHYK+bNn5GdGBwbMEGdpROKeAVKTayoQv4A
- Thread-topic: [PATCH 08/11] swiotlb: make the swiotlb_init interface more useful
From: Christoph Hellwig <hch@xxxxxx> Sent: Sunday, February 27, 2022 6:31 AM
>
> Pass a bool to pass if swiotlb needs to be enabled based on the
> addressing needs and replace the verbose argument with a set of
> flags, including one to force enable bounce buffering.
>
> Note that this patch removes the possibility to force xen-swiotlb
> use using swiotlb=force on the command line on x86 (arm and arm64
> never supported that), but this interface will be restored shortly.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
> arch/arm/mm/init.c | 6 +----
> arch/arm64/mm/init.c | 6 +----
> arch/ia64/mm/init.c | 4 +--
> arch/mips/cavium-octeon/dma-octeon.c | 2 +-
> arch/mips/loongson64/dma.c | 2 +-
> arch/mips/sibyte/common/dma.c | 2 +-
> arch/powerpc/include/asm/swiotlb.h | 1 +
> arch/powerpc/mm/mem.c | 3 ++-
> arch/powerpc/platforms/pseries/setup.c | 3 ---
> arch/riscv/mm/init.c | 8 +-----
> arch/s390/mm/init.c | 3 +--
> arch/x86/kernel/cpu/mshyperv.c | 8 ------
> arch/x86/kernel/pci-dma.c | 15 ++++++-----
> arch/x86/mm/mem_encrypt_amd.c | 3 ---
> drivers/xen/swiotlb-xen.c | 4 +--
> include/linux/swiotlb.h | 15 ++++++-----
> include/trace/events/swiotlb.h | 29 ++++++++-------------
> kernel/dma/swiotlb.c | 35 ++++++++++++++------------
> 18 files changed, 56 insertions(+), 93 deletions(-)
[snip]
>
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 5a99f993e6392..568274917f1cd 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -336,14 +336,6 @@ static void __init ms_hyperv_init_platform(void)
> swiotlb_unencrypted_base =
> ms_hyperv.shared_gpa_boundary;
> #endif
> }
> -
> -#ifdef CONFIG_SWIOTLB
> - /*
> - * Enable swiotlb force mode in Isolation VM to
> - * use swiotlb bounce buffer for dma transaction.
> - */
> - swiotlb_force = SWIOTLB_FORCE;
> -#endif
With this code removed, it's not clear to me what forces the use of the
swiotlb in a Hyper-V isolated VM. The code in pci_swiotlb_detect_4g() doesn't
catch this case because cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)
returns "false" in a Hyper-V guest. In the Hyper-V guest, it's only
cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT) that returns "true". I'm
looking more closely at the meaning of the CC_ATTR_* values, and it may
be that Hyper-V should also return "true" for CC_ATTR_MEM_ENCRYPT,
but I don't think CC_ATTR_HOST_MEM_ENCRYPT should return "true".
Michael
|