qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1 for-2.11 09/10] s390x/kvm: move KVM declarati


From: Thomas Huth
Subject: Re: [Qemu-devel] [PATCH v1 for-2.11 09/10] s390x/kvm: move KVM declarations and stubs to separate files
Date: Thu, 17 Aug 2017 14:35:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 17.08.2017 13:40, Philippe Mathieu-Daudé wrote:
> Hi David,
> 
> On 08/17/2017 06:22 AM, David Hildenbrand wrote:
>> Let's do it just like the other architectures. Introduce kvm-stub.c
>> for stubs and kvm_s390x.h for the declarations.
>>
>> Add a fake declaration of struct kvm_s390_irq so we don't need other
>> ugly CONFIG_KVM checks.
> 
> You can use an opaque pointer to avoid that ("bridge" design pattern).
> 
> It involves few more changes but looks safer.

There is maybe even a simpler solution than that, see below ...

[...]
>>   feat-src = $(SRC_PATH)/target/$(TARGET_BASE_ARCH)/
>> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
>> index 74d5b35..aeb730c 100644
>> --- a/target/s390x/cpu.h
>> +++ b/target/s390x/cpu.h
>> @@ -41,6 +41,7 @@
>>   #include "exec/cpu-all.h"
>>     #include "fpu/softfloat.h"
>> +#include "kvm_s390x.h"

Do we still need that? cpu.h should theoretically be independent from
kvm now, shouldn't it? And for the .c files, it's likely better to
include kvm_s390x.h directly there if they require it.

[...]
>> diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm_s390x.h
>> new file mode 100644
>> index 0000000..35db28c
>> --- /dev/null
>> +++ b/target/s390x/kvm_s390x.h
>> @@ -0,0 +1,51 @@
>> +/*
>> + * QEMU KVM support -- s390x specific functions.
>> + *
>> + * Copyright (c) 2009 Ulrich Hecht
>> + *
>> + * This work is licensed under the terms of the GNU GPL, version 2 or
>> later.
>> + * See the COPYING file in the top-level directory.
>> + */
>> +
>> +#ifndef KVM_S390X_H
>> +#define KVM_S390X_H
>> +
>> +#include "sysemu/kvm.h"
>> +
>> +#ifndef CONFIG_KVM
>> +struct kvm_s390_irq {};
>> +#endif /* CONFIG_KVM */
> 
> change by
> 
> typedef struct kvm_s390_irq kvm_s390_irq_t;

May I suggest to simply use this instead:

struct kvm_s390_irq;

No need to switch for a typedef here, you can simply use this anonymous
struct declaration, I think.

 Thomas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]