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 D6058C433EF for ; Sun, 17 Apr 2022 18:44:22 +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=CT0+1oUpXH0mkba2Zt/D74sTCxY7vyxyk8hqoHyUdYw=; b=iSdGIHGRSbwMr6ESOrMTiIwc9D +WgYI7i0dzmcpia39WG3dKteuBrtse4QDYb/3ff/Ri4VoXUQdBE+jJXe0UxPM+AZZzRQZvPUxUZL7 CpLLAmi/bKEIZZwIMLl9Zk6ulyqu0IFuUseQDdDWN/sjOG3bb5FfPkLSPS6lln7BvMZP8gI++t3ZX foruzhcAsp4RtZnZ4tP9XCxCYQRvb1I28gtIIsLUwsjpMOZosiXbmCltdcxLcK6Vkn+cZvPwI8ui2 CpSDArf+ZeiQ5VsA+zXXAoCJEvYMdg/O82rewZBcfyZr+wAe2U8x5+3dAzlsAZVNkyVNxsoW8RzDk 8czl9JTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ng9rm-00Eowy-TJ; Sun, 17 Apr 2022 18:43:23 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ng9ri-00Eow3-UT for linux-arm-kernel@lists.infradead.org; Sun, 17 Apr 2022 18:43:20 +0000 Received: by mail-lj1-x22c.google.com with SMTP id f5so7209417ljp.8 for ; Sun, 17 Apr 2022 11:43:17 -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=Kk9BppkAb1GLyoA2hlXyi8RoR58LZ27BwBibVf+whww=; b=qt5JWOZ1VfiLDVLEejVPGDYo3ZcP+JCb/V3FdDnmfvP9WmAWjdDok5wpZUVuADRg24 fS/HUufwFDewQAGNUruGZUWRsayZYLyRWsbPnthPGLeban+cJ+sfdiZr4+6hZ8K+H/fq HaF7YfEMxlTsydFQ6VJEyHmcvpcepTm1ox5hOSvpTaf/VW/vMkACJQmHuCofbf7EQTSb YTUlrx3yCnHQ24kUxwwOj6znDjmn1Kb8i1QrzF3m8VAufNmIQbIx425Kl9LZDPjOxIng 6E+6kHI9MbvnSm9HzKn1MfSr582N/2iNs5Zcd/9Lj9zQYqMx4tFf915Bgcyb2FYMkAvD DvrA== 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=Kk9BppkAb1GLyoA2hlXyi8RoR58LZ27BwBibVf+whww=; b=cl0FCfsV0FWrpUac/Qvge3pRqQowi/EuJNwZJT+rf56E1AgztpEQEn0cYL8bbZ5e/n Q5EcNAECB60wCorTGeEa8PjLUPIIK4qPVBvpvruN4UrjUIeCpfZR5neB1mUTfFu35Ii8 3U+jxWjhdcbZnpaccBGBbg24Cld+Viqnr1glCNfCfRpePLqi9wntnzVvUqCj084zWJTn O3RERtXA5/3Z2VoFdEkktek57za+wqLbYu/nmomQ5+NyuBwwz0gOTKAX5iQPhqd1zvVk S9+e7VsXZ8GuEpFPnLRM0oMt79WXr8GuAAYgIJdvyuBHjJnukPVWUJxRgWp8SH9eiwLT 3AzA== X-Gm-Message-State: AOAM532iIpSSdfPQLjDTeyRV9ShIAJ3JwmZBujYqiEvV7lLIzpDjDKj5 EhF+oxUS+v/BPSzYtN2VRlY= X-Google-Smtp-Source: ABdhPJwUkJUNtAb7kvGmdnAfzY9PQvgtza8+x07uV7miQaHaGsm/DshtCFE9C62GtukahGs1aCKfTw== X-Received: by 2002:a05:651c:19a5:b0:24c:87dd:d60d with SMTP id bx37-20020a05651c19a500b0024c87ddd60dmr5119546ljb.344.1650220996419; Sun, 17 Apr 2022 11:43:16 -0700 (PDT) Received: from [192.168.1.7] ([212.22.223.21]) by smtp.gmail.com with ESMTPSA id n2-20020a19d602000000b0046d150c112dsm999811lfg.234.2022.04.17.11.43.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Apr 2022 11:43:15 -0700 (PDT) Subject: Re: [RFC PATCH 5/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 , Christoph Hellwig , "Michael S. Tsirkin" References: <1649963973-22879-1-git-send-email-olekstysh@gmail.com> <1649963973-22879-6-git-send-email-olekstysh@gmail.com> From: Oleksandr Message-ID: <53d13d03-b387-bf01-20fb-8d11a964b370@gmail.com> Date: Sun, 17 Apr 2022 21:43:14 +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-20220417_114319_008909_107D03ED X-CRM114-Status: GOOD ( 22.87 ) 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 16.04.22 01:02, Stefano Stabellini wrote: Hello Stefano > On Thu, 14 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 subsequent patch will add xen-virtio DMA ops case. >> >> Also re-use the xen_swiotlb_detect() check on Arm32. > Thanks for the patch, this is good to have in any case. I would move it > to the beginning of the series. ok, will move > > >> Signed-off-by: Oleksandr Tyshchenko >> --- >> arch/arm/include/asm/xen/xen-ops.h | 1 + >> arch/arm/mm/dma-mapping.c | 5 ++--- >> arch/arm64/include/asm/xen/xen-ops.h | 1 + >> arch/arm64/mm/dma-mapping.c | 5 ++--- >> include/xen/arm/xen-ops.h | 13 +++++++++++++ >> 5 files changed, 19 insertions(+), 6 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..a1bf9dd 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" >> @@ -2288,8 +2288,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; >> + xen_setup_dma_ops(dev); >> #endif > You can take this opportunity to also remove the #ifdef, by providing an > empty stub implemention of xen_setup_dma_ops for the !CONFIG_XEN case. agree, will do > > >> 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..831e673 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) >> @@ -53,7 +53,6 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, >> 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; >> + xen_setup_dma_ops(dev); >> #endif > same here ok > > >> } >> diff --git a/include/xen/arm/xen-ops.h b/include/xen/arm/xen-ops.h >> new file mode 100644 >> index 00000000..621da05 >> --- /dev/null >> +++ b/include/xen/arm/xen-ops.h >> @@ -0,0 +1,13 @@ >> +/* 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) >> +{ >> + if (xen_swiotlb_detect()) >> + dev->dma_ops = &xen_swiotlb_dma_ops; >> +} >> + >> +#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