Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp179051lqg; Wed, 10 Apr 2024 21:43:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXtP8hdbzjTZrYxOWHnAJiHM9LssWE8yWuf/xutbw4+LBz61a7aa9xnv3vu3uMP3ZoOnWA0UusCwLc6h5KiAGBPSGESOF59KlAXdnhAkQ== X-Google-Smtp-Source: AGHT+IHNTc9WNORnCGJvlK+KoWdGi8FGf2Xfy7xMaWD2M7h9Gb9PpGOCGdw/Fu10bid6fU4LYf8D X-Received: by 2002:a17:902:d2cf:b0:1e4:7adf:b855 with SMTP id n15-20020a170902d2cf00b001e47adfb855mr5391889plc.35.1712810623795; Wed, 10 Apr 2024 21:43:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712810623; cv=pass; d=google.com; s=arc-20160816; b=e92YC3078ElG+uP0JYC7h0DEgsU4gLFYZPknN5Z9aO8pB5InKtK55Tb7OwDO6UaeGa yYsiCOjhhaVjITS8j8Ec8BZ4SOZ+QwA7CKLbsQhfQ0wgOoQ4LCxe5z9r2h29QOtVLfii aQh3qPihvYaesijkA+Nl7g2+c9oluN1vpxqLu9MwgMqk8cckgive5z9HlpiTFM6tCQ/G myvQ1sBmUBNa0XTp3z5wJ+InfblKv2jOFL++WfzJ+2XfN0YA4S93rP9OTlvx78OxZ7dV tDB1Ta2Kk0duPjS6uQSRTx1s1nlgFdYKX5pRAES1Q8cyiOYjZ+riFh0+9oAo5UOPp7XL 8f9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:dkim-signature; bh=6lzwKLB3Q/bTbCjordLPg4qofdWe6rcdh5oPrBvdXm4=; fh=r1Fhr5ALv6Cxi0jFiVMhbf/Iwm9FzOHKFusm2aqZx7A=; b=FlYoTNg9fZIfCUQDHMtQ04OHS32SeqRr8QmnKMD8qv99TCOgbOvdqlkU3pePqiTN2U zGgjMzLCQAhfTFFVodvkEBLcdOOyErk6Mky0KNJDoLmD/0DzTjFXtd6RFat6JSJBvkQm 5XNIWixyeUW4V7boAnajzDu0o9eZx9qjwK9NS/AKaGkuuSCjZydsKQ4t1WjoG+AXNk7w YJT4vbDTHN89O0XU0+udlN4PKjgw87AnJhwhbdvgU0t/V3CvAWyQRoTGI7Gw4+MBnTyh EZARTHflpNpUYLfgCRRz7QEIAy9/yeKWJXn0QH+lCa06u/nf9g5bGP1q/05XFnvxrjmF oZzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BVvf92su; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-139750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p6-20020a170902ebc600b001dddd1df881si590277plg.295.2024.04.10.21.43.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 21:43:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BVvf92su; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-139750-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139750-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 64D7C28A149 for ; Thu, 11 Apr 2024 04:43:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F03E613C801; Thu, 11 Apr 2024 04:43:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="BVvf92su" Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) (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 7CFA013C695 for ; Thu, 11 Apr 2024 04:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712810609; cv=none; b=WEKJt3LuNwtLy9zP2J0fnQGEPUUFEIkoDNdlL12nUgBrmRpske8mmFNEFrQXPYA5fgnTPtACXDCmpNHP4e9N/igZcHRWzORol3GvzawKuv3wRUIkw7d/DZkuy8fcof7OCHKuiPO/Ky1JFGJIXnyDDFODxjCyLvy2U8MpJEq7Jps= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712810609; c=relaxed/simple; bh=6lzwKLB3Q/bTbCjordLPg4qofdWe6rcdh5oPrBvdXm4=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=bItgdMKrzp1lER/GHqpaa2yuMhK8fi2AaE5L+gIv9KzuGMsxL5PXPbgyJPsRwWAZYZ5+wbkAUf5vUo/rmOHfsQwDKzdZhyiEBrihYysvX6iaDLyqoB3HvVW2Z6YGZeNrrnNEQLJjFeJqgr2/bmb9uXW+Q7QJSc1HjX/8iAz/k0Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=BVvf92su; arc=none smtp.client-ip=209.85.222.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-ua1-f46.google.com with SMTP id a1e0cc1a2514c-7e3b3e33aa7so2324544241.3 for ; Wed, 10 Apr 2024 21:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1712810606; x=1713415406; darn=vger.kernel.org; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:from:to:cc:subject:date:message-id :reply-to; bh=6lzwKLB3Q/bTbCjordLPg4qofdWe6rcdh5oPrBvdXm4=; b=BVvf92suRfPuHj+fR3KNRnycA8HQw/OQq1kiT+ouGx6P/rwsrrbV75g6OqFUkDEmRv YCmBd99yj0npdsStkib6yuyqOIUZaGyDX/mwX8AzLQ6w+btP162lvEoL0Z6Q4xQGVUKb 6KxLb113uxVG3q+7zBykJT7SSO3olQntPKThY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712810606; x=1713415406; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6lzwKLB3Q/bTbCjordLPg4qofdWe6rcdh5oPrBvdXm4=; b=PHmfcqn33k7FauJmJ3QQZGNRijEpJrtz17elm6MPYMmBflOWWVR6b7KBte8J3LBQAy YjEYajPmuRiVe1v8w8ydUO7XdKIogdHM2DryG1G8RHiYAh5Txdnm5UlialiPqdP+5Iji JL97+q9sXgLFUNlxHzD2uJjVZIHST0ZfbFsy+aey3AUBtNsv53mjXjwiEBPLRrgGxcjn z4uVE9GOOtZVpFd+q5fvzUA2l0kCCvKtjun2uWhQ7xuoB3fewvRPW703tF0IUB66Shvi xKSL/lFRr2xfYUTXl5ovBKRNRHNNfDhLL3Aub3L6AW7V5rMCbkE99bQWQszVd1GYpygz MRfw== X-Forwarded-Encrypted: i=1; AJvYcCV1ikInouFXYWANxO7nWXu2fwYMpvUB64TLEBkZOf8WT8wnVpUtG6zpxyzGusGa4PyRmYwppwgeWuduhljS+eFGlvznjQoccmcNywoQ X-Gm-Message-State: AOJu0YwjmUrSN6WaM6O9tbHdOevk6XTQJloV+dlrg+fgHqxCui6U08AB MKy5/WQnsoERGztTftIgAV0N61mfLxB3p5cg01jVlOOIsPohY+33WEM8axtGAmYpgB4PUtPoeW5 zL1wS+sOexieM2j7dtmXFmXNVE73UnIvlU85z X-Received: by 2002:a05:6102:dd4:b0:47a:2a80:e672 with SMTP id e20-20020a0561020dd400b0047a2a80e672mr3052186vst.5.1712810606285; Wed, 10 Apr 2024 21:43:26 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 10 Apr 2024 21:43:25 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240410204337739-0700.eberman@hu-eberman-lv.qualcomm.com> References: <20240327200917.2576034-1-volodymyr_babchuk@epam.com> <87a5mjz8s3.fsf@epam.com> <20240410204337739-0700.eberman@hu-eberman-lv.qualcomm.com> From: Stephen Boyd User-Agent: alot/0.10 Date: Wed, 10 Apr 2024 21:43:25 -0700 Message-ID: Subject: Re: [PATCH] soc: qcom: cmd-db: map shared memory as WT, not WB To: Elliot Berman Cc: Caleb Connolly , Stephan Gerhold , Konrad Dybcio , Volodymyr Babchuk , Bjorn Andersson , "linux-arm-msm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Douglas Anderson , Rob Clark Content-Type: text/plain; charset="UTF-8" Quoting Elliot Berman (2024-04-10 20:54:24) > On Thu, Mar 28, 2024 at 07:40:49PM -0500, Stephen Boyd wrote: > > Quoting Stephan Gerhold (2024-03-28 02:58:56) > > > > > > FWIW: This old patch series from Stephen Boyd is closely related: > > > https://lore.kernel.org/linux-arm-msm/20190910160903.65694-1-swboyd@chromium.org/ > > > > > > > The main use case I have is to map the command-db memory region on > > > > Qualcomm devices with a read-only mapping. It's already a const marked > > > > pointer and the API returns const pointers as well, so this series > > > > makes sure that even stray writes can't modify the memory. > > > > > > Stephen, what was the end result of that patch series? Mapping the > > > cmd-db read-only sounds cleaner than trying to be lucky with the right > > > set of cache flags. > > > > > > > I dropped it because I got busy with other stuff. Feel free to pick it > > back up. It looks like the part where I left off was where we had to > > make the API fallback to mapping the memory as writeable if read-only > > isn't supported on the architecture. > [...] > > The other weird thing was that we passed both MEMREMAP_RO and > > MEMREMAP_WB to indicate what sort of fallback we want. Perhaps that can > > be encoded in the architecture layer so that you get the closest thing > > to read-only memory (i.e. any sort of write side caching is removed) and > > you don't have to pass a fallback mapping type. > > Was there any motivation for having the fallback? I suspect driver > owners that want to use MEMREMAP_RO will know which architectures the > driver is applicable to and also know whether MEMREMAP_RO would work. I don't think there was any motivation, but it has been many years so maybe I forgot. I suspect you're suggesting that we just don't do that and driver writers can call the memremap API another time if they want to implement a fallback? Sounds OK to me. > > > I also wanted to return a const pointer. > > The stash looks mostly complete. Do you think it should be part of the > series or submitted separately? > Make it part of the series so this topic can be finished? For example, it seems like iounmap() should have always taken a const pointer.