xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 2/3] xen: merge common hvm/irq.h into x86 hvm/irq.h
Date: Mon, 21 Aug 2017 15:09:12 +0100	[thread overview]
Message-ID: <20170821140913.11465-3-wei.liu2@citrix.com> (raw)
In-Reply-To: <20170821140913.11465-1-wei.liu2@citrix.com>

That header file is only used by x86. Merge is into the x86 header.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>                                      
Cc: George Dunlap <George.Dunlap@eu.citrix.com>                                    
Cc: Ian Jackson <ian.jackson@eu.citrix.com>                                        
Cc: Jan Beulich <jbeulich@suse.com>                                                
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>                                 
Cc: Stefano Stabellini <sstabellini@kernel.org>                                    
Cc: Tim Deegan <tim@xen.org>                                                       
Cc: Wei Liu <wei.liu2@citrix.com>      
---
 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

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index ffeaf70be6..e30fd568f3 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -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);
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index 7d45293aed..84cb8f8765 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -21,7 +21,8 @@
 #ifndef __ASM_X86_HVM_IRQ_H__
 #define __ASM_X86_HVM_IRQ_H__
 
-#include <xen/hvm/irq.h>
+#include <xen/timer.h>
+
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/vpic.h>
 #include <asm/hvm/vioapic.h>
@@ -106,4 +107,112 @@ struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v);
 struct hvm_intack hvm_vcpu_ack_pending_irq(struct vcpu *v,
                                            struct hvm_intack intack);
 
+struct dev_intx_gsi_link {
+    struct list_head list;
+    uint8_t bus;
+    uint8_t device;
+    uint8_t intx;
+};
+
+#define _HVM_IRQ_DPCI_MACH_PCI_SHIFT            0
+#define _HVM_IRQ_DPCI_MACH_MSI_SHIFT            1
+#define _HVM_IRQ_DPCI_MAPPED_SHIFT              2
+#define _HVM_IRQ_DPCI_EOI_LATCH_SHIFT           3
+#define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
+#define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
+#define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
+#define _HVM_IRQ_DPCI_TRANSLATE_SHIFT          15
+#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)
+
+#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;
+};
+
+#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
+
+/* Protected by domain's event_lock */
+struct hvm_irq_dpci {
+    /* Guest IRQ to guest device/intx mapping. */
+    struct list_head girq[NR_HVM_DOMU_IRQS];
+    /* Record of mapped ISA IRQs */
+    DECLARE_BITMAP(isairq_map, NR_ISAIRQS);
+    /* Record of mapped Links */
+    uint8_t link_cnt[NR_LINK];
+};
+
+/* Machine IRQ to guest device/intx mapping. */
+struct hvm_pirq_dpci {
+    uint32_t flags;
+    unsigned int state;
+    bool_t masked;
+    uint16_t pending;
+    struct list_head digl_list;
+    struct domain *dom;
+    struct hvm_gmsi_info gmsi;
+    struct timer timer;
+    struct list_head softirq_list;
+};
+
+void pt_pirq_init(struct domain *, struct hvm_pirq_dpci *);
+bool_t 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 *);
+/* Modify state of a PCI INTx wire. */
+void hvm_pci_intx_assert(struct domain *d, unsigned int device,
+                         unsigned int intx);
+void hvm_pci_intx_deassert(struct domain *d, unsigned int device,
+                           unsigned int intx);
+
+/* Modify state of an ISA device's IRQ wire. */
+void hvm_isa_irq_assert(struct domain *d, unsigned int isa_irq);
+void hvm_isa_irq_deassert(struct domain *d, unsigned int isa_irq);
+
+/* Modify state of GSIs. */
+void hvm_gsi_assert(struct domain *d, unsigned int gsi);
+void hvm_gsi_deassert(struct domain *d, unsigned int gsi);
+
+int hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq);
+
+int hvm_inject_msi(struct domain *d, uint64_t addr, uint32_t data);
+
+void hvm_maybe_deassert_evtchn_irq(void);
+void hvm_assert_evtchn_irq(struct vcpu *v);
+void hvm_set_callback_via(struct domain *d, uint64_t via);
+
 #endif /* __ASM_X86_HVM_IRQ_H__ */
