From patchwork Fri May 24 18:26:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 13673509 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 D5F98C25B7E for ; Fri, 24 May 2024 18:28:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B910C10F588; Fri, 24 May 2024 18:28:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="QwRIk+br"; dkim-atps=neutral Received: from mail-wm1-f100.google.com (mail-wm1-f100.google.com [209.85.128.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id C4C0610EA0E for ; Fri, 24 May 2024 18:27:58 +0000 (UTC) Received: by mail-wm1-f100.google.com with SMTP id 5b1f17b1804b1-42016c8daa7so67093595e9.2 for ; Fri, 24 May 2024 11:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1716575277; x=1717180077; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FsDDNY/QwJvf47dmHC7PRu5uL7JEaRYA48sLf9OqOOY=; b=QwRIk+brVktBbhqi9/rULsk4EjPpSkg1cUeN2Kdwmyt/fcQYbr4xX4Z1HJphPz3Bx3 eg7suCBis9b7nWXzdKlLbh4JRmGnr8BdhceMrH1kvRxUBgzvN0zLidkVEfa5v9iZJBIy I4cjju15D9tasJvvGNZM1k0vr5+tmQpQkfNdVPWvkaZdF5BLKO87BDgjp0QgqvKsQUY7 cfX4ZhEZ+4bB/ayyROlEl2NLMpjeDzP21Sf+LCDYl6mKYqVDslCJGQOJhF+brK6V0gTg I2TIcY/T90P+XZYscvfWgfMGynnHPq4HwyEaQrDPu0ujw3B08i4nQVWnhSToBrqwcSpa 7jcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716575277; x=1717180077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FsDDNY/QwJvf47dmHC7PRu5uL7JEaRYA48sLf9OqOOY=; b=KQYjPNC428Fv19WqqlYBDvheZOYGmjiFVXX42iOb47/+JTnO+7QlppY5HI8KnwsWWs JPm3oBRS2IWRQYO82jMyiwkA8S61PiHdFI8Dw0FpDK1NmdCLIgjo3W5wvnoiR19/lZ+P VEOKhOFuqV3k9eZIrf6v7vdsJ3U/VTaRXg1CyJX5IB+iFjgsHc7DRQZ+YB/RZQLJE5gv 7rutqZY7fGx3eEvWMp16Z23yrbP8uRrj/R9mMKeOciojOa8+gAnKP8CwIuUjDJCmdPeX xXXj3kttUYUq8G2gGIV4jeGPwQbeb2poW7CyKOuDCpQ2owgoEJqPzYM6g1GLCeGmVINu Qqrw== X-Forwarded-Encrypted: i=1; AJvYcCV/yoFkVK1e6pckv9ilD0fFxPrav3k41nt+xRU8gbWGkSDmZDnAEb/kbEvghR+R/FwQrVXcaY4E8SOHNapQzudW/G7zkVL1PnDjpnRI5sM5 X-Gm-Message-State: AOJu0YzLEmoRZmxITNKWpW/UPEnymW4TcfFi6RMZHLq/iyM+2ft+nr/R O5exWjFARC2VOC3P+mopZxZX46KKnDf9uL3WFalBkk/5i5fnbpNjUES7dTj4UWDNpQRcPk0+/ln pFse+Wi6Kzw7kseJzaGgLBOgUfXxCQN4P X-Google-Smtp-Source: AGHT+IEXHyAwczg+VXo+M67fY0mVhzt5oPk36AjtQ9lYPMdZoLz7U9U+HdeHdCJz5d472HFdCSVQwmE4fQK0 X-Received: by 2002:a05:600c:3106:b0:420:29dd:84d5 with SMTP id 5b1f17b1804b1-421089ebf63mr23274805e9.5.1716575277312; Fri, 24 May 2024 11:27:57 -0700 (PDT) Received: from raspberrypi.com ([188.39.149.98]) by smtp-relay.gmail.com with ESMTPS id 5b1f17b1804b1-4210a964067sm979275e9.31.2024.05.24.11.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 11:27:57 -0700 (PDT) X-Relaying-Domain: raspberrypi.com From: Dave Stevenson To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Vinod Koul , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Ulf Hansson , Mark Brown , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Vladimir Murzin , Phil Elwell , Stefan Wahren , Serge Semin Cc: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, iommu@lists.linux.dev, linux-sound@vger.kernel.org, Dave Stevenson Subject: [PATCH 10/18] dmaengine: bcm2835: Add backwards compatible handling until clients updated Date: Fri, 24 May 2024 19:26:54 +0100 Message-Id: <20240524182702.1317935-11-dave.stevenson@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240524182702.1317935-1-dave.stevenson@raspberrypi.com> References: <20240524182702.1317935-1-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" bcm2835-dma has been (incorrectly) expecting dma addresses to be passed in, not CPU physical addresses. In order to fix this up, add temporary handling of clients still passing in dma addresses until they are fixed up. This will be reverted once all clients have been fixed. Signed-off-by: Dave Stevenson --- drivers/dma/bcm2835-dma.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index ef1d95bae84e..9531c0b82071 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -283,9 +283,23 @@ static int bcm2835_dma_map_slave_addr(struct dma_chan *chan, struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); struct bcm2835_dma_chan_map *map = &c->map; - map->addr = dev_addr; + if ((dev_addr & 0xfe000000ULL) == 0x7e000000ULL) { + /* + * Address is already in the 0x7e... peripherals range. + * Assume this is an old client that hasn't been updated to + * correctly pass a cpu phys_addr to the DMA subsystem. + */ + map->addr = dev_addr; - return 0; + return 0; + } + + /* + * This path will be updated to handle new clients, but currently should + * never be used. + */ + + return -EINVAL; } static void bcm2835_dma_free_cb_chain(struct bcm2835_desc *desc)