pc: Remove PCLMULQDQ from Westmere on pc-*-1.4 and older

Commit 41cb383f42d0cb51d8e3e25e3ecebc954dd4196f made a guest-visible
change by adding the PCLMULQDQ bit to Westmere without adding
compatibility code to keep the ABI for older machine-types.
Fix it by adding the missing compat code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging

QOM CPUState refactorings

* Fix X86CPU Westmere CPUID for pc-*-1.4 and older

* afaerber/tags/qom-cpu-for-anthony:
  pc: Remove PCLMULQDQ from Westmere on pc-*-1.4 and older

Conflicts:
	hw/i386/pc_piix.c
	hw/i386/pc_q35.c

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Update version for 1.6.0-rc3

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
pc: Remove PCLMULQDQ from Westmere on pc-*-1.4 and older

Commit 41cb383f42d0cb51d8e3e25e3ecebc954dd4196f made a guest-visible
change by adding the PCLMULQDQ bit to Westmere without adding
compatibility code to keep the ABI for older machine-types.
Fix it by adding the missing compat code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>

Conflicts:
	hw/i386/pc_piix.c
	hw/i386/pc_q35.c

Conflicts:
	hw/i386/pc_q35.c
qemu-option: add def_value_str in QemuOptDesc struct and rewrite qemu_opts_print

qemu_opts_print has no user now, so can re-write the function safely.

qemu_opts_print is used while using "qemu-img create", it
produces the same output as previous code.

The behavior of this function has changed:

1. Print every possible option, whether a value has been set or not.
2. Option descriptors may provide a default value.
3. Print to stdout instead of stderr.

Previously the behavior was to print every option that has been set.
Options that have not been set would be skipped.

v13->v14:
1) fix memory leak.
2) make opt_set do not accpet null value argument.

v12->v13
1) re-write commit message.

v11->v12
1) make def_value_str become the real default value string in opt_set
function.

v10->v11:
1) print all values that have actually been assigned while accept-any
cases.

v7->v8:
1) print "elements => accept any params" while opts_accepts_any() ==
true.
2) since def_print_str is the default value if an option isn't set,
so rename it to def_value_str.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
qemu-option: avoid duplication of default value in QemuOpts

This patch moves the default value entirely to QemuOptDesc.

When getting the value of an option that hasn't been set, and
QemuOptDesc has a default value, return that.  Else, behave as
before.

Example: qemu_opt_get_number(opts, "foo", 42)

   If "foo" has been set in opts, return its value.

   Else, if opt's QemuOptDesc has a default value for "foo", return
   that.

   Else, return 42.

   Note that the last argument is useless when QemuOptDesc has a
   default value.  Ugly.  If it bothers us, we could assert.

Example: qemu_opt_get(opts, "bar")

   If "bar" has been set in opts, return its value.

   Else, if opt's QemuOptDesc has a default value for "bar", return
   that.

   Else, return NULL.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>

v13->v14:
1) change code style.
2) assert errors.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>

Conflicts:
	util/qemu-option.c
qemu-option: create four QemuOptsList related functions

This patch creates 4 functions, count_opts_list, qemu_opts_append,
qemu_opts_free and qemu_opts_print_help, they are used in following
commits.

v16->v17:
1) fix indentation.
2) fix typo.

v15->v16:
1) discard double-initialization.
2) use pointer directly, not g_strdup.

v12->v13:
1) simply assert that neither argument has merge_lists set.
2) drop superfluous paranthesesis around p == first.

v11->v12:
1) renmae functions.
2) fix loop styles and code styles.
3) qemu_opts_apend will not return NULL now.
4) merge_lists value is from arguments in qemu_opts_append.

v6->v7:
1) Fix typo.

v5->v6:
1) allocate enough space in append_opts_list function.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
qemu-option: create some QemuOpts functons

These functions will be used in next commit.

qemu_opt_get_(*)_del functions are used to make sure we
have the same behaviors as before: in block layer, after
parsing a parameter value, parameter list will delete it
to avoid parsing it twice.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>

v16->v17:
1) return "char *" instead of "const char*"

v13->v14:
1) rewrite commit message.
2) use def_value_str in qemu_opt_get_FOO_del() and qemu_opt_get_del().
3) delete redundant qemu_opt_del(opt).
qemu-option: opt->str store digit, without suffixes

To produce same output while using "qemu-img create", opt->str
should store pure digit, without suffixes.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
add interface to block

To make patches easy for reviewing, each block format is
a single patch. Add a new interface to block layer to make
sure origin code can compile and do not change any code
logic.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
block: add QemuOpts support for cow.c
block: add QemuOpts support for gluster.c
block: add QemuOpts support for iscsi.c

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
block: add QemuOpts support for qcow.c

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
block: add QemuOpts support for qcow2.c

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
block: add QemuOpts support for qed.c

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
block: add QemuOpts support for raw-posix.c

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
block: add QemuOpts support for raw-win32.c

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
block: add QemuOpts support for raw.c

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
block: add QemuOpts support for rbd.c

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>