[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH V2] arm: xen: mm: use __GPF_DMA32 for arm64
- To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>
- From: Peng Fan <peng.fan@xxxxxxx>
- Date: Wed, 11 Sep 2019 02:06:52 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.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-SenderADCheck; bh=Tb2ETKokaVuDE1uKPXbrgkE2B1D+6xetfdMOqm4EtKg=; b=eos7EqPa9fvNwxx7ehFz6FXWXl8c+G0+vR2JC9+51GjpNDOKQxpCyzd88KJCNAajMBQuT8ETSS/0JSEj43uF1sIyE2pVqsxo3vpZW7D13mVz2EDbrRna8BcP/cKUW27Jsuf1LLsgFwbh6xAU6Fog5CfBR5pL5AqJ14Z0Z/DEPZEjrDemEBauCgDuw+6T0A78hGZZAsd1NF+Ry0rRLU6Q5vTKP55UgO1itggFBKA9KIPY4EvkM8POjZMycEsTlaJvwZxe75ylhdtx9dshfiXU9UL6l19a3CUrifL954budWlkdwG/DIw/R05RXXgCCwuy352lePNv/8Jh/OHfTIep+Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U5Mqi76CBH/tBwzVthZs3NSasHK/C2vAyfXH2o7BJrezXhmCbh0LE6/qSasXEM+JvF1lgfs3a1jQXqeD2LCAAA1ETOILZnYkN2db2Avwpzj1/y9ef687z4E+HQnOL2WVTji/aQNmaNwcJegRFcjjSP6yhZSgjO1AxyRGAq0DHHiNqLVlmq9Pzxp08rzGGzvkzKdN1BcKFGL89u0CrDs9sA56zI/g8giDAW/X7f6K9CO+V23ez8PL5QI4A03NRHu62jvuKxPB9ewirIkc1RgiGLHS9FKKhj0mG7RmGDELg/Pews4vt3Rpw3BPkGBz1HWN7f30lEBzzHpQa9yRxY3b8A==
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@xxxxxxx;
- Cc: "jgross@xxxxxxxx" <jgross@xxxxxxxx>, Catalin Marinas <Catalin.Marinas@xxxxxxx>, "linux@xxxxxxxxxxxxxxx" <linux@xxxxxxxxxxxxxxx>, Julien Grall <Julien.Grall@xxxxxxx>, dl-linux-imx <linux-imx@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "boris.ostrovsky@xxxxxxxxxx" <boris.ostrovsky@xxxxxxxxxx>, nd <nd@xxxxxxx>, "will@xxxxxxxxxx" <will@xxxxxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, Robin Murphy <Robin.Murphy@xxxxxxx>
- Delivery-date: Wed, 11 Sep 2019 02:07:15 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHVXtqjidV/KwEkYkeguLx++Vlcn6cTXzGAgAAFLoCAASjiAIARPvgQ
- Thread-topic: [PATCH V2] arm: xen: mm: use __GPF_DMA32 for arm64
> Subject: Re: [PATCH V2] arm: xen: mm: use __GPF_DMA32 for arm64
>
> + Juergen, Boris
>
> On Fri, 30 Aug 2019, Christoph Hellwig wrote:
> > Can we take a step back and figure out what we want to do here?
> >
> > AFAICS this function allocates memory for the swiotlb-xen buffer, and
> > that means it must be <= 32-bit addressable to satisfy the DMA API
> > guarantees. That means we generally want to use GFP_DMA32
> everywhere
> > that exists, but on systems with odd zones we might want to dip into
> > GFP_DMA. This also means swiotlb-xen doesn't actually do the right
> > thing on x86 at the moment. So shouldn't we just have one common
> > routine in swiotlb-xen.c that checks if we have CONFIG_ZONE_DMA32 set,
> > then try GFP_DMA32, and if not check if CONFIG_ZONE_DMA is set and
> > then try that, else default to GFP_KERNEL?
>
> Yes, for ARM/ARM64 it makes a lot of sense given that dom0 is 1:1 mapped
> (pseudo-physical == physical). I'll let Juergen and Boris comment on the x86
> side of things, but on x86 PV Dom0 is not 1:1 mapped so
> GFP_DMA32 is probably not meaningful.
If we only take ARM/ARM64, so could the following patch be ok?
diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
index d33b77e9add3..e5a6a73b2e06 100644
--- a/arch/arm/xen/mm.c
+++ b/arch/arm/xen/mm.c
@@ -28,7 +28,11 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order)
for_each_memblock(memory, reg) {
if (reg->base < (phys_addr_t)0xffffffff) {
+#ifdef CONFIG_ZONE_DMA32
+ flags |= __GFP_DMA32;
+#else
flags |= __GFP_DMA;
+#endif
break;
}
}
Thanks,
Peng.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|