diff mbox

[qom-cpu,4/4] memory_mapping: Move stubs to libqemustub.a

Message ID 1369228150-5428-5-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber May 22, 2013, 1:09 p.m. UTC
Allows us to drop CONFIG_NO_GET_MEMORY_MAPPING with its indirect
dependency on CONFIG_HAVE_GET_MEMORY_MAPPING in Makefile.target.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 Makefile.target                                 | 2 --
 stubs/Makefile.objs                             | 1 +
 memory_mapping-stub.c => stubs/memory_mapping.c | 5 +++--
 3 files changed, 4 insertions(+), 4 deletions(-)
 rename memory_mapping-stub.c => stubs/memory_mapping.c (85%)

Comments

Paolo Bonzini May 23, 2013, 10:08 a.m. UTC | #1
Il 22/05/2013 15:09, Andreas Färber ha scritto:
> Allows us to drop CONFIG_NO_GET_MEMORY_MAPPING with its indirect
> dependency on CONFIG_HAVE_GET_MEMORY_MAPPING in Makefile.target.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  Makefile.target                                 | 2 --
>  stubs/Makefile.objs                             | 1 +
>  memory_mapping-stub.c => stubs/memory_mapping.c | 5 +++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
>  rename memory_mapping-stub.c => stubs/memory_mapping.c (85%)
> 
> diff --git a/Makefile.target b/Makefile.target
> index 5b02200..efc0b11 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -63,7 +63,6 @@ all: $(PROGS) stap
>  CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
>  CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
>  CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
> -CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
>  
>  #########################################################
>  # cpu emulator library
> @@ -112,7 +111,6 @@ obj-$(CONFIG_KVM) += kvm-all.o
>  obj-y += memory.o savevm.o cputlb.o
>  obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
>  obj-y += dump.o memory_mapping_common.o
> -obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
>  LIBS+=$(libs_softmmu)
>  
>  # xen support
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index 9b701b4..b0bca4d 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -10,6 +10,7 @@ stub-obj-y += fdset-remove-fd.o
>  stub-obj-y += get-fd.o
>  stub-obj-y += get-vm-name.o
>  stub-obj-y += iothread-lock.o
> +stub-obj-y += memory_mapping.o
>  stub-obj-y += migr-blocker.o
>  stub-obj-y += mon-is-qmp.o
>  stub-obj-y += mon-printf.o
> diff --git a/memory_mapping-stub.c b/stubs/memory_mapping.c
> similarity index 85%
> rename from memory_mapping-stub.c
> rename to stubs/memory_mapping.c
> index c48ea44..4db2108 100644
> --- a/memory_mapping-stub.c
> +++ b/stubs/memory_mapping.c
> @@ -11,8 +11,9 @@
>   *
>   */
>  
> -#include "cpu.h"
> -#include "exec/cpu-all.h"
> +#include "qemu-common.h"
> +#include "exec/cpu-common.h"
> +#include "qom/cpu.h"
>  #include "sysemu/memory_mapping.h"
>  
>  int qemu_get_guest_memory_mapping(MemoryMappingList *list)
> 

Patches 1-3 are fine.  But I wonder if a better replacement for stubs is
methods in CPU.

Paolo
Andreas Färber May 28, 2013, 9:39 a.m. UTC | #2
Am 23.05.2013 12:08, schrieb Paolo Bonzini:
> Il 22/05/2013 15:09, Andreas Färber ha scritto:
>> Allows us to drop CONFIG_NO_GET_MEMORY_MAPPING with its indirect
>> dependency on CONFIG_HAVE_GET_MEMORY_MAPPING in Makefile.target.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
>>  Makefile.target                                 | 2 --
>>  stubs/Makefile.objs                             | 1 +
>>  memory_mapping-stub.c => stubs/memory_mapping.c | 5 +++--
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>  rename memory_mapping-stub.c => stubs/memory_mapping.c (85%)
[...]
>> diff --git a/memory_mapping-stub.c b/stubs/memory_mapping.c
>> similarity index 85%
>> rename from memory_mapping-stub.c
>> rename to stubs/memory_mapping.c
>> index c48ea44..4db2108 100644
>> --- a/memory_mapping-stub.c
>> +++ b/stubs/memory_mapping.c
>> @@ -11,8 +11,9 @@
>>   *
>>   */
>>  
>> -#include "cpu.h"
>> -#include "exec/cpu-all.h"
>> +#include "qemu-common.h"
>> +#include "exec/cpu-common.h"
>> +#include "qom/cpu.h"
>>  #include "sysemu/memory_mapping.h"
>>  
>>  int qemu_get_guest_memory_mapping(MemoryMappingList *list)
>>
> 
> Patches 1-3 are fine.

Thanks.

