Re: [PATCH 2/5] hw/s390x/pv: Un-inline s390_pv_init()
On 16/12/22 23:04, Philippe Mathieu-Daudé wrote: There is no point in having s390_pv_init() inlined. Signed-off-by: Philippe Mathieu-Daudé --- hw/s390x/pv.c | 13 + include/hw/s390x/pv.h | 14 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/include/hw/s390x/pv.h b/include/hw/s390x/pv.h index 9360aa1091..5bca5bcaf1 100644 --- a/include/hw/s390x/pv.h +++ b/include/hw/s390x/pv.h @@ -12,7 +12,6 @@ #ifndef HW_S390_PV_H #define HW_S390_PV_H -#include "qapi/error.h" #include "sysemu/kvm.h" #ifdef CONFIG_KVM @@ -78,17 +77,6 @@ static inline int kvm_s390_dump_completion_data(void *buff) { return 0; } #endif /* CONFIG_KVM */ int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); -static inline int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp) -{ -if (!cgs) { -return 0; -} -if (kvm_enabled()) { -return s390_pv_kvm_init(cgs, errp); -} - -error_setg(errp, "Protected Virtualization requires KVM"); -return -1; -} +int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp); OK I understood why this function is inlined. It is called from: $ git grep s390_pv_init hw/s390x/pv.c:29:int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp) hw/s390x/s390-virtio-ccw.c:259:s390_pv_init(machine->cgs, _fatal); include/hw/s390x/pv.h:86:int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp); Now note in meson.build: s390x_ss.add(when: 'CONFIG_KVM', if_true: files( 'tod-kvm.c', 's390-skeys-kvm.c', 's390-stattrib-kvm.c', 'pv.c', 's390-pci-kvm.c', )) So when CONFIG_KVM=false s390-virtio-ccw.c doesn't have to link with the kvm-specific pv.o. I'll rework this patch.
[PATCH 2/5] hw/s390x/pv: Un-inline s390_pv_init()
There is no point in having s390_pv_init() inlined. Signed-off-by: Philippe Mathieu-Daudé --- hw/s390x/pv.c | 13 + include/hw/s390x/pv.h | 14 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c index 8dfe92d8df..9c511369b2 100644 --- a/hw/s390x/pv.c +++ b/hw/s390x/pv.c @@ -26,6 +26,19 @@ static bool info_valid; static struct kvm_s390_pv_info_vm info_vm; static struct kvm_s390_pv_info_dump info_dump; +int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp) +{ +if (!cgs) { +return 0; +} +if (kvm_enabled()) { +return s390_pv_kvm_init(cgs, errp); +} + +error_setg(errp, "Protected Virtualization requires KVM"); +return -1; +} + static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data) { struct kvm_pv_cmd pv_cmd = { diff --git a/include/hw/s390x/pv.h b/include/hw/s390x/pv.h index 9360aa1091..5bca5bcaf1 100644 --- a/include/hw/s390x/pv.h +++ b/include/hw/s390x/pv.h @@ -12,7 +12,6 @@ #ifndef HW_S390_PV_H #define HW_S390_PV_H -#include "qapi/error.h" #include "sysemu/kvm.h" #ifdef CONFIG_KVM @@ -78,17 +77,6 @@ static inline int kvm_s390_dump_completion_data(void *buff) { return 0; } #endif /* CONFIG_KVM */ int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); -static inline int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp) -{ -if (!cgs) { -return 0; -} -if (kvm_enabled()) { -return s390_pv_kvm_init(cgs, errp); -} - -error_setg(errp, "Protected Virtualization requires KVM"); -return -1; -} +int s390_pv_init(ConfidentialGuestSupport *cgs, Error **errp); #endif /* HW_S390_PV_H */ -- 2.38.1