All of lore.kernel.org
 help / color / mirror / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org
Cc: Pankaj Gupta <pagupta@redhat.com>,
	Xiao Guangrong <xiaoguangrong.eric@gmail.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Markus Armbruster <armbru@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-ppc@nongnu.org, Igor Mammedov <imammedo@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Luiz Capitulino <lcapitul@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 08/24] memory-device: document MemoryDeviceClass
Date: Mon, 1 Oct 2018 12:40:39 +0200	[thread overview]
Message-ID: <87c04fe9-7942-9153-d193-d3c968d42aa6@redhat.com> (raw)
In-Reply-To: <83585994-587f-8281-3540-efa77ea8df2c@redhat.com>

Hi David,

On 10/1/18 10:13 AM, David Hildenbrand wrote:
> On 30/09/2018 16:43, Auger Eric wrote:
>> Hi David,
>>
>> On 9/26/18 11:42 AM, David Hildenbrand wrote:
>>> Document the functions and when to not expect errors.
>>>
>>> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
>>> Signed-off-by: David Hildenbrand <david@redhat.com>
>>
>>> ---
>>>  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-device.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;
>>>  
>>> +/**> + * MemoryDeviceClass:
>>> + * @get_addr: The address of the @md in guest physical memory. "0" means 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 currently
>>> + * usable ("plugged") by the guest. This is helpful for devices that
>>> + * dynamically manage the amount of memory accessible by the guest via
>>> + * 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 #MemoryDeviceInfo.
>> 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) ....
> 
>>
>> With respect to the form, you could get inspired of
>> include/exec/memory.h (see for instance IOMMUMemoryRegionClass doc)
>>
> 
> ... 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)
agreed ;-)
> 
> 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)
I am not aware of any. IOMMUMemoryRegionClass doc was written latterly
by Peter so I would be tempted to think this is a good model ;-)

Thanks

Eric
> 
> Thanks!
> 
> 

  reply	other threads:[~2018-10-01 10:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180926094219.20322-1-david@redhat.com>
     [not found] ` <20180926094219.20322-9-david@redhat.com>
     [not found]   ` <df729c85-6fa1-93d7-c91e-7d3738fbf38f@redhat.com>
2018-10-01  8:13     ` [Qemu-devel] [PATCH v4 08/24] memory-device: document MemoryDeviceClass David Hildenbrand
2018-10-01 10:40       ` Auger Eric [this message]
     [not found] ` <20180926094219.20322-15-david@redhat.com>
     [not found]   ` <99ab8baf-37c9-2df1-7292-8e0ac4f31137@redhat.com>
2018-10-01  8:15     ` [Qemu-devel] [PATCH v4 14/24] memory-device: complete factoring out plug handling David Hildenbrand
2018-10-01  8:18       ` David Hildenbrand
2018-10-01  9:01         ` Igor Mammedov
     [not found] ` <20180926094219.20322-17-david@redhat.com>
     [not found]   ` <2c164355-1592-a785-b761-463f00dee259@redhat.com>
2018-10-01  8:21     ` [Qemu-devel] [PATCH v4 16/24] memory-device: trace when pre_assigning/assigning/unassigning addresses David Hildenbrand
     [not found] ` <20180926094219.20322-18-david@redhat.com>
     [not found]   ` <9be6d517-615d-34ef-f6f4-4d478ef21944@redhat.com>
2018-10-01  8:36     ` [Qemu-devel] [PATCH v4 17/24] memory-device: add class function get_device_id() David Hildenbrand
     [not found] ` <20180926094219.20322-20-david@redhat.com>
2018-10-01 13:37   ` [Qemu-devel] [PATCH v4 19/24] virtio-pmem: prototype Igor Mammedov
     [not found] ` <20180926094219.20322-22-david@redhat.com>
2018-10-01 18:57   ` [Qemu-devel] [PATCH v4 21/24] hmp: handle virtio-pmem when printing memory device infos Dr. David Alan Gilbert
     [not found] ` <20180926094219.20322-23-david@redhat.com>
2018-10-01 18:59   ` [Qemu-devel] [PATCH v4 22/24] numa: handle virtio-pmem in NUMA stats Dr. David Alan Gilbert
     [not found] ` <20180926094219.20322-19-david@redhat.com>
     [not found]   ` <20180927150141.60a6488a@redhat.com>
     [not found]     ` <dc5d7b2d-5b51-2c0b-aac7-ebf04a4e7859@redhat.com>
2018-10-01 13:24       ` [Qemu-devel] [PATCH v4 18/24] qdev: hotplug: provide do_unplug handler Igor Mammedov
2018-10-02  9:49         ` David Hildenbrand
2018-10-02 14:23           ` Igor Mammedov
2018-10-02 15:36             ` David Hildenbrand
2018-10-08 11:47         ` David Hildenbrand
2018-10-08 12:19           ` Igor Mammedov
2018-10-08 12:41             ` David Hildenbrand
2018-10-08 14:12               ` Igor Mammedov
2018-10-11  8:50                 ` David Hildenbrand
2018-10-12  8:27                   ` Igor Mammedov
2018-10-12  8:45                     ` David Hildenbrand
2018-10-12 14:21                       ` Igor Mammedov
2018-10-15  7:21                         ` David Hildenbrand
2018-10-03  6:29   ` David Gibson
2018-10-03 17:21     ` David Hildenbrand
2018-10-04 15:59       ` Igor Mammedov
2018-10-05  7:40         ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87c04fe9-7942-9153-d193-d3c968d42aa6@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lcapitul@redhat.com \
    --cc=mst@redhat.com \
    --cc=pagupta@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=xiaoguangrong.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.