From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3834D310762 for ; Tue, 13 Jan 2026 15:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768318589; cv=none; b=qGUVQ77kGdEhGxUGsf9fIbC5+8VlOY6dP/KlEbBvaf7+D+W+QVFAo0F3QtM6LABxuqrHAOTk2N0vRjuIOMCVb0XmUSgEsQ5Cmxyy/I9cZuBpJdG92Xz1OUrY62zUjvqzgoaR6I++8LHwqdLUpTsuSU55GXChpBT1ErZhdqn7JAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768318589; c=relaxed/simple; bh=m9eM7lrEF2v99gMzQMLE/BPwkN5Wc7QA9E+PDtK8y00=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Ue//aHgjcx1z53+TpATXp10CZx4QQFi2MX0Q5gfvNCfSjYxChzcwyMBc7NlD8UMgEnCuq1i+gFltFupcrp7aT55aUnb83f7kcDs8fn6qwe2OrHuNFKuZnttfodJw0cOHDW7iUKcRLFcP3ghu3C1y0Zr7/nORQMXGGss8LSNIyno= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=HVAg5nl8; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=hUIzjw4N; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="HVAg5nl8"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="hUIzjw4N" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60DBsPVf2865805 for ; Tue, 13 Jan 2026 15:36:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= EZ2/IbZkEd6N3FMPn0lY4+x3iY0Qz+kyyjWVOoANMOA=; b=HVAg5nl8cM8zVS55 yzTwaJZofsza0OYMHTHTAKvCUU8PwAc/De1TvXO1ZmV9nkOPOSeTH6bMSxP7H2WJ o7D1DcsNroLmWfv7RdYZPOHZCynwKsBEpO+Gs8u1DnP9h093OA4GGM4I2gWtjt0p sUvkKsgalPsVQG1miyVlGLl25lFud7Ow2y+TJxrg67b5CrMM56JF+6gTMtUxCoJu rqypROXHFElreUUe1o7jip78/+JEhWI8Wi60Zii/nXcHaSW+iZaTaQfi/XcrVrCC BLTd926XILVDqK75JciZnD+k5DReXMxXhj51ndYCIQgqCCbaLsjS3EeqK8YruFz4 lJ4vCA== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bnfjh9yeu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 13 Jan 2026 15:36:27 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-8b2ea2b51cfso172640085a.0 for ; Tue, 13 Jan 2026 07:36:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1768318586; x=1768923386; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=EZ2/IbZkEd6N3FMPn0lY4+x3iY0Qz+kyyjWVOoANMOA=; b=hUIzjw4NitU3ITP2njBQfu1zfA/mBc2r2im/3BeHnGCapjR8/SQB+TVERejVE5yXuk Wm6KlZC9vP5ba91fbG+RvhapYqVR9J/fcwE2BJ2c11u+/Q1rK13HFuJU6XNeKVKN+XMI KHqx5wYW++yt5r3wVgBtwJwYmDy0OyfSUfyYVVXGgjmRtdEmg/e85KhcC/VFA4GQ49vA yC1wom2cLWH8SGP3t/COCIcDIK75rV82Vl5oLB/SVhzrZU21sOrUodJdc2M4PcpOeLG4 XUW117AREZr41vSqLWDBZ5oQ8VOxSD1a7/vQp2UsoPkQPaKAYe7UGJMdulROHWQesaRk V6pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768318586; x=1768923386; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EZ2/IbZkEd6N3FMPn0lY4+x3iY0Qz+kyyjWVOoANMOA=; b=WZzyss96Gi4dD3joSyXdq2zlWTGAi6NMrXSjJ4CduQu9KLIC+WFJ/xL+nQMRFdTUDd k3fsubZPeliMzcGwcUU/88gTUVARCr0QhFlPJNl7X/DOdwV83TkHtgaweEPKY85MbFdt wYlAw3DkkkrjtBnBYvoSozlNRusm5g9IPauqVIUtwNQxyWpPD0UEES/7USoVtiGVVd2C Dfz3oDVkPGqJibx0u/YwDgpZnWPteJfm6/YYVbOee0CmYe23430P7zgVp2n3Bdj+YmSs tH++HkJF2Op5i9lkiY8C9ujwNefBRqALY1J0g5ZgmfXG6cCuqV3YclzhdExLJ6dhdltP nJLw== X-Forwarded-Encrypted: i=1; AJvYcCV1ap4Vfv7v7Hz9OVC1Lee1gx8Mwt/o1ZaA52p86/CDE7yMB41yw+cM6ksuBm/w3dDQs4o9JEUpBsjcnY8=@vger.kernel.org X-Gm-Message-State: AOJu0Yzp7KHeQYmO4xHnKgAPdj9lot2mHculrMCNSQXuZDGGo5yjzuKS GTjTu/YvkLd/cL4Z6AzQ6VsBD0Vu7V8BuLNroo/DBBoN/+4yEXms3HA9FXQXTgl0qAdpvIE+yER tTFbrsQxYywUIINLQTE1VVppYqjnymdJP/h9vcPpbxMJXJ+Hn4iu+HKBElegYp6jFXyI= X-Gm-Gg: AY/fxX4271LOd16Lacf3qNkMhlMahl6v4srKLw91uS+eWo2SJSta2n6VuOpkfzOvj+D pcwDtTHCL/DyMHc9vR0GRgQZ7s/+SiKeP6dYHgxQerBmT6t6me7lhsMxP4XJCwtHGVpNSCs3Dto ZNoAa1hCC5IL46wkEm7RQtE1Brvkgv6p5a2BGKMVEsONUyK+HTZ7PtZk+yHrCGQremtYX4zylU3 i55Kf9ZhtQHxY4NgwtZ6ryzTBJRR+qDyg/NsNpu0KDZx1dyyn4OJG0Mc2KABOQR7ImFDn2cpNzt 9ZN6DecZGnzqoedHr7NZScj3qV5qzHjBhGSM+mFSJDO6yi55hnTT+fdF+qks9uLIoOrb9/QOx7E CJm8zdNtl2zvhWf6sbRYdbSEWapFmIyIOsbiK4xB0AneFWP7rh48yxzkiUZBY//trBA4= X-Received: by 2002:a05:620a:1794:b0:89f:63e7:b085 with SMTP id af79cd13be357-8c389410364mr2118448885a.10.1768318584781; Tue, 13 Jan 2026 07:36:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMLwqRlVP/7fKfi+RZDpnX5OZ7Qgk9Q1gQb/STq85+GeJMS+CL71WIBqS8kpTydKMXpn6Oqw== X-Received: by 2002:a05:620a:1794:b0:89f:63e7:b085 with SMTP id af79cd13be357-8c389410364mr2118445685a.10.1768318584257; Tue, 13 Jan 2026 07:36:24 -0800 (PST) Received: from [192.168.119.254] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b870889ac26sm819561366b.28.2026.01.13.07.36.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jan 2026 07:36:23 -0800 (PST) Message-ID: <40193ace-36b9-4e05-83b3-9539534bb1ac@oss.qualcomm.com> Date: Tue, 13 Jan 2026 16:36:20 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/3] soc: qcom: ubwc: Get HBB from SMEM To: Bjorn Andersson , Dmitry Baryshkov Cc: Konrad Dybcio , Kees Cook , "Gustavo A. R. Silva" , Rob Clark , Sean Paul , Akhil P Oommen , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Marijn Suijten , David Airlie , Simona Vetter , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-hardening@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org References: <20260108-topic-smem_dramc-v3-0-6b64df58a017@oss.qualcomm.com> <20260108-topic-smem_dramc-v3-2-6b64df58a017@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTEzMDEzMCBTYWx0ZWRfX8M6ATMJLu6Dt ngL7qkSc1osPQu2YKoR6OYF5ZdMhTVebf7HhSOpECO9uS7Y79ti4GmrE2b970xkhGV1GMLmE6ug i+njxtvIOPGDuhb3J8p6TGmj0NAw3sABkg5TGG4pWpgRogJ7vLLUnDED0UE3CS0juMzZzC3M2I9 gr/wntq5GzVo0C5e5cHWK4gSkuMwuv4zt9p0kjwHi9atrVVOxcWfUwSlXZE01k962+U9r8Pl/jo /wIXePqLCW2roifhfsO7mTr1Fx4Qr5GtSkr2JQ3xKfRzbe2MOSahxYdnIAI9ftWcBqaFYhexmPr uSVVjIq1MB6TNpto1LdnkUr6zoz0M8BeDkXa9DfLreXHS+4mzgUMv0h6aVwMUuAQiqzuaG2P/Pm idfu3rt2GvH2bBP7rDi5p9TfFLe4vaF5TJ/VH288SS6NxkBsMjr4Fos0CsAGSp8BedH9vn+jWIY kfQhx1qGl2G9BLfN78A== X-Proofpoint-GUID: tiPIgac2_F0nz3Jm_5kd4yTociDtj09T X-Proofpoint-ORIG-GUID: tiPIgac2_F0nz3Jm_5kd4yTociDtj09T X-Authority-Analysis: v=2.4 cv=XJQ9iAhE c=1 sm=1 tr=0 ts=6966667b cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=egEcnhzrLz9U2KnhiLcA:9 a=QEXdDO2ut3YA:10 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-13_03,2026-01-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 phishscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2601130130 On 1/8/26 6:49 PM, Bjorn Andersson wrote: > On Thu, Jan 08, 2026 at 04:45:49PM +0200, Dmitry Baryshkov wrote: >> On Thu, Jan 08, 2026 at 03:21:51PM +0100, Konrad Dybcio wrote: >>> From: Konrad Dybcio >>> >>> To make sure the correct settings for a given DRAM configuration get >>> applied, attempt to retrieve that data from SMEM (which happens to be >>> what the BSP kernel does, albeit with through convoluted means of the >>> bootloader altering the DT with this data). >>> >>> Signed-off-by: Konrad Dybcio >>> >>> --- >>> I'm not sure about this approach - perhaps a global variable storing >>> the selected config, which would then be non-const would be better? >> >> I'd prefer if const data was const, split HBB to a separate API. >> > > I agree, but I'd prefer to avoid a separate API for it. > > Instead I'd like to either return the struct by value (after updating > the hbb), but we then loose the ability to return errors, or by changing > the signature to: > > int qcom_ubwc_config_get_data(struct qcom_ubwc_cfg_data *data) > > This costs us an additional 16 bytes in each client (as the pointer is > replaced with the data), but I think it's a cleaner API. I don't see how that's much better than static const qcom_ubwc_cfg_data foobar_ubwc_data = { ... }; static qcom_ubwc_cfg __data; const struct qcom_ubwc_cfg_data *qcom_ubwc_config_get_data(void) { ... if (__data) return data; __data = of_machine_get_match_data() ... hbb = ...; __data->hbb = hbb; return data; //still returns a constptr } Since we essentially do the same thing, except we save space and rest assured the various client drivers don't mess with the data they receive Konrad