From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12DDDC433F5 for ; Sat, 23 Apr 2022 14:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5X0LCEGLPjmWACaczgJjg6EZkL6NckLc5SeOc6CSflI=; b=UiV2EO1wNiNmMIpLTHrFk+gcU3 KwD0d3kXI118doEtFUnrjV080eXswfCu215nP4sBN/+BeNLrIBG7Jeflub2rLIrBz9eU3ZBukpcVf 0ZEOQvydP8xMSmn3rIUNNJBxHtVeVdaIdDzHS1sAyoZRh3SWlZCq64uf2+YQPrAZcflxLDWkfw3c4 vCfy7HnIwK0SG0zelsW5q0Mu7Hqrgs8gbUspWTWAjTGuihR5ZfvKd5PZOCYHbnpJx4sN8X7b+sr6D MDnWn61s2FpTeN2Bzt2t7SRyeIV3iTUvQDSR4fP5IFRYWmE94tR0msvWBrPZLfe0CIJwbT3QWuiXK l0cEXNPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1niGrQ-004TK8-Vb; Sat, 23 Apr 2022 14:35:45 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1niGrN-004TJ2-JO for linux-arm-kernel@lists.infradead.org; Sat, 23 Apr 2022 14:35:43 +0000 Received: by mail-lf1-x12b.google.com with SMTP id x17so18955600lfa.10 for ; Sat, 23 Apr 2022 07:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=5Ob5FZ3XWHH7ndiX9e02UPLlc8ptKYdQZQQb2q10kFk=; b=edcQjFzK13CxlrO3DRi39U1HLX1VBiZdMToLxtPriW5w54rke5iEMAjcSbz0qLKiU1 6Dg/+t7jlWN4zLOE4R7gc+Oiehyx44/fBegjF9CUPZTdazhsEq5kmlyBBIDrFcpJ2UXh 39lAPieblL9SemJymxB3+VitLdVV4ID+j2PN+nuGr61uKUGz8IVRPkA+fobqsdBAqXKq ApWZOKdhVIcgtmhqGwlNCdGSukJgvhZDorgcmTlkv0mfPzZ/PfSWiA/hCgs5Wv2oL+vK XJZN28Yak1op0o0AkGamHUIANzbptaiH+ktbXi6pl22teiG63KGXxIYyM50hdzwzZcwU 6EXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=5Ob5FZ3XWHH7ndiX9e02UPLlc8ptKYdQZQQb2q10kFk=; b=3uNLdoejLSy+T3cfi+mzvrgo8Ads2a9E2JKwSw7fgappHy4/LuKCdFEqS/63Y3h4De CFBB8drJrwBls3b1ywn2G5ZiDWtgO3Ye/uQgx6RusXRArpvEQWUQHa6b0kbYKZ2vo3IA LxhWN79cmX3wdUVbwrsi1hfJOc/EechqZYtJE2nruOOCHNDASgD20I9soGkJ2J77jOcF UmUM9EIULwoTyob1A1Jw20OkxIf8Za3MIy9G2SoCZI4gPtA5S5iSXRuwxbJhhSh0Vbyh rNS3EijJiF6PHl1OKzqwnSLv7Ut7qRFHQkLBkAtm5PW0570Q927Z5rPSAMvJbgjFh+Kz O+Vw== X-Gm-Message-State: AOAM531YELCTW+dEUPD4KX2UgCE/6/kBk1C3kEWaZz2X1m4rr3iqFLDj f5F9qOzgNoCpgv8ScuYf6r0= X-Google-Smtp-Source: ABdhPJzuBm8Fq2ksLNZubEsggwEds0YNor4simf+758e/Wch36unqYhiwGrQiA/w92oNFg+B4tk+9w== X-Received: by 2002:a05:6512:2348:b0:471:92ac:3bfd with SMTP id p8-20020a056512234800b0047192ac3bfdmr6525788lfu.199.1650724539295; Sat, 23 Apr 2022 07:35:39 -0700 (PDT) Received: from [192.168.1.7] ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id k10-20020a19560a000000b0046d1707fcbdsm640495lfb.215.2022.04.23.07.35.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 23 Apr 2022 07:35:38 -0700 (PDT) Subject: Re: [PATCH V1 1/6] arm/xen: Introduce xen_setup_dma_ops() To: Stefano Stabellini Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Oleksandr Tyshchenko , Russell King , Catalin Marinas , Will Deacon , Boris Ostrovsky , Juergen Gross , Logan Gunthorpe , David Hildenbrand , Martin Oliveira , Kees Cook , Jean-Philippe Brucker , Julien Grall , "Michael S. Tsirkin" , Christoph Hellwig References: <1650646263-22047-1-git-send-email-olekstysh@gmail.com> <1650646263-22047-2-git-send-email-olekstysh@gmail.com> From: Oleksandr Message-ID: Date: Sat, 23 Apr 2022 17:35:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220423_073541_713143_B749AF29 X-CRM114-Status: GOOD ( 20.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 23.04.22 01:59, Stefano Stabellini wrote: Hello Stefano > On Fri, 22 Apr 2022, Oleksandr Tyshchenko wrote: >> From: Oleksandr Tyshchenko >> >> This patch introduces new helper and places it in new header. >> The helper's purpose is to assign any Xen specific DMA ops in >> a single place. For now, we deal with xen-swiotlb DMA ops only. >> The one of the subsequent commits in current series will add >> xen-grant DMA ops case. >> >> Also re-use the xen_swiotlb_detect() check on Arm32. >> >> Signed-off-by: Oleksandr Tyshchenko > Reviewed-by: Stefano Stabellini Thanks! checkpatch.pl suggests adding missing SPDX-License-Identifier to Arm/Arm64's xen-ops.h I will retain your R-b tag after making this change. Please let me know if you think otherwise. >> --- >> Changes RFC -> V1: >> - update commit description >> - move commit to the beginning of the series >> - move #ifdef CONFIG_XEN from dma-mapping.c to xen-ops.h >> --- >> arch/arm/include/asm/xen/xen-ops.h | 1 + >> arch/arm/mm/dma-mapping.c | 7 ++----- >> arch/arm64/include/asm/xen/xen-ops.h | 1 + >> arch/arm64/mm/dma-mapping.c | 7 ++----- >> include/xen/arm/xen-ops.h | 15 +++++++++++++++ >> 5 files changed, 21 insertions(+), 10 deletions(-) >> create mode 100644 arch/arm/include/asm/xen/xen-ops.h >> create mode 100644 arch/arm64/include/asm/xen/xen-ops.h >> create mode 100644 include/xen/arm/xen-ops.h >> >> diff --git a/arch/arm/include/asm/xen/xen-ops.h b/arch/arm/include/asm/xen/xen-ops.h >> new file mode 100644 >> index 00000000..8d2fa24 >> --- /dev/null >> +++ b/arch/arm/include/asm/xen/xen-ops.h >> @@ -0,0 +1 @@ >> +#include >> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c >> index 82ffac6..059cce0 100644 >> --- a/arch/arm/mm/dma-mapping.c >> +++ b/arch/arm/mm/dma-mapping.c >> @@ -33,7 +33,7 @@ >> #include >> #include >> #include >> -#include >> +#include >> >> #include "dma.h" >> #include "mm.h" >> @@ -2287,10 +2287,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, >> >> set_dma_ops(dev, dma_ops); >> >> -#ifdef CONFIG_XEN >> - if (xen_initial_domain()) >> - dev->dma_ops = &xen_swiotlb_dma_ops; >> -#endif >> + xen_setup_dma_ops(dev); >> dev->archdata.dma_ops_setup = true; >> } >> >> diff --git a/arch/arm64/include/asm/xen/xen-ops.h b/arch/arm64/include/asm/xen/xen-ops.h >> new file mode 100644 >> index 00000000..8d2fa24 >> --- /dev/null >> +++ b/arch/arm64/include/asm/xen/xen-ops.h >> @@ -0,0 +1 @@ >> +#include >> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c >> index 6719f9e..6099c81 100644 >> --- a/arch/arm64/mm/dma-mapping.c >> +++ b/arch/arm64/mm/dma-mapping.c >> @@ -9,9 +9,9 @@ >> #include >> #include >> #include >> -#include >> >> #include >> +#include >> >> void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, >> enum dma_data_direction dir) >> @@ -52,8 +52,5 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, >> if (iommu) >> iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1); >> >> -#ifdef CONFIG_XEN >> - if (xen_swiotlb_detect()) >> - dev->dma_ops = &xen_swiotlb_dma_ops; >> -#endif >> + xen_setup_dma_ops(dev); >> } >> diff --git a/include/xen/arm/xen-ops.h b/include/xen/arm/xen-ops.h >> new file mode 100644 >> index 00000000..288deb1 >> --- /dev/null >> +++ b/include/xen/arm/xen-ops.h >> @@ -0,0 +1,15 @@ >> +/* SPDX-License-Identifier: GPL-2.0 */ >> +#ifndef _ASM_ARM_XEN_OPS_H >> +#define _ASM_ARM_XEN_OPS_H >> + >> +#include >> + >> +static inline void xen_setup_dma_ops(struct device *dev) >> +{ >> +#ifdef CONFIG_XEN >> + if (xen_swiotlb_detect()) >> + dev->dma_ops = &xen_swiotlb_dma_ops; >> +#endif >> +} >> + >> +#endif /* _ASM_ARM_XEN_OPS_H */ >> -- >> 2.7.4 >> >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >> -- Regards, Oleksandr Tyshchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel