From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoZtT-0007SB-EG for qemu-devel@nongnu.org; Tue, 20 Oct 2015 12:36:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoZtO-0005Hk-6y for qemu-devel@nongnu.org; Tue, 20 Oct 2015 12:36:11 -0400 Received: from mga09.intel.com ([134.134.136.24]:65522) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoZtO-0005Gr-1U for qemu-devel@nongnu.org; Tue, 20 Oct 2015 12:36:06 -0400 References: <1445216059-88521-1-git-send-email-guangrong.xiao@linux.intel.com> <1445216059-88521-29-git-send-email-guangrong.xiao@linux.intel.com> <20151020155149.GB2772@stefanha-thinkpad.home> <56266B3B.4080407@linux.intel.com> From: Xiao Guangrong Message-ID: <56266BF0.3010905@linux.intel.com> Date: Wed, 21 Oct 2015 00:29:36 +0800 MIME-Version: 1.0 In-Reply-To: <56266B3B.4080407@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 28/33] nvdimm acpi: support DSM_FUN_IMPLEMENTED function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, imammedo@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, rth@twiddle.net On 10/21/2015 12:26 AM, Xiao Guangrong wrote: > > > On 10/20/2015 11:51 PM, Stefan Hajnoczi wrote: >> On Mon, Oct 19, 2015 at 08:54:14AM +0800, Xiao Guangrong wrote: >>> +exit: >>> + /* Write our output result to dsm memory. */ >>> + ((dsm_out *)dsm_ram_addr)->len = out->len; >> >> Missing byteswap? >> >> I thought you were going to remove this field because it wasn't needed >> by the guest. >> > > The @len is the size of _DSM result buffer, for example, for the function of > DSM_FUN_IMPLEMENTED the result buffer is 8 bytes, and for > DSM_DEV_FUN_NAMESPACE_LABEL_SIZE the buffer size is 4 bytes. It tells ASL code Sorry, s/DSM_DEV_FUN_NAMESPACE_LABEL_SIZE/DSM_DEV_FUN_SET_NAMESPACE_LABEL_DATA > how much size of memory we need to return to the _DSM caller. > > In _DSM code, it's handled like this: > > "RLEN" is @len, “OBUF” is the left memory in DSM page. > > /* get @len*/ > aml_append(method, aml_store(aml_name("RLEN"), aml_local(6))); > /* @len << 3 to get bits. */ > aml_append(method, aml_store(aml_shiftleft(aml_local(6), > aml_int(3)), aml_local(6))); > > /* get @len << 3 bits from OBUF, and return it to the caller. */ > aml_append(method, aml_create_field(aml_name("ODAT"), aml_int(0), > aml_local(6) , "OBUF")); > > Since @len is our internally used, it's not return to guest, so i did not do > byteswap here.