Received: by 2002:a6b:cdcf:0:0:0:0:0 with SMTP id d198csp24529iog; Tue, 28 Jun 2022 14:52:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sSmZzWKICCf1ajHIyNZ9KPdSOEdFvkwCJ9C6pwksU0dfuufDIFCCOF11f40YWSZR9QPwQN X-Received: by 2002:a05:6a00:1a0e:b0:523:1e7c:e26e with SMTP id g14-20020a056a001a0e00b005231e7ce26emr5711023pfv.60.1656453166857; Tue, 28 Jun 2022 14:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656453166; cv=none; d=google.com; s=arc-20160816; b=IVFuP1KI9IYcyjEevXy7epI1HwauuespG0gx05Cvv8B01sJjvtbTQYv62Ymd9ve8Vt eapEZzn5f9fFFHamHrt5fwCff1YiEp+Ydx3ZmdgkGjeyoql59ECjEA13bSie4amZZxiO SXc75ZyLId9RiKplwZRrzaBJ2W5E79+L678XOPuq2KArpe1JODt4+mSZYAhBn8L10h4g CQ2/EFO883cQc7B494EqnaGMIj7QzkAqs1fhFjrClgCdncSdlm3dsfGB3ZMfmBqbpp/Q AS190iIz2Gzu0tGTBg1Ood7qX/3eAo5MfSzAsqItCKo9GXKWyesW7ngMwGuMkItVOIXT 01CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=WjW+6GW3ETFm2JU8jE79XhUoTv6z3/GSxYftllUP/xs=; b=Cq9gk0cxZl7+nEfYbg1LVM3wNMVBtNvCEDLHi7Po7Z6QarSQeKq5Jja3CcF3qhSfOF uZPSgy5E7bQZAssxd0nlgDOzNjoKWogb00iLdzZKJKUIbBxTdQS7qCfgoE1mDm+tu4LW ncmCorJ1uvajQUZ0zX7he1USORw9B5MRBj3jnKYEMlImcAc5w1EsJ/ggDSsKcwxM/xYu BVKf/K4KIXUPgsSvuNWFEv8C5ClLyij/PHim5rc+9qjBzGqve/YJR4pvcNFjoz42a/cY P8VkmnT7kYQu1vilExNM6oOZDwpqrg7vfgGm3aEOtbb/AvGsxA6SEkYQLsU9QtJMatXF VOUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Hl4POJee; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a170902ee1300b0016a3c9abbcesi18131773plb.375.2022.06.28.14.52.33; Tue, 28 Jun 2022 14:52:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Hl4POJee; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229919AbiF1ViO (ORCPT + 99 others); Tue, 28 Jun 2022 17:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229880AbiF1ViN (ORCPT ); Tue, 28 Jun 2022 17:38:13 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B00B7B; Tue, 28 Jun 2022 14:38:10 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id 68so13393957pgb.10; Tue, 28 Jun 2022 14:38:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=WjW+6GW3ETFm2JU8jE79XhUoTv6z3/GSxYftllUP/xs=; b=Hl4POJee6IPPulGeCkhFVzmaewHFoLW/+/aEoDQjxUpbODhZ1oymIgaTqZ81qNcby5 tayUWDYOl9MImX18J8dQD7IqMr+zmUU1bqZHU+pNimB587Iq3zDvd9733Lpd08PJ3ZqN hCcDuWiBdimpZlnAS7LXz+VIQLfHxUzeRmXR/DhhOL+83rGT7oCb0qCs+I3LD5qbJUOY Z7gwLbNztnnB2BuHaZLhgR2hoazBRvaRufJfP7NUdv99H5O/s5nLD+ERJ1SZjBEJ5o3/ g1yNYiH51zSIYiit2licB5Pp4Mw6FaB2n5sZmRFysJGeMTkqmhnQmnjN1azWYVr/4Saz dDKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=WjW+6GW3ETFm2JU8jE79XhUoTv6z3/GSxYftllUP/xs=; b=f2wa68tdcB1EJBEBD9egwCf85hVewX+aAvW4ic7N5atk2Y15nx8sE0dCnEggoImUph UjeA5Qfo75sW+NdsIvD9EHY9LD7i1VxY+Ojou7YfMvG2CGetEeDnYKAQylQ6ONDUc8CX nbfZRfwBbxEK5r8i14BoG4fvuGEU5bMN3B4woW2aXc3VjoB4sCGFN+S+RGdMmwxl9QCk T5Z1mG2Uzd5zpoAD2StT+ybn1l4KKokkT+3GQAEMoMhYCbr6uonCTgq5NdFMFJ8GGKEq 9uR6NOA9lVo3XdNVRVo4rAye2EcpdnkDRkUAdsP10atJSo+BPCDRgkJEtZZyriPg9Sfv gLXw== X-Gm-Message-State: AJIora/blAk/JCjNaQ5M0dMbtnRj2u0RFEYAl/dBeDoUIFyelW2w7+KR zuezxLizQmQ4McYE2EMiO+k= X-Received: by 2002:a63:3545:0:b0:40c:95f7:d114 with SMTP id c66-20020a633545000000b0040c95f7d114mr5443pga.150.1656452290295; Tue, 28 Jun 2022 14:38:10 -0700 (PDT) Received: from ?IPV6:2001:df0:0:200c:75aa:d6ca:4354:6033? ([2001:df0:0:200c:75aa:d6ca:4354:6033]) by smtp.gmail.com with ESMTPSA id b8-20020a170902650800b00168a651316csm9770467plk.270.2022.06.28.14.38.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Jun 2022 14:38:09 -0700 (PDT) Message-ID: Date: Wed, 29 Jun 2022 09:38:00 +1200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2 3/3] arch/*/: remove CONFIG_VIRT_TO_BUS Content-Language: en-US To: Arnd Bergmann 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 , John Paul Adrian Glaubitz 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> From: Michael Schmitz In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd, On 28/06/22 19:08, Arnd Bergmann wrote: > 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. OK, leaving the old custom logic in place allows to convert the 24 bit DMA drivers more easily. > > 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. That's one of the 'liberties' I alluded to. The reason I left these in is that I'm none too certain what device feature the DMA API uses to decide a device isn't cache-coherent. If it's dev->coherent_dma_mask, the way I set up the device in the a3000 driver should leave the coherent mask unchanged. For the Zorro drivers, devices are set up to use the same storage to store normal and coherent masks - something we most likely want to change. I need to think about the ramifications of that. Note that zorro_esp.c uses dma_sync_single_for_device() and uses a 32 bit coherent DMA mask which does work OK. I might  ask Adrian to test a change to only set dev->dma_mask, and drop the dma_sync_single_for_device() calls if there's any doubt on this aspect. > 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. I hadn't realized that I can map the bounce buffer just as it's done for the SCp data buffer. Should have been obvious, but I'm still learning about the DMA API. I've updated the patch now, will re-send as part of a complete series once done. Cheers,     Michael > > Arnd