From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0m2C-0002HK-F2 for qemu-devel@nongnu.org; Fri, 05 Jun 2015 03:27:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0m2B-0004Gn-Fu for qemu-devel@nongnu.org; Fri, 05 Jun 2015 03:27:20 -0400 MIME-Version: 1.0 In-Reply-To: <1433367941-119488-35-git-send-email-agraf@suse.de> References: <1433367941-119488-1-git-send-email-agraf@suse.de> <1433367941-119488-35-git-send-email-agraf@suse.de> Date: Fri, 5 Jun 2015 09:27:18 +0200 Message-ID: From: Laurent Desnogues Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PULL 34/40] machine: add default_ram_size to machine class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Peter Maydell , qemu-ppc@nongnu.org, "qemu-devel@nongnu.org" , Nikunj A Dadhania , David Gibson Hello, On Wed, Jun 3, 2015 at 11:45 PM, Alexander Graf wrote: > From: Nikunj A Dadhania > > Machines types can have different requirement for default ram > size. Introduce a member in the machine class and set the current > default_ram_size to 128MB. > > For QEMUMachine types override the value during the registration of > the machine and for MachineClass introduce the generic class init > setting the default_ram_size. > > Add helpers [K,M,G,T,P,E]_BYTE for better readability and easy usage > > Signed-off-by: Nikunj A Dadhania > Reviewed-by: Thomas Huth > Reviewed-by: David Gibson > Acked-by: Paolo Bonzini > Signed-off-by: David Gibson > Signed-off-by: Alexander Graf > --- > hw/core/machine.c | 9 +++++++++ > include/hw/boards.h | 1 + > include/qemu-common.h | 6 ++++++ > vl.c | 30 ++++++++++++++++-------------- > 4 files changed, 32 insertions(+), 14 deletions(-) > [...] > diff --git a/include/qemu-common.h b/include/qemu-common.h > index 6b373ff..d52d09c 100644 > --- a/include/qemu-common.h > +++ b/include/qemu-common.h > @@ -186,6 +186,12 @@ int64_t strtosz(const char *nptr, char **end); > int64_t strtosz_suffix(const char *nptr, char **end, const char default_suffix); > int64_t strtosz_suffix_unit(const char *nptr, char **end, > const char default_suffix, int64_t unit); > +#define K_BYTE (1ULL << 10) > +#define M_BYTE (1ULL << 20) > +#define G_BYTE (1ULL << 30) > +#define T_BYTE (1ULL << 40) > +#define P_BYTE (1ULL << 50) > +#define E_BYTE (1ULL << 60) > > /* used to print char* safely */ > #define STR_OR_NULL(str) ((str) ? (str) : "null") > diff --git a/vl.c b/vl.c > index 1d4c089..6c7e4e4 100644 > --- a/vl.c > +++ b/vl.c > @@ -120,8 +120,6 @@ int main(int argc, char **argv) > #include "qom/object_interfaces.h" > #include "qapi-event.h" > > -#define DEFAULT_RAM_SIZE 128 This define is still used in qemu-options.hx. We now get this out of "qemu -h": -m[emory] [size=]megs[,slots=n,maxmem=size] configure guest RAM size: initial amount of guest memory (default: DEFAULT_RAM_SIZEMiB) slots: number of hotplug slots (default: none) maxmem: maximum amount of guest memory (default: none) Thanks, Laurent