xen: move common hvm code to x86
cover xen: move common hvm code to x86
Wei Liu (3):
xen: move hvm save code under common to x86
xen: merge common hvm/irq.h into x86 hvm/irq.h
x86: switch to plain bool in passthrough code
xen/arch/x86/cpu/mcheck/vmce.c | 2 +-
xen/arch/x86/cpu/vpmu_amd.c | 2 +-
xen/arch/x86/hvm/save.c | 308 +++++++++++++++++++++++++++++
xen/common/Makefile | 2 -
xen/common/hvm/Makefile | 1 -
xen/common/hvm/save.c | 330 --------------------------------
xen/drivers/passthrough/io.c | 17 +-
xen/include/asm-x86/hvm/irq.h | 111 ++++++++++-
xen/include/{xen => asm-x86}/hvm/save.h | 0
xen/include/asm-x86/hvm/support.h | 2 +-
xen/include/asm-x86/irq.h | 2 +-
xen/include/xen/hvm/irq.h | 140 --------------
12 files changed, 430 insertions(+), 487 deletions(-)
delete mode 100644 xen/common/hvm/Makefile
delete mode 100644 xen/common/hvm/save.c
rename xen/include/{xen => asm-x86}/hvm/save.h (100%)
delete mode 100644 xen/include/xen/hvm/irq.hSignature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 1/3 xen: move hvm save code under common to x86
The code is only used by x86 at this point. Merge common/hvm/save.c into x86 hvm/save.c. Move the headers and fix up inclusions. Remove the now empty common/hvm directory.
Also fix some issues while moving:
1. removing trailing spaces;
2. fix multi-line comment;
3. make "i" in hvm_save unsigned int;
4. add some blank lines to separate sections of code;
5. change bool_t to bool.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
---
xen/arch/x86/cpu/mcheck/vmce.c | 2 +-
xen/arch/x86/cpu/vpmu_amd.c | 2 +-
xen/arch/x86/hvm/save.c | 308 +++++++++++++++++++++++++++++
xen/common/Makefile | 2 -
xen/common/hvm/Makefile | 1 -
xen/common/hvm/save.c | 330 --------------------------------
xen/include/{xen => asm-x86}/hvm/save.h | 0
xen/include/asm-x86/hvm/support.h | 2 +-
8 files changed, 311 insertions(+), 336 deletions(-)
delete mode 100644 xen/common/hvm/Makefile
delete mode 100644 xen/common/hvm/save.c
rename xen/include/{xen => asm-x86}/hvm/save.h (100%)xen/arch/x86/cpu/mcheck/vmce.c +1 -1
@@ -26,7 +26,7 @@#include <xen/delay.h> #include <xen/smp.h> #include <xen/mm.h> -#include <xen/hvm/save.h> +#include <asm/hvm/save.h> #include <asm/processor.h> #include <public/sysctl.h> #include <asm/system.h>
xen/arch/x86/cpu/vpmu_amd.c +1 -1
@@ -22,11 +22,11 @@*/ #include <xen/xenoprof.h> -#include <xen/hvm/save.h> #include <xen/sched.h> #include <xen/irq.h> #include <asm/apic.h> #include <asm/vpmu.h> +#include <asm/hvm/save.h> #include <asm/hvm/vlapic.h> #include <public/pmu.h>
xen/arch/x86/hvm/save.c +308 -0
321 lines not on this page · raw message
xen/common/Makefile +0 -2
@@ -74,8 +74,6 @@ tmem-y := tmem.o tmem_xen.o tmem_control.o tmem-$(CONFIG_COMPAT) += compat/tmem_xen.o obj-$(CONFIG_TMEM) += $(tmem-y) -subdir-$(CONFIG_X86) += hvm - subdir-$(CONFIG_GCOV) += gcov subdir-y += libelf
xen/common/hvm/Makefile deleted +0 -1
@@ -1 +0,0 @@ -obj-y += save.o
xen/common/hvm/save.c deleted +0 -330
330 lines not on this page · raw message
xen/include/asm-x86/hvm/save.h renamed from xen/include/xen/hvm/save.h +0 -0
xen/include/asm-x86/hvm/support.h +1 -1
@@ -22,7 +22,7 @@#include <xen/types.h> #include <xen/sched.h> -#include <xen/hvm/save.h> +#include <asm/hvm/save.h> #include <asm/processor.h> #ifndef NDEBUG
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 1/3] xen: move hvm save code under common to x86
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 21.08.17 at 16:09, <[email protected]> wrote:
The code is only used by x86 at this point. Merge
common/hvm/save.cinto x86hvm/save.c. Move the headers and fix up inclusions. Remove the now empty common/hvm directory.
Quoted 8 lines
Also fix some issues while moving:
1. removing trailing spaces;
2. fix multi-line comment;
3. make "i" inhvm_saveunsigned int;
4. add some blank lines to separate sections of code;
5. changebool_tto bool.Signed-off-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH 2/3 xen: merge common hvm/irq.h into x86 hvm/irq.h
In reply to Wei LiuThat header file is only used by x86. Merge is into the x86 header.
---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>
--- xen/drivers/passthrough/io.c | 1 - xen/include/asm-x86/hvm/irq.h | 111 ++++++++++++++++++++++++++++++++- xen/include/asm-x86/irq.h | 2 +- xen/include/xen/hvm/irq.h | 140 ------------------------------------------ 4 files changed, 111 insertions(+), 143 deletions(-) delete mode 100644 xen/include/xen/hvm/irq.h
xen/drivers/passthrough/io.c +0 -1
@@ -23,7 +23,6 @@#include <xen/irq.h> #include <asm/hvm/irq.h> #include <asm/hvm/support.h> -#include <xen/hvm/irq.h> #include <asm/io_apic.h> static DEFINE_PER_CPU(struct list_head, dpci_list);
xen/include/asm-x86/hvm/irq.h +110 -1
121 lines not on this page · raw message
xen/include/asm-x86/irq.h +1 -1
@@ -7,7 +7,7 @@#include <asm/numa.h> #include <xen/cpumask.h> #include <xen/smp.h> -#include <xen/hvm/irq.h> +#include <asm/hvm/irq.h> #include <irq_vectors.h> #include <asm/percpu.h>
xen/include/xen/hvm/irq.h deleted +0 -140
140 lines not on this page · raw message
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 2/3] xen: merge common hvm/irq.h into x86 hvm/irq.h
Quoted 3 lines · Wei Liu
That header file is only used by x86. Merge is into the x86 header.
Signed-off-by Wei Liu <[email protected]>
[...]
xen/include/asm-x86/hvm/irq.h struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v); · line 132
Quoted 8 lines
xen/include/asm-x86/hvm/irq.h +8
-0+#define HVM_IRQ_DPCI_MACH_PCI (1 << _HVM_IRQ_DPCI_MACH_PCI_SHIFT) +#define HVM_IRQ_DPCI_MACH_MSI (1 << _HVM_IRQ_DPCI_MACH_MSI_SHIFT) +#define HVM_IRQ_DPCI_MAPPED (1 << _HVM_IRQ_DPCI_MAPPED_SHIFT) +#define HVM_IRQ_DPCI_EOI_LATCH (1 << _HVM_IRQ_DPCI_EOI_LATCH_SHIFT) +#define HVM_IRQ_DPCI_GUEST_PCI (1 << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT) +#define HVM_IRQ_DPCI_GUEST_MSI (1 << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT) +#define HVM_IRQ_DPCI_IDENTITY_GSI (1 << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT) +#define HVM_IRQ_DPCI_TRANSLATE (1 << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)
Hmm... I think I'd better change these to 1u
Quoted 21 lines
xen/include/asm-x86/hvm/irq.h +21
-0+ +#define VMSI_DEST_ID_MASK 0xff +#define VMSI_RH_MASK 0x100 +#define VMSI_DM_MASK 0x200 +#define VMSI_DELIV_MASK 0x7000 +#define VMSI_TRIG_MODE 0x8000 + +#define GFLAGS_SHIFT_RH 8 +#define GFLAGS_SHIFT_DELIV_MODE 12 +#define GFLAGS_SHIFT_TRG_MODE 15 + +struct hvm_gmsi_info { +uint32_t gvec; +uint32_t gflags; +int dest_vcpu_id;/* -1 :multi-dest, non-negative: dest_vcpu_id */ +bool posted;/* directly deliver to guest via VT-d PI? */ +}; + +struct hvm_girq_dpci_mapping { +struct list_head list; +uint8_t bus;
xen/include/asm-x86/hvm/irq.h struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v); · line 163
Quoted 10 lines
xen/include/asm-x86/hvm/irq.h +10
-0+uint8_t device; +uint8_t intx; +uint8_t machine_gsi; +}; + +#define NR_ISAIRQS 16 +#define NR_LINK 4 +#if defined(CONFIG_X86 ) +# define NR_HVM_DOMU_IRQS ARRAY_SIZE(((struct hvm_hw_vioapic *)0)->redirtbl) +#endif
And this if defined is not needed any more after moving.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Jan Beulich
Acked-byRe: [PATCH 2/3] xen: merge common hvm/irq.h into x86 hvm/irq.h
Quoted 42 lines
Quoted 1 line
Quoted 1 line · On 21.08.17 at 16:14, <[email protected]> wrote:
Quoted 3 lines · Wei Liu
That header file is only used by x86. Merge is into the x86 header.
Signed-off-by Wei Liu <[email protected]>[...]
xen/include/asm-x86/hvm/irq.h struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v); · line 132
Quoted 8 lines
xen/include/asm-x86/hvm/irq.h +8
-0+#define HVM_IRQ_DPCI_MACH_PCI (1 << _HVM_IRQ_DPCI_MACH_PCI_SHIFT) +#define HVM_IRQ_DPCI_MACH_MSI (1 << _HVM_IRQ_DPCI_MACH_MSI_SHIFT) +#define HVM_IRQ_DPCI_MAPPED (1 << _HVM_IRQ_DPCI_MAPPED_SHIFT) +#define HVM_IRQ_DPCI_EOI_LATCH (1 << _HVM_IRQ_DPCI_EOI_LATCH_SHIFT) +#define HVM_IRQ_DPCI_GUEST_PCI (1 << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT) +#define HVM_IRQ_DPCI_GUEST_MSI (1 << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT) +#define HVM_IRQ_DPCI_IDENTITY_GSI (1 << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT) +#define HVM_IRQ_DPCI_TRANSLATE (1 << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)Hmm... I think I'd better change these to 1u
Quoted 25 lines
xen/include/asm-x86/hvm/irq.h +25
-0+ +#define VMSI_DEST_ID_MASK 0xff +#define VMSI_RH_MASK 0x100 +#define VMSI_DM_MASK 0x200 +#define VMSI_DELIV_MASK 0x7000 +#define VMSI_TRIG_MODE 0x8000 + +#define GFLAGS_SHIFT_RH 8 +#define GFLAGS_SHIFT_DELIV_MODE 12 +#define GFLAGS_SHIFT_TRG_MODE 15 + +struct hvm_gmsi_info { +uint32_t gvec; +uint32_t gflags; +int dest_vcpu_id;/* -1 :multi-dest, non-negative: dest_vcpu_id */ +bool posted;/* directly deliver to guest via VT-d PI? */ +}; + +struct hvm_girq_dpci_mapping { +struct list_head list; +uint8_t bus; +uint8_t device; +uint8_t intx; +uint8_t machine_gsi; +};
Quoted 8 lines
xen/include/asm-x86/hvm/irq.h struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v); · line 163
Quoted 6 lines
xen/include/asm-x86/hvm/irq.h +6
-0+ +#define NR_ISAIRQS 16 +#define NR_LINK 4 +#if defined(CONFIG_X86 ) +# define NR_HVM_DOMU_IRQS ARRAY_SIZE(((struct hvm_hw_vioapic *)0)->redirtbl) +#endif And this if defined is not needed any more after moving.
Wit these adjustments
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH 3/3 x86: switch to plain bool in passthrough code
In reply to Wei Liu---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
--- xen/drivers/passthrough/io.c | 16 ++++++++-------- xen/include/asm-x86/hvm/irq.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-)
xen/drivers/passthrough/io.c +8 -8
@@ -81,17 +81,17 @@ static void raise_softirq_for(struct hvm_pirq_dpci *pirq_dpci)* If it is false, it is the callers responsibility to make sure * that the softirq (with the event_lock dropped) has ran. */ -bool_t pt_pirq_softirq_active (struct hvm_pirq_dpci *pirq_dpci) +bool pt_pirq_softirq_active (struct hvm_pirq_dpci *pirq_dpci) {if ( pirq_dpci->state & ((1 <<STATE_RUN ) | (1 <<STATE_SCHED )) ) -return 1 ; +return true;/* * If in the future we would call 'raise_softirq_for' right away * after 'pt_pirq_softirq_active' we MUST reset the list (otherwise it * might have stale data). */ -return 0 ; +return false; }/*
@@ -136,7 +136,7 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci) pirq_dpci->masked =0 ; } -bool_t pt_irq_need_timer (uint32_t flags) +bool pt_irq_need_timer (uint32_t flags) {return !(flags & (HVM_IRQ_DPCI_GUEST_MSI |HVM_IRQ_DPCI_TRANSLATE )); }
@@ -232,7 +232,7 @@ void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci)*/ static struct vcpu *vector_hashing_dest (const struct domain *d,uint32_t dest_id, -bool_t dest_mode, +bool dest_mode,uint8_t gvec) {
@@ -739,14 +739,14 @@ void pt_pirq_init(struct domain *d, struct hvm_pirq_dpci *dpci) dpci->gmsi.dest_vcpu_id =-1 ; } -bool_t pt_pirq_cleanup_check (struct hvm_pirq_dpci *dpci) +bool pt_pirq_cleanup_check (struct hvm_pirq_dpci *dpci) {if ( !dpci->flags && !pt_pirq_softirq_active (dpci) ) { dpci->dom =NULL ; -return 1 ; +return true; } -return 0 ; +return false; } int pt_pirq_iterate(struct domain *d,
xen/include/asm-x86/hvm/irq.h +3 -3
@@ -176,7 +176,7 @@ struct hvm_irq_dpci {struct hvm_pirq_dpci {uint32_t flags;unsigned int state; -bool_t masked; +bool masked;uint16_t pending;struct list_head digl_list;struct domain *dom;
@@ -186,13 +186,13 @@ struct hvm_pirq_dpci { };void pt_pirq_init (struct domain *,struct hvm_pirq_dpci *); -bool_t pt_pirq_cleanup_check (struct hvm_pirq_dpci *); +bool pt_pirq_cleanup_check (struct hvm_pirq_dpci *);int pt_pirq_iterate (struct domain *d,int (*cb)(struct domain *,struct hvm_pirq_dpci *,void *arg),void *arg); -bool_t pt_pirq_softirq_active (struct hvm_pirq_dpci *); +bool pt_pirq_softirq_active (struct hvm_pirq_dpci *);/* Modify state of a PCI INTx wire. */ void hvm_pci_intx_assert (struct domain *d,unsigned int device,unsigned int intx);
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 3/3] x86: switch to plain bool in passthrough code
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 21.08.17 at 16:09, <[email protected]> wrote:
Signed-off-by Wei Liu <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel