Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp439385pxt; Thu, 12 Aug 2021 01:56:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGRnRhI7WYLDCeWZ2GJRIhqEoXZLFLuEpEdFMEzLvAOueO4efJlPo54UgNKCo/ARIPw2Iy X-Received: by 2002:a05:6402:50:: with SMTP id f16mr4220361edu.346.1628758602285; Thu, 12 Aug 2021 01:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628758602; cv=none; d=google.com; s=arc-20160816; b=HvgKqJdn6tMGvCf6kwGVCerZYKpB5dsMF978OopQ6PmNGqwX77X19tVie5pfnep2c8 lThztPY+D9me3izrrzaaDY66vmS6mlPHHGt/yFhAXsvP2R+PbsDAGjUbObkUKNhZMCvN YxcpzPlYa8J3GSKGxV86abms2devhP+imF8V7sm5hAl/cZkdZPLH18hR+5+S4ZPdSZnW 5lu8suicL17xLHPuOpM7wFiRBHcJYtC8aInhy1XKqgj1jc0QpMegKI/8CM2u0WqtROlS miqd9HNL4L7Z18FjU0FOYfBxE6T0TvR32TRJWlnkZR3gexSxwmEDGnS/l4Y7rzCx23n6 F43g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=PSj4JHIjNEZ0Pnq0kCUtHXFd19FV7YVTxXuuWLgLOaM=; b=H9IQPxK7iad5/bEW7ILWYuimgEbq8SMhxgjuWcIm3WPzab+rgDfw+Wse58mIiIacNx FLXoCXHHTou2k/aY1vFoUdq7pXgsS4hc3G/XZ8FGMxBQWmA5K7fvxOB3v5JREoQD/DZI ubnbLY3XkdRnQMWT/TMYiwtiWH1FgtvBdSB+jLjSUaAYw4pZ8Fdk3veL4JLwDuLc2OPX r4awIOXK9ykhk0EaHs2bzG56uAU1OpEV6SRiy/fWynFgek4q+lclkV+gtE06mcy8BQ78 +R+NwjQVDiDIq4GWxAIpbZeeARO2vJloTDXtOd56P2ZNtA8ONSdeNGMT4DxNKwfC9XIb klNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id um10si1924298ejb.57.2021.08.12.01.56.19; Thu, 12 Aug 2021 01:56:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234226AbhHLIzF convert rfc822-to-8bit (ORCPT + 99 others); Thu, 12 Aug 2021 04:55:05 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:51139 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbhHLIzE (ORCPT ); Thu, 12 Aug 2021 04:55:04 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]) by mrelayeu.kundenserver.de (mreue010 [213.165.67.97]) with ESMTPSA (Nemesis) id 1Mow06-1mtD8a0ffi-00qVxq for ; Thu, 12 Aug 2021 10:54:38 +0200 Received: by mail-wr1-f45.google.com with SMTP id q10so7214363wro.2 for ; Thu, 12 Aug 2021 01:54:38 -0700 (PDT) X-Gm-Message-State: AOAM531Gou1N3h4yRFKOzMsen8vmyCbgdJSsGin8aXFay9orXOdu0t2P Bk/pKA8qOnmRifO2ejqPFq5oMZc0snmPgbUjyrc= X-Received: by 2002:adf:fd89:: with SMTP id d9mr701787wrr.361.1628758477814; Thu, 12 Aug 2021 01:54:37 -0700 (PDT) MIME-Version: 1.0 References: <20210806030138.123479-1-xianting.tian@linux.alibaba.com> <20210806030138.123479-2-xianting.tian@linux.alibaba.com> In-Reply-To: From: Arnd Bergmann Date: Thu, 12 Aug 2021 10:54:22 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/2] tty: hvc: pass DMA capable memory to put_chars() To: Xianting TIan Cc: Arnd Bergmann , gregkh , Jiri Slaby , Amit Shah , Omar Sandoval , linuxppc-dev , "open list:DRM DRIVER FOR QEMU'S CIRRUS DEVICE" , Linux Kernel Mailing List , Guo Ren Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Provags-ID: V03:K1:BQoTlOxcHqA6Jtpz6G3I3iEkEbcUJNnHyR0h3BwaWv5nor11G/e PLoxk9dK0LwHMNkHlClRBDGKWtyOaPSjZHVTKpsd6v2dC97N3iRp5KbE5CoGpBMiQPLs3yx 9hpQ4SFJ9lUHe4to0Oh9N1yzyLqvJutjexWJ+FEP6UDCSb72Pl5tHmdmrEB9bRtEXCSIJv+ 6GMkfVieEBNRLWHGOeF1A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:BjMA3fbz6kw=:CyRb4FO92E5xxUMElyAPUF aRnGrM15tGTjfzAQFXeDt7dU44dduc49Mw5jiDlV1OBRS5i6tMI4NsHfVUcVpDnjd2l6QXp2O PeZ8r8gyjZN0sDF/3folLaRYBs5jIZ3GkbeW3Q0+smu0I87KEBmEi2kNZRUj12HtkpjWscx25 ZgV4OulF6Ab3UQf9QYpSMN5c2CwHXlCSVM10xok/ZVsZa9CTDKdu4SnxGZFVM4x0zx9VS4EYj 3hhQ+mLHIHRpJXHx/j1nlIRnko2jDOE2egYsWt3i+WhtcUVKfQ1K/Hqb55wTVXzYnCsid6l7r /iFeoIPIWXx8ja2aSHM1+dzmAFKXGGYPNptskr7DI9CrpA/2ga9CDkvajt6VQ1OfQXyRSylnB O2y4atQ95WlVPNiiuS8S2oUrmm8stWpimhob7G1dQ6+WhVRJBGNPVcdRkEfRY3A17rGyM4DlT 56iIRtdeCEEDxRukWQHZlEjprxs6BPLSsnHUX+9xdl2KUTjfLV5f4aTiPhqaFc9YBE9nDSNXc U2Ee8el8dTxaABFY86c99JlaoCS6yvPdP1VlMPoJO15UvCJlTF/1LNzuszNlZpUjWqud9SveR at+8MNf/Q8rOzDHPdb4TLuvqxcXbdah9wAJLSZfeMYwPyPbXDC0EPSosd59+JgePg1KqhBjYx toW1CO8E14jQXs1U1q53ag0pu9LwazV87/GctFxtK8RhAq83TOrek9bzXCKUiRf57fUjnfS28 G8HHJMCV9zLRgO+jnpLQp6tAaxKrQZ/g6n2gW4TOR25pf2VG7ME3Sy5oYqpqnj+1F3bbcHwMq j8QJWmfU/8TDyFqTgXBI2DLgsnQuURoV3rJZRqnFM7W3IHwsLCgVU/n6Xl5QV/7daawkc8fTH hTBcOjlORguiQAbfhYR5Ao5ACmDZ9uyPELRRtDh9dnsHBzTAiCbHoveO8lcojK14vOlK4kex6 AyifyKgV5VJzzK48ec769bMJMHjbatbLUov+gIsXggmeTNBN+K0Ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 12, 2021 at 10:08 AM Xianting TIan wrote: > 在 2021/8/6 下午10:51, Arnd Bergmann 写道: > > On Fri, Aug 6, 2021 at 5:01 AM Xianting Tian > >> +#define __ALIGNED__ __attribute__((__aligned__(sizeof(long)))) > > I think you need a higher alignment for DMA buffers, instead of sizeof(long), > > I would suggest ARCH_DMA_MINALIGN. > > As some ARCH(eg, x86, riscv) doesn't define ARCH_DMA_MINALIG, so i think > it 's better remain the code unchanged, > > I will send v5 patch soon. I think you could just use "L1_CACHE_BYTES" as the alignment in this case. This will make the structure slightly larger for architectures that do not have alignment constraints on DMA buffers, but using a smaller alignment is clearly wrong. Another option would be to use ARCH_KMALLOC_MINALIGN. Note that there is a patch to add ARCH_DMA_MINALIGN to riscv already, as some implementations do not have coherent DMA. I had failed to realized though that on x86 you do not get an ARCH_DMA_MINALIGN definition. Arnd