From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5121D188015 for ; Fri, 15 Nov 2024 10:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731668028; cv=none; b=i/UauZRTt3/SLvTz4I68NlRSXNPlD5YuIVvrcJwxjbRelgu83B9OyJO2IP2k+tL2IHVZqT1uYwWdxso0DoMx2CVzyG2FRfUAJop3TYJMq3w6y93fp+NBrImb91YqbSG3duqe4qtpLepLKXtct+EjGlcWiqe2BZDLMIXRvjjnams= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731668028; c=relaxed/simple; bh=Aze8ubsJfw20CCAheENnV0TxOaVpLIudKLyqB1mUmWs=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TkeydevKseACiQ/8SqBAaQhiCkZAd5zTsjYcuhzXEcI33gf2ysZx1AeJ1/JL4got/2gKPGiXn9+IW2Fkkxj1uS0PGCZhVojsySpP0hFmSAUcYlu3PrVCfbicoy8CK2DbIyi65kK8tTJL/K9NpYpflyDFiklulT3fsyGJFlgWKBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=LxD2iVQS; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="LxD2iVQS" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-53c779ef19cso622558e87.3 for ; Fri, 15 Nov 2024 02:53:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1731668023; x=1732272823; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=kqEZZaXWIaNRK9OLE5Wx827F0bUtvaOZcgVtTnimPxg=; b=LxD2iVQSWDliHa7Qm3U3T/EF+DEPxdk9Ry8F7GTgz3VvaNne5Bk1xmuxG6LqbmMXDz 5rlp5x3XY53Lq88fHFqXPax4sm/eWCl63dMf8NDRiPHsqBmsRNFtnIaJS9g7oygJahmr yOXnNQlESkzsmaTIhRvy97jxtpiq4j8KaBGB/cREmFctrM/vwQzXRsKMoMV9q46oy8gz miY6W2t5FL5k1Xzc6cQ1NVZEzOOn17TiwTYFlTubfSdjVbzgWUPzhfMeXCOLE2ULq2HA WyCXiqEGTDgOU277xMcpAN87RLgbLg5KBgZ6NI90hAMsIuBXhXrWI9+t7wkIVZ9nBY0y sgZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731668023; x=1732272823; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kqEZZaXWIaNRK9OLE5Wx827F0bUtvaOZcgVtTnimPxg=; b=HMUKEL3BpdGd+2f02KxqJgp+oeeTlqKPVnLcSlsBZsOdCoFXAyHGeo7zlpk+oKLnSz ZO/24MxXeC0czyS0KJElnntijCVCMj8n2X13+z6QZQJck41hJO9RusnFv/6icldCmz46 aiSI9KZy7W1OAoUcq3EmsidmqSRovsNV8xaTbUniUQwVQdTznwxPl3A5UM7pdWTqDD9u utKAELox31Qls3eERfIBuyXf1Zkr28y2ur67fg6foKIeMtQwAMtnNCmgUEAqKJrG+zi5 20/q2TsDTN3oSgINcWsQIqDPD4iHUcaglbMznAAzy0vF41WvQCkDJlVKa79uNt8gJ5IL E85g== X-Forwarded-Encrypted: i=1; AJvYcCUPqXNwPS1uGbqvhmsQrx2kNhwQuOvXOrX+EYBjhzn/49tgheMYjYps4x22oAju8W+42mx2PiMZmVbQ@vger.kernel.org X-Gm-Message-State: AOJu0Yz5f4mp7j2PGykAuN4H3SLAtP+CPmIALu7EXmZXfk32p1n+ZxJJ EGH/gLhHPNTMephbK5GTB6jnTD/WsOgsIXg8iqtWgtfLNvq4Suy/cS8vHvh0u2U= X-Google-Smtp-Source: AGHT+IFHVLZ9JHkGOvekL5vmiZxKEfDLHTUYv8vjzg0FSLM0sIjZA/dYE3eiUJZBbLbHkNSDwDDmVw== X-Received: by 2002:a05:651c:245:b0:2fa:c59d:1af3 with SMTP id 38308e7fff4ca-2ff606933a3mr12846531fa.20.1731668023447; Fri, 15 Nov 2024 02:53:43 -0800 (PST) Received: from localhost (host-79-19-144-50.retail.telecomitalia.it. [79.19.144.50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cf9010b12bsm531260a12.41.2024.11.15.02.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2024 02:53:43 -0800 (PST) From: Andrea della Porta X-Google-Original-From: Andrea della Porta Date: Fri, 15 Nov 2024 11:54:11 +0100 To: Bjorn Helgaas Cc: Andrea della Porta , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Lorenzo Pieralisi , Krzysztof Wilczynski , Manivannan Sadhasivam , Bjorn Helgaas , Linus Walleij , Catalin Marinas , Will Deacon , Bartosz Golaszewski , Derek Kiernan , Dragan Cvetic , Arnd Bergmann , Greg Kroah-Hartman , Saravana Kannan , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-gpio@vger.kernel.org, Masahiro Yamada , Stefan Wahren , Herve Codina , Luca Ceresoli , Thomas Petazzoni , Andrew Lunn , stable@vger.kernel.org Subject: Re: [PATCH 2/2] of: address: Preserve the flags portion on 1:1 dma-ranges mapping Message-ID: References: <20241108165654.GA1665761@bhelgaas> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241108165654.GA1665761@bhelgaas> Hi Bjorn, On 10:56 Fri 08 Nov , Bjorn Helgaas wrote: > On Fri, Nov 08, 2024 at 11:39:21AM +0100, Andrea della Porta wrote: > > A missing or empty dma-ranges in a DT node implies a 1:1 mapping for dma > > translations. In this specific case, the current behaviour is to zero out > > the entire specifier so that the translation could be carried on as an > > offset from zero. This includes address specifier that has flags (e.g. > > PCI ranges). > > Once the flags portion has been zeroed, the translation chain is broken > > since the mapping functions will check the upcoming address specifier > > against mismatching flags, always failing the 1:1 mapping and its entire > > purpose of always succeeding. > > Set to zero only the address portion while passing the flags through. > > Add blank lines between paragraphs. Ack. > > > Fixes: dbbdee94734b ("of/address: Merge all of the bus translation code") > > Cc: stable@vger.kernel.org > > Signed-off-by: Andrea della Porta > > Tested-by: Herve Codina > > --- > > drivers/of/address.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/of/address.c b/drivers/of/address.c > > index 286f0c161e33..72b6accff21c 100644 > > --- a/drivers/of/address.c > > +++ b/drivers/of/address.c > > @@ -455,7 +455,8 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, > > } > > if (ranges == NULL || rlen == 0) { > > offset = of_read_number(addr, na); > > - memset(addr, 0, pna * 4); > > + /* copy the address while preserving the flags */ > > Not knowing the surrounding code, it seems strange to say "copy the > address" when the memset() fills with zero and does no copying. > > The commit log says "set address to zero, pass flags through," and I > could believe *that* matches the memset(). Ack. Many thanks, Andrea > > > + memset(addr + pbus->flag_cells, 0, (pna - pbus->flag_cells) * 4); > > pr_debug("empty ranges; 1:1 translation\n"); > > goto finish; > > } > > -- > > 2.35.3 > >