Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp6232534pxb; Mon, 8 Nov 2021 05:26:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUIarhU8F5ybNm3bwVvCYnv2ZjmLmeSlmYhrLZMRQCL3ECC7EcGxMIEnZAZ2cfhLKolxDV X-Received: by 2002:a6b:6e08:: with SMTP id d8mr4592124ioh.53.1636377962802; Mon, 08 Nov 2021 05:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636377962; cv=none; d=google.com; s=arc-20160816; b=u1yG3xR93B5I44nzBMoOUkktMZ5caToFwPoBKliNOAOFj8BvM7kic8P4wEYF764ui0 e0AJeCDdYQc7Ftc+eObVIXpOLUU46rPtRBPTwg4Ghc5YbNIa7Zt3g/SSDd6j+vdhz/Dm EqRVXXqaEBN8V9MzQgZyhn/N+BWMTfvLtPTOQFiLH6wMlNYqGzr1x/jXLgxsmU7i9Z3/ EgvO27Vy2mO010mbHpWRmrim8V1b5qKT1+3BMgRvpyWct3LAG9IE+TC/wVUVF48dSYBG JdpNXZ8FMUYE/spSTGrtD7kKAnmjG/PaA6HZUk5WSlHjpFmh09OVmtpPwW+10dv045Yj wmCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=Wkez+BGR0cB/bR5Sx2tQp+g1Wv1eaHAWl3+KK1G0OCY=; b=ITfDVmsaSW9C0KXsAXrrKPSbE0z97BA5cH77FOgs1XHJ1eGzWr/doGKWz4bWalX/FJ BEo/9KErOXfwJnBO7QZNaaHPS75SeR7yd0SSmUWhvWsmkBXu51JpJBFBXqhU062fbUCp vqCEO6n0Y8zwLJzLWFMcz2AdDSBJQk9GLb+ZIIFslgd0X8cu43va5gxg8cDyt12/ipyT gbADX4Hw1n+Xc2GdQ4tYSnZGuTj4YioVTc6f2V5VibPPLfHa7EyPC7E1YIxSEwmF3Xar gEOkgBTTaXljBPyYK/jT8XCX1K+DrUjbO/WE7fAuIy5CXiUr1ELAqg6sBNm67taeKxlc W/1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s19si39430333jat.11.2021.11.08.05.25.49; Mon, 08 Nov 2021 05:26:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237701AbhKHJu6 (ORCPT + 99 others); Mon, 8 Nov 2021 04:50:58 -0500 Received: from mailgw01.mediatek.com ([60.244.123.138]:39542 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232818AbhKHJu5 (ORCPT ); Mon, 8 Nov 2021 04:50:57 -0500 X-UUID: 3ee690613a8d4cecb71755dac53b3aae-20211108 X-UUID: 3ee690613a8d4cecb71755dac53b3aae-20211108 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1011212809; Mon, 08 Nov 2021 17:48:08 +0800 Received: from mtkmbs10n1.mediatek.inc (172.21.101.34) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Mon, 8 Nov 2021 17:48:08 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs10n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 8 Nov 2021 17:48:08 +0800 From: Mark-PK Tsai To: , , CC: , , , Subject: remoteproc: rproc_va_to_pa returns invalid physical address when using sparse memory model Date: Mon, 8 Nov 2021 17:48:08 +0800 Message-ID: <20211108094808.1993-1-mark-pk.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On my arm platform with CONFIG_SPARSEMEM=y, when the virtual address comes from ioremap, which map to a reserved memory region, rproc_va_to_pa returns a invalid address. (no iommu) It's because the corresponding struct page and section not present. And then __page_to_pfn read the page->flags in the returned page which is actually an invalid address. (When CONFIG_SPARSMEM=y && CONFIG_SPARSEMEM_VMEMMAP=n, kernel get the section the page belong to in flags field.) I'm looking for suggestion to properly fix this problem. Could you please give us some suggestion?