[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 10/23] x86/pt: split out HVM functions from vtd.c
Functions are moved to hvm.c. Reorder makefile items while at it. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- v2: reduce and sort inlcudes --- xen/drivers/passthrough/vtd/x86/Makefile | 3 +- xen/drivers/passthrough/vtd/x86/hvm.c | 67 +++++++++++++++++++++++++- xen/drivers/passthrough/vtd/x86/vtd.c | 45 +----------------- 3 files changed, 69 insertions(+), 46 deletions(-) create mode 100644 xen/drivers/passthrough/vtd/x86/hvm.c diff --git a/xen/drivers/passthrough/vtd/x86/Makefile b/xen/drivers/passthrough/vtd/x86/Makefile index df4509d..4ef00a4 100644 --- a/xen/drivers/passthrough/vtd/x86/Makefile +++ b/xen/drivers/passthrough/vtd/x86/Makefile @@ -1,2 +1,3 @@ -obj-y += vtd.o obj-y += ats.o +obj-$(CONFIG_HVM) += hvm.o +obj-y += vtd.o diff --git a/xen/drivers/passthrough/vtd/x86/hvm.c b/xen/drivers/passthrough/vtd/x86/hvm.c new file mode 100644 index 0000000..6675dca --- /dev/null +++ b/xen/drivers/passthrough/vtd/x86/hvm.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2008, Intel Corporation. + * + * 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/>. + * + * Copyright (C) Allen Kay <allen.m.kay@xxxxxxxxx> + * Copyright (C) Weidong Han <weidong.han@xxxxxxxxx> + */ + +#include <xen/iommu.h> +#include <xen/irq.h> +#include <xen/sched.h> + +static int _hvm_dpci_isairq_eoi(struct domain *d, + struct hvm_pirq_dpci *pirq_dpci, void *arg) +{ + struct hvm_irq *hvm_irq = hvm_domain_irq(d); + unsigned int isairq = (long)arg; + const struct dev_intx_gsi_link *digl; + + list_for_each_entry ( digl, &pirq_dpci->digl_list, list ) + { + unsigned int link = hvm_pci_intx_link(digl->device, digl->intx); + + if ( hvm_irq->pci_link.route[link] == isairq ) + { + hvm_pci_intx_deassert(d, digl->device, digl->intx); + if ( --pirq_dpci->pending == 0 ) + { + stop_timer(&pirq_dpci->timer); + pirq_guest_eoi(dpci_pirq(pirq_dpci)); + } + } + } + + return 0; +} + +void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq) +{ + struct hvm_irq_dpci *dpci = NULL; + + ASSERT(isairq < NR_ISAIRQS); + if ( !iommu_enabled ) + return; + + spin_lock(&d->event_lock); + + dpci = domain_get_irq_dpci(d); + + if ( dpci && test_bit(isairq, dpci->isairq_map) ) + { + /* Multiple mirq may be mapped to one isa irq */ + pt_pirq_iterate(d, _hvm_dpci_isairq_eoi, (void *)(long)isairq); + } + spin_unlock(&d->event_lock); +} diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c index 00a9891..ac653ee 100644 --- a/xen/drivers/passthrough/vtd/x86/vtd.c +++ b/xen/drivers/passthrough/vtd/x86/vtd.c @@ -63,51 +63,6 @@ void flush_all_cache() wbinvd(); } -static int _hvm_dpci_isairq_eoi(struct domain *d, - struct hvm_pirq_dpci *pirq_dpci, void *arg) -{ - struct hvm_irq *hvm_irq = hvm_domain_irq(d); - unsigned int isairq = (long)arg; - const struct dev_intx_gsi_link *digl; - - list_for_each_entry ( digl, &pirq_dpci->digl_list, list ) - { - unsigned int link = hvm_pci_intx_link(digl->device, digl->intx); - - if ( hvm_irq->pci_link.route[link] == isairq ) - { - hvm_pci_intx_deassert(d, digl->device, digl->intx); - if ( --pirq_dpci->pending == 0 ) - { - stop_timer(&pirq_dpci->timer); - pirq_guest_eoi(dpci_pirq(pirq_dpci)); - } - } - } - - return 0; -} - -void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq) -{ - struct hvm_irq_dpci *dpci = NULL; - - ASSERT(isairq < NR_ISAIRQS); - if ( !iommu_enabled) - return; - - spin_lock(&d->event_lock); - - dpci = domain_get_irq_dpci(d); - - if ( dpci && test_bit(isairq, dpci->isairq_map) ) - { - /* Multiple mirq may be mapped to one isa irq */ - pt_pirq_iterate(d, _hvm_dpci_isairq_eoi, (void *)(long)isairq); - } - spin_unlock(&d->event_lock); -} - void __hwdom_init vtd_set_hwdom_mapping(struct domain *d) { unsigned long i, top, max_pfn; -- git-series 0.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |