From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGVCR-0006Ds-4V for qemu-devel@nongnu.org; Tue, 05 Jan 2016 12:15:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGVCN-0005Ca-03 for qemu-devel@nongnu.org; Tue, 05 Jan 2016 12:15:11 -0500 Received: from mga04.intel.com ([192.55.52.120]:23508) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGVCM-0005CW-QG for qemu-devel@nongnu.org; Tue, 05 Jan 2016 12:15:06 -0500 References: <1449040860-19040-1-git-send-email-guangrong.xiao@linux.intel.com> <5680A0C8.6040505@linux.intel.com> <20151228141917-mutt-send-email-mst@redhat.com> <20151230165554.4d15e5a4@nial.brq.redhat.com> <20151230213740-mutt-send-email-mst@redhat.com> <20160105173025.4aa4e69f@nial.brq.redhat.com> <20160105183211-mutt-send-email-mst@redhat.com> From: Xiao Guangrong Message-ID: <568BF861.8040907@linux.intel.com> Date: Wed, 6 Jan 2016 01:07:45 +0800 MIME-Version: 1.0 In-Reply-To: <20160105183211-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] How to reserve guest physical region for ACPI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , Igor Mammedov Cc: ehabkost@redhat.com, kvm@vger.kernel.org, gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, Laszlo Ersek , rth@twiddle.net On 01/06/2016 12:43 AM, Michael S. Tsirkin wrote: >>> Yes - if address is static, you need to put it outside >>> the table. Can come right before or right after this. >>> >>>> Also if OperationRegion() is used, then one has to patch >>>> DefOpRegion directly as RegionOffset must be Integer, >>>> using variable names is not permitted there. >>> >>> I am not sure the comment was understood correctly. >>> The comment says really "we can't use DataTableRegion >>> so here is an alternative". >> so how are you going to access data at which patched >> NameString point to? >> for that you'd need a normal patched OperationRegion >> as well since DataTableRegion isn't usable. > > For VMGENID you would patch the method that > returns the address - you do not need an op region > as you never access it. > > I don't know about NVDIMM. Maybe OperationRegion can > use the patched NameString? Will need some thought. The ACPI spec says that the offsetTerm in OperationRegion is evaluated as Int, so the named object is allowed to be used in OperationRegion, that is exact what my patchset is doing (http://marc.info/?l=kvm&m=145193395624537&w=2): + dsm_mem = aml_arg(3); + aml_append(method, aml_store(aml_call0(NVDIMM_GET_DSM_MEM), dsm_mem)); + aml_append(method, aml_operation_region("NRAM", AML_SYSTEM_MEMORY, + dsm_mem, TARGET_PAGE_SIZE)); We hide the int64 object which is patched by BIOS in the method, NVDIMM_GET_DSM_MEM, to make windows XP happy. However, the disadvantages i see are: a) as Igor pointed out, we need a way to tell QEMU what is the patched address, in NVDIMM ACPI, we used a 64 bit IO ports to pass the address to QEMU. b) BIOS allocated memory is RAM based so it stops us to use MMIO in ACPI, MMIO is the more scalable resource than IO port as it has larger region and supports 64 bits operation.