From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH v5 28/33] nvdimm acpi: support Get Namespace Label Size function Date: Thu, 29 Oct 2015 10:16:14 +0800 Message-ID: <5631816E.8000106@linux.intel.com> References: <1446071191-62591-1-git-send-email-guangrong.xiao@linux.intel.com> <1446071191-62591-29-git-send-email-guangrong.xiao@linux.intel.com> <20151028164136.GB1925@stefanha-x1.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: pbonzini@redhat.com, imammedo@redhat.com, gleb@kernel.org, mtosatti@redhat.com, mst@redhat.com, rth@twiddle.net, ehabkost@redhat.com, dan.j.williams@intel.com, kvm@vger.kernel.org, qemu-devel@nongnu.org To: Stefan Hajnoczi Return-path: Received: from mga09.intel.com ([134.134.136.24]:16511 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751237AbbJ2CWv (ORCPT ); Wed, 28 Oct 2015 22:22:51 -0400 In-Reply-To: <20151028164136.GB1925@stefanha-x1.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: On 10/29/2015 12:41 AM, Stefan Hajnoczi wrote: > On Wed, Oct 28, 2015 at 10:26:26PM +0000, Xiao Guangrong wrote: >> +struct nvdimm_func_in_get_label_data { >> + uint32_t offset; /* the offset in the namespace label data area. */ >> + uint32_t length; /* the size of data is to be read via the function. */ >> +} QEMU_PACKED; >> +typedef struct nvdimm_func_in_get_label_data nvdimm_func_in_get_label_data; > > ./CODING_STYLE "3. Naming": > > Structured type names are in CamelCase; harder to type but standing > out. Did not realize it before. Will change its name to: NVDIMMFuncInGetLabelData And the same as others. > > I'm surprised that scripts/checkpatch.pl didn't warning about this. > >> +/* >> + * the max transfer size is the max size transferred by both a >> + * 'Get Namespace Label Data' function and a 'Set Namespace Label Data' >> + * function. >> + */ >> +static uint32_t nvdimm_get_max_xfer_label_size(void) >> +{ >> + nvdimm_dsm_in *in; >> + uint32_t max_get_size, max_set_size, dsm_memory_size = getpagesize(); > > Why is the host's page size relevant here? Did you mean > TARGET_PAGE_SIZE? Yes. NVDIMM is the common code, unfortunately TARGET_PAGE_SIZE is platform specified and QEMU lacks a place to include this kind of specified definition: $ git grep "#define TARGET_PAGE_SIZE" include/exec/cpu-all.h:#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS) [eric@xiaoreal1 qemu]$ git grep "#define TARGET_PAGE_BITS" target-alpha/cpu.h:#define TARGET_PAGE_BITS 13 target-arm/cpu.h:#define TARGET_PAGE_BITS 12 target-arm/cpu.h:#define TARGET_PAGE_BITS 10 target-cris/cpu.h:#define TARGET_PAGE_BITS 13 target-i386/cpu.h:#define TARGET_PAGE_BITS 12 target-lm32/cpu.h:#define TARGET_PAGE_BITS 12 target-m68k/cpu.h:#define TARGET_PAGE_BITS 13 target-m68k/cpu.h:#define TARGET_PAGE_BITS 10 target-microblaze/cpu.h:#define TARGET_PAGE_BITS 12 target-mips/mips-defs.h:#define TARGET_PAGE_BITS 12 target-moxie/cpu.h:#define TARGET_PAGE_BITS 12 /* 4k */ target-openrisc/cpu.h:#define TARGET_PAGE_BITS 13 target-ppc/cpu.h:#define TARGET_PAGE_BITS 12 target-ppc/cpu.h:#define TARGET_PAGE_BITS_64K 16 target-ppc/cpu.h:#define TARGET_PAGE_BITS_16M 24 target-ppc/cpu.h:#define TARGET_PAGE_BITS 12 target-ppc/cpu.h:#define TARGET_PAGE_BITS 10 target-ppc/cpu.h:#define TARGET_PAGE_BITS 12 target-s390x/cpu.h:#define TARGET_PAGE_BITS 12 target-sh4/cpu.h:#define TARGET_PAGE_BITS 12 /* 4k XXXXX */ target-sparc/cpu.h:#define TARGET_PAGE_BITS 12 /* 4k */ target-sparc/cpu.h:#define TARGET_PAGE_BITS 13 /* 8k */ target-tilegx/cpu.h:#define TARGET_PAGE_BITS 16 /* TILE-Gx uses 64KB page size */ target-tricore/tricore-defs.h:#define TARGET_PAGE_BITS 14 target-unicore32/cpu.h:#define TARGET_PAGE_BITS 12 target-xtensa/cpu.h:#define TARGET_PAGE_BITS 12