From: Kei Tokunaga <ktokunag@redhat.com> Subject: [RHEL5.1 PATCH 6/21] Change to new interrupt deliver mechanism Date: Thu, 07 Jun 2007 03:36:13 -0400 Bugzilla: 242125 Message-Id: <4667B56D.2040700@redhat.com> Changelog: [xen] Change to new interrupt deliver mechanism bz242125 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=242125 Backport of cset#12275, 12504, and 12867. Needs to accomodate the new interrupt deliver mechanism, required for viosapic emulation on Xen. Also, needs to replace shared-memory PIC state with a set-irq-level hypercall. This simplifies the IRQ logic significantly and avoids the bogus hvm_pic_assit() on domain resume path. Thanks, Kei # HG changeset patch # User kfraser@localhost.localdomain # Date 1162905232 0 # Node ID 9a6fb3e2f12d17e4b8cf58cd8755135e161562d6 # Parent 6f551093f0689c7c914ddfe2ad268bd15aa0ba37 [HVM] Replace shared-memory PIC state with a set-irq-level hypercall. This simplifies the IRQ logic significantly and avoids the bogus hvm_pic_assist() on domain resume path. There is more work to be done here. At least: 1. set-irq-level should really be set-interrupt-wire-level. Wire state needs to be distinguished from PIC (in particular, PIC IRR) state. 2. Hypercalls can be batched in qemu and pushed down in one multicall. Signed-off-by: Keir Fraser <keir@xensource.com> --- linux-2.6.18-21.el5-gerd-order-kei/include/xen/interface/hvm/hvm_op.h | 25 ++++++++++ linux-2.6.18-21.el5-gerd-order-kei/include/xen/interface/hvm/ioreq.h | 9 --- linux-2.6.18-21.el5-gerd-order-kei/include/xen/interface/hvm/params.h | 16 +----- 3 files changed, 28 insertions(+), 22 deletions(-) diff -puN /dev/null include/xen/interface/hvm/hvm_op.h --- /dev/null 2007-06-06 22:04:04.286000000 -0400 +++ linux-2.6.18-21.el5-gerd-order-kei/include/xen/interface/hvm/hvm_op.h 2007-06-07 02:44:28.000000000 -0400 @@ -0,0 +1,25 @@ +#ifndef __XEN_PUBLIC_HVM_HVM_OP_H__ +#define __XEN_PUBLIC_HVM_HVM_OP_H__ + +/* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */ +#define HVMOP_set_param 0 +#define HVMOP_get_param 1 +struct xen_hvm_param { + domid_t domid; /* IN */ + uint32_t index; /* IN */ + uint64_t value; /* IN/OUT */ +}; +typedef struct xen_hvm_param xen_hvm_param_t; +DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t); + +/* Set the logical level of one of a domain's IRQ lines. */ +#define HVMOP_set_irq_level 2 +struct xen_hvm_set_irq_level { + domid_t domid; /* Domain to be updated. */ + uint16_t level; /* New level of the IRQ (0 or 1). */ + uint32_t irq; /* IRQ to be updated. */ +}; +typedef struct xen_hvm_set_irq_level xen_hvm_set_irq_level_t; +DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_irq_level_t); + +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ diff -puN include/xen/interface/hvm/ioreq.h~12275-HVM_Replace_shared-memory_PIC_state_with_a_set-irq-level_hypercall. include/xen/interface/hvm/ioreq.h --- linux-2.6.18-21.el5-gerd-order/include/xen/interface/hvm/ioreq.h~12275-HVM_Replace_shared-memory_PIC_state_with_a_set-irq-level_hypercall. 2007-06-07 02:44:28.000000000 -0400 +++ linux-2.6.18-21.el5-gerd-order-kei/include/xen/interface/hvm/ioreq.h 2007-06-07 02:44:28.000000000 -0400 @@ -57,14 +57,6 @@ struct ioreq { }; typedef struct ioreq ioreq_t; -struct global_iodata { - uint16_t pic_elcr; - uint16_t pic_irr; - uint16_t pic_last_irr; - uint16_t pic_clear_irr; -}; -typedef struct global_iodata global_iodata_t; - struct vcpu_iodata { struct ioreq vp_ioreq; /* Event channel port */ @@ -73,7 +65,6 @@ struct vcpu_iodata { typedef struct vcpu_iodata vcpu_iodata_t; struct shared_iopage { - struct global_iodata sp_global; struct vcpu_iodata vcpu_iodata[1]; }; typedef struct shared_iopage shared_iopage_t; diff -puN include/xen/interface/hvm/params.h~12275-HVM_Replace_shared-memory_PIC_state_with_a_set-irq-level_hypercall. include/xen/interface/hvm/params.h --- linux-2.6.18-21.el5-gerd-order/include/xen/interface/hvm/params.h~12275-HVM_Replace_shared-memory_PIC_state_with_a_set-irq-level_hypercall. 2007-06-07 02:44:28.000000000 -0400 +++ linux-2.6.18-21.el5-gerd-order-kei/include/xen/interface/hvm/params.h 2007-06-07 02:44:28.000000000 -0400 @@ -1,7 +1,9 @@ #ifndef __XEN_PUBLIC_HVM_PARAMS_H__ #define __XEN_PUBLIC_HVM_PARAMS_H__ -/* Parameter space. */ +#include "hvm_op.h" + +/* Parameter space for HVMOP_{set,get}_param. */ #define HVM_PARAM_CALLBACK_IRQ 0 #define HVM_PARAM_STORE_PFN 1 #define HVM_PARAM_STORE_EVTCHN 2 @@ -9,16 +11,4 @@ #define HVM_PARAM_PAE_ENABLED 4 #define HVM_NR_PARAMS 5 -/* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */ -#define HVMOP_set_param 0 -#define HVMOP_get_param 1 - -struct xen_hvm_param { - domid_t domid; /* IN */ - uint32_t index; /* IN */ - uint64_t value; /* IN/OUT */ -}; -typedef struct xen_hvm_param xen_hvm_param_t; -DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t); - #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ _ # HG changeset patch # User kfraser@localhost.localdomain # Date 1164136945 0 # Node ID f555a90bcc373a7379bc18f875eac5e7c7122ae9 # Parent b80f00215bbaf2050765e557f1a017a71e1e8529 [HVM] Reworked interrupt distribution logic. TODO: 1. Fix IO-APIC ID to not conflict with LAPIC IDS. 2. Fix i8259 device model (seems to work already though!). 3. Add INTSRC overrides in MPBIOS and ACPI tables so that PCI legacy IRQ routing always ends up at an IO-APIC input with level trigger. Restricting link routing to {5,6,10,11} and setting overrides for all four of those would work. Signed-off-by: Keir Fraser <keir@xensource.com> --- linux-2.6.18-21.el5-gerd-order-kei/include/xen/interface/hvm/hvm_op.h | 50 +++++++--- 1 file changed, 39 insertions(+), 11 deletions(-) diff -puN include/xen/interface/hvm/hvm_op.h~12504-HVM_Reworked_interrupt_distribution_logic. include/xen/interface/hvm/hvm_op.h --- linux-2.6.18-21.el5-gerd-order/include/xen/interface/hvm/hvm_op.h~12504-HVM_Reworked_interrupt_distribution_logic. 2007-06-07 02:44:28.000000000 -0400 +++ linux-2.6.18-21.el5-gerd-order-kei/include/xen/interface/hvm/hvm_op.h 2007-06-07 02:44:28.000000000 -0400 @@ -2,24 +2,52 @@ #define __XEN_PUBLIC_HVM_HVM_OP_H__ /* Get/set subcommands: extra argument == pointer to xen_hvm_param struct. */ -#define HVMOP_set_param 0 -#define HVMOP_get_param 1 +#define HVMOP_set_param 0 +#define HVMOP_get_param 1 struct xen_hvm_param { - domid_t domid; /* IN */ + domid_t domid; /* IN */ uint32_t index; /* IN */ uint64_t value; /* IN/OUT */ }; typedef struct xen_hvm_param xen_hvm_param_t; DEFINE_XEN_GUEST_HANDLE(xen_hvm_param_t); -/* Set the logical level of one of a domain's IRQ lines. */ -#define HVMOP_set_irq_level 2 -struct xen_hvm_set_irq_level { - domid_t domid; /* Domain to be updated. */ - uint16_t level; /* New level of the IRQ (0 or 1). */ - uint32_t irq; /* IRQ to be updated. */ +/* Set the logical level of one of a domain's PCI INTx wires. */ +#define HVMOP_set_pci_intx_level 2 +struct xen_hvm_set_pci_intx_level { + /* Domain to be updated. */ + domid_t domid; + /* PCI INTx identification in PCI topology (domain:bus:device:intx). */ + uint8_t domain, bus, device, intx; + /* Assertion level (0 = unasserted, 1 = asserted). */ + uint8_t level; }; -typedef struct xen_hvm_set_irq_level xen_hvm_set_irq_level_t; -DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_irq_level_t); +typedef struct xen_hvm_set_pci_intx_level xen_hvm_set_pci_intx_level_t; +DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_intx_level_t); + +/* Set the logical level of one of a domain's ISA IRQ wires. */ +#define HVMOP_set_isa_irq_level 3 +struct xen_hvm_set_isa_irq_level { + /* Domain to be updated. */ + domid_t domid; + /* ISA device identification, by ISA IRQ (0-15). */ + uint8_t isa_irq; + /* Assertion level (0 = unasserted, 1 = asserted). */ + uint8_t level; +}; +typedef struct xen_hvm_set_isa_irq_level xen_hvm_set_isa_irq_level_t; +DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_isa_irq_level_t); + +#define HVMOP_set_pci_link_route 4 +struct xen_hvm_set_pci_link_route { + /* Domain to be updated. */ + domid_t domid; + /* PCI link identifier (0-3). */ + uint8_t link; + /* ISA IRQ (1-15), or 0 (disable link). */ + uint8_t isa_irq; +}; +typedef struct xen_hvm_set_pci_link_route xen_hvm_set_pci_link_route_t; +DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_link_route_t); #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ _ rh bug 242125 # HG changeset patch # User awilliam@xenbuild.aw # Date 1164998457 25200 # Node ID 0705db48d23cca452e33f7ab2bc01b0da27e759d # Parent 76d379e3f1d786858e4b8d34175f95e55ab1d8fa [IA64] Change to new interrupt deliver mechanism. Signed-off-by: Anthony Xu <anthony.xu@intel.com> --- linux-2.6.18-21.el5-gerd-order-kei/arch/ia64/xen/xcom_privcmd.c | 11 ++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff -puN arch/ia64/xen/xcom_privcmd.c~12867-IA64_Change_to_new_interrupt_deliver_mechanism. arch/ia64/xen/xcom_privcmd.c --- linux-2.6.18-21.el5-gerd-order/arch/ia64/xen/xcom_privcmd.c~12867-IA64_Change_to_new_interrupt_deliver_mechanism. 2007-06-07 02:44:28.000000000 -0400 +++ linux-2.6.18-21.el5-gerd-order-kei/arch/ia64/xen/xcom_privcmd.c 2007-06-07 02:44:28.000000000 -0400 @@ -550,9 +550,16 @@ xencomm_privcmd_hvm_op(privcmd_hypercall case HVMOP_set_param: argsize = sizeof(xen_hvm_param_t); break; - case HVMOP_set_irq_level: - argsize = sizeof(xen_hvm_set_irq_level_t); + case HVMOP_set_pci_intx_level: + argsize = sizeof(xen_hvm_set_pci_intx_level_t); break; + case HVMOP_set_isa_irq_level: + argsize = sizeof(xen_hvm_set_isa_irq_level_t); + break; + case HVMOP_set_pci_link_route: + argsize = sizeof(xen_hvm_set_pci_link_route_t); + break; + default: printk("%s: unknown HVMOP %d\n", __func__, cmd); return -EINVAL; _