>  But I wonder if a better replacement for stubs is
> methods in CPU.

None of the functions I have moved from *-stub.c to stubs/ operate on a
single CPU, so now that the conflict with the kdump format support has
been resolved I'd like to move them as a step towards dropping
per-target configure changes for guest-memory-dump support.

With my note in the cover letter I was rather referring to
cpu_paging_enabled(), which is mandatory currently without any stub.

Do you have a concrete suggestion what else to do for these stubs?

Andreas
Paolo Bonzini May 28, 2013, 9:53 a.m. UTC | #3
Il 28/05/2013 11:39, Andreas Färber ha scritto:
> Am 23.05.2013 12:08, schrieb Paolo Bonzini:
>> Il 22/05/2013 15:09, Andreas Färber ha scritto:
>>> Allows us to drop CONFIG_NO_GET_MEMORY_MAPPING with its indirect
>>> dependency on CONFIG_HAVE_GET_MEMORY_MAPPING in Makefile.target.
>>>
>>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>>> ---
>>>  Makefile.target                                 | 2 --
>>>  stubs/Makefile.objs                             | 1 +
>>>  memory_mapping-stub.c => stubs/memory_mapping.c | 5 +++--
>>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>>  rename memory_mapping-stub.c => stubs/memory_mapping.c (85%)
> [...]
>>> diff --git a/memory_mapping-stub.c b/stubs/memory_mapping.c
>>> similarity index 85%
>>> rename from memory_mapping-stub.c
>>> rename to stubs/memory_mapping.c
>>> index c48ea44..4db2108 100644
>>> --- a/memory_mapping-stub.c
>>> +++ b/stubs/memory_mapping.c
>>> @@ -11,8 +11,9 @@
>>>   *
>>>   */
>>>  
>>> -#include "cpu.h"
>>> -#include "exec/cpu-all.h"
>>> +#include "qemu-common.h"
>>> +#include "exec/cpu-common.h"
>>> +#include "qom/cpu.h"
>>>  #include "sysemu/memory_mapping.h"
>>>  
>>>  int qemu_get_guest_memory_mapping(MemoryMappingList *list)
>>>
>>
>> Patches 1-3 are fine.
> 
> Thanks.
> 
>>  But I wonder if a better replacement for stubs is
>> methods in CPU.
> 
> None of the functions I have moved from *-stub.c to stubs/ operate on a
> single CPU,

cpu_get_memory_mapping and cpu_paging_enabled can be made methods in
CPU, can't they?

And as far as this patch is concerned, this only leaves out
qemu_get_guest_memory_mapping.  If you make cpu_paging_enabled and
cpu_get_memory_mapping return a different value for "not supported"
(e.g. -ENOSYS), qemu_get_guest_memory_mapping need not be a stub at all.

Paolo

 so now that the conflict with the kdump format support has
> been resolved I'd like to move them as a step towards dropping
> per-target configure changes for guest-memory-dump support.
> 
> With my note in the cover letter I was rather referring to
> cpu_paging_enabled(), which is mandatory currently without any stub.
> 
> Do you have a concrete suggestion what else to do for these stubs?
> 
> Andreas
>
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index 5b02200..efc0b11 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -63,7 +63,6 @@  all: $(PROGS) stap
 CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y)
 CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y)
 CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y)
-CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y)
 
 #########################################################
 # cpu emulator library
@@ -112,7 +111,6 @@  obj-$(CONFIG_KVM) += kvm-all.o
 obj-y += memory.o savevm.o cputlb.o
 obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o
 obj-y += dump.o memory_mapping_common.o
-obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o
 LIBS+=$(libs_softmmu)
 
 # xen support
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 9b701b4..b0bca4d 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -10,6 +10,7 @@  stub-obj-y += fdset-remove-fd.o
 stub-obj-y += get-fd.o
 stub-obj-y += get-vm-name.o
 stub-obj-y += iothread-lock.o
+stub-obj-y += memory_mapping.o
 stub-obj-y += migr-blocker.o
 stub-obj-y += mon-is-qmp.o
 stub-obj-y += mon-printf.o
diff --git a/memory_mapping-stub.c b/stubs/memory_mapping.c
similarity index 85%
rename from memory_mapping-stub.c
rename to stubs/memory_mapping.c
index c48ea44..4db2108 100644
--- a/memory_mapping-stub.c
+++ b/stubs/memory_mapping.c
@@ -11,8 +11,9 @@ 
  *
  */
 
-#include "cpu.h"
-#include "exec/cpu-all.h"
+#include "qemu-common.h"
+#include "exec/cpu-common.h"
+#include "qom/cpu.h"
 #include "sysemu/memory_mapping.h"
 
 int qemu_get_guest_memory_mapping(MemoryMappingList *list)