Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1877703rdb; Thu, 21 Sep 2023 02:04:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcBDqQ987zPFraPg74NurABT4VVZmq4CITfmPt/SyxzdDz29WmAn+0K0Sb+xmX27CCTwiW X-Received: by 2002:a05:6a20:1608:b0:15a:7d2:7594 with SMTP id l8-20020a056a20160800b0015a07d27594mr5259840pzj.11.1695287081380; Thu, 21 Sep 2023 02:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695287081; cv=none; d=google.com; s=arc-20160816; b=p5TP/x+Nn6+XHWKfWn4wH+uOikRmomupq4TDOBK4OVIHmkPdEueTDY1HbAdokxFKBS KfNhfLXo2hwdC9gwtG1rwopI2lV5LpNQJQmP1U7BxAIqLkxrUcGPmBgMgIM1UC4Hn5Ak 4xBkx+EiAx/DXiRoPZUW93JPGb/8rkkBri3c2fFbmP8dFLNMg+lphdfQLe/iBh0V+K/n jD+mMOCP7J5C91PpHD/zclhrw91GlN2xf9e1FekZYVzos6Qmonn98Z5fkzhpH/GL8toH vxqfPZGBKqSbivOrsjwAixOxXatA2dV9WqM6DGWOPtBcyYESVZavLsNsiSSaVQxKApsZ bETQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=xNyb8ZIupF+SY+3e23HEdJol+sE1HfzbPJHdC+LOLQc=; fh=JqQ9vB33k0mgLF+8qvMDdtg+EJ5VT4RAgruajKjRjLc=; b=PZX+gOtwpKQ+prYEPD7GVrUU888ZlPGOAFFDPNgL/9jWzgZ/excmffTLuG1YxBRCOA MjvVUoAaEXYdUq3ylrWRPjUI/+hX2Yg6K4lB8HnsOFEQUTyAq8Zt3zVDr/JoH1GXhvkG DXnXb0WKS+9uxU8/wqEohrfY8cp3Eh1FftjT1AEI+dX2MZ9NKRYgVB3uVgtjkyIYvi14 UKjMRzdLMf0VQBBowS5O7EmPiblqVw1A4QigSa5MJPOvSgXLZXH3OfmkMrpVK540zQMg Du63HiLDISRNvIkm13XbPZRggZ+AMbXMrcGse530Jvytu0FS2SX/EaRgOfXHHpoq9IOX B4uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=c0977gJC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id r7-20020a17090a690700b00274001b10e8si1182535pjj.112.2023.09.21.02.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 02:04:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=c0977gJC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8D634802D41C; Wed, 20 Sep 2023 19:38:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229621AbjIUCiB (ORCPT + 99 others); Wed, 20 Sep 2023 22:38:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbjIUCh4 (ORCPT ); Wed, 20 Sep 2023 22:37:56 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35C1EE4; Wed, 20 Sep 2023 19:37:51 -0700 (PDT) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38L2ETRR004317; Thu, 21 Sep 2023 02:37:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : date : subject : mime-version : content-type : content-transfer-encoding : message-id : references : in-reply-to : to : cc; s=qcppdkim1; bh=xNyb8ZIupF+SY+3e23HEdJol+sE1HfzbPJHdC+LOLQc=; b=c0977gJCtvleggYx+qvcdtSAGVtyHyTQSr+MSsbf1PiITHpUh0VZb0YlltFKv50OCIut Qifmqn5MDrzjh5nhKVmfcySAjgq/or84mcaBeqpLJMTYAR9MjqPVuIm13Cm13+ZA1WSE fdwOki7rf9kSwtQlDpbXQ3UdF7hUpK9WbgDOU1VmcxHz1ERFn8wl8KiytWKIwDG9bJ5Z wY6e7ylHiNYn75CJVkXxJmKDWN8JC2yZ7DN6IaPxK6j6zzVHbqR8YAOC12zLQmtYeLsg F5GXGdtxSrGDg6xp+WIGrwt7lzXoFbL/nsKYy1C6F+qWol4nzp0BrqbVZW7y8Qg12fJi 0w== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t87510k7n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Sep 2023 02:37:45 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38L2biLB024347 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Sep 2023 02:37:44 GMT Received: from hu-bjorande-lv.qualcomm.com (10.49.16.6) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 20 Sep 2023 19:37:44 -0700 From: Bjorn Andersson Date: Wed, 20 Sep 2023 19:37:31 -0700 Subject: [PATCH v3 2/3] soc: qcom: rmtfs: Support discarding guard pages MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20230920-rmtfs-mem-guard-pages-v3-2-305b37219b78@quicinc.com> References: <20230920-rmtfs-mem-guard-pages-v3-0-305b37219b78@quicinc.com> In-Reply-To: <20230920-rmtfs-mem-guard-pages-v3-0-305b37219b78@quicinc.com> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , Bjorn Andersson X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1695263863; l=1416; i=quic_bjorande@quicinc.com; s=20230915; h=from:subject:message-id; bh=QJw72O7i7ZmFiiHvUXcqqtPd/U+RD0Qw3QJSkoRMKPE=; b=FLlS4/QOwYvniUnTEcOE0fU/3G4BWKz6JFzFl+XjuxpIDc1VWL1XxL0X8ZKscc4kuBPi8IznpKwD cEkMzMjWBzlD00+KSi2O+Onh2IoD0RnuNPDKSVoxnBRrkQMKTRPM X-Developer-Key: i=quic_bjorande@quicinc.com; a=ed25519; pk=VkhObtljigy9k0ZUIE1Mvr0Y+E1dgBEH9WoLQnUtbIM= X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: T7fwUtA8joYQe3ViHH0tIqzSM7z1ZP9M X-Proofpoint-ORIG-GUID: T7fwUtA8joYQe3ViHH0tIqzSM7z1ZP9M X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-20_14,2023-09-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1011 phishscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309210021 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 20 Sep 2023 19:38:05 -0700 (PDT) In some configurations, the exact placement of the rmtfs shared memory region isn't so strict. The DeviceTree author can then choose to use the "size" property and rely on the OS for placement (in combination with "alloc-ranges", if desired). But on some platforms the rmtfs memory region may not be allocated adjacent to regions allocated by other clients. Add support for discarding the first and last 4k block in the region, if qcom,use-guard-pages is specified in DeviceTree. Signed-off-by: Bjorn Andersson --- drivers/soc/qcom/rmtfs_mem.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index f83811f51175..83bba9321e72 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -200,6 +200,15 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) rmtfs_mem->client_id = client_id; rmtfs_mem->size = rmem->size; + /* + * If requested, discard the first and last 4k block in order to ensure + * that the rmtfs region isn't adjacent to other protected regions. + */ + if (of_property_present(node, "qcom,use-guard-pages")) { + rmtfs_mem->addr += SZ_4K; + rmtfs_mem->size -= 2 * SZ_4K; + } + device_initialize(&rmtfs_mem->dev); rmtfs_mem->dev.parent = &pdev->dev; rmtfs_mem->dev.groups = qcom_rmtfs_mem_groups; -- 2.25.1