qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"


From: Xuebing wang
Subject: Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h
Date: Tue, 04 Mar 2014 19:54:45 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Hi Paolo, thanks for reviewing.


On 03/04/2014 06:19 PM, Paolo Bonzini wrote:
Hi,

in general I agree with this patch. I have a few comments, and I suggest that you split it in multiple patches so that it's easier to get it in when each part is ready.

I spent some time trying to reduce it. I may be wrong, but this is the smallest patch I can get to get all targets (linuxuser vs softmmu, kvm enable/disable) build.


diff --git a/hw/dma/soc_dma.c b/hw/dma/soc_dma.c
index c06aabb..950f3ec 100644
--- a/hw/dma/soc_dma.c
+++ b/hw/dma/soc_dma.c
@@ -21,6 +21,11 @@
 #include "qemu/timer.h"
 #include "hw/arm/soc_dma.h"

+#ifndef NEED_CPU_H
+#error target-xxx/cpu.h must be included because target-specific are required
+#endif

Not needed; include/exec/cpu-defs.h already has a similar #error.

I guess this is my personal preference.

My original idea is to emphasize that this *whole* file is "target-specific", as "target-independent" vs "target-specific" is important for qemu framework (everything except target-xxx, tcg backend and hw/arch*/). Ideally all qemu framework is designed to be target-independent, right?

In my docs/api-hierarchy.txt, I am trying my best to illustrate what are "target-independent", and what are "target-specific".

cpu-defs.h is NOT included in this file.

The idea is the same for the rest "#ifndef NEED_CPU_H"

Why use "#ifndef NEED_CPU_H, then #error ...", is because "target-xxx/cpu.h"
    is better included for the whole file.

    If "target-xxx/cpu.h" is only needed for part of the file, use
    "#ifdef NEED_CPU_H, then #include "cpu.h"".


Thanks.



reply via email to

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