From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 A2B8229E114 for ; Tue, 27 Jan 2026 14:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769523738; cv=none; b=SoF3JGz2az7jG08P83uFNtZGWM/sejMJsnVkG0+5YdZitWpS8qXWGdohqF2Yl2ECWoJdoiNhk1i1AyGSs1HvnZ0IbOci19qpyG04RXNm96/LoqauThISOZZCSodpri1s/3WeYlpABUarLMu0RFXKM4TD2NkdCKUqqvbqE2d3hAU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769523738; c=relaxed/simple; bh=iAmtRqGPeR/S9VjWwZKA1aPJW+IrV/cIuDNCInOMnnQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Udof3odaUMgY+Sfy/0PmOHP+uptPkw36b34tDswkQ4Zi3veNADXQbUHajsEbHLyCFl0pBPxUDk5aYr/H1R3cO+qegB8Fu9BcYG5NrGIYChh1ue3kTEdyL3MjfbKbSNk1TZ+XHCE6kq/5/oBSZPuMUE0nxBRkZ97E+rGbt1Y1yBY= 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=U1LqhODG; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=eaRqjjOl; arc=none smtp.client-ip=205.220.180.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="U1LqhODG"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="eaRqjjOl" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60R9rUi51268745 for ; Tue, 27 Jan 2026 14:22:14 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= T/zZBr4RQMGR6+8mwWzOZeCwVTQSBGms3epNbHc/lK4=; b=U1LqhODGZjRjomPG kj2Tn0IW2gH/YO2UfKr1oCd1wYuDd8oHGJPP66qCoKBW2rZAtmI6N3CyX4zEoqZ0 xgsTESoghkgenLSBdK4vD/HQNat9JV6ESB+xedzP6a/TJf3HO6woc8nf/+QE4RP7 VMcd3joH2Ony78XdvoNGaBcBkKWvAADACa3KDYdpEXzl1KaQtjtis1Al4jgWy7w7 kSUMU4Wy4epR6XpRbAtD1gjaV8VqUOBa5RyRTogDNIckxCcs7HoThn9io+YubLtQ KR9g8m1fLu1t0rxLE+GXFROHHhTXhryhe71uvxkaGeo1Jw6nHsCvgP6pSl5v0MBG 28zFhQ== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bxnyasyfc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 27 Jan 2026 14:22:14 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-8c70c91c8b0so17308385a.2 for ; Tue, 27 Jan 2026 06:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769523734; x=1770128534; 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=T/zZBr4RQMGR6+8mwWzOZeCwVTQSBGms3epNbHc/lK4=; b=eaRqjjOlvxQgeJLFronU2HN1kKvlPznmpbR9QxcUmR1gZsnS31N+R5Ob2HTydlkfx9 iD4HzxPWyLP6dJS/arI2Lxuk6SZNxErp1ffyOwG73iguR4r6e86953INcid/s2SiDGrG qOG5Buik1iv2OYilNyxGv0GqViPDd9913BJt/LiIOMr6lLhK//CluN2WbfjmlZSbapgQ JuUOWuymnGKGDH5WtwjmpnLLFglpIOf3sAsa3QppWoK63Cm8I4Uuv+gziEccG/ilEN6s 0pvUr9oYdqOi8cD6Le7Ef8Yf2Nnl/tGYyGL3cOlx3AqD2obl/ILZo6tG8UzulAlpEOWu 8gCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769523734; x=1770128534; 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=T/zZBr4RQMGR6+8mwWzOZeCwVTQSBGms3epNbHc/lK4=; b=pb/ImJeP54IJn1G2YuCbKJSPkAUF+KoOAtX7qFJngLtC0gm+zFYXT6pZ1x9ZOgKuZk hPNiUezPQmAIbyUtCWhAMKx/wjzSapTvwh0vHNI3Bd0mgNB9MVxvm400++lvE6cB/OKR SYiIiEA5lhOzomalKhSsLkfyNdjQpzF8RR4GL8yEr4q9nmWaNznw2irvUYZWjMGVIScA q75RlQIgnqRl5gFHKXeprN64nGfCHriiqDN9f2VoJF3Km0mu2v9yYGhCWE0ebVeZ89aG /Apz6b39qKmWe1pPGfD84KqF0hAqLKc4KDbBf4uaV7PbJjjKVzHHiev+C+cNAqjrGq58 0VQg== X-Forwarded-Encrypted: i=1; AJvYcCVpAtO5qAxwUgP3wjtz5rd5FkB2tGdP7Mw3oEbZhQlv9RMakPRtdZwSEavr8tQcE8gaT3/sC0DGpVR750o=@vger.kernel.org X-Gm-Message-State: AOJu0YzSFEX1O5ZVcmZn4b2M9V8mOAB5A1mgD5YTxE31XZjI02OEC5kJ OVpEXPfdK89A520aQr0kdsB627dZsHTngrlwl4W5hQ0LxzVtfzwrOm5DEhhLnvF9sJu/Gqxtlkt T1wYJQZiifvyZabeIk3pq9YJmfqVyztHi5wpvhFIizZpNL+rNNJK3koG8ILC7pIEXTxk= X-Gm-Gg: AZuq6aL0/acSZc90H3Xid8514R1QFtrxYxFQl0UR7sPrXpwnQrsDAzwPzMsTJElQFWn D+oCSGAuZeX/IdiknUQmdqkrOeYXAQKxKMB4nk0p/zxfp0efLG11TPvxcRk7P21Lc/P1a8NViRq 85h9otn9RmlcaxVdG21LLxFJhWN4F74otprftap9qcNN//nQpxRgPZZnOeoNLtbpr1AChYdBFGi rm6hlNGcIXLR5nAqWBjs9fgzJU9HNrXbpcq5ynpS2N/gW0Ox3l4N5pGw5qnGxV3tfOXn+SiQzlg keXIGYwAV5kjX2GTct52S3A62SRWA6LRkS4g6f198VStjErtrNmOGRU6BDTNS+GrzIiahJ2DxwE o67Zs25MVW6dmKMwkLzsBW6LpMIt18v8rHGTNbsR+fgBKQdesggavU16SVajOCdBqbko= X-Received: by 2002:a05:620a:178a:b0:8b2:1f8d:f11d with SMTP id af79cd13be357-8c70b9046b6mr186420785a.2.1769523733713; Tue, 27 Jan 2026 06:22:13 -0800 (PST) X-Received: by 2002:a05:620a:178a:b0:8b2:1f8d:f11d with SMTP id af79cd13be357-8c70b9046b6mr186414885a.2.1769523733146; Tue, 27 Jan 2026 06:22:13 -0800 (PST) Received: from [192.168.119.254] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b885b416ca5sm815011666b.25.2026.01.27.06.22.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Jan 2026 06:22:12 -0800 (PST) Message-ID: Date: Tue, 27 Jan 2026 15:22:09 +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 1/3] soc: qcom: smem: Expose DDR data from SMEM To: Mukesh Ojha , Konrad Dybcio Cc: Bjorn Andersson , 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-1-6b64df58a017@oss.qualcomm.com> <20260109133612.ommcoivkbhbisp6o@hu-mojha-hyd.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20260109133612.ommcoivkbhbisp6o@hu-mojha-hyd.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: nfcv_nKEa1enw_QrugZyCHU5K6GrIgjb X-Authority-Analysis: v=2.4 cv=JZqxbEKV c=1 sm=1 tr=0 ts=6978ca16 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=rBdmBs-3Ac6Y_iI8bpQA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-ORIG-GUID: nfcv_nKEa1enw_QrugZyCHU5K6GrIgjb X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDExNyBTYWx0ZWRfXw5kr/sYJEqwn Dg9PbBsjC6Pi2UjzPq8msgOhr1mzU3vm8HlS/hn/gtmuSEm5JqinKbcfvXXhymKHPmKiwiEpDUV DqcQIVViF1R80CGCKoph36E/qM157AFZoEFZDcAAQg8n7IJWVf3SkzF9Gn6hJrmaXERZLUuXFON ON3oV2SQqBq2CSRxwTT3iwj5thsOCvzK81rUjhgbJQ7qbPB4m0V8i88Okc7uWn5JOS1eM8wYYwK PCJi6uTfXTgfiwZq2CiXKb6Xd7TN1U7/g5ABCfSFQesROp56c77LUSs4nIkOU/+8dtXB17pNcmj nJdz3TPuZa6Ed6Vxzb522aVMxUaMuLJaDvu/KVUNtxmGyfv2xwe1xkxKsyQmbXTVw3yqmZwjXM6 fav/rP84beUau9zbjMUX5wqVb09iyHG5Cu2+/gK6pugKUQqI+y26A4PUtu/xPtm+i9TRd8KdIiR n5ahdaG5xYUSCnGAAHA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 clxscore=1015 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601270117 On 1/9/26 2:36 PM, Mukesh Ojha wrote: > On Thu, Jan 08, 2026 at 03:21:50PM +0100, Konrad Dybcio wrote: >> From: Konrad Dybcio >> >> Most modern Qualcomm platforms (>= SM8150) expose information about the >> DDR memory present on the system via SMEM. [...] >> @@ -1236,17 +1241,24 @@ static int qcom_smem_probe(struct platform_device *pdev) >> >> __smem = smem; >> >> + smem->debugfs_dir = smem_dram_parse(smem->dev); > > Is it possible, even after calling qcom_smem_is_available() before calling > qcom_smem_dram_get_hbb() we are getting __dram as NULL. > > is it good to move __smem assignment to the end with barrier so all the > changes before the assignment are seen when somebody checking qcom_smem_is_available() > with a pair smp store/release pair. I think just moving the __smem assignment down will be enough, no? What scenario do you have in mind that would require SMP barriers? [...] >> +struct smem_dram { >> + unsigned long frequencies[MAX_DDR_FREQ_NUM_V5]; >> + u32 num_frequencies; > > freq and num_freq_entries ? since you have used freq at various places.. The names in structs come from internal shmem definitions that I didn't want to stray away from Making the kernel-side struct fields named the same feels like added confusion to me [...] >> + if (size == sizeof(struct ddr_details_v5) >> + + 4 * sizeof(struct ddr_region_v5) >> + + sizeof(struct ddr_xbl2quantum_smem_data) >> + + sizeof(struct shub_freq_plan_entry)) >> + return INFO_V5; > > Why this does not have separate name ? Because it's the same DDR info structure as "normal v5", with trailing extras that we don't really care about [...] >> +struct dentry *smem_dram_parse(struct device *dev) >> +{ >> + struct dentry *debugfs_dir; >> + enum ddr_info_version ver; >> + struct smem_dram *dram; >> + size_t actual_size; >> + void *data = NULL; >> + >> + /* No need to check qcom_smem_is_available(), this func is called by the SMEM driver */ > > This comment seems redundant.. With this one specifically, I don't agree it's obvious.. Konrad