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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D09B4C433EF for ; Tue, 28 Jun 2022 07:08:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241950AbiF1HIm (ORCPT ); Tue, 28 Jun 2022 03:08:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbiF1HIf (ORCPT ); Tue, 28 Jun 2022 03:08:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA4A0B4A0; Tue, 28 Jun 2022 00:08:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9A4E9B81CD2; Tue, 28 Jun 2022 07:08:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5220EC341D0; Tue, 28 Jun 2022 07:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656400112; bh=Dm+i1ahm5JO1Y0z9h4uqTDK4kJt3Abm9W7KKXWn4iRE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qC+UQmphl8Hd+1T1U0QD9tDpqj4RMtyFkgyHY4s5qIB7gRI+xS50dQLQF60N4d53a pt8nrB+n/0dsGBpX9rzm604Cauhg2V1pGMdOs9Z8ftj1edDPVWFevjoguG98IqrTXI ivqLmEwSVJigzb4BvjUY8SyP2jqcLYvPGrfQt0+Lb4o5OGtjK05l74oqdAtZe6v+RV EiZUgKYNvTN+ggir5o2MPXO4/eJKq2WsfCAQvCsHp1NxR2fH/lMZBuGL6JAF9vspsB biRI4WdoUfZ8vhFQRuwocB5PEe84qldt+0c/fmHu+92iK9/LCneqYIva5kjHPnQFrz CH1QITDOJFbvA== Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-318889e6a2cso107031767b3.1; Tue, 28 Jun 2022 00:08:32 -0700 (PDT) X-Gm-Message-State: AJIora8MiVwDMPyfVFDg50UsNzIa8HEXJj852LRFNF2XK4Bl+jtVzBSX IkfkG7HMbEQJR83rL6kkMQu46XNHYTFUCNfeJ4o= X-Google-Smtp-Source: AGRyM1vKbt5VKtzdC4XgmSFOrmSiRmjlG5/FEc3iJTDP+CtgJE9woQ9uDs2lLsQ8604dHCHHG6u5L7MmI7NPb3gwZE4= X-Received: by 2002:a81:1d43:0:b0:318:638d:2ca with SMTP id d64-20020a811d43000000b00318638d02camr20536106ywd.135.1656400111255; Tue, 28 Jun 2022 00:08:31 -0700 (PDT) MIME-Version: 1.0 References: <20220617125750.728590-1-arnd@kernel.org> <20220617125750.728590-4-arnd@kernel.org> <6ba86afe-bf9f-1aca-7af1-d0d348d75ffc@gmail.com> <9289fd82-285c-035f-5355-4d70ce4f87b0@gmail.com> In-Reply-To: <9289fd82-285c-035f-5355-4d70ce4f87b0@gmail.com> From: Arnd Bergmann Date: Tue, 28 Jun 2022 09:08:14 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/3] arch/*/: remove CONFIG_VIRT_TO_BUS To: Michael Schmitz Cc: Geert Uytterhoeven , scsi , Linux Kernel Mailing List , Arnd Bergmann , Jakub Kicinski , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Linux IOMMU , Khalid Aziz , "Maciej W . Rozycki" , Matt Wang , Miquel van Smoorenburg , Mark Salyzyn , linuxppc-dev , Linux-Arch , alpha , linux-m68k , Parisc List , Denis Efremov , Michael Ellerman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 28, 2022 at 5:25 AM Michael Schmitz wrote: > Am 28.06.2022 um 09:12 schrieb Michael Schmitz: > > Leaving the bounce buffer handling in place, and taking a few other > liberties - this is what converting the easiest case (a3000 SCSI) might > look like. Any obvious mistakes? The mvme147 driver would be very > similar to handle (after conversion to a platform device). > > The driver allocates bounce buffers using kmalloc if it hits an > unaligned data buffer - can such buffers still even happen these days? > If I understand dma_map_single() correctly, the resulting dma handle > would be equally misaligned? > > To allocate a bounce buffer, would it be OK to use dma_alloc_coherent() > even though AFAIU memory used for DMA buffers generally isn't consistent > on m68k? I think it makes sense to skip the bounce buffering as you do here: the only standardized way we have for integrating that part is to use the swiotlb infrastructure, but as you mentioned earlier that part is probably too resource-heavy here for Amiga. I see two other problems with your patch though: a) you still duplicate the cache handling: the cache_clear()/cache_push() is supposed to already be done by dma_map_single() when the device is not cache-coherent. b) The bounce buffer is never mapped here, instead you have the virt_to_phys() here, which is not the same. I think you need to map the pointer that actually gets passed down to the device after deciding to use a bouce buffer or not. Arnd