Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp865745ybl; Fri, 16 Aug 2019 05:22:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvSJYMtv5vkEn0Atf9ErJLNBU2k6IEXw29MuZEzyBpt8fLlLLEJu8WKib2IRf3lEJJqtev X-Received: by 2002:a17:90a:de01:: with SMTP id m1mr2708970pjv.43.1565958123197; Fri, 16 Aug 2019 05:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565958123; cv=none; d=google.com; s=arc-20160816; b=RjxeXXHVgcZt6N/O9VwUVCuFUjIiGE8MBTzlCeWmW3ELHYr5OlRUP+uEv1vkLuBcVJ F2GSXe06ZJvD1BbPa/AizCVWpEP2BdOY+E/cS9j1vmtIh/0JbJe4a3shqvfnJzW0i2ke JCNu7Xmy/nFa9c0dUCWi/UVLxkMubGDgidKEDXncROJ0BkbnvTJMimrmGJ4Jp3VGwqsw eXywx7XyaRFMpcdBwGWhtChaPhOdsl6vFB5L0NcS2/aOwf1cCreIYGG5O0s9s0Zkjig4 05IVGaikn+uq1D7WSbklNxpRHYMaRJm+M2/XPM50FObUvnIBGvWEW+uY/3T71YJUNCBh 2+Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=BSu8IvWvvbvmrGb/CgKULzr7aYTiI6QZczZ8env2h1U=; b=bqETCqtMf+T3iGA5bpVLCt9CHOGoCypAhDcYT5STYharJk1p7uN2I5Fh6j1j+bEryn U0q88dswU5Ey2z6VVFcH+TfWezk5fBxurRX3FUAg59svGxfkg/f2KF61AmPQ9Mbg6MQP 8nW0Up7FK6Ij5iX0NTPhf8X7ukvw4FjDh0m16QDRfzLPBVkh5BRmo3fRMgHxOWXoXgkj Qeoppp2+gcV+MM6gjfNBaBQUKbN1vmpNmGKdL3WI/gHTpxJt8CuCdk8szgQMt4WOAc/T GJ9T+GCJZVwEuvwDu3IZ4hfwhbP2YtbS1LaSEQZ6uCy1nh+ASn1ekdCnAxJlOio1eGSY C1XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@runbox.com header.s=rbselector1 header.b=QTkZSQVc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=runbox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si3726162pgu.16.2019.08.16.05.21.45; Fri, 16 Aug 2019 05:22:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@runbox.com header.s=rbselector1 header.b=QTkZSQVc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=runbox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727178AbfHPMVB (ORCPT + 99 others); Fri, 16 Aug 2019 08:21:01 -0400 Received: from aibo.runbox.com ([91.220.196.211]:48154 "EHLO aibo.runbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727007AbfHPMVB (ORCPT ); Fri, 16 Aug 2019 08:21:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Transfer-Encoding:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=BSu8IvWvvbvmrGb/CgKULzr7aYTiI6QZczZ8env2h1U=; b=QTkZSQVcELXjXkSq0+dXq4vNKe Z9vQKAfK2tbEDiTWhDalupw7jgMTtZmSyU9iybb4gDQwyMmo3k241qjQRMhE/YHSa+X9bA/VMko6u v1iq/lNAoo46FpYHfgsIEdMJNotE1UrKoL6t/cNKX/bg8GiR+ewcS368/HTNVaizneAQbOqiG4yrW bliM1f5ue0C2u1RsiULBfmv8DxqLqrWNV9tEeKMAgRXqrCWTNyBTBxgX++33laohz3HriBgu4PeIF 9t8pO8P2Z0xMzUo/q7Hb0xECtxJIjTFhgvEzbMJaHvcyBoVOsdiidPZBabCLzF2K9bNCTWFtVzngS Si5UYQkw==; Received: from [10.9.9.203] (helo=mailfront21.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1hybE0-0003Sd-R7; Fri, 16 Aug 2019 14:20:56 +0200 Received: by mailfront21.runbox with esmtpsa [Authenticated alias (536975)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1hybDn-0002aC-4s; Fri, 16 Aug 2019 14:20:43 +0200 Date: Fri, 16 Aug 2019 08:20:36 -0400 From: "M. Vefa Bicakci" To: Andy Shevchenko Cc: Platform Driver , Linux Kernel Mailing List , Rajneesh Bhardwaj , Vishwanath Somayaji , Darren Hart , Andy Shevchenko Subject: Re: [PATCH] platform/x86: intel_pmc_core: Do not ioremap RAM Message-ID: <20190816082036.7b60c9f5@runbox.com> In-Reply-To: References: <20190816014140.10687-1-m.v.b@runbox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 16 Aug 2019 12:21:58 +0300 Andy Shevchenko wrote: > On Fri, Aug 16, 2019 at 4:42 AM M. Vefa Bicakci wrote: > > > > On a Xen-based PVH virtual machine with more than 4 GiB of RAM, > > intel_pmc_core fails initialization with the following warning message > > from the kernel, indicating that the driver is attempting to ioremap > > RAM: > > > > ------------[ cut here ]------------ > > ioremap on RAM at 0x00000000fe000000 - 0x00000000fe001fff > > > This issue appears to manifest itself because of the following fallback > > mechanism in the driver: > > > > if (lpit_read_residency_count_address(&slp_s0_addr)) > > pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; > > > > The validity of address PMC_BASE_ADDR_DEFAULT (i.e., 0xFE000000) is not > > verified by the driver, which is what this patch introduces. With this > > patch, if address PMC_BASE_ADDR_DEFAULT is in RAM, then the driver will > > not attempt to ioremap the aforementioned address. > > Thank you for the patch. Hello Andy, Thank you for reviewing the patch! > Is there anything preventing us to use memremap() in such case? I re-read the documentation for memremap a few times along with taking a look at its code, but I think I am missing an important piece of information. As I understand it, depending on its flags, memremap would allow a section of RAM to be mapped for the PMC driver. The intention with this patch is to prevent the driver from being instantiated when the default/fallback memory address is in RAM, as this issue occurs with a non-administrative virtual machine (domU in Xen terminology) that does not simulate or pass-through a corresponding PMC device. I think that I have misunderstood your review comment though, so I would apppreciate it if you could elaborate. Thanks again for reviewing the patch, Vefa (Please note that my next reply may be delayed by about 10 hours.)