Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp792822rwb; Wed, 14 Dec 2022 02:53:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf7uR+Sz5IUPnRSMI+rxiX9bzt996lYdUX8XDIM5GlGVwlsC6npBGsBWhLkVgytpN/0VR2eo X-Received: by 2002:a17:902:cf06:b0:187:261a:8441 with SMTP id i6-20020a170902cf0600b00187261a8441mr27313994plg.16.1671015216315; Wed, 14 Dec 2022 02:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671015216; cv=none; d=google.com; s=arc-20160816; b=g0ZbF6tpL2kRPps7sIcvuMMzqPa1oTwAbUOqGBBB16lNvS6b6tYnj6CcPhUOSeAizq mBK6yqkThGHOxupuZ4Qh0Q813lQwyacUa29bEU20fuNqvRwjnPipHRWkL52vI9OV7coF KLvxxLuWk1O8NKRjHX6sM7nRy9BIXWN/qkG9qmBuhbVD95QJgc3wWk70So7d53aiVj1s JTY5gSr/4hR/BLW1vZMgQe3yG2iY/xAXPTWa3f6XOl1VyAx5E2rky0c8unbLDQDKxvMG bSg9mi6m5dR2QJFReIZ1y70b9Buu9hrEhaZhvTr/VrnaVZrm4/7uRiq+HLMExVNTVssN 149A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=b82NDcu0JlRnQvm9PlYbdyd7beQ1Y13MMv9ZYAvjCRs=; b=W4Qza5ItDhFf1nx9wQo2y0IW3EFmtQZd116hplGMfPrQpu4CMIdtWGpAbfKvzSG5bJ yWJMkNgABSrW6Wcjz8x/QoOlx1Llsk0MPJSiCwE7rwf2ZQFAoPKswYhF67uXVmnXzk9Q 0zmCN/E1a1iGUTRWqIu10h8WtUxRKPulvezkhIdYR6a+PA3a5YoZOrLP35CqY1afKtJT 2lq5KZ/r8Mh24dWOHoyCAdlShTcmoAZF8k8ptKjxAGHXmsRh4Xzl8j3jwEWKC782i2SQ sw1qFJnES3BdXneo2Y/gfO15H7bSyYyA1avdwzcqCVcP0NUJ6eXrKEujxZbqkuMInXHd Urqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=V0ZP6ZWn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v7-20020a170902b7c700b0018890a7e9c5si2357158plz.509.2022.12.14.02.53.26; Wed, 14 Dec 2022 02:53:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=V0ZP6ZWn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237925AbiLNKeZ (ORCPT + 71 others); Wed, 14 Dec 2022 05:34:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbiLNKeX (ORCPT ); Wed, 14 Dec 2022 05:34:23 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1010E1EAE4; Wed, 14 Dec 2022 02:34:21 -0800 (PST) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BE8nkLT028042; Wed, 14 Dec 2022 10:34:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=b82NDcu0JlRnQvm9PlYbdyd7beQ1Y13MMv9ZYAvjCRs=; b=V0ZP6ZWnFcK8CEmSCeDhHGYEC5wCCB6JLm4bpc0Vv03KyiMXStrWXKqZH0dw5N+Fe6OE p60oeVpEmLSYFOe05cLSAV6Ry/V0VuGoZXazeGywK36sb4pAePNWgveXo6IlO75yPi9X rrpnFr9R9CNurUI1Y8Ru57CLJabpYNMONIHMVcMRZUUiRLiPCMZm4aF+qYllpVpqhHct glCf53AC6nyVRRDjGm5dje3RtyAz/Dsn/RDQ58xe3ikOOnQjSjiDcPX12XmyuIE9aYnX NJyb6RJR9T2n0YTG2F26kHaRuPcb5gdLis183JLvkMiMjHYlB6FGD5pQxVj6PIl1W9gP gw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mf6rcrseq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Dec 2022 10:34:05 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2BEAXwMh015779 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Dec 2022 10:33:58 GMT Received: from [10.79.43.91] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Wed, 14 Dec 2022 02:33:53 -0800 Message-ID: Date: Wed, 14 Dec 2022 16:03:50 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH 4/4] remoteproc: qcom_q6v5_mss: Use a carveout to authenticate modem headers Content-Language: en-US To: Krzysztof Kozlowski , , , , CC: , , , , , , , , , , References: <20221213140724.8612-1-quic_sibis@quicinc.com> <20221213140724.8612-5-quic_sibis@quicinc.com> <8739f59b-c551-2da4-5523-a89f960bd402@linaro.org> From: Sibi Sankar In-Reply-To: <8739f59b-c551-2da4-5523-a89f960bd402@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: UkU5gjAuNWLQpOHTFWohtq-bRXTSxxh6 X-Proofpoint-ORIG-GUID: UkU5gjAuNWLQpOHTFWohtq-bRXTSxxh6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-14_04,2022-12-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=981 priorityscore=1501 phishscore=0 lowpriorityscore=0 adultscore=0 bulkscore=0 clxscore=1015 impostorscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212140084 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/14/22 01:17, Krzysztof Kozlowski wrote: > On 13/12/2022 15:07, Sibi Sankar wrote: >> The memory region allocated using dma_alloc_attr with no kernel mapping >> attribute set would still be a part of the linear kernel map. Any access >> to this region by the application processor after assigning it to the >> remote Q6 will result in a XPU violation. Fix this by replacing the >> dynamically allocated memory region with a no-map carveout and unmap the >> modem metadata memory region before passing control to the remote Q6. >> >> Reported-by: Amit Pundir >> Fixes: 6c5a9dc2481b ("remoteproc: qcom: Make secure world call for mem ownership switch") >> Signed-off-by: Sibi Sankar >> --- > > Thank you for your patch. There is something to discuss/improve. >> >> return ret < 0 ? ret : 0; >> @@ -1882,6 +1899,26 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) >> qproc->mpss_phys = qproc->mpss_reloc = r.start; >> qproc->mpss_size = resource_size(&r); >> >> + if (!child) { >> + node = of_parse_phandle(qproc->dev->of_node, "memory-region", 2); >> + } else { >> + child = of_get_child_by_name(qproc->dev->of_node, "metadata"); > > Bindings do not allow to have child "metadata", do they? memory-region property was used to specify mba/mpss region in a phandle array only from SC7180 SoC. All the older dtbs in the wild/upstream still had sub-nodes to achieve the same. Patch 3 allows for a sub-set of the SoCs (MSM8996/MSM8998/SDM845) to use metadata as a sub-node so as to not break bindings when newer kernel uses a older dtb. - Sibi > >> + node = of_parse_phandle(child, "memory-region", 0); >> + of_node_put(child); >> + } >> + >> + if (!node) >> + return 0; >> + >> + ret = of_address_to_resource(node, 0, &r); >> + of_node_put(node); >> + if (ret) { >> + dev_err(qproc->dev, "unable to resolve metadata region\n"); >> + return ret; >> + } >> + >> + qproc->mdata_phys = r.start; >> + >> return 0; >> } >> > > Best regards, > Krzysztof >