Re: [Xen-ia64-devel][PATCH][VTD] add structure and helper function for interrupt sharing
On Wed, Oct 15, 2008 at 05:44:41PM +0800, Xu, Anthony wrote: add structure and helper function for interrupt sharing Sign-off-by; Anthony Xu [EMAIL PROTECTED] Anthony Hi. Some comments below. add structure and helper function for interrupt sharing Sign-off-by; Anthony Xu [EMAIL PROTECTED] ^ ^ no space around email address. not semicolon, but colon. diff -r 9b227eb09263 xen/arch/ia64/linux-xen/irq_ia64.c --- a/xen/arch/ia64/linux-xen/irq_ia64.c Tue Oct 14 19:19:48 2008 +0100 +++ b/xen/arch/ia64/linux-xen/irq_ia64.c Wed Oct 15 17:18:25 2008 +0800 @@ -334,3 +334,62 @@ writeq(ipi_data, ipi_addr); } + + +static void __hvm_pci_intx_assert( + struct domain *d, unsigned int device, unsigned int intx) +{ + struct hvm_irq *hvm_irq = d-arch.hvm_domain.irq; + unsigned int gsi; + + ASSERT((device = 31) (intx = 3)); + + if ( __test_and_set_bit(device*4 + intx, hvm_irq-pci_intx.i) ) + return; + gsi = hvm_pci_intx_gsi(device, intx); + if ( ++hvm_irq-gsi_assert_count[gsi] == 1 ) +viosapic_set_irq(d, gsi, 1); +} + + +void hvm_pci_intx_assert( + struct domain *d, unsigned int device, unsigned int intx) +{ + __hvm_pci_intx_assert(d, device, intx); +} + Why are the two version (with and without __) defined? Looking x86 version, a lock will be added in future. doesn't it? +static void __hvm_pci_intx_deassert( + struct domain *d, unsigned int device, unsigned int intx) +{ + struct hvm_irq *hvm_irq = d-arch.hvm_domain.irq; + unsigned int gsi; + + ASSERT((device = 31) (intx = 3)); + + if ( !__test_and_clear_bit(device*4 + intx, hvm_irq-pci_intx.i) ) + return; + + gsi = hvm_pci_intx_gsi(device, intx); + + if (--hvm_irq-gsi_assert_count[gsi] == 0) + viosapic_set_irq(d, gsi, 0); +} + +void hvm_pci_intx_deassert( + struct domain *d, unsigned int device, unsigned int intx) +{ + __hvm_pci_intx_deassert(d, device, intx); +} + +void hvm_isa_irq_assert( + struct domain *d, unsigned int isa_irq) +{ +} + + +void hvm_isa_irq_deassert( + struct domain *d, unsigned int isa_irq) +{ +} + + Those are for HVM domain, so please move them under the directory, xen/arch/ia64/vmx. diff -r 9b227eb09263 xen/arch/ia64/vmx/viosapic.c --- a/xen/arch/ia64/vmx/viosapic.cTue Oct 14 19:19:48 2008 +0100 +++ b/xen/arch/ia64/vmx/viosapic.cWed Oct 15 17:18:25 2008 +0800 @@ -314,10 +314,6 @@ out: spin_unlock(viosapic-lock); } - -#define hvm_pci_intx_gsi(dev, intx) \ -(dev) 2) + ((dev) 3) + (intx)) 31) + 16) - void viosapic_set_pci_irq(struct domain *d, int device, int intx, int level) { diff -r 9b227eb09263 xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Tue Oct 14 19:19:48 2008 +0100 +++ b/xen/arch/ia64/xen/domain.c Wed Oct 15 17:18:25 2008 +0800 @@ -568,6 +568,8 @@ if (is_idle_domain(d)) return 0; + + INIT_LIST_HEAD(d-arch.pdev_list); foreign_p2m_init(d); #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT diff -r 9b227eb09263 xen/include/asm-ia64/domain.h --- a/xen/include/asm-ia64/domain.h Tue Oct 14 19:19:48 2008 +0100 +++ b/xen/include/asm-ia64/domain.h Wed Oct 15 17:18:25 2008 +0800 @@ -129,6 +129,8 @@ /* Set an optimization feature in the struct arch_domain. */ extern int domain_opt_feature(struct domain *, struct xen_ia64_opt_feature*); +#define has_arch_pdevs(d) (!list_empty((d)-arch.pdev_list)) + struct arch_domain { struct mm_struct mm; @@ -166,6 +168,7 @@ unsigned char rid_bits; /* number of virtual rid bits (default: 18) */ int breakimm; /* The imm value for hypercalls. */ +struct list_head pdev_list; struct virtual_platform_def vmx_platform; #define hvm_domain vmx_platform /* platform defs are not vmx specific */ diff -r 9b227eb09263 xen/include/asm-ia64/hvm/irq.h --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/xen/include/asm-ia64/hvm/irq.h Wed Oct 15 17:18:25 2008 +0800 @@ -0,0 +1,178 @@ +/** + * 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
RE: [Xen-ia64-devel][PATCH][VTD] add structure and helper function for interrupt sharing
Isaku Yamahata wrote: On Wed, Oct 15, 2008 at 05:44:41PM +0800, Xu, Anthony wrote: add structure and helper function for interrupt sharing Sign-off-by; Anthony Xu [EMAIL PROTECTED] Anthony Hi. Some comments below. add structure and helper function for interrupt sharing Sign-off-by; Anthony Xu [EMAIL PROTECTED] ^ ^ no space around email address. not semicolon, but colon. :-) diff -r 9b227eb09263 xen/arch/ia64/linux-xen/irq_ia64.c --- a/xen/arch/ia64/linux-xen/irq_ia64.c Tue Oct 14 19:19:48 2008 +0100 +++ b/xen/arch/ia64/linux-xen/irq_ia64.c Wed Oct 15 17:18:25 2008 +0800 @@ -334,3 +334,62 @@ writeq(ipi_data, ipi_addr); } + + +static void __hvm_pci_intx_assert( + struct domain *d, unsigned int device, unsigned int intx) +{ + struct hvm_irq *hvm_irq = d-arch.hvm_domain.irq; + unsigned int gsi; + + ASSERT((device = 31) (intx = 3)); + + if ( __test_and_set_bit(device*4 + intx, hvm_irq-pci_intx.i) ) + return; + gsi = hvm_pci_intx_gsi(device, intx); + if ( ++hvm_irq-gsi_assert_count[gsi] == 1 ) +viosapic_set_irq(d, gsi, 1); +} + + +void hvm_pci_intx_assert( + struct domain *d, unsigned int device, unsigned int intx) +{ + __hvm_pci_intx_assert(d, device, intx); +} + Why are the two version (with and without __) defined? Looking x86 version, a lock will be added in future. doesn't it? In x86 side, vpic and vioapci use a big lock, so it is needed to get the lock first before call __hvm_pci_intx_assert. In ia65 side, there is a dedicated lock for viosapic, there is no need to get a lock here. I'll merge the two version +static void __hvm_pci_intx_deassert( + struct domain *d, unsigned int device, unsigned int intx) +{ + struct hvm_irq *hvm_irq = d-arch.hvm_domain.irq; + unsigned int gsi; + + ASSERT((device = 31) (intx = 3)); + + if ( !__test_and_clear_bit(device*4 + intx, hvm_irq-pci_intx.i) ) + return; + + gsi = hvm_pci_intx_gsi(device, intx); + + if (--hvm_irq-gsi_assert_count[gsi] == 0) + viosapic_set_irq(d, gsi, 0); +} + +void hvm_pci_intx_deassert( + struct domain *d, unsigned int device, unsigned int intx) +{ + __hvm_pci_intx_deassert(d, device, intx); +} + +void hvm_isa_irq_assert( + struct domain *d, unsigned int isa_irq) +{ +} + + +void hvm_isa_irq_deassert( + struct domain *d, unsigned int isa_irq) +{ +} + + Those are for HVM domain, so please move them under the directory, xen/arch/ia64/vmx. Agree diff -r 9b227eb09263 xen/arch/ia64/vmx/viosapic.c --- a/xen/arch/ia64/vmx/viosapic.cTue Oct 14 19:19:48 2008 +0100 +++ b/xen/arch/ia64/vmx/viosapic.cWed Oct 15 17:18:25 2008 +0800 @@ -314,10 +314,6 @@ out: spin_unlock(viosapic-lock); } - -#define hvm_pci_intx_gsi(dev, intx) \ -(dev) 2) + ((dev) 3) + (intx)) 31) + 16) - void viosapic_set_pci_irq(struct domain *d, int device, int intx, int level) { diff -r 9b227eb09263 xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Tue Oct 14 19:19:48 2008 +0100 +++ b/xen/arch/ia64/xen/domain.c Wed Oct 15 17:18:25 2008 +0800 @@ -568,6 +568,8 @@ if (is_idle_domain(d)) return 0; + + INIT_LIST_HEAD(d-arch.pdev_list); foreign_p2m_init(d); #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT diff -r 9b227eb09263 xen/include/asm-ia64/domain.h --- a/xen/include/asm-ia64/domain.h Tue Oct 14 19:19:48 2008 +0100 +++ b/xen/include/asm-ia64/domain.h Wed Oct 15 17:18:25 2008 +0800 @@ -129,6 +129,8 @@ /* Set an optimization feature in the struct arch_domain. */ extern int domain_opt_feature(struct domain *, struct xen_ia64_opt_feature*); +#define has_arch_pdevs(d) (!list_empty((d)-arch.pdev_list)) + struct arch_domain { struct mm_struct mm; @@ -166,6 +168,7 @@ unsigned char rid_bits; /* number of virtual rid bits (default: 18) */ int breakimm; /* The imm value for hypercalls. */ +struct list_head pdev_list; struct virtual_platform_def vmx_platform; #define hvm_domain vmx_platform /* platform defs are not vmx specific */ diff -r 9b227eb09263 xen/include/asm-ia64/hvm/irq.h --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/xen/include/asm-ia64/hvm/irq.h Wed Oct 15 17:18:25 2008 +0800 @@ -0,0 +1,178 @@ +/** + * 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 +