diff --git a/xen/include/asm-x86/irq.h b/xen/include/asm-x86/irq.h
index 38edc053f8..d9dad393b1 100644
--- a/xen/include/asm-x86/irq.h
+++ b/xen/include/asm-x86/irq.h
@@ -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>
 
diff --git a/xen/include/xen/hvm/irq.h b/xen/include/xen/hvm/irq.h
deleted file mode 100644
index 0d2c72c109..0000000000
--- a/xen/include/xen/hvm/irq.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/******************************************************************************
- * irq.h
- * 
- * Interrupt distribution and delivery logic.
- * 
- * Copyright (c) 2006, K A Fraser, XenSource Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __XEN_HVM_IRQ_H__
-#define __XEN_HVM_IRQ_H__
-
-#include <xen/types.h>
-#include <xen/spinlock.h>
-#include <xen/tasklet.h>
-#include <xen/timer.h>
-#include <public/hvm/save.h>
-
-struct dev_intx_gsi_link {
-    struct list_head list;
-    uint8_t bus;
-    uint8_t device;
-    uint8_t intx;
-};
-
-#define _HVM_IRQ_DPCI_MACH_PCI_SHIFT            0
-#define _HVM_IRQ_DPCI_MACH_MSI_SHIFT            1
-#define _HVM_IRQ_DPCI_MAPPED_SHIFT              2
-#define _HVM_IRQ_DPCI_EOI_LATCH_SHIFT           3
-#define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
-#define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
-#define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
-#define _HVM_IRQ_DPCI_TRANSLATE_SHIFT          15
-#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)
-
-#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;
-};
-
-#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
-
-/* Protected by domain's event_lock */
-struct hvm_irq_dpci {
-    /* Guest IRQ to guest device/intx mapping. */
-    struct list_head girq[NR_HVM_DOMU_IRQS];
-    /* Record of mapped ISA IRQs */
-    DECLARE_BITMAP(isairq_map, NR_ISAIRQS);
-    /* Record of mapped Links */
-    uint8_t link_cnt[NR_LINK];
-};
-
-/* Machine IRQ to guest device/intx mapping. */
-struct hvm_pirq_dpci {
-    uint32_t flags;
-    unsigned int state;
-    bool_t masked;
-    uint16_t pending;
-    struct list_head digl_list;
-    struct domain *dom;
-    struct hvm_gmsi_info gmsi;
-    struct timer timer;
-    struct list_head softirq_list;
-};
-
-void pt_pirq_init(struct domain *, struct hvm_pirq_dpci *);
-bool_t 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 *);
-/* Modify state of a PCI INTx wire. */
-void hvm_pci_intx_assert(
-    struct domain *d, unsigned int device, unsigned int intx);
-void hvm_pci_intx_deassert(
-    struct domain *d, unsigned int device, unsigned int intx);
-
-/* Modify state of an ISA device's IRQ wire. */
-void hvm_isa_irq_assert(
-    struct domain *d, unsigned int isa_irq);
-void hvm_isa_irq_deassert(
-    struct domain *d, unsigned int isa_irq);
-
-/* Modify state of GSIs. */
-void hvm_gsi_assert(struct domain *d, unsigned int gsi);
-void hvm_gsi_deassert(struct domain *d, unsigned int gsi);
-
-int hvm_set_pci_link_route(struct domain *d, u8 link, u8 isa_irq);
-
-int hvm_inject_msi(struct domain *d, uint64_t addr, uint32_t data);
-
-void hvm_maybe_deassert_evtchn_irq(void);
-void hvm_assert_evtchn_irq(struct vcpu *v);
-void hvm_set_callback_via(struct domain *d, uint64_t via);
-
-#endif /* __XEN_HVM_IRQ_H__ */
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-08-21 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21 14:09 [PATCH 0/3] xen: move common hvm code to x86 Wei Liu
2017-08-21 14:09 ` [PATCH 1/3] xen: move hvm save code under common " Wei Liu
2017-08-22 12:53   ` Jan Beulich
2017-08-21 14:09 ` Wei Liu [this message]
2017-08-21 14:14   ` [PATCH 2/3] xen: merge common hvm/irq.h into x86 hvm/irq.h Wei Liu
2017-08-22 12:55     ` Jan Beulich
2017-08-21 14:09 ` [PATCH 3/3] x86: switch to plain bool in passthrough code Wei Liu
2017-08-22 12:55   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170821140913.11465-3-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).