qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] sysemu/accel: Simplify sysemu/hvf.h
@ 2023-09-05 12:39 Philippe Mathieu-Daudé
  2023-09-05 12:39 ` [PATCH 1/2] target/i386/hvf: Remove unused includes in 'hvf-i386.h' Philippe Mathieu-Daudé
  2023-09-05 12:39 ` [PATCH 2/2] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets Philippe Mathieu-Daudé
  0 siblings, 2 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-05 12:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Roman Bolshakov, Paolo Bonzini, Cameron Esfahani,
	Philippe Mathieu-Daudé

Trivial cleanups which simplify "sysemu/hvf.h".

Philippe Mathieu-Daudé (2):
  target/i386/hvf: Remove unused includes in 'hvf-i386.h'
  sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets

 include/sysemu/hvf.h       | 3 ---
 target/i386/hvf/hvf-i386.h | 6 +-----
 target/i386/cpu.c          | 1 +
 3 files changed, 2 insertions(+), 8 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] target/i386/hvf: Remove unused includes in 'hvf-i386.h'
  2023-09-05 12:39 [PATCH 0/2] sysemu/accel: Simplify sysemu/hvf.h Philippe Mathieu-Daudé
@ 2023-09-05 12:39 ` Philippe Mathieu-Daudé
  2023-09-10 20:54   ` Roman Bolshakov
  2023-09-05 12:39 ` [PATCH 2/2] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets Philippe Mathieu-Daudé
  1 sibling, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-05 12:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Roman Bolshakov, Paolo Bonzini, Cameron Esfahani,
	Philippe Mathieu-Daudé

The only non standard type -- CPUArchState -- is forward
declared in "qemu/typedefs.h", so no particular header is
required here.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/i386/hvf/hvf-i386.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/target/i386/hvf/hvf-i386.h b/target/i386/hvf/hvf-i386.h
index 95b47c1c2e..243bc111cc 100644
--- a/target/i386/hvf/hvf-i386.h
+++ b/target/i386/hvf/hvf-i386.h
@@ -16,12 +16,6 @@
 #ifndef HVF_I386_H
 #define HVF_I386_H
 
-#include "qemu/accel.h"
-#include "sysemu/hvf.h"
-#include "sysemu/hvf_int.h"
-#include "cpu.h"
-#include "x86.h"
-
 void hvf_handle_io(CPUArchState *, uint16_t, void *, int, int, int);
 
 /* Host specific functions */
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets
  2023-09-05 12:39 [PATCH 0/2] sysemu/accel: Simplify sysemu/hvf.h Philippe Mathieu-Daudé
  2023-09-05 12:39 ` [PATCH 1/2] target/i386/hvf: Remove unused includes in 'hvf-i386.h' Philippe Mathieu-Daudé
@ 2023-09-05 12:39 ` Philippe Mathieu-Daudé
  2023-09-10 20:59   ` Roman Bolshakov
  1 sibling, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-05 12:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Roman Bolshakov, Paolo Bonzini, Cameron Esfahani,
	Philippe Mathieu-Daudé

hvf_get_supported_cpuid() is only defined for x86 targets
(in target/i386/hvf/x86_cpuid.c).
Its declaration is pointless on all other targets.

All the calls to it in target/i386/cpu.c are guarded by
a call on hvf_enabled(), so are elided when HVF is not
built in. Therefore we can remove the unnecessary function
stub.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/sysemu/hvf.h       | 3 ---
 target/i386/hvf/hvf-i386.h | 2 ++
 target/i386/cpu.c          | 1 +
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h
index 4037cd6a73..4a7c6af3a5 100644
--- a/include/sysemu/hvf.h
+++ b/include/sysemu/hvf.h
@@ -20,13 +20,10 @@
 #include "cpu.h"
 
 #ifdef CONFIG_HVF
-uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx,
-                                 int reg);
 extern bool hvf_allowed;
 #define hvf_enabled() (hvf_allowed)
 #else /* !CONFIG_HVF */
 #define hvf_enabled() 0
-#define hvf_get_supported_cpuid(func, idx, reg) 0
 #endif /* !CONFIG_HVF */
 
 #endif /* NEED_CPU_H */
diff --git a/target/i386/hvf/hvf-i386.h b/target/i386/hvf/hvf-i386.h
index 243bc111cc..e99c02cd4b 100644
--- a/target/i386/hvf/hvf-i386.h
+++ b/target/i386/hvf/hvf-i386.h
@@ -16,6 +16,8 @@
 #ifndef HVF_I386_H
 #define HVF_I386_H
 
+uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx, int reg);
+
 void hvf_handle_io(CPUArchState *, uint16_t, void *, int, int, int);
 
 /* Host specific functions */
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 00f913b638..6789384bec 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -26,6 +26,7 @@
 #include "tcg/helper-tcg.h"
 #include "sysemu/reset.h"
 #include "sysemu/hvf.h"
+#include "hvf/hvf-i386.h"
 #include "kvm/kvm_i386.h"
 #include "sev.h"
 #include "qapi/error.h"
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] target/i386/hvf: Remove unused includes in 'hvf-i386.h'
  2023-09-05 12:39 ` [PATCH 1/2] target/i386/hvf: Remove unused includes in 'hvf-i386.h' Philippe Mathieu-Daudé
@ 2023-09-10 20:54   ` Roman Bolshakov
  0 siblings, 0 replies; 6+ messages in thread
From: Roman Bolshakov @ 2023-09-10 20:54 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Roman Bolshakov, Paolo Bonzini, Cameron Esfahani

On Tue, Sep 05, 2023 at 02:39:05PM +0200, Philippe Mathieu-Daudé wrote:
> The only non standard type -- CPUArchState -- is forward
> declared in "qemu/typedefs.h", so no particular header is
> required here.
> 

Hi Philippe,

Reviewed-by: Roman Bolshakov <roman@roolebo.dev>
Tested-by: Roman Bolshakov <roman@roolebo.dev>

Regards,
Roman


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets
  2023-09-05 12:39 ` [PATCH 2/2] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets Philippe Mathieu-Daudé
@ 2023-09-10 20:59   ` Roman Bolshakov
  2023-10-04  9:25     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 6+ messages in thread
From: Roman Bolshakov @ 2023-09-10 20:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Roman Bolshakov, Paolo Bonzini, Cameron Esfahani

On Tue, Sep 05, 2023 at 02:39:06PM +0200, Philippe Mathieu-Daudé wrote:
> hvf_get_supported_cpuid() is only defined for x86 targets
> (in target/i386/hvf/x86_cpuid.c).
> Its declaration is pointless on all other targets.
> 
> All the calls to it in target/i386/cpu.c are guarded by
> a call on hvf_enabled(), so are elided when HVF is not
> built in. Therefore we can remove the unnecessary function
> stub.
> 

Looks good but you also need to include "hvf/hvf-i386.h" to
target/i386/hvf/hvf-cpu.c, otherwise the build fails.

--Roman


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets
  2023-09-10 20:59   ` Roman Bolshakov
@ 2023-10-04  9:25     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-04  9:25 UTC (permalink / raw)
  To: Roman Bolshakov
  Cc: qemu-devel, Roman Bolshakov, Paolo Bonzini, Cameron Esfahani

On 10/9/23 22:59, Roman Bolshakov wrote:
> On Tue, Sep 05, 2023 at 02:39:06PM +0200, Philippe Mathieu-Daudé wrote:
>> hvf_get_supported_cpuid() is only defined for x86 targets
>> (in target/i386/hvf/x86_cpuid.c).
>> Its declaration is pointless on all other targets.
>>
>> All the calls to it in target/i386/cpu.c are guarded by
>> a call on hvf_enabled(), so are elided when HVF is not
>> built in. Therefore we can remove the unnecessary function
>> stub.
>>
> 
> Looks good but you also need to include "hvf/hvf-i386.h" to
> target/i386/hvf/hvf-cpu.c, otherwise the build fails.

Oops, thanks for testing!



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-04  9:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-05 12:39 [PATCH 0/2] sysemu/accel: Simplify sysemu/hvf.h Philippe Mathieu-Daudé
2023-09-05 12:39 ` [PATCH 1/2] target/i386/hvf: Remove unused includes in 'hvf-i386.h' Philippe Mathieu-Daudé
2023-09-10 20:54   ` Roman Bolshakov
2023-09-05 12:39 ` [PATCH 2/2] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets Philippe Mathieu-Daudé
2023-09-10 20:59   ` Roman Bolshakov
2023-10-04  9:25     ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).