Received: from eggs.gnu.org ([2001:4830:134:3::10]:49957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6tKh-00058J-RU for qemu-devel@nongnu.org; Mon, 01 Oct 2018 04:13:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6tKe-0006sV-MU for qemu-devel@nongnu.org; Mon, 01 Oct 2018 04:13:35 -0400 References: <20180926094219.20322-1-david@redhat.com> <20180926094219.20322-9-david@redhat.com> From: David Hildenbrand Message-ID: <83585994-587f-8281-3540-efa77ea8df2c@redhat.com> Date: Mon, 1 Oct 2018 10:13:17 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 08/24] memory-device: document MemoryDeviceClass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Auger Eric , qemu-devel@nongnu.org Cc: Pankaj Gupta , Eduardo Habkost , "Michael S . Tsirkin" , Xiao Guangrong , "Dr . David Alan Gilbert" , Markus Armbruster , Alexander Graf , qemu-ppc@nongnu.org, Paolo Bonzini , Igor Mammedov , Luiz Capitulino , David Gibson , Richard Henderson On 30/09/2018 16:43, Auger Eric wrote: > Hi David, >=20 > On 9/26/18 11:42 AM, David Hildenbrand wrote: >> Document the functions and when to not expect errors. >> >> Reviewed-by: David Gibson >> Signed-off-by: David Hildenbrand >=20 >> --- >> include/hw/mem/memory-device.h | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-de= vice.h >> index f02b229837..1d15cfc357 100644 >> --- a/include/hw/mem/memory-device.h >> +++ b/include/hw/mem/memory-device.h >> @@ -29,9 +29,25 @@ typedef struct MemoryDeviceState { >> Object parent_obj; >> } MemoryDeviceState; >> =20 >> +/**> + * MemoryDeviceClass: >> + * @get_addr: The address of the @md in guest physical memory. "0" me= ans that >> + * no address has been specified by the user and that no address has = been >> + * assigned yet. >> + * @get_plugged_size: The amount of memory provided by this @md curre= ntly >> + * usable ("plugged") by the guest. This is helpful for devices that >> + * dynamically manage the amount of memory accessible by the guest vi= a >> + * the reserved memory region. For most devices, this corresponds to = the >> + * size of the memory region. >> + * @get_region_size: The size of the memory region of the @md that's = mapped >> + * in guest physical memory at @get_addr. >> + * @fill_device_info: Translate current @md state into #MemoryDeviceI= nfo. > I think it may be relevant to document whether all those functions are > mandated or if any are optional. All are mandatory if not otherwise specified (right now none) .... >=20 > With respect to the form, you could get inspired of > include/exec/memory.h (see for instance IOMMUMemoryRegionClass doc) >=20 ... which seems to be the same approach used in IOMMUMemoryRegionClass. While I am a friend of documentation, I prefer to keep it short where possible. (e.g. obvious things like "@md: the MemoryDeviceState", I don't consider useful) I am using right now a similar style as in include/hw/mem/pc-dimm.h and include/exec/memory.h. BTW, is there a coding style about such things? (where, how to document classes, structs, fuucntions and parameters) Thanks! --=20 Thanks, David / dhildenb