From tippy@moebelheinrich.de Thu May 01 05:47:54 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 05:47:54 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrYCY-00030L-F1 for www-data@colo.xensource.com; Thu, 01 May 2008 05:47:54 -0700 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrYD5-0001Xc-5E; Thu, 01 May 2008 12:48:27 +0000 Received: from 189-19-240-166.dsl.telesp.net.br ([189.19.240.166]) by lists.xensource.com with smtp (Exim 4.50) id 1JrYCk-0002E4-PN; Thu, 01 May 2008 12:48:24 +0000 Date: Thu, 01 May 2008 11:45:31 -0200 From: "Royal Casino" Message-ID: <20628222.22944691@campfire.com> To: xen-changelog@lists.xensource.com MIME-Version: 1.0 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 189.19.240.166 X-SA-Exim-Mail-From: tippy@moebelheinrich.de X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=5.0 tests=BAYES_99,HTML_MESSAGE, MIME_HTML_ONLY autolearn=no version=3.1.0 Subject: 300% Bonus auf Ihre erste Einzahlung auf bis zu 300 Euro Bonus! X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Werden Sie jetzt Mitglied

Werden Sie jetzt Mitglied im Royal Club Casino und erhalten Sie einen heissen Willkommensbonus von bis zu €300!

 

Royal Club ist eines der exklusivsten Onlinecasinos mit mehr als 100 realistischen und aufregenden Spielen, die mit fantastischen Gewinnchancen winken!

 

Lassen Sie Ihre Träume wahr werden und gewinnen Sie einen der progressiven Jackpots!

 

http://www.vipgamingzone.net/lang-de/

From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra35-0004NR-Lg for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra3c-0003G6-6M; Thu, 01 May 2008 14:46:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCW-0000M0-SL for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCN-0000PM-Vw for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:42 +0000 X-SBRS: 3.6 X-MesageID: 107375 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107375" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xpau010616 for ; Thu, 1 May 2008 02:59:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A08ri015240 for ; Thu, 1 May 2008 03:00:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A08on015239 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:08 -0700 Message-Id: <200805011000.m41A08on015239@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 time: Read platform time before locally-extrapolated time during X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209631544 -3600 # Node ID 013a47065e8c4e815e3b1aba0883341c19238e82 # Parent 483d006cc60765357dcdb66ab0fc43c955ecd8fe x86 time: Read platform time before locally-extrapolated time during calibration and frequency changes. This places the variable delay (acquiring the platform_timer_lock) safely as the very first thing we do, avoiding a variable delay /between/ computing the two timestamps. Problem diagnosed by Dave Winchell Signed-off-by: Keir Fraser --- xen/arch/x86/time.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff -r 483d006cc607 -r 013a47065e8c xen/arch/x86/time.c --- a/xen/arch/x86/time.c Fri Apr 25 13:46:27 2008 +0100 +++ b/xen/arch/x86/time.c Thu May 01 09:45:44 2008 +0100 @@ -759,12 +759,13 @@ int cpu_frequency_change(u64 freq) } local_irq_disable(); - rdtscll(curr_tsc); - t->local_tsc_stamp = curr_tsc; + /* Platform time /first/, as we may be delayed by platform_timer_lock. */ t->stime_master_stamp = read_platform_stime(); /* TSC-extrapolated time may be bogus after frequency change. */ /*t->stime_local_stamp = get_s_time();*/ t->stime_local_stamp = t->stime_master_stamp; + rdtscll(curr_tsc); + t->local_tsc_stamp = curr_tsc; set_time_scale(&t->tsc_scale, freq); local_irq_enable(); @@ -834,11 +835,14 @@ static void local_time_calibration(void prev_local_stime = t->stime_local_stamp; prev_master_stime = t->stime_master_stamp; - /* Disable IRQs to get 'instantaneous' current timestamps. */ + /* + * Disable IRQs to get 'instantaneous' current timestamps. We read platform + * time first, as we may be delayed when acquiring platform_timer_lock. + */ local_irq_disable(); + curr_master_stime = read_platform_stime(); + curr_local_stime = get_s_time(); rdtscll(curr_tsc); - curr_local_stime = get_s_time(); - curr_master_stime = read_platform_stime(); local_irq_enable(); #if 0 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:26 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:26 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3G-0004NU-0K for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra3l-0003JN-RT; Thu, 01 May 2008 14:46:58 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCY-0000M4-Ms for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCQ-0000PT-6W for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:44 +0000 X-SBRS: 3.6 X-MesageID: 107378 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107378" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xqmH010622 for ; Thu, 1 May 2008 02:59:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0AqM015274 for ; Thu, 1 May 2008 03:00:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0A7G015273 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:10 -0700 Message-Id: <200805011000.m41A0A7G015273@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix xend config typos X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209631858 -3600 # Node ID eb111919e8e0fb97ce14cc64e1dac038934b7878 # Parent 1e169f4e8e727e8f32a476d4b4eb8bd5504a362f Fix xend config typos Signed-off-by: Zhigang Wang --- tools/examples/xend-config-xenapi.sxp | 6 +++--- tools/examples/xend-config.sxp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff -r 1e169f4e8e72 -r eb111919e8e0 tools/examples/xend-config-xenapi.sxp --- a/tools/examples/xend-config-xenapi.sxp Thu May 01 09:50:16 2008 +0100 +++ b/tools/examples/xend-config-xenapi.sxp Thu May 01 09:50:58 2008 +0100 @@ -66,9 +66,9 @@ # Address and port xend should use for the legacy TCP XMLRPC interface, -# if xen-tcp-xmlrpc-server is set. -#(xen-tcp-xmlrpc-server-address 'localhost') -#(xen-tcp-xmlrpc-server-port 8006) +# if xend-tcp-xmlrpc-server is set. +#(xend-tcp-xmlrpc-server-address 'localhost') +#(xend-tcp-xmlrpc-server-port 8006) # SSL key and certificate to use for the legacy TCP XMLRPC interface. # Setting these will mean that this port serves only SSL connections as diff -r 1e169f4e8e72 -r eb111919e8e0 tools/examples/xend-config.sxp --- a/tools/examples/xend-config.sxp Thu May 01 09:50:16 2008 +0100 +++ b/tools/examples/xend-config.sxp Thu May 01 09:50:58 2008 +0100 @@ -64,9 +64,9 @@ # Address and port xend should use for the legacy TCP XMLRPC interface, -# if xen-tcp-xmlrpc-server is set. -#(xen-tcp-xmlrpc-server-address 'localhost') -#(xen-tcp-xmlrpc-server-port 8006) +# if xend-tcp-xmlrpc-server is set. +#(xend-tcp-xmlrpc-server-address 'localhost') +#(xend-tcp-xmlrpc-server-port 8006) # SSL key and certificate to use for the legacy TCP XMLRPC interface. # Setting these will mean that this port serves only SSL connections as _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:35 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:35 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3P-0004NX-FK for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:35 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra3w-0003MZ-0Y; Thu, 01 May 2008 14:47:08 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCd-0000ME-6j for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCQ-0000OS-NI for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:48 +0000 X-SBRS: 3.6 X-MesageID: 107379 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107379" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xriI010625 for ; Thu, 1 May 2008 02:59:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0BaX015291 for ; Thu, 1 May 2008 03:00:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0BVK015290 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:11 -0700 Message-Id: <200805011000.m41A0BVK015290@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] VT-d: Separate VT-d page table from P2M table X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209632006 -3600 # Node ID 2ab9f85f221fd99507cbca320a6958f377c4fc8d # Parent eb111919e8e0fb97ce14cc64e1dac038934b7878 VT-d: Separate VT-d page table from P2M table Signed-off-by: Weidong Han Signed-off-by: Anthony Xu --- tools/python/xen/xend/XendDomainInfo.py | 7 ++++++- xen/arch/x86/mm/p2m.c | 21 ++++----------------- xen/drivers/passthrough/vtd/iommu.c | 19 ++++++++++++++++--- 3 files changed, 26 insertions(+), 21 deletions(-) diff -r eb111919e8e0 -r 2ab9f85f221f tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu May 01 09:50:58 2008 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu May 01 09:53:26 2008 +0100 @@ -2135,8 +2135,13 @@ class XendDomainInfo: # set memory limit xc.domain_setmaxmem(self.domid, maxmem) + # Reserve 1 page per MiB of RAM for separate VT-d page table. + vtd_mem = 4 * (self.info['memory_static_max'] / 1024 / 1024) + # Round vtd_mem up to a multiple of a MiB. + vtd_mem = ((vtd_mem + 1023) / 1024) * 1024 + # Make sure there's enough RAM available for the domain - balloon.free(memory + shadow) + balloon.free(memory + shadow + vtd_mem) # Set up the shadow memory shadow_cur = xc.shadow_mem_control(self.domid, shadow / 1024) diff -r eb111919e8e0 -r 2ab9f85f221f xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Thu May 01 09:50:58 2008 +0100 +++ b/xen/arch/x86/mm/p2m.c Thu May 01 09:53:26 2008 +0100 @@ -259,18 +259,10 @@ p2m_set_entry(struct domain *d, unsigned if ( iommu_enabled && is_hvm_domain(d) ) { - if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) - { - if ( (p2mt == p2m_mmio_direct) ) - iommu_flush(d, gfn, (u64*)p2m_entry); - } - else if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD ) - { - if ( p2mt == p2m_ram_rw ) - iommu_map_page(d, gfn, mfn_x(mfn)); - else - iommu_unmap_page(d, gfn); - } + if ( p2mt == p2m_ram_rw ) + iommu_map_page(d, gfn, mfn_x(mfn)); + else + iommu_unmap_page(d, gfn); } /* Success */ @@ -528,11 +520,6 @@ int p2m_alloc_table(struct domain *d, && !set_p2m_entry(d, gfn, mfn, p2m_ram_rw) ) goto error; } - -#if CONFIG_PAGING_LEVELS >= 3 - if (vtd_enabled && is_hvm_domain(d)) - iommu_set_pgd(d); -#endif P2M_PRINTK("p2m table initialised (%u pages)\n", page_count); p2m_unlock(p2m); diff -r eb111919e8e0 -r 2ab9f85f221f xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Thu May 01 09:50:58 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Thu May 01 09:53:26 2008 +0100 @@ -671,11 +671,24 @@ void dma_pte_free_pagetable(struct domai } /* free pgd */ - if ( start == 0 && end == ((((u64)1) << addr_width) - 1) ) + if ( start == 0 && end >= ((((u64)1) << addr_width) - 1) ) { free_pgtable_maddr(hd->pgd_maddr); hd->pgd_maddr = 0; } +} + + /* free all VT-d page tables when shut down or destroy domain. */ +static void iommu_free_pagetable(struct domain *domain) +{ + struct hvm_iommu *hd = domain_hvm_iommu(domain); + int addr_width = agaw_to_width(hd->agaw); + u64 start, end; + + start = 0; + end = (((u64)1) << addr_width) - 1; + + dma_pte_free_pagetable(domain, start, end); } static int iommu_set_root_entry(struct iommu *iommu) @@ -1472,9 +1485,9 @@ void iommu_domain_teardown(struct domain if ( list_empty(&acpi_drhd_units) ) return; + iommu_free_pagetable(d); + return_devices_to_dom0(d); iommu_domid_release(d); - iommu_free_pgd(d); - return_devices_to_dom0(d); } static int domain_context_mapped(struct pci_dev *pdev) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:38 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:38 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3S-0004Nb-BH for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:38 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra3y-0003PW-Sl; Thu, 01 May 2008 14:47:10 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCg-0000MK-S1 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCO-0000Pi-02 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:52 +0000 X-SBRS: 3.6 X-MesageID: 107377 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107377" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xpOh010619 for ; Thu, 1 May 2008 02:59:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A09Yc015257 for ; Thu, 1 May 2008 03:00:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A09G6015256 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:09 -0700 Message-Id: <200805011000.m41A09G6015256@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add SSL/TLS support to relocation X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209631816 -3600 # Node ID 1e169f4e8e727e8f32a476d4b4eb8bd5504a362f # Parent 013a47065e8c4e815e3b1aba0883341c19238e82 Add SSL/TLS support to relocation * SSL/TLS support is disabled by default, as other server did. * If "xend-relocation-server-ssl-key-file" and "xend-relocation-server-ssl-cert-file" exist, SSL/TLS is enabled automatically. * "xend-relocation-tls" is used by relocation client only. Signed-off-by: Zhigang Wang --- tools/examples/xend-config.sxp | 9 ++++++ tools/python/xen/web/tcp.py | 41 +++++++++++++++++++++++++++++++ tools/python/xen/xend/XendDomain.py | 12 +++++++-- tools/python/xen/xend/XendOptions.py | 11 ++++++++ tools/python/xen/xend/server/relocate.py | 13 ++++++++- 5 files changed, 82 insertions(+), 4 deletions(-) diff -r 013a47065e8c -r 1e169f4e8e72 tools/examples/xend-config.sxp --- a/tools/examples/xend-config.sxp Thu May 01 09:45:44 2008 +0100 +++ b/tools/examples/xend-config.sxp Thu May 01 09:50:16 2008 +0100 @@ -82,6 +82,15 @@ # is set. #(xend-relocation-port 8002) +# Whether to use tls when relocating. +#(xend-relocation-tls no) + +# SSL key and certificate to use for the relocation interface. +# Setting these will mean that this port serves only SSL connections as +# opposed to plaintext ones. +#(xend-relocation-server-ssl-key-file /etc/xen/xmlrpc.key) +#(xend-relocation-server-ssl-cert-file /etc/xen/xmlrpc.crt) + # Address xend should listen on for HTTP connections, if xend-http-server is # set. # Specifying 'localhost' prevents remote connections. diff -r 013a47065e8c -r 1e169f4e8e72 tools/python/xen/web/tcp.py --- a/tools/python/xen/web/tcp.py Thu May 01 09:45:44 2008 +0100 +++ b/tools/python/xen/web/tcp.py Thu May 01 09:50:16 2008 +0100 @@ -21,6 +21,8 @@ import re import re import socket import time + +from OpenSSL import SSL import connection @@ -64,3 +66,42 @@ class TCPListener(connection.SocketListe sock.close() except: pass + +class SSLTCPListener(TCPListener): + + def __init__(self, protocol_class, port, interface, hosts_allow, + ssl_key_file = None, ssl_cert_file = None): + if not ssl_key_file or not ssl_cert_file: + raise ValueError("SSLXMLRPCServer requires ssl_key_file " + "and ssl_cert_file to be set.") + + self.ssl_key_file = ssl_key_file + self.ssl_cert_file = ssl_cert_file + + TCPListener.__init__(self, protocol_class, port, interface, hosts_allow) + + + def createSocket(self): + # make a SSL socket + ctx = SSL.Context(SSL.SSLv23_METHOD) + ctx.set_options(SSL.OP_NO_SSLv2) + ctx.use_privatekey_file (self.ssl_key_file) + ctx.use_certificate_file(self.ssl_cert_file) + sock = SSL.Connection(ctx, + socket.socket(socket.AF_INET, socket.SOCK_STREAM)) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + + # SO_REUSEADDR does not always ensure that we do not get an address + # in use error when restarted quickly + # we implement a timeout to try and avoid failing unnecessarily + timeout = time.time() + 30 + while True: + try: + sock.bind((self.interface, self.port)) + return sock + except socket.error, (_errno, strerrno): + if _errno == errno.EADDRINUSE and time.time() < timeout: + time.sleep(0.5) + else: + raise + diff -r 013a47065e8c -r 1e169f4e8e72 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Thu May 01 09:45:44 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Thu May 01 09:50:16 2008 +0100 @@ -1293,8 +1293,16 @@ class XendDomain: if port == 0: port = xoptions.get_xend_relocation_port() - try: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + try: + tls = xoptions.get_xend_relocation_tls() + if tls: + from OpenSSL import SSL + ctx = SSL.Context(SSL.SSLv23_METHOD) + sock = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) + sock.set_connect_state() + else: + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((dst, port)) except socket.error, err: raise XendError("can't connect: %s" % err[1]) diff -r 013a47065e8c -r 1e169f4e8e72 tools/python/xen/xend/XendOptions.py --- a/tools/python/xen/xend/XendOptions.py Thu May 01 09:45:44 2008 +0100 +++ b/tools/python/xen/xend/XendOptions.py Thu May 01 09:50:16 2008 +0100 @@ -192,6 +192,12 @@ class XendOptions: return self.get_config_bool("xend-relocation-server", self.xend_relocation_server_default) + def get_xend_relocation_server_ssl_key_file(self): + return self.get_config_string("xend-relocation-server-ssl-key-file") + + def get_xend_relocation_server_ssl_cert_file(self): + return self.get_config_string("xend-relocation-server-ssl-cert-file") + def get_xend_port(self): """Get the port xend listens at for its HTTP interface. """ @@ -202,6 +208,11 @@ class XendOptions: """ return self.get_config_int('xend-relocation-port', self.xend_relocation_port_default) + + def get_xend_relocation_tls(self): + """Whether to use tls when relocating. + """ + return self.get_config_bool('xend-relocation-tls', 'no') def get_xend_relocation_hosts_allow(self): return self.get_config_string("xend-relocation-hosts-allow", diff -r 013a47065e8c -r 1e169f4e8e72 tools/python/xen/xend/server/relocate.py --- a/tools/python/xen/xend/server/relocate.py Thu May 01 09:45:44 2008 +0100 +++ b/tools/python/xen/xend/server/relocate.py Thu May 01 09:50:16 2008 +0100 @@ -132,5 +132,14 @@ def listenRelocation(): else: hosts_allow = map(re.compile, hosts_allow.split(" ")) - tcp.TCPListener(RelocationProtocol, port, interface = interface, - hosts_allow = hosts_allow) + ssl_key_file = xoptions.get_xend_relocation_server_ssl_key_file() + ssl_cert_file = xoptions.get_xend_relocation_server_ssl_cert_file() + + if ssl_key_file and ssl_cert_file: + tcp.SSLTCPListener(RelocationProtocol, port, interface = interface, + hosts_allow = hosts_allow, + ssl_key_file = ssl_key_file, + ssl_cert_file = ssl_cert_file) + else: + tcp.TCPListener(RelocationProtocol, port, interface = interface, + hosts_allow = hosts_allow) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:42 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:42 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3W-0004Ne-0g for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:42 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra42-0003Tb-Qz; Thu, 01 May 2008 14:47:14 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCl-0000MP-Ec for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:59 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCS-0000P1-Il for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:55 +0000 X-SBRS: 3.6 X-MesageID: 107380 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107380" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xswF010628 for ; Thu, 1 May 2008 02:59:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0CHt015308 for ; Thu, 1 May 2008 03:00:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0Cdf015307 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:12 -0700 Message-Id: <200805011000.m41A0Cdf015307@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,INFO_TLD autolearn=no version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [Xend/ACM] Embed the policy schema in the python file X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209632106 -3600 # Node ID 931932f5fc6d4b97ff262e8ab2aa5f77f5a938a6 # Parent 2ab9f85f221fd99507cbca320a6958f377c4fc8d [Xend/ACM] Embed the policy schema in the python file This patch embeds the ACM policy's schema in the python file where the schema is being accessed for verifying the policy XML. This way also programs that cannot access a protected directory where the schema may be located in can use this class. Signed-off-by: Stefan Berger --- tools/python/xen/util/acmpolicy.py | 165 +++++++++++++++++++++++++++++++++---- 1 files changed, 150 insertions(+), 15 deletions(-) diff -r 2ab9f85f221f -r 931932f5fc6d tools/python/xen/util/acmpolicy.py --- a/tools/python/xen/util/acmpolicy.py Thu May 01 09:53:26 2008 +0100 +++ b/tools/python/xen/util/acmpolicy.py Thu May 01 09:55:06 2008 +0100 @@ -48,8 +48,6 @@ ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY = 2 ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY = 2 ACM_POLICY_UNDEFINED = 15 - -ACM_SCHEMA_FILE = ACM_POLICIES_DIR + "security_policy.xsd" ACM_LABEL_UNLABELED = "__UNLABELED__" ACM_LABEL_UNLABELED_DISPLAY = "unlabeled" @@ -118,6 +116,153 @@ DEFAULT_policy = \ " \n" +\ "\n" +ACM_SCHEMA=""" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""" + def get_DEFAULT_policy(dom0label=""): fromnode = "" @@ -133,18 +278,7 @@ def initialize(): instdir = security.install_policy_dir_prefix DEF_policy_file = "DEFAULT-security_policy.xml" - xsd_file = "security_policy.xsd" - - files = [ xsd_file ] - - for file in files: - if not os.path.isfile(policiesdir + "/" + file ): - try: - shutil.copyfile(instdir + "/" + file, - policiesdir + "/" + file) - except Exception, e: - log.info("could not copy '%s': %s" % - (file, str(e))) + #Install default policy. f = open(policiesdir + "/" + DEF_policy_file, 'w') if f: @@ -219,7 +353,8 @@ class ACMPolicy(XSPolicy): log.warn("Libxml2 python-wrapper is not installed on the system.") return xsconstants.XSERR_SUCCESS try: - parserctxt = libxml2.schemaNewParserCtxt(ACM_SCHEMA_FILE) + parserctxt = libxml2.schemaNewMemParserCtxt(ACM_SCHEMA, + len(ACM_SCHEMA)) schemaparser = parserctxt.schemaParse() valid = schemaparser.schemaNewValidCtxt() doc = libxml2.parseDoc(self.toxml()) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:46 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:46 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3Z-0004Nh-TA for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:46 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra46-0003Wx-Hs; Thu, 01 May 2008 14:47:18 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCs-0000MW-Hn for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCb-0000OS-Cr for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:01 +0000 X-SBRS: 3.6 X-MesageID: 107383 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107383" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xvVL010637 for ; Thu, 1 May 2008 02:59:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0FcR015359 for ; Thu, 1 May 2008 03:00:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0F2d015358 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:15 -0700 Message-Id: <200805011000.m41A0F2d015358@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] MSI 1/6: Move PCI functions and headers to a common location. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634018 -3600 # Node ID 8bced3d8a90756540df18c356b9f1d66acac2b87 # Parent 5e5bc5b2bb6d4d71c0de97c15448f2f991f4271d MSI 1/6: Move PCI functions and headers to a common location. Signed-off-by: Shan Haitao Signed-off-by: Jiang Yunhong --- xen/drivers/passthrough/pci_regs.h | 530 ---------------------------- xen/arch/x86/domctl.c | 1 xen/arch/x86/pci.c | 58 +++ xen/drivers/passthrough/amd/iommu_detect.c | 2 xen/drivers/passthrough/amd/iommu_init.c | 2 xen/drivers/passthrough/amd/pci_amd_iommu.c | 2 xen/drivers/passthrough/vtd/dmar.c | 2 xen/drivers/passthrough/vtd/intremap.c | 2 xen/drivers/passthrough/vtd/iommu.c | 29 - xen/drivers/passthrough/vtd/qinval.c | 2 xen/drivers/passthrough/vtd/utils.c | 37 - xen/include/xen/iommu.h | 21 - xen/include/xen/pci.h | 22 + xen/include/xen/pci_regs.h | 530 ++++++++++++++++++++++++++++ 14 files changed, 623 insertions(+), 617 deletions(-) diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/arch/x86/domctl.c --- a/xen/arch/x86/domctl.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/arch/x86/domctl.c Thu May 01 10:26:58 2008 +0100 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/arch/x86/pci.c --- a/xen/arch/x86/pci.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/arch/x86/pci.c Thu May 01 10:26:58 2008 +0100 @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -116,3 +117,60 @@ void pci_conf_write32( BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255)); pci_conf_write(PCI_CONF_ADDRESS(bus, dev, func, reg), 0, 4, data); } + +int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap) +{ + u8 id; + int max_cap = 48; + u8 pos = PCI_CAPABILITY_LIST; + u16 status; + + status = pci_conf_read16(bus, dev, func, PCI_STATUS); + if ( (status & PCI_STATUS_CAP_LIST) == 0 ) + return 0; + + while ( max_cap-- ) + { + pos = pci_conf_read8(bus, dev, func, pos); + if ( pos < 0x40 ) + break; + + pos &= ~3; + id = pci_conf_read8(bus, dev, func, pos + PCI_CAP_LIST_ID); + + if ( id == 0xff ) + break; + else if ( id == cap ) + return pos; + + pos += PCI_CAP_LIST_NEXT; + } + + return 0; +} + +int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap) +{ + u8 id; + int ttl = 48; + + while ( ttl-- ) + { + pos = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos); + if ( pos < 0x40 ) + break; + + pos &= ~3; + id = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), + pos + PCI_CAP_LIST_ID); + + if ( id == 0xff ) + break; + if ( id == cap ) + return pos; + + pos += PCI_CAP_LIST_NEXT; + } + return 0; +} + diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/amd/iommu_detect.c --- a/xen/drivers/passthrough/amd/iommu_detect.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/drivers/passthrough/amd/iommu_detect.c Thu May 01 10:26:58 2008 +0100 @@ -22,9 +22,9 @@ #include #include #include +#include #include #include -#include "../pci_regs.h" static int __init valid_bridge_bus_config( int bus, int dev, int func, int *sec_bus, int *sub_bus) diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/amd/iommu_init.c --- a/xen/drivers/passthrough/amd/iommu_init.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/drivers/passthrough/amd/iommu_init.c Thu May 01 10:26:58 2008 +0100 @@ -21,10 +21,10 @@ #include #include #include +#include #include #include #include -#include "../pci_regs.h" extern int nr_amd_iommus; static struct amd_iommu *vector_to_iommu[NR_VECTORS]; diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/amd/pci_amd_iommu.c --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c Thu May 01 10:26:58 2008 +0100 @@ -20,11 +20,11 @@ #include #include +#include #include #include #include #include -#include "../pci_regs.h" struct list_head amd_iommu_head; long amd_iommu_poll_comp_wait = COMPLETION_WAIT_DEFAULT_POLLING_COUNT; diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/pci_regs.h --- a/xen/drivers/passthrough/pci_regs.h Thu May 01 10:00:00 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,530 +0,0 @@ -/* - * pci_regs.h - * - * PCI standard defines - * Copyright 1994, Drew Eckhardt - * Copyright 1997--1999 Martin Mares - * - * For more information, please consult the following manuals (look at - * http://www.pcisig.com/ for how to get them): - * - * PCI BIOS Specification - * PCI Local Bus Specification - * PCI to PCI Bridge Specification - * PCI System Design Guide - * - * For hypertransport information, please consult the following manuals - * from http://www.hypertransport.org - * - * The Hypertransport I/O Link Specification - */ - -#ifndef LINUX_PCI_REGS_H -#define LINUX_PCI_REGS_H - -/* - * Under PCI, each device has 256 bytes of configuration address space, - * of which the first 64 bytes are standardized as follows: - */ -#define PCI_VENDOR_ID 0x00 /* 16 bits */ -#define PCI_DEVICE_ID 0x02 /* 16 bits */ -#define PCI_COMMAND 0x04 /* 16 bits */ -#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ -#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ -#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ -#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ -#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ -#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ -#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ -#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ -#define PCI_COMMAND_SERR 0x100 /* Enable SERR */ -#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ -#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ - -#define PCI_STATUS 0x06 /* 16 bits */ -#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ -#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ -#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ -#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ -#define PCI_STATUS_PARITY 0x100 /* Detected parity error */ -#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ -#define PCI_STATUS_DEVSEL_FAST 0x000 -#define PCI_STATUS_DEVSEL_MEDIUM 0x200 -#define PCI_STATUS_DEVSEL_SLOW 0x400 -#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ -#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ -#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ -#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ -#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ - -#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ -#define PCI_REVISION_ID 0x08 /* Revision ID */ -#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ -#define PCI_CLASS_DEVICE 0x0a /* Device class */ - -#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ -#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ -#define PCI_HEADER_TYPE 0x0e /* 8 bits */ -#define PCI_HEADER_TYPE_NORMAL 0 -#define PCI_HEADER_TYPE_BRIDGE 1 -#define PCI_HEADER_TYPE_CARDBUS 2 - -#define PCI_BIST 0x0f /* 8 bits */ -#define PCI_BIST_CODE_MASK 0x0f /* Return result */ -#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ -#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ - -/* - * Base addresses specify locations in memory or I/O space. - * Decoded size can be determined by writing a value of - * 0xffffffff to the register, and reading it back. Only - * 1 bits are decoded. - */ -#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ -#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ -#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ -#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ -#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ -#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ -#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ -#define PCI_BASE_ADDRESS_SPACE_IO 0x01 -#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 -#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 -#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ -#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ -#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ -#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ -#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) -#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) -/* bit 1 is reserved if address_space = 1 */ - -/* Header type 0 (normal devices) */ -#define PCI_CARDBUS_CIS 0x28 -#define PCI_SUBSYSTEM_VENDOR_ID 0x2c -#define PCI_SUBSYSTEM_ID 0x2e -#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ -#define PCI_ROM_ADDRESS_ENABLE 0x01 -#define PCI_ROM_ADDRESS_MASK (~0x7ffUL) - -#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ - -/* 0x35-0x3b are reserved */ -#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ -#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ -#define PCI_MIN_GNT 0x3e /* 8 bits */ -#define PCI_MAX_LAT 0x3f /* 8 bits */ - -/* Header type 1 (PCI-to-PCI bridges) */ -#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ -#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ -#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ -#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ -#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ -#define PCI_IO_LIMIT 0x1d -#define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ -#define PCI_IO_RANGE_TYPE_16 0x00 -#define PCI_IO_RANGE_TYPE_32 0x01 -#define PCI_IO_RANGE_MASK (~0x0fUL) -#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ -#define PCI_MEMORY_BASE 0x20 /* Memory range behind */ -#define PCI_MEMORY_LIMIT 0x22 -#define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL -#define PCI_MEMORY_RANGE_MASK (~0x0fUL) -#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ -#define PCI_PREF_MEMORY_LIMIT 0x26 -#define PCI_PREF_RANGE_TYPE_MASK 0x0fUL -#define PCI_PREF_RANGE_TYPE_32 0x00 -#define PCI_PREF_RANGE_TYPE_64 0x01 -#define PCI_PREF_RANGE_MASK (~0x0fUL) -#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ -#define PCI_PREF_LIMIT_UPPER32 0x2c -#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ -#define PCI_IO_LIMIT_UPPER16 0x32 -/* 0x34 same as for htype 0 */ -/* 0x35-0x3b is reserved */ -#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ -/* 0x3c-0x3d are same as for htype 0 */ -#define PCI_BRIDGE_CONTROL 0x3e -#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ -#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ -#define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */ -#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ -#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ -#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ -#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ - -/* Header type 2 (CardBus bridges) */ -#define PCI_CB_CAPABILITY_LIST 0x14 -/* 0x15 reserved */ -#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ -#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ -#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ -#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ -#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ -#define PCI_CB_MEMORY_BASE_0 0x1c -#define PCI_CB_MEMORY_LIMIT_0 0x20 -#define PCI_CB_MEMORY_BASE_1 0x24 -#define PCI_CB_MEMORY_LIMIT_1 0x28 -#define PCI_CB_IO_BASE_0 0x2c -#define PCI_CB_IO_BASE_0_HI 0x2e -#define PCI_CB_IO_LIMIT_0 0x30 -#define PCI_CB_IO_LIMIT_0_HI 0x32 -#define PCI_CB_IO_BASE_1 0x34 -#define PCI_CB_IO_BASE_1_HI 0x36 -#define PCI_CB_IO_LIMIT_1 0x38 -#define PCI_CB_IO_LIMIT_1_HI 0x3a -#define PCI_CB_IO_RANGE_MASK (~0x03UL) -/* 0x3c-0x3d are same as for htype 0 */ -#define PCI_CB_BRIDGE_CONTROL 0x3e -#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ -#define PCI_CB_BRIDGE_CTL_SERR 0x02 -#define PCI_CB_BRIDGE_CTL_ISA 0x04 -#define PCI_CB_BRIDGE_CTL_VGA 0x08 -#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 -#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ -#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ -#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ -#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 -#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 -#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 -#define PCI_CB_SUBSYSTEM_ID 0x42 -#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ -/* 0x48-0x7f reserved */ - -/* Capability lists */ - -#define PCI_CAP_LIST_ID 0 /* Capability ID */ -#define PCI_CAP_ID_PM 0x01 /* Power Management */ -#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ -#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ -#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ -#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ -#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ -#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ -#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ -#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */ -#define PCI_CAP_ID_DBG 0x0A /* Debug port */ -#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ -#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ -#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ -#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ -#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ -#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ -#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ -#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ -#define PCI_CAP_SIZEOF 4 - -/* Power Management Registers */ - -#define PCI_PM_PMC 2 /* PM Capabilities Register */ -#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ -#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ -#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ -#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ -#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ -#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ -#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ -#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ -#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ -#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ -#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ -#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ -#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ -#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ -#define PCI_PM_CTRL 4 /* PM control and status register */ -#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ -#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ -#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ -#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ -#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ -#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ -#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ -#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ -#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ -#define PCI_PM_DATA_REGISTER 7 /* (??) */ -#define PCI_PM_SIZEOF 8 - -/* AGP registers */ - -#define PCI_AGP_VERSION 2 /* BCD version number */ -#define PCI_AGP_RFU 3 /* Rest of capability flags */ -#define PCI_AGP_STATUS 4 /* Status register */ -#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ -#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ -#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ -#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ -#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ -#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ -#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ -#define PCI_AGP_COMMAND 8 /* Control register */ -#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ -#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ -#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ -#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ -#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ -#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ -#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ -#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ -#define PCI_AGP_SIZEOF 12 - -/* Vital Product Data */ - -#define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ -#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ -#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ -#define PCI_VPD_DATA 4 /* 32-bits of data returned here */ - -/* Slot Identification */ - -#define PCI_SID_ESR 2 /* Expansion Slot Register */ -#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ -#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ -#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ - -/* Message Signalled Interrupts registers */ - -#define PCI_MSI_FLAGS 2 /* Various flags */ -#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ -#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ -#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ -#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ -#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ -#define PCI_MSI_RFU 3 /* Rest of capability flags */ -#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ -#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ -#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ -#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ -#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ - -/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */ -#define PCI_MSIX_FLAGS 2 -#define PCI_MSIX_FLAGS_QSIZE 0x7FF -#define PCI_MSIX_FLAGS_ENABLE (1 << 15) -#define PCI_MSIX_FLAGS_MASKALL (1 << 14) -#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) -#define PCI_MSIX_FLAGS_BITMASK (1 << 0) - -/* CompactPCI Hotswap Register */ - -#define PCI_CHSWP_CSR 2 /* Control and Status Register */ -#define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ -#define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ -#define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ -#define PCI_CHSWP_LOO 0x08 /* LED On / Off */ -#define PCI_CHSWP_PI 0x30 /* Programming Interface */ -#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ -#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ - -/* PCI-X registers */ - -#define PCI_X_CMD 2 /* Modes & Features */ -#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ -#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ -#define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */ -#define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */ -#define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */ -#define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */ -#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ - /* Max # of outstanding split transactions */ -#define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */ -#define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */ -#define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */ -#define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */ -#define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */ -#define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */ -#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ -#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ -#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ -#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ -#define PCI_X_STATUS 4 /* PCI-X capabilities */ -#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ -#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ -#define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ -#define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ -#define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ -#define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ -#define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ -#define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ -#define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ -#define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ -#define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ -#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ -#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ - -/* PCI Express capability registers */ - -#define PCI_EXP_FLAGS 2 /* Capabilities register */ -#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ -#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ -#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ -#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ -#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ -#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ -#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ -#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ -#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ -#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ -#define PCI_EXP_DEVCAP 4 /* Device capabilities */ -#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ -#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ -#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ -#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ -#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ -#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ -#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ -#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ -#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ -#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ -#define PCI_EXP_DEVCTL 8 /* Device Control */ -#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ -#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ -#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ -#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ -#define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ -#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ -#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ -#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ -#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ -#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ -#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ -#define PCI_EXP_DEVSTA 10 /* Device Status */ -#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ -#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ -#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ -#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ -#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ -#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ -#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ -#define PCI_EXP_LNKCTL 16 /* Link Control */ -#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ -#define PCI_EXP_LNKSTA 18 /* Link Status */ -#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ -#define PCI_EXP_SLTCTL 24 /* Slot Control */ -#define PCI_EXP_SLTSTA 26 /* Slot Status */ -#define PCI_EXP_RTCTL 28 /* Root Control */ -#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ -#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ -#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ -#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ -#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ -#define PCI_EXP_RTCAP 30 /* Root Capabilities */ -#define PCI_EXP_RTSTA 32 /* Root Status */ - -/* Extended Capabilities (PCI-X 2.0 and Express) */ -#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) -#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) -#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) - -#define PCI_EXT_CAP_ID_ERR 1 -#define PCI_EXT_CAP_ID_VC 2 -#define PCI_EXT_CAP_ID_DSN 3 -#define PCI_EXT_CAP_ID_PWR 4 - -/* Advanced Error Reporting */ -#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ -#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ -#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ -#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ -#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ -#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ -#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ -#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ -#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ -#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ -#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ -#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ -#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ - /* Same bits as above */ -#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ - /* Same bits as above */ -#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ -#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ -#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ -#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ -#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ -#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ -#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ - /* Same bits as above */ -#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ -#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ -#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ -#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ -#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ -#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ -#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ -#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ -/* Correctable Err Reporting Enable */ -#define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 -/* Non-fatal Err Reporting Enable */ -#define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 -/* Fatal Err Reporting Enable */ -#define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 -#define PCI_ERR_ROOT_STATUS 48 -#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */ -/* Multi ERR_COR Received */ -#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 -/* ERR_FATAL/NONFATAL Recevied */ -#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 -/* Multi ERR_FATAL/NONFATAL Recevied */ -#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 -#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ -#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ -#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ -#define PCI_ERR_ROOT_COR_SRC 52 -#define PCI_ERR_ROOT_SRC 54 - -/* Virtual Channel */ -#define PCI_VC_PORT_REG1 4 -#define PCI_VC_PORT_REG2 8 -#define PCI_VC_PORT_CTRL 12 -#define PCI_VC_PORT_STATUS 14 -#define PCI_VC_RES_CAP 16 -#define PCI_VC_RES_CTRL 20 -#define PCI_VC_RES_STATUS 26 - -/* Power Budgeting */ -#define PCI_PWR_DSR 4 /* Data Select Register */ -#define PCI_PWR_DATA 8 /* Data Register */ -#define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ -#define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ -#define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ -#define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ -#define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ -#define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ -#define PCI_PWR_CAP 12 /* Capability */ -#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ - -/* - * Hypertransport sub capability types - * - * Unfortunately there are both 3 bit and 5 bit capability types defined - * in the HT spec, catering for that is a little messy. You probably don't - * want to use these directly, just use pci_find_ht_capability() and it - * will do the right thing for you. - */ -#define HT_3BIT_CAP_MASK 0xE0 -#define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */ -#define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */ - -#define HT_5BIT_CAP_MASK 0xF8 -#define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */ -#define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */ -#define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */ -#define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */ -#define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */ -#define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */ -#define HT_MSI_FLAGS 0x02 /* Offset to flags */ -#define HT_MSI_FLAGS_ENABLE 0x1 /* Mapping enable */ -#define HT_MSI_FLAGS_FIXED 0x2 /* Fixed mapping only */ -#define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL /* Fixed addr */ -#define HT_MSI_ADDR_LO 0x04 /* Offset to low addr bits */ -#define HT_MSI_ADDR_LO_MASK 0xFFF00000 /* Low address bit mask */ -#define HT_MSI_ADDR_HI 0x08 /* Offset to high addr bits */ -#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ -#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ -#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ -#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ -#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ - - -#endif /* LINUX_PCI_REGS_H */ diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/drivers/passthrough/vtd/dmar.c Thu May 01 10:26:58 2008 +0100 @@ -26,9 +26,9 @@ #include #include #include +#include #include #include "dmar.h" -#include "../pci_regs.h" int vtd_enabled = 1; diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/drivers/passthrough/vtd/intremap.c Thu May 01 10:26:58 2008 +0100 @@ -23,10 +23,10 @@ #include #include #include +#include #include "iommu.h" #include "dmar.h" #include "vtd.h" -#include "../pci_regs.h" #include "msi.h" #include "extern.h" diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Thu May 01 10:26:58 2008 +0100 @@ -27,10 +27,10 @@ #include #include #include +#include #include #include "iommu.h" #include "dmar.h" -#include "../pci_regs.h" #include "msi.h" #include "extern.h" #include "vtd.h" @@ -1182,31 +1182,6 @@ static int domain_context_mapping_one( return 0; } -static int __pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap) -{ - u8 id; - int ttl = 48; - - while ( ttl-- ) - { - pos = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pos); - if ( pos < 0x40 ) - break; - - pos &= ~3; - id = pci_conf_read8(bus, PCI_SLOT(devfn), PCI_FUNC(devfn), - pos + PCI_CAP_LIST_ID); - - if ( id == 0xff ) - break; - if ( id == cap ) - return pos; - - pos += PCI_CAP_LIST_NEXT; - } - return 0; -} - #define PCI_BASE_CLASS_BRIDGE 0x06 #define PCI_CLASS_BRIDGE_PCI 0x0604 @@ -1230,7 +1205,7 @@ int pdev_type(struct pci_dev *dev) if ( !(status & PCI_STATUS_CAP_LIST) ) return DEV_TYPE_PCI; - if ( __pci_find_next_cap(dev->bus, dev->devfn, + if ( pci_find_next_cap(dev->bus, dev->devfn, PCI_CAPABILITY_LIST, PCI_CAP_ID_EXP) ) return DEV_TYPE_PCIe_ENDPOINT; diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/vtd/qinval.c --- a/xen/drivers/passthrough/vtd/qinval.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/drivers/passthrough/vtd/qinval.c Thu May 01 10:26:58 2008 +0100 @@ -23,10 +23,10 @@ #include #include #include +#include #include "iommu.h" #include "dmar.h" #include "vtd.h" -#include "../pci_regs.h" #include "msi.h" #include "extern.h" diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/drivers/passthrough/vtd/utils.c --- a/xen/drivers/passthrough/vtd/utils.c Thu May 01 10:00:00 2008 +0100 +++ b/xen/drivers/passthrough/vtd/utils.c Thu May 01 10:26:58 2008 +0100 @@ -22,9 +22,9 @@ #include #include #include +#include #include "iommu.h" #include "dmar.h" -#include "../pci_regs.h" #include "msi.h" #include "vtd.h" @@ -96,37 +96,6 @@ void disable_pmr(struct iommu *iommu) "Disabled protected memory registers\n"); } -static u8 find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap) -{ - u8 id; - int max_cap = 48; - u8 pos = PCI_CAPABILITY_LIST; - u16 status; - - status = pci_conf_read16(bus, dev, func, PCI_STATUS); - if ( (status & PCI_STATUS_CAP_LIST) == 0 ) - return 0; - - while ( max_cap-- ) - { - pos = pci_conf_read8(bus, dev, func, pos); - if ( pos < 0x40 ) - break; - - pos &= ~3; - id = pci_conf_read8(bus, dev, func, pos + PCI_CAP_LIST_ID); - - if ( id == 0xff ) - break; - else if ( id == cap ) - return pos; - - pos += PCI_CAP_LIST_NEXT; - } - - return 0; -} - #define PCI_D3hot (3) #define PCI_CONFIG_DWORD_SIZE (64) #define PCI_EXP_DEVCAP_FLR (1 << 28) @@ -140,7 +109,7 @@ void pdev_flr(u8 bus, u8 devfn) u8 dev = PCI_SLOT(devfn); u8 func = PCI_FUNC(devfn); - pos = find_cap_offset(bus, dev, func, PCI_CAP_ID_EXP); + pos = pci_find_cap_offset(bus, dev, func, PCI_CAP_ID_EXP); if ( pos != 0 ) { dev_cap = pci_conf_read32(bus, dev, func, pos + PCI_EXP_DEVCAP); @@ -163,7 +132,7 @@ void pdev_flr(u8 bus, u8 devfn) */ if ( flr == 0 ) { - pos = find_cap_offset(bus, dev, func, PCI_CAP_ID_PM); + pos = pci_find_cap_offset(bus, dev, func, PCI_CAP_ID_PM); if ( pos != 0 ) { int i; diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Thu May 01 10:00:00 2008 +0100 +++ b/xen/include/xen/iommu.h Thu May 01 10:26:58 2008 +0100 @@ -21,7 +21,7 @@ #define _IOMMU_H_ #include -#include +#include #include #include #include @@ -38,25 +38,6 @@ extern int iommu_enabled; #define PAGE_SIZE_4K (1UL << PAGE_SHIFT_4K) #define PAGE_MASK_4K (((u64)-1) << PAGE_SHIFT_4K) #define PAGE_ALIGN_4K(addr) (((addr) + PAGE_SIZE_4K - 1) & PAGE_MASK_4K) - -/* - * The PCI interface treats multi-function devices as independent - * devices. The slot/function address of each device is encoded - * in a single byte as follows: - * - * 15:8 = bus - * 7:3 = slot - * 2:0 = function - */ -#define PCI_DEVFN(slot,func) (((slot & 0x1f) << 3) | (func & 0x07)) -#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) -#define PCI_FUNC(devfn) ((devfn) & 0x07) - -struct pci_dev { - struct list_head list; - u8 bus; - u8 devfn; -}; struct iommu { struct list_head list; diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/include/xen/pci.h --- a/xen/include/xen/pci.h Thu May 01 10:00:00 2008 +0100 +++ b/xen/include/xen/pci.h Thu May 01 10:26:58 2008 +0100 @@ -9,6 +9,26 @@ #include #include +#include + +/* + * The PCI interface treats multi-function devices as independent + * devices. The slot/function address of each device is encoded + * in a single byte as follows: + * + * 15:8 = bus + * 7:3 = slot + * 2:0 = function + */ +#define PCI_DEVFN(slot,func) (((slot & 0x1f) << 3) | (func & 0x07)) +#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) +#define PCI_FUNC(devfn) ((devfn) & 0x07) + +struct pci_dev { + struct list_head list; + u8 bus; + u8 devfn; +}; uint8_t pci_conf_read8( unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg); @@ -25,5 +45,7 @@ void pci_conf_write32( void pci_conf_write32( unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg, uint32_t data); +int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap); +int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap); #endif /* __XEN_PCI_H__ */ diff -r 5e5bc5b2bb6d -r 8bced3d8a907 xen/include/xen/pci_regs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/include/xen/pci_regs.h Thu May 01 10:26:58 2008 +0100 @@ -0,0 +1,530 @@ +/* + * pci_regs.h + * + * PCI standard defines + * Copyright 1994, Drew Eckhardt + * Copyright 1997--1999 Martin Mares + * + * For more information, please consult the following manuals (look at + * http://www.pcisig.com/ for how to get them): + * + * PCI BIOS Specification + * PCI Local Bus Specification + * PCI to PCI Bridge Specification + * PCI System Design Guide + * + * For hypertransport information, please consult the following manuals + * from http://www.hypertransport.org + * + * The Hypertransport I/O Link Specification + */ + +#ifndef LINUX_PCI_REGS_H +#define LINUX_PCI_REGS_H + +/* + * Under PCI, each device has 256 bytes of configuration address space, + * of which the first 64 bytes are standardized as follows: + */ +#define PCI_VENDOR_ID 0x00 /* 16 bits */ +#define PCI_DEVICE_ID 0x02 /* 16 bits */ +#define PCI_COMMAND 0x04 /* 16 bits */ +#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ +#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ +#define PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */ +#define PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */ +#define PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */ +#define PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */ +#define PCI_COMMAND_PARITY 0x40 /* Enable parity checking */ +#define PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */ +#define PCI_COMMAND_SERR 0x100 /* Enable SERR */ +#define PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */ +#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */ + +#define PCI_STATUS 0x06 /* 16 bits */ +#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ +#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */ +#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */ +#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */ +#define PCI_STATUS_PARITY 0x100 /* Detected parity error */ +#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */ +#define PCI_STATUS_DEVSEL_FAST 0x000 +#define PCI_STATUS_DEVSEL_MEDIUM 0x200 +#define PCI_STATUS_DEVSEL_SLOW 0x400 +#define PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */ +#define PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */ +#define PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */ +#define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */ +#define PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */ + +#define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ +#define PCI_REVISION_ID 0x08 /* Revision ID */ +#define PCI_CLASS_PROG 0x09 /* Reg. Level Programming Interface */ +#define PCI_CLASS_DEVICE 0x0a /* Device class */ + +#define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ +#define PCI_LATENCY_TIMER 0x0d /* 8 bits */ +#define PCI_HEADER_TYPE 0x0e /* 8 bits */ +#define PCI_HEADER_TYPE_NORMAL 0 +#define PCI_HEADER_TYPE_BRIDGE 1 +#define PCI_HEADER_TYPE_CARDBUS 2 + +#define PCI_BIST 0x0f /* 8 bits */ +#define PCI_BIST_CODE_MASK 0x0f /* Return result */ +#define PCI_BIST_START 0x40 /* 1 to start BIST, 2 secs or less */ +#define PCI_BIST_CAPABLE 0x80 /* 1 if BIST capable */ + +/* + * Base addresses specify locations in memory or I/O space. + * Decoded size can be determined by writing a value of + * 0xffffffff to the register, and reading it back. Only + * 1 bits are decoded. + */ +#define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ +#define PCI_BASE_ADDRESS_1 0x14 /* 32 bits [htype 0,1 only] */ +#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ +#define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ +#define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ +#define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ +#define PCI_BASE_ADDRESS_SPACE 0x01 /* 0 = memory, 1 = I/O */ +#define PCI_BASE_ADDRESS_SPACE_IO 0x01 +#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 +#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 +#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */ +#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */ +#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */ +#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */ +#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) +#define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) +/* bit 1 is reserved if address_space = 1 */ + +/* Header type 0 (normal devices) */ +#define PCI_CARDBUS_CIS 0x28 +#define PCI_SUBSYSTEM_VENDOR_ID 0x2c +#define PCI_SUBSYSTEM_ID 0x2e +#define PCI_ROM_ADDRESS 0x30 /* Bits 31..11 are address, 10..1 reserved */ +#define PCI_ROM_ADDRESS_ENABLE 0x01 +#define PCI_ROM_ADDRESS_MASK (~0x7ffUL) + +#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ + +/* 0x35-0x3b are reserved */ +#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ +#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ +#define PCI_MIN_GNT 0x3e /* 8 bits */ +#define PCI_MAX_LAT 0x3f /* 8 bits */ + +/* Header type 1 (PCI-to-PCI bridges) */ +#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ +#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ +#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ +#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ +#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ +#define PCI_IO_LIMIT 0x1d +#define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ +#define PCI_IO_RANGE_TYPE_16 0x00 +#define PCI_IO_RANGE_TYPE_32 0x01 +#define PCI_IO_RANGE_MASK (~0x0fUL) +#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ +#define PCI_MEMORY_BASE 0x20 /* Memory range behind */ +#define PCI_MEMORY_LIMIT 0x22 +#define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL +#define PCI_MEMORY_RANGE_MASK (~0x0fUL) +#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ +#define PCI_PREF_MEMORY_LIMIT 0x26 +#define PCI_PREF_RANGE_TYPE_MASK 0x0fUL +#define PCI_PREF_RANGE_TYPE_32 0x00 +#define PCI_PREF_RANGE_TYPE_64 0x01 +#define PCI_PREF_RANGE_MASK (~0x0fUL) +#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ +#define PCI_PREF_LIMIT_UPPER32 0x2c +#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ +#define PCI_IO_LIMIT_UPPER16 0x32 +/* 0x34 same as for htype 0 */ +/* 0x35-0x3b is reserved */ +#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ +/* 0x3c-0x3d are same as for htype 0 */ +#define PCI_BRIDGE_CONTROL 0x3e +#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ +#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ +#define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */ +#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ +#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ +#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ +#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ + +/* Header type 2 (CardBus bridges) */ +#define PCI_CB_CAPABILITY_LIST 0x14 +/* 0x15 reserved */ +#define PCI_CB_SEC_STATUS 0x16 /* Secondary status */ +#define PCI_CB_PRIMARY_BUS 0x18 /* PCI bus number */ +#define PCI_CB_CARD_BUS 0x19 /* CardBus bus number */ +#define PCI_CB_SUBORDINATE_BUS 0x1a /* Subordinate bus number */ +#define PCI_CB_LATENCY_TIMER 0x1b /* CardBus latency timer */ +#define PCI_CB_MEMORY_BASE_0 0x1c +#define PCI_CB_MEMORY_LIMIT_0 0x20 +#define PCI_CB_MEMORY_BASE_1 0x24 +#define PCI_CB_MEMORY_LIMIT_1 0x28 +#define PCI_CB_IO_BASE_0 0x2c +#define PCI_CB_IO_BASE_0_HI 0x2e +#define PCI_CB_IO_LIMIT_0 0x30 +#define PCI_CB_IO_LIMIT_0_HI 0x32 +#define PCI_CB_IO_BASE_1 0x34 +#define PCI_CB_IO_BASE_1_HI 0x36 +#define PCI_CB_IO_LIMIT_1 0x38 +#define PCI_CB_IO_LIMIT_1_HI 0x3a +#define PCI_CB_IO_RANGE_MASK (~0x03UL) +/* 0x3c-0x3d are same as for htype 0 */ +#define PCI_CB_BRIDGE_CONTROL 0x3e +#define PCI_CB_BRIDGE_CTL_PARITY 0x01 /* Similar to standard bridge control register */ +#define PCI_CB_BRIDGE_CTL_SERR 0x02 +#define PCI_CB_BRIDGE_CTL_ISA 0x04 +#define PCI_CB_BRIDGE_CTL_VGA 0x08 +#define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 +#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */ +#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 /* Prefetch enable for both memory regions */ +#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 +#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 +#define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 +#define PCI_CB_SUBSYSTEM_ID 0x42 +#define PCI_CB_LEGACY_MODE_BASE 0x44 /* 16-bit PC Card legacy mode base address (ExCa) */ +/* 0x48-0x7f reserved */ + +/* Capability lists */ + +#define PCI_CAP_LIST_ID 0 /* Capability ID */ +#define PCI_CAP_ID_PM 0x01 /* Power Management */ +#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ +#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ +#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */ +#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ +#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ +#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ +#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ +#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */ +#define PCI_CAP_ID_DBG 0x0A /* Debug port */ +#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */ +#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ +#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */ +#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ +#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ +#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ +#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ +#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ +#define PCI_CAP_SIZEOF 4 + +/* Power Management Registers */ + +#define PCI_PM_PMC 2 /* PM Capabilities Register */ +#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */ +#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */ +#define PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */ +#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */ +#define PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */ +#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */ +#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */ +#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */ +#define PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */ +#define PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */ +#define PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */ +#define PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */ +#define PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */ +#define PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */ +#define PCI_PM_CTRL 4 /* PM control and status register */ +#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ +#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ +#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ +#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ +#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ +#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */ +#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */ +#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */ +#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */ +#define PCI_PM_DATA_REGISTER 7 /* (??) */ +#define PCI_PM_SIZEOF 8 + +/* AGP registers */ + +#define PCI_AGP_VERSION 2 /* BCD version number */ +#define PCI_AGP_RFU 3 /* Rest of capability flags */ +#define PCI_AGP_STATUS 4 /* Status register */ +#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */ +#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */ +#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */ +#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */ +#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */ +#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */ +#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */ +#define PCI_AGP_COMMAND 8 /* Control register */ +#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */ +#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */ +#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */ +#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */ +#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */ +#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */ +#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 2x rate */ +#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 1x rate */ +#define PCI_AGP_SIZEOF 12 + +/* Vital Product Data */ + +#define PCI_VPD_ADDR 2 /* Address to access (15 bits!) */ +#define PCI_VPD_ADDR_MASK 0x7fff /* Address mask */ +#define PCI_VPD_ADDR_F 0x8000 /* Write 0, 1 indicates completion */ +#define PCI_VPD_DATA 4 /* 32-bits of data returned here */ + +/* Slot Identification */ + +#define PCI_SID_ESR 2 /* Expansion Slot Register */ +#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ +#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */ +#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */ + +/* Message Signalled Interrupts registers */ + +#define PCI_MSI_FLAGS 2 /* Various flags */ +#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */ +#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */ +#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */ +#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */ +#define PCI_MSI_FLAGS_MASKBIT 0x100 /* 64-bit mask bits allowed */ +#define PCI_MSI_RFU 3 /* Rest of capability flags */ +#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ +#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ +#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ +#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ +#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ + +/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */ +#define PCI_MSIX_FLAGS 2 +#define PCI_MSIX_FLAGS_QSIZE 0x7FF +#define PCI_MSIX_FLAGS_ENABLE (1 << 15) +#define PCI_MSIX_FLAGS_MASKALL (1 << 14) +#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) +#define PCI_MSIX_FLAGS_BITMASK (1 << 0) + +/* CompactPCI Hotswap Register */ + +#define PCI_CHSWP_CSR 2 /* Control and Status Register */ +#define PCI_CHSWP_DHA 0x01 /* Device Hiding Arm */ +#define PCI_CHSWP_EIM 0x02 /* ENUM# Signal Mask */ +#define PCI_CHSWP_PIE 0x04 /* Pending Insert or Extract */ +#define PCI_CHSWP_LOO 0x08 /* LED On / Off */ +#define PCI_CHSWP_PI 0x30 /* Programming Interface */ +#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ +#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ + +/* PCI-X registers */ + +#define PCI_X_CMD 2 /* Modes & Features */ +#define PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */ +#define PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */ +#define PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */ +#define PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */ +#define PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */ +#define PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */ +#define PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */ + /* Max # of outstanding split transactions */ +#define PCI_X_CMD_SPLIT_1 0x0000 /* Max 1 */ +#define PCI_X_CMD_SPLIT_2 0x0010 /* Max 2 */ +#define PCI_X_CMD_SPLIT_3 0x0020 /* Max 3 */ +#define PCI_X_CMD_SPLIT_4 0x0030 /* Max 4 */ +#define PCI_X_CMD_SPLIT_8 0x0040 /* Max 8 */ +#define PCI_X_CMD_SPLIT_12 0x0050 /* Max 12 */ +#define PCI_X_CMD_SPLIT_16 0x0060 /* Max 16 */ +#define PCI_X_CMD_SPLIT_32 0x0070 /* Max 32 */ +#define PCI_X_CMD_MAX_SPLIT 0x0070 /* Max Outstanding Split Transactions */ +#define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) /* Version */ +#define PCI_X_STATUS 4 /* PCI-X capabilities */ +#define PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */ +#define PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */ +#define PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */ +#define PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */ +#define PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */ +#define PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */ +#define PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity */ +#define PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count */ +#define PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */ +#define PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */ +#define PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */ +#define PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */ +#define PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */ + +/* PCI Express capability registers */ + +#define PCI_EXP_FLAGS 2 /* Capabilities register */ +#define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */ +#define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */ +#define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */ +#define PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */ +#define PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */ +#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ +#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ +#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ +#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ +#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ +#define PCI_EXP_DEVCAP 4 /* Device capabilities */ +#define PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */ +#define PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */ +#define PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */ +#define PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */ +#define PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */ +#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ +#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ +#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ +#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ +#define PCI_EXP_DEVCTL 8 /* Device Control */ +#define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */ +#define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */ +#define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */ +#define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */ +#define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */ +#define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */ +#define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */ +#define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */ +#define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 /* Enable No Snoop */ +#define PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */ +#define PCI_EXP_DEVSTA 10 /* Device Status */ +#define PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */ +#define PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */ +#define PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */ +#define PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */ +#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ +#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ +#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ +#define PCI_EXP_LNKCTL 16 /* Link Control */ +#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ +#define PCI_EXP_LNKSTA 18 /* Link Status */ +#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ +#define PCI_EXP_SLTCTL 24 /* Slot Control */ +#define PCI_EXP_SLTSTA 26 /* Slot Status */ +#define PCI_EXP_RTCTL 28 /* Root Control */ +#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ +#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ +#define PCI_EXP_RTCTL_SEFEE 0x04 /* System Error on Fatal Error */ +#define PCI_EXP_RTCTL_PMEIE 0x08 /* PME Interrupt Enable */ +#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ +#define PCI_EXP_RTCAP 30 /* Root Capabilities */ +#define PCI_EXP_RTSTA 32 /* Root Status */ + +/* Extended Capabilities (PCI-X 2.0 and Express) */ +#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) +#define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) +#define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) + +#define PCI_EXT_CAP_ID_ERR 1 +#define PCI_EXT_CAP_ID_VC 2 +#define PCI_EXT_CAP_ID_DSN 3 +#define PCI_EXT_CAP_ID_PWR 4 + +/* Advanced Error Reporting */ +#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ +#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */ +#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */ +#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */ +#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */ +#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */ +#define PCI_ERR_UNC_COMP_ABORT 0x00008000 /* Completer Abort */ +#define PCI_ERR_UNC_UNX_COMP 0x00010000 /* Unexpected Completion */ +#define PCI_ERR_UNC_RX_OVER 0x00020000 /* Receiver Overflow */ +#define PCI_ERR_UNC_MALF_TLP 0x00040000 /* Malformed TLP */ +#define PCI_ERR_UNC_ECRC 0x00080000 /* ECRC Error Status */ +#define PCI_ERR_UNC_UNSUP 0x00100000 /* Unsupported Request */ +#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */ + /* Same bits as above */ +#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */ + /* Same bits as above */ +#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */ +#define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */ +#define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */ +#define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */ +#define PCI_ERR_COR_REP_ROLL 0x00000100 /* REPLAY_NUM Rollover */ +#define PCI_ERR_COR_REP_TIMER 0x00001000 /* Replay Timer Timeout */ +#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */ + /* Same bits as above */ +#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */ +#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */ +#define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */ +#define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */ +#define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */ +#define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */ +#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */ +#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */ +/* Correctable Err Reporting Enable */ +#define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 +/* Non-fatal Err Reporting Enable */ +#define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 +/* Fatal Err Reporting Enable */ +#define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 +#define PCI_ERR_ROOT_STATUS 48 +#define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */ +/* Multi ERR_COR Received */ +#define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 +/* ERR_FATAL/NONFATAL Recevied */ +#define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 +/* Multi ERR_FATAL/NONFATAL Recevied */ +#define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 +#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ +#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ +#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ +#define PCI_ERR_ROOT_COR_SRC 52 +#define PCI_ERR_ROOT_SRC 54 + +/* Virtual Channel */ +#define PCI_VC_PORT_REG1 4 +#define PCI_VC_PORT_REG2 8 +#define PCI_VC_PORT_CTRL 12 +#define PCI_VC_PORT_STATUS 14 +#define PCI_VC_RES_CAP 16 +#define PCI_VC_RES_CTRL 20 +#define PCI_VC_RES_STATUS 26 + +/* Power Budgeting */ +#define PCI_PWR_DSR 4 /* Data Select Register */ +#define PCI_PWR_DATA 8 /* Data Register */ +#define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */ +#define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */ +#define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */ +#define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */ +#define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */ +#define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */ +#define PCI_PWR_CAP 12 /* Capability */ +#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ + +/* + * Hypertransport sub capability types + * + * Unfortunately there are both 3 bit and 5 bit capability types defined + * in the HT spec, catering for that is a little messy. You probably don't + * want to use these directly, just use pci_find_ht_capability() and it + * will do the right thing for you. + */ +#define HT_3BIT_CAP_MASK 0xE0 +#define HT_CAPTYPE_SLAVE 0x00 /* Slave/Primary link configuration */ +#define HT_CAPTYPE_HOST 0x20 /* Host/Secondary link configuration */ + +#define HT_5BIT_CAP_MASK 0xF8 +#define HT_CAPTYPE_IRQ 0x80 /* IRQ Configuration */ +#define HT_CAPTYPE_REMAPPING_40 0xA0 /* 40 bit address remapping */ +#define HT_CAPTYPE_REMAPPING_64 0xA2 /* 64 bit address remapping */ +#define HT_CAPTYPE_UNITID_CLUMP 0x90 /* Unit ID clumping */ +#define HT_CAPTYPE_EXTCONF 0x98 /* Extended Configuration Space Access */ +#define HT_CAPTYPE_MSI_MAPPING 0xA8 /* MSI Mapping Capability */ +#define HT_MSI_FLAGS 0x02 /* Offset to flags */ +#define HT_MSI_FLAGS_ENABLE 0x1 /* Mapping enable */ +#define HT_MSI_FLAGS_FIXED 0x2 /* Fixed mapping only */ +#define HT_MSI_FIXED_ADDR 0x00000000FEE00000ULL /* Fixed addr */ +#define HT_MSI_ADDR_LO 0x04 /* Offset to low addr bits */ +#define HT_MSI_ADDR_LO_MASK 0xFFF00000 /* Low address bit mask */ +#define HT_MSI_ADDR_HI 0x08 /* Offset to high addr bits */ +#define HT_CAPTYPE_DIRECT_ROUTE 0xB0 /* Direct routing configuration */ +#define HT_CAPTYPE_VCSET 0xB8 /* Virtual Channel configuration */ +#define HT_CAPTYPE_ERROR_RETRY 0xC0 /* Retry on error configuration */ +#define HT_CAPTYPE_GEN3 0xD0 /* Generation 3 hypertransport configuration */ +#define HT_CAPTYPE_PM 0xE0 /* Hypertransport powermanagement configuration */ + + +#endif /* LINUX_PCI_REGS_H */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:49 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:49 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3d-0004Ni-3w for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:49 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra49-0003a5-OR; Thu, 01 May 2008 14:47:21 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCx-0000MQ-30 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:11 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCV-0000PM-AK for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:56 +0000 X-SBRS: 3.6 X-MesageID: 107381 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107381" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xt5r010631 for ; Thu, 1 May 2008 02:59:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0DZ8015325 for ; Thu, 1 May 2008 03:00:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0DfL015324 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:13 -0700 Message-Id: <200805011000.m41A0DfL015324@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [Xend/ACM] Provide explicit initialization function for bootloader class X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209632145 -3600 # Node ID 2cf9a8736babe63fe1783286f666c3d6fc9af58b # Parent 931932f5fc6d4b97ff262e8ab2aa5f77f5a938a6 [Xend/ACM] Provide explicit initialization function for bootloader class This patch refactors the initialization code for the bootloader class and puts it into an explicit initialization function that is called from another class. Signed-off-by: Stefan Berger --- tools/python/xen/util/bootloader.py | 25 ++++++++++++++----------- tools/python/xen/xend/XendXSPolicyAdmin.py | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff -r 931932f5fc6d -r 2cf9a8736bab tools/python/xen/util/bootloader.py --- a/tools/python/xen/util/bootloader.py Thu May 01 09:55:06 2008 +0100 +++ b/tools/python/xen/util/bootloader.py Thu May 01 09:55:45 2008 +0100 @@ -25,8 +25,6 @@ from xen.xend.XendLogging import log from xen.xend.XendLogging import log from xen.util import mkdir import xen.util.xsm.xsm as security - -__bootloader = None # # Functions for modifying entries in the bootloader, i.e. adding @@ -513,8 +511,11 @@ class LatePolicyLoader(Bootloader): Bootloader.__init__(self) def probe(self): - _dir=os.path.dirname(self.FILENAME) - mkdir.parents(_dir, stat.S_IRWXU) + try: + _dir=os.path.dirname(self.FILENAME) + mkdir.parents(_dir, stat.S_IRWXU) + except: + return False return True def get_default_title(self): @@ -614,10 +615,12 @@ class LatePolicyLoader(Bootloader): __bootloader = Bootloader() -grub = Grub() -if grub.probe() == True: - __bootloader = grub -else: - late = LatePolicyLoader() - if late.probe() == True: - __bootloader = late +def init(): + global __bootloader + grub = Grub() + if grub.probe() == True: + __bootloader = grub + else: + late = LatePolicyLoader() + if late.probe() == True: + __bootloader = late diff -r 931932f5fc6d -r 2cf9a8736bab tools/python/xen/xend/XendXSPolicyAdmin.py --- a/tools/python/xen/xend/XendXSPolicyAdmin.py Thu May 01 09:55:06 2008 +0100 +++ b/tools/python/xen/xend/XendXSPolicyAdmin.py Thu May 01 09:55:45 2008 +0100 @@ -46,6 +46,7 @@ class XSPolicyAdmin: self.maxpolicies = maxpolicies self.policies = {} self.xsobjs = {} + bootloader.init() act_pol_name = self.get_hv_loaded_policy_name() initialize() _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:53 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:53 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3h-0004No-8C for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:53 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4E-0003dp-0I; Thu, 01 May 2008 14:47:26 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCx-0000MR-8t for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:11 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCX-0000PT-3k for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:39:58 +0000 X-SBRS: 3.6 X-MesageID: 107382 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107382" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xubx010634 for ; Thu, 1 May 2008 02:59:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0EFC015342 for ; Thu, 1 May 2008 03:00:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0E28015341 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:14 -0700 Message-Id: <200805011000.m41A0E28015341@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xemnstored: Fix xenstored abort when connection dropped. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209632400 -3600 # Node ID 5e5bc5b2bb6d4d71c0de97c15448f2f991f4271d # Parent 2cf9a8736babe63fe1783286f666c3d6fc9af58b xemnstored: Fix xenstored abort when connection dropped. If a connection is dropped with pending input and output data then the connection will be dereferenced by both handle_input and handle_output resulting in a double free when the main loop dereferences the connection. Fix this issue by taking/releasing a reference over the calls to handle_input and handle_output separately and checking the result of talloc_free to see if the connection went away. Signed-off-by: Ian Campbell --- tools/xenstore/xenstored_core.c | 30 +++++++++++++++++++++--------- 1 files changed, 21 insertions(+), 9 deletions(-) diff -r 2cf9a8736bab -r 5e5bc5b2bb6d tools/xenstore/xenstored_core.c --- a/tools/xenstore/xenstored_core.c Thu May 01 09:55:45 2008 +0100 +++ b/tools/xenstore/xenstored_core.c Thu May 01 10:00:00 2008 +0100 @@ -1929,7 +1929,7 @@ int main(int argc, char *argv[]) /* Main loop. */ for (;;) { - struct connection *conn, *old_conn; + struct connection *conn, *next; if (select(max+1, &inset, &outset, NULL, timeout) < 0) { if (errno == EINTR) @@ -1953,27 +1953,39 @@ int main(int argc, char *argv[]) if (evtchn_fd != -1 && FD_ISSET(evtchn_fd, &inset)) handle_event(); - conn = list_entry(connections.next, typeof(*conn), list); - while (&conn->list != &connections) { - talloc_increase_ref_count(conn); + next = list_entry(connections.next, typeof(*conn), list); + while (&next->list != &connections) { + conn = next; + + next = list_entry(conn->list.next, + typeof(*conn), list); if (conn->domain) { + talloc_increase_ref_count(conn); if (domain_can_read(conn)) handle_input(conn); + if (talloc_free(conn) == 0) + continue; + + talloc_increase_ref_count(conn); if (domain_can_write(conn) && !list_empty(&conn->out_list)) handle_output(conn); + if (talloc_free(conn) == 0) + continue; } else { + talloc_increase_ref_count(conn); if (FD_ISSET(conn->fd, &inset)) handle_input(conn); + if (talloc_free(conn) == 0) + continue; + + talloc_increase_ref_count(conn); if (FD_ISSET(conn->fd, &outset)) handle_output(conn); + if (talloc_free(conn) == 0) + continue; } - - old_conn = conn; - conn = list_entry(old_conn->list.next, - typeof(*conn), list); - talloc_free(old_conn); } max = initialize_set(&inset, &outset, *sock, *ro_sock, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:46:57 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:46:57 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3k-0004Nr-V1 for www-data@colo.xensource.com; Thu, 01 May 2008 07:46:57 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4H-0003hC-Mz; Thu, 01 May 2008 14:47:29 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWCy-0000Mb-4g for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:12 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCl-0000PT-H3 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:09 +0000 X-SBRS: 3.6 X-MesageID: 107387 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107387" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:02 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A02Kb010649 for ; Thu, 1 May 2008 03:00:02 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0KZ3015428 for ; Thu, 1 May 2008 03:00:20 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0JDT015427 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:19 -0700 Message-Id: <200805011000.m41A0JDT015427@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:18 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] MSI 5/6: add MSI support to passthrough HVM domain X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634383 -3600 # Node ID ad55c06c9bbc31e4e3db2944f3a1fcbf842bd4aa # Parent a0ebceaf41ff8ebda5e2478c03fd6e382ddc4b7f MSI 5/6: add MSI support to passthrough HVM domain Currently it only inercept access to MSI config space, no MSI-x support. Signed-off-by: Jiang Yunhong Signed-off-by: Shan Haitao --- tools/ioemu/Makefile.target | 2 tools/ioemu/hw/pass-through.c | 40 ++ tools/ioemu/hw/pass-through.h | 9 tools/ioemu/hw/pt-msi.c | 488 ++++++++++++++++++++++++++++++++++ tools/ioemu/hw/pt-msi.h | 65 ++++ tools/libxc/xc_domain.c | 26 + tools/libxc/xc_physdev.c | 32 ++ tools/libxc/xenctrl.h | 16 + xen/arch/x86/hvm/Makefile | 1 xen/arch/x86/hvm/vlapic.c | 3 xen/arch/x86/hvm/vmsi.c | 189 +++++++++++++ xen/arch/x86/hvm/vmx/intr.c | 12 xen/drivers/passthrough/io.c | 118 +++++--- xen/drivers/passthrough/iommu.c | 2 xen/drivers/passthrough/vtd/x86/vtd.c | 2 xen/include/asm-x86/hvm/io.h | 1 xen/include/asm-x86/hvm/irq.h | 13 xen/include/public/domctl.h | 7 18 files changed, 977 insertions(+), 49 deletions(-) diff -r a0ebceaf41ff -r ad55c06c9bbc tools/ioemu/Makefile.target --- a/tools/ioemu/Makefile.target Thu May 01 10:32:10 2008 +0100 +++ b/tools/ioemu/Makefile.target Thu May 01 10:33:03 2008 +0100 @@ -370,7 +370,7 @@ endif ifdef CONFIG_PASSTHROUGH LIBS+=-lpci -VL_OBJS+= pass-through.o +VL_OBJS+= pass-through.o pt-msi.o CFLAGS += -DCONFIG_PASSTHROUGH $(info *** PCI passthrough capability has been enabled ***) endif diff -r a0ebceaf41ff -r ad55c06c9bbc tools/ioemu/hw/pass-through.c --- a/tools/ioemu/hw/pass-through.c Thu May 01 10:32:10 2008 +0100 +++ b/tools/ioemu/hw/pass-through.c Thu May 01 10:33:03 2008 +0100 @@ -26,6 +26,7 @@ #include "pass-through.h" #include "pci/header.h" #include "pci/pci.h" +#include "pt-msi.h" extern FILE *logfile; @@ -286,6 +287,9 @@ static void pt_pci_write_config(PCIDevic pci_default_write_config(d, address, val, len); return; } + + if ( pt_msi_write(assigned_device, address, val, len) ) + return; /* PCI config pass-through */ if (address == 0x4) { @@ -333,6 +337,7 @@ static uint32_t pt_pci_read_config(PCIDe break; } + pt_msi_read(assigned_device, address, len, &val); exit: #ifdef PT_DEBUG_PCI_CONFIG_ACCESS @@ -445,11 +450,41 @@ static int pt_unregister_regions(struct } +uint8_t find_cap_offset(struct pci_dev *pci_dev, uint8_t cap) +{ + int id; + int max_cap = 48; + int pos = PCI_CAPABILITY_LIST; + int status; + + status = pci_read_byte(pci_dev, PCI_STATUS); + if ( (status & PCI_STATUS_CAP_LIST) == 0 ) + return 0; + + while ( max_cap-- ) + { + pos = pci_read_byte(pci_dev, pos); + if ( pos < 0x40 ) + break; + + pos &= ~3; + id = pci_read_byte(pci_dev, pos + PCI_CAP_LIST_ID); + + if ( id == 0xff ) + break; + if ( id == cap ) + return pos; + + pos += PCI_CAP_LIST_NEXT; + } + return 0; +} + struct pt_dev * register_real_device(PCIBus *e_bus, const char *e_dev_name, int e_devfn, uint8_t r_bus, uint8_t r_dev, uint8_t r_func, uint32_t machine_irq, struct pci_access *pci_access) { - int rc = -1, i; + int rc = -1, i, pos; struct pt_dev *assigned_device = NULL; struct pci_dev *pci_dev; uint8_t e_device, e_intx; @@ -510,6 +545,9 @@ struct pt_dev * register_real_device(PCI /* Initialize virtualized PCI configuration (Extended 256 Bytes) */ for ( i = 0; i < PCI_CONFIG_SIZE; i++ ) assigned_device->dev.config[i] = pci_read_byte(pci_dev, i); + + if ( (pos = find_cap_offset(pci_dev, PCI_CAP_ID_MSI)) ) + pt_msi_init(assigned_device, pos); /* Handle real device's MMIO/PIO BARs */ pt_register_regions(assigned_device); diff -r a0ebceaf41ff -r ad55c06c9bbc tools/ioemu/hw/pass-through.h --- a/tools/ioemu/hw/pass-through.h Thu May 01 10:32:10 2008 +0100 +++ b/tools/ioemu/hw/pass-through.h Thu May 01 10:33:03 2008 +0100 @@ -57,6 +57,14 @@ struct pt_region { } access; }; +struct pt_msi_info { + uint32_t flags; + int offset; + int size; + int pvec; /* physical vector used */ + int pirq; /* guest pirq corresponding */ +}; + /* This structure holds the context of the mapping functions and data that is relevant for qemu device management. @@ -65,6 +73,7 @@ struct pt_dev { PCIDevice dev; struct pci_dev *pci_dev; /* libpci struct */ struct pt_region bases[PCI_NUM_REGIONS]; /* Access regions */ + struct pt_msi_info *msi; /* MSI virtualization */ }; /* Used for formatting PCI BDF into cf8 format */ diff -r a0ebceaf41ff -r ad55c06c9bbc tools/ioemu/hw/pt-msi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/ioemu/hw/pt-msi.c Thu May 01 10:33:03 2008 +0100 @@ -0,0 +1,488 @@ +/* + * Copyright (c) 2007, 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * Jiang Yunhong + * + * This file implements direct PCI assignment to a HVM guest + */ + +#include "pt-msi.h" + +#define PT_MSI_CTRL_WR_MASK_HI (0x1) +#define PT_MSI_CTRL_WR_MASK_LO (0x8E) +#define PT_MSI_DATA_WR_MASK (0x38) +int pt_msi_init(struct pt_dev *dev, int pos) +{ + uint8_t id; + uint16_t flags; + struct pci_dev *pd = dev->pci_dev; + PCIDevice *d = (struct PCIDevice *)dev; + + id = pci_read_byte(pd, pos + PCI_CAP_LIST_ID); + + if ( id != PCI_CAP_ID_MSI ) + { + PT_LOG("pt_msi_init: error id %x pos %x\n", id, pos); + return -1; + } + + dev->msi = malloc(sizeof(struct pt_msi_info)); + if ( !dev->msi ) + { + PT_LOG("pt_msi_init: error allocation pt_msi_info\n"); + return -1; + } + memset(dev->msi, 0, sizeof(struct pt_msi_info)); + + dev->msi->offset = pos; + dev->msi->size = 0xa; + + flags = pci_read_byte(pd, pos + PCI_MSI_FLAGS); + if ( flags & PCI_MSI_FLAGS_ENABLE ) + { + PT_LOG("pt_msi_init: MSI enabled already, disable first\n"); + pci_write_byte(pd, pos + PCI_MSI_FLAGS, flags & ~PCI_MSI_FLAGS_ENABLE); + } + dev->msi->flags |= (flags | MSI_FLAG_UNINIT); + + if ( flags & PCI_MSI_FLAGS_64BIT ) + dev->msi->size += 4; + if ( flags & PCI_MSI_FLAGS_PVMASK ) + dev->msi->size += 10; + + /* All register is 0 after reset, except first 4 byte */ + *(uint32_t *)(&d->config[pos]) = pci_read_long(pd, pos); + d->config[pos + 2] &= PT_MSI_CTRL_WR_MASK_LO; + d->config[pos + 3] &= PT_MSI_CTRL_WR_MASK_HI; + + return 0; +} + +/* + * setup physical msi, but didn't enable it + */ +static int pt_msi_setup(struct pt_dev *dev) +{ + int vector = -1, pirq = -1; + + if ( !(dev->msi->flags & MSI_FLAG_UNINIT) ) + { + PT_LOG("setup physical after initialized?? \n"); + return -1; + } + + if ( xc_physdev_map_pirq_msi(xc_handle, domid, MAP_PIRQ_TYPE_MSI, + vector, &pirq, + dev->pci_dev->dev << 3 | dev->pci_dev->func, + dev->pci_dev->bus, 1) ) + { + PT_LOG("error map vector %x\n", vector); + return -1; + } + dev->msi->pirq = pirq; + PT_LOG("vector %x pirq %x\n", vector, pirq); + + return 0; +} + +/* + * caller should make sure mask is supported + */ +static uint32_t get_msi_gmask(struct pt_dev *d) +{ + struct PCIDevice *pd = (struct PCIDevice *)d; + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + return *(uint32_t *)(pd->config + d->msi->offset + 0xc); + else + return *(uint32_t *)(pd->config + d->msi->offset + 0x10); + +} + +static uint16_t get_msi_gdata(struct pt_dev *d) +{ + struct PCIDevice *pd = (struct PCIDevice *)d; + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + return *(uint16_t *)(pd->config + d->msi->offset + PCI_MSI_DATA_64); + else + return *(uint16_t *)(pd->config + d->msi->offset + PCI_MSI_DATA_32); +} + +static uint64_t get_msi_gaddr(struct pt_dev *d) +{ + struct PCIDevice *pd = (struct PCIDevice *)d; + uint32_t addr_hi; + uint64_t addr = 0; + + addr =(uint64_t)(*(uint32_t *)(pd->config + + d->msi->offset + PCI_MSI_ADDRESS_LO)); + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + { + addr_hi = *(uint32_t *)(pd->config + d->msi->offset + + PCI_MSI_ADDRESS_HI); + addr |= (uint64_t)addr_hi << 32; + } + return addr; +} + +static uint8_t get_msi_gctrl(struct pt_dev *d) +{ + struct PCIDevice *pd = (struct PCIDevice *)d; + + return *(uint8_t *)(pd->config + d->msi->offset + PCI_MSI_FLAGS); +} + +static uint32_t get_msi_gflags(struct pt_dev *d) +{ + uint32_t result = 0; + int rh, dm, dest_id, deliv_mode, trig_mode; + uint16_t data; + uint64_t addr; + + data = get_msi_gdata(d); + addr = get_msi_gaddr(d); + + rh = (addr >> MSI_ADDR_REDIRECTION_SHIFT) & 0x1; + dm = (addr >> MSI_ADDR_DESTMODE_SHIFT) & 0x1; + dest_id = (addr >> MSI_TARGET_CPU_SHIFT) & 0xff; + deliv_mode = (data >> MSI_DATA_DELIVERY_SHIFT) & 0x7; + trig_mode = (data >> MSI_DATA_TRIGGER_SHIFT) & 0x1; + + result |= dest_id | (rh << GFLAGS_SHIFT_RH) | (dm << GFLAGS_SHIFT_DM) | \ + (deliv_mode << GLFAGS_SHIFT_DELIV_MODE) | + (trig_mode << GLFAGS_SHIFT_TRG_MODE); + + return result; +} + +/* + * This may be arch different + */ +static inline uint8_t get_msi_gvec(struct pt_dev *d) +{ + return get_msi_gdata(d) & 0xff; +} + +static inline uint8_t get_msi_hvec(struct pt_dev *d) +{ + struct pci_dev *pd = d->pci_dev; + uint16_t data; + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + data = pci_read_word(pd, PCI_MSI_DATA_64); + else + data = pci_read_word(pd, PCI_MSI_DATA_32); + + return data & 0xff; +} + +/* + * Update msi mapping, usually called when MSI enabled, + * except the first time + */ +static int pt_msi_update(struct pt_dev *d) +{ + PT_LOG("now update msi with pirq %x gvec %x\n", + get_msi_gvec(d), d->msi->pirq); + return xc_domain_update_msi_irq(xc_handle, domid, get_msi_gvec(d), + d->msi->pirq, get_msi_gflags(d)); +} + +static int pt_msi_enable(struct pt_dev *d, int enable) +{ + uint16_t ctrl; + struct pci_dev *pd = d->pci_dev; + + if ( !pd ) + return -1; + + ctrl = pci_read_word(pd, d->msi->offset + PCI_MSI_FLAGS); + + if ( enable ) + ctrl |= PCI_MSI_FLAGS_ENABLE; + else + ctrl &= ~PCI_MSI_FLAGS_ENABLE; + + pci_write_word(pd, d->msi->offset + PCI_MSI_FLAGS, ctrl); + return 0; +} + +static int pt_msi_control_update(struct pt_dev *d, uint16_t old_ctrl) +{ + uint16_t new_ctrl; + PCIDevice *pd = (PCIDevice *)d; + + new_ctrl = get_msi_gctrl(d); + + PT_LOG("old_ctrl %x new_Ctrl %x\n", old_ctrl, new_ctrl); + + if ( new_ctrl & PCI_MSI_FLAGS_ENABLE ) + { + if ( d->msi->flags & MSI_FLAG_UNINIT ) + { + /* Init physical one */ + PT_LOG("setup msi for dev %x\n", pd->devfn); + if ( pt_msi_setup(d) ) + { + PT_LOG("pt_msi_setup error!!!\n"); + return -1; + } + pt_msi_update(d); + + d->msi->flags &= ~MSI_FLAG_UNINIT; + d->msi->flags |= PT_MSI_MAPPED; + + /* Enable physical MSI only after bind */ + pt_msi_enable(d, 1); + } + else if ( !(old_ctrl & PCI_MSI_FLAGS_ENABLE) ) + pt_msi_enable(d, 1); + } + else if ( old_ctrl & PCI_MSI_FLAGS_ENABLE ) + pt_msi_enable(d, 0); + + /* Currently no support for multi-vector */ + if ( (new_ctrl & PCI_MSI_FLAGS_QSIZE) != 0x0 ) + PT_LOG("try to set more than 1 vector ctrl %x\n", new_ctrl); + + return 0; +} + +static int +pt_msi_map_update(struct pt_dev *d, uint32_t old_data, uint64_t old_addr) +{ + uint16_t pctrl; + uint32_t data; + uint64_t addr; + + data = get_msi_gdata(d); + addr = get_msi_gaddr(d); + + PT_LOG("old_data %x old_addr %lx data %x addr %lx\n", + old_data, old_addr, data, addr); + + if ( data != old_data || addr != old_addr ) + if ( get_msi_gctrl(d) & PCI_MSI_FLAGS_ENABLE ) + pt_msi_update(d); + + return 0; +} + +static int pt_msi_mask_update(struct pt_dev *d, uint32_t old_mask) +{ + struct pci_dev *pd = d->pci_dev; + uint32_t mask; + int offset; + + if ( !(d->msi->flags & PCI_MSI_FLAGS_PVMASK) ) + return -1; + + mask = get_msi_gmask(d); + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + offset = d->msi->offset + 0xc; + else + offset = d->msi->offset + 0x10; + + if ( old_mask != mask ) + pci_write_long(pd, offset, mask); +} + +#define ACCESSED_DATA 0x2 +#define ACCESSED_MASK 0x4 +#define ACCESSED_ADDR 0x8 +#define ACCESSED_CTRL 0x10 + +int pt_msi_write(struct pt_dev *d, uint32_t addr, uint32_t val, uint32_t len) +{ + struct pci_dev *pd; + int i, cur = addr; + uint8_t value, flags = 0; + uint16_t old_ctrl = 0, old_data = 0; + uint32_t old_mask = 0; + uint64_t old_addr = 0; + PCIDevice *dev = (PCIDevice *)d; + int can_write = 1; + + if ( !d || !d->msi ) + return 0; + + if ( (addr >= (d->msi->offset + d->msi->size) ) || + (addr + len) < d->msi->offset) + return 0; + + PT_LOG("addr %x val %x len %x offset %x size %x\n", + addr, val, len, d->msi->offset, d->msi->size); + + pd = d->pci_dev; + old_ctrl = get_msi_gctrl(d); + old_addr = get_msi_gaddr(d); + old_data = get_msi_gdata(d); + + if ( d->msi->flags & PCI_MSI_FLAGS_PVMASK ) + old_mask = get_msi_gmask(d); + + for ( i = 0; i < len; i++, cur++ ) + { + int off; + uint8_t orig_value; + + if ( cur < d->msi->offset ) + continue; + else if ( cur >= (d->msi->offset + d->msi->size) ) + break; + + off = cur - d->msi->offset; + value = (val >> (i * 8)) & 0xff; + + switch ( off ) + { + case 0x0 ... 0x1: + can_write = 0; + break; + case 0x2: + case 0x3: + flags |= ACCESSED_CTRL; + + orig_value = pci_read_byte(pd, d->msi->offset + off); + + orig_value &= (off == 2) ? PT_MSI_CTRL_WR_MASK_LO: + PT_MSI_CTRL_WR_MASK_HI; + + orig_value |= value & ( (off == 2) ? ~PT_MSI_CTRL_WR_MASK_LO: + ~PT_MSI_CTRL_WR_MASK_HI); + value = orig_value; + break; + case 0x4 ... 0x7: + flags |= ACCESSED_ADDR; + /* bit 4 ~ 11 is reserved for MSI in x86 */ + if ( off == 0x4 ) + value &= 0x0f; + if ( off == 0x5 ) + value &= 0xf0; + break; + case 0x8 ... 0xb: + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + { + /* Up 32bit is reserved in x86 */ + flags |= ACCESSED_ADDR; + if ( value ) + PT_LOG("Write up32 addr with %x \n", value); + } + else + { + if ( off == 0xa || off == 0xb ) + can_write = 0; + else + flags |= ACCESSED_DATA; + if ( off == 0x9 ) + value &= ~PT_MSI_DATA_WR_MASK; + } + break; + case 0xc ... 0xf: + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + { + if ( off == 0xe || off == 0xf ) + can_write = 0; + else + { + flags |= ACCESSED_DATA; + if (off == 0xd) + value &= ~PT_MSI_DATA_WR_MASK; + } + } + else + { + if ( d->msi->flags & PCI_MSI_FLAGS_PVMASK ) + flags |= ACCESSED_MASK; + else + PT_LOG("why comes to MASK without mask support??\n"); + } + break; + case 0x10 ... 0x13: + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + { + if ( d->msi->flags & PCI_MSI_FLAGS_PVMASK ) + flags |= ACCESSED_MASK; + else + PT_LOG("why comes to MASK without mask support??\n"); + } + else + can_write = 0; + break; + case 0x14 ... 0x18: + can_write = 0; + break; + default: + PT_LOG("Non MSI register!!!\n"); + break; + } + + if ( can_write ) + dev->config[cur] = value; + } + + if ( flags & ACCESSED_DATA || flags & ACCESSED_ADDR ) + pt_msi_map_update(d, old_data, old_addr); + + if ( flags & ACCESSED_MASK ) + pt_msi_mask_update(d, old_mask); + + /* This will enable physical one, do it in last step */ + if ( flags & ACCESSED_CTRL ) + pt_msi_control_update(d, old_ctrl); + + return 1; +} + +int pt_msi_read(struct pt_dev *d, int addr, int len, uint32_t *val) +{ + int e_addr = addr, e_len = len, offset = 0, i; + uint8_t e_val = 0; + PCIDevice *pd = (PCIDevice *)d; + + if ( !d || !d->msi ) + return 0; + + if ( (addr > (d->msi->offset + d->msi->size) ) || + (addr + len) <= d->msi->offset ) + return 0; + + PT_LOG("pt_msi_read addr %x len %x val %x offset %x size %x\n", + addr, len, *val, d->msi->offset, d->msi->size); + + if ( (addr + len ) > (d->msi->offset + d->msi->size) ) + e_len -= addr + len - d->msi->offset - d->msi->size; + + if ( addr < d->msi->offset ) + { + e_addr = d->msi->offset; + offset = d->msi->offset - addr; + e_len -= offset; + } + + for ( i = 0; i < e_len; i++ ) + { + e_val = *(uint8_t *)(&pd->config[e_addr] + i); + *val &= ~(0xff << ( (offset + i) * 8)); + *val |= (e_val << ( (offset + i) * 8)); + } + + return e_len; +} + diff -r a0ebceaf41ff -r ad55c06c9bbc tools/ioemu/hw/pt-msi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/ioemu/hw/pt-msi.h Thu May 01 10:33:03 2008 +0100 @@ -0,0 +1,65 @@ +#ifndef _PT_MSI_H +#define _PT_MSI_H + +#include "vl.h" +#include "pci/header.h" +#include "pci/pci.h" +#include "pass-through.h" + +#define MSI_FLAG_UNINIT 0x1000 +#define PT_MSI_MAPPED 0x2000 + +#define MSI_DATA_VECTOR_SHIFT 0 +#define MSI_DATA_VECTOR(v) (((u8)v) << MSI_DATA_VECTOR_SHIFT) + +#define MSI_DATA_DELIVERY_SHIFT 8 +#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_SHIFT) +#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_SHIFT) + +#define MSI_DATA_LEVEL_SHIFT 14 +#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT) +#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT) + +#define MSI_DATA_TRIGGER_SHIFT 15 +#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT) +#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT) + +/* + + * Shift/mask fields for APIC-based bus address + + */ + +#define MSI_ADDR_HEADER 0xfee00000 +#define MSI_TARGET_CPU_SHIFT 12 + +#define MSI_ADDR_DESTID_MASK 0xfff0000f +#define MSI_ADDR_DESTID_CPU(cpu) ((cpu) << MSI_TARGET_CPU_SHIFT) + +#define MSI_ADDR_DESTMODE_SHIFT 2 +#define MSI_ADDR_DESTMODE_PHYS (0 << MSI_ADDR_DESTMODE_SHIFT) +#define MSI_ADDR_DESTMODE_LOGIC (1 << MSI_ADDR_DESTMODE_SHIFT) + +#define MSI_ADDR_REDIRECTION_SHIFT 3 +#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT) +#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT) + +#define PCI_MSI_FLAGS_PVMASK 0x100 + +#define AUTO_ASSIGN -1 + +/* shift count for gflags */ +#define GFLAGS_SHIFT_DEST_ID 0 +#define GFLAGS_SHIFT_RH 8 +#define GFLAGS_SHIFT_DM 9 +#define GLFAGS_SHIFT_DELIV_MODE 12 +#define GLFAGS_SHIFT_TRG_MODE 15 + +int +pt_msi_init(struct pt_dev *dev, int pos); + +int +pt_msi_write(struct pt_dev *d, uint32_t addr, uint32_t val, uint32_t len); + +int +pt_msi_read(struct pt_dev *d, int addr, int len, uint32_t *val); + +#endif diff -r a0ebceaf41ff -r ad55c06c9bbc tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Thu May 01 10:32:10 2008 +0100 +++ b/tools/libxc/xc_domain.c Thu May 01 10:33:03 2008 +0100 @@ -795,6 +795,32 @@ int xc_deassign_device( return do_domctl(xc_handle, &domctl); } +int xc_domain_update_msi_irq( + int xc_handle, + uint32_t domid, + uint32_t gvec, + uint32_t pirq, + uint32_t gflags) +{ + int rc; + xen_domctl_bind_pt_irq_t *bind; + + DECLARE_DOMCTL; + + domctl.cmd = XEN_DOMCTL_bind_pt_irq; + domctl.domain = (domid_t)domid; + + bind = &(domctl.u.bind_pt_irq); + bind->hvm_domid = domid; + bind->irq_type = PT_IRQ_TYPE_MSI; + bind->machine_irq = pirq; + bind->u.msi.gvec = gvec; + bind->u.msi.gflags = gflags; + + rc = do_domctl(xc_handle, &domctl); + return rc; +} + /* Pass-through: binds machine irq to guests irq */ int xc_domain_bind_pt_irq( int xc_handle, diff -r a0ebceaf41ff -r ad55c06c9bbc tools/libxc/xc_physdev.c --- a/tools/libxc/xc_physdev.c Thu May 01 10:32:10 2008 +0100 +++ b/tools/libxc/xc_physdev.c Thu May 01 10:33:03 2008 +0100 @@ -45,6 +45,37 @@ int xc_physdev_map_pirq(int xc_handle, return rc; } +int xc_physdev_map_pirq_msi(int xc_handle, + int domid, + int type, + int index, + int *pirq, + int devfn, + int bus, + int msi_type) +{ + int rc; + struct physdev_map_pirq map; + + if ( !pirq ) + return -EINVAL; + + map.domid = domid; + map.type = type; + map.index = index; + map.pirq = *pirq; + map.msi_info.devfn = devfn; + map.msi_info.bus = bus; + map.msi_info.msi = msi_type; + + rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map); + + if ( !rc ) + *pirq = map.pirq; + + return rc; +} + int xc_physdev_unmap_pirq(int xc_handle, int domid, int pirq) @@ -59,3 +90,4 @@ int xc_physdev_unmap_pirq(int xc_handle, return rc; } + diff -r a0ebceaf41ff -r ad55c06c9bbc tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Thu May 01 10:32:10 2008 +0100 +++ b/tools/libxc/xenctrl.h Thu May 01 10:33:03 2008 +0100 @@ -856,6 +856,15 @@ int xc_physdev_map_pirq(int xc_handle, int index, int *pirq); +int xc_physdev_map_pirq_msi(int xc_handle, + int domid, + int type, + int index, + int *pirq, + int devfn, + int bus, + int msi_type); + int xc_physdev_unmap_pirq(int xc_handle, int domid, int pirq); @@ -959,6 +968,13 @@ int xc_domain_ioport_mapping(int xc_hand uint32_t first_mport, uint32_t nr_ports, uint32_t add_mapping); + +int xc_domain_update_msi_irq( + int xc_handle, + uint32_t domid, + uint32_t gvec, + uint32_t pirq, + uint32_t gflags); int xc_domain_bind_pt_irq(int xc_handle, uint32_t domid, diff -r a0ebceaf41ff -r ad55c06c9bbc xen/arch/x86/hvm/Makefile --- a/xen/arch/x86/hvm/Makefile Thu May 01 10:32:10 2008 +0100 +++ b/xen/arch/x86/hvm/Makefile Thu May 01 10:33:03 2008 +0100 @@ -16,4 +16,5 @@ obj-y += vlapic.o obj-y += vlapic.o obj-y += vpic.o obj-y += save.o +obj-y += vmsi.o obj-y += stdvga.o diff -r a0ebceaf41ff -r ad55c06c9bbc xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Thu May 01 10:32:10 2008 +0100 +++ b/xen/arch/x86/hvm/vlapic.c Thu May 01 10:33:03 2008 +0100 @@ -476,6 +476,9 @@ void vlapic_EOI_set(struct vlapic *vlapi if ( vlapic_test_and_clear_vector(vector, &vlapic->regs->data[APIC_TMR]) ) vioapic_update_EOI(vlapic_domain(vlapic), vector); + + if ( vtd_enabled ) + hvm_dpci_msi_eoi(current->domain, vector); } static int vlapic_ipi( diff -r a0ebceaf41ff -r ad55c06c9bbc xen/arch/x86/hvm/vmsi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/hvm/vmsi.c Thu May 01 10:33:03 2008 +0100 @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2001 MandrakeSoft S.A. + * + * MandrakeSoft S.A. + * 43, rue d'Aboukir + * 75002 Paris - France + * http://www.linux-mandrake.com/ + * http://www.mandrakesoft.com/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Support for virtual MSI logic + * Will be merged it with virtual IOAPIC logic, since most is the same +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static uint32_t vmsi_get_delivery_bitmask( + struct domain *d, uint16_t dest, uint8_t dest_mode) +{ + uint32_t mask = 0; + struct vcpu *v; + + HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_get_delivery_bitmask " + "dest %d dest_mode %d\n", dest, dest_mode); + + if ( dest_mode == 0 ) /* Physical mode. */ + { + if ( dest == 0xFF ) /* Broadcast. */ + { + for_each_vcpu ( d, v ) + mask |= 1 << v->vcpu_id; + goto out; + } + + for_each_vcpu ( d, v ) + { + if ( VLAPIC_ID(vcpu_vlapic(v)) == dest ) + { + mask = 1 << v->vcpu_id; + break; + } + } + } + else if ( dest != 0 ) /* Logical mode, MDA non-zero. */ + { + for_each_vcpu ( d, v ) + if ( vlapic_match_logical_addr(vcpu_vlapic(v), dest) ) + mask |= 1 << v->vcpu_id; + } + + out: + HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_get_delivery_bitmask mask %x\n", + mask); + return mask; +} + +static void vmsi_inj_irq( + struct domain *d, + struct vlapic *target, + uint8_t vector, + uint8_t trig_mode, + uint8_t delivery_mode) +{ + HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic_inj_irq " + "irq %d trig %d delive mode %d\n", + vector, trig_mode, delivery_mode); + + switch ( delivery_mode ) + { + case dest_Fixed: + case dest_LowestPrio: + if ( vlapic_set_irq(target, vector, trig_mode) ) + vcpu_kick(vlapic_vcpu(target)); + break; + default: + gdprintk(XENLOG_WARNING, "error delivery mode %d\n", delivery_mode); + break; + } +} + +#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 + +int vmsi_deliver(struct domain *d, int pirq) +{ + struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci; + uint32_t flags = hvm_irq_dpci->mirq[pirq].gmsi.gflags; + int vector = hvm_irq_dpci->mirq[pirq].gmsi.gvec; + uint16_t dest = flags & VMSI_DEST_ID_MASK; + uint8_t dest_mode = flags & VMSI_DM_MASK; + uint8_t delivery_mode = flags & VMSI_DELIV_MASK; + uint8_t trig_mode = flags & VMSI_TRIG_MODE; + uint32_t deliver_bitmask; + struct vlapic *target; + struct vcpu *v; + + HVM_DBG_LOG(DBG_LEVEL_IOAPIC, + "msi: dest=%x dest_mode=%x delivery_mode=%x " + "vector=%x trig_mode=%x\n", + dest, dest_mode, delivery_mode, vector, trig_mode); + + if ( !(hvm_irq_dpci->mirq[pirq].flags & HVM_IRQ_DPCI_MSI) ) + { + gdprintk(XENLOG_WARNING, "pirq %x not msi \n", pirq); + return 0; + } + + deliver_bitmask = vmsi_get_delivery_bitmask(d, dest, dest_mode); + if ( !deliver_bitmask ) + { + HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "ioapic deliver " + "no target on destination\n"); + return 0; + } + + switch ( delivery_mode ) + { + case dest_LowestPrio: + { + target = apic_round_robin(d, vector, deliver_bitmask); + if ( target != NULL ) + vmsi_inj_irq(d, target, vector, trig_mode, delivery_mode); + else + HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "null round robin: " + "mask=%x vector=%x delivery_mode=%x\n", + deliver_bitmask, vector, dest_LowestPrio); + break; + } + + case dest_Fixed: + case dest_ExtINT: + { + uint8_t bit; + for ( bit = 0; deliver_bitmask != 0; bit++ ) + { + if ( !(deliver_bitmask & (1 << bit)) ) + continue; + deliver_bitmask &= ~(1 << bit); + v = d->vcpu[bit]; + if ( v != NULL ) + { + target = vcpu_vlapic(v); + vmsi_inj_irq(d, target, vector, trig_mode, delivery_mode); + } + } + break; + } + + case dest_SMI: + case dest_NMI: + case dest_INIT: + case dest__reserved_2: + default: + gdprintk(XENLOG_WARNING, "Unsupported delivery mode %d\n", + delivery_mode); + break; + } + return 1; +} + diff -r a0ebceaf41ff -r ad55c06c9bbc xen/arch/x86/hvm/vmx/intr.c --- a/xen/arch/x86/hvm/vmx/intr.c Thu May 01 10:32:10 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/intr.c Thu May 01 10:33:03 2008 +0100 @@ -103,6 +103,12 @@ static void enable_intr_window(struct vc } } +extern int vmsi_deliver(struct domain *d, int pirq); +static int hvm_pci_msi_assert(struct domain *d, int pirq) +{ + return vmsi_deliver(d, pirq); +} + static void vmx_dirq_assist(struct vcpu *v) { unsigned int irq; @@ -120,6 +126,12 @@ static void vmx_dirq_assist(struct vcpu { if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) ) continue; + + if ( test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[irq].flags) ) + { + hvm_pci_msi_assert(d, irq); + continue; + } stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]); diff -r a0ebceaf41ff -r ad55c06c9bbc xen/drivers/passthrough/io.c --- a/xen/drivers/passthrough/io.c Thu May 01 10:32:10 2008 +0100 +++ b/xen/drivers/passthrough/io.c Thu May 01 10:33:03 2008 +0100 @@ -71,44 +71,59 @@ int pt_irq_create_bind_vtd( xfree(hvm_irq_dpci); } - machine_gsi = pt_irq_bind->machine_irq; - device = pt_irq_bind->u.pci.device; - intx = pt_irq_bind->u.pci.intx; - guest_gsi = hvm_pci_intx_gsi(device, intx); - link = hvm_pci_intx_link(device, intx); - hvm_irq_dpci->link_cnt[link]++; - - digl = xmalloc(struct dev_intx_gsi_link); - if ( !digl ) - return -ENOMEM; - - digl->device = device; - digl->intx = intx; - digl->gsi = guest_gsi; - digl->link = link; - list_add_tail(&digl->list, - &hvm_irq_dpci->mirq[machine_gsi].digl_list); - - hvm_irq_dpci->girq[guest_gsi].valid = 1; - hvm_irq_dpci->girq[guest_gsi].device = device; - hvm_irq_dpci->girq[guest_gsi].intx = intx; - hvm_irq_dpci->girq[guest_gsi].machine_gsi = machine_gsi; - - /* Bind the same mirq once in the same domain */ - if ( !hvm_irq_dpci->mirq[machine_gsi].valid ) - { - hvm_irq_dpci->mirq[machine_gsi].valid = 1; - hvm_irq_dpci->mirq[machine_gsi].dom = d; - - init_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, machine_gsi)], - pt_irq_time_out, &hvm_irq_dpci->mirq[machine_gsi], 0); - /* Deal with gsi for legacy devices */ - pirq_guest_bind(d->vcpu[0], machine_gsi, BIND_PIRQ__WILL_SHARE); - } - - gdprintk(XENLOG_INFO VTDPREFIX, - "VT-d irq bind: m_irq = %x device = %x intx = %x\n", - machine_gsi, device, intx); + if ( pt_irq_bind->irq_type == PT_IRQ_TYPE_MSI ) + { + int pirq = pt_irq_bind->machine_irq; + + hvm_irq_dpci->mirq[pirq].flags |= HVM_IRQ_DPCI_VALID |HVM_IRQ_DPCI_MSI ; + hvm_irq_dpci->mirq[pirq].gmsi.gvec = pt_irq_bind->u.msi.gvec; + hvm_irq_dpci->mirq[pirq].gmsi.gflags = pt_irq_bind->u.msi.gflags; + + hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] = pirq; + + pirq_guest_bind(d->vcpu[0], pirq, BIND_PIRQ__WILL_SHARE); + } + else + { + machine_gsi = pt_irq_bind->machine_irq; + device = pt_irq_bind->u.pci.device; + intx = pt_irq_bind->u.pci.intx; + guest_gsi = hvm_pci_intx_gsi(device, intx); + link = hvm_pci_intx_link(device, intx); + hvm_irq_dpci->link_cnt[link]++; + + digl = xmalloc(struct dev_intx_gsi_link); + if ( !digl ) + return -ENOMEM; + + digl->device = device; + digl->intx = intx; + digl->gsi = guest_gsi; + digl->link = link; + list_add_tail(&digl->list, + &hvm_irq_dpci->mirq[machine_gsi].digl_list); + + hvm_irq_dpci->girq[guest_gsi].valid = 1; + hvm_irq_dpci->girq[guest_gsi].device = device; + hvm_irq_dpci->girq[guest_gsi].intx = intx; + hvm_irq_dpci->girq[guest_gsi].machine_gsi = machine_gsi; + + /* Bind the same mirq once in the same domain */ + if ( !(hvm_irq_dpci->mirq[machine_gsi].flags & HVM_IRQ_DPCI_VALID) ) + { + hvm_irq_dpci->mirq[machine_gsi].flags |= HVM_IRQ_DPCI_VALID; + hvm_irq_dpci->mirq[machine_gsi].dom = d; + + init_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, machine_gsi)], + pt_irq_time_out, &hvm_irq_dpci->mirq[machine_gsi], 0); + /* Deal with gsi for legacy devices */ + pirq_guest_bind(d->vcpu[0], machine_gsi, BIND_PIRQ__WILL_SHARE); + } + + gdprintk(XENLOG_INFO VTDPREFIX, + "VT-d irq bind: m_irq = %x device = %x intx = %x\n", + machine_gsi, device, intx); + } return 0; } @@ -139,7 +154,7 @@ int pt_irq_destroy_bind_vtd( sizeof(struct hvm_girq_dpci_mapping)); /* clear the mirq info */ - if ( hvm_irq_dpci->mirq[machine_gsi].valid ) + if ( (hvm_irq_dpci->mirq[machine_gsi].flags & HVM_IRQ_DPCI_VALID) ) { list_for_each_safe ( digl_list, tmp, &hvm_irq_dpci->mirq[machine_gsi].digl_list ) @@ -161,7 +176,7 @@ int pt_irq_destroy_bind_vtd( pirq_guest_unbind(d, machine_gsi); kill_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, machine_gsi)]); hvm_irq_dpci->mirq[machine_gsi].dom = NULL; - hvm_irq_dpci->mirq[machine_gsi].valid = 0; + hvm_irq_dpci->mirq[machine_gsi].flags = 0; } } @@ -177,7 +192,7 @@ int hvm_do_IRQ_dpci(struct domain *d, un struct hvm_irq_dpci *dpci = domain_get_irq_dpci(d); if ( !iommu_enabled || (d == dom0) || !dpci || - !dpci->mirq[mirq].valid ) + !dpci->mirq[mirq].flags & HVM_IRQ_DPCI_VALID ) return 0; /* @@ -187,11 +202,28 @@ int hvm_do_IRQ_dpci(struct domain *d, un * PIC) and we need to detect that. */ set_bit(mirq, dpci->dirq_mask); - set_timer(&dpci->hvm_timer[domain_irq_to_vector(d, mirq)], - NOW() + PT_IRQ_TIME_OUT); + if ( !test_bit(_HVM_IRQ_DPCI_MSI, &dpci->mirq[mirq].flags) ) + set_timer(&dpci->hvm_timer[domain_irq_to_vector(d, mirq)], + NOW() + PT_IRQ_TIME_OUT); vcpu_kick(d->vcpu[0]); return 1; +} + + +void hvm_dpci_msi_eoi(struct domain *d, int vector) +{ + struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci; + int pirq; + + if ( !vtd_enabled || (hvm_irq_dpci == NULL) ) + return; + + pirq = hvm_irq_dpci->msi_gvec_pirq[vector]; + if ( ( pirq >= 0 ) && (pirq < NR_PIRQS) && + (hvm_irq_dpci->mirq[pirq].flags & HVM_IRQ_DPCI_VALID) && + (hvm_irq_dpci->mirq[pirq].flags & HVM_IRQ_DPCI_MSI) ) + pirq_guest_eoi(d, pirq); } void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi, diff -r a0ebceaf41ff -r ad55c06c9bbc xen/drivers/passthrough/iommu.c --- a/xen/drivers/passthrough/iommu.c Thu May 01 10:32:10 2008 +0100 +++ b/xen/drivers/passthrough/iommu.c Thu May 01 10:33:03 2008 +0100 @@ -77,7 +77,7 @@ void iommu_domain_destroy(struct domain { for ( i = 0; i < NR_IRQS; i++ ) { - if ( !hvm_irq_dpci->mirq[i].valid ) + if ( !(hvm_irq_dpci->mirq[i].flags & HVM_IRQ_DPCI_VALID) ) continue; pirq_guest_unbind(d, i); diff -r a0ebceaf41ff -r ad55c06c9bbc xen/drivers/passthrough/vtd/x86/vtd.c --- a/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 01 10:32:10 2008 +0100 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 01 10:33:03 2008 +0100 @@ -101,7 +101,7 @@ void hvm_dpci_isairq_eoi(struct domain * /* Multiple mirq may be mapped to one isa irq */ for ( i = 0; i < NR_IRQS; i++ ) { - if ( !dpci->mirq[i].valid ) + if ( !dpci->mirq[i].flags & HVM_IRQ_DPCI_VALID ) continue; list_for_each_entry_safe ( digl, tmp, diff -r a0ebceaf41ff -r ad55c06c9bbc xen/include/asm-x86/hvm/io.h --- a/xen/include/asm-x86/hvm/io.h Thu May 01 10:32:10 2008 +0100 +++ b/xen/include/asm-x86/hvm/io.h Thu May 01 10:33:03 2008 +0100 @@ -120,5 +120,6 @@ void stdvga_init(struct domain *d); void stdvga_init(struct domain *d); void stdvga_deinit(struct domain *d); +extern void hvm_dpci_msi_eoi(struct domain *d, int vector); #endif /* __ASM_X86_HVM_IO_H__ */ diff -r a0ebceaf41ff -r ad55c06c9bbc xen/include/asm-x86/hvm/irq.h --- a/xen/include/asm-x86/hvm/irq.h Thu May 01 10:32:10 2008 +0100 +++ b/xen/include/asm-x86/hvm/irq.h Thu May 01 10:33:03 2008 +0100 @@ -38,11 +38,21 @@ struct dev_intx_gsi_link { uint8_t link; }; +#define HVM_IRQ_DPCI_VALID 0x1 +#define HVM_IRQ_DPCI_MSI 0x2 +#define _HVM_IRQ_DPCI_MSI 0x1 + +struct hvm_gmsi_info { + uint32_t gvec; + uint32_t gflags; +}; + struct hvm_mirq_dpci_mapping { - uint8_t valid; + uint32_t flags; int pending; struct list_head digl_list; struct domain *dom; + struct hvm_gmsi_info gmsi; }; struct hvm_girq_dpci_mapping { @@ -60,6 +70,7 @@ struct hvm_irq_dpci { struct hvm_mirq_dpci_mapping mirq[NR_IRQS]; /* Guest IRQ to guest device/intx mapping. */ struct hvm_girq_dpci_mapping girq[NR_IRQS]; + uint8_t msi_gvec_pirq[NR_VECTORS]; DECLARE_BITMAP(dirq_mask, NR_IRQS); /* Record of mapped ISA IRQs */ DECLARE_BITMAP(isairq_map, NR_ISAIRQS); diff -r a0ebceaf41ff -r ad55c06c9bbc xen/include/public/domctl.h --- a/xen/include/public/domctl.h Thu May 01 10:32:10 2008 +0100 +++ b/xen/include/public/domctl.h Thu May 01 10:33:03 2008 +0100 @@ -454,7 +454,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_assig #define XEN_DOMCTL_unbind_pt_irq 48 typedef enum pt_irq_type_e { PT_IRQ_TYPE_PCI, - PT_IRQ_TYPE_ISA + PT_IRQ_TYPE_ISA, + PT_IRQ_TYPE_MSI, } pt_irq_type_t; struct xen_domctl_bind_pt_irq { uint32_t machine_irq; @@ -470,6 +471,10 @@ struct xen_domctl_bind_pt_irq { uint8_t device; uint8_t intx; } pci; + struct { + uint8_t gvec; + uint32_t gflags; + } msi; } u; }; typedef struct xen_domctl_bind_pt_irq xen_domctl_bind_pt_irq_t; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:05 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:05 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3s-0004OR-QB for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:05 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4P-0003jo-Al; Thu, 01 May 2008 14:47:37 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWD2-0000Mp-Io for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:16 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCf-0000Pi-6l for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:14 +0000 X-SBRS: 3.6 X-MesageID: 107384 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107384" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 05:59:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xw6m010640 for ; Thu, 1 May 2008 02:59:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0G2V015376 for ; Thu, 1 May 2008 03:00:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0GwP015375 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:16 -0700 Message-Id: <200805011000.m41A0GwP015375@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] MSI 2/6: change the pirq to be per-domain X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634222 -3600 # Node ID 6ecbb00e58cd891fb3c26455bb096ed5fec0b0aa # Parent 8bced3d8a90756540df18c356b9f1d66acac2b87 MSI 2/6: change the pirq to be per-domain Signed-off-by: Jiang Yunhong Signed-off-by: Shan Haitao --- tools/ioemu/hw/pass-through.c | 14 + tools/libxc/xc_physdev.c | 40 ++++ tools/libxc/xc_private.h | 30 +++ tools/libxc/xenctrl.h | 11 + tools/python/xen/lowlevel/xc/xc.c | 29 +++ tools/python/xen/xend/server/irqif.py | 7 tools/python/xen/xend/server/pciif.py | 6 xen/arch/x86/domain.c | 2 xen/arch/x86/hvm/vmx/intr.c | 4 xen/arch/x86/io_apic.c | 19 ++ xen/arch/x86/irq.c | 29 +-- xen/arch/x86/physdev.c | 302 +++++++++++++++++++++++++++++++++- xen/drivers/passthrough/io.c | 12 - xen/drivers/passthrough/vtd/x86/vtd.c | 2 xen/include/asm-x86/domain.h | 5 xen/include/asm-x86/irq.h | 6 xen/include/asm-x86/pirq.h | 11 + xen/include/public/physdev.h | 27 +++ 18 files changed, 530 insertions(+), 26 deletions(-) diff -r 8bced3d8a907 -r 6ecbb00e58cd tools/ioemu/hw/pass-through.c --- a/tools/ioemu/hw/pass-through.c Thu May 01 10:26:58 2008 +0100 +++ b/tools/ioemu/hw/pass-through.c Thu May 01 10:30:22 2008 +0100 @@ -519,7 +519,21 @@ struct pt_dev * register_real_device(PCI e_intx = assigned_device->dev.config[0x3d]-1; if ( PT_MACHINE_IRQ_AUTO == machine_irq ) + { + int pirq = pci_dev->irq; + machine_irq = pci_dev->irq; + rc = xc_physdev_map_pirq(xc_handle, domid, MAP_PIRQ_TYPE_GSI, + machine_irq, &pirq); + + if ( rc ) + { + /* TBD: unregister device in case of an error */ + PT_LOG("Error: Mapping irq failed, rc = %d\n", rc); + } + else + machine_irq = pirq; + } /* bind machine_irq to device */ if ( 0 != machine_irq ) diff -r 8bced3d8a907 -r 6ecbb00e58cd tools/libxc/xc_physdev.c --- a/tools/libxc/xc_physdev.c Thu May 01 10:26:58 2008 +0100 +++ b/tools/libxc/xc_physdev.c Thu May 01 10:30:22 2008 +0100 @@ -19,3 +19,43 @@ int xc_physdev_pci_access_modify(int xc_ errno = ENOSYS; return -1; } + +int xc_physdev_map_pirq(int xc_handle, + int domid, + int type, + int index, + int *pirq) +{ + int rc; + struct physdev_map_pirq map; + + if ( !pirq ) + return -EINVAL; + + map.domid = domid; + map.type = type; + map.index = index; + map.pirq = *pirq; + + rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map); + + if ( !rc ) + *pirq = map.pirq; + + return rc; +} + +int xc_physdev_unmap_pirq(int xc_handle, + int domid, + int pirq) +{ + int rc; + struct physdev_unmap_pirq unmap; + + unmap.domid = domid; + unmap.pirq = pirq; + + rc = do_physdev_op(xc_handle, PHYSDEVOP_unmap_pirq, &unmap); + + return rc; +} diff -r 8bced3d8a907 -r 6ecbb00e58cd tools/libxc/xc_private.h --- a/tools/libxc/xc_private.h Thu May 01 10:26:58 2008 +0100 +++ b/tools/libxc/xc_private.h Thu May 01 10:30:22 2008 +0100 @@ -24,10 +24,12 @@ #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall = { 0 } #define DECLARE_DOMCTL struct xen_domctl domctl = { 0 } #define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 } +#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op = { 0 } #else #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall #define DECLARE_DOMCTL struct xen_domctl domctl #define DECLARE_SYSCTL struct xen_sysctl sysctl +#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op #endif #undef PAGE_SHIFT @@ -94,6 +96,34 @@ static inline int do_xen_version(int xc_ hypercall.arg[1] = (unsigned long) dest; return do_xen_hypercall(xc_handle, &hypercall); +} + +static inline int do_physdev_op(int xc_handle, int cmd, void *op) +{ + int ret = -1; + + DECLARE_HYPERCALL; + hypercall.op = __HYPERVISOR_physdev_op; + hypercall.arg[0] = (unsigned long) cmd; + hypercall.arg[1] = (unsigned long) op; + + if ( lock_pages(op, sizeof(*op)) != 0 ) + { + PERROR("Could not lock memory for Xen hypercall"); + goto out1; + } + + if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 ) + { + if ( errno == EACCES ) + DPRINTF("physdev operation failed -- need to" + " rebuild the user-space tool set?\n"); + } + + unlock_pages(op, sizeof(*op)); + +out1: + return ret; } static inline int do_domctl(int xc_handle, struct xen_domctl *domctl) diff -r 8bced3d8a907 -r 6ecbb00e58cd tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Thu May 01 10:26:58 2008 +0100 +++ b/tools/libxc/xenctrl.h Thu May 01 10:30:22 2008 +0100 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -849,6 +850,16 @@ int xc_gnttab_set_max_grants(int xcg_han int xc_gnttab_set_max_grants(int xcg_handle, uint32_t count); +int xc_physdev_map_pirq(int xc_handle, + int domid, + int type, + int index, + int *pirq); + +int xc_physdev_unmap_pirq(int xc_handle, + int domid, + int pirq); + int xc_hvm_set_pci_intx_level( int xc_handle, domid_t dom, uint8_t domain, uint8_t bus, uint8_t device, uint8_t intx, diff -r 8bced3d8a907 -r 6ecbb00e58cd tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Thu May 01 10:26:58 2008 +0100 +++ b/tools/python/xen/lowlevel/xc/xc.c Thu May 01 10:30:22 2008 +0100 @@ -799,6 +799,26 @@ static PyObject *pyxc_evtchn_reset(XcObj return zero; } +static PyObject *pyxc_physdev_map_pirq(PyObject *self, + PyObject *args, + PyObject *kwds) +{ + XcObject *xc = (XcObject *)self; + uint32_t dom; + int index, pirq, ret; + + static char *kwd_list[] = {"domid", "index", "pirq", NULL}; + + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list, + &dom, &index, &pirq) ) + return NULL; + ret = xc_physdev_map_pirq(xc->xc_handle, dom, MAP_PIRQ_TYPE_GSI, + index, &pirq); + if ( ret != 0 ) + return pyxc_error_to_exception(); + return PyLong_FromUnsignedLong(pirq); +} + static PyObject *pyxc_physdev_pci_access_modify(XcObject *self, PyObject *args, PyObject *kwds) @@ -1588,6 +1608,15 @@ static PyMethodDef pyxc_methods[] = { METH_VARARGS | METH_KEYWORDS, "\n" "Reset all connections.\n" " dom [int]: Domain to reset.\n" }, + + { "physdev_map_pirq", + (PyCFunction)pyxc_physdev_map_pirq, + METH_VARARGS | METH_KEYWORDS, "\n" + "map physical irq to guest pirq.\n" + " dom [int]: Identifier of domain to map for.\n" + " index [int]: physical irq.\n" + " pirq [int]: guest pirq.\n" + "Returns: [long] value of the param.\n" }, { "physdev_pci_access_modify", (PyCFunction)pyxc_physdev_pci_access_modify, diff -r 8bced3d8a907 -r 6ecbb00e58cd tools/python/xen/xend/server/irqif.py --- a/tools/python/xen/xend/server/irqif.py Thu May 01 10:26:58 2008 +0100 +++ b/tools/python/xen/xend/server/irqif.py Thu May 01 10:30:22 2008 +0100 @@ -69,5 +69,10 @@ class IRQController(DevController): #todo non-fatal raise VmError( 'irq: Failed to configure irq: %d' % (pirq)) - + rc = xc.physdev_map_pirq(domid = self.getDomid(), + index = pirq, + pirq = pirq) + if rc < 0: + raise VmError( + 'irq: Failed to map irq %x' % (pirq)) return (None, {}, {}) diff -r 8bced3d8a907 -r 6ecbb00e58cd tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Thu May 01 10:26:58 2008 +0100 +++ b/tools/python/xen/xend/server/pciif.py Thu May 01 10:30:22 2008 +0100 @@ -270,6 +270,12 @@ class PciController(DevController): allow_access = True) if rc<0: raise VmError(('pci: failed to configure I/O memory on device '+ + '%s - errno=%d')%(dev.name,rc)) + rc = xc.physdev_map_pirq(domid = fe_domid, + index = dev.irq, + pirq = dev.irq) + if rc < 0: + raise VmError(('pci: failed to map irq on device '+ '%s - errno=%d')%(dev.name,rc)) if dev.irq>0: diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Thu May 01 10:26:58 2008 +0100 +++ b/xen/arch/x86/domain.c Thu May 01 10:30:22 2008 +0100 @@ -525,6 +525,8 @@ int arch_domain_create(struct domain *d, goto fail; } + spin_lock_init(&d->arch.irq_lock); + if ( is_hvm_domain(d) ) { if ( (rc = hvm_domain_initialise(d)) != 0 ) diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/arch/x86/hvm/vmx/intr.c --- a/xen/arch/x86/hvm/vmx/intr.c Thu May 01 10:26:58 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/intr.c Thu May 01 10:30:22 2008 +0100 @@ -121,7 +121,7 @@ static void vmx_dirq_assist(struct vcpu if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) ) continue; - stop_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(irq)]); + stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]); list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list ) { @@ -140,7 +140,7 @@ static void vmx_dirq_assist(struct vcpu * guest will never deal with the irq, then the physical interrupt line * will never be deasserted. */ - set_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(irq)], + set_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)], NOW() + PT_IRQ_TIME_OUT); } } diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/arch/x86/io_apic.c --- a/xen/arch/x86/io_apic.c Thu May 01 10:26:58 2008 +0100 +++ b/xen/arch/x86/io_apic.c Thu May 01 10:30:22 2008 +0100 @@ -40,6 +40,25 @@ int (*ioapic_renumber_irq)(int ioapic, int irq); atomic_t irq_mis_count; + +int msi_irq_enable = 0; +boolean_param("msi_irq_enable", msi_irq_enable); + +int domain_irq_to_vector(struct domain *d, int irq) +{ + if ( !msi_irq_enable ) + return irq_to_vector(irq); + else + return d->arch.pirq_vector[irq]; +} + +int domain_vector_to_irq(struct domain *d, int vector) +{ + if ( !msi_irq_enable ) + return vector_to_irq(vector); + else + return d->arch.vector_pirq[vector]; +} /* Where if anywhere is the i8259 connect in external int mode */ static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Thu May 01 10:26:58 2008 +0100 +++ b/xen/arch/x86/irq.c Thu May 01 10:30:22 2008 +0100 @@ -203,7 +203,6 @@ static DEFINE_PER_CPU(struct pending_eoi static void __do_IRQ_guest(int vector) { - unsigned int irq = vector_to_irq(vector); irq_desc_t *desc = &irq_desc[vector]; irq_guest_action_t *action = (irq_guest_action_t *)desc->action; struct domain *d; @@ -232,7 +231,9 @@ static void __do_IRQ_guest(int vector) for ( i = 0; i < action->nr_guests; i++ ) { + unsigned int irq; d = action->guest[i]; + irq = domain_vector_to_irq(d, vector); if ( (action->ack_type != ACKTYPE_NONE) && !test_and_set_bit(irq, d->pirq_mask) ) action->in_flight++; @@ -305,8 +306,10 @@ static void __pirq_guest_eoi(struct doma irq_desc_t *desc; irq_guest_action_t *action; cpumask_t cpu_eoi_map; - - desc = &irq_desc[irq_to_vector(irq)]; + int vector; + + vector = domain_irq_to_vector(d, irq); + desc = &irq_desc[vector]; action = (irq_guest_action_t *)desc->action; spin_lock_irq(&desc->lock); @@ -324,7 +327,7 @@ static void __pirq_guest_eoi(struct doma if ( action->ack_type == ACKTYPE_UNMASK ) { ASSERT(cpus_empty(action->cpu_eoi_map)); - desc->handler->end(irq_to_vector(irq)); + desc->handler->end(vector); spin_unlock_irq(&desc->lock); return; } @@ -375,12 +378,12 @@ int pirq_guest_unmask(struct domain *d) } extern int ioapic_ack_new; -int pirq_acktype(int irq) +int pirq_acktype(struct domain *d, int irq) { irq_desc_t *desc; unsigned int vector; - vector = irq_to_vector(irq); + vector = domain_irq_to_vector(d, irq); if ( vector == 0 ) return ACKTYPE_NONE; @@ -421,7 +424,7 @@ int pirq_acktype(int irq) return 0; } -int pirq_shared(int irq) +int pirq_shared(struct domain *d, int irq) { unsigned int vector; irq_desc_t *desc; @@ -429,7 +432,7 @@ int pirq_shared(int irq) unsigned long flags; int shared; - vector = irq_to_vector(irq); + vector = domain_irq_to_vector(d, irq); if ( vector == 0 ) return 0; @@ -453,7 +456,7 @@ int pirq_guest_bind(struct vcpu *v, int cpumask_t cpumask = CPU_MASK_NONE; retry: - vector = irq_to_vector(irq); + vector = domain_irq_to_vector(v->domain, irq); if ( vector == 0 ) return -EINVAL; @@ -487,7 +490,7 @@ int pirq_guest_bind(struct vcpu *v, int action->nr_guests = 0; action->in_flight = 0; action->shareable = will_share; - action->ack_type = pirq_acktype(irq); + action->ack_type = pirq_acktype(v->domain, irq); cpus_clear(action->cpu_eoi_map); desc->depth = 0; @@ -538,13 +541,15 @@ int pirq_guest_bind(struct vcpu *v, int int pirq_guest_unbind(struct domain *d, int irq) { - unsigned int vector = irq_to_vector(irq); - irq_desc_t *desc = &irq_desc[vector]; + unsigned int vector; + irq_desc_t *desc; irq_guest_action_t *action; cpumask_t cpu_eoi_map; unsigned long flags; int i; + vector = domain_irq_to_vector(d, irq); + desc = &irq_desc[vector]; BUG_ON(vector == 0); spin_lock_irqsave(&desc->lock, flags); diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/arch/x86/physdev.c --- a/xen/arch/x86/physdev.c Thu May 01 10:26:58 2008 +0100 +++ b/xen/arch/x86/physdev.c Thu May 01 10:30:22 2008 +0100 @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -24,6 +25,263 @@ ioapic_guest_write( ioapic_guest_write( unsigned long physbase, unsigned int reg, u32 pval); +static int get_free_pirq(struct domain *d, int type, int index) +{ + int i; + + if ( d == NULL ) + return -EINVAL; + + ASSERT(spin_is_locked(&d->arch.irq_lock)); + + if ( type == MAP_PIRQ_TYPE_GSI ) + { + for ( i = 16; i < NR_PIRQS; i++ ) + if ( !d->arch.pirq_vector[i] ) + break; + if ( i == NR_PIRQS ) + return -ENOSPC; + } + else + { + for ( i = NR_PIRQS - 1; i >= 16; i-- ) + if ( !d->arch.pirq_vector[i] ) + break; + if ( i == 16 ) + return -ENOSPC; + } + + return i; +} + +/* + * Caller hold the irq_lock + */ +static int map_domain_pirq(struct domain *d, int pirq, int vector, int type) +{ + int ret = 0; + int old_vector, old_pirq; + + if ( d == NULL ) + return -EINVAL; + + ASSERT(spin_is_locked(&d->arch.irq_lock)); + + if ( !IS_PRIV(current->domain) ) + return -EPERM; + + if ( pirq < 0 || pirq >= NR_PIRQS || vector < 0 || vector >= NR_VECTORS ) + { + gdprintk(XENLOG_G_ERR, + "invalid pirq %x or vector %x\n", pirq, vector); + return -EINVAL; + } + + old_vector = d->arch.pirq_vector[pirq]; + old_pirq = d->arch.vector_pirq[vector]; + + if ( (old_vector && (old_vector != vector) ) || + (old_pirq && (old_pirq != pirq)) ) + { + gdprintk(XENLOG_G_ERR, "remap pirq %x vector %x while not unmap\n", + pirq, vector); + ret = -EINVAL; + goto done; + } + + ret = irq_permit_access(d, pirq); + if ( ret ) + { + gdprintk(XENLOG_G_ERR, "add irq permit access %x failed\n", pirq); + ret = -EINVAL; + goto done; + } + + d->arch.pirq_vector[pirq] = vector; + d->arch.vector_pirq[vector] = pirq; + +done: + return ret; +} + +/* + * The pirq should has been unbound before this call + */ +static int unmap_domain_pirq(struct domain *d, int pirq) +{ + int ret = 0; + int vector; + + if ( d == NULL || pirq < 0 || pirq > NR_PIRQS ) + return -EINVAL; + + if ( !IS_PRIV(current->domain) ) + return -EINVAL; + + ASSERT(spin_is_locked(&d->arch.irq_lock)); + + vector = d->arch.pirq_vector[pirq]; + + if ( !vector ) + { + gdprintk(XENLOG_G_ERR, "domain %X: pirq %x not mapped still\n", + d->domain_id, pirq); + ret = -EINVAL; + } + else + d->arch.pirq_vector[pirq] = d->arch.vector_pirq[vector] = 0; + ret = irq_deny_access(d, pirq); + + if ( ret ) + gdprintk(XENLOG_G_ERR, "deny irq %x access failed\n", pirq); + + return ret; +} + +extern int msi_irq_enable; +static int physdev_map_pirq(struct physdev_map_pirq *map) +{ + struct domain *d; + int vector, pirq, ret = 0; + unsigned long flags; + + /* if msi_irq_enable is not enabled,map always success */ + if ( !msi_irq_enable ) + return 0; + + if ( !IS_PRIV(current->domain) ) + return -EPERM; + + if ( !map ) + return -EINVAL; + + if ( map->domid == DOMID_SELF ) + d = rcu_lock_domain(current->domain); + else + d = rcu_lock_domain_by_id(map->domid); + + if ( d == NULL ) + { + ret = -ESRCH; + goto free_domain; + } + + switch ( map->type ) + { + case MAP_PIRQ_TYPE_GSI: + if ( map->index >= NR_IRQS ) + { + ret = -EINVAL; + gdprintk(XENLOG_G_ERR, + "map invalid irq %x\n", map->index); + goto free_domain; + } + vector = IO_APIC_VECTOR(map->index); + if ( !vector ) + { + ret = -EINVAL; + gdprintk(XENLOG_G_ERR, + "map irq with no vector %x\n", map->index); + goto free_domain; + } + break; + case MAP_PIRQ_TYPE_MSI: + vector = map->index; + if ( vector < 0 || vector >= NR_VECTORS ) + { + ret = -EINVAL; + gdprintk(XENLOG_G_ERR, + "map_pirq with wrong vector %x\n", map->index); + goto free_domain; + } + break; + default: + ret = -EINVAL; + gdprintk(XENLOG_G_ERR, "wrong map_pirq type %x\n", map->type); + goto free_domain; + break; + } + + spin_lock_irqsave(&d->arch.irq_lock, flags); + if ( map->pirq == -1 ) + { + if ( d->arch.vector_pirq[vector] ) + { + gdprintk(XENLOG_G_ERR, "%x %x mapped already%x\n", + map->index, map->pirq, + d->arch.vector_pirq[vector]); + pirq = d->arch.vector_pirq[vector]; + } + else + { + pirq = get_free_pirq(d, map->type, map->index); + if ( pirq < 0 ) + { + ret = pirq; + gdprintk(XENLOG_G_ERR, "No free pirq\n"); + goto done; + } + } + } + else + { + if ( d->arch.vector_pirq[vector] && + d->arch.vector_pirq[vector] != map->pirq ) + { + gdprintk(XENLOG_G_ERR, "%x conflict with %x\n", + map->index, map->pirq); + ret = -EEXIST; + goto done; + } + else + pirq = map->pirq; + } + + ret = map_domain_pirq(d, pirq, vector, map->type); + + if ( !ret ) + map->pirq = pirq; +done: + spin_unlock_irqrestore(&d->arch.irq_lock, flags); +free_domain: + rcu_unlock_domain(d); + return ret; +} + +static int physdev_unmap_pirq(struct physdev_unmap_pirq *unmap) +{ + struct domain *d; + unsigned long flags; + int ret; + + if ( !msi_irq_enable ) + return 0; + + if ( !IS_PRIV(current->domain) ) + return -EPERM; + + if ( !unmap ) + return -EINVAL; + + if ( unmap->domid == DOMID_SELF ) + d = rcu_lock_domain(current->domain); + else + d = rcu_lock_domain_by_id(unmap->domid); + + if ( d == NULL ) + { + rcu_unlock_domain(d); + return -ESRCH; + } + + spin_lock_irqsave(&d->arch.irq_lock, flags); + ret = unmap_domain_pirq(d, unmap->pirq); + spin_unlock_irqrestore(&d->arch.irq_lock, flags); + rcu_unlock_domain(d); + + return ret; +} + ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg) { int irq; @@ -57,11 +315,35 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H if ( (irq < 0) || (irq >= NR_IRQS) ) break; irq_status_query.flags = 0; - if ( pirq_acktype(irq) != 0 ) + if ( pirq_acktype(v->domain, irq) != 0 ) irq_status_query.flags |= XENIRQSTAT_needs_eoi; - if ( pirq_shared(irq) ) + if ( pirq_shared(v->domain, irq) ) irq_status_query.flags |= XENIRQSTAT_shared; ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0; + break; + } + + case PHYSDEVOP_map_pirq: { + struct physdev_map_pirq map; + + ret = -EFAULT; + if ( copy_from_guest(&map, arg, 1) != 0 ) + break; + + ret = physdev_map_pirq(&map); + if ( copy_to_guest(arg, &map, 1) != 0 ) + ret = -EFAULT; + break; + } + + case PHYSDEVOP_unmap_pirq: { + struct physdev_unmap_pirq unmap; + + ret = -EFAULT; + if ( copy_from_guest(&unmap, arg, 1) != 0 ) + break; + + ret = physdev_unmap_pirq(&unmap); break; } @@ -99,6 +381,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H case PHYSDEVOP_alloc_irq_vector: { struct physdev_irq irq_op; + unsigned long flags; ret = -EFAULT; if ( copy_from_guest(&irq_op, arg, 1) != 0 ) @@ -118,7 +401,20 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H break; irq_op.vector = assign_irq_vector(irq); - ret = copy_to_guest(arg, &irq_op, 1) ? -EFAULT : 0; + + ret = 0; + + if ( msi_irq_enable ) + { + spin_lock_irqsave(&dom0->arch.irq_lock, flags); + if ( irq != AUTO_ASSIGN ) + ret = map_domain_pirq(dom0, irq_op.irq, irq_op.vector, + MAP_PIRQ_TYPE_GSI); + spin_unlock_irqrestore(&dom0->arch.irq_lock, flags); + } + + if ( copy_to_guest(arg, &irq_op, 1) != 0 ) + ret = -EFAULT; break; } diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/drivers/passthrough/io.c --- a/xen/drivers/passthrough/io.c Thu May 01 10:26:58 2008 +0100 +++ b/xen/drivers/passthrough/io.c Thu May 01 10:30:22 2008 +0100 @@ -25,6 +25,7 @@ static void pt_irq_time_out(void *data) { struct hvm_mirq_dpci_mapping *irq_map = data; unsigned int guest_gsi, machine_gsi = 0; + int vector; struct hvm_irq_dpci *dpci = domain_get_irq_dpci(irq_map->dom); struct dev_intx_gsi_link *digl; uint32_t device, intx; @@ -39,7 +40,8 @@ static void pt_irq_time_out(void *data) } clear_bit(machine_gsi, dpci->dirq_mask); - stop_timer(&dpci->hvm_timer[irq_to_vector(machine_gsi)]); + vector = domain_irq_to_vector(irq_map->dom, machine_gsi); + stop_timer(&dpci->hvm_timer[vector]); spin_lock(&dpci->dirq_lock); dpci->mirq[machine_gsi].pending = 0; spin_unlock(&dpci->dirq_lock); @@ -98,7 +100,7 @@ int pt_irq_create_bind_vtd( hvm_irq_dpci->mirq[machine_gsi].valid = 1; hvm_irq_dpci->mirq[machine_gsi].dom = d; - init_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(machine_gsi)], + init_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, machine_gsi)], pt_irq_time_out, &hvm_irq_dpci->mirq[machine_gsi], 0); /* Deal with gsi for legacy devices */ pirq_guest_bind(d->vcpu[0], machine_gsi, BIND_PIRQ__WILL_SHARE); @@ -157,7 +159,7 @@ int pt_irq_destroy_bind_vtd( if ( list_empty(&hvm_irq_dpci->mirq[machine_gsi].digl_list) ) { pirq_guest_unbind(d, machine_gsi); - kill_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(machine_gsi)]); + kill_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, machine_gsi)]); hvm_irq_dpci->mirq[machine_gsi].dom = NULL; hvm_irq_dpci->mirq[machine_gsi].valid = 0; } @@ -185,7 +187,7 @@ int hvm_do_IRQ_dpci(struct domain *d, un * PIC) and we need to detect that. */ set_bit(mirq, dpci->dirq_mask); - set_timer(&dpci->hvm_timer[irq_to_vector(mirq)], + set_timer(&dpci->hvm_timer[domain_irq_to_vector(d, mirq)], NOW() + PT_IRQ_TIME_OUT); vcpu_kick(d->vcpu[0]); @@ -221,7 +223,7 @@ void hvm_dpci_eoi(struct domain *d, unsi gdprintk(XENLOG_INFO VTDPREFIX, "hvm_dpci_eoi:: mirq = %x\n", machine_gsi); - stop_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(machine_gsi)]); + stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, machine_gsi)]); if ( (ent == NULL) || !ent->fields.mask ) pirq_guest_eoi(d, machine_gsi); } diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/drivers/passthrough/vtd/x86/vtd.c --- a/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 01 10:26:58 2008 +0100 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 01 10:30:22 2008 +0100 @@ -114,7 +114,7 @@ void hvm_dpci_isairq_eoi(struct domain * if ( --dpci->mirq[i].pending == 0 ) { spin_unlock(&dpci->dirq_lock); - stop_timer(&dpci->hvm_timer[irq_to_vector(i)]); + stop_timer(&dpci->hvm_timer[domain_irq_to_vector(d, i)]); pirq_guest_eoi(d, i); } else diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/include/asm-x86/domain.h --- a/xen/include/asm-x86/domain.h Thu May 01 10:26:58 2008 +0100 +++ b/xen/include/asm-x86/domain.h Thu May 01 10:30:22 2008 +0100 @@ -6,6 +6,7 @@ #include #include #include +#include #define has_32bit_shinfo(d) ((d)->arch.has_32bit_shinfo) #define is_pv_32bit_domain(d) ((d)->arch.is_32bit_pv) @@ -221,6 +222,10 @@ struct arch_domain /* Shadow translated domain: P2M mapping */ pagetable_t phys_table; + + spinlock_t irq_lock; + int vector_pirq[NR_VECTORS]; + int pirq_vector[NR_PIRQS]; /* Pseudophysical e820 map (XENMEM_memory_map). */ struct e820entry e820[3]; diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/include/asm-x86/irq.h --- a/xen/include/asm-x86/irq.h Thu May 01 10:26:58 2008 +0100 +++ b/xen/include/asm-x86/irq.h Thu May 01 10:30:22 2008 +0100 @@ -49,7 +49,9 @@ extern atomic_t irq_err_count; extern atomic_t irq_err_count; extern atomic_t irq_mis_count; -int pirq_acktype(int irq); -int pirq_shared(int irq); +int pirq_acktype(struct domain *d, int irq); +int pirq_shared(struct domain *d , int irq); +extern int domain_irq_to_vector(struct domain *d, int irq); +extern int domain_vector_to_irq(struct domain *d, int vector); #endif /* _ASM_HW_IRQ_H */ diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/include/asm-x86/pirq.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/include/asm-x86/pirq.h Thu May 01 10:30:22 2008 +0100 @@ -0,0 +1,11 @@ +#ifndef __XEN_PIRQ_H +#define __XEN_PIRQ_H + +#define PIRQ_BASE 0 +#define NR_PIRQS 256 + +#define DYNIRQ_BASE (PIRQ_BASE + NR_PIRQS) +#define NR_DYNIRQS 256 + +#endif /* __XEN_PIRQ_H */ + diff -r 8bced3d8a907 -r 6ecbb00e58cd xen/include/public/physdev.h --- a/xen/include/public/physdev.h Thu May 01 10:26:58 2008 +0100 +++ b/xen/include/public/physdev.h Thu May 01 10:30:22 2008 +0100 @@ -121,6 +121,33 @@ struct physdev_irq { }; typedef struct physdev_irq physdev_irq_t; DEFINE_XEN_GUEST_HANDLE(physdev_irq_t); + +#define MAP_PIRQ_TYPE_MSI 0x0 +#define MAP_PIRQ_TYPE_GSI 0x1 +#define MAP_PIRQ_TYPE_UNKNOWN 0x2 + +#define PHYSDEVOP_map_pirq 13 +struct physdev_map_pirq { + domid_t domid; + /* IN */ + int type; + /* IN */ + int index; + /* IN or OUT */ + int pirq; +}; +typedef struct physdev_map_pirq physdev_map_pirq_t; +DEFINE_XEN_GUEST_HANDLE(physdev_map_pirq_t); + +#define PHYSDEVOP_unmap_pirq 14 +struct physdev_unmap_pirq { + domid_t domid; + /* IN */ + int pirq; +}; + +typedef struct physdev_unmap_pirq physdev_unmap_pirq_t; +DEFINE_XEN_GUEST_HANDLE(physdev_unmap_pirq_t); /* * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op() _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3u-0004OS-Hl for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4R-0003nE-8d; Thu, 01 May 2008 14:47:39 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWD4-0000Mx-Jy for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:18 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCw-0000PT-B6 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:16 +0000 X-SBRS: 3.6 X-MesageID: 107389 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107389" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:05 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A051E010655 for ; Thu, 1 May 2008 03:00:05 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0MRt015469 for ; Thu, 1 May 2008 03:00:22 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0Msn015468 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:22 -0700 Message-Id: <200805011000.m41A0Msn015468@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:21 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add option "xen_processor_pm" in xen to enable dom0 external Cx control. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634858 -3600 # Node ID 74cae5c11f0a2fb81212b52b7a7b38b599fe2ac2 # Parent 5bb9093eb0e9abfcf8537148ba088fd2604e5737 Add option "xen_processor_pm" in xen to enable dom0 external Cx control. Signed-off-by: Wei Gang --- xen/arch/x86/setup.c | 7 +++++++ 1 files changed, 7 insertions(+) diff -r 5bb9093eb0e9 -r 74cae5c11f0a xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Thu May 01 10:40:01 2008 +0100 +++ b/xen/arch/x86/setup.c Thu May 01 10:40:58 2008 +0100 @@ -93,6 +93,11 @@ boolean_param("acpi_skip_timer_override" /* noapic: Disable IOAPIC setup. */ extern int skip_ioapic_setup; boolean_param("noapic", skip_ioapic_setup); + +/* **** Linux config option: propagated to domain0. */ +/* xen_processor_pm: xen control cstate. */ +static int xen_processor_pm; +boolean_param("xen_processor_pm", xen_processor_pm); int early_boot = 1; @@ -1008,6 +1013,8 @@ void __init __start_xen(unsigned long mb safe_strcat(dom0_cmdline, " acpi="); safe_strcat(dom0_cmdline, acpi_param); } + if ( xen_processor_pm && !strstr(dom0_cmdline, "xen_processor_pmbits=") ) + safe_strcat(dom0_cmdline, " xen_processor_pmbits=1"); cmdline = dom0_cmdline; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:11 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:11 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra3y-0004Ob-Ed for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:11 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4V-0003rD-4u; Thu, 01 May 2008 14:47:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWD6-0000Mz-JW for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:20 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCj-0000P1-Oq for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:18 +0000 X-SBRS: 3.6 X-MesageID: 107385 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107385" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:00 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m419xxKW010643 for ; Thu, 1 May 2008 02:59:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0HiL015393 for ; Thu, 1 May 2008 03:00:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0HtP015392 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:17 -0700 Message-Id: <200805011000.m41A0HtP015392@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] MSI 3/6: add msi support to xen X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634289 -3600 # Node ID 86c0353f19d03ec79d352074a54d94863d2dac4c # Parent 6ecbb00e58cd891fb3c26455bb096ed5fec0b0aa MSI 3/6: add msi support to xen Signed-off-by: Jiang Yunhong Signed-off-by: Shan Haitao --- xen/drivers/passthrough/vtd/msi.h | 127 ---- xen/arch/x86/Makefile | 1 xen/arch/x86/i8259.c | 7 xen/arch/x86/io_apic.c | 58 + xen/arch/x86/irq.c | 4 xen/arch/x86/msi.c | 787 +++++++++++++++++++++++++++ xen/arch/x86/physdev.c | 60 +- xen/drivers/passthrough/amd/iommu_init.c | 3 xen/drivers/passthrough/vtd/intremap.c | 2 xen/drivers/passthrough/vtd/iommu.c | 2 xen/drivers/passthrough/vtd/qinval.c | 2 xen/drivers/passthrough/vtd/utils.c | 2 xen/include/asm-x86/fixmap.h | 3 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h | 29 xen/include/asm-x86/msi.h | 210 +++++++ xen/include/public/physdev.h | 5 xen/include/xen/iommu.h | 1 xen/include/xen/irq.h | 2 xen/include/xen/pci.h | 2 19 files changed, 1138 insertions(+), 169 deletions(-) diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/arch/x86/Makefile --- a/xen/arch/x86/Makefile Thu May 01 10:30:22 2008 +0100 +++ b/xen/arch/x86/Makefile Thu May 01 10:31:29 2008 +0100 @@ -24,6 +24,7 @@ obj-y += i387.o obj-y += i387.o obj-y += i8259.o obj-y += io_apic.o +obj-y += msi.o obj-y += ioport_emulate.o obj-y += irq.o obj-y += microcode.o diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/arch/x86/i8259.c --- a/xen/arch/x86/i8259.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/arch/x86/i8259.c Thu May 01 10:31:29 2008 +0100 @@ -382,6 +382,7 @@ void __devinit init_8259A(int auto_eoi) static struct irqaction cascade = { no_action, "cascade", NULL}; +extern struct list_head msi_pdev_list; void __init init_IRQ(void) { int i; @@ -418,5 +419,7 @@ void __init init_IRQ(void) outb(LATCH >> 8, PIT_CH0); /* MSB */ setup_irq(2, &cascade); -} - + + INIT_LIST_HEAD(&msi_pdev_list); +} + diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/arch/x86/io_apic.c --- a/xen/arch/x86/io_apic.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/arch/x86/io_apic.c Thu May 01 10:31:29 2008 +0100 @@ -27,13 +27,17 @@ #include #include #include +#include +#include #include #include #include #include #include +#include #include #include +#include /* Different to Linux: our implementation can be simpler. */ #define make_8259A_irq(irq) (io_apic_irqs &= ~(1<<(irq))) @@ -726,6 +730,7 @@ next: static struct hw_interrupt_type ioapic_level_type; static struct hw_interrupt_type ioapic_edge_type; +struct hw_interrupt_type pci_msi_type; #define IOAPIC_AUTO -1 #define IOAPIC_EDGE 0 @@ -1554,6 +1559,59 @@ static struct hw_interrupt_type ioapic_l .set_affinity = set_ioapic_affinity_vector, }; +static void mask_msi_vector(unsigned int vector) +{ + mask_msi_irq(vector); +} + +static void unmask_msi_vector(unsigned int vector) +{ + unmask_msi_irq(vector); +} + +static unsigned int startup_msi_vector(unsigned int vector) +{ + dprintk(XENLOG_INFO, "startup msi vector %x\n", vector); + unmask_msi_irq(vector); + return 0; +} + +static void ack_msi_vector(unsigned int vector) +{ + ack_APIC_irq(); +} + +static void end_msi_vector(unsigned int vector) +{ +} + +static void shutdown_msi_vector(unsigned int vector) +{ + dprintk(XENLOG_INFO, "shutdown msi vector %x\n", vector); + mask_msi_irq(vector); +} + +static void set_msi_affinity_vector(unsigned int vector, cpumask_t cpu_mask) +{ + set_native_irq_info(vector, cpu_mask); + set_msi_irq_affinity(vector, cpu_mask); +} + +/* + * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices, + * which implement the MSI or MSI-X Capability Structure. + */ +struct hw_interrupt_type pci_msi_type = { + .typename = "PCI-MSI", + .startup = startup_msi_vector, + .shutdown = shutdown_msi_vector, + .enable = unmask_msi_vector, + .disable = mask_msi_vector, + .ack = ack_msi_vector, + .end = end_msi_vector, + .set_affinity = set_msi_affinity_vector, +}; + static inline void init_IO_APIC_traps(void) { int irq; diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/arch/x86/irq.c --- a/xen/arch/x86/irq.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/arch/x86/irq.c Thu May 01 10:31:29 2008 +0100 @@ -395,9 +395,11 @@ int pirq_acktype(struct domain *d, int i /* * Edge-triggered IO-APIC and LAPIC interrupts need no final * acknowledgement: we ACK early during interrupt processing. + * MSIs are treated as edge-triggered interrupts. */ if ( !strcmp(desc->handler->typename, "IO-APIC-edge") || - !strcmp(desc->handler->typename, "local-APIC-edge") ) + !strcmp(desc->handler->typename, "local-APIC-edge") || + !strcmp(desc->handler->typename, "PCI-MSI") ) return ACKTYPE_NONE; /* diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/arch/x86/msi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/msi.c Thu May 01 10:31:29 2008 +0100 @@ -0,0 +1,787 @@ +/* + * File: msi.c + * Purpose: PCI Message Signaled Interrupt (MSI) + * + * Copyright (C) 2003-2004 Intel + * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern int msi_irq_enable; + +/* PCI-dev list with MSI/MSIX capabilities */ +DEFINE_SPINLOCK(msi_pdev_lock); +struct list_head msi_pdev_list; + +struct pci_dev *get_msi_pdev(u8 bus, u8 devfn) +{ + struct pci_dev *pdev = NULL; + + list_for_each_entry(pdev, &msi_pdev_list, msi_dev_list) + if ( pdev->bus == bus && pdev->devfn == devfn ) + return pdev; + + return NULL; +} + +/* bitmap indicate which fixed map is free */ +DEFINE_SPINLOCK(msix_fixmap_lock); +DECLARE_BITMAP(msix_fixmap_pages, MAX_MSIX_PAGES); + +static int msix_fixmap_alloc(void) +{ + int i; + int rc = -1; + + spin_lock(&msix_fixmap_lock); + for ( i = 0; i < MAX_MSIX_PAGES; i++ ) + if ( !test_bit(i, &msix_fixmap_pages) ) + break; + if ( i == MAX_MSIX_PAGES ) + goto out; + rc = FIX_MSIX_IO_RESERV_BASE + i; + set_bit(i, &msix_fixmap_pages); + + out: + spin_unlock(&msix_fixmap_lock); + return rc; +} + +static void msix_fixmap_free(int idx) +{ + if ( idx < FIX_MSIX_IO_RESERV_BASE ) + return; + + spin_lock(&msix_fixmap_lock); + clear_bit(idx - FIX_MSIX_IO_RESERV_BASE, &msix_fixmap_pages); + spin_unlock(&msix_fixmap_lock); +} + +/* + * MSI message composition + */ +static void msi_compose_msg(struct pci_dev *pdev, int vector, + struct msi_msg *msg) +{ + unsigned dest; + cpumask_t tmp; + + tmp = TARGET_CPUS; + if ( vector ) + { + dest = cpu_mask_to_apicid(tmp); + + msg->address_hi = MSI_ADDR_BASE_HI; + msg->address_lo = + MSI_ADDR_BASE_LO | + ((INT_DEST_MODE == 0) ? + MSI_ADDR_DESTMODE_PHYS: + MSI_ADDR_DESTMODE_LOGIC) | + ((INT_DELIVERY_MODE != dest_LowestPrio) ? + MSI_ADDR_REDIRECTION_CPU: + MSI_ADDR_REDIRECTION_LOWPRI) | + MSI_ADDR_DEST_ID(dest); + + msg->data = + MSI_DATA_TRIGGER_EDGE | + MSI_DATA_LEVEL_ASSERT | + ((INT_DELIVERY_MODE != dest_LowestPrio) ? + MSI_DATA_DELIVERY_FIXED: + MSI_DATA_DELIVERY_LOWPRI) | + MSI_DATA_VECTOR(vector); + } +} + +void read_msi_msg(unsigned int irq, struct msi_msg *msg) +{ + struct msi_desc *entry = irq_desc[irq].msi_desc; + + switch ( entry->msi_attrib.type ) + { + case PCI_CAP_ID_MSI: + { + struct pci_dev *dev = entry->dev; + int pos = entry->msi_attrib.pos; + u16 data; + u8 bus = dev->bus; + u8 slot = PCI_SLOT(dev->devfn); + u8 func = PCI_FUNC(dev->devfn); + + msg->address_lo = pci_conf_read32(bus, slot, func, + msi_lower_address_reg(pos)); + if ( entry->msi_attrib.is_64 ) + { + msg->address_hi = pci_conf_read32(bus, slot, func, + msi_upper_address_reg(pos)); + data = pci_conf_read16(bus, slot, func, msi_data_reg(pos, 1)); + } + else + { + msg->address_hi = 0; + data = pci_conf_read16(bus, slot, func, msi_data_reg(pos, 0)); + } + msg->data = data; + break; + } + case PCI_CAP_ID_MSIX: + { + void __iomem *base; + base = entry->mask_base + + entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; + + msg->address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); + msg->data = readl(base + PCI_MSIX_ENTRY_DATA_OFFSET); + break; + } + default: + BUG(); + } +} + +static int set_vector_msi(struct msi_desc *entry) +{ + irq_desc_t *desc; + unsigned long flags; + + if ( entry->vector >= NR_VECTORS ) + { + dprintk(XENLOG_ERR, "Trying to install msi data for Vector %d\n", + entry->vector); + return -EINVAL; + } + + desc = &irq_desc[entry->vector]; + spin_lock_irqsave(&desc->lock, flags); + desc->msi_desc = entry; + spin_unlock_irqrestore(&desc->lock, flags); + + return 0; +} + +static int unset_vector_msi(int vector) +{ + irq_desc_t *desc; + unsigned long flags; + + if ( vector >= NR_VECTORS ) + { + dprintk(XENLOG_ERR, "Trying to uninstall msi data for Vector %d\n", + vector); + return -EINVAL; + } + + desc = &irq_desc[vector]; + spin_lock_irqsave(&desc->lock, flags); + desc->msi_desc = NULL; + spin_unlock_irqrestore(&desc->lock, flags); + + return 0; +} + +void write_msi_msg(unsigned int irq, struct msi_msg *msg) +{ + struct msi_desc *entry = irq_desc[irq].msi_desc; + + switch ( entry->msi_attrib.type ) + { + case PCI_CAP_ID_MSI: + { + struct pci_dev *dev = entry->dev; + int pos = entry->msi_attrib.pos; + u8 bus = dev->bus; + u8 slot = PCI_SLOT(dev->devfn); + u8 func = PCI_FUNC(dev->devfn); + + pci_conf_write32(bus, slot, func, msi_lower_address_reg(pos), + msg->address_lo); + if ( entry->msi_attrib.is_64 ) + { + pci_conf_write32(bus, slot, func, msi_upper_address_reg(pos), + msg->address_hi); + pci_conf_write16(bus, slot, func, msi_data_reg(pos, 1), + msg->data); + } + else + pci_conf_write16(bus, slot, func, msi_data_reg(pos, 0), + msg->data); + break; + } + case PCI_CAP_ID_MSIX: + { + void __iomem *base; + base = entry->mask_base + + entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; + + writel(msg->address_lo, + base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); + writel(msg->address_hi, + base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); + writel(msg->data, base + PCI_MSIX_ENTRY_DATA_OFFSET); + break; + } + default: + BUG(); + } + entry->msg = *msg; +} + +void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) +{ + struct msi_msg msg; + unsigned int dest; + + memset(&msg, 0, sizeof(msg)); + cpus_and(mask, mask, cpu_online_map); + if ( cpus_empty(mask) ) + mask = TARGET_CPUS; + dest = cpu_mask_to_apicid(mask); + + read_msi_msg(irq, &msg); + + msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK; + msg.address_lo |= MSI_ADDR_DEST_ID(dest); + + write_msi_msg(irq, &msg); +} + +static void msi_set_enable(struct pci_dev *dev, int enable) +{ + int pos; + u16 control; + u8 bus = dev->bus; + u8 slot = PCI_SLOT(dev->devfn); + u8 func = PCI_FUNC(dev->devfn); + + pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSI); + if ( pos ) + { + control = pci_conf_read16(bus, slot, func, pos + PCI_MSI_FLAGS); + control &= ~PCI_MSI_FLAGS_ENABLE; + if ( enable ) + control |= PCI_MSI_FLAGS_ENABLE; + pci_conf_write16(bus, slot, func, pos + PCI_MSI_FLAGS, control); + } +} + +void msix_set_enable(struct pci_dev *dev, int enable) +{ + int pos; + u16 control; + u8 bus = dev->bus; + u8 slot = PCI_SLOT(dev->devfn); + u8 func = PCI_FUNC(dev->devfn); + + pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSIX); + if ( pos ) + { + control = pci_conf_read16(bus, slot, func, pos + PCI_MSIX_FLAGS); + control &= ~PCI_MSIX_FLAGS_ENABLE; + if ( enable ) + control |= PCI_MSIX_FLAGS_ENABLE; + pci_conf_write16(bus, slot, func, pos + PCI_MSIX_FLAGS, control); + } +} + +static void msix_flush_writes(unsigned int irq) +{ + struct msi_desc *entry = irq_desc[irq].msi_desc; + + BUG_ON(!entry || !entry->dev); + switch (entry->msi_attrib.type) { + case PCI_CAP_ID_MSI: + /* nothing to do */ + break; + case PCI_CAP_ID_MSIX: + { + int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; + readl(entry->mask_base + offset); + break; + } + default: + BUG(); + break; + } +} + +static void msi_set_mask_bit(unsigned int irq, int flag) +{ + struct msi_desc *entry = irq_desc[irq].msi_desc; + + BUG_ON(!entry || !entry->dev); + switch (entry->msi_attrib.type) { + case PCI_CAP_ID_MSI: + if (entry->msi_attrib.maskbit) { + int pos; + u32 mask_bits; + u8 bus = entry->dev->bus; + u8 slot = PCI_SLOT(entry->dev->devfn); + u8 func = PCI_FUNC(entry->dev->devfn); + + pos = (long)entry->mask_base; + mask_bits = pci_conf_read32(bus, slot, func, pos); + mask_bits &= ~(1); + mask_bits |= flag; + pci_conf_write32(bus, slot, func, pos, mask_bits); + } else { + msi_set_enable(entry->dev, !flag); + } + break; + case PCI_CAP_ID_MSIX: + { + int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; + writel(flag, entry->mask_base + offset); + readl(entry->mask_base + offset); + break; + } + default: + BUG(); + break; + } + entry->msi_attrib.masked = !!flag; +} + +void mask_msi_irq(unsigned int irq) +{ + msi_set_mask_bit(irq, 1); + msix_flush_writes(irq); +} + +void unmask_msi_irq(unsigned int irq) +{ + msi_set_mask_bit(irq, 0); + msix_flush_writes(irq); +} + +static struct msi_desc* alloc_msi_entry(void) +{ + struct msi_desc *entry; + + entry = xmalloc(struct msi_desc); + if ( !entry ) + return NULL; + + INIT_LIST_HEAD(&entry->list); + entry->dev = NULL; + + return entry; +} + +static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) +{ + struct msi_msg msg; + + msi_compose_msg(dev, desc->vector, &msg); + set_vector_msi(desc); + write_msi_msg(desc->vector, &msg); + + return 0; +} + +static void teardown_msi_vector(int vector) +{ + unset_vector_msi(vector); +} + +static void msi_free_vector(int vector) +{ + struct msi_desc *entry; + + entry = irq_desc[vector].msi_desc; + + teardown_msi_vector(vector); + + if ( entry->msi_attrib.type == PCI_CAP_ID_MSIX ) + { + unsigned long start; + + writel(1, entry->mask_base + entry->msi_attrib.entry_nr + * PCI_MSIX_ENTRY_SIZE + + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); + + start = (unsigned long)entry->mask_base & ~(PAGE_SIZE - 1); + msix_fixmap_free(virt_to_fix(start)); + destroy_xen_mappings(start, start + PAGE_SIZE); + } + list_del(&entry->list); + xfree(entry); +} + +void msi_free_vectors(struct pci_dev* dev) +{ + struct msi_desc *entry, *tmp; + + list_for_each_entry_safe( entry, tmp, &dev->msi_list, list ) + msi_free_vector(entry->vector); +} + +static struct msi_desc *find_msi_entry(struct pci_dev *dev, + int vector, int cap_id) +{ + struct msi_desc *entry; + + list_for_each_entry( entry, &dev->msi_list, list ) + { + if ( entry->msi_attrib.type == cap_id && + (vector == -1 || entry->vector == vector) ) + return entry; + } + + return NULL; +} + +/** + * msi_capability_init - configure device's MSI capability structure + * @dev: pointer to the pci_dev data structure of MSI device function + * + * Setup the MSI capability structure of device function with a single + * MSI irq, regardless of device function is capable of handling + * multiple messages. A return of zero indicates the successful setup + * of an entry zero with the new MSI irq or non-zero for otherwise. + **/ +static int msi_capability_init(struct pci_dev *dev, int vector) +{ + struct msi_desc *entry; + int pos, ret; + u16 control; + u8 bus = dev->bus; + u8 slot = PCI_SLOT(dev->devfn); + u8 func = PCI_FUNC(dev->devfn); + + pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSI); + control = pci_conf_read16(bus, slot, func, msi_control_reg(pos)); + /* MSI Entry Initialization */ + msi_set_enable(dev, 0); /* Ensure msi is disabled as I set it up */ + + entry = alloc_msi_entry(); + if ( !entry ) + return -ENOMEM; + + entry->msi_attrib.type = PCI_CAP_ID_MSI; + entry->msi_attrib.is_64 = is_64bit_address(control); + entry->msi_attrib.entry_nr = 0; + entry->msi_attrib.maskbit = is_mask_bit_support(control); + entry->msi_attrib.masked = 1; + entry->msi_attrib.pos = pos; + entry->vector = vector; + if ( is_mask_bit_support(control) ) + entry->mask_base = (void __iomem *)(long)msi_mask_bits_reg(pos, + is_64bit_address(control)); + entry->dev = dev; + if ( entry->msi_attrib.maskbit ) + { + unsigned int maskbits, temp; + /* All MSIs are unmasked by default, Mask them all */ + maskbits = pci_conf_read32(bus, slot, func, + msi_mask_bits_reg(pos, is_64bit_address(control))); + temp = (1 << multi_msi_capable(control)); + temp = ((temp - 1) & ~temp); + maskbits |= temp; + pci_conf_write32(bus, slot, func, + msi_mask_bits_reg(pos, is_64bit_address(control)), + maskbits); + } + list_add_tail(&entry->list, &dev->msi_list); + + /* Configure MSI capability structure */ + ret = setup_msi_irq(dev, entry); + if ( ret ) + { + msi_free_vector(vector); + return ret; + } + + /* Restore the original MSI enabled bits */ + pci_conf_write16(bus, slot, func, msi_control_reg(pos), control); + + return 0; +} + +static u64 pci_resource_start(struct pci_dev *dev, u8 bar_index) +{ + unsigned long bar_base; + u8 bus = dev->bus; + u8 slot = PCI_SLOT(dev->devfn); + u8 func = PCI_FUNC(dev->devfn); + + bar_base = pci_conf_read32(bus, slot, func, + PCI_BASE_ADDRESS_0 + 4 * bar_index); + if ( bar_base & PCI_BASE_ADDRESS_MEM_TYPE_64 ) + { + bar_base <<= 32; + bar_base += pci_conf_read32(bus, slot, func, + PCI_BASE_ADDRESS_0 + 4 * (bar_index + 1)); + } + + return bar_base; +} + +/** + * msix_capability_init - configure device's MSI-X capability + * @dev: pointer to the pci_dev data structure of MSI-X device function + * @entries: pointer to an array of struct msix_entry entries + * @nvec: number of @entries + * + * Setup the MSI-X capability structure of device function with a + * single MSI-X irq. A return of zero indicates the successful setup of + * requested MSI-X entries with allocated irqs or non-zero for otherwise. + **/ +static int msix_capability_init(struct pci_dev *dev, int vector, int entry_nr) +{ + struct msi_desc *entry; + int pos; + u16 control; + unsigned long phys_addr; + u32 table_offset; + u8 bir; + void __iomem *base; + int idx; + u8 bus = dev->bus; + u8 slot = PCI_SLOT(dev->devfn); + u8 func = PCI_FUNC(dev->devfn); + + pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSIX); + control = pci_conf_read16(bus, slot, func, msix_control_reg(pos)); + msix_set_enable(dev, 0);/* Ensure msix is disabled as I set it up */ + + /* MSI-X Table Initialization */ + entry = alloc_msi_entry(); + if ( !entry ) + return -ENOMEM; + + /* Request & Map MSI-X table region */ + table_offset = pci_conf_read32(bus, slot, func, msix_table_offset_reg(pos)); + bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); + table_offset &= ~PCI_MSIX_FLAGS_BIRMASK; + phys_addr = pci_resource_start(dev, bir) + table_offset; + idx = msix_fixmap_alloc(); + if ( idx < 0 ) + { + xfree(entry); + return -ENOMEM; + } + set_fixmap_nocache(idx, phys_addr); + base = (void *)(fix_to_virt(idx) + (phys_addr & ((1UL << PAGE_SHIFT) - 1))); + + entry->msi_attrib.type = PCI_CAP_ID_MSIX; + entry->msi_attrib.is_64 = 1; + entry->msi_attrib.entry_nr = entry_nr; + entry->msi_attrib.maskbit = 1; + entry->msi_attrib.masked = 1; + entry->msi_attrib.pos = pos; + entry->vector = vector; + entry->dev = dev; + entry->mask_base = base; + + list_add_tail(&entry->list, &dev->msi_list); + + setup_msi_irq(dev, entry); + + /* Set MSI-X enabled bits */ + pci_conf_write16(bus, slot, func, msix_control_reg(pos), control); + + return 0; +} + +/** + * pci_enable_msi - configure device's MSI capability structure + * @dev: pointer to the pci_dev data structure of MSI device function + * + * Setup the MSI capability structure of device function with + * a single MSI irq upon its software driver call to request for + * MSI mode enabled on its hardware device function. A return of zero + * indicates the successful setup of an entry zero with the new MSI + * irq or non-zero for otherwise. + **/ +static int __pci_enable_msi(u8 bus, u8 devfn, int vector) +{ + int status; + struct pci_dev *dev; + + dev = get_msi_pdev(bus, devfn); + if ( !dev ) + { + dev = xmalloc(struct pci_dev); + if ( !dev ) + return -ENOMEM; + dev->bus = bus; + dev->devfn = devfn; + INIT_LIST_HEAD(&dev->msi_list); + } + + if ( find_msi_entry(dev, vector, PCI_CAP_ID_MSI) ) + { + dprintk(XENLOG_WARNING, "vector %d has already mapped to MSI on device \ + %02x:%02x.%01x.\n", vector, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); + return 0; + } + + status = msi_capability_init(dev, vector); + + if ( dev != get_msi_pdev(bus, devfn) ) + { + spin_lock(&msi_pdev_lock); + list_add_tail(&dev->msi_dev_list, &msi_pdev_list); + spin_unlock(&msi_pdev_lock); + } + + return status; +} + +static void __pci_disable_msi(int vector) +{ + struct msi_desc *entry; + struct pci_dev *dev; + int pos; + u16 control; + u8 bus, slot, func; + + entry = irq_desc[vector].msi_desc; + dev = entry->dev; + bus = dev->bus; + slot = PCI_SLOT(dev->devfn); + func = PCI_FUNC(dev->devfn); + + pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSI); + control = pci_conf_read16(bus, slot, func, msi_control_reg(pos)); + msi_set_enable(dev, 0); + + BUG_ON(list_empty(&dev->msi_list)); + + msi_free_vector(vector); + + pci_conf_write16(bus, slot, func, msi_control_reg(pos), control); +} + +/** + * pci_enable_msix - configure device's MSI-X capability structure + * @dev: pointer to the pci_dev data structure of MSI-X device function + * @entries: pointer to an array of MSI-X entries + * @nvec: number of MSI-X irqs requested for allocation by device driver + * + * Setup the MSI-X capability structure of device function with the number + * of requested irqs upon its software driver call to request for + * MSI-X mode enabled on its hardware device function. A return of zero + * indicates the successful configuration of MSI-X capability structure + * with new allocated MSI-X irqs. A return of < 0 indicates a failure. + * Or a return of > 0 indicates that driver request is exceeding the number + * of irqs available. Driver should use the returned value to re-send + * its request. + **/ +static int __pci_enable_msix(u8 bus, u8 devfn, int vector, int entry_nr) +{ + int status, pos, nr_entries; + struct pci_dev *dev; + u16 control; + u8 slot = PCI_SLOT(devfn); + u8 func = PCI_FUNC(devfn); + + pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSIX); + control = pci_conf_read16(bus, slot, func, msi_control_reg(pos)); + nr_entries = multi_msix_capable(control); + if (entry_nr > nr_entries) + return -EINVAL; + + /* Check whether driver already requested for MSI-X irqs */ + dev = get_msi_pdev(bus, devfn); + + if ( !dev ) + { + dev = xmalloc(struct pci_dev); + if ( !dev ) + return -ENOMEM; + dev->bus = bus; + dev->devfn = devfn; + INIT_LIST_HEAD(&dev->msi_list); + } + + if ( find_msi_entry(dev, vector, PCI_CAP_ID_MSIX) ) + { + dprintk(XENLOG_WARNING, "vector %d has already mapped to MSIX on \ + device %02x:%02x.%01x.\n", vector, bus, + PCI_SLOT(devfn), PCI_FUNC(devfn)); + return 0; + } + + status = msix_capability_init(dev, vector, entry_nr); + + if ( dev != get_msi_pdev(bus, devfn) ) + { + spin_lock(&msi_pdev_lock); + list_add_tail(&dev->msi_dev_list, &msi_pdev_list); + spin_unlock(&msi_pdev_lock); + } + + return status; +} + +static void __pci_disable_msix(int vector) +{ + struct msi_desc *entry; + struct pci_dev *dev; + int pos; + u16 control; + u8 bus, slot, func; + + entry = irq_desc[vector].msi_desc; + dev = entry->dev; + bus = dev->bus; + slot = PCI_SLOT(dev->devfn); + func = PCI_FUNC(dev->devfn); + + pos = pci_find_cap_offset(bus, slot, func, PCI_CAP_ID_MSIX); + control = pci_conf_read16(bus, slot, func, msix_control_reg(pos)); + msi_set_enable(dev, 0); + + BUG_ON(list_empty(&dev->msi_list)); + + msi_free_vector(vector); + + pci_conf_write16(bus, slot, func, msix_control_reg(pos), control); +} + +int pci_enable_msi(u8 bus, u8 devfn, int vector, int entry_nr, int msi) +{ + if ( msi ) + return __pci_enable_msi(bus, devfn, vector); + else + return __pci_enable_msix(bus, devfn, vector, entry_nr); +} + +void pci_disable_msi(int vector) +{ + irq_desc_t *desc; + + desc = &irq_desc[vector]; + if ( desc->msi_desc->msi_attrib.type == PCI_CAP_ID_MSI ) + __pci_disable_msi(vector); + else if ( desc->msi_desc->msi_attrib.type == PCI_CAP_ID_MSIX ) + __pci_disable_msix(vector); +} + +void pci_cleanup_msi(struct pci_dev *dev) +{ + msi_free_vectors(dev); +} + diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/arch/x86/physdev.c --- a/xen/arch/x86/physdev.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/arch/x86/physdev.c Thu May 01 10:31:29 2008 +0100 @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -25,6 +26,9 @@ ioapic_guest_write( ioapic_guest_write( unsigned long physbase, unsigned int reg, u32 pval); + +extern struct hw_interrupt_type pci_msi_type; + static int get_free_pirq(struct domain *d, int type, int index) { int i; @@ -57,7 +61,8 @@ static int get_free_pirq(struct domain * /* * Caller hold the irq_lock */ -static int map_domain_pirq(struct domain *d, int pirq, int vector, int type) +static int map_domain_pirq(struct domain *d, int pirq, int vector, + struct physdev_map_pirq *map) { int ret = 0; int old_vector, old_pirq; @@ -95,6 +100,28 @@ static int map_domain_pirq(struct domain gdprintk(XENLOG_G_ERR, "add irq permit access %x failed\n", pirq); ret = -EINVAL; goto done; + } + + if ( map && MAP_PIRQ_TYPE_MSI == map->type ) + { + irq_desc_t *desc; + unsigned long flags; + + desc = &irq_desc[vector]; + + spin_lock_irqsave(&desc->lock, flags); + if ( desc->handler != &no_irq_type ) + gdprintk(XENLOG_G_ERR, "Map vector %x to msi while it is in use\n", + vector); + desc->handler = &pci_msi_type; + spin_unlock_irqrestore(&desc->lock, flags); + + ret = pci_enable_msi(map->msi_info.bus, + map->msi_info.devfn, vector, + map->msi_info.entry_nr, + map->msi_info.msi); + if ( ret ) + goto done; } d->arch.pirq_vector[pirq] = vector; @@ -129,7 +156,26 @@ static int unmap_domain_pirq(struct doma ret = -EINVAL; } else + { + unsigned long flags; + irq_desc_t *desc; + + desc = &irq_desc[vector]; + if ( desc->msi_desc ) + pci_disable_msi(vector); + + spin_lock_irqsave(&desc->lock, flags); + if ( desc->handler == &pci_msi_type ) + { + /* MSI is not shared, so should be released already */ + BUG_ON(desc->status & IRQ_GUEST); + irq_desc[vector].handler = &no_irq_type; + } + spin_unlock_irqrestore(&desc->lock, flags); + d->arch.pirq_vector[pirq] = d->arch.vector_pirq[vector] = 0; + } + ret = irq_deny_access(d, pirq); if ( ret ) @@ -187,6 +233,9 @@ static int physdev_map_pirq(struct physd break; case MAP_PIRQ_TYPE_MSI: vector = map->index; + if ( vector == -1 ) + vector = assign_irq_vector(AUTO_ASSIGN); + if ( vector < 0 || vector >= NR_VECTORS ) { ret = -EINVAL; @@ -237,7 +286,8 @@ static int physdev_map_pirq(struct physd pirq = map->pirq; } - ret = map_domain_pirq(d, pirq, vector, map->type); + + ret = map_domain_pirq(d, pirq, vector, map); if ( !ret ) map->pirq = pirq; @@ -331,6 +381,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H break; ret = physdev_map_pirq(&map); + if ( copy_to_guest(arg, &map, 1) != 0 ) ret = -EFAULT; break; @@ -397,7 +448,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H irq = irq_op.irq; ret = -EINVAL; - if ( (irq < 0) || (irq >= NR_IRQS) ) + if ( ((irq < 0) && (irq != AUTO_ASSIGN)) || (irq >= NR_IRQS) ) break; irq_op.vector = assign_irq_vector(irq); @@ -408,8 +459,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H { spin_lock_irqsave(&dom0->arch.irq_lock, flags); if ( irq != AUTO_ASSIGN ) - ret = map_domain_pirq(dom0, irq_op.irq, irq_op.vector, - MAP_PIRQ_TYPE_GSI); + ret = map_domain_pirq(dom0, irq_op.irq, irq_op.vector, NULL); spin_unlock_irqrestore(&dom0->arch.irq_lock, flags); } diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/drivers/passthrough/amd/iommu_init.c --- a/xen/drivers/passthrough/amd/iommu_init.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/drivers/passthrough/amd/iommu_init.c Thu May 01 10:31:29 2008 +0100 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -292,7 +293,7 @@ static void amd_iommu_msi_addr_init(stru u32 address_lo = MSI_ADDR_HEADER | MSI_ADDR_DESTMODE_PHYS | MSI_ADDR_REDIRECTION_CPU | - MSI_ADDR_DESTID_CPU(phy_cpu); + MSI_ADDR_DEST_ID(phy_cpu); pci_conf_write32(bus, dev, func, iommu->msi_cap + PCI_MSI_ADDRESS_LO, address_lo); diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/drivers/passthrough/vtd/intremap.c Thu May 01 10:31:29 2008 +0100 @@ -24,10 +24,10 @@ #include #include #include +#include #include "iommu.h" #include "dmar.h" #include "vtd.h" -#include "msi.h" #include "extern.h" u16 apicid_to_bdf(int apic_id) diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Thu May 01 10:31:29 2008 +0100 @@ -29,9 +29,9 @@ #include #include #include +#include #include "iommu.h" #include "dmar.h" -#include "msi.h" #include "extern.h" #include "vtd.h" diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/drivers/passthrough/vtd/msi.h --- a/xen/drivers/passthrough/vtd/msi.h Thu May 01 10:30:22 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2003-2004 Intel - * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) - */ - -#ifndef MSI_H -#define MSI_H - -/* - * Assume the maximum number of hot plug slots supported by the system is about - * ten. The worstcase is that each of these slots is hot-added with a device, - * which has two MSI/MSI-X capable functions. To avoid any MSI-X driver, which - * attempts to request all available vectors, NR_HP_RESERVED_VECTORS is defined - * as below to ensure at least one message is assigned to each detected MSI/ - * MSI-X device function. - */ -#define NR_HP_RESERVED_VECTORS 20 - -extern int vector_irq[NR_VECTORS]; -extern int pci_vector_resources(int last, int nr_released); - -/* - * MSI-X Address Register - */ -#define PCI_MSIX_FLAGS_QSIZE 0x7FF -#define PCI_MSIX_FLAGS_ENABLE (1 << 15) -#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) -#define PCI_MSIX_FLAGS_BITMASK (1 << 0) - -#define PCI_MSIX_ENTRY_SIZE 16 -#define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET 0 -#define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET 4 -#define PCI_MSIX_ENTRY_DATA_OFFSET 8 -#define PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET 12 - -#define msi_control_reg(base) (base + PCI_MSI_FLAGS) -#define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) -#define msi_upper_address_reg(base) (base + PCI_MSI_ADDRESS_HI) -#define msi_data_reg(base, is64bit) \ - ( (is64bit == 1) ? base+PCI_MSI_DATA_64 : base+PCI_MSI_DATA_32 ) -#define msi_mask_bits_reg(base, is64bit) \ - ( (is64bit == 1) ? base+PCI_MSI_MASK_BIT : base+PCI_MSI_MASK_BIT-4) -#define msi_disable(control) control &= ~PCI_MSI_FLAGS_ENABLE -#define multi_msi_capable(control) \ - (1 << ((control & PCI_MSI_FLAGS_QMASK) >> 1)) -#define multi_msi_enable(control, num) \ - control |= (((num >> 1) << 4) & PCI_MSI_FLAGS_QSIZE); -#define is_64bit_address(control) (control & PCI_MSI_FLAGS_64BIT) -#define is_mask_bit_support(control) (control & PCI_MSI_FLAGS_MASKBIT) -#define msi_enable(control, num) multi_msi_enable(control, num); \ - control |= PCI_MSI_FLAGS_ENABLE - -#define msix_table_offset_reg(base) (base + 0x04) -#define msix_pba_offset_reg(base) (base + 0x08) -#define msix_enable(control) control |= PCI_MSIX_FLAGS_ENABLE -#define msix_disable(control) control &= ~PCI_MSIX_FLAGS_ENABLE -#define msix_table_size(control) ((control & PCI_MSIX_FLAGS_QSIZE)+1) -#define multi_msix_capable msix_table_size -#define msix_unmask(address) (address & ~PCI_MSIX_FLAGS_BITMASK) -#define msix_mask(address) (address | PCI_MSIX_FLAGS_BITMASK) -#define msix_is_pending(address) (address & PCI_MSIX_FLAGS_PENDMASK) - -/* - * MSI Defined Data Structures - */ -#define MSI_ADDRESS_HEADER 0xfee -#define MSI_ADDRESS_HEADER_SHIFT 12 -#define MSI_ADDRESS_HEADER_MASK 0xfff000 -#define MSI_ADDRESS_DEST_ID_MASK 0xfff0000f -#define MSI_TARGET_CPU_MASK 0xff -#define MSI_TARGET_CPU_SHIFT 12 -#define MSI_DELIVERY_MODE 0 -#define MSI_LEVEL_MODE 1 /* Edge always assert */ -#define MSI_TRIGGER_MODE 0 /* MSI is edge sensitive */ -#define MSI_PHYSICAL_MODE 0 -#define MSI_LOGICAL_MODE 1 -#define MSI_REDIRECTION_HINT_MODE 0 - -#define __LITTLE_ENDIAN_BITFIELD 1 - -struct msg_data { -#if defined(__LITTLE_ENDIAN_BITFIELD) - __u32 vector : 8; - __u32 delivery_mode : 3; /* 000b: FIXED | 001b: lowest prior */ - __u32 reserved_1 : 3; - __u32 level : 1; /* 0: deassert | 1: assert */ - __u32 trigger : 1; /* 0: edge | 1: level */ - __u32 reserved_2 : 16; -#elif defined(__BIG_ENDIAN_BITFIELD) - __u32 reserved_2 : 16; - __u32 trigger : 1; /* 0: edge | 1: level */ - __u32 level : 1; /* 0: deassert | 1: assert */ - __u32 reserved_1 : 3; - __u32 delivery_mode : 3; /* 000b: FIXED | 001b: lowest prior */ - __u32 vector : 8; -#else -#error "Bitfield endianness not defined! Check your byteorder.h" -#endif -} __attribute__ ((packed)); - -struct msg_address { - union { - struct { -#if defined(__LITTLE_ENDIAN_BITFIELD) - __u32 reserved_1 : 2; - __u32 dest_mode : 1; /*0:physic | 1:logic */ - __u32 redirection_hint: 1; /*0: dedicated CPU - 1: lowest priority */ - __u32 reserved_2 : 4; - __u32 dest_id : 24; /* Destination ID */ -#elif defined(__BIG_ENDIAN_BITFIELD) - __u32 dest_id : 24; /* Destination ID */ - __u32 reserved_2 : 4; - __u32 redirection_hint: 1; /*0: dedicated CPU - 1: lowest priority */ - __u32 dest_mode : 1; /*0:physic | 1:logic */ - __u32 reserved_1 : 2; -#else -#error "Bitfield endianness not defined! Check your byteorder.h" -#endif - }u; - __u32 value; - }lo_address; - __u32 hi_address; -} __attribute__ ((packed)); - -#endif /* MSI_H */ diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/drivers/passthrough/vtd/qinval.c --- a/xen/drivers/passthrough/vtd/qinval.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/drivers/passthrough/vtd/qinval.c Thu May 01 10:31:29 2008 +0100 @@ -24,10 +24,10 @@ #include #include #include +#include #include "iommu.h" #include "dmar.h" #include "vtd.h" -#include "msi.h" #include "extern.h" static void print_qi_regs(struct iommu *iommu) diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/drivers/passthrough/vtd/utils.c --- a/xen/drivers/passthrough/vtd/utils.c Thu May 01 10:30:22 2008 +0100 +++ b/xen/drivers/passthrough/vtd/utils.c Thu May 01 10:31:29 2008 +0100 @@ -23,9 +23,9 @@ #include #include #include +#include #include "iommu.h" #include "dmar.h" -#include "msi.h" #include "vtd.h" #define INTEL 0x8086 diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/include/asm-x86/fixmap.h --- a/xen/include/asm-x86/fixmap.h Thu May 01 10:30:22 2008 +0100 +++ b/xen/include/asm-x86/fixmap.h Thu May 01 10:31:29 2008 +0100 @@ -19,6 +19,7 @@ #include #include #include +#include /* * Here we define all the compile-time 'special' virtual @@ -47,6 +48,8 @@ enum fixed_addresses { FIX_IOMMU_MMIO_BASE_0, FIX_IOMMU_MMIO_END = FIX_IOMMU_MMIO_BASE_0 + IOMMU_PAGES -1, FIX_TBOOT_SHARED_BASE, + FIX_MSIX_IO_RESERV_BASE, + FIX_MSIX_IO_RESERV_END = FIX_MSIX_IO_RESERV_BASE + MAX_MSIX_PAGES -1, __end_of_fixed_addresses }; diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h --- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h Thu May 01 10:30:22 2008 +0100 +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h Thu May 01 10:31:29 2008 +0100 @@ -435,33 +435,4 @@ #define IOMMU_IO_READ_ENABLED 1 #define HACK_BIOS_SETTINGS 0 -/* MSI interrupt */ -#define MSI_DATA_VECTOR_SHIFT 0 -#define MSI_DATA_VECTOR(v) (((u8)v) << MSI_DATA_VECTOR_SHIFT) - -#define MSI_DATA_DELIVERY_SHIFT 8 -#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_SHIFT) -#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_SHIFT) - -#define MSI_DATA_LEVEL_SHIFT 14 -#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT) -#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT) - -#define MSI_DATA_TRIGGER_SHIFT 15 -#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT) -#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT) - -#define MSI_TARGET_CPU_SHIFT 12 -#define MSI_ADDR_HEADER 0xfee00000 -#define MSI_ADDR_DESTID_MASK 0xfff0000f -#define MSI_ADDR_DESTID_CPU(cpu) ((cpu) << MSI_TARGET_CPU_SHIFT) - -#define MSI_ADDR_DESTMODE_SHIFT 2 -#define MSI_ADDR_DESTMODE_PHYS (0 << MSI_ADDR_DESTMODE_SHIFT) -#define MSI_ADDR_DESTMODE_LOGIC (1 << MSI_ADDR_DESTMODE_SHIFT) - -#define MSI_ADDR_REDIRECTION_SHIFT 3 -#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT) -#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT) - #endif /* _ASM_X86_64_AMD_IOMMU_DEFS_H */ diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/include/asm-x86/msi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/include/asm-x86/msi.h Thu May 01 10:31:29 2008 +0100 @@ -0,0 +1,210 @@ +#ifndef __ASM_MSI_H +#define __ASM_MSI_H + +#include +#include +/* + * Constants for Intel APIC based MSI messages. + */ + +/* + * Shifts for MSI data + */ + +#define MSI_DATA_VECTOR_SHIFT 0 +#define MSI_DATA_VECTOR_MASK 0x000000ff +#define MSI_DATA_VECTOR(v) (((v) << MSI_DATA_VECTOR_SHIFT) & MSI_DATA_VECTOR_MASK) + +#define MSI_DATA_DELIVERY_MODE_SHIFT 8 +#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_MODE_SHIFT) +#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_MODE_SHIFT) + +#define MSI_DATA_LEVEL_SHIFT 14 +#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT) +#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT) + +#define MSI_DATA_TRIGGER_SHIFT 15 +#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT) +#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT) + +/* + * Shift/mask fields for msi address + */ + +#define MSI_ADDR_BASE_HI 0 +#define MSI_ADDR_BASE_LO 0xfee00000 +#define MSI_ADDR_HEADER MSI_ADDR_BASE_LO + +#define MSI_ADDR_DESTMODE_SHIFT 2 +#define MSI_ADDR_DESTMODE_PHYS (0 << MSI_ADDR_DESTMODE_SHIFT) +#define MSI_ADDR_DESTMODE_LOGIC (1 << MSI_ADDR_DESTMODE_SHIFT) + +#define MSI_ADDR_REDIRECTION_SHIFT 3 +#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT) +#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT) + +#define MSI_ADDR_DEST_ID_SHIFT 12 +#define MSI_ADDR_DEST_ID_MASK 0x00ffff0 +#define MSI_ADDR_DEST_ID(dest) (((dest) << MSI_ADDR_DEST_ID_SHIFT) & MSI_ADDR_DEST_ID_MASK) + +/* MAX fixed pages reserved for mapping MSIX tables. */ +#if defined(__x86_64__) +#define MAX_MSIX_PAGES 512 +#else +#define MAX_MSIX_PAGES 32 +#endif + +struct msi_msg { + u32 address_lo; /* low 32 bits of msi message address */ + u32 address_hi; /* high 32 bits of msi message address */ + u32 data; /* 16 bits of msi message data */ +}; + +/* Helper functions */ +extern void mask_msi_irq(unsigned int irq); +extern void unmask_msi_irq(unsigned int irq); +extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); +extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); +extern void set_msi_irq_affinity(unsigned int irq, cpumask_t mask); +extern int pci_enable_msi(u8 bus, u8 devfn, int vector, int entry_nr, int msi); +extern void pci_disable_msi(int vector); + +struct msi_desc { + struct { + __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ + __u8 maskbit : 1; /* mask-pending bit supported ? */ + __u8 masked : 1; + __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ + __u8 pos; /* Location of the msi capability */ + __u16 entry_nr; /* specific enabled entry */ + }msi_attrib; + + struct list_head list; + + void __iomem *mask_base; + struct pci_dev *dev; + int vector; + + /* Last set MSI message */ + struct msi_msg msg; +}; + +/* + * Assume the maximum number of hot plug slots supported by the system is about + * ten. The worstcase is that each of these slots is hot-added with a device, + * which has two MSI/MSI-X capable functions. To avoid any MSI-X driver, which + * attempts to request all available vectors, NR_HP_RESERVED_VECTORS is defined + * as below to ensure at least one message is assigned to each detected MSI/ + * MSI-X device function. + */ +#define NR_HP_RESERVED_VECTORS 20 + +extern int vector_irq[NR_VECTORS]; + +/* + * MSI-X Address Register + */ +#define PCI_MSIX_FLAGS_QSIZE 0x7FF +#define PCI_MSIX_FLAGS_ENABLE (1 << 15) +#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) +#define PCI_MSIX_FLAGS_BITMASK (1 << 0) + +#define PCI_MSIX_ENTRY_SIZE 16 +#define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET 0 +#define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET 4 +#define PCI_MSIX_ENTRY_DATA_OFFSET 8 +#define PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET 12 + +#define msi_control_reg(base) (base + PCI_MSI_FLAGS) +#define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) +#define msi_upper_address_reg(base) (base + PCI_MSI_ADDRESS_HI) +#define msi_data_reg(base, is64bit) \ + ( (is64bit == 1) ? base+PCI_MSI_DATA_64 : base+PCI_MSI_DATA_32 ) +#define msi_mask_bits_reg(base, is64bit) \ + ( (is64bit == 1) ? base+PCI_MSI_MASK_BIT : base+PCI_MSI_MASK_BIT-4) +#define msi_disable(control) control &= ~PCI_MSI_FLAGS_ENABLE +#define multi_msi_capable(control) \ + (1 << ((control & PCI_MSI_FLAGS_QMASK) >> 1)) +#define multi_msi_enable(control, num) \ + control |= (((num >> 1) << 4) & PCI_MSI_FLAGS_QSIZE); +#define is_64bit_address(control) (!!(control & PCI_MSI_FLAGS_64BIT)) +#define is_mask_bit_support(control) (!!(control & PCI_MSI_FLAGS_MASKBIT)) +#define msi_enable(control, num) multi_msi_enable(control, num); \ + control |= PCI_MSI_FLAGS_ENABLE + +#define msix_control_reg(base) (base + PCI_MSIX_FLAGS) +#define msix_table_offset_reg(base) (base + 0x04) +#define msix_pba_offset_reg(base) (base + 0x08) +#define msix_enable(control) control |= PCI_MSIX_FLAGS_ENABLE +#define msix_disable(control) control &= ~PCI_MSIX_FLAGS_ENABLE +#define msix_table_size(control) ((control & PCI_MSIX_FLAGS_QSIZE)+1) +#define multi_msix_capable msix_table_size +#define msix_unmask(address) (address & ~PCI_MSIX_FLAGS_BITMASK) +#define msix_mask(address) (address | PCI_MSIX_FLAGS_BITMASK) +#define msix_is_pending(address) (address & PCI_MSIX_FLAGS_PENDMASK) + +/* + * MSI Defined Data Structures + */ +#define MSI_ADDRESS_HEADER 0xfee +#define MSI_ADDRESS_HEADER_SHIFT 12 +#define MSI_ADDRESS_HEADER_MASK 0xfff000 +#define MSI_ADDRESS_DEST_ID_MASK 0xfff0000f +#define MSI_TARGET_CPU_MASK 0xff +#define MSI_TARGET_CPU_SHIFT 12 +#define MSI_DELIVERY_MODE 0 +#define MSI_LEVEL_MODE 1 /* Edge always assert */ +#define MSI_TRIGGER_MODE 0 /* MSI is edge sensitive */ +#define MSI_PHYSICAL_MODE 0 +#define MSI_LOGICAL_MODE 1 +#define MSI_REDIRECTION_HINT_MODE 0 + +#define __LITTLE_ENDIAN_BITFIELD 1 + +struct msg_data { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u32 vector : 8; + __u32 delivery_mode : 3; /* 000b: FIXED | 001b: lowest prior */ + __u32 reserved_1 : 3; + __u32 level : 1; /* 0: deassert | 1: assert */ + __u32 trigger : 1; /* 0: edge | 1: level */ + __u32 reserved_2 : 16; +#elif defined(__BIG_ENDIAN_BITFIELD) + __u32 reserved_2 : 16; + __u32 trigger : 1; /* 0: edge | 1: level */ + __u32 level : 1; /* 0: deassert | 1: assert */ + __u32 reserved_1 : 3; + __u32 delivery_mode : 3; /* 000b: FIXED | 001b: lowest prior */ + __u32 vector : 8; +#else +#error "Bitfield endianness not defined! Check your byteorder.h" +#endif +} __attribute__ ((packed)); + +struct msg_address { + union { + struct { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u32 reserved_1 : 2; + __u32 dest_mode : 1; /*0:physic | 1:logic */ + __u32 redirection_hint: 1; /*0: dedicated CPU + 1: lowest priority */ + __u32 reserved_2 : 4; + __u32 dest_id : 24; /* Destination ID */ +#elif defined(__BIG_ENDIAN_BITFIELD) + __u32 dest_id : 24; /* Destination ID */ + __u32 reserved_2 : 4; + __u32 redirection_hint: 1; /*0: dedicated CPU + 1: lowest priority */ + __u32 dest_mode : 1; /*0:physic | 1:logic */ + __u32 reserved_1 : 2; +#else +#error "Bitfield endianness not defined! Check your byteorder.h" +#endif + }u; + __u32 value; + }lo_address; + __u32 hi_address; +} __attribute__ ((packed)); + +#endif /* __ASM_MSI_H */ diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/include/public/physdev.h --- a/xen/include/public/physdev.h Thu May 01 10:30:22 2008 +0100 +++ b/xen/include/public/physdev.h Thu May 01 10:31:29 2008 +0100 @@ -135,6 +135,11 @@ struct physdev_map_pirq { int index; /* IN or OUT */ int pirq; + /* IN */ + struct { + int bus, devfn, entry_nr; + int msi; /* 0 - MSIX 1 - MSI */ + } msi_info; }; typedef struct physdev_map_pirq physdev_map_pirq_t; DEFINE_XEN_GUEST_HANDLE(physdev_map_pirq_t); diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Thu May 01 10:30:22 2008 +0100 +++ b/xen/include/xen/iommu.h Thu May 01 10:31:29 2008 +0100 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/include/xen/irq.h --- a/xen/include/xen/irq.h Thu May 01 10:30:22 2008 +0100 +++ b/xen/include/xen/irq.h Thu May 01 10:31:29 2008 +0100 @@ -44,6 +44,7 @@ typedef struct hw_interrupt_type hw_irq_ #include +struct msi_desc; /* * This is the "IRQ descriptor", which contains various information * about the irq, including what kind of hardware handling it has, @@ -54,6 +55,7 @@ typedef struct { typedef struct { unsigned int status; /* IRQ status */ hw_irq_controller *handler; + struct msi_desc *msi_desc; struct irqaction *action; /* IRQ action list */ unsigned int depth; /* nested irq disables */ spinlock_t lock; diff -r 6ecbb00e58cd -r 86c0353f19d0 xen/include/xen/pci.h --- a/xen/include/xen/pci.h Thu May 01 10:30:22 2008 +0100 +++ b/xen/include/xen/pci.h Thu May 01 10:31:29 2008 +0100 @@ -26,8 +26,10 @@ struct pci_dev { struct list_head list; + struct list_head msi_dev_list; u8 bus; u8 devfn; + struct list_head msi_list; }; uint8_t pci_conf_read8( _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra42-0004Oe-Ii for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:15 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4Y-0003uV-UY; Thu, 01 May 2008 14:47:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWD7-0000N4-IN for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:21 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCl-0000PM-F6 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:19 +0000 X-SBRS: 3.6 X-MesageID: 107386 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107386" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:01 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A00NP010646 for ; Thu, 1 May 2008 03:00:00 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0IA0015410 for ; Thu, 1 May 2008 03:00:18 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0IeS015409 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:18 -0700 Message-Id: <200805011000.m41A0IeS015409@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:17 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] MSI 4/6: remove io_mem permission for MSI-X, since MSI-X X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634330 -3600 # Node ID a0ebceaf41ff8ebda5e2478c03fd6e382ddc4b7f # Parent 86c0353f19d03ec79d352074a54d94863d2dac4c MSI 4/6: remove io_mem permission for MSI-X, since MSI-X facilities are allocted through and located in PCI BAR. Signed-off-by: Jiang Yunhong Signed-off-by: Shan Haitao --- tools/python/xen/util/pci.py | 85 +++++++++++++++++++++++++++++++++- tools/python/xen/xend/server/pciif.py | 13 +++++ 2 files changed, 96 insertions(+), 2 deletions(-) diff -r 86c0353f19d0 -r a0ebceaf41ff tools/python/xen/util/pci.py --- a/tools/python/xen/util/pci.py Thu May 01 10:31:29 2008 +0100 +++ b/tools/python/xen/util/pci.py Thu May 01 10:32:10 2008 +0100 @@ -7,6 +7,7 @@ import sys import os, os.path +import resource PROC_MNT_PATH = '/proc/mounts' PROC_PCI_PATH = '/proc/bus/pci/devices' @@ -14,6 +15,7 @@ PROC_PCI_NUM_RESOURCES = 7 SYSFS_PCI_DEVS_PATH = '/bus/pci/devices' SYSFS_PCI_DEV_RESOURCE_PATH = '/resource' +SYSFS_PCI_DEV_CONFIG_PATH = '/config' SYSFS_PCI_DEV_IRQ_PATH = '/irq' SYSFS_PCI_DEV_DRIVER_DIR_PATH = '/driver' SYSFS_PCI_DEV_VENDOR_PATH = '/vendor' @@ -24,7 +26,20 @@ PCI_BAR_IO = 0x01 PCI_BAR_IO = 0x01 PCI_BAR_IO_MASK = ~0x03 PCI_BAR_MEM_MASK = ~0x0f - +PCI_STATUS_CAP_MASK = 0x10 +PCI_STATUS_OFFSET = 0x6 +PCI_CAP_OFFSET = 0x34 +MSIX_BIR_MASK = 0x7 + +#Calculate PAGE_SHIFT: number of bits to shift an address to get the page number +PAGE_SIZE = resource.getpagesize() +PAGE_SHIFT = 0 +t = PAGE_SIZE +while not (t&1): + t>>=1 + PAGE_SHIFT+=1 + +PAGE_MASK=~(PAGE_SIZE - 1) # Definitions from Linux: include/linux/pci.h def PCI_DEVFN(slot, func): return ((((slot) & 0x1f) << 3) | ((func) & 0x07)) @@ -74,10 +89,72 @@ class PciDevice: self.device = None self.subvendor = None self.subdevice = None - + self.msix = 0 + self.msix_iomem = [] self.get_info_from_sysfs() + def find_capability(self, type): + try: + sysfs_mnt = find_sysfs_mnt() + except IOError, (errno, strerr): + raise PciDeviceParseError(('Failed to locate sysfs mount: %s (%d)' % + (PROC_PCI_PATH, strerr, errno))) + + if sysfs_mnt == None: + return False + path = sysfs_mnt+SYSFS_PCI_DEVS_PATH+'/'+ \ + self.name+SYSFS_PCI_DEV_CONFIG_PATH + try: + conf_file = open(path, 'rb') + conf_file.seek(PCI_STATUS_OFFSET) + status = ord(conf_file.read(1)) + if status&PCI_STATUS_CAP_MASK: + conf_file.seek(PCI_CAP_OFFSET) + capa_pointer = ord(conf_file.read(1)) + while capa_pointer: + conf_file.seek(capa_pointer) + capa_id = ord(conf_file.read(1)) + capa_pointer = ord(conf_file.read(1)) + if capa_id == type: + # get the type + message_cont_lo = ord(conf_file.read(1)) + message_cont_hi = ord(conf_file.read(1)) + self.msix=1 + self.msix_entries = message_cont_lo + \ + message_cont_hi << 8 + t_off=conf_file.read(4) + p_off=conf_file.read(4) + self.table_offset=ord(t_off[0]) | (ord(t_off[1])<<8) | \ + (ord(t_off[2])<<16)| \ + (ord(t_off[3])<<24) + self.pba_offset=ord(p_off[0]) | (ord(p_off[1]) << 8)| \ + (ord(p_off[2])<<16) | \ + (ord(p_off[3])<<24) + self.table_index = self.table_offset & MSIX_BIR_MASK + self.table_offset = self.table_offset & ~MSIX_BIR_MASK + self.pba_index = self.pba_offset & MSIX_BIR_MASK + self.pba_offset = self.pba_offset & ~MSIX_BIR_MASK + break + except IOError, (errno, strerr): + raise PciDeviceParseError(('Failed to locate sysfs mount: %s (%d)' % + (PROC_PCI_PATH, strerr, errno))) + + def remove_msix_iomem(self, index, start, size): + if (index == self.table_index): + table_start = start+self.table_offset + table_end = table_start + self.msix_entries * 16 + table_start = table_start & PAGE_MASK + table_end = (table_end + PAGE_SIZE) & PAGE_MASK + self.msix_iomem.append((table_start, table_end-table_start)) + if (index==self.pba_index): + pba_start = start + self.pba_offset + pba_end = pba_start + self.msix_entries/8 + pba_start = pba_start & PAGE_MASK + pba_end = (pba_end + PAGE_SIZE) & PAGE_MASK + self.msix_iomem.append((pba_start, pba_end-pba_start)) + def get_info_from_sysfs(self): + self.find_capability(0x11) try: sysfs_mnt = find_sysfs_mnt() except IOError, (errno, strerr): @@ -108,6 +185,10 @@ class PciDevice: self.ioports.append( (start,size) ) else: self.iomem.append( (start,size) ) + if (self.msix): + self.remove_msix_iomem(i, start, size) + + except IOError, (errno, strerr): raise PciDeviceParseError(('Failed to open & read %s: %s (%d)' % diff -r 86c0353f19d0 -r a0ebceaf41ff tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Thu May 01 10:31:29 2008 +0100 +++ b/tools/python/xen/xend/server/pciif.py Thu May 01 10:32:10 2008 +0100 @@ -277,6 +277,19 @@ class PciController(DevController): if rc < 0: raise VmError(('pci: failed to map irq on device '+ '%s - errno=%d')%(dev.name,rc)) + + if dev.msix: + for (start, size) in dev.msix_iomem: + start_pfn = start>>PAGE_SHIFT + nr_pfns = (size+(PAGE_SIZE-1))>>PAGE_SHIFT + log.debug('pci-msix: remove permission for 0x%x/0x%x 0x%x/0x%x' % \ + (start,size, start_pfn, nr_pfns)) + rc = xc.domain_iomem_permission(domid = fe_domid, + first_pfn = start_pfn, + nr_pfns = nr_pfns, + allow_access = False) + if rc<0: + raise VmError(('pci: failed to remove msi-x iomem')) if dev.irq>0: log.debug('pci: enabling irq %d'%dev.irq) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:20 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:20 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra47-0004Oh-RO for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:20 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4e-000413-Jz; Thu, 01 May 2008 14:47:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDB-0000NI-OV for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:25 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWD0-0000Pi-VV for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:23 +0000 X-SBRS: 3.6 X-MesageID: 107390 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107390" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:06 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A060p010658 for ; Thu, 1 May 2008 03:00:06 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0O6u015503 for ; Thu, 1 May 2008 03:00:24 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0NPl015502 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:23 -0700 Message-Id: <200805011000.m41A0NPl015502@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:23 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Port acpi bit register support from Linux. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634911 -3600 # Node ID 93bc6d9b5f3186ad5f0221a8e23e524284c3197e # Parent 74cae5c11f0a2fb81212b52b7a7b38b599fe2ac2 Port acpi bit register support from Linux. Bit register read/write is required by deep C code. Remove dependendy on acpi_sinfo. Signed-off-by: Wei Gang --- xen/arch/x86/acpi/boot.c | 16 ++ xen/drivers/acpi/Makefile | 1 xen/drivers/acpi/hwregs.c | 339 +++++++++++++++++++++++++++++++++++++++++--- xen/drivers/acpi/utglobal.c | 136 +++++++++++++++++ 4 files changed, 473 insertions(+), 19 deletions(-) diff -r 74cae5c11f0a -r 93bc6d9b5f31 xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Thu May 01 10:40:58 2008 +0100 +++ b/xen/arch/x86/acpi/boot.c Thu May 01 10:41:51 2008 +0100 @@ -462,6 +462,20 @@ bad: } #endif +static void __init +acpi_fadt_parse_reg(struct acpi_table_fadt *fadt) +{ + memcpy(&acpi_gbl_FADT, fadt, sizeof(acpi_gbl_FADT)); + + memcpy(&acpi_gbl_xpm1a_enable, &(fadt->xpm1a_event_block), + sizeof(acpi_gbl_xpm1a_enable)); + memcpy(&acpi_gbl_xpm1b_enable, &(fadt->xpm1b_event_block), + sizeof(acpi_gbl_xpm1b_enable)); + + acpi_gbl_xpm1a_enable.address += 2; + acpi_gbl_xpm1b_enable.address += 2; +} + static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) { struct acpi_table_fadt *fadt = NULL; @@ -512,6 +526,8 @@ static int __init acpi_parse_fadt(unsign #ifdef CONFIG_ACPI_SLEEP acpi_fadt_parse_sleep_info(fadt); #endif + + acpi_fadt_parse_reg(fadt); return 0; } diff -r 74cae5c11f0a -r 93bc6d9b5f31 xen/drivers/acpi/Makefile --- a/xen/drivers/acpi/Makefile Thu May 01 10:40:58 2008 +0100 +++ b/xen/drivers/acpi/Makefile Thu May 01 10:41:51 2008 +0100 @@ -3,3 +3,4 @@ obj-y += osl.o obj-y += osl.o obj-$(x86) += hwregs.o +obj-$(x86) += utglobal.o diff -r 74cae5c11f0a -r 93bc6d9b5f31 xen/drivers/acpi/hwregs.c --- a/xen/drivers/acpi/hwregs.c Thu May 01 10:40:58 2008 +0100 +++ b/xen/drivers/acpi/hwregs.c Thu May 01 10:41:51 2008 +0100 @@ -53,6 +53,241 @@ #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME("hwregs") +/******************************************************************************* + * + * FUNCTION: acpi_hw_get_register_bit_mask + * + * PARAMETERS: register_id - Index of ACPI Register to access + * + * RETURN: The bitmask to be used when accessing the register + * + * DESCRIPTION: Map register_id into a register bitmask. + * + ******************************************************************************/ +struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) +{ + ACPI_FUNCTION_ENTRY(); + + if (register_id > ACPI_BITREG_MAX) { + ACPI_DEBUG_PRINT((AE_INFO, "Invalid BitRegister ID: %X", + register_id)); + return (NULL); + } + + return (&acpi_gbl_bit_register_info[register_id]); +} + +/******************************************************************************* + * + * FUNCTION: acpi_get_register + * + * PARAMETERS: register_id - ID of ACPI bit_register to access + * return_value - Value that was read from the register + * + * RETURN: Status and the value read from specified Register. Value + * returned is normalized to bit0 (is shifted all the way right) + * + * DESCRIPTION: ACPI bit_register read function. + * + ******************************************************************************/ + +acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value) +{ + u32 register_value = 0; + struct acpi_bit_register_info *bit_reg_info; + acpi_status status; + + ACPI_FUNCTION_TRACE(acpi_get_register); + + /* Get the info structure corresponding to the requested ACPI Register */ + + bit_reg_info = acpi_hw_get_bit_register_info(register_id); + if (!bit_reg_info) { + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + + /* Read from the register */ + + status = acpi_hw_register_read(bit_reg_info->parent_register, + ®ister_value); + + if (ACPI_SUCCESS(status)) { + + /* Normalize the value that was read */ + + register_value = + ((register_value & bit_reg_info->access_bit_mask) + >> bit_reg_info->bit_position); + + *return_value = register_value; + + ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n", + register_value, + bit_reg_info->parent_register)); + } + + return_ACPI_STATUS(status); +} + +acpi_status acpi_get_register(u32 register_id, u32 * return_value) +{ + acpi_status status; + //acpi_cpu_flags flags; + //flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); + status = acpi_get_register_unlocked(register_id, return_value); + //acpi_os_release_lock(acpi_gbl_hardware_lock, flags); + return status; +} + +/******************************************************************************* + * + * FUNCTION: acpi_set_register + * + * PARAMETERS: register_id - ID of ACPI bit_register to access + * Value - (only used on write) value to write to the + * Register, NOT pre-normalized to the bit pos + * + * RETURN: Status + * + * DESCRIPTION: ACPI Bit Register write function. + * + ******************************************************************************/ +acpi_status acpi_set_register(u32 register_id, u32 value) +{ + u32 register_value = 0; + struct acpi_bit_register_info *bit_reg_info; + acpi_status status; + //acpi_cpu_flags lock_flags; + + ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); + + /* Get the info structure corresponding to the requested ACPI Register */ + + bit_reg_info = acpi_hw_get_bit_register_info(register_id); + if (!bit_reg_info) { + ACPI_DEBUG_PRINT((AE_INFO, "Bad ACPI HW RegisterId: %X", + register_id)); + return_ACPI_STATUS(AE_BAD_PARAMETER); + } + + //lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); + + /* Always do a register read first so we can insert the new bits */ + + status = acpi_hw_register_read(bit_reg_info->parent_register, + ®ister_value); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } + + /* + * Decode the Register ID + * Register ID = [Register block ID] | [bit ID] + * + * Check bit ID to fine locate Register offset. + * Check Mask to determine Register offset, and then read-write. + */ + switch (bit_reg_info->parent_register) { + case ACPI_REGISTER_PM1_STATUS: + + /* + * Status Registers are different from the rest. Clear by + * writing 1, and writing 0 has no effect. So, the only relevant + * information is the single bit we're interested in, all others should + * be written as 0 so they will be left unchanged. + */ + value = ACPI_REGISTER_PREPARE_BITS(value, + bit_reg_info->bit_position, + bit_reg_info-> + access_bit_mask); + if (value) { + status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS, + (u16) value); + register_value = 0; + } + break; + + case ACPI_REGISTER_PM1_ENABLE: + + ACPI_REGISTER_INSERT_VALUE(register_value, + bit_reg_info->bit_position, + bit_reg_info->access_bit_mask, + value); + + status = acpi_hw_register_write(ACPI_REGISTER_PM1_ENABLE, + (u16) register_value); + break; + + case ACPI_REGISTER_PM1_CONTROL: + + /* + * Write the PM1 Control register. + * Note that at this level, the fact that there are actually TWO + * registers (A and B - and B may not exist) is abstracted. + */ + ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n", + register_value)); + + ACPI_REGISTER_INSERT_VALUE(register_value, + bit_reg_info->bit_position, + bit_reg_info->access_bit_mask, + value); + + status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL, + (u16) register_value); + break; + + case ACPI_REGISTER_PM2_CONTROL: + + status = acpi_hw_register_read(ACPI_REGISTER_PM2_CONTROL, + ®ister_value); + if (ACPI_FAILURE(status)) { + goto unlock_and_exit; + } + + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "PM2 control: Read %X from %8.8X%8.8X\n", + register_value, + ACPI_FORMAT_UINT64(acpi_gbl_FADT. + xpm2_control_block. + address))); + + ACPI_REGISTER_INSERT_VALUE(register_value, + bit_reg_info->bit_position, + bit_reg_info->access_bit_mask, + value); + + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "About to write %4.4X to %8.8X%8.8X\n", + register_value, + ACPI_FORMAT_UINT64(acpi_gbl_FADT. + xpm2_control_block. + address))); + + status = acpi_hw_register_write(ACPI_REGISTER_PM2_CONTROL, + (u8) (register_value)); + break; + + default: + break; + } + + unlock_and_exit: + + //acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); + + /* Normalize the value that was read */ + + ACPI_DEBUG_EXEC(register_value = + ((register_value & bit_reg_info->access_bit_mask) >> + bit_reg_info->bit_position)); + + ACPI_DEBUG_PRINT((ACPI_DB_IO, + "Set bits: %8.8X actual %8.8X register %X\n", value, + register_value, bit_reg_info->parent_register)); + return_ACPI_STATUS(status); +} + /****************************************************************************** * * FUNCTION: acpi_hw_register_read @@ -79,7 +314,7 @@ acpi_hw_register_read(u32 register_id, u status = acpi_hw_low_level_read(16, &value1, - &acpi_sinfo.pm1a_evt_blk); + &acpi_gbl_FADT.xpm1a_event_block); if (ACPI_FAILURE(status)) { goto exit; } @@ -88,28 +323,62 @@ acpi_hw_register_read(u32 register_id, u status = acpi_hw_low_level_read(16, &value2, - &acpi_sinfo.pm1b_evt_blk); + &acpi_gbl_FADT.xpm1b_event_block); value1 |= value2; break; + case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ + + status = + acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable); + if (ACPI_FAILURE(status)) { + goto exit; + } + + /* PM1B is optional */ + + status = + acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable); + value1 |= value2; + break; case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ status = acpi_hw_low_level_read(16, &value1, - &acpi_sinfo.pm1a_cnt_blk); + &acpi_gbl_FADT.xpm1a_control_block); if (ACPI_FAILURE(status)) { goto exit; } status = acpi_hw_low_level_read(16, &value2, - &acpi_sinfo.pm1b_cnt_blk); + &acpi_gbl_FADT.xpm1b_control_block); value1 |= value2; break; + case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ + + status = + acpi_hw_low_level_read(8, &value1, + &acpi_gbl_FADT.xpm2_control_block); + break; + + case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ + + status = + acpi_hw_low_level_read(32, &value1, + &acpi_gbl_FADT.xpm_timer_block); + break; + + case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ + + status = + acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8); + break; default: + ACPI_DEBUG_PRINT((AE_INFO, "Unknown Register ID: %X", register_id)); status = AE_BAD_PARAMETER; break; } @@ -127,7 +396,7 @@ acpi_hw_register_read(u32 register_id, u * * FUNCTION: acpi_hw_register_write * - * PARAMETERS: register_id - ACPI Register ID + * PARAMETERS: register_id - ACPI Register ID * Value - The value to write * * RETURN: Status @@ -156,7 +425,7 @@ acpi_status acpi_hw_register_write(u32 r ACPI_FUNCTION_TRACE(hw_register_write); - switch (register_id) { //By now we just need handle PM1 status/PM1 control + switch (register_id) { case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ /* Perform a read first to preserve certain bits (per ACPI spec) */ @@ -176,7 +445,7 @@ acpi_status acpi_hw_register_write(u32 r status = acpi_hw_low_level_write(16, value, - &acpi_sinfo.pm1a_evt_blk); + &acpi_gbl_FADT.xpm1a_event_block); if (ACPI_FAILURE(status)) { goto exit; } @@ -185,16 +454,27 @@ acpi_status acpi_hw_register_write(u32 r status = acpi_hw_low_level_write(16, value, - &acpi_sinfo.pm1b_evt_blk); - break; - + &acpi_gbl_FADT.xpm1b_event_block); + break; + + case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ + + status = + acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable); + if (ACPI_FAILURE(status)) { + goto exit; + } + + /* PM1B is optional */ + + status = + acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable); + break; case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ /* * Perform a read first to preserve certain bits (per ACPI spec) - * - * Note: This includes SCI_EN, we never want to change this bit */ status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, &read_value); @@ -211,30 +491,51 @@ acpi_status acpi_hw_register_write(u32 r status = acpi_hw_low_level_write(16, value, - &acpi_sinfo.pm1a_cnt_blk); + &acpi_gbl_FADT.xpm1a_control_block); if (ACPI_FAILURE(status)) { goto exit; } status = acpi_hw_low_level_write(16, value, - &acpi_sinfo.pm1b_cnt_blk); + &acpi_gbl_FADT.xpm1b_control_block); break; case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ status = acpi_hw_low_level_write(16, value, - &acpi_sinfo.pm1a_cnt_blk); + &acpi_gbl_FADT.xpm1a_control_block); break; case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ status = acpi_hw_low_level_write(16, value, - &acpi_sinfo.pm1b_cnt_blk); - break; - + &acpi_gbl_FADT.xpm1b_control_block); + break; + + case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ + + status = + acpi_hw_low_level_write(8, value, + &acpi_gbl_FADT.xpm2_control_block); + break; + + case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ + + status = + acpi_hw_low_level_write(32, value, + &acpi_gbl_FADT.xpm_timer_block); + break; + + case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ + + /* SMI_CMD is currently always in IO space */ + + status = + acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8); + break; default: status = AE_BAD_PARAMETER; @@ -242,7 +543,6 @@ acpi_status acpi_hw_register_write(u32 r } exit: - return_ACPI_STATUS(status); } @@ -383,3 +683,4 @@ acpi_hw_low_level_write(u32 width, u32 v return (status); } + diff -r 74cae5c11f0a -r 93bc6d9b5f31 xen/drivers/acpi/utglobal.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/drivers/acpi/utglobal.c Thu May 01 10:41:51 2008 +0100 @@ -0,0 +1,136 @@ +/****************************************************************************** + * + * Module Name: utglobal - Global variables for the ACPI subsystem + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2007, R. Byron Moore + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +//#define DEFINE_ACPI_GLOBALS + +#include +//#include + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME("utglobal") + +struct acpi_table_fadt acpi_gbl_FADT; + +/* These addresses are calculated from FADT address values */ + +struct acpi_generic_address acpi_gbl_xpm1a_enable; +struct acpi_generic_address acpi_gbl_xpm1b_enable; + +/****************************************************************************** + * + * Event and Hardware globals + * + ******************************************************************************/ + +struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = { + /* Name Parent Register Register Bit Position Register Bit Mask */ + + /* ACPI_BITREG_TIMER_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_TIMER_STATUS, + ACPI_BITMASK_TIMER_STATUS}, + /* ACPI_BITREG_BUS_MASTER_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_BUS_MASTER_STATUS, + ACPI_BITMASK_BUS_MASTER_STATUS}, + /* ACPI_BITREG_GLOBAL_LOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_GLOBAL_LOCK_STATUS, + ACPI_BITMASK_GLOBAL_LOCK_STATUS}, + /* ACPI_BITREG_POWER_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_POWER_BUTTON_STATUS, + ACPI_BITMASK_POWER_BUTTON_STATUS}, + /* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, + ACPI_BITMASK_SLEEP_BUTTON_STATUS}, + /* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_RT_CLOCK_STATUS, + ACPI_BITMASK_RT_CLOCK_STATUS}, + /* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_WAKE_STATUS, + ACPI_BITMASK_WAKE_STATUS}, + /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, + ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, + ACPI_BITMASK_PCIEXP_WAKE_STATUS}, + + /* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_TIMER_ENABLE, + ACPI_BITMASK_TIMER_ENABLE}, + /* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, + ACPI_BITMASK_GLOBAL_LOCK_ENABLE}, + /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_POWER_BUTTON_ENABLE, + ACPI_BITMASK_POWER_BUTTON_ENABLE}, + /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, + ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, + /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_RT_CLOCK_ENABLE, + ACPI_BITMASK_RT_CLOCK_ENABLE}, + /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0}, + /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, + ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, + ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, + + /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_SCI_ENABLE, + ACPI_BITMASK_SCI_ENABLE}, + /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_BUS_MASTER_RLD, + ACPI_BITMASK_BUS_MASTER_RLD}, + /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, + ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, + /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_SLEEP_TYPE_X, + ACPI_BITMASK_SLEEP_TYPE_X}, + /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_SLEEP_TYPE_X, + ACPI_BITMASK_SLEEP_TYPE_X}, + /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, + ACPI_BITPOSITION_SLEEP_ENABLE, + ACPI_BITMASK_SLEEP_ENABLE}, + + /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, + ACPI_BITPOSITION_ARB_DISABLE, + ACPI_BITMASK_ARB_DISABLE} +}; + _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra4B-0004Oi-2l for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4h-00044E-Sf; Thu, 01 May 2008 14:47:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDD-0000NN-RB for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:27 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWCn-0000OS-Ki for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:25 +0000 X-SBRS: 3.6 X-MesageID: 107388 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107388" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:03 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A03wU010652 for ; Thu, 1 May 2008 03:00:03 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0L79015450 for ; Thu, 1 May 2008 03:00:21 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0Ln9015448 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:21 -0700 Message-Id: <200805011000.m41A0Ln9015448@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:20 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add basic acpi C-states based cpu idle power mgmt in xen for x86. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634801 -3600 # Node ID 5bb9093eb0e9abfcf8537148ba088fd2604e5737 # Parent ad55c06c9bbc31e4e3db2944f3a1fcbf842bd4aa Add basic acpi C-states based cpu idle power mgmt in xen for x86. It includes: 1. hypercall definition for passing ACPI info. 2. C1/C2 support. 3. Mwait support, as well as legacy ioport. 4. Ladder policy from Linux kernel. A lot of code & ideas came from Linux. Signed-off-by: Wei Gang --- xen/arch/x86/acpi/Makefile | 2 xen/arch/x86/acpi/cpu_idle.c | 690 +++++++++++++++++++++++++++++++ xen/arch/x86/domain.c | 5 xen/arch/x86/platform_hypercall.c | 23 + xen/arch/x86/x86_64/Makefile | 2 xen/arch/x86/x86_64/cpu_idle.c | 128 +++++ xen/arch/x86/x86_64/platform_hypercall.c | 4 xen/include/public/platform.h | 65 ++ xen/include/xlat.lst | 5 9 files changed, 922 insertions(+), 2 deletions(-) diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/arch/x86/acpi/Makefile --- a/xen/arch/x86/acpi/Makefile Thu May 01 10:33:03 2008 +0100 +++ b/xen/arch/x86/acpi/Makefile Thu May 01 10:40:01 2008 +0100 @@ -1,2 +1,2 @@ obj-y += boot.o obj-y += boot.o -obj-y += power.o suspend.o wakeup_prot.o +obj-y += power.o suspend.o wakeup_prot.o cpu_idle.o diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/arch/x86/acpi/cpu_idle.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/acpi/cpu_idle.c Thu May 01 10:40:01 2008 +0100 @@ -0,0 +1,690 @@ +/* + * cpu_idle - xen idle state module derived from Linux + * drivers/acpi/processor_idle.c & + * arch/x86/kernel/acpi/cstate.c + * + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * Copyright (C) 2004, 2005 Dominik Brodowski + * Copyright (C) 2004 Anil S Keshavamurthy + * - Added processor hotplug support + * Copyright (C) 2005 Venkatesh Pallipadi + * - Added support for C3 on SMP + * Copyright (C) 2007, 2008 Intel Corporation + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_PM_CX + +#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) +#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ +#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ + +#define ACPI_PROCESSOR_MAX_POWER 8 +#define ACPI_PROCESSOR_MAX_C2_LATENCY 100 +#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000 + +extern u32 pmtmr_ioport; +extern void (*pm_idle) (void); + +static void (*pm_idle_save) (void) __read_mostly; +unsigned int max_cstate __read_mostly = 2; +integer_param("max_cstate", max_cstate); + +struct acpi_processor_cx; + +struct acpi_processor_cx_policy +{ + u32 count; + struct acpi_processor_cx *state; + struct + { + u32 time; + u32 ticks; + u32 count; + u32 bm; + } threshold; +}; + +struct acpi_processor_cx +{ + u8 valid; + u8 type; + u32 address; + u8 space_id; + u32 latency; + u32 latency_ticks; + u32 power; + u32 usage; + u64 time; + struct acpi_processor_cx_policy promotion; + struct acpi_processor_cx_policy demotion; +}; + +struct acpi_processor_power +{ + struct acpi_processor_cx *state; + u64 bm_check_timestamp; + u32 default_state; + u32 bm_activity; + u32 count; + struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; +}; + +static struct acpi_processor_power processor_powers[NR_CPUS]; + +static void print_acpi_power(uint32_t cpu, struct acpi_processor_power *power) +{ + uint32_t i; + + printk("saved cpu%d cx acpi info:\n", cpu); + printk("\tcurrent state is C%d\n", (power->state)?power->state->type:-1); + printk("\tbm_check_timestamp = %"PRId64"\n", power->bm_check_timestamp); + printk("\tdefault_state = %d\n", power->default_state); + printk("\tbm_activity = 0x%08x\n", power->bm_activity); + printk("\tcount = %d\n", power->count); + + for ( i = 0; i < power->count; i++ ) + { + printk("\tstates[%d]:\n", i); + printk("\t\tvalid = %d\n", power->states[i].valid); + printk("\t\ttype = %d\n", power->states[i].type); + printk("\t\taddress = 0x%x\n", power->states[i].address); + printk("\t\tspace_id = 0x%x\n", power->states[i].space_id); + printk("\t\tlatency = %d\n", power->states[i].latency); + printk("\t\tpower = %d\n", power->states[i].power); + printk("\t\tlatency_ticks = %d\n", power->states[i].latency_ticks); + printk("\t\tusage = %d\n", power->states[i].usage); + printk("\t\ttime = %"PRId64"\n", power->states[i].time); + + printk("\t\tpromotion policy:\n"); + printk("\t\t\tcount = %d\n", power->states[i].promotion.count); + printk("\t\t\tstate = C%d\n", + (power->states[i].promotion.state) ? + power->states[i].promotion.state->type : -1); + printk("\t\t\tthreshold.time = %d\n", power->states[i].promotion.threshold.time); + printk("\t\t\tthreshold.ticks = %d\n", power->states[i].promotion.threshold.ticks); + printk("\t\t\tthreshold.count = %d\n", power->states[i].promotion.threshold.count); + printk("\t\t\tthreshold.bm = %d\n", power->states[i].promotion.threshold.bm); + + printk("\t\tdemotion policy:\n"); + printk("\t\t\tcount = %d\n", power->states[i].demotion.count); + printk("\t\t\tstate = C%d\n", + (power->states[i].demotion.state) ? + power->states[i].demotion.state->type : -1); + printk("\t\t\tthreshold.time = %d\n", power->states[i].demotion.threshold.time); + printk("\t\t\tthreshold.ticks = %d\n", power->states[i].demotion.threshold.ticks); + printk("\t\t\tthreshold.count = %d\n", power->states[i].demotion.threshold.count); + printk("\t\t\tthreshold.bm = %d\n", power->states[i].demotion.threshold.bm); + } +} + +static void dump_cx(unsigned char key) +{ + for( int i = 0; i < num_online_cpus(); i++ ) + print_acpi_power(i, &processor_powers[i]); +} + +static int __init cpu_idle_key_init(void) +{ + register_keyhandler( + 'c', dump_cx, "dump cx structures"); + return 0; +} +__initcall(cpu_idle_key_init); + +static inline u32 ticks_elapsed(u32 t1, u32 t2) +{ + if ( t2 >= t1 ) + return (t2 - t1); + else + return ((0xFFFFFFFF - t1) + t2); +} + +static void acpi_processor_power_activate(struct acpi_processor_power *power, + struct acpi_processor_cx *new) +{ + struct acpi_processor_cx *old; + + if ( !power || !new ) + return; + + old = power->state; + + if ( old ) + old->promotion.count = 0; + new->demotion.count = 0; + + power->state = new; + + return; +} + +static void acpi_safe_halt(void) +{ + smp_mb__after_clear_bit(); + safe_halt(); +} + +#define MWAIT_ECX_INTERRUPT_BREAK (0x1) + +static void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) +{ + __monitor((void *)current, 0, 0); + smp_mb(); + __mwait(eax, ecx); +} + +static void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx) +{ + mwait_idle_with_hints(cx->address, MWAIT_ECX_INTERRUPT_BREAK); +} + +static void acpi_idle_do_entry(struct acpi_processor_cx *cx) +{ + if ( cx->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE ) + { + /* Call into architectural FFH based C-state */ + acpi_processor_ffh_cstate_enter(cx); + } + else + { + int unused; + /* IO port based C-state */ + inb(cx->address); + /* Dummy wait op - must do something useless after P_LVL2 read + because chipsets cannot guarantee that STPCLK# signal + gets asserted in time to freeze execution properly. */ + unused = inl(pmtmr_ioport); + } +} + +static void acpi_processor_idle(void) +{ + struct acpi_processor_power *power = NULL; + struct acpi_processor_cx *cx = NULL; + struct acpi_processor_cx *next_state = NULL; + int sleep_ticks = 0; + u32 t1, t2 = 0; + + power = &processor_powers[smp_processor_id()]; + + /* + * Interrupts must be disabled during bus mastering calculations and + * for C2/C3 transitions. + */ + local_irq_disable(); + cx = power->state; + if ( !cx ) + { + if ( pm_idle_save ) + { + printk(XENLOG_DEBUG "call pm_idle_save()\n"); + pm_idle_save(); + } + else + { + printk(XENLOG_DEBUG "call acpi_safe_halt()\n"); + acpi_safe_halt(); + } + return; + } + + /* + * Sleep: + * ------ + * Invoke the current Cx state to put the processor to sleep. + */ + if ( cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3 ) + smp_mb__after_clear_bit(); + + switch ( cx->type ) + { + case ACPI_STATE_C1: + /* + * Invoke C1. + * Use the appropriate idle routine, the one that would + * be used without acpi C-states. + */ + if ( pm_idle_save ) + pm_idle_save(); + else + acpi_safe_halt(); + + /* + * TBD: Can't get time duration while in C1, as resumes + * go to an ISR rather than here. Need to instrument + * base interrupt handler. + */ + sleep_ticks = 0xFFFFFFFF; + break; + + case ACPI_STATE_C2: + /* Get start time (ticks) */ + t1 = inl(pmtmr_ioport); + /* Invoke C2 */ + acpi_idle_do_entry(cx); + /* Get end time (ticks) */ + t2 = inl(pmtmr_ioport); + + /* Re-enable interrupts */ + local_irq_enable(); + /* Compute time (ticks) that we were actually asleep */ + sleep_ticks = + ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; + break; + default: + local_irq_enable(); + return; + } + + cx->usage++; + if ( (cx->type != ACPI_STATE_C1) && (sleep_ticks > 0) ) + cx->time += sleep_ticks; + + next_state = power->state; + + /* + * Promotion? + * ---------- + * Track the number of longs (time asleep is greater than threshold) + * and promote when the count threshold is reached. Note that bus + * mastering activity may prevent promotions. + * Do not promote above max_cstate. + */ + if ( cx->promotion.state && + ((cx->promotion.state - power->states) <= max_cstate) ) + { + if ( sleep_ticks > cx->promotion.threshold.ticks ) + { + cx->promotion.count++; + cx->demotion.count = 0; + if ( cx->promotion.count >= cx->promotion.threshold.count ) + { + next_state = cx->promotion.state; + goto end; + } + } + } + + /* + * Demotion? + * --------- + * Track the number of shorts (time asleep is less than time threshold) + * and demote when the usage threshold is reached. + */ + if ( cx->demotion.state ) + { + if ( sleep_ticks < cx->demotion.threshold.ticks ) + { + cx->demotion.count++; + cx->promotion.count = 0; + if ( cx->demotion.count >= cx->demotion.threshold.count ) + { + next_state = cx->demotion.state; + goto end; + } + } + } + +end: + /* + * Demote if current state exceeds max_cstate + */ + if ( (power->state - power->states) > max_cstate ) + { + if ( cx->demotion.state ) + next_state = cx->demotion.state; + } + + /* + * New Cx State? + * ------------- + * If we're going to start using a new Cx state we must clean up + * from the previous and prepare to use the new. + */ + if ( next_state != power->state ) + acpi_processor_power_activate(power, next_state); +} + +static int acpi_processor_set_power_policy(struct acpi_processor_power *power) +{ + unsigned int i; + unsigned int state_is_set = 0; + struct acpi_processor_cx *lower = NULL; + struct acpi_processor_cx *higher = NULL; + struct acpi_processor_cx *cx; + + if ( !power ) + return -EINVAL; + + /* + * This function sets the default Cx state policy (OS idle handler). + * Our scheme is to promote quickly to C2 but more conservatively + * to C3. We're favoring C2 for its characteristics of low latency + * (quick response), good power savings, and ability to allow bus + * mastering activity. Note that the Cx state policy is completely + * customizable and can be altered dynamically. + */ + + /* startup state */ + for ( i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++ ) + { + cx = &power->states[i]; + if ( !cx->valid ) + continue; + + if ( !state_is_set ) + power->state = cx; + state_is_set++; + break; + } + + if ( !state_is_set ) + return -ENODEV; + + /* demotion */ + for ( i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++ ) + { + cx = &power->states[i]; + if ( !cx->valid ) + continue; + + if ( lower ) + { + cx->demotion.state = lower; + cx->demotion.threshold.ticks = cx->latency_ticks; + cx->demotion.threshold.count = 1; + } + + lower = cx; + } + + /* promotion */ + for ( i = (ACPI_PROCESSOR_MAX_POWER - 1); i > 0; i-- ) + { + cx = &power->states[i]; + if ( !cx->valid ) + continue; + + if ( higher ) + { + cx->promotion.state = higher; + cx->promotion.threshold.ticks = cx->latency_ticks; + if ( cx->type >= ACPI_STATE_C2 ) + cx->promotion.threshold.count = 4; + else + cx->promotion.threshold.count = 10; + } + + higher = cx; + } + + return 0; +} + +static int init_cx_pminfo(struct acpi_processor_power *acpi_power) +{ + memset(acpi_power, 0, sizeof(*acpi_power)); + + acpi_power->states[ACPI_STATE_C1].type = ACPI_STATE_C1; + + acpi_power->states[ACPI_STATE_C0].valid = 1; + acpi_power->states[ACPI_STATE_C1].valid = 1; + + acpi_power->count = 2; + + return 0; +} + +#define CPUID_MWAIT_LEAF (5) +#define CPUID5_ECX_EXTENSIONS_SUPPORTED (0x1) +#define CPUID5_ECX_INTERRUPT_BREAK (0x2) + +#define MWAIT_ECX_INTERRUPT_BREAK (0x1) + +#define MWAIT_SUBSTATE_MASK (0xf) +#define MWAIT_SUBSTATE_SIZE (4) + +static int acpi_processor_ffh_cstate_probe(xen_processor_cx_t *cx) +{ + struct cpuinfo_x86 *c = ¤t_cpu_data; + unsigned int eax, ebx, ecx, edx; + unsigned int edx_part; + unsigned int cstate_type; /* C-state type and not ACPI C-state type */ + unsigned int num_cstate_subtype; + + if ( c->cpuid_level < CPUID_MWAIT_LEAF ) + { + printk(XENLOG_INFO "MWAIT leaf not supported by cpuid\n"); + return -EFAULT; + } + + cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); + printk(XENLOG_DEBUG "cpuid.MWAIT[.eax=%x, .ebx=%x, .ecx=%x, .edx=%x]\n", + eax, ebx, ecx, edx); + + /* Check whether this particular cx_type (in CST) is supported or not */ + cstate_type = (cx->reg.address >> MWAIT_SUBSTATE_SIZE) + 1; + edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE); + num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; + + if ( num_cstate_subtype < (cx->reg.address & MWAIT_SUBSTATE_MASK) ) + return -EFAULT; + + /* mwait ecx extensions INTERRUPT_BREAK should be supported for C2/C3 */ + if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || + !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ) + return -EFAULT; + + printk(XENLOG_INFO "Monitor-Mwait will be used to enter C-%d state\n", cx->type); + return 0; +} + +#define VENDOR_INTEL (1) +#define NATIVE_CSTATE_BEYOND_HALT (2) + +static int check_cx(xen_processor_cx_t *cx) +{ + if ( cx == NULL ) + return -EINVAL; + + switch ( cx->reg.space_id ) + { + case ACPI_ADR_SPACE_SYSTEM_IO: + if ( cx->reg.address == 0 ) + return -EINVAL; + break; + + case ACPI_ADR_SPACE_FIXED_HARDWARE: + if ( cx->type > ACPI_STATE_C1 ) + { + if ( cx->reg.bit_width != VENDOR_INTEL || + cx->reg.bit_offset != NATIVE_CSTATE_BEYOND_HALT ) + return -EINVAL; + + /* assume all logical cpu has the same support for mwait */ + if ( acpi_processor_ffh_cstate_probe(cx) ) + return -EFAULT; + } + break; + + default: + return -ENODEV; + } + + return 0; +} + +static int set_cx(struct acpi_processor_power *acpi_power, + xen_processor_cx_t *xen_cx) +{ + struct acpi_processor_cx *cx; + + /* skip unsupported acpi cstate */ + if ( check_cx(xen_cx) ) + return -EFAULT; + + cx = &acpi_power->states[xen_cx->type]; + if ( !cx->valid ) + acpi_power->count++; + + cx->valid = 1; + cx->type = xen_cx->type; + cx->address = xen_cx->reg.address; + cx->space_id = xen_cx->reg.space_id; + cx->latency = xen_cx->latency; + cx->power = xen_cx->power; + + cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); + + return 0; +} + +static int get_cpu_id(u8 acpi_id) +{ + int i; + u8 apic_id; + + apic_id = x86_acpiid_to_apicid[acpi_id]; + if ( apic_id == 0xff ) + return -1; + + for ( i = 0; i < NR_CPUS; i++ ) + { + if ( apic_id == x86_cpu_to_apicid[i] ) + return i; + } + + return -1; +} + +#ifdef DEBUG_PM_CX +static void print_cx_pminfo(uint32_t cpu, struct xen_processor_power *power) +{ + XEN_GUEST_HANDLE(xen_processor_cx_t) states; + xen_processor_cx_t state; + XEN_GUEST_HANDLE(xen_processor_csd_t) csd; + xen_processor_csd_t dp; + uint32_t i; + + printk("cpu%d cx acpi info:\n", cpu); + printk("\tcount = %d\n", power->count); + printk("\tflags: bm_cntl[%d], bm_chk[%d], has_cst[%d],\n" + "\t pwr_setup_done[%d], bm_rld_set[%d]\n", + power->flags.bm_control, power->flags.bm_check, power->flags.has_cst, + power->flags.power_setup_done, power->flags.bm_rld_set); + + states = power->states; + + for ( i = 0; i < power->count; i++ ) + { + if ( unlikely(copy_from_guest_offset(&state, states, i, 1)) ) + return; + + printk("\tstates[%d]:\n", i); + printk("\t\treg.space_id = 0x%x\n", state.reg.space_id); + printk("\t\treg.bit_width = 0x%x\n", state.reg.bit_width); + printk("\t\treg.bit_offset = 0x%x\n", state.reg.bit_offset); + printk("\t\treg.access_size = 0x%x\n", state.reg.access_size); + printk("\t\treg.address = 0x%"PRIx64"\n", state.reg.address); + printk("\t\ttype = %d\n", state.type); + printk("\t\tlatency = %d\n", state.latency); + printk("\t\tpower = %d\n", state.power); + + csd = state.dp; + printk("\t\tdp(@0x%p)\n", csd.p); + + if ( csd.p != NULL ) + { + if ( unlikely(copy_from_guest(&dp, csd, 1)) ) + return; + printk("\t\t\tdomain = %d\n", dp.domain); + printk("\t\t\tcoord_type = %d\n", dp.coord_type); + printk("\t\t\tnum = %d\n", dp.num); + } + } +} +#else +#define print_cx_pminfo(c, p) +#endif + +long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power) +{ + XEN_GUEST_HANDLE(xen_processor_cx_t) states; + xen_processor_cx_t xen_cx; + struct acpi_processor_power *acpi_power; + int cpu_id, i; + + if ( unlikely(!guest_handle_okay(power->states, power->count)) ) + return -EFAULT; + + print_cx_pminfo(cpu, power); + + /* map from acpi_id to cpu_id */ + cpu_id = get_cpu_id((u8)cpu); + if ( cpu_id == -1 ) + { + printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu); + return -EFAULT; + } + + acpi_power = &processor_powers[cpu_id]; + + init_cx_pminfo(acpi_power); + + states = power->states; + + for ( i = 0; i < power->count; i++ ) + { + if ( unlikely(copy_from_guest_offset(&xen_cx, states, i, 1)) ) + return -EFAULT; + + set_cx(acpi_power, &xen_cx); + } + + /* FIXME: C-state dependency is not supported by far */ + + /* initialize default policy */ + acpi_processor_set_power_policy(acpi_power); + + print_acpi_power(cpu_id, acpi_power); + + if ( cpu_id == 0 && pm_idle_save == NULL ) + { + pm_idle_save = pm_idle; + pm_idle = acpi_processor_idle; + } + + return 0; +} diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Thu May 01 10:33:03 2008 +0100 +++ b/xen/arch/x86/domain.c Thu May 01 10:40:01 2008 +0100 @@ -56,6 +56,9 @@ DEFINE_PER_CPU(u64, efer); DEFINE_PER_CPU(u64, efer); DEFINE_PER_CPU(unsigned long, cr4); +static void default_idle(void); +void (*pm_idle) (void) = default_idle; + static void unmap_vcpu_info(struct vcpu *v); static void paravirt_ctxt_switch_from(struct vcpu *v); @@ -105,7 +108,7 @@ void idle_loop(void) if ( cpu_is_offline(smp_processor_id()) ) play_dead(); page_scrub_schedule_work(); - default_idle(); + (*pm_idle)(); do_softirq(); } } diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/arch/x86/platform_hypercall.c --- a/xen/arch/x86/platform_hypercall.c Thu May 01 10:33:03 2008 +0100 +++ b/xen/arch/x86/platform_hypercall.c Thu May 01 10:40:01 2008 +0100 @@ -44,6 +44,8 @@ extern spinlock_t xenpf_lock; static DEFINE_PER_CPU(uint64_t, freq); +extern long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power); + static long cpu_frequency_change_helper(void *data) { return cpu_frequency_change(this_cpu(freq)); @@ -340,6 +342,27 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe } break; + case XENPF_set_processor_pminfo: + switch ( op->u.set_pminfo.type ) + { + case XEN_PM_PX: + ret = -EINVAL; + break; + + case XEN_PM_CX: + ret = set_cx_pminfo(op->u.set_pminfo.id, &op->u.set_pminfo.power); + break; + + case XEN_PM_TX: + ret = -EINVAL; + break; + + default: + ret = -EINVAL; + break; + } + break; + default: ret = -ENOSYS; break; diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/arch/x86/x86_64/Makefile --- a/xen/arch/x86/x86_64/Makefile Thu May 01 10:33:03 2008 +0100 +++ b/xen/arch/x86/x86_64/Makefile Thu May 01 10:40:01 2008 +0100 @@ -12,6 +12,7 @@ obj-$(CONFIG_COMPAT) += domain.o obj-$(CONFIG_COMPAT) += domain.o obj-$(CONFIG_COMPAT) += physdev.o obj-$(CONFIG_COMPAT) += platform_hypercall.o +obj-$(CONFIG_COMPAT) += cpu_idle.o ifeq ($(CONFIG_COMPAT),y) # extra dependencies @@ -22,4 +23,5 @@ platform_hypercall.o: ../platform_hyperc platform_hypercall.o: ../platform_hypercall.c sysctl.o: ../sysctl.c traps.o: compat/traps.c +cpu_idle.o: ../acpi/cpu_idle.c endif diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/arch/x86/x86_64/cpu_idle.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/x86_64/cpu_idle.c Thu May 01 10:40:01 2008 +0100 @@ -0,0 +1,128 @@ +/****************************************************************************** + * cpu_idle.c -- adapt x86/acpi/cpu_idle.c to compat guest. + * + * Copyright (C) 2007, 2008 Intel Corporation + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#define __XEN_TOOLS__ /* for using get_xen_guest_handle macro */ + +#include +#include +#include +#include +#include + +CHECK_processor_csd; + +DEFINE_XEN_GUEST_HANDLE(compat_processor_csd_t); +DEFINE_XEN_GUEST_HANDLE(compat_processor_cx_t); + +#define xlat_page_start COMPAT_ARG_XLAT_VIRT_START(current->vcpu_id) +#define xlat_page_size COMPAT_ARG_XLAT_SIZE +#define xlat_page_left_size(xlat_page_current) \ + (xlat_page_start + xlat_page_size - xlat_page_current) + +#define xlat_malloc_init(xlat_page_current) do { \ + xlat_page_current = xlat_page_start; \ +} while (0) + +static void *xlat_malloc(unsigned long *xlat_page_current, size_t size) +{ + void *ret; + + /* normalize size to be 64 * n */ + size = (size + 0x3fUL) & ~0x3fUL; + + if ( unlikely(size > xlat_page_left_size(*xlat_page_current)) ) + return NULL; + + ret = (void *) *xlat_page_current; + *xlat_page_current += size; + + return ret; +} + +#define xlat_malloc_array(_p, _t, _c) ((_t *) xlat_malloc(&_p, sizeof(_t) * _c)) + +static int copy_from_compat_state(xen_processor_cx_t *xen_state, + compat_processor_cx_t *state) +{ +#define XLAT_processor_cx_HNDL_dp(_d_, _s_) do { \ + XEN_GUEST_HANDLE(compat_processor_csd_t) dps; \ + if ( unlikely(!compat_handle_okay((_s_)->dp, (_s_)->dpcnt)) ) \ + return -EFAULT; \ + guest_from_compat_handle(dps, (_s_)->dp); \ + (_d_)->dp = guest_handle_cast(dps, xen_processor_csd_t); \ +} while (0) + XLAT_processor_cx(xen_state, state); +#undef XLAT_processor_cx_HNDL_dp + + return 0; +} + +extern long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power); + +long compat_set_cx_pminfo(uint32_t cpu, struct compat_processor_power *power) +{ + struct xen_processor_power *xen_power; + unsigned long xlat_page_current; + + xlat_malloc_init(xlat_page_current); + + xen_power = xlat_malloc_array(xlat_page_current, + struct xen_processor_power, 1); + if ( unlikely(xen_power == NULL) ) + return -EFAULT; + +#define XLAT_processor_power_HNDL_states(_d_, _s_) do { \ + xen_processor_cx_t *xen_states = NULL; \ +\ + if ( likely((_s_)->count > 0) ) \ + { \ + XEN_GUEST_HANDLE(compat_processor_cx_t) states; \ + compat_processor_cx_t state; \ + int i; \ +\ + xen_states = xlat_malloc_array(xlat_page_current, \ + xen_processor_cx_t, (_s_)->count); \ + if ( unlikely(xen_states == NULL) ) \ + return -EFAULT; \ +\ + if ( unlikely(!compat_handle_okay((_s_)->states, (_s_)->count)) ) \ + return -EFAULT; \ + guest_from_compat_handle(states, (_s_)->states); \ +\ + for ( i = 0; i < _s_->count; i++ ) \ + { \ + if ( unlikely(copy_from_guest_offset(&state, states, i, 1)) ) \ + return -EFAULT; \ + if ( unlikely(copy_from_compat_state(&xen_states[i], &state)) ) \ + return -EFAULT; \ + } \ + } \ +\ + set_xen_guest_handle((_d_)->states, xen_states); \ +} while (0) + XLAT_processor_power(xen_power, power); +#undef XLAT_processor_power_HNDL_states + + return set_cx_pminfo(cpu, xen_power); +} diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/arch/x86/x86_64/platform_hypercall.c --- a/xen/arch/x86/x86_64/platform_hypercall.c Thu May 01 10:33:03 2008 +0100 +++ b/xen/arch/x86/x86_64/platform_hypercall.c Thu May 01 10:40:01 2008 +0100 @@ -10,6 +10,10 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_ #define xen_platform_op compat_platform_op #define xen_platform_op_t compat_platform_op_t #define do_platform_op(x) compat_platform_op(_##x) + +#define xen_processor_power compat_processor_power +#define xen_processor_power_t compat_processor_power_t +#define set_cx_pminfo compat_set_cx_pminfo #define xenpf_enter_acpi_sleep compat_pf_enter_acpi_sleep diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/include/public/platform.h --- a/xen/include/public/platform.h Thu May 01 10:33:03 2008 +0100 +++ b/xen/include/public/platform.h Thu May 01 10:40:01 2008 +0100 @@ -199,6 +199,70 @@ typedef struct xenpf_getidletime xenpf_g typedef struct xenpf_getidletime xenpf_getidletime_t; DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t); +#define XENPF_set_processor_pminfo 54 + +/* ability bits */ +#define XEN_PROCESSOR_PM_CX 1 +#define XEN_PROCESSOR_PM_PX 2 +#define XEN_PROCESSOR_PM_TX 4 + +/* cmd type */ +#define XEN_PM_CX 0 +#define XEN_PM_PX 1 +#define XEN_PM_TX 2 + +struct xen_power_register { + uint32_t space_id; + uint32_t bit_width; + uint32_t bit_offset; + uint32_t access_size; + uint64_t address; +}; + +struct xen_processor_csd { + uint32_t domain; /* domain number of one dependent group */ + uint32_t coord_type; /* coordination type */ + uint32_t num; /* number of processors in same domain */ +}; +typedef struct xen_processor_csd xen_processor_csd_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_csd_t); + +struct xen_processor_cx { + struct xen_power_register reg; /* GAS for Cx trigger register */ + uint8_t type; /* cstate value, c0: 0, c1: 1, ... */ + uint32_t latency; /* worst latency (ms) to enter/exit this cstate */ + uint32_t power; /* average power consumption(mW) */ + uint32_t dpcnt; /* number of dependency entries */ + XEN_GUEST_HANDLE(xen_processor_csd_t) dp; /* NULL if no dependency */ +}; +typedef struct xen_processor_cx xen_processor_cx_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_cx_t); + +struct xen_processor_flags { + uint32_t bm_control:1; + uint32_t bm_check:1; + uint32_t has_cst:1; + uint32_t power_setup_done:1; + uint32_t bm_rld_set:1; +}; + +struct xen_processor_power { + uint32_t count; /* number of C state entries in array below */ + struct xen_processor_flags flags; /* global flags of this processor */ + XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */ +}; + +struct xenpf_set_processor_pminfo { + /* IN variables */ + uint32_t id; /* ACPI CPU ID */ + uint32_t type; /* {XEN_PM_CX, ...} */ + union { + struct xen_processor_power power;/* Cx: _CST/_CSD */ + }; +}; +typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; +DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t); + struct xen_platform_op { uint32_t cmd; uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ @@ -213,6 +277,7 @@ struct xen_platform_op { struct xenpf_enter_acpi_sleep enter_acpi_sleep; struct xenpf_change_freq change_freq; struct xenpf_getidletime getidletime; + struct xenpf_set_processor_pminfo set_pminfo; uint8_t pad[128]; } u; }; diff -r ad55c06c9bbc -r 5bb9093eb0e9 xen/include/xlat.lst --- a/xen/include/xlat.lst Thu May 01 10:33:03 2008 +0100 +++ b/xen/include/xlat.lst Thu May 01 10:40:01 2008 +0100 @@ -44,3 +44,8 @@ ! vcpu_runstate_info vcpu.h ? xenoprof_init xenoprof.h ? xenoprof_passive xenoprof.h +! power_register platform.h +? processor_csd platform.h +! processor_cx platform.h +! processor_flags platform.h +! processor_power platform.h _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:43 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:43 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra4U-0004On-K3 for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:43 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra4m-00047c-2H; Thu, 01 May 2008 14:48:00 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDE-0000NS-DU for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:28 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWD3-0000PT-1s for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:26 +0000 X-SBRS: 3.6 X-MesageID: 107391 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107391" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:07 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A078B010661 for ; Thu, 1 May 2008 03:00:07 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0PXQ015521 for ; Thu, 1 May 2008 03:00:25 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0Olp015520 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:25 -0700 Message-Id: <200805011000.m41A0Olp015520@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:24 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add acpi C3 support for x86. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209635219 -3600 # Node ID 520519f5e346034585dfe65b2e6ca5ec3fc49687 # Parent 93bc6d9b5f3186ad5f0221a8e23e524284c3197e Add acpi C3 support for x86. C3 & deep C state will need to do ARB_DIS or cache flush. ARB_DIS should be done within the last cpu which is ready for C3. Bus master activities are checked and recorded for C state promotion/demotion judgement. C3 is disabled by default, till TSC/APIC stop issues resolved. Adding cmdline option "max_cstate=3" can enable C3. Signed-off-by: Wei Gang --- xen/arch/x86/acpi/cpu_idle.c | 280 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 273 insertions(+), 7 deletions(-) diff -r 93bc6d9b5f31 -r 520519f5e346 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Thu May 01 10:41:51 2008 +0100 +++ b/xen/arch/x86/acpi/cpu_idle.c Thu May 01 10:46:59 2008 +0100 @@ -60,6 +60,16 @@ static void (*pm_idle_save) (void) __rea static void (*pm_idle_save) (void) __read_mostly; unsigned int max_cstate __read_mostly = 2; integer_param("max_cstate", max_cstate); +/* + * bm_history -- bit-mask with a bit per jiffy of bus-master activity + * 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms + * 800 HZ: 0xFFFFFFFF: 32 jiffies = 40ms + * 100 HZ: 0x0000000F: 4 jiffies = 40ms + * reduce history for more aggressive entry into C3 + */ +unsigned int bm_history __read_mostly = + (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); +integer_param("bm_history", bm_history); struct acpi_processor_cx; @@ -91,10 +101,20 @@ struct acpi_processor_cx struct acpi_processor_cx_policy demotion; }; +struct acpi_processor_flags +{ + u8 bm_control:1; + u8 bm_check:1; + u8 has_cst:1; + u8 power_setup_done:1; + u8 bm_rld_set:1; +}; + struct acpi_processor_power { + struct acpi_processor_flags flags; struct acpi_processor_cx *state; - u64 bm_check_timestamp; + s_time_t bm_check_timestamp; u32 default_state; u32 bm_activity; u32 count; @@ -185,6 +205,29 @@ static void acpi_processor_power_activat old->promotion.count = 0; new->demotion.count = 0; + /* Cleanup from old state. */ + if ( old ) + { + switch ( old->type ) + { + case ACPI_STATE_C3: + /* Disable bus master reload */ + if ( new->type != ACPI_STATE_C3 && power->flags.bm_check ) + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); + break; + } + } + + /* Prepare to use new state. */ + switch ( new->type ) + { + case ACPI_STATE_C3: + /* Enable bus master reload */ + if ( old->type != ACPI_STATE_C3 && power->flags.bm_check ) + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1); + break; + } + power->state = new; return; @@ -196,7 +239,7 @@ static void acpi_safe_halt(void) safe_halt(); } -#define MWAIT_ECX_INTERRUPT_BREAK (0x1) +#define MWAIT_ECX_INTERRUPT_BREAK (0x1) static void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) { @@ -229,6 +272,8 @@ static void acpi_idle_do_entry(struct ac } } +static atomic_t c3_cpu_count; + static void acpi_processor_idle(void) { struct acpi_processor_power *power = NULL; @@ -258,6 +303,62 @@ static void acpi_processor_idle(void) acpi_safe_halt(); } return; + } + + /* + * Check BM Activity + * ----------------- + * Check for bus mastering activity (if required), record, and check + * for demotion. + */ + if ( power->flags.bm_check ) + { + u32 bm_status = 0; + unsigned long diff = (NOW() - power->bm_check_timestamp) >> 23; + + if ( diff > 31 ) + diff = 31; + + power->bm_activity <<= diff; + + acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); + if ( bm_status ) + { + power->bm_activity |= 0x1; + acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); + } + /* + * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect + * the true state of bus mastering activity; forcing us to + * manually check the BMIDEA bit of each IDE channel. + */ + /*else if ( errata.piix4.bmisx ) + { + if ( (inb_p(errata.piix4.bmisx + 0x02) & 0x01) + || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01) ) + pr->power.bm_activity |= 0x1; + }*/ + + power->bm_check_timestamp = NOW(); + + /* + * If bus mastering is or was active this jiffy, demote + * to avoid a faulty transition. Note that the processor + * won't enter a low-power state during this call (to this + * function) but should upon the next. + * + * TBD: A better policy might be to fallback to the demotion + * state (use it for this quantum only) istead of + * demoting -- and rely on duration as our sole demotion + * qualification. This may, however, introduce DMA + * issues (e.g. floppy DMA transfer overrun/underrun). + */ + if ( (power->bm_activity & 0x1) && cx->demotion.threshold.bm ) + { + local_irq_enable(); + next_state = cx->demotion.state; + goto end; + } } /* @@ -303,6 +404,73 @@ static void acpi_processor_idle(void) sleep_ticks = ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; break; + + case ACPI_STATE_C3: + /* + * disable bus master + * bm_check implies we need ARB_DIS + * !bm_check implies we need cache flush + * bm_control implies whether we can do ARB_DIS + * + * That leaves a case where bm_check is set and bm_control is + * not set. In that case we cannot do much, we enter C3 + * without doing anything. + */ + if ( power->flags.bm_check && power->flags.bm_control ) + { + atomic_inc(&c3_cpu_count); + if ( atomic_read(&c3_cpu_count) == num_online_cpus() ) + { + /* + * All CPUs are trying to go to C3 + * Disable bus master arbitration + */ + acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); + } + } + else if ( !power->flags.bm_check ) + { + /* SMP with no shared cache... Invalidate cache */ + ACPI_FLUSH_CPU_CACHE(); + } + + /* Get start time (ticks) */ + t1 = inl(pmtmr_ioport); + + /* + * FIXME: Before invoking C3, be aware that TSC/APIC timer may be + * stopped by H/W. Without carefully handling of TSC/APIC stop issues, + * deep C state can't work correctly. + */ + /* placeholder for preparing TSC stop */ + + /* placeholder for preparing APIC stop */ + + /* Invoke C3 */ + acpi_idle_do_entry(cx); + + /* placeholder for recovering APIC */ + + /* placeholder for recovering TSC */ + + /* Get end time (ticks) */ + t2 = inl(pmtmr_ioport); + if ( power->flags.bm_check && power->flags.bm_control ) + { + /* Enable bus master arbitration */ + atomic_dec(&c3_cpu_count); + acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); + } + + /* Compute time (ticks) that we were actually asleep */ + sleep_ticks = ticks_elapsed(t1, t2); + /* Re-enable interrupts */ + local_irq_enable(); + /* Do not account our idle-switching overhead: */ + sleep_ticks -= cx->latency_ticks + C3_OVERHEAD; + + break; + default: local_irq_enable(); return; @@ -331,8 +499,19 @@ static void acpi_processor_idle(void) cx->demotion.count = 0; if ( cx->promotion.count >= cx->promotion.threshold.count ) { - next_state = cx->promotion.state; - goto end; + if ( power->flags.bm_check ) + { + if ( !(power->bm_activity & cx->promotion.threshold.bm) ) + { + next_state = cx->promotion.state; + goto end; + } + } + else + { + next_state = cx->promotion.state; + goto end; + } } } } @@ -425,6 +604,8 @@ static int acpi_processor_set_power_poli cx->demotion.state = lower; cx->demotion.threshold.ticks = cx->latency_ticks; cx->demotion.threshold.count = 1; + if ( cx->type == ACPI_STATE_C3 ) + cx->demotion.threshold.bm = bm_history; } lower = cx; @@ -445,6 +626,8 @@ static int acpi_processor_set_power_poli cx->promotion.threshold.count = 4; else cx->promotion.threshold.count = 10; + if ( higher->type == ACPI_STATE_C3 ) + cx->promotion.threshold.bm = bm_history; } higher = cx; @@ -511,11 +694,40 @@ static int acpi_processor_ffh_cstate_pro return 0; } +/* + * Initialize bm_flags based on the CPU cache properties + * On SMP it depends on cache configuration + * - When cache is not shared among all CPUs, we flush cache + * before entering C3. + * - When cache is shared among all CPUs, we use bm_check + * mechanism as in UP case + * + * This routine is called only after all the CPUs are online + */ +static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags) +{ + struct cpuinfo_x86 *c = ¤t_cpu_data; + + flags->bm_check = 0; + if ( num_online_cpus() == 1 ) + flags->bm_check = 1; + else if ( c->x86_vendor == X86_VENDOR_INTEL ) + { + /* + * Today all CPUs that support C3 share cache. + * TBD: This needs to look at cache shared map, once + * multi-core detection patch makes to the base. + */ + flags->bm_check = 1; + } +} + #define VENDOR_INTEL (1) #define NATIVE_CSTATE_BEYOND_HALT (2) -static int check_cx(xen_processor_cx_t *cx) -{ +static int check_cx(struct acpi_processor_power *power, xen_processor_cx_t *cx) +{ + static int bm_check_flag; if ( cx == NULL ) return -EINVAL; @@ -543,6 +755,56 @@ static int check_cx(xen_processor_cx_t * return -ENODEV; } + if ( cx->type == ACPI_STATE_C3 ) + { + /* All the logic here assumes flags.bm_check is same across all CPUs */ + if ( !bm_check_flag ) + { + /* Determine whether bm_check is needed based on CPU */ + acpi_processor_power_init_bm_check(&(power->flags)); + bm_check_flag = power->flags.bm_check; + } + else + { + power->flags.bm_check = bm_check_flag; + } + + if ( power->flags.bm_check ) + { + if ( !power->flags.bm_control ) + { + if ( power->flags.has_cst != 1 ) + { + /* bus mastering control is necessary */ + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "C3 support requires BM control\n")); + return -1; + } + else + { + /* Here we enter C3 without bus mastering */ + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "C3 support without BM control\n")); + } + } + } + else + { + /* + * WBINVD should be set in fadt, for C3 state to be + * supported on when bm_check is not required. + */ + if ( !(acpi_gbl_FADT.flags & ACPI_FADT_WBINVD) ) + { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Cache invalidation should work properly" + " for C3 to be enabled on SMP systems\n")); + return -1; + } + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); + } + } + return 0; } @@ -552,7 +814,7 @@ static int set_cx(struct acpi_processor_ struct acpi_processor_cx *cx; /* skip unsupported acpi cstate */ - if ( check_cx(xen_cx) ) + if ( check_cx(acpi_power, xen_cx) ) return -EFAULT; cx = &acpi_power->states[xen_cx->type]; @@ -663,6 +925,10 @@ long set_cx_pminfo(uint32_t cpu, struct init_cx_pminfo(acpi_power); + acpi_power->flags.bm_check = power->flags.bm_check; + acpi_power->flags.bm_control = power->flags.bm_control; + acpi_power->flags.has_cst = power->flags.has_cst; + states = power->states; for ( i = 0; i < power->count; i++ ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:54 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:54 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra4g-0004Or-1d for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:54 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5C-0004Br-PW; Thu, 01 May 2008 14:48:26 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDG-0000NX-8l for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:30 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWD4-0000P1-ST for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:27 +0000 X-SBRS: 3.6 X-MesageID: 107392 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107392" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:08 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A08Hp010664 for ; Thu, 1 May 2008 03:00:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0QUQ015539 for ; Thu, 1 May 2008 03:00:26 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0PBM015538 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:25 -0700 Message-Id: <200805011000.m41A0PBM015538@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:25 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] i386: Fix build. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209635378 -3600 # Node ID 4aec1797720f3691a54988b2b7e02683fb6cdf89 # Parent 520519f5e346034585dfe65b2e6ca5ec3fc49687 i386: Fix build. Signed-off-by: Keir Fraser --- xen/arch/x86/msi.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 520519f5e346 -r 4aec1797720f xen/arch/x86/msi.c --- a/xen/arch/x86/msi.c Thu May 01 10:46:59 2008 +0100 +++ b/xen/arch/x86/msi.c Thu May 01 10:49:38 2008 +0100 @@ -520,7 +520,7 @@ static int msi_capability_init(struct pc static u64 pci_resource_start(struct pci_dev *dev, u8 bar_index) { - unsigned long bar_base; + u64 bar_base; u8 bus = dev->bus; u8 slot = PCI_SLOT(dev->devfn); u8 func = PCI_FUNC(dev->devfn); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:47:57 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:47:57 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra4j-0004Ou-EM for www-data@colo.xensource.com; Thu, 01 May 2008 07:47:57 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5G-0004F1-2u; Thu, 01 May 2008 14:48:30 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDI-0000Nc-8e for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:32 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWD5-0000PM-Ua for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:29 +0000 X-SBRS: 3.6 X-MesageID: 107393 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107393" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:09 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A09jq010667 for ; Thu, 1 May 2008 03:00:09 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0RiV015556 for ; Thu, 1 May 2008 03:00:27 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0QJf015555 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:26 -0700 Message-Id: <200805011000.m41A0QJf015555@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:26 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Add TSC stop support for Deep C state X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209635409 -3600 # Node ID becd9b77f951fe66bb68616426ef13a2894d0191 # Parent 4aec1797720f3691a54988b2b7e02683fb6cdf89 x86: Add TSC stop support for Deep C state TSC may stop at deep C state (C3/C4...) entry/exit. this patch add the logic that save and restore TSC during deep C state entry/exit, by using platform timer (PIT/HPET) Signed-off-by: Yu Ke Signed-off-by: Tian Kevin Signed-off-by: Wei Gang --- xen/arch/x86/acpi/cpu_idle.c | 7 ++++--- xen/arch/x86/time.c | 39 +++++++++++++++++++++++++++++++++++++++ xen/include/xen/time.h | 2 ++ 3 files changed, 45 insertions(+), 3 deletions(-) diff -r 4aec1797720f -r becd9b77f951 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Thu May 01 10:49:38 2008 +0100 +++ b/xen/arch/x86/acpi/cpu_idle.c Thu May 01 10:50:09 2008 +0100 @@ -442,8 +442,8 @@ static void acpi_processor_idle(void) * stopped by H/W. Without carefully handling of TSC/APIC stop issues, * deep C state can't work correctly. */ - /* placeholder for preparing TSC stop */ - + /* preparing TSC stop */ + cstate_save_tsc(); /* placeholder for preparing APIC stop */ /* Invoke C3 */ @@ -451,7 +451,8 @@ static void acpi_processor_idle(void) /* placeholder for recovering APIC */ - /* placeholder for recovering TSC */ + /* recovering TSC */ + cstate_restore_tsc(); /* Get end time (ticks) */ t2 = inl(pmtmr_ioport); diff -r 4aec1797720f -r becd9b77f951 xen/arch/x86/time.c --- a/xen/arch/x86/time.c Thu May 01 10:49:38 2008 +0100 +++ b/xen/arch/x86/time.c Thu May 01 10:50:09 2008 +0100 @@ -51,9 +51,11 @@ struct time_scale { struct cpu_time { u64 local_tsc_stamp; + u64 cstate_tsc_stamp; s_time_t stime_local_stamp; s_time_t stime_master_stamp; struct time_scale tsc_scale; + u32 cstate_plt_count_stamp; struct timer calibration_timer; }; @@ -65,6 +67,8 @@ struct platform_timesource { }; static DEFINE_PER_CPU(struct cpu_time, cpu_time); + +static u8 tsc_invariant=0; /* TSC is invariant upon C state entry */ /* * We simulate a 32-bit platform timer from the 16-bit PIT ch2 counter. @@ -594,6 +598,36 @@ static void init_platform_timer(void) freq_string(pts->frequency), pts->name); } +void cstate_save_tsc(void) +{ + struct cpu_time *t = &this_cpu(cpu_time); + + if (!tsc_invariant){ + t->cstate_plt_count_stamp = plt_src.read_counter(); + rdtscll(t->cstate_tsc_stamp); + } +} + +void cstate_restore_tsc(void) +{ + struct cpu_time *t; + u32 plt_count_delta; + u64 tsc_delta; + + if (!tsc_invariant){ + t = &this_cpu(cpu_time); + + /* if platform counter overflow happens, interrupt will bring CPU from + C state to working state, so the platform counter won't wrap the + cstate_plt_count_stamp, and the 32 bit unsigned platform counter + is enough for delta calculation + */ + plt_count_delta = + (plt_src.read_counter() - t->cstate_plt_count_stamp) & plt_mask; + tsc_delta = scale_delta(plt_count_delta, &plt_scale)*cpu_khz/1000000UL; + wrmsrl(MSR_IA32_TSC, t->cstate_tsc_stamp + tsc_delta); + } +} /*************************************************************************** * CMOS Timer functions @@ -972,6 +1006,11 @@ int __init init_xen_time(void) stime_platform_stamp = 0; init_platform_timer(); + + /* check if TSC is invariant during deep C state + this is a new feature introduced by Nehalem*/ + if ( cpuid_edx(0x80000007) & (1U<<8) ) + tsc_invariant = 1; local_irq_enable(); diff -r 4aec1797720f -r becd9b77f951 xen/include/xen/time.h --- a/xen/include/xen/time.h Thu May 01 10:49:38 2008 +0100 +++ b/xen/include/xen/time.h Thu May 01 10:50:09 2008 +0100 @@ -13,6 +13,8 @@ #include extern int init_xen_time(void); +extern void cstate_save_tsc(void); +extern void cstate_restore_tsc(void); extern unsigned long cpu_khz; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:01 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:01 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra4m-0004Ox-Tp for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:01 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5J-0004IP-Ks; Thu, 01 May 2008 14:48:33 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDJ-0000Nh-Nu for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:33 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDA-0000Pi-6Q for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:31 +0000 X-SBRS: 3.6 X-MesageID: 107394 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107394" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:12 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0CF8010670 for ; Thu, 1 May 2008 03:00:12 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0Tc2015652 for ; Thu, 1 May 2008 03:00:29 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0TF5015651 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:29 -0700 Message-Id: <200805011000.m41A0TF5015651@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:28 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] MSI 6/6: add MSI support to domain0/domainU X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209634530 -3600 # Node ID 9f9b4214bec8c82f835b43554b798e107371749f # Parent 81c5a517a42b817378b63ced1420684e9bed1e21 MSI 6/6: add MSI support to domain0/domainU Signed-off-by: Jiang Yunhong Signed-off-by: Shan Haitao --- drivers/pci/Kconfig | 1 drivers/pci/msi-xen.c | 710 ++++++++++++++++++++++++ drivers/pci/msi.h | 5 drivers/xen/pciback/Makefile | 1 drivers/xen/pciback/conf_space_capability_msi.c | 60 ++ drivers/xen/pciback/pci_stub.c | 24 drivers/xen/pciback/pciback.h | 14 drivers/xen/pciback/pciback_ops.c | 38 + drivers/xen/pcifront/pci_op.c | 116 +++ include/asm-i386/io_apic.h | 2 include/asm-x86_64/io_apic.h | 2 include/asm-x86_64/msi.h | 9 include/linux/pci.h | 3 include/xen/evtchn.h | 14 include/xen/interface/io/pciif.h | 15 include/xen/interface/physdev.h | 32 + 16 files changed, 1034 insertions(+), 12 deletions(-) diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/pci/Kconfig --- a/drivers/pci/Kconfig Tue Apr 22 18:56:27 2008 +0100 +++ b/drivers/pci/Kconfig Thu May 01 10:35:30 2008 +0100 @@ -5,7 +5,6 @@ config PCI_MSI bool "Message Signaled Interrupts (MSI and MSI-X)" depends on PCI depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64 - depends on !XEN help This allows device drivers to enable MSI (Message Signaled Interrupts). Message Signaled Interrupts enable a device to diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/pci/msi-xen.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/msi-xen.c Thu May 01 10:35:30 2008 +0100 @@ -0,0 +1,710 @@ +/* + * File: msi.c + * Purpose: PCI Message Signaled Interrupt (MSI) + * + * Copyright (C) 2003-2004 Intel + * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "pci.h" +#include "msi.h" + +static int pci_msi_enable = 1; + +static struct msi_ops *msi_ops; + +int msi_register(struct msi_ops *ops) +{ + msi_ops = ops; + return 0; +} + +static struct list_head msi_dev_head; +static int msi_dev_head_inited = 0; +DEFINE_SPINLOCK(msi_dev_lock); + +struct msi_dev_list { + struct pci_dev *dev; + struct list_head list; + spinlock_t pirq_list_lock; + struct list_head pirq_list_head; +}; + +struct msi_pirq_entry { + struct list_head list; + int pirq; + int entry_nr; +}; + +static struct msi_dev_list *get_msi_dev_pirq_list(struct pci_dev *dev) +{ + struct msi_dev_list *msi_dev_list, *ret = NULL; + unsigned long flags; + + if (!msi_dev_head_inited) { + INIT_LIST_HEAD(&msi_dev_head); + msi_dev_head_inited = 1; + } + + spin_lock_irqsave(&msi_dev_lock, flags); + + list_for_each_entry(msi_dev_list, &msi_dev_head, list) + if ( msi_dev_list->dev == dev ) + ret = msi_dev_list; + + if ( ret ) { + spin_unlock_irqrestore(&msi_dev_lock, flags); + return ret; + } + + /* Has not allocate msi_dev until now. */ + ret = kmalloc(sizeof(struct msi_dev_list), GFP_ATOMIC); + + /* Failed to allocate msi_dev structure */ + if ( !ret ) { + spin_unlock_irqrestore(&msi_dev_lock, flags); + return NULL; + } + + list_add_tail(&ret->list, &msi_dev_head); + spin_unlock_irqrestore(&msi_dev_lock, flags); + spin_lock_init(&ret->pirq_list_lock); + INIT_LIST_HEAD(&ret->pirq_list_head); + return ret; +} + +static int attach_pirq_entry(int pirq, int entry_nr, + struct msi_dev_list *msi_dev_entry) +{ + struct msi_pirq_entry *entry = kmalloc(sizeof(*entry), GFP_ATOMIC); + unsigned long flags; + + if (!entry) + return -ENOMEM; + entry->pirq = pirq; + entry->entry_nr = entry_nr; + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + list_add_tail(&entry->list, &msi_dev_entry->pirq_list_head); + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + return 0; +} + +/* + * pciback will provide device's owner + */ +int (*get_owner)(struct pci_dev *dev); + +int register_msi_get_owner(int (*func)(struct pci_dev *dev)) +{ + if (get_owner) { + printk(KERN_WARNING "register msi_get_owner again\n"); + return -EEXIST; + } + get_owner = func; + return 0; +} + +int unregister_msi_get_owner(int (*func)(struct pci_dev *dev)) +{ + if (get_owner == func) + get_owner = NULL; + return 0; +} + +static int msi_get_dev_owner(struct pci_dev *dev) +{ + int owner = DOMID_SELF; + + BUG_ON(!is_initial_xendomain()); + if (get_owner && (owner = get_owner(dev)) >=0 ) { + printk(KERN_INFO "get owner for dev %x get %x \n", + dev->devfn, owner); + return owner; + } + else + return DOMID_SELF; +} + +static int msi_unmap_pirq(struct pci_dev *dev, int pirq) +{ + struct physdev_unmap_pirq unmap; + int rc; + domid_t domid = DOMID_SELF; + + domid = msi_get_dev_owner(dev); + unmap.domid = domid; + unmap.pirq = pirq; + + if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap))) + printk(KERN_WARNING "unmap irq %x failed\n", pirq); + + if (rc < 0) + return rc; + return 0; +} + +/* + * Protected by msi_lock + */ +static int msi_map_pirq_to_vector(struct pci_dev *dev, int pirq, + int entry_nr, int msi) +{ + struct physdev_map_pirq map_irq; + int rc; + domid_t domid = DOMID_SELF; + + domid = msi_get_dev_owner(dev); + + map_irq.domid = domid; + map_irq.type = MAP_PIRQ_TYPE_MSI; + map_irq.index = -1; + map_irq.pirq = pirq; + map_irq.msi_info.bus = dev->bus->number; + map_irq.msi_info.devfn = dev->devfn; + map_irq.msi_info.entry_nr = entry_nr; + map_irq.msi_info.msi = msi; + + if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq))) + printk(KERN_WARNING "map irq failed\n"); + + if (rc < 0) + return rc; + + return map_irq.pirq; +} + +static int msi_map_vector(struct pci_dev *dev, int entry_nr, int msi) +{ + return msi_map_pirq_to_vector(dev, -1, entry_nr, msi); +} + +static int msi_init(void) +{ + static int status = 0; + + if (pci_msi_quirk) { + pci_msi_enable = 0; + printk(KERN_WARNING "PCI: MSI quirk detected. MSI disabled.\n"); + status = -EINVAL; + } + + return status; +} + +void pci_scan_msi_device(struct pci_dev *dev) { } + +void disable_msi_mode(struct pci_dev *dev, int pos, int type) +{ + u16 control; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (type == PCI_CAP_ID_MSI) { + /* Set enabled bits to single MSI & enable MSI_enable bit */ + msi_disable(control); + pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msi_enabled = 0; + } else { + msix_disable(control); + pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msix_enabled = 0; + } + if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { + /* PCI Express Endpoint device detected */ + pci_intx(dev, 1); /* enable intx */ + } +} + +static void enable_msi_mode(struct pci_dev *dev, int pos, int type) +{ + u16 control; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (type == PCI_CAP_ID_MSI) { + /* Set enabled bits to single MSI & enable MSI_enable bit */ + msi_enable(control, 1); + pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msi_enabled = 1; + } else { + msix_enable(control); + pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msix_enabled = 1; + } + if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { + /* PCI Express Endpoint device detected */ + pci_intx(dev, 0); /* disable intx */ + } +} + +#ifdef CONFIG_PM +int pci_save_msi_state(struct pci_dev *dev) +{ + int pos; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (pos <= 0 || dev->no_msi) + return 0; + + if (!dev->msi_enabled) + return 0; + + /* Restore dev->irq to its default pin-assertion vector */ + msi_unmap_pirq(dev, dev->irq); + /* Disable MSI mode */ + disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); + /* Set the flags for use of restore */ + dev->msi_enabled = 1; + return 0; +} + +void pci_restore_msi_state(struct pci_dev *dev) +{ + int pos, pirq; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (pos <= 0) + return; + + if (!dev->msi_enabled) + return; + + pirq = msi_map_pirq_to_vector(dev, dev->irq, 0, 1); + if (pirq < 0) + return; + enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); +} + +int pci_save_msix_state(struct pci_dev *dev) +{ + int pos; + unsigned long flags; + struct msi_dev_list *msi_dev_entry; + struct msi_pirq_entry *pirq_entry, *tmp; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (pos <= 0 || dev->no_msi) + return 0; + + /* save the capability */ + if (!dev->msix_enabled) + return 0; + + msi_dev_entry = get_msi_dev_pirq_list(dev); + + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) + msi_unmap_pirq(dev, pirq_entry->pirq); + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + + disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); + /* Set the flags for use of restore */ + dev->msix_enabled = 1; + + return 0; +} + +void pci_restore_msix_state(struct pci_dev *dev) +{ + int pos; + unsigned long flags; + struct msi_dev_list *msi_dev_entry; + struct msi_pirq_entry *pirq_entry, *tmp; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (pos <= 0) + return; + + if (!dev->msix_enabled) + return; + + msi_dev_entry = get_msi_dev_pirq_list(dev); + + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) + msi_map_pirq_to_vector(dev, pirq_entry->pirq, pirq_entry->entry_nr, 0); + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + + enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); +} +#endif + +/** + * msi_capability_init - configure device's MSI capability structure + * @dev: pointer to the pci_dev data structure of MSI device function + * + * Setup the MSI capability structure of device function with a single + * MSI vector, regardless of device function is capable of handling + * multiple messages. A return of zero indicates the successful setup + * of an entry zero with the new MSI vector or non-zero for otherwise. + **/ +static int msi_capability_init(struct pci_dev *dev) +{ + int pos, pirq; + u16 control; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + pci_read_config_word(dev, msi_control_reg(pos), &control); + + pirq = msi_map_vector(dev, 0, 1); + if (pirq < 0) + return -EBUSY; + + dev->irq = pirq; + /* Set MSI enabled bits */ + enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); + dev->msi_enabled = 1; + + return 0; +} + +/** + * msix_capability_init - configure device's MSI-X capability + * @dev: pointer to the pci_dev data structure of MSI-X device function + * @entries: pointer to an array of struct msix_entry entries + * @nvec: number of @entries + * + * Setup the MSI-X capability structure of device function with a + * single MSI-X vector. A return of zero indicates the successful setup of + * requested MSI-X entries with allocated vectors or non-zero for otherwise. + **/ +static int msix_capability_init(struct pci_dev *dev, + struct msix_entry *entries, int nvec) +{ + int pirq, i, pos; + struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev); + struct msi_pirq_entry *pirq_entry, *tmp; + unsigned long flags; + + if (!msi_dev_entry) + return -ENOMEM; + + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + { + printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ + before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) { + msi_unmap_pirq(dev, pirq_entry->pirq); + list_del(&pirq_entry->list); + kfree(pirq_entry); + } + } + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + + /* MSI-X Table Initialization */ + for (i = 0; i < nvec; i++) { + pirq = msi_map_vector(dev, entries[i].entry, 0); + if (pirq < 0) + break; + attach_pirq_entry(pirq, entries[i].entry, msi_dev_entry); + dev->irq = pirq; + (entries + i)->vector = pirq; + } + if (i != nvec) { + msi_unmap_pirq(dev, dev->irq); + (entries + i)->vector = 0; + return -EBUSY; + } + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); + dev->msix_enabled = 1; + + return 0; +} + +/** + * pci_enable_msi - configure device's MSI capability structure + * @dev: pointer to the pci_dev data structure of MSI device function + * + * Setup the MSI capability structure of device function with + * a single MSI vector upon its software driver call to request for + * MSI mode enabled on its hardware device function. A return of zero + * indicates the successful setup of an entry zero with the new MSI + * vector or non-zero for otherwise. + **/ +extern int pci_frontend_enable_msi(struct pci_dev *dev); +int pci_enable_msi(struct pci_dev* dev) +{ + struct pci_bus *bus; + int pos, temp, status = -EINVAL; + + if (!pci_msi_enable || !dev) + return status; + + if (dev->no_msi) + return status; + + for (bus = dev->bus; bus; bus = bus->parent) + if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) + return -EINVAL; + + status = msi_init(); + if (status < 0) + return status; + +#ifdef CONFIG_XEN_PCIDEV_FRONTEND + if (!is_initial_xendomain()) + { + int ret; + + temp = dev->irq; + ret = pci_frontend_enable_msi(dev); + if (ret) + return ret; + + dev->irq_old = temp; + + return ret; + } +#endif + + temp = dev->irq; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (!pos) + return -EINVAL; + + /* Check whether driver already requested for MSI-X vectors */ + if (dev->msix_enabled) { + printk(KERN_INFO "PCI: %s: Can't enable MSI. " + "Device already has MSI-X vectors assigned\n", + pci_name(dev)); + dev->irq = temp; + return -EINVAL; + } + + status = msi_capability_init(dev); + if ( !status ) + dev->irq_old = temp; + else + dev->irq = temp; + + return status; +} + +extern void pci_frontend_disable_msi(struct pci_dev* dev); +void pci_disable_msi(struct pci_dev* dev) +{ + int pos; + int pirq; + + if (!pci_msi_enable) + return; + if (!dev) + return; + +#ifdef CONFIG_XEN_PCIDEV_FRONTEND + if (!is_initial_xendomain()) { + pci_frontend_disable_msi(dev); + dev->irq = dev->irq_old; + return; + } +#endif + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (!pos) + return; + + pirq = dev->irq; + /* Restore dev->irq to its default pin-assertion vector */ + dev->irq = dev->irq_old; + msi_unmap_pirq(dev, pirq); + + /* Disable MSI mode */ + disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); +} + +/** + * pci_enable_msix - configure device's MSI-X capability structure + * @dev: pointer to the pci_dev data structure of MSI-X device function + * @entries: pointer to an array of MSI-X entries + * @nvec: number of MSI-X vectors requested for allocation by device driver + * + * Setup the MSI-X capability structure of device function with the number + * of requested vectors upon its software driver call to request for + * MSI-X mode enabled on its hardware device function. A return of zero + * indicates the successful configuration of MSI-X capability structure + * with new allocated MSI-X vectors. A return of < 0 indicates a failure. + * Or a return of > 0 indicates that driver request is exceeding the number + * of vectors available. Driver should use the returned value to re-send + * its request. + **/ +extern int pci_frontend_enable_msix(struct pci_dev *dev, + struct msix_entry *entries, int nvec); +int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) +{ + struct pci_bus *bus; + int status, pos, nr_entries; + int i, j, temp; + u16 control; + + if (!pci_msi_enable || !dev || !entries) + return -EINVAL; + + if (dev->no_msi) + return -EINVAL; + + for (bus = dev->bus; bus; bus = bus->parent) + if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) + return -EINVAL; + +#ifdef CONFIG_XEN_PCIDEV_FRONTEND + if (!is_initial_xendomain()) { + int ret; + + ret = pci_frontend_enable_msix(dev, entries, nvec); + if (ret) { + printk("get %x from pci_frontend_enable_msix\n", ret); + return ret; + } + + return 0; + } +#endif + + status = msi_init(); + if (status < 0) + return status; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (!pos) + return -EINVAL; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + nr_entries = multi_msix_capable(control); + if (nvec > nr_entries) + return -EINVAL; + + /* Check for any invalid entries */ + for (i = 0; i < nvec; i++) { + if (entries[i].entry >= nr_entries) + return -EINVAL; /* invalid entry */ + for (j = i + 1; j < nvec; j++) { + if (entries[i].entry == entries[j].entry) + return -EINVAL; /* duplicate entry */ + } + } + + temp = dev->irq; + /* Check whether driver already requested for MSI vector */ + if (dev->msi_enabled) { + printk(KERN_INFO "PCI: %s: Can't enable MSI-X. " + "Device already has an MSI vector assigned\n", + pci_name(dev)); + dev->irq = temp; + return -EINVAL; + } + + status = msix_capability_init(dev, entries, nvec); + + if ( !status ) + dev->irq_old = temp; + else + dev->irq = temp; + + return status; +} + +extern void pci_frontend_disable_msix(struct pci_dev* dev); +void pci_disable_msix(struct pci_dev* dev) +{ + int pos; + u16 control; + + + if (!pci_msi_enable) + return; + if (!dev) + return; + +#ifdef CONFIG_XEN_PCIDEV_FRONTEND + if (!is_initial_xendomain()) { + pci_frontend_disable_msix(dev); + dev->irq = dev->irq_old; + return; + } +#endif + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (!pos) + return; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (!(control & PCI_MSIX_FLAGS_ENABLE)) + return; + + msi_remove_pci_irq_vectors(dev); + + /* Disable MSI mode */ + disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); +} + +/** + * msi_remove_pci_irq_vectors - reclaim MSI(X) vectors to unused state + * @dev: pointer to the pci_dev data structure of MSI(X) device function + * + * Being called during hotplug remove, from which the device function + * is hot-removed. All previous assigned MSI/MSI-X vectors, if + * allocated for this device function, are reclaimed to unused state, + * which may be used later on. + **/ +void msi_remove_pci_irq_vectors(struct pci_dev* dev) +{ + unsigned long flags; + struct msi_dev_list *msi_dev_entry; + struct msi_pirq_entry *pirq_entry, *tmp; + + if (!pci_msi_enable || !dev) + return; + + msi_dev_entry = get_msi_dev_pirq_list(dev); + + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + { + printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ + before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) { + msi_unmap_pirq(dev, pirq_entry->pirq); + list_del(&pirq_entry->list); + kfree(pirq_entry); + } + } + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + dev->irq = dev->irq_old; +} + +void pci_no_msi(void) +{ + pci_msi_enable = 0; +} + +EXPORT_SYMBOL(pci_enable_msi); +EXPORT_SYMBOL(pci_disable_msi); +EXPORT_SYMBOL(pci_enable_msix); +EXPORT_SYMBOL(pci_disable_msix); +#ifdef CONFIG_XEN +EXPORT_SYMBOL(register_msi_get_owner); +EXPORT_SYMBOL(unregister_msi_get_owner); +#endif + diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/pci/msi.h --- a/drivers/pci/msi.h Tue Apr 22 18:56:27 2008 +0100 +++ b/drivers/pci/msi.h Thu May 01 10:35:30 2008 +0100 @@ -84,6 +84,11 @@ extern void (*interrupt[NR_IRQS])(void); extern void (*interrupt[NR_IRQS])(void); extern int pci_vector_resources(int last, int nr_released); +#ifdef CONFIG_XEN +extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev)); +extern int register_msi_get_owner(int (*func)(struct pci_dev *dev)); +#endif + /* * MSI-X Address Register */ diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/xen/pciback/Makefile --- a/drivers/xen/pciback/Makefile Tue Apr 22 18:56:27 2008 +0100 +++ b/drivers/xen/pciback/Makefile Thu May 01 10:35:30 2008 +0100 @@ -6,6 +6,7 @@ pciback-y += conf_space.o conf_space_hea conf_space_capability_vpd.o \ conf_space_capability_pm.o \ conf_space_quirks.o +pciback-$(CONFIG_PCI_MSI) += conf_space_capability_msi.o pciback-$(CONFIG_XEN_PCIDEV_BACKEND_VPCI) += vpci.o pciback-$(CONFIG_XEN_PCIDEV_BACKEND_SLOT) += slot.o pciback-$(CONFIG_XEN_PCIDEV_BACKEND_PASS) += passthrough.o diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/xen/pciback/conf_space_capability_msi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/xen/pciback/conf_space_capability_msi.c Thu May 01 10:35:30 2008 +0100 @@ -0,0 +1,60 @@ +/* + * PCI Backend -- Configuration overlay for MSI capability + */ +#include +#include "conf_space.h" +#include "conf_space_capability.h" +#include +#include "pciback.h" + +int pciback_enable_msi(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op) +{ + int otherend = pdev->xdev->otherend_id; + int irq; + int status; + + status = pci_enable_msi(dev); + + if (status) { + printk("error enable msi for guest %x status %x\n", otherend, status); + op->value = 0; + return XEN_PCI_ERR_op_failed; + } + + op->value = dev->irq; + return 0; +} + +int pciback_disable_msi(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op) +{ + int old_irq = dev->irq; + + pci_disable_msi(dev); + + op->value = dev->irq; + return 0; +} + +int pciback_enable_msix(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op) +{ + int otherend = pdev->xdev->otherend_id, result, i; + + result = pci_enable_msix(dev, op->msix_entries, op->value); + + op->value = result; + return result; +} + +int pciback_disable_msix(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op) +{ + + pci_disable_msix(dev); + + op->value = dev->irq; + return 0; +} + diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/xen/pciback/pci_stub.c --- a/drivers/xen/pciback/pci_stub.c Tue Apr 22 18:56:27 2008 +0100 +++ b/drivers/xen/pciback/pci_stub.c Thu May 01 10:35:30 2008 +0100 @@ -805,6 +805,23 @@ static ssize_t permissive_show(struct de DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show, permissive_add); +#ifdef CONFIG_PCI_MSI + +int pciback_get_owner(struct pci_dev *dev) +{ + struct pcistub_device *psdev; + + psdev = pcistub_device_find(pci_domain_nr(dev->bus), dev->bus->number, + PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); + /* XXX will other domain has pciback support ??? */ + if (!psdev || !psdev->pdev) { + printk(KERN_WARNING "no ownder\n"); + return -1; + } + return psdev->pdev->xdev->otherend_id; +} +#endif + static void pcistub_exit(void) { driver_remove_file(&pciback_pci_driver.driver, &driver_attr_new_slot); @@ -815,6 +832,9 @@ static void pcistub_exit(void) driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive); pci_unregister_driver(&pciback_pci_driver); +#ifdef CONFIG_PCI_MSI + unregister_msi_get_owner(pciback_get_owner); +#endif } static int __init pcistub_init(void) @@ -872,6 +892,10 @@ static int __init pcistub_init(void) err = driver_create_file(&pciback_pci_driver.driver, &driver_attr_permissive); +#ifdef CONFIG_PCI_MSI + if (!err) + err = register_msi_get_owner(pciback_get_owner); +#endif if (err) pcistub_exit(); diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/xen/pciback/pciback.h --- a/drivers/xen/pciback/pciback.h Tue Apr 22 18:56:27 2008 +0100 +++ b/drivers/xen/pciback/pciback.h Thu May 01 10:35:30 2008 +0100 @@ -93,5 +93,19 @@ int pciback_xenbus_register(void); int pciback_xenbus_register(void); void pciback_xenbus_unregister(void); +#ifdef CONFIG_PCI_MSI +int pciback_enable_msi(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op); + +int pciback_disable_msi(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op); + + +int pciback_enable_msix(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op); + +int pciback_disable_msix(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op); +#endif extern int verbose_request; #endif diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/xen/pciback/pciback_ops.c --- a/drivers/xen/pciback/pciback_ops.c Tue Apr 22 18:56:27 2008 +0100 +++ b/drivers/xen/pciback/pciback_ops.c Thu May 01 10:35:30 2008 +0100 @@ -61,15 +61,37 @@ void pciback_do_op(void *data) if (dev == NULL) op->err = XEN_PCI_ERR_dev_not_found; - else if (op->cmd == XEN_PCI_OP_conf_read) - op->err = pciback_config_read(dev, op->offset, op->size, - &op->value); - else if (op->cmd == XEN_PCI_OP_conf_write) - op->err = pciback_config_write(dev, op->offset, op->size, - op->value); else - op->err = XEN_PCI_ERR_not_implemented; - + { + switch (op->cmd) + { + case XEN_PCI_OP_conf_read: + op->err = pciback_config_read(dev, + op->offset, op->size, &op->value); + break; + case XEN_PCI_OP_conf_write: + op->err = pciback_config_write(dev, + op->offset, op->size, op->value); + break; +#ifdef CONFIG_PCI_MSI + case XEN_PCI_OP_enable_msi: + op->err = pciback_enable_msi(pdev, dev, op); + break; + case XEN_PCI_OP_disable_msi: + op->err = pciback_disable_msi(pdev, dev, op); + break; + case XEN_PCI_OP_enable_msix: + op->err = pciback_enable_msix(pdev, dev, op); + break; + case XEN_PCI_OP_disable_msix: + op->err = pciback_disable_msix(pdev, dev, op); + break; +#endif + default: + op->err = XEN_PCI_ERR_not_implemented; + break; + } + } /* Tell the driver domain that we're done. */ wmb(); clear_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags); diff -r 81c5a517a42b -r 9f9b4214bec8 drivers/xen/pcifront/pci_op.c --- a/drivers/xen/pcifront/pci_op.c Tue Apr 22 18:56:27 2008 +0100 +++ b/drivers/xen/pcifront/pci_op.c Thu May 01 10:35:30 2008 +0100 @@ -277,6 +277,122 @@ struct pci_ops pcifront_bus_ops = { .write = pcifront_bus_write, }; +#ifdef CONFIG_PCI_MSI +int pci_frontend_enable_msix(struct pci_dev *dev, + struct msix_entry *entries, + int nvec) +{ + int err; + int i; + struct xen_pci_op op = { + .cmd = XEN_PCI_OP_enable_msix, + .domain = pci_domain_nr(dev->bus), + .bus = dev->bus->number, + .devfn = dev->devfn, + .value = nvec, + }; + struct pcifront_sd *sd = dev->bus->sysdata; + struct pcifront_device *pdev = pcifront_get_pdev(sd); + + if (nvec > SH_INFO_MAX_VEC) { + printk("too much vector for pci frontend%x\n", nvec); + return -EINVAL; + } + + for (i = 0; i < nvec; i++) { + op.msix_entries[i].entry = entries[i].entry; + op.msix_entries[i].vector = entries[i].vector; + } + + err = do_pci_op(pdev, &op); + + if (!err) { + if (!op.value) { + /* we get the result */ + for ( i = 0; i < nvec; i++) + entries[i].vector = op.msix_entries[i].vector; + return 0; + } + else { + printk("enable msix get value %x\n", op.value); + return op.value; + } + } + else { + printk("enable msix get err %x\n", err); + return err; + } +} + +void pci_frontend_disable_msix(struct pci_dev* dev) +{ + int err; + struct xen_pci_op op = { + .cmd = XEN_PCI_OP_disable_msix, + .domain = pci_domain_nr(dev->bus), + .bus = dev->bus->number, + .devfn = dev->devfn, + }; + struct pcifront_sd *sd = dev->bus->sysdata; + struct pcifront_device *pdev = pcifront_get_pdev(sd); + + err = do_pci_op(pdev, &op); + + /* What should do for error ? */ + if (err) + printk("pci_disable_msix get err %x\n", err); +} + +int pci_frontend_enable_msi(struct pci_dev *dev) +{ + int err; + struct xen_pci_op op = { + .cmd = XEN_PCI_OP_enable_msi, + .domain = pci_domain_nr(dev->bus), + .bus = dev->bus->number, + .devfn = dev->devfn, + }; + struct pcifront_sd *sd = dev->bus->sysdata; + struct pcifront_device *pdev = pcifront_get_pdev(sd); + + err = do_pci_op(pdev, &op); + if (likely(!err)) { + dev->irq = op.value; + } + else { + printk("pci frontend enable msi failed for dev %x:%x \n", + op.bus, op.devfn); + err = -EINVAL; + } + return err; +} + +void pci_frontend_disable_msi(struct pci_dev* dev) +{ + int err; + struct xen_pci_op op = { + .cmd = XEN_PCI_OP_disable_msi, + .domain = pci_domain_nr(dev->bus), + .bus = dev->bus->number, + .devfn = dev->devfn, + }; + struct pcifront_sd *sd = dev->bus->sysdata; + struct pcifront_device *pdev = pcifront_get_pdev(sd); + + err = do_pci_op(pdev, &op); + if (err == XEN_PCI_ERR_dev_not_found) { + /* XXX No response from backend, what shall we do? */ + printk("get no response from backend for disable MSI\n"); + return; + } + if (likely(!err)) + dev->irq = op.value; + else + /* how can pciback notify us fail? */ + printk("get fake response frombackend \n"); +} +#endif /* CONFIG_PCI_MSI */ + /* Claim resources for the PCI frontend as-is, backend won't allow changes */ static void pcifront_claim_resource(struct pci_dev *dev, void *data) { diff -r 81c5a517a42b -r 9f9b4214bec8 include/asm-i386/io_apic.h --- a/include/asm-i386/io_apic.h Tue Apr 22 18:56:27 2008 +0100 +++ b/include/asm-i386/io_apic.h Thu May 01 10:35:30 2008 +0100 @@ -12,7 +12,7 @@ #ifdef CONFIG_X86_IO_APIC -#ifdef CONFIG_PCI_MSI +#if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN) static inline int use_pci_vector(void) {return 1;} static inline void disable_edge_ioapic_vector(unsigned int vector) { } static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { } diff -r 81c5a517a42b -r 9f9b4214bec8 include/asm-x86_64/io_apic.h --- a/include/asm-x86_64/io_apic.h Tue Apr 22 18:56:27 2008 +0100 +++ b/include/asm-x86_64/io_apic.h Thu May 01 10:35:30 2008 +0100 @@ -12,7 +12,7 @@ #ifdef CONFIG_X86_IO_APIC -#ifdef CONFIG_PCI_MSI +#if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN) static inline int use_pci_vector(void) {return 1;} static inline void disable_edge_ioapic_vector(unsigned int vector) { } static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { } diff -r 81c5a517a42b -r 9f9b4214bec8 include/asm-x86_64/msi.h --- a/include/asm-x86_64/msi.h Tue Apr 22 18:56:27 2008 +0100 +++ b/include/asm-x86_64/msi.h Thu May 01 10:35:30 2008 +0100 @@ -7,14 +7,21 @@ #define ASM_MSI_H #include +#ifndef CONFIG_XEN #include +#endif #include +#ifndef CONFIG_XEN #define LAST_DEVICE_VECTOR (FIRST_SYSTEM_VECTOR - 1) +#else +#define LAST_DYNAMIC_VECTOR 0xdf +#define LAST_DEVICE_VECTOR (LAST_DYNAMIC_VECTOR) +#endif + #define MSI_TARGET_CPU_SHIFT 12 extern struct msi_ops msi_apic_ops; - static inline int msi_arch_init(void) { msi_register(&msi_apic_ops); diff -r 81c5a517a42b -r 9f9b4214bec8 include/linux/pci.h --- a/include/linux/pci.h Tue Apr 22 18:56:27 2008 +0100 +++ b/include/linux/pci.h Thu May 01 10:35:30 2008 +0100 @@ -152,6 +152,9 @@ struct pci_dev { * directly, use the values stored here. They might be different! */ unsigned int irq; +#ifdef CONFIG_XEN + unsigned int irq_old; +#endif struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ /* These fields are used by common fixups */ diff -r 81c5a517a42b -r 9f9b4214bec8 include/xen/evtchn.h --- a/include/xen/evtchn.h Tue Apr 22 18:56:27 2008 +0100 +++ b/include/xen/evtchn.h Thu May 01 10:35:30 2008 +0100 @@ -136,4 +136,18 @@ void notify_remote_via_irq(int irq); void notify_remote_via_irq(int irq); int irq_to_evtchn_port(int irq); +#define PIRQ_SET_MAPPING 0x0 +#define PIRQ_CLEAR_MAPPING 0x1 +#define PIRQ_GET_MAPPING 0x3 +int pirq_mapstatus(int pirq, int action); +int set_pirq_hw_action(int pirq, int (*action)(int pirq, int action)); +int clear_pirq_hw_action(int pirq); + +#define PIRQ_STARTUP 1 +#define PIRQ_SHUTDOWN 2 +#define PIRQ_ENABLE 3 +#define PIRQ_DISABLE 4 +#define PIRQ_END 5 +#define PIRQ_ACK 6 + #endif /* __ASM_EVTCHN_H__ */ diff -r 81c5a517a42b -r 9f9b4214bec8 include/xen/interface/io/pciif.h --- a/include/xen/interface/io/pciif.h Tue Apr 22 18:56:27 2008 +0100 +++ b/include/xen/interface/io/pciif.h Thu May 01 10:35:30 2008 +0100 @@ -34,6 +34,10 @@ /* xen_pci_op commands */ #define XEN_PCI_OP_conf_read (0) #define XEN_PCI_OP_conf_write (1) +#define XEN_PCI_OP_enable_msi (2) +#define XEN_PCI_OP_enable_msix (3) +#define XEN_PCI_OP_disable_msi (4) +#define XEN_PCI_OP_disable_msix (5) /* xen_pci_op error numbers */ #define XEN_PCI_ERR_success (0) @@ -43,6 +47,12 @@ #define XEN_PCI_ERR_not_implemented (-4) /* XEN_PCI_ERR_op_failed - backend failed to complete the operation */ #define XEN_PCI_ERR_op_failed (-5) + +/* + * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry)) + * Should not exceed 128 + */ +#define SH_INFO_MAX_VEC 128 struct xen_pci_op { /* IN: what action to perform: XEN_PCI_OP_* */ @@ -62,6 +72,11 @@ struct xen_pci_op { /* IN/OUT: Contains the result after a READ or the value to WRITE */ uint32_t value; + /* IN: Contains extra infor for this operation */ + uint32_t info; + /*IN: param for msi-x */ + struct msix_entry msix_entries[SH_INFO_MAX_VEC]; + }; struct xen_pci_sharedinfo { diff -r 81c5a517a42b -r 9f9b4214bec8 include/xen/interface/physdev.h --- a/include/xen/interface/physdev.h Tue Apr 22 18:56:27 2008 +0100 +++ b/include/xen/interface/physdev.h Thu May 01 10:35:30 2008 +0100 @@ -122,6 +122,38 @@ typedef struct physdev_irq physdev_irq_t typedef struct physdev_irq physdev_irq_t; DEFINE_XEN_GUEST_HANDLE(physdev_irq_t); +#define MAP_PIRQ_TYPE_MSI 0x0 +#define MAP_PIRQ_TYPE_GSI 0x1 +#define MAP_PIRQ_TYPE_UNKNOWN 0x2 + +#define PHYSDEVOP_map_pirq 13 +struct physdev_map_pirq { + domid_t domid; + /* IN */ + int type; + /* IN */ + int index; + /* IN or OUT */ + int pirq; + /* msi info passed to VMM */ + struct { + int bus, devfn, entry_nr; + int msi; /* 0 - MSIX 1 - MSI */ + } msi_info; +}; +typedef struct physdev_map_pirq physdev_map_pirq_t; +DEFINE_XEN_GUEST_HANDLE(physdev_map_pirq_t); + +#define PHYSDEVOP_unmap_pirq 14 +struct physdev_unmap_pirq { + domid_t domid; + /* IN */ + int pirq; +}; + +typedef struct physdev_unmap_pirq physdev_unmap_pirq_t; +DEFINE_XEN_GUEST_HANDLE(physdev_unmap_pirq_t); + /* * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op() * hypercall since 0x00030202. _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:05 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:05 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra4q-0004PW-NX for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:05 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5N-0004Lm-Fc; Thu, 01 May 2008 14:48:37 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDM-0000Nq-3a for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:36 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDB-0000OS-JZ for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:33 +0000 X-SBRS: 3.6 X-MesageID: 107395 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107395" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:13 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0DMD010673 for ; Thu, 1 May 2008 03:00:13 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0UvF015670 for ; Thu, 1 May 2008 03:00:30 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0UHS015669 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:30 -0700 Message-Id: <200805011000.m41A0UHS015669@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:30 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Add basic interface to allow ACPI processor events revealed to X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209635526 -3600 # Node ID 3da869d5095b191050f1527b896d87f3afab3f27 # Parent 9f9b4214bec8c82f835b43554b798e107371749f Add basic interface to allow ACPI processor events revealed to external control logic like VMM. Signed-off-by: Tian Kevin Signed-off-by: Wei Gang --- drivers/acpi/Kconfig | 5 + drivers/acpi/Makefile | 3 + drivers/acpi/processor_extcntl.c | 111 +++++++++++++++++++++++++++++++++++++++ include/acpi/processor.h | 72 +++++++++++++++++++++++++ 4 files changed, 191 insertions(+) diff -r 9f9b4214bec8 -r 3da869d5095b drivers/acpi/Kconfig --- a/drivers/acpi/Kconfig Thu May 01 10:35:30 2008 +0100 +++ b/drivers/acpi/Kconfig Thu May 01 10:52:06 2008 +0100 @@ -367,6 +367,11 @@ config ACPI_PV_SLEEP bool depends on X86 && XEN && ACPI_SLEEP default y + +config PROCESSOR_EXTERNAL_CONTROL + bool + depends on X86 && XEN + default y endif # ACPI endmenu diff -r 9f9b4214bec8 -r 3da869d5095b drivers/acpi/Makefile --- a/drivers/acpi/Makefile Thu May 01 10:35:30 2008 +0100 +++ b/drivers/acpi/Makefile Thu May 01 10:52:06 2008 +0100 @@ -34,6 +34,9 @@ ifdef CONFIG_CPU_FREQ ifdef CONFIG_CPU_FREQ processor-objs += processor_perflib.o endif +ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL +processor-objs += processor_extcntl.o +endif obj-y += sleep/ obj-y += bus.o glue.o diff -r 9f9b4214bec8 -r 3da869d5095b drivers/acpi/processor_extcntl.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/acpi/processor_extcntl.c Thu May 01 10:52:06 2008 +0100 @@ -0,0 +1,111 @@ +/* + * processor_extcntl.c - channel to external control logic + * + * Copyright (C) 2008, Intel corporation + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +/* + * External processor control logic may register with its own set of + * ops to get ACPI related notification. One example is like VMM. + */ +struct processor_extcntl_ops *processor_extcntl_ops; + +int processor_notify_external(struct acpi_processor *pr, int event, int type) +{ + int ret = -EINVAL; + + if (!processor_cntl_external()) + return -EINVAL; + + switch (event) { + case PROCESSOR_PM_INIT: + case PROCESSOR_PM_CHANGE: + if ((type >= PM_TYPE_MAX) || + !processor_extcntl_ops->pm_ops[type]) + break; + + ret = processor_extcntl_ops->pm_ops[type](pr, event); + break; + case PROCESSOR_HOTPLUG: + if (processor_extcntl_ops->hotplug) + ret = processor_extcntl_ops->hotplug(pr, type); + break; + default: + printk(KERN_ERR "Unsupport processor events %d.\n", event); + break; + } + + return ret; +} + +/* + * External control logic can decide to grab full or part of physical + * processor control bits. Take a VMM for example, physical processors + * are owned by VMM and thus existence information like hotplug is + * always required to be notified to VMM. Similar is processor idle + * state which is also necessarily controlled by VMM. But for other + * control bits like performance/throttle states, VMM may choose to + * control or not upon its own policy. + * + * Such ownership is unlikely to be switched in the fly, and thus + * not sure unregister interface is required or not. Being same reason, + * lock is not forced now. + */ +int processor_register_extcntl(struct processor_extcntl_ops *ops) +{ + if (!ops) + return -EINVAL; + + if (processor_extcntl_ops && + (processor_extcntl_ops != ops)) + return -EBUSY; + + processor_extcntl_ops = ops; + return 0; +} + +int processor_unregister_extcntl(struct processor_extcntl_ops *ops) +{ + if (processor_extcntl_ops == ops) + processor_extcntl_ops = NULL; + + return 0; +} + +/* + * This is called from ACPI processor init, and targeted to hold + * some tricky housekeeping jobs to satisfy external control model. + * For example, we may put dependency parse stub here for idle + * and performance state. Those information may be not available + * if splitting from dom0 control logic like cpufreq driver. + */ +int processor_extcntl_init(struct acpi_processor *pr) +{ + return 0; +} diff -r 9f9b4214bec8 -r 3da869d5095b include/acpi/processor.h --- a/include/acpi/processor.h Thu May 01 10:35:30 2008 +0100 +++ b/include/acpi/processor.h Thu May 01 10:52:06 2008 +0100 @@ -275,4 +275,76 @@ static inline void acpi_thermal_cpufreq_ } #endif +/* + * Following are interfaces geared to external processor PM control + * logic like a VMM + */ +/* Events notified to external control logic */ +#define PROCESSOR_PM_INIT 1 +#define PROCESSOR_PM_CHANGE 2 +#define PROCESSOR_HOTPLUG 3 + +/* Objects for the PM envents */ +#define PM_TYPE_IDLE 0 +#define PM_TYPE_PERF 1 +#define PM_TYPE_THR 2 +#define PM_TYPE_MAX 3 + +/* Processor hotplug events */ +#define HOTPLUG_TYPE_ADD 0 +#define HOTPLUG_TYPE_REMOVE 1 + +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL +struct processor_extcntl_ops { + /* Transfer processor PM events to external control logic */ + int (*pm_ops[PM_TYPE_MAX])(struct acpi_processor *pr, int event); + /* Notify physical processor status to external control logic */ + int (*hotplug)(struct acpi_processor *pr, int event); +}; +extern struct processor_extcntl_ops *processor_extcntl_ops; + +static inline int processor_cntl_external(void) +{ + return (processor_extcntl_ops != NULL); +} + +static inline int processor_pm_external(void) +{ + return processor_cntl_external() && + (processor_extcntl_ops->pm_ops[PM_TYPE_IDLE] != NULL); +} + +static inline int processor_pmperf_external(void) +{ + return processor_cntl_external() && + (processor_extcntl_ops->pm_ops[PM_TYPE_PERF] != NULL); +} + +static inline int processor_pmthr_external(void) +{ + return processor_cntl_external() && + (processor_extcntl_ops->pm_ops[PM_TYPE_THR] != NULL); +} + +extern int processor_notify_external(struct acpi_processor *pr, + int event, int type); +extern int processor_register_extcntl(struct processor_extcntl_ops *ops); +extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops); +extern int processor_extcntl_init(struct acpi_processor *pr); +#else +static inline int processor_cntl_external(void) {return 0;} +static inline int processor_pm_external(void) {return 0;} +static inline int processor_pmperf_external(void) {return 0;} +static inline int processor_pmthr_external(void) {return 0;} +static inline int processor_notify_external(struct acpi_processor *pr, + int event, int type) +{ + return -EINVAL; +} +static inline int processor_extcntl_init(struct acpi_processor *pr) +{ + return -EINVAL; +} +#endif /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */ + #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:08 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:08 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra4u-0004PZ-Ai for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:08 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5R-0004P5-12; Thu, 01 May 2008 14:48:41 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDM-0000Nr-Gy for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:36 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDC-0000PT-Rv for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:34 +0000 X-SBRS: 3.6 X-MesageID: 107396 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107396" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:14 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0ESi010676 for ; Thu, 1 May 2008 03:00:14 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0VTa015687 for ; Thu, 1 May 2008 03:00:31 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0VVX015686 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:31 -0700 Message-Id: <200805011000.m41A0VVX015686@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:31 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Notify ACPI processor events to external logic, including C/P/T and hotplug, etc. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209635551 -3600 # Node ID 3c564f80f2ef2b458f9a81598c0928acb72cc891 # Parent 3da869d5095b191050f1527b896d87f3afab3f27 Notify ACPI processor events to external logic, including C/P/T and hotplug, etc. Signed-off-by: Tian Kevin Signed-off-by: Wei Gang --- arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 9 +++++++++ drivers/acpi/processor_core.c | 17 +++++++++++++++++ drivers/acpi/processor_idle.c | 13 ++++++++++--- drivers/acpi/processor_perflib.c | 5 ++++- 4 files changed, 40 insertions(+), 4 deletions(-) diff -r 3da869d5095b -r 3c564f80f2ef arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c Thu May 01 10:52:06 2008 +0100 +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c Thu May 01 10:52:31 2008 +0100 @@ -568,6 +568,15 @@ acpi_cpufreq_init (void) { dprintk("acpi_cpufreq_init\n"); + /* + * This effectively blocks in-kernel cpufreq driver to interfere + * external control logic + */ + if (processor_pmperf_external()) { + printk("CPUFREQ is controllerd externally...exit then!\n"); + return -1; + } + acpi_cpufreq_early_init_acpi(); return cpufreq_register_driver(&acpi_cpufreq_driver); diff -r 3da869d5095b -r 3c564f80f2ef drivers/acpi/processor_core.c --- a/drivers/acpi/processor_core.c Thu May 01 10:52:06 2008 +0100 +++ b/drivers/acpi/processor_core.c Thu May 01 10:52:31 2008 +0100 @@ -564,6 +564,10 @@ static int acpi_processor_start(struct a acpi_processor_power_init(pr, device); +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL + processor_extcntl_init(pr); +#endif + if (pr->flags.throttling) { printk(KERN_INFO PREFIX "%s [%s] (supports", acpi_device_name(device), acpi_device_bid(device)); @@ -709,6 +713,10 @@ int acpi_processor_device_add(acpi_handl pr = acpi_driver_data(*device); if (!pr) return -ENODEV; + + if (processor_cntl_external()) + processor_notify_external(pr, + PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD); if ((pr->id >= 0) && (pr->id < NR_CPUS)) { kobject_uevent(&(*device)->kobj, KOBJ_ONLINE); @@ -747,6 +755,10 @@ acpi_processor_hotplug_notify(acpi_handl printk(KERN_ERR PREFIX "Driver data is NULL\n"); break; } + + if (processor_cntl_external()) + processor_notify_external(pr, + PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD); if (pr->id >= 0 && (pr->id < NR_CPUS)) { kobject_uevent(&device->kobj, KOBJ_OFFLINE); @@ -779,6 +791,11 @@ acpi_processor_hotplug_notify(acpi_handl if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) kobject_uevent(&device->kobj, KOBJ_OFFLINE); + + if (processor_cntl_external()) + processor_notify_external(pr, PROCESSOR_HOTPLUG, + HOTPLUG_TYPE_REMOVE); + break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, diff -r 3da869d5095b -r 3c564f80f2ef drivers/acpi/processor_idle.c --- a/drivers/acpi/processor_idle.c Thu May 01 10:52:06 2008 +0100 +++ b/drivers/acpi/processor_idle.c Thu May 01 10:52:31 2008 +0100 @@ -985,12 +985,16 @@ int acpi_processor_cst_has_changed(struc return -ENODEV; /* Fall back to the default idle loop */ - pm_idle = pm_idle_save; + if (!processor_pm_external()) + pm_idle = pm_idle_save; synchronize_sched(); /* Relies on interrupts forcing exit from idle. */ pr->flags.power = 0; result = acpi_processor_get_power_info(pr); - if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) + if (processor_pm_external()) + processor_notify_external(pr, + PROCESSOR_PM_CHANGE, PM_TYPE_IDLE); + else if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) pm_idle = acpi_processor_idle; return result; @@ -1122,7 +1126,7 @@ int acpi_processor_power_init(struct acp pr->power.states[i].type); printk(")\n"); - if (pr->id == 0) { + if (!processor_pm_external() && (pr->id == 0)) { pm_idle_save = pm_idle; pm_idle = acpi_processor_idle; } @@ -1141,6 +1145,9 @@ int acpi_processor_power_init(struct acp pr->flags.power_setup_done = 1; + if (processor_pm_external()) + processor_notify_external(pr, + PROCESSOR_PM_INIT, PM_TYPE_IDLE); return 0; } diff -r 3da869d5095b -r 3c564f80f2ef drivers/acpi/processor_perflib.c --- a/drivers/acpi/processor_perflib.c Thu May 01 10:52:06 2008 +0100 +++ b/drivers/acpi/processor_perflib.c Thu May 01 10:52:31 2008 +0100 @@ -136,8 +136,11 @@ int acpi_processor_ppc_has_changed(struc int ret = acpi_processor_get_platform_limit(pr); if (ret < 0) return (ret); + else if (!processor_pmperf_external()) + return cpufreq_update_policy(pr->id); else - return cpufreq_update_policy(pr->id); + return processor_notify_external(pr, + PROCESSOR_PM_CHANGE, PM_TYPE_PERF); } void acpi_processor_ppc_init(void) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra4y-0004Pc-NE for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5V-0004SW-D1; Thu, 01 May 2008 14:48:45 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDO-0000Ns-0D for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:38 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDD-0000P1-IJ for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:35 +0000 X-SBRS: 3.6 X-MesageID: 107397 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107397" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:15 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0FwX010679 for ; Thu, 1 May 2008 03:00:15 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0XGk015722 for ; Thu, 1 May 2008 03:00:33 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0X7W015721 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:33 -0700 Message-Id: <200805011000.m41A0X7W015721@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:32 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Notify xen about Cx acpi info, such as table returned by _CST/_CSD methods. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209635587 -3600 # Node ID e97855b90cc280e75c583cc6ac78d924f8cf16b8 # Parent 3c564f80f2ef2b458f9a81598c0928acb72cc891 Notify xen about Cx acpi info, such as table returned by _CST/_CSD methods. Add notifiers for P/T & hotplug as placeholders. Add option "xen_processor_pmbits" for enable/disable control. Signed-off-by: Tian Kevin Signed-off-by: Wei Gang --- arch/i386/kernel/acpi/Makefile | 1 arch/i386/kernel/acpi/processor_extcntl_xen.c | 142 ++++++++++++++++++++++++++ arch/x86_64/kernel/acpi/Makefile | 2 drivers/acpi/Kconfig | 1 drivers/acpi/processor_extcntl.c | 26 ++++ drivers/acpi/processor_idle.c | 22 +++- include/acpi/processor.h | 17 +++ include/xen/interface/platform.h | 73 +++++++++++++ 8 files changed, 279 insertions(+), 5 deletions(-) diff -r 3c564f80f2ef -r e97855b90cc2 arch/i386/kernel/acpi/Makefile --- a/arch/i386/kernel/acpi/Makefile Thu May 01 10:52:31 2008 +0100 +++ b/arch/i386/kernel/acpi/Makefile Thu May 01 10:53:07 2008 +0100 @@ -1,6 +1,7 @@ obj-$(CONFIG_ACPI) += boot.o obj-$(CONFIG_ACPI) += boot.o obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o +obj-$(CONFIG_XEN) += processor_extcntl_xen.o ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += cstate.o processor.o diff -r 3c564f80f2ef -r e97855b90cc2 arch/i386/kernel/acpi/processor_extcntl_xen.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c Thu May 01 10:53:07 2008 +0100 @@ -0,0 +1,142 @@ +/* + * processor_extcntl_xen.c - interface to notify Xen + * + * Copyright (C) 2008, Intel corporation + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +static int xen_processor_pmbits; +static int __init set_xen_processor_pmbits(char *str) +{ + get_option(&str, &xen_processor_pmbits); + + return 1; +} +__setup("xen_processor_pmbits=", set_xen_processor_pmbits); +EXPORT_SYMBOL(xen_processor_pmbits); + +static int xen_cx_notifier(struct acpi_processor *pr, int action) +{ + int ret, count = 0, i; + xen_platform_op_t op = { + .cmd = XENPF_set_processor_pminfo, + .interface_version = XENPF_INTERFACE_VERSION, + .u.set_pminfo.id = pr->acpi_id, + .u.set_pminfo.type = XEN_PM_CX, + }; + struct xen_processor_cx *data, *buf; + struct acpi_processor_cx *cx; + + if (action == PROCESSOR_PM_CHANGE) + return -EINVAL; + + /* Convert to Xen defined structure and hypercall */ + buf = kzalloc(pr->power.count * sizeof(struct xen_processor_cx), + GFP_KERNEL); + if (!buf) + return -ENOMEM; + + data = buf; + for (i = 1; i <= pr->power.count; i++) { + cx = &pr->power.states[i]; + /* Skip invalid cstate entry */ + if (!cx->valid) + continue; + + data->type = cx->type; + data->latency = cx->latency; + data->power = cx->power; + data->reg.space_id = cx->reg.space_id; + data->reg.bit_width = cx->reg.bit_width; + data->reg.bit_offset = cx->reg.bit_offset; + data->reg.access_size = cx->reg.reserved; + data->reg.address = cx->reg.address; + + /* Get dependency relationships */ + if (cx->csd_count) { + printk("Wow! _CSD is found. Not support for now!\n"); + kfree(buf); + return -EINVAL; + } else { + data->dpcnt = 0; + set_xen_guest_handle(data->dp, NULL); + } + + data++; + count++; + } + + if (!count) { + printk("No available Cx info for cpu %d\n", pr->acpi_id); + kfree(buf); + return -EINVAL; + } + + op.u.set_pminfo.power.count = count; + op.u.set_pminfo.power.flags.bm_control = pr->flags.bm_control; + op.u.set_pminfo.power.flags.bm_check = pr->flags.bm_check; + op.u.set_pminfo.power.flags.has_cst = pr->flags.has_cst; + op.u.set_pminfo.power.flags.power_setup_done = pr->flags.power_setup_done; + + set_xen_guest_handle(op.u.set_pminfo.power.states, buf); + ret = HYPERVISOR_platform_op(&op); + kfree(buf); + return ret; +} + +static int xen_px_notifier(struct acpi_processor *pr, int action) +{ + return -EINVAL; +} + +static int xen_tx_notifier(struct acpi_processor *pr, int action) +{ + return -EINVAL; +} +static int xen_hotplug_notifier(struct acpi_processor *pr, int event) +{ + return -EINVAL; +} + +static struct processor_extcntl_ops xen_extcntl_ops = { + .hotplug = xen_hotplug_notifier, +}; + +static int __cpuinit xen_init_processor_extcntl(void) +{ + if (xen_processor_pmbits & XEN_PROCESSOR_PM_CX) + xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier; + if (xen_processor_pmbits & XEN_PROCESSOR_PM_PX) + xen_extcntl_ops.pm_ops[PM_TYPE_PERF] = xen_px_notifier; + if (xen_processor_pmbits & XEN_PROCESSOR_PM_TX) + xen_extcntl_ops.pm_ops[PM_TYPE_THR] = xen_tx_notifier; + + return processor_register_extcntl(&xen_extcntl_ops); +} +core_initcall(xen_init_processor_extcntl); diff -r 3c564f80f2ef -r e97855b90cc2 arch/x86_64/kernel/acpi/Makefile --- a/arch/x86_64/kernel/acpi/Makefile Thu May 01 10:52:31 2008 +0100 +++ b/arch/x86_64/kernel/acpi/Makefile Thu May 01 10:53:07 2008 +0100 @@ -8,4 +8,6 @@ processor-$(CONFIG_XEN) := ../../../i386 processor-$(CONFIG_XEN) := ../../../i386/kernel/acpi/processor.o endif +obj-$(CONFIG_XEN) += processor_extcnt_xen.o +processor_extcnt_xen-$(CONFIG_XEN) := ../../../i386/kernel/acpi/processor_extcntl_xen.o disabled-obj-$(CONFIG_XEN) := wakeup.o diff -r 3c564f80f2ef -r e97855b90cc2 drivers/acpi/Kconfig --- a/drivers/acpi/Kconfig Thu May 01 10:52:31 2008 +0100 +++ b/drivers/acpi/Kconfig Thu May 01 10:53:07 2008 +0100 @@ -371,6 +371,7 @@ config PROCESSOR_EXTERNAL_CONTROL config PROCESSOR_EXTERNAL_CONTROL bool depends on X86 && XEN + select ACPI_PROCESSOR default y endif # ACPI diff -r 3c564f80f2ef -r e97855b90cc2 drivers/acpi/processor_extcntl.c --- a/drivers/acpi/processor_extcntl.c Thu May 01 10:52:31 2008 +0100 +++ b/drivers/acpi/processor_extcntl.c Thu May 01 10:53:07 2008 +0100 @@ -30,6 +30,7 @@ #include +static int processor_extcntl_parse_csd(struct acpi_processor *pr); /* * External processor control logic may register with its own set of * ops to get ACPI related notification. One example is like VMM. @@ -107,5 +108,30 @@ int processor_unregister_extcntl(struct */ int processor_extcntl_init(struct acpi_processor *pr) { + /* parse cstate dependency information */ + processor_extcntl_parse_csd(pr); + return 0; } + +/* + * Currently no _CSD is implemented which is why existing ACPI code + * doesn't parse _CSD at all. But to keep interface complete with + * external control logic, we put a placeholder here for future + * compatibility. + */ +static int processor_extcntl_parse_csd(struct acpi_processor *pr) +{ + int i; + + for (i = 0; i < pr->power.count; i++) { + if (!pr->power.states[i].valid) + continue; + + /* No dependency by default */ + pr->power.states[i].domain_info = NULL; + pr->power.states[i].csd_count = 0; + } + + return 0; +} diff -r 3c564f80f2ef -r e97855b90cc2 drivers/acpi/processor_idle.c --- a/drivers/acpi/processor_idle.c Thu May 01 10:52:31 2008 +0100 +++ b/drivers/acpi/processor_idle.c Thu May 01 10:53:07 2008 +0100 @@ -714,8 +714,12 @@ static int acpi_processor_get_power_info (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) continue; - cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? - 0 : reg->address; + if (!processor_pm_external()) + cx.address = (reg->space_id == + ACPI_ADR_SPACE_FIXED_HARDWARE) ? + 0 : reg->address; + else + cx.address = reg->address; /* There should be an easy way to extract an integer... */ obj = (union acpi_object *)&(element->package.elements[1]); @@ -724,9 +728,11 @@ static int acpi_processor_get_power_info cx.type = obj->integer.value; - if ((cx.type != ACPI_STATE_C1) && - (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) - continue; + /* Following check doesn't apply to external control case */ + if (!processor_pm_external()) + if ((cx.type != ACPI_STATE_C1) && + (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) + continue; if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3)) continue; @@ -742,6 +748,12 @@ static int acpi_processor_get_power_info continue; cx.power = obj->integer.value; + +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL + /* cache control methods to notify external logic */ + if (processor_pm_external()) + memcpy(&cx.reg, reg, sizeof(*reg)); +#endif current_count++; memcpy(&(pr->power.states[current_count]), &cx, sizeof(cx)); diff -r 3c564f80f2ef -r e97855b90cc2 include/acpi/processor.h --- a/include/acpi/processor.h Thu May 01 10:52:31 2008 +0100 +++ b/include/acpi/processor.h Thu May 01 10:53:07 2008 +0100 @@ -32,6 +32,17 @@ /* Power Management */ struct acpi_processor_cx; + +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL +struct acpi_csd_package { + acpi_integer num_entries; + acpi_integer revision; + acpi_integer domain; + acpi_integer coord_type; + acpi_integer num_processors; + acpi_integer index; +} __attribute__ ((packed)); +#endif struct acpi_power_register { u8 descriptor; @@ -63,6 +74,12 @@ struct acpi_processor_cx { u32 power; u32 usage; u64 time; +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL + /* Require raw information for external control logic */ + struct acpi_power_register reg; + u32 csd_count; + struct acpi_csd_package *domain_info; +#endif struct acpi_processor_cx_policy promotion; struct acpi_processor_cx_policy demotion; }; diff -r 3c564f80f2ef -r e97855b90cc2 include/xen/interface/platform.h --- a/include/xen/interface/platform.h Thu May 01 10:52:31 2008 +0100 +++ b/include/xen/interface/platform.h Thu May 01 10:53:07 2008 +0100 @@ -199,6 +199,78 @@ typedef struct xenpf_getidletime xenpf_g typedef struct xenpf_getidletime xenpf_getidletime_t; DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t); +#define XENPF_set_processor_pminfo 54 + +/* ability bits */ +#define XEN_PROCESSOR_PM_CX 1 +#define XEN_PROCESSOR_PM_PX 2 +#define XEN_PROCESSOR_PM_TX 4 + +/* cmd type */ +#define XEN_PM_CX 0 +#define XEN_PM_PX 1 +#define XEN_PM_TX 2 + +struct xen_power_register { + uint32_t space_id; + uint32_t bit_width; + uint32_t bit_offset; + uint32_t access_size; + uint64_t address; +}; + +struct xen_processor_csd { + uint32_t domain; /* domain number of one dependent group */ + uint32_t coord_type; /* coordination type */ + uint32_t num; /* number of processors in same domain */ +}; +typedef struct xen_processor_csd xen_processor_csd_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_csd_t); + +struct xen_processor_cx { + struct xen_power_register reg; /* GAS for Cx trigger register */ + uint8_t type; /* cstate value, c0: 0, c1: 1, ... */ + uint32_t latency; /* worst latency (ms) to enter/exit this cstate */ + uint32_t power; /* average power consumption(mW) */ + uint32_t dpcnt; /* number of dependency entries */ + XEN_GUEST_HANDLE(xen_processor_csd_t) dp; /* NULL if no dependency */ +}; +typedef struct xen_processor_cx xen_processor_cx_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_cx_t); + +struct xen_processor_flags { + uint8_t bm_control:1; + uint8_t bm_check:1; + uint8_t has_cst:1; + uint8_t power_setup_done:1; + uint8_t bm_rld_set:1; +}; + +struct xen_processor_power { + uint32_t count; /* number of C state entries in array below */ + struct xen_processor_flags flags; /* global flags of this processor */ + XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */ +}; + +struct xen_processor_performance { +}; + +struct xen_processor_throttling { +}; + +struct xenpf_set_processor_pminfo { + /* IN variables */ + uint32_t id; /* ACPI CPU ID */ + uint32_t type; /* {XEN_PM_CX, XEN_PM_PX, XEN_PM_TX} */ + union { + struct xen_processor_power power;/* Cx: _CST/_CSD */ + struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ + struct xen_processor_throttling throt;/* Tx: _TPC/_PTC/_TSS/_TSD */ + }; +}; +typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; +DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t); + struct xen_platform_op { uint32_t cmd; uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ @@ -213,6 +285,7 @@ struct xen_platform_op { struct xenpf_enter_acpi_sleep enter_acpi_sleep; struct xenpf_change_freq change_freq; struct xenpf_getidletime getidletime; + struct xenpf_set_processor_pminfo set_pminfo; uint8_t pad[128]; } u; }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra55-0004Ph-5B for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5b-0004Z5-T3; Thu, 01 May 2008 14:48:51 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDZ-0000OA-EI for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDG-0000PM-5R for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:47 +0000 X-SBRS: 3.6 X-MesageID: 107398 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107398" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:16 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0Giw010682 for ; Thu, 1 May 2008 03:00:16 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0YPh015739 for ; Thu, 1 May 2008 03:00:34 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0YAi015738 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:34 -0700 Message-Id: <200805011000.m41A0YAi015738@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:33 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Handle dom0_max_vcpus < nr_pcpu cases, e.g. UP dom0. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209635617 -3600 # Node ID d62d60eaba6e7fea87847b2e8042146aea61a871 # Parent e97855b90cc280e75c583cc6ac78d924f8cf16b8 Handle dom0_max_vcpus < nr_pcpu cases, e.g. UP dom0. Just try to pass info about all acpi processors to xen even in such cases. Signed-off-by: Tian Kevin Signed-off-by: Wei Gang --- arch/i386/kernel/acpi/processor.c | 10 ++++++++-- drivers/acpi/processor_core.c | 30 +++++++++++++++++++----------- include/acpi/processor.h | 2 ++ 3 files changed, 29 insertions(+), 13 deletions(-) diff -r e97855b90cc2 -r d62d60eaba6e arch/i386/kernel/acpi/processor.c --- a/arch/i386/kernel/acpi/processor.c Thu May 01 10:53:07 2008 +0100 +++ b/arch/i386/kernel/acpi/processor.c Thu May 01 10:53:37 2008 +0100 @@ -59,10 +59,16 @@ static void init_intel_pdc(struct acpi_p return; } -/* Initialize _PDC data based on the CPU vendor */ +/* + * Initialize _PDC data based on the CPU vendor. As a work-around, just + * use cpu0's cpuinfo for all processors. Further work is required + * to expose xen hypervisor interface of getting physical cpuinfo to dom0 + * kerneland then arch_acpi_processor_init_pdc can set _PDC parameters + * according to Xen's phys information. + */ void arch_acpi_processor_init_pdc(struct acpi_processor *pr) { - unsigned int cpu = pr->id; + unsigned int cpu = 0; struct cpuinfo_x86 *c = cpu_data + cpu; pr->pdc = NULL; diff -r e97855b90cc2 -r d62d60eaba6e drivers/acpi/processor_core.c --- a/drivers/acpi/processor_core.c Thu May 01 10:53:07 2008 +0100 +++ b/drivers/acpi/processor_core.c Thu May 01 10:53:37 2008 +0100 @@ -475,7 +475,8 @@ static int acpi_processor_get_info(struc */ if (cpu_index == -1) { if (ACPI_FAILURE - (acpi_processor_hotadd_init(pr->handle, &pr->id))) { + (acpi_processor_hotadd_init(pr->handle, &pr->id)) && + !processor_cntl_external()) { printk(KERN_ERR PREFIX "Getting cpuindex for acpiid 0x%x\n", pr->acpi_id); @@ -517,7 +518,7 @@ static int acpi_processor_get_info(struc return 0; } -static void *processor_device_array[NR_CPUS]; +static void *processor_device_array[NR_ACPI_CPUS]; static int acpi_processor_start(struct acpi_device *device) { @@ -529,27 +530,29 @@ static int acpi_processor_start(struct a pr = acpi_driver_data(device); result = acpi_processor_get_info(pr); - if (result) { + if (result || + ((pr->id == -1) && !processor_cntl_external())) { /* Processor is physically not present */ return 0; } - BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); + BUG_ON(!processor_cntl_external() && + ((pr->id >= NR_CPUS) || (pr->id < 0))); /* * Buggy BIOS check * ACPI id of processors can be reported wrongly by the BIOS. * Don't trust it blindly */ - if (processor_device_array[pr->id] != NULL && - processor_device_array[pr->id] != (void *)device) { + if (processor_device_array[pr->acpi_id] != NULL && + processor_device_array[pr->acpi_id] != (void *)device) { printk(KERN_WARNING "BIOS reported wrong ACPI id" "for the processor\n"); return -ENODEV; } - processor_device_array[pr->id] = (void *)device; - - processors[pr->id] = pr; + processor_device_array[pr->acpi_id] = (void *)device; + if (pr->id != -1) + processors[pr->id] = pr; result = acpi_processor_add_fs(device); if (result) @@ -660,7 +663,8 @@ static int acpi_processor_remove(struct acpi_processor_remove_fs(device); - processors[pr->id] = NULL; + if (pr->id != -1) + processors[pr->id] = NULL; kfree(pr); @@ -789,7 +793,8 @@ acpi_processor_hotplug_notify(acpi_handl return; } - if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) + if ((pr->id >= 0) && (pr->id < NR_CPUS) + && (cpu_present(pr->id))) kobject_uevent(&device->kobj, KOBJ_OFFLINE); if (processor_cntl_external()) @@ -860,6 +865,9 @@ static acpi_status acpi_processor_hotadd static int acpi_processor_handle_eject(struct acpi_processor *pr) { + if (pr->id == -1) + return (0); + if (cpu_online(pr->id)) { return (-EINVAL); } diff -r e97855b90cc2 -r d62d60eaba6e include/acpi/processor.h --- a/include/acpi/processor.h Thu May 01 10:53:07 2008 +0100 +++ b/include/acpi/processor.h Thu May 01 10:53:37 2008 +0100 @@ -20,6 +20,8 @@ #define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */ #define ACPI_PSD_REV0_ENTRIES 5 + +#define NR_ACPI_CPUS 256 /* * Types of coordination defined in ACPI 3.0. Same macros can be used across _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:21 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:21 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra56-0004Pi-QI for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:21 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5Y-0004Vx-KZ; Thu, 01 May 2008 14:48:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDY-0000O7-Em for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDK-0000PT-Lu for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:41 +0000 X-SBRS: 3.6 X-MesageID: 107402 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107402" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:36 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0afn010691 for ; Thu, 1 May 2008 03:00:36 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0raS015973 for ; Thu, 1 May 2008 03:00:53 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0rY4015972 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:53 -0700 Message-Id: <200805011000.m41A0rY4015972@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:53 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86: Fix a typo in shadow_get_and_create_l1e(). X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209633344 -3600 # Node ID 76815d93d8c9856c12905c5a463054ac01ec8722 # Parent fa7cfe1d847a036da8f59a654444bd5683c41f9d x86: Fix a typo in shadow_get_and_create_l1e(). The typo is benign because sh_page_fault() gates the call to shadow_get_and_create_l1e() on an equivalent test. Signed-off-by: Tim Deegan xen-unstable changeset: 17505:bc7ee2f93852b0ac1e644a5604dda223f12b8604 xen-unstable date: Wed Apr 23 13:32:58 2008 +0100 --- xen/arch/x86/mm/shadow/multi.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r fa7cfe1d847a -r 76815d93d8c9 xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu May 01 10:15:18 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Thu May 01 10:15:44 2008 +0100 @@ -2006,7 +2006,7 @@ static shadow_l1e_t * shadow_get_and_cre else { /* Shadowing an actual guest l1 table */ - if ( !mfn_valid(gw->l2mfn) ) return NULL; /* No guest page. */ + if ( !mfn_valid(gw->l1mfn) ) return NULL; /* No guest page. */ *sl1mfn = get_shadow_status(v, gw->l1mfn, SH_type_l1_shadow); if ( !mfn_valid(*sl1mfn) ) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra58-0004Pl-Te for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5f-0004cu-KR; Thu, 01 May 2008 14:48:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDa-0000O8-9c for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDM-0000P1-Bt for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:43 +0000 X-SBRS: 3.6 X-MesageID: 107403 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107403" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:37 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0bId010694 for ; Thu, 1 May 2008 03:00:37 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0sXZ015990 for ; Thu, 1 May 2008 03:00:54 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0soX015989 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:54 -0700 Message-Id: <200805011000.m41A0soX015989@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:54 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86 time: Read platform time before locally-extrapolated time during X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209633430 -3600 # Node ID 01615264bb88a0cc8c674c5cb0d30fb2862d33c0 # Parent 76815d93d8c9856c12905c5a463054ac01ec8722 x86 time: Read platform time before locally-extrapolated time during calibration and frequency changes. This places the variable delay (acquiring the platform_timer_lock) safely as the very first thing we do, avoiding a variable delay /between/ computing the two timestamps. Problem diagnosed by Dave Winchell Signed-off-by: Keir Fraser xen-unstable changeset: 17526:013a47065e8c4e815e3b1aba0883341c19238e82 xen-unstable date: Thu May 01 09:45:44 2008 +0100 --- xen/arch/x86/time.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff -r 76815d93d8c9 -r 01615264bb88 xen/arch/x86/time.c --- a/xen/arch/x86/time.c Thu May 01 10:15:44 2008 +0100 +++ b/xen/arch/x86/time.c Thu May 01 10:17:10 2008 +0100 @@ -738,12 +738,13 @@ int cpu_frequency_change(u64 freq) } local_irq_disable(); - rdtscll(curr_tsc); - t->local_tsc_stamp = curr_tsc; + /* Platform time /first/, as we may be delayed by platform_timer_lock. */ t->stime_master_stamp = read_platform_stime(); /* TSC-extrapolated time may be bogus after frequency change. */ /*t->stime_local_stamp = get_s_time();*/ t->stime_local_stamp = t->stime_master_stamp; + rdtscll(curr_tsc); + t->local_tsc_stamp = curr_tsc; set_time_scale(&t->tsc_scale, freq); local_irq_enable(); @@ -813,11 +814,14 @@ static void local_time_calibration(void prev_local_stime = t->stime_local_stamp; prev_master_stime = t->stime_master_stamp; - /* Disable IRQs to get 'instantaneous' current timestamps. */ + /* + * Disable IRQs to get 'instantaneous' current timestamps. We read platform + * time first, as we may be delayed when acquiring platform_timer_lock. + */ local_irq_disable(); + curr_master_stime = read_platform_stime(); + curr_local_stime = get_s_time(); rdtscll(curr_tsc); - curr_local_stime = get_s_time(); - curr_master_stime = read_platform_stime(); local_irq_enable(); #if 0 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:27 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:27 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra5C-0004Pq-OJ for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:27 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5j-0004gg-Er; Thu, 01 May 2008 14:48:59 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDb-0000O9-0O for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDP-0000Pi-75 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:43 +0000 X-SBRS: 3.6 X-MesageID: 107405 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107405" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:38 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0cG2010697 for ; Thu, 1 May 2008 03:00:38 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0uYW016025 for ; Thu, 1 May 2008 03:00:56 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0tZn016024 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:55 -0700 Message-Id: <200805011000.m41A0tZn016024@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:55 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] xenstored: Fix xenstored abort when connection dropped. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209633459 -3600 # Node ID f37f7dcb78ee320359d92eefef17bb6369eb2de7 # Parent 01615264bb88a0cc8c674c5cb0d30fb2862d33c0 xenstored: Fix xenstored abort when connection dropped. If a connection is dropped with pending input and output data then the connection will be dereferenced by both handle_input and handle_output resulting in a double free when the main loop dereferences the connection. Fix this issue by taking/releasing a reference over the calls to handle_input and handle_output separately and checking the result of talloc_free to see if the connection went away. Signed-off-by: Ian Campbell xen-unstable changeset: 17532:5e5bc5b2bb6d4d71c0de97c15448f2f991f4271d xen-unstable date: Thu May 01 10:00:00 2008 +0100 --- tools/xenstore/xenstored_core.c | 30 +++++++++++++++++++++--------- 1 files changed, 21 insertions(+), 9 deletions(-) diff -r 01615264bb88 -r f37f7dcb78ee tools/xenstore/xenstored_core.c --- a/tools/xenstore/xenstored_core.c Thu May 01 10:17:10 2008 +0100 +++ b/tools/xenstore/xenstored_core.c Thu May 01 10:17:39 2008 +0100 @@ -1915,7 +1915,7 @@ int main(int argc, char *argv[]) /* Main loop. */ for (;;) { - struct connection *conn, *old_conn; + struct connection *conn, *next; if (select(max+1, &inset, &outset, NULL, timeout) < 0) { if (errno == EINTR) @@ -1939,27 +1939,39 @@ int main(int argc, char *argv[]) if (evtchn_fd != -1 && FD_ISSET(evtchn_fd, &inset)) handle_event(); - conn = list_entry(connections.next, typeof(*conn), list); - while (&conn->list != &connections) { - talloc_increase_ref_count(conn); + next = list_entry(connections.next, typeof(*conn), list); + while (&next->list != &connections) { + conn = next; + + next = list_entry(conn->list.next, + typeof(*conn), list); if (conn->domain) { + talloc_increase_ref_count(conn); if (domain_can_read(conn)) handle_input(conn); + if (talloc_free(conn) == 0) + continue; + + talloc_increase_ref_count(conn); if (domain_can_write(conn) && !list_empty(&conn->out_list)) handle_output(conn); + if (talloc_free(conn) == 0) + continue; } else { + talloc_increase_ref_count(conn); if (FD_ISSET(conn->fd, &inset)) handle_input(conn); + if (talloc_free(conn) == 0) + continue; + + talloc_increase_ref_count(conn); if (FD_ISSET(conn->fd, &outset)) handle_output(conn); + if (talloc_free(conn) == 0) + continue; } - - old_conn = conn; - conn = list_entry(old_conn->list.next, - typeof(*conn), list); - talloc_free(old_conn); } max = initialize_set(&inset, &outset, *sock, *ro_sock, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:31 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:31 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra5H-0004Pt-3J for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:31 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5n-0004kC-P2; Thu, 01 May 2008 14:49:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDa-0000O5-Vs for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDI-0000Pi-4f for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:38 +0000 X-SBRS: 3.6 X-MesageID: 107400 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107400" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:34 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0YeM010685 for ; Thu, 1 May 2008 03:00:34 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0qHL015937 for ; Thu, 1 May 2008 03:00:52 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0qIQ015936 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:52 -0700 Message-Id: <200805011000.m41A0qIQ015936@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:51 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] vtpm: Small makefile fix. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209633293 -3600 # Node ID 5656ac18bad0c1ea711c6f58184c579d935efa62 # Parent 4073b3ded545c89ac6c5b3a89978aacafb04c945 vtpm: Small makefile fix. Signed-off-by: Jason Andryuk xen-unstable changeset: 16935:daf1862c4ee50e5d57304e80bd62ba40b8565a3a xen-unstable date: Wed Jan 30 09:31:35 2008 +0000 --- tools/vtpm/Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 4073b3ded545 -r 5656ac18bad0 tools/vtpm/Makefile --- a/tools/vtpm/Makefile Fri Apr 25 14:03:45 2008 +0100 +++ b/tools/vtpm/Makefile Thu May 01 10:14:53 2008 +0100 @@ -83,7 +83,7 @@ updatepatches: clean orig .PHONY: build_sub build_sub: - set -e; @if [ -e $(GMP_HEADER) ]; then \ + set -e; if [ -e $(GMP_HEADER) ]; then \ $(MAKE) -C $(VTPM_DIR); \ if [ "$(BUILD_EMULATOR)" = "y" ]; then \ $(MAKE) -C $(TPM_EMULATOR_DIR); \ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:34 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:34 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra5K-0004Pw-HR for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:34 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5r-0004nP-7F; Thu, 01 May 2008 14:49:07 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDc-0000O6-1q for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDJ-0000OS-Tf for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:39 +0000 X-SBRS: 3.6 X-MesageID: 107401 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,421,1204520400"; d="scan'208";a="107401" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:00:35 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0ZIN010688 for ; Thu, 1 May 2008 03:00:35 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41A0rbV015955 for ; Thu, 1 May 2008 03:00:53 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41A0qFT015954 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:00:52 -0700 Message-Id: <200805011000.m41A0qFT015954@xenbits.xensource.com> Date: Thu, 01 May 2008 03:00:52 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86/hvm: fix copy-and-paste mistakes X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209633318 -3600 # Node ID fa7cfe1d847a036da8f59a654444bd5683c41f9d # Parent 5656ac18bad0c1ea711c6f58184c579d935efa62 x86/hvm: fix copy-and-paste mistakes Signed-off-by: Jan Beulich xen-unstable changeset: 17500:5355726f01b66565a55ef2201bebd283c1f9a384 xen-unstable date: Tue Apr 22 14:40:34 2008 +0100 --- xen/arch/x86/hvm/hvm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 5656ac18bad0 -r fa7cfe1d847a xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Thu May 01 10:14:53 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Thu May 01 10:15:18 2008 +0100 @@ -371,14 +371,14 @@ static int hvm_load_cpu_ctxt(struct doma ((ctxt.cr0 & (X86_CR0_PE|X86_CR0_PG)) == X86_CR0_PG) ) { gdprintk(XENLOG_ERR, "HVM restore: bad CR0 0x%"PRIx64"\n", - ctxt.msr_efer); + ctxt.cr0); return -EINVAL; } if ( ctxt.cr4 & HVM_CR4_GUEST_RESERVED_BITS ) { gdprintk(XENLOG_ERR, "HVM restore: bad CR4 0x%"PRIx64"\n", - ctxt.msr_efer); + ctxt.cr4); return -EINVAL; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 07:48:38 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 07:48:38 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jra5O-0004Pz-4b for www-data@colo.xensource.com; Thu, 01 May 2008 07:48:38 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra5u-0004rA-Tx; Thu, 01 May 2008 14:49:10 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrWDi-0000Oa-NW for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrWDQ-0000OS-9y for xen-changelog@lists.xensource.com; Thu, 01 May 2008 10:40:56 +0000 X-SBRS: 3.6 X-MesageID: 107501 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="107501" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 06:29:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41ATqFJ010813 for ; Thu, 1 May 2008 03:29:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41AU9iI017477 for ; Thu, 1 May 2008 03:30:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41AU9WC017476 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 03:30:09 -0700 Message-Id: <200805011030.m41AU9WC017476@xenbits.xensource.com> Date: Thu, 01 May 2008 03:30:08 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] i386/xen: Fix domU build. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209637703 -3600 # Node ID a947207da4e49d003dff47fe47a27bf119b17740 # Parent d62d60eaba6e7fea87847b2e8042146aea61a871 i386/xen: Fix domU build. Signed-off-by: Keir Fraser --- arch/i386/kernel/acpi/Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r d62d60eaba6e -r a947207da4e4 arch/i386/kernel/acpi/Makefile --- a/arch/i386/kernel/acpi/Makefile Thu May 01 10:53:37 2008 +0100 +++ b/arch/i386/kernel/acpi/Makefile Thu May 01 11:28:23 2008 +0100 @@ -1,10 +1,10 @@ obj-$(CONFIG_ACPI) += boot.o obj-$(CONFIG_ACPI) += boot.o obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o -obj-$(CONFIG_XEN) += processor_extcntl_xen.o ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += cstate.o processor.o +obj-$(CONFIG_XEN) += processor_extcntl_xen.o endif disabled-obj-$(CONFIG_XEN) := cstate.o wakeup.o _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 08:30:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 08:30:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jraji-0004xn-Nn for www-data@colo.xensource.com; Thu, 01 May 2008 08:30:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrakA-0003tq-F9; Thu, 01 May 2008 15:30:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrXmS-0001HB-7L for xen-changelog@lists.xensource.com; Thu, 01 May 2008 12:20:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrXm3-0001sm-Um for xen-changelog@lists.xensource.com; Thu, 01 May 2008 12:20:44 +0000 X-SBRS: 3.6 X-MesageID: 107928 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="107928" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 08:19:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41CJp6N011141 for ; Thu, 1 May 2008 05:19:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41CK8b5024501 for ; Thu, 1 May 2008 05:20:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41CK8bH024500 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 05:20:08 -0700 Message-Id: <200805011220.m41CK8bH024500@xenbits.xensource.com> Date: Thu, 01 May 2008 05:20:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Make apicid 32 bits in preparation for x2APIC support. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209637842 -3600 # Node ID f13ff27fa0d1ca8eed461ba47e49f784716b874b # Parent becd9b77f951fe66bb68616426ef13a2894d0191 x86: Make apicid 32 bits in preparation for x2APIC support. Signed-off-by: Dexuan Cui --- xen/arch/x86/mpparse.c | 2 +- xen/arch/x86/numa.c | 2 +- xen/arch/x86/setup.c | 2 +- xen/arch/x86/smpboot.c | 6 +++--- xen/include/asm-x86/mach-generic/mach_apic.h | 4 ++-- xen/include/asm-x86/processor.h | 6 +++--- xen/include/asm-x86/smp.h | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff -r becd9b77f951 -r f13ff27fa0d1 xen/arch/x86/mpparse.c --- a/xen/arch/x86/mpparse.c Thu May 01 10:50:09 2008 +0100 +++ b/xen/arch/x86/mpparse.c Thu May 01 11:30:42 2008 +0100 @@ -73,7 +73,7 @@ static unsigned int __devinitdata num_pr /* Bitmask of physically existing CPUs */ physid_mask_t phys_cpu_present_map; -u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; +u32 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; /* * Intel MP BIOS table parsing routines: diff -r becd9b77f951 -r f13ff27fa0d1 xen/arch/x86/numa.c --- a/xen/arch/x86/numa.c Thu May 01 10:50:09 2008 +0100 +++ b/xen/arch/x86/numa.c Thu May 01 11:30:42 2008 +0100 @@ -262,7 +262,7 @@ void __init init_cpu_to_node(void) { int i; for (i = 0; i < NR_CPUS; i++) { - u8 apicid = x86_cpu_to_apicid[i]; + u32 apicid = x86_cpu_to_apicid[i]; if (apicid == BAD_APICID) continue; if (apicid_to_node[apicid] == NUMA_NO_NODE) diff -r becd9b77f951 -r f13ff27fa0d1 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Thu May 01 10:50:09 2008 +0100 +++ b/xen/arch/x86/setup.c Thu May 01 11:30:42 2008 +0100 @@ -245,7 +245,7 @@ static void __init srat_detect_node(int static void __init srat_detect_node(int cpu) { unsigned node; - u8 apicid = x86_cpu_to_apicid[cpu]; + u32 apicid = x86_cpu_to_apicid[cpu]; node = apicid_to_node[apicid]; if ( node == NUMA_NO_NODE ) diff -r becd9b77f951 -r f13ff27fa0d1 xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Thu May 01 10:50:09 2008 +0100 +++ b/xen/arch/x86/smpboot.c Thu May 01 11:30:42 2008 +0100 @@ -103,8 +103,8 @@ struct cpuinfo_x86 cpu_data[NR_CPUS] __c struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; EXPORT_SYMBOL(cpu_data); -u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = - { [0 ... NR_CPUS-1] = 0xff }; +u32 x86_cpu_to_apicid[NR_CPUS] __read_mostly = + { [0 ... NR_CPUS-1] = -1U }; EXPORT_SYMBOL(x86_cpu_to_apicid); static void map_cpu_to_logical_apicid(void); @@ -543,7 +543,7 @@ extern struct { unsigned short ss; } stack_start; -u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; +u32 cpu_2_logical_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; static void map_cpu_to_logical_apicid(void) { diff -r becd9b77f951 -r f13ff27fa0d1 xen/include/asm-x86/mach-generic/mach_apic.h --- a/xen/include/asm-x86/mach-generic/mach_apic.h Thu May 01 10:50:09 2008 +0100 +++ b/xen/include/asm-x86/mach-generic/mach_apic.h Thu May 01 11:30:42 2008 +0100 @@ -21,9 +21,9 @@ static inline void enable_apic_mode(void /*es7000_sw_apic();*/ } -#define apicid_to_node(apicid) ((int)apicid_to_node[(u8)apicid]) +#define apicid_to_node(apicid) ((int)apicid_to_node[(u32)apicid]) -extern u8 bios_cpu_apicid[]; +extern u32 bios_cpu_apicid[]; static inline int cpu_present_to_apicid(int mps_cpu) { if (mps_cpu < NR_CPUS) diff -r becd9b77f951 -r f13ff27fa0d1 xen/include/asm-x86/processor.h --- a/xen/include/asm-x86/processor.h Thu May 01 10:50:09 2008 +0100 +++ b/xen/include/asm-x86/processor.h Thu May 01 11:30:42 2008 +0100 @@ -167,9 +167,9 @@ struct cpuinfo_x86 { int x86_cache_size; /* in KB - valid for CPUS which support this call */ int x86_cache_alignment; /* In bytes */ int x86_power; - unsigned char x86_max_cores; /* cpuid returned max cores value */ - unsigned char booted_cores; /* number of cores as seen by OS */ - unsigned char apicid; + __u32 x86_max_cores; /* cpuid returned max cores value */ + __u32 booted_cores; /* number of cores as seen by OS */ + __u32 apicid; unsigned short x86_clflush_size; } __cacheline_aligned; diff -r becd9b77f951 -r f13ff27fa0d1 xen/include/asm-x86/smp.h --- a/xen/include/asm-x86/smp.h Thu May 01 10:50:09 2008 +0100 +++ b/xen/include/asm-x86/smp.h Thu May 01 11:30:42 2008 +0100 @@ -22,7 +22,7 @@ #endif #endif -#define BAD_APICID 0xFFu +#define BAD_APICID -1U #ifdef CONFIG_SMP #ifndef __ASSEMBLY__ @@ -45,7 +45,7 @@ extern void zap_low_mappings(l2_pgentry_ #endif #define MAX_APICID 256 -extern u8 x86_cpu_to_apicid[]; +extern u32 x86_cpu_to_apicid[]; #define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 08:30:22 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 08:30:22 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrajl-0004xq-Ro for www-data@colo.xensource.com; Thu, 01 May 2008 08:30:22 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrakI-0003xN-Jp; Thu, 01 May 2008 15:30:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrXmT-0001HD-LD for xen-changelog@lists.xensource.com; Thu, 01 May 2008 12:20:57 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrXm4-0001sp-6C for xen-changelog@lists.xensource.com; Thu, 01 May 2008 12:20:45 +0000 X-SBRS: 3.6 X-MesageID: 107929 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="107929" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 08:19:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41CJqnW011144 for ; Thu, 1 May 2008 05:19:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41CK9Ns024518 for ; Thu, 1 May 2008 05:20:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41CK9EW024517 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 05:20:09 -0700 Message-Id: <200805011220.m41CK9EW024517@xenbits.xensource.com> Date: Thu, 01 May 2008 05:20:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Support x2APIC mode. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209638096 -3600 # Node ID 9fd00ff95068a613dac994a6a3d7025d7dd465d9 # Parent f13ff27fa0d1ca8eed461ba47e49f784716b874b x86: Support x2APIC mode. Signed-off-by: Dexuan Cui --- xen/arch/x86/apic.c | 50 ++++++++++-- xen/arch/x86/genapic/Makefile | 1 xen/arch/x86/genapic/delivery.c | 2 xen/arch/x86/genapic/probe.c | 2 xen/arch/x86/genapic/x2apic.c | 79 ++++++++++++++++++++ xen/arch/x86/hvm/vlapic.c | 4 - xen/arch/x86/io_apic.c | 2 xen/arch/x86/mpparse.c | 11 +- xen/arch/x86/nmi.c | 5 - xen/arch/x86/setup.c | 3 xen/arch/x86/shutdown.c | 2 xen/arch/x86/smp.c | 5 + xen/arch/x86/smpboot.c | 91 +++++++++++++---------- xen/include/asm-x86/apic.h | 105 ++++++++++++++++++++++++++- xen/include/asm-x86/apicdef.h | 19 +++- xen/include/asm-x86/cpufeature.h | 2 xen/include/asm-x86/genapic.h | 14 +++ xen/include/asm-x86/hvm/vlapic.h | 2 xen/include/asm-x86/mach-generic/mach_apic.h | 2 xen/include/asm-x86/msr-index.h | 1 xen/include/asm-x86/smp.h | 4 - 21 files changed, 334 insertions(+), 72 deletions(-) diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/apic.c --- a/xen/arch/x86/apic.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/apic.c Thu May 01 11:34:56 2008 +0100 @@ -47,6 +47,8 @@ int enable_local_apic __initdata = 0; /* */ int apic_verbosity; +int x2apic_enabled __read_mostly = 0; + static void apic_pm_activate(void); @@ -306,7 +308,10 @@ int __init verify_local_APIC(void) */ reg0 = apic_read(APIC_LVR); apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg0); - apic_write(APIC_LVR, reg0 ^ APIC_LVR_MASK); + + /* We don't try writing LVR in x2APIC mode since that incurs #GP. */ + if ( !x2apic_enabled ) + apic_write(APIC_LVR, reg0 ^ APIC_LVR_MASK); reg1 = apic_read(APIC_LVR); apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg1); @@ -610,7 +615,8 @@ int lapic_suspend(void) apic_pm_state.apic_id = apic_read(APIC_ID); apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI); apic_pm_state.apic_ldr = apic_read(APIC_LDR); - apic_pm_state.apic_dfr = apic_read(APIC_DFR); + if ( !x2apic_enabled ) + apic_pm_state.apic_dfr = apic_read(APIC_DFR); apic_pm_state.apic_spiv = apic_read(APIC_SPIV); apic_pm_state.apic_lvtt = apic_read(APIC_LVTT); apic_pm_state.apic_lvtpc = apic_read(APIC_LVTPC); @@ -643,14 +649,20 @@ int lapic_resume(void) * FIXME! This will be wrong if we ever support suspend on * SMP! We'll need to do this as part of the CPU restore! */ - rdmsr(MSR_IA32_APICBASE, l, h); - l &= ~MSR_IA32_APICBASE_BASE; - l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; - wrmsr(MSR_IA32_APICBASE, l, h); + if ( !x2apic_enabled ) + { + rdmsr(MSR_IA32_APICBASE, l, h); + l &= ~MSR_IA32_APICBASE_BASE; + l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; + wrmsr(MSR_IA32_APICBASE, l, h); + } + else + enable_x2apic(); apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); apic_write(APIC_ID, apic_pm_state.apic_id); - apic_write(APIC_DFR, apic_pm_state.apic_dfr); + if ( !x2apic_enabled ) + apic_write(APIC_DFR, apic_pm_state.apic_dfr); apic_write(APIC_LDR, apic_pm_state.apic_ldr); apic_write(APIC_TASKPRI, apic_pm_state.apic_taskpri); apic_write(APIC_SPIV, apic_pm_state.apic_spiv); @@ -809,10 +821,29 @@ no_apic: return -1; } +void enable_x2apic(void) +{ + u32 lo, hi; + + rdmsr(MSR_IA32_APICBASE, lo, hi); + if ( !(lo & MSR_IA32_APICBASE_EXTD) ) + { + lo |= MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD; + wrmsr(MSR_IA32_APICBASE, lo, 0); + printk("x2APIC mode enabled.\n"); + } + else + printk("x2APIC mode enabled by BIOS.\n"); + + x2apic_enabled = 1; +} + void __init init_apic_mappings(void) { unsigned long apic_phys; + if ( x2apic_enabled ) + goto __next; /* * If no local APIC can be found then set up a fake all * zeroes page to simulate the local APIC and another @@ -828,12 +859,13 @@ void __init init_apic_mappings(void) apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n", APIC_BASE, apic_phys); +__next: /* * Fetch the APIC ID of the BSP in case we have a * default configuration (or the MP table is broken). */ if (boot_cpu_physical_apicid == -1U) - boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); + boot_cpu_physical_apicid = get_apic_id(); #ifdef CONFIG_X86_IO_APIC { @@ -1271,7 +1303,7 @@ int __init APIC_init_uniprocessor (void) * might be zero if read from MP tables. Get it from LAPIC. */ #ifdef CONFIG_CRASH_DUMP - boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); + boot_cpu_physical_apicid = get_apic_id(); #endif phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid); diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/genapic/Makefile --- a/xen/arch/x86/genapic/Makefile Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/genapic/Makefile Thu May 01 11:34:56 2008 +0100 @@ -1,4 +1,5 @@ obj-y += bigsmp.o obj-y += bigsmp.o +obj-y += x2apic.o obj-y += default.o obj-y += delivery.o obj-y += probe.o diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/genapic/delivery.c --- a/xen/arch/x86/genapic/delivery.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/genapic/delivery.c Thu May 01 11:34:56 2008 +0100 @@ -17,7 +17,7 @@ void init_apic_ldr_flat(void) apic_write_around(APIC_DFR, APIC_DFR_FLAT); val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; - val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id()); + val |= SET_xAPIC_LOGICAL_ID(1UL << smp_processor_id()); apic_write_around(APIC_LDR, val); } diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/genapic/probe.c --- a/xen/arch/x86/genapic/probe.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/genapic/probe.c Thu May 01 11:34:56 2008 +0100 @@ -14,6 +14,7 @@ #include #include +extern struct genapic apic_x2apic; extern struct genapic apic_summit; extern struct genapic apic_bigsmp; extern struct genapic apic_default; @@ -21,6 +22,7 @@ struct genapic *genapic; struct genapic *genapic; struct genapic *apic_probe[] __initdata = { + &apic_x2apic, &apic_summit, &apic_bigsmp, &apic_default, /* must be last */ diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/genapic/x2apic.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/genapic/x2apic.c Thu May 01 11:34:56 2008 +0100 @@ -0,0 +1,79 @@ +/* + * x2APIC driver. + * + * 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include + +__init int probe_x2apic(void) +{ + return x2apic_is_available(); +} + +struct genapic apic_x2apic= { + APIC_INIT("x2apic", probe_x2apic), + GENAPIC_X2APIC +}; + +void init_apic_ldr_x2apic(void) +{ + /* We only use physical delivery mode. */ + return; +} + +void clustered_apic_check_x2apic(void) +{ + /* We only use physical delivery mode. */ + return; +} + +cpumask_t target_cpus_x2apic(void) +{ + /* Deliver interrupts only to CPU0 for now */ + return cpumask_of_cpu(0); +} + +unsigned int cpu_mask_to_apicid_x2apic(cpumask_t cpumask) +{ + return cpu_physical_id(first_cpu(cpumask)); +} + +void send_IPI_mask_x2apic(cpumask_t cpumask, int vector) +{ + unsigned int query_cpu; + u32 cfg, dest; + unsigned long flags; + + ASSERT(cpus_subset(cpumask, cpu_online_map)); + ASSERT(!cpus_empty(cpumask)); + + local_irq_save(flags); + + cfg = APIC_DM_FIXED | 0 /* no shorthand */ | APIC_DEST_PHYSICAL | vector; + for_each_cpu_mask(query_cpu, cpumask) + { + dest = cpu_physical_id(query_cpu); + apic_icr_write(cfg, dest); + } + + local_irq_restore(flags); +} + diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/hvm/vlapic.c Thu May 01 11:34:56 2008 +0100 @@ -171,7 +171,7 @@ int vlapic_match_logical_addr(struct vla int result = 0; uint8_t logical_id; - logical_id = GET_APIC_LOGICAL_ID(vlapic_get_reg(vlapic, APIC_LDR)); + logical_id = GET_xAPIC_LOGICAL_ID(vlapic_get_reg(vlapic, APIC_LDR)); switch ( vlapic_get_reg(vlapic, APIC_DFR) ) { @@ -484,7 +484,7 @@ static int vlapic_ipi( static int vlapic_ipi( struct vlapic *vlapic, uint32_t icr_low, uint32_t icr_high) { - unsigned int dest = GET_APIC_DEST_FIELD(icr_high); + unsigned int dest = GET_xAPIC_DEST_FIELD(icr_high); unsigned int short_hand = icr_low & APIC_SHORT_MASK; unsigned int trig_mode = icr_low & APIC_INT_LEVELTRIG; unsigned int level = icr_low & APIC_INT_ASSERT; diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/io_apic.c --- a/xen/arch/x86/io_apic.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/io_apic.c Thu May 01 11:34:56 2008 +0100 @@ -1125,7 +1125,7 @@ void disable_IO_APIC(void) entry.delivery_mode = dest_ExtINT; /* ExtInt */ entry.vector = 0; entry.dest.physical.physical_dest = - GET_APIC_ID(apic_read(APIC_ID)); + get_apic_id(); /* * Add it to the IO-APIC irq-routing table: diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/mpparse.c --- a/xen/arch/x86/mpparse.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/mpparse.c Thu May 01 11:34:56 2008 +0100 @@ -814,12 +814,15 @@ void __init mp_register_lapic_address ( void __init mp_register_lapic_address ( u64 address) { - mp_lapic_addr = (unsigned long) address; - - set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); + if ( !x2apic_enabled ) + { + mp_lapic_addr = (unsigned long) address; + + set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); + } if (boot_cpu_physical_apicid == -1U) - boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); + boot_cpu_physical_apicid = get_apic_id(); Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid); } diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/nmi.c --- a/xen/arch/x86/nmi.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/nmi.c Thu May 01 11:34:56 2008 +0100 @@ -434,14 +434,13 @@ void nmi_watchdog_tick(struct cpu_user_r */ static void do_nmi_trigger(unsigned char key) { - u32 id = GET_APIC_ID(apic_read(APIC_ID)); + u32 id = get_apic_id(); printk("Triggering NMI on APIC ID %x\n", id); local_irq_disable(); apic_wait_icr_idle(); - apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(id)); - apic_write_around(APIC_ICR, APIC_DM_NMI | APIC_DEST_PHYSICAL); + apic_icr_write(APIC_DM_NMI | APIC_DEST_PHYSICAL, id); local_irq_enable(); } diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/setup.c Thu May 01 11:34:56 2008 +0100 @@ -890,6 +890,9 @@ void __init __start_xen(unsigned long mb generic_apic_probe(); + if ( x2apic_is_available() ) + enable_x2apic(); + acpi_boot_init(); init_cpu_to_node(); diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/shutdown.c --- a/xen/arch/x86/shutdown.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/shutdown.c Thu May 01 11:34:56 2008 +0100 @@ -209,7 +209,7 @@ void machine_restart(void) local_irq_enable(); /* Ensure we are the boot CPU. */ - if ( GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid ) + if ( get_apic_id() != boot_cpu_physical_apicid ) { /* Send IPI to the boot CPU (logical cpu 0). */ on_selected_cpus(cpumask_of_cpu(0), (void *)machine_restart, diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/smp.c --- a/xen/arch/x86/smp.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/smp.c Thu May 01 11:34:56 2008 +0100 @@ -72,11 +72,14 @@ static inline int __prepare_ICR (unsigne static inline int __prepare_ICR2 (unsigned int mask) { - return SET_APIC_DEST_FIELD(mask); + return SET_xAPIC_DEST_FIELD(mask); } void apic_wait_icr_idle(void) { + if ( x2apic_enabled ) + return; + while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ) cpu_relax(); } diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Thu May 01 11:30:42 2008 +0100 +++ b/xen/arch/x86/smpboot.c Thu May 01 11:34:56 2008 +0100 @@ -325,10 +325,13 @@ void __devinit smp_callin(void) */ wait_for_init_deassert(&init_deasserted); + if ( x2apic_is_available() ) + enable_x2apic(); + /* * (This works even if the APIC is not enabled.) */ - phys_id = GET_APIC_ID(apic_read(APIC_ID)); + phys_id = get_apic_id(); cpuid = smp_processor_id(); if (cpu_isset(cpuid, cpu_callin_map)) { printk("huh, phys CPU#%d, CPU#%d already present??\n", @@ -548,7 +551,7 @@ static void map_cpu_to_logical_apicid(vo static void map_cpu_to_logical_apicid(void) { int cpu = smp_processor_id(); - int apicid = hard_smp_processor_id(); + int apicid = logical_smp_processor_id(); cpu_2_logical_apicid[cpu] = apicid; } @@ -575,8 +578,7 @@ static inline void __inquire_remote_apic */ apic_wait_icr_idle(); - apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(apicid)); - apic_write_around(APIC_ICR, APIC_DM_REMRD | regs[i]); + apic_icr_write(APIC_DM_REMRD | regs[i], apicid); timeout = 0; do { @@ -597,6 +599,21 @@ static inline void __inquire_remote_apic #endif #ifdef WAKE_SECONDARY_VIA_NMI + +static int logical_apicid_to_cpu(int logical_apicid) +{ + int i; + + for ( i = 0; i < sizeof(cpu_2_logical_apicid); i++ ) + if ( cpu_2_logical_apicid[i] == logical_apicid ) + break; + + if ( i == sizeof(cpu_2_logical_apicid) ); + i = -1; /* not found */ + + return i; +} + /* * Poke the other CPU in the eye via NMI to wake it up. Remember that the normal * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this @@ -607,20 +624,26 @@ wakeup_secondary_cpu(int logical_apicid, { unsigned long send_status = 0, accept_status = 0; int timeout, maxlvt; - - /* Target chip */ - apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(logical_apicid)); + int dest_cpu; + u32 dest; + + dest_cpu = logical_apicid_to_cpu(logical_apicid); + BUG_ON(dest_cpu == -1); + + dest = cpu_physical_id(dest_cpu); /* Boot on the stack */ - /* Kick the second */ - apic_write_around(APIC_ICR, APIC_DM_NMI | APIC_DEST_LOGICAL); + apic_icr_write(APIC_DM_NMI | APIC_DEST_PHYSICAL, dest_cpu); Dprintk("Waiting for send to finish...\n"); timeout = 0; do { Dprintk("+"); udelay(100); - send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; + if ( !x2apic_enabled ) + send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; + else + send_status = 0; /* We go out of the loop directly. */ } while (send_status && (timeout++ < 1000)); /* @@ -666,40 +689,37 @@ wakeup_secondary_cpu(int phys_apicid, un Dprintk("Asserting INIT.\n"); /* - * Turn INIT on target chip - */ - apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); - - /* - * Send IPI - */ - apic_write_around(APIC_ICR, APIC_INT_LEVELTRIG | APIC_INT_ASSERT - | APIC_DM_INIT); + * Turn INIT on target chip via IPI + */ + apic_icr_write(APIC_INT_LEVELTRIG | APIC_INT_ASSERT | APIC_DM_INIT, + phys_apicid); Dprintk("Waiting for send to finish...\n"); timeout = 0; do { Dprintk("+"); udelay(100); - send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; + if ( !x2apic_enabled ) + send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; + else + send_status = 0; /* We go out of the loop dirctly. */ } while (send_status && (timeout++ < 1000)); mdelay(10); Dprintk("Deasserting INIT.\n"); - /* Target chip */ - apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); - - /* Send IPI */ - apic_write_around(APIC_ICR, APIC_INT_LEVELTRIG | APIC_DM_INIT); + apic_icr_write(APIC_INT_LEVELTRIG | APIC_DM_INIT, phys_apicid); Dprintk("Waiting for send to finish...\n"); timeout = 0; do { Dprintk("+"); udelay(100); - send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; + if ( !x2apic_enabled ) + send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; + else + send_status = 0; /* We go out of the loop dirctly. */ } while (send_status && (timeout++ < 1000)); atomic_set(&init_deasserted, 1); @@ -731,15 +751,9 @@ wakeup_secondary_cpu(int phys_apicid, un /* * STARTUP IPI - */ - - /* Target chip */ - apic_write_around(APIC_ICR2, SET_APIC_DEST_FIELD(phys_apicid)); - - /* Boot on the stack */ - /* Kick the second */ - apic_write_around(APIC_ICR, APIC_DM_STARTUP - | (start_eip >> 12)); + * Boot on the stack + */ + apic_icr_write(APIC_DM_STARTUP | (start_eip >> 12), phys_apicid); /* * Give the other CPU some time to accept the IPI. @@ -753,7 +767,10 @@ wakeup_secondary_cpu(int phys_apicid, un do { Dprintk("+"); udelay(100); - send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; + if ( !x2apic_enabled ) + send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; + else + send_status = 0; /* We go out of the loop dirctly. */ } while (send_status && (timeout++ < 1000)); /* @@ -988,7 +1005,7 @@ static void __init smp_boot_cpus(unsigne printk("CPU%d: ", 0); print_cpu_info(&cpu_data[0]); - boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); + boot_cpu_physical_apicid = get_apic_id(); x86_cpu_to_apicid[0] = boot_cpu_physical_apicid; stack_base[0] = stack_start.esp; diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/include/asm-x86/apic.h --- a/xen/include/asm-x86/apic.h Thu May 01 11:30:42 2008 +0100 +++ b/xen/include/asm-x86/apic.h Thu May 01 11:34:56 2008 +0100 @@ -16,6 +16,21 @@ #define APIC_DEBUG 2 extern int apic_verbosity; +extern int x2apic_enabled; + +extern void enable_x2apic(void); + +static __inline int x2apic_is_available(void) +{ + unsigned int op = 1, eax, ecx; + + asm ( "cpuid" + : "=a" (eax), "=c" (ecx) + : "0" (op) + : "bx", "dx" ); + + return (ecx & (1U << 21)); +} /* * Define the default level of output to be very little @@ -35,19 +50,103 @@ extern int apic_verbosity; * Basic functions accessing APICs. */ +static __inline void apic_mem_write(unsigned long reg, u32 v) +{ + *((volatile u32 *)(APIC_BASE+reg)) = v; +} + +static __inline void apic_mem_write_atomic(unsigned long reg, u32 v) +{ + (void)xchg((volatile u32 *)(APIC_BASE+reg), v); +} + +static __inline u32 apic_mem_read(unsigned long reg) +{ + return *((volatile u32 *)(APIC_BASE+reg)); +} + +/* NOTE: in x2APIC mode, we should use apic_icr_write()/apic_icr_read() to + * access the 64-bit ICR register. + */ + +static __inline void apic_wrmsr(unsigned long reg, u32 low, u32 high) +{ + __asm__ __volatile__("wrmsr" + : /* no outputs */ + : "c" (APIC_MSR_BASE + (reg >> 4)), "a" (low), "d" (high)); +} + +static __inline void apic_rdmsr(unsigned long reg, u32 *low, u32 *high) +{ + __asm__ __volatile__("rdmsr" + : "=a" (*low), "=d" (*high) + : "c" (APIC_MSR_BASE + (reg >> 4))); +} + static __inline void apic_write(unsigned long reg, u32 v) { - *((volatile u32 *)(APIC_BASE+reg)) = v; + + if ( x2apic_enabled ) + apic_wrmsr(reg, v, 0); + else + apic_mem_write(reg, v); } static __inline void apic_write_atomic(unsigned long reg, u32 v) { - (void)xchg((volatile u32 *)(APIC_BASE+reg), v); + if ( x2apic_enabled ) + apic_wrmsr(reg, v, 0); + else + apic_mem_write_atomic(reg, v); } static __inline u32 apic_read(unsigned long reg) { - return *((volatile u32 *)(APIC_BASE+reg)); + u32 lo, hi; + + if ( x2apic_enabled ) + apic_rdmsr(reg, &lo, &hi); + else + lo = apic_mem_read(reg); + return lo; +} + +static __inline u64 apic_icr_read(void) +{ + u32 lo, hi; + + if ( x2apic_enabled ) + apic_rdmsr(APIC_ICR, &lo, &hi); + else + { + lo = apic_mem_read(APIC_ICR); + hi = apic_mem_read(APIC_ICR2); + } + + return ((u64)lo) | (((u64)hi) << 32); +} + +static __inline void apic_icr_write(u32 low, u32 dest) +{ + if ( x2apic_enabled ) + apic_wrmsr(APIC_ICR, low, dest); + else + { + apic_mem_write(APIC_ICR2, dest << 24); + apic_mem_write(APIC_ICR, low); + } +} + +static __inline u32 get_apic_id(void) /* Get the physical APIC id */ +{ + u32 id = apic_read(APIC_ID); + return x2apic_enabled ? id : GET_xAPIC_ID(id); +} + +static __inline u32 get_logical_apic_id(void) +{ + u32 logical_id = apic_read(APIC_LDR); + return x2apic_enabled ? logical_id : GET_xAPIC_LOGICAL_ID(logical_id); } void apic_wait_icr_idle(void); diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/include/asm-x86/apicdef.h --- a/xen/include/asm-x86/apicdef.h Thu May 01 11:30:42 2008 +0100 +++ b/xen/include/asm-x86/apicdef.h Thu May 01 11:34:56 2008 +0100 @@ -12,8 +12,8 @@ #define APIC_ID 0x20 #define APIC_ID_MASK (0xFFu<<24) -#define GET_APIC_ID(x) (((x)>>24)&0xFFu) -#define SET_APIC_ID(x) (((x)<<24)) +#define GET_xAPIC_ID(x) (((x)>>24)&0xFFu) +#define SET_xAPIC_ID(x) (((x)<<24)) #define APIC_LVR 0x30 #define APIC_LVR_MASK 0xFF00FF #define GET_APIC_VERSION(x) ((x)&0xFF) @@ -30,8 +30,8 @@ #define APIC_RRR 0xC0 #define APIC_LDR 0xD0 #define APIC_LDR_MASK (0xFF<<24) -#define GET_APIC_LOGICAL_ID(x) (((x)>>24)&0xFF) -#define SET_APIC_LOGICAL_ID(x) (((x)<<24)) +#define GET_xAPIC_LOGICAL_ID(x) (((x)>>24)&0xFF) +#define SET_xAPIC_LOGICAL_ID(x) (((x)<<24)) #define APIC_ALL_CPUS 0xFF #define APIC_DFR 0xE0 #define APIC_DFR_CLUSTER 0x0FFFFFFFul @@ -74,8 +74,8 @@ #define APIC_DM_EXTINT 0x00700 #define APIC_VECTOR_MASK 0x000FF #define APIC_ICR2 0x310 -#define GET_APIC_DEST_FIELD(x) (((x)>>24)&0xFF) -#define SET_APIC_DEST_FIELD(x) ((x)<<24) +#define GET_xAPIC_DEST_FIELD(x) (((x)>>24)&0xFF) +#define SET_xAPIC_DEST_FIELD(x) ((x)<<24) #define APIC_LVTT 0x320 #define APIC_LVTTHMR 0x330 #define APIC_LVTPC 0x340 @@ -103,6 +103,10 @@ #define APIC_TMICT 0x380 #define APIC_TMCCT 0x390 #define APIC_TDCR 0x3E0 + +/* Only available in x2APIC mode */ +#define APIC_SELF_IPI 0x400 + #define APIC_TDR_DIV_TMBASE (1<<2) #define APIC_TDR_DIV_1 0xB #define APIC_TDR_DIV_2 0x0 @@ -114,6 +118,9 @@ #define APIC_TDR_DIV_128 0xA #define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) + +/* It's only used in x2APIC mode of an x2APIC unit. */ +#define APIC_MSR_BASE 0x800 #ifdef __i386__ #define MAX_IO_APICS 64 diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/include/asm-x86/cpufeature.h --- a/xen/include/asm-x86/cpufeature.h Thu May 01 11:30:42 2008 +0100 +++ b/xen/include/asm-x86/cpufeature.h Thu May 01 11:34:56 2008 +0100 @@ -92,6 +92,7 @@ #define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */ #define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */ #define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */ +#define X86_FEATURE_X2APIC (4*32+21) /* Extended xAPIC */ #define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */ /* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ @@ -182,6 +183,7 @@ #define cpu_has_ffxsr ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) \ && boot_cpu_has(X86_FEATURE_FFXSR)) +#define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC) #endif /* __ASM_I386_CPUFEATURE_H */ /* diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/include/asm-x86/genapic.h --- a/xen/include/asm-x86/genapic.h Thu May 01 11:30:42 2008 +0100 +++ b/xen/include/asm-x86/genapic.h Thu May 01 11:34:56 2008 +0100 @@ -62,6 +62,20 @@ void send_IPI_mask_flat(cpumask_t mask, .cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \ .send_IPI_mask = send_IPI_mask_flat +void init_apic_ldr_x2apic(void); +void clustered_apic_check_x2apic(void); +cpumask_t target_cpus_x2apic(void); +unsigned int cpu_mask_to_apicid_x2apic(cpumask_t cpumask); +void send_IPI_mask_x2apic(cpumask_t mask, int vector); +#define GENAPIC_X2APIC \ + .int_delivery_mode = dest_Fixed, \ + .int_dest_mode = 0 /* physical delivery */, \ + .init_apic_ldr = init_apic_ldr_x2apic, \ + .clustered_apic_check = clustered_apic_check_x2apic, \ + .target_cpus = target_cpus_x2apic, \ + .cpu_mask_to_apicid = cpu_mask_to_apicid_x2apic, \ + .send_IPI_mask = send_IPI_mask_x2apic + void init_apic_ldr_phys(void); void clustered_apic_check_phys(void); cpumask_t target_cpus_phys(void); diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/include/asm-x86/hvm/vlapic.h --- a/xen/include/asm-x86/hvm/vlapic.h Thu May 01 11:30:42 2008 +0100 +++ b/xen/include/asm-x86/hvm/vlapic.h Thu May 01 11:34:56 2008 +0100 @@ -34,7 +34,7 @@ #define vlapic_domain(vpic) (vlapic_vcpu(vlapic)->domain) #define VLAPIC_ID(vlapic) \ - (GET_APIC_ID(vlapic_get_reg((vlapic), APIC_ID))) + (GET_xAPIC_ID(vlapic_get_reg((vlapic), APIC_ID))) /* * APIC can be disabled in two ways: diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/include/asm-x86/mach-generic/mach_apic.h --- a/xen/include/asm-x86/mach-generic/mach_apic.h Thu May 01 11:30:42 2008 +0100 +++ b/xen/include/asm-x86/mach-generic/mach_apic.h Thu May 01 11:34:56 2008 +0100 @@ -62,7 +62,7 @@ extern void generic_bigsmp_probe(void); */ static inline int apic_id_registered(void) { - return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), + return physid_isset(get_apic_id(), phys_cpu_present_map); } diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/include/asm-x86/msr-index.h --- a/xen/include/asm-x86/msr-index.h Thu May 01 11:30:42 2008 +0100 +++ b/xen/include/asm-x86/msr-index.h Thu May 01 11:34:56 2008 +0100 @@ -236,6 +236,7 @@ #define MSR_IA32_APICBASE 0x0000001b #define MSR_IA32_APICBASE_BSP (1<<8) +#define MSR_IA32_APICBASE_EXTD (1<<10) #define MSR_IA32_APICBASE_ENABLE (1<<11) #define MSR_IA32_APICBASE_BASE (0xfffff<<12) diff -r f13ff27fa0d1 -r 9fd00ff95068 xen/include/asm-x86/smp.h --- a/xen/include/asm-x86/smp.h Thu May 01 11:30:42 2008 +0100 +++ b/xen/include/asm-x86/smp.h Thu May 01 11:34:56 2008 +0100 @@ -90,13 +90,13 @@ static inline int hard_smp_processor_id( static inline int hard_smp_processor_id(void) { /* we don't want to mark this access volatile - bad code generation */ - return GET_APIC_ID(*(unsigned int *)(APIC_BASE+APIC_ID)); + return get_apic_id(); } static __inline int logical_smp_processor_id(void) { /* we don't want to mark this access volatile - bad code generation */ - return GET_APIC_LOGICAL_ID(*(unsigned int *)(APIC_BASE+APIC_LDR)); + return get_logical_apic_id(); } #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 08:30:26 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 08:30:26 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrajp-0004xt-Oa for www-data@colo.xensource.com; Thu, 01 May 2008 08:30:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrakM-00040T-F8; Thu, 01 May 2008 15:30:58 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrXmZ-0001HS-TH for xen-changelog@lists.xensource.com; Thu, 01 May 2008 12:21:03 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrXmG-0001sm-LD for xen-changelog@lists.xensource.com; Thu, 01 May 2008 12:21:01 +0000 X-SBRS: 3.6 X-MesageID: 107930 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="107930" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 08:19:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41CJr1u011147 for ; Thu, 1 May 2008 05:19:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41CKAJW024535 for ; Thu, 1 May 2008 05:20:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41CKAKq024534 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 05:20:10 -0700 Message-Id: <200805011220.m41CKAKq024534@xenbits.xensource.com> Date: Thu, 01 May 2008 05:20:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Fix FADT parsing for PM event blocks. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209644192 -3600 # Node ID 806e7fa302640eed99f439087519c3645eb56b78 # Parent 9fd00ff95068a613dac994a6a3d7025d7dd465d9 x86: Fix FADT parsing for PM event blocks. Signed-off-by: Keir Fraser --- xen/arch/x86/acpi/boot.c | 25 ++++++++++++++----------- 1 files changed, 14 insertions(+), 11 deletions(-) diff -r 9fd00ff95068 -r 806e7fa30264 xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Thu May 01 11:34:56 2008 +0100 +++ b/xen/arch/x86/acpi/boot.c Thu May 01 13:16:32 2008 +0100 @@ -465,15 +465,18 @@ static void __init static void __init acpi_fadt_parse_reg(struct acpi_table_fadt *fadt) { - memcpy(&acpi_gbl_FADT, fadt, sizeof(acpi_gbl_FADT)); - - memcpy(&acpi_gbl_xpm1a_enable, &(fadt->xpm1a_event_block), - sizeof(acpi_gbl_xpm1a_enable)); - memcpy(&acpi_gbl_xpm1b_enable, &(fadt->xpm1b_event_block), - sizeof(acpi_gbl_xpm1b_enable)); - - acpi_gbl_xpm1a_enable.address += 2; - acpi_gbl_xpm1b_enable.address += 2; + unsigned int len = min(fadt->header.length, sizeof(*fadt)); + + memcpy(&acpi_gbl_FADT, fadt, len); + + if (len > offsetof(struct acpi_table_fadt, xpm1b_event_block)) { + memcpy(&acpi_gbl_xpm1a_enable, &fadt->xpm1a_event_block, + sizeof(acpi_gbl_xpm1a_enable)); + memcpy(&acpi_gbl_xpm1b_enable, &fadt->xpm1b_event_block, + sizeof(acpi_gbl_xpm1b_enable)); + acpi_gbl_xpm1a_enable.address += 2; + acpi_gbl_xpm1b_enable.address += 2; + } } static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) @@ -523,11 +526,11 @@ static int __init acpi_parse_fadt(unsign acpi_enable_value = fadt->acpi_enable; acpi_disable_value = fadt->acpi_disable; + acpi_fadt_parse_reg(fadt); + #ifdef CONFIG_ACPI_SLEEP acpi_fadt_parse_sleep_info(fadt); #endif - - acpi_fadt_parse_reg(fadt); return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 08:47:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 08:47:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrb00-00058U-Mx for www-data@colo.xensource.com; Thu, 01 May 2008 08:47:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb0X-0004dI-Fe; Thu, 01 May 2008 15:47:41 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra7I-0005V7-6I for xen-changelog@lists.xensource.com; Thu, 01 May 2008 14:50:36 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jra7C-0003ds-L3 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 14:50:34 +0000 X-SBRS: 3.6 X-MesageID: 108695 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="108695" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 10:49:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41EnpvA011405 for ; Thu, 1 May 2008 07:49:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41Eo8FJ031564 for ; Thu, 1 May 2008 07:50:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41Eo8r8031563 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 07:50:08 -0700 Message-Id: <200805011450.m41Eo8r8031563@xenbits.xensource.com> Date: Thu, 01 May 2008 07:50:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] docs: Do not reference stale external websites. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209646028 -3600 # Node ID b2a036d390dbce2a0359740da0c52906d749eead # Parent 806e7fa302640eed99f439087519c3645eb56b78 docs: Do not reference stale external websites. Signed-off-by: Keir Fraser --- docs/src/user.tex | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) diff -r 806e7fa30264 -r b2a036d390db docs/src/user.tex --- a/docs/src/user.tex Thu May 01 13:16:32 2008 +0100 +++ b/docs/src/user.tex Thu May 01 13:47:08 2008 +0100 @@ -2459,9 +2459,7 @@ file. Please refer to Section~\ref{subse file. Please refer to Section~\ref{subsection:acmlabelmanageddomains} if you are using managed domains. -The following configuration file defines \verb|domain1| -(Note: www.jailtime.org or www.xen-get.org might be good -places to look for example domU images): +The following configuration file defines \verb|domain1|: \begin{scriptsize} \begin{verbatim} _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 08:47:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 08:47:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrb04-00058X-ES for www-data@colo.xensource.com; Thu, 01 May 2008 08:47:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb0b-0004gF-4n; Thu, 01 May 2008 15:47:45 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra7K-0005Xf-OK for xen-changelog@lists.xensource.com; Thu, 01 May 2008 14:50:38 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jra7E-0003dt-1I for xen-changelog@lists.xensource.com; Thu, 01 May 2008 14:50:36 +0000 X-SBRS: 3.6 X-MesageID: 108696 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="108696" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 10:49:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41Enp4i011408 for ; Thu, 1 May 2008 07:49:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41Eo9kJ031581 for ; Thu, 1 May 2008 07:50:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41Eo9Cl031580 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 07:50:09 -0700 Message-Id: <200805011450.m41Eo9Cl031580@xenbits.xensource.com> Date: Thu, 01 May 2008 07:50:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Update README to reference next major Xen release (3.3). X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209647052 -3600 # Node ID 4b1bbcf18eb5a6c7d3e1b96306e8f6cec5209f09 # Parent b2a036d390dbce2a0359740da0c52906d749eead Update README to reference next major Xen release (3.3). Signed-off-by: Keir Fraser --- README | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-) diff -r b2a036d390db -r 4b1bbcf18eb5 README --- a/README Thu May 01 13:47:08 2008 +0100 +++ b/README Thu May 01 14:04:12 2008 +0100 @@ -1,10 +1,10 @@ ################################# - __ __ _____ ____ - \ \/ /___ _ __ |___ / |___ \ - \ // _ \ '_ \ |_ \ __) | - / \ __/ | | | ___) | / __/ - /_/\_\___|_| |_| |____(_)_____| - + __ __ _____ _____ + \ \/ /___ _ __ |___ / |___ / + \ // _ \ '_ \ |_ \ |_ \ + / \ __/ | | | ___) | ___) | + /_/\_\___|_| |_| |____(_)____/ + ################################# http://www.xen.org/ @@ -21,11 +21,10 @@ by the original Xen development team to by the original Xen development team to build enterprise products around Xen. -The 3.2 release offers excellent performance, hardware support and +The 3.3 release offers excellent performance, hardware support and enterprise-grade features such as x86_32-PAE, x86_64, SMP guests and -live relocation of VMs. This install tree contains source for a Linux -2.6 guest; ports to Linux 2.4, NetBSD, FreeBSD and Solaris are -available from the community. +live relocation of VMs. Ports to Linux 2.6, Linux 2.4, NetBSD, FreeBSD +and Solaris are available from the community. This file contains some quick-start instructions to install Xen on your system. For full documentation, see the Xen User Manual. If this @@ -55,8 +54,8 @@ 2. Configure your bootloader to boot Xen /boot/grub/menu.lst: edit this file to include an entry like the following: - title Xen 3.2 / XenLinux 2.6 - kernel /boot/xen-3.2.gz console=vga + title Xen 3.3 / XenLinux 2.6 + kernel /boot/xen-3.3.gz console=vga module /boot/vmlinuz-2.6-xen root= ro console=tty0 module /boot/initrd-2.6-xen.img @@ -75,7 +74,7 @@ 2. Configure your bootloader to boot Xen 32MB memory for internal use, which is not available for allocation to virtual machines. -3. Reboot your system and select the "Xen 3.2 / XenLinux 2.6" menu +3. Reboot your system and select the "Xen 3.3 / XenLinux 2.6" menu option. After booting Xen, Linux will start and your initialisation scripts should execute in the usual way. _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 08:47:18 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 08:47:18 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrb0A-00058a-Gq for www-data@colo.xensource.com; Thu, 01 May 2008 08:47:18 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb0f-0004jf-AD; Thu, 01 May 2008 15:47:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jra7N-0005ZK-67 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 14:50:41 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jra7G-0003ds-Jn for xen-changelog@lists.xensource.com; Thu, 01 May 2008 14:50:38 +0000 X-SBRS: 3.6 X-MesageID: 108697 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="108697" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 10:49:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41EnqGX011411 for ; Thu, 1 May 2008 07:49:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41EoANK031598 for ; Thu, 1 May 2008 07:50:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41EoAKZ031597 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 07:50:10 -0700 Message-Id: <200805011450.m41EoAKZ031597@xenbits.xensource.com> Date: Thu, 01 May 2008 07:50:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] i386: Fix the build. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209653075 -3600 # Node ID bb2301b33760e74960dc9b845d9251f6f4cd2fd1 # Parent 4b1bbcf18eb5a6c7d3e1b96306e8f6cec5209f09 i386: Fix the build. Signed-off-by: Keir Fraser --- xen/arch/x86/acpi/boot.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r 4b1bbcf18eb5 -r bb2301b33760 xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Thu May 01 14:04:12 2008 +0100 +++ b/xen/arch/x86/acpi/boot.c Thu May 01 15:44:35 2008 +0100 @@ -465,8 +465,9 @@ static void __init static void __init acpi_fadt_parse_reg(struct acpi_table_fadt *fadt) { - unsigned int len = min(fadt->header.length, sizeof(*fadt)); - + unsigned int len; + + len = min_t(unsigned int, fadt->header.length, sizeof(*fadt)); memcpy(&acpi_gbl_FADT, fadt, len); if (len > offsetof(struct acpi_table_fadt, xpm1b_event_block)) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 08:57:04 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 08:57:04 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrb9b-0005F4-SA for www-data@colo.xensource.com; Thu, 01 May 2008 08:57:04 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrbA8-0001l0-IB; Thu, 01 May 2008 15:57:36 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JraQk-0008LO-3B for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:10:42 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JraQe-0003sO-5g for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:10:39 +0000 X-SBRS: 3.6 X-MesageID: 108832 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="108832" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 11:09:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41F9pVK011527 for ; Thu, 1 May 2008 08:09:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41FA8aJ032713 for ; Thu, 1 May 2008 08:10:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41FA8BI032712 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 08:10:08 -0700 Message-Id: <200805011510.m41FA8BI032712@xenbits.xensource.com> Date: Thu, 01 May 2008 08:10:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Intel vpid: Invalidate VPID mapping on INVLPG. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209654476 -3600 # Node ID 45c975a6554d75e6661996a1b97dcc8c01d49888 # Parent bb2301b33760e74960dc9b845d9251f6f4cd2fd1 Intel vpid: Invalidate VPID mapping on INVLPG. Signed-off-by: Gianluca Guida --- xen/arch/x86/hvm/vmx/vmx.c | 3 ++- xen/include/asm-x86/hvm/vmx/vmx.h | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff -r bb2301b33760 -r 45c975a6554d xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Thu May 01 15:44:35 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Thu May 01 16:07:56 2008 +0100 @@ -1368,7 +1368,8 @@ static void vmx_invlpg_intercept(unsigne { struct vcpu *curr = current; HVMTRACE_2D(INVLPG, curr, /*invlpga=*/ 0, vaddr); - paging_invlpg(curr, vaddr); + if ( paging_invlpg(curr, vaddr) ) + vpid_sync_vcpu_gva(curr, vaddr); } #define CASE_SET_REG(REG, reg) \ diff -r bb2301b33760 -r 45c975a6554d xen/include/asm-x86/hvm/vmx/vmx.h --- a/xen/include/asm-x86/hvm/vmx/vmx.h Thu May 01 15:44:35 2008 +0100 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h Thu May 01 16:07:56 2008 +0100 @@ -301,6 +301,12 @@ static inline void ept_sync_all(void) void ept_sync_domain(struct domain *d); +static inline void vpid_sync_vcpu_gva(struct vcpu *v, unsigned long gva) +{ + if ( cpu_has_vmx_vpid ) + __invvpid(0, v->arch.hvm_vmx.vpid, (u64)gva); +} + static inline void vpid_sync_vcpu_all(struct vcpu *v) { if ( cpu_has_vmx_vpid ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 08:57:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 08:57:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrb9g-0005Gv-Np for www-data@colo.xensource.com; Thu, 01 May 2008 08:57:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrbAD-0001oq-IN; Thu, 01 May 2008 15:57:41 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JraQo-0008M2-6u for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:10:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JraQi-0003sO-FV for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:10:44 +0000 X-SBRS: 3.6 X-MesageID: 108833 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="108833" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 11:09:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41F9pcC011530 for ; Thu, 1 May 2008 08:09:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41FA91V032730 for ; Thu, 1 May 2008 08:10:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41FA9ED032729 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 08:10:09 -0700 Message-Id: <200805011510.m41FA9ED032729@xenbits.xensource.com> Date: Thu, 01 May 2008 08:10:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm cpuid: fix some problem with the hvm's cpuid configuration. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209654516 -3600 # Node ID eb3437db158ba73d5df1ae93074916709e1dc481 # Parent 45c975a6554d75e6661996a1b97dcc8c01d49888 x86 hvm cpuid: fix some problem with the hvm's cpuid configuration. - When we overwrite a cpuid's input, apply the default policy for the other registers. - For the python binding, get unsigned long instead long. - Fix the multiple inputs cpuid's configuration parsing. Signed-off-by: Jean Guyader --- tools/libxc/xc_cpuid_x86.c | 3 +++ tools/python/xen/lowlevel/xc/xc.c | 2 +- tools/python/xen/xm/create.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff -r 45c975a6554d -r eb3437db158b tools/libxc/xc_cpuid_x86.c --- a/tools/libxc/xc_cpuid_x86.c Thu May 01 16:07:56 2008 +0100 +++ b/tools/libxc/xc_cpuid_x86.c Thu May 01 16:08:36 2008 +0100 @@ -385,7 +385,10 @@ int xc_cpuid_set( for ( i = 0; i < 4; i++ ) { if ( config[i] == NULL ) + { + regs[i] = polregs[i]; continue; + } config_transformed[i] = alloc_str(); diff -r 45c975a6554d -r eb3437db158b tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Thu May 01 16:07:56 2008 +0100 +++ b/tools/python/xen/lowlevel/xc/xc.c Thu May 01 16:08:36 2008 +0100 @@ -696,7 +696,7 @@ static PyObject *pyxc_dom_set_cpuid(XcOb unsigned int input[2]; char *regs[4], *regs_transform[4]; - if ( !PyArg_ParseTuple(args, "iiOO", &domid, + if ( !PyArg_ParseTuple(args, "IIOO", &domid, &input[0], &sub_input, &config) ) return NULL; diff -r 45c975a6554d -r eb3437db158b tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Thu May 01 16:07:56 2008 +0100 +++ b/tools/python/xen/xm/create.py Thu May 01 16:08:36 2008 +0100 @@ -856,7 +856,9 @@ def preprocess_cpuid(vals, attr_name): if not vals.cpuid: return cpuid = {} for cpuid_input in getattr(vals, attr_name): - cpuid_match = re.match(r"(?P(0x)?[0-9A-Fa-f]+):(?P.*)", cpuid_input) + input_re = "(0x)?[0-9A-Fa-f]+(,(0x)?[0-9A-Fa-f]+)?" + cpuid_match = re.match(r'(?P%s):(?P.*)' % \ + input_re, cpuid_input) if cpuid_match != None: res_cpuid = cpuid_match.groupdict() input = res_cpuid['input'] _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 09:03:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 09:03:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrbFX-0005Us-RI for www-data@colo.xensource.com; Thu, 01 May 2008 09:03:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrbG4-0006Pg-KA; Thu, 01 May 2008 16:03:44 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb3X-00068E-Hg for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:50:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrb3G-0004bc-9Q for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:50:35 +0000 X-SBRS: 3.6 X-MesageID: 109212 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="109212" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 11:49:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41Fno1C011668 for ; Thu, 1 May 2008 08:49:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41Fo8ld002601 for ; Thu, 1 May 2008 08:50:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41Fo8sj002600 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 08:50:08 -0700 Message-Id: <200805011550.m41Fo8sj002600@xenbits.xensource.com> Date: Thu, 01 May 2008 08:50:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Accept decimal block device IDs X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209656128 -3600 # Node ID 84a066b9e57ae6c8885dc563141cd0a843ef571e # Parent eb3437db158ba73d5df1ae93074916709e1dc481 Accept decimal block device IDs Solaris uses a simple indexing scheme for block devices. Parts of xend translate them as hexadecimal (such as block-attach), and decimal, or unconverted, elsewhere (such as block-detach). Harmonise these interfaces by allowing decimal specifications. Also allow Solaris-style block device names. Signed-off-by: John Levon --- tools/python/xen/util/blkif.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff -r eb3437db158b -r 84a066b9e57a tools/python/xen/util/blkif.py --- a/tools/python/xen/util/blkif.py Thu May 01 16:08:36 2008 +0100 +++ b/tools/python/xen/util/blkif.py Thu May 01 16:35:28 2008 +0100 @@ -42,10 +42,12 @@ def blkdev_name_to_number(name): if re.match( '/dev/xvd[a-p]([1-9]|1[0-5])?', n): return 202 * 256 + 16 * (ord(n[8:9]) - ord('a')) + int(n[9:] or 0) - # see if this is a hex device number - if re.match( '^(0x)?[0-9a-fA-F]+$', name ): + if re.match( '^(0x)[0-9a-fA-F]+$', name ): return string.atoi(name,16) - + + if re.match('^[0-9]+$', name): + return string.atoi(name, 10) + return None def blkdev_segment(name): _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 09:03:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 09:03:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrbFb-0005Uv-VM for www-data@colo.xensource.com; Thu, 01 May 2008 09:03:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrbG8-0006T6-JJ; Thu, 01 May 2008 16:03:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb3i-0006CN-3U for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:50:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrb3W-0004bd-TU for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:50:56 +0000 X-SBRS: 3.6 X-MesageID: 109218 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="109218" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 11:49:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41FnqiQ011674 for ; Thu, 1 May 2008 08:49:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41FoAVj002635 for ; Thu, 1 May 2008 08:50:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41FoABB002634 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 08:50:10 -0700 Message-Id: <200805011550.m41FoABB002634@xenbits.xensource.com> Date: Thu, 01 May 2008 08:50:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Allow .config to override the "cc_compile_by" and "cc_compile_domain" settings. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209656218 -3600 # Node ID acdc1814d29b3ff05ea7093f06851edb31e06ad3 # Parent 706395167701dcb00e54d4739a163de944d70376 Allow .config to override the "cc_compile_by" and "cc_compile_domain" settings. Signed-off-by: David Edmondson --- xen/Makefile | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff -r 706395167701 -r acdc1814d29b xen/Makefile --- a/xen/Makefile Thu May 01 16:35:49 2008 +0100 +++ b/xen/Makefile Thu May 01 16:36:58 2008 +0100 @@ -5,6 +5,9 @@ export XEN_EXTRAVERSION ?= -unstable$(XE export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION) export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version + +export XEN_WHOAMI ?= $(USER) +export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) export BASEDIR := $(CURDIR) @@ -81,8 +84,8 @@ include/xen/compile.h: include/xen/compi include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \ -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \ - -e 's/@@whoami@@/$(USER)/g' \ - -e 's/@@domain@@/$(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown]))/g' \ + -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ + -e 's/@@domain@@/$(XEN_DOMAIN)/g' \ -e 's/@@hostname@@/$(shell hostname)/g' \ -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | grep -i "gcc.*version")!g' \ -e 's/@@version@@/$(XEN_VERSION)/g' \ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 09:03:21 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 09:03:21 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrbFg-0005Uy-QZ for www-data@colo.xensource.com; Thu, 01 May 2008 09:03:21 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrbGD-0006XQ-KY; Thu, 01 May 2008 16:03:53 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb3o-0006GC-2s for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:51:04 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrb3Y-0004bi-Un for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:51:01 +0000 X-SBRS: 3.6 X-MesageID: 109220 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="109220" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 11:49:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41FnrCH011677 for ; Thu, 1 May 2008 08:49:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41FoBhV002652 for ; Thu, 1 May 2008 08:50:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41FoB9g002651 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 08:50:11 -0700 Message-Id: <200805011550.m41FoB9g002651@xenbits.xensource.com> Date: Thu, 01 May 2008 08:50:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix xenstore-client.c compile X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209656248 -3600 # Node ID ac0900c43fd7e24b7aa945948f91c6fbc45f439a # Parent acdc1814d29b3ff05ea7093f06851edb31e06ad3 Fix xenstore-client.c compile errx() is not necessarily defined as a never-returns function. Fix lookup_mode() to account for this. Signed-off-by: John Levon --- tools/xenstore/xenstore_client.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r acdc1814d29b -r ac0900c43fd7 tools/xenstore/xenstore_client.c --- a/tools/xenstore/xenstore_client.c Thu May 01 16:36:58 2008 +0100 +++ b/tools/xenstore/xenstore_client.c Thu May 01 16:37:28 2008 +0100 @@ -450,8 +450,9 @@ static enum mode lookup_mode(const char return MODE_write; else if (strcmp(m, "read") == 0) return MODE_read; - else - errx(1, "unknown mode %s\n", m); + + errx(1, "unknown mode %s\n", m); + return 0; } int _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 09:03:25 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 09:03:25 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrbFk-0005V1-SA for www-data@colo.xensource.com; Thu, 01 May 2008 09:03:25 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrbGH-0006ar-Gx; Thu, 01 May 2008 16:03:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb3r-0006FF-FP for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:51:07 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrb3L-0004bc-S9 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:51:00 +0000 X-SBRS: 3.6 X-MesageID: 109215 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="109215" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 11:49:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41Fnphi011671 for ; Thu, 1 May 2008 08:49:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41Fo9co002618 for ; Thu, 1 May 2008 08:50:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41Fo9D1002617 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 08:50:09 -0700 Message-Id: <200805011550.m41Fo9D1002617@xenbits.xensource.com> Date: Thu, 01 May 2008 08:50:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Remove unimplemented xm migrate --resource option. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209656149 -3600 # Node ID 706395167701dcb00e54d4739a163de944d70376 # Parent 84a066b9e57ae6c8885dc563141cd0a843ef571e Remove unimplemented xm migrate --resource option. Signed-off-by: Gary Pennington --- tools/python/xen/xend/XendDomain.py | 3 +-- tools/python/xen/xend/server/SrvDomain.py | 1 - tools/python/xen/xm/migrate.py | 6 ------ 3 files changed, 1 insertion(+), 9 deletions(-) diff -r 84a066b9e57a -r 706395167701 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Thu May 01 16:35:28 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Thu May 01 16:35:49 2008 +0100 @@ -1258,7 +1258,7 @@ class XendDomain: return val - def domain_migrate(self, domid, dst, live=False, resource=0, port=0, node=-1): + def domain_migrate(self, domid, dst, live=False, port=0, node=-1): """Start domain migration. @param domid: Domain ID or Name @@ -1269,7 +1269,6 @@ class XendDomain: @type port: int @keyword live: Live migration @type live: bool - @keyword resource: not used?? @rtype: None @keyword node: use node number for target @rtype: int diff -r 84a066b9e57a -r 706395167701 tools/python/xen/xend/server/SrvDomain.py --- a/tools/python/xen/xend/server/SrvDomain.py Thu May 01 16:35:28 2008 +0100 +++ b/tools/python/xen/xend/server/SrvDomain.py Thu May 01 16:35:49 2008 +0100 @@ -115,7 +115,6 @@ class SrvDomain(SrvDir): [['dom', 'int'], ['destination', 'str'], ['live', 'int'], - ['resource', 'int'], ['port', 'int']]) return fn(req.args, {'dom': self.dom.domid}) diff -r 84a066b9e57a -r 706395167701 tools/python/xen/xm/migrate.py --- a/tools/python/xen/xm/migrate.py Thu May 01 16:35:28 2008 +0100 +++ b/tools/python/xen/xm/migrate.py Thu May 01 16:35:49 2008 +0100 @@ -47,10 +47,6 @@ gopts.opt('node', short='n', val='nodenu fn=set_int, default=-1, use="Use specified NUMA node on target.") -gopts.opt('resource', short='r', val='MBIT', - fn=set_int, default=0, - use="Set level of resource usage for migration.") - def help(): return str(gopts) @@ -69,13 +65,11 @@ def main(argv): vm_ref = get_single_vm(dom) other_config = { "port": opts.vals.port, - "resource": opts.vals.resource, "node": opts.vals.node } server.xenapi.VM.migrate(vm_ref, dst, bool(opts.vals.live), other_config) else: server.xend.domain.migrate(dom, dst, opts.vals.live, - opts.vals.resource, opts.vals.port, opts.vals.node) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 09:04:11 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 09:04:11 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrbGU-0005Vf-5w for www-data@colo.xensource.com; Thu, 01 May 2008 09:04:11 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrbH0-00078p-Te; Thu, 01 May 2008 16:04:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb41-0006MB-H0 for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:51:17 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrb3k-0004bc-TO for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:51:15 +0000 X-SBRS: 3.6 X-MesageID: 109223 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="109223" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 11:49:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41FntVm011683 for ; Thu, 1 May 2008 08:49:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41FoDcs002686 for ; Thu, 1 May 2008 08:50:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41FoD30002685 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 08:50:13 -0700 Message-Id: <200805011550.m41FoD30002685@xenbits.xensource.com> Date: Thu, 01 May 2008 08:50:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add ZFS libfsimage support patch X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209656336 -3600 # Node ID 64f790e90d3d4797e298cc5abdfc54cb943687f3 # Parent 8ccaf43782bd43e7d593a0c8e9c7af6f616b86c6 Add ZFS libfsimage support patch Add support to pygrub and libfsimage to boot ZFS root filesystems. Boot argument of zfs-bootfs is set to describe ZFS root pool and boot filesystem object number. Boot argument bootpath is set to describe the virtual device root mirror components. Signed-off-by: Susan Kamm-Worrell --- tools/libfsimage/Makefile | 2 tools/libfsimage/common/fsimage.c | 29 tools/libfsimage/common/fsimage.h | 6 tools/libfsimage/common/fsimage_grub.c | 4 tools/libfsimage/common/fsimage_grub.h | 8 tools/libfsimage/common/fsimage_priv.h | 3 tools/libfsimage/common/mapfile-GNU | 3 tools/libfsimage/common/mapfile-SunOS | 3 tools/libfsimage/zfs/Makefile | 37 tools/libfsimage/zfs/fsys_zfs.c | 1457 ++++++++++++++++++++++ tools/libfsimage/zfs/fsys_zfs.h | 203 +++ tools/libfsimage/zfs/mb_info.h | 217 +++ tools/libfsimage/zfs/zfs-include/dmu.h | 105 + tools/libfsimage/zfs/zfs-include/dmu_objset.h | 35 tools/libfsimage/zfs/zfs-include/dnode.h | 76 + tools/libfsimage/zfs/zfs-include/dsl_dataset.h | 53 tools/libfsimage/zfs/zfs-include/dsl_dir.h | 49 tools/libfsimage/zfs/zfs-include/spa.h | 283 ++++ tools/libfsimage/zfs/zfs-include/uberblock_impl.h | 49 tools/libfsimage/zfs/zfs-include/vdev_impl.h | 70 + tools/libfsimage/zfs/zfs-include/zap_impl.h | 110 + tools/libfsimage/zfs/zfs-include/zap_leaf.h | 100 + tools/libfsimage/zfs/zfs-include/zfs.h | 112 + tools/libfsimage/zfs/zfs-include/zfs_acl.h | 60 tools/libfsimage/zfs/zfs-include/zfs_znode.h | 68 + tools/libfsimage/zfs/zfs-include/zil.h | 51 tools/libfsimage/zfs/zfs-include/zio.h | 81 + tools/libfsimage/zfs/zfs-include/zio_checksum.h | 42 tools/libfsimage/zfs/zfs_fletcher.c | 93 + tools/libfsimage/zfs/zfs_lzjb.c | 60 tools/libfsimage/zfs/zfs_sha256.c | 124 + tools/pygrub/src/fsimage/fsimage.c | 24 tools/pygrub/src/pygrub | 18 33 files changed, 3626 insertions(+), 9 deletions(-) diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/Makefile --- a/tools/libfsimage/Makefile Thu May 01 16:37:46 2008 +0100 +++ b/tools/libfsimage/Makefile Thu May 01 16:38:56 2008 +0100 @@ -1,7 +1,7 @@ XEN_ROOT = ../.. XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk -SUBDIRS-y = common ufs reiserfs iso9660 fat +SUBDIRS-y = common ufs reiserfs iso9660 fat zfs SUBDIRS-y += $(shell env CC="$(CC)" ./check-libext2fs) .PHONY: all clean install diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/common/fsimage.c --- a/tools/libfsimage/common/fsimage.c Thu May 01 16:37:46 2008 +0100 +++ b/tools/libfsimage/common/fsimage.c Thu May 01 16:38:56 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -51,6 +51,7 @@ fsi_t *fsi_open_fsimage(const char *path fsi->f_fd = fd; fsi->f_off = off; fsi->f_data = NULL; + fsi->f_bootstring = NULL; pthread_mutex_lock(&fsi_lock); err = find_plugin(fsi, path, options); @@ -140,3 +141,29 @@ ssize_t fsi_pread_file(fsi_file_t *ffi, return (ret); } + +char * +fsi_bootstring_alloc(fsi_t *fsi, size_t len) +{ + fsi->f_bootstring = malloc(len); + if (fsi->f_bootstring == NULL) + return (NULL); + + bzero(fsi->f_bootstring, len); + return (fsi->f_bootstring); +} + +void +fsi_bootstring_free(fsi_t *fsi) +{ + if (fsi->f_bootstring != NULL) { + free(fsi->f_bootstring); + fsi->f_bootstring = NULL; + } +} + +char * +fsi_fs_bootstring(fsi_t *fsi) +{ + return (fsi->f_bootstring); +} diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/common/fsimage.h --- a/tools/libfsimage/common/fsimage.h Thu May 01 16:37:46 2008 +0100 +++ b/tools/libfsimage/common/fsimage.h Thu May 01 16:38:56 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -45,6 +45,10 @@ ssize_t fsi_read_file(fsi_file_t *, void ssize_t fsi_read_file(fsi_file_t *, void *, size_t); ssize_t fsi_pread_file(fsi_file_t *, void *, size_t, uint64_t); +char *fsi_bootstring_alloc(fsi_t *, size_t); +void fsi_bootstring_free(fsi_t *); +char *fsi_fs_bootstring(fsi_t *); + #ifdef __cplusplus }; #endif diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/common/fsimage_grub.c --- a/tools/libfsimage/common/fsimage_grub.c Thu May 01 16:37:46 2008 +0100 +++ b/tools/libfsimage/common/fsimage_grub.c Thu May 01 16:38:56 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -286,6 +286,7 @@ fsig_mount(fsi_t *fsi, const char *path, if (!ops->fpo_mount(ffi, options)) { fsip_file_free(ffi); + fsi_bootstring_free(fsi); free(fsi->f_data); fsi->f_data = NULL; return (-1); @@ -299,6 +300,7 @@ static int static int fsig_umount(fsi_t *fsi) { + fsi_bootstring_free(fsi); free(fsi->f_data); return (0); } diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/common/fsimage_grub.h --- a/tools/libfsimage/common/fsimage_grub.h Thu May 01 16:37:46 2008 +0100 +++ b/tools/libfsimage/common/fsimage_grub.h Thu May 01 16:38:56 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -72,6 +72,12 @@ unsigned long fsig_log2(unsigned long); #define ERR_FILELENGTH 1 #define ERR_BAD_FILETYPE 1 #define ERR_FILE_NOT_FOUND 1 +#define ERR_BAD_ARGUMENT 1 +#define ERR_FILESYSTEM_NOT_FOUND 1 +#define ERR_NO_BOOTPATH 1 +#define ERR_DEV_VALUES 1 +#define ERR_WONT_FIT 1 +#define ERR_READ 1 fsi_plugin_ops_t *fsig_init(fsi_plugin_t *, fsig_plugin_ops_t *); diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/common/fsimage_priv.h --- a/tools/libfsimage/common/fsimage_priv.h Thu May 01 16:37:46 2008 +0100 +++ b/tools/libfsimage/common/fsimage_priv.h Thu May 01 16:38:56 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -46,6 +46,7 @@ struct fsi { uint64_t f_off; void *f_data; fsi_plugin_t *f_plugin; + char *f_bootstring; }; struct fsi_file { diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/common/mapfile-GNU --- a/tools/libfsimage/common/mapfile-GNU Thu May 01 16:37:46 2008 +0100 +++ b/tools/libfsimage/common/mapfile-GNU Thu May 01 16:38:56 2008 +0100 @@ -8,6 +8,9 @@ VERSION { fsi_close_file; fsi_read_file; fsi_pread_file; + fsi_bootstring_alloc; + fsi_bootstring_free; + fsi_fs_bootstring; fsip_fs_set_data; fsip_file_alloc; diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/common/mapfile-SunOS --- a/tools/libfsimage/common/mapfile-SunOS Thu May 01 16:37:46 2008 +0100 +++ b/tools/libfsimage/common/mapfile-SunOS Thu May 01 16:38:56 2008 +0100 @@ -7,6 +7,9 @@ libfsimage.so.1.0 { fsi_close_file; fsi_read_file; fsi_pread_file; + fsi_bootstring_alloc; + fsi_bootstring_free; + fsi_fs_bootstring; fsip_fs_set_data; fsip_file_alloc; diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/Makefile Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,37 @@ +# +# GRUB -- GRand Unified Bootloader +# Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +XEN_ROOT = ../../.. + +LIB_SRCS-y = fsys_zfs.c zfs_lzjb.c zfs_sha256.c zfs_fletcher.c + +FS = zfs + +.PHONY: all +all: fs-all + +.PHONY: install +install: fs-install + +include $(XEN_ROOT)/tools/libfsimage/Rules.mk diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/fsys_zfs.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/fsys_zfs.c Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,1457 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * All files in the zfs directory are derived from the OpenSolaris + * zfs grub files. All files in the zfs-include directory were + * included without changes. + */ + +/* + * The zfs plug-in routines for GRUB are: + * + * zfs_mount() - locates a valid uberblock of the root pool and reads + * in its MOS at the memory address MOS. + * + * zfs_open() - locates a plain file object by following the MOS + * and places its dnode at the memory address DNODE. + * + * zfs_read() - read in the data blocks pointed by the DNODE. + * + * ZFS_SCRATCH is used as a working area. + * + * (memory addr) MOS DNODE ZFS_SCRATCH + * | | | + * +-------V---------V----------V---------------+ + * memory | | dnode | dnode | scratch | + * | | 512B | 512B | area | + * +--------------------------------------------+ + */ + +#include +#include + +/* From "shared.h" */ +#include "mb_info.h" + +/* Boot signature related defines for the findroot command */ +#define BOOTSIGN_DIR "/boot/grub/bootsign" +#define BOOTSIGN_BACKUP "/etc/bootsign" + +/* Maybe redirect memory requests through grub_scratch_mem. */ +#define RAW_ADDR(x) (x) +#define RAW_SEG(x) (x) + +/* ZFS will use the top 4 Meg of physical memory (below 4Gig) for sratch */ +#define ZFS_SCRATCH_SIZE 0x400000 + +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +/* End from shared.h */ + +#include "fsys_zfs.h" + +/* cache for a file block of the currently zfs_open()-ed file */ +#define file_buf zfs_ba->zfs_file_buf +#define file_start zfs_ba->zfs_file_start +#define file_end zfs_ba->zfs_file_end + +/* cache for a dnode block */ +#define dnode_buf zfs_ba->zfs_dnode_buf +#define dnode_mdn zfs_ba->zfs_dnode_mdn +#define dnode_start zfs_ba->zfs_dnode_start +#define dnode_end zfs_ba->zfs_dnode_end + +#define stackbase zfs_ba->zfs_stackbase + +decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = +{ + {"noop", 0}, + {"on", lzjb_decompress}, /* ZIO_COMPRESS_ON */ + {"off", 0}, + {"lzjb", lzjb_decompress} /* ZIO_COMPRESS_LZJB */ +}; + +/* From disk_io.c */ +/* ZFS root filesystem for booting */ +#define current_bootpath zfs_ba->zfs_current_bootpath +#define current_rootpool zfs_ba->zfs_current_rootpool +#define current_bootfs zfs_ba->zfs_current_bootfs +#define current_bootfs_obj zfs_ba->zfs_current_bootfs_obj +#define is_zfs_mount (*fsig_int1(ffi)) +/* End from disk_io.c */ + +#define is_zfs_open zfs_ba->zfs_open + +/* + * Our own version of bcmp(). + */ +static int +zfs_bcmp(const void *s1, const void *s2, size_t n) +{ + const unsigned char *ps1 = s1; + const unsigned char *ps2 = s2; + + if (s1 != s2 && n != 0) { + do { + if (*ps1++ != *ps2++) + return (1); + } while (--n != 0); + } + + return (0); +} + +/* + * Our own version of log2(). Same thing as highbit()-1. + */ +static int +zfs_log2(uint64_t num) +{ + int i = 0; + + while (num > 1) { + i++; + num = num >> 1; + } + + return (i); +} + +/* Checksum Functions */ +static void +zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0); +} + +/* Checksum Table and Values */ +zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { + {{NULL, NULL}, 0, 0, "inherit"}, + {{NULL, NULL}, 0, 0, "on"}, + {{zio_checksum_off, zio_checksum_off}, 0, 0, "off"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 1, "label"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 1, "gang_header"}, + {{fletcher_2_native, fletcher_2_byteswap}, 0, 1, "zilog"}, + {{fletcher_2_native, fletcher_2_byteswap}, 0, 0, "fletcher2"}, + {{fletcher_4_native, fletcher_4_byteswap}, 1, 0, "fletcher4"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 0, "SHA256"} +}; + +/* + * zio_checksum_verify: Provides support for checksum verification. + * + * Fletcher2, Fletcher4, and SHA256 are supported. + * + * Return: + * -1 = Failure + * 0 = Success + */ +static int +zio_checksum_verify(blkptr_t *bp, char *data, int size) +{ + zio_cksum_t zc = bp->blk_cksum; + uint32_t checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : + BP_GET_CHECKSUM(bp); + int byteswap = BP_SHOULD_BYTESWAP(bp); + zio_block_tail_t *zbt = (zio_block_tail_t *)(data + size) - 1; + zio_checksum_info_t *ci = &zio_checksum_table[checksum]; + zio_cksum_t actual_cksum, expected_cksum; + + /* byteswap is not supported */ + if (byteswap) + return (-1); + + if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL) + return (-1); + + if (ci->ci_zbt) { + if (checksum == ZIO_CHECKSUM_GANG_HEADER) { + /* + * 'gang blocks' is not supported. + */ + return (-1); + } + + if (zbt->zbt_magic == BSWAP_64(ZBT_MAGIC)) { + /* byte swapping is not supported */ + return (-1); + } else { + expected_cksum = zbt->zbt_cksum; + zbt->zbt_cksum = zc; + ci->ci_func[0](data, size, &actual_cksum); + zbt->zbt_cksum = expected_cksum; + } + zc = expected_cksum; + + } else { + if (BP_IS_GANG(bp)) + return (-1); + ci->ci_func[byteswap](data, size, &actual_cksum); + } + + if ((actual_cksum.zc_word[0] - zc.zc_word[0]) | + (actual_cksum.zc_word[1] - zc.zc_word[1]) | + (actual_cksum.zc_word[2] - zc.zc_word[2]) | + (actual_cksum.zc_word[3] - zc.zc_word[3])) + return (-1); + + return (0); +} + +/* + * vdev_label_offset takes "offset" (the offset within a vdev_label) and + * returns its physical disk offset (starting from the beginning of the vdev). + * + * Input: + * psize : Physical size of this vdev + * l : Label Number (0-3) + * offset : The offset with a vdev_label in which we want the physical + * address + * Return: + * Success : physical disk offset + * Failure : errnum = ERR_BAD_ARGUMENT, return value is meaningless + */ +static uint64_t +vdev_label_offset(fsi_file_t *ffi, uint64_t psize, int l, uint64_t offset) +{ + /* XXX Need to add back label support! */ + if (l >= VDEV_LABELS/2 || offset > sizeof (vdev_label_t)) { + errnum = ERR_BAD_ARGUMENT; + return (0); + } + + return (offset + l * sizeof (vdev_label_t) + (l < VDEV_LABELS / 2 ? + 0 : psize - VDEV_LABELS * sizeof (vdev_label_t))); + +} + +/* + * vdev_uberblock_compare takes two uberblock structures and returns an integer + * indicating the more recent of the two. + * Return Value = 1 if ub2 is more recent + * Return Value = -1 if ub1 is more recent + * The most recent uberblock is determined using its transaction number and + * timestamp. The uberblock with the highest transaction number is + * considered "newer". If the transaction numbers of the two blocks match, the + * timestamps are compared to determine the "newer" of the two. + */ +static int +vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2) +{ + if (ub1->ub_txg < ub2->ub_txg) + return (-1); + if (ub1->ub_txg > ub2->ub_txg) + return (1); + + if (ub1->ub_timestamp < ub2->ub_timestamp) + return (-1); + if (ub1->ub_timestamp > ub2->ub_timestamp) + return (1); + + return (0); +} + +/* + * Three pieces of information are needed to verify an uberblock: the magic + * number, the version number, and the checksum. + * + * Currently Implemented: version number, magic number + * Need to Implement: checksum + * + * Return: + * 0 - Success + * -1 - Failure + */ +static int +uberblock_verify(uberblock_phys_t *ub, int offset) +{ + + uberblock_t *uber = &ub->ubp_uberblock; + blkptr_t bp; + + BP_ZERO(&bp); + BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); + BP_SET_BYTEORDER(&bp, ZFS_HOST_BYTEORDER); + ZIO_SET_CHECKSUM(&bp.blk_cksum, offset, 0, 0, 0); + + if (zio_checksum_verify(&bp, (char *)ub, UBERBLOCK_SIZE) != 0) + return (-1); + + if (uber->ub_magic == UBERBLOCK_MAGIC && + uber->ub_version >= SPA_VERSION_1 && + uber->ub_version <= SPA_VERSION) + return (0); + + return (-1); +} + +/* + * Find the best uberblock. + * Return: + * Success - Pointer to the best uberblock. + * Failure - NULL + */ +static uberblock_phys_t * +find_bestub(fsi_file_t *ffi, uberblock_phys_t *ub_array, int label) +{ + uberblock_phys_t *ubbest = NULL; + int i, offset; + + for (i = 0; i < (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT); i++) { + offset = vdev_label_offset(ffi, 0, label, + VDEV_UBERBLOCK_OFFSET(i)); + if (errnum == ERR_BAD_ARGUMENT) + return (NULL); + if (uberblock_verify(&ub_array[i], offset) == 0) { + if (ubbest == NULL) { + ubbest = &ub_array[i]; + } else if (vdev_uberblock_compare( + &(ub_array[i].ubp_uberblock), + &(ubbest->ubp_uberblock)) > 0) { + ubbest = &ub_array[i]; + } + } + } + + return (ubbest); +} + +/* + * Read in a block and put its uncompressed data in buf. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +zio_read(fsi_file_t *ffi, blkptr_t *bp, void *buf, char *stack) +{ + uint64_t offset, sector; + int psize, lsize; + int i, comp, cksum; + + psize = BP_GET_PSIZE(bp); + lsize = BP_GET_LSIZE(bp); + comp = BP_GET_COMPRESS(bp); + cksum = BP_GET_CHECKSUM(bp); + + if ((unsigned int)comp >= ZIO_COMPRESS_FUNCTIONS || + (comp != ZIO_COMPRESS_OFF && + decomp_table[comp].decomp_func == NULL)) + return (ERR_FSYS_CORRUPT); + + /* pick a good dva from the block pointer */ + for (i = 0; i < SPA_DVAS_PER_BP; i++) { + + if (bp->blk_dva[i].dva_word[0] == 0 && + bp->blk_dva[i].dva_word[1] == 0) + continue; + + /* read in a block */ + offset = DVA_GET_OFFSET(&bp->blk_dva[i]); + sector = DVA_OFFSET_TO_PHYS_SECTOR(offset); + + if (comp != ZIO_COMPRESS_OFF) { + + if (devread(ffi, sector, 0, psize, stack) == 0) + continue; + if (zio_checksum_verify(bp, stack, psize) != 0) + continue; + decomp_table[comp].decomp_func(stack, buf, psize, + lsize); + } else { + if (devread(ffi, sector, 0, psize, buf) == 0) + continue; + if (zio_checksum_verify(bp, buf, psize) != 0) + continue; + } + return (0); + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Get the block from a block id. + * push the block onto the stack. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +dmu_read(fsi_file_t *ffi, dnode_phys_t *dn, uint64_t blkid, void *buf, + char *stack) +{ + int idx, level; + blkptr_t *bp_array = dn->dn_blkptr; + int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; + blkptr_t *bp, *tmpbuf; + + bp = (blkptr_t *)stack; + stack += sizeof (blkptr_t); + + tmpbuf = (blkptr_t *)stack; + stack += 1<dn_indblkshift; + + for (level = dn->dn_nlevels - 1; level >= 0; level--) { + idx = (blkid >> (epbs * level)) & ((1<dn_datablkszsec << SPA_MINBLOCKSHIFT); + break; + } else if ((errnum = zio_read(ffi, bp, tmpbuf, stack))) { + return (errnum); + } + bp_array = tmpbuf; + } + + return (0); +} + +/* + * mzap_lookup: Looks up property described by "name" and returns the value + * in "value". + * + * Return: + * 0 - success + * errnum - failure + */ +static int +mzap_lookup(mzap_phys_t *zapobj, int objsize, char *name, + uint64_t *value) +{ + int i, chunks; + mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; + + chunks = objsize/MZAP_ENT_LEN - 1; + for (i = 0; i < chunks; i++) { + if (strcmp(mzap_ent[i].mze_name, name) == 0) { + *value = mzap_ent[i].mze_value; + return (0); + } + } + + return (ERR_FSYS_CORRUPT); +} + +static uint64_t +zap_hash(fsi_file_t *ffi, uint64_t salt, const char *name) +{ + static uint64_t table[256]; + const uint8_t *cp; + uint8_t c; + uint64_t crc = salt; + + if (table[128] == 0) { + uint64_t *ct; + int i, j; + for (i = 0; i < 256; i++) { + for (ct = table + i, *ct = i, j = 8; j > 0; j--) + *ct = (*ct >> 1) ^ (-(*ct & 1) & + ZFS_CRC64_POLY); + } + } + + if (crc == 0 || table[128] != ZFS_CRC64_POLY) { + errnum = ERR_FSYS_CORRUPT; + return (0); + } + + for (cp = (const uint8_t *)name; (c = *cp) != '\0'; cp++) + crc = (crc >> 8) ^ table[(crc ^ c) & 0xFF]; + + /* + * Only use 28 bits, since we need 4 bits in the cookie for the + * collision differentiator. We MUST use the high bits, since + * those are the onces that we first pay attention to when + * chosing the bucket. + */ + crc &= ~((1ULL << (64 - ZAP_HASHBITS)) - 1); + + return (crc); +} + +/* + * Only to be used on 8-bit arrays. + * array_len is actual len in bytes (not encoded le_value_length). + * buf is null-terminated. + */ +static int +zap_leaf_array_equal(zap_leaf_phys_t *l, int blksft, int chunk, + int array_len, const char *buf) +{ + int bseen = 0; + + while (bseen < array_len) { + struct zap_leaf_array *la = + &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array; + int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); + + if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) + return (0); + + if (zfs_bcmp(la->la_array, buf + bseen, toread) != 0) + break; + chunk = la->la_next; + bseen += toread; + } + return (bseen == array_len); +} + +/* + * Given a zap_leaf_phys_t, walk thru the zap leaf chunks to get the + * value for the property "name". + * + * Return: + * 0 - success + * errnum - failure + */ +static int +zap_leaf_lookup(zap_leaf_phys_t *l, int blksft, uint64_t h, + const char *name, uint64_t *value) +{ + uint16_t chunk; + struct zap_leaf_entry *le; + + /* Verify if this is a valid leaf block */ + if (l->l_hdr.lh_block_type != ZBT_LEAF) + return (ERR_FSYS_CORRUPT); + if (l->l_hdr.lh_magic != ZAP_LEAF_MAGIC) + return (ERR_FSYS_CORRUPT); + + for (chunk = l->l_hash[LEAF_HASH(blksft, h)]; + chunk != CHAIN_END; chunk = le->le_next) { + + if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) + return (ERR_FSYS_CORRUPT); + + le = ZAP_LEAF_ENTRY(l, blksft, chunk); + + /* Verify the chunk entry */ + if (le->le_type != ZAP_CHUNK_ENTRY) + return (ERR_FSYS_CORRUPT); + + if (le->le_hash != h) + continue; + + if (zap_leaf_array_equal(l, blksft, le->le_name_chunk, + le->le_name_length, name)) { + + struct zap_leaf_array *la; + uint8_t *ip; + + if (le->le_int_size != 8 || le->le_value_length != 1) + return (ERR_FSYS_CORRUPT); + + /* get the uint64_t property value */ + la = &ZAP_LEAF_CHUNK(l, blksft, + le->le_value_chunk).l_array; + ip = la->la_array; + + *value = (uint64_t)ip[0] << 56 | (uint64_t)ip[1] << 48 | + (uint64_t)ip[2] << 40 | (uint64_t)ip[3] << 32 | + (uint64_t)ip[4] << 24 | (uint64_t)ip[5] << 16 | + (uint64_t)ip[6] << 8 | (uint64_t)ip[7]; + + return (0); + } + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Fat ZAP lookup + * + * Return: + * 0 - success + * errnum - failure + */ +static int +fzap_lookup(fsi_file_t *ffi, dnode_phys_t *zap_dnode, zap_phys_t *zap, + char *name, uint64_t *value, char *stack) +{ + zap_leaf_phys_t *l; + uint64_t hash, idx, blkid; + int blksft = zfs_log2(zap_dnode->dn_datablkszsec << DNODE_SHIFT); + + /* Verify if this is a fat zap header block */ + if (zap->zap_magic != (uint64_t)ZAP_MAGIC) + return (ERR_FSYS_CORRUPT); + + hash = zap_hash(ffi, zap->zap_salt, name); + if (errnum) + return (errnum); + + /* get block id from index */ + if (zap->zap_ptrtbl.zt_numblks != 0) { + /* external pointer tables not supported */ + return (ERR_FSYS_CORRUPT); + } + idx = ZAP_HASH_IDX(hash, zap->zap_ptrtbl.zt_shift); + blkid = ((uint64_t *)zap)[idx + (1<<(blksft-3-1))]; + + /* Get the leaf block */ + l = (zap_leaf_phys_t *)stack; + stack += 1<dn_datablkszsec << SPA_MINBLOCKSHIFT; + stack += size; + if ((errnum = dmu_read(ffi, zap_dnode, 0, zapbuf, stack))) + return (errnum); + + block_type = *((uint64_t *)zapbuf); + + if (block_type == ZBT_MICRO) { + return (mzap_lookup(zapbuf, size, name, val)); + } else if (block_type == ZBT_HEADER) { + /* this is a fat zap */ + return (fzap_lookup(ffi, zap_dnode, zapbuf, name, + val, stack)); + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Get the dnode of an object number from the metadnode of an object set. + * + * Input + * mdn - metadnode to get the object dnode + * objnum - object number for the object dnode + * buf - data buffer that holds the returning dnode + * stack - scratch area + * + * Return: + * 0 - success + * errnum - failure + */ +static int +dnode_get(fsi_file_t *ffi, dnode_phys_t *mdn, uint64_t objnum, + uint8_t type, dnode_phys_t *buf, char *stack) +{ + uint64_t blkid, blksz; /* the block id this object dnode is in */ + int epbs; /* shift of number of dnodes in a block */ + int idx; /* index within a block */ + dnode_phys_t *dnbuf; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + blksz = mdn->dn_datablkszsec << SPA_MINBLOCKSHIFT; + epbs = zfs_log2(blksz) - DNODE_SHIFT; + blkid = objnum >> epbs; + idx = objnum & ((1<= dnode_start && objnum < dnode_end) { + grub_memmove(buf, &dnode_buf[idx], DNODE_SIZE); + VERIFY_DN_TYPE(buf, type); + return (0); + } + + if (dnode_buf && blksz == 1< ZPL_VERSION) + return (-1); + + if ((errnum = zap_lookup(ffi, dn, ZFS_ROOT_OBJ, &objnum, stack))) + return (errnum); + + if ((errnum = dnode_get(ffi, mdn, objnum, DMU_OT_DIRECTORY_CONTENTS, + dn, stack))) + return (errnum); + + /* skip leading slashes */ + while (*path == '/') + path++; + + while (*path && !isspace(*path)) { + + /* get the next component name */ + cname = path; + while (*path && !isspace(*path) && *path != '/') + path++; + ch = *path; + *path = 0; /* ensure null termination */ + + if ((errnum = zap_lookup(ffi, dn, cname, &objnum, stack))) + return (errnum); + + objnum = ZFS_DIRENT_OBJ(objnum); + if ((errnum = dnode_get(ffi, mdn, objnum, 0, dn, stack))) + return (errnum); + + *path = ch; + while (*path == '/') + path++; + } + + /* We found the dnode for this file. Verify if it is a plain file. */ + VERIFY_DN_TYPE(dn, DMU_OT_PLAIN_FILE_CONTENTS); + + return (0); +} + +/* + * Get the default 'bootfs' property value from the rootpool. + * + * Return: + * 0 - success + * errnum -failure + */ +static int +get_default_bootfsobj(fsi_file_t *ffi, dnode_phys_t *mosmdn, + uint64_t *obj, char *stack) +{ + uint64_t objnum = 0; + dnode_phys_t *dn = (dnode_phys_t *)stack; + stack += DNODE_SIZE; + + if ((errnum = dnode_get(ffi, mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, dn, stack))) + return (errnum); + + /* + * find the object number for 'pool_props', and get the dnode + * of the 'pool_props'. + */ + if (zap_lookup(ffi, dn, DMU_POOL_PROPS, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_POOL_PROPS, dn, + stack))) + return (errnum); + + if (zap_lookup(ffi, dn, ZPOOL_PROP_BOOTFS, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (!objnum) + return (ERR_FILESYSTEM_NOT_FOUND); + + + *obj = objnum; + return (0); +} + +/* + * Given a MOS metadnode, get the metadnode of a given filesystem name (fsname), + * e.g. pool/rootfs, or a given object number (obj), e.g. the object number + * of pool/rootfs. + * + * If no fsname and no obj are given, return the DSL_DIR metadnode. + * If fsname is given, return its metadnode and its matching object number. + * If only obj is given, return the metadnode for this object number. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +get_objset_mdn(fsi_file_t *ffi, dnode_phys_t *mosmdn, char *fsname, + uint64_t *obj, dnode_phys_t *mdn, char *stack) +{ + uint64_t objnum, headobj; + char *cname, ch; + blkptr_t *bp; + objset_phys_t *osp; + + if (fsname == NULL && obj) { + headobj = *obj; + goto skip; + } + + if ((errnum = dnode_get(ffi, mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, mdn, stack))) + return (errnum); + + if ((errnum = zap_lookup(ffi, mdn, DMU_POOL_ROOT_DATASET, &objnum, + stack))) + return (errnum); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_DSL_DIR, mdn, + stack))) + return (errnum); + + if (fsname == NULL) { + headobj = + ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; + goto skip; + } + + /* take out the pool name */ + while (*fsname && !isspace(*fsname) && *fsname != '/') + fsname++; + + while (*fsname && !isspace(*fsname)) { + uint64_t childobj; + + while (*fsname == '/') + fsname++; + + cname = fsname; + while (*fsname && !isspace(*fsname) && *fsname != '/') + fsname++; + ch = *fsname; + *fsname = 0; + + childobj = + ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_child_dir_zapobj; + if ((errnum = dnode_get(ffi, mosmdn, childobj, + DMU_OT_DSL_DIR_CHILD_MAP, mdn, stack))) + return (errnum); + + if (zap_lookup(ffi, mdn, cname, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_DSL_DIR, + mdn, stack))) + return (errnum); + + *fsname = ch; + } + headobj = ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; + if (obj) + *obj = headobj; + +skip: + if ((errnum = dnode_get(ffi, mosmdn, headobj, DMU_OT_DSL_DATASET, mdn, + stack))) + return (errnum); + + /* TODO: Add snapshot support here - for fsname=snapshot-name */ + + bp = &((dsl_dataset_phys_t *)DN_BONUS(mdn))->ds_bp; + osp = (objset_phys_t *)stack; + stack += sizeof (objset_phys_t); + if ((errnum = zio_read(ffi, bp, osp, stack))) + return (errnum); + + grub_memmove((char *)mdn, (char *)&osp->os_meta_dnode, DNODE_SIZE); + + return (0); +} + +/* + * For a given XDR packed nvlist, verify the first 4 bytes and move on. + * + * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) : + * + * encoding method/host endian (4 bytes) + * nvl_version (4 bytes) + * nvl_nvflag (4 bytes) + * encoded nvpairs: + * encoded size of the nvpair (4 bytes) + * decoded size of the nvpair (4 bytes) + * name string size (4 bytes) + * name string data (sizeof(NV_ALIGN4(string)) + * data type (4 bytes) + * # of elements in the nvpair (4 bytes) + * data + * 2 zero's for the last nvpair + * (end of the entire list) (8 bytes) + * + * Return: + * 0 - success + * 1 - failure + */ +static int +nvlist_unpack(char *nvlist, char **out) +{ + /* Verify if the 1st and 2nd byte in the nvlist are valid. */ + if (nvlist[0] != NV_ENCODE_XDR || nvlist[1] != HOST_ENDIAN) + return (1); + + nvlist += 4; + *out = nvlist; + return (0); +} + +static char * +nvlist_array(char *nvlist, int index) +{ + int i, encode_size; + + for (i = 0; i < index; i++) { + /* skip the header, nvl_version, and nvl_nvflag */ + nvlist = nvlist + 4 * 2; + + while ((encode_size = BSWAP_32(*(uint32_t *)nvlist))) + nvlist += encode_size; /* goto the next nvpair */ + + nvlist = nvlist + 4 * 2; /* skip the ending 2 zeros - 8 bytes */ + } + + return (nvlist); +} + +static int +nvlist_lookup_value(char *nvlist, char *name, void *val, int valtype, + int *nelmp) +{ + int name_len, type, slen, encode_size; + char *nvpair, *nvp_name, *strval = val; + uint64_t *intval = val; + + /* skip the header, nvl_version, and nvl_nvflag */ + nvlist = nvlist + 4 * 2; + + /* + * Loop thru the nvpair list + * The XDR representation of an integer is in big-endian byte order. + */ + while ((encode_size = BSWAP_32(*(uint32_t *)nvlist))) { + + nvpair = nvlist + 4 * 2; /* skip the encode/decode size */ + + name_len = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + + nvp_name = nvpair; + nvpair = nvpair + ((name_len + 3) & ~3); /* align */ + + type = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + + if (((strncmp(nvp_name, name, name_len) == 0) && + type == valtype)) { + int nelm; + + if (((nelm = BSWAP_32(*(uint32_t *)nvpair)) < 1)) + return (1); + nvpair += 4; + + switch (valtype) { + case DATA_TYPE_STRING: + slen = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + grub_memmove(strval, nvpair, slen); + strval[slen] = '\0'; + return (0); + + case DATA_TYPE_UINT64: + *intval = BSWAP_64(*(uint64_t *)nvpair); + return (0); + + case DATA_TYPE_NVLIST: + *(void **)val = (void *)nvpair; + return (0); + + case DATA_TYPE_NVLIST_ARRAY: + *(void **)val = (void *)nvpair; + if (nelmp) + *nelmp = nelm; + return (0); + } + } + + nvlist += encode_size; /* goto the next nvpair */ + } + + return (1); +} + +/* + * Check if this vdev is online and is in a good state. + */ +static int +vdev_validate(char *nv) +{ + uint64_t ival; + + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_OFFLINE, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_FAULTED, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_DEGRADED, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_REMOVED, &ival, + DATA_TYPE_UINT64, NULL) == 0) + return (ERR_DEV_VALUES); + + return (0); +} + +/* + * Get a list of valid vdev pathname from the boot device. + * The caller should already allocate MAXNAMELEN memory for bootpath. + */ +static int +vdev_get_bootpath(char *nv, char *bootpath) +{ + char type[16]; + + bootpath[0] = '\0'; + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_TYPE, &type, DATA_TYPE_STRING, + NULL)) + return (ERR_FSYS_CORRUPT); + + if (strcmp(type, VDEV_TYPE_DISK) == 0) { + if (vdev_validate(nv) != 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_PHYS_PATH, bootpath, + DATA_TYPE_STRING, NULL) != 0) + return (ERR_NO_BOOTPATH); + + } else if (strcmp(type, VDEV_TYPE_MIRROR) == 0) { + int nelm, i; + char *child; + + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_CHILDREN, &child, + DATA_TYPE_NVLIST_ARRAY, &nelm)) + return (ERR_FSYS_CORRUPT); + + for (i = 0; i < nelm; i++) { + char tmp_path[MAXNAMELEN]; + char *child_i; + + child_i = nvlist_array(child, i); + if (vdev_validate(child_i) != 0) + continue; + + if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_PHYS_PATH, + tmp_path, DATA_TYPE_STRING, NULL) != 0) + return (ERR_NO_BOOTPATH); + + if ((strlen(bootpath) + strlen(tmp_path)) > MAXNAMELEN) + return (ERR_WONT_FIT); + + if (strlen(bootpath) == 0) + sprintf(bootpath, "%s", tmp_path); + else + sprintf(bootpath, "%s %s", bootpath, tmp_path); + } + } + + return (strlen(bootpath) > 0 ? 0 : ERR_NO_BOOTPATH); +} + +/* + * Check the disk label information and retrieve needed vdev name-value pairs. + * + * Return: + * 0 - success + * ERR_* - failure + */ +static int +check_pool_label(fsi_file_t *ffi, int label, char *stack) +{ + vdev_phys_t *vdev; + uint64_t sector, pool_state, txg = 0; + char *nvlist, *nv; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + sector = (label * sizeof (vdev_label_t) + VDEV_SKIP_SIZE + + VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT; + + /* Read in the vdev name-value pair list (112K). */ + if (devread(ffi, sector, 0, VDEV_PHYS_SIZE, stack) == 0) + return (ERR_READ); + + vdev = (vdev_phys_t *)stack; + + if (nvlist_unpack(vdev->vp_nvlist, &nvlist)) + return (ERR_FSYS_CORRUPT); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_STATE, &pool_state, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + + if (pool_state == POOL_STATE_DESTROYED) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_NAME, + current_rootpool, DATA_TYPE_STRING, NULL)) + return (ERR_FSYS_CORRUPT); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_TXG, &txg, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + + /* not an active device */ + if (txg == 0) + return (ERR_NO_BOOTPATH); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_VDEV_TREE, &nv, + DATA_TYPE_NVLIST, NULL)) + return (ERR_FSYS_CORRUPT); + + if (vdev_get_bootpath(nv, current_bootpath)) + return (ERR_NO_BOOTPATH); + + return (0); +} + +/* + * zfs_mount() locates a valid uberblock of the root pool and read in its MOS + * to the memory address MOS. + * + * Return: + * 1 - success + * 0 - failure + */ +int +zfs_mount(fsi_file_t *ffi, const char *options) +{ + char *stack; + int label = 0; + uberblock_phys_t *ub_array, *ubbest = NULL; + objset_phys_t *osp; + zfs_bootarea_t *zfs_ba; + + /* if zfs is already mounted, don't do it again */ + if (is_zfs_mount == 1) + return (1); + + /* get much bigger data block for zfs */ + if (((zfs_ba = malloc(sizeof (zfs_bootarea_t))) == NULL)) { + return (1); + } + bzero(zfs_ba, sizeof (zfs_bootarea_t)); + + /* replace small data area in fsi with big one */ + free(ffi->ff_fsi->f_data); + ffi->ff_fsi->f_data = (void *)zfs_ba; + + /* If an boot filesystem is passed in, set it to current_bootfs */ + if (options != NULL) { + if (strlen(options) < MAXNAMELEN) { + strcpy(current_bootfs, options); + } + } + + stackbase = ZFS_SCRATCH; + stack = stackbase; + ub_array = (uberblock_phys_t *)stack; + stack += VDEV_UBERBLOCK_RING; + + osp = (objset_phys_t *)stack; + stack += sizeof (objset_phys_t); + + /* XXX add back labels support? */ + for (label = 0; ubbest == NULL && label < (VDEV_LABELS/2); label++) { + uint64_t sector = (label * sizeof (vdev_label_t) + + VDEV_SKIP_SIZE + VDEV_BOOT_HEADER_SIZE + + VDEV_PHYS_SIZE) >> SPA_MINBLOCKSHIFT; + + + /* Read in the uberblock ring (128K). */ + if (devread(ffi, sector, 0, VDEV_UBERBLOCK_RING, + (char *)ub_array) == 0) + continue; + + if ((ubbest = find_bestub(ffi, ub_array, label)) != NULL && + zio_read(ffi, &ubbest->ubp_uberblock.ub_rootbp, osp, stack) + == 0) { + + VERIFY_OS_TYPE(osp, DMU_OST_META); + + /* Got the MOS. Save it at the memory addr MOS. */ + grub_memmove(MOS, &osp->os_meta_dnode, DNODE_SIZE); + + if (check_pool_label(ffi, label, stack)) + return (0); + + /* + * Copy fsi->f_data to ffi->ff_data since + * fsig_mount copies from ff_data to f_data + * overwriting fsi->f_data. + */ + bcopy(zfs_ba, fsig_file_buf(ffi), FSYS_BUFLEN); + + is_zfs_mount = 1; + return (1); + } + } + + return (0); +} + +/* + * zfs_open() locates a file in the rootpool by following the + * MOS and places the dnode of the file in the memory address DNODE. + * + * Return: + * 1 - success + * 0 - failure + */ +int +zfs_open(fsi_file_t *ffi, char *filename) +{ + char *stack; + dnode_phys_t *mdn; + char *bootstring; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + file_buf = NULL; + stackbase = ZFS_SCRATCH; + stack = stackbase; + + mdn = (dnode_phys_t *)stack; + stack += sizeof (dnode_phys_t); + + dnode_mdn = NULL; + dnode_buf = (dnode_phys_t *)stack; + stack += 1<ff_fsi, + alloc_size); + if (bootstring != NULL) { + strcpy(bootstring, zfs_bootstr); + strcat(bootstring, current_rootpool); + strcat(bootstring, "/"); + strcat(bootstring, temp); + strcat(bootstring, zfs_bootpath); + strcat(bootstring, current_bootpath); + strcat(bootstring, "'"); + is_zfs_open = 1; + } + } + } + + if (dnode_get_path(ffi, mdn, filename, DNODE, stack)) { + errnum = ERR_FILE_NOT_FOUND; + return (0); + } + + /* get the file size and set the file position to 0 */ + filemax = ((znode_phys_t *)DN_BONUS(DNODE))->zp_size; + filepos = 0; + + dnode_buf = NULL; + return (1); +} + +/* + * zfs_read reads in the data blocks pointed by the DNODE. + * + * Return: + * len - the length successfully read in to the buffer + * 0 - failure + */ +int +zfs_read(fsi_file_t *ffi, char *buf, int len) +{ + char *stack; + int blksz, length, movesize; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + if (file_buf == NULL) { + file_buf = stackbase; + stackbase += SPA_MAXBLOCKSIZE; + file_start = file_end = 0; + } + stack = stackbase; + + /* + * If offset is in memory, move it into the buffer provided and return. + */ + if (filepos >= file_start && filepos+len <= file_end) { + grub_memmove(buf, file_buf + filepos - file_start, len); + filepos += len; + return (len); + } + + blksz = DNODE->dn_datablkszsec << SPA_MINBLOCKSHIFT; + + /* + * Entire Dnode is too big to fit into the space available. We + * will need to read it in chunks. This could be optimized to + * read in as large a chunk as there is space available, but for + * now, this only reads in one data block at a time. + */ + length = len; + while (length) { + /* + * Find requested blkid and the offset within that block. + */ + uint64_t blkid = filepos / blksz; + + if ((errnum = dmu_read(ffi, DNODE, blkid, file_buf, stack))) + return (0); + + file_start = blkid * blksz; + file_end = file_start + blksz; + + movesize = MIN(length, file_end - filepos); + + grub_memmove(buf, file_buf + filepos - file_start, + movesize); + buf += movesize; + length -= movesize; + filepos += movesize; + } + + return (len); +} + +/* + * No-Op + */ +int +zfs_embed(int *start_sector, int needed_sectors) +{ + return (1); +} + +fsi_plugin_ops_t * +fsi_init_plugin(int version, fsi_plugin_t *fp, const char **name) +{ + static fsig_plugin_ops_t ops = { + FSIMAGE_PLUGIN_VERSION, + .fpo_mount = zfs_mount, + .fpo_dir = zfs_open, + .fpo_read = zfs_read + }; + + *name = "zfs"; + return (fsig_init(fp, &ops)); +} diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/fsys_zfs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/fsys_zfs.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,203 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#ifndef _FSYS_ZFS_H +#define _FSYS_ZFS_H + +#include +#include + +#include "zfs-include/zfs.h" +#include "zfs-include/dmu.h" +#include "zfs-include/spa.h" +#include "zfs-include/zio.h" +#include "zfs-include/zio_checksum.h" +#include "zfs-include/vdev_impl.h" +#include "zfs-include/zap_impl.h" +#include "zfs-include/zap_leaf.h" +#include "zfs-include/uberblock_impl.h" +#include "zfs-include/dnode.h" +#include "zfs-include/dsl_dir.h" +#include "zfs-include/zfs_acl.h" +#include "zfs-include/zfs_znode.h" +#include "zfs-include/dsl_dataset.h" +#include "zfs-include/zil.h" +#include "zfs-include/dmu_objset.h" + +/* + * Global Memory addresses to store MOS and DNODE data + */ +#define MOS ((dnode_phys_t *)(((zfs_bootarea_t *) \ + (ffi->ff_fsi->f_data))->zfs_data)) +#define DNODE (MOS+1) /* move sizeof(dnode_phys_t) bytes */ +#define ZFS_SCRATCH ((char *)(DNODE+1)) + +#define MAXNAMELEN 256 + +typedef struct zfs_bootarea { + char zfs_current_bootpath[MAXNAMELEN]; + char zfs_current_rootpool[MAXNAMELEN]; + char zfs_current_bootfs[MAXNAMELEN]; + uint64_t zfs_current_bootfs_obj; + int zfs_open; + + /* cache for a file block of the currently zfs_open()-ed file */ + void *zfs_file_buf; + uint64_t zfs_file_start; + uint64_t zfs_file_end; + + /* cache for a dnode block */ + dnode_phys_t *zfs_dnode_buf; + dnode_phys_t *zfs_dnode_mdn; + uint64_t zfs_dnode_start; + uint64_t zfs_dnode_end; + + char *zfs_stackbase; + char zfs_data[0x400000]; +} zfs_bootarea_t; + +/* + * Verify dnode type. + * Can only be used in functions returning non-0 for failure. + */ +#define VERIFY_DN_TYPE(dnp, type) \ + if (type && (dnp)->dn_type != type) { \ + return (ERR_FSYS_CORRUPT); \ + } + +/* + * Verify object set type. + * Can only be used in functions returning 0 for failure. + */ +#define VERIFY_OS_TYPE(osp, type) \ + if (type && (osp)->os_type != type) { \ + errnum = ERR_FSYS_CORRUPT; \ + return (0); \ + } + +#define ZPOOL_PROP_BOOTFS "bootfs" + +/* General macros */ +#define BSWAP_8(x) ((x) & 0xff) +#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) +#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) +#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) +#define P2ROUNDUP(x, align) (-(-(x) & -(align))) + +/* + * XXX Match these macro up with real zfs once we have nvlist support so that we + * can support large sector disks. + */ +#define UBERBLOCK_SIZE (1ULL << UBERBLOCK_SHIFT) +#undef offsetof +#define offsetof(t, m) (size_t)(&(((t *)0)->m)) +#define VDEV_UBERBLOCK_SHIFT UBERBLOCK_SHIFT +#define VDEV_UBERBLOCK_OFFSET(n) \ +offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT]) + +typedef struct uberblock uberblock_t; + +/* XXX Uberblock_phys_t is no longer in the kernel zfs */ +typedef struct uberblock_phys { + uberblock_t ubp_uberblock; + char ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) - + sizeof (zio_block_tail_t)]; + zio_block_tail_t ubp_zbt; +} uberblock_phys_t; + +/* + * Macros to get fields in a bp or DVA. + */ +#define P2PHASE(x, align) ((x) & ((align) - 1)) +#define DVA_OFFSET_TO_PHYS_SECTOR(offset) \ + ((offset + VDEV_LABEL_START_SIZE) >> SPA_MINBLOCKSHIFT) + +/* + * For nvlist manipulation. (from nvpair.h) + */ +#define NV_ENCODE_NATIVE 0 +#define NV_ENCODE_XDR 1 +#define HOST_ENDIAN 1 /* for x86 machine */ +#define DATA_TYPE_UINT64 8 +#define DATA_TYPE_STRING 9 +#define DATA_TYPE_NVLIST 19 +#define DATA_TYPE_NVLIST_ARRAY 20 + +/* + * Decompression Entry - lzjb + */ +#ifndef NBBY +#define NBBY 8 +#endif + +typedef int zfs_decomp_func_t(void *s_start, void *d_start, size_t s_len, + size_t d_len); +typedef struct decomp_entry { + char *name; + zfs_decomp_func_t *decomp_func; +} decomp_entry_t; + +/* + * FAT ZAP data structures + */ +#define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ +#define ZAP_HASH_IDX(hash, n) (((n) == 0) ? 0 : ((hash) >> (64 - (n)))) +#define CHAIN_END 0xffff /* end of the chunk chain */ + +/* + * The amount of space within the chunk available for the array is: + * chunk size - space for type (1) - space for next pointer (2) + */ +#define ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3) + +#define ZAP_LEAF_HASH_SHIFT(bs) (bs - 5) +#define ZAP_LEAF_HASH_NUMENTRIES(bs) (1 << ZAP_LEAF_HASH_SHIFT(bs)) +#define LEAF_HASH(bs, h) \ + ((ZAP_LEAF_HASH_NUMENTRIES(bs)-1) & \ + ((h) >> (64 - ZAP_LEAF_HASH_SHIFT(bs)-l->l_hdr.lh_prefix_len))) + +/* + * The amount of space available for chunks is: + * block size shift - hash entry size (2) * number of hash + * entries - header space (2*chunksize) + */ +#define ZAP_LEAF_NUMCHUNKS(bs) \ + (((1<l_hash + ZAP_LEAF_HASH_NUMENTRIES(bs)))[idx] +#define ZAP_LEAF_ENTRY(l, bs, idx) (&ZAP_LEAF_CHUNK(l, bs, idx).l_entry) + +extern void fletcher_2_native(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_2_byteswap(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_4_native(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_4_byteswap(const void *, uint64_t, zio_cksum_t *); +extern void zio_checksum_SHA256(const void *, uint64_t, zio_cksum_t *); +extern int lzjb_decompress(void *, void *, size_t, size_t); + +#endif /* !_FSYS_ZFS_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/mb_info.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/mb_info.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,217 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2003 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * The structure type "mod_list" is used by the "multiboot_info" structure. + */ + +struct mod_list +{ + /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ + unsigned long mod_start; + unsigned long mod_end; + + /* Module command line */ + unsigned long cmdline; + + /* padding to take it to 16 bytes (must be zero) */ + unsigned long pad; +}; + + +/* + * INT-15, AX=E820 style "AddressRangeDescriptor" + * ...with a "size" parameter on the front which is the structure size - 4, + * pointing to the next one, up until the full buffer length of the memory + * map has been reached. + */ + +struct AddrRangeDesc +{ + unsigned long size; + unsigned long long BaseAddr; + unsigned long long Length; + unsigned long Type; + + /* unspecified optional padding... */ +} __attribute__ ((packed)); + +/* usable memory "Type", all others are reserved. */ +#define MB_ARD_MEMORY 1 + + +/* Drive Info structure. */ +struct drive_info +{ + /* The size of this structure. */ + unsigned long size; + + /* The BIOS drive number. */ + unsigned char drive_number; + + /* The access mode (see below). */ + unsigned char drive_mode; + + /* The BIOS geometry. */ + unsigned short drive_cylinders; + unsigned char drive_heads; + unsigned char drive_sectors; + + /* The array of I/O ports used for the drive. */ + unsigned short drive_ports[0]; +}; + +/* Drive Mode. */ +#define MB_DI_CHS_MODE 0 +#define MB_DI_LBA_MODE 1 + + +/* APM BIOS info. */ +struct apm_info +{ + unsigned short version; + unsigned short cseg; + unsigned long offset; + unsigned short cseg_16; + unsigned short dseg_16; + unsigned short cseg_len; + unsigned short cseg_16_len; + unsigned short dseg_16_len; +}; + + +/* + * MultiBoot Info description + * + * This is the struct passed to the boot image. This is done by placing + * its address in the EAX register. + */ + +struct multiboot_info +{ + /* MultiBoot info version number */ + unsigned long flags; + + /* Available memory from BIOS */ + unsigned long mem_lower; + unsigned long mem_upper; + + /* "root" partition */ + unsigned long boot_device; + + /* Kernel command line */ + unsigned long cmdline; + + /* Boot-Module list */ + unsigned long mods_count; + unsigned long mods_addr; + + union + { + struct + { + /* (a.out) Kernel symbol table info */ + unsigned long tabsize; + unsigned long strsize; + unsigned long addr; + unsigned long pad; + } + a; + + struct + { + /* (ELF) Kernel section header table */ + unsigned long num; + unsigned long size; + unsigned long addr; + unsigned long shndx; + } + e; + } + syms; + + /* Memory Mapping buffer */ + unsigned long mmap_length; + unsigned long mmap_addr; + + /* Drive Info buffer */ + unsigned long drives_length; + unsigned long drives_addr; + + /* ROM configuration table */ + unsigned long config_table; + + /* Boot Loader Name */ + unsigned long boot_loader_name; + + /* APM table */ + unsigned long apm_table; + + /* Video */ + unsigned long vbe_control_info; + unsigned long vbe_mode_info; + unsigned short vbe_mode; + unsigned short vbe_interface_seg; + unsigned short vbe_interface_off; + unsigned short vbe_interface_len; +}; + +/* + * Flags to be set in the 'flags' parameter above + */ + +/* is there basic lower/upper memory information? */ +#define MB_INFO_MEMORY 0x00000001 +/* is there a boot device set? */ +#define MB_INFO_BOOTDEV 0x00000002 +/* is the command-line defined? */ +#define MB_INFO_CMDLINE 0x00000004 +/* are there modules to do something with? */ +#define MB_INFO_MODS 0x00000008 + +/* These next two are mutually exclusive */ + +/* is there a symbol table loaded? */ +#define MB_INFO_AOUT_SYMS 0x00000010 +/* is there an ELF section header table? */ +#define MB_INFO_ELF_SHDR 0x00000020 + +/* is there a full memory map? */ +#define MB_INFO_MEM_MAP 0x00000040 + +/* Is there drive info? */ +#define MB_INFO_DRIVE_INFO 0x00000080 + +/* Is there a config table? */ +#define MB_INFO_CONFIG_TABLE 0x00000100 + +/* Is there a boot loader name? */ +#define MB_INFO_BOOT_LOADER_NAME 0x00000200 + +/* Is there a APM table? */ +#define MB_INFO_APM_TABLE 0x00000400 + +/* Is there video information? */ +#define MB_INFO_VIDEO_INFO 0x00000800 + +/* + * The following value must be present in the EAX register. + */ + +#define MULTIBOOT_VALID 0x2BADB002 diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/dmu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dmu.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,105 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DMU_H +#define _SYS_DMU_H + +/* + * This file describes the interface that the DMU provides for its + * consumers. + * + * The DMU also interacts with the SPA. That interface is described in + * dmu_spa.h. + */ +typedef enum dmu_object_type { + DMU_OT_NONE, + /* general: */ + DMU_OT_OBJECT_DIRECTORY, /* ZAP */ + DMU_OT_OBJECT_ARRAY, /* UINT64 */ + DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */ + DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */ + DMU_OT_BPLIST, /* UINT64 */ + DMU_OT_BPLIST_HDR, /* UINT64 */ + /* spa: */ + DMU_OT_SPACE_MAP_HEADER, /* UINT64 */ + DMU_OT_SPACE_MAP, /* UINT64 */ + /* zil: */ + DMU_OT_INTENT_LOG, /* UINT64 */ + /* dmu: */ + DMU_OT_DNODE, /* DNODE */ + DMU_OT_OBJSET, /* OBJSET */ + /* dsl: */ + DMU_OT_DSL_DIR, /* UINT64 */ + DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */ + DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */ + DMU_OT_DSL_PROPS, /* ZAP */ + DMU_OT_DSL_DATASET, /* UINT64 */ + /* zpl: */ + DMU_OT_ZNODE, /* ZNODE */ + DMU_OT_ACL, /* ACL */ + DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */ + DMU_OT_DIRECTORY_CONTENTS, /* ZAP */ + DMU_OT_MASTER_NODE, /* ZAP */ + DMU_OT_UNLINKED_SET, /* ZAP */ + /* zvol: */ + DMU_OT_ZVOL, /* UINT8 */ + DMU_OT_ZVOL_PROP, /* ZAP */ + /* other; for testing only! */ + DMU_OT_PLAIN_OTHER, /* UINT8 */ + DMU_OT_UINT64_OTHER, /* UINT64 */ + DMU_OT_ZAP_OTHER, /* ZAP */ + /* new object types: */ + DMU_OT_ERROR_LOG, /* ZAP */ + DMU_OT_SPA_HISTORY, /* UINT8 */ + DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */ + DMU_OT_POOL_PROPS, /* ZAP */ + + DMU_OT_NUMTYPES +} dmu_object_type_t; + +typedef enum dmu_objset_type { + DMU_OST_NONE, + DMU_OST_META, + DMU_OST_ZFS, + DMU_OST_ZVOL, + DMU_OST_OTHER, /* For testing only! */ + DMU_OST_ANY, /* Be careful! */ + DMU_OST_NUMTYPES +} dmu_objset_type_t; + +/* + * The names of zap entries in the DIRECTORY_OBJECT of the MOS. + */ +#define DMU_POOL_DIRECTORY_OBJECT 1 +#define DMU_POOL_CONFIG "config" +#define DMU_POOL_ROOT_DATASET "root_dataset" +#define DMU_POOL_SYNC_BPLIST "sync_bplist" +#define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" +#define DMU_POOL_ERRLOG_LAST "errlog_last" +#define DMU_POOL_SPARES "spares" +#define DMU_POOL_DEFLATE "deflate" +#define DMU_POOL_HISTORY "history" +#define DMU_POOL_PROPS "pool_props" +#define DMU_POOL_L2CACHE "l2cache" + +#endif /* _SYS_DMU_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/dmu_objset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dmu_objset.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,35 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DMU_OBJSET_H +#define _SYS_DMU_OBJSET_H + +typedef struct objset_phys { + dnode_phys_t os_meta_dnode; + zil_header_t os_zil_header; + uint64_t os_type; + char os_pad[1024 - sizeof (dnode_phys_t) - sizeof (zil_header_t) - + sizeof (uint64_t)]; +} objset_phys_t; + +#endif /* _SYS_DMU_OBJSET_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/dnode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dnode.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,76 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DNODE_H +#define _SYS_DNODE_H + +/* + * Fixed constants. + */ +#define DNODE_SHIFT 9 /* 512 bytes */ +#define DN_MIN_INDBLKSHIFT 10 /* 1k */ +#define DN_MAX_INDBLKSHIFT 14 /* 16k */ +#define DNODE_BLOCK_SHIFT 14 /* 16k */ +#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ +#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */ +#define DN_MAX_OFFSET_SHIFT 64 /* 2^64 bytes in a dnode */ + +/* + * Derived constants. + */ +#define DNODE_SIZE (1 << DNODE_SHIFT) +#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT) +#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT)) +#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT) + +#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT) +#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT) +#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT) + +#define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \ + (((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t)))) + +typedef struct dnode_phys { + uint8_t dn_type; /* dmu_object_type_t */ + uint8_t dn_indblkshift; /* ln2(indirect block size) */ + uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */ + uint8_t dn_nblkptr; /* length of dn_blkptr */ + uint8_t dn_bonustype; /* type of data in bonus buffer */ + uint8_t dn_checksum; /* ZIO_CHECKSUM type */ + uint8_t dn_compress; /* ZIO_COMPRESS type */ + uint8_t dn_flags; /* DNODE_FLAG_* */ + uint16_t dn_datablkszsec; /* data block size in 512b sectors */ + uint16_t dn_bonuslen; /* length of dn_bonus */ + uint8_t dn_pad2[4]; + + /* accounting is protected by dn_dirty_mtx */ + uint64_t dn_maxblkid; /* largest allocated block ID */ + uint64_t dn_used; /* bytes (or sectors) of disk space */ + + uint64_t dn_pad3[4]; + + blkptr_t dn_blkptr[1]; + uint8_t dn_bonus[DN_MAX_BONUSLEN]; +} dnode_phys_t; + +#endif /* _SYS_DNODE_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/dsl_dataset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dsl_dataset.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,53 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DSL_DATASET_H +#define _SYS_DSL_DATASET_H + +typedef struct dsl_dataset_phys { + uint64_t ds_dir_obj; + uint64_t ds_prev_snap_obj; + uint64_t ds_prev_snap_txg; + uint64_t ds_next_snap_obj; + uint64_t ds_snapnames_zapobj; /* zap obj of snaps; ==0 for snaps */ + uint64_t ds_num_children; /* clone/snap children; ==0 for head */ + uint64_t ds_creation_time; /* seconds since 1970 */ + uint64_t ds_creation_txg; + uint64_t ds_deadlist_obj; + uint64_t ds_used_bytes; + uint64_t ds_compressed_bytes; + uint64_t ds_uncompressed_bytes; + uint64_t ds_unique_bytes; /* only relevant to snapshots */ + /* + * The ds_fsid_guid is a 56-bit ID that can change to avoid + * collisions. The ds_guid is a 64-bit ID that will never + * change, so there is a small probability that it will collide. + */ + uint64_t ds_fsid_guid; + uint64_t ds_guid; + uint64_t ds_flags; + blkptr_t ds_bp; + uint64_t ds_pad[8]; /* pad out to 320 bytes for good measure */ +} dsl_dataset_phys_t; + +#endif /* _SYS_DSL_DATASET_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/dsl_dir.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dsl_dir.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,49 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DSL_DIR_H +#define _SYS_DSL_DIR_H + +typedef struct dsl_dir_phys { + uint64_t dd_creation_time; /* not actually used */ + uint64_t dd_head_dataset_obj; + uint64_t dd_parent_obj; + uint64_t dd_clone_parent_obj; + uint64_t dd_child_dir_zapobj; + /* + * how much space our children are accounting for; for leaf + * datasets, == physical space used by fs + snaps + */ + uint64_t dd_used_bytes; + uint64_t dd_compressed_bytes; + uint64_t dd_uncompressed_bytes; + /* Administrative quota setting */ + uint64_t dd_quota; + /* Administrative reservation setting */ + uint64_t dd_reserved; + uint64_t dd_props_zapobj; + uint64_t dd_deleg_zapobj; /* dataset permissions */ + uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */ +} dsl_dir_phys_t; + +#endif /* _SYS_DSL_DIR_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/spa.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/spa.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,283 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_SPA_H +#define _SYS_SPA_H + +/* + * General-purpose 32-bit and 64-bit bitfield encodings. + */ +#define BF32_DECODE(x, low, len) P2PHASE((x) >> (low), 1U << (len)) +#define BF64_DECODE(x, low, len) P2PHASE((x) >> (low), 1ULL << (len)) +#define BF32_ENCODE(x, low, len) (P2PHASE((x), 1U << (len)) << (low)) +#define BF64_ENCODE(x, low, len) (P2PHASE((x), 1ULL << (len)) << (low)) + +#define BF32_GET(x, low, len) BF32_DECODE(x, low, len) +#define BF64_GET(x, low, len) BF64_DECODE(x, low, len) + +#define BF32_SET(x, low, len, val) \ + ((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len)) +#define BF64_SET(x, low, len, val) \ + ((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len)) + +#define BF32_GET_SB(x, low, len, shift, bias) \ + ((BF32_GET(x, low, len) + (bias)) << (shift)) +#define BF64_GET_SB(x, low, len, shift, bias) \ + ((BF64_GET(x, low, len) + (bias)) << (shift)) + +#define BF32_SET_SB(x, low, len, shift, bias, val) \ + BF32_SET(x, low, len, ((val) >> (shift)) - (bias)) +#define BF64_SET_SB(x, low, len, shift, bias, val) \ + BF64_SET(x, low, len, ((val) >> (shift)) - (bias)) + +/* + * We currently support nine block sizes, from 512 bytes to 128K. + * We could go higher, but the benefits are near-zero and the cost + * of COWing a giant block to modify one byte would become excessive. + */ +#define SPA_MINBLOCKSHIFT 9 +#define SPA_MAXBLOCKSHIFT 17 +#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT) +#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT) + +#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1) + +/* + * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB. + * The ASIZE encoding should be at least 64 times larger (6 more bits) + * to support up to 4-way RAID-Z mirror mode with worst-case gang block + * overhead, three DVAs per bp, plus one more bit in case we do anything + * else that expands the ASIZE. + */ +#define SPA_LSIZEBITS 16 /* LSIZE up to 32M (2^16 * 512) */ +#define SPA_PSIZEBITS 16 /* PSIZE up to 32M (2^16 * 512) */ +#define SPA_ASIZEBITS 24 /* ASIZE up to 64 times larger */ + +/* + * All SPA data is represented by 128-bit data virtual addresses (DVAs). + * The members of the dva_t should be considered opaque outside the SPA. + */ +typedef struct dva { + uint64_t dva_word[2]; +} dva_t; + +/* + * Each block has a 256-bit checksum -- strong enough for cryptographic hashes. + */ +typedef struct zio_cksum { + uint64_t zc_word[4]; +} zio_cksum_t; + +/* + * Each block is described by its DVAs, time of birth, checksum, etc. + * The word-by-word, bit-by-bit layout of the blkptr is as follows: + * + * 64 56 48 40 32 24 16 8 0 + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 0 | vdev1 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 1 |G| offset1 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 2 | vdev2 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 3 |G| offset2 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 4 | vdev3 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 5 |G| offset3 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 6 |E| lvl | type | cksum | comp | PSIZE | LSIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 7 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 8 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 9 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * a | birth txg | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * b | fill count | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * c | checksum[0] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * d | checksum[1] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * e | checksum[2] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * f | checksum[3] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * Legend: + * + * vdev virtual device ID + * offset offset into virtual device + * LSIZE logical size + * PSIZE physical size (after compression) + * ASIZE allocated size (including RAID-Z parity and gang block headers) + * GRID RAID-Z layout information (reserved for future use) + * cksum checksum function + * comp compression function + * G gang block indicator + * E endianness + * type DMU object type + * lvl level of indirection + * birth txg transaction group in which the block was born + * fill count number of non-zero blocks under this bp + * checksum[4] 256-bit checksum of the data this bp describes + */ +typedef struct blkptr { + dva_t blk_dva[3]; /* 128-bit Data Virtual Address */ + uint64_t blk_prop; /* size, compression, type, etc */ + uint64_t blk_pad[3]; /* Extra space for the future */ + uint64_t blk_birth; /* transaction group at birth */ + uint64_t blk_fill; /* fill count */ + zio_cksum_t blk_cksum; /* 256-bit checksum */ +} blkptr_t; + +#define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */ +#define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */ + +/* + * Macros to get and set fields in a bp or DVA. + */ +#define DVA_GET_ASIZE(dva) \ + BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0) +#define DVA_SET_ASIZE(dva, x) \ + BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x) + +#define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8) +#define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x) + +#define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, 32) +#define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, 32, x) + +#define DVA_GET_OFFSET(dva) \ + BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0) +#define DVA_SET_OFFSET(dva, x) \ + BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x) + +#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1) +#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x) + +#define BP_GET_LSIZE(bp) \ + (BP_IS_HOLE(bp) ? 0 : \ + BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)) +#define BP_SET_LSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) + +#define BP_GET_PSIZE(bp) \ + BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1) +#define BP_SET_PSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x) + +#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) +#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) + +#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) +#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) + +#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) +#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) + +#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) +#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) + +#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1)) +#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) + +#define BP_GET_ASIZE(bp) \ + (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + DVA_GET_ASIZE(&(bp)->blk_dva[2])) + +#define BP_GET_UCSIZE(bp) \ + ((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) ? \ + BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp)); + +#define BP_GET_NDVAS(bp) \ + (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[2])) + +#define BP_COUNT_GANG(bp) \ + (DVA_GET_GANG(&(bp)->blk_dva[0]) + \ + DVA_GET_GANG(&(bp)->blk_dva[1]) + \ + DVA_GET_GANG(&(bp)->blk_dva[2])) + +#define DVA_EQUAL(dva1, dva2) \ + ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \ + (dva1)->dva_word[0] == (dva2)->dva_word[0]) + +#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \ + (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \ + ((zc1).zc_word[1] - (zc2).zc_word[1]) | \ + ((zc1).zc_word[2] - (zc2).zc_word[2]) | \ + ((zc1).zc_word[3] - (zc2).zc_word[3]))) + + +#define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0) + +#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \ +{ \ + (zcp)->zc_word[0] = w0; \ + (zcp)->zc_word[1] = w1; \ + (zcp)->zc_word[2] = w2; \ + (zcp)->zc_word[3] = w3; \ +} + +#define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) +#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) +#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) +#define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg)) + +#define BP_ZERO(bp) \ +{ \ + (bp)->blk_dva[0].dva_word[0] = 0; \ + (bp)->blk_dva[0].dva_word[1] = 0; \ + (bp)->blk_dva[1].dva_word[0] = 0; \ + (bp)->blk_dva[1].dva_word[1] = 0; \ + (bp)->blk_dva[2].dva_word[0] = 0; \ + (bp)->blk_dva[2].dva_word[1] = 0; \ + (bp)->blk_prop = 0; \ + (bp)->blk_pad[0] = 0; \ + (bp)->blk_pad[1] = 0; \ + (bp)->blk_pad[2] = 0; \ + (bp)->blk_birth = 0; \ + (bp)->blk_fill = 0; \ + ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ +} + +/* + * Note: the byteorder is either 0 or -1, both of which are palindromes. + * This simplifies the endianness handling a bit. + */ +#ifdef _BIG_ENDIAN +#define ZFS_HOST_BYTEORDER (0ULL) +#else +#define ZFS_HOST_BYTEORDER (-1ULL) +#endif + +#define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) + +#define BP_SPRINTF_LEN 320 + +#endif /* _SYS_SPA_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/uberblock_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/uberblock_impl.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,49 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_UBERBLOCK_IMPL_H +#define _SYS_UBERBLOCK_IMPL_H + +/* + * The uberblock version is incremented whenever an incompatible on-disk + * format change is made to the SPA, DMU, or ZAP. + * + * Note: the first two fields should never be moved. When a storage pool + * is opened, the uberblock must be read off the disk before the version + * can be checked. If the ub_version field is moved, we may not detect + * version mismatch. If the ub_magic field is moved, applications that + * expect the magic number in the first word won't work. + */ +#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ +#define UBERBLOCK_SHIFT 10 /* up to 1K */ + +struct uberblock { + uint64_t ub_magic; /* UBERBLOCK_MAGIC */ + uint64_t ub_version; /* ZFS_VERSION */ + uint64_t ub_txg; /* txg of last sync */ + uint64_t ub_guid_sum; /* sum of all vdev guids */ + uint64_t ub_timestamp; /* UTC time of last sync */ + blkptr_t ub_rootbp; /* MOS objset_phys_t */ +}; + +#endif /* _SYS_UBERBLOCK_IMPL_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/vdev_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/vdev_impl.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,70 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_VDEV_IMPL_H +#define _SYS_VDEV_IMPL_H + +#define VDEV_SKIP_SIZE (8 << 10) +#define VDEV_BOOT_HEADER_SIZE (8 << 10) +#define VDEV_PHYS_SIZE (112 << 10) +#define VDEV_UBERBLOCK_RING (128 << 10) + +/* ZFS boot block */ +#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL +#define VDEV_BOOT_VERSION 1 /* version number */ + +typedef struct vdev_boot_header { + uint64_t vb_magic; /* VDEV_BOOT_MAGIC */ + uint64_t vb_version; /* VDEV_BOOT_VERSION */ + uint64_t vb_offset; /* start offset (bytes) */ + uint64_t vb_size; /* size (bytes) */ + char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)]; +} vdev_boot_header_t; + +typedef struct vdev_phys { + char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)]; + zio_block_tail_t vp_zbt; +} vdev_phys_t; + +typedef struct vdev_label { + char vl_pad[VDEV_SKIP_SIZE]; /* 8K */ + vdev_boot_header_t vl_boot_header; /* 8K */ + vdev_phys_t vl_vdev_phys; /* 112K */ + char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */ +} vdev_label_t; /* 256K total */ + +/* + * Size and offset of embedded boot loader region on each label. + * The total size of the first two labels plus the boot area is 4MB. + */ +#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t)) +#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */ + +/* + * Size of label regions at the start and end of each leaf device. + */ +#define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE) +#define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t)) +#define VDEV_LABELS 4 + +#endif /* _SYS_VDEV_IMPL_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/zap_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zap_impl.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,110 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZAP_IMPL_H +#define _SYS_ZAP_IMPL_H + +#define ZAP_MAGIC 0x2F52AB2ABULL + +#define ZAP_HASHBITS 28 +#define MZAP_ENT_LEN 64 +#define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2) +#define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT +#define MZAP_MAX_BLKSZ (1 << MZAP_MAX_BLKSHIFT) + +typedef struct mzap_ent_phys { + uint64_t mze_value; + uint32_t mze_cd; + uint16_t mze_pad; /* in case we want to chain them someday */ + char mze_name[MZAP_NAME_LEN]; +} mzap_ent_phys_t; + +typedef struct mzap_phys { + uint64_t mz_block_type; /* ZBT_MICRO */ + uint64_t mz_salt; + uint64_t mz_pad[6]; + mzap_ent_phys_t mz_chunk[1]; + /* actually variable size depending on block size */ +} mzap_phys_t; + +/* + * The (fat) zap is stored in one object. It is an array of + * 1<= 6] [zap_leaf_t] [ptrtbl] ... + * + */ + +#define ZBT_LEAF ((1ULL << 63) + 0) +#define ZBT_HEADER ((1ULL << 63) + 1) +#define ZBT_MICRO ((1ULL << 63) + 3) +/* any other values are ptrtbl blocks */ + +/* + * the embedded pointer table takes up half a block: + * block size / entry size (2^3) / 2 + */ +#define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1) + +/* + * The embedded pointer table starts half-way through the block. Since + * the pointer table itself is half the block, it starts at (64-bit) + * word number (1<zap_f.zap_phys) \ + [(idx) + (1<| + * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->| + * |<---- znode (264) ---->|<---- data (56) ---->| + * + * At present, we only use this space to store symbolic links. + */ +} znode_phys_t; + +#endif /* _SYS_FS_ZFS_ZNODE_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/zil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zil.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,51 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZIL_H +#define _SYS_ZIL_H + +/* + * Intent log format: + * + * Each objset has its own intent log. The log header (zil_header_t) + * for objset N's intent log is kept in the Nth object of the SPA's + * intent_log objset. The log header points to a chain of log blocks, + * each of which contains log records (i.e., transactions) followed by + * a log block trailer (zil_trailer_t). The format of a log record + * depends on the record (or transaction) type, but all records begin + * with a common structure that defines the type, length, and txg. + */ + +/* + * Intent log header - this on disk structure holds fields to manage + * the log. All fields are 64 bit to easily handle cross architectures. + */ +typedef struct zil_header { + uint64_t zh_claim_txg; /* txg in which log blocks were claimed */ + uint64_t zh_replay_seq; /* highest replayed sequence number */ + blkptr_t zh_log; /* log chain */ + uint64_t zh_claim_seq; /* highest claimed sequence number */ + uint64_t zh_pad[5]; +} zil_header_t; + +#endif /* _SYS_ZIL_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/zio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zio.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,81 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ZIO_H +#define _ZIO_H + +#define ZBT_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */ + +typedef struct zio_block_tail { + uint64_t zbt_magic; /* for validation, endianness */ + zio_cksum_t zbt_cksum; /* 256-bit checksum */ +} zio_block_tail_t; + +/* + * Gang block headers are self-checksumming and contain an array + * of block pointers. + */ +#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE +#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \ + sizeof (zio_block_tail_t)) / sizeof (blkptr_t)) +#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \ + sizeof (zio_block_tail_t) - \ + (SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\ + sizeof (uint64_t)) + +#define ZIO_GET_IOSIZE(zio) \ + (BP_IS_GANG((zio)->io_bp) ? \ + SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp)) + +typedef struct zio_gbh { + blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS]; + uint64_t zg_filler[SPA_GBH_FILLER]; + zio_block_tail_t zg_tail; +} zio_gbh_phys_t; + +enum zio_checksum { + ZIO_CHECKSUM_INHERIT = 0, + ZIO_CHECKSUM_ON, + ZIO_CHECKSUM_OFF, + ZIO_CHECKSUM_LABEL, + ZIO_CHECKSUM_GANG_HEADER, + ZIO_CHECKSUM_ZILOG, + ZIO_CHECKSUM_FLETCHER_2, + ZIO_CHECKSUM_FLETCHER_4, + ZIO_CHECKSUM_SHA256, + ZIO_CHECKSUM_FUNCTIONS +}; + +#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2 +#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON + +enum zio_compress { + ZIO_COMPRESS_INHERIT = 0, + ZIO_COMPRESS_ON, + ZIO_COMPRESS_OFF, + ZIO_COMPRESS_LZJB, + ZIO_COMPRESS_EMPTY, + ZIO_COMPRESS_FUNCTIONS +}; + +#endif /* _ZIO_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs-include/zio_checksum.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zio_checksum.h Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,42 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZIO_CHECKSUM_H +#define _SYS_ZIO_CHECKSUM_H + +/* + * Signature for checksum functions. + */ +typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp); + +/* + * Information about each checksum function. + */ +typedef struct zio_checksum_info { + zio_checksum_t *ci_func[2]; /* checksum function for each byteorder */ + int ci_correctable; /* number of correctable bits */ + int ci_zbt; /* uses zio block tail? */ + char *ci_name; /* descriptive name */ +} zio_checksum_info_t; + +#endif /* _SYS_ZIO_CHECKSUM_H */ diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs_fletcher.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_fletcher.c Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,93 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + + +void +fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint64_t *ip = buf; + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); + uint64_t a0, b0, a1, b1; + + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 += ip[0]; + a1 += ip[1]; + b0 += a0; + b1 += a1; + } + + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); +} + +void +fletcher_2_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint64_t *ip = buf; + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); + uint64_t a0, b0, a1, b1; + + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 += BSWAP_64(ip[0]); + a1 += BSWAP_64(ip[1]); + b0 += a0; + b1 += a1; + } + + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); +} + +void +fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint32_t *ip = buf; + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); + uint64_t a, b, c, d; + + for (a = b = c = d = 0; ip < ipend; ip++) { + a += ip[0]; + b += a; + c += b; + d += c; + } + + ZIO_SET_CHECKSUM(zcp, a, b, c, d); +} + +void +fletcher_4_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint32_t *ip = buf; + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); + uint64_t a, b, c, d; + + for (a = b = c = d = 0; ip < ipend; ip++) { + a += BSWAP_32(ip[0]); + b += a; + c += b; + d += c; + } + + ZIO_SET_CHECKSUM(zcp, a, b, c, d); +} diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs_lzjb.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_lzjb.c Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,60 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + +#define MATCH_BITS 6 +#define MATCH_MIN 3 +#define OFFSET_MASK ((1 << (16 - MATCH_BITS)) - 1) + + +/*ARGSUSED*/ +int +lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len) +{ + unsigned char *src = s_start; + unsigned char *dst = d_start; + unsigned char *d_end = (unsigned char *)d_start + d_len; + unsigned char *cpy; + unsigned char copymap = '\0'; + int copymask = 1 << (NBBY - 1); + + while (dst < d_end) { + if ((copymask <<= 1) == (1 << NBBY)) { + copymask = 1; + copymap = *src++; + } + if (copymap & (unsigned char)copymask) { + int mlen = (src[0] >> (NBBY - MATCH_BITS)) + MATCH_MIN; + int offset = ((src[0] << NBBY) | src[1]) & OFFSET_MASK; + src += 2; + if ((cpy = dst - offset) < (unsigned char *)d_start) + return (-1); + while (--mlen >= 0 && dst < d_end) + *dst++ = *cpy++; + } else { + *dst++ = *src++; + } + } + return (0); +} diff -r 8ccaf43782bd -r 64f790e90d3d tools/libfsimage/zfs/zfs_sha256.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_sha256.c Thu May 01 16:38:56 2008 +0100 @@ -0,0 +1,124 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + +/* + * SHA-256 checksum, as specified in FIPS 180-2, available at: + * http://csrc.nist.gov/cryptval + * + * This is a very compact implementation of SHA-256. + * It is designed to be simple and portable, not to be fast. + */ + +/* + * The literal definitions according to FIPS180-2 would be: + * + * Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) + * Maj(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) + * + * We use logical equivalents which require one less op. + */ +#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y)))) +#define Rot32(x, s) (((x) >> s) | ((x) << (32 - s))) +#define SIGMA0(x) (Rot32(x, 2) ^ Rot32(x, 13) ^ Rot32(x, 22)) +#define SIGMA1(x) (Rot32(x, 6) ^ Rot32(x, 11) ^ Rot32(x, 25)) +#define sigma0(x) (Rot32(x, 7) ^ Rot32(x, 18) ^ ((x) >> 3)) +#define sigma1(x) (Rot32(x, 17) ^ Rot32(x, 19) ^ ((x) >> 10)) + +static const uint32_t SHA256_K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static void +SHA256Transform(uint32_t *H, const uint8_t *cp) +{ + uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64]; + + for (t = 0; t < 16; t++, cp += 4) + W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | cp[3]; + + for (t = 16; t < 64; t++) + W[t] = sigma1(W[t - 2]) + W[t - 7] + + sigma0(W[t - 15]) + W[t - 16]; + + a = H[0]; b = H[1]; c = H[2]; d = H[3]; + e = H[4]; f = H[5]; g = H[6]; h = H[7]; + + for (t = 0; t < 64; t++) { + T1 = h + SIGMA1(e) + Ch(e, f, g) + SHA256_K[t] + W[t]; + T2 = SIGMA0(a) + Maj(a, b, c); + h = g; g = f; f = e; e = d + T1; + d = c; c = b; b = a; a = T1 + T2; + } + + H[0] += a; H[1] += b; H[2] += c; H[3] += d; + H[4] += e; H[5] += f; H[6] += g; H[7] += h; +} + +void +zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; + uint8_t pad[128]; + int padsize = size & 63; + int i; + + for (i = 0; i < size - padsize; i += 64) + SHA256Transform(H, (uint8_t *)buf + i); + + for (i = 0; i < padsize; i++) + pad[i] = ((uint8_t *)buf)[i]; + + for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) + pad[padsize] = 0; + + for (i = 0; i < 8; i++) + pad[padsize++] = (size << 3) >> (56 - 8 * i); + + for (i = 0; i < padsize; i += 64) + SHA256Transform(H, pad + i); + + ZIO_SET_CHECKSUM(zcp, + (uint64_t)H[0] << 32 | H[1], + (uint64_t)H[2] << 32 | H[3], + (uint64_t)H[4] << 32 | H[5], + (uint64_t)H[6] << 32 | H[7]); +} diff -r 8ccaf43782bd -r 64f790e90d3d tools/pygrub/src/fsimage/fsimage.c --- a/tools/pygrub/src/fsimage/fsimage.c Thu May 01 16:37:46 2008 +0100 +++ b/tools/pygrub/src/fsimage/fsimage.c Thu May 01 16:38:56 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -281,6 +281,22 @@ fsimage_open(PyObject *o, PyObject *args return (PyObject *)fs; } +static PyObject * +fsimage_getbootstring(PyObject *o, PyObject *args) +{ + PyObject *fs; + char *bootstring; + fsi_t *fsi; + + if (!PyArg_ParseTuple(args, "O", &fs)) + return (NULL); + + fsi = ((fsimage_fs_t *)fs)->fs; + bootstring = fsi_fs_bootstring(fsi); + + return Py_BuildValue("s", bootstring); +} + PyDoc_STRVAR(fsimage_open__doc__, "open(name, [offset=off]) - Open the given file as a filesystem image.\n" "\n" @@ -288,9 +304,15 @@ PyDoc_STRVAR(fsimage_open__doc__, "offset - offset of file system within file image.\n" "options - mount options string.\n"); +PyDoc_STRVAR(fsimage_getbootstring__doc__, + "getbootstring(fs) - Return the boot string needed for this file system " + "or NULL if none is needed.\n"); + static struct PyMethodDef fsimage_module_methods[] = { { "open", (PyCFunction)fsimage_open, METH_VARARGS|METH_KEYWORDS, fsimage_open__doc__ }, + { "getbootstring", (PyCFunction)fsimage_getbootstring, + METH_VARARGS, fsimage_getbootstring__doc__ }, { NULL, NULL, 0, NULL } }; diff -r 8ccaf43782bd -r 64f790e90d3d tools/pygrub/src/pygrub --- a/tools/pygrub/src/pygrub Thu May 01 16:37:46 2008 +0100 +++ b/tools/pygrub/src/pygrub Thu May 01 16:38:56 2008 +0100 @@ -646,7 +646,13 @@ if __name__ == "__main__": print " args: %s" % chosencfg["args"] sys.exit(0) - fs = fsimage.open(file, get_fs_offset(file)) + # if boot filesystem is set then pass to fsimage.open + bootfsargs = '"%s"' % incfg["args"] + bootfsgroup = re.findall('zfs-bootfs=(.*?)[\s\,\"]', bootfsargs) + if bootfsgroup: + fs = fsimage.open(file, get_fs_offset(file), bootfsgroup[0]) + else: + fs = fsimage.open(file, get_fs_offset(file)) chosencfg = sniff_solaris(fs, incfg) @@ -672,7 +678,15 @@ if __name__ == "__main__": if bootcfg["ramdisk"]: sxp += "(ramdisk %s)" % bootcfg["ramdisk"] if chosencfg["args"]: - sxp += "(args \"%s\")" % chosencfg["args"] + zfsinfo = fsimage.getbootstring(fs) + if zfsinfo is None: + sxp += "(args \"%s\")" % chosencfg["args"] + else: + e = re.compile("zfs-bootfs=[\w\-\.\:@/]+" ) + (chosencfg["args"],count) = e.subn(zfsinfo, chosencfg["args"]) + if count == 0: + chosencfg["args"] += " -B %s" % zfsinfo + sxp += "(args \"%s\")" % (chosencfg["args"]) sys.stdout.flush() os.write(fd, sxp) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 01 09:04:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 01 May 2008 09:04:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrbGa-0005Vi-4H for www-data@colo.xensource.com; Thu, 01 May 2008 09:04:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrbH6-0007EG-ON; Thu, 01 May 2008 16:04:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrb43-0006Mg-LO for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:51:19 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrb3g-0004bd-Hz for xen-changelog@lists.xensource.com; Thu, 01 May 2008 15:51:17 +0000 X-SBRS: 3.6 X-MesageID: 109221 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,422,1204520400"; d="scan'208";a="109221" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 01 May 2008 11:49:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m41FnsxG011680 for ; Thu, 1 May 2008 08:49:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m41FoCxj002669 for ; Thu, 1 May 2008 08:50:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m41FoC6A002668 for xen-changelog@lists.xensource.com; Thu, 1 May 2008 08:50:12 -0700 Message-Id: <200805011550.m41FoC6A002668@xenbits.xensource.com> Date: Thu, 01 May 2008 08:50:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix lint in headers that are pulled into the Solaris tree. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209656266 -3600 # Node ID 8ccaf43782bd43e7d593a0c8e9c7af6f616b86c6 # Parent ac0900c43fd7e24b7aa945948f91c6fbc45f439a Fix lint in headers that are pulled into the Solaris tree. Signed-off-by: Ryan Scott --- xen/include/public/io/xs_wire.h | 1 + 1 files changed, 1 insertion(+) diff -r ac0900c43fd7 -r 8ccaf43782bd xen/include/public/io/xs_wire.h --- a/xen/include/public/io/xs_wire.h Thu May 01 16:37:28 2008 +0100 +++ b/xen/include/public/io/xs_wire.h Thu May 01 16:37:46 2008 +0100 @@ -61,6 +61,7 @@ struct xsd_errors const char *errstring; }; #define XSD_ERROR(x) { x, #x } +/* LINTED: static unused */ static struct xsd_errors xsd_errors[] #if defined(__GNUC__) __attribute__((unused)) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 06:00:10 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 06:00:10 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrurx-0004iI-Qz for www-data@colo.xensource.com; Fri, 02 May 2008 06:00:10 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrusV-0007A4-1w; Fri, 02 May 2008 13:00:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrusT-00079J-7N for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:41 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrusN-0001Sn-KX for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:39 +0000 X-SBRS: 3.6 X-MesageID: 117156 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117156" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 08:59:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42CxtLf014006 for ; Fri, 2 May 2008 05:59:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42D0C6f008482 for ; Fri, 2 May 2008 06:00:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42D0Csd008481 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 06:00:12 -0700 Message-Id: <200805021300.m42D0Csd008481@xenbits.xensource.com> Date: Fri, 02 May 2008 06:00:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] libxc foreign address translation bug X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209732376 -3600 # Node ID a353dd2ab9445036351c5da5c14555b82bc85ae6 # Parent 64f790e90d3d4797e298cc5abdfc54cb943687f3 libxc foreign address translation bug In the xc_translate_foreign_address function from libxc, there is a check on the page directory entry to see if the page is 4K or 4M. However, the check is looking at bit 3, when it should be looking at bit 7. This patch fixes the problem. Signed-off-by: Bryan D. Payne --- tools/libxc/xc_pagetab.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 64f790e90d3d -r a353dd2ab944 tools/libxc/xc_pagetab.c --- a/tools/libxc/xc_pagetab.c Thu May 01 16:38:56 2008 +0100 +++ b/tools/libxc/xc_pagetab.c Fri May 02 13:46:16 2008 +0100 @@ -141,7 +141,7 @@ unsigned long xc_translate_foreign_addre /* Page Table */ - if (pde & 0x00000008) { /* 4M page (or 2M in PAE mode) */ + if (pde & 0x00000080) { /* 4M page (or 2M in PAE mode) */ DPRINTF("Cannot currently cope with 2/4M pages\n"); exit(-1); } else { /* 4k page */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 06:00:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 06:00:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrus3-0004iN-6O for www-data@colo.xensource.com; Fri, 02 May 2008 06:00:15 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrusa-0007Da-BX; Fri, 02 May 2008 13:00:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrusX-0007AZ-8I for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrusR-0001Sq-5c for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:42 +0000 X-SBRS: 3.6 X-MesageID: 117157 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117157" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 08:59:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42Cxu9J014009 for ; Fri, 2 May 2008 05:59:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42D0DwC008499 for ; Fri, 2 May 2008 06:00:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42D0DcX008498 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 06:00:13 -0700 Message-Id: <200805021300.m42D0DcX008498@xenbits.xensource.com> Date: Fri, 02 May 2008 06:00:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [libfsimage/zfs] compilation fix ZFS libfsimage support. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209732421 -3600 # Node ID 1f24743354ea85d3c6485c986522cb1698169bd1 # Parent a353dd2ab9445036351c5da5c14555b82bc85ae6 [libfsimage/zfs] compilation fix ZFS libfsimage support. Depending on environments, zfs libfsimage support doesn't compile. This patch fixes it. ia64-linux-gnu-gcc -DPIC -O2 -fomit-frame-pointer -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -I/usr/ia64-linux-gnu/ sys-root/usr/include -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I../../../tools/libfsimage/common/ -Werror -Wp,-MD,.zfs_lzjb.opic.d -fPIC -c -o zfs_lzjb.opic zfs_ lzjb.c In file included from fsys_zfs.h:41, from zfs_lzjb.c:25: zfs-include/zfs_acl.h:29: error: redefinition of typedef uid_t /usr/ia64-linux-gnu/sys-root/usr/include/sys/types.h:82: error: previous declaration of uid_t was here This depends on how __uid_t is defined in the system header. No file under the zfs directory uses uid_t so that just removing the definition in the zfs_acl.h looks reasonable. Signed-off-by: Isaku Yamahata --- tools/libfsimage/zfs/zfs-include/zfs_acl.h | 5 ----- 1 files changed, 5 deletions(-) diff -r a353dd2ab944 -r 1f24743354ea tools/libfsimage/zfs/zfs-include/zfs_acl.h --- a/tools/libfsimage/zfs/zfs-include/zfs_acl.h Fri May 02 13:46:16 2008 +0100 +++ b/tools/libfsimage/zfs/zfs-include/zfs_acl.h Fri May 02 13:47:01 2008 +0100 @@ -23,11 +23,6 @@ #ifndef _SYS_FS_ZFS_ACL_H #define _SYS_FS_ZFS_ACL_H - -#ifndef _UID_T -#define _UID_T -typedef unsigned int uid_t; /* UID type */ -#endif /* _UID_T */ typedef struct zfs_oldace { uint32_t z_fuid; /* "who" */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 06:00:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 06:00:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrus6-0004iQ-Pw for www-data@colo.xensource.com; Fri, 02 May 2008 06:00:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrusd-0007Gz-UH; Fri, 02 May 2008 13:00:51 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrusX-0007BD-Rj for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrusR-0001Sn-Lv for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:43 +0000 X-SBRS: 3.6 X-MesageID: 117158 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117158" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 08:59:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42CxvEh014012 for ; Fri, 2 May 2008 05:59:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42D0Ffr008516 for ; Fri, 2 May 2008 06:00:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42D0ElU008515 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 06:00:14 -0700 Message-Id: <200805021300.m42D0ElU008515@xenbits.xensource.com> Date: Fri, 02 May 2008 06:00:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: pump SDL events on resize X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209732466 -3600 # Node ID 26f394079b6cca2010c2567fcd73d2e14b1be43d # Parent 1f24743354ea85d3c6485c986522cb1698169bd1 ioemu: pump SDL events on resize When sdl_resize resizes the SDL window, some window manager send back a ConfigureNotify event, which triggers a SDL_VIDEORESIZE event. That event, however, is seen only much later, on the next VGA refresh round. If the guest quickly switches to another resolution in between, the SDL_VIDEORESIZE event makes us erroneously rescale that new resolution into the old one. This patch makes us pump that window manager event, so that no SDL_VIDEORESIZE event is generated. Signed-off-by: Samuel Thibault --- tools/ioemu/sdl.c | 3 +++ 1 files changed, 3 insertions(+) diff -r 1f24743354ea -r 26f394079b6c tools/ioemu/sdl.c --- a/tools/ioemu/sdl.c Fri May 02 13:47:01 2008 +0100 +++ b/tools/ioemu/sdl.c Fri May 02 13:47:46 2008 +0100 @@ -234,6 +234,9 @@ static void sdl_resize(DisplayState *ds, again: screen = SDL_SetVideoMode(w, h, 0, flags); + + /* Process any WM-generated resize event */ + SDL_PumpEvents(); if (!screen) { fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError()); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 06:00:31 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 06:00:31 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrusI-0004ie-LN for www-data@colo.xensource.com; Fri, 02 May 2008 06:00:30 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrusp-0007KH-QJ; Fri, 02 May 2008 13:01:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrusa-0007CP-GJ for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrusU-0001Su-4y for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:46 +0000 X-SBRS: 3.6 X-MesageID: 117159 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117159" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 08:59:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42Cxwp5014015 for ; Fri, 2 May 2008 05:59:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42D0GpC008533 for ; Fri, 2 May 2008 06:00:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42D0G14008532 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 06:00:16 -0700 Message-Id: <200805021300.m42D0G14008532@xenbits.xensource.com> Date: Fri, 02 May 2008 06:00:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: always disable shared buffer in text mode X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209732490 -3600 # Node ID e309f53f3f83d461a2c10efe65db3b6b2894b590 # Parent 26f394079b6cca2010c2567fcd73d2e14b1be43d ioemu: always disable shared buffer in text mode by not calling get_bpp() (which only makes sense in graphical mode) and always use 0 instead. Signed-off-by: Samuel Thibault --- tools/ioemu/hw/vga.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff -r 26f394079b6c -r e309f53f3f83 tools/ioemu/hw/vga.c --- a/tools/ioemu/hw/vga.c Fri May 02 13:47:46 2008 +0100 +++ b/tools/ioemu/hw/vga.c Fri May 02 13:48:10 2008 +0100 @@ -1075,7 +1075,7 @@ static rgb_to_pixel_dup_func *rgb_to_pix */ static void vga_draw_text(VGAState *s, int full_update) { - int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr, depth; + int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr; int cx_min, cx_max, linesize, x_incr; uint32_t offset, fgcol, bgcol, v, cursor_offset; uint8_t *d1, *d, *src, *s1, *dest, *cursor_ptr; @@ -1086,9 +1086,8 @@ static void vga_draw_text(VGAState *s, i vga_draw_glyph8_func *vga_draw_glyph8; vga_draw_glyph9_func *vga_draw_glyph9; - depth = s->get_bpp(s); - if (s->ds->dpy_colourdepth != NULL && s->ds->depth != depth) - s->ds->dpy_colourdepth(s->ds, depth); + if (s->ds->dpy_colourdepth != NULL && s->ds->depth != 0) + s->ds->dpy_colourdepth(s->ds, 0); s->rgb_to_pixel = rgb_to_pixel_dup_table[get_depth_index(s->ds)]; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 06:00:33 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 06:00:33 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrusL-0004ij-H3 for www-data@colo.xensource.com; Fri, 02 May 2008 06:00:33 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jruss-0007NO-M4; Fri, 02 May 2008 13:01:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrusm-0007IX-Bz for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:01:00 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrusV-0001Sq-LX for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:00:58 +0000 X-SBRS: 3.6 X-MesageID: 117160 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117160" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 09:00:00 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42Cxx3w014018 for ; Fri, 2 May 2008 05:59:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42D0HaE008550 for ; Fri, 2 May 2008 06:00:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42D0HLH008549 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 06:00:17 -0700 Message-Id: <200805021300.m42D0HLH008549@xenbits.xensource.com> Date: Fri, 02 May 2008 06:00:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: move VNC-specific switchbpp member to VncState X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209732516 -3600 # Node ID 5b994ca498de29e9ac9e3e32f7249f865b4c6e8c # Parent e309f53f3f83d461a2c10efe65db3b6b2894b590 ioemu: move VNC-specific switchbpp member to VncState Signed-off-by: Samuel Thibault --- tools/ioemu/vl.h | 1 - tools/ioemu/vnc.c | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff -r e309f53f3f83 -r 5b994ca498de tools/ioemu/vl.h --- a/tools/ioemu/vl.h Fri May 02 13:48:10 2008 +0100 +++ b/tools/ioemu/vl.h Fri May 02 13:48:36 2008 +0100 @@ -940,7 +940,6 @@ struct DisplayState { uint32_t *palette; uint64_t gui_timer_interval; - int switchbpp; int shared_buf; void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); diff -r e309f53f3f83 -r 5b994ca498de tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Fri May 02 13:48:10 2008 +0100 +++ b/tools/ioemu/vnc.c Fri May 02 13:48:36 2008 +0100 @@ -198,6 +198,7 @@ struct VncState char *x509key; #endif char challenge[VNC_AUTH_CHALLENGE_SIZE]; + int switchbpp; #if CONFIG_VNC_TLS int wiremode; @@ -1686,7 +1687,7 @@ static void vnc_dpy_colourdepth(DisplayS default: return; } - if (ds->switchbpp) { + if (vs->switchbpp) { vnc_client_error(vs); } else if (vs->csock != -1 && vs->has_WMVi) { /* Sending a WMVi message to notify the client*/ @@ -2647,7 +2648,7 @@ int vnc_display_open(DisplayState *ds, c if (strncmp(options, "password", 8) == 0) { password = 1; /* Require password auth */ } else if (strncmp(options, "switchbpp", 9) == 0) { - ds->switchbpp = 1; + vs->switchbpp = 1; #if CONFIG_VNC_TLS } else if (strncmp(options, "tls", 3) == 0) { tls = 1; /* Require TLS */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 06:30:24 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 06:30:24 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrvLD-00054u-S5 for www-data@colo.xensource.com; Fri, 02 May 2008 06:30:24 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrvLk-0001Rg-Vu; Fri, 02 May 2008 13:30:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrvLi-0001Ql-TH for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:30:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrvLd-0001rM-D2 for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:30:52 +0000 X-SBRS: 3.6 X-MesageID: 117284 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117284" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 09:30:10 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42DU9IV014042 for ; Fri, 2 May 2008 06:30:09 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42DURP1010393 for ; Fri, 2 May 2008 06:30:27 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42DURXi010392 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 06:30:27 -0700 Message-Id: <200805021330.m42DURXi010392@xenbits.xensource.com> Date: Fri, 02 May 2008 06:30:26 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] docs: Do not reference stale external websites. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209646095 -3600 # Node ID 561fe1c610da1f2304777b8a4fca8a23231b3ac7 # Parent f37f7dcb78ee320359d92eefef17bb6369eb2de7 docs: Do not reference stale external websites. Signed-off-by: Keir Fraser xen-unstable changeset: 17547:b2a036d390dbce2a0359740da0c52906d749eead xen-unstable date: Thu May 01 13:47:08 2008 +0100 --- docs/src/user.tex | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) diff -r f37f7dcb78ee -r 561fe1c610da docs/src/user.tex --- a/docs/src/user.tex Thu May 01 10:17:39 2008 +0100 +++ b/docs/src/user.tex Thu May 01 13:48:15 2008 +0100 @@ -2459,9 +2459,7 @@ file. Please refer to Section~\ref{subse file. Please refer to Section~\ref{subsection:acmlabelmanageddomains} if you are using managed domains. -The following configuration file defines \verb|domain1| -(Note: www.jailtime.org or www.xen-get.org might be good -places to look for example domU images): +The following configuration file defines \verb|domain1|: \begin{scriptsize} \begin{verbatim} _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 06:30:27 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 06:30:27 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JrvLH-000551-Jl for www-data@colo.xensource.com; Fri, 02 May 2008 06:30:27 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrvLo-0001Up-Ly; Fri, 02 May 2008 13:31:00 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrvLn-0001Rv-1G for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:30:59 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JrvLh-0001rM-Bb for xen-changelog@lists.xensource.com; Fri, 02 May 2008 13:30:56 +0000 X-SBRS: 3.6 X-MesageID: 117285 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117285" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 09:30:11 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42DUA2X014045 for ; Fri, 2 May 2008 06:30:10 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42DUS6f010410 for ; Fri, 2 May 2008 06:30:28 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42DUSUY010409 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 06:30:28 -0700 Message-Id: <200805021330.m42DUSUY010409@xenbits.xensource.com> Date: Fri, 02 May 2008 06:30:27 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] XEN_GUEST_HANDLE_00030205() compat macro is broken. Remove it and X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209734587 -3600 # Node ID 9733f681d5c5b81f003acb4a75d90aa5028361fb # Parent 561fe1c610da1f2304777b8a4fca8a23231b3ac7 XEN_GUEST_HANDLE_00030205() compat macro is broken. Remove it and open-code an alternative at its two invocation sites. Based on a patch by Jan Beulich. Signed-off-by: Keir Fraser xen-unstable changeset: 16778:491c283207945c5acdad8f9bc1f64c76511d83b6 xen-unstable date: Tue Jan 22 10:18:58 2008 +0000 --- xen/include/public/physdev.h | 6 +++++- xen/include/public/xen-compat.h | 7 ------- xen/include/public/xen.h | 6 +++++- 3 files changed, 10 insertions(+), 9 deletions(-) diff -r 561fe1c610da -r 9733f681d5c5 xen/include/public/physdev.h --- a/xen/include/public/physdev.h Thu May 01 13:48:15 2008 +0100 +++ b/xen/include/public/physdev.h Fri May 02 14:23:07 2008 +0100 @@ -81,7 +81,11 @@ DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl #define PHYSDEVOP_set_iobitmap 7 struct physdev_set_iobitmap { /* IN */ - XEN_GUEST_HANDLE_00030205(uint8) bitmap; +#if __XEN_INTERFACE_VERSION__ >= 0x00030205 + XEN_GUEST_HANDLE(uint8) bitmap; +#else + uint8_t *bitmap; +#endif uint32_t nr_ports; }; typedef struct physdev_set_iobitmap physdev_set_iobitmap_t; diff -r 561fe1c610da -r 9733f681d5c5 xen/include/public/xen-compat.h --- a/xen/include/public/xen-compat.h Thu May 01 13:48:15 2008 +0100 +++ b/xen/include/public/xen-compat.h Fri May 02 14:23:07 2008 +0100 @@ -41,11 +41,4 @@ #error "These header files do not support the requested interface version." #endif -/* Fields defined as a Xen guest handle since 0x00030205. */ -#if __XEN_INTERFACE_VERSION__ >= 0x00030205 -#define XEN_GUEST_HANDLE_00030205(type) XEN_GUEST_HANDLE(type) -#else -#define XEN_GUEST_HANDLE_00030205(type) type * -#endif - #endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */ diff -r 561fe1c610da -r 9733f681d5c5 xen/include/public/xen.h --- a/xen/include/public/xen.h Thu May 01 13:48:15 2008 +0100 +++ b/xen/include/public/xen.h Fri May 02 14:23:07 2008 +0100 @@ -245,7 +245,11 @@ struct mmuext_op { /* SET_LDT */ unsigned int nr_ents; /* TLB_FLUSH_MULTI, INVLPG_MULTI */ - XEN_GUEST_HANDLE_00030205(void) vcpumask; +#if __XEN_INTERFACE_VERSION__ >= 0x00030205 + XEN_GUEST_HANDLE(void) vcpumask; +#else + void *vcpumask; +#endif } arg2; }; typedef struct mmuext_op mmuext_op_t; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 07:10:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 07:10:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrvxe-0005fK-Du for www-data@colo.xensource.com; Fri, 02 May 2008 07:10:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrvyB-00033N-EN; Fri, 02 May 2008 14:10:39 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrvy9-000334-7y for xen-changelog@lists.xensource.com; Fri, 02 May 2008 14:10:37 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrvy3-0002Kh-7S for xen-changelog@lists.xensource.com; Fri, 02 May 2008 14:10:34 +0000 X-SBRS: 3.6 X-MesageID: 117539 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117539" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 10:09:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42E9pHI014097 for ; Fri, 2 May 2008 07:09:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42EA9cq012691 for ; Fri, 2 May 2008 07:10:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42EA9dV012690 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 07:10:09 -0700 Message-Id: <200805021410.m42EA9dV012690@xenbits.xensource.com> Date: Fri, 02 May 2008 07:10:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: end watch of FS backend state value X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209735327 -3600 # Node ID cd5fa4e7993f4de6d51fb2c4e1670c89040521b3 # Parent 5b994ca498de29e9ac9e3e32f7249f865b4c6e8c minios: end watch of FS backend state value Signed-off-by: Samuel Thibault --- extras/mini-os/fs-front.c | 1 + 1 files changed, 1 insertion(+) diff -r 5b994ca498de -r cd5fa4e7993f extras/mini-os/fs-front.c --- a/extras/mini-os/fs-front.c Fri May 02 13:48:36 2008 +0100 +++ b/extras/mini-os/fs-front.c Fri May 02 14:35:27 2008 +0100 @@ -1028,6 +1028,7 @@ done: /* The token will not be unique if multiple imports are inited */ xenbus_watch_path(XBT_NIL, r_nodename/*, token*/); xenbus_wait_for_value(/*token,*/ r_nodename, STATE_READY); + xenbus_unwatch_path(XBT_NIL, r_nodename); printk("Backend ready.\n"); //create_thread("fs-tester", test_fs_import, import); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 07:10:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 07:10:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrvxj-0005fN-3Z for www-data@colo.xensource.com; Fri, 02 May 2008 07:10:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrvyG-00037K-7X; Fri, 02 May 2008 14:10:44 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JrvyD-00033Y-Cf for xen-changelog@lists.xensource.com; Fri, 02 May 2008 14:10:41 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrvy4-0002Ki-DR for xen-changelog@lists.xensource.com; Fri, 02 May 2008 14:10:39 +0000 X-SBRS: 3.6 X-MesageID: 117540 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117540" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 10:09:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42E9q4Z014100 for ; Fri, 2 May 2008 07:09:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42EAAoi012708 for ; Fri, 2 May 2008 07:10:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42EAAwh012707 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 07:10:10 -0700 Message-Id: <200805021410.m42EAAwh012707@xenbits.xensource.com> Date: Fri, 02 May 2008 07:10:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] shadow: track video RAM dirty bits X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209737307 -3600 # Node ID b6aa55ca599e3c626ea22d1ae1aceb5b9fb46cf2 # Parent cd5fa4e7993f4de6d51fb2c4e1670c89040521b3 shadow: track video RAM dirty bits This adds a new HVM op that enables tracking dirty bits of a range of video RAM. The idea is to optimize just for the most common case (only one guest mapping, with sometimes some temporary other mappings), which permits to keep the overhead on shadow as low as possible. Signed-off-by: Samuel Thibault --- tools/ioemu/hw/cirrus_vga.c | 50 +++++------ tools/ioemu/hw/vga.c | 83 ++++++++++++++++++- tools/ioemu/hw/vga_int.h | 2 tools/libxc/xc_misc.c | 31 +++++++ tools/libxc/xenctrl.h | 16 +++ xen/arch/ia64/vmx/vmx_hypercall.c | 4 xen/arch/x86/hvm/hvm.c | 48 +++++++++++ xen/arch/x86/mm/shadow/common.c | 165 ++++++++++++++++++++++++++++++++++++++ xen/arch/x86/mm/shadow/multi.c | 83 ++++++++++++++++++- xen/arch/x86/mm/shadow/private.h | 9 ++ xen/include/asm-ia64/config.h | 1 xen/include/asm-powerpc/types.h | 1 xen/include/asm-x86/shadow.h | 6 + xen/include/asm-x86/types.h | 3 xen/include/public/hvm/hvm_op.h | 16 +++ xen/include/xen/sched.h | 3 16 files changed, 489 insertions(+), 32 deletions(-) diff -r cd5fa4e7993f -r b6aa55ca599e tools/ioemu/hw/cirrus_vga.c --- a/tools/ioemu/hw/cirrus_vga.c Fri May 02 14:35:27 2008 +0100 +++ b/tools/ioemu/hw/cirrus_vga.c Fri May 02 15:08:27 2008 +0100 @@ -234,8 +234,6 @@ typedef struct CirrusVGAState { int cirrus_linear_io_addr; int cirrus_linear_bitblt_io_addr; int cirrus_mmio_io_addr; - unsigned long cirrus_lfb_addr; - unsigned long cirrus_lfb_end; uint32_t cirrus_addr_mask; uint32_t linear_mmio_mask; uint8_t cirrus_shadow_gr0; @@ -2657,11 +2655,11 @@ static void cirrus_update_memory_access( mode = s->gr[0x05] & 0x7; if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) { - if (s->cirrus_lfb_addr && s->cirrus_lfb_end && !s->map_addr) { + if (s->lfb_addr && s->lfb_end && !s->map_addr) { void *vram_pointer, *old_vram; - vram_pointer = set_vram_mapping(s->cirrus_lfb_addr, - s->cirrus_lfb_end); + vram_pointer = set_vram_mapping(s->lfb_addr, + s->lfb_end); if (!vram_pointer) fprintf(stderr, "NULL vram_pointer\n"); else { @@ -2669,21 +2667,21 @@ static void cirrus_update_memory_access( VGA_RAM_SIZE); qemu_free(old_vram); } - s->map_addr = s->cirrus_lfb_addr; - s->map_end = s->cirrus_lfb_end; + s->map_addr = s->lfb_addr; + s->map_end = s->lfb_end; } s->cirrus_linear_write[0] = cirrus_linear_mem_writeb; s->cirrus_linear_write[1] = cirrus_linear_mem_writew; s->cirrus_linear_write[2] = cirrus_linear_mem_writel; } else { generic_io: - if (s->cirrus_lfb_addr && s->cirrus_lfb_end && s->map_addr) { + if (s->lfb_addr && s->lfb_end && s->map_addr) { void *old_vram; old_vram = vga_update_vram((VGAState *)s, NULL, VGA_RAM_SIZE); - unset_vram_mapping(s->cirrus_lfb_addr, - s->cirrus_lfb_end, + unset_vram_mapping(s->lfb_addr, + s->lfb_end, old_vram); s->map_addr = s->map_end = 0; @@ -3049,27 +3047,27 @@ void cirrus_stop_acc(CirrusVGAState *s) if (s->map_addr){ int error; s->map_addr = 0; - error = unset_vram_mapping(s->cirrus_lfb_addr, - s->cirrus_lfb_end, s->vram_ptr); + error = unset_vram_mapping(s->lfb_addr, + s->lfb_end, s->vram_ptr); fprintf(stderr, "cirrus_stop_acc:unset_vram_mapping.\n"); } } void cirrus_restart_acc(CirrusVGAState *s) { - if (s->cirrus_lfb_addr && s->cirrus_lfb_end) { + if (s->lfb_addr && s->lfb_end) { void *vram_pointer, *old_vram; fprintf(stderr, "cirrus_vga_load:re-enable vga acc.lfb_addr=0x%lx, lfb_end=0x%lx.\n", - s->cirrus_lfb_addr, s->cirrus_lfb_end); - vram_pointer = set_vram_mapping(s->cirrus_lfb_addr ,s->cirrus_lfb_end); + s->lfb_addr, s->lfb_end); + vram_pointer = set_vram_mapping(s->lfb_addr ,s->lfb_end); if (!vram_pointer){ fprintf(stderr, "cirrus_vga_load:NULL vram_pointer\n"); } else { old_vram = vga_update_vram((VGAState *)s, vram_pointer, VGA_RAM_SIZE); qemu_free(old_vram); - s->map_addr = s->cirrus_lfb_addr; - s->map_end = s->cirrus_lfb_end; + s->map_addr = s->lfb_addr; + s->map_end = s->lfb_end; } } } @@ -3120,8 +3118,8 @@ static void cirrus_vga_save(QEMUFile *f, vga_acc = (!!s->map_addr); qemu_put_8s(f, &vga_acc); - qemu_put_be64s(f, (uint64_t*)&s->cirrus_lfb_addr); - qemu_put_be64s(f, (uint64_t*)&s->cirrus_lfb_end); + qemu_put_be64s(f, (uint64_t*)&s->lfb_addr); + qemu_put_be64s(f, (uint64_t*)&s->lfb_end); qemu_put_buffer(f, s->vram_ptr, VGA_RAM_SIZE); } @@ -3175,8 +3173,8 @@ static int cirrus_vga_load(QEMUFile *f, qemu_get_be32s(f, &s->hw_cursor_y); qemu_get_8s(f, &vga_acc); - qemu_get_be64s(f, (uint64_t*)&s->cirrus_lfb_addr); - qemu_get_be64s(f, (uint64_t*)&s->cirrus_lfb_end); + qemu_get_be64s(f, (uint64_t*)&s->lfb_addr); + qemu_get_be64s(f, (uint64_t*)&s->lfb_end); qemu_get_buffer(f, s->vram_ptr, VGA_RAM_SIZE); if (vga_acc){ cirrus_restart_acc(s); @@ -3337,11 +3335,11 @@ static void cirrus_pci_lfb_map(PCIDevice /* XXX: add byte swapping apertures */ cpu_register_physical_memory(addr, s->vram_size, s->cirrus_linear_io_addr); - s->cirrus_lfb_addr = addr; - s->cirrus_lfb_end = addr + VGA_RAM_SIZE; - - if (s->map_addr && (s->cirrus_lfb_addr != s->map_addr) && - (s->cirrus_lfb_end != s->map_end)) + s->lfb_addr = addr; + s->lfb_end = addr + VGA_RAM_SIZE; + + if (s->map_addr && (s->lfb_addr != s->map_addr) && + (s->lfb_end != s->map_end)) fprintf(logfile, "cirrus vga map change while on lfb mode\n"); cpu_register_physical_memory(addr + 0x1000000, 0x400000, diff -r cd5fa4e7993f -r b6aa55ca599e tools/ioemu/hw/vga.c --- a/tools/ioemu/hw/vga.c Fri May 02 14:35:27 2008 +0100 +++ b/tools/ioemu/hw/vga.c Fri May 02 15:08:27 2008 +0100 @@ -1086,6 +1086,9 @@ static void vga_draw_text(VGAState *s, i vga_draw_glyph8_func *vga_draw_glyph8; vga_draw_glyph9_func *vga_draw_glyph9; + /* Disable dirty bit tracking */ + xc_hvm_track_dirty_vram(xc_handle, domid, 0, 0, NULL); + if (s->ds->dpy_colourdepth != NULL && s->ds->depth != 0) s->ds->dpy_colourdepth(s->ds, 0); s->rgb_to_pixel = @@ -1485,7 +1488,7 @@ static void vga_draw_graphic(VGAState *s static void vga_draw_graphic(VGAState *s, int full_update) { int y1, y, update, linesize, y_start, double_scan, mask, depth; - int width, height, shift_control, line_offset, bwidth, ds_depth; + int width, height, shift_control, line_offset, bwidth, ds_depth, bits; ram_addr_t page0, page1; int disp_width, multi_scan, multi_run; uint8_t *d; @@ -1533,6 +1536,7 @@ static void vga_draw_graphic(VGAState *s } else { v = VGA_DRAW_LINE4; } + bits = 4; } else if (shift_control == 1) { full_update |= update_palette16(s); if (s->sr[0x01] & 8) { @@ -1541,28 +1545,35 @@ static void vga_draw_graphic(VGAState *s } else { v = VGA_DRAW_LINE2; } + bits = 4; } else { switch(s->get_bpp(s)) { default: case 0: full_update |= update_palette256(s); v = VGA_DRAW_LINE8D2; + bits = 4; break; case 8: full_update |= update_palette256(s); v = VGA_DRAW_LINE8; + bits = 8; break; case 15: v = VGA_DRAW_LINE15; + bits = 16; break; case 16: v = VGA_DRAW_LINE16; + bits = 16; break; case 24: v = VGA_DRAW_LINE24; + bits = 24; break; case 32: v = VGA_DRAW_LINE32; + bits = 32; break; } } @@ -1590,12 +1601,72 @@ static void vga_draw_graphic(VGAState *s width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]); #endif - for (y = 0; y < s->vram_size; y += TARGET_PAGE_SIZE) - if (vram_dirty(s, y, TARGET_PAGE_SIZE)) + y = 0; + + if (height - 1 > s->line_compare || multi_run || (s->cr[0x17] & 3) != 3 + || !s->lfb_addr) { + /* Tricky things happen, disable dirty bit tracking */ + xc_hvm_track_dirty_vram(xc_handle, domid, 0, 0, NULL); + + for ( ; y < s->vram_size; y += TARGET_PAGE_SIZE) + if (vram_dirty(s, y, TARGET_PAGE_SIZE)) + cpu_physical_memory_set_dirty(s->vram_offset + y); + } else { + /* Tricky things won't have any effect, i.e. we are in the very simple + * (and very usual) case of a linear buffer. */ + unsigned long end; + + for ( ; y < ((s->start_addr * 4) & TARGET_PAGE_MASK); y += TARGET_PAGE_SIZE) + /* We will not read that anyway. */ cpu_physical_memory_set_dirty(s->vram_offset + y); + if (y < (s->start_addr * 4)) { + /* start address not aligned on a page, track dirtyness by hand. */ + if (vram_dirty(s, y, TARGET_PAGE_SIZE)) + cpu_physical_memory_set_dirty(s->vram_offset + y); + y += TARGET_PAGE_SIZE; + } + + /* use page table dirty bit tracking for the inner of the LFB */ + end = s->start_addr * 4 + height * line_offset; + { + unsigned long npages = ((end & TARGET_PAGE_MASK) - y) / TARGET_PAGE_SIZE; + const int width = sizeof(unsigned long) * 8; + unsigned long bitmap[(npages + width - 1) / width]; + int err; + + if (!(err = xc_hvm_track_dirty_vram(xc_handle, domid, + (s->lfb_addr + y) / TARGET_PAGE_SIZE, npages, bitmap))) { + int i, j; + for (i = 0; i < sizeof(bitmap) / sizeof(*bitmap); i++) { + unsigned long map = bitmap[i]; + for (j = i * width; map && j < npages; map >>= 1, j++) + if (map & 1) + cpu_physical_memory_set_dirty(s->vram_offset + y + + j * TARGET_PAGE_SIZE); + } + y += npages * TARGET_PAGE_SIZE; + } else { + /* ENODATA just means we have changed mode and will succeed + * next time */ + if (err != -ENODATA) + fprintf(stderr, "track_dirty_vram(%lx, %lx) failed (%d)\n", s->lfb_addr + y, npages, err); + } + } + + for ( ; y < s->vram_size && y < end; y += TARGET_PAGE_SIZE) + /* failed or end address not aligned on a page, track dirtyness by + * hand. */ + if (vram_dirty(s, y, TARGET_PAGE_SIZE)) + cpu_physical_memory_set_dirty(s->vram_offset + y); + + for ( ; y < s->vram_size; y += TARGET_PAGE_SIZE) + /* We will not read that anyway. */ + cpu_physical_memory_set_dirty(s->vram_offset + y); + } + addr1 = (s->start_addr * 4); - bwidth = width * 4; + bwidth = (width * bits + 7) / 8; y_start = -1; page_min = 0; page_max = 0; @@ -1681,6 +1752,10 @@ static void vga_draw_blank(VGAState *s, return; if (s->last_scr_width <= 0 || s->last_scr_height <= 0) return; + + /* Disable dirty bit tracking */ + xc_hvm_track_dirty_vram(xc_handle, domid, 0, 0, NULL); + s->rgb_to_pixel = rgb_to_pixel_dup_table[get_depth_index(s->ds)]; if (s->ds->depth == 8) diff -r cd5fa4e7993f -r b6aa55ca599e tools/ioemu/hw/vga_int.h --- a/tools/ioemu/hw/vga_int.h Fri May 02 14:35:27 2008 +0100 +++ b/tools/ioemu/hw/vga_int.h Fri May 02 15:08:27 2008 +0100 @@ -87,6 +87,8 @@ unsigned int vram_size; \ unsigned long bios_offset; \ unsigned int bios_size; \ + unsigned long lfb_addr; \ + unsigned long lfb_end; \ PCIDevice *pci_dev; \ uint32_t latch; \ uint8_t sr_index; \ diff -r cd5fa4e7993f -r b6aa55ca599e tools/libxc/xc_misc.c --- a/tools/libxc/xc_misc.c Fri May 02 14:35:27 2008 +0100 +++ b/tools/libxc/xc_misc.c Fri May 02 15:08:27 2008 +0100 @@ -222,6 +222,37 @@ int xc_hvm_set_pci_link_route( arg.domid = dom; arg.link = link; arg.isa_irq = isa_irq; + + if ( (rc = lock_pages(&arg, sizeof(arg))) != 0 ) + { + PERROR("Could not lock memory"); + return rc; + } + + rc = do_xen_hypercall(xc_handle, &hypercall); + + unlock_pages(&arg, sizeof(arg)); + + return rc; +} + +int xc_hvm_track_dirty_vram( + int xc_handle, domid_t dom, + uint64_t first_pfn, uint64_t nr, + unsigned long *dirty_bitmap) +{ + DECLARE_HYPERCALL; + struct xen_hvm_track_dirty_vram arg; + int rc; + + hypercall.op = __HYPERVISOR_hvm_op; + hypercall.arg[0] = HVMOP_track_dirty_vram; + hypercall.arg[1] = (unsigned long)&arg; + + arg.domid = dom; + arg.first_pfn = first_pfn; + arg.nr = nr; + set_xen_guest_handle(arg.dirty_bitmap, (uint8_t *)dirty_bitmap); if ( (rc = lock_pages(&arg, sizeof(arg))) != 0 ) { diff -r cd5fa4e7993f -r b6aa55ca599e tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Fri May 02 14:35:27 2008 +0100 +++ b/tools/libxc/xenctrl.h Fri May 02 15:08:27 2008 +0100 @@ -882,6 +882,22 @@ int xc_hvm_set_pci_link_route( int xc_handle, domid_t dom, uint8_t link, uint8_t isa_irq); +/* + * Track dirty bit changes in the VRAM area + * + * All of this is done atomically: + * - get the dirty bitmap since the last call + * - set up dirty tracking area for period up to the next call + * - clear the dirty tracking area. + * + * Returns -ENODATA and does not fill bitmap if the area has changed since the + * last call. + */ +int xc_hvm_track_dirty_vram( + int xc_handle, domid_t dom, + uint64_t first_pfn, uint64_t nr, + unsigned long *bitmap); + typedef enum { XC_ERROR_NONE = 0, XC_INTERNAL_ERROR = 1, diff -r cd5fa4e7993f -r b6aa55ca599e xen/arch/ia64/vmx/vmx_hypercall.c --- a/xen/arch/ia64/vmx/vmx_hypercall.c Fri May 02 14:35:27 2008 +0100 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c Fri May 02 15:08:27 2008 +0100 @@ -200,6 +200,10 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA rc = 0; break; + case HVMOP_track_dirty_vram: + rc = -ENOSYS; + break; + default: gdprintk(XENLOG_INFO, "Bad HVM op %ld.\n", op); rc = -ENOSYS; diff -r cd5fa4e7993f -r b6aa55ca599e xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Fri May 02 14:35:27 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Fri May 02 15:08:27 2008 +0100 @@ -2345,6 +2345,54 @@ long do_hvm_op(unsigned long op, XEN_GUE rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -ENOSYS; break; + case HVMOP_track_dirty_vram: + { + struct xen_hvm_track_dirty_vram a; + struct domain *d; + + if ( copy_from_guest(&a, arg, 1) ) + return -EFAULT; + + if ( a.domid == DOMID_SELF ) + { + d = rcu_lock_current_domain(); + } + else + { + if ( (d = rcu_lock_domain_by_id(a.domid)) == NULL ) + return -ESRCH; + if ( !IS_PRIV_FOR(current->domain, d) ) + { + rc = -EPERM; + goto param_fail2; + } + } + + rc = -EINVAL; + if ( !is_hvm_domain(d) ) + goto param_fail2; + + rc = xsm_hvm_param(d, op); + if ( rc ) + goto param_fail2; + + rc = -ESRCH; + if ( d->is_dying ) + goto param_fail2; + + rc = -EINVAL; + if ( !shadow_mode_enabled(d)) + goto param_fail2; + if ( d->vcpu[0] == NULL ) + goto param_fail2; + + rc = shadow_track_dirty_vram(d, a.first_pfn, a.nr, a.dirty_bitmap); + + param_fail2: + rcu_unlock_domain(d); + break; + } + default: { gdprintk(XENLOG_WARNING, "Bad HVM op %ld.\n", op); diff -r cd5fa4e7993f -r b6aa55ca599e xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Fri May 02 14:35:27 2008 +0100 +++ b/xen/arch/x86/mm/shadow/common.c Fri May 02 15:08:27 2008 +0100 @@ -2589,6 +2589,13 @@ void shadow_teardown(struct domain *d) * calls now that we've torn down the bitmap */ d->arch.paging.mode &= ~PG_log_dirty; + if (d->dirty_vram) { + xfree(d->dirty_vram->sl1ma); + xfree(d->dirty_vram->dirty_bitmap); + xfree(d->dirty_vram); + d->dirty_vram = NULL; + } + shadow_unlock(d); } @@ -2849,6 +2856,164 @@ void shadow_clean_dirty_bitmap(struct do shadow_blow_tables(d); shadow_unlock(d); } + + +/**************************************************************************/ +/* VRAM dirty tracking support */ +int shadow_track_dirty_vram(struct domain *d, + unsigned long begin_pfn, + unsigned long nr, + XEN_GUEST_HANDLE_64(uint8) dirty_bitmap) +{ + int rc; + unsigned long end_pfn = begin_pfn + nr; + unsigned long dirty_size = (nr + 7) / 8; + int flush_tlb = 0; + + if (end_pfn < begin_pfn + || begin_pfn > d->arch.p2m->max_mapped_pfn + || end_pfn >= d->arch.p2m->max_mapped_pfn) + return -EINVAL; + + shadow_lock(d); + + if ( d->dirty_vram && (!nr || + ( begin_pfn != d->dirty_vram->begin_pfn + || end_pfn != d->dirty_vram->end_pfn )) ) { + /* Different tracking, tear the previous down. */ + gdprintk(XENLOG_INFO, "stopping tracking VRAM %lx - %lx\n", d->dirty_vram->begin_pfn, d->dirty_vram->end_pfn); + xfree(d->dirty_vram->sl1ma); + xfree(d->dirty_vram->dirty_bitmap); + xfree(d->dirty_vram); + d->dirty_vram = NULL; + } + + if ( !nr ) { + rc = 0; + goto out; + } + + /* This should happen seldomly (Video mode change), + * no need to be careful. */ + if ( !d->dirty_vram ) { + unsigned long i; + p2m_type_t t; + + /* Just recount from start. */ + for ( i = begin_pfn; i < end_pfn; i++ ) + flush_tlb |= sh_remove_all_mappings(d->vcpu[0], gfn_to_mfn(d, i, &t)); + + gdprintk(XENLOG_INFO, "tracking VRAM %lx - %lx\n", begin_pfn, end_pfn); + + rc = -ENOMEM; + if ( (d->dirty_vram = xmalloc(struct sh_dirty_vram)) == NULL ) + goto out; + d->dirty_vram->begin_pfn = begin_pfn; + d->dirty_vram->end_pfn = end_pfn; + + if ( (d->dirty_vram->sl1ma = xmalloc_array(paddr_t, nr)) == NULL ) + goto out_dirty_vram; + memset(d->dirty_vram->sl1ma, ~0, sizeof(paddr_t) * nr); + + if ( (d->dirty_vram->dirty_bitmap = xmalloc_array(uint8_t, dirty_size)) == NULL ) + goto out_sl1ma; + memset(d->dirty_vram->dirty_bitmap, 0, dirty_size); + + /* Tell the caller that this time we could not track dirty bits. */ + rc = -ENODATA; + } else { + int i; +#ifdef __i386__ + unsigned long map_mfn = INVALID_MFN; + void *map_sl1p = NULL; +#endif + + /* Iterate over VRAM to track dirty bits. */ + for ( i = 0; i < nr; i++ ) { + p2m_type_t t; + mfn_t mfn = gfn_to_mfn(d, begin_pfn + i, &t); + struct page_info *page = mfn_to_page(mfn); + u32 count_info = page->u.inuse.type_info & PGT_count_mask; + int dirty = 0; + paddr_t sl1ma = d->dirty_vram->sl1ma[i]; + + switch (count_info) { + case 0: + /* No guest reference, nothing to track. */ + break; + case 1: + /* One guest reference. */ + if ( sl1ma == INVALID_PADDR ) { + /* We don't know which sl1e points to this, too bad. */ + dirty = 1; + /* TODO: Heuristics for finding the single mapping of + * this gmfn */ + flush_tlb |= sh_remove_all_mappings(d->vcpu[0], gfn_to_mfn(d, begin_pfn + i, &t)); + } else { + /* Hopefully the most common case: only one mapping, + * whose dirty bit we can use. */ + l1_pgentry_t *sl1e; +#ifdef __i386__ + void *sl1p = map_sl1p; + unsigned long sl1mfn = paddr_to_pfn(sl1ma); + + if ( sl1mfn != map_mfn ) { + if ( map_sl1p ) + sh_unmap_domain_page(map_sl1p); + map_sl1p = sl1p = sh_map_domain_page(_mfn(sl1mfn)); + map_mfn = sl1mfn; + } + sl1e = sl1p + (sl1ma & ~PAGE_MASK); +#else + sl1e = maddr_to_virt(sl1ma); +#endif + + if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY ) { + dirty = 1; + /* Note: this is atomic, so we may clear a + * _PAGE_ACCESSED set by another processor. */ + l1e_remove_flags(*sl1e, _PAGE_DIRTY); + flush_tlb = 1; + } + } + break; + default: + /* More than one guest reference, + * we don't afford tracking that. */ + dirty = 1; + break; + } + + if ( dirty ) + d->dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8); + } + +#ifdef __i386__ + if ( map_sl1p ) + sh_unmap_domain_page(map_sl1p); +#endif + + rc = -EFAULT; + if ( copy_to_guest(dirty_bitmap, d->dirty_vram->dirty_bitmap, dirty_size) == 0 ) { + memset(d->dirty_vram->dirty_bitmap, 0, dirty_size); + rc = 0; + } + } + if ( flush_tlb ) + flush_tlb_mask(d->domain_dirty_cpumask); + goto out; + +out_sl1ma: + xfree(d->dirty_vram->sl1ma); +out_dirty_vram: + xfree(d->dirty_vram); + d->dirty_vram = NULL; + +out: + shadow_unlock(d); + return rc; +} + /**************************************************************************/ /* Shadow-control XEN_DOMCTL dispatcher */ diff -r cd5fa4e7993f -r b6aa55ca599e xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Fri May 02 14:35:27 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Fri May 02 15:08:27 2008 +0100 @@ -801,7 +801,7 @@ _sh_propagate(struct vcpu *v, // Since we know the guest's PRESENT bit is set, we also set the shadow's // SHADOW_PRESENT bit. // - pass_thru_flags = (_PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_USER | + pass_thru_flags = (_PAGE_ACCESSED | _PAGE_USER | _PAGE_RW | _PAGE_PRESENT); if ( guest_supports_nx(v) ) pass_thru_flags |= _PAGE_NX_BIT; @@ -1251,6 +1251,80 @@ static int shadow_set_l2e(struct vcpu *v return flags; } +static inline void shadow_vram_get_l1e(shadow_l1e_t new_sl1e, + shadow_l1e_t *sl1e, + mfn_t sl1mfn, + struct domain *d) +{ + mfn_t mfn; + unsigned long gfn; + + if ( !d->dirty_vram ) return; + + mfn = shadow_l1e_get_mfn(new_sl1e); + gfn = mfn_to_gfn(d, mfn); + + if ( (gfn >= d->dirty_vram->begin_pfn) && (gfn < d->dirty_vram->end_pfn) ) { + unsigned long i = gfn - d->dirty_vram->begin_pfn; + struct page_info *page = mfn_to_page(mfn); + u32 count_info = page->u.inuse.type_info & PGT_count_mask; + + if ( count_info == 1 ) + /* Initial guest reference, record it */ + d->dirty_vram->sl1ma[i] = pfn_to_paddr(mfn_x(sl1mfn)) + | ((paddr_t) sl1e & ~PAGE_MASK); + } +} + +static inline void shadow_vram_put_l1e(shadow_l1e_t old_sl1e, + shadow_l1e_t *sl1e, + mfn_t sl1mfn, + struct domain *d) +{ + mfn_t mfn; + unsigned long gfn; + + if ( !d->dirty_vram ) return; + + mfn = shadow_l1e_get_mfn(old_sl1e); + gfn = mfn_to_gfn(d, mfn); + + if ( (gfn >= d->dirty_vram->begin_pfn) && (gfn < d->dirty_vram->end_pfn) ) { + unsigned long i = gfn - d->dirty_vram->begin_pfn; + struct page_info *page = mfn_to_page(mfn); + u32 count_info = page->u.inuse.type_info & PGT_count_mask; + int dirty = 0; + paddr_t sl1ma = pfn_to_paddr(mfn_x(sl1mfn)) + | ((paddr_t) sl1e & ~PAGE_MASK); + + if ( count_info == 1 ) { + /* Last reference */ + if ( d->dirty_vram->sl1ma[i] == INVALID_PADDR ) { + /* We didn't know it was that one, let's say it is dirty */ + dirty = 1; + } else { + ASSERT(d->dirty_vram->sl1ma[i] == sl1ma); + d->dirty_vram->sl1ma[i] = INVALID_PADDR; + if ( shadow_l1e_get_flags(old_sl1e) & _PAGE_DIRTY ) + dirty = 1; + } + } else { + /* We had more than one reference, just consider the page dirty. */ + dirty = 1; + /* Check that it's not the one we recorded. */ + if ( d->dirty_vram->sl1ma[i] == sl1ma ) { + /* Too bad, we remembered the wrong one... */ + d->dirty_vram->sl1ma[i] = INVALID_PADDR; + } else { + /* Ok, our recorded sl1e is still pointing to this page, let's + * just hope it will remain. */ + } + } + if ( dirty ) + d->dirty_vram->dirty_bitmap[i / 8] |= d->dirty_vram->dirty_bitmap[i % 8]; + } +} + static int shadow_set_l1e(struct vcpu *v, shadow_l1e_t *sl1e, shadow_l1e_t new_sl1e, @@ -1275,6 +1349,8 @@ static int shadow_set_l1e(struct vcpu *v /* Doesn't look like a pagetable. */ flags |= SHADOW_SET_ERROR; new_sl1e = shadow_l1e_empty(); + } else { + shadow_vram_get_l1e(new_sl1e, sl1e, sl1mfn, d); } } } @@ -1293,6 +1369,7 @@ static int shadow_set_l1e(struct vcpu *v * trigger a flush later. */ if ( shadow_mode_refcounts(d) ) { + shadow_vram_put_l1e(old_sl1e, sl1e, sl1mfn, d); shadow_put_page_from_l1e(old_sl1e, d); } } @@ -2248,8 +2325,10 @@ void sh_destroy_l1_shadow(struct vcpu *v mfn_t sl1mfn = smfn; SHADOW_FOREACH_L1E(sl1mfn, sl1e, 0, 0, { if ( (shadow_l1e_get_flags(*sl1e) & _PAGE_PRESENT) - && !sh_l1e_is_magic(*sl1e) ) + && !sh_l1e_is_magic(*sl1e) ) { + shadow_vram_put_l1e(*sl1e, sl1e, sl1mfn, d); shadow_put_page_from_l1e(*sl1e, d); + } }); } diff -r cd5fa4e7993f -r b6aa55ca599e xen/arch/x86/mm/shadow/private.h --- a/xen/arch/x86/mm/shadow/private.h Fri May 02 14:35:27 2008 +0100 +++ b/xen/arch/x86/mm/shadow/private.h Fri May 02 15:08:27 2008 +0100 @@ -528,6 +528,15 @@ sh_mfn_is_dirty(struct domain *d, mfn_t return rv; } +/**************************************************************************/ +/* VRAM dirty tracking support */ + +struct sh_dirty_vram { + unsigned long begin_pfn; + unsigned long end_pfn; + paddr_t *sl1ma; + uint8_t *dirty_bitmap; +}; /**************************************************************************/ /* Shadow-page refcounting. */ diff -r cd5fa4e7993f -r b6aa55ca599e xen/include/asm-ia64/config.h --- a/xen/include/asm-ia64/config.h Fri May 02 14:35:27 2008 +0100 +++ b/xen/include/asm-ia64/config.h Fri May 02 15:08:27 2008 +0100 @@ -71,6 +71,7 @@ typedef int pid_t; // now needed for xen/include/mm.h typedef unsigned long paddr_t; +#define INVALID_PADDR (~0UL) // from include/linux/kernel.h #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) diff -r cd5fa4e7993f -r b6aa55ca599e xen/include/asm-powerpc/types.h --- a/xen/include/asm-powerpc/types.h Fri May 02 14:35:27 2008 +0100 +++ b/xen/include/asm-powerpc/types.h Fri May 02 15:08:27 2008 +0100 @@ -61,6 +61,7 @@ typedef unsigned long size_t; #endif typedef unsigned long paddr_t; +#define INVALID_PADDR (~0UL) #define PRIpaddr "08lx" /* DMA addresses come in generic and 64-bit flavours. */ diff -r cd5fa4e7993f -r b6aa55ca599e xen/include/asm-x86/shadow.h --- a/xen/include/asm-x86/shadow.h Fri May 02 14:35:27 2008 +0100 +++ b/xen/include/asm-x86/shadow.h Fri May 02 15:08:27 2008 +0100 @@ -62,6 +62,12 @@ void shadow_vcpu_init(struct vcpu *v); /* Enable an arbitrary shadow mode. Call once at domain creation. */ int shadow_enable(struct domain *d, u32 mode); +/* Enable VRAM dirty bit tracking. */ +int shadow_track_dirty_vram(struct domain *d, + unsigned long first_pfn, + unsigned long nr, + XEN_GUEST_HANDLE_64(uint8) dirty_bitmap); + /* Handler for shadow control ops: operations from user-space to enable * and disable ephemeral shadow modes (test mode and log-dirty mode) and * manipulate the log-dirty bitmap. */ diff -r cd5fa4e7993f -r b6aa55ca599e xen/include/asm-x86/types.h --- a/xen/include/asm-x86/types.h Fri May 02 14:35:27 2008 +0100 +++ b/xen/include/asm-x86/types.h Fri May 02 15:08:27 2008 +0100 @@ -38,15 +38,18 @@ typedef unsigned long long u64; typedef unsigned long long u64; #if defined(CONFIG_X86_PAE) typedef u64 paddr_t; +#define INVALID_PADDR (~0ULL) #define PRIpaddr "016llx" #else typedef unsigned long paddr_t; +#define INVALID_PADDR (~0UL) #define PRIpaddr "08lx" #endif #elif defined(__x86_64__) typedef signed long s64; typedef unsigned long u64; typedef unsigned long paddr_t; +#define INVALID_PADDR (~0UL) #define PRIpaddr "016lx" #endif diff -r cd5fa4e7993f -r b6aa55ca599e xen/include/public/hvm/hvm_op.h --- a/xen/include/public/hvm/hvm_op.h Fri May 02 14:35:27 2008 +0100 +++ b/xen/include/public/hvm/hvm_op.h Fri May 02 15:08:27 2008 +0100 @@ -73,4 +73,20 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_ /* Flushes all VCPU TLBs: @arg must be NULL. */ #define HVMOP_flush_tlbs 5 +/* Track dirty VRAM. */ +#define HVMOP_track_dirty_vram 6 +struct xen_hvm_track_dirty_vram { + /* Domain to be tracked. */ + domid_t domid; + /* First pfn to track. */ + uint64_aligned_t first_pfn; + /* Number of pages to track. */ + uint64_aligned_t nr; + /* OUT variable. */ + /* Dirty bitmap buffer. */ + XEN_GUEST_HANDLE_64(uint8) dirty_bitmap; +}; +typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t; +DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t); + #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ diff -r cd5fa4e7993f -r b6aa55ca599e xen/include/xen/sched.h --- a/xen/include/xen/sched.h Fri May 02 14:35:27 2008 +0100 +++ b/xen/include/xen/sched.h Fri May 02 15:08:27 2008 +0100 @@ -236,6 +236,9 @@ struct domain * cause a deadlock. Acquirers don't spin waiting; they preempt. */ spinlock_t hypercall_deadlock_mutex; + + /* VRAM dirty support. */ + struct sh_dirty_vram *dirty_vram; }; struct domain_setup_info _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 02 07:20:05 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 02 May 2008 07:20:05 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jrw7I-0005nQ-US for www-data@colo.xensource.com; Fri, 02 May 2008 07:20:05 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrw7p-000455-UG; Fri, 02 May 2008 14:20:37 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jrw7o-00044g-Mc for xen-changelog@lists.xensource.com; Fri, 02 May 2008 14:20:36 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jrw7i-0002Ua-Oj for xen-changelog@lists.xensource.com; Fri, 02 May 2008 14:20:34 +0000 X-SBRS: 3.6 X-MesageID: 117583 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,426,1204520400"; d="scan'208";a="117583" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 02 May 2008 10:19:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m42EJpCq014106 for ; Fri, 2 May 2008 07:19:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m42EK99s013439 for ; Fri, 2 May 2008 07:20:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m42EK8SO013438 for xen-changelog@lists.xensource.com; Fri, 2 May 2008 07:20:08 -0700 Message-Id: <200805021420.m42EK8SO013438@xenbits.xensource.com> Date: Fri, 02 May 2008 07:20:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add missing ChangeLog entries X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209737420 -3600 # Node ID 6bd4625a20ee529d9f92f096b39e7716f982c675 # Parent b6aa55ca599e3c626ea22d1ae1aceb5b9fb46cf2 Add missing ChangeLog entries A couple of recent changes need ChangeLog entries. Signed-off-by: John Levon --- docs/ChangeLog | 6 ++++++ 1 files changed, 6 insertions(+) diff -r b6aa55ca599e -r 6bd4625a20ee docs/ChangeLog --- a/docs/ChangeLog Fri May 02 15:08:27 2008 +0100 +++ b/docs/ChangeLog Fri May 02 15:10:20 2008 +0100 @@ -15,6 +15,12 @@ http://lists.xensource.com/archives/html Xen 3.3 release --------------- + +17538: Add XENPF_set_processor_pminfo +http://xenbits.xensource.com/xen-unstable.hg?rev/5bb9093eb0e9 + +17537: Add MSI support +http://xenbits.xensource.com/xen-unstable.hg?rev/ad55c06c9bbc 17524: Add DOMCTL_set_cpuid to configure guest CPUID on x86 systems. http://xenbits.xensource.com/xen-unstable.hg?rev/18727843db60 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sun May 04 00:40:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sun, 04 May 2008 00:40:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JsYpJ-000659-SX for www-data@colo.xensource.com; Sun, 04 May 2008 00:40:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JsYpq-0000Yd-W3; Sun, 04 May 2008 07:40:38 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JsYpp-0000YM-W3 for xen-changelog@lists.xensource.com; Sun, 04 May 2008 07:40:37 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JsYpj-0001TK-Aw for xen-changelog@lists.xensource.com; Sun, 04 May 2008 07:40:35 +0000 X-SBRS: 3.6 X-MesageID: 130934 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,433,1204520400"; d="scan'208";a="130934" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 04 May 2008 03:39:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m447dpd2015425 for ; Sun, 4 May 2008 00:39:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m447e8D5015875 for ; Sun, 4 May 2008 00:40:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m447e8MP015874 for xen-changelog@lists.xensource.com; Sun, 4 May 2008 00:40:08 -0700 Message-Id: <200805040740.m447e8MP015874@xenbits.xensource.com> Date: Sun, 04 May 2008 00:40:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] i386: Fix 32-bit x86 build. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209886320 -3600 # Node ID bb49aeae1ff24477f066c19aaf032f740bed369e # Parent 6bd4625a20ee529d9f92f096b39e7716f982c675 i386: Fix 32-bit x86 build. Signed-off-by: Keir Fraser --- xen/arch/x86/mm/shadow/multi.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -r 6bd4625a20ee -r bb49aeae1ff2 xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Fri May 02 15:10:20 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Sun May 04 08:32:00 2008 +0100 @@ -1272,7 +1272,7 @@ static inline void shadow_vram_get_l1e(s if ( count_info == 1 ) /* Initial guest reference, record it */ d->dirty_vram->sl1ma[i] = pfn_to_paddr(mfn_x(sl1mfn)) - | ((paddr_t) sl1e & ~PAGE_MASK); + | ((unsigned long)sl1e & ~PAGE_MASK); } } @@ -1294,8 +1294,8 @@ static inline void shadow_vram_put_l1e(s struct page_info *page = mfn_to_page(mfn); u32 count_info = page->u.inuse.type_info & PGT_count_mask; int dirty = 0; - paddr_t sl1ma = pfn_to_paddr(mfn_x(sl1mfn)) - | ((paddr_t) sl1e & ~PAGE_MASK); + paddr_t sl1ma = pfn_to_paddr(mfn_x(sl1mfn)) + | ((unsigned long)sl1e & ~PAGE_MASK); if ( count_info == 1 ) { /* Last reference */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 05 02:30:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 05 May 2008 02:30:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jsx1L-0006zJ-8r for www-data@colo.xensource.com; Mon, 05 May 2008 02:30:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx1t-0000Xr-Ey; Mon, 05 May 2008 09:30:41 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx1r-0000XV-Jy for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:39 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jsx1k-0001yz-QW for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:37 +0000 X-SBRS: 3.6 X-MesageID: 137353 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,437,1204520400"; d="scan'208";a="137353" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 May 2008 05:29:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m459TqaI017703 for ; Mon, 5 May 2008 02:29:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m459U9al006889 for ; Mon, 5 May 2008 02:30:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m459U9va006888 for xen-changelog@lists.xensource.com; Mon, 5 May 2008 02:30:09 -0700 Message-Id: <200805050930.m459U9va006888@xenbits.xensource.com> Date: Mon, 05 May 2008 02:30:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Calculation of MSI-X table size needs to be masked. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209978764 -3600 # Node ID eb046aff9f17471983a165d05e53fb190ee27a34 # Parent bb49aeae1ff24477f066c19aaf032f740bed369e Calculation of MSI-X table size needs to be masked. Signed-off-by: Espen Skoglund --- tools/python/xen/util/pci.py | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff -r bb49aeae1ff2 -r eb046aff9f17 tools/python/xen/util/pci.py --- a/tools/python/xen/util/pci.py Sun May 04 08:32:00 2008 +0100 +++ b/tools/python/xen/util/pci.py Mon May 05 10:12:44 2008 +0100 @@ -30,6 +30,7 @@ PCI_STATUS_OFFSET = 0x6 PCI_STATUS_OFFSET = 0x6 PCI_CAP_OFFSET = 0x34 MSIX_BIR_MASK = 0x7 +MSIX_SIZE_MASK = 0x3ff #Calculate PAGE_SHIFT: number of bits to shift an address to get the page number PAGE_SIZE = resource.getpagesize() @@ -120,8 +121,9 @@ class PciDevice: message_cont_lo = ord(conf_file.read(1)) message_cont_hi = ord(conf_file.read(1)) self.msix=1 - self.msix_entries = message_cont_lo + \ - message_cont_hi << 8 + self.msix_entries = (message_cont_lo + \ + message_cont_hi << 8) \ + & MSIX_SIZE_MASK t_off=conf_file.read(4) p_off=conf_file.read(4) self.table_offset=ord(t_off[0]) | (ord(t_off[1])<<8) | \ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 05 02:30:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 05 May 2008 02:30:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jsx1P-0006zX-Jz for www-data@colo.xensource.com; Mon, 05 May 2008 02:30:11 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx1x-0000bK-N7; Mon, 05 May 2008 09:30:45 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx1u-0000Xa-9W for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:42 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jsx1n-0001z1-KU for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:40 +0000 X-SBRS: 3.6 X-MesageID: 137354 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,437,1204520400"; d="scan'208";a="137354" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 May 2008 05:29:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m459TrMx017706 for ; Mon, 5 May 2008 02:29:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m459UAvN006906 for ; Mon, 5 May 2008 02:30:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m459UAb8006905 for xen-changelog@lists.xensource.com; Mon, 5 May 2008 02:30:10 -0700 Message-Id: <200805050930.m459UAb8006905@xenbits.xensource.com> Date: Mon, 05 May 2008 02:30:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] shadow: Fix dirty vram tracking typo. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209978797 -3600 # Node ID dab1301bc7229b5ca82a570e72ad02bfb3353dcd # Parent eb046aff9f17471983a165d05e53fb190ee27a34 shadow: Fix dirty vram tracking typo. Signed-off-by: Samuel Thibault --- xen/arch/x86/mm/shadow/multi.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r eb046aff9f17 -r dab1301bc722 xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Mon May 05 10:12:44 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Mon May 05 10:13:17 2008 +0100 @@ -1321,7 +1321,7 @@ static inline void shadow_vram_put_l1e(s } } if ( dirty ) - d->dirty_vram->dirty_bitmap[i / 8] |= d->dirty_vram->dirty_bitmap[i % 8]; + d->dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 05 02:30:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 05 May 2008 02:30:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jsx1T-0006zk-TK for www-data@colo.xensource.com; Mon, 05 May 2008 02:30:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx21-0000ec-In; Mon, 05 May 2008 09:30:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx1w-0000Yj-0x for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jsx1p-0001z2-3F for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:41 +0000 X-SBRS: 3.6 X-MesageID: 137355 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,437,1204520400"; d="scan'208";a="137355" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 May 2008 05:29:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m459Ts4I017709 for ; Mon, 5 May 2008 02:29:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m459UBEG006923 for ; Mon, 5 May 2008 02:30:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m459UBbs006922 for xen-changelog@lists.xensource.com; Mon, 5 May 2008 02:30:11 -0700 Message-Id: <200805050930.m459UBbs006922@xenbits.xensource.com> Date: Mon, 05 May 2008 02:30:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Enable Px/Cx related CPUID/MSR bits for dom0 to get correct Px/Cx info. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209978966 -3600 # Node ID 0eb471aa24dcaf14f309a985f44c075092fd3c8b # Parent dab1301bc7229b5ca82a570e72ad02bfb3353dcd Enable Px/Cx related CPUID/MSR bits for dom0 to get correct Px/Cx info. Signed-off-by: Wei Gang --- xen/arch/x86/traps.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff -r dab1301bc722 -r 0eb471aa24dc xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Mon May 05 10:13:17 2008 +0100 +++ b/xen/arch/x86/traps.c Mon May 05 10:16:06 2008 +0100 @@ -713,11 +713,13 @@ static int emulate_forced_invalid_op(str __clear_bit(X86_FEATURE_PBE, &d); __clear_bit(X86_FEATURE_DTES64 % 32, &c); - __clear_bit(X86_FEATURE_MWAIT % 32, &c); + if ( !IS_PRIV(current->domain) ) + __clear_bit(X86_FEATURE_MWAIT % 32, &c); __clear_bit(X86_FEATURE_DSCPL % 32, &c); __clear_bit(X86_FEATURE_VMXE % 32, &c); __clear_bit(X86_FEATURE_SMXE % 32, &c); - __clear_bit(X86_FEATURE_EST % 32, &c); + if ( !IS_PRIV(current->domain) ) + __clear_bit(X86_FEATURE_EST % 32, &c); __clear_bit(X86_FEATURE_TM2 % 32, &c); if ( is_pv_32bit_vcpu(current) ) __clear_bit(X86_FEATURE_CX16 % 32, &c); @@ -2146,8 +2148,9 @@ static int emulate_privileged_op(struct case MSR_IA32_MISC_ENABLE: if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) ) goto fail; - regs->eax &= ~(MSR_IA32_MISC_ENABLE_PERF_AVAIL | - MSR_IA32_MISC_ENABLE_MONITOR_ENABLE); + regs->eax &= ~MSR_IA32_MISC_ENABLE_PERF_AVAIL; + if ( !IS_PRIV(current->domain) ) + regs->eax &= ~MSR_IA32_MISC_ENABLE_MONITOR_ENABLE; regs->eax |= MSR_IA32_MISC_ENABLE_BTS_UNAVAIL | MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL | MSR_IA32_MISC_ENABLE_XTPR_DISABLE; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 05 02:30:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 05 May 2008 02:30:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jsx1X-0006zp-FZ for www-data@colo.xensource.com; Mon, 05 May 2008 02:30:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx25-0000i3-Pz; Mon, 05 May 2008 09:30:53 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx1x-0000Zt-1H for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jsx1q-0001yz-1i for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:42 +0000 X-SBRS: 3.6 X-MesageID: 137356 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,437,1204520400"; d="scan'208";a="137356" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 May 2008 05:29:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m459TtXf017712 for ; Mon, 5 May 2008 02:29:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m459UCxi006940 for ; Mon, 5 May 2008 02:30:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m459UCID006939 for xen-changelog@lists.xensource.com; Mon, 5 May 2008 02:30:12 -0700 Message-Id: <200805050930.m459UCID006939@xenbits.xensource.com> Date: Mon, 05 May 2008 02:30:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix the address calculation of acpi enable reg according to ACPI spec. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209979018 -3600 # Node ID ccbbe6fe5827b3a262b24f6dd7140de8ae3ec456 # Parent 0eb471aa24dcaf14f309a985f44c075092fd3c8b Fix the address calculation of acpi enable reg according to ACPI spec. Signed-off-by: Wei Gang --- xen/arch/x86/acpi/boot.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff -r 0eb471aa24dc -r ccbbe6fe5827 xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Mon May 05 10:16:06 2008 +0100 +++ b/xen/arch/x86/acpi/boot.c Mon May 05 10:16:58 2008 +0100 @@ -475,8 +475,12 @@ acpi_fadt_parse_reg(struct acpi_table_fa sizeof(acpi_gbl_xpm1a_enable)); memcpy(&acpi_gbl_xpm1b_enable, &fadt->xpm1b_event_block, sizeof(acpi_gbl_xpm1b_enable)); - acpi_gbl_xpm1a_enable.address += 2; - acpi_gbl_xpm1b_enable.address += 2; + + acpi_gbl_xpm1a_enable.address += + acpi_gbl_FADT.pm1_event_length / 2; + if ( acpi_gbl_xpm1b_enable.address ) + acpi_gbl_xpm1b_enable.address += + acpi_gbl_FADT.pm1_event_length / 2; } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 05 02:30:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 05 May 2008 02:30:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jsx1b-0006zv-K6 for www-data@colo.xensource.com; Mon, 05 May 2008 02:30:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx29-0000lc-TB; Mon, 05 May 2008 09:30:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx1y-0000at-Gv for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jsx1s-0001z1-Mh for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:44 +0000 X-SBRS: 3.6 X-MesageID: 137357 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,437,1204520400"; d="scan'208";a="137357" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 May 2008 05:29:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m459TuX5017715 for ; Mon, 5 May 2008 02:29:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m459UELH007005 for ; Mon, 5 May 2008 02:30:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m459UELV007004 for xen-changelog@lists.xensource.com; Mon, 5 May 2008 02:30:14 -0700 Message-Id: <200805050930.m459UELV007004@xenbits.xensource.com> Date: Mon, 05 May 2008 02:30:13 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Keep platform.h sync with Xen side. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209978865 -3600 # Node ID 26c60aa94b9f715027cf32cf5163ae9305e1abd4 # Parent a947207da4e49d003dff47fe47a27bf119b17740 Keep platform.h sync with Xen side. Signed-off-by: Wei Gang --- include/xen/interface/platform.h | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-) diff -r a947207da4e4 -r 26c60aa94b9f include/xen/interface/platform.h --- a/include/xen/interface/platform.h Thu May 01 11:28:23 2008 +0100 +++ b/include/xen/interface/platform.h Mon May 05 10:14:25 2008 +0100 @@ -239,11 +239,11 @@ DEFINE_XEN_GUEST_HANDLE(xen_processor_cx DEFINE_XEN_GUEST_HANDLE(xen_processor_cx_t); struct xen_processor_flags { - uint8_t bm_control:1; - uint8_t bm_check:1; - uint8_t has_cst:1; - uint8_t power_setup_done:1; - uint8_t bm_rld_set:1; + uint32_t bm_control:1; + uint32_t bm_check:1; + uint32_t has_cst:1; + uint32_t power_setup_done:1; + uint32_t bm_rld_set:1; }; struct xen_processor_power { @@ -252,20 +252,12 @@ struct xen_processor_power { XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */ }; -struct xen_processor_performance { -}; - -struct xen_processor_throttling { -}; - struct xenpf_set_processor_pminfo { /* IN variables */ uint32_t id; /* ACPI CPU ID */ - uint32_t type; /* {XEN_PM_CX, XEN_PM_PX, XEN_PM_TX} */ + uint32_t type; /* {XEN_PM_CX, ...} */ union { struct xen_processor_power power;/* Cx: _CST/_CSD */ - struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ - struct xen_processor_throttling throt;/* Tx: _TPC/_PTC/_TSS/_TSD */ }; }; typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 05 02:30:29 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 05 May 2008 02:30:29 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jsx1g-000700-Ux for www-data@colo.xensource.com; Mon, 05 May 2008 02:30:29 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx2F-0000p6-7J; Mon, 05 May 2008 09:31:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jsx22-0000dk-3E for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jsx1u-0001z2-FJ for xen-changelog@lists.xensource.com; Mon, 05 May 2008 09:30:47 +0000 X-SBRS: 3.6 X-MesageID: 137358 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,437,1204520400"; d="scan'208";a="137358" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 05 May 2008 05:29:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m459TvMM017718 for ; Mon, 5 May 2008 02:29:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m459UFJe007022 for ; Mon, 5 May 2008 02:30:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m459UFYv007021 for xen-changelog@lists.xensource.com; Mon, 5 May 2008 02:30:15 -0700 Message-Id: <200805050930.m459UFYv007021@xenbits.xensource.com> Date: Mon, 05 May 2008 02:30:14 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Isolate Xen PM related code in dom0 with #ifdef CONFIG_XEN to avoid X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1209979061 -3600 # Node ID e39cf97647af69cd0b09f4e91e539e26194b8a9f # Parent 26c60aa94b9f715027cf32cf5163ae9305e1abd4 Isolate Xen PM related code in dom0 with #ifdef CONFIG_XEN to avoid breaking native. Signed-off-by: Wei Gang --- arch/i386/kernel/acpi/processor.c | 19 +++++++---- arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 2 + drivers/acpi/processor_core.c | 45 ++++++++++++++++++++++++++++ drivers/acpi/processor_idle.c | 25 +++++++++++++++ drivers/acpi/processor_perflib.c | 8 +++- include/acpi/processor.h | 8 +++- 6 files changed, 95 insertions(+), 12 deletions(-) diff -r 26c60aa94b9f -r e39cf97647af arch/i386/kernel/acpi/processor.c --- a/arch/i386/kernel/acpi/processor.c Mon May 05 10:14:25 2008 +0100 +++ b/arch/i386/kernel/acpi/processor.c Mon May 05 10:17:41 2008 +0100 @@ -59,16 +59,21 @@ static void init_intel_pdc(struct acpi_p return; } -/* - * Initialize _PDC data based on the CPU vendor. As a work-around, just - * use cpu0's cpuinfo for all processors. Further work is required - * to expose xen hypervisor interface of getting physical cpuinfo to dom0 - * kerneland then arch_acpi_processor_init_pdc can set _PDC parameters - * according to Xen's phys information. - */ +/* Initialize _PDC data based on the CPU vendor */ void arch_acpi_processor_init_pdc(struct acpi_processor *pr) { +#ifdef CONFIG_XEN + /* + * As a work-around, just use cpu0's cpuinfo for all processors. + * Further work is required to expose xen hypervisor interface of + * getting physical cpuinfo to dom0 kernel and then + * arch_acpi_processor_init_pdc can set _PDC parameters according + * to Xen's phys information. + */ unsigned int cpu = 0; +#else + unsigned int cpu = pr->id; +#endif /* CONFIG_XEN */ struct cpuinfo_x86 *c = cpu_data + cpu; pr->pdc = NULL; diff -r 26c60aa94b9f -r e39cf97647af arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c Mon May 05 10:14:25 2008 +0100 +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c Mon May 05 10:17:41 2008 +0100 @@ -568,6 +568,7 @@ acpi_cpufreq_init (void) { dprintk("acpi_cpufreq_init\n"); +#ifdef CONFIG_XEN /* * This effectively blocks in-kernel cpufreq driver to interfere * external control logic @@ -576,6 +577,7 @@ acpi_cpufreq_init (void) printk("CPUFREQ is controllerd externally...exit then!\n"); return -1; } +#endif /* CONFIG_XEN */ acpi_cpufreq_early_init_acpi(); diff -r 26c60aa94b9f -r e39cf97647af drivers/acpi/processor_core.c --- a/drivers/acpi/processor_core.c Mon May 05 10:14:25 2008 +0100 +++ b/drivers/acpi/processor_core.c Mon May 05 10:17:41 2008 +0100 @@ -474,9 +474,14 @@ static int acpi_processor_get_info(struc * they are physically not present. */ if (cpu_index == -1) { +#ifdef CONFIG_XEN if (ACPI_FAILURE (acpi_processor_hotadd_init(pr->handle, &pr->id)) && !processor_cntl_external()) { +#else + if (ACPI_FAILURE + (acpi_processor_hotadd_init(pr->handle, &pr->id))) { +#endif /* CONFIG_XEN */ printk(KERN_ERR PREFIX "Getting cpuindex for acpiid 0x%x\n", pr->acpi_id); @@ -518,7 +523,11 @@ static int acpi_processor_get_info(struc return 0; } +#ifdef CONFIG_XEN static void *processor_device_array[NR_ACPI_CPUS]; +#else +static void *processor_device_array[NR_CPUS]; +#endif /* CONFIG_XEN */ static int acpi_processor_start(struct acpi_device *device) { @@ -530,29 +539,48 @@ static int acpi_processor_start(struct a pr = acpi_driver_data(device); result = acpi_processor_get_info(pr); +#ifdef CONFIG_XEN if (result || ((pr->id == -1) && !processor_cntl_external())) { +#else + if (result) { +#endif /* CONFIG_XEN */ /* Processor is physically not present */ return 0; } +#ifdef CONFIG_XEN BUG_ON(!processor_cntl_external() && ((pr->id >= NR_CPUS) || (pr->id < 0))); +#else + BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); +#endif /* CONFIG_XEN */ /* * Buggy BIOS check * ACPI id of processors can be reported wrongly by the BIOS. * Don't trust it blindly */ +#ifdef CONFIG_XEN if (processor_device_array[pr->acpi_id] != NULL && processor_device_array[pr->acpi_id] != (void *)device) { +#else + if (processor_device_array[pr->id] != NULL && + processor_device_array[pr->id] != (void *)device) { +#endif /* CONFIG_XEN */ printk(KERN_WARNING "BIOS reported wrong ACPI id" "for the processor\n"); return -ENODEV; } +#ifdef CONFIG_XEN processor_device_array[pr->acpi_id] = (void *)device; if (pr->id != -1) processors[pr->id] = pr; +#else + processor_device_array[pr->id] = (void *)device; + + processors[pr->id] = pr; +#endif /* CONFIG_XEN */ result = acpi_processor_add_fs(device); if (result) @@ -663,8 +691,13 @@ static int acpi_processor_remove(struct acpi_processor_remove_fs(device); +#ifdef CONFIG_XEN if (pr->id != -1) processors[pr->id] = NULL; +#else + processors[pr->id] = NULL; +#endif /* CONFIG_XEN */ + kfree(pr); @@ -718,9 +751,11 @@ int acpi_processor_device_add(acpi_handl if (!pr) return -ENODEV; +#ifdef CONFIG_XEN if (processor_cntl_external()) processor_notify_external(pr, PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD); +#endif /* CONFIG_XEN */ if ((pr->id >= 0) && (pr->id < NR_CPUS)) { kobject_uevent(&(*device)->kobj, KOBJ_ONLINE); @@ -760,9 +795,11 @@ acpi_processor_hotplug_notify(acpi_handl break; } +#ifdef CONFIG_XEN if (processor_cntl_external()) processor_notify_external(pr, PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD); +#endif /* CONFIG_XEN */ if (pr->id >= 0 && (pr->id < NR_CPUS)) { kobject_uevent(&device->kobj, KOBJ_OFFLINE); @@ -793,13 +830,19 @@ acpi_processor_hotplug_notify(acpi_handl return; } +#ifdef CONFIG_XEN if ((pr->id >= 0) && (pr->id < NR_CPUS) && (cpu_present(pr->id))) +#else + if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) +#endif /* CONFIG_XEN */ kobject_uevent(&device->kobj, KOBJ_OFFLINE); +#ifdef CONFIG_XEN if (processor_cntl_external()) processor_notify_external(pr, PROCESSOR_HOTPLUG, HOTPLUG_TYPE_REMOVE); +#endif /* CONFIG_XEN */ break; default: @@ -865,8 +908,10 @@ static acpi_status acpi_processor_hotadd static int acpi_processor_handle_eject(struct acpi_processor *pr) { +#ifdef CONFIG_XEN if (pr->id == -1) return (0); +#endif /* CONFIG_XEN */ if (cpu_online(pr->id)) { return (-EINVAL); diff -r 26c60aa94b9f -r e39cf97647af drivers/acpi/processor_idle.c --- a/drivers/acpi/processor_idle.c Mon May 05 10:14:25 2008 +0100 +++ b/drivers/acpi/processor_idle.c Mon May 05 10:17:41 2008 +0100 @@ -714,12 +714,17 @@ static int acpi_processor_get_power_info (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) continue; +#ifdef CONFIG_XEN if (!processor_pm_external()) cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? 0 : reg->address; else cx.address = reg->address; +#else + cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? + 0 : reg->address; +#endif /* CONFIG_XEN */ /* There should be an easy way to extract an integer... */ obj = (union acpi_object *)&(element->package.elements[1]); @@ -728,11 +733,17 @@ static int acpi_processor_get_power_info cx.type = obj->integer.value; +#ifdef CONFIG_XEN /* Following check doesn't apply to external control case */ if (!processor_pm_external()) if ((cx.type != ACPI_STATE_C1) && (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) continue; +#else + if ((cx.type != ACPI_STATE_C1) && + (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) + continue; +#endif /* CONFIG_XEN */ if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3)) continue; @@ -997,16 +1008,24 @@ int acpi_processor_cst_has_changed(struc return -ENODEV; /* Fall back to the default idle loop */ +#ifdef CONFIG_XEN if (!processor_pm_external()) pm_idle = pm_idle_save; +#else + pm_idle = pm_idle_save; +#endif /* CONFIG_XEN */ synchronize_sched(); /* Relies on interrupts forcing exit from idle. */ pr->flags.power = 0; result = acpi_processor_get_power_info(pr); +#ifdef CONFIG_XEN if (processor_pm_external()) processor_notify_external(pr, PROCESSOR_PM_CHANGE, PM_TYPE_IDLE); else if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) +#else + if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) +#endif /* CONFIG_XEN */ pm_idle = acpi_processor_idle; return result; @@ -1138,7 +1157,11 @@ int acpi_processor_power_init(struct acp pr->power.states[i].type); printk(")\n"); +#ifdef CONFIG_XEN if (!processor_pm_external() && (pr->id == 0)) { +#else + if (pr->id == 0) { +#endif /* CONFIG_XEN */ pm_idle_save = pm_idle; pm_idle = acpi_processor_idle; } @@ -1157,9 +1180,11 @@ int acpi_processor_power_init(struct acp pr->flags.power_setup_done = 1; +#ifdef CONFIG_XEN if (processor_pm_external()) processor_notify_external(pr, PROCESSOR_PM_INIT, PM_TYPE_IDLE); +#endif /* CONFIG_XEN */ return 0; } diff -r 26c60aa94b9f -r e39cf97647af drivers/acpi/processor_perflib.c --- a/drivers/acpi/processor_perflib.c Mon May 05 10:14:25 2008 +0100 +++ b/drivers/acpi/processor_perflib.c Mon May 05 10:17:41 2008 +0100 @@ -136,11 +136,13 @@ int acpi_processor_ppc_has_changed(struc int ret = acpi_processor_get_platform_limit(pr); if (ret < 0) return (ret); - else if (!processor_pmperf_external()) - return cpufreq_update_policy(pr->id); - else +#ifdef CONFIG_XEN + else if (processor_pmperf_external()) return processor_notify_external(pr, PROCESSOR_PM_CHANGE, PM_TYPE_PERF); +#endif /* CONFIG_XEN */ + else + return cpufreq_update_policy(pr->id); } void acpi_processor_ppc_init(void) diff -r 26c60aa94b9f -r e39cf97647af include/acpi/processor.h --- a/include/acpi/processor.h Mon May 05 10:14:25 2008 +0100 +++ b/include/acpi/processor.h Mon May 05 10:17:41 2008 +0100 @@ -21,7 +21,9 @@ #define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */ #define ACPI_PSD_REV0_ENTRIES 5 +#ifdef CONFIG_XEN #define NR_ACPI_CPUS 256 +#endif /* CONFIG_XEN */ /* * Types of coordination defined in ACPI 3.0. Same macros can be used across @@ -294,6 +296,7 @@ static inline void acpi_thermal_cpufreq_ } #endif +#ifdef CONFIG_XEN /* * Following are interfaces geared to external processor PM control * logic like a VMM @@ -365,5 +368,6 @@ static inline int processor_extcntl_init return -EINVAL; } #endif /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */ - -#endif +#endif /* CONFIG_XEN */ + +#endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 06:00:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 06:00:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtMm5-0004mJ-Hw for www-data@colo.xensource.com; Tue, 06 May 2008 06:00:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMme-0007ve-8B; Tue, 06 May 2008 13:00:40 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmc-0007ug-Fo for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:38 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtMmW-0003Sw-1g for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:36 +0000 X-SBRS: 3.6 X-MesageID: 148837 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="148837" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 08:59:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46Cxo9n021832 for ; Tue, 6 May 2008 05:59:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46D08h0002880 for ; Tue, 6 May 2008 06:00:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46D08cC002879 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 06:00:08 -0700 Message-Id: <200805061300.m46D08cC002879@xenbits.xensource.com> Date: Tue, 06 May 2008 06:00:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,INFO_TLD autolearn=no version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Refactor security.on() call X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210064752 -3600 # Node ID 94c6501c4ffef716c4445ee2dd8074a497a9a3ce # Parent ccbbe6fe5827b3a262b24f6dd7140de8ae3ec456 xend: Refactor security.on() call I am refactoring the security.on() call to return the actual type of the security module that is found to be enabled rather than just returning True or False. Signed-off-by: Stefan Berger --- tools/python/xen/util/xsm/acm/acm.py | 4 +++- tools/python/xen/util/xsm/flask/flask.py | 2 +- tools/python/xen/xend/XendConfig.py | 2 +- tools/python/xen/xend/XendDomainInfo.py | 6 +++--- tools/python/xen/xend/XendXSPolicyAdmin.py | 8 +++++++- tools/python/xen/xend/server/blkif.py | 3 ++- tools/python/xen/xend/server/netif.py | 3 ++- tools/python/xen/xm/addlabel.py | 10 +++++----- tools/python/xen/xm/dry-run.py | 5 +++-- 9 files changed, 27 insertions(+), 16 deletions(-) diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/util/xsm/acm/acm.py --- a/tools/python/xen/util/xsm/acm/acm.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/util/xsm/acm/acm.py Tue May 06 10:05:52 2008 +0100 @@ -156,7 +156,9 @@ def on(): returns none if security policy is off (not compiled), any string otherwise, use it: if not security.on() ... """ - return (get_active_policy_name() not in ['INACTIVE', 'NULL']) + if get_active_policy_name() not in ['INACTIVE', 'NULL', '']: + return xsconstants.XS_POLICY_ACM + return 0 def calc_dom_ssidref_from_info(info): diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/util/xsm/flask/flask.py --- a/tools/python/xen/util/xsm/flask/flask.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/util/xsm/flask/flask.py Tue May 06 10:05:52 2008 +0100 @@ -12,7 +12,7 @@ def err(msg): raise XSMError(msg) def on(): - return 1 + return 0 #xsconstants.XS_POLICY_FLASK def ssidref2label(ssidref): try: diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/xend/XendConfig.py Tue May 06 10:05:52 2008 +0100 @@ -688,7 +688,7 @@ class XendConfig(dict): self.parse_cpuid(cfg, 'cpuid_check') import xen.util.xsm.xsm as security - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: from xen.util.acmpolicy import ACM_LABEL_UNLABELED if not 'security' in cfg and sxp.child_value(sxp_cfg, 'security'): cfg['security'] = sxp.child_value(sxp_cfg, 'security') diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue May 06 10:05:52 2008 +0100 @@ -37,6 +37,7 @@ from xen.util import asserts from xen.util import asserts from xen.util.blkif import blkdev_uname_to_file, blkdev_uname_to_taptype import xen.util.xsm.xsm as security +from xen.util import xsconstants from xen.xend import balloon, sxp, uuid, image, arch, osdep from xen.xend import XendOptions, XendNode, XendConfig @@ -1973,7 +1974,7 @@ class XendDomainInfo: balloon.free(2*1024) # 2MB should be plenty ssidref = 0 - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: ssidref = security.calc_dom_ssidref_from_info(self.info) if security.has_authorization(ssidref) == False: raise VmError("VM is not authorized to run.") @@ -1987,7 +1988,7 @@ class XendDomainInfo: target = self.info.target()) except Exception, e: # may get here if due to ACM the operation is not permitted - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: raise VmError('Domain in conflict set with running domain?') if self.domid < 0: @@ -2853,7 +2854,6 @@ class XendDomainInfo: is_policy_update = (xspol_old != None) from xen.xend.XendXSPolicyAdmin import XSPolicyAdminInstance - from xen.util import xsconstants state = self._stateGet() # Relabel only HALTED or RUNNING or PAUSED domains diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/xend/XendXSPolicyAdmin.py --- a/tools/python/xen/xend/XendXSPolicyAdmin.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/xend/XendXSPolicyAdmin.py Tue May 06 10:05:52 2008 +0100 @@ -48,6 +48,10 @@ class XSPolicyAdmin: self.xsobjs = {} bootloader.init() + if security.on() == xsconstants.XS_POLICY_ACM: + self.__acm_init() + + def __acm_init(self): act_pol_name = self.get_hv_loaded_policy_name() initialize() @@ -74,7 +78,7 @@ class XSPolicyAdmin: This currently only checks for ACM-enablement. """ rc = 0 - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: rc |= xsconstants.XS_POLICY_ACM return rc @@ -104,6 +108,8 @@ class XSPolicyAdmin: def __add_acmpolicy_to_system(self, xmltext, flags, overwrite): errors = "" + if security.on() != xsconstants.XS_POLICY_ACM: + raise SecurityError(-xsconstants.XSERR_POLICY_TYPE_UNSUPPORTED) loadedpol = self.get_loaded_policy() if loadedpol: # This is meant as an update to a currently loaded policy diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/xend/server/blkif.py Tue May 06 10:05:52 2008 +0100 @@ -23,6 +23,7 @@ import xen.util.xsm.xsm as security import xen.util.xsm.xsm as security from xen.xend.XendError import VmError from xen.xend.server.DevController import DevController +from xen.util import xsconstants class BlkifController(DevController): """Block device interface controller. Handles all block devices @@ -72,7 +73,7 @@ class BlkifController(DevController): if uuid: back['uuid'] = uuid - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: self.do_access_control(config, uname) devid = blkif.blkdev_name_to_number(dev) diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/xend/server/netif.py --- a/tools/python/xen/xend/server/netif.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/xend/server/netif.py Tue May 06 10:05:52 2008 +0100 @@ -29,6 +29,7 @@ from xen.xend.XendError import VmError from xen.xend.XendError import VmError from xen.xend.XendXSPolicyAdmin import XSPolicyAdminInstance import xen.util.xsm.xsm as security +from xen.util import xsconstants from xen.xend.XendLogging import log @@ -155,7 +156,7 @@ class NetifController(DevController): front = { 'handle' : "%i" % devid, 'mac' : mac } - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: self.do_access_control(config) return (devid, back, front) diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/xm/addlabel.py --- a/tools/python/xen/xm/addlabel.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/xm/addlabel.py Tue May 06 10:05:52 2008 +0100 @@ -205,17 +205,17 @@ def main(argv): policy_type = "" if len(argv) not in (4, 5): raise OptionError('Needs either 2 or 3 arguments') - + label = argv[1] - + if len(argv) == 5: policyref = argv[4] - elif security.on(): + elif security.on() == xsconstants.XS_POLICY_ACM: policyref = security.active_policy policy_type = xsconstants.ACM_POLICY_ID else: - raise OptionError("No active policy. Must specify policy on the " - "command line.") + raise OptionError("ACM security is not enabled. You must specify "\ + "the policy on the command line.") if argv[2].lower() == "dom": configfile = argv[3] diff -r ccbbe6fe5827 -r 94c6501c4ffe tools/python/xen/xm/dry-run.py --- a/tools/python/xen/xm/dry-run.py Mon May 05 10:16:58 2008 +0100 +++ b/tools/python/xen/xm/dry-run.py Tue May 06 10:05:52 2008 +0100 @@ -22,6 +22,7 @@ import xen.util.xsm.xsm as security import xen.util.xsm.xsm as security from xen.xm import create from xen.xend import sxp +from xen.util import xsconstants from xen.xm.opts import OptionError def help(): @@ -40,7 +41,7 @@ def check_domain_label(config, verbose): answer = 0 default_label = None secon = 0 - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: default_label = security.ssidref2label(security.NULL_SSIDREF) secon = 1 @@ -90,7 +91,7 @@ def config_security_check(config, verbos domain_policy = sxp.child_value(sxp.name(sxp.child0(x)), 'policy') # if no domain label, use default - if not domain_label and security.on(): + if not domain_label and security.on() == xsconstants.XS_POLICY_ACM: try: domain_label = security.ssidref2label(security.NULL_SSIDREF) except: _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 06:00:11 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 06:00:11 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtMmA-0004mP-Pf for www-data@colo.xensource.com; Tue, 06 May 2008 06:00:11 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmj-0007ym-JB; Tue, 06 May 2008 13:00:45 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmh-0007ww-BG for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:43 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtMmY-0003Sy-KT for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:41 +0000 X-SBRS: 3.6 X-MesageID: 148838 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="148838" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 08:59:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46CxpTT021835 for ; Tue, 6 May 2008 05:59:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46D09pM002897 for ; Tue, 6 May 2008 06:00:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46D0923002896 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 06:00:09 -0700 Message-Id: <200805061300.m46D0923002896@xenbits.xensource.com> Date: Tue, 06 May 2008 06:00:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86, hvm: stdvga cache always on X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210065550 -3600 # Node ID d5589865bfce91bf65c34bd56e466bf26ca4176f # Parent 94c6501c4ffef716c4445ee2dd8074a497a9a3ce x86, hvm: stdvga cache always on currently the hypervisor vga cache (stdvga.c) enables itself only in graphical mode and in the a0000h-affffh range. However there is no reason for this: it already allocates enought memory to map the whole vram. I am attaching a patch that implements the bank switching mechanism in stdvga.c, allowing the cache to be always enabled when the emulated graphic card is in VGA mode. Signed-off-by: Stefano Stabellini Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/stdvga.c | 55 +++++++++++++++++++++++++++++++++++++--------- 1 files changed, 45 insertions(+), 10 deletions(-) diff -r 94c6501c4ffe -r d5589865bfce xen/arch/x86/hvm/stdvga.c --- a/xen/arch/x86/hvm/stdvga.c Tue May 06 10:05:52 2008 +0100 +++ b/xen/arch/x86/hvm/stdvga.c Tue May 06 10:19:10 2008 +0100 @@ -131,14 +131,15 @@ static int stdvga_outb(uint64_t addr, ui /* When in standard vga mode, emulate here all writes to the vram buffer * so we can immediately satisfy reads without waiting for qemu. */ - s->stdvga = - (s->sr[7] == 0x00) && /* standard vga mode */ - (s->gr[6] == 0x05); /* misc graphics register w/ MemoryMapSelect=1 - * 0xa0000-0xaffff (64k region), AlphaDis=1 */ + s->stdvga = (s->sr[7] == 0x00); if ( !prev_stdvga && s->stdvga ) { - s->cache = 1; /* (re)start caching video buffer */ + /* + * (Re)start caching of video buffer. + * XXX TODO: In case of a restart the cache could be unsynced. + */ + s->cache = 1; gdprintk(XENLOG_INFO, "entering stdvga and caching modes\n"); } else if ( prev_stdvga && !s->stdvga ) @@ -180,6 +181,40 @@ static int stdvga_intercept_pio( } return X86EMUL_UNHANDLEABLE; /* propagate to external ioemu */ +} + +static unsigned int stdvga_mem_offset( + struct hvm_hw_stdvga *s, unsigned int mmio_addr) +{ + unsigned int memory_map_mode = (s->gr[6] >> 2) & 3; + unsigned int offset = mmio_addr & 0x1ffff; + + switch ( memory_map_mode ) + { + case 0: + break; + case 1: + if ( offset >= 0x10000 ) + goto fail; + offset += 0; /* assume bank_offset == 0; */ + break; + case 2: + offset -= 0x10000; + if ( offset >= 0x8000 ) + goto fail; + break; + default: + case 3: + offset -= 0x18000; + if ( offset >= 0x8000 ) + goto fail; + break; + } + + return offset; + + fail: + return ~0u; } #define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff) @@ -191,8 +226,8 @@ static uint8_t stdvga_mem_readb(uint64_t uint32_t ret, *vram_l; uint8_t *vram_b; - addr &= 0x1ffff; - if ( addr >= 0x10000 ) + addr = stdvga_mem_offset(s, addr); + if ( addr == ~0u ) return 0xff; if ( s->sr[4] & 0x08 ) @@ -273,8 +308,8 @@ static void stdvga_mem_writeb(uint64_t a uint32_t write_mask, bit_mask, set_mask, *vram_l; uint8_t *vram_b; - addr &= 0x1ffff; - if ( addr >= 0x10000 ) + addr = stdvga_mem_offset(s, addr); + if ( addr == ~0u ) return; if ( s->sr[4] & 0x08 ) @@ -531,7 +566,7 @@ void stdvga_init(struct domain *d) register_portio_handler(d, 0x3ce, 2, stdvga_intercept_pio); /* MMIO. */ register_buffered_io_handler( - d, 0xa0000, 0x10000, stdvga_intercept_mmio); + d, 0xa0000, 0x20000, stdvga_intercept_mmio); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 06:00:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 06:00:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtMmD-0004mT-0q for www-data@colo.xensource.com; Tue, 06 May 2008 06:00:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMml-00081f-Po; Tue, 06 May 2008 13:00:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmi-0007xH-1Y for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtMma-0003Sw-UE for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:41 +0000 X-SBRS: 3.6 X-MesageID: 148840 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="148840" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 08:59:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46CxrdQ021841 for ; Tue, 6 May 2008 05:59:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46D0BUe002931 for ; Tue, 6 May 2008 06:00:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46D0BQC002930 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 06:00:11 -0700 Message-Id: <200805061300.m46D0BQC002930@xenbits.xensource.com> Date: Tue, 06 May 2008 06:00:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Simplify and consolidate logic for HLT emulation. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210068300 -3600 # Node ID e6f20d5ed5fe7e24eab12977d812bd499794ba30 # Parent 777f294e3be81a4d0825e3a9b633a8d81c37f613 x86 hvm: Simplify and consolidate logic for HLT emulation. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hvm.c | 10 +++++++++- xen/arch/x86/hvm/svm/svm.c | 14 +------------- xen/arch/x86/hvm/vmx/vmx.c | 18 +----------------- 3 files changed, 11 insertions(+), 31 deletions(-) diff -r 777f294e3be8 -r e6f20d5ed5fe xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Tue May 06 10:25:34 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Tue May 06 11:05:00 2008 +0100 @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -739,15 +740,22 @@ void hvm_send_assist_req(struct vcpu *v) void hvm_hlt(unsigned long rflags) { + struct vcpu *curr = current; + + if ( hvm_event_pending(curr) ) + return; + /* * If we halt with interrupts disabled, that's a pretty sure sign that we * want to shut down. In a real processor, NMIs are the only way to break * out of this. */ if ( unlikely(!(rflags & X86_EFLAGS_IF)) ) - return hvm_vcpu_down(current); + return hvm_vcpu_down(curr); do_sched_op_compat(SCHEDOP_block, 0); + + HVMTRACE_1D(HLT, curr, /* pending = */ vcpu_runnable(curr)); } void hvm_triple_fault(void) diff -r 777f294e3be8 -r e6f20d5ed5fe xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Tue May 06 10:25:34 2008 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Tue May 06 11:05:00 2008 +0100 @@ -1099,25 +1099,13 @@ static void svm_vmexit_do_hlt(struct vmc static void svm_vmexit_do_hlt(struct vmcb_struct *vmcb, struct cpu_user_regs *regs) { - struct vcpu *curr = current; - struct hvm_intack intack = hvm_vcpu_has_pending_irq(curr); unsigned int inst_len; - inst_len = __get_instruction_length(curr, INSTR_HLT, NULL); + inst_len = __get_instruction_length(current, INSTR_HLT, NULL); if ( inst_len == 0 ) return; __update_guest_eip(regs, inst_len); - /* Check for pending exception or new interrupt. */ - if ( vmcb->eventinj.fields.v || - ((intack.source != hvm_intsrc_none) && - !hvm_interrupt_blocked(current, intack)) ) - { - HVMTRACE_1D(HLT, curr, /*int pending=*/ 1); - return; - } - - HVMTRACE_1D(HLT, curr, /*int pending=*/ 0); hvm_hlt(regs->eflags); } diff -r 777f294e3be8 -r e6f20d5ed5fe xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Tue May 06 10:25:34 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue May 06 11:05:00 2008 +0100 @@ -1857,22 +1857,6 @@ gp_fault: return X86EMUL_EXCEPTION; } -static void vmx_do_hlt(struct cpu_user_regs *regs) -{ - unsigned long intr_info = __vmread(VM_ENTRY_INTR_INFO); - struct vcpu *curr = current; - - /* Check for pending exception. */ - if ( intr_info & INTR_INFO_VALID_MASK ) - { - HVMTRACE_1D(HLT, curr, /*int pending=*/ 1); - return; - } - - HVMTRACE_1D(HLT, curr, /*int pending=*/ 0); - hvm_hlt(regs->eflags); -} - static void vmx_do_extint(struct cpu_user_regs *regs) { unsigned int vector; @@ -2187,7 +2171,7 @@ asmlinkage void vmx_vmexit_handler(struc case EXIT_REASON_HLT: inst_len = __get_instruction_length(); /* Safe: HLT */ __update_guest_eip(inst_len); - vmx_do_hlt(regs); + hvm_hlt(regs->eflags); break; case EXIT_REASON_INVLPG: { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 06:00:17 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 06:00:17 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtMmG-0004mZ-TE for www-data@colo.xensource.com; Tue, 06 May 2008 06:00:17 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmp-000855-Jd; Tue, 06 May 2008 13:00:51 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmi-0007xL-6h for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtMmZ-0003T0-Ln for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:42 +0000 X-SBRS: 3.6 X-MesageID: 148839 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="148839" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 08:59:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46Cxqk2021838 for ; Tue, 6 May 2008 05:59:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46D0At0002914 for ; Tue, 6 May 2008 06:00:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46D0AWo002913 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 06:00:10 -0700 Message-Id: <200805061300.m46D0AWo002913@xenbits.xensource.com> Date: Tue, 06 May 2008 06:00:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86, Intel: Make only EST feature visible to dom0 to enable Cx-state X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210065934 -3600 # Node ID 777f294e3be81a4d0825e3a9b633a8d81c37f613 # Parent d5589865bfce91bf65c34bd56e466bf26ca4176f x86, Intel: Make only EST feature visible to dom0 to enable Cx-state logic. There should be no need to make MWAIT visible. Signed-off-by: Keir Fraser --- xen/arch/x86/traps.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff -r d5589865bfce -r 777f294e3be8 xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Tue May 06 10:19:10 2008 +0100 +++ b/xen/arch/x86/traps.c Tue May 06 10:25:34 2008 +0100 @@ -713,8 +713,7 @@ static int emulate_forced_invalid_op(str __clear_bit(X86_FEATURE_PBE, &d); __clear_bit(X86_FEATURE_DTES64 % 32, &c); - if ( !IS_PRIV(current->domain) ) - __clear_bit(X86_FEATURE_MWAIT % 32, &c); + __clear_bit(X86_FEATURE_MWAIT % 32, &c); __clear_bit(X86_FEATURE_DSCPL % 32, &c); __clear_bit(X86_FEATURE_VMXE % 32, &c); __clear_bit(X86_FEATURE_SMXE % 32, &c); @@ -2148,9 +2147,8 @@ static int emulate_privileged_op(struct case MSR_IA32_MISC_ENABLE: if ( rdmsr_safe(regs->ecx, regs->eax, regs->edx) ) goto fail; - regs->eax &= ~MSR_IA32_MISC_ENABLE_PERF_AVAIL; - if ( !IS_PRIV(current->domain) ) - regs->eax &= ~MSR_IA32_MISC_ENABLE_MONITOR_ENABLE; + regs->eax &= ~(MSR_IA32_MISC_ENABLE_PERF_AVAIL | + MSR_IA32_MISC_ENABLE_MONITOR_ENABLE); regs->eax |= MSR_IA32_MISC_ENABLE_BTS_UNAVAIL | MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL | MSR_IA32_MISC_ENABLE_XTPR_DISABLE; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 06:00:20 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 06:00:20 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtMmJ-0004md-Q7 for www-data@colo.xensource.com; Tue, 06 May 2008 06:00:20 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMms-00088Q-Hy; Tue, 06 May 2008 13:00:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmm-00080i-Qr for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtMmf-0003Sy-Nn for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:46 +0000 X-SBRS: 3.6 X-MesageID: 148841 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="148841" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 08:59:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46CxslS021844 for ; Tue, 6 May 2008 05:59:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46D0CG4002948 for ; Tue, 6 May 2008 06:00:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46D0C3n002947 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 06:00:12 -0700 Message-Id: <200805061300.m46D0C3n002947@xenbits.xensource.com> Date: Tue, 06 May 2008 06:00:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] SVM: clean up __get_instruction_length_from_list() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210077138 -3600 # Node ID 01aa7c088e983cd54b61faeb3ff533581714a26f # Parent e6f20d5ed5fe7e24eab12977d812bd499794ba30 SVM: clean up __get_instruction_length_from_list() Remove unused arguments, fix its behaviour near page boundaries, inject appropriate pagefaults, and inject #GP if the instruction is not decodable or %eip is not pointing to valid RAM. Signed-off-by: Tim Deegan Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/svm/emulate.c | 115 +++++++++++++++++----------------- xen/arch/x86/hvm/svm/svm.c | 68 ++++++++++---------- xen/include/asm-x86/hvm/svm/emulate.h | 11 +-- 3 files changed, 100 insertions(+), 94 deletions(-) diff -r e6f20d5ed5fe -r 01aa7c088e98 xen/arch/x86/hvm/svm/emulate.c --- a/xen/arch/x86/hvm/svm/emulate.c Tue May 06 11:05:00 2008 +0100 +++ b/xen/arch/x86/hvm/svm/emulate.c Tue May 06 13:32:18 2008 +0100 @@ -28,18 +28,6 @@ #include #define MAX_INST_LEN 15 - -static int inst_copy_from_guest( - unsigned char *buf, unsigned long guest_eip, int inst_len) -{ - struct vmcb_struct *vmcb = current->arch.hvm_svm.vmcb; - uint32_t pfec = (vmcb->cpl == 3) ? PFEC_user_mode : 0; - if ( (inst_len > MAX_INST_LEN) || (inst_len <= 0) ) - return 0; - if ( hvm_fetch_from_guest_virt_nofault(buf, guest_eip, inst_len, pfec) ) - return 0; - return inst_len; -} static unsigned int is_prefix(u8 opc) { @@ -73,12 +61,7 @@ static unsigned long svm_rip2pointer(str return p; } -/* - * Here's how it works: - * First byte: Length. - * Following bytes: Opcode bytes. - * Special case: Last byte, if zero, doesn't need to match. - */ +/* First byte: Length. Following bytes: Opcode bytes. */ #define MAKE_INSTR(nm, ...) static const u8 OPCODE_##nm[] = { __VA_ARGS__ } MAKE_INSTR(INVD, 2, 0x0f, 0x08); MAKE_INSTR(WBINVD, 2, 0x0f, 0x09); @@ -101,70 +84,90 @@ static const u8 *opc_bytes[INSTR_MAX_COU [INSTR_INT3] = OPCODE_INT3 }; +static int fetch(struct vcpu *v, u8 *buf, unsigned long addr, int len) +{ + uint32_t pfec = (v->arch.hvm_svm.vmcb->cpl == 3) ? PFEC_user_mode : 0; + + switch ( hvm_fetch_from_guest_virt(buf, addr, len, pfec) ) + { + case HVMCOPY_okay: + return 1; + case HVMCOPY_bad_gva_to_gfn: + /* OK just to give up; we'll have injected #PF already */ + return 0; + case HVMCOPY_bad_gfn_to_mfn: + default: + /* Not OK: fetches from non-RAM pages are not supportable. */ + gdprintk(XENLOG_WARNING, "Bad instruction fetch at %#lx (%#lx)\n", + (unsigned long) guest_cpu_user_regs()->eip, addr); + hvm_inject_exception(TRAP_gp_fault, 0, 0); + return 0; + } +} + int __get_instruction_length_from_list(struct vcpu *v, - enum instruction_index *list, unsigned int list_count, - u8 *guest_eip_buf, enum instruction_index *match) + enum instruction_index *list, unsigned int list_count) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; unsigned int i, j, inst_len = 0; - int found = 0; enum instruction_index instr = 0; - u8 buffer[MAX_INST_LEN]; - u8 *buf; + u8 buf[MAX_INST_LEN]; const u8 *opcode = NULL; + unsigned long fetch_addr; + unsigned int fetch_len; - if ( guest_eip_buf ) + /* Fetch up to the next page break; we'll fetch from the next page + * later if we have to. */ + fetch_addr = svm_rip2pointer(v); + fetch_len = min_t(unsigned int, MAX_INST_LEN, + PAGE_SIZE - (fetch_addr & ~PAGE_MASK)); + if ( !fetch(v, buf, fetch_addr, fetch_len) ) + return 0; + + while ( (inst_len < MAX_INST_LEN) && is_prefix(buf[inst_len]) ) { - buf = guest_eip_buf; - } - else - { - if ( inst_copy_from_guest(buffer, svm_rip2pointer(v), MAX_INST_LEN) - != MAX_INST_LEN ) - return 0; - buf = buffer; + inst_len++; + if ( inst_len >= fetch_len ) + { + if ( !fetch(v, buf + fetch_len, fetch_addr + fetch_len, + MAX_INST_LEN - fetch_len) ) + return 0; + fetch_len = MAX_INST_LEN; + } } for ( j = 0; j < list_count; j++ ) { instr = list[j]; opcode = opc_bytes[instr]; - ASSERT(opcode); - while ( (inst_len < MAX_INST_LEN) && - is_prefix(buf[inst_len]) && - !is_prefix(opcode[1]) ) - inst_len++; - - ASSERT(opcode[0] <= 15); /* Make sure the table is correct. */ - found = 1; - - for ( i = 0; i < opcode[0]; i++ ) + for ( i = 0; (i < opcode[0]) && ((inst_len + i) < MAX_INST_LEN); i++ ) { - /* If the last byte is zero, we just accept it without checking */ - if ( (i == (opcode[0]-1)) && (opcode[i+1] == 0) ) - break; + if ( (inst_len + i) >= fetch_len ) + { + if ( !fetch(v, buf + fetch_len, + fetch_addr + fetch_len, + MAX_INST_LEN - fetch_len) ) + return 0; + fetch_len = MAX_INST_LEN; + } if ( buf[inst_len+i] != opcode[i+1] ) - { - found = 0; - break; - } + goto mismatch; } - - if ( found ) - goto done; + goto done; + mismatch: ; } - printk("%s: Mismatch between expected and actual instruction bytes: " - "eip = %lx\n", __func__, (unsigned long)vmcb->rip); + gdprintk(XENLOG_WARNING, + "%s: Mismatch between expected and actual instruction bytes: " + "eip = %lx\n", __func__, (unsigned long)vmcb->rip); + hvm_inject_exception(TRAP_gp_fault, 0, 0); return 0; done: inst_len += opcode[0]; ASSERT(inst_len <= MAX_INST_LEN); - if ( match ) - *match = instr; return inst_len; } diff -r e6f20d5ed5fe -r 01aa7c088e98 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Tue May 06 11:05:00 2008 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Tue May 06 13:32:18 2008 +0100 @@ -84,7 +84,10 @@ static void inline __update_guest_eip( { struct vcpu *curr = current; - if ( unlikely((inst_len == 0) || (inst_len > 15)) ) + if ( unlikely(inst_len == 0) ) + return; + + if ( unlikely(inst_len > 15) ) { gdprintk(XENLOG_ERR, "Bad instruction length %u\n", inst_len); domain_crash(curr->domain); @@ -907,8 +910,7 @@ static void svm_vmexit_do_cpuid(struct c { unsigned int eax, ebx, ecx, edx, inst_len; - inst_len = __get_instruction_length(current, INSTR_CPUID, NULL); - if ( inst_len == 0 ) + if ( (inst_len = __get_instruction_length(current, INSTR_CPUID)) == 0 ) return; eax = regs->eax; @@ -1083,13 +1085,15 @@ static void svm_do_msr_access(struct cpu if ( vmcb->exitinfo1 == 0 ) { + if ( (inst_len = __get_instruction_length(v, INSTR_RDMSR)) == 0 ) + return; rc = hvm_msr_read_intercept(regs); - inst_len = __get_instruction_length(v, INSTR_RDMSR, NULL); } else { + if ( (inst_len = __get_instruction_length(v, INSTR_WRMSR)) == 0 ) + return; rc = hvm_msr_write_intercept(regs); - inst_len = __get_instruction_length(v, INSTR_WRMSR, NULL); } if ( rc == X86EMUL_OKAY ) @@ -1101,34 +1105,36 @@ static void svm_vmexit_do_hlt(struct vmc { unsigned int inst_len; - inst_len = __get_instruction_length(current, INSTR_HLT, NULL); + if ( (inst_len = __get_instruction_length(current, INSTR_HLT)) == 0 ) + return; + __update_guest_eip(regs, inst_len); + + hvm_hlt(regs->eflags); +} + +static void wbinvd_ipi(void *info) +{ + wbinvd(); +} + +static void svm_wbinvd_intercept(void) +{ + if ( !list_empty(&(domain_hvm_iommu(current->domain)->pdev_list)) ) + on_each_cpu(wbinvd_ipi, NULL, 1, 1); +} + +static void svm_vmexit_do_invalidate_cache(struct cpu_user_regs *regs) +{ + enum instruction_index list[] = { INSTR_INVD, INSTR_WBINVD }; + int inst_len; + + inst_len = __get_instruction_length_from_list( + current, list, ARRAY_SIZE(list)); if ( inst_len == 0 ) return; - __update_guest_eip(regs, inst_len); - - hvm_hlt(regs->eflags); -} - -static void wbinvd_ipi(void *info) -{ - wbinvd(); -} - -static void svm_wbinvd_intercept(void) -{ - if ( !list_empty(&(domain_hvm_iommu(current->domain)->pdev_list)) ) - on_each_cpu(wbinvd_ipi, NULL, 1, 1); -} - -static void svm_vmexit_do_invalidate_cache(struct cpu_user_regs *regs) -{ - enum instruction_index list[] = { INSTR_INVD, INSTR_WBINVD }; - int inst_len; svm_wbinvd_intercept(); - inst_len = __get_instruction_length_from_list( - current, list, ARRAY_SIZE(list), NULL, NULL); __update_guest_eip(regs, inst_len); } @@ -1204,7 +1210,8 @@ asmlinkage void svm_vmexit_handler(struc if ( !v->domain->debugger_attached ) goto exit_and_crash; /* AMD Vol2, 15.11: INT3, INTO, BOUND intercepts do not update RIP. */ - inst_len = __get_instruction_length(v, INSTR_INT3, NULL); + if ( (inst_len = __get_instruction_length(v, INSTR_INT3)) == 0 ) + break; __update_guest_eip(regs, inst_len); domain_pause_for_debugger(); break; @@ -1281,8 +1288,7 @@ asmlinkage void svm_vmexit_handler(struc break; case VMEXIT_VMMCALL: - inst_len = __get_instruction_length(v, INSTR_VMCALL, NULL); - if ( inst_len == 0 ) + if ( (inst_len = __get_instruction_length(v, INSTR_VMCALL)) == 0 ) break; HVMTRACE_1D(VMMCALL, v, regs->eax); rc = hvm_do_hypercall(regs); diff -r e6f20d5ed5fe -r 01aa7c088e98 xen/include/asm-x86/hvm/svm/emulate.h --- a/xen/include/asm-x86/hvm/svm/emulate.h Tue May 06 11:05:00 2008 +0100 +++ b/xen/include/asm-x86/hvm/svm/emulate.h Tue May 06 13:32:18 2008 +0100 @@ -34,15 +34,12 @@ enum instruction_index { }; int __get_instruction_length_from_list( - struct vcpu *v, - enum instruction_index *list, unsigned int list_count, - u8 *guest_eip_buf, enum instruction_index *match); + struct vcpu *v, enum instruction_index *list, unsigned int list_count); -static inline int __get_instruction_length(struct vcpu *v, - enum instruction_index instr, u8 *guest_eip_buf) +static inline int __get_instruction_length( + struct vcpu *v, enum instruction_index instr) { - return __get_instruction_length_from_list( - v, &instr, 1, guest_eip_buf, NULL); + return __get_instruction_length_from_list(v, &instr, 1); } #endif /* __ASM_X86_HVM_SVM_EMULATE_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 06:00:24 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 06:00:24 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtMmN-0004mj-Uq for www-data@colo.xensource.com; Tue, 06 May 2008 06:00:24 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmw-0008CS-Nj; Tue, 06 May 2008 13:00:58 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtMmn-00081T-GF for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtMmg-0003Sw-EP for xen-changelog@lists.xensource.com; Tue, 06 May 2008 13:00:47 +0000 X-SBRS: 3.6 X-MesageID: 148842 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="148842" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 08:59:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46Cxtbt021847 for ; Tue, 6 May 2008 05:59:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46D0DCb002965 for ; Tue, 6 May 2008 06:00:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46D0DXB002964 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 06:00:13 -0700 Message-Id: <200805061300.m46D0DXB002964@xenbits.xensource.com> Date: Tue, 06 May 2008 06:00:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,INFO_TLD autolearn=no version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: fix thread safety of xenbus watches by requiring callers to X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210077292 -3600 # Node ID a3bddc22d2f5dc65276765d732a2377867f792e4 # Parent 01aa7c088e983cd54b61faeb3ff533581714a26f minios: fix thread safety of xenbus watches by requiring callers to provide their own queue of events, because else we can not dispatch to watchers running in parallel. Signed-off-by: Samuel Thibault --- extras/mini-os/blkfront.c | 18 +++++++++++------- extras/mini-os/fbfront.c | 35 +++++++++++++++++++++-------------- extras/mini-os/fs-front.c | 5 +++-- extras/mini-os/include/lib.h | 2 +- extras/mini-os/include/xenbus.h | 11 ++++++----- extras/mini-os/netfront.c | 18 +++++++++++------- extras/mini-os/xenbus/xenbus.c | 37 ++++++++++++++++++++++--------------- 7 files changed, 75 insertions(+), 51 deletions(-) diff -r 01aa7c088e98 -r a3bddc22d2f5 extras/mini-os/blkfront.c --- a/extras/mini-os/blkfront.c Tue May 06 13:32:18 2008 +0100 +++ b/extras/mini-os/blkfront.c Tue May 06 13:34:52 2008 +0100 @@ -50,6 +50,8 @@ struct blkfront_dev { char *backend; struct blkfront_info info; + xenbus_event_queue events; + #ifdef HAVE_LIBC int fd; #endif @@ -100,6 +102,8 @@ struct blkfront_dev *init_blkfront(char FRONT_RING_INIT(&dev->ring, s, PAGE_SIZE); dev->ring_ref = gnttab_grant_access(dev->dom,virt_to_mfn(s),0); + + dev->events = NULL; // FIXME: proper frees on failures again: @@ -166,11 +170,9 @@ done: snprintf(path, sizeof(path), "%s/state", dev->backend); - xenbus_watch_path(XBT_NIL, path); - - xenbus_wait_for_value(path,"4"); - - xenbus_unwatch_path(XBT_NIL, path); + xenbus_watch_path_token(XBT_NIL, path, path, &dev->events); + + xenbus_wait_for_value(path, "4", &dev->events); snprintf(path, sizeof(path), "%s/info", dev->backend); dev->info.info = xenbus_read_integer(path); @@ -211,10 +213,12 @@ void shutdown_blkfront(struct blkfront_d snprintf(path, sizeof(path), "%s/state", dev->backend); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */ - xenbus_wait_for_value(path,"5"); + xenbus_wait_for_value(path, "5", &dev->events); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6); - xenbus_wait_for_value(path,"6"); + xenbus_wait_for_value(path, "6", &dev->events); + + xenbus_unwatch_path(XBT_NIL, path); unbind_evtchn(dev->evtchn); diff -r 01aa7c088e98 -r a3bddc22d2f5 extras/mini-os/fbfront.c --- a/extras/mini-os/fbfront.c Tue May 06 13:32:18 2008 +0100 +++ b/extras/mini-os/fbfront.c Tue May 06 13:34:52 2008 +0100 @@ -31,6 +31,8 @@ struct kbdfront_dev { char *nodename; char *backend; + xenbus_event_queue events; + #ifdef HAVE_LIBC int fd; #endif @@ -75,6 +77,8 @@ struct kbdfront_dev *init_kbdfront(char dev->page = s = (struct xenkbd_page*) alloc_page(); memset(s,0,PAGE_SIZE); + dev->events = NULL; + s->in_cons = s->in_prod = 0; s->out_cons = s->out_prod = 0; @@ -136,11 +140,9 @@ done: snprintf(path, sizeof(path), "%s/state", dev->backend); - xenbus_watch_path(XBT_NIL, path); - - xenbus_wait_for_value(path,"4"); - - xenbus_unwatch_path(XBT_NIL, path); + xenbus_watch_path_token(XBT_NIL, path, path, &dev->events); + + xenbus_wait_for_value(path, "4", &dev->events); printk("%s connected\n", dev->backend); @@ -199,10 +201,12 @@ void shutdown_kbdfront(struct kbdfront_d snprintf(path, sizeof(path), "%s/state", dev->backend); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */ - xenbus_wait_for_value(path,"5"); + xenbus_wait_for_value(path, "5", &dev->events); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6); - xenbus_wait_for_value(path,"6"); + xenbus_wait_for_value(path, "6", &dev->events); + + xenbus_unwatch_path(XBT_NIL, path); unbind_evtchn(dev->evtchn); @@ -249,6 +253,8 @@ struct fbfront_dev { int stride; int mem_length; int offset; + + xenbus_event_queue events; }; void fbfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) @@ -292,6 +298,7 @@ struct fbfront_dev *init_fbfront(char *n dev->stride = s->line_length = stride; dev->mem_length = s->mem_length = n * PAGE_SIZE; dev->offset = 0; + dev->events = NULL; const int max_pd = sizeof(s->pd) / sizeof(s->pd[0]); unsigned long mapped = 0; @@ -368,13 +375,11 @@ done: snprintf(path, sizeof(path), "%s/state", dev->backend); - xenbus_watch_path(XBT_NIL, path); - - xenbus_wait_for_value(path,"4"); + xenbus_watch_path_token(XBT_NIL, path, path, &dev->events); + + xenbus_wait_for_value(path, "4", &dev->events); printk("%s connected\n", dev->backend); - - xenbus_unwatch_path(XBT_NIL, path); snprintf(path, sizeof(path), "%s/request-update", dev->backend); dev->request_update = xenbus_read_integer(path); @@ -463,10 +468,12 @@ void shutdown_fbfront(struct fbfront_dev snprintf(path, sizeof(path), "%s/state", dev->backend); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */ - xenbus_wait_for_value(path,"5"); + xenbus_wait_for_value(path, "5", &dev->events); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6); - xenbus_wait_for_value(path,"6"); + xenbus_wait_for_value(path, "6", &dev->events); + + xenbus_unwatch_path(XBT_NIL, path); unbind_evtchn(dev->evtchn); diff -r 01aa7c088e98 -r a3bddc22d2f5 extras/mini-os/fs-front.c --- a/extras/mini-os/fs-front.c Tue May 06 13:32:18 2008 +0100 +++ b/extras/mini-os/fs-front.c Tue May 06 13:34:52 2008 +0100 @@ -917,6 +917,7 @@ static int init_fs_import(struct fs_impo struct fsif_sring *sring; int retry = 0; domid_t self_id; + xenbus_event_queue events = NULL; printk("Initialising FS fortend to backend dom %d\n", import->dom_id); /* Allocate page for the shared ring */ @@ -1026,8 +1027,8 @@ done: sprintf(r_nodename, "%s/state", import->backend); sprintf(token, "fs-front-%d", import->import_id); /* The token will not be unique if multiple imports are inited */ - xenbus_watch_path(XBT_NIL, r_nodename/*, token*/); - xenbus_wait_for_value(/*token,*/ r_nodename, STATE_READY); + xenbus_watch_path_token(XBT_NIL, r_nodename, r_nodename, &events); + xenbus_wait_for_value(r_nodename, STATE_READY, &events); xenbus_unwatch_path(XBT_NIL, r_nodename); printk("Backend ready.\n"); diff -r 01aa7c088e98 -r a3bddc22d2f5 extras/mini-os/include/lib.h --- a/extras/mini-os/include/lib.h Tue May 06 13:32:18 2008 +0100 +++ b/extras/mini-os/include/lib.h Tue May 06 13:34:52 2008 +0100 @@ -178,7 +178,7 @@ extern struct file { struct { /* To each xenbus FD is associated a queue of watch events for this * FD. */ - struct xenbus_event *volatile events; + xenbus_event_queue events; } xenbus; }; volatile int read; /* maybe available for read */ diff -r 01aa7c088e98 -r a3bddc22d2f5 extras/mini-os/include/xenbus.h --- a/extras/mini-os/include/xenbus.h Tue May 06 13:32:18 2008 +0100 +++ b/extras/mini-os/include/xenbus.h Tue May 06 13:34:52 2008 +0100 @@ -19,17 +19,18 @@ struct xenbus_event { char *token; struct xenbus_event *next; }; +typedef struct xenbus_event *xenbus_event_queue; -char *xenbus_watch_path_token(xenbus_transaction_t xbt, const char *path, const char *token, struct xenbus_event *volatile *events); +char *xenbus_watch_path_token(xenbus_transaction_t xbt, const char *path, const char *token, xenbus_event_queue *events); char *xenbus_unwatch_path_token(xenbus_transaction_t xbt, const char *path, const char *token); extern struct wait_queue_head xenbus_watch_queue; -void xenbus_wait_for_watch(void); -char **xenbus_wait_for_watch_return(void); -char* xenbus_wait_for_value(const char *path, const char *value); +void xenbus_wait_for_watch(xenbus_event_queue *queue); +char **xenbus_wait_for_watch_return(xenbus_event_queue *queue); +char* xenbus_wait_for_value(const char *path, const char *value, xenbus_event_queue *queue); /* When no token is provided, use a global queue. */ #define XENBUS_WATCH_PATH_TOKEN "xenbus_watch_path" -extern struct xenbus_event * volatile xenbus_events; +extern xenbus_event_queue xenbus_events; #define xenbus_watch_path(xbt, path) xenbus_watch_path_token(xbt, path, XENBUS_WATCH_PATH_TOKEN, NULL) #define xenbus_unwatch_path(xbt, path) xenbus_unwatch_path_token(xbt, path, XENBUS_WATCH_PATH_TOKEN) diff -r 01aa7c088e98 -r a3bddc22d2f5 extras/mini-os/netfront.c --- a/extras/mini-os/netfront.c Tue May 06 13:32:18 2008 +0100 +++ b/extras/mini-os/netfront.c Tue May 06 13:34:52 2008 +0100 @@ -52,6 +52,8 @@ struct netfront_dev { char *nodename; char *backend; + + xenbus_event_queue events; #ifdef HAVE_LIBC int fd; @@ -328,6 +330,8 @@ struct netfront_dev *init_netfront(char dev->netif_rx = thenetif_rx; + dev->events = NULL; + // FIXME: proper frees on failures again: err = xenbus_transaction_start(&xbt); @@ -399,11 +403,9 @@ done: char path[strlen(dev->backend) + 1 + 5 + 1]; snprintf(path, sizeof(path), "%s/state", dev->backend); - xenbus_watch_path(XBT_NIL, path); - - xenbus_wait_for_value(path,"4"); - - xenbus_unwatch_path(XBT_NIL, path); + xenbus_watch_path_token(XBT_NIL, path, path, &dev->events); + + xenbus_wait_for_value(path, "4", &dev->events); if (ip) { snprintf(path, sizeof(path), "%s/ip", dev->backend); @@ -458,10 +460,12 @@ void shutdown_netfront(struct netfront_d snprintf(path, sizeof(path), "%s/state", dev->backend); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */ - xenbus_wait_for_value(path,"5"); + xenbus_wait_for_value(path, "5", &dev->events); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6); - xenbus_wait_for_value(path,"6"); + xenbus_wait_for_value(path, "6", &dev->events); + + xenbus_unwatch_path(XBT_NIL, path); unbind_evtchn(dev->evtchn); diff -r 01aa7c088e98 -r a3bddc22d2f5 extras/mini-os/xenbus/xenbus.c --- a/extras/mini-os/xenbus/xenbus.c Tue May 06 13:32:18 2008 +0100 +++ b/extras/mini-os/xenbus/xenbus.c Tue May 06 13:34:52 2008 +0100 @@ -45,10 +45,10 @@ static DECLARE_WAIT_QUEUE_HEAD(xb_waitq) static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); DECLARE_WAIT_QUEUE_HEAD(xenbus_watch_queue); -struct xenbus_event *volatile xenbus_events; +xenbus_event_queue xenbus_events; static struct watch { char *token; - struct xenbus_event *volatile *events; + xenbus_event_queue *events; struct watch *next; } *watches; struct xenbus_req_info @@ -75,28 +75,34 @@ static void memcpy_from_ring(const void memcpy(dest + c1, ring, c2); } -char **xenbus_wait_for_watch_return() +char **xenbus_wait_for_watch_return(xenbus_event_queue *queue) { struct xenbus_event *event; + if (!queue) + queue = &xenbus_events; DEFINE_WAIT(w); - while (!(event = xenbus_events)) { + while (!(event = *queue)) { add_waiter(w, xenbus_watch_queue); schedule(); } remove_waiter(w); - xenbus_events = event->next; + *queue = event->next; return &event->path; } -void xenbus_wait_for_watch(void) +void xenbus_wait_for_watch(xenbus_event_queue *queue) { char **ret; - ret = xenbus_wait_for_watch_return(); + if (!queue) + queue = &xenbus_events; + ret = xenbus_wait_for_watch_return(queue); free(ret); } -char* xenbus_wait_for_value(const char* path, const char* value) -{ +char* xenbus_wait_for_value(const char* path, const char* value, xenbus_event_queue *queue) +{ + if (!queue) + queue = &xenbus_events; for(;;) { char *res, *msg; @@ -109,7 +115,7 @@ char* xenbus_wait_for_value(const char* free(res); if(r==0) break; - else xenbus_wait_for_watch(); + else xenbus_wait_for_watch(queue); } return NULL; } @@ -147,8 +153,8 @@ static void xenbus_thread_func(void *ign if(msg.type == XS_WATCH_EVENT) { - struct xenbus_event *event = malloc(sizeof(*event) + msg.len), - *volatile *events = NULL; + struct xenbus_event *event = malloc(sizeof(*event) + msg.len); + xenbus_event_queue *events = NULL; char *data = (char*)event + sizeof(*event); struct watch *watch; @@ -167,8 +173,6 @@ static void xenbus_thread_func(void *ign events = watch->events; break; } - if (!events) - events = &xenbus_events; event->next = *events; *events = event; @@ -463,7 +467,7 @@ char *xenbus_write(xenbus_transaction_t return NULL; } -char* xenbus_watch_path_token( xenbus_transaction_t xbt, const char *path, const char *token, struct xenbus_event *volatile *events) +char* xenbus_watch_path_token( xenbus_transaction_t xbt, const char *path, const char *token, xenbus_event_queue *events) { struct xsd_sockmsg *rep; @@ -473,6 +477,9 @@ char* xenbus_watch_path_token( xenbus_tr }; struct watch *watch = malloc(sizeof(*watch)); + + if (!events) + events = &xenbus_events; watch->token = strdup(token); watch->events = events; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 08:30:10 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 08:30:10 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtP7K-0006xr-DY for www-data@colo.xensource.com; Tue, 06 May 2008 08:30:10 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtP7t-0003Bc-5P; Tue, 06 May 2008 15:30:45 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtP7r-0003B8-HN for xen-changelog@lists.xensource.com; Tue, 06 May 2008 15:30:43 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtP7k-0005DT-Qs for xen-changelog@lists.xensource.com; Tue, 06 May 2008 15:30:41 +0000 X-SBRS: 3.6 X-MesageID: 150014 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="150014" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 11:29:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46FTtlF022616 for ; Tue, 6 May 2008 08:29:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46FUDEB011167 for ; Tue, 6 May 2008 08:30:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46FUDe6011166 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 08:30:13 -0700 Message-Id: <200805061530.m46FUDe6011166@xenbits.xensource.com> Date: Tue, 06 May 2008 08:30:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Only import OpenSSL package when it is required. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210084275 -3600 # Node ID ab2d9e75098d5a17b38d3d84bd8c65d9d4f39b9f # Parent a3bddc22d2f5dc65276765d732a2377867f792e4 xend: Only import OpenSSL package when it is required. Signed-off-by: Keir Fraser --- tools/python/xen/web/tcp.py | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) diff -r a3bddc22d2f5 -r ab2d9e75098d tools/python/xen/web/tcp.py --- a/tools/python/xen/web/tcp.py Tue May 06 13:34:52 2008 +0100 +++ b/tools/python/xen/web/tcp.py Tue May 06 15:31:15 2008 +0100 @@ -21,8 +21,6 @@ import re import re import socket import time - -from OpenSSL import SSL import connection @@ -82,6 +80,7 @@ class SSLTCPListener(TCPListener): def createSocket(self): + from OpenSSL import SSL # make a SSL socket ctx = SSL.Context(SSL.SSLv23_METHOD) ctx.set_options(SSL.OP_NO_SSLv2) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 08:30:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 08:30:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtP7M-0006xu-Ad for www-data@colo.xensource.com; Tue, 06 May 2008 08:30:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtP7v-0003EB-3y; Tue, 06 May 2008 15:30:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtP7s-0003B9-Fv for xen-changelog@lists.xensource.com; Tue, 06 May 2008 15:30:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtP7m-0005DU-1O for xen-changelog@lists.xensource.com; Tue, 06 May 2008 15:30:42 +0000 X-SBRS: 3.6 X-MesageID: 150015 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="150015" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 11:29:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46FTu3p022619 for ; Tue, 6 May 2008 08:29:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46FUEFo011184 for ; Tue, 6 May 2008 08:30:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46FUEEn011183 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 08:30:14 -0700 Message-Id: <200805061530.m46FUEEn011183@xenbits.xensource.com> Date: Tue, 06 May 2008 08:30:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Support interrupt delivery for PIT channel 0 when in modes 3 and 4. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210087224 -3600 # Node ID a95c2e36d6fda747279123ab13bfaf40c4041337 # Parent ab2d9e75098d5a17b38d3d84bd8c65d9d4f39b9f x86 hvm: Support interrupt delivery for PIT channel 0 when in modes 3 and 4. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/i8254.c | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff -r ab2d9e75098d -r a95c2e36d6fd xen/arch/x86/hvm/i8254.c --- a/xen/arch/x86/hvm/i8254.c Tue May 06 15:31:15 2008 +0100 +++ b/xen/arch/x86/hvm/i8254.c Tue May 06 16:20:24 2008 +0100 @@ -206,19 +206,21 @@ static void pit_load_count(PITState *pit switch ( s->mode ) { - case 2: - /* Periodic timer. */ - create_periodic_time(v, &pit->pt0, period, 0, 0, pit_time_fired, - &pit->count_load_time[channel]); - break; - case 1: - /* One-shot timer. */ - create_periodic_time(v, &pit->pt0, period, 0, 1, pit_time_fired, - &pit->count_load_time[channel]); - break; - default: - destroy_periodic_time(&pit->pt0); - break; + case 2: + case 3: + /* Periodic timer. */ + create_periodic_time(v, &pit->pt0, period, 0, 0, pit_time_fired, + &pit->count_load_time[channel]); + break; + case 1: + case 4: + /* One-shot timer. */ + create_periodic_time(v, &pit->pt0, period, 0, 1, pit_time_fired, + &pit->count_load_time[channel]); + break; + default: + destroy_periodic_time(&pit->pt0); + break; } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 06 08:30:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 06 May 2008 08:30:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtP7P-0006xz-OB for www-data@colo.xensource.com; Tue, 06 May 2008 08:30:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtP7y-0003Hu-Gq; Tue, 06 May 2008 15:30:50 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtP7w-0003DQ-6k for xen-changelog@lists.xensource.com; Tue, 06 May 2008 15:30:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtP7n-0005DV-Jg for xen-changelog@lists.xensource.com; Tue, 06 May 2008 15:30:46 +0000 X-SBRS: 3.6 X-MesageID: 150016 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,443,1204520400"; d="scan'208";a="150016" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 06 May 2008 11:29:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m46FTwS2022622 for ; Tue, 6 May 2008 08:29:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m46FUGpV011201 for ; Tue, 6 May 2008 08:30:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m46FUGxF011200 for xen-changelog@lists.xensource.com; Tue, 6 May 2008 08:30:16 -0700 Message-Id: <200805061530.m46FUGxF011200@xenbits.xensource.com> Date: Tue, 06 May 2008 08:30:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Warn only once per time source when the periodic tiemout is X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210087254 -3600 # Node ID cc953475ab149a61defff06de237295a7feb882d # Parent a95c2e36d6fda747279123ab13bfaf40c4041337 x86 hvm: Warn only once per time source when the periodic tiemout is set 'too small'. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vpt.c | 6 +++--- xen/include/asm-x86/hvm/vpt.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff -r a95c2e36d6fd -r cc953475ab14 xen/arch/x86/hvm/vpt.c --- a/xen/arch/x86/hvm/vpt.c Tue May 06 16:20:24 2008 +0100 +++ b/xen/arch/x86/hvm/vpt.c Tue May 06 16:20:54 2008 +0100 @@ -338,9 +338,9 @@ void create_periodic_time( /* Periodic timer must be at least 0.9ms. */ if ( (period < 900000) && !one_shot ) { - gdprintk(XENLOG_WARNING, - "HVM_PlatformTime: program too small period %"PRIu64"\n", - period); + if ( !test_and_set_bool(pt->warned_timeout_too_short) ) + gdprintk(XENLOG_WARNING, "HVM_PlatformTime: program too " + "small period %"PRIu64"\n", period); period = 900000; } diff -r a95c2e36d6fd -r cc953475ab14 xen/include/asm-x86/hvm/vpt.h --- a/xen/include/asm-x86/hvm/vpt.h Tue May 06 16:20:24 2008 +0100 +++ b/xen/include/asm-x86/hvm/vpt.h Tue May 06 16:20:54 2008 +0100 @@ -78,6 +78,7 @@ struct periodic_time { bool_t one_shot; bool_t do_not_freeze; bool_t irq_issued; + bool_t warned_timeout_too_short; #define PTSRC_isa 1 /* ISA time source */ #define PTSRC_lapic 2 /* LAPIC time source */ u8 source; /* PTSRC_ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JtmgX-0004nC-T7 for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jtmh6-0008Ny-WF; Wed, 07 May 2008 16:40:41 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jtmh6-0008Na-3p for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:40 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jtmgz-0003Wd-8U for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:37 +0000 X-SBRS: 3.6 X-MesageID: 159556 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159556" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47GdpVb026241 for ; Wed, 7 May 2008 09:39:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47Ge98N031399 for ; Wed, 7 May 2008 09:40:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47Ge8sw031398 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:08 -0700 Message-Id: <200805071640.m47Ge8sw031398@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: let events get mixed X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210087741 -3600 # Node ID 9d84c12de877e7c90a1b4b1c4b53bfa55bf0d432 # Parent cc953475ab149a61defff06de237295a7feb882d minios: let events get mixed since events do not need to be counted Signed-off-by: Keir Fraser --- tools/libxc/xc_minios.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r cc953475ab14 -r 9d84c12de877 tools/libxc/xc_minios.c --- a/tools/libxc/xc_minios.c Tue May 06 16:20:54 2008 +0100 +++ b/tools/libxc/xc_minios.c Tue May 06 16:29:01 2008 +0100 @@ -178,7 +178,7 @@ static void evtchn_handler(evtchn_port_t printk("Unknown port for handle %d\n", xce_handle); return; } - files[xce_handle].evtchn.ports[i].pending++; + files[xce_handle].evtchn.ports[i].pending = 1; files[xce_handle].read = 1; wake_up(&event_queue); } @@ -278,7 +278,7 @@ evtchn_port_or_error_t xc_evtchn_pending for (i = 0; i < MAX_EVTCHN_PORTS; i++) { evtchn_port_t port = files[xce_handle].evtchn.ports[i].port; if (port != -1 && files[xce_handle].evtchn.ports[i].pending) { - files[xce_handle].evtchn.ports[i].pending--; + files[xce_handle].evtchn.ports[i].pending = 0; local_irq_restore(flags); return port; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmga-0004nF-Ov for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jtmh9-0008Qn-U0; Wed, 07 May 2008 16:40:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jtmh7-0008Nb-A1 for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:41 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jtmh0-0003We-Kl for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:39 +0000 X-SBRS: 3.6 X-MesageID: 159557 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159557" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47GdqOc026244 for ; Wed, 7 May 2008 09:39:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeAnh031416 for ; Wed, 7 May 2008 09:40:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47Ge9gc031415 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:09 -0700 Message-Id: <200805071640.m47Ge9gc031415@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: drop volatile qualifier from some status variables X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210088144 -3600 # Node ID 892ae66ed82fa66fb474cea14b5be7ddbc39cbd9 # Parent 9d84c12de877e7c90a1b4b1c4b53bfa55bf0d432 minios: drop volatile qualifier from some status variables since we already use memory barriers as approriate to prevent concurrent access with event handlers. Signed-off-by: Samuel Thibault --- extras/mini-os/include/lib.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 9d84c12de877 -r 892ae66ed82f extras/mini-os/include/lib.h --- a/extras/mini-os/include/lib.h Tue May 06 16:29:01 2008 +0100 +++ b/extras/mini-os/include/lib.h Tue May 06 16:35:44 2008 +0100 @@ -162,7 +162,7 @@ extern struct file { * wakes select for this FD. */ struct { evtchn_port_t port; - volatile unsigned long pending; + unsigned long pending; int bound; } ports[MAX_EVTCHN_PORTS]; } evtchn; @@ -181,7 +181,7 @@ extern struct file { xenbus_event_queue events; } xenbus; }; - volatile int read; /* maybe available for read */ + int read; /* maybe available for read */ } files[]; int alloc_fd(enum fd_type type); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmge-0004nJ-Ei for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhD-0008UT-Kd; Wed, 07 May 2008 16:40:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jtmh9-0008Ol-DL for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:43 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jtmh2-0003Wh-GP for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:41 +0000 X-SBRS: 3.6 X-MesageID: 159558 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159558" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47GdqkV026247 for ; Wed, 7 May 2008 09:39:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeArO031433 for ; Wed, 7 May 2008 09:40:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47GeAfu031432 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:10 -0700 Message-Id: <200805071640.m47GeAfu031432@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 shadow: Fix typo in a code comment. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210148149 -3600 # Node ID 730c253afc304b40b979b9be342deba1943de51d # Parent 892ae66ed82fa66fb474cea14b5be7ddbc39cbd9 x86 shadow: Fix typo in a code comment. Signed-off-by: Samuel Thibault --- xen/arch/x86/mm/shadow/common.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 892ae66ed82f -r 730c253afc30 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Tue May 06 16:35:44 2008 +0100 +++ b/xen/arch/x86/mm/shadow/common.c Wed May 07 09:15:49 2008 +0100 @@ -2327,7 +2327,7 @@ static void sh_update_paging_modes(struc current->domain->domain_id, current->vcpu_id, v->domain->domain_id, v->vcpu_id); /* It's not safe to do that because we can't change - * the host CR£ for a running domain */ + * the host CR3 for a running domain */ domain_crash(v->domain); return; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmgh-0004nM-RJ for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhH-00006A-1K; Wed, 07 May 2008 16:40:51 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhB-0008QF-5m for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jtmh4-0003Wd-Dl for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:43 +0000 X-SBRS: 3.6 X-MesageID: 159559 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159559" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47GdrcR026250 for ; Wed, 7 May 2008 09:39:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeBjS031450 for ; Wed, 7 May 2008 09:40:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47GeB0J031449 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:11 -0700 Message-Id: <200805071640.m47GeB0J031449@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] msix: Further fixes to Python arithmetic. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210148272 -3600 # Node ID 9d2a45d4b6c6ecf6d99f01dd035326d2215c548c # Parent 730c253afc304b40b979b9be342deba1943de51d msix: Further fixes to Python arithmetic. Signed-off-by: Keir Fraser --- tools/python/xen/util/pci.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 730c253afc30 -r 9d2a45d4b6c6 tools/python/xen/util/pci.py --- a/tools/python/xen/util/pci.py Wed May 07 09:15:49 2008 +0100 +++ b/tools/python/xen/util/pci.py Wed May 07 09:17:52 2008 +0100 @@ -30,7 +30,7 @@ PCI_STATUS_OFFSET = 0x6 PCI_STATUS_OFFSET = 0x6 PCI_CAP_OFFSET = 0x34 MSIX_BIR_MASK = 0x7 -MSIX_SIZE_MASK = 0x3ff +MSIX_SIZE_MASK = 0x7ff #Calculate PAGE_SHIFT: number of bits to shift an address to get the page number PAGE_SIZE = resource.getpagesize() @@ -122,7 +122,7 @@ class PciDevice: message_cont_hi = ord(conf_file.read(1)) self.msix=1 self.msix_entries = (message_cont_lo + \ - message_cont_hi << 8) \ + (message_cont_hi << 8)) \ & MSIX_SIZE_MASK t_off=conf_file.read(4) p_off=conf_file.read(4) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmgl-0004nQ-3q for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhK-00009i-BV; Wed, 07 May 2008 16:40:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhC-0008RF-3b for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jtmh5-0003We-OT for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:43 +0000 X-SBRS: 3.6 X-MesageID: 159560 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159560" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47Gds9L026253 for ; Wed, 7 May 2008 09:39:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeCBn031467 for ; Wed, 7 May 2008 09:40:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47GeCRt031466 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:12 -0700 Message-Id: <200805071640.m47GeCRt031466@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] VT-d: Fix free VT-d page table issue X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210148380 -3600 # Node ID fb58da5167497ce8752f99673149911909f0f269 # Parent 9d2a45d4b6c6ecf6d99f01dd035326d2215c548c VT-d: Fix free VT-d page table issue This patch frees VT-d page tables from pgd, rather than free them according to a guest address range. This fixes [Bug 1244] Poweroff/Destroying HVM guest causes HV crash. http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1244. Signed-off-by: Weidong Han --- xen/drivers/passthrough/vtd/iommu.c | 62 +++++++++++++++++++++++++++++++----- xen/drivers/passthrough/vtd/iommu.h | 1 2 files changed, 55 insertions(+), 8 deletions(-) diff -r 9d2a45d4b6c6 -r fb58da516749 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed May 07 09:17:52 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed May 07 09:19:40 2008 +0100 @@ -678,17 +678,63 @@ void dma_pte_free_pagetable(struct domai } } - /* free all VT-d page tables when shut down or destroy domain. */ +static void iommu_free_next_pagetable(u64 pt_maddr, unsigned long index, + int level) +{ + struct acpi_drhd_unit *drhd; + unsigned long next_index; + struct dma_pte *pt_vaddr, *pde; + int next_level; + + if ( pt_maddr == 0 ) + return; + + pt_vaddr = (struct dma_pte *)map_vtd_domain_page(pt_maddr); + pde = &pt_vaddr[index]; + if ( dma_pte_addr(*pde) != 0 ) + { + next_level = level - 1; + if ( next_level > 1 ) + { + next_index = 0; + do + { + iommu_free_next_pagetable(pde->val, + next_index, next_level); + next_index++; + } while ( next_index < PTE_NUM ); + } + + dma_clear_pte(*pde); + drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); + iommu_flush_cache_entry(drhd->iommu, pde); + free_pgtable_maddr(pde->val); + unmap_vtd_domain_page(pt_vaddr); + } + else + unmap_vtd_domain_page(pt_vaddr); +} + +/* free all VT-d page tables when shut down or destroy domain. */ static void iommu_free_pagetable(struct domain *domain) { + unsigned long index; struct hvm_iommu *hd = domain_hvm_iommu(domain); - int addr_width = agaw_to_width(hd->agaw); - u64 start, end; - - start = 0; - end = (((u64)1) << addr_width) - 1; - - dma_pte_free_pagetable(domain, start, end); + int total_level = agaw_to_level(hd->agaw); + + if ( hd->pgd_maddr != 0 ) + { + index = 0; + do + { + iommu_free_next_pagetable(hd->pgd_maddr, + index, total_level + 1); + index++; + } while ( index < PTE_NUM ); + + free_pgtable_maddr(hd->pgd_maddr); + hd->pgd_maddr = 0; + } } static int iommu_set_root_entry(struct iommu *iommu) diff -r 9d2a45d4b6c6 -r fb58da516749 xen/drivers/passthrough/vtd/iommu.h --- a/xen/drivers/passthrough/vtd/iommu.h Wed May 07 09:17:52 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.h Wed May 07 09:19:40 2008 +0100 @@ -235,6 +235,7 @@ struct context_entry { /* page table handling */ #define LEVEL_STRIDE (9) #define LEVEL_MASK ((1 << LEVEL_STRIDE) - 1) +#define PTE_NUM (1 << LEVEL_STRIDE) #define agaw_to_level(val) ((val) + 2) #define agaw_to_width(val) (30 + val * LEVEL_STRIDE) #define width_to_agaw(w) ((w - 30)/LEVEL_STRIDE) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmgp-0004nT-9Q for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhO-0000DP-Es; Wed, 07 May 2008 16:40:58 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhE-0008Tu-Sj for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jtmh7-0003Wh-Qz for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:46 +0000 X-SBRS: 3.6 X-MesageID: 159561 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159561" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47GdtV9026256 for ; Wed, 7 May 2008 09:39:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeD4H031484 for ; Wed, 7 May 2008 09:40:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47GeDoZ031483 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:13 -0700 Message-Id: <200805071640.m47GeDoZ031483@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] VT-d: Remove unused function dma_pte_free_pagetable(). X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210148525 -3600 # Node ID 2cc926c18a7bb7f2a720c15054a4f4ac5249dc35 # Parent fb58da5167497ce8752f99673149911909f0f269 VT-d: Remove unused function dma_pte_free_pagetable(). Signed-off-by: Keir Fraser --- xen/drivers/passthrough/vtd/iommu.c | 55 ------------------------------------ 1 files changed, 55 deletions(-) diff -r fb58da516749 -r 2cc926c18a7b xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed May 07 09:19:40 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed May 07 09:22:05 2008 +0100 @@ -620,61 +620,6 @@ static void dma_pte_clear_range(struct d { dma_pte_clear_one(domain, start); start += PAGE_SIZE_4K; - } -} - -/* free page table pages. last level pte should already be cleared */ -void dma_pte_free_pagetable(struct domain *domain, u64 start, u64 end) -{ - struct acpi_drhd_unit *drhd; - struct hvm_iommu *hd = domain_hvm_iommu(domain); - struct iommu *iommu; - int addr_width = agaw_to_width(hd->agaw); - struct dma_pte *page, *pte; - int total = agaw_to_level(hd->agaw); - int level; - u64 tmp; - u64 pg_maddr; - - drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); - iommu = drhd->iommu; - - start &= (((u64)1) << addr_width) - 1; - end &= (((u64)1) << addr_width) - 1; - - /* we don't need lock here, nobody else touches the iova range */ - level = 2; - while ( level <= total ) - { - tmp = align_to_level(start, level); - if ( (tmp >= end) || ((tmp + level_size(level)) > end) ) - return; - - while ( tmp < end ) - { - pg_maddr = dma_addr_level_page_maddr(domain, tmp, level); - if ( pg_maddr == 0 ) - { - tmp += level_size(level); - continue; - } - page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); - pte = page + address_level_offset(tmp, level); - dma_clear_pte(*pte); - iommu_flush_cache_entry(iommu, pte); - unmap_vtd_domain_page(page); - free_pgtable_maddr(pg_maddr); - - tmp += level_size(level); - } - level++; - } - - /* free pgd */ - if ( start == 0 && end >= ((((u64)1) << addr_width) - 1) ) - { - free_pgtable_maddr(hd->pgd_maddr); - hd->pgd_maddr = 0; } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:26 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:26 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmgr-0004nV-MA for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhQ-0000GC-SK; Wed, 07 May 2008 16:41:00 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhG-0008Vo-KS for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jtmh9-0003Wd-KK for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:48 +0000 X-SBRS: 3.6 X-MesageID: 159562 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159562" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47GduSf026259 for ; Wed, 7 May 2008 09:39:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeEq9031501 for ; Wed, 7 May 2008 09:40:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47GeEKh031500 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:14 -0700 Message-Id: <200805071640.m47GeEKh031500@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Update for vtd.txt: add VT-d hotplug description, remove MSI X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210148609 -3600 # Node ID a3b8a99c26ebb464a3c9791a5d48e1bf90c800b8 # Parent 2cc926c18a7bb7f2a720c15054a4f4ac5249dc35 Update for vtd.txt: add VT-d hotplug description, remove MSI limitation note because Xen has supported MSI, and add link of VT-d howto on xen wiki for more information about VT-d enabled systems. Signed-off-by: Weidong Han Signed-off-by: Edwin Zhai --- docs/misc/vtd.txt | 35 +++++++++++++++++++++++++++++++---- 1 files changed, 31 insertions(+), 4 deletions(-) diff -r 2cc926c18a7b -r a3b8a99c26eb docs/misc/vtd.txt --- a/docs/misc/vtd.txt Wed May 07 09:22:05 2008 +0100 +++ b/docs/misc/vtd.txt Wed May 07 09:23:29 2008 +0100 @@ -2,7 +2,7 @@ Authors : Allen Kay Weidong Han Created : October-24-2007 -Updated : December-13-2007 +Updated : May-07-2007 How to turn on VT-d in Xen -------------------------- @@ -22,7 +22,7 @@ title Xen-Fedora Core (2.6.18-xen) title Xen-Fedora Core (2.6.18-xen) root (hd0,0) kernel /boot/xen.gz com1=115200,8n1 console=com1 - module /boot/vmlinuz-2.6.18.8-xen root=LABEL=/ ro console=tty0 console=ttyS0,115200,8n1 pciback.hide=(01:00.0)(03:00.0) pciback.verbose_request=1 apic=debug + module /boot/vmlinuz-2.6.18.8-xen root=LABEL=/ ro xencons=ttyS console=tty0 console=ttyS0, pciback.hide=(01:00.0)(03:00.0) module /boot/initrd-2.6.18-xen.img 12) reboot system @@ -47,14 +47,39 @@ 1) Host OS: PAE, 64-bit 1) Host OS: PAE, 64-bit 2) Guest OS: 32-bit, PAE, 64-bit -Because current Xen doesn't support MSI, for guest OS which uses MSI by default, need to add "pci=nomsi" option on its grub, e.g. RHEL5, FC6. - Combinations Tested: -------------------- 1) 64-bit host: 32/PAE/64 Linux/XP/Win2003/Vista guests 2) PAE host: 32/PAE Linux/XP/Win2003/Vista guests + + +VTd device hotplug: +------------------- + +2 virtual PCI slots (6~7) are reserved in HVM guest to support VTd hotplug. If you have more VTd devices, only 2 of them can support hotplug. Usage is simple: + + 1. List the VTd device by dom. You can see a VTd device 0:2:0.0 is inserted in the HVM domain's PCI slot 6. '''lspci''' inside the guest should see the same. + + [root@vt-vtd ~]# xm pci-list HVMDomainVtd + VSlt domain bus slot func + 0x6 0x0 0x02 0x00 0x0 + + 2. Detach the device from the guest by the physical BDF. Then HVM guest will receive a virtual PCI hot removal event to detach the physical device + + [root@vt-vtd ~]# xm pci-detach HVMDomainVtd 0:2:0.0 + + 3. Attach a PCI device to the guest by the physical BDF and desired virtual slot(optional). Following command would insert the physical device into guest's virtual slot 7 + + [root@vt-vtd ~]# xm pci-attach HVMDomainVtd 0:2:0.0 7 + +VTd hotplug usage model: +------------------------ + + * For live migration: As you know, VTd device would break the live migration as physical device can't be save/restored like virtual device. With hotplug, live migration is back again. Just hot remove all the VTd devices before live migration and hot add new VTd devices on target machine after live migration. + + * VTd hotplug for device switch: VTd hotplug can be used to dynamically switch physical device between different HVM guest without shutdown. VT-d Enabled Systems @@ -74,3 +99,5 @@ http://www.dell.com/content/products/cat - HP Compaq: DC7800 http://h10010.www1.hp.com/wwpc/us/en/en/WF04a/12454-12454-64287-321860-3328898.html +For more information, pls refer to http://wiki.xensource.com/xenwiki/VTdHowTo. + _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:30 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:30 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmgw-0004nd-Ek for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:30 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhV-0000Ke-KH; Wed, 07 May 2008 16:41:05 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhH-00005S-NW for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtmhA-0003We-Hg for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:49 +0000 X-SBRS: 3.6 X-MesageID: 159563 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159563" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47GdvsN026262 for ; Wed, 7 May 2008 09:39:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeFaX031518 for ; Wed, 7 May 2008 09:40:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47GeFG5031517 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:15 -0700 Message-Id: <200805071640.m47GeFG5031517@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Vt-d doc: Update modification time. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210149034 -3600 # Node ID 2e6d2eac74d9a5195ebf596b5c98de62dae42d7c # Parent a3b8a99c26ebb464a3c9791a5d48e1bf90c800b8 Vt-d doc: Update modification time. Signed-off-by: Weidong Han --- docs/misc/vtd.txt | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r a3b8a99c26eb -r 2e6d2eac74d9 docs/misc/vtd.txt --- a/docs/misc/vtd.txt Wed May 07 09:23:29 2008 +0100 +++ b/docs/misc/vtd.txt Wed May 07 09:30:34 2008 +0100 @@ -2,7 +2,7 @@ Authors : Allen Kay Weidong Han Created : October-24-2007 -Updated : May-07-2007 +Updated : May-07-2008 How to turn on VT-d in Xen -------------------------- _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:34 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:34 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmgz-0004nh-NL for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:34 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhY-0000OE-Ur; Wed, 07 May 2008 16:41:08 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhK-00007r-Ck for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtmhD-0003Wh-9k for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:52 +0000 X-SBRS: 3.6 X-MesageID: 159564 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159564" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47GdwEX026265 for ; Wed, 7 May 2008 09:39:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeGer031535 for ; Wed, 7 May 2008 09:40:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47GeG7B031534 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:16 -0700 Message-Id: <200805071640.m47GeG7B031534@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 pci passthrough: Make printk messages more exact. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210149955 -3600 # Node ID 0bc9343661273585966f30f12d36ceb784a63787 # Parent 2e6d2eac74d9a5195ebf596b5c98de62dae42d7c x86 pci passthrough: Make printk messages more exact. Signed-off-by: Weidong Han --- xen/arch/x86/domctl.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 2e6d2eac74d9 -r 0bc934366127 xen/arch/x86/domctl.c --- a/xen/arch/x86/domctl.c Wed May 07 09:30:34 2008 +0100 +++ b/xen/arch/x86/domctl.c Wed May 07 09:45:55 2008 +0100 @@ -540,7 +540,7 @@ long arch_do_domctl( if ( device_assigned(bus, devfn) ) { gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: " - "%x:%x:%x already assigned\n", + "%x:%x:%x already assigned, or non-existent\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); break; } @@ -569,7 +569,7 @@ long arch_do_domctl( if ( device_assigned(bus, devfn) ) { gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: " - "%x:%x:%x already assigned\n", + "%x:%x:%x already assigned, or non-existent\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); break; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 07 09:40:37 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 07 May 2008 09:40:37 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jtmh3-0004nm-1B for www-data@colo.xensource.com; Wed, 07 May 2008 09:40:37 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jtmhc-0000Rf-5j; Wed, 07 May 2008 16:41:12 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JtmhM-00009V-3o for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JtmhF-0003Wd-2d for xen-changelog@lists.xensource.com; Wed, 07 May 2008 16:40:53 +0000 X-SBRS: 3.6 X-MesageID: 159565 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,449,1204520400"; d="scan'208";a="159565" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 07 May 2008 12:39:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m47Gdxrc026268 for ; Wed, 7 May 2008 09:39:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m47GeH23031552 for ; Wed, 7 May 2008 09:40:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m47GeHD6031551 for xen-changelog@lists.xensource.com; Wed, 7 May 2008 09:40:17 -0700 Message-Id: <200805071640.m47GeHD6031551@xenbits.xensource.com> Date: Wed, 07 May 2008 09:40:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] XM/XenAPI: Enable Console other_config parameters to be passed through Xen API. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210166208 -3600 # Node ID 9a6ad687ec20dd84753e334b104a154738eae6ec # Parent 0bc9343661273585966f30f12d36ceb784a63787 XM/XenAPI: Enable Console other_config parameters to be passed through Xen API. Signed-off-by: Yosuke Iwamatsu --- tools/python/xen/xm/xenapi_create.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 0bc934366127 -r 9a6ad687ec20 tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Wed May 07 09:45:55 2008 +0100 +++ b/tools/python/xen/xm/xenapi_create.py Wed May 07 14:16:48 2008 +0100 @@ -485,9 +485,9 @@ class xenapi_create: vm_ref, "protocol": console.attributes["protocol"].value, - "other_params": + "other_config": get_child_nodes_as_dict(console, - "other_param", "key", "value") + "other_config", "key", "value") } return server.xenapi.console.create(console_record) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 07:10:05 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 07:10:05 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Ju6ov-0007IY-GF for www-data@colo.xensource.com; Thu, 08 May 2008 07:10:05 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Ju6pU-0005Fp-WC; Thu, 08 May 2008 14:10:41 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Ju6pT-0005Eu-IL for xen-changelog@lists.xensource.com; Thu, 08 May 2008 14:10:39 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Ju6pM-00005P-TU for xen-changelog@lists.xensource.com; Thu, 08 May 2008 14:10:37 +0000 X-SBRS: 3.6 X-MesageID: 166803 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="166803" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 10:09:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48E9oUB031889 for ; Thu, 8 May 2008 07:09:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48EA8rw022140 for ; Thu, 8 May 2008 07:10:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48EA825022139 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 07:10:08 -0700 Message-Id: <200805081410.m48EA825022139@xenbits.xensource.com> Date: Thu, 08 May 2008 07:10:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fixed typos in xmexamples. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210241631 -3600 # Node ID d7dbae33e81d45c86a0a02cc1537144351e38df8 # Parent 9a6ad687ec20dd84753e334b104a154738eae6ec Fixed typos in xmexamples. Signed-off-by: Hiroya INAKOSHI --- tools/examples/xmexample1 | 2 +- tools/examples/xmexample2 | 2 +- tools/examples/xmexample3 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff -r 9a6ad687ec20 -r d7dbae33e81d tools/examples/xmexample1 --- a/tools/examples/xmexample1 Wed May 07 14:16:48 2008 +0100 +++ b/tools/examples/xmexample1 Thu May 08 11:13:51 2008 +0100 @@ -90,7 +90,7 @@ disk = [ 'phy:hda1,hda1,w' ] # # Or you can bind the first unused port above 5900: # -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vnunused=1' ] +# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ] # # You can override the password: # diff -r 9a6ad687ec20 -r d7dbae33e81d tools/examples/xmexample2 --- a/tools/examples/xmexample2 Wed May 07 14:16:48 2008 +0100 +++ b/tools/examples/xmexample2 Thu May 08 11:13:51 2008 +0100 @@ -126,7 +126,7 @@ disk = [ 'phy:sda%d,sda1,w' % (7+vmid), # # Or you can bind the first unused port above 5900: # -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vnunused=1' ] +# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ] # # You can override the password: # diff -r 9a6ad687ec20 -r d7dbae33e81d tools/examples/xmexample3 --- a/tools/examples/xmexample3 Wed May 07 14:16:48 2008 +0100 +++ b/tools/examples/xmexample3 Thu May 08 11:13:51 2008 +0100 @@ -111,7 +111,7 @@ disk = [ 'phy:hda%d,hda1,w' % (vmid)] # # Or you can bind the first unused port above 5900: # -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vnunused=1' ] +# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ] # # You can override the password: # _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 07:10:08 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 07:10:08 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Ju6oy-0007Ie-Cm for www-data@colo.xensource.com; Thu, 08 May 2008 07:10:08 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Ju6pX-0005Ic-UU; Thu, 08 May 2008 14:10:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Ju6pU-0005Ev-Fl for xen-changelog@lists.xensource.com; Thu, 08 May 2008 14:10:40 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Ju6pO-00005U-65 for xen-changelog@lists.xensource.com; Thu, 08 May 2008 14:10:38 +0000 X-SBRS: 3.6 X-MesageID: 166804 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="166804" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 10:09:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48E9qcY031892 for ; Thu, 8 May 2008 07:09:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48EAAVP022203 for ; Thu, 8 May 2008 07:10:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48EAAmm022202 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 07:10:10 -0700 Message-Id: <200805081410.m48EAAmm022202@xenbits.xensource.com> Date: Thu, 08 May 2008 07:10:09 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] defconfigs: Disable MSI support by default. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210241687 -3600 # Node ID 63b51bcb6bf6cdc746cd2662f6c8e6a1ebae078d # Parent e39cf97647af69cd0b09f4e91e539e26194b8a9f defconfigs: Disable MSI support by default. Signed-off-by: Hiroya INAKOSHI --- buildconfigs/linux-defconfig_xen0_x86_32 | 1 + buildconfigs/linux-defconfig_xen0_x86_64 | 1 + buildconfigs/linux-defconfig_xen_x86_32 | 1 + buildconfigs/linux-defconfig_xen_x86_64 | 1 + 4 files changed, 4 insertions(+) diff -r e39cf97647af -r 63b51bcb6bf6 buildconfigs/linux-defconfig_xen0_x86_32 --- a/buildconfigs/linux-defconfig_xen0_x86_32 Mon May 05 10:17:41 2008 +0100 +++ b/buildconfigs/linux-defconfig_xen0_x86_32 Thu May 08 11:14:47 2008 +0100 @@ -248,6 +248,7 @@ CONFIG_XEN_PCIDEV_FRONTEND=y CONFIG_XEN_PCIDEV_FRONTEND=y # CONFIG_XEN_PCIDEV_FE_DEBUG is not set # CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_MSI is not set # CONFIG_PCI_DEBUG is not set CONFIG_ISA_DMA_API=y # CONFIG_SCx200 is not set diff -r e39cf97647af -r 63b51bcb6bf6 buildconfigs/linux-defconfig_xen0_x86_64 --- a/buildconfigs/linux-defconfig_xen0_x86_64 Mon May 05 10:17:41 2008 +0100 +++ b/buildconfigs/linux-defconfig_xen0_x86_64 Thu May 08 11:14:47 2008 +0100 @@ -204,6 +204,7 @@ CONFIG_XEN_PCIDEV_FRONTEND=y CONFIG_XEN_PCIDEV_FRONTEND=y # CONFIG_XEN_PCIDEV_FE_DEBUG is not set # CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_MSI is not set # CONFIG_PCI_DEBUG is not set # diff -r e39cf97647af -r 63b51bcb6bf6 buildconfigs/linux-defconfig_xen_x86_32 --- a/buildconfigs/linux-defconfig_xen_x86_32 Mon May 05 10:17:41 2008 +0100 +++ b/buildconfigs/linux-defconfig_xen_x86_32 Thu May 08 11:14:47 2008 +0100 @@ -254,6 +254,7 @@ CONFIG_XEN_PCIDEV_FRONTEND=y CONFIG_XEN_PCIDEV_FRONTEND=y # CONFIG_XEN_PCIDEV_FE_DEBUG is not set # CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_MSI is not set # CONFIG_PCI_DEBUG is not set CONFIG_ISA_DMA_API=y CONFIG_SCx200=m diff -r e39cf97647af -r 63b51bcb6bf6 buildconfigs/linux-defconfig_xen_x86_64 --- a/buildconfigs/linux-defconfig_xen_x86_64 Mon May 05 10:17:41 2008 +0100 +++ b/buildconfigs/linux-defconfig_xen_x86_64 Thu May 08 11:14:47 2008 +0100 @@ -209,6 +209,7 @@ CONFIG_XEN_PCIDEV_FRONTEND=y CONFIG_XEN_PCIDEV_FRONTEND=y # CONFIG_XEN_PCIDEV_FE_DEBUG is not set # CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_MSI is not set # CONFIG_PCI_DEBUG is not set # _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:08 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:08 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBBv-00022p-He for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:08 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCV-0005bS-2R; Thu, 08 May 2008 18:50:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCT-0005ai-6Q for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:41 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCM-0004JJ-4p for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:38 +0000 X-SBRS: 3.6 X-MesageID: 168910 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168910" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:49:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48Inpb5032761 for ; Thu, 8 May 2008 11:49:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48Io9FZ004877 for ; Thu, 8 May 2008 11:50:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48Io9ca004876 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:09 -0700 Message-Id: <200805081850.m48Io9ca004876@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,INFO_TLD autolearn=no version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Improve "cpus" parameter to be able to define CPU affinities for each VCPU X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210241758 -3600 # Node ID 5c3df1bded8249219dfae4f5a9820636f73aa944 # Parent d7dbae33e81d45c86a0a02cc1537144351e38df8 xend: Improve "cpus" parameter to be able to define CPU affinities for each VCPU If we define the form of list of string to "cpus" parameter, different CPU affinities are set for each VCPU as follows. # grep cpus /etc/xen/vm1 cpus = ["2", "3"] vcpus = 2 # xm create vm1 Using config file "/etc/xen/vm1". Started domain vm1 # xm vcpu-list vm1 Name ID VCPU CPU State Time(s) CPU Affinity vm1 1 0 2 r-- 3.5 2 vm1 1 1 3 -b- 3.2 3 If we define the form of string to "cpus" parameter as before, a same CPU affinity is set for each VCPU as follows. # grep cpus /etc/xen/vm2 cpus = "2,3" vcpus = 2 # xm create vm2 Using config file "/etc/xen/vm2". Started domain vm2 # xm vcpu-list vm2 Name ID VCPU CPU State Time(s) CPU Affinity vm2 2 0 3 -b- 3.0 2-3 vm2 2 1 2 r-- 2.6 2-3 Signed-off-by: Masaki Kanno --- tools/python/xen/xend/XendConfig.py | 108 +++++++++++++++++++++----------- tools/python/xen/xend/XendDomain.py | 31 ++++----- tools/python/xen/xend/XendDomainInfo.py | 23 +++++- 3 files changed, 106 insertions(+), 56 deletions(-) diff -r d7dbae33e81d -r 5c3df1bded82 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Thu May 08 11:13:51 2008 +0100 +++ b/tools/python/xen/xend/XendConfig.py Thu May 08 11:15:58 2008 +0100 @@ -640,46 +640,84 @@ class XendConfig(dict): else: cfg['cpus'] = str(cfg['cpu']) - # Convert 'cpus' to list of ints + # Convert 'cpus' to list of list of ints + cpus_list = [] if 'cpus' in cfg: - cpus = [] + # Convert the following string to list of ints. + # The string supports a list of ranges (0-3), + # seperated by commas, and negation (^1). + # Precedence is settled by order of the string: + # "0-3,^1" -> [0,2,3] + # "0-3,^1,1" -> [0,1,2,3] + def cnv(s): + l = [] + for c in s.split(','): + if c.find('-') != -1: + (x, y) = c.split('-') + for i in range(int(x), int(y)+1): + l.append(int(i)) + else: + # remove this element from the list + if c[0] == '^': + l = [x for x in l if x != int(c[1:])] + else: + l.append(int(c)) + return l + if type(cfg['cpus']) == list: - # If sxp_cfg was created from config.sxp, - # the form of 'cpus' is list of string. - # Convert 'cpus' to list of ints. - # ['1'] -> [1] - # ['0','2','3'] -> [0,2,3] + if len(cfg['cpus']) > 0 and type(cfg['cpus'][0]) == list: + # If sxp_cfg was created from config.sxp, + # the form of 'cpus' is list of list of string. + # Convert 'cpus' to list of list of ints. + # Conversion examples: + # [['1']] -> [[1]] + # [['0','2'],['1','3']] -> [[0,2],[1,3]] + try: + for c1 in cfg['cpus']: + cpus = [] + for c2 in c1: + cpus.append(int(c2)) + cpus_list.append(cpus) + except ValueError, e: + raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) + else: + # Conversion examples: + # ["1"] -> [[1]] + # ["0,2","1,3"] -> [[0,2],[1,3]] + # ["0-3,^1","1-4,^2"] -> [[0,2,3],[1,3,4]] + try: + for c in cfg['cpus']: + cpus = cnv(c) + cpus_list.append(cpus) + except ValueError, e: + raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) + + if len(cpus_list) != cfg['vcpus']: + raise XendConfigError('vcpus and the item number of cpus are not same') + else: + # Conversion examples: + # vcpus=1: + # "1" -> [[1]] + # "0-3,^1" -> [[0,2,3]] + # vcpus=2: + # "1" -> [[1],[1]] + # "0-3,^1" -> [[0,2,3],[0,2,3]] try: - for c in cfg['cpus']: - cpus.append(int(c)) - - cfg['cpus'] = cpus + cpus = cnv(cfg['cpus']) + for v in range(0, cfg['vcpus']): + cpus_list.append(cpus) except ValueError, e: raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) - else: - # Convert 'cpus' string to list of ints - # 'cpus' supports a list of ranges (0-3), - # seperated by commas, and negation, (^1). - # Precedence is settled by order of the - # string: - # "0-3,^1" -> [0,2,3] - # "0-3,^1,1" -> [0,1,2,3] - try: - for c in cfg['cpus'].split(','): - if c.find('-') != -1: - (x, y) = c.split('-') - for i in range(int(x), int(y)+1): - cpus.append(int(i)) - else: - # remove this element from the list - if c[0] == '^': - cpus = [x for x in cpus if x != int(c[1:])] - else: - cpus.append(int(c)) - - cfg['cpus'] = cpus - except ValueError, e: - raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) + else: + # Generation examples: + # vcpus=1: + # -> [[]] + # vcpus=2: + # -> [[],[]] + for v in range(0, cfg['vcpus']): + cpus_list.append(list()) + + cfg['cpus'] = cpus_list # Parse cpuid if 'cpuid' in cfg: diff -r d7dbae33e81d -r 5c3df1bded82 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Thu May 08 11:13:51 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Thu May 08 11:15:58 2008 +0100 @@ -1365,28 +1365,25 @@ class XendDomain: raise XendInvalidDomain(str(domid)) # if vcpu is keyword 'all', apply the cpumap to all vcpus - vcpus = [ vcpu ] if str(vcpu).lower() == "all": vcpus = range(0, int(dominfo.getVCpuCount())) + else: + vcpus = [ int(vcpu) ] # set the same cpumask for all vcpus rc = 0 - if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): - for v in vcpus: - try: - rc = xc.vcpu_setaffinity(dominfo.getDomid(), int(v), cpumap) - except Exception, ex: - log.exception(ex) - raise XendError("Cannot pin vcpu: %s to cpu: %s - %s" % \ - (v, cpumap, str(ex))) - else: - # FIXME: if we could define cpu affinity definitions to - # each vcpu, reprogram the following processing. - if str(vcpu).lower() != "all": - raise XendError("Must specify 'all' to VCPU " - "for inactive managed domains") - dominfo.setCpus(cpumap) - self.managed_config_save(dominfo) + cpus = dominfo.getCpus() + for v in vcpus: + try: + if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): + rc = xc.vcpu_setaffinity(dominfo.getDomid(), v, cpumap) + cpus[v] = cpumap + except Exception, ex: + log.exception(ex) + raise XendError("Cannot pin vcpu: %d to cpu: %s - %s" % \ + (v, cpumap, str(ex))) + dominfo.setCpus(cpus) + self.managed_config_save(dominfo) return rc diff -r d7dbae33e81d -r 5c3df1bded82 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu May 08 11:13:51 2008 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu May 08 11:15:58 2008 +0100 @@ -1051,8 +1051,8 @@ class XendDomainInfo: ['running', 0], ['cpu_time', 0.0], ['cpu', -1], - ['cpumap', self.info['cpus'] and \ - self.info['cpus'] or range(64)]]) + ['cpumap', self.info['cpus'][i] and \ + self.info['cpus'][i] or range(64)]]) return sxpr @@ -1477,6 +1477,13 @@ class XendDomainInfo: self.info['VCPUs_live'] = vcpus self._writeDom(self._vcpuDomDetails()) else: + if self.info['VCPUs_max'] > vcpus: + # decreasing + del self.info['cpus'][vcpus:] + elif self.info['VCPUs_max'] < vcpus: + # increasing + for c in range(self.info['VCPUs_max'], vcpus): + self.info['cpus'].append(list()) self.info['VCPUs_max'] = vcpus xen.xend.XendDomain.instance().managed_config_save(self) log.info("Set VCPU count on domain %s to %d", self.info['name_label'], @@ -2071,9 +2078,17 @@ class XendDomainInfo: # repin domain vcpus if a restricted cpus list is provided # this is done prior to memory allocation to aide in memory # distribution for NUMA systems. - if self.info['cpus'] is not None and len(self.info['cpus']) > 0: + def has_cpus(): + if self.info['cpus'] is not None: + for c in self.info['cpus']: + if c: + return True + return False + + if has_cpus(): for v in range(0, self.info['VCPUs_max']): - xc.vcpu_setaffinity(self.domid, v, self.info['cpus']) + if self.info['cpus'][v]: + xc.vcpu_setaffinity(self.domid, v, self.info['cpus'][v]) else: def find_relaxed_node(node_list): import sys _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:11 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:11 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBBz-00022s-Eb for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:11 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCZ-0005eW-1Q; Thu, 08 May 2008 18:50:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCW-0005an-5B for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCP-0004JL-IN for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:42 +0000 X-SBRS: 3.6 X-MesageID: 168911 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168911" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:49:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48InqqD032764 for ; Thu, 8 May 2008 11:49:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoAbD004894 for ; Thu, 8 May 2008 11:50:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoAtB004893 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:10 -0700 Message-Id: <200805081850.m48IoAtB004893@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix the boot of ia32pae Windows xp guest (up acpi) X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210241914 -3600 # Node ID 3a1758f420d3bb705267fd00d61d2305cd4566e4 # Parent 5c3df1bded8249219dfae4f5a9820636f73aa944 Fix the boot of ia32pae Windows xp guest (up acpi) - X86_FEATURE_APIC should be in edx register. Signed-off-by: Xu Dongxiao --- xen/arch/x86/hvm/hvm.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 5c3df1bded82 -r 3a1758f420d3 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Thu May 08 11:15:58 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Thu May 08 11:18:34 2008 +0100 @@ -1610,7 +1610,7 @@ void hvm_cpuid(unsigned int input, unsig *ebx &= 0x00FFFFFFu; *ebx |= (v->vcpu_id * 2) << 24; if ( vlapic_hw_disabled(vcpu_vlapic(v)) ) - __clear_bit(X86_FEATURE_APIC & 31, ebx); + __clear_bit(X86_FEATURE_APIC & 31, edx); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBC2-00022v-Ds for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCc-0005hq-0k; Thu, 08 May 2008 18:50:50 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCX-0005cA-Ab for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCR-0004JJ-Fe for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:43 +0000 X-SBRS: 3.6 X-MesageID: 168913 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168913" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:49:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48InsiJ000302 for ; Thu, 8 May 2008 11:49:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoCFJ004928 for ; Thu, 8 May 2008 11:50:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoCij004927 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:12 -0700 Message-Id: <200805081850.m48IoCij004927@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: fix port selection shifts X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210242442 -3600 # Node ID 72e70f9041c2c5c4f3d3591f252bcf6dcda7da63 # Parent 36694cae3927bea2934871d287dd1ec0c9912e3d minios: fix port selection shifts Event selectors span unsigned longs, whose size is not always 32 bits. Signed-off-by: Samuel Thibault --- extras/mini-os/hypervisor.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r 36694cae3927 -r 72e70f9041c2 extras/mini-os/hypervisor.c --- a/extras/mini-os/hypervisor.c Thu May 08 11:20:04 2008 +0100 +++ b/extras/mini-os/hypervisor.c Thu May 08 11:27:22 2008 +0100 @@ -58,7 +58,7 @@ void do_hypervisor_callback(struct pt_re l2i = __ffs(l2); l2 &= ~(1 << l2i); - port = (l1i << 5) + l2i; + port = (l1i * (sizeof(unsigned long) * 8)) + l2i; do_event(port, regs); } } @@ -100,7 +100,8 @@ inline void unmask_evtchn(u32 port) * a real IO-APIC we 'lose the interrupt edge' if the channel is masked. */ if ( synch_test_bit (port, &s->evtchn_pending[0]) && - !synch_test_and_set_bit(port>>5, &vcpu_info->evtchn_pending_sel) ) + !synch_test_and_set_bit(port / (sizeof(unsigned long) * 8), + &vcpu_info->evtchn_pending_sel) ) { vcpu_info->evtchn_upcall_pending = 1; if ( !vcpu_info->evtchn_upcall_mask ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBC7-00022y-At for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCg-0005me-VP; Thu, 08 May 2008 18:50:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCZ-0005dQ-FC for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCU-0004JL-Lu for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:45 +0000 X-SBRS: 3.6 X-MesageID: 168914 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168914" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:49:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48Intt2000305 for ; Thu, 8 May 2008 11:49:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoDiM004945 for ; Thu, 8 May 2008 11:50:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoD6B004944 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:13 -0700 Message-Id: <200805081850.m48IoD6B004944@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: clear the event before calling the handler since (especially X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210244019 -3600 # Node ID addfc2db07a3bfaf4b117c3fc6a34a7eb7dc6ab8 # Parent 72e70f9041c2c5c4f3d3591f252bcf6dcda7da63 minios: clear the event before calling the handler since (especially in the SMP case) the handler may make another domain send an event again, and that must not be lost. Signed-off-by: Samuel Thibault --- extras/mini-os/events.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff -r 72e70f9041c2 -r addfc2db07a3 extras/mini-os/events.c --- a/extras/mini-os/events.c Thu May 08 11:27:22 2008 +0100 +++ b/extras/mini-os/events.c Thu May 08 11:53:39 2008 +0100 @@ -58,9 +58,12 @@ int do_event(evtchn_port_t port, struct int do_event(evtchn_port_t port, struct pt_regs *regs) { ev_action_t *action; + + clear_evtchn(port); + if (port >= NR_EVS) { printk("Port number too large: %d\n", port); - goto out; + return 1; } action = &ev_actions[port]; @@ -68,9 +71,6 @@ int do_event(evtchn_port_t port, struct /* call the handler */ action->handler(port, regs, action->data); - - out: - clear_evtchn(port); return 1; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:24 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:24 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCB-000231-Pl for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:24 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCl-0005qa-5s; Thu, 08 May 2008 18:50:59 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCZ-0005di-Vh for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCQ-0004JM-Ig for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:45 +0000 X-SBRS: 3.6 X-MesageID: 168912 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168912" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:49:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48Inr2I032767 for ; Thu, 8 May 2008 11:49:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoBVX004911 for ; Thu, 8 May 2008 11:50:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoBmi004910 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:11 -0700 Message-Id: <200805081850.m48IoBmi004910@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Xend: Fix handling of vnc params. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210242004 -3600 # Node ID 36694cae3927bea2934871d287dd1ec0c9912e3d # Parent 3a1758f420d3bb705267fd00d61d2305cd4566e4 Xend: Fix handling of vnc params. Signed-off-by: Yosuke Iwamatsu --- tools/python/xen/xend/image.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 3a1758f420d3 -r 36694cae3927 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Thu May 08 11:18:34 2008 +0100 +++ b/tools/python/xen/xend/image.py Thu May 08 11:20:04 2008 +0100 @@ -294,11 +294,11 @@ class ImageHandler: vnclisten = vnc_config.get('vnclisten', XendOptions.instance().get_vnclisten_address()) - vncdisplay = vnc_config.get('vncdisplay', 0) + vncdisplay = int(vnc_config.get('vncdisplay', 0)) ret.append('-vnc') ret.append("%s:%s%s" % (vnclisten, vncdisplay, vncopts)) - if vnc_config.get('vncunused', 0): + if int(vnc_config.get('vncunused', 1)) != 0: ret.append('-vncunused') elif has_sdl: _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:28 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:28 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCG-000234-1A for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:28 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCp-0005uW-Lu; Thu, 08 May 2008 18:51:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCe-0005i5-0T for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCV-0004JJ-PS for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:49 +0000 X-SBRS: 3.6 X-MesageID: 168915 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168915" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:49:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48InuMG000308 for ; Thu, 8 May 2008 11:49:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoEpE004962 for ; Thu, 8 May 2008 11:50:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoETj004961 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:14 -0700 Message-Id: <200805081850.m48IoETj004961@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: in non-x86 case, use wmb to enforce ordering between X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210244113 -3600 # Node ID 37cf8747f55bb1e18c01bca4ed6a2bb41c34adb6 # Parent addfc2db07a3bfaf4b117c3fc6a34a7eb7dc6ab8 minios: in non-x86 case, use wmb to enforce ordering between evtchn_upcall_pending and evtchn_pending_sel stores. Signed-off-by: Samuel Thibault --- extras/mini-os/hypervisor.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) diff -r addfc2db07a3 -r 37cf8747f55b extras/mini-os/hypervisor.c --- a/extras/mini-os/hypervisor.c Thu May 08 11:53:39 2008 +0100 +++ b/extras/mini-os/hypervisor.c Thu May 08 11:55:13 2008 +0100 @@ -46,7 +46,11 @@ void do_hypervisor_callback(struct pt_re in_callback = 1; vcpu_info->evtchn_upcall_pending = 0; - /* NB. No need for a barrier here -- XCHG is a barrier on x86. */ + /* NB x86. No need for a barrier here -- XCHG is a barrier on x86. */ +#if !defined(__i386__) && !defined(__x86_64__) + /* Clear master flag /before/ clearing selector flag. */ + wmb(); +#endif l1 = xchg(&vcpu_info->evtchn_pending_sel, 0); while ( l1 != 0 ) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:32 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:32 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCJ-000238-Up for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:32 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCt-0005xy-GR; Thu, 08 May 2008 18:51:07 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCe-0005is-Lb for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCX-0004JL-Ta for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:50 +0000 X-SBRS: 3.6 X-MesageID: 168916 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168916" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:49:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48InvEn000311 for ; Thu, 8 May 2008 11:49:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoFUM004979 for ; Thu, 8 May 2008 11:50:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoFf3004978 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:15 -0700 Message-Id: <200805081850.m48IoFf3004978@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: fix and enforce block_domain atomicity X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210248867 -3600 # Node ID fe625fd796f8de4cf09cba6b7bd0c7e8438e2552 # Parent 37cf8747f55bb1e18c01bca4ed6a2bb41c34adb6 minios: fix and enforce block_domain atomicity To ensure that the timer event is not lost, block_domain requires that event delivery is disabled. SCHEDOP_block re-enables them, so for coherency (and fixing a bug actually), we should re-disable them after. Also, make sure that the caller disabled them. Signed-off-by: Samuel Thibault --- extras/mini-os/arch/x86/time.c | 2 ++ 1 files changed, 2 insertions(+) diff -r 37cf8747f55b -r fe625fd796f8 extras/mini-os/arch/x86/time.c --- a/extras/mini-os/arch/x86/time.c Thu May 08 11:55:13 2008 +0100 +++ b/extras/mini-os/arch/x86/time.c Thu May 08 13:14:27 2008 +0100 @@ -201,10 +201,12 @@ void block_domain(s_time_t until) { struct timeval tv; gettimeofday(&tv, NULL); + ASSERT(irqs_disabled()); if(monotonic_clock() < until) { HYPERVISOR_set_timer_op(until); HYPERVISOR_sched_op(SCHEDOP_block, 0); + local_irq_disable(); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:35 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:35 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCN-00023C-Fg for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:35 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCx-00061P-3I; Thu, 08 May 2008 18:51:11 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCf-0005kB-P2 for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:53 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCY-0004JM-ED for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:51 +0000 X-SBRS: 3.6 X-MesageID: 168917 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168917" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:49:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48InwSc000314 for ; Thu, 8 May 2008 11:49:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoGbp004996 for ; Thu, 8 May 2008 11:50:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoGbe004995 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:16 -0700 Message-Id: <200805081850.m48IoGbe004995@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] shadow: drop guest VRAM write access after some idleness X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210248945 -3600 # Node ID 0ac957f9d42e778565e745d7b6dc55bd527c8e90 # Parent fe625fd796f8de4cf09cba6b7bd0c7e8438e2552 shadow: drop guest VRAM write access after some idleness If the video RAM has been kept clean for at least 2 seconds, we can afford taking the time to drop guest write access, which allows us to save the dirty bit scanning entirely until we get a guest page handle. From: Samuel Thibault Signed-off-by: Keir Fraser --- xen/arch/x86/mm/shadow/common.c | 53 +++++++++++++++++++++++++++++---------- xen/arch/x86/mm/shadow/multi.c | 15 ++++++++++- xen/arch/x86/mm/shadow/private.h | 1 3 files changed, 55 insertions(+), 14 deletions(-) diff -r fe625fd796f8 -r 0ac957f9d42e xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Thu May 08 13:14:27 2008 +0100 +++ b/xen/arch/x86/mm/shadow/common.c Thu May 08 13:15:45 2008 +0100 @@ -2869,6 +2869,8 @@ int shadow_track_dirty_vram(struct domai unsigned long end_pfn = begin_pfn + nr; unsigned long dirty_size = (nr + 7) / 8; int flush_tlb = 0; + unsigned long i; + p2m_type_t t; if (end_pfn < begin_pfn || begin_pfn > d->arch.p2m->max_mapped_pfn @@ -2879,7 +2881,8 @@ int shadow_track_dirty_vram(struct domai if ( d->dirty_vram && (!nr || ( begin_pfn != d->dirty_vram->begin_pfn - || end_pfn != d->dirty_vram->end_pfn )) ) { + || end_pfn != d->dirty_vram->end_pfn )) ) + { /* Different tracking, tear the previous down. */ gdprintk(XENLOG_INFO, "stopping tracking VRAM %lx - %lx\n", d->dirty_vram->begin_pfn, d->dirty_vram->end_pfn); xfree(d->dirty_vram->sl1ma); @@ -2888,17 +2891,16 @@ int shadow_track_dirty_vram(struct domai d->dirty_vram = NULL; } - if ( !nr ) { + if ( !nr ) + { rc = 0; goto out; } /* This should happen seldomly (Video mode change), * no need to be careful. */ - if ( !d->dirty_vram ) { - unsigned long i; - p2m_type_t t; - + if ( !d->dirty_vram ) + { /* Just recount from start. */ for ( i = begin_pfn; i < end_pfn; i++ ) flush_tlb |= sh_remove_all_mappings(d->vcpu[0], gfn_to_mfn(d, i, &t)); @@ -2919,10 +2921,20 @@ int shadow_track_dirty_vram(struct domai goto out_sl1ma; memset(d->dirty_vram->dirty_bitmap, 0, dirty_size); + d->dirty_vram->last_dirty = NOW(); + /* Tell the caller that this time we could not track dirty bits. */ rc = -ENODATA; - } else { - int i; + } + else if (d->dirty_vram->last_dirty == -1) + { + /* still completely clean, just copy our empty bitmap */ + rc = -EFAULT; + if ( copy_to_guest(dirty_bitmap, d->dirty_vram->dirty_bitmap, dirty_size) == 0 ) + rc = 0; + } + else + { #ifdef __i386__ unsigned long map_mfn = INVALID_MFN; void *map_sl1p = NULL; @@ -2930,26 +2942,29 @@ int shadow_track_dirty_vram(struct domai /* Iterate over VRAM to track dirty bits. */ for ( i = 0; i < nr; i++ ) { - p2m_type_t t; mfn_t mfn = gfn_to_mfn(d, begin_pfn + i, &t); struct page_info *page = mfn_to_page(mfn); u32 count_info = page->u.inuse.type_info & PGT_count_mask; int dirty = 0; paddr_t sl1ma = d->dirty_vram->sl1ma[i]; - switch (count_info) { + switch (count_info) + { case 0: /* No guest reference, nothing to track. */ break; case 1: /* One guest reference. */ - if ( sl1ma == INVALID_PADDR ) { + if ( sl1ma == INVALID_PADDR ) + { /* We don't know which sl1e points to this, too bad. */ dirty = 1; /* TODO: Heuristics for finding the single mapping of * this gmfn */ flush_tlb |= sh_remove_all_mappings(d->vcpu[0], gfn_to_mfn(d, begin_pfn + i, &t)); - } else { + } + else + { /* Hopefully the most common case: only one mapping, * whose dirty bit we can use. */ l1_pgentry_t *sl1e; @@ -2968,7 +2983,8 @@ int shadow_track_dirty_vram(struct domai sl1e = maddr_to_virt(sl1ma); #endif - if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY ) { + if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY ) + { dirty = 1; /* Note: this is atomic, so we may clear a * _PAGE_ACCESSED set by another processor. */ @@ -2985,7 +3001,10 @@ int shadow_track_dirty_vram(struct domai } if ( dirty ) + { d->dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8); + d->dirty_vram->last_dirty = NOW(); + } } #ifdef __i386__ @@ -2996,6 +3015,14 @@ int shadow_track_dirty_vram(struct domai rc = -EFAULT; if ( copy_to_guest(dirty_bitmap, d->dirty_vram->dirty_bitmap, dirty_size) == 0 ) { memset(d->dirty_vram->dirty_bitmap, 0, dirty_size); + if (d->dirty_vram->last_dirty + SECONDS(2) < NOW()) + { + /* was clean for more than two seconds, try to disable guest + * write access */ + for ( i = begin_pfn; i < end_pfn; i++ ) + flush_tlb |= sh_remove_write_access(d->vcpu[0], gfn_to_mfn(d, i, &t), 1, 0); + d->dirty_vram->last_dirty = -1; + } rc = 0; } } diff -r fe625fd796f8 -r 0ac957f9d42e xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu May 08 13:14:27 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Thu May 08 13:15:45 2008 +0100 @@ -870,6 +870,17 @@ _sh_propagate(struct vcpu *v, } } + if ( unlikely((level == 1) && d->dirty_vram + && d->dirty_vram->last_dirty == -1 + && gfn_x(target_gfn) >= d->dirty_vram->begin_pfn + && gfn_x(target_gfn) < d->dirty_vram->end_pfn) ) + { + if ( ft & FETCH_TYPE_WRITE ) + d->dirty_vram->last_dirty = NOW(); + else + sflags &= ~_PAGE_RW; + } + /* Read-only memory */ if ( p2mt == p2m_ram_ro ) sflags &= ~_PAGE_RW; @@ -1320,8 +1331,10 @@ static inline void shadow_vram_put_l1e(s * just hope it will remain. */ } } - if ( dirty ) + if ( dirty ) { d->dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8); + d->dirty_vram->last_dirty = NOW(); + } } } diff -r fe625fd796f8 -r 0ac957f9d42e xen/arch/x86/mm/shadow/private.h --- a/xen/arch/x86/mm/shadow/private.h Thu May 08 13:14:27 2008 +0100 +++ b/xen/arch/x86/mm/shadow/private.h Thu May 08 13:15:45 2008 +0100 @@ -536,6 +536,7 @@ struct sh_dirty_vram { unsigned long end_pfn; paddr_t *sl1ma; uint8_t *dirty_bitmap; + s_time_t last_dirty; }; /**************************************************************************/ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:39 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:39 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCQ-00023F-Vo for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:39 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBD0-00064q-Gv; Thu, 08 May 2008 18:51:14 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCj-0005nv-Q9 for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:57 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCd-0004JL-3K for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:55 +0000 X-SBRS: 3.6 X-MesageID: 168920 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168920" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:50:02 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48Io219000323 for ; Thu, 8 May 2008 11:50:02 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoKIh005047 for ; Thu, 8 May 2008 11:50:20 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoKwa005046 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:20 -0700 Message-Id: <200805081850.m48IoKwa005046@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:19 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,INFO_TLD autolearn=no version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Fix and improve error handling for failed suspend/migrate X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210253611 -3600 # Node ID c99a88623eda83d8e02f4b6d7c32bc4c6d298d8a # Parent 8bd776540ab319d73b8e55656ad2c342c178a5b1 xend: Fix and improve error handling for failed suspend/migrate This has been broken since cset 16964:5d84464dc1fc Also deal better with very early errors (close sender side socket) Signed-off-by: Steven Hand --- tools/python/xen/xend/XendCheckpoint.py | 14 ++------------ tools/python/xen/xend/XendDomain.py | 6 ++++-- tools/python/xen/xend/XendDomainInfo.py | 13 ++++++++++++- 3 files changed, 18 insertions(+), 15 deletions(-) diff -r 8bd776540ab3 -r c99a88623eda tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Thu May 08 14:32:11 2008 +0100 +++ b/tools/python/xen/xend/XendCheckpoint.py Thu May 08 14:33:31 2008 +0100 @@ -81,8 +81,6 @@ def save(fd, dominfo, network, live, dst # thing is useful for debugging. dominfo.setName('migrating-' + domain_name) - done_suspend = 0 - try: dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP1, domain_name) @@ -110,7 +108,6 @@ def save(fd, dominfo, network, live, dst log.debug("Suspending %d ...", dominfo.getDomid()) dominfo.shutdown('suspend') dominfo.waitForShutdown() - done_suspend = 1 dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, domain_name) log.info("Domain %d suspended.", dominfo.getDomid()) @@ -154,16 +151,9 @@ def save(fd, dominfo, network, live, dst pass except Exception, exn: - log.exception("Save failed on domain %s (%s).", domain_name, + log.exception("Save failed on domain %s (%s) - resuming.", domain_name, dominfo.getDomid()) - - # If we didn't get as far as suspending the domain (for - # example, we couldn't balloon enough memory for the new - # domain), then we don't want to re-plumb the devices, as the - # domU will not be expecting it. - if done_suspend: - log.debug("XendCheckpoint.save: resumeDomain") - dominfo.resumeDomain() + dominfo.resumeDomain() try: dominfo.setName(domain_name) diff -r 8bd776540ab3 -r c99a88623eda tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Thu May 08 14:32:11 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Thu May 08 14:33:31 2008 +0100 @@ -1308,8 +1308,10 @@ class XendDomain: sock.send("receive\n") sock.recv(80) - XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst, node=node) - sock.close() + try: + XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst, node=node) + finally: + sock.close() def domain_save(self, domid, dst, checkpoint=False): """Start saving a domain to file. diff -r 8bd776540ab3 -r c99a88623eda tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu May 08 14:32:11 2008 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu May 08 14:33:31 2008 +0100 @@ -2378,8 +2378,19 @@ class XendDomainInfo: def resumeDomain(self): log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid)) - if self.domid is None: + # resume a suspended domain (e.g. after live checkpoint, or after + # a later error during save or migate); checks that the domain + # is currently suspended first so safe to call from anywhere + + xeninfo = dom_get(self.domid) + if xeninfo is None: return + if not xeninfo['shutdown']: + return + reason = shutdown_reason(xeninfo['shutdown_reason']) + if reason != 'suspend': + return + try: # could also fetch a parsed note from xenstore fast = self.info.get_notes().get('SUSPEND_CANCEL') and 1 or 0 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:46 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:46 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCX-00023K-6Q for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:46 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBD6-00069C-KK; Thu, 08 May 2008 18:51:20 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCk-0005oM-6T for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCe-0004JM-7S for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:50:56 +0000 X-SBRS: 3.6 X-MesageID: 168918 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168918" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:50:00 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48Io0sd000317 for ; Thu, 8 May 2008 11:50:00 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoIK6005013 for ; Thu, 8 May 2008 11:50:18 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoI49005012 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:18 -0700 Message-Id: <200805081850.m48IoI49005012@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-SA-Exim-Scanned: No (on lists.xensource.com); Message bigger than SAmaxbody (256000) Subject: [Xen-changelog] [xen-unstable] Remove defunct powerpc port. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210250440 -3600 # Node ID b0d7780794ebb087766391380b1c17467f016fb6 # Parent 0ac957f9d42e778565e745d7b6dc55bd527c8e90 Remove defunct powerpc port. Signed-off-by: Keir Fraser --- config/powerpc64.mk | 6 tools/libxc/powerpc64/Makefile | 4 tools/libxc/powerpc64/flatdevtree.c | 662 ----------- tools/libxc/powerpc64/flatdevtree.h | 108 - tools/libxc/powerpc64/flatdevtree_env.h | 94 - tools/libxc/powerpc64/mk_flatdevtree.c | 648 ---------- tools/libxc/powerpc64/mk_flatdevtree.h | 37 tools/libxc/powerpc64/xc_memory.c | 42 tools/libxc/xc_core_powerpc.c | 79 - tools/libxc/xc_core_powerpc.h | 58 tools/libxc/xc_dom_powerpc.c | 236 --- tools/xm-test/ramdisk/configs/buildroot-powerpc | 338 ----- xen/arch/powerpc/0opt.c | 34 xen/arch/powerpc/Makefile | 152 -- xen/arch/powerpc/Rules.mk | 52 xen/arch/powerpc/audit.c | 47 xen/arch/powerpc/backtrace.c | 217 --- xen/arch/powerpc/bitops.c | 94 - xen/arch/powerpc/boot_of.c | 1257 --------------------- xen/arch/powerpc/cmdline.c | 24 xen/arch/powerpc/crash.c | 20 xen/arch/powerpc/dart.c | 297 ---- xen/arch/powerpc/dart.h | 36 xen/arch/powerpc/dart_u3.c | 108 - xen/arch/powerpc/dart_u4.c | 184 --- xen/arch/powerpc/domain.c | 357 ----- xen/arch/powerpc/domain_build.c | 297 ---- xen/arch/powerpc/domctl.c | 120 -- xen/arch/powerpc/exceptions.c | 91 - xen/arch/powerpc/exceptions.h | 54 xen/arch/powerpc/external.c | 202 --- xen/arch/powerpc/float.S | 243 ---- xen/arch/powerpc/gdbstub.c | 216 --- xen/arch/powerpc/hcalls.c | 171 -- xen/arch/powerpc/iommu.c | 95 - xen/arch/powerpc/iommu.h | 28 xen/arch/powerpc/irq.c | 22 xen/arch/powerpc/machine_kexec.c | 41 xen/arch/powerpc/memory.c | 224 --- xen/arch/powerpc/mm.c | 617 ---------- xen/arch/powerpc/mpic.c | 1100 ------------------ xen/arch/powerpc/mpic_init.c | 416 ------ xen/arch/powerpc/mpic_init.h | 27 xen/arch/powerpc/multiboot2.c | 67 - xen/arch/powerpc/numa.c | 1 xen/arch/powerpc/of-devtree.c | 1087 ------------------ xen/arch/powerpc/of-devtree.h | 157 -- xen/arch/powerpc/of-devwalk.c | 133 -- xen/arch/powerpc/of_handler/Makefile | 32 xen/arch/powerpc/of_handler/console.c | 233 --- xen/arch/powerpc/of_handler/control.c | 90 - xen/arch/powerpc/of_handler/cpu.c | 82 - xen/arch/powerpc/of_handler/devtree.c | 268 ---- xen/arch/powerpc/of_handler/head.S | 156 -- xen/arch/powerpc/of_handler/io.c | 160 -- xen/arch/powerpc/of_handler/leap.S | 38 xen/arch/powerpc/of_handler/memcmp.c | 39 xen/arch/powerpc/of_handler/memory.c | 129 -- xen/arch/powerpc/of_handler/memset.c | 67 - xen/arch/powerpc/of_handler/ofh.c | 439 ------- xen/arch/powerpc/of_handler/ofh.h | 164 -- xen/arch/powerpc/of_handler/papr.S | 97 - xen/arch/powerpc/of_handler/papr.h | 69 - xen/arch/powerpc/of_handler/rtas.c | 82 - xen/arch/powerpc/of_handler/services.c | 96 - xen/arch/powerpc/of_handler/snprintf.c | 332 ----- xen/arch/powerpc/of_handler/strcmp.c | 36 xen/arch/powerpc/of_handler/strlcpy.c | 58 xen/arch/powerpc/of_handler/strlen.c | 30 xen/arch/powerpc/of_handler/strncmp.c | 39 xen/arch/powerpc/of_handler/strnlen.c | 30 xen/arch/powerpc/of_handler/vdevice.c | 74 - xen/arch/powerpc/of_handler/xen_hvcall.S | 44 xen/arch/powerpc/of_handler/xencomm.c | 84 - xen/arch/powerpc/ofd_fixup.c | 428 ------- xen/arch/powerpc/ofd_fixup_memory.c | 128 -- xen/arch/powerpc/oftree.h | 38 xen/arch/powerpc/papr/Makefile | 11 xen/arch/powerpc/papr/debug.c | 84 - xen/arch/powerpc/papr/h_perfmon.c | 158 -- xen/arch/powerpc/papr/tce.c | 84 - xen/arch/powerpc/papr/vtce.c | 158 -- xen/arch/powerpc/papr/vterm.c | 70 - xen/arch/powerpc/papr/xlate.c | 619 ---------- xen/arch/powerpc/physdev.c | 24 xen/arch/powerpc/platform.c | 43 xen/arch/powerpc/powerpc64/Makefile | 14 xen/arch/powerpc/powerpc64/asm-offsets.c | 67 - xen/arch/powerpc/powerpc64/domain.c | 222 --- xen/arch/powerpc/powerpc64/exceptions.S | 644 ---------- xen/arch/powerpc/powerpc64/hypercall_table.S | 46 xen/arch/powerpc/powerpc64/io.S | 193 --- xen/arch/powerpc/powerpc64/memcpy.S | 171 -- xen/arch/powerpc/powerpc64/ppc970.c | 302 ----- xen/arch/powerpc/powerpc64/ppc970_machinecheck.c | 125 -- xen/arch/powerpc/powerpc64/ppc970_scom.c | 184 --- xen/arch/powerpc/powerpc64/prom_call.S | 116 - xen/arch/powerpc/powerpc64/scom.h | 39 xen/arch/powerpc/powerpc64/string.S | 286 ---- xen/arch/powerpc/powerpc64/traps.c | 58 xen/arch/powerpc/ppc32/prom_call.c | 41 xen/arch/powerpc/rtas.c | 201 --- xen/arch/powerpc/rtas.h | 65 - xen/arch/powerpc/rtas_flash.c | 182 --- xen/arch/powerpc/rtas_nvram.c | 129 -- xen/arch/powerpc/setup.c | 509 -------- xen/arch/powerpc/shadow.c | 155 -- xen/arch/powerpc/smp-tbsync.c | 193 --- xen/arch/powerpc/smp.c | 214 --- xen/arch/powerpc/smpboot.c | 29 xen/arch/powerpc/start.S | 62 - xen/arch/powerpc/sysctl.c | 65 - xen/arch/powerpc/systemsim.S | 64 - xen/arch/powerpc/tce.h | 71 - xen/arch/powerpc/time.c | 90 - xen/arch/powerpc/usercopy.c | 50 xen/arch/powerpc/xen.lds.S | 250 ---- xen/include/asm-powerpc/acpi.h | 2 xen/include/asm-powerpc/asm_defns.h | 28 xen/include/asm-powerpc/atomic.h | 211 --- xen/include/asm-powerpc/bitops.h | 309 ----- xen/include/asm-powerpc/boot.h | 46 xen/include/asm-powerpc/bug.h | 7 xen/include/asm-powerpc/byteorder.h | 80 - xen/include/asm-powerpc/cache.h | 74 - xen/include/asm-powerpc/config.h | 85 - xen/include/asm-powerpc/current.h | 79 - xen/include/asm-powerpc/debugger.h | 97 - xen/include/asm-powerpc/delay.h | 40 xen/include/asm-powerpc/desc.h | 25 xen/include/asm-powerpc/div64.h | 33 xen/include/asm-powerpc/domain.h | 123 -- xen/include/asm-powerpc/elf.h | 30 xen/include/asm-powerpc/event.h | 99 - xen/include/asm-powerpc/flushtlb.h | 105 - xen/include/asm-powerpc/grant_table.h | 92 - xen/include/asm-powerpc/guest_access.h | 26 xen/include/asm-powerpc/hardirq.h | 21 xen/include/asm-powerpc/hcalls.h | 34 xen/include/asm-powerpc/htab.h | 136 -- xen/include/asm-powerpc/hypercall.h | 26 xen/include/asm-powerpc/init.h | 40 xen/include/asm-powerpc/io.h | 69 - xen/include/asm-powerpc/iocap.h | 26 xen/include/asm-powerpc/irq.h | 31 xen/include/asm-powerpc/mach-default/irq_vectors.h | 89 - xen/include/asm-powerpc/memory.h | 39 xen/include/asm-powerpc/mm.h | 286 ---- xen/include/asm-powerpc/mpic.h | 294 ---- xen/include/asm-powerpc/msr.h | 66 - xen/include/asm-powerpc/multicall.h | 27 xen/include/asm-powerpc/nmi.h | 9 xen/include/asm-powerpc/numa.h | 28 xen/include/asm-powerpc/page.h | 134 -- xen/include/asm-powerpc/papr.h | 219 --- xen/include/asm-powerpc/pci.h | 35 xen/include/asm-powerpc/percpu.h | 36 xen/include/asm-powerpc/perfc.h | 16 xen/include/asm-powerpc/platform.h | 28 xen/include/asm-powerpc/powerpc64/config.h | 39 xen/include/asm-powerpc/powerpc64/ppc970-hid.h | 144 -- xen/include/asm-powerpc/powerpc64/ppc970.h | 31 xen/include/asm-powerpc/powerpc64/procarea.h | 38 xen/include/asm-powerpc/powerpc64/processor.h | 228 --- xen/include/asm-powerpc/powerpc64/string.h | 42 xen/include/asm-powerpc/processor.h | 429 ------- xen/include/asm-powerpc/reg_defs.h | 210 --- xen/include/asm-powerpc/regs.h | 25 xen/include/asm-powerpc/shadow.h | 52 xen/include/asm-powerpc/shared.h | 4 xen/include/asm-powerpc/smp.h | 60 - xen/include/asm-powerpc/softirq.h | 6 xen/include/asm-powerpc/spinlock.h | 218 --- xen/include/asm-powerpc/string.h | 26 xen/include/asm-powerpc/system.h | 247 ---- xen/include/asm-powerpc/time.h | 86 - xen/include/asm-powerpc/trace.h | 4 xen/include/asm-powerpc/types.h | 79 - xen/include/asm-powerpc/xenoprof.h | 100 - xen/include/public/arch-powerpc.h | 120 -- Config.mk | 3 tools/libxc/Makefile | 2 tools/libxc/xc_core.h | 2 tools/libxc/xc_dom_elfloader.c | 2 tools/libxc/xenctrl.h | 9 tools/libxc/xenguest.h | 14 tools/python/xen/lowlevel/xc/xc.c | 32 tools/python/xen/xend/arch.py | 2 tools/python/xen/xend/image.py | 17 tools/xm-test/lib/XmTestLib/arch.py | 40 tools/xm-test/lib/XmTestReport/arch.py | 6 tools/xm-test/ramdisk/Makefile.am | 2 tools/xm-test/ramdisk/make-release.sh | 3 tools/xm-test/runtest.sh | 2 xen/Rules.mk | 3 xen/include/asm-x86/desc.h | 2 xen/include/public/io/protocols.h | 3 xen/include/public/libelf.h | 4 xen/include/public/xen.h | 2 199 files changed, 6 insertions(+), 25862 deletions(-) diff -r 0ac957f9d42e -r b0d7780794eb Config.mk --- a/Config.mk Thu May 08 13:15:45 2008 +0100 +++ b/Config.mk Thu May 08 13:40:40 2008 +0100 @@ -4,8 +4,7 @@ debug ?= n debug ?= n XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ \ - -e s/ppc/powerpc/ -e s/i86pc/x86_32/ \ - -e s/amd64/x86_64/) + -e s/i86pc/x86_32/ -e s/amd64/x86_64/) XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH) XEN_OS ?= $(shell uname -s) diff -r 0ac957f9d42e -r b0d7780794eb config/powerpc64.mk --- a/config/powerpc64.mk Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -CONFIG_POWERPC := y -CONFIG_POWERPC_$(XEN_OS) := y - -CONFIG_XENCOMM := y - -CFLAGS += -DELFSIZE=64 diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/Makefile --- a/tools/libxc/Makefile Thu May 08 13:15:45 2008 +0100 +++ b/tools/libxc/Makefile Thu May 08 13:40:40 2008 +0100 @@ -9,7 +9,6 @@ CTRL_SRCS-y += xc_core.c CTRL_SRCS-y += xc_core.c CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c -CTRL_SRCS-$(CONFIG_POWERPC) += xc_core_powerpc.c endif CTRL_SRCS-y += xc_domain.c CTRL_SRCS-y += xc_evtchn.c @@ -55,7 +54,6 @@ GUEST_SRCS-$(CONFIG_X86) += xc_dom_x GUEST_SRCS-$(CONFIG_X86) += xc_dom_x86.c GUEST_SRCS-$(CONFIG_X86) += xc_cpuid_x86.c GUEST_SRCS-$(CONFIG_IA64) += xc_dom_ia64.c -GUEST_SRCS-$(CONFIG_POWERPC) += xc_dom_powerpc.c endif -include $(XEN_TARGET_ARCH)/Makefile diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/Makefile --- a/tools/libxc/powerpc64/Makefile Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -GUEST_SRCS-y += powerpc64/flatdevtree.c -GUEST_SRCS-y += powerpc64/mk_flatdevtree.c - -CTRL_SRCS-y += powerpc64/xc_memory.c diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/flatdevtree.c --- a/tools/libxc/powerpc64/flatdevtree.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,662 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright Pantelis Antoniou 2006 - * Copyright IBM Corporation 2006, 2007 - * 2006 (c) MontaVista, Software, Inc. - * - * Authors: Pantelis Antoniou - * Hollis Blanchard - * Mark A. Greer - */ - -#include "flatdevtree.h" - -/* Set ptrs to current one's info; return addr of next one */ -static u32 *ft_next(u32 *p, const u32 *p_strings, const u32 version, - u32 **tagpp, char **namepp, char **datapp, u32 **sizepp) -{ - u32 sz; - - *namepp = NULL; - *datapp = NULL; - *sizepp = NULL; - *tagpp = p; - - switch (be32_to_cpu(*p++)) { /* Tag */ - case OF_DT_BEGIN_NODE: - *namepp = (char *)p; - p = (u32 *)_ALIGN((unsigned long)p + strlen((char *)p) + 1, 4); - break; - case OF_DT_PROP: - sz = be32_to_cpu(*p); - *sizepp = p++; - *namepp = (char *)p_strings + be32_to_cpu(*p++); - if ((version < 0x10) && (sz >= 8)) - p = (u32 *)_ALIGN((unsigned long)p, 8); - *datapp = (char *)p; - p = (u32 *)_ALIGN((unsigned long)p + sz, 4); - break; - case OF_DT_END_NODE: - case OF_DT_NOP: - break; - case OF_DT_END: - default: - p = NULL; - break; - } - - return p; -} - -static void ft_put_word(struct ft_cxt *cxt, u32 v) -{ - if (cxt->overflow) /* do nothing */ - return; - - /* check for overflow */ - if (cxt->p + 4 > cxt->pstr) { - cxt->overflow = 1; - return; - } - - *(u32 *) cxt->p = cpu_to_be32(v); - cxt->p += 4; -} - -static inline void ft_put_bin(struct ft_cxt *cxt, const void *data, int sz) -{ - char *p; - - if (cxt->overflow) /* do nothing */ - return; - - /* next pointer pos */ - p = (char *) _ALIGN((unsigned long)cxt->p + sz, 4); - - /* check for overflow */ - if (p > cxt->pstr) { - cxt->overflow = 1; - return; - } - - memcpy(cxt->p, data, sz); - if ((sz & 3) != 0) - memset(cxt->p + sz, 0, 4 - (sz & 3)); - cxt->p = p; -} - -void ft_begin_node(struct ft_cxt *cxt, const char *name) -{ - ft_put_word(cxt, OF_DT_BEGIN_NODE); - ft_put_bin(cxt, name, strlen(name) + 1); -} - -void ft_end_node(struct ft_cxt *cxt) -{ - ft_put_word(cxt, OF_DT_END_NODE); -} - -void ft_nop(struct ft_cxt *cxt) -{ - ft_put_word(cxt, OF_DT_NOP); -} - -static int lookup_string(struct ft_cxt *cxt, const char *name) -{ - char *p; - - p = cxt->pstr; - while (p < cxt->pstr_begin) { - if (strcmp(p, (char *)name) == 0) - return p - cxt->p_begin; - p += strlen(p) + 1; - } - - return -1; -} - -void ft_prop(struct ft_cxt *cxt, const char *name, - const void *data, unsigned int sz) -{ - int len, off; - - if (cxt->overflow) - return; - - len = strlen(name) + 1; - - off = lookup_string(cxt, name); - if (off == -1) { - /* check if we have space */ - if (cxt->p + 12 + sz + len > cxt->pstr) { - cxt->overflow = 1; - return; - } - - cxt->pstr -= len; - memcpy(cxt->pstr, name, len); - off = cxt->pstr - cxt->p_begin; - } - - /* now put offset from beginning of *STRUCTURE* */ - /* will be fixed up at the end */ - ft_put_word(cxt, OF_DT_PROP); - ft_put_word(cxt, sz); - ft_put_word(cxt, off); - ft_put_bin(cxt, data, sz); -} - -void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str) -{ - ft_prop(cxt, name, str, strlen(str) + 1); -} - -void ft_prop_int(struct ft_cxt *cxt, const char *name, unsigned int val) -{ - u32 v = cpu_to_be32((u32) val); - - ft_prop(cxt, name, &v, 4); -} - -/* start construction of the flat OF tree */ -void ft_begin(struct ft_cxt *cxt, void *blob, unsigned int max_size) -{ - struct boot_param_header *bph = blob; - u32 off; - - /* clear the cxt */ - memset(cxt, 0, sizeof(*cxt)); - - cxt->bph = bph; - cxt->max_size = max_size; - - /* zero everything in the header area */ - memset(bph, 0, sizeof(*bph)); - - bph->magic = cpu_to_be32(OF_DT_HEADER); - bph->version = cpu_to_be32(0x10); - bph->last_comp_version = cpu_to_be32(0x10); - - /* start pointers */ - cxt->pres_begin = (char *) _ALIGN((unsigned long)(bph + 1), 8); - cxt->pres = cxt->pres_begin; - - off = (unsigned long)cxt->pres_begin - (unsigned long)bph; - bph->off_mem_rsvmap = cpu_to_be32(off); - - ((u64 *) cxt->pres)[0] = 0; /* phys = 0, size = 0, terminate */ - ((u64 *) cxt->pres)[1] = 0; - - cxt->p_anchor = cxt->pres + 16; /* over the terminator */ -} - -/* add a reserver physical area to the rsvmap */ -void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size) -{ - ((u64 *) cxt->pres)[0] = cpu_to_be64(physaddr); /* phys = 0, size = 0, terminate */ - ((u64 *) cxt->pres)[1] = cpu_to_be64(size); - - cxt->pres += 16; /* advance two u64s worth */ - - ((u64 *) cxt->pres)[0] = 0; /* phys = 0, size = 0, terminate */ - ((u64 *) cxt->pres)[1] = 0; - - /* keep track of size */ - cxt->res_size = cxt->pres + 16 - cxt->pres_begin; - - cxt->p_anchor = cxt->pres + 16; /* over the terminator */ -} - -int ft_set_rsvmap(void *bphp, int m, u64 physaddr, u64 size) -{ - const struct boot_param_header *bph = bphp; - u64 *p_rsvmap = (u64 *) - ((char *)bph + be32_to_cpu(bph->off_mem_rsvmap)); - u32 i; - - for (i = 0;; i++) { - u64 addr, sz; - - addr = be64_to_cpu(p_rsvmap[i * 2]); - sz = be64_to_cpu(p_rsvmap[i * 2 + 1]); - if (addr == 0 && size == 0) - break; - if (m == i) { - p_rsvmap[i * 2] = cpu_to_be64(physaddr); - p_rsvmap[i * 2 + 1] = cpu_to_be64(size); - return 0; - } - } - return -1; -} - -void ft_begin_tree(struct ft_cxt *cxt) -{ - cxt->p_begin = cxt->p_anchor; - cxt->pstr_begin = (char *)cxt->bph + cxt->max_size; /* point at the end */ - - cxt->p = cxt->p_begin; - cxt->pstr = cxt->pstr_begin; -} - -int ft_end_tree(struct ft_cxt *cxt) -{ - struct boot_param_header *bph = cxt->bph; - int off, sz, sz1; - u32 tag, v; - char *p; - - ft_put_word(cxt, OF_DT_END); - - if (cxt->overflow) - return -ENOMEM; - - /* size of the areas */ - cxt->struct_size = cxt->p - cxt->p_begin; - cxt->strings_size = cxt->pstr_begin - cxt->pstr; - - /* the offset we must move */ - off = (cxt->pstr_begin - cxt->p_begin) - cxt->strings_size; - - /* the new strings start */ - cxt->pstr_begin = cxt->p_begin + cxt->struct_size; - - /* move the whole string area */ - memmove(cxt->pstr_begin, cxt->pstr, cxt->strings_size); - - /* now perform the fixup of the strings */ - p = cxt->p_begin; - while ((tag = be32_to_cpu(*(u32 *) p)) != OF_DT_END) { - p += 4; - - if (tag == OF_DT_BEGIN_NODE) { - p = (char *) _ALIGN((unsigned long)p + strlen(p) + 1, 4); - continue; - } - - if (tag == OF_DT_END_NODE || tag == OF_DT_NOP) - continue; - - if (tag != OF_DT_PROP) - return -EINVAL; - - sz = be32_to_cpu(*(u32 *) p); - p += 4; - - v = be32_to_cpu(*(u32 *) p); - v -= off; - *(u32 *) p = cpu_to_be32(v); /* move down */ - p += 4; - - p = (char *) _ALIGN((unsigned long)p + sz, 4); - } - - /* fix sizes */ - p = (char *)cxt->bph; - sz = (cxt->pstr_begin + cxt->strings_size) - p; - sz1 = _ALIGN(sz, 16); /* align at 16 bytes */ - if (sz != sz1) - memset(p + sz, 0, sz1 - sz); - bph->totalsize = cpu_to_be32(sz1); - bph->off_dt_struct = cpu_to_be32(cxt->p_begin - p); - bph->off_dt_strings = cpu_to_be32(cxt->pstr_begin - p); - - /* the new strings start */ - cxt->pstr_begin = cxt->p_begin + cxt->struct_size; - cxt->pstr = cxt->pstr_begin + cxt->strings_size; - - /* mark the size of string structure in bph */ - bph->size_dt_strings = cxt->strings_size; - - return 0; -} - -/**********************************************************************/ - -static inline int isprint(int c) -{ - return c >= 0x20 && c <= 0x7e; -} - -static int is_printable_string(const void *data, int len) -{ - const char *s = data; - const char *ss; - - /* zero length is not */ - if (len == 0) - return 0; - - /* must terminate with zero */ - if (s[len - 1] != '\0') - return 0; - - ss = s; - while (*s && isprint(*s)) - s++; - - /* not zero, or not done yet */ - if (*s != '\0' || (s + 1 - ss) < len) - return 0; - - return 1; -} - -static void print_data(const void *data, int len) -{ - int i; - const char *s; - - /* no data, don't print */ - if (len == 0) - return; - - if (is_printable_string(data, len)) { - printf(" = \"%s\"", (char *)data); - return; - } - - switch (len) { - case 1: /* byte */ - printf(" = <0x%02x>", (*(char *) data) & 0xff); - break; - case 2: /* half-word */ - printf(" = <0x%04x>", be16_to_cpu(*(u16 *) data) & 0xffff); - break; - case 4: /* word */ - printf(" = <0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU); - break; - case 8: /* double-word */ - printf(" = <0x%16llx>", be64_to_cpu(*(u64 *) data)); - break; - default: /* anything else... hexdump */ - printf(" = ["); - for (i = 0, s = data; i < len; i++) - printf("%02x%s", s[i], i < len - 1 ? " " : ""); - printf("]"); - - break; - } -} - -void ft_dump_blob(const void *bphp) -{ - const struct boot_param_header *bph = bphp; - const u64 *p_rsvmap = (const u64 *) - ((const char *)bph + be32_to_cpu(bph->off_mem_rsvmap)); - const u32 *p_struct = (const u32 *) - ((const char *)bph + be32_to_cpu(bph->off_dt_struct)); - const u32 *p_strings = (const u32 *) - ((const char *)bph + be32_to_cpu(bph->off_dt_strings)); - const u32 version = be32_to_cpu(bph->version); - u32 i, *p, *tagp, *sizep; - char *namep, *datap; - int depth, shift; - u64 addr, size; - - - if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { - /* not valid tree */ - return; - } - - depth = 0; - shift = 4; - - for (i = 0;; i++) { - addr = be64_to_cpu(p_rsvmap[i * 2]); - size = be64_to_cpu(p_rsvmap[i * 2 + 1]); - if (addr == 0 && size == 0) - break; - - printf("/memreserve/ 0x%llx 0x%llx;\n", addr, size); - } - - p = (u32 *)p_struct; - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - printf("%*s%s {\n", depth * shift, "", namep); - depth++; - break; - case OF_DT_END_NODE: - depth--; - printf("%*s};\n", depth * shift, ""); - break; - case OF_DT_NOP: - printf("%*s[NOP]\n", depth * shift, ""); - break; - case OF_DT_END: - break; - case OF_DT_PROP: - printf("%*s%s", depth * shift, "", namep); - print_data(datap, *sizep); - printf(";\n"); - break; - default: - fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", - depth * shift, "", *tagp); - return; - } -} - -void ft_backtrack_node(struct ft_cxt *cxt) -{ - if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE) - return; /* XXX only for node */ - - cxt->p -= 4; -} - -/* note that the root node of the blob is "peeled" off */ -void ft_merge_blob(struct ft_cxt *cxt, void *blob) -{ - struct boot_param_header *bph = (struct boot_param_header *)blob; - u32 *p_struct = (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_struct)); - u32 *p_strings = - (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_strings)); - const u32 version = be32_to_cpu(bph->version); - u32 *p, *tagp, *sizep; - char *namep, *datap; - int depth; - - if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE) - return; /* XXX only for node */ - - cxt->p -= 4; - - depth = 0; - p = p_struct; - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - if (depth++ > 0) - ft_begin_node(cxt, namep); - break; - case OF_DT_END_NODE: - ft_end_node(cxt); - if (--depth == 0) - return; - break; - case OF_DT_PROP: - ft_prop(cxt, namep, datap, *sizep); - break; - } -} - -/**********************************************************************/ - -void *ft_find_node(const void *bphp, const char *srch_path) -{ - const struct boot_param_header *bph = bphp; - u32 *p_struct = (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_struct)); - u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings)); - u32 version = be32_to_cpu(bph->version); - u32 *p, *tagp, *sizep; - char *namep, *datap; - static char path[MAX_PATH_LEN]; - - path[0] = '\0'; - p = p_struct; - - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - strcat(path, namep); - if (!strcmp(path, srch_path)) - return tagp; - strcat(path, "/"); - break; - case OF_DT_END_NODE: - ft_parentize(path, 1); - break; - } - return NULL; -} - -int ft_get_prop(const void *bphp, const void *node, const char *propname, - void *buf, const unsigned int buflen) -{ - const struct boot_param_header *bph = bphp; - u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings)); - u32 version = be32_to_cpu(bph->version); - u32 *p, *tagp, *sizep, size; - char *namep, *datap; - int depth; - - depth = 0; - p = (u32 *)node; - - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - depth++; - break; - case OF_DT_PROP: - if ((depth == 1) && !strcmp(namep, propname)) { - size = min(be32_to_cpu(*sizep), (u32)buflen); - memcpy(buf, datap, size); - return size; - } - break; - case OF_DT_END_NODE: - if (--depth <= 0) - return -1; - break; - } - return -1; -} - -static void ft_modify_prop(void **bphpp, char *datap, u32 *old_prop_sizep, - const char *buf, const unsigned int buflen) -{ - u32 old_prop_data_len, new_prop_data_len; - - old_prop_data_len = _ALIGN(be32_to_cpu(*old_prop_sizep), 4); - new_prop_data_len = _ALIGN(buflen, 4); - - /* Check if new prop data fits in old prop data area */ - if (new_prop_data_len == old_prop_data_len) { - memcpy(datap, buf, buflen); - *old_prop_sizep = cpu_to_be32(buflen); - } else { - /* Need to alloc new area to put larger or smaller ft */ - struct boot_param_header *old_bph = *bphpp, *new_bph; - u32 *old_tailp, *new_tailp, *new_datap; - u32 old_total_size, new_total_size, head_len, tail_len, diff, v; - - old_total_size = be32_to_cpu(old_bph->totalsize); - head_len = (u32)(datap - (char *)old_bph); - tail_len = old_total_size - (head_len + old_prop_data_len); - old_tailp = (u32 *)(datap + old_prop_data_len); - new_total_size = head_len + new_prop_data_len + tail_len; - - if (!(new_bph = malloc(new_total_size))) { - printf("Can't alloc space for new ft\n"); - ft_exit(-ENOSPC); - } - - new_datap = (u32 *)((char *)new_bph + head_len); - new_tailp = (u32 *)((char *)new_datap + new_prop_data_len); - - memcpy(new_bph, *bphpp, head_len); - memcpy(new_datap, buf, buflen); - memcpy(new_tailp, old_tailp, tail_len); - - *(new_datap - 2) = cpu_to_be32(buflen); /* Set prop size */ - - new_bph->totalsize = cpu_to_be32(new_total_size); - diff = new_prop_data_len - old_prop_data_len; - - if (be32_to_cpu(old_bph->off_dt_strings) - > be32_to_cpu(old_bph->off_dt_struct)) { - v = be32_to_cpu(new_bph->off_dt_strings); - new_bph->off_dt_strings = cpu_to_be32(v + diff); - } - - if (be32_to_cpu(old_bph->off_mem_rsvmap) - > be32_to_cpu(old_bph->off_dt_struct)) { - v = be32_to_cpu(new_bph->off_mem_rsvmap); - new_bph->off_mem_rsvmap = cpu_to_be32(v + diff); - } - - ft_free(*bphpp, old_total_size); - *bphpp = new_bph; - } -} - -/* - * - Only modifies existing properties. - * - The dev tree passed in may be freed and a new one allocated - * (and *bphpp set to location of new dev tree). - */ -int ft_set_prop(void **bphpp, const void *node, const char *propname, - const void *buf, const unsigned int buflen) -{ - struct boot_param_header *bph = *bphpp; - u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings)); - u32 version = be32_to_cpu(bph->version); - u32 *p, *tagp, *sizep; - char *namep, *datap; - int depth; - - depth = 0; - p = (u32 *)node; - - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - depth++; - break; - case OF_DT_PROP: - if ((depth == 1) && !strcmp(namep, propname)) { - ft_modify_prop(bphpp, datap, sizep, buf, - buflen); - return be32_to_cpu(*sizep); - } - break; - case OF_DT_END_NODE: - if (--depth <= 0) - return -1; - break; - } - return -1; -} diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/flatdevtree.h --- a/tools/libxc/powerpc64/flatdevtree.h Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _FLATDEVTREE_H_ -#define _FLATDEVTREE_H_ - -#include "flatdevtree_env.h" - -/* Definitions used by the flattened device tree */ -#define OF_DT_HEADER 0xd00dfeed /* marker */ -#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ -#define OF_DT_END_NODE 0x2 /* End node */ -#define OF_DT_PROP 0x3 /* Property: name off, size, content */ -#define OF_DT_NOP 0x4 /* nop */ -#define OF_DT_END 0x9 - -#define OF_DT_VERSION 0x10 - -struct boot_param_header { - u32 magic; /* magic word OF_DT_HEADER */ - u32 totalsize; /* total size of DT block */ - u32 off_dt_struct; /* offset to structure */ - u32 off_dt_strings; /* offset to strings */ - u32 off_mem_rsvmap; /* offset to memory reserve map */ - u32 version; /* format version */ - u32 last_comp_version; /* last compatible version */ - /* version 2 fields below */ - u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ - /* version 3 fields below */ - u32 size_dt_strings; /* size of the DT strings block */ -}; - -struct ft_cxt { - struct boot_param_header *bph; - int max_size; /* maximum size of tree */ - int overflow; /* set when this happens */ - char *p, *pstr, *pres; /* running pointers */ - char *p_begin, *pstr_begin, *pres_begin; /* starting pointers */ - char *p_anchor; /* start of constructed area */ - int struct_size, strings_size, res_size; -}; - -void ft_begin_node(struct ft_cxt *cxt, const char *name); -void ft_end_node(struct ft_cxt *cxt); - -void ft_begin_tree(struct ft_cxt *cxt); -int ft_end_tree(struct ft_cxt *cxt); - -void ft_nop(struct ft_cxt *cxt); -void ft_prop(struct ft_cxt *cxt, const char *name, - const void *data, unsigned int sz); -void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str); -void ft_prop_int(struct ft_cxt *cxt, const char *name, unsigned int val); -void ft_begin(struct ft_cxt *cxt, void *blob, unsigned int max_size); -void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size); -int ft_set_rsvmap(void *bphp, int m, u64 physaddr, u64 size); - -void ft_dump_blob(const void *bphp); -void ft_backtrack_node(struct ft_cxt *cxt); -void ft_merge_blob(struct ft_cxt *cxt, void *blob); - -void *ft_find_node(const void *bphp, const char *srch_path); -int ft_get_prop(const void *bphp, const void *node, const char *propname, - void *buf, const unsigned int buflen); -int ft_set_prop(void **bphp, const void *node, const char *propname, - const void *buf, const unsigned int buflen); - -static inline char *ft_strrchr(const char *s, int c) -{ - const char *p = s + strlen(s); - - do { - if (*p == (char)c) - return (char *)p; - } while (--p >= s); - return NULL; -} - -/* 'path' is modified */ -static inline void ft_parentize(char *path, int leave_slash) -{ - char *s = &path[strlen(path) - 1]; - - if (*s == '/') - *s = '\0'; - s = ft_strrchr(path, '/'); - if (s != NULL) { - if (leave_slash) - s[1] = '\0'; - else if (s[0] == '/') - s[0] = '\0'; - } -} - -#endif /* FLATDEVTREE_H */ diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/flatdevtree_env.h --- a/tools/libxc/powerpc64/flatdevtree_env.h Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _FLATDEVTREE_ENV_H_ -#define _FLATDEVTREE_ENV_H_ - -#include -#include -#include -#include -#include -#include - -#define MAX_PATH_LEN 1024 - -#define _ALIGN(addr,size) (((addr)+(size)-1)&(~((size)-1))) - -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -static inline u16 swab16(u16 x) -{ - return (((u16)(x) & (u16)0x00ffU) << 8) | - (((u16)(x) & (u16)0xff00U) >> 8); -} - -static inline u32 swab32(u32 x) -{ - return (((u32)(x) & (u32)0x000000ffUL) << 24) | - (((u32)(x) & (u32)0x0000ff00UL) << 8) | - (((u32)(x) & (u32)0x00ff0000UL) >> 8) | - (((u32)(x) & (u32)0xff000000UL) >> 24); -} - -static inline u64 swab64(u64 x) -{ - return (u64)(((u64)(x) & (u64)0x00000000000000ffULL) << 56) | - (u64)(((u64)(x) & (u64)0x000000000000ff00ULL) << 40) | - (u64)(((u64)(x) & (u64)0x0000000000ff0000ULL) << 24) | - (u64)(((u64)(x) & (u64)0x00000000ff000000ULL) << 8) | - (u64)(((u64)(x) & (u64)0x000000ff00000000ULL) >> 8) | - (u64)(((u64)(x) & (u64)0x0000ff0000000000ULL) >> 24) | - (u64)(((u64)(x) & (u64)0x00ff000000000000ULL) >> 40) | - (u64)(((u64)(x) & (u64)0xff00000000000000ULL) >> 56); -} - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define cpu_to_be16(x) swab16(x) -#define be16_to_cpu(x) swab16(x) -#define cpu_to_be32(x) swab32(x) -#define be32_to_cpu(x) swab32(x) -#define cpu_to_be64(x) swab64(x) -#define be64_to_cpu(x) swab64(x) -#else -#define cpu_to_be16(x) (x) -#define be16_to_cpu(x) (x) -#define cpu_to_be32(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_be64(x) (x) -#define be64_to_cpu(x) (x) -#endif - -static inline void ft_exit(int code) -{ - exit(code); -} - -static inline void ft_free(void *ptr, int len) -{ - free(ptr); -} - -static inline u32 min(u32 a, u32 b) -{ - if (a < b) - return a; - return b; -} - -#endif /* _FLATDEVTREE_ENV_H_ */ diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/mk_flatdevtree.c --- a/tools/libxc/powerpc64/mk_flatdevtree.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,648 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright IBM Corporation 2007 - * - * Authors: Ryan Harper - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include /* for PERROR() */ -#include - -#include "mk_flatdevtree.h" - -static uint32_t current_phandle = 0; - -static uint32_t get_phandle(void) -{ - return current_phandle++; -} - -static int readfile(const char *fullpath, void *data, int len) -{ - struct stat st; - int saved_errno; - int rc = -1; - int fd; - - if ((fd = open(fullpath, O_RDONLY)) == -1) { - PERROR("%s: failed to open file %s", __func__, fullpath); - return -1; - } - - if ((rc = fstat(fd, &st)) == -1) { - PERROR("%s: failed to stat fd %d", __func__, fd); - goto error; - } - - if (S_ISREG(st.st_mode)) - rc = read(fd, data, len); - - close(fd); - return rc; - -error: - saved_errno = errno; - close(fd); - errno = saved_errno; - return -1; -} - -/* - * @property - string to check against the filter list - * @filter - NULL terminated list of strings - * - * compare @property string to each string in @filter - * - * return 1 if @property matches any filter, otherwise 0 - * - */ -static int match(const char *property, const char **filter) -{ - int i; - - for (i=0; filter[i] != NULL; i++) { - /* compare the filter to property */ - if (strncmp(property, filter[i], strlen(filter[i])) == 0) - return 1; - } - - return 0; -} - -/* - * copy the node at @dirpath filtering out any properties that match in @propfilter - */ -static int copynode(struct ft_cxt *cxt, const char *dirpath, const char **propfilter) -{ - struct dirent *tree; - struct stat st; - DIR *dir; - char fullpath[MAX_PATH]; - char *bname = NULL; - char *basec = NULL; - int saved_errno; - - if ((dir = opendir(dirpath)) == NULL) { - PERROR("%s: failed to open dir %s", __func__, dirpath); - return -1; - } - - while (1) { - if ((tree = readdir(dir)) == NULL) - break; /* reached end of directory entries */ - - /* ignore . and .. */ - if (strcmp(tree->d_name,"." ) == 0 || strcmp(tree->d_name,"..") == 0) - continue; - - /* build full path name of the file, for stat() */ - if (snprintf(fullpath, sizeof(fullpath), "%s/%s", dirpath, - tree->d_name) >= sizeof(fullpath)) { - PERROR("%s: failed to build full path", __func__); - goto error; - } - - /* stat the entry */ - if (stat(fullpath, &st) < 0) { - PERROR("%s: failed to stat file %s", __func__, fullpath); - goto error; - } - - if (S_ISDIR(st.st_mode)) { - /* start a new node for a dir */ - ft_begin_node(cxt, tree->d_name); - - /* copy everything in this dir */ - if (copynode(cxt, fullpath, propfilter) < 0) { - PERROR("%s: failed to copy node @ %s", __func__, fullpath); - goto error; - } - - /* end the node */ - ft_end_node(cxt); - } - /* add files in dir as properties */ - else if (S_ISREG(st.st_mode)) { - - if ((basec = strdup(fullpath)) == NULL) { - PERROR("%s: failed to dupe string", __func__); - goto error; - } - - if ((bname = basename(basec)) == NULL) { - PERROR("%s: basename() failed", __func__); - goto error; - } - - /* only add files that don't match the property filter string */ - if (!match(bname, propfilter)) { - char data[BUFSIZE]; - int len; - - /* snarf the data and push into the property */ - if ((len = readfile(fullpath, data, sizeof(data))) < 0) { - PERROR("%s: failed to read data from file %s", __func__, - fullpath); - goto error; - } - ft_prop(cxt, tree->d_name, data, len); - - } - - /* strdup mallocs memory */ - if (basec != NULL ) { - free(basec); - basec = NULL; - } - - } - } - - closedir(dir); - return 0; - -error: - saved_errno = errno; - - /* strdup mallocs memory */ - if (basec != NULL ) { - free(basec); - basec = NULL; - } - - closedir(dir); - - errno = saved_errno; - return -1; -} - -static int find_cpu0(char *cpupath, int len) -{ - const char path[] = "/proc/device-tree/cpus"; - const char device[] = "device_type"; - const char dev_cpu[] = "cpu"; - const char reg[] = "reg"; - char data[sizeof(dev_cpu)]; - char prop[MAX_PATH]; - char node[MAX_PATH]; - struct dirent *tree; - struct stat st; - DIR* dir; - int saved_errno; - int found = 0; - - if ((dir = opendir(path)) == NULL) { - PERROR("%s: failed to open directory %s", __func__, path); - return -1; - } - - while (!found) { - - if ((tree = readdir(dir)) == NULL) - break; /* reached end of directory entries */ - - /* ignore ., .. */ - if (strcmp(tree->d_name,"." ) == 0 || strcmp(tree->d_name,"..") == 0) - continue; - - /* build full path name of the file, for stat() */ - if (snprintf(node, sizeof(node), "%s/%s", path, - tree->d_name) >= sizeof(node)) { - PERROR("%s: failed to concat strings", __func__); - goto error; - } - - /* stat the entry */ - if (stat(node, &st) < 0) { - PERROR("%s: failed to stat file %s", __func__, node); - /* something funny happen in /proc/device-tree, but march onward */ - continue; - } - - /* for each dir, check the device_type property until we find 'cpu'*/ - if (S_ISDIR(st.st_mode)) { - - /* construct path to device_type */ - if (snprintf(prop, sizeof(prop), "%s/%s", node, - device) >= sizeof(prop)) { - PERROR("%s: failed to concat strings", __func__); - goto error; - } - - /* read device_type into buffer */ - if ((readfile(prop, data, sizeof(data))) < 0) { - PERROR("%s: failed to read data from file %s", __func__, prop); - goto error; - } - - /* if the device_type is 'cpu', and reg is 0 - * return the path where we found it */ - if (strcmp(data, "cpu") == 0) { - - /* construct path to reg */ - if (snprintf(prop, sizeof(prop), "%s/%s", node, - reg) >= sizeof(prop)) { - PERROR("%s: failed to concat strings", __func__); - goto error; - } - - /* using data buffer since reg and device_type values have same size */ - if ((readfile(prop, data, sizeof(data))) < 0) { - PERROR("%s: failed to read data from file %s", __func__, prop); - goto error; - } - - /* now check property "reg" for value 0 */ - if ((u32)*data == 0) { - if (snprintf(cpupath, len, "%s", node) >= len) { - PERROR("%s: failed to copy cpupath", __func__); - goto error; - } - found = 1; - } - } - } - } - - closedir(dir); - return found; - -error: - saved_errno = errno; - closedir(dir); - errno = saved_errno; - return -1; -} - -void free_devtree(struct ft_cxt *root) -{ - if ((root != NULL) && root->bph != NULL) { - free(root->bph); - root->bph = NULL; - } -} - -int make_devtree(struct ft_cxt *root, - struct xc_dom_image *dom, - unsigned long shadow_mb) -{ - struct boot_param_header *bph = NULL; - uint64_t val[2]; - uint32_t val32[2]; - uint64_t shared_info_paddr = dom->shared_info_pfn << PAGE_SHIFT; - uint64_t xenstore_paddr = dom->xenstore_pfn << PAGE_SHIFT; - uint64_t console_paddr = dom->console_pfn << PAGE_SHIFT; - long remaining; - unsigned long ramdisk_start; - unsigned long ramdisk_size; - unsigned long rma_bytes = 1 << dom->realmodearea_log; - int64_t shadow_mb_log; - uint64_t pft_size; - char cpupath[MAX_PATH]; - const char *propfilter[] = { "ibm", "linux,", NULL }; - char *cpupath_copy = NULL; - char *cpuname = NULL; - int saved_errno; - int dtb_fd = -1; - uint32_t cpu0_phandle = get_phandle(); - uint32_t xen_phandle = get_phandle(); - uint32_t rma_phandle = get_phandle(); - - /* initialize bph to prevent double free on error path */ - root->bph = NULL; - - /* carve out space for bph */ - if ((bph = (struct boot_param_header *)malloc(BPH_SIZE)) == NULL) { - PERROR("%s: Failed to malloc bph buffer size", __func__); - goto error; - } - - /* NB: struct ft_cxt root defined at top of file */ - /* root = Tree() */ - ft_begin(root, bph, BPH_SIZE); - - /* you MUST set reservations BEFORE _starting_the_tree_ */ - - /* reserve shared_info_t page */ - if (shared_info_paddr) { - val[0] = cpu_to_be64((u64) shared_info_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_add_rsvmap(root, val[0], val[1]); - } - - /* reserve console page for domU */ - if (console_paddr) { - val[0] = cpu_to_be64((u64) console_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_add_rsvmap(root, val[0], val[1]); - } - - /* reserve xen store page for domU */ - if (xenstore_paddr) { - val[0] = cpu_to_be64((u64) xenstore_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_add_rsvmap(root, val[0], val[1]); - } - - /* reserve space for initrd if needed */ - ramdisk_start = dom->ramdisk_seg.pfn << PAGE_SHIFT; - ramdisk_size = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart; - if (ramdisk_size > 0) { - val[0] = cpu_to_be64((u64) ramdisk_start); - val[1] = cpu_to_be64((u64) ramdisk_size); - ft_add_rsvmap(root, val[0], val[1]); - } - - /* NB: ft_add_rsvmap() already terminates with a NULL reservation for us */ - - /* done with reservations, _starting_the_tree_ */ - ft_begin_tree(root); - - /* make root node */ - ft_begin_node(root, ""); - - /* root.addprop('device_type', 'chrp-but-not-really\0') */ - ft_prop_str(root, "device_type", "chrp-but-not-really"); - - /* root.addprop('#size-cells', 2) */ - ft_prop_int(root, "#size-cells", 2); - - /* root.addprop('#address-cells', 2) */ - ft_prop_int(root, "#address-cells", 2); - - /* root.addprop('model', 'Momentum,Maple-D\0') */ - ft_prop_str(root, "model", "Momentum,Maple-D"); - - /* root.addprop('compatible', 'Momentum,Maple\0') */ - ft_prop_str(root, "compatible", "Momentum,Maple"); - - /* start chosen node */ - ft_begin_node(root, "chosen"); - - /* chosen.addprop('cpu', cpu0.get_phandle()) */ - ft_prop_int(root, "cpu", cpu0_phandle); - - /* chosen.addprop('rma', rma.get_phandle()) */ - ft_prop_int(root, "memory", rma_phandle); - - /* chosen.addprop('linux,stdout-path', '/xen/console\0') */ - ft_prop_str(root, "linux,stdout-path", "/xen/console"); - - /* chosen.addprop('interrupt-controller, xen.get_phandle()) */ - ft_prop_int(root, "interrupt-controller", xen_phandle); - - /* chosen.addprop('bootargs', imghandler.cmdline + '\0') */ - if (dom->cmdline != NULL) - ft_prop_str(root, "bootargs", dom->cmdline); - - /* mark where the initrd is, if present */ - if (ramdisk_size > 0) { - val[0] = cpu_to_be64((u64) ramdisk_start); - val[1] = cpu_to_be64((u64) ramdisk_start + ramdisk_size); - ft_prop(root, "linux,initrd-start", &(val[0]), sizeof(val[0])); - ft_prop(root, "linux,initrd-end", &(val[1]), sizeof(val[1])); - } - - /* end chosen node */ - ft_end_node(root); - - /* xen = root.addnode('xen') */ - ft_begin_node(root, "xen"); - - /* xen.addprop('version', 'Xen-3.0-unstable\0') */ - ft_prop_str(root, "compatible", "Xen-3.0-unstable"); - - /* xen.addprop('reg', long(imghandler.vm.domid), long(0)) */ - val[0] = cpu_to_be64((u64) dom->guest_domid); - val[1] = cpu_to_be64((u64) 0); - ft_prop(root, "reg", val, sizeof(val)); - - /* point to shared_info_t page base addr */ - val[0] = cpu_to_be64((u64) shared_info_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_prop(root, "shared-info", val, sizeof(val)); - - /* xen.addprop('domain-name', imghandler.vm.getName() + '\0') */ - /* libxc doesn't know the domain name, that is purely a xend thing */ - /* ft_prop_str(root, "domain-name", domain_name); */ - - /* add xen/linux,phandle for chosen/interrupt-controller */ - ft_prop_int(root, "linux,phandle", xen_phandle); - - if (console_paddr != 0) { - /* xencons = xen.addnode('console') */ - ft_begin_node(root, "console"); - - /* console_paddr */ - val[0] = cpu_to_be64((u64) console_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_prop(root, "reg", val, sizeof(val)); - - /* xencons.addprop('interrupts', console_evtchn, 0) */ - val32[0] = cpu_to_be32((u32) dom->console_evtchn); - val32[1] = cpu_to_be32((u32) 0); - ft_prop(root, "interrupts", val32, sizeof(val32)); - - /* end of console */ - ft_end_node(root); - } - - if (xenstore_paddr != 0) { - /* start store node */ - ft_begin_node(root, "store"); - - /* store paddr */ - val[0] = cpu_to_be64((u64) xenstore_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_prop(root, "reg", val, sizeof(val)); - - /* store event channel */ - val32[0] = cpu_to_be32((u32) dom->xenstore_evtchn); - val32[1] = cpu_to_be32((u32) 0); - ft_prop(root, "interrupts", val32, sizeof(val32)); - - /* end of store */ - ft_end_node(root); - } - - /* end of xen node */ - ft_end_node(root); - - /* rma = root.addnode('memory@0') */ - ft_begin_node(root, "memory@0"); - - /* rma.addprop('reg', long(0), long(rma_bytes)) */ - val[0] = cpu_to_be64((u64) 0); - val[1] = cpu_to_be64((u64) rma_bytes); - ft_prop(root, "reg", val, sizeof(val)); - - /* rma.addprop('device_type', 'memory\0') */ - ft_prop_str(root, "device_type", "memory"); - - /* add linux,phandle for chosen/rma node */ - ft_prop_int(root, "linux,phandle", rma_phandle); - - /* end of memory@0 */ - ft_end_node(root); - - /* calculate remaining bytes from total - rma size */ - remaining = (dom->total_pages << PAGE_SHIFT) - rma_bytes; - - /* memory@ is all remaining memory after RMA */ - if (remaining > 0) - { - char mem[MAX_PATH]; - - if (snprintf(mem, sizeof(mem), "memory@%lx", - rma_bytes) >= sizeof(mem)) { - PERROR("%s: failed to build memory string", __func__); - goto error; - } - - /* memory@ is all remaining memory after RMA */ - ft_begin_node(root, mem); - - /* mem.addprop('reg', long(rma_bytes), long(remaining)) */ - val[0] = cpu_to_be64((u64) rma_bytes); - val[1] = cpu_to_be64((u64) remaining); - ft_prop(root, "reg", val, sizeof(val)); - - /* mem.addprop('device_type', 'memory\0') */ - ft_prop_str(root, "device_type", "memory"); - - /* end memory@ node */ - ft_end_node(root); - } - - /* add CPU nodes */ - /* cpus = root.addnode('cpus') */ - ft_begin_node(root, "cpus"); - - /* cpus.addprop('smp-enabled') */ - ft_prop(root, "smp-enabled", NULL, 0); - - /* cpus.addprop('#size-cells', 0) */ - ft_prop_int(root, "#size-cells", 0); - - /* cpus.addprop('#address-cells', 1) */ - ft_prop_int(root, "#address-cells", 1); - - /* - * Copy all properties the system firmware gave us from a - * CPU node in the device tree. - */ - if (find_cpu0(cpupath, sizeof(cpupath)) <= 0) { - PERROR("%s: failed find cpu0 node in host devtree", __func__); - goto error; - } - - /* get the basename from path to cpu device */ - if ((cpupath_copy = strdup(cpupath)) == NULL) { - PERROR("%s: failed to dupe string", __func__); - goto error; - } - if ((cpuname = basename(cpupath_copy)) == NULL) { - PERROR("%s: basename() failed", __func__); - goto error; - } - - /* start node for the cpu */ - ft_begin_node(root, cpuname); - - /* strdup() mallocs memory */ - if ( cpupath_copy != NULL ) { - free(cpupath_copy); - cpupath_copy = NULL; - } - - /* copy over most properties from host tree for cpu */ - if (copynode(root, cpupath, propfilter) < 0) { - PERROR("%s: failed to copy node", __func__); - goto error; - } - - /* calculate the pft-size */ - shadow_mb_log = (int)log2((double)shadow_mb); - pft_size = shadow_mb_log + 20; - - val32[0] = cpu_to_be32((u32) 0); - val32[1] = cpu_to_be32((u32) pft_size); - ft_prop(root, "ibm,pft-size", val32, sizeof(val32)); - - /* make phandle for cpu0 */ - ft_prop_int(root, "linux,phandle", cpu0_phandle); - - /* end node */ - ft_end_node(root); - - /* end cpus node */ - ft_end_node(root); - - /* end root node */ - ft_end_node(root); - - /* end of the tree */ - if (ft_end_tree(root) != 0) { - PERROR("%s: failed to end tree", __func__); - goto error; - } - - /* write a copy of the tree to a file */ - if ((dtb_fd = creat(DTB_FILE, S_IRUSR | S_IWUSR)) == -1) { - PERROR("%s: failed to open file %s", __func__, DTB_FILE); - goto error; - } - - if (write(dtb_fd, (const void *)bph, bph->totalsize) != bph->totalsize) { - PERROR("%s: failed to write blob to file", __func__); - goto error; - } - - return 0; - -error: - saved_errno = errno; - - /* strdup() mallocs memory */ - if ( cpupath_copy != NULL ) { - free(cpupath_copy); - cpupath_copy = NULL; - } - - /* free bph buffer */ - free_devtree(root); - - if (dtb_fd) - close(dtb_fd); - - errno = saved_errno; - return -1; -} diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/mk_flatdevtree.h --- a/tools/libxc/powerpc64/mk_flatdevtree.h Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright IBM Corporation 2007 - * - * Authors: Ryan Harper - */ - -#ifndef MK_FLATDEVTREE_H -#define MK_FLATDEVTREE_H - -#include "flatdevtree_env.h" -#include "flatdevtree.h" - -extern void free_devtree(struct ft_cxt *root); -extern int make_devtree(struct ft_cxt *root, - struct xc_dom_image *dom, - unsigned long shadow_mb); - -#define MAX_PATH 200 -#define BUFSIZE 1024 -#define BPH_SIZE 16*1024 -#define DTB_FILE "/tmp/domU.dtb" - -#endif /* MK_FLATDEVTREE_H */ diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/powerpc64/xc_memory.c --- a/tools/libxc/powerpc64/xc_memory.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright (C) IBM Corporation 2006 - * - * Authors: Hollis Blanchard - */ - -#include "xc_private.h" -#include - -int xc_alloc_real_mode_area(int xc_handle, - uint32_t domain, - unsigned int log) -{ - DECLARE_DOMCTL; - int err; - - domctl.cmd = XEN_DOMCTL_real_mode_area; - domctl.domain = (domid_t)domain; - domctl.u.real_mode_area.log = log; - - err = do_domctl(xc_handle, &domctl); - - if (err) - DPRINTF("Failed real mode area allocation for dom %u (log %u)\n", - domain, log); - - return err; -} diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_core.h --- a/tools/libxc/xc_core.h Thu May 08 13:15:45 2008 +0100 +++ b/tools/libxc/xc_core.h Thu May 08 13:40:40 2008 +0100 @@ -148,8 +148,6 @@ int xc_core_arch_map_p2m(int xc_handle, # include "xc_core_x86.h" #elif defined (__ia64__) # include "xc_core_ia64.h" -#elif defined (__powerpc__) -# include "xc_core_powerpc.h" #else # error "unsupported architecture" #endif diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_core_powerpc.c --- a/tools/libxc/xc_core_powerpc.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (c) 2007 Isaku Yamahata - * VA Linux Systems Japan K.K. - * Copyright IBM Corp. 2007 - * - * Authors: Isaku Yamahata - * Hollis Blanchard - * - */ - -#include "xg_private.h" -#include "xc_core.h" - -int -xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info) -{ - /* All PowerPC domU are autotranslated. */ - return 1; -} - -int -xc_core_arch_map_p2m(int xc_handle, xc_dominfo_t *info, - shared_info_t *live_shinfo, xen_pfn_t **live_p2m, - unsigned long *pfnp) -{ - /* All PowerPC domU are autotranslated. */ - errno = ENOSYS; - return -1; -} - -int -xc_core_arch_memory_map_get(int xc_handle, struct xc_core_arch_context *unused, - xc_dominfo_t *info, shared_info_t *live_shinfo, - xc_core_memory_map_t **mapp, - unsigned int *nr_entries) -{ - xc_core_memory_map_t *map = NULL; - - map = malloc(sizeof(*map)); - if (!map) { - PERROR("Could not allocate memory"); - goto out; - } - - map->addr = 0; - map->size = info->max_memkb * 1024; - - *mapp = map; - *nr_entries = 1; - return 0; - -out: - free(map); - return -1; -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_core_powerpc.h --- a/tools/libxc/xc_core_powerpc.h Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (c) 2007 Isaku Yamahata - * VA Linux Systems Japan K.K. - * - */ - -#ifndef XC_CORE_POWERPC_H -#define XC_CORE_POWERPC_H - -#define ELF_ARCH_DATA ELFDATA2MSB -#define ELF_ARCH_MACHINE EM_PPC64 - -struct xc_core_arch_context { - /* nothing */ -}; - -#define xc_core_arch_context_init(arch_ctxt) do {} while (0) -#define xc_core_arch_context_free(arch_ctxt) do {} while (0) -#define xc_core_arch_context_get(arch_ctxt, ctxt, xc_handle, domid) \ - (0) -#define xc_core_arch_context_dump(arch_ctxt, args, dump_rtn) (0) -#define xc_core_arch_gpfn_may_present(arch_ctxt, i) (1) - -static inline int -xc_core_arch_context_get_shdr(struct xc_core_arch_context *arch_ctxt, - struct xc_core_section_headers *sheaders, - struct xc_core_strtab *strtab, - uint64_t *filesz, uint64_t offset) -{ - *filesz = 0; - return 0; -} - -#endif /* XC_CORE_POWERPC_H */ - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_dom_elfloader.c --- a/tools/libxc/xc_dom_elfloader.c Thu May 08 13:15:45 2008 +0100 +++ b/tools/libxc/xc_dom_elfloader.c Thu May 08 13:40:40 2008 +0100 @@ -43,8 +43,6 @@ static char *xc_dom_guest_type(struct xc return "xen-3.0-x86_64"; case EM_IA_64: return elf_msb(elf) ? "xen-3.0-ia64be" : "xen-3.0-ia64"; - case EM_PPC64: - return "xen-3.0-powerpc64"; default: return "xen-3.0-unknown"; } diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xc_dom_powerpc.c --- a/tools/libxc/xc_dom_powerpc.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -/* - * Xen domain builder -- powerpc bits. - * - * Most architecture-specific code for powerpc goes here. - * - * This code is licenced under the GPL. - * written 2006 by Gerd Hoffmann . - * - * Copyright IBM Corp. 2007 - * - * Authors: Gerd Hoffmann - * Hollis Blanchard - * - */ -#include -#include -#include -#include - -#include - -#include "xg_private.h" -#include "xc_dom.h" -#include "powerpc64/flatdevtree.h" -#include "powerpc64/mk_flatdevtree.h" - -#define RMA_LOG 26 /* 64 MB */ -#define EXTENT_LOG 24 /* 16 MB */ -#define EXTENT_ORDER (EXTENT_LOG - PAGE_SHIFT) - -/* ------------------------------------------------------------------------ */ - -static int alloc_magic_pages(struct xc_dom_image *dom) -{ - struct ft_cxt devtree; - void *guest_devtree; - unsigned long shadow_mb; - int rma_pages; - int rc; - - /* Allocate special pages from the end of the RMA. */ - rma_pages = 1 << (dom->realmodearea_log - PAGE_SHIFT); - dom->shared_info_pfn = --rma_pages; - dom->console_pfn = --rma_pages; - dom->xenstore_pfn = --rma_pages; - - /* Gather shadow allocation info for the device tree. */ - rc = xc_shadow_control(dom->guest_xc, dom->guest_domid, - XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION, NULL, 0, - &shadow_mb, 0, NULL); - if (rc < 0 || shadow_mb == 0) { - xc_dom_printf("Couldn't get shadow allocation size or it was 0.\n"); - return rc; - } - - /* Build device tree. */ - rc = make_devtree(&devtree, dom, shadow_mb); - if (rc < 0) { - xc_dom_printf("Failed to create flattened device tree.\n"); - return rc; - } - - /* Find a spot for it. */ - rc = xc_dom_alloc_segment(dom, &dom->devicetree_seg, "devtree", 0, - devtree.bph->totalsize); - if (rc) - goto out; - - /* Copy the device tree into place. */ - guest_devtree = xc_dom_seg_to_ptr(dom, &dom->devicetree_seg); - if (!guest_devtree) { - xc_dom_printf("Couldn't map guest memory for device tree.\n"); - rc = -1; - goto out; - } - memcpy(guest_devtree, devtree.bph, devtree.bph->totalsize); - -out: - free_devtree(&devtree); - return rc; -} - -static int shared_info(struct xc_dom_image *dom, void *ptr) -{ - shared_info_t *shared_info = ptr; - - xc_dom_printf("%s: called\n", __FUNCTION__); - - memset(shared_info, 0, sizeof(*shared_info)); - return 0; -} - -static int vcpu(struct xc_dom_image *dom, void *ptr) -{ - vcpu_guest_context_t *ctxt = ptr; - - memset(ctxt, 0x55, sizeof(*ctxt)); - ctxt->user_regs.pc = dom->parms.virt_entry; - ctxt->user_regs.msr = 0; - ctxt->user_regs.gprs[1] = 0; /* Linux uses its own stack */ - ctxt->user_regs.gprs[3] = dom->devicetree_seg.pfn << PAGE_SHIFT; - ctxt->user_regs.gprs[4] = dom->kernel_seg.pfn << PAGE_SHIFT; - ctxt->user_regs.gprs[5] = 0; - - /* There is a buggy kernel that does not zero the "local_paca", so - * we must make sure this register is 0 */ - ctxt->user_regs.gprs[13] = 0; - - xc_dom_printf("%s: initial vcpu:\n", __FUNCTION__); - xc_dom_printf(" pc 0x%016"PRIx64", msr 0x%016"PRIx64"\n" - " r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64" %016"PRIx64 - " %016"PRIx64"\n", - ctxt->user_regs.pc, ctxt->user_regs.msr, - ctxt->user_regs.gprs[1], - ctxt->user_regs.gprs[2], - ctxt->user_regs.gprs[3], - ctxt->user_regs.gprs[4], - ctxt->user_regs.gprs[5]); - - return 0; -} - -/* ------------------------------------------------------------------------ */ - -static struct xc_dom_arch xc_dom_arch = { - .guest_type = "xen-3.0-powerpc64", - .page_shift = PAGE_SHIFT, - .alloc_magic_pages = alloc_magic_pages, - .shared_info = shared_info, - .vcpu = vcpu, -}; - -static void __init register_arch_hooks(void) -{ - xc_dom_register_arch_hooks(&xc_dom_arch); -} - -int arch_setup_meminit(struct xc_dom_image *dom) -{ - xen_pfn_t *extent_list; - unsigned long total_mem = dom->total_pages << PAGE_SHIFT; - unsigned long rma_bytes; - unsigned long rma_nr_pages; - unsigned long nr_extents; - int rc = 0; - int i; - - /* XXX RMA size is processor-dependent. */ - dom->realmodearea_log = RMA_LOG; - rma_bytes = 1 << dom->realmodearea_log; - rma_nr_pages = rma_bytes >> PAGE_SHIFT; - - xc_dom_printf("dom%u memory: %lu MB RMA, %lu MB additional.\n", - dom->guest_domid, rma_bytes >> 20, (total_mem - rma_bytes) >> 20); - - if (total_mem < rma_bytes) { - xc_dom_printf("Domain must have at least %lu MB\n", rma_bytes >> 20); - return -EINVAL; - } - - /* Allocate the first chunk of memory. */ - rc = xc_alloc_real_mode_area(dom->guest_xc, dom->guest_domid, - dom->realmodearea_log); - if (rc) { - xc_dom_printf("Failed to allocate real mode area.\n"); - return rc; - } - - /* Allocate p2m map. */ - dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages); - if (dom->p2m_host == NULL) { - xc_dom_printf("Couldn't allocate p2m map.\n"); - return -ENOMEM; - } - - nr_extents = (dom->total_pages - rma_nr_pages) >> EXTENT_ORDER; - if (nr_extents) { - /* Allocate extent list for populate_physmap() call. */ - extent_list = xc_dom_malloc(dom, sizeof(xen_pfn_t) * nr_extents); - if (extent_list == NULL) { - xc_dom_printf("Couldn't allocate extent list.\n"); - return -ENOMEM; - } - - /* Allocate the remaining (non-RMA) memory. */ - for (i = 0; i < nr_extents; i++) { - /* Use PFNs above the RMA memory we already allocated. */ - extent_list[i] = rma_nr_pages + i * (1<guest_xc, dom->guest_domid, - nr_extents, EXTENT_ORDER, 0, - extent_list); - if (rc < 0) { - xc_dom_printf("populate_physmap(0x%lx extents order %u) -> 0x%x\n", - nr_extents, EXTENT_ORDER, rc); - return rc; - } - } - - /* Populate the p2m map. */ - rc = xc_get_pfn_list(dom->guest_xc, dom->guest_domid, dom->p2m_host, - dom->total_pages); - if (rc < 0) { - xc_dom_printf("Couldn't get p2m translation.\n"); - return rc; - } - - xc_dom_printf("%s: success\n", __func__); - - return 0; -} - -int arch_setup_bootearly(struct xc_dom_image *dom) -{ - xc_dom_printf("%s: doing nothing\n", __FUNCTION__); - return 0; -} - -int arch_setup_bootlate(struct xc_dom_image *dom) -{ - unsigned int page_size = XC_DOM_PAGE_SIZE(dom); - shared_info_t *shared_info; - - /* setup shared_info page */ - xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n", - __FUNCTION__, dom->shared_info_mfn); - shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid, - page_size, - PROT_READ | PROT_WRITE, - dom->shared_info_mfn); - if ( shared_info == NULL ) - return -1; - dom->arch_hooks->shared_info(dom, shared_info); - munmap(shared_info, page_size); - return 0; -} diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Thu May 08 13:15:45 2008 +0100 +++ b/tools/libxc/xenctrl.h Thu May 08 13:40:40 2008 +0100 @@ -55,10 +55,6 @@ #define xen_mb() asm volatile ("mf" ::: "memory") #define xen_rmb() asm volatile ("mf" ::: "memory") #define xen_wmb() asm volatile ("mf" ::: "memory") -#elif defined(__powerpc__) -#define xen_mb() asm volatile ("sync" : : : "memory") -#define xen_rmb() asm volatile ("sync" : : : "memory") /* lwsync? */ -#define xen_wmb() asm volatile ("sync" : : : "memory") /* eieio? */ #else #error "Define barriers" #endif @@ -944,11 +940,6 @@ int xc_set_hvm_param(int handle, domid_t int xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value); int xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long *value); -/* PowerPC specific. */ -int xc_alloc_real_mode_area(int xc_handle, - uint32_t domid, - unsigned int log); - /* IA64 specific, nvram save */ int xc_ia64_save_to_nvram(int xc_handle, uint32_t dom); diff -r 0ac957f9d42e -r b0d7780794eb tools/libxc/xenguest.h --- a/tools/libxc/xenguest.h Thu May 08 13:15:45 2008 +0100 +++ b/tools/libxc/xenguest.h Thu May 08 13:40:40 2008 +0100 @@ -136,18 +136,4 @@ int xc_hvm_build_mem(int xc_handle, const char *image_buffer, unsigned long image_size); -/* PowerPC specific. */ -int xc_prose_build(int xc_handle, - uint32_t domid, - unsigned int mem_mb, - const char *image_name, - const char *ramdisk_name, - const char *cmdline, - const char *features, - unsigned long flags, - unsigned int store_evtchn, - unsigned long *store_mfn, - unsigned int console_evtchn, - unsigned long *console_mfn); - #endif /* XENGUEST_H */ diff -r 0ac957f9d42e -r b0d7780794eb tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Thu May 08 13:15:45 2008 +0100 +++ b/tools/python/xen/lowlevel/xc/xc.c Thu May 08 13:40:40 2008 +0100 @@ -1350,28 +1350,6 @@ static PyObject *dom_op(XcObject *self, return zero; } -#ifdef __powerpc__ -static PyObject *pyxc_alloc_real_mode_area(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t dom; - unsigned int log; - - static char *kwd_list[] = { "dom", "log", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, - &dom, &log) ) - return NULL; - - if ( xc_alloc_real_mode_area(self->xc_handle, dom, log) ) - return pyxc_error_to_exception(); - - Py_INCREF(zero); - return zero; -} -#endif /* powerpc */ - static PyMethodDef pyxc_methods[] = { { "handle", (PyCFunction)pyxc_handle, @@ -1759,16 +1737,6 @@ static PyMethodDef pyxc_methods[] = { "Inject debug keys into Xen.\n" " keys [str]: String of keys to inject.\n" }, -#ifdef __powerpc__ - { "arch_alloc_real_mode_area", - (PyCFunction)pyxc_alloc_real_mode_area, - METH_VARARGS | METH_KEYWORDS, "\n" - "Allocate a domain's real mode area.\n" - " dom [int]: Identifier of domain.\n" - " log [int]: Specifies the area's size.\n" - "Returns: [int] 0 on success; -1 on error.\n" }, -#endif /* __powerpc */ - #if defined(__i386__) || defined(__x86_64__) { "domain_check_cpuid", (PyCFunction)pyxc_dom_check_cpuid, diff -r 0ac957f9d42e -r b0d7780794eb tools/python/xen/xend/arch.py --- a/tools/python/xen/xend/arch.py Thu May 08 13:15:45 2008 +0100 +++ b/tools/python/xen/xend/arch.py Thu May 08 13:40:40 2008 +0100 @@ -28,7 +28,5 @@ _types = { "amd64": "x86", "i86pc": "x86", "ia64": "ia64", - "ppc": "powerpc", - "ppc64": "powerpc", } type = _types.get(os.uname()[4], "unknown") diff -r 0ac957f9d42e -r b0d7780794eb tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Thu May 08 13:15:45 2008 +0100 +++ b/tools/python/xen/xend/image.py Thu May 08 13:40:40 2008 +0100 @@ -506,20 +506,6 @@ class LinuxImageHandler(ImageHandler): return args -class PPC_LinuxImageHandler(LinuxImageHandler): - - ostype = "linux" - - def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb): - """@param shadow_mem_kb The configured shadow memory, in KiB. - @param maxmem_kb The configured maxmem, in KiB. - @return The corresponding required amount of shadow memory, also in - KiB. - PowerPC currently uses "shadow memory" to refer to the hash table.""" - return max(maxmem_kb / 64, shadow_mem_kb) - - - class HVMImageHandler(ImageHandler): ostype = "hvm" @@ -783,9 +769,6 @@ class X86_Linux_ImageHandler(LinuxImageH return LinuxImageHandler.buildDomain(self) _handlers = { - "powerpc": { - "linux": PPC_LinuxImageHandler, - }, "ia64": { "linux": IA64_Linux_ImageHandler, "hvm": IA64_HVM_ImageHandler, diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/lib/XmTestLib/arch.py --- a/tools/xm-test/lib/XmTestLib/arch.py Thu May 08 13:15:45 2008 +0100 +++ b/tools/xm-test/lib/XmTestLib/arch.py Thu May 08 13:40:40 2008 +0100 @@ -88,39 +88,6 @@ ia_HVMDefaults = {"memory" : } # End : Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors -# Begin: PowerPC -def ppc_checkBuffer(buffer): - checks = [ - {"pattern" : re.compile("^\d+:mon>\s*$", re.MULTILINE), - "message" : "domain trapped into XMON"}, - ] - - for i in range(0, len(checks)): - check=checks[i] - if check.get('pattern').search(buffer): - FAIL(check.get('message')) - - return - -def ppc_minSafeMem(): - return 64 - -def ppc_getDefaultKernel(): - """Get the path to the default DomU kernel""" - dom0Ver = commands.getoutput("uname -r"); - domUVer = dom0Ver.replace("xen0", "xenU"); - - return "/boot/vmlinux-" + domUVer; - -ppc_ParavirtDefaults = {"memory" : 64, - "vcpus" : 1, - "kernel" : ppc_getDefaultKernel(), - "root" : "/dev/ram0", - "ramdisk" : getRdPath() + "/initrd.img", - "extra" : "xencons=tty128 console=tty128", -} -# End : PowerPC - """Convert from uname specification to a more general platform.""" _uname_to_arch_map = { "i386" : "x86", @@ -129,8 +96,6 @@ _uname_to_arch_map = { "i686" : "x86", "x86_64": "x86_64", "ia64" : "ia64", - "ppc" : "powerpc", - "ppc64" : "powerpc", } # Lookup current platform. @@ -158,10 +123,5 @@ if _arch == "x86" or _arch == "x86_64" o minSafeMem = ia64_minSafeMem configDefaults['memory'] = ia64_minSafeMem() -elif _arch == "powerpc": - minSafeMem = ppc_minSafeMem - getDefaultKernel = ppc_getDefaultKernel - checkBuffer = ppc_checkBuffer - configDefaults = ppc_ParavirtDefaults else: raise ValueError, "Unknown architecture!" diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/lib/XmTestReport/arch.py --- a/tools/xm-test/lib/XmTestReport/arch.py Thu May 08 13:15:45 2008 +0100 +++ b/tools/xm-test/lib/XmTestReport/arch.py Thu May 08 13:40:40 2008 +0100 @@ -30,8 +30,6 @@ _uname_to_arch_map = { "i686" : "x86", "x86_64": "x86_64", "ia64" : "ia64", - "ppc" : "powerpc", - "ppc64" : "powerpc", } _arch = _uname_to_arch_map.get(os.uname()[4], "Unknown") @@ -44,9 +42,5 @@ elif _arch == "ia64": elif _arch == "ia64": cpuValues = {"arch" : "Unknown", "features" : "Unknown"} -elif _arch == "powerpc": - cpuValues = {"cpu" : "Unknown", - "platform" : "Unknown", - "revision" : "Unknown"} else: raise ValueError, "Unknown architecture!" diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/ramdisk/Makefile.am --- a/tools/xm-test/ramdisk/Makefile.am Thu May 08 13:15:45 2008 +0100 +++ b/tools/xm-test/ramdisk/Makefile.am Thu May 08 13:40:40 2008 +0100 @@ -14,7 +14,7 @@ INITRD ?= http://xm-test.xensource.com/ramdisks -BR_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/ppc\(64\)*/powerpc/' -e 's/x86_64/i386/') +BR_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/x86_64/i386/') @MK@ifdef BR_SNAPSHOT @MK@ BR_URL = http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2 diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/ramdisk/configs/buildroot-powerpc --- a/tools/xm-test/ramdisk/configs/buildroot-powerpc Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,338 +0,0 @@ -# -# Automatically generated make config: don't edit -# -BR2_HAVE_DOT_CONFIG=y -# BR2_alpha is not set -# BR2_arm is not set -# BR2_armeb is not set -# BR2_cris is not set -# BR2_i386 is not set -# BR2_m68k is not set -# BR2_mips is not set -# BR2_mipsel is not set -# BR2_nios2 is not set -BR2_powerpc=y -# BR2_sh is not set -# BR2_sh64 is not set -# BR2_sparc is not set -# BR2_x86_64 is not set -BR2_ARCH="powerpc" -BR2_ENDIAN="BIG" - -# -# Build options -# -BR2_WGET="wget --passive-ftp" -BR2_SVN="svn co" -BR2_ZCAT="zcat" -BR2_TAR_OPTIONS="" -BR2_DL_DIR="$(BASE_DIR)/dl" -BR2_SOURCEFORGE_MIRROR="easynews" -BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir" -BR2_TOPDIR_PREFIX="" -BR2_TOPDIR_SUFFIX="" -BR2_GNU_BUILD_SUFFIX="pc-linux-gnu" -BR2_GNU_TARGET_SUFFIX="linux-uclibc" -BR2_JLEVEL=1 - -# -# Toolchain Options -# - -# -# Kernel Header Options -# -# BR2_KERNEL_HEADERS_2_4_25 is not set -# BR2_KERNEL_HEADERS_2_4_27 is not set -# BR2_KERNEL_HEADERS_2_4_29 is not set -# BR2_KERNEL_HEADERS_2_4_31 is not set -# BR2_KERNEL_HEADERS_2_6_9 is not set -# BR2_KERNEL_HEADERS_2_6_11 is not set -BR2_KERNEL_HEADERS_2_6_12=y -# BR2_KERNEL_HEADERS_2_6_18 is not set -BR2_DEFAULT_KERNEL_HEADERS="2.6.12" - -# -# uClibc Options -# -# BR2_UCLIBC_VERSION_SNAPSHOT is not set -# BR2_ENABLE_LOCALE is not set -# BR2_PTHREADS_NONE is not set -# BR2_PTHREADS is not set -BR2_PTHREADS_OLD=y -# BR2_PTHREADS_NATIVE is not set - -# -# Binutils Options -# -# BR2_BINUTILS_VERSION_2_14_90_0_8 is not set -# BR2_BINUTILS_VERSION_2_15 is not set -# BR2_BINUTILS_VERSION_2_15_94_0_2_2 is not set -# BR2_BINUTILS_VERSION_2_16_1 is not set -# BR2_BINUTILS_VERSION_2_16_90_0_3 is not set -# BR2_BINUTILS_VERSION_2_16_91_0_5 is not set -# BR2_BINUTILS_VERSION_2_16_91_0_6 is not set -# BR2_BINUTILS_VERSION_2_16_91_0_7 is not set -BR2_BINUTILS_VERSION_2_17=y -# BR2_BINUTILS_VERSION_2_17_50_0_2 is not set -# BR2_BINUTILS_VERSION_2_17_50_0_3 is not set -# BR2_BINUTILS_VERSION_2_17_50_0_4 is not set -# BR2_BINUTILS_VERSION_2_17_50_0_5 is not set -# BR2_BINUTILS_VERSION_2_17_50_0_6 is not set -BR2_BINUTILS_VERSION="2.17" -BR2_EXTRA_BINUTILS_CONFIG_OPTIONS="" - -# -# Gcc Options -# -# BR2_GCC_VERSION_3_3_5 is not set -# BR2_GCC_VERSION_3_3_6 is not set -BR2_GCC_VERSION_3_4_2=y -# BR2_GCC_VERSION_3_4_3 is not set -# BR2_GCC_VERSION_3_4_4 is not set -# BR2_GCC_VERSION_3_4_5 is not set -# BR2_GCC_VERSION_3_4_6 is not set -# BR2_GCC_VERSION_4_0_0 is not set -# BR2_GCC_VERSION_4_0_1 is not set -# BR2_GCC_VERSION_4_0_2 is not set -# BR2_GCC_VERSION_4_0_3 is not set -# BR2_GCC_VERSION_4_1_0 is not set -# BR2_GCC_VERSION_4_1_1 is not set -# BR2_GCC_VERSION_4_2 is not set -# BR2_GCC_IS_SNAP is not set -BR2_GCC_VERSION="3.4.2" -# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set -BR2_EXTRA_GCC_CONFIG_OPTIONS="" -# BR2_INSTALL_LIBSTDCPP is not set -# BR2_INSTALL_OBJC is not set -# BR2_GCC_SHARED_LIBGCC is not set - -# -# Ccache Options -# -BR2_CCACHE=y - -# -# Gdb Options -# -# BR2_PACKAGE_GDB is not set -# BR2_PACKAGE_GDB_SERVER is not set -# BR2_PACKAGE_GDB_HOST is not set - -# -# elf2flt -# -# BR2_ELF2FLT is not set -# BR2_MKLIBS is not set - -# -# Common Toolchain Options -# -# BR2_PACKAGE_SSTRIP_TARGET is not set -# BR2_PACKAGE_SSTRIP_HOST is not set -BR2_ENABLE_MULTILIB=y -BR2_LARGEFILE=y -# BR2_SOFT_FLOAT is not set -BR2_TARGET_OPTIMIZATION="-Os -pipe" -BR2_CROSS_TOOLCHAIN_TARGET_UTILS=y - -# -# Package Selection for the target -# - -# -# The default minimal system -# -BR2_PACKAGE_BUSYBOX=y -# BR2_PACKAGE_BUSYBOX_SNAPSHOT is not set -BR2_PACKAGE_BUSYBOX_INSTALL_SYMLINKS=y -BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox.config" - -# -# The minimum needed to build a uClibc development system -# -# BR2_PACKAGE_BASH is not set -# BR2_PACKAGE_BZIP2 is not set -# BR2_PACKAGE_COREUTILS is not set -# BR2_PACKAGE_DIFFUTILS is not set -# BR2_PACKAGE_ED is not set -# BR2_PACKAGE_FINDUTILS is not set -# BR2_PACKAGE_FLEX is not set -# BR2_PACKAGE_GAWK is not set -# BR2_PACKAGE_GCC_TARGET is not set -# BR2_PACKAGE_CCACHE_TARGET is not set -# BR2_PACKAGE_GREP is not set -# BR2_PACKAGE_MAKE is not set -# BR2_PACKAGE_PATCH is not set -# BR2_PACKAGE_SED is not set -# BR2_PACKAGE_TAR is not set - -# -# Other stuff -# -# BR2_PACKAGE_ACPID is not set -# BR2_PACKAGE_ASTERISK is not set -# BR2_PACKAGE_AT is not set -# BR2_PACKAGE_AUTOCONF is not set -# BR2_PACKAGE_AUTOMAKE is not set -# BR2_PACKAGE_BERKELEYDB is not set -# BR2_PACKAGE_BIND is not set -# BR2_PACKAGE_BISON is not set -# BR2_PACKAGE_BOA is not set -# BR2_PACKAGE_BRIDGE is not set -# BR2_PACKAGE_CUSTOMIZE is not set -# BR2_PACKAGE_ISC_DHCP is not set -# BR2_PACKAGE_DIALOG is not set -# BR2_PACKAGE_DIRECTFB is not set -# BR2_PACKAGE_DISTCC is not set -# BR2_PACKAGE_DM is not set -# BR2_PACKAGE_DMRAID is not set -# BR2_PACKAGE_DNSMASQ is not set -# BR2_PACKAGE_DROPBEAR is not set -# BR2_PACKAGE_ETHTOOL is not set -# BR2_PACKAGE_EXPAT is not set -# BR2_PACKAGE_E2FSPROGS is not set -# BR2_PACKAGE_FAKEROOT is not set -# BR2_PACKAGE_FILE is not set -# BR2_PACKAGE_FREETYPE is not set -# BR2_PACKAGE_GETTEXT is not set -# BR2_PACKAGE_LIBINTL is not set -# BR2_PACKAGE_GZIP is not set -# BR2_PACKAGE_HASERL is not set -# BR2_PACKAGE_HDPARM is not set -# BR2_PACKAGE_HOSTAP is not set -# BR2_PACKAGE_HOTPLUG is not set -# BR2_PACKAGE_IOSTAT is not set -# BR2_PACKAGE_IPROUTE2 is not set -# BR2_PACKAGE_IPSEC_TOOLS is not set -# BR2_PACKAGE_IPTABLES is not set -# BR2_PACKAGE_JPEG is not set -# BR2_PACKAGE_LESS is not set -# BR2_PACKAGE_LIBCGI is not set -# BR2_PACKAGE_LIBCGICC is not set -# BR2_PACKAGE_LIBELF is not set -# BR2_PACKAGE_LIBFLOAT is not set -# BR2_PACKAGE_LIBGLIB12 is not set -# BR2_PACKAGE_LIBMAD is not set -# BR2_PACKAGE_LIBPCAP is not set -# BR2_PACKAGE_LIBPNG is not set -# BR2_PACKAGE_LIBSYSFS is not set -# BR2_PACKAGE_LIBTOOL is not set -# BR2_PACKAGE_LIBUSB is not set -# BR2_PACKAGE_LIGHTTPD is not set -# BR2_PACKAGE_LINKS is not set -# BR2_PACKAGE_LRZSZ is not set -# BR2_PACKAGE_LSOF is not set -# BR2_PACKAGE_LTP-TESTSUITE is not set -# BR2_PACKAGE_LTT is not set -# BR2_PACKAGE_LVM2 is not set -# BR2_PACKAGE_LZO is not set -# BR2_PACKAGE_LZMA is not set -# BR2_PACKAGE_M4 is not set -# BR2_PACKAGE_MDADM is not set -# BR2_PACKAGE_MEMTESTER is not set -# BR2_PACKAGE_MICROCOM is not set -# BR2_PACKAGE_MICROPERL is not set -# BR2_PACKAGE_MICROWIN is not set -# BR2_PACKAGE_MKDOSFS is not set -# BR2_PACKAGE_MODULE_INIT_TOOLS is not set -# BR2_PACKAGE_MODUTILS is not set -# BR2_PACKAGE_MPG123 is not set -# BR2_PACKAGE_MROUTED is not set -# BR2_PACKAGE_MTD is not set -# BR2_PACKAGE_NANO is not set -# BR2_PACKAGE_NBD is not set -# BR2_PACKAGE_NCURSES is not set -# BR2_PACKAGE_NETKITBASE is not set -# BR2_PACKAGE_NETKITTELNET is not set -# BR2_PACKAGE_NETSNMP is not set -# BR2_PACKAGE_NEWT is not set -# BR2_PACKAGE_NTP is not set -# BR2_PACKAGE_OPENNTPD is not set -# BR2_PACKAGE_OPENSSH is not set -# BR2_PACKAGE_OPENSSL is not set -# BR2_PACKAGE_OPENVPN is not set -# BR2_PACKAGE_PCIUTILS is not set -# BR2_PACKAGE_PKGCONFIG is not set -# BR2_PACKAGE_PORTAGE is not set -# BR2_PACKAGE_PORTMAP is not set -# BR2_PACKAGE_PPPD is not set -# BR2_PACKAGE_PROCPS is not set -# BR2_PACKAGE_PSMISC is not set -# BR2_PACKAGE_PYTHON is not set -# BR2_PACKAGE_QTE is not set -BR2_QTE_TMAKE_VERSION="1.13" -# BR2_PACKAGE_RAIDTOOLS is not set -# BR2_READLINE is not set -# BR2_PACKAGE_RSYNC is not set -# BR2_PACKAGE_RUBY is not set -# BR2_PACKAGE_RXVT is not set -# BR2_PACKAGE_SDL is not set -# BR2_PACKAGE_SFDISK is not set -# BR2_PACKAGE_SLANG is not set -# BR2_PACKAGE_SMARTMONTOOLS is not set -# BR2_PACKAGE_SOCAT is not set -# BR2_PACKAGE_SQLITE is not set -# BR2_PACKAGE_STRACE is not set -# BR2_PACKAGE_SUDO is not set -# BR2_PACKAGE_SYSKLOGD is not set -# BR2_PACKAGE_SYSVINIT is not set -# BR2_PACKAGE_TCL is not set -# BR2_PACKAGE_TCPDUMP is not set -# BR2_PACKAGE_TFTPD is not set -# BR2_PACKAGE_THTTPD is not set -# BR2_PACKAGE_TINYLOGIN is not set -# BR2_PACKAGE_TINYX is not set -# BR2_PACKAGE_TN5250 is not set -# BR2_PACKAGE_TTCP is not set -# BR2_PACKAGE_UDEV is not set -# BR2_PACKAGE_UDHCP is not set -# BR2_PACKAGE_UEMACS is not set -# BR2_PACKAGE_USBUTILS is not set -# BR2_PACKAGE_UTIL-LINUX is not set -# BR2_PACKAGE_VALGRIND is not set -# BR2_PACKAGE_VTUN is not set -# BR2_PACKAGE_WGET is not set -# BR2_PACKAGE_WHICH is not set -# BR2_PACKAGE_WIPE is not set -# BR2_PACKAGE_WIRELESS_TOOLS is not set -# BR2_PACKAGE_XFSPROGS is not set -# BR2_PACKAGE_ZLIB is not set -BR2_PACKAGE_HPING=y - -# -# Target Options -# - -# -# filesystem for target device -# -# BR2_TARGET_ROOTFS_CRAMFS is not set -# BR2_TARGET_ROOTFS_CLOOP is not set -BR2_TARGET_ROOTFS_EXT2=y -BR2_TARGET_ROOTFS_EXT2_BLOCKS=0 -BR2_TARGET_ROOTFS_EXT2_INODES=0 -BR2_TARGET_ROOTFS_EXT2_RESBLKS=0 -BR2_TARGET_ROOTFS_EXT2_SQUASH=y -BR2_TARGET_ROOTFS_EXT2_OUTPUT="$(IMAGE).ext2" -# BR2_TARGET_ROOTFS_EXT2_GZ is not set -BR2_TARGET_ROOTFS_EXT2_COPYTO="" -# BR2_TARGET_ROOTFS_JFFS2 is not set -# BR2_TARGET_ROOTFS_SQUASHFS is not set -# BR2_TARGET_ROOTFS_TAR is not set - -# -# bootloader for target device -# -# BR2_TARGET_YABOOT is not set - -# -# Board Support Options -# - -# -# Generic System Support -# -# BR2_TARGET_GENERIC_ACCESS_POINT is not set -# BR2_TARGET_GENERIC_FIREWALL is not set -# BR2_TARGET_GENERIC_DEV_SYSTEM is not set diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/ramdisk/make-release.sh --- a/tools/xm-test/ramdisk/make-release.sh Thu May 08 13:15:45 2008 +0100 +++ b/tools/xm-test/ramdisk/make-release.sh Thu May 08 13:40:40 2008 +0100 @@ -3,9 +3,6 @@ if [ "$1" == "" ] if [ "$1" == "" ] then arch="" -elif [ "$1" == "powerpc" ] -then - arch="BR_ARCH=powerpc" else echo "Invalid architecture specified." >&2 exit 1 diff -r 0ac957f9d42e -r b0d7780794eb tools/xm-test/runtest.sh --- a/tools/xm-test/runtest.sh Thu May 08 13:15:45 2008 +0100 +++ b/tools/xm-test/runtest.sh Thu May 08 13:40:40 2008 +0100 @@ -77,7 +77,7 @@ runnable_tests() { # using the right version realrd=$(readlink ramdisk/initrd.img) eval $(./lib/XmTestReport/xmtest.py) - ARCH=$(uname -m | sed -e s/i.86/i386/ -e 's/ppc\(64\)*/powerpc/') + ARCH=$(uname -m | sed -e s/i.86/i386/) rrdver="initrd-${XM_TEST_MAJ}.${XM_TEST_MIN}-${ARCH}.img" exp_flag=0 realarch=`echo $realrd | awk -F- '{print $3}' | awk -F. '{print $1}'` diff -r 0ac957f9d42e -r b0d7780794eb xen/Rules.mk --- a/xen/Rules.mk Thu May 08 13:15:45 2008 +0100 +++ b/xen/Rules.mk Thu May 08 13:40:40 2008 +0100 @@ -30,8 +30,7 @@ endif # Set ARCH/SUBARCH appropriately. override TARGET_SUBARCH := $(XEN_TARGET_ARCH) override TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \ - sed -e 's/x86.*/x86/' \ - -e 's/powerpc.*/powerpc/') + sed -e 's/x86.*/x86/') TARGET := $(BASEDIR)/xen diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/0opt.c --- a/xen/arch/powerpc/0opt.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#include -#include - -extern void __xchg_called_with_bad_pointer(void); -void __xchg_called_with_bad_pointer(void) -{ - BUG(); -} - -extern void __cmpxchg_called_with_bad_pointer(void); -void __cmpxchg_called_with_bad_pointer(void) -{ - BUG(); -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/Makefile --- a/xen/arch/powerpc/Makefile Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -ifneq ($(DOM0_IMAGE),) -builtin_dom0 := y -endif - -subdir-$(HAS_PPC64) += powerpc64 -subdir-y += papr - -obj-y += audit.o -obj-y += backtrace.o -obj-y += bitops.o -obj-y += boot_of.o -obj-y += cmdline.o -obj-y += dart.o -obj-y += dart_u3.o -obj-y += dart_u4.o -obj-y += domctl.o -obj-y += domain_build.o -obj-y += domain.o -obj-y += exceptions.o -obj-y += external.o -obj-y += float.o -obj-y += hcalls.o -obj-y += iommu.o -obj-y += irq.o -obj-y += systemsim.o -obj-y += memory.o -obj-y += mm.o -obj-y += mpic.o -obj-y += mpic_init.o -obj-y += multiboot2.o -obj-y += numa.o -obj-y += of-devtree.o -obj-y += of-devwalk.o -obj-y += ofd_fixup.o -obj-y += ofd_fixup_memory.o -obj-y += physdev.o -obj-y += platform.o -obj-y += rtas.o -obj-y += rtas_nvram.o -obj-y += rtas_flash.o -obj-y += setup.o -obj-y += shadow.o -obj-y += smp.o -obj-y += smpboot.o -obj-y += smp-tbsync.o -obj-y += sysctl.o -obj-y += time.o -obj-y += usercopy.o -obj-y += machine_kexec.o -obj-y += crash.o - -obj-$(debug) += 0opt.o -obj-$(crash_debug) += gdbstub.o -obj-$(builtin_dom0) += dom0.o - -obj-y += firmware_image.o - -# These are extra warnings like for the arch/ppc directory but may not -# allow the rest of the tree to build. -PPC_C_WARNINGS += -Wundef -Wmissing-prototypes -Wmissing-declarations -PPC_C_WARNINGS += -Wshadow -CFLAGS += $(PPC_C_WARNINGS) - -# -# The following flags are fed to gcc in order to link several -# objects into a single ELF segment and to not link in any additional -# objects that gcc would normally like to -# -OMAGIC = -nodefaultlibs -nostartfiles -Wl,--omagic - -firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o - $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@ - -# -# Link firmware again but this time at the place we expect to load it. -# This makes debugging _way_ easier. -# -firmware.dbg: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o - $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x2000000 $^ -o $@ - -firmware_image.bin: firmware firmware.dbg - $(CROSS_COMPILE)objcopy --output-target=binary $< $@ - -# -# Hacks for included C files -# -irq.o: ../x86/irq.c -physdev.o: ../x86/physdev.c -numa.o: ../x86/numa.c - -ifneq ($(CMDLINE),) -# The first token in the arguments will be silently dropped. -FULL_CMDLINE := xen $(CMDLINE) -endif - -ifeq ($(wildcard cmdline.dep),) -cmdline.dep: - echo $(FULL_CMDLINE) > cmdline.dep -else -ifneq ($(FULL_CMDLINE),$(shell cat cmdline.dep)) -cmdline.dep:: - echo $(FULL_CMDLINE) > cmdline.dep -else -cmdline.dep: -endif -endif - -cmdline.o: cmdline.dep -cmdline.o: CFLAGS += -DCMDLINE="\"$(FULL_CMDLINE)\"" - -TARGET_OPTS = $(OMAGIC) -Wl,-T,xen.lds -TARGET_OPTS += start.o $(ALL_OBJS) - -.xen-syms: start.o $(ALL_OBJS) xen.lds - $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o - $(CC) $(CFLAGS) $(TARGET_OPTS) $(BASEDIR)/common/symbols-dummy.o -o $@ - -NM=$(CROSS_COMPILE)nm -new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) - -ifeq ($(new_nm),y) -NM := $(NM) --synthetic -endif - -xen-syms.S: .xen-syms - $(NM) -n $^ | $(BASEDIR)/tools/symbols > $@ - -xen-syms.o: xen-syms.S - $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@ - -$(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds - $(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@ - -# our firmware only loads 32-bit ELF files -OCPYFLAGS := --input-target=elf64-powerpc --output-target=elf32-powerpc -$(TARGET): $(TARGET)-syms - $(CROSS_COMPILE)objcopy $(OCPYFLAGS) $^ $@ - -asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS) - $(CC) $(CFLAGS) -S -o $@ $< - -xen.lds: xen.lds.S $(HDRS) - $(CC) -P -E $(AFLAGS) -o $@ $< - -dom0.bin: $(DOM0_IMAGE) - cp $< $@ - -clean:: - $(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean - rm -f firmware firmware.dbg firmware_image.bin \ - dom0.bin .xen-syms xen-syms.S \ - xen.lds asm-offsets.s cmdline.dep diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/Rules.mk --- a/xen/arch/powerpc/Rules.mk Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -HAS_PPC64 := y - -CC := $(CROSS_COMPILE)gcc -LD := $(CROSS_COMPILE)ld - -# These are goodess that applies to all source. -C_WARNINGS := -Wredundant-decls - -# _no_ common code can have packed data structures or we are in touble. -C_WARNINGS += -Wpacked - -CFLAGS += -m64 -ffreestanding -fno-builtin -fno-common -CFLAGS += -iwithprefix include -Werror -pipe -CFLAGS += -I$(BASEDIR)/include -CFLAGS += -I$(BASEDIR)/include/asm-powerpc/mach-default -CFLAGS += $(C_WARNINGS) -CFLAGS += -msoft-float -O2 -CFLAGS-$(debug) += -O0 # last one wins -CFLAGS-$(papr_vterm) += -DPAPR_VDEVICE -DPAPR_VTERM - -LDFLAGS += -m elf64ppc - -# -# command to embed a binary inside a .o -# -%.o: %.bin - $(CROSS_COMPILE)objcopy --input-target=binary \ - --output-target=elf64-powerpc \ - --binary-architecture=powerpc \ - --redefine-sym _binary_$*_bin_start=$*_start \ - --redefine-sym _binary_$*_bin_end=$*_end \ - --redefine-sym _binary_$*_bin_size=$*_size \ - $< $@ - -HDRS += $(wildcard $(BASEDIR)/include/asm-powerpc/mach-*/*.h) - -# Test for at least GCC v3.2.x. -gcc-ver = $(shell $(CC) -dumpversion | sed -e 's/^\(.\)\.\(.\)\.\(.\)/\$(1)/') -ifeq ($(call gcc-ver,1),1) -$(error gcc-1.x.x unsupported - upgrade to at least gcc-3.2.x) -endif -ifeq ($(call gcc-ver,1),2) -$(error gcc-2.x.x unsupported - upgrade to at least gcc-3.2.x) -endif -ifeq ($(call gcc-ver,1),3) -ifeq ($(call gcc-ver,2),0) -$(error gcc-3.0.x unsupported - upgrade to at least gcc-3.2.x) -endif -ifeq ($(call gcc-ver,2),1) -$(error gcc-3.1.x unsupported - upgrade to at least gcc-3.2.x) -endif -endif diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/audit.c --- a/xen/arch/powerpc/audit.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Hollis Blanchard - */ - -#ifndef NDEBUG -#include -#include - -extern void audit_domain(struct domain *d); -extern void audit_domains(void); -extern void audit_domains_key(unsigned char key); - -void audit_domain(struct domain *d) -{ - panic("%s unimplemented\n", __func__); -} - -void audit_domains(void) -{ - struct domain *d; - rcu_read_lock(&domlist_read_lock); - for_each_domain ( d ) - audit_domain(d); - rcu_read_unlock(&domlist_read_lock); -} - -void audit_domains_key(unsigned char key) -{ - audit_domains(); -} -#endif diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/backtrace.c --- a/xen/arch/powerpc/backtrace.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -/* - * Routines providing a simple monitor for use on the PowerMac. - * - * Copyright (C) 1996-2005 Paul Mackerras. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - -static char namebuf[KSYM_NAME_LEN+1]; - -/* Shamelessly lifted from Linux Xmon try to keep pristene */ -#ifdef __powerpc64__ -#define LRSAVE_OFFSET 0x10 -#define REG_FRAME_MARKER 0x7265677368657265ul /* "regshere" */ -#define MARKER_OFFSET 0x60 -#define REGS_OFFSET 0x70 -#define REG "%016lX" -#else -#define LRSAVE_OFFSET 4 -#define REG_FRAME_MARKER 0x72656773 -#define MARKER_OFFSET 8 -#define REGS_OFFSET 16 -#define REG "%08lX" -#endif - -#define TRAP(regs) ((regs)->entry_vector & ~0xF) -static int xmon_depth_to_print = 64; - -/* Very cheap human name for vector lookup. */ -static -const char *getvecname(unsigned long vec) -{ - char *ret; - - switch (vec) { - case 0x100: ret = "(System Reset)"; break; - case 0x200: ret = "(Machine Check)"; break; - case 0x300: ret = "(Data Access)"; break; - case 0x380: ret = "(Data SLB Access)"; break; - case 0x400: ret = "(Instruction Access)"; break; - case 0x480: ret = "(Instruction SLB Access)"; break; - case 0x500: ret = "(Hardware Interrupt)"; break; - case 0x600: ret = "(Alignment)"; break; - case 0x700: ret = "(Program Check)"; break; - case 0x800: ret = "(FPU Unavailable)"; break; - case 0x900: ret = "(Decrementer)"; break; - case 0xc00: ret = "(System Call)"; break; - case 0xd00: ret = "(Single Step)"; break; - case 0xf00: ret = "(Performance Monitor)"; break; - case 0xf20: ret = "(Altivec Unavailable)"; break; - case 0x1300: ret = "(Instruction Breakpoint)"; break; - default: ret = ""; - } - return ret; -} - -static int mread(unsigned long adrs, void *buf, int size) -{ - memcpy(buf, (void *)adrs, size); - return size; -} - -static void get_function_bounds(unsigned long pc, unsigned long *startp, - unsigned long *endp) -{ - unsigned long size, offset; - const char *name; - - *startp = *endp = 0; - if (pc == 0) - return; - - name = symbols_lookup(pc, &size, &offset, namebuf); - if (name != NULL) { - *startp = pc - offset; - *endp = pc - offset + size; - } -} - -/* Print an address in numeric and symbolic form (if possible) */ -static void xmon_print_symbol(unsigned long address, const char *mid, - const char *after) -{ - const char *name = NULL; - unsigned long offset, size; - - printk(REG, address); - - name = symbols_lookup(address, &size, &offset, namebuf); - if (name) { - printk("%s%s+%#lx/%#lx", mid, name, offset, size); - } - printk("%s", after); -} - -static void backtrace( - unsigned long sp, unsigned long lr, unsigned long pc) -{ - unsigned long ip; - unsigned long newsp; - unsigned long marker; - int count = 0; - struct cpu_user_regs regs; - - do { - if (sp > xenheap_phys_end) { - if (sp != 0) - printk("SP (%lx) is not in xen space\n", sp); - break; - } - - if (!mread(sp + LRSAVE_OFFSET, &ip, sizeof(unsigned long)) - || !mread(sp, &newsp, sizeof(unsigned long))) { - printk("Couldn't read stack frame at %lx\n", sp); - break; - } - - /* - * For the first stack frame, try to work out if - * LR and/or the saved LR value in the bottommost - * stack frame are valid. - */ - if ((pc | lr) != 0) { - unsigned long fnstart, fnend; - unsigned long nextip; - int printip = 1; - - get_function_bounds(pc, &fnstart, &fnend); - nextip = 0; - if (newsp > sp) - mread(newsp + LRSAVE_OFFSET, &nextip, - sizeof(unsigned long)); - if (lr == ip) { - if (lr >= xenheap_phys_end - || (fnstart <= lr && lr < fnend)) - printip = 0; - } else if (lr == nextip) { - printip = 0; - } else if (lr < xenheap_phys_end - && !(fnstart <= lr && lr < fnend)) { - printk("[link register ] "); - xmon_print_symbol(lr, " ", "\n"); - } - if (printip) { - printk("["REG"] ", sp); - xmon_print_symbol(ip, " ", " (unreliable)\n"); - } - pc = lr = 0; - - } else { - printk("["REG"] ", sp); - xmon_print_symbol(ip, " ", "\n"); - } - - /* Look for "regshere" marker to see if this is - an exception frame. */ - if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long)) - && marker == REG_FRAME_MARKER) { - if (mread(sp + REGS_OFFSET, ®s, sizeof(regs)) - != sizeof(regs)) { - printk("Couldn't read registers at %lx\n", - sp + REGS_OFFSET); - break; - } - printk("--- Exception: %x %s at ", regs.entry_vector, - getvecname(TRAP(®s))); - pc = regs.pc; - lr = regs.lr; - xmon_print_symbol(pc, " ", "\n"); - } - - if (newsp == 0) - break; - - sp = newsp; - } while (count++ < xmon_depth_to_print); -} - -void show_backtrace(ulong sp, ulong lr, ulong pc) -{ - console_start_sync(); - backtrace(sp, lr, pc); - console_end_sync(); -} - -void show_backtrace_regs(struct cpu_user_regs *regs) -{ - console_start_sync(); - - show_registers(regs); - printk("hid4 0x%016lx\n", regs->hid4); - printk("---[ backtrace ]---\n"); - show_backtrace(regs->gprs[1], regs->lr, regs->pc); - - console_end_sync(); -} - -void dump_execution_state(void) -{ - struct cpu_user_regs *regs = guest_cpu_user_regs(); - - show_registers(regs); - if (regs->msr & MSR_HV) { - printk("In Xen:\n"); - show_backtrace(regs->gprs[1], regs->pc, regs->lr); - } -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/bitops.c --- a/xen/arch/powerpc/bitops.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* from linux/arch/powerpc/lib/bitops.c */ - -#include -#include - -#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) - -/** - * find_next_bit - find the next set bit in a memory region - * @addr: The address to base the search on - * @offset: The bitnumber to start searching at - * @size: The maximum size to search - */ -unsigned long find_next_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) -{ - const unsigned long *p = addr + BITOP_WORD(offset); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset %= BITS_PER_LONG; - if (offset) { - tmp = *(p++); - tmp &= (~0UL << offset); - if (size < BITS_PER_LONG) - goto found_first; - if (tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) { - if ((tmp = *(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = *p; - -found_first: - tmp &= (~0UL >> (BITS_PER_LONG - size)); - if (tmp == 0UL) /* Are any bits set? */ - return result + size; /* Nope. */ -found_middle: - return result + __ffs(tmp); -} - -/* - * This implementation of find_{first,next}_zero_bit was stolen from - * Linus' asm-alpha/bitops.h. - */ -unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) -{ - const unsigned long *p = addr + BITOP_WORD(offset); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset %= BITS_PER_LONG; - if (offset) { - tmp = *(p++); - tmp |= ~0UL >> (BITS_PER_LONG - offset); - if (size < BITS_PER_LONG) - goto found_first; - if (~tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) { - if (~(tmp = *(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = *p; - -found_first: - tmp |= ~0UL << size; - if (tmp == ~0UL) /* Are any bits zero? */ - return result + size; /* Nope. */ -found_middle: - return result + ffz(tmp); -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/boot_of.c --- a/xen/arch/powerpc/boot_of.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1257 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2006, 2007 - * - * Authors: Jimi Xenidis - * Hollis Blanchard - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "exceptions.h" -#include "of-devtree.h" -#include "oftree.h" -#include "rtas.h" - -/* Secondary processors use this for handshaking with main processor. */ -volatile unsigned int __spin_ack; - -static ulong of_vec; -static ulong of_msr; -static int of_out; -static ulong eomem; - -/* Track memory during early boot with a limited per-page bitmap. We need an - * allocator to tell us where we can place RTAS, our copy of the device tree. - * We could examine the "available" properties in memory nodes, but we - * apparently can't depend on firmware to update those when we call "claim". So - * we need to track it ourselves. - * We can't dynamically allocate the bitmap, because we would need something - * to tell us where it's safe to allocate... - */ -#define MEM_AVAILABLE_PAGES ((32 << 20) >> PAGE_SHIFT) -static DECLARE_BITMAP(mem_available_pages, MEM_AVAILABLE_PAGES); - -extern struct ns16550_defaults ns16550; - -#undef OF_DEBUG -#undef OF_DEBUG_LOW - -#ifdef OF_DEBUG -#define DBG(args...) of_printf(args) -#else -#define DBG(args...) -#endif - -#ifdef OF_DEBUG_LOW -#define DBG_LOW(args...) of_printf(args) -#else -#define DBG_LOW(args...) -#endif - -#define of_panic(MSG...) \ - do { of_printf(MSG); of_printf("\nHANG\n"); for (;;); } while (0) - -struct of_service { - u32 ofs_service; - u32 ofs_nargs; - u32 ofs_nrets; - u32 ofs_args[10]; -}; - -static int bof_chosen; - -static struct of_service s; - -static int __init of_call( - const char *service, u32 nargs, u32 nrets, s32 rets[], ...) -{ - int rc; - - if (of_vec != 0) { - va_list args; - int i; - memset(&s, 0, sizeof (s)); - s.ofs_service = (ulong)service; - s.ofs_nargs = nargs; - s.ofs_nrets = nrets; - s.ofs_nargs = nargs; - - /* copy all the params into the args array */ - va_start(args, rets); - - for (i = 0; i < nargs; i++) { - s.ofs_args[i] = va_arg(args, u32); - } - - va_end(args); - - rc = prom_call(&s, 0, of_vec, of_msr); - - /* yes always to the copy, just in case */ - for (i = 0; i < nrets; i++) { - rets[i] = s.ofs_args[i + nargs]; - } - } else { - rc = OF_FAILURE; - } - return rc; -} - -/* popular OF methods */ -static int __init _of_write(int ih, const char *addr, u32 len) -{ - int rets[1] = { OF_FAILURE }; - if (of_call("write", 3, 1, rets, ih, addr, len) == OF_FAILURE) { - return OF_FAILURE; - } - return rets[0]; -} - -/* popular OF methods */ -static int __init of_write(int ih, const char *addr, u32 len) -{ - int rc; - int i = 0; - int sum = 0; - - while (i < len) { - if (addr[i] == '\n') { - if (i > 0) { - rc = _of_write(ih, addr, i); - if (rc == OF_FAILURE) - return rc; - sum += rc; - } - rc = _of_write(ih, "\r\n", 2); - if (rc == OF_FAILURE) - return rc; - sum += rc; - i++; - addr += i; - len -= i; - i = 0; - continue; - } - i++; - } - if (len > 0) { - rc = _of_write(ih, addr, len); - if (rc == OF_FAILURE) - return rc; - sum += rc; - } - - return sum; -} - -static int of_printf(const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); -static int __init of_printf(const char *fmt, ...) -{ - static char buf[1024]; - va_list args; - int sz; - - if (of_out == 0) { - return OF_FAILURE; - } - - va_start(args, fmt); - - sz = vsnprintf(buf, sizeof (buf), fmt, args); - if (sz <= sizeof (buf)) { - of_write(of_out, buf, sz); - } else { - static const char trunc[] = "\n(TRUNCATED)\n"; - - sz = sizeof (buf); - of_write(of_out, buf, sz); - of_write(of_out, trunc, sizeof (trunc)); - } - return sz; -} - -static int __init of_finddevice(const char *devspec) -{ - int rets[1] = { OF_FAILURE }; - - of_call("finddevice", 1, 1, rets, devspec); - if (rets[0] == OF_FAILURE) { - DBG("finddevice %s -> FAILURE %d\n",devspec,rets[0]); - return OF_FAILURE; - } - DBG_LOW("finddevice %s -> %d\n",devspec, rets[0]); - return rets[0]; -} - -static int __init of_getprop(int ph, const char *name, void *buf, u32 buflen) -{ - int rets[1] = { OF_FAILURE }; - - of_call("getprop", 4, 1, rets, ph, name, buf, buflen); - - if (rets[0] == OF_FAILURE) { - DBG_LOW("getprop 0x%x %s -> FAILURE\n", ph, name); - return OF_FAILURE; - } - - DBG_LOW("getprop 0x%x %s -> 0x%x (%s)\n", ph, name, rets[0], (char *)buf); - return rets[0]; -} - -static int __init of_setprop( - int ph, const char *name, const void *buf, u32 buflen) -{ - int rets[1] = { OF_FAILURE }; - - of_call("setprop", 4, 1, rets, ph, name, buf, buflen); - - if (rets[0] == OF_FAILURE) { - DBG("setprop 0x%x %s -> FAILURE\n", ph, name); - return OF_FAILURE; - } - - DBG_LOW("setprop 0x%x %s -> %s\n", ph, name, (char *)buf); - return rets[0]; -} - -/* - * returns 0 if there are no children (of spec) - */ -static int __init of_getchild(int ph) -{ - int rets[1] = { OF_FAILURE }; - - of_call("child", 1, 1, rets, ph); - DBG_LOW("getchild 0x%x -> 0x%x\n", ph, rets[0]); - - return rets[0]; -} - -/* - * returns 0 is there are no peers - */ -static int __init of_getpeer(int ph) -{ - int rets[1] = { OF_FAILURE }; - - of_call("peer", 1, 1, rets, ph); - DBG_LOW("getpeer 0x%x -> 0x%x\n", ph, rets[0]); - - return rets[0]; -} - -static int __init of_getproplen(int ph, const char *name) -{ - int rets[1] = { OF_FAILURE }; - - of_call("getproplen", 2, 1, rets, ph, name); - if (rets[0] == OF_FAILURE) { - DBG("getproplen 0x%x %s -> FAILURE\n", ph, name); - return OF_FAILURE; - } - DBG_LOW("getproplen 0x%x %s -> 0x%x\n", ph, name, rets[0]); - return rets[0]; -} - -static int __init of_package_to_path(int ph, char *buffer, u32 buflen) -{ - int rets[1] = { OF_FAILURE }; - - of_call("package-to-path", 3, 1, rets, ph, buffer, buflen); - if (rets[0] == OF_FAILURE) { - DBG("%s 0x%x -> FAILURE\n", __func__, ph); - return OF_FAILURE; - } - DBG_LOW("%s 0x%x %s -> 0x%x\n", __func__, ph, buffer, rets[0]); - if (rets[0] <= buflen) - buffer[rets[0]] = '\0'; - return rets[0]; -} - -static int __init of_nextprop(int ph, const char *name, void *buf) -{ - int rets[1] = { OF_FAILURE }; - - of_call("nextprop", 3, 1, rets, ph, name, buf); - - if (rets[0] == OF_FAILURE) { - DBG("nextprop 0x%x %s -> FAILURE\n", ph, name); - return OF_FAILURE; - } - - DBG_LOW("nextprop 0x%x %s -> %s\n", ph, name, (char *)buf); - return rets[0]; -} - -static int __init of_instance_to_path(int ih, char *buffer, u32 buflen) -{ - int rets[1] = { OF_FAILURE }; - - if (of_call("instance-to-path", 3, 1, rets, ih, buffer, buflen) - == OF_FAILURE) - return OF_FAILURE; - - if (rets[0] <= buflen) - buffer[rets[0]] = '\0'; - return rets[0]; -} - -static int __init of_start_cpu(int cpu, u32 pc, u32 reg) -{ - int ret; - - ret = of_call("start-cpu", 3, 0, NULL, cpu, pc, reg); - - return ret; -} - -static void __init of_test(const char *of_method_name) -{ - int rets[1] = { OF_FAILURE }; - - of_call("test", 1, 1, rets, of_method_name); - if (rets[0] == OF_FAILURE ) { - of_printf("Warning: possibly no OF method %s.\n" - "(Ignore this warning on PIBS.)\n", of_method_name); - } -} - -static int __init of_claim(u32 virt, u32 size, u32 align) -{ - int rets[1] = { OF_FAILURE }; - - of_call("claim", 3, 1, rets, virt, size, align); - if (rets[0] == OF_FAILURE) { - DBG("%s 0x%08x 0x%08x 0x%08x -> FAIL\n", __func__, virt, size, align); - return OF_FAILURE; - } - - DBG_LOW("%s 0x%08x 0x%08x 0x%08x -> 0x%08x\n", __func__, virt, size, align, - rets[0]); - return rets[0]; -} - -static int __init of_instance_to_package(int ih) -{ - int rets[1] = { OF_FAILURE }; - - of_call("instance-to-package", 1, 1, rets, ih); - if (rets[0] == OF_FAILURE) - return OF_FAILURE; - - return rets[0]; -} - -static int __init of_getparent(int ph) -{ - int rets[1] = { OF_FAILURE }; - - of_call("parent", 1, 1, rets, ph); - - DBG_LOW("getparent 0x%x -> 0x%x\n", ph, rets[0]); - return rets[0]; -} - -static int __init of_open(const char *devspec) -{ - int rets[1] = { OF_FAILURE }; - - of_call("open", 1, 1, rets, devspec); - return rets[0]; -} - -static void boot_of_alloc_init(int m, uint addr_cells, uint size_cells) -{ - int rc; - uint pg; - uint a[64]; - int tst; - u64 start; - u64 size; - - rc = of_getprop(m, "available", a, sizeof (a)); - if (rc > 0) { - int l = rc / sizeof(a[0]); - int r = 0; - -#ifdef OF_DEBUG - { - int i; - of_printf("avail:\n"); - for (i = 0; i < l; i += 4) - of_printf(" 0x%x%x, 0x%x%x\n", - a[i], a[i + 1], - a[i + 2] ,a[i + 3]); - } -#endif - - pg = 0; - while (pg < MEM_AVAILABLE_PAGES && r < l) { - ulong end; - - start = a[r++]; - if (addr_cells == 2 && (r < l) ) - start = (start << 32) | a[r++]; - - size = a[r++]; - if (size_cells == 2 && (r < l) ) - size = (size << 32) | a[r++]; - - end = ALIGN_DOWN(start + size, PAGE_SIZE); - - start = ALIGN_UP(start, PAGE_SIZE); - - DBG("%s: marking 0x%x - 0x%lx\n", __func__, - pg << PAGE_SHIFT, start); - - start >>= PAGE_SHIFT; - while (pg < MEM_AVAILABLE_PAGES && pg < start) { - set_bit(pg, mem_available_pages); - pg++; - } - - pg = end >> PAGE_SHIFT; - } - } - - /* Now make sure we mark our own memory */ - pg = (ulong)_start >> PAGE_SHIFT; - start = (ulong)_end >> PAGE_SHIFT; - - DBG("%s: marking 0x%x - 0x%lx\n", __func__, - pg << PAGE_SHIFT, start << PAGE_SHIFT); - - /* Lets try and detect if our image has stepped on something. It - * is possible that FW has already subtracted our image from - * available memory so we must make sure that the previous bits - * are the same for the whole image */ - tst = test_and_set_bit(pg, mem_available_pages); - ++pg; - while (pg <= start) { - if (test_and_set_bit(pg, mem_available_pages) != tst) - of_panic("%s: pg :0x%x of our image is different\n", - __func__, pg); - ++pg; - } - - DBG("%s: marking 0x%x - 0x%x\n", __func__, - 0 << PAGE_SHIFT, 3 << PAGE_SHIFT); - /* First for pages (where the vectors are) should be left alone as well */ - set_bit(0, mem_available_pages); - set_bit(1, mem_available_pages); - set_bit(2, mem_available_pages); - set_bit(3, mem_available_pages); -} - -#ifdef BOOT_OF_FREE -/* this is here in case we ever need a free call at a later date */ -static void boot_of_free(ulong addr, ulong size) -{ - ulong bits; - ulong pos; - ulong i; - - size = ALIGN_UP(size, PAGE_SIZE); - bits = size >> PAGE_SHIFT; - pos = addr >> PAGE_SHIFT; - - for (i = 0; i < bits; i++) { - if (!test_and_clear_bit(pos + i, mem_available_pages)) - of_panic("%s: pg :0x%lx was never allocated\n", - __func__, pos + i); - } -} -#endif - -static ulong boot_of_alloc(ulong size) -{ - ulong bits; - ulong pos; - - if (size == 0) - return 0; - - DBG("%s(0x%lx)\n", __func__, size); - - size = ALIGN_UP(size, PAGE_SIZE); - bits = size >> PAGE_SHIFT; - pos = 0; - for (;;) { - ulong i; - - pos = find_next_zero_bit(mem_available_pages, - MEM_AVAILABLE_PAGES, pos); - DBG("%s: found start bit at: 0x%lx\n", __func__, pos); - - /* found nothing */ - if ((pos + bits) > MEM_AVAILABLE_PAGES) { - of_printf("%s: allocation of size: 0x%lx failed\n", - __func__, size); - return 0; - } - - /* find a set that fits */ - DBG("%s: checking for 0x%lx bits: 0x%lx\n", __func__, bits, pos); - - i = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, pos); - if (i - pos >= bits) { - uint addr = pos << PAGE_SHIFT; - - /* make sure OF is happy with our choice */ - if (of_claim(addr, size, 0) != OF_FAILURE) { - for (i = 0; i < bits; i++) - set_bit(pos + i, mem_available_pages); - - DBG("%s: 0x%lx is good returning 0x%x\n", - __func__, pos, addr); - return addr; - } - /* if OF did not like the address then simply start from - * the next bit */ - i = 1; - } - - pos = pos + i; - } -} - -int boot_of_mem_avail(int pos, ulong *startpage, ulong *endpage) -{ - ulong freebit; - ulong usedbit; - - if (pos >= MEM_AVAILABLE_PAGES) - /* Stop iterating. */ - return -1; - - /* Find first free page. */ - freebit = find_next_zero_bit(mem_available_pages, MEM_AVAILABLE_PAGES, pos); - if (freebit >= MEM_AVAILABLE_PAGES) { - /* We know everything after MEM_AVAILABLE_PAGES is still free. */ - *startpage = MEM_AVAILABLE_PAGES << PAGE_SHIFT; - *endpage = ~0UL; - return freebit; - } - *startpage = freebit << PAGE_SHIFT; - - /* Now find first used page after that. */ - usedbit = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, freebit); - if (usedbit >= MEM_AVAILABLE_PAGES) { - /* We know everything after MEM_AVAILABLE_PAGES is still free. */ - *endpage = ~0UL; - return usedbit; - } - - *endpage = usedbit << PAGE_SHIFT; - return usedbit; -} - -static ulong boot_of_mem_init(void) -{ - int root; - int p; - int rc; - uint addr_cells; - uint size_cells; - - root = of_finddevice("/"); - p = of_getchild(root); - - /* code is writen to assume sizes of 1 */ - of_getprop(root, "#address-cells", &addr_cells, - sizeof (addr_cells)); - of_getprop(root, "#size-cells", &size_cells, - sizeof (size_cells)); - DBG("%s: address_cells=%d size_cells=%d\n", - __func__, addr_cells, size_cells); - - /* We do ream memory discovery later, for now we only want to find - * the first LMB */ - do { - const char memory[] = "memory"; - char type[32]; - - type[0] = '\0'; - - of_getprop(p, "device_type", type, sizeof (type)); - if (strncmp(type, memory, sizeof (memory)) == 0) { - uint reg[48]; - u64 start; - u64 size; - int r; - int l; - - rc = of_getprop(p, "reg", reg, sizeof (reg)); - if (rc == OF_FAILURE) { - of_panic("no reg property for memory node: 0x%x.\n", p); - } - - l = rc / sizeof(reg[0]); /* number reg element */ - DBG("%s: number of bytes in property 'reg' %d\n", - __func__, rc); - - r = 0; - while (r < l) { - start = reg[r++]; - if (addr_cells == 2 && (r < l) ) - start = (start << 32) | reg[r++]; - - if (r >= l) - break; /* partial line. Skip */ - - if (start > 0) { - /* this is not the first LMB so we skip it */ - break; - } - - size = reg[r++]; - if (size_cells == 2 && (r < l) ) - size = (size << 32) | reg[r++]; - - if (r > l) - break; /* partial line. Skip */ - - boot_of_alloc_init(p, addr_cells, size_cells); - - eomem = size; - return size; - } - } - p = of_getpeer(p); - } while (p != OF_FAILURE && p != 0); - - return 0; -} - -static int save_props(void *m, ofdn_t n, int pkg) -{ - int ret; - char name[128]; - int result = 1; - int found_name = 0; - int found_device_type = 0; - const char name_str[] = "name"; - const char devtype_str[] = "device_type"; - - /* get first */ - result = of_nextprop(pkg, 0, name); - - while (result > 0) { - int sz; - u64 obj[1024]; - - sz = of_getproplen(pkg, name); - if (sz >= 0) { - ret = OF_SUCCESS; - } else { - ret = OF_FAILURE; - } - - if (ret == OF_SUCCESS) { - int actual = 0; - ofdn_t pos; - - if (sz > 0) { - if (sz > sizeof (obj)) { - of_panic("obj array not big enough for 0x%x\n", sz); - } - actual = of_getprop(pkg, name, obj, sz); - if (actual > sz) - of_panic("obj too small"); - } - - if (strncmp(name, name_str, sizeof(name_str)) == 0) { - found_name = 1; - } - - if (strncmp(name, devtype_str, sizeof(devtype_str)) == 0) { - found_device_type = 1; - } - - pos = ofd_prop_add(m, n, name, obj, actual); - if (pos == 0) - of_panic("prop_create"); - } - - result = of_nextprop(pkg, name, name); - } - - return 1; -} - - -static void do_pkg(void *m, ofdn_t n, int p, char *path, size_t psz) -{ - int pnext; - ofdn_t nnext; - int sz; - -retry: - save_props(m, n, p); - - /* do children first */ - pnext = of_getchild(p); - - if (pnext != 0) { - sz = of_package_to_path(pnext, path, psz); - if (sz == OF_FAILURE) - of_panic("bad path\n"); - - nnext = ofd_node_child_create(m, n, path, sz); - if (nnext == 0) - of_panic("out of mem\n"); - - do_pkg(m, nnext, pnext, path, psz); - } - - /* do peer */ - pnext = of_getpeer(p); - - if (pnext != 0) { - sz = of_package_to_path(pnext, path, psz); - - nnext = ofd_node_peer_create(m, n, path, sz); - if (nnext <= 0) - of_panic("out of space in OFD tree.\n"); - - n = nnext; - p = pnext; - goto retry; - } -} - -static long pkg_save(void *mem) -{ - int root; - char path[256]; - int r; - - path[0]='/'; - path[1]='\0'; - - /* get root */ - root = of_getpeer(0); - if (root == OF_FAILURE) - of_panic("no root package\n"); - - do_pkg(mem, OFD_ROOT, root, path, sizeof(path)); - - r = ofd_size(mem); - - of_printf("%s: saved device tree in 0x%x bytes\n", __func__, r); - - return r; -} - -static int boot_of_fixup_refs(void *mem) -{ - static const char *fixup_props[] = { - "interrupt-parent", - }; - int i; - int count = 0; - - for (i = 0; i < ARRAY_SIZE(fixup_props); i++) { - ofdn_t c; - const char *name = fixup_props[i]; - - c = ofd_node_find_by_prop(mem, OFD_ROOT, name, NULL, 0); - while (c > 0) { - const char *path; - int rp; - int ref; - ofdn_t dp; - int rc; - ofdn_t upd; - char ofpath[256]; - - path = ofd_node_path(mem, c); - if (path == NULL) - of_panic("no path to found prop: %s\n", name); - - rp = of_finddevice(path); - if (rp == OF_FAILURE) - of_panic("no real device for: name %s, path %s\n", - name, path); - /* Note: In theory 0 is a valid node handle but it is highly - * unlikely. - */ - if (rp == 0) { - of_panic("%s: of_finddevice returns 0 for path %s\n", - __func__, path); - } - - rc = of_getprop(rp, name, &ref, sizeof(ref)); - if ((rc == OF_FAILURE) || (rc == 0)) - of_panic("no prop: name %s, path %s, device 0x%x\n", - name, path, rp); - - rc = of_package_to_path(ref, ofpath, sizeof (ofpath)); - if (rc == OF_FAILURE) - of_panic("no package: name %s, path %s, device 0x%x,\n" - "ref 0x%x\n", name, path, rp, ref); - - dp = ofd_node_find(mem, ofpath); - if (dp <= 0) - of_panic("no ofd node for OF node[0x%x]: %s\n", - ref, ofpath); - - ref = dp; - - upd = ofd_prop_add(mem, c, name, &ref, sizeof(ref)); - if (upd <= 0) - of_panic("update failed: %s\n", name); - -#ifdef DEBUG - of_printf("%s: %s/%s -> %s\n", __func__, - path, name, ofpath); -#endif - ++count; - c = ofd_node_find_next(mem, c); - } - } - return count; -} - -static int boot_of_fixup_chosen(void *mem) -{ - int ch; - ofdn_t dn; - ofdn_t dc; - int val; - int rc; - char ofpath[256]; - - ch = of_finddevice("/chosen"); - if (ch == OF_FAILURE) - of_panic("/chosen not found\n"); - - rc = of_getprop(ch, "cpu", &val, sizeof (val)); - - if (rc != OF_FAILURE) { - rc = of_instance_to_path(val, ofpath, sizeof (ofpath)); - - if (rc > 0) { - dn = ofd_node_find(mem, ofpath); - if (dn <= 0) - of_panic("no node for: %s\n", ofpath); - - ofd_boot_cpu = dn; - val = dn; - - dn = ofd_node_find(mem, "/chosen"); - if (dn <= 0) - of_panic("no /chosen node\n"); - - dc = ofd_prop_add(mem, dn, "cpu", &val, sizeof (val)); - if (dc <= 0) - of_panic("could not fix /chosen/cpu\n"); - rc = 1; - } else { - of_printf("*** can't find path to booting cpu, " - "SMP is disabled\n"); - ofd_boot_cpu = -1; - } - } - return rc; -} - -/* PIBS Version 1.05.0000 04/26/2005 has an incorrect /ht/isa/ranges - * property. The values are bad, and it doesn't even have the - * right number of cells. */ - -static void __init boot_of_fix_maple(void) -{ - int isa; - const char *ranges = "ranges"; - u32 isa_ranges[3]; - const u32 isa_test[] = { 0x00000001, 0xf4000000, 0x00010000 }; - const u32 isa_fixed[] = { - 0x00000001, - 0x00000000, - 0x00000000, /* 0xf4000000, matt says this */ - 0x00000000, - 0x00000000, - 0x00010000 - }; - - isa = of_finddevice("/ht@0/isa@4"); - if (isa != OF_FAILURE) { - if (of_getproplen(isa, ranges) == sizeof (isa_test)) { - of_getprop(isa, ranges, isa_ranges, sizeof (isa_ranges)); - if (memcmp(isa_ranges, isa_test, sizeof (isa_test)) == 0) { - int rc; - - of_printf("OF: fixing bogus ISA range on maple\n"); - rc = of_setprop(isa, ranges, isa_fixed, sizeof (isa_fixed)); - if (rc == OF_FAILURE) { - of_panic("of_setprop() failed\n"); - } - } - } - } -} - -void __init boot_of_serial(void *oft) -{ - int n; - int p; - int rc; - u32 val[3]; - char buf[128]; - - n = of_instance_to_package(of_out); - if (n == OF_FAILURE) { - of_panic("instance-to-package of /chosen/stdout: failed\n"); - } - - /* Prune all serial devices from the device tree, including the - * one pointed to by /chosen/stdout, because a guest domain can - * initialize them and in so doing corrupt our console output. - */ - for (p = n; p > 0; p = of_getpeer(p)) { - char type[32]; - - rc = of_package_to_path(p, buf, sizeof(buf)); - if (rc == OF_FAILURE) - of_panic("package-to-path failed\n"); - - rc = of_getprop(p, "device_type", type, sizeof (type)); - if (rc == OF_FAILURE) { - of_printf("%s: fetching type of `%s' failed\n", __func__, buf); - continue; - } - - if (strcmp(type, "serial") != 0) - continue; - - of_printf("pruning `%s' from devtree\n", buf); - rc = ofd_prune_path(oft, buf); - if (rc < 0) - of_panic("prune of `%s' failed\n", buf); - } - - p = of_getparent(n); - if (p == OF_FAILURE) { - of_panic("no parent for: 0x%x\n", n); - } - - buf[0] = '\0'; - of_getprop(p, "device_type", buf, sizeof (buf)); - if (strstr(buf, "isa") == NULL) { - of_panic("only ISA UARTS supported\n"); - } - - /* should get this from devtree */ - isa_io_base = 0xf4000000; - of_printf("%s: ISA base: 0x%lx\n", __func__, isa_io_base); - - buf[0] = '\0'; - of_getprop(n, "device_type", buf, sizeof (buf)); - if (strstr(buf, "serial") == NULL) { - of_panic("only UARTS supported\n"); - } - - rc = of_getprop(n, "reg", val, sizeof (val)); - if (rc == OF_FAILURE) { - of_panic("%s: no location for serial port\n", __func__); - } - - ns16550.baud = BAUD_AUTO; - ns16550.data_bits = 8; - ns16550.parity = 'n'; - ns16550.stop_bits = 1; - - rc = of_getprop(n, "interrupts", val, sizeof (val)); - if (rc == OF_FAILURE) { - of_printf("%s: no ISRC, forcing poll mode\n", __func__); - ns16550.irq = 0; - } else { - ns16550.irq = val[0]; - of_printf("%s: ISRC=0x%x, but forcing poll mode\n", - __func__, ns16550.irq); - ns16550.irq = 0; - } -} - -static int __init boot_of_rtas(void) -{ - int rtas_node; - int rtas_instance; - uint size = 0; - int res[2]; - int mem; - int ret; - - rtas_node = of_finddevice("/rtas"); - - if (rtas_node <= 0) { - of_printf("No RTAS, Xen has no power control\n"); - return 0; - } - of_getprop(rtas_node, "rtas-size", &size, sizeof (size)); - if (size == 0) { - of_printf("RTAS, has no size\n"); - return 0; - } - - rtas_instance = of_open("/rtas"); - if (rtas_instance == OF_FAILURE) { - of_printf("RTAS, could not open\n"); - return 0; - } - - size = ALIGN_UP(size, PAGE_SIZE); - - mem = boot_of_alloc(size); - if (mem == 0) - of_panic("Could not allocate RTAS tree\n"); - - of_printf("instantiating RTAS at: 0x%x\n", mem); - - ret = of_call("call-method", 3, 2, res, - "instantiate-rtas", rtas_instance, mem); - if (ret == OF_FAILURE) { - of_printf("RTAS, could not open\n"); - return 0; - } - - rtas_entry = res[1]; - rtas_base = mem; - rtas_end = mem + size; - rtas_msr = of_msr; - - return 1; -} - -void __init *boot_of_devtree(void) -{ - void *oft; - ulong oft_sz = 48 * PAGE_SIZE; - ulong alloc_sz = 32 << 10; /* 32KiB should be plenty */ - ulong sz; - - /* snapshot the tree */ - oft = (void *)boot_of_alloc(alloc_sz); - if (oft == NULL) - of_panic("Could not allocate OFD tree\n"); - - of_printf("creating oftree at: 0x%p\n", oft); - of_test("package-to-path"); - oft = ofd_create(oft, alloc_sz); - pkg_save(oft); - sz = ofd_size(oft); - - if (sz > alloc_sz) - of_panic("Could not fit all of native devtree in 0x%lx of memory\n", - alloc_sz); - - boot_of_fixup_refs(oft); - boot_of_fixup_chosen(oft); - - if (sz > alloc_sz) - of_panic("Could not fit all devtree fixupsin 0x%lx of memory\n", - alloc_sz); - - ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2); - - oftree = (ulong)oft; - oftree = (ulong)oft + oft_sz; - oftree_len = oft_sz; - - return oft; -} - -static int __init boot_of_cpus(void) -{ - int cpus_node, cpu_node; - int bootcpu_instance, bootcpu_node; - int logical; - int result; - s32 cpuid; - u32 cpu_clock[2]; - extern uint cpu_hard_id[NR_CPUS]; - u32 tbf; - - /* Look up which CPU we are running on right now and get all info - * from there */ - result = of_getprop(bof_chosen, "cpu", - &bootcpu_instance, sizeof (bootcpu_instance)); - if (result == OF_FAILURE) - of_panic("Failed to look up boot cpu instance\n"); - - bootcpu_node = of_instance_to_package(bootcpu_instance); - if (result == OF_FAILURE) - of_panic("Failed to look up boot cpu package\n"); - - cpu_node = bootcpu_node; - - result = of_getprop(cpu_node, "timebase-frequency", &tbf, sizeof(tbf)); - timebase_freq = tbf; - if (result == OF_FAILURE) { - of_panic("Couldn't get timebase frequency!\n"); - } - of_printf("OF: timebase-frequency = %ld Hz\n", timebase_freq); - - result = of_getprop(cpu_node, "clock-frequency", - &cpu_clock, sizeof(cpu_clock)); - if (result == OF_FAILURE || (result !=4 && result != 8)) { - of_panic("Couldn't get clock frequency!\n"); - } - cpu_khz = cpu_clock[0]; - if (result == 8) { - cpu_khz <<= 32; - cpu_khz |= cpu_clock[1]; - } - cpu_khz /= 1000; - of_printf("OF: clock-frequency = %ld KHz\n", cpu_khz); - - /* We want a continuous logical cpu number space and we'll make - * the booting CPU logical 0. */ - cpu_set(0, cpu_present_map); - cpu_set(0, cpu_online_map); - cpu_set(0, cpu_possible_map); - - result = of_getprop(cpu_node, "reg", &cpuid, sizeof(cpuid)); - cpu_hard_id[0] = cpuid; - - /* Spin up all CPUS, even if there are more than NR_CPUS or we are - * runnign nosmp, because Open Firmware has them spinning on cache - * lines which will eventually be scrubbed, which could lead to - * random CPU activation. - */ - - /* Find the base of the multi-CPU package node */ - cpus_node = of_finddevice("/cpus"); - if (cpus_node <= 0) { - of_printf("Single Processor System\n"); - return 1; - } - /* Start with the first child */ - cpu_node = of_getchild(cpus_node); - - for (logical = 1; cpu_node > 0; logical++) { - unsigned int ping, pong; - unsigned long now, then, timeout; - - if (cpu_node == bootcpu_node) { - /* same CPU as boot CPU shich we have already made 0 so - * reduce the logical count */ - --logical; - } else { - result = of_getprop(cpu_node, "reg", &cpuid, sizeof(cpuid)); - if (result == OF_FAILURE) - of_panic("cpuid lookup failed\n"); - - cpu_hard_id[logical] = cpuid; - - of_printf("spinning up secondary processor #%d: ", logical); - - __spin_ack = ~0x0; - ping = __spin_ack; - pong = __spin_ack; - of_printf("ping = 0x%x: ", ping); - - mb(); - result = of_start_cpu(cpu_node, (ulong)spin_start, logical); - if (result == OF_FAILURE) - of_panic("start cpu failed\n"); - - /* We will give the secondary processor five seconds to reply. */ - then = mftb(); - timeout = then + (5 * timebase_freq); - - do { - now = mftb(); - if (now >= timeout) { - of_printf("BROKEN: "); - break; - } - - mb(); - pong = __spin_ack; - } while (pong == ping); - of_printf("pong = 0x%x\n", pong); - - if (pong != ping) { - cpu_set(logical, cpu_present_map); - cpu_set(logical, cpu_possible_map); - } - } - cpu_node = of_getpeer(cpu_node); - } - return 1; -} - -void __init boot_of_init(ulong vec, ulong orig_msr) -{ - int r; - - of_vec = vec; - of_msr = orig_msr; - - if (is_kernel(vec)) { - of_panic("Hmm.. OF[0x%lx] seems to have stepped on our image " - "that ranges: %p .. %p.\n", - vec, _start, _end); - } - of_printf("%s: _start %p _end %p\n", __func__, _start, _end); - - bof_chosen = of_finddevice("/chosen"); - of_getprop(bof_chosen, "stdout", &of_out, sizeof (of_out)); - - of_printf("%s\n", "---------------------------------------------------"); - of_printf("OF: Xen/PPC version %d.%d%s (%s@%s) (%s) %s\n", - xen_major_version(), xen_minor_version(), xen_extra_version(), - xen_compile_by(), xen_compile_domain(), - xen_compiler(), xen_compile_date()); - - boot_of_fix_maple(); - r = boot_of_mem_init(); - if (r == 0) - of_panic("failure to initialize memory allocator"); - - boot_of_rtas(); - boot_of_cpus(); -} - -void __init boot_of_finish(void) -{ - /* end of OF */ - of_printf("Quiescing Open Firmware ...\n"); - of_call("quiesce", 0, 0, NULL); -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/cmdline.c --- a/xen/arch/powerpc/cmdline.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2006 - * - * Authors: Hollis Blanchard - */ - -#include - -char builtin_cmdline[CONFIG_CMDLINE_SIZE] - __attribute__((section("__builtin_cmdline"))) = CMDLINE; diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/crash.c --- a/xen/arch/powerpc/crash.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -#include /* for printk() used in stub */ -#include -#include -#include - -void machine_crash_shutdown(void) -{ - printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__); -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ - diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/dart.c --- a/xen/arch/powerpc/dart.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#include -#include -#include -#include -#include -#include "tce.h" -#include "iommu.h" -#include "dart.h" -#include "oftree.h" -#include "of-devtree.h" - -#undef DEBUG -#ifdef DEBUG -#define DBG(fmt...) printk(fmt) -static int dbg_after; -#define DBG_SET_AFTER dbg_after = 1; -#define DBG_AFTER(fmt...) if (dbg_after) DBG(fmt) -#else -#define DBG(fmt...) -#define DBG_SET_AFTER -#define DBG_AFTER(fmt...) -#endif - -/* Max size of 512 pages */ -#define U3_LOG_MAX_PAGES 9 - -#define DART_DEF_BASE 0xf8033000UL -#define DART_NONE 0 -#define DART_U3 3 -#define DART_U4 4 -#define DART_WRITE 0x1 -#define DART_READ 0x2 - -static ulong dummy_page; -static ulong dart_entries; -static struct dart_ops *dops; -static u32 *dart_table; - -union dart_entry { - u32 de_word; - struct { - u32 de_v:1; /* valid */ - u32 de_rp:1; /* read protected */ - u32 de_wp:1; /* write protected */ - u32 _de_res:5; - u32 de_ppn:24; /* 24 bit Physical Page Number - * representing address [28:51] */ - } de_bits; -}; - -struct dma_window { - u32 dw_liobn; - u32 dw_base_hi; - u64 dw_base; - u64 dw_size; -}; - -struct dart_info { - struct dma_window di_window; - ulong di_base; - int di_model; -}; - -static u32 dart_encode(int perm, ulong rpn) -{ - union dart_entry e; - - e.de_word = 0; - e.de_bits.de_v = 1; - e.de_bits.de_ppn = rpn; - - /* protect the page */ - e.de_bits.de_rp = 1; - e.de_bits.de_wp = 1; - if (perm & DART_READ) { - e.de_bits.de_rp = 0; - } - if (perm & DART_WRITE) { - e.de_bits.de_wp = 0; - } - return e.de_word; -} - -static void dart_fill(ulong index, int perm, ulong rpg, ulong num_pg) -{ - u32 volatile *entry = dart_table + index; - ulong i = 0; - ulong last_flush = 0; - - while (1) { - entry[i] = dart_encode(perm, rpg); - ++i; - ++rpg; - if (i == num_pg) break; - - if ((((ulong)&entry[i]) % cpu_caches.dline_size) == 0) { - last_flush = (ulong)&entry[i - 1]; - dcbst(last_flush); - } - } - dcbst((ulong) &entry[i - 1]); -} - -static void dart_clear(ulong index, ulong num_pg) -{ - u32 *entry = dart_table + index; - ulong i = 0; - ulong rpg = dummy_page; - ulong last_flush = 0; - - while (1) { - entry[i] = dart_encode(DART_READ | DART_WRITE, rpg); - ++i; - if (i == num_pg) break; - - if ((((ulong)&entry[i]) % cpu_caches.dline_size) == 0) { - last_flush = (ulong)&entry[i - 1]; - dcbst(last_flush); - } - } - dcbst((ulong)&entry[i - 1]); -} - -static int dart_put(ulong ioba, union tce tce) -{ - ulong index = ioba >> PAGE_SHIFT; - - if (index > dart_entries) { - return -1; - } - - if (tce.tce_bits.tce_vlps != 0 || tce.tce_bits.tce_lpx != 0) { - panic("no support for large TCEs\n"); - } - - if (tce.tce_bits.tce_read == 0 && - tce.tce_bits.tce_write == 0) { - /* the TCE table is inited by the domain by a bunch of 0 - * perminssion puts. We are only interesting in debugging the - * ones after the first put */ - DBG_AFTER(">DART[0x%lx] clear\n", index); - dart_clear(index, 1); - } else { - unsigned perm = 0; - - if (tce.tce_bits.tce_read) - perm |= DART_READ; - if (tce.tce_bits.tce_write) - perm |= DART_WRITE; - - DBG("do_inv_entry(tce.tce_bits.tce_rpn); - - return 0; -} - -static int find_dart(struct dart_info *di) -{ - int rc; - void *ofd_p; - ofdn_t n; - char compat[128]; - - if (on_systemsim()) { - DBG("%s: systemsim does not support a dart\n", __func__); - return -1; - } - - ofd_p = (void *)oftree; - n = ofd_node_find(ofd_p, "/ht"); - if (n <= 0) - return -1; - - /* get the defaults from the HT node model */ - rc = ofd_getprop(ofd_p, n, "compatible", compat, sizeof (compat)); - if (rc <= 0) - return -1; - - if (ofd_strstr(compat, rc, "u4")) - di->di_model = DART_U4; - else if (ofd_strstr(compat, rc, "u3")) - di->di_model = DART_U3; - else { - DBG("%s: not a U3 or U4\n", __func__); - return -1; - } - - di->di_base = DART_DEF_BASE; - - /* FIXME: this should actually be the HT reg value */ - di->di_window.dw_liobn = 0; - di->di_window.dw_base_hi = 0; - di->di_window.dw_base = 0; - - /* lets see if the devtree has more info */ - n = ofd_node_find(ofd_p, "/dart"); - if (n > 0) { - ulong base; - - rc = ofd_getprop(ofd_p, n, "compatible", compat, sizeof (compat)); - if (rc > 0) { - if (strstr(compat, "u4")) { - di->di_model = DART_U4; - } - } - - rc = ofd_getprop(ofd_p, n, "reg", &base, sizeof (base)); - if (rc > 0) { - di->di_base = base; - } - } - return 0; -} - -static int init_dart(void) -{ - ulong log_pgs; - void *ofd_p; - ofdn_t n; - struct dart_info di; - - if (find_dart(&di)) - return 0; - - /* Max size of 512 pages == 2MB == 1<<21. That siz is good enough for U4 */ - log_pgs = U3_LOG_MAX_PAGES; - dart_table = alloc_xenheap_pages(log_pgs); - BUG_ON(dart_table == NULL); - - dart_entries = (1UL << (log_pgs + PAGE_SHIFT)) / sizeof (union dart_entry); - di.di_window.dw_size = dart_entries << PAGE_SHIFT; - - /* Linux uses a dummy page, filling "empty" DART entries with a - reference to this page to capture stray DMA's */ - dummy_page = (ulong)alloc_xenheap_pages(0); - clear_page((void *)dummy_page); - dummy_page >>= PAGE_SHIFT; - - printk("Initializing DART 0x%lx: tbl: %p[0x%lx] entries: 0x%lx\n", - di.di_base, dart_table, 1UL << log_pgs, dart_entries); - - /* register this iommu */ - iommu_register(di.di_window.dw_liobn, dart_put); - - switch (di.di_model) { - case DART_U3: - dops = u3_init(di.di_base, (ulong)dart_table, 1UL << log_pgs); - break; - case DART_U4: - dops = u4_init(di.di_base, (ulong)dart_table, 1UL << log_pgs); - break; - } - - dart_clear(0, dart_entries); - dops->do_inv_all(); - - /* fix up the devtree */ - ofd_p = (void *)oftree; - n = ofd_node_find(ofd_p, "/ht"); - if (n > 0) { - di.di_window.dw_size = dart_entries << PAGE_SHIFT; - ofd_prop_add(ofd_p, n, "ibm,dma-window", &di.di_window, - sizeof (di.di_window)); - } else { - panic("%s: no /ht node\n", __func__); - } - return 0; -} -__initcall(init_dart); diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/dart.h --- a/xen/arch/powerpc/dart.h Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#ifndef _DART_H -#define _DART_H - -#include -#include - -struct dart_ops { - void (*do_inv_all)(void); - void (*do_inv_entry)(ulong pg); -}; - -extern struct dart_ops *u3_init(ulong base, ulong table, ulong dart_pages); -extern struct dart_ops *u4_init(ulong base, ulong table, ulong dart_pages); - -#endif /* _DART_H */ - diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/dart_u3.c --- a/xen/arch/powerpc/dart_u3.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#undef DEBUG - -#include -#include -#include -#include -#include -#include -#include -#include "tce.h" -#include "iommu.h" -#include "dart.h" - -union dart_ctl { - u32 dc_word; - struct { - u32 dc_base:20; - u32 dc_stop_access:1; - u32 dc_invtlb:1; - u32 dc_enable:1; - u32 dc_size:9; - } reg; -}; - -static u32 volatile *dart_ctl_reg; - -static void u3_inv_all(void) -{ - union dart_ctl dc; - ulong r = 0; - int l = 0; - - for (;;) { - dc.dc_word = in_32(dart_ctl_reg); - dc.reg.dc_invtlb = 1; - out_32(dart_ctl_reg, dc.dc_word); - - do { - dc.dc_word = in_32(dart_ctl_reg); - r++; - } while ((dc.reg.dc_invtlb == 1) && (r < (1 << l))); - - if (r == (1 << l)) { - if (l < 4) { - l++; - dc.dc_word = in_32(dart_ctl_reg); - dc.reg.dc_invtlb = 0; - out_32(dart_ctl_reg, dc.dc_word); - continue; - } else { - panic(" broken U3???\n"); - } - } - return; - } -} - -static void u3_inv_entry(ulong pg) -{ - /* sadly single entry invalidation has been reported not to work */ - u3_inv_all(); -} - -static struct dart_ops u3_ops = { - .do_inv_all = u3_inv_all, - .do_inv_entry = u3_inv_entry, -}; - -struct dart_ops *u3_init(ulong base, ulong table, ulong dart_pages) -{ - union dart_ctl dc; - - dart_ctl_reg = (u32 *)base; - - dc.dc_word = 0; - - dc.reg.dc_base = table >> PAGE_SHIFT; - dc.reg.dc_size = dart_pages; - dc.reg.dc_enable = 1; - - - printk("Initializing DART Model U3: reg: %p word: %x\n", - dart_ctl_reg, dc.dc_word); - - out_32(dart_ctl_reg, dc.dc_word); - - return &u3_ops; -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/dart_u4.c --- a/xen/arch/powerpc/dart_u4.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#undef DEBUG -#define INVALIDATE_ALL - -#include -#include -#include -#include -#include -#include -#include -#include -#include "tce.h" -#include "iommu.h" -#include "dart.h" - -#define TOO_MANY_RETRIES ~0 - -union dart_ctl { - u32 dc_word; - struct { - u32 dc_darten:1; /* DART Enable (0:disabled) */ - u32 dc_ione:1; /* Invalidate one DART TLB entry (using ILPN) */ - u32 dc_iall:1; /* Invalidate all DART TLB entries */ - u32 dc_idle:1; /* DART is idle */ - u32 dc_peen:1; /* Parity Checking is enabled */ - u32 dc_ilpn:27; /* 27-bit Logical Page Address for - * invalidating one TLB entry */ - } dc_bits; -}; - -union dart_base { - u32 db_word; - struct { - u32 _db_resv:8; - u32 db_dartbase:24; /* Base Address of DART (4K byte Alignment) */ - } db_bits; -}; - -union dart_size { - u32 ds_word; - struct { - u32 _ds_resv:15; - u32 ds_dartsize:17; /* Size of Dart in 4K-Byte Pages */ - } ds_bits; -}; - -union dart_excp { - u32 de_word; - struct { - u32 de_rqsrc:1; /* Request Source. [0:PCIE, 1:HT] */ - u32 de_lpn:27; /* 27Ðbit Logical Address of Exception [25:51] */ - u32 de_rqop:1; /* Request operation. [0:Read, 1:Write] */ - u32 de_xcd:3; /* Exception code */ - } de_bits; -}; - -struct dart { - /* 0x00 */ - union dart_ctl d_dartcntl; - u32 _pad0x04_0x10[3]; - /* 0x10 */ - union dart_base d_dartbase; - u32 _pad0x14_0x20[3]; - /* 0x20 */ - union dart_size d_dartsize; - u32 _pad0x24_0x30[3]; - /* 0x30 */ - union dart_excp d_dartexcp; - u32 _pad0x34_0x40[3]; -}; - -static volatile struct dart *dart; - -static void u4_inv_all(void) -{ - union dart_ctl dc; - ulong r = 0; - int l = 0; - - for (;;) { - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - dc.dc_bits.dc_iall = 1; - out_32(&dart->d_dartcntl.dc_word, dc.dc_word); - - do { - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - r++; - } while ((dc.dc_bits.dc_iall == 1) && (r < (1 << l))); - - if (r == (1 << l)) { - if (l < 4) { - l++; - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - dc.dc_bits.dc_iall = 0; - out_32(&dart->d_dartcntl.dc_word, dc.dc_word); - continue; - } else { - panic(" broken U4???\n"); - } - } - return; - } -} - -static void u4_inv_entry(ulong pgn) -{ -#ifdef INVALIDATE_ALL - return u4_inv_all(); -#else - union dart_ctl dc; - ulong retries = 0; - - return u4_inv_all(); - - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - dc.dc_bits.dc_ilpn = pgn; - dc.dc_bits.dc_ione = 1; - out_32(&dart->d_dartcntl.dc_word, dc.dc_word); - - /* wait for completion */ - /* FIXME: since we do this from the HV do we need to wait?! */ - do { - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - retries++; - if (retries > 1000000) - panic("WAY! too long\n"); - } while (dc.dc_bits.dc_ione != 0); -#endif -} - -static struct dart_ops u4_ops = { - .do_inv_all = u4_inv_all, - .do_inv_entry = u4_inv_entry, -}; - -struct dart_ops *u4_init(ulong base, ulong table, ulong dart_pages) -{ - union dart_base db; - union dart_size ds; - union dart_ctl dc; - - dart = (struct dart *)base; - - db.db_word = 0; - db.db_bits.db_dartbase = table >> PAGE_SHIFT; - - ds.ds_word = 0; - ds.ds_bits.ds_dartsize = dart_pages; - - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - if (dc.dc_bits.dc_darten == 1) { - panic("%s: dart is already enabled: 0x%x\n", __func__, dc.dc_word); - } - dc.dc_bits.dc_darten = 1; /* enable it */ - - printk("Initializing DART Model U4: ctl: 0x%x base: 0x%x size: 0x%x\n", - dc.dc_word, db.db_word, ds.ds_word); - - out_32(&dart->d_dartbase.db_word, db.db_word); - out_32(&dart->d_dartsize.ds_word, ds.ds_word); - out_32(&dart->d_dartcntl.dc_word, dc.dc_word); - - return &u4_ops; -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/domain.c --- a/xen/arch/powerpc/domain.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,357 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2006, 2007 - * - * Authors: Jimi Xenidis - * Ryan Harper - * Hollis Blanchard - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rtas.h" -#include "exceptions.h" - -#define next_arg(fmt, args) ({ \ - unsigned long __arg; \ - switch ( *(fmt)++ ) \ - { \ - case 'i': __arg = (unsigned long)va_arg(args, unsigned int); break; \ - case 'l': __arg = (unsigned long)va_arg(args, unsigned long); break; \ - case 'p': __arg = (unsigned long)va_arg(args, void *); break; \ - case 'h': __arg = (unsigned long)va_arg(args, void *); break; \ - default: __arg = 0; BUG(); \ - } \ - __arg; \ -}) - -unsigned long hypercall_create_continuation(unsigned int op, - const char *format, ...) -{ - struct cpu_user_regs *regs = guest_cpu_user_regs(); - const char *p = format; - va_list args; - int gprnum = 4; - int i; - - va_start(args, format); - - regs->pc -= 4; /* re-execute 'sc' */ - - for (i = 0; *p != '\0'; i++) { - regs->gprs[gprnum++] = next_arg(p, args); - } - - va_end(args); - - /* As luck would have it, we use the same register for hcall opcodes and - * for hcall return values. The return value from this function is placed - * in r3 on return, so modifying regs->gprs[3] would have no effect. */ - return XEN_MARK(op); -} - -int arch_domain_create(struct domain *d, unsigned int domcr_flags) -{ - if (d->domain_id == IDLE_DOMAIN_ID) { - d->shared_info = (void *)alloc_xenheap_page(); - clear_page(d->shared_info); - - return 0; - } - - d->arch.large_page_sizes = cpu_large_page_orders( - d->arch.large_page_order, ARRAY_SIZE(d->arch.large_page_order)); - - d->arch.foreign_mfn_count = 2048; - d->arch.foreign_mfns = xmalloc_array(uint, d->arch.foreign_mfn_count); - BUG_ON(d->arch.foreign_mfns == NULL); - - memset(d->arch.foreign_mfns, -1, d->arch.foreign_mfn_count * sizeof(uint)); - - return 0; -} - -void arch_domain_destroy(struct domain *d) -{ - shadow_teardown(d); - /* shared_info is part of the RMA so no need to release it */ -} - -static void machine_fail(const char *s) -{ - printk("%s failed, manual powercycle required!\n" - " spinning....\n", s); - for (;;) - sleep(); -} -void machine_halt(void) -{ - console_start_sync(); - printk("%s called\n", __func__); - rtas_halt(); - - machine_fail(__func__); -} - -void machine_restart(void) -{ - console_start_sync(); - printk("%s called\n", __func__); - rtas_reboot(); - machine_fail(__func__); -} - -struct vcpu *alloc_vcpu_struct(void) -{ - struct vcpu *v; - if ( (v = xmalloc(struct vcpu)) != NULL ) - memset(v, 0, sizeof(*v)); - return v; -} - -void free_vcpu_struct(struct vcpu *v) -{ - xfree(v); -} - -int vcpu_initialise(struct vcpu *v) -{ - /* Guests by default have a 100Hz ticker. */ - v->periodic_period = MILLISECS(10); - return 0; -} - -void vcpu_destroy(struct vcpu *v) -{ -} - -int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_u c) -{ - struct domain *d = v->domain; - - memcpy(&v->arch.ctxt, &c.nat->user_regs, sizeof(c.nat->user_regs)); - - printk("Domain[%d].%d: initializing\n", d->domain_id, v->vcpu_id); - - if (d->arch.htab.order == 0) - panic("Page table never allocated for Domain: %d\n", d->domain_id); - if (d->arch.rma_order == 0) - panic("RMA never allocated for Domain: %d\n", d->domain_id); - - d->shared_info->wc_sec = dom0->shared_info->wc_sec; - d->shared_info->wc_nsec = dom0->shared_info->wc_nsec; - d->shared_info->arch.boot_timebase = dom0->shared_info->arch.boot_timebase; - - if ( !v->is_initialised ) - { - v->is_initialised = 1; - /* Auto-online VCPU0 when it is initialised. */ - if ( v->vcpu_id == 0 ) - clear_bit(_VPF_down, &v->pause_flags); - } - - cpu_init_vcpu(v); - - return 0; -} - -int arch_vcpu_reset(struct vcpu *v) -{ - panic("%s: called for Dom%d[%d]\n", - __func__, v->domain->domain_id, v->vcpu_id); - return 0; -} - -void dump_pageframe_info(struct domain *d) -{ - struct page_info *page; - - printk("Memory pages belonging to domain %u:\n", d->domain_id); - - if ( d->tot_pages >= 10 ) - { - printk(" DomPage list too long to display\n"); - } - else - { - list_for_each_entry ( page, &d->page_list, list ) - { - printk(" DomPage %p: mfn=%p, caf=%016lx, taf=%" PRtype_info "\n", - _p(page_to_maddr(page)), _p(page_to_mfn(page)), - page->count_info, page->u.inuse.type_info); - } - } - - list_for_each_entry ( page, &d->xenpage_list, list ) - { - printk(" XenPage %p: mfn=%p, caf=%016lx, taf=%" PRtype_info "\n", - _p(page_to_maddr(page)), _p(page_to_mfn(page)), - page->count_info, page->u.inuse.type_info); - } -} - -void context_switch(struct vcpu *prev, struct vcpu *next) -{ - struct cpu_user_regs *stack_regs = guest_cpu_user_regs(); - cpumask_t dirty_mask = next->vcpu_dirty_cpumask; - unsigned int cpu = smp_processor_id(); - -#if 0 - printk("%s: dom %x to dom %x\n", __func__, prev->domain->domain_id, - next->domain->domain_id); -#endif - - /* Allow at most one CPU at a time to be dirty. */ - ASSERT(cpus_weight(dirty_mask) <= 1); - if (unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask))) - { - /* Other cpus call __sync_lazy_execstate from flush ipi handler. */ - if (!cpus_empty(next->vcpu_dirty_cpumask)) - flush_tlb_mask(next->vcpu_dirty_cpumask); - } - - /* copy prev guest state off the stack into its vcpu */ - memcpy(&prev->arch.ctxt, stack_regs, sizeof(struct cpu_user_regs)); - - set_current(next); - - /* copy next guest state onto the stack */ - memcpy(stack_regs, &next->arch.ctxt, sizeof(struct cpu_user_regs)); - - /* save old domain state */ - save_sprs(prev); - save_float(prev); - save_segments(prev); - - context_saved(prev); - - /* load up new domain */ - load_sprs(next); - load_float(next); - load_segments(next); - - mtsdr1(next->domain->arch.htab.sdr1); - local_flush_tlb(); /* XXX maybe flush_tlb_mask? */ - cpu_flush_icache(); - - if (is_idle_vcpu(next)) { - reset_stack_and_jump(idle_loop); - } - - reset_stack_and_jump(full_resume); - /* not reached */ -} - -void continue_running(struct vcpu *same) -{ - /* nothing to do */ - return; -} - -void sync_vcpu_execstate(struct vcpu *v) -{ - /* do nothing */ - return; -} - -static void relinquish_memory(struct domain *d, struct list_head *list) -{ - struct list_head *ent; - struct page_info *page; - - /* Use a recursive lock, as we may enter 'free_domheap_page'. */ - spin_lock_recursive(&d->page_alloc_lock); - - ent = list->next; - while ( ent != list ) - { - page = list_entry(ent, struct page_info, list); - - /* Grab a reference to the page so it won't disappear from under us. */ - if ( unlikely(!get_page(page, d)) ) - { - /* Couldn't get a reference -- someone is freeing this page. */ - ent = ent->next; - continue; - } - if ( test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) ) - put_page_and_type(page); - - if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) - put_page(page); - - /* Follow the list chain and /then/ potentially free the page. */ - ent = ent->next; - put_page(page); - } - spin_unlock_recursive(&d->page_alloc_lock); -} - -int domain_relinquish_resources(struct domain *d) -{ - relinquish_memory(d, &d->xenpage_list); - relinquish_memory(d, &d->page_list); - xfree(d->arch.foreign_mfns); - xfree(d->arch.p2m); - return 0; -} - -void arch_dump_domain_info(struct domain *d) -{ -} - -void arch_dump_vcpu_info(struct vcpu *v) -{ -} - -static void safe_halt(void) -{ - int cpu = smp_processor_id(); - - while (!softirq_pending(cpu)) - sleep(); -} - -static void default_idle(void) -{ - local_irq_disable(); - if ( !softirq_pending(smp_processor_id()) ) - safe_halt(); - else - local_irq_enable(); -} - -void idle_loop(void) -{ - for ( ; ; ) { - page_scrub_schedule_work(); - default_idle(); - do_softirq(); - } -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2007 - * - * Authors: Jimi Xenidis - * Ryan Harper - * Hollis Blanchard - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "oftree.h" - -/* opt_dom0_mem: memory allocated to domain 0. */ -static unsigned int dom0_nrpages; -static void parse_dom0_mem(char *s) -{ - unsigned long long bytes; - - bytes = parse_size_and_unit(s, NULL); - dom0_nrpages = bytes >> PAGE_SHIFT; -} -custom_param("dom0_mem", parse_dom0_mem); - -static unsigned int opt_dom0_max_vcpus; -integer_param("dom0_max_vcpus", opt_dom0_max_vcpus); - -static unsigned int opt_dom0_shadow; -boolean_param("dom0_shadow", opt_dom0_shadow); - -/* adapted from common/elf.c */ -#define RM_MASK(a,l) ((a) & ((1UL << (l)) - 1)) - -int construct_dom0(struct domain *d, - unsigned long image_start, unsigned long image_len, - unsigned long initrd_start, unsigned long initrd_len, - char *cmdline) -{ - struct elf_binary elf; - struct elf_dom_parms parms; - int rc; - struct vcpu *v; - ulong dst; - u64 *ofh_tree; - ulong firmware_base; - uint rma_nrpages = 1 << cpu_default_rma_order_pages(); - ulong rma_sz; - ulong rma; - ulong eomem; - int preempt = 0; - int vcpu; - ulong mod_start = 0; - ulong mod_len = 0; - ulong shared_info_addr; - uint extent_size = 1 << cpu_extent_order(); - ulong sz; - - /* Sanity! */ - BUG_ON(d->domain_id != 0); - - if (image_len == 0) - panic("No Dom0 image supplied\n"); - - printk("*** LOADING DOMAIN 0 ***\n"); - - /* default is the max(1/16th of memory, CONFIG_MIN_DOM0_PAGES) */ - if (dom0_nrpages == 0) { - dom0_nrpages = total_pages >> 4; - - if (dom0_nrpages < CONFIG_MIN_DOM0_PAGES) - dom0_nrpages = CONFIG_MIN_DOM0_PAGES; - } - - /* Dom0 has to be at least RMA size. */ - if (dom0_nrpages < rma_nrpages) { - dom0_nrpages = rma_nrpages; - printk("Increasing DOM0 memory size to %u MiB for RMA.\n", - ((rma_nrpages << PAGE_SHIFT) >> 20)); - } - - /* Ensure Dom0 is cpu_extent_order aligned. Round up if - not and let user know we did so. */ - if (dom0_nrpages != ALIGN_UP(dom0_nrpages, extent_size)) { - dom0_nrpages = ALIGN_UP(dom0_nrpages, extent_size); - printk("Increasing DOM0 memory size to %u MiB for large pages.\n", - ((dom0_nrpages << PAGE_SHIFT) >> 20)); - } - - /* XXX Dom0 currently can't extend past the IO hole. */ - if (dom0_nrpages > (platform_iohole_base() >> PAGE_SHIFT)) { - dom0_nrpages = (platform_iohole_base() >> PAGE_SHIFT); - printk("Limiting DOM0 memory size to %u MiB to avoid IO hole.\n", - ((dom0_nrpages << PAGE_SHIFT) >> 20)); - } - - /* Set Dom0 max mem, triggering p2m table creation. */ - if ((guest_physmap_max_mem_pages(d, dom0_nrpages)) != 0) - panic("Failed to set DOM0 max mem pages value\n"); - - d->max_pages = dom0_nrpages; - if (0 > allocate_rma(d, cpu_default_rma_order_pages())) - panic("Error allocating domain 0 RMA\n"); - - rma_sz = rma_size(d->arch.rma_order); - rma = page_to_maddr(d->arch.rma_page); - - /* If we are bigger than RMA, allocate extents. */ - if (dom0_nrpages > rma_nrpages) - dom0_nrpages = allocate_extents(d, dom0_nrpages, rma_nrpages); - - ASSERT(d->tot_pages == dom0_nrpages); - ASSERT(d->tot_pages >= rma_nrpages); - - if (opt_dom0_shadow == 0) { - /* 1/64 of memory */ - opt_dom0_shadow = (d->tot_pages >> 6) >> (20 - PAGE_SHIFT); - } - - do { - shadow_set_allocation(d, opt_dom0_shadow, &preempt); - } while (preempt); - if (shadow_get_allocation(d) == 0) - panic("shadow allocation failed: %dMib\n", opt_dom0_shadow); - - ASSERT( image_len < rma_sz ); - - eomem = ((ulong)d->shared_info) - rma; - printk("shared_info: 0x%lx,%p\n", eomem, d->shared_info); - - /* startup secondary processors */ - if ( opt_dom0_max_vcpus == 0 ) - opt_dom0_max_vcpus = num_online_cpus(); - if ( opt_dom0_max_vcpus > num_online_cpus() ) - opt_dom0_max_vcpus = num_online_cpus(); - if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS ) - opt_dom0_max_vcpus = MAX_VIRT_CPUS; -#ifdef BITS_PER_GUEST_LONG - if ( opt_dom0_max_vcpus > BITS_PER_GUEST_LONG(d) ) - opt_dom0_max_vcpus = BITS_PER_GUEST_LONG(d); -#endif - printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus); - - for (vcpu = 0; vcpu < opt_dom0_max_vcpus; vcpu++) { - if (NULL == alloc_vcpu(dom0, vcpu, vcpu)) - panic("Error creating domain 0 vcpu %d\n", vcpu); - /* for now we pin Dom0 VCPUs to their coresponding CPUs */ - if (cpu_isset(vcpu, cpu_online_map)) - dom0->vcpu[vcpu]->cpu_affinity = cpumask_of_cpu(vcpu); - } - - /* Init VCPU0. */ - v = d->vcpu[0]; - cpu_init_vcpu(v); - - /* convert xen pointer shared_info into guest physical */ - shared_info_addr = (ulong)d->shared_info - page_to_maddr(d->arch.rma_page); - - /* start loading stuff */ - rc = elf_init(&elf, (void *)image_start, image_len); - if (rc) - return rc; -#ifdef VERBOSE - elf_set_verbose(&elf); -#endif - elf_parse_binary(&elf); - if (0 != (elf_xen_parse(&elf, &parms))) - return rc; - - printk("Dom0 kernel: %s, paddr 0x%" PRIx64 " -> 0x%" PRIx64 "\n", - elf_64bit(&elf) ? "64-bit" : "32-bit", - elf.pstart, elf.pend); - - /* elf contains virtual addresses that can have the upper bits - * masked while running in real mode, so we do the masking as well - * as well */ - parms.virt_kend = RM_MASK(parms.virt_kend, 42); - parms.virt_entry = RM_MASK(parms.virt_entry, 42); - - /* set the MSR bit correctly */ - if (elf_64bit(&elf)) - v->arch.ctxt.msr = MSR_SF; - else - v->arch.ctxt.msr = 0; - - /* Load the dom0 kernel. */ - elf.dest = (void *)(parms.virt_kstart + rma); - - elf_load_binary(&elf); - v->arch.ctxt.pc = parms.virt_entry; - - dst = ALIGN_UP(parms.virt_kend + rma, PAGE_SIZE); - - /* Load the initrd. */ - if (initrd_len > 0) { - ASSERT((dst - rma) + image_len < eomem); - - printk("loading initrd: 0x%lx, 0x%lx\n", dst, initrd_len); - memcpy((void *)dst, (void *)initrd_start, initrd_len); - - mod_start = dst - rma; - mod_len = image_len; - - dst = ALIGN_UP(dst + initrd_len, PAGE_SIZE); - } else { - printk("no initrd\n"); - } - - v->arch.ctxt.gprs[3] = mod_start; - v->arch.ctxt.gprs[4] = mod_len; - - /* OF usually sits here: - * - Linux needs it to be loaded before the vmlinux or initrd - * - AIX demands it to be @ 32M. - */ - firmware_base = (32 << 20); - if (dst - rma > firmware_base) - panic("Firmware [0x%lx] will over-write images ending: 0x%lx\n", - firmware_base, dst - rma); - dst = firmware_base + rma; - - /* Put stack below firmware. */ - v->arch.ctxt.gprs[1] = dst - rma - STACK_FRAME_OVERHEAD; - v->arch.ctxt.gprs[2] = 0; - - ASSERT((dst - rma) + (ulong)firmware_image_size < eomem); - printk("loading OFH: 0x%lx, RMA: 0x%lx\n", dst, dst - rma); - memcpy((void *)dst, firmware_image_start, (ulong)firmware_image_size); - - v->arch.ctxt.gprs[5] = (dst - rma); - ofh_tree = (u64 *)(dst + 0x10); - ASSERT(*ofh_tree == 0xdeadbeef00000000); - - /* accomodate for a modest bss section */ - dst = ALIGN_UP(dst + (ulong)firmware_image_size + PAGE_SIZE, PAGE_SIZE); - - ASSERT((dst - rma) + oftree_len < eomem); - - *ofh_tree = dst - rma; - printk("loading OFD: 0x%lx RMA: 0x%lx, 0x%lx\n", dst, dst - rma, - oftree_len); - memcpy((void *)dst, (void *)oftree, oftree_len); - - /* fixup and add stuff for dom0 */ - sz = ofd_dom0_fixup(d, *ofh_tree + rma, cmdline, shared_info_addr); - printk("modified OFD size: 0x%lx\n", sz); - dst = ALIGN_UP(dst + sz + PAGE_SIZE, PAGE_SIZE); - - printk("dom0 initial register state:\n" - " pc %016lx msr %016lx\n" - " r1 %016lx r2 %016lx r3 %016lx\n" - " r4 %016lx r5 %016lx\n", - v->arch.ctxt.pc, - v->arch.ctxt.msr, - v->arch.ctxt.gprs[1], - v->arch.ctxt.gprs[2], - v->arch.ctxt.gprs[3], - v->arch.ctxt.gprs[4], - v->arch.ctxt.gprs[5]); - - v->is_initialised = 1; - clear_bit(_VPF_down, &v->pause_flags); - - rc = 0; - - /* DOM0 is permitted full I/O capabilities. */ - rc |= iomem_permit_access(dom0, 0UL, ~0UL); - rc |= irqs_permit_access(dom0, 0, NR_IRQS-1); - - BUG_ON(rc != 0); - - return 0; -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/domctl.c --- a/xen/arch/powerpc/domctl.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2007 - * - * Authors: Jimi Xenidis - * Ryan Harper - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c) -{ - memcpy(&c.nat->user_regs, &v->arch.ctxt, sizeof(struct cpu_user_regs)); - /* XXX fill in rest of vcpu_guest_context_t */ -} - -long arch_do_domctl(struct xen_domctl *domctl, - XEN_GUEST_HANDLE(xen_domctl_t) u_domctl); -long arch_do_domctl(struct xen_domctl *domctl, - XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) -{ - long ret = 0; - - switch (domctl->cmd) { - case XEN_DOMCTL_getmemlist: - { - int i; - struct domain *d = get_domain_by_id(domctl->domain); - unsigned long max_pfns = domctl->u.getmemlist.max_pfns; - uint64_t mfn; - - ret = -EINVAL; - if ( d != NULL ) - { - ret = 0; - - spin_lock(&d->page_alloc_lock); - for (i = 0; i < max_pfns; i++) { - /* bail if index is beyond p2m size */ - if (i >= d->arch.p2m_entries) - break; - - /* translate */ - mfn = d->arch.p2m[i]; - - if (copy_to_guest_offset(domctl->u.getmemlist.buffer, - i, &mfn, 1)) - { - ret = -EFAULT; - break; - } - } - spin_unlock(&d->page_alloc_lock); - - domctl->u.getmemlist.num_pfns = i; - copy_to_guest(u_domctl, domctl, 1); - - put_domain(d); - } - } - break; - case XEN_DOMCTL_shadow_op: - { - struct domain *d; - ret = -ESRCH; - d = get_domain_by_id(domctl->domain); - if ( d != NULL ) - { - ret = shadow_domctl(d, &domctl->u.shadow_op, u_domctl); - put_domain(d); - copy_to_guest(u_domctl, domctl, 1); - } - } - break; - case XEN_DOMCTL_real_mode_area: - { - struct domain *d; - unsigned int order = domctl->u.real_mode_area.log - PAGE_SHIFT; - - ret = -ESRCH; - d = get_domain_by_id(domctl->domain); - if (d != NULL) { - ret = -EINVAL; - if (cpu_rma_valid(order)) - ret = allocate_rma(d, order); - put_domain(d); - } - } - break; - - default: - ret = -ENOSYS; - break; - } - - return ret; -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/exceptions.c --- a/xen/arch/powerpc/exceptions.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005, 2006 - * - * Authors: Hollis Blanchard - * Jimi Xenidis - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef DEBUG - -extern ulong ppc_do_softirq(ulong orig_msr); -extern void do_timer(struct cpu_user_regs *regs); -extern void do_dec(struct cpu_user_regs *regs); -extern void program_exception(struct cpu_user_regs *regs, - unsigned long cookie); -extern int reprogram_timer(s_time_t timeout); - -int hdec_sample = 0; - -void do_timer(struct cpu_user_regs *regs) -{ - /* Set HDEC high so it stops firing and can be reprogrammed by - * set_preempt() */ - /* FIXME! HACK ALERT! - * - * We have a bug in that if we switch domains in schedule() we - * switch right away regardless of whatever else is pending. This - * means that if the timer goes off while in schedule(), the next - * domain will be preempted by the interval defined below. So - * until we fix our cotnext_switch(), the follow workaround will - * make sure that the domain we switch to does not run for to long - * so we can continue to service the other timers in the timer - * queue and that the value is long enough to escape this - * particular timer event. - */ - reprogram_timer(NOW() + MILLISECS(1)); - - raise_softirq(TIMER_SOFTIRQ); -} - -void do_dec(struct cpu_user_regs *regs) -{ - if (!(regs->msr & MSR_HV)) { - panic("HV dec from domain\n"); - } - printk("DEC_HV: pc: 0x%lx lr: 0x%lx \n", regs->pc, regs->lr); - mtdec(INT_MAX); -} - -void program_exception(struct cpu_user_regs *regs, unsigned long cookie) -{ - if (cookie == 0x200) { - if (cpu_machinecheck(regs)) - return; - - printk("%s: machine check\n", __func__); - } else { -#ifdef CRASH_DEBUG - if (__trap_to_gdb(regs, cookie) == 0) - return; -#endif /* CRASH_DEBUG */ - - printk("%s: type: 0x%lx\n", __func__, cookie); - show_backtrace_regs(regs); - } - machine_halt(); -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/exceptions.h --- a/xen/arch/powerpc/exceptions.h Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2007 - * - * Authors: Hollis Blanchard - */ - -#ifndef _ARCH_PPC_EXCEPTIONS_H_ -#define _ARCH_PPC_EXCEPTIONS_H_ - -#include -#include -#include - -extern void do_hcall(struct cpu_user_regs *regs); -extern void do_IRQ(struct cpu_user_regs *regs); -extern void deliver_ee(struct cpu_user_regs *regs); -extern void do_external(struct cpu_user_regs *regs); -extern void init_IRQ(void); -extern void ack_APIC_irq(void); -extern int ioapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval); -extern int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val); - -extern void do_timer(struct cpu_user_regs *regs); -extern void do_dec(struct cpu_user_regs *regs); -extern void do_perfmon(struct cpu_user_regs *regs); -extern void program_exception( - struct cpu_user_regs *regs, unsigned long cookie); - -extern long xen_hvcall_jump(struct cpu_user_regs *regs, ulong address); - -extern void sleep(void); -extern void idle_loop(void); - -extern ulong *__hypercall_table[]; - -extern char exception_vectors[]; -extern char exception_vectors_end[]; -extern int spin_start[]; -extern void secondary_cpu_init(int cpuid, unsigned long r4); -#endif diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/external.c --- a/xen/arch/powerpc/external.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,202 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005, 2006 - * - * Authors: Jimi Xenidis - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mpic_init.h" -#include "exceptions.h" - -#undef DEBUG -#ifdef DEBUG -#define DBG(fmt...) printk(fmt) -#else -#define DBG(fmt...) -#endif - -int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1}; - -unsigned long io_apic_irqs; -int ioapic_ack_new = 1; - -/* deliver_ee: called with interrupts off when resuming every vcpu */ -void deliver_ee(struct cpu_user_regs *regs) -{ - const ulong srr_mask = ~(MSR_IR | MSR_DR | MSR_FE0 | MSR_FE1 | MSR_EE | - MSR_RI | - MSR_BE | MSR_FP | MSR_PMM | MSR_PR | MSR_SE); - - BUG_ON(mfmsr() & MSR_EE); - BUG_ON(regs->msr & MSR_HV); - - if (!local_events_need_delivery()) - return; - - /* XXX OS error: EE was set but RI was not. We could trigger a machine - * check, or kill the domain... for now just crash Xen so we notice. */ - BUG_ON(!(regs->msr & MSR_RI)); - - regs->srr0 = regs->pc; - /* zero SRR1[33:36] and SRR1[42:47] */ - regs->srr1 = regs->msr & ~0x00000000783f0000; - regs->pc = 0x500; - regs->msr &= srr_mask; - regs->msr |= MSR_SF | MSR_ME; - - DBG("pc, regs->msr); -} - -void do_external(struct cpu_user_regs *regs) -{ - int vec; - static unsigned spur_count; - - BUG_ON(!(regs->msr & MSR_EE)); - BUG_ON(mfmsr() & MSR_EE); - - vec = xen_mpic_get_irq(regs); - DBG(">HV: vec=%d, pc=0x%lx, msr=0x%lx\n", vec, regs->pc, regs->msr); - - if (irq_desc[vec].status & IRQ_PER_CPU) { - /* x86 do_IRQ does not respect the per cpu flag. */ - irq_desc_t *desc = &irq_desc[vec]; - regs->entry_vector = vec; - desc->handler->ack(vec); - desc->action->handler(vector_to_irq(vec), desc->action->dev_id, regs); - desc->handler->end(vec); - } else if (vec != -1) { - regs->entry_vector = vec; - do_IRQ(regs); - - BUG_ON(mfmsr() & MSR_EE); - spur_count = 0; - } else { - ++spur_count; - if (spur_count > 100) - panic("Too many (%d) spurrious interrupts in a row\n" - " Known problem, please halt and let machine idle/cool " - " then reboot\n", - 100); - } -} - -void init_IRQ(void) -{ - xen_mpic_init(); -} - -void ack_APIC_irq(void) -{ - panic("%s: EOI the whole MPIC?\n", __func__); -} - -void ack_bad_irq(unsigned int irq) -{ - printk("unexpected IRQ trap at vector %02x\n", irq); - /* - * Currently unexpected vectors happen only on SMP and APIC. - * We _must_ ack these because every local APIC has only N - * irq slots per priority level, and a 'hanging, unacked' IRQ - * holds up an irq slot - in excessive cases (when multiple - * unexpected vectors occur) that might lock up the APIC - * completely. - */ - ack_APIC_irq(); -} - -extern void dump_ioapic_irq_info(void); -void dump_ioapic_irq_info(void) -{ - printk("%s: can't dump yet\n", __func__); -} - -/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ -u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }; -int assign_irq_vector(int irq) -{ - static int current_vector = FIRST_DEVICE_VECTOR, offset = 0; - - BUG_ON(irq >= NR_IRQ_VECTORS); - if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) - return IO_APIC_VECTOR(irq); -next: - current_vector += 8; - - /* Skip the hypercall vector. */ - if (current_vector == HYPERCALL_VECTOR) - goto next; - - /* Skip the Linux/BSD fast-trap vector. */ - if (current_vector == FAST_TRAP) - goto next; - - if (current_vector >= FIRST_SYSTEM_VECTOR) { - offset++; - if (!(offset%8)) - return -ENOSPC; - current_vector = FIRST_DEVICE_VECTOR + offset; - } - - vector_irq[current_vector] = irq; - if (irq != AUTO_ASSIGN) - IO_APIC_VECTOR(irq) = current_vector; - - return current_vector; -} - -int ioapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval) -{ - BUG_ON(pval != pval); - return 0; -} - -int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) -{ - BUG_ON(val != val); - return 0; -} - -void send_IPI_mask(cpumask_t mask, int vector) -{ - unsigned int cpus; - int const bits = 8 * sizeof(cpus); - - switch(vector) { - case CALL_FUNCTION_VECTOR: - case EVENT_CHECK_VECTOR: - break; - default: - BUG(); - return; - } - - BUG_ON(NR_CPUS > bits); - BUG_ON(fls(mask.bits[0]) > bits); - - cpus = mask.bits[0]; - mpic_send_ipi(vector, cpus); -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/float.S --- a/xen/arch/powerpc/float.S Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +0,0 @@ -/* - * Copyright (C) 2005 Jimi Xenidis , IBM Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include - -#ifdef HAS_FLOAT -save_fp: - addi r4, r3, VCPU_fprs - FPR_WIDTH - stfdu fr0,FPR_WIDTH(r4) - stfdu fr1,FPR_WIDTH(r4) - stfdu fr2,FPR_WIDTH(r4) - stfdu fr3,FPR_WIDTH(r4) - stfdu fr4,FPR_WIDTH(r4) - stfdu fr5,FPR_WIDTH(r4) - stfdu fr6,FPR_WIDTH(r4) - stfdu fr7,FPR_WIDTH(r4) - stfdu fr8,FPR_WIDTH(r4) - stfdu fr9,FPR_WIDTH(r4) - stfdu fr10,FPR_WIDTH(r4) - stfdu fr11,FPR_WIDTH(r4) - stfdu fr12,FPR_WIDTH(r4) - stfdu fr13,FPR_WIDTH(r4) - stfdu fr14,FPR_WIDTH(r4) - stfdu fr15,FPR_WIDTH(r4) - stfdu fr16,FPR_WIDTH(r4) - stfdu fr17,FPR_WIDTH(r4) - stfdu fr18,FPR_WIDTH(r4) - stfdu fr19,FPR_WIDTH(r4) - stfdu fr20,FPR_WIDTH(r4) - stfdu fr21,FPR_WIDTH(r4) - stfdu fr22,FPR_WIDTH(r4) - stfdu fr23,FPR_WIDTH(r4) - stfdu fr24,FPR_WIDTH(r4) - stfdu fr25,FPR_WIDTH(r4) - stfdu fr26,FPR_WIDTH(r4) - stfdu fr27,FPR_WIDTH(r4) - stfdu fr28,FPR_WIDTH(r4) - stfdu fr29,FPR_WIDTH(r4) - stfdu fr30,FPR_WIDTH(r4) - stfdu fr31,FPR_WIDTH(r4) - mffs fr0 - stfd fr0,VCPU_fpscr(r3) - blr - -load_fp: - lfd fr0,VCPU_fpscr(r3) - mtfsf 0xff,fr0 - - addi r4, r3, VCPU_fprs - FPR_WIDTH - lfdu fr0,FPR_WIDTH(r4) - lfdu fr1,FPR_WIDTH(r4) - lfdu fr2,FPR_WIDTH(r4) - lfdu fr3,FPR_WIDTH(r4) - lfdu fr4,FPR_WIDTH(r4) - lfdu fr5,FPR_WIDTH(r4) - lfdu fr6,FPR_WIDTH(r4) - lfdu fr7,FPR_WIDTH(r4) - lfdu fr8,FPR_WIDTH(r4) - lfdu fr9,FPR_WIDTH(r4) - lfdu fr10,FPR_WIDTH(r4) - lfdu fr11,FPR_WIDTH(r4) - lfdu fr12,FPR_WIDTH(r4) - lfdu fr13,FPR_WIDTH(r4) - lfdu fr14,FPR_WIDTH(r4) - lfdu fr15,FPR_WIDTH(r4) - lfdu fr16,FPR_WIDTH(r4) - lfdu fr17,FPR_WIDTH(r4) - lfdu fr18,FPR_WIDTH(r4) - lfdu fr19,FPR_WIDTH(r4) - lfdu fr20,FPR_WIDTH(r4) - lfdu fr21,FPR_WIDTH(r4) - lfdu fr22,FPR_WIDTH(r4) - lfdu fr23,FPR_WIDTH(r4) - lfdu fr24,FPR_WIDTH(r4) - lfdu fr25,FPR_WIDTH(r4) - lfdu fr26,FPR_WIDTH(r4) - lfdu fr27,FPR_WIDTH(r4) - lfdu fr28,FPR_WIDTH(r4) - lfdu fr29,FPR_WIDTH(r4) - lfdu fr30,FPR_WIDTH(r4) - lfdu fr31,FPR_WIDTH(r4) - blr -#endif /* HAS_FLOAT */ - -#ifdef HAS_VMX - -#define VCPU_vr(n) (VCPU_vrs + ((n) * 16)) - -/* - * We cannot rely on the domain to correctly use VRSAVE - * so it is required that all VMX registers are saved and restored. - */ -save_vmx: - mfspr r0,SPRN_VRSAVE - stw r0,VCPU_vrsave(r3) - - addi r0,r3,VCPU_vr(0); stvxl vr0,0,r0 - addi r0,r3,VCPU_vr(1); stvxl vr1,0,r0 - addi r0,r3,VCPU_vr(2); stvxl vr2,0,r0 - addi r0,r3,VCPU_vr(3); stvxl vr3,0,r0 - addi r0,r3,VCPU_vr(4); stvxl vr4,0,r0 - addi r0,r3,VCPU_vr(5); stvxl vr5,0,r0 - addi r0,r3,VCPU_vr(6); stvxl vr6,0,r0 - addi r0,r3,VCPU_vr(7); stvxl vr7,0,r0 - addi r0,r3,VCPU_vr(8); stvxl vr8,0,r0 - - /* - * By now vr0 should be pushed out so now is a good time to - * get the VRSCR which can take a long time and has no dependcies - * on the following operations. - */ - mfvscr vr0 - addi r0,r3,VCPU_vscr ; stvxl vr0,0,r0 - - addi r0,r3,VCPU_vr(9); stvxl vr9,0,r0 - addi r0,r3,VCPU_vr(10); stvxl vr10,0,r0 - addi r0,r3,VCPU_vr(11); stvxl vr11,0,r0 - addi r0,r3,VCPU_vr(12); stvxl vr12,0,r0 - addi r0,r3,VCPU_vr(13); stvxl vr13,0,r0 - addi r0,r3,VCPU_vr(14); stvxl vr14,0,r0 - addi r0,r3,VCPU_vr(15); stvxl vr15,0,r0 - addi r0,r3,VCPU_vr(16); stvxl vr16,0,r0 - addi r0,r3,VCPU_vr(17); stvxl vr17,0,r0 - addi r0,r3,VCPU_vr(18); stvxl vr18,0,r0 - addi r0,r3,VCPU_vr(19); stvxl vr19,0,r0 - addi r0,r3,VCPU_vr(20); stvxl vr20,0,r0 - addi r0,r3,VCPU_vr(21); stvxl vr21,0,r0 - addi r0,r3,VCPU_vr(22); stvxl vr22,0,r0 - addi r0,r3,VCPU_vr(23); stvxl vr23,0,r0 - addi r0,r3,VCPU_vr(24); stvxl vr24,0,r0 - addi r0,r3,VCPU_vr(25); stvxl vr25,0,r0 - addi r0,r3,VCPU_vr(26); stvxl vr26,0,r0 - addi r0,r3,VCPU_vr(27); stvxl vr27,0,r0 - addi r0,r3,VCPU_vr(28); stvxl vr28,0,r0 - addi r0,r3,VCPU_vr(29); stvxl vr29,0,r0 - addi r0,r3,VCPU_vr(30); stvxl vr30,0,r0 - addi r0,r3,VCPU_vr(31); stvxl vr31,0,r0 - blr - -load_vmx: - lwz r0,VCPU_vrsave(r3) - mtspr SPRN_VRSAVE,r0 - - /* - * This operation can take a long time so we use vr31 to - * eliminate the depency on r0 for the next load - */ - addi r0,r3,VCPU_vscr ; lvxl vr31,0,r0 - mtvscr vr31 - - addi r0,r3,VCPU_vr(0); lvxl vr0,0,r0 - addi r0,r3,VCPU_vr(1); lvxl vr1,0,r0 - addi r0,r3,VCPU_vr(2); lvxl vr2,0,r0 - addi r0,r3,VCPU_vr(3); lvxl vr3,0,r0 - addi r0,r3,VCPU_vr(4); lvxl vr4,0,r0 - addi r0,r3,VCPU_vr(5); lvxl vr5,0,r0 - addi r0,r3,VCPU_vr(6); lvxl vr6,0,r0 - addi r0,r3,VCPU_vr(7); lvxl vr7,0,r0 - addi r0,r3,VCPU_vr(8); lvxl vr8,0,r0 - addi r0,r3,VCPU_vr(9); lvxl vr9,0,r0 - addi r0,r3,VCPU_vr(10); lvxl vr10,0,r0 - addi r0,r3,VCPU_vr(11); lvxl vr11,0,r0 - addi r0,r3,VCPU_vr(12); lvxl vr12,0,r0 - addi r0,r3,VCPU_vr(13); lvxl vr13,0,r0 - addi r0,r3,VCPU_vr(14); lvxl vr14,0,r0 - addi r0,r3,VCPU_vr(15); lvxl vr15,0,r0 - addi r0,r3,VCPU_vr(16); lvxl vr16,0,r0 - addi r0,r3,VCPU_vr(17); lvxl vr17,0,r0 - addi r0,r3,VCPU_vr(18); lvxl vr18,0,r0 - addi r0,r3,VCPU_vr(19); lvxl vr19,0,r0 - addi r0,r3,VCPU_vr(20); lvxl vr20,0,r0 - addi r0,r3,VCPU_vr(21); lvxl vr21,0,r0 - addi r0,r3,VCPU_vr(22); lvxl vr22,0,r0 - addi r0,r3,VCPU_vr(23); lvxl vr23,0,r0 - addi r0,r3,VCPU_vr(24); lvxl vr24,0,r0 - addi r0,r3,VCPU_vr(25); lvxl vr25,0,r0 - addi r0,r3,VCPU_vr(26); lvxl vr26,0,r0 - addi r0,r3,VCPU_vr(27); lvxl vr27,0,r0 - addi r0,r3,VCPU_vr(28); lvxl vr28,0,r0 - addi r0,r3,VCPU_vr(29); lvxl vr29,0,r0 - addi r0,r3,VCPU_vr(30); lvxl vr30,0,r0 - addi r0,r3,VCPU_vr(31); lvxl vr31,0,r0 - blr -#endif /* HAS_VMX */ - -/* void save_float(struct exec_domain *ed) */ -_GLOBAL(save_float) - mflr r8 -#ifdef HAS_FLOAT - mfmsr r9 # save msr - ori r0,r9,MSR_FP # turn on FPU - mtmsr r0 - bl save_fp # uses r3, r4 - mtmsr r9 # restore msr -#endif /* HAS_FLOAT */ -#ifdef HAS_VMX - mfmsr r9 # save msr - oris r0,r9,MSR_VMX@h # turn on VMX - mtmsr r0 - bl save_vmx # uses r3 - mtmsr r9 # restore msr -#endif /* HAS_VMX */ - mtlr r8 - blr - -/* void load_float(struct exec_domain *ed) */ -_GLOBAL(load_float) - mflr r8 -#ifdef HAS_FLOAT - mfmsr r9 # save msr - ori r0,r9,MSR_FP # turn on FPU - mtmsr r0 - bl load_fp # uses r3, r4 - mtmsr r9 # restore msr -#endif /* HAS_FLOAT */ -#ifdef HAS_VMX - mfmsr r9 # save msr - oris r0,r9,MSR_VMX@h # turn on VMX - mtmsr r0 - bl load_vmx # uses r3 - mtmsr r9 # restore msr -#endif /* HAS_VMX */ - mtlr r8 - blr diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/gdbstub.c --- a/xen/arch/powerpc/gdbstub.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Hollis Blanchard - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -asm(".globl trap_instruction\n" - "trap_instruction:\n" - "trap\n"); -extern u32 trap_instruction[]; - -static unsigned int dec_entry; -static unsigned int hdec_entry; - -static inline ulong -gdb_ppc_0x700(struct cpu_user_regs *state) -{ - ulong instr; - - switch (state->msr & MSR_TRAP_BITS) { - case MSR_TRAP_FE: - return SIGFPE; - case MSR_TRAP_IOP: - case MSR_TRAP_PRIV: - return SIGILL; - case MSR_TRAP: - instr = *((u32 *)state->pc); - - /* if this was a hardcoded trap in the source, step past it */ - if (instr == *trap_instruction) { - state->pc += sizeof (u32); - } - return SIGTRAP; - } - return SIGBUS; -} - -u16 gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie) -{ - /* exception type identifies, trap or bad address */ - switch (cookie) { - case 0x200: /* Machine Check */ - return SIGTERM; - case 0x300: /* DSI */ - case 0x380: /* Data SLB */ - case 0x400: /* ISI */ - case 0x480: /* Instruction SLB */ - return SIGSEGV; - case 0x600: /* Alignment SLB */ - return SIGBUS; - case 0x700: /* Program */ - return gdb_ppc_0x700(regs); - case 0x800: /* Float */ - return SIGFPE; - case 0x900: /* Decrementer */ - return SIGALRM; /* is this right? */ - case 0xd00: /* TRAP */ - return SIGTRAP; - case 0xe00: /* FP */ - return SIGFPE; - } - return SIGBUS; -} - -void -gdb_arch_resume(struct cpu_user_regs *regs, - unsigned long addr, unsigned long type, - struct gdb_context *ctx) -{ - if (addr != ~((ulong)0)) { - regs->pc = addr; - } - - if (type == GDB_CONTINUE) { - regs->msr &= ~MSR_SE; - } else { - regs->msr |= MSR_SE; - } -} - -void -gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs, - struct gdb_context *ctx) -{ - unimplemented(); - gdb_send_reply("", ctx); -} - -void -gdb_arch_read_reg_array(struct cpu_user_regs *state, struct gdb_context *ctx) -{ - ulong i = 0; - - for (i = 0; i < 32; ++i) { - gdb_write_to_packet_hex(state->gprs[i], sizeof(state->gprs[i]), ctx); - } - /* Avoid floating point for now */ - for (i = 0; i < 32; ++i) { - gdb_write_to_packet_hex(0, sizeof(u64), ctx); - } - gdb_write_to_packet_hex(state->pc, sizeof (state->pc), ctx); - gdb_write_to_packet_hex(state->msr, sizeof (state->msr), ctx); - gdb_write_to_packet_hex(state->cr, sizeof (state->cr), ctx); - gdb_write_to_packet_hex(state->lr, sizeof (state->lr), ctx); - gdb_write_to_packet_hex(state->ctr, sizeof (state->ctr), ctx); - gdb_write_to_packet_hex(state->xer, sizeof (u32), ctx); - gdb_write_to_packet_hex(0, sizeof(u32), ctx); /* fpscr */ - gdb_send_packet(ctx); -} - -void -gdb_arch_write_reg(unsigned long regnum, unsigned long val, - struct cpu_user_regs *regs, struct gdb_context *ctx) -{ - unimplemented(); - gdb_send_reply("", ctx); -} - -void -gdb_arch_write_reg_array(struct cpu_user_regs *regs, const char *buf, - struct gdb_context *ctx) -{ - ulong i; - - for (i = 0; i < 32; ++i) { - regs->gprs[i] = str2ulong(buf, sizeof (ulong)); - buf += sizeof (regs->gprs[0]) * 2; - } - /* Avoid floating point for now */ - for (i = 0; i < 32; ++i) { - buf += sizeof (u64) * 2; - } - - regs->pc = str2ulong(buf, sizeof (regs->pc)); - buf += sizeof (regs->pc) * 2; - regs->msr = str2ulong(buf, sizeof (regs->msr)); - buf += sizeof (regs->msr) * 2; - regs->cr = str2ulong(buf, sizeof (regs->cr)); - buf += sizeof (regs->cr) * 2; - regs->lr = str2ulong(buf, sizeof (regs->lr)); - buf += sizeof (regs->lr) * 2; - regs->ctr = str2ulong(buf, sizeof (regs->ctr)); - buf += sizeof (regs->ctr) * 2; - regs->xer = str2ulong(buf, sizeof (u32)); - buf += sizeof (u32) * 2; -} - -unsigned int -gdb_arch_copy_from_user(void *dest, const void *src, unsigned len) -{ - memcpy(dest, src, len); - return 0; -} - -unsigned int -gdb_arch_copy_to_user(void *dest, const void *src, unsigned len) -{ - memcpy(dest, src, len); - synchronize_caches((ulong)dest, len); - return 0; -} - -void -gdb_arch_print_state(struct cpu_user_regs *state) -{ - int i = 0; - printk("PC: 0x%016lx MSR: 0x%016lx\n", state->pc, state->msr); - printk("LR: 0x%016lx CTR: 0x%016lx\n", state->lr, state->ctr); - /* XXX - printk("DAR: 0x%016lx DSISR: 0x%016lx\n", state->dar, state->dsisr); - */ - printk("CR: 0x%08x XER: 0x%016lx\n", state->cr, state->xer); - for (; i < 32; i+=4) { - printk("%02d: 0x%016lx 0x%016lx 0x%016lx 0x%016lx\n", - i, state->gprs[i], state->gprs[i+1], - state->gprs[i+2], state->gprs[i+3]); - } -} - -void -gdb_arch_enter(struct cpu_user_regs *state) -{ - dec_entry = mfdec(); - hdec_entry = mfhdec(); -} - -void -gdb_arch_exit(struct cpu_user_regs *state) -{ - mtdec(dec_entry); - mthdec(hdec_entry); -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/hcalls.c --- a/xen/arch/powerpc/hcalls.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,171 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2006, 2007 - * - * Authors: Hollis Blanchard - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "exceptions.h" - -u32 *papr_hcalls; /* PAPR Hypervisor Calls */ -u32 *hypercall_table; /* Xen Hypervisor Calls */ - -static void hcall_papr(ulong num, struct cpu_user_regs *regs) -{ - u32 address; - - if (regs->msr & MSR_PR) { - regs->gprs[3] = H_Privilege; - return; - } - - if ((num & 0x3) || (num > RPA_HCALL_END)) { - regs->gprs[3] = H_Parameter; - return; - } - - address = papr_hcalls[num/4]; - papr_hcall_jump(regs, address); -} - -static void hcall_xen(ulong num, struct cpu_user_regs *regs) -{ - u32 address; - - if (regs->msr & MSR_PR) { - regs->gprs[3] = -EPERM; - return; - } - - if ((num >= NR_hypercalls)) { - regs->gprs[3] = -ENOSYS; - return; - } - address = hypercall_table[num]; - if (address == 0) { - printk("unsupported Xen hypercall: 0x%lx\n", num); - regs->gprs[3] = -ENOSYS; - return; - } - - regs->gprs[3] = xen_hvcall_jump(regs, address); -} - -void do_multicall_call(multicall_entry_t *call) -{ - struct cpu_user_regs regs; - - regs.gprs[3] = call->args[0]; - regs.gprs[4] = call->args[1]; - regs.gprs[5] = call->args[2]; - regs.gprs[6] = call->args[3]; - regs.gprs[7] = call->args[4]; - regs.gprs[8] = call->args[5]; - - hcall_xen(call->op, ®s); - - call->result = regs.gprs[3]; -} - -void do_hcall(struct cpu_user_regs *regs) -{ - ulong num = regs->gprs[3]; - - local_irq_enable(); - - if ((num & XEN_MARK(0)) == XEN_MARK(0)) { - /* it's a Xen call */ - num &= ~XEN_MARK(0); - hcall_xen(num, regs); - } else { - /* it's a PAPR call */ - hcall_papr(num, regs); - } -} - -static void do_ni_papr_hypercall(struct cpu_user_regs *regs) -{ - struct vcpu *v = get_current(); - - printk("unsupported PAPR hcall 0x%lx was called by dom0x%x\n", - regs->gprs[3], v->domain->domain_id); - - regs->gprs[3] = H_Parameter; -} - -/* store low 32 bits of 64-bit address in hcall table (this is safe because we - * know we will not link above 4GB). We don't need to preserve the TOC - * because that only changes when calling dynamically linked objects. */ -static void register_papr_hcall(ulong num, hcall_handler_t handler) -{ - int index = num/4; - - papr_hcalls[index] = (u32)(*(u64 *)handler); -} - -static void init_papr_hcalls(void) -{ - init_hcall_t *hcall; - int i; - - /* initialize PAPR hcall table */ - papr_hcalls = xmalloc_array(u32, RPA_HCALL_END/4); - ASSERT(papr_hcalls != NULL); - for (i = 0; i <= RPA_HCALL_END; i += 4) - register_papr_hcall(i, do_ni_papr_hypercall); - - /* register the PAPR hcalls */ - for (hcall = &__init_hcall_start; hcall < &__init_hcall_end; hcall++) { - register_papr_hcall(hcall->number, hcall->handler); - } -} - -static void init_hypercall_table(void) -{ - int i; - - hypercall_table = xmalloc_array(u32, NR_hypercalls); - ASSERT(hypercall_table != NULL); - - for (i = 0; i < NR_hypercalls; i++) { - if (__hypercall_table[i] == NULL ) { - hypercall_table[i] = 0; - } else { - hypercall_table[i] = (u32)(*__hypercall_table[i]); - } - } -} - -static int init_hcalls(void) -{ - init_papr_hcalls(); - init_hypercall_table(); - - return 0; -} -__initcall(init_hcalls); diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/iommu.c --- a/xen/arch/powerpc/iommu.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2007 - * - * Authors: Jimi Xenidis - */ - -#undef DEBUG - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tce.h" -#include "iommu.h" - -#ifdef DEBUG -#define DBG(fmt...) printk(fmt) -#else -#define DBG(fmt...) -#endif - -struct iommu_funcs { - int (*iommu_put)(ulong, union tce); -}; - -/* individual host bridges */ -static struct iommu_funcs iommu_phbs[16]; -static u32 iommu_phbs_num = ARRAY_SIZE(iommu_phbs); - -int iommu_put(u32 buid, ulong ioba, union tce tce) -{ - struct vcpu *v = get_current(); - struct domain *d = v->domain; - - if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put != NULL) { - ulong gmfn; - ulong mfn; - int mtype; - - gmfn = tce.tce_bits.tce_rpn; - - - mfn = pfn2mfn(d, gmfn, &mtype); - if (mfn != INVALID_MFN) { - switch (mtype) { - case PFN_TYPE_LOGICAL: - break; - case PFN_TYPE_FOREIGN: - DBG("%s: assigning to Foriegn page: " - "gmfn: 0x%lx mfn: 0x%lx\n", __func__, gmfn, mfn); - break; - default: - printk("%s: unsupported type[%d]: gmfn: 0x%lx mfn: 0x%lx\n", - __func__, mtype, gmfn, mfn); - return -1; - break; - } - DBG("%s: ioba=0x%lx gmfn=0x%lx mfn=0x%lx\n", __func__, - ioba, gmfn, mfn); - tce.tce_bits.tce_rpn = mfn; - return iommu_phbs[buid].iommu_put(ioba, tce); - } - } - return -1; -} - -int iommu_register(u32 buid, int (*put)(ulong ioba, union tce ltce)) -{ - - if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put == NULL) { - iommu_phbs[0].iommu_put = put; - return 0; - } - panic("bad IOMMU registration\n"); - return -1; -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/iommu.h --- a/xen/arch/powerpc/iommu.h Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#ifndef _IOMMU_H -#define _IOMMU_H - -extern int iommu_put(u32 buid, ulong ioba, union tce tce); -extern int iommu_register(u32 buid, int (*put)(ulong, union tce)); - -#endif /* _IOMMU_H */ - diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/irq.c --- a/xen/arch/powerpc/irq.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#include "exceptions.h" -#include "../x86/irq.c" diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/machine_kexec.c --- a/xen/arch/powerpc/machine_kexec.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -#include /* for printk() used in stubs */ -#include -#include -#include - -int machine_kexec_load(int type, int slot, xen_kexec_image_t *image) -{ - printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__); - return -1; -} - -void machine_kexec_unload(int type, int slot, xen_kexec_image_t *image) -{ - printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__); -} - -void machine_reboot_kexec(xen_kexec_image_t *image) -{ - printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__); -} - -void machine_kexec(xen_kexec_image_t *image) -{ - printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__); -} - -int machine_kexec_get(xen_kexec_image_t *image) -{ - printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__); - return -1; -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/memory.c --- a/xen/arch/powerpc/memory.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2006, 2007 - * - * Authors: Dan Poff - * Jimi Xenidis - */ -#include -#include -#include -#include -#include "of-devtree.h" -#include "oftree.h" -#include "rtas.h" - -#define DEBUG -#ifdef DEBUG -#define DBG(fmt...) printk(fmt) -#else -#define DBG(fmt...) -#endif - -/* - * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the - * page_info table and allocation bitmap. - */ -static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB; -integer_param("xenheap_megabytes", opt_xenheap_megabytes); - -unsigned long xenheap_phys_end; -static uint nr_pages; -static ulong xenheap_size; - -struct membuf { - ulong start; - ulong size; -}; - -typedef void (*walk_mem_fn)(struct membuf *, uint); - -static void set_max_page(struct membuf *mb, uint entries) -{ - int i; - - for (i = 0; i < entries; i++) { - ulong end_page; - - printk(" %016lx: %016lx\n", mb[i].start, mb[i].size); - nr_pages += mb[i].size >> PAGE_SHIFT; - - end_page = (mb[i].start + mb[i].size) >> PAGE_SHIFT; - if (end_page > max_page) - max_page = end_page; - } -} - -/* mark all memory from modules onward as unused */ -static void heap_init(struct membuf *mb, uint entries) -{ - int i; - ulong start_blk; - ulong end_blk = 0; - - for (i = 0; i < entries; i++) { - start_blk = mb[i].start; - end_blk = start_blk + mb[i].size; - - if (start_blk < xenheap_phys_end) { - if (xenheap_phys_end > end_blk) { - panic("xenheap spans LMB\n"); - } - if (xenheap_phys_end == end_blk) - continue; - - start_blk = xenheap_phys_end; - } - - DBG("boot free: %016lx - %016lx\n", start_blk, end_blk); - init_boot_pages(start_blk, end_blk); - total_pages += (end_blk - start_blk) >> PAGE_SHIFT; - } -} - -static void ofd_walk_mem(void *m, walk_mem_fn fn) -{ - ofdn_t n; - uint p_len; - struct membuf mb[8]; - static char name[] = "memory"; - - n = ofd_node_find_by_prop(m, OFD_ROOT, "device_type", name, sizeof(name)); - while (n > 0) { - - p_len = ofd_getprop(m, n, "reg", mb, sizeof (mb)); - if (p_len <= 0) { - panic("ofd_getprop(): failed\n"); - } - if (p_len > sizeof(mb)) - panic("%s: buffer is not big enuff for this firmware: " - "0x%lx < 0x%x\n", __func__, sizeof(mb), p_len); - - fn(mb, p_len / sizeof(mb[0])); - n = ofd_node_find_next(m, n); - } -} - -void memory_init(void) -{ - ulong eomem; - ulong bitmap_start = ~0UL; - ulong bitmap_end = 0; - ulong bitmap_size; - ulong xh_pages; - ulong start; - ulong end; - int pos; - - /* lets find out how much memory there is and set max_page */ - max_page = 0; - printk("Physical RAM map:\n"); - ofd_walk_mem((void *)oftree, set_max_page); - eomem = max_page << PAGE_SHIFT; - if (eomem == 0) { - panic("ofd_walk_mem() failed\n"); - } - - xh_pages = opt_xenheap_megabytes << (20 - PAGE_SHIFT); - - /* While we are allocating HTABS from The Xen Heap we need it to - * be larger */ - xh_pages += nr_pages >> 5; - - xenheap_phys_end = xh_pages << PAGE_SHIFT; - printk("End of Xen Area: %luMiB (%luKiB)\n", - xenheap_phys_end >> 20, xenheap_phys_end >> 10); - - printk("End of RAM: %luMiB (%luKiB)\n", eomem >> 20, eomem >> 10); - - /* The boot allocator requires one bit per page. Find a spot for it. */ - bitmap_size = max_page / 8; - pos = boot_of_mem_avail(0, &start, &end); - while (pos >= 0) { - if (end - start >= bitmap_size) { - bitmap_start = start; - bitmap_end = init_boot_allocator(bitmap_start); - printk("boot allocator @ %lx - %lx\n", bitmap_start, bitmap_end); - break; - } - pos = boot_of_mem_avail(pos, &start, &end); - } - if (bitmap_start == ~0UL) - panic("Couldn't find 0x%lx bytes for boot allocator.", bitmap_size); - - /* allow everything else to be allocated */ - total_pages = 0; - ofd_walk_mem((void *)oftree, heap_init); - if (total_pages == 0) - panic("heap_init: failed"); - - if (total_pages > max_page) - panic("total_pages > max_page: 0x%lx > 0x%lx\n", - total_pages, max_page); - - DBG("total_pages: 0x%016lx\n", total_pages); - - init_frametable(); - init_machine_to_phys_table(); - - numa_initmem_init(0, max_page); - - /* Domain heap gets all the unclaimed memory. */ - end_boot_allocator(); - - /* Create initial xen heap by finding non-reserved memory. */ - pos = boot_of_mem_avail(0, &start, &end); - while (pos >= 0) { - if (end == ~0UL) - end = xenheap_phys_end; - - /* Problem: the bitmap itself is not reserved. */ - if ((start >= bitmap_start) && (start < bitmap_end)) { - /* Start is inside bitmap. */ - start = bitmap_end; - } - if ((end > bitmap_start) && (end <= bitmap_end)) { - /* End is inside bitmap. */ - end = bitmap_start; - } - if ((start < bitmap_start) && (end > bitmap_end)) { - /* Range encompasses bitmap. First free low part, then high. */ - xenheap_size += bitmap_start - start; - DBG("xenheap: %016lx - %016lx\n", start, bitmap_start); - init_xenheap_pages(start, bitmap_start); - start = bitmap_end; - } - - xenheap_size += end - start; - DBG("xenheap: %016lx - %016lx\n", start, end); - init_xenheap_pages(start, end); - - pos = boot_of_mem_avail(pos, &start, &end); - } - - printk("Xen Heap: %luMiB (%luKiB)\n", - xenheap_size >> 20, xenheap_size >> 10); - - eomem = avail_domheap_pages(); - printk("Dom Heap: %luMiB (%luKiB)\n", - (eomem << PAGE_SHIFT) >> 20, - (eomem << PAGE_SHIFT) >> 10); -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/mm.c --- a/xen/arch/powerpc/mm.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,617 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005, 2006 - * - * Authors: Hollis Blanchard - * Jimi Xenidis - * Ryan Harper - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef VERBOSE -#define MEM_LOG(_f, _a...) \ - printk("DOM%u: (file=mm.c, line=%d) " _f "\n", \ - current->domain->domain_id , __LINE__ , ## _a ) -#else -#define MEM_LOG(_f, _a...) ((void)0) -#endif - -/* Frame table and its size in pages. */ -struct page_info *frame_table; -unsigned long max_page; -unsigned long total_pages; - -/* machine to phys mapping to used by all domains */ -unsigned long *machine_phys_mapping; - -void __init init_frametable(void) -{ - unsigned long p; - unsigned long nr_pages; - int i; - - nr_pages = PFN_UP(max_page * sizeof(struct page_info)); - - p = alloc_boot_pages(nr_pages, 1); - if (p == 0) - panic("Not enough memory for frame table\n"); - - frame_table = (struct page_info *)(p << PAGE_SHIFT); - for (i = 0; i < nr_pages; i += 1) - clear_page((void *)((p + i) << PAGE_SHIFT)); -} - -/* Array of PFNs, indexed by MFN. */ -void __init init_machine_to_phys_table(void) -{ - unsigned long p; - unsigned long nr_pages; - int i; - - nr_pages = PFN_UP(max_page * sizeof(unsigned long)); - - p = alloc_boot_pages(nr_pages, 1); - if (p == 0) - panic("Not enough memory for machine phys mapping table\n"); - - machine_phys_mapping = (unsigned long *)(p << PAGE_SHIFT); - for (i = 0; i < nr_pages; i += 1) - clear_page((void *)((p + i) << PAGE_SHIFT)); -} - -void share_xen_page_with_guest( - struct page_info *page, struct domain *d, int readonly) -{ - if ( page_get_owner(page) == d ) - return; - - /* this causes us to leak pages in the Domain and reuslts in - * Zombie domains, I think we are missing a piece, until we find - * it we disable the following code */ - set_gpfn_from_mfn(page_to_mfn(page), INVALID_M2P_ENTRY); - - spin_lock(&d->page_alloc_lock); - - /* The incremented type count pins as writable or read-only. */ - page->u.inuse.type_info = (readonly ? PGT_none : PGT_writable_page); - page->u.inuse.type_info |= PGT_validated | 1; - - page_set_owner(page, d); - wmb(); /* install valid domain ptr before updating refcnt. */ - ASSERT(page->count_info == 0); - - /* Only add to the allocation list if the domain isn't dying. */ - if ( !d->is_dying ) - { - page->count_info |= PGC_allocated | 1; - if ( unlikely(d->xenheap_pages++ == 0) ) - get_knownalive_domain(d); - list_add_tail(&page->list, &d->xenpage_list); - } - - spin_unlock(&d->page_alloc_lock); -} - -void share_xen_page_with_privileged_guests( - struct page_info *page, int readonly) -{ - unimplemented(); -} - -static ulong foreign_to_mfn(struct domain *d, ulong pfn) -{ - - pfn -= 1UL << cpu_foreign_map_order(); - - BUG_ON(pfn >= d->arch.foreign_mfn_count); - - return d->arch.foreign_mfns[pfn]; -} - -static int set_foreign(struct domain *d, ulong pfn, ulong mfn) -{ - pfn -= 1UL << cpu_foreign_map_order(); - - BUG_ON(pfn >= d->arch.foreign_mfn_count); - d->arch.foreign_mfns[pfn] = mfn; - - return 0; -} - -static int create_grant_va_mapping( - unsigned long va, unsigned long frame, struct vcpu *v) -{ - if (v->domain->domain_id != 0) { - printk("only Dom0 can map a grant entry\n"); - BUG(); - return GNTST_permission_denied; - } - set_foreign(v->domain, va >> PAGE_SHIFT, frame); - return GNTST_okay; -} - -static int destroy_grant_va_mapping( - unsigned long addr, unsigned long frame, struct domain *d) -{ - if (d->domain_id != 0) { - printk("only Dom0 can map a grant entry\n"); - BUG(); - return GNTST_permission_denied; - } - set_foreign(d, addr >> PAGE_SHIFT, ~0UL); - return GNTST_okay; -} - -int create_grant_host_mapping( - unsigned long addr, unsigned long frame, unsigned int flags, unsigned int cache_flags) -{ - if (flags & GNTMAP_application_map) { - printk("%s: GNTMAP_application_map not supported\n", __func__); - BUG(); - return GNTST_general_error; - } - if (flags & GNTMAP_contains_pte) { - printk("%s: GNTMAP_contains_pte not supported\n", __func__); - BUG(); - return GNTST_general_error; - } - if (cache_flags) { - printk("%s: cache_flags not supported\n", __func__); - BUG(); - return GNTST_general_error; - } - return create_grant_va_mapping(addr, frame, current); -} - -int replace_grant_host_mapping( - unsigned long addr, unsigned long frame, unsigned long new_addr, - unsigned int flags) -{ - if (new_addr) { - printk("%s: new_addr not supported\n", __func__); - BUG(); - return GNTST_general_error; - } - - if (flags & GNTMAP_contains_pte) { - printk("%s: GNTMAP_contains_pte not supported\n", __func__); - BUG(); - return GNTST_general_error; - } - - /* may have force the remove here */ - return destroy_grant_va_mapping(addr, frame, current->domain); -} - -int steal_page(struct domain *d, struct page_info *page, unsigned int memflags) -{ - panic("%s called\n", __func__); - return 1; -} - -void put_page_type(struct page_info *page) -{ - unsigned long nx, x, y = page->u.inuse.type_info; - - do { - x = y; - nx = x - 1; - - ASSERT((x & PGT_count_mask) != 0); - - /* - * The page should always be validated while a reference is held. The - * exception is during domain destruction, when we forcibly invalidate - * page-table pages if we detect a referential loop. - * See domain.c:relinquish_list(). - */ - ASSERT((x & PGT_validated) || page_get_owner(page)->is_dying); - - if ( unlikely((nx & PGT_count_mask) == 0) ) - { - /* Record TLB information for flush later. */ - page->tlbflush_timestamp = tlbflush_current_time(); - } - } - while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) ); -} - - -int get_page_type(struct page_info *page, unsigned long type) -{ - unsigned long nx, x, y = page->u.inuse.type_info; - - ASSERT(!(type & ~PGT_type_mask)); - - again: - do { - x = y; - nx = x + 1; - if ( unlikely((nx & PGT_count_mask) == 0) ) - { - MEM_LOG("Type count overflow on pfn %lx", page_to_mfn(page)); - return 0; - } - else if ( unlikely((x & PGT_count_mask) == 0) ) - { - if ( (x & PGT_type_mask) != type ) - { - /* - * On type change we check to flush stale TLB entries. This - * may be unnecessary (e.g., page was GDT/LDT) but those - * circumstances should be very rare. - */ - cpumask_t mask = - page_get_owner(page)->domain_dirty_cpumask; - tlbflush_filter(mask, page->tlbflush_timestamp); - - if ( unlikely(!cpus_empty(mask)) ) - { - perfc_incr(need_flush_tlb_flush); - flush_tlb_mask(mask); - } - - /* We lose existing type, back pointer, and validity. */ - nx &= ~(PGT_type_mask | PGT_validated); - nx |= type; - - /* No special validation needed for writable pages. */ - /* Page tables and GDT/LDT need to be scanned for validity. */ - if ( type == PGT_writable_page ) - nx |= PGT_validated; - } - } - else if ( unlikely((x & PGT_type_mask) != type) ) - { - return 0; - } - else if ( unlikely(!(x & PGT_validated)) ) - { - /* Someone else is updating validation of this page. Wait... */ - while ( (y = page->u.inuse.type_info) == x ) - cpu_relax(); - goto again; - } - } - while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) ); - - if ( unlikely(!(nx & PGT_validated)) ) - { - /* Noone else is updating simultaneously. */ - __set_bit(_PGT_validated, &page->u.inuse.type_info); - } - - return 1; -} - -long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg) -{ - printk("%s: no PPC specific memory ops\n", __func__); - return -ENOSYS; -} - -extern void copy_page(void *dp, void *sp) -{ - if (on_systemsim()) { - systemsim_memcpy(dp, sp, PAGE_SIZE); - } else { - memcpy(dp, sp, PAGE_SIZE); - } -} - -/* Allocate (rma_nrpages - nrpages) more memory for domain in proper size. */ -uint allocate_extents(struct domain *d, uint nrpages, uint rma_nrpages) -{ - struct page_info *pg; - ulong mfn; - ulong gpfn = rma_nrpages; /* starting PFN at end of RMA */ - uint ext_order; - uint ext_nrpages; - uint total_nrpages; - int i; - - ext_order = cpu_extent_order(); - ext_nrpages = 1 << ext_order; - - total_nrpages = rma_nrpages; - - /* We only allocate in nr_extsz chunks so if you are not divisible - * you get more than you asked for. */ - while (total_nrpages < nrpages) { - pg = alloc_domheap_pages(d, ext_order, 0); - if (pg == NULL) - return total_nrpages; - - /* Build p2m mapping for newly allocated extent. */ - mfn = page_to_mfn(pg); - for (i = 0; i < (1 << ext_order); i++) - guest_physmap_add_page(d, gpfn + i, mfn + i); - - /* Bump starting PFN by extent size pages. */ - gpfn += ext_nrpages; - - total_nrpages += ext_nrpages; - } - - return total_nrpages; -} - -int allocate_rma(struct domain *d, unsigned int order) -{ - struct vcpu *v; - ulong rma_base; - ulong rma_sz; - ulong mfn; - int i; - - if (d->arch.rma_page) - return -EINVAL; - - d->arch.rma_page = alloc_domheap_pages(d, order, 0); - if (d->arch.rma_page == NULL) { - gdprintk(XENLOG_INFO, "Could not allocate order=%d RMA for domain %u\n", - order, d->domain_id); - return -ENOMEM; - } - d->arch.rma_order = order; - - rma_base = page_to_maddr(d->arch.rma_page); - rma_sz = rma_size(d->arch.rma_order); - - BUG_ON(rma_base & (rma_sz - 1)); /* check alignment */ - - printk("allocated RMA for Dom[%d]: 0x%lx[0x%lx]\n", - d->domain_id, rma_base, rma_sz); - - mfn = page_to_mfn(d->arch.rma_page); - - for (i = 0; i < (1 << d->arch.rma_order); i++ ) { - d->arch.rma_page[i].count_info |= PGC_page_RMA; - clear_page((void *)page_to_maddr(&d->arch.rma_page[i])); - - /* Set up p2m mapping for RMA. */ - guest_physmap_add_page(d, i, mfn+i); - } - - /* shared_info uses last page of RMA */ - d->shared_info = (shared_info_t *) (rma_base + rma_sz - PAGE_SIZE); - - /* if there are already running vcpus, adjust v->vcpu_info */ - /* XXX untested */ - for_each_vcpu(d, v) { - v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id]; - } - - return 0; -} - -void free_rma_check(struct page_info *page) -{ - if (test_bit(_PGC_page_RMA, &page->count_info)) { - if (!page_get_owner(page)->is_dying) { - panic("Attempt to free an RMA page: 0x%lx\n", page_to_mfn(page)); - } else { - clear_bit(_PGC_page_RMA, &page->count_info); - } - } -} - -ulong pfn2mfn(struct domain *d, ulong pfn, int *type) -{ - ulong mfn = INVALID_MFN; - int t = PFN_TYPE_NONE; - ulong foreign_map_pfn = 1UL << cpu_foreign_map_order(); - - /* quick tests first */ - if (pfn & foreign_map_pfn) { - t = PFN_TYPE_FOREIGN; - mfn = foreign_to_mfn(d, pfn); - } else if (pfn >= max_page && pfn < - (max_page + nr_grant_frames(d->grant_table))) { - /* XXX access d->grant_table->nr_grant_frames without lock. - * Currently on powerpc dynamic expanding grant table is - * inhibited by setting max_nr_grant_frames = INITIAL_NR_GRANT_FRAMES - * so that this access is safe. - */ - /* Its a grant table access */ - t = PFN_TYPE_GNTTAB; - mfn = gnttab_shared_mfn(d, d->grant_table, (pfn - max_page)); - } else if (d->is_privileged && platform_io_mfn(pfn)) { - t = PFN_TYPE_IO; - mfn = pfn; - } else { - if (pfn < d->arch.p2m_entries) { - t = PFN_TYPE_LOGICAL; - mfn = d->arch.p2m[pfn]; - } -#ifdef DEBUG - if (t != PFN_TYPE_NONE && d->is_dying && - page_get_owner(mfn_to_page(mfn)) != d) { - printk("%s: page type: %d owner Dom[%d]:%p expected Dom[%d]:%p\n", - __func__, t, - page_get_owner(mfn_to_page(mfn))->domain_id, - page_get_owner(mfn_to_page(mfn)), - d->domain_id, d); - BUG(); - } -#endif - } - - if (t == PFN_TYPE_NONE) { - /* This hack allows dom0 to map all memory, necessary to - * initialize domU state. */ - if (d->is_privileged && mfn_valid(pfn)) { - struct page_info *pg; - - /* page better be allocated to some domain but not the caller */ - pg = mfn_to_page(pfn); - if (!(pg->count_info & PGC_allocated)) - panic("Foreign page: 0x%lx is not owned by any domain\n", - mfn); - if (page_get_owner(pg) == d) - panic("Foreign page: 0x%lx is owned by this domain\n", - mfn); - - t = PFN_TYPE_FOREIGN; - mfn = pfn; - } - } - - if (mfn == INVALID_MFN) { - printk("%s: Dom[%d] pfn 0x%lx is not a valid page\n", - __func__, d->domain_id, pfn); - } - - if (type) - *type = t; - - return mfn; -} - -unsigned long mfn_to_gmfn(struct domain *d, unsigned long mfn) -{ - struct page_info *pg = mfn_to_page(mfn); - ulong gnttab_mfn; - - /* is this our mfn? */ - if (page_get_owner(pg) != d) - return INVALID_M2P_ENTRY; - - /* XXX access d->grant_table->nr_grant_frames without lock. - * Currently on powerpc dynamic expanding grant table is - * inhibited by setting max_nr_grant_frames = INITIAL_NR_GRANT_FRAMES - * so that this access is safe. - */ - /* grant? */ - gnttab_mfn = gnttab_shared_mfn(d, d->grant_table, 0); - if (mfn >= gnttab_mfn && mfn < - (gnttab_mfn + nr_grant_frames(d->grant_table))) - return max_page + (mfn - gnttab_mfn); - - /* IO? */ - if (d->is_privileged && platform_io_mfn(mfn)) - return mfn; - - /* check m2p table */ - return get_gpfn_from_mfn(mfn); -} - -/* NB: caller holds d->page_alloc lock, sets d->max_pages = new_max */ -int guest_physmap_max_mem_pages(struct domain *d, unsigned long new_max_pages) -{ - u32 *p2m_array = NULL; - u32 *p2m_old = NULL; - ulong i; - - /* XXX We probably could, but right now we don't shrink the p2m array. - * NB: d->max_pages >= d->arch.p2m_entries */ - if (new_max_pages < d->max_pages) { - printk("Can't shrink DOM%d max memory pages\n", d->domain_id); - return -EINVAL; - } - - /* Allocate one u32 per page. */ - p2m_array = xmalloc_array(u32, new_max_pages); - if (p2m_array == NULL) - return -ENOMEM; - - /* Copy old mappings into new array. */ - if (d->arch.p2m != NULL) { - /* XXX This could take a long time; we should use a continuation. */ - memcpy(p2m_array, d->arch.p2m, d->arch.p2m_entries * sizeof(u32)); - p2m_old = d->arch.p2m; - } - - /* Mark new mfns as invalid. */ - for (i = d->arch.p2m_entries; i < new_max_pages; i++) - p2m_array[i] = INVALID_MFN; - - /* Set new p2m pointer and size. */ - d->arch.p2m = p2m_array; - d->arch.p2m_entries = new_max_pages; - - /* Free old p2m array if present. */ - if (p2m_old) - xfree(p2m_old); - - return 0; -} - -void guest_physmap_add_page( - struct domain *d, unsigned long gpfn, unsigned long mfn) -{ - if (page_get_owner(mfn_to_page(mfn)) != d) { - printk("Won't map foreign MFN 0x%lx for DOM%d\n", mfn, d->domain_id); - return; - } - - /* Check that pfn is within guest table. */ - if (gpfn >= d->arch.p2m_entries) { - printk("Won't map invalid PFN 0x%lx for DOM%d\n", gpfn, d->domain_id); - return; - } - - /* Warn if there is an existing mapping. */ - /* XXX: probably shouldn't let this happen, but - current interface doesn't throw errors. =( */ - if (d->arch.p2m[gpfn] != INVALID_MFN) - printk("Ack! PFN aliased. PFN%lx, old MFN=%x, new MFN=%lx\n", - gpfn, d->arch.p2m[gpfn], mfn); - - /* PFN and MFN ok, map in p2m table. */ - d->arch.p2m[gpfn] = mfn; - - /* Map in m2p table. */ - set_gpfn_from_mfn(mfn, gpfn); -} - -void guest_physmap_remove_page( - struct domain *d, unsigned long gpfn, unsigned long mfn) -{ - if (page_get_owner(mfn_to_page(mfn)) != d) { - printk("Won't unmap foreign MFN 0x%lx for DOM%d\n", mfn, d->domain_id); - return; - } - - /* check that pfn is within guest table */ - if (gpfn >= d->arch.p2m_entries) { - printk("Won't unmap invalid PFN 0x%lx for DOM%d\n", gpfn, d->domain_id); - return; - } - - /* PFN and MFN ok, unmap from p2m table. */ - d->arch.p2m[gpfn] = INVALID_MFN; - - /* Unmap from m2p table. */ - set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY); -} - -void shadow_drop_references( - struct domain *d, struct page_info *page) -{ -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/mpic.c --- a/xen/arch/powerpc/mpic.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1100 +0,0 @@ -/* - * arch/powerpc/kernel/mpic.c - * - * Driver for interrupt controllers following the OpenPIC standard, the - * common implementation beeing IBM's MPIC. This driver also can deal - * with various broken implementations of this HW. - * - * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - */ - -/* XXX Xen hacks ... */ -/* make this generic */ - -#define le32_to_cpu(x) \ - ({ \ - __u32 __x = (x); \ - ((__u32)( \ - (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \ - (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | \ - (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | \ - (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \ - }) - - -#define alloc_bootmem(x) xmalloc_bytes(x) - -#define IRQ_NONE (0) -#define IRQ_HANDLED (1) -#define IRQ_RETVAL(x) ((x) != 0) - -#define IRQ_SENSE_MASK 0x1 -#define IRQ_SENSE_LEVEL 0x1 /* interrupt on active level */ -#define IRQ_SENSE_EDGE 0x0 /* interrupt triggered by edge */ - -#define IRQ_POLARITY_MASK 0x2 -#define IRQ_POLARITY_POSITIVE 0x2 /* high level or low->high edge */ -#define IRQ_POLARITY_NEGATIVE 0x0 /* low level or high->low edge */ - -#define CONFIG_IRQ_ALL_CPUS 0 -#define distribute_irqs CONFIG_IRQ_ALL_CPUS -#define CONFIG_MPIC_BROKEN_U3 - -#define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) -#define PCI_FUNC(devfn) ((devfn) & 0x07) -#define PCI_HEADER_TYPE 0x0e /* 8 bits */ -#define PCI_VENDOR_ID 0x00 /* 16 bits */ -#define PCI_VENDOR_ID_AMD 0x1022 -#define PCI_CAPABILITY_LIST 0x34 /* Offset of first capability list entry */ -#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ -#define PCI_CAP_LIST_ID 0 /* Capability ID */ -#define PCI_CAP_ID_HT_IRQCONF 0x08 /* HyperTransport IRQ Configuration */ -#define PCI_STATUS 0x06 /* 16 bits */ -#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ -#define MSG_ALL 0x8001 -#define MSG_ALL_BUT_SELF 0x8000 - -/* keeps file even closer to the original */ -#define pt_regs cpu_user_regs -/* XXX ... Xen hacks */ - -#undef DEBUG -#undef DEBUG_IPI -#undef DEBUG_IRQ -#undef DEBUG_LOW - -#include -#include -#include -#include -#include -#include -#ifndef __XEN__ -#include -#include -#endif -#include -#ifndef __XEN__ -#include - -#include -#include -#endif -#include -#ifndef __XEN__ -#include -#include -#include -#endif -#include -#include - -#ifdef DEBUG -#define DBG(fmt...) printk(fmt) -#else -#define DBG(fmt...) -#endif - -static struct mpic *mpics; -static struct mpic *mpic_primary; -static DEFINE_SPINLOCK(mpic_lock); - -#ifdef CONFIG_PPC32 /* XXX for now */ -#ifdef CONFIG_IRQ_ALL_CPUS -#define distribute_irqs (1) -#else -#define distribute_irqs (0) -#endif -#endif - -/* - * Register accessor functions - */ - - -static inline u32 _mpic_read(unsigned int be, volatile u32 __iomem *base, - unsigned int reg) -{ - if (be) - return in_be32(base + (reg >> 2)); - else - return in_le32(base + (reg >> 2)); -} - -static inline void _mpic_write(unsigned int be, volatile u32 __iomem *base, - unsigned int reg, u32 value) -{ - if (be) - out_be32(base + (reg >> 2), value); - else - out_le32(base + (reg >> 2), value); -} - -static inline u32 _mpic_ipi_read(struct mpic *mpic, unsigned int ipi) -{ - unsigned int be = (mpic->flags & MPIC_BIG_ENDIAN) != 0; - unsigned int offset = MPIC_GREG_IPI_VECTOR_PRI_0 + (ipi * 0x10); - - if (mpic->flags & MPIC_BROKEN_IPI) - be = !be; - return _mpic_read(be, mpic->gregs, offset); -} - -static inline void _mpic_ipi_write(struct mpic *mpic, unsigned int ipi, u32 value) -{ - unsigned int offset = MPIC_GREG_IPI_VECTOR_PRI_0 + (ipi * 0x10); - - _mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->gregs, offset, value); -} - -static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg) -{ - unsigned int cpu = 0; - - if (mpic->flags & MPIC_PRIMARY) - cpu = hard_smp_processor_id(); - - return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN, mpic->cpuregs[cpu], reg); -} - -static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 value) -{ - unsigned int cpu = 0; - - if (mpic->flags & MPIC_PRIMARY) - cpu = hard_smp_processor_id(); - - _mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->cpuregs[cpu], reg, value); -} - -static inline u32 _mpic_irq_read(struct mpic *mpic, unsigned int src_no, unsigned int reg) -{ - unsigned int isu = src_no >> mpic->isu_shift; - unsigned int idx = src_no & mpic->isu_mask; - - return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN, mpic->isus[isu], - reg + (idx * MPIC_IRQ_STRIDE)); -} - -static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no, - unsigned int reg, u32 value) -{ - unsigned int isu = src_no >> mpic->isu_shift; - unsigned int idx = src_no & mpic->isu_mask; - - _mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->isus[isu], - reg + (idx * MPIC_IRQ_STRIDE), value); -} - -#define mpic_read(b,r) _mpic_read(mpic->flags & MPIC_BIG_ENDIAN,(b),(r)) -#define mpic_write(b,r,v) _mpic_write(mpic->flags & MPIC_BIG_ENDIAN,(b),(r),(v)) -#define mpic_ipi_read(i) _mpic_ipi_read(mpic,(i)) -#define mpic_ipi_write(i,v) _mpic_ipi_write(mpic,(i),(v)) -#define mpic_cpu_read(i) _mpic_cpu_read(mpic,(i)) -#define mpic_cpu_write(i,v) _mpic_cpu_write(mpic,(i),(v)) -#define mpic_irq_read(s,r) _mpic_irq_read(mpic,(s),(r)) -#define mpic_irq_write(s,r,v) _mpic_irq_write(mpic,(s),(r),(v)) - - -/* - * Low level utility functions - */ - - - -/* Check if we have one of those nice broken MPICs with a flipped endian on - * reads from IPI registers - */ -static void __init mpic_test_broken_ipi(struct mpic *mpic) -{ - u32 r; - - mpic_write(mpic->gregs, MPIC_GREG_IPI_VECTOR_PRI_0, MPIC_VECPRI_MASK); - r = mpic_read(mpic->gregs, MPIC_GREG_IPI_VECTOR_PRI_0); - - if (r == le32_to_cpu(MPIC_VECPRI_MASK)) { - printk(KERN_INFO "mpic: Detected reversed IPI registers\n"); - mpic->flags |= MPIC_BROKEN_IPI; - } -} - -#ifdef CONFIG_MPIC_BROKEN_U3 - -/* Test if an interrupt is sourced from HyperTransport (used on broken U3s) - * to force the edge setting on the MPIC and do the ack workaround. - */ -static inline int mpic_is_ht_interrupt(struct mpic *mpic, unsigned int source) -{ - if (source >= 128 || !mpic->fixups) - return 0; - return mpic->fixups[source].base != NULL; -} - - -static inline void mpic_ht_end_irq(struct mpic *mpic, unsigned int source) -{ - struct mpic_irq_fixup *fixup = &mpic->fixups[source]; - - if (fixup->applebase) { - unsigned int soff = (fixup->index >> 3) & ~3; - unsigned int mask = 1U << (fixup->index & 0x1f); - writel(mask, fixup->applebase + soff); - } else { - spin_lock(&mpic->fixup_lock); - writeb(0x11 + 2 * fixup->index, fixup->base + 2); - writel(fixup->data, fixup->base + 4); - spin_unlock(&mpic->fixup_lock); - } -} - -static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source, - unsigned int irqflags) -{ - struct mpic_irq_fixup *fixup = &mpic->fixups[source]; - unsigned long flags; - u32 tmp; - - if (fixup->base == NULL) - return; - - DBG("startup_ht_interrupt(%u, %u) index: %d\n", - source, irqflags, fixup->index); - spin_lock_irqsave(&mpic->fixup_lock, flags); - /* Enable and configure */ - writeb(0x10 + 2 * fixup->index, fixup->base + 2); - tmp = readl(fixup->base + 4); - tmp &= ~(0x23U); - if (irqflags & IRQ_LEVEL) - tmp |= 0x22; - writel(tmp, fixup->base + 4); - spin_unlock_irqrestore(&mpic->fixup_lock, flags); -} - -static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source, - unsigned int irqflags) -{ - struct mpic_irq_fixup *fixup = &mpic->fixups[source]; - unsigned long flags; - u32 tmp; - - if (fixup->base == NULL) - return; - - DBG("shutdown_ht_interrupt(%u, %u)\n", source, irqflags); - - /* Disable */ - spin_lock_irqsave(&mpic->fixup_lock, flags); - writeb(0x10 + 2 * fixup->index, fixup->base + 2); - tmp = readl(fixup->base + 4); - tmp |= 1; - writel(tmp, fixup->base + 4); - spin_unlock_irqrestore(&mpic->fixup_lock, flags); -} - -static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase, - unsigned int devfn, u32 vdid) -{ - int i, irq, n; - u8 __iomem *base; - u32 tmp; - u8 pos; - - for (pos = readb(devbase + PCI_CAPABILITY_LIST); pos != 0; - pos = readb(devbase + pos + PCI_CAP_LIST_NEXT)) { - u8 id = readb(devbase + pos + PCI_CAP_LIST_ID); - if (id == PCI_CAP_ID_HT_IRQCONF) { - id = readb(devbase + pos + 3); - if (id == 0x80) - break; - } - } - if (pos == 0) - return; - - base = devbase + pos; - writeb(0x01, base + 2); - n = (readl(base + 4) >> 16) & 0xff; - - printk(KERN_INFO "mpic: - HT:%02x.%x [0x%02x] vendor %04x device %04x" - " has %d irqs\n", - devfn >> 3, devfn & 0x7, pos, vdid & 0xffff, vdid >> 16, n + 1); - - for (i = 0; i <= n; i++) { - writeb(0x10 + 2 * i, base + 2); - tmp = readl(base + 4); - irq = (tmp >> 16) & 0xff; - DBG("HT PIC index 0x%x, irq 0x%x, tmp: %08x\n", i, irq, tmp); - /* mask it , will be unmasked later */ - tmp |= 0x1; - writel(tmp, base + 4); - mpic->fixups[irq].index = i; - mpic->fixups[irq].base = base; - /* Apple HT PIC has a non-standard way of doing EOIs */ - if ((vdid & 0xffff) == 0x106b) - mpic->fixups[irq].applebase = devbase + 0x60; - else - mpic->fixups[irq].applebase = NULL; - writeb(0x11 + 2 * i, base + 2); - mpic->fixups[irq].data = readl(base + 4) | 0x80000000; - } -} - - -static void __init mpic_scan_ht_pics(struct mpic *mpic) -{ - unsigned int devfn; - u8 __iomem *cfgspace; - - printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n"); - - /* Allocate fixups array */ - mpic->fixups = alloc_bootmem(128 * sizeof(struct mpic_irq_fixup)); - BUG_ON(mpic->fixups == NULL); - memset(mpic->fixups, 0, 128 * sizeof(struct mpic_irq_fixup)); - - /* Init spinlock */ - spin_lock_init(&mpic->fixup_lock); - - /* Map U3 config space. We assume all IO-APICs are on the primary bus - * so we only need to map 64kB. - */ - cfgspace = ioremap(0xf2000000, 0x10000); - BUG_ON(cfgspace == NULL); - - /* Now we scan all slots. We do a very quick scan, we read the header - * type, vendor ID and device ID only, that's plenty enough - */ - for (devfn = 0; devfn < 0x100; devfn++) { - u8 __iomem *devbase = cfgspace + (devfn << 8); - u8 hdr_type = readb(devbase + PCI_HEADER_TYPE); - u32 l = readl(devbase + PCI_VENDOR_ID); - u16 s; - - DBG("devfn %x, l: %x\n", devfn, l); - - /* If no device, skip */ - if (l == 0xffffffff || l == 0x00000000 || - l == 0x0000ffff || l == 0xffff0000) - goto next; - /* Check if is supports capability lists */ - s = readw(devbase + PCI_STATUS); - if (!(s & PCI_STATUS_CAP_LIST)) - goto next; - - mpic_scan_ht_pic(mpic, devbase, devfn, l); - - next: - /* next device, if function 0 */ - if (PCI_FUNC(devfn) == 0 && (hdr_type & 0x80) == 0) - devfn += 7; - } -} - -#endif /* CONFIG_MPIC_BROKEN_U3 */ - - -/* Find an mpic associated with a given linux interrupt */ -static struct mpic *mpic_find(unsigned int irq, unsigned int *is_ipi) -{ - struct mpic *mpic = mpics; - - while(mpic) { - /* search IPIs first since they may override the main interrupts */ - if (irq >= mpic->ipi_offset && irq < (mpic->ipi_offset + 4)) { - if (is_ipi) - *is_ipi = 1; - return mpic; - } - if (irq >= mpic->irq_offset && - irq < (mpic->irq_offset + mpic->irq_count)) { - if (is_ipi) - *is_ipi = 0; - return mpic; - } - mpic = mpic -> next; - } - return NULL; -} - -/* Convert a cpu mask from logical to physical cpu numbers. */ -static inline u32 mpic_physmask(u32 cpumask) -{ - int i; - u32 mask = 0; - - for (i = 0; i < NR_CPUS; ++i, cpumask >>= 1) - mask |= (cpumask & 1) << get_hard_smp_processor_id(i); - return mask; -} - -#ifdef CONFIG_SMP -/* Get the mpic structure from the IPI number */ -static inline struct mpic * mpic_from_ipi(unsigned int ipi) -{ - return container_of(irq_desc[ipi].handler, struct mpic, hc_ipi); -} -#endif - -/* Get the mpic structure from the irq number */ -static inline struct mpic * mpic_from_irq(unsigned int irq) -{ - return container_of(irq_desc[irq].handler, struct mpic, hc_irq); -} - -/* Send an EOI */ -static inline void mpic_eoi(struct mpic *mpic) -{ - mpic_cpu_write(MPIC_CPU_EOI, 0); - (void)mpic_cpu_read(MPIC_CPU_WHOAMI); -} - -#ifdef CONFIG_SMP -static irqreturn_t mpic_ipi_action(int irq, void *dev_id, struct pt_regs *regs) -{ - struct mpic *mpic = dev_id; - - smp_message_recv(irq - mpic->ipi_offset, regs); - return IRQ_HANDLED; -} -#endif /* CONFIG_SMP */ - -/* - * Linux descriptor level callbacks - */ - - -static void mpic_enable_irq(unsigned int irq) -{ - unsigned int loops = 100000; - struct mpic *mpic = mpic_from_irq(irq); - unsigned int src = irq - mpic->irq_offset; - - DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq, src); - - mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI, - mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & - ~MPIC_VECPRI_MASK); - - /* make sure mask gets to controller before we return to user */ - do { - if (!loops--) { - printk(KERN_ERR "mpic_enable_irq timeout\n"); - break; - } - } while(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK); - -#ifdef CONFIG_MPIC_BROKEN_U3 - if (mpic->flags & MPIC_BROKEN_U3) { - unsigned int bsrc = irq - mpic->irq_offset; - if (mpic_is_ht_interrupt(mpic, bsrc) && - (irq_desc[irq].status & IRQ_LEVEL)) - mpic_ht_end_irq(mpic, bsrc); - } -#endif /* CONFIG_MPIC_BROKEN_U3 */ -} - -static unsigned int mpic_startup_irq(unsigned int irq) -{ -#ifdef CONFIG_MPIC_BROKEN_U3 - struct mpic *mpic = mpic_from_irq(irq); - unsigned int src = irq - mpic->irq_offset; -#endif /* CONFIG_MPIC_BROKEN_U3 */ - - mpic_enable_irq(irq); - -#ifdef CONFIG_MPIC_BROKEN_U3 - if (mpic_is_ht_interrupt(mpic, src)) - mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status); -#endif /* CONFIG_MPIC_BROKEN_U3 */ - - return 0; -} - -static void mpic_disable_irq(unsigned int irq) -{ - unsigned int loops = 100000; - struct mpic *mpic = mpic_from_irq(irq); - unsigned int src = irq - mpic->irq_offset; - - DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src); - - mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI, - mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) | - MPIC_VECPRI_MASK); - - /* make sure mask gets to controller before we return to user */ - do { - if (!loops--) { - printk(KERN_ERR "mpic_enable_irq timeout\n"); - break; - } - } while(!(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK)); -} - -static void mpic_shutdown_irq(unsigned int irq) -{ -#ifdef CONFIG_MPIC_BROKEN_U3 - struct mpic *mpic = mpic_from_irq(irq); - unsigned int src = irq - mpic->irq_offset; - - if (mpic_is_ht_interrupt(mpic, src)) - mpic_shutdown_ht_interrupt(mpic, src, irq_desc[irq].status); - -#endif /* CONFIG_MPIC_BROKEN_U3 */ - - mpic_disable_irq(irq); -} - -static void mpic_end_irq(unsigned int irq) -{ - struct mpic *mpic = mpic_from_irq(irq); - -#ifdef DEBUG_IRQ - DBG("%s: end_irq: %d\n", mpic->name, irq); -#endif - /* We always EOI on end_irq() even for edge interrupts since that - * should only lower the priority, the MPIC should have properly - * latched another edge interrupt coming in anyway - */ - -#ifdef CONFIG_MPIC_BROKEN_U3 - if (mpic->flags & MPIC_BROKEN_U3) { - unsigned int src = irq - mpic->irq_offset; - if (mpic_is_ht_interrupt(mpic, src) && - (irq_desc[irq].status & IRQ_LEVEL)) - mpic_ht_end_irq(mpic, src); - } -#endif /* CONFIG_MPIC_BROKEN_U3 */ - - mpic_eoi(mpic); -} - -#ifdef CONFIG_SMP - -static void mpic_enable_ipi(unsigned int irq) -{ - struct mpic *mpic = mpic_from_ipi(irq); - unsigned int src = irq - mpic->ipi_offset; - - DBG("%s: enable_ipi: %d (ipi %d)\n", mpic->name, irq, src); - mpic_ipi_write(src, mpic_ipi_read(src) & ~MPIC_VECPRI_MASK); -} - -static void mpic_disable_ipi(unsigned int irq) -{ - /* NEVER disable an IPI... that's just plain wrong! */ -} - -static void mpic_end_ipi(unsigned int irq) -{ - struct mpic *mpic = mpic_from_ipi(irq); - - /* - * IPIs are marked IRQ_PER_CPU. This has the side effect of - * preventing the IRQ_PENDING/IRQ_INPROGRESS logic from - * applying to them. We EOI them late to avoid re-entering. - * We mark IPI's with SA_INTERRUPT as they must run with - * irqs disabled. - */ - mpic_eoi(mpic); -} - -#endif /* CONFIG_SMP */ - -static void mpic_set_affinity(unsigned int irq, cpumask_t cpumask) -{ - struct mpic *mpic = mpic_from_irq(irq); - - cpumask_t tmp; - - cpus_and(tmp, cpumask, cpu_online_map); - - mpic_irq_write(irq - mpic->irq_offset, MPIC_IRQ_DESTINATION, - mpic_physmask(cpus_addr(tmp)[0])); -} - - -/* - * Exported functions - */ - - -struct mpic * __init mpic_alloc(unsigned long phys_addr, - unsigned int flags, - unsigned int isu_size, - unsigned int irq_offset, - unsigned int irq_count, - unsigned int ipi_offset, - unsigned char *senses, - unsigned int senses_count, - const char *name) -{ - struct mpic *mpic; - u32 reg; - const char *vers; - int i; - - mpic = alloc_bootmem(sizeof(struct mpic)); - if (mpic == NULL) - return NULL; - - - memset(mpic, 0, sizeof(struct mpic)); - mpic->name = name; - - mpic->hc_irq.typename = name; - mpic->hc_irq.startup = mpic_startup_irq; - mpic->hc_irq.shutdown = mpic_shutdown_irq; - mpic->hc_irq.enable = mpic_enable_irq; - mpic->hc_irq.disable = mpic_disable_irq; - mpic->hc_irq.end = mpic_end_irq; - if (flags & MPIC_PRIMARY) - mpic->hc_irq.set_affinity = mpic_set_affinity; -#ifdef CONFIG_SMP - mpic->hc_ipi.typename = name; - mpic->hc_ipi.enable = mpic_enable_ipi; - mpic->hc_ipi.disable = mpic_disable_ipi; - mpic->hc_ipi.end = mpic_end_ipi; -#endif /* CONFIG_SMP */ - - mpic->flags = flags; - mpic->isu_size = isu_size; - mpic->irq_offset = irq_offset; - mpic->irq_count = irq_count; - mpic->ipi_offset = ipi_offset; - mpic->num_sources = 0; /* so far */ - mpic->senses = senses; - mpic->senses_count = senses_count; - - /* Map the global registers */ - mpic->gregs = ioremap(phys_addr + MPIC_GREG_BASE, 0x1000); - mpic->tmregs = mpic->gregs + ((MPIC_TIMER_BASE - MPIC_GREG_BASE) >> 2); - BUG_ON(mpic->gregs == NULL); - - /* Reset */ - if (flags & MPIC_WANTS_RESET) { - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0, - mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0) - | MPIC_GREG_GCONF_RESET); - while( mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0) - & MPIC_GREG_GCONF_RESET) - mb(); - } - - /* Read feature register, calculate num CPUs and, for non-ISU - * MPICs, num sources as well. On ISU MPICs, sources are counted - * as ISUs are added - */ - reg = mpic_read(mpic->gregs, MPIC_GREG_FEATURE_0); - mpic->num_cpus = ((reg & MPIC_GREG_FEATURE_LAST_CPU_MASK) - >> MPIC_GREG_FEATURE_LAST_CPU_SHIFT) + 1; - if (isu_size == 0) - mpic->num_sources = ((reg & MPIC_GREG_FEATURE_LAST_SRC_MASK) - >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1; - - /* Map the per-CPU registers */ - for (i = 0; i < mpic->num_cpus; i++) { - mpic->cpuregs[i] = ioremap(phys_addr + MPIC_CPU_BASE + - i * MPIC_CPU_STRIDE, 0x1000); - BUG_ON(mpic->cpuregs[i] == NULL); - } - - /* Initialize main ISU if none provided */ - if (mpic->isu_size == 0) { - mpic->isu_size = mpic->num_sources; - mpic->isus[0] = ioremap(phys_addr + MPIC_IRQ_BASE, - MPIC_IRQ_STRIDE * mpic->isu_size); - BUG_ON(mpic->isus[0] == NULL); - } - mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1); - mpic->isu_mask = (1 << mpic->isu_shift) - 1; - - /* Display version */ - switch (reg & MPIC_GREG_FEATURE_VERSION_MASK) { - case 1: - vers = "1.0"; - break; - case 2: - vers = "1.2"; - break; - case 3: - vers = "1.3"; - break; - default: - vers = ""; - break; - } - printk(KERN_INFO "mpic: Setting up MPIC \"%s\" version %s at %lx, max %d CPUs\n", - name, vers, phys_addr, mpic->num_cpus); - printk(KERN_INFO "mpic: ISU size: %d, shift: %d, mask: %x\n", mpic->isu_size, - mpic->isu_shift, mpic->isu_mask); - - mpic->next = mpics; - mpics = mpic; - - if (flags & MPIC_PRIMARY) - mpic_primary = mpic; - - return mpic; -} - -void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num, - unsigned long phys_addr) -{ - unsigned int isu_first = isu_num * mpic->isu_size; - - BUG_ON(isu_num >= MPIC_MAX_ISU); - - mpic->isus[isu_num] = ioremap(phys_addr, MPIC_IRQ_STRIDE * mpic->isu_size); - if ((isu_first + mpic->isu_size) > mpic->num_sources) - mpic->num_sources = isu_first + mpic->isu_size; -} - -void __init mpic_setup_cascade(unsigned int irq, mpic_cascade_t handler, - void *data) -{ - struct mpic *mpic = mpic_find(irq, NULL); - unsigned long flags; - - /* Synchronization here is a bit dodgy, so don't try to replace cascade - * interrupts on the fly too often ... but normally it's set up at boot. - */ - spin_lock_irqsave(&mpic_lock, flags); - if (mpic->cascade) - mpic_disable_irq(mpic->cascade_vec + mpic->irq_offset); - mpic->cascade = NULL; - wmb(); - mpic->cascade_vec = irq - mpic->irq_offset; - mpic->cascade_data = data; - wmb(); - mpic->cascade = handler; - mpic_enable_irq(irq); - spin_unlock_irqrestore(&mpic_lock, flags); -} - -void __init mpic_init(struct mpic *mpic) -{ - int i; - - BUG_ON(mpic->num_sources == 0); - - printk(KERN_INFO "mpic: Initializing for %d sources\n", mpic->num_sources); - - /* Set current processor priority to max */ - mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0xf); - - /* Initialize timers: just disable them all */ - for (i = 0; i < 4; i++) { - mpic_write(mpic->tmregs, - i * MPIC_TIMER_STRIDE + MPIC_TIMER_DESTINATION, 0); - mpic_write(mpic->tmregs, - i * MPIC_TIMER_STRIDE + MPIC_TIMER_VECTOR_PRI, - MPIC_VECPRI_MASK | - (MPIC_VEC_TIMER_0 + i)); - } - - /* Initialize IPIs to our reserved vectors and mark them disabled for now */ - mpic_test_broken_ipi(mpic); - for (i = 0; i < 4; i++) { - mpic_ipi_write(i, - MPIC_VECPRI_MASK | - (10 << MPIC_VECPRI_PRIORITY_SHIFT) | - (MPIC_VEC_IPI_0 + i)); -#ifdef CONFIG_SMP - if (!(mpic->flags & MPIC_PRIMARY)) - continue; - irq_desc[mpic->ipi_offset+i].status |= IRQ_PER_CPU; - irq_desc[mpic->ipi_offset+i].handler = &mpic->hc_ipi; -#endif /* CONFIG_SMP */ - } - - /* Initialize interrupt sources */ - if (mpic->irq_count == 0) - mpic->irq_count = mpic->num_sources; - -#ifdef CONFIG_MPIC_BROKEN_U3 - /* Do the HT PIC fixups on U3 broken mpic */ - DBG("MPIC flags: %x\n", mpic->flags); - if ((mpic->flags & MPIC_BROKEN_U3) && (mpic->flags & MPIC_PRIMARY)) - mpic_scan_ht_pics(mpic); -#endif /* CONFIG_MPIC_BROKEN_U3 */ - - for (i = 0; i < mpic->num_sources; i++) { - /* start with vector = source number, and masked */ - u32 vecpri = MPIC_VECPRI_MASK | i | (8 << MPIC_VECPRI_PRIORITY_SHIFT); - int level = 0; - - /* if it's an IPI, we skip it */ - if ((mpic->irq_offset + i) >= (mpic->ipi_offset + i) && - (mpic->irq_offset + i) < (mpic->ipi_offset + i + 4)) - continue; - - /* do senses munging */ - if (mpic->senses && i < mpic->senses_count) { - if (mpic->senses[i] & IRQ_SENSE_LEVEL) - vecpri |= MPIC_VECPRI_SENSE_LEVEL; - if (mpic->senses[i] & IRQ_POLARITY_POSITIVE) - vecpri |= MPIC_VECPRI_POLARITY_POSITIVE; - } else - vecpri |= MPIC_VECPRI_SENSE_LEVEL; - - /* remember if it was a level interrupts */ - level = (vecpri & MPIC_VECPRI_SENSE_LEVEL); - - /* deal with broken U3 */ - if (mpic->flags & MPIC_BROKEN_U3) { -#ifdef CONFIG_MPIC_BROKEN_U3 - if (mpic_is_ht_interrupt(mpic, i)) { - vecpri &= ~(MPIC_VECPRI_SENSE_MASK | - MPIC_VECPRI_POLARITY_MASK); - vecpri |= MPIC_VECPRI_POLARITY_POSITIVE; - } -#else - printk(KERN_ERR "mpic: BROKEN_U3 set, but CONFIG doesn't match\n"); -#endif - } - - DBG("setup source %d, vecpri: %08x, level: %d\n", i, vecpri, - (level != 0)); - - /* init hw */ - mpic_irq_write(i, MPIC_IRQ_VECTOR_PRI, vecpri); - mpic_irq_write(i, MPIC_IRQ_DESTINATION, - 1 << hard_smp_processor_id()); - - /* init linux descriptors */ - if (i < mpic->irq_count) { - irq_desc[mpic->irq_offset+i].status = level ? IRQ_LEVEL : 0; - irq_desc[mpic->irq_offset+i].handler = &mpic->hc_irq; - } - } - - /* Init spurrious vector */ - mpic_write(mpic->gregs, MPIC_GREG_SPURIOUS, MPIC_VEC_SPURRIOUS); - - /* Disable 8259 passthrough */ - mpic_write(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0, - mpic_read(mpic->gregs, MPIC_GREG_GLOBAL_CONF_0) - | MPIC_GREG_GCONF_8259_PTHROU_DIS); - - /* Set current processor priority to 0 */ - mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0); -} - - - -void mpic_irq_set_priority(unsigned int irq, unsigned int pri) -{ - unsigned is_ipi; - struct mpic *mpic = mpic_find(irq, &is_ipi); - unsigned long flags; - u32 reg; - - spin_lock_irqsave(&mpic_lock, flags); - if (is_ipi) { - reg = mpic_ipi_read(irq - mpic->ipi_offset) & - ~MPIC_VECPRI_PRIORITY_MASK; - mpic_ipi_write(irq - mpic->ipi_offset, - reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); - } else { - reg = mpic_irq_read(irq - mpic->irq_offset,MPIC_IRQ_VECTOR_PRI) - & ~MPIC_VECPRI_PRIORITY_MASK; - mpic_irq_write(irq - mpic->irq_offset, MPIC_IRQ_VECTOR_PRI, - reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); - } - spin_unlock_irqrestore(&mpic_lock, flags); -} - -unsigned int mpic_irq_get_priority(unsigned int irq) -{ - unsigned is_ipi; - struct mpic *mpic = mpic_find(irq, &is_ipi); - unsigned long flags; - u32 reg; - - spin_lock_irqsave(&mpic_lock, flags); - if (is_ipi) - reg = mpic_ipi_read(irq - mpic->ipi_offset); - else - reg = mpic_irq_read(irq - mpic->irq_offset, MPIC_IRQ_VECTOR_PRI); - spin_unlock_irqrestore(&mpic_lock, flags); - return (reg & MPIC_VECPRI_PRIORITY_MASK) >> MPIC_VECPRI_PRIORITY_SHIFT; -} - -void mpic_setup_this_cpu(void) -{ -#ifdef CONFIG_SMP - struct mpic *mpic = mpic_primary; - unsigned long flags; - u32 msk = 1 << hard_smp_processor_id(); - unsigned int i; - - BUG_ON(mpic == NULL); - - DBG("%s: setup_this_cpu(%d)\n", mpic->name, hard_smp_processor_id()); - - spin_lock_irqsave(&mpic_lock, flags); - - /* let the mpic know we want intrs. default affinity is 0xffffffff - * until changed via /proc. That's how it's done on x86. If we want - * it differently, then we should make sure we also change the default - * values of irq_affinity in irq.c. - */ - if (distribute_irqs) { - for (i = 0; i < mpic->num_sources ; i++) - mpic_irq_write(i, MPIC_IRQ_DESTINATION, - mpic_irq_read(i, MPIC_IRQ_DESTINATION) | msk); - } - - /* Set current processor priority to 0 */ - mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0); - - spin_unlock_irqrestore(&mpic_lock, flags); -#endif /* CONFIG_SMP */ -} - -int mpic_cpu_get_priority(void) -{ - struct mpic *mpic = mpic_primary; - - return mpic_cpu_read(MPIC_CPU_CURRENT_TASK_PRI); -} - -void mpic_cpu_set_priority(int prio) -{ - struct mpic *mpic = mpic_primary; - - prio &= MPIC_CPU_TASKPRI_MASK; - mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, prio); -} - -/* - * XXX: someone who knows mpic should check this. - * do we need to eoi the ipi including for kexec cpu here (see xics comments)? - * or can we reset the mpic in the new kernel? - */ -void mpic_teardown_this_cpu(int secondary) -{ - struct mpic *mpic = mpic_primary; - unsigned long flags; - u32 msk = 1 << hard_smp_processor_id(); - unsigned int i; - - BUG_ON(mpic == NULL); - - DBG("%s: teardown_this_cpu(%d)\n", mpic->name, hard_smp_processor_id()); - spin_lock_irqsave(&mpic_lock, flags); - - /* let the mpic know we don't want intrs. */ - for (i = 0; i < mpic->num_sources ; i++) - mpic_irq_write(i, MPIC_IRQ_DESTINATION, - mpic_irq_read(i, MPIC_IRQ_DESTINATION) & ~msk); - - /* Set current processor priority to max */ - mpic_cpu_write(MPIC_CPU_CURRENT_TASK_PRI, 0xf); - - spin_unlock_irqrestore(&mpic_lock, flags); -} - - -void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask) -{ - struct mpic *mpic = mpic_primary; - - BUG_ON(mpic == NULL); - -#ifdef DEBUG_IPI - DBG("%s: send_ipi(ipi_no: %d)\n", mpic->name, ipi_no); -#endif - - mpic_cpu_write(MPIC_CPU_IPI_DISPATCH_0 + ipi_no * 0x10, - mpic_physmask(cpu_mask & cpus_addr(cpu_online_map)[0])); -} - -int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs) -{ - u32 irq; - - irq = mpic_cpu_read(MPIC_CPU_INTACK) & MPIC_VECPRI_VECTOR_MASK; -#ifdef DEBUG_LOW - DBG("%s: get_one_irq(): %d\n", mpic->name, irq); -#endif - if (mpic->cascade && irq == mpic->cascade_vec) { -#ifdef DEBUG_LOW - DBG("%s: cascading ...\n", mpic->name); -#endif - irq = mpic->cascade(regs, mpic->cascade_data); - mpic_eoi(mpic); - return irq; - } - if (unlikely(irq == MPIC_VEC_SPURRIOUS)) - return -1; - if (irq < MPIC_VEC_IPI_0) { -#ifdef DEBUG_IRQ - DBG("%s: irq %d\n", mpic->name, irq + mpic->irq_offset); -#endif - return irq + mpic->irq_offset; - } -#ifdef DEBUG_IPI - DBG("%s: ipi %d !\n", mpic->name, irq - MPIC_VEC_IPI_0); -#endif - return irq - MPIC_VEC_IPI_0 + mpic->ipi_offset; -} - -int mpic_get_irq(struct pt_regs *regs) -{ - struct mpic *mpic = mpic_primary; - - BUG_ON(mpic == NULL); - - return mpic_get_one_irq(mpic, regs); -} - - -#ifdef CONFIG_SMP -void mpic_request_ipis(void) -{ - struct mpic *mpic = mpic_primary; - - BUG_ON(mpic == NULL); - - printk("requesting IPIs ... \n"); - - /* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */ - request_irq(mpic->ipi_offset+0, mpic_ipi_action, SA_INTERRUPT, - "IPI0 (call function)", mpic); - request_irq(mpic->ipi_offset+1, mpic_ipi_action, SA_INTERRUPT, - "IPI1 (reschedule)", mpic); - request_irq(mpic->ipi_offset+2, mpic_ipi_action, SA_INTERRUPT, - "IPI2 (unused)", mpic); - request_irq(mpic->ipi_offset+3, mpic_ipi_action, SA_INTERRUPT, - "IPI3 (debugger break)", mpic); - - printk("IPIs requested... \n"); -} - -void smp_mpic_message_pass(int target, int msg) -{ - /* make sure we're sending something that translates to an IPI */ - if ((unsigned int)msg > 3) { - printk("SMP %d: smp_message_pass: unknown msg %d\n", - smp_processor_id(), msg); - return; - } - switch (target) { - case MSG_ALL: - mpic_send_ipi(msg, 0xffffffff); - break; - case MSG_ALL_BUT_SELF: - mpic_send_ipi(msg, 0xffffffff & ~(1 << smp_processor_id())); - break; - default: - mpic_send_ipi(msg, 1 << target); - break; - } -} -#endif /* CONFIG_SMP */ diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/mpic_init.c --- a/xen/arch/powerpc/mpic_init.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,416 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#include -#include -#include -#include -#include -#include "mpic_init.h" -#include "oftree.h" -#include "of-devtree.h" - -#undef DEBUG -#define CONFIG_SHARE_MPIC - -#ifdef DEBUG -#define DBG(fmt...) printk(fmt) -#else -#define DBG(fmt...) -#endif - -#define PANIC(fmt...) DBG(fmt) - -static struct mpic *mpic; -static unsigned long opic_addr; -static unsigned int opic_flags; - -/* - * from OF_IEEE_1275 - * - * pg 175, property "ranges" - * - * The number of integers in each size entry is determined by the - * value of the #size-cells property of this node (the node in which - * the ranges property appears) or 1 if the #size-cells property is - * absent. - * - * - * pg 177, property "reg" - * - * The number of integers in each size entry is determined by the - * value of the "#size-cells" property in the parent node. If the - * parent node has no such property, the value is one. - */ -static unsigned long reg2(void *oft_p, ofdn_t c) -{ - int rc; - /* the struct isa_reg_property is for a value of 2 for - * #address-cells and a value of 1 for #size-cells (of the - * parent). - */ - struct isa_reg_property { - u32 space; - u32 address; - u32 size; - } isa_reg; - - rc = ofd_getprop(oft_p, c, "reg", &isa_reg, sizeof(isa_reg)); - - DBG("%s: reg property address=0x%08x size=0x%08x\n", __func__, - isa_reg.address, isa_reg.size); - return isa_reg.address; -} - -static unsigned long reg1(void *oft_p, ofdn_t c) -{ - int rc; - /* the struct reg_property32 is for a value of 1 for - * #address-cells and a value of 1 for #size-cells. - */ - struct reg_property32 { - u32 address; - u32 size; - } reg; - - rc = ofd_getprop(oft_p, c, "reg", ®, sizeof(reg)); - - DBG("%s: reg property address=0x%08x size=0x%08x\n", __func__, - reg.address, reg.size); - return reg.address; -} - -static unsigned long find_reg_addr_from_node(void *oft_p, ofdn_t c) -{ - int p_len; - unsigned long reg_addr = 0; - u32 size_c = 1; - u32 addr_c = 2; - ofdn_t parent; - - if (c == OFD_ROOT) { - parent = c; - } else { - parent = ofd_node_parent(oft_p, c); - } - - p_len = ofd_getprop(oft_p, parent, "#size-cells", &size_c, sizeof(size_c)); - DBG("%s size is %d\n", __func__, size_c); - - p_len = ofd_getprop(oft_p, parent, "#address-cells", &addr_c, - sizeof(addr_c)); - DBG("%s address is %d\n", __func__, addr_c); - - if ( 1 != size_c ) { - PANIC("Unsupported size for reg property\n"); - } - - if ( 1 == addr_c) { - reg_addr = reg1(oft_p, c); - } else if ( 2 == addr_c ) { - reg_addr = reg2(oft_p, c); - } else { - PANIC("Unsupported address size for reg property\n"); - } - DBG("%s: address 0x%lx\n", __func__, reg_addr); - return reg_addr; -} - -/* - * from OF_IEEE_1275 - * - * pg 175, property "ranges" - * - * The ranges property value is a sequence of child-phys parent-phys - * size specifications. Child-phys is an address, encoded as with - * encode-phys, in the child address space. Parent-phys is an address - * (likewise encoded as with encode-phys) in the parent address - * space. Size is a list of integers, each encoded as with encode-int, - * denoting the length of the child's address range. - */ -static unsigned long find_ranges_addr_from_node(void *oft_p, ofdn_t c) -{ - unsigned long ranges_addr = 0; - int ranges_i; - ofdn_t parent; - u32 addr_c = 2; - u32 ranges[64]; - int p_len; - int i; - - parent = ofd_node_parent(oft_p, c); - parent = ofd_node_parent(oft_p, parent); - - p_len = ofd_getprop(oft_p, parent, "ranges", &ranges, sizeof(ranges)); - DBG("%s: ranges\n", __func__); - for (i=0; i= 0) { - DBG("%s: Big Endian found\n", __func__); - flags |= MPIC_BIG_ENDIAN; - } - DBG("%s: flags 0x%x\n", __func__, flags); - return flags; -} - -static int find_mpic_simple_probe(void *oft_p) -{ - u32 addr_cells; - int rc; - u32 addr[2]; - - rc = ofd_getprop(oft_p, OFD_ROOT, "#address-cells", - &addr_cells, sizeof(addr_cells)); - if ( rc < 0 ) { - /* if the property does not exist use its default value, 2 */ - addr_cells = 2; - } - - rc = ofd_getprop(oft_p, OFD_ROOT, "platform-open-pic", addr, sizeof(addr)); - if (rc < 0) { - return rc; - } - - opic_addr = addr[0]; - if (addr_cells == 2) { - opic_addr <<= 32; - opic_addr |= addr[1]; - } - DBG("%s: found OpenPIC at: 0x%lx\n", __func__, opic_addr); - /* we did not really find the pic device, only its address. - * We use big endian and broken u3 by default. - */ - opic_flags |= MPIC_BIG_ENDIAN | MPIC_BROKEN_U3; - return 0; -} - -static int find_mpic_canonical_probe(void *oft_p) -{ - ofdn_t c; - const char mpic_type[] = "open-pic"; - /* some paths are special and we cannot find the address - * by the usual method */ - const char *excluded_paths[] = { "/interrupt-controller" }; - - /* - * Search through the OFD tree for all devices of type 'open_pic'. - * We select the one without an 'interrupt' property. - */ - c = ofd_node_find_by_prop(oft_p, OFD_ROOT, "device_type", mpic_type, - sizeof(mpic_type)); - while (c > 0) { - int int_len; - int good_mpic; - const char * path = ofd_node_path(oft_p, c); - - good_mpic = 0; - int_len = ofd_getprop(oft_p, c, "interrupts", NULL, 0); - if (int_len < 0) { - int i; - - /* there is no property interrupt. This could be the pic */ - DBG("%s: potential OpenPIC in: %s\n", __func__, path); - good_mpic = 1; - - for (i = 0; i < ARRAY_SIZE(excluded_paths) && good_mpic; i++) { - const char *excluded_path = excluded_paths[i]; - if (!strncmp(path, excluded_path, strlen(excluded_path))) - good_mpic = 0; - } - } - - if (good_mpic) { - DBG("%s: found OpenPIC in: %s\n", __func__, path); - opic_addr = find_pic_address_from_node(oft_p, c); - opic_flags = find_pic_flags_from_node(oft_p, c); - return 0; - } - - c = ofd_node_find_next(oft_p, c); - } - - DBG("%s: Could not find a pic\n", __func__); - return -1; -} - -static int find_mpic(void) -{ - void *oft_p; - int rc; - - opic_addr = (unsigned long)-1; - opic_flags = 0; - - oft_p = (void *)oftree; - rc = find_mpic_simple_probe(oft_p); - - if (rc < 0) { - DBG("%s: Searching for pic ...\n", __func__); - rc = find_mpic_canonical_probe(oft_p); - } - - return rc; -} - -static unsigned int mpic_startup_ipi(unsigned int irq) -{ - mpic->hc_ipi.enable(irq); - return 0; -} - -int request_irq(unsigned int irq, - irqreturn_t (*handler)(int, void *, struct cpu_user_regs *), - unsigned long irqflags, const char * devname, void *dev_id) -{ - int retval; - struct irqaction *action; - void (*func)(int, void *, struct cpu_user_regs *); - - action = xmalloc(struct irqaction); - if (!action) { - BUG(); - return -ENOMEM; - } - - /* Xen's handler prototype is slightly different than Linux's. */ - func = (void (*)(int, void *, struct cpu_user_regs *))handler; - - action->handler = func; - action->name = devname; - action->dev_id = dev_id; - - retval = setup_irq(irq, action); - if (retval) { - BUG(); - xfree(action); - } - - return retval; -} - -static void dummy_ack(unsigned int irq) -{ -} - -void xen_mpic_init(void) -{ - unsigned int isu_size; - unsigned int irq_offset; - unsigned int irq_count; - unsigned int ipi_offset; - unsigned char *senses; - unsigned int senses_count; - - printk("%s: start\n", __func__); - - io_apic_irqs = ~0; /* all IRQs go through IOAPIC */ - irq_vector[0] = FIRST_DEVICE_VECTOR; - vector_irq[FIRST_DEVICE_VECTOR] = 0; - - isu_size = 0; - irq_offset = 0; - irq_count = 128; - ipi_offset = 128; - senses = NULL; - senses_count = 0; - - if (find_mpic()) { - printk("%s: ERROR: Could not find open pic.\n", __func__); - return; - } - - mpic = mpic_alloc(opic_addr, - opic_flags | MPIC_PRIMARY | MPIC_WANTS_RESET, - isu_size, irq_offset, irq_count, - ipi_offset, senses, senses_count, "Xen-U3-MPIC"); - - BUG_ON(mpic == NULL); - mpic_init(mpic); - - printk("%s: success\n", __func__); - - mpic->hc_irq.ack = dummy_ack; - mpic->hc_ipi.ack = dummy_ack; - mpic->hc_ipi.startup = mpic_startup_ipi; - mpic_request_ipis(); -} - -/* Note: reading the vector implicitly ACKs it in hardware. */ -int xen_mpic_get_irq(struct cpu_user_regs *regs) -{ - BUG_ON(mpic == NULL); - - return mpic_get_one_irq(mpic, regs); -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/mpic_init.h --- a/xen/arch/powerpc/mpic_init.h Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#ifndef _MPIC_INIT_H -#define _MPIC_INIT_H - -extern void xen_mpic_init(void); -extern int xen_mpic_get_irq(struct cpu_user_regs *regs); - -#endif /* #ifndef _MPIC_INIT_H */ diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/multiboot2.c --- a/xen/arch/powerpc/multiboot2.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2006, 2007 - * - * Authors: Hollis Blanchard - */ - -#include -#include -#include -#include -#include - -static struct mb2_tag_module *mb2_tag_mod_find(struct mb2_tag_header *tags, - const char *type) -{ - struct mb2_tag_header *tag; - - for_each_tag(tag, tags) { - if (tag->key == MB2_TAG_MODULE) { - struct mb2_tag_module *mod = (struct mb2_tag_module *)tag; - if (!strcmp((char *)mod->type, type)) - return mod; - } - } - return NULL; -} - -void parse_multiboot(ulong tags_addr) -{ - struct mb2_tag_header *tags = (struct mb2_tag_header *)tags_addr; - struct mb2_tag_module *mod; - - if (tags->key != MB2_TAG_START) - return; - - mod = mb2_tag_mod_find(tags, "kernel"); - if (mod) { - xen_cmdline = (char *)mod->cmdline; - } - - mod = mb2_tag_mod_find(tags, "dom0"); - if (mod) { - dom0_addr = mod->addr; - dom0_len = mod->size; - dom0_cmdline = (char *)mod->cmdline; - } - - mod = mb2_tag_mod_find(tags, "initrd"); - if (mod) { - initrd_start = mod->addr; - initrd_len = mod->size; - } -} diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/numa.c --- a/xen/arch/powerpc/numa.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -#include "../x86/numa.c" diff -r 0ac957f9d42e -r b0d7780794eb xen/arch/powerpc/of-devtree.c --- a/xen/arch/powerpc/of-devtree.c Thu May 08 13:15:45 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1087 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * This code is intended to be used but relocatable routines So PLEASE - * do not place any global data here including const integrals or - * literals. - * The local assert() is ok for string literal usage.. but thats it. - */ - - -#include -#include -#include -#include "of-devtree.h" - -static int (*ofd_write)(const char *, size_t len) = NULL; - -void ofd_init(int (*write)(const char *, size_t len)) -{ - ofd_write = write; -} - - -static void ofd_stop(void) -{ - for ( ; ; ) ; -} _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:52 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:52 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCd-00023O-CA for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:52 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBDC-0006DC-Uu; Thu, 08 May 2008 18:51:26 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCp-0005sf-Tk for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:51:03 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCc-0004JJ-FB for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:51:01 +0000 X-SBRS: 3.6 X-MesageID: 168919 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168919" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:50:01 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48Io1XR000320 for ; Thu, 8 May 2008 11:50:01 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoJLi005030 for ; Thu, 8 May 2008 11:50:19 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoJUs005029 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:19 -0700 Message-Id: <200805081850.m48IoJUs005029@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:18 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] i386: Remove non-PAE hypervisor build target. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210253531 -3600 # Node ID 8bd776540ab319d73b8e55656ad2c342c178a5b1 # Parent b0d7780794ebb087766391380b1c17467f016fb6 i386: Remove non-PAE hypervisor build target. Signed-off-by: Keir Fraser --- xen/include/asm-x86/x86_32/page-2level.h | 60 ------------ xen/include/asm-x86/x86_32/page-3level.h | 90 ------------------ Config.mk | 4 Makefile | 4 buildconfigs/mk.linux-2.6-common | 4 buildconfigs/mk.linux-2.6.5-SLES-xen | 2 buildconfigs/mk.linux-2.6.9-RHEL-xen | 2 extras/mini-os/Config.mk | 8 - extras/mini-os/arch/x86/arch.mk | 5 - extras/mini-os/arch/x86/mm.c | 17 --- extras/mini-os/arch/x86/setup.c | 2 extras/mini-os/arch/x86/traps.c | 5 - extras/mini-os/arch/x86/x86_32.S | 4 extras/mini-os/include/types.h | 6 - extras/mini-os/include/x86/arch_limits.h | 2 extras/mini-os/include/x86/arch_mm.h | 30 ------ extras/mini-os/include/x86/x86_32/hypercall-x86_32.h | 12 -- xen/arch/x86/Rules.mk | 5 - xen/arch/x86/boot/head.S | 24 ----- xen/arch/x86/boot/trampoline.S | 6 - xen/arch/x86/boot/wakeup.S | 6 - xen/arch/x86/boot/x86_32.S | 2 xen/arch/x86/domain_build.c | 6 - xen/arch/x86/hvm/vmx/vmcs.c | 2 xen/arch/x86/hvm/vmx/vmx.c | 4 xen/arch/x86/mm.c | 43 ++------ xen/arch/x86/mm/hap/hap.c | 44 --------- xen/arch/x86/mm/p2m.c | 2 xen/arch/x86/mm/shadow/Makefile | 5 - xen/arch/x86/mm/shadow/common.c | 91 ------------------- xen/arch/x86/mm/shadow/multi.c | 91 ------------------- xen/arch/x86/mm/shadow/private.h | 9 - xen/arch/x86/setup.c | 16 --- xen/arch/x86/traps.c | 4 xen/arch/x86/x86_32/mm.c | 11 -- xen/arch/x86/x86_32/traps.c | 10 -- xen/include/asm-x86/config.h | 41 ++------ xen/include/asm-x86/domain.h | 4 xen/include/asm-x86/fixmap.h | 2 xen/include/asm-x86/mm.h | 4 xen/include/asm-x86/page.h | 16 --- xen/include/asm-x86/types.h | 6 - xen/include/asm-x86/x86_32/page.h | 91 +++++++++++++++++-- xen/include/public/arch-x86/xen-x86_32.h | 7 - 44 files changed, 134 insertions(+), 675 deletions(-) diff -r b0d7780794eb -r 8bd776540ab3 Config.mk --- a/Config.mk Thu May 08 13:40:40 2008 +0100 +++ b/Config.mk Thu May 08 14:32:11 2008 +0100 @@ -7,10 +7,6 @@ XEN_COMPILE_ARCH ?= $(shell uname -m -e s/i86pc/x86_32/ -e s/amd64/x86_64/) XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH) XEN_OS ?= $(shell uname -s) - -ifeq ($(XEN_TARGET_ARCH),x86_32) -XEN_TARGET_X86_PAE ?= y -endif CONFIG_$(XEN_OS) := y diff -r b0d7780794eb -r 8bd776540ab3 Makefile --- a/Makefile Thu May 08 13:40:40 2008 +0100 +++ b/Makefile Thu May 08 14:32:11 2008 +0100 @@ -12,10 +12,6 @@ SUBARCH := $(subst x86_32,i386,$(XEN_TAR SUBARCH := $(subst x86_32,i386,$(XEN_TARGET_ARCH)) export XEN_TARGET_ARCH SUBARCH XEN_SYSTYPE include buildconfigs/Rules.mk - -ifeq ($(XEN_TARGET_X86_PAE),y) -export pae=y -endif # build and install everything into the standard system directories .PHONY: install diff -r b0d7780794eb -r 8bd776540ab3 buildconfigs/mk.linux-2.6-common --- a/buildconfigs/mk.linux-2.6-common Thu May 08 13:40:40 2008 +0100 +++ b/buildconfigs/mk.linux-2.6-common Thu May 08 14:32:11 2008 +0100 @@ -91,11 +91,7 @@ ifneq ($(XEN_LINUX_CONFIG_UPDATE),) sh $(XEN_LINUX_CONFIG_UPDATE) $(CONFIG_FILE) endif ifeq ($(XEN_TARGET_ARCH),x86_32) -ifeq ($(pae),y) sed -e 's!^CONFIG_HIGHMEM4G=y$$!\# CONFIG_HIGHMEM4G is not set!;s!^\# CONFIG_HIGHMEM64G is not set$$!CONFIG_HIGHMEM64G=y!' $(CONFIG_FILE) > $(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) -else - grep '^CONFIG_HIGHMEM64G=y' $(CONFIG_FILE) >/dev/null && ( sed -e 's!^CONFIG_HIGHMEM64G=y$$!\# CONFIG_HIGHMEM64G is not set!;s!^\# CONFIG_HIGHMEM4G is not set$$!CONFIG_HIGHMEM4G=y!' $(CONFIG_FILE) > $(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) ) || true -endif endif ifneq ($(EXTRAVERSION),) echo "$(EXTRAVERSION)" >$(LINUX_DIR)/localversion-xen diff -r b0d7780794eb -r 8bd776540ab3 buildconfigs/mk.linux-2.6.5-SLES-xen --- a/buildconfigs/mk.linux-2.6.5-SLES-xen Thu May 08 13:40:40 2008 +0100 +++ b/buildconfigs/mk.linux-2.6.5-SLES-xen Thu May 08 14:32:11 2008 +0100 @@ -1,6 +1,4 @@ -# This tree only supports PAE XEN_TARGET_ARCH = x86_32 -XEN_TARGET_X86_PAE = y EXTRAVERSION = -xen LINUX_VER = 2.6.5-SLES diff -r b0d7780794eb -r 8bd776540ab3 buildconfigs/mk.linux-2.6.9-RHEL-xen --- a/buildconfigs/mk.linux-2.6.9-RHEL-xen Thu May 08 13:40:40 2008 +0100 +++ b/buildconfigs/mk.linux-2.6.9-RHEL-xen Thu May 08 14:32:11 2008 +0100 @@ -1,6 +1,4 @@ -# This tree only supports PAE XEN_TARGET_ARCH = x86_32 -XEN_TARGET_X86_PAE = y EXTRAVERSION = -xen LINUX_VER = 2.6.9-RHEL diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/Config.mk --- a/extras/mini-os/Config.mk Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/Config.mk Thu May 08 14:32:11 2008 +0100 @@ -2,9 +2,6 @@ MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os export MINI-OS_ROOT -ifeq ($(XEN_TARGET_ARCH),x86_32) -export pae ?= y -endif libc = $(stubdom) XEN_INTERFACE_VERSION := 0x00030205 @@ -25,7 +22,6 @@ TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FA # Export these variables for possible use in architecture dependent makefiles. export TARGET_ARCH_DIR export TARGET_ARCH_FAM -export XEN_TARGET_X86_PAE # This is used for architecture specific links. # This can be overwritten from arch specific rules. @@ -70,7 +66,3 @@ ifneq ($(CAMLDIR),) ifneq ($(CAMLDIR),) caml=y endif - -ifeq ($(pae),y) -DEF_CPPFLAGS += -DCONFIG_X86_PAE -endif diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/arch/x86/arch.mk --- a/extras/mini-os/arch/x86/arch.mk Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/arch/x86/arch.mk Thu May 08 14:32:11 2008 +0100 @@ -9,11 +9,6 @@ ARCH_ASFLAGS := -m32 ARCH_ASFLAGS := -m32 EXTRA_INC += $(TARGET_ARCH_FAM)/$(XEN_TARGET_ARCH) EXTRA_SRC += arch/$(EXTRA_INC) - -ifeq ($(XEN_TARGET_X86_PAE),y) -ARCH_CFLAGS += -DCONFIG_X86_PAE=1 -ARCH_ASFLAGS += -DCONFIG_X86_PAE=1 -endif endif ifeq ($(XEN_TARGET_ARCH),x86_64) diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/arch/x86/mm.c --- a/extras/mini-os/arch/x86/mm.c Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/arch/x86/mm.c Thu May 08 14:32:11 2008 +0100 @@ -79,13 +79,11 @@ void new_pt_frame(unsigned long *pt_pfn, prot_t = L2_PROT; pincmd = MMUEXT_PIN_L1_TABLE; break; -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) case L2_FRAME: prot_e = L2_PROT; prot_t = L3_PROT; pincmd = MMUEXT_PIN_L2_TABLE; break; -#endif #if defined(__x86_64__) case L3_FRAME: prot_e = L3_PROT; @@ -102,11 +100,8 @@ void new_pt_frame(unsigned long *pt_pfn, /* Update the entry */ #if defined(__x86_64__) tab = pte_to_virt(tab[l4_table_offset(pt_page)]); +#endif tab = pte_to_virt(tab[l3_table_offset(pt_page)]); -#endif -#if defined(CONFIG_X86_PAE) - tab = pte_to_virt(tab[l3_table_offset(pt_page)]); -#endif mmu_updates[0].ptr = ((pgentry_t)tab[l2_table_offset(pt_page)] & PAGE_MASK) + sizeof(pgentry_t) * l1_table_offset(pt_page); @@ -164,7 +159,6 @@ static int need_pt_frame(unsigned long v } else #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) if(level == L2_FRAME) { #if defined(__x86_64__) @@ -181,7 +175,6 @@ static int need_pt_frame(unsigned long v return 1; } else -#endif /* defined(__x86_64__) || defined(CONFIG_X86_PAE) */ /* Always need l1 frames */ if(level == L1_FRAME) @@ -236,7 +229,6 @@ void build_pagetable(unsigned long *star mfn = pte_to_mfn(page); tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) offset = l3_table_offset(start_address); /* Need new L2 pt frame */ if(!(start_address & L2_MASK)) @@ -246,7 +238,6 @@ void build_pagetable(unsigned long *star page = tab[offset]; mfn = pte_to_mfn(page); tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT); -#endif offset = l2_table_offset(start_address); /* Need new L1 pt frame */ if(!(start_address & L1_MASK)) @@ -298,12 +289,10 @@ static void set_readonly(void *text, voi mfn = pte_to_mfn(page); tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) offset = l3_table_offset(start_address); page = tab[offset]; mfn = pte_to_mfn(page); tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT); -#endif offset = l2_table_offset(start_address); page = tab[offset]; mfn = pte_to_mfn(page); @@ -382,13 +371,11 @@ static pgentry_t *get_pgt(unsigned long mfn = pte_to_mfn(tab[offset]); tab = mfn_to_virt(mfn); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) offset = l3_table_offset(addr); if (!(tab[offset] & _PAGE_PRESENT)) return NULL; mfn = pte_to_mfn(tab[offset]); tab = mfn_to_virt(mfn); -#endif offset = l2_table_offset(addr); if (!(tab[offset] & _PAGE_PRESENT)) return NULL; @@ -418,7 +405,6 @@ static pgentry_t *need_pgt(unsigned long mfn = pte_to_mfn(tab[offset]); tab = mfn_to_virt(mfn); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) offset = l3_table_offset(addr); if (!(tab[offset] & _PAGE_PRESENT)) { pt_pfn = virt_to_pfn(alloc_page()); @@ -427,7 +413,6 @@ static pgentry_t *need_pgt(unsigned long ASSERT(tab[offset] & _PAGE_PRESENT); mfn = pte_to_mfn(tab[offset]); tab = mfn_to_virt(mfn); -#endif offset = l2_table_offset(addr); if (!(tab[offset] & _PAGE_PRESENT)) { pt_pfn = virt_to_pfn(alloc_page()); diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/arch/x86/setup.c --- a/extras/mini-os/arch/x86/setup.c Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/arch/x86/setup.c Thu May 08 14:32:11 2008 +0100 @@ -53,7 +53,7 @@ void hypervisor_callback(void); void hypervisor_callback(void); void failsafe_callback(void); -#if !defined(CONFIG_X86_PAE) +#if defined(__x86_64__) #define __pte(x) ((pte_t) { (x) } ) #else #define __pte(x) ({ unsigned long long _x = (x); \ diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/arch/x86/traps.c --- a/extras/mini-os/arch/x86/traps.c Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/arch/x86/traps.c Thu May 08 14:32:11 2008 +0100 @@ -104,11 +104,9 @@ void page_walk(unsigned long virt_addres tab = pte_to_virt(page); printk(" L4 = %"PRIpte" (%p) [offset = %lx]\n", page, tab, l4_table_offset(addr)); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) page = tab[l3_table_offset(addr)]; tab = pte_to_virt(page); printk(" L3 = %"PRIpte" (%p) [offset = %lx]\n", page, tab, l3_table_offset(addr)); -#endif page = tab[l2_table_offset(addr)]; tab = pte_to_virt(page); printk(" L2 = %"PRIpte" (%p) [offset = %lx]\n", page, tab, l2_table_offset(addr)); @@ -129,12 +127,11 @@ static int handle_cow(unsigned long addr return 0; tab = pte_to_virt(page); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) page = tab[l3_table_offset(addr)]; if (!(page & _PAGE_PRESENT)) return 0; tab = pte_to_virt(page); -#endif + page = tab[l2_table_offset(addr)]; if (!(page & _PAGE_PRESENT)) return 0; diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/arch/x86/x86_32.S --- a/extras/mini-os/arch/x86/x86_32.S Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/arch/x86/x86_32.S Thu May 08 14:32:11 2008 +0100 @@ -8,11 +8,7 @@ .ascii ",VIRT_BASE=0x0" /* &_text from minios_x86_32.lds */ .ascii ",ELF_PADDR_OFFSET=0x0" .ascii ",HYPERCALL_PAGE=0x2" -#ifdef CONFIG_X86_PAE .ascii ",PAE=yes" -#else - .ascii ",PAE=no" -#endif .ascii ",LOADER=generic" .byte 0 .text diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/include/types.h --- a/extras/mini-os/include/types.h Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/include/types.h Thu May 08 14:32:11 2008 +0100 @@ -43,11 +43,7 @@ typedef long long quad_t; typedef long long quad_t; typedef unsigned long long u_quad_t; -#if !defined(CONFIG_X86_PAE) -typedef struct { unsigned long pte_low; } pte_t; -#else typedef struct { unsigned long pte_low, pte_high; } pte_t; -#endif /* CONFIG_X86_PAE */ #elif defined(__x86_64__) || defined(__ia64__) typedef long quad_t; @@ -56,7 +52,7 @@ typedef struct { unsigned long pte; } pt typedef struct { unsigned long pte; } pte_t; #endif /* __i386__ || __x86_64__ */ -#if !defined(CONFIG_X86_PAE) +#ifdef __x86_64__ #define __pte(x) ((pte_t) { (x) } ) #else #define __pte(x) ({ unsigned long long _x = (x); \ diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/include/x86/arch_limits.h --- a/extras/mini-os/include/x86/arch_limits.h Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/include/x86/arch_limits.h Thu May 08 14:32:11 2008 +0100 @@ -7,7 +7,7 @@ #ifdef __ASSEMBLY__ #define __PAGE_SIZE (1 << __PAGE_SHIFT) #else -#ifndef CONFIG_X86_PAE +#ifdef __x86_64__ #define __PAGE_SIZE (1UL << __PAGE_SHIFT) #else #define __PAGE_SIZE (1ULL << __PAGE_SHIFT) diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/include/x86/arch_mm.h --- a/extras/mini-os/include/x86/arch_mm.h Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/include/x86/arch_mm.h Thu May 08 14:32:11 2008 +0100 @@ -44,24 +44,6 @@ #if defined(__i386__) -#if !defined(CONFIG_X86_PAE) - -#define L2_PAGETABLE_SHIFT 22 - -#define L1_PAGETABLE_ENTRIES 1024 -#define L2_PAGETABLE_ENTRIES 1024 - -#define PADDR_BITS 32 -#define PADDR_MASK (~0UL) - -#define NOT_L1_FRAMES 1 -#define PRIpte "08lx" -#ifndef __ASSEMBLY__ -typedef unsigned long pgentry_t; -#endif - -#else /* defined(CONFIG_X86_PAE) */ - #define L2_PAGETABLE_SHIFT 21 #define L3_PAGETABLE_SHIFT 30 @@ -85,8 +67,6 @@ typedef uint64_t pgentry_t; typedef uint64_t pgentry_t; #endif -#endif /* !defined(CONFIG_X86_PAE) */ - #elif defined(__x86_64__) #define L2_PAGETABLE_SHIFT 21 @@ -122,10 +102,8 @@ typedef unsigned long pgentry_t; (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1)) #define l2_table_offset(_a) \ (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1)) -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) #define l3_table_offset(_a) \ (((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1)) -#endif #if defined(__x86_64__) #define l4_table_offset(_a) \ (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1)) @@ -146,9 +124,7 @@ typedef unsigned long pgentry_t; #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED) #define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED) #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |_PAGE_USER) -#if defined(CONFIG_X86_PAE) #define L3_PROT (_PAGE_PRESENT) -#endif /* CONFIG_X86_PAE */ #elif defined(__x86_64__) #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER) #define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_USER) @@ -172,7 +148,7 @@ typedef unsigned long pgentry_t; #ifndef __ASSEMBLY__ /* Definitions for machine and pseudophysical addresses. */ -#ifdef CONFIG_X86_PAE +#ifdef __i386__ typedef unsigned long long paddr_t; typedef unsigned long long maddr_t; #else @@ -225,14 +201,10 @@ static __inline__ paddr_t machine_to_phy #define virtual_to_l3(_virt) PT_BASE #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) #define virtual_to_l2(_virt) ({ \ unsigned long __virt2 = (_virt); \ (pgentry_t *) pte_to_virt(virtual_to_l3(__virt2)[l3_table_offset(__virt2)]); \ }) -#else -#define virtual_to_l2(_virt) PT_BASE -#endif #define virtual_to_l1(_virt) ({ \ unsigned long __virt1 = (_virt); \ diff -r b0d7780794eb -r 8bd776540ab3 extras/mini-os/include/x86/x86_32/hypercall-x86_32.h --- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h Thu May 08 13:40:40 2008 +0100 +++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h Thu May 08 14:32:11 2008 +0100 @@ -220,12 +220,8 @@ HYPERVISOR_update_va_mapping( HYPERVISOR_update_va_mapping( unsigned long va, pte_t new_val, unsigned long flags) { - unsigned long pte_hi = 0; -#ifdef CONFIG_X86_PAE - pte_hi = new_val.pte_high; -#endif return _hypercall4(int, update_va_mapping, va, - new_val.pte_low, pte_hi, flags); + new_val.pte_low, new_val.pte_high, flags); } static inline int @@ -267,12 +263,8 @@ HYPERVISOR_update_va_mapping_otherdomain HYPERVISOR_update_va_mapping_otherdomain( unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) { - unsigned long pte_hi = 0; -#ifdef CONFIG_X86_PAE - pte_hi = new_val.pte_high; -#endif return _hypercall5(int, update_va_mapping_otherdomain, va, - new_val.pte_low, pte_hi, flags, domid); + new_val.pte_low, new_val.pte_high, flags, domid); } static inline int diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/Rules.mk --- a/xen/arch/x86/Rules.mk Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/Rules.mk Thu May 08 14:32:11 2008 +0100 @@ -9,7 +9,6 @@ xenoprof := y # If you change any of these configuration options then you must # 'make clean' before rebuilding. # -pae ?= n supervisor_mode_kernel ?= n # Solaris grabs stdarg.h and friends from the system include directory. @@ -30,10 +29,6 @@ CFLAGS += $(call cc-option,$(CC),-nopie, CFLAGS += $(call cc-option,$(CC),-nopie,) CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) - -ifeq ($(TARGET_SUBARCH)$(pae),x86_32y) -CFLAGS += -DCONFIG_X86_PAE=1 -endif ifeq ($(supervisor_mode_kernel),y) CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1 diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/boot/head.S --- a/xen/arch/x86/boot/head.S Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/boot/head.S Thu May 08 14:32:11 2008 +0100 @@ -132,7 +132,7 @@ 1: mov %eax,(%edi) mov %eax,sym_phys(idle_pg_table) + (262*8) /* PML4[262]: 1:1 map */ mov $(sym_phys(l3_xenmap)+7),%eax mov %eax,sym_phys(idle_pg_table) + (261*8) /* PML4[261]: xen map */ -#elif defined(CONFIG_X86_PAE) +#else /* Initialize low and high mappings of memory with 2MB pages */ mov $sym_phys(idle_pg_table_l2),%edi mov $0xe3,%eax /* PRESENT+RW+A+D+2MB */ @@ -147,19 +147,6 @@ 1: stosl /* low mappings cover up add $(1<>20(%edi) /* high mapping */ - stosl /* low mapping */ - add $(1<= 3 - add $4,%edi -#endif + add $4,%edi add $PAGE_SIZE,%eax inc %ecx /* VGA hole (0xa0000-0xc0000) should be mapped UC. */ @@ -188,12 +173,9 @@ 2: cmp $L1_PAGETABLE_ENTRIES,%e #if defined(__x86_64__) mov %edi,sym_phys(l2_identmap) mov %edi,sym_phys(l2_xenmap) -#elif defined(CONFIG_X86_PAE) +#else mov %edi,sym_phys(idle_pg_table_l2) mov %edi,sym_phys(idle_pg_table_l2) + (__PAGE_OFFSET>>18) -#else - mov %edi,sym_phys(idle_pg_table) - mov %edi,sym_phys(idle_pg_table) + (__PAGE_OFFSET>>20) #endif /* Copy bootstrap trampoline to low memory, below 1MB. */ diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/boot/trampoline.S --- a/xen/arch/x86/boot/trampoline.S Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/boot/trampoline.S Thu May 08 14:32:11 2008 +0100 @@ -60,11 +60,7 @@ trampoline_protmode_entry: fninit /* Initialise CR4. */ -#if CONFIG_PAGING_LEVELS == 2 - mov $X86_CR4_PSE,%ecx -#else mov $X86_CR4_PAE,%ecx -#endif mov %ecx,%cr4 /* Load pagetable base register. */ @@ -72,7 +68,6 @@ trampoline_protmode_entry: add bootsym_phys(trampoline_xen_phys_start),%eax mov %eax,%cr3 -#if CONFIG_PAGING_LEVELS != 2 /* Set up EFER (Extended Feature Enable Register). */ mov bootsym_phys(cpuid_ext_features),%edi test $0x20100800,%edi /* SYSCALL/SYSRET, No Execute, Long Mode? */ @@ -88,7 +83,6 @@ trampoline_protmode_entry: btsl $_EFER_NX,%eax /* No Execute */ 1: wrmsr .Lskip_efer: -#endif mov $0x80050033,%eax /* hi-to-lo: PG,AM,WP,NE,ET,MP,PE */ mov %eax,%cr0 diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/boot/wakeup.S --- a/xen/arch/x86/boot/wakeup.S Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/boot/wakeup.S Thu May 08 14:32:11 2008 +0100 @@ -126,11 +126,7 @@ wakeup_32: /* fpu init? */ /* Initialise CR4. */ -#if CONFIG_PAGING_LEVELS == 2 - mov $X86_CR4_PSE, %ecx -#else mov $X86_CR4_PAE, %ecx -#endif mov %ecx, %cr4 /* Load pagetable base register */ @@ -139,7 +135,6 @@ wakeup_32: mov %eax,%cr3 /* Will cpuid feature change after resume? */ -#if CONFIG_PAGING_LEVELS != 2 /* Set up EFER (Extended Feature Enable Register). */ mov bootsym_phys(cpuid_ext_features),%edi test $0x20100800,%edi /* SYSCALL/SYSRET, No Execute, Long Mode? */ @@ -155,7 +150,6 @@ wakeup_32: btsl $_EFER_NX,%eax /* No Execute */ 1: wrmsr .Lskip_eferw: -#endif wbinvd diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/boot/x86_32.S --- a/xen/arch/x86/boot/x86_32.S Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/boot/x86_32.S Thu May 08 14:32:11 2008 +0100 @@ -81,14 +81,12 @@ gdt_descr: .long gdt_table - FIRST_RESERVED_GDT_BYTE -#ifdef CONFIG_X86_PAE .align 32 ENTRY(idle_pg_table) .long sym_phys(idle_pg_table_l2) + 0*PAGE_SIZE + 0x01, 0 .long sym_phys(idle_pg_table_l2) + 1*PAGE_SIZE + 0x01, 0 .long sym_phys(idle_pg_table_l2) + 2*PAGE_SIZE + 0x01, 0 .long sym_phys(idle_pg_table_l2) + 3*PAGE_SIZE + 0x01, 0 -#endif .align PAGE_SIZE, 0 /* NB. Rings != 0 get access up to MACH2PHYS_VIRT_END. This allows access to */ diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/domain_build.c Thu May 08 14:32:11 2008 +0100 @@ -398,11 +398,7 @@ int __init construct_dom0( v_end = (vstack_end + (1UL<<22)-1) & ~((1UL<<22)-1); if ( (v_end - vstack_end) < (512UL << 10) ) v_end += 1UL << 22; /* Add extra 4MB to get >= 512kB padding. */ -#if defined(__i386__) && !defined(CONFIG_X86_PAE) - if ( (((v_end - v_start + ((1UL<> - L2_PAGETABLE_SHIFT) + 1) <= nr_pt_pages ) - break; -#elif defined(__i386__) && defined(CONFIG_X86_PAE) +#if defined(__i386__) /* 5 pages: 1x 3rd + 4x 2nd level */ if ( (((v_end - v_start + ((1UL<> L2_PAGETABLE_SHIFT) + 5) <= nr_pt_pages ) diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/hvm/vmx/vmcs.c --- a/xen/arch/x86/hvm/vmx/vmcs.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vmcs.c Thu May 08 14:32:11 2008 +0100 @@ -630,7 +630,7 @@ static int construct_vmcs(struct vcpu *v if ( paging_mode_hap(d) ) { __vmwrite(EPT_POINTER, d->arch.hvm_domain.vmx.ept_control.eptp); -#ifdef CONFIG_X86_PAE +#ifdef __i386__ __vmwrite(EPT_POINTER_HIGH, d->arch.hvm_domain.vmx.ept_control.eptp >> 32); #endif diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Thu May 08 14:32:11 2008 +0100 @@ -934,7 +934,7 @@ static void vmx_load_pdptrs(struct vcpu __vmwrite(GUEST_PDPTR1, guest_pdptrs[1]); __vmwrite(GUEST_PDPTR2, guest_pdptrs[2]); __vmwrite(GUEST_PDPTR3, guest_pdptrs[3]); -#ifdef CONFIG_X86_PAE +#ifdef __i386__ __vmwrite(GUEST_PDPTR0_HIGH, guest_pdptrs[0] >> 32); __vmwrite(GUEST_PDPTR1_HIGH, guest_pdptrs[1] >> 32); __vmwrite(GUEST_PDPTR2_HIGH, guest_pdptrs[2] >> 32); @@ -2253,7 +2253,7 @@ asmlinkage void vmx_vmexit_handler(struc case EXIT_REASON_EPT_VIOLATION: { paddr_t gpa = __vmread(GUEST_PHYSICAL_ADDRESS); -#ifdef CONFIG_X86_PAE +#ifdef __i386__ gpa |= (paddr_t)__vmread(GUEST_PHYSICAL_ADDRESS_HIGH) << 32; #endif exit_qualification = __vmread(EXIT_QUALIFICATION); diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/mm.c Thu May 08 14:32:11 2008 +0100 @@ -129,7 +129,7 @@ l1_pgentry_t __attribute__ ((__section__ * 1. Debug builds get extra checking by using CMPXCHG[8B]. * 2. PAE builds perform an atomic 8-byte store with CMPXCHG8B. */ -#if !defined(NDEBUG) || defined(CONFIG_X86_PAE) +#if !defined(NDEBUG) || defined(__i386__) #define PTE_UPDATE_WITH_CMPXCHG #endif @@ -340,7 +340,7 @@ void share_xen_page_with_privileged_gues share_xen_page_with_guest(page, dom_xen, readonly); } -#if defined(CONFIG_X86_PAE) +#if defined(__i386__) #ifdef NDEBUG /* Only PDPTs above 4GB boundary need to be shadowed in low memory. */ @@ -416,14 +416,14 @@ void make_cr3(struct vcpu *v, unsigned l spin_unlock(&cache->lock); } -#else /* !CONFIG_X86_PAE */ +#else /* !defined(__i386__) */ void make_cr3(struct vcpu *v, unsigned long mfn) { v->arch.cr3 = mfn << PAGE_SHIFT; } -#endif /* !CONFIG_X86_PAE */ +#endif /* !defined(__i386__) */ void write_ptbase(struct vcpu *v) { @@ -997,7 +997,6 @@ static int alloc_l1_table(struct page_in return 0; } -#if defined(CONFIG_X86_PAE) || defined(CONFIG_COMPAT) static int create_pae_xen_mappings(struct domain *d, l3_pgentry_t *pl3e) { struct page_info *page; @@ -1070,11 +1069,8 @@ static int create_pae_xen_mappings(struc return 1; } -#else -# define create_pae_xen_mappings(d, pl3e) (1) -#endif - -#ifdef CONFIG_X86_PAE + +#ifdef __i386__ /* Flush a pgdir update into low-memory caches. */ static void pae_flush_pgd( unsigned long mfn, unsigned int idx, l3_pgentry_t nl3e) @@ -1144,20 +1140,6 @@ static int alloc_l2_table(struct page_in adjust_guest_l2e(pl2e[i], d); } -#if CONFIG_PAGING_LEVELS == 2 - /* Xen private mappings. */ - memcpy(&pl2e[L2_PAGETABLE_FIRST_XEN_SLOT], - &idle_pg_table[L2_PAGETABLE_FIRST_XEN_SLOT], - L2_PAGETABLE_XEN_SLOTS * sizeof(l2_pgentry_t)); - pl2e[l2_table_offset(LINEAR_PT_VIRT_START)] = - l2e_from_pfn(pfn, __PAGE_HYPERVISOR); - for ( i = 0; i < PDPT_L2_ENTRIES; i++ ) - pl2e[l2_table_offset(PERDOMAIN_VIRT_START) + i] = - l2e_from_page( - virt_to_page(page_get_owner(page)->arch.mm_perdomain_pt) + i, - __PAGE_HYPERVISOR); -#endif - unmap_domain_page(pl2e); return 1; @@ -1180,7 +1162,7 @@ static int alloc_l3_table(struct page_in l3_pgentry_t *pl3e; int i; -#ifdef CONFIG_X86_PAE +#if CONFIG_PAGING_LEVELS == 3 /* * PAE pgdirs above 4GB are unacceptable if the guest does not understand * the weird 'extended cr3' format for dealing with high-order address @@ -1209,7 +1191,6 @@ static int alloc_l3_table(struct page_in for ( i = 0; i < L3_PAGETABLE_ENTRIES; i++ ) { -#if defined(CONFIG_X86_PAE) || defined(CONFIG_COMPAT) if ( is_pv_32bit_domain(d) && (i == 3) ) { if ( !(l3e_get_flags(pl3e[i]) & _PAGE_PRESENT) || @@ -1220,12 +1201,10 @@ static int alloc_l3_table(struct page_in d) ) goto fail; } - else -#endif - if ( is_guest_l3_slot(i) && - unlikely(!get_page_from_l3e(pl3e[i], pfn, d)) ) + else if ( is_guest_l3_slot(i) && + unlikely(!get_page_from_l3e(pl3e[i], pfn, d)) ) goto fail; - + adjust_guest_l3e(pl3e[i], d); } @@ -1562,14 +1541,12 @@ static int mod_l3_entry(l3_pgentry_t *pl return 0; } -#if defined(CONFIG_X86_PAE) || defined(CONFIG_COMPAT) /* * Disallow updates to final L3 slot. It contains Xen mappings, and it * would be a pain to ensure they remain continuously valid throughout. */ if ( is_pv_32bit_domain(d) && (pgentry_ptr_to_slot(pl3e) >= 3) ) return 0; -#endif if ( unlikely(__copy_from_user(&ol3e, pl3e, sizeof(ol3e)) != 0) ) return 0; diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/mm/hap/hap.c --- a/xen/arch/x86/mm/hap/hap.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/mm/hap/hap.c Thu May 08 14:32:11 2008 +0100 @@ -311,41 +311,6 @@ static void hap_install_xen_entries_in_l } #endif -#if CONFIG_PAGING_LEVELS == 2 -static void hap_install_xen_entries_in_l2(struct vcpu *v, mfn_t l2mfn) -{ - struct domain *d = v->domain; - l2_pgentry_t *l2e; - int i; - - l2e = hap_map_domain_page(l2mfn); - ASSERT(l2e != NULL); - - /* Copy the common Xen mappings from the idle domain */ - memcpy(&l2e[L2_PAGETABLE_FIRST_XEN_SLOT], - &idle_pg_table[L2_PAGETABLE_FIRST_XEN_SLOT], - L2_PAGETABLE_XEN_SLOTS * sizeof(l2_pgentry_t)); - - /* Install the per-domain mappings for this domain */ - for ( i = 0; i < PDPT_L2_ENTRIES; i++ ) - l2e[l2_table_offset(PERDOMAIN_VIRT_START) + i] = - l2e_from_pfn( - mfn_x(page_to_mfn(virt_to_page(d->arch.mm_perdomain_pt) + i)), - __PAGE_HYPERVISOR); - - /* Install the linear mapping */ - l2e[l2_table_offset(LINEAR_PT_VIRT_START)] = - l2e_from_pfn(mfn_x(l2mfn), __PAGE_HYPERVISOR); - - /* Install the domain-specific P2M table */ - l2e[l2_table_offset(RO_MPT_VIRT_START)] = - l2e_from_pfn(mfn_x(pagetable_get_mfn(d->arch.phys_table)), - __PAGE_HYPERVISOR); - - hap_unmap_domain_page(l2e); -} -#endif - static mfn_t hap_make_monitor_table(struct vcpu *v) { struct domain *d = v->domain; @@ -395,15 +360,6 @@ static mfn_t hap_make_monitor_table(stru HAP_PRINTK("new monitor table: %#lx\n", mfn_x(m3mfn)); return m3mfn; } -#else - { - mfn_t m2mfn; - if ( (pg = hap_alloc(d)) == NULL ) - goto oom; - m2mfn = page_to_mfn(pg);; - hap_install_xen_entries_in_l2(v, m2mfn); - return m2mfn; - } #endif oom: diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/mm/p2m.c Thu May 08 14:32:11 2008 +0100 @@ -488,8 +488,6 @@ int p2m_alloc_table(struct domain *d, PGT_l4_page_table #elif CONFIG_PAGING_LEVELS == 3 PGT_l3_page_table -#elif CONFIG_PAGING_LEVELS == 2 - PGT_l2_page_table #endif | 1 | PGT_validated; diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/mm/shadow/Makefile --- a/xen/arch/x86/mm/shadow/Makefile Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/mm/shadow/Makefile Thu May 08 14:32:11 2008 +0100 @@ -1,9 +1,4 @@ ifneq ($(pae),n) -ifneq ($(pae),n) obj-$(x86_32) += common.o g2_on_s3.o g3_on_s3.o -else -obj-$(x86_32) += common.o g2_on_s2.o -endif - obj-$(x86_64) += common.o g4_on_s4.o g3_on_s3.o g2_on_s3.o guest_levels = $(subst g,,$(filter g%,$(subst ., ,$(subst _, ,$(1))))) diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/mm/shadow/common.c Thu May 08 14:32:11 2008 +0100 @@ -68,8 +68,6 @@ void shadow_vcpu_init(struct vcpu *v) v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3); #elif CONFIG_PAGING_LEVELS == 3 v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3); -#elif CONFIG_PAGING_LEVELS == 2 - v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,2,2); #endif } @@ -504,27 +502,14 @@ sh_validate_guest_entry(struct vcpu *v, if ( !(page->count_info & PGC_page_table) ) return 0; /* Not shadowed at all */ -#if CONFIG_PAGING_LEVELS == 2 - if ( page->shadow_flags & SHF_L1_32 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 2, 2) - (v, gmfn, entry, size); -#else if ( page->shadow_flags & SHF_L1_32 ) result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 3, 2) (v, gmfn, entry, size); -#endif - -#if CONFIG_PAGING_LEVELS == 2 - if ( page->shadow_flags & SHF_L2_32 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 2, 2) - (v, gmfn, entry, size); -#else + if ( page->shadow_flags & SHF_L2_32 ) result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 3, 2) (v, gmfn, entry, size); -#endif - -#if CONFIG_PAGING_LEVELS >= 3 + if ( page->shadow_flags & SHF_L1_PAE ) result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 3, 3) (v, gmfn, entry, size); @@ -534,9 +519,6 @@ sh_validate_guest_entry(struct vcpu *v, if ( page->shadow_flags & SHF_L2H_PAE ) result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 3, 3) (v, gmfn, entry, size); -#else /* 32-bit non-PAE hypervisor does not support PAE guests */ - ASSERT((page->shadow_flags & (SHF_L2H_PAE|SHF_L2_PAE|SHF_L1_PAE)) == 0); -#endif #if CONFIG_PAGING_LEVELS >= 4 if ( page->shadow_flags & SHF_L1_64 ) @@ -554,7 +536,7 @@ sh_validate_guest_entry(struct vcpu *v, if ( page->shadow_flags & SHF_L4_64 ) result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl4e, 4, 4) (v, gmfn, entry, size); -#else /* 32-bit/PAE hypervisor does not support 64-bit guests */ +#else /* 32-bit hypervisor does not support 64-bit guests */ ASSERT((page->shadow_flags & (SHF_L4_64|SHF_L3_64|SHF_L2H_64|SHF_L2_64|SHF_L1_64)) == 0); #endif @@ -685,7 +667,6 @@ static inline u32 static inline u32 shadow_order(unsigned int shadow_type) { -#if CONFIG_PAGING_LEVELS > 2 static const u32 type_to_order[SH_type_unused] = { 0, /* SH_type_none */ 1, /* SH_type_l1_32_shadow */ @@ -706,9 +687,6 @@ shadow_order(unsigned int shadow_type) }; ASSERT(shadow_type < SH_type_unused); return type_to_order[shadow_type]; -#else /* 32-bit Xen only ever shadows 32-bit guests on 32-bit shadows. */ - return 0; -#endif } static inline unsigned int @@ -745,18 +723,12 @@ static void shadow_unhook_mappings(struc switch ( sp->type ) { case SH_type_l2_32_shadow: -#if CONFIG_PAGING_LEVELS == 2 - SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings,2,2)(v,smfn); -#else SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings,3,2)(v,smfn); -#endif break; -#if CONFIG_PAGING_LEVELS >= 3 case SH_type_l2_pae_shadow: case SH_type_l2h_pae_shadow: SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings,3,3)(v,smfn); break; -#endif #if CONFIG_PAGING_LEVELS >= 4 case SH_type_l4_64_shadow: SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings,4,4)(v,smfn); @@ -1599,15 +1571,6 @@ void sh_destroy_shadow(struct vcpu *v, m * small numbers that the compiler will enjoy */ switch ( t ) { -#if CONFIG_PAGING_LEVELS == 2 - case SH_type_l1_32_shadow: - case SH_type_fl1_32_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 2, 2)(v, smfn); - break; - case SH_type_l2_32_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 2, 2)(v, smfn); - break; -#else /* PAE or 64bit */ case SH_type_l1_32_shadow: case SH_type_fl1_32_shadow: SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3, 2)(v, smfn); @@ -1615,9 +1578,7 @@ void sh_destroy_shadow(struct vcpu *v, m case SH_type_l2_32_shadow: SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3, 2)(v, smfn); break; -#endif - -#if CONFIG_PAGING_LEVELS >= 3 + case SH_type_l1_pae_shadow: case SH_type_fl1_pae_shadow: SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3, 3)(v, smfn); @@ -1626,7 +1587,6 @@ void sh_destroy_shadow(struct vcpu *v, m case SH_type_l2h_pae_shadow: SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3, 3)(v, smfn); break; -#endif #if CONFIG_PAGING_LEVELS >= 4 case SH_type_l1_64_shadow: @@ -1666,21 +1626,11 @@ int sh_remove_write_access(struct vcpu * /* Dispatch table for getting per-type functions */ static hash_callback_t callbacks[SH_type_unused] = { NULL, /* none */ -#if CONFIG_PAGING_LEVELS == 2 - SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,2,2), /* l1_32 */ - SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,2,2), /* fl1_32 */ -#else SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,2), /* l1_32 */ SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,2), /* fl1_32 */ -#endif NULL, /* l2_32 */ -#if CONFIG_PAGING_LEVELS >= 3 SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,3), /* l1_pae */ SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,3), /* fl1_pae */ -#else - NULL, /* l1_pae */ - NULL, /* fl1_pae */ -#endif NULL, /* l2_pae */ NULL, /* l2h_pae */ #if CONFIG_PAGING_LEVELS >= 4 @@ -1860,21 +1810,11 @@ int sh_remove_all_mappings(struct vcpu * /* Dispatch table for getting per-type functions */ static hash_callback_t callbacks[SH_type_unused] = { NULL, /* none */ -#if CONFIG_PAGING_LEVELS == 2 - SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,2,2), /* l1_32 */ - SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,2,2), /* fl1_32 */ -#else SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,2), /* l1_32 */ SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,2), /* fl1_32 */ -#endif NULL, /* l2_32 */ -#if CONFIG_PAGING_LEVELS >= 3 SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,3), /* l1_pae */ SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,3), /* fl1_pae */ -#else - NULL, /* l1_pae */ - NULL, /* fl1_pae */ -#endif NULL, /* l2_pae */ NULL, /* l2h_pae */ #if CONFIG_PAGING_LEVELS >= 4 @@ -1978,13 +1918,8 @@ static int sh_remove_shadow_via_pointer( { case SH_type_l1_32_shadow: case SH_type_l2_32_shadow: -#if CONFIG_PAGING_LEVELS == 2 - SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,2,2)(v, vaddr, pmfn); -#else SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,3,2)(v, vaddr, pmfn); -#endif break; -#if CONFIG_PAGING_LEVELS >=3 case SH_type_l1_pae_shadow: case SH_type_l2_pae_shadow: case SH_type_l2h_pae_shadow: @@ -1999,7 +1934,6 @@ static int sh_remove_shadow_via_pointer( SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,4,4)(v, vaddr, pmfn); break; #endif -#endif default: BUG(); /* Some wierd unknown shadow type */ } @@ -2032,20 +1966,11 @@ void sh_remove_shadows(struct vcpu *v, m NULL, /* none */ NULL, /* l1_32 */ NULL, /* fl1_32 */ -#if CONFIG_PAGING_LEVELS == 2 - SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,2,2), /* l2_32 */ -#else SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,2), /* l2_32 */ -#endif NULL, /* l1_pae */ NULL, /* fl1_pae */ -#if CONFIG_PAGING_LEVELS >= 3 SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,3), /* l2_pae */ SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,3), /* l2h_pae */ -#else - NULL, /* l2_pae */ - NULL, /* l2h_pae */ -#endif NULL, /* l1_64 */ NULL, /* fl1_64 */ #if CONFIG_PAGING_LEVELS >= 4 @@ -2232,8 +2157,6 @@ static void sh_update_paging_modes(struc v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,4,4); #elif CONFIG_PAGING_LEVELS == 3 v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3); -#elif CONFIG_PAGING_LEVELS == 2 - v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,2,2); #else #error unexpected paging mode #endif @@ -3110,11 +3033,6 @@ void shadow_audit_tables(struct vcpu *v) /* Dispatch table for getting per-type functions */ static hash_callback_t callbacks[SH_type_unused] = { NULL, /* none */ -#if CONFIG_PAGING_LEVELS == 2 - SHADOW_INTERNAL_NAME(sh_audit_l1_table,2,2), /* l1_32 */ - SHADOW_INTERNAL_NAME(sh_audit_fl1_table,2,2), /* fl1_32 */ - SHADOW_INTERNAL_NAME(sh_audit_l2_table,2,2), /* l2_32 */ -#else SHADOW_INTERNAL_NAME(sh_audit_l1_table,3,2), /* l1_32 */ SHADOW_INTERNAL_NAME(sh_audit_fl1_table,3,2), /* fl1_32 */ SHADOW_INTERNAL_NAME(sh_audit_l2_table,3,2), /* l2_32 */ @@ -3130,7 +3048,6 @@ void shadow_audit_tables(struct vcpu *v) SHADOW_INTERNAL_NAME(sh_audit_l3_table,4,4), /* l3_64 */ SHADOW_INTERNAL_NAME(sh_audit_l4_table,4,4), /* l4_64 */ #endif /* CONFIG_PAGING_LEVELS >= 4 */ -#endif /* CONFIG_PAGING_LEVELS > 2 */ NULL /* All the rest */ }; unsigned int mask; diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Thu May 08 14:32:11 2008 +0100 @@ -1745,56 +1745,6 @@ static void sh_install_xen_entries_in_l2 #endif -#if CONFIG_PAGING_LEVELS == 2 && GUEST_PAGING_LEVELS == 2 -void sh_install_xen_entries_in_l2(struct vcpu *v, mfn_t gl2mfn, mfn_t sl2mfn) -{ - struct domain *d = v->domain; - shadow_l2e_t *sl2e; - int i; - - sl2e = sh_map_domain_page(sl2mfn); - ASSERT(sl2e != NULL); - ASSERT(sizeof (l2_pgentry_t) == sizeof (shadow_l2e_t)); - - /* Copy the common Xen mappings from the idle domain */ - memcpy(&sl2e[L2_PAGETABLE_FIRST_XEN_SLOT], - &idle_pg_table[L2_PAGETABLE_FIRST_XEN_SLOT], - L2_PAGETABLE_XEN_SLOTS * sizeof(l2_pgentry_t)); - - /* Install the per-domain mappings for this domain */ - for ( i = 0; i < PDPT_L2_ENTRIES; i++ ) - sl2e[shadow_l2_table_offset(PERDOMAIN_VIRT_START) + i] = - shadow_l2e_from_mfn( - page_to_mfn(virt_to_page(d->arch.mm_perdomain_pt) + i), - __PAGE_HYPERVISOR); - - /* Linear mapping */ - sl2e[shadow_l2_table_offset(SH_LINEAR_PT_VIRT_START)] = - shadow_l2e_from_mfn(sl2mfn, __PAGE_HYPERVISOR); - - if ( shadow_mode_translate(v->domain) && !shadow_mode_external(v->domain) ) - { - // linear tables may not be used with translated PV guests - sl2e[shadow_l2_table_offset(LINEAR_PT_VIRT_START)] = - shadow_l2e_empty(); - } - else - { - sl2e[shadow_l2_table_offset(LINEAR_PT_VIRT_START)] = - shadow_l2e_from_mfn(gl2mfn, __PAGE_HYPERVISOR); - } - - if ( shadow_mode_translate(d) ) - { - /* install domain-specific P2M table */ - sl2e[shadow_l2_table_offset(RO_MPT_VIRT_START)] = - shadow_l2e_from_mfn(pagetable_get_mfn(d->arch.phys_table), - __PAGE_HYPERVISOR); - } - - sh_unmap_domain_page(sl2e); -} -#endif @@ -1865,10 +1815,6 @@ sh_make_shadow(struct vcpu *v, mfn_t gmf #if CONFIG_PAGING_LEVELS >= 3 && GUEST_PAGING_LEVELS >= 3 case SH_type_l2h_shadow: sh_install_xen_entries_in_l2h(v, smfn); break; -#endif -#if CONFIG_PAGING_LEVELS == 2 && GUEST_PAGING_LEVELS == 2 - case SH_type_l2_shadow: - sh_install_xen_entries_in_l2(v, gmfn, smfn); break; #endif default: /* Do nothing */ break; } @@ -1987,17 +1933,6 @@ sh_make_monitor_table(struct vcpu *v) SHADOW_PRINTK("new monitor table: %#lx\n", mfn_x(m3mfn)); return m3mfn; - } - -#elif CONFIG_PAGING_LEVELS == 2 - - { - mfn_t m2mfn; - m2mfn = shadow_alloc(d, SH_type_monitor_table, 0); - sh_install_xen_entries_in_l2(v, m2mfn, m2mfn); - /* Remember the level of this table */ - mfn_to_page(m2mfn)->shadow_flags = 2; - return m2mfn; } #else @@ -3641,32 +3576,6 @@ sh_update_linear_entries(struct vcpu *v) sh_unmap_domain_page(l2e); } -#elif CONFIG_PAGING_LEVELS == 2 - - /* For PV, one l2e points at the guest l2, one points at the shadow - * l2. No maintenance required. - * For HVM, just need to update the l2e that points to the shadow l2. */ - - if ( shadow_mode_external(d) ) - { - /* Use the linear map if we can; otherwise make a new mapping */ - if ( v == current ) - { - __linear_l2_table[l2_linear_offset(SH_LINEAR_PT_VIRT_START)] = - l2e_from_pfn(pagetable_get_pfn(v->arch.shadow_table[0]), - __PAGE_HYPERVISOR); - } - else - { - l2_pgentry_t *ml2e; - ml2e = sh_map_domain_page(pagetable_get_mfn(v->arch.monitor_table)); - ml2e[l2_table_offset(SH_LINEAR_PT_VIRT_START)] = - l2e_from_pfn(pagetable_get_pfn(v->arch.shadow_table[0]), - __PAGE_HYPERVISOR); - sh_unmap_domain_page(ml2e); - } - } - #else #error this should not happen #endif diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/mm/shadow/private.h --- a/xen/arch/x86/mm/shadow/private.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/mm/shadow/private.h Thu May 08 14:32:11 2008 +0100 @@ -161,14 +161,6 @@ extern void shadow_audit_tables(struct v name ## __shadow_ ## shadow_levels ## _guest_ ## guest_levels #define SHADOW_INTERNAL_NAME(name, shadow_levels, guest_levels) \ SHADOW_INTERNAL_NAME_HIDDEN(name, shadow_levels, guest_levels) - -#if CONFIG_PAGING_LEVELS == 2 -#define GUEST_LEVELS 2 -#define SHADOW_LEVELS 2 -#include "multi.h" -#undef GUEST_LEVELS -#undef SHADOW_LEVELS -#endif /* CONFIG_PAGING_LEVELS == 2 */ #if CONFIG_PAGING_LEVELS == 3 #define GUEST_LEVELS 2 @@ -360,7 +352,6 @@ void shadow_free(struct domain *d, mfn_ /* Install the xen mappings in various flavours of shadow */ void sh_install_xen_entries_in_l4(struct vcpu *v, mfn_t gl4mfn, mfn_t sl4mfn); -void sh_install_xen_entries_in_l2(struct vcpu *v, mfn_t gl2mfn, mfn_t sl2mfn); /* Update the shadows in response to a pagetable write from Xen */ int sh_validate_guest_entry(struct vcpu *v, mfn_t gmfn, void *entry, u32 size); diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/setup.c Thu May 08 14:32:11 2008 +0100 @@ -121,11 +121,7 @@ char __attribute__ ((__section__(".bss.s struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 }; -#if CONFIG_PAGING_LEVELS > 2 unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE | X86_CR4_PAE; -#else -unsigned long mmu_cr4_features = X86_CR4_PSE; -#endif EXPORT_SYMBOL(mmu_cr4_features); int acpi_disabled; @@ -1064,17 +1060,7 @@ void arch_get_xen_caps(xen_capabilities_ (*info)[0] = '\0'; -#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE) - - snprintf(s, sizeof(s), "xen-%d.%d-x86_32 ", major, minor); - safe_strcat(*info, s); - if ( hvm_enabled ) - { - snprintf(s, sizeof(s), "hvm-%d.%d-x86_32 ", major, minor); - safe_strcat(*info, s); - } - -#elif defined(CONFIG_X86_32) && defined(CONFIG_X86_PAE) +#if defined(CONFIG_X86_32) snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor); safe_strcat(*info, s); diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/traps.c Thu May 08 14:32:11 2008 +0100 @@ -1021,13 +1021,13 @@ static int __spurious_page_fault( #if CONFIG_PAGING_LEVELS >= 3 l3t = map_domain_page(mfn); -#ifdef CONFIG_X86_PAE +#if CONFIG_PAGING_LEVELS == 3 l3t += (cr3 & 0xFE0UL) >> 3; #endif l3e = l3e_read_atomic(&l3t[l3_table_offset(addr)]); mfn = l3e_get_pfn(l3e); unmap_domain_page(l3t); -#ifdef CONFIG_X86_PAE +#if CONFIG_PAGING_LEVELS == 3 if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ) return 0; #else diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/x86_32/mm.c --- a/xen/arch/x86/x86_32/mm.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/x86_32/mm.c Thu May 08 14:32:11 2008 +0100 @@ -30,13 +30,8 @@ #include #include -#ifdef CONFIG_X86_PAE l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) idle_pg_table_l2[4 * L2_PAGETABLE_ENTRIES]; -#else -l2_pgentry_t __attribute__ ((__section__ (".bss.page_aligned"))) - idle_pg_table_l2[L2_PAGETABLE_ENTRIES]; -#endif extern l1_pgentry_t l1_identmap[L1_PAGETABLE_ENTRIES]; @@ -73,12 +68,6 @@ void __init paging_init(void) unsigned long v; struct page_info *pg; int i; - -#ifdef CONFIG_X86_PAE - printk("PAE enabled, limit: %d GB\n", MACHPHYS_MBYTES); -#else - printk("PAE disabled.\n"); -#endif if ( cpu_has_pge ) { diff -r b0d7780794eb -r 8bd776540ab3 xen/arch/x86/x86_32/traps.c --- a/xen/arch/x86/x86_32/traps.c Thu May 08 13:40:40 2008 +0100 +++ b/xen/arch/x86/x86_32/traps.c Thu May 08 14:32:11 2008 +0100 @@ -21,14 +21,10 @@ static void print_xen_info(void) static void print_xen_info(void) { char taint_str[TAINT_STRING_MAX_LEN]; - char debug = 'n', *arch = "x86_32"; + char debug = 'n', *arch = "x86_32p"; #ifndef NDEBUG debug = 'y'; -#endif - -#ifdef CONFIG_X86_PAE - arch = "x86_32p"; #endif printk("----[ Xen-%d.%d%s %s debug=%c %s ]----\n", @@ -117,9 +113,7 @@ void show_page_walk(unsigned long addr) void show_page_walk(unsigned long addr) { unsigned long pfn, mfn, cr3 = read_cr3(); -#ifdef CONFIG_X86_PAE l3_pgentry_t l3e, *l3t; -#endif l2_pgentry_t l2e, *l2t; l1_pgentry_t l1e, *l1t; @@ -127,7 +121,6 @@ void show_page_walk(unsigned long addr) mfn = cr3 >> PAGE_SHIFT; -#ifdef CONFIG_X86_PAE l3t = map_domain_page(mfn); l3t += (cr3 & 0xFE0UL) >> 3; l3e = l3t[l3_table_offset(addr)]; @@ -138,7 +131,6 @@ void show_page_walk(unsigned long addr) unmap_domain_page(l3t); if ( !(l3e_get_flags(l3e) & _PAGE_PRESENT) ) return; -#endif l2t = map_domain_page(mfn); l2e = l2t[l2_table_offset(addr)]; diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/config.h --- a/xen/include/asm-x86/config.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/include/asm-x86/config.h Thu May 08 14:32:11 2008 +0100 @@ -9,10 +9,8 @@ #if defined(__x86_64__) # define CONFIG_PAGING_LEVELS 4 -#elif defined(CONFIG_X86_PAE) +#else # define CONFIG_PAGING_LEVELS 3 -#else -# define CONFIG_PAGING_LEVELS 2 #endif #define CONFIG_X86 1 @@ -274,17 +272,17 @@ extern unsigned int video_mode, video_fl #define asmlinkage __attribute__((regparm(0))) /* - * Memory layout (high to low): SIZE PAE-SIZE - * ------ ------ + * Memory layout (high to low): PAE-SIZE + * ------ * I/O remapping area ( 4MB) * Direct-map (1:1) area [Xen code/data/heap] (12MB) * Per-domain mappings (inc. 4MB map_domain_page cache) ( 8MB) - * Shadow linear pagetable ( 4MB) ( 8MB) - * Guest linear pagetable ( 4MB) ( 8MB) - * Machine-to-physical translation table [writable] ( 4MB) (16MB) - * Frame-info table (24MB) (96MB) + * Shadow linear pagetable ( 8MB) + * Guest linear pagetable ( 8MB) + * Machine-to-physical translation table [writable] (16MB) + * Frame-info table (96MB) * * Start of guest inaccessible area - * Machine-to-physical translation table [read-only] ( 4MB) (16MB) + * Machine-to-physical translation table [read-only] (16MB) * * Start of guest unmodifiable area */ @@ -293,15 +291,9 @@ extern unsigned int video_mode, video_fl #define MAPCACHE_MBYTES 4 #define PERDOMAIN_MBYTES 8 -#ifdef CONFIG_X86_PAE -# define LINEARPT_MBYTES 8 -# define MACHPHYS_MBYTES 16 /* 1 MB needed per 1 GB memory */ -# define FRAMETABLE_MBYTES (MACHPHYS_MBYTES * 6) -#else -# define LINEARPT_MBYTES 4 -# define MACHPHYS_MBYTES 4 -# define FRAMETABLE_MBYTES 24 -#endif +#define LINEARPT_MBYTES 8 +#define MACHPHYS_MBYTES 16 /* 1 MB needed per 1 GB memory */ +#define FRAMETABLE_MBYTES (MACHPHYS_MBYTES * 6) #define IOREMAP_VIRT_END 0UL #define IOREMAP_VIRT_START (IOREMAP_VIRT_END - (IOREMAP_MBYTES<<20)) @@ -328,13 +320,8 @@ extern unsigned int video_mode, video_fl /* Maximum linear address accessible via guest memory segments. */ #define GUEST_SEGMENT_MAX_ADDR RO_MPT_VIRT_END -#ifdef CONFIG_X86_PAE /* Hypervisor owns top 168MB of virtual address space. */ #define HYPERVISOR_VIRT_START mk_unsigned_long(0xF5800000) -#else -/* Hypervisor owns top 64MB of virtual address space. */ -#define HYPERVISOR_VIRT_START mk_unsigned_long(0xFC000000) -#endif #define L2_PAGETABLE_FIRST_XEN_SLOT \ (HYPERVISOR_VIRT_START >> L2_PAGETABLE_SHIFT) @@ -343,11 +330,7 @@ extern unsigned int video_mode, video_fl #define L2_PAGETABLE_XEN_SLOTS \ (L2_PAGETABLE_LAST_XEN_SLOT - L2_PAGETABLE_FIRST_XEN_SLOT + 1) -#ifdef CONFIG_X86_PAE -# define PGT_base_page_table PGT_l3_page_table -#else -# define PGT_base_page_table PGT_l2_page_table -#endif +#define PGT_base_page_table PGT_l3_page_table #define __HYPERVISOR_CS 0xe008 #define __HYPERVISOR_DS 0xe010 diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/domain.h --- a/xen/include/asm-x86/domain.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/include/asm-x86/domain.h Thu May 08 14:32:11 2008 +0100 @@ -255,7 +255,7 @@ struct arch_domain cpuid_input_t cpuids[MAX_CPUID_INPUT]; } __cacheline_aligned; -#ifdef CONFIG_X86_PAE +#ifdef __i386__ struct pae_l3_cache { /* * Two low-memory (<4GB) PAE L3 tables, used as fallback when the guest @@ -269,7 +269,7 @@ struct pae_l3_cache { spinlock_t lock; }; #define pae_l3_cache_init(c) spin_lock_init(&(c)->lock) -#else /* !CONFIG_X86_PAE */ +#else /* !defined(__i386__) */ struct pae_l3_cache { }; #define pae_l3_cache_init(c) ((void)0) #endif diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/fixmap.h --- a/xen/include/asm-x86/fixmap.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/include/asm-x86/fixmap.h Thu May 08 14:32:11 2008 +0100 @@ -29,7 +29,7 @@ * from the end of virtual memory backwards. */ enum fixed_addresses { -#ifdef CONFIG_X86_PAE +#ifdef __i386__ FIX_PAE_HIGHMEM_0, FIX_PAE_HIGHMEM_END = FIX_PAE_HIGHMEM_0 + NR_CPUS-1, #endif diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/mm.h --- a/xen/include/asm-x86/mm.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/include/asm-x86/mm.h Thu May 08 14:32:11 2008 +0100 @@ -122,11 +122,7 @@ static inline u32 pickle_domptr(struct d #endif /* The order of the largest allocation unit we use for shadow pages */ -#if CONFIG_PAGING_LEVELS == 2 -#define SHADOW_MAX_ORDER 0 /* Only ever need 4k allocations */ -#else #define SHADOW_MAX_ORDER 2 /* Need up to 16k allocs for 32-bit on PAE/64 */ -#endif #define page_get_owner(_p) (unpickle_domptr((_p)->u.inuse._domain)) #define page_set_owner(_p,_d) ((_p)->u.inuse._domain = pickle_domptr(_d)) diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/page.h --- a/xen/include/asm-x86/page.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/include/asm-x86/page.h Thu May 08 14:32:11 2008 +0100 @@ -123,13 +123,11 @@ static inline l2_pgentry_t l2e_from_padd ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0); return (l2_pgentry_t) { pa | put_pte_flags(flags) }; } -#if CONFIG_PAGING_LEVELS >= 3 static inline l3_pgentry_t l3e_from_paddr(paddr_t pa, unsigned int flags) { ASSERT((pa & ~(PADDR_MASK & PAGE_MASK)) == 0); return (l3_pgentry_t) { pa | put_pte_flags(flags) }; } -#endif #if CONFIG_PAGING_LEVELS >= 4 static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags) { @@ -195,10 +193,7 @@ static inline l4_pgentry_t l4e_from_padd #ifndef __ASSEMBLY__ /* Page-table type. */ -#if CONFIG_PAGING_LEVELS == 2 -/* x86_32 default */ -typedef struct { u32 pfn; } pagetable_t; -#elif CONFIG_PAGING_LEVELS == 3 +#if CONFIG_PAGING_LEVELS == 3 /* x86_32 PAE */ typedef struct { u32 pfn; } pagetable_t; #elif CONFIG_PAGING_LEVELS == 4 @@ -251,12 +246,6 @@ void clear_page_sse2(void *); #endif /* !defined(__ASSEMBLY__) */ /* High table entries are reserved by the hypervisor. */ -#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE) -#define DOMAIN_ENTRIES_PER_L2_PAGETABLE \ - (HYPERVISOR_VIRT_START >> L2_PAGETABLE_SHIFT) -#define HYPERVISOR_ENTRIES_PER_L2_PAGETABLE \ - (L2_PAGETABLE_ENTRIES - DOMAIN_ENTRIES_PER_L2_PAGETABLE) -#else #define DOMAIN_ENTRIES_PER_L2_PAGETABLE 0 #define HYPERVISOR_ENTRIES_PER_L2_PAGETABLE 0 @@ -267,7 +256,6 @@ void clear_page_sse2(void *); #define HYPERVISOR_ENTRIES_PER_L4_PAGETABLE \ (L4_PAGETABLE_ENTRIES - GUEST_ENTRIES_PER_L4_PAGETABLE \ + DOMAIN_ENTRIES_PER_L4_PAGETABLE) -#endif /* Where to find each level of the linear mapping */ #define __linear_l1_table ((l1_pgentry_t *)(LINEAR_PT_VIRT_START)) @@ -284,8 +272,6 @@ extern root_pgentry_t idle_pg_table[ROOT #if CONFIG_PAGING_LEVELS == 3 extern l2_pgentry_t idle_pg_table_l2[ ROOT_PAGETABLE_ENTRIES * L2_PAGETABLE_ENTRIES]; -#elif CONFIG_PAGING_LEVELS == 2 -#define idle_pg_table_l2 idle_pg_table #elif CONFIG_PAGING_LEVELS == 4 extern l2_pgentry_t *compat_idle_pg_table_l2; extern unsigned int m2p_compat_vstart; diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/types.h --- a/xen/include/asm-x86/types.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/include/asm-x86/types.h Thu May 08 14:32:11 2008 +0100 @@ -36,15 +36,9 @@ typedef unsigned int u32; #if defined(__i386__) typedef signed long long s64; typedef unsigned long long u64; -#if defined(CONFIG_X86_PAE) typedef u64 paddr_t; #define INVALID_PADDR (~0ULL) #define PRIpaddr "016llx" -#else -typedef unsigned long paddr_t; -#define INVALID_PADDR (~0UL) -#define PRIpaddr "08lx" -#endif #elif defined(__x86_64__) typedef signed long s64; typedef unsigned long u64; diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/x86_32/page-2level.h --- a/xen/include/asm-x86/x86_32/page-2level.h Thu May 08 13:40:40 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -#ifndef __X86_32_PAGE_2LEVEL_H__ -#define __X86_32_PAGE_2LEVEL_H__ - -#define L1_PAGETABLE_SHIFT 12 -#define L2_PAGETABLE_SHIFT 22 -#define PAGE_SHIFT L1_PAGETABLE_SHIFT -#define ROOT_PAGETABLE_SHIFT L2_PAGETABLE_SHIFT - -#define PAGETABLE_ORDER 10 -#define L1_PAGETABLE_ENTRIES (1< - -/* read access (should only be used for debug printk's) */ -typedef u32 intpte_t; -#define PRIpte "08x" - -typedef struct { intpte_t l1; } l1_pgentry_t; -typedef struct { intpte_t l2; } l2_pgentry_t; -typedef l2_pgentry_t root_pgentry_t; - -#endif /* !__ASSEMBLY__ */ - -#define pte_read_atomic(ptep) (*(ptep)) -#define pte_write_atomic(ptep, pte) (*(ptep) = (pte)) -#define pte_write(ptep, pte) (*(ptep) = (pte)) - -/* root table */ -#define root_get_pfn l2e_get_pfn -#define root_get_flags l2e_get_flags -#define root_get_intpte l2e_get_intpte -#define root_empty l2e_empty -#define root_from_paddr l2e_from_paddr -#define PGT_root_page_table PGT_l2_page_table - -/* misc */ -#define is_guest_l1_slot(_s) (1) -#define is_guest_l2_slot(_d, _t,_s) ((_s) < L2_PAGETABLE_FIRST_XEN_SLOT) - -/* - * PTE pfn and flags: - * 20-bit pfn = (pte[31:12]) - * 12-bit flags = (pte[11:0]) - */ - -#define _PAGE_NX_BIT 0U -#define _PAGE_NX 0U - -/* Extract flags into 12-bit integer, or turn 12-bit flags into a pte mask. */ -#define get_pte_flags(x) ((int)(x) & 0xFFF) -#define put_pte_flags(x) ((intpte_t)((x) & 0xFFF)) - -#endif /* __X86_32_PAGE_2LEVEL_H__ */ diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/x86_32/page-3level.h --- a/xen/include/asm-x86/x86_32/page-3level.h Thu May 08 13:40:40 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -#ifndef __X86_32_PAGE_3LEVEL_H__ -#define __X86_32_PAGE_3LEVEL_H__ - -#define L1_PAGETABLE_SHIFT 12 -#define L2_PAGETABLE_SHIFT 21 -#define L3_PAGETABLE_SHIFT 30 -#define PAGE_SHIFT L1_PAGETABLE_SHIFT -#define ROOT_PAGETABLE_SHIFT L3_PAGETABLE_SHIFT - -#define PAGETABLE_ORDER 9 -#define L1_PAGETABLE_ENTRIES (1< - -/* read access (should only be used for debug printk's) */ -typedef u64 intpte_t; -#define PRIpte "016llx" - -typedef struct { intpte_t l1; } l1_pgentry_t; -typedef struct { intpte_t l2; } l2_pgentry_t; -typedef struct { intpte_t l3; } l3_pgentry_t; -typedef l3_pgentry_t root_pgentry_t; - -#endif /* !__ASSEMBLY__ */ - -#define pte_read_atomic(ptep) ({ \ - intpte_t __pte = *(ptep), __npte; \ - while ( (__npte = cmpxchg(ptep, __pte, __pte)) != __pte ) \ - __pte = __npte; \ - __pte; }) -#define pte_write_atomic(ptep, pte) do { \ - intpte_t __pte = *(ptep), __npte; \ - while ( (__npte = cmpxchg(ptep, __pte, (pte))) != __pte ) \ - __pte = __npte; \ -} while ( 0 ) -#define pte_write(ptep, pte) do { \ - u32 *__ptep_words = (u32 *)(ptep); \ - __ptep_words[0] = 0; \ - wmb(); \ - __ptep_words[1] = (pte) >> 32; \ - wmb(); \ - __ptep_words[0] = (pte) >> 0; \ -} while ( 0 ) - -/* root table */ -#define root_get_pfn l3e_get_pfn -#define root_get_flags l3e_get_flags -#define root_get_intpte l3e_get_intpte -#define root_empty l3e_empty -#define root_from_paddr l3e_from_paddr -#define PGT_root_page_table PGT_l3_page_table - -/* misc */ -#define is_guest_l1_slot(s) (1) -#define is_guest_l2_slot(d,t,s) \ - ( !((t) & PGT_pae_xen_l2) || \ - ((s) < (L2_PAGETABLE_FIRST_XEN_SLOT & (L2_PAGETABLE_ENTRIES - 1))) ) -#define is_guest_l3_slot(s) (1) - -/* - * PTE pfn and flags: - * 32-bit pfn = (pte[43:12]) - * 32-bit flags = (pte[63:44],pte[11:0]) - */ - -#define _PAGE_NX_BIT (1U<<31) -#define _PAGE_NX (cpu_has_nx ? _PAGE_NX_BIT : 0) - -/* Extract flags into 32-bit integer, or turn 32-bit flags into a pte mask. */ -#define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF)) -#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF)) - -#define L3_DISALLOW_MASK 0xFFFFF1FEU /* must-be-zero */ - -#endif /* __X86_32_PAGE_3LEVEL_H__ */ diff -r b0d7780794eb -r 8bd776540ab3 xen/include/asm-x86/x86_32/page.h --- a/xen/include/asm-x86/x86_32/page.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/include/asm-x86/x86_32/page.h Thu May 08 14:32:11 2008 +0100 @@ -1,6 +1,28 @@ #ifndef __X86_32_PAGE_H__ #define __X86_32_PAGE_H__ + +#define L1_PAGETABLE_SHIFT 12 +#define L2_PAGETABLE_SHIFT 21 +#define L3_PAGETABLE_SHIFT 30 +#define PAGE_SHIFT L1_PAGETABLE_SHIFT +#define ROOT_PAGETABLE_SHIFT L3_PAGETABLE_SHIFT + +#define PAGETABLE_ORDER 9 +#define L1_PAGETABLE_ENTRIES (1< -#ifdef CONFIG_X86_PAE -# include -#else -# include -#endif - /* Given a virtual address, get an entry offset into a linear page table. */ #define l1_linear_offset(_a) ((_a) >> L1_PAGETABLE_SHIFT) #define l2_linear_offset(_a) ((_a) >> L2_PAGETABLE_SHIFT) #ifndef __ASSEMBLY__ + +#include +#include + +/* read access (should only be used for debug printk's) */ +typedef u64 intpte_t; +#define PRIpte "016llx" + +typedef struct { intpte_t l1; } l1_pgentry_t; +typedef struct { intpte_t l2; } l2_pgentry_t; +typedef struct { intpte_t l3; } l3_pgentry_t; +typedef l3_pgentry_t root_pgentry_t; + extern unsigned int PAGE_HYPERVISOR; extern unsigned int PAGE_HYPERVISOR_NOCACHE; + #endif + +#define pte_read_atomic(ptep) ({ \ + intpte_t __pte = *(ptep), __npte; \ + while ( (__npte = cmpxchg(ptep, __pte, __pte)) != __pte ) \ + __pte = __npte; \ + __pte; }) +#define pte_write_atomic(ptep, pte) do { \ + intpte_t __pte = *(ptep), __npte; \ + while ( (__npte = cmpxchg(ptep, __pte, (pte))) != __pte ) \ + __pte = __npte; \ +} while ( 0 ) +#define pte_write(ptep, pte) do { \ + u32 *__ptep_words = (u32 *)(ptep); \ + __ptep_words[0] = 0; \ + wmb(); \ + __ptep_words[1] = (pte) >> 32; \ + wmb(); \ + __ptep_words[0] = (pte) >> 0; \ +} while ( 0 ) + +/* root table */ +#define root_get_pfn l3e_get_pfn +#define root_get_flags l3e_get_flags +#define root_get_intpte l3e_get_intpte +#define root_empty l3e_empty +#define root_from_paddr l3e_from_paddr +#define PGT_root_page_table PGT_l3_page_table + +/* misc */ +#define is_guest_l1_slot(s) (1) +#define is_guest_l2_slot(d,t,s) \ + ( !((t) & PGT_pae_xen_l2) || \ + ((s) < (L2_PAGETABLE_FIRST_XEN_SLOT & (L2_PAGETABLE_ENTRIES - 1))) ) +#define is_guest_l3_slot(s) (1) + +/* + * PTE pfn and flags: + * 32-bit pfn = (pte[43:12]) + * 32-bit flags = (pte[63:44],pte[11:0]) + */ + +#define _PAGE_NX_BIT (1U<<31) +#define _PAGE_NX (cpu_has_nx ? _PAGE_NX_BIT : 0) + +/* Extract flags into 32-bit integer, or turn 32-bit flags into a pte mask. */ +#define get_pte_flags(x) (((int)((x) >> 32) & ~0xFFF) | ((int)(x) & 0xFFF)) +#define put_pte_flags(x) (((intpte_t)((x) & ~0xFFF) << 32) | ((x) & 0xFFF)) #define GRANT_PTE_FLAGS \ (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_GNTTAB) @@ -40,6 +116,7 @@ extern unsigned int PAGE_HYPERVISOR_NOCA #define L1_DISALLOW_MASK (BASE_DISALLOW_MASK | _PAGE_GNTTAB) #define L2_DISALLOW_MASK (BASE_DISALLOW_MASK) +#define L3_DISALLOW_MASK 0xFFFFF1FEU /* must-be-zero */ #endif /* __X86_32_PAGE_H__ */ diff -r b0d7780794eb -r 8bd776540ab3 xen/include/public/arch-x86/xen-x86_32.h --- a/xen/include/public/arch-x86/xen-x86_32.h Thu May 08 13:40:40 2008 +0100 +++ b/xen/include/public/arch-x86/xen-x86_32.h Thu May 08 14:32:11 2008 +0100 @@ -74,6 +74,7 @@ #define MACH2PHYS_VIRT_END_PAE \ mk_unsigned_long(__MACH2PHYS_VIRT_END_PAE) +/* Non-PAE bounds are obsolete. */ #define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000 #define __MACH2PHYS_VIRT_START_NONPAE 0xFC000000 #define __MACH2PHYS_VIRT_END_NONPAE 0xFC400000 @@ -84,15 +85,9 @@ #define MACH2PHYS_VIRT_END_NONPAE \ mk_unsigned_long(__MACH2PHYS_VIRT_END_NONPAE) -#ifdef CONFIG_X86_PAE #define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE #define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_PAE #define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_PAE -#else -#define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_NONPAE -#define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_NONPAE -#define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_NONPAE -#endif #ifndef HYPERVISOR_VIRT_START #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:50:56 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:50:56 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCi-00023T-Gd for www-data@colo.xensource.com; Thu, 08 May 2008 11:50:56 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBDI-0006HB-23; Thu, 08 May 2008 18:51:32 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCr-0005ty-3t for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:51:05 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCi-0004JL-8i for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:51:02 +0000 X-SBRS: 3.6 X-MesageID: 168921 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168921" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:50:04 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48Io325000326 for ; Thu, 8 May 2008 11:50:03 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoLok005112 for ; Thu, 8 May 2008 11:50:21 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoLsb005111 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:21 -0700 Message-Id: <200805081850.m48IoLsb005111@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:21 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] evtchn: Use wmb instead of rmb to enforce ordering between X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210244142 -3600 # Node ID 77db69c382497116ca3835cd51824723d20b5fb9 # Parent 63b51bcb6bf6cdc746cd2662f6c8e6a1ebae078d evtchn: Use wmb instead of rmb to enforce ordering between evtchn_upcall_pending and evtchn_pending_sel stores. Signed-off-by: Samuel Thibault --- drivers/xen/core/evtchn.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 63b51bcb6bf6 -r 77db69c38249 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Thu May 08 11:14:47 2008 +0100 +++ b/drivers/xen/core/evtchn.c Thu May 08 11:55:42 2008 +0100 @@ -246,7 +246,7 @@ asmlinkage void evtchn_do_upcall(struct #ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */ /* Clear master flag /before/ clearing selector flag. */ - rmb(); + wmb(); #endif l1 = xchg(&vcpu_info->evtchn_pending_sel, 0); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 11:51:00 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 11:51:00 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuBCm-00023W-AI for www-data@colo.xensource.com; Thu, 08 May 2008 11:51:00 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBDL-0006Kn-TH; Thu, 08 May 2008 18:51:35 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuBCr-0005uz-Rw for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:51:05 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuBCi-0004JM-Kx for xen-changelog@lists.xensource.com; Thu, 08 May 2008 18:51:03 +0000 X-SBRS: 3.6 X-MesageID: 168922 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,455,1204520400"; d="scan'208";a="168922" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 14:50:05 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48Io4Ed000329 for ; Thu, 8 May 2008 11:50:04 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48IoMbm005129 for ; Thu, 8 May 2008 11:50:22 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48IoMph005128 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 11:50:22 -0700 Message-Id: <200805081850.m48IoMph005128@xenbits.xensource.com> Date: Thu, 08 May 2008 11:50:22 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Remove some references to powerpc port. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210250697 -3600 # Node ID 0da2e3c3ae18cdd9d499473fb3f5e260abc59864 # Parent 77db69c382497116ca3835cd51824723d20b5fb9 Remove some references to powerpc port. Signed-off-by: Keir Fraser --- drivers/xen/core/evtchn.c | 3 --- drivers/xen/privcmd/privcmd.c | 2 -- 2 files changed, 5 deletions(-) diff -r 77db69c38249 -r 0da2e3c3ae18 drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Thu May 08 11:55:42 2008 +0100 +++ b/drivers/xen/core/evtchn.c Thu May 08 13:44:57 2008 +0100 @@ -200,9 +200,6 @@ static inline void exit_idle(void) {} (regs)->IRQ_REG = ~(irq); \ do_IRQ((regs)); \ } while (0) -#elif defined (__powerpc__) -#define do_IRQ(irq, regs) __do_IRQ(irq, regs) -static inline void exit_idle(void) {} #endif /* Xen will never allocate port zero for any purpose. */ diff -r 77db69c38249 -r 0da2e3c3ae18 drivers/xen/privcmd/privcmd.c --- a/drivers/xen/privcmd/privcmd.c Thu May 08 11:55:42 2008 +0100 +++ b/drivers/xen/privcmd/privcmd.c Thu May 08 13:44:57 2008 +0100 @@ -229,11 +229,9 @@ static struct vm_operations_struct privc static int privcmd_mmap(struct file * file, struct vm_area_struct * vma) { -#ifndef __powerpc__ /* PowerPC has a trick to safely do this. */ /* Unsupported for auto-translate guests. */ if (xen_feature(XENFEAT_auto_translated_physmap)) return -ENOSYS; -#endif /* DONTCOPY is essential for Xen as copy_page_range is broken. */ vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 08 14:30:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 08 May 2008 14:30:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JuDgo-0003w5-Tr for www-data@colo.xensource.com; Thu, 08 May 2008 14:30:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuDhO-0004v5-Iw; Thu, 08 May 2008 21:30:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JuDhL-0004uF-R4 for xen-changelog@lists.xensource.com; Thu, 08 May 2008 21:30:43 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JuDhC-000666-E7 for xen-changelog@lists.xensource.com; Thu, 08 May 2008 21:30:41 +0000 X-SBRS: 3.6 X-MesageID: 170052 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,456,1204520400"; d="scan'208";a="170052" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 08 May 2008 17:29:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m48LTpXY001085 for ; Thu, 8 May 2008 14:29:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m48LU9VK013420 for ; Thu, 8 May 2008 14:30:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m48LU93n013419 for xen-changelog@lists.xensource.com; Thu, 8 May 2008 14:30:09 -0700 Message-Id: <200805082130.m48LU93n013419@xenbits.xensource.com> Date: Thu, 08 May 2008 14:30:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Clean up shadow code after the removal of non-PAE 32-bit builds X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210262313 -3600 # Node ID 810d8c3ac992e8979abb2e60cac5cef5ed6ccb36 # Parent c99a88623eda83d8e02f4b6d7c32bc4c6d298d8a Clean up shadow code after the removal of non-PAE 32-bit builds Signed-off-by: Tim Deegan --- xen/arch/x86/mm/p2m.c | 41 ++------- xen/arch/x86/mm/shadow/Makefile | 13 -- xen/arch/x86/mm/shadow/common.c | 174 ++++++++++++++++----------------------- xen/arch/x86/mm/shadow/multi.c | 100 +++++++--------------- xen/arch/x86/mm/shadow/multi.h | 58 ++++++------- xen/arch/x86/mm/shadow/private.h | 38 +------- xen/arch/x86/mm/shadow/types.h | 107 +++++------------------ xen/include/asm-x86/mtrr.h | 3 8 files changed, 180 insertions(+), 354 deletions(-) diff -r c99a88623eda -r 810d8c3ac992 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Thu May 08 14:33:31 2008 +0100 +++ b/xen/arch/x86/mm/p2m.c Thu May 08 16:58:33 2008 +0100 @@ -220,7 +220,6 @@ p2m_set_entry(struct domain *d, unsigned L4_PAGETABLE_ENTRIES, PGT_l3_page_table) ) goto out; #endif -#if CONFIG_PAGING_LEVELS >= 3 /* * When using PAE Xen, we only allow 33 bits of pseudo-physical * address in translated guests (i.e. 8 GBytes). This restriction @@ -235,7 +234,7 @@ p2m_set_entry(struct domain *d, unsigned : L3_PAGETABLE_ENTRIES), PGT_l2_page_table) ) goto out; -#endif + if ( !p2m_next_level(d, &table_mfn, &table, &gfn_remainder, gfn, L2_PAGETABLE_SHIFT - PAGE_SHIFT, L2_PAGETABLE_ENTRIES, PGT_l1_page_table) ) @@ -308,7 +307,6 @@ p2m_gfn_to_mfn(struct domain *d, unsigne unmap_domain_page(l4e); } #endif -#if CONFIG_PAGING_LEVELS >= 3 { l3_pgentry_t *l3e = map_domain_page(mfn_x(mfn)); #if CONFIG_PAGING_LEVELS == 3 @@ -329,7 +327,6 @@ p2m_gfn_to_mfn(struct domain *d, unsigne mfn = _mfn(l3e_get_pfn(*l3e)); unmap_domain_page(l3e); } -#endif l2e = map_domain_page(mfn_x(mfn)); l2e += l2_table_offset(addr); @@ -486,7 +483,7 @@ int p2m_alloc_table(struct domain *d, p2m_top->u.inuse.type_info = #if CONFIG_PAGING_LEVELS == 4 PGT_l4_page_table -#elif CONFIG_PAGING_LEVELS == 3 +#else PGT_l3_page_table #endif | 1 | PGT_validated; @@ -657,16 +654,13 @@ static void audit_p2m(struct domain *d) l3_pgentry_t *l3e; int i3, i4; l4e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); -#elif CONFIG_PAGING_LEVELS == 3 +#else /* CONFIG_PAGING_LEVELS == 3 */ l3_pgentry_t *l3e; int i3; l3e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); -#else /* CONFIG_PAGING_LEVELS == 2 */ - l2e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); #endif gfn = 0; -#if CONFIG_PAGING_LEVELS >= 3 #if CONFIG_PAGING_LEVELS >= 4 for ( i4 = 0; i4 < L4_PAGETABLE_ENTRIES; i4++ ) { @@ -676,7 +670,7 @@ static void audit_p2m(struct domain *d) continue; } l3e = map_domain_page(mfn_x(_mfn(l4e_get_pfn(l4e[i4])))); -#endif /* now at levels 3 or 4... */ +#endif for ( i3 = 0; i3 < ((CONFIG_PAGING_LEVELS==4) ? L3_PAGETABLE_ENTRIES : 8); i3++ ) @@ -687,7 +681,6 @@ static void audit_p2m(struct domain *d) continue; } l2e = map_domain_page(mfn_x(_mfn(l3e_get_pfn(l3e[i3])))); -#endif /* all levels... */ for ( i2 = 0; i2 < L2_PAGETABLE_ENTRIES; i2++ ) { if ( !(l2e_get_flags(l2e[i2]) & _PAGE_PRESENT) ) @@ -714,21 +707,17 @@ static void audit_p2m(struct domain *d) } unmap_domain_page(l1e); } -#if CONFIG_PAGING_LEVELS >= 3 unmap_domain_page(l2e); } #if CONFIG_PAGING_LEVELS >= 4 unmap_domain_page(l3e); } #endif -#endif #if CONFIG_PAGING_LEVELS == 4 unmap_domain_page(l4e); -#elif CONFIG_PAGING_LEVELS == 3 +#else /* CONFIG_PAGING_LEVELS == 3 */ unmap_domain_page(l3e); -#else /* CONFIG_PAGING_LEVELS == 2 */ - unmap_domain_page(l2e); #endif } @@ -864,14 +853,12 @@ void p2m_change_type_global(struct domai l2_pgentry_t *l2e; mfn_t l1mfn; int i1, i2; -#if CONFIG_PAGING_LEVELS >= 3 l3_pgentry_t *l3e; int i3; #if CONFIG_PAGING_LEVELS == 4 l4_pgentry_t *l4e; int i4; #endif /* CONFIG_PAGING_LEVELS == 4 */ -#endif /* CONFIG_PAGING_LEVELS >= 3 */ if ( !paging_mode_translate(d) ) return; @@ -883,13 +870,10 @@ void p2m_change_type_global(struct domai #if CONFIG_PAGING_LEVELS == 4 l4e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); -#elif CONFIG_PAGING_LEVELS == 3 +#else /* CONFIG_PAGING_LEVELS == 3 */ l3e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); -#else /* CONFIG_PAGING_LEVELS == 2 */ - l2e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); -#endif - -#if CONFIG_PAGING_LEVELS >= 3 +#endif + #if CONFIG_PAGING_LEVELS >= 4 for ( i4 = 0; i4 < L4_PAGETABLE_ENTRIES; i4++ ) { @@ -898,7 +882,7 @@ void p2m_change_type_global(struct domai continue; } l3e = map_domain_page(l4e_get_pfn(l4e[i4])); -#endif /* now at levels 3 or 4... */ +#endif for ( i3 = 0; i3 < ((CONFIG_PAGING_LEVELS==4) ? L3_PAGETABLE_ENTRIES : 8); i3++ ) @@ -908,7 +892,6 @@ void p2m_change_type_global(struct domai continue; } l2e = map_domain_page(l3e_get_pfn(l3e[i3])); -#endif /* all levels... */ for ( i2 = 0; i2 < L2_PAGETABLE_ENTRIES; i2++ ) { if ( !(l2e_get_flags(l2e[i2]) & _PAGE_PRESENT) ) @@ -934,21 +917,17 @@ void p2m_change_type_global(struct domai } unmap_domain_page(l1e); } -#if CONFIG_PAGING_LEVELS >= 3 unmap_domain_page(l2e); } #if CONFIG_PAGING_LEVELS >= 4 unmap_domain_page(l3e); } #endif -#endif #if CONFIG_PAGING_LEVELS == 4 unmap_domain_page(l4e); -#elif CONFIG_PAGING_LEVELS == 3 +#else /* CONFIG_PAGING_LEVELS == 3 */ unmap_domain_page(l3e); -#else /* CONFIG_PAGING_LEVELS == 2 */ - unmap_domain_page(l2e); #endif } diff -r c99a88623eda -r 810d8c3ac992 xen/arch/x86/mm/shadow/Makefile --- a/xen/arch/x86/mm/shadow/Makefile Thu May 08 14:33:31 2008 +0100 +++ b/xen/arch/x86/mm/shadow/Makefile Thu May 08 16:58:33 2008 +0100 @@ -1,10 +1,5 @@ obj-$(x86_32) += common.o g2_on_s3.o g3_ -obj-$(x86_32) += common.o g2_on_s3.o g3_on_s3.o -obj-$(x86_64) += common.o g4_on_s4.o g3_on_s3.o g2_on_s3.o +obj-$(x86_32) += common.o guest_2.o guest_3.o +obj-$(x86_64) += common.o guest_2.o guest_3.o guest_4.o -guest_levels = $(subst g,,$(filter g%,$(subst ., ,$(subst _, ,$(1))))) -shadow_levels = $(subst s,,$(filter s%,$(subst ., ,$(subst _, ,$(1))))) -shadow_defns = -DGUEST_PAGING_LEVELS=$(call guest_levels,$(1)) \ - -DSHADOW_PAGING_LEVELS=$(call shadow_levels,$(1)) - -g%.o: multi.c $(HDRS) Makefile - $(CC) $(CFLAGS) $(call shadow_defns,$(@F)) -c $< -o $@ +guest_%.o: multi.c $(HDRS) Makefile + $(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=$* -c $< -o $@ diff -r c99a88623eda -r 810d8c3ac992 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Thu May 08 14:33:31 2008 +0100 +++ b/xen/arch/x86/mm/shadow/common.c Thu May 08 16:58:33 2008 +0100 @@ -64,11 +64,7 @@ void shadow_domain_init(struct domain *d */ void shadow_vcpu_init(struct vcpu *v) { -#if CONFIG_PAGING_LEVELS == 4 - v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3); -#elif CONFIG_PAGING_LEVELS == 3 - v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3); -#endif + v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode, 3); } #if SHADOW_AUDIT @@ -503,38 +499,37 @@ sh_validate_guest_entry(struct vcpu *v, return 0; /* Not shadowed at all */ if ( page->shadow_flags & SHF_L1_32 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 3, 2) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 2) (v, gmfn, entry, size); - if ( page->shadow_flags & SHF_L2_32 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 3, 2) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 2) (v, gmfn, entry, size); if ( page->shadow_flags & SHF_L1_PAE ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 3, 3) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 3) (v, gmfn, entry, size); if ( page->shadow_flags & SHF_L2_PAE ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 3, 3) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 3) (v, gmfn, entry, size); if ( page->shadow_flags & SHF_L2H_PAE ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 3, 3) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 3) (v, gmfn, entry, size); #if CONFIG_PAGING_LEVELS >= 4 if ( page->shadow_flags & SHF_L1_64 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 4, 4) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, 4) (v, gmfn, entry, size); if ( page->shadow_flags & SHF_L2_64 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 4, 4) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 4) (v, gmfn, entry, size); if ( page->shadow_flags & SHF_L2H_64 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 4, 4) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 4) (v, gmfn, entry, size); if ( page->shadow_flags & SHF_L3_64 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl3e, 4, 4) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl3e, 4) (v, gmfn, entry, size); if ( page->shadow_flags & SHF_L4_64 ) - result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl4e, 4, 4) + result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl4e, 4) (v, gmfn, entry, size); #else /* 32-bit hypervisor does not support 64-bit guests */ ASSERT((page->shadow_flags @@ -613,7 +608,7 @@ int shadow_cmpxchg_guest_entry(struct vc * Most shadow pages are allocated singly, but there is one case where * we need to allocate multiple pages together: shadowing 32-bit guest * tables on PAE or 64-bit shadows. A 32-bit guest l1 table covers 4MB - * of virtuial address space, and needs to be shadowed by two PAE/64-bit + * of virtual address space, and needs to be shadowed by two PAE/64-bit * l1 tables (covering 2MB of virtual address space each). Similarly, a * 32-bit guest l2 table (4GB va) needs to be shadowed by four * PAE/64-bit l2 tables (1GB va each). These multi-page shadows are @@ -622,15 +617,15 @@ int shadow_cmpxchg_guest_entry(struct vc * * This table shows the allocation behaviour of the different modes: * - * Xen paging 32b pae pae 64b 64b 64b - * Guest paging 32b 32b pae 32b pae 64b - * PV or HVM * HVM * HVM HVM * - * Shadow paging 32b pae pae pae pae 64b + * Xen paging pae pae 64b 64b 64b + * Guest paging 32b pae 32b pae 64b + * PV or HVM HVM * HVM HVM * + * Shadow paging pae pae pae pae 64b * - * sl1 size 4k 8k 4k 8k 4k 4k - * sl2 size 4k 16k 4k 16k 4k 4k - * sl3 size - - - - - 4k - * sl4 size - - - - - 4k + * sl1 size 8k 4k 8k 4k 4k + * sl2 size 16k 4k 16k 4k 4k + * sl3 size - - - - 4k + * sl4 size - - - - 4k * * We allocate memory from xen in four-page units and break them down * with a simple buddy allocator. Can't use the xen allocator to handle @@ -723,15 +718,15 @@ static void shadow_unhook_mappings(struc switch ( sp->type ) { case SH_type_l2_32_shadow: - SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings,3,2)(v,smfn); + SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, 2)(v,smfn); break; case SH_type_l2_pae_shadow: case SH_type_l2h_pae_shadow: - SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings,3,3)(v,smfn); + SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, 3)(v,smfn); break; #if CONFIG_PAGING_LEVELS >= 4 case SH_type_l4_64_shadow: - SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings,4,4)(v,smfn); + SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, 4)(v,smfn); break; #endif default: @@ -1573,37 +1568,37 @@ void sh_destroy_shadow(struct vcpu *v, m { case SH_type_l1_32_shadow: case SH_type_fl1_32_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3, 2)(v, smfn); + SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 2)(v, smfn); break; case SH_type_l2_32_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3, 2)(v, smfn); + SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 2)(v, smfn); break; case SH_type_l1_pae_shadow: case SH_type_fl1_pae_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3, 3)(v, smfn); + SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 3)(v, smfn); break; case SH_type_l2_pae_shadow: case SH_type_l2h_pae_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3, 3)(v, smfn); + SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 3)(v, smfn); break; #if CONFIG_PAGING_LEVELS >= 4 case SH_type_l1_64_shadow: case SH_type_fl1_64_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 4, 4)(v, smfn); + SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 4)(v, smfn); break; case SH_type_l2h_64_shadow: ASSERT(is_pv_32on64_vcpu(v)); /* Fall through... */ case SH_type_l2_64_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 4, 4)(v, smfn); + SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 4)(v, smfn); break; case SH_type_l3_64_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l3_shadow, 4, 4)(v, smfn); + SHADOW_INTERNAL_NAME(sh_destroy_l3_shadow, 4)(v, smfn); break; case SH_type_l4_64_shadow: - SHADOW_INTERNAL_NAME(sh_destroy_l4_shadow, 4, 4)(v, smfn); + SHADOW_INTERNAL_NAME(sh_destroy_l4_shadow, 4)(v, smfn); break; #endif default: @@ -1626,16 +1621,16 @@ int sh_remove_write_access(struct vcpu * /* Dispatch table for getting per-type functions */ static hash_callback_t callbacks[SH_type_unused] = { NULL, /* none */ - SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,2), /* l1_32 */ - SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,2), /* fl1_32 */ + SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* l1_32 */ + SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2), /* fl1_32 */ NULL, /* l2_32 */ - SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,3), /* l1_pae */ - SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,3,3), /* fl1_pae */ + SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* l1_pae */ + SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 3), /* fl1_pae */ NULL, /* l2_pae */ NULL, /* l2h_pae */ #if CONFIG_PAGING_LEVELS >= 4 - SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,4,4), /* l1_64 */ - SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1,4,4), /* fl1_64 */ + SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* l1_64 */ + SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 4), /* fl1_64 */ #else NULL, /* l1_64 */ NULL, /* fl1_64 */ @@ -1711,7 +1706,6 @@ int sh_remove_write_access(struct vcpu * GUESS(0xC0000000UL + (gfn << PAGE_SHIFT), 4); } -#if CONFIG_PAGING_LEVELS >= 3 else if ( v->arch.paging.mode->guest_levels == 3 ) { /* 32bit PAE w2k3: linear map at 0xC0000000 */ @@ -1746,7 +1740,6 @@ int sh_remove_write_access(struct vcpu * GUESS(0x0000010000000000UL + (gfn << PAGE_SHIFT), 4); } #endif /* CONFIG_PAGING_LEVELS >= 4 */ -#endif /* CONFIG_PAGING_LEVELS >= 3 */ #undef GUESS } @@ -1810,16 +1803,16 @@ int sh_remove_all_mappings(struct vcpu * /* Dispatch table for getting per-type functions */ static hash_callback_t callbacks[SH_type_unused] = { NULL, /* none */ - SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,2), /* l1_32 */ - SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,2), /* fl1_32 */ + SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* l1_32 */ + SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* fl1_32 */ NULL, /* l2_32 */ - SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,3), /* l1_pae */ - SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,3,3), /* fl1_pae */ + SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* l1_pae */ + SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3), /* fl1_pae */ NULL, /* l2_pae */ NULL, /* l2h_pae */ #if CONFIG_PAGING_LEVELS >= 4 - SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,4,4), /* l1_64 */ - SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1,4,4), /* fl1_64 */ + SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* l1_64 */ + SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 4), /* fl1_64 */ #else NULL, /* l1_64 */ NULL, /* fl1_64 */ @@ -1918,12 +1911,12 @@ static int sh_remove_shadow_via_pointer( { case SH_type_l1_32_shadow: case SH_type_l2_32_shadow: - SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,3,2)(v, vaddr, pmfn); + SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 2)(v, vaddr, pmfn); break; case SH_type_l1_pae_shadow: case SH_type_l2_pae_shadow: case SH_type_l2h_pae_shadow: - SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,3,3)(v, vaddr, pmfn); + SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 3)(v, vaddr, pmfn); break; #if CONFIG_PAGING_LEVELS >= 4 case SH_type_l1_64_shadow: @@ -1931,7 +1924,7 @@ static int sh_remove_shadow_via_pointer( case SH_type_l2h_64_shadow: case SH_type_l3_64_shadow: case SH_type_l4_64_shadow: - SHADOW_INTERNAL_NAME(sh_clear_shadow_entry,4,4)(v, vaddr, pmfn); + SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 4)(v, vaddr, pmfn); break; #endif default: BUG(); /* Some wierd unknown shadow type */ @@ -1966,18 +1959,18 @@ void sh_remove_shadows(struct vcpu *v, m NULL, /* none */ NULL, /* l1_32 */ NULL, /* fl1_32 */ - SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,2), /* l2_32 */ + SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 2), /* l2_32 */ NULL, /* l1_pae */ NULL, /* fl1_pae */ - SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,3), /* l2_pae */ - SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,3,3), /* l2h_pae */ + SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2_pae */ + SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3), /* l2h_pae */ NULL, /* l1_64 */ NULL, /* fl1_64 */ #if CONFIG_PAGING_LEVELS >= 4 - SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,4,4), /* l2_64 */ - SHADOW_INTERNAL_NAME(sh_remove_l1_shadow,4,4), /* l2h_64 */ - SHADOW_INTERNAL_NAME(sh_remove_l2_shadow,4,4), /* l3_64 */ - SHADOW_INTERNAL_NAME(sh_remove_l3_shadow,4,4), /* l4_64 */ + SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2_64 */ + SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4), /* l2h_64 */ + SHADOW_INTERNAL_NAME(sh_remove_l2_shadow, 4), /* l3_64 */ + SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, 4), /* l4_64 */ #else NULL, /* l2_64 */ NULL, /* l2h_64 */ @@ -2061,7 +2054,6 @@ void sh_remove_shadows(struct vcpu *v, m DO_UNSHADOW(SH_type_l2_32_shadow); DO_UNSHADOW(SH_type_l1_32_shadow); -#if CONFIG_PAGING_LEVELS >= 3 DO_UNSHADOW(SH_type_l2h_pae_shadow); DO_UNSHADOW(SH_type_l2_pae_shadow); DO_UNSHADOW(SH_type_l1_pae_shadow); @@ -2072,7 +2064,6 @@ void sh_remove_shadows(struct vcpu *v, m DO_UNSHADOW(SH_type_l2_64_shadow); DO_UNSHADOW(SH_type_l1_64_shadow); #endif -#endif #undef DO_UNSHADOW @@ -2154,11 +2145,9 @@ static void sh_update_paging_modes(struc /// PV guest /// #if CONFIG_PAGING_LEVELS == 4 - v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,4,4); -#elif CONFIG_PAGING_LEVELS == 3 - v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3); -#else -#error unexpected paging mode + v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode, 4); +#else /* CONFIG_PAGING_LEVELS == 3 */ + v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode, 3); #endif } else @@ -2175,11 +2164,7 @@ static void sh_update_paging_modes(struc * pagetable for it, mapping 4 GB one-to-one using a single l2 * page of 1024 superpage mappings */ v->arch.guest_table = d->arch.paging.shadow.unpaged_pagetable; -#if CONFIG_PAGING_LEVELS >= 3 - v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode, 3, 2); -#else - v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode, 2, 2); -#endif + v->arch.paging.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode, 2); } else { @@ -2188,32 +2173,21 @@ static void sh_update_paging_modes(struc { // long mode guest... v->arch.paging.mode = - &SHADOW_INTERNAL_NAME(sh_paging_mode, 4, 4); + &SHADOW_INTERNAL_NAME(sh_paging_mode, 4); } else #endif if ( hvm_pae_enabled(v) ) { -#if CONFIG_PAGING_LEVELS >= 3 // 32-bit PAE mode guest... v->arch.paging.mode = - &SHADOW_INTERNAL_NAME(sh_paging_mode, 3, 3); -#else - SHADOW_ERROR("PAE not supported in 32-bit Xen\n"); - domain_crash(d); - return; -#endif + &SHADOW_INTERNAL_NAME(sh_paging_mode, 3); } else { // 32-bit 2 level guest... -#if CONFIG_PAGING_LEVELS >= 3 v->arch.paging.mode = - &SHADOW_INTERNAL_NAME(sh_paging_mode, 3, 2); -#else - v->arch.paging.mode = - &SHADOW_INTERNAL_NAME(sh_paging_mode, 2, 2); -#endif + &SHADOW_INTERNAL_NAME(sh_paging_mode, 2); } } @@ -2227,7 +2201,7 @@ static void sh_update_paging_modes(struc if ( v->arch.paging.mode != old_mode ) { - SHADOW_PRINTK("new paging mode: d=%u v=%u pe=%d g=%u s=%u " + SHADOW_PRINTK("new paging mode: d=%u v=%u pe=%d gl=%u " "(was g=%u s=%u)\n", d->domain_id, v->vcpu_id, is_hvm_domain(d) ? hvm_paging_enabled(v) : 1, @@ -3033,20 +3007,20 @@ void shadow_audit_tables(struct vcpu *v) /* Dispatch table for getting per-type functions */ static hash_callback_t callbacks[SH_type_unused] = { NULL, /* none */ - SHADOW_INTERNAL_NAME(sh_audit_l1_table,3,2), /* l1_32 */ - SHADOW_INTERNAL_NAME(sh_audit_fl1_table,3,2), /* fl1_32 */ - SHADOW_INTERNAL_NAME(sh_audit_l2_table,3,2), /* l2_32 */ - SHADOW_INTERNAL_NAME(sh_audit_l1_table,3,3), /* l1_pae */ - SHADOW_INTERNAL_NAME(sh_audit_fl1_table,3,3), /* fl1_pae */ - SHADOW_INTERNAL_NAME(sh_audit_l2_table,3,3), /* l2_pae */ - SHADOW_INTERNAL_NAME(sh_audit_l2_table,3,3), /* l2h_pae */ + SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2), /* l1_32 */ + SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 2), /* fl1_32 */ + SHADOW_INTERNAL_NAME(sh_audit_l2_table, 2), /* l2_32 */ + SHADOW_INTERNAL_NAME(sh_audit_l1_table, 3), /* l1_pae */ + SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 3), /* fl1_pae */ + SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3), /* l2_pae */ + SHADOW_INTERNAL_NAME(sh_audit_l2_table, 3), /* l2h_pae */ #if CONFIG_PAGING_LEVELS >= 4 - SHADOW_INTERNAL_NAME(sh_audit_l1_table,4,4), /* l1_64 */ - SHADOW_INTERNAL_NAME(sh_audit_fl1_table,4,4), /* fl1_64 */ - SHADOW_INTERNAL_NAME(sh_audit_l2_table,4,4), /* l2_64 */ - SHADOW_INTERNAL_NAME(sh_audit_l2_table,4,4), /* l2h_64 */ - SHADOW_INTERNAL_NAME(sh_audit_l3_table,4,4), /* l3_64 */ - SHADOW_INTERNAL_NAME(sh_audit_l4_table,4,4), /* l4_64 */ + SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4), /* l1_64 */ + SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4), /* fl1_64 */ + SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4), /* l2_64 */ + SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4), /* l2h_64 */ + SHADOW_INTERNAL_NAME(sh_audit_l3_table, 4), /* l3_64 */ + SHADOW_INTERNAL_NAME(sh_audit_l4_table, 4), /* l4_64 */ #endif /* CONFIG_PAGING_LEVELS >= 4 */ NULL /* All the rest */ }; diff -r c99a88623eda -r 810d8c3ac992 xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu May 08 14:33:31 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Thu May 08 16:58:33 2008 +0100 @@ -605,7 +605,7 @@ static void sh_audit_gw(struct vcpu *v, #endif /* audit code */ -#if (CONFIG_PAGING_LEVELS == GUEST_PAGING_LEVELS) && (CONFIG_PAGING_LEVELS == SHADOW_PAGING_LEVELS) +#if (CONFIG_PAGING_LEVELS == GUEST_PAGING_LEVELS) void * sh_guest_map_l1e(struct vcpu *v, unsigned long addr, unsigned long *gl1mfn) @@ -643,7 +643,7 @@ sh_guest_get_eff_l1e(struct vcpu *v, uns (void) guest_walk_tables(v, addr, &gw, PFEC_page_present); *(guest_l1e_t *)eff_l1e = gw.l1e; } -#endif /* CONFIG==SHADOW==GUEST */ +#endif /* CONFIG == GUEST (== SHADOW) */ /**************************************************************************/ /* Functions to compute the correct index into a shadow page, given an @@ -678,7 +678,7 @@ static u32 static u32 shadow_l1_index(mfn_t *smfn, u32 guest_index) { -#if (GUEST_PAGING_LEVELS == 2) && (SHADOW_PAGING_LEVELS != 2) +#if (GUEST_PAGING_LEVELS == 2) *smfn = _mfn(mfn_x(*smfn) + (guest_index / SHADOW_L1_PAGETABLE_ENTRIES)); return (guest_index % SHADOW_L1_PAGETABLE_ENTRIES); @@ -690,14 +690,14 @@ static u32 static u32 shadow_l2_index(mfn_t *smfn, u32 guest_index) { -#if (GUEST_PAGING_LEVELS == 2) && (SHADOW_PAGING_LEVELS != 2) +#if (GUEST_PAGING_LEVELS == 2) // Because we use 2 shadow l2 entries for each guest entry, the number of // guest entries per shadow page is SHADOW_L2_PAGETABLE_ENTRIES/2 // *smfn = _mfn(mfn_x(*smfn) + (guest_index / (SHADOW_L2_PAGETABLE_ENTRIES / 2))); - // We multiple by two to get the index of the first of the two entries + // We multiply by two to get the index of the first of the two entries // used to shadow the specified guest entry. return (guest_index % (SHADOW_L2_PAGETABLE_ENTRIES / 2)) * 2; #else @@ -721,12 +721,7 @@ shadow_l4_index(mfn_t *smfn, u32 guest_i #endif // GUEST_PAGING_LEVELS >= 4 -extern u32 get_pat_flags(struct vcpu *v, - u32 gl1e_flags, - paddr_t gpaddr, - paddr_t spaddr); - -unsigned char pat_type_2_pte_flags(unsigned char pat_type); + /**************************************************************************/ /* Function which computes shadow entries from their corresponding guest * entries. This is the "heart" of the shadow code. It operates using @@ -996,7 +991,7 @@ static inline void safe_write_entry(void d[1] = s[1]; d[0] = s[0]; #else - /* In 32-bit and 64-bit, sizeof(pte) == sizeof(ulong) == 1 word, + /* In 64-bit, sizeof(pte) == sizeof(ulong) == 1 word, * which will be an atomic write, since the entry is aligned. */ BUILD_BUG_ON(sizeof (shadow_l1e_t) != sizeof (unsigned long)); *d = *s; @@ -1204,7 +1199,7 @@ static int shadow_set_l2e(struct vcpu *v shadow_l2e_t old_sl2e; paddr_t paddr; -#if GUEST_PAGING_LEVELS == 2 && SHADOW_PAGING_LEVELS > 2 +#if GUEST_PAGING_LEVELS == 2 /* In 2-on-3 we work with pairs of l2es pointing at two-page * shadows. Reference counting and up-pointers track from the first * page of the shadow to the first l2e, so make sure that we're @@ -1232,7 +1227,7 @@ static int shadow_set_l2e(struct vcpu *v } /* Write the new entry */ -#if GUEST_PAGING_LEVELS == 2 && SHADOW_PAGING_LEVELS > 2 +#if GUEST_PAGING_LEVELS == 2 { shadow_l2e_t pair[2] = { new_sl2e, new_sl2e }; /* The l1 shadow is two pages long and need to be pointed to by @@ -1418,7 +1413,7 @@ static inline void increment_ptr_to_gues #define _SHADOW_FOREACH_L1E(_sl1mfn, _sl1e, _gl1p, _done, _code) \ do { \ int _i; \ - shadow_l1e_t *_sp = map_shadow_page((_sl1mfn)); \ + shadow_l1e_t *_sp = sh_map_domain_page((_sl1mfn)); \ ASSERT(mfn_to_shadow_page(_sl1mfn)->type == SH_type_l1_shadow \ || mfn_to_shadow_page(_sl1mfn)->type == SH_type_fl1_shadow); \ for ( _i = 0; _i < SHADOW_L1_PAGETABLE_ENTRIES; _i++ ) \ @@ -1429,7 +1424,7 @@ do { if ( _done ) break; \ increment_ptr_to_guest_entry(_gl1p); \ } \ - unmap_shadow_page(_sp); \ + sh_unmap_domain_page(_sp); \ } while (0) /* 32-bit l1, on PAE or 64-bit shadows: need to walk both pages of shadow */ @@ -1450,7 +1445,7 @@ do { #endif -#if GUEST_PAGING_LEVELS == 2 && SHADOW_PAGING_LEVELS > 2 +#if GUEST_PAGING_LEVELS == 2 /* 32-bit l2 on PAE/64: four pages, touch every second entry, and avoid Xen */ #define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _dom, _code) \ @@ -1460,7 +1455,7 @@ do { ASSERT(mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2_32_shadow); \ for ( _j = 0; _j < 4 && !__done; _j++ ) \ { \ - shadow_l2e_t *_sp = map_shadow_page(_sl2mfn); \ + shadow_l2e_t *_sp = sh_map_domain_page(_sl2mfn); \ for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i += 2 ) \ if ( (!(_xen)) \ || ((_j * SHADOW_L2_PAGETABLE_ENTRIES) + _i) \ @@ -1472,32 +1467,9 @@ do { if ( (__done = (_done)) ) break; \ increment_ptr_to_guest_entry(_gl2p); \ } \ - unmap_shadow_page(_sp); \ + sh_unmap_domain_page(_sp); \ _sl2mfn = _mfn(mfn_x(_sl2mfn) + 1); \ } \ -} while (0) - -#elif GUEST_PAGING_LEVELS == 2 - -/* 32-bit on 32-bit: avoid Xen entries */ -#define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _dom, _code) \ -do { \ - int _i; \ - int _xen = !shadow_mode_external(_dom); \ - shadow_l2e_t *_sp = map_shadow_page((_sl2mfn)); \ - ASSERT(mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2_32_shadow); \ - for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ ) \ - if ( (!(_xen)) \ - || \ - (_i < (HYPERVISOR_VIRT_START >> SHADOW_L2_PAGETABLE_SHIFT)) ) \ - { \ - (_sl2e) = _sp + _i; \ - if ( shadow_l2e_get_flags(*(_sl2e)) & _PAGE_PRESENT ) \ - {_code} \ - if ( _done ) break; \ - increment_ptr_to_guest_entry(_gl2p); \ - } \ - unmap_shadow_page(_sp); \ } while (0) #elif GUEST_PAGING_LEVELS == 3 @@ -1507,7 +1479,7 @@ do { do { \ int _i; \ int _xen = !shadow_mode_external(_dom); \ - shadow_l2e_t *_sp = map_shadow_page((_sl2mfn)); \ + shadow_l2e_t *_sp = sh_map_domain_page((_sl2mfn)); \ ASSERT(mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2_pae_shadow \ || mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2h_pae_shadow);\ for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ ) \ @@ -1522,7 +1494,7 @@ do { if ( _done ) break; \ increment_ptr_to_guest_entry(_gl2p); \ } \ - unmap_shadow_page(_sp); \ + sh_unmap_domain_page(_sp); \ } while (0) #else @@ -1532,7 +1504,7 @@ do { do { \ int _i; \ int _xen = !shadow_mode_external(_dom); \ - shadow_l2e_t *_sp = map_shadow_page((_sl2mfn)); \ + shadow_l2e_t *_sp = sh_map_domain_page((_sl2mfn)); \ ASSERT(mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2_64_shadow || \ mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2h_64_shadow); \ for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ ) \ @@ -1549,7 +1521,7 @@ do { increment_ptr_to_guest_entry(_gl2p); \ } \ } \ - unmap_shadow_page(_sp); \ + sh_unmap_domain_page(_sp); \ } while (0) #endif /* different kinds of l2 */ @@ -1560,7 +1532,7 @@ do { #define SHADOW_FOREACH_L3E(_sl3mfn, _sl3e, _gl3p, _done, _code) \ do { \ int _i; \ - shadow_l3e_t *_sp = map_shadow_page((_sl3mfn)); \ + shadow_l3e_t *_sp = sh_map_domain_page((_sl3mfn)); \ ASSERT(mfn_to_shadow_page(_sl3mfn)->type == SH_type_l3_64_shadow); \ for ( _i = 0; _i < SHADOW_L3_PAGETABLE_ENTRIES; _i++ ) \ { \ @@ -1570,13 +1542,13 @@ do { if ( _done ) break; \ increment_ptr_to_guest_entry(_gl3p); \ } \ - unmap_shadow_page(_sp); \ + sh_unmap_domain_page(_sp); \ } while (0) /* 64-bit l4: avoid Xen mappings */ #define SHADOW_FOREACH_L4E(_sl4mfn, _sl4e, _gl4p, _done, _dom, _code) \ do { \ - shadow_l4e_t *_sp = map_shadow_page((_sl4mfn)); \ + shadow_l4e_t *_sp = sh_map_domain_page((_sl4mfn)); \ int _xen = !shadow_mode_external(_dom); \ int _i; \ ASSERT(mfn_to_shadow_page(_sl4mfn)->type == SH_type_l4_64_shadow); \ @@ -1591,7 +1563,7 @@ do { } \ increment_ptr_to_guest_entry(_gl4p); \ } \ - unmap_shadow_page(_sp); \ + sh_unmap_domain_page(_sp); \ } while (0) #endif @@ -2606,7 +2578,7 @@ sh_map_and_validate(struct vcpu *v, mfn_ guest_idx = guest_index(new_gp); map_mfn = smfn; shadow_idx = shadow_index(&map_mfn, guest_idx); - sl1p = map_shadow_page(map_mfn); + sl1p = sh_map_domain_page(map_mfn); /* Validate one entry at a time */ while ( size ) @@ -2618,8 +2590,8 @@ sh_map_and_validate(struct vcpu *v, mfn_ { /* We have moved to another page of the shadow */ map_mfn = smfn2; - unmap_shadow_page(sl1p); - sl1p = map_shadow_page(map_mfn); + sh_unmap_domain_page(sl1p); + sl1p = sh_map_domain_page(map_mfn); } result |= validate_ge(v, new_gp, @@ -2628,7 +2600,7 @@ sh_map_and_validate(struct vcpu *v, mfn_ size -= sizeof(guest_l1e_t); new_gp += sizeof(guest_l1e_t); } - unmap_shadow_page(sl1p); + sh_unmap_domain_page(sl1p); return result; } @@ -2875,7 +2847,7 @@ static int sh_page_fault(struct vcpu *v, // bunch of 4K maps. // -#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH) && SHADOW_PAGING_LEVELS > 2 +#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH) if ( (regs->error_code & PFEC_reserved_bit) ) { /* The only reasons for reserved bits to be set in shadow entries @@ -3282,7 +3254,7 @@ sh_invlpg(struct vcpu *v, unsigned long if ( (!shadow_l3e_get_flags(sl3e) & _PAGE_PRESENT) ) return 0; } -#elif SHADOW_PAGING_LEVELS == 3 +#else /* SHADOW_PAGING_LEVELS == 3 */ if ( !(l3e_get_flags(v->arch.paging.shadow.l3table[shadow_l3_linear_offset(va)]) & _PAGE_PRESENT) ) // no need to flush anything if there's no SL2... @@ -3827,10 +3799,6 @@ sh_update_cr3(struct vcpu *v, int do_loc #error this should never happen #endif -#if 0 - printk("%s %s %d gmfn=%05lx shadow.guest_vtable=%p\n", - __func__, __FILE__, __LINE__, gmfn, v->arch.paging.shadow.guest_vtable); -#endif //// //// vcpu->arch.shadow_table[] @@ -3891,8 +3859,6 @@ sh_update_cr3(struct vcpu *v, int do_loc #error This should never happen #endif -#if (CONFIG_PAGING_LEVELS == 3) && (GUEST_PAGING_LEVELS == 3) -#endif /// /// v->arch.paging.shadow.l3table @@ -3937,7 +3903,7 @@ sh_update_cr3(struct vcpu *v, int do_loc ASSERT(virt_to_maddr(&v->arch.paging.shadow.l3table) <= 0xffffffe0ULL); v->arch.cr3 = virt_to_maddr(&v->arch.paging.shadow.l3table); #else - /* 2-on-2 or 4-on-4: Just use the shadow top-level directly */ + /* 4-on-4: Just use the shadow top-level directly */ make_cr3(v, pagetable_get_pfn(v->arch.shadow_table[0])); #endif } @@ -3954,7 +3920,7 @@ sh_update_cr3(struct vcpu *v, int do_loc v->arch.hvm_vcpu.hw_cr[3] = virt_to_maddr(&v->arch.paging.shadow.l3table); #else - /* 2-on-2 or 4-on-4: Just use the shadow top-level directly */ + /* 4-on-4: Just use the shadow top-level directly */ v->arch.hvm_vcpu.hw_cr[3] = pagetable_get_paddr(v->arch.shadow_table[0]); #endif @@ -3988,11 +3954,9 @@ static int sh_guess_wrmap(struct vcpu *v { shadow_l1e_t sl1e, *sl1p; shadow_l2e_t *sl2p; -#if SHADOW_PAGING_LEVELS >= 3 shadow_l3e_t *sl3p; #if SHADOW_PAGING_LEVELS >= 4 shadow_l4e_t *sl4p; -#endif #endif mfn_t sl1mfn; int r; @@ -4005,7 +3969,7 @@ static int sh_guess_wrmap(struct vcpu *v sl3p = sh_linear_l3_table(v) + shadow_l3_linear_offset(vaddr); if ( !(shadow_l3e_get_flags(*sl3p) & _PAGE_PRESENT) ) return 0; -#elif SHADOW_PAGING_LEVELS == 3 +#else /* SHADOW_PAGING_LEVELS == 3 */ sl3p = ((shadow_l3e_t *) v->arch.paging.shadow.l3table) + shadow_l3_linear_offset(vaddr); if ( !(shadow_l3e_get_flags(*sl3p) & _PAGE_PRESENT) ) @@ -4536,7 +4500,7 @@ int sh_audit_l1_table(struct vcpu *v, mf if ( sh_l1e_is_magic(*sl1e) ) { -#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH) && SHADOW_PAGING_LEVELS > 2 +#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH) if ( sh_l1e_is_gnp(*sl1e) ) { if ( guest_l1e_get_flags(*gl1e) & _PAGE_PRESENT ) diff -r c99a88623eda -r 810d8c3ac992 xen/arch/x86/mm/shadow/multi.h --- a/xen/arch/x86/mm/shadow/multi.h Thu May 08 14:33:31 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.h Thu May 08 16:58:33 2008 +0100 @@ -22,98 +22,96 @@ */ extern int -SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_map_and_validate_gl1e, GUEST_LEVELS)( struct vcpu *v, mfn_t gl1mfn, void *new_gl1p, u32 size); extern int -SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, GUEST_LEVELS)( struct vcpu *v, mfn_t gl2mfn, void *new_gl2p, u32 size); extern int -SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, GUEST_LEVELS)( struct vcpu *v, mfn_t gl2mfn, void *new_gl2p, u32 size); extern int -SHADOW_INTERNAL_NAME(sh_map_and_validate_gl3e, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_map_and_validate_gl3e, GUEST_LEVELS)( struct vcpu *v, mfn_t gl3mfn, void *new_gl3p, u32 size); extern int -SHADOW_INTERNAL_NAME(sh_map_and_validate_gl4e, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_map_and_validate_gl4e, GUEST_LEVELS)( struct vcpu *v, mfn_t gl4mfn, void *new_gl4p, u32 size); extern void -SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, GUEST_LEVELS)( struct vcpu *v, mfn_t smfn); extern void -SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, GUEST_LEVELS)( struct vcpu *v, mfn_t smfn); extern void -SHADOW_INTERNAL_NAME(sh_destroy_l3_shadow, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_destroy_l3_shadow, GUEST_LEVELS)( struct vcpu *v, mfn_t smfn); extern void -SHADOW_INTERNAL_NAME(sh_destroy_l4_shadow, SHADOW_LEVELS, GUEST_LEVELS)( +SHADOW_INTERNAL_NAME(sh_destroy_l4_shadow, GUEST_LEVELS)( struct vcpu *v, mfn_t smfn); extern void -SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_unhook_32b_mappings, GUEST_LEVELS) (struct vcpu *v, mfn_t sl2mfn); extern void -SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_unhook_pae_mappings, GUEST_LEVELS) (struct vcpu *v, mfn_t sl3mfn); extern void -SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_unhook_64b_mappings, GUEST_LEVELS) (struct vcpu *v, mfn_t sl4mfn); extern int -SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, GUEST_LEVELS) (struct vcpu *v, mfn_t sl1mfn, mfn_t readonly_mfn); extern int -SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, GUEST_LEVELS) (struct vcpu *v, mfn_t sl1mfn, mfn_t target_mfn); extern void -SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, GUEST_LEVELS) (struct vcpu *v, void *ep, mfn_t smfn); extern int -SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, GUEST_LEVELS) (struct vcpu *v, mfn_t sl2mfn, mfn_t sl1mfn); extern int -SHADOW_INTERNAL_NAME(sh_remove_l2_shadow, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_remove_l2_shadow, GUEST_LEVELS) (struct vcpu *v, mfn_t sl3mfn, mfn_t sl2mfn); extern int -SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, GUEST_LEVELS) (struct vcpu *v, mfn_t sl4mfn, mfn_t sl3mfn); #if SHADOW_AUDIT & SHADOW_AUDIT_ENTRIES int -SHADOW_INTERNAL_NAME(sh_audit_l1_table, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_audit_l1_table, GUEST_LEVELS) (struct vcpu *v, mfn_t sl1mfn, mfn_t x); int -SHADOW_INTERNAL_NAME(sh_audit_fl1_table, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_audit_fl1_table, GUEST_LEVELS) (struct vcpu *v, mfn_t sl1mfn, mfn_t x); int -SHADOW_INTERNAL_NAME(sh_audit_l2_table, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_audit_l2_table, GUEST_LEVELS) (struct vcpu *v, mfn_t sl2mfn, mfn_t x); int -SHADOW_INTERNAL_NAME(sh_audit_l3_table, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_audit_l3_table, GUEST_LEVELS) (struct vcpu *v, mfn_t sl3mfn, mfn_t x); int -SHADOW_INTERNAL_NAME(sh_audit_l4_table, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_audit_l4_table, GUEST_LEVELS) (struct vcpu *v, mfn_t sl4mfn, mfn_t x); #endif extern void * -SHADOW_INTERNAL_NAME(sh_guest_map_l1e, CONFIG_PAGING_LEVELS, CONFIG_PAGING_LEVELS) +SHADOW_INTERNAL_NAME(sh_guest_map_l1e, CONFIG_PAGING_LEVELS) (struct vcpu *v, unsigned long va, unsigned long *gl1mfn); extern void -SHADOW_INTERNAL_NAME(sh_guest_get_eff_l1e, CONFIG_PAGING_LEVELS, CONFIG_PAGING_LEVELS) +SHADOW_INTERNAL_NAME(sh_guest_get_eff_l1e, CONFIG_PAGING_LEVELS) (struct vcpu *v, unsigned long va, void *eff_l1e); -#if SHADOW_LEVELS == GUEST_LEVELS extern mfn_t -SHADOW_INTERNAL_NAME(sh_make_monitor_table, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_make_monitor_table, GUEST_LEVELS) (struct vcpu *v); extern void -SHADOW_INTERNAL_NAME(sh_destroy_monitor_table, SHADOW_LEVELS, GUEST_LEVELS) +SHADOW_INTERNAL_NAME(sh_destroy_monitor_table, GUEST_LEVELS) (struct vcpu *v, mfn_t mmfn); -#endif extern struct paging_mode -SHADOW_INTERNAL_NAME(sh_paging_mode, SHADOW_LEVELS, GUEST_LEVELS); +SHADOW_INTERNAL_NAME(sh_paging_mode, GUEST_LEVELS); diff -r c99a88623eda -r 810d8c3ac992 xen/arch/x86/mm/shadow/private.h --- a/xen/arch/x86/mm/shadow/private.h Thu May 08 14:33:31 2008 +0100 +++ b/xen/arch/x86/mm/shadow/private.h Thu May 08 16:58:33 2008 +0100 @@ -157,49 +157,23 @@ extern void shadow_audit_tables(struct v * Macro for dealing with the naming of the internal names of the * shadow code's external entry points. */ -#define SHADOW_INTERNAL_NAME_HIDDEN(name, shadow_levels, guest_levels) \ - name ## __shadow_ ## shadow_levels ## _guest_ ## guest_levels -#define SHADOW_INTERNAL_NAME(name, shadow_levels, guest_levels) \ - SHADOW_INTERNAL_NAME_HIDDEN(name, shadow_levels, guest_levels) - -#if CONFIG_PAGING_LEVELS == 3 +#define SHADOW_INTERNAL_NAME_HIDDEN(name, guest_levels) \ + name ## __guest_ ## guest_levels +#define SHADOW_INTERNAL_NAME(name, guest_levels) \ + SHADOW_INTERNAL_NAME_HIDDEN(name, guest_levels) + #define GUEST_LEVELS 2 -#define SHADOW_LEVELS 3 #include "multi.h" #undef GUEST_LEVELS -#undef SHADOW_LEVELS #define GUEST_LEVELS 3 -#define SHADOW_LEVELS 3 #include "multi.h" #undef GUEST_LEVELS -#undef SHADOW_LEVELS -#endif /* CONFIG_PAGING_LEVELS == 3 */ #if CONFIG_PAGING_LEVELS == 4 -#define GUEST_LEVELS 2 -#define SHADOW_LEVELS 3 +#define GUEST_LEVELS 4 #include "multi.h" #undef GUEST_LEVELS -#undef SHADOW_LEVELS - -#define GUEST_LEVELS 3 -#define SHADOW_LEVELS 3 -#include "multi.h" -#undef GUEST_LEVELS -#undef SHADOW_LEVELS - -#define GUEST_LEVELS 3 -#define SHADOW_LEVELS 4 -#include "multi.h" -#undef GUEST_LEVELS -#undef SHADOW_LEVELS - -#define GUEST_LEVELS 4 -#define SHADOW_LEVELS 4 -#include "multi.h" -#undef GUEST_LEVELS -#undef SHADOW_LEVELS #endif /* CONFIG_PAGING_LEVELS == 4 */ /****************************************************************************** diff -r c99a88623eda -r 810d8c3ac992 xen/arch/x86/mm/shadow/types.h --- a/xen/arch/x86/mm/shadow/types.h Thu May 08 14:33:31 2008 +0100 +++ b/xen/arch/x86/mm/shadow/types.h Thu May 08 16:58:33 2008 +0100 @@ -23,47 +23,19 @@ #ifndef _XEN_SHADOW_TYPES_H #define _XEN_SHADOW_TYPES_H -// Map a shadow page -static inline void * -map_shadow_page(mfn_t smfn) -{ - // XXX -- Possible optimization/measurement question for 32-bit and PAE - // hypervisors: - // How often is this smfn already available in the shadow linear - // table? Might it be worth checking that table first, - // presumably using the reverse map hint in the page_info of this - // smfn, rather than calling map_domain_page()? - // - return sh_map_domain_page(smfn); -} - -// matching unmap for map_shadow_page() -static inline void -unmap_shadow_page(void *p) -{ - sh_unmap_domain_page(p); -} +/* The number of levels in the shadow pagetable is entirely determined + * by the number of levels in the guest pagetable */ +#if GUEST_PAGING_LEVELS == 4 +#define SHADOW_PAGING_LEVELS 4 +#else +#define SHADOW_PAGING_LEVELS 3 +#endif /* * Define various types for handling pagetabels, based on these options: * SHADOW_PAGING_LEVELS : Number of levels of shadow pagetables * GUEST_PAGING_LEVELS : Number of levels of guest pagetables */ - -#if (CONFIG_PAGING_LEVELS < SHADOW_PAGING_LEVELS) -#error Cannot have more levels of shadow pagetables than host pagetables -#endif - -#if (SHADOW_PAGING_LEVELS < GUEST_PAGING_LEVELS) -#error Cannot have more levels of guest pagetables than shadow pagetables -#endif - -#if SHADOW_PAGING_LEVELS == 2 -#define SHADOW_L1_PAGETABLE_ENTRIES 1024 -#define SHADOW_L2_PAGETABLE_ENTRIES 1024 -#define SHADOW_L1_PAGETABLE_SHIFT 12 -#define SHADOW_L2_PAGETABLE_SHIFT 22 -#endif #if SHADOW_PAGING_LEVELS == 3 #define SHADOW_L1_PAGETABLE_ENTRIES 512 @@ -72,9 +44,7 @@ unmap_shadow_page(void *p) #define SHADOW_L1_PAGETABLE_SHIFT 12 #define SHADOW_L2_PAGETABLE_SHIFT 21 #define SHADOW_L3_PAGETABLE_SHIFT 30 -#endif - -#if SHADOW_PAGING_LEVELS == 4 +#else /* SHADOW_PAGING_LEVELS == 4 */ #define SHADOW_L1_PAGETABLE_ENTRIES 512 #define SHADOW_L2_PAGETABLE_ENTRIES 512 #define SHADOW_L3_PAGETABLE_ENTRIES 512 @@ -88,11 +58,9 @@ unmap_shadow_page(void *p) /* Types of the shadow page tables */ typedef l1_pgentry_t shadow_l1e_t; typedef l2_pgentry_t shadow_l2e_t; -#if SHADOW_PAGING_LEVELS >= 3 typedef l3_pgentry_t shadow_l3e_t; #if SHADOW_PAGING_LEVELS >= 4 typedef l4_pgentry_t shadow_l4e_t; -#endif #endif /* Access functions for them */ @@ -100,39 +68,33 @@ static inline paddr_t shadow_l1e_get_pad { return l1e_get_paddr(sl1e); } static inline paddr_t shadow_l2e_get_paddr(shadow_l2e_t sl2e) { return l2e_get_paddr(sl2e); } -#if SHADOW_PAGING_LEVELS >= 3 static inline paddr_t shadow_l3e_get_paddr(shadow_l3e_t sl3e) { return l3e_get_paddr(sl3e); } #if SHADOW_PAGING_LEVELS >= 4 static inline paddr_t shadow_l4e_get_paddr(shadow_l4e_t sl4e) { return l4e_get_paddr(sl4e); } -#endif #endif static inline mfn_t shadow_l1e_get_mfn(shadow_l1e_t sl1e) { return _mfn(l1e_get_pfn(sl1e)); } static inline mfn_t shadow_l2e_get_mfn(shadow_l2e_t sl2e) { return _mfn(l2e_get_pfn(sl2e)); } -#if SHADOW_PAGING_LEVELS >= 3 static inline mfn_t shadow_l3e_get_mfn(shadow_l3e_t sl3e) { return _mfn(l3e_get_pfn(sl3e)); } #if SHADOW_PAGING_LEVELS >= 4 static inline mfn_t shadow_l4e_get_mfn(shadow_l4e_t sl4e) { return _mfn(l4e_get_pfn(sl4e)); } -#endif #endif static inline u32 shadow_l1e_get_flags(shadow_l1e_t sl1e) { return l1e_get_flags(sl1e); } static inline u32 shadow_l2e_get_flags(shadow_l2e_t sl2e) { return l2e_get_flags(sl2e); } -#if SHADOW_PAGING_LEVELS >= 3 static inline u32 shadow_l3e_get_flags(shadow_l3e_t sl3e) { return l3e_get_flags(sl3e); } #if SHADOW_PAGING_LEVELS >= 4 static inline u32 shadow_l4e_get_flags(shadow_l4e_t sl4e) { return l4e_get_flags(sl4e); } -#endif #endif static inline shadow_l1e_t @@ -143,26 +105,22 @@ static inline shadow_l1e_t shadow_l1e_em { return l1e_empty(); } static inline shadow_l2e_t shadow_l2e_empty(void) { return l2e_empty(); } -#if SHADOW_PAGING_LEVELS >= 3 static inline shadow_l3e_t shadow_l3e_empty(void) { return l3e_empty(); } #if SHADOW_PAGING_LEVELS >= 4 static inline shadow_l4e_t shadow_l4e_empty(void) { return l4e_empty(); } -#endif #endif static inline shadow_l1e_t shadow_l1e_from_mfn(mfn_t mfn, u32 flags) { return l1e_from_pfn(mfn_x(mfn), flags); } static inline shadow_l2e_t shadow_l2e_from_mfn(mfn_t mfn, u32 flags) { return l2e_from_pfn(mfn_x(mfn), flags); } -#if SHADOW_PAGING_LEVELS >= 3 static inline shadow_l3e_t shadow_l3e_from_mfn(mfn_t mfn, u32 flags) { return l3e_from_pfn(mfn_x(mfn), flags); } #if SHADOW_PAGING_LEVELS >= 4 static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags) { return l4e_from_pfn(mfn_x(mfn), flags); } -#endif #endif #define shadow_l1_table_offset(a) l1_table_offset(a) @@ -441,8 +399,7 @@ struct shadow_walk_t /* macros for dealing with the naming of the internal function names of the * shadow code's external entry points. */ -#define INTERNAL_NAME(name) \ - SHADOW_INTERNAL_NAME(name, SHADOW_PAGING_LEVELS, GUEST_PAGING_LEVELS) +#define INTERNAL_NAME(name) SHADOW_INTERNAL_NAME(name, GUEST_PAGING_LEVELS) /* macros for renaming the primary entry points, so that they are more * easily distinguished from a debugger @@ -481,42 +438,24 @@ struct shadow_walk_t #define sh_guess_wrmap INTERNAL_NAME(sh_guess_wrmap) #define sh_clear_shadow_entry INTERNAL_NAME(sh_clear_shadow_entry) -/* The sh_guest_(map|get)_* functions only depends on the number of config - * levels - */ -#define sh_guest_map_l1e \ - SHADOW_INTERNAL_NAME(sh_guest_map_l1e, \ - CONFIG_PAGING_LEVELS, \ - CONFIG_PAGING_LEVELS) -#define sh_guest_get_eff_l1e \ - SHADOW_INTERNAL_NAME(sh_guest_get_eff_l1e, \ - CONFIG_PAGING_LEVELS, \ - CONFIG_PAGING_LEVELS) - -/* sh_make_monitor_table only depends on the number of shadow levels */ -#define sh_make_monitor_table \ - SHADOW_INTERNAL_NAME(sh_make_monitor_table, \ - SHADOW_PAGING_LEVELS, \ - SHADOW_PAGING_LEVELS) -#define sh_destroy_monitor_table \ - SHADOW_INTERNAL_NAME(sh_destroy_monitor_table, \ - SHADOW_PAGING_LEVELS, \ - SHADOW_PAGING_LEVELS) - + +/* The sh_guest_(map|get)_* functions depends on Xen's paging levels */ +#define sh_guest_map_l1e \ + SHADOW_INTERNAL_NAME(sh_guest_map_l1e, CONFIG_PAGING_LEVELS) +#define sh_guest_get_eff_l1e \ + SHADOW_INTERNAL_NAME(sh_guest_get_eff_l1e, CONFIG_PAGING_LEVELS) + +/* sh_make_monitor_table depends only on the number of shadow levels */ +#define sh_make_monitor_table \ + SHADOW_INTERNAL_NAME(sh_make_monitor_table, SHADOW_PAGING_LEVELS) +#define sh_destroy_monitor_table \ + SHADOW_INTERNAL_NAME(sh_destroy_monitor_table, SHADOW_PAGING_LEVELS) #if SHADOW_PAGING_LEVELS == 3 #define MFN_FITS_IN_HVM_CR3(_MFN) !(mfn_x(_MFN) >> 20) #endif -#if SHADOW_PAGING_LEVELS == 2 -#define SH_PRI_pte "08x" -#else /* SHADOW_PAGING_LEVELS >= 3 */ -#ifndef __x86_64__ -#define SH_PRI_pte "016llx" -#else -#define SH_PRI_pte "016lx" -#endif -#endif /* SHADOW_PAGING_LEVELS >= 3 */ +#define SH_PRI_pte PRIpte #if GUEST_PAGING_LEVELS == 2 #define SH_PRI_gpte "08x" @@ -529,7 +468,7 @@ struct shadow_walk_t #endif /* GUEST_PAGING_LEVELS >= 3 */ -#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH) && SHADOW_PAGING_LEVELS > 2 +#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH) /****************************************************************************** * We implement a "fast path" for two special cases: faults that require * MMIO emulation, and faults where the guest PTE is not present. We diff -r c99a88623eda -r 810d8c3ac992 xen/include/asm-x86/mtrr.h --- a/xen/include/asm-x86/mtrr.h Thu May 08 14:33:31 2008 +0100 +++ b/xen/include/asm-x86/mtrr.h Thu May 08 16:58:33 2008 +0100 @@ -62,5 +62,8 @@ extern int mtrr_del(int reg, unsigned lo extern int mtrr_del(int reg, unsigned long base, unsigned long size); extern int mtrr_del_page(int reg, unsigned long base, unsigned long size); extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi); +extern u32 get_pat_flags(struct vcpu *v, u32 gl1e_flags, paddr_t gpaddr, + paddr_t spaddr); +extern unsigned char pat_type_2_pte_flags(unsigned char pat_type); #endif /* __ASM_X86_MTRR_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From tiffany_tran_af@mindspring.com Sat May 10 21:26:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 10 May 2008 21:26:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jv38Y-0004WN-Qm for www-data@colo.xensource.com; Sat, 10 May 2008 21:26:15 -0700 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jv38x-00009t-Lt; Sun, 11 May 2008 04:26:39 +0000 Received: from [201.79.43.135] (helo=excite.com) by lists.xensource.com with esmtp (Exim 4.50) id 1Jv388-0007gf-Up; Sun, 11 May 2008 04:26:27 +0000 Date: Sun, 11 May 2008 03:23:48 +0000 From: "Tiffany Tran" X-Sender: MIME-Version: 1.0 Sender: Message-ID: <1210476228.4758@mindspring.com> To: xen-changelog@lists.xensource.com, r-users@lists.xensource.com, www-data@lists.xensource.com, xen-announce@lists.xensource.com, xen-fr@lists.xensource.com, xen-fr-bounces@lists.xensource.com, xen-fr-request@lists.xensource.com, xen-ia64-devel@lists.xensource.com, xense-devel@lists.xensource.com Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 201.79.43.135 X-SA-Exim-Mail-From: tiffany_tran_af@mindspring.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=5.0 tests=BAYES_99 autolearn=no version=3.1.0 Subject: SOLD OUT -LIMITED OFFER- I Selling Rolexes and other watches? DO uou want? o5h2b X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Dear xen-changelog@lists.xensource.com Do you want Rolex under 230$? If yes Please visit our site http://ninisii.com http://ninisii.com Thanks Rebeca Moore xen-changelog@lists.xensource.com wrote: > SOLD OUT -LIMITED OFFER- I Selling Rolexes and other watches? DO uou want? zjcut6et5w- out me now http://ninisii.com/remove/ From mcCall_fe@gateway.net Sat May 10 21:27:27 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 10 May 2008 21:27:27 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jv39j-0004XH-Az for www-data@colo.xensource.com; Sat, 10 May 2008 21:27:27 -0700 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jv3A8-0000BE-FR; Sun, 11 May 2008 04:27:52 +0000 Received: from [201.79.43.135] (helo=mb.infoweb.ne.jp) by lists.xensource.com with esmtp (Exim 4.50) id 1Jv39X-0007hR-0v; Sun, 11 May 2008 04:27:40 +0000 Sender: Date: Sun, 11 May 2008 03:25:11 +0000 Message-ID: <1210476311.5380@gateway.net> X-Sender: To: xen-changelog@lists.xensource.com, r-users@lists.xensource.com, www-data@lists.xensource.com, xen-announce@lists.xensource.com, xen-fr@lists.xensource.com, xen-fr-bounces@lists.xensource.com, xen-fr-request@lists.xensource.com, xen-ia64-devel@lists.xensource.com, xense-devel@lists.xensource.com From: "Sue McCall" MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 201.79.43.135 X-SA-Exim-Mail-From: mcCall_fe@gateway.net X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: *** X-Spam-Status: No, score=3.5 required=5.0 tests=BAYES_99 autolearn=no version=3.1.0 Subject: SOLD OUT -LIMITED OFFER-Looking for Gift? Buy Rolex yykt8 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Dear xen-changelog@lists.xensource.com http://esselos.com What is Prestige Replica store? At Prestige Replica, we specialize in the sales of brand-name quality, luxury replicas at some of the lowest prices possible. With our large selection of products, you can be sure to find that perfect gift for yourself or a loved one. http://esselos.com Thanks Ann Anniston xen-changelog@lists.xensource.com wrote: > SOLD OUT -LIMITED OFFER-Looking for perfect gift? Buy Rolex ndj5q32ruf- out me now http://esselos.com/remove/ From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4J-0004Mp-Fu for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb4u-0007H5-FH; Mon, 12 May 2008 16:40:44 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb4r-0007GA-Va for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:41 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb4k-0003p7-Sm for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:39 +0000 X-SBRS: 3.6 X-MesageID: 197138 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197138" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdpKH010077 for ; Mon, 12 May 2008 09:39:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe9ls028300 for ; Mon, 12 May 2008 09:40:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGe9um028299 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:09 -0700 Message-Id: <200805121640.m4CGe9um028299@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Fix fatal page fault when vram dirty logic handles MMIO of passthrough devices. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210582861 -3600 # Node ID 14d362d5fa5913a2e917cdd0ca90cf3b898a45d7 # Parent 810d8c3ac992e8979abb2e60cac5cef5ed6ccb36 x86: Fix fatal page fault when vram dirty logic handles MMIO of passthrough devices. Signed-off-by: Qing He --- xen/arch/x86/mm/shadow/multi.c | 6 ++++++ 1 files changed, 6 insertions(+) diff -r 810d8c3ac992 -r 14d362d5fa59 xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu May 08 16:58:33 2008 +0100 +++ b/xen/arch/x86/mm/shadow/multi.c Mon May 12 10:01:01 2008 +0100 @@ -1268,6 +1268,9 @@ static inline void shadow_vram_get_l1e(s if ( !d->dirty_vram ) return; mfn = shadow_l1e_get_mfn(new_sl1e); + + if ( !mfn_valid(mfn) ) return; /* m2p for mmio_direct may not exist */ + gfn = mfn_to_gfn(d, mfn); if ( (gfn >= d->dirty_vram->begin_pfn) && (gfn < d->dirty_vram->end_pfn) ) { @@ -1293,6 +1296,9 @@ static inline void shadow_vram_put_l1e(s if ( !d->dirty_vram ) return; mfn = shadow_l1e_get_mfn(old_sl1e); + + if ( !mfn_valid(mfn) ) return; + gfn = mfn_to_gfn(d, mfn); if ( (gfn >= d->dirty_vram->begin_pfn) && (gfn < d->dirty_vram->end_pfn) ) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:11 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:11 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4M-0004Ms-S0 for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:11 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb4x-0007K8-Rt; Mon, 12 May 2008 16:40:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb4u-0007GF-6I for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb4n-0003p8-2f for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:42 +0000 X-SBRS: 3.6 X-MesageID: 197139 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197139" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdrmb010083 for ; Mon, 12 May 2008 09:39:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeBfa028334 for ; Mon, 12 May 2008 09:40:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeBq0028333 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:11 -0700 Message-Id: <200805121640.m4CGeBq0028333@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Support MSI-X for HVM domains. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583246 -3600 # Node ID 4afc6023e8eca87590d7d6e89bebad45f299235c # Parent 5c00188dd159825e47547da59f691b2a3c59ac44 x86 hvm: Support MSI-X for HVM domains. Signed-off-by: Shan Haitao --- tools/ioemu/hw/pass-through.c | 11 + tools/ioemu/hw/pass-through.h | 21 +- tools/ioemu/hw/pt-msi.c | 424 +++++++++++++++++++++++++++++++++++++++--- tools/ioemu/hw/pt-msi.h | 15 + tools/libxc/xc_physdev.c | 2 tools/libxc/xenctrl.h | 1 6 files changed, 445 insertions(+), 29 deletions(-) diff -r 5c00188dd159 -r 4afc6023e8ec tools/ioemu/hw/pass-through.c --- a/tools/ioemu/hw/pass-through.c Mon May 12 10:06:40 2008 +0100 +++ b/tools/ioemu/hw/pass-through.c Mon May 12 10:07:26 2008 +0100 @@ -205,6 +205,7 @@ void pt_iomem_map(PCIDevice *d, int i, u if ( !first_map ) { + add_msix_mapping(assigned_device, i); /* Remove old mapping */ ret = xc_domain_memory_mapping(xc_handle, domid, old_ebase >> XC_PAGE_SHIFT, @@ -227,6 +228,9 @@ void pt_iomem_map(PCIDevice *d, int i, u if ( ret != 0 ) PT_LOG("Error: create new mapping failed!\n"); + ret = remove_msix_mapping(assigned_device, i); + if ( ret != 0 ) + PT_LOG("Error: remove MSX-X mmio mapping failed!\n"); } /* Being called each time a pio region has been updated */ @@ -289,6 +293,9 @@ static void pt_pci_write_config(PCIDevic } if ( pt_msi_write(assigned_device, address, val, len) ) + return; + + if ( pt_msix_write(assigned_device, address, val, len) ) return; /* PCI config pass-through */ @@ -338,6 +345,7 @@ static uint32_t pt_pci_read_config(PCIDe } pt_msi_read(assigned_device, address, len, &val); + pt_msix_read(assigned_device, address, len, &val); exit: #ifdef PT_DEBUG_PCI_CONFIG_ACCESS @@ -549,6 +557,9 @@ struct pt_dev * register_real_device(PCI if ( (pos = find_cap_offset(pci_dev, PCI_CAP_ID_MSI)) ) pt_msi_init(assigned_device, pos); + if ( (pos = find_cap_offset(pci_dev, PCI_CAP_ID_MSIX)) ) + pt_msix_init(assigned_device, pos); + /* Handle real device's MMIO/PIO BARs */ pt_register_regions(assigned_device); diff -r 5c00188dd159 -r 4afc6023e8ec tools/ioemu/hw/pass-through.h --- a/tools/ioemu/hw/pass-through.h Mon May 12 10:06:40 2008 +0100 +++ b/tools/ioemu/hw/pass-through.h Mon May 12 10:07:26 2008 +0100 @@ -61,8 +61,26 @@ struct pt_msi_info { uint32_t flags; int offset; int size; - int pvec; /* physical vector used */ int pirq; /* guest pirq corresponding */ +}; + +struct msix_entry_info { + int pirq; /* -1 means unmapped */ + int flags; /* flags indicting whether MSI ADDR or DATA is updated */ + uint32_t io_mem[4]; +}; + +struct pt_msix_info { + int enabled; + int offset; + int total_entries; + int bar_index; + uint32_t table_off; + u64 mmio_base_addr; + int mmio_index; + int fd; + void *phys_iomem_base; + struct msix_entry_info msix_entry[0]; }; /* @@ -74,6 +92,7 @@ struct pt_dev { struct pci_dev *pci_dev; /* libpci struct */ struct pt_region bases[PCI_NUM_REGIONS]; /* Access regions */ struct pt_msi_info *msi; /* MSI virtualization */ + struct pt_msix_info *msix; /* MSI-X virtualization */ }; /* Used for formatting PCI BDF into cf8 format */ diff -r 5c00188dd159 -r 4afc6023e8ec tools/ioemu/hw/pt-msi.c --- a/tools/ioemu/hw/pt-msi.c Mon May 12 10:06:40 2008 +0100 +++ b/tools/ioemu/hw/pt-msi.c Mon May 12 10:07:26 2008 +0100 @@ -20,7 +20,9 @@ */ #include "pt-msi.h" - +#include + +/* MSI virtuailization functions */ #define PT_MSI_CTRL_WR_MASK_HI (0x1) #define PT_MSI_CTRL_WR_MASK_LO (0x8E) #define PT_MSI_DATA_WR_MASK (0x38) @@ -76,7 +78,7 @@ int pt_msi_init(struct pt_dev *dev, int */ static int pt_msi_setup(struct pt_dev *dev) { - int vector = -1, pirq = -1; + int pirq = -1; if ( !(dev->msi->flags & MSI_FLAG_UNINIT) ) { @@ -85,15 +87,15 @@ static int pt_msi_setup(struct pt_dev *d } if ( xc_physdev_map_pirq_msi(xc_handle, domid, MAP_PIRQ_TYPE_MSI, - vector, &pirq, + AUTO_ASSIGN, &pirq, dev->pci_dev->dev << 3 | dev->pci_dev->func, - dev->pci_dev->bus, 1) ) - { - PT_LOG("error map vector %x\n", vector); + dev->pci_dev->bus, 0, 1) ) + { + PT_LOG("error map msi\n"); return -1; } dev->msi->pirq = pirq; - PT_LOG("vector %x pirq %x\n", vector, pirq); + PT_LOG("msi mapped with pirq %x\n", pirq); return 0; } @@ -147,15 +149,10 @@ static uint8_t get_msi_gctrl(struct pt_d return *(uint8_t *)(pd->config + d->msi->offset + PCI_MSI_FLAGS); } -static uint32_t get_msi_gflags(struct pt_dev *d) +static uint32_t __get_msi_gflags(uint32_t data, uint64_t addr) { uint32_t result = 0; int rh, dm, dest_id, deliv_mode, trig_mode; - uint16_t data; - uint64_t addr; - - data = get_msi_gdata(d); - addr = get_msi_gaddr(d); rh = (addr >> MSI_ADDR_REDIRECTION_SHIFT) & 0x1; dm = (addr >> MSI_ADDR_DESTMODE_SHIFT) & 0x1; @@ -170,25 +167,20 @@ static uint32_t get_msi_gflags(struct pt return result; } +static uint32_t get_msi_gflags(struct pt_dev *d) +{ + uint16_t data = get_msi_gdata(d); + uint64_t addr = get_msi_gaddr(d); + + return __get_msi_gflags(data, addr); +} + /* * This may be arch different */ static inline uint8_t get_msi_gvec(struct pt_dev *d) { return get_msi_gdata(d) & 0xff; -} - -static inline uint8_t get_msi_hvec(struct pt_dev *d) -{ - struct pci_dev *pd = d->pci_dev; - uint16_t data; - - if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) - data = pci_read_word(pd, PCI_MSI_DATA_64); - else - data = pci_read_word(pd, PCI_MSI_DATA_32); - - return data & 0xff; } /* @@ -198,7 +190,7 @@ static int pt_msi_update(struct pt_dev * static int pt_msi_update(struct pt_dev *d) { PT_LOG("now update msi with pirq %x gvec %x\n", - get_msi_gvec(d), d->msi->pirq); + d->msi->pirq, get_msi_gvec(d)); return xc_domain_update_msi_irq(xc_handle, domid, get_msi_gvec(d), d->msi->pirq, get_msi_gflags(d)); } @@ -266,7 +258,6 @@ static int static int pt_msi_map_update(struct pt_dev *d, uint32_t old_data, uint64_t old_addr) { - uint16_t pctrl; uint32_t data; uint64_t addr; @@ -301,6 +292,8 @@ static int pt_msi_mask_update(struct pt_ if ( old_mask != mask ) pci_write_long(pd, offset, mask); + + return 0; } #define ACCESSED_DATA 0x2 @@ -486,3 +479,378 @@ int pt_msi_read(struct pt_dev *d, int ad return e_len; } +/* MSI-X virtulization functions */ +#define PT_MSIX_CTRL_WR_MASK_HI (0xC0) +static void mask_physical_msix_entry(struct pt_dev *dev, int entry_nr, int mask) +{ + void *phys_off; + + phys_off = dev->msix->phys_iomem_base + 16 * entry_nr + 12; + *(uint32_t *)phys_off = mask; +} + +static int pt_msix_update_one(struct pt_dev *dev, int entry_nr) +{ + struct msix_entry_info *entry = &dev->msix->msix_entry[entry_nr]; + int pirq = entry->pirq; + int gvec = entry->io_mem[2] & 0xff; + uint64_t gaddr = *(uint64_t *)&entry->io_mem[0]; + uint32_t gflags = __get_msi_gflags(entry->io_mem[2], gaddr); + int ret; + + if ( !entry->flags ) + return 0; + + /* Check if this entry is already mapped */ + if ( entry->pirq == -1 ) + { + ret = xc_physdev_map_pirq_msi(xc_handle, domid, MAP_PIRQ_TYPE_MSI, + AUTO_ASSIGN, &pirq, + dev->pci_dev->dev << 3 | dev->pci_dev->func, + dev->pci_dev->bus, entry_nr, 0); + if ( ret ) + { + PT_LOG("error map msix entry %x\n", entry_nr); + return ret; + } + entry->pirq = pirq; + } + + PT_LOG("now update msix entry %x with pirq %x gvec %x\n", + entry_nr, pirq, gvec); + + ret = xc_domain_update_msi_irq(xc_handle, domid, gvec, pirq, gflags); + if ( ret ) + { + PT_LOG("error update msix irq info for entry %d\n", entry_nr); + return ret; + } + + entry->flags = 0; + + return 0; +} + +static int pt_msix_update(struct pt_dev *dev) +{ + struct pt_msix_info *msix = dev->msix; + int i; + + for ( i = 0; i < msix->total_entries; i++ ) + { + pt_msix_update_one(dev, i); + } + + return 0; +} + +static void pci_msix_invalid_write(void *opaque, target_phys_addr_t addr, + uint32_t val) +{ + PT_LOG("invalid write to MSI-X table, \ + only dword access is allowed.\n"); +} + +static void pci_msix_writel(void *opaque, target_phys_addr_t addr, uint32_t val) +{ + struct pt_dev *dev = (struct pt_dev *)opaque; + struct pt_msix_info *msix = dev->msix; + struct msix_entry_info *entry; + int entry_nr, offset; + + if ( addr % 4 ) + { + PT_LOG("unaligned dword access to MSI-X table, addr %016lx\n", + addr); + return; + } + + entry_nr = (addr - msix->mmio_base_addr) / 16; + entry = &msix->msix_entry[entry_nr]; + offset = ((addr - msix->mmio_base_addr) % 16) / 4; + + if ( offset != 3 && msix->enabled && entry->io_mem[3] & 0x1 ) + { + PT_LOG("can not update msix entry %d since MSI-X is already \ + function now.\n", entry_nr); + return; + } + + if ( offset != 3 && entry->io_mem[offset] != val ) + entry->flags = 1; + entry->io_mem[offset] = val; + + if ( offset == 3 ) + { + if ( !(val & 0x1) ) + pt_msix_update_one(dev, entry_nr); + mask_physical_msix_entry(dev, entry_nr, entry->io_mem[3] & 0x1); + } +} + +static CPUWriteMemoryFunc *pci_msix_write[] = { + pci_msix_invalid_write, + pci_msix_invalid_write, + pci_msix_writel +}; + +static uint32_t pci_msix_invalid_read(void *opaque, target_phys_addr_t addr) +{ + PT_LOG("invalid read to MSI-X table, \ + only dword access is allowed.\n"); + return 0; +} + +static uint32_t pci_msix_readl(void *opaque, target_phys_addr_t addr) +{ + struct pt_dev *dev = (struct pt_dev *)opaque; + struct pt_msix_info *msix = dev->msix; + int entry_nr, offset; + + if ( addr % 4 ) + { + PT_LOG("unaligned dword access to MSI-X table, addr %016lx\n", + addr); + return 0; + } + + entry_nr = (addr - msix->mmio_base_addr) / 16; + offset = ((addr - msix->mmio_base_addr) % 16) / 4; + + return msix->msix_entry[entry_nr].io_mem[offset]; +} + +static CPUReadMemoryFunc *pci_msix_read[] = { + pci_msix_invalid_read, + pci_msix_invalid_read, + pci_msix_readl +}; + +int add_msix_mapping(struct pt_dev *dev, int bar_index) +{ + if ( !(dev->msix && dev->msix->bar_index == bar_index) ) + return 0; + + return xc_domain_memory_mapping(xc_handle, domid, + dev->msix->mmio_base_addr >> XC_PAGE_SHIFT, + (dev->bases[bar_index].access.maddr + + dev->msix->table_off) >> XC_PAGE_SHIFT, + (dev->msix->total_entries * 16 + + XC_PAGE_SIZE -1) >> XC_PAGE_SHIFT, + DPCI_ADD_MAPPING); +} + +int remove_msix_mapping(struct pt_dev *dev, int bar_index) +{ + if ( !(dev->msix && dev->msix->bar_index == bar_index) ) + return 0; + + dev->msix->mmio_base_addr = dev->bases[bar_index].e_physbase + + dev->msix->table_off; + + cpu_register_physical_memory(dev->msix->mmio_base_addr, + dev->msix->total_entries * 16, + dev->msix->mmio_index); + + return xc_domain_memory_mapping(xc_handle, domid, + dev->msix->mmio_base_addr >> XC_PAGE_SHIFT, + (dev->bases[bar_index].access.maddr + + dev->msix->table_off) >> XC_PAGE_SHIFT, + (dev->msix->total_entries * 16 + + XC_PAGE_SIZE -1) >> XC_PAGE_SHIFT, + DPCI_REMOVE_MAPPING); +} + +int pt_msix_init(struct pt_dev *dev, int pos) +{ + uint8_t id; + uint16_t flags, control; + int i, total_entries, table_off, bar_index; + u64 bar_base; + struct pci_dev *pd = dev->pci_dev; + + id = pci_read_byte(pd, pos + PCI_CAP_LIST_ID); + + if ( id != PCI_CAP_ID_MSIX ) + { + PT_LOG("error id %x pos %x\n", id, pos); + return -1; + } + + control = pci_read_word(pd, pos + 2); + total_entries = control & 0x7ff; + total_entries += 1; + + dev->msix = malloc(sizeof(struct pt_msix_info) + + total_entries*sizeof(struct msix_entry_info)); + if ( !dev->msix ) + { + PT_LOG("error allocation pt_msix_info\n"); + return -1; + } + memset(dev->msix, 0, sizeof(struct pt_msix_info) + + total_entries*sizeof(struct msix_entry_info)); + dev->msix->total_entries = total_entries; + dev->msix->offset = pos; + for ( i = 0; i < total_entries; i++ ) + dev->msix->msix_entry[i].pirq = -1; + + dev->msix->mmio_index = + cpu_register_io_memory(0, pci_msix_read, pci_msix_write, dev); + + flags = pci_read_word(pd, pos + PCI_MSI_FLAGS); + if ( flags & PCI_MSIX_ENABLE ) + { + PT_LOG("MSIX enabled already, disable first\n"); + pci_write_word(pd, pos + PCI_MSI_FLAGS, flags & ~PCI_MSIX_ENABLE); + *(uint16_t *)&dev->dev.config[pos + PCI_MSI_FLAGS] + = flags & ~(PCI_MSIX_ENABLE | PCI_MSIX_MASK); + } + + table_off = pci_read_long(pd, pos + PCI_MSIX_TABLE); + bar_index = dev->msix->bar_index = table_off & PCI_MSIX_BIR; + table_off &= table_off & ~PCI_MSIX_BIR; + bar_base = pci_read_long(pd, 0x10 + 4 * bar_index); + if ( (bar_base & 0x6) == 0x4 ) + { + bar_base &= ~0xf; + bar_base += (u64)pci_read_long(pd, 0x10 + 4 * (bar_index + 1)) << 32; + } + PT_LOG("get MSI-X table bar base %lx\n", bar_base); + + dev->msix->fd = open("/dev/mem", O_RDWR); + dev->msix->phys_iomem_base = mmap(0, total_entries * 16, + PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED, + dev->msix->fd, bar_base + table_off); + PT_LOG("mapping physical MSI-X table to %lx\n", + (unsigned long)dev->msix->phys_iomem_base); + return 0; +} + +static int pt_msix_enable(struct pt_dev *d, int enable) +{ + uint16_t ctrl; + struct pci_dev *pd = d->pci_dev; + + if ( !pd ) + return -1; + + ctrl = pci_read_word(pd, d->msix->offset + PCI_MSI_FLAGS); + if ( enable ) + ctrl |= PCI_MSIX_ENABLE; + else + ctrl &= ~PCI_MSIX_ENABLE; + pci_write_word(pd, d->msix->offset + PCI_MSI_FLAGS, ctrl); + d->msix->enabled = !!enable; + + return 0; +} + +static int pt_msix_func_mask(struct pt_dev *d, int mask) +{ + uint16_t ctrl; + struct pci_dev *pd = d->pci_dev; + + if ( !pd ) + return -1; + + ctrl = pci_read_word(pd, d->msix->offset + PCI_MSI_FLAGS); + + if ( mask ) + ctrl |= PCI_MSIX_MASK; + else + ctrl &= ~PCI_MSIX_MASK; + + pci_write_word(pd, d->msix->offset + PCI_MSI_FLAGS, ctrl); + return 0; +} + +static int pt_msix_control_update(struct pt_dev *d) +{ + PCIDevice *pd = (PCIDevice *)d; + uint16_t ctrl = *(uint16_t *)(&pd->config[d->msix->offset + 2]); + + if ( ctrl & PCI_MSIX_ENABLE && !(ctrl & PCI_MSIX_MASK ) ) + pt_msix_update(d); + + pt_msix_func_mask(d, ctrl & PCI_MSIX_MASK); + pt_msix_enable(d, ctrl & PCI_MSIX_ENABLE); + + return 0; +} + +int pt_msix_write(struct pt_dev *d, uint32_t addr, uint32_t val, uint32_t len) +{ + struct pci_dev *pd; + int i, cur = addr; + uint8_t value; + PCIDevice *dev = (PCIDevice *)d; + + if ( !d || !d->msix ) + return 0; + + if ( (addr >= (d->msix->offset + 4) ) || + (addr + len) < d->msix->offset) + return 0; + + PT_LOG("addr %x val %x len %x offset %x\n", + addr, val, len, d->msix->offset); + + pd = d->pci_dev; + + for ( i = 0; i < len; i++, cur++ ) + { + uint8_t orig_value; + + if ( cur != d->msix->offset + 3 ) + continue; + + value = (val >> (i * 8)) & 0xff; + + orig_value = pci_read_byte(pd, cur); + value = (orig_value & ~PT_MSIX_CTRL_WR_MASK_HI) | + (value & PT_MSIX_CTRL_WR_MASK_HI); + dev->config[cur] = value; + pt_msix_control_update(d); + return 1; + } + + return 0; +} + +int pt_msix_read(struct pt_dev *d, int addr, int len, uint32_t *val) +{ + int e_addr = addr, e_len = len, offset = 0, i; + uint8_t e_val = 0; + PCIDevice *pd = (PCIDevice *)d; + + if ( !d || !d->msix ) + return 0; + + if ( (addr > (d->msix->offset + 3) ) || + (addr + len) <= d->msix->offset ) + return 0; + + if ( (addr + len ) > (d->msix->offset + 3) ) + e_len -= addr + len - d->msix->offset - 3; + + if ( addr < d->msix->offset ) + { + e_addr = d->msix->offset; + offset = d->msix->offset - addr; + e_len -= offset; + } + + for ( i = 0; i < e_len; i++ ) + { + e_val = *(uint8_t *)(&pd->config[e_addr] + i); + *val &= ~(0xff << ( (offset + i) * 8)); + *val |= (e_val << ( (offset + i) * 8)); + } + + PT_LOG("addr %x len %x val %x offset %x\n", + addr, len, *val, d->msix->offset); + + return e_len; +} + diff -r 5c00188dd159 -r 4afc6023e8ec tools/ioemu/hw/pt-msi.h --- a/tools/ioemu/hw/pt-msi.h Mon May 12 10:06:40 2008 +0100 +++ b/tools/ioemu/hw/pt-msi.h Mon May 12 10:07:26 2008 +0100 @@ -62,4 +62,19 @@ int int pt_msi_read(struct pt_dev *d, int addr, int len, uint32_t *val); +int +remove_msix_mapping(struct pt_dev *dev, int bar_index); + +int +add_msix_mapping(struct pt_dev *dev, int bar_index); + +int +pt_msix_init(struct pt_dev *dev, int pos); + +int +pt_msix_write(struct pt_dev *d, uint32_t addr, uint32_t val, uint32_t len); + +int +pt_msix_read(struct pt_dev *d, int addr, int len, uint32_t *val); + #endif diff -r 5c00188dd159 -r 4afc6023e8ec tools/libxc/xc_physdev.c --- a/tools/libxc/xc_physdev.c Mon May 12 10:06:40 2008 +0100 +++ b/tools/libxc/xc_physdev.c Mon May 12 10:07:26 2008 +0100 @@ -52,6 +52,7 @@ int xc_physdev_map_pirq_msi(int xc_handl int *pirq, int devfn, int bus, + int entry_nr, int msi_type) { int rc; @@ -66,6 +67,7 @@ int xc_physdev_map_pirq_msi(int xc_handl map.pirq = *pirq; map.msi_info.devfn = devfn; map.msi_info.bus = bus; + map.msi_info.entry_nr = entry_nr; map.msi_info.msi = msi_type; rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map); diff -r 5c00188dd159 -r 4afc6023e8ec tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Mon May 12 10:06:40 2008 +0100 +++ b/tools/libxc/xenctrl.h Mon May 12 10:07:26 2008 +0100 @@ -859,6 +859,7 @@ int xc_physdev_map_pirq_msi(int xc_handl int *pirq, int devfn, int bus, + int entry_nr, int msi_type); int xc_physdev_unmap_pirq(int xc_handle, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4R-0004Mw-EX for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:15 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb52-0007Nf-Ib; Mon, 12 May 2008 16:40:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb4w-0007He-L1 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb4o-0003pA-PR for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:44 +0000 X-SBRS: 3.6 X-MesageID: 197140 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197140" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdsG0010086 for ; Mon, 12 May 2008 09:39:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeCJE028351 for ; Mon, 12 May 2008 09:40:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeCax028350 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:12 -0700 Message-Id: <200805121640.m4CGeCax028350@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: fix disk format security vulnerability X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583352 -3600 # Node ID e3be00bd6aa963aca563692c271af762f9380ba0 # Parent 4afc6023e8eca87590d7d6e89bebad45f299235c ioemu: fix disk format security vulnerability * make the xenstore reader in qemu-dm's startup determine which of qemu's block drivers to use according to the xenstore backend `type' field. This `type' field typically comes from the front of the drive mapping string in ioemu. The supported cases are: xm config file string `type' image format qemu driver phy:[/dev/] phy raw image bdrv_raw file: file raw image bdrv_raw tap:aio: tap raw image bdrv_raw tap:qcow: tap not raw autoprobe tap:: tap named format bdrv_ It is still necessary to autoprobe when the image is specified as `tap:qcow:', because qemu distinguishes `qcow' and `qcow2' whereas blktap doesn't; `qcow' in xenstore typically means what qemu calls qcow2. This is OK because qemu can safely distinguish the different cow formats provided we know it's not a raw image. * Make the format autoprobing machinery never return `raw'. This has two purposes: firstly, it arranges that the `tap:qcow:...' case above can be handled without accidentally falling back to raw format. Secondly it prevents accidents in case the code changes in future: autoprobing will now always fail on supposed cow files which actually contain junk, rather than giving the guest access to the underlying file. Signed-off-by: Ian Jackson --- tools/ioemu/block.c | 2 +- tools/ioemu/xenstore.c | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 5 deletions(-) diff -r 4afc6023e8ec -r e3be00bd6aa9 tools/ioemu/block.c --- a/tools/ioemu/block.c Mon May 12 10:07:26 2008 +0100 +++ b/tools/ioemu/block.c Mon May 12 10:09:12 2008 +0100 @@ -254,7 +254,7 @@ static BlockDriver *find_protocol(const #endif p = strchr(filename, ':'); if (!p) - return &bdrv_raw; + return NULL; /* do not ever guess raw, it is a security problem! */ len = p - filename; if (len > sizeof(protocol) - 1) len = sizeof(protocol) - 1; diff -r 4afc6023e8ec -r e3be00bd6aa9 tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Mon May 12 10:07:26 2008 +0100 +++ b/tools/ioemu/xenstore.c Mon May 12 10:09:12 2008 +0100 @@ -90,6 +90,7 @@ void xenstore_parse_domain_config(int hv int i, is_scsi, is_hdN = 0; unsigned int len, num, hd_index, pci_devid = 0; BlockDriverState *bs; + BlockDriver *format; for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) media_filename[i] = NULL; @@ -135,6 +136,8 @@ void xenstore_parse_domain_config(int hv } for (i = 0; i < num; i++) { + format = NULL; /* don't know what the format is yet */ + /* read the backend path */ if (pasprintf(&buf, "%s/device/vbd/%s/backend", path, e[i]) == -1) continue; @@ -181,13 +184,20 @@ void xenstore_parse_domain_config(int hv drv = xs_read(xsh, XBT_NULL, buf, &len); if (drv == NULL) continue; - /* Strip off blktap sub-type prefix aio: - QEMU can autodetect this */ + /* Obtain blktap sub-type prefix */ if (!strcmp(drv, "tap") && params[0]) { char *offset = strchr(params, ':'); if (!offset) continue ; + free(drv); + drv = malloc(offset - params + 1); + memcpy(drv, params, offset - params); + drv[offset - params] = '\0'; + if (!strcmp(drv, "aio")) + /* qemu does aio anyway if it can */ + format = &bdrv_raw; memmove(params, offset+1, strlen(offset+1)+1 ); - fprintf(logfile, "Strip off blktap sub-type prefix to %s\n", params); + fprintf(logfile, "Strip off blktap sub-type prefix to %s (drv '%s')\n", params, drv); } /* Prefix with /dev/ if needed */ if (!strcmp(drv, "phy") && params[0] != '/') { @@ -195,6 +205,7 @@ void xenstore_parse_domain_config(int hv sprintf(newparams, "/dev/%s", params); free(params); params = newparams; + format = &bdrv_raw; } /* @@ -240,8 +251,25 @@ void xenstore_parse_domain_config(int hv #endif if (params[0]) { - if (bdrv_open(bs, params, 0 /* snapshot */) < 0) - fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s'\n", buf, params); + if (!format) { + if (!drv) { + fprintf(stderr, "qemu: type (image format) not specified for vbd '%s' or image '%s'\n", buf, params); + continue; + } + if (!strcmp(drv,"qcow")) { + /* autoguess qcow vs qcow2 */ + } else if (!strcmp(drv,"file")) { + format = &bdrv_raw; + } else { + format = bdrv_find_format(drv); + if (!format) { + fprintf(stderr, "qemu: type (image format) '%s' unknown for vbd '%s' or image '%s'\n", drv, buf, params); + continue; + } + } + } + if (bdrv_open2(bs, params, 0 /* snapshot */, format) < 0) + fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s')\n", buf, params, drv ? drv : "?"); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:20 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:20 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4V-0004N3-Nh for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:20 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb56-0007RV-Oy; Mon, 12 May 2008 16:40:56 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb4x-0007Id-Ia for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb4q-0003p7-4B for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:45 +0000 X-SBRS: 3.6 X-MesageID: 197141 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197141" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdq7f010080 for ; Mon, 12 May 2008 09:39:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeAwQ028317 for ; Mon, 12 May 2008 09:40:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeAjU028316 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:10 -0700 Message-Id: <200805121640.m4CGeAjU028316@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Clean MSI related data when destroy domain. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583200 -3600 # Node ID 5c00188dd159825e47547da59f691b2a3c59ac44 # Parent 14d362d5fa5913a2e917cdd0ca90cf3b898a45d7 x86 hvm: Clean MSI related data when destroy domain. Signed-off-by: Shan Haitao --- xen/arch/x86/msi.c | 16 ++++++++++++---- xen/drivers/passthrough/vtd/iommu.c | 1 + xen/include/asm-x86/msi.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff -r 14d362d5fa59 -r 5c00188dd159 xen/arch/x86/msi.c --- a/xen/arch/x86/msi.c Mon May 12 10:01:01 2008 +0100 +++ b/xen/arch/x86/msi.c Mon May 12 10:06:40 2008 +0100 @@ -780,8 +780,16 @@ void pci_disable_msi(int vector) __pci_disable_msix(vector); } -void pci_cleanup_msi(struct pci_dev *dev) -{ +void pci_cleanup_msi(u8 bus, u8 devfn) +{ + struct pci_dev *dev = get_msi_pdev(bus, devfn); + + if ( !dev ) + return; msi_free_vectors(dev); -} - + + /* Disable MSI and/or MSI-X */ + msi_set_enable(dev, 0); + msix_set_enable(dev, 0); +} + diff -r 14d362d5fa59 -r 5c00188dd159 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Mon May 12 10:01:01 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Mon May 12 10:06:40 2008 +0100 @@ -1434,6 +1434,7 @@ void return_devices_to_dom0(struct domai while ( !list_empty(&hd->pdev_list) ) { pdev = list_entry(hd->pdev_list.next, typeof(*pdev), list); + pci_cleanup_msi(pdev->bus, pdev->devfn); reassign_device_ownership(d, dom0, pdev->bus, pdev->devfn); } diff -r 14d362d5fa59 -r 5c00188dd159 xen/include/asm-x86/msi.h --- a/xen/include/asm-x86/msi.h Mon May 12 10:01:01 2008 +0100 +++ b/xen/include/asm-x86/msi.h Mon May 12 10:06:40 2008 +0100 @@ -68,6 +68,7 @@ extern void set_msi_irq_affinity(unsigne extern void set_msi_irq_affinity(unsigned int irq, cpumask_t mask); extern int pci_enable_msi(u8 bus, u8 devfn, int vector, int entry_nr, int msi); extern void pci_disable_msi(int vector); +extern void pci_cleanup_msi(u8 bus, u8 devfn); struct msi_desc { struct { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:26 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:26 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4b-0004NC-IP for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5C-0007VU-NZ; Mon, 12 May 2008 16:41:02 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb50-0007LK-RI for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb4s-0003p8-KV for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:48 +0000 X-SBRS: 3.6 X-MesageID: 197142 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197142" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdtRL010089 for ; Mon, 12 May 2008 09:39:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeDu7028368 for ; Mon, 12 May 2008 09:40:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeDhv028367 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:13 -0700 Message-Id: <200805121640.m4CGeDhv028367@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] pvfb/ioemu: transmit refresh interval advice from backend to frontend X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583403 -3600 # Node ID 3b20e543b52d40f76525a7e918fa347af2de00fe # Parent e3be00bd6aa963aca563692c271af762f9380ba0 pvfb/ioemu: transmit refresh interval advice from backend to frontend which permits the frontend to avoid useless polls. Signed-off-by: Samuel Thibault --- extras/mini-os/fbfront.c | 55 ++++++++++++ extras/mini-os/include/fbfront.h | 3 extras/mini-os/include/lib.h | 4 extras/mini-os/kernel.c | 67 +++++++++------ extras/mini-os/lib/sys.c | 20 ++++ tools/ioemu/hw/xenfb.c | 173 +++++++++++++++++++++++++++++++-------- tools/ioemu/sdl.c | 2 tools/ioemu/vl.c | 4 tools/ioemu/vl.h | 4 tools/ioemu/vnc.c | 47 ++++++---- xen/include/public/io/fbif.h | 21 ++++ 11 files changed, 320 insertions(+), 80 deletions(-) diff -r e3be00bd6aa9 -r 3b20e543b52d extras/mini-os/fbfront.c --- a/extras/mini-os/fbfront.c Mon May 12 10:09:12 2008 +0100 +++ b/extras/mini-os/fbfront.c Mon May 12 10:10:03 2008 +0100 @@ -255,11 +255,55 @@ struct fbfront_dev { int offset; xenbus_event_queue events; + +#ifdef HAVE_LIBC + int fd; +#endif }; void fbfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) { +#ifdef HAVE_LIBC + struct fbfront_dev *dev = data; + int fd = dev->fd; + + files[fd].read = 1; +#endif wake_up(&fbfront_queue); +} + +int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n) +{ + struct xenfb_page *page = dev->page; + uint32_t prod, cons; + int i; + +#ifdef HAVE_LIBC + files[dev->fd].read = 0; + mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */ +#endif + + prod = page->in_prod; + + if (prod == page->in_cons) + return 0; + + rmb(); /* ensure we see ring contents up to prod */ + + for (i = 0, cons = page->in_cons; i < n && cons != prod; i++, cons++) + memcpy(buf + i, &XENFB_IN_RING_REF(page, cons), sizeof(*buf)); + + mb(); /* ensure we got ring contents */ + page->in_cons = cons; + notify_remote_via_evtchn(dev->evtchn); + +#ifdef HAVE_LIBC + if (cons != prod) + /* still some events to read */ + files[dev->fd].read = 1; +#endif + + return i; } struct fbfront_dev *init_fbfront(char *nodename, unsigned long *mfns, int width, int height, int depth, int stride, int n) @@ -482,3 +526,14 @@ void shutdown_fbfront(struct fbfront_dev free(dev->backend); free(dev); } + +#ifdef HAVE_LIBC +int fbfront_open(struct fbfront_dev *dev) +{ + dev->fd = alloc_fd(FTYPE_FB); + printk("fb_open(%s) -> %d\n", dev->nodename, dev->fd); + files[dev->fd].fb.dev = dev; + return dev->fd; +} +#endif + diff -r e3be00bd6aa9 -r 3b20e543b52d extras/mini-os/include/fbfront.h --- a/extras/mini-os/include/fbfront.h Mon May 12 10:09:12 2008 +0100 +++ b/extras/mini-os/include/fbfront.h Mon May 12 10:10:03 2008 +0100 @@ -1,4 +1,5 @@ #include +#include #include /* from */ @@ -36,6 +37,8 @@ int fbfront_open(struct fbfront_dev *dev int fbfront_open(struct fbfront_dev *dev); #endif +int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n); +extern struct wait_queue_head fbfront_queue; void fbfront_update(struct fbfront_dev *dev, int x, int y, int width, int height); void fbfront_resize(struct fbfront_dev *dev, int width, int height, int stride, int depth, int offset); diff -r e3be00bd6aa9 -r 3b20e543b52d extras/mini-os/include/lib.h --- a/extras/mini-os/include/lib.h Mon May 12 10:09:12 2008 +0100 +++ b/extras/mini-os/include/lib.h Mon May 12 10:10:03 2008 +0100 @@ -141,6 +141,7 @@ enum fd_type { FTYPE_TAP, FTYPE_BLK, FTYPE_KBD, + FTYPE_FB, }; #define MAX_EVTCHN_PORTS 16 @@ -175,6 +176,9 @@ extern struct file { struct { struct kbdfront_dev *dev; } kbd; + struct { + struct fbfront_dev *dev; + } fb; struct { /* To each xenbus FD is associated a queue of watch events for this * FD. */ diff -r e3be00bd6aa9 -r 3b20e543b52d extras/mini-os/kernel.c --- a/extras/mini-os/kernel.c Mon May 12 10:09:12 2008 +0100 +++ b/extras/mini-os/kernel.c Mon May 12 10:10:03 2008 +0100 @@ -260,6 +260,7 @@ static void blkfront_thread(void *p) #define DEPTH 32 static uint32_t *fb; +static int refresh_period = 50; static struct fbfront_dev *fb_dev; static struct semaphore fbfront_sem = __SEMAPHORE_INITIALIZER(fbfront_sem, 0); @@ -333,6 +334,10 @@ static void refresh_cursor(int new_x, in static void refresh_cursor(int new_x, int new_y) { static int old_x = -1, old_y = -1; + + if (!refresh_period) + return; + if (old_x != -1 && old_y != -1) { fbfront_drawvert(old_x, old_y + 1, old_y + 8, 0xffffffff); fbfront_drawhoriz(old_x + 1, old_x + 8, old_y, 0xffffffff); @@ -358,43 +363,46 @@ static void kbdfront_thread(void *p) down(&fbfront_sem); refresh_cursor(x, y); while (1) { - union xenkbd_in_event event; + union xenkbd_in_event kbdevent; + union xenfb_in_event fbevent; + int sleep = 1; add_waiter(w, kbdfront_queue); - - if (kbdfront_receive(kbd_dev, &event, 1) == 0) - schedule(); - else switch(event.type) { + add_waiter(w, fbfront_queue); + + while (kbdfront_receive(kbd_dev, &kbdevent, 1) != 0) { + sleep = 0; + switch(kbdevent.type) { case XENKBD_TYPE_MOTION: printk("motion x:%d y:%d z:%d\n", - event.motion.rel_x, - event.motion.rel_y, - event.motion.rel_z); - x += event.motion.rel_x; - y += event.motion.rel_y; - z += event.motion.rel_z; + kbdevent.motion.rel_x, + kbdevent.motion.rel_y, + kbdevent.motion.rel_z); + x += kbdevent.motion.rel_x; + y += kbdevent.motion.rel_y; + z += kbdevent.motion.rel_z; clip_cursor(&x, &y); refresh_cursor(x, y); break; case XENKBD_TYPE_POS: printk("pos x:%d y:%d dz:%d\n", - event.pos.abs_x, - event.pos.abs_y, - event.pos.rel_z); - x = event.pos.abs_x; - y = event.pos.abs_y; - z = event.pos.rel_z; + kbdevent.pos.abs_x, + kbdevent.pos.abs_y, + kbdevent.pos.rel_z); + x = kbdevent.pos.abs_x; + y = kbdevent.pos.abs_y; + z = kbdevent.pos.rel_z; clip_cursor(&x, &y); refresh_cursor(x, y); break; case XENKBD_TYPE_KEY: printk("key %d %s\n", - event.key.keycode, - event.key.pressed ? "pressed" : "released"); - if (event.key.keycode == BTN_LEFT) { + kbdevent.key.keycode, + kbdevent.key.pressed ? "pressed" : "released"); + if (kbdevent.key.keycode == BTN_LEFT) { printk("mouse %s at (%d,%d,%d)\n", - event.key.pressed ? "clic" : "release", x, y, z); - if (event.key.pressed) { + kbdevent.key.pressed ? "clic" : "release", x, y, z); + if (kbdevent.key.pressed) { uint32_t color = rand(); fbfront_drawvert(x - 16, y - 16, y + 15, color); fbfront_drawhoriz(x - 16, x + 15, y + 16, color); @@ -402,13 +410,26 @@ static void kbdfront_thread(void *p) fbfront_drawhoriz(x - 15, x + 16, y - 16, color); fbfront_update(fb_dev, x - 16, y - 16, 33, 33); } - } else if (event.key.keycode == KEY_Q) { + } else if (kbdevent.key.keycode == KEY_Q) { struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_poweroff }; HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); do_exit(); } break; + } } + while (fbfront_receive(fb_dev, &fbevent, 1) != 0) { + sleep = 0; + switch(fbevent.type) { + case XENFB_TYPE_REFRESH_PERIOD: + refresh_period = fbevent.refresh_period.period; + printk("refresh period %d\n", refresh_period); + refresh_cursor(x, y); + break; + } + } + if (sleep) + schedule(); } } diff -r e3be00bd6aa9 -r 3b20e543b52d extras/mini-os/lib/sys.c --- a/extras/mini-os/lib/sys.c Mon May 12 10:09:12 2008 +0100 +++ b/extras/mini-os/lib/sys.c Mon May 12 10:10:03 2008 +0100 @@ -249,6 +249,16 @@ int read(int fd, void *buf, size_t nbyte } return ret * sizeof(union xenkbd_in_event); } + case FTYPE_FB: { + int ret, n; + n = nbytes / sizeof(union xenfb_in_event); + ret = fbfront_receive(files[fd].fb.dev, buf, n); + if (ret <= 0) { + errno = EAGAIN; + return -1; + } + return ret * sizeof(union xenfb_in_event); + } case FTYPE_NONE: case FTYPE_XENBUS: case FTYPE_EVTCHN: @@ -290,6 +300,7 @@ int write(int fd, const void *buf, size_ case FTYPE_EVTCHN: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: break; } printk("write(%d): Bad descriptor\n", fd); @@ -348,6 +359,7 @@ int fsync(int fd) { case FTYPE_TAP: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: break; } printk("fsync(%d): Bad descriptor\n", fd); @@ -394,6 +406,10 @@ int close(int fd) shutdown_kbdfront(files[fd].kbd.dev); files[fd].type = FTYPE_NONE; return 0; + case FTYPE_FB: + shutdown_fbfront(files[fd].fb.dev); + files[fd].type = FTYPE_NONE; + return 0; case FTYPE_NONE: break; } @@ -485,6 +501,7 @@ int fstat(int fd, struct stat *buf) case FTYPE_TAP: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: break; } @@ -513,6 +530,7 @@ int ftruncate(int fd, off_t length) case FTYPE_TAP: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: break; } @@ -624,6 +642,7 @@ static const char file_types[] = { [FTYPE_TAP] = 'T', [FTYPE_BLK] = 'B', [FTYPE_KBD] = 'K', + [FTYPE_FB] = 'G', }; #ifdef LIBC_DEBUG static void dump_set(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) @@ -732,6 +751,7 @@ static int select_poll(int nfds, fd_set case FTYPE_TAP: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: if (FD_ISSET(i, readfds)) { if (files[i].read) n++; diff -r e3be00bd6aa9 -r 3b20e543b52d tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Mon May 12 10:09:12 2008 +0100 +++ b/tools/ioemu/hw/xenfb.c Mon May 12 10:10:03 2008 +0100 @@ -59,6 +59,7 @@ struct xenfb { int offset; /* offset of the framebuffer */ int abs_pointer_wanted; /* Whether guest supports absolute pointer */ int button_state; /* Last seen pointer button state */ + int refresh_period; /* The refresh period we have advised */ char protocol[64]; /* frontend protocol */ }; @@ -536,6 +537,41 @@ static void xenfb_on_fb_event(struct xen xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port); } +static int xenfb_queue_full(struct xenfb *xenfb) +{ + struct xenfb_page *page = xenfb->fb.page; + uint32_t cons, prod; + + prod = page->in_prod; + cons = page->in_cons; + return prod - cons == XENFB_IN_RING_LEN; +} + +static void xenfb_send_event(struct xenfb *xenfb, union xenfb_in_event *event) +{ + uint32_t prod; + struct xenfb_page *page = xenfb->fb.page; + + prod = page->in_prod; + /* caller ensures !xenfb_queue_full() */ + xen_mb(); /* ensure ring space available */ + XENFB_IN_RING_REF(page, prod) = *event; + xen_wmb(); /* ensure ring contents visible */ + page->in_prod = prod + 1; + + xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port); +} + +static void xenfb_send_refresh_period(struct xenfb *xenfb, int period) +{ + union xenfb_in_event event; + + memset(&event, 0, sizeof(event)); + event.type = XENFB_TYPE_REFRESH_PERIOD; + event.refresh_period.period = period; + xenfb_send_event(xenfb, &event); +} + static void xenfb_on_kbd_event(struct xenfb *xenfb) { struct xenkbd_page *page = xenfb->kbd.page; @@ -707,6 +743,7 @@ static int xenfb_read_frontend_fb_config xenfb->protocol) < 0) xenfb->protocol[0] = '\0'; xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "request-update", "1"); + xenfb->refresh_period = -1; /* TODO check for permitted ranges */ fb_page = xenfb->fb.page; @@ -1185,10 +1222,28 @@ static void xenfb_guest_copy(struct xenf dpy_update(xenfb->ds, x, y, w, h); } -/* Periodic update of display, no need for any in our case */ +/* Periodic update of display, transmit the refresh interval to the frontend */ static void xenfb_update(void *opaque) { struct xenfb *xenfb = opaque; + int period; + + if (xenfb_queue_full(xenfb)) + return; + + if (xenfb->ds->idle) + period = XENFB_NO_REFRESH; + else { + period = xenfb->ds->gui_timer_interval; + if (!period) + period = GUI_REFRESH_INTERVAL; + } + + /* Will have to be disabled for frontends without feature-update */ + if (xenfb->refresh_period != period) { + xenfb_send_refresh_period(xenfb, period); + xenfb->refresh_period = period; + } } /* QEMU display state changed, so refresh the framebuffer copy */ @@ -1232,11 +1287,17 @@ static int xenfb_register_console(struct } #ifdef CONFIG_STUBDOM -static struct semaphore kbd_sem = __SEMAPHORE_INITIALIZER(kbd_sem, 0); -static struct kbdfront_dev *kbd_dev; +typedef struct XenFBState { + struct semaphore kbd_sem; + struct kbdfront_dev *kbd_dev; + struct fbfront_dev *fb_dev; + void *vga_vram, *nonshared_vram; + DisplayState *ds; +} XenFBState; + +XenFBState *xs; + static char *kbd_path, *fb_path; -static void *vga_vram, *nonshared_vram; -static DisplayState *xenfb_ds; static unsigned char linux2scancode[KEY_MAX + 1]; @@ -1254,7 +1315,8 @@ int xenfb_connect_vfb(const char *path) static void xenfb_pv_update(DisplayState *ds, int x, int y, int w, int h) { - struct fbfront_dev *fb_dev = ds->opaque; + XenFBState *xs = ds->opaque; + struct fbfront_dev *fb_dev = xs->fb_dev; if (!fb_dev) return; fbfront_update(fb_dev, x, y, w, h); @@ -1262,7 +1324,8 @@ static void xenfb_pv_update(DisplayState static void xenfb_pv_resize(DisplayState *ds, int w, int h, int linesize) { - struct fbfront_dev *fb_dev = ds->opaque; + XenFBState *xs = ds->opaque; + struct fbfront_dev *fb_dev = xs->fb_dev; fprintf(stderr,"resize to %dx%d, %d required\n", w, h, linesize); ds->width = w; ds->height = h; @@ -1276,14 +1339,15 @@ static void xenfb_pv_resize(DisplayState if (ds->shared_buf) { ds->data = NULL; } else { - ds->data = nonshared_vram; + ds->data = xs->nonshared_vram; fbfront_resize(fb_dev, w, h, linesize, ds->depth, VGA_RAM_SIZE); } } static void xenfb_pv_colourdepth(DisplayState *ds, int depth) { - struct fbfront_dev *fb_dev = ds->opaque; + XenFBState *xs = ds->opaque; + struct fbfront_dev *fb_dev = xs->fb_dev; static int lastdepth = -1; if (!depth) { ds->shared_buf = 0; @@ -1301,15 +1365,16 @@ static void xenfb_pv_colourdepth(Display if (ds->shared_buf) { ds->data = NULL; } else { - ds->data = nonshared_vram; + ds->data = xs->nonshared_vram; fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, VGA_RAM_SIZE); } } static void xenfb_pv_setdata(DisplayState *ds, void *pixels) { - struct fbfront_dev *fb_dev = ds->opaque; - int offset = pixels - vga_vram; + XenFBState *xs = ds->opaque; + struct fbfront_dev *fb_dev = xs->fb_dev; + int offset = pixels - xs->vga_vram; ds->data = pixels; if (!fb_dev) return; @@ -1321,16 +1386,45 @@ static void xenfb_pv_refresh(DisplayStat vga_hw_update(); } +static void xenfb_fb_handler(void *opaque) +{ +#define FB_NUM_BATCH 4 + union xenfb_in_event buf[FB_NUM_BATCH]; + int n, i; + XenFBState *xs = opaque; + DisplayState *ds = xs->ds; + + n = fbfront_receive(xs->fb_dev, buf, FB_NUM_BATCH); + for (i = 0; i < n; i++) { + switch (buf[i].type) { + case XENFB_TYPE_REFRESH_PERIOD: + if (buf[i].refresh_period.period == XENFB_NO_REFRESH) { + /* Sleeping interval */ + ds->idle = 1; + ds->gui_timer_interval = 500; + } else { + /* Set interval */ + ds->idle = 0; + ds->gui_timer_interval = buf[i].refresh_period.period; + } + default: + /* ignore unknown events */ + break; + } + } +} + static void xenfb_kbd_handler(void *opaque) { #define KBD_NUM_BATCH 64 union xenkbd_in_event buf[KBD_NUM_BATCH]; int n, i; - DisplayState *s = opaque; + XenFBState *xs = opaque; + DisplayState *s = xs->ds; static int buttons; static int x, y; - n = kbdfront_receive(kbd_dev, buf, KBD_NUM_BATCH); + n = kbdfront_receive(xs->kbd_dev, buf, KBD_NUM_BATCH); for (i = 0; i < n; i++) { switch (buf[i].type) { @@ -1412,12 +1506,13 @@ static void kbdfront_thread(void *p) static void kbdfront_thread(void *p) { int scancode, keycode; - kbd_dev = init_kbdfront(p, 1); - if (!kbd_dev) { + XenFBState *xs = p; + xs->kbd_dev = init_kbdfront(kbd_path, 1); + if (!xs->kbd_dev) { fprintf(stderr,"can't open keyboard\n"); exit(1); } - up(&kbd_sem); + up(&xs->kbd_sem); for (scancode = 0; scancode < 128; scancode++) { keycode = atkbd_set2_keycode[atkbd_unxlate_table[scancode]]; linux2scancode[keycode] = scancode; @@ -1431,12 +1526,18 @@ int xenfb_pv_display_init(DisplayState * if (!fb_path || !kbd_path) return -1; - create_thread("kbdfront", kbdfront_thread, (void*) kbd_path); - - xenfb_ds = ds; - - ds->data = nonshared_vram = qemu_memalign(PAGE_SIZE, VGA_RAM_SIZE); + xs = qemu_mallocz(sizeof(XenFBState)); + if (!xs) + return -1; + + init_SEMAPHORE(&xs->kbd_sem, 0); + xs->ds = ds; + + create_thread("kbdfront", kbdfront_thread, (void*) xs); + + ds->data = xs->nonshared_vram = qemu_memalign(PAGE_SIZE, VGA_RAM_SIZE); memset(ds->data, 0, VGA_RAM_SIZE); + ds->opaque = xs; ds->depth = 32; ds->bgr = 0; ds->width = 640; @@ -1452,9 +1553,9 @@ int xenfb_pv_display_init(DisplayState * int xenfb_pv_display_start(void *data) { - DisplayState *ds = xenfb_ds; + DisplayState *ds; struct fbfront_dev *fb_dev; - int kbd_fd; + int kbd_fd, fb_fd; int offset = 0; unsigned long *mfns; int n = VGA_RAM_SIZE / PAGE_SIZE; @@ -1463,12 +1564,13 @@ int xenfb_pv_display_start(void *data) if (!fb_path || !kbd_path) return 0; - vga_vram = data; + ds = xs->ds; + xs->vga_vram = data; mfns = malloc(2 * n * sizeof(*mfns)); for (i = 0; i < n; i++) - mfns[i] = virtual_to_mfn(vga_vram + i * PAGE_SIZE); + mfns[i] = virtual_to_mfn(xs->vga_vram + i * PAGE_SIZE); for (i = 0; i < n; i++) - mfns[n + i] = virtual_to_mfn(nonshared_vram + i * PAGE_SIZE); + mfns[n + i] = virtual_to_mfn(xs->nonshared_vram + i * PAGE_SIZE); fb_dev = init_fbfront(fb_path, mfns, ds->width, ds->height, ds->depth, ds->linesize, 2 * n); free(mfns); @@ -1479,21 +1581,24 @@ int xenfb_pv_display_start(void *data) free(fb_path); if (ds->shared_buf) { - offset = (void*) ds->data - vga_vram; + offset = (void*) ds->data - xs->vga_vram; } else { offset = VGA_RAM_SIZE; - ds->data = nonshared_vram; + ds->data = xs->nonshared_vram; } if (offset) fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, offset); - down(&kbd_sem); + down(&xs->kbd_sem); free(kbd_path); - kbd_fd = kbdfront_open(kbd_dev); - qemu_set_fd_handler(kbd_fd, xenfb_kbd_handler, NULL, ds); - - xenfb_ds->opaque = fb_dev; + kbd_fd = kbdfront_open(xs->kbd_dev); + qemu_set_fd_handler(kbd_fd, xenfb_kbd_handler, NULL, xs); + + fb_fd = fbfront_open(fb_dev); + qemu_set_fd_handler(fb_fd, xenfb_fb_handler, NULL, xs); + + xs->fb_dev = fb_dev; return 0; } #endif diff -r e3be00bd6aa9 -r 3b20e543b52d tools/ioemu/sdl.c --- a/tools/ioemu/sdl.c Mon May 12 10:09:12 2008 +0100 +++ b/tools/ioemu/sdl.c Mon May 12 10:10:03 2008 +0100 @@ -696,9 +696,11 @@ static void sdl_refresh(DisplayState *ds if (ev->active.gain) { /* Back to default interval */ ds->gui_timer_interval = 0; + ds->idle = 0; } else { /* Sleeping interval */ ds->gui_timer_interval = 500; + ds->idle = 1; } } break; diff -r e3be00bd6aa9 -r 3b20e543b52d tools/ioemu/vl.c --- a/tools/ioemu/vl.c Mon May 12 10:09:12 2008 +0100 +++ b/tools/ioemu/vl.c Mon May 12 10:10:03 2008 +0100 @@ -130,8 +130,6 @@ #else #define DEFAULT_RAM_SIZE 128 #endif -/* in ms */ -#define GUI_REFRESH_INTERVAL 30 /* Max number of USB devices that can be specified on the commandline. */ #define MAX_USB_CMDLINE 8 @@ -4467,6 +4465,8 @@ void dumb_display_init(DisplayState *ds) ds->dpy_resize = dumb_resize; ds->dpy_colourdepth = NULL; ds->dpy_refresh = dumb_refresh; + ds->gui_timer_interval = 500; + ds->idle = 1; } /***********************************************************/ diff -r e3be00bd6aa9 -r 3b20e543b52d tools/ioemu/vl.h --- a/tools/ioemu/vl.h Mon May 12 10:09:12 2008 +0100 +++ b/tools/ioemu/vl.h Mon May 12 10:10:03 2008 +0100 @@ -929,6 +929,9 @@ extern struct soundhw soundhw[]; #define VGA_RAM_SIZE (8192 * 1024) +/* in ms */ +#define GUI_REFRESH_INTERVAL 30 + struct DisplayState { uint8_t *data; int linesize; @@ -939,6 +942,7 @@ struct DisplayState { void *opaque; uint32_t *palette; uint64_t gui_timer_interval; + int idle; int shared_buf; diff -r e3be00bd6aa9 -r 3b20e543b52d tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Mon May 12 10:09:12 2008 +0100 +++ b/tools/ioemu/vnc.c Mon May 12 10:10:03 2008 +0100 @@ -778,6 +778,7 @@ static void _vnc_update_client(void *opa vs->has_update = 0; vnc_flush(vs); vs->last_update_time = now; + vs->ds->idle = 0; vs->timer_interval /= 2; if (vs->timer_interval < VNC_REFRESH_INTERVAL_BASE) @@ -790,26 +791,29 @@ static void _vnc_update_client(void *opa vs->timer_interval += VNC_REFRESH_INTERVAL_INC; if (vs->timer_interval > VNC_REFRESH_INTERVAL_MAX) { vs->timer_interval = VNC_REFRESH_INTERVAL_MAX; - if (now - vs->last_update_time >= VNC_MAX_UPDATE_INTERVAL && - vs->update_requested) { - /* Send a null update. If the client is no longer - interested (e.g. minimised) it'll ignore this, and we - can stop scanning the buffer until it sends another - update request. */ - /* It turns out that there's a bug in realvncviewer 4.1.2 - which means that if you send a proper null update (with - no update rectangles), it gets a bit out of sync and - never sends any further requests, regardless of whether - it needs one or not. Fix this by sending a single 1x1 - update rectangle instead. */ - vnc_write_u8(vs, 0); - vnc_write_u8(vs, 0); - vnc_write_u16(vs, 1); - send_framebuffer_update(vs, 0, 0, 1, 1); - vnc_flush(vs); - vs->last_update_time = now; - vs->update_requested--; - return; + if (now - vs->last_update_time >= VNC_MAX_UPDATE_INTERVAL) { + if (!vs->update_requested) { + vs->ds->idle = 1; + } else { + /* Send a null update. If the client is no longer + interested (e.g. minimised) it'll ignore this, and we + can stop scanning the buffer until it sends another + update request. */ + /* It turns out that there's a bug in realvncviewer 4.1.2 + which means that if you send a proper null update (with + no update rectangles), it gets a bit out of sync and + never sends any further requests, regardless of whether + it needs one or not. Fix this by sending a single 1x1 + update rectangle instead. */ + vnc_write_u8(vs, 0); + vnc_write_u8(vs, 0); + vnc_write_u16(vs, 1); + send_framebuffer_update(vs, 0, 0, 1, 1); + vnc_flush(vs); + vs->last_update_time = now; + vs->update_requested--; + return; + } } } qemu_mod_timer(vs->timer, now + vs->timer_interval); @@ -970,6 +974,7 @@ static int vnc_client_io_error(VncState qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL); closesocket(vs->csock); vs->csock = -1; + vs->ds->idle = 1; buffer_reset(&vs->input); buffer_reset(&vs->output); free_queue(vs); @@ -2443,6 +2448,7 @@ static void vnc_listen_read(void *opaque vs->csock = accept(vs->lsock, (struct sockaddr *)&addr, &addrlen); if (vs->csock != -1) { VNC_DEBUG("New client on socket %d\n", vs->csock); + vs->ds->idle = 0; socket_set_nonblock(vs->csock); qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, opaque); vnc_write(vs, "RFB 003.008\n", 12); @@ -2468,6 +2474,7 @@ void vnc_display_init(DisplayState *ds) exit(1); ds->opaque = vs; + ds->idle = 1; vnc_state = vs; vs->display = NULL; vs->password = NULL; diff -r e3be00bd6aa9 -r 3b20e543b52d xen/include/public/io/fbif.h --- a/xen/include/public/io/fbif.h Mon May 12 10:09:12 2008 +0100 +++ b/xen/include/public/io/fbif.h Mon May 12 10:10:03 2008 +0100 @@ -80,14 +80,33 @@ union xenfb_out_event /* * Frontends should ignore unknown in events. - * No in events currently defined. */ + +/* + * Framebuffer refresh period advice + * Backend sends it to advise the frontend their preferred period of + * refresh. Frontends that keep the framebuffer constantly up-to-date + * just ignore it. Frontends that use the advice should immediately + * refresh the framebuffer (and send an update notification event if + * those have been requested), then use the update frequency to guide + * their periodical refreshs. + */ +#define XENFB_TYPE_REFRESH_PERIOD 1 +#define XENFB_NO_REFRESH 0 + +struct xenfb_refresh_period +{ + uint8_t type; /* XENFB_TYPE_UPDATE_PERIOD */ + uint32_t period; /* period of refresh, in ms, + * XENFB_NO_REFRESH if no refresh is needed */ +}; #define XENFB_IN_EVENT_SIZE 40 union xenfb_in_event { uint8_t type; + struct xenfb_refresh_period refresh_period; char pad[XENFB_IN_EVENT_SIZE]; }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:32 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:32 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4i-0004NF-20 for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:32 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5J-0007aI-7O; Mon, 12 May 2008 16:41:09 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb52-0007MR-5g for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb4v-0003pA-2g for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:50 +0000 X-SBRS: 3.6 X-MesageID: 197144 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197144" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdud6010092 for ; Mon, 12 May 2008 09:39:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeEVj028385 for ; Mon, 12 May 2008 09:40:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeEEb028384 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:14 -0700 Message-Id: <200805121640.m4CGeEEb028384@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: clear FB content since _xmalloc may return non-zeroed memory X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583445 -3600 # Node ID 4c3140455620fd268c8cb0e7ad6ddcf0be2198af # Parent 3b20e543b52d40f76525a7e918fa347af2de00fe minios: clear FB content since _xmalloc may return non-zeroed memory (in debug mode, notably). Signed-off-by: Samuel Thibault --- extras/mini-os/kernel.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff -r 3b20e543b52d -r 4c3140455620 extras/mini-os/kernel.c --- a/extras/mini-os/kernel.c Mon May 12 10:10:03 2008 +0100 +++ b/extras/mini-os/kernel.c Mon May 12 10:10:45 2008 +0100 @@ -303,13 +303,10 @@ static void fbfront_thread(void *p) memsize = n * PAGE_SIZE; fb = _xmalloc(memsize, PAGE_SIZE); + memset(fb, 0, memsize); mfns = xmalloc_array(unsigned long, n); - for (i = 0; i < n; i++) { - /* trigger CoW */ - ((char *) fb) [i * PAGE_SIZE] = 0; - barrier(); + for (i = 0; i < n; i++) mfns[i] = virtual_to_mfn((char *) fb + i * PAGE_SIZE); - } fb_dev = init_fbfront(NULL, mfns, WIDTH, HEIGHT, DEPTH, line_length, n); xfree(mfns); if (!fb_dev) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:37 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:37 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4n-0004NL-01 for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:37 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5O-0007dq-1E; Mon, 12 May 2008 16:41:14 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb52-0007Mn-MV for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb4w-0003p7-01 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:50 +0000 X-SBRS: 3.6 X-MesageID: 197145 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197145" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdvfD010095 for ; Mon, 12 May 2008 09:39:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeFBN028402 for ; Mon, 12 May 2008 09:40:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeFMj028401 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:15 -0700 Message-Id: <200805121640.m4CGeFMj028401@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] stubdom: let lwIP check TCP sums as they are now correct. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583483 -3600 # Node ID aadde665245774a6161514dd0e190f7cb5507bb4 # Parent 4c3140455620fd268c8cb0e7ad6ddcf0be2198af stubdom: let lwIP check TCP sums as they are now correct. Signed-off-by: Samuel Thibault --- extras/mini-os/include/arch/cc.h | 3 --- 1 files changed, 3 deletions(-) diff -r 4c3140455620 -r aadde6652457 extras/mini-os/include/arch/cc.h --- a/extras/mini-os/include/arch/cc.h Mon May 12 10:10:45 2008 +0100 +++ b/extras/mini-os/include/arch/cc.h Mon May 12 10:11:23 2008 +0100 @@ -84,7 +84,4 @@ extern void lwip_die(char *fmt, ...); #define DBG_TYPES_ON DBG_ON #endif -/* TODO: checksum doesn't work fine?! */ -#define CHECKSUM_CHECK_TCP 0 - #endif /* __LWIP_ARCH_CC_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:42 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:42 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4r-0004NO-VK for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:42 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5T-0007hc-3u; Mon, 12 May 2008 16:41:19 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb56-0007Pa-8h for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb4z-0003p8-8y for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:54 +0000 X-SBRS: 3.6 X-MesageID: 197146 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197146" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdwXD010098 for ; Mon, 12 May 2008 09:39:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeGWe028419 for ; Mon, 12 May 2008 09:40:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeGGh028418 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:16 -0700 Message-Id: <200805121640.m4CGeGGh028418@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix xmexamples to reflect new meaning of cpus= config option. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583595 -3600 # Node ID 2383e35a1cb8f96752a1530d5305af0392b6c7c2 # Parent aadde665245774a6161514dd0e190f7cb5507bb4 Fix xmexamples to reflect new meaning of cpus= config option. Signed-off-by: Masaki Kanno --- tools/examples/xmexample.hvm | 3 ++- tools/examples/xmexample.vti | 3 ++- tools/examples/xmexample1 | 3 ++- tools/examples/xmexample2 | 3 ++- tools/examples/xmexample3 | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff -r aadde6652457 -r 2383e35a1cb8 tools/examples/xmexample.hvm --- a/tools/examples/xmexample.hvm Mon May 12 10:11:23 2008 +0100 +++ b/tools/examples/xmexample.hvm Mon May 12 10:13:15 2008 +0100 @@ -56,7 +56,8 @@ name = "ExampleHVMDomain" # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 # Optionally define mac and/or bridge for the network interfaces. # Random MACs are assigned if not given. diff -r aadde6652457 -r 2383e35a1cb8 tools/examples/xmexample.vti --- a/tools/examples/xmexample.vti Mon May 12 10:11:23 2008 +0100 +++ b/tools/examples/xmexample.vti Mon May 12 10:13:15 2008 +0100 @@ -33,7 +33,8 @@ name = "ExampleVTIDomain" # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 # Log2 of VHPT size, default=23 (8MB), minimum=15 (32KB). # In Windows OS, smaller size shows better performance. diff -r aadde6652457 -r 2383e35a1cb8 tools/examples/xmexample1 --- a/tools/examples/xmexample1 Mon May 12 10:11:23 2008 +0100 +++ b/tools/examples/xmexample1 Mon May 12 10:13:15 2008 +0100 @@ -33,7 +33,8 @@ name = "ExampleDomain" # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 # Number of Virtual CPUS to use, default is 1 #vcpus = 1 diff -r aadde6652457 -r 2383e35a1cb8 tools/examples/xmexample2 --- a/tools/examples/xmexample2 Mon May 12 10:11:23 2008 +0100 +++ b/tools/examples/xmexample2 Mon May 12 10:13:15 2008 +0100 @@ -62,7 +62,8 @@ name = "VM%d" % vmid # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 #cpus = "%s" % vmid # set based on vmid (mod number of CPUs) # Number of Virtual CPUS to use, default is 1 diff -r aadde6652457 -r 2383e35a1cb8 tools/examples/xmexample3 --- a/tools/examples/xmexample3 Mon May 12 10:11:23 2008 +0100 +++ b/tools/examples/xmexample3 Mon May 12 10:13:15 2008 +0100 @@ -62,7 +62,8 @@ name = "VM%d" % vmid # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 cpus = "%s" % vmid # set based on vmid (mod number of CPUs) #---------------------------------------------------------------------------- _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:47 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:47 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb4w-0004NS-Lp for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:46 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5X-0007l9-Qr; Mon, 12 May 2008 16:41:23 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb57-0007QY-8d for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:57 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb50-0003pA-J2 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:55 +0000 X-SBRS: 3.6 X-MesageID: 197147 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197147" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:39:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGdx5n010101 for ; Mon, 12 May 2008 09:39:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeHCd028436 for ; Mon, 12 May 2008 09:40:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeHVH028435 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:17 -0700 Message-Id: <200805121640.m4CGeHVH028435@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ia64 pv-on-hvm: __XEN_INTERFACE_VERSION__ is needed to assemble X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583641 -3600 # Node ID 9be45076186d191c3c0e622bab42d6c87ffe0cac # Parent 2383e35a1cb8f96752a1530d5305af0392b6c7c2 ia64 pv-on-hvm: __XEN_INTERFACE_VERSION__ is needed to assemble platform-pci/xcom_asm.S, otherwise incompatible kernel module is built. Signed-off-by: Kouya Shimura --- unmodified_drivers/linux-2.6/overrides.mk | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff -r 2383e35a1cb8 -r 9be45076186d unmodified_drivers/linux-2.6/overrides.mk --- a/unmodified_drivers/linux-2.6/overrides.mk Mon May 12 10:13:15 2008 +0100 +++ b/unmodified_drivers/linux-2.6/overrides.mk Mon May 12 10:14:01 2008 +0100 @@ -4,12 +4,14 @@ # # (i.e. we need the native config for things like -mregparm, but # a Xen kernel to find the right headers) -EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030205 -EXTRA_CFLAGS += -DCONFIG_XEN_COMPAT=0xffffff -EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H +_XEN_CPPFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030205 +_XEN_CPPFLAGS += -DCONFIG_XEN_COMPAT=0xffffff +_XEN_CPPFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H ifeq ($(ARCH),ia64) - EXTRA_CFLAGS += -DCONFIG_VMX_GUEST + _XEN_CPPFLAGS += -DCONFIG_VMX_GUEST endif -EXTRA_CFLAGS += -include $(objtree)/include/linux/autoconf.h -EXTRA_AFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H +_XEN_CPPFLAGS += -include $(objtree)/include/linux/autoconf.h + +EXTRA_CFLAGS += $(_XEN_CPPFLAGS) +EXTRA_AFLAGS += $(_XEN_CPPFLAGS) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:51 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:51 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb50-0004NW-Td for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:51 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5c-0007oN-0b; Mon, 12 May 2008 16:41:28 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb58-0007RP-He for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb51-0003p7-47 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:40:56 +0000 X-SBRS: 3.6 X-MesageID: 197148 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197148" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:40:00 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe0p4010104 for ; Mon, 12 May 2008 09:40:00 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeIxI028453 for ; Mon, 12 May 2008 09:40:18 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeIvv028452 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:18 -0700 Message-Id: <200805121640.m4CGeIvv028452@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:17 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: fix a few 32-on-64 compat mode issues X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583707 -3600 # Node ID 945394931d9e5cb6094f5117acc0a9f55e1019d9 # Parent 9be45076186d191c3c0e622bab42d6c87ffe0cac x86: fix a few 32-on-64 compat mode issues - handle VCPUOP_register_vcpu_info and VCPUOP_get_physid (and add respective layout checks) - add missing structure size check for struct vcpu_info - add missing layout check for vcpu_set_periodic_timer - handle VCPUOP_set_singleshot_timer via argument translation as the structure sizes differ (due to padding in 64-bits) Signed-off-by: Jan Beulich --- xen/arch/x86/x86_64/domain.c | 19 ++++++++++++++++--- xen/common/compat/domain.c | 20 ++++++++++++++++++-- xen/include/xlat.lst | 5 +++++ xen/tools/get-fields.sh | 1 - 4 files changed, 39 insertions(+), 6 deletions(-) diff -r 9be45076186d -r 945394931d9e xen/arch/x86/x86_64/domain.c --- a/xen/arch/x86/x86_64/domain.c Mon May 12 10:14:01 2008 +0100 +++ b/xen/arch/x86/x86_64/domain.c Mon May 12 10:15:07 2008 +0100 @@ -9,11 +9,23 @@ #include #include +#define xen_vcpu_info vcpu_info +CHECK_SIZE_(struct, vcpu_info); +#undef xen_vcpu_info + +#define xen_vcpu_register_vcpu_info vcpu_register_vcpu_info +CHECK_vcpu_register_vcpu_info; +#undef xen_vcpu_register_vcpu_info + +#define xen_vcpu_get_physid vcpu_get_physid +CHECK_vcpu_get_physid; +#undef xen_vcpu_get_physid + int arch_compat_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg) { - long rc = 0; + int rc = -ENOSYS; switch ( cmd ) { @@ -51,8 +63,9 @@ arch_compat_vcpu_op( break; } - default: - rc = -ENOSYS; + case VCPUOP_register_vcpu_info: + case VCPUOP_get_physid: + rc = arch_do_vcpu_op(cmd, v, arg); break; } diff -r 9be45076186d -r 945394931d9e xen/common/compat/domain.c --- a/xen/common/compat/domain.c Mon May 12 10:14:01 2008 +0100 +++ b/xen/common/compat/domain.c Mon May 12 10:15:07 2008 +0100 @@ -11,11 +11,15 @@ #include #include +#define xen_vcpu_set_periodic_timer vcpu_set_periodic_timer +CHECK_vcpu_set_periodic_timer; +#undef xen_vcpu_set_periodic_timer + int compat_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg) { struct domain *d = current->domain; struct vcpu *v; - long rc = 0; + int rc = 0; if ( (vcpuid < 0) || (vcpuid >= MAX_VIRT_CPUS) ) return -EINVAL; @@ -57,7 +61,6 @@ int compat_vcpu_op(int cmd, int vcpuid, case VCPUOP_is_up: case VCPUOP_set_periodic_timer: case VCPUOP_stop_periodic_timer: - case VCPUOP_set_singleshot_timer: case VCPUOP_stop_singleshot_timer: case VCPUOP_send_nmi: rc = do_vcpu_op(cmd, vcpuid, arg); @@ -74,6 +77,19 @@ int compat_vcpu_op(int cmd, int vcpuid, xlat_vcpu_runstate_info(&runstate.nat); if ( copy_to_guest(arg, &runstate.cmp, 1) ) rc = -EFAULT; + break; + } + + case VCPUOP_set_singleshot_timer: + { + struct compat_vcpu_set_singleshot_timer cmp; + struct vcpu_set_singleshot_timer *nat; + + if ( copy_from_guest(&cmp, arg, 1) ) + return -EFAULT; + nat = (void *)COMPAT_ARG_XLAT_VIRT_START(current->vcpu_id); + XLAT_vcpu_set_singleshot_timer(nat, &cmp); + rc = do_vcpu_op(cmd, vcpuid, guest_handle_from_ptr(nat, void)); break; } diff -r 9be45076186d -r 945394931d9e xen/include/xlat.lst --- a/xen/include/xlat.lst Mon May 12 10:14:01 2008 +0100 +++ b/xen/include/xlat.lst Mon May 12 10:15:07 2008 +0100 @@ -5,6 +5,7 @@ ? mmu_update xen.h ! mmuext_op xen.h ! start_info xen.h +? vcpu_info xen.h ? vcpu_time_info xen.h ! cpu_user_regs arch-x86/xen-@arch@.h ! trap_info arch-x86/xen.h @@ -41,7 +42,11 @@ ? sched_remote_shutdown sched.h ? sched_shutdown sched.h ? t_buf trace.h +? vcpu_get_physid vcpu.h +? vcpu_register_vcpu_info vcpu.h ! vcpu_runstate_info vcpu.h +? vcpu_set_periodic_timer vcpu.h +! vcpu_set_singleshot_timer vcpu.h ? xenoprof_init xenoprof.h ? xenoprof_passive xenoprof.h ! power_register platform.h diff -r 9be45076186d -r 945394931d9e xen/tools/get-fields.sh --- a/xen/tools/get-fields.sh Mon May 12 10:14:01 2008 +0100 +++ b/xen/tools/get-fields.sh Mon May 12 10:15:07 2008 +0100 @@ -310,7 +310,6 @@ build_body () done echo " \\" echo "} while (0)" - echo "" } check_field () _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:40:55 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:40:55 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb55-0004Nb-KO for www-data@colo.xensource.com; Mon, 12 May 2008 09:40:55 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5g-0007s1-RM; Mon, 12 May 2008 16:41:32 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5C-0007Tw-5A for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:02 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb54-0003p8-Mx for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:00 +0000 X-SBRS: 3.6 X-MesageID: 197150 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197150" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:40:01 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe15g010107 for ; Mon, 12 May 2008 09:40:01 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeJBS028470 for ; Mon, 12 May 2008 09:40:19 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeJNN028469 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:19 -0700 Message-Id: <200805121640.m4CGeJNN028469@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:18 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: only print pages' mfn-s in dump_pageframe_info() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583778 -3600 # Node ID a6e2679b1aad89d654d0af7f973f338d3f2cd9db # Parent 945394931d9e5cb6094f5117acc0a9f55e1019d9 x86: only print pages' mfn-s in dump_pageframe_info() Printing page_to_maddr() and page_to_mfn() of the same page is redundant, and _p(page_to_maddr(page)) is even incorrect on x86/PAE. Signed-off-by: Jan Beulich --- xen/arch/x86/domain.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff -r 945394931d9e -r a6e2679b1aad xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Mon May 12 10:15:07 2008 +0100 +++ b/xen/arch/x86/domain.c Mon May 12 10:16:18 2008 +0100 @@ -138,16 +138,16 @@ void dump_pageframe_info(struct domain * { list_for_each_entry ( page, &d->page_list, list ) { - printk(" DomPage %p: mfn=%p, caf=%08x, taf=%" PRtype_info "\n", - _p(page_to_maddr(page)), _p(page_to_mfn(page)), + printk(" DomPage %p: caf=%08x, taf=%" PRtype_info "\n", + _p(page_to_mfn(page)), page->count_info, page->u.inuse.type_info); } } list_for_each_entry ( page, &d->xenpage_list, list ) { - printk(" XenPage %p: mfn=%p, caf=%08x, taf=%" PRtype_info "\n", - _p(page_to_maddr(page)), _p(page_to_mfn(page)), + printk(" XenPage %p: caf=%08x, taf=%" PRtype_info "\n", + _p(page_to_mfn(page)), page->count_info, page->u.inuse.type_info); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:41:00 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:41:00 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb59-0004Ng-NG for www-data@colo.xensource.com; Mon, 12 May 2008 09:41:00 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5k-0007vH-RY; Mon, 12 May 2008 16:41:36 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5E-0007Vl-B2 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:04 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb56-0003p7-Un for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:02 +0000 X-SBRS: 3.6 X-MesageID: 197153 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197153" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:40:03 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe344010113 for ; Mon, 12 May 2008 09:40:03 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeLUi028504 for ; Mon, 12 May 2008 09:40:21 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeL5q028503 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:21 -0700 Message-Id: <200805121640.m4CGeL5q028503@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:20 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: free blkfront resources on error/shutdown X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210586481 -3600 # Node ID c6533d246a8145e342de71cc7b6dc80b8995c68e # Parent 9f8b8315339ee6b512ae2f98b61bdf51be368783 minios: free blkfront resources on error/shutdown Signed-off-by: Samuel Thibault --- extras/mini-os/blkfront.c | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) diff -r 9f8b8315339e -r c6533d246a81 extras/mini-os/blkfront.c --- a/extras/mini-os/blkfront.c Mon May 12 10:36:27 2008 +0100 +++ b/extras/mini-os/blkfront.c Mon May 12 11:01:21 2008 +0100 @@ -68,6 +68,21 @@ void blkfront_handler(evtchn_port_t port wake_up(&blkfront_queue); } +static void free_blkfront(struct blkfront_dev *dev) +{ + mask_evtchn(dev->evtchn); + + free(dev->backend); + + gnttab_end_access(dev->ring_ref); + free_page(dev->ring.sring); + + unbind_evtchn(dev->evtchn); + + free(dev->nodename); + free(dev); +} + struct blkfront_dev *init_blkfront(char *nodename, struct blkfront_info *info) { xenbus_transaction_t xbt; @@ -88,6 +103,7 @@ struct blkfront_dev *init_blkfront(char printk("******************* BLKFRONT for %s **********\n\n\n", nodename); dev = malloc(sizeof(*dev)); + memset(dev, 0, sizeof(*dev)); dev->nodename = strdup(nodename); snprintf(path, sizeof(path), "%s/backend-id", nodename); @@ -139,7 +155,7 @@ again: abort_transaction: xenbus_transaction_end(xbt, 1, &retry); - return NULL; + goto error; done: @@ -147,7 +163,7 @@ done: msg = xenbus_read(XBT_NIL, path, &dev->backend); if (msg) { printk("Error %s when reading the backend path %s\n", msg, path); - return NULL; + goto error; } printk("backend at %s\n", dev->backend); @@ -160,7 +176,7 @@ done: msg = xenbus_read(XBT_NIL, path, &c); if (msg) { printk("Error %s when reading the mode\n", msg); - return NULL; + goto error; } if (*c == 'w') dev->info.mode = O_RDWR; @@ -198,6 +214,10 @@ done: printk("**************************\n"); return dev; + +error: + free_blkfront(dev); + return NULL; } void shutdown_blkfront(struct blkfront_dev *dev) @@ -220,11 +240,7 @@ void shutdown_blkfront(struct blkfront_d xenbus_unwatch_path(XBT_NIL, path); - unbind_evtchn(dev->evtchn); - - free(nodename); - free(dev->backend); - free(dev); + free_blkfront(dev); } static void blkfront_wait_slot(struct blkfront_dev *dev) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:41:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:41:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb5F-0004OJ-Rs for www-data@colo.xensource.com; Mon, 12 May 2008 09:41:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5r-0007zW-0k; Mon, 12 May 2008 16:41:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5F-0007Wp-LI for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:05 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb55-0003pA-Lw for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:03 +0000 X-SBRS: 3.6 X-MesageID: 197152 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197152" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:40:02 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe20o010110 for ; Mon, 12 May 2008 09:40:02 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeKqT028487 for ; Mon, 12 May 2008 09:40:20 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeKVv028486 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:20 -0700 Message-Id: <200805121640.m4CGeKVv028486@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:19 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: free netfront resources on error/shutdown X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210584987 -3600 # Node ID 9f8b8315339ee6b512ae2f98b61bdf51be368783 # Parent a6e2679b1aad89d654d0af7f973f338d3f2cd9db minios: free netfront resources on error/shutdown Signed-off-by: Samuel Thibault --- extras/mini-os/fbfront.c | 4 +- extras/mini-os/include/mm.h | 1 extras/mini-os/lib/xmalloc.c | 2 - extras/mini-os/netfront.c | 68 ++++++++++++++++++++++++++++++------------- 4 files changed, 53 insertions(+), 22 deletions(-) diff -r a6e2679b1aad -r 9f8b8315339e extras/mini-os/fbfront.c --- a/extras/mini-os/fbfront.c Mon May 12 10:16:18 2008 +0100 +++ b/extras/mini-os/fbfront.c Mon May 12 10:36:27 2008 +0100 @@ -210,7 +210,7 @@ void shutdown_kbdfront(struct kbdfront_d unbind_evtchn(dev->evtchn); - free_pages(dev->page,0); + free_page(dev->page); free(nodename); free(dev->backend); free(dev); @@ -521,7 +521,7 @@ void shutdown_fbfront(struct fbfront_dev unbind_evtchn(dev->evtchn); - free_pages(dev->page,0); + free_page(dev->page); free(nodename); free(dev->backend); free(dev); diff -r a6e2679b1aad -r 9f8b8315339e extras/mini-os/include/mm.h --- a/extras/mini-os/include/mm.h Mon May 12 10:16:18 2008 +0100 +++ b/extras/mini-os/include/mm.h Mon May 12 10:36:27 2008 +0100 @@ -48,6 +48,7 @@ unsigned long alloc_pages(int order); unsigned long alloc_pages(int order); #define alloc_page() alloc_pages(0) void free_pages(void *pointer, int order); +#define free_page(p) free_pages(p, 0) static __inline__ int get_order(unsigned long size) { diff -r a6e2679b1aad -r 9f8b8315339e extras/mini-os/lib/xmalloc.c --- a/extras/mini-os/lib/xmalloc.c Mon May 12 10:16:18 2008 +0100 +++ b/extras/mini-os/lib/xmalloc.c Mon May 12 10:36:27 2008 +0100 @@ -264,7 +264,7 @@ void xfree(const void *p) printk("Bug\n"); *(int*)0=0; } - free_pages(hdr, 0); + free_page(hdr); } else { diff -r a6e2679b1aad -r 9f8b8315339e extras/mini-os/netfront.c --- a/extras/mini-os/netfront.c Mon May 12 10:16:18 2008 +0100 +++ b/extras/mini-os/netfront.c Mon May 12 10:36:27 2008 +0100 @@ -52,6 +52,7 @@ struct netfront_dev { char *nodename; char *backend; + char *mac; xenbus_event_queue events; @@ -263,6 +264,39 @@ void netfront_select_handler(evtchn_port } #endif +static void free_netfront(struct netfront_dev *dev) +{ + int i; + + for(i=0;itx_sem); + + mask_evtchn(dev->evtchn); + + free(dev->mac); + free(dev->backend); + + gnttab_end_access(dev->rx_ring_ref); + gnttab_end_access(dev->tx_ring_ref); + + free_page(dev->rx.sring); + free_page(dev->tx.sring); + + unbind_evtchn(dev->evtchn); + + for(i=0;irx_buffers[i].gref); + free_page(dev->rx_buffers[i].page); + } + + for(i=0;itx_buffers[i].page) + free_page(dev->tx_buffers[i].page); + + free(dev->nodename); + free(dev); +} + struct netfront_dev *init_netfront(char *nodename, void (*thenetif_rx)(unsigned char* data, int len), unsigned char rawmac[6], char **ip) { xenbus_transaction_t xbt; @@ -272,7 +306,6 @@ struct netfront_dev *init_netfront(char struct netif_rx_sring *rxs; int retry=0; int i; - char* mac; char* msg; struct netfront_dev *dev; @@ -288,6 +321,7 @@ struct netfront_dev *init_netfront(char printk("************************ NETFRONT for %s **********\n\n\n", nodename); dev = malloc(sizeof(*dev)); + memset(dev, 0, sizeof(*dev)); dev->nodename = strdup(nodename); printk("net TX ring size %d\n", NET_TX_RING_SIZE); @@ -314,7 +348,7 @@ struct netfront_dev *init_netfront(char #endif evtchn_alloc_unbound(dev->dom, netfront_handler, dev, &dev->evtchn); - txs = (struct netif_tx_sring*) alloc_page(); + txs = (struct netif_tx_sring *) alloc_page(); rxs = (struct netif_rx_sring *) alloc_page(); memset(txs,0,PAGE_SIZE); memset(rxs,0,PAGE_SIZE); @@ -328,11 +362,12 @@ struct netfront_dev *init_netfront(char dev->tx_ring_ref = gnttab_grant_access(dev->dom,virt_to_mfn(txs),0); dev->rx_ring_ref = gnttab_grant_access(dev->dom,virt_to_mfn(rxs),0); + init_rx_buffers(dev); + dev->netif_rx = thenetif_rx; dev->events = NULL; - // FIXME: proper frees on failures again: err = xenbus_transaction_start(&xbt); if (err) { @@ -379,25 +414,22 @@ again: abort_transaction: xenbus_transaction_end(xbt, 1, &retry); - return NULL; + goto error; done: snprintf(path, sizeof(path), "%s/backend", nodename); msg = xenbus_read(XBT_NIL, path, &dev->backend); snprintf(path, sizeof(path), "%s/mac", nodename); - msg = xenbus_read(XBT_NIL, path, &mac); - - if ((dev->backend == NULL) || (mac == NULL)) { - struct evtchn_close op = { dev->evtchn }; + msg = xenbus_read(XBT_NIL, path, &dev->mac); + + if ((dev->backend == NULL) || (dev->mac == NULL)) { printk("%s: backend/mac failed\n", __func__); - unbind_evtchn(dev->evtchn); - HYPERVISOR_event_channel_op(EVTCHNOP_close, &op); - return NULL; + goto error; } printk("backend at %s\n",dev->backend); - printk("mac is %s\n",mac); + printk("mac is %s\n",dev->mac); { char path[strlen(dev->backend) + 1 + 5 + 1]; @@ -415,13 +447,12 @@ done: printk("**************************\n"); - init_rx_buffers(dev); unmask_evtchn(dev->evtchn); /* Special conversion specifier 'hh' needed for __ia64__. Without this mini-os panics with 'Unaligned reference'. */ if (rawmac) - sscanf(mac,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", + sscanf(dev->mac,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &rawmac[0], &rawmac[1], &rawmac[2], @@ -430,6 +461,9 @@ done: &rawmac[5]); return dev; +error: + free_netfront(dev); + return NULL; } #ifdef HAVE_LIBC @@ -467,11 +501,7 @@ void shutdown_netfront(struct netfront_d xenbus_unwatch_path(XBT_NIL, path); - unbind_evtchn(dev->evtchn); - - free(nodename); - free(dev->backend); - free(dev); + free_netfront(dev); } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:41:10 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:41:10 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb5K-0004ON-33 for www-data@colo.xensource.com; Mon, 12 May 2008 09:41:10 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5v-000831-8Y; Mon, 12 May 2008 16:41:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5G-0007XT-Bt for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb5A-0003p8-JQ for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:04 +0000 X-SBRS: 3.6 X-MesageID: 197154 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197154" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:40:04 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe4fF010116 for ; Mon, 12 May 2008 09:40:04 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeMR3028521 for ; Mon, 12 May 2008 09:40:22 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeMCv028520 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:22 -0700 Message-Id: <200805121640.m4CGeMCv028520@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:21 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: Fix build: use uint64_t rather than u64. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210587403 -3600 # Node ID 0f18d5454c7b6f6a338d16571a064ef5c219c06c # Parent c6533d246a8145e342de71cc7b6dc80b8995c68e ioemu: Fix build: use uint64_t rather than u64. Signed-off-by: Keir Fraser --- tools/ioemu/hw/pass-through.h | 2 +- tools/ioemu/hw/pt-msi.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff -r c6533d246a81 -r 0f18d5454c7b tools/ioemu/hw/pass-through.h --- a/tools/ioemu/hw/pass-through.h Mon May 12 11:01:21 2008 +0100 +++ b/tools/ioemu/hw/pass-through.h Mon May 12 11:16:43 2008 +0100 @@ -76,7 +76,7 @@ struct pt_msix_info { int total_entries; int bar_index; uint32_t table_off; - u64 mmio_base_addr; + uint64_t mmio_base_addr; int mmio_index; int fd; void *phys_iomem_base; diff -r c6533d246a81 -r 0f18d5454c7b tools/ioemu/hw/pt-msi.c --- a/tools/ioemu/hw/pt-msi.c Mon May 12 11:01:21 2008 +0100 +++ b/tools/ioemu/hw/pt-msi.c Mon May 12 11:16:43 2008 +0100 @@ -666,7 +666,7 @@ int pt_msix_init(struct pt_dev *dev, int uint8_t id; uint16_t flags, control; int i, total_entries, table_off, bar_index; - u64 bar_base; + uint64_t bar_base; struct pci_dev *pd = dev->pci_dev; id = pci_read_byte(pd, pos + PCI_CAP_LIST_ID); @@ -714,7 +714,7 @@ int pt_msix_init(struct pt_dev *dev, int if ( (bar_base & 0x6) == 0x4 ) { bar_base &= ~0xf; - bar_base += (u64)pci_read_long(pd, 0x10 + 4 * (bar_index + 1)) << 32; + bar_base += (uint64_t)pci_read_long(pd, 0x10 + 4 * (bar_index + 1)) << 32; } PT_LOG("get MSI-X table bar base %lx\n", bar_base); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:41:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:41:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb5P-0004OR-6p for www-data@colo.xensource.com; Mon, 12 May 2008 09:41:15 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb60-00086e-AL; Mon, 12 May 2008 16:41:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5I-0007YU-56 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:08 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb5C-0003p7-PG for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:06 +0000 X-SBRS: 3.6 X-MesageID: 197155 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197155" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:40:05 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe5w9010119 for ; Mon, 12 May 2008 09:40:05 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeNTh028538 for ; Mon, 12 May 2008 09:40:23 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeNXG028537 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:23 -0700 Message-Id: <200805121640.m4CGeNXG028537@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:22 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Add syntax check for block devices X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210587549 -3600 # Node ID 0a8fc1a6279647ab625377a35413429d52b5d454 # Parent 0f18d5454c7b6f6a338d16571a064ef5c219c06c xend: Add syntax check for block devices If we define wrong values to a disk parameter in domain configuration files, we get an error message or a guest OS panic. 1. If we define a wrong disk type, xm create command error occurs about 100 seconds later. e.g. disk=['xyz:/xen/root-vm1.img,hda1,w'] 2. If we forget a disk type, a guest OS panic occurs. e.g. disk=['/xen/root-vm1.img,hda1,w'] Signed-off-by: Masaki Kanno --- tools/python/xen/xend/server/blkif.py | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) diff -r 0f18d5454c7b -r 0a8fc1a62796 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Mon May 12 11:16:43 2008 +0100 +++ b/tools/python/xen/xend/server/blkif.py Mon May 12 11:19:09 2008 +0100 @@ -56,8 +56,12 @@ class BlkifController(DevController): else: try: (typ, params) = string.split(uname, ':', 1) + if typ not in ('phy', 'file'): + raise VmError( + 'Block device must have "phy" or "file" specified to type') except ValueError: - (typ, params) = ("", "") + raise VmError( + 'Block device must have physical details specified') mode = config.get('mode', 'r') if mode not in ('r', 'w', 'w!'): _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:41:20 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:41:20 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb5T-0004OY-Rm for www-data@colo.xensource.com; Mon, 12 May 2008 09:41:20 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb65-0008AD-2P; Mon, 12 May 2008 16:41:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5J-0007ZK-LL for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:09 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb5E-0003pA-2f for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:07 +0000 X-SBRS: 3.6 X-MesageID: 197156 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197156" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:40:07 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe6w2010122 for ; Mon, 12 May 2008 09:40:06 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeO2H028603 for ; Mon, 12 May 2008 09:40:24 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeO20028602 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:24 -0700 Message-Id: <200805121640.m4CGeO20028602@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:23 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Sync public Xen hedaers with xen-unstable.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210582988 -3600 # Node ID db71fb3204b5529b04d1fcf68f2dbd6129a481e6 # Parent 0da2e3c3ae18cdd9d499473fb3f5e260abc59864 Sync public Xen hedaers with xen-unstable.hg Signed-off-by: Keir Fraser --- include/xen/interface/arch-ia64.h | 59 +++--------------- include/xen/interface/arch-ia64/hvm/memmap.h | 88 +++++++++++++++++++++++++++ include/xen/interface/arch-ia64/sioemu.h | 53 +++++++++++++++- include/xen/interface/arch-x86/xen-x86_32.h | 7 -- include/xen/interface/domctl.h | 23 ++++++- include/xen/interface/hvm/hvm_op.h | 16 ++++ include/xen/interface/hvm/params.h | 8 ++ include/xen/interface/io/pciif.h | 15 ---- include/xen/interface/io/protocols.h | 3 include/xen/interface/io/xs_wire.h | 1 include/xen/interface/libelf.h | 4 - include/xen/interface/physdev.h | 6 - include/xen/interface/sysctl.h | 11 ++- include/xen/interface/xen.h | 2 include/xen/interface/xsm/acm.h | 8 ++ 15 files changed, 216 insertions(+), 88 deletions(-) diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/arch-ia64.h --- a/include/xen/interface/arch-ia64.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/arch-ia64.h Mon May 12 10:03:08 2008 +0100 @@ -68,6 +68,10 @@ typedef unsigned long xen_pfn_t; /* WARNING: before changing this, check that shared_info fits on a page */ #define MAX_VIRT_CPUS 64 +/* IO ports location for PV. */ +#define IO_PORTS_PADDR 0x00000ffffc000000UL +#define IO_PORTS_SIZE 0x0000000004000000UL + #ifndef __ASSEMBLY__ typedef unsigned long xen_ulong_t; @@ -79,54 +83,6 @@ typedef unsigned long xen_ulong_t; #endif #define INVALID_MFN (~0UL) - -#define MEM_G (1UL << 30) -#define MEM_M (1UL << 20) -#define MEM_K (1UL << 10) - -/* Guest physical address of IO ports space. */ -#define IO_PORTS_PADDR 0x00000ffffc000000UL -#define IO_PORTS_SIZE 0x0000000004000000UL - -#define MMIO_START (3 * MEM_G) -#define MMIO_SIZE (512 * MEM_M) - -#define VGA_IO_START 0xA0000UL -#define VGA_IO_SIZE 0x20000 - -#define LEGACY_IO_START (MMIO_START + MMIO_SIZE) -#define LEGACY_IO_SIZE (64*MEM_M) - -#define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE) -#define IO_PAGE_SIZE XEN_PAGE_SIZE - -#define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE) -#define STORE_PAGE_SIZE XEN_PAGE_SIZE - -#define BUFFER_IO_PAGE_START (STORE_PAGE_START + STORE_PAGE_SIZE) -#define BUFFER_IO_PAGE_SIZE XEN_PAGE_SIZE - -#define BUFFER_PIO_PAGE_START (BUFFER_IO_PAGE_START + BUFFER_IO_PAGE_SIZE) -#define BUFFER_PIO_PAGE_SIZE XEN_PAGE_SIZE - -#define IO_SAPIC_START 0xfec00000UL -#define IO_SAPIC_SIZE 0x100000 - -#define PIB_START 0xfee00000UL -#define PIB_SIZE 0x200000 - -#define GFW_START (4*MEM_G -16*MEM_M) -#define GFW_SIZE (16*MEM_M) - -/* Nvram belongs to GFW memory space */ -#define NVRAM_SIZE (MEM_K * 64) -#define NVRAM_START (GFW_START + 10 * MEM_M) - -#define NVRAM_VALID_SIG 0x4650494e45584948 // "HIXENIPF" -struct nvram_save_addr { - unsigned long addr; - unsigned long signature; -}; struct pt_fpreg { union { @@ -509,6 +465,9 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte /* Internal only: associated with PGC_allocated bit */ #define _ASSIGN_pgc_allocated 3 #define ASSIGN_pgc_allocated (1UL << _ASSIGN_pgc_allocated) +/* Page is an IO page. */ +#define _ASSIGN_io 4 +#define ASSIGN_io (1UL << _ASSIGN_io) /* This structure has the same layout of struct ia64_boot_param, defined in . It is redefined here to ease use. */ @@ -644,6 +603,10 @@ DEFINE_XEN_GUEST_HANDLE(pfarg_load_t); #endif /* __ASSEMBLY__ */ #endif /* XEN */ +#ifndef __ASSEMBLY__ +#include "arch-ia64/hvm/memmap.h" +#endif + #endif /* __HYPERVISOR_IF_IA64_H__ */ /* diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/arch-ia64/hvm/memmap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/xen/interface/arch-ia64/hvm/memmap.h Mon May 12 10:03:08 2008 +0100 @@ -0,0 +1,88 @@ +/****************************************************************************** + * memmap.h + * + * Copyright (c) 2008 Tristan Gingold + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ +#define __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ + +#define MEM_G (1UL << 30) +#define MEM_M (1UL << 20) +#define MEM_K (1UL << 10) + +/* Guest physical address of IO ports space. */ +#define MMIO_START (3 * MEM_G) +#define MMIO_SIZE (512 * MEM_M) + +#define VGA_IO_START 0xA0000UL +#define VGA_IO_SIZE 0x20000 + +#define LEGACY_IO_START (MMIO_START + MMIO_SIZE) +#define LEGACY_IO_SIZE (64 * MEM_M) + +#define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE) +#define IO_PAGE_SIZE XEN_PAGE_SIZE + +#define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE) +#define STORE_PAGE_SIZE XEN_PAGE_SIZE + +#define BUFFER_IO_PAGE_START (STORE_PAGE_START + STORE_PAGE_SIZE) +#define BUFFER_IO_PAGE_SIZE XEN_PAGE_SIZE + +#define BUFFER_PIO_PAGE_START (BUFFER_IO_PAGE_START + BUFFER_IO_PAGE_SIZE) +#define BUFFER_PIO_PAGE_SIZE XEN_PAGE_SIZE + +#define IO_SAPIC_START 0xfec00000UL +#define IO_SAPIC_SIZE 0x100000 + +#define PIB_START 0xfee00000UL +#define PIB_SIZE 0x200000 + +#define GFW_START (4 * MEM_G - 16 * MEM_M) +#define GFW_SIZE (16 * MEM_M) + +/* domVTI */ +#define GPFN_FRAME_BUFFER 0x1 /* VGA framebuffer */ +#define GPFN_LOW_MMIO 0x2 /* Low MMIO range */ +#define GPFN_PIB 0x3 /* PIB base */ +#define GPFN_IOSAPIC 0x4 /* IOSAPIC base */ +#define GPFN_LEGACY_IO 0x5 /* Legacy I/O base */ +#define GPFN_HIGH_MMIO 0x6 /* High MMIO range */ + +/* Nvram belongs to GFW memory space */ +#define NVRAM_SIZE (MEM_K * 64) +#define NVRAM_START (GFW_START + 10 * MEM_M) + +#define NVRAM_VALID_SIG 0x4650494e45584948 /* "HIXENIPF" */ +struct nvram_save_addr { + unsigned long addr; + unsigned long signature; +}; + +#endif /* __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ */ + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/arch-ia64/sioemu.h --- a/include/xen/interface/arch-ia64/sioemu.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/arch-ia64/sioemu.h Mon May 12 10:03:08 2008 +0100 @@ -22,6 +22,9 @@ #ifndef __XEN_PUBLIC_IA64_SIOEMU_H__ #define __XEN_PUBLIC_IA64_SIOEMU_H__ +/* SIOEMU specific hypercalls. + The numbers are the minor part of FW_HYPERCALL_SIOEMU. */ + /* Defines the callback entry point. r8=ip, r9=data. Must be called per-vcpu. */ #define SIOEMU_HYPERCALL_SET_CALLBACK 0x01 @@ -35,8 +38,52 @@ /* Get wallclock time. */ #define SIOEMU_HYPERCALL_GET_TIME 0x04 -/* Return from callback. r16=0. - Unmask vcpu events. */ -#define SIOEMU_HYPERPRIVOP_CALLBACK_RETURN 0x01 +/* Flush cache. */ +#define SIOEMU_HYPERCALL_FLUSH_CACHE 0x07 +/* Get freq base. */ +#define SIOEMU_HYPERCALL_FREQ_BASE 0x08 + +/* Return from callback. */ +#define SIOEMU_HYPERCALL_CALLBACK_RETURN 0x09 + +/* Deliver an interrupt. */ +#define SIOEMU_HYPERCALL_DELIVER_INT 0x0a + +/* SIOEMU callback reason. */ + +/* An event (from event channel) has to be delivered. */ +#define SIOEMU_CB_EVENT 0x00 + +/* Emulate an IO access. */ +#define SIOEMU_CB_IO_EMULATE 0x01 + +/* An IPI is sent to a dead vcpu. */ +#define SIOEMU_CB_WAKEUP_VCPU 0x02 + +/* A SAL hypercall is executed. */ +#define SIOEMU_CB_SAL_ASSIST 0x03 + +#ifndef __ASSEMBLY__ +struct sioemu_callback_info { + /* Saved registers. */ + unsigned long ip; + unsigned long psr; + unsigned long ifs; + unsigned long nats; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + + /* Callback parameters. */ + unsigned long cause; + unsigned long arg0; + unsigned long arg1; + unsigned long arg2; + unsigned long arg3; + unsigned long _pad2[2]; + unsigned long r2; +}; +#endif /* __ASSEMBLY__ */ #endif /* __XEN_PUBLIC_IA64_SIOEMU_H__ */ diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/arch-x86/xen-x86_32.h --- a/include/xen/interface/arch-x86/xen-x86_32.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/arch-x86/xen-x86_32.h Mon May 12 10:03:08 2008 +0100 @@ -74,6 +74,7 @@ #define MACH2PHYS_VIRT_END_PAE \ mk_unsigned_long(__MACH2PHYS_VIRT_END_PAE) +/* Non-PAE bounds are obsolete. */ #define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000 #define __MACH2PHYS_VIRT_START_NONPAE 0xFC000000 #define __MACH2PHYS_VIRT_END_NONPAE 0xFC400000 @@ -84,15 +85,9 @@ #define MACH2PHYS_VIRT_END_NONPAE \ mk_unsigned_long(__MACH2PHYS_VIRT_END_NONPAE) -#ifdef CONFIG_X86_PAE #define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE #define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_PAE #define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_PAE -#else -#define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_NONPAE -#define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_NONPAE -#define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_NONPAE -#endif #ifndef HYPERVISOR_VIRT_START #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/domctl.h --- a/include/xen/interface/domctl.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/domctl.h Mon May 12 10:03:08 2008 +0100 @@ -454,7 +454,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_assig #define XEN_DOMCTL_unbind_pt_irq 48 typedef enum pt_irq_type_e { PT_IRQ_TYPE_PCI, - PT_IRQ_TYPE_ISA + PT_IRQ_TYPE_ISA, + PT_IRQ_TYPE_MSI, } pt_irq_type_t; struct xen_domctl_bind_pt_irq { uint32_t machine_irq; @@ -470,6 +471,10 @@ struct xen_domctl_bind_pt_irq { uint8_t device; uint8_t intx; } pci; + struct { + uint8_t gvec; + uint32_t gflags; + } msi; } u; }; typedef struct xen_domctl_bind_pt_irq xen_domctl_bind_pt_irq_t; @@ -571,6 +576,19 @@ typedef struct xen_domctl_set_target xen typedef struct xen_domctl_set_target xen_domctl_set_target_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_target_t); +#if defined(__i386__) || defined(__x86_64__) +# define XEN_CPUID_INPUT_UNUSED 0xFFFFFFFF +# define XEN_DOMCTL_set_cpuid 49 +struct xen_domctl_cpuid { + unsigned int input[2]; + unsigned int eax; + unsigned int ebx; + unsigned int ecx; + unsigned int edx; +}; +typedef struct xen_domctl_cpuid xen_domctl_cpuid_t; +DEFINE_XEN_GUEST_HANDLE(xen_domctl_cpuid_t); +#endif struct xen_domctl { uint32_t cmd; @@ -609,6 +627,9 @@ struct xen_domctl { struct xen_domctl_ext_vcpucontext ext_vcpucontext; struct xen_domctl_set_opt_feature set_opt_feature; struct xen_domctl_set_target set_target; +#if defined(__i386__) || defined(__x86_64__) + struct xen_domctl_cpuid cpuid; +#endif uint8_t pad[128]; } u; }; diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/hvm/hvm_op.h --- a/include/xen/interface/hvm/hvm_op.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/hvm/hvm_op.h Mon May 12 10:03:08 2008 +0100 @@ -73,4 +73,20 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_ /* Flushes all VCPU TLBs: @arg must be NULL. */ #define HVMOP_flush_tlbs 5 +/* Track dirty VRAM. */ +#define HVMOP_track_dirty_vram 6 +struct xen_hvm_track_dirty_vram { + /* Domain to be tracked. */ + domid_t domid; + /* First pfn to track. */ + uint64_aligned_t first_pfn; + /* Number of pages to track. */ + uint64_aligned_t nr; + /* OUT variable. */ + /* Dirty bitmap buffer. */ + XEN_GUEST_HANDLE_64(uint8) dirty_bitmap; +}; +typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t; +DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t); + #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/hvm/params.h --- a/include/xen/interface/hvm/params.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/hvm/params.h Mon May 12 10:03:08 2008 +0100 @@ -84,6 +84,12 @@ /* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */ #define HVM_PARAM_HPET_ENABLED 11 -#define HVM_NR_PARAMS 12 +/* Identity-map page directory used by Intel EPT when CR0.PG=0. */ +#define HVM_PARAM_IDENT_PT 12 + +/* Device Model domain, defaults to 0. */ +#define HVM_PARAM_DM_DOMAIN 13 + +#define HVM_NR_PARAMS 14 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/io/pciif.h --- a/include/xen/interface/io/pciif.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/io/pciif.h Mon May 12 10:03:08 2008 +0100 @@ -34,10 +34,6 @@ /* xen_pci_op commands */ #define XEN_PCI_OP_conf_read (0) #define XEN_PCI_OP_conf_write (1) -#define XEN_PCI_OP_enable_msi (2) -#define XEN_PCI_OP_enable_msix (3) -#define XEN_PCI_OP_disable_msi (4) -#define XEN_PCI_OP_disable_msix (5) /* xen_pci_op error numbers */ #define XEN_PCI_ERR_success (0) @@ -47,12 +43,6 @@ #define XEN_PCI_ERR_not_implemented (-4) /* XEN_PCI_ERR_op_failed - backend failed to complete the operation */ #define XEN_PCI_ERR_op_failed (-5) - -/* - * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry)) - * Should not exceed 128 - */ -#define SH_INFO_MAX_VEC 128 struct xen_pci_op { /* IN: what action to perform: XEN_PCI_OP_* */ @@ -72,11 +62,6 @@ struct xen_pci_op { /* IN/OUT: Contains the result after a READ or the value to WRITE */ uint32_t value; - /* IN: Contains extra infor for this operation */ - uint32_t info; - /*IN: param for msi-x */ - struct msix_entry msix_entries[SH_INFO_MAX_VEC]; - }; struct xen_pci_sharedinfo { diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/io/protocols.h --- a/include/xen/interface/io/protocols.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/io/protocols.h Mon May 12 10:03:08 2008 +0100 @@ -26,7 +26,6 @@ #define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi" #define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi" #define XEN_IO_PROTO_ABI_IA64 "ia64-abi" -#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi" #if defined(__i386__) # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32 @@ -34,8 +33,6 @@ # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64 #elif defined(__ia64__) # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64 -#elif defined(__powerpc64__) -# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64 #else # error arch fixup needed here #endif diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/io/xs_wire.h --- a/include/xen/interface/io/xs_wire.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/io/xs_wire.h Mon May 12 10:03:08 2008 +0100 @@ -61,6 +61,7 @@ struct xsd_errors const char *errstring; }; #define XSD_ERROR(x) { x, #x } +/* LINTED: static unused */ static struct xsd_errors xsd_errors[] #if defined(__GNUC__) __attribute__((unused)) diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/libelf.h --- a/include/xen/interface/libelf.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/libelf.h Mon May 12 10:03:08 2008 +0100 @@ -23,10 +23,8 @@ #ifndef __XC_LIBELF__ #define __XC_LIBELF__ 1 -#if defined(__i386__) || defined(__x86_64) || defined(__ia64__) +#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) #define XEN_ELF_LITTLE_ENDIAN -#elif defined(__powerpc__) -#define XEN_ELF_BIG_ENDIAN #else #error define architectural endianness #endif diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/physdev.h --- a/include/xen/interface/physdev.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/physdev.h Mon May 12 10:03:08 2008 +0100 @@ -121,7 +121,7 @@ struct physdev_irq { }; typedef struct physdev_irq physdev_irq_t; DEFINE_XEN_GUEST_HANDLE(physdev_irq_t); - + #define MAP_PIRQ_TYPE_MSI 0x0 #define MAP_PIRQ_TYPE_GSI 0x1 #define MAP_PIRQ_TYPE_UNKNOWN 0x2 @@ -135,10 +135,10 @@ struct physdev_map_pirq { int index; /* IN or OUT */ int pirq; - /* msi info passed to VMM */ + /* IN */ struct { int bus, devfn, entry_nr; - int msi; /* 0 - MSIX 1 - MSI */ + int msi; /* 0 - MSIX 1 - MSI */ } msi_info; }; typedef struct physdev_map_pirq physdev_map_pirq_t; diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/sysctl.h --- a/include/xen/interface/sysctl.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/sysctl.h Mon May 12 10:03:08 2008 +0100 @@ -84,8 +84,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_ * Get physical information about the host machine */ #define XEN_SYSCTL_physinfo 3 + /* (x86) The platform supports HVM guests. */ +#define _XEN_SYSCTL_PHYSCAP_hvm 0 +#define XEN_SYSCTL_PHYSCAP_hvm (1u<<_XEN_SYSCTL_PHYSCAP_hvm) + /* (x86) The platform supports HVM-guest direct access to I/O devices. */ +#define _XEN_SYSCTL_PHYSCAP_hvm_directio 1 +#define XEN_SYSCTL_PHYSCAP_hvm_directio (1u<<_XEN_SYSCTL_PHYSCAP_hvm_directio) struct xen_sysctl_physinfo { - /* IN variables. */ uint32_t threads_per_core; uint32_t cores_per_socket; uint32_t nr_cpus; @@ -96,7 +101,6 @@ struct xen_sysctl_physinfo { uint64_aligned_t scrub_pages; uint32_t hw_cap[8]; - /* IN/OUT variables. */ /* * IN: maximum addressable entry in the caller-provided cpu_to_node array. * OUT: largest cpu identifier in the system. @@ -112,6 +116,9 @@ struct xen_sysctl_physinfo { * elements of the array will not be written by the sysctl. */ XEN_GUEST_HANDLE_64(uint32) cpu_to_node; + + /* XEN_SYSCTL_PHYSCAP_??? */ + uint32_t capabilities; }; typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t); diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/xen.h --- a/include/xen/interface/xen.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/xen.h Mon May 12 10:03:08 2008 +0100 @@ -33,8 +33,6 @@ #include "arch-x86/xen.h" #elif defined(__ia64__) #include "arch-ia64.h" -#elif defined(__powerpc__) -#include "arch-powerpc.h" #else #error "Unsupported architecture" #endif diff -r 0da2e3c3ae18 -r db71fb3204b5 include/xen/interface/xsm/acm.h --- a/include/xen/interface/xsm/acm.h Thu May 08 13:44:57 2008 +0100 +++ b/include/xen/interface/xsm/acm.h Mon May 12 10:03:08 2008 +0100 @@ -91,7 +91,7 @@ * whenever the interpretation of the related * policy's data structure changes */ -#define ACM_POLICY_VERSION 3 +#define ACM_POLICY_VERSION 4 #define ACM_CHWALL_VERSION 1 #define ACM_STE_VERSION 1 @@ -102,6 +102,7 @@ typedef uint32_t ssidref_t; #define ACMHOOK_none 0 #define ACMHOOK_sharing 1 #define ACMHOOK_authorization 2 +#define ACMHOOK_conflictset 3 /* -------security policy relevant type definitions-------- */ @@ -130,6 +131,10 @@ typedef uint16_t domaintype_t; /* high-16 = version, low-16 = check magic */ #define ACM_MAGIC 0x0001debc +/* size of the SHA1 hash identifying the XML policy from which the + binary policy was created */ +#define ACM_SHA1_HASH_SIZE 20 + /* each offset in bytes from start of the struct they * are part of */ @@ -159,6 +164,7 @@ struct acm_policy_buffer { uint32_t secondary_policy_code; uint32_t secondary_buffer_offset; struct acm_policy_version xml_pol_version; /* add in V3 */ + uint8_t xml_policy_hash[ACM_SHA1_HASH_SIZE]; /* added in V4 */ }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 12 09:41:25 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 12 May 2008 09:41:25 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jvb5Z-0004Od-3v for www-data@colo.xensource.com; Mon, 12 May 2008 09:41:25 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb6A-0008E2-9P; Mon, 12 May 2008 16:42:02 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jvb5L-0007am-Az for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:11 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jvb5E-0003p8-Pl for xen-changelog@lists.xensource.com; Mon, 12 May 2008 16:41:09 +0000 X-SBRS: 3.6 X-MesageID: 197157 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,474,1204520400"; d="scan'208";a="197157" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 12 May 2008 12:40:08 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGe85v010125 for ; Mon, 12 May 2008 09:40:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4CGeQSE028621 for ; Mon, 12 May 2008 09:40:26 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4CGeQuo028620 for xen-changelog@lists.xensource.com; Mon, 12 May 2008 09:40:26 -0700 Message-Id: <200805121640.m4CGeQuo028620@xenbits.xensource.com> Date: Mon, 12 May 2008 09:40:25 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] xen: Fix bug in MSI-X passthrough. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210583127 -3600 # Node ID 05b7df5cc607bf5b00725232085c35e5b6d493fe # Parent db71fb3204b5529b04d1fcf68f2dbd6129a481e6 xen: Fix bug in MSI-X passthrough. Signed-off-by: Shan Haitao --- drivers/pci/msi-xen.c | 1 - 1 files changed, 1 deletion(-) diff -r db71fb3204b5 -r 05b7df5cc607 drivers/pci/msi-xen.c --- a/drivers/pci/msi-xen.c Mon May 12 10:03:08 2008 +0100 +++ b/drivers/pci/msi-xen.c Mon May 12 10:05:27 2008 +0100 @@ -414,7 +414,6 @@ static int msix_capability_init(struct p if (pirq < 0) break; attach_pirq_entry(pirq, entries[i].entry, msi_dev_entry); - dev->irq = pirq; (entries + i)->vector = pirq; } if (i != nvec) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:10 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:10 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwS9-0006UP-PI for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:10 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSl-0005YC-6V; Tue, 13 May 2008 15:30:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSj-0005Xh-DF for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSb-0000JN-L5 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:43 +0000 X-SBRS: 3.6 X-MesageID: 204855 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204855" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:29:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFTrWh011561 for ; Tue, 13 May 2008 08:29:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUBdN011288 for ; Tue, 13 May 2008 08:30:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUBFf011287 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:11 -0700 Message-Id: <200805131530.m4DFUBFf011287@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix relocation ssl/tls support X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210666747 -3600 # Node ID f8ce6e3d86c76a39a2e5098c5cc1c5e5529091f9 # Parent 0a8fc1a6279647ab625377a35413429d52b5d454 Fix relocation ssl/tls support * Make a wrapper of read/write sock.fileno(). * Makes pyOpenSSL an optional package. * Implement reference: http://twistedmatrix.com/trac/browser/trunk/twisted/internet/tcp.py Signed-off-by: Zhigang Wang --- tools/python/xen/web/connection.py | 163 +++++++++++++++++++++++++++++++ tools/python/xen/web/tcp.py | 12 ++ tools/python/xen/xend/XendDomain.py | 63 ++++++++--- tools/python/xen/xend/server/relocate.py | 22 +++- 4 files changed, 243 insertions(+), 17 deletions(-) diff -r 0a8fc1a62796 -r f8ce6e3d86c7 tools/python/xen/web/connection.py --- a/tools/python/xen/web/connection.py Mon May 12 11:19:09 2008 +0100 +++ b/tools/python/xen/web/connection.py Tue May 13 09:19:07 2008 +0100 @@ -18,11 +18,17 @@ #============================================================================ import sys +import os import threading import socket import fcntl from errno import EAGAIN, EINTR, EWOULDBLOCK + +try: + from OpenSSL import SSL +except ImportError: + pass from xen.xend.XendLogging import log @@ -114,6 +120,163 @@ class SocketListener: finally: self.close() + +class SSLSocketServerConnection(SocketServerConnection): + """An SSL aware accepted connection to a server. + + As pyOpenSSL SSL.Connection fileno() method just retrieve the file + descriptor number for the underlying socket, direct read/write to the file + descriptor will result no data encrypted. + + recv2fd() and fd2send() are simple wrappers for functions who need direct + read/write to a file descriptor rather than a socket like object. + + To use recv2fd(), you can create a pipe and start a thread to transfer all + received data to one end of the pipe, then read from the other end: + + p2cread, p2cwrite = os.pipe() + threading.Thread(target=connection.recv2fd, args=(sock, p2cwrite)).start() + os.read(p2cread, 1024) + + To use fd2send(): + + p2cread, p2cwrite = os.pipe() + threading.Thread(target=connection.fd2send, args=(sock, p2cread)).start() + os.write(p2cwrite, "data") + """ + + def __init__(self, sock, protocol_class): + SocketServerConnection.__init__(self, sock, protocol_class) + + + def main(self): + try: + while True: + try: + data = self.sock.recv(BUFFER_SIZE) + if data == "": + break + if self.protocol.dataReceived(data): + break + except socket.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + break + except (SSL.WantReadError, SSL.WantWriteError, \ + SSL.WantX509LookupError): + # The operation did not complete; the same I/O method + # should be called again. + continue + except SSL.ZeroReturnError: + # The SSL Connection has been closed. + break + except SSL.SysCallError, (retval, desc): + if ((retval == -1 and desc == "Unexpected EOF") + or retval > 0): + # The SSL Connection is lost. + break + log.debug("SSL SysCallError:%d:%s" % (retval, desc)) + break + except SSL.Error, e: + # other SSL errors + log.debug("SSL Error:%s" % e) + break + finally: + try: + self.sock.close() + except: + pass + + + def recv2fd(sock, fd): + try: + while True: + try: + data = sock.recv(BUFFER_SIZE) + if data == "": + break + count = 0 + while count < len(data): + try: + nbytes = os.write(fd, data[count:]) + count += nbytes + except os.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + raise + except socket.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + break + except (SSL.WantReadError, SSL.WantWriteError, \ + SSL.WantX509LookupError): + # The operation did not complete; the same I/O method + # should be called again. + continue + except SSL.ZeroReturnError: + # The SSL Connection has been closed. + break + except SSL.SysCallError, (retval, desc): + if ((retval == -1 and desc == "Unexpected EOF") + or retval > 0): + # The SSL Connection is lost. + break + log.debug("SSL SysCallError:%d:%s" % (retval, desc)) + break + except SSL.Error, e: + # other SSL errors + log.debug("SSL Error:%s" % e) + break + finally: + try: + sock.close() + os.close(fd) + except: + pass + + recv2fd = staticmethod(recv2fd) + + def fd2send(sock, fd): + try: + while True: + try: + data = os.read(fd, BUFFER_SIZE) + if data == "": + break + count = 0 + while count < len(data): + try: + nbytes = sock.send(data[count:]) + count += nbytes + except socket.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + raise + except (SSL.WantReadError, SSL.WantWriteError, \ + SSL.WantX509LookupError): + # The operation did not complete; the same I/O method + # should be called again. + continue + except SSL.ZeroReturnError: + # The SSL Connection has been closed. + raise + except SSL.SysCallError, (retval, desc): + if not (retval == -1 and data == ""): + # errors when writing empty strings are expected + # and can be ignored + log.debug("SSL SysCallError:%d:%s" % (retval, desc)) + raise + except SSL.Error, e: + # other SSL errors + log.debug("SSL Error:%s" % e) + raise + except os.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + break + finally: + try: + sock.close() + os.close(fd) + except: + pass + + fd2send = staticmethod(fd2send) def hostAllowed(addrport, hosts_allowed): if hosts_allowed is None: diff -r 0a8fc1a62796 -r f8ce6e3d86c7 tools/python/xen/web/tcp.py --- a/tools/python/xen/web/tcp.py Mon May 12 11:19:09 2008 +0100 +++ b/tools/python/xen/web/tcp.py Tue May 13 09:19:07 2008 +0100 @@ -88,6 +88,7 @@ class SSLTCPListener(TCPListener): ctx.use_certificate_file(self.ssl_cert_file) sock = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) + sock.set_accept_state() sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # SO_REUSEADDR does not always ensure that we do not get an address @@ -104,3 +105,14 @@ class SSLTCPListener(TCPListener): else: raise + + def acceptConnection(self, sock, addrport): + addr = addrport[0] + if connection.hostAllowed(addrport, self.hosts_allow): + connection.SSLSocketServerConnection(sock, self.protocol_class) + else: + try: + sock.close() + except: + pass + diff -r 0a8fc1a62796 -r f8ce6e3d86c7 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Mon May 12 11:19:09 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Tue May 13 09:19:07 2008 +0100 @@ -1293,25 +1293,56 @@ class XendDomain: if port == 0: port = xoptions.get_xend_relocation_port() - try: - tls = xoptions.get_xend_relocation_tls() - if tls: - from OpenSSL import SSL + tls = xoptions.get_xend_relocation_tls() + if tls: + from OpenSSL import SSL + from xen.web import connection + try: ctx = SSL.Context(SSL.SSLv23_METHOD) - sock = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) + sock = SSL.Connection(ctx, + socket.socket(socket.AF_INET, socket.SOCK_STREAM)) sock.set_connect_state() - else: + sock.connect((dst, port)) + sock.send("sslreceive\n") + sock.recv(80) + except SSL.Error, err: + raise XendError("SSL error: %s" % err) + except socket.error, err: + raise XendError("can't connect: %s" % err) + + p2cread, p2cwrite = os.pipe() + threading.Thread(target=connection.SSLSocketServerConnection.fd2send, + args=(sock, p2cread)).start() + + try: + XendCheckpoint.save(p2cwrite, dominfo, True, live, dst, + node=node) + finally: + sock.shutdown() + sock.close() + + os.close(p2cread) + os.close(p2cwrite) + else: + try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((dst, port)) - except socket.error, err: - raise XendError("can't connect: %s" % err[1]) - - sock.send("receive\n") - sock.recv(80) - try: - XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst, node=node) - finally: - sock.close() + # When connecting to our ssl enabled relocation server using a + # plain socket, send will success but recv will block. Add a + # 30 seconds timeout to raise a socket.timeout exception to + # inform the client. + sock.settimeout(30.0) + sock.connect((dst, port)) + sock.send("receive\n") + sock.recv(80) + sock.settimeout(None) + except socket.error, err: + raise XendError("can't connect: %s" % err) + + try: + XendCheckpoint.save(sock.fileno(), dominfo, True, live, + dst, node=node) + finally: + sock.close() def domain_save(self, domid, dst, checkpoint=False): """Start saving a domain to file. diff -r 0a8fc1a62796 -r f8ce6e3d86c7 tools/python/xen/xend/server/relocate.py --- a/tools/python/xen/xend/server/relocate.py Mon May 12 11:19:09 2008 +0100 +++ b/tools/python/xen/xend/server/relocate.py Tue May 13 09:19:07 2008 +0100 @@ -17,10 +17,12 @@ #============================================================================ import re +import os import sys import StringIO +import threading -from xen.web import protocol, tcp, unix +from xen.web import protocol, tcp, unix, connection from xen.xend import sxp from xen.xend import XendDomain @@ -116,6 +118,24 @@ class RelocationProtocol(protocol.Protoc log.error(name + ": no transport") raise XendError(name + ": no transport") + def op_sslreceive(self, name, _): + if self.transport: + self.send_reply(["ready", name]) + p2cread, p2cwrite = os.pipe() + threading.Thread(target=connection.SSLSocketServerConnection.recv2fd, + args=(self.transport.sock, p2cwrite)).start() + try: + XendDomain.instance().domain_restore_fd(p2cread, + relocating=True) + except: + os.close(p2cread) + os.close(p2cwrite) + self.send_error() + self.close() + else: + log.error(name + ": no transport") + raise XendError(name + ": no transport") + def listenRelocation(): xoptions = XendOptions.instance() _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSC-0006UQ-18 for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSn-0005at-GZ; Tue, 13 May 2008 15:30:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSj-0005Xi-NV for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSc-0000JO-TG for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:43 +0000 X-SBRS: 3.6 X-MesageID: 204857 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204857" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:29:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFTtAx011564 for ; Tue, 13 May 2008 08:29:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUDwa011305 for ; Tue, 13 May 2008 08:30:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUDUn011304 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:13 -0700 Message-Id: <200805131530.m4DFUDUn011304@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Further minor ssl relo fixes. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210666823 -3600 # Node ID d5f24c99189bc891636fe98b005aa8d96242f63e # Parent f8ce6e3d86c76a39a2e5098c5cc1c5e5529091f9 Further minor ssl relo fixes. Signed-off-by: Zhigang Wang --- tools/python/xen/web/connection.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff -r f8ce6e3d86c7 -r d5f24c99189b tools/python/xen/web/connection.py --- a/tools/python/xen/web/connection.py Tue May 13 09:19:07 2008 +0100 +++ b/tools/python/xen/web/connection.py Tue May 13 09:20:23 2008 +0100 @@ -135,13 +135,15 @@ class SSLSocketServerConnection(SocketSe received data to one end of the pipe, then read from the other end: p2cread, p2cwrite = os.pipe() - threading.Thread(target=connection.recv2fd, args=(sock, p2cwrite)).start() + threading.Thread(target=connection.SSLSocketServerConnection.recv2fd, + args=(sock, p2cwrite)).start() os.read(p2cread, 1024) To use fd2send(): p2cread, p2cwrite = os.pipe() - threading.Thread(target=connection.fd2send, args=(sock, p2cread)).start() + threading.Thread(target=connection.SSLSocketServerConnection.fd2send, + args=(sock, p2cread)).start() os.write(p2cwrite, "data") """ @@ -232,6 +234,7 @@ class SSLSocketServerConnection(SocketSe pass recv2fd = staticmethod(recv2fd) + def fd2send(sock, fd): try: @@ -278,6 +281,7 @@ class SSLSocketServerConnection(SocketSe fd2send = staticmethod(fd2send) + def hostAllowed(addrport, hosts_allowed): if hosts_allowed is None: return True _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:17 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:17 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSH-0006UW-7D for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:17 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSs-0005et-Nd; Tue, 13 May 2008 15:30:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSn-0005Z0-MS for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSh-0000JN-Lv for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:47 +0000 X-SBRS: 3.6 X-MesageID: 204859 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204859" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:29:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFTwOn011570 for ; Tue, 13 May 2008 08:29:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUGxU011339 for ; Tue, 13 May 2008 08:30:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUGPY011338 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:16 -0700 Message-Id: <200805131530.m4DFUGPY011338@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: free fbfront resources on error/shutdown X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210668472 -3600 # Node ID 3ea09a104f5a51bff2aaefc78df396bf6be945af # Parent 2ab64478bd81d808b453e0f7d9f85b1515dc7acf minios: free fbfront resources on error/shutdown Signed-off-by: Samuel Thibault --- extras/mini-os/fbfront.c | 55 +++++++++++++++++++++++++++++++++++------------ 1 files changed, 41 insertions(+), 14 deletions(-) diff -r 2ab64478bd81 -r 3ea09a104f5a extras/mini-os/fbfront.c --- a/extras/mini-os/fbfront.c Tue May 13 09:21:28 2008 +0100 +++ b/extras/mini-os/fbfront.c Tue May 13 09:47:52 2008 +0100 @@ -49,6 +49,20 @@ void kbdfront_handler(evtchn_port_t port wake_up(&kbdfront_queue); } +static void free_kbdfront(struct kbdfront_dev *dev) +{ + mask_evtchn(dev->evtchn); + + free(dev->backend); + + free_page(dev->page); + + unbind_evtchn(dev->evtchn); + + free(dev->nodename); + free(dev); +} + struct kbdfront_dev *init_kbdfront(char *nodename, int abs_pointer) { xenbus_transaction_t xbt; @@ -122,7 +136,7 @@ again: abort_transaction: xenbus_transaction_end(xbt, 1, &retry); - return NULL; + goto error; done: @@ -130,7 +144,7 @@ done: msg = xenbus_read(XBT_NIL, path, &dev->backend); if (msg) { printk("Error %s when reading the backend path %s\n", msg, path); - return NULL; + goto error; } printk("backend at %s\n", dev->backend); @@ -153,6 +167,9 @@ done: printk("************************** KBDFRONT\n"); return dev; +error: + free_kbdfront(dev); + return NULL; } int kbdfront_receive(struct kbdfront_dev *dev, union xenkbd_in_event *buf, int n) @@ -208,12 +225,7 @@ void shutdown_kbdfront(struct kbdfront_d xenbus_unwatch_path(XBT_NIL, path); - unbind_evtchn(dev->evtchn); - - free_page(dev->page); - free(nodename); - free(dev->backend); - free(dev); + free_kbdfront(dev); } #ifdef HAVE_LIBC @@ -270,6 +282,20 @@ void fbfront_handler(evtchn_port_t port, files[fd].read = 1; #endif wake_up(&fbfront_queue); +} + +static void free_fbfront(struct fbfront_dev *dev) +{ + mask_evtchn(dev->evtchn); + + free(dev->backend); + + free_page(dev->page); + + unbind_evtchn(dev->evtchn); + + free(dev->nodename); + free(dev); } int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n) @@ -401,7 +427,7 @@ again: abort_transaction: xenbus_transaction_end(xbt, 1, &retry); - return NULL; + goto error; done: @@ -409,7 +435,7 @@ done: msg = xenbus_read(XBT_NIL, path, &dev->backend); if (msg) { printk("Error %s when reading the backend path %s\n", msg, path); - return NULL; + goto error; } printk("backend at %s\n", dev->backend); @@ -435,6 +461,10 @@ done: printk("************************** FBFRONT\n"); return dev; + +error: + free_fbfront(dev); + return NULL; } static void fbfront_out_event(struct fbfront_dev *dev, union xenfb_out_event *event) @@ -521,10 +551,7 @@ void shutdown_fbfront(struct fbfront_dev unbind_evtchn(dev->evtchn); - free_page(dev->page); - free(nodename); - free(dev->backend); - free(dev); + free_fbfront(dev); } #ifdef HAVE_LIBC _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:21 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:21 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSL-0006Ub-HH for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:21 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSx-0005iR-1p; Tue, 13 May 2008 15:30:59 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSo-0005aD-P3 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSi-0000JO-6O for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:48 +0000 X-SBRS: 3.6 X-MesageID: 204861 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204861" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:29:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFTxoR011573 for ; Tue, 13 May 2008 08:29:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUH6C011356 for ; Tue, 13 May 2008 08:30:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUHit011355 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:17 -0700 Message-Id: <200805131530.m4DFUHit011355@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] XM/XenAPI: Add blktap support when creating domains by xm through Xen API. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210668520 -3600 # Node ID 90022855084754ad7800478a71ce0d7310b2f0fb # Parent 3ea09a104f5a51bff2aaefc78df396bf6be945af XM/XenAPI: Add blktap support when creating domains by xm through Xen API. Signed-off-by: Yosuke Iwamatsu --- tools/python/xen/xm/xenapi_create.py | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 3ea09a104f5a -r 900228550847 tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Tue May 13 09:47:52 2008 +0100 +++ b/tools/python/xen/xm/xenapi_create.py Tue May 13 09:48:40 2008 +0100 @@ -509,7 +509,7 @@ class sxp2xml: if len(child) > 0 and child[0] == "device"] vbds_sxp = map(lambda x: x[1], [device for device in devices - if device[1][0] == "vbd"]) + if device[1][0] in ("vbd", "tap")]) vifs_sxp = map(lambda x: x[1], [device for device in devices if device[1][0] == "vif"]) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:26 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:26 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSQ-0006Uh-0q for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwT1-0005lu-GS; Tue, 13 May 2008 15:31:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSq-0005bZ-3i for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSe-0000JR-Px for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:50 +0000 X-SBRS: 3.6 X-MesageID: 204858 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204858" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:29:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFTuKZ011567 for ; Tue, 13 May 2008 08:29:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUEpu011322 for ; Tue, 13 May 2008 08:30:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUEeQ011321 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:14 -0700 Message-Id: <200805131530.m4DFUEeQ011321@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add missing MSI related part in public pciif.h X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210666888 -3600 # Node ID 2ab64478bd81d808b453e0f7d9f85b1515dc7acf # Parent d5f24c99189bc891636fe98b005aa8d96242f63e Add missing MSI related part in public pciif.h Signed-off-by: Shan Haitao --- xen/include/public/io/pciif.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+) diff -r d5f24c99189b -r 2ab64478bd81 xen/include/public/io/pciif.h --- a/xen/include/public/io/pciif.h Tue May 13 09:20:23 2008 +0100 +++ b/xen/include/public/io/pciif.h Tue May 13 09:21:28 2008 +0100 @@ -34,6 +34,10 @@ /* xen_pci_op commands */ #define XEN_PCI_OP_conf_read (0) #define XEN_PCI_OP_conf_write (1) +#define XEN_PCI_OP_enable_msi (2) +#define XEN_PCI_OP_disable_msi (3) +#define XEN_PCI_OP_enable_msix (4) +#define XEN_PCI_OP_disable_msix (5) /* xen_pci_op error numbers */ #define XEN_PCI_ERR_success (0) @@ -43,6 +47,12 @@ #define XEN_PCI_ERR_not_implemented (-4) /* XEN_PCI_ERR_op_failed - backend failed to complete the operation */ #define XEN_PCI_ERR_op_failed (-5) + +/* + * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry)) + * Should not exceed 128 + */ +#define SH_INFO_MAX_VEC 128 struct xen_pci_op { /* IN: what action to perform: XEN_PCI_OP_* */ @@ -62,6 +72,10 @@ struct xen_pci_op { /* IN/OUT: Contains the result after a READ or the value to WRITE */ uint32_t value; + /* IN: Contains extra infor for this operation */ + uint32_t info; + /*IN: param for msi-x */ + struct msix_entry msix_entries[SH_INFO_MAX_VEC]; }; struct xen_pci_sharedinfo { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:32 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:32 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSW-0006Ul-CA for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:32 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwT7-0005qZ-Pa; Tue, 13 May 2008 15:31:09 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSs-0005dm-TU for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSm-0000JN-4T for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:52 +0000 X-SBRS: 3.6 X-MesageID: 204862 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204862" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:01 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFU0VX011576 for ; Tue, 13 May 2008 08:30:00 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUIAd011373 for ; Tue, 13 May 2008 08:30:18 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUIIO011372 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:18 -0700 Message-Id: <200805131530.m4DFUIIO011372@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:17 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] XM/XenAPI: Add cdrom support when creating domains by xm through Xen API. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210668535 -3600 # Node ID 9da75b15001555824e9951d8f5b0c6a73302a1ae # Parent 90022855084754ad7800478a71ce0d7310b2f0fb XM/XenAPI: Add cdrom support when creating domains by xm through Xen API. Signed-off-by: Yosuke Iwamatsu --- tools/python/xen/xm/xenapi_create.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff -r 900228550847 -r 9da75b150015 tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Tue May 13 09:48:40 2008 +0100 +++ b/tools/python/xen/xm/xenapi_create.py Tue May 13 09:48:55 2008 +0100 @@ -31,6 +31,7 @@ import sys import sys import os import traceback +import re def log(_, msg): #print "> " + msg @@ -707,9 +708,11 @@ class sxp2xml: = get_child_by_name(vbd_sxp, "mode") != "w" \ and "RO" or "RW" vbd.attributes["device"] \ - = get_child_by_name(vbd_sxp, "dev") + = re.sub(":cdrom$", "", get_child_by_name(vbd_sxp, "dev")) vbd.attributes["bootable"] = "1" - vbd.attributes["type"] = "disk" + vbd.attributes["type"] \ + = re.search(":cdrom$", get_child_by_name(vbd_sxp, "dev")) \ + and "CD" or "disk" vbd.attributes["qos_algorithm_type"] = "" return vbd _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:38 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:38 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSb-0006Uo-KU for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:38 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTD-0005u1-11; Tue, 13 May 2008 15:31:15 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSu-0005eY-7j for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSn-0000JO-8N for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:54 +0000 X-SBRS: 3.6 X-MesageID: 204863 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204863" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:02 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFU2EA011579 for ; Tue, 13 May 2008 08:30:02 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUKa8011390 for ; Tue, 13 May 2008 08:30:20 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUJck011389 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:19 -0700 Message-Id: <200805131530.m4DFUJck011389@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:19 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add extra CPUID config examples to sample HVM config file. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210669098 -3600 # Node ID 22f589f09da549314761cfd2ce8207c438afc617 # Parent 9da75b15001555824e9951d8f5b0c6a73302a1ae Add extra CPUID config examples to sample HVM config file. From: Jean Guyader Signed-off-by: Keir Fraser --- tools/examples/xmexample.hvm | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 40 insertions(+), 3 deletions(-) diff -r 9da75b150015 -r 22f589f09da5 tools/examples/xmexample.hvm --- a/tools/examples/xmexample.hvm Tue May 13 09:48:55 2008 +0100 +++ b/tools/examples/xmexample.hvm Tue May 13 09:58:18 2008 +0100 @@ -223,17 +223,54 @@ serial='pty' #----------------------------------------------------------------------------- # Configure guest CPUID responses: -#cpuid=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx, +# +#cpuid=[ '1:ecx=xxxxxxxxxxx00xxxxxxxxxxxxxxxxxxx, # eax=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ] -# - Set the VMX feature flag in the guest (CPUID_1:ECX:5) +# - Unset the SSE4 features (CPUID.1[ECX][20-19]) # - Default behaviour for all other bits in ECX And EAX registers. # # Each successive character represent a lesser-significant bit: # '1' -> force the corresponding bit to 1 # '0' -> force to 0 -# 'x' -> we don't care (default behaviour) +# 'x' -> Get a safe value (pass through and mask with the default policy) # 'k' -> pass through the host bit value # 's' -> as 'k' but preserve across save/restore and migration +# +# Expose to the guest multi-core cpu instead of multiple processors +# Example for intel, expose a 8-core processor : +#cpuid=['1:edx=xxx1xxxxxxxxxxxxxxxxxxxxxxxxxxxx, +# ebx=xxxxxxxx00010000xxxxxxxxxxxxxxxx', +# '4,0:eax=001111xxxxxxxxxxxxxxxxxxxxxxxxxx'] +# - CPUID.1[EDX][HT] : Enable HT +# - CPUID.1[EBX] : Number of vcpus * 2 +# - CPUID.4,0[EAX] : Number of vcpus * 2 - 1 +#vcpus=8 +# +# Example for amd, expose a 5-core processor : +# cpuid = ['1:ebx=xxxxxxxx00000001xxxxxxxxxxxxxxxx, +# edx=xxx1xxxxxxxxxxxxxxxxxxxxxxxxxxxx', +# '0x80000008:ecx=xxxxxxxxxxxxxxxx0000xxxx00001010'] +# - CPUID.1[EBX] : (Thread * Cores ) per processors +# - CPUID.1[EDX][HT] : Enable HT +# - CPUID.0x80000008[ECX] : Number of vcpus * 2 +#vcpus=5 +# +# Downgrade the cpuid to make a better compatibility for migration : +# Look like a PIII : +# cpuid = [ '0:eax=0x3', +# '1:eax=0x06b1, +# ecx=xxxxxxxxxx0000xx00xxx0000000xx0, +# edx=xx00000xxxxxxx0xxxxxxxxx0xxxxxx', +# '4:eax=0x3,ebx=0x756e6547,ecx=0x6c65746e,edx=0x49656e69', +# '0x80000000:eax=0x3,ebx=0x756e6547,ecx=0x6c65746e,edx=0x49656e69'] +# with the highest leaf +# - CPUID.0[EAX] : Set the highest leaf +# - CPUID.1[EAX] : Pentium III +# - CPUID.1[ECX] : Mask some features +# - CPUID.1[EDX] : Mask some features +# - CPUID.4 : Reply like the highest leaf, in our case CPUID.3 +# - CPUID.0x80000000 : No extension we are on a Pentium III, reply like the +# highest leaf (CPUID.3). # # Configure host CPUID consistency checks, which must be satisfied for this # VM to be allowed to run on this host's processor type: _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:42 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:42 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSg-0006Uz-Fa for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:42 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTH-0005xP-Ql; Tue, 13 May 2008 15:31:19 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSw-0005g1-0C for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSo-0000JR-IT for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:55 +0000 X-SBRS: 3.6 X-MesageID: 204864 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204864" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:04 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFU3eO011582 for ; Tue, 13 May 2008 08:30:03 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFULTq011409 for ; Tue, 13 May 2008 08:30:21 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFULL6011408 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:21 -0700 Message-Id: <200805131530.m4DFULL6011408@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:20 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Avoid deep recusrsion when destroying a domain and reaping pagetables. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210670214 -3600 # Node ID 7211d37de25b6073f0346bc8ff3f66e735952859 # Parent 22f589f09da549314761cfd2ce8207c438afc617 x86: Avoid deep recusrsion when destroying a domain and reaping pagetables. From: Jan Beulich Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 26 ++++++++++++++++++++++++++ xen/arch/x86/mm.c | 10 ++++++++++ xen/include/asm-x86/config.h | 8 ++++++++ 3 files changed, 44 insertions(+) diff -r 22f589f09da5 -r 7211d37de25b xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Tue May 13 09:58:18 2008 +0100 +++ b/xen/arch/x86/domain.c Tue May 13 10:16:54 2008 +0100 @@ -1725,6 +1725,27 @@ static int relinquish_memory( if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) put_page(page); +#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION + /* + * Forcibly drop reference counts of page tables above top most (which + * were skipped to prevent long latencies due to deep recursion - see + * the special treatment in free_lX_table()). + */ + y = page->u.inuse.type_info; + if ( (type < PGT_root_page_table) && + unlikely(((y + PGT_type_mask) & + (PGT_type_mask|PGT_validated)) == type) ) + { + BUG_ON((y & PGT_count_mask) >= + (page->count_info & PGC_count_mask)); + while ( y & PGT_count_mask ) + { + put_page_and_type(page); + y = page->u.inuse.type_info; + } + } +#endif + /* * Forcibly invalidate top-most, still valid page tables at this point * to break circular 'linear page table' references. This is okay @@ -1896,6 +1917,11 @@ int domain_relinquish_resources(struct d /* fallthrough */ case RELMEM_done: +#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION + ret = relinquish_memory(d, &d->page_list, PGT_l1_page_table); + if ( ret ) + return ret; +#endif break; default: diff -r 22f589f09da5 -r 7211d37de25b xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Tue May 13 09:58:18 2008 +0100 +++ b/xen/arch/x86/mm.c Tue May 13 10:16:54 2008 +0100 @@ -1320,6 +1320,11 @@ static void free_l3_table(struct page_in l3_pgentry_t *pl3e; int i; +#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION + if ( d->arch.relmem == RELMEM_dom_l3 ) + return; +#endif + pl3e = map_domain_page(pfn); for ( i = 0; i < L3_PAGETABLE_ENTRIES; i++ ) @@ -1342,6 +1347,11 @@ static void free_l4_table(struct page_in unsigned long pfn = page_to_mfn(page); l4_pgentry_t *pl4e = page_to_virt(page); int i; + +#ifdef DOMAIN_DESTRUCT_AVOID_RECURSION + if ( d->arch.relmem == RELMEM_dom_l4 ) + return; +#endif for ( i = 0; i < L4_PAGETABLE_ENTRIES; i++ ) if ( is_guest_l4_slot(d, i) ) diff -r 22f589f09da5 -r 7211d37de25b xen/include/asm-x86/config.h --- a/xen/include/asm-x86/config.h Tue May 13 09:58:18 2008 +0100 +++ b/xen/include/asm-x86/config.h Tue May 13 10:16:54 2008 +0100 @@ -40,6 +40,14 @@ #define CONFIG_HOTPLUG 1 #define CONFIG_HOTPLUG_CPU 1 + +/* + * Avoid deep recursion when tearing down pagetables during domain destruction, + * causing dom0 to become unresponsive and Xen to miss time-critical softirq + * deadlines. This will ultimately be replaced by built-in preemptibility of + * get_page_type(). + */ +#define DOMAIN_DESTRUCT_AVOID_RECURSION 1 #define HZ 100 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:47 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:47 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSk-0006VA-SQ for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:47 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTM-000617-D9; Tue, 13 May 2008 15:31:24 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSx-0005ha-TD for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:59 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSr-0000JN-C2 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:57 +0000 X-SBRS: 3.6 X-MesageID: 204865 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204865" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:05 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFU5xr011585 for ; Tue, 13 May 2008 08:30:05 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUNRp011426 for ; Tue, 13 May 2008 08:30:23 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUNld011425 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:23 -0700 Message-Id: <200805131530.m4DFUNld011425@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:22 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix guest boot if set empty cdrom in config file X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210670394 -3600 # Node ID 5d9430d492e3577d4c45909bef58710ad6a513b5 # Parent 7211d37de25b6073f0346bc8ff3f66e735952859 Fix guest boot if set empty cdrom in config file This is because function "uname = config.get('uname', '')" returns '', rather than None, if uname is not in config variable. Signed-off-by: Xu Dongxiao --- tools/python/xen/xend/server/blkif.py | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 7211d37de25b -r 5d9430d492e3 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Tue May 13 10:16:54 2008 +0100 +++ b/tools/python/xen/xend/server/blkif.py Tue May 13 10:19:54 2008 +0100 @@ -47,7 +47,7 @@ class BlkifController(DevController): except ValueError: dev_type = "disk" - if uname is None: + if uname == '': if dev_type == 'cdrom': (typ, params) = ("", "") else: _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:52 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:52 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSp-0006VD-PX for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:52 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTR-00064s-A8; Tue, 13 May 2008 15:31:29 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwSz-0005jL-VM for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:02 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSs-0000JO-M9 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:30:59 +0000 X-SBRS: 3.6 X-MesageID: 204866 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204866" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:08 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFU7AH011588 for ; Tue, 13 May 2008 08:30:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUQCo011462 for ; Tue, 13 May 2008 08:30:26 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUPLF011461 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:25 -0700 Message-Id: <200805131530.m4DFUPLF011461@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:24 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Intel vmx: To correctly detect default1 vmx features which may X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210671649 -3600 # Node ID 1b7042d60351dd876e501f47e8ffcc270986cbdc # Parent 5d9430d492e3577d4c45909bef58710ad6a513b5 Intel vmx: To correctly detect default1 vmx features which may actually be switched to 0, we must check VMX_BASIC_MSR[55] and possibly check a set of 'true' feature MSRs. Signed-off-by: Jun Nakajima Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/vmx/vmcs.c | 32 +++++++++++++++++++------------- xen/include/asm-x86/msr-index.h | 4 ++++ 2 files changed, 23 insertions(+), 13 deletions(-) diff -r 5d9430d492e3 -r 1b7042d60351 xen/arch/x86/hvm/vmx/vmcs.c --- a/xen/arch/x86/hvm/vmx/vmcs.c Tue May 13 10:19:54 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vmcs.c Tue May 13 10:40:49 2008 +0100 @@ -72,12 +72,14 @@ static u32 adjust_vmx_controls(u32 ctl_m static void vmx_init_vmcs_config(void) { - u32 vmx_msr_low, vmx_msr_high, min, opt; + u32 vmx_basic_msr_low, vmx_basic_msr_high, min, opt; u32 _vmx_pin_based_exec_control; u32 _vmx_cpu_based_exec_control; u32 _vmx_secondary_exec_control = 0; u32 _vmx_vmexit_control; u32 _vmx_vmentry_control; + + rdmsr(MSR_IA32_VMX_BASIC, vmx_basic_msr_low, vmx_basic_msr_high); min = (PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING); @@ -122,9 +124,14 @@ static void vmx_init_vmcs_config(void) if ( _vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT ) { - /* To use EPT we expect to be able to clear certain intercepts. */ - uint32_t must_be_one, must_be_zero; - rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, must_be_one, must_be_zero); + /* + * To use EPT we expect to be able to clear certain intercepts. + * We check VMX_BASIC_MSR[55] to correctly handle default1 controls. + */ + uint32_t must_be_one, must_be_zero, msr = MSR_IA32_VMX_PROCBASED_CTLS; + if ( vmx_basic_msr_high & (1u << 23) ) + msr = MSR_IA32_VMX_TRUE_PROCBASED_CTLS; + rdmsr(msr, must_be_one, must_be_zero); if ( must_be_one & (CPU_BASED_INVLPG_EXITING | CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING) ) @@ -150,41 +157,40 @@ static void vmx_init_vmcs_config(void) _vmx_vmentry_control = adjust_vmx_controls( min, opt, MSR_IA32_VMX_ENTRY_CTLS); - rdmsr(MSR_IA32_VMX_BASIC, vmx_msr_low, vmx_msr_high); - if ( !vmx_pin_based_exec_control ) { /* First time through. */ - vmcs_revision_id = vmx_msr_low; + vmcs_revision_id = vmx_basic_msr_low; vmx_pin_based_exec_control = _vmx_pin_based_exec_control; vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control; vmx_secondary_exec_control = _vmx_secondary_exec_control; vmx_vmexit_control = _vmx_vmexit_control; vmx_vmentry_control = _vmx_vmentry_control; - cpu_has_vmx_ins_outs_instr_info = !!(vmx_msr_high & (1U<<22)); + cpu_has_vmx_ins_outs_instr_info = !!(vmx_basic_msr_high & (1U<<22)); } else { /* Globals are already initialised: re-check them. */ - BUG_ON(vmcs_revision_id != vmx_msr_low); + BUG_ON(vmcs_revision_id != vmx_basic_msr_low); BUG_ON(vmx_pin_based_exec_control != _vmx_pin_based_exec_control); BUG_ON(vmx_cpu_based_exec_control != _vmx_cpu_based_exec_control); BUG_ON(vmx_secondary_exec_control != _vmx_secondary_exec_control); BUG_ON(vmx_vmexit_control != _vmx_vmexit_control); BUG_ON(vmx_vmentry_control != _vmx_vmentry_control); - BUG_ON(cpu_has_vmx_ins_outs_instr_info != !!(vmx_msr_high & (1U<<22))); + BUG_ON(cpu_has_vmx_ins_outs_instr_info != + !!(vmx_basic_msr_high & (1U<<22))); } /* IA-32 SDM Vol 3B: VMCS size is never greater than 4kB. */ - BUG_ON((vmx_msr_high & 0x1fff) > PAGE_SIZE); + BUG_ON((vmx_basic_msr_high & 0x1fff) > PAGE_SIZE); #ifdef __x86_64__ /* IA-32 SDM Vol 3B: 64-bit CPUs always have VMX_BASIC_MSR[48]==0. */ - BUG_ON(vmx_msr_high & (1u<<16)); + BUG_ON(vmx_basic_msr_high & (1u<<16)); #endif /* Require Write-Back (WB) memory type for VMCS accesses. */ - BUG_ON(((vmx_msr_high >> 18) & 15) != 6); + BUG_ON(((vmx_basic_msr_high >> 18) & 15) != 6); } static struct vmcs_struct *vmx_alloc_vmcs(void) diff -r 5d9430d492e3 -r 1b7042d60351 xen/include/asm-x86/msr-index.h --- a/xen/include/asm-x86/msr-index.h Tue May 13 10:19:54 2008 +0100 +++ b/xen/include/asm-x86/msr-index.h Tue May 13 10:40:49 2008 +0100 @@ -135,6 +135,10 @@ #define MSR_IA32_VMX_CR4_FIXED0 0x488 #define MSR_IA32_VMX_CR4_FIXED1 0x489 #define MSR_IA32_VMX_PROCBASED_CTLS2 0x48b +#define MSR_IA32_VMX_TRUE_PINBASED_CTLS 0x48d +#define MSR_IA32_VMX_TRUE_PROCBASED_CTLS 0x48e +#define MSR_IA32_VMX_TRUE_EXIT_CTLS 0x48f +#define MSR_IA32_VMX_TRUE_ENTRY_CTLS 0x490 #define IA32_FEATURE_CONTROL_MSR 0x3a #define IA32_FEATURE_CONTROL_MSR_LOCK 0x0001 #define IA32_FEATURE_CONTROL_MSR_ENABLE_VMXON_INSIDE_SMX 0x0002 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:30:56 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:30:56 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwSu-0006VH-Bz for www-data@colo.xensource.com; Tue, 13 May 2008 08:30:56 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTV-00068D-Lb; Tue, 13 May 2008 15:31:33 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwT0-0005jv-MG for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:02 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSu-0000JR-EG for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:00 +0000 X-SBRS: 3.6 X-MesageID: 204867 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204867" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:11 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUAgM011591 for ; Tue, 13 May 2008 08:30:10 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUS9N011486 for ; Tue, 13 May 2008 08:30:28 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUSvr011485 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:28 -0700 Message-Id: <200805131530.m4DFUSvr011485@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:26 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Xend: Fix blkif type check for tap devices. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210679004 -3600 # Node ID 5e1a0dc74a3560376f45e54827fa0eb0f6747bfa # Parent 1b7042d60351dd876e501f47e8ffcc270986cbdc Xend: Fix blkif type check for tap devices. Signed-off-by: Yosuke Iwamatsu --- tools/python/xen/xend/server/blkif.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r 1b7042d60351 -r 5e1a0dc74a35 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Tue May 13 10:40:49 2008 +0100 +++ b/tools/python/xen/xend/server/blkif.py Tue May 13 12:43:24 2008 +0100 @@ -56,9 +56,10 @@ class BlkifController(DevController): else: try: (typ, params) = string.split(uname, ':', 1) - if typ not in ('phy', 'file'): + if typ not in ('phy', 'file', 'tap'): raise VmError( - 'Block device must have "phy" or "file" specified to type') + 'Block device must have "phy", "file" or "tap" ' + 'specified to type') except ValueError: raise VmError( 'Block device must have physical details specified') _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:02 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:02 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwT0-0006VK-9l for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:02 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTb-0006Ci-Op; Tue, 13 May 2008 15:31:39 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwT2-0005le-M7 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:04 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSw-0000JN-BW for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:02 +0000 X-SBRS: 3.6 X-MesageID: 204868 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204868" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:12 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUBOx011594 for ; Tue, 13 May 2008 08:30:12 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUUog011503 for ; Tue, 13 May 2008 08:30:30 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUTbB011502 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:29 -0700 Message-Id: <200805131530.m4DFUTbB011502@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:29 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [Xend/security] Refactor the code that recalculates the label during a policy update X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210679205 -3600 # Node ID 65eec0554f39049eab354abe1ee4c305f6d1e0aa # Parent 5e1a0dc74a3560376f45e54827fa0eb0f6747bfa [Xend/security] Refactor the code that recalculates the label during a policy update Signed-off-by: Stefan Berger --- tools/python/xen/util/xsm/acm/acm.py | 97 +++++++++++++++++++++++++++-------- 1 files changed, 75 insertions(+), 22 deletions(-) diff -r 5e1a0dc74a35 -r 65eec0554f39 tools/python/xen/util/xsm/acm/acm.py --- a/tools/python/xen/util/xsm/acm/acm.py Tue May 13 12:43:24 2008 +0100 +++ b/tools/python/xen/util/xsm/acm/acm.py Tue May 13 12:46:45 2008 +0100 @@ -1363,6 +1363,45 @@ def relabel_domains(relabel_list): return rc, errors +def __update_label_policy_change(sec_lab, + cur_poltype, + cur_polname, + new_poltype, + new_polname, + polnew_labels, + label_map): + """ + Determine a new resource label given the new policy's type + and name and the new policy's (resource/VM) labels and the + (resource/VM) label map that indicates renaming rules for + labels. + """ + is_deleted = False + policytype, policy, label = sec_lab + + if cur_poltype != policytype or \ + cur_polname != policy: + return sec_lab, is_deleted + + if policytype != xsconstants.ACM_POLICY_ID: + return sec_lab, is_deleted + elif label_map.has_key(label) and policy == cur_polname: + # renaming of an active label; policy may have been renamed + label = label_map[label] + polname = new_polname + elif label not in polnew_labels: + # label been removed + policytype = xsconstants.INVALID_POLICY_PREFIX + policytype + polname = policy + is_deleted = True + else: + # no change to label + policytype = xsconstants.ACM_POLICY_ID + polname = new_polname + + return tuple( [ policytype, polname, label ] ), is_deleted + + def change_acm_policy(bin_pol, del_array, chg_array, vmlabel_map, reslabel_map, cur_acmpol, new_acmpol, is_reset): @@ -1430,30 +1469,21 @@ def change_acm_policy(bin_pol, del_array else: return -xsconstants.XSERR_BAD_LABEL_FORMAT, "" - if policytype != cur_policytype or \ - policy != cur_policyname: - continue - - # label been renamed or deleted? - if policytype != xsconstants.ACM_POLICY_ID: - continue - elif reslabel_map.has_key(label) and cur_policyname == policy: - # renaming of an active label; policy may have been renamed - label = reslabel_map[label] - polname = new_policyname - elif label not in polnew_reslabels: - # label been removed - policytype = xsconstants.INVALID_POLICY_PREFIX + policytype + new_sec_lab, is_deleted = \ + __update_label_policy_change( tuple([policytype, + policy, + label]), + cur_policytype, + cur_policyname, + new_policytype, + new_policyname, + polnew_reslabels, + reslabel_map) + + if is_deleted: label_changes.append(key) - polname = policy - else: - # no change to label - policytype = xsconstants.ACM_POLICY_ID - polname = new_policyname - # Update entry - access_control[key] = \ - tuple([ policytype, polname, label ]) + access_control[key] = new_sec_lab # All resources have new labels in the access_control map # There may still be labels in there that are invalid now. @@ -1509,6 +1539,29 @@ def change_acm_policy(bin_pol, del_array new_acmpol.policy_get_virtualmachinelabel_names()) if not compatible: return (-xsconstants.XSERR_RESOURCE_ACCESS, "") + + for dominfo in dominfos: + # relabel the VIF interfaces + changed = False + for vif_uuid in dominfo.get_vifs(): + sec_lab = dominfo.info['devices'][vif_uuid][1]\ + .get('security_label') + if sec_lab: + result, _ = \ + __update_label_policy_change(tuple(sec_lab.split(':')), + cur_policytype, + cur_policyname, + new_policytype, + new_policyname, + polnew_reslabels, + reslabel_map) + new_sec_lab = ':'.join(list(result)) + if new_sec_lab != sec_lab: + changed = True + dominfo.info['devices'][vif_uuid][1]\ + ['security_label'] = new_sec_lab + if changed: + XendDomain.instance().managed_config_save(dominfo) rc, errors = hv_chg_policy(bin_pol, del_array, chg_array) if rc == 0: _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwT4-0006Vt-Nh for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTg-0006G3-3h; Tue, 13 May 2008 15:31:44 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwT6-0005oH-6B for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:08 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSy-0000JO-Dq for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:06 +0000 X-SBRS: 3.6 X-MesageID: 204869 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204869" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:13 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUCAQ011597 for ; Tue, 13 May 2008 08:30:12 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUVFB011538 for ; Tue, 13 May 2008 08:30:31 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUVbK011537 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:31 -0700 Message-Id: <200805131530.m4DFUVbK011537@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:30 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: Fix PVFB backend to validate frontend's frame buffer description X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210687697 -3600 # Node ID 53195719f7621110dab7a97a2bca292b73baa715 # Parent 65eec0554f39049eab354abe1ee4c305f6d1e0aa ioemu: Fix PVFB backend to validate frontend's frame buffer description A buggy or malicious frontend can describe its shared framebuffer to the backend in a way that makes the backend map an arbitrary amount of guest memory, malloc an arbitrarily large internal buffer, copy arbitrary memory to that buffer, even beyond its end. A domU running a malicious frontend can abuse the former two for denial of service attacks against dom0. It can abuse the third to write arbitrary backend memory. It can abuse all three to terminate or crash the backend. Arbitrary code execution looks quite feasible. In more detail (ignoring #ifdef CONFIG_STUBDOM code): The frame buffer is described by the following parameters: * fb_len (size of shared framebuffer) * width, height, depth * row_stride, offset fb_len is fixed on startup. The frontend can modify the other parameters by sending a XENFB_TYPE_RESIZE event. xenfb_read_frontend_fb_config() limits fb_len according to backend configuration parameter videoram (from xenstore), if present. I believe videoram is not present by default. xenfb_map_fb() uses fb_len to map the frontend's framebuffer. The frontend can make it map arbitrarily much, unless limited by the videoram configuration parameter. This flaw always existed. xenfb_register_console() and xenfb_on_fb_event() pass width, height, depth and rowstride to QEMU's DisplayState object. The object sets itself up to work directly on the framebuffer (shared_buf true) if parameters allow that. Else it allocates an internal buffer of size height * width * depth / 8 (shared_buf false). The frontend can make it allocate arbitrarily much. This flaw always existed. xenfb_register_console() and xenfb_on_fb_event() pass width, height, depth and rowstride to QEMU's DisplayState object. The object sets itself up to work directly on the framebuffer (shared_buf true) if parameters allow that. Else it allocates an internal buffer of size height * width * depth / 8 (shared_buf false). The frontend can make it allocate arbitrarily much. This flaw was introduced by the move of PVFB into QEMU (xen-unstable cset 16220 ff). xenfb_on_fb_event() uses width and height to clip the area of an update event. It then passes that area to xenfb_guest_copy(). xenfb_invalidate() passes the complete screen area to xenfb_guest_copy(). xenfb_guest_copy() copies the argument area (x, y, w, h) into the internal buffer, unless shared_buf is true. This copies h blocks of memory. The i-th copy (counting from zero) copies w * depth / 8 bytes from shared framebuffer + offset + (y + i) * row_stride + x * depth / 8 to internal buffer + (y + i) * ds->linesize + x * ds->depth / 8 where ds->linesize and ds->depth are parameters of the internal buffer chosen by the backend. This copy can be made to read from the shared framebuffer and write to the internal buffer out of bounds. I believe the frontend can abuse this to write arbitrary backend memory. The flaw in its current form was introduced by the move of PVFB into QEMU (xen-unstable cset 16220 ff). Before, the framebuffer was always shared. From: Markus Armbruster Signed-off-by: Keir Fraser --- tools/ioemu/hw/xenfb.c | 107 ++++++++++++++++++++++++++++++++++++------------- 1 files changed, 79 insertions(+), 28 deletions(-) diff -r 65eec0554f39 -r 53195719f762 tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Tue May 13 12:46:45 2008 +0100 +++ b/tools/ioemu/hw/xenfb.c Tue May 13 15:08:17 2008 +0100 @@ -28,8 +28,6 @@ #ifndef BTN_LEFT #define BTN_LEFT 0x110 /* from */ #endif - -// FIXME defend against malicious frontend? struct xenfb; @@ -484,6 +482,68 @@ void xenfb_shutdown(struct xenfb *xenfb) free(xenfb); } +static int xenfb_configure_fb(struct xenfb *xenfb, size_t fb_len_lim, + int width, int height, int depth, + size_t fb_len, int offset, int row_stride) +{ + size_t mfn_sz = sizeof(*((struct xenfb_page *)0)->pd); + size_t pd_len = sizeof(((struct xenfb_page *)0)->pd) / mfn_sz; + size_t fb_pages = pd_len * XC_PAGE_SIZE / mfn_sz; + size_t fb_len_max = fb_pages * XC_PAGE_SIZE; + int max_width, max_height; + + if (fb_len_lim > fb_len_max) { + fprintf(stderr, + "FB: fb size limit %zu exceeds %zu, corrected\n", + fb_len_lim, fb_len_max); + fb_len_lim = fb_len_max; + } + if (fb_len > fb_len_lim) { + fprintf(stderr, + "FB: frontend fb size %zu limited to %zu\n", + fb_len, fb_len_lim); + } + if (depth != 8 && depth != 16 && depth != 24 && depth != 32) { + fprintf(stderr, + "FB: can't handle frontend fb depth %d\n", + depth); + return -1; + } + if (row_stride < 0 || row_stride > fb_len) { + fprintf(stderr, + "FB: invalid frontend stride %d\n", row_stride); + return -1; + } + max_width = row_stride / (depth / 8); + if (width < 0 || width > max_width) { + fprintf(stderr, + "FB: invalid frontend width %d limited to %d\n", + width, max_width); + width = max_width; + } + if (offset < 0 || offset >= fb_len) { + fprintf(stderr, + "FB: invalid frontend offset %d (max %zu)\n", + offset, fb_len - 1); + return -1; + } + max_height = (fb_len - offset) / row_stride; + if (height < 0 || height > max_height) { + fprintf(stderr, + "FB: invalid frontend height %d limited to %d\n", + height, max_height); + height = max_height; + } + xenfb->fb_len = fb_len; + xenfb->row_stride = row_stride; + xenfb->depth = depth; + xenfb->width = width; + xenfb->height = height; + xenfb->offset = offset; + fprintf(stderr, "Framebuffer %dx%dx%d offset %d stride %d\n", + width, height, depth, offset, row_stride); + return 0; +} static void xenfb_on_fb_event(struct xenfb *xenfb) { @@ -514,16 +574,18 @@ static void xenfb_on_fb_event(struct xen || h != event->update.height) { fprintf(stderr, "%s bogus update clipped\n", xenfb->fb.nodename); - break; } xenfb_guest_copy(xenfb, x, y, w, h); break; case XENFB_TYPE_RESIZE: - xenfb->width = event->resize.width; - xenfb->height = event->resize.height; - xenfb->depth = event->resize.depth; - xenfb->row_stride = event->resize.stride; - xenfb->offset = event->resize.offset; + if (xenfb_configure_fb(xenfb, xenfb->fb_len, + event->resize.width, + event->resize.height, + event->resize.depth, + xenfb->fb_len, + event->resize.offset, + event->resize.stride) < 0) + break; dpy_colourdepth(xenfb->ds, xenfb->depth); dpy_resize(xenfb->ds, xenfb->width, xenfb->height, xenfb->row_stride); if (xenfb->ds->shared_buf) @@ -745,29 +807,18 @@ static int xenfb_read_frontend_fb_config xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "request-update", "1"); xenfb->refresh_period = -1; - /* TODO check for permitted ranges */ - fb_page = xenfb->fb.page; - xenfb->depth = fb_page->depth; - xenfb->width = fb_page->width; - xenfb->height = fb_page->height; - /* TODO check for consistency with the above */ - xenfb->fb_len = fb_page->mem_length; - xenfb->row_stride = fb_page->line_length; - - /* Protect against hostile frontend, limit fb_len to max allowed */ if (xenfb_xs_scanf1(xenfb->xsh, xenfb->fb.nodename, "videoram", "%d", &videoram) < 0) videoram = 0; - videoram = videoram * 1024 * 1024; - if (videoram && xenfb->fb_len > videoram) { - fprintf(stderr, "Framebuffer requested length of %zd exceeded allowed %d\n", - xenfb->fb_len, videoram); - xenfb->fb_len = videoram; - if (xenfb->row_stride * xenfb->height > xenfb->fb_len) - xenfb->height = xenfb->fb_len / xenfb->row_stride; - } - fprintf(stderr, "Framebuffer depth %d width %d height %d line %d\n", - fb_page->depth, fb_page->width, fb_page->height, fb_page->line_length); + fb_page = xenfb->fb.page; + if (xenfb_configure_fb(xenfb, videoram * 1024 * 1024U, + fb_page->width, fb_page->height, fb_page->depth, + fb_page->mem_length, 0, fb_page->line_length) + < 0) { + errno = EINVAL; + return -1; + } + if (xenfb_map_fb(xenfb, xenfb->fb.otherend_id) < 0) return -1; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTA-0006Vz-2u for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTl-0006JV-Cd; Tue, 13 May 2008 15:31:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwT7-0005pQ-T0 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:09 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwSz-0000JR-4Z for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:06 +0000 X-SBRS: 3.6 X-MesageID: 204870 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204870" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:15 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUFHF011600 for ; Tue, 13 May 2008 08:30:15 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUXh9011605 for ; Tue, 13 May 2008 08:30:33 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUWfa011604 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:32 -0700 Message-Id: <200805131530.m4DFUWfa011604@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:31 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Sync with Xen pciif.h public header. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210666930 -3600 # Node ID cf3f9f1c7edb92c08291c71c142f28a049c2766e # Parent 05b7df5cc607bf5b00725232085c35e5b6d493fe Sync with Xen pciif.h public header. Signed-off-by: Shan Haitao --- include/xen/interface/io/pciif.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+) diff -r 05b7df5cc607 -r cf3f9f1c7edb include/xen/interface/io/pciif.h --- a/include/xen/interface/io/pciif.h Mon May 12 10:05:27 2008 +0100 +++ b/include/xen/interface/io/pciif.h Tue May 13 09:22:10 2008 +0100 @@ -34,6 +34,10 @@ /* xen_pci_op commands */ #define XEN_PCI_OP_conf_read (0) #define XEN_PCI_OP_conf_write (1) +#define XEN_PCI_OP_enable_msi (2) +#define XEN_PCI_OP_disable_msi (3) +#define XEN_PCI_OP_enable_msix (4) +#define XEN_PCI_OP_disable_msix (5) /* xen_pci_op error numbers */ #define XEN_PCI_ERR_success (0) @@ -43,6 +47,12 @@ #define XEN_PCI_ERR_not_implemented (-4) /* XEN_PCI_ERR_op_failed - backend failed to complete the operation */ #define XEN_PCI_ERR_op_failed (-5) + +/* + * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry)) + * Should not exceed 128 + */ +#define SH_INFO_MAX_VEC 128 struct xen_pci_op { /* IN: what action to perform: XEN_PCI_OP_* */ @@ -62,6 +72,10 @@ struct xen_pci_op { /* IN/OUT: Contains the result after a READ or the value to WRITE */ uint32_t value; + /* IN: Contains extra infor for this operation */ + uint32_t info; + /*IN: param for msi-x */ + struct msix_entry msix_entries[SH_INFO_MAX_VEC]; }; struct xen_pci_sharedinfo { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTG-0006W3-SY for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTs-0006Nh-BB; Tue, 13 May 2008 15:31:56 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwT8-0005pe-8n for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:10 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwT1-0000JN-4J for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:08 +0000 X-SBRS: 3.6 X-MesageID: 204871 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204871" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:17 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUHLx011603 for ; Tue, 13 May 2008 08:30:17 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUZZ0011622 for ; Tue, 13 May 2008 08:30:35 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUYBG011621 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:34 -0700 Message-Id: <200805131530.m4DFUYBG011621@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:33 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] xen: Cleanup of MSI code X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210667520 -3600 # Node ID 29b8c3f366031a6f047777da6be0bed9b307ad5a # Parent cf3f9f1c7edb92c08291c71c142f28a049c2766e xen: Cleanup of MSI code A few cleanups of the MSI code. There were a couple of race conditions in the use of msi_dev_head which this patch fixes. Use list_empty rather than list_empty_careful since pirq_list_head is only ever accessed under pirq_list_lock. I removed some unused variables. Signed-off-by: Neil Turton --- drivers/pci/msi-xen.c | 22 ++++++++-------------- drivers/xen/pciback/conf_space_capability_msi.c | 5 +---- 2 files changed, 9 insertions(+), 18 deletions(-) diff -r cf3f9f1c7edb -r 29b8c3f36603 drivers/pci/msi-xen.c --- a/drivers/pci/msi-xen.c Tue May 13 09:22:10 2008 +0100 +++ b/drivers/pci/msi-xen.c Tue May 13 09:32:00 2008 +0100 @@ -32,7 +32,7 @@ int msi_register(struct msi_ops *ops) return 0; } -static struct list_head msi_dev_head; +static LIST_HEAD(msi_dev_head); static int msi_dev_head_inited = 0; DEFINE_SPINLOCK(msi_dev_lock); @@ -54,11 +54,6 @@ static struct msi_dev_list *get_msi_dev_ struct msi_dev_list *msi_dev_list, *ret = NULL; unsigned long flags; - if (!msi_dev_head_inited) { - INIT_LIST_HEAD(&msi_dev_head); - msi_dev_head_inited = 1; - } - spin_lock_irqsave(&msi_dev_lock, flags); list_for_each_entry(msi_dev_list, &msi_dev_head, list) @@ -79,10 +74,10 @@ static struct msi_dev_list *get_msi_dev_ return NULL; } + spin_lock_init(&ret->pirq_list_lock); + INIT_LIST_HEAD(&ret->pirq_list_head); list_add_tail(&ret->list, &msi_dev_head); spin_unlock_irqrestore(&msi_dev_lock, flags); - spin_lock_init(&ret->pirq_list_lock); - INIT_LIST_HEAD(&ret->pirq_list_head); return ret; } @@ -304,10 +299,9 @@ int pci_save_msix_state(struct pci_dev * msi_dev_entry = get_msi_dev_pirq_list(dev); spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) - list_for_each_entry_safe(pirq_entry, tmp, - &msi_dev_entry->pirq_list_head, list) - msi_unmap_pirq(dev, pirq_entry->pirq); + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) + msi_unmap_pirq(dev, pirq_entry->pirq); spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); @@ -394,7 +388,7 @@ static int msix_capability_init(struct p return -ENOMEM; spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + if (!list_empty(&msi_dev_entry->pirq_list_head)) { printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), @@ -677,7 +671,7 @@ void msi_remove_pci_irq_vectors(struct p msi_dev_entry = get_msi_dev_pirq_list(dev); spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + if (!list_empty(&msi_dev_entry->pirq_list_head)) { printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), diff -r cf3f9f1c7edb -r 29b8c3f36603 drivers/xen/pciback/conf_space_capability_msi.c --- a/drivers/xen/pciback/conf_space_capability_msi.c Tue May 13 09:22:10 2008 +0100 +++ b/drivers/xen/pciback/conf_space_capability_msi.c Tue May 13 09:32:00 2008 +0100 @@ -11,7 +11,6 @@ int pciback_enable_msi(struct pciback_de struct pci_dev *dev, struct xen_pci_op *op) { int otherend = pdev->xdev->otherend_id; - int irq; int status; status = pci_enable_msi(dev); @@ -29,8 +28,6 @@ int pciback_disable_msi(struct pciback_d int pciback_disable_msi(struct pciback_device *pdev, struct pci_dev *dev, struct xen_pci_op *op) { - int old_irq = dev->irq; - pci_disable_msi(dev); op->value = dev->irq; @@ -40,7 +37,7 @@ int pciback_enable_msix(struct pciback_d int pciback_enable_msix(struct pciback_device *pdev, struct pci_dev *dev, struct xen_pci_op *op) { - int otherend = pdev->xdev->otherend_id, result, i; + int result; result = pci_enable_msix(dev, op->msix_entries, op->value); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:24 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:24 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTM-0006W6-4I for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:24 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTx-0006SF-K1; Tue, 13 May 2008 15:32:01 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwT8-0005py-No for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:10 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwT4-0000JO-Kx for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:08 +0000 X-SBRS: 3.6 X-MesageID: 204872 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204872" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:18 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUI18011606 for ; Tue, 13 May 2008 08:30:18 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUagd011640 for ; Tue, 13 May 2008 08:30:36 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFUalI011639 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:30:36 -0700 Message-Id: <200805131530.m4DFUalI011639@xenbits.xensource.com> Date: Tue, 13 May 2008 08:30:35 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Avoid theoretical TOCTTOU bug in block backend nr_segments checking. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210670928 -3600 # Node ID 3044873a84b70e7bbae977037ef97fe18670e166 # Parent 29b8c3f366031a6f047777da6be0bed9b307ad5a Avoid theoretical TOCTTOU bug in block backend nr_segments checking. Based on a patch by Steven Smith Signed-off-by: Keir Fraser --- drivers/xen/blkback/blkback.c | 3 +++ drivers/xen/blktap/blktap.c | 3 +++ include/xen/blkif.h | 10 ++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff -r 29b8c3f36603 -r 3044873a84b7 drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Tue May 13 09:32:00 2008 +0100 +++ b/drivers/xen/blkback/blkback.c Tue May 13 10:28:48 2008 +0100 @@ -343,6 +343,9 @@ static int do_block_io_op(blkif_t *blkif BUG(); } blk_rings->common.req_cons = ++rc; /* before make_response() */ + + /* Apply all sanity checks to /private copy/ of request. */ + barrier(); switch (req.operation) { case BLKIF_OP_READ: diff -r 29b8c3f36603 -r 3044873a84b7 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Tue May 13 09:32:00 2008 +0100 +++ b/drivers/xen/blktap/blktap.c Tue May 13 10:28:48 2008 +0100 @@ -1264,6 +1264,9 @@ static int do_block_io_op(blkif_t *blkif } blk_rings->common.req_cons = ++rc; /* before make_response() */ + /* Apply all sanity checks to /private copy/ of request. */ + barrier(); + switch (req.operation) { case BLKIF_OP_READ: blkif->st_rd_req++; diff -r 29b8c3f36603 -r 3044873a84b7 include/xen/blkif.h --- a/include/xen/blkif.h Tue May 13 09:32:00 2008 +0100 +++ b/include/xen/blkif.h Tue May 13 10:28:48 2008 +0100 @@ -98,8 +98,9 @@ static void inline blkif_get_x86_32_req( dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; - if (n > src->nr_segments) - n = src->nr_segments; + barrier(); + if (n > dst->nr_segments) + n = dst->nr_segments; for (i = 0; i < n; i++) dst->seg[i] = src->seg[i]; } @@ -112,8 +113,9 @@ static void inline blkif_get_x86_64_req( dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; - if (n > src->nr_segments) - n = src->nr_segments; + barrier(); + if (n > dst->nr_segments) + n = dst->nr_segments; for (i = 0; i < n; i++) dst->seg[i] = src->seg[i]; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:29 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:29 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTR-0006WA-Gr for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:29 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwU3-0006Vx-1M; Tue, 13 May 2008 15:32:07 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTc-0006CC-ON for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:40 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTY-0000LC-Pc for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:38 +0000 X-SBRS: 3.6 X-MesageID: 204875 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204875" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUqxG011609 for ; Tue, 13 May 2008 08:30:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVB2N011860 for ; Tue, 13 May 2008 08:31:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVA6K011859 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:10 -0700 Message-Id: <200805131531.m4DFVA6K011859@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:10 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] libxc foreign address translation bug X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210687871 -3600 # Node ID 50790bbfa97aa4667358e97a725070dcfde041b9 # Parent 9733f681d5c5b81f003acb4a75d90aa5028361fb libxc foreign address translation bug In the xc_translate_foreign_address function from libxc, there is a check on the page directory entry to see if the page is 4K or 4M. However, the check is looking at bit 3, when it should be looking at bit 7. This patch fixes the problem. Signed-off-by: Bryan D. Payne xen-unstable changeset: 17558:a353dd2ab9445036351c5da5c14555b82bc85ae6 xen-unstable date: Fri May 02 13:46:16 2008 +0100 --- tools/libxc/xc_pagetab.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 9733f681d5c5 -r 50790bbfa97a tools/libxc/xc_pagetab.c --- a/tools/libxc/xc_pagetab.c Fri May 02 14:23:07 2008 +0100 +++ b/tools/libxc/xc_pagetab.c Tue May 13 15:11:11 2008 +0100 @@ -141,7 +141,7 @@ unsigned long xc_translate_foreign_addre /* Page Table */ - if (pde & 0x00000008) { /* 4M page (or 2M in PAE mode) */ + if (pde & 0x00000080) { /* 4M page (or 2M in PAE mode) */ DPRINTF("Cannot currently cope with 2/4M pages\n"); exit(-1); } else { /* 4k page */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:35 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:35 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTW-0006WD-KR for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:34 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwU8-0006ZN-1G; Tue, 13 May 2008 15:32:12 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTg-0006FN-Sq for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTa-0000LD-L1 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:42 +0000 X-SBRS: 3.6 X-MesageID: 204876 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204876" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUsCc011612 for ; Tue, 13 May 2008 08:30:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVCGx011877 for ; Tue, 13 May 2008 08:31:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVCRP011876 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:12 -0700 Message-Id: <200805131531.m4DFVCRP011876@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:11 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86, hvm: stdvga cache always on X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210687974 -3600 # Node ID ed61db6c6fe0ba2eba723fba03310a5a4d14641b # Parent 50790bbfa97aa4667358e97a725070dcfde041b9 x86, hvm: stdvga cache always on currently the hypervisor vga cache (stdvga.c) enables itself only in graphical mode and in the a0000h-affffh range. However there is no reason for this: it already allocates enought memory to map the whole vram. I am attaching a patch that implements the bank switching mechanism in stdvga.c, allowing the cache to be always enabled when the emulated graphic card is in VGA mode. Signed-off-by: Stefano Stabellini Signed-off-by: Keir Fraser xen-unstable changeset: 17572:d5589865bfce91bf65c34bd56e466bf26ca4176f xen-unstable date: Tue May 06 10:19:10 2008 +0100 --- xen/arch/x86/hvm/stdvga.c | 55 +++++++++++++++++++++++++++++++++++++--------- 1 files changed, 45 insertions(+), 10 deletions(-) diff -r 50790bbfa97a -r ed61db6c6fe0 xen/arch/x86/hvm/stdvga.c --- a/xen/arch/x86/hvm/stdvga.c Tue May 13 15:11:11 2008 +0100 +++ b/xen/arch/x86/hvm/stdvga.c Tue May 13 15:12:54 2008 +0100 @@ -130,14 +130,15 @@ static int stdvga_outb(uint64_t addr, ui /* When in standard vga mode, emulate here all writes to the vram buffer * so we can immediately satisfy reads without waiting for qemu. */ - s->stdvga = - (s->sr[7] == 0x00) && /* standard vga mode */ - (s->gr[6] == 0x05); /* misc graphics register w/ MemoryMapSelect=1 - * 0xa0000-0xaffff (64k region), AlphaDis=1 */ + s->stdvga = (s->sr[7] == 0x00); if ( !prev_stdvga && s->stdvga ) { - s->cache = 1; /* (re)start caching video buffer */ + /* + * (Re)start caching of video buffer. + * XXX TODO: In case of a restart the cache could be unsynced. + */ + s->cache = 1; gdprintk(XENLOG_INFO, "entering stdvga and caching modes\n"); } else if ( prev_stdvga && !s->stdvga ) @@ -179,6 +180,40 @@ int stdvga_intercept_pio( spin_unlock(&s->lock); return 0; /* propagate to external ioemu */ +} + +static unsigned int stdvga_mem_offset( + struct hvm_hw_stdvga *s, unsigned int mmio_addr) +{ + unsigned int memory_map_mode = (s->gr[6] >> 2) & 3; + unsigned int offset = mmio_addr & 0x1ffff; + + switch ( memory_map_mode ) + { + case 0: + break; + case 1: + if ( offset >= 0x10000 ) + goto fail; + offset += 0; /* assume bank_offset == 0; */ + break; + case 2: + offset -= 0x10000; + if ( offset >= 0x8000 ) + goto fail; + break; + default: + case 3: + offset -= 0x18000; + if ( offset >= 0x8000 ) + goto fail; + break; + } + + return offset; + + fail: + return ~0u; } #define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff) @@ -190,8 +225,8 @@ static uint8_t stdvga_mem_readb(uint64_t uint32_t ret, *vram_l; uint8_t *vram_b; - addr &= 0x1ffff; - if ( addr >= 0x10000 ) + addr = stdvga_mem_offset(s, addr); + if ( addr == ~0u ) return 0xff; if ( s->sr[4] & 0x08 ) @@ -272,8 +307,8 @@ static void stdvga_mem_writeb(uint64_t a uint32_t write_mask, bit_mask, set_mask, *vram_l; uint8_t *vram_b; - addr &= 0x1ffff; - if ( addr >= 0x10000 ) + addr = stdvga_mem_offset(s, addr); + if ( addr == ~0u ) return; if ( s->sr[4] & 0x08 ) @@ -563,7 +598,7 @@ void stdvga_init(struct domain *d) register_portio_handler(d, 0x3ce, 2, stdvga_intercept_pio); /* MMIO. */ register_buffered_io_handler( - d, 0xa0000, 0x10000, stdvga_intercept_mmio); + d, 0xa0000, 0x20000, stdvga_intercept_mmio); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:39 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:39 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTb-0006WH-3a for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:39 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwUC-0006cj-Jh; Tue, 13 May 2008 15:32:16 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTh-0006GB-TJ for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTb-0000LC-6d for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:43 +0000 X-SBRS: 3.6 X-MesageID: 204877 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204877" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUvjs011615 for ; Tue, 13 May 2008 08:30:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVFEP011897 for ; Tue, 13 May 2008 08:31:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVFC7011895 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:15 -0700 Message-Id: <200805131531.m4DFVFC7011895@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:13 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86 hvm: Support interrupt delivery for PIT channel 0 when in modes 3 and 4. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210688074 -3600 # Node ID 1f673d541aad6bdddff72cae57fc89210e089089 # Parent ed61db6c6fe0ba2eba723fba03310a5a4d14641b x86 hvm: Support interrupt delivery for PIT channel 0 when in modes 3 and 4. Signed-off-by: Keir Fraser xen-unstable changeset: 17578:a95c2e36d6fda747279123ab13bfaf40c4041337 xen-unstable date: Tue May 06 16:20:24 2008 +0100 --- xen/arch/x86/hvm/i8254.c | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff -r ed61db6c6fe0 -r 1f673d541aad xen/arch/x86/hvm/i8254.c --- a/xen/arch/x86/hvm/i8254.c Tue May 13 15:12:54 2008 +0100 +++ b/xen/arch/x86/hvm/i8254.c Tue May 13 15:14:34 2008 +0100 @@ -206,19 +206,21 @@ static void pit_load_count(PITState *pit switch ( s->mode ) { - case 2: - /* Periodic timer. */ - create_periodic_time(v, &pit->pt0, period, 0, 0, pit_time_fired, - &pit->count_load_time[channel]); - break; - case 1: - /* One-shot timer. */ - create_periodic_time(v, &pit->pt0, period, 0, 1, pit_time_fired, - &pit->count_load_time[channel]); - break; - default: - destroy_periodic_time(&pit->pt0); - break; + case 2: + case 3: + /* Periodic timer. */ + create_periodic_time(v, &pit->pt0, period, 0, 0, pit_time_fired, + &pit->count_load_time[channel]); + break; + case 1: + case 4: + /* One-shot timer. */ + create_periodic_time(v, &pit->pt0, period, 0, 1, pit_time_fired, + &pit->count_load_time[channel]); + break; + default: + destroy_periodic_time(&pit->pt0); + break; } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:43 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:43 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTf-0006WK-JB for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:43 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwUH-0006gL-3Q; Tue, 13 May 2008 15:32:21 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTl-0006IA-3t for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTd-0000LF-6o for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:46 +0000 X-SBRS: 3.6 X-MesageID: 204878 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204878" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:30:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFUxGq011618 for ; Tue, 13 May 2008 08:30:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVHxc011931 for ; Tue, 13 May 2008 08:31:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVHiA011930 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:17 -0700 Message-Id: <200805131531.m4DFVHiA011930@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:15 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86 hvm: Warn only once per time source when the periodic tiemout is X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210688102 -3600 # Node ID 9bb37012b63e58890d4b8eab956dc2722ddb433d # Parent 1f673d541aad6bdddff72cae57fc89210e089089 x86 hvm: Warn only once per time source when the periodic tiemout is set 'too small'. Signed-off-by: Keir Fraser xen-unstable changeset: 17579:cc953475ab149a61defff06de237295a7feb882d xen-unstable date: Tue May 06 16:20:54 2008 +0100 --- xen/arch/x86/hvm/vpt.c | 6 +++--- xen/include/asm-x86/hvm/vpt.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff -r 1f673d541aad -r 9bb37012b63e xen/arch/x86/hvm/vpt.c --- a/xen/arch/x86/hvm/vpt.c Tue May 13 15:14:34 2008 +0100 +++ b/xen/arch/x86/hvm/vpt.c Tue May 13 15:15:02 2008 +0100 @@ -338,9 +338,9 @@ void create_periodic_time( /* Periodic timer must be at least 0.9ms. */ if ( (period < 900000) && !one_shot ) { - gdprintk(XENLOG_WARNING, - "HVM_PlatformTime: program too small period %"PRIu64"\n", - period); + if ( !test_and_set_bool(pt->warned_timeout_too_short) ) + gdprintk(XENLOG_WARNING, "HVM_PlatformTime: program too " + "small period %"PRIu64"\n", period); period = 900000; } diff -r 1f673d541aad -r 9bb37012b63e xen/include/asm-x86/hvm/vpt.h --- a/xen/include/asm-x86/hvm/vpt.h Tue May 13 15:14:34 2008 +0100 +++ b/xen/include/asm-x86/hvm/vpt.h Tue May 13 15:15:02 2008 +0100 @@ -78,6 +78,7 @@ struct periodic_time { bool_t one_shot; bool_t do_not_freeze; bool_t irq_issued; + bool_t warned_timeout_too_short; #define PTSRC_isa 1 /* ISA time source */ #define PTSRC_lapic 2 /* LAPIC time source */ u8 source; /* PTSRC_ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:48 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:48 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTk-0006WO-93 for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:48 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwUL-0006jl-OV; Tue, 13 May 2008 15:32:25 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTm-0006Iv-4E for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTf-0000LD-2s for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:48 +0000 X-SBRS: 3.6 X-MesageID: 204879 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204879" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:31:01 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFV0AA011621 for ; Tue, 13 May 2008 08:31:00 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVIZV011950 for ; Tue, 13 May 2008 08:31:18 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVIwl011949 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:18 -0700 Message-Id: <200805131531.m4DFVIwl011949@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:17 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,INFO_TLD autolearn=no version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] xend: Fix and improve error handling for failed suspend/migrate X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210688219 -3600 # Node ID fd285b18158e8bc355ac036cf9d305d06bbfbce3 # Parent 9bb37012b63e58890d4b8eab956dc2722ddb433d xend: Fix and improve error handling for failed suspend/migrate This has been broken since cset 16964:5d84464dc1fc Also deal better with very early errors (close sender side socket) Signed-off-by: Steven Hand xen-unstable changeset: 17601:c99a88623eda83d8e02f4b6d7c32bc4c6d298d8a xen-unstable date: Thu May 08 14:33:31 2008 +0100 --- tools/python/xen/xend/XendCheckpoint.py | 14 ++------------ tools/python/xen/xend/XendDomain.py | 6 ++++-- tools/python/xen/xend/XendDomainInfo.py | 13 ++++++++++++- 3 files changed, 18 insertions(+), 15 deletions(-) diff -r 9bb37012b63e -r fd285b18158e tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Tue May 13 15:15:02 2008 +0100 +++ b/tools/python/xen/xend/XendCheckpoint.py Tue May 13 15:16:59 2008 +0100 @@ -67,8 +67,6 @@ def save(fd, dominfo, network, live, dst # thing is useful for debugging. dominfo.setName('migrating-' + domain_name) - done_suspend = 0 - try: dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP1, domain_name) @@ -96,7 +94,6 @@ def save(fd, dominfo, network, live, dst log.debug("Suspending %d ...", dominfo.getDomid()) dominfo.shutdown('suspend') dominfo.waitForShutdown() - done_suspend = 1 dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, domain_name) log.info("Domain %d suspended.", dominfo.getDomid()) @@ -140,16 +137,9 @@ def save(fd, dominfo, network, live, dst pass except Exception, exn: - log.exception("Save failed on domain %s (%s).", domain_name, + log.exception("Save failed on domain %s (%s) - resuming.", domain_name, dominfo.getDomid()) - - # If we didn't get as far as suspending the domain (for - # example, we couldn't balloon enough memory for the new - # domain), then we don't want to re-plumb the devices, as the - # domU will not be expecting it. - if done_suspend: - log.debug("XendCheckpoint.save: resumeDomain") - dominfo.resumeDomain() + dominfo.resumeDomain() try: dominfo.setName(domain_name) diff -r 9bb37012b63e -r fd285b18158e tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Tue May 13 15:15:02 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Tue May 13 15:16:59 2008 +0100 @@ -1296,8 +1296,10 @@ class XendDomain: sock.send("receive\n") sock.recv(80) - XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst) - sock.close() + try: + XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst) + finally: + sock.close() def domain_save(self, domid, dst, checkpoint=False): """Start saving a domain to file. diff -r 9bb37012b63e -r fd285b18158e tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Tue May 13 15:15:02 2008 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue May 13 15:16:59 2008 +0100 @@ -1935,8 +1935,19 @@ class XendDomainInfo: def resumeDomain(self): log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid)) - if self.domid is None: + # resume a suspended domain (e.g. after live checkpoint, or after + # a later error during save or migate); checks that the domain + # is currently suspended first so safe to call from anywhere + + xeninfo = dom_get(self.domid) + if xeninfo is None: return + if not xeninfo['shutdown']: + return + reason = shutdown_reason(xeninfo['shutdown_reason']) + if reason != 'suspend': + return + try: # could also fetch a parsed note from xenstore fast = self.info.get_notes().get('SUSPEND_CANCEL') and 1 or 0 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:54 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:54 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTq-0006WS-12 for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:54 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwUR-0006nv-FK; Tue, 13 May 2008 15:32:31 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTo-0006KP-1b for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTg-0000LC-Bc for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:49 +0000 X-SBRS: 3.6 X-MesageID: 204880 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204880" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:31:02 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFV1Cf011624 for ; Tue, 13 May 2008 08:31:02 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVKCu011967 for ; Tue, 13 May 2008 08:31:20 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVKf3011966 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:20 -0700 Message-Id: <200805131531.m4DFVKf3011966@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:19 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] ioemu: fix disk format security vulnerability X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210688387 -3600 # Node ID 80730d294e51e39a7f8f58708d1de2f735001392 # Parent fd285b18158e8bc355ac036cf9d305d06bbfbce3 ioemu: fix disk format security vulnerability * make the xenstore reader in qemu-dm's startup determine which of qemu's block drivers to use according to the xenstore backend `type' field. This `type' field typically comes from the front of the drive mapping string in ioemu. The supported cases are: xm config file string `type' image format qemu driver phy:[/dev/] phy raw image bdrv_raw file: file raw image bdrv_raw tap:aio: tap raw image bdrv_raw tap:qcow: tap not raw autoprobe tap:: tap named format bdrv_ It is still necessary to autoprobe when the image is specified as `tap:qcow:', because qemu distinguishes `qcow' and `qcow2' whereas blktap doesn't; `qcow' in xenstore typically means what qemu calls qcow2. This is OK because qemu can safely distinguish the different cow formats provided we know it's not a raw image. * Make the format autoprobing machinery never return `raw'. This has two purposes: firstly, it arranges that the `tap:qcow:...' case above can be handled without accidentally falling back to raw format. Secondly it prevents accidents in case the code changes in future: autoprobing will now always fail on supposed cow files which actually contain junk, rather than giving the guest access to the underlying file. Signed-off-by: Ian Jackson xen-unstable changeset: 17606:e3be00bd6aa963aca563692c271af762f9380ba0 xen-unstable date: Mon May 12 10:09:12 2008 +0100 --- tools/ioemu/block.c | 2 +- tools/ioemu/xenstore.c | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 6 deletions(-) diff -r fd285b18158e -r 80730d294e51 tools/ioemu/block.c --- a/tools/ioemu/block.c Tue May 13 15:16:59 2008 +0100 +++ b/tools/ioemu/block.c Tue May 13 15:19:47 2008 +0100 @@ -250,7 +250,7 @@ static BlockDriver *find_protocol(const #endif p = strchr(filename, ':'); if (!p) - return &bdrv_raw; + return NULL; /* do not ever guess raw, it is a security problem! */ len = p - filename; if (len > sizeof(protocol) - 1) len = sizeof(protocol) - 1; diff -r fd285b18158e -r 80730d294e51 tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Tue May 13 15:16:59 2008 +0100 +++ b/tools/ioemu/xenstore.c Tue May 13 15:19:47 2008 +0100 @@ -86,6 +86,7 @@ void xenstore_parse_domain_config(int do int i, is_scsi, is_hdN = 0; unsigned int len, num, hd_index; BlockDriverState *bs; + BlockDriver *format; for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) media_filename[i] = NULL; @@ -131,6 +132,8 @@ void xenstore_parse_domain_config(int do } for (i = 0; i < num; i++) { + format = NULL; /* don't know what the format is yet */ + /* read the backend path */ if (pasprintf(&buf, "%s/device/vbd/%s/backend", path, e[i]) == -1) continue; @@ -177,13 +180,20 @@ void xenstore_parse_domain_config(int do drv = xs_read(xsh, XBT_NULL, buf, &len); if (drv == NULL) continue; - /* Strip off blktap sub-type prefix aio: - QEMU can autodetect this */ + /* Obtain blktap sub-type prefix */ if (!strcmp(drv, "tap") && params[0]) { char *offset = strchr(params, ':'); if (!offset) continue ; + free(drv); + drv = malloc(offset - params + 1); + memcpy(drv, params, offset - params); + drv[offset - params] = '\0'; + if (!strcmp(drv, "aio")) + /* qemu does aio anyway if it can */ + format = &bdrv_raw; memmove(params, offset+1, strlen(offset+1)+1 ); - fprintf(logfile, "Strip off blktap sub-type prefix to %s\n", params); + fprintf(logfile, "Strip off blktap sub-type prefix to %s (drv '%s')\n", params, drv); } /* Prefix with /dev/ if needed */ if (!strcmp(drv, "phy") && params[0] != '/') { @@ -191,6 +201,7 @@ void xenstore_parse_domain_config(int do sprintf(newparams, "/dev/%s", params); free(params); params = newparams; + format = &bdrv_raw; } /* @@ -227,9 +238,25 @@ void xenstore_parse_domain_config(int do /* open device now if media present */ if (params[0]) { - if (bdrv_open(bs, params, 0 /* snapshot */) < 0) - fprintf(stderr, "qemu: could not open hard disk image '%s'\n", - params); + if (!format) { + if (!drv) { + fprintf(stderr, "qemu: type (image format) not specified for vbd '%s' or image '%s'\n", buf, params); + continue; + } + if (!strcmp(drv,"qcow")) { + /* autoguess qcow vs qcow2 */ + } else if (!strcmp(drv,"file")) { + format = &bdrv_raw; + } else { + format = bdrv_find_format(drv); + if (!format) { + fprintf(stderr, "qemu: type (image format) '%s' unknown for vbd '%s' or image '%s'\n", drv, buf, params); + continue; + } + } + } + if (bdrv_open2(bs, params, 0 /* snapshot */, format) < 0) + fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s')\n", buf, params, drv ? drv : "?"); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:31:59 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:31:59 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwTu-0006WV-TB for www-data@colo.xensource.com; Tue, 13 May 2008 08:31:59 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwUW-0006rP-Aq; Tue, 13 May 2008 15:32:36 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTq-0006LR-4w for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTj-0000LF-Ha for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:52 +0000 X-SBRS: 3.6 X-MesageID: 204881 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204881" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:31:05 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFV4nD011627 for ; Tue, 13 May 2008 08:31:04 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVMwu011984 for ; Tue, 13 May 2008 08:31:22 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVMu3011983 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:22 -0700 Message-Id: <200805131531.m4DFVMu3011983@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:20 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86: fix a few 32-on-64 compat mode issues X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210688604 -3600 # Node ID 498e719bd90475f1cca4b407e3d62e95b80676be # Parent 80730d294e51e39a7f8f58708d1de2f735001392 x86: fix a few 32-on-64 compat mode issues - handle VCPUOP_register_vcpu_info and VCPUOP_get_physid (and add respective layout checks) - add missing structure size check for struct vcpu_info - add missing layout check for vcpu_set_periodic_timer - handle VCPUOP_set_singleshot_timer via argument translation as the structure sizes differ (due to padding in 64-bits) Signed-off-by: Jan Beulich xen-unstable changeset: 17612:945394931d9e5cb6094f5117acc0a9f55e1019d9 xen-unstable date: Mon May 12 10:15:07 2008 +0100 --- xen/arch/x86/x86_64/domain.c | 19 ++++++++++++++++--- xen/common/compat/domain.c | 20 ++++++++++++++++++-- xen/include/xlat.lst | 5 +++++ xen/tools/get-fields.sh | 1 - 4 files changed, 39 insertions(+), 6 deletions(-) diff -r 80730d294e51 -r 498e719bd904 xen/arch/x86/x86_64/domain.c --- a/xen/arch/x86/x86_64/domain.c Tue May 13 15:19:47 2008 +0100 +++ b/xen/arch/x86/x86_64/domain.c Tue May 13 15:23:24 2008 +0100 @@ -9,11 +9,23 @@ #include #include +#define xen_vcpu_info vcpu_info +CHECK_SIZE_(struct, vcpu_info); +#undef xen_vcpu_info + +#define xen_vcpu_register_vcpu_info vcpu_register_vcpu_info +CHECK_vcpu_register_vcpu_info; +#undef xen_vcpu_register_vcpu_info + +#define xen_vcpu_get_physid vcpu_get_physid +CHECK_vcpu_get_physid; +#undef xen_vcpu_get_physid + int arch_compat_vcpu_op( int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg) { - long rc = 0; + int rc = -ENOSYS; switch ( cmd ) { @@ -51,8 +63,9 @@ arch_compat_vcpu_op( break; } - default: - rc = -ENOSYS; + case VCPUOP_register_vcpu_info: + case VCPUOP_get_physid: + rc = arch_do_vcpu_op(cmd, v, arg); break; } diff -r 80730d294e51 -r 498e719bd904 xen/common/compat/domain.c --- a/xen/common/compat/domain.c Tue May 13 15:19:47 2008 +0100 +++ b/xen/common/compat/domain.c Tue May 13 15:23:24 2008 +0100 @@ -11,11 +11,15 @@ #include #include +#define xen_vcpu_set_periodic_timer vcpu_set_periodic_timer +CHECK_vcpu_set_periodic_timer; +#undef xen_vcpu_set_periodic_timer + int compat_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg) { struct domain *d = current->domain; struct vcpu *v; - long rc = 0; + int rc = 0; if ( (vcpuid < 0) || (vcpuid >= MAX_VIRT_CPUS) ) return -EINVAL; @@ -57,7 +61,6 @@ int compat_vcpu_op(int cmd, int vcpuid, case VCPUOP_is_up: case VCPUOP_set_periodic_timer: case VCPUOP_stop_periodic_timer: - case VCPUOP_set_singleshot_timer: case VCPUOP_stop_singleshot_timer: case VCPUOP_send_nmi: rc = do_vcpu_op(cmd, vcpuid, arg); @@ -74,6 +77,19 @@ int compat_vcpu_op(int cmd, int vcpuid, xlat_vcpu_runstate_info(&runstate.nat); if ( copy_to_guest(arg, &runstate.cmp, 1) ) rc = -EFAULT; + break; + } + + case VCPUOP_set_singleshot_timer: + { + struct compat_vcpu_set_singleshot_timer cmp; + struct vcpu_set_singleshot_timer *nat; + + if ( copy_from_guest(&cmp, arg, 1) ) + return -EFAULT; + nat = (void *)COMPAT_ARG_XLAT_VIRT_START(current->vcpu_id); + XLAT_vcpu_set_singleshot_timer(nat, &cmp); + rc = do_vcpu_op(cmd, vcpuid, guest_handle_from_ptr(nat, void)); break; } diff -r 80730d294e51 -r 498e719bd904 xen/include/xlat.lst --- a/xen/include/xlat.lst Tue May 13 15:19:47 2008 +0100 +++ b/xen/include/xlat.lst Tue May 13 15:23:24 2008 +0100 @@ -5,6 +5,7 @@ ? mmu_update xen.h ! mmuext_op xen.h ! start_info xen.h +? vcpu_info xen.h ? vcpu_time_info xen.h ! cpu_user_regs arch-x86/xen-@arch@.h ! trap_info arch-x86/xen.h @@ -40,6 +41,10 @@ ? sched_remote_shutdown sched.h ? sched_shutdown sched.h ? t_buf trace.h +? vcpu_get_physid vcpu.h +? vcpu_register_vcpu_info vcpu.h ! vcpu_runstate_info vcpu.h +? vcpu_set_periodic_timer vcpu.h +! vcpu_set_singleshot_timer vcpu.h ? xenoprof_init xenoprof.h ? xenoprof_passive xenoprof.h diff -r 80730d294e51 -r 498e719bd904 xen/tools/get-fields.sh --- a/xen/tools/get-fields.sh Tue May 13 15:19:47 2008 +0100 +++ b/xen/tools/get-fields.sh Tue May 13 15:23:24 2008 +0100 @@ -310,7 +310,6 @@ build_body () done echo " \\" echo "} while (0)" - echo "" } check_field () _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:32:04 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:32:04 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwU0-0006X5-BL for www-data@colo.xensource.com; Tue, 13 May 2008 08:32:04 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwUb-0006v3-PH; Tue, 13 May 2008 15:32:41 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTt-0006NJ-0H for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:57 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTm-0000LD-7B for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:54 +0000 X-SBRS: 3.6 X-MesageID: 204882 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204882" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:31:09 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFV8Oj011630 for ; Tue, 13 May 2008 08:31:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVQkx012001 for ; Tue, 13 May 2008 08:31:26 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVQOn012000 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:26 -0700 Message-Id: <200805131531.m4DFVQOn012000@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:23 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86: only print pages' mfn-s in dump_pageframe_info() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210688631 -3600 # Node ID 01f12d39071efa0b5e0d28c06584a42f19c49437 # Parent 498e719bd90475f1cca4b407e3d62e95b80676be x86: only print pages' mfn-s in dump_pageframe_info() Printing page_to_maddr() and page_to_mfn() of the same page is redundant, and _p(page_to_maddr(page)) is even incorrect on x86/PAE. Signed-off-by: Jan Beulich xen-unstable changeset: 17613:a6e2679b1aad89d654d0af7f973f338d3f2cd9db xen-unstable date: Mon May 12 10:16:18 2008 +0100 --- xen/arch/x86/domain.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff -r 498e719bd904 -r 01f12d39071e xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Tue May 13 15:23:24 2008 +0100 +++ b/xen/arch/x86/domain.c Tue May 13 15:23:51 2008 +0100 @@ -135,16 +135,16 @@ void dump_pageframe_info(struct domain * { list_for_each_entry ( page, &d->page_list, list ) { - printk(" DomPage %p: mfn=%p, caf=%08x, taf=%" PRtype_info "\n", - _p(page_to_maddr(page)), _p(page_to_mfn(page)), + printk(" DomPage %p: caf=%08x, taf=%" PRtype_info "\n", + _p(page_to_mfn(page)), page->count_info, page->u.inuse.type_info); } } list_for_each_entry ( page, &d->xenpage_list, list ) { - printk(" XenPage %p: mfn=%p, caf=%08x, taf=%" PRtype_info "\n", - _p(page_to_maddr(page)), _p(page_to_mfn(page)), + printk(" XenPage %p: caf=%08x, taf=%" PRtype_info "\n", + _p(page_to_mfn(page)), page->count_info, page->u.inuse.type_info); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:32:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:32:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwU4-0006X8-Ov for www-data@colo.xensource.com; Tue, 13 May 2008 08:32:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwUg-0006yY-5w; Tue, 13 May 2008 15:32:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTu-0006OG-KV for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTo-0000LC-DX for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:56 +0000 X-SBRS: 3.6 X-MesageID: 204883 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204883" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:31:11 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVBGf011633 for ; Tue, 13 May 2008 08:31:11 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVS5P012020 for ; Tue, 13 May 2008 08:31:28 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVSd6012019 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:28 -0700 Message-Id: <200805131531.m4DFVSd6012019@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:27 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] ioemu: Fix PVFB backend to validate frontend's frame buffer X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210689273 -3600 # Node ID f70475e8396dc4bc0304d5ff697f18e2b35926f4 # Parent 01f12d39071efa0b5e0d28c06584a42f19c49437 ioemu: Fix PVFB backend to validate frontend's frame buffer description A buggy or malicious frontend can describe its shared framebuffer to the backend in a way that makes the backend map an arbitrary amount of guest memory, malloc an arbitrarily large internal buffer, copy arbitrary memory to that buffer, even beyond its end. A domU running a malicious frontend can abuse the former two for denial of service attacks against dom0. It can abuse the third to write arbitrary backend memory. It can abuse all three to terminate or crash the backend. Arbitrary code execution looks quite feasible. From: Markus Armbruster Signed-off-by: Keir Fraser xen-unstable changeset: 17630:53195719f7621110dab7a97a2bca292b73baa715 xen-unstable date: Tue May 13 15:08:17 2008 +0100 --- tools/ioemu/hw/xenfb.c | 64 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 53 insertions(+), 11 deletions(-) diff -r 01f12d39071e -r f70475e8396d tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Tue May 13 15:23:51 2008 +0100 +++ b/tools/ioemu/hw/xenfb.c Tue May 13 15:34:33 2008 +0100 @@ -22,8 +22,6 @@ #ifndef BTN_LEFT #define BTN_LEFT 0x110 /* from */ #endif - -// FIXME defend against malicious frontend? struct xenfb; @@ -476,6 +474,50 @@ void xenfb_shutdown(struct xenfb *xenfb) free(xenfb); } +static int xenfb_configure_fb(struct xenfb *xenfb, + int width, int height, int depth, + size_t fb_len, int row_stride) +{ + size_t mfn_sz = sizeof(*((struct xenfb_page *)0)->pd); + size_t pd_len = sizeof(((struct xenfb_page *)0)->pd) / mfn_sz; + size_t fb_pages = pd_len * XC_PAGE_SIZE / mfn_sz; + size_t fb_len_max = fb_pages * XC_PAGE_SIZE; + int max_width, max_height; + + if (depth != 8 && depth != 16 && depth != 24 && depth != 32) { + fprintf(stderr, + "FB: can't handle frontend fb depth %d\n", + depth); + return -1; + } + if (row_stride < 0 || row_stride > fb_len) { + fprintf(stderr, + "FB: invalid frontend stride %d\n", row_stride); + return -1; + } + max_width = row_stride / (depth / 8); + if (width < 0 || width > max_width) { + fprintf(stderr, + "FB: invalid frontend width %d limited to %d\n", + width, max_width); + width = max_width; + } + max_height = fb_len / row_stride; + if (height < 0 || height > max_height) { + fprintf(stderr, + "FB: invalid frontend height %d limited to %d\n", + height, max_height); + height = max_height; + } + xenfb->fb_len = fb_len; + xenfb->row_stride = row_stride; + xenfb->depth = depth; + xenfb->width = width; + xenfb->height = height; + fprintf(stderr, "Framebuffer %dx%dx%d stride %d\n", + width, height, depth, row_stride); + return 0; +} static void xenfb_on_fb_event(struct xenfb *xenfb) { @@ -506,7 +548,6 @@ static void xenfb_on_fb_event(struct xen || h != event->update.height) { fprintf(stderr, "%s bogus update clipped\n", xenfb->fb.nodename); - break; } xenfb_guest_copy(xenfb, x, y, w, h); break; @@ -686,14 +727,15 @@ static int xenfb_read_frontend_fb_config xenfb->protocol[0] = '\0'; xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "request-update", "1"); - /* TODO check for permitted ranges */ - fb_page = xenfb->fb.page; - xenfb->depth = fb_page->depth; - xenfb->width = fb_page->width; - xenfb->height = fb_page->height; - /* TODO check for consistency with the above */ - xenfb->fb_len = fb_page->mem_length; - xenfb->row_stride = fb_page->line_length; + fb_page = xenfb->fb.page; + if (xenfb_configure_fb(xenfb, + fb_page->width, fb_page->height, fb_page->depth, + fb_page->mem_length, fb_page->line_length) + < 0) { + errno = EINVAL; + return -1; + } + fprintf(stderr, "Framebuffer depth %d width %d height %d line %d\n", fb_page->depth, fb_page->width, fb_page->height, fb_page->line_length); if (xenfb_map_fb(xenfb, xenfb->fb.otherend_id) < 0) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 13 08:32:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 13 May 2008 08:32:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JvwU9-0006XC-D0 for www-data@colo.xensource.com; Tue, 13 May 2008 08:32:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwUk-00071r-P0; Tue, 13 May 2008 15:32:50 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JvwTx-0006Qa-MZ for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:32:01 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JvwTq-0000LF-NC for xen-changelog@lists.xensource.com; Tue, 13 May 2008 15:31:59 +0000 X-SBRS: 3.6 X-MesageID: 204884 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,480,1204520400"; d="scan'208";a="204884" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 13 May 2008 11:31:13 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVDN7011636 for ; Tue, 13 May 2008 08:31:13 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4DFVVFW012055 for ; Tue, 13 May 2008 08:31:31 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4DFVVNQ012054 for xen-changelog@lists.xensource.com; Tue, 13 May 2008 08:31:31 -0700 Message-Id: <200805131531.m4DFVVNQ012054@xenbits.xensource.com> Date: Tue, 13 May 2008 08:31:29 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] SVM: clean up __get_instruction_length_from_list() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210690471 -3600 # Node ID 784805591fa2d972e790451d3242f6c59f8eeebf # Parent f70475e8396dc4bc0304d5ff697f18e2b35926f4 SVM: clean up __get_instruction_length_from_list() Remove unused arguments, fix its behaviour near page boundaries, inject appropriate pagefaults, and inject #GP if the instruction is not decodable or %eip is not pointing to valid RAM. Signed-off-by: Tim Deegan Signed-off-by: Keir Fraser xen-unstable changeset: 17575:01aa7c088e983cd54b61faeb3ff533581714a26f xen-unstable date: Tue May 06 13:32:18 2008 +0100 --- xen/arch/x86/hvm/svm/emulate.c | 73 ++++++++++++++++++++++++++++--------- xen/arch/x86/hvm/svm/svm.c | 79 ++++++++++++++++++----------------------- xen/arch/x86/hvm/vmx/vmx.c | 3 - 3 files changed, 92 insertions(+), 63 deletions(-) diff -r f70475e8396d -r 784805591fa2 xen/arch/x86/hvm/svm/emulate.c --- a/xen/arch/x86/hvm/svm/emulate.c Tue May 13 15:34:33 2008 +0100 +++ b/xen/arch/x86/hvm/svm/emulate.c Tue May 13 15:54:31 2008 +0100 @@ -28,9 +28,6 @@ #include #include - -extern int inst_copy_from_guest(unsigned char *buf, unsigned long guest_eip, - int inst_len); #define REX_PREFIX_BASE 0x40 #define REX_X 0x02 @@ -412,8 +409,8 @@ static const u8 *opc_bytes[INSTR_MAX_COU * Intel has a vmcs entry to give the instruction length. AMD doesn't. So we * have to do a little bit of work to find out... * - * The caller can either pass a NULL pointer to the guest_eip_buf, or a pointer - * to enough bytes to satisfy the instruction including prefix bytes. + * The caller may supply a buffer of at least MAX_INST_LEN bytes, which + * the instruction will be read into. */ int __get_instruction_length_from_list(struct vcpu *v, enum instruction_index *list, unsigned int list_count, @@ -425,21 +422,40 @@ int __get_instruction_length_from_list(s unsigned int j; int found = 0; enum instruction_index instr = 0; - u8 buffer[MAX_INST_LEN]; + unsigned long fetch_addr; + int fetch_len; u8 *buf; const u8 *opcode = NULL; - - if (guest_eip_buf) - { - buf = guest_eip_buf; - } - else - { - if ( inst_copy_from_guest(buffer, svm_rip2pointer(v), MAX_INST_LEN) - != MAX_INST_LEN ) - return 0; - buf = buffer; - } + u8 temp_buffer[MAX_INST_LEN]; + + /* Use the stack if the caller didn't give us a buffer */ + buf = ( guest_eip_buf ) ? guest_eip_buf : temp_buffer; + +#define FETCH(_buf, _addr, _len) do \ + { \ + switch ( hvm_fetch_from_guest_virt((_buf), (_addr), (_len)) ) \ + { \ + case HVMCOPY_okay: \ + break; \ + case HVMCOPY_bad_gva_to_gfn: \ + /* OK just to give up; we'll have injected #PF already */ \ + return 0; \ + case HVMCOPY_bad_gfn_to_mfn: \ + /* Not OK: fetches from non-RAM pages are not supportable. */ \ + gdprintk(XENLOG_ERR, "Bad instruction fetch at %#lx (%#lx)\n", \ + (unsigned long) guest_cpu_user_regs()->eip, fetch_addr); \ + hvm_inject_exception(TRAP_gp_fault, 0, 0); \ + return 0; \ + } \ + } while (0) + + /* Fetch up to the next page break; we'll fetch from the next page + * later if we have to. */ + fetch_addr = svm_rip2pointer(v); + fetch_len = PAGE_SIZE - (fetch_addr & ~PAGE_MASK) ; + if ( fetch_len > MAX_INST_LEN ) + fetch_len = MAX_INST_LEN; + FETCH(buf, fetch_addr, fetch_len); for (j = 0; j < list_count; j++) { @@ -450,7 +466,16 @@ int __get_instruction_length_from_list(s while (inst_len < MAX_INST_LEN && is_prefix(buf[inst_len]) && !is_prefix(opcode[1])) + { inst_len++; + if ( inst_len >= fetch_len ) + { + FETCH(buf + fetch_len, + fetch_addr + fetch_len, + MAX_INST_LEN - fetch_len); + fetch_len = MAX_INST_LEN; + } + } ASSERT(opcode[0] <= 15); /* Make sure the table is correct. */ found = 1; @@ -460,6 +485,14 @@ int __get_instruction_length_from_list(s /* If the last byte is zero, we just accept it without checking */ if (i == opcode[0]-1 && opcode[i+1] == 0) break; + + if ( inst_len + i >= fetch_len ) + { + FETCH(buf + fetch_len, + fetch_addr + fetch_len, + MAX_INST_LEN - fetch_len); + fetch_len = MAX_INST_LEN; + } if (buf[inst_len+i] != opcode[i+1]) { @@ -487,7 +520,11 @@ int __get_instruction_length_from_list(s printk("%s: Mismatch between expected and actual instruction bytes: " "eip = %lx\n", __func__, (unsigned long)vmcb->rip); + hvm_inject_exception(TRAP_gp_fault, 0, 0); return 0; + +#undef FETCH + } /* diff -r f70475e8396d -r 784805591fa2 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Tue May 13 15:34:33 2008 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Tue May 13 15:54:31 2008 +0100 @@ -78,7 +78,10 @@ static void inline __update_guest_eip( { struct vcpu *curr = current; - if ( unlikely((inst_len == 0) || (inst_len > 15)) ) + if ( unlikely(inst_len == 0) ) + return; + + if ( unlikely(inst_len > 15) ) { gdprintk(XENLOG_ERR, "Bad instruction length %u\n", inst_len); domain_crash(curr->domain); @@ -1131,18 +1134,28 @@ static void svm_dr_access(struct vcpu *v static int svm_get_prefix_info(struct vcpu *v, unsigned int dir, svm_segment_register_t **seg, - unsigned int *asize) + unsigned int *asize, + unsigned int isize) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; unsigned char inst[MAX_INST_LEN]; int i; memset(inst, 0, MAX_INST_LEN); - if (inst_copy_from_guest(inst, svm_rip2pointer(v), sizeof(inst)) - != MAX_INST_LEN) - { - gdprintk(XENLOG_ERR, "get guest instruction failed\n"); - return 0; + + switch ( hvm_fetch_from_guest_virt(inst, svm_rip2pointer(v), isize) ) + { + case HVMCOPY_okay: + break; + case HVMCOPY_bad_gva_to_gfn: + /* OK just to give up; we'll have injected #PF already */ + return 0; + case HVMCOPY_bad_gfn_to_mfn: + gdprintk(XENLOG_ERR, "Bad prefix fetch at %#lx (%#lx)\n", + (unsigned long) guest_cpu_user_regs()->eip, + svm_rip2pointer(v)); + domain_crash(v->domain); + return 0; } for (i = 0; i < MAX_INST_LEN; i++) @@ -1232,12 +1245,8 @@ static int svm_get_io_address( * to figure out what it is... */ isize = vmcb->exitinfo2 - regs->eip; - - if (info.fields.rep) - isize --; - - if (isize > 1) - if ( !svm_get_prefix_info(v, info.fields.type, &seg, &asize) ) + if ( isize > ((info.fields.rep) ? 2 : 1) ) + if ( !svm_get_prefix_info(v, info.fields.type, &seg, &asize, isize) ) return 0; if (info.fields.type == IOREQ_WRITE) @@ -1593,30 +1602,24 @@ static void svm_cr_access( enum instruction_index list_b[] = {INSTR_MOVCR2, INSTR_SMSW}; enum instruction_index match; - if ( inst_copy_from_guest(buffer, svm_rip2pointer(v), sizeof(buffer)) - != sizeof buffer ) - /* #PF will have been delivered if appropriate. */ + + if ( type == TYPE_MOV_TO_CR ) + { + inst_len = __get_instruction_length_from_list( + v, list_a, ARRAY_SIZE(list_a), buffer, &match); + } + else /* type == TYPE_MOV_FROM_CR */ + { + inst_len = __get_instruction_length_from_list( + v, list_b, ARRAY_SIZE(list_b), buffer, &match); + } + + if ( inst_len == 0 ) return; /* get index to first actual instruction byte - as we will need to know where the prefix lives later on */ index = skip_prefix_bytes(buffer, sizeof(buffer)); - - if ( type == TYPE_MOV_TO_CR ) - { - inst_len = __get_instruction_length_from_list( - v, list_a, ARRAY_SIZE(list_a), &buffer[index], &match); - } - else /* type == TYPE_MOV_FROM_CR */ - { - inst_len = __get_instruction_length_from_list( - v, list_b, ARRAY_SIZE(list_b), &buffer[index], &match); - } - - if ( inst_len == 0 ) - return; - - inst_len += index; /* Check for REX prefix - it's ALWAYS the last byte of any prefix bytes */ if (index > 0 && (buffer[index-1] & 0xF0) == 0x40) @@ -1941,16 +1944,6 @@ void svm_handle_invlpg(const short invlp unsigned long g_vaddr; int inst_len; - /* - * Unknown how many bytes the invlpg instruction will take. Use the - * maximum instruction length here - */ - if ( inst_copy_from_guest(opcode, svm_rip2pointer(v), length) < length ) - { - gdprintk(XENLOG_ERR, "Error reading memory %d bytes\n", length); - return; - } - if ( invlpga ) { inst_len = __get_instruction_length(v, INSTR_INVLPGA, opcode); @@ -1965,8 +1958,8 @@ void svm_handle_invlpg(const short invlp else { /* What about multiple prefix codes? */ + inst_len = __get_instruction_length(v, INSTR_INVLPG, opcode); prefix = (is_prefix(opcode[0]) ? opcode[0] : 0); - inst_len = __get_instruction_length(v, INSTR_INVLPG, opcode); if ( inst_len <= 0 ) { gdprintk(XENLOG_ERR, "Error getting invlpg instr len\n"); diff -r f70475e8396d -r 784805591fa2 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Tue May 13 15:34:33 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue May 13 15:54:31 2008 +0100 @@ -1390,7 +1390,6 @@ static enum x86_segment vmx_outs_get_seg unsigned char inst[MAX_INST_LEN]; enum x86_segment seg = x86_seg_ds; int i; - extern int inst_copy_from_guest(unsigned char *, unsigned long, int); if ( likely(cpu_has_vmx_ins_outs_instr_info) ) { @@ -1415,7 +1414,7 @@ static enum x86_segment vmx_outs_get_seg eip += __vmread(GUEST_CS_BASE); memset(inst, 0, MAX_INST_LEN); - if ( inst_copy_from_guest(inst, eip, inst_len) != inst_len ) + if ( hvm_fetch_from_guest_virt(inst, eip, inst_len) != HVMCOPY_okay ) { gdprintk(XENLOG_ERR, "Get guest instruction failed\n"); domain_crash(current->domain); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwboe-0001HI-Mn for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpG-0004B4-UZ; Thu, 15 May 2008 11:40:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpF-0004Ag-Np for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwbp8-0000hP-KE for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:43 +0000 X-SBRS: 3.6 X-MesageID: 223238 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223238" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:39:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBdrxB017033 for ; Thu, 15 May 2008 04:39:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeCE0026338 for ; Thu, 15 May 2008 04:40:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeBhH026337 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:11 -0700 Message-Id: <200805151140.m4FBeBhH026337@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: Fix handling of phy: block devices. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210752700 -3600 # Node ID cb22b23156a4b72455d733f547d0c2a59810bed5 # Parent 53195719f7621110dab7a97a2bca292b73baa715 ioemu: Fix handling of phy: block devices. Signed-off-by: Ian Jackson --- tools/ioemu/xenstore.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 53195719f762 -r cb22b23156a4 tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Tue May 13 15:08:17 2008 +0100 +++ b/tools/ioemu/xenstore.c Wed May 14 09:11:40 2008 +0100 @@ -258,7 +258,7 @@ void xenstore_parse_domain_config(int hv } if (!strcmp(drv,"qcow")) { /* autoguess qcow vs qcow2 */ - } else if (!strcmp(drv,"file")) { + } else if (!strcmp(drv,"file") || !strcmp(drv,"phy")) { format = &bdrv_raw; } else { format = bdrv_find_format(drv); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbok-0001HL-D3 for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpM-0004Ej-JG; Thu, 15 May 2008 11:40:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpK-0004D2-1Z for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpB-0000hR-EO for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:47 +0000 X-SBRS: 3.6 X-MesageID: 223239 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223239" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:39:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBdsaL017036 for ; Thu, 15 May 2008 04:39:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeDKw026355 for ; Thu, 15 May 2008 04:40:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeDch026354 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:13 -0700 Message-Id: <200805151140.m4FBeDch026354@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] qemu: add 0xe0 prefix to r-ctrl and r-alt keycodes X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210752828 -3600 # Node ID 39566bf4c9f09cc0b14e2c8ea2963e2efdf9f469 # Parent cb22b23156a4b72455d733f547d0c2a59810bed5 qemu: add 0xe0 prefix to r-ctrl and r-alt keycodes Patch puts 0xe0 prefix before putting right alt or right cntrl keycodes. Also adds keysm definition for ISO_Left_Tab. Signed-off-by: Pat Campbell --- tools/ioemu/vnc.c | 2 ++ tools/ioemu/vnc_keysym.h | 1 + 2 files changed, 3 insertions(+) diff -r cb22b23156a4 -r 39566bf4c9f0 tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Wed May 14 09:11:40 2008 +0100 +++ b/tools/ioemu/vnc.c Wed May 14 09:13:48 2008 +0100 @@ -1333,6 +1333,8 @@ static void do_key_event(VncState *vs, i case 0x9d: /* Right CTRL */ case 0x38: /* Left ALT */ case 0xb8: /* Right ALT */ + if (keycode & 0x80) + kbd_put_keycode(0xe0); if (down) { vs->modifiers_state[keycode] = 1; kbd_put_keycode(keycode & 0x7f); diff -r cb22b23156a4 -r 39566bf4c9f0 tools/ioemu/vnc_keysym.h --- a/tools/ioemu/vnc_keysym.h Wed May 14 09:11:40 2008 +0100 +++ b/tools/ioemu/vnc_keysym.h Wed May 14 09:13:48 2008 +0100 @@ -345,6 +345,7 @@ static name2keysym_t name2keysym[]={ {"Num_Lock", 0xff7f}, /* XK_Num_Lock */ {"Pause", 0xff13}, /* XK_Pause */ {"Escape", 0xff1b}, /* XK_Escape */ +{"ISO_Left_Tab", 0xfe20},/* XK_ISO_Left_Tab */ /* localized keys */ {"BackApostrophe", 0xff21}, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:17 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:17 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbom-0001HM-SJ for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:17 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpP-0004Hf-18; Thu, 15 May 2008 11:40:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpK-0004DP-Jx for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpC-0000hT-MX for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:48 +0000 X-SBRS: 3.6 X-MesageID: 223240 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223240" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:39:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBdtur017039 for ; Thu, 15 May 2008 04:39:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeEh5026372 for ; Thu, 15 May 2008 04:40:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeEqo026371 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:14 -0700 Message-Id: <200805151140.m4FBeEqo026371@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] qemu: Send unit_attention on cd-rom not_ready to ready transition X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210752902 -3600 # Node ID a864c0c4d605efceac28106a7072aa8c1ebdea83 # Parent 39566bf4c9f09cc0b14e2c8ea2963e2efdf9f469 qemu: Send unit_attention on cd-rom not_ready to ready transition Patch sends a UNIT_ATTENTION(6), MEDIUM_MAY_HAVE_CHANGED(0x28) sense when cdrom transitions from not ready to ready. ATA Packet interface for CD-ROMS, SFF8020i.pdf. See state diagram Figure 12, page 82 and Table 44 -recommended Sense Key, ASC With patch in place HVM win2008 server guest sees the CD/DVD contents have changed when the media is switched. Signed-off-by: Pat Campbell --- tools/ioemu/hw/ide.c | 6 ++++++ 1 files changed, 6 insertions(+) diff -r 39566bf4c9f0 -r a864c0c4d605 tools/ioemu/hw/ide.c --- a/tools/ioemu/hw/ide.c Wed May 14 09:13:48 2008 +0100 +++ b/tools/ioemu/hw/ide.c Wed May 14 09:15:02 2008 +0100 @@ -289,6 +289,7 @@ #define ASC_ILLEGAL_OPCODE 0x20 #define ASC_LOGICAL_BLOCK_OOR 0x21 #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 +#define ASC_MEDIUM_MAY_HAVE_CHANGED 0x28 #define ASC_MEDIUM_NOT_PRESENT 0x3a #define ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39 @@ -1456,6 +1457,11 @@ static void ide_atapi_cmd(IDEState *s) switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: if (bdrv_is_inserted(s->bs)) { + if (s->is_cdrom && s->sense_key == SENSE_NOT_READY) { + ide_atapi_cmd_error(s, SENSE_UNIT_ATTENTION, + ASC_MEDIUM_MAY_HAVE_CHANGED); + break; + } ide_atapi_cmd_ok(s); } else { ide_atapi_cmd_error(s, SENSE_NOT_READY, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:21 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:21 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbor-0001HV-Fh for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:21 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpT-0004LR-NV; Thu, 15 May 2008 11:40:59 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpL-0004Dn-Gk for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpD-0000hP-Q2 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:49 +0000 X-SBRS: 3.6 X-MesageID: 223241 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223241" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:39:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBduKJ017042 for ; Thu, 15 May 2008 04:39:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeFCa026389 for ; Thu, 15 May 2008 04:40:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeF7Y026388 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:15 -0700 Message-Id: <200805151140.m4FBeF7Y026388@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] qemu: Fix shift-insert behavior X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210753000 -3600 # Node ID feec00994a0b06ec093a4a4779484810a138eef2 # Parent a864c0c4d605efceac28106a7072aa8c1ebdea83 qemu: Fix shift-insert behavior This patch is related to Changeset 15635:7bdc9f6407d3 [PVFB] Fix shift key for graphical vnc display. With above patch, if a user presses shift-insert, qemu sends shift down, shift up, insert down and then another shift key down (see trace below). This makes it impossible to do shift insert pasting or use guest hot shifted-Fkeys. Shift Insert trace: do_key_event():1135 keycode:2a shift down kbd_put_keycode():539 keycode:2a send shift down do_key_event():1135 keycode:d2 insert down kbd_put_keycode():539 keycode:aa send shift up kbd_put_keycode():539 keycode:e0 send insert down kbd_put_keycode():539 keycode:52 do_key_event():1135 keycode:d2 insert up kbd_put_keycode():539 keycode:e0 send insert up kbd_put_keycode():539 keycode:d2 kbd_put_keycode():539 keycode:2a send shift down do_key_event():1135 keycode:2a shift up kbd_put_keycode():539 keycode:aa send shift up This patch adds a check for the keycode being shiftable, something other than a keypad key, f1-12 , insert, del , etc. before allowing the press_shift_up() operation. Signed-off-by: Pat Campbell --- tools/ioemu/keymaps.c | 16 ++++++++++++++++ tools/ioemu/vnc.c | 9 ++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff -r a864c0c4d605 -r feec00994a0b tools/ioemu/keymaps.c --- a/tools/ioemu/keymaps.c Wed May 14 09:15:02 2008 +0100 +++ b/tools/ioemu/keymaps.c Wed May 14 09:16:40 2008 +0100 @@ -50,6 +50,7 @@ typedef struct { struct key_range *keypad_range; struct key_range *numlock_range; struct key_range *shift_range; + struct key_range *localstate_range; } kbd_layout_t; static void add_to_key_range(struct key_range **krp, int code) { @@ -132,6 +133,10 @@ static kbd_layout_t *parse_keyboard_layo add_to_key_range(&k->shift_range, keysym); //fprintf(stderr, "shift keysym %04x keycode %d\n", keysym, keycode); } + if (rest && strstr(rest, "localstate")) { + add_to_key_range(&k->localstate_range, keycode); + //fprintf(stderr, "localstate keysym %04x keycode %d\n", keysym, keycode); + } /* if(keycode&0x80) keycode=(keycode<<8)^0x80e0; */ @@ -221,3 +226,14 @@ static int keysymIsShift(void *kbd_layou return 1; return 0; } + +static int keycodeIsShiftable(void *kbd_layout, int keycode) +{ + kbd_layout_t *k = kbd_layout; + struct key_range *kr; + + for (kr = k->localstate_range; kr; kr = kr->next) + if (keycode >= kr->start && keycode <= kr->end) + return 0; + return 1; +} diff -r a864c0c4d605 -r feec00994a0b tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Wed May 14 09:15:02 2008 +0100 +++ b/tools/ioemu/vnc.c Wed May 14 09:16:40 2008 +0100 @@ -1307,6 +1307,7 @@ static void do_key_event(VncState *vs, i int keycode; int shift_keys = 0; int shift = 0; + int keypad = 0; if (is_graphic_console()) { if (sym >= 'A' && sym <= 'Z') { @@ -1363,7 +1364,8 @@ static void do_key_event(VncState *vs, i return; } - if (keycodeIsKeypad(vs->kbd_layout, keycode)) { + keypad = keycodeIsKeypad(vs->kbd_layout, keycode); + if (keypad) { /* If the numlock state needs to change then simulate an additional keypress before sending this one. This will happen if the user toggles numlock away from the VNC window. @@ -1383,13 +1385,14 @@ static void do_key_event(VncState *vs, i if (is_graphic_console()) { /* If the shift state needs to change then simulate an additional - keypress before sending this one. + keypress before sending this one. Ignore for non shiftable keys. */ if (shift && !shift_keys) { press_key_shift_down(vs, down, keycode); return; } - else if (!shift && shift_keys) { + else if (!shift && shift_keys && !keypad && + keycodeIsShiftable(vs->kbd_layout, keycode)) { press_key_shift_up(vs, down, keycode); return; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:25 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:25 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbov-0001HY-7G for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:25 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpX-0004Oz-Gg; Thu, 15 May 2008 11:41:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpP-0004G5-CU for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:55 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpI-0000hR-Gv for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:53 +0000 X-SBRS: 3.6 X-MesageID: 223242 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223242" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:39:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBdvBY017045 for ; Thu, 15 May 2008 04:39:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeGwk026406 for ; Thu, 15 May 2008 04:40:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeG4T026405 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:16 -0700 Message-Id: <200805151140.m4FBeG4T026405@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: fix block protocol mismatch on save/restore X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210753145 -3600 # Node ID 049459aec2b10628a8b7474d43a89e2a89b29405 # Parent feec00994a0b06ec093a4a4779484810a138eef2 xend: fix block protocol mismatch on save/restore The protocol field of the blkif interface is correct at startup for a guest of a different mode from dom0 (eg. 32-bit dom0, 64-bit guest). However, this property is not persisted on save, so a later restore (or migrate) will setup the block interface with the wrong mode. Signed-off-by: Herbert van den Bergh Signed-off-by: Kurt Hackel --- tools/python/xen/xend/server/blkif.py | 8 ++++++++ tools/python/xen/xm/create.py | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff -r feec00994a0b -r 049459aec2b1 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Wed May 14 09:16:40 2008 +0100 +++ b/tools/python/xen/xend/server/blkif.py Wed May 14 09:19:05 2008 +0100 @@ -88,6 +88,10 @@ class BlkifController(DevController): front = { 'virtual-device' : "%i" % devid, 'device-type' : dev_type } + + protocol = config.get('protocol') + if protocol: + front['protocol'] = protocol return (devid, back, front) @@ -162,6 +166,10 @@ class BlkifController(DevController): if uuid: config['uuid'] = uuid + proto = self.readFrontend(devid, 'protocol') + if proto: + config['protocol'] = proto + return config def destroyDevice(self, devid, force): diff -r feec00994a0b -r 049459aec2b1 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Wed May 14 09:16:40 2008 +0100 +++ b/tools/python/xen/xm/create.py Wed May 14 09:19:05 2008 +0100 @@ -610,7 +610,7 @@ def configure_disks(config_devs, vals): def configure_disks(config_devs, vals): """Create the config for disks (virtual block devices). """ - for (uname, dev, mode, backend) in vals.disk: + for (uname, dev, mode, backend, protocol) in vals.disk: if uname.startswith('tap:'): cls = 'tap' else: @@ -622,6 +622,8 @@ def configure_disks(config_devs, vals): ['mode', mode ] ] if backend: config_vbd.append(['backend', backend]) + if protocol: + config_vbd.append(['protocol', protocol]) config_devs.append(['device', config_vbd]) def configure_pci(config_devs, vals): @@ -845,7 +847,10 @@ def preprocess_disk(vals): n = len(d) if n == 3: d.append(None) + d.append(None) elif n == 4: + d.append(None) + elif n == 5: pass else: err('Invalid disk specifier: ' + v) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:30 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:30 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbp0-0001Hc-0Y for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:30 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpb-0004Sk-T5; Thu, 15 May 2008 11:41:07 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpP-0004Go-TF for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpJ-0000hT-3E for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:53 +0000 X-SBRS: 3.6 X-MesageID: 223244 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223244" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:39:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBdxSH017048 for ; Thu, 15 May 2008 04:39:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeHSR026424 for ; Thu, 15 May 2008 04:40:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeH8B026423 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:17 -0700 Message-Id: <200805151140.m4FBeH8B026423@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] hvm_op: Fix public header file to provide limited exposure to X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210753904 -3600 # Node ID fa8cb2a8ed52b164177583923c9c6a942d81b812 # Parent 049459aec2b10628a8b7474d43a89e2a89b29405 hvm_op: Fix public header file to provide limited exposure to tools-only interface. Signed-off-by: Keir Fraser --- xen/include/public/hvm/hvm_op.h | 5 +++++ 1 files changed, 5 insertions(+) diff -r 049459aec2b1 -r fa8cb2a8ed52 xen/include/public/hvm/hvm_op.h --- a/xen/include/public/hvm/hvm_op.h Wed May 14 09:19:05 2008 +0100 +++ b/xen/include/public/hvm/hvm_op.h Wed May 14 09:31:44 2008 +0100 @@ -73,6 +73,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_ /* Flushes all VCPU TLBs: @arg must be NULL. */ #define HVMOP_flush_tlbs 5 +/* Following tools-only interfaces may change in future. */ +#if defined(__XEN__) || defined(__XEN_TOOLS__) + /* Track dirty VRAM. */ #define HVMOP_track_dirty_vram 6 struct xen_hvm_track_dirty_vram { @@ -89,4 +92,6 @@ typedef struct xen_hvm_track_dirty_vram typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t; DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t); +#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ + #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:34 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:34 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbp4-0001Hf-9I for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:34 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpg-0004W8-Bn; Thu, 15 May 2008 11:41:12 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpQ-0004Hk-PX for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpJ-0000hP-W6 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:54 +0000 X-SBRS: 3.6 X-MesageID: 223245 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223245" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:00 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBe0sM017051 for ; Thu, 15 May 2008 04:40:00 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeI4e026442 for ; Thu, 15 May 2008 04:40:18 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeI4j026441 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:18 -0700 Message-Id: <200805151140.m4FBeI4j026441@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:18 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix XEN_SYSCTL_physinfo to handle NUMA info properly. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210755145 -3600 # Node ID 547d10d2d38473e84fb47e8bbcde96b1dfe793cc # Parent fa8cb2a8ed52b164177583923c9c6a942d81b812 Fix XEN_SYSCTL_physinfo to handle NUMA info properly. Signed-off-by: Andre Przywara Signed-off-by: Keir Fraser --- xen/arch/ia64/xen/dom0_ops.c | 10 +++++++--- xen/arch/x86/sysctl.c | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff -r fa8cb2a8ed52 -r 547d10d2d384 xen/arch/ia64/xen/dom0_ops.c --- a/xen/arch/ia64/xen/dom0_ops.c Wed May 14 09:31:44 2008 +0100 +++ b/xen/arch/ia64/xen/dom0_ops.c Wed May 14 09:52:25 2008 +0100 @@ -407,10 +407,15 @@ long arch_do_sysctl(xen_sysctl_t *op, XE { int i; uint32_t max_array_ent; + XEN_GUEST_HANDLE_64(uint32) cpu_to_node_arr; xen_sysctl_physinfo_t *pi = &op->u.physinfo; + max_array_ent = pi->max_cpu_id; + cpu_to_node_arr = pi->cpu_to_node; + memset(pi, 0, sizeof(*pi)); + pi->cpu_to_node = cpu_to_node_arr; pi->threads_per_core = cpus_weight(cpu_sibling_map[0]); pi->cores_per_socket = cpus_weight(cpu_core_map[0]) / pi->threads_per_core; @@ -421,16 +426,15 @@ long arch_do_sysctl(xen_sysctl_t *op, XE pi->scrub_pages = avail_scrub_pages(); pi->cpu_khz = local_cpu_data->proc_freq / 1000; - max_array_ent = pi->max_cpu_id; pi->max_cpu_id = last_cpu(cpu_online_map); max_array_ent = min_t(uint32_t, max_array_ent, pi->max_cpu_id); ret = 0; - if (!guest_handle_is_null(pi->cpu_to_node)) { + if (!guest_handle_is_null(cpu_to_node_arr)) { for (i = 0; i <= max_array_ent; i++) { uint32_t node = cpu_online(i) ? cpu_to_node(i) : ~0u; - if (copy_to_guest_offset(pi->cpu_to_node, i, &node, 1)) { + if (copy_to_guest_offset(cpu_to_node_arr, i, &node, 1)) { ret = -EFAULT; break; } diff -r fa8cb2a8ed52 -r 547d10d2d384 xen/arch/x86/sysctl.c --- a/xen/arch/x86/sysctl.c Wed May 14 09:31:44 2008 +0100 +++ b/xen/arch/x86/sysctl.c Wed May 14 09:52:25 2008 +0100 @@ -40,6 +40,7 @@ long arch_do_sysctl( case XEN_SYSCTL_physinfo: { uint32_t i, max_array_ent; + XEN_GUEST_HANDLE_64(uint32) cpu_to_node_arr; xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo; @@ -47,7 +48,11 @@ long arch_do_sysctl( if ( ret ) break; + max_array_ent = pi->max_cpu_id; + cpu_to_node_arr = pi->cpu_to_node; + memset(pi, 0, sizeof(*pi)); + pi->cpu_to_node = cpu_to_node_arr; pi->threads_per_core = cpus_weight(cpu_sibling_map[0]); pi->cores_per_socket = @@ -64,22 +69,26 @@ long arch_do_sysctl( if ( iommu_enabled ) pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm_directio; - max_array_ent = pi->max_cpu_id; pi->max_cpu_id = last_cpu(cpu_online_map); max_array_ent = min_t(uint32_t, max_array_ent, pi->max_cpu_id); - ret = -EFAULT; - if ( !guest_handle_is_null(pi->cpu_to_node) ) + ret = 0; + + if ( !guest_handle_is_null(cpu_to_node_arr) ) { for ( i = 0; i <= max_array_ent; i++ ) { uint32_t node = cpu_online(i) ? cpu_to_node(i) : ~0u; - if ( copy_to_guest_offset(pi->cpu_to_node, i, &node, 1) ) + if ( copy_to_guest_offset(cpu_to_node_arr, i, &node, 1) ) + { + ret = -EFAULT; break; + } } } - ret = copy_to_guest(u_sysctl, sysctl, 1) ? -EFAULT : 0; + if ( copy_to_guest(u_sysctl, sysctl, 1) ) + ret = -EFAULT; } break; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:40 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:40 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbp9-0001Hk-RC for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:40 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpl-0004ae-Ri; Thu, 15 May 2008 11:41:18 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpU-0004Kl-Ky for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:00 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpN-0000hR-Rn for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:58 +0000 X-SBRS: 3.6 X-MesageID: 223246 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223246" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:02 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBe1JE017054 for ; Thu, 15 May 2008 04:40:01 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeJtI026459 for ; Thu, 15 May 2008 04:40:19 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeJR7026458 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:19 -0700 Message-Id: <200805151140.m4FBeJR7026458@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:19 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ia64: fix domain restore X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210767919 -3600 # Node ID b57642bcea300036e151d4f8776b58eb66acb707 # Parent 547d10d2d38473e84fb47e8bbcde96b1dfe793cc ia64: fix domain restore A domain fails to restore on IA64 since cset 17524:18727843db60. This patch fixes it temporarily. Guest CPUID configuration for IA64 might be implemented in the future. Signed-off-by: Kouya Shimura --- tools/python/xen/xend/image.py | 3 +++ 1 files changed, 3 insertions(+) diff -r 547d10d2d384 -r b57642bcea30 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Wed May 14 09:52:25 2008 +0100 +++ b/tools/python/xen/xend/image.py Wed May 14 13:25:19 2008 +0100 @@ -720,6 +720,9 @@ class IA64_HVM_ImageHandler(HVMImageHand (self.getRequiredInitialReservation() / 1024) ]) return args + def setCpuid(self): + # Guest CPUID configuration is not implemented yet. + return class IA64_Linux_ImageHandler(LinuxImageHandler): _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:43 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:43 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JwbpD-0001Hx-D8 for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:43 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpp-0004dz-Hf; Thu, 15 May 2008 11:41:21 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpW-0004MV-DV for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:02 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpO-0000hT-CQ for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:40:59 +0000 X-SBRS: 3.6 X-MesageID: 223248 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223248" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:03 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBe2DN017057 for ; Thu, 15 May 2008 04:40:02 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeL4a026476 for ; Thu, 15 May 2008 04:40:21 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeLuF026475 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:21 -0700 Message-Id: <200805151140.m4FBeLuF026475@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:20 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Get ACPI Px from dom0 and choose Px controller X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210769446 -3600 # Node ID 66ddfc4d69631a069d8914bff12bd54fe97a4e9f # Parent b57642bcea300036e151d4f8776b58eb66acb707 Get ACPI Px from dom0 and choose Px controller Add platform op hypercall case to get ACPI Px info from dom0. Chose Px controller from dom0 (cpufreq=dom0-kernel) or hypervisor (cpufreq=xen). Signed-off-by: Liu Jinsong --- xen/arch/x86/acpi/Makefile | 2 xen/arch/x86/acpi/cpu_idle.c | 2 xen/arch/x86/acpi/cpufreq/Makefile | 1 xen/arch/x86/acpi/cpufreq/cpufreq.c | 52 +++++++++++++++++++++++ xen/arch/x86/platform_hypercall.c | 66 ++++++++++++++++++++++++++++-- xen/arch/x86/setup.c | 17 +++++-- xen/arch/x86/x86_64/platform_hypercall.c | 6 ++ xen/common/domain.c | 10 ++++ xen/include/acpi/cpufreq/processor_perf.h | 30 +++++++++++++ xen/include/public/platform.h | 51 ++++++++++++++++++++++- xen/include/xen/domain.h | 2 11 files changed, 229 insertions(+), 10 deletions(-) diff -r b57642bcea30 -r 66ddfc4d6963 xen/arch/x86/acpi/Makefile --- a/xen/arch/x86/acpi/Makefile Wed May 14 13:25:19 2008 +0100 +++ b/xen/arch/x86/acpi/Makefile Wed May 14 13:50:46 2008 +0100 @@ -1,2 +1,4 @@ obj-y += boot.o +subdir-y += cpufreq + obj-y += boot.o obj-y += power.o suspend.o wakeup_prot.o cpu_idle.o diff -r b57642bcea30 -r 66ddfc4d6963 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Wed May 14 13:25:19 2008 +0100 +++ b/xen/arch/x86/acpi/cpu_idle.c Wed May 14 13:50:46 2008 +0100 @@ -834,7 +834,7 @@ static int set_cx(struct acpi_processor_ return 0; } -static int get_cpu_id(u8 acpi_id) +int get_cpu_id(u8 acpi_id) { int i; u8 apic_id; diff -r b57642bcea30 -r 66ddfc4d6963 xen/arch/x86/acpi/cpufreq/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/acpi/cpufreq/Makefile Wed May 14 13:50:46 2008 +0100 @@ -0,0 +1,1 @@ +obj-y += cpufreq.o diff -r b57642bcea30 -r 66ddfc4d6963 xen/arch/x86/acpi/cpufreq/cpufreq.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Wed May 14 13:50:46 2008 +0100 @@ -0,0 +1,52 @@ +/* + * cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.4 $) + * + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * Copyright (C) 2002 - 2004 Dominik Brodowski + * Copyright (C) 2006 Denis Sadykov + * + * Feb 2008 - Liu Jinsong + * porting acpi-cpufreq.c from Linux 2.6.23 to Xen hypervisor + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct processor_pminfo processor_pminfo[NR_CPUS]; + +int acpi_cpufreq_init(void) +{ + return 0; +} diff -r b57642bcea30 -r 66ddfc4d6963 xen/arch/x86/platform_hypercall.c --- a/xen/arch/x86/platform_hypercall.c Wed May 14 13:25:19 2008 +0100 +++ b/xen/arch/x86/platform_hypercall.c Wed May 14 13:50:46 2008 +0100 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include "cpu/mtrr/mtrr.h" @@ -346,9 +347,68 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe switch ( op->u.set_pminfo.type ) { case XEN_PM_PX: - ret = -EINVAL; - break; - + { + static int cpu_count = 0; + struct xenpf_set_processor_pminfo *xenpmpt = &op->u.set_pminfo; + struct xen_processor_performance *xenpxpt = &op->u.set_pminfo.perf; + int cpuid = get_cpu_id(xenpmpt->id); + struct processor_pminfo *pmpt; + struct processor_performance *pxpt; + + if ( cpuid < 0 ) + { + ret = -EINVAL; + break; + } + pmpt = &processor_pminfo[cpuid]; + pxpt = &processor_pminfo[cpuid].perf; + pmpt->acpi_id = xenpmpt->id; + pmpt->id = cpuid; + + if ( xenpxpt->flags & XEN_PX_PCT ) + { + memcpy ((void *)&pxpt->control_register, + (void *)&xenpxpt->control_register, + sizeof(struct xen_pct_register)); + memcpy ((void *)&pxpt->status_register, + (void *)&xenpxpt->status_register, + sizeof(struct xen_pct_register)); + } + if ( xenpxpt->flags & XEN_PX_PSS ) + { + if ( !(pxpt->states = xmalloc_array(struct xen_processor_px, + xenpxpt->state_count)) ) + { + ret = -ENOMEM; + break; + } + if ( copy_from_compat(pxpt->states, xenpxpt->states, + xenpxpt->state_count) ) + { + xfree(pxpt->states); + ret = -EFAULT; + break; + } + pxpt->state_count = xenpxpt->state_count; + } + if ( xenpxpt->flags & XEN_PX_PSD ) + { + pxpt->shared_type = xenpxpt->shared_type; + memcpy ((void *)&pxpt->domain_info, + (void *)&xenpxpt->domain_info, + sizeof(struct xen_psd_package)); + } + if ( xenpxpt->flags & XEN_PX_PPC ) + pxpt->ppc = xenpxpt->ppc; + + if ( xenpxpt->flags == ( XEN_PX_PCT | XEN_PX_PSS | + XEN_PX_PSD | XEN_PX_PPC ) ) + cpu_count++; + if ( cpu_count == num_online_cpus() ) + ret = acpi_cpufreq_init(); + break; + } + case XEN_PM_CX: ret = set_cx_pminfo(op->u.set_pminfo.id, &op->u.set_pminfo.power); break; diff -r b57642bcea30 -r 66ddfc4d6963 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Wed May 14 13:25:19 2008 +0100 +++ b/xen/arch/x86/setup.c Wed May 14 13:50:46 2008 +0100 @@ -95,9 +95,9 @@ boolean_param("noapic", skip_ioapic_setu boolean_param("noapic", skip_ioapic_setup); /* **** Linux config option: propagated to domain0. */ -/* xen_processor_pm: xen control cstate. */ -static int xen_processor_pm; -boolean_param("xen_processor_pm", xen_processor_pm); +/* xen_cpuidle: xen control cstate. */ +static int xen_cpuidle; +boolean_param("cpuidle", xen_cpuidle); int early_boot = 1; @@ -988,6 +988,7 @@ void __init __start_xen(unsigned long mb if ( (cmdline != NULL) || (kextra != NULL) ) { static char dom0_cmdline[MAX_GUEST_CMDLINE]; + char xen_pm_param[32]; cmdline = cmdline_cook(cmdline); safe_strcpy(dom0_cmdline, cmdline); @@ -1012,8 +1013,14 @@ void __init __start_xen(unsigned long mb safe_strcat(dom0_cmdline, " acpi="); safe_strcat(dom0_cmdline, acpi_param); } - if ( xen_processor_pm && !strstr(dom0_cmdline, "xen_processor_pmbits=") ) - safe_strcat(dom0_cmdline, " xen_processor_pmbits=1"); + if ( xen_cpuidle ) + xen_processor_pmbits |= XEN_PROCESSOR_PM_CX; + + snprintf(xen_pm_param, sizeof(xen_pm_param), + " xen_processor_pmbits=%d", xen_processor_pmbits); + + if ( !strstr(dom0_cmdline, "xen_processor_pmbits=") ) + safe_strcat(dom0_cmdline, xen_pm_param); cmdline = dom0_cmdline; } diff -r b57642bcea30 -r 66ddfc4d6963 xen/arch/x86/x86_64/platform_hypercall.c --- a/xen/arch/x86/x86_64/platform_hypercall.c Wed May 14 13:25:19 2008 +0100 +++ b/xen/arch/x86/x86_64/platform_hypercall.c Wed May 14 13:50:46 2008 +0100 @@ -10,6 +10,12 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_ #define xen_platform_op compat_platform_op #define xen_platform_op_t compat_platform_op_t #define do_platform_op(x) compat_platform_op(_##x) + +#define xen_processor_px compat_processor_px +#define xen_processor_px_t compat_processor_px_t +#define xen_processor_performance compat_processor_performance +#define xen_processor_performance_t compat_processor_performance_t +#define xenpf_set_processor_pminfo compat_pf_set_processor_pminfo #define xen_processor_power compat_processor_power #define xen_processor_power_t compat_processor_power_t diff -r b57642bcea30 -r 66ddfc4d6963 xen/common/domain.c --- a/xen/common/domain.c Wed May 14 13:25:19 2008 +0100 +++ b/xen/common/domain.c Wed May 14 13:50:46 2008 +0100 @@ -30,6 +30,10 @@ #include #include +/* Linux config option: propageted to domain0 */ +/* xen_processor_pmbits: xen control Cx, Px, ... */ +unsigned int xen_processor_pmbits = 0; + /* opt_dom0_vcpus_pin: If true, dom0 VCPUs are pinned. */ static unsigned int opt_dom0_vcpus_pin; boolean_param("dom0_vcpus_pin", opt_dom0_vcpus_pin); @@ -39,8 +43,14 @@ static void __init setup_cpufreq_option( { if ( !strcmp(str, "dom0-kernel") ) { + xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX; cpufreq_controller = FREQCTL_dom0_kernel; opt_dom0_vcpus_pin = 1; + } + else if ( !strcmp(str, "xen") ) + { + xen_processor_pmbits |= XEN_PROCESSOR_PM_PX; + cpufreq_controller = FREQCTL_none; } } custom_param("cpufreq", setup_cpufreq_option); diff -r b57642bcea30 -r 66ddfc4d6963 xen/include/acpi/cpufreq/processor_perf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/include/acpi/cpufreq/processor_perf.h Wed May 14 13:50:46 2008 +0100 @@ -0,0 +1,30 @@ +#ifndef __XEN_PROCESSOR_PM_H__ +#define __XEN_PROCESSOR_PM_H__ + +#include + +int get_cpu_id(u8); +int acpi_cpufreq_init(void); + +struct processor_performance { + uint32_t state; + uint32_t ppc; + struct xen_pct_register control_register; + struct xen_pct_register status_register; + uint32_t state_count; + struct xen_processor_px *states; + struct xen_psd_package domain_info; + cpumask_t shared_cpu_map; + uint32_t shared_type; +}; + +struct processor_pminfo { + uint32_t acpi_id; + uint32_t id; + uint32_t flag; + struct processor_performance perf; +}; + +extern struct processor_pminfo processor_pminfo[NR_CPUS]; + +#endif /* __XEN_PROCESSOR_PM_H__ */ diff -r b57642bcea30 -r 66ddfc4d6963 xen/include/public/platform.h --- a/xen/include/public/platform.h Wed May 14 13:25:19 2008 +0100 +++ b/xen/include/public/platform.h Wed May 14 13:50:46 2008 +0100 @@ -211,6 +211,12 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_getidletim #define XEN_PM_PX 1 #define XEN_PM_TX 2 +/* Px sub info type */ +#define XEN_PX_PCT 1 +#define XEN_PX_PSS 2 +#define XEN_PX_PPC 4 +#define XEN_PX_PSD 8 + struct xen_power_register { uint32_t space_id; uint32_t bit_width; @@ -252,12 +258,55 @@ struct xen_processor_power { XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */ }; +struct xen_pct_register { + uint8_t descriptor; + uint16_t length; + uint8_t space_id; + uint8_t bit_width; + uint8_t bit_offset; + uint8_t reserved; + uint64_t address; +}; + +struct xen_processor_px { + uint64_t core_frequency; /* megahertz */ + uint64_t power; /* milliWatts */ + uint64_t transition_latency; /* microseconds */ + uint64_t bus_master_latency; /* microseconds */ + uint64_t control; /* control value */ + uint64_t status; /* success indicator */ +}; +typedef struct xen_processor_px xen_processor_px_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_px_t); + +struct xen_psd_package { + uint64_t num_entries; + uint64_t revision; + uint64_t domain; + uint64_t coord_type; + uint64_t num_processors; +}; + +struct xen_processor_performance { + uint32_t flags; /* flag for Px sub info type */ + uint32_t ppc; /* Platform limitation on freq usage */ + struct xen_pct_register control_register; + struct xen_pct_register status_register; + uint32_t state_count; /* total available performance states */ + XEN_GUEST_HANDLE(xen_processor_px_t) states; + struct xen_psd_package domain_info; + uint32_t shared_type; /* coordination type of this processor */ +}; +typedef struct xen_processor_performance xen_processor_performance_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_performance_t); + struct xenpf_set_processor_pminfo { /* IN variables */ uint32_t id; /* ACPI CPU ID */ - uint32_t type; /* {XEN_PM_CX, ...} */ + uint32_t type; /* {XEN_PM_CX, XEN_PM_PX} */ union { struct xen_processor_power power;/* Cx: _CST/_CSD */ + struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ }; }; typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; diff -r b57642bcea30 -r 66ddfc4d6963 xen/include/xen/domain.h --- a/xen/include/xen/domain.h Wed May 14 13:25:19 2008 +0100 +++ b/xen/include/xen/domain.h Wed May 14 13:50:46 2008 +0100 @@ -57,4 +57,6 @@ void arch_dump_domain_info(struct domain int arch_vcpu_reset(struct vcpu *v); +extern unsigned int xen_processor_pmbits; + #endif /* __XEN_DOMAIN_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:48 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:48 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JwbpH-0001I0-9Y for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:48 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpt-0004hg-Hl; Thu, 15 May 2008 11:41:25 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbpY-0004Nr-4m for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:04 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpP-0000hP-8Y for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:01 +0000 X-SBRS: 3.6 X-MesageID: 223249 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223249" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:04 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBe4mw017060 for ; Thu, 15 May 2008 04:40:04 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeMYX026493 for ; Thu, 15 May 2008 04:40:22 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeMcc026492 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:22 -0700 Message-Id: <200805151140.m4FBeMcc026492@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:21 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Setup cpufreq infrasturcture, driver and tools X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210769711 -3600 # Node ID 50fb7620d05ad869f354619e9fdf72e316c0d2b5 # Parent 66ddfc4d69631a069d8914bff12bd54fe97a4e9f x86: Setup cpufreq infrasturcture, driver and tools Initializing basic Px data structure, setup cpufreq infrastructure: * cpufreq data structure initializing, including freq table and policy; * basic driver and tools, to measure freq or drive to Px target; * setup _PSD domain to coordinately work; Signed-off-by: Liu Jinsong --- xen/arch/x86/acpi/cpufreq/Makefile | 2 xen/arch/x86/acpi/cpufreq/cpufreq.c | 557 ++++++++++++++++++++++++++- xen/arch/x86/acpi/cpufreq/cpufreq_ondemand.c | 6 xen/arch/x86/acpi/cpufreq/utility.c | 167 ++++++++ xen/include/acpi/cpufreq/cpufreq.h | 129 ++++++ 5 files changed, 858 insertions(+), 3 deletions(-) diff -r 66ddfc4d6963 -r 50fb7620d05a xen/arch/x86/acpi/cpufreq/Makefile --- a/xen/arch/x86/acpi/cpufreq/Makefile Wed May 14 13:50:46 2008 +0100 +++ b/xen/arch/x86/acpi/cpufreq/Makefile Wed May 14 13:55:11 2008 +0100 @@ -1,1 +1,3 @@ obj-y += cpufreq.o obj-y += cpufreq.o +obj-y += utility.o +obj-y += cpufreq_ondemand.o diff -r 66ddfc4d6963 -r 50fb7620d05a xen/arch/x86/acpi/cpufreq/cpufreq.c --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Wed May 14 13:50:46 2008 +0100 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Wed May 14 13:55:11 2008 +0100 @@ -42,11 +42,562 @@ #include #include #include -#include +#include struct processor_pminfo processor_pminfo[NR_CPUS]; +struct cpufreq_policy xen_px_policy[NR_CPUS]; + +enum { + UNDEFINED_CAPABLE = 0, + SYSTEM_INTEL_MSR_CAPABLE, + SYSTEM_IO_CAPABLE, +}; + +#define INTEL_MSR_RANGE (0xffff) +#define CPUID_6_ECX_APERFMPERF_CAPABILITY (0x1) + +struct acpi_cpufreq_data { + struct processor_performance *acpi_data; + struct cpufreq_frequency_table *freq_table; + unsigned int max_freq; + unsigned int resume; + unsigned int cpu_feature; +}; + +static struct acpi_cpufreq_data *drv_data[NR_CPUS]; + +static struct cpufreq_driver acpi_cpufreq_driver; + +static int check_est_cpu(unsigned int cpuid) +{ + struct cpuinfo_x86 *cpu = &cpu_data[cpuid]; + + if (cpu->x86_vendor != X86_VENDOR_INTEL || + !cpu_has(cpu, X86_FEATURE_EST)) + return 0; + + return 1; +} + +static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data) +{ + struct processor_performance *perf; + int i; + + perf = data->acpi_data; + + for (i=0; istate_count; i++) { + if (value == perf->states[i].status) + return data->freq_table[i].frequency; + } + return 0; +} + +static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) +{ + int i; + struct processor_performance *perf; + + msr &= INTEL_MSR_RANGE; + perf = data->acpi_data; + + for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { + if (msr == perf->states[data->freq_table[i].index].status) + return data->freq_table[i].frequency; + } + return data->freq_table[0].frequency; +} + +static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data) +{ + switch (data->cpu_feature) { + case SYSTEM_INTEL_MSR_CAPABLE: + return extract_msr(val, data); + case SYSTEM_IO_CAPABLE: + return extract_io(val, data); + default: + return 0; + } +} + +struct msr_addr { + u32 reg; +}; + +struct io_addr { + u16 port; + u8 bit_width; +}; + +typedef union { + struct msr_addr msr; + struct io_addr io; +} drv_addr_union; + +struct drv_cmd { + unsigned int type; + cpumask_t mask; + drv_addr_union addr; + u32 val; +}; + +static void do_drv_read(struct drv_cmd *cmd) +{ + u32 h; + + switch (cmd->type) { + case SYSTEM_INTEL_MSR_CAPABLE: + rdmsr(cmd->addr.msr.reg, cmd->val, h); + break; + case SYSTEM_IO_CAPABLE: + acpi_os_read_port((acpi_io_address)cmd->addr.io.port, + &cmd->val, (u32)cmd->addr.io.bit_width); + break; + default: + break; + } +} + +static void do_drv_write(void *drvcmd) +{ + struct drv_cmd *cmd; + u32 lo, hi; + + cmd = (struct drv_cmd *)drvcmd; + + switch (cmd->type) { + case SYSTEM_INTEL_MSR_CAPABLE: + rdmsr(cmd->addr.msr.reg, lo, hi); + lo = (lo & ~INTEL_MSR_RANGE) | (cmd->val & INTEL_MSR_RANGE); + wrmsr(cmd->addr.msr.reg, lo, hi); + break; + case SYSTEM_IO_CAPABLE: + acpi_os_write_port((acpi_io_address)cmd->addr.io.port, + cmd->val, (u32)cmd->addr.io.bit_width); + break; + default: + break; + } +} + +static void drv_read(struct drv_cmd *cmd) +{ + cmd->val = 0; + + do_drv_read(cmd); +} + +static void drv_write(struct drv_cmd *cmd) +{ + on_selected_cpus( cmd->mask, do_drv_write, (void *)cmd, 0, 0); +} + +static u32 get_cur_val(cpumask_t mask) +{ + struct processor_performance *perf; + struct drv_cmd cmd; + + if (unlikely(cpus_empty(mask))) + return 0; + + switch (drv_data[first_cpu(mask)]->cpu_feature) { + case SYSTEM_INTEL_MSR_CAPABLE: + cmd.type = SYSTEM_INTEL_MSR_CAPABLE; + cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; + break; + case SYSTEM_IO_CAPABLE: + cmd.type = SYSTEM_IO_CAPABLE; + perf = drv_data[first_cpu(mask)]->acpi_data; + cmd.addr.io.port = perf->control_register.address; + cmd.addr.io.bit_width = perf->control_register.bit_width; + break; + default: + return 0; + } + + cmd.mask = mask; + + drv_read(&cmd); + return cmd.val; +} + +/* + * Return the measured active (C0) frequency on this CPU since last call + * to this function. + * Input: cpu number + * Return: Average CPU frequency in terms of max frequency (zero on error) + * + * We use IA32_MPERF and IA32_APERF MSRs to get the measured performance + * over a period of time, while CPU is in C0 state. + * IA32_MPERF counts at the rate of max advertised frequency + * IA32_APERF counts at the rate of actual CPU frequency + * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and + * no meaning should be associated with absolute values of these MSRs. + */ +/* FIXME: handle query on non-current cpu later */ +static unsigned int get_measured_perf(unsigned int cpu) +{ + union { + struct { + uint32_t lo; + uint32_t hi; + } split; + uint64_t whole; + } aperf_cur, mperf_cur; + + unsigned int perf_percent; + unsigned int retval; + + rdmsr(MSR_IA32_APERF, aperf_cur.split.lo, aperf_cur.split.hi); + rdmsr(MSR_IA32_MPERF, mperf_cur.split.lo, mperf_cur.split.hi); + + wrmsr(MSR_IA32_APERF, 0,0); + wrmsr(MSR_IA32_MPERF, 0,0); + + if (unlikely(((unsigned long)(-1) / 100) < aperf_cur.whole)) { + int shift_count = 7; + aperf_cur.whole >>= shift_count; + mperf_cur.whole >>= shift_count; + } + + if (aperf_cur.whole && mperf_cur.whole) + perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole; + else + perf_percent = 0; + + + retval = drv_data[cpu]->max_freq * perf_percent / 100; + return retval; +} + +static unsigned int get_cur_freq_on_cpu(unsigned int cpu) +{ + struct acpi_cpufreq_data *data = drv_data[cpu]; + unsigned int freq; + + if (unlikely(data == NULL || + data->acpi_data == NULL || data->freq_table == NULL)) { + return 0; + } + + freq = extract_freq(get_cur_val(cpumask_of_cpu(cpu)), data); + return freq; +} + +static unsigned int check_freqs(cpumask_t mask, unsigned int freq, + struct acpi_cpufreq_data *data) +{ + unsigned int cur_freq; + unsigned int i; + + for (i=0; i<100; i++) { + cur_freq = extract_freq(get_cur_val(mask), data); + if (cur_freq == freq) + return 1; + udelay(10); + } + return 0; +} + +static int acpi_cpufreq_target(struct cpufreq_policy *policy, + unsigned int target_freq, unsigned int relation) +{ + struct acpi_cpufreq_data *data = drv_data[policy->cpu]; + struct processor_performance *perf; + struct cpufreq_freqs freqs; + cpumask_t online_policy_cpus; + struct drv_cmd cmd; + unsigned int next_state = 0; /* Index into freq_table */ + unsigned int next_perf_state = 0; /* Index into perf table */ + int result = 0; + + if (unlikely(data == NULL || + data->acpi_data == NULL || data->freq_table == NULL)) { + return -ENODEV; + } + + perf = data->acpi_data; + result = cpufreq_frequency_table_target(policy, + data->freq_table, + target_freq, + relation, &next_state); + if (unlikely(result)) + return -ENODEV; + + online_policy_cpus = policy->cpus; + + next_perf_state = data->freq_table[next_state].index; + if (perf->state == next_perf_state) { + if (unlikely(data->resume)) { + printk("xen_pminfo: @acpi_cpufreq_target, " + "Called after resume, resetting to P%d\n", + next_perf_state); + data->resume = 0; + } + else + return 0; + } + + switch (data->cpu_feature) { + case SYSTEM_INTEL_MSR_CAPABLE: + cmd.type = SYSTEM_INTEL_MSR_CAPABLE; + cmd.addr.msr.reg = MSR_IA32_PERF_CTL; + cmd.val = (u32) perf->states[next_perf_state].control; + break; + case SYSTEM_IO_CAPABLE: + cmd.type = SYSTEM_IO_CAPABLE; + cmd.addr.io.port = perf->control_register.address; + cmd.addr.io.bit_width = perf->control_register.bit_width; + cmd.val = (u32) perf->states[next_perf_state].control; + break; + default: + return -ENODEV; + } + + cpus_clear(cmd.mask); + + if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY) + cmd.mask = online_policy_cpus; + else + cpu_set(policy->cpu, cmd.mask); + + freqs.old = perf->states[perf->state].core_frequency * 1000; + freqs.new = data->freq_table[next_state].frequency; + + drv_write(&cmd); + + if (!check_freqs(cmd.mask, freqs.new, data)) + return -EAGAIN; + + perf->state = next_perf_state; + policy->cur = freqs.new; + + return result; +} + +static unsigned long +acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) +{ + struct processor_performance *perf = data->acpi_data; + + if (cpu_khz) { + /* search the closest match to cpu_khz */ + unsigned int i; + unsigned long freq; + unsigned long freqn = perf->states[0].core_frequency * 1000; + + for (i=0; i<(perf->state_count-1); i++) { + freq = freqn; + freqn = perf->states[i+1].core_frequency * 1000; + if ((2 * cpu_khz) > (freqn + freq)) { + perf->state = i; + return freq; + } + } + perf->state = perf->state_count-1; + return freqn; + } else { + /* assume CPU is at P0... */ + perf->state = 0; + return perf->states[0].core_frequency * 1000; + } +} + +static int +acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) +{ + unsigned int i; + unsigned int valid_states = 0; + unsigned int cpu = policy->cpu; + struct acpi_cpufreq_data *data; + unsigned int result = 0; + struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; + struct processor_performance *perf; + + data = xmalloc(struct acpi_cpufreq_data); + if (!data) + return -ENOMEM; + memset(data, 0, sizeof(struct acpi_cpufreq_data)); + + drv_data[cpu] = data; + + data->acpi_data = &processor_pminfo[cpu].perf; + + perf = data->acpi_data; + policy->shared_type = perf->shared_type; + + /* + * Will let policy->cpus know about dependency only when software + * coordination is required. + */ + if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || + policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { + policy->cpus = perf->shared_cpu_map; + } else { + policy->cpus = cpumask_of_cpu(cpu); + } + + /* capability check */ + if (perf->state_count <= 1) { + printk("No P-States\n"); + result = -ENODEV; + goto err_unreg; + } + + if (perf->control_register.space_id != perf->status_register.space_id) { + result = -ENODEV; + goto err_unreg; + } + + switch (perf->control_register.space_id) { + case ACPI_ADR_SPACE_SYSTEM_IO: + printk("xen_pminfo: @acpi_cpufreq_cpu_init," + "SYSTEM IO addr space\n"); + data->cpu_feature = SYSTEM_IO_CAPABLE; + break; + case ACPI_ADR_SPACE_FIXED_HARDWARE: + printk("xen_pminfo: @acpi_cpufreq_cpu_init," + "HARDWARE addr space\n"); + if (!check_est_cpu(cpu)) { + result = -ENODEV; + goto err_unreg; + } + data->cpu_feature = SYSTEM_INTEL_MSR_CAPABLE; + break; + default: + result = -ENODEV; + goto err_unreg; + } + + data->freq_table = xmalloc_array(struct cpufreq_frequency_table, + (perf->state_count+1)); + if (!data->freq_table) { + result = -ENOMEM; + goto err_unreg; + } + + /* detect transition latency */ + policy->cpuinfo.transition_latency = 0; + for (i=0; istate_count; i++) { + if ((perf->states[i].transition_latency * 1000) > + policy->cpuinfo.transition_latency) + policy->cpuinfo.transition_latency = + perf->states[i].transition_latency * 1000; + } + + data->max_freq = perf->states[0].core_frequency * 1000; + /* table init */ + for (i=0; istate_count; i++) { + if (i>0 && perf->states[i].core_frequency >= + data->freq_table[valid_states-1].frequency / 1000) + continue; + + data->freq_table[valid_states].index = i; + data->freq_table[valid_states].frequency = + perf->states[i].core_frequency * 1000; + valid_states++; + } + data->freq_table[valid_states].frequency = CPUFREQ_TABLE_END; + perf->state = 0; + + result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); + if (result) + goto err_freqfree; + + switch (perf->control_register.space_id) { + case ACPI_ADR_SPACE_SYSTEM_IO: + /* Current speed is unknown and not detectable by IO port */ + policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); + break; + case ACPI_ADR_SPACE_FIXED_HARDWARE: + acpi_cpufreq_driver.get = get_cur_freq_on_cpu; + policy->cur = get_cur_freq_on_cpu(cpu); + break; + default: + break; + } + + /* Check for APERF/MPERF support in hardware */ + if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6) { + unsigned int ecx; + ecx = cpuid_ecx(6); + if (ecx & CPUID_6_ECX_APERFMPERF_CAPABILITY) + acpi_cpufreq_driver.getavg = get_measured_perf; + } + + /* + * the first call to ->target() should result in us actually + * writing something to the appropriate registers. + */ + data->resume = 1; + + return result; + +err_freqfree: + xfree(data->freq_table); +err_unreg: + xfree(data); + drv_data[cpu] = NULL; + + return result; +} + +static struct cpufreq_driver acpi_cpufreq_driver = { + .target = acpi_cpufreq_target, + .init = acpi_cpufreq_cpu_init, +}; int acpi_cpufreq_init(void) { - return 0; -} + unsigned int i, ret = 0; + unsigned int dom, max_dom = 0; + cpumask_t *pt, dom_mask; + + cpus_clear(dom_mask); + + for_each_online_cpu(i) { + cpu_set(processor_pminfo[i].perf.domain_info.domain, dom_mask); + if (max_dom < processor_pminfo[i].perf.domain_info.domain) + max_dom = processor_pminfo[i].perf.domain_info.domain; + } + max_dom++; + + pt = xmalloc_array(cpumask_t, max_dom); + if (!pt) + return -ENOMEM; + memset(pt, 0, max_dom * sizeof(cpumask_t)); + + /* get cpumask of each psd domain */ + for_each_online_cpu(i) + cpu_set(i, pt[processor_pminfo[i].perf.domain_info.domain]); + + for_each_online_cpu(i) + processor_pminfo[i].perf.shared_cpu_map = + pt[processor_pminfo[i].perf.domain_info.domain]; + + cpufreq_driver = &acpi_cpufreq_driver; + + /* setup cpufreq infrastructure */ + for_each_online_cpu(i) { + xen_px_policy[i].cpu = i; + + ret = acpi_cpufreq_cpu_init(&xen_px_policy[i]); + if (ret) + goto cpufreq_init_out; + } + + /* setup ondemand cpufreq */ + for (dom=0; dom + +int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event) +{ + return 0; +} diff -r 66ddfc4d6963 -r 50fb7620d05a xen/arch/x86/acpi/cpufreq/utility.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/acpi/cpufreq/utility.c Wed May 14 13:55:11 2008 +0100 @@ -0,0 +1,167 @@ +/* + * utility.c - misc functions for cpufreq driver and Px statistic + * + * Copyright (C) 2001 Russell King + * (C) 2002 - 2003 Dominik Brodowski + * + * Oct 2005 - Ashok Raj + * Added handling for CPU hotplug + * Feb 2006 - Jacob Shin + * Fix handling for CPU hotplug -- affected CPUs + * Feb 2008 - Liu Jinsong + * 1. Merge cpufreq.c and freq_table.c of linux 2.6.23 + * And poring to Xen hypervisor + * 2. some Px statistic interface funcdtions + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct cpufreq_driver *cpufreq_driver; + +/********************************************************************* + * FREQUENCY TABLE HELPERS * + *********************************************************************/ + +int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table) +{ + unsigned int min_freq = ~0; + unsigned int max_freq = 0; + unsigned int i; + + for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { + unsigned int freq = table[i].frequency; + if (freq == CPUFREQ_ENTRY_INVALID) + continue; + if (freq < min_freq) + min_freq = freq; + if (freq > max_freq) + max_freq = freq; + } + + policy->min = policy->cpuinfo.min_freq = min_freq; + policy->max = policy->cpuinfo.max_freq = max_freq; + + if (policy->min == ~0) + return -EINVAL; + else + return 0; +} + +int cpufreq_frequency_table_target(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table, + unsigned int target_freq, + unsigned int relation, + unsigned int *index) +{ + struct cpufreq_frequency_table optimal = { + .index = ~0, + .frequency = 0, + }; + struct cpufreq_frequency_table suboptimal = { + .index = ~0, + .frequency = 0, + }; + unsigned int i; + + switch (relation) { + case CPUFREQ_RELATION_H: + suboptimal.frequency = ~0; + break; + case CPUFREQ_RELATION_L: + optimal.frequency = ~0; + break; + } + + if (!cpu_online(policy->cpu)) + return -EINVAL; + + for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { + unsigned int freq = table[i].frequency; + if (freq == CPUFREQ_ENTRY_INVALID) + continue; + if ((freq < policy->min) || (freq > policy->max)) + continue; + switch(relation) { + case CPUFREQ_RELATION_H: + if (freq <= target_freq) { + if (freq >= optimal.frequency) { + optimal.frequency = freq; + optimal.index = i; + } + } else { + if (freq <= suboptimal.frequency) { + suboptimal.frequency = freq; + suboptimal.index = i; + } + } + break; + case CPUFREQ_RELATION_L: + if (freq >= target_freq) { + if (freq <= optimal.frequency) { + optimal.frequency = freq; + optimal.index = i; + } + } else { + if (freq >= suboptimal.frequency) { + suboptimal.frequency = freq; + suboptimal.index = i; + } + } + break; + } + } + if (optimal.index > i) { + if (suboptimal.index > i) + return -EINVAL; + *index = suboptimal.index; + } else + *index = optimal.index; + + return 0; +} + + +/********************************************************************* + * GOVERNORS * + *********************************************************************/ + +int __cpufreq_driver_target(struct cpufreq_policy *policy, + unsigned int target_freq, + unsigned int relation) +{ + int retval = -EINVAL; + + if (cpu_online(policy->cpu) && cpufreq_driver->target) + retval = cpufreq_driver->target(policy, target_freq, relation); + + return retval; +} + +int __cpufreq_driver_getavg(struct cpufreq_policy *policy) +{ + int ret = 0; + + if (!policy) + return -EINVAL; + + if (cpu_online(policy->cpu) && cpufreq_driver->getavg) + ret = cpufreq_driver->getavg(policy->cpu); + + return ret; +} diff -r 66ddfc4d6963 -r 50fb7620d05a xen/include/acpi/cpufreq/cpufreq.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/include/acpi/cpufreq/cpufreq.h Wed May 14 13:55:11 2008 +0100 @@ -0,0 +1,129 @@ +/* + * xen/include/acpi/cpufreq/cpufreq.h + * + * Copyright (C) 2001 Russell King + * (C) 2002 - 2003 Dominik Brodowski + * + * $Id: cpufreq.h,v 1.36 2003/01/20 17:31:48 db Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include + +#include "processor_perf.h" + +#define CPUFREQ_NAME_LEN 16 + +struct cpufreq_cpuinfo { + unsigned int max_freq; + unsigned int min_freq; + unsigned int transition_latency; /* in 10^(-9) s = nanoseconds */ +}; + +struct cpufreq_policy { + cpumask_t cpus; /* affected CPUs */ + unsigned int shared_type; /* ANY or ALL affected CPUs + should set cpufreq */ + unsigned int cpu; /* cpu nr of registered CPU */ + struct cpufreq_cpuinfo cpuinfo; /* see above */ + + unsigned int min; /* in kHz */ + unsigned int max; /* in kHz */ + unsigned int cur; /* in kHz, only needed if cpufreq + * governors are used */ +}; + +#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ +#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ +#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ +#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ + +/******************** cpufreq transition notifiers *******************/ + +struct cpufreq_freqs { + unsigned int cpu; /* cpu nr */ + unsigned int old; + unsigned int new; + u8 flags; /* flags of cpufreq_driver, see below. */ +}; + + +/********************************************************************* + * CPUFREQ GOVERNORS * + *********************************************************************/ + +#define CPUFREQ_GOV_START 1 +#define CPUFREQ_GOV_STOP 2 +#define CPUFREQ_GOV_LIMITS 3 + +/* pass a target to the cpufreq driver */ +extern int __cpufreq_driver_target(struct cpufreq_policy *policy, + unsigned int target_freq, + unsigned int relation); +extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy); + + +/********************************************************************* + * CPUFREQ DRIVER INTERFACE * + *********************************************************************/ + +#define CPUFREQ_RELATION_L 0 /* lowest frequency at or above target */ +#define CPUFREQ_RELATION_H 1 /* highest frequency below or at target */ + +struct cpufreq_driver { + int (*init)(struct cpufreq_policy *policy); + int (*verify)(struct cpufreq_policy *policy); + int (*target)(struct cpufreq_policy *policy, + unsigned int target_freq, + unsigned int relation); + unsigned int (*get)(unsigned int cpu); + unsigned int (*getavg)(unsigned int cpu); + int (*exit)(struct cpufreq_policy *policy); +}; + +extern struct cpufreq_driver *cpufreq_driver; + +void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state); + +/********************************************************************* + * FREQUENCY TABLE HELPERS * + *********************************************************************/ + +#define CPUFREQ_ENTRY_INVALID ~0 +#define CPUFREQ_TABLE_END ~1 + +struct cpufreq_frequency_table { + unsigned int index; /* any */ + unsigned int frequency; /* kHz - doesn't need to be in ascending + * order */ +}; + +int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table); + +int cpufreq_frequency_table_target(struct cpufreq_policy *policy, + struct cpufreq_frequency_table *table, + unsigned int target_freq, + unsigned int relation, + unsigned int *index); + + +/********************************************************************* + * UNIFIED DEBUG HELPERS * + *********************************************************************/ + +struct cpu_dbs_info_s { + uint64_t prev_cpu_idle; + uint64_t prev_cpu_wall; + struct cpufreq_policy *cur_policy; + struct cpufreq_frequency_table *freq_table; + int cpu; + unsigned int enable:1; +}; + +int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:53 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:53 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JwbpN-0001I4-Dx for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:53 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpz-0004mJ-HQ; Thu, 15 May 2008 11:41:31 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpa-0004Q2-HH for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpU-0000hT-Hn for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:04 +0000 X-SBRS: 3.6 X-MesageID: 223251 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223251" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:06 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBe6T7017066 for ; Thu, 15 May 2008 04:40:06 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeOHQ026527 for ; Thu, 15 May 2008 04:40:24 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeO29026526 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:24 -0700 Message-Id: <200805151140.m4FBeO29026526@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:23 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Make MSI-X work with 64-bit BARs X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210770773 -3600 # Node ID 86587698116d742ff257e64ddfd230157fcee42c # Parent c9ec94410137d9509a6ea8329e9c0a1f22a4378b x86: Make MSI-X work with 64-bit BARs The code for working out the base address of a 64-bit BAR currently puts the two halves together in the wrong order and leaves the type bits in the resulting value. It also treats PCI_BASE_ADDRESS_MEM_TYPE_64 as a flag rather than an enumeration value. Signed-off-by: Neil Turton --- xen/arch/x86/msi.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff -r c9ec94410137 -r 86587698116d xen/arch/x86/msi.c --- a/xen/arch/x86/msi.c Wed May 14 13:55:26 2008 +0100 +++ b/xen/arch/x86/msi.c Wed May 14 14:12:53 2008 +0100 @@ -521,17 +521,20 @@ static u64 pci_resource_start(struct pci static u64 pci_resource_start(struct pci_dev *dev, u8 bar_index) { u64 bar_base; + u32 reg_val; u8 bus = dev->bus; u8 slot = PCI_SLOT(dev->devfn); u8 func = PCI_FUNC(dev->devfn); - bar_base = pci_conf_read32(bus, slot, func, - PCI_BASE_ADDRESS_0 + 4 * bar_index); - if ( bar_base & PCI_BASE_ADDRESS_MEM_TYPE_64 ) - { - bar_base <<= 32; - bar_base += pci_conf_read32(bus, slot, func, - PCI_BASE_ADDRESS_0 + 4 * (bar_index + 1)); + reg_val = pci_conf_read32(bus, slot, func, + PCI_BASE_ADDRESS_0 + 4 * bar_index); + bar_base = reg_val & PCI_BASE_ADDRESS_MEM_MASK; + if ( ( reg_val & PCI_BASE_ADDRESS_MEM_TYPE_MASK ) == + PCI_BASE_ADDRESS_MEM_TYPE_64 ) + { + reg_val = pci_conf_read32(bus, slot, func, + PCI_BASE_ADDRESS_0 + 4 * (bar_index + 1)); + bar_base |= ((u64)reg_val) << 32; } return bar_base; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:40:57 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:40:57 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JwbpR-0001I9-DB for www-data@colo.xensource.com; Thu, 15 May 2008 04:40:57 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbq3-0004pc-JS; Thu, 15 May 2008 11:41:35 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpb-0004QX-59 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:07 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpT-0000hR-3O for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:05 +0000 X-SBRS: 3.6 X-MesageID: 223250 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223250" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:05 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBe5fl017063 for ; Thu, 15 May 2008 04:40:05 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeNN9026510 for ; Thu, 15 May 2008 04:40:23 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeNax026509 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:23 -0700 Message-Id: <200805151140.m4FBeNax026509@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:22 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Implement cpufreq ondemand policy X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210769726 -3600 # Node ID c9ec94410137d9509a6ea8329e9c0a1f22a4378b # Parent 50fb7620d05ad869f354619e9fdf72e316c0d2b5 x86: Implement cpufreq ondemand policy Based on initialized cpufreq infrustructure, setup a timer on each PSD domain, periodicly sample cpu load and driver cpu to some Px state according to cpu load and cpu coordination. Signed-off-by: Liu Jinsong --- xen/arch/x86/acpi/cpufreq/cpufreq_ondemand.c | 231 +++++++++++++++++++++++++++ 1 files changed, 231 insertions(+) diff -r 50fb7620d05a -r c9ec94410137 xen/arch/x86/acpi/cpufreq/cpufreq_ondemand.c --- a/xen/arch/x86/acpi/cpufreq/cpufreq_ondemand.c Wed May 14 13:55:11 2008 +0100 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq_ondemand.c Wed May 14 13:55:26 2008 +0100 @@ -1,6 +1,237 @@ +/* + * xen/arch/x86/acpi/cpufreq/cpufreq_ondemand.c + * + * Copyright (C) 2001 Russell King + * (C) 2003 Venkatesh Pallipadi . + * Jun Nakajima + * Feb 2008 Liu Jinsong + * Porting cpufreq_ondemand.c from Liunx 2.6.23 to Xen hypervisor + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include #include +#define DEF_FREQUENCY_UP_THRESHOLD (80) + +#define MIN_DBS_INTERVAL (MICROSECS(100)) +#define MIN_SAMPLING_MILLISECS (20) +#define MIN_STAT_SAMPLING_RATE \ + (MIN_SAMPLING_MILLISECS * MILLISECS(1)) +#define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) +#define TRANSITION_LATENCY_LIMIT (10 * 1000 ) + +static uint64_t def_sampling_rate; + +/* Sampling types */ +enum {DBS_NORMAL_SAMPLE, DBS_SUB_SAMPLE}; + +static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); + +static unsigned int dbs_enable; /* number of CPUs using this policy */ + +static struct dbs_tuners { + uint64_t sampling_rate; + unsigned int up_threshold; + unsigned int ignore_nice; + unsigned int powersave_bias; +} dbs_tuners_ins = { + .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, + .ignore_nice = 0, + .powersave_bias = 0, +}; + +static struct timer dbs_timer[NR_CPUS]; + +static inline uint64_t get_cpu_idle_time(unsigned int cpu) +{ + uint64_t idle_ns; + struct vcpu *v; + + if ((v = idle_vcpu[cpu]) == NULL) + return 0; + + idle_ns = v->runstate.time[RUNSTATE_running]; + if (v->is_running) + idle_ns += NOW() - v->runstate.state_entry_time; + + return idle_ns; +} + +static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) +{ + unsigned int load = 0; + uint64_t cur_ns, idle_ns, total_ns; + + struct cpufreq_policy *policy; + unsigned int j; + + if (!this_dbs_info->enable) + return; + + policy = this_dbs_info->cur_policy; + cur_ns = NOW(); + total_ns = cur_ns - this_dbs_info->prev_cpu_wall; + this_dbs_info->prev_cpu_wall = NOW(); + + if (total_ns < MIN_DBS_INTERVAL) + return; + + /* Get Idle Time */ + idle_ns = UINT_MAX; + for_each_cpu_mask(j, policy->cpus) { + uint64_t total_idle_ns; + unsigned int tmp_idle_ns; + struct cpu_dbs_info_s *j_dbs_info; + + j_dbs_info = &per_cpu(cpu_dbs_info, j); + total_idle_ns = get_cpu_idle_time(j); + tmp_idle_ns = total_idle_ns - j_dbs_info->prev_cpu_idle; + j_dbs_info->prev_cpu_idle = total_idle_ns; + + if (tmp_idle_ns < idle_ns) + idle_ns = tmp_idle_ns; + } + + if (likely(total_ns > idle_ns)) + load = (100 * (total_ns - idle_ns)) / total_ns; + + /* Check for frequency increase */ + if (load > dbs_tuners_ins.up_threshold) { + /* if we are already at full speed then break out early */ + if (policy->cur == policy->max) + return; + __cpufreq_driver_target(policy, policy->max,CPUFREQ_RELATION_H); + return; + } + + /* Check for frequency decrease */ + /* if we cannot reduce the frequency anymore, break out early */ + if (policy->cur == policy->min) + return; + + /* + * The optimal frequency is the frequency that is the lowest that + * can support the current CPU usage without triggering the up + * policy. To be safe, we focus 10 points under the threshold. + */ + if (load < (dbs_tuners_ins.up_threshold - 10)) { + unsigned int freq_next, freq_cur; + + freq_cur = __cpufreq_driver_getavg(policy); + if (!freq_cur) + freq_cur = policy->cur; + + freq_next = (freq_cur * load) / (dbs_tuners_ins.up_threshold - 10); + + __cpufreq_driver_target(policy, freq_next, CPUFREQ_RELATION_L); + } +} + +static void do_dbs_timer(void *dbs) +{ + struct cpu_dbs_info_s *dbs_info = (struct cpu_dbs_info_s *)dbs; + + if (!dbs_info->enable) + return; + + dbs_check_cpu(dbs_info); + + set_timer(&dbs_timer[dbs_info->cpu], NOW()+dbs_tuners_ins.sampling_rate); +} + +static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) +{ + dbs_info->enable = 1; + + init_timer(&dbs_timer[dbs_info->cpu], do_dbs_timer, + (void *)dbs_info, dbs_info->cpu); + + set_timer(&dbs_timer[dbs_info->cpu], NOW()+dbs_tuners_ins.sampling_rate); +} + +static void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) +{ + dbs_info->enable = 0; + stop_timer(&dbs_timer[dbs_info->cpu]); +} + int cpufreq_governor_dbs(struct cpufreq_policy *policy, unsigned int event) { + unsigned int cpu = policy->cpu; + struct cpu_dbs_info_s *this_dbs_info; + unsigned int j; + + this_dbs_info = &per_cpu(cpu_dbs_info, cpu); + + switch (event) { + case CPUFREQ_GOV_START: + if ((!cpu_online(cpu)) || (!policy->cur)) + return -EINVAL; + + if (policy->cpuinfo.transition_latency > + (TRANSITION_LATENCY_LIMIT * 1000)) { + printk(KERN_WARNING "ondemand governor failed to load " + "due to too long transition latency\n"); + return -EINVAL; + } + if (this_dbs_info->enable) + /* Already enabled */ + break; + + dbs_enable++; + + for_each_cpu_mask(j, policy->cpus) { + struct cpu_dbs_info_s *j_dbs_info; + j_dbs_info = &per_cpu(cpu_dbs_info, j); + j_dbs_info->cur_policy = policy; + + j_dbs_info->prev_cpu_idle = get_cpu_idle_time(j); + j_dbs_info->prev_cpu_wall = NOW(); + } + this_dbs_info->cpu = cpu; + /* + * Start the timerschedule work, when this governor + * is used for first time + */ + if (dbs_enable == 1) { + def_sampling_rate = policy->cpuinfo.transition_latency * + DEF_SAMPLING_RATE_LATENCY_MULTIPLIER; + + if (def_sampling_rate < MIN_STAT_SAMPLING_RATE) + def_sampling_rate = MIN_STAT_SAMPLING_RATE; + + dbs_tuners_ins.sampling_rate = def_sampling_rate; + } + dbs_timer_init(this_dbs_info); + + break; + + case CPUFREQ_GOV_STOP: + if (this_dbs_info->enable) + dbs_timer_exit(this_dbs_info); + dbs_enable--; + + break; + + case CPUFREQ_GOV_LIMITS: + if (policy->max < this_dbs_info->cur_policy->cur) + __cpufreq_driver_target(this_dbs_info->cur_policy, + policy->max, CPUFREQ_RELATION_H); + else if (policy->min > this_dbs_info->cur_policy->cur) + __cpufreq_driver_target(this_dbs_info->cur_policy, + policy->min, CPUFREQ_RELATION_L); + break; + } return 0; } + _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:41:01 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:41:01 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JwbpV-0001IE-41 for www-data@colo.xensource.com; Thu, 15 May 2008 04:41:01 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbq7-0004sf-6T; Thu, 15 May 2008 11:41:39 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpd-0004SQ-8F for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:09 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpW-0000hP-DP for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:07 +0000 X-SBRS: 3.6 X-MesageID: 223253 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223253" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:07 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBe7u5017069 for ; Thu, 15 May 2008 04:40:07 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBePTm026544 for ; Thu, 15 May 2008 04:40:25 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBePBO026543 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:25 -0700 Message-Id: <200805151140.m4FBePBO026543@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:24 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: Fix PVFB backend to limit frame buffer size X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210840598 -3600 # Node ID 9044705960cb30cec385bdca7305bcf7db096721 # Parent 86587698116d742ff257e64ddfd230157fcee42c ioemu: Fix PVFB backend to limit frame buffer size The recent fix to validate the frontend's frame buffer description neglected to limit the frame buffer size correctly. This lets a malicious frontend make the backend attempt to map an arbitrary amount of guest memory, which could be useful for a denial of service attack against dom0. Signed-off-by: Markus Armbruster --- tools/ioemu/hw/xenfb.c | 1 + 1 files changed, 1 insertion(+) diff -r 86587698116d -r 9044705960cb tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Wed May 14 14:12:53 2008 +0100 +++ b/tools/ioemu/hw/xenfb.c Thu May 15 09:36:38 2008 +0100 @@ -502,6 +502,7 @@ static int xenfb_configure_fb(struct xen fprintf(stderr, "FB: frontend fb size %zu limited to %zu\n", fb_len, fb_len_lim); + fb_len = fb_len_lim; } if (depth != 8 && depth != 16 && depth != 24 && depth != 32) { fprintf(stderr, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:41:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:41:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbpd-0001Iq-4i for www-data@colo.xensource.com; Thu, 15 May 2008 04:41:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbqF-0004zl-Bx; Thu, 15 May 2008 11:41:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpf-0004Ua-L5 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:11 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpZ-0000hR-KP for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:09 +0000 X-SBRS: 3.6 X-MesageID: 223255 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223255" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:11 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeA8f017075 for ; Thu, 15 May 2008 04:40:10 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeTIT026632 for ; Thu, 15 May 2008 04:40:29 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeTaJ026631 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:29 -0700 Message-Id: <200805151140.m4FBeTaJ026631@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:28 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Sync Xen public headers. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210753951 -3600 # Node ID e25f25110882876e12e584b5a6a7ef85a1a28cca # Parent 3044873a84b70e7bbae977037ef97fe18670e166 Sync Xen public headers. Signed-off-by: Keir Fraser --- include/xen/interface/hvm/hvm_op.h | 5 +++++ 1 files changed, 5 insertions(+) diff -r 3044873a84b7 -r e25f25110882 include/xen/interface/hvm/hvm_op.h --- a/include/xen/interface/hvm/hvm_op.h Tue May 13 10:28:48 2008 +0100 +++ b/include/xen/interface/hvm/hvm_op.h Wed May 14 09:32:31 2008 +0100 @@ -73,6 +73,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_ /* Flushes all VCPU TLBs: @arg must be NULL. */ #define HVMOP_flush_tlbs 5 +/* Following tools-only interfaces may change in future. */ +#if defined(__XEN__) || defined(__XEN_TOOLS__) + /* Track dirty VRAM. */ #define HVMOP_track_dirty_vram 6 struct xen_hvm_track_dirty_vram { @@ -89,4 +92,6 @@ typedef struct xen_hvm_track_dirty_vram typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t; DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t); +#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ + #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:41:11 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:41:11 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbpf-0001Ir-1q for www-data@colo.xensource.com; Thu, 15 May 2008 04:41:11 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbqB-0004w6-Kx; Thu, 15 May 2008 11:41:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpf-0004UF-7n for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:11 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwbpY-0000hT-Vg for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:09 +0000 X-SBRS: 3.6 X-MesageID: 223254 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223254" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:08 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBe855017072 for ; Thu, 15 May 2008 04:40:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeQxi026561 for ; Thu, 15 May 2008 04:40:26 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeQ1b026560 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:26 -0700 Message-Id: <200805151140.m4FBeQ1b026560@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:25 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Fix an S3 bug caused by x_firmware_waking_vector X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210840680 -3600 # Node ID 29dc52031954896a407a97cba167c197f8e1c0ed # Parent 9044705960cb30cec385bdca7305bcf7db096721 x86: Fix an S3 bug caused by x_firmware_waking_vector According to ACPI spec., x_firmware_waking_vector in FACS is for waking up in protected mode and firmware_waking_vector is for in real mode. Xen once use x_firmware_waking_vector which can make S3 failed on some platform. This patch fixed the bug by using non-x one. Signed-off-by: Huacai Chen --- xen/arch/x86/acpi/boot.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff -r 9044705960cb -r 29dc52031954 xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Thu May 15 09:36:38 2008 +0100 +++ b/xen/arch/x86/acpi/boot.c Thu May 15 09:38:00 2008 +0100 @@ -441,17 +441,9 @@ acpi_fadt_parse_sleep_info(struct acpi_t "FACS is shorter than ACPI spec allow: 0x%x", facs->length); - if ((rsdp->revision < 2) || (facs->length < 32)) { - acpi_sinfo.wakeup_vector = facs_pa + - offsetof(struct acpi_table_facs, - firmware_waking_vector); - acpi_sinfo.vector_width = 32; - } else { - acpi_sinfo.wakeup_vector = facs_pa + - offsetof(struct acpi_table_facs, - xfirmware_waking_vector); - acpi_sinfo.vector_width = 64; - } + acpi_sinfo.wakeup_vector = facs_pa + + offsetof(struct acpi_table_facs, firmware_waking_vector); + acpi_sinfo.vector_width = 32; printk(KERN_INFO PREFIX " wakeup_vec[%"PRIx64"], vec_size[%x]\n", _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:41:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:41:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbph-0001Iw-PB for www-data@colo.xensource.com; Thu, 15 May 2008 04:41:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbqJ-00053c-W8; Thu, 15 May 2008 11:41:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbph-0004Vn-05 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:13 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwbpb-0000hP-NK for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:10 +0000 X-SBRS: 3.6 X-MesageID: 223256 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223256" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:12 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeBYs017078 for ; Thu, 15 May 2008 04:40:11 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeUCv026649 for ; Thu, 15 May 2008 04:40:30 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeUJQ026648 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:30 -0700 Message-Id: <200805151140.m4FBeUJQ026648@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:29 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] xen: Basic framework of getting and notifying Px info X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210769510 -3600 # Node ID 12bcbf80b8e4d2282429d5bab71749fb58b6643a # Parent e25f25110882876e12e584b5a6a7ef85a1a28cca xen: Basic framework of getting and notifying Px info Setup basic framework for ACPI Px parse, get basic Px info, transfer Px info to hypervisor through platform op hypercall. Add external control for ACPI parse, add notify mechanism for dynamic Px event (like ppc). Signed-off-by: Tian Kevin Signed-off-by: Liu Jinsong --- arch/i386/kernel/acpi/processor_extcntl_xen.c | 95 +++++++++++++++++++++ drivers/acpi/processor_extcntl.c | 113 +++++++++++++++++++++++++- drivers/acpi/processor_perflib.c | 8 + include/acpi/processor.h | 2 include/xen/interface/platform.h | 51 +++++++++++ 5 files changed, 266 insertions(+), 3 deletions(-) diff -r e25f25110882 -r 12bcbf80b8e4 arch/i386/kernel/acpi/processor_extcntl_xen.c --- a/arch/i386/kernel/acpi/processor_extcntl_xen.c Wed May 14 09:32:31 2008 +0100 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c Wed May 14 13:51:50 2008 +0100 @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -110,9 +111,101 @@ static int xen_cx_notifier(struct acpi_p return ret; } +static void convert_pct_reg(struct xen_pct_register *xpct, + struct acpi_pct_register *apct) +{ + xpct->descriptor = apct->descriptor; + xpct->length = apct->length; + xpct->space_id = apct->space_id; + xpct->bit_width = apct->bit_width; + xpct->bit_offset = apct->bit_offset; + xpct->reserved = apct->reserved; + xpct->address = apct->address; +} + +static void convert_pss_states(struct xen_processor_px *xpss, + struct acpi_processor_px *apss, int state_count) +{ + int i; + for(i=0; icore_frequency = apss->core_frequency; + xpss->power = apss->power; + xpss->transition_latency = apss->transition_latency; + xpss->bus_master_latency = apss->bus_master_latency; + xpss->control = apss->control; + xpss->status = apss->status; + xpss++; + apss++; + } +} + +static void convert_psd_pack(struct xen_psd_package *xpsd, + struct acpi_psd_package *apsd) +{ + xpsd->num_entries = apsd->num_entries; + xpsd->revision = apsd->revision; + xpsd->domain = apsd->domain; + xpsd->coord_type = apsd->coord_type; + xpsd->num_processors = apsd->num_processors; +} + static int xen_px_notifier(struct acpi_processor *pr, int action) { - return -EINVAL; + int ret; + xen_platform_op_t op = { + .cmd = XENPF_set_processor_pminfo, + .interface_version = XENPF_INTERFACE_VERSION, + .u.set_pminfo.id = pr->acpi_id, + .u.set_pminfo.type = XEN_PM_PX, + }; + struct xen_processor_performance *perf; + struct xen_processor_px *states = NULL; + struct acpi_processor_performance *px; + struct acpi_psd_package *pdomain; + + /* leave dynamic ppc handle in the future */ + if (action == PROCESSOR_PM_CHANGE) + return 0; + + perf = &op.u.set_pminfo.perf; + px = pr->performance; + + perf->flags = XEN_PX_PPC | + XEN_PX_PCT | + XEN_PX_PSS | + XEN_PX_PSD; + + /* ppc */ + perf->ppc = pr->performance_platform_limit; + + /* pct */ + convert_pct_reg(&perf->control_register, &px->control_register); + convert_pct_reg(&perf->status_register, &px->status_register); + + /* pss */ + perf->state_count = px->state_count; + states = kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL); + if (!states) + return -ENOMEM; + convert_pss_states(states, px->states, px->state_count); + set_xen_guest_handle(perf->states, states); + + /* psd */ + pdomain = &px->domain_info; + convert_psd_pack(&perf->domain_info, pdomain); + if (perf->domain_info.num_processors) { + if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL) + perf->shared_type = CPUFREQ_SHARED_TYPE_ALL; + else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) + perf->shared_type = CPUFREQ_SHARED_TYPE_ANY; + else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) + perf->shared_type = CPUFREQ_SHARED_TYPE_HW; + } else + perf->shared_type = CPUFREQ_SHARED_TYPE_NONE; + + ret = HYPERVISOR_platform_op(&op); + kfree(states); + return ret; } static int xen_tx_notifier(struct acpi_processor *pr, int action) diff -r e25f25110882 -r 12bcbf80b8e4 drivers/acpi/processor_extcntl.c --- a/drivers/acpi/processor_extcntl.c Wed May 14 09:32:31 2008 +0100 +++ b/drivers/acpi/processor_extcntl.c Wed May 14 13:51:50 2008 +0100 @@ -31,11 +31,49 @@ #include static int processor_extcntl_parse_csd(struct acpi_processor *pr); +static int processor_extcntl_get_performance(struct acpi_processor *pr); /* * External processor control logic may register with its own set of * ops to get ACPI related notification. One example is like VMM. */ struct processor_extcntl_ops *processor_extcntl_ops; + +static int processor_notify_smm(void) +{ + acpi_status status; + static int is_done = 0; + + /* only need successfully notify BIOS once */ + /* avoid double notification which may lead to unexpected result */ + if (is_done) + return 0; + + /* Can't write pstate_cnt to smi_cmd if either value is zero */ + if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO,"No SMI port or pstate_cnt\n")); + return 0; + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", + acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); + + /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use + * it anyway, so we need to support it... */ + if (acpi_fadt_is_v1) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Using v1.0 FADT reserved value for pstate_cnt\n")); + } + + status = acpi_os_write_port(acpi_fadt.smi_cmd, + (u32) acpi_fadt.pstate_cnt, 8); + if (ACPI_FAILURE(status)) + return status; + + is_done = 1; + + return 0; +} int processor_notify_external(struct acpi_processor *pr, int event, int type) { @@ -109,7 +147,12 @@ int processor_extcntl_init(struct acpi_p int processor_extcntl_init(struct acpi_processor *pr) { /* parse cstate dependency information */ - processor_extcntl_parse_csd(pr); + if (processor_pm_external()) + processor_extcntl_parse_csd(pr); + + /* Initialize performance states */ + if (processor_pmperf_external()) + processor_extcntl_get_performance(pr); return 0; } @@ -135,3 +178,71 @@ static int processor_extcntl_parse_csd(s return 0; } + +/* + * Existing ACPI module does parse performance states at some point, + * when acpi-cpufreq driver is loaded which however is something + * we'd like to disable to avoid confliction with external control + * logic. So we have to collect raw performance information here + * when ACPI processor object is found and started. + */ +#ifdef CONFIG_CPU_FREQ +static int processor_extcntl_get_performance(struct acpi_processor *pr) +{ + int ret; + struct acpi_processor_performance *perf; + struct acpi_psd_package *pdomain; + + if (pr->performance) + return -EBUSY; + + perf = kzalloc(sizeof(struct acpi_processor_performance), GFP_KERNEL); + if (!perf) + return -ENOMEM; + + pr->performance = perf; + /* Get basic performance state information */ + ret = acpi_processor_get_performance_info(pr); + if (ret < 0) + goto err_out; + + /* + * Well, here we need retrieve performance dependency information + * from _PSD object. The reason why existing interface is not used + * is due to the reason that existing interface sticks to Linux cpu + * id to construct some bitmap, however we want to split ACPI + * processor objects from Linux cpu id logic. For example, even + * when Linux is configured as UP, we still want to parse all ACPI + * processor objects to external logic. In this case, it's preferred + * to use ACPI ID instead. + */ + pr->performance->domain_info.num_processors = 0; + ret = acpi_processor_get_psd(pr); + if (ret < 0) + goto err_out; + + /* Some sanity check */ + pdomain = &pr->performance->domain_info; + if ((pdomain->revision != ACPI_PSD_REV0_REVISION) || + (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) || + ((pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL) && + (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY) && + (pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL))) { + ret = -EINVAL; + goto err_out; + } + + /* Last step is to notify BIOS that external logic exists */ + processor_notify_smm(); + + processor_notify_external(pr, PROCESSOR_PM_INIT, PM_TYPE_PERF); + + return 0; +err_out: + pr->performance = NULL; + kfree(perf); + return ret; +} +#else +static int processor_extcntl_get_performance(struct acpi_processor *pr) { return 0; } +#endif diff -r e25f25110882 -r 12bcbf80b8e4 drivers/acpi/processor_perflib.c --- a/drivers/acpi/processor_perflib.c Wed May 14 09:32:31 2008 +0100 +++ b/drivers/acpi/processor_perflib.c Wed May 14 13:51:50 2008 +0100 @@ -304,7 +304,11 @@ static int acpi_processor_get_performanc return result; } +#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL static int acpi_processor_get_performance_info(struct acpi_processor *pr) +#else +int acpi_processor_get_performance_info(struct acpi_processor *pr) +#endif { int result = 0; acpi_status status = AE_OK; @@ -543,7 +547,11 @@ static void acpi_cpufreq_remove_file(str } #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ +#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL static int acpi_processor_get_psd(struct acpi_processor *pr) +#else +int acpi_processor_get_psd(struct acpi_processor *pr) +#endif { int result = 0; acpi_status status = AE_OK; diff -r e25f25110882 -r 12bcbf80b8e4 include/acpi/processor.h --- a/include/acpi/processor.h Wed May 14 09:32:31 2008 +0100 +++ b/include/acpi/processor.h Wed May 14 13:51:50 2008 +0100 @@ -353,6 +353,8 @@ extern int processor_register_extcntl(st extern int processor_register_extcntl(struct processor_extcntl_ops *ops); extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops); extern int processor_extcntl_init(struct acpi_processor *pr); +extern int acpi_processor_get_performance_info(struct acpi_processor *pr); +extern int acpi_processor_get_psd(struct acpi_processor *pr); #else static inline int processor_cntl_external(void) {return 0;} static inline int processor_pm_external(void) {return 0;} diff -r e25f25110882 -r 12bcbf80b8e4 include/xen/interface/platform.h --- a/include/xen/interface/platform.h Wed May 14 09:32:31 2008 +0100 +++ b/include/xen/interface/platform.h Wed May 14 13:51:50 2008 +0100 @@ -211,6 +211,12 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_getidletim #define XEN_PM_PX 1 #define XEN_PM_TX 2 +/* Px sub info type */ +#define XEN_PX_PCT 1 +#define XEN_PX_PSS 2 +#define XEN_PX_PPC 4 +#define XEN_PX_PSD 8 + struct xen_power_register { uint32_t space_id; uint32_t bit_width; @@ -252,12 +258,55 @@ struct xen_processor_power { XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */ }; +struct xen_pct_register { + uint8_t descriptor; + uint16_t length; + uint8_t space_id; + uint8_t bit_width; + uint8_t bit_offset; + uint8_t reserved; + uint64_t address; +}; + +struct xen_processor_px { + uint64_t core_frequency; /* megahertz */ + uint64_t power; /* milliWatts */ + uint64_t transition_latency; /* microseconds */ + uint64_t bus_master_latency; /* microseconds */ + uint64_t control; /* control value */ + uint64_t status; /* success indicator */ +}; +typedef struct xen_processor_px xen_processor_px_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_px_t); + +struct xen_psd_package { + uint64_t num_entries; + uint64_t revision; + uint64_t domain; + uint64_t coord_type; + uint64_t num_processors; +}; + +struct xen_processor_performance { + uint32_t flags; /* flag for Px sub info type */ + uint32_t ppc; /* Platform limitation on freq usage */ + struct xen_pct_register control_register; + struct xen_pct_register status_register; + uint32_t state_count; /* total available performance states */ + XEN_GUEST_HANDLE(xen_processor_px_t) states; + struct xen_psd_package domain_info; + uint32_t shared_type; /* coordination type of this processor */ +}; +typedef struct xen_processor_performance xen_processor_performance_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_performance_t); + struct xenpf_set_processor_pminfo { /* IN variables */ uint32_t id; /* ACPI CPU ID */ - uint32_t type; /* {XEN_PM_CX, ...} */ + uint32_t type; /* {XEN_PM_CX, XEN_PM_PX} */ union { struct xen_processor_power power;/* Cx: _CST/_CSD */ + struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ }; }; typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:41:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:41:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbpn-0001J2-9y for www-data@colo.xensource.com; Thu, 15 May 2008 04:41:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbqP-00057s-Dr; Thu, 15 May 2008 11:41:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpk-0004YT-MS for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:16 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwbpd-0000hT-NG for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:14 +0000 X-SBRS: 3.6 X-MesageID: 223257 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223257" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:13 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeD9m017081 for ; Thu, 15 May 2008 04:40:13 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeVYi026666 for ; Thu, 15 May 2008 04:40:31 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeVkH026665 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:31 -0700 Message-Id: <200805151140.m4FBeVkH026665@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:30 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] acpi: Fix a bug related to parse named objects X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210769586 -3600 # Node ID d59a4aaf8615aea0ff42349f0d0367be641c36b0 # Parent 12bcbf80b8e4d2282429d5bab71749fb58b6643a acpi: Fix a bug related to parse named objects This patch is pulled from native linux, and is needed in our patchset to make it run, otherwise will parse wrong _PSD info. Fixed a problem with the Package operator where all named references were created as object references and left otherwise unresolved. According to the ACPI specification, a Package can only contain Data Objects or references to control methods. The implication is that named references to Data Objects (Integer, Buffer, String, Package, BufferField, Field) should be resolved immediately upon package creation. This is the approach taken with this change. References to all other named objects (Methods, Devices, Scopes, etc.) are all now properly created as reference objects. Signed-off-by: Bob Moore Signed-off-by: Len Brown --- drivers/acpi/dispatcher/dsobject.c | 91 ++++++++++++++++++++++++++++++++++--- 1 files changed, 85 insertions(+), 6 deletions(-) diff -r 12bcbf80b8e4 -r d59a4aaf8615 drivers/acpi/dispatcher/dsobject.c --- a/drivers/acpi/dispatcher/dsobject.c Wed May 14 13:51:50 2008 +0100 +++ b/drivers/acpi/dispatcher/dsobject.c Wed May 14 13:53:06 2008 +0100 @@ -137,6 +137,71 @@ acpi_ds_build_internal_object(struct acp return_ACPI_STATUS(status); } } + + /* Special object resolution for elements of a package */ + + if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) || + (op->common.parent->common.aml_opcode == + AML_VAR_PACKAGE_OP)) { + /* + * Attempt to resolve the node to a value before we insert it into + * the package. If this is a reference to a common data type, + * resolve it immediately. According to the ACPI spec, package + * elements can only be "data objects" or method references. + * Attempt to resolve to an Integer, Buffer, String or Package. + * If cannot, return the named reference (for things like Devices, + * Methods, etc.) Buffer Fields and Fields will resolve to simple + * objects (int/buf/str/pkg). + * + * NOTE: References to things like Devices, Methods, Mutexes, etc. + * will remain as named references. This behavior is not described + * in the ACPI spec, but it appears to be an oversight. + */ + obj_desc = (union acpi_operand_object *)op->common.node; + + status = + acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR + (struct + acpi_namespace_node, + &obj_desc), + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + switch (op->common.node->type) { + /* + * For these types, we need the actual node, not the subobject. + * However, the subobject got an extra reference count above. + */ + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_METHOD: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_REGION: + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + obj_desc = + (union acpi_operand_object *)op->common. + node; + break; + + default: + break; + } + + /* + * If above resolved to an operand object, we are done. Otherwise, + * we have a NS node, we must create the package entry as a named + * reference. + */ + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != + ACPI_DESC_TYPE_NAMED) { + goto exit; + } + } } /* Create and init a new internal ACPI object */ @@ -156,6 +221,7 @@ acpi_ds_build_internal_object(struct acp return_ACPI_STATUS(status); } + exit: *obj_desc_ptr = obj_desc; return_ACPI_STATUS(AE_OK); } @@ -358,12 +424,25 @@ acpi_ds_build_internal_package_obj(struc arg = arg->common.next; for (i = 0; arg; i++) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { - - /* Object (package or buffer) is already built */ - - obj_desc->package.elements[i] = - ACPI_CAST_PTR(union acpi_operand_object, - arg->common.node); + if (arg->common.node->type == ACPI_TYPE_METHOD) { + /* + * A method reference "looks" to the parser to be a method + * invocation, so we special case it here + */ + arg->common.aml_opcode = AML_INT_NAMEPATH_OP; + status = + acpi_ds_build_internal_object(walk_state, + arg, + &obj_desc-> + package. + elements[i]); + } else { + /* This package element is already built, just get it */ + + obj_desc->package.elements[i] = + ACPI_CAST_PTR(union acpi_operand_object, + arg->common.node); + } } else { status = acpi_ds_build_internal_object(walk_state, arg, &obj_desc-> _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 04:41:24 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 04:41:24 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwbps-0001J5-0S for www-data@colo.xensource.com; Thu, 15 May 2008 04:41:24 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwbqU-0005BT-9N; Thu, 15 May 2008 11:42:02 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwbpl-0004ZH-LH for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:17 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwbpe-0000hR-4I for xen-changelog@lists.xensource.com; Thu, 15 May 2008 11:41:15 +0000 X-SBRS: 3.6 X-MesageID: 223258 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,491,1204520400"; d="scan'208";a="223258" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 07:40:14 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeElq017084 for ; Thu, 15 May 2008 04:40:14 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FBeWl1026683 for ; Thu, 15 May 2008 04:40:32 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FBeWOp026682 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 04:40:32 -0700 Message-Id: <200805151140.m4FBeWOp026682@xenbits.xensource.com> Date: Thu, 15 May 2008 04:40:31 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] balloon: Fix minimum_target() check to work when built as a module. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210840947 -3600 # Node ID a741afb717006a6751044d1d11cd5412f0bbce3c # Parent d59a4aaf8615aea0ff42349f0d0367be641c36b0 balloon: Fix minimum_target() check to work when built as a module. From: Jan Beulich Signed-off-by: Keir Fraser --- drivers/xen/balloon/balloon.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff -r d59a4aaf8615 -r a741afb71700 drivers/xen/balloon/balloon.c --- a/drivers/xen/balloon/balloon.c Wed May 14 13:53:06 2008 +0100 +++ b/drivers/xen/balloon/balloon.c Thu May 15 09:42:27 2008 +0100 @@ -197,8 +197,8 @@ static unsigned long minimum_target(void static unsigned long minimum_target(void) { #ifndef CONFIG_XEN - return 0; -#else +#define max_pfn num_physpages +#endif unsigned long min_pages, curr_pages = current_target(); #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) @@ -226,6 +226,8 @@ static unsigned long minimum_target(void /* Don't enforce growth */ return min(min_pages, curr_pages); +#ifndef CONFIG_XEN +#undef max_pfn #endif } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweT8-000405-P8 for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweTl-0005J8-2S; Thu, 15 May 2008 14:30:45 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweTj-0005IJ-2M for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:30:43 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweTc-0002Nr-8v for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:30:40 +0000 X-SBRS: 3.6 X-MesageID: 224737 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224737" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:29:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEToro017295 for ; Thu, 15 May 2008 07:29:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEU81C003514 for ; Thu, 15 May 2008 07:30:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEU8v1003513 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:08 -0700 Message-Id: <200805151430.m4FEU8v1003513@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:07 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Do not unmap all MSI-X pirqs when enabling MSI-X X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210842209 -3600 # Node ID c3f9cc7789af995b7edfa8a8de4ae099a3750e9e # Parent a741afb717006a6751044d1d11cd5412f0bbce3c Do not unmap all MSI-X pirqs when enabling MSI-X Originally, all existing MSI-X pirqs of that device are unmapped before mapping the required MSI-X entries. This is actually not right. This function may be called several times, with each time requiring enabling different parts of the device MSI-X entry. Former pirqs should not be unmapped. Thanks for Neil Turton's comments on this problem. Signed-off-by: Shan Haitao --- drivers/pci/msi-xen.c | 60 ++++++++++++++++++++++++++++++++------------------ 1 files changed, 39 insertions(+), 21 deletions(-) diff -r a741afb71700 -r c3f9cc7789af drivers/pci/msi-xen.c --- a/drivers/pci/msi-xen.c Thu May 15 09:42:27 2008 +0100 +++ b/drivers/pci/msi-xen.c Thu May 15 10:03:29 2008 +0100 @@ -33,7 +33,6 @@ int msi_register(struct msi_ops *ops) } static LIST_HEAD(msi_dev_head); -static int msi_dev_head_inited = 0; DEFINE_SPINLOCK(msi_dev_lock); struct msi_dev_list { @@ -95,6 +94,23 @@ static int attach_pirq_entry(int pirq, i list_add_tail(&entry->list, &msi_dev_entry->pirq_list_head); spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); return 0; +} + +static void detach_pirq_entry(int entry_nr, + struct msi_dev_list *msi_dev_entry) +{ + unsigned long flags; + struct msi_pirq_entry *pirq_entry; + + list_for_each_entry(pirq_entry, &msi_dev_entry->pirq_list_head, list) { + if (pirq_entry->entry_nr == entry_nr) { + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + list_del(&pirq_entry->list); + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + kfree(pirq_entry); + return; + } + } } /* @@ -379,40 +395,42 @@ static int msix_capability_init(struct p static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, int nvec) { - int pirq, i, pos; + int pirq, i, j, mapped, pos; struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev); - struct msi_pirq_entry *pirq_entry, *tmp; - unsigned long flags; + struct msi_pirq_entry *pirq_entry; if (!msi_dev_entry) return -ENOMEM; - spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - if (!list_empty(&msi_dev_entry->pirq_list_head)) - { - printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ - before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn)); - list_for_each_entry_safe(pirq_entry, tmp, - &msi_dev_entry->pirq_list_head, list) { - msi_unmap_pirq(dev, pirq_entry->pirq); - list_del(&pirq_entry->list); - kfree(pirq_entry); - } - } - spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); - /* MSI-X Table Initialization */ for (i = 0; i < nvec; i++) { + mapped = 0; + list_for_each_entry(pirq_entry, &msi_dev_entry->pirq_list_head, list) { + if (pirq_entry->entry_nr == entries[i].entry) { + printk(KERN_WARNING "msix entry %d for dev %02x:%02x:%01x are \ + not freed before acquire again.\n", entries[i].entry, + dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + (entries + i)->vector = pirq_entry->pirq; + mapped = 1; + break; + } + } + if (mapped) + continue; pirq = msi_map_vector(dev, entries[i].entry, 0); if (pirq < 0) break; attach_pirq_entry(pirq, entries[i].entry, msi_dev_entry); (entries + i)->vector = pirq; } + if (i != nvec) { - msi_unmap_pirq(dev, dev->irq); - (entries + i)->vector = 0; + for (j = --i; j >= 0; j--) { + msi_unmap_pirq(dev, entries[j].vector); + detach_pirq_entry(entries[j].entry, msi_dev_entry); + entries[j].vector = 0; + } return -EBUSY; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:25 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:25 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweTR-000408-AK for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:25 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweU3-0005Mi-Gc; Thu, 15 May 2008 14:31:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweU1-0005Lh-0d for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:01 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweTt-0002O2-J7 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:30:58 +0000 X-SBRS: 3.6 X-MesageID: 224740 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224740" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:30:09 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEU8ia017298 for ; Thu, 15 May 2008 07:30:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEURpi003690 for ; Thu, 15 May 2008 07:30:27 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEURsB003689 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:27 -0700 Message-Id: <200805151430.m4FEURsB003689@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:26 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] ioemu: Fix handling of phy: block devices. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210752747 -3600 # Node ID 5824167feb81c6b85094d26da633a6a2e7ff496f # Parent 784805591fa2d972e790451d3242f6c59f8eeebf ioemu: Fix handling of phy: block devices. Signed-off-by: Ian Jackson xen-unstable changeset: 17631:cb22b23156a4b72455d733f547d0c2a59810bed5 xen-unstable date: Wed May 14 09:11:40 2008 +0100 --- tools/ioemu/xenstore.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 784805591fa2 -r 5824167feb81 tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Tue May 13 15:54:31 2008 +0100 +++ b/tools/ioemu/xenstore.c Wed May 14 09:12:27 2008 +0100 @@ -245,7 +245,7 @@ void xenstore_parse_domain_config(int do } if (!strcmp(drv,"qcow")) { /* autoguess qcow vs qcow2 */ - } else if (!strcmp(drv,"file")) { + } else if (!strcmp(drv,"file") || !strcmp(drv,"phy")) { format = &bdrv_raw; } else { format = bdrv_find_format(drv); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:29 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:29 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweTV-00040B-1g for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:29 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweU7-0005Q3-CL; Thu, 15 May 2008 14:31:07 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweU5-0005MY-9Q for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:05 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweTw-0002O6-Kc for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:03 +0000 X-SBRS: 3.6 X-MesageID: 224742 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224742" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:30:11 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUA7E017304 for ; Thu, 15 May 2008 07:30:10 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUT0o003724 for ; Thu, 15 May 2008 07:30:29 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEUTX9003723 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:29 -0700 Message-Id: <200805151430.m4FEUTX9003723@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:28 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] qemu: Send unit_attention on cd-rom not_ready to ready transition X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210841199 -3600 # Node ID faffec221bada407c1b8543f2edbc359f5c9e659 # Parent 7bfd5bead11adcaf548f56e47bf8a41c1a3a4c9a qemu: Send unit_attention on cd-rom not_ready to ready transition Patch sends a UNIT_ATTENTION(6), MEDIUM_MAY_HAVE_CHANGED(0x28) sense when cdrom transitions from not ready to ready. ATA Packet interface for CD-ROMS, SFF8020i.pdf. See state diagram Figure 12, page 82 and Table 44 -recommended Sense Key, ASC With patch in place HVM win2008 server guest sees the CD/DVD contents have changed when the media is switched. Signed-off-by: Pat Campbell xen-unstable changeset: 17633:a864c0c4d605efceac28106a7072aa8c1ebdea83 xen-unstable date: Wed May 14 09:15:02 2008 +0100 --- tools/ioemu/hw/ide.c | 6 ++++++ 1 files changed, 6 insertions(+) diff -r 7bfd5bead11a -r faffec221bad tools/ioemu/hw/ide.c --- a/tools/ioemu/hw/ide.c Thu May 15 09:46:16 2008 +0100 +++ b/tools/ioemu/hw/ide.c Thu May 15 09:46:39 2008 +0100 @@ -279,6 +279,7 @@ #define ASC_ILLEGAL_OPCODE 0x20 #define ASC_LOGICAL_BLOCK_OOR 0x21 #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 +#define ASC_MEDIUM_MAY_HAVE_CHANGED 0x28 #define ASC_MEDIUM_NOT_PRESENT 0x3a #define ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39 @@ -1406,6 +1407,11 @@ static void ide_atapi_cmd(IDEState *s) switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: if (bdrv_is_inserted(s->bs)) { + if (s->is_cdrom && s->sense_key == SENSE_NOT_READY) { + ide_atapi_cmd_error(s, SENSE_UNIT_ATTENTION, + ASC_MEDIUM_MAY_HAVE_CHANGED); + break; + } ide_atapi_cmd_ok(s); } else { ide_atapi_cmd_error(s, SENSE_NOT_READY, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:33 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:33 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweTY-00040E-R3 for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:33 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUB-0005Tg-5o; Thu, 15 May 2008 14:31:11 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweU6-0005OK-KE for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweTz-0002O2-Ax for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:04 +0000 X-SBRS: 3.6 X-MesageID: 224743 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224743" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:30:12 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUCJQ017307 for ; Thu, 15 May 2008 07:30:12 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUUD7003741 for ; Thu, 15 May 2008 07:30:30 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEUTie003740 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:29 -0700 Message-Id: <200805151430.m4FEUTie003740@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:29 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] qemu: Fix shift-insert behavior X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210841228 -3600 # Node ID 8eeeca7444231600dcd2c4af5eea855645f040f7 # Parent faffec221bada407c1b8543f2edbc359f5c9e659 qemu: Fix shift-insert behavior This patch is related to Changeset 15635:7bdc9f6407d3 [PVFB] Fix shift key for graphical vnc display. With above patch, if a user presses shift-insert, qemu sends shift down, shift up, insert down and then another shift key down (see trace below). This makes it impossible to do shift insert pasting or use guest hot shifted-Fkeys. Shift Insert trace: do_key_event():1135 keycode:2a shift down kbd_put_keycode():539 keycode:2a send shift down do_key_event():1135 keycode:d2 insert down kbd_put_keycode():539 keycode:aa send shift up kbd_put_keycode():539 keycode:e0 send insert down kbd_put_keycode():539 keycode:52 do_key_event():1135 keycode:d2 insert up kbd_put_keycode():539 keycode:e0 send insert up kbd_put_keycode():539 keycode:d2 kbd_put_keycode():539 keycode:2a send shift down do_key_event():1135 keycode:2a shift up kbd_put_keycode():539 keycode:aa send shift up This patch adds a check for the keycode being shiftable, something other than a keypad key, f1-12 , insert, del , etc. before allowing the press_shift_up() operation. Signed-off-by: Pat Campbell xen-unstable changeset: 17634:feec00994a0b06ec093a4a4779484810a138eef2 xen-unstable date: Wed May 14 09:16:40 2008 +0100 --- tools/ioemu/keymaps.c | 16 ++++++++++++++++ tools/ioemu/vnc.c | 9 ++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff -r faffec221bad -r 8eeeca744423 tools/ioemu/keymaps.c --- a/tools/ioemu/keymaps.c Thu May 15 09:46:39 2008 +0100 +++ b/tools/ioemu/keymaps.c Thu May 15 09:47:08 2008 +0100 @@ -50,6 +50,7 @@ typedef struct { struct key_range *keypad_range; struct key_range *numlock_range; struct key_range *shift_range; + struct key_range *localstate_range; } kbd_layout_t; static void add_to_key_range(struct key_range **krp, int code) { @@ -132,6 +133,10 @@ static kbd_layout_t *parse_keyboard_layo add_to_key_range(&k->shift_range, keysym); fprintf(stderr, "shift keysym %04x keycode %d\n", keysym, keycode); } + if (rest && strstr(rest, "localstate")) { + add_to_key_range(&k->localstate_range, keycode); + //fprintf(stderr, "localstate keysym %04x keycode %d\n", keysym, keycode); + } /* if(keycode&0x80) keycode=(keycode<<8)^0x80e0; */ @@ -221,3 +226,14 @@ static int keysymIsShift(void *kbd_layou return 1; return 0; } + +static int keycodeIsShiftable(void *kbd_layout, int keycode) +{ + kbd_layout_t *k = kbd_layout; + struct key_range *kr; + + for (kr = k->localstate_range; kr; kr = kr->next) + if (keycode >= kr->start && keycode <= kr->end) + return 0; + return 1; +} diff -r faffec221bad -r 8eeeca744423 tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Thu May 15 09:46:39 2008 +0100 +++ b/tools/ioemu/vnc.c Thu May 15 09:47:08 2008 +0100 @@ -1107,6 +1107,7 @@ static void do_key_event(VncState *vs, i int keycode; int shift_keys = 0; int shift = 0; + int keypad = 0; if (is_graphic_console()) { if (sym >= 'A' && sym <= 'Z') { @@ -1163,7 +1164,8 @@ static void do_key_event(VncState *vs, i return; } - if (keycodeIsKeypad(vs->kbd_layout, keycode)) { + keypad = keycodeIsKeypad(vs->kbd_layout, keycode); + if (keypad) { /* If the numlock state needs to change then simulate an additional keypress before sending this one. This will happen if the user toggles numlock away from the VNC window. @@ -1183,13 +1185,14 @@ static void do_key_event(VncState *vs, i if (is_graphic_console()) { /* If the shift state needs to change then simulate an additional - keypress before sending this one. + keypress before sending this one. Ignore for non shiftable keys. */ if (shift && !shift_keys) { press_key_shift_down(vs, down, keycode); return; } - else if (!shift && shift_keys) { + else if (!shift && shift_keys && !keypad && + keycodeIsShiftable(vs->kbd_layout, keycode)) { press_key_shift_up(vs, down, keycode); return; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:36 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:36 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweTc-00040J-BK for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:36 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUE-0005Wv-Kf; Thu, 15 May 2008 14:31:14 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweU7-0005Ou-VY for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:07 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweTv-0002O4-Fo for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:05 +0000 X-SBRS: 3.6 X-MesageID: 224741 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224741" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:30:10 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEU90h017301 for ; Thu, 15 May 2008 07:30:09 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUS1Q003707 for ; Thu, 15 May 2008 07:30:28 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEUSFR003706 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:28 -0700 Message-Id: <200805151430.m4FEUSFR003706@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:27 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] qemu: add 0xe0 prefix to r-ctrl and r-alt keycodes X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210841176 -3600 # Node ID 7bfd5bead11adcaf548f56e47bf8a41c1a3a4c9a # Parent 5824167feb81c6b85094d26da633a6a2e7ff496f qemu: add 0xe0 prefix to r-ctrl and r-alt keycodes Patch puts 0xe0 prefix before putting right alt or right cntrl keycodes. Also adds keysm definition for ISO_Left_Tab. Signed-off-by: Pat Campbell xen-unstable changeset: 17632:39566bf4c9f09cc0b14e2c8ea2963e2efdf9f469 xen-unstable date: Wed May 14 09:13:48 2008 +0100 --- tools/ioemu/vnc.c | 2 ++ tools/ioemu/vnc_keysym.h | 1 + 2 files changed, 3 insertions(+) diff -r 5824167feb81 -r 7bfd5bead11a tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Wed May 14 09:12:27 2008 +0100 +++ b/tools/ioemu/vnc.c Thu May 15 09:46:16 2008 +0100 @@ -1133,6 +1133,8 @@ static void do_key_event(VncState *vs, i case 0x9d: /* Right CTRL */ case 0x38: /* Left ALT */ case 0xb8: /* Right ALT */ + if (keycode & 0x80) + kbd_put_keycode(0xe0); if (down) { vs->modifiers_state[keycode] = 1; kbd_put_keycode(keycode & 0x7f); diff -r 5824167feb81 -r 7bfd5bead11a tools/ioemu/vnc_keysym.h --- a/tools/ioemu/vnc_keysym.h Wed May 14 09:12:27 2008 +0100 +++ b/tools/ioemu/vnc_keysym.h Thu May 15 09:46:16 2008 +0100 @@ -345,6 +345,7 @@ static name2keysym_t name2keysym[]={ {"Num_Lock", 0xff7f}, /* XK_Num_Lock */ {"Pause", 0xff13}, /* XK_Pause */ {"Escape", 0xff1b}, /* XK_Escape */ +{"ISO_Left_Tab", 0xfe20},/* XK_ISO_Left_Tab */ /* localized keys */ {"BackApostrophe", 0xff21}, _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:39 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:39 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweTf-00040M-Fm for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:39 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUH-0005aR-Ql; Thu, 15 May 2008 14:31:17 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweU9-0005Pp-2C for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:09 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweU3-0002O6-OX for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:06 +0000 X-SBRS: 3.6 X-MesageID: 224744 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224744" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:30:13 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUCSN017310 for ; Thu, 15 May 2008 07:30:12 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUV0E003758 for ; Thu, 15 May 2008 07:30:31 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEUVT8003757 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:31 -0700 Message-Id: <200805151430.m4FEUVT8003757@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:30 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] xend: fix block protocol mismatch on save/restore X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210841261 -3600 # Node ID 11dc8a6ba4a5309de982d1ecc25f15e0412449ea # Parent 8eeeca7444231600dcd2c4af5eea855645f040f7 xend: fix block protocol mismatch on save/restore The protocol field of the blkif interface is correct at startup for a guest of a different mode from dom0 (eg. 32-bit dom0, 64-bit guest). However, this property is not persisted on save, so a later restore (or migrate) will setup the block interface with the wrong mode. Signed-off-by: Herbert van den Bergh Signed-off-by: Kurt Hackel xen-unstable changeset: 17635:049459aec2b10628a8b7474d43a89e2a89b29405 xen-unstable date: Wed May 14 09:19:05 2008 +0100 --- tools/python/xen/xend/server/blkif.py | 8 ++++++++ tools/python/xen/xm/create.py | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff -r 8eeeca744423 -r 11dc8a6ba4a5 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Thu May 15 09:47:08 2008 +0100 +++ b/tools/python/xen/xend/server/blkif.py Thu May 15 09:47:41 2008 +0100 @@ -82,6 +82,10 @@ class BlkifController(DevController): front = { 'virtual-device' : "%i" % devid, 'device-type' : dev_type } + + protocol = config.get('protocol') + if protocol: + front['protocol'] = protocol return (devid, back, front) @@ -156,6 +160,10 @@ class BlkifController(DevController): if uuid: config['uuid'] = uuid + proto = self.readFrontend(devid, 'protocol') + if proto: + config['protocol'] = proto + return config def destroyDevice(self, devid, force): diff -r 8eeeca744423 -r 11dc8a6ba4a5 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Thu May 15 09:47:08 2008 +0100 +++ b/tools/python/xen/xm/create.py Thu May 15 09:47:41 2008 +0100 @@ -572,7 +572,7 @@ def configure_disks(config_devs, vals): def configure_disks(config_devs, vals): """Create the config for disks (virtual block devices). """ - for (uname, dev, mode, backend) in vals.disk: + for (uname, dev, mode, backend, protocol) in vals.disk: if uname.startswith('tap:'): cls = 'tap' else: @@ -584,6 +584,8 @@ def configure_disks(config_devs, vals): ['mode', mode ] ] if backend: config_vbd.append(['backend', backend]) + if protocol: + config_vbd.append(['protocol', protocol]) config_devs.append(['device', config_vbd]) def configure_pci(config_devs, vals): @@ -805,7 +807,10 @@ def preprocess_disk(vals): n = len(d) if n == 3: d.append(None) + d.append(None) elif n == 4: + d.append(None) + elif n == 5: pass else: err('Invalid disk specifier: ' + v) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:44 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:44 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweTj-00040P-WE for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:44 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUM-0005eN-9I; Thu, 15 May 2008 14:31:22 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUA-0005RG-2l for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:10 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweU5-0002O2-3B for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:07 +0000 X-SBRS: 3.6 X-MesageID: 224745 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224745" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:30:14 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUDMD017313 for ; Thu, 15 May 2008 07:30:13 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUWxk003775 for ; Thu, 15 May 2008 07:30:32 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEUV9K003774 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:31 -0700 Message-Id: <200805151430.m4FEUV9K003774@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:31 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] ioemu: Fix PVFB backend to limit frame buffer size X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210841612 -3600 # Node ID 57cfcbe761b8aeb03f430c828e25a400d7a9b2d6 # Parent 11dc8a6ba4a5309de982d1ecc25f15e0412449ea ioemu: Fix PVFB backend to limit frame buffer size The recent fix to validate the frontend's frame buffer description neglected to limit the frame buffer size correctly. This lets a malicious frontend make the backend attempt to map an arbitrary amount of guest memory, which could be useful for a denial of service attack against dom0. Signed-off-by: Markus Armbruster xen-unstable changeset: 17643:9044705960cb30cec385bdca7305bcf7db096721 xen-unstable date: Thu May 15 09:36:38 2008 +0100 --- tools/ioemu/hw/xenfb.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) diff -r 11dc8a6ba4a5 -r 57cfcbe761b8 tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Thu May 15 09:47:41 2008 +0100 +++ b/tools/ioemu/hw/xenfb.c Thu May 15 09:53:32 2008 +0100 @@ -481,9 +481,15 @@ static int xenfb_configure_fb(struct xen size_t mfn_sz = sizeof(*((struct xenfb_page *)0)->pd); size_t pd_len = sizeof(((struct xenfb_page *)0)->pd) / mfn_sz; size_t fb_pages = pd_len * XC_PAGE_SIZE / mfn_sz; - size_t fb_len_max = fb_pages * XC_PAGE_SIZE; + size_t fb_len_lim = fb_pages * XC_PAGE_SIZE; int max_width, max_height; + if (fb_len > fb_len_lim) { + fprintf(stderr, + "FB: frontend fb size %zu limited to %zu\n", + fb_len, fb_len_lim); + fb_len = fb_len_lim; + } if (depth != 8 && depth != 16 && depth != 24 && depth != 32) { fprintf(stderr, "FB: can't handle frontend fb depth %d\n", _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:47 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:47 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweTn-00040S-Bs for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:47 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUP-0005hq-M1; Thu, 15 May 2008 14:31:25 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUE-0005Uu-1c for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:14 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweU6-0002O4-F2 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:11 +0000 X-SBRS: 3.6 X-MesageID: 224746 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224746" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:30:15 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUE1N017316 for ; Thu, 15 May 2008 07:30:14 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUXjx003794 for ; Thu, 15 May 2008 07:30:33 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEUWuO003792 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:32 -0700 Message-Id: <200805151430.m4FEUWuO003792@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:32 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86: Fix an S3 bug caused by x_firmware_waking_vector X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210841753 -3600 # Node ID ffbf5d0ff61d39929be663c714a3a958387d6b3d # Parent 57cfcbe761b8aeb03f430c828e25a400d7a9b2d6 x86: Fix an S3 bug caused by x_firmware_waking_vector According to ACPI spec., x_firmware_waking_vector in FACS is for waking up in protected mode and firmware_waking_vector is for in real mode. Xen once use x_firmware_waking_vector which can make S3 failed on some platform. This patch fixed the bug by using non-x one. Signed-off-by: Huacai Chen xen-unstable changeset: 17644:29dc52031954896a407a97cba167c197f8e1c0ed xen-unstable date: Thu May 15 09:38:00 2008 +0100 --- xen/arch/x86/acpi/boot.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff -r 57cfcbe761b8 -r ffbf5d0ff61d xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Thu May 15 09:53:32 2008 +0100 +++ b/xen/arch/x86/acpi/boot.c Thu May 15 09:55:53 2008 +0100 @@ -450,17 +450,10 @@ acpi_fadt_parse_sleep_info(struct fadt_d "FACS is shorter than ACPI spec allow: 0x%x", facs->length); - if ((rsdp->revision < 2) || (facs->length < 32)) { - acpi_sinfo.wakeup_vector = facs_pa + - offsetof(struct facs_descriptor_rev2, - firmware_waking_vector); - acpi_sinfo.vector_width = 32; - } else { - acpi_sinfo.wakeup_vector = facs_pa + - offsetof(struct facs_descriptor_rev2, - xfirmware_waking_vector); - acpi_sinfo.vector_width = 64; - } + acpi_sinfo.wakeup_vector = facs_pa + + offsetof(struct facs_descriptor_rev2, + firmware_waking_vector); + acpi_sinfo.vector_width = 32; printk(KERN_INFO PREFIX " wakeup_vec[%"PRIx64"], vec_size[%x]\n", _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 07:30:53 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 07:30:53 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JweTs-00040V-4O for www-data@colo.xensource.com; Thu, 15 May 2008 07:30:53 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUU-0005la-EW; Thu, 15 May 2008 14:31:30 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JweUJ-0005a2-9x for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:19 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JweU7-0002O6-Gp for xen-changelog@lists.xensource.com; Thu, 15 May 2008 14:31:17 +0000 X-SBRS: 3.6 X-MesageID: 224747 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="224747" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 10:30:16 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUFXS017319 for ; Thu, 15 May 2008 07:30:15 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FEUYpV003811 for ; Thu, 15 May 2008 07:30:34 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FEUX1N003810 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 07:30:33 -0700 Message-Id: <200805151430.m4FEUX1N003810@xenbits.xensource.com> Date: Thu, 15 May 2008 07:30:33 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] Add ZFS libfsimage support patch X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210841959 -3600 # Node ID aee5dc4a4a37005994c9ea7e9eab73043f30cb2c # Parent ffbf5d0ff61d39929be663c714a3a958387d6b3d Add ZFS libfsimage support patch Add support to pygrub and libfsimage to boot ZFS root filesystems. Boot argument of zfs-bootfs is set to describe ZFS root pool and boot filesystem object number. Boot argument bootpath is set to describe the virtual device root mirror components. Signed-off-by: Susan Kamm-Worrell xen-unstable changeset: 17557:64f790e90d3d4797e298cc5abdfc54cb943687f3 xen-unstable date: Thu May 01 16:38:56 2008 +0100 [libfsimage/zfs] compilation fix ZFS libfsimage support. Depending on environments, zfs libfsimage support doesn't compile. This patch fixes it. ia64-linux-gnu-gcc -DPIC -O2 -fomit-frame-pointer -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -I/usr/ia64-linux-gnu/ sys-root/usr/include -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I../../../tools/libfsimage/common/ -Werror -Wp,-MD,.zfs_lzjb.opic.d -fPIC -c -o zfs_lzjb.opic zfs_ lzjb.c In file included from fsys_zfs.h:41, from zfs_lzjb.c:25: zfs-include/zfs_acl.h:29: error: redefinition of typedef uid_t /usr/ia64-linux-gnu/sys-root/usr/include/sys/types.h:82: error: previous declaration of uid_t was here This depends on how __uid_t is defined in the system header. No file under the zfs directory uses uid_t so that just removing the definition in the zfs_acl.h looks reasonable. Signed-off-by: Isaku Yamahata xen-unstable changeset: 17559:1f24743354ea85d3c6485c986522cb1698169bd1 xen-unstable date: Fri May 02 13:47:01 2008 +0100 --- tools/libfsimage/Makefile | 2 tools/libfsimage/common/fsimage.c | 29 tools/libfsimage/common/fsimage.h | 6 tools/libfsimage/common/fsimage_grub.c | 4 tools/libfsimage/common/fsimage_grub.h | 8 tools/libfsimage/common/fsimage_priv.h | 3 tools/libfsimage/common/mapfile-GNU | 3 tools/libfsimage/common/mapfile-SunOS | 3 tools/libfsimage/zfs/Makefile | 37 tools/libfsimage/zfs/fsys_zfs.c | 1457 ++++++++++++++++++++++ tools/libfsimage/zfs/fsys_zfs.h | 203 +++ tools/libfsimage/zfs/mb_info.h | 217 +++ tools/libfsimage/zfs/zfs-include/dmu.h | 105 + tools/libfsimage/zfs/zfs-include/dmu_objset.h | 35 tools/libfsimage/zfs/zfs-include/dnode.h | 76 + tools/libfsimage/zfs/zfs-include/dsl_dataset.h | 53 tools/libfsimage/zfs/zfs-include/dsl_dir.h | 49 tools/libfsimage/zfs/zfs-include/spa.h | 283 ++++ tools/libfsimage/zfs/zfs-include/uberblock_impl.h | 49 tools/libfsimage/zfs/zfs-include/vdev_impl.h | 70 + tools/libfsimage/zfs/zfs-include/zap_impl.h | 110 + tools/libfsimage/zfs/zfs-include/zap_leaf.h | 100 + tools/libfsimage/zfs/zfs-include/zfs.h | 112 + tools/libfsimage/zfs/zfs-include/zfs_acl.h | 55 tools/libfsimage/zfs/zfs-include/zfs_znode.h | 68 + tools/libfsimage/zfs/zfs-include/zil.h | 51 tools/libfsimage/zfs/zfs-include/zio.h | 81 + tools/libfsimage/zfs/zfs-include/zio_checksum.h | 42 tools/libfsimage/zfs/zfs_fletcher.c | 93 + tools/libfsimage/zfs/zfs_lzjb.c | 60 tools/libfsimage/zfs/zfs_sha256.c | 124 + tools/pygrub/src/fsimage/fsimage.c | 24 tools/pygrub/src/pygrub | 18 33 files changed, 3621 insertions(+), 9 deletions(-) diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/Makefile --- a/tools/libfsimage/Makefile Thu May 15 09:55:53 2008 +0100 +++ b/tools/libfsimage/Makefile Thu May 15 09:59:19 2008 +0100 @@ -1,7 +1,7 @@ XEN_ROOT = ../.. XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk -SUBDIRS-y = common ufs reiserfs iso9660 fat +SUBDIRS-y = common ufs reiserfs iso9660 fat zfs SUBDIRS-y += $(shell ./check-libext2fs) .PHONY: all diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/common/fsimage.c --- a/tools/libfsimage/common/fsimage.c Thu May 15 09:55:53 2008 +0100 +++ b/tools/libfsimage/common/fsimage.c Thu May 15 09:59:19 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -51,6 +51,7 @@ fsi_t *fsi_open_fsimage(const char *path fsi->f_fd = fd; fsi->f_off = off; fsi->f_data = NULL; + fsi->f_bootstring = NULL; pthread_mutex_lock(&fsi_lock); err = find_plugin(fsi, path, options); @@ -140,3 +141,29 @@ ssize_t fsi_pread_file(fsi_file_t *ffi, return (ret); } + +char * +fsi_bootstring_alloc(fsi_t *fsi, size_t len) +{ + fsi->f_bootstring = malloc(len); + if (fsi->f_bootstring == NULL) + return (NULL); + + bzero(fsi->f_bootstring, len); + return (fsi->f_bootstring); +} + +void +fsi_bootstring_free(fsi_t *fsi) +{ + if (fsi->f_bootstring != NULL) { + free(fsi->f_bootstring); + fsi->f_bootstring = NULL; + } +} + +char * +fsi_fs_bootstring(fsi_t *fsi) +{ + return (fsi->f_bootstring); +} diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/common/fsimage.h --- a/tools/libfsimage/common/fsimage.h Thu May 15 09:55:53 2008 +0100 +++ b/tools/libfsimage/common/fsimage.h Thu May 15 09:59:19 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -45,6 +45,10 @@ ssize_t fsi_read_file(fsi_file_t *, void ssize_t fsi_read_file(fsi_file_t *, void *, size_t); ssize_t fsi_pread_file(fsi_file_t *, void *, size_t, uint64_t); +char *fsi_bootstring_alloc(fsi_t *, size_t); +void fsi_bootstring_free(fsi_t *); +char *fsi_fs_bootstring(fsi_t *); + #ifdef __cplusplus }; #endif diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/common/fsimage_grub.c --- a/tools/libfsimage/common/fsimage_grub.c Thu May 15 09:55:53 2008 +0100 +++ b/tools/libfsimage/common/fsimage_grub.c Thu May 15 09:59:19 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -258,6 +258,7 @@ fsig_mount(fsi_t *fsi, const char *path, if (!ops->fpo_mount(ffi, options)) { fsip_file_free(ffi); + fsi_bootstring_free(fsi); free(fsi->f_data); fsi->f_data = NULL; return (-1); @@ -271,6 +272,7 @@ static int static int fsig_umount(fsi_t *fsi) { + fsi_bootstring_free(fsi); free(fsi->f_data); return (0); } diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/common/fsimage_grub.h --- a/tools/libfsimage/common/fsimage_grub.h Thu May 15 09:55:53 2008 +0100 +++ b/tools/libfsimage/common/fsimage_grub.h Thu May 15 09:59:19 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -72,6 +72,12 @@ unsigned long fsig_log2(unsigned long); #define ERR_FILELENGTH 1 #define ERR_BAD_FILETYPE 1 #define ERR_FILE_NOT_FOUND 1 +#define ERR_BAD_ARGUMENT 1 +#define ERR_FILESYSTEM_NOT_FOUND 1 +#define ERR_NO_BOOTPATH 1 +#define ERR_DEV_VALUES 1 +#define ERR_WONT_FIT 1 +#define ERR_READ 1 fsi_plugin_ops_t *fsig_init(fsi_plugin_t *, fsig_plugin_ops_t *); diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/common/fsimage_priv.h --- a/tools/libfsimage/common/fsimage_priv.h Thu May 15 09:55:53 2008 +0100 +++ b/tools/libfsimage/common/fsimage_priv.h Thu May 15 09:59:19 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -46,6 +46,7 @@ struct fsi { uint64_t f_off; void *f_data; fsi_plugin_t *f_plugin; + char *f_bootstring; }; struct fsi_file { diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/common/mapfile-GNU --- a/tools/libfsimage/common/mapfile-GNU Thu May 15 09:55:53 2008 +0100 +++ b/tools/libfsimage/common/mapfile-GNU Thu May 15 09:59:19 2008 +0100 @@ -8,6 +8,9 @@ VERSION { fsi_close_file; fsi_read_file; fsi_pread_file; + fsi_bootstring_alloc; + fsi_bootstring_free; + fsi_fs_bootstring; fsip_fs_set_data; fsip_file_alloc; diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/common/mapfile-SunOS --- a/tools/libfsimage/common/mapfile-SunOS Thu May 15 09:55:53 2008 +0100 +++ b/tools/libfsimage/common/mapfile-SunOS Thu May 15 09:59:19 2008 +0100 @@ -7,6 +7,9 @@ libfsimage.so.1.0 { fsi_close_file; fsi_read_file; fsi_pread_file; + fsi_bootstring_alloc; + fsi_bootstring_free; + fsi_fs_bootstring; fsip_fs_set_data; fsip_file_alloc; diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/Makefile Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,37 @@ +# +# GRUB -- GRand Unified Bootloader +# Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +XEN_ROOT = ../../.. + +LIB_SRCS-y = fsys_zfs.c zfs_lzjb.c zfs_sha256.c zfs_fletcher.c + +FS = zfs + +.PHONY: all +all: fs-all + +.PHONY: install +install: fs-install + +include $(XEN_ROOT)/tools/libfsimage/Rules.mk diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/fsys_zfs.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/fsys_zfs.c Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,1457 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * All files in the zfs directory are derived from the OpenSolaris + * zfs grub files. All files in the zfs-include directory were + * included without changes. + */ + +/* + * The zfs plug-in routines for GRUB are: + * + * zfs_mount() - locates a valid uberblock of the root pool and reads + * in its MOS at the memory address MOS. + * + * zfs_open() - locates a plain file object by following the MOS + * and places its dnode at the memory address DNODE. + * + * zfs_read() - read in the data blocks pointed by the DNODE. + * + * ZFS_SCRATCH is used as a working area. + * + * (memory addr) MOS DNODE ZFS_SCRATCH + * | | | + * +-------V---------V----------V---------------+ + * memory | | dnode | dnode | scratch | + * | | 512B | 512B | area | + * +--------------------------------------------+ + */ + +#include +#include + +/* From "shared.h" */ +#include "mb_info.h" + +/* Boot signature related defines for the findroot command */ +#define BOOTSIGN_DIR "/boot/grub/bootsign" +#define BOOTSIGN_BACKUP "/etc/bootsign" + +/* Maybe redirect memory requests through grub_scratch_mem. */ +#define RAW_ADDR(x) (x) +#define RAW_SEG(x) (x) + +/* ZFS will use the top 4 Meg of physical memory (below 4Gig) for sratch */ +#define ZFS_SCRATCH_SIZE 0x400000 + +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +/* End from shared.h */ + +#include "fsys_zfs.h" + +/* cache for a file block of the currently zfs_open()-ed file */ +#define file_buf zfs_ba->zfs_file_buf +#define file_start zfs_ba->zfs_file_start +#define file_end zfs_ba->zfs_file_end + +/* cache for a dnode block */ +#define dnode_buf zfs_ba->zfs_dnode_buf +#define dnode_mdn zfs_ba->zfs_dnode_mdn +#define dnode_start zfs_ba->zfs_dnode_start +#define dnode_end zfs_ba->zfs_dnode_end + +#define stackbase zfs_ba->zfs_stackbase + +decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = +{ + {"noop", 0}, + {"on", lzjb_decompress}, /* ZIO_COMPRESS_ON */ + {"off", 0}, + {"lzjb", lzjb_decompress} /* ZIO_COMPRESS_LZJB */ +}; + +/* From disk_io.c */ +/* ZFS root filesystem for booting */ +#define current_bootpath zfs_ba->zfs_current_bootpath +#define current_rootpool zfs_ba->zfs_current_rootpool +#define current_bootfs zfs_ba->zfs_current_bootfs +#define current_bootfs_obj zfs_ba->zfs_current_bootfs_obj +#define is_zfs_mount (*fsig_int1(ffi)) +/* End from disk_io.c */ + +#define is_zfs_open zfs_ba->zfs_open + +/* + * Our own version of bcmp(). + */ +static int +zfs_bcmp(const void *s1, const void *s2, size_t n) +{ + const unsigned char *ps1 = s1; + const unsigned char *ps2 = s2; + + if (s1 != s2 && n != 0) { + do { + if (*ps1++ != *ps2++) + return (1); + } while (--n != 0); + } + + return (0); +} + +/* + * Our own version of log2(). Same thing as highbit()-1. + */ +static int +zfs_log2(uint64_t num) +{ + int i = 0; + + while (num > 1) { + i++; + num = num >> 1; + } + + return (i); +} + +/* Checksum Functions */ +static void +zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0); +} + +/* Checksum Table and Values */ +zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { + {{NULL, NULL}, 0, 0, "inherit"}, + {{NULL, NULL}, 0, 0, "on"}, + {{zio_checksum_off, zio_checksum_off}, 0, 0, "off"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 1, "label"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 1, "gang_header"}, + {{fletcher_2_native, fletcher_2_byteswap}, 0, 1, "zilog"}, + {{fletcher_2_native, fletcher_2_byteswap}, 0, 0, "fletcher2"}, + {{fletcher_4_native, fletcher_4_byteswap}, 1, 0, "fletcher4"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 0, "SHA256"} +}; + +/* + * zio_checksum_verify: Provides support for checksum verification. + * + * Fletcher2, Fletcher4, and SHA256 are supported. + * + * Return: + * -1 = Failure + * 0 = Success + */ +static int +zio_checksum_verify(blkptr_t *bp, char *data, int size) +{ + zio_cksum_t zc = bp->blk_cksum; + uint32_t checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : + BP_GET_CHECKSUM(bp); + int byteswap = BP_SHOULD_BYTESWAP(bp); + zio_block_tail_t *zbt = (zio_block_tail_t *)(data + size) - 1; + zio_checksum_info_t *ci = &zio_checksum_table[checksum]; + zio_cksum_t actual_cksum, expected_cksum; + + /* byteswap is not supported */ + if (byteswap) + return (-1); + + if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL) + return (-1); + + if (ci->ci_zbt) { + if (checksum == ZIO_CHECKSUM_GANG_HEADER) { + /* + * 'gang blocks' is not supported. + */ + return (-1); + } + + if (zbt->zbt_magic == BSWAP_64(ZBT_MAGIC)) { + /* byte swapping is not supported */ + return (-1); + } else { + expected_cksum = zbt->zbt_cksum; + zbt->zbt_cksum = zc; + ci->ci_func[0](data, size, &actual_cksum); + zbt->zbt_cksum = expected_cksum; + } + zc = expected_cksum; + + } else { + if (BP_IS_GANG(bp)) + return (-1); + ci->ci_func[byteswap](data, size, &actual_cksum); + } + + if ((actual_cksum.zc_word[0] - zc.zc_word[0]) | + (actual_cksum.zc_word[1] - zc.zc_word[1]) | + (actual_cksum.zc_word[2] - zc.zc_word[2]) | + (actual_cksum.zc_word[3] - zc.zc_word[3])) + return (-1); + + return (0); +} + +/* + * vdev_label_offset takes "offset" (the offset within a vdev_label) and + * returns its physical disk offset (starting from the beginning of the vdev). + * + * Input: + * psize : Physical size of this vdev + * l : Label Number (0-3) + * offset : The offset with a vdev_label in which we want the physical + * address + * Return: + * Success : physical disk offset + * Failure : errnum = ERR_BAD_ARGUMENT, return value is meaningless + */ +static uint64_t +vdev_label_offset(fsi_file_t *ffi, uint64_t psize, int l, uint64_t offset) +{ + /* XXX Need to add back label support! */ + if (l >= VDEV_LABELS/2 || offset > sizeof (vdev_label_t)) { + errnum = ERR_BAD_ARGUMENT; + return (0); + } + + return (offset + l * sizeof (vdev_label_t) + (l < VDEV_LABELS / 2 ? + 0 : psize - VDEV_LABELS * sizeof (vdev_label_t))); + +} + +/* + * vdev_uberblock_compare takes two uberblock structures and returns an integer + * indicating the more recent of the two. + * Return Value = 1 if ub2 is more recent + * Return Value = -1 if ub1 is more recent + * The most recent uberblock is determined using its transaction number and + * timestamp. The uberblock with the highest transaction number is + * considered "newer". If the transaction numbers of the two blocks match, the + * timestamps are compared to determine the "newer" of the two. + */ +static int +vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2) +{ + if (ub1->ub_txg < ub2->ub_txg) + return (-1); + if (ub1->ub_txg > ub2->ub_txg) + return (1); + + if (ub1->ub_timestamp < ub2->ub_timestamp) + return (-1); + if (ub1->ub_timestamp > ub2->ub_timestamp) + return (1); + + return (0); +} + +/* + * Three pieces of information are needed to verify an uberblock: the magic + * number, the version number, and the checksum. + * + * Currently Implemented: version number, magic number + * Need to Implement: checksum + * + * Return: + * 0 - Success + * -1 - Failure + */ +static int +uberblock_verify(uberblock_phys_t *ub, int offset) +{ + + uberblock_t *uber = &ub->ubp_uberblock; + blkptr_t bp; + + BP_ZERO(&bp); + BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); + BP_SET_BYTEORDER(&bp, ZFS_HOST_BYTEORDER); + ZIO_SET_CHECKSUM(&bp.blk_cksum, offset, 0, 0, 0); + + if (zio_checksum_verify(&bp, (char *)ub, UBERBLOCK_SIZE) != 0) + return (-1); + + if (uber->ub_magic == UBERBLOCK_MAGIC && + uber->ub_version >= SPA_VERSION_1 && + uber->ub_version <= SPA_VERSION) + return (0); + + return (-1); +} + +/* + * Find the best uberblock. + * Return: + * Success - Pointer to the best uberblock. + * Failure - NULL + */ +static uberblock_phys_t * +find_bestub(fsi_file_t *ffi, uberblock_phys_t *ub_array, int label) +{ + uberblock_phys_t *ubbest = NULL; + int i, offset; + + for (i = 0; i < (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT); i++) { + offset = vdev_label_offset(ffi, 0, label, + VDEV_UBERBLOCK_OFFSET(i)); + if (errnum == ERR_BAD_ARGUMENT) + return (NULL); + if (uberblock_verify(&ub_array[i], offset) == 0) { + if (ubbest == NULL) { + ubbest = &ub_array[i]; + } else if (vdev_uberblock_compare( + &(ub_array[i].ubp_uberblock), + &(ubbest->ubp_uberblock)) > 0) { + ubbest = &ub_array[i]; + } + } + } + + return (ubbest); +} + +/* + * Read in a block and put its uncompressed data in buf. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +zio_read(fsi_file_t *ffi, blkptr_t *bp, void *buf, char *stack) +{ + uint64_t offset, sector; + int psize, lsize; + int i, comp, cksum; + + psize = BP_GET_PSIZE(bp); + lsize = BP_GET_LSIZE(bp); + comp = BP_GET_COMPRESS(bp); + cksum = BP_GET_CHECKSUM(bp); + + if ((unsigned int)comp >= ZIO_COMPRESS_FUNCTIONS || + (comp != ZIO_COMPRESS_OFF && + decomp_table[comp].decomp_func == NULL)) + return (ERR_FSYS_CORRUPT); + + /* pick a good dva from the block pointer */ + for (i = 0; i < SPA_DVAS_PER_BP; i++) { + + if (bp->blk_dva[i].dva_word[0] == 0 && + bp->blk_dva[i].dva_word[1] == 0) + continue; + + /* read in a block */ + offset = DVA_GET_OFFSET(&bp->blk_dva[i]); + sector = DVA_OFFSET_TO_PHYS_SECTOR(offset); + + if (comp != ZIO_COMPRESS_OFF) { + + if (devread(ffi, sector, 0, psize, stack) == 0) + continue; + if (zio_checksum_verify(bp, stack, psize) != 0) + continue; + decomp_table[comp].decomp_func(stack, buf, psize, + lsize); + } else { + if (devread(ffi, sector, 0, psize, buf) == 0) + continue; + if (zio_checksum_verify(bp, buf, psize) != 0) + continue; + } + return (0); + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Get the block from a block id. + * push the block onto the stack. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +dmu_read(fsi_file_t *ffi, dnode_phys_t *dn, uint64_t blkid, void *buf, + char *stack) +{ + int idx, level; + blkptr_t *bp_array = dn->dn_blkptr; + int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; + blkptr_t *bp, *tmpbuf; + + bp = (blkptr_t *)stack; + stack += sizeof (blkptr_t); + + tmpbuf = (blkptr_t *)stack; + stack += 1<dn_indblkshift; + + for (level = dn->dn_nlevels - 1; level >= 0; level--) { + idx = (blkid >> (epbs * level)) & ((1<dn_datablkszsec << SPA_MINBLOCKSHIFT); + break; + } else if ((errnum = zio_read(ffi, bp, tmpbuf, stack))) { + return (errnum); + } + bp_array = tmpbuf; + } + + return (0); +} + +/* + * mzap_lookup: Looks up property described by "name" and returns the value + * in "value". + * + * Return: + * 0 - success + * errnum - failure + */ +static int +mzap_lookup(mzap_phys_t *zapobj, int objsize, char *name, + uint64_t *value) +{ + int i, chunks; + mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; + + chunks = objsize/MZAP_ENT_LEN - 1; + for (i = 0; i < chunks; i++) { + if (strcmp(mzap_ent[i].mze_name, name) == 0) { + *value = mzap_ent[i].mze_value; + return (0); + } + } + + return (ERR_FSYS_CORRUPT); +} + +static uint64_t +zap_hash(fsi_file_t *ffi, uint64_t salt, const char *name) +{ + static uint64_t table[256]; + const uint8_t *cp; + uint8_t c; + uint64_t crc = salt; + + if (table[128] == 0) { + uint64_t *ct; + int i, j; + for (i = 0; i < 256; i++) { + for (ct = table + i, *ct = i, j = 8; j > 0; j--) + *ct = (*ct >> 1) ^ (-(*ct & 1) & + ZFS_CRC64_POLY); + } + } + + if (crc == 0 || table[128] != ZFS_CRC64_POLY) { + errnum = ERR_FSYS_CORRUPT; + return (0); + } + + for (cp = (const uint8_t *)name; (c = *cp) != '\0'; cp++) + crc = (crc >> 8) ^ table[(crc ^ c) & 0xFF]; + + /* + * Only use 28 bits, since we need 4 bits in the cookie for the + * collision differentiator. We MUST use the high bits, since + * those are the onces that we first pay attention to when + * chosing the bucket. + */ + crc &= ~((1ULL << (64 - ZAP_HASHBITS)) - 1); + + return (crc); +} + +/* + * Only to be used on 8-bit arrays. + * array_len is actual len in bytes (not encoded le_value_length). + * buf is null-terminated. + */ +static int +zap_leaf_array_equal(zap_leaf_phys_t *l, int blksft, int chunk, + int array_len, const char *buf) +{ + int bseen = 0; + + while (bseen < array_len) { + struct zap_leaf_array *la = + &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array; + int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); + + if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) + return (0); + + if (zfs_bcmp(la->la_array, buf + bseen, toread) != 0) + break; + chunk = la->la_next; + bseen += toread; + } + return (bseen == array_len); +} + +/* + * Given a zap_leaf_phys_t, walk thru the zap leaf chunks to get the + * value for the property "name". + * + * Return: + * 0 - success + * errnum - failure + */ +static int +zap_leaf_lookup(zap_leaf_phys_t *l, int blksft, uint64_t h, + const char *name, uint64_t *value) +{ + uint16_t chunk; + struct zap_leaf_entry *le; + + /* Verify if this is a valid leaf block */ + if (l->l_hdr.lh_block_type != ZBT_LEAF) + return (ERR_FSYS_CORRUPT); + if (l->l_hdr.lh_magic != ZAP_LEAF_MAGIC) + return (ERR_FSYS_CORRUPT); + + for (chunk = l->l_hash[LEAF_HASH(blksft, h)]; + chunk != CHAIN_END; chunk = le->le_next) { + + if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) + return (ERR_FSYS_CORRUPT); + + le = ZAP_LEAF_ENTRY(l, blksft, chunk); + + /* Verify the chunk entry */ + if (le->le_type != ZAP_CHUNK_ENTRY) + return (ERR_FSYS_CORRUPT); + + if (le->le_hash != h) + continue; + + if (zap_leaf_array_equal(l, blksft, le->le_name_chunk, + le->le_name_length, name)) { + + struct zap_leaf_array *la; + uint8_t *ip; + + if (le->le_int_size != 8 || le->le_value_length != 1) + return (ERR_FSYS_CORRUPT); + + /* get the uint64_t property value */ + la = &ZAP_LEAF_CHUNK(l, blksft, + le->le_value_chunk).l_array; + ip = la->la_array; + + *value = (uint64_t)ip[0] << 56 | (uint64_t)ip[1] << 48 | + (uint64_t)ip[2] << 40 | (uint64_t)ip[3] << 32 | + (uint64_t)ip[4] << 24 | (uint64_t)ip[5] << 16 | + (uint64_t)ip[6] << 8 | (uint64_t)ip[7]; + + return (0); + } + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Fat ZAP lookup + * + * Return: + * 0 - success + * errnum - failure + */ +static int +fzap_lookup(fsi_file_t *ffi, dnode_phys_t *zap_dnode, zap_phys_t *zap, + char *name, uint64_t *value, char *stack) +{ + zap_leaf_phys_t *l; + uint64_t hash, idx, blkid; + int blksft = zfs_log2(zap_dnode->dn_datablkszsec << DNODE_SHIFT); + + /* Verify if this is a fat zap header block */ + if (zap->zap_magic != (uint64_t)ZAP_MAGIC) + return (ERR_FSYS_CORRUPT); + + hash = zap_hash(ffi, zap->zap_salt, name); + if (errnum) + return (errnum); + + /* get block id from index */ + if (zap->zap_ptrtbl.zt_numblks != 0) { + /* external pointer tables not supported */ + return (ERR_FSYS_CORRUPT); + } + idx = ZAP_HASH_IDX(hash, zap->zap_ptrtbl.zt_shift); + blkid = ((uint64_t *)zap)[idx + (1<<(blksft-3-1))]; + + /* Get the leaf block */ + l = (zap_leaf_phys_t *)stack; + stack += 1<dn_datablkszsec << SPA_MINBLOCKSHIFT; + stack += size; + if ((errnum = dmu_read(ffi, zap_dnode, 0, zapbuf, stack))) + return (errnum); + + block_type = *((uint64_t *)zapbuf); + + if (block_type == ZBT_MICRO) { + return (mzap_lookup(zapbuf, size, name, val)); + } else if (block_type == ZBT_HEADER) { + /* this is a fat zap */ + return (fzap_lookup(ffi, zap_dnode, zapbuf, name, + val, stack)); + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Get the dnode of an object number from the metadnode of an object set. + * + * Input + * mdn - metadnode to get the object dnode + * objnum - object number for the object dnode + * buf - data buffer that holds the returning dnode + * stack - scratch area + * + * Return: + * 0 - success + * errnum - failure + */ +static int +dnode_get(fsi_file_t *ffi, dnode_phys_t *mdn, uint64_t objnum, + uint8_t type, dnode_phys_t *buf, char *stack) +{ + uint64_t blkid, blksz; /* the block id this object dnode is in */ + int epbs; /* shift of number of dnodes in a block */ + int idx; /* index within a block */ + dnode_phys_t *dnbuf; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + blksz = mdn->dn_datablkszsec << SPA_MINBLOCKSHIFT; + epbs = zfs_log2(blksz) - DNODE_SHIFT; + blkid = objnum >> epbs; + idx = objnum & ((1<= dnode_start && objnum < dnode_end) { + grub_memmove(buf, &dnode_buf[idx], DNODE_SIZE); + VERIFY_DN_TYPE(buf, type); + return (0); + } + + if (dnode_buf && blksz == 1< ZPL_VERSION) + return (-1); + + if ((errnum = zap_lookup(ffi, dn, ZFS_ROOT_OBJ, &objnum, stack))) + return (errnum); + + if ((errnum = dnode_get(ffi, mdn, objnum, DMU_OT_DIRECTORY_CONTENTS, + dn, stack))) + return (errnum); + + /* skip leading slashes */ + while (*path == '/') + path++; + + while (*path && !isspace(*path)) { + + /* get the next component name */ + cname = path; + while (*path && !isspace(*path) && *path != '/') + path++; + ch = *path; + *path = 0; /* ensure null termination */ + + if ((errnum = zap_lookup(ffi, dn, cname, &objnum, stack))) + return (errnum); + + objnum = ZFS_DIRENT_OBJ(objnum); + if ((errnum = dnode_get(ffi, mdn, objnum, 0, dn, stack))) + return (errnum); + + *path = ch; + while (*path == '/') + path++; + } + + /* We found the dnode for this file. Verify if it is a plain file. */ + VERIFY_DN_TYPE(dn, DMU_OT_PLAIN_FILE_CONTENTS); + + return (0); +} + +/* + * Get the default 'bootfs' property value from the rootpool. + * + * Return: + * 0 - success + * errnum -failure + */ +static int +get_default_bootfsobj(fsi_file_t *ffi, dnode_phys_t *mosmdn, + uint64_t *obj, char *stack) +{ + uint64_t objnum = 0; + dnode_phys_t *dn = (dnode_phys_t *)stack; + stack += DNODE_SIZE; + + if ((errnum = dnode_get(ffi, mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, dn, stack))) + return (errnum); + + /* + * find the object number for 'pool_props', and get the dnode + * of the 'pool_props'. + */ + if (zap_lookup(ffi, dn, DMU_POOL_PROPS, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_POOL_PROPS, dn, + stack))) + return (errnum); + + if (zap_lookup(ffi, dn, ZPOOL_PROP_BOOTFS, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (!objnum) + return (ERR_FILESYSTEM_NOT_FOUND); + + + *obj = objnum; + return (0); +} + +/* + * Given a MOS metadnode, get the metadnode of a given filesystem name (fsname), + * e.g. pool/rootfs, or a given object number (obj), e.g. the object number + * of pool/rootfs. + * + * If no fsname and no obj are given, return the DSL_DIR metadnode. + * If fsname is given, return its metadnode and its matching object number. + * If only obj is given, return the metadnode for this object number. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +get_objset_mdn(fsi_file_t *ffi, dnode_phys_t *mosmdn, char *fsname, + uint64_t *obj, dnode_phys_t *mdn, char *stack) +{ + uint64_t objnum, headobj; + char *cname, ch; + blkptr_t *bp; + objset_phys_t *osp; + + if (fsname == NULL && obj) { + headobj = *obj; + goto skip; + } + + if ((errnum = dnode_get(ffi, mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, mdn, stack))) + return (errnum); + + if ((errnum = zap_lookup(ffi, mdn, DMU_POOL_ROOT_DATASET, &objnum, + stack))) + return (errnum); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_DSL_DIR, mdn, + stack))) + return (errnum); + + if (fsname == NULL) { + headobj = + ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; + goto skip; + } + + /* take out the pool name */ + while (*fsname && !isspace(*fsname) && *fsname != '/') + fsname++; + + while (*fsname && !isspace(*fsname)) { + uint64_t childobj; + + while (*fsname == '/') + fsname++; + + cname = fsname; + while (*fsname && !isspace(*fsname) && *fsname != '/') + fsname++; + ch = *fsname; + *fsname = 0; + + childobj = + ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_child_dir_zapobj; + if ((errnum = dnode_get(ffi, mosmdn, childobj, + DMU_OT_DSL_DIR_CHILD_MAP, mdn, stack))) + return (errnum); + + if (zap_lookup(ffi, mdn, cname, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_DSL_DIR, + mdn, stack))) + return (errnum); + + *fsname = ch; + } + headobj = ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; + if (obj) + *obj = headobj; + +skip: + if ((errnum = dnode_get(ffi, mosmdn, headobj, DMU_OT_DSL_DATASET, mdn, + stack))) + return (errnum); + + /* TODO: Add snapshot support here - for fsname=snapshot-name */ + + bp = &((dsl_dataset_phys_t *)DN_BONUS(mdn))->ds_bp; + osp = (objset_phys_t *)stack; + stack += sizeof (objset_phys_t); + if ((errnum = zio_read(ffi, bp, osp, stack))) + return (errnum); + + grub_memmove((char *)mdn, (char *)&osp->os_meta_dnode, DNODE_SIZE); + + return (0); +} + +/* + * For a given XDR packed nvlist, verify the first 4 bytes and move on. + * + * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) : + * + * encoding method/host endian (4 bytes) + * nvl_version (4 bytes) + * nvl_nvflag (4 bytes) + * encoded nvpairs: + * encoded size of the nvpair (4 bytes) + * decoded size of the nvpair (4 bytes) + * name string size (4 bytes) + * name string data (sizeof(NV_ALIGN4(string)) + * data type (4 bytes) + * # of elements in the nvpair (4 bytes) + * data + * 2 zero's for the last nvpair + * (end of the entire list) (8 bytes) + * + * Return: + * 0 - success + * 1 - failure + */ +static int +nvlist_unpack(char *nvlist, char **out) +{ + /* Verify if the 1st and 2nd byte in the nvlist are valid. */ + if (nvlist[0] != NV_ENCODE_XDR || nvlist[1] != HOST_ENDIAN) + return (1); + + nvlist += 4; + *out = nvlist; + return (0); +} + +static char * +nvlist_array(char *nvlist, int index) +{ + int i, encode_size; + + for (i = 0; i < index; i++) { + /* skip the header, nvl_version, and nvl_nvflag */ + nvlist = nvlist + 4 * 2; + + while ((encode_size = BSWAP_32(*(uint32_t *)nvlist))) + nvlist += encode_size; /* goto the next nvpair */ + + nvlist = nvlist + 4 * 2; /* skip the ending 2 zeros - 8 bytes */ + } + + return (nvlist); +} + +static int +nvlist_lookup_value(char *nvlist, char *name, void *val, int valtype, + int *nelmp) +{ + int name_len, type, slen, encode_size; + char *nvpair, *nvp_name, *strval = val; + uint64_t *intval = val; + + /* skip the header, nvl_version, and nvl_nvflag */ + nvlist = nvlist + 4 * 2; + + /* + * Loop thru the nvpair list + * The XDR representation of an integer is in big-endian byte order. + */ + while ((encode_size = BSWAP_32(*(uint32_t *)nvlist))) { + + nvpair = nvlist + 4 * 2; /* skip the encode/decode size */ + + name_len = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + + nvp_name = nvpair; + nvpair = nvpair + ((name_len + 3) & ~3); /* align */ + + type = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + + if (((strncmp(nvp_name, name, name_len) == 0) && + type == valtype)) { + int nelm; + + if (((nelm = BSWAP_32(*(uint32_t *)nvpair)) < 1)) + return (1); + nvpair += 4; + + switch (valtype) { + case DATA_TYPE_STRING: + slen = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + grub_memmove(strval, nvpair, slen); + strval[slen] = '\0'; + return (0); + + case DATA_TYPE_UINT64: + *intval = BSWAP_64(*(uint64_t *)nvpair); + return (0); + + case DATA_TYPE_NVLIST: + *(void **)val = (void *)nvpair; + return (0); + + case DATA_TYPE_NVLIST_ARRAY: + *(void **)val = (void *)nvpair; + if (nelmp) + *nelmp = nelm; + return (0); + } + } + + nvlist += encode_size; /* goto the next nvpair */ + } + + return (1); +} + +/* + * Check if this vdev is online and is in a good state. + */ +static int +vdev_validate(char *nv) +{ + uint64_t ival; + + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_OFFLINE, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_FAULTED, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_DEGRADED, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_REMOVED, &ival, + DATA_TYPE_UINT64, NULL) == 0) + return (ERR_DEV_VALUES); + + return (0); +} + +/* + * Get a list of valid vdev pathname from the boot device. + * The caller should already allocate MAXNAMELEN memory for bootpath. + */ +static int +vdev_get_bootpath(char *nv, char *bootpath) +{ + char type[16]; + + bootpath[0] = '\0'; + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_TYPE, &type, DATA_TYPE_STRING, + NULL)) + return (ERR_FSYS_CORRUPT); + + if (strcmp(type, VDEV_TYPE_DISK) == 0) { + if (vdev_validate(nv) != 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_PHYS_PATH, bootpath, + DATA_TYPE_STRING, NULL) != 0) + return (ERR_NO_BOOTPATH); + + } else if (strcmp(type, VDEV_TYPE_MIRROR) == 0) { + int nelm, i; + char *child; + + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_CHILDREN, &child, + DATA_TYPE_NVLIST_ARRAY, &nelm)) + return (ERR_FSYS_CORRUPT); + + for (i = 0; i < nelm; i++) { + char tmp_path[MAXNAMELEN]; + char *child_i; + + child_i = nvlist_array(child, i); + if (vdev_validate(child_i) != 0) + continue; + + if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_PHYS_PATH, + tmp_path, DATA_TYPE_STRING, NULL) != 0) + return (ERR_NO_BOOTPATH); + + if ((strlen(bootpath) + strlen(tmp_path)) > MAXNAMELEN) + return (ERR_WONT_FIT); + + if (strlen(bootpath) == 0) + sprintf(bootpath, "%s", tmp_path); + else + sprintf(bootpath, "%s %s", bootpath, tmp_path); + } + } + + return (strlen(bootpath) > 0 ? 0 : ERR_NO_BOOTPATH); +} + +/* + * Check the disk label information and retrieve needed vdev name-value pairs. + * + * Return: + * 0 - success + * ERR_* - failure + */ +static int +check_pool_label(fsi_file_t *ffi, int label, char *stack) +{ + vdev_phys_t *vdev; + uint64_t sector, pool_state, txg = 0; + char *nvlist, *nv; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + sector = (label * sizeof (vdev_label_t) + VDEV_SKIP_SIZE + + VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT; + + /* Read in the vdev name-value pair list (112K). */ + if (devread(ffi, sector, 0, VDEV_PHYS_SIZE, stack) == 0) + return (ERR_READ); + + vdev = (vdev_phys_t *)stack; + + if (nvlist_unpack(vdev->vp_nvlist, &nvlist)) + return (ERR_FSYS_CORRUPT); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_STATE, &pool_state, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + + if (pool_state == POOL_STATE_DESTROYED) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_NAME, + current_rootpool, DATA_TYPE_STRING, NULL)) + return (ERR_FSYS_CORRUPT); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_TXG, &txg, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + + /* not an active device */ + if (txg == 0) + return (ERR_NO_BOOTPATH); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_VDEV_TREE, &nv, + DATA_TYPE_NVLIST, NULL)) + return (ERR_FSYS_CORRUPT); + + if (vdev_get_bootpath(nv, current_bootpath)) + return (ERR_NO_BOOTPATH); + + return (0); +} + +/* + * zfs_mount() locates a valid uberblock of the root pool and read in its MOS + * to the memory address MOS. + * + * Return: + * 1 - success + * 0 - failure + */ +int +zfs_mount(fsi_file_t *ffi, const char *options) +{ + char *stack; + int label = 0; + uberblock_phys_t *ub_array, *ubbest = NULL; + objset_phys_t *osp; + zfs_bootarea_t *zfs_ba; + + /* if zfs is already mounted, don't do it again */ + if (is_zfs_mount == 1) + return (1); + + /* get much bigger data block for zfs */ + if (((zfs_ba = malloc(sizeof (zfs_bootarea_t))) == NULL)) { + return (1); + } + bzero(zfs_ba, sizeof (zfs_bootarea_t)); + + /* replace small data area in fsi with big one */ + free(ffi->ff_fsi->f_data); + ffi->ff_fsi->f_data = (void *)zfs_ba; + + /* If an boot filesystem is passed in, set it to current_bootfs */ + if (options != NULL) { + if (strlen(options) < MAXNAMELEN) { + strcpy(current_bootfs, options); + } + } + + stackbase = ZFS_SCRATCH; + stack = stackbase; + ub_array = (uberblock_phys_t *)stack; + stack += VDEV_UBERBLOCK_RING; + + osp = (objset_phys_t *)stack; + stack += sizeof (objset_phys_t); + + /* XXX add back labels support? */ + for (label = 0; ubbest == NULL && label < (VDEV_LABELS/2); label++) { + uint64_t sector = (label * sizeof (vdev_label_t) + + VDEV_SKIP_SIZE + VDEV_BOOT_HEADER_SIZE + + VDEV_PHYS_SIZE) >> SPA_MINBLOCKSHIFT; + + + /* Read in the uberblock ring (128K). */ + if (devread(ffi, sector, 0, VDEV_UBERBLOCK_RING, + (char *)ub_array) == 0) + continue; + + if ((ubbest = find_bestub(ffi, ub_array, label)) != NULL && + zio_read(ffi, &ubbest->ubp_uberblock.ub_rootbp, osp, stack) + == 0) { + + VERIFY_OS_TYPE(osp, DMU_OST_META); + + /* Got the MOS. Save it at the memory addr MOS. */ + grub_memmove(MOS, &osp->os_meta_dnode, DNODE_SIZE); + + if (check_pool_label(ffi, label, stack)) + return (0); + + /* + * Copy fsi->f_data to ffi->ff_data since + * fsig_mount copies from ff_data to f_data + * overwriting fsi->f_data. + */ + bcopy(zfs_ba, fsig_file_buf(ffi), FSYS_BUFLEN); + + is_zfs_mount = 1; + return (1); + } + } + + return (0); +} + +/* + * zfs_open() locates a file in the rootpool by following the + * MOS and places the dnode of the file in the memory address DNODE. + * + * Return: + * 1 - success + * 0 - failure + */ +int +zfs_open(fsi_file_t *ffi, char *filename) +{ + char *stack; + dnode_phys_t *mdn; + char *bootstring; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + file_buf = NULL; + stackbase = ZFS_SCRATCH; + stack = stackbase; + + mdn = (dnode_phys_t *)stack; + stack += sizeof (dnode_phys_t); + + dnode_mdn = NULL; + dnode_buf = (dnode_phys_t *)stack; + stack += 1<ff_fsi, + alloc_size); + if (bootstring != NULL) { + strcpy(bootstring, zfs_bootstr); + strcat(bootstring, current_rootpool); + strcat(bootstring, "/"); + strcat(bootstring, temp); + strcat(bootstring, zfs_bootpath); + strcat(bootstring, current_bootpath); + strcat(bootstring, "'"); + is_zfs_open = 1; + } + } + } + + if (dnode_get_path(ffi, mdn, filename, DNODE, stack)) { + errnum = ERR_FILE_NOT_FOUND; + return (0); + } + + /* get the file size and set the file position to 0 */ + filemax = ((znode_phys_t *)DN_BONUS(DNODE))->zp_size; + filepos = 0; + + dnode_buf = NULL; + return (1); +} + +/* + * zfs_read reads in the data blocks pointed by the DNODE. + * + * Return: + * len - the length successfully read in to the buffer + * 0 - failure + */ +int +zfs_read(fsi_file_t *ffi, char *buf, int len) +{ + char *stack; + int blksz, length, movesize; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + if (file_buf == NULL) { + file_buf = stackbase; + stackbase += SPA_MAXBLOCKSIZE; + file_start = file_end = 0; + } + stack = stackbase; + + /* + * If offset is in memory, move it into the buffer provided and return. + */ + if (filepos >= file_start && filepos+len <= file_end) { + grub_memmove(buf, file_buf + filepos - file_start, len); + filepos += len; + return (len); + } + + blksz = DNODE->dn_datablkszsec << SPA_MINBLOCKSHIFT; + + /* + * Entire Dnode is too big to fit into the space available. We + * will need to read it in chunks. This could be optimized to + * read in as large a chunk as there is space available, but for + * now, this only reads in one data block at a time. + */ + length = len; + while (length) { + /* + * Find requested blkid and the offset within that block. + */ + uint64_t blkid = filepos / blksz; + + if ((errnum = dmu_read(ffi, DNODE, blkid, file_buf, stack))) + return (0); + + file_start = blkid * blksz; + file_end = file_start + blksz; + + movesize = MIN(length, file_end - filepos); + + grub_memmove(buf, file_buf + filepos - file_start, + movesize); + buf += movesize; + length -= movesize; + filepos += movesize; + } + + return (len); +} + +/* + * No-Op + */ +int +zfs_embed(int *start_sector, int needed_sectors) +{ + return (1); +} + +fsi_plugin_ops_t * +fsi_init_plugin(int version, fsi_plugin_t *fp, const char **name) +{ + static fsig_plugin_ops_t ops = { + FSIMAGE_PLUGIN_VERSION, + .fpo_mount = zfs_mount, + .fpo_dir = zfs_open, + .fpo_read = zfs_read + }; + + *name = "zfs"; + return (fsig_init(fp, &ops)); +} diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/fsys_zfs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/fsys_zfs.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,203 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#ifndef _FSYS_ZFS_H +#define _FSYS_ZFS_H + +#include +#include + +#include "zfs-include/zfs.h" +#include "zfs-include/dmu.h" +#include "zfs-include/spa.h" +#include "zfs-include/zio.h" +#include "zfs-include/zio_checksum.h" +#include "zfs-include/vdev_impl.h" +#include "zfs-include/zap_impl.h" +#include "zfs-include/zap_leaf.h" +#include "zfs-include/uberblock_impl.h" +#include "zfs-include/dnode.h" +#include "zfs-include/dsl_dir.h" +#include "zfs-include/zfs_acl.h" +#include "zfs-include/zfs_znode.h" +#include "zfs-include/dsl_dataset.h" +#include "zfs-include/zil.h" +#include "zfs-include/dmu_objset.h" + +/* + * Global Memory addresses to store MOS and DNODE data + */ +#define MOS ((dnode_phys_t *)(((zfs_bootarea_t *) \ + (ffi->ff_fsi->f_data))->zfs_data)) +#define DNODE (MOS+1) /* move sizeof(dnode_phys_t) bytes */ +#define ZFS_SCRATCH ((char *)(DNODE+1)) + +#define MAXNAMELEN 256 + +typedef struct zfs_bootarea { + char zfs_current_bootpath[MAXNAMELEN]; + char zfs_current_rootpool[MAXNAMELEN]; + char zfs_current_bootfs[MAXNAMELEN]; + uint64_t zfs_current_bootfs_obj; + int zfs_open; + + /* cache for a file block of the currently zfs_open()-ed file */ + void *zfs_file_buf; + uint64_t zfs_file_start; + uint64_t zfs_file_end; + + /* cache for a dnode block */ + dnode_phys_t *zfs_dnode_buf; + dnode_phys_t *zfs_dnode_mdn; + uint64_t zfs_dnode_start; + uint64_t zfs_dnode_end; + + char *zfs_stackbase; + char zfs_data[0x400000]; +} zfs_bootarea_t; + +/* + * Verify dnode type. + * Can only be used in functions returning non-0 for failure. + */ +#define VERIFY_DN_TYPE(dnp, type) \ + if (type && (dnp)->dn_type != type) { \ + return (ERR_FSYS_CORRUPT); \ + } + +/* + * Verify object set type. + * Can only be used in functions returning 0 for failure. + */ +#define VERIFY_OS_TYPE(osp, type) \ + if (type && (osp)->os_type != type) { \ + errnum = ERR_FSYS_CORRUPT; \ + return (0); \ + } + +#define ZPOOL_PROP_BOOTFS "bootfs" + +/* General macros */ +#define BSWAP_8(x) ((x) & 0xff) +#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) +#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) +#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) +#define P2ROUNDUP(x, align) (-(-(x) & -(align))) + +/* + * XXX Match these macro up with real zfs once we have nvlist support so that we + * can support large sector disks. + */ +#define UBERBLOCK_SIZE (1ULL << UBERBLOCK_SHIFT) +#undef offsetof +#define offsetof(t, m) (size_t)(&(((t *)0)->m)) +#define VDEV_UBERBLOCK_SHIFT UBERBLOCK_SHIFT +#define VDEV_UBERBLOCK_OFFSET(n) \ +offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT]) + +typedef struct uberblock uberblock_t; + +/* XXX Uberblock_phys_t is no longer in the kernel zfs */ +typedef struct uberblock_phys { + uberblock_t ubp_uberblock; + char ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) - + sizeof (zio_block_tail_t)]; + zio_block_tail_t ubp_zbt; +} uberblock_phys_t; + +/* + * Macros to get fields in a bp or DVA. + */ +#define P2PHASE(x, align) ((x) & ((align) - 1)) +#define DVA_OFFSET_TO_PHYS_SECTOR(offset) \ + ((offset + VDEV_LABEL_START_SIZE) >> SPA_MINBLOCKSHIFT) + +/* + * For nvlist manipulation. (from nvpair.h) + */ +#define NV_ENCODE_NATIVE 0 +#define NV_ENCODE_XDR 1 +#define HOST_ENDIAN 1 /* for x86 machine */ +#define DATA_TYPE_UINT64 8 +#define DATA_TYPE_STRING 9 +#define DATA_TYPE_NVLIST 19 +#define DATA_TYPE_NVLIST_ARRAY 20 + +/* + * Decompression Entry - lzjb + */ +#ifndef NBBY +#define NBBY 8 +#endif + +typedef int zfs_decomp_func_t(void *s_start, void *d_start, size_t s_len, + size_t d_len); +typedef struct decomp_entry { + char *name; + zfs_decomp_func_t *decomp_func; +} decomp_entry_t; + +/* + * FAT ZAP data structures + */ +#define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ +#define ZAP_HASH_IDX(hash, n) (((n) == 0) ? 0 : ((hash) >> (64 - (n)))) +#define CHAIN_END 0xffff /* end of the chunk chain */ + +/* + * The amount of space within the chunk available for the array is: + * chunk size - space for type (1) - space for next pointer (2) + */ +#define ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3) + +#define ZAP_LEAF_HASH_SHIFT(bs) (bs - 5) +#define ZAP_LEAF_HASH_NUMENTRIES(bs) (1 << ZAP_LEAF_HASH_SHIFT(bs)) +#define LEAF_HASH(bs, h) \ + ((ZAP_LEAF_HASH_NUMENTRIES(bs)-1) & \ + ((h) >> (64 - ZAP_LEAF_HASH_SHIFT(bs)-l->l_hdr.lh_prefix_len))) + +/* + * The amount of space available for chunks is: + * block size shift - hash entry size (2) * number of hash + * entries - header space (2*chunksize) + */ +#define ZAP_LEAF_NUMCHUNKS(bs) \ + (((1<l_hash + ZAP_LEAF_HASH_NUMENTRIES(bs)))[idx] +#define ZAP_LEAF_ENTRY(l, bs, idx) (&ZAP_LEAF_CHUNK(l, bs, idx).l_entry) + +extern void fletcher_2_native(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_2_byteswap(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_4_native(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_4_byteswap(const void *, uint64_t, zio_cksum_t *); +extern void zio_checksum_SHA256(const void *, uint64_t, zio_cksum_t *); +extern int lzjb_decompress(void *, void *, size_t, size_t); + +#endif /* !_FSYS_ZFS_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/mb_info.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/mb_info.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,217 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2003 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * The structure type "mod_list" is used by the "multiboot_info" structure. + */ + +struct mod_list +{ + /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ + unsigned long mod_start; + unsigned long mod_end; + + /* Module command line */ + unsigned long cmdline; + + /* padding to take it to 16 bytes (must be zero) */ + unsigned long pad; +}; + + +/* + * INT-15, AX=E820 style "AddressRangeDescriptor" + * ...with a "size" parameter on the front which is the structure size - 4, + * pointing to the next one, up until the full buffer length of the memory + * map has been reached. + */ + +struct AddrRangeDesc +{ + unsigned long size; + unsigned long long BaseAddr; + unsigned long long Length; + unsigned long Type; + + /* unspecified optional padding... */ +} __attribute__ ((packed)); + +/* usable memory "Type", all others are reserved. */ +#define MB_ARD_MEMORY 1 + + +/* Drive Info structure. */ +struct drive_info +{ + /* The size of this structure. */ + unsigned long size; + + /* The BIOS drive number. */ + unsigned char drive_number; + + /* The access mode (see below). */ + unsigned char drive_mode; + + /* The BIOS geometry. */ + unsigned short drive_cylinders; + unsigned char drive_heads; + unsigned char drive_sectors; + + /* The array of I/O ports used for the drive. */ + unsigned short drive_ports[0]; +}; + +/* Drive Mode. */ +#define MB_DI_CHS_MODE 0 +#define MB_DI_LBA_MODE 1 + + +/* APM BIOS info. */ +struct apm_info +{ + unsigned short version; + unsigned short cseg; + unsigned long offset; + unsigned short cseg_16; + unsigned short dseg_16; + unsigned short cseg_len; + unsigned short cseg_16_len; + unsigned short dseg_16_len; +}; + + +/* + * MultiBoot Info description + * + * This is the struct passed to the boot image. This is done by placing + * its address in the EAX register. + */ + +struct multiboot_info +{ + /* MultiBoot info version number */ + unsigned long flags; + + /* Available memory from BIOS */ + unsigned long mem_lower; + unsigned long mem_upper; + + /* "root" partition */ + unsigned long boot_device; + + /* Kernel command line */ + unsigned long cmdline; + + /* Boot-Module list */ + unsigned long mods_count; + unsigned long mods_addr; + + union + { + struct + { + /* (a.out) Kernel symbol table info */ + unsigned long tabsize; + unsigned long strsize; + unsigned long addr; + unsigned long pad; + } + a; + + struct + { + /* (ELF) Kernel section header table */ + unsigned long num; + unsigned long size; + unsigned long addr; + unsigned long shndx; + } + e; + } + syms; + + /* Memory Mapping buffer */ + unsigned long mmap_length; + unsigned long mmap_addr; + + /* Drive Info buffer */ + unsigned long drives_length; + unsigned long drives_addr; + + /* ROM configuration table */ + unsigned long config_table; + + /* Boot Loader Name */ + unsigned long boot_loader_name; + + /* APM table */ + unsigned long apm_table; + + /* Video */ + unsigned long vbe_control_info; + unsigned long vbe_mode_info; + unsigned short vbe_mode; + unsigned short vbe_interface_seg; + unsigned short vbe_interface_off; + unsigned short vbe_interface_len; +}; + +/* + * Flags to be set in the 'flags' parameter above + */ + +/* is there basic lower/upper memory information? */ +#define MB_INFO_MEMORY 0x00000001 +/* is there a boot device set? */ +#define MB_INFO_BOOTDEV 0x00000002 +/* is the command-line defined? */ +#define MB_INFO_CMDLINE 0x00000004 +/* are there modules to do something with? */ +#define MB_INFO_MODS 0x00000008 + +/* These next two are mutually exclusive */ + +/* is there a symbol table loaded? */ +#define MB_INFO_AOUT_SYMS 0x00000010 +/* is there an ELF section header table? */ +#define MB_INFO_ELF_SHDR 0x00000020 + +/* is there a full memory map? */ +#define MB_INFO_MEM_MAP 0x00000040 + +/* Is there drive info? */ +#define MB_INFO_DRIVE_INFO 0x00000080 + +/* Is there a config table? */ +#define MB_INFO_CONFIG_TABLE 0x00000100 + +/* Is there a boot loader name? */ +#define MB_INFO_BOOT_LOADER_NAME 0x00000200 + +/* Is there a APM table? */ +#define MB_INFO_APM_TABLE 0x00000400 + +/* Is there video information? */ +#define MB_INFO_VIDEO_INFO 0x00000800 + +/* + * The following value must be present in the EAX register. + */ + +#define MULTIBOOT_VALID 0x2BADB002 diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/dmu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dmu.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,105 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DMU_H +#define _SYS_DMU_H + +/* + * This file describes the interface that the DMU provides for its + * consumers. + * + * The DMU also interacts with the SPA. That interface is described in + * dmu_spa.h. + */ +typedef enum dmu_object_type { + DMU_OT_NONE, + /* general: */ + DMU_OT_OBJECT_DIRECTORY, /* ZAP */ + DMU_OT_OBJECT_ARRAY, /* UINT64 */ + DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */ + DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */ + DMU_OT_BPLIST, /* UINT64 */ + DMU_OT_BPLIST_HDR, /* UINT64 */ + /* spa: */ + DMU_OT_SPACE_MAP_HEADER, /* UINT64 */ + DMU_OT_SPACE_MAP, /* UINT64 */ + /* zil: */ + DMU_OT_INTENT_LOG, /* UINT64 */ + /* dmu: */ + DMU_OT_DNODE, /* DNODE */ + DMU_OT_OBJSET, /* OBJSET */ + /* dsl: */ + DMU_OT_DSL_DIR, /* UINT64 */ + DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */ + DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */ + DMU_OT_DSL_PROPS, /* ZAP */ + DMU_OT_DSL_DATASET, /* UINT64 */ + /* zpl: */ + DMU_OT_ZNODE, /* ZNODE */ + DMU_OT_ACL, /* ACL */ + DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */ + DMU_OT_DIRECTORY_CONTENTS, /* ZAP */ + DMU_OT_MASTER_NODE, /* ZAP */ + DMU_OT_UNLINKED_SET, /* ZAP */ + /* zvol: */ + DMU_OT_ZVOL, /* UINT8 */ + DMU_OT_ZVOL_PROP, /* ZAP */ + /* other; for testing only! */ + DMU_OT_PLAIN_OTHER, /* UINT8 */ + DMU_OT_UINT64_OTHER, /* UINT64 */ + DMU_OT_ZAP_OTHER, /* ZAP */ + /* new object types: */ + DMU_OT_ERROR_LOG, /* ZAP */ + DMU_OT_SPA_HISTORY, /* UINT8 */ + DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */ + DMU_OT_POOL_PROPS, /* ZAP */ + + DMU_OT_NUMTYPES +} dmu_object_type_t; + +typedef enum dmu_objset_type { + DMU_OST_NONE, + DMU_OST_META, + DMU_OST_ZFS, + DMU_OST_ZVOL, + DMU_OST_OTHER, /* For testing only! */ + DMU_OST_ANY, /* Be careful! */ + DMU_OST_NUMTYPES +} dmu_objset_type_t; + +/* + * The names of zap entries in the DIRECTORY_OBJECT of the MOS. + */ +#define DMU_POOL_DIRECTORY_OBJECT 1 +#define DMU_POOL_CONFIG "config" +#define DMU_POOL_ROOT_DATASET "root_dataset" +#define DMU_POOL_SYNC_BPLIST "sync_bplist" +#define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" +#define DMU_POOL_ERRLOG_LAST "errlog_last" +#define DMU_POOL_SPARES "spares" +#define DMU_POOL_DEFLATE "deflate" +#define DMU_POOL_HISTORY "history" +#define DMU_POOL_PROPS "pool_props" +#define DMU_POOL_L2CACHE "l2cache" + +#endif /* _SYS_DMU_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/dmu_objset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dmu_objset.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,35 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DMU_OBJSET_H +#define _SYS_DMU_OBJSET_H + +typedef struct objset_phys { + dnode_phys_t os_meta_dnode; + zil_header_t os_zil_header; + uint64_t os_type; + char os_pad[1024 - sizeof (dnode_phys_t) - sizeof (zil_header_t) - + sizeof (uint64_t)]; +} objset_phys_t; + +#endif /* _SYS_DMU_OBJSET_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/dnode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dnode.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,76 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DNODE_H +#define _SYS_DNODE_H + +/* + * Fixed constants. + */ +#define DNODE_SHIFT 9 /* 512 bytes */ +#define DN_MIN_INDBLKSHIFT 10 /* 1k */ +#define DN_MAX_INDBLKSHIFT 14 /* 16k */ +#define DNODE_BLOCK_SHIFT 14 /* 16k */ +#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ +#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */ +#define DN_MAX_OFFSET_SHIFT 64 /* 2^64 bytes in a dnode */ + +/* + * Derived constants. + */ +#define DNODE_SIZE (1 << DNODE_SHIFT) +#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT) +#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT)) +#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT) + +#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT) +#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT) +#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT) + +#define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \ + (((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t)))) + +typedef struct dnode_phys { + uint8_t dn_type; /* dmu_object_type_t */ + uint8_t dn_indblkshift; /* ln2(indirect block size) */ + uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */ + uint8_t dn_nblkptr; /* length of dn_blkptr */ + uint8_t dn_bonustype; /* type of data in bonus buffer */ + uint8_t dn_checksum; /* ZIO_CHECKSUM type */ + uint8_t dn_compress; /* ZIO_COMPRESS type */ + uint8_t dn_flags; /* DNODE_FLAG_* */ + uint16_t dn_datablkszsec; /* data block size in 512b sectors */ + uint16_t dn_bonuslen; /* length of dn_bonus */ + uint8_t dn_pad2[4]; + + /* accounting is protected by dn_dirty_mtx */ + uint64_t dn_maxblkid; /* largest allocated block ID */ + uint64_t dn_used; /* bytes (or sectors) of disk space */ + + uint64_t dn_pad3[4]; + + blkptr_t dn_blkptr[1]; + uint8_t dn_bonus[DN_MAX_BONUSLEN]; +} dnode_phys_t; + +#endif /* _SYS_DNODE_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/dsl_dataset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dsl_dataset.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,53 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DSL_DATASET_H +#define _SYS_DSL_DATASET_H + +typedef struct dsl_dataset_phys { + uint64_t ds_dir_obj; + uint64_t ds_prev_snap_obj; + uint64_t ds_prev_snap_txg; + uint64_t ds_next_snap_obj; + uint64_t ds_snapnames_zapobj; /* zap obj of snaps; ==0 for snaps */ + uint64_t ds_num_children; /* clone/snap children; ==0 for head */ + uint64_t ds_creation_time; /* seconds since 1970 */ + uint64_t ds_creation_txg; + uint64_t ds_deadlist_obj; + uint64_t ds_used_bytes; + uint64_t ds_compressed_bytes; + uint64_t ds_uncompressed_bytes; + uint64_t ds_unique_bytes; /* only relevant to snapshots */ + /* + * The ds_fsid_guid is a 56-bit ID that can change to avoid + * collisions. The ds_guid is a 64-bit ID that will never + * change, so there is a small probability that it will collide. + */ + uint64_t ds_fsid_guid; + uint64_t ds_guid; + uint64_t ds_flags; + blkptr_t ds_bp; + uint64_t ds_pad[8]; /* pad out to 320 bytes for good measure */ +} dsl_dataset_phys_t; + +#endif /* _SYS_DSL_DATASET_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/dsl_dir.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dsl_dir.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,49 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DSL_DIR_H +#define _SYS_DSL_DIR_H + +typedef struct dsl_dir_phys { + uint64_t dd_creation_time; /* not actually used */ + uint64_t dd_head_dataset_obj; + uint64_t dd_parent_obj; + uint64_t dd_clone_parent_obj; + uint64_t dd_child_dir_zapobj; + /* + * how much space our children are accounting for; for leaf + * datasets, == physical space used by fs + snaps + */ + uint64_t dd_used_bytes; + uint64_t dd_compressed_bytes; + uint64_t dd_uncompressed_bytes; + /* Administrative quota setting */ + uint64_t dd_quota; + /* Administrative reservation setting */ + uint64_t dd_reserved; + uint64_t dd_props_zapobj; + uint64_t dd_deleg_zapobj; /* dataset permissions */ + uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */ +} dsl_dir_phys_t; + +#endif /* _SYS_DSL_DIR_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/spa.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/spa.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,283 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_SPA_H +#define _SYS_SPA_H + +/* + * General-purpose 32-bit and 64-bit bitfield encodings. + */ +#define BF32_DECODE(x, low, len) P2PHASE((x) >> (low), 1U << (len)) +#define BF64_DECODE(x, low, len) P2PHASE((x) >> (low), 1ULL << (len)) +#define BF32_ENCODE(x, low, len) (P2PHASE((x), 1U << (len)) << (low)) +#define BF64_ENCODE(x, low, len) (P2PHASE((x), 1ULL << (len)) << (low)) + +#define BF32_GET(x, low, len) BF32_DECODE(x, low, len) +#define BF64_GET(x, low, len) BF64_DECODE(x, low, len) + +#define BF32_SET(x, low, len, val) \ + ((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len)) +#define BF64_SET(x, low, len, val) \ + ((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len)) + +#define BF32_GET_SB(x, low, len, shift, bias) \ + ((BF32_GET(x, low, len) + (bias)) << (shift)) +#define BF64_GET_SB(x, low, len, shift, bias) \ + ((BF64_GET(x, low, len) + (bias)) << (shift)) + +#define BF32_SET_SB(x, low, len, shift, bias, val) \ + BF32_SET(x, low, len, ((val) >> (shift)) - (bias)) +#define BF64_SET_SB(x, low, len, shift, bias, val) \ + BF64_SET(x, low, len, ((val) >> (shift)) - (bias)) + +/* + * We currently support nine block sizes, from 512 bytes to 128K. + * We could go higher, but the benefits are near-zero and the cost + * of COWing a giant block to modify one byte would become excessive. + */ +#define SPA_MINBLOCKSHIFT 9 +#define SPA_MAXBLOCKSHIFT 17 +#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT) +#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT) + +#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1) + +/* + * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB. + * The ASIZE encoding should be at least 64 times larger (6 more bits) + * to support up to 4-way RAID-Z mirror mode with worst-case gang block + * overhead, three DVAs per bp, plus one more bit in case we do anything + * else that expands the ASIZE. + */ +#define SPA_LSIZEBITS 16 /* LSIZE up to 32M (2^16 * 512) */ +#define SPA_PSIZEBITS 16 /* PSIZE up to 32M (2^16 * 512) */ +#define SPA_ASIZEBITS 24 /* ASIZE up to 64 times larger */ + +/* + * All SPA data is represented by 128-bit data virtual addresses (DVAs). + * The members of the dva_t should be considered opaque outside the SPA. + */ +typedef struct dva { + uint64_t dva_word[2]; +} dva_t; + +/* + * Each block has a 256-bit checksum -- strong enough for cryptographic hashes. + */ +typedef struct zio_cksum { + uint64_t zc_word[4]; +} zio_cksum_t; + +/* + * Each block is described by its DVAs, time of birth, checksum, etc. + * The word-by-word, bit-by-bit layout of the blkptr is as follows: + * + * 64 56 48 40 32 24 16 8 0 + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 0 | vdev1 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 1 |G| offset1 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 2 | vdev2 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 3 |G| offset2 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 4 | vdev3 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 5 |G| offset3 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 6 |E| lvl | type | cksum | comp | PSIZE | LSIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 7 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 8 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 9 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * a | birth txg | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * b | fill count | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * c | checksum[0] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * d | checksum[1] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * e | checksum[2] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * f | checksum[3] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * Legend: + * + * vdev virtual device ID + * offset offset into virtual device + * LSIZE logical size + * PSIZE physical size (after compression) + * ASIZE allocated size (including RAID-Z parity and gang block headers) + * GRID RAID-Z layout information (reserved for future use) + * cksum checksum function + * comp compression function + * G gang block indicator + * E endianness + * type DMU object type + * lvl level of indirection + * birth txg transaction group in which the block was born + * fill count number of non-zero blocks under this bp + * checksum[4] 256-bit checksum of the data this bp describes + */ +typedef struct blkptr { + dva_t blk_dva[3]; /* 128-bit Data Virtual Address */ + uint64_t blk_prop; /* size, compression, type, etc */ + uint64_t blk_pad[3]; /* Extra space for the future */ + uint64_t blk_birth; /* transaction group at birth */ + uint64_t blk_fill; /* fill count */ + zio_cksum_t blk_cksum; /* 256-bit checksum */ +} blkptr_t; + +#define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */ +#define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */ + +/* + * Macros to get and set fields in a bp or DVA. + */ +#define DVA_GET_ASIZE(dva) \ + BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0) +#define DVA_SET_ASIZE(dva, x) \ + BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x) + +#define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8) +#define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x) + +#define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, 32) +#define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, 32, x) + +#define DVA_GET_OFFSET(dva) \ + BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0) +#define DVA_SET_OFFSET(dva, x) \ + BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x) + +#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1) +#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x) + +#define BP_GET_LSIZE(bp) \ + (BP_IS_HOLE(bp) ? 0 : \ + BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)) +#define BP_SET_LSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) + +#define BP_GET_PSIZE(bp) \ + BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1) +#define BP_SET_PSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x) + +#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) +#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) + +#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) +#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) + +#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) +#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) + +#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) +#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) + +#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1)) +#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) + +#define BP_GET_ASIZE(bp) \ + (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + DVA_GET_ASIZE(&(bp)->blk_dva[2])) + +#define BP_GET_UCSIZE(bp) \ + ((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) ? \ + BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp)); + +#define BP_GET_NDVAS(bp) \ + (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[2])) + +#define BP_COUNT_GANG(bp) \ + (DVA_GET_GANG(&(bp)->blk_dva[0]) + \ + DVA_GET_GANG(&(bp)->blk_dva[1]) + \ + DVA_GET_GANG(&(bp)->blk_dva[2])) + +#define DVA_EQUAL(dva1, dva2) \ + ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \ + (dva1)->dva_word[0] == (dva2)->dva_word[0]) + +#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \ + (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \ + ((zc1).zc_word[1] - (zc2).zc_word[1]) | \ + ((zc1).zc_word[2] - (zc2).zc_word[2]) | \ + ((zc1).zc_word[3] - (zc2).zc_word[3]))) + + +#define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0) + +#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \ +{ \ + (zcp)->zc_word[0] = w0; \ + (zcp)->zc_word[1] = w1; \ + (zcp)->zc_word[2] = w2; \ + (zcp)->zc_word[3] = w3; \ +} + +#define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) +#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) +#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) +#define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg)) + +#define BP_ZERO(bp) \ +{ \ + (bp)->blk_dva[0].dva_word[0] = 0; \ + (bp)->blk_dva[0].dva_word[1] = 0; \ + (bp)->blk_dva[1].dva_word[0] = 0; \ + (bp)->blk_dva[1].dva_word[1] = 0; \ + (bp)->blk_dva[2].dva_word[0] = 0; \ + (bp)->blk_dva[2].dva_word[1] = 0; \ + (bp)->blk_prop = 0; \ + (bp)->blk_pad[0] = 0; \ + (bp)->blk_pad[1] = 0; \ + (bp)->blk_pad[2] = 0; \ + (bp)->blk_birth = 0; \ + (bp)->blk_fill = 0; \ + ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ +} + +/* + * Note: the byteorder is either 0 or -1, both of which are palindromes. + * This simplifies the endianness handling a bit. + */ +#ifdef _BIG_ENDIAN +#define ZFS_HOST_BYTEORDER (0ULL) +#else +#define ZFS_HOST_BYTEORDER (-1ULL) +#endif + +#define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) + +#define BP_SPRINTF_LEN 320 + +#endif /* _SYS_SPA_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/uberblock_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/uberblock_impl.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,49 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_UBERBLOCK_IMPL_H +#define _SYS_UBERBLOCK_IMPL_H + +/* + * The uberblock version is incremented whenever an incompatible on-disk + * format change is made to the SPA, DMU, or ZAP. + * + * Note: the first two fields should never be moved. When a storage pool + * is opened, the uberblock must be read off the disk before the version + * can be checked. If the ub_version field is moved, we may not detect + * version mismatch. If the ub_magic field is moved, applications that + * expect the magic number in the first word won't work. + */ +#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ +#define UBERBLOCK_SHIFT 10 /* up to 1K */ + +struct uberblock { + uint64_t ub_magic; /* UBERBLOCK_MAGIC */ + uint64_t ub_version; /* ZFS_VERSION */ + uint64_t ub_txg; /* txg of last sync */ + uint64_t ub_guid_sum; /* sum of all vdev guids */ + uint64_t ub_timestamp; /* UTC time of last sync */ + blkptr_t ub_rootbp; /* MOS objset_phys_t */ +}; + +#endif /* _SYS_UBERBLOCK_IMPL_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/vdev_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/vdev_impl.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,70 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_VDEV_IMPL_H +#define _SYS_VDEV_IMPL_H + +#define VDEV_SKIP_SIZE (8 << 10) +#define VDEV_BOOT_HEADER_SIZE (8 << 10) +#define VDEV_PHYS_SIZE (112 << 10) +#define VDEV_UBERBLOCK_RING (128 << 10) + +/* ZFS boot block */ +#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL +#define VDEV_BOOT_VERSION 1 /* version number */ + +typedef struct vdev_boot_header { + uint64_t vb_magic; /* VDEV_BOOT_MAGIC */ + uint64_t vb_version; /* VDEV_BOOT_VERSION */ + uint64_t vb_offset; /* start offset (bytes) */ + uint64_t vb_size; /* size (bytes) */ + char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)]; +} vdev_boot_header_t; + +typedef struct vdev_phys { + char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)]; + zio_block_tail_t vp_zbt; +} vdev_phys_t; + +typedef struct vdev_label { + char vl_pad[VDEV_SKIP_SIZE]; /* 8K */ + vdev_boot_header_t vl_boot_header; /* 8K */ + vdev_phys_t vl_vdev_phys; /* 112K */ + char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */ +} vdev_label_t; /* 256K total */ + +/* + * Size and offset of embedded boot loader region on each label. + * The total size of the first two labels plus the boot area is 4MB. + */ +#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t)) +#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */ + +/* + * Size of label regions at the start and end of each leaf device. + */ +#define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE) +#define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t)) +#define VDEV_LABELS 4 + +#endif /* _SYS_VDEV_IMPL_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/zap_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zap_impl.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,110 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZAP_IMPL_H +#define _SYS_ZAP_IMPL_H + +#define ZAP_MAGIC 0x2F52AB2ABULL + +#define ZAP_HASHBITS 28 +#define MZAP_ENT_LEN 64 +#define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2) +#define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT +#define MZAP_MAX_BLKSZ (1 << MZAP_MAX_BLKSHIFT) + +typedef struct mzap_ent_phys { + uint64_t mze_value; + uint32_t mze_cd; + uint16_t mze_pad; /* in case we want to chain them someday */ + char mze_name[MZAP_NAME_LEN]; +} mzap_ent_phys_t; + +typedef struct mzap_phys { + uint64_t mz_block_type; /* ZBT_MICRO */ + uint64_t mz_salt; + uint64_t mz_pad[6]; + mzap_ent_phys_t mz_chunk[1]; + /* actually variable size depending on block size */ +} mzap_phys_t; + +/* + * The (fat) zap is stored in one object. It is an array of + * 1<= 6] [zap_leaf_t] [ptrtbl] ... + * + */ + +#define ZBT_LEAF ((1ULL << 63) + 0) +#define ZBT_HEADER ((1ULL << 63) + 1) +#define ZBT_MICRO ((1ULL << 63) + 3) +/* any other values are ptrtbl blocks */ + +/* + * the embedded pointer table takes up half a block: + * block size / entry size (2^3) / 2 + */ +#define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1) + +/* + * The embedded pointer table starts half-way through the block. Since + * the pointer table itself is half the block, it starts at (64-bit) + * word number (1<zap_f.zap_phys) \ + [(idx) + (1<| + * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->| + * |<---- znode (264) ---->|<---- data (56) ---->| + * + * At present, we only use this space to store symbolic links. + */ +} znode_phys_t; + +#endif /* _SYS_FS_ZFS_ZNODE_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/zil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zil.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,51 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZIL_H +#define _SYS_ZIL_H + +/* + * Intent log format: + * + * Each objset has its own intent log. The log header (zil_header_t) + * for objset N's intent log is kept in the Nth object of the SPA's + * intent_log objset. The log header points to a chain of log blocks, + * each of which contains log records (i.e., transactions) followed by + * a log block trailer (zil_trailer_t). The format of a log record + * depends on the record (or transaction) type, but all records begin + * with a common structure that defines the type, length, and txg. + */ + +/* + * Intent log header - this on disk structure holds fields to manage + * the log. All fields are 64 bit to easily handle cross architectures. + */ +typedef struct zil_header { + uint64_t zh_claim_txg; /* txg in which log blocks were claimed */ + uint64_t zh_replay_seq; /* highest replayed sequence number */ + blkptr_t zh_log; /* log chain */ + uint64_t zh_claim_seq; /* highest claimed sequence number */ + uint64_t zh_pad[5]; +} zil_header_t; + +#endif /* _SYS_ZIL_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/zio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zio.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,81 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ZIO_H +#define _ZIO_H + +#define ZBT_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */ + +typedef struct zio_block_tail { + uint64_t zbt_magic; /* for validation, endianness */ + zio_cksum_t zbt_cksum; /* 256-bit checksum */ +} zio_block_tail_t; + +/* + * Gang block headers are self-checksumming and contain an array + * of block pointers. + */ +#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE +#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \ + sizeof (zio_block_tail_t)) / sizeof (blkptr_t)) +#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \ + sizeof (zio_block_tail_t) - \ + (SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\ + sizeof (uint64_t)) + +#define ZIO_GET_IOSIZE(zio) \ + (BP_IS_GANG((zio)->io_bp) ? \ + SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp)) + +typedef struct zio_gbh { + blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS]; + uint64_t zg_filler[SPA_GBH_FILLER]; + zio_block_tail_t zg_tail; +} zio_gbh_phys_t; + +enum zio_checksum { + ZIO_CHECKSUM_INHERIT = 0, + ZIO_CHECKSUM_ON, + ZIO_CHECKSUM_OFF, + ZIO_CHECKSUM_LABEL, + ZIO_CHECKSUM_GANG_HEADER, + ZIO_CHECKSUM_ZILOG, + ZIO_CHECKSUM_FLETCHER_2, + ZIO_CHECKSUM_FLETCHER_4, + ZIO_CHECKSUM_SHA256, + ZIO_CHECKSUM_FUNCTIONS +}; + +#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2 +#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON + +enum zio_compress { + ZIO_COMPRESS_INHERIT = 0, + ZIO_COMPRESS_ON, + ZIO_COMPRESS_OFF, + ZIO_COMPRESS_LZJB, + ZIO_COMPRESS_EMPTY, + ZIO_COMPRESS_FUNCTIONS +}; + +#endif /* _ZIO_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs-include/zio_checksum.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zio_checksum.h Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,42 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZIO_CHECKSUM_H +#define _SYS_ZIO_CHECKSUM_H + +/* + * Signature for checksum functions. + */ +typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp); + +/* + * Information about each checksum function. + */ +typedef struct zio_checksum_info { + zio_checksum_t *ci_func[2]; /* checksum function for each byteorder */ + int ci_correctable; /* number of correctable bits */ + int ci_zbt; /* uses zio block tail? */ + char *ci_name; /* descriptive name */ +} zio_checksum_info_t; + +#endif /* _SYS_ZIO_CHECKSUM_H */ diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs_fletcher.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_fletcher.c Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,93 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + + +void +fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint64_t *ip = buf; + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); + uint64_t a0, b0, a1, b1; + + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 += ip[0]; + a1 += ip[1]; + b0 += a0; + b1 += a1; + } + + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); +} + +void +fletcher_2_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint64_t *ip = buf; + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); + uint64_t a0, b0, a1, b1; + + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 += BSWAP_64(ip[0]); + a1 += BSWAP_64(ip[1]); + b0 += a0; + b1 += a1; + } + + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); +} + +void +fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint32_t *ip = buf; + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); + uint64_t a, b, c, d; + + for (a = b = c = d = 0; ip < ipend; ip++) { + a += ip[0]; + b += a; + c += b; + d += c; + } + + ZIO_SET_CHECKSUM(zcp, a, b, c, d); +} + +void +fletcher_4_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint32_t *ip = buf; + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); + uint64_t a, b, c, d; + + for (a = b = c = d = 0; ip < ipend; ip++) { + a += BSWAP_32(ip[0]); + b += a; + c += b; + d += c; + } + + ZIO_SET_CHECKSUM(zcp, a, b, c, d); +} diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs_lzjb.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_lzjb.c Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,60 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + +#define MATCH_BITS 6 +#define MATCH_MIN 3 +#define OFFSET_MASK ((1 << (16 - MATCH_BITS)) - 1) + + +/*ARGSUSED*/ +int +lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len) +{ + unsigned char *src = s_start; + unsigned char *dst = d_start; + unsigned char *d_end = (unsigned char *)d_start + d_len; + unsigned char *cpy; + unsigned char copymap = '\0'; + int copymask = 1 << (NBBY - 1); + + while (dst < d_end) { + if ((copymask <<= 1) == (1 << NBBY)) { + copymask = 1; + copymap = *src++; + } + if (copymap & (unsigned char)copymask) { + int mlen = (src[0] >> (NBBY - MATCH_BITS)) + MATCH_MIN; + int offset = ((src[0] << NBBY) | src[1]) & OFFSET_MASK; + src += 2; + if ((cpy = dst - offset) < (unsigned char *)d_start) + return (-1); + while (--mlen >= 0 && dst < d_end) + *dst++ = *cpy++; + } else { + *dst++ = *src++; + } + } + return (0); +} diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/libfsimage/zfs/zfs_sha256.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_sha256.c Thu May 15 09:59:19 2008 +0100 @@ -0,0 +1,124 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + +/* + * SHA-256 checksum, as specified in FIPS 180-2, available at: + * http://csrc.nist.gov/cryptval + * + * This is a very compact implementation of SHA-256. + * It is designed to be simple and portable, not to be fast. + */ + +/* + * The literal definitions according to FIPS180-2 would be: + * + * Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) + * Maj(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) + * + * We use logical equivalents which require one less op. + */ +#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y)))) +#define Rot32(x, s) (((x) >> s) | ((x) << (32 - s))) +#define SIGMA0(x) (Rot32(x, 2) ^ Rot32(x, 13) ^ Rot32(x, 22)) +#define SIGMA1(x) (Rot32(x, 6) ^ Rot32(x, 11) ^ Rot32(x, 25)) +#define sigma0(x) (Rot32(x, 7) ^ Rot32(x, 18) ^ ((x) >> 3)) +#define sigma1(x) (Rot32(x, 17) ^ Rot32(x, 19) ^ ((x) >> 10)) + +static const uint32_t SHA256_K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static void +SHA256Transform(uint32_t *H, const uint8_t *cp) +{ + uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64]; + + for (t = 0; t < 16; t++, cp += 4) + W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | cp[3]; + + for (t = 16; t < 64; t++) + W[t] = sigma1(W[t - 2]) + W[t - 7] + + sigma0(W[t - 15]) + W[t - 16]; + + a = H[0]; b = H[1]; c = H[2]; d = H[3]; + e = H[4]; f = H[5]; g = H[6]; h = H[7]; + + for (t = 0; t < 64; t++) { + T1 = h + SIGMA1(e) + Ch(e, f, g) + SHA256_K[t] + W[t]; + T2 = SIGMA0(a) + Maj(a, b, c); + h = g; g = f; f = e; e = d + T1; + d = c; c = b; b = a; a = T1 + T2; + } + + H[0] += a; H[1] += b; H[2] += c; H[3] += d; + H[4] += e; H[5] += f; H[6] += g; H[7] += h; +} + +void +zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; + uint8_t pad[128]; + int padsize = size & 63; + int i; + + for (i = 0; i < size - padsize; i += 64) + SHA256Transform(H, (uint8_t *)buf + i); + + for (i = 0; i < padsize; i++) + pad[i] = ((uint8_t *)buf)[i]; + + for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) + pad[padsize] = 0; + + for (i = 0; i < 8; i++) + pad[padsize++] = (size << 3) >> (56 - 8 * i); + + for (i = 0; i < padsize; i += 64) + SHA256Transform(H, pad + i); + + ZIO_SET_CHECKSUM(zcp, + (uint64_t)H[0] << 32 | H[1], + (uint64_t)H[2] << 32 | H[3], + (uint64_t)H[4] << 32 | H[5], + (uint64_t)H[6] << 32 | H[7]); +} diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/pygrub/src/fsimage/fsimage.c --- a/tools/pygrub/src/fsimage/fsimage.c Thu May 15 09:55:53 2008 +0100 +++ b/tools/pygrub/src/fsimage/fsimage.c Thu May 15 09:59:19 2008 +0100 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -281,6 +281,22 @@ fsimage_open(PyObject *o, PyObject *args return (PyObject *)fs; } +static PyObject * +fsimage_getbootstring(PyObject *o, PyObject *args) +{ + PyObject *fs; + char *bootstring; + fsi_t *fsi; + + if (!PyArg_ParseTuple(args, "O", &fs)) + return (NULL); + + fsi = ((fsimage_fs_t *)fs)->fs; + bootstring = fsi_fs_bootstring(fsi); + + return Py_BuildValue("s", bootstring); +} + PyDoc_STRVAR(fsimage_open__doc__, "open(name, [offset=off]) - Open the given file as a filesystem image.\n" "\n" @@ -288,9 +304,15 @@ PyDoc_STRVAR(fsimage_open__doc__, "offset - offset of file system within file image.\n" "options - mount options string.\n"); +PyDoc_STRVAR(fsimage_getbootstring__doc__, + "getbootstring(fs) - Return the boot string needed for this file system " + "or NULL if none is needed.\n"); + static struct PyMethodDef fsimage_module_methods[] = { { "open", (PyCFunction)fsimage_open, METH_VARARGS|METH_KEYWORDS, fsimage_open__doc__ }, + { "getbootstring", (PyCFunction)fsimage_getbootstring, + METH_VARARGS, fsimage_getbootstring__doc__ }, { NULL, NULL, 0, NULL } }; diff -r ffbf5d0ff61d -r aee5dc4a4a37 tools/pygrub/src/pygrub --- a/tools/pygrub/src/pygrub Thu May 15 09:55:53 2008 +0100 +++ b/tools/pygrub/src/pygrub Thu May 15 09:59:19 2008 +0100 @@ -645,7 +645,13 @@ if __name__ == "__main__": print " args: %s" % chosencfg["args"] sys.exit(0) - fs = fsimage.open(file, get_fs_offset(file)) + # if boot filesystem is set then pass to fsimage.open + bootfsargs = '"%s"' % incfg["args"] + bootfsgroup = re.findall('zfs-bootfs=(.*?)[\s\,\"]', bootfsargs) + if bootfsgroup: + fs = fsimage.open(file, get_fs_offset(file), bootfsgroup[0]) + else: + fs = fsimage.open(file, get_fs_offset(file)) chosencfg = sniff_solaris(fs, incfg) @@ -671,7 +677,15 @@ if __name__ == "__main__": if bootcfg["ramdisk"]: sxp += "(ramdisk %s)" % bootcfg["ramdisk"] if chosencfg["args"]: - sxp += "(args \"%s\")" % chosencfg["args"] + zfsinfo = fsimage.getbootstring(fs) + if zfsinfo is None: + sxp += "(args \"%s\")" % chosencfg["args"] + else: + e = re.compile("zfs-bootfs=[\w\-\.\:@/]+" ) + (chosencfg["args"],count) = e.subn(zfsinfo, chosencfg["args"]) + if count == 0: + chosencfg["args"] += " -B %s" % zfsinfo + sxp += "(args \"%s\")" % (chosencfg["args"]) sys.stdout.flush() os.write(fd, sxp) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 10:20:08 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 10:20:08 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwh7g-0006Ix-Ch for www-data@colo.xensource.com; Thu, 15 May 2008 10:20:08 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwh8I-0005SC-O3; Thu, 15 May 2008 17:20:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwh8H-0005Rs-5n for xen-changelog@lists.xensource.com; Thu, 15 May 2008 17:20:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwh88-0004AV-F3 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 17:20:43 +0000 X-SBRS: 3.6 X-MesageID: 226156 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="226156" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 13:19:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FHJpVY018163 for ; Thu, 15 May 2008 10:19:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FHK9Vj013215 for ; Thu, 15 May 2008 10:20:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FHK9kQ013214 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 10:20:09 -0700 Message-Id: <200805151720.m4FHK9kQ013214@xenbits.xensource.com> Date: Thu, 15 May 2008 10:20:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: Do not try to guess backing file format when using qcow vbds. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210860605 -3600 # Node ID e3b13e1ecf6ca61b84c8bdf5ae3e961268c920f5 # Parent 8d18e52a1b23c40cb81ae51df8c703175819c504 ioemu: Do not try to guess backing file format when using qcow vbds. Signed-off-by: Ian Jackson --- tools/ioemu/block.c | 32 ++++++++++++++++++++++++++------ tools/ioemu/xenstore.c | 4 +++- 2 files changed, 29 insertions(+), 7 deletions(-) diff -r 8d18e52a1b23 -r e3b13e1ecf6c tools/ioemu/block.c --- a/tools/ioemu/block.c Thu May 15 11:09:16 2008 +0100 +++ b/tools/ioemu/block.c Thu May 15 15:10:05 2008 +0100 @@ -240,8 +240,28 @@ static int is_windows_drive(const char * } #endif +static int bdrv_invalid_protocol_open(BlockDriverState *bs, + const char *filename, int flags) { + return -ENOENT; +} + +static BlockDriver bdrv_invalid_protocol = { + "invalid_protocol", + .bdrv_open = bdrv_invalid_protocol_open, +}; + static BlockDriver *find_protocol(const char *filename) { + /* Return values: + * &bdrv_xxx + * filename specifies protocol xxx + * caller should use that + * NULL filename does not specify any protocol + * caller may apply their own default + * &bdrv_invalid_protocol filename speciies an unknown protocol + * caller should return -ENOENT; or may just try to open with + * that bdrv, which always fails that way. + */ BlockDriver *drv1; char protocol[128]; int len; @@ -254,7 +274,7 @@ static BlockDriver *find_protocol(const #endif p = strchr(filename, ':'); if (!p) - return NULL; /* do not ever guess raw, it is a security problem! */ + return NULL; len = p - filename; if (len > sizeof(protocol) - 1) len = sizeof(protocol) - 1; @@ -265,7 +285,7 @@ static BlockDriver *find_protocol(const !strcmp(drv1->protocol_name, protocol)) return drv1; } - return NULL; + return &bdrv_invalid_protocol; } /* XXX: force raw format if block or character device ? It would @@ -295,8 +315,8 @@ static BlockDriver *find_image_format(co #endif drv = find_protocol(filename); - /* no need to test disk image formats for vvfat */ - if (drv == &bdrv_vvfat) + /* no need to test disk image format if the filename told us */ + if (drv != NULL) return drv; ret = bdrv_file_open(&bs, filename, BDRV_O_RDONLY); @@ -390,7 +410,7 @@ int bdrv_open2(BlockDriverState *bs, con if (flags & BDRV_O_FILE) { drv = find_protocol(filename); if (!drv) - return -ENOENT; + drv = &bdrv_raw; } else { if (!drv) { drv = find_image_format(filename); @@ -438,7 +458,7 @@ int bdrv_open2(BlockDriverState *bs, con } path_combine(backing_filename, sizeof(backing_filename), filename, bs->backing_file); - if (bdrv_open(bs->backing_hd, backing_filename, 0) < 0) + if (bdrv_open2(bs->backing_hd, backing_filename, 0, &bdrv_raw) < 0) goto fail; } diff -r 8d18e52a1b23 -r e3b13e1ecf6c tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Thu May 15 11:09:16 2008 +0100 +++ b/tools/ioemu/xenstore.c Thu May 15 15:10:05 2008 +0100 @@ -260,6 +260,8 @@ void xenstore_parse_domain_config(int hv /* autoguess qcow vs qcow2 */ } else if (!strcmp(drv,"file") || !strcmp(drv,"phy")) { format = &bdrv_raw; + } else if (!strcmp(drv,"phy")) { + format = &bdrv_raw; } else { format = bdrv_find_format(drv); if (!format) { @@ -269,7 +271,7 @@ void xenstore_parse_domain_config(int hv } } if (bdrv_open2(bs, params, 0 /* snapshot */, format) < 0) - fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s')\n", buf, params, drv ? drv : "?"); + fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s' format '%s')\n", buf, params, drv ? drv : "?", format ? format->format_name : "0"); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 10:20:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 10:20:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwh7k-0006J1-BY for www-data@colo.xensource.com; Thu, 15 May 2008 10:20:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwh8M-0005W4-MD; Thu, 15 May 2008 17:20:50 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwh8K-0005Rx-6O for xen-changelog@lists.xensource.com; Thu, 15 May 2008 17:20:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwh89-0004AW-LL for xen-changelog@lists.xensource.com; Thu, 15 May 2008 17:20:46 +0000 X-SBRS: 3.6 X-MesageID: 226155 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="226155" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 13:19:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FHJo31018160 for ; Thu, 15 May 2008 10:19:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FHK8FJ013198 for ; Thu, 15 May 2008 10:20:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FHK8xi013197 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 10:20:08 -0700 Message-Id: <200805151720.m4FHK8xi013197@xenbits.xensource.com> Date: Thu, 15 May 2008 10:20:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86, hvm: Support 2MB superpage allocations for HVM guests. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210846156 -3600 # Node ID 8d18e52a1b23c40cb81ae51df8c703175819c504 # Parent 29dc52031954896a407a97cba167c197f8e1c0ed x86, hvm: Support 2MB superpage allocations for HVM guests. Signed-off-by: Xin Xiaohui Signed-off-by: Li Xin, B Signed-off-by: Wei Huang Signed-off-by: Keir Fraser --- tools/libxc/xc_hvm_build.c | 50 ++++++- xen/arch/ia64/xen/mm.c | 41 +++--- xen/arch/x86/mm.c | 6 xen/arch/x86/mm/hap/p2m-ept.c | 208 +++++++++++++++++++++++------- xen/arch/x86/mm/p2m.c | 251 +++++++++++++++++++++++++++++-------- xen/common/grant_table.c | 2 xen/common/memory.c | 12 - xen/include/asm-ia64/grant_table.h | 2 xen/include/asm-ia64/shadow.h | 6 xen/include/asm-x86/p2m.h | 15 +- xen/include/xen/paging.h | 4 11 files changed, 451 insertions(+), 146 deletions(-) diff -r 29dc52031954 -r 8d18e52a1b23 tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Thu May 15 09:38:00 2008 +0100 +++ b/tools/libxc/xc_hvm_build.c Thu May 15 11:09:16 2008 +0100 @@ -18,6 +18,9 @@ #include "xc_e820.h" #include + +#define SUPERPAGE_PFN_SHIFT 9 +#define SUPERPAGE_NR_PFNS (1UL << SUPERPAGE_PFN_SHIFT) #define SCRATCH_PFN 0xFFFFF @@ -211,7 +214,7 @@ static int setup_guest(int xc_handle, /* * Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. - * We allocate pages in batches of no more than 2048 to ensure that + * We allocate pages in batches of no more than 8MB to ensure that * we can be preempted and hence dom0 remains responsive. */ rc = xc_domain_memory_populate_physmap( @@ -219,13 +222,50 @@ static int setup_guest(int xc_handle, cur_pages = 0xc0; while ( (rc == 0) && (nr_pages > cur_pages) ) { + /* Clip count to maximum 8MB extent. */ unsigned long count = nr_pages - cur_pages; if ( count > 2048 ) count = 2048; - rc = xc_domain_memory_populate_physmap( - xc_handle, dom, count, 0, 0, &page_array[cur_pages]); - cur_pages += count; - } + + /* Clip partial superpage extents to superpage boundaries. */ + if ( ((cur_pages & (SUPERPAGE_NR_PFNS-1)) != 0) && + (count > (-cur_pages & (SUPERPAGE_NR_PFNS-1))) ) + count = -cur_pages & (SUPERPAGE_NR_PFNS-1); /* clip s.p. tail */ + else if ( ((count & (SUPERPAGE_NR_PFNS-1)) != 0) && + (count > SUPERPAGE_NR_PFNS) ) + count &= ~(SUPERPAGE_NR_PFNS - 1); /* clip non-s.p. tail */ + + /* Attempt to allocate superpage extents. */ + if ( ((count | cur_pages) & (SUPERPAGE_NR_PFNS - 1)) == 0 ) + { + long done; + xen_pfn_t sp_extents[2048 >> SUPERPAGE_PFN_SHIFT]; + struct xen_memory_reservation sp_req = { + .nr_extents = count >> SUPERPAGE_PFN_SHIFT, + .extent_order = SUPERPAGE_PFN_SHIFT, + .domid = dom + }; + set_xen_guest_handle(sp_req.extent_start, sp_extents); + for ( i = 0; i < sp_req.nr_extents; i++ ) + sp_extents[i] = page_array[cur_pages+(i< 0 ) + { + done <<= SUPERPAGE_PFN_SHIFT; + cur_pages += done; + count -= done; + } + } + + /* Fall back to 4kB extents. */ + if ( count != 0 ) + { + rc = xc_domain_memory_populate_physmap( + xc_handle, dom, count, 0, 0, &page_array[cur_pages]); + cur_pages += count; + } + } + if ( rc != 0 ) { PERROR("Could not allocate memory for HVM guest.\n"); diff -r 29dc52031954 -r 8d18e52a1b23 xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Thu May 15 09:38:00 2008 +0100 +++ b/xen/arch/ia64/xen/mm.c Thu May 15 11:09:16 2008 +0100 @@ -2415,16 +2415,20 @@ steal_page(struct domain *d, struct page int guest_physmap_add_page(struct domain *d, unsigned long gpfn, - unsigned long mfn) -{ - BUG_ON(!mfn_valid(mfn)); - BUG_ON(mfn_to_page(mfn)->count_info != (PGC_allocated | 1)); - set_gpfn_from_mfn(mfn, gpfn); - smp_mb(); - assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn, - ASSIGN_writable | ASSIGN_pgc_allocated); - - //BUG_ON(mfn != ((lookup_domain_mpa(d, gpfn << PAGE_SHIFT) & _PFN_MASK) >> PAGE_SHIFT)); + unsigned long mfn, unsigned int page_order) +{ + unsigned long i; + + for (i = 0; i < (1UL << page_order); i++) { + BUG_ON(!mfn_valid(mfn)); + BUG_ON(mfn_to_page(mfn)->count_info != (PGC_allocated | 1)); + set_gpfn_from_mfn(mfn, gpfn); + smp_mb(); + assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn, + ASSIGN_writable | ASSIGN_pgc_allocated); + mfn++; + gpfn++; + } perfc_incr(guest_physmap_add_page); return 0; @@ -2432,10 +2436,15 @@ guest_physmap_add_page(struct domain *d, void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, - unsigned long mfn) -{ + unsigned long mfn, unsigned int page_order) +{ + unsigned long i; + BUG_ON(mfn == 0);//XXX - zap_domain_page_one(d, gpfn << PAGE_SHIFT, 0, mfn); + + for (i = 0; i < (1UL << page_order); i++) { + zap_domain_page_one(d, (gpfn+i) << PAGE_SHIFT, 0, mfn+i); + perfc_incr(guest_physmap_remove_page); } @@ -2838,7 +2847,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE( if (prev_mfn && mfn_valid(prev_mfn)) { if (is_xen_heap_mfn(prev_mfn)) /* Xen heap frames are simply unhooked from this phys slot. */ - guest_physmap_remove_page(d, xatp.gpfn, prev_mfn); + guest_physmap_remove_page(d, xatp.gpfn, prev_mfn, 0); else /* Normal domain memory is freed, to avoid leaking memory. */ guest_remove_page(d, xatp.gpfn); @@ -2847,10 +2856,10 @@ arch_memory_op(int op, XEN_GUEST_HANDLE( /* Unmap from old location, if any. */ gpfn = get_gpfn_from_mfn(mfn); if (gpfn != INVALID_M2P_ENTRY) - guest_physmap_remove_page(d, gpfn, mfn); + guest_physmap_remove_page(d, gpfn, mfn, 0); /* Map at new location. */ - guest_physmap_add_page(d, xatp.gpfn, mfn); + guest_physmap_add_page(d, xatp.gpfn, mfn, 0); out: domain_unlock(d); diff -r 29dc52031954 -r 8d18e52a1b23 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu May 15 09:38:00 2008 +0100 +++ b/xen/arch/x86/mm.c Thu May 15 11:09:16 2008 +0100 @@ -3297,7 +3297,7 @@ long arch_memory_op(int op, XEN_GUEST_HA { if ( is_xen_heap_mfn(prev_mfn) ) /* Xen heap frames are simply unhooked from this phys slot. */ - guest_physmap_remove_page(d, xatp.gpfn, prev_mfn); + guest_physmap_remove_page(d, xatp.gpfn, prev_mfn, 0); else /* Normal domain memory is freed, to avoid leaking memory. */ guest_remove_page(d, xatp.gpfn); @@ -3306,10 +3306,10 @@ long arch_memory_op(int op, XEN_GUEST_HA /* Unmap from old location, if any. */ gpfn = get_gpfn_from_mfn(mfn); if ( gpfn != INVALID_M2P_ENTRY ) - guest_physmap_remove_page(d, gpfn, mfn); + guest_physmap_remove_page(d, gpfn, mfn, 0); /* Map at new location. */ - guest_physmap_add_page(d, xatp.gpfn, mfn); + guest_physmap_add_page(d, xatp.gpfn, mfn, 0); domain_unlock(d); diff -r 29dc52031954 -r 8d18e52a1b23 xen/arch/x86/mm/hap/p2m-ept.c --- a/xen/arch/x86/mm/hap/p2m-ept.c Thu May 15 09:38:00 2008 +0100 +++ b/xen/arch/x86/mm/hap/p2m-ept.c Thu May 15 11:09:16 2008 +0100 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,9 @@ static void ept_p2m_type_to_flags(ept_en } } +#define GUEST_TABLE_NORMAL_PAGE 1 +#define GUEST_TABLE_SUPER_PAGE 2 + static int ept_next_level(struct domain *d, bool_t read_only, ept_entry_t **table, unsigned long *gfn_remainder, u32 shift) @@ -54,7 +58,6 @@ static int ept_next_level(struct domain u32 index; index = *gfn_remainder >> shift; - *gfn_remainder &= (1UL << shift) - 1; ept_entry = (*table) + index; @@ -83,31 +86,53 @@ static int ept_next_level(struct domain ept_entry->r = ept_entry->w = ept_entry->x = 1; } - next = map_domain_page(ept_entry->mfn); - unmap_domain_page(*table); - *table = next; - - return 1; + if ( !ept_entry->sp_avail ) + { + *gfn_remainder &= (1UL << shift) - 1; + next = map_domain_page(ept_entry->mfn); + unmap_domain_page(*table); + *table = next; + return GUEST_TABLE_NORMAL_PAGE; + } + else + return GUEST_TABLE_SUPER_PAGE; } static int -ept_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt) -{ - ept_entry_t *table = - map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); - unsigned long gfn_remainder = gfn; +ept_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, + unsigned int order, p2m_type_t p2mt) +{ + ept_entry_t *table = NULL; + unsigned long gfn_remainder = gfn, offset = 0; ept_entry_t *ept_entry = NULL; u32 index; - int i, rv = 0; + int i, rv = 0, ret = 0; + int walk_level = order / EPT_TABLE_ORDER; /* Should check if gfn obeys GAW here */ - for ( i = EPT_DEFAULT_GAW; i > 0; i-- ) - if ( !ept_next_level(d, 0, &table, &gfn_remainder, - i * EPT_TABLE_ORDER) ) + if ( order != 0 ) + if ( (gfn & ((1UL << order) - 1)) ) + return 1; + + table = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); + + ASSERT(table != NULL); + + for ( i = EPT_DEFAULT_GAW; i > walk_level; i-- ) + { + ret = ept_next_level(d, 0, &table, &gfn_remainder, + i * EPT_TABLE_ORDER); + if ( !ret ) goto out; - - index = gfn_remainder; + else if ( ret == GUEST_TABLE_SUPER_PAGE ) + break; + } + + index = gfn_remainder >> ( i ? (i * EPT_TABLE_ORDER): order); + walk_level = ( i ? ( i * EPT_TABLE_ORDER) : order) / EPT_TABLE_ORDER; + offset = (gfn_remainder & ( ((1 << (i*EPT_TABLE_ORDER)) - 1))); + ept_entry = table + index; if ( mfn_valid(mfn_x(mfn)) || (p2mt == p2m_mmio_direct) ) @@ -117,9 +142,20 @@ ept_set_entry(struct domain *d, unsigned d->arch.p2m->max_mapped_pfn = gfn; ept_entry->emt = EPT_DEFAULT_MT; - ept_entry->sp_avail = 0; + ept_entry->sp_avail = walk_level ? 1 : 0; + + if ( ret == GUEST_TABLE_SUPER_PAGE ) + { + ept_entry->mfn = mfn_x(mfn) - offset; + if ( ept_entry->avail1 == p2m_ram_logdirty && + p2mt == p2m_ram_rw ) + for ( i = 0; i < 512; i++ ) + paging_mark_dirty(d, mfn_x(mfn)-offset+i); + } + else + ept_entry->mfn = mfn_x(mfn); + ept_entry->avail1 = p2mt; - ept_entry->mfn = mfn_x(mfn); ept_entry->rsvd = 0; ept_entry->avail2 = 0; /* last step */ @@ -132,14 +168,42 @@ ept_set_entry(struct domain *d, unsigned /* Success */ rv = 1; - out: +out: unmap_domain_page(table); ept_sync_domain(d); + /* Now the p2m table is not shared with vt-d page table */ + + if ( iommu_enabled && is_hvm_domain(d) ) + { + if ( p2mt == p2m_ram_rw ) + { + if ( ret == GUEST_TABLE_SUPER_PAGE ) + { + for ( i = 0; i < 512; i++ ) + iommu_map_page(d, gfn-offset+i, mfn_x(mfn)-offset+i); + } + else if ( ret ) + iommu_map_page(d, gfn, mfn_x(mfn)); + } + else + { + if ( ret == GUEST_TABLE_SUPER_PAGE ) + { + for ( i = 0; i < 512; i++ ) + iommu_unmap_page(d, gfn-offset+i); + } + else if ( ret ) + iommu_unmap_page(d, gfn); + } + } + +#ifdef P2M_SHARE_WITH_VTD_PAGE_TABLE /* If p2m table is shared with vtd page-table. */ if ( iommu_enabled && is_hvm_domain(d) && (p2mt == p2m_mmio_direct) ) iommu_flush(d, gfn, (u64*)ept_entry); +#endif return rv; } @@ -152,7 +216,7 @@ static mfn_t ept_get_entry(struct domain unsigned long gfn_remainder = gfn; ept_entry_t *ept_entry; u32 index; - int i; + int i, ret=0; mfn_t mfn = _mfn(INVALID_MFN); *t = p2m_mmio_dm; @@ -164,17 +228,31 @@ static mfn_t ept_get_entry(struct domain /* Should check if gfn obeys GAW here. */ for ( i = EPT_DEFAULT_GAW; i > 0; i-- ) - if ( !ept_next_level(d, 1, &table, &gfn_remainder, - i * EPT_TABLE_ORDER) ) + { + ret = ept_next_level(d, 1, &table, &gfn_remainder, + i * EPT_TABLE_ORDER); + if ( !ret ) goto out; - - index = gfn_remainder; + else if ( ret == GUEST_TABLE_SUPER_PAGE ) + break; + } + + index = gfn_remainder >> ( i * EPT_TABLE_ORDER); ept_entry = table + index; if ( ept_entry->avail1 != p2m_invalid ) { *t = ept_entry->avail1; mfn = _mfn(ept_entry->mfn); + if ( i ) + { + /* we may meet super pages, and to split into 4k pages + * to emulate p2m table + */ + unsigned long split_mfn = + mfn_x(mfn) + (gfn_remainder & ( ((1 << (i*EPT_TABLE_ORDER)) - 1 ))); + mfn = _mfn(split_mfn); + } } out: @@ -205,33 +283,63 @@ static void ept_change_entry_type_global l4e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); for (i4 = 0; i4 < EPT_PAGETABLE_ENTRIES; i4++ ) { - if ( !l4e[i4].epte || l4e[i4].sp_avail ) + if ( !l4e[i4].epte ) continue; - l3e = map_domain_page(l4e[i4].mfn); - for ( i3 = 0; i3 < EPT_PAGETABLE_ENTRIES; i3++ ) - { - if ( !l3e[i3].epte || l3e[i3].sp_avail ) + if ( !l4e[i4].sp_avail ) + { + l3e = map_domain_page(l4e[i4].mfn); + for ( i3 = 0; i3 < EPT_PAGETABLE_ENTRIES; i3++ ) + { + if ( !l3e[i3].epte ) + continue; + if ( !l3e[i3].sp_avail ) + { + l2e = map_domain_page(l3e[i3].mfn); + for ( i2 = 0; i2 < EPT_PAGETABLE_ENTRIES; i2++ ) + { + if ( !l2e[i2].epte ) + continue; + if ( !l2e[i2].sp_avail ) + { + l1e = map_domain_page(l2e[i2].mfn); + for ( i1 = 0; i1 < EPT_PAGETABLE_ENTRIES; i1++ ) + { + if ( !l1e[i1].epte ) + continue; + if ( l1e[i1].avail1 != ot ) + continue; + l1e[i1].avail1 = nt; + ept_p2m_type_to_flags(l1e+i1, nt); + } + unmap_domain_page(l1e); + } + else + { + if ( l2e[i2].avail1 != ot ) + continue; + l2e[i2].avail1 = nt; + ept_p2m_type_to_flags(l2e+i2, nt); + } + } + unmap_domain_page(l2e); + } + else + { + if ( l3e[i3].avail1 != ot ) + continue; + l3e[i3].avail1 = nt; + ept_p2m_type_to_flags(l3e+i3, nt); + } + } + unmap_domain_page(l3e); + } + else + { + if ( l4e[i4].avail1 != ot ) continue; - l2e = map_domain_page(l3e[i3].mfn); - for ( i2 = 0; i2 < EPT_PAGETABLE_ENTRIES; i2++ ) - { - if ( !l2e[i2].epte || l2e[i2].sp_avail ) - continue; - l1e = map_domain_page(l2e[i2].mfn); - for ( i1 = 0; i1 < EPT_PAGETABLE_ENTRIES; i1++ ) - { - if ( !l1e[i1].epte ) - continue; - if ( l1e[i1].avail1 != ot ) - continue; - l1e[i1].avail1 = nt; - ept_p2m_type_to_flags(l1e+i1, nt); - } - unmap_domain_page(l1e); - } - unmap_domain_page(l2e); - } - unmap_domain_page(l3e); + l4e[i4].avail1 = nt; + ept_p2m_type_to_flags(l4e+i4, nt); + } } unmap_domain_page(l4e); diff -r 29dc52031954 -r 8d18e52a1b23 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Thu May 15 09:38:00 2008 +0100 +++ b/xen/arch/x86/mm/p2m.c Thu May 15 11:09:16 2008 +0100 @@ -151,9 +151,11 @@ p2m_next_level(struct domain *d, mfn_t * unsigned long *gfn_remainder, unsigned long gfn, u32 shift, u32 max, unsigned long type) { + l1_pgentry_t *l1_entry; l1_pgentry_t *p2m_entry; l1_pgentry_t new_entry; void *next; + int i; ASSERT(d->arch.p2m->alloc_page); if ( !(p2m_entry = p2m_find_entry(*table, gfn_remainder, gfn, @@ -194,6 +196,44 @@ p2m_next_level(struct domain *d, mfn_t * break; } } + + ASSERT(l1e_get_flags(*p2m_entry) & _PAGE_PRESENT); + + /* split single large page into 4KB page in P2M table */ + if ( type == PGT_l1_page_table && (l1e_get_flags(*p2m_entry) & _PAGE_PSE) ) + { + unsigned long flags, pfn; + struct page_info *pg = d->arch.p2m->alloc_page(d); + if ( pg == NULL ) + return 0; + list_add_tail(&pg->list, &d->arch.p2m->pages); + pg->u.inuse.type_info = PGT_l1_page_table | 1 | PGT_validated; + pg->count_info = 1; + + /* New splintered mappings inherit the flags of the old superpage, + * with a little reorganisation for the _PAGE_PSE_PAT bit. */ + flags = l1e_get_flags(*p2m_entry); + pfn = l1e_get_pfn(*p2m_entry); + if ( pfn & 1 ) /* ==> _PAGE_PSE_PAT was set */ + pfn -= 1; /* Clear it; _PAGE_PSE becomes _PAGE_PAT */ + else + flags &= ~_PAGE_PSE; /* Clear _PAGE_PSE (== _PAGE_PAT) */ + + l1_entry = map_domain_page(mfn_x(page_to_mfn(pg))); + for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ ) + { + new_entry = l1e_from_pfn(pfn + i, flags); + paging_write_p2m_entry(d, gfn, + l1_entry+i, *table_mfn, new_entry, 1); + } + unmap_domain_page(l1_entry); + + new_entry = l1e_from_pfn(mfn_x(page_to_mfn(pg)), + __PAGE_HYPERVISOR|_PAGE_USER); + paging_write_p2m_entry(d, gfn, + p2m_entry, *table_mfn, new_entry, 2); + } + *table_mfn = _mfn(l1e_get_pfn(*p2m_entry)); next = map_domain_page(mfn_x(*table_mfn)); unmap_domain_page(*table); @@ -204,7 +244,8 @@ p2m_next_level(struct domain *d, mfn_t * // Returns 0 on error (out of memory) static int -p2m_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt) +p2m_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, + unsigned int page_order, p2m_type_t p2mt) { // XXX -- this might be able to be faster iff current->domain == d mfn_t table_mfn = pagetable_get_mfn(d->arch.phys_table); @@ -212,6 +253,7 @@ p2m_set_entry(struct domain *d, unsigned unsigned long gfn_remainder = gfn; l1_pgentry_t *p2m_entry; l1_pgentry_t entry_content; + l2_pgentry_t l2e_content; int rv=0; #if CONFIG_PAGING_LEVELS >= 4 @@ -235,26 +277,53 @@ p2m_set_entry(struct domain *d, unsigned PGT_l2_page_table) ) goto out; - if ( !p2m_next_level(d, &table_mfn, &table, &gfn_remainder, gfn, - L2_PAGETABLE_SHIFT - PAGE_SHIFT, - L2_PAGETABLE_ENTRIES, PGT_l1_page_table) ) - goto out; - - p2m_entry = p2m_find_entry(table, &gfn_remainder, gfn, - 0, L1_PAGETABLE_ENTRIES); - ASSERT(p2m_entry); + if ( page_order == 0 ) + { + if ( !p2m_next_level(d, &table_mfn, &table, &gfn_remainder, gfn, + L2_PAGETABLE_SHIFT - PAGE_SHIFT, + L2_PAGETABLE_ENTRIES, PGT_l1_page_table) ) + goto out; + + p2m_entry = p2m_find_entry(table, &gfn_remainder, gfn, + 0, L1_PAGETABLE_ENTRIES); + ASSERT(p2m_entry); + + if ( mfn_valid(mfn) || (p2mt == p2m_mmio_direct) ) + entry_content = l1e_from_pfn(mfn_x(mfn), p2m_type_to_flags(p2mt)); + else + entry_content = l1e_empty(); + + /* level 1 entry */ + paging_write_p2m_entry(d, gfn, p2m_entry, table_mfn, entry_content, 1); + } + else + { + p2m_entry = p2m_find_entry(table, &gfn_remainder, gfn, + L2_PAGETABLE_SHIFT - PAGE_SHIFT, + L2_PAGETABLE_ENTRIES); + ASSERT(p2m_entry); + + if ( (l1e_get_flags(*p2m_entry) & _PAGE_PRESENT) && + !(l1e_get_flags(*p2m_entry) & _PAGE_PSE) ) + { + P2M_ERROR("configure P2M table 4KB L2 entry with large page\n"); + domain_crash(d); + goto out; + } + + if ( mfn_valid(mfn) ) + l2e_content = l2e_from_pfn(mfn_x(mfn), + p2m_type_to_flags(p2mt) | _PAGE_PSE); + else + l2e_content = l2e_empty(); + + entry_content.l1 = l2e_content.l2; + paging_write_p2m_entry(d, gfn, p2m_entry, table_mfn, entry_content, 2); + } /* Track the highest gfn for which we have ever had a valid mapping */ if ( mfn_valid(mfn) && (gfn > d->arch.p2m->max_mapped_pfn) ) d->arch.p2m->max_mapped_pfn = gfn; - - if ( mfn_valid(mfn) || (p2mt == p2m_mmio_direct) ) - entry_content = l1e_from_pfn(mfn_x(mfn), p2m_type_to_flags(p2mt)); - else - entry_content = l1e_empty(); - - /* level 1 entry */ - paging_write_p2m_entry(d, gfn, p2m_entry, table_mfn, entry_content, 1); if ( iommu_enabled && is_hvm_domain(d) ) { @@ -335,6 +404,16 @@ p2m_gfn_to_mfn(struct domain *d, unsigne unmap_domain_page(l2e); return _mfn(INVALID_MFN); } + else if ( (l2e_get_flags(*l2e) & _PAGE_PSE) ) + { + mfn = _mfn(l2e_get_pfn(*l2e) + l1_table_offset(addr)); + *t = p2m_flags_to_type(l2e_get_flags(*l2e)); + unmap_domain_page(l2e); + + ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t)); + return (p2m_is_valid(*t)) ? mfn : _mfn(INVALID_MFN); + } + mfn = _mfn(l2e_get_pfn(*l2e)); unmap_domain_page(l2e); @@ -358,6 +437,7 @@ static mfn_t p2m_gfn_to_mfn_current(unsi { mfn_t mfn = _mfn(INVALID_MFN); p2m_type_t p2mt = p2m_mmio_dm; + paddr_t addr = ((paddr_t)gfn) << PAGE_SHIFT; /* XXX This is for compatibility with the old model, where anything not * XXX marked as RAM was considered to be emulated MMIO space. * XXX Once we start explicitly registering MMIO regions in the p2m @@ -366,25 +446,44 @@ static mfn_t p2m_gfn_to_mfn_current(unsi if ( gfn <= current->domain->arch.p2m->max_mapped_pfn ) { l1_pgentry_t l1e = l1e_empty(); + l2_pgentry_t l2e = l2e_empty(); int ret; ASSERT(gfn < (RO_MPT_VIRT_END - RO_MPT_VIRT_START) / sizeof(l1_pgentry_t)); - /* Need to __copy_from_user because the p2m is sparse and this - * part might not exist */ - ret = __copy_from_user(&l1e, - &phys_to_machine_mapping[gfn], - sizeof(l1e)); - - if ( ret == 0 ) { - p2mt = p2m_flags_to_type(l1e_get_flags(l1e)); - ASSERT(l1e_get_pfn(l1e) != INVALID_MFN || !p2m_is_ram(p2mt)); + ret = __copy_from_user(&l2e, + &__linear_l1_table[l1_linear_offset(RO_MPT_VIRT_START) + l2_linear_offset(addr)], + sizeof(l2e)); + + if ( (ret == 0) && (l2e_get_flags(l2e) & _PAGE_PRESENT) && + (l2e_get_flags(l2e) & _PAGE_PSE) ) + { + p2mt = p2m_flags_to_type(l2e_get_flags(l2e)); + ASSERT(l2e_get_pfn(l2e) != INVALID_MFN || !p2m_is_ram(p2mt)); if ( p2m_is_valid(p2mt) ) - mfn = _mfn(l1e_get_pfn(l1e)); - else - /* XXX see above */ + mfn = _mfn(l2e_get_pfn(l2e) + l1_table_offset(addr)); + else p2mt = p2m_mmio_dm; + } + else + { + + /* Need to __copy_from_user because the p2m is sparse and this + * part might not exist */ + ret = __copy_from_user(&l1e, + &phys_to_machine_mapping[gfn], + sizeof(l1e)); + + if ( ret == 0 ) { + p2mt = p2m_flags_to_type(l1e_get_flags(l1e)); + ASSERT(l1e_get_pfn(l1e) != INVALID_MFN || !p2m_is_ram(p2mt)); + if ( p2m_is_valid(p2mt) ) + mfn = _mfn(l1e_get_pfn(l1e)); + else + /* XXX see above */ + p2mt = p2m_mmio_dm; + } } } @@ -430,9 +529,10 @@ void p2m_change_entry_type_global(struct } static inline -int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt) -{ - return d->arch.p2m->set_entry(d, gfn, mfn, p2mt); +int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, + unsigned int page_order, p2m_type_t p2mt) +{ + return d->arch.p2m->set_entry(d, gfn, mfn, page_order, p2mt); } // Allocate a new p2m table for a domain. @@ -493,7 +593,8 @@ int p2m_alloc_table(struct domain *d, P2M_PRINTK("populating p2m table\n"); /* Initialise physmap tables for slot zero. Other code assumes this. */ - if ( !set_p2m_entry(d, 0, _mfn(INVALID_MFN), p2m_invalid) ) + if ( !set_p2m_entry(d, 0, _mfn(INVALID_MFN), 0, + p2m_invalid) ) goto error; /* Copy all existing mappings from the page list and m2p */ @@ -512,7 +613,7 @@ int p2m_alloc_table(struct domain *d, (gfn != 0x55555555L) #endif && gfn != INVALID_M2P_ENTRY - && !set_p2m_entry(d, gfn, mfn, p2m_ram_rw) ) + && !set_p2m_entry(d, gfn, mfn, 0, p2m_ram_rw) ) goto error; } @@ -688,6 +789,28 @@ static void audit_p2m(struct domain *d) gfn += 1 << (L2_PAGETABLE_SHIFT - PAGE_SHIFT); continue; } + + /* check for super page */ + if ( l2e_get_flags(l2e[i2]) & _PAGE_PSE ) + { + mfn = l2e_get_pfn(l2e[i2]); + ASSERT(mfn_valid(_mfn(mfn))); + for ( i1 = 0; i1 < L1_PAGETABLE_ENTRIES; i1++) + { + m2pfn = get_gpfn_from_mfn(mfn+i1); + if ( m2pfn != (gfn + i) ) + { + pmbad++; + P2M_PRINTK("mismatch: gfn %#lx -> mfn %#lx" + " -> gfn %#lx\n", gfn+i, mfn+i, + m2pfn); + BUG(); + } + } + gfn += 1 << (L2_PAGETABLE_SHIFT - PAGE_SHIFT); + continue; + } + l1e = map_domain_page(mfn_x(_mfn(l2e_get_pfn(l2e[i2])))); for ( i1 = 0; i1 < L1_PAGETABLE_ENTRIES; i1++, gfn++ ) @@ -737,32 +860,38 @@ static void audit_p2m(struct domain *d) static void -p2m_remove_page(struct domain *d, unsigned long gfn, unsigned long mfn) -{ +p2m_remove_page(struct domain *d, unsigned long gfn, unsigned long mfn, + unsigned int page_order) +{ + unsigned long i; + if ( !paging_mode_translate(d) ) return; + P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn, mfn); - set_p2m_entry(d, gfn, _mfn(INVALID_MFN), p2m_invalid); - set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY); + set_p2m_entry(d, gfn, _mfn(INVALID_MFN), page_order, p2m_invalid); + for ( i = 0; i < (1UL << page_order); i++ ) + set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY); } void guest_physmap_remove_page(struct domain *d, unsigned long gfn, - unsigned long mfn) + unsigned long mfn, unsigned int page_order) { p2m_lock(d->arch.p2m); audit_p2m(d); - p2m_remove_page(d, gfn, mfn); + p2m_remove_page(d, gfn, mfn, page_order); audit_p2m(d); p2m_unlock(d->arch.p2m); } int guest_physmap_add_entry(struct domain *d, unsigned long gfn, - unsigned long mfn, p2m_type_t t) -{ - unsigned long ogfn; + unsigned long mfn, unsigned int page_order, + p2m_type_t t) +{ + unsigned long i, ogfn; p2m_type_t ot; mfn_t omfn; int rc = 0; @@ -795,7 +924,8 @@ guest_physmap_add_entry(struct domain *d if ( p2m_is_ram(ot) ) { ASSERT(mfn_valid(omfn)); - set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); + for ( i = 0; i < (1UL << page_order); i++ ) + set_gpfn_from_mfn(mfn_x(omfn)+i, INVALID_M2P_ENTRY); } ogfn = mfn_to_gfn(d, _mfn(mfn)); @@ -818,21 +948,23 @@ guest_physmap_add_entry(struct domain *d P2M_DEBUG("old gfn=%#lx -> mfn %#lx\n", ogfn , mfn_x(omfn)); if ( mfn_x(omfn) == mfn ) - p2m_remove_page(d, ogfn, mfn); + p2m_remove_page(d, ogfn, mfn, page_order); } } if ( mfn_valid(_mfn(mfn)) ) { - if ( !set_p2m_entry(d, gfn, _mfn(mfn), t) ) + if ( !set_p2m_entry(d, gfn, _mfn(mfn), page_order, t) ) rc = -EINVAL; - set_gpfn_from_mfn(mfn, gfn); + for ( i = 0; i < (1UL << page_order); i++ ) + set_gpfn_from_mfn(mfn+i, gfn+i); } else { gdprintk(XENLOG_WARNING, "Adding bad mfn to p2m map (%#lx -> %#lx)\n", gfn, mfn); - if ( !set_p2m_entry(d, gfn, _mfn(INVALID_MFN), p2m_invalid) ) + if ( !set_p2m_entry(d, gfn, _mfn(INVALID_MFN), page_order, + p2m_invalid) ) rc = -EINVAL; } @@ -851,7 +983,7 @@ void p2m_change_type_global(struct domai l1_pgentry_t l1e_content; l1_pgentry_t *l1e; l2_pgentry_t *l2e; - mfn_t l1mfn; + mfn_t l1mfn, l2mfn; int i1, i2; l3_pgentry_t *l3e; int i3; @@ -891,11 +1023,26 @@ void p2m_change_type_global(struct domai { continue; } + l2mfn = _mfn(l3e_get_pfn(l3e[i3])); l2e = map_domain_page(l3e_get_pfn(l3e[i3])); for ( i2 = 0; i2 < L2_PAGETABLE_ENTRIES; i2++ ) { if ( !(l2e_get_flags(l2e[i2]) & _PAGE_PRESENT) ) { + continue; + } + + if ( (l2e_get_flags(l2e[i2]) & _PAGE_PSE) ) + { + flags = l2e_get_flags(l2e[i2]); + if ( p2m_flags_to_type(flags) != ot ) + continue; + mfn = l2e_get_pfn(l2e[i2]); + gfn = get_gpfn_from_mfn(mfn); + flags = p2m_flags_to_type(nt); + l1e_content = l1e_from_pfn(mfn, flags | _PAGE_PSE); + paging_write_p2m_entry(d, gfn, (l1_pgentry_t *)&l2e[i2], + l2mfn, l1e_content, 2); continue; } @@ -944,7 +1091,7 @@ p2m_type_t p2m_change_type(struct domain mfn = gfn_to_mfn(d, gfn, &pt); if ( pt == ot ) - set_p2m_entry(d, gfn, mfn, nt); + set_p2m_entry(d, gfn, mfn, 0, nt); p2m_unlock(d->arch.p2m); @@ -968,7 +1115,7 @@ set_mmio_p2m_entry(struct domain *d, uns set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); } - rc = set_p2m_entry(d, gfn, mfn, p2m_mmio_direct); + rc = set_p2m_entry(d, gfn, mfn, 0, p2m_mmio_direct); if ( 0 == rc ) gdprintk(XENLOG_ERR, "set_mmio_p2m_entry: set_p2m_entry failed! mfn=%08lx\n", @@ -992,7 +1139,7 @@ clear_mmio_p2m_entry(struct domain *d, u "clear_mmio_p2m_entry: gfn_to_mfn failed! gfn=%08lx\n", gfn); return 0; } - rc = set_p2m_entry(d, gfn, _mfn(INVALID_MFN), 0); + rc = set_p2m_entry(d, gfn, _mfn(INVALID_MFN), 0, 0); return rc; } diff -r 29dc52031954 -r 8d18e52a1b23 xen/common/grant_table.c --- a/xen/common/grant_table.c Thu May 15 09:38:00 2008 +0100 +++ b/xen/common/grant_table.c Thu May 15 11:09:16 2008 +0100 @@ -1159,7 +1159,7 @@ gnttab_transfer( spin_lock(&e->grant_table->lock); sha = &shared_entry(e->grant_table, gop.ref); - guest_physmap_add_page(e, sha->frame, mfn); + guest_physmap_add_page(e, sha->frame, mfn, 0); sha->frame = mfn; wmb(); sha->flags |= GTF_transfer_completed; diff -r 29dc52031954 -r 8d18e52a1b23 xen/common/memory.c --- a/xen/common/memory.c Thu May 15 09:38:00 2008 +0100 +++ b/xen/common/memory.c Thu May 15 11:09:16 2008 +0100 @@ -127,9 +127,7 @@ static void populate_physmap(struct memo if ( unlikely(paging_mode_translate(d)) ) { - for ( j = 0; j < (1 << a->extent_order); j++ ) - if ( guest_physmap_add_page(d, gpfn + j, mfn + j) ) - goto out; + guest_physmap_add_page(d, gpfn, mfn, a->extent_order); } else { @@ -172,7 +170,7 @@ int guest_remove_page(struct domain *d, if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) put_page(page); - guest_physmap_remove_page(d, gmfn, mfn); + guest_physmap_remove_page(d, gmfn, mfn, 0); put_page(page); @@ -419,7 +417,7 @@ static long memory_exchange(XEN_GUEST_HA if ( !test_and_clear_bit(_PGC_allocated, &page->count_info) ) BUG(); mfn = page_to_mfn(page); - guest_physmap_remove_page(d, mfn_to_gmfn(d, mfn), mfn); + guest_physmap_remove_page(d, mfn_to_gmfn(d, mfn), mfn, 0); put_page(page); } @@ -440,9 +438,7 @@ static long memory_exchange(XEN_GUEST_HA mfn = page_to_mfn(page); if ( unlikely(paging_mode_translate(d)) ) { - /* Ignore failure here. There's nothing we can do. */ - for ( k = 0; k < (1UL << exch.out.extent_order); k++ ) - (void)guest_physmap_add_page(d, gpfn + k, mfn + k); + guest_physmap_add_page(d, gpfn, mfn, exch.out.extent_order); } else { diff -r 29dc52031954 -r 8d18e52a1b23 xen/include/asm-ia64/grant_table.h --- a/xen/include/asm-ia64/grant_table.h Thu May 15 09:38:00 2008 +0100 +++ b/xen/include/asm-ia64/grant_table.h Thu May 15 11:09:16 2008 +0100 @@ -13,7 +13,7 @@ int replace_grant_host_mapping(unsigned int replace_grant_host_mapping(unsigned long gpaddr, unsigned long mfn, unsigned long new_gpaddr, unsigned int flags); // for grant transfer -int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn); +int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn, int order); /* XXX * somewhere appropriate diff -r 29dc52031954 -r 8d18e52a1b23 xen/include/asm-ia64/shadow.h --- a/xen/include/asm-ia64/shadow.h Thu May 15 09:38:00 2008 +0100 +++ b/xen/include/asm-ia64/shadow.h Thu May 15 11:09:16 2008 +0100 @@ -40,8 +40,10 @@ * Utilities to change relationship of gpfn->mfn for designated domain, * which is required by gnttab transfer, balloon, device model and etc. */ -int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn); -void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, unsigned long mfn); +int guest_physmap_add_page(struct domain *d, unsigned long gpfn, + unsigned long mfn, unsigned int page_order); +void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, + unsigned long mfn, unsigned int page_order); static inline int shadow_mode_enabled(struct domain *d) diff -r 29dc52031954 -r 8d18e52a1b23 xen/include/asm-x86/p2m.h --- a/xen/include/asm-x86/p2m.h Thu May 15 09:38:00 2008 +0100 +++ b/xen/include/asm-x86/p2m.h Thu May 15 11:09:16 2008 +0100 @@ -102,7 +102,8 @@ struct p2m_domain { void (*free_page )(struct domain *d, struct page_info *pg); int (*set_entry )(struct domain *d, unsigned long gfn, - mfn_t mfn, p2m_type_t p2mt); + mfn_t mfn, unsigned int page_order, + p2m_type_t p2mt); mfn_t (*get_entry )(struct domain *d, unsigned long gfn, p2m_type_t *p2mt); mfn_t (*get_entry_current)(unsigned long gfn, @@ -203,21 +204,23 @@ void p2m_final_teardown(struct domain *d /* Add a page to a domain's p2m table */ int guest_physmap_add_entry(struct domain *d, unsigned long gfn, - unsigned long mfn, p2m_type_t t); + unsigned long mfn, unsigned int page_order, + p2m_type_t t); /* Untyped version for RAM only, for compatibility * * Return 0 for success */ static inline int guest_physmap_add_page(struct domain *d, unsigned long gfn, - unsigned long mfn) -{ - return guest_physmap_add_entry(d, gfn, mfn, p2m_ram_rw); + unsigned long mfn, + unsigned int page_order) +{ + return guest_physmap_add_entry(d, gfn, mfn, page_order, p2m_ram_rw); } /* Remove a page from a domain's p2m table */ void guest_physmap_remove_page(struct domain *d, unsigned long gfn, - unsigned long mfn); + unsigned long mfn, unsigned int page_order); /* Change types across all p2m entries in a domain */ void p2m_change_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt); diff -r 29dc52031954 -r 8d18e52a1b23 xen/include/xen/paging.h --- a/xen/include/xen/paging.h Thu May 15 09:38:00 2008 +0100 +++ b/xen/include/xen/paging.h Thu May 15 11:09:16 2008 +0100 @@ -18,8 +18,8 @@ #else #define paging_mode_translate(d) (0) -#define guest_physmap_add_page(d, p, m) (0) -#define guest_physmap_remove_page(d, p, m) ((void)0) +#define guest_physmap_add_page(d, p, m, o) (0) +#define guest_physmap_remove_page(d, p, m, o) ((void)0) #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 10:20:17 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 10:20:17 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwh7o-0006J4-Rf for www-data@colo.xensource.com; Thu, 15 May 2008 10:20:17 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwh8R-0005aF-57; Thu, 15 May 2008 17:20:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwh8L-0005Ta-FQ for xen-changelog@lists.xensource.com; Thu, 15 May 2008 17:20:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwh8F-0004AV-LB for xen-changelog@lists.xensource.com; Thu, 15 May 2008 17:20:47 +0000 X-SBRS: 3.6 X-MesageID: 226157 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="226157" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 13:19:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FHJq69018166 for ; Thu, 15 May 2008 10:19:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FHKBCW013280 for ; Thu, 15 May 2008 10:20:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FHKB48013279 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 10:20:11 -0700 Message-Id: <200805151720.m4FHKB48013279@xenbits.xensource.com> Date: Thu, 15 May 2008 10:20:10 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] linux/x86: utilize lookup_address() for virt_to_ptep() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210860871 -3600 # Node ID c6e36a53cf054df48d892da2bb0145a5f111387a # Parent c3f9cc7789af995b7edfa8a8de4ae099a3750e9e linux/x86: utilize lookup_address() for virt_to_ptep() Signed-off-by: Jan Beulich --- arch/x86_64/mm/pageattr-xen.c | 2 +- include/asm-i386/mach-xen/asm/pgtable.h | 17 +++++++---------- include/asm-x86_64/mach-xen/asm/pgtable.h | 19 +++++++++---------- 3 files changed, 17 insertions(+), 21 deletions(-) diff -r c3f9cc7789af -r c6e36a53cf05 arch/x86_64/mm/pageattr-xen.c --- a/arch/x86_64/mm/pageattr-xen.c Thu May 15 10:03:29 2008 +0100 +++ b/arch/x86_64/mm/pageattr-xen.c Thu May 15 15:14:31 2008 +0100 @@ -276,7 +276,7 @@ void pte_free(struct page *pte) } #endif /* CONFIG_XEN */ -static inline pte_t *lookup_address(unsigned long address) +pte_t *lookup_address(unsigned long address) { pgd_t *pgd = pgd_offset_k(address); pud_t *pud; diff -r c3f9cc7789af -r c6e36a53cf05 include/asm-i386/mach-xen/asm/pgtable.h --- a/include/asm-i386/mach-xen/asm/pgtable.h Thu May 15 10:03:29 2008 +0100 +++ b/include/asm-i386/mach-xen/asm/pgtable.h Thu May 15 15:14:31 2008 +0100 @@ -477,19 +477,16 @@ void make_pages_readonly(void *va, unsig void make_pages_readonly(void *va, unsigned int nr, unsigned int feature); void make_pages_writable(void *va, unsigned int nr, unsigned int feature); -#define virt_to_ptep(__va) \ +#define virt_to_ptep(va) \ ({ \ - pgd_t *__pgd = pgd_offset_k((unsigned long)(__va)); \ - pud_t *__pud = pud_offset(__pgd, (unsigned long)(__va)); \ - pmd_t *__pmd = pmd_offset(__pud, (unsigned long)(__va)); \ - pte_offset_kernel(__pmd, (unsigned long)(__va)); \ + pte_t *__ptep = lookup_address((unsigned long)(va)); \ + BUG_ON(!__ptep || !pte_present(*__ptep)); \ + __ptep; \ }) -#define arbitrary_virt_to_machine(__va) \ -({ \ - maddr_t m = (maddr_t)pte_mfn(*virt_to_ptep(__va)) << PAGE_SHIFT;\ - m | ((unsigned long)(__va) & (PAGE_SIZE-1)); \ -}) +#define arbitrary_virt_to_machine(va) \ + (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ + | ((unsigned long)(va) & (PAGE_SIZE - 1))) #endif /* !__ASSEMBLY__ */ diff -r c3f9cc7789af -r c6e36a53cf05 include/asm-x86_64/mach-xen/asm/pgtable.h --- a/include/asm-x86_64/mach-xen/asm/pgtable.h Thu May 15 10:03:29 2008 +0100 +++ b/include/asm-x86_64/mach-xen/asm/pgtable.h Thu May 15 15:14:31 2008 +0100 @@ -18,19 +18,18 @@ extern pud_t level3_user_pgt[512]; extern void xen_init_pt(void); -#define virt_to_ptep(__va) \ +extern pte_t *lookup_address(unsigned long address); + +#define virt_to_ptep(va) \ ({ \ - pgd_t *__pgd = pgd_offset_k((unsigned long)(__va)); \ - pud_t *__pud = pud_offset(__pgd, (unsigned long)(__va)); \ - pmd_t *__pmd = pmd_offset(__pud, (unsigned long)(__va)); \ - pte_offset_kernel(__pmd, (unsigned long)(__va)); \ + pte_t *__ptep = lookup_address((unsigned long)(va)); \ + BUG_ON(!__ptep || !pte_present(*__ptep)); \ + __ptep; \ }) -#define arbitrary_virt_to_machine(__va) \ -({ \ - maddr_t m = (maddr_t)pte_mfn(*virt_to_ptep(__va)) << PAGE_SHIFT;\ - m | ((unsigned long)(__va) & (PAGE_SIZE-1)); \ -}) +#define arbitrary_virt_to_machine(va) \ + (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ + | ((unsigned long)(va) & (PAGE_SIZE - 1))) #endif extern pud_t level3_kernel_pgt[512]; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 10:20:20 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 10:20:20 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwh7s-0006J8-4d for www-data@colo.xensource.com; Thu, 15 May 2008 10:20:20 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwh8U-0005e3-EY; Thu, 15 May 2008 17:20:58 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwh8P-0005Wh-1w for xen-changelog@lists.xensource.com; Thu, 15 May 2008 17:20:53 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwh8I-0004Ad-5U for xen-changelog@lists.xensource.com; Thu, 15 May 2008 17:20:50 +0000 X-SBRS: 3.6 X-MesageID: 226158 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,492,1204520400"; d="scan'208";a="226158" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 13:19:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FHJrBX018169 for ; Thu, 15 May 2008 10:19:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FHKCJ1013297 for ; Thu, 15 May 2008 10:20:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FHKCjF013296 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 10:20:12 -0700 Message-Id: <200805151720.m4FHKCjF013296@xenbits.xensource.com> Date: Thu, 15 May 2008 10:20:11 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] linux/x86-64: initialization code cleanup X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210860909 -3600 # Node ID 12e74c1433a6305a7f5fbaa7bd34f0dcfabe06fc # Parent c6e36a53cf054df48d892da2bb0145a5f111387a linux/x86-64: initialization code cleanup Since init_memory_mapping() installs the pgd entry after populating all lower level tables, the whole mechanism can be coded to avoid using xen_l?_entry_update() on pages that aren't page tables (yet). Also, __set_pte() is a pure duplicate of set_pte() and hence can go away. Signed-off-by: Jan Beulich --- arch/x86_64/mm/init-xen.c | 54 ++++++++++++++++++++++------------------------ 1 files changed, 26 insertions(+), 28 deletions(-) diff -r c6e36a53cf05 -r 12e74c1433a6 arch/x86_64/mm/init-xen.c --- a/arch/x86_64/mm/init-xen.c Thu May 15 15:14:31 2008 +0100 +++ b/arch/x86_64/mm/init-xen.c Thu May 15 15:15:09 2008 +0100 @@ -59,6 +59,8 @@ EXPORT_SYMBOL(__kernel_page_user); EXPORT_SYMBOL(__kernel_page_user); #endif +int after_bootmem; + extern unsigned long *contiguous_bitmap; static unsigned long dma_reserve __initdata; @@ -82,6 +84,8 @@ static void __meminit early_make_page_re unsigned long addr, _va = (unsigned long)va; pte_t pte, *ptep; unsigned long *page = (unsigned long *) init_level4_pgt; + + BUG_ON(after_bootmem); if (xen_feature(feature)) return; @@ -207,7 +211,6 @@ void show_mem(void) printk(KERN_INFO "%lu pages swap cached\n",cached); } -int after_bootmem; static __init void *spp_getpage(void) { @@ -373,11 +376,6 @@ static __meminit void *alloc_static_page #define PTE_SIZE PAGE_SIZE -static inline void __set_pte(pte_t *dst, pte_t val) -{ - *dst = val; -} - static inline int make_readonly(unsigned long paddr) { extern char __vsyscall_0; @@ -446,28 +444,28 @@ phys_pmd_init(pmd_t *pmd, unsigned long unsigned long pte_phys; pte_t *pte, *pte_save; - if (address >= end) { - if (!after_bootmem) - for (; i < PTRS_PER_PMD; i++, pmd++) - set_pmd(pmd, __pmd(0)); + if (address >= end) break; - } pte = alloc_static_page(&pte_phys); pte_save = pte; for (k = 0; k < PTRS_PER_PTE; pte++, k++, address += PTE_SIZE) { unsigned long pteval = address | _PAGE_NX | _KERNPG_TABLE; - if ((address >= end) || - ((address >> PAGE_SHIFT) >= - xen_start_info->nr_pages)) + if (address >= (after_bootmem + ? end + : xen_start_info->nr_pages << PAGE_SHIFT)) pteval = 0; else if (make_readonly(address)) pteval &= ~_PAGE_RW; - __set_pte(pte, __pte(pteval & __supported_pte_mask)); - } - pte = pte_save; - early_make_page_readonly(pte, XENFEAT_writable_page_tables); - set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE)); + set_pte(pte, __pte(pteval & __supported_pte_mask)); + } + if (!after_bootmem) { + early_make_page_readonly(pte_save, XENFEAT_writable_page_tables); + *pmd = __pmd(pte_phys | _KERNPG_TABLE); + } else { + make_page_readonly(pte_save, XENFEAT_writable_page_tables); + set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE)); + } } } @@ -504,11 +502,13 @@ static void __meminit phys_pud_init(pud_ break; pmd = alloc_static_page(&pmd_phys); - early_make_page_readonly(pmd, XENFEAT_writable_page_tables); + spin_lock(&init_mm.page_table_lock); - set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE)); + *pud = __pud(pmd_phys | _KERNPG_TABLE); phys_pmd_init(pmd, paddr, end); spin_unlock(&init_mm.page_table_lock); + + early_make_page_readonly(pmd, XENFEAT_writable_page_tables); } __flush_tlb(); } @@ -739,20 +739,18 @@ void __meminit init_memory_mapping(unsig pgd_t *pgd = pgd_offset_k(start); pud_t *pud; - if (after_bootmem) { + if (after_bootmem) pud = pud_offset(pgd, start & PGDIR_MASK); - make_page_readonly(pud, XENFEAT_writable_page_tables); - pud_phys = __pa(pud); - } else { + else pud = alloc_static_page(&pud_phys); - early_make_page_readonly(pud, XENFEAT_writable_page_tables); - } next = start + PGDIR_SIZE; if (next > end) next = end; phys_pud_init(pud, __pa(start), __pa(next)); - if (!after_bootmem) + if (!after_bootmem) { + early_make_page_readonly(pud, XENFEAT_writable_page_tables); set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys)); + } } if (!after_bootmem) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 13:10:37 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 13:10:37 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwjmf-0000RO-Hv for www-data@colo.xensource.com; Thu, 15 May 2008 13:10:37 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwjnH-0005Lt-S3; Thu, 15 May 2008 20:11:15 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwjn1-00053S-Fj for xen-changelog@lists.xensource.com; Thu, 15 May 2008 20:10:59 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwjmt-0005qn-Q5 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 20:10:57 +0000 X-SBRS: 3.6 X-MesageID: 227359 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,493,1204520400"; d="scan'208";a="227359" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 16:10:07 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FKA6j3018426 for ; Thu, 15 May 2008 13:10:06 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FKAOjk022499 for ; Thu, 15 May 2008 13:10:24 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FKAOAA022498 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 13:10:24 -0700 Message-Id: <200805152010.m4FKAOAA022498@xenbits.xensource.com> Date: Thu, 15 May 2008 13:10:23 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] ioemu: Do not try to guess backing file format when using qcow vbds. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210860689 -3600 # Node ID 0016f5a1dd5a1622bcc66b82d2ef9bf4d36e88e3 # Parent aee5dc4a4a37005994c9ea7e9eab73043f30cb2c ioemu: Do not try to guess backing file format when using qcow vbds. Signed-off-by: Ian Jackson xen-unstable changeset: 17646:e3b13e1ecf6ca61b84c8bdf5ae3e961268c920f5 xen-unstable date: Thu May 15 15:10:05 2008 +0100 --- tools/ioemu/block.c | 32 ++++++++++++++++++++++++++------ tools/ioemu/xenstore.c | 4 +++- 2 files changed, 29 insertions(+), 7 deletions(-) diff -r aee5dc4a4a37 -r 0016f5a1dd5a tools/ioemu/block.c --- a/tools/ioemu/block.c Thu May 15 09:59:19 2008 +0100 +++ b/tools/ioemu/block.c Thu May 15 15:11:29 2008 +0100 @@ -236,8 +236,28 @@ static int is_windows_drive(const char * } #endif +static int bdrv_invalid_protocol_open(BlockDriverState *bs, + const char *filename, int flags) { + return -ENOENT; +} + +static BlockDriver bdrv_invalid_protocol = { + "invalid_protocol", + .bdrv_open = bdrv_invalid_protocol_open, +}; + static BlockDriver *find_protocol(const char *filename) { + /* Return values: + * &bdrv_xxx + * filename specifies protocol xxx + * caller should use that + * NULL filename does not specify any protocol + * caller may apply their own default + * &bdrv_invalid_protocol filename speciies an unknown protocol + * caller should return -ENOENT; or may just try to open with + * that bdrv, which always fails that way. + */ BlockDriver *drv1; char protocol[128]; int len; @@ -250,7 +270,7 @@ static BlockDriver *find_protocol(const #endif p = strchr(filename, ':'); if (!p) - return NULL; /* do not ever guess raw, it is a security problem! */ + return NULL; len = p - filename; if (len > sizeof(protocol) - 1) len = sizeof(protocol) - 1; @@ -261,7 +281,7 @@ static BlockDriver *find_protocol(const !strcmp(drv1->protocol_name, protocol)) return drv1; } - return NULL; + return &bdrv_invalid_protocol; } /* XXX: force raw format if block or character device ? It would @@ -291,8 +311,8 @@ static BlockDriver *find_image_format(co #endif drv = find_protocol(filename); - /* no need to test disk image formats for vvfat */ - if (drv == &bdrv_vvfat) + /* no need to test disk image format if the filename told us */ + if (drv != NULL) return drv; ret = bdrv_file_open(&bs, filename, BDRV_O_RDONLY); @@ -386,7 +406,7 @@ int bdrv_open2(BlockDriverState *bs, con if (flags & BDRV_O_FILE) { drv = find_protocol(filename); if (!drv) - return -ENOENT; + drv = &bdrv_raw; } else { if (!drv) { drv = find_image_format(filename); @@ -434,7 +454,7 @@ int bdrv_open2(BlockDriverState *bs, con } path_combine(backing_filename, sizeof(backing_filename), filename, bs->backing_file); - if (bdrv_open(bs->backing_hd, backing_filename, 0) < 0) + if (bdrv_open2(bs->backing_hd, backing_filename, 0, &bdrv_raw) < 0) goto fail; } diff -r aee5dc4a4a37 -r 0016f5a1dd5a tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Thu May 15 09:59:19 2008 +0100 +++ b/tools/ioemu/xenstore.c Thu May 15 15:11:29 2008 +0100 @@ -247,6 +247,8 @@ void xenstore_parse_domain_config(int do /* autoguess qcow vs qcow2 */ } else if (!strcmp(drv,"file") || !strcmp(drv,"phy")) { format = &bdrv_raw; + } else if (!strcmp(drv,"phy")) { + format = &bdrv_raw; } else { format = bdrv_find_format(drv); if (!format) { @@ -256,7 +258,7 @@ void xenstore_parse_domain_config(int do } } if (bdrv_open2(bs, params, 0 /* snapshot */, format) < 0) - fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s')\n", buf, params, drv ? drv : "?"); + fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s' format '%s')\n", buf, params, drv ? drv : "?", format ? format->format_name : "0"); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 15 16:00:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 15 May 2008 16:00:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JwmQh-0002cj-Fy for www-data@colo.xensource.com; Thu, 15 May 2008 16:00:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwmRJ-0008Nw-Ie; Thu, 15 May 2008 23:00:45 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JwmRI-0008Nd-0z for xen-changelog@lists.xensource.com; Thu, 15 May 2008 23:00:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JwmRB-0007Hy-9o for xen-changelog@lists.xensource.com; Thu, 15 May 2008 23:00:41 +0000 X-SBRS: 3.6 X-MesageID: 229419 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,493,1204520400"; d="scan'208";a="229419" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 15 May 2008 18:59:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4FMxqs4018713 for ; Thu, 15 May 2008 15:59:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4FN0AXU031228 for ; Thu, 15 May 2008 16:00:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4FN0Ar4031227 for xen-changelog@lists.xensource.com; Thu, 15 May 2008 16:00:10 -0700 Message-Id: <200805152300.m4FN0Ar4031227@xenbits.xensource.com> Date: Thu, 15 May 2008 16:00:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Device configurations of suspended virtual machines are inaccessible X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210866051 -3600 # Node ID f12724194ec6768baf865dc2d54afe646dbeac79 # Parent e3b13e1ecf6ca61b84c8bdf5ae3e961268c920f5 xend: Device configurations of suspended virtual machines are inaccessible The device configurations of suspended virtual machines are inaccessible even though for example the UUIDs of the VIFs and VBDs are known and returned when VM.get_VIFs()/get_VBDs() is called, though when trying to access their records for example, then handle is reported as being invalid. This patch fixes this. Signed-off-by: Stefan Berger --- tools/python/xen/xend/XendDomainInfo.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -r e3b13e1ecf6c -r f12724194ec6 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu May 15 15:10:05 2008 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu May 15 16:40:51 2008 +0100 @@ -3013,7 +3013,8 @@ class XendDomainInfo: # shortcut if the domain isn't started because # the devcontrollers will have no better information # than XendConfig. - if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED,): + if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, + XEN_API_VM_POWER_STATE_SUSPENDED): if dev_config: return copy.deepcopy(dev_config) return None _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 16 04:10:04 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 16 May 2008 04:10:04 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwxp6-0004Xu-9v for www-data@colo.xensource.com; Fri, 16 May 2008 04:10:04 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwxpi-0002R6-Sd; Fri, 16 May 2008 11:10:42 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwxph-0002Qj-Lz for xen-changelog@lists.xensource.com; Fri, 16 May 2008 11:10:41 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwxpb-0004lt-2l for xen-changelog@lists.xensource.com; Fri, 16 May 2008 11:10:39 +0000 X-SBRS: 3.6 X-MesageID: 233347 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,497,1204520400"; d="scan'208";a="233347" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 16 May 2008 07:09:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4GB9npx019563 for ; Fri, 16 May 2008 04:09:49 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4GBA8wM006145 for ; Fri, 16 May 2008 04:10:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4GBA7wi006144 for xen-changelog@lists.xensource.com; Fri, 16 May 2008 04:10:07 -0700 Message-Id: <200805161110.m4GBA7wi006144@xenbits.xensource.com> Date: Fri, 16 May 2008 04:10:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: serial save/load fix X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210926610 -3600 # Node ID 13e10678e7148e37f12dcda7739ed15385cbb576 # Parent f12724194ec6768baf865dc2d54afe646dbeac79 ioemu: serial save/load fix This patch fixes several bugs in serial.c (1) A typo in serial_save() where qemu_get_8s is called (should be qemu_put_8s) (2) No support provided in serial_load() for version_id == 1 (should unmarshal a 1 byte s->divider and should provide a default value for s->fcr) (3) Call serial_ioport_write() to initialize s->fcr. It is not sufficient to load its value; other hidden values (such as s->recv_fifo.itl) must be re-initialized. Signed-off-by: Ben Guthro Signed-off-by: Robert Phillips --- tools/ioemu/hw/serial.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) diff -r f12724194ec6 -r 13e10678e714 tools/ioemu/hw/serial.c --- a/tools/ioemu/hw/serial.c Thu May 15 16:40:51 2008 +0100 +++ b/tools/ioemu/hw/serial.c Fri May 16 09:30:10 2008 +0100 @@ -705,12 +705,13 @@ static void serial_save(QEMUFile *f, voi qemu_put_8s(f,&s->lsr); qemu_put_8s(f,&s->msr); qemu_put_8s(f,&s->scr); - qemu_get_8s(f,&s->fcr); + qemu_put_8s(f,&s->fcr); } static int serial_load(QEMUFile *f, void *opaque, int version_id) { SerialState *s = opaque; + uint8_t fcr = 0; if(version_id > 2) return -EINVAL; @@ -729,6 +730,11 @@ static int serial_load(QEMUFile *f, void qemu_get_8s(f,&s->scr); qemu_get_8s(f,&s->fcr); + if (version_id >= 2) + qemu_get_8s(f,&fcr); + + /* Initialize fcr via setter to perform essential side-effects */ + serial_ioport_write(s, 0x02, fcr); return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 16 04:10:08 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 16 May 2008 04:10:08 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jwxp9-0004Xx-TV for www-data@colo.xensource.com; Fri, 16 May 2008 04:10:08 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwxpm-0002UP-Iq; Fri, 16 May 2008 11:10:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwxpk-0002Qo-DY for xen-changelog@lists.xensource.com; Fri, 16 May 2008 11:10:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwxpe-0004lv-1u for xen-changelog@lists.xensource.com; Fri, 16 May 2008 11:10:42 +0000 X-SBRS: 3.6 X-MesageID: 233348 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,497,1204520400"; d="scan'208";a="233348" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 16 May 2008 07:09:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4GB9odW019566 for ; Fri, 16 May 2008 04:09:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4GBA8I8006162 for ; Fri, 16 May 2008 04:10:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4GBA8dM006161 for xen-changelog@lists.xensource.com; Fri, 16 May 2008 04:10:08 -0700 Message-Id: <200805161110.m4GBA8dM006161@xenbits.xensource.com> Date: Fri, 16 May 2008 04:10:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] trivial compilation error fix for 17645:8d18e52a1b23. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210926663 -3600 # Node ID f65906f262f9928abfd2ba642ba2051919cdfbbe # Parent 13e10678e7148e37f12dcda7739ed15385cbb576 [IA64] trivial compilation error fix for 17645:8d18e52a1b23. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/mm.c | 2 +- xen/include/asm-ia64/grant_table.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff -r 13e10678e714 -r f65906f262f9 xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Fri May 16 09:30:10 2008 +0100 +++ b/xen/arch/ia64/xen/mm.c Fri May 16 09:31:03 2008 +0100 @@ -2442,7 +2442,7 @@ guest_physmap_remove_page(struct domain BUG_ON(mfn == 0);//XXX - for (i = 0; i < (1UL << page_order); i++) { + for (i = 0; i < (1UL << page_order); i++) zap_domain_page_one(d, (gpfn+i) << PAGE_SHIFT, 0, mfn+i); perfc_incr(guest_physmap_remove_page); diff -r 13e10678e714 -r f65906f262f9 xen/include/asm-ia64/grant_table.h --- a/xen/include/asm-ia64/grant_table.h Fri May 16 09:30:10 2008 +0100 +++ b/xen/include/asm-ia64/grant_table.h Fri May 16 09:31:03 2008 +0100 @@ -13,7 +13,7 @@ int replace_grant_host_mapping(unsigned int replace_grant_host_mapping(unsigned long gpaddr, unsigned long mfn, unsigned long new_gpaddr, unsigned int flags); // for grant transfer -int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn, int order); +int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn, unsigned int page_order); /* XXX * somewhere appropriate _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 16 04:10:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 16 May 2008 04:10:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JwxpE-0004Y2-Me for www-data@colo.xensource.com; Fri, 16 May 2008 04:10:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwxpr-0002YM-CC; Fri, 16 May 2008 11:10:51 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwxpp-0002Vw-I1 for xen-changelog@lists.xensource.com; Fri, 16 May 2008 11:10:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwxpg-0004lt-4x for xen-changelog@lists.xensource.com; Fri, 16 May 2008 11:10:47 +0000 X-SBRS: 3.6 X-MesageID: 233349 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,497,1204520400"; d="scan'208";a="233349" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 16 May 2008 07:09:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4GB9psE019569 for ; Fri, 16 May 2008 04:09:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4GBA9GQ006179 for ; Fri, 16 May 2008 04:10:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4GBA9tu006178 for xen-changelog@lists.xensource.com; Fri, 16 May 2008 04:10:09 -0700 Message-Id: <200805161110.m4GBA9tu006178@xenbits.xensource.com> Date: Fri, 16 May 2008 04:10:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Provide Px statistic data to user through libxc X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210927039 -3600 # Node ID d0817f08599afe3f2d7ffa2e3fd88e6a65f5e85d # Parent f65906f262f9928abfd2ba642ba2051919cdfbbe Provide Px statistic data to user through libxc Sampling and collecting dynamic Px statistic data, including Px state value, Px count, Px residency time, Px transition matrix, etc. Provide Px statistic data to user through libxc. Signed-off-by: Liu Jinsong --- tools/libxc/Makefile | 1 tools/libxc/xc_pm.c | 101 +++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 19 +++++ xen/arch/x86/acpi/Makefile | 1 xen/arch/x86/acpi/cpufreq/cpufreq.c | 16 +++- xen/arch/x86/acpi/cpufreq/utility.c | 77 +++++++++++++++++++++ xen/arch/x86/acpi/pmstat.c | 110 ++++++++++++++++++++++++++++++ xen/arch/x86/platform_hypercall.c | 3 xen/common/sysctl.c | 16 ++++ xen/include/acpi/cpufreq/processor_perf.h | 23 ++++++ xen/include/public/sysctl.h | 37 +++++++++- 11 files changed, 397 insertions(+), 7 deletions(-) diff -r f65906f262f9 -r d0817f08599a tools/libxc/Makefile --- a/tools/libxc/Makefile Fri May 16 09:31:03 2008 +0100 +++ b/tools/libxc/Makefile Fri May 16 09:37:19 2008 +0100 @@ -20,6 +20,7 @@ CTRL_SRCS-y += xc_sedf.c CTRL_SRCS-y += xc_sedf.c CTRL_SRCS-y += xc_csched.c CTRL_SRCS-y += xc_tbuf.c +CTRL_SRCS-y += xc_pm.c ifneq ($(stubdom),y) CTRL_SRCS-y += xc_resume.c endif diff -r f65906f262f9 -r d0817f08599a tools/libxc/xc_pm.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxc/xc_pm.c Fri May 16 09:37:19 2008 +0100 @@ -0,0 +1,101 @@ +/****************************************************************************** + * xc_pm.c - Libxc API for Xen Power Management (Px/Cx/Tx, etc.) statistic + * + * Copyright (c) 2008, Liu Jinsong + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#include "xc_private.h" + +int xc_pm_get_max_px(int xc_handle, int cpuid, int *max_px) +{ + DECLARE_SYSCTL; + int ret; + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_get_max_px; + sysctl.u.get_pmstat.cpuid = cpuid; + ret = xc_sysctl(xc_handle, &sysctl); + if ( ret ) + return ret; + + *max_px = sysctl.u.get_pmstat.u.getpx.total; + return ret; +} + +int xc_pm_get_pxstat(int xc_handle, int cpuid, struct xc_px_stat *pxpt) +{ + DECLARE_SYSCTL; + int max_px, ret; + + if ( !pxpt || !(pxpt->trans_pt) || !(pxpt->pt) ) + return -EINVAL; + + if ( (ret = xc_pm_get_max_px(xc_handle, cpuid, &max_px)) != 0) + return ret; + + if ( (ret = lock_pages(pxpt->trans_pt, + max_px * max_px * sizeof(uint64_t))) != 0 ) + return ret; + + if ( (ret = lock_pages(pxpt->pt, + max_px * sizeof(struct xc_px_val))) != 0 ) + { + unlock_pages(pxpt->trans_pt, max_px * max_px * sizeof(uint64_t)); + return ret; + } + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_get_pxstat; + sysctl.u.get_pmstat.cpuid = cpuid; + set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.trans_pt, pxpt->trans_pt); + set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.pt, + (pm_px_val_t *)pxpt->pt); + + ret = xc_sysctl(xc_handle, &sysctl); + if ( ret ) + { + unlock_pages(pxpt->trans_pt, max_px * max_px * sizeof(uint64_t)); + unlock_pages(pxpt->pt, max_px * sizeof(struct xc_px_val)); + return ret; + } + + pxpt->total = sysctl.u.get_pmstat.u.getpx.total; + pxpt->usable = sysctl.u.get_pmstat.u.getpx.usable; + pxpt->last = sysctl.u.get_pmstat.u.getpx.last; + pxpt->cur = sysctl.u.get_pmstat.u.getpx.cur; + + unlock_pages(pxpt->trans_pt, max_px * max_px * sizeof(uint64_t)); + unlock_pages(pxpt->pt, max_px * sizeof(struct xc_px_val)); + + return ret; +} + +int xc_pm_reset_pxstat(int xc_handle, int cpuid) +{ + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_reset_pxstat; + sysctl.u.get_pmstat.cpuid = cpuid; + + return xc_sysctl(xc_handle, &sysctl); +} diff -r f65906f262f9 -r d0817f08599a tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Fri May 16 09:31:03 2008 +0100 +++ b/tools/libxc/xenctrl.h Fri May 16 09:37:19 2008 +0100 @@ -1034,4 +1034,23 @@ void xc_cpuid_to_str(const unsigned int char **strs); #endif +struct xc_px_val { + uint64_t freq; /* Px core frequency */ + uint64_t residency; /* Px residency time */ + uint64_t count; /* Px transition count */ +}; + +struct xc_px_stat { + uint8_t total; /* total Px states */ + uint8_t usable; /* usable Px states */ + uint8_t last; /* last Px state */ + uint8_t cur; /* current Px state */ + uint64_t *trans_pt; /* Px transition table */ + struct xc_px_val *pt; +}; + +int xc_pm_get_max_px(int xc_handle, int cpuid, int *max_px); +int xc_pm_get_pxstat(int xc_handle, int cpuid, struct xc_px_stat *pxpt); +int xc_pm_reset_pxstat(int xc_handle, int cpuid); + #endif /* XENCTRL_H */ diff -r f65906f262f9 -r d0817f08599a xen/arch/x86/acpi/Makefile --- a/xen/arch/x86/acpi/Makefile Fri May 16 09:31:03 2008 +0100 +++ b/xen/arch/x86/acpi/Makefile Fri May 16 09:37:19 2008 +0100 @@ -2,3 +2,4 @@ subdir-y += cpufreq obj-y += boot.o obj-y += power.o suspend.o wakeup_prot.o cpu_idle.o +obj-y += pmstat.o diff -r f65906f262f9 -r d0817f08599a xen/arch/x86/acpi/cpufreq/cpufreq.c --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Fri May 16 09:31:03 2008 +0100 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Fri May 16 09:37:19 2008 +0100 @@ -369,6 +369,8 @@ static int acpi_cpufreq_target(struct cp if (!check_freqs(cmd.mask, freqs.new, data)) return -EAGAIN; + px_statistic_update(cmd.mask, perf->state, next_perf_state); + perf->state = next_perf_state; policy->cur = freqs.new; @@ -581,9 +583,13 @@ int acpi_cpufreq_init(void) for_each_online_cpu(i) { xen_px_policy[i].cpu = i; + ret = px_statistic_init(i); + if (ret) + goto out; + ret = acpi_cpufreq_cpu_init(&xen_px_policy[i]); if (ret) - goto cpufreq_init_out; + goto out; } /* setup ondemand cpufreq */ @@ -593,10 +599,10 @@ int acpi_cpufreq_init(void) i = first_cpu(pt[dom]); ret = cpufreq_governor_dbs(&xen_px_policy[i], CPUFREQ_GOV_START); if (ret) - goto cpufreq_init_out; - } - -cpufreq_init_out: + goto out; + } + +out: xfree(pt); return ret; diff -r f65906f262f9 -r d0817f08599a xen/arch/x86/acpi/cpufreq/utility.c --- a/xen/arch/x86/acpi/cpufreq/utility.c Fri May 16 09:31:03 2008 +0100 +++ b/xen/arch/x86/acpi/cpufreq/utility.c Fri May 16 09:37:19 2008 +0100 @@ -34,6 +34,83 @@ struct cpufreq_driver *cpufreq_driver; struct cpufreq_driver *cpufreq_driver; /********************************************************************* + * Px STATISTIC INFO * + *********************************************************************/ + +void px_statistic_update(cpumask_t cpumask, uint8_t from, uint8_t to) +{ + uint32_t i; + uint64_t now; + + now = NOW(); + + for_each_cpu_mask(i, cpumask) { + struct pm_px *pxpt = &px_statistic_data[i]; + uint32_t statnum = processor_pminfo[i].perf.state_count; + + pxpt->u.last = from; + pxpt->u.cur = to; + pxpt->u.pt[to].count++; + pxpt->u.pt[from].residency += now - pxpt->prev_state_wall; + + (*(pxpt->u.trans_pt + from*statnum + to))++; + + pxpt->prev_state_wall = now; + } +} + +int px_statistic_init(int cpuid) +{ + uint32_t i, count; + struct pm_px *pxpt = &px_statistic_data[cpuid]; + struct processor_pminfo *pmpt = &processor_pminfo[cpuid]; + + count = pmpt->perf.state_count; + + pxpt->u.trans_pt = xmalloc_array(uint64_t, count * count); + if (!pxpt->u.trans_pt) + return -ENOMEM; + + pxpt->u.pt = xmalloc_array(struct pm_px_val, count); + if (!pxpt->u.pt) { + xfree(pxpt->u.trans_pt); + return -ENOMEM; + } + + memset(pxpt->u.trans_pt, 0, count * count * (sizeof(uint64_t))); + memset(pxpt->u.pt, 0, count * (sizeof(struct pm_px_val))); + + pxpt->u.total = pmpt->perf.state_count; + pxpt->u.usable = pmpt->perf.state_count - pmpt->perf.ppc; + + for (i=0; i < pmpt->perf.state_count; i++) + pxpt->u.pt[i].freq = pmpt->perf.states[i].core_frequency; + + pxpt->prev_state_wall = NOW(); + + return 0; +} + +void px_statistic_reset(int cpuid) +{ + uint32_t i, j, count; + struct pm_px *pxpt = &px_statistic_data[cpuid]; + + count = processor_pminfo[cpuid].perf.state_count; + + for (i=0; i < count; i++) { + pxpt->u.pt[i].residency = 0; + pxpt->u.pt[i].count = 0; + + for (j=0; j < count; j++) + *(pxpt->u.trans_pt + i*count + j) = 0; + } + + pxpt->prev_state_wall = NOW(); +} + + +/********************************************************************* * FREQUENCY TABLE HELPERS * *********************************************************************/ diff -r f65906f262f9 -r d0817f08599a xen/arch/x86/acpi/pmstat.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/acpi/pmstat.c Fri May 16 09:37:19 2008 +0100 @@ -0,0 +1,110 @@ +/***************************************************************************** +# pmstat.c - Power Management statistic information (Px/Cx/Tx, etc.) +# +# Copyright (c) 2008, Liu Jinsong +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The full GNU General Public License is included in this distribution in the +# file called LICENSE. +# +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +struct pm_px px_statistic_data[NR_CPUS]; + +int do_get_pm_info(struct xen_sysctl_get_pmstat *op) +{ + int ret = 0; + struct pm_px *pxpt = &px_statistic_data[op->cpuid]; + struct processor_pminfo *pmpt = &processor_pminfo[op->cpuid]; + + /* to protect the case when Px was controlled by dom0-kernel */ + /* or when CPU_FREQ not set in which case ACPI Px objects not parsed */ + if ( !pmpt->perf.init ) + return -EINVAL; + + if ( !cpu_online(op->cpuid) ) + return -EINVAL; + + switch( op->type ) + { + case PMSTAT_get_max_px: + { + op->u.getpx.total = pmpt->perf.state_count; + break; + } + + case PMSTAT_get_pxstat: + { + uint64_t now, ct; + + now = NOW(); + pxpt->u.usable = pmpt->perf.state_count - pmpt->perf.ppc; + pxpt->u.pt[pxpt->u.cur].residency += now - pxpt->prev_state_wall; + pxpt->prev_state_wall = now; + + ct = pmpt->perf.state_count; + if ( copy_to_guest(op->u.getpx.trans_pt, pxpt->u.trans_pt, ct*ct) ) + { + ret = -EFAULT; + break; + } + + if ( copy_to_guest(op->u.getpx.pt, pxpt->u.pt, ct) ) + { + ret = -EFAULT; + break; + } + + op->u.getpx.total = pxpt->u.total; + op->u.getpx.usable = pxpt->u.usable; + op->u.getpx.last = pxpt->u.last; + op->u.getpx.cur = pxpt->u.cur; + + break; + } + + case PMSTAT_reset_pxstat: + { + px_statistic_reset(op->cpuid); + break; + } + + default: + printk("not defined sub-hypercall @ do_get_pm_info\n"); + ret = -ENOSYS; + break; + } + + return ret; +} diff -r f65906f262f9 -r d0817f08599a xen/arch/x86/platform_hypercall.c --- a/xen/arch/x86/platform_hypercall.c Fri May 16 09:31:03 2008 +0100 +++ b/xen/arch/x86/platform_hypercall.c Fri May 16 09:37:19 2008 +0100 @@ -403,7 +403,10 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe if ( xenpxpt->flags == ( XEN_PX_PCT | XEN_PX_PSS | XEN_PX_PSD | XEN_PX_PPC ) ) + { + pxpt->init =1; cpu_count++; + } if ( cpu_count == num_online_cpus() ) ret = acpi_cpufreq_init(); break; diff -r f65906f262f9 -r d0817f08599a xen/common/sysctl.c --- a/xen/common/sysctl.c Fri May 16 09:31:03 2008 +0100 +++ b/xen/common/sysctl.c Fri May 16 09:37:19 2008 +0100 @@ -25,6 +25,8 @@ #include #include +extern int do_get_pm_info(struct xen_sysctl_get_pmstat *op); + extern long arch_do_sysctl( struct xen_sysctl *op, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl); @@ -193,6 +195,20 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc op->u.availheap.avail_bytes <<= PAGE_SHIFT; ret = copy_to_guest(u_sysctl, op, 1) ? -EFAULT : 0; + } + break; + + case XEN_SYSCTL_get_pmstat: + { + ret = do_get_pm_info(&op->u.get_pmstat); + if ( ret ) + break; + + if ( copy_to_guest(u_sysctl, op, 1) ) + { + ret = -EFAULT; + break; + } } break; diff -r f65906f262f9 -r d0817f08599a xen/include/acpi/cpufreq/processor_perf.h --- a/xen/include/acpi/cpufreq/processor_perf.h Fri May 16 09:31:03 2008 +0100 +++ b/xen/include/acpi/cpufreq/processor_perf.h Fri May 16 09:37:19 2008 +0100 @@ -2,9 +2,13 @@ #define __XEN_PROCESSOR_PM_H__ #include +#include int get_cpu_id(u8); int acpi_cpufreq_init(void); +void px_statistic_update(cpumask_t, uint8_t, uint8_t); +int px_statistic_init(int); +void px_statistic_reset(int); struct processor_performance { uint32_t state; @@ -16,15 +20,32 @@ struct processor_performance { struct xen_psd_package domain_info; cpumask_t shared_cpu_map; uint32_t shared_type; + + uint32_t init; }; struct processor_pminfo { uint32_t acpi_id; uint32_t id; - uint32_t flag; struct processor_performance perf; }; extern struct processor_pminfo processor_pminfo[NR_CPUS]; +struct px_stat { + uint8_t total; /* total Px states */ + uint8_t usable; /* usable Px states */ + uint8_t last; /* last Px state */ + uint8_t cur; /* current Px state */ + uint64_t *trans_pt; /* Px transition table */ + pm_px_val_t *pt; +}; + +struct pm_px { + struct px_stat u; + uint64_t prev_state_wall; +}; + +extern struct pm_px px_statistic_data[NR_CPUS]; + #endif /* __XEN_PROCESSOR_PM_H__ */ diff -r f65906f262f9 -r d0817f08599a xen/include/public/sysctl.h --- a/xen/include/public/sysctl.h Fri May 16 09:31:03 2008 +0100 +++ b/xen/include/public/sysctl.h Fri May 16 09:37:19 2008 +0100 @@ -212,7 +212,41 @@ struct xen_sysctl_availheap { }; typedef struct xen_sysctl_availheap xen_sysctl_availheap_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t); - + +#define XEN_SYSCTL_get_pmstat 10 +struct pm_px_val { + uint64_aligned_t freq; /* Px core frequency */ + uint64_aligned_t residency; /* Px residency time */ + uint64_aligned_t count; /* Px transition count */ +}; +typedef struct pm_px_val pm_px_val_t; +DEFINE_XEN_GUEST_HANDLE(pm_px_val_t); + +struct pm_px_stat { + uint8_t total; /* total Px states */ + uint8_t usable; /* usable Px states */ + uint8_t last; /* last Px state */ + uint8_t cur; /* current Px state */ + XEN_GUEST_HANDLE_64(uint64) trans_pt; /* Px transition table */ + XEN_GUEST_HANDLE_64(pm_px_val_t) pt; +}; +typedef struct pm_px_stat pm_px_stat_t; +DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t); + +struct xen_sysctl_get_pmstat { +#define PMSTAT_get_max_px 0x11 +#define PMSTAT_get_pxstat 0x12 +#define PMSTAT_reset_pxstat 0x13 + uint32_t type; + uint32_t cpuid; + union { + struct pm_px_stat getpx; + /* other struct for cx, tx, etc */ + } u; +}; +typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t; +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t); + struct xen_sysctl { uint32_t cmd; uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ @@ -226,6 +260,7 @@ struct xen_sysctl { struct xen_sysctl_debug_keys debug_keys; struct xen_sysctl_getcpuinfo getcpuinfo; struct xen_sysctl_availheap availheap; + struct xen_sysctl_get_pmstat get_pmstat; uint8_t pad[128]; } u; }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 16 04:10:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 16 May 2008 04:10:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JwxpH-0004Y3-Jk for www-data@colo.xensource.com; Fri, 16 May 2008 04:10:15 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwxpu-0002bS-96; Fri, 16 May 2008 11:10:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jwxpq-0002X0-HN for xen-changelog@lists.xensource.com; Fri, 16 May 2008 11:10:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jwxpi-0004m1-LZ for xen-changelog@lists.xensource.com; Fri, 16 May 2008 11:10:48 +0000 X-SBRS: 3.6 X-MesageID: 233350 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,497,1204520400"; d="scan'208";a="233350" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 16 May 2008 07:09:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4GB9r4i019572 for ; Fri, 16 May 2008 04:09:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4GBAB33006242 for ; Fri, 16 May 2008 04:10:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4GBAB8M006241 for xen-changelog@lists.xensource.com; Fri, 16 May 2008 04:10:11 -0700 Message-Id: <200805161110.m4GBAB8M006241@xenbits.xensource.com> Date: Fri, 16 May 2008 04:10:10 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Update public Xen sysctl.h file. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1210927011 -3600 # Node ID 8ce60d057d0c4d4394df2c5fab4965d4ec189722 # Parent 12e74c1433a6305a7f5fbaa7bd34f0dcfabe06fc Update public Xen sysctl.h file. Signed-off-by: Liu Jinsong --- include/xen/interface/sysctl.h | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+) diff -r 12e74c1433a6 -r 8ce60d057d0c include/xen/interface/sysctl.h --- a/include/xen/interface/sysctl.h Thu May 15 15:15:09 2008 +0100 +++ b/include/xen/interface/sysctl.h Fri May 16 09:36:51 2008 +0100 @@ -212,6 +212,40 @@ struct xen_sysctl_availheap { }; typedef struct xen_sysctl_availheap xen_sysctl_availheap_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t); + +#define XEN_SYSCTL_get_pmstat 10 +struct pm_px_val { + uint64_aligned_t freq; /* Px core frequency */ + uint64_aligned_t residency; /* Px residency time */ + uint64_aligned_t count; /* Px transition count */ +}; +typedef struct pm_px_val pm_px_val_t; +DEFINE_XEN_GUEST_HANDLE(pm_px_val_t); + +struct pm_px_stat { + uint8_t total; /* total Px states */ + uint8_t usable; /* usable Px states */ + uint8_t last; /* last Px state */ + uint8_t cur; /* current Px state */ + XEN_GUEST_HANDLE_64(uint64) trans_pt; /* Px transition table */ + XEN_GUEST_HANDLE_64(pm_px_val_t) pt; +}; +typedef struct pm_px_stat pm_px_stat_t; +DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t); + +struct xen_sysctl_get_pmstat { +#define PMSTAT_get_max_px 0x11 +#define PMSTAT_get_pxstat 0x12 +#define PMSTAT_reset_pxstat 0x13 + uint32_t type; + uint32_t cpuid; + union { + struct pm_px_stat getpx; + /* other struct for cx, tx, etc */ + } u; +}; +typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t; +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t); struct xen_sysctl { uint32_t cmd; @@ -226,6 +260,7 @@ struct xen_sysctl { struct xen_sysctl_debug_keys debug_keys; struct xen_sysctl_getcpuinfo getcpuinfo; struct xen_sysctl_availheap availheap; + struct xen_sysctl_get_pmstat get_pmstat; uint8_t pad[128]; } u; }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 19 04:40:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 19 May 2008 04:40:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jy3ir-0002K3-JY for www-data@colo.xensource.com; Mon, 19 May 2008 04:40:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jy3jU-0002hX-UZ; Mon, 19 May 2008 11:40:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jy3jS-0002gv-FV for xen-changelog@lists.xensource.com; Mon, 19 May 2008 11:40:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jy3jI-0001NM-Qw for xen-changelog@lists.xensource.com; Mon, 19 May 2008 11:40:44 +0000 X-SBRS: 3.6 X-MesageID: 256546 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,508,1204520400"; d="scan'208";a="256546" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 May 2008 07:39:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4JBdoEc026409 for ; Mon, 19 May 2008 04:39:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4JBe8aa031690 for ; Mon, 19 May 2008 04:40:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4JBe8Kr031689 for xen-changelog@lists.xensource.com; Mon, 19 May 2008 04:40:08 -0700 Message-Id: <200805191140.m4JBe8Kr031689@xenbits.xensource.com> Date: Mon, 19 May 2008 04:40:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] stdvga: handle 64bit io operations X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211186453 -3600 # Node ID 3a5750f4a7387cd635328449a03bdc0eb4ae9ce6 # Parent d0817f08599afe3f2d7ffa2e3fd88e6a65f5e85d stdvga: handle 64bit io operations Handle 64bit operations in stdvga instead of throwing away the upper 32bits. This fixes some noisy xen messages like "invalid io size: 8". Signed-off-by: Christoph Egger --- xen/arch/x86/hvm/stdvga.c | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff -r d0817f08599a -r 3a5750f4a738 xen/arch/x86/hvm/stdvga.c --- a/xen/arch/x86/hvm/stdvga.c Fri May 16 09:37:19 2008 +0100 +++ b/xen/arch/x86/hvm/stdvga.c Mon May 19 09:40:53 2008 +0100 @@ -271,9 +271,9 @@ static uint8_t stdvga_mem_readb(uint64_t return ret; } -static uint32_t stdvga_mem_read(uint32_t addr, uint32_t size) -{ - uint32_t data = 0; +static uint64_t stdvga_mem_read(uint64_t addr, uint64_t size) +{ + uint64_t data = 0; switch ( size ) { @@ -293,8 +293,19 @@ static uint32_t stdvga_mem_read(uint32_t data |= stdvga_mem_readb(addr + 3) << 24; break; + case 8: + data = (uint64_t)(stdvga_mem_readb(addr)); + data |= (uint64_t)(stdvga_mem_readb(addr + 1)) << 8; + data |= (uint64_t)(stdvga_mem_readb(addr + 2)) << 16; + data |= (uint64_t)(stdvga_mem_readb(addr + 3)) << 24; + data |= (uint64_t)(stdvga_mem_readb(addr + 4)) << 32; + data |= (uint64_t)(stdvga_mem_readb(addr + 5)) << 40; + data |= (uint64_t)(stdvga_mem_readb(addr + 6)) << 48; + data |= (uint64_t)(stdvga_mem_readb(addr + 7)) << 56; + break; + default: - gdprintk(XENLOG_WARNING, "invalid io size:%d\n", size); + gdprintk(XENLOG_WARNING, "invalid io size: %"PRId64"\n", size); break; } @@ -409,7 +420,7 @@ static void stdvga_mem_writeb(uint64_t a } } -static void stdvga_mem_write(uint32_t addr, uint32_t data, uint32_t size) +static void stdvga_mem_write(uint64_t addr, uint64_t data, uint64_t size) { /* Intercept mmio write */ switch ( size ) @@ -430,8 +441,19 @@ static void stdvga_mem_write(uint32_t ad stdvga_mem_writeb(addr+3, (data >> 24) & 0xff); break; + case 8: + stdvga_mem_writeb(addr+0, (data >> 0) & 0xff); + stdvga_mem_writeb(addr+1, (data >> 8) & 0xff); + stdvga_mem_writeb(addr+2, (data >> 16) & 0xff); + stdvga_mem_writeb(addr+3, (data >> 24) & 0xff); + stdvga_mem_writeb(addr+4, (data >> 32) & 0xff); + stdvga_mem_writeb(addr+5, (data >> 40) & 0xff); + stdvga_mem_writeb(addr+6, (data >> 48) & 0xff); + stdvga_mem_writeb(addr+7, (data >> 56) & 0xff); + break; + default: - gdprintk(XENLOG_WARNING, "invalid io size:%d\n", size); + gdprintk(XENLOG_WARNING, "invalid io size: %"PRId64"\n", size); break; } } @@ -447,7 +469,7 @@ static int mmio_move(struct hvm_hw_stdvg { if ( p->dir == IOREQ_READ ) { - uint32_t addr = p->addr, data = p->data, tmp; + uint64_t addr = p->addr, data = p->data, tmp; for ( i = 0; i < p->count; i++ ) { tmp = stdvga_mem_read(addr, p->size); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 19 04:40:11 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 19 May 2008 04:40:11 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jy3is-0002K6-Ns for www-data@colo.xensource.com; Mon, 19 May 2008 04:40:11 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jy3jW-0002jq-Ic; Mon, 19 May 2008 11:40:50 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jy3jT-0002gw-EU for xen-changelog@lists.xensource.com; Mon, 19 May 2008 11:40:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jy3jJ-0001NP-W5 for xen-changelog@lists.xensource.com; Mon, 19 May 2008 11:40:45 +0000 X-SBRS: 3.6 X-MesageID: 256547 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,508,1204520400"; d="scan'208";a="256547" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 May 2008 07:39:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4JBdoOi026412 for ; Mon, 19 May 2008 04:39:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4JBe9OK031707 for ; Mon, 19 May 2008 04:40:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4JBe9SN031706 for xen-changelog@lists.xensource.com; Mon, 19 May 2008 04:40:09 -0700 Message-Id: <200805191140.m4JBe9SN031706@xenbits.xensource.com> Date: Mon, 19 May 2008 04:40:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: Fix load of PCI-device IRQ state after save/restore. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211186538 -3600 # Node ID f34f771f9ddd86376dd5796709deb4608d871eb1 # Parent 3a5750f4a7387cd635328449a03bdc0eb4ae9ce6 ioemu: Fix load of PCI-device IRQ state after save/restore. From: Ian Jackson Signed-off-by: Keir Fraser --- tools/ioemu/hw/pci.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 3a5750f4a738 -r f34f771f9ddd tools/ioemu/hw/pci.c --- a/tools/ioemu/hw/pci.c Mon May 19 09:40:53 2008 +0100 +++ b/tools/ioemu/hw/pci.c Mon May 19 09:42:18 2008 +0100 @@ -101,7 +101,7 @@ int pci_device_load(PCIDevice *s, QEMUFi int i; qemu_get_buffer(f, &irq_state, 1); for (i = 0; i < 4; i++) - pci_set_irq(s, i, !!(irq_state >> i)); + pci_set_irq(s, i, (irq_state >> i) & 1); } return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 19 04:40:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 19 May 2008 04:40:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jy3iy-0002KB-Ai for www-data@colo.xensource.com; Mon, 19 May 2008 04:40:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jy3jc-0002oA-3q; Mon, 19 May 2008 11:40:56 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jy3ja-0002ly-4A for xen-changelog@lists.xensource.com; Mon, 19 May 2008 11:40:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jy3jQ-0001NM-P9 for xen-changelog@lists.xensource.com; Mon, 19 May 2008 11:40:52 +0000 X-SBRS: 3.6 X-MesageID: 256549 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,508,1204520400"; d="scan'208";a="256549" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 19 May 2008 07:39:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4JBdpAo026415 for ; Mon, 19 May 2008 04:39:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4JBeArG031724 for ; Mon, 19 May 2008 04:40:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4JBeALn031723 for xen-changelog@lists.xensource.com; Mon, 19 May 2008 04:40:10 -0700 Message-Id: <200805191140.m4JBeALn031723@xenbits.xensource.com> Date: Mon, 19 May 2008 04:40:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Fix kexec reservation X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211186622 -3600 # Node ID e66aefdfedcca8319f7ecf9c8d742ae157c2d690 # Parent f34f771f9ddd86376dd5796709deb4608d871eb1 x86: Fix kexec reservation The reservation of space for the kexec area in kexec_reserve_area is incorrect. It specifies the start address and size to reserve_e820_mem when the args should be start and end. Bug found and fixed by Dave Anderson. Signed-off-by: Bill Burns --- xen/arch/x86/setup.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r f34f771f9ddd -r e66aefdfedcc xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Mon May 19 09:42:18 2008 +0100 +++ b/xen/arch/x86/setup.c Mon May 19 09:43:42 2008 +0100 @@ -362,7 +362,7 @@ void __init kexec_reserve_area(struct e8 is_reserved = 1; - if ( !reserve_e820_ram(e820, kdump_start, kdump_size) ) + if ( !reserve_e820_ram(e820, kdump_start, kdump_start + kdump_size) ) { printk("Kdump: DISABLED (failed to reserve %luMB (%lukB) at 0x%lx)" "\n", kdump_size >> 20, kdump_size >> 10, kdump_start); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 04:10:05 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 04:10:05 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyPjJ-0006Gw-HV for www-data@colo.xensource.com; Tue, 20 May 2008 04:10:05 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyPjx-0000z0-Ck; Tue, 20 May 2008 11:10:45 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyPjv-0000yi-UH for xen-changelog@lists.xensource.com; Tue, 20 May 2008 11:10:43 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyPjp-0008ND-7s for xen-changelog@lists.xensource.com; Tue, 20 May 2008 11:10:41 +0000 X-SBRS: 3.6 X-MesageID: 265887 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,515,1204520400"; d="scan'208";a="265887" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 07:09:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KB9otw029136 for ; Tue, 20 May 2008 04:09:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KBA8Sg016108 for ; Tue, 20 May 2008 04:10:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KBA8Gg016107 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 04:10:08 -0700 Message-Id: <200805201110.m4KBA8Gg016107@xenbits.xensource.com> Date: Tue, 20 May 2008 04:10:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix showing of CPU Affinity by xm vcpu-list X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211186762 -3600 # Node ID 8dce20be0bd5a4d3abaebb84b3c749e8d69bfb48 # Parent e66aefdfedcca8319f7ecf9c8d742ae157c2d690 Fix showing of CPU Affinity by xm vcpu-list Signed-off-by: Masaki Kanno --- tools/python/xen/xm/main.py | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r e66aefdfedcc -r 8dce20be0bd5 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Mon May 19 09:43:42 2008 +0100 +++ b/tools/python/xen/xm/main.py Mon May 19 09:46:02 2008 +0100 @@ -1096,7 +1096,7 @@ def xm_vcpu_list(args): # normalize cpumap by modulus nr_cpus, and drop duplicates cpumap = dict.fromkeys( - map(lambda x: x % nr_cpus, cpumap)).keys() + filter(lambda x: x < nr_cpus, cpumap)).keys() if len(cpumap) == nr_cpus: return "any cpu" _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 04:10:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 04:10:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyPjN-0006Hd-2j for www-data@colo.xensource.com; Tue, 20 May 2008 04:10:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyPk1-00012J-AW; Tue, 20 May 2008 11:10:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyPjy-0000yn-La for xen-changelog@lists.xensource.com; Tue, 20 May 2008 11:10:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyPjr-0008NE-Um for xen-changelog@lists.xensource.com; Tue, 20 May 2008 11:10:44 +0000 X-SBRS: 3.6 X-MesageID: 265888 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,515,1204520400"; d="scan'208";a="265888" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 07:09:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KB9pTl029139 for ; Tue, 20 May 2008 04:09:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KBA96D016127 for ; Tue, 20 May 2008 04:10:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KBA9Vl016126 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 04:10:09 -0700 Message-Id: <200805201110.m4KBA9Vl016126@xenbits.xensource.com> Date: Tue, 20 May 2008 04:10:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] svm: Better handling of NMI injection -- avoid nested NMIs. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211187806 -3600 # Node ID 2ada81810ddb73f29dfd1eb00de466eec2881ce6 # Parent 8dce20be0bd5a4d3abaebb84b3c749e8d69bfb48 svm: Better handling of NMI injection -- avoid nested NMIs. We do this by emulating the NMI mask which blocks NMI delivery until next IRET on native hardware. Signed-off-by: Gianluca Guida Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/svm/intr.c | 6 ++++++ xen/arch/x86/hvm/svm/svm.c | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff -r 8dce20be0bd5 -r 2ada81810ddb xen/arch/x86/hvm/svm/intr.c --- a/xen/arch/x86/hvm/svm/intr.c Mon May 19 09:46:02 2008 +0100 +++ b/xen/arch/x86/hvm/svm/intr.c Mon May 19 10:03:26 2008 +0100 @@ -51,6 +51,12 @@ static void svm_inject_nmi(struct vcpu * ASSERT(vmcb->eventinj.fields.v == 0); vmcb->eventinj = event; + + /* + * SVM does not virtualise the NMI mask, so we emulate it by intercepting + * the next IRET and blocking NMI injection until the intercept triggers. + */ + vmcb->general1_intercepts |= GENERAL1_INTERCEPT_IRET; } static void svm_inject_extint(struct vcpu *v, int vector) diff -r 8dce20be0bd5 -r 2ada81810ddb xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Mon May 19 09:46:02 2008 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Mon May 19 10:03:26 2008 +0100 @@ -367,15 +367,27 @@ static unsigned int svm_get_interrupt_sh static unsigned int svm_get_interrupt_shadow(struct vcpu *v) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; - return (vmcb->interrupt_shadow ? - (HVM_INTR_SHADOW_MOV_SS|HVM_INTR_SHADOW_STI) : 0); + unsigned int intr_shadow = 0; + + if ( vmcb->interrupt_shadow ) + intr_shadow |= HVM_INTR_SHADOW_MOV_SS | HVM_INTR_SHADOW_STI; + + if ( vmcb->general1_intercepts & GENERAL1_INTERCEPT_IRET ) + intr_shadow |= HVM_INTR_SHADOW_NMI; + + return intr_shadow; } static void svm_set_interrupt_shadow(struct vcpu *v, unsigned int intr_shadow) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; + vmcb->interrupt_shadow = !!(intr_shadow & (HVM_INTR_SHADOW_MOV_SS|HVM_INTR_SHADOW_STI)); + + vmcb->general1_intercepts &= ~GENERAL1_INTERCEPT_IRET; + if ( intr_shadow & HVM_INTR_SHADOW_NMI ) + vmcb->general1_intercepts |= GENERAL1_INTERCEPT_IRET; } static int svm_guest_x86_mode(struct vcpu *v) @@ -1266,6 +1278,15 @@ asmlinkage void svm_vmexit_handler(struc reason = TSW_call_or_int; if ( (vmcb->exitinfo2 >> 44) & 1 ) errcode = (uint32_t)vmcb->exitinfo2; + + /* + * Some processors set the EXITINTINFO field when the task switch + * is caused by a task gate in the IDT. In this case we will be + * emulating the event injection, so we do not want the processor + * to re-inject the original event! + */ + vmcb->eventinj.bytes = 0; + hvm_task_switch((uint16_t)vmcb->exitinfo1, reason, errcode); break; } @@ -1331,6 +1352,19 @@ asmlinkage void svm_vmexit_handler(struc svm_do_nested_pgfault(vmcb->exitinfo2, regs); break; + case VMEXIT_IRET: + /* + * IRET clears the NMI mask. However because we clear the mask + * /before/ executing IRET, we set the interrupt shadow to prevent + * a pending NMI from being injected immediately. This will work + * perfectly unless the IRET instruction faults: in that case we + * may inject an NMI before the NMI handler's IRET instruction is + * retired. + */ + vmcb->general1_intercepts &= ~GENERAL1_INTERCEPT_IRET; + vmcb->interrupt_shadow = 1; + break; + default: exit_and_crash: gdprintk(XENLOG_ERR, "unexpected VMEXIT: exit reason = 0x%x, " _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 04:10:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 04:10:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyPjP-0006Hg-Sg for www-data@colo.xensource.com; Tue, 20 May 2008 04:10:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyPk4-00015M-4Z; Tue, 20 May 2008 11:10:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyPk1-000111-3D for xen-changelog@lists.xensource.com; Tue, 20 May 2008 11:10:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyPju-0008ND-DD for xen-changelog@lists.xensource.com; Tue, 20 May 2008 11:10:46 +0000 X-SBRS: 3.6 X-MesageID: 265889 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,515,1204520400"; d="scan'208";a="265889" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 07:09:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KB9qwd029142 for ; Tue, 20 May 2008 04:09:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KBAAuu016144 for ; Tue, 20 May 2008 04:10:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KBAAB0016143 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 04:10:10 -0700 Message-Id: <200805201110.m4KBAAB0016143@xenbits.xensource.com> Date: Tue, 20 May 2008 04:10:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: Fix interpretation of missing or zero vfb videoram X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211272912 -3600 # Node ID 13dda75739f2ac18a4b33bc32432f0add9450557 # Parent 2ada81810ddb73f29dfd1eb00de466eec2881ce6 ioemu: Fix interpretation of missing or zero vfb videoram Changeset 17289:d97e61001d81: introduced vfb configuration parameter videoram, defaulting to zero. Value zero was interpreted as unlimited. Changeset 17630:53195719f762 accidentally dropped the special case for zero, which broke guests that don't specify videoram, or specify videoram=0. Restore the old behavior. Signed-off-by: Markus Armbruster --- tools/ioemu/hw/xenfb.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 2ada81810ddb -r 13dda75739f2 tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Mon May 19 10:03:26 2008 +0100 +++ b/tools/ioemu/hw/xenfb.c Tue May 20 09:41:52 2008 +0100 @@ -498,7 +498,7 @@ static int xenfb_configure_fb(struct xen fb_len_lim, fb_len_max); fb_len_lim = fb_len_max; } - if (fb_len > fb_len_lim) { + if (fb_len_lim && fb_len > fb_len_lim) { fprintf(stderr, "FB: frontend fb size %zu limited to %zu\n", fb_len, fb_len_lim); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 04:10:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 04:10:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyPjS-0006Hj-Qd for www-data@colo.xensource.com; Tue, 20 May 2008 04:10:15 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyPk7-00018f-1N; Tue, 20 May 2008 11:10:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyPk3-00012s-KW for xen-changelog@lists.xensource.com; Tue, 20 May 2008 11:10:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyPjw-0008NJ-Tf for xen-changelog@lists.xensource.com; Tue, 20 May 2008 11:10:49 +0000 X-SBRS: 3.6 X-MesageID: 265890 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,515,1204520400"; d="scan'208";a="265890" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 07:09:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KB9rK8029145 for ; Tue, 20 May 2008 04:09:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KBABFh016161 for ; Tue, 20 May 2008 04:10:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KBABMh016160 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 04:10:11 -0700 Message-Id: <200805201110.m4KBABMh016160@xenbits.xensource.com> Date: Tue, 20 May 2008 04:10:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xm migrate: Better error report when attempt to migrate non-running domain. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211272982 -3600 # Node ID 7c8e2a2c006ef5953ef9c50e1b5918c342ac8890 # Parent 13dda75739f2ac18a4b33bc32432f0add9450557 xm migrate: Better error report when attempt to migrate non-running domain. Signed-off-by: Masaki Kanno --- tools/python/xen/xend/XendDomain.py | 4 ++++ 1 files changed, 4 insertions(+) diff -r 13dda75739f2 -r 7c8e2a2c006e tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Tue May 20 09:41:52 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Tue May 20 09:43:02 2008 +0100 @@ -1282,6 +1282,10 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot migrate privileged domain %s" % domid) + if dominfo._stateGet() != DOM_STATE_RUNNING: + raise VMBadState("Domain is not running", + POWER_STATE_NAMES[DOM_STATE_RUNNING], + POWER_STATE_NAMES[dominfo._stateGet()]) """ The following call may raise a XendError exception """ dominfo.testMigrateDevices(True, dst) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:30:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:30:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTmz-0002S7-0p for www-data@colo.xensource.com; Tue, 20 May 2008 08:30:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnd-0006zx-5p; Tue, 20 May 2008 15:30:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnb-0006zX-65 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnT-0002zM-34 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:44 +0000 X-SBRS: 3.6 X-MesageID: 267619 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267619" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:29:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFTp2P029537 for ; Tue, 20 May 2008 08:29:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUA7P032208 for ; Tue, 20 May 2008 08:30:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFU9ih032207 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:09 -0700 Message-Id: <200805201530.m4KFU9ih032207@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] PAL virtualization services X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1208203185 21600 # Node ID 6cf504b4de7d117f2d6d5aeb66dd68ce4b6dcbee # Parent feee6422144f1a7b9caa91e178244214e8c2e14e [IA64] PAL virtualization services - pal_vps_resume_handler: bit 63 of r26 is used to indicate whether CFLE is set when resuming to guest - Add sync_read and sync_write per spec. - Use patching to reduce VPS call overhead Signed-off-by: Anthony Xu --- xen/arch/ia64/vmx/optvfault.S | 316 ++++++++++++++++++++++++------------- xen/arch/ia64/vmx/vmx_entry.S | 32 --- xen/arch/ia64/vmx/vmx_init.c | 27 +++ xen/arch/ia64/vmx/vmx_ivt.S | 9 - xen/arch/ia64/vmx/vmx_minstate.h | 14 - xen/include/asm-ia64/vmx_pal_vsa.h | 8 6 files changed, 256 insertions(+), 150 deletions(-) diff -r feee6422144f -r 6cf504b4de7d xen/arch/ia64/vmx/optvfault.S --- a/xen/arch/ia64/vmx/optvfault.S Tue Apr 01 11:29:03 2008 -0600 +++ b/xen/arch/ia64/vmx/optvfault.S Mon Apr 14 13:59:45 2008 -0600 @@ -31,6 +31,72 @@ // Inputs are: r21 (= current), r24 (= cause), r25 (= insn), r31 (=saved pr) +ENTRY(vmx_dummy_function) + br.sptk.many vmx_dummy_function +END(vmx_dummy_function) + +/* + * Inputs: + * r24 : return address + * r25 : vpd + * r29 : scratch + * + */ +GLOBAL_ENTRY(vmx_vps_sync_read) + movl r29 = vmx_dummy_function + ;; + mov b0=r29 + br.sptk.many b0 +END(vmx_vps_sync_read) + +/* + * Inputs: + * r24 : return address + * r25 : vpd + * r29 : scratch + * + */ +GLOBAL_ENTRY(vmx_vps_sync_write) + movl r29 = vmx_dummy_function + ;; + mov b0=r29 + br.sptk.many b0 +END(vmx_vps_sync_write) + +/* + * Inputs: + * r23 : pr + * r24 : guest b0 + * r25 : vpd + * + */ +GLOBAL_ENTRY(vmx_vps_resume_normal) + movl r29 = vmx_dummy_function + ;; + mov b0=r29 + mov pr=r23,-2 + br.sptk.many b0 +END(vmx_vps_resume_normal) + +/* + * Inputs: + * r23 : pr + * r24 : guest b0 + * r25 : vpd + * r17 : isr + */ +GLOBAL_ENTRY(vmx_vps_resume_handler) + movl r29 = vmx_dummy_function + ;; + ld8 r26=[r25] + shr r17=r17,IA64_ISR_IR_BIT + ;; + dep r26=r17,r26,63,1 // bit 63 of r26 indicate whether enable CFLE + mov b0=r29 + mov pr=r23,-2 + br.sptk.many b0 +END(vmx_vps_resume_handler) + //mov r1=ar3 (only itc is virtualized) GLOBAL_ENTRY(vmx_asm_mov_from_ar) @@ -185,6 +251,7 @@ GLOBAL_ENTRY(vmx_asm_rsm) #ifndef ACCE_RSM br.many vmx_virtualization_fault_back #endif + mov r23=r31 add r16=IA64_VPD_BASE_OFFSET,r21 extr.u r26=r25,6,21 // Imm21 extr.u r27=r25,31,2 // I2d @@ -194,47 +261,62 @@ GLOBAL_ENTRY(vmx_asm_rsm) dep r26=r27,r26,21,2 ;; add r17=VPD_VPSR_START_OFFSET,r16 - add r22=IA64_VCPU_MMU_MODE_OFFSET,r21 - //r26 is imm24 - dep r26=r28,r26,23,1 - ;; - ld8 r18=[r17] - + //r18 is imm24 + dep r18=r28,r26,23,1 + ;; + //sync read + mov r25=r16 + movl r24=vmx_asm_rsm_sync_read_return + mov r20=b0 + br.sptk.many vmx_vps_sync_read + ;; +vmx_asm_rsm_sync_read_return: + ld8 r26=[r17] // xenoprof // Don't change mPSR.pp. // It is manipulated by xenoprof. movl r28=IA64_PSR_IC+IA64_PSR_I+IA64_PSR_DT+IA64_PSR_SI+IA64_PSR_PP - ld1 r23=[r22] - sub r27=-1,r26 // ~r26 - mov r24=b0 - ;; - mov r20=cr.ipsr + sub r27=-1,r18 // ~imm24 + ;; or r28=r27,r28 // Keep IC,I,DT,SI - and r19=r18,r27 // Update vpsr - ;; + and r19=r26,r27 // Update vpsr + ;; st8 [r17]=r19 - and r20=r20,r28 // Update ipsr + mov r24=cr.ipsr + ;; + and r24=r24,r28 // Update ipsr adds r27=IA64_VCPU_FP_PSR_OFFSET,r21 ;; ld8 r27=[r27] ;; tbit.nz p8,p0=r27,IA64_PSR_DFH_BIT ;; - (p8) dep r20=-1,r20,IA64_PSR_DFH_BIT,1 // Keep dfh - ;; - mov cr.ipsr=r20 - cmp.ne p6,p0=VMX_MMU_VIRTUAL,r23 - ;; - tbit.z.or p6,p0=r26,IA64_PSR_DT_BIT - (p6) br.dptk vmx_resume_to_guest // DT not cleared or already in phy mode + (p8) dep r24=-1,r24,IA64_PSR_DFH_BIT,1 // Keep dfh + ;; + mov cr.ipsr=r24 + //sync write + mov r25=r16 + movl r24=vmx_asm_rsm_sync_write_return + br.sptk.many vmx_vps_sync_write + ;; +vmx_asm_rsm_sync_write_return: + add r29=IA64_VCPU_MMU_MODE_OFFSET,r21 + ;; + ld1 r27=[r29] + ;; + cmp.ne p6,p0=VMX_MMU_VIRTUAL,r27 + ;; + tbit.z.or p6,p0=r18,IA64_PSR_DT_BIT + (p6) br.dptk vmx_asm_rsm_out + // DT not cleared or already in phy mode ;; // Switch to meta physical mode D. add r26=IA64_VCPU_META_RID_D_OFFSET,r21 - mov r23=VMX_MMU_PHY_D + mov r27=VMX_MMU_PHY_D ;; ld8 r26=[r26] - st1 [r22]=r23 + st1 [r29]=r27 dep.z r28=4,61,3 ;; mov rr[r0]=r26 @@ -242,6 +324,9 @@ GLOBAL_ENTRY(vmx_asm_rsm) mov rr[r28]=r26 ;; srlz.d +vmx_asm_rsm_out: + mov r31=r23 + mov r24=r20 br.many vmx_resume_to_guest END(vmx_asm_rsm) @@ -251,6 +336,7 @@ GLOBAL_ENTRY(vmx_asm_ssm) #ifndef ACCE_SSM br.many vmx_virtualization_fault_back #endif + mov r23=r31 add r16=IA64_VPD_BASE_OFFSET,r21 extr.u r26=r25,6,21 extr.u r27=r25,31,2 @@ -258,40 +344,55 @@ GLOBAL_ENTRY(vmx_asm_ssm) ld8 r16=[r16] extr.u r28=r25,36,1 dep r26=r27,r26,21,2 - ;; //r26 is imm24 + ;; //r18 is imm24 + dep r18=r28,r26,23,1 + ;; + //sync read + mov r25=r16 + movl r24=vmx_asm_ssm_sync_read_return + mov r20=b0 + br.sptk.many vmx_vps_sync_read + ;; +vmx_asm_ssm_sync_read_return: add r27=VPD_VPSR_START_OFFSET,r16 - dep r26=r28,r26,23,1 - ;; //r19 vpsr - ld8 r29=[r27] - mov r24=b0 - dep r17=0,r26,IA64_PSR_PP_BIT,1 // For xenoprof + ;; + ld8 r17=[r27] //r17 old vpsr + dep r28=0,r18,IA64_PSR_PP_BIT,1 // For xenoprof // Don't change mPSR.pp // It is maintained by xenoprof. ;; - add r22=IA64_VCPU_MMU_MODE_OFFSET,r21 - mov r20=cr.ipsr - or r19=r29,r26 - ;; - ld1 r23=[r22] // mmu_mode - st8 [r27]=r19 // vpsr - or r20=r20,r17 - ;; - mov cr.ipsr=r20 + or r19=r17,r18 //r19 new vpsr + ;; + st8 [r27]=r19 // update vpsr + mov r24=cr.ipsr + ;; + or r24=r24,r28 + ;; + mov cr.ipsr=r24 + //sync_write + mov r25=r16 + movl r24=vmx_asm_ssm_sync_write_return + br.sptk.many vmx_vps_sync_write + ;; +vmx_asm_ssm_sync_write_return: + add r29=IA64_VCPU_MMU_MODE_OFFSET,r21 movl r28=IA64_PSR_DT+IA64_PSR_RT+IA64_PSR_IT ;; - and r19=r28,r19 - cmp.eq p6,p0=VMX_MMU_VIRTUAL,r23 - ;; - cmp.ne.or p6,p0=r28,r19 // (vpsr & (it+dt+rt)) /= (it+dt+rt) ie stay in phy + ld1 r30=[r29] // mmu_mode + ;; + and r27=r28,r19 + cmp.eq p6,p0=VMX_MMU_VIRTUAL,r30 + ;; + cmp.ne.or p6,p0=r28,r27 // (vpsr & (it+dt+rt)) /= (it+dt+rt) ie stay in phy (p6) br.dptk vmx_asm_ssm_1 ;; add r26=IA64_VCPU_META_SAVED_RR0_OFFSET,r21 add r27=IA64_VCPU_META_SAVED_RR0_OFFSET+8,r21 - mov r23=VMX_MMU_VIRTUAL + mov r30=VMX_MMU_VIRTUAL ;; ld8 r26=[r26] ld8 r27=[r27] - st1 [r22]=r23 + st1 [r29]=r30 dep.z r28=4,61,3 ;; mov rr[r0]=r26 @@ -301,10 +402,10 @@ GLOBAL_ENTRY(vmx_asm_ssm) srlz.d ;; vmx_asm_ssm_1: - tbit.nz p6,p0=r29,IA64_PSR_I_BIT + tbit.nz p6,p0=r17,IA64_PSR_I_BIT ;; tbit.z.or p6,p0=r19,IA64_PSR_I_BIT - (p6) br.dptk vmx_resume_to_guest + (p6) br.dptk vmx_asm_ssm_out ;; add r29=VPD_VTPR_START_OFFSET,r16 add r30=VPD_VHPI_START_OFFSET,r16 @@ -316,9 +417,14 @@ vmx_asm_ssm_1: extr.u r18=r29,16,1 ;; dep r17=r18,r17,4,1 + mov r31=r23 + mov b0=r20 ;; cmp.gt p6,p0=r30,r17 (p6) br.dpnt.few vmx_asm_dispatch_vexirq +vmx_asm_ssm_out: + mov r31=r23 + mov r24=r20 br.many vmx_resume_to_guest END(vmx_asm_ssm) @@ -328,33 +434,47 @@ GLOBAL_ENTRY(vmx_asm_mov_to_psr) #ifndef ACCE_MOV_TO_PSR br.many vmx_virtualization_fault_back #endif + mov r23=r31 add r16=IA64_VPD_BASE_OFFSET,r21 extr.u r26=r25,13,7 //r2 ;; ld8 r16=[r16] - movl r20=asm_mov_from_reg - ;; - adds r30=vmx_asm_mov_to_psr_back-asm_mov_from_reg,r20 - shladd r26=r26,4,r20 - mov r24=b0 - ;; - add r27=VPD_VPSR_START_OFFSET,r16 + movl r24=asm_mov_from_reg + ;; + adds r30=vmx_asm_mov_to_psr_back-asm_mov_from_reg,r24 + shladd r26=r26,4,r24 + mov r20=b0 + ;; mov b0=r26 br.many b0 ;; vmx_asm_mov_to_psr_back: - ld8 r17=[r27] // vpsr - add r22=IA64_VCPU_MMU_MODE_OFFSET,r21 + //sync read + mov r25=r16 + movl r24=vmx_asm_mov_to_psr_sync_read_return + br.sptk.many vmx_vps_sync_read + ;; +vmx_asm_mov_to_psr_sync_read_return: + add r27=VPD_VPSR_START_OFFSET,r16 + ;; + ld8 r17=[r27] // r17 old vpsr dep r19=0,r19,32,32 // Clear bits 32-63 ;; - ld1 r23=[r22] // mmu_mode dep r18=0,r17,0,32 ;; - or r30=r18,r19 + or r18=r18,r19 //r18 new vpsr + ;; + st8 [r27]=r18 // set vpsr + //sync write + mov r25=r16 + movl r24=vmx_asm_mov_to_psr_sync_write_return + br.sptk.many vmx_vps_sync_write + ;; +vmx_asm_mov_to_psr_sync_write_return: + add r22=IA64_VCPU_MMU_MODE_OFFSET,r21 movl r28=IA64_PSR_DT+IA64_PSR_RT+IA64_PSR_IT ;; - st8 [r27]=r30 // set vpsr - and r27=r28,r30 + and r27=r28,r18 and r29=r28,r17 ;; cmp.eq p5,p0=r29,r27 // (old_vpsr & (dt+rt+it)) == (new_vpsr & (dt+rt+it)) @@ -364,16 +484,16 @@ vmx_asm_mov_to_psr_back: //virtual to physical D (p7) add r26=IA64_VCPU_META_RID_D_OFFSET,r21 (p7) add r27=IA64_VCPU_META_RID_D_OFFSET,r21 - (p7) mov r23=VMX_MMU_PHY_D + (p7) mov r30=VMX_MMU_PHY_D ;; //physical to virtual (p6) add r26=IA64_VCPU_META_SAVED_RR0_OFFSET,r21 (p6) add r27=IA64_VCPU_META_SAVED_RR0_OFFSET+8,r21 - (p6) mov r23=VMX_MMU_VIRTUAL + (p6) mov r30=VMX_MMU_VIRTUAL ;; ld8 r26=[r26] ld8 r27=[r27] - st1 [r22]=r23 + st1 [r22]=r30 dep.z r28=4,61,3 ;; mov rr[r0]=r26 @@ -383,18 +503,17 @@ vmx_asm_mov_to_psr_back: srlz.d ;; vmx_asm_mov_to_psr_1: - mov r20=cr.ipsr + mov r24=cr.ipsr movl r28=IA64_PSR_IC+IA64_PSR_I+IA64_PSR_DT+IA64_PSR_SI+IA64_PSR_RT ;; - tbit.nz p7,p0=r20,IA64_PSR_PP_BIT // For xenoprof - or r19=r19,r28 - dep r20=0,r20,0,32 - ;; - add r20=r19,r20 - mov b0=r24 + tbit.nz p7,p0=r24,IA64_PSR_PP_BIT // For xenoprof + or r27=r19,r28 + dep r24=0,r24,0,32 + ;; + add r24=r27,r24 ;; adds r27=IA64_VCPU_FP_PSR_OFFSET,r21 - (p7) dep r20=-1,r20,IA64_PSR_PP_BIT,1 // For xenoprof + (p7) dep r24=-1,r24,IA64_PSR_PP_BIT,1 // For xenoprof // Dom't change mPSR.pp // It is maintaned by xenoprof ;; @@ -402,14 +521,13 @@ vmx_asm_mov_to_psr_1: ;; tbit.nz p8,p0=r27,IA64_PSR_DFH_BIT ;; - (p8) dep r20=-1,r20,IA64_PSR_DFH_BIT,1 - ;; - mov cr.ipsr=r20 - cmp.ne p6,p0=r0,r0 - ;; - tbit.nz.or p6,p0=r17,IA64_PSR_I_BIT - tbit.z.or p6,p0=r30,IA64_PSR_I_BIT - (p6) br.dpnt.few vmx_resume_to_guest + (p8) dep r24=-1,r24,IA64_PSR_DFH_BIT,1 + ;; + mov cr.ipsr=r24 + tbit.nz p6,p0=r17,IA64_PSR_I_BIT + ;; + tbit.z.or p6,p0=r18,IA64_PSR_I_BIT + (p6) br.dpnt.few vmx_asm_mov_to_psr_out ;; add r29=VPD_VTPR_START_OFFSET,r16 add r30=VPD_VHPI_START_OFFSET,r16 @@ -421,9 +539,14 @@ vmx_asm_mov_to_psr_1: extr.u r18=r29,16,1 ;; dep r17=r18,r17,4,1 + mov r31=r23 + mov b0=r20 ;; cmp.gt p6,p0=r30,r17 (p6) br.dpnt.few vmx_asm_dispatch_vexirq +vmx_asm_mov_to_psr_out: + mov r31=r23 + mov r24=r20 br.many vmx_resume_to_guest END(vmx_asm_mov_to_psr) @@ -767,40 +890,25 @@ END(asm_mov_from_reg) */ ENTRY(vmx_resume_to_guest) mov r16=cr.ipsr - movl r20=__vsa_base - ;; - ld8 r20=[r20] + ;; adds r19=IA64_VPD_BASE_OFFSET,r21 + extr.u r17=r16,IA64_PSR_RI_BIT,2 ;; ld8 r25=[r19] - extr.u r17=r16,IA64_PSR_RI_BIT,2 - tbit.nz p6,p7=r16,IA64_PSR_RI_BIT+1 - ;; - (p6) mov r18=cr.iip - (p6) mov r17=r0 - ;; - (p6) add r18=0x10,r18 - (p7) add r17=1,r17 - ;; - (p6) mov cr.iip=r18 + add r17=1,r17 + ;; + adds r19= VPD_VPSR_START_OFFSET,r25 dep r16=r17,r16,IA64_PSR_RI_BIT,2 ;; mov cr.ipsr=r16 - adds r19= VPD_VPSR_START_OFFSET,r25 - add r28=PAL_VPS_RESUME_NORMAL,r20 - add r29=PAL_VPS_RESUME_HANDLER,r20 - ;; ld8 r19=[r19] - mov b0=r29 - cmp.ne p6,p7 = r0,r0 - ;; + ;; + mov r23=r31 + mov r17=r0 + //vps_resume_normal/handler tbit.z p6,p7 = r19,IA64_PSR_IC_BIT // p1=vpsr.ic - ;; - (p6) ld8 r26=[r25] - (p7) mov b0=r28 - mov pr=r31,-2 - br.sptk.many b0 // call pal service - ;; + (p6) br.cond.sptk.many vmx_vps_resume_handler + (p7) br.cond.sptk.few vmx_vps_resume_normal END(vmx_resume_to_guest) diff -r feee6422144f -r 6cf504b4de7d xen/arch/ia64/vmx/vmx_entry.S --- a/xen/arch/ia64/vmx/vmx_entry.S Tue Apr 01 11:29:03 2008 -0600 +++ b/xen/arch/ia64/vmx/vmx_entry.S Mon Apr 14 13:59:45 2008 -0600 @@ -370,20 +370,16 @@ vmx_rse_clear_invalid: adds r19=VPD(VPSR),r18 ;; ld8 r19=[r19] //vpsr - movl r20=__vsa_base ;; //vsa_sync_write_start - ld8 r20=[r20] // read entry point + movl r24=ia64_vmm_entry // calculate return address mov r25=r18 - ;; - movl r24=ia64_vmm_entry // calculate return address - add r16=PAL_VPS_SYNC_WRITE,r20 - ;; - mov b0=r16 - br.cond.sptk b0 // call the service + br.sptk.many vmx_vps_sync_write // call the service ;; END(ia64_leave_hypervisor) // fall through + + GLOBAL_ENTRY(ia64_vmm_entry) /* * must be at bank 0 @@ -391,30 +387,16 @@ GLOBAL_ENTRY(ia64_vmm_entry) * r17:cr.isr * r18:vpd * r19:vpsr - * r20:__vsa_base * r22:b0 * r23:predicate */ mov r24=r22 mov r25=r18 tbit.nz p1,p2 = r19,IA64_PSR_IC_BIT // p1=vpsr.ic - ;; - (p1) add r29=PAL_VPS_RESUME_NORMAL,r20 - (p1) br.sptk.many ia64_vmm_entry_out - ;; - tbit.nz p1,p2 = r17,IA64_ISR_IR_BIT //p1=cr.isr.ir - ;; - (p1) add r29=PAL_VPS_RESUME_NORMAL,r20 - (p2) add r29=PAL_VPS_RESUME_HANDLER,r20 - (p2) ld8 r26=[r25] - ;; -ia64_vmm_entry_out: - mov pr=r23,-2 - mov b0=r29 - ;; - br.cond.sptk b0 // call pal service + (p1) br.cond.sptk.few vmx_vps_resume_normal + (p2) br.cond.sptk.many vmx_vps_resume_handler + ;; END(ia64_vmm_entry) - /* diff -r feee6422144f -r 6cf504b4de7d xen/arch/ia64/vmx/vmx_init.c --- a/xen/arch/ia64/vmx/vmx_init.c Tue Apr 01 11:29:03 2008 -0600 +++ b/xen/arch/ia64/vmx/vmx_init.c Mon Apr 14 13:59:45 2008 -0600 @@ -54,6 +54,7 @@ #include #include #include +#include #include "entry.h" /* Global flag to identify whether Intel vmx feature is on */ @@ -64,6 +65,28 @@ u64 __vsa_base = 0; /* Run-time service u64 __vsa_base = 0; /* Run-time service base of VMX */ /* Check whether vt feature is enabled or not. */ + +void vmx_vps_patch(void) +{ + u64 addr; + + addr = (u64)&vmx_vps_sync_read; + ia64_patch_imm64(addr, __vsa_base+PAL_VPS_SYNC_READ); + ia64_fc((void *)addr); + addr = (u64)&vmx_vps_sync_write; + ia64_patch_imm64(addr, __vsa_base+PAL_VPS_SYNC_WRITE); + ia64_fc((void *)addr); + addr = (u64)&vmx_vps_resume_normal; + ia64_patch_imm64(addr, __vsa_base+PAL_VPS_RESUME_NORMAL); + ia64_fc((void *)addr); + addr = (u64)&vmx_vps_resume_handler; + ia64_patch_imm64(addr, __vsa_base+PAL_VPS_RESUME_HANDLER); + ia64_fc((void *)addr); + ia64_sync_i(); + ia64_srlz_i(); +} + + void identify_vmx_feature(void) { @@ -152,8 +175,10 @@ vmx_init_env(void *start, unsigned long return start; } - if (!__vsa_base) + if (!__vsa_base){ __vsa_base = tmp_base; + vmx_vps_patch(); + } else ASSERT(tmp_base == __vsa_base); diff -r feee6422144f -r 6cf504b4de7d xen/arch/ia64/vmx/vmx_ivt.S --- a/xen/arch/ia64/vmx/vmx_ivt.S Tue Apr 01 11:29:03 2008 -0600 +++ b/xen/arch/ia64/vmx/vmx_ivt.S Mon Apr 14 13:59:45 2008 -0600 @@ -211,11 +211,8 @@ vmx_itlb_loop: ld8 r18=[r16] ;; adds r19=VPD(VPSR),r18 - movl r20=__vsa_base ;; ld8 r19=[r19] - ld8 r20=[r20] - ;; br.sptk ia64_vmm_entry ;; vmx_itlb_out: @@ -289,11 +286,8 @@ vmx_dtlb_loop: ld8 r18=[r16] ;; adds r19=VPD(VPSR),r18 - movl r20=__vsa_base ;; ld8 r19=[r19] - ld8 r20=[r20] - ;; br.sptk ia64_vmm_entry ;; vmx_dtlb_out: @@ -461,11 +455,8 @@ dirty_bit_tpa_fail: ld8 r18=[r16] ;; adds r19=VPD(VPSR),r18 - movl r20=__vsa_base ;; ld8 r19=[r19] - ld8 r20=[r20] - ;; br.sptk ia64_vmm_entry ;; END(vmx_dirty_bit) diff -r feee6422144f -r 6cf504b4de7d xen/arch/ia64/vmx/vmx_minstate.h --- a/xen/arch/ia64/vmx/vmx_minstate.h Tue Apr 01 11:29:03 2008 -0600 +++ b/xen/arch/ia64/vmx/vmx_minstate.h Mon Apr 14 13:59:45 2008 -0600 @@ -57,24 +57,16 @@ #define PAL_VSA_SYNC_READ \ /* begin to call pal vps sync_read */ \ +{ .mii; \ (pUStk) add r25=IA64_VPD_BASE_OFFSET, r21; \ -(pUStk) movl r20=__vsa_base; \ - ;; \ -(pUStk) ld8 r25=[r25]; /* read vpd base */ \ -(pUStk) ld8 r20=[r20]; /* read entry point */ \ - ;; \ -(pUStk) add r20=PAL_VPS_SYNC_READ,r20; \ - ;; \ -{ .mii; \ (pUStk) nop 0x0; \ (pUStk) mov r24=ip; \ -(pUStk) mov b0=r20; \ ;; \ }; \ { .mmb; \ (pUStk) add r24 = 0x20, r24; \ -(pUStk) nop 0x0; \ -(pUStk) br.cond.sptk b0; /* call the service */ \ +(pUStk) ld8 r25=[r25]; /* read vpd base */ \ +(pUStk) br.cond.sptk vmx_vps_sync_read; /* call the service */ \ ;; \ }; diff -r feee6422144f -r 6cf504b4de7d xen/include/asm-ia64/vmx_pal_vsa.h --- a/xen/include/asm-ia64/vmx_pal_vsa.h Tue Apr 01 11:29:03 2008 -0600 +++ b/xen/include/asm-ia64/vmx_pal_vsa.h Mon Apr 14 13:59:45 2008 -0600 @@ -28,6 +28,14 @@ #ifndef __ASSEMBLY__ extern u64 ia64_call_vsa(u64 proc, u64 arg1, u64 arg2, u64 arg3, u64 arg4, u64 arg5, u64 arg6, u64 arg7); + +/* entry points in assembly code for calling vps services */ + +extern char vmx_vps_sync_read; +extern char vmx_vps_sync_write; +extern char vmx_vps_resume_normal; +extern char vmx_vps_resume_handler; + extern u64 __vsa_base; #endif /* __ASSEMBLY__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:30:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:30:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTn3-0002SF-3w for www-data@colo.xensource.com; Tue, 20 May 2008 08:30:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnh-00073L-DU; Tue, 20 May 2008 15:30:53 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTne-0006zc-FP for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnY-0002zQ-74 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:48 +0000 X-SBRS: 3.6 X-MesageID: 267620 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267620" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:29:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFTqc9029540 for ; Tue, 20 May 2008 08:29:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUBYW032225 for ; Tue, 20 May 2008 08:30:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUBkk032224 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:11 -0700 Message-Id: <200805201530.m4KFUBkk032224@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] Install missing ia64 hvm public headers. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1208203498 21600 # Node ID c0f77a6575475a1e6aa29ea4ed9f25893b8f19a0 # Parent 6cf504b4de7d117f2d6d5aeb66dd68ce4b6dcbee [IA64] Install missing ia64 hvm public headers. Signed-off-by: Kouya Shimura --- tools/include/Makefile | 2 ++ 1 files changed, 2 insertions(+) diff -r 6cf504b4de7d -r c0f77a657547 tools/include/Makefile --- a/tools/include/Makefile Mon Apr 14 13:59:45 2008 -0600 +++ b/tools/include/Makefile Mon Apr 14 14:04:58 2008 -0600 @@ -21,6 +21,7 @@ xen/.dir: .PHONY: install install: all $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/arch-ia64 + $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/arch-ia64/hvm $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/arch-x86 $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/arch-x86/hvm $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xen/foreign @@ -31,6 +32,7 @@ install: all $(INSTALL_DATA) xen/COPYING $(DESTDIR)$(INCLUDEDIR)/xen $(INSTALL_DATA) xen/*.h $(DESTDIR)$(INCLUDEDIR)/xen $(INSTALL_DATA) xen/arch-ia64/*.h $(DESTDIR)$(INCLUDEDIR)/xen/arch-ia64 + $(INSTALL_DATA) xen/arch-ia64/hvm/*.h $(DESTDIR)$(INCLUDEDIR)/xen/arch-ia64/hvm $(INSTALL_DATA) xen/arch-x86/*.h $(DESTDIR)$(INCLUDEDIR)/xen/arch-x86 $(INSTALL_DATA) xen/arch-x86/hvm/*.h $(DESTDIR)$(INCLUDEDIR)/xen/arch-x86/hvm $(INSTALL_DATA) xen/foreign/*.h $(DESTDIR)$(INCLUDEDIR)/xen/foreign _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:30:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:30:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTn5-0002SI-W4 for www-data@colo.xensource.com; Tue, 20 May 2008 08:30:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnk-00076E-7Q; Tue, 20 May 2008 15:30:56 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnf-00070p-JK for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnZ-0002zM-8e for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:49 +0000 X-SBRS: 3.6 X-MesageID: 267625 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267625" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:29:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFTwK2029549 for ; Tue, 20 May 2008 08:29:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUGle032276 for ; Tue, 20 May 2008 08:30:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUGKU032275 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:16 -0700 Message-Id: <200805201530.m4KFUGKU032275@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] Fix virtualized EFI memory mapping creation for dom0. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1209067336 21600 # Node ID 239b44eeb2d6d235ddee581b6e89398c80278a2f # Parent 1fbc9073a566630a93b3e16a2121b8a1cab9fd41 [IA64] Fix virtualized EFI memory mapping creation for dom0. EFI uses 4k page, while xen uses 16k page. For dom0, identity mappings are setup for EFI_ACPI_RECLAIM_MEMORY etc. It is possible when seting up dom0 memory ranges to include some EFI_ACPI_RECLAIM_MEMORY ranges due to 4k/16k alignment difference. This patch fixes this issue by scaning memory descriptors twice. In the first scan, setup dom0 identity mapping. In the second scan, setup dom0 memory mapping. Signed-off-by: Anthony Xu --- xen/arch/ia64/xen/dom_fw_dom0.c | 120 ++++++++++++++++++++++++++-------------- 1 files changed, 78 insertions(+), 42 deletions(-) diff -r 1fbc9073a566 -r 239b44eeb2d6 xen/arch/ia64/xen/dom_fw_dom0.c --- a/xen/arch/ia64/xen/dom_fw_dom0.c Tue Apr 15 11:15:20 2008 -0600 +++ b/xen/arch/ia64/xen/dom_fw_dom0.c Thu Apr 24 14:02:16 2008 -0600 @@ -352,6 +352,15 @@ complete_dom0_memmap(struct domain *d, s efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size; efi_desc_size = ia64_boot_param->efi_memdesc_size; + + /* EFI memory descriptor is using 4k page, while xen is using 16k page. + * To avoid identity mapping for EFI_ACPI_RECLAIM_MEMORY etc. being + * blocked by WB mapping, scan memory descriptor twice. + * First: setup identity mapping for EFI_ACPI_RECLAIM_MEMORY etc. + * Second: setup mapping for EFI_CONVENTIONAL_MEMORY etc. + */ + + /* first scan, setup identity mapping for EFI_ACPI_RECLAIM_MEMORY etc. */ for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { const efi_memory_desc_t *md = p; efi_memory_desc_t *dom_md = &tables->efi_memmap[tables->num_mds]; @@ -415,48 +424,8 @@ complete_dom0_memmap(struct domain *d, s case EFI_LOADER_CODE: case EFI_LOADER_DATA: case EFI_BOOT_SERVICES_CODE: - case EFI_BOOT_SERVICES_DATA: { - u64 dom_md_start; - u64 dom_md_end; - unsigned long left_mem = - (unsigned long)(d->max_pages - d->tot_pages) << - PAGE_SHIFT; - - if (!(md->attribute & EFI_MEMORY_WB)) - break; - - dom_md_start = max(tables->fw_end_paddr, start); - dom_md_end = dom_md_start; - do { - dom_md_end = min(dom_md_end + left_mem, end); - if (dom_md_end < dom_md_start + PAGE_SIZE) - break; - - dom_md->type = EFI_CONVENTIONAL_MEMORY; - dom_md->phys_addr = dom_md_start; - dom_md->virt_addr = 0; - dom_md->num_pages = - (dom_md_end - dom_md_start) >> - EFI_PAGE_SHIFT; - dom_md->attribute = EFI_MEMORY_WB; - - assign_new_domain0_range(d, dom_md); - /* - * recalculate left_mem. - * we might already allocated memory in - * this region because of kernel loader. - * So we might consumed less than - * (dom_md_end - dom_md_start) above. - */ - left_mem = (unsigned long) - (d->max_pages - d->tot_pages) << - PAGE_SHIFT; - } while (left_mem > 0 && dom_md_end < end); - - if (!(dom_md_end < dom_md_start + PAGE_SIZE)) - tables->num_mds++; - break; - } + case EFI_BOOT_SERVICES_DATA: + break; case EFI_UNUSABLE_MEMORY: case EFI_PAL_CODE: @@ -479,6 +448,73 @@ complete_dom0_memmap(struct domain *d, s "unhandled MDT entry type %u\n", md->type); } } + + + /* secend scan, setup mapping for EFI_CONVENTIONAL_MEMORY etc. */ + for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { + const efi_memory_desc_t *md = p; + efi_memory_desc_t *dom_md = &tables->efi_memmap[tables->num_mds]; + u64 start = md->phys_addr; + u64 size = md->num_pages << EFI_PAGE_SHIFT; + u64 end = start + size; + u64 mpaddr; + unsigned long flags; + + switch (md->type) { + + case EFI_CONVENTIONAL_MEMORY: + case EFI_LOADER_CODE: + case EFI_LOADER_DATA: + case EFI_BOOT_SERVICES_CODE: + case EFI_BOOT_SERVICES_DATA: { + u64 dom_md_start; + u64 dom_md_end; + unsigned long left_mem = + (unsigned long)(d->max_pages - d->tot_pages) << + PAGE_SHIFT; + + if (!(md->attribute & EFI_MEMORY_WB)) + break; + + dom_md_start = max(tables->fw_end_paddr, start); + dom_md_end = dom_md_start; + do { + dom_md_end = min(dom_md_end + left_mem, end); + if (dom_md_end < dom_md_start + PAGE_SIZE) + break; + + dom_md->type = EFI_CONVENTIONAL_MEMORY; + dom_md->phys_addr = dom_md_start; + dom_md->virt_addr = 0; + dom_md->num_pages = + (dom_md_end - dom_md_start) >> + EFI_PAGE_SHIFT; + dom_md->attribute = EFI_MEMORY_WB; + + assign_new_domain0_range(d, dom_md); + /* + * recalculate left_mem. + * we might already allocated memory in + * this region because of kernel loader. + * So we might consumed less than + * (dom_md_end - dom_md_start) above. + */ + left_mem = (unsigned long) + (d->max_pages - d->tot_pages) << + PAGE_SHIFT; + } while (left_mem > 0 && dom_md_end < end); + + if (!(dom_md_end < dom_md_start + PAGE_SIZE)) + tables->num_mds++; + break; + } + + + default: + break; + } + } + BUG_ON(tables->fw_tables_size < sizeof(*tables) + sizeof(tables->efi_memmap[0]) * tables->num_mds); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:30:22 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:30:22 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTnC-0002SL-8e for www-data@colo.xensource.com; Tue, 20 May 2008 08:30:22 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnq-0007B3-EV; Tue, 20 May 2008 15:31:02 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTng-000728-SG for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnZ-0002zS-1b for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:50 +0000 X-SBRS: 3.6 X-MesageID: 267622 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267622" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:29:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFTvhZ029546 for ; Tue, 20 May 2008 08:29:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUFs7032259 for ; Tue, 20 May 2008 08:30:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUFWa032258 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:15 -0700 Message-Id: <200805201530.m4KFUFWa032258@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] xencomm: fix dirty page leak X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1208279720 21600 # Node ID 1fbc9073a566630a93b3e16a2121b8a1cab9fd41 # Parent 2b3d3aaf8be4395144414d4a1d9e4799e5485cab [IA64] xencomm: fix dirty page leak This patch fixes a dirty page leak for live migration. This is the architecture counter part of 146f214a0e63. Signed-off-by: Kouya Shimura --- xen/arch/ia64/xen/mm.c | 14 ++++++++++++++ xen/include/asm-ia64/config.h | 2 ++ 2 files changed, 16 insertions(+) diff -r 2b3d3aaf8be4 -r 1fbc9073a566 xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Tue Apr 15 11:09:46 2008 -0600 +++ b/xen/arch/ia64/xen/mm.c Tue Apr 15 11:15:20 2008 -0600 @@ -2903,6 +2903,20 @@ int is_iomem_page(unsigned long mfn) return (!mfn_valid(mfn) || (page_get_owner(mfn_to_page(mfn)) == dom_io)); } +void xencomm_mark_dirty(unsigned long addr, unsigned int len) +{ + struct domain *d = current->domain; + unsigned long gpfn; + unsigned long end_addr = addr + len; + + if (shadow_mode_enabled(d)) { + for (addr &= PAGE_MASK; addr < end_addr; addr += PAGE_SIZE) { + gpfn = get_gpfn_from_mfn(virt_to_mfn(addr)); + shadow_mark_page_dirty(d, gpfn); + } + } +} + /* * Local variables: * mode: C diff -r 2b3d3aaf8be4 -r 1fbc9073a566 xen/include/asm-ia64/config.h --- a/xen/include/asm-ia64/config.h Tue Apr 15 11:09:46 2008 -0600 +++ b/xen/include/asm-ia64/config.h Tue Apr 15 11:15:20 2008 -0600 @@ -291,4 +291,6 @@ struct screen_info { }; /* Define CONFIG_PRIVIFY to support privified OS (deprecated). */ #undef CONFIG_PRIVIFY +#define CONFIG_XENCOMM_MARK_DIRTY 1 + #endif /* _IA64_CONFIG_H_ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:30:26 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:30:26 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTnG-0002SO-6a for www-data@colo.xensource.com; Tue, 20 May 2008 08:30:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnu-0007EO-D0; Tue, 20 May 2008 15:31:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnk-00074s-Kw for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTne-0002zM-2V for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:54 +0000 X-SBRS: 3.6 X-MesageID: 267627 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267627" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:01 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFU1MY029555 for ; Tue, 20 May 2008 08:30:01 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUJrr032310 for ; Tue, 20 May 2008 08:30:19 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUJkV032309 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:19 -0700 Message-Id: <200805201530.m4KFUJkV032309@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:19 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] fix GNTTABOP_replace_and_unmap X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1209122032 -32400 # Node ID f2457c7aff8d45949bc2c83876a7d26d0588663f # Parent dc510776dd598f3f479af749865bec225e32634d [IA64] fix GNTTABOP_replace_and_unmap This patch fixes the following xen panic repored by Akio Takebe. > When we tested network between domU <-> dom0 with FTP load tools, > we hitted BUG() in hypervisor. It is always reproducible for a few minutes. > At that time, we got the following message. > vmi15.sky.yk.fujitsu.co.jp login: (XEN) Xen BUG at mm.c:1254 > > (XEN) FIXME: implement ia64 dump_execution_state() > (XEN) > (XEN) **************************************** > (XEN) Panic on CPU 0: > (XEN) Xen BUG at mm.c:1254 > (XEN) **************************************** > (XEN) > (XEN) Manual reset required ('noreboot' specified) > (XEN) machine_halt called. spinning... GNTTABOP_replace_and_unmap must updates both the p2m table and m2p table. However the m2p table update was missing so that the above BUG_ON() was triggered detecting the inconsistency between the p2m table and the m2p table. This patch adds the missing the m2p table updates. This patch also fixes the error path of the function. It may return before completing the page table manipulation. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/mm.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-) diff -r dc510776dd59 -r f2457c7aff8d xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Thu Apr 24 14:08:29 2008 -0600 +++ b/xen/arch/ia64/xen/mm.c Fri Apr 25 20:13:52 2008 +0900 @@ -2187,6 +2187,7 @@ replace_grant_host_mapping(unsigned long struct page_info* page = mfn_to_page(mfn); struct page_info* new_page = NULL; volatile pte_t* new_page_pte = NULL; + unsigned long new_page_mfn; if (new_gpaddr) { new_page_pte = lookup_noalloc_domain_pte_none(d, new_gpaddr); @@ -2194,7 +2195,6 @@ replace_grant_host_mapping(unsigned long new_pte = ptep_get_and_clear(&d->arch.mm, new_gpaddr, new_page_pte); if (likely(pte_present(new_pte))) { - unsigned long new_page_mfn; struct domain* page_owner; new_page_mfn = pte_pfn(new_pte); @@ -2255,22 +2255,24 @@ replace_grant_host_mapping(unsigned long goto out; } + if (new_page) { + set_gpfn_from_mfn(new_page_mfn, gpfn); + /* smp_mb() isn't needed because assign_domain_pge_cmpxchg_rel() + has release semantics. */ + } old_pte = ptep_cmpxchg_rel(&d->arch.mm, gpaddr, pte, cur_pte, new_pte); - if (unlikely(!pte_present(old_pte))) { - gdprintk(XENLOG_INFO, "%s: gpaddr 0x%lx mfn 0x%lx" - " cur_pte 0x%lx old_pte 0x%lx\n", - __func__, gpaddr, mfn, pte_val(cur_pte), pte_val(old_pte)); - goto out; - } if (unlikely(pte_val(cur_pte) != pte_val(old_pte))) { if (pte_pfn(old_pte) == mfn) { goto again; } - gdprintk(XENLOG_INFO, "%s gpaddr 0x%lx mfn 0x%lx cur_pte " - "0x%lx old_pte 0x%lx\n", - __func__, gpaddr, mfn, pte_val(cur_pte), pte_val(old_pte)); + if (new_page) { + set_gpfn_from_mfn(new_page_mfn, INVALID_M2P_ENTRY); + domain_put_page(d, new_gpaddr, new_page_pte, new_pte, 1); + } goto out; } + if (unlikely(!pte_present(old_pte))) + goto out; BUG_ON(pte_pfn(old_pte) != mfn); /* try_to_clear_PGC_allocate(d, page) is not needed. */ @@ -2283,8 +2285,9 @@ replace_grant_host_mapping(unsigned long return GNTST_okay; out: - if (new_page) - domain_put_page(d, new_gpaddr, new_page_pte, new_pte, 1); + gdprintk(XENLOG_INFO, "%s gpaddr 0x%lx mfn 0x%lx cur_pte " + "0x%lx old_pte 0x%lx\n", + __func__, gpaddr, mfn, pte_val(cur_pte), pte_val(old_pte)); return GNTST_general_error; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:30:34 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:30:34 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTnM-0002SR-Ji for www-data@colo.xensource.com; Tue, 20 May 2008 08:30:34 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTo0-0007IM-NB; Tue, 20 May 2008 15:31:12 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnm-00076n-Aq for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnc-0002zQ-V0 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:56 +0000 X-SBRS: 3.6 X-MesageID: 267621 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267621" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:29:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFTucd029543 for ; Tue, 20 May 2008 08:29:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUE31032242 for ; Tue, 20 May 2008 08:30:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUETL032241 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:14 -0700 Message-Id: <200805201530.m4KFUETL032241@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-SA-Exim-Scanned: No (on lists.xensource.com); Message bigger than SAmaxbody (256000) Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1208279386 21600 # Node ID 2b3d3aaf8be4395144414d4a1d9e4799e5485cab # Parent c0f77a6575475a1e6aa29ea4ed9f25893b8f19a0 # Parent 08e010c3f2519a585e2948871ab6be0fe25d93d4 merge with xen-unstable.hg --- tools/firmware/etherboot/make-eb-rom-list | 11 tools/security/policies/DEFAULT-UL-security_policy.xml | 41 tools/xenstore/xsls.c | 171 xen/drivers/passthrough/pci-direct.h | 48 xen/include/asm-ia64/linux-xen/linux/pci.h | 820 -- xen/include/asm-ia64/linux/asm/sn/pcidev.h | 83 .hgignore | 3 docs/misc/VMX_changes.txt | 2 docs/misc/hg-cheatsheet.txt | 14 docs/misc/vtpm.txt | 2 docs/misc/xenstore.txt | 3 docs/src/interface.tex | 10 docs/src/user.tex | 4 docs/xen-api/presentation.tex | 2 docs/xen-api/todo.tex | 2 docs/xen-api/wire-protocol.tex | 6 docs/xen-api/xenapi-datamodel.tex | 8 extras/mini-os/blkfront.c | 188 extras/mini-os/include/blkfront.h | 12 extras/mini-os/kernel.c | 41 extras/mini-os/lib/xmalloc.c | 14 stubdom/stubdom-dm | 2 tools/blktap/drivers/block-qcow.c | 2 tools/examples/xend-config-xenapi.sxp | 11 tools/examples/xend-config.sxp | 11 tools/firmware/Rules.mk | 17 tools/firmware/etherboot/Makefile | 15 tools/firmware/etherboot/eb-roms.h | 5695 ++++++++--------- tools/firmware/extboot/Makefile | 14 tools/firmware/hvmloader/Makefile | 17 tools/firmware/hvmloader/acpi/Makefile | 12 tools/firmware/hvmloader/hvmloader.c | 93 tools/firmware/hvmloader/option_rom.h | 50 tools/firmware/hvmloader/smp.c | 132 tools/firmware/hvmloader/util.c | 38 tools/firmware/hvmloader/util.h | 5 tools/firmware/rombios/32bit/Makefile | 8 tools/firmware/rombios/32bit/tcgbios/Makefile | 8 tools/firmware/rombios/32bit/tcgbios/tcgbios.c | 2 tools/ioemu/Makefile | 11 tools/ioemu/block-cow.c | 3 tools/ioemu/block-vbd.c | 48 tools/ioemu/block.c | 4 tools/ioemu/hw/ide.c | 5 tools/ioemu/hw/rtl8139.c | 18 tools/ioemu/hw/xen_machine_fv.c | 1 tools/ioemu/osdep.c | 3 tools/ioemu/qemu-img.c | 4 tools/ioemu/tapdisk-ioemu.c | 142 tools/ioemu/target-i386-dm/helper2.c | 2 tools/ioemu/vl.c | 38 tools/ioemu/vl.h | 4 tools/ioemu/xenstore.c | 12 tools/libxc/xc_domain.c | 31 tools/libxc/xc_domain_restore.c | 28 tools/libxc/xc_domain_save.c | 62 tools/libxc/xc_evtchn.c | 24 tools/libxc/xc_hvm_build.c | 89 tools/libxc/xenctrl.h | 3 tools/libxc/xg_private.c | 17 tools/libxc/xg_private.h | 2 tools/python/xen/util/acmpolicy.py | 26 tools/python/xen/util/xsm/acm/acm.py | 21 tools/python/xen/xend/XendConstants.py | 1 tools/python/xen/xend/XendDomainInfo.py | 10 tools/python/xen/xend/XendOptions.py | 7 tools/python/xen/xend/balloon.py | 17 tools/python/xen/xend/image.py | 7 tools/python/xen/xm/main.py | 10 tools/python/xen/xm/shutdown.py | 2 tools/security/Makefile | 2 tools/tests/blowfish.mk | 8 tools/xcutils/Makefile | 2 tools/xcutils/lsevtchn.c | 59 tools/xenstore/Makefile | 40 tools/xenstore/xenstore_client.c | 627 + tools/xenstore/xenstored_core.c | 2 tools/xenstore/xenstored_solaris.c | 1 tools/xenstore/xenstored_watch.c | 2 tools/xenstore/xs.c | 108 xen/arch/ia64/linux-xen/sn/kernel/irq.c | 2 xen/arch/ia64/vmx/vmx_hypercall.c | 5 xen/arch/ia64/xen/mm.c | 10 xen/arch/ia64/xen/tlb_track.c | 4 xen/arch/ia64/xen/xensetup.c | 2 xen/arch/x86/Makefile | 1 xen/arch/x86/acpi/boot.c | 62 xen/arch/x86/cpu/amd.c | 18 xen/arch/x86/domain.c | 25 xen/arch/x86/domain_build.c | 4 xen/arch/x86/hvm/emulate.c | 89 xen/arch/x86/hvm/hpet.c | 21 xen/arch/x86/hvm/hvm.c | 194 xen/arch/x86/hvm/i8254.c | 68 xen/arch/x86/hvm/intercept.c | 191 xen/arch/x86/hvm/io.c | 92 xen/arch/x86/hvm/mtrr.c | 2 xen/arch/x86/hvm/pmtimer.c | 12 xen/arch/x86/hvm/rtc.c | 12 xen/arch/x86/hvm/stdvga.c | 28 xen/arch/x86/hvm/svm/svm.c | 7 xen/arch/x86/hvm/vioapic.c | 54 xen/arch/x86/hvm/vlapic.c | 327 xen/arch/x86/hvm/vmx/realmode.c | 2 xen/arch/x86/hvm/vmx/vmcs.c | 85 xen/arch/x86/hvm/vmx/vmx.c | 307 xen/arch/x86/hvm/vmx/x86_32/exits.S | 2 xen/arch/x86/hvm/vmx/x86_64/exits.S | 2 xen/arch/x86/hvm/vpic.c | 42 xen/arch/x86/io_apic.c | 9 xen/arch/x86/mm.c | 51 xen/arch/x86/mm/hap/Makefile | 1 xen/arch/x86/mm/hap/hap.c | 12 xen/arch/x86/mm/hap/p2m-ept.c | 257 xen/arch/x86/mm/p2m.c | 377 - xen/arch/x86/mm/paging.c | 19 xen/arch/x86/mm/shadow/common.c | 8 xen/arch/x86/pci.c | 118 xen/arch/x86/setup.c | 2 xen/arch/x86/time.c | 158 xen/arch/x86/traps.c | 299 xen/arch/x86/x86_64/compat/mm.c | 4 xen/arch/x86/x86_64/mm.c | 8 xen/common/compat/domain.c | 4 xen/common/compat/grant_table.c | 20 xen/common/domain.c | 10 xen/common/domctl.c | 7 xen/common/event_channel.c | 12 xen/common/grant_table.c | 6 xen/common/keyhandler.c | 8 xen/common/memory.c | 25 xen/common/page_alloc.c | 27 xen/common/softirq.c | 102 xen/common/trace.c | 9 xen/common/xencomm.c | 1 xen/drivers/passthrough/amd/iommu_detect.c | 37 xen/drivers/passthrough/amd/iommu_init.c | 2 xen/drivers/passthrough/amd/iommu_map.c | 76 xen/drivers/passthrough/amd/pci_amd_iommu.c | 11 xen/drivers/passthrough/io.c | 74 xen/drivers/passthrough/iommu.c | 2 xen/drivers/passthrough/vtd/Makefile | 2 xen/drivers/passthrough/vtd/dmar.c | 30 xen/drivers/passthrough/vtd/dmar.h | 8 xen/drivers/passthrough/vtd/intremap.c | 68 xen/drivers/passthrough/vtd/iommu.c | 500 - xen/drivers/passthrough/vtd/iommu.h | 4 xen/drivers/passthrough/vtd/qinval.c | 105 xen/drivers/passthrough/vtd/utils.c | 79 xen/drivers/passthrough/vtd/vtd.h | 9 xen/drivers/passthrough/vtd/x86/Makefile | 1 xen/drivers/passthrough/vtd/x86/vtd.c | 303 xen/include/asm-ia64/domain.h | 2 xen/include/asm-ia64/linux-xen/asm/sn/README.origin | 1 xen/include/asm-ia64/linux-xen/asm/sn/pcibr_provider.h | 2 xen/include/asm-ia64/linux-xen/asm/sn/pcidev.h | 87 xen/include/asm-ia64/linux-xen/linux/interrupt.h | 2 xen/include/asm-ia64/linux-xen/linux/linux-pci.h | 820 ++ xen/include/asm-ia64/linux/asm/sn/README.origin | 1 xen/include/asm-x86/domain.h | 26 xen/include/asm-x86/hvm/domain.h | 12 xen/include/asm-x86/hvm/hvm.h | 4 xen/include/asm-x86/hvm/io.h | 21 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h | 1 xen/include/asm-x86/hvm/svm/vmcb.h | 6 xen/include/asm-x86/hvm/vcpu.h | 6 xen/include/asm-x86/hvm/vlapic.h | 2 xen/include/asm-x86/hvm/vmx/vmcs.h | 47 xen/include/asm-x86/hvm/vmx/vmx.h | 128 xen/include/asm-x86/mm.h | 3 xen/include/asm-x86/numa.h | 1 xen/include/asm-x86/p2m.h | 80 xen/include/asm-x86/paging.h | 2 xen/include/public/hvm/params.h | 8 xen/include/xen/hvm/iommu.h | 5 xen/include/xen/hypercall.h | 1 xen/include/xen/iommu.h | 6 xen/include/xen/mm.h | 7 xen/include/xen/numa.h | 7 xen/include/xen/pci.h | 29 xen/include/xen/sched.h | 9 xen/include/xen/softirq.h | 59 xen/include/xen/xencomm.h | 8 xen/xsm/acm/acm_chinesewall_hooks.c | 8 xen/xsm/acm/acm_simple_type_enforcement_hooks.c | 12 185 files changed, 8535 insertions(+), 6533 deletions(-) diff -r c0f77a657547 -r 2b3d3aaf8be4 .hgignore --- a/.hgignore Mon Apr 14 14:04:58 2008 -0600 +++ b/.hgignore Tue Apr 15 11:09:46 2008 -0600 @@ -150,6 +150,7 @@ ^tools/ioemu/qemu-tech\.html$ ^tools/ioemu/qemu\.1$ ^tools/ioemu/qemu\.pod$ +^tools/ioemu/tapdisk-ioemu$ ^tools/libxc/ia64/asm/.*\.h$ ^tools/libxc/ia64/acpi/.*\.h$ ^tools/libxc/ia64/acpi/platform/.*\.h$ @@ -198,6 +199,7 @@ ^tools/vtpm/tpm_emulator/.*$ ^tools/vtpm/vtpm/.*$ ^tools/vtpm_manager/manager/vtpm_managerd$ +^tools/xcutils/lsevtchn$ ^tools/xcutils/xc_restore$ ^tools/xcutils/xc_save$ ^tools/xcutils/readnotes$ @@ -208,6 +210,7 @@ ^tools/xenstat/xentop/xentop$ ^tools/xenstore/testsuite/tmp/.*$ ^tools/xenstore/xen$ +^tools/xenstore/xenstore$ ^tools/xenstore/xenstore-chmod$ ^tools/xenstore/xenstore-exists$ ^tools/xenstore/xenstore-list$ diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/misc/VMX_changes.txt --- a/docs/misc/VMX_changes.txt Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/misc/VMX_changes.txt Tue Apr 15 11:09:46 2008 -0600 @@ -79,7 +79,7 @@ Changes to the existing code: * include/asm-x86/processor.h: struct arch_vmx_struct arch_vmx has been added to the thread_struct data structure. The arch_vmx has - the addtional VMX-related CPU context. + the additional VMX-related CPU context. * arch/x86/io_apic.c: reverse mapping between vector and irq has been added. We will revisit this code when considering MSI diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/misc/hg-cheatsheet.txt --- a/docs/misc/hg-cheatsheet.txt Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/misc/hg-cheatsheet.txt Tue Apr 15 11:09:46 2008 -0600 @@ -12,7 +12,7 @@ running with the new tools as quickly as running with the new tools as quickly as possible, and is written from the perspective of someone who has been using BK. -For a more detailed exposition, see the mecurial tutorial: +For a more detailed exposition, see the mercurial tutorial: http://www.serpentine.com/mercurial/index.cgi?Tutorial The Hg manpage is available at: @@ -69,7 +69,7 @@ actually pretty neat. For example, it wo actually pretty neat. For example, it would in principle enable you to have both the 2.0-testing and unstable trees in a single repository. We shyed away from doing this as we thought the risk of -commiting to the wrong head was too great. +committing to the wrong head was too great. One slightly confusing aspect of Hg is that many of the commands have aliases, and hence when looking things up in the man page its not @@ -81,7 +81,7 @@ Getting Xen Getting Xen ----------- -The URL for the mainline Xen mercurial respository is: +The URL for the mainline Xen mercurial repository is: http://xenbits.xensource.com/xen-unstable.hg (similarly for xen-2.0 and xen-2.0-testing) @@ -273,9 +273,9 @@ Pushing changesets to a parent repositor Pushes changes up to a parent. You can't push if you pulled the repository off the web interface. In fact, you can currently only push -to an ssh target -- filesystem drectory targets don't work, but this +to an ssh target -- filesystem directory targets don't work, but this will be fixed soon. -For now it is possible to set up assymetric pull/push paths. Pulls can +For now it is possible to set up asymmetric pull/push paths. Pulls can be done via web interface while pushes via ssh. Example of .hg/hgrc config file: | [paths] @@ -332,7 +332,7 @@ system. Hg will probably get fixed soon, system. Hg will probably get fixed soon, but in the meantime you can cleanup with "find -depth -type d -print | xargs -r rmdir". -You can return to the tip by ommiting an explicit changeset id. +You can return to the tip by omitting an explicit changeset id. The manifest command lets you see the contents of the repository for the current changeset. @@ -347,7 +347,7 @@ This will print a bunch of records of th | 7fc869aae2945a9f4626fad96552db3103e61cb9 644 README | ... -This lists the hash of each file, its 1-bit 'executable' atribute +This lists the hash of each file, its 1-bit 'executable' attribute (either file permission mode 644 or 755), and the file name. So, to determine the files that change across two changesets, you would dump the respective manifests to files, and use diff. diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/misc/vtpm.txt --- a/docs/misc/vtpm.txt Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/misc/vtpm.txt Tue Apr 15 11:09:46 2008 -0600 @@ -143,7 +143,7 @@ PCR-08: 00 00 00 00 00 00 00 00 00 00 00 PCR-08: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [...] -At this point the user domain has been sucessfully connected to its +At this point the user domain has been successfully connected to its virtual TPM instance. For further information please read the documentation in diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/misc/xenstore.txt --- a/docs/misc/xenstore.txt Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/misc/xenstore.txt Tue Apr 15 11:09:46 2008 -0600 @@ -129,7 +129,7 @@ reply payloads as applicable: reply payloads as applicable: ----------- Database read, write and permissions operatons ---------- +---------- Database read, write and permissions operations ---------- READ | WRITE | @@ -206,7 +206,7 @@ WATCH_EVENT || as described above. req_id and tx_id are both 0. is the event's path, ie the actual path that was - modifed; however if the event was the recursive removal of an + modified; however if the event was the recursive removal of an parent of , is just (rather than the actual path which was removed). So is a child of , regardless. diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/src/interface.tex --- a/docs/src/interface.tex Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/src/interface.tex Tue Apr 15 11:09:46 2008 -0600 @@ -470,7 +470,7 @@ typedef struct shared_info { * are delivered by this mechanism: * 1. Bi-directional inter- and intra-domain connections. Domains must * arrange out-of-band to set up a connection (usually by allocating - * an unbound 'listener' port and avertising that via a storage service + * an unbound 'listener' port and advertising that via a storage service * such as xenstore). * 2. Physical interrupts. A domain with suitable hardware-access * privileges can bind an event-channel port to a physical interrupt @@ -915,7 +915,7 @@ These activities include: (e.g. performance-related statistics, etc). \end{itemize} -The store is arranged as a hierachical collection of key-value pairs. +The store is arranged as a hierarchical collection of key-value pairs. Each domain has a directory hierarchy containing data related to its configuration. Domains are permitted to register for notifications about changes in subtrees of the store, and to apply changes to the @@ -1114,9 +1114,9 @@ This path contains: \end{description} \end{description} - \item[device-misc/] miscellanous information for devices + \item[device-misc/] miscellaneous information for devices \begin{description} - \item[vif/] miscellanous information for vif devices + \item[vif/] miscellaneous information for vif devices \begin{description} \item[nextDeviceID] the next device id to use \end{description} @@ -1511,7 +1511,7 @@ The virtual TPM implementation listens f The virtual TPM implementation listens for TPM request on /dev/vtpm. Since it must be able to apply the TPM request packet to the virtual TPM instance associated with the virtual machine, a 4-byte virtual TPM instance -identifier is prepended to each packet by the backend driver (in network +identifier is pretended to each packet by the backend driver (in network byte order) for internal routing of the request. \subsection{Virtual TPM ring interface} diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/src/user.tex --- a/docs/src/user.tex Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/src/user.tex Tue Apr 15 11:09:46 2008 -0600 @@ -3394,7 +3394,7 @@ Alternatively, a system that has two har Alternatively, a system that has two hard-drives does not need a VIO domain but can directly assign one hardware storage device to each of the workloads if the platform offers an IO-MMU, cf -Section~\ref{s:ddsecurity}. Sharing hardware through virtualizated devices +Section~\ref{s:ddsecurity}. Sharing hardware through virtualized devices is a trade-off between the amount of trusted code (size of the trusted computing base) and the amount of acceptable over-provisioning. This holds both for peripherals and for system platforms. @@ -4652,7 +4652,7 @@ answering the questions as follows: \begin{enumerate} \item When the program asks for \textbf{model}, -scroll down and selese \textbf{SummaSketch (MM Compatible)}. +scroll down and select \textbf{SummaSketch (MM Compatible)}. \item When the program asks for \textbf{COM Port} specify \textbf{com2}. diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/xen-api/presentation.tex --- a/docs/xen-api/presentation.tex Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/xen-api/presentation.tex Tue Apr 15 11:09:46 2008 -0600 @@ -69,7 +69,7 @@ The API reference explicitly lists the f The API reference explicitly lists the fields that are bound together in this way. It also contains a diagram that shows relationships between classes. In this diagram an edge signifies the -existance of a pair of fields that are bound together, using standard +existence of a pair of fields that are bound together, using standard crows-foot notation to signify the type of relationship (e.g.\ one-many, many-many). diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/xen-api/todo.tex --- a/docs/xen-api/todo.tex Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/xen-api/todo.tex Tue Apr 15 11:09:46 2008 -0600 @@ -32,7 +32,7 @@ code, potential error description, but o \item Clarify session behaviour wrt timeouts and disconnects. -\item Clarify behaviour of progress field on asyncrhonous request polling when +\item Clarify behaviour of progress field on asynchronous request polling when that request fails. \item Clarify which calls have asynchronous counterparts by marking them as such in the reference. (Individual getters and setters are too small and quick to justify having async versions) diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/xen-api/wire-protocol.tex --- a/docs/xen-api/wire-protocol.tex Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/xen-api/wire-protocol.tex Tue Apr 15 11:09:46 2008 -0600 @@ -185,7 +185,7 @@ Where {\tt uname} and {\tt password} ref Where {\tt uname} and {\tt password} refer to your username and password respectively, as defined by the Xen administrator. The {\tt session\_id} returned by {\tt session.login\_with\_password} is passed -to subequent RPC calls as an authentication token. +to subsequent RPC calls as an authentication token. A session can be terminated with the {\tt session.logout} function: \begin{verbatim} @@ -210,7 +210,7 @@ Async.VM.clone(...)}, that is non-blocki Instead of returning its result directly, an asynchronous RPC call returns a {\tt task-id}; this identifier is subsequently used -to track the status of a running asynchronous RPC. Note that an asychronous +to track the status of a running asynchronous RPC. Note that an asynchronous call may fail immediately, before a {\tt task-id} has even been created---to represent this eventuality, the returned {\tt task-id} is wrapped in an XML-RPC struct with a {\tt Status}, {\tt ErrorDescription} and @@ -248,7 +248,7 @@ Create a python object referencing the r \end{verbatim} Acquire a session token by logging in with a username and password -(error-handling ommitted for brevity; the session token is pointed to by the +(error-handling omitted for brevity; the session token is pointed to by the key {\tt 'Value'} in the returned dictionary) \begin{verbatim} diff -r c0f77a657547 -r 2b3d3aaf8be4 docs/xen-api/xenapi-datamodel.tex --- a/docs/xen-api/xenapi-datamodel.tex Mon Apr 14 14:04:58 2008 -0600 +++ b/docs/xen-api/xenapi-datamodel.tex Tue Apr 15 11:09:46 2008 -0600 @@ -75,7 +75,7 @@ host.host\_CPUs & host\_cpu.host & many- \hline \end{tabular}\end{center} -The following represents bound fields (as specified above) diagramatically, using crows-foot notation to specify one-to-one, one-to-many or many-to-many +The following represents bound fields (as specified above) diagrammatically, using crows-foot notation to specify one-to-one, one-to-many or many-to-many relationships: \begin{center}\resizebox{0.8\textwidth}{!}{ @@ -444,7 +444,7 @@ returned. Also returned is a developer- \subsubsection{VLAN\_TAG\_INVALID} -You tried to create a VLAN, but the tag you gave was invalid -- it mmust be +You tried to create a VLAN, but the tag you gave was invalid -- it must be between 0 and 4095. The parameter echoes the VLAN tag you gave. \vspace{0.3cm} @@ -1390,7 +1390,7 @@ Quals & Field & Type & Description \\ $\mathit{RW}$ & {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum (bytes) \\ $\mathit{RW}$ & {\tt memory/dynamic\_max} & int & Dynamic maximum (bytes) \\ $\mathit{RW}$ & {\tt memory/dynamic\_min} & int & Dynamic minimum (bytes) \\ -$\mathit{RW}$ & {\tt memory/static\_min} & int & Statically-set (i.e. absolute) mininum (bytes) \\ +$\mathit{RW}$ & {\tt memory/static\_min} & int & Statically-set (i.e. absolute) minimum (bytes) \\ $\mathit{RW}$ & {\tt VCPUs/params} & (string $\rightarrow$ string) Map & configuration parameters for the selected VCPU policy \\ $\mathit{RW}$ & {\tt VCPUs/max} & int & Max number of VCPUs \\ $\mathit{RW}$ & {\tt VCPUs/at\_startup} & int & Boot number of VCPUs \\ @@ -14954,7 +14954,7 @@ Check whether a VM with the given securi \begin{tabular}{|c|c|p{7cm}|} \hline {\bf type} & {\bf name} & {\bf description} \\ \hline -{\tt string } & security_label & reference to the object \\ \hline +{\tt string } & security\_label & reference to the object \\ \hline \end{tabular} diff -r c0f77a657547 -r 2b3d3aaf8be4 extras/mini-os/blkfront.c --- a/extras/mini-os/blkfront.c Mon Apr 14 14:04:58 2008 -0600 +++ b/extras/mini-os/blkfront.c Tue Apr 15 11:09:46 2008 -0600 @@ -48,11 +48,7 @@ struct blkfront_dev { char *nodename; char *backend; - unsigned sector_size; - unsigned sectors; - int mode; - int barrier; - int flush; + struct blkfront_info info; #ifdef HAVE_LIBC int fd; @@ -70,7 +66,7 @@ void blkfront_handler(evtchn_port_t port wake_up(&blkfront_queue); } -struct blkfront_dev *init_blkfront(char *nodename, uint64_t *sectors, unsigned *sector_size, int *mode, int *info) +struct blkfront_dev *init_blkfront(char *nodename, struct blkfront_info *info) { xenbus_transaction_t xbt; char* err; @@ -163,9 +159,9 @@ done: return NULL; } if (*c == 'w') - *mode = dev->mode = O_RDWR; + dev->info.mode = O_RDWR; else - *mode = dev->mode = O_RDONLY; + dev->info.mode = O_RDONLY; free(c); snprintf(path, sizeof(path), "%s/state", dev->backend); @@ -177,24 +173,26 @@ done: xenbus_unwatch_path(XBT_NIL, path); snprintf(path, sizeof(path), "%s/info", dev->backend); - *info = xenbus_read_integer(path); + dev->info.info = xenbus_read_integer(path); snprintf(path, sizeof(path), "%s/sectors", dev->backend); // FIXME: read_integer returns an int, so disk size limited to 1TB for now - *sectors = dev->sectors = xenbus_read_integer(path); + dev->info.sectors = xenbus_read_integer(path); snprintf(path, sizeof(path), "%s/sector-size", dev->backend); - *sector_size = dev->sector_size = xenbus_read_integer(path); + dev->info.sector_size = xenbus_read_integer(path); snprintf(path, sizeof(path), "%s/feature-barrier", dev->backend); - dev->barrier = xenbus_read_integer(path); + dev->info.barrier = xenbus_read_integer(path); snprintf(path, sizeof(path), "%s/feature-flush-cache", dev->backend); - dev->flush = xenbus_read_integer(path); + dev->info.flush = xenbus_read_integer(path); + + *info = dev->info; } unmask_evtchn(dev->evtchn); - printk("%u sectors of %u bytes\n", dev->sectors, dev->sector_size); + printk("%u sectors of %u bytes\n", dev->info.sectors, dev->info.sector_size); printk("**************************\n"); return dev; @@ -258,11 +256,11 @@ void blkfront_aio(struct blkfront_aiocb uintptr_t start, end; // Can't io at non-sector-aligned location - ASSERT(!(aiocbp->aio_offset & (dev->sector_size-1))); + ASSERT(!(aiocbp->aio_offset & (dev->info.sector_size-1))); // Can't io non-sector-sized amounts - ASSERT(!(aiocbp->aio_nbytes & (dev->sector_size-1))); + ASSERT(!(aiocbp->aio_nbytes & (dev->info.sector_size-1))); // Can't io non-sector-aligned buffer - ASSERT(!((uintptr_t) aiocbp->aio_buf & (dev->sector_size-1))); + ASSERT(!((uintptr_t) aiocbp->aio_buf & (dev->info.sector_size-1))); start = (uintptr_t)aiocbp->aio_buf & PAGE_MASK; end = ((uintptr_t)aiocbp->aio_buf + aiocbp->aio_nbytes + PAGE_SIZE - 1) & PAGE_MASK; @@ -280,7 +278,7 @@ void blkfront_aio(struct blkfront_aiocb req->nr_segments = n; req->handle = dev->handle; req->id = (uintptr_t) aiocbp; - req->sector_number = aiocbp->aio_offset / dev->sector_size; + req->sector_number = aiocbp->aio_offset / dev->info.sector_size; for (j = 0; j < n; j++) { uintptr_t data = start + j * PAGE_SIZE; @@ -292,10 +290,10 @@ void blkfront_aio(struct blkfront_aiocb aiocbp->gref[j] = req->seg[j].gref = gnttab_grant_access(dev->dom, virtual_to_mfn(data), write); req->seg[j].first_sect = 0; - req->seg[j].last_sect = PAGE_SIZE / dev->sector_size - 1; - } - req->seg[0].first_sect = ((uintptr_t)aiocbp->aio_buf & ~PAGE_MASK) / dev->sector_size; - req->seg[n-1].last_sect = (((uintptr_t)aiocbp->aio_buf + aiocbp->aio_nbytes - 1) & ~PAGE_MASK) / dev->sector_size; + req->seg[j].last_sect = PAGE_SIZE / dev->info.sector_size - 1; + } + req->seg[0].first_sect = ((uintptr_t)aiocbp->aio_buf & ~PAGE_MASK) / dev->info.sector_size; + req->seg[n-1].last_sect = (((uintptr_t)aiocbp->aio_buf + aiocbp->aio_nbytes - 1) & ~PAGE_MASK) / dev->info.sector_size; dev->ring.req_prod_pvt = i + 1; @@ -315,67 +313,7 @@ void blkfront_aio_read(struct blkfront_a blkfront_aio(aiocbp, 0); } -int blkfront_aio_poll(struct blkfront_dev *dev) -{ - RING_IDX rp, cons; - struct blkif_response *rsp; - int more; - -moretodo: -#ifdef HAVE_LIBC - files[dev->fd].read = 0; - mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */ -#endif - - rp = dev->ring.sring->rsp_prod; - rmb(); /* Ensure we see queued responses up to 'rp'. */ - cons = dev->ring.rsp_cons; - - int nr_consumed = 0; - while ((cons != rp)) - { - rsp = RING_GET_RESPONSE(&dev->ring, cons); - nr_consumed++; - - if (rsp->status != BLKIF_RSP_OKAY) - printk("block error %d for op %d\n", rsp->status, rsp->operation); - - switch (rsp->operation) { - case BLKIF_OP_READ: - case BLKIF_OP_WRITE: - { - struct blkfront_aiocb *aiocbp = (void*) (uintptr_t) rsp->id; - int status = rsp->status; - int j; - - for (j = 0; j < aiocbp->n; j++) - gnttab_end_access(aiocbp->gref[j]); - - dev->ring.rsp_cons = ++cons; - /* Nota: callback frees aiocbp itself */ - aiocbp->aio_cb(aiocbp, status ? -EIO : 0); - if (dev->ring.rsp_cons != cons) - /* We reentered, we must not continue here */ - goto out; - break; - } - default: - printk("unrecognized block operation %d response\n", rsp->operation); - case BLKIF_OP_WRITE_BARRIER: - case BLKIF_OP_FLUSH_DISKCACHE: - dev->ring.rsp_cons = ++cons; - break; - } - } - -out: - RING_FINAL_CHECK_FOR_RESPONSES(&dev->ring, more); - if (more) goto moretodo; - - return nr_consumed; -} - -static void blkfront_push_operation(struct blkfront_dev *dev, uint8_t op) +static void blkfront_push_operation(struct blkfront_dev *dev, uint8_t op, uint64_t id) { int i; struct blkif_request *req; @@ -387,8 +325,7 @@ static void blkfront_push_operation(stru req->operation = op; req->nr_segments = 0; req->handle = dev->handle; - /* Not used */ - req->id = 0; + req->id = id; /* Not needed anyway, but the backend will check it */ req->sector_number = 0; dev->ring.req_prod_pvt = i + 1; @@ -397,16 +334,22 @@ static void blkfront_push_operation(stru if (notify) notify_remote_via_evtchn(dev->evtchn); } +void blkfront_aio_push_operation(struct blkfront_aiocb *aiocbp, uint8_t op) +{ + struct blkfront_dev *dev = aiocbp->aio_dev; + blkfront_push_operation(dev, op, (uintptr_t) aiocbp); +} + void blkfront_sync(struct blkfront_dev *dev) { unsigned long flags; - if (dev->mode == O_RDWR) { - if (dev->barrier == 1) - blkfront_push_operation(dev, BLKIF_OP_WRITE_BARRIER); - - if (dev->flush == 1) - blkfront_push_operation(dev, BLKIF_OP_FLUSH_DISKCACHE); + if (dev->info.mode == O_RDWR) { + if (dev->info.barrier == 1) + blkfront_push_operation(dev, BLKIF_OP_WRITE_BARRIER, 0); + + if (dev->info.flush == 1) + blkfront_push_operation(dev, BLKIF_OP_FLUSH_DISKCACHE, 0); } /* Note: This won't finish if another thread enqueues requests. */ @@ -426,6 +369,69 @@ void blkfront_sync(struct blkfront_dev * local_irq_restore(flags); } +int blkfront_aio_poll(struct blkfront_dev *dev) +{ + RING_IDX rp, cons; + struct blkif_response *rsp; + int more; + +moretodo: +#ifdef HAVE_LIBC + files[dev->fd].read = 0; + mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */ +#endif + + rp = dev->ring.sring->rsp_prod; + rmb(); /* Ensure we see queued responses up to 'rp'. */ + cons = dev->ring.rsp_cons; + + int nr_consumed = 0; + while ((cons != rp)) + { + rsp = RING_GET_RESPONSE(&dev->ring, cons); + nr_consumed++; + + struct blkfront_aiocb *aiocbp = (void*) (uintptr_t) rsp->id; + int status = rsp->status; + + if (status != BLKIF_RSP_OKAY) + printk("block error %d for op %d\n", status, rsp->operation); + + switch (rsp->operation) { + case BLKIF_OP_READ: + case BLKIF_OP_WRITE: + { + int j; + + for (j = 0; j < aiocbp->n; j++) + gnttab_end_access(aiocbp->gref[j]); + + break; + } + + case BLKIF_OP_WRITE_BARRIER: + case BLKIF_OP_FLUSH_DISKCACHE: + break; + + default: + printk("unrecognized block operation %d response\n", rsp->operation); + } + + dev->ring.rsp_cons = ++cons; + /* Nota: callback frees aiocbp itself */ + if (aiocbp && aiocbp->aio_cb) + aiocbp->aio_cb(aiocbp, status ? -EIO : 0); + if (dev->ring.rsp_cons != cons) + /* We reentered, we must not continue here */ + break; + } + + RING_FINAL_CHECK_FOR_RESPONSES(&dev->ring, more); + if (more) goto moretodo; + + return nr_consumed; +} + #ifdef HAVE_LIBC int blkfront_open(struct blkfront_dev *dev) { diff -r c0f77a657547 -r 2b3d3aaf8be4 extras/mini-os/include/blkfront.h --- a/extras/mini-os/include/blkfront.h Mon Apr 14 14:04:58 2008 -0600 +++ b/extras/mini-os/include/blkfront.h Tue Apr 15 11:09:46 2008 -0600 @@ -15,13 +15,23 @@ struct blkfront_aiocb void (*aio_cb)(struct blkfront_aiocb *aiocb, int ret); }; -struct blkfront_dev *init_blkfront(char *nodename, uint64_t *sectors, unsigned *sector_size, int *mode, int *info); +struct blkfront_info +{ + uint64_t sectors; + unsigned sector_size; + int mode; + int info; + int barrier; + int flush; +}; +struct blkfront_dev *init_blkfront(char *nodename, struct blkfront_info *info); #ifdef HAVE_LIBC int blkfront_open(struct blkfront_dev *dev); #endif void blkfront_aio(struct blkfront_aiocb *aiocbp, int write); void blkfront_aio_read(struct blkfront_aiocb *aiocbp); void blkfront_aio_write(struct blkfront_aiocb *aiocbp); +void blkfront_aio_push_operation(struct blkfront_aiocb *aiocbp, uint8_t op); int blkfront_aio_poll(struct blkfront_dev *dev); void blkfront_sync(struct blkfront_dev *dev); void shutdown_blkfront(struct blkfront_dev *dev); diff -r c0f77a657547 -r 2b3d3aaf8be4 extras/mini-os/kernel.c --- a/extras/mini-os/kernel.c Mon Apr 14 14:04:58 2008 -0600 +++ b/extras/mini-os/kernel.c Tue Apr 15 11:09:46 2008 -0600 @@ -91,9 +91,7 @@ static void netfront_thread(void *p) } static struct blkfront_dev *blk_dev; -static uint64_t blk_sectors; -static unsigned blk_sector_size; -static int blk_mode; +static struct blkfront_info blk_info; static uint64_t blk_size_read; static uint64_t blk_size_write; @@ -111,9 +109,9 @@ static struct blk_req *blk_alloc_req(uin { struct blk_req *req = xmalloc(struct blk_req); req->aiocb.aio_dev = blk_dev; - req->aiocb.aio_buf = _xmalloc(blk_sector_size, blk_sector_size); - req->aiocb.aio_nbytes = blk_sector_size; - req->aiocb.aio_offset = sector * blk_sector_size; + req->aiocb.aio_buf = _xmalloc(blk_info.sector_size, blk_info.sector_size); + req->aiocb.aio_nbytes = blk_info.sector_size; + req->aiocb.aio_offset = sector * blk_info.sector_size; req->aiocb.data = req; req->next = NULL; return req; @@ -125,7 +123,7 @@ static void blk_read_completed(struct bl if (ret) printk("got error code %d when reading at offset %ld\n", ret, aiocb->aio_offset); else - blk_size_read += blk_sector_size; + blk_size_read += blk_info.sector_size; free(aiocb->aio_buf); free(req); } @@ -154,10 +152,10 @@ static void blk_write_read_completed(str free(req); return; } - blk_size_read += blk_sector_size; + blk_size_read += blk_info.sector_size; buf = (int*) aiocb->aio_buf; rand_value = req->rand_value; - for (i = 0; i < blk_sector_size / sizeof(int); i++) { + for (i = 0; i < blk_info.sector_size / sizeof(int); i++) { if (buf[i] != rand_value) { printk("bogus data at offset %ld\n", aiocb->aio_offset + i); break; @@ -177,7 +175,7 @@ static void blk_write_completed(struct b free(req); return; } - blk_size_write += blk_sector_size; + blk_size_write += blk_info.sector_size; /* Push write check */ req->next = blk_to_read; blk_to_read = req; @@ -195,7 +193,7 @@ static void blk_write_sector(uint64_t se req->rand_value = rand_value = rand(); buf = (int*) req->aiocb.aio_buf; - for (i = 0; i < blk_sector_size / sizeof(int); i++) { + for (i = 0; i < blk_info.sector_size / sizeof(int); i++) { buf[i] = rand_value; rand_value *= RAND_MIX; } @@ -207,35 +205,34 @@ static void blkfront_thread(void *p) static void blkfront_thread(void *p) { time_t lasttime = 0; - int blk_info; - - blk_dev = init_blkfront(NULL, &blk_sectors, &blk_sector_size, &blk_mode, &blk_info); + + blk_dev = init_blkfront(NULL, &blk_info); if (!blk_dev) return; - if (blk_info & VDISK_CDROM) + if (blk_info.info & VDISK_CDROM) printk("Block device is a CDROM\n"); - if (blk_info & VDISK_REMOVABLE) + if (blk_info.info & VDISK_REMOVABLE) printk("Block device is removable\n"); - if (blk_info & VDISK_READONLY) + if (blk_info.info & VDISK_READONLY) printk("Block device is read-only\n"); #ifdef BLKTEST_WRITE - if (blk_mode == O_RDWR) { + if (blk_info.mode == O_RDWR) { blk_write_sector(0); - blk_write_sector(blk_sectors-1); + blk_write_sector(blk_info.sectors-1); } else #endif { blk_read_sector(0); - blk_read_sector(blk_sectors-1); + blk_read_sector(blk_info.sectors-1); } while (1) { - uint64_t sector = rand() % blk_sectors; + uint64_t sector = rand() % blk_info.sectors; struct timeval tv; #ifdef BLKTEST_WRITE - if (blk_mode == O_RDWR) + if (blk_info.mode == O_RDWR) blk_write_sector(sector); else #endif diff -r c0f77a657547 -r 2b3d3aaf8be4 extras/mini-os/lib/xmalloc.c --- a/extras/mini-os/lib/xmalloc.c Mon Apr 14 14:04:58 2008 -0600 +++ b/extras/mini-os/lib/xmalloc.c Tue Apr 15 11:09:46 2008 -0600 @@ -208,6 +208,13 @@ void xfree(const void *p) pad = (struct xmalloc_pad *)p - 1; hdr = (struct xmalloc_hdr *)((char *)p - pad->hdr_size); + /* Big allocs free directly. */ + if ( hdr->size >= PAGE_SIZE ) + { + free_pages(hdr, get_order(hdr->size)); + return; + } + /* We know hdr will be on same page. */ if(((long)p & PAGE_MASK) != ((long)hdr & PAGE_MASK)) { @@ -220,13 +227,6 @@ void xfree(const void *p) { printk("Should not be previously freed\n"); *(int*)0=0; - } - - /* Big allocs free directly. */ - if ( hdr->size >= PAGE_SIZE ) - { - free_pages(hdr, get_order(hdr->size)); - return; } /* Merge with other free block, or put in list. */ diff -r c0f77a657547 -r 2b3d3aaf8be4 stubdom/stubdom-dm --- a/stubdom/stubdom-dm Mon Apr 14 14:04:58 2008 -0600 +++ b/stubdom/stubdom-dm Tue Apr 15 11:09:46 2008 -0600 @@ -74,7 +74,7 @@ done creation="xm create -c stubdom-$domname target=$domid memory=32 extra=\"$extra\"" -(while true ; do sleep 60 ; done) | $creation & +(while true ; do sleep 60 ; done) | /bin/sh -c "$creation" & #xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to shut down ; read" & consolepid=$! diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/blktap/drivers/block-qcow.c --- a/tools/blktap/drivers/block-qcow.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/blktap/drivers/block-qcow.c Tue Apr 15 11:09:46 2008 -0600 @@ -1112,7 +1112,7 @@ int qcow_create(const char *filename, ui int shift, length, adjust, flags = 0, ret = 0; QCowHeader header; QCowHeader_ext exthdr; - char backing_filename[1024], *ptr; + char backing_filename[PATH_MAX], *ptr; uint64_t tmp, size, total_length; struct stat st; diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/examples/xend-config-xenapi.sxp --- a/tools/examples/xend-config-xenapi.sxp Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/examples/xend-config-xenapi.sxp Tue Apr 15 11:09:46 2008 -0600 @@ -167,11 +167,14 @@ #(network-script network-nat) #(vif-script vif-nat) +# dom0-min-mem is the lowest permissible memory level (in MB) for dom0. +# This is a minimum both for auto-ballooning (as enabled by +# enable-dom0-ballooning below) and for xm mem-set when applied to dom0. +(dom0-min-mem 196) -# Dom0 will balloon out when needed to free memory for domU. -# dom0-min-mem is the lowest memory level (in MB) dom0 will get down to. -# If dom0-min-mem=0, dom0 will never balloon out. -(dom0-min-mem 196) +# Whether to enable auto-ballooning of dom0 to allow domUs to be created. +# If enable-dom0-ballooning = no, dom0 will never balloon out. +(enable-dom0-ballooning yes) # In SMP system, dom0 will use dom0-cpus # of CPUS # If dom0-cpus = 0, dom0 will take all cpus available diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/examples/xend-config.sxp --- a/tools/examples/xend-config.sxp Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/examples/xend-config.sxp Tue Apr 15 11:09:46 2008 -0600 @@ -165,11 +165,14 @@ #(network-script network-nat) #(vif-script vif-nat) - -# Dom0 will balloon out when needed to free memory for domU. -# dom0-min-mem is the lowest memory level (in MB) dom0 will get down to. -# If dom0-min-mem=0, dom0 will never balloon out. +# dom0-min-mem is the lowest permissible memory level (in MB) for dom0. +# This is a minimum both for auto-ballooning (as enabled by +# enable-dom0-ballooning below) and for xm mem-set when applied to dom0. (dom0-min-mem 196) + +# Whether to enable auto-ballooning of dom0 to allow domUs to be created. +# If enable-dom0-ballooning = no, dom0 will never balloon out. +(enable-dom0-ballooning yes) # In SMP system, dom0 will use dom0-cpus # of CPUS # If dom0-cpus = 0, dom0 will take all cpus available diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/Rules.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/firmware/Rules.mk Tue Apr 15 11:09:46 2008 -0600 @@ -0,0 +1,17 @@ +# Firmware is a 32-bit target +override XEN_TARGET_ARCH = x86_32 + +# User-supplied CFLAGS are not useful here. +CFLAGS := + +include $(XEN_ROOT)/tools/Rules.mk + +CFLAGS += -Werror + +# Disable PIE/SSP if GCC supports them. They can break us. +CFLAGS += $(call cc-option,$(CC),-nopie,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) + +# Extra CFLAGS suitable for an embedded type of environment. +CFLAGS += -fno-builtin -msoft-float diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/etherboot/Makefile --- a/tools/firmware/etherboot/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/etherboot/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -10,21 +10,16 @@ T=etherboot-$(EB_VERSION).tar.gz T=etherboot-$(EB_VERSION).tar.gz E=etherboot-build -ROM_ZHS = $(addprefix eb-, $(addsuffix .zrom.h, $(NICS))) +ROMS = $(addprefix $E/src/bin/, $(addsuffix .zrom, $(NICS))) .PHONY: all all: eb-roms.h -eb-%.zrom.h: $E/src/Config - $(MAKE) -C $E/src bin/$*.zrom - ../hvmloader/mkhex etherboot_$* <$E/src/bin/$*.zrom >$@.new - mv -f $@.new $@ +%.zrom: $E/src/Config + $(MAKE) -C $E/src bin/$(*F).zrom -eb-rom-list.h: make-eb-rom-list $E/src/bin/Roms - ./$^ $(NICS) >$@.new && mv -f $@.new $@ - -eb-roms.h.new: eb-rom-list.h $(ROM_ZHS) - cat $^ >$@ +eb-roms.h.new: $(ROMS) + cat $^ | ../hvmloader/mkhex etherboot >$@ eb-roms.h: Config $(MAKE) $@.new diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/etherboot/eb-roms.h --- a/tools/firmware/etherboot/eb-roms.h Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/etherboot/eb-roms.h Tue Apr 15 11:09:46 2008 -0600 @@ -1,11 +1,5 @@ -/* autogenerated - do not edit */ -#define ETHERBOOT_ROM_LIST \ - ETHERBOOT_ROM(rtl8139, 0x10ec,0x8139) \ - ETHERBOOT_ROM(eepro100, 0x8086,0x1229) \ - -/*end.*/ -unsigned etherboot_rtl8139[] = { -0xeb40aa55, 0xbfe94b65, 0x68744500, 0x6f627265, +unsigned etherboot[] = { +0xeb40aa55, 0xbfe9ca65, 0x68744500, 0x6f627265, 0x0000746f, 0x00540000, 0x0034001c, 0x52494350, 0x813910ec, 0x00180000, 0x00000200, 0x00010040, 0x00008000, 0x506e5024, 0x00000201, 0x00008a00, @@ -24,7 +18,7 @@ 0x55506650, 0x468be589, 0x02468910, 0x89 0x55506650, 0x468be589, 0x02468910, 0x8912468b, 0x685d0446, 0x5066104d, 0x0f2e0e50, 0x000206b6, 0x5009e0c1, 0xe6e8146a, 0x8f2e5800, 0x2e064a06, -0x0648068f, 0xc72e6658, 0x00038406, 0x66000000, +0x0648068f, 0xc72e6658, 0x00038006, 0x66000000, 0x00020168, 0x50686600, 0xe8000178, 0xc4830010, 0x89175b12, 0x3ce85bdc, 0x0002ca01, 0x6650006a, 0xc0200f50, 0x586601a8, 0x832d7458, 0x0000247c, @@ -39,18 +33,18 @@ 0x1f07a10f, 0x8cc03166, 0x66d88ec8, 0x66 0x1f07a10f, 0x8cc03166, 0x66d88ec8, 0x6604e0c1, 0x00038005, 0x0ba36600, 0x1f586604, 0x500179e9, 0xbb061e60, 0xc38e0040, 0x131e8b26, 0x06e3c100, -0x14d1eb81, 0x2606ebc1, 0x00131e89, 0x8c06e3c1, -0x89d88ed0, 0x4c8b36e6, 0x78c98518, 0x99878d15, +0x1511eb81, 0x2606ebc1, 0x00131e89, 0x8c06e3c1, +0x89d88ed0, 0x4c8b36e6, 0x78c98518, 0xd9878d15, 0xbfc08e13, 0xc1831000, 0x8ecf291a, 0xfcfc89d0, -0x6066a4f3, 0x1f0ec38e, 0x5f4fb966, 0x89660000, +0x6066a4f3, 0x1f0ec38e, 0x5b7fb966, 0x89660000, 0xcf8966ce, 0xf3fd4166, 0x66fca467, 0x66506661, -0xd889c031, 0x04e0c166, 0x84a32666, 0xc7266603, -0x10038006, 0x6600014d, 0x87e58958, 0x5e89165e, +0xd889c031, 0x04e0c166, 0x80a32666, 0xc7266603, +0x10038406, 0x66000151, 0x87e58958, 0x5e89165e, 0x611f0714, 0xb80650cb, 0xc08e0040, 0x0013a126, -0x0506e0c1, 0xe8c11510, 0x13a32606, 0xc3580700, -0x0000e860, 0x815d0000, 0x0002b6ed, 0xfab9fd00, -0x8d000058, 0x06530db4, 0xbc8d0000, 0x0050d90d, -0xfca4f300, 0x50dab58d, 0xbd8d0000, 0x00000650, +0x0506e0c1, 0xe8c11550, 0x13a32606, 0xc3580700, +0x0000e860, 0x815d0000, 0x0002b6ed, 0x21b9fd00, +0x8d000055, 0x06530db4, 0xbc8d0000, 0x0059320d, +0xfca4f300, 0x5933b58d, 0xbd8d0000, 0x00000650, 0xffffffbd, 0xa405ebff, 0x0775db01, 0xee831e8b, 0x72db11fc, 0x40c031f2, 0x0775db01, 0xee831e8b, 0x11db11fc, 0x75db01c0, 0x831e8b07, 0xdb11fcee, @@ -106,7 +100,7 @@ 0x00000000, 0x00000000, 0x00000000, 0x00 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x0002bd01, 0x00000000, 0x90909090, -0x000090ec, 0xffedffff, 0xf8835858, 0xcb017500, +0x000094ec, 0xffedffff, 0xf8835858, 0xcb017500, 0x0804c483, 0xcd027502, 0xfb18cd19, 0xfbfa9090, 0x15cdf958, 0xbbf6edfd, 0x0eb4069c, 0x0001bb66, 0x0c10cd00, 0x16cdc031, 0x4bffe430, 0xb407b973, @@ -138,1398 +132,1398 @@ 0x0bfdc1c8, 0x500342dd, 0xc88c66d7, 0x04 0x0bfdc1c8, 0x500342dd, 0xc88c66d7, 0x04244487, 0xdda17d03, 0xec837eee, 0x08010f08, 0x02a80f66, 0x435c66a0, 0x7eddb777, 0x600e6616, 0x8938128d, -0x44070c03, 0xae3be850, 0x5dfdbedb, 0x050ced81, -0x98ad8906, 0x168b0591, 0x6fffbca9, 0x7400fedf, -0x90b58d21, 0xbd8d0739, 0x39054990, 0x390472f4, -0x890d76fc, 0x76fdb9e6, 0x3248bbfc, 0xfc89cf29, -0xe3e8a4f3, 0x362d8b51, 0xb3db6c29, 0xe868bdcd, -0x3f450c4f, 0xb70f1220, 0x6db7240a, 0x5c046ff7, -0x8d502624, 0x50608085, 0x7c548ffa, 0xfb7fd38e, -0xec01fb6d, 0x936158cb, 0x66a102a9, 0xe61f6607, -0x648b9d0c, 0xa37dd424, 0xf79cdcd0, 0xbe852696, -0xca9dcb9d, 0xbff62db5, 0x57565507, 0x10247c8b, -0x61983d2b, 0x8336a810, 0x68affbbb, 0xe8550e48, -0x5b217cba, 0xd637df40, 0x42a30eed, 0xbe778904, -0x29b4b923, 0xb6dbf77b, 0x732ea3f1, 0xf8ea2015, -0xb8000881, 0x6ddd1c10, 0xd88ebfff, 0xd08ec08e, -0xe88ee08e, 0xc35d5e5f, 0x89e64035, 0x77ee4435, -0x3d05f9f3, 0x584c1d48, 0x250b50a3, 0xfbac0554, -0xbb59e17b, 0x0300e968, 0x68535f1d, 0xe4514328, -0xf770fbf7, 0x890bb1e8, 0xa5282ca5, 0x6ca52f20, -0xde977b29, 0xe4cf615c, 0x8100768d, 0xa88fbcfc, -0x74d7ba15, 0xed0c6020, 0x02341b22, 0xbb7b1919, -0x17072db7, 0x7e8bd0ff, 0xf23b8b8b, 0x8b8b191c, -0x3ca18b15, 0x28d0bb04, 0x8be2ffbc, 0x68d6da4c, -0xfd025189, 0x597ff1b8, 0x08618904, 0x890c6989, -0x14796071, 0x6dc3006f, 0x1bcd0bdb, 0x8b08431f, -0x095a374a, 0xebf4f662, 0x0c6a08bf, 0x8b10728b, -0x051c147a, 0x4389ffb8, 0xb6959c2d, 0xbea29c28, -0x840c5401, 0xce8b664b, 0xb8bb188d, 0xef181f30, -0x21a29687, 0x2e9d5d58, 0xc3c2e428, 0x2b07357b, -0x38815080, 0x0f0d2300, 0x82858907, 0x68956ffa, -0x921b11d7, 0x284f2907, 0xd4bd530c, 0x5350ee68, -0x2c1d9da9, 0x2f024389, 0x03d4bedf, 0x88101f0a, -0x0c020443, 0x0f076388, 0xc231585b, 0x90c3db8d, -0xc6535600, 0x6cd6a10c, 0xbddaddfa, 0x70bb0010, -0x29c62904, 0xb801006a, 0xe6dfc2e8, 0x2d062e66, -0x056850e4, 0x6c0986e8, 0x38de176f, 0x18c03b80, -0xc03903c6, 0xb0050f93, 0x7f5d6500, 0x0921188d, -0x055a0603, 0x5bd30aa1, 0x145db6eb, 0x047f1887, -0x13026a10, 0x6c7dd7b6, 0x1c065016, 0x4eefb850, -0xe859602d, 0x793d2dbf, 0x66c2892c, 0x010a20f6, -0xb10f0374, 0xb6c730ed, 0x8843bbc6, 0xce961203, -0x3f7cb3c8, 0xefeffc1e, 0x95f7b072, 0x2e2c3f8e, -0x250304bd, 0x282f6cf3, 0x32c8fc23, 0xb0b937b5, -0x2d0c26c0, 0x30be0526, 0xa1e805fb, 0x83063126, -0x19b901f0, 0x01b0b939, 0x0c0c152f, 0xecb0ccb9, -0x29535671, 0x19e4b817, 0x47151539, 0x196d2f57, -0x66287b7e, 0x8dca13c7, 0x0a6a1887, 0xbbeeef4a, -0x2474db57, 0x2a24bb22, 0x3eeb8156, 0x2b186f0d, -0xdcd805f0, 0x01181820, 0x35fb3975, 0x14881dfc, -0x74d28566, 0x16186617, 0x0506e0a9, 0x6e0bad62, -0x017220d2, 0xbd16f9d0, 0x20debec5, 0x24e475c0, -0x10321d12, 0x1b07deeb, 0x0e6dfd73, 0x6cba8800, -0x07b15d56, 0x22c5cdb1, 0x55404d3f, 0x636e8f9c, -0x3b2c2c83, 0x06334440, 0xc36c619e, 0x31657df7, -0x7f1e39ed, 0x1406500c, 0x3dafd986, 0xb0034673, -0x65e805e1, 0x03fdb74b, 0x02d081db, 0xf63a75fb, -0x34b22404, 0xb5deef91, 0x23e4405a, 0xb9fc0adf, -0xa5f34e05, 0xae868343, 0x14c5dffb, 0x850c7d60, -0x21a574db, 0x1b9db206, 0xdb5ae70d, 0x5f87d889, -0x0e070939, 0xb07c08fc, 0xe81c8f5d, 0x140101ed, -0xfffe98e8, 0x0bdbb9fd, 0x2f60a3ea, 0x0ab4e80f, -0x6c682096, 0xdbf36d06, 0x1364a30e, 0x10c4ff3c, -0xc2fb704e, 0x3284dcdb, 0x072a05d3, 0x74a3990a, -0x7dc27608, 0x0d64a1b6, 0x086805c7, 0x90790924, -0x003cbded, 0x15897009, 0x73db6378, 0x057c0f9b, -0x19800911, 0x83b1b210, 0x23840975, 0x8c2288a3, -0x1bedb73c, 0xa12c906c, 0xf8843159, 0xd8f9867c, -0x0f726896, 0x89fc1489, 0xdb4f0805, 0x0c4e6bff, -0x470ceb2b, 0x3914c183, 0xe7d91ff8, 0xefdb7fb9, -0xeb756663, 0x837f918b, 0x928131fa, 0x5f3d5277, -0xff86f0db, 0xbd4b772d, 0xf6318400, 0x372b941e, -0xa9bf6bf8, 0x23d6391b, 0x770c72ce, 0xd876c53c, -0x06ef12d8, 0xc30da98b, 0x3fc70729, 0xbdac3b16, -0x19d20935, 0x2fef623d, 0xff4b472d, 0x8944777c, -0x399903c3, 0xf7c2fc37, 0xb113d689, 0x0cab3b27, -0x06772e72, 0x267608a3, 0x8d6ed977, 0x4367413b, -0x77440d72, 0xd9b1cf3b, 0x260856dd, 0xd619218b, -0x30333589, 0xf762c1c2, 0x862787d8, 0xf8675a1c, -0x18a3cc8d, 0x34ace5e9, 0x64c82c14, 0x9879f65f, -0x097481c7, 0x5d760c78, 0x4bb3eb3a, 0x2b9013b8, -0xbc6fef05, 0x36b2c3a7, 0xeb9b14be, 0x6dc5811b, -0x213fffeb, 0x75455246, 0x5703662e, 0x21116204, -0xb58e044f, 0x3d09c344, 0x89d3aa3b, 0x4aeffdf1, -0x170bb72d, 0x0ae7c1fa, 0x8166c729, 0xbadd80fa, -0xcabb0b75, 0x8944c38e, 0x150369d3, 0xfc777d6c, -0xffe28125, 0x1a8c8db8, 0xd6fc8906, 0x5c3768ea, -0xf2893942, 0x772096a6, 0x465edf7f, 0x5c12ebc9, -0x02c7044a, 0x00c2816c, 0x7549667c, 0xb772c40b, -0x70e946ec, 0xcc42e4df, 0x5c3bb3af, 0xa109bdf2, -0xb90408d0, 0x660d83ee, 0xc99c69b8, 0xf0662c89, -0x33e8ed1a, 0x232404fd, 0xfbe177b5, 0x535723de, -0xd3bf7705, 0x1ce88151, 0xfb85c826, 0x2bf9897b, -0xebc1390d, 0x1676be0a, 0x915d0b73, 0xda832472, -0x5fcad7e3, 0xd2b796db, 0xc2e2c117, 0xf31ecb07, -0x140b60d7, 0x5f72a732, 0x0f63738d, 0x25742a72, -0x5b9082a1, 0x37bb870d, 0x97032fb6, 0xe9821ca3, -0xd2a6fc9e, 0x8a6b160d, 0x2e7c9d24, 0xbbb7ad61, -0x51d1753b, 0x10883a68, 0x473058e7, 0xa6ee4dde, -0xe8088cfe, 0x10b41e05, 0xbdb239e8, 0xb9db1a67, -0xbc084657, 0xb1421983, 0xe8a77e1b, 0xd9e8f291, -0x22c962fe, 0x23b82894, 0xc1781d7b, 0xdc11f0fd, -0x9a8dd029, 0x00e3810b, 0x86ffe41b, 0x0d8bb705, -0xecde8715, 0xc839ce29, 0xd8390c77, 0xa36df847, -0x12fb6477, 0x0476000a, 0x56086e58, 0xfa4c5afd, -0xe851d129, 0x2f4de497, 0x18473529, 0x1e44ef7b, -0x438b599b, 0xcdb2c829, 0x07537899, 0x6904764f, -0x74ddcfd8, 0xda34d039, 0xafb10574, 0xaf40ff08, -0x05a97b30, 0x573fe852, 0x0d8b2c08, 0x06d549a3, -0x140a602c, 0xc849db0c, 0xc0847a25, 0x5af60d75, -0x8c675045, 0x1f845b34, 0xb95c0958, 0x2e5a7ce8, -0x8b56c4a0, 0x086808c5, 0x2bcc2620, 0x99b5f1b6, -0x5359563d, 0xb7efa412, 0x21856bef, 0x5230262d, -0xbe7974ed, 0x6c1a1054, 0x892408fd, 0x89d729f7, -0xdd0e0715, 0x54fe3eb1, 0xab898389, 0xf7839f82, -0xdd36b80b, 0x2d8943de, 0x3354550f, 0xdefb8386, -0x21fd2c5c, 0x8c8a1554, 0xeac1fed5, 0xb1e37d04, -0x960313db, 0x43688b89, 0x352b0257, 0xe0db966f, -0x3e060c59, 0x5b788fd9, 0xaa9d629c, 0x370f1d3a, -0xfdd62946, 0xbb73061c, 0x6e36da92, 0x53e2f1a5, -0x06047902, 0x685dfb0b, 0x007e1db4, 0x74b5153b, -0x6d80d602, 0xea8177e7, 0x03828ba0, 0xa041585b, -0xcb3ca114, 0x85b3ebc5, 0x2822191a, 0x11048ddb, -0x7432377a, 0x47207b14, 0x8dcd87cd, 0x00be9691, -0x2b9a1915, 0xd0408934, 0x4f1b56f4, 0x290c2bc7, -0xf7fe91df, 0x28b5386c, 0xbf6687d3, 0x760d8f01, -0x5678c7b0, 0xc65915e8, 0x180475ff, 0xdd0bc601, -0x17bb22ed, 0xc31458fd, 0xf45e5502, 0xcf730403, -0xc13321ad, 0x181be101, 0x305d0e93, 0xe0062da1, -0x9fd917d8, 0x2f485721, 0xf8890603, 0x2b061712, -0x095bcfb5, 0x1045fb43, 0x02a66e31, 0xc19946c9, -0xde0d6203, 0x181c5b6a, 0x1c42d213, 0xad0cc903, -0x3d03dee0, 0x3c497611, 0xe36c584b, 0xe7338190, -0xdfd66189, 0xd2b01c76, 0x526e2d84, 0x5708b150, -0xd7c74be8, 0xa495736e, 0x17e9910c, 0x3da7312d, -0x2904d8b0, 0xbbeb4246, 0xb7c2d82e, 0x03ec0dbe, -0x0ac9104d, 0x46fe26d4, 0x03014c2c, 0x9bfce183, -0xa4c45504, 0x2910be8d, 0x5b5154cc, 0xaee27c84, -0xf59ab745, 0x066bd054, 0x875dec89, 0xe860a13f, -0x8b4c9294, 0x79a4249c, 0x6e015a9a, 0xc4f76435, -0x4260b94b, 0x6cf85e2e, 0x7408998d, 0xc8979d65, -0xe6815b12, 0x06ba0c05, 0xe85b51b8, 0x83d3c283, -0x4f75cd0f, 0x5b71363f, 0xc2ef8b19, 0x8e886b04, -0xddc1c695, 0xfec2835e, 0x17dd1f02, 0x8e108c42, -0x1bdff0b0, 0x7cf13941, 0x535250f0, 0x70125955, -0xf1fae381, 0x2a64f6ed, 0x4c0c2775, 0x75f0895b, -0x427645c7, 0x266f458e, 0xd97411dd, 0x4fbf8b6c, -0x00e8d10c, 0x6a20a86a, 0x8cf67c10, 0x02e47350, -0xe8d0dfd0, 0x5fdc91e9, 0x83542036, 0x6ae903c0, -0x90dbb3f5, 0xd1821301, 0x2cc51534, 0x9a36b75f, -0x5bc9beff, 0xc8b30e76, 0x1ac118a4, 0xf0ec16bf, -0x7b10bba9, 0x25008ba3, 0x09086841, 0x10cf08ff, -0xa98045bb, 0x2b7b9856, 0x60a1b1c1, 0x0abef339, -0x613f4ae2, 0xe20c5782, 0xebd93917, 0xa37e06db, -0x1604c109, 0xbec10142, 0xc10b5bf5, 0x8b0f850a, -0x40a1c85e, 0xa331ba2b, 0x651a36e5, 0x499cd330, -0xbf020847, 0x7d9c6c30, 0x830f026e, 0x03e5f0e7, -0x89ef4b86, 0xb964273d, 0xdce07580, 0x97257ef0, -0x0e838d0f, 0x8e2d189d, 0x36fd3a18, 0x05b88d32, -0x1ae19605, 0x76674098, 0x1e04d00b, 0x6f588289, -0xad1ef785, 0xe58309cb, 0x1dfaa4f0, 0xa57328d0, -0x68046a51, 0xb95d8855, 0xcfacfdb1, 0xf5c60555, -0x0707c658, 0x5d73a464, 0x05d3431d, 0xaf490e08, -0xa10c6c11, 0xba288883, 0x1c896c5b, 0x7b0aa62b, -0x74162210, 0x28c6c44b, 0xff510514, 0x74601805, -0x1c50adbb, 0x0d071d54, 0xc5b6cc1e, 0x283cb3ba, -0x070f2003, 0xaeb2022a, 0x8222c18b, 0x26032e13, -0x10ccdb6a, 0x7f11309b, 0x75321014, 0xe457b64f, -0x3643057f, 0x3ec6405f, 0x43757413, 0x054680ae, -0x06c6f948, 0x4e4a12f9, 0x52125005, 0x0436163b, -0x01586ad3, 0x738d3c3d, 0xfd18e196, 0x05432860, -0x68f104c7, 0x742b195a, 0xb5efff64, 0x06462554, -0x46c60201, 0x46942c08, 0xee9276d9, 0x461486ae, -0x5a0e2c0a, 0xec0f7583, 0x46ed1246, 0xe2140320, -0xeb1b1946, 0x160322ba, 0x1a281822, 0xf6131c05, -0x651e184a, 0x46e92446, 0x89560382, 0x46ac6526, -0xb7db172a, 0xe3833a47, 0x285e0c0f, 0x70b42c6a, -0x8f060868, 0x09462871, 0x8c80c768, 0xb63c77bf, -0xdf891cc1, 0x24d23468, 0x9d76d6e8, 0x375389b1, -0xd4df6a5a, 0x842c8971, 0x14ddac5c, 0x3b07f918, -0x96e0c1dc, 0x24ba3030, 0x09c6d1f0, 0xf7592dd7, -0x001ac225, 0xa705c2c0, 0xeb6b47dd, 0x6c8e62d9, -0x685fbaf0, 0xe9e804e3, 0xf91d21f6, 0x441bcc02, -0x235b1822, 0x36f415fb, 0x56567df8, 0x0b745339, -0xdddd9a9a, 0xb095be87, 0x97047401, 0xe80e68be, -0xf73df8da, 0x66241a14, 0xafcfc529, 0x4ef06e0f, -0x48cdb503, 0x81cd250b, 0x8d0af4e1, 0x02090a94, -0x9ad4f8e3, 0x4e83e0cd, 0x7f38de0b, 0x8a17a3c1, -0xbad0361e, 0x75d044a9, 0x01f38e17, 0x4c835fd0, -0x06296027, 0x80833062, 0xaeb4fc1d, 0x42845981, -0xa4d2e743, 0x91d4a0da, 0x9eb1c082, 0xfbd0c811, -0xeb291c1a, 0x70acb85a, 0xe3837d0b, 0x0b899392, -0x684bbac0, 0xd61d31b1, 0x5d7c325c, 0xebba178c, -0xe8671857, 0x23c3541b, 0x21dafc22, 0x05527716, -0xefc4e82d, 0x3634222c, 0x1c6de3c7, 0xfb30d08a, -0x7b6168d0, 0x66104f6b, 0x1102c010, 0x0af31982, -0xde180c1a, 0xdad4a9a0, 0xb1fbe083, 0xd46c36e0, -0x1204bef6, 0x800fe283, 0x106df6a9, 0x040e140a, -0x02334fbc, 0xb508947c, 0x2f46464d, 0xaf343018, -0xd8bf38ef, 0xcbeb2de8, 0xd820acd0, 0x4114abc6, -0xad036019, 0x81c55424, 0x77052a38, 0x20e277c7, -0x028b4676, 0x04428b43, 0xe898795c, 0x08076d8a, -0xdc04f57a, 0x302d6d0b, 0xd14a6b23, 0x989a0471, -0xe26f0ae0, 0x80c6b622, 0x8b0ddf83, 0x245d6317, -0x68167d5b, 0x8b0db89b, 0x0640b243, 0xbee1e927, -0x7fd76a6d, 0xaf09135b, 0x0a031072, 0x3790baeb, -0x2d1b0c35, 0xcb3c8c68, 0x49fae8b3, 0x753b6f99, -0x78cad904, 0xb05a15c4, 0x0bd9b239, 0x1fa8000a, -0x4e42888b, 0x9c09b46f, 0x638e5728, 0xbe02f8c0, -0xbbf4f8db, 0x07771aa1, 0xa085348b, 0xed147b27, -0x77761940, 0x7718651b, 0x1b741e54, 0x07760a48, -0xb81d6c7a, 0x19ff2cb8, 0x72db8c14, 0x02bae874, -0x921d6f86, 0x0dddb87a, 0xb81789ad, 0x3a397440, -0xd81ecdeb, 0xa73f0364, 0xa1247b8d, 0xf6530024, -0x75ecf25c, 0x497a33ac, 0x0b2994b2, 0x35b86306, -0xa0928e0c, 0x6a6461e2, 0x0c866303, 0x7d193153, -0x037ba054, 0xc377906d, 0x85a3208d, 0x205c6868, -0x851906bf, 0xc5ffffff, 0x09e7d350, 0xb0f631d7, -0xeeea8980, 0xedee88b0, 0xc383cb89, 0x872f7804, -0x4a2df05c, 0xd98877bc, 0xddb6f8d3, 0x89dedc3f, -0x4ff7c019, 0x8ba602e0, 0xc8832414, 0xed778a29, -0x080b7365, 0xd5794b8c, 0xbbed3e39, 0xeb65ee10, -0x8cbf5276, 0xf80fb1f8, 0x3dece6d1, 0xf725f78b, -0xc888c609, 0xeb7f9b24, 0xd426f7b0, 0xc49b306c, -0xc35f9155, 0x060b9e97, 0x534307cb, 0x4fa9538b, -0xb068c4df, 0x68ee37f1, 0xd4fb2e9a, 0xe31f4293, -0x09d80ec1, 0xfe690ae8, 0x8d686b8b, 0xf528b698, -0xa8ec3755, 0x48fc983c, 0x35c97f42, 0x3b13ec04, -0x8a5c5b8b, 0xfd920b04, 0x0dffefed, 0x8341ee00, -0xf27e05f9, 0x758d62bf, 0xf2899a37, 0x8400b9ee, -0xd8df00b6, 0x63445d0c, 0xb8efda89, 0x6245038b, -0x40e24f77, 0x99c8b4ef, 0xef30551a, 0xb858e028, -0x4c0d20c5, 0x1aef7266, 0xeebfdef6, 0x0704a5d6, -0x840eb866, 0x08210b3d, 0x08dd95bd, 0x05ef0c25, -0xb8ef663c, 0xb2c0d0d0, 0xa32c74e1, 0x35d8e830, -0x685c7bb8, 0x4be5bc9e, 0x85c243a5, 0x30559e16, -0x68f2fc22, 0xb30cce8a, 0x4288fc0b, 0x321c896c, -0xa3d7437e, 0x16d85c5a, 0xc0c85106, 0x0aee5206, -0x95b83b81, 0x39e88971, 0x81293d5a, 0x5e25c280, -0xb62694a8, 0x3fe15af8, 0x7296bc06, 0x8d57fb9b, -0x3a610756, 0x46e31e1a, 0x1452a150, 0x5ebda8d5, -0x3ebdca58, 0x17e47e58, 0x51224812, 0x9788ec58, -0xd766140a, 0x666251b6, 0x6fb86ee0, 0x01c4f67d, -0x31892eba, 0xfb0633ba, 0x9dbd8eeb, 0x0e38b852, -0x50063bb8, 0x5c72ff98, 0x68da7b63, 0x0750935b, -0x3029ec31, 0x3f04ccb4, 0xe852dc93, 0xc1a28041, -0xa016b7df, 0x7504a85c, 0x00c7182c, 0x1afe7e59, -0x40c776dc, 0x4c064948, 0x20501bf3, 0x1811061e, -0x1a5fcc8c, 0xdb166204, 0x8d1c683d, 0xee4adb54, -0x44fd301c, 0x2c0aa312, 0x0edec486, 0x3746b876, -0x6a233b7c, 0x17425d06, 0x682ce3bb, 0x66e803dc, -0x7712524d, 0x208a6454, 0x5411e2df, 0xf93bbbd8, -0xe868d42e, 0x37534013, 0x11ea6838, 0xe7c0777e, -0x7f0ec32e, 0x4a83c608, 0xfe014300, 0x3bebadf8, -0x358bf376, 0xb5148d5b, 0xcff7f114, 0x6630d6e0, -0x81687703, 0x6e8d25c1, 0x8182d620, 0xefea0bde, -0x7230cb81, 0xde1ad910, 0x1eefc0b0, 0x1270faeb, -0x3e614f8b, 0x157378ea, 0x2515f758, 0xef1b800c, -0x95a186e0, 0x95500700, 0x870beae0, 0xf02537b9, -0x6224db72, 0x5b1032b1, 0x850a0df1, 0x8d1374df, -0xf0031846, 0xa3e10d06, 0xe81f93d8, 0x2be3e8f8, -0x49488c05, 0x6ec0b642, 0x7942dc34, 0x0ceb664e, -0x60c301a8, 0xc52d2580, 0x42f0f5aa, 0xb26dc7b3, -0xdbb7840d, 0x15389082, 0x52e8db68, 0x35dd80ae, -0x2d5c0d1e, 0xd47ad495, 0xad81fed5, 0xc11e252f, -0x3ea810ef, 0xc0771140, 0xff83653f, 0x35860f3b, -0x6deeff81, 0x1ed12ff7, 0x8d3a0e7d, 0x003dfc4f, -0x644e2d20, 0x77f70d1b, 0xfcbb8d9b, 0x50d32941, -0xcc828d53, 0x9bba1045, 0x6076d4a3, 0x29a80b21, -0x1983a5d8, 0x05142bfa, 0x5e035e6c, 0xf1d7ff60, -0xbc18cad7, 0x07478d79, 0xb60aa3db, 0xb8b83815, -0x38a2cde3, 0xff618398, 0xac519fbe, 0x0001baef, -0x4f031af7, 0x081447db, 0xc51f3f49, 0xf21b5825, -0xfb1cf0c6, 0x23f5ffff, 0xecbc752d, 0xeb855153, -0xdc088291, 0x6d028101, 0x06765113, 0xdbaf8008, -0x9146cc97, 0x25ed8352, 0x49267fac, 0xdbc36f85, -0xc3660374, 0xeb8a530d, 0x6fb01af6, 0xf02185e6, -0xc3ee36c2, 0x76e8ae35, 0x23d7f1fb, 0x73987059, -0xc864aae8, 0x988bdcbf, 0x09601719, 0xc0649be8, -0xebc08887, 0xb9f42151, 0x3c173a19, 0x52a6fe96, -0xd7765e68, 0x44ef0b15, 0xe819f840, 0x2e5be811, -0xcf8c10da, 0x796aa1bf, 0x1d6d6faf, 0x080c89c7, -0x0131f8ca, 0xfadb3b00, 0xc38aa5db, 0x0c4384db, -0x08743a3c, 0x0b1eb343, 0x7e1eec2e, 0x64bff475, -0x056c9486, 0xff791f73, 0x36243f37, 0xd114c03a, -0x8331f24a, 0x57e108c7, 0x721e67e2, 0xf65653e1, -0x3a526859, 0xf6fd1fa4, 0x5a04478a, 0x34986859, -0xb229ef73, 0x41ec1a96, 0xaad24c85, 0x70589603, -0xe928092d, 0xbc42461e, 0x50c3c344, 0x0843ba75, -0x03428dfe, 0x4fe2ddc2, 0x037a8082, 0x25740d2f, -0xd59377d2, 0xe851e847, 0x180c17c2, 0x3a388031, -0x77e8f07e, 0x3980311f, 0x5280752f, 0x516568a8, -0x56ebf764, 0x05e889a3, 0x3e585e84, 0xd3eb42f0, -0xe9040500, 0x01402773, 0xfd0aaeb7, 0x756a525f, -0x33815251, 0x78783917, 0xa308ee58, 0x92f3eb10, -0x332d7f11, 0xfc053d36, 0x61a8dfb9, 0x47850343, -0xb84af0e4, 0xbbb7bb17, 0xc604eb17, 0x903d4004, -0xfff5726d, 0xa501bc1f, 0xbbe8fb69, 0x06153d65, -0xc8c268f8, 0x6e56bc02, 0x9a8eeed1, 0x0462dbdd, -0x74ed179a, 0x04e9f3e8, 0x8860c1f8, 0xaeeea093, -0x02e647e8, 0x6ac61db3, 0xf479c03d, 0xf4b7b406, -0x8515b2b4, 0xcd8c6447, 0x0b21db22, 0x0d1f99e0, -0x2e26f75b, 0xf9097e3a, 0x01b58e0f, 0x8408fe72, -0xbbda1ad9, 0x4a7f6f35, 0x6f09f685, 0xf17a1800, -0xf3d1efdd, 0x04e4a13c, 0xbe0c50ff, 0xd8ec46ff, -0x71f07519, 0x33219875, 0x375fc2c6, 0x09a1c202, -0xb8f8658d, 0xa7bf66c9, 0x04feedcd, 0x8c020d4a, -0x79fea9a2, 0x04f72774, 0x71b97c3e, 0x414599f0, -0xbb33ec3d, 0xa10b4075, 0x3d927ffd, 0x742e0df0, -0x9f7ef06b, 0x9beb621e, 0xba9290e3, 0xe5076c4f, -0x053bd548, 0x08940418, 0x5029b41f, 0x926d1943, -0x4755cc68, 0x7a58532d, 0x6bc14644, 0xe8a37731, -0x4e22a443, 0x8e105b24, 0x95e005fc, 0x09badc09, -0x30d8cdb7, 0x2ee90333, 0x73344553, 0x7666ec10, -0xda46b9e0, 0x2e09befb, 0x49ca0406, 0xe78e7ab5, -0x9429856e, 0x4df200ee, 0x5f85e9d9, 0x6b782b81, -0x396fc985, 0x63d02042, 0xe75f3ec1, 0x9644b17a, -0x75fbe991, 0xbec4ba87, 0xb80b57be, 0x7afdc4ca, -0x0e047bf1, 0xe9103e63, 0xfdfe8c2d, 0xbbdf6360, -0xb8fed002, 0xecae0356, 0xecd9d809, 0x18b7e9ef, -0xfb011442, 0x22a753ae, 0xa10d873c, 0xe25e78a6, -0x06bbdcde, 0x6a36147b, 0x8dd46801, 0x344c686e, -0x3b63ba01, 0x2826fa3f, 0x6885f9e9, 0x1323ab23, -0xc2ae3730, 0xfd9cccd4, 0xf0ea4860, 0xc86f2243, -0x425e1318, 0x372be94b, 0x2231ef24, 0x2999084d, -0x34d3880f, 0xb3cdb043, 0xfdc9ee01, 0x5d31fcd5, -0xe19868ba, 0xacc746e8, 0xef87a5ae, 0xf1f829df, -0x950c8d42, 0x16a3a162, 0xd3c5f02f, 0x7f0f05e8, -0x21ebc107, 0xd0ac61f0, 0xa322d0fa, 0xc60a7e0f, -0x17963719, 0x4f0d75e2, 0xf14ac503, 0x0ba1778e, -0x89687fe6, 0xbecdb6c2, 0x6082058e, 0x8ba6a331, -0x5bd8b50a, 0x14e77ae2, 0xbf7b86ab, 0x31fd8fb3, -0x0d105089, 0xa11c5889, 0xbe8a2021, 0x7845a803, -0xd301c767, 0x84fd3991, 0xebccc6c7, 0xfe98e9ec, -0x3be802c9, 0x07849c15, 0x3634ac17, 0x2efa85dd, -0x689dca78, 0xac4c9c2a, 0xfbb03fdd, 0x48fa81d1, -0x247c7669, 0xbe0f1869, 0xb896401d, 0x6fe01621, -0x746f4813, 0x7e307728, 0xc76f3855, 0x8d566172, -0x4e87c5b6, 0x622005c6, 0x4d6ee483, 0x8c26425b, -0x27613488, 0xfa2c047b, 0x74237850, 0x5f673a2d, -0x27e87b0f, 0xf7caeb33, 0xaa012757, 0xe8ee91ee, -0xb712fb58, 0x0bf308e8, 0xcf6893ab, 0x60fec36a, -0xcb10e206, 0x83be017e, 0x3950783c, 0x4dc589da, -0x07870f34, 0x061f0301, 0x0488af21, 0x1620d939, -0x247a043f, 0x8ac4820f, 0x0e76cb39, 0x6db9aa39, -0xf53985a0, 0x35010f17, 0x3396e51b, 0x28f4fe16, -0x2c416c12, 0x98f56a3a, 0xcbb6bc1c, 0x0bd8cea8, -0x27fe1e14, 0x03d421cc, 0x6c811ea3, 0xf50e01c1, -0xde380d8a, 0xbb3dd6dd, 0x09789113, 0x390d8b2c, -0x281f1c03, 0xf74dfba0, 0x7c76b972, 0x77142c0f, -0x8b0a72ad, 0x1b753913, 0x77f3eede, 0x346c3ba1, -0x34781376, 0xc82b092b, 0xa90c85d5, 0xc3d989c5, -0x47c05f6a, 0x8d3eebe9, 0x80ee98b0, 0xc1fd3eab, -0x5351561b, 0x10706855, 0xc42f40df, 0x3c3a1053, -0xf69febfb, 0xff8bb122, 0xfac03119, 0xb4fb191b, -0xa38bdce0, 0xd482d86f, 0xdf0471e9, 0x50ae9b61, -0xd1eba446, 0xa90ddc54, 0x2de8f508, 0x98c29d24, -0x80f47091, 0xa0794e53, 0xd080c155, 0x36f4d0d3, -0x10ce3a2b, 0x500c0707, 0x80f990b8, 0x4d2d791d, -0xd2ef4dce, 0x81baee17, 0x6838142d, 0x009f9aaf, -0xb42ab14b, 0xe86cdb64, 0x3075f94c, 0x4899187a, -0x5b08cb5f, 0x583d58c2, 0xbea4a1fa, 0xa19724d6, -0x2422f1cb, 0xdda24aa1, 0x1b92ddf1, 0xb0291cb4, -0x09cf8905, 0x1b7674d7, 0xd518a085, 0x392e2bee, -0x6dda5df1, 0x0e726fdc, 0x3986821c, 0x037ab0c2, -0x86085a5c, 0xa9249b29, 0x0ee0beb0, 0xb47a0876, -0x08b8a109, 0x34743374, 0x445d4b3f, 0x77d8428a, -0xbc329436, 0x5352c3df, 0xa1ba8d08, 0x24c62ca0, -0x445220e8, 0xdbd632c3, 0x01c350b0, 0x1d1d01b7, -0xada2663c, 0x4115a337, 0x5ea2e418, 0x8ce9d46b, -0x69bd81ba, 0x416dbaca, 0x160ff7ac, 0x770269c2, -0x6f442d0b, 0xa8efedee, 0xac2d131a, 0x72140324, -0x1cc4a605, 0x700750b4, 0x1636460d, 0x5cea203d, -0x7efe6fdd, 0xa0ba8363, 0x063a014a, 0x5aeb6f75, -0xac1398b4, 0x60640edd, 0x823a37ff, 0x95398fdb, -0x06774048, 0xf939c872, 0x7fdcc472, 0x742708e8, -0xe0c15716, 0xa4808b05, 0xfef43526, 0x413970af, -0x89a77340, 0x10458b35, 0x8d8e1067, 0x7f624661, -0xd8c25b9d, 0x1b76dcd7, 0x8637e6c1, 0x8bdba3ac, -0xf62ceda4, 0x8e8b31a9, 0xb0dbae4c, 0xff4c3611, -0xea11f801, 0xd319c129, 0x8d0d1f42, 0x845b6dd6, -0x440f991d, 0x392bb040, 0x5b09ea09, 0x085c7fab, -0x1638821a, 0xfcfb1e01, 0x25f02835, 0xb7290900, -0x3ddedf8b, 0xc1014f33, 0xcd01fb11, 0x5e4d5c11, -0xf07dd43b, 0x09f8ac0f, 0x5b5d0c1d, 0x85740171, -0x3a489e1a, 0x6d8dff38, 0x1584d7b4, 0xa34d8294, -0xdc1a154e, 0xc143eda7, 0x780de31d, 0xb91c6a79, -0x09dbfb82, 0x3db715bc, 0x88881072, 0x2e2c7c3e, -0x55068406, 0x68346a08, 0x3aa3e84f, 0xd30a6d03, -0x0e9458c7, 0x68746c5a, 0x6fc23218, 0xd6ed0c0e, -0xde290598, 0x2f50c706, 0x06b82ded, 0x2dd8112e, -0xaeb81127, 0x34d5b440, 0x3226f996, 0x088017f8, -0x688dcf69, 0x31697e34, 0x9f91d4db, 0x58c3c049, -0xea75bb83, 0xf0fe2304, 0xff57833a, 0xb9bab4b3, -0x6d85f628, 0x55692051, 0xef9350e8, 0x867bd3d9, -0x16726ca1, 0x38ab0351, 0x63a1aefb, 0xaea87f57, -0x3966dfc0, 0x383474fa, 0xa24f7607, 0x8e0c3155, -0x8e3cbebc, 0x02e14221, 0x5d6deb41, 0x026ce0f1, -0x16e9b44e, 0xc889d29c, 0x2ad58e24, 0xe8671a39, -0x25740e59, 0x6b0dc220, 0x72844005, 0x59de08c5, -0x57e34bff, 0xa850e2b8, 0xec5b7eac, 0x052ee52d, -0xcf1b7420, 0x604f3ce3, 0x4e6ff329, 0x55b0533b, -0x63e952dc, 0xc8bb516c, 0x19da29de, 0xc61ca78f, -0xa1b36918, 0x10ce154a, 0x2b5381b8, 0xfdebe928, -0xc0ddb1df, 0x3d802cfd, 0x25377f45, 0x0544af81, -0xec1c0d62, 0x2d021020, 0xe0a1ece0, 0x81146cc0, -0xf8f4cbca, 0x402d0914, 0xa553b58e, 0xd6804d4f, -0xed85ce48, 0xdd1bdb82, 0x1d8ad94f, 0x32eb1d44, -0xfc4c8ac8, 0x87e1c1a3, 0x34ce488f, 0x38a3f887, -0xdde25cc1, 0x881a99a2, 0x25992315, 0xb625e9f0, -0xc1dce20e, 0x90148da8, 0xbbf0c8f3, 0x2d840cb1, -0x84263c15, 0xb6bd2522, 0x7593dc06, 0xdc58756e, -0x9808232f, 0x222017ea, 0x9f1c85a2, 0x4ae80268, -0xb5a07304, 0x72b44ded, 0x7a8b47d5, 0x13468a0c, -0xc0da5762, 0x7c0336b0, 0xad7af50a, 0xb61a376f, -0x80186c4f, 0x047474e8, 0x0a7b7402, 0xa1bfe10c, -0xe9c82992, 0xbd9bff58, 0x1d35c01a, 0x7544869b, -0x7bc0486a, 0xe433a177, 0xeb89fb3b, 0x3ded0476, -0xb1b7868c, 0x488fcda1, 0x743d9242, 0x97cf5b6d, -0x2129945f, 0xaf509854, 0x254ab5e1, 0xa3ad269a, -0x5f6de019, 0xfed3e9c3, 0x6e01faa1, 0x036d0be9, -0x7d8484da, 0x251f10c0, 0xd5b86717, 0x28461213, -0x71b1323b, 0x783424a4, 0x4b60522a, 0x16fd3c0c, -0x3573282e, 0xb9d21b2c, 0x0d121e08, 0xda65a05b, -0xf88c77db, 0x8d05eb00, 0x29522e90, 0x26b07030, -0xdf940536, 0xd9733550, 0x07630763, 0x335a58a6, -0xf69c3a1a, 0xdfba3c1b, 0x74932505, 0x5106e60a, -0x1e2bbb88, 0x518973db, 0xd7169e0a, 0x82eefc04, -0x6b400d50, 0x5031048d, 0x0dc1998d, 0x511cd0b8, -0x845233a8, 0xd837f7e2, 0x756919e9, 0xd292d50f, -0xc37c026a, 0x2b56507b, 0x1827901d, 0x3c70e853, -0xa6bddc2e, 0x4a35c020, 0x5b5e0831, 0x3edc193b, -0x05c35e6d, 0xd98c52e8, 0x87d809e5, 0x98a3683f, -0x0e022404, 0x2e3a3deb, 0x6cae6fc5, 0x428d1c32, -0x77d766fc, 0xf6706b07, 0xeb046dff, 0xe9a8e890, -0x840bffff, 0x90420bf6, 0xeb1986ea, 0x49f8d5db, -0x64c4d81b, 0x1033ff8c, 0x35347760, 0x2fd52829, -0xa91b5e1b, 0x5553d59e, 0x6e3bd384, 0xb7f80d3d, -0x457fffdf, 0x3e74464c, 0x752ec031, 0x7d8175d1, -0x03133600, 0x31f4f11b, 0x60d639da, 0xbc75d389, -0xbd8eb5af, 0xd6533c41, 0x2cc8bba2, 0xe105c73d, -0xd6f16383, 0x1ca19bba, 0xb5b14525, 0x3d00bb41, -0xb1350001, 0x36b17049, 0xe80bfb1a, 0xa3a2bc02, -0x2dda9274, 0x7299b6e8, 0xb6340888, 0xa3238d75, -0x2707742b, 0x058c0320, 0xbe60ee06, 0xe8776013, -0x816a6bbb, 0x12d7cc06, 0x325e0bc0, 0xc2af0a8a, -0x11151811, 0x3da2d0af, 0x006b811d, 0xd37d8c53, -0x4e05a780, 0xbf0414ab, 0x7ccec46f, 0xc668cb47, -0xb823203d, 0x9df276c0, 0xe6e9dcdd, 0x19de63fe, -0xba128106, 0x2fbaf6dd, 0x093a1fba, 0x5920bf84, -0x23f859b9, 0x5c00e7e8, 0x39106a53, 0x318dc320, -0x883a99f6, 0x8b0ce82a, 0x78a3c6a5, 0x8c6af7d0, -0xbc2e3e9f, 0xa352d405, 0xe8b9a38d, 0x167a71b0, -0x5f31f58c, 0xc60ba984, 0xecea156a, 0xc10a0251, -0x17b785be, 0x95548d27, 0x80021c3d, 0x7442be99, -0x36ffe36a, 0x3907bd76, 0x514676df, 0x43924b8b, -0x5fdde056, 0x010814cb, 0x0c5651f1, 0x51044b03, -0xa5ad5647, 0x7c741ff8, 0x0303438a, 0x1ed90873, -0x15f67b65, 0x5d5503b0, 0xb6755493, 0xc19ac524, -0x2682219a, 0x7facb052, 0x555c6348, 0x0039bbd6, -0xa224a100, 0x2e7ac5dc, 0x6e9c01e8, 0xc52aafba, -0x25087c0c, 0x49dfe901, 0xb0b06051, 0x5009cb2b, -0xcc298a52, 0xe0910a3d, 0xf7d63972, 0x0c0d8b06, -0x5fdc9b5d, 0x41a4353f, 0xdb196368, 0x0ebc3cf6, -0xf14da2df, 0xd4e91375, 0x2f015a13, 0x8d0fc339, -0x89e0e128, 0xe5d86e19, 0x4a3faddc, 0xa46c4a3d, -0xee407983, 0xf8b185c2, 0x8bd975da, 0x1e491298, -0x60f30b04, 0x77fdb6d9, 0x1d5c8dc9, 0xcb0a0c21, -0x1a833050, 0x9c301568, 0xdb81a728, 0x00c4ff12, -0x60eb1572, 0x3987082f, 0xe214c103, 0x0c241a9b, -0x8b277330, 0x3efd4613, 0x8dfb46fc, 0x348d0c4b, -0x0ec08363, 0x762ef001, 0xbad94e9b, 0x76073930, -0xd57417c6, 0x992cadc5, 0x281b1e74, 0x963f16a0, -0x2c9e1f70, 0x44e4d203, 0x106b35c1, 0xde80119b, -0xe84bb56d, 0x1fe9ed5d, 0x0026badd, 0x364a8e00, -0xa8096d19, 0x3809ac0c, 0x2032b6c8, 0x39e9b809, -0x90774304, 0x0c8e5c2c, 0x1d3c6434, 0x757db4a1, -0xb8a4eb0e, 0x7d31ae01, 0x8410ab98, 0xe1c1c54b, -0xb4ae232d, 0x2f423a5a, 0xdb6d407b, 0xa7fb703c, -0xc181fd4f, 0x505b8b9d, 0x4902718b, 0xd406fc40, -0x2203ceb0, 0x04ecdb20, 0xc6c60153, 0x516f1120, -0x3df30ee8, 0xb7dced84, 0x4a31a1c3, 0xa1187466, -0x8ded08c4, 0x20ff205e, 0x73a40d72, 0x70996609, -0xc091616a, 0x4e89e3ea, 0x92db92c4, 0x688b801b, -0x86443841, 0x376b518e, 0x5853a1bc, 0x4307eb3c, -0x467d3c7e, 0x1fbdb4ac, 0xe2c13e8c, 0xe5757405, -0x596c8a8d, 0x1aeee52f, 0x7348763c, 0x82132f04, -0xdbb9bab4, 0x448663be, 0x1c440f76, 0x76400c50, -0xd0ddd5b9, 0xb3eb40bd, 0xa248058b, 0x10c18540, -0x2201941c, 0x94f545b4, 0x627ba378, 0x412ba6f7, -0x3838f983, 0x41213486, 0x98050b80, 0x5dceaf86, -0x47052601, 0x76101887, 0xae1121ee, 0x572eff17, -0xe29a8334, 0x1411ed8d, 0x5a7b3339, 0x351ab845, -0xdc9e011a, 0x1300f120, 0x039001a0, 0x120edba6, -0x6e1392d1, 0x6c10bd77, 0x2df7f886, 0x2689a731, -0xd1015905, 0x398bc839, 0x738dbff7, 0x76d03906, -0x181e4102, 0x201ef70e, 0x0c137376, 0x1f23d088, -0x6ec44b0a, 0x76953bc2, 0x0f108e0a, 0xebfc0739, -0x7609108f, 0x68153b0c, 0x87eefe11, 0x546c0dc2, -0x1c07ff02, 0xc221d0f7, 0xdd6cd139, 0x3efb8d86, -0x3bd1297f, 0x55320b38, 0x570e250b, 0xd0bbde64, -0xc0cae188, 0x42c04666, 0x7e83e3ec, 0x930105e3, -0xca0e8b28, 0x0c234b47, 0xb87cc943, 0xbc72de15, -0x46e9e381, 0x68084018, 0x1c7ef1fd, 0xb37cdc16, -0x31aec035, 0xb23e0843, 0x4954a9bd, 0x10481e77, -0x7c80049d, 0x6c01c930, 0x8f0d0d0d, 0x56dc2e60, -0x86e9b1e0, 0x7d11eaca, 0x1edf8f08, 0x6d12ad93, -0x66ee2906, 0xd84c57a3, 0x6eb1168f, 0x4f3f5de9, -0x9d889dbb, 0xe29b8028, 0x7d032950, 0x4c69ba66, -0x7c684c7e, 0x17e9c316, 0x65cc89fa, 0x12ac2927, -0x26859404, 0x24703576, 0x02281501, 0x8f8546c0, -0x00e800ce, 0x76160ca8, 0xe8bafe1b, 0x82fb3909, -0x730c0835, 0xd410014d, 0x45afed16, 0x222e73eb, -0xac7b05da, 0xc2f98ffe, 0x3109eac1, 0x19d629c9, -0xd80142cf, 0xd2f62c89, 0x3f891b1b, 0x29882fa3, -0x513989eb, 0xb8344922, 0xc8df6f27, 0xf06f06f1, -0xfde4ad72, 0x09f031fa, 0xecef5b6d, 0x5e4074c2, -0x09df3ea1, 0x58e80149, 0x295a36bf, 0x55304ec5, -0x57001553, 0x41416338, 0x332a1561, 0x8c6dbd83, -0x2594a191, 0xb2d8a592, 0x77f166c5, 0xb951e9b5, -0x1e08293d, 0x090b6496, 0xd7e83d0c, 0x2c3bc2c4, -0x5964a3b9, 0x250134f7, 0xe1550882, 0x71f82330, -0x37e9c712, 0x8eda9090, 0xd2382960, 0x0ddcda31, -0x73f02fda, 0xa0c1f625, 0x740e04b6, 0x2687b903, -0xc2c33468, 0x95315b81, 0x46fed1a6, 0x2bfc1083, -0xd93941d0, 0x9e0edb72, 0x7ea004e0, 0x0ccb54ea, -0x2ad12edd, 0xd2f71cc1, 0xd8027416, 0x25475c05, -0x02ba1cd2, 0x891d3d3d, 0x2d05efba, 0xc03df706, -0x78c80de7, 0x787817ab, 0x55b85f69, 0xe9f713ed, -0xa160dfdb, 0x1fc5c8b3, 0x290cfbc1, 0xdb5b35c3, -0x026c475a, 0x6f07d583, 0xe086c309, 0x027ad0be, -0xbbcbc129, 0xca2903e2, 0xdcdb4086, 0x16c24fd6, -0x800223db, 0xddbdb115, 0xd17711c8, 0x89430be2, -0xf67827d1, 0xeaac4149, 0xf5e8c05b, 0xbd0579d0, -0x646dab69, 0x15bf0f40, 0x05b6c268, 0x100c6cde, -0xab288aeb, 0xe3297f16, 0xb744700d, 0x841e8aa1, -0xf8d6fc30, 0x74144346, 0x9f418a1c, 0x88da8818, -0x06ff7ec8, 0x2bdf1c4b, 0x75c238df, 0x1f47460a, -0xf0bfe475, 0x7d1bd52f, 0xc3be0fdf, 0x04dfe183, -0x295ed1be, 0x721a3bd0, 0xdbf27814, 0x5b0a147f, -0x5e01eef7, 0x5b0e744c, 0x229bce5e, 0xc2f6fad2, -0x3842be06, 0x058d118a, 0xec76093c, 0x64b4382f, -0xad0eee92, 0xe005f495, 0x18b0518e, 0x31e1ea89, -0x15ff31f6, 0x884a184a, 0x7013644a, 0x021a00e5, -0xd07d34b2, 0x9d68e11b, 0x9a3b74d1, 0xffff6f77, -0x02ffa86f, 0x8942097f, 0x39802414, 0xc126752e, -0x094708e6, 0x7e0313c6, 0xf6ebf1c4, 0x7bf089c2, -0x0410c8c1, 0x8922c689, 0x0dc6bc30, 0x29a23947, -0x4407a4e8, 0xd1430a1f, 0xe9cfdee1, 0xf8bfedd6, -0x02eb1258, 0x64e460e4, 0xe1a8c09e, 0x0cd7a804, -0x097b86e0, 0x6f18c5e8, 0x0cb5e872, 0x18f89ba9, -0xe8f50168, 0x7f0bd00f, 0xfd51fbbf, 0xb097b8e8, -0xe864e6d1, 0xe6df08af, 0x08f8ec60, 0xa6eb1576, -0x834db627, 0x8b7bddfb, 0xf01d2e6e, 0x890d743a, -0x26e94b0e, 0x10bd4dd1, 0xe80d0642, 0xe29d67d5, -0xf619c3c8, 0xda3d80cf, 0x9bf9360e, 0xe82e2961, -0x23e810ab, 0xe5db6f7d, 0xc0958842, 0x6f13c064, -0x51cef7bb, 0x45eb5b7c, 0xe8187507, 0x92b34cff, -0xef2921bb, 0xae08cfe8, 0xc059e217, 0xfbce74b7, -0xfb07740d, 0x12280ab3, 0x74cb8c96, 0xf777fb70, -0xe8f33c77, 0x1bf878a2, 0x04041174, 0x789bba74, -0x75cc7dab, 0xff93badf, 0xba0b0aeb, 0x0f6baacf, -0x527c61f0, 0xbecdbe13, 0x861061d0, 0xe8db8410, -0x1361ce81, 0x1c5c1bf1, 0xe805eb58, 0xce72eb9a, -0xa306ee52, 0x1462f218, 0x1f681c27, 0x9f15f6c2, -0x1a2d708c, 0x07181a20, 0xd22ab041, 0xe05c8fb9, -0xd41fa7c1, 0x8dd0868d, 0xe20626be, 0xf8d63e0e, -0x688d08e4, 0xc1a350ed, 0xf00a818e, 0x433036ff, -0x990e80fc, 0xb900b08f, 0xddc6d7c1, 0x14c3a7c1, -0xa4a0c049, 0x4060cfbb, 0x8bedc19f, 0xdc831c93, -0xbf6c873c, 0xd577403d, 0xc4747817, 0x9d9a016f, -0x934b26bd, 0x4b4bc016, 0x04758385, 0x39f00af0, -0x0d72dfc2, 0x9e6a735c, 0x9672ea99, 0x6c68dbf7, -0x75e4c280, 0xa9656911, 0xefdfbf0a, 0xea8130c2, -0x47e28107, 0x6d2c543b, 0xe4135fff, 0x14208d0c, -0x40d70b61, 0xce7ea3af, 0x9e7f56e9, 0xe8066be3, -0x39748976, 0xf75557f8, 0x03558ff1, 0x685350fc, -0x864acfdc, 0x6e75e820, 0xe5a24553, 0xcb1a775f, -0x2e00cb44, 0x4b629b01, 0x7f061cac, 0x72badc1b, -0x0fff65e9, 0x62c6d61c, 0x540c3906, 0x8b810937, -0x3058bc21, 0xd8a71301, 0xc993b20e, 0x426467fc, -0xbb89d3f8, 0x0131fc2d, 0xc3a19148, 0x85bb267f, -0x8be375ff, 0xe0a73ab3, 0xd9ad1230, 0x2abbff09, -0x5db0febb, 0xf2f73905, 0x76f21fa4, 0x73113932, -0xb7c2df2c, 0x66b439b9, 0x48fa139a, 0x0df88ea1, -0xf5143a85, 0xbb14d338, 0x39b9b007, 0xe7893309, -0xf73bf019, 0x9a77a068, 0x81750a77, 0x868d79a5, -0x2a604b68, 0xa07ceee8, 0x168046bc, 0x18a26fd3, -0xd8b1a81d, 0xba15cf02, 0x038275b6, 0x289f78fc, -0x582b115e, 0x7d237d0e, 0x4be2e17a, 0x06a328a1, -0x2041a27b, 0x52e0bffc, 0x0fbc0e04, 0x9c0d999f, -0x0672e9d6, 0x8275035f, 0x32a13d08, 0xc2ae7e29, -0x508dc8f1, 0x6a1c02fc, 0xc6821972, 0x51d31559, -0x70269489, 0x1532b6f6, 0x4ec31024, 0x3b62dc5f, -0x168b0cea, 0xb1da29e6, 0x2302b08d, 0x3ef84add, -0x3e78230d, 0x42ec15db, 0x0afc42f1, 0x480d89b2, -0x2c0cea60, 0x9604e722, 0x2f8cd062, 0x408bc2d9, -0xd94687fc, 0x070d63a1, 0x3cc239ce, 0x1d4ca57d, -0xf1bacaa8, 0x6817b5e2, 0x528b3050, 0xe87523f8, -0xcea450ac, 0x78c12f8f, 0x8c766095, 0xa2e6a164, -0x2289f417, 0x70d4dba4, 0x10b87ab5, 0xa71ae084, -0xa8971021, 0xb99e92e8, 0xbafbd832, 0x03281a20, -0xec230453, 0x35d30293, 0xf2086d20, 0x5f8f67b0, -0xb2fb24db, 0x5fe4e84a, 0x26417e00, 0x603515f0, -0xe8780375, 0x55bb4334, 0x375a5827, 0x4b1a0edf, -0x114b68a2, 0x397ea143, 0xa10d3883, 0x66ec8f01, -0xefbe7c83, 0x2256346a, 0x75337820, 0xee740fd4, -0x1a74a17b, 0x0a4f5f08, 0xe6c75be8, 0xf4a722b6, -0x2aa722cc, 0xa186df28, 0xebe80abf, 0x6128a9e0, -0x0927dc43, 0x594f00b8, 0xdfe83658, 0x8b3be605, -0x1d773ec8, 0x708b40be, 0xdc30be83, 0x17df305f, -0x26d715b0, 0x939e1f84, 0xc821ac67, 0x8b91128e, -0x8f633c83, 0x9d15b2e9, 0x551a3a75, 0x9f37320b, -0x297891e3, 0x0806189a, 0x5b590637, 0x74036805, -0x3d125e61, 0xf1761c04, 0x5b9be951, 0x21080007, -0x0200147b, 0xffc42475, 0xaf049db0, 0x501c438d, -0x422b13e8, 0xdb6c06f8, 0x140618ca, 0x8db63116, -0x1a020084, 0x1ff39db0, 0x22a1c5d2, 0x94d3cdb0, -0x403fa5a9, 0x18407209, 0x7e0946e0, 0xc6661c2b, -0x59784503, 0xede25841, 0x8845fe28, 0x0143c603, -0x05000437, 0xa689544c, 0x664ac88b, 0xa7c5f6c5, -0xe74388ac, 0x10090618, 0x4148c3b5, 0xda1baca1, -0x0fed0170, 0x14c46b06, 0xde899a07, 0xf6aae8b3, -0x4cd42190, 0xfd12f8e5, 0xa2eb0342, 0x10fe1363, -0x51a4e16d, 0x10403e0f, 0x410b0539, 0x643ef42b, -0x02411f80, 0x324236a6, 0x2df620c0, 0xee78342d, -0xaa14c294, 0x2feb29bf, 0xec2da8d1, 0xad4194b6, -0xcd408a02, 0x02dbf6f0, 0x3c23f83c, 0xe9ec753c, -0x46a56809, 0x609c76ee, 0x0fe302b6, 0xb074d4f0, -0x68891b01, 0xe5737b31, 0xed15441c, 0x0c6d5b50, -0x8819a370, 0x8a54d6db, 0x110688bf, 0xa89ad8c6, -0x4379b377, 0xe514e883, 0x01db0c85, 0xe801a0fd, -0x58c648e7, 0x5c16dd1e, 0x225a9837, 0xe8034356, -0x30ed10cd, 0xc65219c8, 0x2f112686, 0xf79ee228, -0x84e9c44e, 0x28272445, 0xa160991f, 0xb53f11ca, -0x110fb1e8, 0x4bc37ea0, 0xb7727e8d, 0x46c3eedb, -0xeb835114, 0x0edf860c, 0x5f030247, 0x0fc07304, -0x79475d0b, 0x6e3de8f0, 0x4536ebd5, 0x8f110aaf, -0x0623c35f, 0x823a7d07, 0x008925c4, 0x1f16c70f, -0x4fe50ca3, 0xc702e804, 0x030e0369, 0x33e8017e, -0x2a06eefc, 0xc7fa163c, 0x0df9834e, 0x5015e276, -0x40b475bd, 0x66e40c4c, 0x090d5a07, 0x6e9db321, -0xc066ed09, 0xd188002b, 0xad510bf6, 0x097d800a, -0xd8640f11, 0xd827db53, 0xe4555600, 0x0340c4c3, -0xcae76af6, 0x8f5dce54, 0x103cdfc6, 0xbd8d028c, -0x785fb3b0, 0x74b52c0f, 0x05663d39, 0x26778d04, -0x821fe336, 0x6f8db656, 0xfa3ee80e, 0x00d81330, -0xbae77dda, 0x7eddca4b, 0x11088cdb, 0xc7f63b0f, -0x51021b45, 0xdfb18eff, 0x531c5f38, 0x310ce856, -0x1677de0c, 0x20c78356, 0x1b60e857, 0x27fad9ef, -0x34680411, 0x5a0fea74, 0x06f336ec, 0xda316468, -0x666a550f, 0xd6b708e0, 0x402d0792, 0xe0e979fb, -0x26c08eda, 0xdbf70595, 0x0fc4852c, 0x16d18857, -0x740cc58c, 0x0b6a1b81, 0xc0316243, 0x12212548, -0xbff1bfc4, 0x0e6a8d38, 0xc60e528a, 0x0f0a3cbb, -0x42fea087, 0xc6e28d53, 0x7b899390, 0xa755682c, -0xb0544ecd, 0xa9433734, 0xf7fe7fbb, 0x2716c13f, -0xc674821a, 0x6ac1c3f4, 0x6519617b, 0xaf8f0c84, -0x62b380cf, 0xf4582478, 0x7046e91c, 0x1e7843a8, -0x7bcd8f3a, 0x3afc6c9b, 0x8422c683, 0x04560845, -0xa5df742b, 0xd6867572, 0x1387805c, 0x6be1836b, -0x277e8501, 0x26e89706, 0x6316d839, 0x4e0f30fd, -0xf88aaf6c, 0x0ba4f7b0, 0x4c1de3e9, 0xdb05dc3d, -0xff6dc286, 0x3e13cf8f, 0x093414ea, 0x14cffdb8, -0x0c8b74ae, 0x08748d24, 0x012278f3, 0x31cf12e0, -0x73cfd129, 0x736db60e, 0x15297785, 0x2034450e, -0x0efe030e, 0x0f7cf6f4, 0xfc15fdff, 0x01dfe7eb, -0x623f3468, 0xc42ba04d, 0x186ee8fd, 0xf8982fc4, -0x057e074c, 0xf81e07b9, 0x84a5fc52, 0xe8e3d3c3, -0xc751f2f6, 0xaa071c71, 0xa437d3a5, 0x29f9f799, -0xd1125fb1, 0xa4c1bbda, 0x8b54273c, 0xd6381048, -0x77d341b1, 0xa173748f, 0xca12c134, 0xa04323c8, -0xfe248b54, 0x96b5dbaa, 0xaa4f8db1, 0x460813b8, -0x5b046ec4, 0x07fe766d, 0x6274a1f3, 0x0616fc78, -0xe0d1c307, 0x1318bc80, 0xb6225ede, 0x05550618, -0x0604f07e, 0x41e06174, 0x54c03af7, 0xb4682303, -0x43c4cb80, 0x1917eb30, 0xec40b703, 0x54e72ba3, -0xd486d91b, 0x61101980, 0xf8e6f8fc, 0x31770fa1, -0x6851df03, 0x22a664c3, 0x01831487, 0xdc663804, -0x397df6ae, 0x43120601, 0x0406146d, 0x1554ed8c, -0x57171640, 0xd5b8c0a9, 0x55241414, 0x94cd252c, -0x13dd2c8a, 0x7450182a, 0xa96c019a, 0x4f0ebe22, -0x438d68d8, 0xf876506c, 0xb801b3d6, 0x217016e0, -0xc3db0ada, 0x0b39638f, 0xf6810b86, 0x7c3045b6, -0xb4199175, 0x2ee26b27, 0xb1df7526, 0x3e546856, -0x5914b80c, 0xee526b60, 0x18ede9c3, 0x7d28b977, -0x39197a5d, 0x3c6a78c5, 0xc69a50b8, 0x6604fc36, -0xe8823ca3, 0x9318341b, 0xe22c0452, 0x5b14cdb1, -0xc7000f5e, 0x9e6315d7, 0x1c02ea69, 0xe71a2971, -0xbf1c4a24, 0x8cfc360b, 0x06427437, 0x32ff2550, -0x6834df68, 0x2078e81e, 0x2be818ee, 0x592a1f1e, -0x665ac442, 0x671fbe5b, 0xdd10e71e, 0xec473ae7, -0xec112040, 0xc7220b14, 0x0722d9ef, 0x713a0224, -0x1354cf04, 0xbfa805a0, 0xcdbddb88, 0x4413abc2, -0x61932c35, 0xc5e8ff23, 0x23113b68, 0x22e9d99d, -0x3de0f01a, 0xcd04e38e, 0xc7b4ce0a, 0x502bfa6e, -0xd163e9ac, 0x19500176, 0xddb0b40d, 0x987ee013, -0xfb2d9136, 0xee12c76a, 0xc7561544, 0x2ec5eb37, -0xfa72e105, 0x0088e245, 0xb5b6dec9, 0x40b43de2, -0x0ca3affa, 0x9764aed9, 0x5002efaa, 0xf100f4e0, -0x6c14ef73, 0x5bc1ace8, 0x7b01ecfe, 0xba0750ee, -0xfe5de8cc, 0x0e1b7d68, 0xcc45843c, 0x0d028b5b, -0x71164848, 0x95dbdecc, 0xc1d4b8c2, 0x3d791302, -0xe118c30e, 0xf1bdd59d, 0x08f6688d, 0x5aa34714, -0x1ae9154a, 0x1c19e724, 0x6db10744, 0x204e0512, -0xb2f0602c, 0x84c076c7, 0x200da8e9, 0x206aa0c1, -0x984d9e10, 0x869a0263, 0x73ede4cd, 0xce04ed87, -0xc60fd40d, 0x03b1b520, 0xfda7c09d, 0xeb3a4d79, -0xc07fed04, 0x065d0fe9, 0x578da475, 0xc301492c, -0x0873752e, 0x6aff101a, 0x2f03426c, 0x105c8dd9, -0xf29ae732, 0x60c76ecc, 0x98fd61db, 0x16dc87a0, -0x1b52c261, 0xd009d82f, 0x010e8bb3, 0x8af67360, -0x2e1cef38, 0x13116c0d, 0x1f073622, 0x96a6ba29, -0x01780d72, 0x38124c59, 0xbb16e284, 0xdaf07549, -0x58c6bdeb, 0x7d05820a, 0xb05742b8, 0x1e10691d, -0x0249d039, 0xc6c0f040, 0xd5192458, 0xef790206, -0x12205e16, 0x2e472560, 0x69a1e789, 0x36f1b669, -0xaa3da3a6, 0x528ca541, 0xfe42768e, 0xa6e74805, -0x704d72d8, 0x85b19c0f, 0x7c0ac919, 0xb9c14188, -0x9ae9885b, 0x0ec1bef1, 0x59950bc7, 0x8b832115, -0xb4771aea, 0x4f72537e, 0x416dc50d, 0xce7d8a06, -0x2038fece, 0x098461dc, 0x6c057363, 0x86d26e08, -0xe0e8f197, 0x21c00d1a, 0x12107e42, 0xbf1e17c6, -0x7878b64d, 0xfc18306c, 0x87c49d38, 0x063c36e8, -0x7fd7e92d, 0xb1a58055, 0x5010da17, 0x26e857c5, -0x9a1819ee, 0x14afd885, 0xb4e997ab, 0x202520ae, -0xbd5285c2, 0x1a25522e, 0x809a9c1f, 0x531df08b, -0x28cc7569, 0x1ffd84fe, 0x63e9018b, 0x6a1c6efd, -0x35f65e80, 0x10a18a34, 0x0c040fb9, 0xd2c1c245, -0x428258a3, 0xad74d3ed, 0xd05ba841, 0xeefbae5a, -0xa3d84f63, 0xd703e535, 0x7e1adb31, 0xaf747df3, -0xcc22a31a, 0x257d2097, 0x8291a12f, 0x6c21209f, -0xfbf4fc8b, 0x8c24bce3, 0x8024b42f, 0xa4249c06, -0xdfffff83, 0x981583c6, 0x1e1e2c8d, 0xd8841a9f, -0x24d14f06, 0x44740b84, 0x7d3e0abc, 0x1801db04, -0xd02ce380, 0xd2711a04, 0x9ebe945f, 0x0d020886, -0xdb90a148, 0x44afc83d, 0x011f28a1, 0x520a9b4a, -0x816c7d17, 0x511868a5, 0x0c553089, 0xec3e4153, -0xc140ef61, 0x0131ec09, 0xc9f525c4, 0x47e83988, -0x8eb7cb1f, 0xf9b16b94, 0xbc9da004, 0x2fc5a874, -0xea0e8edb, 0x1b88b6f4, 0x0b73ee39, 0x3edd93bd, -0x0a467786, 0x89b8f572, 0x2854a82d, 0x8e05afc5, -0x20524c75, 0x2e186a15, 0xbd5744c2, 0x6c34e840, -0xb8c868b8, 0x2c6c50be, 0x2e0452f4, 0x5c1ebb64, -0x0141b67e, 0xbab60dbf, 0xf130047b, 0xd178225e, -0x44de1bdd, 0x687700dd, 0x423a49a8, 0x15fffffe, -0xd4c362c6, 0xa180d988, 0x27badf7e, 0x6a30a090, -0x804bac84, 0x75d8313d, 0x56c33042, 0x541a7f02, -0xe1b61135, 0x0330e5ff, 0x568a2b75, 0x03fa8001, -0x8d131776, 0x8b9b8346, 0xba68c4fd, 0xee1e37e8, -0xb3c2851b, 0xff0be027, 0x22e90230, 0xaf5c12c1, -0x576a580b, 0x156e837b, 0xcaab9b49, 0x75d284f6, -0xfb351a7f, 0x55bb3608, 0x08c050ac, 0x0801841d, -0x196465df, 0xb3810e2b, 0xfd308001, 0xa02361db, -0x961a9789, 0xff6a9275, 0xdfd805c6, 0x7318ee85, -0x006a1246, 0xfdd0e88e, 0xaa1c05e6, 0x560019b3, -0xc1f0ccdb, 0x8ee9b656, 0x01c18202, 0xdfb1eadf, -0x08954e74, 0xeb948f01, 0x5256ed89, 0xad1f6fe8, -0xa1791d0e, 0xff9ca47a, 0xbd287c22, 0x86cf0ba3, -0xc735c589, 0x32d84461, 0x891a483d, 0x54d7e0cb, -0xec04e96c, 0xfbad8a6e, 0x88609d09, 0x108b0e66, -0x5eb70310, 0x1409c218, 0xfedae78c, 0x48aa5edb, -0x311a7a86, 0x99ec8ec9, 0x95bfc1da, 0x73d13830, -0x3200b817, 0xed1839e8, 0xaf1616df, 0x1144dd41, -0xf980f372, 0x08487405, 0x09b68380, 0x31d14817, -0x0bad7607, 0xc9148db5, 0xf23db92a, 0x4b4535df, -0x4cd2c047, 0x3c02416c, 0x63db763c, 0xb002ebb5, -0x5051a13c, 0x5003c08d, 0x54309ad4, 0xd51c8091, -0x16e81964, 0x10bf3cd4, 0x510dd503, 0xa8cf4388, -0xafa3e916, 0xfe1d1f83, 0xc9fef7c8, 0xabd3fd80, -0x7e803e05, 0xea86a301, 0x9d981e00, 0x008680f0, -0x9a4f6b62, 0x1b724762, 0x150625c6, 0x1346fe58, -0x9c3df6e9, 0x285347b6, 0xa39a16a3, 0x3a31493d, -0xe8476915, 0xaf4b1c27, 0x3b1f24b6, 0x8323db93, -0xfb3e4e1e, 0x5ae904eb, 0x93143bfc, 0xa4b8e400, -0xead1a16e, 0xce6f803b, 0x060af009, 0xf80f2479, -0x31fbd731, 0x46e0dc37, 0x8d7d2771, 0x0180027e, -0x55c139f8, 0x76c7aa3f, 0x758e5d83, 0x042c241d, -0x25781f80, 0xbab83034, 0xef6e7408, 0x4b731c77, -0x7b472843, 0x6f2d40ca, 0x7552385f, 0xb6641b44, -0x877c5147, 0x175d3b03, 0x5e7cb7c0, 0xfae9a572, -0x44c0b61e, 0x0f7520dd, 0x570dec09, 0xe871e827, -0xbbe90d4f, 0xd3e9340f, 0x3dfffffc, 0xc425e80b, -0x1af9dd36, 0x8842bd15, 0xbe01e998, 0xf8838952, -0x6181e99c, 0x8db76f64, 0xa2d1f041, 0x2f5c1e21, -0xadc518c0, 0x74c9ed20, 0x75631326, 0x85813316, -0x0ed03115, 0x2a5ff899, 0xf8b41176, 0x1ba81d3c, -0x2c3baf1b, 0x04290674, 0x036ff77c, 0x75022a7f, -0x1a38a1f4, 0x75044339, 0x1456c3ea, 0x0fab816e, -0xb000f269, 0xc3edc549, 0x3e47f7ec, 0x2e1a73f1, -0x81a0b96d, 0xb49fc558, 0xe3260756, 0x1a599819, -0x7d7ff511, 0x9d16ba82, 0xbfac1422, 0xa0c3636e, -0xc03104de, 0x1a7a06b9, 0x85db6874, 0x4053783c, -0xaa7076d2, 0x48570990, 0xd9a2fa3b, 0xf0a3e44b, -0xc108afbe, 0x945bddc4, 0xba7f6b48, 0x107e21ff, -0x55a83a3d, 0xba6630fb, 0x00c58ef7, 0xa5805829, -0x5306c0bc, 0x118ab587, 0xa1573fda, 0x85e2acb6, -0xf9b14800, 0xf01ddfe8, 0x13fd2ac4, 0xc1011a87, -0xf8f602ef, 0xea848f44, 0xba0f49ec, 0x43aa8570, -0x6e72685a, 0x2b6c388c, 0x44671396, 0x4e275718, -0x244a66b8, 0x09210547, 0x0656558f, 0x27194be8, -0xd385df0f, 0xe91a996e, 0xa314f2eb, 0xcf82f57e, -0x047316ba, 0x52f5d7f3, 0x056c4359, 0x5660d02b, -0xbba0c5ed, 0x57b1386e, 0x81d7c25c, 0x680078ec, -0xe06dba9c, 0x1608d403, 0x0492a8ac, 0xe16e20a2, -0xa1fa1f7c, 0x1e210aa4, 0x47803408, 0x22a2d8cf, -0x3723a616, 0x2d7eedca, 0x24a21ab6, 0x4740b90c, -0xeb95dba7, 0xc279ef82, 0x3d04013c, 0xf8184d0c, -0x96e8063e, 0x51d02ab6, 0xd1ed91f3, 0x6e010c96, -0x7818ff10, 0x1554c107, 0x18050385, 0x03958378, -0x0fa3f7d3, 0x0261b669, 0x2d2f2295, 0x0d0c9ae6, -0x73ce8d06, 0x3232182b, 0x5416c1f2, 0x3887e068, -0x4dfbf201, 0x800f1037, 0x680d6a52, 0xe917931c, -0xcd006017, 0xff8dc632, 0xf4e010dc, 0xe814bec7, -0x713df15c, 0xed9b70e9, 0x89ba2e1c, 0x284b5ff7, -0x31cba13b, 0x8f50fe9c, 0x7d581f9a, 0x242cfbfb, -0x436afb68, 0xe8ffb66a, 0xcafaf2dc, 0x7ea26bbd, -0x246a28ff, 0x6a561ce8, 0xc91bd175, 0xb58ee8c7, -0x6c4838f2, 0x687f04f8, 0x5728eb00, 0x0c4ece0c, -0xc4ddee51, 0x09cf587b, 0x1adc8ca1, 0xd8225ee8, -0x892fde0d, 0x2dc729df, 0xd615d47f, 0x638455ab, -0x5a7f0424, 0x85ee8484, 0x13570c03, 0x6384e32b, -0xfa2b1cf1, 0x71611d16, 0x420760d6, 0x0416e31d, -0x9192643a, 0xcc3d162e, 0x64109bf0, 0x43b543e4, -0x66c27316, 0x319e99a4, 0x409a4cdb, 0xebff8b38, -0x13fb8309, 0xf9858f0f, 0x0c581455, 0x02c7e118, -0xf69f5f18, 0x010ec612, 0x0750f5f0, 0x4a11ed49, -0x43c2767c, 0x05e5b108, 0x2426a875, 0xde3f65b6, -0xf939f685, 0x4ae4bd81, 0x7548423c, 0x6c348143, -0x025d0f82, 0x38ec3d8c, 0x16b70513, 0x970a6d45, -0x20641d8e, 0x4ced9df3, 0x9a941d1a, 0xbb08ece7, -0x5d1ab323, 0x3b703102, 0x5d008316, 0xffe53374, -0x27536fb3, 0x838d993e, 0x00831f1b, 0xb6050807, -0x2e7768df, 0x470412d3, 0xd78ed23c, 0xc36cbfad, -0xcf483944, 0x42c8daa1, 0x50ba8110, 0x77024c03, -0xc64784fb, 0x155abd51, 0xa068495a, 0xbc0dc22f, -0x41575a92, 0xad86a7a3, 0x03841af0, 0xbe681535, -0x03418df0, 0x02756dd2, 0x0267682e, 0x6899fa78, -0x7342c5bc, 0x0d3411ae, 0x0e6aa3eb, 0x8158f796, -0xa91f30c1, 0x78048368, 0xff3bf840, 0x28e82835, -0x6ce89ef0, 0xf24c21ee, 0xebb49448, 0x307b6a8a, -0xd0533642, 0x1482e8d9, 0x303d82d7, 0x0068453e, -0xc9146b77, 0xc1c8c23b, 0xfffe3cbc, 0xbddc68de, -0xfd848d67, 0x00001184, 0xe81e3fa7, 0xd81e48e4, -0xc7a4ef83, 0xedaa0fed, 0xe9a2be88, 0xb21f69e2, -0xf809a804, 0x39ba09bb, 0xf738e38e, 0x01029be2, -0xc211eeb7, 0x20e7e944, 0xc0310090, 0x182144d1, -0x3867f292, 0x3aa9044b, 0xd1d2ccca, 0x548c04f1, -0xf6fb040f, 0x1d102d02, 0x132703a3, 0x7f16aaa9, -0xd3518be1, 0x5c418bf2, 0x2ce50e77, 0x771806e8, -0xc1ad8665, 0x451d51de, 0x8b150c7f, 0x80835457, -0x0c8dfc5b, 0xd5891c76, 0xf78dd889, 0x51a96df5, -0x07df57db, 0x1119cf32, 0xba69ba97, 0x446c277c, -0x9f396868, 0xfdd86478, 0x7877c442, 0x7277df03, -0x4213548b, 0x5008b758, 0x68e28a21, 0x316b5e72, -0x1977b788, 0xa35876d8, 0x9788d44d, 0x6110ae80, -0x4703e41c, 0x6ac1536c, 0xfe10786b, 0x2ce2d913, -0xc77bdb15, 0x22ff5378, 0x04ac3860, 0x44f43c14, -0x33906c38, 0x608207fc, 0xc3299b90, 0x4ae9d619, -0x00db6f60, 0x04e1a37c, 0x77034651, 0x20c0336c, -0x4e481197, 0x46528879, 0x79f858fc, 0x7b5650ad, -0x0fe0f281, 0x3109e0c5, 0x89da486c, 0x751721c7, -0xed31879b, 0xbd3bd62e, 0x7860d168, 0xe200aa8d, -0xeb0e2034, 0xe86d16c6, 0x1f75d829, 0xecd65c07, -0x07b7a0bb, 0xd875c289, 0xf7de75eb, 0x20a11889, -0x3f505420, 0x18954bee, 0x0341ed50, 0x104c40ff, -0x6e2b187c, 0x30c12a36, 0x1c42928b, 0x0038005f, -0x8948dcde, 0x82277842, 0x4257001b, 0x41db6774, -0x688b6774, 0x68b57c3e, 0x7360b19b, 0xa22ee4c0, -0x0aa77838, 0x3642856d, 0x84358fe0, 0x40dc2076, -0x3f45038b, 0x86eebb71, 0x4cf3a753, 0x4819db31, -0x6f394c31, 0xd3c7ff86, 0x06720fb9, 0xc1396f77, -0x441a6b77, 0xabb87451, 0xa7403609, 0xd17ee281, -0xaafa5ac7, 0x4428d06e, 0x18131ca9, 0xc41d6c70, -0xb32c2655, 0xec3ecf78, 0x66602558, 0xc3f6ae9c, -0xb59d4b74, 0xfebddf6b, 0x2b514674, 0x86502826, -0x9dc2a74c, 0x5a582bdd, 0x2c8f0c53, 0xee1bec78, -0x8b5c46fe, 0xc8296056, 0xda194876, 0xc8014c56, -0xd7a5da11, 0xe93e0f04, 0x36b3ff6e, 0x47588250, -0x525470fc, 0x40ba4a50, 0x6efdd0c7, 0x280fc7bd, -0xcd880f0c, 0xb717c3a6, 0x849ff1e0, 0xb18d71dd, -0x203dfbec, 0xba50415e, 0x3a3db8d4, 0x28712360, -0x4124b3fe, 0x3e4d8f84, 0x686e831c, 0x0dda53b3, -0xe20e1da0, 0xbd392ba3, 0x0a025120, 0xbb36c1b1, -0xd5781639, 0x02964ca0, 0xda8aa7e8, 0xfca5287b, -0xdd6e5a83, 0x9b6a9d05, 0xd374a3e9, 0x9e9ace01, -0x11625fa7, 0x0afa53df, 0x0a3df007, 0x29f137db, -0xdad719c6, 0x4655cf01, 0xd29c1702, 0xbddc8b50, -0x2fc217be, 0x41a279c9, 0x6c93100a, 0x2a41614e, -0xfd4bdce0, 0x4041b458, 0x2c5b284b, 0x44f59ac4, -0x961bd8f7, 0x300040c5, 0x55165763, 0xd76274bf, -0x31de98b0, 0x7c887ff8, 0xdcaf8946, 0x855d202c, -0x7bb1bec0, 0x94c60222, 0x50047a83, 0x0fb1c03d, -0x25502823, 0x309cdd02, 0x46ddc8ee, 0x3c2d02ae, -0x1b84bd2b, 0x76e80206, 0x072d3cdb, 0x3a800d89, -0xa4c5ac3e, 0x7b8de78b, 0x41387c74, 0x0f200aec, -0x3f6b0740, 0x5202c3b8, 0x89980954, 0x9b18502d, -0x49a97c55, 0x36bab62d, 0x296bc043, 0x5c7c20a3, -0xfc5330c0, 0x3a1da3be, 0x2715d772, 0xfbb7e203, -0x05b83589, 0xc232b4a3, 0xed83adfc, 0x57be26f8, -0x57206142, 0x4efc52c3, 0x41e8e11a, 0x481834dc, -0x5484ab20, 0x19ad8ff6, 0x12c5987e, 0x00000bc7, -0xf43c2141, 0x844a1c60, 0x9061e423, 0x7d0e91ea, -0x8e061a42, 0xe7272470, 0xe54802db, 0x1d8376fe, -0x71e952a4, 0xeb66e3db, 0xe82cd197, 0x8df909f9, -0x108631b8, 0x842b66d0, 0x0ad871e3, 0xdb241e5a, -0xdd1074dc, 0x7a80890d, 0xbefe4e1b, 0xaef17df7, -0x72071111, 0x41d1e915, 0x87dfbb7c, 0x2b7838dd, -0xfb813b43, 0x118779fe, 0x66c3f634, 0x07eeb7f4, -0x2ba4df75, 0x57530eab, 0x5223d9e8, 0x8986bb18, -0xb910cd8a, 0xe055ec24, 0x8d34f05f, 0xfdf8fd46, -0xaddcb877, 0x1d56fa23, 0x10edc124, 0xba040899, -0xec110a8d, 0x8d2b087b, 0x7954da0b, 0x18ba2d44, -0xa805c1b7, 0xfa68bf15, 0xb678a030, 0x042c0c13, -0x230a2706, 0x177384ed, 0x345c02a0, 0x051acf01, -0xe9722468, 0x7f62cf04, 0x4274d2c4, 0x35731440, -0xdf64ece0, 0x08e9c16e, 0x73280beb, 0xee753f21, -0x8758235d, 0x3943dbed, 0x1ee175d5, 0x02b06105, -0x21df4998, 0x1e2f014b, 0x5a303f4d, 0xe2980bba, -0x2d428819, 0x066602c3, 0x7ba91d0a, 0x04428ddc, -0x45060727, 0xf6dc306a, 0xc7c5d91a, 0xc9693023, -0xee93c40a, 0x42b21758, 0x146ae814, 0x61d5a71f, -0x643c9a01, 0xfb52be05, 0x24d6f04d, 0xeb0c2418, -0x24fe8608, 0x56552e7f, 0xe089ff29, 0x45287da4, -0x74fce283, 0xe1cda8e1, 0x7401ee4e, 0x268622dd, -0xb0383579, 0x1050f0d0, 0x174fd27e, 0xd4873d42, -0x612ddd02, 0x1a045019, 0x43424d55, 0x8a47236c, -0xdd6a172c, 0x688446f5, 0xc418c30b, 0xdb5b547c, -0xf758d488, 0x3bdbbc1a, 0xedafd76b, 0xd0b5e9fd, -0x58456110, 0xb708ad0a, 0x1a700319, 0x1adf2ddd, -0x0f0d837b, 0xf6e8def8, 0x5d544721, 0x74a68a7b, -0x6dc6f842, 0xbc571903, 0xfb008af1, 0xbee9474f, -0x468295b4, 0x18e44241, 0x52a3601a, 0x805b56db, -0x7457c272, 0x410adfdf, 0x4c0e0c39, 0xc3ca44f7, -0xe7ab7516, 0x44aece04, 0xb7b6d0d9, 0xce443970, -0xd277e08d, 0xb1ae3c1c, 0xc8da76f0, 0x0816ae04, -0xc8b62fd8, 0x3e39886d, 0xfd093b84, 0x6dec3e14, -0x2fb5630d, 0xeb042f54, 0x4b090ed2, 0x3c15a7e1, -0x01214705, 0x704901f0, 0x5e094053, 0xae06f58c, -0xf9a6145e, 0x4329114a, 0x1b55de95, 0xca6f140e, -0xd0398605, 0x4d9b1874, 0x26368b98, 0x8a4350ac, -0x05ad901c, 0x20dd0d18, 0x6e08441a, 0x761f052d, -0xd88273b8, 0xf821c264, 0x87178b1a, 0x6a8d3627, -0xf9ac0849, 0x5350b05a, 0x824629b8, 0xc2e8a564, -0xf6f48bee, 0x891af4c2, 0x6730a6a3, 0x1dd1fca6, -0x034421dc, 0x3124a8d0, 0x013f0643, 0x075b1d7f, -0xdaebf023, 0x04538d76, 0xb01905cb, 0x1a334e52, -0x6717c15c, 0x2d560baf, 0x4614d0ac, 0x18b002f5, -0x2de86100, 0x34d6f907, 0x9da40d97, 0xc756745c, -0x0326ad60, 0x321419e4, 0x0c709361, 0xb72c0c17, -0x68784aee, 0xf62d5634, 0x45e35463, 0x9913df6c, -0xa341bee1, 0x980d9768, 0xc35ed021, 0xce40d082, -0x0642f012, 0x62ebc0cc, 0x503b970a, 0x3145fcd6, -0x1018f281, 0xeae60875, 0x2d7e0182, 0x05299c09, -0x340326d7, 0x7e3c190c, 0x7f8026d2, 0x858b84e0, -0x346a5508, 0xc064c77d, 0x083c0a29, 0x2fbe3f3c, -0xdaad011d, 0x235b7623, 0xd80e88fa, 0x57137452, -0xdb2e50e9, 0xdb70091e, 0xef3c0743, 0xec0f1d31, -0x247bfb01, 0x08693e74, 0x4e2a5540, 0x042bafe8, -0xc6d2b6cf, 0x775f0828, 0x2cc408a9, 0x338a2709, -0xb1001ea6, 0xac8bee3d, 0x53d78e02, 0x84c39dbb, -0xf89682c7, 0x731a1e6a, 0xc7596d67, 0x6c54e885, -0x5fc38337, 0x57021d10, 0xe272e325, 0xdc85526a, -0x689abfab, 0x29ff8c0e, 0x1eda1434, 0xff921481, -0x4fa35e8d, 0xa0155c3f, 0x1574915b, 0xc1171a43, -0xc2e99637, 0x46c7131f, 0xa0fae70c, 0x1113c09d, -0x73651ac7, 0x5c0bbbb0, 0x3810466c, 0x483e3874, -0x041bcf75, 0x729f1885, 0x405b5ae4, 0x16d8b3aa, -0x4663f87b, 0xdb4d2224, 0x97076178, 0x05f0147e, -0x135646ff, 0xbee100bb, 0x912172e5, 0xe0092fb0, -0x023abe8d, 0xcb8b5859, 0x21560c70, 0x070563a1, -0xea701775, 0x41eaa8d5, 0x37501734, 0x4112da62, -0x527ec76b, 0xc26a892b, 0x76d688a5, 0x18bbd40d, -0xe7922e1b, 0x18045015, 0x21636e26, 0x042689fc, -0xc9ab1c1b, 0x0b2dd54a, 0x8f20071c, 0x7d8ce262, -0xdf06d6d1, 0xce784d20, 0xc3023e03, 0x6601bcce, -0x67048c3f, 0x09eb98db, 0x060c7e06, 0xcbe40884, -0x44ae6d97, 0x5340e0ce, 0xea0e3fdf, 0xeb0a2724, -0x49735694, 0x76ffd5b8, 0x371df7ae, 0x12422e33, -0x7577160e, 0x68076988, 0x200326c1, 0x508b0623, -0x439d139a, 0x4e4b8a43, 0xe91c669d, 0xa74a4b30, -0x28137705, 0xe8510e84, 0xa84d5b04, 0xa3f35259, -0xe0dff18a, 0xee8416d4, 0x1b74c784, 0x7425fa80, -0xc006bb2f, 0xffed9914, 0x6b178829, 0x47df83c7, -0xe5752046, 0xc60339a7, 0x06d13a43, 0xa0282540, -0xb170ab1b, 0xf6a91ff6, 0x58a3583d, 0x0b432e61, -0x62d815bc, 0x85731c01, 0x41bd2308, 0x30f5e800, -0x11bcb94e, 0x19b9edcf, 0x086c0112, 0xdb6800b8, -0x010af5be, 0x20c8f477, 0xb20c783c, 0x6465cf15, -0xfa08641b, 0x2101bd40, 0x2c8cba47, 0x017763f9, -0xe88830da, 0x3c43542f, 0x3930b345, 0x45830feb, -0x0462b800, 0xb3f2280e, 0xa6dffa8f, 0x0788038a, -0xe4eb4743, 0x83dd848b, 0xda26d806, 0x18188106, -0x2e16843c, 0x0dccc0f0, 0x902c4f46, 0x6c576ebe, -0x4ee81e6f, 0x30461dd3, 0x8608fef0, 0xda6b954c, -0xe64d87a7, 0xc60a0a96, 0xb112042f, 0x1ef64602, -0x64494e85, 0x65a00fa8, 0xaff9eb35, 0xec1b8225, -0x84ebc980, 0x4149d3d8, 0x0ff1dffc, 0x3839808a, -0x4588d009, 0xe9834500, 0x76e87904, 0xe5ee0e84, -0xdef52750, 0x440850fe, 0xedf256a8, 0xab400dbf, -0xeb89bfd2, 0x4ab9990d, 0x0abb176e, 0x38f9f71e, -0xe6038a1c, 0x1605db00, 0x67f25514, 0x5ff70066, -0x1e0c3a30, 0x2e0c8904, 0x6f5536c1, 0x0502fac0, -0x02c22945, 0x6c37be75, 0xbd478d4b, 0x2a0aef0b, -0xb60b8802, 0x4aff7343, 0x77da3943, 0x7dace9f1, -0x58df5edb, 0x0a351d6b, 0x5430649b, 0x2d8b2604, -0x37e9317b, 0x459b1ee8, 0xee231406, 0x73e9301e, -0x63b03069, 0x0e3f85c1, 0x8fe995d2, 0xa980c1cb, -0xc86a2c86, 0x1a0d86ba, 0x1e76d878, 0x4ab10341, -0xedd67f16, 0x39e855e2, 0x3ac50169, 0xe2771d43, -0xd419e94d, 0x44600ab7, 0x390653ff, 0xae91d9d3, -0xde73aafd, 0x4e3f7351, 0xda79fcf9, 0x43b60e5a, -0x3dbf503b, 0x776bfbdb, 0x45af3d86, 0xcdf45cf7, -0xaabfe92d, 0x0e5c83b1, 0xb7d16303, 0x9c1314fd, -0x4e450470, 0x16acf17b, 0x1ec5a12a, 0x50d890c3, -0x1858018d, 0x52db85ba, 0xb808cfe1, 0x8a307414, -0x6d32b907, 0x84d2d2f1, 0x74342628, 0x1b5f3822, -0x0ba5e26f, 0x36c188d2, 0xe720488d, 0xd188c888, -0x776fd10a, 0x38204a0b, 0x0375ca08, 0xe817754b, -0x430d6d05, 0x7a15d202, 0x5eba27e1, 0xcb891508, -0x4201808a, 0x88244541, 0x81f62ead, 0x4f09f452, -0x89b94c1b, 0x8bb64ade, 0x74c2b7ba, 0x41034ea6, -0x66f02343, 0x9d34d577, 0xd34c543d, 0x4204eb94, -0x76eec06c, 0x24fa7505, 0x48424102, 0x43f6ce4c, -0xc93746c1, 0x1b74d63f, 0x2cdfa52c, 0x74430307, -0xf3754906, 0x5dda34c6, 0x955760b0, 0x1a2ac34a, -0x15f4161e, 0xf0993a02, 0x0efdc2d3, 0x20da51b5, -0xa8ef05eb, 0x025ed8a9, 0xd738108a, 0xa05728f5, -0xa92db300, 0xbac1b05c, 0xa01ff144, 0xf7aef2df, -0x38d849d1, 0x836d1510, 0x3b4827da, 0xab9d19f7, -0xb8ab1cf8, 0x89d6384a, 0xe9501bbe, 0x111174c8, -0xe4404a17, 0xdf868a05, 0xf4758002, 0x6ec3c829, -0x6ed03a56, 0x31a2ba06, 0x60cf7cff, 0x752169a8, -0x8e03f116, 0x2f6c3510, 0x74f18974, 0x106e161a, -0xabb58d7f, 0x5bf5ae38, 0x74bbc39d, 0xcd3843f3, -0x47356dde, 0xe9ebd5b1, 0x64f39556, 0xaf46c2e4, -0x140d4323, 0x1bf02744, 0xe3752643, 0x30a35a73, -0x8981384c, 0xbbaa79f0, 0x8130a025, 0xc301d864, -0xba82ff59, 0x74584c17, 0x169b0f3c, 0x09745a5e, -0x74117ea9, 0xa3e574b9, 0x552fa7f4, 0x8b3d58ef, -0xdb540a1d, 0xbf7ef174, 0x282b7597, 0x64c4753b, -0x001f05c7, 0x410b6200, 0x1ef21280, 0xb6c7672c, -0x2f10bb0f, 0x595a5b3f, 0x447e8956, 0x5306b178, -0xeba4f690, 0x8f0a9e06, 0x4301c21b, 0xe2362041, -0x462c9d5b, 0x203520ca, 0x61855b08, 0xa46a986c, -0x8265f685, 0x1b6d742b, 0x13020192, 0x4eecd018, -0x7b170c61, 0x69ef754e, 0xb10c371a, 0xf6c2b636, -0x02210b74, 0x2c428cc4, 0x06209ff5, 0x318e27d1, -0xd0885c8b, 0x4e4e7854, 0x60f21815, 0xf502dfb4, -0x74da89cd, 0xa8031227, 0x89fc4edb, 0x5514ebce, -0x307ed490, 0x7ade944e, 0x71951761, 0x4fe87dee, -0x008360b1, 0x7808daf9, 0xefbdbf4b, 0x58f98349, -0x8d9fb30c, 0x428aff50, 0xa39e3821, 0x0a7e6df8, -0xc2f27518, 0x1158c484, 0xb8b2f30f, 0x53803e36, -0xf27753d0, 0x654b110d, 0x10b84080, 0x48822fa2, -0x42d07989, 0xc81b8206, 0xfddf3d80, 0x8a5f88c3, -0xe03d83f7, 0x01c84c08, 0x2a92b4a3, 0xe34500fe, -0xffd2088b, 0x63b23dff, 0xb25c37c3, 0x05c74601, -0xea07b21d, 0x82c79032, 0x88f10977, 0xaa004182, -0x1aee2812, 0x12e84f54, 0x4b245bd2, 0x297c4456, -0x788ac455, 0x45fa7ca8, 0xfe5d7064, 0x7c167457, -0x3f0b608b, 0x1176c42c, 0xd8e013e8, 0x2138368a, -0x07111dc3, 0xdb042f7b, 0x1085e89e, 0xab41e8ac, -0xe56f170a, 0xe6eb7e88, 0xdbaa91e8, 0xc8eb010a, -0x105820b7, 0x016a6cce, 0x447f0108, 0x92c4bf6f, -0x556d4149, 0x0f75fb3c, 0x60126a0a, 0xb0a79e0a, -0xdd63e401, 0xc2c287f0, 0xc1661639, 0xc5c508ea, -0x15464075, 0xe89b51ac, 0x888c9c91, 0xf9b592d9, -0xd8dee889, 0x909b5822, 0x1a53681b, 0x155e8c88, -0xf860972d, 0xbeefbfa2, 0x35de1538, 0x0538b875, -0xebb007dd, 0x5d4108df, 0x0693e630, 0x6f157bb1, -0x360c753b, 0x0ba28c03, 0xa7d14921, 0x14c03100, -0x056db047, 0x2dfed8b6, 0x112daa5b, 0x7c89902c, -0x6361ec21, 0x741c5fd7, 0x6d853ee3, 0x6c3db081, -0xb06c0f4f, 0x4a6dc548, 0x6832cffa, 0x2f254843, -0x69f6fdd4, 0x7c99b648, 0xef30a36b, 0xf006b707, -0x47b70f03, 0x5706f50a, 0x68a0c608, 0x2957f850, -0x2a961774, 0x74bf7973, 0x056c2b12, 0x03446122, -0xeffedf68, 0x02512b76, 0x10348d32, 0x7f80de29, -0xf5890103, 0x34ba0911, 0x74980088, 0x4e10a91d, -0xc04c2806, 0xda1fa4d6, 0xaa386ac8, 0x7e13691b, -0xd1c51638, 0x29817d30, 0x8035b8a9, 0x97604831, -0x553a4762, 0xcec25e51, 0x07bb43ed, 0xb83407c6, -0xdeeb1f06, 0x4e8dc43e, 0xe71c73c4, 0x9b83f289, -0x6ea94b88, 0x0ee9890e, 0x308187eb, 0x003416e9, -0x4f5c4103, 0xb2e10250, 0x02ff21fc, 0x102d3ec3, -0xf8e2fcde, 0x8d0124fa, 0x3a0a8430, 0xae400344, -0x62b125b0, 0x01c8894f, 0x2908a1bc, 0x2d9b9578, -0x0b0c1995, 0x06e82f41, 0x87dc37b1, 0xa23d0843, -0x0a857336, 0x8f85895c, 0x5b1b2e59, 0x0c894dde, -0xdd391c13, 0xa1b4f876, 0x008b86f8, 0x3a2c461c, -0xc206c82e, 0x01304063, 0x71a4ec00, 0x0e5916c0, -0x58fb8cc2, 0xef9038ca, 0x4982cd77, 0x57205d78, -0x092ca142, 0xff787adb, 0x1f69fd15, 0xedb6b702, -0x260f705d, 0xdde3c8a1, 0x56ca0903, 0x054f5e2b, -0x482fa1a1, 0xd8c28558, 0x37880a07, 0x52ba424c, -0xdd5487bf, 0x3d08e21c, 0x78aa0b2a, 0x0942dae8, -0x0d140a76, 0xf142eeb6, 0x9beb3b72, 0x030a0358, -0x011ba6bd, 0x08030728, 0xbe222409, 0xbba602a2, -0x9e439157, 0x85bce01d, 0x54770bfa, 0xbbfb12b4, -0x54680809, 0xa2138037, 0xdaa7418c, 0x2c547b8d, -0x3f1ab7c0, 0x98968012, 0x50e01683, 0x976f882d, -0x22f44620, 0xd8d70466, 0x04143aab, 0xe30ae3a0, -0xa503f060, 0x76164774, 0x1180bb3e, 0x0c4f5a19, -0x045b7543, 0x0ea069a0, 0x35d70f03, 0x752bbc05, -0x4908257e, 0x8b1c0216, 0x03e13819, 0xef596f6c, -0x3c50a408, 0xf0eb1f83, 0x5add7548, 0x8c18cb6d, -0x22d587b1, 0x1f024e01, 0x59dc8859, 0xa752c5b1, -0xb0f67b25, 0x313b0e41, 0xeb653a75, 0x046324d0, -0x18223b0f, 0xeae6ca74, 0x05bb0582, 0x76247652, -0x5e33b38f, 0x26c1b2d0, 0x36303150, 0xb7ebde8a, -0xf204151e, 0x5877b533, 0xd9dd0608, 0x8d041073, -0xff19c230, 0x20b10513, 0x59fec171, 0x0f12f752, -0x41080d91, 0xbc160c86, 0xe78a8f0a, 0x885508eb, -0xfb8d5488, 0xffbe1d13, 0x7f547423, 0x08003d45, -0x0b7c4420, 0x8d2ff087, 0xf717e856, 0xe9589518, -0x047384b0, 0xde131f85, 0x9e305f8a, 0xe0ca9636, -0xbbcce9d6, 0xa7265fbb, 0x24bb7598, 0x05b9eb03, -0xc607eb02, 0x79b38301, 0x04e3f85e, 0x02018fba, -0x2e305575, 0xc9a4183c, 0x2e2f181a, 0xa024120d, -0x57c6d746, 0x48136e8b, 0x77001156, 0xcc0844eb, -0x9be08a83, 0xb87da237, 0x66260d0c, 0x75088f20, -0xa28462b1, 0xdc02b444, 0xeb6c3991, 0xd7575018, -0x154254d1, 0x43be00ec, 0x053ba9eb, 0x57b074eb, -0x1291efc5, 0xeb18a302, 0x3da00597, 0x7041b2e4, -0x4c6dbe74, 0xac5d8a00, 0x0e718966, 0x3f54d63d, -0x7854666b, 0x8912184f, 0x0c3e9490, 0x1c600636, -0xffb4980e, 0x50761174, 0x05a50fc1, 0xd6d6c79c, -0xf58ad606, 0x5f8aea2e, 0x89003b20, 0x1bf72107, -0x5ea02d24, 0xf32ca6c8, 0xf601b0f6, 0x2b7427b0, -0xa6ba811c, 0x68d71f74, 0x08786d87, 0xd0979e50, -0x752e3833, 0x1c4fbc55, 0x9c828dca, 0xd9c582af, -0xe4c7e8af, 0x0c099882, 0x47087ecd, 0x90825113, -0x4c2a0000, 0xbadf6206, 0x5e0e6ca3, 0x06539cdd, -0x4b12cde3, 0x41bb8556, 0xed515216, 0x96c0e1d0, -0xeef4f20a, 0x2778fc18, 0x53561d00, 0xfb509a9d, -0x200f56f7, 0xb28b2eb0, 0x3e048d7a, 0xd518793b, -0x7315100f, 0x8dc65128, 0x04ed9366, 0x3b504a33, -0x250068bb, 0xe3632d7a, 0xa8dababc, 0xc8d1c132, -0x621f5853, 0xd7498e50, 0x392cadf5, 0x5bbb0a1a, -0x4551e355, 0xf1158f23, 0xfb53025e, 0x2fba88b0, -0x868b5873, 0x8b5a1486, 0x422c7843, 0x968becc1, -0x1841f482, 0xffd20984, 0xae8c0894, 0xf968c01a, -0x2bd3e751, 0x3ba658b5, 0x08016a0e, 0xc522126d, -0x9e5bde08, 0x6058cbe3, 0x04f53df0, 0xde82cd5b, -0x756a00b2, 0x69906d50, 0x911e7c80, 0xa46b38d2, -0xc7197f87, 0x01fd0026, 0x90163236, 0x898b3ca0, -0x421d8123, 0xf4a06e28, 0x1fd8479c, 0x05748d29, -0x013960a3, 0x42446639, 0x19f7205a, 0x2559201a, -0x78bc8b07, 0x3b016ad7, 0x3b0b5afb, 0x516a1047, -0x98138b04, 0xda8065aa, 0x12bed6b9, 0x256a6f4b, -0x39f62ed2, 0x87e275d0, 0xeb342a0c, 0x018b3017, -0x077062de, 0x8ddec7b6, 0x1018f870, 0xaf0a2b41, -0x960f1c77, 0x73f0390e, 0x8e8e7e4e, 0x533cd66e, -0x10ab1214, 0xa178c3a7, 0x51498568, 0x4da35208, -0xf7d45d15, 0x377367f1, 0xb11207be, 0xff302c08, -0xc8aa13f3, 0x0711d961, 0xec5aa961, 0xded08908, -0x8f6aec0d, 0x707608b0, 0xab3276f4, 0x8ec1bbc8, -0xd993558d, 0x2dd230fe, 0x460a811a, 0x517c1d6e, -0x6789ee92, 0xba2b6014, 0x779e8905, 0xd3bf01b0, -0x6d150a5f, 0xe7d18940, 0xbf005d2b, 0x0e0ebb2d, -0x698d0c77, 0x61819d1c, 0xfd83fdd4, 0x7ec68973, -0x7e063219, 0x7a3e8e74, 0xce1215bb, 0x6857f365, -0x97e9d837, 0x83738bef, 0x7286a2c0, 0xf0ff396c, -0xba5501fb, 0x8a11512d, 0x3e8b7791, 0x343803cc, -0x4eed1e23, 0x551fa310, 0x74c0316e, 0x01e92d11, -0x51bb6410, 0xefb4a264, 0xbfa724d7, 0x3d3b6909, -0x960075db, 0x11ed0059, 0xfb59910f, 0x0ef02a7c, -0x8ba08476, 0xf6f234cb, 0xd03e9e8d, 0xa8f53d3c, -0xc6fe5e07, 0xa362ec86, 0x470212fa, 0xc606a501, -0xc8934408, 0xa3057055, 0x80cd62da, 0xc8f2313a, -0xa1100783, 0x74a1146a, 0x1e046018, 0xac86ab12, -0x58ac0c7d, 0x0cc6afb7, 0x08002c4d, 0x2391dc04, -0xeffc1c5b, 0x660068ef, 0x2876e798, 0x017c18b0, -0x5122a8d6, 0x9c08041d, 0x5fb7505e, 0x04ec0a44, -0x57113f74, 0xa6525806, 0xd2c6a680, 0xaff1cbd0, -0x816184fb, 0xb941ecfa, 0x89027304, 0xadd497d1, -0x9342bf14, 0x415bbaef, 0x5e81de3b, 0x75e23ef4, -0x1b5056bc, 0xa764a758, 0x388a7736, 0x22c9da89, -0x1603046d, 0xeb49dd18, 0x875eacc6, 0xa9866023, -0xf10be4a4, 0x254054ac, 0x6d8fe840, 0xe1bbb7e8, -0x76a433d8, 0xe831b7e8, 0xc911bd76, 0x9afb049d, -0x8fcf66cd, 0xbed6a56f, 0x2a080965, 0xba2841d3, -0x4ec00fe8, 0x0146d329, 0xdcb836dc, 0xc0d029b0, -0x2f589865, 0xd42763a1, 0xf0741ef0, 0x883236c8, -0x9111ff16, 0x9c022ce0, 0xd85bdd10, 0x60c0c581, -0x291416c8, 0x3ac0c149, 0x86f43f14, 0xf6a1629b, -0x840f3a12, 0xf4570b0b, 0x417fdb6c, 0xd70a080e, -0xd48b6d78, 0xafa0d01d, 0x5201368f, 0xe0ab160e, -0x0f3f036e, 0x4ddef58e, 0xa1bb3552, 0xd3e852f3, -0x56be80b9, 0xf8562dc1, 0x7a406430, 0xd96c645d, -0x4072200a, 0x469c6553, 0xa0151f63, 0x3b150ede, -0xd84c4db6, 0xb003495c, 0x0d18b4eb, 0xdb103b65, -0x5b361727, 0xb6fd0a0e, 0x3678b191, 0x100e0bcb, -0x040cf8c6, 0x3fb2138a, 0xf3f2d21c, 0xdb73191b, -0x42d0711b, 0xdf0e32ab, 0x0f6c646d, 0x0e339942, -0x700802ba, 0x6e40f30a, 0x6b00d942, 0xd839acfc, -0x8912810c, 0xb6551bf3, 0x0f6db191, 0x30464b37, -0x8c600e10, 0x46c65a45, 0x304d9211, 0x936efb49, -0x050e5ad0, 0x3301f324, 0x1ecb89d6, 0x84e611bb, -0x75073319, 0x6e8a6362, 0xf093cd9d, 0x84b6feb7, -0x65bb53d6, 0x0a7b64eb, 0x3d2b5d76, 0xd236ef4d, -0x34756cbc, 0x89fd572d, 0xdb632222, 0x5d82d8c8, -0x050e23d3, 0x1ec3255d, 0x44f066a4, 0x8f000302, -0x64dfb03d, 0x44724e44, 0xf941e9fe, 0xd63d9772, -0x73573112, 0xe917c475, 0x1d65ee45, 0xad9d0c27, -0x2eee1516, 0xb09a6ec0, 0x9a234102, 0x12fdefe9, -0xf3551c10, 0xe6dcf306, 0xdec9cfa4, 0xe95a2141, -0xaa10fedd, 0xac27ccf0, 0xf147613b, 0x47a734f8, -0x2361f623, 0x94127597, 0x36957b47, 0x37d84ee9, -0x36709176, 0x5d12f4dd, 0x09cd2137, 0x5b4afabe, -0x4e6909f9, 0xa81237d8, 0x776424f2, 0xf00fcd61, -0x12ed2511, 0xb09bfcfe, 0xe992245d, 0x974b12eb, -0xf65cf65c, 0xfbbbfcd8, 0xd8ccccd9, 0x03236137, -0x34445ac8, 0x139a47a3, 0x80b44df6, 0xf8f61290, -0xdf21307d, 0xefbf5acb, 0x97317e49, 0x3af6137d, -0x12b93659, 0x90f83646, 0xfa9d1430, 0x6850ab5a, -0xebe01c85, 0xea21b61c, 0xc6b80641, 0xba87268c, -0x092dde00, 0x43e5831d, 0xc112f800, 0xfb9ce823, -0x6ada8381, 0xc96fb78b, 0xb3d89746, 0x719056e8, -0x8bd3bdeb, 0xb344de8f, 0x08e3c11c, 0xd6c20bb3, -0x35f5dc44, 0x08b8b348, 0x2d870fb1, 0xff72df54, -0xfad6ff0e, 0x094de8fc, 0x88e43044, 0xec160e0a, -0xc4b62d1b, 0x383cc35f, 0x3e434c8a, 0x3c43d603, -0x0286eb0b, 0x1090585b, 0x726d773a, 0x3a09ef92, -0xb186d5b0, 0x605c85df, 0x3d0c8b78, 0xc82c0072, -0x16789724, 0x0aef9264, 0x775c373a, 0x0177e43b, -0x85fa3c0d, 0x2189771f, 0xd5700b15, 0x5e0b5417, -0x15fb1f2d, 0x8e02ad5b, 0x1db633b0, 0x6b205ea2, -0x80480e02, 0x5a8d837e, 0x29f3a80f, 0xfad839f0, -0xf754519f, 0x811a7212, 0x32335f3b, 0x7d9bbd5f, -0xf9b04cd8, 0x232510c3, 0x358be673, 0xeaae802e, -0x9a0d5b25, 0xff64ddb6, 0x5024b8db, 0x70e84943, -0x89099589, 0xdbd085d6, 0x9725edbe, 0x6f33348d, -0x2fc02504, 0xabd6b789, 0x99931110, 0xac9d989f, -0x32c2b1d4, 0xa1bc8562, 0xfe02e110, 0x703abd83, -0x0c15542f, 0x4857fa81, 0x93dda808, 0x90205322, -0x0be4ccf0, 0x34a4ec10, 0x2058a948, 0xc1561ee0, -0xe9fd8c5e, 0xfaa920ab, 0x091f42c5, 0x8c438451, -0xc156ff6f, 0x107dc24c, 0x42130c02, 0x84f87c07, -0xb501350a, 0x8a4d92c9, 0xeaabd800, 0x8189d30a, -0x027dddd1, 0x271218ba, 0x00433d04, 0xb9102177, -0xa3f7d7a5, 0xd2fee719, 0x70661a51, 0xd6684463, -0x1237c984, 0x3596542a, 0x91dfea6b, 0x95d3751d, -0x80c21f15, 0xdfb94374, 0x528c9787, 0x68316850, -0xe3fc3884, 0x7c0038a1, 0xf4d9c000, 0x23b7cc08, -0x19ac680e, 0x27bf88e2, 0xe9ac8944, 0xebf08479, -0x3726e2a0, 0xf4402be6, 0x61e45326, 0x7ff75188, -0x83fd7b29, 0xd08801ca, 0xb0b261e6, 0xf11a4305, -0xe67c4362, 0xdad9df42, 0x08df735c, 0xd6e9c3c3, -0x105e29d9, 0xc454fd05, 0x8ddf6da8, 0xb682d504, -0xd08f457d, 0xac028208, 0xc9adb82d, 0x033b0880, -0x7a150410, 0xad0218a9, 0x864b83ba, 0x008eefb3, -0x538907d8, 0x0002b0e9, 0xd9c83d00, 0x37d2b17f, -0x4dd3ba3a, 0x06241062, 0xcd51083a, 0xbf10578b, -0xc7442360, 0x03c46182, 0x06bf0add, 0x68ee11f8, -0x1b058c78, 0xd54bb007, 0x0e1fdb33, 0x45226409, -0xba642a68, 0x6a08e008, 0x57003979, 0x7c0739a8, -0x542ba462, 0x74040939, 0x190f8ac5, 0xe57845b4, -0x284514d4, 0x4ca7579a, 0xfddbb636, 0xa3219468, -0x40886684, 0x75f2128c, 0x06099093, 0x1db13740, -0x68fe84f0, 0xa01db3b0, 0x6eb8513d, 0x09a8a492, -0x0c11dc8c, 0x9a2dac54, 0xa8edffff, 0x160c1afa, -0xbc680368, 0x4fb036df, 0x54e4e29b, 0x48482e04, -0xaa30761d, 0x2e4c6b2e, 0x2a5b5052, 0x0209d7d8, -0x7131b048, 0x9d98317c, 0x606ce464, 0xf3ae2e64, -0x1e675f20, 0x7e310309, 0x48826807, 0x80c8c937, -0x07097874, 0xcd7d82a4, 0x4c31017c, 0x649bbbac, -0x342490ac, 0xc1098c88, 0x80a13906, 0x66172e1f, -0xd15725bf, 0x8ce26801, 0x2f14312f, 0x21d5461e, -0x2f1cbc18, 0x13c72b61, 0xc0e5e85b, 0x87ce68b5, -0x68e1d6c1, 0x18b0a2e1, 0x1072b575, 0x7be01284, -0x6bd920e5, 0xa3ca1cea, 0xf8090e10, 0x20968b1b, -0x8021e803, 0x075f5d12, 0x27e9903f, 0x0481be88, -0x6e90f0ee, 0x5e18a380, 0x891afbcc, 0x88f46ba8, -0x607a4b91, 0x2e95d880, 0x4b6eab96, 0x050f4475, -0xf2573ec3, 0x88805bb7, 0x208a0f4a, 0xb70ee8e8, -0x903a87b2, 0x000023f2, 0x6dd95ffb, 0x33224d57, -0x866c0349, 0x7445e41e, 0xd8c813f8, 0x0000ff68, -0x2b030135, 0xc0d04706, 0x617107fe, 0xadde0011, -0xff03efbe, 0xe3fc4bff, 0x8701035e, 0x5850203c, -0x696c4345, 0x3a746e65, 0x68637241, 0xeeb7613a, -0x3a0030bf, 0x49444e55, 0x3102320a, 0x82585f00, -0x02394fb0, 0x5f5bdc05, 0x36362caa, 0x0532bd36, -0xfffd916b, 0x510e37f6, 0x3c112b0c, 0x83828180, -0x87868584, 0x00670000, 0x017f6db0, 0xffff0d73, -0xaf726484, 0x41544146, 0x4e203a4c, 0x6572206f, -0x6ebb6c61, 0x6d2dffe9, 0x2065646f, 0x63617473, -0x5021906b, 0x564e0300, 0xff736573, 0x6143002b, -0x746f6e6e, 0x14762023, 0x7fd6fd24, 0x6e25213b, -0x64006369, 0xa26b7369, 0x70706f6c, 0xfdbfed79, -0x277230b6, 0x6c6f636f, 0x48445473, 0x54205043, -0xd9045446, 0x266ff12e, 0x384c5452, 0x51393331, -0x32076c74, 0x05b6ffdb, 0x663b620f, 0x38333565, -0x636d7300, 0xed633116, 0x2d31ec36, 0x65180931, -0x6133626c, 0xedb177ed, 0x55746464, 0x362e0b6e, -0x78743039, 0xeb1f6f64, 0xd465bbb6, 0x1e787630, -0x1d64f56c, 0x33776e66, 0xed63cd6f, 0x1e333036, -0x30303809, 0x656e9763, 0xfb6d4a2d, 0x20006f60, -0x751b202d, 0xe6fd8b31, 0x6636d816, 0x03023089, -0x65207872, 0x6ff6f672, 0x207261bf, 0xaa586825, -0x70746674, 0x756f4c00, 0x11676e69, 0xfb7b2ddd, -0x73253a40, 0x2f2f3a32, 0x613c0f12, 0x6e6b5b62, -0x3e742ebb, 0x1298572c, 0xe678ad16, 0x0c6ead0a, -0x03366e55, 0x6edf8e18, 0x4120f12f, 0x2522b450, -0x0a220163, 0x656c6970, 0x56b6e673, 0x3e207af8, -0x073f6d20, 0x0591640f, 0xc35a2a94, 0x05294628, -0x6c3fe1ff, 0x002e771b, 0x72673a20, 0x68206d61, -0xd0a17b89, 0x468c4e5a, 0x67696294, 0x6c042f28, -0x49424eb9, 0x72837f0a, 0x75bb6973, 0x3a446dcd, -0x42401e0b, 0xc200742a, 0x1687b5b6, 0x2161a712, -0x6f8469de, 0x69fbb6ee, 0x6967616d, 0x657f733c, -0x693ead70, 0xff6d5f74, 0x705e7422, 0x662008f1, -0x2ebc756f, 0xbddc22c1, 0x654d0a1a, 0x2c00404e, -0xad6b0ab6, 0x0abc0ec5, 0x9243f0d9, 0xb75ee73d, -0x20856c20, 0x094333d0, 0xb7376f67, 0x2d646d1b, -0x77f86147, 0x523a7961, 0x0ad63dd8, 0x203b0abe, -0x29062628, 0x6c68d800, 0x444d9fc9, 0x5a65a112, -0x3fd0b09b, 0x3e796d2e, 0x16856e21, 0xbc73addb, -0x614427a4, 0xc7342872, 0x74749bdb, 0xf046e563, -0x53d6dad6, 0x1006745c, 0x657a6934, 0xc3582371, -0x5b0b0158, 0xc4204346, 0x38dcbb38, 0x70004932, -0xdd985dce, 0x3b28a9b6, 0x75130a29, 0xb5bd6e77, -0x4bbd8b76, 0x4e57706d, 0x747562a4, 0x8da386ec, -0x641d49c5, 0x0e7373dd, 0x6d0c130c, 0x1a613e53, -0xd8c61819, 0x656317de, 0xf7641069, 0x3b696a62, -0x6ec73774, 0x64973a75, 0x010ab98c, 0x14f6085f, -0x09796441, 0x25783020, 0x8e6b5a1f, 0xc94b136c, -0x6f66b7eb, 0x84c3464b, 0x0aec9072, 0xdb7b114d, -0x6d4a2ed6, 0x27502743, 0xf7b4603d, 0x6f4a5bd8, -0x75572066, 0x14966c72, 0x0ae6c2b5, 0x6e2f1964, -0xb9baab1d, 0xac90ce0b, 0xd66e6b97, 0xd676650f, -0x8750d861, 0x8970799f, 0x645a6247, 0x733b98db, -0x5b5b9f61, 0x85175d07, 0x70f21adf, 0x32156963, -0x36353433, 0xeb69633d, 0x424139fe, 0x46454443, -0x68032ed2, 0x1e563a06, 0x6d5ad7dd, 0x2f00edcb, -0xdc14395f, 0x205b3e37, 0x33534f8a, 0xf53f7032, -0x91306fb6, 0x342e351e, 0x435b322e, 0x9b10be18, -0x2037abec, 0x50478119, 0x3587294c, 0x746b3695, -0x1c654454, 0x36f1ad2e, 0x44d90c0a, 0x0e57c9c5, -0x377c2877, 0x0d0a8520, 0x08b74fee, 0x6ed4208e, -0x51784500, 0x46c3b673, 0xc30e3ab0, 0x23c0aa6f, -0xd0bc36ce, 0x7269c0a4, 0x202ce571, 0x37862112, -0x7dd6e42c, 0x2d739270, 0x85e37564, 0x7f0d8c47, -0x58b94300, 0xc61af1f7, 0x20b4c45a, 0x0a896f89, -0xcdad0b8d, 0x61665fd7, 0xb70d63c4, 0x4938186e, -0x65d84d4f, 0x9b74de67, 0x607dadb5, 0x67091f78, -0x18210b28, 0x3d46dce6, 0x23540a63, 0x5b9cdb86, -0x04846c56, 0xf1c96fe0, 0xb992c045, 0x6c1de27b, -0xddf612c4, 0x9133340a, 0x94621d65, 0xf645f266, -0x6ea67bd9, 0x799d2273, 0x37e0676c, 0xd22c2d6b, -0x9966c120, 0x67a11492, 0x12825f46, 0xbbd8c6f6, -0x75f53d21, 0xeac119fc, 0x17a03c36, 0x70736164, -0x2dd0cb7f, 0x0e747b6c, 0xde25296e, 0x1a50b05e, -0x870f91d6, 0x42b61b69, 0xb4ae2073, 0x6b0e6290, -0xb521ac0a, 0x61621f63, 0xd38041a5, 0x76e18223, -0xa5f57853, 0xb9f656bb, 0x2f004da0, 0x6b6e67a9, -0xe26360b4, 0xd3893c69, 0xc1c1c66e, 0x3932ffc6, -0x19aef776, 0x5fb88fb6, 0xa62c78be, 0x36bd92bb, -0x4578f574, 0x0c942978, 0xe06c1adb, 0x6c45ce61, -0x8348671f, 0x2b16c22e, 0x70cc3d61, 0x06bdb0af, -0x72ffd89a, 0x7d67c2f0, 0xf2db5c91, 0x9ed27920, -0x854f9cee, 0x07c0e876, 0x0a8c77c7, 0x5b56ed15, -0x7419bb70, 0x66662746, 0x03b92319, 0xf5415e1b, -0xe6003b89, 0x00a49eb6, 0x4f4f42c4, 0x339c2d60, -0x81c08813, 0x509c1597, 0x00ac859a, 0xdb146b00, -0x64381c62, 0x632c17f5, 0x88d1aedf, 0x010a3511, -0x062db9d0, 0x1420af4b, 0xde88531f, 0x1de9b122, -0x537978be, 0x657571b8, 0x19cb5eb5, 0x447cf981, -0x6ee3bb06, 0x6c24196b, 0x623436e5, 0x5241424b, -0xe1e37419, 0x7838307d, 0x52c3043a, 0x073a52d9, -0xbb86b614, 0x54687916, 0x3c08a761, 0x10d8040f, -0xdcf4cdd2, 0xf5b7003f, 0xf9736f4a, 0x0861c19b, -0xc9162143, 0x168dbd67, 0x3aa4688c, 0x5e9976a3, -0x6a2b9e09, 0xe02a2c30, 0xb80b0b18, 0x9964778a, -0x606e4a3a, 0x58230ec1, 0x42215758, 0x7589016b, -0x3f3a2d33, 0x206a71d1, 0xd7816158, 0x81b1736d, -0x58ee48cb, 0x8c265440, 0x6f42edb0, 0x75292e6f, -0x73822e6f, 0x55703e7c, 0x3300a0ae, 0xa2a9b741, -0x031ac0a7, 0xc700e691, 0x3702fde8, 0x07914000, -0x36cf9fbf, 0x076720d8, 0x93179b93, 0xc026db1f, -0x02100056, 0x17fb837b, 0x037faed8, 0xec228884, -0xaa812910, 0xd42e0788, 0x8139fcfd, 0x81388922, -0xf0860fb2, 0x6bfdbb13, 0x1307ef9a, 0xc2121111, -0x1543cc12, 0xbed41360, 0x07d96c7b, 0x27de4033, -0x07ea1340, 0xab0613d1, 0x9b6efef4, 0x1712596f, -0x14eafda1, 0x0789080f, 0x5712ab07, 0xfc6452f6, -0x7f891c81, 0x0889b601, 0xd39dc265, 0x0b0d033c, -0x50a5ee04, 0x0b40ac5b, 0xd74cc83f, 0x031d57a8, -0x2d580f7a, 0x054fdfb2, 0x962d6704, 0x0056c2bd, -0x1b033cd0, 0x00f511ca, 0xc15292bf, 0x65601bfd, -0x82639f2b, 0x0b966353, 0xc81605af, 0xb1778f76, -0x07390302, 0xf09f5f45, 0xa8547b2a, 0x07403755, -0x85800000, 0x0002406d, 0xffffff00, 0xffffffff, +0x44070c03, 0xeb3be850, 0x5dfdbc2e, 0x050ced81, +0x98ad8906, 0x168b00a5, 0xdbffbca9, 0x7400bfb7, +0x90b58d21, 0xbd8d073d, 0x39054d90, 0x390472f4, +0x890d76fc, 0xeeff1dbf, 0x3248b9e6, 0xfc89cf29, +0xe3e8a4f3, 0x362d8b51, 0x6cf66c29, 0xe8686f73, +0x3f450caf, 0xb70f1220, 0xfddb6d0a, 0x5c0424db, +0x8d502624, 0x50608085, 0x7c548ffa, 0xfedb7edf, +0xec01d38e, 0x936158cb, 0x66a102a9, 0xe61f6607, +0x648b9d0c, 0xf73428df, 0xf79cd424, 0xbe852696, +0xca9dcb9d, 0x6ffd8b6d, 0x57565507, 0x10247c8b, +0x61983d2b, 0xe0cda810, 0x68af7eee, 0xe8550e48, +0x5b217cba, 0xbb758df7, 0x42a30e40, 0xbe778904, +0xdeb4b923, 0x29edb6fd, 0x732ea3f1, 0xf8ea2015, +0xb8000881, 0xffdb7710, 0xd88e1cef, 0xd08ec08e, +0xe88ee08e, 0xc35d5e5f, 0x89e64035, 0xddfb4435, +0x3d057e7c, 0x584c1d48, 0x250b50a3, 0xfeeb0554, +0xbb59b85e, 0x0300e968, 0x68535f1d, 0xe4514328, +0x3ddc3efd, 0x890bb1e8, 0xa5282ca5, 0x6ca52f20, +0xd737a5de, 0xe4cf6129, 0x8100768d, 0x858fbcfc, +0xa8dd35ee, 0xed0c6020, 0x02341b22, 0x6edec646, +0x17072db7, 0x7e8bd0ff, 0x3c8e8b8b, 0x8b8b4647, +0x3ca18b15, 0xef0a342e, 0x8be2ff04, 0x68d6da4c, +0x6e3f5189, 0x5902dffc, 0x08618904, 0x890c6989, +0x14796071, 0xdbc3006f, 0x1b7342f6, 0x8b08431f, +0x095a374a, 0xfafd3d62, 0x0c6a086f, 0x8b10728b, +0x051c147a, 0x0b89ffb8, 0x43ada567, 0xbea29c28, +0xe10c5401, 0xce62d992, 0xb8bb188d, 0xfbc61f30, +0x21a225a1, 0x2e9d5d58, 0xf0f0b928, 0x2b07351e, +0x38815080, 0xc3c34800, 0x82858901, 0x75956ffa, +0x68e486c4, 0x284f2907, 0x9a352f0c, 0x535053fb, +0x2c1d9da9, 0xcb024389, 0x03752fb7, 0x88101f0a, +0x0c020443, 0x0f076388, 0xf6e35b7f, 0x90c3585b, +0xc6535600, 0xb8ab1525, 0x67a6046c, 0xc66577ff, +0x70b0d629, 0xd329c389, 0xb801006a, 0x847132e8, +0xe42dddbf, 0x05685004, 0x6e09e5e8, 0x6f0b3b80, +0x0dc2bd6f, 0x057703c6, 0xb01097c0, 0x06131800, +0xb1032e6d, 0x0a230b03, 0xa6d81457, 0x1881d6b7, +0x6a100479, 0x50160d02, 0xe4679b06, 0xb8501cfb, +0xe8e851ef, 0xe3c28993, 0x537046df, 0x0a23f666, +0x0f037401, 0xc5b8c6b6, 0xa39ec1b6, 0x12038849, +0xcf233d92, 0xfc1e45f2, 0xd24defef, 0x978dec9d, +0x04bb782c, 0xc8fc2303, 0xfc33cc96, 0x26c03229, +0xe77b5ed6, 0x05262b0c, 0x0b642694, 0x0631617c, +0xb901f083, 0xcfb22f01, 0x0c1573c8, 0x5608d20c, +0x59b26791, 0x151729af, 0x9e4b6f0c, 0x3426a815, +0x9616c766, 0xc7b708b1, 0xd8170a6a, 0xe60c2422, +0x1733f919, 0xe61c7417, 0x171a5bfa, 0x0e333518, +0x367d8800, 0x50d8dde9, 0x39d06a3d, 0x836630eb, +0xbbe5b4e7, 0x19755741, 0x17111607, 0x6faffbe4, +0xe2c112ca, 0x01104306, 0x100febc2, 0x77e3f016, +0xd0891419, 0x1e5755a1, 0x6fdebb3c, 0xa995ef7c, +0x54513b07, 0x46b87d7d, 0xf48ba46c, 0xbdea71f5, +0x7f1e9081, 0x06df835b, 0x04665024, 0xb3e82268, +0x6c1f8407, 0x7b81c063, 0x07740e12, 0xd87956e7, +0xf639eb7b, 0x8b2b0d7c, 0xdbeefdc8, 0x8d457cd6, +0xb9fc1a37, 0xa5f31305, 0x14c58343, 0x8fd9f6c6, +0xdb850b71, 0x96bc9d74, 0x3c4cd889, 0xb106c361, +0x9f5a5fd6, 0x4bda1bfe, 0xb20df02f, 0xfffe84e8, +0x3360a3fe, 0xfbf3e886, 0x0aa0bb73, 0x950964a3, +0x136c6820, 0xfbefff2e, 0xc4684ffe, 0x75c08510, +0x0c05c773, 0x2005db02, 0x63b042df, 0x097005e5, +0xc1490508, 0xf77b9b73, 0x74a30ae0, 0x15899907, +0x7c1f0678, 0x75832105, 0x8009db63, 0x84091029, +0x6c9ba133, 0x3164b06c, 0x548c2a88, 0xbdbb3490, +0x28bf0611, 0x8660773d, 0x5ee9055d, 0xa089a983, +0x0b18145a, 0x19a04508, 0x1c180ca4, 0x88977b6b, +0x79b9358d, 0x0c011740, 0xedf0d8a6, 0x0a870f1e, +0xbdb98105, 0x4f7730ff, 0x587df08d, 0x2b0a064a, +0xafba1299, 0x7dfd8e91, 0x77a4b7eb, 0xc8993b08, +0x078b0676, 0x61b181c7, 0x2ef3c5cd, 0xe430f309, +0x29b1b164, 0x6736191e, 0x67de00a2, 0x09ff9dd3, +0x818b920f, 0x6822918b, 0x72dec738, 0x3803d689, +0x10cbb113, 0x1bf06f02, 0xd639142d, 0xd8776a72, +0x376476c3, 0x2dd8fd8e, 0x2f390c11, 0x08722c77, +0x22773f39, 0x9ddb1b3b, 0x2b1c19db, 0x814f1b0f, +0xec39194b, 0xeb9189f3, 0x89892128, 0x19108ec1, +0x78815ec7, 0x08b63809, 0xc18347ed, 0xcca15d71, +0xeebb1201, 0xc3267370, 0x2bd813b8, 0x42ee3305, +0x7a9f61d3, 0x97d0850c, 0x230ac632, 0x084a75db, +0x08a60acc, 0xc1fc607c, 0xff0cca3f, 0x727d9c35, +0xec2e0000, 0x12dddd91, 0x8c2f6814, 0xeb5d5513, +0x075203fe, 0xa36f6df6, 0x6efd2835, 0x3935590c, +0x7420fd86, 0x97cca12c, 0xedcc8f80, 0xf15a9816, +0x3ae81b9f, 0x8e077837, 0x446a166f, 0x8068d557, +0x10f4ffb9, 0xc361ff05, 0xe80aebc1, 0xf4c81ee7, +0xaa8450be, 0x3172189d, 0xb8b114ba, 0x16afacd0, +0x2ea118a7, 0xb7f6c674, 0xc13ae9c2, 0xfa890ae7, +0xcbceb809, 0x362da702, 0x55d78923, 0x7aa0dbaa, +0x1ea19da6, 0x144ce88b, 0xe4db93ee, 0xe81c735e, +0xa7460b85, 0x836206fc, 0x187b0c1d, 0x8856c35b, +0x26661447, 0x35bbfbd0, 0x96e2811c, 0x061a8c8d, +0xc0fc2e99, 0xf289336e, 0xa4227423, 0x0bff817e, +0x74c98504, 0x2102c714, 0xfb455246, 0xc281044a, +0xe0c05e00, 0x49669fef, 0x24e8ec75, 0x57711b00, +0x75c66c32, 0xadc5e898, 0xf58b78a0, 0x1c1f369e, +0x77d4bed5, 0x6c37fe74, 0x29f1893f, 0xbb01c2d1, +0xd729c789, 0x80398166, 0xa85e7402, 0x3f4fb6fd, +0x98187564, 0x044703e0, 0xd4bdf361, 0x4fb71d6d, +0xebd8e604, 0xd23efbc5, 0x43c1d9b1, 0xc358828d, +0xe300e381, 0x68ed8f08, 0xde0d0d8b, 0x2955ce29, +0xb1bd1ad0, 0xc8393ffd, 0xd8392977, 0xfb812577, +0x1d9c0a13, 0x61e9c889, 0x2719a1a1, 0x1d48ae56, +0xb312211d, 0x04351c21, 0x2240ccab, 0xf48950b6, +0xec56e13b, 0x4a4d81ef, 0x34053b52, 0x71393277, +0x760d8b6e, 0xff522a75, 0xfaf05745, 0xd186d904, +0x096705c7, 0x83838904, 0xa84f0b60, 0x23631bc8, +0xc454c8c2, 0x86d7245d, 0xa3975c05, 0x5cef2e8c, +0xc736ed88, 0x987fed46, 0xb81ec8a1, 0x811d9601, +0x5b084087, 0x3a01b8c5, 0xb63d9bc6, 0x4c4b8c42, +0xbbf0a12d, 0x8b7eec54, 0xe9815c36, 0x9654bf4a, +0x78f23d4c, 0xf529fd35, 0x478979aa, 0xf21e11dd, +0xf7813386, 0x3800b80b, 0x2dd9ccdd, 0x54f8fb0f, +0xd6dd9b37, 0xa113fd0c, 0x18e44e8c, 0x30019d03, +0xf38d0da3, 0x025d9bbe, 0xefd82066, 0xe507be6d, +0xa9000189, 0x46c070a3, 0x74a2bacb, 0x85e59e56, +0x8817ab5b, 0x0242e798, 0x2dacef48, 0x0112ee76, +0x05d6c8e5, 0x436bf7b0, 0xb82e75fa, 0x81120054, +0xc1ea8112, 0xefd9ac6f, 0x89af928b, 0x01db6810, +0x060850aa, 0xd74fd087, 0x3575a9b5, 0x57204e6c, +0x19285a24, 0xff8b74cd, 0x77df3d3a, 0x1a048d11, +0xed152b90, 0xa8f6f587, 0xeb081d89, 0xe8052523, +0xd622fbc0, 0xd048083a, 0x283a08ff, 0x3fed86d2, +0x89dd29c5, 0x0c7f83ee, 0xff9c15be, 0xba395577, +0xc4748150, 0xeed85be9, 0x0ba1c239, 0x01bfb18d, +0xfc334c8f, 0xe856ee60, 0x01121bcd, 0xf45e8dc6, +0x8dce33f0, 0x37395b6d, 0x0435b319, 0x4dfe1f10, +0x02c3df9e, 0x9a01c132, 0x06548d12, 0x178054e0, +0x818b56eb, 0x30ac018b, 0x03e833fb, 0x12e88906, +0x7b6bd906, 0x081436c2, 0xa0107ff3, 0xd8172508, +0xdb3414a8, 0x14475942, 0x6ddb3704, 0x47301c05, +0x9174290c, 0x5b7c73ac, 0x03990d66, 0x750803dc, +0x3fc4da97, 0x8303014c, 0x04e2fce1, 0xcc297155, +0xc6c08db4, 0xabc35154, 0xf57e0c6c, 0xdddc5c24, +0x2ce8d024, 0x5dec8906, 0xbd4ea1e7, 0x6140e194, +0x94249c10, 0x77036308, 0x335437d8, 0xec40ec07, +0x180d6f0d, 0x745836f7, 0x898f8d48, 0xa97c5b22, +0x83d67778, 0x060018c2, 0x2f85aea5, 0x2c7630b0, +0x12c7c2b4, 0x00adb6df, 0xc07c7964, 0xfec1c6d3, +0x6f6e1602, 0xf1393ec1, 0x551b107d, 0x0f41108c, +0xb00df07c, 0x52671b75, 0x98145f53, 0x62c631f9, +0x240cc1b0, 0x264f2e63, 0xf43c58d1, 0xaa10a117, +0x45f81eb8, 0xd02dd8f8, 0x01e80566, 0xc783c416, +0x4b8dd6eb, 0x2d4640c4, 0x36241dce, 0x74d285bc, +0x02c50610, 0xa1d03994, 0xd6284523, 0x8ba3bf49, +0x05b72c06, 0x4a21041b, 0x6ae30f08, 0xe570f7b9, +0x150db459, 0x52c9008b, 0xc3d84f86, 0xa7d10abe, +0x93e8da74, 0x3982b9c4, 0xfe0b73d9, 0xf6f18304, +0x42c11937, 0xf572da39, 0x5e5bc10a, 0x1bbe1cb4, +0x3086746e, 0x982f408c, 0x07a10a74, 0x9b831de9, +0x7599e509, 0x1325b620, 0xd86b822d, 0x80fa21be, +0x1bf16ac2, 0xee6217fd, 0x23a6840f, 0x0f0264a9, +0x29f0e783, 0x301989c7, 0x20448b1c, 0x326c80b9, +0x6bfef0d0, 0x738d1205, 0x11838d60, 0xbefe18a6, +0x816e2f0d, 0x81a58eef, 0x042d05c7, 0xfb049605, +0x1bc6eb31, 0x0ad0e714, 0x07011883, 0x9b783fb7, +0x32e42d12, 0x68056c8d, 0xd478f0e5, 0xe4a35828, +0xafdb1b28, 0x046a1c6f, 0xad8c4a68, 0xc60558d1, +0xd0ce58ac, 0x07c695d5, 0x0e431807, 0x91844605, +0x0c0e0891, 0xfb16ac30, 0x9c05778c, 0x2b6612e2, +0xb1060abd, 0x107beeb1, 0x142b1625, 0x6edd9405, +0x05ffdd2b, 0x571c5318, 0x1e0d071d, 0x7690eeb1, +0x1f97ccfb, 0x0f200328, 0x6dba775d, 0x22022a07, +0x2e13bca1, 0x02d82603, 0x306a6536, 0xea320d11, +0x54066c9e, 0x3643057c, 0xb6c6405c, 0x43ceec48, +0x46078e42, 0xc6f94805, 0x4a12f906, 0x1250054e, +0xdc2d3752, 0x6a055606, 0x35010158, 0x77054328, +0xc7e3f0c9, 0x68eb2404, 0xbadf164f, 0x07742257, +0x0646ffb0, 0x46c60201, 0x46fc2c08, 0x6014830c, +0x4693b6cf, 0x570e2c0a, 0xd7e71246, 0x467bac1d, +0xdc140320, 0x16032246, 0xd8c8f622, 0x1a281858, +0x001e1c05, 0x38956200, 0xe6245361, 0x7b502646, +0x60603824, 0x83a72a46, 0x8f0c0fe3, 0x5e7dbbb1, +0xb42c6a28, 0x46c9fd37, 0x80c78e09, 0x08c36c8c, +0xdf1fc106, 0xbf703a68, 0xe80f377a, 0x6a95fbdb, +0x938bedf6, 0x2c6aa517, 0xfff91a15, 0xb1063cff, +0x1cb320c6, 0x7adbf57d, 0xa9e81f6b, 0xdb4a1cf6, +0x1d19e3c1, 0x060831dd, 0x3c55c7ed, 0x914823de, +0x1434164c, 0x436762ea, 0x51ed9960, 0x89628eb8, +0xfdf40d13, 0x7e0ff86c, 0xcba2708f, 0x95eb81d3, +0x6deb68be, 0x6d063ffa, 0xcf29f789, 0x8389078b, +0x04260b48, 0xe0bbad0a, 0x4e83ec8e, 0x4c83250c, +0x60156006, 0x94d3ee83, 0xeac1180a, 0x35d05719, +0xcd8d2285, 0x1bd04e76, 0xed84067f, 0xa9bad0e3, +0x0620d0ee, 0x82c0010e, 0x4e810cb5, 0x53dfecb3, +0xaf5274f6, 0x98ba3f74, 0x9598152b, 0x3bfdcc18, +0x808b5f16, 0xe802899c, 0xb042c8ce, 0x7650d090, +0x46687714, 0x8e519c2f, 0x3be86a18, 0x57b5c557, +0x23740e2c, 0x88052378, 0x34e8d0d0, 0xe7c75cb7, +0xb060e46c, 0xe8a6eb73, 0xb257ea56, 0x85526cf8, +0x0b8d147a, 0x9fe662cc, 0x323a1bed, 0xe8d0de38, +0x00c18960, 0x83024b0c, 0x27dd0de0, 0x01d30db5, +0x063979f2, 0x5312e283, 0x810e2d80, 0x85086a04, +0x0f78364d, 0xa24635e8, 0x77f9cc05, 0xda1d1dee, +0xaee8206b, 0x1409b322, 0x74085e5b, 0x8b6d672d, +0xdd24ec20, 0xe01bc777, 0x76a83881, 0x4d028b1f, +0x6904428b, 0x35b62060, 0x72080762, 0x37ed1040, +0x06a0fe28, 0x138b1beb, 0x362d4314, 0x82438fb0, +0x93310640, 0x35bb51b0, 0xc109365f, 0x92c81315, +0xff5a2c7a, 0xd001d144, 0x8370498b, 0xc60e506d, +0x9466ce25, 0xdc09bddb, 0x18bf7c24, 0x9e908068, +0x7c04516b, 0x0eb3639b, 0x774c094d, 0x5515b879, +0xcecd9187, 0x27000a0b, 0xee2e7022, 0x3dce8c47, +0xbeb7be51, 0x6f7d1486, 0x9f83aded, 0x900a7702, +0xa0853493, 0x0fc07b72, 0x75f81bae, 0x8d6f9f17, +0xadd1247b, 0x247e9e45, 0x75161c00, 0x6e0b0e1c, +0xcc1b6deb, 0x7e144270, 0x17743b64, 0x310775e9, +0x02219f02, 0x3c91a916, 0x062e4baa, 0xdb99ae68, +0x76010f48, 0x580f0069, 0x506a4988, 0xb4834c5f, +0xd190b90f, 0xff53e06f, 0x0003c713, 0x07dff724, +0x3023d0de, 0x468b2c4e, 0x9768e15c, 0x5dbf64d8, +0x5750bdba, 0xfbfce027, 0x88608a68, 0x1c896c46, +0x4b8b18de, 0x2a4820b4, 0x568bf4b0, 0x865b6768, +0xee52a317, 0xe20be76a, 0xd8373d55, 0x8129c360, +0xbcc09454, 0x062d09e8, 0x018816c4, 0x8555fef9, +0x1df6d78b, 0x478d021e, 0xb42d5007, 0x3c68a4b9, +0x47305dfb, 0x7e02ff83, 0xec584bdd, 0xcfbb7657, +0x0c0863b6, 0xbded6662, 0xf68a9bba, 0xbbb95ac4, +0xba052017, 0xb85209a0, 0xb56a05a5, 0x75296ef6, +0xff5008a8, 0x97695c76, 0xdc3efaeb, 0xe0686807, +0x864fafa5, 0x8f019b14, 0x161f8fdd, 0x7404a858, +0x9110e117, 0xaff88a24, 0xf8b83461, 0x00c720f4, +0x3f521f43, 0x46d26f7f, 0x061db948, 0x501c9b4c, +0x85541ef5, 0x1b4a1309, 0x82e6d62f, 0x2c761b04, +0xd1423eb2, 0x78db1681, 0xcf4ec764, 0xbe8dffff, +0x0be5d30e, 0x80b0596c, 0xb0eefa89, 0x89edee88, +0x04c683ce, 0x68973878, 0x81ed68b4, 0xd3f10ec5, +0x88e0bc6e, 0x19ab59f8, 0xe0e2f7c0, 0x152fb402, +0x1c8ad23e, 0x8888cb2e, 0x76f6add8, 0x02f96db7, +0x83138a32, 0x4e088cc8, 0x6c42cd79, 0x47bbbb0d, +0x5a10beed, 0xb1d98cbd, 0xdddbe80f, 0x0c4ea1bd, +0x49ece3d1, 0x0b89c309, 0x112cc888, 0x85bf7a7b, +0xb0e37ff6, 0x10512ef7, 0x1f7f84b0, 0x13b96767, +0x0eb804bb, 0x06b90084, 0x441d9d2b, 0x230807ef, +0xe8360c09, 0xef37da61, 0xb01fc90a, 0x1aed6eac, +0x3715573c, 0x97d429ee, 0x821b4fa7, 0x4c97d83c, +0x6b0b2e9a, 0x082c42f1, 0x10682b68, 0xb8470974, +0x1323ae04, 0x20b9eb3c, 0xfec35c77, 0x5f8bc6ff, +0x8d0e0440, 0x41ee0b14, 0x7e05f983, 0x5a0cb0f3, +0x0ac645ab, 0x0c578f86, 0xf427b0eb, 0x400c036c, +0x9dc860ef, 0x10ec3f1e, 0x35ef30f6, 0x4c0bb866, +0x9ee857ef, 0x0ba11845, 0x15de04c2, 0xba31663c, +0x5fd4ea33, 0x24d81492, 0xd30af8ed, 0x862c620b, +0x06a7fdc4, 0x3b826c22, 0xdc682c96, 0xed5031d1, +0xe6ef9068, 0xe268b612, 0xdd021f11, 0x5bc77c9d, +0x0b13e868, 0x68383753, 0xb4fe8dea, 0x4ff911f9, +0xfb580ec3, 0x7c0d773b, 0x78d76cde, 0x760c554d, +0xe110caf3, 0x47050ff7, 0x02e2c13f, 0x209a0366, +0x91fc71ef, 0x081e406d, 0xe8ef1017, 0x9d28ea5a, +0x45234cdd, 0x3ec412c6, 0xbf61d10d, 0x252d3119, +0xffff800c, 0x05bbef12, 0x0edead57, 0x2d2c709d, +0x1a2df039, 0xd372d91f, 0xc3f6ed47, 0xdf864bf8, +0x40147d46, 0xeb08a38a, 0x3300bb0c, 0x16280b9e, +0x282810fe, 0x1b86d8cc, 0xc90b20cf, 0x3188dc18, +0x127aa867, 0x6c615c01, 0x3c8330c2, 0x42010269, +0xb11b6d87, 0x5ae8d395, 0x9bef10ae, 0x8268f05a, +0x8b502c2c, 0x8df03f82, 0xc14cbf0e, 0x922510ef, +0x68753ea8, 0x0da50bea, 0x810811ef, 0x763beeff, +0x3c2d7d7d, 0x6dac5197, 0x6034d7f6, 0x5e6e0c17, +0x98e1fd7f, 0x97dd98e9, 0x472e7ae8, 0x3a98647f, +0x3220003d, 0xae52ee38, 0x58fcbbdd, 0xec54d329, +0x345ecc82, 0xfc4de11e, 0x4e7ae860, 0x29f88990, +0xd7f02dfa, 0x7753861a, 0x2f605e03, 0x5806d861, +0x18e6188a, 0x3264769b, 0x0d9b6315, 0x03321947, +0x75fb1ade, 0xea075f6d, 0xa1660aa3, 0x7c92e810, +0xbb3dc14b, 0x9851e2ef, 0x6924b486, 0x86818263, +0xbe0c1761, 0x87e18e53, 0x9bd02e31, 0x26740204, +0x81538b80, 0x0c37eef6, 0xf7f26926, 0x1dd021d2, +0xf0090275, 0x2ece9918, 0xb18def1c, 0xc4360c01, +0x30906da1, 0xba1c047d, 0x81a92674, 0x10b0b669, +0x6f6f841c, 0x1c8325e4, 0xb05367b7, 0x869dcd67, +0x8fbe19d0, 0xd4b53547, 0x0f18ce0b, 0x7396debe, +0xeff68b05, 0xd1ef05e0, 0x486948b8, 0x05fa816f, +0xf5776a6e, 0x77075aac, 0xeb0ce206, 0x70780d2f, +0x7422a6f6, 0x2e25eb18, 0x6cfc7301, 0x3d2ad810, +0x540e2c2a, 0xd8fffff8, 0x1df57ab6, 0x0350a4f4, +0x3a3b48c5, 0x8d42705d, 0xffb8fd3c, 0x47b40681, +0x768810ec, 0xd431005b, 0x3abb00aa, 0x9ba3e483, +0x5d54cad8, 0xed023d2b, 0x2ad17ec6, 0xed0a96e6, +0x410c75a1, 0x02df660b, 0x699ce808, 0x2afba5e0, +0x74fcfd18, 0xf0556822, 0xdb1e0750, 0x70169edc, +0x49c0913c, 0x66a1e82b, 0xedd7236e, 0x041a620c, +0xe96e9c36, 0x741d8b04, 0xa5051ed6, 0xe6180544, +0x61836ff0, 0x41bdf4f4, 0x1c5bffa8, 0x13b842b0, +0x7512e320, 0xddbaf8ed, 0x29f84f03, 0xa1892ee8, +0xa975c909, 0x3ee0a45e, 0x98fe7445, 0xe87deebd, +0x68b518a3, 0x310a6435, 0x64f915a2, 0x6c877779, +0x3d589763, 0x766b2efc, 0xffbf3dfc, 0x12e0bf02, +0x7ea95874, 0x02fe8354, 0x10a14f7f, 0x9f7740c7, +0x1d14bf78, 0xa50c1d8b, 0xff08e4a1, 0x71760450, +0x23e7126c, 0x05417883, 0x8dfa3abe, 0x41fe5b11, +0x68016a16, 0xd46a18d4, 0x79ddf126, 0x33de384c, +0xeb7653d3, 0x469eb01c, 0x651a5c6e, 0xb1033974, +0x0ff636dd, 0xfd10598f, 0xe9087219, 0xa0eb0d81, +0x94049767, 0x8a8c0800, 0x47a1fe4d, 0x14db7ce1, +0x975e2248, 0x350fa02f, 0xe81b74fc, 0xd10a19ac, +0x621b12b7, 0xd5f7a26f, 0xe812ba17, 0x31b003bb, +0x6b8eac16, 0x710c4ddc, 0x36fdeec1, 0xd9e8a33d, +0x00c9f005, 0x9b6404be, 0xff3d8b10, 0xc1dc0c6d, +0x541073ae, 0xe9c23009, 0x9859f610, 0x55658535, +0x1cace884, 0x35a394da, 0x338d3b61, 0xcfd8fbe9, +0x894157b8, 0x02e1c106, 0xa3d340a1, 0xa036a5dc, +0xcbe2fe0f, 0xb60fec15, 0x4081ad78, 0x61223603, +0xc22f0b0a, 0x031364d7, 0x16981285, 0x6b1d9d82, +0x0d751208, 0x75c219b5, 0x15c5b7a9, 0x71151731, +0x86bd168c, 0x8ffa59af, 0x1ea12371, 0x1dc3343a, +0x60908d51, 0x84ab6a08, 0x9f95f082, 0x80cca30b, +0x5884709f, 0x5089ba82, 0x1c5889c2, 0x08308c21, +0x0c3e20ee, 0xfe10f0fc, 0x99be0dbe, 0x4f0111e9, +0x430c1b2e, 0x15428233, 0xb08e1478, 0x55142384, +0xeccce964, 0xe3c423b0, 0xec33745c, 0x74f4302a, +0x7a8b6d84, 0x1a74763b, 0xf7cf5a19, 0x7db3fb05, +0x90e03846, 0xd8860245, 0x0978c43b, 0x803c896e, +0x3563c7ec, 0x69785208, 0x62ebb3be, 0xcd74231e, +0x1e340c8e, 0x17eb3647, 0x408cde10, 0x7d83df04, +0x4f92c20e, 0x7945ff67, 0x4434097f, 0x05b410ec, +0xd8048d41, 0x9659a1c1, 0x6aa1a17a, 0x0390d6db, +0x0c897f11, 0xb7f85408, 0x35c637ed, 0x2dbb6301, +0x12dc3e80, 0x68743a04, 0x0dfb6ef1, 0x1e3c8043, +0x3a05060b, 0x80bff375, 0xedca5a33, 0x0570ffe4, +0x0194d808, 0xbd12c4de, 0xe814bf37, 0xb2274863, +0x8205bb3f, 0x722408c7, 0x00b2e9df, 0xfdc0da31, +0x036aa6e4, 0x8cb57568, 0x0c6dfa1e, 0x352d34db, +0xd8a58892, 0x47386f03, 0x06a493b8, 0x2f388085, +0xd70b1e1a, 0x331d4774, 0xe4cfe852, 0x9ce6b701, +0x3403ce8b, 0x4020921d, 0x7beed8e1, 0x240a5429, +0x318a5010, 0x3760f615, 0xe0cf9e29, 0x1f2d7546, +0x959af03e, 0x687ef2a3, 0x44c83679, 0x04fd18ed, +0x36a66806, 0x3e401480, 0xc3dd0afd, 0x25740457, +0x2d905650, 0xa5f18568, 0x9e29f202, 0x001f2015, +0x86e1e900, 0xe885f425, 0xfc971a13, 0x07759c97, +0x6a143c24, 0xab02d0fe, 0x480288c1, 0x3e227c80, +0x34180b7c, 0x3d80382f, 0x29749945, 0x0d631186, +0xc2b80825, 0xb8775f7e, 0x860f3d46, 0x0bee52f9, +0x6033c781, 0x8605f5ab, 0x97fabdbc, 0x31785bbb, +0xf6218b33, 0x8a0c4405, 0x466b46c6, 0x0fd4129a, +0x8c520a07, 0x26240df8, 0x6abc5c79, 0xa9ba6b6e, +0x94808dce, 0x30dc5264, 0xee8b9c1a, 0x2c35ef6e, +0xdf96e806, 0x62dbe0bc, 0x64100d9f, 0x593f43af, +0xdd821d25, 0xbb3595d4, 0xdb85ffd4, 0xcf7ef608, +0xd953401a, 0x040de028, 0xb14a5868, 0x28dcc180, +0xfe47502c, 0x087725c1, 0xcb270001, 0xc695be3c, +0x89932080, 0x40bc855a, 0x8bb24d85, 0x8b20e84a, +0x996a0c42, 0x0d8b637a, 0xbb73bad9, 0x6816f895, +0x9184d8a2, 0x09481d20, 0xb0af6a5b, 0x113248eb, +0x0738b890, 0x876c64fa, 0x18a3042a, 0x1875022f, +0xac1b81ca, 0xb91b2b45, 0x567dec3b, 0xa10e20f0, +0xa1307c34, 0x636c1604, 0x4334a3f6, 0x6f723815, +0x22b6bf86, 0x0fff243b, 0x543bf025, 0xc1d1bd8a, +0x9014b0f8, 0x8203bb01, 0xb72fb261, 0xec830f75, +0x8a3629d6, 0x1e1837f7, 0xa01a7584, 0x74ed8504, +0x141d8b3a, 0xf6d88241, 0xe776f339, 0x63336bf3, +0x2d4b1b4d, 0xad14f357, 0x19012129, 0xd763ebee, +0xdf01de29, 0x04411d36, 0x62105a01, 0x1d5b34ca, +0x28a09d4c, 0x38246eab, 0x07d419c4, 0x4ec29730, +0x03416705, 0x6010428f, 0x2df48d13, 0xccb8300c, +0x7d084d2d, 0x0531bdfd, 0x53e968e8, 0x8c591c3c, +0xa7b3850f, 0x4cad5f2e, 0xd461e075, 0x614b5650, +0xf08631f8, 0xbb05bb48, 0x0f1bf3ff, 0x93c22307, +0x2601da41, 0xb4bc02de, 0xc28f89fb, 0x39d021c8, +0x720cc405, 0xfa5bc015, 0x730b4fec, 0xc01a6609, +0xa436c821, 0x14250562, 0x05b974bc, 0x03ad0e8e, +0x7403df5c, 0x1fb86012, 0x34a5c728, 0x0b5e0508, +0x73fbd00f, 0xd8bd1baa, 0x8dda8391, 0x62c2fb53, +0xf12e348d, 0x0baa2e60, 0x9839302c, 0xa5a68587, +0x3b351fd7, 0x0e767508, 0xd5b894ab, 0x335b19ba, +0x5fc8cacc, 0x51aec02f, 0x50ce28a1, 0xf1077704, +0x3b6a176f, 0x064bebf2, 0xeb287403, 0x7d148b44, +0x180de160, 0xff307c80, 0xeb0f37e1, 0xcdd9bd31, +0x04241281, 0xc3b11eeb, 0x1bde051d, 0xa3660637, +0x205456d3, 0xbf761eed, 0xeb89e7a3, 0x2c568284, +0x1f74b97c, 0xcda9173b, 0x3274c806, 0x68100351, +0xafc46082, 0x40514c9c, 0x80305d1a, 0xc81c0d4b, +0x1b111007, 0xa4e349dd, 0xc558ff54, 0xd7772343, +0x0b0bb4dd, 0x6d05b005, 0x418dff5a, 0x1075345d, +0x721a15ee, 0x39087728, 0x63909b1b, 0x291e721e, +0xac241914, 0xe91c4efb, 0x010f7888, 0xd819c71e, +0x39459d82, 0xb87309b4, 0x4417361a, 0x5c4368c9, +0x8a5c1dcd, 0xd810f46d, 0xa0c2078b, 0x3dd4d0c2, +0x3869cb86, 0xf6301840, 0x409a363d, 0x291ecd42, +0x2b77012a, 0x81d2cb16, 0x010da850, 0x702f4767, +0xd000d1b1, 0x627b0c9a, 0x253a8c52, 0x3a68b18b, +0xa88b6ddc, 0xac151325, 0xeb548a52, 0xac8ebc59, +0xbe40292d, 0x47ea02a0, 0x084a1b60, 0x8b413eb0, +0x6fbea48e, 0xefb0573b, 0xd3392f55, 0x392972b1, +0xe107bd6f, 0x442572c1, 0x07a11674, 0x968b0517, +0x7efec41b, 0x05903b2c, 0x1e890673, 0x125fc661, +0x1020a97e, 0x7ff839c5, 0x8b5a74a2, 0xb1975ef6, +0x86e63435, 0x6cdd2fac, 0x06c03f5a, 0x19c129b1, +0x76cec3d3, 0xb3591d68, 0xdab03a55, 0x3d110d44, +0x82e63997, 0x759d8f21, 0x3458e865, 0xf02d3546, +0xf7e70025, 0xa8157847, 0xd311c101, 0x11540d01, +0xb3f11c1d, 0x0f1ab308, 0x5c09d0ac, 0xed60d8b1, +0x2901ff2f, 0x721e40a3, 0x721d0d0f, 0xe8265038, +0x9d207878, 0xeb2df535, 0xa9080a72, 0xb608ceb3, +0x3473de20, 0x22a38306, 0xe90b63d4, 0x1f7269a6, +0x3228865a, 0x1949e867, 0xa78a76ec, 0x30edc047, +0x142b7ee8, 0x0c5b7eef, 0xd0892815, 0x34688d2a, +0xa958e1bf, 0x00fa0e83, 0xbb83d693, 0x020297a7, +0x838b373f, 0xb30600ac, 0xf6135ab4, 0xf0e87807, +0x4955580a, 0xc7788fd8, 0x1eab0357, 0x8d20c3d1, +0x21bd3a55, 0x3966b198, 0xb5ab6e35, 0x221ed73d, +0xa50f1a2f, 0x309d0884, 0x3cff93f8, 0x70d9916e, +0x89a31bb6, 0x7cdef608, 0x22004044, 0x22f163a1, +0xfaf8231f, 0xe042505f, 0x146ea615, 0x1e92815d, +0xbf8d4bac, 0x4378b635, 0x04e316aa, 0x53505033, +0x91c184e8, 0x8530d088, 0x024d0ac0, 0x721edc2d, +0xc356e6bc, 0x63c9786b, 0x3f2ae816, 0x1b473502, +0x85b68cef, 0x57c0189b, 0x41985d99, 0xad1afd5d, +0xf05fe879, 0x9eb341a3, 0x021085ed, 0xc05e20c8, +0x07a283c0, 0xeab8bae8, 0x3bfc428d, 0x339456f0, +0x62e8059e, 0xa0c27cc8, 0xb804a4d4, 0x48f5fd38, +0x681858c0, 0x3be36db5, 0xab55b800, 0x6cba7d82, +0x4186f74e, 0xf41b4c4d, 0x8ed1a15b, 0x2c82b386, +0x44a1480c, 0xf30a4176, 0x3dbbd78d, 0x51e9e4a5, +0x78e9ea90, 0x45e10701, 0x52f16803, 0x3073486a, +0x3aebcc50, 0x363bade0, 0x07247640, 0x035cfa52, +0xb87b2f15, 0x9ab46858, 0xe9204064, 0xc3bddaee, +0x3b48f84e, 0x760a540d, 0x3b406634, 0xe865331d, +0xd873f000, 0x36f90a02, 0x1c05daf8, 0x3fe86051, +0x81308c24, 0x361ff703, 0x81d268be, 0x90920e15, +0xf0561bf0, 0x8969120d, 0x4ad78c4c, 0x2c451656, +0xaff053aa, 0x7510bfe0, 0x87878b56, 0xc14ff053, +0x89c13797, 0x878f03d3, 0xef6c5d05, 0x3b0f789f, +0xe61ca118, 0x93c0865b, 0x267256c3, 0x437d0477, +0x8f208290, 0x12771c01, 0x47520672, 0x18fdddea, +0xce990a77, 0x19014608, 0x2db7887c, 0xea9977f5, +0x25011f75, 0x4cddddd0, 0x18684803, 0x3a4fe8a9, +0xb789403a, 0x445b25dd, 0x76480339, 0x7a0d0016, +0xb8e748d8, 0xdad929be, 0x409c1808, 0xe02d2c3b, +0x0696df03, 0x458d596c, 0x854dbaff, 0x60849cc5, +0x00f05f5d, 0x00d91195, 0x20801d03, 0xe2205eac, +0x0d3103f5, 0xd8f7e852, 0x260ac20d, 0x95991a04, +0xf0882b14, 0xca098103, 0xba25dac6, 0x297c77d6, +0x211b7777, 0x305817b9, 0xd7011bfc, 0x47f80f07, +0x0b16d039, 0xc7e91778, 0xe424348b, 0x153bf80e, +0x090c73ed, 0x3bc21899, 0xbdb62c3d, 0x3b0eee47, +0x8b2e0715, 0x63fb0d0f, 0x8c15df91, 0x548d0f3d, +0x5423ff2a, 0x46c3789c, 0x72d7397c, 0x5ad0870a, +0x43157320, 0x2ba47b3c, 0xff4a1d9c, 0xd089f7ff, +0x4908683f, 0xb9301442, 0x5827ef89, 0xde89c278, +0x0833fb5e, 0x3a4f08ab, 0x341116eb, 0x1095ec55, +0xd75d3d81, 0x7f0d7fe8, 0x75464c45, 0x250a3549, +0xfaf50052, 0x00896b42, 0xa16638b1, 0x2d638670, +0x70ba2a7c, 0x74542977, 0x4b8320cc, 0x88346dd1, +0x75433408, 0xd61fbf14, 0x3f5780e2, 0x0a740609, +0x6382474f, 0x7a39e975, 0x6341cb68, 0xa46f99c0, +0x0bd0e938, 0x7e027a57, 0xc33c415d, 0xd0af068a, +0xe5fa4e3e, 0xf039a466, 0x2a24507a, 0xcfbaaf0a, +0x25c4b82c, 0x8504e652, 0x86677d81, 0x4ed62118, +0x30202108, 0x02c4ec7b, 0xf88952e6, 0x5f0bc04b, +0x3aa7e230, 0xe703d107, 0x61c6294b, 0x184301a4, +0xcc2e0141, 0x01f12188, 0x43259e00, 0x7708f4e2, +0x4f687dc1, 0x9896073b, 0xd2b883c0, 0xf7d29071, +0xfc1dee61, 0x89047318, 0x90032005, 0x7b8436b4, +0xf3cac358, 0x6c0513d1, 0x05f83e12, 0x763ccd1e, +0x50408b07, 0xbf03ffbd, 0x2e6ac519, 0x879c7c09, +0xee048c3e, 0x53048548, 0x37290070, 0xc06e03d2, +0xb8a2e5de, 0x2bd0152b, 0x981cd378, 0xf2e85110, +0x1ee6bff1, 0x75ffd2dc, 0xf21c5832, 0x9236f137, +0xad203333, 0xdccaa309, 0x3b99622e, 0xf3b92bc2, +0xd8ec3b16, 0xbe237d10, 0x89afea01, 0x226c2756, +0x6114dd7c, 0xd196c21e, 0x8d0f4bc5, 0x838ffae9, +0x8d4f899d, 0x7a837590, 0xd8750440, 0xa817c5e0, +0x888b5052, 0x8b11594e, 0xf95c3fc1, 0x51bd0e77, +0xf4dde857, 0xb61c7399, 0x63b900ec, 0x51b78c5c, +0xeca38061, 0xe3feb8b8, 0x8d62bb81, 0x0504170c, +0x50488be2, 0xad81f901, 0x040def56, 0xd640708b, +0x43b1146e, 0x52f86b70, 0x203b5156, 0xb7f9f678, +0x825c0325, 0xe7ca848b, 0xc3b73cce, 0x580cc607, +0x14f4171c, 0xf3b2bee4, 0x8c0f9db7, 0x93641774, +0xc7e425f0, 0xac19a805, 0x2b6c8309, 0xb80974a3, +0xf84609b8, 0xf029eec1, 0xeea0850f, 0xdba4e30b, +0x36007d1f, 0x131b0313, 0xee540160, 0x261facf9, +0x21350ef1, 0xfffb81ce, 0xe041d5f0, 0xbf053f6e, +0xb93dbe20, 0x9a57f62c, 0x10f91766, 0x379be817, +0x622e80b2, 0x46e12a31, 0x09b0e215, 0xd001b1ee, +0x3ca30aa3, 0xd07ba1cc, 0x6a469164, 0x3d5207e0, +0x78458bc0, 0x14f8e1e8, 0x3005fc69, 0xbf56f7c1, +0x245ba11c, 0x85e0315b, 0x9d5c83e3, 0x012f2c00, +0xa01bbfdc, 0x8d5fdac3, 0xd8392285, 0x9eb25576, +0x91995bab, 0xae575079, 0xa5d98907, 0x3aff06c1, +0xe25b85e8, 0xbf8df01e, 0x087b033b, 0x140343f6, +0x03b60f25, 0x030f7f7d, 0x80939e16, 0x0a54021c, +0x7fb1868d, 0xab7727b1, 0x4d742f8d, 0x1b0c07eb, +0xc256e030, 0x68673ca1, 0xa4d9802a, 0xa8be56ed, +0x4163ac0b, 0xe8d5c992, 0x0785017d, 0xd3badcb7, +0xd2858745, 0x9c5165ae, 0xa8f49f15, 0x35406333, +0x239f4216, 0x292d7cb8, 0x89900c48, 0x221f245c, +0x36dc21d9, 0x082a4e75, 0x090cd5be, 0x3208011a, +0x484f7b10, 0x791b8041, 0x96be00a3, 0x30b262ef, +0x396efadf, 0x0637c96b, 0xa8b33db1, 0x4d15b109, +0xe2a563b2, 0x61883572, 0xa41b2b72, 0x8bf3f63e, +0x33d1310d, 0x75c10919, 0x96f81c53, 0x783b1b18, +0x07355b77, 0xf142f773, 0x071d6db6, 0xc181d90d, +0x3b1b1d1f, 0x42c889ec, 0x64193a29, 0x5f63e181, +0x01884fa9, 0x292dc5d9, 0x6385eb3b, 0xa139de37, +0x03093420, 0xe7c62953, 0x1276efbe, 0xffd020d4, +0x20a3cc15, 0x80e24189, 0xc4f041c5, 0x7d9abc10, +0x909243d5, 0x86b41046, 0xeb2d1023, 0xf373f205, +0xf412b628, 0xc1f60b04, 0x680860b6, 0x21d0c060, +0x1afde61f, 0x0a0b6350, 0x5c859d10, 0x98205db7, +0xf70edb72, 0xb147c00b, 0x4d0605dd, 0xd2f70c0a, +0x9ae6f611, 0x3881336a, 0x1dd28402, 0x7b04013d, +0xea81064f, 0x3fda3407, 0x09c2e8b5, 0xe8197567, +0x991bcf44, 0xc8d89bdc, 0xbf0f7564, 0x03066815, +0xe15ffd0b, 0xb805491b, 0x1389c755, 0xc10be9f7, +0xc37dad82, 0xf8220cfb, 0x8dc3291f, 0xad8302be, +0x6cddadb6, 0x092a07e2, 0xe802a7c3, 0x1b6f57db, +0x030f8941, 0x0903ca29, 0xc05bd178, 0x18e2b6e6, +0x800225db, 0xda15e1d7, 0xc83902db, 0xc2294309, +0xb637141d, 0x5855e37d, 0xab050a79, 0xa1697f77, +0x70da8704, 0x80fd67a8, 0xe0ff543d, 0x3c74fa31, +0xf00273e8, 0xcc3be833, 0x0c741bf8, 0x68d04b1b, +0x03abe304, 0xf058eb95, 0xf40a8917, 0xfdba050b, +0x83156292, 0xcdff52d1, 0x54b6a53f, 0xce209132, +0xc54d3611, 0x348e6f52, 0x992deb58, 0xa92f5024, +0xdb1172a5, 0x8e141df2, 0x1d84417d, 0x9d30c573, +0x1a0fbdf5, 0x1c7203d8, 0x8511d492, 0xe82ef524, +0xc22a017d, 0xc1b6d3f4, 0x3980bdac, 0x28972d1e, +0xe377118a, 0xdf57b82d, 0x38df888a, 0x4341cec2, +0x207eef19, 0x740e13cf, 0x08018ae6, 0x8ac0be0f, +0xb9b16d08, 0xd2071513, 0x60ce5bdc, 0x200ed49c, +0xbf3c0389, 0xcbab1d20, 0x3053d68a, 0x50f4c189, +0x3984d705, 0x76651218, 0x127012e3, 0x7ffd3cfd, +0x3fb01617, 0x0122d5b4, 0x2e3a80d9, 0xa51b1b74, +0xc1207fb7, 0xce0908e6, 0x7e032147, 0xc12717ac, +0xda08fa3f, 0x1a0410c8, 0xe829c502, 0x421b2714, +0x00bad843, 0x61abab5d, 0x920a33e1, 0x6858e8b7, +0x3c30f85b, 0xd0147709, 0xa111b692, 0x0e2ad142, +0x761391d6, 0x03e2b5ec, 0x0bed2ee4, 0xe912ca89, +0xfc6eb7cc, 0x12c349bf, 0x60e402eb, 0xc0d964e4, +0xa80416a8, 0xaa5b96e1, 0x1ace5e02, 0xf6e872bc, +0x042d4d84, 0xe8c70180, 0x1ff7bb12, 0x17365076, +0xd1b0e0e8, 0xb1e864e6, 0xb09bda08, 0x60e6dff5, +0x5bd9ff81, 0xa06d164b, 0x1d89d91b, 0x0afbd7f0, +0xa1042d6f, 0xe2e80d3e, 0x102332ff, 0x8d9c436e, +0xbb8a184b, 0x1253e8a8, 0x00fbf7db, 0x98cd2342, +0x7415fb81, 0xd0acfb83, 0x750dfe30, 0x890ab302, +0x286d83d8, 0x7b8024d5, 0xb2c0950f, 0x54fe0c12, +0xa8ee9c3c, 0x89b58d0d, 0xf4eb29fb, 0xded8170d, +0x81f0f60f, 0x76fff082, 0x90e0bf05, 0x7b66164a, +0xe011a9e2, 0x910cd79d, 0x059c63ba, 0x0cbe06c5, +0x22d6b116, 0xbadd1f44, 0xc90f473c, 0xa1d8c9c8, +0x7494781c, 0x37d04e28, 0xc1825184, 0xebee6db1, +0x831982b1, 0x04648809, 0x387bb1f0, 0xe0f057b5, +0x730739d0, 0xb477b108, 0x2c384348, 0xf74b7204, +0xbd9ea70d, 0x810afe00, 0x1deb1764, 0x54b66cba, +0xa9d829ec, 0x206c0b16, 0x1ecd4a1e, 0x10724836, +0xbe85e326, 0x8950b741, 0x4104bcc5, 0x58c9c283, +0xceb61827, 0x1b76298f, 0x1013c598, 0x90ebda03, +0x78311508, 0xaf5546e8, 0x6789d068, 0x1fe1812e, +0xd9e820f0, 0xe85574e8, 0xed85c8c7, 0xfe1b8a40, +0x90024d0a, 0x080cb000, 0x945ec252, 0x75af47d5, +0xdc00aa4f, 0xc0763900, 0xfc3d4820, 0x1c22ac0a, +0x6f1c2ee8, 0x4425d8d3, 0xee00de2f, 0xb2210cd1, +0x0c86a21d, 0xce016cc4, 0x0cb706c6, 0x07aa1974, +0x0d1e0111, 0x704605a9, 0xf9a5426d, 0x9b105c07, +0x8abe17a9, 0x7614353b, 0x4613064c, 0x741d7762, +0x6c9c1405, 0x2eeb6c0b, 0x6e813a07, 0x29109b88, +0xcd14b0e8, 0xed57615d, 0x47720c3d, 0x8916eb35, +0xb1bdf7eb, 0x0a0510b1, 0x3117043b, 0xd1bb2b2b, +0x0c4f00fb, 0x7c392505, 0x31476c65, 0x561918ac, +0xe1297c8b, 0xf5de01ed, 0x09b5de18, 0x0bb5ffff, +0xa3184422, 0xaf6f190e, 0xf0c15c25, 0x2dea1d5e, +0xdac588f0, 0x6851e02b, 0x118061e2, 0xa33c3522, +0xa89a8076, 0xa1c5d421, 0xf81702f1, 0x83d9c28c, +0xf0e2ceea, 0xfd1083b8, 0x72528026, 0x59892b19, +0x08c023b3, 0x0442ae89, 0xa0dd3f10, 0x5d3e6c94, +0xb2c2217c, 0x44b60725, 0x3b244108, 0x761d9a51, +0x084c1889, 0xa2c79210, 0xb777e9ad, 0x31034727, +0x0d01fc40, 0x9a83a51c, 0x58a868e7, 0x762f8cac, +0xb56e39eb, 0x7d5dbc04, 0x0d03782a, 0xc746daff, +0xfbfc422f, 0x01812cf8, 0x8d0d3bd1, 0x3260c8c8, +0x08730d0d, 0x985162b8, 0x1cb6fe8a, 0xd981e431, +0x4fc09e21, 0x010e12d4, 0x1c9308db, 0x0160dd7d, +0x281a2050, 0x1aea5303, 0x2304ec19, 0x085c200c, +0x03ea4560, 0xe548bbe5, 0xbf604c82, 0x5bb9e822, +0xdbb42110, 0x930026fc, 0x6d042a37, 0xb8471a0b, +0x38bb8467, 0x35e0181e, 0xff419e21, 0xf0c6b0f0, +0x19f51d7e, 0x6035ff69, 0xf32a49aa, 0x1c4dbe29, +0xec35e823, 0x12516862, 0x02dc96e0, 0x257e8c45, +0xef9016ee, 0x0bc722f7, 0xc11e5c68, 0x5f3cf61e, +0xab646a15, 0x0e377834, 0x0b4b7ef9, 0x8c1e6f68, +0x5fbec374, 0x680b53c0, 0x536d1e7b, 0x02f148ee, +0x3ee80aa3, 0x3dccb86b, 0x12bd50c2, 0x57f00559, +0xdd3380bf, 0xe3653c27, 0xbecc0530, 0x3b889c0d, +0x77ccc131, 0xc01297ac, 0x9e683fc5, 0xc203121e, +0x34292907, 0x17fffff8, 0xb2d14898, 0xe53ac580, +0xd378a338, 0x08060581, 0x24326375, 0x6a951b0f, +0x0a952972, 0x40c37b20, 0x0eb0751b, 0x3c067b24, +0xfedc523f, 0x8d0b6138, 0x92920e43, 0xd528852b, +0x217503be, 0xba19061d, 0x9702a1c0, 0x8f8db606, +0x0520e83e, 0xd52bf45b, 0x183110c4, 0x6c1bac50, +0x4f01db3c, 0x8b54d337, 0xa30ca545, 0x4759551c, +0x54b1fdd8, 0x84682268, 0xfdaabb8a, 0x8d5be915, +0x5514d827, 0x0c25c538, 0xc5b087ad, 0xcb0523c3, +0x5b122f39, 0xe2c5f609, 0x4707a1bd, 0x23b8261e, +0x36d2f12c, 0x15461a10, 0xdbfe830a, 0xab4120f3, +0x062b8305, 0xc3ea4060, 0x27ea27ab, 0xeba2fb4e, +0xbc424365, 0x061e3c80, 0x05ed8168, 0xf47e055b, +0xb52d0604, 0x0745d7db, 0x06017e08, 0x7cc6a912, +0x715d76a8, 0x04150406, 0xf101006c, 0x03237a09, +0xe8fa3d68, 0x5ece5949, 0x04e39788, 0x2a136068, +0x2d8e0135, 0x788d101c, 0xd9897e22, 0x8f75b386, +0x0495043a, 0x49102434, 0xb36f17f8, 0x6ade2601, +0x1706681c, 0x82441b0f, 0xb442d792, 0xfa36bde1, +0x33cb002b, 0xa956503c, 0x020ddf41, 0x0d9f10ed, +0x14bb087f, 0x22ebbe7e, 0x096103b1, 0x474a9a59, +0x521d580c, 0x54b33c80, 0x53c72df5, 0x8d2420d3, +0x4506c6f3, 0x7eb6017c, 0x7d0379f6, 0x03006c03, +0xaa7e43c6, 0xc86c350a, 0x43c7fa24, 0xf8031804, +0x21067580, 0x53e82488, 0x434dfe55, 0x1c2d7109, +0xf6a16f68, 0x43e8e027, 0x3b5b1a09, 0x56e24542, +0x2a442da3, 0x9236555c, 0x518b100e, 0x9b026fd4, +0xa1a96e88, 0x2f34b211, 0x0a1969e8, 0x8db90377, +0x4229147e, 0xf867ff2c, 0x5b8b0776, 0x83024708, +0xdf8614eb, 0xcd8ad75f, 0x82477f35, 0x18c92c58, +0x44306bda, 0x0602d206, 0x7dee3f17, 0x87aca041, +0x1a6e661c, 0x28f1defb, 0x5440a366, 0x3c6a5653, +0x726c5067, 0x11b718bc, 0xe814182d, 0x3c9d7d57, +0x05087552, 0x6e68750c, 0x560ba244, 0xf60c8b03, +0x11631849, 0xe854450d, 0x6d158927, 0xf4787f15, +0x10503b0d, 0x47433475, 0x7e58c1d1, 0xb308aec0, +0xc2d8c01e, 0x8e5b3dc8, 0x182dea24, 0xb3acab51, +0xbd0b55ad, 0x450440e1, 0x9806404e, 0x93eb8c05, +0x1c22ab05, 0x51d60375, 0xfd58e0ec, 0x1cc0337e, +0x7e812e00, 0xd0c7708c, 0x15352519, 0x02c6a6a8, +0x0d1a1816, 0xb0e2ac44, 0x0585af67, 0x8649622e, +0x3ee55aa9, 0x9e84bd2e, 0x8bfd184b, 0xdc62decf, +0xca0000d5, 0x500646b4, 0x2536fff5, 0x68ddbb47, +0x1e6863e4, 0x9894e81b, 0x99da0b57, 0x1e401f85, +0x23c52030, 0x1d8b67bb, 0x07082205, 0xff120224, +0x3b0b8105, 0x8be93488, 0x36a3a046, 0xb702d7cd, +0x42007c14, 0x9c093b65, 0x0750dd93, 0x60349736, +0xab5508ac, 0x6c5a5f8c, 0x9d16e890, 0x3dbb0307, +0x7609375a, 0x5df5115b, 0x3d3407c7, 0x3f6bc51a, +0x1e665079, 0xa85bf48a, 0x7e0825b6, 0x120636a0, +0x1e1f4816, 0x5e006ab6, 0x7dbb8b68, 0xab9a210a, +0x66727857, 0x9f1639ac, 0xf6e2dbd8, 0x14fa4108, +0x4bba8f2c, 0x3b1db787, 0x83c1a166, 0x09a303d0, +0x0388c16d, 0xfd8ec160, 0x1d11d02b, 0x023885ec, +0xbd40e9bc, 0xb71bdd0d, 0x0ec15923, 0x1718417a, +0x08f6588d, 0x6125d114, 0x1fc486c2, 0x001c1443, +0x358817bb, 0x1d74051a, 0x060e7f04, 0xd9ad4cd8, +0x9e477bf7, 0xc64c2f6e, 0x7406f8fe, 0x0194e92d, +0x8db11e2a, 0x45862051, 0xe552b63f, 0x230b0dfb, +0xeb47b6ef, 0x27c6deb6, 0x2867268d, 0x70bad4eb, +0x056c2aa1, 0xbac3b7f4, 0x2b0edb87, 0xa900e9a8, +0xc00c2546, 0x3ede251b, 0x7783ad55, 0xfdda395b, +0x73742e04, 0x68103755, 0x1a588f0f, 0x700dd1f2, +0x297591b0, 0x077a8052, 0x22013170, 0x8ca48ac2, +0x775ba1e0, 0xaaa323cf, 0x6dd28aff, 0x2e7b4020, +0xf16939f0, 0xabe11bb1, 0x6bffcb81, 0x3b69107e, +0x8f198c6e, 0xc08d0f36, 0x0805854b, 0x9a227bb1, +0x1703081e, 0x7020687e, 0x81f9e4c4, 0x95212212, +0x46108f14, 0x008dc091, 0xef11affc, 0xe920ee21, +0xf6f3db08, 0x42849f6e, 0x75d0393b, 0xa1d3064b, +0x5ad15882, 0x5e02c1b8, 0x202f3c77, 0x73d6856a, +0x4f28c1cf, 0x80615806, 0x42da1ac1, 0xc04405fe, +0xd1829cae, 0x111066c4, 0xf80aa90c, 0xc046de1d, +0x37a1f6bf, 0x7464ecde, 0x0ecdc6ef, 0x206a4520, +0xc638e8b1, 0x3ffb4e21, 0x1aeb3f83, 0xf7006a24, +0xd07b084b, 0x120e16d4, 0x3b807694, 0x2f0c329b, +0x3c04d83c, 0x680984de, 0xd21f2525, 0x02862585, +0xf723f184, 0x3701b004, 0x2802b46e, 0xd8013c3c, +0xaa800270, 0x78c4b583, 0x29ce6e02, 0x871e5b08, +0x2011b0f4, 0xa8026fb9, 0x2c1b10ce, 0xac152a02, +0x1bfb640d, 0xe45c15ab, 0x0250b705, 0x463740db, +0xaa0c4308, 0x01c842c2, 0x009b6d13, 0x0d0290eb, +0x562167f9, 0x2f10cf8a, 0x37f14d3c, 0x5ca685c6, +0x0fab3a3d, 0x628dff75, 0x838a66c0, 0xaa2baf73, +0xc98af12d, 0x3ad17c85, 0xc14f87c0, 0x4353a142, +0xf3f7f9e8, 0xff6f7c6d, 0xe3008068, 0x15ccea6c, +0x83b313e3, 0xe964b945, 0x97723546, 0x8c6fb6c5, +0x5814248a, 0x235835e8, 0x608b7893, 0x1c7bad22, +0x63125457, 0x22c5b30d, 0x571920c5, 0x0ba0e4c4, +0x39aee83b, 0x36d8aa85, 0xd9664288, 0xa2a3588b, +0xa97ea0c1, 0xe83d6ebf, 0xd8f3c906, 0x181f6910, +0xc17874a3, 0x105cb416, 0x82a3f36b, 0x278bb120, +0x29c2f007, 0xce05dfe0, 0xba89c17e, 0x7ff869ff, +0xa09b117e, 0xc9f49451, 0x25057e44, 0x0005ca6c, +0x18c538d1, 0x3e2842f1, 0x000021e0, 0xa7096aad, +0xef8efbe4, 0x7eaa33eb, 0x04ec828a, 0x090ecc55, +0xf021984a, 0xf000883f, 0x2ecbc87b, 0xdb82ec81, +0x136c8ed4, 0xa297c8a0, 0x19fb04ac, 0xc4df3b7b, +0x08aead0a, 0xc613aea2, 0xe43b950c, 0x7608b0af, +0xcf2286dd, 0x2d024072, 0x3d04013c, 0x3f829544, +0xd8e8063e, 0x538fd83e, 0x2066bd93, 0x880fe827, +0x8b108318, 0x40031538, 0xdeea12e8, 0x443004a3, +0x3be06467, 0x20853684, 0x8474a467, 0x8147d822, +0x16ca51a3, 0xdd8c8cdf, 0x168aa0fc, 0x9c8db338, +0xba019024, 0x1d67dc25, 0x34a8680d, 0xc6169c27, +0xda861420, 0x8c499d23, 0xea7425a0, 0xd54104e8, +0x1ecf0932, 0xbf567332, 0x50284f60, 0x256d8cec, +0x21513753, 0xf0afedf1, 0xf9582cd0, 0xb16a436a, +0xf777e8ff, 0x63faa3b8, 0x6a46565f, 0x3e03e824, +0xf4d7e8c3, 0xd46ff120, 0xdf01c789, 0xc2e805c6, +0x2c7edba8, 0x3a8961b1, 0x0949b503, 0xd78103ce, +0xb29a8622, 0x76183f72, 0xe82b7bfb, 0x29fb35a1, +0xd47f2bc3, 0x01681f15, 0xa245f298, 0x86e81d0f, +0x050b49df, 0x31483d3a, 0xd60a7402, 0xe8446b96, +0x488512c0, 0x4c2138a7, 0x96337508, 0xb6101b1f, +0xa061154e, 0x167f338b, 0x05bb1919, 0x16c2ec2d, +0x4660683d, 0x43f0264e, 0x43919e51, 0x3a9d61d2, +0x1dbbaa1f, 0x8a4106d5, 0xec555c24, 0x26081d41, +0xe2a43850, 0x90943519, 0x0acfed43, 0x4421e241, +0x02b31acf, 0x5874bbc9, 0xea011017, 0x01e8a605, +0x0088abe4, 0xf68bd709, 0x661086ca, 0xac1e9df8, +0x74ac0fd8, 0x86f81245, 0xab00001e, 0x6032603b, +0xa88e2018, 0xb156dd1b, 0x242cc10d, 0xbe0f53b9, +0xf6032144, 0x8fe81e67, 0xb6fffff5, 0xb0ea5f18, +0x8001fc78, 0x7e13a105, 0x427080a9, 0x933db16d, +0x3ec329a0, 0xf80a41d8, 0xd31b4ac4, 0xb72110c4, +0x743a33e3, 0x40b31136, 0x02838b36, 0xb7ef9805, +0x00833803, 0x34586807, 0x8c0ac415, 0xef441d11, +0xb81d35ea, 0xa1cf1d11, 0xd050340a, 0x03d52602, +0x4dca934c, 0x03803846, 0x3cb71d99, 0x2bc1f0de, +0xe7bc59d0, 0x68496a11, 0x16b95be0, 0x243106e4, +0x389d4904, 0xbec10930, 0x45ce9f02, 0x688ff87d, +0x1a8e1944, 0x808e0e58, 0x6aa3d613, 0x23f78973, +0x081b1dfc, 0x35ff0432, 0xf459e82b, 0x213909c8, +0xc608e235, 0x62b5dc00, 0xddcf8e4c, 0xbb8e0f0b, +0x4dda237f, 0xb78de822, 0xba0c0304, 0x38e38e39, +0xd1755ebb, 0x021fe2f7, 0xfe832c26, 0x760b3d7a, +0x15fc3024, 0x2cccc481, 0xf0b26af0, 0x0c240d1c, +0x53c07ae0, 0x9b904325, 0x2d5b6d49, 0x88c58aa4, +0x82c01107, 0x83f67117, 0x124b14e8, 0x14e2553d, +0xe74e925d, 0x1616413b, 0x23e124ba, 0x21147850, +0x13c15833, 0x0cf31ae5, 0xb0d49615, 0x11270cd2, +0xc3e0af7f, 0xd4e8d120, 0xc0d8efb6, 0xc8750b15, +0x1fb68ba5, 0x9e290742, 0x206aee91, 0x3a80f3e8, +0xf141729a, 0x245a263c, 0xbfebaef8, 0x2e3b259f, +0x4ae9cf76, 0x1385ba02, 0x760d1e8d, 0xfcb7d1c1, +0xb7b5de09, 0xc1c3cf42, 0x0d099ce3, 0xc7bdc309, +0x110a9609, 0xe9d61d81, 0x0e2551df, 0x8d47cc21, +0x428a0e6a, 0xb7edc52d, 0x3c45bd0e, 0x2f81770a, +0x14770e52, 0x028b6ea1, 0x04c13238, 0x89c4fd02, +0x551c3fb1, 0x8ee65ce8, 0xdb460966, 0x66c74df6, +0x3f0645f7, 0x284c2c1a, 0x02205140, 0x03c94174, +0xfa7d1087, 0x84188a03, 0xe90cc528, 0xbf09f777, +0x458b3322, 0x05dc3d2c, 0xff0e8f32, 0xa837dffb, +0xef6e7c5d, 0x7410bb14, 0x8dbea13c, 0xd11df7fa, +0x8d592250, 0xa10e0174, 0x29c189a8, 0x80aeedf9, +0x6307098d, 0x170eeba4, 0x68581ad8, 0x370a8436, +0x8afc0efd, 0x47afbc08, 0x1eb52605, 0x6037f82c, +0x097d8063, 0xce5d7511, 0xf5358b54, 0xcb2c7452, +0x045c22c6, 0x15c2d686, 0x860b1ac9, 0xec6e8134, +0x8687b8ee, 0x7e839bfe, 0x892674a4, 0xf61c08d3, +0x74ebfde3, 0x475d6257, 0xb7eceaf5, 0x9f59c817, +0x601cce79, 0x4555566a, 0x9a54033a, 0x8e559e13, +0x066ebc8f, 0x6177582c, 0x6e892cf6, 0x2deefe1f, +0xd1620de2, 0x4c664dc2, 0xd88627c3, 0x2675e0b1, +0x1a183056, 0xdb921161, 0x81b90bb6, 0x3f018d7f, +0x00b389ec, 0xef22b9b3, 0x360ddd0e, 0x02edfb38, +0x56905d3a, 0x336fdbff, 0x494f19a8, 0xc5835616, +0xd8cfbf20, 0x1982c046, 0x21bf9279, 0x60c5b741, +0x0faf31a0, 0xdd18f157, 0x3e2d5766, 0x80e96eec, +0x6ab015fd, 0xfec43848, 0xfb30a146, 0xdf864fd1, +0x0d3a00b1, 0xbfded4c0, 0x8a187355, 0xb82c0715, +0x837a97fa, 0x4108742a, 0xd1384436, 0xf980f372, +0xb6cf52ef, 0x752445b0, 0xa201431a, 0x54d55709, +0x06d1541b, 0xd97dba04, 0x851c6f67, 0x0346bc33, +0x048d1a50, 0x5c102585, 0x13040678, 0x96400119, +0x5657f61f, 0x86c17f53, 0x5e1db3cd, 0x0819679a, +0x6efbd343, 0xe4991d3a, 0xd3434190, 0xf3feb00c, +0x89fb1116, 0x3c8df8f8, 0xa4360285, 0xe24ffe8a, +0x468ac83d, 0x763c3c02, 0x2e3cb002, 0x7cf56b39, +0x02d3a857, 0x4722a0c9, 0x62da186a, 0x5caeba23, +0x78ae704a, 0xad0a7cdc, 0x60570416, 0x1b6957a4, +0xe0b696a3, 0x53977432, 0x243d8717, 0x44dde460, +0x08ec09c5, 0x35c83c49, 0x013d8801, 0x5202369f, +0x1822c15c, 0x7bb9086f, 0xdc27ddb0, 0xe95d04c3, +0x75015986, 0x5c9f3126, 0x17f003c8, 0x04ee8387, +0xd0b74407, 0x304df089, 0x6ed23d77, 0x7663f357, +0x93a0e022, 0x2ca190d6, 0xa8926018, 0x501f6c02, +0xac400b78, 0x3335c920, 0x15cc3bc7, 0xa34056ff, +0xf4adb004, 0x351dde96, 0x81b7ba8f, 0x916e34ec, +0x84e31b82, 0xad52f355, 0x460d54c2, 0x6fa99a1b, +0x9caedd40, 0x10038aab, 0x4306b80a, 0xd4bf87e9, +0x800f84ba, 0x0d75cbba, 0x1d89df89, 0x87db2316, +0x1370e9df, 0x7517343d, 0x22350869, 0x7b633576, +0x381be025, 0xc83868df, 0x8cfd9d80, 0x34a416e7, +0x4bec3533, 0x032c73ff, 0x7b802575, 0x117b0301, +0x3d000002, 0xb53ec1d9, 0x3da9e89c, 0x488501f6, +0x12f54776, 0xe9e80975, 0xc04d01e6, 0x365f61df, +0x00000081, 0x35251551, 0xd97b0e75, 0x024c2e2f, +0xbbe960a3, 0xac5a752a, 0x09903438, 0x60323536, +0x6effb583, 0xc3263387, 0x1d1cf4ae, 0xa32ebf0c, +0x3ec3bfa0, 0xa3af006c, 0x01580fe0, 0xffb7f080, +0x2573ff6d, 0x8d2e7508, 0x6b200273, 0x39f50101, +0x66960eee, 0x373754b1, 0x87e24dd5, 0xaa556c0b, +0x03862002, 0x019e4870, 0xe872eefb, 0x353d1ae9, +0x0c932409, 0x9100f972, 0xb90efe30, 0xaa00dcec, +0x2b46363f, 0x50ac2f75, 0x0b06e801, 0xb95d53e0, +0x6a77e031, 0x6a50b2ff, 0x834ceb7d, 0x189b1b25, +0x854794f2, 0x6e33c080, 0x76059628, 0x8a80b128, +0x67906db4, 0x0e153bb5, 0xc36b061f, 0x7b1a91df, +0x3456eb21, 0x1e137581, 0xa708a7d8, 0xeb271e28, +0xfdb69f3c, 0x2a33721d, 0x2375962b, 0xbd98347f, +0x52572320, 0xd7631934, 0x03d54b8e, 0x64829b02, +0xd13d89fd, 0xdba43b81, 0xacc52c05, 0x22eb064f, +0x487612d0, 0x4a423019, 0x412daace, 0x0d4ac085, +0x033c5b65, 0x18323399, 0xa7d10437, 0xfd20a091, +0x11874ed0, 0x23a7811a, 0x8e5494a9, 0x24106409, +0xd7a10e09, 0xe804c65c, 0x86eb1c17, 0xb9057e07, +0x885f3807, 0xd36bc0be, 0x3f66e8e3, 0x1c71c7ba, +0x06fc01c0, 0xf799d1f6, 0x8a3629f9, 0x9104d420, +0x178ad49b, 0xbfc0c941, 0xd04dfb50, 0x83c8f541, +0x76015478, 0xb4102b19, 0xc6c53247, 0x715471f7, +0x8f7fffbb, 0xd519c7ca, 0x68703922, 0x05722a77, +0x77645839, 0x8b20bd23, 0xc1186efc, 0x35305842, +0x13644103, 0xa5e86851, 0x72724be0, 0x51227706, +0x8107e81e, 0xca8c5a81, 0x6da82770, 0xff270761, +0xa7c41152, 0x0a416cc2, 0x5028a516, 0xb13f2971, +0x09530d74, 0x136c2840, 0x6446e830, 0x1388c911, +0x0d059187, 0xbb0c38a3, 0x84fd51a9, 0x00bdcd83, +0xc5393001, 0x460b1f73, 0x0e2461d0, 0x11eb01e0, +0xddeffdd6, 0x7239ad7f, 0xbd117760, 0x0a775c5a, +0x5c582bcd, 0xa860701b, 0x52ac780f, 0xfee6e89d, +0x58aa1853, 0x144331d1, 0xfd631d45, 0x3074de82, +0x797bb172, 0x0168cf12, 0x7689f59a, 0xc10fe2d4, +0x58a39dff, 0x82449d98, 0x59c5b828, 0x5a2c7d74, +0xb58d20ff, 0x23e1be88, 0x89b6fbff, 0x50d829e8, +0xeb78224c, 0xe8060174, 0xb216d698, 0x6f437a07, +0xdd75f339, 0xc5f218d8, 0x8b9d9a2b, 0x33eaca6c, +0x8c0a3c2c, 0x36e838fe, 0x85dc224c, 0x48483039, +0xb21ce989, 0xeb80fecd, 0xa1df11ce, 0xad6378f8, +0x7070721c, 0x1abd2912, 0x01a2b05a, 0x3c0668df, +0xfe2b3f00, 0xfe94e803, 0xb8977987, 0x68911200, +0x620b6259, 0x851bea3f, 0xff03e01d, 0x9f644c40, +0x8aaee8bd, 0x832c8554, 0x80b01c7a, 0x02471edf, +0xc7784288, 0x46f47442, 0xc3ef7808, 0x90c4a8c5, +0x1f260a66, 0x780e9f42, 0x95b4aa2d, 0xe0371282, +0x0ced8c20, 0xde30497a, 0x5f741734, 0x3751de82, +0x3c61380e, 0xdf0010b9, 0x2ac9ba2a, 0x413c3c38, +0x76c13928, 0x801e25db, 0x4c412a24, 0xf0456051, +0xd4ed0aa6, 0x1f1cd283, 0xb763202b, 0xda11d86d, +0x38408c3d, 0x512ae8d1, 0x800d051d, 0xd0e70974, +0x77058351, 0xd0293445, 0xf70a1850, 0x37f6e223, +0x116dbee8, 0x29d54fa8, 0xcfaa7007, 0x04dfb144, +0xf8832754, 0x2d2274fe, 0xf63a2901, 0x9021682f, +0xabaec510, 0xaa60d498, 0x6248d891, 0xa05c1067, +0xcb40644c, 0x8bc43175, 0x91ea408a, 0xda8c513a, +0x83a18865, 0x688e7ad8, 0xe1945935, 0xed7b1e58, +0x3a3f439d, 0x93e83fb9, 0x5ed0c2fd, 0xe1d588cd, +0xb20e4326, 0x323479af, 0xdf87c060, 0x2d747060, +0x1886a868, 0x1a86ba0d, 0x442c2f16, 0x7aba4885, +0x6aa9dd97, 0x3c78ab20, 0x423520b3, 0xa0efc8f5, +0xa854020f, 0x9e64c586, 0xc52ebe10, 0xa1827036, +0x5e448c8b, 0xcc770f99, 0x0ca10438, 0xeb048773, +0x8d872040, 0x25902510, 0x0f7cfa73, 0xeb060232, +0x6bbaac1a, 0xb8a4ee0c, 0x910c7ea4, 0x0ea2920a, +0x5028d8ef, 0xe7dc8c3f, 0xd8347b44, 0x742bcafe, +0x722d0405, 0x1b6f08f4, 0xf00c903c, 0x442436a8, +0xa0cd2024, 0x513a6433, 0x1454cd78, 0x01bd2e88, +0x203546ea, 0xf278cfbf, 0xc526930b, 0xed77c80f, +0x7cebd819, 0x289740bf, 0x2b083466, 0xd114157c, +0xe2a75005, 0x230ee40b, 0x54ab7fe0, 0xe021ac09, +0x502d6e03, 0xc15149a2, 0x3d17e0eb, 0xa36b95e8, +0x3effc620, 0x94744902, 0x72381d39, 0xb83589d9, +0x6a91f797, 0xa3083ec0, 0x9f3097b4, 0x767a4e94, +0x1718a649, 0x909aba98, 0x1e1e3a20, 0x7cdf8b9c, +0x4bdd6c1a, 0xba6331c0, 0xfa81d10c, 0x12730524, +0x56fa8da5, 0x47753239, 0xaf4b0b8b, 0xa47b18dd, +0xb938eb5c, 0x7ed27ad3, 0xaa5f6f2d, 0x3c2d4645, +0x051e75c8, 0xb002c86c, 0x75d44fb9, 0x1c503a17, +0x00c80916, 0xdf7b7ff1, 0xeb08420d, 0x4a39416b, +0x36d37f10, 0x2aacf442, 0x9caa7255, 0xee906953, +0x7a46074d, 0x08e9c118, 0x71043070, 0x212864fb, +0x74945439, 0xa2564b1b, 0xcd1459b4, 0x015f63b1, +0x0b26cb81, 0x4d1bc159, 0x2c825c18, 0x13002b76, +0xd6c00b10, 0xa9441e60, 0x11808d1c, 0x78db70dc, +0x4640851b, 0x1d1c52db, 0x1dcf1bb7, 0x1a58081a, +0x00197003, 0x1da8dd2b, 0xc60eed1b, 0xdbf6f8e0, +0x5b7f7423, 0xbc548723, 0x42c6441c, 0x8b19031a, +0x8618c158, 0x3efae7df, 0xb1622ef4, 0xfe81f3e6, +0x9187e8fe, 0xa8ef6083, 0x7507c32d, 0x6f4e4913, +0xe878ce2e, 0x0b0d2396, 0x890f9a51, 0xc0180a59, +0xb3a94850, 0xe9341729, 0xdfc6f31d, 0xb0118741, +0x32bc013d, 0xc0e0340f, 0xe8d73df8, 0x6bd30406, +0x0466bace, 0xba08380a, 0x2a6ae89b, 0x18262057, +0xdb6054d6, 0x209f7144, 0xf5055022, 0x7bb811bc, +0x64032cc0, 0x28c00ce8, 0xebb12ef2, 0xd75a920c, +0xdc5a88aa, 0x6d4b88f8, 0xe5d0d117, 0x9d5b0289, +0xba59a68b, 0x06426363, 0x57302062, 0x8381f0ed, +0x3026f2c1, 0xd6771d07, 0x8f148afd, 0x391d146a, +0xb1183c80, 0x644b875c, 0x1667be0c, 0x4e247f11, +0x191f56ba, 0xe283e228, 0xa81174fc, 0xe80eded6, +0xcc0d7401, 0x338bd089, 0xbe86f0f5, 0xfe24c6c1, +0x05cc7e24, 0x3d6a5317, 0x3a1b740b, 0x50190216, +0x5d6e1a04, 0x4488685b, 0xb1173639, 0x4f2b1f19, +0x3d3c6486, 0x284f448a, 0xccdbe10c, 0x4327eb18, +0xc7849ef0, 0x86904770, 0x4709fc6f, 0x06b0ff81, +0x82708d42, 0x002c0e4f, 0xeb402df3, 0xa7d506b4, +0x6b435c43, 0x1d4d7782, 0x8316be66, 0x39c405c8, +0x1cc26c21, 0x201874b5, 0xec83ac26, 0x3fdd6c80, +0xa00d1805, 0xb09bbc21, 0x1f053f02, 0x1c401677, +0x82a0353b, 0xea053014, 0x0e410c23, 0x1c5717f8, +0x4167cd66, 0x47d3462a, 0x00dc18a6, 0x0d073e35, +0xf25bebfc, 0x60dc50be, 0xbf06e0a2, 0x578d4175, +0x8396d80c, 0x3a529f29, 0xa1045498, 0x47e02a9a, +0x104cf54f, 0x2d59f484, 0x27678907, 0x1beb0329, +0xd609f04c, 0xd9c30b40, 0x48bf783e, 0x024828c9, +0x6036f584, 0xa774b185, 0x2bd2e510, 0x5607266c, +0xc914276a, 0xc581e45e, 0x20fe17d4, 0xecc5428b, +0x2e9a16c0, 0x36dbe376, 0xea0c3d62, 0xa5f00605, +0x1f8e6c04, 0x21daf7c2, 0xd0093fc2, 0x861e4fa4, +0xbe5c3af4, 0xcc580030, 0x0e616c06, 0x54540688, +0x20d4bb6b, 0x7d0eba55, 0xa928d384, 0x0d3a6603, +0x1fee289f, 0xc16a8ecd, 0x7f091905, 0xd80c9ec7, +0x6ab925b1, 0xebc82534, 0xcdd20323, 0xe90c27fe, +0x14244a88, 0x1ad8efa3, 0xe2dc4e27, 0x3f0c0264, +0x77605d76, 0xce80bdae, 0x0b2fbe1e, 0xb72e5250, +0x74326019, 0x58342f0a, 0x817b1ddb, 0x9e74f809, +0x318d4061, 0x1c2d5052, 0x4601b019, 0xa377075c, +0x1861c503, 0x888fa772, 0xbbc0e940, 0x03650319, +0xb323e25a, 0x01817d73, 0xb19ecf18, 0xc3140537, +0xe2721d10, 0x9044b885, 0x5ed0cd80, 0xba418024, +0x036832bf, 0x7e0a2c90, 0x85821c14, 0x5aa715be, +0x6d75ed8c, 0x0c063724, 0x52fb1a3b, 0x20aa15b5, +0x830a857b, 0x8f151003, 0x2a05c27d, 0x7f3b81d5, +0x37038b61, 0x8ba97d8a, 0x7510463a, 0x462b2dd2, +0xdb6fb820, 0x7007764e, 0xa3661693, 0x6dcfc058, +0x89024d41, 0x80560c15, 0xbc420ed6, 0x50311474, +0xbf68a918, 0x5389c0f1, 0x148c176e, 0x4cf12b1c, +0x017adbd5, 0x2c1470cd, 0x7211c8c6, 0xff9001f6, +0xc8c9040c, 0x1b183245, 0xef833904, 0x20d41d76, +0x0b43ff01, 0x081cb143, 0x1c0743a5, 0x285d6c20, +0x763fa702, 0xcb209f10, 0x2625ec16, 0x223e10c4, +0x044a691c, 0xf608092e, 0x1dba4655, 0x4618dad4, +0x06060904, 0xc613a87b, 0x841e08b2, 0x131b08bd, +0x1c708432, 0x32201953, 0x93921127, 0x6c2168d4, +0xe28fd530, 0xea24b48b, 0xeab724bc, 0x8608d4bb, +0x0802e810, 0x661bf125, 0xcc14fa85, 0x0788068a, +0xa051e947, 0x101115eb, 0xd68a1dbe, 0xd30c2d9d, +0x4613b156, 0xb0f6f61e, 0x090ab0b1, 0x2e40f676, +0xcc180175, 0x7305fe9e, 0x848b4575, 0x06832b24, +0x1bdd7b0f, 0x3b80186c, 0x735f6578, 0x14ac8a07, +0xeb039b63, 0x1a03700f, 0xfa607070, 0x752943ee, +0x023ae9da, 0x6c7b8c69, 0x28e01a84, 0x23bd1c51, +0xf6110975, 0x5ac3dbd8, 0x756c0d46, 0xeb461708, +0x7bfe0c13, 0x7568fd9b, 0x170cb90e, 0x04b1030a, +0x3c20c891, 0x4eca7578, 0xf97e17d9, 0x91137e1c, +0xef1211eb, 0x875a1636, 0x7cade2cd, 0xc60e7472, +0x76f52c45, 0x453000fb, 0x5843d088, 0x85450988, +0xc379a7c9, 0xfb4f040f, 0x808acfd8, 0x7fbdab2e, +0xd0096fff, 0x04e9831a, 0x5ce9e879, 0x0f649f01, +0xfd52a485, 0x71d64620, 0xeb705e17, 0x20bf7715, +0x79311681, 0x452d7309, 0xb81f70f7, 0xeb894f11, +0x210ab903, 0x25036e05, 0x8a1c05c8, 0xb7b77003, +0x55886d5b, 0x6667b870, 0x256cf700, 0x2644b777, +0x038b79f7, 0x3202fac1, 0xa0b808ff, 0xbe75355d, +0x39ff558d, 0xc4f86fda, 0x18c31212, 0x026d0abe, +0x80430b88, 0x4ab7c23d, 0xe9f17712, 0x75404caf, +0x55fd8c46, 0x9f2c7133, 0x76d88b03, 0xa1e17722, +0xb6db0fc2, 0xf23f68a1, 0x40a03a1d, 0xc5631255, +0xbfb784a9, 0x77240b00, 0x64eb4de2, 0x3d75214a, +0xba854f4d, 0x06538da7, 0x92e52088, 0xb1926004, +0x4368e30f, 0x563b8641, 0xcc6ba5c2, 0x63224172, +0xe6f13075, 0xeb5d1fde, 0x07068a06, 0x73eb9094, +0x3936f125, 0xd12a3f85, 0x46db7224, 0xf80661f6, +0x671885e7, 0x07c6032e, 0x2d80c1dc, 0x842bf8f6, +0xd46c270e, 0x17b80424, 0x13aa9ec0, 0xc4e82c31, +0x585eb4fc, 0x1b304447, 0x0a19aab8, 0x732b4146, +0xde206dcb, 0x1b5c569e, 0xcdb200b0, 0xfa378a30, +0x1693be97, 0xae844647, 0x74d28426, 0xd1d03822, +0xef97c188, 0x03c6137f, 0x8820488d, 0xf6d188c8, +0xca4a0bc2, 0xfa66a038, 0x4b034f52, 0x02cdd075, +0xbb15260f, 0xed5f5eb5, 0x2b6360ee, 0x028acbfe, +0x41018842, 0x5b6df6ed, 0xa92c3fda, 0xde89e6c6, +0x8ffa834a, 0x15bdd46e, 0x038820ce, 0xbdf02343, +0x82975e5b, 0x543de9a6, 0x742ed34c, 0x9af6b006, +0xfa344282, 0xea484b24, 0x5e1722be, 0xd6484c5f, +0x005b036b, 0x4e2c2719, 0xd2ec3d2c, 0x4912741f, +0x7ec60575, 0x75110aeb, 0xc16fb6ee, 0x56a16382, +0x1a2ac388, 0xc558db18, 0xa527d7c2, 0x5fc37ef0, +0xbf068055, 0x20103884, 0x246d683f, 0x40fb7928, +0x3008200f, 0x5c30233b, 0xfbb121c2, 0xdf00807f, +0xd1f7aef2, 0x19048d49, 0x5c480a35, 0x6fb83040, +0x45daf773, 0x806dec68, 0x53c88939, 0xb1bf11f2, +0x20058e12, 0xf461050b, 0x2c684929, 0x1047c888, +0xdc11371f, 0x8925b800, 0x8a136cf2, 0x3dedfb08, +0x740a3af6, 0xebf6db08, 0xd84d0605, 0x404309eb, +0x10e0833b, 0xd889dbfb, 0xaccf59d1, 0x72d1da23, +0x0c62da89, 0xd8d8d837, 0xe72b1164, 0xb36b5b93, +0x322fb7e8, 0x8b0ff985, 0x0335f41d, 0x0d502dc8, +0x708640fa, 0xb57778d1, 0x4dc4c5ad, 0x05c711c1, +0x3dd0231f, 0x1eeb0484, 0x089d8c21, 0x0133e0ab, +0x67047198, 0xaf622a13, 0x7b8d26a3, 0xb0e876c9, +0x3019531e, 0x48445734, 0x892f2c76, 0xc2f0ba06, +0x61570461, 0xf0ae0c13, 0xbc287b02, 0x5b0c1a0b, +0x2c9b0424, 0x08243746, 0x30c152d6, 0xa1689426, +0xc6db4570, 0x02139811, 0x98c56e01, 0x43e55f84, +0xef754e41, 0x1a40542f, 0x90a36e0a, 0xb4210fe2, +0x8b80c857, 0x78a595b8, 0xa1a6f175, 0x6e7c2069, +0x1829e55c, 0xa3b0f1e7, 0xbacd891d, 0x88eb3a74, +0xffa74034, 0xce890694, 0x187ce939, 0x4b85554e, +0x24a88c5d, 0xd2d2f6a8, 0x68a458ee, 0x84e87dc2, +0x631fa657, 0x6649302b, 0x8a20172b, 0x41420142, +0x38bfbc68, 0x0bebd089, 0x19b4b216, 0x3f140d14, +0xaf8acf0c, 0x77010fe8, 0xc03d8372, 0x07e2168f, +0x02ad0cb9, 0x3d8053eb, 0xa08160ff, 0x53756703, +0x06dc45d4, 0x331157ab, 0x26409700, 0xc82c8f78, +0x8416a301, 0x7d662ac1, 0xd97b0a8d, 0xb00c5120, +0x5d025414, 0x8db2baae, 0x305f4076, 0x76e14480, +0x041ae845, 0x105524aa, 0x51600c28, 0xbbe80924, +0xedb63801, 0x2db8230d, 0x79e807b8, 0x682141a7, +0x7dbbc1fe, 0xe80957df, 0xeb0bfeff, 0x08ff8414, +0x12b73e80, 0xa80d0a4e, 0xbb75d889, 0x185b4062, +0xcbe4bb60, 0x0dc822bf, 0x9549d0e0, 0xb441b1ff, +0x9d0699a5, 0x0dfc5710, 0x7c964280, 0x08eac166, +0xda17c589, 0x0ad958f8, 0x1e1a5338, 0x31741838, +0xc03b6c62, 0x068847c7, 0x0ac7ad18, 0x4c830942, +0xb5bcae0e, 0x3b1b4216, 0x88e88932, 0x60620b55, +0x620000c5, 0xd2072362, 0x03177d05, 0x2765850a, +0x08300873, 0xc2382d5b, 0xe9d815b6, 0xbb5b2dfe, +0x4ae2012d, 0x82248d26, 0x1b089b08, 0x2d454773, +0x16d95a11, 0xee2d175b, 0x6fb03b23, 0xffcf0b47, +0x681037ff, 0xc9520105, 0x8848fddc, 0x69f64c83, +0xe90c2ead, 0x553d1bcd, 0x0a43efbf, 0xd0b153d2, +0xe88fe00d, 0x032bc189, 0xee798366, 0xba08b1d8, +0x796c270f, 0x462aa2e9, 0x41e47345, 0xc6025104, +0xe3b83687, 0xba090d2d, 0x7b80c029, 0x1515f403, +0x4de93bb9, 0xc2220406, 0xbaec152b, 0x34114a08, +0x067f0417, 0x5472d00c, 0xda86140e, 0xb728e06e, +0xaf28eb43, 0xff340a08, 0xb82d756e, 0xb8260606, +0xdc1f8035, 0x3a0846df, 0xc63c0c84, 0xeb0ee929, +0xf8225c0c, 0x16eb8e65, 0xa23a5156, 0x23c17fcd, +0xf1e92225, 0x070300c7, 0x34050984, 0x9cfca96d, +0x32094d05, 0xb0029c2c, 0x5f50b14d, 0xfad54f1c, +0x422c1023, 0x545b07ec, 0x0ae4af4b, 0x4a5e548b, +0x04c0a174, 0xbc288a99, 0xb3705810, 0x0b2c75a5, +0x07dc263e, 0xc1a36150, 0x12807343, 0x06ec59b5, +0x8b818500, 0xd972cd70, 0x0c852ad8, 0xa1161c13, +0xa01df758, 0x2c453518, 0x163f2e39, 0x30f195b2, +0xa6290001, 0xb01c600e, 0xfb85c445, 0x7d952391, +0xcc79195b, 0x7267ffff, 0x26b16e32, 0x35355fbe, +0xa37d77fb, 0x3e879be2, 0x8d4e757e, 0x6bae244e, +0x022a6c2c, 0xd1598b1b, 0x23560703, 0x05069a16, +0x3bff24f9, 0xdd0a17e1, 0x24880807, 0xc11a5139, +0xae4108e2, 0x41b52bad, 0x0b208a19, 0xdd630934, +0x0abe809e, 0x0f790dfc, 0x2329eb05, 0x53ddd6c0, +0x501f7502, 0xcd031003, 0xd7c35c07, 0x09080374, +0x04cd0b2a, 0x9017a41e, 0x27492d10, 0x07653057, +0x37fffa85, 0xb3c137c2, 0x8690496a, 0x1209f5b0, +0x83079680, 0x349880d8, 0x1a7bab16, 0x02726c45, +0x04611007, 0xde980049, 0x041830ed, 0x0ec36b62, +0x149fa2a7, 0x6b6b0f9b, 0x000001c0, 0x1014058b, +0xbbb79c3e, 0x0e6ea7a7, 0x02b00f03, 0x7f04513d, +0xd00e800a, 0xe913574f, 0x210ff672, 0x3704d9a2, +0xca6bc564, 0x5460d9cc, 0xb6101822, 0xe4118ecf, +0x4de9104e, 0xc3010268, 0x336c82b6, 0x33375642, +0x6c548714, 0xeadee94d, 0x4d66e906, 0xa939152d, +0x30581606, 0xeb40c16e, 0x08da24a1, 0x77c78d7d, +0xd70eb506, 0xf1ff12c1, 0xfc8b1c54, 0xd49005f3, +0xd9682b47, 0x1210f117, 0xb231004d, 0x7e160c01, +0xa5e1564d, 0x2d3d14f1, 0xebc21f74, 0x7f06c7df, +0x0d003d09, 0x3d1beb0b, 0xdd4a5b3d, 0x12ebe182, +0x0510b82e, 0x28b5c002, 0x0305e876, 0x76898ef8, +0xaf7fb0e1, 0xf6ece856, 0xeb5695e8, 0xb070fd44, +0xc9957e08, 0x2d5dffff, 0x49d984c9, 0x000d3d87, +0x1c061078, 0x62da1256, 0x710a950e, 0x576460c0, +0x63f82eba, 0x5681c080, 0x4a85ad04, 0xf8d535da, +0xf7ff6a3c, 0xbe8eb735, 0x0266dd60, 0x3b778bf8, +0x362aca05, 0x1a743e11, 0x78d88364, 0x1ba31c5d, +0x62b60aab, 0x3082ee10, 0xa1188a83, 0xadb11e83, +0x731154e8, 0x49b74413, 0x00080891, 0xa0ac7602, +0xf4c01460, 0x0376adcd, 0x613b073d, 0x89660e36, +0xc10fe83c, 0x669eb822, 0x1b507854, 0x9a6b1ea3, +0x90891218, 0x0e1ce394, 0x0608c402, 0x6574aa98, +0x246cf09d, 0xf5ff9c05, 0x6078904e, 0x5f5b243d, +0x4af6fa8a, 0x034535d2, 0xcc2d2cb2, 0x4849d042, +0x2800a032, 0x0ec3f788, 0x75abba81, 0x80828d31, +0x86bc44fb, 0xdcad8247, 0x7e099882, 0x0c3aa984, +0x90820fff, 0x80b30684, 0x681b8bd7, 0x08f0d84a, +0xccdbc650, 0xa7403e18, 0x7661910a, 0x0e1a242c, +0xf9fd935a, 0x09260204, 0x04f306e8, 0xb905bb29, +0xf451ff2a, 0x0980e6f5, 0xac607600, 0x72216229, +0xd438dd83, 0x58a91b1c, 0xa33b3da2, 0x87623973, +0x7439457d, 0xe0a78b2b, 0x26cdba4b, 0x53f3f35d, +0x08949801, 0xfca47456, 0x425c001c, 0x14b01847, +0xf5986174, 0x4021f2fc, 0x5efa7953, 0xd1165302, +0x559d362d, 0xf58686a0, 0x58458f18, 0x968b7cdf, +0x83081282, 0x1df06131, 0xda434094, 0xb8683c05, +0xcb24e478, 0x1525c84e, 0x33199f0c, 0x1a4a6306, +0x76f4ff16, 0xb2ec2d79, 0x986a0001, 0x077a600e, +0x7cb77986, 0x24e9140b, 0x0ca41bb0, 0x8c13c716, +0x8e42361d, 0x3c1b8903, 0x8a10ae8b, 0xb620898d, +0xe91a7960, 0x9b1899ca, 0x6b607e08, 0x3b985725, +0xea240924, 0x6a762905, 0x40280b18, 0x45c96162, +0x9016b143, 0x119a029f, 0x6b1a9450, 0x8d3b1551, +0x222b40c2, 0x261863ff, 0x942f011a, 0xc40148f7, +0x24c41162, 0xbe2fc098, 0x478b686b, 0x018b840c, +0xfdb81d45, 0xf01e6f95, 0x47b0ee83, 0xde9ead10, +0x7630c071, 0xf0390ebb, 0xa3064173, 0x6aa9142b, +0xcf121398, 0x3901f85d, 0x518d5610, 0x81555208, +0xdd587df1, 0x0e73af44, 0x5bf0bbbe, 0x3a42c05e, +0xf335c421, 0x08aa5196, 0x782a7823, 0xea23a02a, +0x7ac7c352, 0x5304d5fb, 0x3102a494, 0x09eac011, +0x4f00ba70, 0x20bf5b08, 0x26c508bb, 0xb7f2d95b, +0xbe231c23, 0x460b8de9, 0xc789de0a, 0x5fec43aa, +0x15bf05de, 0x0f1d1108, 0x6a66d1be, 0xc34e5ec6, +0xd3fb811c, 0xbc183142, 0xebcd377e, 0xc81ba0b1, +0x56e846d9, 0x6d100e0e, 0x450c8b68, 0x40f09481, +0x387d534b, 0xc71e8d53, 0x0adc109a, 0xc7bc85c8, +0x10559149, 0xd0014446, 0xb450aef4, 0xb72876a4, +0x412ece46, 0xbea8fce0, 0x928a05db, 0x3911908d, +0x11c7bb25, 0xfcc38128, 0xa1f1dbfd, 0x532185ba, +0x88020324, 0x62eb42a2, 0x0306e701, 0x1161a144, +0x34e1df4d, 0x6a84160f, 0x10077b80, 0xd0596aa1, +0xa11423c8, 0x75d51874, 0x7768fd11, 0x2cd6ef9e, +0x1486b144, 0xe644145e, 0xe81876e7, 0x00151984, +0xab1b9104, 0x3a8d5a75, 0x9e186b87, 0xe412da0a, +0x7e41480a, 0xdc54f444, 0x432d757a, 0xd8624775, +0x0e08d485, 0xc10646df, 0x3474aadd, 0xecb91f04, +0x37778f52, 0x0608a4e4, 0xfa81040b, 0x5281ed1c, +0x562a73c1, 0xb0a76d53, 0xeefdc482, 0xf0b04997, +0x18075b7c, 0x86073d84, 0xd2d67c2e, 0x4e7f76db, +0x092d218e, 0x673982fa, 0x9a637c15, 0x012be823, +0x7c60d076, 0x0d4b1f6c, 0x03ed99d7, 0x40b05297, +0x6312586a, 0xbb0211f6, 0x1d03f389, 0x05bb89c0, +0x974a510b, 0x94a16401, 0x1686eeb8, 0x25e89807, +0x5ef911bc, 0x2dd9afbe, 0xe1048b6e, 0xd713b2a6, +0x90543909, 0xe82aeea0, 0xa0e8be13, 0x3f16dd0c, +0x1c0e48d6, 0x99d8e405, 0x945550d4, 0xb2f02551, +0xf016beb8, 0xdcefbbbf, 0x345091d8, 0x11127358, +0x084c19f0, 0xc0833d83, 0xd85b3860, 0x1416a781, +0x598a1429, 0x3b7148c1, 0x66dd88ad, 0x2f021afc, +0x231012f8, 0x02d8f3db, 0xc48f0800, 0x14110800, +0x8d19c408, 0xb3567fd1, 0xb77fbcb1, 0x66a8d6c8, +0x08810dcb, 0xa3f7898f, 0x9201a811, 0x039cd25f, +0x56d9ea15, 0x015005d1, 0x2d8c8c08, 0xe92c5b63, +0x0708a511, 0x36d8f6ad, 0x0d7328f2, 0x0d16ff0d, +0x2304297f, 0xf2a5d8b7, 0x080dc184, 0xf20baa8c, +0x116d8add, 0x84ef08c0, 0x2a3c36c5, 0x0f36ecf2, +0x0801e40d, 0xa15fcd8c, 0xe055b6c6, 0x284d1108, +0x731edb13, 0xc3a73023, 0x04577f30, 0x6dce0d20, +0x201e647b, 0x1404207f, 0xd801ee0d, 0x08dc8db7, +0x1115d48c, 0x24d73bed, 0xdb60f3db, 0x08120d22, +0x2301f88c, 0xeb1a1111, 0x0825236e, 0xae280219, +0xfb64710d, 0x084784da, 0x2d0d32c4, 0x5b91a235, +0x33168c08, 0xb7d8cb15, 0x2e70088c, 0x750d7736, +0xa8eb064a, 0x73180866, 0xb5735b1b, 0x7612c6db, +0x3d08390d, 0xa80aa54d, 0xf8352c8f, 0xdce85202, +0xc3c9c8ed, 0x103b07c6, 0x202aee56, 0x73720c87, +0x0e419019, 0xad08c872, 0x3c9c01f7, 0xe6e49064, +0x72d5ef01, 0x2b8720c8, 0xa47b48c4, 0x0db30ccd, +0xe904b830, 0x23201ea5, 0xf02e0f27, 0x0c8c7094, +0x6e86c872, 0x20c8f875, 0x0d678363, 0x1c8359f9, +0x4bfac836, 0xf23af83a, 0x1e639390, 0x232cf125, +0x1c8321f1, 0xc7101b76, 0xf20e4e0a, 0xf9f213e4, +0xe8f3fd00, 0x43c9c879, 0x0fd7f41a, 0x0e4190f5, +0xb52cc639, 0xf2721c83, 0xdca4f64e, 0xe4e43993, +0x82f76521, 0x8e4e4690, 0x0d74eb3d, 0xb666f871, +0x4191c9c8, 0x4af96858, 0xc832393b, 0xfabe3c94, +0x0b6c0a2e, 0xc219609c, 0x1d0a2395, 0x83639307, +0xfb1e2318, 0x8288c5b2, 0xdc000240, 0x5520c512, +0xdfa804e3, 0x44743aee, 0x59e81959, 0xff0e3183, +0x802dfad6, 0xe8fceead, 0xc589097e, 0x07f841b6, +0xfa5d044b, 0xeb077458, 0xdd118820, 0x38eb2ba0, +0xd4322357, 0x5b8b6828, 0xc4087412, 0x14761d7b, +0x1e6c6790, 0x0d043d38, 0x8a17164a, 0xc88da0ed, +0xa30be672, 0xdb0eb108, 0x4885f455, 0x8182d77a, +0x57eda2fc, 0x027209ef, 0x88aee430, 0x97c4550a, +0xa624d91c, 0x159a093c, 0xbf24c808, 0x325c930a, +0x5c0a3d90, 0x2c8fd881, 0x4c8a3c20, 0xc8401c24, +0x0b1c9724, 0x90c9401b, 0x3a772c85, 0x0e40260c, +0x0581e079, 0x9272120d, 0x81caa54b, 0x0c7e3454, +0x502468dc, 0x6bc84943, 0x58dbd49c, 0x632fa3c6, +0x20410d47, 0xe8b64c82, 0xa88e3b69, 0xa9142c15, +0x46fcd82f, 0x9e03b744, 0x203cfa81, 0xfa89d4b9, +0x6fcd6030, 0x9250dfe4, 0xca180648, 0x42d82a83, +0xed164468, 0x36d50bc1, 0x29260e02, 0x05f5b8d3, +0xf7e642aa, 0x820fd839, 0x3ff8ad89, 0x5f3b8109, +0x755f3233, 0x2009766a, 0xba88cf5b, 0xdeb16174, +0x0ca87dc2, 0xdbff1558, 0x7c074213, 0x75c984f8, +0x087b804a, 0x22dbf163, 0x022953dc, 0xe3ef7f94, +0x9a2b58fe, 0x756db9d1, 0x047b8123, 0xf7c860ff, +0x12765fed, 0xcb23dca3, 0x25bc10ac, 0x7525a3e0, +0x9bb41c83, 0x8387a245, 0x3e02d678, 0x7441cfd0, +0xe4d4e805, 0x2a055b08, 0x83303276, 0x02bce23d, +0x22b166c6, 0x53620d29, 0xeb06a04d, 0x1362681b, +0xe22c1f61, 0xd8f1b057, 0x61e4c301, 0x2c01df88, +0xb5fd7b10, 0xb261e601, 0x8a9b15b0, 0x43e6086e, +0xc942e6b5, 0xa1322575, 0x254210b7, 0xc0018e2a, +0x4d056982, 0xc51bc3c3, 0x0445ee02, 0x7d39c1e8, +0x8b87a5de, 0x83460870, 0x3edb6275, 0xd002d5a0, +0xc2028208, 0x035c16d6, 0x033c0889, 0xda150410, +0xa2020c54, 0xb0774b83, 0x3d448c15, 0xc5020407, +0x824486ce, 0xdb3bd241, 0x3eff6602, 0x624dd3ba, +0xa0602810, 0xed452128, 0xbfdd5706, 0xdfedfc60, +0x03c4e284, 0xb0071239, 0x61090e1f, 0x6499e009, +0xea680c16, 0x174c1400, 0x00a76a08, 0x2a0ae013, +0x23052507, 0x092a015d, 0xa7c77404, 0x0b4cca78, +0x78689d0a, 0x061448ad, 0x2241f0c7, 0x06c076c0, +0x84a30180, 0xb0880513, 0x40c9926e, 0x0609908c, +0xe4c05340, 0xa6af9419, 0x2aa4ec64, 0xa440a06a, +0x9bb114ec, 0x028c09a8, 0xc9de9d9d, 0xb0405973, +0xe322686e, 0xd53454bb, 0x16bc6843, 0x0761da57, +0xc9323a29, 0x3b4f324c, 0x50dd566c, 0x482a0209, +0x649d1254, 0x318381ac, 0x2a326460, 0xae986758, +0x3103091e, 0x5be7cf24, 0x6c3171a9, 0xba74e3f3, +0x78dd1548, 0x09c90709, 0xe79e4601, 0x680731c1, +0x88c18077, 0x49ba1360, 0x1c80098c, 0x090af96d, +0x3422f6a9, 0x8700068c, 0x1833141c, 0x137ea09d, +0x5b331c1e, 0xc3680166, 0x8bbbba31, 0x31332068, +0x6808d05a, 0xf00130de, 0xe8f168c3, 0x2036ae29, +0xe770409c, 0x28f60991, 0xce819ee8, 0x045f2d20, +0xf54ef16c, 0x7c290320, 0x87d5560d, 0x849ce8af, +0xf10118f7, 0xef1a23b2, 0x82f01b84, 0x920f5dd5, +0x1b8c73f9, 0xa8eb588d, 0xe8c33e9a, 0x114b5b03, +0x24367dbf, 0x4b779d88, 0xdb475475, 0xda3a4d2d, +0x9eb377fc, 0x0ed8e820, 0x9d7d887b, 0x004ef299, +0x02841000, 0x603776c2, 0x44c46670, 0x00008a07, +0x7e46409e, 0x687445e4, 0x013500ff, 0xffb03801, +0xdc057585, 0xde001161, 0x03efbead, 0xa5ffff5d, +0x035e00ee, 0x203c3401, 0x43455850, 0x6e65696c, +0x72413a74, 0x5bff6863, 0x303adff7, 0x4e553a00, +0x320a4944, 0x0d373102, 0x2b0c0301, 0x85e0803c, +0x834406fd, 0x87868584, 0x0336035f, 0xee1ec580, +0x0e6b0532, 0x3d812c09, 0x5fdf6c11, 0x03b2ab64, +0x062b5f73, 0xca2c2747, 0xa463db62, 0xfff06e46, +0x415441ff, 0x4e203a4c, 0x6572206f, 0x6d2d6c61, +0x2065646f, 0x6b633073, 0x96ebbff7, 0x00412197, +0x2b564e03, 0x6e614300, 0x23746f6e, 0x365733b7, +0x24147620, 0x72502521, 0x6fdbfed6, 0x6f636f17, +0x4444736c, 0x20504348, 0x04544654, 0xadffb716, +0x63696eff, 0x73696400, 0x6f6cc06b, 0x00797070, +0x0a202d20, 0xb9bf6c75, 0xfa6c8d6f, 0x31006665, +0x72030230, 0x72652078, 0x6fdbfd9f, 0x2520723f, +0x72325868, 0x31386c74, 0x33073932, 0xbec36239, +0x663f6ffd, 0x38333565, 0x636d7300, 0x2d313116, +0x85ed0931, 0x65186ed7, 0x02237d6c, 0x40746464, +0xb177edbb, 0x362e0b6e, 0x78743039, 0xe0656864, +0x6c7f7630, 0x1e78b5a1, 0x1d640170, 0x33776e66, +0x35bd3036, 0x1e33b58f, 0x30303809, 0x656e9b63, +0x8dd8fb2d, 0x54f16f82, 0x6e55074c, 0xf6b27573, +0x955b6f12, 0x41203974, 0x25229b50, 0xb6de0163, +0x9f22db77, 0x20676857, 0x787d6e69, 0x62613c0c, +0xeb7ffb6e, 0x74083e21, 0x00707466, 0x002f2f3a, +0x698c6f4c, 0xbde2ab20, 0x207325ec, 0x0e3a400b, +0xab580827, 0x266f4270, 0x9b7523eb, 0x72465edb, +0x3a506973, 0x8764440b, 0xf0ad6d0a, 0x6c6998bf, +0x207a7365, 0x666d203e, 0xff280f07, 0x37c0db61, +0x20002e90, 0x61726765, 0x4268206d, 0xa40ad0a1, +0xaf712f7e, 0xf77b4334, 0x22676962, 0x2949424e, +0xb6059005, 0x4a22d0f6, 0x5e61a74f, 0x5dcd69fa, +0x69bedf76, 0x5867616d, 0x7065733c, 0x5fed7bac, +0x7469ee84, 0xf170435f, 0x6f662008, 0xb99bd175, +0x1a2eb5d6, 0x9541530f, 0x458f1011, 0x4d0a7bb8, +0x00409c65, 0x200ad72c, 0xd8302628, 0x290675c1, +0x521de512, 0xbb070b6b, 0x0b79618c, 0x77346147, +0x6bb70c0d, 0x2145c285, 0x6c20a975, 0xcdedb9f4, +0x65db205e, 0x966d1b09, 0xadb16b5b, 0xaf73a025, +0x6135f397, 0xb6f1c310, 0x35748e72, 0xbb5a4656, +0x7716bb11, 0x6d5f3d6e, 0xad5b1670, 0x61dee851, +0x38747562, 0x0e739073, 0xb5b0b86b, 0x6b2d0674, +0xa2657a46, 0xdb6d3364, 0x33503182, 0x2a292528, +0x6085d2ec, 0x4346dc1f, 0x1e3238c9, 0xe925f68e, +0x49901b00, 0x6f864634, 0x73da1b0d, 0x63060a88, +0xf9766965, 0x1f0c1bba, 0x8cb462e3, 0x733a756e, +0xadda9564, 0x09b2b51d, 0x50304455, 0xadd9c629, +0x6d755827, 0x41ea0a4f, 0xec10bf1c, 0x20077f64, +0x6c257830, 0xad0fc228, 0x2dd65415, 0x726f66f4, +0xa3259690, 0x220ad161, 0x7374a111, 0x6e6b3117, +0x7665f5f0, 0xadb6393c, 0x7079b0d0, 0x588b4a23, +0xe1277927, 0x52f6b7b1, 0x666f5f89, 0x72756c20, +0x73614e6c, 0x6e14da05, 0x3f6e4419, 0x5ae70eb1, +0x2cc4b9c3, 0xdb275a62, 0x6173dcc6, 0x075b5bb3, +0x6370175d, 0x90d6fc2f, 0x33320669, 0x19363534, +0x1a424139, 0x43f75b4b, 0xe6464544, 0x8e68032e, +0xba3cb43a, 0xcb58d687, 0x5f2f0001, 0x6fb82839, +0x6f205b7c, 0x3233534f, 0x6dfb7ea4, 0x278161df, +0x2e342e35, 0x18435b32, 0x8d360000, 0x202ec42f, +0x50478618, 0xc26a294c, 0x74a54d61, 0x1c652425, +0x2b570b2e, 0x44bd8dbd, 0xcc5605af, 0xc28770e8, +0x0d098720, 0x74fb20d2, 0x81f9e08b, 0x8a784500, +0x6d0e3a73, 0xc2046c3b, 0x23bfac6f, 0xc36ceea3, +0x72690d1b, 0x202cea71, 0xe0d52112, 0x7642c378, +0x2d73a570, 0xd5307564, 0x7ed8c478, 0x64864300, +0x61af1a32, 0x20b3c3ac, 0x9a896f88, 0xd0b8d0a1, +0x616649d6, 0xd76b4d91, 0x2486eb70, 0x65d74d4f, +0x6074f167, 0xdadb59b4, 0x67091f78, 0x42210b28, +0x8a6dc117, 0x4bd30a63, 0x16dbd764, 0x707285a4, +0x42741c97, 0x5d62326e, 0x478d5a73, 0xde24ca0a, +0x1c533b18, 0xc63d213f, 0xc30b8075, 0x3019c25a, +0x826ca573, 0xd4738281, 0xe0663004, 0xdc12580a, +0x1d32cb61, 0x1d906916, 0x2ed83333, 0x16d612c5, +0x222f3093, 0x5e2d2695, 0x82927e65, 0x3d75cdae, +0xd76f7a43, 0x6a9c67cf, 0x38787583, 0xbb6f7589, +0x507342b6, 0xb42e1f4b, 0xb5216230, 0x6b0e1b63, +0x61621f0a, 0xc520435c, 0x5407b42e, 0xdc696e67, +0x8d0b78db, 0x3e77c184, 0x042f32b9, 0x220058c3, +0x8ca88376, 0x2453a775, 0xb764b8b0, 0xd1f0b752, +0xb7e17638, 0xac783a5f, 0x050ce9a5, 0x78c53772, +0x7a486b78, 0x0c6f74d9, 0x736f000a, 0xf03866d2, +0x49c2283a, 0xb0622007, 0x786ed229, 0xb279780d, +0xdee72578, 0x65757186, 0x24df49d1, 0x66d88442, +0x73638a2b, 0x58111e79, 0x64158572, 0xd88c2042, +0x008960d6, 0x832c4531, 0x0d13dc67, 0x618fb611, +0x1270d658, 0x05074785, 0x2072eaaf, 0xc2b0df26, +0x2056678e, 0xd0873679, 0x9a1ee74f, 0x77130770, +0xa48a7670, 0x0db56ed1, 0xd8467449, 0x3a196666, +0xc2b07b92, 0x9e795741, 0x619a0000, 0x4227c9eb, +0x2ddd4f4f, 0x20ce3300, 0x46370f02, 0x6ee1003c, +0x0339b96b, 0x36816c49, 0x6ecb6234, 0x42bb7dee, +0x30195241, 0x043a7838, 0x736f1320, 0x035eb80b, +0x18598410, 0x0ce19d64, 0x7027350a, 0xf70aba81, +0x00b08465, 0x5823d623, 0x7586003f, 0xf92839a9, +0x063a5225, 0xb614073c, 0xc0c17961, 0xaf61b00f, +0x10239d08, 0xbd62e832, 0x445e4057, 0xb5887555, +0x61609016, 0x7472cf6e, 0x615f1a9c, 0x0c6db375, +0xe06c5cd6, 0x574049cc, 0x5b5cff26, 0x2e6fedd8, +0x470a7529, 0x5c60b846, 0x46a93830, 0xb86867ed, +0xb46c3b42, 0x2e76b73c, 0xb6e03d60, 0x3a002da3, +0x0319b0a7, 0x7dca95c0, 0x002c9995, 0x29400037, +0x0e76ce41, 0xcf9f04b5, 0xad809307, 0x179bb06c, +0xdb001f93, 0x104db575, 0x8b108702, 0x228c9003, +0x02ff7f9f, 0x812910ec, 0x39078cba, 0x388d3281, +0x85ddf381, 0x860fc2ba, 0x07cb13ec, 0x12111113, +0x7fbb2dd2, 0x43dc124d, 0xe4136015, 0xee403307, +0x8f77ddf7, 0xfa134027, 0x0613d107, 0x593f04ab, +0x0da11712, 0xb1e6db07, 0x0f14ea6d, 0xab070718, +0x5fffff22, 0xbb28412c, 0x017f8db2, 0x445b75c2, +0x9a6ed31d, 0xa22e03f0, 0x7850aa26, 0x66464381, +0x600d2dba, 0xbf0f7e03, 0x4ffd9601, 0x103f0405, +0x63538263, 0x916a0b96, 0x05afd8fd, 0x0302b16b, +0xec870000, 0x4dc2b615, 0x033f6800, 0xb7aa0e50, +0xec0ab200, 0x52cfdb2b, 0x07d02bc5, 0x78427f45, +0x59049d95, 0x6d0b4037, 0xc0000000, 0x00012000, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, @@ -2053,10 +2047,7 @@ 0xffffffff, 0x72ffffff, 0x31386c74, 0x7a 0xffffffff, 0x72ffffff, 0x31386c74, 0x7a2e3933, 0x206d6f72, 0x2e342e35, 0x47282032, 0x20294c50, 0x65687465, 0x6f6f6272, 0x726f2e74, 0xffff0067, - -}; -unsigned etherboot_eepro100[] = { -0xeb40aa55, 0xbfe9a865, 0x68744500, 0x6f627265, +0xeb40aa55, 0xbfe9ab65, 0x68744500, 0x6f627265, 0x0000746f, 0x00540000, 0x0034001c, 0x52494350, 0x12298086, 0x00180000, 0x00000200, 0x00010040, 0x00008000, 0x506e5024, 0x00000201, 0x00008b00, @@ -2075,7 +2066,7 @@ 0x55506650, 0x468be589, 0x02468910, 0x89 0x55506650, 0x468be589, 0x02468910, 0x8912468b, 0x685d0446, 0x5066104d, 0x0f2e0e50, 0x000206b6, 0x5009e0c1, 0xe6e8146a, 0x8f2e5800, 0x2e064a06, -0x0648068f, 0xc72e6658, 0x00038406, 0x66000000, +0x0648068f, 0xc72e6658, 0x00038006, 0x66000000, 0x00020168, 0x50686600, 0xe8000178, 0xc4830010, 0x89175b12, 0x3ce85bdc, 0x0002ca01, 0x6650006a, 0xc0200f50, 0x586601a8, 0x832d7458, 0x0000247c, @@ -2090,18 +2081,18 @@ 0x1f07a10f, 0x8cc03166, 0x66d88ec8, 0x66 0x1f07a10f, 0x8cc03166, 0x66d88ec8, 0x6604e0c1, 0x00038005, 0x0ba36600, 0x1f586604, 0x500179e9, 0xbb061e60, 0xc38e0040, 0x131e8b26, 0x06e3c100, -0x146beb81, 0x2606ebc1, 0x00131e89, 0x8c06e3c1, -0x89d88ed0, 0x4c8b36e6, 0x78c98518, 0x33878d15, +0x14b9eb81, 0x2606ebc1, 0x00131e89, 0x8c06e3c1, +0x89d88ed0, 0x4c8b36e6, 0x78c98518, 0x81878d15, 0xbfc08e13, 0xc1831000, 0x8ecf291a, 0xfcfc89d0, -0x6066a4f3, 0x1f0ec38e, 0x61dfb966, 0x89660000, +0x6066a4f3, 0x1f0ec38e, 0x5dafb966, 0x89660000, 0xcf8966ce, 0xf3fd4166, 0x66fca467, 0x66506661, -0xd889c031, 0x04e0c166, 0x84a32666, 0xc7266603, -0xb0038006, 0x66000146, 0x87e58958, 0x5e89165e, +0xd889c031, 0x04e0c166, 0x80a32666, 0xc7266603, +0x90038406, 0x6600014b, 0x87e58958, 0x5e89165e, 0x611f0714, 0xb80650cb, 0xc08e0040, 0x0013a126, -0x0506e0c1, 0xe8c114aa, 0x13a32606, 0xc3580700, -0x0000e860, 0x815d0000, 0x0002b6ed, 0x89b9fd00, -0x8d00005b, 0x06530db4, 0xbc8d0000, 0x0056060d, -0xfca4f300, 0x5607b58d, 0xbd8d0000, 0x00000650, +0x0506e0c1, 0xe8c114f8, 0x13a32606, 0xc3580700, +0x0000e860, 0x815d0000, 0x0002b6ed, 0x5fb9fd00, +0x8d000057, 0x06530db4, 0xbc8d0000, 0x005fac0d, +0xfca4f300, 0x5fadb58d, 0xbd8d0000, 0x00000650, 0xffffffbd, 0xa405ebff, 0x0775db01, 0xee831e8b, 0x72db11fc, 0x40c031f2, 0x0775db01, 0xee831e8b, 0x11db11fc, 0x75db01c0, 0x831e8b07, 0xdb11fcee, @@ -2157,7 +2148,7 @@ 0x00000000, 0x00000000, 0x00000000, 0x00 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x0002bd01, 0x00000000, 0x90909090, -0x000097cc, 0xffedffff, 0xf8835858, 0xcb017500, +0x00009cac, 0xffedffff, 0xf8835858, 0xcb017500, 0x0804c483, 0xcd027502, 0xfb18cd19, 0xfbfa9090, 0x15cdf958, 0xbbf6edfd, 0x0eb4069c, 0x0001bb66, 0x0c10cd00, 0x16cdc031, 0x4bffe430, 0xb407b973, @@ -2190,1438 +2181,1438 @@ 0xdda17d03, 0xec837eee, 0x08010f08, 0x02 0xdda17d03, 0xec837eee, 0x08010f08, 0x02a80f66, 0x435c66a0, 0x7eddb777, 0x600e6616, 0x8938128d, 0x44070c03, 0xae3be850, 0x5dfdbedb, 0x050ced81, -0xd8ad8906, 0x168b0597, 0x6fffbca9, 0x7400fedf, -0x30b58d21, 0xbd8d0733, 0x39054330, 0x390472f4, +0x98ad8906, 0x168b059c, 0x6fffbca9, 0x7400fedf, +0x10b58d21, 0xbd8d0738, 0x39054810, 0x390472f4, 0x890d76fc, 0x76fdb9e6, 0x3248bbfc, 0xfc89cf29, 0xe3e8a4f3, 0x362d8b51, 0xb3db6c29, 0xe868bdcd, -0x3f450c4f, 0xb70f1220, 0x6db7240a, 0x5c046ff7, +0x3f450caf, 0xb70f1220, 0x6db7240a, 0x5c046ff7, 0x8d502624, 0x50608085, 0x7c548ffa, 0xfb7fd38e, 0xec01fb6d, 0x936158cb, 0x66a102a9, 0xe61f6607, 0x648b9d0c, 0xa37dd424, 0xf79cdcd0, 0xbe852696, 0xca9dcb9d, 0xbff62db5, 0x57565507, 0x10247c8b, -0x61983d2b, 0x8339a810, 0x68affbbb, 0xe8550e88, -0x5b217cba, 0xdbac6fbf, 0x0482a30e, 0x23be7789, -0xf129b4b9, 0x6db7eef7, 0x15732ea3, 0x81f8ea20, -0x10b80008, 0xfedc361c, 0x8ed88e7f, 0x8ed08ec0, -0x5fe88ee0, 0x35c35d5e, 0x35b832e0, 0xf9bbf7e4, -0xe83d05fc, 0xa358ec1d, 0xf4250bf0, 0xbdfdd605, -0x68bb5970, 0x1d0300e9, 0x2868535f, 0xf7e45143, -0xe87bbbbb, 0xa5890bb1, 0xa58d23cc, 0x6ca52fc0, -0xde977b29, 0xe4cf615c, 0x8100768d, 0xa88fbcfc, -0x74d7ba15, 0xed0c6020, 0x02341b22, 0xbb7b1919, -0x17072db7, 0x7e8bd0ff, 0xf23b8b8b, 0x8b8b191c, -0xdca18b15, 0x28d0bb04, 0x8be2ffbc, 0x68d6da4c, -0xfd025189, 0x597ff1b8, 0x08618904, 0x890c6989, -0x14796071, 0x6dc3006f, 0x1bcd0bdb, 0x8b08431f, -0x095a374a, 0xebf4f662, 0x0c6a08bf, 0x8b10728b, -0x051c147a, 0x4389ffb8, 0xb6959c2d, 0xbea29c28, -0x840c5401, 0xce8b664b, 0xb8bb188d, 0xef181f30, -0x21a29687, 0x2e9d5d58, 0xc3c2e428, 0x2b07357b, -0x38815080, 0x0f0d2300, 0x82858907, 0x68956ffa, -0x921b11d7, 0x284f2907, 0xd4bd530c, 0x5350ee68, -0x2c1d9da9, 0x2f024389, 0x03d4bedf, 0x88101f0a, -0x0c020443, 0x0f076388, 0xc231585b, 0x90c3db8d, -0xc6535600, 0x6cd6a10c, 0xbddaddfa, 0x70bb0010, -0x29c62904, 0xb801006a, 0xe6dfc2e8, 0x2d062e66, -0x056850e4, 0x6c0986e8, 0x38de176f, 0x18c03b80, -0xa03903c6, 0xb0050f9a, 0x7f5d6500, 0x0921188d, -0x055a0603, 0x5bd30aa1, 0x145db6eb, 0x047f1887, -0x13026a10, 0x6c7dd7b6, 0x1c065016, 0x4eefb850, -0xe859602d, 0x793d2dbf, 0x66c2892c, 0x010a20f6, -0xb10f0374, 0xb6c730ed, 0x8843bbc6, 0xce961203, -0x3f7cb3c8, 0xefeffc1e, 0x95f7b072, 0x2e2c3f8e, -0x250304bd, 0x282f6cf3, 0x32c8fc23, 0xb0b937b5, -0x2d0c26c0, 0x30be0526, 0xa1e805fb, 0x83063126, -0x19b901f0, 0x01b0b939, 0x0c0c152f, 0xecb0ccb9, -0x29535671, 0x19e4b817, 0x47151539, 0x196d2f57, -0x66287b7e, 0x8dca13c7, 0x0a6a1887, 0xbbeeef4a, -0x2474db57, 0x2a24bb22, 0x3eeb8156, 0x2b186f0d, -0xdcd805f0, 0x01181820, 0x35fb3975, 0x14881dfc, -0x74d28566, 0x16186617, 0x0506e0a9, 0x6e0bad62, -0x017220d2, 0xbd16f9d0, 0x20debec5, 0x24e475c0, -0x10321d12, 0x1b07deeb, 0x0e6dfd73, 0x6cba8800, -0x07b15d56, 0x22c5cdb1, 0x55404d3f, 0x636e8f9c, -0x3b2c2c83, 0x06334440, 0xc36c619e, 0x31657df7, -0x7f1e39ed, 0x1406500c, 0x3dafd986, 0xb0034673, -0x65e805e1, 0x03fdb74b, 0x02d081db, 0xf63a75fb, -0x34b22404, 0xb5deef91, 0x23e4405a, 0xb9fc0adf, -0xa5f34e05, 0xae868343, 0x14c5dffb, 0x850c7d60, -0x21a574db, 0x1b9db206, 0xdb5ae70d, 0x5f87d889, -0x0e070939, 0xb07c08fc, 0xe81c8f5d, 0x140101ed, -0xfffe98e8, 0x0b1addcf, 0x0faaa3ea, 0x960ab4e8, -0x8576fcdb, 0xa30e8b20, 0xff3c1304, 0xf04e10c4, -0x7041b736, 0x05d33284, 0xed9f702a, 0x990a07be, -0xa10814a3, 0x05c70d04, 0x7b640808, 0x09249daf, -0x1009003c, 0x1e66dcf6, 0x0f181589, 0x0911051c, -0xd8dd60ec, 0x09101920, 0x28a32324, 0x9b06fb22, -0x303c2c6c, 0x3159a12c, 0xdc9a2584, 0x867cf86d, -0x14890ff9, 0x1afff6fc, 0x080589b6, 0xeb2b0c4e, -0xc183470c, 0x1ff83914, 0xd3d8fbf6, 0x66b9e7d9, -0x918beb75, 0x31fa837f, 0xdfe1bc36, 0x52779281, -0x772dff3d, 0x8400bd4b, 0xdafef631, 0x941ed7ef, -0x391ba92b, 0x72ce23d6, 0xc4b6770c, 0xc53c0dfb, -0xa98b0676, 0x0729c30d, 0x362f6b0e, 0x09353fc7, -0xcb4b19d2, 0x623dc591, 0x777cff4b, 0xfbfdf0bf, -0x03c38944, 0xd6893999, 0x3b27b113, 0x2e720cab, -0x5bb60677, 0x08a30de3, 0x413b2676, 0x0d724367, -0xcd02bb44, 0xcf3b775d, 0x192111e1, 0x62c583d6, -0x333589b3, 0xf087d8f7, 0x2784611b, 0xa3cc1c86, -0xbee5e918, 0xacceb5ec, 0x792c1434, 0x1481c798, -0xc99074ba, 0xb3eb1809, 0x4f13b84b, 0x90ec1987, -0xb2ef052b, 0xffd6be36, 0x9b1478df, 0x3f811beb, -0x45524621, 0x03662e75, 0x89620457, 0x11db8b86, -0x09044f21, 0x5a953b3d, 0xd3aa6b1c, 0x0bb7f189, -0xdffa16eb, 0xe7c1fa17, 0x66c7290a, 0xbb80fa81, -0x44c38eca, 0x75bbf8ee, 0x0369d389, 0xe2812515, -0x8c8db8ff, 0xd8b86e1a, 0xfc8906fa, 0x893942d6, -0xd4bdbef2, 0x2096a6d1, 0x12ebc946, 0xc7044a5c, -0xef6ee502, 0xc2816cfe, 0x49667c00, 0xe946ec75, -0xb877df70, 0x42e48816, 0x09bdf2ac, 0xcc1bb0a1, -0x0408675e, 0xdc69b8b9, 0x07ddda35, 0xe82c89c9, -0x2404fd33, 0xe0cdbdf7, 0x5723b523, 0xbf770553, -0xeef7f7d3, 0xe88151c2, 0xf989261c, 0xc1390d2b, -0x16be0aeb, 0x760b90ba, 0x83247291, 0x2d6f2dda, -0xcad7e3e6, 0xe2c117d2, 0xbe6428c2, 0x1ecb07b6, -0x1ea7d7f3, 0x7216c0e4, 0x742a8d5f, 0x6c6fa125, -0x9082c6e7, 0x032f0d5b, 0x2c1ca397, 0x82770ed6, -0xa6fc9ee9, 0x779d248a, 0x7c1ba477, 0xd175612e, -0x8d1a6851, 0x5b4ddc10, 0x305d936f, 0x088cfe47, -0x341e05e8, 0xb49bbdb6, 0xb239e810, 0x084657b9, -0xcf7afc37, 0xa71983bc, 0xe8f291e8, 0x7051fed9, -0xc9626285, 0x23c27b23, 0x781d2844, 0x8dd029dc, -0xc1b7050d, 0x00e3813d, 0x0d8be41b, 0xa36d8715, -0xecde86ff, 0xc839ce29, 0xd8390c77, 0x12fb6477, -0xf847fa4c, 0x0476000a, 0x56086e58, 0xe851d129, -0xef7be497, 0x2f4d5afd, 0x1e443529, 0x7899599b, -0x438b1847, 0x0753c829, 0xcdb274dd, 0x6904764f, -0xda34d039, 0xa97b0574, 0xafb1cfd8, 0x0540ff08, -0x573fe852, 0x30af49a3, 0x06d52c08, 0x0d8bdb70, -0xa849602c, 0x2bd835b5, 0x5a847a50, 0x607e5045, -0x8c67d701, 0xb95c0934, 0x165f28e8, 0x2e116c23, -0x0868a4a0, 0x5ad7c620, 0x99cc262d, 0xbe59563d, -0x53d8adaf, 0x2185a412, 0xf530262d, 0x52dfbc23, -0xbe7974ed, 0x89241054, 0x89d729f7, 0xb06bf8fa, -0x540e0715, 0xab898389, 0x750f7b82, 0xf7839fc7, -0x2d89b80b, 0xf4b4550f, 0x2cf474db, 0x21fb8386, -0x2c8a1554, 0x737b6ec7, 0xeac1fe5e, 0x96031304, -0x6e688b89, 0x438df783, 0x352b0257, 0x3e060c59, -0x59bd8a71, 0xaa9d8fd9, 0x6de358a5, 0xfd0f1d3a, -0x95b8061c, 0xbb7318de, 0x53e2f192, 0x6ad1a102, -0x060479db, 0x007e1d0b, 0x77eddf9d, 0x74b5153b, -0xea81d602, 0x52828ba0, 0x03b60284, 0xcb3c585b, -0x81046a16, 0x282219c5, 0xcfac51d0, 0x11048ddb, -0x5a207b7a, 0x47c8defa, 0x00cd87cd, 0x2b9a1915, -0x46346d5a, 0x4f408934, 0x16a72bc7, 0xdf2cb69a, -0xd328fe91, 0x9eee3187, 0x01bf660d, 0xe8560d8f, -0xd74995c1, 0xff0cf60e, 0x01180475, 0xa9170bc6, -0xbb776b73, 0x5502c314, 0x2103f45e, 0x1701c133, -0x8ddcc10c, 0x2da1181b, 0xd5c8e006, 0x17d843a4, -0xf66d4a48, 0x06032f67, 0xcf12f889, 0x85c0a95b, -0xfb4309c1, 0x46c91045, 0x9b8c56da, 0x6203c199, -0xb813181c, 0xd2b78377, 0xc9031c42, 0x76113d03, -0x2b432438, 0x814b3c49, 0x162c0733, 0x6189e7db, -0x2d84d2d6, 0x1db7e86d, 0xb150526e, 0xf7e85708, -0x0c75375c, 0xdaf8e09b, 0x2d17e991, 0x4629a731, -0x1607b6f8, 0xbebbeb42, 0xdf03ec0d, 0x4d5b05c8, -0x2c0ac910, 0x8303014c, 0xc4da97d1, 0x049bfce1, -0xcc291055, 0x96eb5154, 0x845bb498, 0x54f59a7c, -0xc142fbd0, 0x89065dc4, 0x94e85dec, 0x0edc0292, -0x9c8b4c7f, 0x3579a424, 0xbcc4f764, 0x4bb535f0, -0x8d6c60b9, 0x65740899, 0x5c8502b6, 0x05e6979d, -0x91d0b60c, 0x8306ba25, 0x0f83d3c2, 0xa370b6e2, -0x194f75cd, 0x04c2ef8b, 0x6c7f8506, 0x958e886b, -0x02fec1c6, 0xbfd1dd1f, 0x4217bdbb, 0x411b108c, -0xf07cf139, 0x76535250, 0xd2b8477b, 0x817016b0, -0x752a64e3, 0x22c60c27, 0x5b4cf8fd, 0xc775f089, -0x89266f45, 0x42f60c4f, 0xd16cd974, 0x735000e8, -0xa86abf8b, 0x7c106a20, 0x5fd002e4, 0xdf8cf636, -0x20e9e8d0, 0x03c08354, 0xdc911301, 0xb3f56ae9, -0x9a36d182, 0x153490db, 0xbeff2cc5, 0x5f1ac1c9, -0x0e765bb7, 0x16bfc8b3, 0x18a47b10, 0x8ba3f0ec, -0x45bb2500, 0x6841bba9, 0x08ff0908, 0x985b5580, -0x10cf60a1, 0xf3392b7b, 0xb1c15782, 0x4ae20abe, -0x3fa37e0c, 0x3917e261, 0xc109ebd9, 0x01421604, -0xdb8b0fc1, 0x5bf5be06, 0xc85ec10b, 0x1a36e0a1, -0xba24850a, 0xd3306531, 0xa36c309c, 0x084749e5, -0xef4b7d9c, 0x026ebf02, 0xf0e7830f, 0x273d89e5, -0x257eb964, 0x75808603, 0x8d0f97e0, 0xdc36fd83, -0x189d0ef0, 0x8d328e2d, 0x960505b8, 0x3a187667, -0xd00b1ae1, 0xf7851e04, 0x82894098, 0xa2cbad1e, -0x096f5830, 0xa4f0e583, 0xed8d6401, 0x5188efd7, -0x3568046a, 0x5a7bac8d, 0x9df5c605, 0x58caeaeb, -0x1d0707c6, 0x0805d343, 0x2323608d, 0x83a10c0e, -0x7a4c4b62, 0x2b1c2888, 0xd63622a6, 0x107b0add, -0x14281622, 0xa56ddb05, 0x05ff515b, 0x541c5018, -0xd60d071d, 0x1ea3059d, 0x03283ccc, 0x0c5d0f20, -0x2a072db6, 0x13822202, 0x94d8862e, 0x6a260375, -0xb27f1130, 0x1466dabd, 0x7fe43210, 0xaba09905, -0x5f36437b, 0xae437540, 0xf637c836, 0x48054680, -0x054e4a12, 0x37c83534, 0x56521250, 0xfa3158a5, -0x3d012c77, 0x60738d3c, 0xc7054328, 0xdffef104, -0x3a68c32d, 0x59612b19, 0x01064625, 0x0846c602, -0xe9dd242c, 0xae4694c8, 0xd81e1486, 0x0a46edb3, -0x465a0e2c, 0x2046ed12, 0xeb0775d6, 0x46e21403, -0x22160322, 0x30952818, 0x051a3632, 0xac651e1c, -0x46ec2712, 0x2646e924, 0x8f6fac65, 0x2a460704, -0x0fe3833a, 0x6a285e0c, 0xb62ee31e, 0x6870b42c, -0x68094628, 0x6c8c80c7, 0xbf0c1183, 0x68df891c, -0x78ef1363, 0xe824d234, 0x5a375882, 0xbb58df6a, -0x71d43aed, 0x18142c89, 0x613b07f9, 0xdcb90860, -0xd709bac1, 0xf0242ddd, 0xf7fde8d1, 0x001ac225, -0xc6dda705, 0xeb6b47c0, 0xbaf062d9, 0x688ec25f, -0xe9e804e3, 0xf91d21f6, 0x6c182244, 0x235bac02, -0x1b7df836, 0x565615fb, 0x0b745339, 0xbe87dd9a, -0xb0959af4, 0x97047401, 0xe80e68be, 0xdd66241a, -0xf73df8da, 0x6ecfc529, 0xaf144ef0, 0x48cdb503, -0xf4e1810b, 0x8d0a250f, 0x02090a94, 0xcde0cd9a, -0x4e83f8e3, 0xa338de0b, 0x7fd48a17, 0xbad0361e, -0x177544a9, 0x01f3c18e, 0x4c835fd0, 0x83306027, -0x0629d080, 0x5981fc1d, 0x42b46284, 0xd4a0e743, -0xa4d2ae91, 0x9eb1c082, 0xda1c1afb, 0xeb29c811, -0x0bacb85a, 0xe3d0837d, 0x0b899392, 0x31b168c0, -0xd61dba70, 0x178c325c, 0xeb7c4bba, 0xe8671857, -0xdac358c7, 0x235d1621, 0x05527722, 0xfc34222c, -0x36c4e82d, 0x306de3c7, 0x1cefd0fb, 0x7b41688a, -0x02105417, 0x66d08211, 0x0af31910, 0xc0a0de18, -0xdad4a91a, 0x36fbe083, 0xb10cd46c, 0x1204bef6, -0xf6a9e283, 0x100fe06d, 0x040e140a, 0x7c0233bc, -0xb5089480, 0x3430184d, 0xaf46464f, 0x59a138ef, -0xd8bf2d0b, 0xc6d824aa, 0x97d75a06, 0x244114ab, -0xef8ec554, 0x3881c032, 0x7620e22a, 0x43028b46, -0xee0adb15, 0x5c04428b, 0x7a080779, 0xd130605a, -0x23dc04f5, 0x1615c16b, 0x71d14ada, 0x22e26f04, -0x31341bbf, 0xc38bc6b6, 0x5b245d67, 0x07017136, -0x438b0d7d, 0xd40640b2, 0x27d02dae, 0x5b7fe1e9, -0x37760913, 0x72afdb7c, 0xeb0a0310, 0x682d90ba, -0x1c9c9220, 0xd8e6df53, 0x4ea604ec, 0x78504d85, -0x73061558, 0x0b33b364, 0x2454000a, 0x13688d6b, -0x52ee6138, 0x638e5728, 0xdf77e9f1, 0xbe02f8c0, -0x07771a81, 0xe085348b, 0xee147b27, 0xedb6ca36, -0x77181940, 0x1b741e54, 0x703ad848, 0x07760aed, -0x19ff2cb8, 0xd0e8e514, 0x02ba8cf5, 0x1bbb6f86, -0x3e1db75a, 0xb817897a, 0x3a397440, 0x06c9cdeb, -0xa71e707e, 0xa1247b8d, 0xe4b90024, 0x7553b1d9, -0x4e2633ac, 0x70c60cb2, 0x352994ed, 0xc3928e0c, -0xa016d4c8, 0x32866303, 0x0cc4a8fa, 0x037ba053, -0x32b4346d, 0x4b17a344, 0x85e6d315, 0x0b1ef856, -0xd01d244c, 0x0bc78553, 0x23c9816e, 0xbe10c3e7, -0x858e74bd, 0xda89ee12, 0x2a1640ef, 0xfea5f66e, -0x23231af4, 0xed10c2be, 0x85a99e4e, 0x0e78e03b, -0xdc74bba9, 0x45c3725a, 0x30b0fa93, 0xbd4880fb, -0xc0e4d551, 0x56e6ec3e, 0x09566753, 0xec0864c1, -0x41019225, 0x31266463, 0x58a839e4, 0xb1c1ea01, -0x392d3085, 0x77b30ec5, 0xbdd04b7f, 0xb8f21014, -0xea654802, 0x10c1ef66, 0x026afba4, 0x0f6ddfe8, -0xfe8bdd03, 0x89fec50f, 0x6dc8e8ee, 0xf989af49, -0x01a8f8d3, 0xd8f006bb, 0x7523ee37, 0xd892b302, -0x9e66f289, 0x16cb8302, 0xdf6ddb01, 0xd889289f, -0xd8d4f93c, 0xd111bb75, 0x40f26f64, 0x2ca5ed66, -0x2a2f1dd9, 0xc20901e0, 0x79b0794f, 0xd820703f, -0x7c62e877, 0x1bde1200, 0x0521bc37, 0x00b9e277, -0x8f7427ac, 0x1afc25ed, 0x00b81273, 0x02c20801, -0xc04fc32c, 0x0fd96176, 0xeb3412c3, 0x16ae25e9, -0x23d6616c, 0x2cf4fad8, 0x81a2831d, 0x8b25d5ee, -0x2c7e06ee, 0x16058c5b, 0xf1ba0c1c, 0xd50684c0, -0x6a77a6a5, 0x5c70ff28, 0xdb3812b1, 0x8fe3b752, -0x82b01186, 0x8a799b50, 0xa3450540, 0xdf867a56, -0x537ed601, 0x826ef77a, 0x48a34ddb, 0x2c3db911, -0x0f581589, 0x6e5b7b19, 0xf7045ca3, 0x42082d05, -0xbee6dfb6, 0x0d89400c, 0x4c0d0744, 0xa7208016, -0xdc0fd235, 0x540f54f6, 0x538dbf05, 0xa96254de, -0xb0efc8f6, 0x17eef16c, 0x305ffc6c, 0x06eb36d3, -0x64f98341, 0x84ec3c7f, 0xe1b6f5b2, 0xbe0a6b57, -0x5a2e9a9e, 0x73986be0, 0x663bc477, 0x097a64a1, -0x0812d2e8, 0xac96a6b6, 0x561febec, 0x7eec45c3, -0x0a85bbfb, 0x097441d8, 0x10f98141, 0xf27e1927, -0xd8535150, 0xc0851f84, 0xdc4f3126, 0x7bbab6c1, -0x2f9debe1, 0x09cca156, 0x7440148d, 0x9ae1b409, -0x608248dd, 0x1164655d, 0x26047b99, 0x7275b3d0, -0x28365a5a, 0x97bc28d0, 0x601002da, 0x895d2eb7, -0x2450770c, 0x00009585, 0x87901676, 0x4eba561c, -0x4d2fbc71, 0x6d400478, 0x848d0910, 0xda957710, -0x0d0f3059, 0x6ac76b01, 0x6da37777, 0x166c82e3, -0x5d3fff25, 0xb7296441, 0x38c3561b, 0x19700532, -0x1d9cc1d4, 0xe860717e, 0x19b75123, 0x3c367e52, -0x628070f7, 0x5508c070, 0x1d688071, 0x07e5ee84, -0xa36c1277, 0xecc06e80, 0xf808de05, 0x96428d05, -0x544203e0, 0xb61ec5d7, 0x003d03d2, 0xb8b35289, -0x3c022d39, 0x5aef6284, 0x8ef69c77, 0x5cb0085c, -0xbabc04b0, 0xecd95711, 0x7e6203ba, 0x873f4305, -0x794a3edd, 0x0f0a4dd3, 0x4e29b08f, 0x513fb824, -0x09d0e9f1, 0xd84d60d0, 0x59101d49, 0x148a7ae9, -0x4b0b1baf, 0x081e8a2d, 0x14fe0253, 0x1b01cf48, -0x15c169f5, 0xb0ad1f51, 0x4a518de9, 0x05c9ca89, -0x1b8b1838, 0x3a5ba906, 0x8b54f43c, 0x22ad7953, -0x88751a5d, 0x9c943cc4, 0x1de3868c, 0xe68350ed, -0x04c68ffc, 0x702ee574, 0x977f6870, 0x8ac95344, -0x0bfbeded, 0x6c428873, 0x5c001bba, 0x77e8d300, -0x7a9687fb, 0x00794bdd, 0x3d9a0ffe, 0xff287d07, -0x141b0e29, 0x9f0f40bd, 0xdb310180, 0xed8aff31, -0xeb39f14a, 0x11732b7d, 0x833ef009, 0x2435dc5b, -0x0ffb8339, 0xf3057ffd, 0xbf8bdbb5, 0x0143105c, -0x3ec681d7, 0x32d77c2a, 0xfd68d85f, 0x5c508b86, -0xb41f8076, 0xd1d98903, 0xf40b42eb, 0x01e183f8, -0xe1164485, 0x0edfad03, 0x04887dbc, 0x053e431a, -0x99fcd77e, 0x5c72ff58, 0xeed27fa1, 0x578eb468, -0x813f4c38, 0x74babaff, 0xe9364a14, 0x77c71aba, -0x5c1d1a93, 0xac9132f8, 0x68a69c52, 0x78bec57e, -0x8b85e86b, 0x045618f3, 0xec3cd879, 0x4106b81b, -0xb85e8d56, 0x0608c0da, 0xb806f00e, 0x1ed0b78b, -0x878da67f, 0x833397e0, 0x87e12e40, 0x2dee590c, -0x60978df1, 0x6023ada1, 0x38bbe3fc, 0x9b649089, -0x1e3c913e, 0x81472464, 0x915b48c2, 0x4b4d63da, -0xc676be79, 0xfd836069, 0x90adac1b, 0xa3c00862, -0x018dad64, 0x200c86d6, 0x60238798, 0x603200c8, -0xac9812a3, 0xee99c513, 0x4de30001, 0xf6a3ebc3, -0x5c4254aa, 0x341b048a, 0x8360708c, 0xc0ea9735, -0x2f16d01c, 0x6ad4cd6d, 0x9cfa833f, 0x966ebd84, -0x0a0889ed, 0x98eca11b, 0xbb77110f, 0xe805781b, -0x5d09a208, 0xdf9ac4a1, 0x6883bb13, 0xa00f0ca2, -0x68c133c0, 0x7b3bb783, 0x9680c0c2, 0x02860da2, -0x08400206, 0x3c36eeeb, 0x040d4796, 0x1705c607, -0x70064805, 0x1b669668, 0xc5051d80, 0x22caf208, -0x0105e179, 0x12725393, 0x58666679, 0xd5b54c66, -0x3f1cfd44, 0xc2e6ca1f, 0x9a47391c, 0x0ff00b11, -0xe5a8b843, 0x00c7b947, 0x7ef41e1b, 0x40c8defe, -0x061c4748, 0x501b174c, 0x21611ada, 0x69eb14bd, -0x00bd6e5c, 0x33a72701, 0xe9d285c5, 0x1752f7d3, -0xabc0b87e, 0x15881ab8, 0x22cb07c8, 0x842dd404, -0xc329da03, 0x3f57050b, 0x174a22b6, 0x4948d460, -0xeb398175, 0x3a288d3e, 0x9e133b53, 0xfb7513b6, -0xc7ded194, 0x8d4d1f18, 0x5f28e89a, 0x7a3a5c1c, -0xafae9031, 0x0520c0be, 0xf075daa5, 0xbe4f08f6, -0xea565155, 0xd7e91348, 0x726128fe, 0xc15005c8, -0x947606a8, 0x57e6e93d, 0x43212e92, 0xe94393d8, -0xb95734df, 0x5dd84ec0, 0x2efd3e63, 0xc1ba8153, -0x39bb2e0e, 0xc1cd9028, 0x7cf11f40, 0x52fe42b3, -0x1da2db41, 0x9bff68b0, 0x80ec28e4, 0x408b4219, -0xe365e8bb, 0x26621b28, 0xf14a09ad, 0xf50aa120, -0x6b0c89da, 0x088de91c, 0x012b986b, 0xf1068a93, -0x58d8ee6f, 0x3a3c0cb8, 0x1ef3438d, 0x38bff442, -0x265b7712, 0x05407017, 0x28501f73, 0xc3017561, -0x93886637, 0x4aad9e4a, 0x8331fb3c, 0x721e08c7, -0xc1a288e1, 0x597e1f6f, 0x8a94e868, 0x595a0447, -0xec394468, 0x1f36a1d4, 0x31f129ef, 0xdd68b64c, -0x6a51d21f, 0x28f76803, 0x42b9688d, 0xc3d355a0, -0x73ba7550, 0xd5bbaa08, 0x03d4dabf, 0x037a802e, -0x2574b92f, 0x8f82c3d2, 0xe8519495, 0x3ab817c2, -0x18bbbbf0, 0x3a388031, 0x3980311f, 0x8380752f, -0x9f75fbb2, 0x56fb6854, 0x05e889a3, 0x7b585e84, -0xa02871a1, 0xe90405a7, 0x16dbeb73, 0x408dbbfc, -0x6a525f01, 0x52fd8d0a, 0x87c33381, 0x811784ed, -0x10a3144c, 0x2456aceb, 0xe8717e89, 0x84ed1d36, -0xc3558bb3, 0x47315286, 0xb84af0e4, 0x7606eec0, -0xda04ebc3, 0x6d303d40, 0xfa11f572, 0x75ab3456, -0xbbe80865, 0x9a23f165, 0x02c8d260, 0x7d6e0278, -0xb766c52e, 0x9a0462db, 0xbdf34117, 0x1f8ce547, -0x9304ec66, 0xe8aecbff, 0x07e0e19b, 0x3d61db32, -0x607c79c0, 0xb5ed14b6, 0x47854b68, 0x0b0b2110, -0x68c8b363, 0x3a0d1f99, 0xa37afb7e, 0x0f55fc12, -0xfe8eb58e, 0x7b609b08, 0x6f358477, 0xf6854a7f, -0x8ed68609, 0x267eef7a, 0x3c9f1878, 0xff046ca1, -0x62be0c50, 0xffa24ec7, 0x7571f021, 0xfe162198, -0x023331ba, 0x8d09a1c2, 0xc9b8f865, 0x36bb7689, -0x0d06fe66, 0xa28c4a02, 0xdfbb5222, 0x7479feaf, -0x8f07b927, 0xe645992f, 0x7bbbaddf, 0x0233743d, -0x7f2304be, 0x0d783d92, 0x5b896b7e, 0x62229f89, -0x70e39beb, 0xada7dcbc, 0xd5489090, 0x041805cd, -0x9fbf082a, 0x1943e8ca, 0x689970ee, 0x66d731dc, -0x537a185f, 0x4370a346, 0xc5af7b61, 0xb34e22a4, -0xc1956809, 0x0905b24c, 0x998a6064, 0x4253426e, -0x3445532e, 0xbb07b040, 0x46b36876, 0xfb241c89, -0xb84dfdbb, 0x4914433f, 0xff147ab5, 0xf200ee94, -0x9e3a057e, 0xb22bd94d, 0xfbc9856b, 0x6f17e245, -0x74204239, 0xb1e74c1c, 0xeab19644, 0xe991058e, -0x77bebec4, 0x6dfb0f59, 0xc4cab80b, 0xfc637afd, -0x8d43b3ac, 0xfe8c2ddf, 0xc20a02fd, 0xb1b077f6, -0x0974ae03, 0x4218b7e9, 0xc3fb0114, 0xae6cec06, -0xa6a1a753, 0x9e11b6ef, 0x01e25e78, 0x6a36144f, -0x67d46801, 0x8d7378ed, 0x2dec686e, 0x1a26fa3f, -0x427827f9, 0xcf688574, 0x9c5a02ca, 0xc28b607d, -0xf057982c, 0x136f2243, 0xc8cc425e, 0x372be94b, -0x184d2231, 0x29990824, 0xefb3cdb0, 0x34d3880f, -0xfdc9ee01, 0x6031fcd5, 0x5d43e198, 0xacc746e8, -0x06a2f7a3, 0xf1a4a55a, 0xc3e051a0, 0x62950c77, -0xe8d3a3a1, 0x05f12aee, 0x07d7891a, 0x3c03ebc1, -0xb58c3e12, 0x0fa32257, 0x67170a7e, 0xbfd0d19c, -0xc5034f0d, 0xed0a8ba1, 0x7fe60b78, 0xd9625d68, -0xe355b1d7, 0xa6a33140, 0x09d80a8b, 0x8e7abc1a, -0x8fb386a1, 0x317bb5fd, 0x0d105089, 0xa11c5889, -0x67784521, 0xbe8a20bf, 0xd301c703, 0x9ec70691, -0xeb7839a0, 0x6498e9ec, 0x60170030, 0x58153bea, -0x7849c9dc, 0x85dd3634, 0xd12a68fa, 0x480ba81b, -0x81d1584c, 0xeeb748fa, 0x7ca5f81f, 0x0f186924, -0x96201dbe, 0x6f4813b8, 0xf07502c2, 0x30772874, -0x56e455e8, 0x8e12bd8d, 0x1dc5b6e5, 0x8820ce4e, -0x4dbb920d, 0x8c26425b, 0x9d853488, 0xfa2c11ec, -0x74237850, 0x7d9c3a2d, 0x27e8ec3d, 0xf7caeb33, -0x74012757, 0xdb4b748f, 0xe8b712fb, 0xab0bee5c, -0x05d59ed5, 0x5a60fe6f, 0x42fd10dd, 0x502725fc, -0xc589da39, 0x870f34f9, 0x3e060107, 0x885b060c, -0x20d93904, 0xf5187e0d, 0xc4820f24, 0x76cb3936, -0x60aea10e, 0x393151db, 0x780f17f5, 0x803396e1, -0xf4fec235, 0xa268b128, 0xf56c8675, 0x32be1cf6, -0xba05ae80, 0x3cca140b, 0xfeed8030, 0x81cacc27, -0x868bc00c, 0x3db96d01, 0xe40e23bb, 0x1891138a, -0x4d8b2c09, 0x0dd6ddf7, 0x1f1c0339, 0x76b97228, -0x142c0f7c, 0xf01d0776, 0x0a72ad77, 0x77f339ff, -0x106c3ba1, 0x34f0dbad, 0x34781376, 0x072b092b, -0xaa510a2c, 0x906f5b72, 0x7c40f6ac, 0xb08d3eeb, -0x1b80ee44, 0x100bd3e0, 0xc06855d9, 0xd340df10, -0xdb2ce02c, 0x55eb4b3c, 0x35c3dc2c, 0x4f19c561, -0x86099c16, 0xd86fda45, 0x75d36c82, 0x71e9d49f, -0xf4465004, 0x8954d1eb, 0x2c3dd2de, 0x24a90d94, -0x88f0c09d, 0xff448018, 0x4c278a41, 0x7fd07971, -0x04b75166, 0x10e566b9, 0xa9b14fb3, 0x500c07de, -0x4d2d25b8, 0x29a94d7a, 0xe634363e, 0x14d83c17, -0xd8a58838, 0x9a456877, 0xdb64b42a, 0xcf8c3aac, -0xf94ce818, 0xe8544899, 0x16588213, 0xb844a1a6, -0x4611178e, 0x2497248e, 0x08dc96a1, 0xdda24a5d, -0x50291c54, 0xef8d1068, 0x09cf8905, 0x811874d7, -0xdbb6e36e, 0x392e2bee, 0x0e726ff1, 0x0686821c, -0x39d2ec31, 0x037ab0c2, 0x43b04729, 0xa924d2e0, -0x547ab850, 0x01a3a109, 0x0858a177, 0x445d4b3f, -0xa5e1b08a, 0x77d8429b, 0x5352c3df, 0x26034808, -0xbac8d745, 0xf0522084, 0x3163c36f, 0xd82932c3, -0x1d01b701, 0xdeb6ab1d, 0x15a33c58, 0x2b901841, -0xa29ba701, 0x6981b42c, 0xac456d69, 0xbb43ca5e, -0x442fbb16, 0x0269c2ba, 0x03edee6f, 0x131a483d, -0xb923a32d, 0x31054cbb, 0x1ce5c7d2, 0xbb44460d, -0x16fffb95, 0x3920c283, 0x83637ef0, 0x3d4a40ba, -0xdf060082, 0x75b8b5d6, 0xac138be4, 0x60040edd, -0x346ffedb, 0x95393b11, 0x06774048, 0xf939c872, -0xea5fc472, 0x742711d0, 0x05d65716, 0xf444808b, -0x267266fe, 0x404124ea, 0x3589a773, 0x8d8e108b, -0x61104535, 0x9d7f6246, 0x76dcd75b, 0xc11bc267, -0x4c8637e6, 0x6d8bdba3, 0xa48bd8b8, 0x4c8e1d4f, -0x7fd30dae, 0x01b0db3b, 0x29ea11f8, 0x42d319c1, -0x6116db1f, 0x1d8d0d84, 0x40440f99, 0xbb613c50, -0x09392b75, 0x085c8924, 0xf738821a, 0x2910d63d, -0x25f02835, 0x294c0c00, 0x5edf8bb7, 0x014f333d, -0x01fb11c1, 0x4d5c11cd, 0x7dd43b5e, 0xf8ac0ff0, -0x5d0c1d09, 0x7453715b, 0x489e1a85, 0xb4ff383a, -0x5ed1b637, 0x4d829415, 0x43154ea3, 0xb69f706b, -0x0de31dc1, 0x1c6a7918, 0xee0ae409, 0xb7155c6f, -0x8810123d, 0x1ca9b088, 0x468406b0, 0x68683471, -0x4ff88baa, 0xc77fa3e8, 0xa1d105b5, 0x5ab07861, -0x406fc232, 0x0eb05663, 0xbdded50c, 0xb6737705, -0x11b9e82f, 0xd7272dd8, 0x11b68a35, 0xf94234d5, -0x46ff3226, 0x7b690110, 0x7e34688d, 0x38db3169, -0xc00933f2, 0xbb8358c3, 0xf448ea75, 0x831f2687, -0x54b3ff57, 0x2fb165b4, 0x2051236c, 0x50e85569, -0x2f4f6793, 0x726cff56, 0xbb035116, 0xabbd8e86, -0xa87f5738, 0x66df60ae, 0x893a6e39, 0x3474faee, -0x5c315538, 0x3cbee8cb, 0x0702e142, 0x6deb418e, -0x5e0af15d, 0xe9e021b5, 0xd58e4816, 0x897eec2a, -0x671a39c8, 0x20ad59e8, 0x0d0e24c2, 0x08d43017, -0xde400574, 0x8650ab59, 0x50f7013a, 0xc14bab54, -0x5b7e58f8, 0x1b7420ec, 0xe652c0f9, 0x4e6f8c1b, -0xc7d2533b, 0xa9b09ed8, 0xc8bb51d7, 0x19da29de, -0xd2318c8f, 0xa1b3a7a4, 0x0370154a, 0xd7ce3a27, -0xfdebe928, 0x21f89d4b, 0x3d802cdf, 0x813ed7e5, -0x6d130358, 0x209844af, 0x687b3810, 0xc0e00281, -0x1881146c, 0x7681513f, 0xb3e02db5, 0x02ba9f16, -0x825344d7, 0xed85ce48, 0x4b77746f, 0x8a07be82, -0xeb1de41d, 0x4c8ac832, 0x6e27a3fb, 0xaee8a3fc, -0xa3f87dd4, 0xdde206d8, 0x1a9981c2, 0x25231588, -0x995c0eb6, 0xdce2f025, 0xbbf0a8c1, 0x148de9b1, -0x840cf390, 0x26dc152d, 0x4b6d2284, 0x9325c8dc, -0x04fd6e75, 0x4c04dc58, 0x172f7bc0, 0x5f8e22cc, -0x02a211b5, 0x73044a94, 0x42da26f6, 0x47d572a0, -0x8a0c7a8b, 0xd8606d46, 0x366213da, 0xf50a7c03, -0x2bdb0d1b, 0x6c4fad7a, 0x74e88018, 0xb7dff086, -0x74020474, 0x2992a17b, 0xff58e9c8, 0x0e9ae89b, -0x869bbd05, 0xf7087544, 0xf4f002ee, 0xfb3be4df, -0x0476eb89, 0x6f0d18ed, 0xcda1b181, 0x2342488f, -0x927b9eb6, 0x945f973d, 0xab5e4b29, 0x50985744, -0xf6269a25, 0xad1afc35, 0xd3e919a3, 0x01faa1fe, -0x20cda06e, 0x300be9de, 0xdb86717d, 0x1f10c436, -0x461213d5, 0x725a31c6, 0x4cc43b28, 0xfd522a78, -0xda81402e, 0x73c8356f, 0x0344cc35, 0xd2340f03, -0x3f125bb9, 0xb9a08788, 0xefebacd5, 0xdb32148c, -0x522e9077, 0x9b18d029, 0xdf4d60e0, 0xd4c73550, -0xfd5a5846, 0x33183b1e, 0xf69c3a1a, 0x7493c505, -0xe0db9e0a, 0x5106e6d1, 0x5189bb88, 0xd8f50c17, -0x83169e0a, 0x58e00d50, 0x6b77da0a, 0x5031048d, -0x51c8528d, 0x5fc12201, 0x895233a8, 0x5fe2e8d8, -0xd8337b88, 0x92d50f69, 0x2b565026, 0x120f901d, -0x1827c37d, 0x3c70e853, 0x35011861, 0x7bb87db8, -0x5e08314a, 0xc35e6d5b, 0xa752e805, 0x8c326aea, -0x44a3d02d, 0x449e231b, 0xab3deb61, 0x77ff32d2, -0x8d1cbe89, 0x2a66fc42, 0x046d0777, 0xfce890eb, -0x4028ffe4, 0x0bffb383, 0x161df684, 0x19dc0582, -0xf881dbeb, 0xc0da4e64, 0x33ff8c26, 0x34776010, -0x51166b2f, 0x530ac702, 0xab3c058d, 0x3bd38455, -0xdbfc3d1a, 0x7f0dffef, 0x74464c45, 0x2ec0313e, -0x8175d175, 0x1336007d, 0xfa781b03, 0xd6396d18, -0x75d38960, 0xc74bafbc, 0x539e2a5e, 0x74bb4ed6, -0x05c73d31, 0x78b1c1f0, 0xa19bbad6, 0xdada251c, -0x0045dda0, 0x3500013d, 0x581049b1, 0x38fd8d1b, -0xa2bc02e8, 0xa09214a3, 0x99db776c, 0x34082872, -0x8d232000, 0x7742ba36, 0x8c032027, 0x77ee0605, -0x013be60d, 0x6a6b51e8, 0x68115612, 0x5e0b7cc0, -0xf00a2a32, 0x15811c2a, 0xa2d0af11, 0xb844d43d, -0x298cff46, 0x5a7804d3, 0x0414abe0, 0x0dcb6fbf, -0x9d56be64, 0x6ce5203d, 0x04bd9df2, 0xfee6e964, -0x06197463, 0x76baf6dd, 0xba2f1281, 0x84093a1f, -0xc5e226bf, 0xb923c08e, 0x18080a2c, 0x53fbfab3, -0x6855106a, 0x3a99e812, 0x53a0e830, 0x8b0cdc3d, -0x5c7da3a5, 0x8d169f78, 0x52d40590, 0xf4a38da3, -0xb93f182c, 0x31f5b0e8, 0xb5a9845f, 0x0be3c00a, -0x7802fdec, 0x0a62897b, 0x95548d69, 0x80021c3d, -0x5be36ffe, 0x7442be99, 0x3907bd76, 0x514676df, -0xfdde4b8b, 0x439236a5, 0x010814cb, 0x0c5651f1, -0x51044b03, 0x0561fffa, 0x7c745647, 0x0303438a, -0x04a80873, 0x5f671e75, 0x0365db01, 0x54935d55, -0xac19ac75, 0x2124b6b9, 0xb0522682, 0x563487fa, -0xbbd6555c, 0xa1000039, 0xe7ac5dc4, 0x01e8a2c2, -0xccba6e9c, 0x5bc087c0, 0xe901252f, 0x065149df, -0xcb52bb0b, 0x8a525009, 0x10a3cc29, 0x39720e09, -0x1606f7d6, 0x9bd5d50f, 0xa435e0dc, 0x32c6d083, -0x5c3cf6db, 0x817f750e, 0xe913ea1a, 0xe15a28d4, -0x0fc339c6, 0xc250198d, 0xd86e13c1, 0xadf8dce5, -0x8d4a7e3f, 0x7983a488, 0x75daee40, 0xfd988bd9, -0x12b185c2, 0x0b041e49, 0x8dc977f3, 0x60681d5c, -0x0c21b6d9, 0x1550cb0a, 0x8470ff30, 0x75289c1a, -0x00c42444, 0x60eb1572, 0x12db811a, 0x3987082f, -0xfc24c103, 0x0c9be217, 0x8b277330, 0xe0834613, -0x0c4b8dfc, 0x4e9b348d, 0x83633efd, 0xf0010ec0, -0x3930bad9, 0x762eadc5, 0x17c67607, 0x1e74992c, -0xd5741f70, 0x16a0281b, 0xcc032c9e, 0xd2963f66, -0x35c1447a, 0x577adeec, 0xb56d1afb, 0x66dd1fe9, -0x4d00002b, 0x8e12db46, 0x4c0c4809, 0x928cadb2, -0x58092009, 0x0e241dd0, 0xac2c39e9, 0x28340c94, -0x64c11f6d, 0xeb0e753c, 0xae01b8a4, 0x4752e104, -0xc5987d31, 0xd52de1c1, 0x232e11d2, 0x7b2f998d, -0xdbdb6d40, 0x3ca27d3f, 0x9dc181fd, 0x8b505b8b, -0x97490271, 0x408586a2, 0x202203ce, 0x0604ec87, -0x53e378a9, 0xe851c601, 0x84e9f30e, 0x350e1dbe, -0x664a31ed, 0x64a11874, 0xe146f46e, 0x7220ab08, -0x0973a40d, 0x83a7612a, 0x4eeab86d, 0xe37092c4, -0x5a1b92db, 0xf1c54c10, 0x0d8e8626, 0xfd2ae86f, -0xeb3c5853, 0x3c7e4307, 0xdacfa307, 0xb4ac467d, -0x7405e2c1, 0x8d77e575, 0x078da15e, 0x48763c59, -0xb1df0473, 0x132f7297, 0x86b45482, 0x440f7644, -0x6ddcdee8, 0x400c501c, 0xeb40b976, 0x48058bb3, -0x6eeada11, 0xc18540a2, 0xf5451c10, 0xca7bb194, -0x2ba67800, 0x85f98341, 0x383dd182, 0x21348638, -0x20889398, 0xceaf86c0, 0x371561f3, 0x244c4300, -0xed8d5a10, 0xff17ee76, 0x8334572e, 0x33391411, -0x9a011a7b, 0xb8455ae2, 0x01a0dc9e, 0xf120351a, -0xd1560390, 0x92a61300, 0x312d1a13, 0xbd770edb, -0xa7860c10, 0xf8bff789, 0x590526f7, 0xc839d101, -0x3906738d, 0x410276d0, 0x398b7620, 0x730e181e, -0x6ec50c13, 0xd0881ef7, 0x3bc21f23, 0xfc0a7695, -0x3a5b0b73, 0x0b8b0f10, 0x3b0c7609, 0x39c80f15, -0x0d116807, 0x1dfd1b18, 0x490254c5, 0x21d0f71c, -0xfbd139c2, 0xbad81c3e, 0xd1297f0d, 0x320b383b, -0x16086557, 0xbbde644a, 0xc468416c, 0xc0466670, -0xf621067e, 0x0105e3f1, 0x0e8b2893, 0xa3f143ca, -0x7cc911a5, 0xe9de15b8, 0xde396e46, 0x084018c0, -0x7cf19368, 0x3f0035b3, 0xaec00b0e, 0xc1084331, -0xb037b647, 0x481e7749, 0x80049d10, 0x64d8307c, -0x0d0dada0, 0xe92ed98f, 0x2b6e4986, 0x11eacaf0, -0x8bad087d, 0x128f6fc7, 0xee29066d, 0xb157a366, -0x47ec264e, 0x3f5de96e, 0x896d284f, 0x9b80c44e, -0xf4032962, 0x4ca6e999, 0xcc684c7e, 0x17e9c316, -0x9730a1fa, 0x12fc299d, 0x944d2e04, 0x60703570, -0x45b82815, 0xce020b1f, 0x3dbae800, 0xc36ec2ac, -0x09e8ba1f, 0x3582fb39, 0x4d730ca8, 0xadda2d01, -0xdf07b0dc, 0xda222e73, 0xa91ffd58, 0xc1c2f905, -0xc93109ea, 0xcf19d629, 0x3637a542, 0x89d801f6, -0xa33f892c, 0x888b882f, 0xeb29ec45, 0xb8cf3989, -0xc4c2a5e3, 0x72f01b6f, 0xd9dee4ad, 0xfafd91bf, -0xc209f031, 0xa15e4074, 0x5b4daf3e, 0x01498aab, -0x4ec5295a, 0xd63a1058, 0x15535530, 0x6d6141a0, -0x15cfbc63, 0x913305c7, 0x362594a1, 0x92ec1f8b, -0xb577d8a5, 0x3db951e9, 0x3c521d92, 0xe7a805c7, -0x877809ac, 0xe83dc3c5, 0x64a3b9d7, 0x58906bf0, -0x9b08f759, 0x2430fdc3, 0xc749c7e2, 0x909037e9, -0x25889b86, 0xdaddd2e2, 0x37257388, 0xf6c0bf68, -0x04b6a0c1, 0xb903740e, 0x9a81c287, 0x5b0cd1a0, -0x10a69531, 0x0d1bfb46, 0x41d02bfc, 0xdb72d939, -0x827a7e0e, 0x54968233, 0xbb7d0ccb, 0x1c6d2144, -0x7416d2f7, 0xecc48602, 0x5f10ae02, 0x3d02ba1c, -0xdd15633d, 0x062d0577, 0x10c03df7, 0x02f56f0d, -0x697868af, 0xed55b85f, 0xd2e9f713, 0x5f406c1b, -0xc11fc5c8, 0x475a45fb, 0x35c3db6c, 0xd583025b, -0xd0be6f07, 0xc309db7a, 0xc1290286, 0x03e2bbcb, -0xdcdbca29, 0x4f86e0d6, 0x23db16c2, 0xbd158002, -0x1140c8dd, 0x0be2d177, 0x59d18943, 0x27b1ac44, -0x6c5bea78, 0xf6ab69bd, 0x79cc49e8, 0x0f40046d, -0xb60815bf, 0x4141de05, 0x8aeb100c, 0x7f16ab28, -0xc244700d, 0xd6a1b729, 0x8ae346f8, 0x4330841e, -0x8a1c7414, 0x06ff9f41, 0x8818fc4b, 0x1cc888da, -0x38df2bdf, 0x460a75c2, 0xd52ff047, 0xe4751f7e, -0x0fdf7d1b, 0xe183c3be, 0x41321adf, 0xd1be04bf, -0x24d0295e, 0xeef7dbf2, 0x147f3b01, 0x744c5e0a, -0xce5e5b0e, 0x5b06c2f6, 0xbed2229b, 0x118a3842, -0xb438058d, 0x093cfa64, 0xee92ec76, 0xe20dad0e, -0x51952f8e, 0xea8918b0, 0x4a184a4a, 0x31f631f4, -0x644a88ff, 0x170532b8, 0x5ea8e813, 0x8de83e34, -0xd19d6870, 0x779a3b74, 0xb7eb7ffd, 0x7f02ffa8, -0x24684209, 0x752e3980, 0x08e6c126, 0xafc60947, -0x13bf0bdb, 0x89c47e03, 0xc8c17bf0, 0xc6890410, -0x1c371a22, 0xe53089d0, 0xa4e829a2, 0xf10c80fd, -0x328dd107, 0xffb75bcb, 0x1258f812, 0x60e402eb, -0xc09e64e4, 0x8204e1a8, 0xa8a5ee1b, 0x19e809d7, -0xe8726f18, 0x93f1da90, 0x01681861, 0xcb633424, -0x4fbbf70b, 0xb8e8a9d0, 0xe6d1b097, 0x08afe864, -0xf7620f8e, 0x1560e6df, 0xb6d3a6eb, 0xe8b7bd4d, -0x2efb83c6, 0x743a901d, 0x120e890d, 0x4bdbd4dd, -0x064264e9, 0x67d5e80d, 0x6c393c53, 0x3d804a19, -0x7f26c1da, 0x2e2961b3, 0xef10abe8, 0xe8dcbadd, -0x95882877, 0x13c0b602, 0xa039de6f, 0xeb5bbbaf, -0x187507f1, 0xb3b753e8, 0x7423c7dd, 0x0823e8ef, -0x7417c389, 0x240dfbce, 0x74c409e8, 0x0ab3a707, -0x12827777, 0x3c237496, 0x77fb70ab, 0x78a2e8f3, -0x11741bf8, 0x7d740404, 0x9bba0fcc, 0xbadf7578, -0x0aebff93, 0x15f0ba0b, 0x616baacf, 0x1213527c, -0xd0b6b9c9, 0x84103221, 0x110fe0db, 0x07bf1576, -0xe805eb58, 0xc9c6979a, 0x906ee952, 0x140ef2a0, -0xb5681c27, 0x5f01368c, 0x1a2d70f1, 0xb9e9b220, -0x91402088, 0x83c0f68f, 0x8d809f4f, 0xbe8dd086, -0x1dc51d26, 0xe4f8d67c, 0x99688d08, 0x8346a281, -0xfff00a1d, 0xf8873036, 0x3b453d14, 0x83b900b0, -0xc1bb8daf, 0x4914c3a7, 0xbba4a0c0, 0x88c19fc1, -0x938bed3e, 0x3ddc83c8, 0x7ed90e79, 0x17d57740, -0xdfc41418, 0xbd3b3442, 0x1693f726, 0x96978883, -0xf004750a, 0xc239f00a, 0x381b07fc, 0xc7916ac6, -0xf79672ea, 0x6346dec2, 0x1175e403, 0x0aa96569, -0x177efdf8, 0x07ea8130, 0x3b47e281, 0xff6d2c54, -0x67229afb, 0x61c0208d, 0x29ced70b, 0xe9f51d7a, -0xe39e7f56, 0x40335f35, 0xf83974b7, 0xf1f75557, -0xd8afe850, 0x2c6853f0, 0x2c4a2595, 0xe575e894, -0x9154dbbe, 0xc66e775f, 0xe8241c44, 0x277f4b62, -0x89e02930, 0x65e972ba, 0x1c0608ff, 0x391c0f06, -0x3ed6bc21, 0x0937540b, 0x1ed83058, 0x5e018b84, -0xd3f8c993, 0x67fca713, 0x9c2dbb89, 0x267f012b, -0x91484264, 0x75ff85bb, 0xa1ad12e3, 0x3ab38bc3, -0xff09d9a7, 0x30e05db0, 0x39052abb, 0xb7a4f2f7, -0x1ffebbb9, 0x393276f2, 0x392c7311, 0x139a66b4, -0xc2df407a, 0x8ea148fa, 0xb9b7a1f8, 0xd338850d, -0x33093914, 0xd0341789, 0x19d6ddbb, 0x779a3bf0, -0xa581750a, 0x95302579, 0xe8868d7b, 0x0b4463ee, -0xd3a07cb4, 0x58184e6f, 0x1d5e016c, 0xb6ba15cf, -0xd43c7e01, 0x5ebe9f75, 0xbe582b11, 0x7ac13e91, -0xa14be2e1, 0x20d1a328, 0xa2068710, 0xcf87debf, -0x0452e03d, 0xd69c0d99, 0x3aa172e9, 0xb4060745, -0xf8e417e9, 0x2932a1af, 0xfc508dc8, 0xace3c802, -0x726a3f0a, 0x8951d319, 0x5b7b3894, 0x2415de44, -0xb16ec310, 0xea4e131d, 0xe6168b0c, 0x9181da29, -0x8db12fee, 0x0d3ef84a, 0x760a7823, 0xf13e5821, -0xe10afc42, 0xb2ed960a, 0xa8480d89, 0xc980be33, -0xc2d9966f, 0x87fc408b, 0x4188358e, 0x39ce0746, -0x66a8f5c2, 0x767d3c87, 0x3295a05e, 0x3050f1ba, -0x42f8528b, 0x23d7a0b1, 0x828f7a75, 0x2fb3a1d9, -0xd4648cc1, 0xa155e2a7, 0xd6f8cee6, 0x0ea2e1fa, -0x6884bc80, 0x2e28c380, 0xc8a81ae1, 0xf7b04a99, -0x20b94f75, 0x5303281a, 0xa6112304, 0x20cc646b, -0x1ecf086d, 0xdb9e66bf, 0x4ab2fb24, 0x417a38e8, -0x5fd7b00e, 0xd0f015d0, 0x346c1401, 0x7955bbd9, -0x6d0bb796, 0x88115a58, 0x43e100b8, 0xbd0869c5, -0x01331ea1, 0x07bfec8f, 0x0a124f7c, 0x22ffec34, -0x9d032d18, 0x7b7520fb, 0x081a14a1, 0xadb94f5f, -0xe80af508, 0x6cf4a75b, 0xefe86122, 0x282aa7b1, -0xe0ebe80a, 0xc02e02a9, 0x43f728b7, 0x58594fdc, -0x49e2ce9b, 0xc433e836, 0xe8450d3e, 0x61dc80be, -0xbe0028c1, 0x45f7dc30, 0x150b502c, 0x1f1ab9d7, -0xcc22eb19, 0x128eb99e, 0xe3d8cf27, 0xb2e98be4, -0xd0753315, 0x3a20cc8a, 0xa29789e3, 0x189a4b04, -0x0d370806, 0x061e3617, 0x5e055b59, 0x1ce43d12, -0x4a08ef29, 0xcaf176d0, 0x147b8115, 0x46c3ff00, -0x9d7502a5, 0x438daf04, 0x13e8501c, 0x936db02b, -0x18ca4210, 0xe0161406, 0x311be276, 0x00848db6, -0x2ad21ff3, 0x9509b604, 0xa994abee, 0x280e45a5, -0xc1183f54, 0x8c68056f, 0x03c6661c, 0x80597845, -0x4128df5c, 0x03884558, 0x2e891dc6, 0x04e3dde8, -0xc8370500, 0x5ca7c54a, 0x88ac1255, 0xd048c343, -0x0618e7f6, 0xaca1ed09, 0xb540ed01, 0x8906bb1b, -0x6b70dade, 0xe8b314c4, 0x1b90f6aa, 0x219a2070, -0x16eb7687, 0xa28e54ce, 0x51a41363, 0xd40fef42, -0x1040ea0f, 0x643e0539, 0xb445b423, 0x3241fc80, -0x602ee7c0, 0x2df6206a, 0xaa14c294, 0x836a341a, -0xed2d8abf, 0xd46897ed, 0x02ad4194, 0x3c02408a, -0x7866dbf8, 0x3c3c23fb, 0x09e9ec75, 0xee463b68, -0x180fe302, 0xf0304e3b, 0x01b074d4, 0x5588b57b, -0x039173b4, 0xba8768ae, 0x700c407b, 0x51cd54a3, -0xbf8ab6dc, 0xc6110688, 0x55d57943, 0x83439bbd, -0x31e514e8, 0xe88ed90c, 0xe7e8ad47, 0x1e58c6f4, -0xbae0b6ee, 0x56225a98, 0xcde80343, 0x87689619, -0x86c65241, 0x59a1fc95, 0xa39e0bc5, 0x7153a845, -0xd427243a, 0x582647e8, 0xb53f11ca, 0xec707ee8, -0x4b6f8c43, 0x46727e8d, 0xb6edc214, 0xeb8351fb, -0x0edf860c, 0x5f030247, 0x1ceb5d04, 0x7947c3f0, -0x6e3de8f0, 0xf1110ad5, 0x3bd45dba, 0x0623c35f, -0x8e9f4307, 0x00892520, 0x9ce5c263, 0x4f28c7c5, -0xc256e804, 0x1c070169, 0xfcb96c06, 0x782a06ee, -0x4e8ff42c, 0x760df983, 0x5b5015e2, 0x595d1d6f, -0x66e40c42, 0x090d5a07, 0xc855ed09, 0xc066a76c, -0x4988002b, 0x5906fdb4, 0x097d800a, 0xd8640f11, -0xf152a9ec, 0xa9555600, 0x7b0340c4, 0x546573b5, -0xc68f5dce, 0x46083cdf, 0xb0bd4681, 0x07bc2fb3, -0x3974b516, 0x0405663d, 0xf19b778d, 0x5626c10f, -0x0e6f8db6, 0x30fa3ee8, 0x6d006c09, 0x4bbae77d, -0x6d883eca, 0x0f1108c6, 0x8e45143b, 0x1bdddfb1, -0x5f385102, 0xe856531c, 0xde0c310c, 0xffd9ef1b, -0x83561677, 0xe85720c7, 0x041127fa, 0xea743468, -0x60f336ec, 0x0468060f, 0x550fda31, 0xd6b7086a, -0x0792665a, 0x79fb402d, 0xe026c08e, 0x0595e0e9, -0x852cdbf7, 0xdab6d188, 0xc1fb0fc4, 0x430b740c, -0x1b815762, 0x2548c031, 0xbff1bf21, 0x8d38126a, -0x528a0e6a, 0x3cbbc60e, 0x53870f0a, 0xa0c4e28d, -0x932bc6fe, 0x42a7005a, 0xfacd7b89, 0x0b10cdcd, -0x7fbba954, 0x89c5f7fe, 0x823f2c06, 0x5edab074, -0x6194c6b0, 0x70846519, 0x5c627c56, 0x582478d1, -0xef087594, 0x46e91c19, 0x938f3a1e, 0xcd0e1f8d, -0x22c6833a, 0xae544584, 0x56086f6e, 0x86742b04, -0xa02d5cd6, 0x8780bbf0, 0x7e836b13, 0x62db0627, -0xe8977c2c, 0x0f30fd26, 0x277b6c4e, 0x694506bf, -0x1de3240b, 0x86ddb74c, 0x05dc3d0f, 0x13cf8fff, -0xeac8148b, 0x533ff614, 0xae09346c, 0x240c8b74, -0xf308748d, 0xe33c4b80, 0x29312278, 0x0e73cfd1, -0x8dde15cd, 0x0e152962, 0x3b203445, 0x0eb7dbd0, -0xff0f7c03, 0xebfc15fd, 0x3501dfe7, 0x68f8ae81, -0xfdc443e0, 0x60bf10e8, 0x4cf86e8a, 0xb9057e07, -0x97f14b07, 0xc3843762, 0xf6e8e3d3, 0x96c751f2, -0x71e0df4e, 0x99a4071c, 0xb129f9f7, 0x976b125f, -0x44b72849, 0xd6381048, 0x45de2ec1, 0xa173748f, -0xca89d9d4, 0xb18b54a0, 0xfe2423c8, 0x8db196aa, -0xaa4fdb43, 0x460813b8, 0xb56d5b04, 0x07fe76c4, -0x0616fcf3, 0x6274a16e, 0xe0d1c307, 0x7b18bc80, -0x1378b622, 0xf0b40618, 0xebdd0704, 0x61740678, -0x230354c0, 0x132eb468, 0xeb30810f, 0xee031917, -0x2b028fb1, 0x681b54e7, 0x00d48b64, 0xfcc22033, -0x42f8e6f8, 0x0362ee1f, 0x596851df, 0x8722a664, -0x08030680, 0x5dba6638, 0x01a4fbed, 0x6d431206, -0x15040614, 0x9946b630, 0x57176ddd, 0x56e303a9, -0x55241453, 0x51cd252c, 0x1374b22a, 0xd250182a, -0xa9b00669, 0x430ebe22, 0x35a3613d, 0xf876506c, -0xe001b3d6, 0x21c05b82, 0xc3db0ada, 0x2ce6638f, -0xf6812e18, 0xf0c345b6, 0xb41945d5, 0xb1e26b27, -0x6d0f498b, 0xb8a56556, 0x9ad85914, 0xe9c3bb94, -0xb97718ed, 0x5e975f28, 0x78c53906, 0x50b83c6a, -0x7f0db1a6, 0xdca36604, 0x341be882, 0x13789318, -0xcd52ac60, 0x7c3ac214, 0x4f83415d, 0xea699e63, -0x7001a296, 0x4a24e702, 0x1c6f19bc, 0x42748008, -0xb8255006, 0xfff8642b, 0x34756832, 0x2be818a4, -0xe8e85b1e, 0x1b0a1f81, 0x671fbe42, 0x665ac447, -0xec10e7be, 0x3ae7dd22, 0xec11c040, 0x74c20b14, -0x07d9efc7, 0x713a02c4, 0xa068cf04, 0x6a9859b8, -0x13ab3446, 0xb7376227, 0xe80c3544, 0x23e8ff23, -0x6d18bc1e, 0x3de9d99d, 0x46782b8e, 0x2495e303, -0xb1406ec7, 0x634a3152, 0xafeb76c2, 0x500176d1, -0x7ee01319, 0xf1913698, 0x2dd0335c, 0x9b20bdfb, -0x2c3e414b, 0x7245e3c7, 0x6d88e2fa, 0x00b178ad, -0x40b43dc9, 0xa5d92bfa, 0x0ca3afb7, 0x5002efaa, -0x5b053be0, 0xf100f4b6, 0xc0c1ace8, 0x5bdcfb9e, -0xba0750fe, 0x0f0386cc, 0xfe5de87b, 0xcc458468, -0x731d665b, 0x0d028bdf, 0x95dbde48, 0x6058bdc2, -0x5da1b702, 0x0e3d79c3, 0x3a97bab3, 0x8df118c3, -0x1408f668, 0x24835d47, 0x4a5aa3bc, 0x201c19e7, -0x1222adb6, 0xf6204e05, 0x2ce88ed8, 0xe984c060, -0xbac00da8, 0x1309b3a0, 0x63206a5e, 0xb0ee9a02, -0xcd86c21d, 0x0dce04e4, 0x13a00fd4, 0x20c67db8, -0x79fda7b5, 0x7e03ff4d, 0xe9357731, 0x75065d0f, -0x2c578da4, 0x6823a976, 0x1a087349, 0x1a6aff10, -0xd9180978, 0x32105c8d, 0x63063be7, 0xdbf29a13, -0xa098fd61, 0x7660da96, 0x2f16dc87, 0x80d009d8, -0xb3130b4f, 0x38848c8b, 0x384c45ef, 0x222ec884, -0xb03002e5, 0x231f0736, 0x2d4d7576, 0x4c590178, -0x75493812, 0x584428f0, 0x2fbd6888, 0x820a583b, -0xb87d3145, 0x1db05742, 0x391e1069, 0x400249d0, -0x58c6c0f0, 0x06d519c4, 0x16ef7902, 0x6012205e, -0x892e4725, 0x6969a1e7, 0xa636f1b6, 0x41aa3da3, -0x8e528ca5, 0x05fe4276, 0xd8a6e748, 0x0f704d72, -0x1985b19c, 0x887c0ac9, 0x5bb9c141, 0xf19ae988, -0xc70ec1be, 0x1559950b, 0xeaab8321, 0x7eb4771a, -0x0d4f72ff, 0x06416dc5, 0xcece7d8a, 0xdcc03894, -0x63098461, 0x086c0573, 0x97153693, 0x7ae0e8f1, -0x484221c0, 0x7e70bb18, 0x4db8a01e, 0x40c1b1e1, -0x38fc18b6, 0xf0c2a79d, 0x2d06c4e0, 0x7da17b02, -0x10805588, 0xe857c550, 0xfd19ee26, 0x181a514a, -0xe997ab9a, 0x585c22b4, 0x5220ae88, 0x25522ebd, -0x167d383f, 0x1da3a27d, 0xfd756953, 0x09fc5198, -0xe9018b1f, 0x386efd63, 0xf6be0a64, 0x428a9330, -0x041f7283, 0x6dc2450c, 0x04b147d2, 0x74d3ed85, -0x175083ad, 0xfbae06a8, 0x941235ee, 0x03e547b0, -0xd7ba3e33, 0x1a7e1ab1, 0x97cc22a3, 0xc148d0b6, -0x9f257df9, 0xf1fdfa20, 0x8b6c2197, 0x2f8c24bc, -0x068024b4, 0xc1e3249c, 0x83a47e0a, 0x8d98ffff, -0x831e1e2c, 0x9f6fea27, 0x8424841a, 0x3e4474b7, -0xbc6c6d82, 0x8018010a, 0x1774cce3, 0x04d09f4b, -0x9e32be1a, 0xe4020886, 0x0d9c4f76, 0x44afc898, -0x821fc8a1, 0x012845d4, 0x816c7d4a, 0xa6d342d1, -0x83f868a5, 0x41809e56, 0xef61ec3e, 0x8c09bae0, -0x25c4012b, 0x3328c9f5, 0xcb1f47e8, 0x6b948eb7, -0xa004f9b1, 0xa874bc9d, 0x8edb2fc5, 0xb6f4ea0e, -0xee391b88, 0x93bd0b73, 0x77863edd, 0xf5720a46, -0xa82d89b8, 0xafc52854, 0x4c758e05, 0x6a152052, -0x44c22e18, 0xe840bd57, 0x68b86c34, 0x50beb8c8, -0x52f42c6c, 0xbb642e04, 0xb67e5c1e, 0x0dbf0141, -0x047bbab6, 0x225ef130, 0x1bddd1c8, 0x00dd54de, -0x4e546877, 0xfffe42e6, 0x62c615ff, 0xd988d4c3, -0xdf7ea180, 0xa09027ba, 0xac846ad0, 0xd13d804b, -0x304275d8, 0x7f0256c3, 0x1135541a, 0xe5ffe1b6, -0x2b750330, 0x8001568a, 0x177603fa, 0x83468d13, -0xc4fd8b9b, 0x37e8ba68, 0x851bee1e, 0xe027b3c2, -0x0230ff0b, 0x12c122e9, 0x580baf5c, 0x837b576a, -0x9b49156e, 0x84f6caab, 0x1a7f75d2, 0x3608fb35, -0x50ac55bb, 0x841d08c0, 0x65df0801, 0x0e2b1964, -0x8001b381, 0x61dbfdd0, 0x9789a023, 0x9275961a, -0x05c6ff6a, 0xee85dfd8, 0x12467318, 0xe88e006a, -0x01e6fdd0, 0x19b3800f, 0x33360200, 0xb656707c, -0x82028ee9, 0xec7ab7c1, 0x4e7401f7, 0x8f010895, -0xed89eb94, 0xab475256, 0x6fe8c743, 0xa47aa179, -0x4a1f089c, 0x0ba3ffef, 0xc58986cf, 0x11187135, -0x483d32b6, 0x35f8891a, 0xe9cbdb15, 0x8a6eec04, -0x2709fbad, 0x0e19a218, 0x0310108b, 0x708617ad, -0xe78c1409, 0xd22a97b6, 0x7a86feda, 0x8ec9311a, -0x6fe3ba8c, 0x383099e5, 0xb81773d1, 0x396647a0, -0x16dfed18, 0xdd41af16, 0xf3721144, 0x7405f980, -0x83800848, 0x481709b6, 0xc0e931d1, 0x8db50bee, -0x2aa28514, 0x47f23db9, 0x6a2ebbfd, 0x6c4c7ec0, -0x3c3c0241, 0x3cb00276, 0x76ac7b70, 0x8d5051a1, -0xd45003c0, 0x03861c9a, 0x10d51220, 0x85d0323c, -0x03104482, 0x10a21ad5, 0x16a8cf87, 0x075f46e9, -0xc8fe1d3f, 0x80c9fef7, 0x0b57a7fd, 0x017e807c, -0x00ea86a3, 0xe13b303d, 0x62008b60, 0x629a4f6b, -0x8c36e48e, 0x58150625, 0xe91346fe, 0x6d387af6, -0xa328538f, 0x7aa39a16, 0x15746292, 0x27e84769, -0x6d5e971c, 0x933b1f49, 0xeb8323db, 0xf67c9c3d, -0xfc5ae904, 0x0099f43b, 0xdca4b884, 0x3bd5a342, -0x09ce6f80, 0xf20c0af0, 0xd1f81e48, 0x6fd1fbd7, -0x718dc1b8, 0x7e8d7d27, 0xf8018002, 0xaae0c739, -0x8322004f, 0x120e8e5d, 0x80758216, 0x1a25781f, -0x08dd5c18, 0x77ef6e74, 0x21a5b91c, 0xca7b4714, -0x0bb02de0, 0x446fb4c0, 0x47b6105c, 0xbf6f80ae, -0x03877c51, 0x725e7c3b, 0xcafae9a5, 0xba1eea41, -0x09e4c0b6, 0x27570dec, 0x05db910e, 0x340fe8fc, -0xd4fdd336, 0xe80b3d90, 0xbd151af9, 0x6c425895, -0xe9988842, 0xe01b7683, 0xe99cf82b, 0xf0418d81, -0x1c51a2d1, 0x1e21f646, 0x02f1675c, 0xed20ad8c, -0x332674c9, 0x313f8981, 0x31158556, 0x11762a5f, -0xed01b1b4, 0xaf3cf890, 0x0875bf3b, 0x06742cb8, -0x2a7f032b, 0xb8f47502, 0xa1ddf044, 0x43391ad8, -0x2dea7504, 0x0f0f0fab, 0xf269515b, 0xf7ccb000, -0x15260647, 0x73f13eb7, 0x67582e1a, 0xc582e5b4, -0x9856b49f, 0x981c5a59, 0xf5111a8c, 0xf72a9d7f, -0x1422ea09, 0x040ebfac, 0x9643633c, 0x141a0626, -0xdb680918, 0xd2405385, 0x704b5776, 0x3b4890aa, -0xfa94a3e4, 0xb890d9a2, 0x48c108af, 0x5bdde27b, -0xffba7f6b, 0x3d107e21, 0xf7ba77bf, 0x55a83aa5, -0xbc00c58e, 0x805829da, 0x875306c0, 0x8ab5003f, -0xb6a15711, 0x85e2acc4, 0xe8f9b148, 0xf01ddf44, -0x8713fd2a, 0xefc1011a, 0xf8f60285, 0xecea848f, -0x0f6caa49, 0x5a4370ba, 0x962b7268, 0x388c6eb8, -0x18446713, 0x57554a66, 0x47244e27, 0x216e5605, -0xe8068f09, 0x0f27194b, 0xdf731a99, 0xebe9d385, -0x1ea314f2, 0xf30422f5, 0x16bacf60, 0x5952f5d7, -0xb1566c43, 0xedd02b05, 0x5c57a0c5, 0x386eb9a0, -0xec81d7c2, 0xa1c10078, 0xd47c0d0d, 0x88ac1608, -0xfa00a2d6, 0xf7ce16ed, 0x010a84a1, 0xa234081e, -0xf5034602, 0x0386168c, 0x75136ce4, 0x1abf76e5, -0xb90c04a2, 0xef824740, 0xcaedd3e0, 0x013cc279, -0x063e3d04, 0xd8184d0d, 0xd02ab193, 0x2206f351, -0x8614c3db, 0xf018ff10, 0x15a9820e, 0x18050385, -0x072b06f0, 0x0fa3f7d3, 0x15c36cd2, 0x2d2f2241, -0x1b040ce6, 0x34ce8d0c, 0x830b63ae, 0x5416b615, -0x38168c59, 0x232374df, 0x800f1001, 0x680d6a52, -0x232cd0fc, 0xe91799bf, 0xff8dc617, 0x060c7f4e, -0xe814bedc, 0xb73df15c, 0x71010ed9, 0x89ba2e1c, -0x1cba5ff7, 0x284b0e93, 0xb750fe9c, 0x8f13bfbf, -0x242c1f9a, 0x436afb68, 0xe8ffb66a, 0xd58a26bb, -0x7efaf2dc, 0x246a28ff, 0xdca1bd17, 0xc9561ce8, -0xb0e2e8c7, 0xa7f04ff2, 0x68483856, 0x5728eb00, -0x87bc7a0c, 0x0c5386c5, 0x09cfee51, 0xe0dd8ca1, -0x1adc4ddd, 0x892fb2e8, 0x2dc729df, 0x475ed47f, -0x63158228, 0x22043d83, 0x7fb77424, 0x570c0385, -0x8b1c2713, 0x2b1c2bd7, 0x611d16fa, 0x6840ec1a, -0x16e31da1, 0xd2324c04, 0x3d163ac5, 0x821390cc, -0xb5439c8c, 0x8cd84e43, 0x9e991674, 0x9a4cdb31, -0x7ff16708, 0xfb8309eb, 0x858f0f13, 0x8b1455f9, -0xc71c2301, 0x9f5f1802, 0x01d8c25e, 0x50f5f001, -0x89ed4907, 0x11d84ecf, 0xe5b10843, 0x26a87505, -0x47ecb6c4, 0x39f685de, 0x895c81f9, 0x48bd8847, -0x34814375, 0x4ba9186c, 0xe8d38c80, 0x516b7013, -0x970a6d24, 0x32061d8e, 0xe2ed59df, 0x79941d1a, -0xbb408ece, 0xf31aae77, 0x3163b702, 0x5d0031a8, -0xffe53374, 0xe27536b3, 0x838d9903, 0xa0831f1b, -0xfd16f6c0, 0xef0d6807, 0x0412d3e8, 0x17f5ba47, -0x6cd23ca1, 0x483944c3, 0x5022a1cf, 0xc8daf1d7, -0x024c0350, 0x0858c8f0, 0x5abd5177, 0x2b92bc15, -0xaa495a9d, 0x84575a2f, 0x410dc203, 0xad8b87a3, -0x03681535, 0xbe1af0d2, 0x02756df0, 0x418dfdd0, -0x6899682e, 0x4290960c, 0x15cfd61a, 0x0aa3ae1f, -0x2a61830e, 0xcbf79668, 0x77f068a9, 0x048302b0, -0xe82835ff, 0x91e4f028, 0xe89e80f0, 0xb494ee6c, -0x426c84eb, 0x536a8a98, 0xf67d81d0, 0x82e8d960, -0x6845d714, 0x0e46c9e0, 0x146be416, 0xfffe3cbc, -0x11dfec24, 0xbd2c68de, 0x00001184, 0x3ec0f2a7, -0xe81e3f6b, 0xc7a4ef83, 0x25f447ed, 0xe9a20f47, -0xdfc069e2, 0xad736d55, 0x39ba0904, 0xf738e38e, -0x408f51e2, 0xc2029b4d, 0x82e7e944, 0x09337044, -0x3ec03100, 0x144d1380, 0xca3867f2, 0x2c112d52, -0x0fd1d237, 0x3013c474, 0xa3f6fb04, 0xb40bff03, -0xa9132740, 0x3960518b, 0x5c418bf2, 0x6a3a2d77, -0xb5e50e8b, 0x75cdd8ae, 0xada0b114, 0xf10c7fc1, -0x15477a37, 0x8354578b, 0x891c760c, 0x46d889d5, -0x8d6e036d, 0xdf57f5f7, 0xe9a63207, 0x19cfa5b6, -0x6c277c11, 0x5f140b44, 0x396868ea, 0x7764789f, -0x40dfaf78, 0x77f76085, 0x13548b72, 0x208a5842, -0xe222dede, 0x775e7268, 0x5876d819, 0xc5aeba02, -0x10d44da3, 0xadab1c61, 0x03e45e21, 0x10786c47, -0x6cd913fe, 0xe2054def, 0xff5378c7, 0xd0386022, -0xac54b113, 0x0a6c3804, 0x90f10482, 0x036d3c33, -0x29473ff0, 0xe9d619c3, 0xe1a37c4a, 0x8300cd04, -0x034651bd, 0x43119720, 0x48b1dfc4, 0x5288794e, -0xda50ad79, 0x0fc466c3, 0xc50fe0f2, 0x9e09b748, -0xc789da10, 0x2eed3187, 0x51721786, 0x8dbd3bd6, -0xd1e200aa, 0x340d1686, 0x29e80e20, 0x6eb07bd8, -0x071f756c, 0x89ecd65c, 0x59d875c2, 0xeb7a0bb0, -0x89f7de75, 0x06259718, 0x50eb2201, 0xfb9b8aed, -0xff034152, 0x36104c40, 0x1428bc7e, 0x8b30c61f, -0x491c4292, 0x86f80a5c, 0x89480275, 0x42037842, -0x7b3ba274, 0x688b1315, 0x26037c3e, 0x68b50edf, -0xa22eb131, 0x9b042b68, 0x36427838, 0x3ee103e0, -0x40358f55, 0x3445038b, 0x3fb4229c, 0x4cf3a771, -0x003dde3f, 0x4c314877, 0x0fb9d339, 0x71b10672, -0x6f77fc33, 0x6b77c139, 0x7451441a, 0xab6e40e7, -0xd8e604e3, 0x28d0c7d1, 0xaafa5ac4, 0x131ca944, -0x70255518, 0x2c261d6c, 0x60cf78b3, 0x58ec3edf, -0xf6a9f066, 0xbd4b74c3, 0x514674fe, 0x6bb59ddd, -0x5028262b, 0x582b4c86, 0xa7fe535a, 0xe30c9dc2, -0x5c46782c, 0x2960568b, 0x1bec3ec8, 0x194876ee, -0x014c56da, 0xa5da11c8, 0x70ff6ee9, 0xb30f04d7, -0x54825036, 0x58285052, 0xba4afc47, 0xfdd0c0e0, -0xc7bde06e, 0x880f0c0f, 0x20f1a6cd, 0x9fb717c3, -0x8d71dd84, 0xfbec71b1, 0x50415e3d, 0x3db8d4ba, -0x2aa7fe28, 0x24b32360, 0xe4ded341, 0x492703c3, -0xa30dda53, 0x20e1da0b, 0x20bd392b, 0xa0251dc1, -0xa0bb3610, 0x8163924c, 0xe8029657, 0xa8a6a5a7, -0x83fc87bd, 0x6f9b6e5a, 0xe9800f41, 0x01d3747e, -0xe9e7a6ce, 0xdf116257, 0x070afa53, 0x8df6c28f, -0xc629f1f0, 0x01dad719, 0xc09155cf, 0x50d26705, -0x85efdc8b, 0xc9bd8bf0, 0x0a41a279, 0x58539310, -0xe06c8a90, 0x6d164bdc, 0x4bfd9010, 0xb1045b28, -0xf7443d66, 0x19961bd8, 0x281b7633, 0xbaa92a9a, -0xd7625774, 0xf80e8890, 0x467c8d5f, 0x2cdcaf89, -0xc0855d20, 0x227bb1be, 0x8394c602, 0x3d50047a, -0x230fb1c0, 0x02255028, 0x80309cdd, 0xae46ddc8, -0x2b3c2d02, 0xda00edbd, 0x2d3c050f, 0x3a80d507, -0xd75e2e93, 0xbf08ac3e, 0xd67c747b, 0x0805aea2, -0x0904e00f, 0xe0b06e0f, 0x341c9a6c, 0xc6899809, -0x2ddf1566, 0x2d49a930, 0x41cdbab6, 0xa3291af0, -0x155c2820, 0xf472dbf0, 0x723a1d02, 0x1eedf8d7, -0x89276dec, 0xa3059835, 0xfcc23294, 0x8a49be3b, -0x4257be59, 0x93572061, 0xc360f846, 0xdc41e852, -0x63481834, 0x20bf066b, 0x7e5484ab, 0x0f125b98, -0xc7fd983d, 0x4100000b, 0x18644a1c, 0x23087aa4, -0x427d0e91, 0x7909c91c, 0xdbe7061a, 0xa9076002, -0xfee54823, 0xdb71e952, 0xddbe7a0b, 0x97eb6679, -0xb88d8f09, 0x34760431, 0xb7002b66, 0x8ad056c3, -0xdb241ee3, 0x6ee883dc, 0x7a808988, 0xbefe4e1b, -0xa08d778b, 0x720711f7, 0x41d1e915, 0xeeec3efd, -0x2b78387c, 0xfb813b43, 0x118779fe, 0xdf75bfa3, -0x07c3f634, 0x2ba4df75, 0x57530eab, 0x5223d9e8, -0x344c35d8, 0xb910cd8a, 0x82ff0224, 0x8d34ecc7, -0xfdf8fd46, 0x1ddcb877, 0x1daab7d1, 0x10edc124, -0xd46d0899, 0x980468a0, 0xa6d0087b, 0x8d2bd3ca, -0x68ba2d44, 0x58ad402e, 0xfa68bfb7, 0x9db3c580, -0x042cb80a, 0x69185106, 0x17733053, 0x785c02a0, -0x34388256, 0xe9722414, 0x0bfb1678, 0x4274d2c4, -0x35731440, 0x26fb2767, 0x08e9c16e, 0x73280beb, -0xef753f21, 0x8702c11a, 0x3943dbed, 0x08e175d5, -0x1e701583, 0x21df4998, 0x28f17817, 0x88c33f4d, -0x980bba5a, 0x428819e2, 0x6602c32d, 0xa91d0a06, -0x428ddc7b, 0x06072704, 0xdc306a45, 0xc5d91af6, -0x693023c7, 0x93c40ac9, 0xb21758ee, 0x6ae81442, -0xd5a71f14, 0x3c9a0161, 0x52be0564, 0xd6f04dfb, -0x0c241824, 0xfe8608eb, 0x552e7f24, 0xa9ff2956, -0x287da4e0, 0xfce283f1, 0xcda8e174, 0x01ee4ee1, -0x8622dd74, 0x38357926, 0x50f0d0b0, 0x4fd27e10, -0x873d4217, 0x2ddd02d4, 0x04501961, 0x424d551a, -0x47236c43, 0x6a172c8a, 0x8446f5dd, 0x18c30b68, -0x5b547cc4, 0x58d488db, 0xdbbc1af7, 0xafd76b3b, -0xb5e9fded, 0x456110d0, 0x08ad0a58, 0x700319b7, -0xdf2ddd1a, 0xb60dec6a, 0xe8def898, 0x544721f6, -0x9a29ed76, 0xc6f84274, 0x0019036d, 0x2bc6f15d, -0xe9474ffb, 0x5542b4be, 0x90104a0a, 0x8d806b18, -0x5b56db4a, 0x0bdf7280, 0x0a7dd15f, 0x0e0c3941, -0xca44f74c, 0x2d86e166, 0xce0439ea, 0x39d944ae, -0xed8dce44, 0xe06f6da0, 0x3c1cd277, 0x1004c8da, -0xaee1635d, 0x2fd80816, 0x916c1a39, 0x3b843edb, -0x6314fd09, 0xdbd87dc2, 0x2f542fb5, 0xa7d2eb04, -0x96121c92, 0x47053c15, 0xe0031821, 0xf5537003, -0x12809506, 0x115eaebc, 0xf34c2a1c, 0xc0954329, -0x36abbd17, 0x8605ca6f, 0x1874d039, 0x9b375b36, -0x50ac2630, 0x0d180543, 0x203914dc, 0x052d20dd, -0x3584761f, 0x73b81088, 0xb1054f21, 0xe21af8c9, -0x2f17608d, 0x08496a0e, 0x59dd5350, 0x29b8b5f3, -0x8b648246, 0x4b4cf6f4, 0xf4c285d1, 0xfca3891a, -0x614d04d1, 0x21dc1dce, 0x00588324, 0x0643d54c, -0xe027045b, 0xf02307af, 0x0b76daeb, 0x324b6032, -0x1a334e52, 0x975ece2f, 0x2d560b5c, 0xfd51d0ac, -0x18148368, 0x072d5650, 0x8365cd35, 0x5c9da4f9, -0xab585674, 0xe4c780c9, 0xd84c1419, 0x170c1c24, -0xbbb72c0c, 0x349a1e12, 0x63f62d56, 0x9b1178d5, -0xe19913df, 0x1a28d06f, 0x21980d97, 0x34205ed0, -0x12c3b390, 0x330142f0, 0x0a62baf0, 0x7f503b97, -0xd6a04c55, 0x7510c4f2, 0x60bab908, 0x092d7e00, -0xc9b5c19c, 0x0c342980, 0xb49f3c19, 0xe07f6009, -0x08858b84, 0x31df6a55, 0x2934b019, 0x3c083c0a, -0x252fbe3f, 0x2376ab68, 0x07235b76, 0x296c07ef, -0x571388ba, 0xdb2e50e9, 0xedb8041e, 0xef3c0721, -0x80f61d31, 0x240fbdfd, 0x08693e74, 0x4e2a5540, -0xb32bafe8, 0xc6695b67, 0x775f0828, 0x1022b2a9, -0x8a1607b3, 0x007a9b33, 0x8bee3dc4, 0x0ab1bb53, -0xc39d5e38, 0x5829c784, 0x1a1eabe2, 0x6f036773, -0xa029a3ac, 0x5fc3e96c, 0xab811d10, 0xe272f192, -0xee42526a, 0x689a5f83, 0x294284a4, 0x8f6d0a34, -0xff9214c0, 0x4fa35e8d, 0xd00aae3f, 0x1574912d, -0xe2011a43, 0xc2e94b1b, 0x46c7131f, 0xd07d930c, -0x1113e04e, 0x73651ac7, 0x2e05ddd8, 0x3810466c, -0x483e3874, 0x821bcf75, 0x724f8c42, 0x405b5ae4, -0x8b6c59aa, 0x4663f83d, 0x6d4d2224, 0x9783b0bc, -0x05f0147e, 0x135646ff, 0xf2df7088, 0x91b772bb, -0xf0042fb0, 0x02e65f46, 0xcb8b5859, 0xd0560c70, -0x218382b1, 0xea701775, 0x9a20f5d5, 0x3750a88b, -0xba35a062, 0x527ec735, 0x6a28940f, 0xa310b215, -0xfc681b17, 0x50e7922e, 0x89bc1804, 0x6e0b0426, -0x1c1b2163, 0x071cc9ab, 0x2dd54ad6, 0xe2628f20, -0x8ccedf06, 0x4d20d17d, 0xbc03ce78, 0xc3023eeb, -0x8c3f6601, 0x7e060904, 0x98db6744, 0x0884060c, -0x9727cbe4, 0xe0ceae6d, 0x3fdf5340, 0xea0ed50a, -0x5694eb24, 0x731676ff, 0xf7aeb849, 0x2e33371d, -0x12420377, 0x6988750e, 0x68132007, 0x062326c1, -0x508b1c9d, 0x8a43439a, 0x2a30e94b, 0x4b669d4e, -0x1059a74a, 0x0e303377, 0xfe04e851, 0xa84d5bd4, -0x168aa3f3, 0xdff14584, 0xc784eee0, 0xfa801b74, -0xdf2f7425, 0x45c006bb, 0x8829ffed, 0x20464717, -0xc76b4075, 0x39a7e583, 0xb143c603, 0x2506d13a, -0x61f6a028, 0x1f70ab1b, 0x2e3df6a9, 0xa3581c43, -0x15bc0b58, 0x62d8e873, 0x23088501, 0xbdb930f5, -0xb94e0041, 0x011219bc, 0xedcf140a, 0x00b8086c, -0xdb1bad68, 0xf477f5be, 0x783c20c8, 0x6415b20c, -0x65cf2c08, 0xbd40fa64, 0x43f92101, 0x638cba47, -0x30da0177, 0xe8043c88, 0xb345542f, 0x0feb3930, -0xdf0e4583, 0x2862b800, 0x038aa6f2, 0x06430788, -0x47fa8fb3, 0x848be4eb, 0x810683dd, 0xda26d80d, -0x843c1818, 0x6f462e16, 0x4fccc0f0, 0x1ebe902c, -0x6bd34ee8, 0x1d6c576e, 0xfef03046, 0xbba7da08, -0x87954c86, 0xb137534d, 0x0f7b2304, 0x85b11273, -0x0764494e, 0x350132d0, 0x0de0f9eb, 0x80afd476, -0xd884ebc9, 0xbff8e8d3, 0x8a1da5e3, 0x0938cf80, -0x004588d0, 0x04e98345, 0x1d08e879, 0x50e583dc, -0x5088f527, 0xfedeecad, 0x801bf250, 0xd2ed1156, -0xdceb89bf, 0x0d7f762e, 0x1e0ab999, 0x1c38f9f7, -0x0bb6038a, 0x14e6942c, 0x6667f255, 0x7460f700, -0x041e0018, 0xdeaa0c89, 0xc12ebf80, 0x450502fa, -0x96d8c229, 0x75026d1a, 0x0bbd47be, 0xe6870aef, -0x022a6ffe, 0x434a0b88, 0xf177da39, 0xdb7dace9, -0xa3ad6f5e, 0x8358df6f, 0x306402c5, 0xe9310454, -0xb164dd37, 0x9b1ee865, 0xd0301e45, 0xe9c46280, -0x10306973, 0x3fb82c76, 0xe995d20e, 0x182fcb8f, -0x6a2cd530, 0x76d8bac8, 0x41b0d81e, 0xb1034103, -0xe85516e0, 0x226dd67f, 0x3ac501ab, 0xe2771d43, -0xd419e94d, 0x44600ab7, 0x390653ff, 0xae91d9d3, -0xde73aafd, 0xe43f7351, 0xda79fcf9, 0x43b60e5a, -0x3dbf503b, 0x776bfbdb, 0x45af3d86, 0xcdf45cf7, -0xaabfe92d, 0x0e5c83b1, 0xb7d16303, 0x9c1314fd, -0x4e450470, 0x16acf17b, 0x1ec5a12a, 0x50d890c3, -0x1804148d, 0x52db85ba, 0xb808cfe1, 0x8a307414, -0x6d32b907, 0x84d2d2f1, 0x74342628, 0x1b5f3822, -0x0ba5e26f, 0x36c188d2, 0xe720488d, 0xd188c888, -0x776fd10a, 0x38204a0b, 0x0375ca08, 0xe817754b, -0x430d6d05, 0x7a15d202, 0x5eba27e1, 0xcb891508, -0x4201808a, 0x88ac4541, 0x2df62ead, 0x4f09f452, -0x89b94c1b, 0x8bb64ade, 0x74c2b7ba, 0x41034ea6, -0x66f02343, 0x9d34d577, 0xd34c543d, 0x4204eb94, -0x76eec06c, 0x24fa7505, 0x48424102, 0xe976ce4c, -0xc93746d0, 0x1b74fd1f, 0x2cdfa52c, 0x74430307, -0xf3754906, 0x5dda34c6, 0x955760b0, 0x1a2ac34a, -0x15f4161e, 0xf0993a02, 0x0efdc2d3, 0x20da51b5, -0xa8ef05eb, 0x025ed8a9, 0xd738108a, 0xa05728f5, -0xa92db300, 0xbac1b05c, 0xa01ff155, 0xf7aef2df, -0x388449d1, 0x836d4010, 0x3b4827da, 0xab9d19f7, -0xb8574cf8, 0x89d6384a, 0xfa0377c0, 0x801174c8, -0x404a1739, 0xd10505e4, 0x75805bf0, 0xc3c829f4, -0x0744566e, 0xa295cdda, 0xcf7cff31, 0x2d350c05, -0x03f11675, 0xa215748e, 0xf189ed86, 0x6e161a74, -0xafed3810, 0xf5ae76b1, 0xbbc39d5b, 0x3543f374, -0xbbd9a708, 0xebd5b147, 0xf39556e9, 0x5c8c83af, -0x0d4323d8, 0xe8874314, 0x75267e04, 0x815a73e3, -0x09861474, 0x3079f089, 0x04b77542, 0x01d86481, -0xee4c59c3, 0x58f7505f, 0x9b0f3c74, 0x745a5e16, -0xc56bb909, 0xe574822f, 0x3d5d94a3, 0x1deaa5ee, -0x540a1d8b, 0x2bf174db, 0xb2f7efd0, 0xc4753b28, -0x1f05c764, 0x6c410000, 0xf2120821, 0xecf62c1e, -0x10bbf6d8, 0x5a5b3f2f, 0x06895659, 0x088fc353, -0xa4f6902f, 0xd9c206eb, 0x0171e153, 0x36204143, -0xb3205be2, 0x3548c593, 0x6a5b0820, 0x0d8c30a3, -0x65f685a4, 0x856f9282, 0x02016dae, 0xecd01813, -0xef754e4e, 0x62e18c3e, 0x0c371a69, 0xda0b74b1, -0x21d856c6, 0x428cc402, 0xef27f52c, 0x8e20c413, -0x4e5c8b31, 0x0a9a1100, 0xf218154e, 0x5bf68c1f, -0xda89cdf5, 0x03122774, 0x14ebce89, 0x89db750c, -0x7ed49055, 0x80174e30, 0x952f5bd2, 0xe87dee71, -0x6c163d4f, 0x08daf910, 0xf9834978, 0xf7b7e96d, -0x9fb30c58, 0x8aff508d, 0x7e382142, 0xbf1473c1, -0xf275180a, 0x18a284c2, 0x5ef3e2a1, 0x07c6d0b8, -0x77537cf0, 0x628b0df2, 0xb8400ca9, 0xf4433510, -0xd0791045, 0x40c850c8, 0xbf3d8070, 0x52e1c3fd, -0x087256bc, 0xb201c84c, 0x6211403f, 0x088be399, -0xd8ecffd2, 0x37ff8ab0, 0x4601b25c, 0x8c30284f, -0xc7eb85ba, 0x643a8305, 0x00097782, 0x11e235dc, -0xe84f54aa, 0x8a84d212, 0x28075464, 0x9648f150, -0x60caa829, 0x09288a08, 0xf416c1fe, 0x16740301, -0x6d152c3f, 0x76c416f8, 0x3813e811, 0xb608c321, -0x111db1c1, 0x85e89e07, 0x6dedfa10, 0xa6e9ac55, -0xe6eb170a, 0x50a5e5e8, 0xdb2395bc, 0xc8eb010a, -0x6082dd11, 0x016a6c20, 0xfc0420f4, 0x99a4bf6f, -0x0f75fb49, 0x05b50678, 0xb0a76ab6, 0x804bc301, -0xc263e429, 0x04160d8b, 0x66f86ed9, 0xc508eac1, -0xe84075c5, 0x2d98a290, 0xb5990240, 0x49c5822d, -0x9be889a5, 0xe2d41090, 0x53681b8d, 0xfb97881a, -0x0ce8cbee, 0xbe1538f8, 0x38b87535, 0xd407bd05, -0xb0fa2305, 0x93e6dfeb, 0x83b6f106, 0x0c755d41, -0x148c0336, 0xa257ba7d, 0xc031000b, 0x921b6056, -0xfed84714, 0x0899022d, 0x2daa5bdb, 0x16361e7c, -0x1c5fd7c1, 0x0816e374, 0x3d3ec21b, 0xdc544f6c, -0x6c0fd856, 0x54cffa4a, 0x328b02f2, 0x64fdd468, -0xf684399b, 0x30a36b7c, 0x86903f00, 0xb70f07ef, -0x068a0a47, 0x06f56b75, 0x61f80857, 0x03a4680b, -0xbf791f29, 0x7748220b, 0x6c2b1274, 0x02bb77aa, -0x512b6831, 0x348d3202, 0x6f8eba10, 0x80de29ff, -0x8901037f, 0xba0911f5, 0x10a98d14, 0x6b60064e, -0x1fa44c00, 0x151dd5da, 0x1315c826, 0x40bc387e, -0xc5161c35, 0x35b8a929, 0x4c0d8a3b, 0x3ab83bbe, -0x06305155, 0xc25e14bb, 0x3407edce, 0x3dda1e22, -0xeb1f06b8, 0x5c733ede, 0x1c746e22, 0xa9f289e7, -0x18b70e6e, 0xe98944dc, 0x3487eb0e, 0x0f080300, -0x5c414984, 0x8121fcb2, 0xff128278, 0x1c21de02, -0xe2dc69f6, 0x0a24faf8, 0x682b2d3a, 0x5d034484, -0x857205e9, 0xe8a14f62, 0x572a5b39, 0xec1924d1, -0x2b620d0b, 0xdc374137, 0x5f0ae687, 0x3d0843d0, -0x85895c0a, 0x6d44b636, 0x894dde8f, 0x6fc3130c, -0x391c5cb3, 0x8b40d8a1, 0x1e101c00, 0x2c46b6eb, -0x30402e3a, 0xb6ec0001, 0xa43642c8, 0x81c6c20e, -0xfb8c038c, 0x82cd77ef, 0x52c2b902, 0xc3d64249, -0x2ca1ebc3, 0x69fd15ff, 0x4b82e11f, 0x0fb702d8, -0x24a8a126, 0x3b64f5e2, 0x05aa0903, 0x8c28a1a1, -0x482fb56d, 0x37880a07, 0x55887bf5, 0xbd54424c, -0x8708e21c, 0x3d2badae, 0x09420b2a, 0x2e140a76, -0x0da08714, 0x9beb3b1e, 0xeb6011ba, 0x030a0358, -0x08030728, 0x6bd02a2b, 0xbba62409, 0xe221d9e4, -0x85bce057, 0x112b50fa, 0xbbfb0b39, 0x077a2138, -0xea6808b5, 0x02a74191, 0xda037b7c, 0x3f1a7b8d, -0x98968012, 0x4882d583, 0x976f16c5, 0x0e06622f, -0xd8d70420, 0x446a08c1, 0x3f068fab, 0xa50a43a0, -0x91164774, 0x760e35a1, 0x0c4fbb3e, 0x180a08c5, -0xc0531543, 0x0ea0b75b, 0x752b0f03, 0x8108257e, -0x495d7e13, 0x031c0216, 0xef596f6c, 0x98b1f833, -0xf0eba408, 0x5add7548, 0xc5087b18, 0x22d5cb6d, -0x9d024e01, 0x1fc18b15, 0xa752c559, 0xc8841d87, -0xcb3b0e25, 0xb0f03af1, 0xeb6567b3, 0x182224d0, -0x5bb0ca74, 0xeae64630, 0x76247652, 0x582d05e3, -0x26c1b28f, 0x3b3dea03, 0xb7eb3150, 0x877bc11e, -0xf2e46305, 0xd9dd0608, 0x533c2308, 0xff191073, -0x54371213, 0xe8845283, 0x8012f752, 0x0f0b1441, -0x1a027032, 0x93160cd9, 0xabc54888, 0xe18d08eb, -0xfb855ffb, 0x7f547423, 0x08003d45, 0xff084420, -0x8d7cd132, 0xf717e856, 0xb0473818, 0xe9589570, -0xe3051f85, 0xde134b09, 0xe0ca9636, 0xfbabf777, -0x1dcce9d6, 0xbb75983d, 0xb9eb0324, 0x6038c005, -0xb3eb0270, 0xe3f85e79, 0xe04031f7, 0x30557504, -0x5934832e, 0x2f183c43, 0x24120d2e, 0x18dae8d4, -0x136e8b57, 0xe0025648, 0x08441d6e, 0xe08a83cc, -0x0fb4469b, 0x260d0c37, 0x568f2066, 0x08f5018c, -0x02604475, 0x6d8732dc, 0x5750183d, 0x4254d1d7, -0x37c01d82, 0x3ba9eb43, 0xb074eb05, 0xb23dfa02, -0x18a30212, 0x87b497eb, 0x41b1f65c, 0x6dbe7470, -0x0bb14109, 0x718966ac, 0xea9ac7ba, 0x54666b87, -0x12184f78, 0xc1879089, 0x6094a0c6, 0xb4980e1c, -0xd82a0ec2, 0xa50f74ff, 0xdac79c05, 0x8a3ac0da, -0x8aea2ef5, 0xf120065f, 0xf72120c0, 0xe07ec21b, -0xf3af178a, 0x74272df6, 0x2b2adaa0, 0x786d811c, -0xa6bab0f6, 0x08d71f74, 0xd0979e50, 0x87684fbd, -0x1c2e3833, 0x9c828dca, 0x0435e8af, 0xe4c7825b, -0xd9c308ff, 0x0c099882, 0x82c7df5b, 0x03260090, -0xdf0066b1, 0xaf07a3ba, 0x539c156e, 0xc8cde306, -0x123620dd, 0x5152164b, 0x054b60ed, 0xf4f27c21, -0x8e8233ee, 0x56fc1870, 0xab7b4953, 0x509abc07, -0x8b2eb020, 0x07ea7ab2, 0x048dfd88, 0x15793b3e, -0xb3512873, 0xc68c76c9, 0x504a3304, 0xbd12803b, -0x632dbb46, 0x37d5d5e2, 0x940f00e3, 0x53c8d1c1, -0x8310fac0, 0xf5d7498e, 0xd1c960ad, 0x555bbb50, -0x1a2951e3, 0x5ef1ac79, 0x73fb5302, 0x7dd50082, -0x86868b58, 0x18375a14, 0xc11163c2, 0x82968bec, -0x20c20ff4, 0x94ffd24c, 0x79a56808, 0x147630ee, -0x2bd364dd, 0x26846a0e, 0x0e019900, 0x910978de, -0xe39e5b62, 0x65d9f53d, 0x5b04302c, 0x66c06a00, -0x50756f41, 0xc836c37c, 0xd2911e34, 0x359c487f, -0x26c719d2, 0xa001fd00, 0x0b191b14, 0x23898b3c, -0x210ec094, 0x9cf4a06e, 0x8fec2390, 0xa305748d, -0x39013300, 0x21222c66, 0x8225f72d, 0x07900d0c, -0xbc45bc8b, 0xfbe7b56b, 0x473b0b5a, 0x96b6a210, -0x53701382, 0x895ad6b9, 0x126a396a, 0xc5fa2ed2, -0x39f69bd2, 0x87e275d0, 0x018b300c, 0xcd0ab1ed, -0x8dde62de, 0x1d18f870, 0x1081dc07, 0x960f2b41, -0xc2b59b0e, 0x73f039eb, 0x533c7e4e, 0xa39a2814, -0x10ab12a3, 0xf51785a7, 0x51495e30, 0xf7a35208, -0x08b167f1, 0x0e7360a6, 0xc8302c3f, 0xff120761, -0x5a11d9f3, 0x07aa13ec, 0xded08908, 0x6170760d, -0x8f6aeca9, 0xab327ba0, 0xb0558dc8, 0xd993bb08, -0x8ec1460a, 0x2dd230fe, 0x1a89ee6e, 0x677c1d81, -0x9e896014, 0x772b9251, 0x40bf01b0, 0xd305ba89, -0xbfd10a5f, 0xe76d416d, 0x0e0e672b, 0x698d0c77, -0x5d83fd1c, 0xfd819d00, 0x7ec68973, 0x617a3e19, -0x7e0632d4, 0xce1215bb, 0x8e74e9d8, 0x9757f365, -0x23e86cef, 0x39c05628, 0xa211f0ff, 0x01fb7286, -0xba238a55, 0x7791512d, 0x1ecc3e8b, 0x34388a55, -0xc400c0ed, 0x316e47e8, 0x446874c0, 0x64107a4b, -0x412ecfb4, 0x2483ef99, 0x75dbbfa7, 0x4eda4264, -0x00599600, 0xc47b6859, 0x2a7cfb43, 0x838f8bf0, -0x3477831d, 0x9e8df6f2, 0x340fbef5, 0x5e07a84f, -0x1286c6fe, 0xd8bb3202, 0xa50147a8, 0x4618c606, -0x1c5524d1, 0xb6a8c160, 0x073a80cd, 0xf23c8c44, -0x140aa110, 0x2b1814a1, 0xab878118, 0x0c7dac86, -0xd62b16c6, 0x2c4d0ced, 0x1c040800, 0xc8e4776c, -0x68efeffc, 0xec686600, 0xcc0ea818, 0xd6017c73, -0x2fdb0804, 0x449c9154, 0x7404ec0a, 0x4057113f, -0x06aa0753, 0x7dd2c604, 0xd0532942, 0xfa8161cb, -0xf88a56ec, 0x04b941d7, 0xd1890273, 0xc0ef42bf, -0xef93ea4b, 0xf45e5bba, 0xa2840d3e, 0xbc75e21d, -0xa11c4553, 0x895364a8, 0x9b6e8cda, 0x6d22c93b, -0xc6eb4904, 0x01c330ac, 0x56a95e0b, 0xa411c3aa, -0x402540e4, 0x7d44358e, 0xf896e3e8, 0xb7e876a4, -0x1bbb766c, 0xbd76e831, 0x04991d11, 0xa56f8b23, -0xd9afbba8, 0x0965bed6, 0x0fe82a08, 0x1d3b83c0, -0xd329fa04, 0x3ab0dc46, 0x296dc016, 0x93b9c0d0, -0x68f0d427, 0x1e12f581, 0x22c8f074, 0xaba92360, -0x091c5811, 0xdd109cce, 0xacc860c0, 0x161d85b3, -0x3f142914, 0x0c149a16, 0xb612f6f4, 0x3a29b86d, -0x0b0b840f, 0x080e417f, 0x457d010a, 0x6d78d7cf, -0x48b6eea0, 0x368fafdd, 0x030e5201, 0xf58e0f3f, -0x0ab16a1b, 0x52f34dde, 0x55236ce8, 0x80b9d3b3, -0x963026c3, 0x64156bed, 0x200a7a40, 0x45d15172, -0x655340c6, 0x346d849c, 0x0edea0f6, 0x495c3b15, -0xc4db6db1, 0xb4ebb003, 0x17270d18, 0xb65b1936, -0x0a0e5b03, 0x21cb3678, 0x0b1b6fdb, 0xf8c6100e, -0xb71c3f0c, 0xd238a04d, 0x711bf3f2, 0x91b6c6d0, -0x32ab4231, 0x99420f0e, 0x46ddf6e4, 0x02ba0e33, -0xd9427008, 0x30a0cd00, 0x81fc6b0f, 0x839ac6db, -0x1bf38912, 0x4b370f55, 0x1b6c6546, 0x0e103019, -0x09114660, 0x92a458cd, 0x5a49304d, 0xefb11b0e, -0xf3240536, 0x89d63301, 0xbcd984e6, 0x3319b1ec, -0x63627507, 0xfeb7f093, 0xd6e8aeb6, 0x64d684b6, -0xcb760a7b, 0x5d5bb536, 0xef4d3d2b, 0x8c2d3475, -0x57cd236d, 0x222289fd, 0x6ad35d82, 0x238db636, -0x255d050e, 0xec364df0, 0x03024441, 0x4e448f00, -0xfb03dd63, 0xe9fe4472, 0x3112f941, 0x22717357, -0xc475d977, 0x0c45e917, 0xd65eeb09, 0x1516ad9d, -0x41022eee, 0xa6ec0f35, 0xefe99a23, 0xf30612fd, -0xc1041ddc, 0x21a4e651, 0x9cf6135a, 0xfedde9ec, -0xccf0aa10, 0x7759f147, 0x34f8bac2, 0xf62347a7, -0x7d479412, 0x7b723613, 0x91763695, 0xee909c70, -0xf4dd3684, 0xfabe5d12, 0xd2137d84, 0x37f95b4a, -0x909cd612, 0x24f2a8e6, 0x2511f00f, 0x17764245, -0xfcfe12ed, 0xdb09bf65, 0x12ebe992, 0xfcd8974b, -0x65c236bb, 0xccd9fbcf, 0x5ac803cc, 0x137d84df, -0x47a33444, 0xbd9080b4, 0x126139ac, 0x5a7df8f6, -0x0f61efbf, 0x7e49f213, 0x36593a31, 0x37d979d4, -0x364612b9, 0x01c8faf8, 0xab060709, 0x041eebe0, -0x061c5685, 0xa83b6de0, 0x26881a64, 0x712f092d, -0x831d0ba8, 0xe823c1e5, 0x0438b69c, 0xb781fb80, -0x085ac96f, 0xf4073570, 0x344d8950, 0xbde6b68b, -0x5d1cb3d3, 0xc1e8f8bf, 0x0bb308e3, 0xb3e835c2, -0xb7fb96b8, 0x53b108dd, 0x0e2d827c, 0xfcfad6ff, -0x4409a1e8, 0xfaa8df60, 0x0a88e430, 0x5fc4b6d9, -0xb0193cc3, 0x8a38b076, 0x0b3c434c, 0xe4990585, -0x263a643f, 0x77b02ef9, 0x29043a09, 0x416b02e4, -0xb08b78b1, 0x0c2efc87, 0xeb81c63d, 0x49907881, -0x3a0a2bbe, 0xdf24b08b, 0x0d775805, 0xa90c4e3c, -0x7773d858, 0xf05aa870, 0x1f2dd54a, 0x18156ad5, -0x68b08ea7, 0xe0070224, 0x60dfbbd0, 0xb82ca3a3, -0xf3a80f5a, 0x6739f029, 0xd8a01540, 0x6672bef7, -0x1afeb61f, 0x335f3b81, 0xb04c5f32, 0x2510c3f9, -0xef7aaba0, 0x8be67323, 0x0d5b2535, 0x0bbfec3b, -0x24b8db9a, 0xe8494350, 0xe98980c4, 0xc4bdb709, -0x85d689b6, 0x348d97d0, 0x25046f33, 0xdb622215, -0xb7892fc0, 0xdec9d993, 0xb19f997a, 0xb63291e8, -0x444dbc80, 0x7ffe802e, 0xbdc0e810, 0x810c1550, -0x084857fa, 0x8a4f76a8, 0xf0967053, 0x402fe4cc, -0xe8e093b0, 0xf42058a9, 0x587b8191, 0xabe9fd05, -0x17eaa720, 0x51091f0b, 0xbe8c4384, 0x4c055bfd, -0x02107dc2, 0x0742130c, 0xc984f87c, 0xd404d428, -0x008a4d92, 0x2baaaf62, 0xd18189d3, 0xe809f777, -0x04271218, 0x7700433d, 0xe0d0f721, 0x19a35e96, -0x3cd2fee7, 0x34a22489, 0xd66844cc, 0x93083b2a, -0x3596a46f, 0x95d3756b, 0x23bfd52f, 0x80c21f15, -0x528c4374, 0x72006850, 0x68310fbf, 0xe3fc38d4, -0x007047a1, 0xf4d9c0f8, 0x9810880e, 0x19fc686f, -0x11cc89e2, 0xe9ac4f7f, 0xebf08479, 0xf1402ba0, -0x446a8392, 0x61e4534b, 0xbffba088, 0x83fd7b14, -0xd08801ca, 0xb0b261e6, 0xf11a4305, 0x040e8de2, -0xd9df42e6, 0xdf735cd8, 0xe9c3c308, 0x5e29d9d6, -0x153f0510, 0xdf190091, 0xa0d5048d, 0x3b550f6d, -0x028208d0, 0xab6e0b6b, 0x3b0880c9, 0x85041003, -0x02062a5e, 0x4b83baad, 0x23bbec86, 0x8907d840, -0x02b0e953, 0x723d0000, 0xd2ec5ff6, 0xd3ba3a37, -0x2410624d, 0x55020f06, 0xbc578b33, 0x182500bf, -0x3105fa21, 0x0add03c4, 0x8fddbfd5, 0x151868ee, -0x071b05c7, 0xa50e1fb0, 0xb642b9ea, 0x28452209, -0x08c19ee4, 0x0a05c225, 0xc00e7908, 0x07e50015, -0x02ba467c, 0x0409e500, 0x1f158b14, 0x7845056a, -0x3b57d4e5, 0x4234459a, 0x9234687d, 0x2176c6c9, -0x286624a3, 0x42502c40, 0x09306ebe, 0x49374006, -0xfe9eeec6, 0x891d5068, 0x443d401d, 0xbae114ac, -0xdc8c0948, 0x111a9a4e, 0xffff540c, 0x6dd7050c, -0x29fa16f4, 0xc31a5c77, 0xb03efd51, 0xf46854e4, -0x27e84827, 0x83b0eebe, 0x5227ec6b, 0x480209f0, -0x52eec2b0, 0x127131c1, 0x280c3192, 0x1ecc331f, -0x04312836, 0x091eae28, 0xaf90615f, 0x077e3103, -0x2320314c, 0x142324dd, 0x1c070918, 0x35f60a92, -0xac4c3101, 0xb1926ebb, 0x28342442, 0x1b07092c, -0x1f8084e4, 0x01661728, 0x0db19268, 0xc0688e51, -0x00b0b431, 0x5cb86c10, 0x5b0f2806, 0xe85b9e39, -0x68b5c0e5, 0x878468ce, 0xe8e10fc1, 0x7518b01f, -0xb5eae012, 0xe57b1072, 0xd9208b1c, 0x10a3ca6b, -0x093d960e, 0x03201bf8, 0x127b75e8, 0xbe06e990, -0xbe1c0a0e, 0xa64204d5, 0x8c51c037, 0xfbcc5e90, -0x3515891a, 0x4b91447a, 0x720bb638, 0xb2ab96b9, -0x0f754b6e, 0x3e80c305, 0x2ddbf257, 0xeb4a448c, -0xe8208a87, 0x824d0ee8, 0xf2909d43, 0xecf2f423, -0xdeefd046, 0x031d813a, 0x37ed1cde, 0x071f05b0, -0x89038ee3, 0xdfa805ec, 0x008b4032, 0x1605fe00, -0x7445e4f9, 0x351fff68, 0x062b0301, 0xf6f60647, -0x1161a501, 0xefbead5d, 0xe25fff03, 0x035e178f, -0x203cbb01, 0x43455850, 0x6e65696c, 0x75bb3a74, -0x7241fdff, 0x303a6863, 0x4e553a00, 0x320a4944, -0x5f003102, 0x0a7d8412, 0xdc050239, 0xb1b1655b, -0xbd365fc1, 0xc26b0532, 0x3757b7ff, 0x2b0c510e, -0x81803c11, 0x85848382, 0x015e8786, 0x7f45bac0, -0x13ff7301, 0x720d9d92, 0x544146af, 0x203a4c41, -0x5ffd2d4e, 0x72206ffa, 0x6d386165, 0x2065646f, -0x63617473, 0x6c21c46b, 0x50d77fee, 0x564e0300, -0x6143002b, 0x746f6e6e, 0xfa762023, 0x14ae676f, -0x6e252124, 0x64006369, 0xb76b7369, 0xd6dfb6df, -0x70706f6c, 0x27723079, 0x6c6f636f, 0x48445473, -0xfdadfdbd, 0x54205043, 0x26045446, 0x52504545, -0x0085314f, 0x7b7f6469, 0x3205bb1b, 0x0d330639, -0x98383238, 0x006d6163, 0x584c6565, 0x3870b5d7, -0x32162d1f, 0x4c84330d, 0x353484c8, 0xc84d9cdf, -0x38633736, 0x65323635, 0x21d84d74, 0x62610e67, -0x4ee6632c, 0x640d84c8, 0xf50b0065, 0xbfd8f7ec, -0x71313538, 0x6539076d, 0x3536bb72, 0x6c1b360d, -0x6d5d7859, 0x1b033d07, 0x3207b06c, 0x84587a17, -0x4c6b2e19, 0x0da0350d, 0xb5336df8, 0x6e64521b, -0x646120a8, 0x56db7264, 0x254c5868, 0xc4a1566b, -0x6d6e0320, 0x6bc3c35b, 0x83658d20, 0x27730d62, -0xdadb7f64, 0x66741bbf, 0x4c007074, 0x671d2c6f, -0x253a402c, 0xed002073, 0x3aecb75b, 0x0f122f2f, -0x726f2e3c, 0x6f2c3e74, 0x57b5cd0b, 0xec161267, -0x6e550c78, 0x7378b773, 0x18b97585, 0x50412046, -0xfd25229e, 0x63b6a376, 0x69122201, 0x207a616c, -0xc36d203e, 0xcfad6db6, 0x33640f07, 0xfc280565, -0x5a2ab41b, 0x13e90529, 0x3e16d62e, 0xf020006c, -0x20c17267, 0x6f776885, 0x20b0b614, 0x69624afc, -0x424e2867, 0x8085ed49, 0x437f0a2d, 0x44697372, -0x74736d0a, 0x401073cb, 0xb1952a42, 0x13d6b9f6, -0x61cfde3f, 0x0ae6e021, 0x6d69f76d, 0x3c696761, -0xad117f73, 0x462ff63e, 0x5f7469f7, 0x08a7705e, -0x756f6620, 0xddc62cbc, 0x0a1a2edb, 0x404e654d, -0x0a6c2c00, 0x11ec5a1a, 0x1fd90a72, 0xaebdce65, -0x853392e0, 0x4333d020, 0x7b6e6ede, 0x646d1b09, -0xf861472d, 0x36796177, 0x3acfb588, 0x0a6c6552, -0x3526743b, 0x06ed24b6, 0x4d550029, 0x56b1c844, -0x65572c68, 0xb6ed2ef5, 0x6b5b62d0, 0x73ad213e, -0x1e19a4bc, 0x4427adda, 0x949b7261, 0xb6d6ad65, -0x46e5a152, 0x06745c09, 0x861ac110, 0x7a6934b7, -0x0b5a5865, 0x56e946b3, 0x924346a7, 0xb5b64916, -0x2600a458, 0x28a9750a, 0xc2ec5b3b, 0x130a29ec, -0xbd6e7775, 0xec716d4b, 0x5770b5ad, 0x7562a44e, -0x5049c574, 0x885b1b43, 0x0e73a41b, 0xb6613e53, -0x1a04c337, 0x65631719, 0xdd641069, 0xad91860d, -0x6ec76a62, 0x64973a75, 0x0eda453d, 0xb70ab98c, -0xe39a64f7, 0x09798217, 0x25783020, 0x304b136c, -0xc9d687e1, 0x6f66b7eb, 0xcbb59072, 0x0aecd192, -0x6d4a114d, 0xb6ded6f6, 0x27502743, 0x6f4a603d, -0xe6572066, 0x753ded1a, 0x14966c72, 0x0b2f19c7, -0x6ec2b5ce, 0xac90ab1d, 0xadc36b97, 0xd66eb9bd, -0x6976650f, 0x707920a4, 0xb1dcc689, 0x5a62470e, -0x5b9f6173, 0x2790d25b, 0x175d07db, 0x1d696370, -0xd6a50bfd, 0x3d4f0832, 0x43424139, 0xf7464544, -0xd2d6fa4d, 0x6868032e, 0xed353a58, 0x8dd62f00, -0x395f478f, 0x4f8a205b, 0x60de5753, 0x3f70b828, -0x2e351e91, 0xfb2e2e34, 0x7295951a, 0x20350018, -0xc42f8da5, 0x50477f17, 0x7469294c, 0x61c28d52, -0x1c65424d, 0xf0d70a2e, 0x44bc6b40, 0x9755c7c3, -0xdc3a3820, 0x0d0883a1, 0xc1d220ec, 0x6c22dd3e, -0x4f784500, 0x6d0e3a73, 0x276c2f6b, 0x5f6f126d, -0x287b3a77, 0x0c15b657, 0x963d7485, 0x10776da6, -0xc7edec10, 0x3d20f468, 0x0a2e58da, 0x89028d27, -0x8e2691ec, 0x1adb630b, 0x32c7500c, 0x611e78ac, -0xe8e8e882, 0x69306d06, 0x63886cce, 0x5ba3da38, -0x2ce97058, 0x93b4494e, 0x9172c96e, 0x6e499861, -0x3197856b, 0xd74d9702, 0xa1452325, 0x2cb302b5, -0x39f9e20e, 0x8eb9ad79, 0x65625c5b, 0x0e536505, -0x6c20bd35, 0x69d31278, 0xa157be73, 0xe2a9605d, -0x346a381b, 0x6dca3330, 0x7742a5bd, 0x553c635e, -0x3ad68d2c, 0x67654386, 0x174b8f31, 0xb90a9c2b, -0x7ac7ac8f, 0xb63af6a6, 0x74986721, 0xe196ca79, -0x67ecda36, 0x320b6874, 0x380a63f7, 0x8ecc31b7, -0x9d6c1023, 0x186ad604, 0x60911d28, 0x028f8509, -0x1d9e8496, 0x96296181, 0x33340ab0, 0xae29654b, -0xa036a447, 0xb2dc93b0, 0xdb6d8ad7, 0x379a9f79, -0x62c2da6b, 0x67667b0d, 0x31093737, 0xdb3a4102, -0x253d21bb, 0xaf48c0ec, 0x02195375, 0x5a3b42dd, -0x7361ba19, 0x81833970, 0x2a7b0b42, 0x810ccee9, -0x18980e03, 0xd133464b, 0x902afb32, 0x630b70ae, -0x6290b61b, 0x1f0a6b0e, 0x2e65f162, 0xfb48604c, -0x6c69973a, 0xb14ebdcf, 0xa05fafec, 0xb0db1b4d, -0xf72f00b2, 0x69e26e67, 0xa95e963c, 0x6e8d8905, -0x9db032b9, 0x5232d870, 0xbe5fe576, 0x73a1b078, -0xbba62ccd, 0x784578f5, 0x970b7b29, 0x610cbeec, -0x5452453e, 0x5b08ba1f, 0x2b48676c, 0x70cc3d61, -0x2e075ce6, 0xde2dbd1f, 0x5cb1c2f0, 0xe367dadb, -0x9ed27983, 0xc2e876a8, 0x074f9c7d, 0x0a8c7737, -0x85705b56, 0x7419bb15, 0x41eee146, 0x6666ed83, -0xaf8e2119, 0xeb278189, 0x0000f548, 0x4f4f427e, -0x683c081a, 0x339c2d6e, 0xc859cf51, 0x0056833a, -0x83c66bba, 0x1ed0a507, 0x18a617af, 0x632c2db1, -0xb69335df, 0x6db96c18, 0xce2069d0, 0xc58b531f, -0x1d88e7ae, 0xc3797878, 0x30c6f5b8, 0x6c757171, -0xdd4440b8, 0xc0b4d771, 0xe56c7e68, 0x4b623436, -0xba524142, 0x19bef0f1, 0x3a783830, 0xd952c304, -0x0a093a52, 0xd075c35b, 0xb0f86879, 0x0f9e0457, -0xeb1092be, 0x3fee7ae6, 0x4aafb700, 0xcdb3736f, -0x430430e0, 0xdec91621, 0x67c60b46, 0xa33aa468, -0x05af9976, 0x305895cf, 0x8ce0ce2c, 0x854c0d85, -0x3a996431, 0x60b0374a, 0x58582307, 0xb5a12157, -0xed754480, 0xa33f3a2d, 0x2315d4e3, 0x6dd78161, -0xc25a1948, 0x4012a880, 0x76d846c4, 0x6f6f26a1, -0x6f75292e, 0x3e39c117, 0xae55703e, 0xb6c100a0, -0x8d8261ae, 0x98081e83, 0x3b131d02, 0x8b42ef56, -0x1f079780, 0xb207cf9f, 0x933906c1, 0x1f93179b, -0xb6012836, 0x1f5b5000, 0x73eba660, 0x0064035f, -0x1e298086, 0x10efe479, 0x30078d8b, 0x10319210, -0xa2103299, 0x4791e479, 0x34b01033, 0x1035be10, -0x4791e4cc, 0xda10361e, 0x38e81037, 0x3f23f610, -0x1039791f, 0x05103afd, 0x0c103b8e, 0xf23c8f3c, -0x3d1510c8, 0x103e2310, 0x3f105131, 0x23c8f23c, -0x09451059, 0x12274d12, 0x23c8f655, 0x5b12288f, -0x49611229, 0xb02f6a24, 0x247b1e47, 0x245d0772, -0x8210507a, 0x52d8f34f, 0xae078a6c, 0x52010798, -0xd8477ba6, 0x0300086c, 0xf31c1600, 0x5568dffc, -0x0060c399, 0x400048f2, 0x053f80f2, 0x458b20c5, -0x2d82008f, 0x7fd10da0, 0x7255ae41, 0x83d81945, -0x328def42, 0x4f28ddb3, 0x26035c09, 0xecad810f, -0x04054f37, 0x96156747, 0x002d80c2, 0xecb7a8ae, -0x0003417c, 0xdb2b04f3, 0xbaf2c654, 0xec68b72b, -0x8263d3df, 0x0b966353, 0xb17705af, 0x8fd00039, -0x07d902ca, 0x549f5f45, 0x5c24205a, 0x6de03765, -0x00000000, 0x00900000, 0xffffffff, 0xffffffff, +0x61983d2b, 0x8336a810, 0x68affbbb, 0xe8550e48, +0x5b217cba, 0xd637df40, 0x42a30eed, 0xbe778904, +0x29b4b923, 0xb6dbf77b, 0x732ea3f1, 0xf8ea2015, +0xb8000881, 0x6e1b1c10, 0xd88ebfff, 0xd08ec08e, +0xe88ee08e, 0xc35d5e5f, 0xb837c035, 0xddfbc435, +0x3d057e7c, 0x58cc1dc8, 0x250bd0a3, 0xfeeb05d4, +0xbb59b85e, 0x0300e968, 0x68535f1d, 0xe4514328, +0x3dddddfb, 0x890bb1e8, 0x8d23aca5, 0xa52fa0a5, +0x4bbd296c, 0xcf61ae6f, 0x00768de4, 0x8fbcfc81, +0xba6bdd0a, 0x0c6020a8, 0x341b22ed, 0xbd8c8c02, +0x072db7dd, 0x8bd0ff17, 0x1d8b8b7e, 0x8b8c8e79, +0xa18b158b, 0x14685dbc, 0xe2ff04de, 0xd6da4c8b, +0x7e518968, 0x02bff8dc, 0x61890459, 0x0c698908, +0x79607189, 0xc3006f14, 0xe685edb6, 0x08431f1b, +0x5a374a8b, 0xfa7b6209, 0x6a08dff5, 0x10728b0c, +0x1c147a8b, 0x89ffb805, 0x4ace1643, 0xa29c285b, +0x0c5401be, 0xc5b325c2, 0xbb188dce, 0x8c1f30b8, +0xa24b43f7, 0x9d5d5821, 0xe172282e, 0x07353de1, +0x8150802b, 0x86910038, 0x85890387, 0x956ffa82, +0xc90d88eb, 0x4f290768, 0x5e530c28, 0x50f7346a, +0x1d9da953, 0x0243892c, 0xea5f6f97, 0x101f0a03, +0x02044388, 0x0763880c, 0xb6fe5b0f, 0xc358edc6, +0x53560090, 0xab1525c6, 0x4d046cb8, 0x65effecf, +0xb0d629c6, 0x29c38970, 0x01006ad3, 0x2d32e8b8, +0xbb7f08e3, 0x685004e4, 0x09e5e805, 0xc23b806e, +0x7adede17, 0x7703c60d, 0x109f8005, 0x131800b0, +0x5cdb0306, 0x230b6206, 0x8114570a, 0xad6f4db1, +0x10047918, 0x160d026a, 0xcf360650, 0x501cf7c8, +0xe851efb8, 0xc28993e8, 0xe08dbfc7, 0x23f66653, +0x0374010a, 0xb8c6b60f, 0x3d836d8b, 0x038849a3, +0x7b459212, 0x1ee59e46, 0x4defeffc, 0xd93ba497, +0xbb782c1b, 0xfc230304, 0x67992d91, 0xc03229fc, +0xf6bdac26, 0x262b0cce, 0xc8269405, 0x31c2f816, +0x01f08306, 0x642f01b9, 0x15e7919f, 0x08d20c0c, +0x64cf2356, 0x1729afb3, 0xde191515, 0x26a83c96, +0x16c76634, 0x6e11632d, 0x170a6ac7, 0x182422d8, +0x33f233cc, 0x1c741717, 0x34b7f5cc, 0x33351817, +0x7d88000e, 0xb1bbd236, 0xd06a3da1, 0x6630eb39, +0xcb68e783, 0x75578377, 0x11160719, 0x5ff7c817, +0xc112cadf, 0x104306e2, 0x0febc201, 0xc7e11610, +0x891432ef, 0x5755a1d0, 0x95bb3c1e, 0xdef8dfbd, +0x513b07a9, 0xb87d7d54, 0x17496c46, 0xea71ebe9, +0x1e9081bd, 0xbf06b6fe, 0x66502406, 0xe8226804, +0x3f0807b3, 0x81c0c6d8, 0x740e127b, 0xf2ade707, +0x39ebf7b0, 0x2b0d7cf6, 0xddfbc88b, 0x457cadb7, +0xfc1a378d, 0xf31305b9, 0xc58343a5, 0xed8d7114, +0x850b1fb3, 0xbc9d74db, 0x4cd88996, 0x0d86613c, +0x5a5fad62, 0xda1bfe9f, 0x1be05e97, 0xfe84e8b2, +0xe0a3feff, 0xa0e8862d, 0x76e7f7e6, 0x09e4a30a, +0xec682095, 0xdeff2e13, 0xe89ffdf7, 0xc08510c4, +0x05c77375, 0x05db020c, 0x6085bf20, 0xf005e5c7, +0x49050809, 0x36e7e0c1, 0xa30aeef7, 0x899907f4, +0x1f06f815, 0x2d2105fc, 0x09b77dd2, 0x10072e00, +0x1e000409, 0xa1d83bf6, 0x2e0831e4, 0x542e0c2a, +0xbdbb2e10, 0xbf34ce11, 0x60773d28, 0xe9055d86, +0x89a9835e, 0x18145aa0, 0xa045080b, 0x180ca419, +0x977b6b1c, 0xb9358d88, 0x01174079, 0xf0d8a60c, +0x870f1eed, 0xb981050a, 0x7730ffbd, 0x7df08d4f, +0x0a064a58, 0xba12992b, 0xfd8e91af, 0xa4b7eb7d, +0x993b0877, 0x8b0676c8, 0xb181c707, 0xf3c5cd61, +0x30f3092e, 0xb1b164e4, 0x36191e29, 0xde00a267, +0xff9dd367, 0x8b920f09, 0x22918b81, 0xdec73868, +0x03d68972, 0xcbb11338, 0xf06f0210, 0x39142d1b, +0x776a72d6, 0x6476c3d8, 0xd8fd8e37, 0x390c112d, +0x722c772f, 0x773f3908, 0xdb1b3b22, 0x1c19db9d, +0x4f1b0f2b, 0x39194b81, 0x9189f3ec, 0x892128eb, +0x108ec189, 0x815ec719, 0xb63809f8, 0x8347ed08, +0xa15d71c1, 0xbb1201cc, 0x267370ee, 0xd813b8c3, +0xee33052b, 0x9f61d342, 0x90850c7a, 0x0ac6329f, +0x4a75db23, 0xa60a8c08, 0xfc607c08, 0x0cca3fc1, +0x7d9c35ff, 0x2e000072, 0xdddd91ec, 0xcf681412, +0x62a51391, 0x5203feeb, 0x6f6df607, 0xfd2835a3, +0x35590c6e, 0x20fd8639, 0x8ca12c74, 0x988f809f, +0x5a9815fb, 0x3ae81bf1, 0x1c0f7837, 0x446a2cdf, +0x0168d557, 0x10e9ff73, 0xc361ff05, 0xe80aebc1, +0xe9c81ee7, 0xaa08a17d, 0x3172189d, 0x63af14ba, +0x1659a171, 0x2ea118a7, 0xed8ce8c2, 0xc13ae96f, +0xfa890ae7, 0xcbceb809, 0x6c5b4e05, 0x55d78923, +0xf4a0dbaa, 0x1e433b4c, 0x144ce88b, 0xc9b726ee, +0xe81c73bd, 0xa7460b85, 0x066206fc, 0x18f6183b, +0x8856c35b, 0x26661447, 0x6b77f7a1, 0x96e2811c, +0x061a8c8d, 0xf85d326e, 0xf2893381, 0xa4227423, +0x17ff02fd, 0x74c98504, 0x2102c714, 0xfb455246, +0xc281044a, 0xc180bd00, 0x49669fdf, 0x24e8ec75, +0xae711b00, 0x758cd864, 0xadc5e898, 0xeb1678a0, +0x1c1f6d3d, 0x77d4bed5, 0xd86ffd74, 0x29f1897e, +0xbb01c2d1, 0xd729c789, 0x80398166, 0x50bd7402, +0x3f4f6dfb, 0x98187564, 0x044703e0, 0xa97be6c3, +0x4fb71d6d, 0xebd8e604, 0xa47dfbc5, 0x43c1b363, +0xc358828d, 0xc600e381, 0x68db1e11, 0xde0d0d8b, +0x2955ce29, 0x637b1ad0, 0xc8397ffb, 0xd8392977, +0xfb812577, 0x1d9c0a13, 0xd219c889, 0x274342c3, +0x1d48ae56, 0x6625211d, 0x04353843, 0x4440ccab, +0xf412a16c, 0xd856e13b, 0x4a9b03df, 0x34053b52, +0x71393277, 0xec1b16dd, 0xff522a75, 0xfaf05745, +0x0fc612c7, 0xc76705a3, 0x0b000405, 0x0e0e2708, +0xc8c8a84f, 0x8d8c6e5d, 0x245d8454, 0x1b8ca3d7, +0x2e701619, 0xed885cef, 0xdbb61ecf, 0x88a1981c, +0x4001b81e, 0x5ad85b08, 0xb8c50476, 0x8c423a01, +0xf66f1bb1, 0xa12d4c4b, 0xc8368b7e, 0x5c52efc3, +0xbf4ae981, 0x78357854, 0xfdf53258, 0x79aaf529, +0x6786f289, 0x3347751f, 0xb80bf781, 0xfb0f2d00, +0x3374e3f4, 0x9b31d4f8, 0x340ca113, 0xd7735b76, +0x9d0318e4, 0xb7bef301, 0x9b368cc1, 0xbe66025d, +0x811be507, 0x0189bf60, 0xbacba900, 0xc28c5ea2, +0x9e567401, 0x15d888e5, 0xe798ad6e, 0xee480242, +0xbfe90112, 0xc8e5b6b3, 0x75b005d6, 0x0054b82e, +0xafdfbf12, 0x8112810d, 0x928bc1ea, 0x1c1089af, +0x6866b1be, 0xd0aa01db, 0x2141b04f, 0x4eb5d718, +0xd6a4eb20, 0x5a2457d5, 0x3dcd1928, 0x2dd3dbdf, +0x8d1177fe, 0x2b901a04, 0x1d89a815, 0x18376a08, +0x2523ebd6, 0x22fbc033, 0x4041d6b1, 0x3a08ffd0, +0x6c369428, 0xdd29c5ff, 0x7f83ee89, 0x9c15be0c, +0xcd5577ff, 0x740a85d1, 0xd86139c4, 0x11cf770b, +0xbfb18d0e, 0x564c8f01, 0xe19a1de8, 0x121b7307, +0x5e8dc601, 0x7633f0f4, 0x39db6c6e, 0x35031937, +0xc31f1004, 0xf917fb02, 0x01c132fc, 0x8d1260ea, +0x56e00654, 0xac5e0150, 0x018b818b, 0xcfecc2b0, +0x890603e8, 0xd90612e8, 0xdb09edac, 0x7ff30814, +0x2508a010, 0x52a3605d, 0x5942db34, 0xdc111447, +0x1c05b76c, 0x290c4730, 0xceb09174, 0x0d666df1, +0x03dc0399, 0x6a5f7508, 0x014cff13, 0xfce18303, +0x715504e2, 0x5154cc29, 0x1b0236d3, 0x0c6cabc3, +0x9324f57e, 0xd0777170, 0x89062ce8, 0xa1e75dec, +0x8652f53b, 0x9c106140, 0x37089424, 0x61dc0d8c, +0xec073354, 0xbc36ec40, 0x36f76035, 0x8d487458, +0x8878898f, 0x77a5f16c, 0x18c283d6, 0xba960600, +0x30b0be16, 0xc2b42c76, 0x7c4800c7, 0x7964b6db, +0xc6d3c07c, 0x1602fec1, 0xfb05bdb8, 0x107df139, +0x108c551b, 0xf07c0f41, 0x6dd6e8f0, 0x5f535267, +0x12499814, 0x1b062fd2, 0x2e6324cc, 0x1f17264f, +0xa143c58d, 0xd8b8aa10, 0x5f81ed2d, 0x0566d084, +0xc41601e8, 0xbc783b8d, 0x40c44b6e, 0x85ce2d46, +0x6241d2d2, 0x061074c3, 0x399402c5, 0x3a11d6d0, +0xbf498452, 0xc7068ba3, 0x04b05b72, 0x0f084a21, +0xa45f35e3, 0xb40f7b96, 0x008b150d, 0x652c9cd8, +0x0abec3f8, 0xb974a7d1, 0x493e8da3, 0x73d93982, +0x1904fe0b, 0x7f6f1837, 0xda3942c1, 0xc10af572, +0x1cb45e5b, 0xe1bbe086, 0xc08c3046, 0x0a749829, +0xdde907a1, 0xe599b831, 0xb6207599, 0x21be1325, +0x86b822de, 0x6ac280fa, 0x840f1bf1, 0x217fd8a6, +0x64a923e6, 0xe7830f02, 0x89c729f0, 0xc3019644, +0x80b920b1, 0x0205326c, 0x12bfef0d, 0x8d60738d, +0x18a61183, 0xdbefec6e, 0x8eef81f0, 0x05c781a5, +0x9605042d, 0x1fb91b04, 0xe7146eb3, 0x18830ad0, +0xfb750701, 0x2d12b783, 0x6c8d32e4, 0xf0e56805, +0x828d4786, 0x1c28e4a3, 0xfafdb1b9, 0xea68046a, +0x5e21ad91, 0x58acc605, 0x5d0ce9c6, 0x1807075d, +0x08050e43, 0x19184467, 0xac300c0e, 0xcfb16e05, +0x12e29c78, 0x0abd2b66, 0x106d107b, 0x1625eb1b, +0x9405142b, 0xb6edd7ff, 0x531805d2, 0x071d571c, +0x16fb1e0d, 0x8c690eeb, 0x03281f9f, 0xd6070f20, +0x2adba775, 0xbca12202, 0x26032e13, 0x602d806a, +0x0d113053, 0xc9eeae32, 0x057c5466, 0x405c3643, +0x8b6c6fce, 0x8e4243c4, 0x48054607, 0x6c6f9012, +0x054e4a90, 0x7e521250, 0x566dc2d3, 0x01586a05, +0x43283501, 0x2404c705, 0x3d5a192e, 0xdf16c4eb, +0x00ee5d0a, 0x4622fff6, 0xc6020106, 0xfc2c0846, +0xec830c46, 0x149276d9, 0x0e2c0a46, 0xe7124657, +0x0f7583ba, 0x14032046, 0x032246dc, 0x1b191e16, +0x281822eb, 0x1e1c051a, 0x27120000, 0x2462ca6c, +0x502646e6, 0xac07048f, 0xa72a4660, 0x310fe383, +0x0c6fb776, 0x2c6a285e, 0xc9fd37b4, 0x6d8e0946, +0xc7e0c118, 0x1fc18c80, 0x57f01fdf, 0x0f37688f, +0xd25c2be8, 0xc5f6fb6a, 0x6aa51749, 0xf91a152c, +0x833cffff, 0xb3106358, 0x6df57d1c, 0xe80fb5bd, +0x4a1cf6a9, 0x19e3c1db, 0x5830411d, 0x90d3dde0, +0x648a413c, 0x3416de8a, 0x021b3b14, 0xed99ea1b, +0x4b8eb851, 0xf410689c, 0xf0f86cfd, 0xa213847b, +0xeb81d3cb, 0xd368be95, 0xeb7831ff, 0x29f7896d, +0x89078bcf, 0x260b4883, 0x6c7705dd, 0x83ec0a04, +0x83250c4e, 0x1b60064c, 0x156e9f74, 0xc1180a94, +0xd05719ea, 0x6c691435, 0xd04e7606, 0x1f6c201b, +0xbad07f2f, 0x20d0eea9, 0xac160e06, 0x81013065, +0x9effb34e, 0x527407b2, 0xba3f74af, 0x98152b98, +0xb1dfee9c, 0x8b5f1860, 0x02899c80, 0x85c8cee8, +0x42628684, 0x70771476, 0x68828ce1, 0xe86a188e, +0xd162bd8b, 0x2a10748d, 0x84237823, 0x05af4686, +0xc75cb734, 0x830723e7, 0xa6eb7345, 0xc592bfe8, +0x57bcf667, 0x8d147a85, 0x57331660, 0xf11bed9f, +0x3a5f4686, 0xc1896032, 0x024b0c00, 0xa93ee083, +0xd30dc06d, 0x3979f201, 0x6ce28306, 0x12ec0871, +0x086a0453, 0x7bf84d85, 0x46350740, 0x9ae805a2, +0x77b9ddf9, 0x206bda74, 0xb327fee8, 0x5e5b1409, +0x9cb5d023, 0xec208b6d, 0xdc81dd24, 0x38806f1d, +0x8b1f76a8, 0x428b4d02, 0x81806904, 0x0762d6d8, +0x42407208, 0xfea0dfb4, 0x1beb06a0, 0x8f14138b, +0xc0d8b50c, 0x06408243, 0x46c19331, 0x365fd6ed, +0x1315c109, 0xb1ea49c8, 0xd144ff68, 0x278bd001, +0x50b60dc1, 0x1e25c60e, 0x5324946c, 0x7c7026f7, +0xd46818bf, 0xa8bb9e96, 0x69b8e6ea, 0xe8b55ee8, +0x79775159, 0xd91c970c, 0x56ff7b1c, 0x77000a0b, +0x7e921027, 0x8dd72304, 0xbeb7be17, 0xded6f726, +0x9f8314ea, 0x900a7702, 0xa0853493, 0xbae0fc72, +0x75f87bd1, 0x8d6f9f17, 0x5add247b, 0x247e09e4, +0x75161c00, 0xb6e0b01c, 0x1c1b6d1e, 0xb6144275, +0x7ee17743, 0x310775e9, 0x02219f02, 0x43c91a91, +0xe62e50fa, 0x066db99a, 0x76010f48, 0x850f0069, +0x5086a498, 0xb4834c5f, 0x86fd180a, 0xff53e00f, +0x0003c713, 0x8f5e1824, 0xa7be2791, 0x81913a5d, +0x2e7a305f, 0xd00915e2, 0xbb84da0b, 0x6fb9e1bb, +0x319fb015, 0x41ef10c2, 0xbd8b2ea5, 0x72dbe839, +0x5ced173f, 0xe1f0f8cf, 0x5613794e, 0x7b293468, +0xa9075255, 0x04d85a93, 0x63c97428, 0xe4a632c3, +0x696d615b, 0xe4237108, 0x115c4819, 0x127cb08d, +0x7c8b1835, 0x961d1fbd, 0x418f81be, 0x02b80ec3, +0x66da89a5, 0x124c6aef, 0xed82183f, 0x0f03b85e, +0xfde86ace, 0xe16fdd71, 0x06a05262, 0xbef8d3f9, +0xeda81f06, 0x9f0bb1bd, 0xf038be05, 0xc83d9c2a, +0xd4dfd81d, 0xc8830f71, 0x14bf3d01, 0x58916c68, +0x16ee2d29, 0xd8b07bed, 0xe0b6b6df, 0xc509cd20, +0x7aad794f, 0x1ac1423d, 0x052896ee, 0xc868847b, +0x10fdac30, 0x955dacae, 0xfa85bbdd, 0x041d7401, +0xc3f30672, 0x870936d8, 0x020835b8, 0xc20cc333, +0x804f612c, 0xfd0f02cc, 0x2dabddf9, 0x8a152cd8, +0x06f6a625, 0x0345d1b1, 0x0cfd2c81, 0xf74b96ff, +0x8db98b6e, 0xff28ec06, 0x12155c70, 0xd2b41a80, +0xdf861023, 0xb00d3f64, 0x25b7067b, 0x0567a020, +0x400c0822, 0x082fdcdb, 0x24a31655, 0x212c1804, +0xfb67b80b, 0x14022080, 0x48042830, 0xb703e214, +0x1c0ca3bd, 0x03a90534, 0xef08f830, 0x381589c1, +0xa32cfca0, 0x4b80a03c, 0x5f58b278, 0xb0ef04bc, +0x1a130bef, 0xb7ee02c2, 0x2dec2bf5, 0x84adfee4, +0x83412ccc, 0xf57e64f9, 0xf1f0210c, 0x10ff4d8e, +0xf9814109, 0xf27e9110, 0x6856515e, 0xc0dabf84, +0x52f61af8, 0x9adeff3b, 0x4ec4122e, 0x6fc71876, +0x59e277a1, 0x09f73acb, 0x0812c1e8, 0x7b8f2cec, +0x04364572, 0x04b07481, 0xc02085cf, 0x8300ba01, +0x2d993b4f, 0x584080c2, 0x12b44807, 0xa1077788, +0x4e806b4c, 0x4205f808, 0xbd915e05, 0x0301a961, +0xec87d07e, 0xee0b4b51, 0x3fa04d84, 0x09764096, +0x083c2436, 0x401084c2, 0x60aa017a, 0xe5020327, +0x4b3c2454, 0x226d6218, 0xb87339b8, 0x00822bdb, +0xcd0f67ca, 0x07b2d2b1, 0xd08e2ace, 0xeedd603b, +0xb13fff25, 0x50936442, 0x1b50051d, 0xbf89d9de, +0x6072ff50, 0x4f540de8, 0x24625219, 0x1b10dd3c, +0x24c04208, 0x1e9760b0, 0xe02d428d, 0x8a309c03, +0x00706ab5, 0x522e8542, 0x917841b1, 0xefdc380e, +0x4a5078b0, 0xec25ebc2, 0x7805c5a4, 0x0c3d1601, +0xc48524b9, 0x180222a2, 0x35a2106a, 0x4c2610e1, +0x081bb14c, 0x07fa4a28, 0x6a0c026c, 0x6dc8e814, +0x40a10000, 0x60592e1d, 0x941c510a, 0x57829a2b, +0xb0f45496, 0x19ecc1a1, 0x8b3b2d64, 0xbbc53005, +0x8a10c63d, 0x3436a3fc, 0x581d6db0, 0x93b46833, +0xf18a0f47, 0xe1283bd0, 0x41881cec, 0x7b1b476c, +0x257f01a9, 0x9415e806, 0x0ffe00d8, 0xef15b7e4, +0x75073daf, 0x4286bd0f, 0xe2b02008, 0x0debfd87, +0x0e0040bd, 0x00bb0180, 0x8106b68c, 0x7deb397e, +0x1bbebe32, 0xc3f80bc6, 0xc63601ea, 0x0ffb833f, +0xbdb8057f, 0x5c649bf8, 0x43d70110, 0x31c8c681, +0x7625d37c, 0x5f998451, 0x6db45c50, 0x370b0bd0, +0xd103741f, 0x5f443bf8, 0xed6f56e0, 0xb7e183d9, +0x883103e1, 0x50431a04, 0x3f6f0780, 0x7bd77e05, +0x4fa4e23c, 0x685ce0bc, 0x4f642837, 0x53608178, +0xbac1d8b5, 0xc7b746bc, 0x58fb3091, 0x49a2bcc7, +0xd802661a, 0xceb3a71f, 0x1f6c68e8, 0x37090a48, +0x7206b8af, 0x565a1624, 0x724ec7af, 0xc0099f17, +0x401690ba, 0x1197eb91, 0xde6264b3, 0xa640c281, +0x1923200e, 0x63f2c123, 0x89fbab1d, 0x43074490, +0x23c2811d, 0x0d8106fb, 0x40a3bb2c, 0x9642acb2, +0x08fb37fd, 0xa359cfc0, 0x0000b244, 0x8d915e0e, +0x85def590, 0x2760044d, 0x60b0a310, 0x8307065d, +0x018527c9, 0x183c9700, 0xe0d24b3c, 0x28ba8c9c, +0x0c77c6a0, 0xa74c4156, 0x048a5c41, 0x5a349118, +0xbeed1e32, 0xe9c56aff, 0x5e4ba5ed, 0x04f53fe0, +0x0a040574, 0x5d084f75, 0x17ea1ada, 0x1f162806, +0xc4f7510a, 0x14037a13, 0x0422cb81, 0xaca43d2c, +0xa07fbbdd, 0x01cf8003, 0x14685329, 0x4c929498, +0x0ea65321, 0xaa38536c, 0xb4377459, 0x74f6f70b, +0xe020be37, 0xc0199820, 0xf16353f7, 0x8159d0a5, +0x342000e2, 0xb93794e0, 0xce4bb7ec, 0x006a5201, +0x89da6f3a, 0xe25dbb65, 0x084002ce, 0x70e39ce0, +0x1ab100c8, 0x6e9317e4, 0xd3deedf7, 0x08c4050a, +0xac12e9a2, 0x09eca29e, 0xc3fabedb, 0xc061a8a0, +0xdaeda280, 0x7e0258f8, 0x16f3bd9d, 0xf7a24911, +0x5be0117c, 0x02bec1b0, 0xfba240e8, 0x0a140126, +0x2145e1c0, 0xfda20df1, 0x4b599c9c, 0x21e4a755, +0x68339331, 0x12f3682d, 0x0197261e, 0xbff5b923, +0x12b0991f, 0x04a810a6, 0x4a502375, 0x83c5de92, +0x734af836, 0x3ce85ceb, 0x946c77fa, 0x2829cc04, +0x01c75016, 0xd67f4def, 0xc7c81ed4, 0x1dd14840, +0x884c406b, 0x3518061b, 0x4050cc81, 0xe0256b46, +0xd817ab54, 0x5ddb052e, 0x72143875, 0x30be0f18, +0x86ff689e, 0x0505c3b7, 0x48b8d1bd, 0x816f4869, +0x46f605fa, 0x5a1feb3c, 0x32067707, 0x0d2feb0c, +0x80bb06b3, 0x6d187472, 0xec1b3d2e, 0x57563b1f, +0x2c8c3de8, 0xedf3040e, 0xc08c688d, 0xb64490eb, +0xd80350c1, 0xc581774d, 0xc6939817, 0xffffb831, +0xa9da291e, 0xd57688d8, 0x94008100, 0x833a5dda, +0x7005f0e4, 0xd017606b, 0x73523d7b, 0x0a40a90b, +0x1c036df0, 0x75f1f572, 0xe808020c, 0xf824699c, +0xc35c98dc, 0x682202c8, 0x75cf6ea5, 0x075040c4, +0x984c7016, 0x61ac7bb7, 0xa1e82b25, 0x1a620c66, +0x9776a104, 0xa2f2e668, 0x1e04e48b, 0x80ec2205, +0xc468f54d, 0x40e0c855, 0x36fbb85c, 0x7e911208, +0x20135bff, 0x912b01a1, 0x79751233, 0xfbb75f50, +0x296035ff, 0xa1892ee8, 0x5b88c909, 0x3e308bc0, +0x39fe7495, 0x38ebdd7b, 0x68b518a3, 0xd6836435, +0x84909854, 0x2e648277, 0x36c87bf4, 0x3d64766b, +0x58741248, 0xbfef0b78, 0x83547e6d, 0x4f7f02fe, +0x14c610a1, 0x89f7701d, 0x400c9ed7, 0xff084ca1, +0xc02a0450, 0x233708b1, 0xc6917883, 0xd4942352, +0x16defe5b, 0x92f76350, 0xead468e9, 0x32cc688e, +0xa0331879, 0x3689773a, 0x02469853, 0xdb1a5c0b, +0xd39adec6, 0x8f0f0339, 0x19fd1059, 0xecf50872, +0x81e9b632, 0x0094040d, 0x9f8a8c08, 0x9d4d7b6f, +0x4814a1fe, 0x503d5e22, 0x1ff0d04d, 0xe81b742f, +0xd10a19ac, 0x2ff61207, 0x05731f62, 0xe8129217, +0xb3b003bb, 0xbb209708, 0x0cf4fedc, 0xd35fbddd, +0x50f91c71, 0xc95805d9, 0x0004be00, 0xec426d90, +0x0c6dff0e, 0xcebbba44, 0x30090541, 0x0210e9c2, +0xfac16566, 0x8455cc2c, 0xd11cac50, 0x638e10af, +0x33850f3b, 0x77c35708, 0x8941d889, 0xa102c506, +0xe57fd340, 0x0f45da16, 0x4807e20e, 0xfb5f0f54, +0x03901d6b, 0x7e022236, 0x0313640a, 0x08bc2dac, +0x16981285, 0x0b161208, 0x0d757676, 0x15c219b5, +0x9e08cd31, 0x8cf817d5, 0xd7704a16, 0xe91ad86b, +0x1ea12371, 0x20908dcd, 0xcd0e8d7c, 0x62ab6a08, +0xf621a30b, 0xd0cc2080, 0xc20cba82, 0x50891c27, +0x1c5889c2, 0x6fbf20ee, 0x0c3e2308, 0x99be0dfc, +0x208c11e9, 0x4f01843c, 0x15421b2e, 0xf8c2384b, +0x14241c89, 0x423b5514, 0xe96408ec, 0x745ce3cc, +0xd847ec33, 0x302a0ec6, 0x763b7a8b, 0xb05f1a74, +0xb0194f4f, 0x38467db3, 0x8c4390e0, 0x02457cf7, +0x896e0986, 0xbd8310fe, 0xa208803c, 0x01be6978, +0xfb23b35d, 0x0c1e62c4, 0x84471e34, 0x3608e337, +0xdf0440eb, 0xd3e4b083, 0xffbd7d05, 0x843b1d45, +0x097f7983, 0x894105b4, 0xa31a6ef0, 0x108dda49, +0xeaa1205a, 0x0a6035b6, 0x0c890e61, 0x91db5408, +0x3078f188, 0x80466301, 0xf512dc3e, 0x046ff6dd, +0x430d743a, 0x0b1e3c80, 0x753a0506, 0x6df8bff3, +0x273216e4, 0x7ce000c9, 0x3c0ca5d8, 0xff530012, +0x670d7037, 0x63c460b7, 0xc7827748, 0xb9722408, +0xdff65c9f, 0x3100b2e9, 0x68036aa6, 0x618db5cb, +0x1e461b5b, 0x92352d34, 0xbf472267, 0x03d8a588, +0x4f06f4b5, 0x850dfae4, 0x742f3880, 0x52df1d47, +0xc3401ce7, 0x01e4cfe8, 0x7634031e, 0x1d35bbdf, +0x29402092, 0x10240a54, 0x0cf50950, 0x15318ac7, +0x0730cff6, 0x46bb03de, 0xa3f82d75, 0xbf827ef2, +0xcf68c3e2, 0x5644c836, 0xd03bf668, 0x9bc6dc3d, +0x04573e40, 0x56502574, 0xafdf203e, 0xdb682d90, +0xe8569e29, 0xa4f81f20, 0x104b2138, 0x1a13e8df, +0x7a4957f5, 0x3f976497, 0x08fe6a14, 0xd09e1512, +0xd055dbb2, 0x2d0d102f, 0x7f347b9a, 0x343d8038, +0xc58c60d6, 0x0825295d, 0x6b8775b8, 0x3d461258, +0xb6f9860f, 0x52f7ef5a, 0xc7810bee, 0xbdbc8605, +0x2b349dd1, 0x218bc64a, 0x97466bf6, 0x8a0c106b, +0xfdd4129a, 0x0f46c586, 0x7926bf07, 0x3aa5e95c, +0xe0900c16, 0x54808db4, 0xb9bafc64, 0xb0dc52ad, +0xac35ef1a, 0xfbda461d, 0xf75ee06c, 0xaf7410e0, +0xeda63f43, 0xa55916c0, 0xd4bb7473, 0xec1422c7, +0x08db85ff, 0xdad8d90a, 0x7ef6c7b3, 0x5868040d, +0x50baa84a, 0x88310877, 0xb0014e47, 0xc5608a27, +0xb8bccb25, 0x962961e3, 0x855ad946, 0xe84acc5c, +0x546f18df, 0x0c428b70, 0x8ad90d8b, 0x6885de2d, +0xa2034209, 0x15ed4dd8, 0x2075b776, 0xeb09c81d, +0x90113248, 0x4b4f6d8c, 0x4402b8b8, 0x2f18a33d, +0x9f0420dc, 0x95187502, 0xf7b01b2b, 0x10b90ed9, +0xa10e2000, 0xb0307cb4, 0xa1efd98d, 0x43b4a304, +0xfe72b815, 0x6f58a85a, 0x0fff248b, 0x14b5f025, +0xc13b1bfb, 0x148d02f8, 0x03bb0190, 0x93e10f24, +0x830f02bd, 0xd9d9d6ec, 0x848affff, 0x1bfbfb75, +0x04a01a0c, 0x3a74ed85, 0x39141d8b, 0xa5e776f3, +0xf36c4560, 0xb12d836b, 0x578da6b1, 0x29ad14f3, +0x31d70121, 0x29f5f018, 0x36df01de, 0x89ba7f1d, +0x44988c5a, 0x87a0341c, 0x28a2bc42, 0x1e2442fb, +0x07755274, 0x9ec2e730, 0x0a5409d0, 0x361092df, +0x7d3d2300, 0x1cb8300c, 0x0daf4d2d, 0x058181de, +0x2353e4df, 0x3c8ae851, 0x9bb31420, 0xb380905f, +0x504cad18, 0x382110a6, 0xf8614bf0, 0x18c7080b, +0x1bfff3b2, 0x7eda4193, 0x018c1c3c, 0x3c02d8d6, +0xa7217495, 0xd027815d, 0x720c1939, 0xc6284f15, +0x730b67ab, 0xd9b7a109, 0x63440082, 0x2e3c1491, +0x0e11c817, 0xdf5c03fd, 0x0d018603, 0xc7281f97, +0x0bbf00a5, 0x461a16bc, 0x1baa73fb, 0x025d8dbd, +0xfb53b557, 0x348d2e12, 0x03307897, 0x302c0bfa, +0x85879839, 0x0febd2d3, 0x75083b35, 0xeaab0e76, +0x8cdd6ab8, 0xcacc332d, 0x722f5fc8, 0x28d0bbb4, +0x042674ce, 0x1df80777, 0xa5376ff4, 0x03064beb, +0x44eb2874, 0x8068148b, 0xd6e07d81, 0x75a9307c, +0x31eb0f37, 0xd9bd4b12, 0xeb0424cd, 0x0fc3b11e, +0x051dbf06, 0xd3a366de, 0xa3205456, 0xcdeb89e7, +0x84761eed, 0x7c2c5682, 0x061f74b9, 0x8039cec8, +0x511e0646, 0xf4482103, 0xf26810eb, 0x6a40514c, +0x820ac1e0, 0x6d181a15, 0x07752774, 0x5424e310, +0x34c558ff, 0x0b5f7772, 0x050b0b34, 0xdf6d0530, +0x5a35d558, 0x3e107534, 0xb1721a15, 0x28f63909, +0x1e390877, 0x14291e72, 0xb1c4efba, 0x88e92419, +0x1e010f78, 0x59d82dc7, 0x343919c4, 0x9b0d7309, +0xc9388461, 0x5c439155, 0xc52e1dcd, 0xd8107a36, +0x20c2078b, 0x1eea68bd, 0x3869cb43, 0xfb181840, +0x409a1b1e, 0x291ecd42, 0x15bb012a, 0x81d2658b, +0x010da850, 0xb803a367, 0x8d00d1d8, 0x889ec39a, +0x3ab90cb4, 0x9ab18b25, 0x8b1b770e, 0x15132528, +0x548a522c, 0x89af167b, 0x40292dfc, 0xe00a20be, +0x0296db7f, 0x3d30084a, 0x8e8b4174, 0x3b6fb924, +0x55fd1057, 0xb1d3392f, 0x6f392972, 0xc1e107bd, +0x74442572, 0x1707a116, 0x1b968b05, 0x2c7efec4, +0x7305903b, 0x611e8906, 0x7e125fc6, 0xc51020a9, +0xa27ff839, 0xec8b6b74, 0x35b19775, 0x2c86e634, +0x6cdda32e, 0x0d807eb4, 0x19c129b1, 0xed9cc3d3, +0xb3593ad0, 0x6d303a55, 0x3d221a00, 0x82363997, +0xbacec721, 0x3458e832, 0xf02d3546, 0x23fbf325, +0xa81500bc, 0xd311c101, 0x11540d01, 0x59f8011d, +0x0f1ab384, 0x8e09d0ac, 0x9dac1b16, 0x2901ff2f, +0xe21e40a3, 0x7223a1a1, 0xe8265038, 0xca6b3af8, +0xeb2df1f5, 0x75080af2, 0xa9416c46, 0x3404de20, +0x9e0246e0, 0x390b6306, 0x87dc2b08, 0x2869e196, +0x49e86732, 0xfa876e19, 0x3dc09702, 0xf47ee830, +0x2bc5b7ee, 0x8928150c, 0x688d2ad0, 0x958ebf34, +0xfa5e583a, 0x83d69300, 0xf88101bb, 0x8b37a713, +0x10b92c83, 0xdc0a5b09, 0x090e34b3, 0xb82c580a, +0xe855ec77, 0xab035726, 0xc394491e, 0xcc437a74, +0x66b1988d, 0x9e6e3539, 0xaba0276b, 0x0f1a2f72, +0xdafc184e, 0xff9394a5, 0xd4416e3c, 0x8444d18d, +0xdef60870, 0x1178b1fc, 0x0040e3db, 0x21231f22, +0xf8d08af0, 0x6ea65ffa, 0x284951ae, 0x1a4bfc1e, +0x8da09c5b, 0xe316aa93, 0xdfc558e0, 0x50503304, +0x80d0e853, 0x0301c085, 0xce0ac271, 0x35e647d3, +0x5626e4bc, 0x2ae81663, 0x4635023f, 0x47e1c2db, +0xc0189b1b, 0x7eae9957, 0x985d778d, 0x0fe879ad, +0x7459d6f0, 0x4fd5a3aa, 0x781820c8, 0x07f26a90, +0x5ab86ae8, 0xea0bd2a8, 0x33fc428d, 0xe93905ee, +0xc842b40e, 0x4751047c, 0x388181a0, 0x8d6818c2, +0x0bddd820, 0x3be34c94, 0xea0a7d00, 0x6c56e136, +0x181bf74e, 0x70d15b96, 0x82f190d6, 0x60480c2c, +0xa1da31be, 0x11d77644, 0x0582a53d, 0xe946483c, +0x8b570178, 0xe18f4a97, 0x73486a45, 0x6f015030, +0x3b1c415d, 0x24764036, 0xd04ceb43, 0x037e5207, +0x439a9b58, 0x64d97a18, 0x4fe92040, 0x576bb8a1, +0x0d3b4870, 0x6634763f, 0xcf1d3b40, 0x402ba194, +0x0a02d873, 0x6be0dbe4, 0x60511c05, 0x31243ff8, +0xf70e04c2, 0xa3be361f, 0x5e420749, 0xc50d9092, +0x62c5086f, 0x334c8969, 0x66092b5e, 0x5faa2c45, +0xbf8a1fc4, 0x8b567560, 0x5f97d787, 0x87117fc4, +0x03d389c1, 0x409fd78f, 0xf8bdb174, 0xa1183b0f, +0x265be61c, 0x5613f0c2, 0x04772672, 0x88b0437d, +0x1c01df20, 0x06721277, 0xddea4752, 0x0a7718fd, +0x4608ce99, 0x86174101, 0x77f52db7, 0x1f327499, +0x9ddeec25, 0x48034c01, 0xd4992868, 0x89553a4f, +0x6ca35db7, 0x0339445b, 0x00167648, 0x4408d87a, +0x29beb837, 0x059c18d9, 0x2c992aad, 0x96df032d, +0x596c0608, 0xbaff458d, 0x5d60844d, 0x5fc585e0, +0x119500f0, 0x988c3522, 0xebfe42d9, 0x54266207, +0xf7e8520d, 0x4c500dd8, 0x996ac518, 0x85e11146, +0x098103e5, 0x755bb51a, 0x7c77d629, 0x1b777779, +0x8df860b0, 0x011bb921, 0xf80f07d7, 0x2e2ef106, +0xe9d03947, 0x24348bc7, 0xda82f734, 0x0c730e2d, +0x6c18e909, 0xc2f08f7b, 0x0eee3d3b, 0x2e07153b, +0x22c70f8b, 0x150d59bf, 0x8d0f380c, 0xff86f154, +0x23ff2af6, 0xd7399c54, 0xf8890a72, 0x205ad029, +0x78431573, 0xec4348f6, 0xffff4a1d, 0x7fd089f7, +0x429210d0, 0x89b93014, 0xb04e89ef, 0x5ede84f0, +0xab0833fb, 0xd6749e08, 0x5534112d, 0x811095ec, +0xd1aebb3d, 0x457f0dff, 0x4975464c, 0x52250a35, +0x80ed3d00, 0x0001b42f, 0xa16638b1, 0x02e819f0, +0x3e168c6d, 0x54297770, 0x342077f4, 0x0f14b838, +0x75d03435, 0x61f6bf14, 0x3f570e2d, 0x0a740609, +0x2474fa75, 0x7a39e938, 0x63412168, 0xf99c0438, +0x0b26e946, 0x063c7a57, 0xc315d7e2, 0xd0af060a, +0xa4e3ecb6, 0xf039a45f, 0x2a24607a, 0xaaf0a82c, +0x2b14b8fb, 0x8504e652, 0x6677d81e, 0x4e2c2118, +0x02c42108, 0xc6159810, 0x4b3452e6, 0x182f85c0, +0x073aa771, 0x62e703d1, 0x4ba2c61c, 0x01411829, +0x9f12188c, 0x9e00012e, 0x8f4e2425, 0x7dc177c0, +0x603b4f68, 0x833c0989, 0x9071d2b8, 0x71dee61f, +0x7318fcd2, 0x20058904, 0x82349003, 0x367c3587, +0x13d1f3ca, 0x017dec05, 0x1d316157, 0x8b07763c, +0x0158a340, 0x6a810043, 0xe07dc02e, 0x9c7c0937, +0x04854887, 0x9187d80d, 0x29008053, 0x4de5de37, +0xa2c07a85, 0x980e2bb8, 0x8f437010, 0xf2e851e2, +0x75ffd241, 0xb7e40632, 0x681c587b, 0x36f137b0, +0x724d00ad, 0x99a30966, 0xdb995b1d, 0xb92bc28b, +0x237d10f3, 0x8762cd84, 0xafea01be, 0xd13a3222, +0x14dd7cea, 0xd3b0c561, 0x0f4bd843, 0x4f89e98d, +0x71ff42f8, 0x8375908d, 0x7504407a, 0x8b5052a8, +0x1b0b8788, 0x11594ebc, 0xbd0e77f9, 0xf831601d, +0xdde85751, 0xb97399f4, 0x96c3900c, 0x708c5c63, +0xa32a36f7, 0x62b8b8ec, 0xea170c8d, 0x043c7fdd, +0x488be205, 0x0df90150, 0x40708b04, 0xd5b03f0d, +0xb1146ed6, 0x3b515652, 0x22754d20, 0xf9f6786e, +0xf0cae207, 0xe700c941, 0xec0cc6ce, 0x58edcf3c, +0x14f4171c, 0x097c9db7, 0x8c0fafb9, 0xc7e41774, +0x28ca2805, 0x2c1924d9, 0xf07e7409, 0x3809db20, +0xf02f3eb8, 0x23fd850f, 0x36a01100, 0x36007d81, +0x121b0313, 0x13ba4e3f, 0x44540160, 0x21350ef9, +0x61fac6ee, 0xfffb81ce, 0xbf053ff0, 0x109ab8a0, +0xb93d041c, 0xd8c4672c, 0x10f96967, 0xb2379ba0, +0x980770aa, 0xb1857a62, 0x26a3d001, 0x0a4d8713, +0x91ccbca3, 0xdd0bc246, 0x07e06a83, 0xe1e83d52, +0x07be14f8, 0xfc692c5e, 0xa11cbf56, 0x09802c2f, +0x83e3245b, 0x14009d5c, 0x2c018add, 0xcac3012f, +0x2addfee4, 0x22858d5f, 0x5576d839, 0xf60d91b2, +0x5079dd5c, 0x0607ae57, 0xcc4dfcff, 0x85e83a2e, +0x033be25b, 0x43f6087b, 0x80f0b003, 0x0f25146f, +0x9e7d03b6, 0x7bf93d93, 0x021c8018, 0x868d0a54, +0x8ab7ab77, 0x2f8d8bfd, 0x07eb4d74, 0xbca1c20c, +0x0180df6d, 0x562a6867, 0x064ca8be, 0xac0b26cc, +0x1ee5e8d5, 0x017d920b, 0x874523ba, 0x87b83d12, +0x4faed285, 0x67412765, 0x6333a8c5, 0x57b873c0, +0xccd0858d, 0x24482932, 0x2260070d, 0xc9750a1f, +0x4eb62b0e, 0x8c8e882a, 0x41047d09, 0xcb179088, +0xc020a44f, 0x80a3790d, 0x31ef96b8, 0x506f9859, +0xc96b396e, 0x1ed8ab1b, 0x0109a8b3, 0xb1d94d15, +0x3572f416, 0x2b7261d8, 0xfb1f521b, 0x310d8b79, +0x091933d1, 0x1c5375c1, 0x0d8c4b7c, 0x5b77783b, +0x7b730735, 0x6d5b7a03, 0xd95d071d, 0x8e1fc181, +0x89f61d8d, 0x3a2942c8, 0xe1816419, 0xa7d4afb1, +0xc5d90188, 0x8e3b292d, 0xebef006d, 0x6a20a139, +0xc6295303, 0x1449dbbe, 0xd020d4e7, 0xa3cc15ff, +0xfb160389, 0xf0418920, 0x3dbc10c4, 0x92050f14, +0xe110fe90, 0xb49eac42, 0xcefc245c, 0xa0f373f2, +0x04bd40ad, 0x06c1f60b, 0x181a0860, 0x1f719430, +0xd452fde6, 0x105a2058, 0x6dd7d59d, 0x72e88a37, +0x0bf70edb, 0x476d47c0, 0xcd2e0238, 0x7311d2f7, +0xf6899bdb, 0x86023881, 0x1dd21ac4, 0xbd820a3d, +0xea810627, 0x9fed3407, 0xfb12f40a, 0xe8197567, +0x4c1bc9f4, 0xc86d0dee, 0xbf0f8de4, 0x0306e815, +0xf0affe85, 0xb805491b, 0x1389c755, 0xc10be9f7, +0xc1e1bed6, 0xf8220cfb, 0x8dc3291f, 0x568302be, +0x6c6ed6db, 0x092a07e2, 0xe802a7c3, 0x8db7abed, +0x030f8941, 0x0903ca29, 0x73620d78, 0x18e2d1db, +0x800225db, 0x6ded0a27, 0xc839e181, 0xc2294309, +0xdb1b141d, 0x5855f1be, 0xab050a79, 0xa1697f77, +0x5e1b5004, 0x80fd8bc1, 0x463c1f3d, 0x3c7454ff, +0xf00273e8, 0xcc3be833, 0x9812c6f8, 0x0c741bea, +0x9503abaa, 0xe245fc16, 0x0bf40aeb, 0x92fdba05, +0x3460d108, 0x8fc8ff52, 0x8c952b92, 0x36e12091, +0xb7a9682e, 0xeb58348e, 0x2e74992d, 0x00b80ba9, +0xf2726411, 0x83d06a1d, 0xc5733f51, 0xe81c3230, +0x81a0ffbd, 0x921c723d, 0x7de82ed4, 0x48511c01, +0xacc22a52, 0x1b6d3f4b, 0x1e3980bd, 0x8a28972d, +0x7cdf5711, 0x8a82de37, 0xc238df88, 0x194341ce, +0x07eefb13, 0xe6740ef2, 0x0f08018a, 0x138ac0be, +0x16d08015, 0xdcd2079b, 0xc9c5ce5b, 0x8920edaa, +0x8bab0803, 0x3562155c, 0x3053d660, 0x0550f557, +0x183984d7, 0x56766512, 0x4d027f8f, 0x02ff833c, +0x2216177f, 0xd0fec1fe, 0x3a80d901, 0x201b742e, +0x0908e6c1, 0x6f6847ce, 0x0321de94, 0x2717ac7e, +0x0410c8c1, 0x89e8fd08, 0x29c5026a, 0x464a43e8, +0xadd86c90, 0xbeb5df85, 0xb7920a33, 0x093c30e8, +0x60d01477, 0x92b6858d, 0x42a111b6, 0x12ee1391, +0xec76e88d, 0x890bed05, 0x7e2bffca, 0xc7996244, +0xeb12c349, 0xfd60e402, 0xe4c6c40b, 0x46c0d964, +0x7402a804, 0x177ee809, 0x1acb7082, 0xf6e872bc, +0xc3240180, 0xc235c831, 0xe8173615, 0xfeb613e0, +0xe6d1b0fe, 0x08b1e864, 0x8160e6df, 0x740dd9ff, +0x4b5b7b43, 0x701d89d9, 0xd420fbd7, 0x6f0aa2c7, +0xffe2e80d, 0xb1b38832, 0x4bc02385, 0xb1bb8a18, +0xa86c7007, 0x421a03e8, 0xf8c398d3, 0xfb81df6f, +0xfb837415, 0xb302750d, 0x83d8890a, 0xefee0093, +0x28c7dae8, 0xb2c0950f, 0xf4430c12, 0xa8ee5670, +0x37058d0d, 0x89fb605c, 0xdeeb29fb, 0x81f0f60f, +0x76fff082, 0xd4092a43, 0x7bb6bf05, 0x82778046, +0x910cd7e2, 0x1b1502ba, 0x0cbe63a4, 0x7d418b66, +0xbaddb170, 0x2723478c, 0xa10f5b63, 0xf494f81c, +0x24df503a, 0x11825184, 0x0bafb9b6, 0x83198201, +0x04648809, 0x8016a70f, 0xd0e0f0dd, 0x29168e39, +0x08730776, 0xb32c3843, 0x04f62017, 0x0df74b72, +0x64810afe, 0xfd8a9617, 0xba1debd4, 0x16a9d829, +0xc3d96c0b, 0x1e20cd86, 0x26107248, 0xa956e837, +0xc58950e3, 0x044104bc, 0x83d0b6c3, 0x8fcec9c2, +0x801b7629, 0x98e08c52, 0x354ab459, 0x3308c436, +0x6aaf5557, 0x87c03f01, 0xb72d6789, 0x90e8d9e8, +0x74fe1be2, 0xc377e855, 0xe8241c85, 0x03024d0a, +0x903b5482, 0xf55ec200, 0x752c2bd1, 0x8e00aa4f, +0xdc65301d, 0x7c3d4820, 0x7a07080a, 0x6f1c7e44, +0xab0bd449, 0x3e00ded3, 0x762a0f6c, 0x0cd60cd1, +0x41b1b3c4, 0x0cb76c88, 0x478019f4, 0x07aa8043, +0x019b5ca9, 0xf9f50545, 0xaf85ea07, 0x8a105c11, +0x7614353b, 0xdd075d4c, 0x46130666, 0x6c9c1405, +0x3ba06c0b, 0x2eebd8a8, 0x2910eb07, 0x95d857e8, +0xed14b04e, 0x47720c3d, 0x6c6c6f35, 0x8916eb73, +0x0a0510eb, 0xf417043b, 0x317dc03e, 0x0c4f2b2b, +0xeb0d0405, 0x7c39256e, 0x7b191865, 0xa6db3780, +0xf5297c8b, 0x08b5de18, 0x09784611, 0xa3b5ffff, +0x4709190e, 0x406f82f1, 0xf1623c5e, 0xdaea736b, +0x6051e02b, 0x680b4884, 0xa33c35e2, 0x1845868e, +0xc01c8a76, 0xa1a29e05, 0x83d9c2dc, 0x49bf50ea, +0xf0e2cebc, 0x725280b8, 0xf008ec19, 0x08897b60, +0x0442ae89, 0x5b252810, 0x5d3e3fd6, 0x376d81c9, +0x44c2217c, 0x66244108, 0x3b6c9d87, 0x084c1889, +0x7a6b6810, 0xb7779294, 0x03034727, 0x31b1e947, +0x9a83fc40, 0x2b1668e7, 0x762f4063, 0xc04b39eb, +0x7dad2001, 0xec746d2a, 0x0d037856, 0xfbfc422f, +0xf60c8cf8, 0x01812caf, 0x320d3bd1, 0xaf020d0d, +0xa5908c49, 0x472dfe8a, 0xd431390c, 0xb73c9e21, +0x01808384, 0x1505c8db, 0x5582ebef, 0x03281aa5, +0xd7510453, 0xcc2360c8, 0x05085c20, 0x355f522b, +0x17e548bb, 0x22fb0264, 0xd05b69e8, 0xdda10c26, +0x379a10e6, 0x0b6d042a, 0x3dc23a1a, 0x1e8ebb23, +0x06ffe018, 0xf00cf106, 0x88a9c160, 0x53dd475f, +0x9faae035, 0x9129f32a, 0xe8c7136f, 0x68626c35, +0xa0e012a7, 0x8c40b10d, 0x167480fe, 0x3dfbe417, +0xb2680b17, 0x9215c11e, 0xeacf3d87, 0xf834abba, +0xbe43b031, 0xc5680bdf, 0x53f48c1e, 0x17efb0c0, +0x1ed1680b, 0x3da2536d, 0x0aa3bc52, 0xb86b3ee8, +0x111e324c, 0x59578026, 0xfab84005, 0x27dd9c05, +0x30e3653c, 0x6df6602c, 0x313bde9c, 0xbe6112c1, +0xc070bd63, 0x1ef4683f, 0x35221212, 0x41342948, +0x165aa117, 0x3ac04870, 0x6f412735, 0x0605811a, +0x82637508, 0x52a361e4, 0x9529720d, 0x687be00a, +0xc3f60ea3, 0x067b240e, 0xdb8a3f3c, 0x0bb18f1f, +0x920e438d, 0xdaa52b92, 0x75854077, 0x19061d21, +0xe0543dba, 0x8db60612, 0xa6503e8f, 0x71b41262, +0x9bfb822b, 0xd08ab018, 0x54d33c86, 0x80edd88b, +0x0ca545a7, 0x59551ca3, 0x238a6854, 0x6822feec, +0xaabb9024, 0x5be915fd, 0x6c4488dc, 0xfcbfb855, +0x7b0523ad, 0xcb3c5b08, 0x5b122f39, 0x6307a109, +0x47de2c5f, 0x23b8261e, 0x2f12c010, 0x15461a6d, +0xdbfe830a, 0xb4120ef3, 0x062b835a, 0x0c089501, +0xea5fed48, 0x42fb4e27, 0x6cbd7440, 0x1e3c80bc, +0xc0b10706, 0x04f423f6, 0x43b52d06, 0xa2ebedae, +0x1206017e, 0x8471c6a9, 0x06bb001f, 0xbc041504, +0x31030100, 0x686f503e, 0x49e84a3d, 0xd9cb2397, +0x6804e30b, 0x352a13e0, 0xb1c02710, 0x22788d85, +0x86d9897e, 0xeeb66d04, 0x34049551, 0x01b31024, +0xe2ff0930, 0x1c6ade26, 0x92170668, 0x488361e0, +0xe1b442d7, 0x7feed0bd, 0x3c33cb05, 0x8d685650, +0x0d9f1046, 0x20ddf096, 0x14bb087f, 0x22ebbe7e, +0x3b182959, 0x474a9a10, 0xc53cd710, 0x541c0319, +0x57eb20d3, 0x8d2472df, 0x4506c6f3, 0x7d0379f6, +0x6017c350, 0x03006c03, 0xc86c43c6, 0xa021fa29, +0x43c74a24, 0x6140c504, 0x2106e00c, 0xac6ffe88, +0x439d17e8, 0xf6a1c109, 0x681c2d3b, 0x43e8e027, +0x09404542, 0x56e25b1a, 0xb1412da3, 0x5286430a, +0x62c403aa, 0x5a026f24, 0xa15ba806, 0x9434b211, +0xee40731a, 0x7e8db906, 0x767d2914, 0xee9ff961, +0x47240807, 0x14eb8302, 0x7f5fdf86, 0xae6c56ba, +0x2c588247, 0xd50618c9, 0xd221835e, 0x3f170602, +0x460bef77, 0x661c87fc, 0xa366286e, 0x8ef7d8d0, +0x565354c0, 0x50673c6a, 0xc5e0726c, 0x182d8db8, +0x7d57e814, 0x802c789d, 0xc50c0543, 0x4449be68, +0x8b06ac17, 0x1849f60c, 0x8a1ac40a, 0x0827e854, +0xfe885a77, 0x3b0df4f0, 0x84751050, 0x8385b443, +0xaec07eb1, 0x8c01948e, 0xc83f342d, 0x248e5b3d, +0xeab54582, 0xb803acea, 0xadde1bd0, 0x4e450440, +0x05980640, 0x263ceb8c, 0x91c5560b, 0xb4d60375, +0xfdb1c1d1, 0x1cc0337e, 0x04b817fd, 0x1df8f1fa, +0x352519d0, 0x1a9a0015, 0x1a18160b, 0xe884540d, +0xd5afb710, 0x86899028, 0x8e81c554, 0xbd296a78, +0xf3e8cd84, 0x55b00c3d, 0xca069c8b, 0xbd9fbb76, +0x500646b4, 0x6836fff5, 0x9e68633a, 0x3394e81b, +0x988e4b0b, 0x9e401f57, 0x316c8b30, 0x08afa0aa, +0xb82c07a2, 0x02a467bb, 0xf405ff12, 0xc4460259, +0xa02e0452, 0x7ccdf6a3, 0xfbb27380, 0x503b1822, +0xf49ef607, 0x813c0062, 0xaf50e860, 0xb05ba241, +0x03079d5a, 0x6dd824bb, 0x115a3db1, 0x07c75df5, +0xfdaf1134, 0x50793ddc, 0xb78a1e66, 0xb13db001, +0x5636a07e, 0x3e901612, 0x006a6c3c, 0xbbdb685e, +0x35210a7d, 0x72f0af57, 0x1639ac66, 0xc5b7b09f, +0xfa4108ed, 0xba8f2c14, 0x3b6f144b, 0xc1a16676, +0xa303d083, 0xabc46009, 0x8ec17dec, 0xa2e82bfd, +0x3885f60e, 0x40e9bc02, 0x8dee0d0d, 0xc15911db, +0x18417a0e, 0xf6588d17, 0x3092e808, 0xc48614e1, +0x1c14431f, 0xc40bdd80, 0x74051a35, 0x0e7f041d, +0x56a66c03, 0x477bf7d9, 0x26176e9e, 0x06f87f63, +0x94e92d74, 0xb11e2a01, 0x4586518d, 0x5220db9b, +0x0b9551e5, 0x47b6ef23, 0xc6deb6eb, 0x67268d27, +0x446aeb28, 0x6c2aa16d, 0x0edb16b5, 0xa8bad42b, +0x46a900e9, 0xde251b25, 0x553e0c87, 0xfb7783ad, +0x5bc02e04, 0x55737439, 0x65681037, 0x60e01b58, +0x91f21af5, 0x80522975, 0x4402627a, 0x8ac207a2, +0xe0b743c1, 0x23cf77a4, 0xdbffaaa3, 0x8a188040, +0x63f02e7b, 0x39a5c237, 0xcb81ab69, 0x107e6bff, +0x1e331869, 0x0f363be3, 0x854bc08d, 0xdd3444f1, +0x089e0805, 0x93076d03, 0xa081f3e7, 0xec212212, +0x04e108f5, 0x008dc091, 0x6a19e2fc, 0x08242006, +0x35f093ed, 0x3b42f3db, 0x4b75d039, 0xd8370b06, +0x82a1d3de, 0x775e0258, 0x7a202f3c, 0x6a5a39ee, +0x064f28c1, 0xd0bb4358, 0xfe426158, 0xaec04405, +0x300cd89a, 0x0c11109c, 0x08db0aa9, 0xbff83058, +0x8c37a1f6, 0xdec3bdee, 0x200ecdc6, 0x8438c745, +0xb1206a9d, 0x833ffb4e, 0x1ee00d3f, 0x4b1aeb1d, +0xc1d07b08, 0xd444928a, 0xdb0785c6, 0x9b3b80c2, +0xde3c0432, 0x84b0ba84, 0x7b6809e1, 0x84028625, +0x568d23f1, 0x04f743e0, 0x3c2801b0, 0xf896b03c, +0x70d801c6, 0x02788002, 0xa429ce6e, 0x08701087, +0xb920615b, 0xf160d86f, 0x02a80238, 0x58df152a, +0x1981c58d, 0x05e45c15, 0x221842b7, 0xdb0250db, +0xdbaa0cc0, 0xc231b804, 0xeb01c842, 0x52b10290, +0xf90d689c, 0x31bf10cf, 0xbc2f0b3e, 0x3d5ca685, +0x360fab3a, 0x758a6c53, 0x73838dff, 0x4c572baf, +0x85aa0316, 0x160ad17c, 0xc03a896a, 0x42df53a1, +0xe8437c3b, 0x3bfff7f9, 0xc16ce300, 0x50d0fba2, +0xe3e82c68, 0xdb64b915, 0xe9d989b7, 0x2c723546, +0x58142490, 0xcbb045e8, 0x23583562, 0x49d98622, +0x1c7badbc, 0x22c55457, 0x891d85c5, 0x571920b1, +0x39aee8c4, 0xd0728344, 0x55b6aa85, 0xd91b6c3f, +0xa9a3588b, 0x6c37eebf, 0x3860d418, 0x5a1fb906, +0x1879e4ae, 0x10f8f4a3, 0x60c5d86b, 0x27a3d40b, +0x02bd7007, 0x29904167, 0x2889c17e, 0xbaeff04a, +0x7ff869ff, 0x53f4117e, 0xc9d1f82e, 0x00057e57, +0x29f142d1, 0x18bfb861, 0x000021e0, 0x8c77dfad, +0xef096a17, 0xfeaa33eb, 0x243b028a, 0xec38923c, +0x21984a04, 0x43c052f0, 0x1bc83535, 0x20fe3b1d, +0x6cec812e, 0x0488a013, 0xdf3b7ba2, 0xa1a86caf, +0xae6d0a84, 0x136ea208, 0x19e43b80, 0x08706f86, +0x0733c8a1, 0x024072c6, 0x4ffc002d, 0x04013cb7, +0xe8063e3d, 0xffffb688, 0x24d4e3f6, 0x2720e60d, +0xc6880fe8, 0x3822c420, 0xba400315, 0xa337ba84, +0x67443004, 0xa10ef864, 0x6720850d, 0x08847464, +0xf328d1f6, 0x3616ca51, 0xfcb76323, 0x38169040, +0x4b9c8db3, 0xf716cfb8, 0x680d1d01, 0x9c273468, +0x75b50c28, 0x9d23c616, 0xd4e84b49, 0x04e88c41, +0xb3c2d541, 0x28ee55ad, 0xe0bf5673, 0x26d8ceda, +0x254f284c, 0xfe513753, 0x21c50f0a, 0xf9582cd0, +0xc16a436a, 0xb1df163f, 0xf777e8ff, 0x6a46565f, +0x0c03e824, 0x13e1bf89, 0x00b587a8, 0xc6df01c7, +0xa8bd6805, 0x07a1d5d0, 0x032c7edb, 0x116b4eb0, +0xce09d8c3, 0x72b29a03, 0xc0b6bfb7, 0x35602b3f, +0x2bc329fb, 0xc0fad47f, 0x151561d7, 0x0fa28555, +0xfc37421d, 0x3a050b4e, 0x0231c83d, 0xb0e80a74, +0xc0235cb6, 0xa7c88512, 0x426109c2, 0x1f963375, +0x2840ec15, 0x33696170, 0x6464167f, 0x6c2d16ec, +0x683d16bd, 0x99391983, 0x61514370, 0x490e4679, +0xaa1f3a9d, 0x1b004dbb, 0xac248a04, 0x1d54ec55, +0x88502608, 0x3519e2a4, 0xed439094, 0xe2410acf, +0x1acf4421, 0xbbc902b3, 0x10175874, 0xa605ea01, +0xabe401e8, 0xd7090088, 0x86caf68b, 0x9df86610, +0x7d86ac1e, 0x68457ec0, 0x86f89120, 0xab00001e, +0x032603b0, 0xa88e3018, 0x1ad7591b, 0x242cc1db, +0xbecc68b9, 0xc85e1e44, 0x8fe8fd80, 0xb6fffff5, +0xec01fc18, 0x802c3a97, 0x7e13a105, 0x933d80a9, +0x5b509c3e, 0x94c329a0, 0x0e1b4ac4, 0x230a1076, +0x742110c4, 0xf8edc036, 0xc0b3118c, 0x82838b30, +0xfbe60405, 0x808338ed, 0x34ae6807, 0x02b10415, +0xef441d63, 0x07a811ea, 0xa1cf1d6e, 0x845d890a, +0x4ca93016, 0x6903ca93, 0x9901c232, 0xd03cb71d, +0x5e0f86d6, 0x1187bc59, 0x842b496a, 0x91c3dcad, +0x042474c5, 0x4efcc149, 0x02be981c, 0x54688f9f, +0x3e88676b, 0x901a8e19, 0xfeeaa30e, 0x09c11304, +0x3273f789, 0x0d8efe10, 0x2b35ff04, 0x35f459e8, +0x9c84e426, 0x00c608e2, 0xc6ee268e, 0x0b33b1a0, +0x22bb8e0f, 0xed11bfe8, 0x04b23de8, 0x39ba0c03, +0xf738e38e, 0xaf5dbbe2, 0x26021fba, 0x24fe832c, +0xbd59fc30, 0x8115059e, 0x29f0ccc4, 0x1c357816, +0x250c240d, 0xe03d7016, 0xa49b9043, 0xb6a4fb8a, +0x0788c5ad, 0xe883c011, 0xc12e4b14, 0x3d12388b, +0x49e74e92, 0x829815ca, 0x2dc0e114, 0x5023742c, +0x33211478, 0xe0ac691a, 0x150c4301, 0x4b10270c, +0x7f11586a, 0x61f05785, 0xb184e8d1, 0x0a4175ef, +0xa5c88aee, 0x9eb175e8, 0xd087dca6, 0x206aee91, +0xf141f3e8, 0x8ea03aeb, 0xbf5a263c, 0x2e3b254f, +0xbe0907ab, 0x4ae9cf76, 0x760dba02, 0xded77ec1, +0xfc089c16, 0xc1c3cf42, 0x2a099ce3, 0x0d782444, +0xc7bdc309, 0x24389581, 0xe9d61d58, 0xdfb7cc21, +0x8d47477e, 0x428a0e6a, 0x3c45bd0e, 0x2f81770a, +0x0a2d0e52, 0x147714b4, 0xfe8a3238, 0x04c1ba84, +0x551cfd02, 0x6fe65ce8, 0x8a444e22, 0xf766c709, +0x33a00645, 0x1a3fb6da, 0x40a84c2c, 0xc7e9f441, +0x7468c911, 0x84188a03, 0xa2f8bfa8, 0xe90c421e, +0xee457022, 0x2c4fbbba, 0x3205dc3d, 0xfbff0e8f, +0x14ef6e7c, 0x7bfa2389, 0x3c744e89, 0x508dbea1, +0x51b05922, 0x748dbeff, 0xa8a10e01, 0xf929c189, +0xad0b0709, 0xa4b350dd, 0x36170eeb, 0x15f70a84, +0xfd37035b, 0x0547fc0e, 0x1146ff26, 0x6360b581, +0x11097d80, 0xc58e5d75, 0x54ce0583, 0xc6cb358b, +0x51ac9122, 0x04567ddf, 0x860bd686, 0x5c2eeec6, +0x8687b834, 0x7e839bfe, 0x1f61c0a4, 0x892674e8, +0x74ebfde3, 0x8d3eceaf, 0xb75db857, 0x9f59c817, +0x004da980, 0x455556c9, 0x73395678, 0x8e54033a, +0xd985bc8f, 0x066e4e6b, 0x6e892c2c, 0xdd630b45, +0x2deefe1f, 0x4c664de2, 0x883782c7, 0x267527c3, +0x1a183056, 0x00088a15, 0x72442168, 0x7f3eb6db, +0xec3f018d, 0x601fb389, 0x0eef5736, 0xb502eddd, +0x3a6706c1, 0xff56905d, 0x6dfb7019, 0x1649b456, +0x20c58356, 0x0c19cfbf, 0x795808db, 0x2c21bf92, +0xa018b6e8, 0x570faf31, 0xa31e2957, 0xec3e2ddb, +0xfd80e96e, 0x5602a638, 0xd7fbc40d, 0xd11428df, +0xb1df864f, 0x550d3a00, 0xfbebc152, 0x158a1873, +0x7a21b807, 0xf52ff56d, 0x36410874, 0x72d13844, +0xb0f980f3, 0xa5de3645, 0x1a75249e, 0x09a20143, +0x23b7d154, 0x0406a9a0, 0x33851c0a, 0xb3ecbebc, +0x500346bc, 0x85048d1a, 0x0a32fb06, 0x1913042e, +0x53565751, 0xcb200c7f, 0xcd86c10f, 0x20081db3, +0x43b3cd2f, 0x3a6efbd3, 0x724c8b1d, 0x0cd343c8, +0xff587111, 0xf889fb79, 0x853c8df8, 0x3da43082, +0x27ff457a, 0x02468ac8, 0x02763c3c, 0x237c3cb0, +0x57b59c97, 0x6a82d3a8, 0x91e906ba, 0x5f5e5b18, +0x704a5cd3, 0xe88d8810, 0x7cdc78ae, 0xb42a5a57, +0x57a4605a, 0xa094e0b6, 0x74328c6d, 0xf90b5397, +0xdd0487b0, 0x6c09bfc4, 0x210b0130, 0x38080789, +0x22c19f01, 0x8a4046c4, 0xb9086f18, 0xfbb60f60, +0x5d04c3dc, 0x015986e9, 0xd4312675, 0xf0790b93, +0xee838717, 0x4a85bb1d, 0x77b04d81, 0x760ca03d, +0xa21d3d76, 0xd6b3a622, 0x1caca190, 0x18e02c06, +0x503cff6c, 0x1588016f, 0x3335c920, 0x02b98778, +0xa34056ff, 0xd2de9504, 0x351db0fb, 0x81b7ba8f, +0xb0522da8, 0x84e31bec, 0x0d54c255, 0x1b46c714, +0xaedd409a, 0xab9ca9ad, 0x0a10038a, 0x6fbad4bf, +0xe94306b8, 0xba800f84, 0x890d75cb, 0x87db89df, +0x161d87df, 0x3d1370e9, 0x697517b4, 0x6335b508, +0x2522237b, 0x80381be0, 0xdf76fd9d, 0xe78cb868, +0x3334a416, 0xc873ff4b, 0x75032c35, 0x017b8025, +0xc1117b03, 0x02ecb53e, 0x9c3d0000, 0xdd3da9e8, +0xf6d9f004, 0x75128501, 0xe6e9df09, 0x17d87701, +0x81364d92, 0x51000000, 0x8bf62515, 0x7535f00b, +0xa3024c0e, 0x2abbe960, 0x5ec2640d, 0x36ac5a75, +0x0e2d60d8, 0x876eff35, 0x873d2b33, 0x0c1d260c, +0x35a12ebf, 0x60a3b022, 0x0f08bcc2, 0xf61b6ffd, +0xff800158, 0x75082573, 0x02738d2e, 0xbf858b34, +0x01016b20, 0x54ee39f5, 0x46813737, 0x4dd5b073, +0x20bc16e2, 0x70ff6033, 0xee700386, 0x1ae9e872, +0x4192353d, 0xf909c90e, 0x97219100, 0xdc30649d, +0x2a3faa00, 0x36dfdd00, 0x2f752b46, 0x06e00b06, +0x53158efc, 0xb2ff6a5d, 0x647d6a50, 0xeb373363, +0x94f2184c, 0x650dc647, 0x968085b0, 0xb1287605, +0x780cf20d, 0x3bb59020, 0x523b0e15, 0x061fb683, +0xeb217b6b, 0xe1143456, 0x7581f874, 0x1e281e13, +0xfb0e43bf, 0x9f3ceb27, 0x962b2a33, 0xcae46475, +0xb47f23b6, 0xdab45298, 0x1917a971, 0x9b0203d5, +0x74876482, 0x89fdec7b, 0xac05d13d, 0x044facbf, +0x06702ada, 0xb51948c6, 0x305d6825, 0xc0854a42, +0xd320674a, 0x33650d59, 0x12341832, 0x04378b74, +0xf0e0fd20, 0x4efa2474, 0xe4a91187, 0x70098e59, +0x64230418, 0xbf5c9110, 0xc64920e0, 0x7e0786eb, +0xf807b905, 0x38402605, 0xe8e3d36b, 0xdf80df66, +0xc7b62de0, 0xd1f61c71, 0x29f9f799, 0x38009a84, +0xf19b9136, 0xc9114822, 0x9a09bfc0, 0xf541bf5a, +0x547883c8, 0xf6197601, 0x2b6a0648, 0x71f7c6c5, +0xefff7154, 0xc7ca8211, 0x3922d519, 0x2a776870, +0x0d390572, 0x58f77823, 0xbd237764, 0x58428b20, +0x897c1430, 0x410335df, 0x68511364, 0x77067272, +0x01db7022, 0xe81e51be, 0x7007e007, 0x2db567ff, +0xff772a6c, 0xa7c41152, 0xc1482dc2, 0x5028a502, +0xae962771, 0x09532981, 0x136c2840, 0xf119222c, +0x1346e830, 0x61a09187, 0xbb0c8714, 0x709faaa9, +0x00bdcdb0, 0xc5393001, 0x08c16373, 0x0e24613a, +0xbdff01e0, 0x11ebeffb, 0x7239add6, 0xbd117760, +0x0a775c5a, 0x5c582bcd, 0x01f5701b, 0x5260b58f, +0xfee6e89d, 0x2b151853, 0x1443063a, 0x5fac1d45, +0x30745bd0, 0x797bb172, 0x02b0cf12, 0xcc68713e, +0xdb0fe2d4, 0x6c8451ce, 0x82449d08, 0x6da2ce2d, +0x5a545c79, 0x0df420ff, 0xb58dc11f, 0x89b6fbff, +0x50d829e8, 0x475bc016, 0xe8060174, 0x3d26d698, +0x6f621bd0, 0xdd75f339, 0xd15e18d8, 0x8bf294ec, +0x61eaca6c, 0x8c2851e1, 0x36e838fe, 0x99cc2ee1, +0x4848304c, 0x401ce989, 0xeb1407f0, 0x95df11ce, +0x7d9ece43, 0x70f87839, 0x74560b70, 0xbd2912ac, +0x6768df01, 0x06435fc5, 0x94e8033c, 0x267987fe, +0x97aa4145, 0x46fa3510, 0x835a09e1, 0xff03e01d, +0x22ab4c40, 0x4f648fd5, 0xe02c85b8, 0x83ba07b7, +0x02471c7a, 0xc7784288, 0xdf007442, 0xc3f42c3b, +0x0a5ca8c5, 0xff361f26, 0x9f42e668, 0x8295b40e, +0x122d7866, 0x0cede037, 0x4920aa7a, 0x1734de30, +0x8c3751de, 0x380e5f74, 0x10b93c61, 0xc9ba2a00, +0x3c382a82, 0x801e253c, 0x392841df, 0x2a2476c1, +0xed0a4c41, 0x6051dbd4, 0xd283f045, 0xb72b1f1c, +0x20a6d86d, 0x8c3dda11, 0xe8d13840, 0x63e2b84a, +0x8174512a, 0xa39a48e2, 0x45ee0b06, 0x50d02934, +0xee15f618, 0xe887c513, 0x50226dbe, 0x0729aa9f, +0x89cfa520, 0x5409bf62, 0xfef88327, 0x2f2d2274, +0xec745203, 0x10902168, 0x575d10c5, 0x91a5a931, +0x4c6248d8, 0xb70549d0, 0xc5c02652, 0xf13631c5, +0x91ea22a2, 0x8da18865, 0x83a3144e, 0x9ea759d8, +0xe1945a23, 0xc7b34358, 0x3a3f7b5e, 0x93e83fb9, +0x30ab88fd, 0xe1d557b4, 0x90d87926, 0x3234ec83, +0xea1e7060, 0x2d7437e1, 0x1886fe68, 0x0d750cfa, +0x2c7a0065, 0x75488544, 0xa9bb2ef5, 0x78ab206a, +0x6a20b33c, 0xef91ea84, 0x54020fa0, 0xc98b0d50, +0x5cbe109e, 0x82e06d8a, 0x44922ba1, 0xee0f995e, +0xa1087198, 0x0487730c, 0x0e4040eb, 0x3025211b, +0x41fb7325, 0x0602641c, 0x9610cdeb, 0x497149ac, +0x7e0c6bb5, 0xde1d910c, 0x920addb1, 0x8c3f5028, +0x6844e7dc, 0xca45fdb0, 0x0405742b, 0x7836722d, +0x08f4f720, 0x36a8f00c, 0xdec86741, 0x20244424, +0x28a9513a, 0x2e789b10, 0x406a01bd, 0x25ea9b7e, +0x930bf278, 0x8cef901c, 0xd8194326, 0x20d17ceb, +0x9f001b14, 0xd8a27c2b, 0xa1159a19, 0x2005c012, +0xcfed0877, 0x14b59f4c, 0x141d6009, 0x102d6e1f, +0x0a5149fc, 0x3dbf075e, 0xa36b95e8, 0xf7fe3120, +0x94749931, 0x72381d39, 0x783589d9, 0x548af79f, +0xa308f603, 0x9f309f74, 0xb3d27094, 0x1718a64b, +0x909ab548, 0xf0f1d114, 0x7cdf8b9c, 0x9b776c1a, +0xbab38e02, 0x34fa361c, 0x39567305, 0xea36944a, +0x8b477532, 0x75af4b0b, 0x5c91ec63, 0xd3b938eb, +0x2d7ed27a, 0x16a97dbf, 0xc83c2d46, 0x6c051e75, +0x177502c8, 0x513ee6c1, 0x161c503a, 0xc446c809, +0x0ddfedff, 0x6beb0842, 0x104a3941, 0xd87ad37f, +0x55b3d108, 0x539caa72, 0x37ba4169, 0x187a461d, +0x7008e9c1, 0xedc45630, 0x39212893, 0x1b749454, +0x89592ca9, 0xb1cd14d2, 0x04065f63, 0x590b9b2e, +0x352c1bc1, 0x76097061, 0x1013002b, 0x835b002f, +0x1ca9441e, 0x1b78808d, 0x6dc37047, 0xdb464085, +0x741d1c52, 0x1a3c6edc, 0x031a5808, 0x2b001970, +0x6c043546, 0xf8cc0eed, 0x1adbfbf6, 0x8723dbe9, +0x441cbc54, 0x031a42c6, 0xa0c60ac4, 0xe7df8619, +0x5b1177a1, 0xf3e6b1fa, 0xe8fefe81, 0xf5477b04, +0xc32d9187, 0x49137507, 0x1bc67173, 0x2396e84e, +0x9a510b0d, 0x7a8600c0, 0x4859890f, 0x49a0b9a9, +0xf31db357, 0x1e82e6c6, 0xc43ddf4d, 0x1e060ad1, +0x3dc28098, 0xf759cdd7, 0x0406e881, 0x380a0466, +0x0ae5ba08, 0xe89b7a64, 0x021b1826, 0x54d64d4e, +0x5022be9f, 0x6c0f7702, 0x2cc0f505, 0x0ce86403, +0x819d76c0, 0x92f22837, 0x88aad75a, 0xda22ed5a, +0x88f8dc25, 0x0289e5d0, 0xa96c774b, 0x638b9d5b, +0x20620642, 0xd0703e30, 0xf2c15734, 0x5fba3026, +0x1d071db1, 0x146a8f14, 0x6071391d, 0x3c80cee9, +0x1c0c6418, 0x0cb1ba4e, 0x1f56115c, 0xe80e2819, +0x83e2247f, 0x1174fce2, 0x0d7401a8, 0xd6c1becc, +0x8bd089de, 0x24c6f533, 0xcc7e24fe, 0x86f03a1b, +0x6a531705, 0x1902163d, 0x0b448850, 0x6e1a0474, +0x6486395d, 0x1736685b, 0x3c1f19b1, 0x2bdbe13d, +0x4f448a4f, 0x27eb18cc, 0x4770f043, 0x909e0c28, +0x8dfc6f86, 0x09c78470, 0xb0ff8147, 0x2c0e4f82, +0x4206eb40, 0xd506b400, 0x2df34d77, 0x435c43a7, +0x16be661d, 0xb51cc883, 0xc405826b, 0x18742139, +0x6cdd6c20, 0x83ac26c2, 0x0d18053f, 0x80ec3f02, +0x05bc21a0, 0x4016771f, 0xb09b3110, 0x0c353b1c, +0x6f82a041, 0x67cdf80e, 0x571723ea, 0xd3462a41, +0x661c3500, 0x073ea647, 0xdc11618d, 0x5bebfc0d, +0xd072a730, 0xbf068a17, 0x578d4175, 0x01935429, +0x3a529fdb, 0x8a9ea998, 0x104c2a20, 0xd80a4984, +0x0f9b04f5, 0x7003072d, 0xebd9e276, 0x09f04c1b, +0x10783ed6, 0xbfd80049, 0xac84d801, 0x45593630, +0xe510a774, 0xcd4ac0d2, 0x276c2b06, 0xd8b03c14, +0x17d4c9e4, 0x1d9a20fe, 0x168b8bd8, 0x46db2e9a, +0x3dc600cc, 0xcd05ea0c, 0x067c63f1, 0xf7c2a5f0, +0x3fc221da, 0x90c3c909, 0x3af4d080, 0x8c2d805c, +0x0030bef4, 0x06880e58, 0xa0841a54, 0x0a6b54d9, +0x674cc00e, 0xd3847d97, 0x289f0d28, 0x7520b82d, +0x19cd1fee, 0x3b017f09, 0x25c751d6, 0x25346ab9, +0x93dfd9ba, 0x2723ebc8, 0x4a88e90c, 0xe35b1424, +0x4ea34064, 0xce64e2dc, 0x021df7b5, 0x5d763f0c, +0xbe1ece80, 0x064c032f, 0x52500bec, 0x630a742e, +0x2f36f02f, 0xf8095834, 0x40619e74, 0xbb603603, +0x5052318d, 0x075c462d, 0x23830c38, 0xa772a377, +0xa8f81d28, 0x0319bbdf, 0x11047c4b, 0x7d73b365, +0x3633d9d7, 0x05371955, 0x1d10c314, 0xe20b0c04, +0x83afe272, 0xcdc25c5f, 0x32245ed0, 0x58cd5968, +0x0aec1808, 0x15be7e2c, 0x21c0dbdb, 0x244651a7, +0x6a0c0637, 0x3b18b42b, 0x7b20aa1a, 0xa5f60b84, +0x03830a85, 0xfb2a1510, 0xd5fb1f52, 0x617f3b81, +0x3a8b038b, 0xd2751046, 0x6e9db42d, 0x20462b14, +0x02700776, 0x095afb85, 0x9d58a366, 0xdcfc0420, +0x0c158902, 0x0bf6bc56, 0x1474ed68, 0xc0f15031, +0x82b15389, 0x176e8a91, 0x48dc30f1, 0xdbd54cc1, +0x21c66f7a, 0x01501f67, 0x5c1cff90, 0x041c8324, +0x6ef87118, 0x1d048c97, 0xff0120d4, 0x9a508143, +0x43430b33, 0x10228507, 0xa7201ccb, 0xc25ec13f, +0x9f1076d6, 0x10c42620, 0xb092e03e, 0x691c226c, +0x41dbf608, 0xda2551ad, 0x09044618, 0xa46c613a, +0x08b20606, 0x0843841e, 0x08bd87b7, 0x19531c1b, +0x39392120, 0x68d43221, 0x127e28fd, 0xb48b6c21, +0x24bcea24, 0x53008d4b, 0xe81086b7, 0xbea85661, +0xfa250802, 0x0ebacc14, 0x068abf15, 0xe9470788, +0xddbe1061, 0x1d0512d9, 0xb156d30c, 0x1b0f4613, +0xb01e68ab, 0xf676090a, 0x6f605fe9, 0x01752e40, +0x45757318, 0x2b24848b, 0xecc1bdd7, 0x186c0683, +0x65783b80, 0xf9b6315f, 0x8a0773b0, 0x700feb03, +0xceefa603, 0x43701a4a, 0xe9da7529, 0x4669023a, +0x8c0701a8, 0x1c5128e0, 0xc7bc3dbd, 0x097523bd, +0x0d465a11, 0xb708756c, 0x178f6fd9, 0x0c13eb46, +0xb90e7568, 0x030a170c, 0xe17d94b1, 0xc89104bf, +0x75783c20, 0x7e1cf97e, 0xa1639113, 0x11ebeca5, +0xe2cd8712, 0xffb76fad, 0x74727c6e, 0x0045c60e, +0xd0884530, 0x09885843, 0x40c98545, 0xa752c4f0, +0xf7d8fb79, 0xcffc36ff, 0xab84808a, 0x831ad009, +0xe87904e9, 0x9f015ce9, 0xfbdd6462, 0xa4850f64, +0x5e177152, 0x0fd8120b, 0x1615eb70, 0x711b8131, +0x730979f7, 0x4ff7452d, 0x3603eb89, 0xb9f70250, +0x05c8210a, 0x6f6e8a1c, 0x0403e42f, 0x70558830, +0x006667b8, 0x896e6cf7, 0xf725e04c, 0x11038b79, +0xc1ef4170, 0x5d3202fa, 0x2589f035, 0x8dbe75fe, +0xda39ff55, 0xbe18c312, 0x6f847b0a, 0x88026ddf, +0x124a430b, 0xafe9f177, 0x4675404c, 0xe261118c, +0x049f2c00, 0xdacadee4, 0x2276d88b, 0xbba0500f, +0xa1b62bf0, 0x55f29568, 0x0e805f12, 0xa9c5631d, +0xe277240b, 0xc253dd4d, 0x4a64ebdb, 0x4d3d7521, +0x8806538d, 0xa787d820, 0x0492e542, 0x419968e3, +0xc93035d2, 0x72cc3b86, 0x0fef2241, 0x7563e12b, +0x06eb5d30, 0x9c07068a, 0x947378c2, 0x2573eb90, +0x03d12a3f, 0x249b78fc, 0xe746db72, 0x17671885, +0x2e30f12a, 0x0200c603, 0x0c11842b, 0x270e62d8, +0x6010d46c, 0x51c07888, 0x87a0b0c4, 0xb4fcc4aa, +0x4cc1145d, 0xaa081b5e, 0x60828c95, 0x40dbcb19, +0x5c563dbc, 0xb200b01b, 0x938a30cd, 0x7d2ff46e, +0x84464716, 0xd28426ae, 0xd0382274, 0x2ec188d1, +0xc626ffdf, 0x20488d03, 0xd188c888, 0x4a0bc2f6, +0xcd4138ca, 0x034fa5f4, 0xcdd0754b, 0x2a4c1f02, +0x5f5eb576, 0xafcbeeed, 0x8afc56c6, 0x01884202, +0x6df6ed41, 0x72a9c3ab, 0xe6320315, 0x7da15bdd, +0x834ade89, 0x20ce8ffa, 0x23430388, 0xa6827bf0, +0x53edbd46, 0xa63d4c49, 0xd3a0a5e0, 0x4206742e, +0xac05c834, 0x4b24fabd, 0x82365e48, 0x4c5fafba, +0x2769d648, 0xc0dac7f4, 0x742c4e2c, 0x05754912, +0x0f60b0c6, 0x0aeb7ebb, 0x63ee7511, 0xedb5f0a1, +0xc388565b, 0xdb181a2a, 0xc1f0a527, 0x7eb1562f, +0x38845fc3, 0x154a0910, 0x793f20a0, 0x5a08cefb, +0x200f401b, 0x201f5c30, 0x21c2cc02, 0x0cf2df00, +0xaefeec6e, 0x8d49d1f7, 0x0a351904, 0xf7736f48, +0x17201bda, 0x89394510, 0x1a2384c8, 0x11f2537b, +0x6fefe805, 0x050b20ac, 0xc829f461, 0x102474d3, +0x4900dc11, 0x8925b81f, 0xf63dedf2, 0x8a136c37, +0x740a3a08, 0xebf6db08, 0xe04d0605, 0xd8fbfb10, +0x404309eb, 0xd889db3b, 0xda2359d1, 0x72cf83d1, +0xd862da89, 0x0cac64d8, 0xe72b1137, 0x2fb7d193, +0x326b5bd8, 0x8b0ff985, 0xa816741d, 0xfa036086, +0xbb708640, 0xd1e456da, 0xc14dc4c5, 0x1ee8c711, +0x1f05bc42, 0x211eeb04, 0x8099f08c, 0x98089d11, +0xb1400471, 0xa36755d7, 0x743b8d26, 0x1ecb19d8, +0x34301953, 0x64963b24, 0x06892f57, 0x2b8230ba, +0x1361f022, 0x5e143d0c, 0x0bf0aee1, 0x4d5b0c1a, +0x24812316, 0x60082437, 0xd6821318, 0x6da26894, +0x11a1a963, 0x01021398, 0xb82fc24c, 0x4143e56e, +0x2fef754e, 0xd1b70554, 0xe2904062, 0x45b4210f, +0x570d4adc, 0x7578a5c8, 0x3e1034f1, 0x5c6ea6c0, +0x8ed1d8e5, 0xe71829d0, 0x74bacd89, 0x7fd3eb3a, +0x348878ca, 0x39ce8906, 0x4e187ce9, 0x462e8555, +0xa824a054, 0xe13452f6, 0xeed2d2a5, 0x5784e87d, +0x2c1815b1, 0x2b6649a6, 0xdfde3417, 0x428a208f, +0x89384201, 0x160bebd0, 0x8a8e8ab2, 0x0c8fb420, +0xac87f457, 0x7277011f, 0x8f803d83, 0xc5525c83, +0xeb02fd16, 0xf101d858, 0xbf3d8053, 0xc60c7567, +0xc1820d94, 0x9911572a, 0x788def10, 0x01c8e414, +0xab3116a3, 0x8d943a03, 0x80627b0a, 0x14d9560d, +0x0595d554, 0x768d52ab, 0x72ebb70a, 0x45305f40, +0x82041ae8, 0xfaac0140, 0x2741590c, 0x01bb60a9, +0x01186f88, 0xb82d0828, 0xa229e807, 0x6db6fbed, +0xfe682141, 0xffe80957, 0x14eb0bfe, 0xde0895b9, +0x4e08ff84, 0x80a2bd0a, 0x89f15084, 0x8037e2d8, +0xbb3eddd7, 0xd0bfcba4, 0xd1ff9549, 0x99208a96, +0x0a009d06, 0x571006c5, 0xf163e396, 0xc1667c37, +0xc58908ea, 0x53380ad9, 0x00ed1e1a, 0x1838685f, +0x47c73174, 0xa4250688, 0xad18b18a, 0x5ad69cc7, +0x420e0828, 0x81323b1b, 0x89f2bb15, 0x005588e8, +0xe9036200, 0x1c71ab06, 0x93b2177d, 0x0a0391b9, +0x5b083008, 0xec0adb2d, 0xfee938c2, 0x71bb5b2d, +0x2d611325, 0x844d248d, 0x7382008d, 0x6cad4547, +0x5b2d840b, 0xd81d2d17, 0x47ee08b7, 0xffffcf0b, +0xa9001037, 0xdc6891e4, 0xfb2641fd, 0xad694882, +0xaa9e0c2e, 0xcde9c45f, 0xd20a43ef, 0xf447f053, +0x89d0b18d, 0x66032bc1, 0x04587983, 0x0fee06dd, +0xa8796c27, 0xe9ec7239, 0x04412aa2, 0x42c60251, +0xd70916f0, 0xc9ba090d, 0x6dd277fc, 0x037b80f0, +0x064d15f4, 0x94112204, 0x2bc2722a, 0x02651115, +0x173475da, 0x5e067f04, 0xa01851c0, 0xfeb78614, +0x43ddb4dd, 0x08af28eb, 0x06b82d75, 0x35b82606, +0x14741080, 0x84dc1f68, 0xbecbf00c, 0x29c63c8d, +0x0ceb0ee9, 0x5616eb8e, 0xb84a4751, 0xcda23a44, +0x0a13e922, 0xc7f182fe, 0x9a340300, 0x6d080e12, +0x2c32fca9, 0x0b38a169, 0xdc5f029c, 0x1d8845e2, +0x23fad5f6, 0x5c545b07, 0x4b821161, 0x204a5e54, +0x7495f107, 0x6ef4e8a1, 0x109814b6, 0x3e0bec75, +0x0b146c2a, 0x43c1dc26, 0x7d8b3673, 0x0006d00a, +0x2e8b8185, 0x70a25b1b, 0x130c852a, 0xb403be1c, +0xd8a11659, 0xb62c4535, 0x39eb1e32, 0x01303f2e, +0x03a62900, 0x0e42c8b6, 0x6fb285c4, 0x91fb8c0b, +0xffcc7919, 0xd62d67ff, 0xbe72a464, 0x7d01355f, +0xfb35c653, 0x7e3e8777, 0x2fad8a8d, 0x4e8d4ec5, +0x1d022a24, 0x1aeba685, 0x0703d159, 0x42f90506, +0x2488d5b7, 0x08073bff, 0x6d4a2488, 0x513985f8, +0x08e2c11a, 0x8a194141, 0xeb6bafa0, 0x09340b20, +0x0dfc0a63, 0xafb77775, 0xeb050fc9, 0x75025329, +0x3503501f, 0x10b008dd, 0x0307cd03, 0x04240908, +0x0b2af0d7, 0x2d1e04cd, 0x05e901d9, 0xfa852749, +0x15daacff, 0x9fc2374c, 0xe0368696, 0xf5b0f04d, +0x96801209, 0x9c163498, 0xab20c1c0, 0x10071a7b, +0x9b116600, 0x1881de61, 0x6bed1241, 0x0c26c5c3, +0x0fa70e06, 0xe884056b, 0x01c06b27, 0xa93e0000, +0xec1022db, 0x0f030eb7, 0xeed3f4b0, 0x513d02e9, +0x570a7f04, 0x6872e913, 0xf603a036, 0x18643704, +0xc58843d5, 0x1122ca6b, 0x18367339, 0xd94eb610, +0x6023b34a, 0xcd684de9, 0x86d84233, 0x3756056d, +0x76e94d33, 0xdea90e0b, 0x157631ea, 0x906c1639, +0x1606a96e, 0x877ceb40, 0xe4a1e305, 0xb50608da, +0xd7d8b10e, 0x12c1d778, 0x7df3fcff, 0x05c54f11, +0xf147d490, 0x8a101b10, 0x0c9d1296, 0x100e1516, +0x7df1a523, 0x1464d7ec, 0x1f742d3d, 0x3d097f06, +0xbc2e1800, 0xeb0b0dfe, 0x5b3d3d1b, 0x872e12eb, +0xb82dd4ae, 0xc0020510, 0xfbf80305, 0x8e628b57, +0xe856af89, 0xe0e8f6ec, 0x950e1767, 0xfd44eb56, +0xffffc995, 0x8b070874, 0x3dc92d5d, 0x984da10d, +0x1078009d, 0x460e6206, 0x952561c6, 0x181c570a, +0x2eba0c07, 0x530456f8, 0xad08063d, 0xa60bf885, +0x6a3c5da4, 0xdd35f7ff, 0xeb786c66, 0x8bf802e8, +0xea053b77, 0xf11a74eb, 0x645594ba, 0xdc1ba31c, +0xabb10705, 0x8330b60a, 0x5b62188a, 0xe8a120c5, +0x22931154, 0x13733d07, 0x88c14508, 0x0200086e, +0xec0e7a14, 0xcdf41018, 0x82613bad, 0x3606ec45, +0x3c89660e, 0xd0d63db8, 0x54669e1f, 0x189a5078, +0x94908912, 0x46360c11, 0x980e1ce3, 0x8804d9e1, +0x052474aa, 0x7ac0ff9c, 0x4ef53aca, 0x8a5f5b24, +0xf120068a, 0x934af6fa, 0xb26ba490, 0x32cc2d2c, +0x0c1d87a0, 0x817800a2, 0x7875abba, 0x31ef110d, +0x4780828d, 0x7553ad82, 0x82dc89f6, 0xff0c0998, +0x08fd1066, 0x2790820f, 0x0d09e1b0, 0x50081b8b, +0x15ccdbc6, 0x1894d122, 0x1c76613e, 0x2c4e8814, +0xd102fde3, 0x04f93449, 0x720b4306, 0x2a044c05, +0x520013ff, 0xf5f45176, 0xcce44276, 0x83ac6001, +0x52b152dd, 0xa2d438c4, 0x388afb3d, 0x73a33b36, +0x2b743939, 0x0ec59b74, 0x5d26a78b, 0x48e8f3f3, +0x015397c1, 0x1cfc9498, 0x11603000, 0x74145cac, +0x8e84a680, 0xfcf59861, 0xe46c5b79, 0x025efa43, +0xa0559d53, 0x0cb08b86, 0xdf4586a8, 0x30c2637c, +0x82968b1e, 0x0b1df012, 0x94061078, 0x7e086840, +0x861b49e4, 0x4ecb24b4, 0x3301069f, 0x72058692, +0xbbf4ff06, 0x7698c06c, 0x986a0079, 0x6181de0e, +0x7cb7790b, 0x982c093a, 0x0ca41b0b, 0x8d87c716, +0x8e134510, 0x841b8903, 0x3c632362, 0xb620898b, +0x2bb2ba46, 0x9b189960, 0x6615c908, 0x3be07e9e, +0xca417a24, 0x0276095a, 0x6a89100a, 0x504ed962, +0x0fc961c7, 0x4a0666a4, 0x1162b58d, 0x8d3b1551, +0x281115a0, 0x808d63ff, 0x94186117, 0x08b162f7, +0x24c44813, 0x00df17e0, 0x478b686b, 0x018b840c, +0x4c4afedc, 0xf01e6f45, 0x47b0ee83, 0xe038ef10, +0x7630ad0e, 0xf0390ebb, 0x548a1573, 0x6a06414f, +0x9c80fc98, 0xcf1213d1, 0x518d5610, 0x6eac5208, +0x81552ea2, 0x0e73aff1, 0x9d21bbbe, 0x5bf03e90, +0xf335c45e, 0x11845596, 0x782a7860, 0x28a963b8, +0x6d17c32a, 0xc1d502e8, 0x02292514, 0x7ab01131, +0x00ba1c02, 0xbf5b084f, 0x31422ec8, 0xf2d95b26, +0x08c708ed, 0x0b8de9be, 0xeade0a46, 0x89d7fb10, +0xbf05dec7, 0x1d110815, 0x99b46f83, 0x4e5ec66a, +0xfb811cc3, 0x060c50d3, 0xcd377eef, 0x7206e8eb, +0xe846b1b6, 0x450e0e56, 0x0c22da1b, 0xf0948145, +0x4f54d2d1, 0x1e8d5388, 0xe084d2c7, 0x857634b6, +0x4449c7bc, 0x3082ac8d, 0x72f4d001, 0x7625a80d, +0x7234b778, 0xfce00976, 0x05dbbea8, 0x846c9501, +0xd9293911, 0x81788e3d, 0xdbfdfcc3, 0x2dd50bf1, +0x0324530c, 0x12018802, 0xe7175a15, 0xdf440306, +0x6a030d0b, 0x79803431, 0x7b5420b0, 0xeaa11007, +0x1e4682cb, 0x18f4a114, 0xea03a8d5, 0xef9e7747, +0x8a232c26, 0x145ea435, 0x3f34ed18, 0x1984e8b7, +0xcc040015, 0xdca0163a, 0x186b8758, 0xf6e20a34, +0x4148d054, 0x2d757a7e, 0xa7a8042e, 0x08247543, +0xc3123ba5, 0x0646df0e, 0x0d270434, 0xb91f56ee, +0x088f52ec, 0xbbbe0a06, 0x81040b21, 0x24731cfa, +0x2a940f6e, 0xfd6d5356, 0x38c097ee, 0xb0491585, +0xe3b684f0, 0x073d3adb, 0x7f7c2e86, 0x1b2188fe, +0x2dde96b3, 0x3982fa09, 0x38ff239a, 0x2be8e0ab, +0x4bd07601, 0x941be80d, 0x1f181a90, 0x589703ed, +0x2c148084, 0xd50bbb12, 0xf3897d98, 0x89c01d03, +0x168692ec, 0x640105bb, 0x980794a1, 0xeebbbb35, +0x11bc25e8, 0x4ee85ea9, 0xa6e10486, 0xddd502b2, +0x09d713f7, 0x13e82a39, 0x5ba138be, 0xd68f0aa0, +0x1d1c0e48, 0x2495033b, 0x518f0550, 0x62cbc034, +0xf02324ab, 0x47efbbbf, 0xdc94d406, 0x6712c358, +0x11602130, 0x6c833d83, 0xc0c20761, 0x1416a760, +0x23056629, 0x3b7114e1, 0x299b7622, 0x2f021afc, +0xcf6c12f8, 0x0210b763, 0xc48f0800, 0x14110800, +0x8f463467, 0xb3567f08, 0x227fbcb1, 0x6612a35b, +0x8f810dcb, 0x08dea046, 0x9201898f, 0x0b67d25f, +0x039cdf51, 0x01a00515, 0x6d8c8c08, 0xe98ca8b1, +0x0708a511, 0xb7c8db63, 0x0d7328ad, 0x0d16ff0d, +0xab69762d, 0xf2f8147f, 0x080dc184, 0xc8db62b7, +0x110baa8c, 0x84ef08c0, 0x8dbb3cc5, 0x0f3c367c, +0x0801e40d, 0xb1a8cd8c, 0xe0558aad, 0xdcc71108, +0x284d57c8, 0xc3a73013, 0x1edb7f30, 0x0457b6d9, +0x201e0d20, 0x1404207f, 0xb7236d0d, 0x0801ee73, +0x1115d48c, 0x36d83ced, 0x24d73bf6, 0x08120d22, +0xba01f88c, 0x23f6c8db, 0x08251111, 0xae280219, +0xc6a136be, 0x0847710d, 0xe46832c4, 0x2d0dd916, +0x33168c08, 0x8d632df6, 0x2e700815, 0x3a0d7736, +0x7532d9aa, 0x7318084a, 0xc1b1b6ed, 0x76125b1b, +0x3d08390d, 0xcd4b234d, 0xf80aa55c, 0xb0f25202, +0xdce8ea31, 0x103b07ed, 0x8321ee56, 0x732a721c, +0x321c8319, 0xad0890c8, 0x64190ff7, 0xe6e40190, +0xc832ef01, 0x2bd52721, 0x833369c4, 0x0db3481c, +0xc9c8b830, 0xe9041ec3, 0xf02e1ea5, 0x321c8394, +0x6e8670c8, 0x20d8c875, 0x0d67f823, 0x320d87f9, +0x4bfa5932, 0xe4e4f83a, 0x1e3a20d8, 0x202cf125, +0x233c9d87, 0xc7101bf1, 0xc8793c83, 0xf9f2130a, +0xf272fd00, 0xe8f39390, 0x90d7f41a, 0x0f1e4e43, +0x872cc6f5, 0xb5643c9c, 0xdca4f64e, 0x20c87939, +0x82f76593, 0x0e4f6393, 0x0d74eb90, 0x6472f871, +0xb6669190, 0x8ef96858, 0x4a72320c, 0xfabe3c94, +0x4ed82702, 0xc2190a2e, 0x20d8e495, 0x1d0a23db, +0xfb1e2318, 0xc1d020a2, 0x0c0002b2, 0xdc310042, +0x43ae0433, 0xc4a85127, 0x57561959, 0x09e8edf8, +0xff0e317e, 0xc8fcfad6, 0x25c58909, 0xb6c01682, +0x506e5d41, 0x58fa83fc, 0x20eb0774, 0xbb38eb2b, +0x5788c780, 0xd0246818, 0x7412e65c, 0x1d8f4159, +0x67901476, 0x3d481e6c, 0x164a0d04, 0xa0ed8a17, +0xe672c88d, 0xb108a30b, 0xf510db0e, 0x87cac885, +0x8bac817d, 0x09ef57ed, 0xe4300272, 0x550a88ae, +0x25c9b9c4, 0x093cd803, 0x0205644a, 0x3d0a6f32, +0x0c9724c8, 0x07310c0a, 0x3c0b23f6, 0x1c244c8a, +0x3c9b0b40, 0x7ccb25e4, 0x5c777cf0, 0x3a216432, +0x1325900c, 0x0db59320, 0xc932160c, 0xa6dc7a55, +0xa442f1a2, 0xc8494350, 0xa4e35c58, 0x2fa3c6de, +0x410d4763, 0x35932088, 0x963e3b3a, 0xa9050a8a, +0x44100c2f, 0x9e803b74, 0x203cfa81, 0x630fa89d, +0x6fcd70b9, 0x8925dfe4, 0xca684524, 0x042d82aa, +0x0016c468, 0x3db3504c, 0x82855527, 0xe6b882a6, +0x4bea7ff1, 0x0fd83947, 0x3b810982, 0x5f32335f, +0x75456a75, 0x09765b13, 0xb1617420, 0x9eb7b7fe, +0xa87dc22e, 0x0742130c, 0xc984f87c, 0x7b804a75, +0xb1b84508, 0x2953632a, 0xb7e33456, 0xef7fa402, +0xefb9d1e3, 0x6db1fddb, 0x7b812375, 0x765fff04, +0x23eca312, 0x90c04b78, 0x25a3e0cb, 0x21588b37, +0x87a28375, 0x68399fa0, 0x41d67883, 0xd4e80574, +0x7c0464ec, 0x305b08e4, 0xcde23d83, 0xbc540b62, +0x0d0d2922, 0x628c05d6, 0x62681ba9, 0x9aafc413, +0xf1b06140, 0x3e2058d8, 0xe4c30158, 0xfd7b8861, +0x03bedc40, 0x61e601b5, 0xe608b0b2, 0x54c89543, +0xe60430bc, 0x00b7a142, 0x10d7260b, 0x692a2542, +0x3bb80b05, 0xc3c39d52, 0xc1e80445, 0x6dc22e39, +0x08de7d14, 0x9680fb46, 0xd575831e, 0x7008d002, +0x826d880d, 0x0889c202, 0x5b583153, 0x0410033c, +0x1230a202, 0x4b836855, 0x1b073d77, 0x0456c112, +0x98418202, 0xd23b17fd, 0xd3ba3e3b, 0x2810624d, +0x0b6c1bb5, 0x5728a060, 0x13e0bfdd, 0x4c50878a, +0x803903c4, 0x127fb667, 0x0e1fb007, 0x3016e409, +0x0c25845d, 0xea08eae8, 0x50046b80, 0x74077aa7, +0x254c008d, 0xe204097a, 0xf48c1729, 0x4f0a0b4c, +0x9d9f1f40, 0xf0adf868, 0x80050caa, 0x01e74519, +0xe286d879, 0x962a04a3, 0x0c402a08, 0xeb01cd2a, +0x0609100e, 0xaf2a1440, 0x26029800, 0xd8c937a6, +0x4020ba59, 0x65092824, 0x8c6229ef, 0x9d2a9d02, +0x277c0140, 0x686e30cf, 0x33a26822, 0x681d4dbe, +0xda57163c, 0x761dd52c, 0x2cccc990, 0x0209d04f, +0x66c3b81a, 0x12d4482a, 0x49d98683, 0xe4e031c6, +0xbe1eae2c, 0x097582a5, 0xc7a93103, 0x4dd1ec31, +0xe3f37cf2, 0x0709f8f4, 0x548bac1e, 0x310109c9, +0x0ecd6807, 0x007cd239, 0x2d08c12d, 0x4ecd480c, +0x1c8009e8, 0xc9f66d2d, 0x224857c8, 0xe1948c34, +0x98300521, 0x5b2d9ced, 0x37ea81b7, 0xdb680166, +0x7031a068, 0x5ac63878, 0xde6808d0, 0x7070f168, +0xaee0b005, 0x2081e786, 0x0991409c, 0x284ecef6, +0x2d209ee8, 0x8720f55f, 0x03f56c04, 0xe8af76ee, +0xc0118348, 0x18477f4c, 0xbc40641a, 0x1b7f9fec, +0x4ff97da0, 0x7383d775, 0x588d1b8c, 0x3ae7e8c3, +0x5b03a6aa, 0x7dbf114b, 0x090d8e77, 0x54754b62, +0x9dfcda47, 0x77936ddb, 0xe8209e88, 0xf2990ed8, +0x7d8121aa, 0x2000004e, 0xb06421cb, 0x03c606ad, +0x6c44dbcb, 0xbd0b1f60, 0x8b3f4a14, 0x90b644fc, +0x45e40000, 0x1fff6874, 0x02fa17fe, 0xc5010135, +0x1161dc05, 0xbeadde00, 0xe3ba97ef, 0x505d03c0, +0x8401035e, 0x7fdd203c, 0x5850ffff, 0x696c4345, +0x3a746e65, 0x68637241, 0x3a00303a, 0x49444e55, +0xfb0b320a, 0x31026fff, 0x03010d37, 0x803c2b0c, +0x84838281, 0x5f878685, 0xc07d8b00, 0x323e3603, +0x02586b05, 0x110e067b, 0x56c8df6c, 0x73031365, +0xc594585f, 0x47062bbe, 0xffe063db, 0x46a44fff, +0x4c415441, 0x6f4e203a, 0x61657220, 0x6f6d2d6c, +0x73206564, 0xdd2dd77f, 0xe76b6380, 0x03004121, +0x002b564e, 0x676e6143, 0x6eee6cae, 0x2023746f, +0x21241476, 0x6edfb7fd, 0x17725025, 0x6c6f636f, +0x48444473, 0x54205043, 0x02fe5446, 0x1604adff, +0x0063696e, 0x6b736964, 0x706f6c10, 0xba007970, +0x153bdbed, 0x656e7265, 0x64646142, 0x39252a72, +0xdefbad56, 0x64696fde, 0x6b6e0320, 0x51655b20, +0xdb630d62, 0x2773b6d6, 0x31181b64, 0x330639a4, +0xfb7fb5bb, 0x32380030, 0x6163af38, 0x6565006d, +0x30126e70, 0x4264162d, 0x0d32ac26, 0x64263433, +0x36352642, 0x6ed67237, 0x353863ce, 0x0e9f3236, +0x84d84c61, 0x632c621d, 0x0aff640d, 0x006584ee, +0x35381b0b, 0x2c6d7131, 0x07636bf6, 0x36bbf239, +0x58780d35, 0x5db60d9b, 0x073d076d, 0x360d81b5, +0x587a1732, 0x0cc25b4c, 0xb7350d97, 0x17451b0d, +0x45f7f85e, 0x524f5250, 0x75736e55, 0x74726f68, +0x6d41203e, 0x508b7b61, 0x632522a1, 0x57492201, +0x42db0a2c, 0x20676ee1, 0x0c78d764, 0xf85b613c, +0x3e21eb7f, 0x74667408, 0x2f3a0070, 0x6f4c002f, +0x00206990, 0x25bb2f7a, 0x400b2073, 0x15800e3a, +0x422d5c28, 0x23f1986f, 0xb7b435b6, 0x697372e0, +0x4473c050, 0x17ed0864, 0xd065d46e, 0x7aba6c69, +0x6d203e20, 0x6e12dbd0, 0x280f076b, 0x002e9637, +0x85856b20, 0x72671b1f, 0x40d220b6, 0xadf77b38, +0x204d3450, 0x22676962, 0x2949424e, 0x35ad1c05, +0x17054647, 0x8fbb1024, 0x61013ed1, 0x6d69125e, +0x3c586761, 0x5cdee873, 0x7baceb2b, 0x435f7469, +0xfedb5d70, 0x2008a7c5, 0xd1756f66, 0x530f1a2e, +0x6b99b7bb, 0x10119541, 0x9c654d0a, 0xf75c0040, +0x8d2c8c58, 0x2628200a, 0x0e122906, 0x9b3d83f6, +0x6c65521d, 0x470b7961, 0xd7851d61, 0x0d773416, +0x6583450c, 0x70d75ecd, 0x20f497a9, 0xadb165db, +0x1b09edb9, 0xa025966d, 0xb47caf73, 0xf3976b5b, +0x8e726135, 0x2ec565b9, 0xfcd270c4, 0x3d6e7716, +0x2ed6b7ba, 0x16706d15, 0x7562615b, 0x6c733874, +0x90152b6d, 0x06740e29, 0xcc226b2d, 0x7a462e1a, +0x3364a265, 0xdb6b0705, 0x283380d6, 0x1f2a2925, +0x67495200, 0x4346d68d, 0x001e147f, 0xd22143d1, +0x5049902f, 0xc3887a4a, 0x0a5be193, 0x69656306, +0x6299f976, 0xee876bb4, 0x756e8c06, 0xb564733a, +0x6b7609b2, 0x445576ad, 0x58270630, 0x044f6d75, +0x0a748a7b, 0x7f64f7a0, 0x2fc7056b, 0x78302007, +0x54286c25, 0x98682dd6, 0x66f443f0, 0xd190726f, +0x6585dc0a, 0x311122c9, 0x34f06e6b, 0xf5dd286c, +0x39f27665, 0x4a237079, 0x2b6dbdad, 0x7927588b, +0x5f895227, 0xec7876ad, 0x6c20666f, 0x4e6c7275, +0x5ae70e14, 0x44197361, 0xb9c33f6e, 0xb1dcc6c4, +0x5a622c0e, 0x5bb36173, 0x2790c65b, 0x175d07db, +0xf7696370, 0xd2a50bfd, 0x1929e232, 0x43424139, +0x3d464544, 0xe6d6facc, 0x6868032e, 0x01673a58, +0xe3e37500, 0x395f2fd1, 0x4f6f205b, 0x0a187753, +0x7ea431ae, 0x2e352781, 0x52bd9734, 0xca6f2ea5, +0xd2203418, 0x166217c6, 0x4c504784, 0x23746829, +0xa6b0e146, 0x2e1c6522, 0xa078bb09, 0xad44de95, +0x20805403, 0x50ee1d1c, 0xd00d0785, 0x9f60f720, +0x007f116e, 0x73887845, 0xd6db0e3a, 0x6d27b6de, +0x775f6ffc, 0x57287a3a, 0x186b6d74, 0xaea93c0a, +0x2110776d, 0x688fdbd8, 0xd93d20f3, 0x270a2e58, +0x12051a90, 0x588d26d9, 0x1835b6c6, 0xac32da3a, +0x8e611e78, 0x0dd1d1d0, 0xcb69306d, 0x3063946c, +0x8bb747b4, 0x532ce870, 0xdd26f549, 0x3a9de592, +0x6a6e4998, 0xb18cbc2d, 0x25184d3e, 0x0a2c4423, +0x0e9815ad, 0x7839f9e1, 0xdc75cd6b, 0x0465625c, +0x350e5365, 0x6105ed12, 0x7369bdc3, 0x0ae257f1, +0x5c1b02ed, 0x30344338, 0xeb6cfd33, 0x2b76152d, +0x2c8e3c63, 0xd6b46843, 0x31676431, 0x58bd4a8f, +0x5cb854e1, 0x377ac7ab, 0x21b1d7b5, 0x7974ab67, +0x746763ca, 0xd4b70c68, 0x44320b66, 0x6b8d0a63, +0x3852b46b, 0x70d791ee, 0xe0706051, 0x4e5e7206, +0x422c9402, 0x86ffcbc3, 0xd2303bc5, 0x213fd6ce, +0x1075803d, 0x6b0c6d19, 0x5f733009, 0x0a061a6c, +0x6d04edce, 0x25809aba, 0xd558b5a1, 0x06b11dee, +0x33f3a3d9, 0x6d612c92, 0x30932e61, 0xc261562f, +0xa9651856, 0xd7073c20, 0x34fd23c0, 0x041fd76f, +0xe26bc781, 0x462f4538, 0xfb32d133, 0x702e8f05, +0xb61b630b, 0x6b0e6230, 0xf1621f0a, 0x6d0bb165, +0xc707fd48, 0xde696e67, 0x96582946, 0x3e777d3e, +0x96c01621, 0x222f3273, 0x8a75eec7, 0xe96c6975, +0xc2b86ade, 0x64b18709, 0xe57652b7, 0x33a63a5f, +0xac78dc14, 0x78c53772, 0xc3b27590, 0x0cbe2978, +0x0f29000a, 0x73c09c0e, 0x037c288c, 0x0cdac536, +0x326e2007, 0x3e7978c7, 0x222c5bdc, 0x65757186, +0x084008d1, 0x24f0cdb1, 0x73638a2b, 0xb92c1879, +0x646d27a6, 0x2d4620fc, 0x00c5bdb6, 0x545245a1, +0x8fdc6783, 0x844345c2, 0x70d65861, 0x8705c782, +0x512d52eb, 0x75672620, 0xb0df70a6, 0x87367942, +0x0d074fd0, 0x83ba1ee7, 0x8a767077, 0xb62549a4, +0x4674b40b, 0x19666692, 0x63ac2b21, 0x791113b9, +0xe1000058, 0x9e058668, 0x974f4f42, 0x3a33002d, +0xf13c1883, 0x6e00f600, 0xf3ea6bb8, 0x816c7e68, +0xcb623436, 0x82524142, 0x19df7b9b, 0x3a783830, +0x6f132004, 0xa602c273, 0x2184d057, 0x6c3564d2, +0xe1833867, 0x0aba8170, 0x7dce2300, 0x23d62119, +0x28003f58, 0x6a5d6181, 0x3a5225f9, 0x73c11bc0, +0xc1796141, 0x1b050f80, 0xdd578af6, 0x2e8b3210, +0x5efa7bd6, 0x1a7555fe, 0x016b58ae, 0x17cf6e61, +0xa71d1c06, 0x6db37561, 0xcd6e860c, 0x400312d0, +0x6fff26c7, 0x85b5c32e, 0x0a7529dd, 0xa9b84647, +0x8305c60b, 0x6867ed46, 0xb4223cb8, 0x76b746c3, +0xc83d602e, 0x00dabb75, 0x1f1d278f, 0x51079d08, +0xbfc0142d, 0xd9c84070, 0x1ff17ab1, 0x9307cf9f, +0x360d95b0, 0x1f93179b, 0xb6016e00, 0x27021009, +0xb2032bc0, 0x30d81760, 0x03082292, 0xfd468d00, +0x8024168e, 0xfb9f9e32, 0x60f6f04b, 0xb648f200, +0xba3f80f2, 0x10298086, 0x91079266, 0x30f91e47, +0x10316d10, 0x7d103274, 0xe4791e47, 0x348b1033, +0x10359910, 0x1e1036a7, 0xb591e479, 0x38c31037, +0x1039d110, 0x91e479d8, 0xe0103a47, 0x3ce7103b, +0xcfc8f010, 0x103d1e47, 0x0c103efe, 0x1a105193, +0xf23c8f23, 0x09201059, 0x12272812, 0x3d9e2830, +0x3612c8f2, 0x493c1229, 0x242f4524, 0x91ec1b4d, +0x245d07c7, 0x5d105055, 0x1007654f, 0xfa14b63e, +0x52010773, 0x40179381, 0x01ae1284, 0x14b50537, +0x41be43d5, 0x2a1a0240, 0x037ef8b7, 0x664693f1, +0xb0daadba, 0xbf0fce03, 0x4ffd9609, 0x803f0405, +0x63538263, 0x51800b96, 0x05afd8f6, 0x0302b16b, +0x9615ec87, 0xb8006dc2, 0x86550344, 0x2200b7aa, +0xdb2bec0a, 0x2bbfd23f, 0x7f4507d0, 0x9d957842, +0xc0375e54, 0x00006d05, 0x2000c000, 0xffff0001, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, +0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/etherboot/make-eb-rom-list --- a/tools/firmware/etherboot/make-eb-rom-list Mon Apr 14 14:04:58 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/bin/bash -set -e -roms=$1; shift -echo "/* autogenerated - do not edit */" -echo "#define ETHERBOOT_ROM_LIST \\" -for nic in "$@"; do - makerom=`grep "^MAKEROM_ID_$nic *= *-p *" <$roms` - echo " ETHERBOOT_ROM($nic,${makerom#*-p}) \\" -done -echo -echo "/*end.*/" diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/extboot/Makefile --- a/tools/firmware/extboot/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/extboot/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -1,15 +1,7 @@ +XEN_ROOT = ../../.. +include $(XEN_ROOT)/tools/firmware/Rules.mk -override XEN_TARGET_ARCH = x86_32 -XEN_ROOT = ../../.. -CFLAGS := -I$(XEN_ROOT)/tools/libxc -I. -include $(XEN_ROOT)/tools/Rules.mk - -# Disable PIE/SSP if GCC supports them. They can break us. -CFLAGS += $(call cc-option,$(CC),-nopie,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) - -CFLAGS += -fno-builtin -O2 -msoft-float +CFLAGS += -I$(XEN_ROOT)/tools/libxc -I. .PHONY: all all: extboot.bin diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/hvmloader/Makefile --- a/tools/firmware/hvmloader/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/hvmloader/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -18,33 +18,26 @@ # Place - Suite 330, Boston, MA 02111-1307 USA. # -override XEN_TARGET_ARCH = x86_32 XEN_ROOT = ../../.. -CFLAGS := -include $(XEN_ROOT)/tools/Rules.mk +include $(XEN_ROOT)/tools/firmware/Rules.mk SUBDIRS := acpi # The HVM loader is started in 32-bit mode at the address below: LOADADDR = 0x100000 -# Disable PIE/SSP if GCC supports them. They can break us. -CFLAGS += $(call cc-option,$(CC),-nopie,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) +CFLAGS += $(CFLAGS_include) -I. -CFLAGS += -fno-builtin -O2 -msoft-float -CFLAGS += $(CFLAGS_include) -I. - -SRCS = hvmloader.c mp_tables.c util.c smbios.c 32bitbios_support.c +SRCS = hvmloader.c mp_tables.c util.c smbios.c 32bitbios_support.c smp.c OBJS = $(patsubst %.c,%.o,$(SRCS)) .PHONY: all all: hvmloader +hvmloader.o: roms.h smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(shell date +%m/%d/%Y)\"" -hvmloader: roms.h subdirs-all $(OBJS) +hvmloader: subdirs-all $(OBJS) $(LD) $(LDFLAGS_DIRECT) -N -Ttext $(LOADADDR) \ -o hvmloader.tmp $(OBJS) acpi/acpi.a $(OBJCOPY) hvmloader.tmp hvmloader diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/hvmloader/acpi/Makefile --- a/tools/firmware/hvmloader/acpi/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/hvmloader/acpi/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -15,10 +15,8 @@ # Place - Suite 330, Boston, MA 02111-1307 USA. # -override XEN_TARGET_ARCH = x86_32 XEN_ROOT = ../../../.. -CFLAGS := -include $(XEN_ROOT)/tools/Rules.mk +include $(XEN_ROOT)/tools/firmware/Rules.mk C_SRC = build.c dsdt.c static_tables.c H_SRC = $(wildcard *.h) @@ -27,13 +25,7 @@ IASL_VER = acpica-unix-20060707 IASL_VER = acpica-unix-20060707 IASL_URL = http://developer.intel.com/technology/iapc/acpi/downloads/$(IASL_VER).tar.gz -# Disable PIE/SSP if GCC supports them. They can break us. -CFLAGS += $(call cc-option,$(CC),-nopie,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) - -CFLAGS += -fno-builtin -O2 -msoft-float -CFLAGS += -I. -I.. $(CFLAGS_include) +CFLAGS += -I. -I.. $(CFLAGS_include) vpath iasl $(PATH) all: acpi.a diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/hvmloader/hvmloader.c --- a/tools/firmware/hvmloader/hvmloader.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/hvmloader/hvmloader.c Tue Apr 15 11:09:46 2008 -0600 @@ -28,10 +28,11 @@ #include "apic_regs.h" #include "pci_regs.h" #include "e820.h" +#include "option_rom.h" #include #include -asm( +asm ( " .text \n" " .globl _start \n" "_start: \n" @@ -97,6 +98,7 @@ asm( "stack_top: \n" ); +void smp_initialise(void); void create_mp_tables(void); int hvm_write_smbios_tables(void); @@ -105,14 +107,6 @@ cirrus_check(void) { outw(0x3C4, 0x9206); return inb(0x3C5) == 0x12; -} - -static void -wrmsr(uint32_t idx, uint64_t v) -{ - __asm__ __volatile__ ( - "wrmsr" - : : "c" (idx), "a" ((uint32_t)v), "d" ((uint32_t)(v>>32)) ); } static void @@ -130,11 +124,7 @@ init_hypercalls(void) *(uint32_t *)(signature + 8) = edx; signature[12] = '\0'; - if ( strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002) ) - { - printf("FATAL: Xen hypervisor not detected\n"); - __asm__ __volatile__( "ud2" ); - } + BUG_ON(strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002)); /* Fill in hypercall transfer pages. */ cpuid(0x40000002, &eax, &ebx, &ecx, &edx); @@ -334,21 +324,13 @@ static int must_load_extboot(void) */ static int scan_etherboot_nic(void *copy_rom_dest) { - static struct etherboots_table_entry { - char *name; - void *etherboot_rom; - int etherboot_sz; - uint16_t vendor, device; - } etherboots_table[] = { -#define ETHERBOOT_ROM(name, vendor, device) \ - { #name, etherboot_##name, sizeof(etherboot_##name), vendor, device }, - ETHERBOOT_ROM_LIST - { 0 } - }; - + struct option_rom_header *rom; + struct option_rom_pnp_header *pnph; + struct option_rom_pci_header *pcih; uint32_t devfn; uint16_t class, vendor_id, device_id; - struct etherboots_table_entry *eb; + uint8_t csum; + int i; for ( devfn = 0; devfn < 128; devfn++ ) { @@ -359,21 +341,62 @@ static int scan_etherboot_nic(void *copy if ( (vendor_id == 0xffff) && (device_id == 0xffff) ) continue; - if ( class != 0x0200 ) /* Not a NIC */ + /* We're only interested in NICs. */ + if ( class != 0x0200 ) continue; - for ( eb = etherboots_table; eb->name; eb++ ) - if (eb->vendor == vendor_id && - eb->device == device_id) + rom = (struct option_rom_header *)etherboot; + for ( ; ; ) + { + /* Invalid signature means we're out of option ROMs. */ + if ( strncmp((char *)rom->signature, "\x55\xaa", 2) || + (rom->rom_size == 0) ) + break; + + /* Invalid checksum means we're out of option ROMs. */ + csum = 0; + for ( i = 0; i < (rom->rom_size * 512); i++ ) + csum += ((uint8_t *)rom)[i]; + if ( csum != 0 ) + break; + + /* Check the PCI PnP header (if any) for a match. */ + pcih = (struct option_rom_pci_header *) + ((char *)rom + rom->pci_header_offset); + if ( (rom->pci_header_offset != 0) && + !strncmp((char *)pcih->signature, "PCIR", 4) && + (pcih->vendor_id == vendor_id) && + (pcih->device_id == device_id) ) goto found; + + rom = (struct option_rom_header *) + ((char *)rom + rom->rom_size * 512); + } } return 0; found: - printf("Loading %s Etherboot PXE ROM ...\n", eb->name); - memcpy(copy_rom_dest, eb->etherboot_rom, eb->etherboot_sz); - return eb->etherboot_sz; + /* Find the PnP expansion header (if any). */ + pnph = ((rom->expansion_header_offset != 0) + ? ((struct option_rom_pnp_header *) + ((char *)rom + rom->expansion_header_offset)) + : ((struct option_rom_pnp_header *)NULL)); + while ( (pnph != NULL) && strncmp((char *)pnph->signature, "$PnP", 4) ) + pnph = ((pnph->next_header_offset != 0) + ? ((struct option_rom_pnp_header *) + ((char *)rom + pnph->next_header_offset)) + : ((struct option_rom_pnp_header *)NULL)); + + printf("Loading PXE ROM ...\n"); + if ( (pnph != NULL) && (pnph->manufacturer_name_offset != 0) ) + printf(" - Manufacturer: %s\n", + (char *)rom + pnph->manufacturer_name_offset); + if ( (pnph != NULL) && (pnph->product_name_offset != 0) ) + printf(" - Product name: %s\n", + (char *)rom + pnph->product_name_offset); + memcpy(copy_rom_dest, rom, rom->rom_size * 512); + return rom->rom_size * 512; } /* Replace possibly erroneous memory-size CMOS fields with correct values. */ @@ -421,6 +444,8 @@ int main(void) init_hypercalls(); printf("CPU speed is %u MHz\n", get_cpu_mhz()); + + smp_initialise(); printf("Writing SMBIOS tables ...\n"); smbios_sz = hvm_write_smbios_tables(); diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/hvmloader/option_rom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/firmware/hvmloader/option_rom.h Tue Apr 15 11:09:46 2008 -0600 @@ -0,0 +1,50 @@ +#ifndef __HVMLOADER_OPTION_ROM_H__ +#define __HVMLOADER_OPTION_ROM_H__ + +#include + +struct option_rom_header { + uint8_t signature[2]; /* "\x55\xaa" */ + uint8_t rom_size; /* 512-byte increments */ + uint32_t entry_point; + uint8_t reserved[17]; + uint16_t pci_header_offset; + uint16_t expansion_header_offset; +} __attribute__ ((packed)); + +struct option_rom_pnp_header { + uint8_t signature[4]; /* "$PnP" */ + uint8_t structure_revision; + uint8_t structure_length; /* 16-byte increments */ + uint16_t next_header_offset; + uint8_t reserved; + uint8_t checksum; + uint32_t device_id; + uint16_t manufacturer_name_offset; + uint16_t product_name_offset; + uint8_t device_type_code[3]; + uint8_t device_indicators; + uint16_t boot_connection_vector; + uint16_t disconnect_vector; + uint16_t bootstap_entry_vector; + uint16_t reserved2; + uint16_t static_resource_information_vector; +} __attribute__ ((packed)); + + +struct option_rom_pci_header { + uint8_t signature[4]; /* "PCIR" */ + uint16_t vendor_id; + uint16_t device_id; + uint16_t vital_product_data_offset; + uint16_t structure_length; + uint8_t structure_revision; + uint8_t class_code[3]; + uint16_t image_length; + uint16_t image_revision; + uint8_t code_type; + uint8_t indicator; + uint16_t reserved; +} __attribute__ ((packed)); + +#endif /* __HVMLOADER_OPTION_ROM_H__ */ diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/hvmloader/smp.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/firmware/hvmloader/smp.c Tue Apr 15 11:09:46 2008 -0600 @@ -0,0 +1,132 @@ +/* + * smp.c: Secondary processor bringup and initialisation. + * + * Copyright (c) 2008, Citrix Systems, Inc. + * + * Authors: + * Keir Fraser + * + * 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + */ + +#include "util.h" +#include "config.h" +#include "apic_regs.h" + +#define AP_BOOT_EIP 0x1000 +extern char ap_boot_start[], ap_boot_end[]; + +static int ap_callin, ap_cpuid; + +asm ( + " .text \n" + " .code16 \n" + "ap_boot_start: .code16 \n" + " mov %cs,%ax \n" + " mov %ax,%ds \n" + " lgdt gdt_desr-ap_boot_start\n" + " xor %ax, %ax \n" + " inc %ax \n" + " lmsw %ax \n" + " ljmpl $0x08,$1f \n" + "gdt_desr: \n" + " .word gdt_end - gdt - 1 \n" + " .long gdt \n" + "ap_boot_end: .code32 \n" + "1: mov $0x10,%eax \n" + " mov %eax,%ds \n" + " mov %eax,%es \n" + " mov %eax,%ss \n" + " movl $stack_top,%esp \n" + " movl %esp,%ebp \n" + " call ap_start \n" + "1: hlt \n" + " jmp 1b \n" + " \n" + " .align 8 \n" + "gdt: \n" + " .quad 0x0000000000000000 \n" + " .quad 0x00cf9a000000ffff \n" /* 0x08: Flat code segment */ + " .quad 0x00cf92000000ffff \n" /* 0x10: Flat data segment */ + "gdt_end: \n" + " \n" + " .bss \n" + " .align 8 \n" + "stack: \n" + " .skip 0x4000 \n" + "stack_top: \n" + ); + +/*static*/ void ap_start(void) +{ + printf(" - CPU%d ... ", ap_cpuid); + + printf("done.\n"); + wmb(); + ap_callin = 1; +} + +static void lapic_wait_ready(void) +{ + while ( lapic_read(APIC_ICR) & APIC_ICR_BUSY ) + cpu_relax(); +} + +static void boot_cpu(unsigned int cpu) +{ + unsigned int icr2 = SET_APIC_DEST_FIELD(LAPIC_ID(cpu)); + + /* Initialise shared variables. */ + ap_cpuid = cpu; + ap_callin = 0; + wmb(); + + /* Wake up the secondary processor: INIT-SIPI-SIPI... */ + lapic_wait_ready(); + lapic_write(APIC_ICR2, icr2); + lapic_write(APIC_ICR, APIC_DM_INIT); + lapic_wait_ready(); + lapic_write(APIC_ICR2, icr2); + lapic_write(APIC_ICR, APIC_DM_STARTUP | (AP_BOOT_EIP >> 12)); + lapic_wait_ready(); + lapic_write(APIC_ICR2, icr2); + lapic_write(APIC_ICR, APIC_DM_STARTUP | (AP_BOOT_EIP >> 12)); + lapic_wait_ready(); + + /* + * Wait for the secondary processor to complete initialisation. + * Do not touch shared resources meanwhile. + */ + while ( !ap_callin ) + cpu_relax(); + + /* Take the secondary processor offline. */ + lapic_write(APIC_ICR2, icr2); + lapic_write(APIC_ICR, APIC_DM_INIT); + lapic_wait_ready(); +} + +void smp_initialise(void) +{ + unsigned int i, nr_cpus = get_vcpu_nr(); + + if ( nr_cpus <= 1 ) + return; + + memcpy((void *)AP_BOOT_EIP, ap_boot_start, ap_boot_end - ap_boot_start); + + printf("Multiprocessor initialisation:\n"); + for ( i = 1; i < nr_cpus; i++ ) + boot_cpu(i); +} diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/hvmloader/util.c --- a/tools/firmware/hvmloader/util.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/hvmloader/util.c Tue Apr 15 11:09:46 2008 -0600 @@ -27,39 +27,57 @@ #include #include +void wrmsr(uint32_t idx, uint64_t v) +{ + asm volatile ( + "wrmsr" + : : "c" (idx), "a" ((uint32_t)v), "d" ((uint32_t)(v>>32)) ); +} + +uint64_t rdmsr(uint32_t idx) +{ + uint32_t lo, hi; + + asm volatile ( + "rdmsr" + : "=a" (lo), "=d" (hi) : "c" (idx) ); + + return (lo | ((uint64_t)hi << 32)); +} + void outb(uint16_t addr, uint8_t val) { - __asm__ __volatile__ ( "outb %%al, %%dx" : : "d" (addr), "a" (val) ); + asm volatile ( "outb %%al, %%dx" : : "d" (addr), "a" (val) ); } void outw(uint16_t addr, uint16_t val) { - __asm__ __volatile__ ( "outw %%ax, %%dx" : : "d" (addr), "a" (val) ); + asm volatile ( "outw %%ax, %%dx" : : "d" (addr), "a" (val) ); } void outl(uint16_t addr, uint32_t val) { - __asm__ __volatile__ ( "outl %%eax, %%dx" : : "d" (addr), "a" (val) ); + asm volatile ( "outl %%eax, %%dx" : : "d" (addr), "a" (val) ); } uint8_t inb(uint16_t addr) { uint8_t val; - __asm__ __volatile__ ( "inb %%dx,%%al" : "=a" (val) : "d" (addr) ); + asm volatile ( "inb %%dx,%%al" : "=a" (val) : "d" (addr) ); return val; } uint16_t inw(uint16_t addr) { uint16_t val; - __asm__ __volatile__ ( "inw %%dx,%%ax" : "=a" (val) : "d" (addr) ); + asm volatile ( "inw %%dx,%%ax" : "=a" (val) : "d" (addr) ); return val; } uint32_t inl(uint16_t addr) { uint32_t val; - __asm__ __volatile__ ( "inl %%dx,%%eax" : "=a" (val) : "d" (addr) ); + asm volatile ( "inl %%dx,%%eax" : "=a" (val) : "d" (addr) ); return val; } @@ -118,7 +136,7 @@ void *memcpy(void *dest, const void *src { int t0, t1, t2; - __asm__ __volatile__ ( + asm volatile ( "cld\n" "rep; movsl\n" "testb $2,%b4\n" @@ -219,7 +237,7 @@ void void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { - __asm__ __volatile__ ( + asm volatile ( "cpuid" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "0" (idx) ); @@ -516,14 +534,14 @@ void __assert_failed(char *assertion, ch printf("HVMLoader assertion '%s' failed at %s:%d\n", assertion, file, line); for ( ; ; ) - __asm__ __volatile__ ( "ud2" ); + asm volatile ( "ud2" ); } void __bug(char *file, int line) { printf("HVMLoader bug at %s:%d\n", file, line); for ( ; ; ) - __asm__ __volatile__ ( "ud2" ); + asm volatile ( "ud2" ); } static int validate_hvm_info(struct hvm_info_table *t) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/hvmloader/util.h --- a/tools/firmware/hvmloader/util.h Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/hvmloader/util.h Tue Apr 15 11:09:46 2008 -0600 @@ -18,6 +18,10 @@ void __bug(char *file, int line) __attri #define BUG() __bug(__FILE__, __LINE__) #define BUG_ON(p) do { if (p) BUG(); } while (0) #define BUILD_BUG_ON(p) ((void)sizeof(char[1 - 2 * !!(p)])) + +/* MSR access */ +void wrmsr(uint32_t idx, uint64_t v); +uint64_t rdmsr(uint32_t idx); /* I/O output */ void outb(uint16_t addr, uint8_t val); @@ -74,6 +78,7 @@ static inline void cpu_relax(void) #define barrier() asm volatile ( "" : : : "memory" ) #define rmb() barrier() #define wmb() barrier() +#define mb() asm volatile ( "lock; addl $0,0(%%esp)" : : : "memory" ) /* * Divide a 64-bit dividend by a 32-bit divisor. diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/rombios/32bit/Makefile --- a/tools/firmware/rombios/32bit/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/rombios/32bit/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -1,16 +1,10 @@ - -override XEN_TARGET_ARCH = x86_32 XEN_ROOT = ../../../.. -CFLAGS := -include $(XEN_ROOT)/tools/Rules.mk +include $(XEN_ROOT)/tools/firmware/Rules.mk SOURCES = util.c TARGET = 32bitbios_flat.h -CFLAGS += -fno-builtin -O2 -msoft-float -nostdlib CFLAGS += -I../ -DGCC_PROTOS -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) SUBDIRS = tcgbios diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/rombios/32bit/tcgbios/Makefile --- a/tools/firmware/rombios/32bit/tcgbios/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/rombios/32bit/tcgbios/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -1,16 +1,10 @@ - -override XEN_TARGET_ARCH = x86_32 XEN_ROOT = ../../../../.. -CFLAGS := -include $(XEN_ROOT)/tools/Rules.mk +include $(XEN_ROOT)/tools/firmware/Rules.mk TARGET = tcgbiosext.o FILES = tcgbios tpm_drivers OBJECTS = $(foreach f,$(FILES),$(f).o) -CFLAGS += -fno-builtin -O2 -msoft-float -nostdlib -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) CFLAGS += -I../ -I../../ -DGCC_PROTOS .PHONY: all clean diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/firmware/rombios/32bit/tcgbios/tcgbios.c --- a/tools/firmware/rombios/32bit/tcgbios/tcgbios.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/firmware/rombios/32bit/tcgbios/tcgbios.c Tue Apr 15 11:09:46 2008 -0600 @@ -923,7 +923,7 @@ uint32_t HashLogExtendEvent32(struct hle struct hlei hlei ; /* HashLogEventInput block */ struct hleo hleo; /* HashLogEventOutput block */ struct hleei_long *hleei_l = (struct hleei_long *)hleei_s; - int sh; + int sh = 0; uint32_t logdataptr; if (TCG_IsShutdownPreBootInterface() != 0) { diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/Makefile --- a/tools/ioemu/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -35,7 +35,7 @@ endif endif endif -TOOLS= +TOOLS=tapdisk-ioemu all: $(TOOLS) $(DOCS) recurse-all @@ -43,6 +43,13 @@ subdir-%: $(MAKE) -C $(subst subdir-,,$@) all recurse-all: $(patsubst %,subdir-%, $(TARGET_DIRS)) + +tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/libxc +tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/blktap/lib +tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/xenstore +tapdisk-ioemu: CPPFLAGS += -I$(XEN_ROOT)/tools/include +tapdisk-ioemu: tapdisk-ioemu.c cutils.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c hw/xen_blktap.c osdep.c + $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) qemu-img$(EXESUF): qemu-img.c cutils.c block.c block-raw.c block-cow.c block-qcow.c aes.c block-vmdk.c block-cloop.c block-dmg.c block-bochs.c block-vpc.c block-vvfat.c block-qcow2.c $(CC) -DQEMU_TOOL $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(LDFLAGS) $(BASE_LDFLAGS) -o $@ $^ -lz $(LIBS) @@ -80,7 +87,7 @@ endif install: all $(if $(BUILD_DOCS),install-doc) mkdir -p "$(DESTDIR)$(bindir)" -# $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" + $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(prefix)/sbin" # mkdir -p "$(DESTDIR)$(datadir)" # for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ # video.x openbios-sparc32 linux_boot.bin pxe-ne2k_pci.bin \ diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/block-cow.c --- a/tools/ioemu/block-cow.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/block-cow.c Tue Apr 15 11:09:46 2008 -0600 @@ -246,10 +246,11 @@ static int cow_create(const char *filena return 0; } -static void cow_flush(BlockDriverState *bs) +static int cow_flush(BlockDriverState *bs) { BDRVCowState *s = bs->opaque; fsync(s->fd); + return 0; } BlockDriver bdrv_cow = { diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/block-vbd.c --- a/tools/ioemu/block-vbd.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/block-vbd.c Tue Apr 15 11:09:46 2008 -0600 @@ -49,11 +49,7 @@ typedef struct BDRVVbdState { typedef struct BDRVVbdState { struct blkfront_dev *dev; int fd; - int type; - int mode; - int info; - uint64_t sectors; - unsigned sector_size; + struct blkfront_info info; QEMU_LIST_ENTRY(BDRVVbdState) list; } BDRVVbdState; @@ -81,13 +77,13 @@ static int vbd_open(BlockDriverState *bs //handy to test posix access //return -EIO; - s->dev = init_blkfront((char *) filename, &s->sectors, &s->sector_size, &s->mode, &s->info); + s->dev = init_blkfront((char *) filename, &s->info); if (!s->dev) return -EIO; - if (SECTOR_SIZE % s->sector_size) { - printf("sector size is %d, we only support sector sizes that divide %d\n", s->sector_size, SECTOR_SIZE); + if (SECTOR_SIZE % s->info.sector_size) { + printf("sector size is %d, we only support sector sizes that divide %d\n", s->info.sector_size, SECTOR_SIZE); return -EIO; } @@ -267,6 +263,32 @@ static void vbd_aio_cancel(BlockDriverAI // Try to cancel. If can't, wait for it, drop the callback and call qemu_aio_release(acb) } +static void vbd_nop_cb(void *opaque, int ret) +{ +} + +static BlockDriverAIOCB *vbd_aio_flush(BlockDriverState *bs, + BlockDriverCompletionFunc *cb, void *opaque) +{ + BDRVVbdState *s = bs->opaque; + VbdAIOCB *acb = NULL; + + if (s->info.barrier == 1) { + acb = vbd_aio_setup(bs, 0, NULL, 0, + s->info.flush == 1 ? vbd_nop_cb : cb, opaque); + if (!acb) + return NULL; + blkfront_aio_push_operation(&acb->aiocb, BLKIF_OP_WRITE_BARRIER); + } + if (s->info.flush == 1) { + acb = vbd_aio_setup(bs, 0, NULL, 0, cb, opaque); + if (!acb) + return NULL; + blkfront_aio_push_operation(&acb->aiocb, BLKIF_OP_FLUSH_DISKCACHE); + } + return &acb->common; +} + static void vbd_close(BlockDriverState *bs) { BDRVVbdState *s = bs->opaque; @@ -282,13 +304,14 @@ static int64_t vbd_getlength(BlockDrive static int64_t vbd_getlength(BlockDriverState *bs) { BDRVVbdState *s = bs->opaque; - return s->sectors * s->sector_size; -} - -static void vbd_flush(BlockDriverState *bs) + return s->info.sectors * s->info.sector_size; +} + +static int vbd_flush(BlockDriverState *bs) { BDRVVbdState *s = bs->opaque; blkfront_sync(s->dev); + return 0; } /***********************************************/ @@ -333,6 +356,7 @@ BlockDriver bdrv_vbd = { .bdrv_aio_read = vbd_aio_read, .bdrv_aio_write = vbd_aio_write, .bdrv_aio_cancel = vbd_aio_cancel, + .bdrv_aio_flush = vbd_aio_flush, .aiocb_size = sizeof(VbdAIOCB), .bdrv_read = vbd_read, .bdrv_write = vbd_write, diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/block.c --- a/tools/ioemu/block.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/block.c Tue Apr 15 11:09:46 2008 -0600 @@ -347,8 +347,8 @@ int bdrv_open2(BlockDriverState *bs, con BlockDriver *drv) { int ret, open_flags; - char tmp_filename[1024]; - char backing_filename[1024]; + char tmp_filename[PATH_MAX]; + char backing_filename[PATH_MAX]; bs->read_only = 0; bs->is_temporary = 0; diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/hw/ide.c --- a/tools/ioemu/hw/ide.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/hw/ide.c Tue Apr 15 11:09:46 2008 -0600 @@ -655,12 +655,13 @@ static void ide_identify(IDEState *s) put_le16(p + 68, 120); put_le16(p + 80, 0xf0); /* ata3 -> ata6 supported */ put_le16(p + 81, 0x16); /* conforms to ata5 */ - put_le16(p + 82, (1 << 14)); + /* 14=nop 5=write_cache */ + put_le16(p + 82, (1 << 14) | (1 << 5)); /* 13=flush_cache_ext,12=flush_cache,10=lba48 */ put_le16(p + 83, (1 << 14) | (1 << 13) | (1 <<12) | (1 << 10)); put_le16(p + 84, (1 << 14)); /* 14=nop 5=write_cache */ - put_le16(p + 85, (1 << 14) | (1 << 5)); + put_le16(p + 85, (1 << 14) | (s->write_cache << 5)); /* 13=flush_cache_ext,12=flush_cache,10=lba48 */ put_le16(p + 86, (1 << 14) | (1 << 13) | (1 <<12) | (1 << 10)); put_le16(p + 87, (1 << 14)); diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/hw/rtl8139.c --- a/tools/ioemu/hw/rtl8139.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/hw/rtl8139.c Tue Apr 15 11:09:46 2008 -0600 @@ -1416,12 +1416,28 @@ static uint32_t rtl8139_ChipCmd_read(RTL static void rtl8139_CpCmd_write(RTL8139State *s, uint32_t val) { + int i; + val &= 0xffff; DEBUG_PRINT(("RTL8139C+ command register write(w) val=0x%04x\n", val)); /* mask unwriteable bits */ val = SET_MASKED(val, 0xff84, s->CpCmd); + + if ( (s->CpCmd & CPlusTxEnb) && + !(val & CPlusTxEnb) ) + { + /* Reset TX status when the transmitter drops from C+ to + non-C+ mode. Windows has a habit of turning off C+ and + then waiting for the TX requests to clear as part of shut + down, and you get stuck forever if there are old DTCRs in + the registers. */ + for (i = 0; i < 4; i++) + { + s->TxStatus[i] = TxHostOwns; + } + } s->CpCmd = val; } @@ -1765,6 +1781,7 @@ static int rtl8139_transmit_one(RTL8139S { DEBUG_PRINT(("RTL8139: +++ cannot transmit from descriptor %d: transmitter disabled\n", descriptor)); + s->TxStatus[descriptor] = TxAborted | TxHostOwns; return 0; } @@ -1772,6 +1789,7 @@ static int rtl8139_transmit_one(RTL8139S { DEBUG_PRINT(("RTL8139: +++ cannot transmit from descriptor %d: owned by host (%08x)\n", descriptor, s->TxStatus[descriptor])); + s->TxStatus[descriptor] = TxAborted | TxHostOwns; return 0; } diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/hw/xen_machine_fv.c --- a/tools/ioemu/hw/xen_machine_fv.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/hw/xen_machine_fv.c Tue Apr 15 11:09:46 2008 -0600 @@ -205,6 +205,7 @@ static void xen_init_fv(uint64_t ram_siz } #endif + xc_set_hvm_param(xc_handle, domid, HVM_PARAM_DM_DOMAIN, DOMID_SELF); xc_get_hvm_param(xc_handle, domid, HVM_PARAM_IOREQ_PFN, &ioreq_pfn); fprintf(logfile, "shared page at pfn %lx\n", ioreq_pfn); shared_page = xc_map_foreign_range(xc_handle, domid, XC_PAGE_SIZE, diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/osdep.c --- a/tools/ioemu/osdep.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/osdep.c Tue Apr 15 11:09:46 2008 -0600 @@ -21,6 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + +#include "config-host.h" #include #include #include @@ -32,7 +34,6 @@ #include #endif -#include "cpu.h" #if defined(USE_KQEMU) #include "vl.h" #endif diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/qemu-img.c --- a/tools/ioemu/qemu-img.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/qemu-img.c Tue Apr 15 11:09:46 2008 -0600 @@ -594,8 +594,8 @@ static int img_info(int argc, char **arg BlockDriverState *bs; char fmt_name[128], size_buf[128], dsize_buf[128]; int64_t total_sectors, allocated_size; - char backing_filename[1024]; - char backing_filename2[1024]; + char backing_filename[PATH_MAX]; + char backing_filename2[PATH_MAX]; BlockDriverInfo bdi; fmt = NULL; diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/tapdisk-ioemu.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/ioemu/tapdisk-ioemu.c Tue Apr 15 11:09:46 2008 -0600 @@ -0,0 +1,142 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +extern int init_blktap(void); +extern void qemu_aio_init(void); +extern void qemu_aio_poll(void); +extern void bdrv_init(void); + +extern void *qemu_mallocz(size_t size); +extern void qemu_free(void *ptr); + +int domid = 0; +FILE* logfile; + +void term_printf(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); +} + +void term_print_filename(const char *filename) +{ + term_printf(filename); +} + + +typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size); +typedef int IOCanRWHandler(void *opaque); +typedef void IOHandler(void *opaque); + +typedef struct IOHandlerRecord { + int fd; + IOCanRWHandler *fd_read_poll; + IOHandler *fd_read; + IOHandler *fd_write; + int deleted; + void *opaque; + /* temporary data */ + struct pollfd *ufd; + struct IOHandlerRecord *next; +} IOHandlerRecord; + +static IOHandlerRecord *first_io_handler; + +int qemu_set_fd_handler2(int fd, + IOCanRWHandler *fd_read_poll, + IOHandler *fd_read, + IOHandler *fd_write, + void *opaque) +{ + IOHandlerRecord *ioh; + + /* This is a stripped down version of fd handling */ + assert(fd_read_poll == NULL); + assert(fd_write == NULL); + + for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) + if (ioh->fd == fd) + goto found; + + if (!fd_read && !fd_write) + return 0; + + ioh = qemu_mallocz(sizeof(IOHandlerRecord)); + if (!ioh) + return -1; + ioh->next = first_io_handler; + first_io_handler = ioh; + +found: + if (!fd_read && !fd_write) { + ioh->deleted = 1; + } else { + ioh->fd = fd; + ioh->fd_read = fd_read; + ioh->opaque = opaque; + ioh->deleted = 0; + } + + return 0; +} + +int main(void) +{ + IOHandlerRecord *ioh, **pioh; + int max_fd; + fd_set rfds; + struct timeval tv; + + logfile = stderr; + + bdrv_init(); + qemu_aio_init(); + init_blktap(); + + /* + * Main loop: Pass events to the corrsponding handlers and check for + * completed aio operations. + */ + while (1) { + qemu_aio_poll(); + + max_fd = -1; + FD_ZERO(&rfds); + for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) + if (!ioh->deleted) { + FD_SET(ioh->fd, &rfds); + max_fd = max_fd > ioh->fd ? max_fd : ioh->fd; + } + + tv.tv_sec = 0; + tv.tv_usec = 10000; + if (select(max_fd + 1, &rfds, NULL, NULL, &tv) <= 0) + continue; + + /* Call handlers */ + for(ioh = first_io_handler; ioh != NULL; ioh = ioh->next) + if (FD_ISSET(ioh->fd, &rfds)) + ioh->fd_read(ioh->opaque); + + /* Remove deleted IO handlers */ + pioh = &first_io_handler; + while (*pioh) { + ioh = *pioh; + if (ioh->deleted) { + *pioh = ioh->next; + qemu_free(ioh); + } else + pioh = &ioh->next; + } + } + return 0; +} diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/target-i386-dm/helper2.c --- a/tools/ioemu/target-i386-dm/helper2.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/target-i386-dm/helper2.c Tue Apr 15 11:09:46 2008 -0600 @@ -391,8 +391,6 @@ void timeoffset_get(void) fprintf(logfile, "Time offset set %ld\n", time_offset); else time_offset = 0; - - xc_domain_set_time_offset(xc_handle, domid, time_offset); free(p); } diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/vl.c --- a/tools/ioemu/vl.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/vl.c Tue Apr 15 11:09:46 2008 -0600 @@ -1762,7 +1762,8 @@ static int store_dev_info(char *devName, CharDriverState *cState, char *storeString) { #ifdef CONFIG_STUBDOM - return 0; + fprintf(logfile, "can't store dev %s name for domid %d in %s from a stub domain\n", devName, domid, storeString); + return ENOSYS; #else int xc_handle; struct xs_handle *xs; @@ -7017,26 +7018,12 @@ int unset_mm_mapping(int xc_handle, uint xen_pfn_t *extent_start) { int err = 0; - xc_dominfo_t info; - - xc_domain_getinfo(xc_handle, domid, 1, &info); - if ((info.nr_pages - nr_pages) <= 0) { - fprintf(stderr, "unset_mm_mapping: error nr_pages\n"); - err = -1; - } err = xc_domain_memory_decrease_reservation(xc_handle, domid, nr_pages, 0, extent_start); if (err) fprintf(stderr, "Failed to decrease physmap\n"); - - if (xc_domain_setmaxmem(xc_handle, domid, (info.nr_pages - nr_pages) * - PAGE_SIZE/1024) != 0) { - fprintf(logfile, "set maxmem returned error %d\n", errno); - err = -1; - } - return err; } @@ -7044,16 +7031,7 @@ int set_mm_mapping(int xc_handle, uint32 unsigned long nr_pages, unsigned int address_bits, xen_pfn_t *extent_start) { - xc_dominfo_t info; int err = 0; - - xc_domain_getinfo(xc_handle, domid, 1, &info); - - if (xc_domain_setmaxmem(xc_handle, domid, info.max_memkb + - nr_pages * PAGE_SIZE/1024) != 0) { - fprintf(logfile, "set maxmem returned error %d\n", errno); - return -1; - } err = xc_domain_memory_populate_physmap(xc_handle, domid, nr_pages, 0, address_bits, extent_start); @@ -7688,11 +7666,13 @@ int main(int argc, char **argv) bdrv_init(); xc_handle = xc_interface_open(); #ifdef CONFIG_STUBDOM - char *domid_s, *msg; - if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s))) - fprintf(stderr,"Can not read our own domid\n", msg); - else - xenstore_parse_domain_config(atoi(domid_s)); + { + char *domid_s, *msg; + if ((msg = xenbus_read(XBT_NIL, "domid", &domid_s))) + fprintf(stderr,"Can not read our own domid: %s\n", msg); + else + xenstore_parse_domain_config(atoi(domid_s)); + } #else /* CONFIG_STUBDOM */ xenstore_parse_domain_config(domid); #endif /* CONFIG_STUBDOM */ diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/vl.h --- a/tools/ioemu/vl.h Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/vl.h Tue Apr 15 11:09:46 2008 -0600 @@ -159,7 +159,7 @@ extern FILE *logfile; extern FILE *logfile; -#if defined(__i386__) || defined(__x86_64__) +#if (defined(__i386__) || defined(__x86_64__)) && !defined(QEMU_TOOL) #define MAPCACHE uint8_t *qemu_map_cache(target_phys_addr_t phys_addr); void qemu_invalidate_map_cache(void); @@ -1553,7 +1553,9 @@ void timeoffset_get(void); void timeoffset_get(void); /* xen_platform.c */ +#ifndef QEMU_TOOL void pci_xen_platform_init(PCIBus *bus); +#endif void kqemu_record_dump(void); diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/ioemu/xenstore.c Tue Apr 15 11:09:46 2008 -0600 @@ -347,10 +347,6 @@ extern int vga_ram_size, bios_size; void xenstore_process_logdirty_event(void) { -#ifdef CONFIG_STUBDOM - /* XXX we just can't use shm. */ - return; -#else char *act; static char *active_path = NULL; static char *next_active_path = NULL; @@ -392,6 +388,12 @@ void xenstore_process_logdirty_event(voi /* Map the shared-memory segment */ fprintf(logfile, "%s: key=%16.16llx size=%lu\n", __FUNCTION__, (unsigned long long)key, logdirty_bitmap_size); + +#ifdef CONFIG_STUBDOM + /* XXX we just can't use shm. */ + fprintf(logfile, "Log dirty is not implemented in stub domains!\n"); + return; +#else shmid = shmget(key, 2 * logdirty_bitmap_size, S_IRUSR|S_IWUSR); if (shmid == -1) { fprintf(logfile, "Log-dirty: shmget failed: segment %16.16llx " @@ -417,6 +419,7 @@ void xenstore_process_logdirty_event(voi seg = NULL; return; } +#endif /* Remember the paths for the next-active and active entries */ if (pasprintf(&active_path, @@ -453,7 +456,6 @@ void xenstore_process_logdirty_event(voi /* Ack that we've switched */ xs_write(xsh, XBT_NULL, active_path, act, len); free(act); -#endif } diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/libxc/xc_domain.c Tue Apr 15 11:09:46 2008 -0600 @@ -7,6 +7,7 @@ */ #include "xc_private.h" +#include "xg_save_restore.h" #include #include @@ -301,18 +302,27 @@ int xc_vcpu_getcontext(int xc_handle, { int rc; DECLARE_DOMCTL; + size_t sz = sizeof(vcpu_guest_context_either_t); domctl.cmd = XEN_DOMCTL_getvcpucontext; domctl.domain = (domid_t)domid; domctl.u.vcpucontext.vcpu = (uint16_t)vcpu; set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt); - if ( (rc = lock_pages(ctxt, sizeof(*ctxt))) != 0 ) - return rc; + /* + * We may be asked to lock either a 32-bit or a 64-bit context. Lock the + * larger of the two if possible, otherwise fall back to native size. + */ + if ( (rc = lock_pages(ctxt, sz)) != 0 ) + { + sz = sizeof(*ctxt); + if ( (rc = lock_pages(ctxt, sz)) != 0 ) + return rc; + } rc = do_domctl(xc_handle, &domctl); - unlock_pages(ctxt, sizeof(*ctxt)); + unlock_pages(ctxt, sz); return rc; } @@ -620,19 +630,28 @@ int xc_vcpu_setcontext(int xc_handle, { DECLARE_DOMCTL; int rc; + size_t sz = sizeof(vcpu_guest_context_either_t); domctl.cmd = XEN_DOMCTL_setvcpucontext; domctl.domain = domid; domctl.u.vcpucontext.vcpu = vcpu; set_xen_guest_handle(domctl.u.vcpucontext.ctxt, ctxt); - if ( (ctxt != NULL) && ((rc = lock_pages(ctxt, sizeof(*ctxt))) != 0) ) - return rc; + /* + * We may be asked to lock either a 32-bit or a 64-bit context. Lock the + * larger of the two if possible, otherwise fall back to native size. + */ + if ( (ctxt != NULL) && (rc = lock_pages(ctxt, sz)) != 0 ) + { + sz = sizeof(*ctxt); + if ( (rc = lock_pages(ctxt, sz)) != 0 ) + return rc; + } rc = do_domctl(xc_handle, &domctl); if ( ctxt != NULL ) - unlock_pages(ctxt, sizeof(*ctxt)); + unlock_pages(ctxt, sz); return rc; } diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/libxc/xc_domain_restore.c --- a/tools/libxc/xc_domain_restore.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/libxc/xc_domain_restore.c Tue Apr 15 11:09:46 2008 -0600 @@ -284,7 +284,8 @@ int xc_domain_restore(int xc_handle, int /* The new domain's shared-info frame number. */ unsigned long shared_info_frame; unsigned char shared_info_page[PAGE_SIZE]; /* saved contents from file */ - shared_info_either_t *old_shared_info = (shared_info_either_t *)shared_info_page; + shared_info_either_t *old_shared_info = + (shared_info_either_t *)shared_info_page; shared_info_either_t *new_shared_info; /* A copy of the CPU context of the guest. */ @@ -349,13 +350,6 @@ int xc_domain_restore(int xc_handle, int guest_width = sizeof(unsigned long); pt_levels = (guest_width == 8) ? 4 : (pt_levels == 2) ? 2 : 3; - if ( lock_pages(&ctxt, sizeof(ctxt)) ) - { - /* needed for build domctl, but might as well do early */ - ERROR("Unable to lock ctxt"); - return 1; - } - if ( !hvm ) { /* Load the p2m frame list, plus potential extended info chunk */ @@ -380,8 +374,11 @@ int xc_domain_restore(int xc_handle, int /* We want zeroed memory so use calloc rather than malloc. */ p2m = calloc(p2m_size, MAX(guest_width, sizeof (xen_pfn_t))); pfn_type = calloc(p2m_size, sizeof(unsigned long)); - region_mfn = calloc(MAX_BATCH_SIZE, sizeof(xen_pfn_t)); - p2m_batch = calloc(MAX_BATCH_SIZE, sizeof(xen_pfn_t)); + + region_mfn = xg_memalign(PAGE_SIZE, ROUNDUP( + MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT)); + p2m_batch = xg_memalign(PAGE_SIZE, ROUNDUP( + MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT)); if ( (p2m == NULL) || (pfn_type == NULL) || (region_mfn == NULL) || (p2m_batch == NULL) ) @@ -390,6 +387,11 @@ int xc_domain_restore(int xc_handle, int errno = ENOMEM; goto out; } + + memset(region_mfn, 0, + ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT)); + memset(p2m_batch, 0, + ROUNDUP(MAX_BATCH_SIZE * sizeof(xen_pfn_t), PAGE_SHIFT)); if ( lock_pages(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE) ) { @@ -974,6 +976,12 @@ int xc_domain_restore(int xc_handle, int else DPRINTF("Decreased reservation by %d pages\n", count); } + } + + if ( lock_pages(&ctxt, sizeof(ctxt)) ) + { + ERROR("Unable to lock ctxt"); + return 1; } for ( i = 0; i <= max_vcpu_id; i++ ) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/libxc/xc_domain_save.c --- a/tools/libxc/xc_domain_save.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/libxc/xc_domain_save.c Tue Apr 15 11:09:46 2008 -0600 @@ -223,7 +223,7 @@ static int ratewrite(int io_fd, int live { budget += BURST_BUDGET; last_put.tv_usec += burst_time_us; - if ( last_put.tv_usec > 1000000 + if ( last_put.tv_usec > 1000000 ) { last_put.tv_usec -= 1000000; last_put.tv_sec++; @@ -939,9 +939,9 @@ int xc_domain_save(int xc_handle, int io sent_last_iter = p2m_size; /* Setup to_send / to_fix and to_skip bitmaps */ - to_send = malloc(BITMAP_SIZE); + to_send = xg_memalign(PAGE_SIZE, ROUNDUP(BITMAP_SIZE, PAGE_SHIFT)); to_fix = calloc(1, BITMAP_SIZE); - to_skip = malloc(BITMAP_SIZE); + to_skip = xg_memalign(PAGE_SIZE, ROUNDUP(BITMAP_SIZE, PAGE_SHIFT)); if ( !to_send || !to_fix || !to_skip ) { @@ -983,8 +983,8 @@ int xc_domain_save(int xc_handle, int io analysis_phase(xc_handle, dom, p2m_size, to_skip, 0); - /* We want zeroed memory so use calloc rather than malloc. */ - pfn_type = calloc(MAX_BATCH_SIZE, sizeof(*pfn_type)); + pfn_type = xg_memalign(PAGE_SIZE, ROUNDUP( + MAX_BATCH_SIZE * sizeof(*pfn_type), PAGE_SHIFT)); pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch)); if ( (pfn_type == NULL) || (pfn_batch == NULL) ) { @@ -992,10 +992,12 @@ int xc_domain_save(int xc_handle, int io errno = ENOMEM; goto out; } + memset(pfn_type, 0, + ROUNDUP(MAX_BATCH_SIZE * sizeof(*pfn_type), PAGE_SHIFT)); if ( lock_pages(pfn_type, MAX_BATCH_SIZE * sizeof(*pfn_type)) ) { - ERROR("Unable to lock"); + ERROR("Unable to lock pfn_type array"); goto out; } @@ -1048,7 +1050,7 @@ int xc_domain_save(int xc_handle, int io /* Now write out each data page, canonicalising page tables as we go... */ for ( ; ; ) { - unsigned int prev_pc, sent_this_iter, N, batch; + unsigned int prev_pc, sent_this_iter, N, batch, run; iter++; sent_this_iter = 0; @@ -1225,6 +1227,7 @@ int xc_domain_save(int xc_handle, int io } /* entering this loop, pfn_type is now in pfns (Not mfns) */ + run = 0; for ( j = 0; j < batch; j++ ) { unsigned long pfn, pagetype; @@ -1233,7 +1236,25 @@ int xc_domain_save(int xc_handle, int io pfn = pfn_type[j] & ~XEN_DOMCTL_PFINFO_LTAB_MASK; pagetype = pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK; - /* write out pages in batch */ + if ( pagetype != 0 ) + { + /* If the page is not a normal data page, write out any + run of pages we may have previously acumulated */ + if ( run ) + { + if ( ratewrite(io_fd, live, + (char*)region_base+(PAGE_SIZE*(j-run)), + PAGE_SIZE*run) != PAGE_SIZE*run ) + { + ERROR("Error when writing to state file (4a)" + " (errno %d)", errno); + goto out; + } + run = 0; + } + } + + /* skip pages that aren't present */ if ( pagetype == XEN_DOMCTL_PFINFO_XTAB ) continue; @@ -1255,23 +1276,30 @@ int xc_domain_save(int xc_handle, int io if ( ratewrite(io_fd, live, page, PAGE_SIZE) != PAGE_SIZE ) { - ERROR("Error when writing to state file (4)" + ERROR("Error when writing to state file (4b)" " (errno %d)", errno); goto out; } } else { - /* We have a normal page: just write it directly. */ - if ( ratewrite(io_fd, live, spage, PAGE_SIZE) != - PAGE_SIZE ) - { - ERROR("Error when writing to state file (5)" - " (errno %d)", errno); - goto out; - } + /* We have a normal page: accumulate it for writing. */ + run++; } } /* end of the write out for this batch */ + + if ( run ) + { + /* write out the last accumulated run of pages */ + if ( ratewrite(io_fd, live, + (char*)region_base+(PAGE_SIZE*(j-run)), + PAGE_SIZE*run) != PAGE_SIZE*run ) + { + ERROR("Error when writing to state file (4c)" + " (errno %d)", errno); + goto out; + } + } sent_this_iter += batch; diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/libxc/xc_evtchn.c --- a/tools/libxc/xc_evtchn.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/libxc/xc_evtchn.c Tue Apr 15 11:09:46 2008 -0600 @@ -9,7 +9,8 @@ #include "xc_private.h" -static int do_evtchn_op(int xc_handle, int cmd, void *arg, size_t arg_size) +static int do_evtchn_op(int xc_handle, int cmd, void *arg, + size_t arg_size, int silently_fail) { int ret = -1; DECLARE_HYPERCALL; @@ -24,7 +25,7 @@ static int do_evtchn_op(int xc_handle, i goto out; } - if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0) + if ((ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 && !silently_fail) ERROR("do_evtchn_op: HYPERVISOR_event_channel_op failed: %d", ret); unlock_pages(arg, arg_size); @@ -44,7 +45,7 @@ xc_evtchn_alloc_unbound(int xc_handle, .remote_dom = (domid_t)remote_dom }; - rc = do_evtchn_op(xc_handle, EVTCHNOP_alloc_unbound, &arg, sizeof(arg)); + rc = do_evtchn_op(xc_handle, EVTCHNOP_alloc_unbound, &arg, sizeof(arg), 0); if ( rc == 0 ) rc = arg.port; @@ -55,5 +56,20 @@ int xc_evtchn_reset(int xc_handle, uint32_t dom) { struct evtchn_reset arg = { .dom = (domid_t)dom }; - return do_evtchn_op(xc_handle, EVTCHNOP_reset, &arg, sizeof(arg)); + return do_evtchn_op(xc_handle, EVTCHNOP_reset, &arg, sizeof(arg), 0); } + +int xc_evtchn_status(int xc_handle, + uint32_t dom, + uint32_t port) +{ + int rc; + struct evtchn_status arg = { .dom = (domid_t)dom, + .port = (evtchn_port_t)port }; + + rc = do_evtchn_op(xc_handle, EVTCHNOP_status, &arg, sizeof(arg), 1); + if ( rc == 0 ) + rc = arg.status; + + return rc; +} diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/libxc/xc_hvm_build.c Tue Apr 15 11:09:46 2008 -0600 @@ -20,6 +20,13 @@ #include #define SCRATCH_PFN 0xFFFFF + +#define SPECIALPAGE_GUARD 0 +#define SPECIALPAGE_BUFIOREQ 1 +#define SPECIALPAGE_XENSTORE 2 +#define SPECIALPAGE_IOREQ 3 +#define SPECIALPAGE_IDENT_PT 4 +#define NR_SPECIAL_PAGES 5 static void build_e820map(void *e820_page, unsigned long long mem_size) { @@ -77,21 +84,16 @@ static void build_e820map(void *e820_pag e820entry[nr_map].type = E820_RESERVED; nr_map++; - /* - * Low RAM goes here. Remove 4 pages for: ioreq, bufioreq, and xenstore. - * 1. Guard page. - * 2. Buffered ioreq. - * 3. Xenstore. - * 4. Normal ioreq. - */ + /* Low RAM goes here. Reserve space for special pages. */ e820entry[nr_map].addr = 0x100000; - e820entry[nr_map].size = mem_size - 0x100000 - PAGE_SIZE * 4; + e820entry[nr_map].size = (mem_size - 0x100000 - + PAGE_SIZE * NR_SPECIAL_PAGES); e820entry[nr_map].type = E820_RAM; nr_map++; - /* Explicitly reserve space for special pages. */ - e820entry[nr_map].addr = mem_size - PAGE_SIZE * 3; - e820entry[nr_map].size = PAGE_SIZE * 3; + /* Explicitly reserve space for special pages (excluding guard page). */ + e820entry[nr_map].addr = mem_size - PAGE_SIZE * (NR_SPECIAL_PAGES - 1); + e820entry[nr_map].size = PAGE_SIZE * (NR_SPECIAL_PAGES - 1); e820entry[nr_map].type = E820_RESERVED; nr_map++; @@ -156,10 +158,11 @@ static int setup_guest(int xc_handle, { xen_pfn_t *page_array = NULL; unsigned long i, nr_pages = (unsigned long)memsize << (20 - PAGE_SHIFT); - unsigned long shared_page_nr, entry_eip; + unsigned long special_page_nr, entry_eip, cur_pages; struct xen_add_to_physmap xatp; struct shared_info *shared_info; void *e820_page; + uint32_t *ident_pt; struct elf_binary elf; uint64_t v_start, v_end; int rc; @@ -206,12 +209,23 @@ static int setup_guest(int xc_handle, for ( i = HVM_BELOW_4G_RAM_END >> PAGE_SHIFT; i < nr_pages; i++ ) page_array[i] += HVM_BELOW_4G_MMIO_LENGTH >> PAGE_SHIFT; - /* Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. */ + /* + * Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. + * We allocate pages in batches of no more than 2048 to ensure that + * we can be preempted and hence dom0 remains responsive. + */ rc = xc_domain_memory_populate_physmap( xc_handle, dom, 0xa0, 0, 0, &page_array[0x00]); - if ( rc == 0 ) + cur_pages = 0xc0; + while ( (rc == 0) && (nr_pages > cur_pages) ) + { + unsigned long count = nr_pages - cur_pages; + if ( count > 2048 ) + count = 2048; rc = xc_domain_memory_populate_physmap( - xc_handle, dom, nr_pages - 0xc0, 0, 0, &page_array[0xc0]); + xc_handle, dom, count, 0, 0, &page_array[cur_pages]); + cur_pages += count; + } if ( rc != 0 ) { PERROR("Could not allocate memory for HVM guest.\n"); @@ -245,29 +259,46 @@ static int setup_guest(int xc_handle, sizeof(shared_info->evtchn_mask)); munmap(shared_info, PAGE_SIZE); - if ( v_end > HVM_BELOW_4G_RAM_END ) - shared_page_nr = (HVM_BELOW_4G_RAM_END >> PAGE_SHIFT) - 1; - else - shared_page_nr = (v_end >> PAGE_SHIFT) - 1; + special_page_nr = (((v_end > HVM_BELOW_4G_RAM_END) + ? (HVM_BELOW_4G_RAM_END >> PAGE_SHIFT) + : (v_end >> PAGE_SHIFT)) + - NR_SPECIAL_PAGES); + + /* Paranoia: clean special pages. */ + for ( i = 0; i < NR_SPECIAL_PAGES; i++ ) + if ( xc_clear_domain_page(xc_handle, dom, special_page_nr + i) ) + goto error_out; /* Free the guard page that separates low RAM from special pages. */ rc = xc_domain_memory_decrease_reservation( - xc_handle, dom, 1, 0, &page_array[shared_page_nr-3]); + xc_handle, dom, 1, 0, &page_array[special_page_nr]); if ( rc != 0 ) { PERROR("Could not deallocate guard page for HVM guest.\n"); goto error_out; } - /* Paranoia: clean pages. */ - if ( xc_clear_domain_page(xc_handle, dom, shared_page_nr) || - xc_clear_domain_page(xc_handle, dom, shared_page_nr-1) || - xc_clear_domain_page(xc_handle, dom, shared_page_nr-2) ) - goto error_out; - - xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, shared_page_nr-1); - xc_set_hvm_param(xc_handle, dom, HVM_PARAM_BUFIOREQ_PFN, shared_page_nr-2); - xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IOREQ_PFN, shared_page_nr); + xc_set_hvm_param(xc_handle, dom, HVM_PARAM_STORE_PFN, + special_page_nr + SPECIALPAGE_XENSTORE); + xc_set_hvm_param(xc_handle, dom, HVM_PARAM_BUFIOREQ_PFN, + special_page_nr + SPECIALPAGE_BUFIOREQ); + xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IOREQ_PFN, + special_page_nr + SPECIALPAGE_IOREQ); + + /* + * Identity-map page table is required for running with CR0.PG=0 when + * using Intel EPT. Create a 32-bit non-PAE page directory of superpages. + */ + if ( (ident_pt = xc_map_foreign_range( + xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, + special_page_nr + SPECIALPAGE_IDENT_PT)) == NULL ) + goto error_out; + for ( i = 0; i < PAGE_SIZE / sizeof(*ident_pt); i++ ) + ident_pt[i] = ((i << 22) | _PAGE_PRESENT | _PAGE_RW | _PAGE_USER | + _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE); + munmap(ident_pt, PAGE_SIZE); + xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IDENT_PT, + special_page_nr + SPECIALPAGE_IDENT_PT); /* Insert JMP instruction at address 0x0 to reach entry point. */ entry_eip = elf_uval(&elf, elf.ehdr, e_entry); diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/libxc/xenctrl.h Tue Apr 15 11:09:46 2008 -0600 @@ -470,6 +470,9 @@ xc_evtchn_alloc_unbound(int xc_handle, int xc_evtchn_reset(int xc_handle, uint32_t dom); +int xc_evtchn_status(int xc_handle, + uint32_t dom, + uint32_t port); /* * Return a handle to the event channel driver, or -1 on failure, in which case diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/libxc/xg_private.c --- a/tools/libxc/xg_private.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/libxc/xg_private.c Tue Apr 15 11:09:46 2008 -0600 @@ -8,6 +8,7 @@ #include #include #include +#include #include "xg_private.h" @@ -196,6 +197,22 @@ __attribute__((weak)) { errno = ENOSYS; return -1; +} + +void *xg_memalign(size_t alignment, size_t size) +{ +#if defined(_POSIX_C_SOURCE) && !defined(__sun__) + int ret; + void *ptr; + ret = posix_memalign(&ptr, alignment, size); + if (ret != 0) + return NULL; + return ptr; +#elif defined(__NetBSD__) || defined(__OpenBSD__) + return valloc(size); +#else + return memalign(alignment, size); +#endif } /* diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/libxc/xg_private.h --- a/tools/libxc/xg_private.h Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/libxc/xg_private.h Tue Apr 15 11:09:46 2008 -0600 @@ -176,4 +176,6 @@ int pin_table(int xc_handle, unsigned in int pin_table(int xc_handle, unsigned int type, unsigned long mfn, domid_t dom); +void *xg_memalign(size_t alignment, size_t size); + #endif /* XG_PRIVATE_H */ diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/util/acmpolicy.py --- a/tools/python/xen/util/acmpolicy.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/util/acmpolicy.py Tue Apr 15 11:09:46 2008 -0600 @@ -76,6 +76,7 @@ DEFAULT_policy = \ " \n" +\ " \n" +\ " SystemManagement\n" +\ +" __UNLABELED__\n" +\ " \n" +\ " \n" +\ " \n" +\ @@ -89,12 +90,30 @@ DEFAULT_policy = \ " SystemManagement\n" +\ " \n" +\ " SystemManagement\n" +\ +" __UNLABELED__\n" +\ +" \n" +\ +" \n" +\ +" \n" +\ +" \n" +\ +" \n" +\ +" \n" +\ +" __UNLABELED__\n" +\ +" \n" +\ +" __UNLABELED__\n" +\ " \n" +\ " \n" +\ " \n" +\ " \n" +\ " \n" +\ " \n" +\ +" \n" +\ +" \n" +\ +" __UNLABELED__\n" +\ +" \n" +\ +" __UNLABELED__\n" +\ +" \n" +\ +" \n" +\ +" \n" +\ " \n" +\ "\n" @@ -231,13 +250,14 @@ class ACMPolicy(XSPolicy): """ Determine whether this is the default policy """ - default = ['SystemManagement'] + default = ['SystemManagement', ACM_LABEL_UNLABELED ] if self.policy_get_virtualmachinelabel_names() == default and \ self.policy_get_bootstrap_vmlabel() == default[0] and \ self.policy_get_stetypes_types() == default and \ self.policy_get_stes_of_vmlabel(default[0]) == default and \ - self.policy_get_resourcelabel_names() == [] and \ - self.policy_get_chwall_types() == default and \ + self.policy_get_stes_of_vmlabel(default[1]) == [default[1]] and \ + self.policy_get_resourcelabel_names() == [default[1]] and \ + self.policy_get_chwall_types() == [ default[0] ] and \ self.get_name() == "DEFAULT": return True return False diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/util/xsm/acm/acm.py --- a/tools/python/xen/util/xsm/acm/acm.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/util/xsm/acm/acm.py Tue Apr 15 11:09:46 2008 -0600 @@ -1146,11 +1146,13 @@ def __resources_compatible_with_vmlabel( for key, value in resources.items(): if key in [ 'vbd', 'tap' ]: for res in resources[key]: - try: + if not res in access_control: + label = [xsconstants.ACM_POLICY_ID, + xspol.get_name(), + ACM_LABEL_UNLABELED] + else: label = access_control[res] - if not collect_labels(reslabels, label, polname): - return False - except: + if not collect_labels(reslabels, label, polname): return False elif key in [ 'vif' ]: for xapi_label in value: @@ -1220,6 +1222,11 @@ def set_resource_label(resource, policyt return -xsconstants.XSERR_BAD_LABEL if tmp[2] != oreslabel: return -xsconstants.XSERR_BAD_LABEL + if resource.startswith('vlan:'): + for key, value in access_control.items(): + if value == tuple([policytype, policyref, reslabel]) and \ + key.startswith('vlan:'): + return -xsconstants.XSERR_BAD_LABEL if reslabel != "": new_entry = { resource : tuple([policytype, policyref, reslabel])} access_control.update(new_entry) @@ -1402,6 +1409,8 @@ def change_acm_policy(bin_pol, del_array dominfos = XendDomain.instance().list('all') log.info("----------------------------------------------") + + label_changes = [] # relabel resources access_control = {} @@ -1433,7 +1442,7 @@ def change_acm_policy(bin_pol, del_array elif label not in polnew_reslabels: # label been removed policytype = xsconstants.INVALID_POLICY_PREFIX + policytype - run_resource_label_change_script(key, "", "remove") + label_changes.append(key) polname = policy else: # no change to label @@ -1501,6 +1510,8 @@ def change_acm_policy(bin_pol, del_array rc, errors = hv_chg_policy(bin_pol, del_array, chg_array) if rc == 0: + for key in label_changes: + run_resource_label_change_script(key, "", "remove") # Write the relabeled resources back into the file dictio.dict_write(access_control, "resources", res_label_filename) # Properly update all VMs to their new labels diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/xend/XendConstants.py --- a/tools/python/xen/xend/XendConstants.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/xend/XendConstants.py Tue Apr 15 11:09:46 2008 -0600 @@ -96,6 +96,7 @@ MINIMUM_RESTART_TIME = 20 MINIMUM_RESTART_TIME = 20 RESTART_IN_PROGRESS = 'xend/restart_in_progress' +DUMPCORE_IN_PROGRESS = 'xend/dumpcore_in_progress' LAST_SHUTDOWN_REASON = 'xend/last_shutdown_reason' TRIGGER_NMI = 0 diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Apr 15 11:09:46 2008 -0600 @@ -986,6 +986,13 @@ class XendDomainInfo: self.info['name_label'], str(self.domid), target) MiB = 1024 * 1024 + + if self.domid == 0: + dom0_min_mem = xoptions.get_dom0_min_mem() + memory_cur = self.get_memory_dynamic_max() / MiB + if target < memory_cur and dom0_min_mem > target: + raise XendError("memory_dynamic_max too small") + self._safe_set_memory('memory_dynamic_min', target * MiB) self._safe_set_memory('memory_dynamic_max', target * MiB) @@ -1792,10 +1799,13 @@ class XendDomainInfo: raise XendError("Cannot dump core in a directory: %s" % corefile) + self._writeVm(DUMPCORE_IN_PROGRESS, 'True') xc.domain_dumpcore(self.domid, corefile) + self._removeVm(DUMPCORE_IN_PROGRESS) except RuntimeError, ex: corefile_incomp = corefile+'-incomplete' os.rename(corefile, corefile_incomp) + self._removeVm(DUMPCORE_IN_PROGRESS) log.exception("XendDomainInfo.dumpCore failed: id = %s name = %s", self.domid, self.info['name_label']) raise XendError("Failed to dump core: %s" % str(ex)) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/xend/XendOptions.py --- a/tools/python/xen/xend/XendOptions.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/xend/XendOptions.py Tue Apr 15 11:09:46 2008 -0600 @@ -278,6 +278,13 @@ class XendOptions: def get_dom0_min_mem(self): return self.get_config_int('dom0-min-mem', self.dom0_min_mem_default) + + def get_enable_dom0_ballooning(self): + enable_dom0_ballooning_default = 'yes' + if self.get_dom0_min_mem() == 0: + enable_dom0_ballooning_default = 'no' + return self.get_config_bool('enable-dom0-ballooning', + enable_dom0_ballooning_default) def get_dom0_vcpus(self): return self.get_config_int('dom0-cpus', self.dom0_vcpus_default) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/xend/balloon.py --- a/tools/python/xen/xend/balloon.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/xend/balloon.py Tue Apr 15 11:09:46 2008 -0600 @@ -81,8 +81,8 @@ def free(need_mem): # needs to balloon. No matter where we expect the free memory to come # from, we need to wait for it to become available. # - # We are not allowed to balloon below dom0_min_mem, or if dom0_min_mem - # is 0, we cannot balloon at all. Memory can still become available + # We are not allowed to balloon below dom0_min_mem, or if dom0_ballooning + # is False, we cannot balloon at all. Memory can still become available # through a rebooting domain, however. # # Eventually, we time out (presumably because there really isn't enough @@ -100,6 +100,7 @@ def free(need_mem): try: dom0_min_mem = xoptions.get_dom0_min_mem() * 1024 + dom0_ballooning = xoptions.get_enable_dom0_ballooning() dom0_alloc = get_dom0_current_alloc() retries = 0 @@ -115,7 +116,7 @@ def free(need_mem): free_mem = physinfo['free_memory'] scrub_mem = physinfo['scrub_memory'] total_mem = physinfo['total_memory'] - if dom0_min_mem > 0: + if dom0_ballooning: max_free_mem = total_mem - dom0_min_mem else: max_free_mem = total_mem - dom0_alloc @@ -137,7 +138,7 @@ def free(need_mem): log.debug("Balloon: %d KiB free; %d to scrub; need %d; retries: %d.", free_mem, scrub_mem, need_mem, rlimit) - if dom0_min_mem > 0: + if dom0_ballooning: dom0_alloc = get_dom0_current_alloc() new_alloc = dom0_alloc - (need_mem - free_mem - scrub_mem) @@ -163,10 +164,10 @@ def free(need_mem): last_free = free_mem + scrub_mem # Not enough memory; diagnose the problem. - if dom0_min_mem == 0: - raise VmError(('Not enough free memory and dom0_min_mem is 0, so ' - 'I cannot release any more. I need %d KiB but ' - 'only have %d.') % + if not dom0_ballooning: + raise VmError(('Not enough free memory and enable-dom0-ballooning ' + 'is False, so I cannot release any more. ' + 'I need %d KiB but only have %d.') % (need_mem, free_mem)) elif new_alloc < dom0_min_mem: raise VmError( diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/xend/image.py Tue Apr 15 11:09:46 2008 -0600 @@ -99,7 +99,9 @@ class ImageHandler: self.vncconsole = vmConfig['platform'].get('vncconsole') self.dmargs = self.parseDeviceModelArgs(vmConfig) self.pid = None - + rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset') + if rtc_timeoffset is not None: + xc.domain_set_time_offset(self.vm.getDomid(), int(rtc_timeoffset)) def cleanupBootloading(self): @@ -419,9 +421,6 @@ class LinuxImageHandler(ImageHandler): def configure(self, vmConfig): ImageHandler.configure(self, vmConfig) - rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset') - if rtc_timeoffset is not None: - xc.domain_set_time_offset(self.vm.getDomid(), int(rtc_timeoffset)) def buildDomain(self): store_evtchn = self.vm.getStorePort() diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/xm/main.py Tue Apr 15 11:09:46 2008 -0600 @@ -1294,13 +1294,13 @@ def xm_dump_core(args): try: print "Dumping core of domain: %s ..." % str(dom) server.xend.domain.dump(dom, filename, live, crash) + + if crash: + print "Destroying domain: %s ..." % str(dom) + server.xend.domain.destroy(dom) finally: - if not live and ds == DOM_STATE_RUNNING: + if not live and not crash and ds == DOM_STATE_RUNNING: server.xend.domain.unpause(dom) - - if crash: - print "Destroying domain: %s ..." % str(dom) - server.xend.domain.destroy(dom) def xm_rename(args): arg_check(args, "rename", 2) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/python/xen/xm/shutdown.py --- a/tools/python/xen/xm/shutdown.py Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/python/xen/xm/shutdown.py Tue Apr 15 11:09:46 2008 -0600 @@ -144,7 +144,7 @@ def main_dom(opts, args): def main_dom(opts, args): if len(args) == 0: opts.err('No domain parameter given') if len(args) > 1: opts.err('No multiple domain parameters allowed') - dom = args[0] + dom = sxp.child_value(server.xend.domain(args[0]), 'name') if serverType == SERVER_XEN_API: dom = get_single_vm(dom) mode = shutdown_mode(opts) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/security/Makefile --- a/tools/security/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/security/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -32,7 +32,7 @@ ACM_SECGEN_CGIDIR = $(ACM_SECGEN_HTMLDIR ACM_SCHEMA = security_policy.xsd ACM_EXAMPLES = client_v1 test -ACM_DEF_POLICIES = DEFAULT-UL +ACM_DEF_POLICIES = ACM_POLICY_SUFFIX = security_policy.xml ifeq ($(ACM_SECURITY),y) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/security/policies/DEFAULT-UL-security_policy.xml --- a/tools/security/policies/DEFAULT-UL-security_policy.xml Mon Apr 14 14:04:58 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ - - - - DEFAULT-UL - 1.0 - - - - SystemManagement - __UNLABELED__ - - - - - SystemManagement - - - - - - SystemManagement - - SystemManagement - __UNLABELED__ - - - - - - - __UNLABELED__ - - __UNLABELED__ - - - - - - - - diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/tests/blowfish.mk --- a/tools/tests/blowfish.mk Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/tests/blowfish.mk Tue Apr 15 11:09:46 2008 -0600 @@ -5,11 +5,11 @@ include $(XEN_ROOT)/tools/Rules.mk include $(XEN_ROOT)/tools/Rules.mk # Disable PIE/SSP if GCC supports them. They can break us. -CFLAGS += $(call cc-option,$(CC),-nopie,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) -CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) +CFLAGS += $(call cc-option,$(CC),-nopie,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) +CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) -CFLAGS += -fno-builtin -O2 -msoft-float +CFLAGS += -fno-builtin -msoft-float .PHONY: all all: blowfish.bin diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/xcutils/Makefile --- a/tools/xcutils/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/xcutils/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -18,7 +18,7 @@ CFLAGS += -Wp,-MD,.$(@F).d CFLAGS += -Wp,-MD,.$(@F).d PROG_DEP = .*.d -PROGRAMS = xc_restore xc_save readnotes +PROGRAMS = xc_restore xc_save readnotes lsevtchn LDLIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/xcutils/lsevtchn.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/xcutils/lsevtchn.c Tue Apr 15 11:09:46 2008 -0600 @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include + +#include +#include +#include + +int +main(int argc, char **argv) +{ + int xc_fd; + int domid = 0, port = 0, status; + const char *msg; + + if ( argc > 1 ) + domid = strtol(argv[1], NULL, 10); + + xc_fd = xc_interface_open(); + if ( xc_fd < 0 ) + errx(1, "failed to open control interface"); + + while ( (status = xc_evtchn_status(xc_fd, domid, port)) >= 0 ) + { + switch ( status ) + { + case EVTCHNSTAT_closed: + msg = "Channel is not in use."; + break; + case EVTCHNSTAT_unbound: + msg = "Channel is waiting interdom connection."; + break; + case EVTCHNSTAT_interdomain: + msg = "Channel is connected to remote domain."; + break; + case EVTCHNSTAT_pirq: + msg = "Channel is bound to a phys IRQ line."; + break; + case EVTCHNSTAT_virq: + msg = "Channel is bound to a virtual IRQ line."; + break; + case EVTCHNSTAT_ipi: + msg = "Channel is bound to a virtual IPI line."; + break; + default: + msg = "Unknown."; + break; + + } + printf("%03d: %d: %s\n", port, status, msg); + port++; + } + + xc_interface_close(xc_fd); + + return 0; +} diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/xenstore/Makefile --- a/tools/xenstore/Makefile Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/xenstore/Makefile Tue Apr 15 11:09:46 2008 -0600 @@ -13,8 +13,7 @@ DEP = .*.d DEP = .*.d CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod -CLIENTS += xenstore-write -CLIENTS_OBJS := $(patsubst xenstore-%,xenstore_%.o,$(CLIENTS)) +CLIENTS += xenstore-write xenstore-ls XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o @@ -24,8 +23,18 @@ XENSTORED_OBJS_$(CONFIG_NetBSD) = xensto XENSTORED_OBJS += $(XENSTORED_OBJS_y) +ifneq ($(XENSTORE_STATIC_CLIENTS),y) +LIBXENSTORE := libxenstore.so +else +LIBXENSTORE := libxenstore.a +xenstore xenstore-control: CFLAGS += -static +endif + .PHONY: all -all: libxenstore.so libxenstore.a xenstored $(CLIENTS) xs_tdb_dump xenstore-control xenstore-ls +all: libxenstore.so libxenstore.a xenstored clients xs_tdb_dump + +.PHONY: clients +clients: xenstore $(CLIENTS) xenstore-control ifeq ($(CONFIG_SunOS),y) xenstored_probes.h: xenstored_probes.d @@ -42,16 +51,13 @@ xenstored: $(XENSTORED_OBJS) xenstored: $(XENSTORED_OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LDFLAGS_libxenctrl) $(SOCKET_LIBS) -o $@ -$(CLIENTS): xenstore-%: xenstore_%.o libxenstore.so +$(CLIENTS): xenstore + ln -f xenstore $@ + +xenstore: xenstore_client.o $(LIBXENSTORE) $(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@ -$(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c - $(COMPILE.c) -DCLIENT_$(*F) -o $@ $< - -xenstore-control: xenstore_control.o libxenstore.so - $(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@ - -xenstore-ls: xsls.o libxenstore.so +xenstore-control: xenstore_control.o $(LIBXENSTORE) $(CC) $(CFLAGS) $(LDFLAGS) $< -L. -lxenstore $(SOCKET_LIBS) -o $@ xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o @@ -61,6 +67,8 @@ libxenstore.so: libxenstore.so.$(MAJOR) ln -sf $< $@ libxenstore.so.$(MAJOR): libxenstore.so.$(MAJOR).$(MINOR) ln -sf $< $@ + +xs.opic: CFLAGS += -DUSE_PTHREAD libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic $(CC) $(CFLAGS) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread @@ -72,8 +80,8 @@ clean: clean: rm -f *.a *.o *.opic *.so* xenstored_probes.h rm -f xenstored xs_random xs_stress xs_crashme - rm -f xs_tdb_dump xenstore-control xenstore-ls - rm -f $(CLIENTS) + rm -f xs_tdb_dump xenstore-control + rm -f xenstore $(CLIENTS) $(RM) $(DEP) .PHONY: TAGS @@ -92,9 +100,11 @@ install: all $(INSTALL_DIR) $(DESTDIR)$(SBINDIR) $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR) $(INSTALL_PROG) xenstored $(DESTDIR)$(SBINDIR) - $(INSTALL_PROG) $(CLIENTS) $(DESTDIR)$(BINDIR) $(INSTALL_PROG) xenstore-control $(DESTDIR)$(BINDIR) - $(INSTALL_PROG) xenstore-ls $(DESTDIR)$(BINDIR) + $(INSTALL_PROG) xenstore $(DESTDIR)/usr/bin + set -e ; for c in $(CLIENTS) ; do \ + ln -f $(DESTDIR)/usr/bin/xenstore $(DESTDIR)/usr/bin/$${c} ; \ + done $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_PROG) libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR) ln -sf libxenstore.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenstore.so.$(MAJOR) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/xenstore/xenstore_client.c --- a/tools/xenstore/xenstore_client.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/xenstore/xenstore_client.c Tue Apr 15 11:09:46 2008 -0600 @@ -16,12 +16,31 @@ #include #include #include +#include +#include #include + +#include + +#define PATH_SEP '/' +#define MAX_PATH_LEN 256 + +#define MAX_PERMS 16 + +enum mode { + MODE_unknown, + MODE_chmod, + MODE_exists, + MODE_list, + MODE_ls, + MODE_read, + MODE_rm, + MODE_write, +}; static char *output_buf = NULL; static int output_pos = 0; -#if defined(CLIENT_read) || defined(CLIENT_list) static int output_size = 0; static void @@ -47,26 +66,39 @@ output(const char *fmt, ...) { va_end(ap); output_pos += len; } -#endif static void -usage(const char *progname) -{ -#if defined(CLIENT_read) - errx(1, "Usage: %s [-h] [-p] [-s] key [...]", progname); -#elif defined(CLIENT_write) - errx(1, "Usage: %s [-h] [-s] key value [...]", progname); -#elif defined(CLIENT_rm) - errx(1, "Usage: %s [-h] [-s] [-t] key [...]", progname); -#elif defined(CLIENT_exists) || defined(CLIENT_list) - errx(1, "Usage: %s [-h] [-s] key [...]", progname); -#elif defined(CLIENT_chmod) - errx(1, "Usage: %s [-h] [-s] key ", progname); -#endif -} - - -#if defined(CLIENT_rm) +usage(enum mode mode, int incl_mode, const char *progname) +{ + const char *mstr = NULL; + + switch (mode) { + case MODE_unknown: + errx(1, "Usage: %s [-h] [...]", progname); + case MODE_read: + mstr = incl_mode ? "read " : ""; + errx(1, "Usage: %s %s[-h] [-p] [-s] key [...]", progname, mstr); + case MODE_write: + mstr = incl_mode ? "write " : ""; + errx(1, "Usage: %s %s[-h] [-s] key value [...]", progname, mstr); + case MODE_rm: + mstr = incl_mode ? "rm " : ""; + errx(1, "Usage: %s %s[-h] [-s] [-t] key [...]", progname, mstr); + case MODE_exists: + mstr = incl_mode ? "exists " : ""; + case MODE_list: + mstr = mstr ? : incl_mode ? "list " : ""; + errx(1, "Usage: %s %s[-h] [-s] key [...]", progname, mstr); + case MODE_ls: + mstr = mstr ? : incl_mode ? "ls " : ""; + errx(1, "Usage: %s %s[-h] [-s] [path]", progname, mstr); + case MODE_chmod: + mstr = incl_mode ? "chmod " : ""; + errx(1, "Usage: %s %s[-h] [-s] key ", progname, mstr); + } +} + + static int do_rm(char *path, struct xs_handle *xsh, xs_transaction_t xth) { @@ -78,11 +110,111 @@ do_rm(char *path, struct xs_handle *xsh, return 1; } } -#endif - -#if defined(CLIENT_chmod) -#define PATH_SEP '/' -#define MAX_PATH_LEN 256 + +#define STRING_MAX XENSTORE_ABS_PATH_MAX+1024 +static int max_width = 80; +static int desired_width = 60; +static int show_whole_path = 0; + +#define TAG " = \"...\"" +#define TAG_LEN strlen(TAG) + +#define MIN(a, b) (((a) < (b))? (a) : (b)) + +void do_ls(struct xs_handle *h, char *path, int cur_depth, int show_perms) +{ + static struct expanding_buffer ebuf; + char **e; + char newpath[STRING_MAX], *val; + int newpath_len; + int i; + unsigned int num, len; + + e = xs_directory(h, XBT_NULL, path, &num); + if (e == NULL) + err(1, "xs_directory (%s)", path); + + for (i = 0; i 1; -#elif defined(CLIENT_write) - transaction = (argc - optind) > 2; -#else - transaction = 1; -#endif + } + } + + switch (mode) { + case MODE_ls: + break; + case MODE_write: + if ((argc - switch_argv - optind) % 2 == 1) { + usage(mode, switch_argv, argv[0]); + /* NOTREACHED */ + } + /* DROP-THRU */ + default: + if (optind == argc - switch_argv) { + usage(mode, switch_argv, argv[0]); + /* NOTREACHED */ + } + } + + switch (mode) { + case MODE_read: + transaction = (argc - switch_argv - optind) > 1; + break; + case MODE_write: + transaction = (argc - switch_argv - optind) > 2; + break; + case MODE_ls: + transaction = 0; + break; + default: + transaction = 1; + break; + } + + if ( mode == MODE_ls ) + { + memset(&ws, 0, sizeof(ws)); + ret = ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); + if (!ret) + max_width = ws.ws_col - 2; + } xsh = socket ? xs_daemon_open() : xs_domain_open(); if (xsh == NULL) err(1, socket ? "xs_daemon_open" : "xs_domain_open"); - again: +again: if (transaction) { xth = xs_transaction_start(xsh); if (xth == XBT_NULL) errx(1, "couldn't start transaction"); } - ret = perform(optind, argc, argv, xsh, xth, prefix, tidy, upto, recurse); + ret = perform(mode, optind, argc - switch_argv, argv + switch_argv, xsh, xth, prefix, tidy, upto, recurse); if (transaction && !xs_transaction_end(xsh, xth, ret)) { if (ret == 0 && errno == EAGAIN) { diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/xenstore/xenstored_core.c --- a/tools/xenstore/xenstored_core.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/xenstore/xenstored_core.c Tue Apr 15 11:09:46 2008 -0600 @@ -722,7 +722,7 @@ char *canonicalize(struct connection *co { const char *prefix; - if (!node || strstarts(node, "/")) + if (!node || (node[0] == '/') || (node[0] == '@')) return (char *)node; prefix = get_implicit_path(conn); if (prefix) diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/xenstore/xenstored_solaris.c --- a/tools/xenstore/xenstored_solaris.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/xenstore/xenstored_solaris.c Tue Apr 15 11:09:46 2008 -0600 @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/xenstore/xenstored_watch.c --- a/tools/xenstore/xenstored_watch.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/xenstore/xenstored_watch.c Tue Apr 15 11:09:46 2008 -0600 @@ -183,7 +183,7 @@ void do_unwatch(struct connection *conn, return; } - node = strstarts(vec[0], "@") ? vec[0] : canonicalize(conn, vec[0]); + node = canonicalize(conn, vec[0]); list_for_each_entry(watch, &conn->watches, list) { if (streq(watch->node, node) && streq(watch->token, vec[1])) { list_del(&watch->list); diff -r c0f77a657547 -r 2b3d3aaf8be4 tools/xenstore/xs.c --- a/tools/xenstore/xs.c Mon Apr 14 14:04:58 2008 -0600 +++ b/tools/xenstore/xs.c Tue Apr 15 11:09:46 2008 -0600 @@ -32,7 +32,6 @@ #include #include #include -#include #include "xs.h" #include "list.h" #include "utils.h" @@ -42,6 +41,10 @@ struct xs_stored_msg { struct xsd_sockmsg hdr; char *body; }; + +#ifdef USE_PTHREAD + +#include struct xs_handle { /* Communications channel to xenstore daemon. */ @@ -78,14 +81,37 @@ struct xs_handle { pthread_mutex_t request_mutex; }; +#define mutex_lock(m) pthread_mutex_lock(m) +#define mutex_unlock(m) pthread_mutex_unlock(m) +#define condvar_signal(c) pthread_cond_signal(c) +#define condvar_wait(c,m,hnd) pthread_cond_wait(c,m) + +static void *read_thread(void *arg); + +#else /* !defined(USE_PTHREAD) */ + +struct xs_handle { + int fd; + struct list_head reply_list; + struct list_head watch_list; + /* Clients can select() on this pipe to wait for a watch to fire. */ + int watch_pipe[2]; +}; + +#define mutex_lock(m) ((void)0) +#define mutex_unlock(m) ((void)0) +#define condvar_signal(c) ((void)0) +#define condvar_wait(c,m,hnd) read_message(hnd) + +#endif + static int read_message(struct xs_handle *h); -static void *read_thread(void *arg); int xs_fileno(struct xs_handle *h) { char c = 0; - pthread_mutex_lock(&h->watch_mutex); + mutex_lock(&h->watch_mutex); if ((h->watch_pipe[0] == -1) && (pipe(h->watch_pipe) != -1)) { /* Kick things off if the watch list is already non-empty. */ @@ -94,7 +120,7 @@ int xs_fileno(struct xs_handle *h) continue; } - pthread_mutex_unlock(&h->watch_mutex); + mutex_unlock(&h->watch_mutex); return h->watch_pipe[0]; } @@ -163,18 +189,21 @@ static struct xs_handle *get_handle(cons h->fd = fd; + INIT_LIST_HEAD(&h->reply_list); + INIT_LIST_HEAD(&h->watch_list); + /* Watch pipe is allocated on demand in xs_fileno(). */ h->watch_pipe[0] = h->watch_pipe[1] = -1; - INIT_LIST_HEAD(&h->watch_list); +#ifdef USE_PTHREAD pthread_mutex_init(&h->watch_mutex, NULL); pthread_cond_init(&h->watch_condvar, NULL); - INIT_LIST_HEAD(&h->reply_list); pthread_mutex_init(&h->reply_mutex, NULL); pthread_cond_init(&h->reply_condvar, NULL); pthread_mutex_init(&h->request_mutex, NULL); +#endif return h; } @@ -198,15 +227,17 @@ void xs_daemon_close(struct xs_handle *h { struct xs_stored_msg *msg, *tmsg; - pthread_mutex_lock(&h->request_mutex); - pthread_mutex_lock(&h->reply_mutex); - pthread_mutex_lock(&h->watch_mutex); - + mutex_lock(&h->request_mutex); + mutex_lock(&h->reply_mutex); + mutex_lock(&h->watch_mutex); + +#ifdef USE_PTHREAD if (h->read_thr_exists) { /* XXX FIXME: May leak an unpublished message buffer. */ pthread_cancel(h->read_thr); pthread_join(h->read_thr, NULL); } +#endif list_for_each_entry_safe(msg, tmsg, &h->reply_list, list) { free(msg->body); @@ -218,9 +249,9 @@ void xs_daemon_close(struct xs_handle *h free(msg); } - pthread_mutex_unlock(&h->request_mutex); - pthread_mutex_unlock(&h->reply_mutex); - pthread_mutex_unlock(&h->watch_mutex); + mutex_unlock(&h->request_mutex); + mutex_unlock(&h->reply_mutex); + mutex_unlock(&h->watch_mutex); if (h->watch_pipe[0] != -1) { close(h->watch_pipe[0]); @@ -277,17 +308,19 @@ static void *read_reply( struct xs_stored_msg *msg; char *body; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:30:45 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:30:45 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTnX-0002SU-Cp for www-data@colo.xensource.com; Tue, 20 May 2008 08:30:45 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToB-0007MJ-7C; Tue, 20 May 2008 15:31:23 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnm-00077T-Rt for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:59 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnf-0002zS-Mq for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:56 +0000 X-SBRS: 3.6 X-MesageID: 267626 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267626" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:01 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFU0tr029552 for ; Tue, 20 May 2008 08:30:00 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUI3F032293 for ; Tue, 20 May 2008 08:30:18 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUI4f032292 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:18 -0700 Message-Id: <200805201530.m4KFUI4f032292@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-SA-Exim-Scanned: No (on lists.xensource.com); Message bigger than SAmaxbody (256000) Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1209067709 21600 # Node ID dc510776dd598f3f479af749865bec225e32634d # Parent 239b44eeb2d6d235ddee581b6e89398c80278a2f # Parent 97da69831384f0819caeeb8b8bdff0f942b2d690 merge with xen-unstable.hg --- xen/arch/x86/hvm/svm/x86_32/Makefile | 1 xen/arch/x86/hvm/svm/x86_32/exits.S | 131 ------- xen/arch/x86/hvm/svm/x86_64/Makefile | 1 xen/arch/x86/hvm/svm/x86_64/exits.S | 148 -------- xen/arch/x86/hvm/vmx/x86_32/Makefile | 1 xen/arch/x86/hvm/vmx/x86_32/exits.S | 148 -------- xen/arch/x86/hvm/vmx/x86_64/Makefile | 1 xen/arch/x86/hvm/vmx/x86_64/exits.S | 165 --------- .hgignore | 1 Makefile | 7 docs/misc/vtd.txt | 2 docs/src/user.tex | 7 docs/xen-api/revision-history.tex | 10 docs/xen-api/xenapi-coversheet.tex | 2 docs/xen-api/xenapi-datamodel.tex | 180 ++++++++-- extras/mini-os/Makefile | 29 + extras/mini-os/app.lds | 11 extras/mini-os/arch/ia64/minios-ia64.lds | 5 extras/mini-os/arch/x86/minios-x86_32.lds | 1 extras/mini-os/arch/x86/minios-x86_64.lds | 1 extras/mini-os/arch/x86/mm.c | 7 extras/mini-os/fbfront.c | 98 +++-- extras/mini-os/hypervisor.c | 15 extras/mini-os/include/fbfront.h | 3 extras/mini-os/include/hypervisor.h | 4 extras/mini-os/include/ia64/arch_mm.h | 2 extras/mini-os/include/ia64/os.h | 11 extras/mini-os/include/lib.h | 1 extras/mini-os/include/mm.h | 2 extras/mini-os/include/x86/os.h | 1 extras/mini-os/kernel.c | 15 extras/mini-os/lib/sys.c | 35 ++ extras/mini-os/main.c | 2 extras/mini-os/mm.c | 12 extras/mini-os/sched.c | 136 ++------ tools/blktap/drivers/blktapctrl.c | 83 ++++ tools/blktap/drivers/tapdisk.h | 2 tools/console/daemon/io.c | 18 - tools/console/daemon/main.c | 13 tools/examples/blktap | 22 - tools/firmware/hvmloader/Makefile | 5 tools/firmware/hvmloader/acpi/build.c | 4 tools/firmware/hvmloader/cacheattr.c | 99 +++++ tools/firmware/hvmloader/config.h | 3 tools/firmware/hvmloader/hvmloader.c | 3 tools/firmware/hvmloader/smp.c | 9 tools/ioemu/Makefile | 2 tools/ioemu/hw/cirrus_vga.c | 4 tools/ioemu/hw/pci.c | 16 tools/ioemu/hw/vga.c | 6 tools/ioemu/hw/xen_blktap.c | 45 -- tools/ioemu/hw/xenfb.c | 153 ++++++--- tools/ioemu/tapdisk-ioemu.c | 14 tools/ioemu/target-i386-dm/helper2.c | 2 tools/ioemu/vl.c | 17 - tools/ioemu/vl.h | 1 tools/libfsimage/ext2fs/fsys_ext2fs.c | 61 +++ tools/libxc/xc_hvm_build.c | 2 tools/python/xen/util/acmpolicy.py | 27 + tools/python/xen/xend/XendDomain.py | 26 + tools/python/xen/xend/XendDomainInfo.py | 31 + tools/python/xen/xend/XendXSPolicyAdmin.py | 1 tools/python/xen/xend/image.py | 46 ++ tools/python/xen/xm/main.py | 11 tools/tests/test_x86_emulator.c | 48 -- tools/tests/x86_emulate.c | 6 tools/xenmon/xenbaked.c | 32 + xen/Makefile | 12 xen/arch/x86/Makefile | 2 xen/arch/x86/bitops.c | 32 + xen/arch/x86/cpu/mtrr/main.c | 7 xen/arch/x86/domain.c | 11 xen/arch/x86/domain_build.c | 4 xen/arch/x86/hvm/emulate.c | 133 +++++++- xen/arch/x86/hvm/hvm.c | 152 ++++++++- xen/arch/x86/hvm/mtrr.c | 312 ++++-------------- xen/arch/x86/hvm/svm/Makefile | 4 xen/arch/x86/hvm/svm/entry.S | 178 ++++++++++ xen/arch/x86/hvm/svm/intr.c | 6 xen/arch/x86/hvm/svm/svm.c | 40 -- xen/arch/x86/hvm/vmx/Makefile | 4 xen/arch/x86/hvm/vmx/entry.S | 198 +++++++++++ xen/arch/x86/hvm/vmx/intr.c | 6 xen/arch/x86/hvm/vmx/vmx.c | 101 ------ xen/arch/x86/mm.c | 35 -- xen/arch/x86/mm/shadow/common.c | 94 ++--- xen/arch/x86/mm/shadow/multi.c | 13 xen/arch/x86/setup.c | 4 xen/arch/x86/smp.c | 27 - xen/arch/x86/traps.c | 41 +- xen/arch/x86/x86_emulate.c | 18 - xen/arch/x86/x86_emulate/x86_emulate.c | 282 +++++++++++----- xen/arch/x86/x86_emulate/x86_emulate.h | 54 +-- xen/common/trace.c | 11 xen/common/xencomm.c | 2 xen/drivers/char/console.c | 2 xen/drivers/char/serial.c | 53 ++- xen/drivers/passthrough/amd/iommu_acpi.c | 214 +++++------- xen/drivers/passthrough/amd/iommu_detect.c | 62 +++ xen/drivers/passthrough/amd/iommu_init.c | 306 ++++++++++++++++++ xen/drivers/passthrough/amd/iommu_map.c | 21 - xen/drivers/passthrough/amd/pci_amd_iommu.c | 210 +++++------- xen/drivers/passthrough/iommu.c | 30 + xen/drivers/passthrough/vtd/dmar.c | 58 --- xen/drivers/passthrough/vtd/iommu.c | 432 ++++++++------------------ xen/drivers/passthrough/vtd/utils.c | 2 xen/drivers/passthrough/vtd/x86/vtd.c | 16 xen/include/asm-x86/amd-iommu.h | 6 xen/include/asm-x86/bitops.h | 52 +-- xen/include/asm-x86/hvm/hvm.h | 2 xen/include/asm-x86/hvm/support.h | 2 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h | 37 ++ xen/include/asm-x86/hvm/svm/amd-iommu-proto.h | 19 - xen/include/asm-x86/hvm/vcpu.h | 11 xen/include/asm-x86/mtrr.h | 8 xen/include/asm-x86/paging.h | 2 xen/include/public/xsm/acm.h | 7 xen/include/xen/iommu.h | 4 xen/include/xen/serial.h | 8 xen/include/xsm/acm/acm_core.h | 1 xen/tools/Makefile | 4 xen/tools/figlet/figlet.c | 24 - xen/xsm/acm/acm_policy.c | 8 123 files changed, 2967 insertions(+), 2425 deletions(-) diff -r 239b44eeb2d6 -r dc510776dd59 .hgignore --- a/.hgignore Thu Apr 24 14:02:16 2008 -0600 +++ b/.hgignore Thu Apr 24 14:08:29 2008 -0600 @@ -243,6 +243,7 @@ ^tools/xm-test/lib/XmTestLib/config.py$ ^tools/xm-test/lib/XmTestReport/xmtest.py$ ^tools/xm-test/tests/.*\.test$ +^xen/\.banner.*$ ^xen/BLOG$ ^xen/System.map$ ^xen/TAGS$ diff -r 239b44eeb2d6 -r dc510776dd59 Makefile --- a/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -121,6 +121,13 @@ distclean: # Linux name for GNU distclean .PHONY: mrproper mrproper: distclean + +# Prepare for source tarball +.PHONY: src-tarball +src-tarball: distclean + $(MAKE) -C xen .banner + rm -rf xen/tools/figlet .[a-z]* + $(MAKE) -C xen distclean .PHONY: help help: diff -r 239b44eeb2d6 -r dc510776dd59 docs/misc/vtd.txt --- a/docs/misc/vtd.txt Thu Apr 24 14:02:16 2008 -0600 +++ b/docs/misc/vtd.txt Thu Apr 24 14:08:29 2008 -0600 @@ -21,7 +21,7 @@ 11) "hide" pci device from dom0 as follo title Xen-Fedora Core (2.6.18-xen) root (hd0,0) - kernel /boot/xen.gz com1=115200,8n1 console=com1 vtd=1 + kernel /boot/xen.gz com1=115200,8n1 console=com1 module /boot/vmlinuz-2.6.18.8-xen root=LABEL=/ ro console=tty0 console=ttyS0,115200,8n1 pciback.hide=(01:00.0)(03:00.0) pciback.verbose_request=1 apic=debug module /boot/initrd-2.6.18-xen.img diff -r 239b44eeb2d6 -r dc510776dd59 docs/src/user.tex --- a/docs/src/user.tex Thu Apr 24 14:02:16 2008 -0600 +++ b/docs/src/user.tex Thu Apr 24 14:08:29 2008 -0600 @@ -4088,6 +4088,8 @@ editing \path{grub.conf}. a list of pages not to be allocated for use because they contain bad bytes. For example, if your memory tester says that byte 0x12345678 is bad, you would place `badpage=0x12345' on Xen's command line. +\item [ serial\_tx\_buffer=$<$size$>$ ] Size of serial transmit + buffers. Default is 16kB. \item [ com1=$<$baud$>$,DPS,$<$io\_base$>$,$<$irq$>$ com2=$<$baud$>$,DPS,$<$io\_base$>$,$<$irq$>$ ] \mbox{}\\ Xen supports up to two 16550-compatible serial ports. For example: @@ -4239,10 +4241,11 @@ In addition to the standard Linux kernel \begin{tabular}{l} `xencons=off': disable virtual console \\ `xencons=tty': attach console to /dev/tty1 (tty0 at boot-time) \\ - `xencons=ttyS': attach console to /dev/ttyS0 + `xencons=ttyS': attach console to /dev/ttyS0 \\ + `xencons=xvc': attach console to /dev/xvc0 \end{tabular} \end{center} -The default is ttyS for dom0 and tty for all other domains. +The default is ttyS for dom0 and xvc for all other domains. \end{description} diff -r 239b44eeb2d6 -r dc510776dd59 docs/xen-api/revision-history.tex --- a/docs/xen-api/revision-history.tex Thu Apr 24 14:02:16 2008 -0600 +++ b/docs/xen-api/revision-history.tex Thu Apr 24 14:08:29 2008 -0600 @@ -37,5 +37,15 @@ \end{flushleft} \end{minipage}\\ \hline + 1.0.5 & 17th Apr. 08 & S. Berger & + \begin{minipage}[t]{7cm} + \begin{flushleft} + Added undocumented fields and methods for default\_netmask and + default\_gateway to the Network class. Removed an unimplemented + method from the XSPolicy class and removed the 'optional' from + 'oldlabel' parameters. + \end{flushleft} + \end{minipage}\\ + \hline \end{tabular} \end{center} diff -r 239b44eeb2d6 -r dc510776dd59 docs/xen-api/xenapi-coversheet.tex --- a/docs/xen-api/xenapi-coversheet.tex Thu Apr 24 14:02:16 2008 -0600 +++ b/docs/xen-api/xenapi-coversheet.tex Thu Apr 24 14:08:29 2008 -0600 @@ -22,7 +22,7 @@ \newcommand{\releasestatement}{Stable Release} %% Document revision -\newcommand{\revstring}{API Revision 1.0.4} +\newcommand{\revstring}{API Revision 1.0.5} %% Document authors \newcommand{\docauthors}{ diff -r 239b44eeb2d6 -r dc510776dd59 docs/xen-api/xenapi-datamodel.tex --- a/docs/xen-api/xenapi-datamodel.tex Thu Apr 24 14:02:16 2008 -0600 +++ b/docs/xen-api/xenapi-datamodel.tex Thu Apr 24 14:08:29 2008 -0600 @@ -4467,7 +4467,7 @@ security_label, string old_label)\end{ve {\bf type} & {\bf name} & {\bf description} \\ \hline {\tt VM ref } & self & reference to the object \\ \hline {\tt string } & security\_label & security label for the VM \\ \hline -{\tt string } & old\_label & Optional label value that the security label \\ +{\tt string } & old\_label & Label value that the security label \\ & & must currently have for the change to succeed.\\ \hline \end{tabular} @@ -7619,6 +7619,8 @@ Quals & Field & Type & Description \\ $\mathit{RW}$ & {\tt name/description} & string & a notes field containg human-readable description \\ $\mathit{RO}_\mathit{run}$ & {\tt VIFs} & (VIF ref) Set & list of connected vifs \\ $\mathit{RO}_\mathit{run}$ & {\tt PIFs} & (PIF ref) Set & list of connected pifs \\ +$\mathit{RW}$ & {\tt default\_gateway} & string & default gateway \\ +$\mathit{RW}$ & {\tt default\_netmask} & string & default netmask \\ $\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\ \hline \end{longtable} @@ -7869,6 +7871,138 @@ Get the PIFs field of the given network. value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_default\_gateway} + +{\bf Overview:} +Get the default\_gateway field of the given network. + + \noindent {\bf Signature:} +\begin{verbatim} string get_default_gateway (session_id s, network ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt network ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +string +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~set\_default\_gateway} + +{\bf Overview:} +Set the default\_gateway field of the given network. + + \noindent {\bf Signature:} +\begin{verbatim} void set_default_gateway (session_id s, network ref self, string value)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt network ref } & self & reference to the object \\ \hline + +{\tt string } & value & New value to set \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_default\_netmask} + +{\bf Overview:} +Get the default\_netmask field of the given network. + + \noindent {\bf Signature:} +\begin{verbatim} string get_default_netmask (session_id s, network ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt network ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +string +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~set\_default\_netmask} + +{\bf Overview:} +Set the default\_netmask field of the given network. + + \noindent {\bf Signature:} +\begin{verbatim} void set_default_netmask (session_id s, network ref self, string value)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt network ref } & self & reference to the object \\ \hline + +{\tt string } & value & New value to set \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} @@ -8999,7 +9133,7 @@ security_label, string old_label)\end{ve {\tt VIF ref } & self & reference to the object \\ \hline {\tt string } & security\_label & New value of the security label \\ \hline -{\tt string } & old\_label & Optional label value that the security label \\ +{\tt string } & old\_label & Label value that the security label \\ & & must currently have for the change to succeed.\\ \hline \end{tabular} @@ -11504,7 +11638,7 @@ security_label, string old_label)\end{ve {\tt VDI ref } & self & reference to the object \\ \hline {\tt string } & security\_label & New value of the security label \\ \hline -{\tt string } & old\_label & Optional label value that the security label \\ +{\tt string } & old\_label & Label value that the security label \\ & & must currently have for the change to succeed.\\ \hline \end{tabular} @@ -14898,46 +15032,6 @@ The label of the given resource. \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} -\subsubsection{RPC name:~activate\_xspolicy} - -{\bf Overview:} -Load the referenced policy into the hypervisor. - - \noindent {\bf Signature:} -\begin{verbatim} xs_instantiationflags activate_xspolicy (session_id s, xs_ref xspolicy, -xs_instantiationflags flags)\end{verbatim} - - -\noindent{\bf Arguments:} - - -\vspace{0.3cm} -\begin{tabular}{|c|c|p{7cm}|} - \hline -{\bf type} & {\bf name} & {\bf description} \\ \hline -{\tt xs ref } & self & reference to the object \\ \hline -{\tt xs\_instantiationflags } & flags & flags to activate on a policy; flags - can only be set \\ \hline - -\end{tabular} - -\vspace{0.3cm} - - - \noindent {\bf Return Type:} -{\tt -xs\_instantiationflags -} - - -Currently active instantiation flags. -\vspace{0.3cm} - -\noindent{\bf Possible Error Codes:} {\tt SECURITY\_ERROR} - -\vspace{0.3cm} -\vspace{0.3cm} -\vspace{0.3cm} \subsubsection{RPC name:~can\_run} {\bf Overview:} diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/Makefile --- a/extras/mini-os/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -19,6 +19,7 @@ include minios.mk # Define some default flags for linking. LDLIBS := +APP_LDLIBS := LDARCHLIB := -L$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME) LDFLAGS_FINAL := -T $(TARGET_ARCH_DIR)/minios-$(XEN_TARGET_ARCH).lds @@ -33,6 +34,7 @@ SUBDIRS := lib xenbus console SUBDIRS := lib xenbus console # The common mini-os objects to build. +APP_OBJS := OBJS := $(patsubst %.c,%.o,$(wildcard *.c)) OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c)) OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c)) @@ -75,28 +77,28 @@ OBJS := $(filter-out lwip%.o $(LWO), $(O ifeq ($(caml),y) CAMLLIB = $(shell ocamlc -where) -OBJS += $(CAMLDIR)/caml.o -OBJS += $(CAMLLIB)/libasmrun.a +APP_OBJS += main-caml.o +APP_OBJS += $(CAMLDIR)/caml.o +APP_OBJS += $(CAMLLIB)/libasmrun.a CFLAGS += -I$(CAMLLIB) -LDLIBS += -lm -else +APP_LDLIBS += -lm +endif OBJS := $(filter-out main-caml.o, $(OBJS)) -endif ifeq ($(qemu),y) -OBJS += $(QEMUDIR)/i386-dm-stubdom/qemu.a $(QEMUDIR)/i386-dm-stubdom/libqemu.a +APP_OBJS += $(QEMUDIR)/i386-dm-stubdom/qemu.a $(QEMUDIR)/i386-dm-stubdom/libqemu.a CFLAGS += -DCONFIG_QEMU endif ifneq ($(CDIR),) -OBJS += $(CDIR)/main.a -LDLIBS += +APP_OBJS += $(CDIR)/main.a +APP_LDLIBS += endif ifeq ($(libc),y) LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -lxenctrl -lxenguest -LDLIBS += -lpci -LDLIBS += -lz +APP_LDLIBS += -lpci +APP_LDLIBS += -lz LDLIBS += -lc endif @@ -104,8 +106,11 @@ OBJS := $(filter-out daytime.o, $(OBJS)) OBJS := $(filter-out daytime.o, $(OBJS)) endif -$(TARGET): links $(OBJS) arch_lib - $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o +app.o: $(APP_OBJS) app.lds + $(LD) -r -d $(LDFLAGS) $^ $(APP_LDLIBS) --undefined main -o $@ + +$(TARGET): links $(OBJS) app.o arch_lib + $(LD) -r $(LDFLAGS) $(HEAD_OBJ) app.o $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@ gzip -f -9 -c $@ >$@.gz diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/app.lds --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/extras/mini-os/app.lds Thu Apr 24 14:08:29 2008 -0600 @@ -0,0 +1,11 @@ +SECTIONS +{ + .app.bss : { + __app_bss_start = . ; + *(.bss .bss.*) + *(COMMON) + *(.lbss .lbss.*) + *(LARGE_COMMON) + __app_bss_end = . ; + } +} diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/arch/ia64/minios-ia64.lds --- a/extras/mini-os/arch/ia64/minios-ia64.lds Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/arch/ia64/minios-ia64.lds Thu Apr 24 14:08:29 2008 -0600 @@ -59,7 +59,10 @@ SECTIONS { *(.IA_64.unwind) } .bss : AT(ADDR(.bss) - (((5<<(61))+0x100000000) - (1 << 20))) - { *(.bss) } + { + *(.bss) + *(.app.bss) + } _end = .; diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/arch/x86/minios-x86_32.lds --- a/extras/mini-os/arch/x86/minios-x86_32.lds Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/arch/x86/minios-x86_32.lds Thu Apr 24 14:08:29 2008 -0600 @@ -38,6 +38,7 @@ SECTIONS __bss_start = .; /* BSS */ .bss : { *(.bss) + *(.app.bss) } _end = . ; diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/arch/x86/minios-x86_64.lds --- a/extras/mini-os/arch/x86/minios-x86_64.lds Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/arch/x86/minios-x86_64.lds Thu Apr 24 14:08:29 2008 -0600 @@ -38,6 +38,7 @@ SECTIONS __bss_start = .; /* BSS */ .bss : { *(.bss) + *(.app.bss) } _end = . ; diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/arch/x86/mm.c --- a/extras/mini-os/arch/x86/mm.c Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/arch/x86/mm.c Thu Apr 24 14:08:29 2008 -0600 @@ -556,7 +556,6 @@ void *map_frames_ex(unsigned long *f, un static void clear_bootstrap(void) { - struct xen_memory_reservation reservation; xen_pfn_t mfns[] = { virt_to_mfn(&shared_info) }; int n = sizeof(mfns)/sizeof(*mfns); pte_t nullpte = { }; @@ -567,11 +566,7 @@ static void clear_bootstrap(void) if (HYPERVISOR_update_va_mapping((unsigned long) &_text, nullpte, UVMF_INVLPG)) printk("Unable to unmap first page\n"); - set_xen_guest_handle(reservation.extent_start, mfns); - reservation.nr_extents = n; - reservation.extent_order = 0; - reservation.domid = DOMID_SELF; - if (HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation) != n) + if (free_physical_pages(mfns, n) != n) printk("Unable to free bootstrap pages\n"); } diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/fbfront.c --- a/extras/mini-os/fbfront.c Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/fbfront.c Thu Apr 24 14:08:29 2008 -0600 @@ -243,12 +243,12 @@ struct fbfront_dev { char *backend; int request_update; - char *data; int width; int height; int depth; - int line_length; + int stride; int mem_length; + int offset; }; void fbfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) @@ -256,7 +256,7 @@ void fbfront_handler(evtchn_port_t port, wake_up(&fbfront_queue); } -struct fbfront_dev *init_fbfront(char *nodename, void *data, int width, int height, int depth, int line_length, int mem_length) +struct fbfront_dev *init_fbfront(char *nodename, unsigned long *mfns, int width, int height, int depth, int stride, int n) { xenbus_transaction_t xbt; char* err; @@ -289,24 +289,17 @@ struct fbfront_dev *init_fbfront(char *n dev->width = s->width = width; dev->height = s->height = height; dev->depth = s->depth = depth; - dev->line_length = s->line_length = line_length; - dev->mem_length = s->mem_length = mem_length; - - ASSERT(!((unsigned long)data & ~PAGE_MASK)); - dev->data = data; + dev->stride = s->line_length = stride; + dev->mem_length = s->mem_length = n * PAGE_SIZE; + dev->offset = 0; const int max_pd = sizeof(s->pd) / sizeof(s->pd[0]); unsigned long mapped = 0; - for (i = 0; mapped < mem_length && i < max_pd; i++) { + for (i = 0; mapped < n && i < max_pd; i++) { unsigned long *pd = (unsigned long *) alloc_page(); - for (j = 0; mapped < mem_length && j < PAGE_SIZE / sizeof(unsigned long); j++) { - /* Trigger CoW */ - * ((char *)data + mapped) = 0; - barrier(); - pd[j] = virtual_to_mfn((unsigned long) data + mapped); - mapped += PAGE_SIZE; - } + for (j = 0; mapped < n && j < PAGE_SIZE / sizeof(unsigned long); j++) + pd[j] = mfns[mapped++]; for ( ; j < PAGE_SIZE / sizeof(unsigned long); j++) pd[j] = 0; s->pd[i] = virt_to_mfn(pd); @@ -395,31 +388,11 @@ done: return dev; } -void fbfront_update(struct fbfront_dev *dev, int x, int y, int width, int height) +static void fbfront_out_event(struct fbfront_dev *dev, union xenfb_out_event *event) { struct xenfb_page *page = dev->page; uint32_t prod; DEFINE_WAIT(w); - - if (dev->request_update <= 0) - return; - - if (x < 0) { - width += x; - x = 0; - } - if (x + width > dev->width) - width = dev->width - x; - - if (y < 0) { - height += y; - y = 0; - } - if (y + height > dev->height) - height = dev->height - y; - - if (width <= 0 || height <= 0) - return; add_waiter(w, fbfront_queue); while (page->out_prod - page->out_cons == XENFB_OUT_RING_LEN) @@ -428,14 +401,55 @@ void fbfront_update(struct fbfront_dev * prod = page->out_prod; mb(); /* ensure ring space available */ - XENFB_OUT_RING_REF(page, prod).type = XENFB_TYPE_UPDATE; - XENFB_OUT_RING_REF(page, prod).update.x = x; - XENFB_OUT_RING_REF(page, prod).update.y = y; - XENFB_OUT_RING_REF(page, prod).update.width = width; - XENFB_OUT_RING_REF(page, prod).update.height = height; + XENFB_OUT_RING_REF(page, prod) = *event; wmb(); /* ensure ring contents visible */ page->out_prod = prod + 1; notify_remote_via_evtchn(dev->evtchn); +} + +void fbfront_update(struct fbfront_dev *dev, int x, int y, int width, int height) +{ + struct xenfb_update update; + + if (dev->request_update <= 0) + return; + + if (x < 0) { + width += x; + x = 0; + } + if (x + width > dev->width) + width = dev->width - x; + + if (y < 0) { + height += y; + y = 0; + } + if (y + height > dev->height) + height = dev->height - y; + + if (width <= 0 || height <= 0) + return; + + update.type = XENFB_TYPE_UPDATE; + update.x = x; + update.y = y; + update.width = width; + update.height = height; + fbfront_out_event(dev, (union xenfb_out_event *) &update); +} + +void fbfront_resize(struct fbfront_dev *dev, int width, int height, int stride, int depth, int offset) +{ + struct xenfb_resize resize; + + resize.type = XENFB_TYPE_RESIZE; + dev->width = resize.width = width; + dev->height = resize.height = height; + dev->stride = resize.stride = stride; + dev->depth = resize.depth = depth; + dev->offset = resize.offset = offset; + fbfront_out_event(dev, (union xenfb_out_event *) &resize); } void shutdown_fbfront(struct fbfront_dev *dev) diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/hypervisor.c --- a/extras/mini-os/hypervisor.c Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/hypervisor.c Thu Apr 24 14:08:29 2008 -0600 @@ -66,6 +66,21 @@ void do_hypervisor_callback(struct pt_re in_callback = 0; } +void force_evtchn_callback(void) +{ + vcpu_info_t *vcpu; + vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; + int save = vcpu->evtchn_upcall_mask; + + while (vcpu->evtchn_upcall_pending) { + vcpu->evtchn_upcall_mask = 1; + barrier(); + do_hypervisor_callback(NULL); + barrier(); + vcpu->evtchn_upcall_mask = save; + barrier(); + }; +} inline void mask_evtchn(u32 port) { diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/include/fbfront.h --- a/extras/mini-os/include/fbfront.h Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/include/fbfront.h Thu Apr 24 14:08:29 2008 -0600 @@ -31,11 +31,12 @@ void shutdown_kbdfront(struct kbdfront_d void shutdown_kbdfront(struct kbdfront_dev *dev); -struct fbfront_dev *init_fbfront(char *nodename, void *data, int width, int height, int depth, int line_length, int mem_length); +struct fbfront_dev *init_fbfront(char *nodename, unsigned long *mfns, int width, int height, int depth, int stride, int n); #ifdef HAVE_LIBC int fbfront_open(struct fbfront_dev *dev); #endif void fbfront_update(struct fbfront_dev *dev, int x, int y, int width, int height); +void fbfront_resize(struct fbfront_dev *dev, int width, int height, int stride, int depth, int offset); void shutdown_fbfront(struct fbfront_dev *dev); diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/include/hypervisor.h --- a/extras/mini-os/include/hypervisor.h Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/include/hypervisor.h Thu Apr 24 14:08:29 2008 -0600 @@ -24,6 +24,7 @@ #else #error "Unsupported architecture" #endif +#include /* * a placeholder for the start of day information passed up from the hypervisor @@ -37,7 +38,8 @@ extern union start_info_union start_info #define start_info (start_info_union.start_info) /* hypervisor.c */ -//void do_hypervisor_callback(struct pt_regs *regs); +void force_evtchn_callback(void); +void do_hypervisor_callback(struct pt_regs *regs); void mask_evtchn(u32 port); void unmask_evtchn(u32 port); void clear_evtchn(u32 port); diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/include/ia64/arch_mm.h --- a/extras/mini-os/include/ia64/arch_mm.h Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/include/ia64/arch_mm.h Thu Apr 24 14:08:29 2008 -0600 @@ -38,6 +38,6 @@ #define map_frames(f, n) map_frames_ex(f, n, 1, 0, 1, DOMID_SELF, 0, 0) /* TODO */ #define map_zero(n, a) map_frames_ex(NULL, n, 0, 0, a, DOMID_SELF, 0, 0) -#define do_map_zero(start, n) ((void)0) +#define do_map_zero(start, n) ASSERT(n == 0) #endif /* __ARCH_MM_H__ */ diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/include/ia64/os.h --- a/extras/mini-os/include/ia64/os.h Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/include/ia64/os.h Thu Apr 24 14:08:29 2008 -0600 @@ -189,17 +189,6 @@ __synch_cmpxchg(volatile void *ptr, uint return ia64_cmpxchg_acq_64(ptr, old, new); } -/* - * Force a proper event-channel callback from Xen after clearing the - * callback mask. We do this in a very simple manner, by making a call - * down into Xen. The pending flag will be checked by Xen on return. - */ -static inline void -force_evtchn_callback(void) -{ - (void)HYPERVISOR_xen_version(0, NULL); -} - extern shared_info_t *HYPERVISOR_shared_info; static inline int diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/include/lib.h --- a/extras/mini-os/include/lib.h Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/include/lib.h Thu Apr 24 14:08:29 2008 -0600 @@ -187,6 +187,7 @@ int alloc_fd(enum fd_type type); int alloc_fd(enum fd_type type); void close_all_files(void); extern struct thread *main_thread; +void sparse(unsigned long data, size_t size); #endif #endif /* _LIB_H_ */ diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/include/mm.h --- a/extras/mini-os/include/mm.h Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/include/mm.h Thu Apr 24 14:08:29 2008 -0600 @@ -70,4 +70,6 @@ extern unsigned long heap, brk, heap_map extern unsigned long heap, brk, heap_mapped, heap_end; #endif +int free_physical_pages(xen_pfn_t *mfns, int n); + #endif /* _MM_H_ */ diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/include/x86/os.h --- a/extras/mini-os/include/x86/os.h Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/include/x86/os.h Thu Apr 24 14:08:29 2008 -0600 @@ -28,7 +28,6 @@ extern void do_exit(void) __attribute__( #include -#define force_evtchn_callback() ((void)HYPERVISOR_xen_version(0, 0)) #define __KERNEL_CS FLAT_KERNEL_CS #define __KERNEL_DS FLAT_KERNEL_DS diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/kernel.c --- a/extras/mini-os/kernel.c Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/kernel.c Thu Apr 24 14:08:29 2008 -0600 @@ -297,9 +297,20 @@ static void fbfront_thread(void *p) { size_t line_length = WIDTH * (DEPTH / 8); size_t memsize = HEIGHT * line_length; - + unsigned long *mfns; + int i, n = (memsize + PAGE_SIZE-1) / PAGE_SIZE; + + memsize = n * PAGE_SIZE; fb = _xmalloc(memsize, PAGE_SIZE); - fb_dev = init_fbfront(NULL, fb, WIDTH, HEIGHT, DEPTH, line_length, memsize); + mfns = xmalloc_array(unsigned long, n); + for (i = 0; i < n; i++) { + /* trigger CoW */ + ((char *) fb) [i * PAGE_SIZE] = 0; + barrier(); + mfns[i] = virtual_to_mfn((char *) fb + i * PAGE_SIZE); + } + fb_dev = init_fbfront(NULL, mfns, WIDTH, HEIGHT, DEPTH, line_length, n); + xfree(mfns); if (!fb_dev) { xfree(fb); return; diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/lib/sys.c --- a/extras/mini-os/lib/sys.c Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/lib/sys.c Thu Apr 24 14:08:29 2008 -0600 @@ -1108,6 +1108,41 @@ int munmap(void *start, size_t length) return 0; } +void sparse(unsigned long data, size_t size) +{ + unsigned long newdata; + xen_pfn_t *mfns; + int i, n; + + newdata = (data + PAGE_SIZE - 1) & PAGE_MASK; + if (newdata - data > size) + return; + size -= newdata - data; + data = newdata; + n = size / PAGE_SIZE; + size = n * PAGE_SIZE; + + mfns = malloc(n * sizeof(*mfns)); + for (i = 0; i < n; i++) { +#ifdef LIBC_DEBUG + int j; + for (j=0; j> 20, data); + + munmap((void *) data, size); + free_physical_pages(mfns, n); + do_map_zero(data, n); +} + + /* Not supported by FS yet. */ unsupported_function_crash(link); unsupported_function(int, readlink, -1); diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/main.c --- a/extras/mini-os/main.c Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/main.c Thu Apr 24 14:08:29 2008 -0600 @@ -39,6 +39,7 @@ void _fini(void) { } +extern char __app_bss_start, __app_bss_end; static void call_main(void *p) { char *args, /**path,*/ *msg, *c; @@ -56,6 +57,7 @@ static void call_main(void *p) * crashing. */ //sleep(1); + sparse((unsigned long) &__app_bss_start, &__app_bss_end - &__app_bss_start); start_networking(); init_fs_frontend(); diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/mm.c --- a/extras/mini-os/mm.c Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/mm.c Thu Apr 24 14:08:29 2008 -0600 @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -360,6 +361,17 @@ void free_pages(void *pointer, int order } +int free_physical_pages(xen_pfn_t *mfns, int n) +{ + struct xen_memory_reservation reservation; + + set_xen_guest_handle(reservation.extent_start, mfns); + reservation.nr_extents = n; + reservation.extent_order = 0; + reservation.domid = DOMID_SELF; + return HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); +} + #ifdef HAVE_LIBC void *sbrk(ptrdiff_t increment) { diff -r 239b44eeb2d6 -r dc510776dd59 extras/mini-os/sched.c --- a/extras/mini-os/sched.c Thu Apr 24 14:02:16 2008 -0600 +++ b/extras/mini-os/sched.c Thu Apr 24 14:08:29 2008 -0600 @@ -70,62 +70,15 @@ void inline print_runqueue(void) printk("\n"); } -/* Find the time when the next timeout expires. If this is more than - 10 seconds from now, return 10 seconds from now. */ -static s_time_t blocking_time(void) -{ - struct thread *thread; - struct list_head *iterator; - s_time_t min_wakeup_time; - unsigned long flags; - local_irq_save(flags); - /* default-block the domain for 10 seconds: */ - min_wakeup_time = NOW() + SECONDS(10); - - /* Thread list needs to be protected */ - list_for_each(iterator, &idle_thread->thread_list) - { - thread = list_entry(iterator, struct thread, thread_list); - if(!is_runnable(thread) && thread->wakeup_time != 0LL) - { - if(thread->wakeup_time < min_wakeup_time) - { - min_wakeup_time = thread->wakeup_time; - } - } - } - local_irq_restore(flags); - return(min_wakeup_time); -} - -/* Wake up all threads with expired timeouts. */ -static void wake_expired(void) -{ - struct thread *thread; - struct list_head *iterator; - s_time_t now = NOW(); - unsigned long flags; - local_irq_save(flags); - /* Thread list needs to be protected */ - list_for_each(iterator, &idle_thread->thread_list) - { - thread = list_entry(iterator, struct thread, thread_list); - if(!is_runnable(thread) && thread->wakeup_time != 0LL) - { - if(thread->wakeup_time <= now) - wake(thread); - } - } - local_irq_restore(flags); -} - void schedule(void) { struct thread *prev, *next, *thread; struct list_head *iterator; unsigned long flags; + prev = current; local_irq_save(flags); + if (in_callback) { printk("Must not call schedule() from a callback\n"); BUG(); @@ -134,6 +87,45 @@ void schedule(void) printk("Must not call schedule() with IRQs disabled\n"); BUG(); } + + do { + /* Examine all threads. + Find a runnable thread, but also wake up expired ones and find the + time when the next timeout expires, else use 10 seconds. */ + s_time_t now = NOW(); + s_time_t min_wakeup_time = now + SECONDS(10); + next = NULL; + list_for_each(iterator, &idle_thread->thread_list) + { + thread = list_entry(iterator, struct thread, thread_list); + if (!is_runnable(thread) && thread->wakeup_time != 0LL) + { + if (thread->wakeup_time <= now) + wake(thread); + else if (thread->wakeup_time < min_wakeup_time) + min_wakeup_time = thread->wakeup_time; + } + if(is_runnable(thread)) + { + next = thread; + /* Put this thread on the end of the list */ + list_del(&thread->thread_list); + list_add_tail(&thread->thread_list, &idle_thread->thread_list); + break; + } + } + if (next) + break; + /* block until the next timeout expires, or for 10 secs, whichever comes first */ + block_domain(min_wakeup_time); + /* handle pending events if any */ + force_evtchn_callback(); + } while(1); + local_irq_restore(flags); + /* Interrupting the switch is equivalent to having the next thread + inturrupted at the return instruction. And therefore at safe point. */ + if(prev != next) switch_threads(prev, next); + list_for_each(iterator, &exited_threads) { thread = list_entry(iterator, struct thread, thread_list); @@ -144,24 +136,6 @@ void schedule(void) xfree(thread); } } - next = idle_thread; - /* Thread list needs to be protected */ - list_for_each(iterator, &idle_thread->thread_list) - { - thread = list_entry(iterator, struct thread, thread_list); - if(is_runnable(thread)) - { - next = thread; - /* Put this thread on the end of the list */ - list_del(&thread->thread_list); - list_add_tail(&thread->thread_list, &idle_thread->thread_list); - break; - } - } - local_irq_restore(flags); - /* Interrupting the switch is equivalent to having the next thread - inturrupted at the return instruction. And therefore at safe point. */ - if(prev != next) switch_threads(prev, next); } struct thread* create_thread(char *name, void (*function)(void *), void *data) @@ -267,32 +241,10 @@ void wake(struct thread *thread) void idle_thread_fn(void *unused) { - s_time_t until; threads_started = 1; - unsigned long flags; - struct list_head *iterator; - struct thread *next, *thread; - for(;;) - { - schedule(); - next = NULL; - local_irq_save(flags); - list_for_each(iterator, &idle_thread->thread_list) - { - thread = list_entry(iterator, struct thread, thread_list); - if(is_runnable(thread)) - { - next = thread; - break; - } - } - if (!next) { - /* block until the next timeout expires, or for 10 secs, whichever comes first */ - until = blocking_time(); - block_domain(until); - } - local_irq_restore(flags); - wake_expired(); + while (1) { + block(current); + schedule(); } } diff -r 239b44eeb2d6 -r dc510776dd59 tools/blktap/drivers/blktapctrl.c --- a/tools/blktap/drivers/blktapctrl.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/blktap/drivers/blktapctrl.c Thu Apr 24 14:08:29 2008 -0600 @@ -474,9 +474,8 @@ static int read_msg(int fd, int msgtype, } -int launch_tapdisk(char *wrctldev, char *rdctldev) -{ - char *argv[] = { "tapdisk", wrctldev, rdctldev, NULL }; +static int launch_tapdisk_provider(char **argv) +{ pid_t child; if ((child = fork()) < 0) @@ -490,7 +489,9 @@ int launch_tapdisk(char *wrctldev, char i != STDERR_FILENO) close(i); - execvp("tapdisk", argv); + execvp(argv[0], argv); + DPRINTF("execvp failed: %d (%s)\n", errno, strerror(errno)); + DPRINTF("PATH = %s\n", getenv("PATH")); _exit(1); } else { pid_t got; @@ -498,28 +499,78 @@ int launch_tapdisk(char *wrctldev, char got = waitpid(child, NULL, 0); } while (got != child); } + return child; +} + +static int launch_tapdisk(char *wrctldev, char *rdctldev) +{ + char *argv[] = { "tapdisk", wrctldev, rdctldev, NULL }; + + if (launch_tapdisk_provider(argv) < 0) + return -1; + return 0; } -/* Connect to qemu-dm */ -static int connect_qemu(blkif_t *blkif) +static int launch_tapdisk_ioemu(void) +{ + char *argv[] = { "tapdisk-ioemu", NULL }; + return launch_tapdisk_provider(argv); +} + +/* + * Connect to an ioemu based disk provider (qemu-dm or tapdisk-ioemu) + * + * If the domain has a device model, connect to qemu-dm through the + * domain specific pipe. Otherwise use a single tapdisk-ioemu instance + * which is represented by domid 0 and provides access for Dom0 and + * all DomUs without device model. + */ +static int connect_qemu(blkif_t *blkif, int domid) { char *rdctldev, *wrctldev; - - if (asprintf(&rdctldev, BLKTAP_CTRL_DIR "/qemu-read-%d", - blkif->domid) < 0) - return -1; - - if (asprintf(&wrctldev, BLKTAP_CTRL_DIR "/qemu-write-%d", - blkif->domid) < 0) { + + static int tapdisk_ioemu_pid = 0; + static int dom0_readfd = 0; + static int dom0_writefd = 0; + + if (asprintf(&rdctldev, BLKTAP_CTRL_DIR "/qemu-read-%d", domid) < 0) + return -1; + + if (asprintf(&wrctldev, BLKTAP_CTRL_DIR "/qemu-write-%d", domid) < 0) { free(rdctldev); return -1; } DPRINTF("Using qemu blktap pipe: %s\n", rdctldev); - blkif->fds[READ] = open_ctrl_socket(wrctldev); - blkif->fds[WRITE] = open_ctrl_socket(rdctldev); + if (domid == 0) { + /* + * tapdisk-ioemu exits as soon as the last image is + * disconnected. Check if it is still running. + */ + if (tapdisk_ioemu_pid == 0 || kill(tapdisk_ioemu_pid, 0)) { + /* No device model and tapdisk-ioemu doesn't run yet */ + DPRINTF("Launching tapdisk-ioemu\n"); + tapdisk_ioemu_pid = launch_tapdisk_ioemu(); + + dom0_readfd = open_ctrl_socket(wrctldev); + dom0_writefd = open_ctrl_socket(rdctldev); + } + + DPRINTF("Using tapdisk-ioemu connection\n"); + blkif->fds[READ] = dom0_readfd; + blkif->fds[WRITE] = dom0_writefd; + } else if (access(rdctldev, R_OK | W_OK) == 0) { + /* Use existing pipe to the device model */ + DPRINTF("Using qemu-dm connection\n"); + blkif->fds[READ] = open_ctrl_socket(wrctldev); + blkif->fds[WRITE] = open_ctrl_socket(rdctldev); + } else { + /* No device model => try with tapdisk-ioemu */ + DPRINTF("No device model\n"); + connect_qemu(blkif, 0); + } free(rdctldev); free(wrctldev); @@ -599,7 +650,7 @@ int blktapctrl_new_blkif(blkif_t *blkif) if (!exist) { if (type == DISK_TYPE_IOEMU) { - if (connect_qemu(blkif)) + if (connect_qemu(blkif, blkif->domid)) goto fail; } else { if (connect_tapdisk(blkif, minor)) diff -r 239b44eeb2d6 -r dc510776dd59 tools/blktap/drivers/tapdisk.h --- a/tools/blktap/drivers/tapdisk.h Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/blktap/drivers/tapdisk.h Thu Apr 24 14:08:29 2008 -0600 @@ -235,7 +235,7 @@ static disk_info_t ioemu_disk = { DISK_TYPE_IOEMU, "ioemu disk", "ioemu", - 0, + 1, #ifdef TAPDISK NULL #endif diff -r 239b44eeb2d6 -r dc510776dd59 tools/console/daemon/io.c --- a/tools/console/daemon/io.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/console/daemon/io.c Thu Apr 24 14:08:29 2008 -0600 @@ -63,6 +63,7 @@ extern int log_time_hv; extern int log_time_hv; extern int log_time_guest; extern char *log_dir; +extern int discard_overflowed_data; static int log_time_hv_needts = 1; static int log_time_guest_needts = 1; @@ -201,7 +202,7 @@ static void buffer_append(struct domain dom->domid, errno, strerror(errno)); } - if (buffer->max_capacity && + if (discard_overflowed_data && buffer->max_capacity && buffer->size > buffer->max_capacity) { /* Discard the middle of the data. */ @@ -228,6 +229,11 @@ static void buffer_advance(struct buffer if (buffer->consumed == buffer->size) { buffer->consumed = 0; buffer->size = 0; + if (buffer->max_capacity && + buffer->capacity > buffer->max_capacity) { + buffer->data = realloc(buffer->data, buffer->max_capacity); + buffer->capacity = buffer->max_capacity; + } } } @@ -1005,9 +1011,13 @@ void handle_io(void) d->next_period < next_timeout) next_timeout = d->next_period; } else if (d->xce_handle != -1) { - int evtchn_fd = xc_evtchn_fd(d->xce_handle); - FD_SET(evtchn_fd, &readfds); - max_fd = MAX(evtchn_fd, max_fd); + if (discard_overflowed_data || + !d->buffer.max_capacity || + d->buffer.size < d->buffer.max_capacity) { + int evtchn_fd = xc_evtchn_fd(d->xce_handle); + FD_SET(evtchn_fd, &readfds); + max_fd = MAX(evtchn_fd, max_fd); + } } if (d->master_fd != -1) { diff -r 239b44eeb2d6 -r dc510776dd59 tools/console/daemon/main.c --- a/tools/console/daemon/main.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/console/daemon/main.c Thu Apr 24 14:08:29 2008 -0600 @@ -38,6 +38,7 @@ int log_time_hv = 0; int log_time_hv = 0; int log_time_guest = 0; char *log_dir = NULL; +int discard_overflowed_data = 1; static void handle_hup(int sig) { @@ -46,7 +47,7 @@ static void handle_hup(int sig) static void usage(char *name) { - printf("Usage: %s [-h] [-V] [-v] [-i] [--log=none|guest|hv|all] [--log-dir=DIR] [--pid-file=PATH] [-t, --timestamp=none|guest|hv|all]\n", name); + printf("Usage: %s [-h] [-V] [-v] [-i] [--log=none|guest|hv|all] [--log-dir=DIR] [--pid-file=PATH] [-t, --timestamp=none|guest|hv|all] [-o, --overflow-data=discard|keep]\n", name); } static void version(char *name) @@ -56,7 +57,7 @@ static void version(char *name) int main(int argc, char **argv) { - const char *sopts = "hVvit:"; + const char *sopts = "hVvit:o:"; struct option lopts[] = { { "help", 0, 0, 'h' }, { "version", 0, 0, 'V' }, @@ -66,6 +67,7 @@ int main(int argc, char **argv) { "log-dir", 1, 0, 'r' }, { "pid-file", 1, 0, 'p' }, { "timestamp", 1, 0, 't' }, + { "overflow-data", 1, 0, 'o'}, { 0 }, }; bool is_interactive = false; @@ -119,6 +121,13 @@ int main(int argc, char **argv) log_time_hv = 0; } break; + case 'o': + if (!strcmp(optarg, "keep")) { + discard_overflowed_data = 0; + } else if (!strcmp(optarg, "discard")) { + discard_overflowed_data = 1; + } + break; case '?': fprintf(stderr, "Try `%s --help' for more information\n", diff -r 239b44eeb2d6 -r dc510776dd59 tools/examples/blktap --- a/tools/examples/blktap Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/examples/blktap Thu Apr 24 14:08:29 2008 -0600 @@ -54,10 +54,6 @@ check_blktap_sharing() echo 'ok' } -FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") -FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm") -mode=$(xenstore_read "$XENBUS_PATH/mode") -mode=$(canonicalise_mode "$mode") t=$(xenstore_read_default "$XENBUS_PATH/type" 'MISSING') if [ -n "$t" ] @@ -77,15 +73,21 @@ else file="$p" fi -if [ "$mode" != '!' ] -then - result=$(check_blktap_sharing "$file" "$mode") - [ "$result" = 'ok' ] || ebusy "$file already in use by other domain" -fi - if [ "$command" = 'add' ] then [ -e "$file" ] || { fatal $file does not exist; } + + FRONTEND_ID=$(xenstore_read "$XENBUS_PATH/frontend-id") + FRONTEND_UUID=$(xenstore_read "/local/domain/$FRONTEND_ID/vm") + mode=$(xenstore_read "$XENBUS_PATH/mode") + mode=$(canonicalise_mode "$mode") + + if [ "$mode" != '!' ] + then + result=$(check_blktap_sharing "$file" "$mode") + [ "$result" = 'ok' ] || ebusy "$file already in use by other domain" + fi + success fi diff -r 239b44eeb2d6 -r dc510776dd59 tools/firmware/hvmloader/Makefile --- a/tools/firmware/hvmloader/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/firmware/hvmloader/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -28,8 +28,9 @@ LOADADDR = 0x100000 CFLAGS += $(CFLAGS_include) -I. -SRCS = hvmloader.c mp_tables.c util.c smbios.c 32bitbios_support.c smp.c -OBJS = $(patsubst %.c,%.o,$(SRCS)) +SRCS = hvmloader.c mp_tables.c util.c smbios.c +SRCS += 32bitbios_support.c smp.c cacheattr.c +OBJS = $(patsubst %.c,%.o,$(SRCS)) .PHONY: all all: hvmloader diff -r 239b44eeb2d6 -r dc510776dd59 tools/firmware/hvmloader/acpi/build.c --- a/tools/firmware/hvmloader/acpi/build.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/firmware/hvmloader/acpi/build.c Thu Apr 24 14:08:29 2008 -0600 @@ -84,8 +84,8 @@ static int construct_bios_info_table(uin bios_info->hpet_present = hpet_exists(ACPI_HPET_ADDRESS); - bios_info->pci_min = 0xf0000000; - bios_info->pci_len = 0x0c000000; + bios_info->pci_min = PCI_MEMBASE; + bios_info->pci_len = PCI_MEMSIZE; return align16(sizeof(*bios_info)); } diff -r 239b44eeb2d6 -r dc510776dd59 tools/firmware/hvmloader/cacheattr.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/firmware/hvmloader/cacheattr.c Thu Apr 24 14:08:29 2008 -0600 @@ -0,0 +1,99 @@ +/* + * cacheattr.c: MTRR and PAT initialisation. + * + * Copyright (c) 2008, Citrix Systems, Inc. + * + * Authors: + * Keir Fraser + * + * 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + */ + +#include "util.h" +#include "config.h" + +#define MSR_MTRRphysBase(reg) (0x200 + 2 * (reg)) +#define MSR_MTRRphysMask(reg) (0x200 + 2 * (reg) + 1) +#define MSR_MTRRcap 0x00fe +#define MSR_MTRRfix64K_00000 0x0250 +#define MSR_MTRRfix16K_80000 0x0258 +#define MSR_MTRRfix16K_A0000 0x0259 +#define MSR_MTRRfix4K_C0000 0x0268 +#define MSR_MTRRfix4K_C8000 0x0269 +#define MSR_MTRRfix4K_D0000 0x026a +#define MSR_MTRRfix4K_D8000 0x026b +#define MSR_MTRRfix4K_E0000 0x026c +#define MSR_MTRRfix4K_E8000 0x026d +#define MSR_MTRRfix4K_F0000 0x026e +#define MSR_MTRRfix4K_F8000 0x026f +#define MSR_PAT 0x0277 +#define MSR_MTRRdefType 0x02ff + +void cacheattr_init(void) +{ + uint32_t eax, ebx, ecx, edx; + uint64_t mtrr_cap, mtrr_def, content, addr_mask; + unsigned int i, nr_var_ranges, phys_bits = 36; + + /* Does the CPU support architectural MTRRs? */ + cpuid(0x00000001, &eax, &ebx, &ecx, &edx); + if ( !(edx & (1u << 12)) ) + return; + + /* Find the physical address size for this CPU. */ + cpuid(0x80000000, &eax, &ebx, &ecx, &edx); + if ( eax >= 0x80000008 ) + { + cpuid(0x80000008, &eax, &ebx, &ecx, &edx); + phys_bits = (uint8_t)eax; + } + + printf("%u-bit phys ... ", phys_bits); + + addr_mask = ((1ull << phys_bits) - 1) & ~((1ull << 12) - 1); + mtrr_cap = rdmsr(MSR_MTRRcap); + mtrr_def = (1u << 11) | 6; /* E, default type WB */ + + /* Fixed-range MTRRs supported? */ + if ( mtrr_cap & (1u << 8) ) + { + /* 0x00000-0x9ffff: Write Back (WB) */ + content = 0x0606060606060606ull; + wrmsr(MSR_MTRRfix64K_00000, content); + wrmsr(MSR_MTRRfix16K_80000, content); + /* 0xa0000-0xbffff: Write Combining (WC) */ + if ( mtrr_cap & (1u << 10) ) /* WC supported? */ + content = 0x0101010101010101ull; + wrmsr(MSR_MTRRfix16K_A0000, content); + /* 0xc0000-0xfffff: Write Back (WB) */ + content = 0x0606060606060606ull; + for ( i = 0; i < 8; i++ ) + wrmsr(MSR_MTRRfix4K_C0000 + i, content); + mtrr_def |= 1u << 10; /* FE */ + printf("fixed MTRRs ... "); + } + + /* Variable-range MTRRs supported? */ + nr_var_ranges = (uint8_t)mtrr_cap; + if ( nr_var_ranges != 0 ) + { + /* A single UC range covering PCI space. */ + wrmsr(MSR_MTRRphysBase(0), PCI_MEMBASE); + wrmsr(MSR_MTRRphysMask(0), + ((uint64_t)(int32_t)PCI_MEMBASE & addr_mask) | (1u << 11)); + printf("var MTRRs ... "); + } + + wrmsr(MSR_MTRRdefType, mtrr_def); +} diff -r 239b44eeb2d6 -r dc510776dd59 tools/firmware/hvmloader/config.h --- a/tools/firmware/hvmloader/config.h Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/firmware/hvmloader/config.h Thu Apr 24 14:08:29 2008 -0600 @@ -10,6 +10,9 @@ #define PCI_ISA_DEVFN 0x08 /* dev 1, fn 0 */ #define PCI_ISA_IRQ_MASK 0x0c20U /* ISA IRQs 5,10,11 are PCI connected */ + +#define PCI_MEMBASE 0xf0000000 +#define PCI_MEMSIZE 0x0c000000 #define ROMBIOS_SEG 0xF000 #define ROMBIOS_BEGIN 0x000F0000 diff -r 239b44eeb2d6 -r dc510776dd59 tools/firmware/hvmloader/hvmloader.c --- a/tools/firmware/hvmloader/hvmloader.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/firmware/hvmloader/hvmloader.c Thu Apr 24 14:08:29 2008 -0600 @@ -96,6 +96,7 @@ asm ( "stack: \n" " .skip 0x4000 \n" "stack_top: \n" + " .text \n" ); void smp_initialise(void); @@ -158,7 +159,7 @@ static void pci_setup(void) struct resource { uint32_t base, max; } *resource; - struct resource mem_resource = { 0xf0000000, 0xfc000000 }; + struct resource mem_resource = { PCI_MEMBASE, PCI_MEMBASE + PCI_MEMSIZE }; struct resource io_resource = { 0xc000, 0x10000 }; /* Create a list of device BARs in descending order of size. */ diff -r 239b44eeb2d6 -r dc510776dd59 tools/firmware/hvmloader/smp.c --- a/tools/firmware/hvmloader/smp.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/firmware/hvmloader/smp.c Thu Apr 24 14:08:29 2008 -0600 @@ -66,12 +66,15 @@ asm ( "stack: \n" " .skip 0x4000 \n" "stack_top: \n" + " .text \n" ); + +extern void cacheattr_init(void); /*static*/ void ap_start(void) { printf(" - CPU%d ... ", ap_cpuid); - + cacheattr_init(); printf("done.\n"); wmb(); ap_callin = 1; @@ -121,12 +124,10 @@ void smp_initialise(void) { unsigned int i, nr_cpus = get_vcpu_nr(); - if ( nr_cpus <= 1 ) - return; - memcpy((void *)AP_BOOT_EIP, ap_boot_start, ap_boot_end - ap_boot_start); printf("Multiprocessor initialisation:\n"); + ap_start(); for ( i = 1; i < nr_cpus; i++ ) boot_cpu(i); } diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/Makefile --- a/tools/ioemu/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -87,7 +87,7 @@ endif install: all $(if $(BUILD_DOCS),install-doc) mkdir -p "$(DESTDIR)$(bindir)" - $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(prefix)/sbin" + $(INSTALL) -m 755 $(TOOLS) "$(DESTDIR)$(SBINDIR)" # mkdir -p "$(DESTDIR)$(datadir)" # for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ # video.x openbios-sparc32 linux_boot.bin pxe-ne2k_pci.bin \ diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/hw/cirrus_vga.c --- a/tools/ioemu/hw/cirrus_vga.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/hw/cirrus_vga.c Thu Apr 24 14:08:29 2008 -0600 @@ -2595,6 +2595,10 @@ static void *set_vram_mapping(unsigned l memset(vram_pointer, 0, nr_extents * TARGET_PAGE_SIZE); +#ifdef CONFIG_STUBDOM + xenfb_pv_display_start(vram_pointer); +#endif + free(extent_start); return vram_pointer; diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/hw/pci.c --- a/tools/ioemu/hw/pci.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/hw/pci.c Thu Apr 24 14:08:29 2008 -0600 @@ -79,18 +79,30 @@ int pci_bus_num(PCIBus *s) void pci_device_save(PCIDevice *s, QEMUFile *f) { - qemu_put_be32(f, 1); /* PCI device version */ + uint8_t irq_state = 0; + int i; + qemu_put_be32(f, 2); /* PCI device version */ qemu_put_buffer(f, s->config, 256); + for (i = 0; i < 4; i++) + irq_state |= !!s->irq_state[i] << i; + qemu_put_buffer(f, &irq_state, 1); } int pci_device_load(PCIDevice *s, QEMUFile *f) { uint32_t version_id; version_id = qemu_get_be32(f); - if (version_id != 1) + if (version_id != 1 && version_id != 2) return -EINVAL; qemu_get_buffer(f, s->config, 256); pci_update_mappings(s); + if (version_id == 2) { + uint8_t irq_state; + int i; + qemu_get_buffer(f, &irq_state, 1); + for (i = 0; i < 4; i++) + pci_set_irq(s, i, !!(irq_state >> i)); + } return 0; } diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/hw/vga.c --- a/tools/ioemu/hw/vga.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/hw/vga.c Thu Apr 24 14:08:29 2008 -0600 @@ -2067,8 +2067,8 @@ void vga_common_init(VGAState *s, Displa & ~(TARGET_PAGE_SIZE - 1)); /* Video RAM must be 128-bit aligned for SSE optimizations later */ - s->vram_alloc = qemu_malloc(vga_ram_size + 15); - s->vram_ptr = (uint8_t *)((long)(s->vram_alloc + 15) & ~15L); + /* and page-aligned for PVFB memory sharing */ + s->vram_ptr = s->vram_alloc = qemu_memalign(TARGET_PAGE_SIZE, vga_ram_size); s->vram_offset = vga_ram_offset; s->vram_size = vga_ram_size; @@ -2210,7 +2210,7 @@ void *vga_update_vram(VGAState *s, void } if (!vga_ram_base) { - vga_ram_base = qemu_malloc(vga_ram_size + TARGET_PAGE_SIZE + 1); + vga_ram_base = qemu_memalign(TARGET_PAGE_SIZE, vga_ram_size + TARGET_PAGE_SIZE + 1); if (!vga_ram_base) { fprintf(stderr, "reallocate error\n"); return NULL; diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/hw/xen_blktap.c --- a/tools/ioemu/hw/xen_blktap.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/hw/xen_blktap.c Thu Apr 24 14:08:29 2008 -0600 @@ -581,17 +581,13 @@ static void handle_blktap_ctrlmsg(void* */ static int open_ctrl_socket(char *devname) { - int ret; int ipc_fd; if (mkdir(BLKTAP_CTRL_DIR, 0755) == 0) DPRINTF("Created %s directory\n", BLKTAP_CTRL_DIR); - ret = mkfifo(devname,S_IRWXU|S_IRWXG|S_IRWXO); - if ( (ret != 0) && (errno != EEXIST) ) { - DPRINTF("ERROR: pipe failed (%d)\n", errno); + if (access(devname, R_OK | W_OK)) return -1; - } ipc_fd = open(devname,O_RDWR|O_NONBLOCK); @@ -601,42 +597,6 @@ static int open_ctrl_socket(char *devnam } return ipc_fd; -} - -/** - * Unmaps all disks and closes their pipes - */ -void shutdown_blktap(void) -{ - fd_list_entry_t *ptr; - struct td_state *s; - char *devname; - - DPRINTF("Shutdown blktap\n"); - - /* Unmap all disks */ - ptr = fd_start; - while (ptr != NULL) { - s = ptr->s; - unmap_disk(s); - close(ptr->tap_fd); - ptr = ptr->next; - } - - /* Delete control pipes */ - if (asprintf(&devname, BLKTAP_CTRL_DIR "/qemu-read-%d", domid) >= 0) { - DPRINTF("Delete %s\n", devname); - if (unlink(devname)) - DPRINTF("Could not delete: %s\n", strerror(errno)); - free(devname); - } - - if (asprintf(&devname, BLKTAP_CTRL_DIR "/qemu-write-%d", domid) >= 0) { - DPRINTF("Delete %s\n", devname); - if (unlink(devname)) - DPRINTF("Could not delete: %s\n", strerror(errno)); - free(devname); - } } /** @@ -679,8 +639,5 @@ int init_blktap(void) /* Attach a handler to the read pipe (called from qemu main loop) */ qemu_set_fd_handler2(read_fd, NULL, &handle_blktap_ctrlmsg, NULL, NULL); - /* Register handler to clean up when the domain is destroyed */ - atexit(&shutdown_blktap); - return 0; } diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/hw/xenfb.c Thu Apr 24 14:08:29 2008 -0600 @@ -1235,14 +1235,10 @@ static struct semaphore kbd_sem = __SEMA static struct semaphore kbd_sem = __SEMAPHORE_INITIALIZER(kbd_sem, 0); static struct kbdfront_dev *kbd_dev; static char *kbd_path, *fb_path; +static void *vga_vram, *nonshared_vram; +static DisplayState *xenfb_ds; static unsigned char linux2scancode[KEY_MAX + 1]; - -#define WIDTH 1024 -#define HEIGHT 768 -#define DEPTH 32 -#define LINESIZE (1280 * (DEPTH / 8)) -#define MEMSIZE (LINESIZE * HEIGHT) int xenfb_connect_vkbd(const char *path) { @@ -1256,33 +1252,73 @@ int xenfb_connect_vfb(const char *path) return 0; } -static void xenfb_pv_update(DisplayState *s, int x, int y, int w, int h) -{ - struct fbfront_dev *fb_dev = s->opaque; +static void xenfb_pv_update(DisplayState *ds, int x, int y, int w, int h) +{ + struct fbfront_dev *fb_dev = ds->opaque; + if (!fb_dev) + return; fbfront_update(fb_dev, x, y, w, h); } -static void xenfb_pv_resize(DisplayState *s, int w, int h, int linesize) -{ - struct fbfront_dev *fb_dev = s->opaque; - fprintf(stderr,"resize to %dx%d required\n", w, h); - s->width = w; - s->height = h; - /* TODO: send resize event if supported */ - memset(s->data, 0, MEMSIZE); - fbfront_update(fb_dev, 0, 0, WIDTH, HEIGHT); +static void xenfb_pv_resize(DisplayState *ds, int w, int h, int linesize) +{ + struct fbfront_dev *fb_dev = ds->opaque; + fprintf(stderr,"resize to %dx%d, %d required\n", w, h, linesize); + ds->width = w; + ds->height = h; + if (!linesize) + ds->shared_buf = 0; + if (!ds->shared_buf) + linesize = w * 4; + ds->linesize = linesize; + if (!fb_dev) + return; + if (ds->shared_buf) { + ds->data = NULL; + } else { + ds->data = nonshared_vram; + fbfront_resize(fb_dev, w, h, linesize, ds->depth, VGA_RAM_SIZE); + } } static void xenfb_pv_colourdepth(DisplayState *ds, int depth) { - /* TODO: send redepth event if supported */ + struct fbfront_dev *fb_dev = ds->opaque; static int lastdepth = -1; + if (!depth) { + ds->shared_buf = 0; + ds->depth = 32; + } else { + ds->shared_buf = 1; + ds->depth = depth; + } if (depth != lastdepth) { fprintf(stderr,"redepth to %d required\n", depth); lastdepth = depth; + } else return; + if (!fb_dev) + return; + if (ds->shared_buf) { + ds->data = NULL; + } else { + ds->data = nonshared_vram; + fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, VGA_RAM_SIZE); } - /* We can't redepth for now */ - ds->depth = DEPTH; +} + +static void xenfb_pv_setdata(DisplayState *ds, void *pixels) +{ + struct fbfront_dev *fb_dev = ds->opaque; + int offset = pixels - vga_vram; + ds->data = pixels; + if (!fb_dev) + return; + fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, offset); +} + +static void xenfb_pv_refresh(DisplayState *ds) +{ + vga_hw_update(); } static void xenfb_kbd_handler(void *opaque) @@ -1373,13 +1409,6 @@ static void xenfb_kbd_handler(void *opaq } } -static void xenfb_pv_refresh(DisplayState *ds) -{ - /* always request negociation */ - ds->depth = -1; - vga_hw_update(); -} - static void kbdfront_thread(void *p) { int scancode, keycode; @@ -1399,40 +1428,72 @@ static void kbdfront_thread(void *p) int xenfb_pv_display_init(DisplayState *ds) { - void *data; + if (!fb_path || !kbd_path) + return -1; + + create_thread("kbdfront", kbdfront_thread, (void*) kbd_path); + + xenfb_ds = ds; + + ds->data = nonshared_vram = qemu_memalign(PAGE_SIZE, VGA_RAM_SIZE); + memset(ds->data, 0, VGA_RAM_SIZE); + ds->depth = 32; + ds->bgr = 0; + ds->width = 640; + ds->height = 400; + ds->linesize = 640 * 4; + ds->dpy_update = xenfb_pv_update; + ds->dpy_resize = xenfb_pv_resize; + ds->dpy_colourdepth = xenfb_pv_colourdepth; + ds->dpy_setdata = xenfb_pv_setdata; + ds->dpy_refresh = xenfb_pv_refresh; + return 0; +} + +int xenfb_pv_display_start(void *data) +{ + DisplayState *ds = xenfb_ds; struct fbfront_dev *fb_dev; int kbd_fd; + int offset = 0; + unsigned long *mfns; + int n = VGA_RAM_SIZE / PAGE_SIZE; + int i; if (!fb_path || !kbd_path) - return -1; - - create_thread("kbdfront", kbdfront_thread, (void*) kbd_path); - - data = qemu_memalign(PAGE_SIZE, VGA_RAM_SIZE); - fb_dev = init_fbfront(fb_path, data, WIDTH, HEIGHT, DEPTH, LINESIZE, MEMSIZE); + return 0; + + vga_vram = data; + mfns = malloc(2 * n * sizeof(*mfns)); + for (i = 0; i < n; i++) + mfns[i] = virtual_to_mfn(vga_vram + i * PAGE_SIZE); + for (i = 0; i < n; i++) + mfns[n + i] = virtual_to_mfn(nonshared_vram + i * PAGE_SIZE); + + fb_dev = init_fbfront(fb_path, mfns, ds->width, ds->height, ds->depth, ds->linesize, 2 * n); + free(mfns); if (!fb_dev) { fprintf(stderr,"can't open frame buffer\n"); exit(1); } free(fb_path); + if (ds->shared_buf) { + offset = (void*) ds->data - vga_vram; + } else { + offset = VGA_RAM_SIZE; + ds->data = nonshared_vram; + } + if (offset) + fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, offset); + down(&kbd_sem); free(kbd_path); kbd_fd = kbdfront_open(kbd_dev); qemu_set_fd_handler(kbd_fd, xenfb_kbd_handler, NULL, ds); - ds->data = data; - ds->linesize = LINESIZE; - ds->depth = DEPTH; - ds->bgr = 0; - ds->width = WIDTH; - ds->height = HEIGHT; - ds->dpy_update = xenfb_pv_update; - ds->dpy_resize = xenfb_pv_resize; - ds->dpy_colourdepth = xenfb_pv_colourdepth; - ds->dpy_refresh = xenfb_pv_refresh; - ds->opaque = fb_dev; + xenfb_ds->opaque = fb_dev; return 0; } #endif diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/tapdisk-ioemu.c --- a/tools/ioemu/tapdisk-ioemu.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/tapdisk-ioemu.c Thu Apr 24 14:08:29 2008 -0600 @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -15,6 +16,8 @@ extern void bdrv_init(void); extern void *qemu_mallocz(size_t size); extern void qemu_free(void *ptr); + +extern void *fd_start; int domid = 0; FILE* logfile; @@ -95,12 +98,17 @@ int main(void) int max_fd; fd_set rfds; struct timeval tv; + void *old_fd_start = NULL; logfile = stderr; bdrv_init(); qemu_aio_init(); init_blktap(); + + /* Daemonize */ + if (fork() != 0) + exit(0); /* * Main loop: Pass events to the corrsponding handlers and check for @@ -137,6 +145,12 @@ int main(void) } else pioh = &ioh->next; } + + /* Exit when the last image has been closed */ + if (old_fd_start != NULL && fd_start == NULL) + exit(0); + + old_fd_start = fd_start; } return 0; } diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/target-i386-dm/helper2.c --- a/tools/ioemu/target-i386-dm/helper2.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/target-i386-dm/helper2.c Thu Apr 24 14:08:29 2008 -0600 @@ -482,7 +482,7 @@ void cpu_handle_ioreq(void *opaque) CPUState *env = opaque; ioreq_t *req = cpu_get_ioreq(); - handle_buffered_io(env); + __handle_buffered_iopage(env); if (req) { __handle_ioreq(env, req); diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/vl.c --- a/tools/ioemu/vl.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/vl.c Thu Apr 24 14:08:29 2008 -0600 @@ -140,9 +140,9 @@ #define MAX_IOPORTS 65536 const char *bios_dir = CONFIG_QEMU_SHAREDIR; -void **ioport_opaque; -IOPortReadFunc *(*ioport_read_table)[MAX_IOPORTS]; -IOPortWriteFunc *(*ioport_write_table)[MAX_IOPORTS]; +void *ioport_opaque[MAX_IOPORTS]; +IOPortReadFunc *ioport_read_table[3][MAX_IOPORTS]; +IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS]; /* Note: bs_table[MAX_DISKS] is a dummy block driver if none available to store the VM snapshots */ BlockDriverState *bs_table[MAX_DISKS + MAX_SCSI_DISKS + 1], *fd_table[MAX_FD]; @@ -281,9 +281,6 @@ void default_ioport_writel(void *opaque, void init_ioports(void) { - ioport_opaque = calloc(MAX_IOPORTS, sizeof(*ioport_opaque)); - ioport_read_table = calloc(3 * MAX_IOPORTS, sizeof(**ioport_read_table)); - ioport_write_table = calloc(3 * MAX_IOPORTS, sizeof(**ioport_write_table)); } /* size is the word size in byte */ @@ -6276,12 +6273,6 @@ void qemu_system_powerdown_request(void) powerdown_requested = 1; if (cpu_single_env) cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT); -} - -static void qemu_sighup_handler(int signal) -{ - fprintf(stderr, "Received SIGHUP, terminating.\n"); - exit(0); } void main_loop_wait(int timeout) @@ -7979,7 +7970,7 @@ int main(int argc, char **argv) #ifndef CONFIG_STUBDOM /* Unblock SIGTERM and SIGHUP, which may have been blocked by the caller */ - signal(SIGHUP, qemu_sighup_handler); + signal(SIGHUP, SIG_DFL); sigemptyset(&set); sigaddset(&set, SIGTERM); sigaddset(&set, SIGHUP); diff -r 239b44eeb2d6 -r dc510776dd59 tools/ioemu/vl.h --- a/tools/ioemu/vl.h Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/ioemu/vl.h Thu Apr 24 14:08:29 2008 -0600 @@ -1545,6 +1545,7 @@ char *xenstore_vm_read(int domid, char * /* xenfb.c */ int xenfb_pv_display_init(DisplayState *ds); +int xenfb_pv_display_start(void *vram_start); int xenfb_connect_vkbd(const char *path); int xenfb_connect_vfb(const char *path); diff -r 239b44eeb2d6 -r dc510776dd59 tools/libfsimage/ext2fs/fsys_ext2fs.c --- a/tools/libfsimage/ext2fs/fsys_ext2fs.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/libfsimage/ext2fs/fsys_ext2fs.c Thu Apr 24 14:08:29 2008 -0600 @@ -77,7 +77,52 @@ struct ext2_super_block __u32 s_rev_level; /* Revision level */ __u16 s_def_resuid; /* Default uid for reserved blocks */ __u16 s_def_resgid; /* Default gid for reserved blocks */ - __u32 s_reserved[235]; /* Padding to the end of the block */ + /* + * These fields are for EXT2_DYNAMIC_REV superblocks only. + * + * Note: the difference between the compatible feature set and + * the incompatible feature set is that if there is a bit set + * in the incompatible feature set that the kernel doesn't + * know about, it should refuse to mount the filesystem. + * + * e2fsck's requirements are more strict; if it doesn't know + * about a feature in either the compatible or incompatible + * feature set, it must abort and not try to meddle with + * things it doesn't understand... + */ + __u32 s_first_ino; /* First non-reserved inode */ + __u16 s_inode_size; /* size of inode structure */ + __u16 s_block_group_nr; /* block group # of this superblock */ + __u32 s_feature_compat; /* compatible feature set */ + __u32 s_feature_incompat; /* incompatible feature set */ + __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __u8 s_uuid[16]; /* 128-bit uuid for volume */ + char s_volume_name[16]; /* volume name */ + char s_last_mounted[64]; /* directory where last mounted */ + __u32 s_algorithm_usage_bitmap; /* For compression */ + /* + * Performance hints. Directory preallocation should only + * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. + */ + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ + __u16 s_reserved_gdt_blocks;/* Per group table for online growth */ + /* + * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. + */ + __u8 s_journal_uuid[16]; /* uuid of journal superblock */ + __u32 s_journal_inum; /* inode number of journal file */ + __u32 s_journal_dev; /* device number of journal file */ + __u32 s_last_orphan; /* start of list of inodes to delete */ + __u32 s_hash_seed[4]; /* HTREE hash seed */ + __u8 s_def_hash_version; /* Default hash version to use */ + __u8 s_jnl_backup_type; /* Default type of journal backup */ + __u16 s_reserved_word_pad; + __u32 s_default_mount_opts; + __u32 s_first_meta_bg; /* First metablock group */ + __u32 s_mkfs_time; /* When the filesystem was created */ + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ + __u32 s_reserved[172]; /* Padding to the end of the block */ }; struct ext2_group_desc @@ -216,6 +261,9 @@ struct ext2_dir_entry #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) #define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s))) +#define EXT2_INODE_SIZE(s) (SUPERBLOCK->s_inode_size) +#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) + /* linux/ext2_fs.h */ #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) /* kind of from ext2/super.c */ @@ -537,7 +585,7 @@ ext2fs_dir (fsi_file_t *ffi, char *dirna gdp = GROUP_DESC; ino_blk = gdp[desc].bg_inode_table + (((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group)) - >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode))); + >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK))); #ifdef E2DEBUG printf ("inode table fsblock=%d\n", ino_blk); #endif /* E2DEBUG */ @@ -549,13 +597,12 @@ ext2fs_dir (fsi_file_t *ffi, char *dirna /* reset indirect blocks! */ mapblock2 = mapblock1 = -1; - raw_inode = INODE + - ((current_ino - 1) - & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1)); + raw_inode = (struct ext2_inode *)((char *)INODE + + ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) * + EXT2_INODE_SIZE (SUPERBLOCK)); #ifdef E2DEBUG printf ("ipb=%d, sizeof(inode)=%d\n", - (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)), - sizeof (struct ext2_inode)); + EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK)); printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode); printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE); for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode; diff -r 239b44eeb2d6 -r dc510776dd59 tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/libxc/xc_hvm_build.c Thu Apr 24 14:08:29 2008 -0600 @@ -298,7 +298,7 @@ static int setup_guest(int xc_handle, _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_PSE); munmap(ident_pt, PAGE_SIZE); xc_set_hvm_param(xc_handle, dom, HVM_PARAM_IDENT_PT, - special_page_nr + SPECIALPAGE_IDENT_PT); + (special_page_nr + SPECIALPAGE_IDENT_PT) << PAGE_SHIFT); /* Insert JMP instruction at address 0x0 to reach entry point. */ entry_eip = elf_uval(&elf, elf.ehdr, e_entry); diff -r 239b44eeb2d6 -r dc510776dd59 tools/python/xen/util/acmpolicy.py --- a/tools/python/xen/util/acmpolicy.py Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/python/xen/util/acmpolicy.py Thu Apr 24 14:08:29 2008 -0600 @@ -17,6 +17,7 @@ #============================================================================ import os +import sha import stat import array import struct @@ -35,7 +36,7 @@ ACM_POLICIES_DIR = security.policy_dir_p # Constants needed for generating a binary policy from its XML # representation -ACM_POLICY_VERSION = 3 # Latest one +ACM_POLICY_VERSION = 4 # Latest one ACM_CHWALL_VERSION = 1 ACM_STE_VERSION = 1 @@ -965,6 +966,10 @@ class ACMPolicy(XSPolicy): return dom.toxml() return None + def hash(self): + """ Calculate a SAH1 hash of the XML policy """ + return sha.sha(self.toxml()) + def save(self): ### Save the XML policy into a file ### rc = -xsconstants.XSERR_FILE_ERROR @@ -1403,7 +1408,7 @@ class ACMPolicy(XSPolicy): ste_bin += "\x00" #Write binary header: - headerformat="!iiiiiiiiii" + headerformat="!iiiiiiiiii20s" totallen_bin = struct.calcsize(headerformat) + \ len(pr_bin) + len(chw_bin) + len(ste_bin) polref_offset = struct.calcsize(headerformat) @@ -1425,7 +1430,8 @@ class ACMPolicy(XSPolicy): primpoloffset, secpolcode, secpoloffset, - major, minor) + major, minor, + self.hash().digest()) all_bin = array.array('B') for s in [ hdr_bin, pr_bin, chw_bin, ste_bin ]: @@ -1443,6 +1449,21 @@ class ACMPolicy(XSPolicy): rc = -xsconstants.XSERR_BAD_LABEL return rc, mapfile, all_bin.tostring() + def validate_enforced_policy_hash(self): + """ verify that the policy hash embedded in the binary policy + that is currently enforce matches the one of the XML policy. + """ + if self.hash().digest() != self.get_enforced_policy_hash(): + raise Exception('Policy hashes do not match') + + def get_enforced_policy_hash(self): + binpol = self.get_enforced_binary() + headerformat="!iiiiiiiiii20s" + res = struct.unpack(headerformat, binpol[:60]) + if len(res) >= 11: + return res[10] + return None + def get_enforced_binary(self): rc, binpol = security.hv_get_policy() if rc != 0: diff -r 239b44eeb2d6 -r dc510776dd59 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/python/xen/xend/XendDomain.py Thu Apr 24 14:08:29 2008 -0600 @@ -1622,7 +1622,31 @@ class XendDomain: vcpu) except Exception, ex: raise XendError(str(ex)) - + + def domain_reset(self, domid): + """Terminate domain immediately, and then create domain. + + @param domid: Domain ID or Name + @type domid: int or string. + @rtype: None + @raise XendError: Failed to destroy or create + @raise XendInvalidDomain: Domain is not valid + """ + + dominfo = self.domain_lookup_nr(domid) + if not dominfo: + raise XendInvalidDomain(str(domid)) + if dominfo and dominfo.getDomid() == DOM0_ID: + raise XendError("Cannot reset privileged domain %s" % domid) + if dominfo._stateGet() not in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): + raise VMBadState("Domain '%s' is not started" % domid, + POWER_STATE_NAMES[DOM_STATE_RUNNING], + POWER_STATE_NAMES[dominfo._stateGet()]) + try: + dominfo.resetDomain() + except Exception, ex: + raise XendError(str(ex)) + def instance(): """Singleton constructor. Use this instead of the class constructor. diff -r 239b44eeb2d6 -r dc510776dd59 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Apr 24 14:08:29 2008 -0600 @@ -1837,6 +1837,9 @@ class XendDomainInfo: @raise: VmError for invalid devices """ + if self.image: + self.image.prepareEnvironment() + ordered_refs = self.info.ordered_device_refs() for dev_uuid in ordered_refs: devclass, config = self.info['devices'][dev_uuid] @@ -2323,6 +2326,34 @@ class XendDomainInfo: self._cleanup_phantom_devs(paths) + def resetDomain(self): + log.debug("XendDomainInfo.resetDomain(%s)", str(self.domid)) + + old_domid = self.domid + prev_vm_xend = self._listRecursiveVm('xend') + new_dom_info = self.info + try: + self._unwatchVm() + self.destroy() + + new_dom = None + try: + from xen.xend import XendDomain + new_dom_info['domid'] = None + new_dom = XendDomain.instance().domain_create_from_dict( + new_dom_info) + for x in prev_vm_xend[0][1]: + new_dom._writeVm('xend/%s' % x[0], x[1]) + new_dom.waitForDevices() + new_dom.unpause() + except: + if new_dom: + new_dom.destroy() + raise + except: + log.exception('Failed to reset domain %s.', str(old_domid)) + + def resumeDomain(self): log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid)) diff -r 239b44eeb2d6 -r dc510776dd59 tools/python/xen/xend/XendXSPolicyAdmin.py --- a/tools/python/xen/xend/XendXSPolicyAdmin.py Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/python/xen/xend/XendXSPolicyAdmin.py Thu Apr 24 14:08:29 2008 -0600 @@ -54,6 +54,7 @@ class XSPolicyAdmin: try: self.xsobjs[ref] = ACMPolicy(name=act_pol_name, ref=ref) self.policies[ref] = (act_pol_name, xsconstants.ACM_POLICY_ID) + self.xsobjs[ref].validate_enforced_policy_hash() except Exception, e: log.error("Could not find XML representation of policy '%s': " "%s" % (act_pol_name,e)) diff -r 239b44eeb2d6 -r dc510776dd59 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/python/xen/xend/image.py Thu Apr 24 14:08:29 2008 -0600 @@ -184,6 +184,42 @@ class ImageHandler: def buildDomain(self): """Build the domain. Define in subclass.""" raise NotImplementedError() + + def prepareEnvironment(self): + """Prepare the environment for the execution of the domain. This + method is called before any devices are set up.""" + + domid = self.vm.getDomid() + + # Delete left-over pipes + try: + os.unlink('/var/run/tap/qemu-read-%d' % domid) + os.unlink('/var/run/tap/qemu-write-%d' % domid) + except: + pass + + # No device model, don't create pipes + if self.device_model is None: + return + + # If we use a device model, the pipes for communication between + # blktapctrl and ioemu must be present before the devices are + # created (blktapctrl must access them for new block devices) + + # mkdir throws an exception if the path already exists + try: + os.mkdir('/var/run/tap', 0755) + except: + pass + + try: + os.mkfifo('/var/run/tap/qemu-read-%d' % domid, 0600) + os.mkfifo('/var/run/tap/qemu-write-%d' % domid, 0600) + except OSError, e: + log.warn('Could not create blktap pipes for domain %d' % domid) + log.exception(e) + pass + # Return a list of cmd line args to the device models based on the # xm config file @@ -411,6 +447,12 @@ class ImageHandler: self.pid = None state = xstransact.Remove("/local/domain/0/device-model/%i" % self.vm.getDomid()) + + try: + os.unlink('/var/run/tap/qemu-read-%d' % self.vm.getDomid()) + os.unlink('/var/run/tap/qemu-write-%d' % self.vm.getDomid()) + except: + pass class LinuxImageHandler(ImageHandler): @@ -643,7 +685,9 @@ class IA64_HVM_ImageHandler(HVMImageHand # ROM size for guest firmware, io page, xenstore page # buffer io page, buffer pio page and memmap info page extra_pages = 1024 + 5 - return mem_kb + extra_pages * page_kb + mem_kb += extra_pages * page_kb + # Add 8 MiB overhead for QEMU's video RAM. + return mem_kb + 8192 def getRequiredInitialReservation(self): return self.vm.getMemoryTarget() diff -r 239b44eeb2d6 -r dc510776dd59 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/python/xen/xm/main.py Thu Apr 24 14:08:29 2008 -0600 @@ -107,6 +107,7 @@ SUBCOMMAND_HELP = { 'Migrate a domain to another machine.'), 'pause' : ('', 'Pause execution of a domain.'), 'reboot' : (' [-wa]', 'Reboot a domain.'), + 'reset' : ('', 'Reset a domain.'), 'restore' : (' [-p]', 'Restore a domain from a saved state.'), 'save' : ('[-c] ', @@ -274,6 +275,7 @@ common_commands = [ "migrate", "pause", "reboot", + "reset", "restore", "resume", "save", @@ -303,6 +305,7 @@ domain_commands = [ "pause", "reboot", "rename", + "reset", "restore", "resume", "save", @@ -1247,6 +1250,13 @@ def xm_shutdown(args): arg_check(args, "shutdown", 1, 4) from xen.xm import shutdown shutdown.main(["shutdown"] + args) + +def xm_reset(args): + arg_check(args, "reset", 1) + dom = args[0] + + # TODO: XenAPI + server.xend.domain.reset(dom) def xm_pause(args): arg_check(args, "pause", 1) @@ -2474,6 +2484,7 @@ commands = { "dump-core": xm_dump_core, "reboot": xm_reboot, "rename": xm_rename, + "reset": xm_reset, "restore": xm_restore, "resume": xm_resume, "save": xm_save, diff -r 239b44eeb2d6 -r dc510776dd59 tools/tests/test_x86_emulator.c --- a/tools/tests/test_x86_emulator.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/tests/test_x86_emulator.c Thu Apr 24 14:08:29 2008 -0600 @@ -26,14 +26,8 @@ static int read( unsigned int bytes, struct x86_emulate_ctxt *ctxt) { - unsigned long addr = offset; - switch ( bytes ) - { - case 1: *val = *(uint8_t *)addr; break; - case 2: *val = *(uint16_t *)addr; break; - case 4: *val = *(uint32_t *)addr; break; - case 8: *val = *(unsigned long *)addr; break; - } + *val = 0; + memcpy(val, (void *)offset, bytes); return X86EMUL_OKAY; } @@ -44,48 +38,19 @@ static int write( unsigned int bytes, struct x86_emulate_ctxt *ctxt) { - unsigned long addr = offset; - switch ( bytes ) - { - case 1: *(uint8_t *)addr = (uint8_t)val; break; - case 2: *(uint16_t *)addr = (uint16_t)val; break; - case 4: *(uint32_t *)addr = (uint32_t)val; break; - case 8: *(unsigned long *)addr = val; break; - } + memcpy((void *)offset, &val, bytes); return X86EMUL_OKAY; } static int cmpxchg( unsigned int seg, unsigned long offset, - unsigned long old, - unsigned long new, + void *old, + void *new, unsigned int bytes, struct x86_emulate_ctxt *ctxt) { - unsigned long addr = offset; - switch ( bytes ) - { - case 1: *(uint8_t *)addr = (uint8_t)new; break; - case 2: *(uint16_t *)addr = (uint16_t)new; break; - case 4: *(uint32_t *)addr = (uint32_t)new; break; - case 8: *(unsigned long *)addr = new; break; - } - return X86EMUL_OKAY; -} - -static int cmpxchg8b( - unsigned int seg, - unsigned long offset, - unsigned long old_lo, - unsigned long old_hi, - unsigned long new_lo, - unsigned long new_hi, - struct x86_emulate_ctxt *ctxt) -{ - unsigned long addr = offset; - ((unsigned long *)addr)[0] = new_lo; - ((unsigned long *)addr)[1] = new_hi; + memcpy((void *)offset, new, bytes); return X86EMUL_OKAY; } @@ -94,7 +59,6 @@ static struct x86_emulate_ops emulops = .insn_fetch = read, .write = write, .cmpxchg = cmpxchg, - .cmpxchg8b = cmpxchg8b }; int main(int argc, char **argv) diff -r 239b44eeb2d6 -r dc510776dd59 tools/tests/x86_emulate.c --- a/tools/tests/x86_emulate.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/tests/x86_emulate.c Thu Apr 24 14:08:29 2008 -0600 @@ -4,10 +4,4 @@ #include #include "x86_emulate/x86_emulate.h" - -#define __emulate_fpu_insn(_op) \ -do{ rc = X86EMUL_UNHANDLEABLE; \ - goto done; \ -} while (0) - #include "x86_emulate/x86_emulate.c" diff -r 239b44eeb2d6 -r dc510776dd59 tools/xenmon/xenbaked.c --- a/tools/xenmon/xenbaked.c Thu Apr 24 14:02:16 2008 -0600 +++ b/tools/xenmon/xenbaked.c Thu Apr 24 14:08:29 2008 -0600 @@ -509,14 +509,36 @@ int monitor_tbufs(void) { for ( i = 0; (i < num) && !interrupted; i++ ) { - while ( meta[i]->cons != meta[i]->prod ) + unsigned long start_offset, end_offset, cons, prod; + + cons = meta[i]->cons; + prod = meta[i]->prod; + xen_rmb(); /* read prod, then read item. */ + + if ( cons == prod ) + continue; + + start_offset = cons % data_size; + end_offset = prod % data_size; + + if ( start_offset >= end_offset ) { - xen_rmb(); /* read prod, then read item. */ + while ( start_offset != data_size ) + { + rec_size = process_record( + i, (struct t_rec *)(data[i] + start_offset)); + start_offset += rec_size; + } + start_offset = 0; + } + while ( start_offset != end_offset ) + { rec_size = process_record( - i, (struct t_rec *)(data[i] + meta[i]->cons % data_size)); - xen_mb(); /* read item, then update cons. */ - meta[i]->cons += rec_size; + i, (struct t_rec *)(data[i] + start_offset)); + start_offset += rec_size; } + xen_mb(); /* read item, then update cons. */ + meta[i]->cons = prod; } wait_for_event(); diff -r 239b44eeb2d6 -r dc510776dd59 xen/Makefile --- a/xen/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -44,6 +44,7 @@ _clean: delete-unfresh-files $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean rm -f include/asm *.o $(TARGET)* *~ core rm -f include/asm-*/asm-offsets.h + [ -d tools/figlet ] && rm -f .banner* .PHONY: _distclean _distclean: clean @@ -70,8 +71,14 @@ delete-unfresh-files: rm -f include/xen/compile.h; \ fi +.banner: Makefile + $(MAKE) -C tools + @tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION) 2>$@2 >$@1 + @cat $@1 $@2 >$@ + @rm -f $@1 $@2 + # compile.h contains dynamic build info. Rebuilt on every 'make' invocation. -include/xen/compile.h: include/xen/compile.h.in +include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \ -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \ -e 's/@@whoami@@/$(USER)/g' \ @@ -83,7 +90,8 @@ include/xen/compile.h: include/xen/compi -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \ -e 's!@@changeset@@!$(shell ((hg parents --template "{date|date} {rev}:{node|short}" >/dev/null && hg parents --template "{date|date} {rev}:{node|short}") || echo "unavailable") 2>/dev/null)!g' \ < include/xen/compile.h.in > $@.new - tools/figlet/figlet -d tools/figlet Xen $(XEN_FULLVERSION) >> $@.new + @grep \" .banner >> $@.new + @grep -v \" .banner @mv -f $@.new $@ include/asm-$(TARGET_ARCH)/asm-offsets.h: arch/$(TARGET_ARCH)/asm-offsets.s diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/Makefile --- a/xen/arch/x86/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -52,6 +52,8 @@ obj-y += tboot.o obj-$(crash_debug) += gdbstub.o +x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h + $(TARGET): $(TARGET)-syms boot/mkelf32 ./boot/mkelf32 $(TARGET)-syms $(TARGET) 0x100000 \ `$(NM) -nr $(TARGET)-syms | head -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'` diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/bitops.c --- a/xen/arch/x86/bitops.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/bitops.c Thu Apr 24 14:08:29 2008 -0600 @@ -8,17 +8,18 @@ unsigned int __find_first_bit( unsigned long d0, d1, res; asm volatile ( - " xor %%eax,%%eax\n\t" /* also ensures ZF==1 if size==0 */ + "1: xor %%eax,%%eax\n\t" /* also ensures ZF==1 if size==0 */ " repe; scas"__OS"\n\t" - " je 1f\n\t" + " je 2f\n\t" + " bsf -"STR(BITS_PER_LONG/8)"(%2),%0\n\t" + " jz 1b\n\t" " lea -"STR(BITS_PER_LONG/8)"(%2),%2\n\t" - " bsf (%2),%0\n" - "1: sub %%ebx,%%edi\n\t" + "2: sub %%ebx,%%edi\n\t" " shl $3,%%edi\n\t" " add %%edi,%%eax" : "=&a" (res), "=&c" (d0), "=&D" (d1) - : "1" ((size + BITS_PER_LONG - 1) / BITS_PER_LONG), - "2" (addr), "b" ((int)(long)addr) : "memory" ); + : "1" (BITS_TO_LONGS(size)), "2" (addr), "b" ((int)(long)addr) + : "memory" ); return res; } @@ -34,8 +35,7 @@ unsigned int __find_next_bit( if ( bit != 0 ) { /* Look for a bit in the first word. */ - asm ( "bsf %1,%%"__OP"ax" - : "=a" (set) : "r" (*p >> bit), "0" (BITS_PER_LONG) ); + set = __scanbit(*p >> bit, BITS_PER_LONG - bit); if ( set < (BITS_PER_LONG - bit) ) return (offset + set); offset += BITS_PER_LONG - bit; @@ -56,18 +56,20 @@ unsigned int __find_first_zero_bit( unsigned long d0, d1, d2, res; asm volatile ( + "1: xor %%eax,%%eax ; not %3\n\t" /* rAX == ~0ul */ " xor %%edx,%%edx\n\t" /* also ensures ZF==1 if size==0 */ " repe; scas"__OS"\n\t" - " je 1f\n\t" + " je 2f\n\t" + " xor -"STR(BITS_PER_LONG/8)"(%2),%3\n\t" + " jz 1b\n\t" + " bsf %3,%0\n\t" " lea -"STR(BITS_PER_LONG/8)"(%2),%2\n\t" - " xor (%2),%3\n\t" - " bsf %3,%0\n" - "1: sub %%ebx,%%edi\n\t" + "2: sub %%ebx,%%edi\n\t" " shl $3,%%edi\n\t" " add %%edi,%%edx" : "=&d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2) - : "1" ((size + BITS_PER_LONG - 1) / BITS_PER_LONG), - "2" (addr), "b" ((int)(long)addr), "3" (-1L) : "memory" ); + : "1" (BITS_TO_LONGS(size)), "2" (addr), "b" ((int)(long)addr) + : "memory" ); return res; } @@ -83,7 +85,7 @@ unsigned int __find_next_zero_bit( if ( bit != 0 ) { /* Look for zero in the first word. */ - asm ( "bsf %1,%%"__OP"ax" : "=a" (set) : "r" (~(*p >> bit)) ); + set = __scanbit(~(*p >> bit), BITS_PER_LONG - bit); if ( set < (BITS_PER_LONG - bit) ) return (offset + set); offset += BITS_PER_LONG - bit; diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/cpu/mtrr/main.c --- a/xen/arch/x86/cpu/mtrr/main.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/cpu/mtrr/main.c Thu Apr 24 14:08:29 2008 -0600 @@ -586,8 +586,6 @@ struct mtrr_value { unsigned long lsize; }; -extern void global_init_mtrr_pat(void); - /** * mtrr_bp_init - initialize mtrrs on the boot CPU * @@ -654,11 +652,8 @@ void __init mtrr_bp_init(void) if (mtrr_if) { set_num_var_ranges(); init_table(); - if (use_intel()) { + if (use_intel()) get_mtrr_state(); - /* initialize some global data for MTRR/PAT virutalization */ - global_init_mtrr_pat(); - } } } diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/domain.c Thu Apr 24 14:08:29 2008 -0600 @@ -521,10 +521,10 @@ int arch_domain_create(struct domain *d, clear_page(d->shared_info); share_xen_page_with_guest( virt_to_page(d->shared_info), d, XENSHARE_writable); - } - - if ( (rc = iommu_domain_init(d)) != 0 ) - goto fail; + + if ( (rc = iommu_domain_init(d)) != 0 ) + goto fail; + } if ( is_hvm_domain(d) ) { @@ -562,7 +562,8 @@ void arch_domain_destroy(struct domain * if ( is_hvm_domain(d) ) hvm_domain_destroy(d); - iommu_domain_destroy(d); + if ( !is_idle_domain(d) ) + iommu_domain_destroy(d); paging_final_teardown(d); diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/domain_build.c Thu Apr 24 14:08:29 2008 -0600 @@ -957,8 +957,8 @@ int __init construct_dom0( rc |= ioports_deny_access(dom0, 0x40, 0x43); /* PIT Channel 2 / PC Speaker Control. */ rc |= ioports_deny_access(dom0, 0x61, 0x61); - /* PCI configuration spaces. */ - rc |= ioports_deny_access(dom0, 0xcf8, 0xcff); + /* PCI configuration space (NB. 0xcf8 has special treatment). */ + rc |= ioports_deny_access(dom0, 0xcfc, 0xcff); /* Command-line I/O ranges. */ process_dom0_ioports_disable(); diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/emulate.c --- a/xen/arch/x86/hvm/emulate.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/emulate.c Thu Apr 24 14:08:29 2008 -0600 @@ -28,6 +28,33 @@ static int hvmemul_do_io( ioreq_t *p = &vio->vp_ioreq; int rc; + /* Only retrieve the value from singleton (non-REP) reads. */ + ASSERT((val == NULL) || ((dir == IOREQ_READ) && !value_is_ptr)); + + if ( is_mmio && !value_is_ptr ) + { + /* Part of a multi-cycle read or write? */ + if ( dir == IOREQ_WRITE ) + { + paddr_t pa = curr->arch.hvm_vcpu.mmio_large_write_pa; + unsigned int bytes = curr->arch.hvm_vcpu.mmio_large_write_bytes; + if ( (addr >= pa) && ((addr + size) <= (pa + bytes)) ) + return X86EMUL_OKAY; + } + else + { + paddr_t pa = curr->arch.hvm_vcpu.mmio_large_read_pa; + unsigned int bytes = curr->arch.hvm_vcpu.mmio_large_read_bytes; + if ( (addr >= pa) && ((addr + size) <= (pa + bytes)) ) + { + *val = 0; + memcpy(val, &curr->arch.hvm_vcpu.mmio_large_read[addr - pa], + size); + return X86EMUL_OKAY; + } + } + } + switch ( curr->arch.hvm_vcpu.io_state ) { case HVMIO_none: @@ -36,8 +63,13 @@ static int hvmemul_do_io( curr->arch.hvm_vcpu.io_state = HVMIO_none; if ( val == NULL ) return X86EMUL_UNHANDLEABLE; - *val = curr->arch.hvm_vcpu.io_data; - return X86EMUL_OKAY; + goto finish_access; + case HVMIO_dispatched: + /* May have to wait for previous cycle of a multi-write to complete. */ + if ( is_mmio && !value_is_ptr && (dir == IOREQ_WRITE) && + (addr == (curr->arch.hvm_vcpu.mmio_large_write_pa + + curr->arch.hvm_vcpu.mmio_large_write_bytes)) ) + return X86EMUL_RETRY; default: return X86EMUL_UNHANDLEABLE; } @@ -80,8 +112,6 @@ static int hvmemul_do_io( *reps = p->count; p->state = STATE_IORESP_READY; hvm_io_assist(); - if ( val != NULL ) - *val = curr->arch.hvm_vcpu.io_data; curr->arch.hvm_vcpu.io_state = HVMIO_none; break; case X86EMUL_UNHANDLEABLE: @@ -92,7 +122,43 @@ static int hvmemul_do_io( BUG(); } - return rc; + if ( rc != X86EMUL_OKAY ) + return rc; + + finish_access: + if ( val != NULL ) + *val = curr->arch.hvm_vcpu.io_data; + + if ( is_mmio && !value_is_ptr ) + { + /* Part of a multi-cycle read or write? */ + if ( dir == IOREQ_WRITE ) + { + paddr_t pa = curr->arch.hvm_vcpu.mmio_large_write_pa; + unsigned int bytes = curr->arch.hvm_vcpu.mmio_large_write_bytes; + if ( bytes == 0 ) + pa = curr->arch.hvm_vcpu.mmio_large_write_pa = addr; + if ( addr == (pa + bytes) ) + curr->arch.hvm_vcpu.mmio_large_write_bytes += size; + } + else + { + paddr_t pa = curr->arch.hvm_vcpu.mmio_large_read_pa; + unsigned int bytes = curr->arch.hvm_vcpu.mmio_large_read_bytes; + if ( bytes == 0 ) + pa = curr->arch.hvm_vcpu.mmio_large_read_pa = addr; + if ( (addr == (pa + bytes)) && + ((bytes + size) < + sizeof(curr->arch.hvm_vcpu.mmio_large_read)) ) + { + memcpy(&curr->arch.hvm_vcpu.mmio_large_read[addr - pa], + val, size); + curr->arch.hvm_vcpu.mmio_large_read_bytes += size; + } + } + } + + return X86EMUL_OKAY; } static int hvmemul_do_pio( @@ -371,11 +437,15 @@ static int hvmemul_cmpxchg( static int hvmemul_cmpxchg( enum x86_segment seg, unsigned long offset, - unsigned long old, - unsigned long new, + void *p_old, + void *p_new, unsigned int bytes, struct x86_emulate_ctxt *ctxt) { + unsigned long new = 0; + if ( bytes > sizeof(new) ) + return X86EMUL_UNHANDLEABLE; + memcpy(&new, p_new, bytes); /* Fix this in case the guest is really relying on r-m-w atomicity. */ return hvmemul_write(seg, offset, new, bytes, ctxt); } @@ -603,7 +673,7 @@ static int hvmemul_read_msr( _regs.ecx = (uint32_t)reg; - if ( (rc = hvm_funcs.msr_read_intercept(&_regs)) != 0 ) + if ( (rc = hvm_msr_read_intercept(&_regs)) != 0 ) return rc; *val = ((uint64_t)(uint32_t)_regs.edx << 32) || (uint32_t)_regs.eax; @@ -621,7 +691,7 @@ static int hvmemul_write_msr( _regs.eax = (uint32_t)val; _regs.ecx = (uint32_t)reg; - return hvm_funcs.msr_write_intercept(&_regs); + return hvm_msr_write_intercept(&_regs); } static int hvmemul_wbinvd( @@ -674,11 +744,40 @@ static int hvmemul_inject_sw_interrupt( return X86EMUL_OKAY; } -static void hvmemul_load_fpu_ctxt( - struct x86_emulate_ctxt *ctxt) -{ - if ( !current->fpu_dirtied ) +static int hvmemul_get_fpu( + void (*exception_callback)(void *, struct cpu_user_regs *), + void *exception_callback_arg, + enum x86_emulate_fpu_type type, + struct x86_emulate_ctxt *ctxt) +{ + struct vcpu *curr = current; + + switch ( type ) + { + case X86EMUL_FPU_fpu: + break; + case X86EMUL_FPU_mmx: + if ( !cpu_has_mmx ) + return X86EMUL_UNHANDLEABLE; + break; + default: + return X86EMUL_UNHANDLEABLE; + } + + if ( !curr->fpu_dirtied ) hvm_funcs.fpu_dirty_intercept(); + + curr->arch.hvm_vcpu.fpu_exception_callback = exception_callback; + curr->arch.hvm_vcpu.fpu_exception_callback_arg = exception_callback_arg; + + return X86EMUL_OKAY; +} + +static void hvmemul_put_fpu( + struct x86_emulate_ctxt *ctxt) +{ + struct vcpu *curr = current; + curr->arch.hvm_vcpu.fpu_exception_callback = NULL; } static int hvmemul_invlpg( @@ -720,7 +819,8 @@ static struct x86_emulate_ops hvm_emulat .cpuid = hvmemul_cpuid, .inject_hw_exception = hvmemul_inject_hw_exception, .inject_sw_interrupt = hvmemul_inject_sw_interrupt, - .load_fpu_ctxt = hvmemul_load_fpu_ctxt, + .get_fpu = hvmemul_get_fpu, + .put_fpu = hvmemul_put_fpu, .invlpg = hvmemul_invlpg }; @@ -763,6 +863,11 @@ int hvm_emulate_one( hvmemul_ctxt->exn_pending = 0; rc = x86_emulate(&hvmemul_ctxt->ctxt, &hvm_emulate_ops); + + if ( rc != X86EMUL_RETRY ) + curr->arch.hvm_vcpu.mmio_large_read_bytes = + curr->arch.hvm_vcpu.mmio_large_write_bytes = 0; + if ( rc != X86EMUL_OKAY ) return rc; diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/hvm.c Thu Apr 24 14:08:29 2008 -0600 @@ -494,14 +494,14 @@ static int hvm_load_cpu_ctxt(struct doma ((ctxt.cr0 & (X86_CR0_PE|X86_CR0_PG)) == X86_CR0_PG) ) { gdprintk(XENLOG_ERR, "HVM restore: bad CR0 0x%"PRIx64"\n", - ctxt.msr_efer); + ctxt.cr0); return -EINVAL; } if ( ctxt.cr4 & HVM_CR4_GUEST_RESERVED_BITS ) { gdprintk(XENLOG_ERR, "HVM restore: bad CR4 0x%"PRIx64"\n", - ctxt.msr_efer); + ctxt.cr4); return -EINVAL; } @@ -620,8 +620,6 @@ HVM_REGISTER_SAVE_RESTORE(CPU, hvm_save_ HVM_REGISTER_SAVE_RESTORE(CPU, hvm_save_cpu_ctxt, hvm_load_cpu_ctxt, 1, HVMSR_PER_VCPU); -extern int reset_vmsr(struct mtrr_state *m, u64 *p); - int hvm_vcpu_initialise(struct vcpu *v) { int rc; @@ -647,7 +645,7 @@ int hvm_vcpu_initialise(struct vcpu *v) spin_lock_init(&v->arch.hvm_vcpu.tm_lock); INIT_LIST_HEAD(&v->arch.hvm_vcpu.tm_list); - rc = reset_vmsr(&v->arch.hvm_vcpu.mtrr, &v->arch.hvm_vcpu.pat_cr); + rc = hvm_vcpu_cacheattr_init(v); if ( rc != 0 ) goto fail3; @@ -681,6 +679,7 @@ int hvm_vcpu_initialise(struct vcpu *v) void hvm_vcpu_destroy(struct vcpu *v) { + hvm_vcpu_cacheattr_destroy(v); vlapic_destroy(v); hvm_funcs.vcpu_destroy(v); @@ -1604,6 +1603,9 @@ void hvm_cpuid(unsigned int input, unsig *ebx &= 0x0000FFFFu; *ebx |= (current->vcpu_id * 2) << 24; + /* We always support MTRR MSRs. */ + *edx |= bitmaskof(X86_FEATURE_MTRR); + *ecx &= (bitmaskof(X86_FEATURE_XMM3) | bitmaskof(X86_FEATURE_SSSE3) | bitmaskof(X86_FEATURE_CX16) | @@ -1653,6 +1655,146 @@ void hvm_cpuid(unsigned int input, unsig #endif break; } +} + +int hvm_msr_read_intercept(struct cpu_user_regs *regs) +{ + uint32_t ecx = regs->ecx; + uint64_t msr_content = 0; + struct vcpu *v = current; + uint64_t *var_range_base, *fixed_range_base; + int index; + + var_range_base = (uint64_t *)v->arch.hvm_vcpu.mtrr.var_ranges; + fixed_range_base = (uint64_t *)v->arch.hvm_vcpu.mtrr.fixed_ranges; + + switch ( ecx ) + { + case MSR_IA32_TSC: + msr_content = hvm_get_guest_time(v); + break; + + case MSR_IA32_APICBASE: + msr_content = vcpu_vlapic(v)->hw.apic_base_msr; + break; + + case MSR_IA32_MCG_CAP: + case MSR_IA32_MCG_STATUS: + case MSR_IA32_MC0_STATUS: + case MSR_IA32_MC1_STATUS: + case MSR_IA32_MC2_STATUS: + case MSR_IA32_MC3_STATUS: + case MSR_IA32_MC4_STATUS: + case MSR_IA32_MC5_STATUS: + /* No point in letting the guest see real MCEs */ + msr_content = 0; + break; + + case MSR_IA32_CR_PAT: + msr_content = v->arch.hvm_vcpu.pat_cr; + break; + + case MSR_MTRRcap: + msr_content = v->arch.hvm_vcpu.mtrr.mtrr_cap; + break; + case MSR_MTRRdefType: + msr_content = v->arch.hvm_vcpu.mtrr.def_type + | (v->arch.hvm_vcpu.mtrr.enabled << 10); + break; + case MSR_MTRRfix64K_00000: + msr_content = fixed_range_base[0]; + break; + case MSR_MTRRfix16K_80000: + case MSR_MTRRfix16K_A0000: + index = regs->ecx - MSR_MTRRfix16K_80000; + msr_content = fixed_range_base[index + 1]; + break; + case MSR_MTRRfix4K_C0000...MSR_MTRRfix4K_F8000: + index = regs->ecx - MSR_MTRRfix4K_C0000; + msr_content = fixed_range_base[index + 3]; + break; + case MSR_IA32_MTRR_PHYSBASE0...MSR_IA32_MTRR_PHYSMASK7: + index = regs->ecx - MSR_IA32_MTRR_PHYSBASE0; + msr_content = var_range_base[index]; + break; + + default: + return hvm_funcs.msr_read_intercept(regs); + } + + regs->eax = (uint32_t)msr_content; + regs->edx = (uint32_t)(msr_content >> 32); + return X86EMUL_OKAY; +} + +int hvm_msr_write_intercept(struct cpu_user_regs *regs) +{ + extern bool_t mtrr_var_range_msr_set( + struct mtrr_state *v, u32 msr, u64 msr_content); + extern bool_t mtrr_fix_range_msr_set( + struct mtrr_state *v, int row, u64 msr_content); + extern bool_t mtrr_def_type_msr_set(struct mtrr_state *v, u64 msr_content); + extern bool_t pat_msr_set(u64 *pat, u64 msr); + + uint32_t ecx = regs->ecx; + uint64_t msr_content = (uint32_t)regs->eax | ((uint64_t)regs->edx << 32); + struct vcpu *v = current; + int index; + + switch ( ecx ) + { + case MSR_IA32_TSC: + hvm_set_guest_time(v, msr_content); + pt_reset(v); + break; + + case MSR_IA32_APICBASE: + vlapic_msr_set(vcpu_vlapic(v), msr_content); + break; + + case MSR_IA32_CR_PAT: + if ( !pat_msr_set(&v->arch.hvm_vcpu.pat_cr, msr_content) ) + goto gp_fault; + break; + + case MSR_MTRRcap: + goto gp_fault; + case MSR_MTRRdefType: + if ( !mtrr_def_type_msr_set(&v->arch.hvm_vcpu.mtrr, msr_content) ) + goto gp_fault; + break; + case MSR_MTRRfix64K_00000: + if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, 0, msr_content) ) + goto gp_fault; + break; + case MSR_MTRRfix16K_80000: + case MSR_MTRRfix16K_A0000: + index = regs->ecx - MSR_MTRRfix16K_80000 + 1; + if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, + index, msr_content) ) + goto gp_fault; + break; + case MSR_MTRRfix4K_C0000...MSR_MTRRfix4K_F8000: + index = regs->ecx - MSR_MTRRfix4K_C0000 + 3; + if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, + index, msr_content) ) + goto gp_fault; + break; + case MSR_IA32_MTRR_PHYSBASE0...MSR_IA32_MTRR_PHYSMASK7: + if ( !mtrr_var_range_msr_set(&v->arch.hvm_vcpu.mtrr, + regs->ecx, msr_content) ) + goto gp_fault; + break; + + default: + return hvm_funcs.msr_write_intercept(regs); + } + + return X86EMUL_OKAY; + +gp_fault: + hvm_inject_exception(TRAP_gp_fault, 0, 0); + return X86EMUL_EXCEPTION; } enum hvm_intblk hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack) diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/mtrr.c --- a/xen/arch/x86/hvm/mtrr.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/mtrr.c Thu Apr 24 14:08:29 2008 -0600 @@ -27,7 +27,6 @@ #include #include -/* Xen holds the native MTRR MSRs */ extern struct mtrr_state mtrr_state; static uint64_t phys_base_msr_mask; @@ -35,19 +34,17 @@ static uint32_t size_or_mask; static uint32_t size_or_mask; static uint32_t size_and_mask; -static void init_pat_entry_tbl(uint64_t pat); -static void init_mtrr_epat_tbl(void); -static uint8_t get_mtrr_type(struct mtrr_state *m, paddr_t pa); -/* get page attribute fields (PAn) from PAT MSR */ +/* Get page attribute fields (PAn) from PAT MSR. */ #define pat_cr_2_paf(pat_cr,n) ((((uint64_t)pat_cr) >> ((n)<<3)) & 0xff) -/* pat entry to PTE flags (PAT, PCD, PWT bits) */ + +/* PAT entry to PTE flags (PAT, PCD, PWT bits). */ static uint8_t pat_entry_2_pte_flags[8] = { 0, _PAGE_PWT, _PAGE_PCD, _PAGE_PCD | _PAGE_PWT, _PAGE_PAT, _PAGE_PAT | _PAGE_PWT, _PAGE_PAT | _PAGE_PCD, _PAGE_PAT | _PAGE_PCD | _PAGE_PWT }; -/* effective mm type lookup table, according to MTRR and PAT */ +/* Effective mm type lookup table, according to MTRR and PAT. */ static uint8_t mm_type_tbl[MTRR_NUM_TYPES][PAT_TYPE_NUMS] = { /********PAT(UC,WC,RS,RS,WT,WP,WB,UC-)*/ /* RS means reserved type(2,3), and type is hardcoded here */ @@ -67,12 +64,13 @@ static uint8_t mm_type_tbl[MTRR_NUM_TYPE {0, 1, 2, 2, 4, 5, 6, 0} }; -/* reverse lookup table, to find a pat type according to MTRR and effective - * memory type. This table is dynamically generated +/* + * Reverse lookup table, to find a pat type according to MTRR and effective + * memory type. This table is dynamically generated. */ static uint8_t mtrr_epat_tbl[MTRR_NUM_TYPES][MEMORY_NUM_TYPES]; -/* lookup table for PAT entry of a given PAT value in host pat */ +/* Lookup table for PAT entry of a given PAT value in host PAT. */ static uint8_t pat_entry_tbl[PAT_TYPE_NUMS]; static void get_mtrr_range(uint64_t base_msr, uint64_t mask_msr, @@ -139,220 +137,63 @@ bool_t is_var_mtrr_overlapped(struct mtr return 0; } -/* reserved mtrr for guest OS */ -#define RESERVED_MTRR 2 +#define MTRR_PHYSMASK_VALID_BIT 11 +#define MTRR_PHYSMASK_SHIFT 12 + +#define MTRR_PHYSBASE_TYPE_MASK 0xff /* lowest 8 bits */ +#define MTRR_PHYSBASE_SHIFT 12 +#define MTRR_VCNT 8 + #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg)) #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1) bool_t mtrr_var_range_msr_set(struct mtrr_state *m, uint32_t msr, uint64_t msr_content); -bool_t mtrr_def_type_msr_set(struct mtrr_state *m, uint64_t msr_content); bool_t mtrr_fix_range_msr_set(struct mtrr_state *m, uint32_t row, uint64_t msr_content); -static void set_var_mtrr(uint32_t reg, struct mtrr_state *m, - uint32_t base, uint32_t size, - uint32_t type) -{ - struct mtrr_var_range *vr; - - vr = &m->var_ranges[reg]; - - if ( size == 0 ) - { - /* The invalid bit is kept in the mask, so we simply clear the - * relevant mask register to disable a range. - */ - mtrr_var_range_msr_set(m, MTRRphysMask_MSR(reg), 0); - } - else - { - vr->base_lo = base << PAGE_SHIFT | type; - vr->base_hi = (base & size_and_mask) >> (32 - PAGE_SHIFT); - vr->mask_lo = -size << PAGE_SHIFT | 0x800; - vr->mask_hi = (-size & size_and_mask) >> (32 - PAGE_SHIFT); - - mtrr_var_range_msr_set(m, MTRRphysBase_MSR(reg), *(uint64_t *)vr); - mtrr_var_range_msr_set(m, MTRRphysMask_MSR(reg), - *((uint64_t *)vr + 1)); - } -} -/* From Intel Vol. III Section 10.11.4, the Range Size and Base Alignment has - * some kind of requirement: - * 1. The range size must be 2^N byte for N >= 12 (i.e 4KB minimum). - * 2. The base address must be 2^N aligned, where the N here is equal to - * the N in previous requirement. So a 8K range must be 8K aligned not 4K aligned. - */ -static uint32_t range_to_mtrr(uint32_t reg, struct mtrr_state *m, - uint32_t range_startk, uint32_t range_sizek, - uint8_t type) -{ - if ( !range_sizek || (reg >= ((m->mtrr_cap & 0xff) - RESERVED_MTRR)) ) - { - gdprintk(XENLOG_WARNING, - "Failed to init var mtrr msr[%d]" - "range_size:%x, total available MSR:%d\n", - reg, range_sizek, - (uint32_t)((m->mtrr_cap & 0xff) - RESERVED_MTRR)); - return reg; - } - - while ( range_sizek ) - { - uint32_t max_align, align, sizek; - - max_align = (range_startk == 0) ? 32 : ffs(range_startk); - align = min_t(uint32_t, fls(range_sizek), max_align); - sizek = 1 << (align - 1); - - set_var_mtrr(reg++, m, range_startk, sizek, type); - - range_startk += sizek; - range_sizek -= sizek; - - if ( reg >= ((m->mtrr_cap & 0xff) - RESERVED_MTRR) ) - { - gdprintk(XENLOG_WARNING, - "Failed to init var mtrr msr[%d]," - "total available MSR:%d\n", - reg, (uint32_t)((m->mtrr_cap & 0xff) - RESERVED_MTRR)); - break; - } - } - - return reg; -} - -static void setup_fixed_mtrrs(struct vcpu *v) -{ - uint64_t content; - int32_t i; - struct mtrr_state *m = &v->arch.hvm_vcpu.mtrr; - - /* 1. Map (0~A0000) as WB */ - content = 0x0606060606060606ull; - mtrr_fix_range_msr_set(m, 0, content); - mtrr_fix_range_msr_set(m, 1, content); - /* 2. Map VRAM(A0000~C0000) as WC */ - content = 0x0101010101010101; - mtrr_fix_range_msr_set(m, 2, content); - /* 3. Map (C0000~100000) as UC */ - for ( i = 3; i < 11; i++) - mtrr_fix_range_msr_set(m, i, 0); -} - -static void setup_var_mtrrs(struct vcpu *v) -{ - p2m_type_t p2m; - uint64_t e820_mfn; - int8_t *p = NULL; - uint8_t nr = 0; - int32_t i; - uint32_t reg = 0; - uint64_t size = 0; - uint64_t addr = 0; - struct e820entry *e820_table; - - e820_mfn = mfn_x(gfn_to_mfn(v->domain, - HVM_E820_PAGE >> PAGE_SHIFT, &p2m)); - - p = (int8_t *)map_domain_page(e820_mfn); - - nr = *(uint8_t*)(p + HVM_E820_NR_OFFSET); - e820_table = (struct e820entry*)(p + HVM_E820_OFFSET); - /* search E820 table, set MTRR for RAM */ - for ( i = 0; i < nr; i++) - { - if ( (e820_table[i].addr >= 0x100000) && - (e820_table[i].type == E820_RAM) ) - { - if ( e820_table[i].addr == 0x100000 ) - { - size = e820_table[i].size + 0x100000 + PAGE_SIZE * 5; - addr = 0; - } - else - { - /* Larger than 4G */ - size = e820_table[i].size; - addr = e820_table[i].addr; - } - - reg = range_to_mtrr(reg, &v->arch.hvm_vcpu.mtrr, - addr >> PAGE_SHIFT, size >> PAGE_SHIFT, - MTRR_TYPE_WRBACK); - } - } -} - -void init_mtrr_in_hyper(struct vcpu *v) -{ - /* TODO:MTRR should be initialized in BIOS or other places. - * workaround to do it in here - */ - if ( v->arch.hvm_vcpu.mtrr.is_initialized ) - return; - - setup_fixed_mtrrs(v); - setup_var_mtrrs(v); - /* enable mtrr */ - mtrr_def_type_msr_set(&v->arch.hvm_vcpu.mtrr, 0xc00); - - v->arch.hvm_vcpu.mtrr.is_initialized = 1; -} - -static int32_t reset_mtrr(struct mtrr_state *m) -{ - m->var_ranges = xmalloc_array(struct mtrr_var_range, MTRR_VCNT); - if ( m->var_ranges == NULL ) - return -ENOMEM; - memset(m->var_ranges, 0, MTRR_VCNT * sizeof(struct mtrr_var_range)); - memset(m->fixed_ranges, 0, sizeof(m->fixed_ranges)); - m->enabled = 0; - m->def_type = 0;/*mtrr is disabled*/ - m->mtrr_cap = (0x5<<8)|MTRR_VCNT;/*wc,fix enabled, and vcnt=8*/ - m->overlapped = 0; - return 0; -} - -/* init global variables for MTRR and PAT */ -void global_init_mtrr_pat(void) + +static int hvm_mtrr_pat_init(void) { extern uint64_t host_pat; - uint32_t phys_addr; - - init_mtrr_epat_tbl(); - init_pat_entry_tbl(host_pat); - /* Get max physical address, set some global variable */ - if ( cpuid_eax(0x80000000) < 0x80000008 ) - phys_addr = 36; - else - phys_addr = cpuid_eax(0x80000008); - - phys_base_msr_mask = ~((((uint64_t)1) << phys_addr) - 1) | 0xf00UL; - phys_mask_msr_mask = ~((((uint64_t)1) << phys_addr) - 1) | 0x7ffUL; - - size_or_mask = ~((1 << (phys_addr - PAGE_SHIFT)) - 1); - size_and_mask = ~size_or_mask & 0xfff00000; -} - -static void init_pat_entry_tbl(uint64_t pat) -{ - int32_t i, j; + unsigned int i, j, phys_addr; + + memset(&mtrr_epat_tbl, INVALID_MEM_TYPE, sizeof(mtrr_epat_tbl)); + for ( i = 0; i < MTRR_NUM_TYPES; i++ ) + { + for ( j = 0; j < PAT_TYPE_NUMS; j++ ) + { + int32_t tmp = mm_type_tbl[i][j]; + if ( (tmp >= 0) && (tmp < MEMORY_NUM_TYPES) ) + mtrr_epat_tbl[i][tmp] = j; + } + } memset(&pat_entry_tbl, INVALID_MEM_TYPE, PAT_TYPE_NUMS * sizeof(pat_entry_tbl[0])); - for ( i = 0; i < PAT_TYPE_NUMS; i++ ) { for ( j = 0; j < PAT_TYPE_NUMS; j++ ) { - if ( pat_cr_2_paf(pat, j) == i ) + if ( pat_cr_2_paf(host_pat, j) == i ) { pat_entry_tbl[i] = j; break; } } } -} + + phys_addr = 36; + if ( cpuid_eax(0x80000000) >= 0x80000008 ) + phys_addr = (uint8_t)cpuid_eax(0x80000008); + + phys_base_msr_mask = ~((((uint64_t)1) << phys_addr) - 1) | 0xf00UL; + phys_mask_msr_mask = ~((((uint64_t)1) << phys_addr) - 1) | 0x7ffUL; + + size_or_mask = ~((1 << (phys_addr - PAGE_SHIFT)) - 1); + size_and_mask = ~size_or_mask & 0xfff00000; + + return 0; +} +__initcall(hvm_mtrr_pat_init); uint8_t pat_type_2_pte_flags(uint8_t pat_type) { @@ -368,24 +209,35 @@ uint8_t pat_type_2_pte_flags(uint8_t pat return pat_entry_2_pte_flags[pat_entry_tbl[PAT_TYPE_UNCACHABLE]]; } -int32_t reset_vmsr(struct mtrr_state *m, uint64_t *pat_ptr) -{ - int32_t rc; - - rc = reset_mtrr(m); - if ( rc != 0 ) - return rc; - - *pat_ptr = ((uint64_t)PAT_TYPE_WRBACK) | /* PAT0: WB */ - ((uint64_t)PAT_TYPE_WRTHROUGH << 8) | /* PAT1: WT */ - ((uint64_t)PAT_TYPE_UC_MINUS << 16) | /* PAT2: UC- */ - ((uint64_t)PAT_TYPE_UNCACHABLE << 24) | /* PAT3: UC */ - ((uint64_t)PAT_TYPE_WRBACK << 32) | /* PAT4: WB */ - ((uint64_t)PAT_TYPE_WRTHROUGH << 40) | /* PAT5: WT */ - ((uint64_t)PAT_TYPE_UC_MINUS << 48) | /* PAT6: UC- */ - ((uint64_t)PAT_TYPE_UNCACHABLE << 56); /* PAT7: UC */ - - return 0; +int hvm_vcpu_cacheattr_init(struct vcpu *v) +{ + struct mtrr_state *m = &v->arch.hvm_vcpu.mtrr; + + memset(m, 0, sizeof(*m)); + + m->var_ranges = xmalloc_array(struct mtrr_var_range, MTRR_VCNT); + if ( m->var_ranges == NULL ) + return -ENOMEM; + memset(m->var_ranges, 0, MTRR_VCNT * sizeof(struct mtrr_var_range)); + + m->mtrr_cap = (1u << 10) | (1u << 8) | MTRR_VCNT; + + v->arch.hvm_vcpu.pat_cr = + ((uint64_t)PAT_TYPE_WRBACK) | /* PAT0: WB */ + ((uint64_t)PAT_TYPE_WRTHROUGH << 8) | /* PAT1: WT */ + ((uint64_t)PAT_TYPE_UC_MINUS << 16) | /* PAT2: UC- */ + ((uint64_t)PAT_TYPE_UNCACHABLE << 24) | /* PAT3: UC */ + ((uint64_t)PAT_TYPE_WRBACK << 32) | /* PAT4: WB */ + ((uint64_t)PAT_TYPE_WRTHROUGH << 40) | /* PAT5: WT */ + ((uint64_t)PAT_TYPE_UC_MINUS << 48) | /* PAT6: UC- */ + ((uint64_t)PAT_TYPE_UNCACHABLE << 56); /* PAT7: UC */ + + return 0; +} + +void hvm_vcpu_cacheattr_destroy(struct vcpu *v) +{ + xfree(v->arch.hvm_vcpu.mtrr.var_ranges); } /* @@ -512,23 +364,6 @@ static uint8_t effective_mm_type(struct return effective; } -static void init_mtrr_epat_tbl(void) -{ - int32_t i, j; - /* set default value to an invalid type, just for checking conflict */ - memset(&mtrr_epat_tbl, INVALID_MEM_TYPE, sizeof(mtrr_epat_tbl)); - - for ( i = 0; i < MTRR_NUM_TYPES; i++ ) - { - for ( j = 0; j < PAT_TYPE_NUMS; j++ ) - { - int32_t tmp = mm_type_tbl[i][j]; - if ( (tmp >= 0) && (tmp < MEMORY_NUM_TYPES) ) - mtrr_epat_tbl[i][tmp] = j; - } - } -} - uint32_t get_pat_flags(struct vcpu *v, uint32_t gl1e_flags, paddr_t gpaddr, @@ -856,7 +691,6 @@ static int hvm_load_mtrr_msr(struct doma mtrr_def_type_msr_set(mtrr_state, hw_mtrr.msr_mtrr_def_type); - v->arch.hvm_vcpu.mtrr.is_initialized = 1; return 0; } diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/svm/Makefile --- a/xen/arch/x86/hvm/svm/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/svm/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -1,8 +1,6 @@ subdir-$(x86_32) += x86_32 -subdir-$(x86_32) += x86_32 -subdir-$(x86_64) += x86_64 - obj-y += asid.o obj-y += emulate.o +obj-y += entry.o obj-y += intr.o obj-y += svm.o obj-y += vmcb.o diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/svm/entry.S --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/hvm/svm/entry.S Thu Apr 24 14:08:29 2008 -0600 @@ -0,0 +1,178 @@ +/* + * entry.S: SVM architecture-specific entry/exit handling. + * Copyright (c) 2005-2007, Advanced Micro Devices, Inc. + * Copyright (c) 2004, Intel Corporation. + * Copyright (c) 2008, Citrix Systems, 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define VMRUN .byte 0x0F,0x01,0xD8 +#define STGI .byte 0x0F,0x01,0xDC +#define CLGI .byte 0x0F,0x01,0xDD + +#define get_current(reg) \ + mov $STACK_SIZE-BYTES_PER_LONG, r(reg); \ + or r(sp), r(reg); \ + and $~(BYTES_PER_LONG-1),r(reg); \ + mov (r(reg)),r(reg); + +#if defined(__x86_64__) +#define r(reg) %r##reg +#define addr_of(lbl) lbl(%rip) +#define call_with_regs(fn) \ + mov %rsp,%rdi; \ + call fn; +#else /* defined(__i386__) */ +#define r(reg) %e##reg +#define addr_of(lbl) lbl +#define UREGS_rax UREGS_eax +#define UREGS_rip UREGS_eip +#define UREGS_rsp UREGS_esp +#define call_with_regs(fn) \ + mov %esp,%eax; \ + push %eax; \ + call fn; \ + add $4,%esp; +#endif + +ENTRY(svm_asm_do_resume) + get_current(bx) + CLGI + + mov VCPU_processor(r(bx)),%eax + shl $IRQSTAT_shift,r(ax) + lea addr_of(irq_stat),r(dx) + testl $~0,(r(dx),r(ax),1) + jnz .Lsvm_process_softirqs + + call svm_asid_handle_vmrun + call svm_intr_assist + + cmpb $0,addr_of(tb_init_done) + jnz .Lsvm_trace +.Lsvm_trace_done: + + mov VCPU_svm_vmcb(r(bx)),r(cx) + mov UREGS_rax(r(sp)),r(ax) + mov r(ax),VMCB_rax(r(cx)) + mov UREGS_rip(r(sp)),r(ax) + mov r(ax),VMCB_rip(r(cx)) + mov UREGS_rsp(r(sp)),r(ax) + mov r(ax),VMCB_rsp(r(cx)) + mov UREGS_eflags(r(sp)),r(ax) + mov r(ax),VMCB_rflags(r(cx)) + + mov VCPU_svm_vmcb_pa(r(bx)),r(ax) + +#if defined(__x86_64__) + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %rbp + pop %rbx + pop %r11 + pop %r10 + pop %r9 + pop %r8 + add $8,%rsp /* Skip %rax: restored by VMRUN. */ + pop %rcx + pop %rdx + pop %rsi + pop %rdi +#else /* defined(__i386__) */ + pop %ebx + pop %ecx + pop %edx + pop %esi + pop %edi + pop %ebp +#endif + + VMRUN + +#if defined(__x86_64__) + push %rdi + push %rsi + push %rdx + push %rcx + push %rax + push %r8 + push %r9 + push %r10 + push %r11 + push %rbx + push %rbp + push %r12 + push %r13 + push %r14 + push %r15 +#else /* defined(__i386__) */ + push %ebp + push %edi + push %esi + push %edx + push %ecx + push %ebx +#endif + + get_current(bx) + movb $0,VCPU_svm_vmcb_in_sync(r(bx)) + mov VCPU_svm_vmcb(r(bx)),r(cx) + mov VMCB_rax(r(cx)),r(ax) + mov r(ax),UREGS_rax(r(sp)) + mov VMCB_rip(r(cx)),r(ax) + mov r(ax),UREGS_rip(r(sp)) + mov VMCB_rsp(r(cx)),r(ax) + mov r(ax),UREGS_rsp(r(sp)) + mov VMCB_rflags(r(cx)),r(ax) + mov r(ax),UREGS_eflags(r(sp)) + +#ifndef NDEBUG + mov $0xbeef,%ax + mov %ax,UREGS_error_code(r(sp)) + mov %ax,UREGS_entry_vector(r(sp)) + mov %ax,UREGS_saved_upcall_mask(r(sp)) + mov %ax,UREGS_cs(r(sp)) + mov %ax,UREGS_ds(r(sp)) + mov %ax,UREGS_es(r(sp)) + mov %ax,UREGS_fs(r(sp)) + mov %ax,UREGS_gs(r(sp)) + mov %ax,UREGS_ss(r(sp)) +#endif + + STGI +.globl svm_stgi_label +svm_stgi_label: + call_with_regs(svm_vmexit_handler) + jmp svm_asm_do_resume + +.Lsvm_process_softirqs: + STGI + call do_softirq + jmp svm_asm_do_resume + +.Lsvm_trace: + call svm_trace_vmentry + jmp .Lsvm_trace_done diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/svm/intr.c --- a/xen/arch/x86/hvm/svm/intr.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/svm/intr.c Thu Apr 24 14:08:29 2008 -0600 @@ -102,15 +102,17 @@ static void svm_dirq_assist(struct vcpu struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci; struct dev_intx_gsi_link *digl; - if ( !amd_iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) ) + if ( !iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) ) return; for ( irq = find_first_bit(hvm_irq_dpci->dirq_mask, NR_IRQS); irq < NR_IRQS; irq = find_next_bit(hvm_irq_dpci->dirq_mask, NR_IRQS, irq + 1) ) { + if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) ) + continue; + stop_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(irq)]); - clear_bit(irq, &hvm_irq_dpci->dirq_mask); list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list ) { diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/svm/svm.c Thu Apr 24 14:08:29 2008 -0600 @@ -911,6 +911,9 @@ static void svm_cpuid_intercept( __clear_bit(X86_FEATURE_PAE & 31, edx); __clear_bit(X86_FEATURE_PSE36 & 31, edx); + /* We always support MTRR MSRs. */ + *edx |= bitmaskof(X86_FEATURE_MTRR); + /* Filter all other features according to a whitelist. */ *ecx &= (bitmaskof(X86_FEATURE_LAHF_LM) | bitmaskof(X86_FEATURE_ALTMOVCR) | @@ -924,7 +927,9 @@ static void svm_cpuid_intercept( bitmaskof(X86_FEATURE_SYSCALL) | bitmaskof(X86_FEATURE_MP) | bitmaskof(X86_FEATURE_MMXEXT) | - bitmaskof(X86_FEATURE_FFXSR)); + bitmaskof(X86_FEATURE_FFXSR) | + bitmaskof(X86_FEATURE_3DNOW) | + bitmaskof(X86_FEATURE_3DNOWEXT)); break; case 0x80000007: @@ -981,14 +986,6 @@ static int svm_msr_read_intercept(struct switch ( ecx ) { - case MSR_IA32_TSC: - msr_content = hvm_get_guest_time(v); - break; - - case MSR_IA32_APICBASE: - msr_content = vcpu_vlapic(v)->hw.apic_base_msr; - break; - case MSR_EFER: msr_content = v->arch.hvm_vcpu.guest_efer; break; @@ -1013,18 +1010,6 @@ static int svm_msr_read_intercept(struct case MSR_K8_VM_HSAVE_PA: goto gpf; - - case MSR_IA32_MCG_CAP: - case MSR_IA32_MCG_STATUS: - case MSR_IA32_MC0_STATUS: - case MSR_IA32_MC1_STATUS: - case MSR_IA32_MC2_STATUS: - case MSR_IA32_MC3_STATUS: - case MSR_IA32_MC4_STATUS: - case MSR_IA32_MC5_STATUS: - /* No point in letting the guest see real MCEs */ - msr_content = 0; - break; case MSR_IA32_DEBUGCTLMSR: msr_content = vmcb->debugctlmsr; @@ -1083,15 +1068,6 @@ static int svm_msr_write_intercept(struc switch ( ecx ) { - case MSR_IA32_TSC: - hvm_set_guest_time(v, msr_content); - pt_reset(v); - break; - - case MSR_IA32_APICBASE: - vlapic_msr_set(vcpu_vlapic(v), msr_content); - break; - case MSR_K8_VM_HSAVE_PA: goto gpf; @@ -1152,12 +1128,12 @@ static void svm_do_msr_access(struct cpu if ( vmcb->exitinfo1 == 0 ) { - rc = svm_msr_read_intercept(regs); + rc = hvm_msr_read_intercept(regs); inst_len = __get_instruction_length(v, INSTR_RDMSR, NULL); } else { - rc = svm_msr_write_intercept(regs); + rc = hvm_msr_write_intercept(regs); inst_len = __get_instruction_length(v, INSTR_WRMSR, NULL); } diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/svm/x86_32/Makefile --- a/xen/arch/x86/hvm/svm/x86_32/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -obj-y += exits.o diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/svm/x86_32/exits.S --- a/xen/arch/x86/hvm/svm/x86_32/exits.S Thu Apr 24 14:02:16 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* - * exits.S: SVM architecture-specific exit handling. - * Copyright (c) 2005-2007, Advanced Micro Devices, Inc. - * Copyright (c) 2004, 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, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define GET_CURRENT(reg) \ - movl $STACK_SIZE-4,reg; \ - orl %esp,reg; \ - andl $~3,reg; \ - movl (reg),reg; - -#define VMRUN .byte 0x0F,0x01,0xD8 -#define STGI .byte 0x0F,0x01,0xDC -#define CLGI .byte 0x0F,0x01,0xDD - -ENTRY(svm_asm_do_resume) - GET_CURRENT(%ebx) - CLGI - - movl VCPU_processor(%ebx),%eax - shl $IRQSTAT_shift,%eax - testl $~0,irq_stat(%eax,1) - jnz svm_process_softirqs - - call svm_asid_handle_vmrun - call svm_intr_assist - - /* Check if the trace buffer is initialized. - * Because the below condition is unlikely, we jump out of line - * instead of having a mostly taken branch over the unlikely code. - */ - cmpb $0,tb_init_done - jnz svm_trace -svm_trace_done: - - movl VCPU_svm_vmcb(%ebx),%ecx - movl UREGS_eax(%esp),%eax - movl %eax,VMCB_rax(%ecx) - movl UREGS_eip(%esp),%eax - movl %eax,VMCB_rip(%ecx) - movl UREGS_esp(%esp),%eax - movl %eax,VMCB_rsp(%ecx) - movl UREGS_eflags(%esp),%eax - movl %eax,VMCB_rflags(%ecx) - - movl VCPU_svm_vmcb_pa(%ebx),%eax - popl %ebx - popl %ecx - popl %edx - popl %esi - popl %edi - popl %ebp - - VMRUN - - pushl %ebp - pushl %edi - pushl %esi - pushl %edx - pushl %ecx - pushl %ebx - - GET_CURRENT(%ebx) - movb $0,VCPU_svm_vmcb_in_sync(%ebx) - movl VCPU_svm_vmcb(%ebx),%ecx - movl VMCB_rax(%ecx),%eax - movl %eax,UREGS_eax(%esp) - movl VMCB_rip(%ecx),%eax - movl %eax,UREGS_eip(%esp) - movl VMCB_rsp(%ecx),%eax - movl %eax,UREGS_esp(%esp) - movl VMCB_rflags(%ecx),%eax - movl %eax,UREGS_eflags(%esp) - -#ifndef NDEBUG - movw $0xbeef,%ax - movw %ax,UREGS_error_code(%esp) - movw %ax,UREGS_entry_vector(%esp) - movw %ax,UREGS_saved_upcall_mask(%esp) - movw %ax,UREGS_cs(%esp) - movw %ax,UREGS_ds(%esp) - movw %ax,UREGS_es(%esp) - movw %ax,UREGS_fs(%esp) - movw %ax,UREGS_gs(%esp) - movw %ax,UREGS_ss(%esp) -#endif - - STGI -.globl svm_stgi_label; -svm_stgi_label: - movl %esp,%eax - push %eax - call svm_vmexit_handler - addl $4,%esp - jmp svm_asm_do_resume - - ALIGN -svm_process_softirqs: - STGI - call do_softirq - jmp svm_asm_do_resume - -svm_trace: - /* Call out to C, as this is not speed critical path - * Note: svm_trace_vmentry will recheck the tb_init_done, - * but this is on the slow path, so who cares - */ - call svm_trace_vmentry - jmp svm_trace_done diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/svm/x86_64/Makefile --- a/xen/arch/x86/hvm/svm/x86_64/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -obj-y += exits.o diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/svm/x86_64/exits.S --- a/xen/arch/x86/hvm/svm/x86_64/exits.S Thu Apr 24 14:02:16 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* - * exits.S: AMD-V architecture-specific exit handling. - * Copyright (c) 2005-2007, Advanced Micro Devices, Inc. - * Copyright (c) 2004, 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, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define GET_CURRENT(reg) \ - movq $STACK_SIZE-8,reg; \ - orq %rsp,reg; \ - andq $~7,reg; \ - movq (reg),reg; - -#define VMRUN .byte 0x0F,0x01,0xD8 -#define STGI .byte 0x0F,0x01,0xDC -#define CLGI .byte 0x0F,0x01,0xDD - -ENTRY(svm_asm_do_resume) - GET_CURRENT(%rbx) - CLGI - - movl VCPU_processor(%rbx),%eax - shl $IRQSTAT_shift,%rax - leaq irq_stat(%rip),%rdx - testl $~0,(%rdx,%rax,1) - jnz svm_process_softirqs - - call svm_asid_handle_vmrun - call svm_intr_assist - - /* Check if the trace buffer is initialized. - * Because the below condition is unlikely, we jump out of line - * instead of having a mostly taken branch over the unlikely code. - */ - cmpb $0,tb_init_done(%rip) - jnz svm_trace -svm_trace_done: - - movq VCPU_svm_vmcb(%rbx),%rcx - movq UREGS_rax(%rsp),%rax - movq %rax,VMCB_rax(%rcx) - movq UREGS_rip(%rsp),%rax - movq %rax,VMCB_rip(%rcx) - movq UREGS_rsp(%rsp),%rax - movq %rax,VMCB_rsp(%rcx) - movq UREGS_eflags(%rsp),%rax - movq %rax,VMCB_rflags(%rcx) - - movq VCPU_svm_vmcb_pa(%rbx),%rax - popq %r15 - popq %r14 - popq %r13 - popq %r12 - popq %rbp - popq %rbx - popq %r11 - popq %r10 - popq %r9 - popq %r8 - addq $8,%rsp /* Skip %rax: restored by VMRUN. */ - popq %rcx - popq %rdx - popq %rsi - popq %rdi - - VMRUN - - pushq %rdi - pushq %rsi - pushq %rdx - pushq %rcx - pushq %rax - pushq %r8 - pushq %r9 - pushq %r10 - pushq %r11 - pushq %rbx - pushq %rbp - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - - GET_CURRENT(%rbx) - movb $0,VCPU_svm_vmcb_in_sync(%rbx) - movq VCPU_svm_vmcb(%rbx),%rcx - movq VMCB_rax(%rcx),%rax - movq %rax,UREGS_rax(%rsp) - movq VMCB_rip(%rcx),%rax - movq %rax,UREGS_rip(%rsp) - movq VMCB_rsp(%rcx),%rax - movq %rax,UREGS_rsp(%rsp) - movq VMCB_rflags(%rcx),%rax - movq %rax,UREGS_eflags(%rsp) - -#ifndef NDEBUG - movw $0xbeef,%ax - movw %ax,UREGS_error_code(%rsp) - movw %ax,UREGS_entry_vector(%rsp) - movw %ax,UREGS_saved_upcall_mask(%rsp) - movw %ax,UREGS_cs(%rsp) - movw %ax,UREGS_ds(%rsp) - movw %ax,UREGS_es(%rsp) - movw %ax,UREGS_fs(%rsp) - movw %ax,UREGS_gs(%rsp) - movw %ax,UREGS_ss(%rsp) -#endif - - STGI -.globl svm_stgi_label; -svm_stgi_label: - movq %rsp,%rdi - call svm_vmexit_handler - jmp svm_asm_do_resume - - ALIGN -svm_process_softirqs: - STGI - call do_softirq - jmp svm_asm_do_resume - -svm_trace: - /* Call out to C, as this is not speed critical path - * Note: svm_trace_vmentry will recheck the tb_init_done, - * but this is on the slow path, so who cares - */ - call svm_trace_vmentry - jmp svm_trace_done diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/vmx/Makefile --- a/xen/arch/x86/hvm/vmx/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/vmx/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -1,6 +1,4 @@ subdir-$(x86_32) += x86_32 -subdir-$(x86_32) += x86_32 -subdir-$(x86_64) += x86_64 - +obj-y += entry.o obj-y += intr.o obj-y += realmode.o obj-y += vmcs.o diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/vmx/entry.S --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/hvm/vmx/entry.S Thu Apr 24 14:08:29 2008 -0600 @@ -0,0 +1,198 @@ +/* + * entry.S: VMX architecture-specific entry/exit handling. + * Copyright (c) 2004, Intel Corporation. + * Copyright (c) 2008, Citrix Systems, 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define VMRESUME .byte 0x0f,0x01,0xc3 +#define VMLAUNCH .byte 0x0f,0x01,0xc2 +#define VMREAD(off) .byte 0x0f,0x78,0x47,((off)-UREGS_rip) +#define VMWRITE(off) .byte 0x0f,0x79,0x47,((off)-UREGS_rip) + +/* VMCS field encodings */ +#define GUEST_RSP 0x681c +#define GUEST_RIP 0x681e +#define GUEST_RFLAGS 0x6820 + +#define get_current(reg) \ + mov $STACK_SIZE-BYTES_PER_LONG, r(reg); \ + or r(sp), r(reg); \ + and $~(BYTES_PER_LONG-1),r(reg); \ + mov (r(reg)),r(reg); + +#if defined(__x86_64__) +#define r(reg) %r##reg +#define addr_of(lbl) lbl(%rip) +#define call_with_regs(fn) \ + mov %rsp,%rdi; \ + call fn; +#else /* defined(__i386__) */ +#define r(reg) %e##reg +#define addr_of(lbl) lbl +#define UREGS_rip UREGS_eip +#define UREGS_rsp UREGS_esp +#define call_with_regs(fn) \ + mov %esp,%eax; \ + push %eax; \ + call fn; \ + add $4,%esp; +#endif + + ALIGN +.globl vmx_asm_vmexit_handler +vmx_asm_vmexit_handler: +#if defined(__x86_64__) + push %rdi + push %rsi + push %rdx + push %rcx + push %rax + push %r8 + push %r9 + push %r10 + push %r11 + push %rbx + push %rbp + push %r12 + push %r13 + push %r14 + push %r15 +#else /* defined(__i386__) */ + push %eax + push %ebp + push %edi + push %esi + push %edx + push %ecx + push %ebx +#endif + + get_current(bx) + + movb $1,VCPU_vmx_launched(r(bx)) + + lea UREGS_rip(r(sp)),r(di) + mov $GUEST_RIP,%eax + /*VMREAD(UREGS_rip)*/ + .byte 0x0f,0x78,0x07 /* vmread r(ax),(r(di)) */ + mov $GUEST_RSP,%eax + VMREAD(UREGS_rsp) + mov $GUEST_RFLAGS,%eax + VMREAD(UREGS_eflags) + + mov %cr2,r(ax) + mov r(ax),VCPU_hvm_guest_cr2(r(bx)) + +#ifndef NDEBUG + mov $0xbeef,%ax + mov %ax,UREGS_error_code(r(sp)) + mov %ax,UREGS_entry_vector(r(sp)) + mov %ax,UREGS_saved_upcall_mask(r(sp)) + mov %ax,UREGS_cs(r(sp)) + mov %ax,UREGS_ds(r(sp)) + mov %ax,UREGS_es(r(sp)) + mov %ax,UREGS_fs(r(sp)) + mov %ax,UREGS_gs(r(sp)) + mov %ax,UREGS_ss(r(sp)) +#endif + + call_with_regs(vmx_vmexit_handler) + +.globl vmx_asm_do_vmentry +vmx_asm_do_vmentry: + get_current(bx) + cli + + mov VCPU_processor(r(bx)),%eax + shl $IRQSTAT_shift,r(ax) + lea addr_of(irq_stat),r(dx) + cmpl $0,(r(dx),r(ax),1) + jnz .Lvmx_process_softirqs + + call vmx_intr_assist + + testb $0xff,VCPU_vmx_emul(r(bx)) + jnz .Lvmx_goto_realmode + + mov VCPU_hvm_guest_cr2(r(bx)),r(ax) + mov r(ax),%cr2 + call vmx_trace_vmentry + + lea UREGS_rip(r(sp)),r(di) + mov $GUEST_RIP,%eax + /*VMWRITE(UREGS_rip)*/ + .byte 0x0f,0x79,0x07 /* vmwrite (r(di)),r(ax) */ + mov $GUEST_RSP,%eax + VMWRITE(UREGS_rsp) + mov $GUEST_RFLAGS,%eax + VMWRITE(UREGS_eflags) + + cmpb $0,VCPU_vmx_launched(r(bx)) +#if defined(__x86_64__) + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %rbp + pop %rbx + pop %r11 + pop %r10 + pop %r9 + pop %r8 + pop %rax + pop %rcx + pop %rdx + pop %rsi + pop %rdi +#else /* defined(__i386__) */ + pop %ebx + pop %ecx + pop %edx + pop %esi + pop %edi + pop %ebp + pop %eax +#endif + je .Lvmx_launch + +/*.Lvmx_resume:*/ + VMRESUME + call vm_resume_fail + ud2 + +.Lvmx_launch: + VMLAUNCH + call vm_launch_fail + ud2 + +.Lvmx_goto_realmode: + sti + call_with_regs(vmx_realmode) + jmp vmx_asm_do_vmentry + +.Lvmx_process_softirqs: + sti + call do_softirq + jmp vmx_asm_do_vmentry diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/vmx/intr.c --- a/xen/arch/x86/hvm/vmx/intr.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/vmx/intr.c Thu Apr 24 14:08:29 2008 -0600 @@ -111,15 +111,17 @@ static void vmx_dirq_assist(struct vcpu struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci; struct dev_intx_gsi_link *digl; - if ( !vtd_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) ) + if ( !iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) ) return; for ( irq = find_first_bit(hvm_irq_dpci->dirq_mask, NR_IRQS); irq < NR_IRQS; irq = find_next_bit(hvm_irq_dpci->dirq_mask, NR_IRQS, irq + 1) ) { + if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) ) + continue; + stop_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(irq)]); - clear_bit(irq, &hvm_irq_dpci->dirq_mask); list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list ) { diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/hvm/vmx/vmx.c Thu Apr 24 14:08:29 2008 -0600 @@ -1622,17 +1622,11 @@ static int vmx_msr_read_intercept(struct u64 msr_content = 0; u32 ecx = regs->ecx, eax, edx; struct vcpu *v = current; - int index; - u64 *var_range_base = (u64*)v->arch.hvm_vcpu.mtrr.var_ranges; - u64 *fixed_range_base = (u64*)v->arch.hvm_vcpu.mtrr.fixed_ranges; HVM_DBG_LOG(DBG_LEVEL_1, "ecx=%x", ecx); switch ( ecx ) { - case MSR_IA32_TSC: - msr_content = hvm_get_guest_time(v); - break; case MSR_IA32_SYSENTER_CS: msr_content = (u32)__vmread(GUEST_SYSENTER_CS); break; @@ -1641,35 +1635,6 @@ static int vmx_msr_read_intercept(struct break; case MSR_IA32_SYSENTER_EIP: msr_content = __vmread(GUEST_SYSENTER_EIP); - break; - case MSR_IA32_APICBASE: - msr_content = vcpu_vlapic(v)->hw.apic_base_msr; - break; - case MSR_IA32_CR_PAT: - msr_content = v->arch.hvm_vcpu.pat_cr; - break; - case MSR_MTRRcap: - msr_content = v->arch.hvm_vcpu.mtrr.mtrr_cap; - break; - case MSR_MTRRdefType: - msr_content = v->arch.hvm_vcpu.mtrr.def_type - | (v->arch.hvm_vcpu.mtrr.enabled << 10); - break; - case MSR_MTRRfix64K_00000: - msr_content = fixed_range_base[0]; - break; - case MSR_MTRRfix16K_80000: - case MSR_MTRRfix16K_A0000: - index = regs->ecx - MSR_MTRRfix16K_80000; - msr_content = fixed_range_base[index + 1]; - break; - case MSR_MTRRfix4K_C0000...MSR_MTRRfix4K_F8000: - index = regs->ecx - MSR_MTRRfix4K_C0000; - msr_content = fixed_range_base[index + 3]; - break; - case MSR_IA32_MTRR_PHYSBASE0...MSR_IA32_MTRR_PHYSMASK7: - index = regs->ecx - MSR_IA32_MTRR_PHYSBASE0; - msr_content = var_range_base[index]; break; case MSR_IA32_DEBUGCTLMSR: msr_content = __vmread(GUEST_IA32_DEBUGCTL); @@ -1679,17 +1644,6 @@ static int vmx_msr_read_intercept(struct break; case MSR_IA32_VMX_BASIC...MSR_IA32_VMX_PROCBASED_CTLS2: goto gp_fault; - case MSR_IA32_MCG_CAP: - case MSR_IA32_MCG_STATUS: - case MSR_IA32_MC0_STATUS: - case MSR_IA32_MC1_STATUS: - case MSR_IA32_MC2_STATUS: - case MSR_IA32_MC3_STATUS: - case MSR_IA32_MC4_STATUS: - case MSR_IA32_MC5_STATUS: - /* No point in letting the guest see real MCEs */ - msr_content = 0; - break; case MSR_IA32_MISC_ENABLE: rdmsrl(MSR_IA32_MISC_ENABLE, msr_content); /* Debug Trace Store is not supported. */ @@ -1729,8 +1683,8 @@ static int vmx_msr_read_intercept(struct goto gp_fault; } - regs->eax = msr_content & 0xFFFFFFFF; - regs->edx = msr_content >> 32; + regs->eax = (uint32_t)msr_content; + regs->edx = (uint32_t)(msr_content >> 32); done: hvmtrace_msr_read(v, ecx, msr_content); @@ -1833,19 +1787,11 @@ void vmx_vlapic_msr_changed(struct vcpu vmx_vmcs_exit(v); } -extern bool_t mtrr_var_range_msr_set(struct mtrr_state *v, - u32 msr, u64 msr_content); -extern bool_t mtrr_fix_range_msr_set(struct mtrr_state *v, - int row, u64 msr_content); -extern bool_t mtrr_def_type_msr_set(struct mtrr_state *v, u64 msr_content); -extern bool_t pat_msr_set(u64 *pat, u64 msr); - static int vmx_msr_write_intercept(struct cpu_user_regs *regs) { u32 ecx = regs->ecx; u64 msr_content; struct vcpu *v = current; - int index; HVM_DBG_LOG(DBG_LEVEL_1, "ecx=%x, eax=%x, edx=%x", ecx, (u32)regs->eax, (u32)regs->edx); @@ -1856,10 +1802,6 @@ static int vmx_msr_write_intercept(struc switch ( ecx ) { - case MSR_IA32_TSC: - hvm_set_guest_time(v, msr_content); - pt_reset(v); - break; case MSR_IA32_SYSENTER_CS: __vmwrite(GUEST_SYSENTER_CS, msr_content); break; @@ -1869,41 +1811,6 @@ static int vmx_msr_write_intercept(struc case MSR_IA32_SYSENTER_EIP: __vmwrite(GUEST_SYSENTER_EIP, msr_content); break; - case MSR_IA32_APICBASE: - vlapic_msr_set(vcpu_vlapic(v), msr_content); - break; - case MSR_IA32_CR_PAT: - if ( !pat_msr_set(&v->arch.hvm_vcpu.pat_cr, msr_content) ) - goto gp_fault; - break; - case MSR_MTRRdefType: - if ( !mtrr_def_type_msr_set(&v->arch.hvm_vcpu.mtrr, msr_content) ) - goto gp_fault; - break; - case MSR_MTRRfix64K_00000: - if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, 0, msr_content) ) - goto gp_fault; - break; - case MSR_MTRRfix16K_80000: - case MSR_MTRRfix16K_A0000: - index = regs->ecx - MSR_MTRRfix16K_80000 + 1; - if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, - index, msr_content) ) - goto gp_fault; - break; - case MSR_MTRRfix4K_C0000...MSR_MTRRfix4K_F8000: - index = regs->ecx - MSR_MTRRfix4K_C0000 + 3; - if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, - index, msr_content) ) - goto gp_fault; - break; - case MSR_IA32_MTRR_PHYSBASE0...MSR_IA32_MTRR_PHYSMASK7: - if ( !mtrr_var_range_msr_set(&v->arch.hvm_vcpu.mtrr, - regs->ecx, msr_content) ) - goto gp_fault; - break; - case MSR_MTRRcap: - goto gp_fault; case MSR_IA32_DEBUGCTLMSR: { int i, rc = 0; @@ -2330,12 +2237,12 @@ asmlinkage void vmx_vmexit_handler(struc break; case EXIT_REASON_MSR_READ: inst_len = __get_instruction_length(); /* Safe: RDMSR */ - if ( vmx_msr_read_intercept(regs) == X86EMUL_OKAY ) + if ( hvm_msr_read_intercept(regs) == X86EMUL_OKAY ) __update_guest_eip(inst_len); break; case EXIT_REASON_MSR_WRITE: inst_len = __get_instruction_length(); /* Safe: WRMSR */ - if ( vmx_msr_write_intercept(regs) == X86EMUL_OKAY ) + if ( hvm_msr_write_intercept(regs) == X86EMUL_OKAY ) __update_guest_eip(inst_len); break; diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/vmx/x86_32/Makefile --- a/xen/arch/x86/hvm/vmx/x86_32/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -obj-y += exits.o diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/vmx/x86_32/exits.S --- a/xen/arch/x86/hvm/vmx/x86_32/exits.S Thu Apr 24 14:02:16 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* - * exits.S: VMX architecture-specific exit handling. - * Copyright (c) 2004, 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, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - */ -#include -#include -#include -#include -#include -#include -#include - -#define VMRESUME .byte 0x0f,0x01,0xc3 -#define VMLAUNCH .byte 0x0f,0x01,0xc2 -#define VMREAD(off) .byte 0x0f,0x78,0x44,0x24,off -#define VMWRITE(off) .byte 0x0f,0x79,0x44,0x24,off - -/* VMCS field encodings */ -#define GUEST_RSP 0x681c -#define GUEST_RIP 0x681e -#define GUEST_RFLAGS 0x6820 - -#define GET_CURRENT(reg) \ - movl $STACK_SIZE-4, reg; \ - orl %esp, reg; \ - andl $~3,reg; \ - movl (reg),reg; - -#define HVM_SAVE_ALL_NOSEGREGS \ - pushl %eax; \ - pushl %ebp; \ - pushl %edi; \ - pushl %esi; \ - pushl %edx; \ - pushl %ecx; \ - pushl %ebx; - -#define HVM_RESTORE_ALL_NOSEGREGS \ - popl %ebx; \ - popl %ecx; \ - popl %edx; \ - popl %esi; \ - popl %edi; \ - popl %ebp; \ - popl %eax - - ALIGN -ENTRY(vmx_asm_vmexit_handler) - HVM_SAVE_ALL_NOSEGREGS - GET_CURRENT(%ebx) - - movl $GUEST_RIP,%eax - VMREAD(UREGS_eip) - movl $GUEST_RSP,%eax - VMREAD(UREGS_esp) - movl $GUEST_RFLAGS,%eax - VMREAD(UREGS_eflags) - - movl %cr2,%eax - movl %eax,VCPU_hvm_guest_cr2(%ebx) - -#ifndef NDEBUG - movw $0xbeef,%ax - movw %ax,UREGS_error_code(%esp) - movw %ax,UREGS_entry_vector(%esp) - movw %ax,UREGS_saved_upcall_mask(%esp) - movw %ax,UREGS_cs(%esp) - movw %ax,UREGS_ds(%esp) - movw %ax,UREGS_es(%esp) - movw %ax,UREGS_fs(%esp) - movw %ax,UREGS_gs(%esp) - movw %ax,UREGS_ss(%esp) -#endif - - movl %esp,%eax - push %eax - call vmx_vmexit_handler - addl $4,%esp - jmp vmx_asm_do_vmentry - - ALIGN -vmx_process_softirqs: - sti - call do_softirq - jmp vmx_asm_do_vmentry - - ALIGN -ENTRY(vmx_asm_do_vmentry) - GET_CURRENT(%ebx) - cli # tests must not race interrupts - - movl VCPU_processor(%ebx),%eax - shl $IRQSTAT_shift,%eax - cmpl $0,irq_stat(%eax,1) - jnz vmx_process_softirqs - - call vmx_intr_assist - - testb $0xff,VCPU_vmx_emul(%ebx) - jnz vmx_goto_realmode - - movl VCPU_hvm_guest_cr2(%ebx),%eax - movl %eax,%cr2 - call vmx_trace_vmentry - - movl $GUEST_RIP,%eax - VMWRITE(UREGS_eip) - movl $GUEST_RSP,%eax - VMWRITE(UREGS_esp) - movl $GUEST_RFLAGS,%eax - VMWRITE(UREGS_eflags) - - cmpb $0,VCPU_vmx_launched(%ebx) - je vmx_launch - -/*vmx_resume:*/ - HVM_RESTORE_ALL_NOSEGREGS - VMRESUME - call vm_resume_fail - ud2 - -vmx_launch: - movb $1,VCPU_vmx_launched(%ebx) - HVM_RESTORE_ALL_NOSEGREGS - VMLAUNCH - call vm_launch_fail - ud2 - -vmx_goto_realmode: - sti - movl %esp,%eax - push %eax - call vmx_realmode - addl $4,%esp - jmp vmx_asm_do_vmentry diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/vmx/x86_64/Makefile --- a/xen/arch/x86/hvm/vmx/x86_64/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -obj-y += exits.o diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/hvm/vmx/x86_64/exits.S --- a/xen/arch/x86/hvm/vmx/x86_64/exits.S Thu Apr 24 14:02:16 2008 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* - * exits.S: VMX architecture-specific exit handling. - * Copyright (c) 2004, 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, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - */ -#include -#include -#include -#include -#include -#include -#include - -#define VMRESUME .byte 0x0f,0x01,0xc3 -#define VMLAUNCH .byte 0x0f,0x01,0xc2 -#define VMREAD(off) .byte 0x0f,0x78,0x47,((off)-UREGS_rip) -#define VMWRITE(off) .byte 0x0f,0x79,0x47,((off)-UREGS_rip) - -/* VMCS field encodings */ -#define GUEST_RSP 0x681c -#define GUEST_RIP 0x681e -#define GUEST_RFLAGS 0x6820 - -#define GET_CURRENT(reg) \ - movq $STACK_SIZE-8, reg; \ - orq %rsp, reg; \ - andq $~7,reg; \ - movq (reg),reg; - -#define HVM_SAVE_ALL_NOSEGREGS \ - pushq %rdi; \ - pushq %rsi; \ - pushq %rdx; \ - pushq %rcx; \ - pushq %rax; \ - pushq %r8; \ - pushq %r9; \ - pushq %r10; \ - pushq %r11; \ - pushq %rbx; \ - pushq %rbp; \ - pushq %r12; \ - pushq %r13; \ - pushq %r14; \ - pushq %r15; - -#define HVM_RESTORE_ALL_NOSEGREGS \ - popq %r15; \ - popq %r14; \ - popq %r13; \ - popq %r12; \ - popq %rbp; \ - popq %rbx; \ - popq %r11; \ - popq %r10; \ - popq %r9; \ - popq %r8; \ - popq %rax; \ - popq %rcx; \ - popq %rdx; \ - popq %rsi; \ - popq %rdi - - ALIGN -ENTRY(vmx_asm_vmexit_handler) - HVM_SAVE_ALL_NOSEGREGS - GET_CURRENT(%rbx) - - leaq UREGS_rip(%rsp),%rdi - movl $GUEST_RIP,%eax - /*VMREAD(UREGS_rip)*/ - .byte 0x0f,0x78,0x07 /* vmread %rax,(%rdi) */ - movl $GUEST_RSP,%eax - VMREAD(UREGS_rsp) - movl $GUEST_RFLAGS,%eax - VMREAD(UREGS_eflags) - - movq %cr2,%rax - movq %rax,VCPU_hvm_guest_cr2(%rbx) - -#ifndef NDEBUG - movw $0xbeef,%ax - movw %ax,UREGS_error_code(%rsp) - movw %ax,UREGS_entry_vector(%rsp) - movw %ax,UREGS_saved_upcall_mask(%rsp) - movw %ax,UREGS_cs(%rsp) - movw %ax,UREGS_ds(%rsp) - movw %ax,UREGS_es(%rsp) - movw %ax,UREGS_fs(%rsp) - movw %ax,UREGS_gs(%rsp) - movw %ax,UREGS_ss(%rsp) -#endif - - movq %rsp,%rdi - call vmx_vmexit_handler - jmp vmx_asm_do_vmentry - - ALIGN -vmx_process_softirqs: - sti - call do_softirq - jmp vmx_asm_do_vmentry - - ALIGN -ENTRY(vmx_asm_do_vmentry) - GET_CURRENT(%rbx) - cli # tests must not race interrupts - - movl VCPU_processor(%rbx),%eax - shl $IRQSTAT_shift,%rax - leaq irq_stat(%rip),%rdx - cmpl $0,(%rdx,%rax,1) - jnz vmx_process_softirqs - - call vmx_intr_assist - - testb $0xff,VCPU_vmx_emul(%rbx) - jnz vmx_goto_realmode - - movq VCPU_hvm_guest_cr2(%rbx),%rax - movq %rax,%cr2 - call vmx_trace_vmentry - - leaq UREGS_rip(%rsp),%rdi - movl $GUEST_RIP,%eax - /*VMWRITE(UREGS_rip)*/ - .byte 0x0f,0x79,0x07 /* vmwrite (%rdi),%rax */ - movl $GUEST_RSP,%eax - VMWRITE(UREGS_rsp) - movl $GUEST_RFLAGS,%eax - VMWRITE(UREGS_eflags) - - cmpb $0,VCPU_vmx_launched(%rbx) - je vmx_launch - -/*vmx_resume:*/ - HVM_RESTORE_ALL_NOSEGREGS - VMRESUME - call vm_resume_fail - ud2 - -vmx_launch: - movb $1,VCPU_vmx_launched(%rbx) - HVM_RESTORE_ALL_NOSEGREGS - VMLAUNCH - call vm_launch_fail - ud2 - -vmx_goto_realmode: - sti - movq %rsp,%rdi - call vmx_realmode - jmp vmx_asm_do_vmentry diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/mm.c Thu Apr 24 14:08:29 2008 -0600 @@ -3279,15 +3279,6 @@ long arch_memory_op(int op, XEN_GUEST_HA case XENMAPSPACE_shared_info: if ( xatp.idx == 0 ) mfn = virt_to_mfn(d->shared_info); - /* XXX: assumption here, this is called after E820 table is build - * need the E820 to initialize MTRR. - */ - if ( is_hvm_domain(d) ) { - extern void init_mtrr_in_hyper(struct vcpu *); - struct vcpu *vs; - for_each_vcpu(d, vs) - init_mtrr_in_hyper(vs); - } break; case XENMAPSPACE_grant_table: spin_lock(&d->grant_table->lock); @@ -3625,29 +3616,18 @@ static int ptwr_emulated_cmpxchg( static int ptwr_emulated_cmpxchg( enum x86_segment seg, unsigned long offset, - unsigned long old, - unsigned long new, + void *p_old, + void *p_new, unsigned int bytes, struct x86_emulate_ctxt *ctxt) { + paddr_t old = 0, new = 0; + if ( bytes > sizeof(paddr_t) ) + return X86EMUL_UNHANDLEABLE; + memcpy(&old, p_old, bytes); + memcpy(&new, p_new, bytes); return ptwr_emulated_update( offset, old, new, bytes, 1, - container_of(ctxt, struct ptwr_emulate_ctxt, ctxt)); -} - -static int ptwr_emulated_cmpxchg8b( - enum x86_segment seg, - unsigned long offset, - unsigned long old, - unsigned long old_hi, - unsigned long new, - unsigned long new_hi, - struct x86_emulate_ctxt *ctxt) -{ - if ( CONFIG_PAGING_LEVELS == 2 ) - return X86EMUL_UNHANDLEABLE; - return ptwr_emulated_update( - offset, ((u64)old_hi << 32) | old, ((u64)new_hi << 32) | new, 8, 1, container_of(ctxt, struct ptwr_emulate_ctxt, ctxt)); } @@ -3656,7 +3636,6 @@ static struct x86_emulate_ops ptwr_emula .insn_fetch = ptwr_emulated_read, .write = ptwr_emulated_write, .cmpxchg = ptwr_emulated_cmpxchg, - .cmpxchg8b = ptwr_emulated_cmpxchg8b }; /* Write page fault handler: check if guest is trying to modify a PTE. */ diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/mm/shadow/common.c Thu Apr 24 14:08:29 2008 -0600 @@ -239,15 +239,15 @@ static int static int hvm_emulate_cmpxchg(enum x86_segment seg, unsigned long offset, - unsigned long old, - unsigned long new, + void *p_old, + void *p_new, unsigned int bytes, struct x86_emulate_ctxt *ctxt) { struct sh_emulate_ctxt *sh_ctxt = container_of(ctxt, struct sh_emulate_ctxt, ctxt); struct vcpu *v = current; - unsigned long addr; + unsigned long addr, old[2], new[2]; int rc; if ( !is_x86_user_segment(seg) ) @@ -258,35 +258,21 @@ hvm_emulate_cmpxchg(enum x86_segment seg if ( rc ) return rc; - return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( - v, addr, old, new, bytes, sh_ctxt); -} - -static int -hvm_emulate_cmpxchg8b(enum x86_segment seg, - unsigned long offset, - unsigned long old_lo, - unsigned long old_hi, - unsigned long new_lo, - unsigned long new_hi, - struct x86_emulate_ctxt *ctxt) -{ - struct sh_emulate_ctxt *sh_ctxt = - container_of(ctxt, struct sh_emulate_ctxt, ctxt); - struct vcpu *v = current; - unsigned long addr; - int rc; - - if ( !is_x86_user_segment(seg) ) - return X86EMUL_UNHANDLEABLE; - - rc = hvm_translate_linear_addr( - seg, offset, 8, hvm_access_write, sh_ctxt, &addr); - if ( rc ) - return rc; - - return v->arch.paging.mode->shadow.x86_emulate_cmpxchg8b( - v, addr, old_lo, old_hi, new_lo, new_hi, sh_ctxt); + old[0] = new[0] = 0; + memcpy(old, p_old, bytes); + memcpy(new, p_new, bytes); + + if ( bytes <= sizeof(long) ) + return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( + v, addr, old[0], new[0], bytes, sh_ctxt); + +#ifdef __i386__ + if ( bytes == 8 ) + return v->arch.paging.mode->shadow.x86_emulate_cmpxchg8b( + v, addr, old[0], old[1], new[0], new[1], sh_ctxt); +#endif + + return X86EMUL_UNHANDLEABLE; } static struct x86_emulate_ops hvm_shadow_emulator_ops = { @@ -294,7 +280,6 @@ static struct x86_emulate_ops hvm_shadow .insn_fetch = hvm_emulate_insn_fetch, .write = hvm_emulate_write, .cmpxchg = hvm_emulate_cmpxchg, - .cmpxchg8b = hvm_emulate_cmpxchg8b, }; static int @@ -338,36 +323,34 @@ static int static int pv_emulate_cmpxchg(enum x86_segment seg, unsigned long offset, - unsigned long old, - unsigned long new, + void *p_old, + void *p_new, unsigned int bytes, struct x86_emulate_ctxt *ctxt) { struct sh_emulate_ctxt *sh_ctxt = container_of(ctxt, struct sh_emulate_ctxt, ctxt); + unsigned long old[2], new[2]; struct vcpu *v = current; + if ( !is_x86_user_segment(seg) ) return X86EMUL_UNHANDLEABLE; - return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( - v, offset, old, new, bytes, sh_ctxt); -} - -static int -pv_emulate_cmpxchg8b(enum x86_segment seg, - unsigned long offset, - unsigned long old_lo, - unsigned long old_hi, - unsigned long new_lo, - unsigned long new_hi, - struct x86_emulate_ctxt *ctxt) -{ - struct sh_emulate_ctxt *sh_ctxt = - container_of(ctxt, struct sh_emulate_ctxt, ctxt); - struct vcpu *v = current; - if ( !is_x86_user_segment(seg) ) - return X86EMUL_UNHANDLEABLE; - return v->arch.paging.mode->shadow.x86_emulate_cmpxchg8b( - v, offset, old_lo, old_hi, new_lo, new_hi, sh_ctxt); + + old[0] = new[0] = 0; + memcpy(old, p_old, bytes); + memcpy(new, p_new, bytes); + + if ( bytes <= sizeof(long) ) + return v->arch.paging.mode->shadow.x86_emulate_cmpxchg( + v, offset, old[0], new[0], bytes, sh_ctxt); + +#ifdef __i386__ + if ( bytes == 8 ) + return v->arch.paging.mode->shadow.x86_emulate_cmpxchg8b( + v, offset, old[0], old[1], new[0], new[1], sh_ctxt); +#endif + + return X86EMUL_UNHANDLEABLE; } static struct x86_emulate_ops pv_shadow_emulator_ops = { @@ -375,7 +358,6 @@ static struct x86_emulate_ops pv_shadow_ .insn_fetch = pv_emulate_read, .write = pv_emulate_write, .cmpxchg = pv_emulate_cmpxchg, - .cmpxchg8b = pv_emulate_cmpxchg8b, }; struct x86_emulate_ops *shadow_init_emulation( diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/mm/shadow/multi.c --- a/xen/arch/x86/mm/shadow/multi.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/mm/shadow/multi.c Thu Apr 24 14:08:29 2008 -0600 @@ -2089,7 +2089,7 @@ static shadow_l1e_t * shadow_get_and_cre else { /* Shadowing an actual guest l1 table */ - if ( !mfn_valid(gw->l2mfn) ) return NULL; /* No guest page. */ + if ( !mfn_valid(gw->l1mfn) ) return NULL; /* No guest page. */ *sl1mfn = get_shadow_status(v, gw->l1mfn, SH_type_l1_shadow); if ( !mfn_valid(*sl1mfn) ) { @@ -4365,7 +4365,7 @@ static void emulate_unmap_dest(struct vc atomic_inc(&v->domain->arch.paging.shadow.gtable_dirty_version); } -int +static int sh_x86_emulate_write(struct vcpu *v, unsigned long vaddr, void *src, u32 bytes, struct sh_emulate_ctxt *sh_ctxt) { @@ -4389,7 +4389,7 @@ sh_x86_emulate_write(struct vcpu *v, uns return X86EMUL_OKAY; } -int +static int sh_x86_emulate_cmpxchg(struct vcpu *v, unsigned long vaddr, unsigned long old, unsigned long new, unsigned int bytes, struct sh_emulate_ctxt *sh_ctxt) @@ -4432,7 +4432,8 @@ sh_x86_emulate_cmpxchg(struct vcpu *v, u return rv; } -int +#ifdef __i386__ +static int sh_x86_emulate_cmpxchg8b(struct vcpu *v, unsigned long vaddr, unsigned long old_lo, unsigned long old_hi, unsigned long new_lo, unsigned long new_hi, @@ -4465,7 +4466,7 @@ sh_x86_emulate_cmpxchg8b(struct vcpu *v, shadow_unlock(v->domain); return rv; } - +#endif /**************************************************************************/ /* Audit tools */ @@ -4738,7 +4739,9 @@ struct paging_mode sh_paging_mode = { .shadow.detach_old_tables = sh_detach_old_tables, .shadow.x86_emulate_write = sh_x86_emulate_write, .shadow.x86_emulate_cmpxchg = sh_x86_emulate_cmpxchg, +#ifdef __i386__ .shadow.x86_emulate_cmpxchg8b = sh_x86_emulate_cmpxchg8b, +#endif .shadow.make_monitor_table = sh_make_monitor_table, .shadow.destroy_monitor_table = sh_destroy_monitor_table, #if SHADOW_OPTIMIZATIONS & SHOPT_WRITABLE_HEURISTIC diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/setup.c Thu Apr 24 14:08:29 2008 -0600 @@ -1019,10 +1019,6 @@ void __init __start_xen(unsigned long mb _initrd_len = mod[initrdidx].mod_end - mod[initrdidx].mod_start; } - iommu_setup(); - - amd_iommu_detect(); - /* * We're going to setup domain0 using the module(s) that we stashed safely * above our heap. The second module, if present, is an initrd ramdisk. diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/smp.c --- a/xen/arch/x86/smp.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/smp.c Thu Apr 24 14:08:29 2008 -0600 @@ -75,20 +75,10 @@ static inline int __prepare_ICR2 (unsign return SET_APIC_DEST_FIELD(mask); } -static inline void check_IPI_mask(cpumask_t cpumask) -{ - /* - * Sanity, and necessary. An IPI with no target generates a send accept - * error with Pentium and P6 APICs. - */ - ASSERT(cpus_subset(cpumask, cpu_online_map)); - ASSERT(!cpus_empty(cpumask)); -} - void apic_wait_icr_idle(void) { - while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ) - cpu_relax(); + while ( apic_read( APIC_ICR ) & APIC_ICR_BUSY ) + cpu_relax(); } void send_IPI_mask_flat(cpumask_t cpumask, int vector) @@ -97,7 +87,8 @@ void send_IPI_mask_flat(cpumask_t cpumas unsigned long cfg; unsigned long flags; - check_IPI_mask(cpumask); + /* An IPI with no target generates a send accept error from P5/P6 APICs. */ + WARN_ON(mask == 0); local_irq_save(flags); @@ -130,17 +121,9 @@ void send_IPI_mask_phys(cpumask_t mask, unsigned long cfg, flags; unsigned int query_cpu; - check_IPI_mask(mask); - - /* - * Hack. The clustered APIC addressing mode doesn't allow us to send - * to an arbitrary mask, so I do a unicasts to each CPU instead. This - * should be modified to do 1 message per cluster ID - mbligh - */ - local_irq_save(flags); - for_each_cpu_mask( query_cpu, mask ) + for_each_cpu_mask ( query_cpu, mask ) { /* * Wait for idle. diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/traps.c --- a/xen/arch/x86/traps.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/traps.c Thu Apr 24 14:08:29 2008 -0600 @@ -479,6 +479,7 @@ static inline void do_trap( static inline void do_trap( int trapnr, struct cpu_user_regs *regs, int use_error_code) { + struct vcpu *curr = current; unsigned long fixup; DEBUGGER_trap_entry(trapnr, regs); @@ -494,6 +495,14 @@ static inline void do_trap( dprintk(XENLOG_ERR, "Trap %d: %p -> %p\n", trapnr, _p(regs->eip), _p(fixup)); regs->eip = fixup; + return; + } + + if ( ((trapnr == TRAP_copro_error) || (trapnr == TRAP_simd_error)) && + is_hvm_vcpu(curr) && curr->arch.hvm_vcpu.fpu_exception_callback ) + { + curr->arch.hvm_vcpu.fpu_exception_callback( + curr->arch.hvm_vcpu.fpu_exception_callback_arg, regs); return; } @@ -1399,6 +1408,13 @@ static int admin_io_okay( unsigned int port, unsigned int bytes, struct vcpu *v, struct cpu_user_regs *regs) { + /* + * Port 0xcf8 (CONFIG_ADDRESS) is only visible for DWORD accesses. + * We never permit direct access to that register. + */ + if ( (port == 0xcf8) && (bytes == 4) ) + return 0; + return ioports_access_permitted(v->domain, port, port + bytes - 1); } @@ -1431,10 +1447,10 @@ static uint32_t guest_io_read( { sub_data = pv_pit_handler(port, 0, 0); } - else if ( (port & 0xfffc) == 0xcf8 ) - { - size = min(bytes, 4 - (port & 3)); - sub_data = v->domain->arch.pci_cf8 >> ((port & 3) * 8); + else if ( (port == 0xcf8) && (bytes == 4) ) + { + size = 4; + sub_data = v->domain->arch.pci_cf8; } else if ( ((port & 0xfffc) == 0xcfc) && IS_PRIV(v->domain) ) { @@ -1489,19 +1505,10 @@ static void guest_io_write( { pv_pit_handler(port, (uint8_t)data, 1); } - else if ( (port & 0xfffc) == 0xcf8 ) - { - size = min(bytes, 4 - (port & 3)); - if ( size == 4 ) - { - v->domain->arch.pci_cf8 = data; - } - else - { - uint32_t mask = ((1u << (size * 8)) - 1) << ((port & 3) * 8); - v->domain->arch.pci_cf8 &= ~mask; - v->domain->arch.pci_cf8 |= (data << ((port & 3) * 8)) & mask; - } + else if ( (port == 0xcf8) && (bytes == 4) ) + { + size = 4; + v->domain->arch.pci_cf8 = data; } else if ( ((port & 0xfffc) == 0xcfc) && IS_PRIV(v->domain) ) { diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/x86_emulate.c --- a/xen/arch/x86/x86_emulate.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/x86_emulate.c Thu Apr 24 14:08:29 2008 -0600 @@ -11,23 +11,7 @@ #include +/* Avoid namespace pollution. */ #undef cmpxchg -#define __emulate_fpu_insn(_op) \ -do{ int _exn; \ - asm volatile ( \ - "1: " _op "\n" \ - "2: \n" \ - ".section .fixup,\"ax\"\n" \ - "3: mov $1,%0\n" \ - " jmp 2b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " "__FIXUP_ALIGN"\n" \ - " "__FIXUP_WORD" 1b,3b\n" \ - ".previous" \ - : "=r" (_exn) : "0" (0) ); \ - generate_exception_if(_exn, EXC_MF, -1); \ -} while (0) - #include "x86_emulate/x86_emulate.c" diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/x86_emulate/x86_emulate.c --- a/xen/arch/x86/x86_emulate/x86_emulate.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/x86_emulate/x86_emulate.c Thu Apr 24 14:08:29 2008 -0600 @@ -195,9 +195,9 @@ static uint8_t twobyte_table[256] = { /* 0x50 - 0x5F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x6F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps|ModRM, /* 0x70 - 0x7F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps|ModRM, /* 0x80 - 0x87 */ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, @@ -546,6 +546,62 @@ do { ? (uint16_t)_regs.eip : (uint32_t)_regs.eip); \ } while (0) +struct fpu_insn_ctxt { + uint8_t insn_bytes; + uint8_t exn_raised; +}; + +static void fpu_handle_exception(void *_fic, struct cpu_user_regs *regs) +{ + struct fpu_insn_ctxt *fic = _fic; + fic->exn_raised = 1; + regs->eip += fic->insn_bytes; +} + +#define get_fpu(_type, _fic) \ +do{ (_fic)->exn_raised = 0; \ + fail_if(ops->get_fpu == NULL); \ + rc = ops->get_fpu(fpu_handle_exception, _fic, _type, ctxt); \ + if ( rc ) goto done; \ +} while (0) +#define put_fpu(_fic) \ +do{ \ + if ( ops->put_fpu != NULL ) \ + ops->put_fpu(ctxt); \ + generate_exception_if((_fic)->exn_raised, EXC_MF, -1); \ +} while (0) + +#define emulate_fpu_insn(_op) \ +do{ struct fpu_insn_ctxt fic; \ + get_fpu(X86EMUL_FPU_fpu, &fic); \ + asm volatile ( \ + "movb $2f-1f,%0 \n" \ + "1: " _op " \n" \ + "2: \n" \ + : "=m" (fic.insn_bytes) : : "memory" ); \ + put_fpu(&fic); \ +} while (0) + +#define emulate_fpu_insn_memdst(_op, _arg) \ +do{ struct fpu_insn_ctxt fic; \ + get_fpu(X86EMUL_FPU_fpu, &fic); \ + asm volatile ( \ + "movb $2f-1f,%0 \n" \ + "1: " _op " %1 \n" \ + "2: \n" \ + : "=m" (fic.insn_bytes), "=m" (_arg) \ + : : "memory" ); \ + put_fpu(&fic); \ +} while (0) + +#define emulate_fpu_insn_stub(_bytes...) \ +do{ uint8_t stub[] = { _bytes, 0xc3 }; \ + struct fpu_insn_ctxt fic = { .insn_bytes = sizeof(stub)-1 }; \ + get_fpu(X86EMUL_FPU_fpu, &fic); \ + (*(void(*)(void))stub)(); \ + put_fpu(&fic); \ +} while (0) + static unsigned long __get_rep_prefix( struct cpu_user_regs *int_regs, struct cpu_user_regs *ext_regs, @@ -851,6 +907,7 @@ protmode_load_seg( struct { uint32_t a, b; } desc; unsigned long val; uint8_t dpl, rpl, cpl; + uint32_t new_desc_b; int rc, fault_type = EXC_TS; /* NULL selector? */ @@ -933,10 +990,11 @@ protmode_load_seg( } /* Ensure Accessed flag is set. */ + new_desc_b = desc.b | 0x100; rc = ((desc.b & 0x100) ? X86EMUL_OKAY : ops->cmpxchg( - x86_seg_none, desctab.base + (sel & 0xfff8) + 4, desc.b, - desc.b | 0x100, 4, ctxt)); + x86_seg_none, desctab.base + (sel & 0xfff8) + 4, + &desc.b, &new_desc_b, 4, ctxt)); } while ( rc == X86EMUL_CMPXCHG_FAILED ); if ( rc ) @@ -2036,8 +2094,8 @@ x86_emulate( /* nothing to do */; else if ( lock_prefix ) rc = ops->cmpxchg( - dst.mem.seg, dst.mem.off, dst.orig_val, - dst.val, dst.bytes, ctxt); + dst.mem.seg, dst.mem.off, &dst.orig_val, + &dst.val, dst.bytes, ctxt); else rc = ops->write( dst.mem.seg, dst.mem.off, dst.val, dst.bytes, ctxt); @@ -2399,9 +2457,7 @@ x86_emulate( } case 0x9b: /* wait/fwait */ - fail_if(ops->load_fpu_ctxt == NULL); - ops->load_fpu_ctxt(ctxt); - __emulate_fpu_insn("fwait"); + emulate_fpu_insn("fwait"); break; case 0x9c: /* pushf */ @@ -2721,77 +2777,89 @@ x86_emulate( } case 0xd9: /* FPU 0xd9 */ - fail_if(ops->load_fpu_ctxt == NULL); - ops->load_fpu_ctxt(ctxt); switch ( modrm ) { - case 0xc0: __emulate_fpu_insn(".byte 0xd9,0xc0"); break; - case 0xc1: __emulate_fpu_insn(".byte 0xd9,0xc1"); break; - case 0xc2: __emulate_fpu_insn(".byte 0xd9,0xc2"); break; - case 0xc3: __emulate_fpu_insn(".byte 0xd9,0xc3"); break; - case 0xc4: __emulate_fpu_insn(".byte 0xd9,0xc4"); break; - case 0xc5: __emulate_fpu_insn(".byte 0xd9,0xc5"); break; - case 0xc6: __emulate_fpu_insn(".byte 0xd9,0xc6"); break; - case 0xc7: __emulate_fpu_insn(".byte 0xd9,0xc7"); break; - case 0xe0: __emulate_fpu_insn(".byte 0xd9,0xe0"); break; - case 0xe8: __emulate_fpu_insn(".byte 0xd9,0xe8"); break; - case 0xee: __emulate_fpu_insn(".byte 0xd9,0xee"); break; + case 0xc0 ... 0xc7: /* fld %stN */ + case 0xc8 ... 0xcf: /* fxch %stN */ + case 0xd0: /* fnop */ + case 0xe0: /* fchs */ + case 0xe1: /* fabs */ + case 0xe4: /* ftst */ + case 0xe5: /* fxam */ + case 0xe8: /* fld1 */ + case 0xe9: /* fldl2t */ + case 0xea: /* fldl2e */ + case 0xeb: /* fldpi */ + case 0xec: /* fldlg2 */ + case 0xed: /* fldln2 */ + case 0xee: /* fldz */ + case 0xf0: /* f2xm1 */ + case 0xf1: /* fyl2x */ + case 0xf2: /* fptan */ + case 0xf3: /* fpatan */ + case 0xf4: /* fxtract */ + case 0xf5: /* fprem1 */ + case 0xf6: /* fdecstp */ + case 0xf7: /* fincstp */ + case 0xf8: /* fprem */ + case 0xf9: /* fyl2xp1 */ + case 0xfa: /* fsqrt */ + case 0xfb: /* fsincos */ + case 0xfc: /* frndint */ + case 0xfd: /* fscale */ + case 0xfe: /* fsin */ + case 0xff: /* fcos */ + emulate_fpu_insn_stub(0xd9, modrm); + break; default: fail_if((modrm_reg & 7) != 7); fail_if(modrm >= 0xc0); /* fnstcw m2byte */ ea.bytes = 2; dst = ea; - asm volatile ( "fnstcw %0" : "=m" (dst.val) ); + emulate_fpu_insn_memdst("fnstcw", dst.val); } break; case 0xdb: /* FPU 0xdb */ - fail_if(ops->load_fpu_ctxt == NULL); - ops->load_fpu_ctxt(ctxt); fail_if(modrm != 0xe3); /* fninit */ - asm volatile ( "fninit" ); + emulate_fpu_insn("fninit"); break; case 0xdd: /* FPU 0xdd */ - fail_if(ops->load_fpu_ctxt == NULL); - ops->load_fpu_ctxt(ctxt); fail_if((modrm_reg & 7) != 7); fail_if(modrm >= 0xc0); /* fnstsw m2byte */ ea.bytes = 2; dst = ea; - asm volatile ( "fnstsw %0" : "=m" (dst.val) ); + emulate_fpu_insn_memdst("fnstsw", dst.val); break; case 0xde: /* FPU 0xde */ - fail_if(ops->load_fpu_ctxt == NULL); - ops->load_fpu_ctxt(ctxt); switch ( modrm ) { - case 0xd9: __emulate_fpu_insn(".byte 0xde,0xd9"); break; - case 0xf8: __emulate_fpu_insn(".byte 0xde,0xf8"); break; - case 0xf9: __emulate_fpu_insn(".byte 0xde,0xf9"); break; - case 0xfa: __emulate_fpu_insn(".byte 0xde,0xfa"); break; - case 0xfb: __emulate_fpu_insn(".byte 0xde,0xfb"); break; - case 0xfc: __emulate_fpu_insn(".byte 0xde,0xfc"); break; - case 0xfd: __emulate_fpu_insn(".byte 0xde,0xfd"); break; - case 0xfe: __emulate_fpu_insn(".byte 0xde,0xfe"); break; - case 0xff: __emulate_fpu_insn(".byte 0xde,0xff"); break; - default: goto cannot_emulate; + case 0xc0 ... 0xc7: /* faddp %stN */ + case 0xc8 ... 0xcf: /* fmulp %stN */ + case 0xd9: /* fcompp */ + case 0xe0 ... 0xe7: /* fsubrp %stN */ + case 0xe8 ... 0xef: /* fsubp %stN */ + case 0xf0 ... 0xf7: /* fdivrp %stN */ + case 0xf8 ... 0xff: /* fdivp %stN */ + emulate_fpu_insn_stub(0xde, modrm); + break; + default: + goto cannot_emulate; } break; case 0xdf: /* FPU 0xdf */ - fail_if(ops->load_fpu_ctxt == NULL); - ops->load_fpu_ctxt(ctxt); fail_if(modrm != 0xe0); /* fnstsw %ax */ dst.bytes = 2; dst.type = OP_REG; dst.reg = (unsigned long *)&_regs.eax; - asm volatile ( "fnstsw %0" : "=m" (dst.val) ); + emulate_fpu_insn_memdst("fnstsw", dst.val); break; case 0xe0 ... 0xe2: /* loop{,z,nz} */ { @@ -2975,6 +3043,7 @@ x86_emulate( case 0xa3: bt: /* bt */ emulate_2op_SrcV_nobyte("bt", src, dst, _regs.eflags); + dst.type = OP_NONE; break; case 0xa4: /* shld imm8,r,r/m */ @@ -3067,7 +3136,11 @@ x86_emulate( : "=r" (dst.val), "=q" (zf) : "r" (src.val), "1" (0) ); _regs.eflags &= ~EFLG_ZF; - _regs.eflags |= zf ? EFLG_ZF : 0; + if ( zf ) + { + _regs.eflags |= EFLG_ZF; + dst.type = OP_NONE; + } break; } @@ -3077,7 +3150,11 @@ x86_emulate( : "=r" (dst.val), "=q" (zf) : "r" (src.val), "1" (0) ); _regs.eflags &= ~EFLG_ZF; - _regs.eflags |= zf ? EFLG_ZF : 0; + if ( zf ) + { + _regs.eflags |= EFLG_ZF; + dst.type = OP_NONE; + } break; } @@ -3310,6 +3387,44 @@ x86_emulate( break; } + case 0x6f: /* movq mm/m64,mm */ { + uint8_t stub[] = { 0x0f, 0x6f, modrm, 0xc3 }; + struct fpu_insn_ctxt fic = { .insn_bytes = sizeof(stub)-1 }; + uint64_t val; + if ( ea.type == OP_MEM ) + { + unsigned long lval, hval; + if ( (rc = ops->read(ea.mem.seg, ea.mem.off+0, &lval, 4, ctxt)) || + (rc = ops->read(ea.mem.seg, ea.mem.off+4, &hval, 4, ctxt)) ) + goto done; + val = ((uint64_t)hval << 32) | (uint32_t)lval; + stub[2] = modrm & 0x38; /* movq (%eax),%mmN */ + } + get_fpu(X86EMUL_FPU_mmx, &fic); + asm volatile ( "call *%0" : : "r" (stub), "a" (&val) : "memory" ); + put_fpu(&fic); + break; + } + + case 0x7f: /* movq mm,mm/m64 */ { + uint8_t stub[] = { 0x0f, 0x7f, modrm, 0xc3 }; + struct fpu_insn_ctxt fic = { .insn_bytes = sizeof(stub)-1 }; + uint64_t val; + if ( ea.type == OP_MEM ) + stub[2] = modrm & 0x38; /* movq %mmN,(%eax) */ + get_fpu(X86EMUL_FPU_mmx, &fic); + asm volatile ( "call *%0" : : "r" (stub), "a" (&val) : "memory" ); + put_fpu(&fic); + if ( ea.type == OP_MEM ) + { + unsigned long lval = (uint32_t)val, hval = (uint32_t)(val >> 32); + if ( (rc = ops->write(ea.mem.seg, ea.mem.off+0, lval, 4, ctxt)) || + (rc = ops->write(ea.mem.seg, ea.mem.off+4, hval, 4, ctxt)) ) + goto done; + } + break; + } + case 0x80 ... 0x8f: /* jcc (near) */ { int rel = (((op_bytes == 2) && !mode_64bit()) ? (int32_t)insn_fetch_type(int16_t) @@ -3346,60 +3461,49 @@ x86_emulate( src.val = x86_seg_gs; goto pop_seg; - case 0xc7: /* Grp9 (cmpxchg8b) */ -#if defined(__i386__) - { - unsigned long old_lo, old_hi; + case 0xc7: /* Grp9 (cmpxchg8b/cmpxchg16b) */ { + unsigned long old[2], exp[2], new[2]; + unsigned int i; + generate_exception_if((modrm_reg & 7) != 1, EXC_UD, -1); generate_exception_if(ea.type != OP_MEM, EXC_UD, -1); - if ( (rc = ops->read(ea.mem.seg, ea.mem.off+0, &old_lo, 4, ctxt)) || - (rc = ops->read(ea.mem.seg, ea.mem.off+4, &old_hi, 4, ctxt)) ) - goto done; - if ( (old_lo != _regs.eax) || (old_hi != _regs.edx) ) - { - _regs.eax = old_lo; - _regs.edx = old_hi; + op_bytes *= 2; + + /* Get actual old value. */ + for ( i = 0; i < (op_bytes/sizeof(long)); i++ ) + if ( (rc = ops->read(ea.mem.seg, ea.mem.off + i*sizeof(long), + &old[i], sizeof(long), ctxt)) != 0 ) + goto done; + + /* Get expected and proposed values. */ + if ( op_bytes == 8 ) + { + ((uint32_t *)exp)[0] = _regs.eax; ((uint32_t *)exp)[1] = _regs.edx; + ((uint32_t *)new)[0] = _regs.ebx; ((uint32_t *)new)[1] = _regs.ecx; + } + else + { + exp[0] = _regs.eax; exp[1] = _regs.edx; + new[0] = _regs.ebx; new[1] = _regs.ecx; + } + + if ( memcmp(old, exp, op_bytes) ) + { + /* Expected != actual: store actual to rDX:rAX and clear ZF. */ + _regs.eax = (op_bytes == 8) ? ((uint32_t *)old)[0] : old[0]; + _regs.edx = (op_bytes == 8) ? ((uint32_t *)old)[1] : old[1]; _regs.eflags &= ~EFLG_ZF; } - else if ( ops->cmpxchg8b == NULL ) - { - rc = X86EMUL_UNHANDLEABLE; - goto done; - } else { - if ( (rc = ops->cmpxchg8b(ea.mem.seg, ea.mem.off, old_lo, old_hi, - _regs.ebx, _regs.ecx, ctxt)) != 0 ) + /* Expected == actual: attempt atomic cmpxchg and set ZF. */ + if ( (rc = ops->cmpxchg(ea.mem.seg, ea.mem.off, old, + new, op_bytes, ctxt)) != 0 ) goto done; _regs.eflags |= EFLG_ZF; } break; } -#elif defined(__x86_64__) - { - unsigned long old, new; - generate_exception_if((modrm_reg & 7) != 1, EXC_UD, -1); - generate_exception_if(ea.type != OP_MEM, EXC_UD, -1); - if ( (rc = ops->read(ea.mem.seg, ea.mem.off, &old, 8, ctxt)) != 0 ) - goto done; - if ( ((uint32_t)(old>>0) != (uint32_t)_regs.eax) || - ((uint32_t)(old>>32) != (uint32_t)_regs.edx) ) - { - _regs.eax = (uint32_t)(old>>0); - _regs.edx = (uint32_t)(old>>32); - _regs.eflags &= ~EFLG_ZF; - } - else - { - new = (_regs.ecx<<32)|(uint32_t)_regs.ebx; - if ( (rc = ops->cmpxchg(ea.mem.seg, ea.mem.off, old, - new, 8, ctxt)) != 0 ) - goto done; - _regs.eflags |= EFLG_ZF; - } - break; - } -#endif case 0xc8 ... 0xcf: /* bswap */ dst.type = OP_REG; diff -r 239b44eeb2d6 -r dc510776dd59 xen/arch/x86/x86_emulate/x86_emulate.h --- a/xen/arch/x86/x86_emulate/x86_emulate.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/arch/x86/x86_emulate/x86_emulate.h Thu Apr 24 14:08:29 2008 -0600 @@ -95,6 +95,12 @@ struct segment_register { /* (cmpxchg accessor): CMPXCHG failed. Maps to X86EMUL_RETRY in caller. */ #define X86EMUL_CMPXCHG_FAILED 3 +/* FPU sub-types which may be requested via ->get_fpu(). */ +enum x86_emulate_fpu_type { + X86EMUL_FPU_fpu, /* Standard FPU coprocessor instruction set */ + X86EMUL_FPU_mmx /* MMX instruction set (%mm0-%mm7) */ +}; + /* * These operations represent the instruction emulator's interface to memory. * @@ -104,8 +110,7 @@ struct segment_register { * some out-of-band mechanism, unknown to the emulator. The memop signals * failure by returning X86EMUL_EXCEPTION to the emulator, which will * then immediately bail. - * 2. Valid access sizes are 1, 2, 4 and 8 bytes. On x86/32 systems only - * cmpxchg8b_emulated need support 8-byte accesses. + * 2. Valid access sizes are 1, 2, 4 and 8 (x86/64 only) bytes. * 3. The emulator cannot handle 64-bit mode emulation on an x86/32 system. */ struct x86_emulate_ops @@ -153,34 +158,16 @@ struct x86_emulate_ops /* * cmpxchg: Emulate an atomic (LOCKed) CMPXCHG operation. - * @old: [IN ] Value expected to be current at @addr. - * @new: [IN ] Value to write to @addr. + * @p_old: [IN ] Pointer to value expected to be current at @addr. + * @p_new: [IN ] Pointer to value to write to @addr. + * @bytes: [IN ] Operation size (up to 8 (x86/32) or 16 (x86/64) bytes). */ int (*cmpxchg)( enum x86_segment seg, unsigned long offset, - unsigned long old, - unsigned long new, - unsigned int bytes, - struct x86_emulate_ctxt *ctxt); - - /* - * cmpxchg8b: Emulate an atomic (LOCKed) CMPXCHG8B operation. - * @old: [IN ] Value expected to be current at @addr. - * @new: [IN ] Value to write to @addr. - * NOTES: - * 1. This function is only ever called when emulating a real CMPXCHG8B. - * 2. This function is *never* called on x86/64 systems. - * 2. Not defining this function (i.e., specifying NULL) is equivalent - * to defining a function that always returns X86EMUL_UNHANDLEABLE. - */ - int (*cmpxchg8b)( - enum x86_segment seg, - unsigned long offset, - unsigned long old_lo, - unsigned long old_hi, - unsigned long new_lo, - unsigned long new_hi, + void *p_old, + void *p_new, + unsigned int bytes, struct x86_emulate_ctxt *ctxt); /* @@ -342,8 +329,19 @@ struct x86_emulate_ops uint8_t insn_len, struct x86_emulate_ctxt *ctxt); - /* load_fpu_ctxt: Load emulated environment's FPU state onto processor. */ - void (*load_fpu_ctxt)( + /* + * get_fpu: Load emulated environment's FPU state onto processor. + * @exn_callback: On any FPU or SIMD exception, pass control to + * (*exception_callback)(exception_callback_arg, regs). + */ + int (*get_fpu)( + void (*exception_callback)(void *, struct cpu_user_regs *), + void *exception_callback_arg, + enum x86_emulate_fpu_type type, + struct x86_emulate_ctxt *ctxt); + + /* put_fpu: Relinquish the FPU. Unhook from FPU/SIMD exception handlers. */ + void (*put_fpu)( struct x86_emulate_ctxt *ctxt); /* invlpg: Invalidate paging structures which map addressed byte. */ diff -r 239b44eeb2d6 -r dc510776dd59 xen/common/trace.c --- a/xen/common/trace.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/common/trace.c Thu Apr 24 14:08:29 2008 -0600 @@ -374,6 +374,15 @@ static inline int insert_lost_records(st (unsigned char *)&ed); } +/* + * Notification is performed in qtasklet to avoid deadlocks with contexts + * which __trace_var() may be called from (e.g., scheduler critical regions). + */ +static void trace_notify_dom0(unsigned long unused) +{ + send_guest_global_virq(dom0, VIRQ_TBUF); +} +static DECLARE_TASKLET(trace_notify_dom0_tasklet, trace_notify_dom0, 0); /** * trace - Enters a trace tuple into the trace buffer for the current CPU. @@ -506,7 +515,7 @@ void __trace_var(u32 event, int cycles, /* Notify trace buffer consumer that we've crossed the high water mark. */ if ( started_below_highwater && (calc_unconsumed_bytes(buf) >= t_buf_highwater) ) - send_guest_global_virq(dom0, VIRQ_TBUF); + tasklet_schedule(&trace_notify_dom0_tasklet); } /* diff -r 239b44eeb2d6 -r dc510776dd59 xen/common/xencomm.c --- a/xen/common/xencomm.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/common/xencomm.c Thu Apr 24 14:08:29 2008 -0600 @@ -323,7 +323,7 @@ xencomm_copy_chunk_to( (unsigned long)xencomm_vaddr(paddr, page)); memcpy(xencomm_vaddr(paddr, page), (void *)from, len); - xencomm_mark_dirty(xencomm_vaddr(paddr, page), len); + xencomm_mark_dirty((unsigned long)xencomm_vaddr(paddr, page), len); put_page(page); return 0; diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/char/console.c --- a/xen/drivers/char/console.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/char/console.c Thu Apr 24 14:08:29 2008 -0600 @@ -322,7 +322,7 @@ static long guest_console_write(XEN_GUES while ( count > 0 ) { - while ( serial_tx_space(sercon_handle) < (SERIAL_TXBUFSZ / 2) ) + while ( serial_tx_space(sercon_handle) < (serial_txbufsz / 2) ) { if ( hypercall_preempt_check() ) break; diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/char/serial.c --- a/xen/drivers/char/serial.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/char/serial.c Thu Apr 24 14:08:29 2008 -0600 @@ -15,6 +15,19 @@ #include #include +/* Never drop characters, even if the async transmit buffer fills. */ +/* #define SERIAL_NEVER_DROP_CHARS 1 */ + +unsigned int serial_txbufsz = 16384; +static void __init parse_serial_tx_buffer(const char *s) +{ + serial_txbufsz = max((unsigned int)parse_size_and_unit(s, NULL), 512u); +} +custom_param("serial_tx_buffer", parse_serial_tx_buffer); + +#define mask_serial_rxbuf_idx(_i) ((_i)&(serial_rxbufsz-1)) +#define mask_serial_txbuf_idx(_i) ((_i)&(serial_txbufsz-1)) + static struct serial_port com[2] = { { .rx_lock = SPIN_LOCK_UNLOCKED, .tx_lock = SPIN_LOCK_UNLOCKED }, { .rx_lock = SPIN_LOCK_UNLOCKED, .tx_lock = SPIN_LOCK_UNLOCKED } @@ -36,8 +49,8 @@ void serial_rx_interrupt(struct serial_p fn = port->rx_hi; else if ( !(c & 0x80) && (port->rx_lo != NULL) ) fn = port->rx_lo; - else if ( (port->rxbufp - port->rxbufc) != SERIAL_RXBUFSZ ) - port->rxbuf[MASK_SERIAL_RXBUF_IDX(port->rxbufp++)] = c; + else if ( (port->rxbufp - port->rxbufc) != serial_rxbufsz ) + port->rxbuf[mask_serial_rxbuf_idx(port->rxbufp++)] = c; } spin_unlock_irqrestore(&port->rx_lock, flags); @@ -72,7 +85,7 @@ void serial_tx_interrupt(struct serial_p if ( port->txbufc == port->txbufp ) break; port->driver->putc( - port, port->txbuf[MASK_SERIAL_TXBUF_IDX(port->txbufc++)]); + port, port->txbuf[mask_serial_txbuf_idx(port->txbufc++)]); } } @@ -81,22 +94,24 @@ void serial_tx_interrupt(struct serial_p static void __serial_putc(struct serial_port *port, char c) { - int i; - if ( (port->txbuf != NULL) && !port->sync ) { /* Interrupt-driven (asynchronous) transmitter. */ - if ( (port->txbufp - port->txbufc) == SERIAL_TXBUFSZ ) - { - /* Buffer is full: we spin, but could alternatively drop chars. */ +#ifdef SERIAL_NEVER_DROP_CHARS + if ( (port->txbufp - port->txbufc) == serial_txbufsz ) + { + /* Buffer is full: we spin waiting for space to appear. */ + int i; while ( !port->driver->tx_empty(port) ) cpu_relax(); for ( i = 0; i < port->tx_fifo_size; i++ ) port->driver->putc( - port, port->txbuf[MASK_SERIAL_TXBUF_IDX(port->txbufc++)]); - port->txbuf[MASK_SERIAL_TXBUF_IDX(port->txbufp++)] = c; - } - else if ( ((port->txbufp - port->txbufc) == 0) && + port, port->txbuf[mask_serial_txbuf_idx(port->txbufc++)]); + port->txbuf[mask_serial_txbuf_idx(port->txbufp++)] = c; + return; + } +#endif + if ( ((port->txbufp - port->txbufc) == 0) && port->driver->tx_empty(port) ) { /* Buffer and UART FIFO are both empty. */ @@ -105,7 +120,7 @@ static void __serial_putc(struct serial_ else { /* Normal case: buffer the character. */ - port->txbuf[MASK_SERIAL_TXBUF_IDX(port->txbufp++)] = c; + port->txbuf[mask_serial_txbuf_idx(port->txbufp++)] = c; } } else if ( port->driver->tx_empty ) @@ -200,7 +215,7 @@ char serial_getc(int handle) if ( port->rxbufp != port->rxbufc ) { - c = port->rxbuf[MASK_SERIAL_RXBUF_IDX(port->rxbufc++)]; + c = port->rxbuf[mask_serial_rxbuf_idx(port->rxbufc++)]; spin_unlock_irqrestore(&port->rx_lock, flags); break; } @@ -336,7 +351,7 @@ void serial_start_sync(int handle) while ( !port->driver->tx_empty(port) ) cpu_relax(); port->driver->putc( - port, port->txbuf[MASK_SERIAL_TXBUF_IDX(port->txbufc++)]); + port, port->txbuf[mask_serial_txbuf_idx(port->txbufc++)]); } } @@ -364,9 +379,9 @@ int serial_tx_space(int handle) { struct serial_port *port; if ( handle == -1 ) - return SERIAL_TXBUFSZ; - port = &com[handle & SERHND_IDX]; - return SERIAL_TXBUFSZ - (port->txbufp - port->txbufc); + return serial_txbufsz; + port = &com[handle & SERHND_IDX]; + return serial_txbufsz - (port->txbufp - port->txbufc); } void __devinit serial_init_preirq(void) @@ -431,7 +446,7 @@ void serial_async_transmit(struct serial BUG_ON(!port->driver->tx_empty); if ( port->txbuf == NULL ) port->txbuf = alloc_xenheap_pages( - get_order_from_bytes(SERIAL_TXBUFSZ)); + get_order_from_bytes(serial_txbufsz)); } /* diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/amd/iommu_acpi.c --- a/xen/drivers/passthrough/amd/iommu_acpi.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/amd/iommu_acpi.c Thu Apr 24 14:08:29 2008 -0600 @@ -139,7 +139,7 @@ static int __init register_exclusion_ran iommu = find_iommu_for_device(bus, devfn); if ( !iommu ) { - dprintk(XENLOG_ERR, "IVMD Error: No IOMMU for Dev_Id 0x%x!\n", bdf); + amd_iov_error("IVMD Error: No IOMMU for Dev_Id 0x%x!\n", bdf); return -ENODEV; } req = ivrs_mappings[bdf].dte_requestor_id; @@ -221,7 +221,7 @@ static int __init parse_ivmd_device_sele bdf = ivmd_block->header.dev_id; if ( bdf >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVMD Error: Invalid Dev_Id 0x%x\n", bdf); + amd_iov_error("IVMD Error: Invalid Dev_Id 0x%x\n", bdf); return -ENODEV; } @@ -238,21 +238,18 @@ static int __init parse_ivmd_device_rang first_bdf = ivmd_block->header.dev_id; if ( first_bdf >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVMD Error: " - "Invalid Range_First Dev_Id 0x%x\n", first_bdf); + amd_iov_error( + "IVMD Error: Invalid Range_First Dev_Id 0x%x\n", first_bdf); return -ENODEV; } last_bdf = ivmd_block->last_dev_id; if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) ) { - dprintk(XENLOG_ERR, "IVMD Error: " - "Invalid Range_Last Dev_Id 0x%x\n", last_bdf); - return -ENODEV; - } - - dprintk(XENLOG_ERR, " Dev_Id Range: 0x%x -> 0x%x\n", - first_bdf, last_bdf); + amd_iov_error( + "IVMD Error: Invalid Range_Last Dev_Id 0x%x\n", last_bdf); + return -ENODEV; + } for ( bdf = first_bdf, error = 0; (bdf <= last_bdf) && !error; bdf++ ) error = register_exclusion_range_for_device( @@ -272,8 +269,7 @@ static int __init parse_ivmd_device_iomm ivmd_block->cap_offset); if ( !iommu ) { - dprintk(XENLOG_ERR, - "IVMD Error: No IOMMU for Dev_Id 0x%x Cap 0x%x\n", + amd_iov_error("IVMD Error: No IOMMU for Dev_Id 0x%x Cap 0x%x\n", ivmd_block->header.dev_id, ivmd_block->cap_offset); return -ENODEV; } @@ -290,7 +286,7 @@ static int __init parse_ivmd_block(struc if ( ivmd_block->header.length < sizeof(struct acpi_ivmd_block_header) ) { - dprintk(XENLOG_ERR, "IVMD Error: Invalid Block Length!\n"); + amd_iov_error("IVMD Error: Invalid Block Length!\n"); return -ENODEV; } @@ -299,10 +295,9 @@ static int __init parse_ivmd_block(struc base = start_addr & PAGE_MASK; limit = (start_addr + mem_length - 1) & PAGE_MASK; - dprintk(XENLOG_INFO, "IVMD Block: Type 0x%x\n", - ivmd_block->header.type); - dprintk(XENLOG_INFO, " Start_Addr_Phys 0x%lx\n", start_addr); - dprintk(XENLOG_INFO, " Mem_Length 0x%lx\n", mem_length); + amd_iov_info("IVMD Block: Type 0x%x\n",ivmd_block->header.type); + amd_iov_info(" Start_Addr_Phys 0x%lx\n", start_addr); + amd_iov_info(" Mem_Length 0x%lx\n", mem_length); if ( get_field_from_byte(ivmd_block->header.flags, AMD_IOMMU_ACPI_EXCLUSION_RANGE_MASK, @@ -321,7 +316,7 @@ static int __init parse_ivmd_block(struc } else { - dprintk(KERN_ERR, "IVMD Error: Invalid Flag Field!\n"); + amd_iov_error("IVMD Error: Invalid Flag Field!\n"); return -ENODEV; } @@ -344,7 +339,7 @@ static int __init parse_ivmd_block(struc base, limit, iw, ir); default: - dprintk(XENLOG_ERR, "IVMD Error: Invalid Block Type!\n"); + amd_iov_error("IVMD Error: Invalid Block Type!\n"); return -ENODEV; } } @@ -354,7 +349,7 @@ static u16 __init parse_ivhd_device_padd { if ( header_length < (block_length + pad_length) ) { - dprintk(XENLOG_ERR, "IVHD Error: Invalid Device_Entry Length!\n"); + amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n"); return 0; } @@ -369,8 +364,7 @@ static u16 __init parse_ivhd_device_sele bdf = ivhd_device->header.dev_id; if ( bdf >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Device_Entry Dev_Id 0x%x\n", bdf); + amd_iov_error("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf); return 0; } @@ -393,14 +387,14 @@ static u16 __init parse_ivhd_device_rang dev_length = sizeof(struct acpi_ivhd_device_range); if ( header_length < (block_length + dev_length) ) { - dprintk(XENLOG_ERR, "IVHD Error: Invalid Device_Entry Length!\n"); + amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n"); return 0; } if ( ivhd_device->range.trailer.type != AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END ) { - dprintk(XENLOG_ERR, "IVHD Error: " + amd_iov_error("IVHD Error: " "Invalid Range: End_Type 0x%x\n", ivhd_device->range.trailer.type); return 0; @@ -409,21 +403,20 @@ static u16 __init parse_ivhd_device_rang first_bdf = ivhd_device->header.dev_id; if ( first_bdf >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Range: First Dev_Id 0x%x\n", first_bdf); + amd_iov_error( + "IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf); return 0; } last_bdf = ivhd_device->range.trailer.dev_id; if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Range: Last Dev_Id 0x%x\n", last_bdf); - return 0; - } - - dprintk(XENLOG_INFO, " Dev_Id Range: 0x%x -> 0x%x\n", - first_bdf, last_bdf); + amd_iov_error( + "IVHD Error: Invalid Range: Last Dev_Id 0x%x\n", last_bdf); + return 0; + } + + amd_iov_info(" Dev_Id Range: 0x%x -> 0x%x\n", first_bdf, last_bdf); /* override flags for range of devices */ sys_mgt = get_field_from_byte(ivhd_device->header.flags, @@ -444,28 +437,25 @@ static u16 __init parse_ivhd_device_alia dev_length = sizeof(struct acpi_ivhd_device_alias); if ( header_length < (block_length + dev_length) ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Device_Entry Length!\n"); + amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n"); return 0; } bdf = ivhd_device->header.dev_id; if ( bdf >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Device_Entry Dev_Id 0x%x\n", bdf); + amd_iov_error("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf); return 0; } alias_id = ivhd_device->alias.dev_id; if ( alias_id >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Alias Dev_Id 0x%x\n", alias_id); - return 0; - } - - dprintk(XENLOG_INFO, " Dev_Id Alias: 0x%x\n", alias_id); + amd_iov_error("IVHD Error: Invalid Alias Dev_Id 0x%x\n", alias_id); + return 0; + } + + amd_iov_info(" Dev_Id Alias: 0x%x\n", alias_id); /* override requestor_id and flags for device */ ivrs_mappings[bdf].dte_requestor_id = alias_id; @@ -490,15 +480,14 @@ static u16 __init parse_ivhd_device_alia dev_length = sizeof(struct acpi_ivhd_device_alias_range); if ( header_length < (block_length + dev_length) ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Device_Entry Length!\n"); + amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n"); return 0; } if ( ivhd_device->alias_range.trailer.type != AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END ) { - dprintk(XENLOG_ERR, "IVHD Error: " + amd_iov_error("IVHD Error: " "Invalid Range: End_Type 0x%x\n", ivhd_device->alias_range.trailer.type); return 0; @@ -507,30 +496,28 @@ static u16 __init parse_ivhd_device_alia first_bdf = ivhd_device->header.dev_id; if ( first_bdf >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR,"IVHD Error: " - "Invalid Range: First Dev_Id 0x%x\n", first_bdf); + amd_iov_error( + "IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf); return 0; } last_bdf = ivhd_device->alias_range.trailer.dev_id; if ( last_bdf >= ivrs_bdf_entries || last_bdf <= first_bdf ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Range: Last Dev_Id 0x%x\n", last_bdf); + amd_iov_error( + "IVHD Error: Invalid Range: Last Dev_Id 0x%x\n", last_bdf); return 0; } alias_id = ivhd_device->alias_range.alias.dev_id; if ( alias_id >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Alias Dev_Id 0x%x\n", alias_id); - return 0; - } - - dprintk(XENLOG_INFO, " Dev_Id Range: 0x%x -> 0x%x\n", - first_bdf, last_bdf); - dprintk(XENLOG_INFO, " Dev_Id Alias: 0x%x\n", alias_id); + amd_iov_error("IVHD Error: Invalid Alias Dev_Id 0x%x\n", alias_id); + return 0; + } + + amd_iov_info(" Dev_Id Range: 0x%x -> 0x%x\n", first_bdf, last_bdf); + amd_iov_info(" Dev_Id Alias: 0x%x\n", alias_id); /* override requestor_id and flags for range of devices */ sys_mgt = get_field_from_byte(ivhd_device->header.flags, @@ -555,16 +542,14 @@ static u16 __init parse_ivhd_device_exte dev_length = sizeof(struct acpi_ivhd_device_extended); if ( header_length < (block_length + dev_length) ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Device_Entry Length!\n"); + amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n"); return 0; } bdf = ivhd_device->header.dev_id; if ( bdf >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Device_Entry Dev_Id 0x%x\n", bdf); + amd_iov_error("IVHD Error: Invalid Device_Entry Dev_Id 0x%x\n", bdf); return 0; } @@ -587,15 +572,14 @@ static u16 __init parse_ivhd_device_exte dev_length = sizeof(struct acpi_ivhd_device_extended_range); if ( header_length < (block_length + dev_length) ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Device_Entry Length!\n"); + amd_iov_error("IVHD Error: Invalid Device_Entry Length!\n"); return 0; } if ( ivhd_device->extended_range.trailer.type != AMD_IOMMU_ACPI_IVHD_DEV_RANGE_END ) { - dprintk(XENLOG_ERR, "IVHD Error: " + amd_iov_error("IVHD Error: " "Invalid Range: End_Type 0x%x\n", ivhd_device->extended_range.trailer.type); return 0; @@ -604,20 +588,20 @@ static u16 __init parse_ivhd_device_exte first_bdf = ivhd_device->header.dev_id; if ( first_bdf >= ivrs_bdf_entries ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Range: First Dev_Id 0x%x\n", first_bdf); + amd_iov_error( + "IVHD Error: Invalid Range: First Dev_Id 0x%x\n", first_bdf); return 0; } last_bdf = ivhd_device->extended_range.trailer.dev_id; if ( (last_bdf >= ivrs_bdf_entries) || (last_bdf <= first_bdf) ) { - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Range: Last Dev_Id 0x%x\n", last_bdf); - return 0; - } - - dprintk(XENLOG_INFO, " Dev_Id Range: 0x%x -> 0x%x\n", + amd_iov_error( + "IVHD Error: Invalid Range: Last Dev_Id 0x%x\n", last_bdf); + return 0; + } + + amd_iov_info(" Dev_Id Range: 0x%x -> 0x%x\n", first_bdf, last_bdf); /* override flags for range of devices */ @@ -639,7 +623,7 @@ static int __init parse_ivhd_block(struc if ( ivhd_block->header.length < sizeof(struct acpi_ivhd_block_header) ) { - dprintk(XENLOG_ERR, "IVHD Error: Invalid Block Length!\n"); + amd_iov_error("IVHD Error: Invalid Block Length!\n"); return -ENODEV; } @@ -647,21 +631,16 @@ static int __init parse_ivhd_block(struc ivhd_block->cap_offset); if ( !iommu ) { - dprintk(XENLOG_ERR, - "IVHD Error: No IOMMU for Dev_Id 0x%x Cap 0x%x\n", + amd_iov_error("IVHD Error: No IOMMU for Dev_Id 0x%x Cap 0x%x\n", ivhd_block->header.dev_id, ivhd_block->cap_offset); return -ENODEV; } - dprintk(XENLOG_INFO, "IVHD Block:\n"); - dprintk(XENLOG_INFO, " Cap_Offset 0x%x\n", - ivhd_block->cap_offset); - dprintk(XENLOG_INFO, " MMIO_BAR_Phys 0x%lx\n", - (unsigned long)ivhd_block->mmio_base); - dprintk(XENLOG_INFO, " PCI_Segment 0x%x\n", - ivhd_block->pci_segment); - dprintk(XENLOG_INFO, " IOMMU_Info 0x%x\n", - ivhd_block->iommu_info); + amd_iov_info("IVHD Block:\n"); + amd_iov_info(" Cap_Offset 0x%x\n", ivhd_block->cap_offset); + amd_iov_info(" MMIO_BAR_Phys 0x%"PRIx64"\n",ivhd_block->mmio_base); + amd_iov_info( " PCI_Segment 0x%x\n", ivhd_block->pci_segment); + amd_iov_info( " IOMMU_Info 0x%x\n", ivhd_block->iommu_info); /* override IOMMU support flags */ iommu->coherent = get_field_from_byte(ivhd_block->header.flags, @@ -692,13 +671,10 @@ static int __init parse_ivhd_block(struc ivhd_device = (union acpi_ivhd_device *) ((u8 *)ivhd_block + block_length); - dprintk(XENLOG_INFO, "IVHD Device Entry:\n"); - dprintk(XENLOG_INFO, " Type 0x%x\n", - ivhd_device->header.type); - dprintk(XENLOG_INFO, " Dev_Id 0x%x\n", - ivhd_device->header.dev_id); - dprintk(XENLOG_INFO, " Flags 0x%x\n", - ivhd_device->header.flags); + amd_iov_info( "IVHD Device Entry:\n"); + amd_iov_info( " Type 0x%x\n", ivhd_device->header.type); + amd_iov_info( " Dev_Id 0x%x\n", ivhd_device->header.dev_id); + amd_iov_info( " Flags 0x%x\n", ivhd_device->header.flags); switch ( ivhd_device->header.type ) { @@ -741,8 +717,7 @@ static int __init parse_ivhd_block(struc ivhd_block->header.length, block_length); break; default: - dprintk(XENLOG_ERR, "IVHD Error: " - "Invalid Device Type!\n"); + amd_iov_error("IVHD Error: Invalid Device Type!\n"); dev_length = 0; break; } @@ -774,46 +749,49 @@ static int __init parse_ivrs_block(struc return parse_ivmd_block(ivmd_block); default: - dprintk(XENLOG_ERR, "IVRS Error: Invalid Block Type!\n"); + amd_iov_error("IVRS Error: Invalid Block Type!\n"); return -ENODEV; } return 0; } -void __init dump_acpi_table_header(struct acpi_table_header *table) -{ +static void __init dump_acpi_table_header(struct acpi_table_header *table) +{ +#ifdef AMD_IOV_DEBUG int i; - printk(XENLOG_INFO "AMD IOMMU: ACPI Table:\n"); - printk(XENLOG_INFO " Signature "); + amd_iov_info("ACPI Table:\n"); + amd_iov_info(" Signature "); for ( i = 0; i < ACPI_NAME_SIZE; i++ ) printk("%c", table->signature[i]); printk("\n"); - printk(" Length 0x%x\n", table->length); - printk(" Revision 0x%x\n", table->revision); - printk(" CheckSum 0x%x\n", table->checksum); - - printk(" OEM_Id "); + amd_iov_info(" Length 0x%x\n", table->length); + amd_iov_info(" Revision 0x%x\n", table->revision); + amd_iov_info(" CheckSum 0x%x\n", table->checksum); + + amd_iov_info(" OEM_Id "); for ( i = 0; i < ACPI_OEM_ID_SIZE; i++ ) printk("%c", table->oem_id[i]); printk("\n"); - printk(" OEM_Table_Id "); + amd_iov_info(" OEM_Table_Id "); for ( i = 0; i < ACPI_OEM_TABLE_ID_SIZE; i++ ) printk("%c", table->oem_table_id[i]); printk("\n"); - printk(" OEM_Revision 0x%x\n", table->oem_revision); - - printk(" Creator_Id "); + amd_iov_info(" OEM_Revision 0x%x\n", table->oem_revision); + + amd_iov_info(" Creator_Id "); for ( i = 0; i < ACPI_NAME_SIZE; i++ ) printk("%c", table->asl_compiler_id[i]); printk("\n"); - printk(" Creator_Revision 0x%x\n", + amd_iov_info(" Creator_Revision 0x%x\n", table->asl_compiler_revision); +#endif + } int __init parse_ivrs_table(unsigned long phys_addr, unsigned long size) @@ -827,9 +805,7 @@ int __init parse_ivrs_table(unsigned lon BUG_ON(!table); -#if 0 dump_acpi_table_header(table); -#endif /* validate checksum: sum of entire table == 0 */ checksum = 0; @@ -838,7 +814,7 @@ int __init parse_ivrs_table(unsigned lon checksum += raw_table[i]; if ( checksum ) { - dprintk(XENLOG_ERR, "IVRS Error: " + amd_iov_error("IVRS Error: " "Invalid Checksum 0x%x\n", checksum); return -ENODEV; } @@ -850,15 +826,15 @@ int __init parse_ivrs_table(unsigned lon ivrs_block = (struct acpi_ivrs_block_header *) ((u8 *)table + length); - dprintk(XENLOG_INFO, "IVRS Block:\n"); - dprintk(XENLOG_INFO, " Type 0x%x\n", ivrs_block->type); - dprintk(XENLOG_INFO, " Flags 0x%x\n", ivrs_block->flags); - dprintk(XENLOG_INFO, " Length 0x%x\n", ivrs_block->length); - dprintk(XENLOG_INFO, " Dev_Id 0x%x\n", ivrs_block->dev_id); + amd_iov_info("IVRS Block:\n"); + amd_iov_info(" Type 0x%x\n", ivrs_block->type); + amd_iov_info(" Flags 0x%x\n", ivrs_block->flags); + amd_iov_info(" Length 0x%x\n", ivrs_block->length); + amd_iov_info(" Dev_Id 0x%x\n", ivrs_block->dev_id); if ( table->length < (length + ivrs_block->length) ) { - dprintk(XENLOG_ERR, "IVRS Error: " + amd_iov_error("IVRS Error: " "Table Length Exceeded: 0x%x -> 0x%lx\n", table->length, (length + ivrs_block->length)); diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/amd/iommu_detect.c --- a/xen/drivers/passthrough/amd/iommu_detect.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/amd/iommu_detect.c Thu Apr 24 14:08:29 2008 -0600 @@ -85,6 +85,45 @@ int __init get_iommu_last_downstream_bus return 0; } +static int __init get_iommu_msi_capabilities(u8 bus, u8 dev, u8 func, + struct amd_iommu *iommu) +{ + int cap_ptr, cap_id; + u32 cap_header; + u16 control; + int count = 0; + + cap_ptr = pci_conf_read8(bus, dev, func, + PCI_CAPABILITY_LIST); + + while ( cap_ptr >= PCI_MIN_CAP_OFFSET && + count < PCI_MAX_CAP_BLOCKS ) + { + cap_ptr &= PCI_CAP_PTR_MASK; + cap_header = pci_conf_read32(bus, dev, func, cap_ptr); + cap_id = get_field_from_reg_u32(cap_header, + PCI_CAP_ID_MASK, PCI_CAP_ID_SHIFT); + + if ( cap_id == PCI_CAP_ID_MSI ) + { + iommu->msi_cap = cap_ptr; + break; + } + cap_ptr = get_field_from_reg_u32(cap_header, + PCI_CAP_NEXT_PTR_MASK, PCI_CAP_NEXT_PTR_SHIFT); + count++; + } + + if ( !iommu->msi_cap ) + return -ENODEV; + + amd_iov_info("Found MSI capability block \n"); + control = pci_conf_read16(bus, dev, func, + iommu->msi_cap + PCI_MSI_FLAGS); + iommu->maskbit = control & PCI_MSI_FLAGS_MASKBIT; + return 0; +} + int __init get_iommu_capabilities(u8 bus, u8 dev, u8 func, u8 cap_ptr, struct amd_iommu *iommu) { @@ -99,8 +138,7 @@ int __init get_iommu_capabilities(u8 bus if ( ((mmio_bar & 0x1) == 0) || (iommu->mmio_base_phys == 0) ) { - dprintk(XENLOG_ERR , - "AMD IOMMU: Invalid MMIO_BAR = 0x%"PRIx64"\n", mmio_bar); + amd_iov_error("Invalid MMIO_BAR = 0x%"PRIx64"\n", mmio_bar); return -ENODEV; } @@ -133,6 +171,8 @@ int __init get_iommu_capabilities(u8 bus iommu->msi_number = get_field_from_reg_u32( misc_info, PCI_CAP_MSI_NUMBER_MASK, PCI_CAP_MSI_NUMBER_SHIFT); + get_iommu_msi_capabilities(bus, dev, func, iommu); + return 0; } @@ -176,24 +216,24 @@ static int __init scan_functions_for_iom int bus, int dev, iommu_detect_callback_ptr_t iommu_detect_callback) { int func, hdr_type; - int count, error = 0; - - func = 0; - count = 1; - while ( VALID_PCI_VENDOR_ID(pci_conf_read16(bus, dev, func, - PCI_VENDOR_ID)) && - !error && (func < count) ) + int count = 1, error = 0; + + for ( func = 0; + (func < count) && !error && + VALID_PCI_VENDOR_ID(pci_conf_read16(bus, dev, func, + PCI_VENDOR_ID)); + func++ ) + { hdr_type = pci_conf_read8(bus, dev, func, PCI_HEADER_TYPE); - if ( func == 0 && IS_PCI_MULTI_FUNCTION(hdr_type) ) + if ( (func == 0) && IS_PCI_MULTI_FUNCTION(hdr_type) ) count = PCI_MAX_FUNC_COUNT; if ( IS_PCI_TYPE0_HEADER(hdr_type) || IS_PCI_TYPE1_HEADER(hdr_type) ) error = scan_caps_for_iommu(bus, dev, func, iommu_detect_callback); - func++; } return error; diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/amd/iommu_init.c --- a/xen/drivers/passthrough/amd/iommu_init.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/amd/iommu_init.c Thu Apr 24 14:08:29 2008 -0600 @@ -27,6 +27,7 @@ #include "../pci_regs.h" extern int nr_amd_iommus; +static struct amd_iommu *vector_to_iommu[NR_VECTORS]; int __init map_iommu_mmio_region(struct amd_iommu *iommu) { @@ -34,8 +35,7 @@ int __init map_iommu_mmio_region(struct if ( nr_amd_iommus > MAX_AMD_IOMMUS ) { - gdprintk(XENLOG_ERR, - "IOMMU: nr_amd_iommus %d > MAX_IOMMUS\n", nr_amd_iommus); + amd_iov_error("nr_amd_iommus %d > MAX_IOMMUS\n", nr_amd_iommus); return -ENOMEM; } @@ -109,6 +109,33 @@ void __init register_iommu_cmd_buffer_in writel(entry, iommu->mmio_base+IOMMU_CMD_BUFFER_BASE_HIGH_OFFSET); } +void __init register_iommu_event_log_in_mmio_space(struct amd_iommu *iommu) +{ + u64 addr_64, addr_lo, addr_hi; + u32 power_of2_entries; + u32 entry; + + addr_64 = (u64)virt_to_maddr(iommu->event_log.buffer); + addr_lo = addr_64 & DMA_32BIT_MASK; + addr_hi = addr_64 >> 32; + + set_field_in_reg_u32((u32)addr_lo >> PAGE_SHIFT, 0, + IOMMU_EVENT_LOG_BASE_LOW_MASK, + IOMMU_EVENT_LOG_BASE_LOW_SHIFT, &entry); + writel(entry, iommu->mmio_base + IOMMU_EVENT_LOG_BASE_LOW_OFFSET); + + power_of2_entries = get_order_from_bytes(iommu->event_log.alloc_size) + + IOMMU_EVENT_LOG_POWER_OF2_ENTRIES_PER_PAGE; + + set_field_in_reg_u32((u32)addr_hi, 0, + IOMMU_EVENT_LOG_BASE_HIGH_MASK, + IOMMU_EVENT_LOG_BASE_HIGH_SHIFT, &entry); + set_field_in_reg_u32(power_of2_entries, entry, + IOMMU_EVENT_LOG_LENGTH_MASK, + IOMMU_EVENT_LOG_LENGTH_SHIFT, &entry); + writel(entry, iommu->mmio_base+IOMMU_EVENT_LOG_BASE_HIGH_OFFSET); +} + static void __init set_iommu_translation_control(struct amd_iommu *iommu, int enable) { @@ -179,10 +206,281 @@ static void __init register_iommu_exclus writel(entry, iommu->mmio_base+IOMMU_EXCLUSION_BASE_LOW_OFFSET); } +static void __init set_iommu_event_log_control(struct amd_iommu *iommu, + int enable) +{ + u32 entry; + + entry = readl(iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET); + set_field_in_reg_u32(enable ? IOMMU_CONTROL_ENABLED : + IOMMU_CONTROL_DISABLED, entry, + IOMMU_CONTROL_EVENT_LOG_ENABLE_MASK, + IOMMU_CONTROL_EVENT_LOG_ENABLE_SHIFT, &entry); + writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET); + + set_field_in_reg_u32(enable ? IOMMU_CONTROL_ENABLED : + IOMMU_CONTROL_DISABLED, entry, + IOMMU_CONTROL_EVENT_LOG_INT_MASK, + IOMMU_CONTROL_EVENT_LOG_INT_SHIFT, &entry); + writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET); + + set_field_in_reg_u32(enable ? IOMMU_CONTROL_ENABLED : + IOMMU_CONTROL_DISABLED, entry, + IOMMU_CONTROL_COMP_WAIT_INT_MASK, + IOMMU_CONTROL_COMP_WAIT_INT_SHIFT, &entry); + writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET); +} + +static int amd_iommu_read_event_log(struct amd_iommu *iommu, u32 event[]) +{ + u32 tail, head, *event_log; + int i; + + BUG_ON( !iommu || !event ); + + /* make sure there's an entry in the log */ + tail = get_field_from_reg_u32( + readl(iommu->mmio_base + IOMMU_EVENT_LOG_TAIL_OFFSET), + IOMMU_EVENT_LOG_TAIL_MASK, + IOMMU_EVENT_LOG_TAIL_SHIFT); + if ( tail != iommu->event_log_head ) + { + /* read event log entry */ + event_log = (u32 *)(iommu->event_log.buffer + + (iommu->event_log_head * + IOMMU_EVENT_LOG_ENTRY_SIZE)); + for ( i = 0; i < IOMMU_EVENT_LOG_U32_PER_ENTRY; i++ ) + event[i] = event_log[i]; + if ( ++iommu->event_log_head == iommu->event_log.entries ) + iommu->event_log_head = 0; + + /* update head pointer */ + set_field_in_reg_u32(iommu->event_log_head, 0, + IOMMU_EVENT_LOG_HEAD_MASK, + IOMMU_EVENT_LOG_HEAD_SHIFT, &head); + writel(head, iommu->mmio_base + IOMMU_EVENT_LOG_HEAD_OFFSET); + return 0; + } + + return -EFAULT; +} + +static void amd_iommu_msi_data_init(struct amd_iommu *iommu, int vector) +{ + u32 msi_data; + u8 bus = (iommu->bdf >> 8) & 0xff; + u8 dev = PCI_SLOT(iommu->bdf & 0xff); + u8 func = PCI_FUNC(iommu->bdf & 0xff); + + msi_data = MSI_DATA_TRIGGER_EDGE | + MSI_DATA_LEVEL_ASSERT | + MSI_DATA_DELIVERY_FIXED | + MSI_DATA_VECTOR(vector); + + pci_conf_write32(bus, dev, func, + iommu->msi_cap + PCI_MSI_DATA_64, msi_data); +} + +static void amd_iommu_msi_addr_init(struct amd_iommu *iommu, int phy_cpu) +{ + + int bus = (iommu->bdf >> 8) & 0xff; + int dev = PCI_SLOT(iommu->bdf & 0xff); + int func = PCI_FUNC(iommu->bdf & 0xff); + + u32 address_hi = 0; + u32 address_lo = MSI_ADDR_HEADER | + MSI_ADDR_DESTMODE_PHYS | + MSI_ADDR_REDIRECTION_CPU | + MSI_ADDR_DESTID_CPU(phy_cpu); + + pci_conf_write32(bus, dev, func, + iommu->msi_cap + PCI_MSI_ADDRESS_LO, address_lo); + pci_conf_write32(bus, dev, func, + iommu->msi_cap + PCI_MSI_ADDRESS_HI, address_hi); +} + +static void amd_iommu_msi_enable(struct amd_iommu *iommu, int flag) +{ + u16 control; + int bus = (iommu->bdf >> 8) & 0xff; + int dev = PCI_SLOT(iommu->bdf & 0xff); + int func = PCI_FUNC(iommu->bdf & 0xff); + + control = pci_conf_read16(bus, dev, func, + iommu->msi_cap + PCI_MSI_FLAGS); + control &= ~(1); + if ( flag ) + control |= flag; + pci_conf_write16(bus, dev, func, + iommu->msi_cap + PCI_MSI_FLAGS, control); +} + +static void iommu_msi_unmask(unsigned int vector) +{ + unsigned long flags; + struct amd_iommu *iommu = vector_to_iommu[vector]; + + /* FIXME: do not support mask bits at the moment */ + if ( iommu->maskbit ) + return; + + spin_lock_irqsave(&iommu->lock, flags); + amd_iommu_msi_enable(iommu, IOMMU_CONTROL_ENABLED); + spin_unlock_irqrestore(&iommu->lock, flags); +} + +static void iommu_msi_mask(unsigned int vector) +{ + unsigned long flags; + struct amd_iommu *iommu = vector_to_iommu[vector]; + + /* FIXME: do not support mask bits at the moment */ + if ( iommu->maskbit ) + return; + + spin_lock_irqsave(&iommu->lock, flags); + amd_iommu_msi_enable(iommu, IOMMU_CONTROL_DISABLED); + spin_unlock_irqrestore(&iommu->lock, flags); +} + +static unsigned int iommu_msi_startup(unsigned int vector) +{ + iommu_msi_unmask(vector); + return 0; +} + +static void iommu_msi_end(unsigned int vector) +{ + iommu_msi_unmask(vector); + ack_APIC_irq(); +} + +static void iommu_msi_set_affinity(unsigned int vector, cpumask_t dest) +{ + struct amd_iommu *iommu = vector_to_iommu[vector]; + amd_iommu_msi_addr_init(iommu, cpu_physical_id(first_cpu(dest))); +} + +static struct hw_interrupt_type iommu_msi_type = { + .typename = "AMD_IOV_MSI", + .startup = iommu_msi_startup, + .shutdown = iommu_msi_mask, + .enable = iommu_msi_unmask, + .disable = iommu_msi_mask, + .ack = iommu_msi_mask, + .end = iommu_msi_end, + .set_affinity = iommu_msi_set_affinity, +}; + +static void parse_event_log_entry(u32 entry[]) +{ + u16 domain_id, device_id; + u32 code; + u64 *addr; + char * event_str[] = {"ILLEGAL_DEV_TABLE_ENTRY", + "IO_PAGE_FALT", + "DEV_TABLE_HW_ERROR", + "PAGE_TABLE_HW_ERROR", + "ILLEGAL_COMMAND_ERROR", + "COMMAND_HW_ERROR", + "IOTLB_INV_TIMEOUT", + "INVALID_DEV_REQUEST"}; + + code = get_field_from_reg_u32(entry[1], + IOMMU_EVENT_CODE_MASK, + IOMMU_EVENT_CODE_SHIFT); + + if ( (code > IOMMU_EVENT_INVALID_DEV_REQUEST) + || (code < IOMMU_EVENT_ILLEGAL_DEV_TABLE_ENTRY) ) + { + amd_iov_error("Invalid event log entry!\n"); + return; + } + + if ( code == IOMMU_EVENT_IO_PAGE_FALT ) + { + device_id = get_field_from_reg_u32(entry[0], + IOMMU_EVENT_DEVICE_ID_MASK, + IOMMU_EVENT_DEVICE_ID_SHIFT); + domain_id = get_field_from_reg_u32(entry[1], + IOMMU_EVENT_DOMAIN_ID_MASK, + IOMMU_EVENT_DOMAIN_ID_SHIFT); + addr= (u64*) (entry + 2); + printk(XENLOG_ERR "AMD_IOV: " + "%s: domain:%d, device id:0x%x, fault address:0x%"PRIx64"\n", + event_str[code-1], domain_id, device_id, *addr); + } +} + +static void amd_iommu_page_fault(int vector, void *dev_id, + struct cpu_user_regs *regs) +{ + u32 event[4]; + unsigned long flags; + int ret = 0; + struct amd_iommu *iommu = dev_id; + + spin_lock_irqsave(&iommu->lock, flags); + ret = amd_iommu_read_event_log(iommu, event); + spin_unlock_irqrestore(&iommu->lock, flags); + + if ( ret != 0 ) + return; + parse_event_log_entry(event); +} + +static int set_iommu_interrupt_handler(struct amd_iommu *iommu) +{ + int vector, ret; + unsigned long flags; + + vector = assign_irq_vector(AUTO_ASSIGN); + vector_to_iommu[vector] = iommu; + + /* make irq == vector */ + irq_vector[vector] = vector; + vector_irq[vector] = vector; + + if ( !vector ) + { + amd_iov_error("no vectors\n"); + return 0; + } + + irq_desc[vector].handler = &iommu_msi_type; + ret = request_irq(vector, amd_iommu_page_fault, 0, "dmar", iommu); + if ( ret ) + { + amd_iov_error("can't request irq\n"); + return 0; + } + + spin_lock_irqsave(&iommu->lock, flags); + + amd_iommu_msi_data_init (iommu, vector); + amd_iommu_msi_addr_init(iommu, cpu_physical_id(first_cpu(cpu_online_map))); + amd_iommu_msi_enable(iommu, IOMMU_CONTROL_ENABLED); + + spin_unlock_irqrestore(&iommu->lock, flags); + + return vector; +} + void __init enable_iommu(struct amd_iommu *iommu) { + unsigned long flags; + + set_iommu_interrupt_handler(iommu); + + spin_lock_irqsave(&iommu->lock, flags); + register_iommu_exclusion_range(iommu); set_iommu_command_buffer_control(iommu, IOMMU_CONTROL_ENABLED); + set_iommu_event_log_control(iommu, IOMMU_CONTROL_ENABLED); set_iommu_translation_control(iommu, IOMMU_CONTROL_ENABLED); - printk("AMD IOMMU %d: Enabled\n", nr_amd_iommus); -} + + spin_unlock_irqrestore(&iommu->lock, flags); + + printk("AMD_IOV: IOMMU %d Enabled.\n", nr_amd_iommus); +} diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/amd/iommu_map.c --- a/xen/drivers/passthrough/amd/iommu_map.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/amd/iommu_map.c Thu Apr 24 14:08:29 2008 -0600 @@ -154,8 +154,7 @@ void flush_command_buffer(struct amd_iom } else { - dprintk(XENLOG_WARNING, "AMD IOMMU: Warning:" - " ComWaitInt bit did not assert!\n"); + amd_iov_warning("Warning: ComWaitInt bit did not assert!\n"); } } } @@ -402,10 +401,9 @@ int amd_iommu_map_page(struct domain *d, pte = get_pte_from_page_tables(hd->root_table, hd->paging_mode, gfn); if ( pte == NULL ) { - dprintk(XENLOG_ERR, - "AMD IOMMU: Invalid IO pagetable entry gfn = %lx\n", gfn); + amd_iov_error("Invalid IO pagetable entry gfn = %lx\n", gfn); spin_unlock_irqrestore(&hd->mapping_lock, flags); - return -EIO; + return -EFAULT; } set_page_table_entry_present((u32 *)pte, maddr, iw, ir); @@ -439,10 +437,9 @@ int amd_iommu_unmap_page(struct domain * pte = get_pte_from_page_tables(hd->root_table, hd->paging_mode, gfn); if ( pte == NULL ) { - dprintk(XENLOG_ERR, - "AMD IOMMU: Invalid IO pagetable entry gfn = %lx\n", gfn); + amd_iov_error("Invalid IO pagetable entry gfn = %lx\n", gfn); spin_unlock_irqrestore(&hd->mapping_lock, flags); - return -EIO; + return -EFAULT; } /* mark PTE as 'page not present' */ @@ -479,9 +476,8 @@ int amd_iommu_reserve_domain_unity_map( hd->root_table, hd->paging_mode, phys_addr >> PAGE_SHIFT); if ( pte == NULL ) { - dprintk(XENLOG_ERR, - "AMD IOMMU: Invalid IO pagetable entry " - "phys_addr = %lx\n", phys_addr); + amd_iov_error( + "Invalid IO pagetable entry phys_addr = %lx\n", phys_addr); spin_unlock_irqrestore(&hd->mapping_lock, flags); return -EFAULT; } @@ -528,8 +524,7 @@ int amd_iommu_sync_p2m(struct domain *d) pte = get_pte_from_page_tables(hd->root_table, hd->paging_mode, gfn); if ( pte == NULL ) { - dprintk(XENLOG_ERR, - "AMD IOMMU: Invalid IO pagetable entry gfn = %lx\n", gfn); + amd_iov_error("Invalid IO pagetable entry gfn = %lx\n", gfn); spin_unlock_irqrestore(&hd->mapping_lock, flags); return -EFAULT; } diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/amd/pci_amd_iommu.c --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c Thu Apr 24 14:08:29 2008 -0600 @@ -29,16 +29,11 @@ struct list_head amd_iommu_head; struct list_head amd_iommu_head; long amd_iommu_poll_comp_wait = COMPLETION_WAIT_DEFAULT_POLLING_COUNT; static long amd_iommu_cmd_buffer_entries = IOMMU_CMD_BUFFER_DEFAULT_ENTRIES; -int nr_amd_iommus = 0; - -unsigned short ivrs_bdf_entries = 0; -struct ivrs_mappings *ivrs_mappings = NULL; - -/* will set if amd-iommu HW is found */ -int amd_iommu_enabled = 0; - -static int enable_amd_iommu = 0; -boolean_param("enable_amd_iommu", enable_amd_iommu); +static long amd_iommu_event_log_entries = IOMMU_EVENT_LOG_DEFAULT_ENTRIES; +int nr_amd_iommus; + +unsigned short ivrs_bdf_entries; +struct ivrs_mappings *ivrs_mappings; static void deallocate_domain_page_tables(struct hvm_iommu *hd) { @@ -73,25 +68,8 @@ static void __init deallocate_iommu_reso static void __init deallocate_iommu_resources(struct amd_iommu *iommu) { deallocate_iommu_table_struct(&iommu->dev_table); - deallocate_iommu_table_struct(&iommu->cmd_buffer);; -} - -static void __init detect_cleanup(void) -{ - struct amd_iommu *iommu, *next; - - list_for_each_entry_safe ( iommu, next, &amd_iommu_head, list ) - { - list_del(&iommu->list); - deallocate_iommu_resources(iommu); - xfree(iommu); - } - - if ( ivrs_mappings ) - { - xfree(ivrs_mappings); - ivrs_mappings = NULL; - } + deallocate_iommu_table_struct(&iommu->cmd_buffer); + deallocate_iommu_table_struct(&iommu->event_log); } static int __init allocate_iommu_table_struct(struct table_struct *table, @@ -102,7 +80,7 @@ static int __init allocate_iommu_table_s if ( !table->buffer ) { - dprintk(XENLOG_ERR, "AMD IOMMU: Error allocating %s\n", name); + amd_iov_error("Error allocating %s\n", name); return -ENOMEM; } @@ -139,6 +117,20 @@ static int __init allocate_iommu_resourc "Command Buffer") != 0 ) goto error_out; + /* allocate 'event log' in power of 2 increments of 4K */ + iommu->event_log_head = 0; + iommu->event_log.alloc_size = + PAGE_SIZE << get_order_from_bytes( + PAGE_ALIGN(amd_iommu_event_log_entries * + IOMMU_EVENT_LOG_ENTRY_SIZE)); + + iommu->event_log.entries = + iommu->event_log.alloc_size / IOMMU_EVENT_LOG_ENTRY_SIZE; + + if ( allocate_iommu_table_struct(&iommu->event_log, + "Event Log") != 0 ) + goto error_out; + return 0; error_out: @@ -153,7 +145,7 @@ int iommu_detect_callback(u8 bus, u8 dev iommu = (struct amd_iommu *) xmalloc(struct amd_iommu); if ( !iommu ) { - dprintk(XENLOG_ERR, "AMD IOMMU: Error allocating amd_iommu\n"); + amd_iov_error("Error allocating amd_iommu\n"); return -ENOMEM; } memset(iommu, 0, sizeof(struct amd_iommu)); @@ -203,6 +195,7 @@ static int __init amd_iommu_init(void) goto error_out; register_iommu_dev_table_in_mmio_space(iommu); register_iommu_cmd_buffer_in_mmio_space(iommu); + register_iommu_event_log_in_mmio_space(iommu); spin_unlock_irqrestore(&iommu->lock, flags); } @@ -220,18 +213,14 @@ static int __init amd_iommu_init(void) } if ( acpi_table_parse(ACPI_IVRS, parse_ivrs_table) != 0 ) - dprintk(XENLOG_INFO, "AMD IOMMU: Did not find IVRS table!\n"); + amd_iov_error("Did not find IVRS table!\n"); for_each_amd_iommu ( iommu ) { - spin_lock_irqsave(&iommu->lock, flags); /* enable IOMMU translation services */ enable_iommu(iommu); nr_amd_iommus++; - spin_unlock_irqrestore(&iommu->lock, flags); - } - - amd_iommu_enabled = 1; + } return 0; @@ -262,7 +251,7 @@ struct amd_iommu *find_iommu_for_device( return NULL; } -void amd_iommu_setup_domain_device( +static void amd_iommu_setup_domain_device( struct domain *domain, struct amd_iommu *iommu, int bdf) { void *dte; @@ -288,12 +277,12 @@ void amd_iommu_setup_domain_device( sys_mgt = ivrs_mappings[req_id].dte_sys_mgt_enable; dev_ex = ivrs_mappings[req_id].dte_allow_exclusion; amd_iommu_set_dev_table_entry((u32 *)dte, root_ptr, - req_id, sys_mgt, dev_ex, + hd->domain_id, sys_mgt, dev_ex, hd->paging_mode); invalidate_dev_table_entry(iommu, req_id); flush_command_buffer(iommu); - dprintk(XENLOG_INFO, "AMD IOMMU: Set DTE req_id:%x, " + amd_iov_info("Enable DTE:0x%x, " "root_ptr:%"PRIx64", domain_id:%d, paging_mode:%d\n", req_id, root_ptr, hd->domain_id, hd->paging_mode); @@ -301,9 +290,9 @@ void amd_iommu_setup_domain_device( } } -void __init amd_iommu_setup_dom0_devices(void) -{ - struct hvm_iommu *hd = domain_hvm_iommu(dom0); +static void amd_iommu_setup_dom0_devices(struct domain *d) +{ + struct hvm_iommu *hd = domain_hvm_iommu(d); struct amd_iommu *iommu; struct pci_dev *pdev; int bus, dev, func; @@ -333,80 +322,72 @@ void __init amd_iommu_setup_dom0_devices find_iommu_for_device(bus, pdev->devfn) : NULL; if ( iommu ) - amd_iommu_setup_domain_device(dom0, iommu, bdf); + amd_iommu_setup_domain_device(d, iommu, bdf); } } } } -int amd_iommu_detect(void) -{ - unsigned long i; +int amd_iov_detect(void) +{ int last_bus; - struct amd_iommu *iommu; - - if ( !enable_amd_iommu ) - { - printk("AMD IOMMU: Disabled\n"); - return 0; - } + struct amd_iommu *iommu, *next; INIT_LIST_HEAD(&amd_iommu_head); if ( scan_for_iommu(iommu_detect_callback) != 0 ) { - dprintk(XENLOG_ERR, "AMD IOMMU: Error detection\n"); + amd_iov_error("Error detection\n"); goto error_out; } if ( !iommu_found() ) { - printk("AMD IOMMU: Not found!\n"); - return 0; - } - else - { - /* allocate 'ivrs mappings' table */ - /* note: the table has entries to accomodate all IOMMUs */ - last_bus = 0; - for_each_amd_iommu ( iommu ) - if ( iommu->last_downstream_bus > last_bus ) - last_bus = iommu->last_downstream_bus; - - ivrs_bdf_entries = (last_bus + 1) * - IOMMU_DEV_TABLE_ENTRIES_PER_BUS; - ivrs_mappings = xmalloc_array( struct ivrs_mappings, ivrs_bdf_entries); - - if ( !ivrs_mappings ) - { - dprintk(XENLOG_ERR, "AMD IOMMU:" - " Error allocating IVRS DevMappings table\n"); - goto error_out; - } - memset(ivrs_mappings, 0, - ivrs_bdf_entries * sizeof(struct ivrs_mappings)); - } + printk("AMD_IOV: IOMMU not found!\n"); + goto error_out; + } + + /* allocate 'ivrs mappings' table */ + /* note: the table has entries to accomodate all IOMMUs */ + last_bus = 0; + for_each_amd_iommu ( iommu ) + if ( iommu->last_downstream_bus > last_bus ) + last_bus = iommu->last_downstream_bus; + + ivrs_bdf_entries = (last_bus + 1) * + IOMMU_DEV_TABLE_ENTRIES_PER_BUS; + ivrs_mappings = xmalloc_array( struct ivrs_mappings, ivrs_bdf_entries); + if ( ivrs_mappings == NULL ) + { + amd_iov_error("Error allocating IVRS DevMappings table\n"); + goto error_out; + } + memset(ivrs_mappings, 0, + ivrs_bdf_entries * sizeof(struct ivrs_mappings)); if ( amd_iommu_init() != 0 ) { - dprintk(XENLOG_ERR, "AMD IOMMU: Error initialization\n"); - goto error_out; - } - - if ( iommu_domain_init(dom0) != 0 ) - goto error_out; - - /* setup 1:1 page table for dom0 */ - for ( i = 0; i < max_page; i++ ) - amd_iommu_map_page(dom0, i, i); - - amd_iommu_setup_dom0_devices(); + amd_iov_error("Error initialization\n"); + goto error_out; + } + return 0; error_out: - detect_cleanup(); + list_for_each_entry_safe ( iommu, next, &amd_iommu_head, list ) + { + list_del(&iommu->list); + deallocate_iommu_resources(iommu); + xfree(iommu); + } + + if ( ivrs_mappings ) + { + xfree(ivrs_mappings); + ivrs_mappings = NULL; + } + return -ENODEV; - } static int allocate_domain_resources(struct hvm_iommu *hd) @@ -447,12 +428,10 @@ static int get_paging_mode(unsigned long return -ENOMEM; } - dprintk(XENLOG_INFO, "AMD IOMMU: paging mode = %d\n", level); - return level; } -int amd_iommu_domain_init(struct domain *domain) +static int amd_iommu_domain_init(struct domain *domain) { struct hvm_iommu *hd = domain_hvm_iommu(domain); @@ -463,10 +442,18 @@ int amd_iommu_domain_init(struct domain return -ENOMEM; } - if ( is_hvm_domain(domain) ) - hd->paging_mode = IOMMU_PAGE_TABLE_LEVEL_4; - else - hd->paging_mode = get_paging_mode(max_page); + hd->paging_mode = is_hvm_domain(domain)? + IOMMU_PAGE_TABLE_LEVEL_4 : get_paging_mode(max_page); + + if ( domain->domain_id == 0 ) + { + unsigned long i; + /* setup 1:1 page table for dom0 */ + for ( i = 0; i < max_page; i++ ) + amd_iommu_map_page(domain, i, i); + + amd_iommu_setup_dom0_devices(domain); + } hd->domain_id = domain->domain_id; @@ -490,7 +477,7 @@ static void amd_iommu_disable_domain_dev memset (dte, 0, IOMMU_DEV_TABLE_ENTRY_SIZE); invalidate_dev_table_entry(iommu, req_id); flush_command_buffer(iommu); - dprintk(XENLOG_INFO , "AMD IOMMU: disable DTE 0x%x," + amd_iov_info("Disable DTE:0x%x," " domain_id:%d, paging_mode:%d\n", req_id, domain_hvm_iommu(domain)->domain_id, domain_hvm_iommu(domain)->paging_mode); @@ -525,7 +512,7 @@ static int reassign_device( struct domai if ( !iommu ) { - gdprintk(XENLOG_ERR , "AMD IOMMU: fail to find iommu." + amd_iov_error("Fail to find iommu." " %x:%x.%x cannot be assigned to domain %d\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn), target->domain_id); return -ENODEV; @@ -540,8 +527,7 @@ static int reassign_device( struct domai spin_unlock_irqrestore(&source_hd->iommu_list_lock, flags); amd_iommu_setup_domain_device(target, iommu, bdf); - gdprintk(XENLOG_INFO , - "AMD IOMMU: reassign %x:%x.%x domain %d -> domain %d\n", + amd_iov_info("reassign %x:%x.%x domain %d -> domain %d\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn), source->domain_id, target->domain_id); @@ -550,7 +536,7 @@ static int reassign_device( struct domai return 0; } -int amd_iommu_assign_device(struct domain *d, u8 bus, u8 devfn) +static int amd_iommu_assign_device(struct domain *d, u8 bus, u8 devfn) { int bdf = (bus << 8) | devfn; int req_id = ivrs_mappings[bdf].dte_requestor_id; @@ -580,8 +566,7 @@ static void release_domain_devices(struc { pdev = list_entry(hd->pdev_list.next, typeof(*pdev), list); pdev_flr(pdev->bus, pdev->devfn); - gdprintk(XENLOG_INFO , - "AMD IOMMU: release devices %x:%x.%x\n", + amd_iov_info("release domain %d devices %x:%x.%x\n", d->domain_id, pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); reassign_device(d, dom0, pdev->bus, pdev->devfn); } @@ -637,16 +622,13 @@ static void deallocate_iommu_page_tables hd ->root_table = NULL; } -void amd_iommu_domain_destroy(struct domain *d) -{ - if ( !amd_iommu_enabled ) - return; - +static void amd_iommu_domain_destroy(struct domain *d) +{ deallocate_iommu_page_tables(d); release_domain_devices(d); } -void amd_iommu_return_device( +static void amd_iommu_return_device( struct domain *s, struct domain *t, u8 bus, u8 devfn) { pdev_flr(bus, devfn); diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/iommu.c --- a/xen/drivers/passthrough/iommu.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/iommu.c Thu Apr 24 14:08:29 2008 -0600 @@ -18,6 +18,11 @@ extern struct iommu_ops intel_iommu_ops; extern struct iommu_ops amd_iommu_ops; +int intel_vtd_setup(void); +int amd_iov_detect(void); + +int iommu_enabled = 1; +boolean_param("iommu", iommu_enabled); int iommu_domain_init(struct domain *domain) { @@ -134,3 +139,28 @@ void deassign_device(struct domain *d, u return hd->platform_ops->reassign_device(d, dom0, bus, devfn); } + +static int iommu_setup(void) +{ + int rc = -ENODEV; + + if ( !iommu_enabled ) + goto out; + + switch ( boot_cpu_data.x86_vendor ) + { + case X86_VENDOR_INTEL: + rc = intel_vtd_setup(); + break; + case X86_VENDOR_AMD: + rc = amd_iov_detect(); + break; + } + + iommu_enabled = (rc == 0); + + out: + printk("I/O virtualisation %sabled\n", iommu_enabled ? "en" : "dis"); + return rc; +} +__initcall(iommu_setup); diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/vtd/dmar.c Thu Apr 24 14:08:29 2008 -0600 @@ -30,8 +30,7 @@ #include "dmar.h" #include "../pci_regs.h" -int vtd_enabled; -boolean_param("vtd", vtd_enabled); +int vtd_enabled = 1; #undef PREFIX #define PREFIX VTDPREFIX "ACPI DMAR:" @@ -79,14 +78,9 @@ struct acpi_drhd_unit * ioapic_to_drhd(u struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id) { struct acpi_drhd_unit *drhd; - list_for_each_entry( drhd, &acpi_drhd_units, list ) { - if ( acpi_ioapic_device_match(&drhd->ioapic_list, apic_id) ) { - dprintk(XENLOG_INFO VTDPREFIX, - "ioapic_to_drhd: drhd->address = %lx\n", - drhd->address); + list_for_each_entry( drhd, &acpi_drhd_units, list ) + if ( acpi_ioapic_device_match(&drhd->ioapic_list, apic_id) ) return drhd; - } - } return NULL; } @@ -94,15 +88,9 @@ struct iommu * ioapic_to_iommu(unsigned { struct acpi_drhd_unit *drhd; - list_for_each_entry( drhd, &acpi_drhd_units, list ) { - if ( acpi_ioapic_device_match(&drhd->ioapic_list, apic_id) ) { - dprintk(XENLOG_INFO VTDPREFIX, - "ioapic_to_iommu: drhd->address = %lx\n", - drhd->address); + list_for_each_entry( drhd, &acpi_drhd_units, list ) + if ( acpi_ioapic_device_match(&drhd->ioapic_list, apic_id) ) return drhd->iommu; - } - } - dprintk(XENLOG_INFO VTDPREFIX, "returning NULL\n"); return NULL; } @@ -150,21 +138,11 @@ struct acpi_drhd_unit * acpi_find_matche if ( acpi_pci_device_match(drhd->devices, drhd->devices_cnt, dev) ) - { - dprintk(XENLOG_INFO VTDPREFIX, - "acpi_find_matched_drhd_unit: drhd->address = %lx\n", - drhd->address); return drhd; - } } if ( include_all_drhd ) - { - dprintk(XENLOG_INFO VTDPREFIX, - "acpi_find_matched_drhd_unit:include_all_drhd->addr = %lx\n", - include_all_drhd->address); return include_all_drhd; - } return NULL; } @@ -174,11 +152,9 @@ struct acpi_rmrr_unit * acpi_find_matche struct acpi_rmrr_unit *rmrr; list_for_each_entry ( rmrr, &acpi_rmrr_units, list ) - { if ( acpi_pci_device_match(rmrr->devices, rmrr->devices_cnt, dev) ) return rmrr; - } return NULL; } @@ -199,11 +175,7 @@ struct acpi_atsr_unit * acpi_find_matche } if ( all_ports_atsru ) - { - dprintk(XENLOG_INFO VTDPREFIX, - "acpi_find_matched_atsr_unit: all_ports_atsru\n"); return all_ports_atsru;; - } return NULL; } @@ -604,22 +576,24 @@ int acpi_dmar_init(void) { int rc; - if ( !vtd_enabled ) - return -ENODEV; + rc = -ENODEV; + if ( !iommu_enabled ) + goto fail; if ( (rc = vtd_hw_check()) != 0 ) - return rc; + goto fail; acpi_table_parse(ACPI_DMAR, acpi_parse_dmar); + rc = -ENODEV; if ( list_empty(&acpi_drhd_units) ) - { - dprintk(XENLOG_ERR VTDPREFIX, "No DMAR devices found\n"); - vtd_enabled = 0; - return -ENODEV; - } + goto fail; printk("Intel VT-d has been enabled\n"); return 0; -} + + fail: + vtd_enabled = 0; + return -ENODEV; +} diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/vtd/iommu.c Thu Apr 24 14:08:29 2008 -0600 @@ -41,6 +41,9 @@ static int domid_bitmap_size; static int domid_bitmap_size; /* domain id bitmap size in bits */ static unsigned long *domid_bitmap; /* iommu domain id bitmap */ +static void setup_dom0_devices(struct domain *d); +static void setup_dom0_rmrr(struct domain *d); + #define DID_FIELD_WIDTH 16 #define DID_HIGH_OFFSET 8 static void context_set_domain_id(struct context_entry *context, @@ -78,17 +81,12 @@ static struct intel_iommu *alloc_intel_i struct intel_iommu *intel; intel = xmalloc(struct intel_iommu); - if ( !intel ) - { - gdprintk(XENLOG_ERR VTDPREFIX, - "Allocate intel_iommu failed.\n"); + if ( intel == NULL ) return NULL; - } memset(intel, 0, sizeof(struct intel_iommu)); spin_lock_init(&intel->qi_ctrl.qinval_lock); spin_lock_init(&intel->qi_ctrl.qinval_poll_lock); - spin_lock_init(&intel->ir_ctrl.iremap_lock); return intel; @@ -96,68 +94,22 @@ static struct intel_iommu *alloc_intel_i static void free_intel_iommu(struct intel_iommu *intel) { - if ( intel ) - { - xfree(intel); - intel = NULL; - } + xfree(intel); } struct qi_ctrl *iommu_qi_ctrl(struct iommu *iommu) { - if ( !iommu ) - return NULL; - - if ( !iommu->intel ) - { - iommu->intel = alloc_intel_iommu(); - if ( !iommu->intel ) - { - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_qi_ctrl: Allocate iommu->intel failed.\n"); - return NULL; - } - } - - return &(iommu->intel->qi_ctrl); + return iommu ? &iommu->intel->qi_ctrl : NULL; } struct ir_ctrl *iommu_ir_ctrl(struct iommu *iommu) { - if ( !iommu ) - return NULL; - - if ( !iommu->intel ) - { - iommu->intel = alloc_intel_iommu(); - if ( !iommu->intel ) - { - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_ir_ctrl: Allocate iommu->intel failed.\n"); - return NULL; - } - } - - return &(iommu->intel->ir_ctrl); + return iommu ? &iommu->intel->ir_ctrl : NULL; } struct iommu_flush *iommu_get_flush(struct iommu *iommu) { - if ( !iommu ) - return NULL; - - if ( !iommu->intel ) - { - iommu->intel = alloc_intel_iommu(); - if ( !iommu->intel ) - { - dprintk(XENLOG_ERR VTDPREFIX, - "iommu_get_flush: Allocate iommu->intel failed.\n"); - return NULL; - } - } - - return &(iommu->intel->flush); + return iommu ? &iommu->intel->flush : NULL; } unsigned int clflush_size; @@ -276,11 +228,7 @@ static u64 addr_to_dma_page_maddr(struct dma_set_pte_addr(*pte, maddr); vaddr = map_vtd_domain_page(maddr); if ( !vaddr ) - { - unmap_vtd_domain_page(parent); - spin_unlock_irqrestore(&hd->mapping_lock, flags); - return 0; - } + break; /* * high level table always sets r/w, last level @@ -294,14 +242,9 @@ static u64 addr_to_dma_page_maddr(struct { vaddr = map_vtd_domain_page(pte->val); if ( !vaddr ) - { - unmap_vtd_domain_page(parent); - spin_unlock_irqrestore(&hd->mapping_lock, flags); - return 0; - } + break; } - unmap_vtd_domain_page(parent); if ( level == 2 ) { pte_maddr = pte->val & PAGE_MASK_4K; @@ -309,11 +252,13 @@ static u64 addr_to_dma_page_maddr(struct break; } + unmap_vtd_domain_page(parent); parent = (struct dma_pte *)vaddr; vaddr = NULL; level--; } + unmap_vtd_domain_page(parent); spin_unlock_irqrestore(&hd->mapping_lock, flags); return pte_maddr; } @@ -688,7 +633,7 @@ void dma_pte_free_pagetable(struct domai struct dma_pte *page, *pte; int total = agaw_to_level(hd->agaw); int level; - u32 tmp; + u64 tmp; u64 pg_maddr; drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); @@ -709,7 +654,10 @@ void dma_pte_free_pagetable(struct domai { pg_maddr = dma_addr_level_page_maddr(domain, tmp, level); if ( pg_maddr == 0 ) - return; + { + tmp += level_size(level); + continue; + } page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); pte = page + address_level_offset(tmp, level); dma_clear_pte(*pte); @@ -730,18 +678,11 @@ void dma_pte_free_pagetable(struct domai } } -/* iommu handling */ static int iommu_set_root_entry(struct iommu *iommu) { u32 cmd, sts; unsigned long flags; - - if ( iommu == NULL ) - { - gdprintk(XENLOG_ERR VTDPREFIX, - "iommu_set_root_entry: iommu == NULL\n"); - return -EINVAL; - } + s_time_t start_time; if ( iommu->root_maddr != 0 ) { @@ -760,11 +701,14 @@ static int iommu_set_root_entry(struct i dmar_writel(iommu->reg, DMAR_GCMD_REG, cmd); /* Make sure hardware complete it */ + start_time = NOW(); for ( ; ; ) { sts = dmar_readl(iommu->reg, DMAR_GSTS_REG); if ( sts & DMA_GSTS_RTPS ) break; + if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) + panic("DMAR hardware is malfunctional, please disable IOMMU\n"); cpu_relax(); } @@ -777,6 +721,7 @@ static int iommu_enable_translation(stru { u32 sts; unsigned long flags; + s_time_t start_time; dprintk(XENLOG_INFO VTDPREFIX, "iommu_enable_translation: iommu->reg = %p\n", iommu->reg); @@ -784,11 +729,14 @@ static int iommu_enable_translation(stru iommu->gcmd |= DMA_GCMD_TE; dmar_writel(iommu->reg, DMAR_GCMD_REG, iommu->gcmd); /* Make sure hardware complete it */ + start_time = NOW(); for ( ; ; ) { sts = dmar_readl(iommu->reg, DMAR_GSTS_REG); if ( sts & DMA_GSTS_TES ) break; + if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) + panic("DMAR hardware is malfunctional, please disable IOMMU\n"); cpu_relax(); } @@ -802,17 +750,21 @@ int iommu_disable_translation(struct iom { u32 sts; unsigned long flags; + s_time_t start_time; spin_lock_irqsave(&iommu->register_lock, flags); iommu->gcmd &= ~ DMA_GCMD_TE; dmar_writel(iommu->reg, DMAR_GCMD_REG, iommu->gcmd); /* Make sure hardware complete it */ + start_time = NOW(); for ( ; ; ) { sts = dmar_readl(iommu->reg, DMAR_GSTS_REG); if ( !(sts & DMA_GSTS_TES) ) break; + if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT ) + panic("DMAR hardware is malfunctional, please disable IOMMU\n"); cpu_relax(); } spin_unlock_irqrestore(&iommu->register_lock, flags); @@ -1039,69 +991,64 @@ int iommu_set_interrupt(struct iommu *io return vector; } -struct iommu *iommu_alloc(void *hw_data) -{ - struct acpi_drhd_unit *drhd = (struct acpi_drhd_unit *) hw_data; +static int iommu_alloc(struct acpi_drhd_unit *drhd) +{ struct iommu *iommu; if ( nr_iommus > MAX_IOMMUS ) { gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: nr_iommus %d > MAX_IOMMUS\n", nr_iommus); - return NULL; + return -ENOMEM; } iommu = xmalloc(struct iommu); - if ( !iommu ) - return NULL; + if ( iommu == NULL ) + return -ENOMEM; memset(iommu, 0, sizeof(struct iommu)); + iommu->intel = alloc_intel_iommu(); + if ( iommu->intel == NULL ) + { + xfree(iommu); + return -ENOMEM; + } + set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, drhd->address); - iommu->reg = (void *) fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus); - - printk("iommu_alloc: iommu->reg = %p drhd->address = %lx\n", - iommu->reg, drhd->address); - + iommu->reg = (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus); nr_iommus++; - - if ( !iommu->reg ) - { - printk(KERN_ERR VTDPREFIX "IOMMU: can't mapping the region\n"); - goto error; - } iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG); iommu->ecap = dmar_readq(iommu->reg, DMAR_ECAP_REG); - printk("iommu_alloc: cap = %"PRIx64"\n",iommu->cap); - printk("iommu_alloc: ecap = %"PRIx64"\n", iommu->ecap); - spin_lock_init(&iommu->lock); spin_lock_init(&iommu->register_lock); - iommu->intel = alloc_intel_iommu(); - drhd->iommu = iommu; - return iommu; - error: - xfree(iommu); - return NULL; -} - -static void free_iommu(struct iommu *iommu) -{ - if ( !iommu ) + return 0; +} + +static void iommu_free(struct acpi_drhd_unit *drhd) +{ + struct iommu *iommu = drhd->iommu; + + if ( iommu == NULL ) return; + if ( iommu->root_maddr != 0 ) { free_pgtable_maddr(iommu->root_maddr); iommu->root_maddr = 0; } + if ( iommu->reg ) iounmap(iommu->reg); + free_intel_iommu(iommu->intel); free_irq(iommu->vector); xfree(iommu); + + drhd->iommu = NULL; } #define guestwidth_to_adjustwidth(gaw) ({ \ @@ -1111,22 +1058,21 @@ static void free_iommu(struct iommu *iom agaw = 64; \ agaw; }) -int intel_iommu_domain_init(struct domain *domain) -{ - struct hvm_iommu *hd = domain_hvm_iommu(domain); +static int intel_iommu_domain_init(struct domain *d) +{ + struct hvm_iommu *hd = domain_hvm_iommu(d); struct iommu *iommu = NULL; int guest_width = DEFAULT_DOMAIN_ADDRESS_WIDTH; - int adjust_width, agaw; + int i, adjust_width, agaw; unsigned long sagaw; struct acpi_drhd_unit *drhd; - if ( !vtd_enabled || list_empty(&acpi_drhd_units) ) - return 0; - - for_each_drhd_unit ( drhd ) - iommu = drhd->iommu ? : iommu_alloc(drhd); - - /* calculate AGAW */ + INIT_LIST_HEAD(&hd->pdev_list); + + drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); + iommu = drhd->iommu; + + /* Calculate AGAW. */ if ( guest_width > cap_mgaw(iommu->cap) ) guest_width = cap_mgaw(iommu->cap); adjust_width = guestwidth_to_adjustwidth(guest_width); @@ -1142,6 +1088,26 @@ int intel_iommu_domain_init(struct domai return -ENODEV; } hd->agaw = agaw; + + if ( d->domain_id == 0 ) + { + /* Set up 1:1 page table for dom0. */ + for ( i = 0; i < max_page; i++ ) + iommu_map_page(d, i, i); + + setup_dom0_devices(d); + setup_dom0_rmrr(d); + + iommu_flush_all(); + + for_each_drhd_unit ( drhd ) + { + iommu = drhd->iommu; + if ( iommu_enable_translation(iommu) ) + return -EIO; + } + } + return 0; } @@ -1153,28 +1119,15 @@ static int domain_context_mapping_one( struct hvm_iommu *hd = domain_hvm_iommu(domain); struct context_entry *context, *context_entries; unsigned long flags; - int ret = 0; u64 maddr; maddr = bus_to_context_maddr(iommu, bus); context_entries = (struct context_entry *)map_vtd_domain_page(maddr); context = &context_entries[devfn]; - if ( !context ) + + if ( context_present(*context) ) { unmap_vtd_domain_page(context_entries); - gdprintk(XENLOG_ERR VTDPREFIX, - "domain_context_mapping_one:context == NULL:" - "bdf = %x:%x:%x\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); - return -ENOMEM; - } - - if ( context_present(*context) ) - { - unmap_vtd_domain_page(context_entries); - gdprintk(XENLOG_WARNING VTDPREFIX, - "domain_context_mapping_one:context present:bdf=%x:%x:%x\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); return 0; } @@ -1203,12 +1156,6 @@ static int domain_context_mapping_one( context_set_present(*context); iommu_flush_cache_entry(iommu, context); - gdprintk(XENLOG_INFO VTDPREFIX, - "domain_context_mapping_one-%x:%x:%x-*context=%"PRIx64":%"PRIx64 - " hd->pgd_maddr=%"PRIx64"\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn), - context->hi, context->lo, hd->pgd_maddr); - unmap_vtd_domain_page(context_entries); if ( iommu_flush_context_device(iommu, domain_iommu_domid(domain), @@ -1218,7 +1165,8 @@ static int domain_context_mapping_one( else iommu_flush_iotlb_dsi(iommu, domain_iommu_domid(domain), 0); spin_unlock_irqrestore(&iommu->lock, flags); - return ret; + + return 0; } static int __pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap) @@ -1377,28 +1325,12 @@ static int domain_context_unmap_one( maddr = bus_to_context_maddr(iommu, bus); context_entries = (struct context_entry *)map_vtd_domain_page(maddr); context = &context_entries[devfn]; - if ( !context ) + + if ( !context_present(*context) ) { unmap_vtd_domain_page(context_entries); - gdprintk(XENLOG_ERR VTDPREFIX, - "domain_context_unmap_one-%x:%x:%x- context == NULL:return\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); - return -ENOMEM; - } - - if ( !context_present(*context) ) - { - unmap_vtd_domain_page(context_entries); - gdprintk(XENLOG_WARNING VTDPREFIX, - "domain_context_unmap_one-%x:%x:%x- " - "context NOT present:return\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); return 0; } - - gdprintk(XENLOG_INFO VTDPREFIX, - "domain_context_unmap_one: bdf = %x:%x:%x\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); spin_lock_irqsave(&iommu->lock, flags); context_clear_present(*context); @@ -1431,24 +1363,12 @@ static int domain_context_unmap( sub_bus = pci_conf_read8( pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), PCI_SUBORDINATE_BUS); - - gdprintk(XENLOG_INFO VTDPREFIX, - "domain_context_unmap:BRIDGE:%x:%x:%x " - "sec_bus=%x sub_bus=%x\n", - pdev->bus, PCI_SLOT(pdev->devfn), - PCI_FUNC(pdev->devfn), sec_bus, sub_bus); break; case DEV_TYPE_PCIe_ENDPOINT: - gdprintk(XENLOG_INFO VTDPREFIX, - "domain_context_unmap:PCIe : bdf = %x:%x:%x\n", - pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); ret = domain_context_unmap_one(domain, iommu, (u8)(pdev->bus), (u8)(pdev->devfn)); break; case DEV_TYPE_PCI: - gdprintk(XENLOG_INFO VTDPREFIX, - "domain_context_unmap:PCI: bdf = %x:%x:%x\n", - pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); if ( pdev->bus == 0 ) ret = domain_context_unmap_one( domain, iommu, @@ -1502,35 +1422,29 @@ void reassign_device_ownership( int status; unsigned long flags; - gdprintk(XENLOG_INFO VTDPREFIX, - "reassign_device-%x:%x:%x- source = %d target = %d\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn), - source->domain_id, target->domain_id); - pdev_flr(bus, devfn); for_each_pdev( source, pdev ) - { - if ( (pdev->bus != bus) || (pdev->devfn != devfn) ) - continue; - - drhd = acpi_find_matched_drhd_unit(pdev); - iommu = drhd->iommu; - domain_context_unmap(source, iommu, pdev); - - /* Move pci device from the source domain to target domain. */ - spin_lock_irqsave(&source_hd->iommu_list_lock, flags); - spin_lock_irqsave(&target_hd->iommu_list_lock, flags); - list_move(&pdev->list, &target_hd->pdev_list); - spin_unlock_irqrestore(&target_hd->iommu_list_lock, flags); - spin_unlock_irqrestore(&source_hd->iommu_list_lock, flags); - - status = domain_context_mapping(target, iommu, pdev); - if ( status != 0 ) - gdprintk(XENLOG_ERR VTDPREFIX, "domain_context_mapping failed\n"); - - break; - } + if ( (pdev->bus == bus) && (pdev->devfn == devfn) ) + goto found; + + return; + + found: + drhd = acpi_find_matched_drhd_unit(pdev); + iommu = drhd->iommu; + domain_context_unmap(source, iommu, pdev); + + /* Move pci device from the source domain to target domain. */ + spin_lock_irqsave(&source_hd->iommu_list_lock, flags); + spin_lock_irqsave(&target_hd->iommu_list_lock, flags); + list_move(&pdev->list, &target_hd->pdev_list); + spin_unlock_irqrestore(&target_hd->iommu_list_lock, flags); + spin_unlock_irqrestore(&source_hd->iommu_list_lock, flags); + + status = domain_context_mapping(target, iommu, pdev); + if ( status != 0 ) + gdprintk(XENLOG_ERR VTDPREFIX, "domain_context_mapping failed\n"); } void return_devices_to_dom0(struct domain *d) @@ -1541,9 +1455,6 @@ void return_devices_to_dom0(struct domai while ( !list_empty(&hd->pdev_list) ) { pdev = list_entry(hd->pdev_list.next, typeof(*pdev), list); - dprintk(XENLOG_INFO VTDPREFIX, - "return_devices_to_dom0: bdf = %x:%x:%x\n", - pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); reassign_device_ownership(d, dom0, pdev->bus, pdev->devfn); } @@ -1600,7 +1511,7 @@ int intel_iommu_map_page( return 0; #endif - pg_maddr = addr_to_dma_page_maddr(d, gfn << PAGE_SHIFT_4K); + pg_maddr = addr_to_dma_page_maddr(d, (paddr_t)gfn << PAGE_SHIFT_4K); if ( pg_maddr == 0 ) return -ENOMEM; page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); @@ -1643,11 +1554,11 @@ int intel_iommu_unmap_page(struct domain } int iommu_page_mapping(struct domain *domain, paddr_t iova, - void *hpa, size_t size, int prot) + paddr_t hpa, size_t size, int prot) { struct acpi_drhd_unit *drhd; struct iommu *iommu; - unsigned long start_pfn, end_pfn; + u64 start_pfn, end_pfn; struct dma_pte *page = NULL, *pte = NULL; int index; u64 pg_maddr; @@ -1657,9 +1568,8 @@ int iommu_page_mapping(struct domain *do if ( (prot & (DMA_PTE_READ|DMA_PTE_WRITE)) == 0 ) return -EINVAL; iova = (iova >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K; - start_pfn = (unsigned long)(((unsigned long) hpa) >> PAGE_SHIFT_4K); - end_pfn = (unsigned long) - ((PAGE_ALIGN_4K(((unsigned long)hpa) + size)) >> PAGE_SHIFT_4K); + start_pfn = hpa >> PAGE_SHIFT_4K; + end_pfn = (PAGE_ALIGN_4K(hpa + size)) >> PAGE_SHIFT_4K; index = 0; while ( start_pfn < end_pfn ) { @@ -1668,7 +1578,7 @@ int iommu_page_mapping(struct domain *do return -ENOMEM; page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); pte = page + (start_pfn & LEVEL_MASK); - dma_set_pte_addr(*pte, start_pfn << PAGE_SHIFT_4K); + dma_set_pte_addr(*pte, (paddr_t)start_pfn << PAGE_SHIFT_4K); dma_set_pte_prot(*pte, prot); iommu_flush_cache_entry(iommu, pte); unmap_vtd_domain_page(page); @@ -1727,7 +1637,7 @@ static int iommu_prepare_rmrr_dev( /* page table init */ size = rmrr->end_address - rmrr->base_address + 1; ret = iommu_page_mapping(d, rmrr->base_address, - (void *)rmrr->base_address, size, + rmrr->base_address, size, DMA_PTE_READ|DMA_PTE_WRITE); if ( ret ) return ret; @@ -1743,37 +1653,15 @@ static int iommu_prepare_rmrr_dev( return ret; } -void __init setup_dom0_devices(void) -{ - struct hvm_iommu *hd = domain_hvm_iommu(dom0); +static void setup_dom0_devices(struct domain *d) +{ + struct hvm_iommu *hd; struct acpi_drhd_unit *drhd; struct pci_dev *pdev; int bus, dev, func, ret; u32 l; -#ifdef DEBUG_VTD_CONTEXT_ENTRY - for ( bus = 0; bus < 256; bus++ ) - { - for ( dev = 0; dev < 32; dev++ ) - { - for ( func = 0; func < 8; func++ ) - { - struct context_entry *context; - struct pci_dev device; - - device.bus = bus; - device.devfn = PCI_DEVFN(dev, func); - drhd = acpi_find_matched_drhd_unit(&device); - context = device_to_context_entry(drhd->iommu, - bus, PCI_DEVFN(dev, func)); - if ( (context->lo != 0) || (context->hi != 0) ) - dprintk(XENLOG_INFO VTDPREFIX, - "setup_dom0_devices-%x:%x:%x- context not 0\n", - bus, dev, func); - } - } - } -#endif + hd = domain_hvm_iommu(d); for ( bus = 0; bus < 256; bus++ ) { @@ -1792,18 +1680,13 @@ void __init setup_dom0_devices(void) list_add_tail(&pdev->list, &hd->pdev_list); drhd = acpi_find_matched_drhd_unit(pdev); - ret = domain_context_mapping(dom0, drhd->iommu, pdev); + ret = domain_context_mapping(d, drhd->iommu, pdev); if ( ret != 0 ) gdprintk(XENLOG_ERR VTDPREFIX, "domain_context_mapping failed\n"); } } } - - for_each_pdev ( dom0, pdev ) - dprintk(XENLOG_INFO VTDPREFIX, - "setup_dom0_devices: bdf = %x:%x:%x\n", - pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); } void clear_fault_bits(struct iommu *iommu) @@ -1850,13 +1733,6 @@ static int init_vtd_hw(void) flush->context = flush_context_reg; flush->iotlb = flush_iotlb_reg; } - return 0; -} - -static int init_vtd2_hw(void) -{ - struct acpi_drhd_unit *drhd; - struct iommu *iommu; for_each_drhd_unit ( drhd ) { @@ -1873,52 +1749,38 @@ static int init_vtd2_hw(void) dprintk(XENLOG_ERR VTDPREFIX, "Interrupt Remapping hardware not found\n"); } - return 0; -} - -static int enable_vtd_translation(void) -{ - struct acpi_drhd_unit *drhd; - struct iommu *iommu; - - for_each_drhd_unit ( drhd ) - { - iommu = drhd->iommu; - if ( iommu_enable_translation(iommu) ) - return -EIO; - } - return 0; -} - -static void setup_dom0_rmrr(void) + + return 0; +} + +static void setup_dom0_rmrr(struct domain *d) { struct acpi_rmrr_unit *rmrr; struct pci_dev *pdev; int ret; for_each_rmrr_device ( rmrr, pdev ) - ret = iommu_prepare_rmrr_dev(dom0, rmrr, pdev); + ret = iommu_prepare_rmrr_dev(d, rmrr, pdev); if ( ret ) gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: mapping reserved region failed\n"); end_for_each_rmrr_device ( rmrr, pdev ) } -int iommu_setup(void) -{ - struct hvm_iommu *hd = domain_hvm_iommu(dom0); +int intel_vtd_setup(void) +{ struct acpi_drhd_unit *drhd; struct iommu *iommu; - unsigned long i; if ( !vtd_enabled ) - return 0; + return -ENODEV; spin_lock_init(&domid_bitmap_lock); - INIT_LIST_HEAD(&hd->pdev_list); - - /* setup clflush size */ clflush_size = get_clflush_size(); + + for_each_drhd_unit ( drhd ) + if ( iommu_alloc(drhd) != 0 ) + goto error; /* Allocate IO page directory page for the domain. */ drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); @@ -1933,27 +1795,15 @@ int iommu_setup(void) memset(domid_bitmap, 0, domid_bitmap_size / 8); set_bit(0, domid_bitmap); - /* setup 1:1 page table for dom0 */ - for ( i = 0; i < max_page; i++ ) - iommu_map_page(dom0, i, i); - init_vtd_hw(); - setup_dom0_devices(); - setup_dom0_rmrr(); - iommu_flush_all(); - enable_vtd_translation(); - init_vtd2_hw(); return 0; error: - printk("iommu_setup() failed\n"); for_each_drhd_unit ( drhd ) - { - iommu = drhd->iommu; - free_iommu(iommu); - } - return -EIO; + iommu_free(drhd); + vtd_enabled = 0; + return -ENOMEM; } /* @@ -1979,10 +1829,6 @@ int intel_iommu_assign_device(struct dom if ( list_empty(&acpi_drhd_units) ) return ret; - - gdprintk(XENLOG_INFO VTDPREFIX, - "assign_device: bus = %x dev = %x func = %x\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); reassign_device_ownership(dom0, d, bus, devfn); diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/vtd/utils.c --- a/xen/drivers/passthrough/vtd/utils.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/vtd/utils.c Thu Apr 24 14:08:29 2008 -0600 @@ -60,10 +60,10 @@ int vtd_hw_check(void) dprintk(XENLOG_WARNING VTDPREFIX, "*** vendor = %x device = %x revision = %x\n", vendor, device, revision); - vtd_enabled = 0; return -ENODEV; } } + return 0; } diff -r 239b44eeb2d6 -r dc510776dd59 xen/drivers/passthrough/vtd/x86/vtd.c --- a/xen/drivers/passthrough/vtd/x86/vtd.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c Thu Apr 24 14:08:29 2008 -0600 @@ -114,8 +114,6 @@ void hvm_dpci_isairq_eoi(struct domain * if ( --dpci->mirq[i].pending == 0 ) { spin_unlock(&dpci->dirq_lock); - gdprintk(XENLOG_INFO VTDPREFIX, - "hvm_dpci_isairq_eoi:: mirq = %x\n", i); stop_timer(&dpci->hvm_timer[irq_to_vector(i)]); pirq_guest_eoi(d, i); } @@ -130,8 +128,6 @@ void iommu_set_pgd(struct domain *d) { struct hvm_iommu *hd = domain_hvm_iommu(d); unsigned long p2m_table; - int level = agaw_to_level(hd->agaw); - l3_pgentry_t *l3e; p2m_table = mfn_x(pagetable_get_mfn(d->arch.phys_table)); @@ -153,12 +149,12 @@ void iommu_set_pgd(struct domain *d) return; } pgd_mfn = _mfn(dma_pte_addr(*dpte) >> PAGE_SHIFT_4K); - hd->pgd_maddr = mfn_x(pgd_mfn) << PAGE_SHIFT_4K; + hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K; unmap_domain_page(dpte); break; case VTD_PAGE_TABLE_LEVEL_4: pgd_mfn = _mfn(p2m_table); - hd->pgd_maddr = mfn_x(pgd_mfn) << PAGE_SHIFT_4K; + hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K; break; default: gdprintk(XENLOG_ERR VTDPREFIX, @@ -173,6 +169,8 @@ void iommu_set_pgd(struct domain *d) int i; u64 pmd_maddr; unsigned long flags; + l3_pgentry_t *l3e; + int level = agaw_to_level(hd->agaw); spin_lock_irqsave(&hd->mapping_lock, flags); hd->pgd_maddr = alloc_pgtable_maddr(); @@ -236,6 +234,8 @@ void iommu_set_pgd(struct domain *d) #elif CONFIG_PAGING_LEVELS == 4 mfn_t pgd_mfn; + l3_pgentry_t *l3e; + int level = agaw_to_level(hd->agaw); switch ( level ) { @@ -250,12 +250,12 @@ void iommu_set_pgd(struct domain *d) } pgd_mfn = _mfn(l3e_get_pfn(*l3e)); - hd->pgd_maddr = mfn_x(pgd_mfn) << PAGE_SHIFT_4K; + hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K; unmap_domain_page(l3e); break; case VTD_PAGE_TABLE_LEVEL_4: pgd_mfn = _mfn(p2m_table); - hd->pgd_maddr = mfn_x(pgd_mfn) << PAGE_SHIFT_4K; + hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K; break; default: gdprintk(XENLOG_ERR VTDPREFIX, diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/amd-iommu.h --- a/xen/include/asm-x86/amd-iommu.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/amd-iommu.h Thu Apr 24 14:08:29 2008 -0600 @@ -28,10 +28,9 @@ #define iommu_found() (!list_empty(&amd_iommu_head)) -extern int amd_iommu_enabled; extern struct list_head amd_iommu_head; -extern int __init amd_iommu_detect(void); +extern int __init amd_iov_detect(void); struct table_struct { void *buffer; @@ -79,6 +78,9 @@ struct amd_iommu { int exclusion_allow_all; uint64_t exclusion_base; uint64_t exclusion_limit; + + int msi_cap; + int maskbit; }; struct ivrs_mappings { diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/bitops.h --- a/xen/include/asm-x86/bitops.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/bitops.h Thu Apr 24 14:08:29 2008 -0600 @@ -331,10 +331,9 @@ extern unsigned int __find_next_zero_bit extern unsigned int __find_next_zero_bit( const unsigned long *addr, unsigned int size, unsigned int offset); -/* return index of first bit set in val or BITS_PER_LONG when no bit is set */ -static inline unsigned int __scanbit(unsigned long val) -{ - asm ( "bsf %1,%0" : "=r" (val) : "r" (val), "0" (BITS_PER_LONG) ); +static inline unsigned int __scanbit(unsigned long val, unsigned long max) +{ + asm ( "bsf %1,%0 ; cmovz %2,%0" : "=&r" (val) : "r" (val), "r" (max) ); return (unsigned int)val; } @@ -346,9 +345,9 @@ static inline unsigned int __scanbit(uns * Returns the bit-number of the first set bit, not the number of the byte * containing a bit. */ -#define find_first_bit(addr,size) \ -((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ - (__scanbit(*(const unsigned long *)addr)) : \ +#define find_first_bit(addr,size) \ +((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ + (__scanbit(*(const unsigned long *)addr, size)) : \ __find_first_bit(addr,size))) /** @@ -357,9 +356,9 @@ static inline unsigned int __scanbit(uns * @offset: The bitnumber to start searching at * @size: The maximum size to search */ -#define find_next_bit(addr,size,off) \ -((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ - ((off) + (__scanbit((*(const unsigned long *)addr) >> (off)))) : \ +#define find_next_bit(addr,size,off) \ +((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ + ((off) + (__scanbit((*(const unsigned long *)addr) >> (off), size))) : \ __find_next_bit(addr,size,off))) /** @@ -370,9 +369,9 @@ static inline unsigned int __scanbit(uns * Returns the bit-number of the first zero bit, not the number of the byte * containing a bit. */ -#define find_first_zero_bit(addr,size) \ -((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ - (__scanbit(~*(const unsigned long *)addr)) : \ +#define find_first_zero_bit(addr,size) \ +((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ + (__scanbit(~*(const unsigned long *)addr, size)) : \ __find_first_zero_bit(addr,size))) /** @@ -381,9 +380,9 @@ static inline unsigned int __scanbit(uns * @offset: The bitnumber to start searching at * @size: The maximum size to search */ -#define find_next_zero_bit(addr,size,off) \ -((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ - ((off)+(__scanbit(~(((*(const unsigned long *)addr)) >> (off))))) : \ +#define find_next_zero_bit(addr,size,off) \ +((__builtin_constant_p(size) && (size) <= BITS_PER_LONG ? \ + ((off)+(__scanbit(~(((*(const unsigned long *)addr)) >> (off)), size))) : \ __find_next_zero_bit(addr,size,off))) @@ -391,8 +390,7 @@ static inline unsigned int __scanbit(uns * find_first_set_bit - find the first set bit in @word * @word: the word to search * - * Returns the bit-number of the first set bit. If no bits are set then the - * result is undefined. + * Returns the bit-number of the first set bit. The input must *not* be zero. */ static inline unsigned int find_first_set_bit(unsigned long word) { @@ -401,26 +399,10 @@ static inline unsigned int find_first_se } /** - * ffz - find first zero in word. - * @word: The word to search - * - * Undefined if no zero exists, so code should check against ~0UL first. - */ -static inline unsigned long ffz(unsigned long word) -{ - asm ( "bsf %1,%0" - :"=r" (word) - :"r" (~word)); - return word; -} - -/** * ffs - find first bit set * @x: the word to search * - * This is defined the same way as - * the libc and compiler builtin ffs routines, therefore - * differs in spirit from the above ffz (man ffs). + * This is defined the same way as the libc and compiler builtin ffs routines. */ static inline int ffs(unsigned long x) { diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/hvm/hvm.h --- a/xen/include/asm-x86/hvm/hvm.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/hvm/hvm.h Thu Apr 24 14:08:29 2008 -0600 @@ -139,6 +139,8 @@ int hvm_vcpu_initialise(struct vcpu *v); int hvm_vcpu_initialise(struct vcpu *v); void hvm_vcpu_destroy(struct vcpu *v); void hvm_vcpu_down(struct vcpu *v); +int hvm_vcpu_cacheattr_init(struct vcpu *v); +void hvm_vcpu_cacheattr_destroy(struct vcpu *v); void hvm_send_assist_req(struct vcpu *v); diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/hvm/support.h --- a/xen/include/asm-x86/hvm/support.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/hvm/support.h Thu Apr 24 14:08:29 2008 -0600 @@ -130,5 +130,7 @@ int hvm_set_cr0(unsigned long value); int hvm_set_cr0(unsigned long value); int hvm_set_cr3(unsigned long value); int hvm_set_cr4(unsigned long value); +int hvm_msr_read_intercept(struct cpu_user_regs *regs); +int hvm_msr_write_intercept(struct cpu_user_regs *regs); #endif /* __ASM_X86_HVM_SUPPORT_H__ */ diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h --- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h Thu Apr 24 14:08:29 2008 -0600 @@ -35,6 +35,9 @@ /* IOMMU Command Buffer entries: in power of 2 increments, minimum of 256 */ #define IOMMU_CMD_BUFFER_DEFAULT_ENTRIES 512 +/* IOMMU Event Log entries: in power of 2 increments, minimum of 256 */ +#define IOMMU_EVENT_LOG_DEFAULT_ENTRIES 512 + #define BITMAP_ENTRIES_PER_BYTE 8 #define PTE_PER_TABLE_SHIFT 9 @@ -303,6 +306,11 @@ #define IOMMU_EVENT_COMMAND_HW_ERROR 0x6 #define IOMMU_EVENT_IOTLB_INV_TIMEOUT 0x7 #define IOMMU_EVENT_INVALID_DEV_REQUEST 0x8 + +#define IOMMU_EVENT_DOMAIN_ID_MASK 0x0000FFFF +#define IOMMU_EVENT_DOMAIN_ID_SHIFT 0 +#define IOMMU_EVENT_DEVICE_ID_MASK 0x0000FFFF +#define IOMMU_EVENT_DEVICE_ID_SHIFT 0 /* Control Register */ #define IOMMU_CONTROL_MMIO_OFFSET 0x18 @@ -427,4 +435,33 @@ #define IOMMU_IO_READ_ENABLED 1 #define HACK_BIOS_SETTINGS 0 +/* MSI interrupt */ +#define MSI_DATA_VECTOR_SHIFT 0 +#define MSI_DATA_VECTOR(v) (((u8)v) << MSI_DATA_VECTOR_SHIFT) + +#define MSI_DATA_DELIVERY_SHIFT 8 +#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_SHIFT) +#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_SHIFT) + +#define MSI_DATA_LEVEL_SHIFT 14 +#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT) +#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT) + +#define MSI_DATA_TRIGGER_SHIFT 15 +#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT) +#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT) + +#define MSI_TARGET_CPU_SHIFT 12 +#define MSI_ADDR_HEADER 0xfee00000 +#define MSI_ADDR_DESTID_MASK 0xfff0000f +#define MSI_ADDR_DESTID_CPU(cpu) ((cpu) << MSI_TARGET_CPU_SHIFT) + +#define MSI_ADDR_DESTMODE_SHIFT 2 +#define MSI_ADDR_DESTMODE_PHYS (0 << MSI_ADDR_DESTMODE_SHIFT) +#define MSI_ADDR_DESTMODE_LOGIC (1 << MSI_ADDR_DESTMODE_SHIFT) + +#define MSI_ADDR_REDIRECTION_SHIFT 3 +#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT) +#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT) + #endif /* _ASM_X86_64_AMD_IOMMU_DEFS_H */ diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h --- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h Thu Apr 24 14:08:29 2008 -0600 @@ -35,6 +35,19 @@ #define DMA_32BIT_MASK 0x00000000ffffffffULL #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK) +#ifdef AMD_IOV_DEBUG +#define amd_iov_info(fmt, args...) \ + printk(XENLOG_INFO "AMD_IOV: " fmt, ## args) +#define amd_iov_warning(fmt, args...) \ + printk(XENLOG_WARNING "AMD_IOV: " fmt, ## args) +#define amd_iov_error(fmt, args...) \ + printk(XENLOG_ERR "AMD_IOV: %s:%d: " fmt, __FILE__ , __LINE__ , ## args) +#else +#define amd_iov_info(fmt, args...) +#define amd_iov_warning(fmt, args...) +#define amd_iov_error(fmt, args...) +#endif + typedef int (*iommu_detect_callback_ptr_t)( u8 bus, u8 dev, u8 func, u8 cap_ptr); @@ -49,6 +62,7 @@ void __init unmap_iommu_mmio_region(stru void __init unmap_iommu_mmio_region(struct amd_iommu *iommu); void __init register_iommu_dev_table_in_mmio_space(struct amd_iommu *iommu); void __init register_iommu_cmd_buffer_in_mmio_space(struct amd_iommu *iommu); +void __init register_iommu_event_log_in_mmio_space(struct amd_iommu *iommu); void __init enable_iommu(struct amd_iommu *iommu); /* mapping functions */ @@ -69,11 +83,6 @@ void invalidate_dev_table_entry(struct a /* send cmd to iommu */ int send_iommu_command(struct amd_iommu *iommu, u32 cmd[]); void flush_command_buffer(struct amd_iommu *iommu); - -/* iommu domain funtions */ -int amd_iommu_domain_init(struct domain *domain); -void amd_iommu_setup_domain_device(struct domain *domain, - struct amd_iommu *iommu, int bdf); /* find iommu for bdf */ struct amd_iommu *find_iommu_for_device(int bus, int devfn); diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/hvm/vcpu.h --- a/xen/include/asm-x86/hvm/vcpu.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/hvm/vcpu.h Thu Apr 24 14:08:29 2008 -0600 @@ -83,7 +83,16 @@ struct hvm_vcpu { */ unsigned long mmio_gva; unsigned long mmio_gpfn; + /* Callback into x86_emulate when emulating FPU/MMX/XMM instructions. */ + void (*fpu_exception_callback)(void *, struct cpu_user_regs *); + void *fpu_exception_callback_arg; + /* We may read up to m128 as a number of device-model transactions. */ + paddr_t mmio_large_read_pa; + uint8_t mmio_large_read[16]; + unsigned int mmio_large_read_bytes; + /* We may write up to m128 as a number of device-model transactions. */ + paddr_t mmio_large_write_pa; + unsigned int mmio_large_write_bytes; }; #endif /* __ASM_X86_HVM_VCPU_H__ */ - diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/mtrr.h --- a/xen/include/asm-x86/mtrr.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/mtrr.h Thu Apr 24 14:08:29 2008 -0600 @@ -11,13 +11,6 @@ #define MTRR_TYPE_WRBACK 6 #define MTRR_NUM_TYPES 7 #define MEMORY_NUM_TYPES MTRR_NUM_TYPES - -#define MTRR_PHYSMASK_VALID_BIT 11 -#define MTRR_PHYSMASK_SHIFT 12 - -#define MTRR_PHYSBASE_TYPE_MASK 0xff /* lowest 8 bits */ -#define MTRR_PHYSBASE_SHIFT 12 -#define MTRR_VCNT 8 #define NORMAL_CACHE_MODE 0 #define NO_FILL_CACHE_MODE 2 @@ -58,7 +51,6 @@ struct mtrr_state { u64 mtrr_cap; /* ranges in var MSRs are overlapped or not:0(no overlapped) */ bool_t overlapped; - bool_t is_initialized; }; extern void mtrr_save_fixed_ranges(void *); diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/asm-x86/paging.h --- a/xen/include/asm-x86/paging.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/asm-x86/paging.h Thu Apr 24 14:08:29 2008 -0600 @@ -83,12 +83,14 @@ struct shadow_paging_mode { unsigned long new, unsigned int bytes, struct sh_emulate_ctxt *sh_ctxt); +#ifdef __i386__ int (*x86_emulate_cmpxchg8b )(struct vcpu *v, unsigned long va, unsigned long old_lo, unsigned long old_hi, unsigned long new_lo, unsigned long new_hi, struct sh_emulate_ctxt *sh_ctxt); +#endif mfn_t (*make_monitor_table )(struct vcpu *v); void (*destroy_monitor_table )(struct vcpu *v, mfn_t mmfn); int (*guess_wrmap )(struct vcpu *v, diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/public/xsm/acm.h --- a/xen/include/public/xsm/acm.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/public/xsm/acm.h Thu Apr 24 14:08:29 2008 -0600 @@ -91,7 +91,7 @@ * whenever the interpretation of the related * policy's data structure changes */ -#define ACM_POLICY_VERSION 3 +#define ACM_POLICY_VERSION 4 #define ACM_CHWALL_VERSION 1 #define ACM_STE_VERSION 1 @@ -131,6 +131,10 @@ typedef uint16_t domaintype_t; /* high-16 = version, low-16 = check magic */ #define ACM_MAGIC 0x0001debc +/* size of the SHA1 hash identifying the XML policy from which the + binary policy was created */ +#define ACM_SHA1_HASH_SIZE 20 + /* each offset in bytes from start of the struct they * are part of */ @@ -160,6 +164,7 @@ struct acm_policy_buffer { uint32_t secondary_policy_code; uint32_t secondary_buffer_offset; struct acm_policy_version xml_pol_version; /* add in V3 */ + uint8_t xml_policy_hash[ACM_SHA1_HASH_SIZE]; /* added in V4 */ }; diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/xen/iommu.h Thu Apr 24 14:08:29 2008 -0600 @@ -27,9 +27,8 @@ #include extern int vtd_enabled; -extern int amd_iommu_enabled; +extern int iommu_enabled; -#define iommu_enabled ( amd_iommu_enabled || vtd_enabled ) #define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu) #define domain_vmx_iommu(d) (&d->arch.hvm_domain.hvm_iommu.vmx_iommu) @@ -72,7 +71,6 @@ struct iommu { struct intel_iommu *intel; }; -int iommu_setup(void); int iommu_domain_init(struct domain *d); void iommu_domain_destroy(struct domain *d); int device_assigned(u8 bus, u8 devfn); diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/xen/serial.h --- a/xen/include/xen/serial.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/xen/serial.h Thu Apr 24 14:08:29 2008 -0600 @@ -16,12 +16,10 @@ void serial_set_rx_handler(int handle, s void serial_set_rx_handler(int handle, serial_rx_fn fn); /* Number of characters we buffer for a polling receiver. */ -#define SERIAL_RXBUFSZ 32 -#define MASK_SERIAL_RXBUF_IDX(_i) ((_i)&(SERIAL_RXBUFSZ-1)) +#define serial_rxbufsz 32 /* Number of characters we buffer for an interrupt-driven transmitter. */ -#define SERIAL_TXBUFSZ 16384 -#define MASK_SERIAL_TXBUF_IDX(_i) ((_i)&(SERIAL_TXBUFSZ-1)) +extern unsigned int serial_txbufsz; struct uart_driver; @@ -39,7 +37,7 @@ struct serial_port { /* Receiver callback functions (asynchronous receivers). */ serial_rx_fn rx_lo, rx_hi, rx; /* Receive data buffer (polling receivers). */ - char rxbuf[SERIAL_RXBUFSZ]; + char rxbuf[serial_rxbufsz]; unsigned int rxbufp, rxbufc; /* Serial I/O is concurrency-safe. */ spinlock_t rx_lock, tx_lock; diff -r 239b44eeb2d6 -r dc510776dd59 xen/include/xsm/acm/acm_core.h --- a/xen/include/xsm/acm/acm_core.h Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/include/xsm/acm/acm_core.h Thu Apr 24 14:08:29 2008 -0600 @@ -34,6 +34,7 @@ struct acm_binary_policy { u16 primary_policy_code; u16 secondary_policy_code; struct acm_policy_version xml_pol_version; + u8 xml_policy_hash[ACM_SHA1_HASH_SIZE]; }; struct chwall_binary_policy { diff -r 239b44eeb2d6 -r dc510776dd59 xen/tools/Makefile --- a/xen/tools/Makefile Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/tools/Makefile Thu Apr 24 14:08:29 2008 -0600 @@ -4,12 +4,12 @@ include $(XEN_ROOT)/Config.mk .PHONY: default default: - $(MAKE) -C figlet + [ -d figlet ] && $(MAKE) -C figlet $(MAKE) symbols .PHONY: clean clean: - $(MAKE) -C figlet clean + [ -d figlet ] && $(MAKE) -C figlet clean rm -f *.o symbols symbols: symbols.c diff -r 239b44eeb2d6 -r dc510776dd59 xen/tools/figlet/figlet.c --- a/xen/tools/figlet/figlet.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/tools/figlet/figlet.c Thu Apr 24 14:08:29 2008 -0600 @@ -1488,18 +1488,7 @@ static void myputchar(unsigned char c) putc(c, stderr); - if ( nr_chars == 0 ) - putchar('"'); - - putchar('\\'); - putchar('0' + ((c>>6)&7)); - putchar('0' + ((c>>3)&7)); - putchar('0' + ((c>>0)&7)); - - if ( c == '\n' ) - startline = 1; - - if ( ++nr_chars == 18 ) + if ( nr_chars == 18 ) { nr_chars = 0; putchar('"'); @@ -1507,6 +1496,17 @@ static void myputchar(unsigned char c) putchar('\\'); putchar('\n'); } + + if ( nr_chars++ == 0 ) + putchar('"'); + + putchar('\\'); + putchar('0' + ((c>>6)&7)); + putchar('0' + ((c>>3)&7)); + putchar('0' + ((c>>0)&7)); + + if ( c == '\n' ) + startline = 1; } void putstring(string) diff -r 239b44eeb2d6 -r dc510776dd59 xen/xsm/acm/acm_policy.c --- a/xen/xsm/acm/acm_policy.c Thu Apr 24 14:02:16 2008 -0600 +++ b/xen/xsm/acm/acm_policy.c Thu Apr 24 14:08:29 2008 -0600 @@ -156,6 +156,10 @@ _acm_update_policy(void *buf, u32 buf_si &pol->xml_pol_version, sizeof(acm_bin_pol.xml_pol_version)); + memcpy(&acm_bin_pol.xml_policy_hash, + pol->xml_policy_hash, + sizeof(acm_bin_pol.xml_policy_hash)); + if ( acm_primary_ops->is_default_policy() && acm_secondary_ops->is_default_policy() ) require_update = 0; @@ -257,6 +261,10 @@ acm_get_policy(XEN_GUEST_HANDLE_64(void) memcpy(&bin_pol->xml_pol_version, &acm_bin_pol.xml_pol_version, sizeof(struct acm_policy_version)); + + memcpy(&bin_pol->xml_policy_hash, + &acm_bin_pol.xml_policy_hash, + sizeof(acm_bin_pol.xml_policy_hash)); ret = acm_dump_policy_reference( policy_buffer + be32_to_cpu(bin_pol->policy_reference_offset), _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:30:54 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:30:54 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTni-0002Se-6x for www-data@colo.xensource.com; Tue, 20 May 2008 08:30:54 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToM-0007S3-GA; Tue, 20 May 2008 15:31:34 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnp-00079p-PK for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:01 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnj-0002zM-40 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:30:59 +0000 X-SBRS: 3.6 X-MesageID: 267629 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267629" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:06 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFU6bi029561 for ; Tue, 20 May 2008 08:30:06 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUOec032372 for ; Tue, 20 May 2008 08:30:24 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUOPn032371 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:24 -0700 Message-Id: <200805201530.m4KFUOPn032371@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:23 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] Remove regNaT fault message X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User KUWAMURA Shin'ya # Date 1207901130 -32400 # Node ID af327038a43f030cdc4e111188c6585ac740d79e # Parent 611787b6ca35fb43a811533316c799adae9cccdb [IA64] Remove regNaT fault message Signed-off-by: KUWAMURA Shin'ya --- xen/arch/ia64/xen/faults.c | 2 -- 1 files changed, 2 deletions(-) diff -r 611787b6ca35 -r af327038a43f xen/arch/ia64/xen/faults.c --- a/xen/arch/ia64/xen/faults.c Thu May 08 18:40:07 2008 +0900 +++ b/xen/arch/ia64/xen/faults.c Fri Apr 11 17:05:30 2008 +0900 @@ -626,8 +626,6 @@ ia64_handle_reflection(unsigned long ifa if (((isr >> 4L) & 0xfL) == 1) { /* Fault is due to a register NaT consumption fault. */ //regs->eml_unat = 0; FIXME: DO WE NEED THIS?? - printk("ia64_handle_reflection: handling regNaT " - "fault\n"); vector = IA64_NAT_CONSUMPTION_VECTOR; break; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:04 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:04 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTnn-0002Ss-UJ for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:04 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToS-0007Wk-04; Tue, 20 May 2008 15:31:40 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnq-0007AC-Rn for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:03 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnk-0002zQ-Q3 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:00 +0000 X-SBRS: 3.6 X-MesageID: 267628 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267628" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:05 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFU4aO029558 for ; Tue, 20 May 2008 08:30:04 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUMXd032334 for ; Tue, 20 May 2008 08:30:22 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUMdn032333 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:22 -0700 Message-Id: <200805201530.m4KFUMdn032333@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:20 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-SA-Exim-Scanned: No (on lists.xensource.com); Message bigger than SAmaxbody (256000) Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210239607 -32400 # Node ID 611787b6ca35fb43a811533316c799adae9cccdb # Parent f2457c7aff8d45949bc2c83876a7d26d0588663f # Parent 9a6ad687ec20dd84753e334b104a154738eae6ec merge with xen-unstable.hg --- xen/drivers/passthrough/pci_regs.h | 530 -------- xen/drivers/passthrough/vtd/msi.h | 127 - README | 25 docs/ChangeLog | 9 docs/misc/vtd.txt | 35 docs/src/user.tex | 4 extras/mini-os/blkfront.c | 18 extras/mini-os/fbfront.c | 35 extras/mini-os/fs-front.c | 6 extras/mini-os/include/lib.h | 6 extras/mini-os/include/xenbus.h | 11 extras/mini-os/netfront.c | 18 extras/mini-os/xenbus/xenbus.c | 37 tools/examples/xend-config-xenapi.sxp | 6 tools/examples/xend-config.sxp | 15 tools/examples/xmexample.hvm | 25 tools/ioemu/Makefile.target | 2 tools/ioemu/hw/cirrus_vga.c | 50 tools/ioemu/hw/pass-through.c | 54 tools/ioemu/hw/pass-through.h | 9 tools/ioemu/hw/pt-msi.c | 488 +++++++ tools/ioemu/hw/pt-msi.h | 65 tools/ioemu/hw/vga.c | 90 + tools/ioemu/hw/vga_int.h | 2 tools/ioemu/sdl.c | 3 tools/ioemu/vl.h | 1 tools/ioemu/vnc.c | 5 tools/libfsimage/Makefile | 2 tools/libfsimage/common/fsimage.c | 29 tools/libfsimage/common/fsimage.h | 6 tools/libfsimage/common/fsimage_grub.c | 4 tools/libfsimage/common/fsimage_grub.h | 8 tools/libfsimage/common/fsimage_priv.h | 3 tools/libfsimage/common/mapfile-GNU | 3 tools/libfsimage/common/mapfile-SunOS | 3 tools/libfsimage/zfs/Makefile | 37 tools/libfsimage/zfs/fsys_zfs.c | 1457 ++++++++++++++++++++++ tools/libfsimage/zfs/fsys_zfs.h | 203 +++ tools/libfsimage/zfs/mb_info.h | 217 +++ tools/libfsimage/zfs/zfs-include/dmu.h | 105 + tools/libfsimage/zfs/zfs-include/dmu_objset.h | 35 tools/libfsimage/zfs/zfs-include/dnode.h | 76 + tools/libfsimage/zfs/zfs-include/dsl_dataset.h | 53 tools/libfsimage/zfs/zfs-include/dsl_dir.h | 49 tools/libfsimage/zfs/zfs-include/spa.h | 283 ++++ tools/libfsimage/zfs/zfs-include/uberblock_impl.h | 49 tools/libfsimage/zfs/zfs-include/vdev_impl.h | 70 + tools/libfsimage/zfs/zfs-include/zap_impl.h | 110 + tools/libfsimage/zfs/zfs-include/zap_leaf.h | 100 + tools/libfsimage/zfs/zfs-include/zfs.h | 112 + tools/libfsimage/zfs/zfs-include/zfs_acl.h | 55 tools/libfsimage/zfs/zfs-include/zfs_znode.h | 68 + tools/libfsimage/zfs/zfs-include/zil.h | 51 tools/libfsimage/zfs/zfs-include/zio.h | 81 + tools/libfsimage/zfs/zfs-include/zio_checksum.h | 42 tools/libfsimage/zfs/zfs_fletcher.c | 93 + tools/libfsimage/zfs/zfs_lzjb.c | 60 tools/libfsimage/zfs/zfs_sha256.c | 124 + tools/libxc/Makefile | 1 tools/libxc/xc_cpufeature.h | 115 + tools/libxc/xc_cpuid_x86.c | 433 ++++++ tools/libxc/xc_domain.c | 26 tools/libxc/xc_minios.c | 4 tools/libxc/xc_misc.c | 31 tools/libxc/xc_pagetab.c | 2 tools/libxc/xc_physdev.c | 72 + tools/libxc/xc_private.h | 30 tools/libxc/xenctrl.h | 59 tools/pygrub/src/fsimage/fsimage.c | 24 tools/pygrub/src/pygrub | 18 tools/python/xen/lowlevel/xc/xc.c | 164 ++ tools/python/xen/util/acmpolicy.py | 165 ++ tools/python/xen/util/blkif.py | 8 tools/python/xen/util/bootloader.py | 25 tools/python/xen/util/pci.py | 87 + tools/python/xen/util/xsm/acm/acm.py | 4 tools/python/xen/util/xsm/flask/flask.py | 2 tools/python/xen/web/tcp.py | 40 tools/python/xen/xend/XendCheckpoint.py | 1 tools/python/xen/xend/XendConfig.py | 53 tools/python/xen/xend/XendDomain.py | 15 tools/python/xen/xend/XendDomainInfo.py | 13 tools/python/xen/xend/XendOptions.py | 11 tools/python/xen/xend/XendXSPolicyAdmin.py | 11 tools/python/xen/xend/image.py | 33 tools/python/xen/xend/server/SrvDomain.py | 1 tools/python/xen/xend/server/blkif.py | 3 tools/python/xen/xend/server/irqif.py | 7 tools/python/xen/xend/server/netif.py | 3 tools/python/xen/xend/server/pciif.py | 19 tools/python/xen/xend/server/relocate.py | 13 tools/python/xen/xm/addlabel.py | 10 tools/python/xen/xm/create.py | 35 tools/python/xen/xm/dry-run.py | 5 tools/python/xen/xm/main.py | 28 tools/python/xen/xm/migrate.py | 6 tools/python/xen/xm/xenapi_create.py | 4 tools/xenstore/xenstore_client.c | 5 tools/xenstore/xenstored_core.c | 30 xen/Makefile | 7 xen/arch/ia64/vmx/vmx_hypercall.c | 4 xen/arch/x86/Makefile | 1 xen/arch/x86/acpi/Makefile | 2 xen/arch/x86/acpi/boot.c | 24 xen/arch/x86/acpi/cpu_idle.c | 957 ++++++++++++++ xen/arch/x86/apic.c | 50 xen/arch/x86/domain.c | 48 xen/arch/x86/domctl.c | 44 xen/arch/x86/genapic/Makefile | 1 xen/arch/x86/genapic/delivery.c | 2 xen/arch/x86/genapic/probe.c | 2 xen/arch/x86/genapic/x2apic.c | 79 + xen/arch/x86/hvm/Makefile | 1 xen/arch/x86/hvm/hvm.c | 165 +- xen/arch/x86/hvm/i8254.c | 28 xen/arch/x86/hvm/stdvga.c | 55 xen/arch/x86/hvm/svm/emulate.c | 115 - xen/arch/x86/hvm/svm/svm.c | 131 - xen/arch/x86/hvm/vlapic.c | 7 xen/arch/x86/hvm/vmsi.c | 189 ++ xen/arch/x86/hvm/vmx/intr.c | 16 xen/arch/x86/hvm/vmx/vmx.c | 54 xen/arch/x86/hvm/vpt.c | 6 xen/arch/x86/i8259.c | 7 xen/arch/x86/io_apic.c | 79 + xen/arch/x86/irq.c | 33 xen/arch/x86/mm/p2m.c | 21 xen/arch/x86/mm/shadow/common.c | 171 ++ xen/arch/x86/mm/shadow/multi.c | 83 + xen/arch/x86/mm/shadow/private.h | 9 xen/arch/x86/mpparse.c | 13 xen/arch/x86/msi.c | 787 +++++++++++ xen/arch/x86/nmi.c | 5 xen/arch/x86/numa.c | 2 xen/arch/x86/pci.c | 58 xen/arch/x86/physdev.c | 354 +++++ xen/arch/x86/platform_hypercall.c | 23 xen/arch/x86/setup.c | 12 xen/arch/x86/shutdown.c | 2 xen/arch/x86/smp.c | 5 xen/arch/x86/smpboot.c | 97 - xen/arch/x86/time.c | 53 xen/arch/x86/traps.c | 3 xen/arch/x86/x86_64/Makefile | 2 xen/arch/x86/x86_64/cpu_idle.c | 128 + xen/arch/x86/x86_64/platform_hypercall.c | 4 xen/drivers/acpi/Makefile | 1 xen/drivers/acpi/hwregs.c | 339 ++++- xen/drivers/acpi/utglobal.c | 136 ++ xen/drivers/passthrough/amd/iommu_detect.c | 2 xen/drivers/passthrough/amd/iommu_init.c | 5 xen/drivers/passthrough/amd/pci_amd_iommu.c | 2 xen/drivers/passthrough/io.c | 126 + xen/drivers/passthrough/iommu.c | 2 xen/drivers/passthrough/vtd/dmar.c | 2 xen/drivers/passthrough/vtd/intremap.c | 4 xen/drivers/passthrough/vtd/iommu.c | 131 - xen/drivers/passthrough/vtd/iommu.h | 1 xen/drivers/passthrough/vtd/qinval.c | 4 xen/drivers/passthrough/vtd/utils.c | 39 xen/drivers/passthrough/vtd/x86/vtd.c | 4 xen/include/asm-ia64/config.h | 1 xen/include/asm-powerpc/types.h | 1 xen/include/asm-x86/apic.h | 105 + xen/include/asm-x86/apicdef.h | 19 xen/include/asm-x86/cpufeature.h | 2 xen/include/asm-x86/domain.h | 18 xen/include/asm-x86/fixmap.h | 3 xen/include/asm-x86/genapic.h | 14 xen/include/asm-x86/hvm/io.h | 1 xen/include/asm-x86/hvm/irq.h | 13 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h | 29 xen/include/asm-x86/hvm/svm/emulate.h | 11 xen/include/asm-x86/hvm/vlapic.h | 2 xen/include/asm-x86/hvm/vmx/vmx.h | 20 xen/include/asm-x86/hvm/vpt.h | 1 xen/include/asm-x86/irq.h | 6 xen/include/asm-x86/mach-generic/mach_apic.h | 6 xen/include/asm-x86/msi.h | 210 +++ xen/include/asm-x86/msr-index.h | 1 xen/include/asm-x86/pirq.h | 11 xen/include/asm-x86/processor.h | 6 xen/include/asm-x86/shadow.h | 6 xen/include/asm-x86/smp.h | 8 xen/include/asm-x86/types.h | 3 xen/include/public/domctl.h | 23 xen/include/public/hvm/hvm_op.h | 16 xen/include/public/io/xs_wire.h | 1 xen/include/public/physdev.h | 32 xen/include/public/platform.h | 65 xen/include/xen/iommu.h | 22 xen/include/xen/irq.h | 2 xen/include/xen/pci.h | 24 xen/include/xen/pci_regs.h | 530 ++++++++ xen/include/xen/sched.h | 3 xen/include/xen/time.h | 2 xen/include/xlat.lst | 5 197 files changed, 11293 insertions(+), 1546 deletions(-) diff -r f2457c7aff8d -r 611787b6ca35 README --- a/README Fri Apr 25 20:13:52 2008 +0900 +++ b/README Thu May 08 18:40:07 2008 +0900 @@ -1,10 +1,10 @@ ################################# - __ __ _____ ____ - \ \/ /___ _ __ |___ / |___ \ - \ // _ \ '_ \ |_ \ __) | - / \ __/ | | | ___) | / __/ - /_/\_\___|_| |_| |____(_)_____| - + __ __ _____ _____ + \ \/ /___ _ __ |___ / |___ / + \ // _ \ '_ \ |_ \ |_ \ + / \ __/ | | | ___) | ___) | + /_/\_\___|_| |_| |____(_)____/ + ################################# http://www.xen.org/ @@ -21,11 +21,10 @@ by the original Xen development team to by the original Xen development team to build enterprise products around Xen. -The 3.2 release offers excellent performance, hardware support and +The 3.3 release offers excellent performance, hardware support and enterprise-grade features such as x86_32-PAE, x86_64, SMP guests and -live relocation of VMs. This install tree contains source for a Linux -2.6 guest; ports to Linux 2.4, NetBSD, FreeBSD and Solaris are -available from the community. +live relocation of VMs. Ports to Linux 2.6, Linux 2.4, NetBSD, FreeBSD +and Solaris are available from the community. This file contains some quick-start instructions to install Xen on your system. For full documentation, see the Xen User Manual. If this @@ -55,8 +54,8 @@ 2. Configure your bootloader to boot Xen /boot/grub/menu.lst: edit this file to include an entry like the following: - title Xen 3.2 / XenLinux 2.6 - kernel /boot/xen-3.2.gz console=vga + title Xen 3.3 / XenLinux 2.6 + kernel /boot/xen-3.3.gz console=vga module /boot/vmlinuz-2.6-xen root= ro console=tty0 module /boot/initrd-2.6-xen.img @@ -75,7 +74,7 @@ 2. Configure your bootloader to boot Xen 32MB memory for internal use, which is not available for allocation to virtual machines. -3. Reboot your system and select the "Xen 3.2 / XenLinux 2.6" menu +3. Reboot your system and select the "Xen 3.3 / XenLinux 2.6" menu option. After booting Xen, Linux will start and your initialisation scripts should execute in the usual way. diff -r f2457c7aff8d -r 611787b6ca35 docs/ChangeLog --- a/docs/ChangeLog Fri Apr 25 20:13:52 2008 +0900 +++ b/docs/ChangeLog Thu May 08 18:40:07 2008 +0900 @@ -15,6 +15,15 @@ http://lists.xensource.com/archives/html Xen 3.3 release --------------- + +17538: Add XENPF_set_processor_pminfo +http://xenbits.xensource.com/xen-unstable.hg?rev/5bb9093eb0e9 + +17537: Add MSI support +http://xenbits.xensource.com/xen-unstable.hg?rev/ad55c06c9bbc + +17524: Add DOMCTL_set_cpuid to configure guest CPUID on x86 systems. +http://xenbits.xensource.com/xen-unstable.hg?rev/18727843db60 17336: Add platform capabilities field to XEN_SYSCTL_physinfo http://xenbits.xensource.com/xen-unstable.hg?rev/250606290439 diff -r f2457c7aff8d -r 611787b6ca35 docs/misc/vtd.txt --- a/docs/misc/vtd.txt Fri Apr 25 20:13:52 2008 +0900 +++ b/docs/misc/vtd.txt Thu May 08 18:40:07 2008 +0900 @@ -2,7 +2,7 @@ Authors : Allen Kay Weidong Han Created : October-24-2007 -Updated : December-13-2007 +Updated : May-07-2008 How to turn on VT-d in Xen -------------------------- @@ -22,7 +22,7 @@ title Xen-Fedora Core (2.6.18-xen) title Xen-Fedora Core (2.6.18-xen) root (hd0,0) kernel /boot/xen.gz com1=115200,8n1 console=com1 - module /boot/vmlinuz-2.6.18.8-xen root=LABEL=/ ro console=tty0 console=ttyS0,115200,8n1 pciback.hide=(01:00.0)(03:00.0) pciback.verbose_request=1 apic=debug + module /boot/vmlinuz-2.6.18.8-xen root=LABEL=/ ro xencons=ttyS console=tty0 console=ttyS0, pciback.hide=(01:00.0)(03:00.0) module /boot/initrd-2.6.18-xen.img 12) reboot system @@ -47,14 +47,39 @@ 1) Host OS: PAE, 64-bit 1) Host OS: PAE, 64-bit 2) Guest OS: 32-bit, PAE, 64-bit -Because current Xen doesn't support MSI, for guest OS which uses MSI by default, need to add "pci=nomsi" option on its grub, e.g. RHEL5, FC6. - Combinations Tested: -------------------- 1) 64-bit host: 32/PAE/64 Linux/XP/Win2003/Vista guests 2) PAE host: 32/PAE Linux/XP/Win2003/Vista guests + + +VTd device hotplug: +------------------- + +2 virtual PCI slots (6~7) are reserved in HVM guest to support VTd hotplug. If you have more VTd devices, only 2 of them can support hotplug. Usage is simple: + + 1. List the VTd device by dom. You can see a VTd device 0:2:0.0 is inserted in the HVM domain's PCI slot 6. '''lspci''' inside the guest should see the same. + + [root@vt-vtd ~]# xm pci-list HVMDomainVtd + VSlt domain bus slot func + 0x6 0x0 0x02 0x00 0x0 + + 2. Detach the device from the guest by the physical BDF. Then HVM guest will receive a virtual PCI hot removal event to detach the physical device + + [root@vt-vtd ~]# xm pci-detach HVMDomainVtd 0:2:0.0 + + 3. Attach a PCI device to the guest by the physical BDF and desired virtual slot(optional). Following command would insert the physical device into guest's virtual slot 7 + + [root@vt-vtd ~]# xm pci-attach HVMDomainVtd 0:2:0.0 7 + +VTd hotplug usage model: +------------------------ + + * For live migration: As you know, VTd device would break the live migration as physical device can't be save/restored like virtual device. With hotplug, live migration is back again. Just hot remove all the VTd devices before live migration and hot add new VTd devices on target machine after live migration. + + * VTd hotplug for device switch: VTd hotplug can be used to dynamically switch physical device between different HVM guest without shutdown. VT-d Enabled Systems @@ -74,3 +99,5 @@ http://www.dell.com/content/products/cat - HP Compaq: DC7800 http://h10010.www1.hp.com/wwpc/us/en/en/WF04a/12454-12454-64287-321860-3328898.html +For more information, pls refer to http://wiki.xensource.com/xenwiki/VTdHowTo. + diff -r f2457c7aff8d -r 611787b6ca35 docs/src/user.tex --- a/docs/src/user.tex Fri Apr 25 20:13:52 2008 +0900 +++ b/docs/src/user.tex Thu May 08 18:40:07 2008 +0900 @@ -2459,9 +2459,7 @@ file. Please refer to Section~\ref{subse file. Please refer to Section~\ref{subsection:acmlabelmanageddomains} if you are using managed domains. -The following configuration file defines \verb|domain1| -(Note: www.jailtime.org or www.xen-get.org might be good -places to look for example domU images): +The following configuration file defines \verb|domain1|: \begin{scriptsize} \begin{verbatim} diff -r f2457c7aff8d -r 611787b6ca35 extras/mini-os/blkfront.c --- a/extras/mini-os/blkfront.c Fri Apr 25 20:13:52 2008 +0900 +++ b/extras/mini-os/blkfront.c Thu May 08 18:40:07 2008 +0900 @@ -50,6 +50,8 @@ struct blkfront_dev { char *backend; struct blkfront_info info; + xenbus_event_queue events; + #ifdef HAVE_LIBC int fd; #endif @@ -100,6 +102,8 @@ struct blkfront_dev *init_blkfront(char FRONT_RING_INIT(&dev->ring, s, PAGE_SIZE); dev->ring_ref = gnttab_grant_access(dev->dom,virt_to_mfn(s),0); + + dev->events = NULL; // FIXME: proper frees on failures again: @@ -166,11 +170,9 @@ done: snprintf(path, sizeof(path), "%s/state", dev->backend); - xenbus_watch_path(XBT_NIL, path); - - xenbus_wait_for_value(path,"4"); - - xenbus_unwatch_path(XBT_NIL, path); + xenbus_watch_path_token(XBT_NIL, path, path, &dev->events); + + xenbus_wait_for_value(path, "4", &dev->events); snprintf(path, sizeof(path), "%s/info", dev->backend); dev->info.info = xenbus_read_integer(path); @@ -211,10 +213,12 @@ void shutdown_blkfront(struct blkfront_d snprintf(path, sizeof(path), "%s/state", dev->backend); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */ - xenbus_wait_for_value(path,"5"); + xenbus_wait_for_value(path, "5", &dev->events); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6); - xenbus_wait_for_value(path,"6"); + xenbus_wait_for_value(path, "6", &dev->events); + + xenbus_unwatch_path(XBT_NIL, path); unbind_evtchn(dev->evtchn); diff -r f2457c7aff8d -r 611787b6ca35 extras/mini-os/fbfront.c --- a/extras/mini-os/fbfront.c Fri Apr 25 20:13:52 2008 +0900 +++ b/extras/mini-os/fbfront.c Thu May 08 18:40:07 2008 +0900 @@ -31,6 +31,8 @@ struct kbdfront_dev { char *nodename; char *backend; + xenbus_event_queue events; + #ifdef HAVE_LIBC int fd; #endif @@ -75,6 +77,8 @@ struct kbdfront_dev *init_kbdfront(char dev->page = s = (struct xenkbd_page*) alloc_page(); memset(s,0,PAGE_SIZE); + dev->events = NULL; + s->in_cons = s->in_prod = 0; s->out_cons = s->out_prod = 0; @@ -136,11 +140,9 @@ done: snprintf(path, sizeof(path), "%s/state", dev->backend); - xenbus_watch_path(XBT_NIL, path); - - xenbus_wait_for_value(path,"4"); - - xenbus_unwatch_path(XBT_NIL, path); + xenbus_watch_path_token(XBT_NIL, path, path, &dev->events); + + xenbus_wait_for_value(path, "4", &dev->events); printk("%s connected\n", dev->backend); @@ -199,10 +201,12 @@ void shutdown_kbdfront(struct kbdfront_d snprintf(path, sizeof(path), "%s/state", dev->backend); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */ - xenbus_wait_for_value(path,"5"); + xenbus_wait_for_value(path, "5", &dev->events); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6); - xenbus_wait_for_value(path,"6"); + xenbus_wait_for_value(path, "6", &dev->events); + + xenbus_unwatch_path(XBT_NIL, path); unbind_evtchn(dev->evtchn); @@ -249,6 +253,8 @@ struct fbfront_dev { int stride; int mem_length; int offset; + + xenbus_event_queue events; }; void fbfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) @@ -292,6 +298,7 @@ struct fbfront_dev *init_fbfront(char *n dev->stride = s->line_length = stride; dev->mem_length = s->mem_length = n * PAGE_SIZE; dev->offset = 0; + dev->events = NULL; const int max_pd = sizeof(s->pd) / sizeof(s->pd[0]); unsigned long mapped = 0; @@ -368,13 +375,11 @@ done: snprintf(path, sizeof(path), "%s/state", dev->backend); - xenbus_watch_path(XBT_NIL, path); - - xenbus_wait_for_value(path,"4"); + xenbus_watch_path_token(XBT_NIL, path, path, &dev->events); + + xenbus_wait_for_value(path, "4", &dev->events); printk("%s connected\n", dev->backend); - - xenbus_unwatch_path(XBT_NIL, path); snprintf(path, sizeof(path), "%s/request-update", dev->backend); dev->request_update = xenbus_read_integer(path); @@ -463,10 +468,12 @@ void shutdown_fbfront(struct fbfront_dev snprintf(path, sizeof(path), "%s/state", dev->backend); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */ - xenbus_wait_for_value(path,"5"); + xenbus_wait_for_value(path, "5", &dev->events); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6); - xenbus_wait_for_value(path,"6"); + xenbus_wait_for_value(path, "6", &dev->events); + + xenbus_unwatch_path(XBT_NIL, path); unbind_evtchn(dev->evtchn); diff -r f2457c7aff8d -r 611787b6ca35 extras/mini-os/fs-front.c --- a/extras/mini-os/fs-front.c Fri Apr 25 20:13:52 2008 +0900 +++ b/extras/mini-os/fs-front.c Thu May 08 18:40:07 2008 +0900 @@ -917,6 +917,7 @@ static int init_fs_import(struct fs_impo struct fsif_sring *sring; int retry = 0; domid_t self_id; + xenbus_event_queue events = NULL; printk("Initialising FS fortend to backend dom %d\n", import->dom_id); /* Allocate page for the shared ring */ @@ -1026,8 +1027,9 @@ done: sprintf(r_nodename, "%s/state", import->backend); sprintf(token, "fs-front-%d", import->import_id); /* The token will not be unique if multiple imports are inited */ - xenbus_watch_path(XBT_NIL, r_nodename/*, token*/); - xenbus_wait_for_value(/*token,*/ r_nodename, STATE_READY); + xenbus_watch_path_token(XBT_NIL, r_nodename, r_nodename, &events); + xenbus_wait_for_value(r_nodename, STATE_READY, &events); + xenbus_unwatch_path(XBT_NIL, r_nodename); printk("Backend ready.\n"); //create_thread("fs-tester", test_fs_import, import); diff -r f2457c7aff8d -r 611787b6ca35 extras/mini-os/include/lib.h --- a/extras/mini-os/include/lib.h Fri Apr 25 20:13:52 2008 +0900 +++ b/extras/mini-os/include/lib.h Thu May 08 18:40:07 2008 +0900 @@ -162,7 +162,7 @@ extern struct file { * wakes select for this FD. */ struct { evtchn_port_t port; - volatile unsigned long pending; + unsigned long pending; int bound; } ports[MAX_EVTCHN_PORTS]; } evtchn; @@ -178,10 +178,10 @@ extern struct file { struct { /* To each xenbus FD is associated a queue of watch events for this * FD. */ - struct xenbus_event *volatile events; + xenbus_event_queue events; } xenbus; }; - volatile int read; /* maybe available for read */ + int read; /* maybe available for read */ } files[]; int alloc_fd(enum fd_type type); diff -r f2457c7aff8d -r 611787b6ca35 extras/mini-os/include/xenbus.h --- a/extras/mini-os/include/xenbus.h Fri Apr 25 20:13:52 2008 +0900 +++ b/extras/mini-os/include/xenbus.h Thu May 08 18:40:07 2008 +0900 @@ -19,17 +19,18 @@ struct xenbus_event { char *token; struct xenbus_event *next; }; +typedef struct xenbus_event *xenbus_event_queue; -char *xenbus_watch_path_token(xenbus_transaction_t xbt, const char *path, const char *token, struct xenbus_event *volatile *events); +char *xenbus_watch_path_token(xenbus_transaction_t xbt, const char *path, const char *token, xenbus_event_queue *events); char *xenbus_unwatch_path_token(xenbus_transaction_t xbt, const char *path, const char *token); extern struct wait_queue_head xenbus_watch_queue; -void xenbus_wait_for_watch(void); -char **xenbus_wait_for_watch_return(void); -char* xenbus_wait_for_value(const char *path, const char *value); +void xenbus_wait_for_watch(xenbus_event_queue *queue); +char **xenbus_wait_for_watch_return(xenbus_event_queue *queue); +char* xenbus_wait_for_value(const char *path, const char *value, xenbus_event_queue *queue); /* When no token is provided, use a global queue. */ #define XENBUS_WATCH_PATH_TOKEN "xenbus_watch_path" -extern struct xenbus_event * volatile xenbus_events; +extern xenbus_event_queue xenbus_events; #define xenbus_watch_path(xbt, path) xenbus_watch_path_token(xbt, path, XENBUS_WATCH_PATH_TOKEN, NULL) #define xenbus_unwatch_path(xbt, path) xenbus_unwatch_path_token(xbt, path, XENBUS_WATCH_PATH_TOKEN) diff -r f2457c7aff8d -r 611787b6ca35 extras/mini-os/netfront.c --- a/extras/mini-os/netfront.c Fri Apr 25 20:13:52 2008 +0900 +++ b/extras/mini-os/netfront.c Thu May 08 18:40:07 2008 +0900 @@ -52,6 +52,8 @@ struct netfront_dev { char *nodename; char *backend; + + xenbus_event_queue events; #ifdef HAVE_LIBC int fd; @@ -328,6 +330,8 @@ struct netfront_dev *init_netfront(char dev->netif_rx = thenetif_rx; + dev->events = NULL; + // FIXME: proper frees on failures again: err = xenbus_transaction_start(&xbt); @@ -399,11 +403,9 @@ done: char path[strlen(dev->backend) + 1 + 5 + 1]; snprintf(path, sizeof(path), "%s/state", dev->backend); - xenbus_watch_path(XBT_NIL, path); - - xenbus_wait_for_value(path,"4"); - - xenbus_unwatch_path(XBT_NIL, path); + xenbus_watch_path_token(XBT_NIL, path, path, &dev->events); + + xenbus_wait_for_value(path, "4", &dev->events); if (ip) { snprintf(path, sizeof(path), "%s/ip", dev->backend); @@ -458,10 +460,12 @@ void shutdown_netfront(struct netfront_d snprintf(path, sizeof(path), "%s/state", dev->backend); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 5); /* closing */ - xenbus_wait_for_value(path,"5"); + xenbus_wait_for_value(path, "5", &dev->events); err = xenbus_printf(XBT_NIL, nodename, "state", "%u", 6); - xenbus_wait_for_value(path,"6"); + xenbus_wait_for_value(path, "6", &dev->events); + + xenbus_unwatch_path(XBT_NIL, path); unbind_evtchn(dev->evtchn); diff -r f2457c7aff8d -r 611787b6ca35 extras/mini-os/xenbus/xenbus.c --- a/extras/mini-os/xenbus/xenbus.c Fri Apr 25 20:13:52 2008 +0900 +++ b/extras/mini-os/xenbus/xenbus.c Thu May 08 18:40:07 2008 +0900 @@ -45,10 +45,10 @@ static DECLARE_WAIT_QUEUE_HEAD(xb_waitq) static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); DECLARE_WAIT_QUEUE_HEAD(xenbus_watch_queue); -struct xenbus_event *volatile xenbus_events; +xenbus_event_queue xenbus_events; static struct watch { char *token; - struct xenbus_event *volatile *events; + xenbus_event_queue *events; struct watch *next; } *watches; struct xenbus_req_info @@ -75,28 +75,34 @@ static void memcpy_from_ring(const void memcpy(dest + c1, ring, c2); } -char **xenbus_wait_for_watch_return() +char **xenbus_wait_for_watch_return(xenbus_event_queue *queue) { struct xenbus_event *event; + if (!queue) + queue = &xenbus_events; DEFINE_WAIT(w); - while (!(event = xenbus_events)) { + while (!(event = *queue)) { add_waiter(w, xenbus_watch_queue); schedule(); } remove_waiter(w); - xenbus_events = event->next; + *queue = event->next; return &event->path; } -void xenbus_wait_for_watch(void) +void xenbus_wait_for_watch(xenbus_event_queue *queue) { char **ret; - ret = xenbus_wait_for_watch_return(); + if (!queue) + queue = &xenbus_events; + ret = xenbus_wait_for_watch_return(queue); free(ret); } -char* xenbus_wait_for_value(const char* path, const char* value) -{ +char* xenbus_wait_for_value(const char* path, const char* value, xenbus_event_queue *queue) +{ + if (!queue) + queue = &xenbus_events; for(;;) { char *res, *msg; @@ -109,7 +115,7 @@ char* xenbus_wait_for_value(const char* free(res); if(r==0) break; - else xenbus_wait_for_watch(); + else xenbus_wait_for_watch(queue); } return NULL; } @@ -147,8 +153,8 @@ static void xenbus_thread_func(void *ign if(msg.type == XS_WATCH_EVENT) { - struct xenbus_event *event = malloc(sizeof(*event) + msg.len), - *volatile *events = NULL; + struct xenbus_event *event = malloc(sizeof(*event) + msg.len); + xenbus_event_queue *events = NULL; char *data = (char*)event + sizeof(*event); struct watch *watch; @@ -167,8 +173,6 @@ static void xenbus_thread_func(void *ign events = watch->events; break; } - if (!events) - events = &xenbus_events; event->next = *events; *events = event; @@ -463,7 +467,7 @@ char *xenbus_write(xenbus_transaction_t return NULL; } -char* xenbus_watch_path_token( xenbus_transaction_t xbt, const char *path, const char *token, struct xenbus_event *volatile *events) +char* xenbus_watch_path_token( xenbus_transaction_t xbt, const char *path, const char *token, xenbus_event_queue *events) { struct xsd_sockmsg *rep; @@ -473,6 +477,9 @@ char* xenbus_watch_path_token( xenbus_tr }; struct watch *watch = malloc(sizeof(*watch)); + + if (!events) + events = &xenbus_events; watch->token = strdup(token); watch->events = events; diff -r f2457c7aff8d -r 611787b6ca35 tools/examples/xend-config-xenapi.sxp --- a/tools/examples/xend-config-xenapi.sxp Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/examples/xend-config-xenapi.sxp Thu May 08 18:40:07 2008 +0900 @@ -66,9 +66,9 @@ # Address and port xend should use for the legacy TCP XMLRPC interface, -# if xen-tcp-xmlrpc-server is set. -#(xen-tcp-xmlrpc-server-address 'localhost') -#(xen-tcp-xmlrpc-server-port 8006) +# if xend-tcp-xmlrpc-server is set. +#(xend-tcp-xmlrpc-server-address 'localhost') +#(xend-tcp-xmlrpc-server-port 8006) # SSL key and certificate to use for the legacy TCP XMLRPC interface. # Setting these will mean that this port serves only SSL connections as diff -r f2457c7aff8d -r 611787b6ca35 tools/examples/xend-config.sxp --- a/tools/examples/xend-config.sxp Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/examples/xend-config.sxp Thu May 08 18:40:07 2008 +0900 @@ -64,9 +64,9 @@ # Address and port xend should use for the legacy TCP XMLRPC interface, -# if xen-tcp-xmlrpc-server is set. -#(xen-tcp-xmlrpc-server-address 'localhost') -#(xen-tcp-xmlrpc-server-port 8006) +# if xend-tcp-xmlrpc-server is set. +#(xend-tcp-xmlrpc-server-address 'localhost') +#(xend-tcp-xmlrpc-server-port 8006) # SSL key and certificate to use for the legacy TCP XMLRPC interface. # Setting these will mean that this port serves only SSL connections as @@ -81,6 +81,15 @@ # Port xend should use for the relocation interface, if xend-relocation-server # is set. #(xend-relocation-port 8002) + +# Whether to use tls when relocating. +#(xend-relocation-tls no) + +# SSL key and certificate to use for the relocation interface. +# Setting these will mean that this port serves only SSL connections as +# opposed to plaintext ones. +#(xend-relocation-server-ssl-key-file /etc/xen/xmlrpc.key) +#(xend-relocation-server-ssl-cert-file /etc/xen/xmlrpc.crt) # Address xend should listen on for HTTP connections, if xend-http-server is # set. diff -r f2457c7aff8d -r 611787b6ca35 tools/examples/xmexample.hvm --- a/tools/examples/xmexample.hvm Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/examples/xmexample.hvm Thu May 08 18:40:07 2008 +0900 @@ -219,3 +219,28 @@ serial='pty' #----------------------------------------------------------------------------- # Set keyboard layout, default is en-us keyboard. #keymap='ja' + +#----------------------------------------------------------------------------- +# Configure guest CPUID responses: +#cpuid=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx, +# eax=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ] +# - Set the VMX feature flag in the guest (CPUID_1:ECX:5) +# - Default behaviour for all other bits in ECX And EAX registers. +# +# Each successive character represent a lesser-significant bit: +# '1' -> force the corresponding bit to 1 +# '0' -> force to 0 +# 'x' -> we don't care (default behaviour) +# 'k' -> pass through the host bit value +# 's' -> as 'k' but preserve across save/restore and migration +# +# Configure host CPUID consistency checks, which must be satisfied for this +# VM to be allowed to run on this host's processor type: +#cpuid_check=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx' ] +# - Host must have VMX feature flag set +# +# The format is similar to the above for 'cpuid': +# '1' -> the bit must be '1' +# '0' -> the bit must be '0' +# 'x' -> we don't care (do not check) +# 's' -> the bit must be the same as on the host that started this VM diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/Makefile.target --- a/tools/ioemu/Makefile.target Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/Makefile.target Thu May 08 18:40:07 2008 +0900 @@ -370,7 +370,7 @@ endif ifdef CONFIG_PASSTHROUGH LIBS+=-lpci -VL_OBJS+= pass-through.o +VL_OBJS+= pass-through.o pt-msi.o CFLAGS += -DCONFIG_PASSTHROUGH $(info *** PCI passthrough capability has been enabled ***) endif diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/hw/cirrus_vga.c --- a/tools/ioemu/hw/cirrus_vga.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/hw/cirrus_vga.c Thu May 08 18:40:07 2008 +0900 @@ -234,8 +234,6 @@ typedef struct CirrusVGAState { int cirrus_linear_io_addr; int cirrus_linear_bitblt_io_addr; int cirrus_mmio_io_addr; - unsigned long cirrus_lfb_addr; - unsigned long cirrus_lfb_end; uint32_t cirrus_addr_mask; uint32_t linear_mmio_mask; uint8_t cirrus_shadow_gr0; @@ -2657,11 +2655,11 @@ static void cirrus_update_memory_access( mode = s->gr[0x05] & 0x7; if (mode < 4 || mode > 5 || ((s->gr[0x0B] & 0x4) == 0)) { - if (s->cirrus_lfb_addr && s->cirrus_lfb_end && !s->map_addr) { + if (s->lfb_addr && s->lfb_end && !s->map_addr) { void *vram_pointer, *old_vram; - vram_pointer = set_vram_mapping(s->cirrus_lfb_addr, - s->cirrus_lfb_end); + vram_pointer = set_vram_mapping(s->lfb_addr, + s->lfb_end); if (!vram_pointer) fprintf(stderr, "NULL vram_pointer\n"); else { @@ -2669,21 +2667,21 @@ static void cirrus_update_memory_access( VGA_RAM_SIZE); qemu_free(old_vram); } - s->map_addr = s->cirrus_lfb_addr; - s->map_end = s->cirrus_lfb_end; + s->map_addr = s->lfb_addr; + s->map_end = s->lfb_end; } s->cirrus_linear_write[0] = cirrus_linear_mem_writeb; s->cirrus_linear_write[1] = cirrus_linear_mem_writew; s->cirrus_linear_write[2] = cirrus_linear_mem_writel; } else { generic_io: - if (s->cirrus_lfb_addr && s->cirrus_lfb_end && s->map_addr) { + if (s->lfb_addr && s->lfb_end && s->map_addr) { void *old_vram; old_vram = vga_update_vram((VGAState *)s, NULL, VGA_RAM_SIZE); - unset_vram_mapping(s->cirrus_lfb_addr, - s->cirrus_lfb_end, + unset_vram_mapping(s->lfb_addr, + s->lfb_end, old_vram); s->map_addr = s->map_end = 0; @@ -3049,27 +3047,27 @@ void cirrus_stop_acc(CirrusVGAState *s) if (s->map_addr){ int error; s->map_addr = 0; - error = unset_vram_mapping(s->cirrus_lfb_addr, - s->cirrus_lfb_end, s->vram_ptr); + error = unset_vram_mapping(s->lfb_addr, + s->lfb_end, s->vram_ptr); fprintf(stderr, "cirrus_stop_acc:unset_vram_mapping.\n"); } } void cirrus_restart_acc(CirrusVGAState *s) { - if (s->cirrus_lfb_addr && s->cirrus_lfb_end) { + if (s->lfb_addr && s->lfb_end) { void *vram_pointer, *old_vram; fprintf(stderr, "cirrus_vga_load:re-enable vga acc.lfb_addr=0x%lx, lfb_end=0x%lx.\n", - s->cirrus_lfb_addr, s->cirrus_lfb_end); - vram_pointer = set_vram_mapping(s->cirrus_lfb_addr ,s->cirrus_lfb_end); + s->lfb_addr, s->lfb_end); + vram_pointer = set_vram_mapping(s->lfb_addr ,s->lfb_end); if (!vram_pointer){ fprintf(stderr, "cirrus_vga_load:NULL vram_pointer\n"); } else { old_vram = vga_update_vram((VGAState *)s, vram_pointer, VGA_RAM_SIZE); qemu_free(old_vram); - s->map_addr = s->cirrus_lfb_addr; - s->map_end = s->cirrus_lfb_end; + s->map_addr = s->lfb_addr; + s->map_end = s->lfb_end; } } } @@ -3120,8 +3118,8 @@ static void cirrus_vga_save(QEMUFile *f, vga_acc = (!!s->map_addr); qemu_put_8s(f, &vga_acc); - qemu_put_be64s(f, (uint64_t*)&s->cirrus_lfb_addr); - qemu_put_be64s(f, (uint64_t*)&s->cirrus_lfb_end); + qemu_put_be64s(f, (uint64_t*)&s->lfb_addr); + qemu_put_be64s(f, (uint64_t*)&s->lfb_end); qemu_put_buffer(f, s->vram_ptr, VGA_RAM_SIZE); } @@ -3175,8 +3173,8 @@ static int cirrus_vga_load(QEMUFile *f, qemu_get_be32s(f, &s->hw_cursor_y); qemu_get_8s(f, &vga_acc); - qemu_get_be64s(f, (uint64_t*)&s->cirrus_lfb_addr); - qemu_get_be64s(f, (uint64_t*)&s->cirrus_lfb_end); + qemu_get_be64s(f, (uint64_t*)&s->lfb_addr); + qemu_get_be64s(f, (uint64_t*)&s->lfb_end); qemu_get_buffer(f, s->vram_ptr, VGA_RAM_SIZE); if (vga_acc){ cirrus_restart_acc(s); @@ -3337,11 +3335,11 @@ static void cirrus_pci_lfb_map(PCIDevice /* XXX: add byte swapping apertures */ cpu_register_physical_memory(addr, s->vram_size, s->cirrus_linear_io_addr); - s->cirrus_lfb_addr = addr; - s->cirrus_lfb_end = addr + VGA_RAM_SIZE; - - if (s->map_addr && (s->cirrus_lfb_addr != s->map_addr) && - (s->cirrus_lfb_end != s->map_end)) + s->lfb_addr = addr; + s->lfb_end = addr + VGA_RAM_SIZE; + + if (s->map_addr && (s->lfb_addr != s->map_addr) && + (s->lfb_end != s->map_end)) fprintf(logfile, "cirrus vga map change while on lfb mode\n"); cpu_register_physical_memory(addr + 0x1000000, 0x400000, diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/hw/pass-through.c --- a/tools/ioemu/hw/pass-through.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/hw/pass-through.c Thu May 08 18:40:07 2008 +0900 @@ -26,6 +26,7 @@ #include "pass-through.h" #include "pci/header.h" #include "pci/pci.h" +#include "pt-msi.h" extern FILE *logfile; @@ -286,6 +287,9 @@ static void pt_pci_write_config(PCIDevic pci_default_write_config(d, address, val, len); return; } + + if ( pt_msi_write(assigned_device, address, val, len) ) + return; /* PCI config pass-through */ if (address == 0x4) { @@ -333,6 +337,7 @@ static uint32_t pt_pci_read_config(PCIDe break; } + pt_msi_read(assigned_device, address, len, &val); exit: #ifdef PT_DEBUG_PCI_CONFIG_ACCESS @@ -445,11 +450,41 @@ static int pt_unregister_regions(struct } +uint8_t find_cap_offset(struct pci_dev *pci_dev, uint8_t cap) +{ + int id; + int max_cap = 48; + int pos = PCI_CAPABILITY_LIST; + int status; + + status = pci_read_byte(pci_dev, PCI_STATUS); + if ( (status & PCI_STATUS_CAP_LIST) == 0 ) + return 0; + + while ( max_cap-- ) + { + pos = pci_read_byte(pci_dev, pos); + if ( pos < 0x40 ) + break; + + pos &= ~3; + id = pci_read_byte(pci_dev, pos + PCI_CAP_LIST_ID); + + if ( id == 0xff ) + break; + if ( id == cap ) + return pos; + + pos += PCI_CAP_LIST_NEXT; + } + return 0; +} + struct pt_dev * register_real_device(PCIBus *e_bus, const char *e_dev_name, int e_devfn, uint8_t r_bus, uint8_t r_dev, uint8_t r_func, uint32_t machine_irq, struct pci_access *pci_access) { - int rc = -1, i; + int rc = -1, i, pos; struct pt_dev *assigned_device = NULL; struct pci_dev *pci_dev; uint8_t e_device, e_intx; @@ -511,6 +546,9 @@ struct pt_dev * register_real_device(PCI for ( i = 0; i < PCI_CONFIG_SIZE; i++ ) assigned_device->dev.config[i] = pci_read_byte(pci_dev, i); + if ( (pos = find_cap_offset(pci_dev, PCI_CAP_ID_MSI)) ) + pt_msi_init(assigned_device, pos); + /* Handle real device's MMIO/PIO BARs */ pt_register_regions(assigned_device); @@ -519,7 +557,21 @@ struct pt_dev * register_real_device(PCI e_intx = assigned_device->dev.config[0x3d]-1; if ( PT_MACHINE_IRQ_AUTO == machine_irq ) + { + int pirq = pci_dev->irq; + machine_irq = pci_dev->irq; + rc = xc_physdev_map_pirq(xc_handle, domid, MAP_PIRQ_TYPE_GSI, + machine_irq, &pirq); + + if ( rc ) + { + /* TBD: unregister device in case of an error */ + PT_LOG("Error: Mapping irq failed, rc = %d\n", rc); + } + else + machine_irq = pirq; + } /* bind machine_irq to device */ if ( 0 != machine_irq ) diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/hw/pass-through.h --- a/tools/ioemu/hw/pass-through.h Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/hw/pass-through.h Thu May 08 18:40:07 2008 +0900 @@ -57,6 +57,14 @@ struct pt_region { } access; }; +struct pt_msi_info { + uint32_t flags; + int offset; + int size; + int pvec; /* physical vector used */ + int pirq; /* guest pirq corresponding */ +}; + /* This structure holds the context of the mapping functions and data that is relevant for qemu device management. @@ -65,6 +73,7 @@ struct pt_dev { PCIDevice dev; struct pci_dev *pci_dev; /* libpci struct */ struct pt_region bases[PCI_NUM_REGIONS]; /* Access regions */ + struct pt_msi_info *msi; /* MSI virtualization */ }; /* Used for formatting PCI BDF into cf8 format */ diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/hw/pt-msi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/ioemu/hw/pt-msi.c Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,488 @@ +/* + * Copyright (c) 2007, 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + * + * Jiang Yunhong + * + * This file implements direct PCI assignment to a HVM guest + */ + +#include "pt-msi.h" + +#define PT_MSI_CTRL_WR_MASK_HI (0x1) +#define PT_MSI_CTRL_WR_MASK_LO (0x8E) +#define PT_MSI_DATA_WR_MASK (0x38) +int pt_msi_init(struct pt_dev *dev, int pos) +{ + uint8_t id; + uint16_t flags; + struct pci_dev *pd = dev->pci_dev; + PCIDevice *d = (struct PCIDevice *)dev; + + id = pci_read_byte(pd, pos + PCI_CAP_LIST_ID); + + if ( id != PCI_CAP_ID_MSI ) + { + PT_LOG("pt_msi_init: error id %x pos %x\n", id, pos); + return -1; + } + + dev->msi = malloc(sizeof(struct pt_msi_info)); + if ( !dev->msi ) + { + PT_LOG("pt_msi_init: error allocation pt_msi_info\n"); + return -1; + } + memset(dev->msi, 0, sizeof(struct pt_msi_info)); + + dev->msi->offset = pos; + dev->msi->size = 0xa; + + flags = pci_read_byte(pd, pos + PCI_MSI_FLAGS); + if ( flags & PCI_MSI_FLAGS_ENABLE ) + { + PT_LOG("pt_msi_init: MSI enabled already, disable first\n"); + pci_write_byte(pd, pos + PCI_MSI_FLAGS, flags & ~PCI_MSI_FLAGS_ENABLE); + } + dev->msi->flags |= (flags | MSI_FLAG_UNINIT); + + if ( flags & PCI_MSI_FLAGS_64BIT ) + dev->msi->size += 4; + if ( flags & PCI_MSI_FLAGS_PVMASK ) + dev->msi->size += 10; + + /* All register is 0 after reset, except first 4 byte */ + *(uint32_t *)(&d->config[pos]) = pci_read_long(pd, pos); + d->config[pos + 2] &= PT_MSI_CTRL_WR_MASK_LO; + d->config[pos + 3] &= PT_MSI_CTRL_WR_MASK_HI; + + return 0; +} + +/* + * setup physical msi, but didn't enable it + */ +static int pt_msi_setup(struct pt_dev *dev) +{ + int vector = -1, pirq = -1; + + if ( !(dev->msi->flags & MSI_FLAG_UNINIT) ) + { + PT_LOG("setup physical after initialized?? \n"); + return -1; + } + + if ( xc_physdev_map_pirq_msi(xc_handle, domid, MAP_PIRQ_TYPE_MSI, + vector, &pirq, + dev->pci_dev->dev << 3 | dev->pci_dev->func, + dev->pci_dev->bus, 1) ) + { + PT_LOG("error map vector %x\n", vector); + return -1; + } + dev->msi->pirq = pirq; + PT_LOG("vector %x pirq %x\n", vector, pirq); + + return 0; +} + +/* + * caller should make sure mask is supported + */ +static uint32_t get_msi_gmask(struct pt_dev *d) +{ + struct PCIDevice *pd = (struct PCIDevice *)d; + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + return *(uint32_t *)(pd->config + d->msi->offset + 0xc); + else + return *(uint32_t *)(pd->config + d->msi->offset + 0x10); + +} + +static uint16_t get_msi_gdata(struct pt_dev *d) +{ + struct PCIDevice *pd = (struct PCIDevice *)d; + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + return *(uint16_t *)(pd->config + d->msi->offset + PCI_MSI_DATA_64); + else + return *(uint16_t *)(pd->config + d->msi->offset + PCI_MSI_DATA_32); +} + +static uint64_t get_msi_gaddr(struct pt_dev *d) +{ + struct PCIDevice *pd = (struct PCIDevice *)d; + uint32_t addr_hi; + uint64_t addr = 0; + + addr =(uint64_t)(*(uint32_t *)(pd->config + + d->msi->offset + PCI_MSI_ADDRESS_LO)); + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + { + addr_hi = *(uint32_t *)(pd->config + d->msi->offset + + PCI_MSI_ADDRESS_HI); + addr |= (uint64_t)addr_hi << 32; + } + return addr; +} + +static uint8_t get_msi_gctrl(struct pt_dev *d) +{ + struct PCIDevice *pd = (struct PCIDevice *)d; + + return *(uint8_t *)(pd->config + d->msi->offset + PCI_MSI_FLAGS); +} + +static uint32_t get_msi_gflags(struct pt_dev *d) +{ + uint32_t result = 0; + int rh, dm, dest_id, deliv_mode, trig_mode; + uint16_t data; + uint64_t addr; + + data = get_msi_gdata(d); + addr = get_msi_gaddr(d); + + rh = (addr >> MSI_ADDR_REDIRECTION_SHIFT) & 0x1; + dm = (addr >> MSI_ADDR_DESTMODE_SHIFT) & 0x1; + dest_id = (addr >> MSI_TARGET_CPU_SHIFT) & 0xff; + deliv_mode = (data >> MSI_DATA_DELIVERY_SHIFT) & 0x7; + trig_mode = (data >> MSI_DATA_TRIGGER_SHIFT) & 0x1; + + result |= dest_id | (rh << GFLAGS_SHIFT_RH) | (dm << GFLAGS_SHIFT_DM) | \ + (deliv_mode << GLFAGS_SHIFT_DELIV_MODE) | + (trig_mode << GLFAGS_SHIFT_TRG_MODE); + + return result; +} + +/* + * This may be arch different + */ +static inline uint8_t get_msi_gvec(struct pt_dev *d) +{ + return get_msi_gdata(d) & 0xff; +} + +static inline uint8_t get_msi_hvec(struct pt_dev *d) +{ + struct pci_dev *pd = d->pci_dev; + uint16_t data; + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + data = pci_read_word(pd, PCI_MSI_DATA_64); + else + data = pci_read_word(pd, PCI_MSI_DATA_32); + + return data & 0xff; +} + +/* + * Update msi mapping, usually called when MSI enabled, + * except the first time + */ +static int pt_msi_update(struct pt_dev *d) +{ + PT_LOG("now update msi with pirq %x gvec %x\n", + get_msi_gvec(d), d->msi->pirq); + return xc_domain_update_msi_irq(xc_handle, domid, get_msi_gvec(d), + d->msi->pirq, get_msi_gflags(d)); +} + +static int pt_msi_enable(struct pt_dev *d, int enable) +{ + uint16_t ctrl; + struct pci_dev *pd = d->pci_dev; + + if ( !pd ) + return -1; + + ctrl = pci_read_word(pd, d->msi->offset + PCI_MSI_FLAGS); + + if ( enable ) + ctrl |= PCI_MSI_FLAGS_ENABLE; + else + ctrl &= ~PCI_MSI_FLAGS_ENABLE; + + pci_write_word(pd, d->msi->offset + PCI_MSI_FLAGS, ctrl); + return 0; +} + +static int pt_msi_control_update(struct pt_dev *d, uint16_t old_ctrl) +{ + uint16_t new_ctrl; + PCIDevice *pd = (PCIDevice *)d; + + new_ctrl = get_msi_gctrl(d); + + PT_LOG("old_ctrl %x new_Ctrl %x\n", old_ctrl, new_ctrl); + + if ( new_ctrl & PCI_MSI_FLAGS_ENABLE ) + { + if ( d->msi->flags & MSI_FLAG_UNINIT ) + { + /* Init physical one */ + PT_LOG("setup msi for dev %x\n", pd->devfn); + if ( pt_msi_setup(d) ) + { + PT_LOG("pt_msi_setup error!!!\n"); + return -1; + } + pt_msi_update(d); + + d->msi->flags &= ~MSI_FLAG_UNINIT; + d->msi->flags |= PT_MSI_MAPPED; + + /* Enable physical MSI only after bind */ + pt_msi_enable(d, 1); + } + else if ( !(old_ctrl & PCI_MSI_FLAGS_ENABLE) ) + pt_msi_enable(d, 1); + } + else if ( old_ctrl & PCI_MSI_FLAGS_ENABLE ) + pt_msi_enable(d, 0); + + /* Currently no support for multi-vector */ + if ( (new_ctrl & PCI_MSI_FLAGS_QSIZE) != 0x0 ) + PT_LOG("try to set more than 1 vector ctrl %x\n", new_ctrl); + + return 0; +} + +static int +pt_msi_map_update(struct pt_dev *d, uint32_t old_data, uint64_t old_addr) +{ + uint16_t pctrl; + uint32_t data; + uint64_t addr; + + data = get_msi_gdata(d); + addr = get_msi_gaddr(d); + + PT_LOG("old_data %x old_addr %lx data %x addr %lx\n", + old_data, old_addr, data, addr); + + if ( data != old_data || addr != old_addr ) + if ( get_msi_gctrl(d) & PCI_MSI_FLAGS_ENABLE ) + pt_msi_update(d); + + return 0; +} + +static int pt_msi_mask_update(struct pt_dev *d, uint32_t old_mask) +{ + struct pci_dev *pd = d->pci_dev; + uint32_t mask; + int offset; + + if ( !(d->msi->flags & PCI_MSI_FLAGS_PVMASK) ) + return -1; + + mask = get_msi_gmask(d); + + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + offset = d->msi->offset + 0xc; + else + offset = d->msi->offset + 0x10; + + if ( old_mask != mask ) + pci_write_long(pd, offset, mask); +} + +#define ACCESSED_DATA 0x2 +#define ACCESSED_MASK 0x4 +#define ACCESSED_ADDR 0x8 +#define ACCESSED_CTRL 0x10 + +int pt_msi_write(struct pt_dev *d, uint32_t addr, uint32_t val, uint32_t len) +{ + struct pci_dev *pd; + int i, cur = addr; + uint8_t value, flags = 0; + uint16_t old_ctrl = 0, old_data = 0; + uint32_t old_mask = 0; + uint64_t old_addr = 0; + PCIDevice *dev = (PCIDevice *)d; + int can_write = 1; + + if ( !d || !d->msi ) + return 0; + + if ( (addr >= (d->msi->offset + d->msi->size) ) || + (addr + len) < d->msi->offset) + return 0; + + PT_LOG("addr %x val %x len %x offset %x size %x\n", + addr, val, len, d->msi->offset, d->msi->size); + + pd = d->pci_dev; + old_ctrl = get_msi_gctrl(d); + old_addr = get_msi_gaddr(d); + old_data = get_msi_gdata(d); + + if ( d->msi->flags & PCI_MSI_FLAGS_PVMASK ) + old_mask = get_msi_gmask(d); + + for ( i = 0; i < len; i++, cur++ ) + { + int off; + uint8_t orig_value; + + if ( cur < d->msi->offset ) + continue; + else if ( cur >= (d->msi->offset + d->msi->size) ) + break; + + off = cur - d->msi->offset; + value = (val >> (i * 8)) & 0xff; + + switch ( off ) + { + case 0x0 ... 0x1: + can_write = 0; + break; + case 0x2: + case 0x3: + flags |= ACCESSED_CTRL; + + orig_value = pci_read_byte(pd, d->msi->offset + off); + + orig_value &= (off == 2) ? PT_MSI_CTRL_WR_MASK_LO: + PT_MSI_CTRL_WR_MASK_HI; + + orig_value |= value & ( (off == 2) ? ~PT_MSI_CTRL_WR_MASK_LO: + ~PT_MSI_CTRL_WR_MASK_HI); + value = orig_value; + break; + case 0x4 ... 0x7: + flags |= ACCESSED_ADDR; + /* bit 4 ~ 11 is reserved for MSI in x86 */ + if ( off == 0x4 ) + value &= 0x0f; + if ( off == 0x5 ) + value &= 0xf0; + break; + case 0x8 ... 0xb: + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + { + /* Up 32bit is reserved in x86 */ + flags |= ACCESSED_ADDR; + if ( value ) + PT_LOG("Write up32 addr with %x \n", value); + } + else + { + if ( off == 0xa || off == 0xb ) + can_write = 0; + else + flags |= ACCESSED_DATA; + if ( off == 0x9 ) + value &= ~PT_MSI_DATA_WR_MASK; + } + break; + case 0xc ... 0xf: + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + { + if ( off == 0xe || off == 0xf ) + can_write = 0; + else + { + flags |= ACCESSED_DATA; + if (off == 0xd) + value &= ~PT_MSI_DATA_WR_MASK; + } + } + else + { + if ( d->msi->flags & PCI_MSI_FLAGS_PVMASK ) + flags |= ACCESSED_MASK; + else + PT_LOG("why comes to MASK without mask support??\n"); + } + break; + case 0x10 ... 0x13: + if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) + { + if ( d->msi->flags & PCI_MSI_FLAGS_PVMASK ) + flags |= ACCESSED_MASK; + else + PT_LOG("why comes to MASK without mask support??\n"); + } + else + can_write = 0; + break; + case 0x14 ... 0x18: + can_write = 0; + break; + default: + PT_LOG("Non MSI register!!!\n"); + break; + } + + if ( can_write ) + dev->config[cur] = value; + } + + if ( flags & ACCESSED_DATA || flags & ACCESSED_ADDR ) + pt_msi_map_update(d, old_data, old_addr); + + if ( flags & ACCESSED_MASK ) + pt_msi_mask_update(d, old_mask); + + /* This will enable physical one, do it in last step */ + if ( flags & ACCESSED_CTRL ) + pt_msi_control_update(d, old_ctrl); + + return 1; +} + +int pt_msi_read(struct pt_dev *d, int addr, int len, uint32_t *val) +{ + int e_addr = addr, e_len = len, offset = 0, i; + uint8_t e_val = 0; + PCIDevice *pd = (PCIDevice *)d; + + if ( !d || !d->msi ) + return 0; + + if ( (addr > (d->msi->offset + d->msi->size) ) || + (addr + len) <= d->msi->offset ) + return 0; + + PT_LOG("pt_msi_read addr %x len %x val %x offset %x size %x\n", + addr, len, *val, d->msi->offset, d->msi->size); + + if ( (addr + len ) > (d->msi->offset + d->msi->size) ) + e_len -= addr + len - d->msi->offset - d->msi->size; + + if ( addr < d->msi->offset ) + { + e_addr = d->msi->offset; + offset = d->msi->offset - addr; + e_len -= offset; + } + + for ( i = 0; i < e_len; i++ ) + { + e_val = *(uint8_t *)(&pd->config[e_addr] + i); + *val &= ~(0xff << ( (offset + i) * 8)); + *val |= (e_val << ( (offset + i) * 8)); + } + + return e_len; +} + diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/hw/pt-msi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/ioemu/hw/pt-msi.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,65 @@ +#ifndef _PT_MSI_H +#define _PT_MSI_H + +#include "vl.h" +#include "pci/header.h" +#include "pci/pci.h" +#include "pass-through.h" + +#define MSI_FLAG_UNINIT 0x1000 +#define PT_MSI_MAPPED 0x2000 + +#define MSI_DATA_VECTOR_SHIFT 0 +#define MSI_DATA_VECTOR(v) (((u8)v) << MSI_DATA_VECTOR_SHIFT) + +#define MSI_DATA_DELIVERY_SHIFT 8 +#define MSI_DATA_DELIVERY_FIXED (0 << MSI_DATA_DELIVERY_SHIFT) +#define MSI_DATA_DELIVERY_LOWPRI (1 << MSI_DATA_DELIVERY_SHIFT) + +#define MSI_DATA_LEVEL_SHIFT 14 +#define MSI_DATA_LEVEL_DEASSERT (0 << MSI_DATA_LEVEL_SHIFT) +#define MSI_DATA_LEVEL_ASSERT (1 << MSI_DATA_LEVEL_SHIFT) + +#define MSI_DATA_TRIGGER_SHIFT 15 +#define MSI_DATA_TRIGGER_EDGE (0 << MSI_DATA_TRIGGER_SHIFT) +#define MSI_DATA_TRIGGER_LEVEL (1 << MSI_DATA_TRIGGER_SHIFT) + +/* + + * Shift/mask fields for APIC-based bus address + + */ + +#define MSI_ADDR_HEADER 0xfee00000 +#define MSI_TARGET_CPU_SHIFT 12 + +#define MSI_ADDR_DESTID_MASK 0xfff0000f +#define MSI_ADDR_DESTID_CPU(cpu) ((cpu) << MSI_TARGET_CPU_SHIFT) + +#define MSI_ADDR_DESTMODE_SHIFT 2 +#define MSI_ADDR_DESTMODE_PHYS (0 << MSI_ADDR_DESTMODE_SHIFT) +#define MSI_ADDR_DESTMODE_LOGIC (1 << MSI_ADDR_DESTMODE_SHIFT) + +#define MSI_ADDR_REDIRECTION_SHIFT 3 +#define MSI_ADDR_REDIRECTION_CPU (0 << MSI_ADDR_REDIRECTION_SHIFT) +#define MSI_ADDR_REDIRECTION_LOWPRI (1 << MSI_ADDR_REDIRECTION_SHIFT) + +#define PCI_MSI_FLAGS_PVMASK 0x100 + +#define AUTO_ASSIGN -1 + +/* shift count for gflags */ +#define GFLAGS_SHIFT_DEST_ID 0 +#define GFLAGS_SHIFT_RH 8 +#define GFLAGS_SHIFT_DM 9 +#define GLFAGS_SHIFT_DELIV_MODE 12 +#define GLFAGS_SHIFT_TRG_MODE 15 + +int +pt_msi_init(struct pt_dev *dev, int pos); + +int +pt_msi_write(struct pt_dev *d, uint32_t addr, uint32_t val, uint32_t len); + +int +pt_msi_read(struct pt_dev *d, int addr, int len, uint32_t *val); + +#endif diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/hw/vga.c --- a/tools/ioemu/hw/vga.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/hw/vga.c Thu May 08 18:40:07 2008 +0900 @@ -1075,7 +1075,7 @@ static rgb_to_pixel_dup_func *rgb_to_pix */ static void vga_draw_text(VGAState *s, int full_update) { - int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr, depth; + int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr; int cx_min, cx_max, linesize, x_incr; uint32_t offset, fgcol, bgcol, v, cursor_offset; uint8_t *d1, *d, *src, *s1, *dest, *cursor_ptr; @@ -1086,9 +1086,11 @@ static void vga_draw_text(VGAState *s, i vga_draw_glyph8_func *vga_draw_glyph8; vga_draw_glyph9_func *vga_draw_glyph9; - depth = s->get_bpp(s); - if (s->ds->dpy_colourdepth != NULL && s->ds->depth != depth) - s->ds->dpy_colourdepth(s->ds, depth); + /* Disable dirty bit tracking */ + xc_hvm_track_dirty_vram(xc_handle, domid, 0, 0, NULL); + + if (s->ds->dpy_colourdepth != NULL && s->ds->depth != 0) + s->ds->dpy_colourdepth(s->ds, 0); s->rgb_to_pixel = rgb_to_pixel_dup_table[get_depth_index(s->ds)]; @@ -1486,7 +1488,7 @@ static void vga_draw_graphic(VGAState *s static void vga_draw_graphic(VGAState *s, int full_update) { int y1, y, update, linesize, y_start, double_scan, mask, depth; - int width, height, shift_control, line_offset, bwidth, ds_depth; + int width, height, shift_control, line_offset, bwidth, ds_depth, bits; ram_addr_t page0, page1; int disp_width, multi_scan, multi_run; uint8_t *d; @@ -1534,6 +1536,7 @@ static void vga_draw_graphic(VGAState *s } else { v = VGA_DRAW_LINE4; } + bits = 4; } else if (shift_control == 1) { full_update |= update_palette16(s); if (s->sr[0x01] & 8) { @@ -1542,28 +1545,35 @@ static void vga_draw_graphic(VGAState *s } else { v = VGA_DRAW_LINE2; } + bits = 4; } else { switch(s->get_bpp(s)) { default: case 0: full_update |= update_palette256(s); v = VGA_DRAW_LINE8D2; + bits = 4; break; case 8: full_update |= update_palette256(s); v = VGA_DRAW_LINE8; + bits = 8; break; case 15: v = VGA_DRAW_LINE15; + bits = 16; break; case 16: v = VGA_DRAW_LINE16; + bits = 16; break; case 24: v = VGA_DRAW_LINE24; + bits = 24; break; case 32: v = VGA_DRAW_LINE32; + bits = 32; break; } } @@ -1591,12 +1601,72 @@ static void vga_draw_graphic(VGAState *s width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]); #endif - for (y = 0; y < s->vram_size; y += TARGET_PAGE_SIZE) - if (vram_dirty(s, y, TARGET_PAGE_SIZE)) + y = 0; + + if (height - 1 > s->line_compare || multi_run || (s->cr[0x17] & 3) != 3 + || !s->lfb_addr) { + /* Tricky things happen, disable dirty bit tracking */ + xc_hvm_track_dirty_vram(xc_handle, domid, 0, 0, NULL); + + for ( ; y < s->vram_size; y += TARGET_PAGE_SIZE) + if (vram_dirty(s, y, TARGET_PAGE_SIZE)) + cpu_physical_memory_set_dirty(s->vram_offset + y); + } else { + /* Tricky things won't have any effect, i.e. we are in the very simple + * (and very usual) case of a linear buffer. */ + unsigned long end; + + for ( ; y < ((s->start_addr * 4) & TARGET_PAGE_MASK); y += TARGET_PAGE_SIZE) + /* We will not read that anyway. */ cpu_physical_memory_set_dirty(s->vram_offset + y); + if (y < (s->start_addr * 4)) { + /* start address not aligned on a page, track dirtyness by hand. */ + if (vram_dirty(s, y, TARGET_PAGE_SIZE)) + cpu_physical_memory_set_dirty(s->vram_offset + y); + y += TARGET_PAGE_SIZE; + } + + /* use page table dirty bit tracking for the inner of the LFB */ + end = s->start_addr * 4 + height * line_offset; + { + unsigned long npages = ((end & TARGET_PAGE_MASK) - y) / TARGET_PAGE_SIZE; + const int width = sizeof(unsigned long) * 8; + unsigned long bitmap[(npages + width - 1) / width]; + int err; + + if (!(err = xc_hvm_track_dirty_vram(xc_handle, domid, + (s->lfb_addr + y) / TARGET_PAGE_SIZE, npages, bitmap))) { + int i, j; + for (i = 0; i < sizeof(bitmap) / sizeof(*bitmap); i++) { + unsigned long map = bitmap[i]; + for (j = i * width; map && j < npages; map >>= 1, j++) + if (map & 1) + cpu_physical_memory_set_dirty(s->vram_offset + y + + j * TARGET_PAGE_SIZE); + } + y += npages * TARGET_PAGE_SIZE; + } else { + /* ENODATA just means we have changed mode and will succeed + * next time */ + if (err != -ENODATA) + fprintf(stderr, "track_dirty_vram(%lx, %lx) failed (%d)\n", s->lfb_addr + y, npages, err); + } + } + + for ( ; y < s->vram_size && y < end; y += TARGET_PAGE_SIZE) + /* failed or end address not aligned on a page, track dirtyness by + * hand. */ + if (vram_dirty(s, y, TARGET_PAGE_SIZE)) + cpu_physical_memory_set_dirty(s->vram_offset + y); + + for ( ; y < s->vram_size; y += TARGET_PAGE_SIZE) + /* We will not read that anyway. */ + cpu_physical_memory_set_dirty(s->vram_offset + y); + } + addr1 = (s->start_addr * 4); - bwidth = width * 4; + bwidth = (width * bits + 7) / 8; y_start = -1; page_min = 0; page_max = 0; @@ -1682,6 +1752,10 @@ static void vga_draw_blank(VGAState *s, return; if (s->last_scr_width <= 0 || s->last_scr_height <= 0) return; + + /* Disable dirty bit tracking */ + xc_hvm_track_dirty_vram(xc_handle, domid, 0, 0, NULL); + s->rgb_to_pixel = rgb_to_pixel_dup_table[get_depth_index(s->ds)]; if (s->ds->depth == 8) diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/hw/vga_int.h --- a/tools/ioemu/hw/vga_int.h Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/hw/vga_int.h Thu May 08 18:40:07 2008 +0900 @@ -87,6 +87,8 @@ unsigned int vram_size; \ unsigned long bios_offset; \ unsigned int bios_size; \ + unsigned long lfb_addr; \ + unsigned long lfb_end; \ PCIDevice *pci_dev; \ uint32_t latch; \ uint8_t sr_index; \ diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/sdl.c --- a/tools/ioemu/sdl.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/sdl.c Thu May 08 18:40:07 2008 +0900 @@ -234,6 +234,9 @@ static void sdl_resize(DisplayState *ds, again: screen = SDL_SetVideoMode(w, h, 0, flags); + + /* Process any WM-generated resize event */ + SDL_PumpEvents(); if (!screen) { fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError()); diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/vl.h --- a/tools/ioemu/vl.h Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/vl.h Thu May 08 18:40:07 2008 +0900 @@ -940,7 +940,6 @@ struct DisplayState { uint32_t *palette; uint64_t gui_timer_interval; - int switchbpp; int shared_buf; void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); diff -r f2457c7aff8d -r 611787b6ca35 tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/ioemu/vnc.c Thu May 08 18:40:07 2008 +0900 @@ -198,6 +198,7 @@ struct VncState char *x509key; #endif char challenge[VNC_AUTH_CHALLENGE_SIZE]; + int switchbpp; #if CONFIG_VNC_TLS int wiremode; @@ -1686,7 +1687,7 @@ static void vnc_dpy_colourdepth(DisplayS default: return; } - if (ds->switchbpp) { + if (vs->switchbpp) { vnc_client_error(vs); } else if (vs->csock != -1 && vs->has_WMVi) { /* Sending a WMVi message to notify the client*/ @@ -2647,7 +2648,7 @@ int vnc_display_open(DisplayState *ds, c if (strncmp(options, "password", 8) == 0) { password = 1; /* Require password auth */ } else if (strncmp(options, "switchbpp", 9) == 0) { - ds->switchbpp = 1; + vs->switchbpp = 1; #if CONFIG_VNC_TLS } else if (strncmp(options, "tls", 3) == 0) { tls = 1; /* Require TLS */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/Makefile --- a/tools/libfsimage/Makefile Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libfsimage/Makefile Thu May 08 18:40:07 2008 +0900 @@ -1,7 +1,7 @@ XEN_ROOT = ../.. XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk -SUBDIRS-y = common ufs reiserfs iso9660 fat +SUBDIRS-y = common ufs reiserfs iso9660 fat zfs SUBDIRS-y += $(shell env CC="$(CC)" ./check-libext2fs) .PHONY: all clean install diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/common/fsimage.c --- a/tools/libfsimage/common/fsimage.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libfsimage/common/fsimage.c Thu May 08 18:40:07 2008 +0900 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -51,6 +51,7 @@ fsi_t *fsi_open_fsimage(const char *path fsi->f_fd = fd; fsi->f_off = off; fsi->f_data = NULL; + fsi->f_bootstring = NULL; pthread_mutex_lock(&fsi_lock); err = find_plugin(fsi, path, options); @@ -140,3 +141,29 @@ ssize_t fsi_pread_file(fsi_file_t *ffi, return (ret); } + +char * +fsi_bootstring_alloc(fsi_t *fsi, size_t len) +{ + fsi->f_bootstring = malloc(len); + if (fsi->f_bootstring == NULL) + return (NULL); + + bzero(fsi->f_bootstring, len); + return (fsi->f_bootstring); +} + +void +fsi_bootstring_free(fsi_t *fsi) +{ + if (fsi->f_bootstring != NULL) { + free(fsi->f_bootstring); + fsi->f_bootstring = NULL; + } +} + +char * +fsi_fs_bootstring(fsi_t *fsi) +{ + return (fsi->f_bootstring); +} diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/common/fsimage.h --- a/tools/libfsimage/common/fsimage.h Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libfsimage/common/fsimage.h Thu May 08 18:40:07 2008 +0900 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -45,6 +45,10 @@ ssize_t fsi_read_file(fsi_file_t *, void ssize_t fsi_read_file(fsi_file_t *, void *, size_t); ssize_t fsi_pread_file(fsi_file_t *, void *, size_t, uint64_t); +char *fsi_bootstring_alloc(fsi_t *, size_t); +void fsi_bootstring_free(fsi_t *); +char *fsi_fs_bootstring(fsi_t *); + #ifdef __cplusplus }; #endif diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/common/fsimage_grub.c --- a/tools/libfsimage/common/fsimage_grub.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libfsimage/common/fsimage_grub.c Thu May 08 18:40:07 2008 +0900 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -286,6 +286,7 @@ fsig_mount(fsi_t *fsi, const char *path, if (!ops->fpo_mount(ffi, options)) { fsip_file_free(ffi); + fsi_bootstring_free(fsi); free(fsi->f_data); fsi->f_data = NULL; return (-1); @@ -299,6 +300,7 @@ static int static int fsig_umount(fsi_t *fsi) { + fsi_bootstring_free(fsi); free(fsi->f_data); return (0); } diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/common/fsimage_grub.h --- a/tools/libfsimage/common/fsimage_grub.h Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libfsimage/common/fsimage_grub.h Thu May 08 18:40:07 2008 +0900 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -72,6 +72,12 @@ unsigned long fsig_log2(unsigned long); #define ERR_FILELENGTH 1 #define ERR_BAD_FILETYPE 1 #define ERR_FILE_NOT_FOUND 1 +#define ERR_BAD_ARGUMENT 1 +#define ERR_FILESYSTEM_NOT_FOUND 1 +#define ERR_NO_BOOTPATH 1 +#define ERR_DEV_VALUES 1 +#define ERR_WONT_FIT 1 +#define ERR_READ 1 fsi_plugin_ops_t *fsig_init(fsi_plugin_t *, fsig_plugin_ops_t *); diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/common/fsimage_priv.h --- a/tools/libfsimage/common/fsimage_priv.h Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libfsimage/common/fsimage_priv.h Thu May 08 18:40:07 2008 +0900 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -46,6 +46,7 @@ struct fsi { uint64_t f_off; void *f_data; fsi_plugin_t *f_plugin; + char *f_bootstring; }; struct fsi_file { diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/common/mapfile-GNU --- a/tools/libfsimage/common/mapfile-GNU Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libfsimage/common/mapfile-GNU Thu May 08 18:40:07 2008 +0900 @@ -8,6 +8,9 @@ VERSION { fsi_close_file; fsi_read_file; fsi_pread_file; + fsi_bootstring_alloc; + fsi_bootstring_free; + fsi_fs_bootstring; fsip_fs_set_data; fsip_file_alloc; diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/common/mapfile-SunOS --- a/tools/libfsimage/common/mapfile-SunOS Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libfsimage/common/mapfile-SunOS Thu May 08 18:40:07 2008 +0900 @@ -7,6 +7,9 @@ libfsimage.so.1.0 { fsi_close_file; fsi_read_file; fsi_pread_file; + fsi_bootstring_alloc; + fsi_bootstring_free; + fsi_fs_bootstring; fsip_fs_set_data; fsip_file_alloc; diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/Makefile Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,37 @@ +# +# GRUB -- GRand Unified Bootloader +# Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +XEN_ROOT = ../../.. + +LIB_SRCS-y = fsys_zfs.c zfs_lzjb.c zfs_sha256.c zfs_fletcher.c + +FS = zfs + +.PHONY: all +all: fs-all + +.PHONY: install +install: fs-install + +include $(XEN_ROOT)/tools/libfsimage/Rules.mk diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/fsys_zfs.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/fsys_zfs.c Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,1457 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* + * All files in the zfs directory are derived from the OpenSolaris + * zfs grub files. All files in the zfs-include directory were + * included without changes. + */ + +/* + * The zfs plug-in routines for GRUB are: + * + * zfs_mount() - locates a valid uberblock of the root pool and reads + * in its MOS at the memory address MOS. + * + * zfs_open() - locates a plain file object by following the MOS + * and places its dnode at the memory address DNODE. + * + * zfs_read() - read in the data blocks pointed by the DNODE. + * + * ZFS_SCRATCH is used as a working area. + * + * (memory addr) MOS DNODE ZFS_SCRATCH + * | | | + * +-------V---------V----------V---------------+ + * memory | | dnode | dnode | scratch | + * | | 512B | 512B | area | + * +--------------------------------------------+ + */ + +#include +#include + +/* From "shared.h" */ +#include "mb_info.h" + +/* Boot signature related defines for the findroot command */ +#define BOOTSIGN_DIR "/boot/grub/bootsign" +#define BOOTSIGN_BACKUP "/etc/bootsign" + +/* Maybe redirect memory requests through grub_scratch_mem. */ +#define RAW_ADDR(x) (x) +#define RAW_SEG(x) (x) + +/* ZFS will use the top 4 Meg of physical memory (below 4Gig) for sratch */ +#define ZFS_SCRATCH_SIZE 0x400000 + +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +/* End from shared.h */ + +#include "fsys_zfs.h" + +/* cache for a file block of the currently zfs_open()-ed file */ +#define file_buf zfs_ba->zfs_file_buf +#define file_start zfs_ba->zfs_file_start +#define file_end zfs_ba->zfs_file_end + +/* cache for a dnode block */ +#define dnode_buf zfs_ba->zfs_dnode_buf +#define dnode_mdn zfs_ba->zfs_dnode_mdn +#define dnode_start zfs_ba->zfs_dnode_start +#define dnode_end zfs_ba->zfs_dnode_end + +#define stackbase zfs_ba->zfs_stackbase + +decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = +{ + {"noop", 0}, + {"on", lzjb_decompress}, /* ZIO_COMPRESS_ON */ + {"off", 0}, + {"lzjb", lzjb_decompress} /* ZIO_COMPRESS_LZJB */ +}; + +/* From disk_io.c */ +/* ZFS root filesystem for booting */ +#define current_bootpath zfs_ba->zfs_current_bootpath +#define current_rootpool zfs_ba->zfs_current_rootpool +#define current_bootfs zfs_ba->zfs_current_bootfs +#define current_bootfs_obj zfs_ba->zfs_current_bootfs_obj +#define is_zfs_mount (*fsig_int1(ffi)) +/* End from disk_io.c */ + +#define is_zfs_open zfs_ba->zfs_open + +/* + * Our own version of bcmp(). + */ +static int +zfs_bcmp(const void *s1, const void *s2, size_t n) +{ + const unsigned char *ps1 = s1; + const unsigned char *ps2 = s2; + + if (s1 != s2 && n != 0) { + do { + if (*ps1++ != *ps2++) + return (1); + } while (--n != 0); + } + + return (0); +} + +/* + * Our own version of log2(). Same thing as highbit()-1. + */ +static int +zfs_log2(uint64_t num) +{ + int i = 0; + + while (num > 1) { + i++; + num = num >> 1; + } + + return (i); +} + +/* Checksum Functions */ +static void +zio_checksum_off(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + ZIO_SET_CHECKSUM(zcp, 0, 0, 0, 0); +} + +/* Checksum Table and Values */ +zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = { + {{NULL, NULL}, 0, 0, "inherit"}, + {{NULL, NULL}, 0, 0, "on"}, + {{zio_checksum_off, zio_checksum_off}, 0, 0, "off"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 1, "label"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 1, "gang_header"}, + {{fletcher_2_native, fletcher_2_byteswap}, 0, 1, "zilog"}, + {{fletcher_2_native, fletcher_2_byteswap}, 0, 0, "fletcher2"}, + {{fletcher_4_native, fletcher_4_byteswap}, 1, 0, "fletcher4"}, + {{zio_checksum_SHA256, zio_checksum_SHA256}, 1, 0, "SHA256"} +}; + +/* + * zio_checksum_verify: Provides support for checksum verification. + * + * Fletcher2, Fletcher4, and SHA256 are supported. + * + * Return: + * -1 = Failure + * 0 = Success + */ +static int +zio_checksum_verify(blkptr_t *bp, char *data, int size) +{ + zio_cksum_t zc = bp->blk_cksum; + uint32_t checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : + BP_GET_CHECKSUM(bp); + int byteswap = BP_SHOULD_BYTESWAP(bp); + zio_block_tail_t *zbt = (zio_block_tail_t *)(data + size) - 1; + zio_checksum_info_t *ci = &zio_checksum_table[checksum]; + zio_cksum_t actual_cksum, expected_cksum; + + /* byteswap is not supported */ + if (byteswap) + return (-1); + + if (checksum >= ZIO_CHECKSUM_FUNCTIONS || ci->ci_func[0] == NULL) + return (-1); + + if (ci->ci_zbt) { + if (checksum == ZIO_CHECKSUM_GANG_HEADER) { + /* + * 'gang blocks' is not supported. + */ + return (-1); + } + + if (zbt->zbt_magic == BSWAP_64(ZBT_MAGIC)) { + /* byte swapping is not supported */ + return (-1); + } else { + expected_cksum = zbt->zbt_cksum; + zbt->zbt_cksum = zc; + ci->ci_func[0](data, size, &actual_cksum); + zbt->zbt_cksum = expected_cksum; + } + zc = expected_cksum; + + } else { + if (BP_IS_GANG(bp)) + return (-1); + ci->ci_func[byteswap](data, size, &actual_cksum); + } + + if ((actual_cksum.zc_word[0] - zc.zc_word[0]) | + (actual_cksum.zc_word[1] - zc.zc_word[1]) | + (actual_cksum.zc_word[2] - zc.zc_word[2]) | + (actual_cksum.zc_word[3] - zc.zc_word[3])) + return (-1); + + return (0); +} + +/* + * vdev_label_offset takes "offset" (the offset within a vdev_label) and + * returns its physical disk offset (starting from the beginning of the vdev). + * + * Input: + * psize : Physical size of this vdev + * l : Label Number (0-3) + * offset : The offset with a vdev_label in which we want the physical + * address + * Return: + * Success : physical disk offset + * Failure : errnum = ERR_BAD_ARGUMENT, return value is meaningless + */ +static uint64_t +vdev_label_offset(fsi_file_t *ffi, uint64_t psize, int l, uint64_t offset) +{ + /* XXX Need to add back label support! */ + if (l >= VDEV_LABELS/2 || offset > sizeof (vdev_label_t)) { + errnum = ERR_BAD_ARGUMENT; + return (0); + } + + return (offset + l * sizeof (vdev_label_t) + (l < VDEV_LABELS / 2 ? + 0 : psize - VDEV_LABELS * sizeof (vdev_label_t))); + +} + +/* + * vdev_uberblock_compare takes two uberblock structures and returns an integer + * indicating the more recent of the two. + * Return Value = 1 if ub2 is more recent + * Return Value = -1 if ub1 is more recent + * The most recent uberblock is determined using its transaction number and + * timestamp. The uberblock with the highest transaction number is + * considered "newer". If the transaction numbers of the two blocks match, the + * timestamps are compared to determine the "newer" of the two. + */ +static int +vdev_uberblock_compare(uberblock_t *ub1, uberblock_t *ub2) +{ + if (ub1->ub_txg < ub2->ub_txg) + return (-1); + if (ub1->ub_txg > ub2->ub_txg) + return (1); + + if (ub1->ub_timestamp < ub2->ub_timestamp) + return (-1); + if (ub1->ub_timestamp > ub2->ub_timestamp) + return (1); + + return (0); +} + +/* + * Three pieces of information are needed to verify an uberblock: the magic + * number, the version number, and the checksum. + * + * Currently Implemented: version number, magic number + * Need to Implement: checksum + * + * Return: + * 0 - Success + * -1 - Failure + */ +static int +uberblock_verify(uberblock_phys_t *ub, int offset) +{ + + uberblock_t *uber = &ub->ubp_uberblock; + blkptr_t bp; + + BP_ZERO(&bp); + BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); + BP_SET_BYTEORDER(&bp, ZFS_HOST_BYTEORDER); + ZIO_SET_CHECKSUM(&bp.blk_cksum, offset, 0, 0, 0); + + if (zio_checksum_verify(&bp, (char *)ub, UBERBLOCK_SIZE) != 0) + return (-1); + + if (uber->ub_magic == UBERBLOCK_MAGIC && + uber->ub_version >= SPA_VERSION_1 && + uber->ub_version <= SPA_VERSION) + return (0); + + return (-1); +} + +/* + * Find the best uberblock. + * Return: + * Success - Pointer to the best uberblock. + * Failure - NULL + */ +static uberblock_phys_t * +find_bestub(fsi_file_t *ffi, uberblock_phys_t *ub_array, int label) +{ + uberblock_phys_t *ubbest = NULL; + int i, offset; + + for (i = 0; i < (VDEV_UBERBLOCK_RING >> VDEV_UBERBLOCK_SHIFT); i++) { + offset = vdev_label_offset(ffi, 0, label, + VDEV_UBERBLOCK_OFFSET(i)); + if (errnum == ERR_BAD_ARGUMENT) + return (NULL); + if (uberblock_verify(&ub_array[i], offset) == 0) { + if (ubbest == NULL) { + ubbest = &ub_array[i]; + } else if (vdev_uberblock_compare( + &(ub_array[i].ubp_uberblock), + &(ubbest->ubp_uberblock)) > 0) { + ubbest = &ub_array[i]; + } + } + } + + return (ubbest); +} + +/* + * Read in a block and put its uncompressed data in buf. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +zio_read(fsi_file_t *ffi, blkptr_t *bp, void *buf, char *stack) +{ + uint64_t offset, sector; + int psize, lsize; + int i, comp, cksum; + + psize = BP_GET_PSIZE(bp); + lsize = BP_GET_LSIZE(bp); + comp = BP_GET_COMPRESS(bp); + cksum = BP_GET_CHECKSUM(bp); + + if ((unsigned int)comp >= ZIO_COMPRESS_FUNCTIONS || + (comp != ZIO_COMPRESS_OFF && + decomp_table[comp].decomp_func == NULL)) + return (ERR_FSYS_CORRUPT); + + /* pick a good dva from the block pointer */ + for (i = 0; i < SPA_DVAS_PER_BP; i++) { + + if (bp->blk_dva[i].dva_word[0] == 0 && + bp->blk_dva[i].dva_word[1] == 0) + continue; + + /* read in a block */ + offset = DVA_GET_OFFSET(&bp->blk_dva[i]); + sector = DVA_OFFSET_TO_PHYS_SECTOR(offset); + + if (comp != ZIO_COMPRESS_OFF) { + + if (devread(ffi, sector, 0, psize, stack) == 0) + continue; + if (zio_checksum_verify(bp, stack, psize) != 0) + continue; + decomp_table[comp].decomp_func(stack, buf, psize, + lsize); + } else { + if (devread(ffi, sector, 0, psize, buf) == 0) + continue; + if (zio_checksum_verify(bp, buf, psize) != 0) + continue; + } + return (0); + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Get the block from a block id. + * push the block onto the stack. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +dmu_read(fsi_file_t *ffi, dnode_phys_t *dn, uint64_t blkid, void *buf, + char *stack) +{ + int idx, level; + blkptr_t *bp_array = dn->dn_blkptr; + int epbs = dn->dn_indblkshift - SPA_BLKPTRSHIFT; + blkptr_t *bp, *tmpbuf; + + bp = (blkptr_t *)stack; + stack += sizeof (blkptr_t); + + tmpbuf = (blkptr_t *)stack; + stack += 1<dn_indblkshift; + + for (level = dn->dn_nlevels - 1; level >= 0; level--) { + idx = (blkid >> (epbs * level)) & ((1<dn_datablkszsec << SPA_MINBLOCKSHIFT); + break; + } else if ((errnum = zio_read(ffi, bp, tmpbuf, stack))) { + return (errnum); + } + bp_array = tmpbuf; + } + + return (0); +} + +/* + * mzap_lookup: Looks up property described by "name" and returns the value + * in "value". + * + * Return: + * 0 - success + * errnum - failure + */ +static int +mzap_lookup(mzap_phys_t *zapobj, int objsize, char *name, + uint64_t *value) +{ + int i, chunks; + mzap_ent_phys_t *mzap_ent = zapobj->mz_chunk; + + chunks = objsize/MZAP_ENT_LEN - 1; + for (i = 0; i < chunks; i++) { + if (strcmp(mzap_ent[i].mze_name, name) == 0) { + *value = mzap_ent[i].mze_value; + return (0); + } + } + + return (ERR_FSYS_CORRUPT); +} + +static uint64_t +zap_hash(fsi_file_t *ffi, uint64_t salt, const char *name) +{ + static uint64_t table[256]; + const uint8_t *cp; + uint8_t c; + uint64_t crc = salt; + + if (table[128] == 0) { + uint64_t *ct; + int i, j; + for (i = 0; i < 256; i++) { + for (ct = table + i, *ct = i, j = 8; j > 0; j--) + *ct = (*ct >> 1) ^ (-(*ct & 1) & + ZFS_CRC64_POLY); + } + } + + if (crc == 0 || table[128] != ZFS_CRC64_POLY) { + errnum = ERR_FSYS_CORRUPT; + return (0); + } + + for (cp = (const uint8_t *)name; (c = *cp) != '\0'; cp++) + crc = (crc >> 8) ^ table[(crc ^ c) & 0xFF]; + + /* + * Only use 28 bits, since we need 4 bits in the cookie for the + * collision differentiator. We MUST use the high bits, since + * those are the onces that we first pay attention to when + * chosing the bucket. + */ + crc &= ~((1ULL << (64 - ZAP_HASHBITS)) - 1); + + return (crc); +} + +/* + * Only to be used on 8-bit arrays. + * array_len is actual len in bytes (not encoded le_value_length). + * buf is null-terminated. + */ +static int +zap_leaf_array_equal(zap_leaf_phys_t *l, int blksft, int chunk, + int array_len, const char *buf) +{ + int bseen = 0; + + while (bseen < array_len) { + struct zap_leaf_array *la = + &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array; + int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); + + if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) + return (0); + + if (zfs_bcmp(la->la_array, buf + bseen, toread) != 0) + break; + chunk = la->la_next; + bseen += toread; + } + return (bseen == array_len); +} + +/* + * Given a zap_leaf_phys_t, walk thru the zap leaf chunks to get the + * value for the property "name". + * + * Return: + * 0 - success + * errnum - failure + */ +static int +zap_leaf_lookup(zap_leaf_phys_t *l, int blksft, uint64_t h, + const char *name, uint64_t *value) +{ + uint16_t chunk; + struct zap_leaf_entry *le; + + /* Verify if this is a valid leaf block */ + if (l->l_hdr.lh_block_type != ZBT_LEAF) + return (ERR_FSYS_CORRUPT); + if (l->l_hdr.lh_magic != ZAP_LEAF_MAGIC) + return (ERR_FSYS_CORRUPT); + + for (chunk = l->l_hash[LEAF_HASH(blksft, h)]; + chunk != CHAIN_END; chunk = le->le_next) { + + if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) + return (ERR_FSYS_CORRUPT); + + le = ZAP_LEAF_ENTRY(l, blksft, chunk); + + /* Verify the chunk entry */ + if (le->le_type != ZAP_CHUNK_ENTRY) + return (ERR_FSYS_CORRUPT); + + if (le->le_hash != h) + continue; + + if (zap_leaf_array_equal(l, blksft, le->le_name_chunk, + le->le_name_length, name)) { + + struct zap_leaf_array *la; + uint8_t *ip; + + if (le->le_int_size != 8 || le->le_value_length != 1) + return (ERR_FSYS_CORRUPT); + + /* get the uint64_t property value */ + la = &ZAP_LEAF_CHUNK(l, blksft, + le->le_value_chunk).l_array; + ip = la->la_array; + + *value = (uint64_t)ip[0] << 56 | (uint64_t)ip[1] << 48 | + (uint64_t)ip[2] << 40 | (uint64_t)ip[3] << 32 | + (uint64_t)ip[4] << 24 | (uint64_t)ip[5] << 16 | + (uint64_t)ip[6] << 8 | (uint64_t)ip[7]; + + return (0); + } + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Fat ZAP lookup + * + * Return: + * 0 - success + * errnum - failure + */ +static int +fzap_lookup(fsi_file_t *ffi, dnode_phys_t *zap_dnode, zap_phys_t *zap, + char *name, uint64_t *value, char *stack) +{ + zap_leaf_phys_t *l; + uint64_t hash, idx, blkid; + int blksft = zfs_log2(zap_dnode->dn_datablkszsec << DNODE_SHIFT); + + /* Verify if this is a fat zap header block */ + if (zap->zap_magic != (uint64_t)ZAP_MAGIC) + return (ERR_FSYS_CORRUPT); + + hash = zap_hash(ffi, zap->zap_salt, name); + if (errnum) + return (errnum); + + /* get block id from index */ + if (zap->zap_ptrtbl.zt_numblks != 0) { + /* external pointer tables not supported */ + return (ERR_FSYS_CORRUPT); + } + idx = ZAP_HASH_IDX(hash, zap->zap_ptrtbl.zt_shift); + blkid = ((uint64_t *)zap)[idx + (1<<(blksft-3-1))]; + + /* Get the leaf block */ + l = (zap_leaf_phys_t *)stack; + stack += 1<dn_datablkszsec << SPA_MINBLOCKSHIFT; + stack += size; + if ((errnum = dmu_read(ffi, zap_dnode, 0, zapbuf, stack))) + return (errnum); + + block_type = *((uint64_t *)zapbuf); + + if (block_type == ZBT_MICRO) { + return (mzap_lookup(zapbuf, size, name, val)); + } else if (block_type == ZBT_HEADER) { + /* this is a fat zap */ + return (fzap_lookup(ffi, zap_dnode, zapbuf, name, + val, stack)); + } + + return (ERR_FSYS_CORRUPT); +} + +/* + * Get the dnode of an object number from the metadnode of an object set. + * + * Input + * mdn - metadnode to get the object dnode + * objnum - object number for the object dnode + * buf - data buffer that holds the returning dnode + * stack - scratch area + * + * Return: + * 0 - success + * errnum - failure + */ +static int +dnode_get(fsi_file_t *ffi, dnode_phys_t *mdn, uint64_t objnum, + uint8_t type, dnode_phys_t *buf, char *stack) +{ + uint64_t blkid, blksz; /* the block id this object dnode is in */ + int epbs; /* shift of number of dnodes in a block */ + int idx; /* index within a block */ + dnode_phys_t *dnbuf; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + blksz = mdn->dn_datablkszsec << SPA_MINBLOCKSHIFT; + epbs = zfs_log2(blksz) - DNODE_SHIFT; + blkid = objnum >> epbs; + idx = objnum & ((1<= dnode_start && objnum < dnode_end) { + grub_memmove(buf, &dnode_buf[idx], DNODE_SIZE); + VERIFY_DN_TYPE(buf, type); + return (0); + } + + if (dnode_buf && blksz == 1< ZPL_VERSION) + return (-1); + + if ((errnum = zap_lookup(ffi, dn, ZFS_ROOT_OBJ, &objnum, stack))) + return (errnum); + + if ((errnum = dnode_get(ffi, mdn, objnum, DMU_OT_DIRECTORY_CONTENTS, + dn, stack))) + return (errnum); + + /* skip leading slashes */ + while (*path == '/') + path++; + + while (*path && !isspace(*path)) { + + /* get the next component name */ + cname = path; + while (*path && !isspace(*path) && *path != '/') + path++; + ch = *path; + *path = 0; /* ensure null termination */ + + if ((errnum = zap_lookup(ffi, dn, cname, &objnum, stack))) + return (errnum); + + objnum = ZFS_DIRENT_OBJ(objnum); + if ((errnum = dnode_get(ffi, mdn, objnum, 0, dn, stack))) + return (errnum); + + *path = ch; + while (*path == '/') + path++; + } + + /* We found the dnode for this file. Verify if it is a plain file. */ + VERIFY_DN_TYPE(dn, DMU_OT_PLAIN_FILE_CONTENTS); + + return (0); +} + +/* + * Get the default 'bootfs' property value from the rootpool. + * + * Return: + * 0 - success + * errnum -failure + */ +static int +get_default_bootfsobj(fsi_file_t *ffi, dnode_phys_t *mosmdn, + uint64_t *obj, char *stack) +{ + uint64_t objnum = 0; + dnode_phys_t *dn = (dnode_phys_t *)stack; + stack += DNODE_SIZE; + + if ((errnum = dnode_get(ffi, mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, dn, stack))) + return (errnum); + + /* + * find the object number for 'pool_props', and get the dnode + * of the 'pool_props'. + */ + if (zap_lookup(ffi, dn, DMU_POOL_PROPS, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_POOL_PROPS, dn, + stack))) + return (errnum); + + if (zap_lookup(ffi, dn, ZPOOL_PROP_BOOTFS, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (!objnum) + return (ERR_FILESYSTEM_NOT_FOUND); + + + *obj = objnum; + return (0); +} + +/* + * Given a MOS metadnode, get the metadnode of a given filesystem name (fsname), + * e.g. pool/rootfs, or a given object number (obj), e.g. the object number + * of pool/rootfs. + * + * If no fsname and no obj are given, return the DSL_DIR metadnode. + * If fsname is given, return its metadnode and its matching object number. + * If only obj is given, return the metadnode for this object number. + * + * Return: + * 0 - success + * errnum - failure + */ +static int +get_objset_mdn(fsi_file_t *ffi, dnode_phys_t *mosmdn, char *fsname, + uint64_t *obj, dnode_phys_t *mdn, char *stack) +{ + uint64_t objnum, headobj; + char *cname, ch; + blkptr_t *bp; + objset_phys_t *osp; + + if (fsname == NULL && obj) { + headobj = *obj; + goto skip; + } + + if ((errnum = dnode_get(ffi, mosmdn, DMU_POOL_DIRECTORY_OBJECT, + DMU_OT_OBJECT_DIRECTORY, mdn, stack))) + return (errnum); + + if ((errnum = zap_lookup(ffi, mdn, DMU_POOL_ROOT_DATASET, &objnum, + stack))) + return (errnum); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_DSL_DIR, mdn, + stack))) + return (errnum); + + if (fsname == NULL) { + headobj = + ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; + goto skip; + } + + /* take out the pool name */ + while (*fsname && !isspace(*fsname) && *fsname != '/') + fsname++; + + while (*fsname && !isspace(*fsname)) { + uint64_t childobj; + + while (*fsname == '/') + fsname++; + + cname = fsname; + while (*fsname && !isspace(*fsname) && *fsname != '/') + fsname++; + ch = *fsname; + *fsname = 0; + + childobj = + ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_child_dir_zapobj; + if ((errnum = dnode_get(ffi, mosmdn, childobj, + DMU_OT_DSL_DIR_CHILD_MAP, mdn, stack))) + return (errnum); + + if (zap_lookup(ffi, mdn, cname, &objnum, stack)) + return (ERR_FILESYSTEM_NOT_FOUND); + + if ((errnum = dnode_get(ffi, mosmdn, objnum, DMU_OT_DSL_DIR, + mdn, stack))) + return (errnum); + + *fsname = ch; + } + headobj = ((dsl_dir_phys_t *)DN_BONUS(mdn))->dd_head_dataset_obj; + if (obj) + *obj = headobj; + +skip: + if ((errnum = dnode_get(ffi, mosmdn, headobj, DMU_OT_DSL_DATASET, mdn, + stack))) + return (errnum); + + /* TODO: Add snapshot support here - for fsname=snapshot-name */ + + bp = &((dsl_dataset_phys_t *)DN_BONUS(mdn))->ds_bp; + osp = (objset_phys_t *)stack; + stack += sizeof (objset_phys_t); + if ((errnum = zio_read(ffi, bp, osp, stack))) + return (errnum); + + grub_memmove((char *)mdn, (char *)&osp->os_meta_dnode, DNODE_SIZE); + + return (0); +} + +/* + * For a given XDR packed nvlist, verify the first 4 bytes and move on. + * + * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) : + * + * encoding method/host endian (4 bytes) + * nvl_version (4 bytes) + * nvl_nvflag (4 bytes) + * encoded nvpairs: + * encoded size of the nvpair (4 bytes) + * decoded size of the nvpair (4 bytes) + * name string size (4 bytes) + * name string data (sizeof(NV_ALIGN4(string)) + * data type (4 bytes) + * # of elements in the nvpair (4 bytes) + * data + * 2 zero's for the last nvpair + * (end of the entire list) (8 bytes) + * + * Return: + * 0 - success + * 1 - failure + */ +static int +nvlist_unpack(char *nvlist, char **out) +{ + /* Verify if the 1st and 2nd byte in the nvlist are valid. */ + if (nvlist[0] != NV_ENCODE_XDR || nvlist[1] != HOST_ENDIAN) + return (1); + + nvlist += 4; + *out = nvlist; + return (0); +} + +static char * +nvlist_array(char *nvlist, int index) +{ + int i, encode_size; + + for (i = 0; i < index; i++) { + /* skip the header, nvl_version, and nvl_nvflag */ + nvlist = nvlist + 4 * 2; + + while ((encode_size = BSWAP_32(*(uint32_t *)nvlist))) + nvlist += encode_size; /* goto the next nvpair */ + + nvlist = nvlist + 4 * 2; /* skip the ending 2 zeros - 8 bytes */ + } + + return (nvlist); +} + +static int +nvlist_lookup_value(char *nvlist, char *name, void *val, int valtype, + int *nelmp) +{ + int name_len, type, slen, encode_size; + char *nvpair, *nvp_name, *strval = val; + uint64_t *intval = val; + + /* skip the header, nvl_version, and nvl_nvflag */ + nvlist = nvlist + 4 * 2; + + /* + * Loop thru the nvpair list + * The XDR representation of an integer is in big-endian byte order. + */ + while ((encode_size = BSWAP_32(*(uint32_t *)nvlist))) { + + nvpair = nvlist + 4 * 2; /* skip the encode/decode size */ + + name_len = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + + nvp_name = nvpair; + nvpair = nvpair + ((name_len + 3) & ~3); /* align */ + + type = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + + if (((strncmp(nvp_name, name, name_len) == 0) && + type == valtype)) { + int nelm; + + if (((nelm = BSWAP_32(*(uint32_t *)nvpair)) < 1)) + return (1); + nvpair += 4; + + switch (valtype) { + case DATA_TYPE_STRING: + slen = BSWAP_32(*(uint32_t *)nvpair); + nvpair += 4; + grub_memmove(strval, nvpair, slen); + strval[slen] = '\0'; + return (0); + + case DATA_TYPE_UINT64: + *intval = BSWAP_64(*(uint64_t *)nvpair); + return (0); + + case DATA_TYPE_NVLIST: + *(void **)val = (void *)nvpair; + return (0); + + case DATA_TYPE_NVLIST_ARRAY: + *(void **)val = (void *)nvpair; + if (nelmp) + *nelmp = nelm; + return (0); + } + } + + nvlist += encode_size; /* goto the next nvpair */ + } + + return (1); +} + +/* + * Check if this vdev is online and is in a good state. + */ +static int +vdev_validate(char *nv) +{ + uint64_t ival; + + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_OFFLINE, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_FAULTED, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_DEGRADED, &ival, + DATA_TYPE_UINT64, NULL) == 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_REMOVED, &ival, + DATA_TYPE_UINT64, NULL) == 0) + return (ERR_DEV_VALUES); + + return (0); +} + +/* + * Get a list of valid vdev pathname from the boot device. + * The caller should already allocate MAXNAMELEN memory for bootpath. + */ +static int +vdev_get_bootpath(char *nv, char *bootpath) +{ + char type[16]; + + bootpath[0] = '\0'; + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_TYPE, &type, DATA_TYPE_STRING, + NULL)) + return (ERR_FSYS_CORRUPT); + + if (strcmp(type, VDEV_TYPE_DISK) == 0) { + if (vdev_validate(nv) != 0 || + nvlist_lookup_value(nv, ZPOOL_CONFIG_PHYS_PATH, bootpath, + DATA_TYPE_STRING, NULL) != 0) + return (ERR_NO_BOOTPATH); + + } else if (strcmp(type, VDEV_TYPE_MIRROR) == 0) { + int nelm, i; + char *child; + + if (nvlist_lookup_value(nv, ZPOOL_CONFIG_CHILDREN, &child, + DATA_TYPE_NVLIST_ARRAY, &nelm)) + return (ERR_FSYS_CORRUPT); + + for (i = 0; i < nelm; i++) { + char tmp_path[MAXNAMELEN]; + char *child_i; + + child_i = nvlist_array(child, i); + if (vdev_validate(child_i) != 0) + continue; + + if (nvlist_lookup_value(child_i, ZPOOL_CONFIG_PHYS_PATH, + tmp_path, DATA_TYPE_STRING, NULL) != 0) + return (ERR_NO_BOOTPATH); + + if ((strlen(bootpath) + strlen(tmp_path)) > MAXNAMELEN) + return (ERR_WONT_FIT); + + if (strlen(bootpath) == 0) + sprintf(bootpath, "%s", tmp_path); + else + sprintf(bootpath, "%s %s", bootpath, tmp_path); + } + } + + return (strlen(bootpath) > 0 ? 0 : ERR_NO_BOOTPATH); +} + +/* + * Check the disk label information and retrieve needed vdev name-value pairs. + * + * Return: + * 0 - success + * ERR_* - failure + */ +static int +check_pool_label(fsi_file_t *ffi, int label, char *stack) +{ + vdev_phys_t *vdev; + uint64_t sector, pool_state, txg = 0; + char *nvlist, *nv; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + sector = (label * sizeof (vdev_label_t) + VDEV_SKIP_SIZE + + VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT; + + /* Read in the vdev name-value pair list (112K). */ + if (devread(ffi, sector, 0, VDEV_PHYS_SIZE, stack) == 0) + return (ERR_READ); + + vdev = (vdev_phys_t *)stack; + + if (nvlist_unpack(vdev->vp_nvlist, &nvlist)) + return (ERR_FSYS_CORRUPT); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_STATE, &pool_state, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + + if (pool_state == POOL_STATE_DESTROYED) + return (ERR_FILESYSTEM_NOT_FOUND); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_NAME, + current_rootpool, DATA_TYPE_STRING, NULL)) + return (ERR_FSYS_CORRUPT); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_POOL_TXG, &txg, + DATA_TYPE_UINT64, NULL)) + return (ERR_FSYS_CORRUPT); + + /* not an active device */ + if (txg == 0) + return (ERR_NO_BOOTPATH); + + if (nvlist_lookup_value(nvlist, ZPOOL_CONFIG_VDEV_TREE, &nv, + DATA_TYPE_NVLIST, NULL)) + return (ERR_FSYS_CORRUPT); + + if (vdev_get_bootpath(nv, current_bootpath)) + return (ERR_NO_BOOTPATH); + + return (0); +} + +/* + * zfs_mount() locates a valid uberblock of the root pool and read in its MOS + * to the memory address MOS. + * + * Return: + * 1 - success + * 0 - failure + */ +int +zfs_mount(fsi_file_t *ffi, const char *options) +{ + char *stack; + int label = 0; + uberblock_phys_t *ub_array, *ubbest = NULL; + objset_phys_t *osp; + zfs_bootarea_t *zfs_ba; + + /* if zfs is already mounted, don't do it again */ + if (is_zfs_mount == 1) + return (1); + + /* get much bigger data block for zfs */ + if (((zfs_ba = malloc(sizeof (zfs_bootarea_t))) == NULL)) { + return (1); + } + bzero(zfs_ba, sizeof (zfs_bootarea_t)); + + /* replace small data area in fsi with big one */ + free(ffi->ff_fsi->f_data); + ffi->ff_fsi->f_data = (void *)zfs_ba; + + /* If an boot filesystem is passed in, set it to current_bootfs */ + if (options != NULL) { + if (strlen(options) < MAXNAMELEN) { + strcpy(current_bootfs, options); + } + } + + stackbase = ZFS_SCRATCH; + stack = stackbase; + ub_array = (uberblock_phys_t *)stack; + stack += VDEV_UBERBLOCK_RING; + + osp = (objset_phys_t *)stack; + stack += sizeof (objset_phys_t); + + /* XXX add back labels support? */ + for (label = 0; ubbest == NULL && label < (VDEV_LABELS/2); label++) { + uint64_t sector = (label * sizeof (vdev_label_t) + + VDEV_SKIP_SIZE + VDEV_BOOT_HEADER_SIZE + + VDEV_PHYS_SIZE) >> SPA_MINBLOCKSHIFT; + + + /* Read in the uberblock ring (128K). */ + if (devread(ffi, sector, 0, VDEV_UBERBLOCK_RING, + (char *)ub_array) == 0) + continue; + + if ((ubbest = find_bestub(ffi, ub_array, label)) != NULL && + zio_read(ffi, &ubbest->ubp_uberblock.ub_rootbp, osp, stack) + == 0) { + + VERIFY_OS_TYPE(osp, DMU_OST_META); + + /* Got the MOS. Save it at the memory addr MOS. */ + grub_memmove(MOS, &osp->os_meta_dnode, DNODE_SIZE); + + if (check_pool_label(ffi, label, stack)) + return (0); + + /* + * Copy fsi->f_data to ffi->ff_data since + * fsig_mount copies from ff_data to f_data + * overwriting fsi->f_data. + */ + bcopy(zfs_ba, fsig_file_buf(ffi), FSYS_BUFLEN); + + is_zfs_mount = 1; + return (1); + } + } + + return (0); +} + +/* + * zfs_open() locates a file in the rootpool by following the + * MOS and places the dnode of the file in the memory address DNODE. + * + * Return: + * 1 - success + * 0 - failure + */ +int +zfs_open(fsi_file_t *ffi, char *filename) +{ + char *stack; + dnode_phys_t *mdn; + char *bootstring; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + file_buf = NULL; + stackbase = ZFS_SCRATCH; + stack = stackbase; + + mdn = (dnode_phys_t *)stack; + stack += sizeof (dnode_phys_t); + + dnode_mdn = NULL; + dnode_buf = (dnode_phys_t *)stack; + stack += 1<ff_fsi, + alloc_size); + if (bootstring != NULL) { + strcpy(bootstring, zfs_bootstr); + strcat(bootstring, current_rootpool); + strcat(bootstring, "/"); + strcat(bootstring, temp); + strcat(bootstring, zfs_bootpath); + strcat(bootstring, current_bootpath); + strcat(bootstring, "'"); + is_zfs_open = 1; + } + } + } + + if (dnode_get_path(ffi, mdn, filename, DNODE, stack)) { + errnum = ERR_FILE_NOT_FOUND; + return (0); + } + + /* get the file size and set the file position to 0 */ + filemax = ((znode_phys_t *)DN_BONUS(DNODE))->zp_size; + filepos = 0; + + dnode_buf = NULL; + return (1); +} + +/* + * zfs_read reads in the data blocks pointed by the DNODE. + * + * Return: + * len - the length successfully read in to the buffer + * 0 - failure + */ +int +zfs_read(fsi_file_t *ffi, char *buf, int len) +{ + char *stack; + int blksz, length, movesize; + zfs_bootarea_t *zfs_ba = (zfs_bootarea_t *)ffi->ff_fsi->f_data; + + if (file_buf == NULL) { + file_buf = stackbase; + stackbase += SPA_MAXBLOCKSIZE; + file_start = file_end = 0; + } + stack = stackbase; + + /* + * If offset is in memory, move it into the buffer provided and return. + */ + if (filepos >= file_start && filepos+len <= file_end) { + grub_memmove(buf, file_buf + filepos - file_start, len); + filepos += len; + return (len); + } + + blksz = DNODE->dn_datablkszsec << SPA_MINBLOCKSHIFT; + + /* + * Entire Dnode is too big to fit into the space available. We + * will need to read it in chunks. This could be optimized to + * read in as large a chunk as there is space available, but for + * now, this only reads in one data block at a time. + */ + length = len; + while (length) { + /* + * Find requested blkid and the offset within that block. + */ + uint64_t blkid = filepos / blksz; + + if ((errnum = dmu_read(ffi, DNODE, blkid, file_buf, stack))) + return (0); + + file_start = blkid * blksz; + file_end = file_start + blksz; + + movesize = MIN(length, file_end - filepos); + + grub_memmove(buf, file_buf + filepos - file_start, + movesize); + buf += movesize; + length -= movesize; + filepos += movesize; + } + + return (len); +} + +/* + * No-Op + */ +int +zfs_embed(int *start_sector, int needed_sectors) +{ + return (1); +} + +fsi_plugin_ops_t * +fsi_init_plugin(int version, fsi_plugin_t *fp, const char **name) +{ + static fsig_plugin_ops_t ops = { + FSIMAGE_PLUGIN_VERSION, + .fpo_mount = zfs_mount, + .fpo_dir = zfs_open, + .fpo_read = zfs_read + }; + + *name = "zfs"; + return (fsig_init(fp, &ops)); +} diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/fsys_zfs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/fsys_zfs.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,203 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#ifndef _FSYS_ZFS_H +#define _FSYS_ZFS_H + +#include +#include + +#include "zfs-include/zfs.h" +#include "zfs-include/dmu.h" +#include "zfs-include/spa.h" +#include "zfs-include/zio.h" +#include "zfs-include/zio_checksum.h" +#include "zfs-include/vdev_impl.h" +#include "zfs-include/zap_impl.h" +#include "zfs-include/zap_leaf.h" +#include "zfs-include/uberblock_impl.h" +#include "zfs-include/dnode.h" +#include "zfs-include/dsl_dir.h" +#include "zfs-include/zfs_acl.h" +#include "zfs-include/zfs_znode.h" +#include "zfs-include/dsl_dataset.h" +#include "zfs-include/zil.h" +#include "zfs-include/dmu_objset.h" + +/* + * Global Memory addresses to store MOS and DNODE data + */ +#define MOS ((dnode_phys_t *)(((zfs_bootarea_t *) \ + (ffi->ff_fsi->f_data))->zfs_data)) +#define DNODE (MOS+1) /* move sizeof(dnode_phys_t) bytes */ +#define ZFS_SCRATCH ((char *)(DNODE+1)) + +#define MAXNAMELEN 256 + +typedef struct zfs_bootarea { + char zfs_current_bootpath[MAXNAMELEN]; + char zfs_current_rootpool[MAXNAMELEN]; + char zfs_current_bootfs[MAXNAMELEN]; + uint64_t zfs_current_bootfs_obj; + int zfs_open; + + /* cache for a file block of the currently zfs_open()-ed file */ + void *zfs_file_buf; + uint64_t zfs_file_start; + uint64_t zfs_file_end; + + /* cache for a dnode block */ + dnode_phys_t *zfs_dnode_buf; + dnode_phys_t *zfs_dnode_mdn; + uint64_t zfs_dnode_start; + uint64_t zfs_dnode_end; + + char *zfs_stackbase; + char zfs_data[0x400000]; +} zfs_bootarea_t; + +/* + * Verify dnode type. + * Can only be used in functions returning non-0 for failure. + */ +#define VERIFY_DN_TYPE(dnp, type) \ + if (type && (dnp)->dn_type != type) { \ + return (ERR_FSYS_CORRUPT); \ + } + +/* + * Verify object set type. + * Can only be used in functions returning 0 for failure. + */ +#define VERIFY_OS_TYPE(osp, type) \ + if (type && (osp)->os_type != type) { \ + errnum = ERR_FSYS_CORRUPT; \ + return (0); \ + } + +#define ZPOOL_PROP_BOOTFS "bootfs" + +/* General macros */ +#define BSWAP_8(x) ((x) & 0xff) +#define BSWAP_16(x) ((BSWAP_8(x) << 8) | BSWAP_8((x) >> 8)) +#define BSWAP_32(x) ((BSWAP_16(x) << 16) | BSWAP_16((x) >> 16)) +#define BSWAP_64(x) ((BSWAP_32(x) << 32) | BSWAP_32((x) >> 32)) +#define P2ROUNDUP(x, align) (-(-(x) & -(align))) + +/* + * XXX Match these macro up with real zfs once we have nvlist support so that we + * can support large sector disks. + */ +#define UBERBLOCK_SIZE (1ULL << UBERBLOCK_SHIFT) +#undef offsetof +#define offsetof(t, m) (size_t)(&(((t *)0)->m)) +#define VDEV_UBERBLOCK_SHIFT UBERBLOCK_SHIFT +#define VDEV_UBERBLOCK_OFFSET(n) \ +offsetof(vdev_label_t, vl_uberblock[(n) << VDEV_UBERBLOCK_SHIFT]) + +typedef struct uberblock uberblock_t; + +/* XXX Uberblock_phys_t is no longer in the kernel zfs */ +typedef struct uberblock_phys { + uberblock_t ubp_uberblock; + char ubp_pad[UBERBLOCK_SIZE - sizeof (uberblock_t) - + sizeof (zio_block_tail_t)]; + zio_block_tail_t ubp_zbt; +} uberblock_phys_t; + +/* + * Macros to get fields in a bp or DVA. + */ +#define P2PHASE(x, align) ((x) & ((align) - 1)) +#define DVA_OFFSET_TO_PHYS_SECTOR(offset) \ + ((offset + VDEV_LABEL_START_SIZE) >> SPA_MINBLOCKSHIFT) + +/* + * For nvlist manipulation. (from nvpair.h) + */ +#define NV_ENCODE_NATIVE 0 +#define NV_ENCODE_XDR 1 +#define HOST_ENDIAN 1 /* for x86 machine */ +#define DATA_TYPE_UINT64 8 +#define DATA_TYPE_STRING 9 +#define DATA_TYPE_NVLIST 19 +#define DATA_TYPE_NVLIST_ARRAY 20 + +/* + * Decompression Entry - lzjb + */ +#ifndef NBBY +#define NBBY 8 +#endif + +typedef int zfs_decomp_func_t(void *s_start, void *d_start, size_t s_len, + size_t d_len); +typedef struct decomp_entry { + char *name; + zfs_decomp_func_t *decomp_func; +} decomp_entry_t; + +/* + * FAT ZAP data structures + */ +#define ZFS_CRC64_POLY 0xC96C5795D7870F42ULL /* ECMA-182, reflected form */ +#define ZAP_HASH_IDX(hash, n) (((n) == 0) ? 0 : ((hash) >> (64 - (n)))) +#define CHAIN_END 0xffff /* end of the chunk chain */ + +/* + * The amount of space within the chunk available for the array is: + * chunk size - space for type (1) - space for next pointer (2) + */ +#define ZAP_LEAF_ARRAY_BYTES (ZAP_LEAF_CHUNKSIZE - 3) + +#define ZAP_LEAF_HASH_SHIFT(bs) (bs - 5) +#define ZAP_LEAF_HASH_NUMENTRIES(bs) (1 << ZAP_LEAF_HASH_SHIFT(bs)) +#define LEAF_HASH(bs, h) \ + ((ZAP_LEAF_HASH_NUMENTRIES(bs)-1) & \ + ((h) >> (64 - ZAP_LEAF_HASH_SHIFT(bs)-l->l_hdr.lh_prefix_len))) + +/* + * The amount of space available for chunks is: + * block size shift - hash entry size (2) * number of hash + * entries - header space (2*chunksize) + */ +#define ZAP_LEAF_NUMCHUNKS(bs) \ + (((1<l_hash + ZAP_LEAF_HASH_NUMENTRIES(bs)))[idx] +#define ZAP_LEAF_ENTRY(l, bs, idx) (&ZAP_LEAF_CHUNK(l, bs, idx).l_entry) + +extern void fletcher_2_native(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_2_byteswap(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_4_native(const void *, uint64_t, zio_cksum_t *); +extern void fletcher_4_byteswap(const void *, uint64_t, zio_cksum_t *); +extern void zio_checksum_SHA256(const void *, uint64_t, zio_cksum_t *); +extern int lzjb_decompress(void *, void *, size_t, size_t); + +#endif /* !_FSYS_ZFS_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/mb_info.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/mb_info.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,217 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2003 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * The structure type "mod_list" is used by the "multiboot_info" structure. + */ + +struct mod_list +{ + /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ + unsigned long mod_start; + unsigned long mod_end; + + /* Module command line */ + unsigned long cmdline; + + /* padding to take it to 16 bytes (must be zero) */ + unsigned long pad; +}; + + +/* + * INT-15, AX=E820 style "AddressRangeDescriptor" + * ...with a "size" parameter on the front which is the structure size - 4, + * pointing to the next one, up until the full buffer length of the memory + * map has been reached. + */ + +struct AddrRangeDesc +{ + unsigned long size; + unsigned long long BaseAddr; + unsigned long long Length; + unsigned long Type; + + /* unspecified optional padding... */ +} __attribute__ ((packed)); + +/* usable memory "Type", all others are reserved. */ +#define MB_ARD_MEMORY 1 + + +/* Drive Info structure. */ +struct drive_info +{ + /* The size of this structure. */ + unsigned long size; + + /* The BIOS drive number. */ + unsigned char drive_number; + + /* The access mode (see below). */ + unsigned char drive_mode; + + /* The BIOS geometry. */ + unsigned short drive_cylinders; + unsigned char drive_heads; + unsigned char drive_sectors; + + /* The array of I/O ports used for the drive. */ + unsigned short drive_ports[0]; +}; + +/* Drive Mode. */ +#define MB_DI_CHS_MODE 0 +#define MB_DI_LBA_MODE 1 + + +/* APM BIOS info. */ +struct apm_info +{ + unsigned short version; + unsigned short cseg; + unsigned long offset; + unsigned short cseg_16; + unsigned short dseg_16; + unsigned short cseg_len; + unsigned short cseg_16_len; + unsigned short dseg_16_len; +}; + + +/* + * MultiBoot Info description + * + * This is the struct passed to the boot image. This is done by placing + * its address in the EAX register. + */ + +struct multiboot_info +{ + /* MultiBoot info version number */ + unsigned long flags; + + /* Available memory from BIOS */ + unsigned long mem_lower; + unsigned long mem_upper; + + /* "root" partition */ + unsigned long boot_device; + + /* Kernel command line */ + unsigned long cmdline; + + /* Boot-Module list */ + unsigned long mods_count; + unsigned long mods_addr; + + union + { + struct + { + /* (a.out) Kernel symbol table info */ + unsigned long tabsize; + unsigned long strsize; + unsigned long addr; + unsigned long pad; + } + a; + + struct + { + /* (ELF) Kernel section header table */ + unsigned long num; + unsigned long size; + unsigned long addr; + unsigned long shndx; + } + e; + } + syms; + + /* Memory Mapping buffer */ + unsigned long mmap_length; + unsigned long mmap_addr; + + /* Drive Info buffer */ + unsigned long drives_length; + unsigned long drives_addr; + + /* ROM configuration table */ + unsigned long config_table; + + /* Boot Loader Name */ + unsigned long boot_loader_name; + + /* APM table */ + unsigned long apm_table; + + /* Video */ + unsigned long vbe_control_info; + unsigned long vbe_mode_info; + unsigned short vbe_mode; + unsigned short vbe_interface_seg; + unsigned short vbe_interface_off; + unsigned short vbe_interface_len; +}; + +/* + * Flags to be set in the 'flags' parameter above + */ + +/* is there basic lower/upper memory information? */ +#define MB_INFO_MEMORY 0x00000001 +/* is there a boot device set? */ +#define MB_INFO_BOOTDEV 0x00000002 +/* is the command-line defined? */ +#define MB_INFO_CMDLINE 0x00000004 +/* are there modules to do something with? */ +#define MB_INFO_MODS 0x00000008 + +/* These next two are mutually exclusive */ + +/* is there a symbol table loaded? */ +#define MB_INFO_AOUT_SYMS 0x00000010 +/* is there an ELF section header table? */ +#define MB_INFO_ELF_SHDR 0x00000020 + +/* is there a full memory map? */ +#define MB_INFO_MEM_MAP 0x00000040 + +/* Is there drive info? */ +#define MB_INFO_DRIVE_INFO 0x00000080 + +/* Is there a config table? */ +#define MB_INFO_CONFIG_TABLE 0x00000100 + +/* Is there a boot loader name? */ +#define MB_INFO_BOOT_LOADER_NAME 0x00000200 + +/* Is there a APM table? */ +#define MB_INFO_APM_TABLE 0x00000400 + +/* Is there video information? */ +#define MB_INFO_VIDEO_INFO 0x00000800 + +/* + * The following value must be present in the EAX register. + */ + +#define MULTIBOOT_VALID 0x2BADB002 diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/dmu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dmu.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,105 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DMU_H +#define _SYS_DMU_H + +/* + * This file describes the interface that the DMU provides for its + * consumers. + * + * The DMU also interacts with the SPA. That interface is described in + * dmu_spa.h. + */ +typedef enum dmu_object_type { + DMU_OT_NONE, + /* general: */ + DMU_OT_OBJECT_DIRECTORY, /* ZAP */ + DMU_OT_OBJECT_ARRAY, /* UINT64 */ + DMU_OT_PACKED_NVLIST, /* UINT8 (XDR by nvlist_pack/unpack) */ + DMU_OT_PACKED_NVLIST_SIZE, /* UINT64 */ + DMU_OT_BPLIST, /* UINT64 */ + DMU_OT_BPLIST_HDR, /* UINT64 */ + /* spa: */ + DMU_OT_SPACE_MAP_HEADER, /* UINT64 */ + DMU_OT_SPACE_MAP, /* UINT64 */ + /* zil: */ + DMU_OT_INTENT_LOG, /* UINT64 */ + /* dmu: */ + DMU_OT_DNODE, /* DNODE */ + DMU_OT_OBJSET, /* OBJSET */ + /* dsl: */ + DMU_OT_DSL_DIR, /* UINT64 */ + DMU_OT_DSL_DIR_CHILD_MAP, /* ZAP */ + DMU_OT_DSL_DS_SNAP_MAP, /* ZAP */ + DMU_OT_DSL_PROPS, /* ZAP */ + DMU_OT_DSL_DATASET, /* UINT64 */ + /* zpl: */ + DMU_OT_ZNODE, /* ZNODE */ + DMU_OT_ACL, /* ACL */ + DMU_OT_PLAIN_FILE_CONTENTS, /* UINT8 */ + DMU_OT_DIRECTORY_CONTENTS, /* ZAP */ + DMU_OT_MASTER_NODE, /* ZAP */ + DMU_OT_UNLINKED_SET, /* ZAP */ + /* zvol: */ + DMU_OT_ZVOL, /* UINT8 */ + DMU_OT_ZVOL_PROP, /* ZAP */ + /* other; for testing only! */ + DMU_OT_PLAIN_OTHER, /* UINT8 */ + DMU_OT_UINT64_OTHER, /* UINT64 */ + DMU_OT_ZAP_OTHER, /* ZAP */ + /* new object types: */ + DMU_OT_ERROR_LOG, /* ZAP */ + DMU_OT_SPA_HISTORY, /* UINT8 */ + DMU_OT_SPA_HISTORY_OFFSETS, /* spa_his_phys_t */ + DMU_OT_POOL_PROPS, /* ZAP */ + + DMU_OT_NUMTYPES +} dmu_object_type_t; + +typedef enum dmu_objset_type { + DMU_OST_NONE, + DMU_OST_META, + DMU_OST_ZFS, + DMU_OST_ZVOL, + DMU_OST_OTHER, /* For testing only! */ + DMU_OST_ANY, /* Be careful! */ + DMU_OST_NUMTYPES +} dmu_objset_type_t; + +/* + * The names of zap entries in the DIRECTORY_OBJECT of the MOS. + */ +#define DMU_POOL_DIRECTORY_OBJECT 1 +#define DMU_POOL_CONFIG "config" +#define DMU_POOL_ROOT_DATASET "root_dataset" +#define DMU_POOL_SYNC_BPLIST "sync_bplist" +#define DMU_POOL_ERRLOG_SCRUB "errlog_scrub" +#define DMU_POOL_ERRLOG_LAST "errlog_last" +#define DMU_POOL_SPARES "spares" +#define DMU_POOL_DEFLATE "deflate" +#define DMU_POOL_HISTORY "history" +#define DMU_POOL_PROPS "pool_props" +#define DMU_POOL_L2CACHE "l2cache" + +#endif /* _SYS_DMU_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/dmu_objset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dmu_objset.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,35 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DMU_OBJSET_H +#define _SYS_DMU_OBJSET_H + +typedef struct objset_phys { + dnode_phys_t os_meta_dnode; + zil_header_t os_zil_header; + uint64_t os_type; + char os_pad[1024 - sizeof (dnode_phys_t) - sizeof (zil_header_t) - + sizeof (uint64_t)]; +} objset_phys_t; + +#endif /* _SYS_DMU_OBJSET_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/dnode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dnode.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,76 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DNODE_H +#define _SYS_DNODE_H + +/* + * Fixed constants. + */ +#define DNODE_SHIFT 9 /* 512 bytes */ +#define DN_MIN_INDBLKSHIFT 10 /* 1k */ +#define DN_MAX_INDBLKSHIFT 14 /* 16k */ +#define DNODE_BLOCK_SHIFT 14 /* 16k */ +#define DNODE_CORE_SIZE 64 /* 64 bytes for dnode sans blkptrs */ +#define DN_MAX_OBJECT_SHIFT 48 /* 256 trillion (zfs_fid_t limit) */ +#define DN_MAX_OFFSET_SHIFT 64 /* 2^64 bytes in a dnode */ + +/* + * Derived constants. + */ +#define DNODE_SIZE (1 << DNODE_SHIFT) +#define DN_MAX_NBLKPTR ((DNODE_SIZE - DNODE_CORE_SIZE) >> SPA_BLKPTRSHIFT) +#define DN_MAX_BONUSLEN (DNODE_SIZE - DNODE_CORE_SIZE - (1 << SPA_BLKPTRSHIFT)) +#define DN_MAX_OBJECT (1ULL << DN_MAX_OBJECT_SHIFT) + +#define DNODES_PER_BLOCK_SHIFT (DNODE_BLOCK_SHIFT - DNODE_SHIFT) +#define DNODES_PER_BLOCK (1ULL << DNODES_PER_BLOCK_SHIFT) +#define DNODES_PER_LEVEL_SHIFT (DN_MAX_INDBLKSHIFT - SPA_BLKPTRSHIFT) + +#define DN_BONUS(dnp) ((void*)((dnp)->dn_bonus + \ + (((dnp)->dn_nblkptr - 1) * sizeof (blkptr_t)))) + +typedef struct dnode_phys { + uint8_t dn_type; /* dmu_object_type_t */ + uint8_t dn_indblkshift; /* ln2(indirect block size) */ + uint8_t dn_nlevels; /* 1=dn_blkptr->data blocks */ + uint8_t dn_nblkptr; /* length of dn_blkptr */ + uint8_t dn_bonustype; /* type of data in bonus buffer */ + uint8_t dn_checksum; /* ZIO_CHECKSUM type */ + uint8_t dn_compress; /* ZIO_COMPRESS type */ + uint8_t dn_flags; /* DNODE_FLAG_* */ + uint16_t dn_datablkszsec; /* data block size in 512b sectors */ + uint16_t dn_bonuslen; /* length of dn_bonus */ + uint8_t dn_pad2[4]; + + /* accounting is protected by dn_dirty_mtx */ + uint64_t dn_maxblkid; /* largest allocated block ID */ + uint64_t dn_used; /* bytes (or sectors) of disk space */ + + uint64_t dn_pad3[4]; + + blkptr_t dn_blkptr[1]; + uint8_t dn_bonus[DN_MAX_BONUSLEN]; +} dnode_phys_t; + +#endif /* _SYS_DNODE_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/dsl_dataset.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dsl_dataset.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,53 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DSL_DATASET_H +#define _SYS_DSL_DATASET_H + +typedef struct dsl_dataset_phys { + uint64_t ds_dir_obj; + uint64_t ds_prev_snap_obj; + uint64_t ds_prev_snap_txg; + uint64_t ds_next_snap_obj; + uint64_t ds_snapnames_zapobj; /* zap obj of snaps; ==0 for snaps */ + uint64_t ds_num_children; /* clone/snap children; ==0 for head */ + uint64_t ds_creation_time; /* seconds since 1970 */ + uint64_t ds_creation_txg; + uint64_t ds_deadlist_obj; + uint64_t ds_used_bytes; + uint64_t ds_compressed_bytes; + uint64_t ds_uncompressed_bytes; + uint64_t ds_unique_bytes; /* only relevant to snapshots */ + /* + * The ds_fsid_guid is a 56-bit ID that can change to avoid + * collisions. The ds_guid is a 64-bit ID that will never + * change, so there is a small probability that it will collide. + */ + uint64_t ds_fsid_guid; + uint64_t ds_guid; + uint64_t ds_flags; + blkptr_t ds_bp; + uint64_t ds_pad[8]; /* pad out to 320 bytes for good measure */ +} dsl_dataset_phys_t; + +#endif /* _SYS_DSL_DATASET_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/dsl_dir.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/dsl_dir.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,49 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_DSL_DIR_H +#define _SYS_DSL_DIR_H + +typedef struct dsl_dir_phys { + uint64_t dd_creation_time; /* not actually used */ + uint64_t dd_head_dataset_obj; + uint64_t dd_parent_obj; + uint64_t dd_clone_parent_obj; + uint64_t dd_child_dir_zapobj; + /* + * how much space our children are accounting for; for leaf + * datasets, == physical space used by fs + snaps + */ + uint64_t dd_used_bytes; + uint64_t dd_compressed_bytes; + uint64_t dd_uncompressed_bytes; + /* Administrative quota setting */ + uint64_t dd_quota; + /* Administrative reservation setting */ + uint64_t dd_reserved; + uint64_t dd_props_zapobj; + uint64_t dd_deleg_zapobj; /* dataset permissions */ + uint64_t dd_pad[20]; /* pad out to 256 bytes for good measure */ +} dsl_dir_phys_t; + +#endif /* _SYS_DSL_DIR_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/spa.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/spa.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,283 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_SPA_H +#define _SYS_SPA_H + +/* + * General-purpose 32-bit and 64-bit bitfield encodings. + */ +#define BF32_DECODE(x, low, len) P2PHASE((x) >> (low), 1U << (len)) +#define BF64_DECODE(x, low, len) P2PHASE((x) >> (low), 1ULL << (len)) +#define BF32_ENCODE(x, low, len) (P2PHASE((x), 1U << (len)) << (low)) +#define BF64_ENCODE(x, low, len) (P2PHASE((x), 1ULL << (len)) << (low)) + +#define BF32_GET(x, low, len) BF32_DECODE(x, low, len) +#define BF64_GET(x, low, len) BF64_DECODE(x, low, len) + +#define BF32_SET(x, low, len, val) \ + ((x) ^= BF32_ENCODE((x >> low) ^ (val), low, len)) +#define BF64_SET(x, low, len, val) \ + ((x) ^= BF64_ENCODE((x >> low) ^ (val), low, len)) + +#define BF32_GET_SB(x, low, len, shift, bias) \ + ((BF32_GET(x, low, len) + (bias)) << (shift)) +#define BF64_GET_SB(x, low, len, shift, bias) \ + ((BF64_GET(x, low, len) + (bias)) << (shift)) + +#define BF32_SET_SB(x, low, len, shift, bias, val) \ + BF32_SET(x, low, len, ((val) >> (shift)) - (bias)) +#define BF64_SET_SB(x, low, len, shift, bias, val) \ + BF64_SET(x, low, len, ((val) >> (shift)) - (bias)) + +/* + * We currently support nine block sizes, from 512 bytes to 128K. + * We could go higher, but the benefits are near-zero and the cost + * of COWing a giant block to modify one byte would become excessive. + */ +#define SPA_MINBLOCKSHIFT 9 +#define SPA_MAXBLOCKSHIFT 17 +#define SPA_MINBLOCKSIZE (1ULL << SPA_MINBLOCKSHIFT) +#define SPA_MAXBLOCKSIZE (1ULL << SPA_MAXBLOCKSHIFT) + +#define SPA_BLOCKSIZES (SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1) + +/* + * The DVA size encodings for LSIZE and PSIZE support blocks up to 32MB. + * The ASIZE encoding should be at least 64 times larger (6 more bits) + * to support up to 4-way RAID-Z mirror mode with worst-case gang block + * overhead, three DVAs per bp, plus one more bit in case we do anything + * else that expands the ASIZE. + */ +#define SPA_LSIZEBITS 16 /* LSIZE up to 32M (2^16 * 512) */ +#define SPA_PSIZEBITS 16 /* PSIZE up to 32M (2^16 * 512) */ +#define SPA_ASIZEBITS 24 /* ASIZE up to 64 times larger */ + +/* + * All SPA data is represented by 128-bit data virtual addresses (DVAs). + * The members of the dva_t should be considered opaque outside the SPA. + */ +typedef struct dva { + uint64_t dva_word[2]; +} dva_t; + +/* + * Each block has a 256-bit checksum -- strong enough for cryptographic hashes. + */ +typedef struct zio_cksum { + uint64_t zc_word[4]; +} zio_cksum_t; + +/* + * Each block is described by its DVAs, time of birth, checksum, etc. + * The word-by-word, bit-by-bit layout of the blkptr is as follows: + * + * 64 56 48 40 32 24 16 8 0 + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 0 | vdev1 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 1 |G| offset1 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 2 | vdev2 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 3 |G| offset2 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 4 | vdev3 | GRID | ASIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 5 |G| offset3 | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 6 |E| lvl | type | cksum | comp | PSIZE | LSIZE | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 7 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 8 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * 9 | padding | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * a | birth txg | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * b | fill count | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * c | checksum[0] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * d | checksum[1] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * e | checksum[2] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * f | checksum[3] | + * +-------+-------+-------+-------+-------+-------+-------+-------+ + * + * Legend: + * + * vdev virtual device ID + * offset offset into virtual device + * LSIZE logical size + * PSIZE physical size (after compression) + * ASIZE allocated size (including RAID-Z parity and gang block headers) + * GRID RAID-Z layout information (reserved for future use) + * cksum checksum function + * comp compression function + * G gang block indicator + * E endianness + * type DMU object type + * lvl level of indirection + * birth txg transaction group in which the block was born + * fill count number of non-zero blocks under this bp + * checksum[4] 256-bit checksum of the data this bp describes + */ +typedef struct blkptr { + dva_t blk_dva[3]; /* 128-bit Data Virtual Address */ + uint64_t blk_prop; /* size, compression, type, etc */ + uint64_t blk_pad[3]; /* Extra space for the future */ + uint64_t blk_birth; /* transaction group at birth */ + uint64_t blk_fill; /* fill count */ + zio_cksum_t blk_cksum; /* 256-bit checksum */ +} blkptr_t; + +#define SPA_BLKPTRSHIFT 7 /* blkptr_t is 128 bytes */ +#define SPA_DVAS_PER_BP 3 /* Number of DVAs in a bp */ + +/* + * Macros to get and set fields in a bp or DVA. + */ +#define DVA_GET_ASIZE(dva) \ + BF64_GET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0) +#define DVA_SET_ASIZE(dva, x) \ + BF64_SET_SB((dva)->dva_word[0], 0, 24, SPA_MINBLOCKSHIFT, 0, x) + +#define DVA_GET_GRID(dva) BF64_GET((dva)->dva_word[0], 24, 8) +#define DVA_SET_GRID(dva, x) BF64_SET((dva)->dva_word[0], 24, 8, x) + +#define DVA_GET_VDEV(dva) BF64_GET((dva)->dva_word[0], 32, 32) +#define DVA_SET_VDEV(dva, x) BF64_SET((dva)->dva_word[0], 32, 32, x) + +#define DVA_GET_OFFSET(dva) \ + BF64_GET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0) +#define DVA_SET_OFFSET(dva, x) \ + BF64_SET_SB((dva)->dva_word[1], 0, 63, SPA_MINBLOCKSHIFT, 0, x) + +#define DVA_GET_GANG(dva) BF64_GET((dva)->dva_word[1], 63, 1) +#define DVA_SET_GANG(dva, x) BF64_SET((dva)->dva_word[1], 63, 1, x) + +#define BP_GET_LSIZE(bp) \ + (BP_IS_HOLE(bp) ? 0 : \ + BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)) +#define BP_SET_LSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) + +#define BP_GET_PSIZE(bp) \ + BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1) +#define BP_SET_PSIZE(bp, x) \ + BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x) + +#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) +#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) + +#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) +#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) + +#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) +#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) + +#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) +#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) + +#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1)) +#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) + +#define BP_GET_ASIZE(bp) \ + (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + DVA_GET_ASIZE(&(bp)->blk_dva[2])) + +#define BP_GET_UCSIZE(bp) \ + ((BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata) ? \ + BP_GET_PSIZE(bp) : BP_GET_LSIZE(bp)); + +#define BP_GET_NDVAS(bp) \ + (!!DVA_GET_ASIZE(&(bp)->blk_dva[0]) + \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ + !!DVA_GET_ASIZE(&(bp)->blk_dva[2])) + +#define BP_COUNT_GANG(bp) \ + (DVA_GET_GANG(&(bp)->blk_dva[0]) + \ + DVA_GET_GANG(&(bp)->blk_dva[1]) + \ + DVA_GET_GANG(&(bp)->blk_dva[2])) + +#define DVA_EQUAL(dva1, dva2) \ + ((dva1)->dva_word[1] == (dva2)->dva_word[1] && \ + (dva1)->dva_word[0] == (dva2)->dva_word[0]) + +#define ZIO_CHECKSUM_EQUAL(zc1, zc2) \ + (0 == (((zc1).zc_word[0] - (zc2).zc_word[0]) | \ + ((zc1).zc_word[1] - (zc2).zc_word[1]) | \ + ((zc1).zc_word[2] - (zc2).zc_word[2]) | \ + ((zc1).zc_word[3] - (zc2).zc_word[3]))) + + +#define DVA_IS_VALID(dva) (DVA_GET_ASIZE(dva) != 0) + +#define ZIO_SET_CHECKSUM(zcp, w0, w1, w2, w3) \ +{ \ + (zcp)->zc_word[0] = w0; \ + (zcp)->zc_word[1] = w1; \ + (zcp)->zc_word[2] = w2; \ + (zcp)->zc_word[3] = w3; \ +} + +#define BP_IDENTITY(bp) (&(bp)->blk_dva[0]) +#define BP_IS_GANG(bp) DVA_GET_GANG(BP_IDENTITY(bp)) +#define BP_IS_HOLE(bp) ((bp)->blk_birth == 0) +#define BP_IS_OLDER(bp, txg) (!BP_IS_HOLE(bp) && (bp)->blk_birth < (txg)) + +#define BP_ZERO(bp) \ +{ \ + (bp)->blk_dva[0].dva_word[0] = 0; \ + (bp)->blk_dva[0].dva_word[1] = 0; \ + (bp)->blk_dva[1].dva_word[0] = 0; \ + (bp)->blk_dva[1].dva_word[1] = 0; \ + (bp)->blk_dva[2].dva_word[0] = 0; \ + (bp)->blk_dva[2].dva_word[1] = 0; \ + (bp)->blk_prop = 0; \ + (bp)->blk_pad[0] = 0; \ + (bp)->blk_pad[1] = 0; \ + (bp)->blk_pad[2] = 0; \ + (bp)->blk_birth = 0; \ + (bp)->blk_fill = 0; \ + ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ +} + +/* + * Note: the byteorder is either 0 or -1, both of which are palindromes. + * This simplifies the endianness handling a bit. + */ +#ifdef _BIG_ENDIAN +#define ZFS_HOST_BYTEORDER (0ULL) +#else +#define ZFS_HOST_BYTEORDER (-1ULL) +#endif + +#define BP_SHOULD_BYTESWAP(bp) (BP_GET_BYTEORDER(bp) != ZFS_HOST_BYTEORDER) + +#define BP_SPRINTF_LEN 320 + +#endif /* _SYS_SPA_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/uberblock_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/uberblock_impl.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,49 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_UBERBLOCK_IMPL_H +#define _SYS_UBERBLOCK_IMPL_H + +/* + * The uberblock version is incremented whenever an incompatible on-disk + * format change is made to the SPA, DMU, or ZAP. + * + * Note: the first two fields should never be moved. When a storage pool + * is opened, the uberblock must be read off the disk before the version + * can be checked. If the ub_version field is moved, we may not detect + * version mismatch. If the ub_magic field is moved, applications that + * expect the magic number in the first word won't work. + */ +#define UBERBLOCK_MAGIC 0x00bab10c /* oo-ba-bloc! */ +#define UBERBLOCK_SHIFT 10 /* up to 1K */ + +struct uberblock { + uint64_t ub_magic; /* UBERBLOCK_MAGIC */ + uint64_t ub_version; /* ZFS_VERSION */ + uint64_t ub_txg; /* txg of last sync */ + uint64_t ub_guid_sum; /* sum of all vdev guids */ + uint64_t ub_timestamp; /* UTC time of last sync */ + blkptr_t ub_rootbp; /* MOS objset_phys_t */ +}; + +#endif /* _SYS_UBERBLOCK_IMPL_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/vdev_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/vdev_impl.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,70 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_VDEV_IMPL_H +#define _SYS_VDEV_IMPL_H + +#define VDEV_SKIP_SIZE (8 << 10) +#define VDEV_BOOT_HEADER_SIZE (8 << 10) +#define VDEV_PHYS_SIZE (112 << 10) +#define VDEV_UBERBLOCK_RING (128 << 10) + +/* ZFS boot block */ +#define VDEV_BOOT_MAGIC 0x2f5b007b10cULL +#define VDEV_BOOT_VERSION 1 /* version number */ + +typedef struct vdev_boot_header { + uint64_t vb_magic; /* VDEV_BOOT_MAGIC */ + uint64_t vb_version; /* VDEV_BOOT_VERSION */ + uint64_t vb_offset; /* start offset (bytes) */ + uint64_t vb_size; /* size (bytes) */ + char vb_pad[VDEV_BOOT_HEADER_SIZE - 4 * sizeof (uint64_t)]; +} vdev_boot_header_t; + +typedef struct vdev_phys { + char vp_nvlist[VDEV_PHYS_SIZE - sizeof (zio_block_tail_t)]; + zio_block_tail_t vp_zbt; +} vdev_phys_t; + +typedef struct vdev_label { + char vl_pad[VDEV_SKIP_SIZE]; /* 8K */ + vdev_boot_header_t vl_boot_header; /* 8K */ + vdev_phys_t vl_vdev_phys; /* 112K */ + char vl_uberblock[VDEV_UBERBLOCK_RING]; /* 128K */ +} vdev_label_t; /* 256K total */ + +/* + * Size and offset of embedded boot loader region on each label. + * The total size of the first two labels plus the boot area is 4MB. + */ +#define VDEV_BOOT_OFFSET (2 * sizeof (vdev_label_t)) +#define VDEV_BOOT_SIZE (7ULL << 19) /* 3.5M */ + +/* + * Size of label regions at the start and end of each leaf device. + */ +#define VDEV_LABEL_START_SIZE (2 * sizeof (vdev_label_t) + VDEV_BOOT_SIZE) +#define VDEV_LABEL_END_SIZE (2 * sizeof (vdev_label_t)) +#define VDEV_LABELS 4 + +#endif /* _SYS_VDEV_IMPL_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/zap_impl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zap_impl.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,110 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZAP_IMPL_H +#define _SYS_ZAP_IMPL_H + +#define ZAP_MAGIC 0x2F52AB2ABULL + +#define ZAP_HASHBITS 28 +#define MZAP_ENT_LEN 64 +#define MZAP_NAME_LEN (MZAP_ENT_LEN - 8 - 4 - 2) +#define MZAP_MAX_BLKSHIFT SPA_MAXBLOCKSHIFT +#define MZAP_MAX_BLKSZ (1 << MZAP_MAX_BLKSHIFT) + +typedef struct mzap_ent_phys { + uint64_t mze_value; + uint32_t mze_cd; + uint16_t mze_pad; /* in case we want to chain them someday */ + char mze_name[MZAP_NAME_LEN]; +} mzap_ent_phys_t; + +typedef struct mzap_phys { + uint64_t mz_block_type; /* ZBT_MICRO */ + uint64_t mz_salt; + uint64_t mz_pad[6]; + mzap_ent_phys_t mz_chunk[1]; + /* actually variable size depending on block size */ +} mzap_phys_t; + +/* + * The (fat) zap is stored in one object. It is an array of + * 1<= 6] [zap_leaf_t] [ptrtbl] ... + * + */ + +#define ZBT_LEAF ((1ULL << 63) + 0) +#define ZBT_HEADER ((1ULL << 63) + 1) +#define ZBT_MICRO ((1ULL << 63) + 3) +/* any other values are ptrtbl blocks */ + +/* + * the embedded pointer table takes up half a block: + * block size / entry size (2^3) / 2 + */ +#define ZAP_EMBEDDED_PTRTBL_SHIFT(zap) (FZAP_BLOCK_SHIFT(zap) - 3 - 1) + +/* + * The embedded pointer table starts half-way through the block. Since + * the pointer table itself is half the block, it starts at (64-bit) + * word number (1<zap_f.zap_phys) \ + [(idx) + (1<| + * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->| + * |<---- znode (264) ---->|<---- data (56) ---->| + * + * At present, we only use this space to store symbolic links. + */ +} znode_phys_t; + +#endif /* _SYS_FS_ZFS_ZNODE_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/zil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zil.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,51 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZIL_H +#define _SYS_ZIL_H + +/* + * Intent log format: + * + * Each objset has its own intent log. The log header (zil_header_t) + * for objset N's intent log is kept in the Nth object of the SPA's + * intent_log objset. The log header points to a chain of log blocks, + * each of which contains log records (i.e., transactions) followed by + * a log block trailer (zil_trailer_t). The format of a log record + * depends on the record (or transaction) type, but all records begin + * with a common structure that defines the type, length, and txg. + */ + +/* + * Intent log header - this on disk structure holds fields to manage + * the log. All fields are 64 bit to easily handle cross architectures. + */ +typedef struct zil_header { + uint64_t zh_claim_txg; /* txg in which log blocks were claimed */ + uint64_t zh_replay_seq; /* highest replayed sequence number */ + blkptr_t zh_log; /* log chain */ + uint64_t zh_claim_seq; /* highest claimed sequence number */ + uint64_t zh_pad[5]; +} zil_header_t; + +#endif /* _SYS_ZIL_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/zio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zio.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,81 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _ZIO_H +#define _ZIO_H + +#define ZBT_MAGIC 0x210da7ab10c7a11ULL /* zio data bloc tail */ + +typedef struct zio_block_tail { + uint64_t zbt_magic; /* for validation, endianness */ + zio_cksum_t zbt_cksum; /* 256-bit checksum */ +} zio_block_tail_t; + +/* + * Gang block headers are self-checksumming and contain an array + * of block pointers. + */ +#define SPA_GANGBLOCKSIZE SPA_MINBLOCKSIZE +#define SPA_GBH_NBLKPTRS ((SPA_GANGBLOCKSIZE - \ + sizeof (zio_block_tail_t)) / sizeof (blkptr_t)) +#define SPA_GBH_FILLER ((SPA_GANGBLOCKSIZE - \ + sizeof (zio_block_tail_t) - \ + (SPA_GBH_NBLKPTRS * sizeof (blkptr_t))) /\ + sizeof (uint64_t)) + +#define ZIO_GET_IOSIZE(zio) \ + (BP_IS_GANG((zio)->io_bp) ? \ + SPA_GANGBLOCKSIZE : BP_GET_PSIZE((zio)->io_bp)) + +typedef struct zio_gbh { + blkptr_t zg_blkptr[SPA_GBH_NBLKPTRS]; + uint64_t zg_filler[SPA_GBH_FILLER]; + zio_block_tail_t zg_tail; +} zio_gbh_phys_t; + +enum zio_checksum { + ZIO_CHECKSUM_INHERIT = 0, + ZIO_CHECKSUM_ON, + ZIO_CHECKSUM_OFF, + ZIO_CHECKSUM_LABEL, + ZIO_CHECKSUM_GANG_HEADER, + ZIO_CHECKSUM_ZILOG, + ZIO_CHECKSUM_FLETCHER_2, + ZIO_CHECKSUM_FLETCHER_4, + ZIO_CHECKSUM_SHA256, + ZIO_CHECKSUM_FUNCTIONS +}; + +#define ZIO_CHECKSUM_ON_VALUE ZIO_CHECKSUM_FLETCHER_2 +#define ZIO_CHECKSUM_DEFAULT ZIO_CHECKSUM_ON + +enum zio_compress { + ZIO_COMPRESS_INHERIT = 0, + ZIO_COMPRESS_ON, + ZIO_COMPRESS_OFF, + ZIO_COMPRESS_LZJB, + ZIO_COMPRESS_EMPTY, + ZIO_COMPRESS_FUNCTIONS +}; + +#endif /* _ZIO_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs-include/zio_checksum.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs-include/zio_checksum.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,42 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_ZIO_CHECKSUM_H +#define _SYS_ZIO_CHECKSUM_H + +/* + * Signature for checksum functions. + */ +typedef void zio_checksum_t(const void *data, uint64_t size, zio_cksum_t *zcp); + +/* + * Information about each checksum function. + */ +typedef struct zio_checksum_info { + zio_checksum_t *ci_func[2]; /* checksum function for each byteorder */ + int ci_correctable; /* number of correctable bits */ + int ci_zbt; /* uses zio block tail? */ + char *ci_name; /* descriptive name */ +} zio_checksum_info_t; + +#endif /* _SYS_ZIO_CHECKSUM_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs_fletcher.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_fletcher.c Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,93 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + + +void +fletcher_2_native(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint64_t *ip = buf; + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); + uint64_t a0, b0, a1, b1; + + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 += ip[0]; + a1 += ip[1]; + b0 += a0; + b1 += a1; + } + + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); +} + +void +fletcher_2_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint64_t *ip = buf; + const uint64_t *ipend = ip + (size / sizeof (uint64_t)); + uint64_t a0, b0, a1, b1; + + for (a0 = b0 = a1 = b1 = 0; ip < ipend; ip += 2) { + a0 += BSWAP_64(ip[0]); + a1 += BSWAP_64(ip[1]); + b0 += a0; + b1 += a1; + } + + ZIO_SET_CHECKSUM(zcp, a0, a1, b0, b1); +} + +void +fletcher_4_native(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint32_t *ip = buf; + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); + uint64_t a, b, c, d; + + for (a = b = c = d = 0; ip < ipend; ip++) { + a += ip[0]; + b += a; + c += b; + d += c; + } + + ZIO_SET_CHECKSUM(zcp, a, b, c, d); +} + +void +fletcher_4_byteswap(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + const uint32_t *ip = buf; + const uint32_t *ipend = ip + (size / sizeof (uint32_t)); + uint64_t a, b, c, d; + + for (a = b = c = d = 0; ip < ipend; ip++) { + a += BSWAP_32(ip[0]); + b += a; + c += b; + d += c; + } + + ZIO_SET_CHECKSUM(zcp, a, b, c, d); +} diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs_lzjb.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_lzjb.c Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,60 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + +#define MATCH_BITS 6 +#define MATCH_MIN 3 +#define OFFSET_MASK ((1 << (16 - MATCH_BITS)) - 1) + + +/*ARGSUSED*/ +int +lzjb_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len) +{ + unsigned char *src = s_start; + unsigned char *dst = d_start; + unsigned char *d_end = (unsigned char *)d_start + d_len; + unsigned char *cpy; + unsigned char copymap = '\0'; + int copymask = 1 << (NBBY - 1); + + while (dst < d_end) { + if ((copymask <<= 1) == (1 << NBBY)) { + copymask = 1; + copymap = *src++; + } + if (copymap & (unsigned char)copymask) { + int mlen = (src[0] >> (NBBY - MATCH_BITS)) + MATCH_MIN; + int offset = ((src[0] << NBBY) | src[1]) & OFFSET_MASK; + src += 2; + if ((cpy = dst - offset) < (unsigned char *)d_start) + return (-1); + while (--mlen >= 0 && dst < d_end) + *dst++ = *cpy++; + } else { + *dst++ = *src++; + } + } + return (0); +} diff -r f2457c7aff8d -r 611787b6ca35 tools/libfsimage/zfs/zfs_sha256.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libfsimage/zfs/zfs_sha256.c Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,124 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#include "fsys_zfs.h" + +/* + * SHA-256 checksum, as specified in FIPS 180-2, available at: + * http://csrc.nist.gov/cryptval + * + * This is a very compact implementation of SHA-256. + * It is designed to be simple and portable, not to be fast. + */ + +/* + * The literal definitions according to FIPS180-2 would be: + * + * Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) + * Maj(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) + * + * We use logical equivalents which require one less op. + */ +#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define Maj(x, y, z) (((x) & (y)) ^ ((z) & ((x) ^ (y)))) +#define Rot32(x, s) (((x) >> s) | ((x) << (32 - s))) +#define SIGMA0(x) (Rot32(x, 2) ^ Rot32(x, 13) ^ Rot32(x, 22)) +#define SIGMA1(x) (Rot32(x, 6) ^ Rot32(x, 11) ^ Rot32(x, 25)) +#define sigma0(x) (Rot32(x, 7) ^ Rot32(x, 18) ^ ((x) >> 3)) +#define sigma1(x) (Rot32(x, 17) ^ Rot32(x, 19) ^ ((x) >> 10)) + +static const uint32_t SHA256_K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static void +SHA256Transform(uint32_t *H, const uint8_t *cp) +{ + uint32_t a, b, c, d, e, f, g, h, t, T1, T2, W[64]; + + for (t = 0; t < 16; t++, cp += 4) + W[t] = (cp[0] << 24) | (cp[1] << 16) | (cp[2] << 8) | cp[3]; + + for (t = 16; t < 64; t++) + W[t] = sigma1(W[t - 2]) + W[t - 7] + + sigma0(W[t - 15]) + W[t - 16]; + + a = H[0]; b = H[1]; c = H[2]; d = H[3]; + e = H[4]; f = H[5]; g = H[6]; h = H[7]; + + for (t = 0; t < 64; t++) { + T1 = h + SIGMA1(e) + Ch(e, f, g) + SHA256_K[t] + W[t]; + T2 = SIGMA0(a) + Maj(a, b, c); + h = g; g = f; f = e; e = d + T1; + d = c; c = b; b = a; a = T1 + T2; + } + + H[0] += a; H[1] += b; H[2] += c; H[3] += d; + H[4] += e; H[5] += f; H[6] += g; H[7] += h; +} + +void +zio_checksum_SHA256(const void *buf, uint64_t size, zio_cksum_t *zcp) +{ + uint32_t H[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; + uint8_t pad[128]; + int padsize = size & 63; + int i; + + for (i = 0; i < size - padsize; i += 64) + SHA256Transform(H, (uint8_t *)buf + i); + + for (i = 0; i < padsize; i++) + pad[i] = ((uint8_t *)buf)[i]; + + for (pad[padsize++] = 0x80; (padsize & 63) != 56; padsize++) + pad[padsize] = 0; + + for (i = 0; i < 8; i++) + pad[padsize++] = (size << 3) >> (56 - 8 * i); + + for (i = 0; i < padsize; i += 64) + SHA256Transform(H, pad + i); + + ZIO_SET_CHECKSUM(zcp, + (uint64_t)H[0] << 32 | H[1], + (uint64_t)H[2] << 32 | H[3], + (uint64_t)H[4] << 32 | H[5], + (uint64_t)H[6] << 32 | H[7]); +} diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/Makefile --- a/tools/libxc/Makefile Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libxc/Makefile Thu May 08 18:40:07 2008 +0900 @@ -53,6 +53,7 @@ GUEST_SRCS-y += xc_dom_c GUEST_SRCS-y += xc_dom_compat_linux.c GUEST_SRCS-$(CONFIG_X86) += xc_dom_x86.c +GUEST_SRCS-$(CONFIG_X86) += xc_cpuid_x86.c GUEST_SRCS-$(CONFIG_IA64) += xc_dom_ia64.c GUEST_SRCS-$(CONFIG_POWERPC) += xc_dom_powerpc.c endif diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xc_cpufeature.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxc/xc_cpufeature.h Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,115 @@ +#ifndef __LIBXC_CPUFEATURE_H +#define __LIBXC_CPUFEATURE_H + +/* Intel-defined CPU features, CPUID level 0x00000001 (edx), word 0 */ +#define X86_FEATURE_FPU (0*32+ 0) /* Onboard FPU */ +#define X86_FEATURE_VME (0*32+ 1) /* Virtual Mode Extensions */ +#define X86_FEATURE_DE (0*32+ 2) /* Debugging Extensions */ +#define X86_FEATURE_PSE (0*32+ 3) /* Page Size Extensions */ +#define X86_FEATURE_TSC (0*32+ 4) /* Time Stamp Counter */ +#define X86_FEATURE_MSR (0*32+ 5) /* Model-Specific Registers, RDMSR, WRMSR */ +#define X86_FEATURE_PAE (0*32+ 6) /* Physical Address Extensions */ +#define X86_FEATURE_MCE (0*32+ 7) /* Machine Check Architecture */ +#define X86_FEATURE_CX8 (0*32+ 8) /* CMPXCHG8 instruction */ +#define X86_FEATURE_APIC (0*32+ 9) /* Onboard APIC */ +#define X86_FEATURE_SEP (0*32+11) /* SYSENTER/SYSEXIT */ +#define X86_FEATURE_MTRR (0*32+12) /* Memory Type Range Registers */ +#define X86_FEATURE_PGE (0*32+13) /* Page Global Enable */ +#define X86_FEATURE_MCA (0*32+14) /* Machine Check Architecture */ +#define X86_FEATURE_CMOV (0*32+15) /* CMOV instruction (FCMOVCC and FCOMI too if FPU present) */ +#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */ +#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */ +#define X86_FEATURE_PN (0*32+18) /* Processor serial number */ +#define X86_FEATURE_CLFLSH (0*32+19) /* Supports the CLFLUSH instruction */ +#define X86_FEATURE_DS (0*32+21) /* Debug Store */ +#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */ +#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */ +#define X86_FEATURE_FXSR (0*32+24) /* FXSAVE and FXRSTOR instructions (fast save and restore */ + /* of FPU context), and CR4.OSFXSR available */ +#define X86_FEATURE_XMM (0*32+25) /* Streaming SIMD Extensions */ +#define X86_FEATURE_XMM2 (0*32+26) /* Streaming SIMD Extensions-2 */ +#define X86_FEATURE_SELFSNOOP (0*32+27) /* CPU self snoop */ +#define X86_FEATURE_HT (0*32+28) /* Hyper-Threading */ +#define X86_FEATURE_ACC (0*32+29) /* Automatic clock control */ +#define X86_FEATURE_IA64 (0*32+30) /* IA-64 processor */ +#define X86_FEATURE_PBE (0*32+31) /* Pending Break Enable */ + +/* AMD-defined CPU features, CPUID level 0x80000001, word 1 */ +/* Don't duplicate feature flags which are redundant with Intel! */ +#define X86_FEATURE_SYSCALL (1*32+11) /* SYSCALL/SYSRET */ +#define X86_FEATURE_MP (1*32+19) /* MP Capable. */ +#define X86_FEATURE_NX (1*32+20) /* Execute Disable */ +#define X86_FEATURE_MMXEXT (1*32+22) /* AMD MMX extensions */ +#define X86_FEATURE_FFXSR (1*32+25) /* FFXSR instruction optimizations */ +#define X86_FEATURE_PAGE1GB (1*32+26) /* 1Gb large page support */ +#define X86_FEATURE_RDTSCP (1*32+27) /* RDTSCP */ +#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */ +#define X86_FEATURE_3DNOWEXT (1*32+30) /* AMD 3DNow! extensions */ +#define X86_FEATURE_3DNOW (1*32+31) /* 3DNow! */ + +/* Transmeta-defined CPU features, CPUID level 0x80860001, word 2 */ +#define X86_FEATURE_RECOVERY (2*32+ 0) /* CPU in recovery mode */ +#define X86_FEATURE_LONGRUN (2*32+ 1) /* Longrun power control */ +#define X86_FEATURE_LRTI (2*32+ 3) /* LongRun table interface */ + +/* Other features, Linux-defined mapping, word 3 */ +/* This range is used for feature bits which conflict or are synthesized */ +#define X86_FEATURE_CXMMX (3*32+ 0) /* Cyrix MMX extensions */ +#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */ +#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */ +#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */ +/* cpu types for specific tunings: */ +#define X86_FEATURE_K8 (3*32+ 4) /* Opteron, Athlon64 */ +#define X86_FEATURE_K7 (3*32+ 5) /* Athlon */ +#define X86_FEATURE_P3 (3*32+ 6) /* P3 */ +#define X86_FEATURE_P4 (3*32+ 7) /* P4 */ +#define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */ + +/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ +#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ +#define X86_FEATURE_DTES64 (4*32+ 2) /* 64-bit Debug Store */ +#define X86_FEATURE_MWAIT (4*32+ 3) /* Monitor/Mwait support */ +#define X86_FEATURE_DSCPL (4*32+ 4) /* CPL Qualified Debug Store */ +#define X86_FEATURE_VMXE (4*32+ 5) /* Virtual Machine Extensions */ +#define X86_FEATURE_SMXE (4*32+ 6) /* Safer Mode Extensions */ +#define X86_FEATURE_EST (4*32+ 7) /* Enhanced SpeedStep */ +#define X86_FEATURE_TM2 (4*32+ 8) /* Thermal Monitor 2 */ +#define X86_FEATURE_SSSE3 (4*32+ 9) /* Supplemental Streaming SIMD Extensions-3 */ +#define X86_FEATURE_CID (4*32+10) /* Context ID */ +#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */ +#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */ +#define X86_FEATURE_PDCM (4*32+15) /* Perf/Debug Capability MSR */ +#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */ +#define X86_FEATURE_SSE4_1 (4*32+19) /* Streaming SIMD Extensions 4.1 */ +#define X86_FEATURE_SSE4_2 (4*32+20) /* Streaming SIMD Extensions 4.2 */ +#define X86_FEATURE_POPCNT (4*32+23) /* POPCNT instruction */ + +/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ +#define X86_FEATURE_XSTORE (5*32+ 2) /* on-CPU RNG present (xstore insn) */ +#define X86_FEATURE_XSTORE_EN (5*32+ 3) /* on-CPU RNG enabled */ +#define X86_FEATURE_XCRYPT (5*32+ 6) /* on-CPU crypto (xcrypt insn) */ +#define X86_FEATURE_XCRYPT_EN (5*32+ 7) /* on-CPU crypto enabled */ +#define X86_FEATURE_ACE2 (5*32+ 8) /* Advanced Cryptography Engine v2 */ +#define X86_FEATURE_ACE2_EN (5*32+ 9) /* ACE v2 enabled */ +#define X86_FEATURE_PHE (5*32+ 10) /* PadLock Hash Engine */ +#define X86_FEATURE_PHE_EN (5*32+ 11) /* PHE enabled */ +#define X86_FEATURE_PMM (5*32+ 12) /* PadLock Montgomery Multiplier */ +#define X86_FEATURE_PMM_EN (5*32+ 13) /* PMM enabled */ + +/* More extended AMD flags: CPUID level 0x80000001, ecx, word 6 */ +#define X86_FEATURE_LAHF_LM (6*32+ 0) /* LAHF/SAHF in long mode */ +#define X86_FEATURE_CMP_LEGACY (6*32+ 1) /* If yes HyperThreading not valid */ +#define X86_FEATURE_SVME (6*32+ 2) /* Secure Virtual Machine */ +#define X86_FEATURE_EXTAPICSPACE (6*32+ 3) /* Extended APIC space */ +#define X86_FEATURE_ALTMOVCR (6*32+ 4) /* LOCK MOV CR accesses CR+8 */ +#define X86_FEATURE_ABM (6*32+ 5) /* Advanced Bit Manipulation */ +#define X86_FEATURE_SSE4A (6*32+ 6) /* AMD Streaming SIMD Extensions-4a */ +#define X86_FEATURE_MISALIGNSSE (6*32+ 7) /* Misaligned SSE Access */ +#define X86_FEATURE_3DNOWPF (6*32+ 8) /* 3DNow! Prefetch */ +#define X86_FEATURE_OSVW (6*32+ 9) /* OS Visible Workaround */ +#define X86_FEATURE_IBS (6*32+ 10) /* Instruction Based Sampling */ +#define X86_FEATURE_SSE5 (6*32+ 11) /* AMD Streaming SIMD Extensions-5 */ +#define X86_FEATURE_SKINIT (6*32+ 12) /* SKINIT, STGI/CLGI, DEV */ +#define X86_FEATURE_WDT (6*32+ 13) /* Watchdog Timer */ + +#endif /* __LIBXC_CPUFEATURE_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xc_cpuid_x86.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxc/xc_cpuid_x86.c Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,433 @@ +/****************************************************************************** + * xc_cpuid_x86.c + * + * Compute cpuid of a domain. + * + * Copyright (c) 2008, Citrix Systems, 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include "xc_private.h" +#include "xc_cpufeature.h" +#include + +#define bitmaskof(idx) (1u << ((idx) & 31)) +#define clear_bit(idx, dst) ((dst) &= ~(1u << (idx))) +#define set_bit(idx, dst) ((dst) |= (1u << (idx))) + +#define DEF_MAX_BASE 0x00000004u +#define DEF_MAX_EXT 0x80000008u + +static void amd_xc_cpuid_policy( + int xc, domid_t domid, const unsigned int *input, unsigned int *regs) +{ + unsigned long pae = 0; + + xc_get_hvm_param(xc, domid, HVM_PARAM_PAE_ENABLED, &pae); + + switch ( input[0] ) + { + case 0x00000001: + /* Mask Intel-only features. */ + regs[2] &= ~(bitmaskof(X86_FEATURE_SSSE3) | + bitmaskof(X86_FEATURE_SSE4_1) | + bitmaskof(X86_FEATURE_SSE4_2)); + break; + + case 0x00000002: + case 0x00000004: + regs[0] = regs[1] = regs[2] = 0; + break; + + case 0x80000001: + if ( !pae ) + clear_bit(X86_FEATURE_PAE & 31, regs[3]); + clear_bit(X86_FEATURE_PSE36 & 31, regs[3]); + + /* Filter all other features according to a whitelist. */ + regs[2] &= (bitmaskof(X86_FEATURE_LAHF_LM) | + bitmaskof(X86_FEATURE_ALTMOVCR) | + bitmaskof(X86_FEATURE_ABM) | + bitmaskof(X86_FEATURE_SSE4A) | + bitmaskof(X86_FEATURE_MISALIGNSSE) | + bitmaskof(X86_FEATURE_3DNOWPF)); + regs[3] &= (0x0183f3ff | /* features shared with 0x00000001:EDX */ + bitmaskof(X86_FEATURE_NX) | + bitmaskof(X86_FEATURE_LM) | + bitmaskof(X86_FEATURE_SYSCALL) | + bitmaskof(X86_FEATURE_MP) | + bitmaskof(X86_FEATURE_MMXEXT) | + bitmaskof(X86_FEATURE_FFXSR) | + bitmaskof(X86_FEATURE_3DNOW) | + bitmaskof(X86_FEATURE_3DNOWEXT)); + break; + } +} + +static void intel_xc_cpuid_policy( + int xc, domid_t domid, const unsigned int *input, unsigned int *regs) +{ + switch ( input[0] ) + { + case 0x00000001: + /* Mask AMD-only features. */ + regs[2] &= ~(bitmaskof(X86_FEATURE_POPCNT)); + break; + + case 0x00000004: + regs[0] &= 0x3FF; + regs[3] &= 0x3FF; + break; + + case 0x80000001: + /* Only a few features are advertised in Intel's 0x80000001. */ + regs[2] &= (bitmaskof(X86_FEATURE_LAHF_LM)); + regs[3] &= (bitmaskof(X86_FEATURE_NX) | + bitmaskof(X86_FEATURE_LM) | + bitmaskof(X86_FEATURE_SYSCALL)); + break; + } +} + +static void cpuid(const unsigned int *input, unsigned int *regs) +{ + unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1]; + unsigned int bx_temp; + asm ( "mov %%ebx,%4; cpuid; mov %%ebx,%1; mov %4,%%ebx" + : "=a" (regs[0]), "=r" (regs[1]), + "=c" (regs[2]), "=d" (regs[3]), "=m" (bx_temp) + : "0" (input[0]), "2" (count) ); +} + +/* Get the manufacturer brand name of the host processor. */ +static void xc_cpuid_brand_get(char *str) +{ + unsigned int input[2] = { 0, 0 }; + unsigned int regs[4]; + + cpuid(input, regs); + + *(uint32_t *)(str + 0) = regs[1]; + *(uint32_t *)(str + 4) = regs[3]; + *(uint32_t *)(str + 8) = regs[2]; + str[12] = '\0'; +} + +static void xc_cpuid_policy( + int xc, domid_t domid, const unsigned int *input, unsigned int *regs) +{ + char brand[13]; + unsigned long pae; + + xc_get_hvm_param(xc, domid, HVM_PARAM_PAE_ENABLED, &pae); + + switch( input[0] ) + { + case 0x00000000: + if ( regs[0] > DEF_MAX_BASE ) + regs[0] = DEF_MAX_BASE; + break; + + case 0x00000001: + regs[2] &= (bitmaskof(X86_FEATURE_XMM3) | + bitmaskof(X86_FEATURE_SSSE3) | + bitmaskof(X86_FEATURE_CX16) | + bitmaskof(X86_FEATURE_SSE4_1) | + bitmaskof(X86_FEATURE_SSE4_2) | + bitmaskof(X86_FEATURE_POPCNT)); + + regs[3] &= (bitmaskof(X86_FEATURE_FPU) | + bitmaskof(X86_FEATURE_VME) | + bitmaskof(X86_FEATURE_DE) | + bitmaskof(X86_FEATURE_PSE) | + bitmaskof(X86_FEATURE_TSC) | + bitmaskof(X86_FEATURE_MSR) | + bitmaskof(X86_FEATURE_PAE) | + bitmaskof(X86_FEATURE_MCE) | + bitmaskof(X86_FEATURE_CX8) | + bitmaskof(X86_FEATURE_APIC) | + bitmaskof(X86_FEATURE_SEP) | + bitmaskof(X86_FEATURE_MTRR) | + bitmaskof(X86_FEATURE_PGE) | + bitmaskof(X86_FEATURE_MCA) | + bitmaskof(X86_FEATURE_CMOV) | + bitmaskof(X86_FEATURE_PAT) | + bitmaskof(X86_FEATURE_CLFLSH) | + bitmaskof(X86_FEATURE_MMX) | + bitmaskof(X86_FEATURE_FXSR) | + bitmaskof(X86_FEATURE_XMM) | + bitmaskof(X86_FEATURE_XMM2)); + + /* We always support MTRR MSRs. */ + regs[3] |= bitmaskof(X86_FEATURE_MTRR); + + if ( !pae ) + clear_bit(X86_FEATURE_PAE & 31, regs[3]); + break; + + case 0x80000000: + if ( regs[0] > DEF_MAX_EXT ) + regs[0] = DEF_MAX_EXT; + break; + + case 0x80000001: + if ( !pae ) + clear_bit(X86_FEATURE_NX & 31, regs[3]); + break; + + + case 0x80000008: + regs[0] &= 0x0000ffffu; + regs[1] = regs[2] = regs[3] = 0; + break; + + case 0x00000002: + case 0x00000004: + case 0x80000002: + case 0x80000003: + case 0x80000004: + case 0x80000006: + break; + + default: + regs[0] = regs[1] = regs[2] = regs[3] = 0; + break; + } + + xc_cpuid_brand_get(brand); + if ( strstr(brand, "AMD") ) + amd_xc_cpuid_policy(xc, domid, input, regs); + else + intel_xc_cpuid_policy(xc, domid, input, regs); +} + +static int xc_cpuid_do_domctl( + int xc, domid_t domid, + const unsigned int *input, const unsigned int *regs) +{ + DECLARE_DOMCTL; + + memset(&domctl, 0, sizeof (domctl)); + domctl.domain = domid; + domctl.cmd = XEN_DOMCTL_set_cpuid; + domctl.u.cpuid.input[0] = input[0]; + domctl.u.cpuid.input[1] = input[1]; + domctl.u.cpuid.eax = regs[0]; + domctl.u.cpuid.ebx = regs[1]; + domctl.u.cpuid.ecx = regs[2]; + domctl.u.cpuid.edx = regs[3]; + + return do_domctl(xc, &domctl); +} + +static char *alloc_str(void) +{ + char *s = malloc(33); + memset(s, 0, 33); + return s; +} + +void xc_cpuid_to_str(const unsigned int *regs, char **strs) +{ + int i, j; + + for ( i = 0; i < 4; i++ ) + { + strs[i] = alloc_str(); + for ( j = 0; j < 32; j++ ) + strs[i][j] = !!((regs[i] & (1U << (31 - j)))) ? '1' : '0'; + } +} + +int xc_cpuid_apply_policy(int xc, domid_t domid) +{ + unsigned int input[2] = { 0, 0 }, regs[4]; + unsigned int base_max, ext_max; + int rc; + + cpuid(input, regs); + base_max = (regs[0] <= DEF_MAX_BASE) ? regs[0] : DEF_MAX_BASE; + input[0] = 0x80000000; + cpuid(input, regs); + ext_max = (regs[0] <= DEF_MAX_EXT) ? regs[0] : DEF_MAX_EXT; + + input[0] = 0; + input[1] = XEN_CPUID_INPUT_UNUSED; + for ( ; ; ) + { + cpuid(input, regs); + xc_cpuid_policy(xc, domid, input, regs); + + if ( regs[0] || regs[1] || regs[2] || regs[3] ) + { + rc = xc_cpuid_do_domctl(xc, domid, input, regs); + if ( rc ) + return rc; + + /* Intel cache descriptor leaves. */ + if ( input[0] == 4 ) + { + input[1]++; + /* More to do? Then loop keeping %%eax==0x00000004. */ + if ( (regs[0] & 0x1f) != 0 ) + continue; + } + } + + input[0]++; + input[1] = (input[0] == 4) ? 0 : XEN_CPUID_INPUT_UNUSED; + if ( !(input[0] & 0x80000000u) && (input[0] > base_max ) ) + input[0] = 0x80000000u; + + if ( (input[0] & 0x80000000u) && (input[0] > ext_max) ) + break; + } + + return 0; +} + +/* + * Check whether a VM is allowed to launch on this host's processor type. + * + * @config format is similar to that of xc_cpuid_set(): + * '1' -> the bit must be set to 1 + * '0' -> must be 0 + * 'x' -> we don't care + * 's' -> (same) must be the same + */ +int xc_cpuid_check( + int xc, const unsigned int *input, + const char **config, + char **config_transformed) +{ + int i, j; + unsigned int regs[4]; + + memset(config_transformed, 0, 4 * sizeof(*config_transformed)); + + cpuid(input, regs); + + for ( i = 0; i < 4; i++ ) + { + if ( config[i] == NULL ) + continue; + config_transformed[i] = alloc_str(); + for ( j = 0; j < 32; j++ ) + { + unsigned char val = !!((regs[i] & (1U << (31 - j)))); + if ( !strchr("10xs", config[i][j]) || + ((config[i][j] == '1') && !val) || + ((config[i][j] == '0') && val) ) + goto fail; + config_transformed[i][j] = config[i][j]; + if ( config[i][j] == 's' ) + config_transformed[i][j] = '0' + val; + } + } + + return 0; + + fail: + for ( i = 0; i < 4; i++ ) + { + free(config_transformed[i]); + config_transformed[i] = NULL; + } + return -EPERM; +} + +/* + * Configure a single input with the informatiom from config. + * + * Config is an array of strings: + * config[0] = eax + * config[1] = ebx + * config[2] = ecx + * config[3] = edx + * + * The format of the string is the following: + * '1' -> force to 1 + * '0' -> force to 0 + * 'x' -> we don't care (use default) + * 'k' -> pass through host value + * 's' -> pass through the first time and then keep the same value + * across save/restore and migration. + * + * For 's' and 'x' the configuration is overwritten with the value applied. + */ +int xc_cpuid_set( + int xc, domid_t domid, const unsigned int *input, + const char **config, char **config_transformed) +{ + int rc; + unsigned int i, j, regs[4], polregs[4]; + + memset(config_transformed, 0, 4 * sizeof(*config_transformed)); + + cpuid(input, regs); + + memcpy(polregs, regs, sizeof(regs)); + xc_cpuid_policy(xc, domid, input, polregs); + + for ( i = 0; i < 4; i++ ) + { + if ( config[i] == NULL ) + { + regs[i] = polregs[i]; + continue; + } + + config_transformed[i] = alloc_str(); + + for ( j = 0; j < 32; j++ ) + { + unsigned char val = !!((regs[i] & (1U << (31 - j)))); + unsigned char polval = !!((polregs[i] & (1U << (31 - j)))); + + rc = -EINVAL; + if ( !strchr("10xks", config[i][j]) ) + goto fail; + + if ( config[i][j] == '1' ) + val = 1; + else if ( config[i][j] == '0' ) + val = 0; + else if ( config[i][j] == 'x' ) + val = polval; + + if ( val ) + set_bit(31 - j, regs[i]); + else + clear_bit(31 - j, regs[i]); + + config_transformed[i][j] = config[i][j]; + if ( config[i][j] == 's' ) + config_transformed[i][j] = '0' + val; + } + } + + rc = xc_cpuid_do_domctl(xc, domid, input, regs); + if ( rc == 0 ) + return 0; + + fail: + for ( i = 0; i < 4; i++ ) + { + free(config_transformed[i]); + config_transformed[i] = NULL; + } + return rc; +} diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libxc/xc_domain.c Thu May 08 18:40:07 2008 +0900 @@ -795,6 +795,32 @@ int xc_deassign_device( return do_domctl(xc_handle, &domctl); } +int xc_domain_update_msi_irq( + int xc_handle, + uint32_t domid, + uint32_t gvec, + uint32_t pirq, + uint32_t gflags) +{ + int rc; + xen_domctl_bind_pt_irq_t *bind; + + DECLARE_DOMCTL; + + domctl.cmd = XEN_DOMCTL_bind_pt_irq; + domctl.domain = (domid_t)domid; + + bind = &(domctl.u.bind_pt_irq); + bind->hvm_domid = domid; + bind->irq_type = PT_IRQ_TYPE_MSI; + bind->machine_irq = pirq; + bind->u.msi.gvec = gvec; + bind->u.msi.gflags = gflags; + + rc = do_domctl(xc_handle, &domctl); + return rc; +} + /* Pass-through: binds machine irq to guests irq */ int xc_domain_bind_pt_irq( int xc_handle, diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xc_minios.c --- a/tools/libxc/xc_minios.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libxc/xc_minios.c Thu May 08 18:40:07 2008 +0900 @@ -178,7 +178,7 @@ static void evtchn_handler(evtchn_port_t printk("Unknown port for handle %d\n", xce_handle); return; } - files[xce_handle].evtchn.ports[i].pending++; + files[xce_handle].evtchn.ports[i].pending = 1; files[xce_handle].read = 1; wake_up(&event_queue); } @@ -278,7 +278,7 @@ evtchn_port_or_error_t xc_evtchn_pending for (i = 0; i < MAX_EVTCHN_PORTS; i++) { evtchn_port_t port = files[xce_handle].evtchn.ports[i].port; if (port != -1 && files[xce_handle].evtchn.ports[i].pending) { - files[xce_handle].evtchn.ports[i].pending--; + files[xce_handle].evtchn.ports[i].pending = 0; local_irq_restore(flags); return port; } diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xc_misc.c --- a/tools/libxc/xc_misc.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libxc/xc_misc.c Thu May 08 18:40:07 2008 +0900 @@ -222,6 +222,37 @@ int xc_hvm_set_pci_link_route( arg.domid = dom; arg.link = link; arg.isa_irq = isa_irq; + + if ( (rc = lock_pages(&arg, sizeof(arg))) != 0 ) + { + PERROR("Could not lock memory"); + return rc; + } + + rc = do_xen_hypercall(xc_handle, &hypercall); + + unlock_pages(&arg, sizeof(arg)); + + return rc; +} + +int xc_hvm_track_dirty_vram( + int xc_handle, domid_t dom, + uint64_t first_pfn, uint64_t nr, + unsigned long *dirty_bitmap) +{ + DECLARE_HYPERCALL; + struct xen_hvm_track_dirty_vram arg; + int rc; + + hypercall.op = __HYPERVISOR_hvm_op; + hypercall.arg[0] = HVMOP_track_dirty_vram; + hypercall.arg[1] = (unsigned long)&arg; + + arg.domid = dom; + arg.first_pfn = first_pfn; + arg.nr = nr; + set_xen_guest_handle(arg.dirty_bitmap, (uint8_t *)dirty_bitmap); if ( (rc = lock_pages(&arg, sizeof(arg))) != 0 ) { diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xc_pagetab.c --- a/tools/libxc/xc_pagetab.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libxc/xc_pagetab.c Thu May 08 18:40:07 2008 +0900 @@ -141,7 +141,7 @@ unsigned long xc_translate_foreign_addre /* Page Table */ - if (pde & 0x00000008) { /* 4M page (or 2M in PAE mode) */ + if (pde & 0x00000080) { /* 4M page (or 2M in PAE mode) */ DPRINTF("Cannot currently cope with 2/4M pages\n"); exit(-1); } else { /* 4k page */ diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xc_physdev.c --- a/tools/libxc/xc_physdev.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libxc/xc_physdev.c Thu May 08 18:40:07 2008 +0900 @@ -19,3 +19,75 @@ int xc_physdev_pci_access_modify(int xc_ errno = ENOSYS; return -1; } + +int xc_physdev_map_pirq(int xc_handle, + int domid, + int type, + int index, + int *pirq) +{ + int rc; + struct physdev_map_pirq map; + + if ( !pirq ) + return -EINVAL; + + map.domid = domid; + map.type = type; + map.index = index; + map.pirq = *pirq; + + rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map); + + if ( !rc ) + *pirq = map.pirq; + + return rc; +} + +int xc_physdev_map_pirq_msi(int xc_handle, + int domid, + int type, + int index, + int *pirq, + int devfn, + int bus, + int msi_type) +{ + int rc; + struct physdev_map_pirq map; + + if ( !pirq ) + return -EINVAL; + + map.domid = domid; + map.type = type; + map.index = index; + map.pirq = *pirq; + map.msi_info.devfn = devfn; + map.msi_info.bus = bus; + map.msi_info.msi = msi_type; + + rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map); + + if ( !rc ) + *pirq = map.pirq; + + return rc; +} + +int xc_physdev_unmap_pirq(int xc_handle, + int domid, + int pirq) +{ + int rc; + struct physdev_unmap_pirq unmap; + + unmap.domid = domid; + unmap.pirq = pirq; + + rc = do_physdev_op(xc_handle, PHYSDEVOP_unmap_pirq, &unmap); + + return rc; +} + diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xc_private.h --- a/tools/libxc/xc_private.h Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libxc/xc_private.h Thu May 08 18:40:07 2008 +0900 @@ -24,10 +24,12 @@ #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall = { 0 } #define DECLARE_DOMCTL struct xen_domctl domctl = { 0 } #define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 } +#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op = { 0 } #else #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall #define DECLARE_DOMCTL struct xen_domctl domctl #define DECLARE_SYSCTL struct xen_sysctl sysctl +#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op #endif #undef PAGE_SHIFT @@ -94,6 +96,34 @@ static inline int do_xen_version(int xc_ hypercall.arg[1] = (unsigned long) dest; return do_xen_hypercall(xc_handle, &hypercall); +} + +static inline int do_physdev_op(int xc_handle, int cmd, void *op) +{ + int ret = -1; + + DECLARE_HYPERCALL; + hypercall.op = __HYPERVISOR_physdev_op; + hypercall.arg[0] = (unsigned long) cmd; + hypercall.arg[1] = (unsigned long) op; + + if ( lock_pages(op, sizeof(*op)) != 0 ) + { + PERROR("Could not lock memory for Xen hypercall"); + goto out1; + } + + if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 ) + { + if ( errno == EACCES ) + DPRINTF("physdev operation failed -- need to" + " rebuild the user-space tool set?\n"); + } + + unlock_pages(op, sizeof(*op)); + +out1: + return ret; } static inline int do_domctl(int xc_handle, struct xen_domctl *domctl) diff -r f2457c7aff8d -r 611787b6ca35 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/libxc/xenctrl.h Thu May 08 18:40:07 2008 +0900 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -849,6 +850,25 @@ int xc_gnttab_set_max_grants(int xcg_han int xc_gnttab_set_max_grants(int xcg_handle, uint32_t count); +int xc_physdev_map_pirq(int xc_handle, + int domid, + int type, + int index, + int *pirq); + +int xc_physdev_map_pirq_msi(int xc_handle, + int domid, + int type, + int index, + int *pirq, + int devfn, + int bus, + int msi_type); + +int xc_physdev_unmap_pirq(int xc_handle, + int domid, + int pirq); + int xc_hvm_set_pci_intx_level( int xc_handle, domid_t dom, uint8_t domain, uint8_t bus, uint8_t device, uint8_t intx, @@ -862,6 +882,22 @@ int xc_hvm_set_pci_link_route( int xc_handle, domid_t dom, uint8_t link, uint8_t isa_irq); +/* + * Track dirty bit changes in the VRAM area + * + * All of this is done atomically: + * - get the dirty bitmap since the last call + * - set up dirty tracking area for period up to the next call + * - clear the dirty tracking area. + * + * Returns -ENODATA and does not fill bitmap if the area has changed since the + * last call. + */ +int xc_hvm_track_dirty_vram( + int xc_handle, domid_t dom, + uint64_t first_pfn, uint64_t nr, + unsigned long *bitmap); + typedef enum { XC_ERROR_NONE = 0, XC_INTERNAL_ERROR = 1, @@ -948,6 +984,13 @@ int xc_domain_ioport_mapping(int xc_hand uint32_t first_mport, uint32_t nr_ports, uint32_t add_mapping); + +int xc_domain_update_msi_irq( + int xc_handle, + uint32_t domid, + uint32_t gvec, + uint32_t pirq, + uint32_t gflags); int xc_domain_bind_pt_irq(int xc_handle, uint32_t domid, @@ -983,4 +1026,20 @@ int xc_domain_set_target(int xc_handle, uint32_t domid, uint32_t target); +#if defined(__i386__) || defined(__x86_64__) +int xc_cpuid_check(int xc, + const unsigned int *input, + const char **config, + char **config_transformed); +int xc_cpuid_set(int xc, + domid_t domid, + const unsigned int *input, + const char **config, + char **config_transformed); +int xc_cpuid_apply_policy(int xc, + domid_t domid); +void xc_cpuid_to_str(const unsigned int *regs, + char **strs); +#endif + #endif /* XENCTRL_H */ diff -r f2457c7aff8d -r 611787b6ca35 tools/pygrub/src/fsimage/fsimage.c --- a/tools/pygrub/src/fsimage/fsimage.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/pygrub/src/fsimage/fsimage.c Thu May 08 18:40:07 2008 +0900 @@ -17,7 +17,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -281,6 +281,22 @@ fsimage_open(PyObject *o, PyObject *args return (PyObject *)fs; } +static PyObject * +fsimage_getbootstring(PyObject *o, PyObject *args) +{ + PyObject *fs; + char *bootstring; + fsi_t *fsi; + + if (!PyArg_ParseTuple(args, "O", &fs)) + return (NULL); + + fsi = ((fsimage_fs_t *)fs)->fs; + bootstring = fsi_fs_bootstring(fsi); + + return Py_BuildValue("s", bootstring); +} + PyDoc_STRVAR(fsimage_open__doc__, "open(name, [offset=off]) - Open the given file as a filesystem image.\n" "\n" @@ -288,9 +304,15 @@ PyDoc_STRVAR(fsimage_open__doc__, "offset - offset of file system within file image.\n" "options - mount options string.\n"); +PyDoc_STRVAR(fsimage_getbootstring__doc__, + "getbootstring(fs) - Return the boot string needed for this file system " + "or NULL if none is needed.\n"); + static struct PyMethodDef fsimage_module_methods[] = { { "open", (PyCFunction)fsimage_open, METH_VARARGS|METH_KEYWORDS, fsimage_open__doc__ }, + { "getbootstring", (PyCFunction)fsimage_getbootstring, + METH_VARARGS, fsimage_getbootstring__doc__ }, { NULL, NULL, 0, NULL } }; diff -r f2457c7aff8d -r 611787b6ca35 tools/pygrub/src/pygrub --- a/tools/pygrub/src/pygrub Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/pygrub/src/pygrub Thu May 08 18:40:07 2008 +0900 @@ -646,7 +646,13 @@ if __name__ == "__main__": print " args: %s" % chosencfg["args"] sys.exit(0) - fs = fsimage.open(file, get_fs_offset(file)) + # if boot filesystem is set then pass to fsimage.open + bootfsargs = '"%s"' % incfg["args"] + bootfsgroup = re.findall('zfs-bootfs=(.*?)[\s\,\"]', bootfsargs) + if bootfsgroup: + fs = fsimage.open(file, get_fs_offset(file), bootfsgroup[0]) + else: + fs = fsimage.open(file, get_fs_offset(file)) chosencfg = sniff_solaris(fs, incfg) @@ -672,7 +678,15 @@ if __name__ == "__main__": if bootcfg["ramdisk"]: sxp += "(ramdisk %s)" % bootcfg["ramdisk"] if chosencfg["args"]: - sxp += "(args \"%s\")" % chosencfg["args"] + zfsinfo = fsimage.getbootstring(fs) + if zfsinfo is None: + sxp += "(args \"%s\")" % chosencfg["args"] + else: + e = re.compile("zfs-bootfs=[\w\-\.\:@/]+" ) + (chosencfg["args"],count) = e.subn(zfsinfo, chosencfg["args"]) + if count == 0: + chosencfg["args"] += " -B %s" % zfsinfo + sxp += "(args \"%s\")" % (chosencfg["args"]) sys.stdout.flush() os.write(fd, sxp) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/lowlevel/xc/xc.c Thu May 08 18:40:07 2008 +0900 @@ -611,6 +611,110 @@ static PyObject *pyxc_set_os_type(XcObje } #endif /* __ia64__ */ + +#if defined(__i386__) || defined(__x86_64__) +static void pyxc_dom_extract_cpuid(PyObject *config, + char **regs) +{ + const char *regs_extract[4] = { "eax", "ebx", "ecx", "edx" }; + PyObject *obj; + int i; + + memset(regs, 0, 4*sizeof(*regs)); + + if ( !PyDict_Check(config) ) + return; + + for ( i = 0; i < 4; i++ ) + if ( (obj = PyDict_GetItemString(config, regs_extract[i])) != NULL ) + regs[i] = PyString_AS_STRING(obj); +} + +static PyObject *pyxc_create_cpuid_dict(char **regs) +{ + const char *regs_extract[4] = { "eax", "ebx", "ecx", "edx" }; + PyObject *dict; + int i; + + dict = PyDict_New(); + for ( i = 0; i < 4; i++ ) + { + if ( regs[i] == NULL ) + continue; + PyDict_SetItemString(dict, regs_extract[i], + PyString_FromString(regs[i])); + free(regs[i]); + regs[i] = NULL; + } + return dict; +} + +static PyObject *pyxc_dom_check_cpuid(XcObject *self, + PyObject *args) +{ + PyObject *sub_input, *config; + unsigned int input[2]; + char *regs[4], *regs_transform[4]; + + if ( !PyArg_ParseTuple(args, "iOO", &input[0], &sub_input, &config) ) + return NULL; + + pyxc_dom_extract_cpuid(config, regs); + + input[1] = XEN_CPUID_INPUT_UNUSED; + if ( PyLong_Check(sub_input) ) + input[1] = PyLong_AsUnsignedLong(sub_input); + + if ( xc_cpuid_check(self->xc_handle, input, + (const char **)regs, regs_transform) ) + return pyxc_error_to_exception(); + + return pyxc_create_cpuid_dict(regs_transform); +} + +static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self, + PyObject *args) +{ + domid_t domid; + + if ( !PyArg_ParseTuple(args, "i", &domid) ) + return NULL; + + if ( xc_cpuid_apply_policy(self->xc_handle, domid) ) + return pyxc_error_to_exception(); + + Py_INCREF(zero); + return zero; +} + + +static PyObject *pyxc_dom_set_cpuid(XcObject *self, + PyObject *args) +{ + domid_t domid; + PyObject *sub_input, *config; + unsigned int input[2]; + char *regs[4], *regs_transform[4]; + + if ( !PyArg_ParseTuple(args, "IIOO", &domid, + &input[0], &sub_input, &config) ) + return NULL; + + pyxc_dom_extract_cpuid(config, regs); + + input[1] = XEN_CPUID_INPUT_UNUSED; + if ( PyLong_Check(sub_input) ) + input[1] = PyLong_AsUnsignedLong(sub_input); + + if ( xc_cpuid_set(self->xc_handle, domid, input, (const char **)regs, + regs_transform) ) + return pyxc_error_to_exception(); + + return pyxc_create_cpuid_dict(regs_transform); +} + +#endif /* __i386__ || __x86_64__ */ + static PyObject *pyxc_hvm_build(XcObject *self, PyObject *args, PyObject *kwds) @@ -693,6 +797,26 @@ static PyObject *pyxc_evtchn_reset(XcObj Py_INCREF(zero); return zero; +} + +static PyObject *pyxc_physdev_map_pirq(PyObject *self, + PyObject *args, + PyObject *kwds) +{ + XcObject *xc = (XcObject *)self; + uint32_t dom; + int index, pirq, ret; + + static char *kwd_list[] = {"domid", "index", "pirq", NULL}; + + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list, + &dom, &index, &pirq) ) + return NULL; + ret = xc_physdev_map_pirq(xc->xc_handle, dom, MAP_PIRQ_TYPE_GSI, + index, &pirq); + if ( ret != 0 ) + return pyxc_error_to_exception(); + return PyLong_FromUnsignedLong(pirq); } static PyObject *pyxc_physdev_pci_access_modify(XcObject *self, @@ -1485,6 +1609,15 @@ static PyMethodDef pyxc_methods[] = { "Reset all connections.\n" " dom [int]: Domain to reset.\n" }, + { "physdev_map_pirq", + (PyCFunction)pyxc_physdev_map_pirq, + METH_VARARGS | METH_KEYWORDS, "\n" + "map physical irq to guest pirq.\n" + " dom [int]: Identifier of domain to map for.\n" + " index [int]: physical irq.\n" + " pirq [int]: guest pirq.\n" + "Returns: [long] value of the param.\n" }, + { "physdev_pci_access_modify", (PyCFunction)pyxc_physdev_pci_access_modify, METH_VARARGS | METH_KEYWORDS, "\n" @@ -1635,6 +1768,37 @@ static PyMethodDef pyxc_methods[] = { " log [int]: Specifies the area's size.\n" "Returns: [int] 0 on success; -1 on error.\n" }, #endif /* __powerpc */ + +#if defined(__i386__) || defined(__x86_64__) + { "domain_check_cpuid", + (PyCFunction)pyxc_dom_check_cpuid, + METH_VARARGS, "\n" + "Apply checks to host CPUID.\n" + " input [long]: Input for cpuid instruction (eax)\n" + " sub_input [long]: Second input (optional, may be None) for cpuid " + " instruction (ecx)\n" + " config [dict]: Dictionary of register\n" + " config [dict]: Dictionary of register, use for checking\n\n" + "Returns: [int] 0 on success; exception on error.\n" }, + + { "domain_set_cpuid", + (PyCFunction)pyxc_dom_set_cpuid, + METH_VARARGS, "\n" + "Set cpuid response for an input and a domain.\n" + " dom [int]: Identifier of domain.\n" + " input [long]: Input for cpuid instruction (eax)\n" + " sub_input [long]: Second input (optional, may be None) for cpuid " + " instruction (ecx)\n" + " config [dict]: Dictionary of register\n\n" + "Returns: [int] 0 on success; exception on error.\n" }, + + { "domain_set_policy_cpuid", + (PyCFunction)pyxc_dom_set_policy_cpuid, + METH_VARARGS, "\n" + "Set the default cpuid policy for a domain.\n" + " dom [int]: Identifier of domain.\n\n" + "Returns: [int] 0 on success; exception on error.\n" }, +#endif { NULL, NULL, 0, NULL } }; diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/util/acmpolicy.py --- a/tools/python/xen/util/acmpolicy.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/util/acmpolicy.py Thu May 08 18:40:07 2008 +0900 @@ -48,8 +48,6 @@ ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY = 2 ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY = 2 ACM_POLICY_UNDEFINED = 15 - -ACM_SCHEMA_FILE = ACM_POLICIES_DIR + "security_policy.xsd" ACM_LABEL_UNLABELED = "__UNLABELED__" ACM_LABEL_UNLABELED_DISPLAY = "unlabeled" @@ -118,6 +116,153 @@ DEFAULT_policy = \ " \n" +\ "\n" +ACM_SCHEMA=""" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +""" + def get_DEFAULT_policy(dom0label=""): fromnode = "" @@ -133,18 +278,7 @@ def initialize(): instdir = security.install_policy_dir_prefix DEF_policy_file = "DEFAULT-security_policy.xml" - xsd_file = "security_policy.xsd" - - files = [ xsd_file ] - - for file in files: - if not os.path.isfile(policiesdir + "/" + file ): - try: - shutil.copyfile(instdir + "/" + file, - policiesdir + "/" + file) - except Exception, e: - log.info("could not copy '%s': %s" % - (file, str(e))) + #Install default policy. f = open(policiesdir + "/" + DEF_policy_file, 'w') if f: @@ -219,7 +353,8 @@ class ACMPolicy(XSPolicy): log.warn("Libxml2 python-wrapper is not installed on the system.") return xsconstants.XSERR_SUCCESS try: - parserctxt = libxml2.schemaNewParserCtxt(ACM_SCHEMA_FILE) + parserctxt = libxml2.schemaNewMemParserCtxt(ACM_SCHEMA, + len(ACM_SCHEMA)) schemaparser = parserctxt.schemaParse() valid = schemaparser.schemaNewValidCtxt() doc = libxml2.parseDoc(self.toxml()) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/util/blkif.py --- a/tools/python/xen/util/blkif.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/util/blkif.py Thu May 08 18:40:07 2008 +0900 @@ -42,10 +42,12 @@ def blkdev_name_to_number(name): if re.match( '/dev/xvd[a-p]([1-9]|1[0-5])?', n): return 202 * 256 + 16 * (ord(n[8:9]) - ord('a')) + int(n[9:] or 0) - # see if this is a hex device number - if re.match( '^(0x)?[0-9a-fA-F]+$', name ): + if re.match( '^(0x)[0-9a-fA-F]+$', name ): return string.atoi(name,16) - + + if re.match('^[0-9]+$', name): + return string.atoi(name, 10) + return None def blkdev_segment(name): diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/util/bootloader.py --- a/tools/python/xen/util/bootloader.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/util/bootloader.py Thu May 08 18:40:07 2008 +0900 @@ -25,8 +25,6 @@ from xen.xend.XendLogging import log from xen.xend.XendLogging import log from xen.util import mkdir import xen.util.xsm.xsm as security - -__bootloader = None # # Functions for modifying entries in the bootloader, i.e. adding @@ -513,8 +511,11 @@ class LatePolicyLoader(Bootloader): Bootloader.__init__(self) def probe(self): - _dir=os.path.dirname(self.FILENAME) - mkdir.parents(_dir, stat.S_IRWXU) + try: + _dir=os.path.dirname(self.FILENAME) + mkdir.parents(_dir, stat.S_IRWXU) + except: + return False return True def get_default_title(self): @@ -614,10 +615,12 @@ class LatePolicyLoader(Bootloader): __bootloader = Bootloader() -grub = Grub() -if grub.probe() == True: - __bootloader = grub -else: - late = LatePolicyLoader() - if late.probe() == True: - __bootloader = late +def init(): + global __bootloader + grub = Grub() + if grub.probe() == True: + __bootloader = grub + else: + late = LatePolicyLoader() + if late.probe() == True: + __bootloader = late diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/util/pci.py --- a/tools/python/xen/util/pci.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/util/pci.py Thu May 08 18:40:07 2008 +0900 @@ -7,6 +7,7 @@ import sys import os, os.path +import resource PROC_MNT_PATH = '/proc/mounts' PROC_PCI_PATH = '/proc/bus/pci/devices' @@ -14,6 +15,7 @@ PROC_PCI_NUM_RESOURCES = 7 SYSFS_PCI_DEVS_PATH = '/bus/pci/devices' SYSFS_PCI_DEV_RESOURCE_PATH = '/resource' +SYSFS_PCI_DEV_CONFIG_PATH = '/config' SYSFS_PCI_DEV_IRQ_PATH = '/irq' SYSFS_PCI_DEV_DRIVER_DIR_PATH = '/driver' SYSFS_PCI_DEV_VENDOR_PATH = '/vendor' @@ -24,7 +26,21 @@ PCI_BAR_IO = 0x01 PCI_BAR_IO = 0x01 PCI_BAR_IO_MASK = ~0x03 PCI_BAR_MEM_MASK = ~0x0f - +PCI_STATUS_CAP_MASK = 0x10 +PCI_STATUS_OFFSET = 0x6 +PCI_CAP_OFFSET = 0x34 +MSIX_BIR_MASK = 0x7 +MSIX_SIZE_MASK = 0x7ff + +#Calculate PAGE_SHIFT: number of bits to shift an address to get the page number +PAGE_SIZE = resource.getpagesize() +PAGE_SHIFT = 0 +t = PAGE_SIZE +while not (t&1): + t>>=1 + PAGE_SHIFT+=1 + +PAGE_MASK=~(PAGE_SIZE - 1) # Definitions from Linux: include/linux/pci.h def PCI_DEVFN(slot, func): return ((((slot) & 0x1f) << 3) | ((func) & 0x07)) @@ -74,10 +90,73 @@ class PciDevice: self.device = None self.subvendor = None self.subdevice = None - + self.msix = 0 + self.msix_iomem = [] self.get_info_from_sysfs() + def find_capability(self, type): + try: + sysfs_mnt = find_sysfs_mnt() + except IOError, (errno, strerr): + raise PciDeviceParseError(('Failed to locate sysfs mount: %s (%d)' % + (PROC_PCI_PATH, strerr, errno))) + + if sysfs_mnt == None: + return False + path = sysfs_mnt+SYSFS_PCI_DEVS_PATH+'/'+ \ + self.name+SYSFS_PCI_DEV_CONFIG_PATH + try: + conf_file = open(path, 'rb') + conf_file.seek(PCI_STATUS_OFFSET) + status = ord(conf_file.read(1)) + if status&PCI_STATUS_CAP_MASK: + conf_file.seek(PCI_CAP_OFFSET) + capa_pointer = ord(conf_file.read(1)) + while capa_pointer: + conf_file.seek(capa_pointer) + capa_id = ord(conf_file.read(1)) + capa_pointer = ord(conf_file.read(1)) + if capa_id == type: + # get the type + message_cont_lo = ord(conf_file.read(1)) + message_cont_hi = ord(conf_file.read(1)) + self.msix=1 + self.msix_entries = (message_cont_lo + \ + (message_cont_hi << 8)) \ + & MSIX_SIZE_MASK + t_off=conf_file.read(4) + p_off=conf_file.read(4) + self.table_offset=ord(t_off[0]) | (ord(t_off[1])<<8) | \ + (ord(t_off[2])<<16)| \ + (ord(t_off[3])<<24) + self.pba_offset=ord(p_off[0]) | (ord(p_off[1]) << 8)| \ + (ord(p_off[2])<<16) | \ + (ord(p_off[3])<<24) + self.table_index = self.table_offset & MSIX_BIR_MASK + self.table_offset = self.table_offset & ~MSIX_BIR_MASK + self.pba_index = self.pba_offset & MSIX_BIR_MASK + self.pba_offset = self.pba_offset & ~MSIX_BIR_MASK + break + except IOError, (errno, strerr): + raise PciDeviceParseError(('Failed to locate sysfs mount: %s (%d)' % + (PROC_PCI_PATH, strerr, errno))) + + def remove_msix_iomem(self, index, start, size): + if (index == self.table_index): + table_start = start+self.table_offset + table_end = table_start + self.msix_entries * 16 + table_start = table_start & PAGE_MASK + table_end = (table_end + PAGE_SIZE) & PAGE_MASK + self.msix_iomem.append((table_start, table_end-table_start)) + if (index==self.pba_index): + pba_start = start + self.pba_offset + pba_end = pba_start + self.msix_entries/8 + pba_start = pba_start & PAGE_MASK + pba_end = (pba_end + PAGE_SIZE) & PAGE_MASK + self.msix_iomem.append((pba_start, pba_end-pba_start)) + def get_info_from_sysfs(self): + self.find_capability(0x11) try: sysfs_mnt = find_sysfs_mnt() except IOError, (errno, strerr): @@ -108,6 +187,10 @@ class PciDevice: self.ioports.append( (start,size) ) else: self.iomem.append( (start,size) ) + if (self.msix): + self.remove_msix_iomem(i, start, size) + + except IOError, (errno, strerr): raise PciDeviceParseError(('Failed to open & read %s: %s (%d)' % diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/util/xsm/acm/acm.py --- a/tools/python/xen/util/xsm/acm/acm.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/util/xsm/acm/acm.py Thu May 08 18:40:07 2008 +0900 @@ -156,7 +156,9 @@ def on(): returns none if security policy is off (not compiled), any string otherwise, use it: if not security.on() ... """ - return (get_active_policy_name() not in ['INACTIVE', 'NULL']) + if get_active_policy_name() not in ['INACTIVE', 'NULL', '']: + return xsconstants.XS_POLICY_ACM + return 0 def calc_dom_ssidref_from_info(info): diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/util/xsm/flask/flask.py --- a/tools/python/xen/util/xsm/flask/flask.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/util/xsm/flask/flask.py Thu May 08 18:40:07 2008 +0900 @@ -12,7 +12,7 @@ def err(msg): raise XSMError(msg) def on(): - return 1 + return 0 #xsconstants.XS_POLICY_FLASK def ssidref2label(ssidref): try: diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/web/tcp.py --- a/tools/python/xen/web/tcp.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/web/tcp.py Thu May 08 18:40:07 2008 +0900 @@ -64,3 +64,43 @@ class TCPListener(connection.SocketListe sock.close() except: pass + +class SSLTCPListener(TCPListener): + + def __init__(self, protocol_class, port, interface, hosts_allow, + ssl_key_file = None, ssl_cert_file = None): + if not ssl_key_file or not ssl_cert_file: + raise ValueError("SSLXMLRPCServer requires ssl_key_file " + "and ssl_cert_file to be set.") + + self.ssl_key_file = ssl_key_file + self.ssl_cert_file = ssl_cert_file + + TCPListener.__init__(self, protocol_class, port, interface, hosts_allow) + + + def createSocket(self): + from OpenSSL import SSL + # make a SSL socket + ctx = SSL.Context(SSL.SSLv23_METHOD) + ctx.set_options(SSL.OP_NO_SSLv2) + ctx.use_privatekey_file (self.ssl_key_file) + ctx.use_certificate_file(self.ssl_cert_file) + sock = SSL.Connection(ctx, + socket.socket(socket.AF_INET, socket.SOCK_STREAM)) + sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + + # SO_REUSEADDR does not always ensure that we do not get an address + # in use error when restarted quickly + # we implement a timeout to try and avoid failing unnecessarily + timeout = time.time() + 30 + while True: + try: + sock.bind((self.interface, self.port)) + return sock + except socket.error, (_errno, strerrno): + if _errno == errno.EADDRINUSE and time.time() < timeout: + time.sleep(0.5) + else: + raise + diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/XendCheckpoint.py Thu May 08 18:40:07 2008 +0900 @@ -309,6 +309,7 @@ def restore(xd, fd, dominfo = None, paus else: break os.close(qemu_fd) + restore_image.setCpuid() os.read(fd, 1) # Wait for source to close connection diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/XendConfig.py Thu May 08 18:40:07 2008 +0900 @@ -203,6 +203,8 @@ XENAPI_CFG_TYPES = { 'target': int, 'security_label': str, 'pci': str, + 'cpuid' : dict, + 'cpuid_check' : dict, } # List of legacy configuration keys that have no equivalent in the @@ -497,6 +499,32 @@ class XendConfig(dict): if 'handle' in dominfo: self['uuid'] = uuid.toString(dominfo['handle']) + def parse_cpuid(self, cfg, field): + def int2bin(n, count=32): + return "".join([str((n >> y) & 1) for y in range(count-1, -1, -1)]) + + for input, regs in cfg[field].iteritems(): + if not regs is dict: + cfg[field][input] = dict(regs) + + cpuid = {} + for input in cfg[field]: + inputs = input.split(',') + if inputs[0][0:2] == '0x': + inputs[0] = str(int(inputs[0], 16)) + if len(inputs) == 2: + if inputs[1][0:2] == '0x': + inputs[1] = str(int(inputs[1], 16)) + new_input = ','.join(inputs) + cpuid[new_input] = {} # new input + for reg in cfg[field][input]: + val = cfg[field][input][reg] + if val[0:2] == '0x': + cpuid[new_input][reg] = int2bin(int(val, 16)) + else: + cpuid[new_input][reg] = val + cfg[field] = cpuid + def _parse_sxp(self, sxp_cfg): """ Populate this XendConfig using the parsed SXP. @@ -653,8 +681,14 @@ class XendConfig(dict): except ValueError, e: raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) + # Parse cpuid + if 'cpuid' in cfg: + self.parse_cpuid(cfg, 'cpuid') + if 'cpuid_check' in cfg: + self.parse_cpuid(cfg, 'cpuid_check') + import xen.util.xsm.xsm as security - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: from xen.util.acmpolicy import ACM_LABEL_UNLABELED if not 'security' in cfg and sxp.child_value(sxp_cfg, 'security'): cfg['security'] = sxp.child_value(sxp_cfg, 'security') @@ -900,6 +934,16 @@ class XendConfig(dict): self['vcpus_params']['weight'] = \ int(self['vcpus_params'].get('weight', 256)) self['vcpus_params']['cap'] = int(self['vcpus_params'].get('cap', 0)) + + def cpuid_to_sxp(self, sxpr, field): + regs_list = [] + for input, regs in self[field].iteritems(): + reg_list = [] + for reg, val in regs.iteritems(): + reg_list.append([reg, val]) + regs_list.append([input, reg_list]) + sxpr.append([field, regs_list]) + def to_sxp(self, domain = None, ignore_devices = False, ignore = [], legacy_only = True): @@ -1011,6 +1055,13 @@ class XendConfig(dict): except: txn.abort() raise + + if 'cpuid' in self: + self.cpuid_to_sxp(sxpr, 'cpuid') + if 'cpuid_check' in self: + self.cpuid_to_sxp(sxpr, 'cpuid_check') + + log.debug(sxpr) return sxpr diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/XendDomain.py Thu May 08 18:40:07 2008 +0900 @@ -1258,7 +1258,7 @@ class XendDomain: return val - def domain_migrate(self, domid, dst, live=False, resource=0, port=0, node=-1): + def domain_migrate(self, domid, dst, live=False, port=0, node=-1): """Start domain migration. @param domid: Domain ID or Name @@ -1269,7 +1269,6 @@ class XendDomain: @type port: int @keyword live: Live migration @type live: bool - @keyword resource: not used?? @rtype: None @keyword node: use node number for target @rtype: int @@ -1293,8 +1292,16 @@ class XendDomain: if port == 0: port = xoptions.get_xend_relocation_port() - try: - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + + try: + tls = xoptions.get_xend_relocation_tls() + if tls: + from OpenSSL import SSL + ctx = SSL.Context(SSL.SSLv23_METHOD) + sock = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) + sock.set_connect_state() + else: + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((dst, port)) except socket.error, err: raise XendError("can't connect: %s" % err[1]) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu May 08 18:40:07 2008 +0900 @@ -37,6 +37,7 @@ from xen.util import asserts from xen.util import asserts from xen.util.blkif import blkdev_uname_to_file, blkdev_uname_to_taptype import xen.util.xsm.xsm as security +from xen.util import xsconstants from xen.xend import balloon, sxp, uuid, image, arch, osdep from xen.xend import XendOptions, XendNode, XendConfig @@ -1973,7 +1974,7 @@ class XendDomainInfo: balloon.free(2*1024) # 2MB should be plenty ssidref = 0 - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: ssidref = security.calc_dom_ssidref_from_info(self.info) if security.has_authorization(ssidref) == False: raise VmError("VM is not authorized to run.") @@ -1987,7 +1988,7 @@ class XendDomainInfo: target = self.info.target()) except Exception, e: # may get here if due to ACM the operation is not permitted - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: raise VmError('Domain in conflict set with running domain?') if self.domid < 0: @@ -2135,8 +2136,13 @@ class XendDomainInfo: # set memory limit xc.domain_setmaxmem(self.domid, maxmem) + # Reserve 1 page per MiB of RAM for separate VT-d page table. + vtd_mem = 4 * (self.info['memory_static_max'] / 1024 / 1024) + # Round vtd_mem up to a multiple of a MiB. + vtd_mem = ((vtd_mem + 1023) / 1024) * 1024 + # Make sure there's enough RAM available for the domain - balloon.free(memory + shadow) + balloon.free(memory + shadow + vtd_mem) # Set up the shadow memory shadow_cur = xc.shadow_mem_control(self.domid, shadow / 1024) @@ -2848,7 +2854,6 @@ class XendDomainInfo: is_policy_update = (xspol_old != None) from xen.xend.XendXSPolicyAdmin import XSPolicyAdminInstance - from xen.util import xsconstants state = self._stateGet() # Relabel only HALTED or RUNNING or PAUSED domains diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/XendOptions.py --- a/tools/python/xen/xend/XendOptions.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/XendOptions.py Thu May 08 18:40:07 2008 +0900 @@ -192,6 +192,12 @@ class XendOptions: return self.get_config_bool("xend-relocation-server", self.xend_relocation_server_default) + def get_xend_relocation_server_ssl_key_file(self): + return self.get_config_string("xend-relocation-server-ssl-key-file") + + def get_xend_relocation_server_ssl_cert_file(self): + return self.get_config_string("xend-relocation-server-ssl-cert-file") + def get_xend_port(self): """Get the port xend listens at for its HTTP interface. """ @@ -202,6 +208,11 @@ class XendOptions: """ return self.get_config_int('xend-relocation-port', self.xend_relocation_port_default) + + def get_xend_relocation_tls(self): + """Whether to use tls when relocating. + """ + return self.get_config_bool('xend-relocation-tls', 'no') def get_xend_relocation_hosts_allow(self): return self.get_config_string("xend-relocation-hosts-allow", diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/XendXSPolicyAdmin.py --- a/tools/python/xen/xend/XendXSPolicyAdmin.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/XendXSPolicyAdmin.py Thu May 08 18:40:07 2008 +0900 @@ -46,7 +46,12 @@ class XSPolicyAdmin: self.maxpolicies = maxpolicies self.policies = {} self.xsobjs = {} - + bootloader.init() + + if security.on() == xsconstants.XS_POLICY_ACM: + self.__acm_init() + + def __acm_init(self): act_pol_name = self.get_hv_loaded_policy_name() initialize() @@ -73,7 +78,7 @@ class XSPolicyAdmin: This currently only checks for ACM-enablement. """ rc = 0 - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: rc |= xsconstants.XS_POLICY_ACM return rc @@ -103,6 +108,8 @@ class XSPolicyAdmin: def __add_acmpolicy_to_system(self, xmltext, flags, overwrite): errors = "" + if security.on() != xsconstants.XS_POLICY_ACM: + raise SecurityError(-xsconstants.XSERR_POLICY_TYPE_UNSUPPORTED) loadedpol = self.get_loaded_policy() if loadedpol: # This is meant as an update to a currently loaded policy diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/image.py Thu May 08 18:40:07 2008 +0900 @@ -551,6 +551,38 @@ class HVMImageHandler(ImageHandler): self.acpi = int(vmConfig['platform'].get('acpi', 0)) self.guest_os_type = vmConfig['platform'].get('guest_os_type') + self.vmConfig = vmConfig + + def setCpuid(self): + xc.domain_set_policy_cpuid(self.vm.getDomid()) + + if 'cpuid' in self.vmConfig: + cpuid = self.vmConfig['cpuid'] + transformed = {} + for sinput, regs in cpuid.iteritems(): + inputs = sinput.split(',') + input = long(inputs[0]) + sub_input = None + if len(inputs) == 2: + sub_input = long(inputs[1]) + t = xc.domain_set_cpuid(self.vm.getDomid(), + input, sub_input, regs) + transformed[sinput] = t + self.vmConfig['cpuid'] = transformed + + if 'cpuid_check' in self.vmConfig: + cpuid_check = self.vmConfig['cpuid_check'] + transformed = {} + for sinput, regs_check in cpuid_check.iteritems(): + inputs = sinput.split(',') + input = long(inputs[0]) + sub_input = None + if len(inputs) == 2: + sub_input = long(inputs[1]) + t = xc.domain_check_cpuid(input, sub_input, regs_check) + transformed[sinput] = t + self.vmConfig['cpuid_check'] = transformed + # Return a list of cmd line args to the device models based on the # xm config file def parseDeviceModelArgs(self, vmConfig): @@ -718,6 +750,7 @@ class X86_HVM_ImageHandler(HVMImageHandl def buildDomain(self): xc.hvm_set_param(self.vm.getDomid(), HVM_PARAM_PAE_ENABLED, self.pae) + self.setCpuid() return HVMImageHandler.buildDomain(self) def getRequiredAvailableMemory(self, mem_kb): diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/server/SrvDomain.py --- a/tools/python/xen/xend/server/SrvDomain.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/server/SrvDomain.py Thu May 08 18:40:07 2008 +0900 @@ -115,7 +115,6 @@ class SrvDomain(SrvDir): [['dom', 'int'], ['destination', 'str'], ['live', 'int'], - ['resource', 'int'], ['port', 'int']]) return fn(req.args, {'dom': self.dom.domid}) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/server/blkif.py Thu May 08 18:40:07 2008 +0900 @@ -23,6 +23,7 @@ import xen.util.xsm.xsm as security import xen.util.xsm.xsm as security from xen.xend.XendError import VmError from xen.xend.server.DevController import DevController +from xen.util import xsconstants class BlkifController(DevController): """Block device interface controller. Handles all block devices @@ -72,7 +73,7 @@ class BlkifController(DevController): if uuid: back['uuid'] = uuid - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: self.do_access_control(config, uname) devid = blkif.blkdev_name_to_number(dev) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/server/irqif.py --- a/tools/python/xen/xend/server/irqif.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/server/irqif.py Thu May 08 18:40:07 2008 +0900 @@ -69,5 +69,10 @@ class IRQController(DevController): #todo non-fatal raise VmError( 'irq: Failed to configure irq: %d' % (pirq)) - + rc = xc.physdev_map_pirq(domid = self.getDomid(), + index = pirq, + pirq = pirq) + if rc < 0: + raise VmError( + 'irq: Failed to map irq %x' % (pirq)) return (None, {}, {}) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/server/netif.py --- a/tools/python/xen/xend/server/netif.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/server/netif.py Thu May 08 18:40:07 2008 +0900 @@ -29,6 +29,7 @@ from xen.xend.XendError import VmError from xen.xend.XendError import VmError from xen.xend.XendXSPolicyAdmin import XSPolicyAdminInstance import xen.util.xsm.xsm as security +from xen.util import xsconstants from xen.xend.XendLogging import log @@ -155,7 +156,7 @@ class NetifController(DevController): front = { 'handle' : "%i" % devid, 'mac' : mac } - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: self.do_access_control(config) return (devid, back, front) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/server/pciif.py Thu May 08 18:40:07 2008 +0900 @@ -271,6 +271,25 @@ class PciController(DevController): if rc<0: raise VmError(('pci: failed to configure I/O memory on device '+ '%s - errno=%d')%(dev.name,rc)) + rc = xc.physdev_map_pirq(domid = fe_domid, + index = dev.irq, + pirq = dev.irq) + if rc < 0: + raise VmError(('pci: failed to map irq on device '+ + '%s - errno=%d')%(dev.name,rc)) + + if dev.msix: + for (start, size) in dev.msix_iomem: + start_pfn = start>>PAGE_SHIFT + nr_pfns = (size+(PAGE_SIZE-1))>>PAGE_SHIFT + log.debug('pci-msix: remove permission for 0x%x/0x%x 0x%x/0x%x' % \ + (start,size, start_pfn, nr_pfns)) + rc = xc.domain_iomem_permission(domid = fe_domid, + first_pfn = start_pfn, + nr_pfns = nr_pfns, + allow_access = False) + if rc<0: + raise VmError(('pci: failed to remove msi-x iomem')) if dev.irq>0: log.debug('pci: enabling irq %d'%dev.irq) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xend/server/relocate.py --- a/tools/python/xen/xend/server/relocate.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xend/server/relocate.py Thu May 08 18:40:07 2008 +0900 @@ -132,5 +132,14 @@ def listenRelocation(): else: hosts_allow = map(re.compile, hosts_allow.split(" ")) - tcp.TCPListener(RelocationProtocol, port, interface = interface, - hosts_allow = hosts_allow) + ssl_key_file = xoptions.get_xend_relocation_server_ssl_key_file() + ssl_cert_file = xoptions.get_xend_relocation_server_ssl_cert_file() + + if ssl_key_file and ssl_cert_file: + tcp.SSLTCPListener(RelocationProtocol, port, interface = interface, + hosts_allow = hosts_allow, + ssl_key_file = ssl_key_file, + ssl_cert_file = ssl_cert_file) + else: + tcp.TCPListener(RelocationProtocol, port, interface = interface, + hosts_allow = hosts_allow) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xm/addlabel.py --- a/tools/python/xen/xm/addlabel.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xm/addlabel.py Thu May 08 18:40:07 2008 +0900 @@ -205,17 +205,17 @@ def main(argv): policy_type = "" if len(argv) not in (4, 5): raise OptionError('Needs either 2 or 3 arguments') - + label = argv[1] - + if len(argv) == 5: policyref = argv[4] - elif security.on(): + elif security.on() == xsconstants.XS_POLICY_ACM: policyref = security.active_policy policy_type = xsconstants.ACM_POLICY_ID else: - raise OptionError("No active policy. Must specify policy on the " - "command line.") + raise OptionError("ACM security is not enabled. You must specify "\ + "the policy on the command line.") if argv[2].lower() == "dom": configfile = argv[3] diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xm/create.py Thu May 08 18:40:07 2008 +0900 @@ -548,6 +548,14 @@ gopts.var('hap', val='HAP', fn=set_int, default=1, use="""Hap status (0=hap is disabled; 1=hap is enabled.""") + +gopts.var('cpuid', val="IN[,SIN]:eax=EAX,ebx=EBX,exc=ECX,edx=EDX", + fn=append_value, default=[], + use="""Cpuid description.""") + +gopts.var('cpuid_check', val="IN[,SIN]:eax=EAX,ebx=EBX,exc=ECX,edx=EDX", + fn=append_value, default=[], + use="""Cpuid check description.""") def err(msg): """Print an error to stderr and exit. @@ -755,7 +763,7 @@ def configure_hvm(config_image, vals): 'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten', 'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor', 'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet', - 'guest_os_type', 'hap', 'opengl'] + 'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check'] for a in args: if a in vals.__dict__ and vals.__dict__[a] is not None: @@ -779,7 +787,8 @@ def make_config(vals): map(add_conf, ['name', 'memory', 'maxmem', 'shadow_memory', 'restart', 'on_poweroff', 'on_reboot', 'on_crash', 'vcpus', 'vcpu_avail', 'features', - 'on_xend_start', 'on_xend_stop', 'target']) + 'on_xend_start', 'on_xend_stop', 'target', 'cpuid', + 'cpuid_check']) if vals.uuid is not None: config.append(['uuid', vals.uuid]) @@ -842,6 +851,26 @@ def preprocess_disk(vals): err('Invalid disk specifier: ' + v) disk.append(d) vals.disk = disk + +def preprocess_cpuid(vals, attr_name): + if not vals.cpuid: return + cpuid = {} + for cpuid_input in getattr(vals, attr_name): + input_re = "(0x)?[0-9A-Fa-f]+(,(0x)?[0-9A-Fa-f]+)?" + cpuid_match = re.match(r'(?P%s):(?P.*)' % \ + input_re, cpuid_input) + if cpuid_match != None: + res_cpuid = cpuid_match.groupdict() + input = res_cpuid['input'] + regs = res_cpuid['regs'].split(',') + cpuid[input]= {} # New input + for reg in regs: + reg_match = re.match(r"(?Peax|ebx|ecx|edx)=(?P.*)", reg) + if reg_match == None: + err("cpuid's syntax is (eax|ebx|ecx|edx)=value") + res = reg_match.groupdict() + cpuid[input][res['reg']] = res['val'] # new register + setattr(vals, attr_name, cpuid) def preprocess_pci(vals): if not vals.pci: return @@ -1047,6 +1076,8 @@ def preprocess(vals): preprocess_vnc(vals) preprocess_vtpm(vals) preprocess_access_control(vals) + preprocess_cpuid(vals, 'cpuid') + preprocess_cpuid(vals, 'cpuid_check') def comma_sep_kv_to_dict(c): diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xm/dry-run.py --- a/tools/python/xen/xm/dry-run.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xm/dry-run.py Thu May 08 18:40:07 2008 +0900 @@ -22,6 +22,7 @@ import xen.util.xsm.xsm as security import xen.util.xsm.xsm as security from xen.xm import create from xen.xend import sxp +from xen.util import xsconstants from xen.xm.opts import OptionError def help(): @@ -40,7 +41,7 @@ def check_domain_label(config, verbose): answer = 0 default_label = None secon = 0 - if security.on(): + if security.on() == xsconstants.XS_POLICY_ACM: default_label = security.ssidref2label(security.NULL_SSIDREF) secon = 1 @@ -90,7 +91,7 @@ def config_security_check(config, verbos domain_policy = sxp.child_value(sxp.name(sxp.child0(x)), 'policy') # if no domain label, use default - if not domain_label and security.on(): + if not domain_label and security.on() == xsconstants.XS_POLICY_ACM: try: domain_label = security.ssidref2label(security.NULL_SSIDREF) except: diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xm/main.py Thu May 08 18:40:07 2008 +0900 @@ -133,7 +133,7 @@ SUBCOMMAND_HELP = { 'Read and/or clear Xend\'s message buffer.'), 'domid' : ('', 'Convert a domain name to domain id.'), 'domname' : ('', 'Convert a domain id to domain name.'), - 'dump-core' : ('[-L|--live] [-C|--crash] [Filename]', + 'dump-core' : ('[-L|--live] [-C|--crash] [-R|--reset] [Filename]', 'Dump core for a specific domain.'), 'info' : ('[-c|--config]', 'Get information about Xen host.'), 'log' : ('', 'Print Xend log'), @@ -243,6 +243,7 @@ SUBCOMMAND_OPTIONS = { 'dump-core': ( ('-L', '--live', 'Dump core without pausing the domain'), ('-C', '--crash', 'Crash domain after dumping core'), + ('-R', '--reset', 'Reset domain after dumping core'), ), 'start': ( ('-p', '--paused', 'Do not unpause domain after starting it'), @@ -417,10 +418,11 @@ def cmdHelp(cmd): def cmdHelp(cmd): """Print help for a specific subcommand.""" - for fc in SUBCOMMAND_HELP.keys(): - if fc[:len(cmd)] == cmd: - cmd = fc - break + if not SUBCOMMAND_HELP.has_key(cmd): + for fc in SUBCOMMAND_HELP.keys(): + if fc[:len(cmd)] == cmd: + cmd = fc + break try: args, desc = SUBCOMMAND_HELP[cmd] @@ -1279,14 +1281,19 @@ def xm_dump_core(args): def xm_dump_core(args): live = False crash = False + reset = False try: - (options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash']) + (options, params) = getopt.gnu_getopt(args, 'LCR', ['live', 'crash', 'reset']) for (k, v) in options: if k in ('-L', '--live'): live = True - if k in ('-C', '--crash'): + elif k in ('-C', '--crash'): crash = True - + elif k in ('-R', '--reset'): + reset = True + + if crash and reset: + raise OptionError("You may not specify more than one '-CR' option") if len(params) not in (1, 2): raise OptionError("Expects 1 or 2 argument(s)") except getopt.GetoptError, e: @@ -1308,8 +1315,11 @@ def xm_dump_core(args): if crash: print "Destroying domain: %s ..." % str(dom) server.xend.domain.destroy(dom) + elif reset: + print "Resetting domain: %s ..." % str(dom) + server.xend.domain.reset(dom) finally: - if not live and not crash and ds == DOM_STATE_RUNNING: + if not live and not crash and not reset and ds == DOM_STATE_RUNNING: server.xend.domain.unpause(dom) def xm_rename(args): diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xm/migrate.py --- a/tools/python/xen/xm/migrate.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xm/migrate.py Thu May 08 18:40:07 2008 +0900 @@ -47,10 +47,6 @@ gopts.opt('node', short='n', val='nodenu fn=set_int, default=-1, use="Use specified NUMA node on target.") -gopts.opt('resource', short='r', val='MBIT', - fn=set_int, default=0, - use="Set level of resource usage for migration.") - def help(): return str(gopts) @@ -69,13 +65,11 @@ def main(argv): vm_ref = get_single_vm(dom) other_config = { "port": opts.vals.port, - "resource": opts.vals.resource, "node": opts.vals.node } server.xenapi.VM.migrate(vm_ref, dst, bool(opts.vals.live), other_config) else: server.xend.domain.migrate(dom, dst, opts.vals.live, - opts.vals.resource, opts.vals.port, opts.vals.node) diff -r f2457c7aff8d -r 611787b6ca35 tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/python/xen/xm/xenapi_create.py Thu May 08 18:40:07 2008 +0900 @@ -485,9 +485,9 @@ class xenapi_create: vm_ref, "protocol": console.attributes["protocol"].value, - "other_params": + "other_config": get_child_nodes_as_dict(console, - "other_param", "key", "value") + "other_config", "key", "value") } return server.xenapi.console.create(console_record) diff -r f2457c7aff8d -r 611787b6ca35 tools/xenstore/xenstore_client.c --- a/tools/xenstore/xenstore_client.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/xenstore/xenstore_client.c Thu May 08 18:40:07 2008 +0900 @@ -450,8 +450,9 @@ static enum mode lookup_mode(const char return MODE_write; else if (strcmp(m, "read") == 0) return MODE_read; - else - errx(1, "unknown mode %s\n", m); + + errx(1, "unknown mode %s\n", m); + return 0; } int diff -r f2457c7aff8d -r 611787b6ca35 tools/xenstore/xenstored_core.c --- a/tools/xenstore/xenstored_core.c Fri Apr 25 20:13:52 2008 +0900 +++ b/tools/xenstore/xenstored_core.c Thu May 08 18:40:07 2008 +0900 @@ -1929,7 +1929,7 @@ int main(int argc, char *argv[]) /* Main loop. */ for (;;) { - struct connection *conn, *old_conn; + struct connection *conn, *next; if (select(max+1, &inset, &outset, NULL, timeout) < 0) { if (errno == EINTR) @@ -1953,27 +1953,39 @@ int main(int argc, char *argv[]) if (evtchn_fd != -1 && FD_ISSET(evtchn_fd, &inset)) handle_event(); - conn = list_entry(connections.next, typeof(*conn), list); - while (&conn->list != &connections) { - talloc_increase_ref_count(conn); + next = list_entry(connections.next, typeof(*conn), list); + while (&next->list != &connections) { + conn = next; + + next = list_entry(conn->list.next, + typeof(*conn), list); if (conn->domain) { + talloc_increase_ref_count(conn); if (domain_can_read(conn)) handle_input(conn); + if (talloc_free(conn) == 0) + continue; + + talloc_increase_ref_count(conn); if (domain_can_write(conn) && !list_empty(&conn->out_list)) handle_output(conn); + if (talloc_free(conn) == 0) + continue; } else { + talloc_increase_ref_count(conn); if (FD_ISSET(conn->fd, &inset)) handle_input(conn); + if (talloc_free(conn) == 0) + continue; + + talloc_increase_ref_count(conn); if (FD_ISSET(conn->fd, &outset)) handle_output(conn); + if (talloc_free(conn) == 0) + continue; } - - old_conn = conn; - conn = list_entry(old_conn->list.next, - typeof(*conn), list); - talloc_free(old_conn); } max = initialize_set(&inset, &outset, *sock, *ro_sock, diff -r f2457c7aff8d -r 611787b6ca35 xen/Makefile --- a/xen/Makefile Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/Makefile Thu May 08 18:40:07 2008 +0900 @@ -5,6 +5,9 @@ export XEN_EXTRAVERSION ?= -unstable$(XE export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION) export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version + +export XEN_WHOAMI ?= $(USER) +export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) export BASEDIR := $(CURDIR) @@ -81,8 +84,8 @@ include/xen/compile.h: include/xen/compi include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(shell LC_ALL=C date)/g' \ -e 's/@@time@@/$(shell LC_ALL=C date +%T)/g' \ - -e 's/@@whoami@@/$(USER)/g' \ - -e 's/@@domain@@/$(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown]))/g' \ + -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ + -e 's/@@domain@@/$(XEN_DOMAIN)/g' \ -e 's/@@hostname@@/$(shell hostname)/g' \ -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) -v 2>&1 | grep -i "gcc.*version")!g' \ -e 's/@@version@@/$(XEN_VERSION)/g' \ diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/ia64/vmx/vmx_hypercall.c --- a/xen/arch/ia64/vmx/vmx_hypercall.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c Thu May 08 18:40:07 2008 +0900 @@ -200,6 +200,10 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA rc = 0; break; + case HVMOP_track_dirty_vram: + rc = -ENOSYS; + break; + default: gdprintk(XENLOG_INFO, "Bad HVM op %ld.\n", op); rc = -ENOSYS; diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/Makefile --- a/xen/arch/x86/Makefile Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/Makefile Thu May 08 18:40:07 2008 +0900 @@ -24,6 +24,7 @@ obj-y += i387.o obj-y += i387.o obj-y += i8259.o obj-y += io_apic.o +obj-y += msi.o obj-y += ioport_emulate.o obj-y += irq.o obj-y += microcode.o diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/acpi/Makefile --- a/xen/arch/x86/acpi/Makefile Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/acpi/Makefile Thu May 08 18:40:07 2008 +0900 @@ -1,2 +1,2 @@ obj-y += boot.o obj-y += boot.o -obj-y += power.o suspend.o wakeup_prot.o +obj-y += power.o suspend.o wakeup_prot.o cpu_idle.o diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/acpi/boot.c Thu May 08 18:40:07 2008 +0900 @@ -462,6 +462,28 @@ bad: } #endif +static void __init +acpi_fadt_parse_reg(struct acpi_table_fadt *fadt) +{ + unsigned int len; + + len = min_t(unsigned int, fadt->header.length, sizeof(*fadt)); + memcpy(&acpi_gbl_FADT, fadt, len); + + if (len > offsetof(struct acpi_table_fadt, xpm1b_event_block)) { + memcpy(&acpi_gbl_xpm1a_enable, &fadt->xpm1a_event_block, + sizeof(acpi_gbl_xpm1a_enable)); + memcpy(&acpi_gbl_xpm1b_enable, &fadt->xpm1b_event_block, + sizeof(acpi_gbl_xpm1b_enable)); + + acpi_gbl_xpm1a_enable.address += + acpi_gbl_FADT.pm1_event_length / 2; + if ( acpi_gbl_xpm1b_enable.address ) + acpi_gbl_xpm1b_enable.address += + acpi_gbl_FADT.pm1_event_length / 2; + } +} + static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) { struct acpi_table_fadt *fadt = NULL; @@ -508,6 +530,8 @@ static int __init acpi_parse_fadt(unsign acpi_smi_cmd = fadt->smi_command; acpi_enable_value = fadt->acpi_enable; acpi_disable_value = fadt->acpi_disable; + + acpi_fadt_parse_reg(fadt); #ifdef CONFIG_ACPI_SLEEP acpi_fadt_parse_sleep_info(fadt); diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/acpi/cpu_idle.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/acpi/cpu_idle.c Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,957 @@ +/* + * cpu_idle - xen idle state module derived from Linux + * drivers/acpi/processor_idle.c & + * arch/x86/kernel/acpi/cstate.c + * + * Copyright (C) 2001, 2002 Andy Grover + * Copyright (C) 2001, 2002 Paul Diefenbaugh + * Copyright (C) 2004, 2005 Dominik Brodowski + * Copyright (C) 2004 Anil S Keshavamurthy + * - Added processor hotplug support + * Copyright (C) 2005 Venkatesh Pallipadi + * - Added support for C3 on SMP + * Copyright (C) 2007, 2008 Intel Corporation + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEBUG_PM_CX + +#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) +#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ +#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ + +#define ACPI_PROCESSOR_MAX_POWER 8 +#define ACPI_PROCESSOR_MAX_C2_LATENCY 100 +#define ACPI_PROCESSOR_MAX_C3_LATENCY 1000 + +extern u32 pmtmr_ioport; +extern void (*pm_idle) (void); + +static void (*pm_idle_save) (void) __read_mostly; +unsigned int max_cstate __read_mostly = 2; +integer_param("max_cstate", max_cstate); +/* + * bm_history -- bit-mask with a bit per jiffy of bus-master activity + * 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms + * 800 HZ: 0xFFFFFFFF: 32 jiffies = 40ms + * 100 HZ: 0x0000000F: 4 jiffies = 40ms + * reduce history for more aggressive entry into C3 + */ +unsigned int bm_history __read_mostly = + (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); +integer_param("bm_history", bm_history); + +struct acpi_processor_cx; + +struct acpi_processor_cx_policy +{ + u32 count; + struct acpi_processor_cx *state; + struct + { + u32 time; + u32 ticks; + u32 count; + u32 bm; + } threshold; +}; + +struct acpi_processor_cx +{ + u8 valid; + u8 type; + u32 address; + u8 space_id; + u32 latency; + u32 latency_ticks; + u32 power; + u32 usage; + u64 time; + struct acpi_processor_cx_policy promotion; + struct acpi_processor_cx_policy demotion; +}; + +struct acpi_processor_flags +{ + u8 bm_control:1; + u8 bm_check:1; + u8 has_cst:1; + u8 power_setup_done:1; + u8 bm_rld_set:1; +}; + +struct acpi_processor_power +{ + struct acpi_processor_flags flags; + struct acpi_processor_cx *state; + s_time_t bm_check_timestamp; + u32 default_state; + u32 bm_activity; + u32 count; + struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER]; +}; + +static struct acpi_processor_power processor_powers[NR_CPUS]; + +static void print_acpi_power(uint32_t cpu, struct acpi_processor_power *power) +{ + uint32_t i; + + printk("saved cpu%d cx acpi info:\n", cpu); + printk("\tcurrent state is C%d\n", (power->state)?power->state->type:-1); + printk("\tbm_check_timestamp = %"PRId64"\n", power->bm_check_timestamp); + printk("\tdefault_state = %d\n", power->default_state); + printk("\tbm_activity = 0x%08x\n", power->bm_activity); + printk("\tcount = %d\n", power->count); + + for ( i = 0; i < power->count; i++ ) + { + printk("\tstates[%d]:\n", i); + printk("\t\tvalid = %d\n", power->states[i].valid); + printk("\t\ttype = %d\n", power->states[i].type); + printk("\t\taddress = 0x%x\n", power->states[i].address); + printk("\t\tspace_id = 0x%x\n", power->states[i].space_id); + printk("\t\tlatency = %d\n", power->states[i].latency); + printk("\t\tpower = %d\n", power->states[i].power); + printk("\t\tlatency_ticks = %d\n", power->states[i].latency_ticks); + printk("\t\tusage = %d\n", power->states[i].usage); + printk("\t\ttime = %"PRId64"\n", power->states[i].time); + + printk("\t\tpromotion policy:\n"); + printk("\t\t\tcount = %d\n", power->states[i].promotion.count); + printk("\t\t\tstate = C%d\n", + (power->states[i].promotion.state) ? + power->states[i].promotion.state->type : -1); + printk("\t\t\tthreshold.time = %d\n", power->states[i].promotion.threshold.time); + printk("\t\t\tthreshold.ticks = %d\n", power->states[i].promotion.threshold.ticks); + printk("\t\t\tthreshold.count = %d\n", power->states[i].promotion.threshold.count); + printk("\t\t\tthreshold.bm = %d\n", power->states[i].promotion.threshold.bm); + + printk("\t\tdemotion policy:\n"); + printk("\t\t\tcount = %d\n", power->states[i].demotion.count); + printk("\t\t\tstate = C%d\n", + (power->states[i].demotion.state) ? + power->states[i].demotion.state->type : -1); + printk("\t\t\tthreshold.time = %d\n", power->states[i].demotion.threshold.time); + printk("\t\t\tthreshold.ticks = %d\n", power->states[i].demotion.threshold.ticks); + printk("\t\t\tthreshold.count = %d\n", power->states[i].demotion.threshold.count); + printk("\t\t\tthreshold.bm = %d\n", power->states[i].demotion.threshold.bm); + } +} + +static void dump_cx(unsigned char key) +{ + for( int i = 0; i < num_online_cpus(); i++ ) + print_acpi_power(i, &processor_powers[i]); +} + +static int __init cpu_idle_key_init(void) +{ + register_keyhandler( + 'c', dump_cx, "dump cx structures"); + return 0; +} +__initcall(cpu_idle_key_init); + +static inline u32 ticks_elapsed(u32 t1, u32 t2) +{ + if ( t2 >= t1 ) + return (t2 - t1); + else + return ((0xFFFFFFFF - t1) + t2); +} + +static void acpi_processor_power_activate(struct acpi_processor_power *power, + struct acpi_processor_cx *new) +{ + struct acpi_processor_cx *old; + + if ( !power || !new ) + return; + + old = power->state; + + if ( old ) + old->promotion.count = 0; + new->demotion.count = 0; + + /* Cleanup from old state. */ + if ( old ) + { + switch ( old->type ) + { + case ACPI_STATE_C3: + /* Disable bus master reload */ + if ( new->type != ACPI_STATE_C3 && power->flags.bm_check ) + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); + break; + } + } + + /* Prepare to use new state. */ + switch ( new->type ) + { + case ACPI_STATE_C3: + /* Enable bus master reload */ + if ( old->type != ACPI_STATE_C3 && power->flags.bm_check ) + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1); + break; + } + + power->state = new; + + return; +} + +static void acpi_safe_halt(void) +{ + smp_mb__after_clear_bit(); + safe_halt(); +} + +#define MWAIT_ECX_INTERRUPT_BREAK (0x1) + +static void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) +{ + __monitor((void *)current, 0, 0); + smp_mb(); + __mwait(eax, ecx); +} + +static void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx) +{ + mwait_idle_with_hints(cx->address, MWAIT_ECX_INTERRUPT_BREAK); +} + +static void acpi_idle_do_entry(struct acpi_processor_cx *cx) +{ + if ( cx->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE ) + { + /* Call into architectural FFH based C-state */ + acpi_processor_ffh_cstate_enter(cx); + } + else + { + int unused; + /* IO port based C-state */ + inb(cx->address); + /* Dummy wait op - must do something useless after P_LVL2 read + because chipsets cannot guarantee that STPCLK# signal + gets asserted in time to freeze execution properly. */ + unused = inl(pmtmr_ioport); + } +} + +static atomic_t c3_cpu_count; + +static void acpi_processor_idle(void) +{ + struct acpi_processor_power *power = NULL; + struct acpi_processor_cx *cx = NULL; + struct acpi_processor_cx *next_state = NULL; + int sleep_ticks = 0; + u32 t1, t2 = 0; + + power = &processor_powers[smp_processor_id()]; + + /* + * Interrupts must be disabled during bus mastering calculations and + * for C2/C3 transitions. + */ + local_irq_disable(); + cx = power->state; + if ( !cx ) + { + if ( pm_idle_save ) + { + printk(XENLOG_DEBUG "call pm_idle_save()\n"); + pm_idle_save(); + } + else + { + printk(XENLOG_DEBUG "call acpi_safe_halt()\n"); + acpi_safe_halt(); + } + return; + } + + /* + * Check BM Activity + * ----------------- + * Check for bus mastering activity (if required), record, and check + * for demotion. + */ + if ( power->flags.bm_check ) + { + u32 bm_status = 0; + unsigned long diff = (NOW() - power->bm_check_timestamp) >> 23; + + if ( diff > 31 ) + diff = 31; + + power->bm_activity <<= diff; + + acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); + if ( bm_status ) + { + power->bm_activity |= 0x1; + acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); + } + /* + * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect + * the true state of bus mastering activity; forcing us to + * manually check the BMIDEA bit of each IDE channel. + */ + /*else if ( errata.piix4.bmisx ) + { + if ( (inb_p(errata.piix4.bmisx + 0x02) & 0x01) + || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01) ) + pr->power.bm_activity |= 0x1; + }*/ + + power->bm_check_timestamp = NOW(); + + /* + * If bus mastering is or was active this jiffy, demote + * to avoid a faulty transition. Note that the processor + * won't enter a low-power state during this call (to this + * function) but should upon the next. + * + * TBD: A better policy might be to fallback to the demotion + * state (use it for this quantum only) istead of + * demoting -- and rely on duration as our sole demotion + * qualification. This may, however, introduce DMA + * issues (e.g. floppy DMA transfer overrun/underrun). + */ + if ( (power->bm_activity & 0x1) && cx->demotion.threshold.bm ) + { + local_irq_enable(); + next_state = cx->demotion.state; + goto end; + } + } + + /* + * Sleep: + * ------ + * Invoke the current Cx state to put the processor to sleep. + */ + if ( cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3 ) + smp_mb__after_clear_bit(); + + switch ( cx->type ) + { + case ACPI_STATE_C1: + /* + * Invoke C1. + * Use the appropriate idle routine, the one that would + * be used without acpi C-states. + */ + if ( pm_idle_save ) + pm_idle_save(); + else + acpi_safe_halt(); + + /* + * TBD: Can't get time duration while in C1, as resumes + * go to an ISR rather than here. Need to instrument + * base interrupt handler. + */ + sleep_ticks = 0xFFFFFFFF; + break; + + case ACPI_STATE_C2: + /* Get start time (ticks) */ + t1 = inl(pmtmr_ioport); + /* Invoke C2 */ + acpi_idle_do_entry(cx); + /* Get end time (ticks) */ + t2 = inl(pmtmr_ioport); + + /* Re-enable interrupts */ + local_irq_enable(); + /* Compute time (ticks) that we were actually asleep */ + sleep_ticks = + ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD; + break; + + case ACPI_STATE_C3: + /* + * disable bus master + * bm_check implies we need ARB_DIS + * !bm_check implies we need cache flush + * bm_control implies whether we can do ARB_DIS + * + * That leaves a case where bm_check is set and bm_control is + * not set. In that case we cannot do much, we enter C3 + * without doing anything. + */ + if ( power->flags.bm_check && power->flags.bm_control ) + { + atomic_inc(&c3_cpu_count); + if ( atomic_read(&c3_cpu_count) == num_online_cpus() ) + { + /* + * All CPUs are trying to go to C3 + * Disable bus master arbitration + */ + acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); + } + } + else if ( !power->flags.bm_check ) + { + /* SMP with no shared cache... Invalidate cache */ + ACPI_FLUSH_CPU_CACHE(); + } + + /* Get start time (ticks) */ + t1 = inl(pmtmr_ioport); + + /* + * FIXME: Before invoking C3, be aware that TSC/APIC timer may be + * stopped by H/W. Without carefully handling of TSC/APIC stop issues, + * deep C state can't work correctly. + */ + /* preparing TSC stop */ + cstate_save_tsc(); + /* placeholder for preparing APIC stop */ + + /* Invoke C3 */ + acpi_idle_do_entry(cx); + + /* placeholder for recovering APIC */ + + /* recovering TSC */ + cstate_restore_tsc(); + + /* Get end time (ticks) */ + t2 = inl(pmtmr_ioport); + if ( power->flags.bm_check && power->flags.bm_control ) + { + /* Enable bus master arbitration */ + atomic_dec(&c3_cpu_count); + acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); + } + + /* Compute time (ticks) that we were actually asleep */ + sleep_ticks = ticks_elapsed(t1, t2); + /* Re-enable interrupts */ + local_irq_enable(); + /* Do not account our idle-switching overhead: */ + sleep_ticks -= cx->latency_ticks + C3_OVERHEAD; + + break; + + default: + local_irq_enable(); + return; + } + + cx->usage++; + if ( (cx->type != ACPI_STATE_C1) && (sleep_ticks > 0) ) + cx->time += sleep_ticks; + + next_state = power->state; + + /* + * Promotion? + * ---------- + * Track the number of longs (time asleep is greater than threshold) + * and promote when the count threshold is reached. Note that bus + * mastering activity may prevent promotions. + * Do not promote above max_cstate. + */ + if ( cx->promotion.state && + ((cx->promotion.state - power->states) <= max_cstate) ) + { + if ( sleep_ticks > cx->promotion.threshold.ticks ) + { + cx->promotion.count++; + cx->demotion.count = 0; + if ( cx->promotion.count >= cx->promotion.threshold.count ) + { + if ( power->flags.bm_check ) + { + if ( !(power->bm_activity & cx->promotion.threshold.bm) ) + { + next_state = cx->promotion.state; + goto end; + } + } + else + { + next_state = cx->promotion.state; + goto end; + } + } + } + } + + /* + * Demotion? + * --------- + * Track the number of shorts (time asleep is less than time threshold) + * and demote when the usage threshold is reached. + */ + if ( cx->demotion.state ) + { + if ( sleep_ticks < cx->demotion.threshold.ticks ) + { + cx->demotion.count++; + cx->promotion.count = 0; + if ( cx->demotion.count >= cx->demotion.threshold.count ) + { + next_state = cx->demotion.state; + goto end; + } + } + } + +end: + /* + * Demote if current state exceeds max_cstate + */ + if ( (power->state - power->states) > max_cstate ) + { + if ( cx->demotion.state ) + next_state = cx->demotion.state; + } + + /* + * New Cx State? + * ------------- + * If we're going to start using a new Cx state we must clean up + * from the previous and prepare to use the new. + */ + if ( next_state != power->state ) + acpi_processor_power_activate(power, next_state); +} + +static int acpi_processor_set_power_policy(struct acpi_processor_power *power) +{ + unsigned int i; + unsigned int state_is_set = 0; + struct acpi_processor_cx *lower = NULL; + struct acpi_processor_cx *higher = NULL; + struct acpi_processor_cx *cx; + + if ( !power ) + return -EINVAL; + + /* + * This function sets the default Cx state policy (OS idle handler). + * Our scheme is to promote quickly to C2 but more conservatively + * to C3. We're favoring C2 for its characteristics of low latency + * (quick response), good power savings, and ability to allow bus + * mastering activity. Note that the Cx state policy is completely + * customizable and can be altered dynamically. + */ + + /* startup state */ + for ( i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++ ) + { + cx = &power->states[i]; + if ( !cx->valid ) + continue; + + if ( !state_is_set ) + power->state = cx; + state_is_set++; + break; + } + + if ( !state_is_set ) + return -ENODEV; + + /* demotion */ + for ( i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++ ) + { + cx = &power->states[i]; + if ( !cx->valid ) + continue; + + if ( lower ) + { + cx->demotion.state = lower; + cx->demotion.threshold.ticks = cx->latency_ticks; + cx->demotion.threshold.count = 1; + if ( cx->type == ACPI_STATE_C3 ) + cx->demotion.threshold.bm = bm_history; + } + + lower = cx; + } + + /* promotion */ + for ( i = (ACPI_PROCESSOR_MAX_POWER - 1); i > 0; i-- ) + { + cx = &power->states[i]; + if ( !cx->valid ) + continue; + + if ( higher ) + { + cx->promotion.state = higher; + cx->promotion.threshold.ticks = cx->latency_ticks; + if ( cx->type >= ACPI_STATE_C2 ) + cx->promotion.threshold.count = 4; + else + cx->promotion.threshold.count = 10; + if ( higher->type == ACPI_STATE_C3 ) + cx->promotion.threshold.bm = bm_history; + } + + higher = cx; + } + + return 0; +} + +static int init_cx_pminfo(struct acpi_processor_power *acpi_power) +{ + memset(acpi_power, 0, sizeof(*acpi_power)); + + acpi_power->states[ACPI_STATE_C1].type = ACPI_STATE_C1; + + acpi_power->states[ACPI_STATE_C0].valid = 1; + acpi_power->states[ACPI_STATE_C1].valid = 1; + + acpi_power->count = 2; + + return 0; +} + +#define CPUID_MWAIT_LEAF (5) +#define CPUID5_ECX_EXTENSIONS_SUPPORTED (0x1) +#define CPUID5_ECX_INTERRUPT_BREAK (0x2) + +#define MWAIT_ECX_INTERRUPT_BREAK (0x1) + +#define MWAIT_SUBSTATE_MASK (0xf) +#define MWAIT_SUBSTATE_SIZE (4) + +static int acpi_processor_ffh_cstate_probe(xen_processor_cx_t *cx) +{ + struct cpuinfo_x86 *c = ¤t_cpu_data; + unsigned int eax, ebx, ecx, edx; + unsigned int edx_part; + unsigned int cstate_type; /* C-state type and not ACPI C-state type */ + unsigned int num_cstate_subtype; + + if ( c->cpuid_level < CPUID_MWAIT_LEAF ) + { + printk(XENLOG_INFO "MWAIT leaf not supported by cpuid\n"); + return -EFAULT; + } + + cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); + printk(XENLOG_DEBUG "cpuid.MWAIT[.eax=%x, .ebx=%x, .ecx=%x, .edx=%x]\n", + eax, ebx, ecx, edx); + + /* Check whether this particular cx_type (in CST) is supported or not */ + cstate_type = (cx->reg.address >> MWAIT_SUBSTATE_SIZE) + 1; + edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE); + num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; + + if ( num_cstate_subtype < (cx->reg.address & MWAIT_SUBSTATE_MASK) ) + return -EFAULT; + + /* mwait ecx extensions INTERRUPT_BREAK should be supported for C2/C3 */ + if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || + !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ) + return -EFAULT; + + printk(XENLOG_INFO "Monitor-Mwait will be used to enter C-%d state\n", cx->type); + return 0; +} + +/* + * Initialize bm_flags based on the CPU cache properties + * On SMP it depends on cache configuration + * - When cache is not shared among all CPUs, we flush cache + * before entering C3. + * - When cache is shared among all CPUs, we use bm_check + * mechanism as in UP case + * + * This routine is called only after all the CPUs are online + */ +static void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags) +{ + struct cpuinfo_x86 *c = ¤t_cpu_data; + + flags->bm_check = 0; + if ( num_online_cpus() == 1 ) + flags->bm_check = 1; + else if ( c->x86_vendor == X86_VENDOR_INTEL ) + { + /* + * Today all CPUs that support C3 share cache. + * TBD: This needs to look at cache shared map, once + * multi-core detection patch makes to the base. + */ + flags->bm_check = 1; + } +} + +#define VENDOR_INTEL (1) +#define NATIVE_CSTATE_BEYOND_HALT (2) + +static int check_cx(struct acpi_processor_power *power, xen_processor_cx_t *cx) +{ + static int bm_check_flag; + if ( cx == NULL ) + return -EINVAL; + + switch ( cx->reg.space_id ) + { + case ACPI_ADR_SPACE_SYSTEM_IO: + if ( cx->reg.address == 0 ) + return -EINVAL; + break; + + case ACPI_ADR_SPACE_FIXED_HARDWARE: + if ( cx->type > ACPI_STATE_C1 ) + { + if ( cx->reg.bit_width != VENDOR_INTEL || + cx->reg.bit_offset != NATIVE_CSTATE_BEYOND_HALT ) + return -EINVAL; + + /* assume all logical cpu has the same support for mwait */ + if ( acpi_processor_ffh_cstate_probe(cx) ) + return -EFAULT; + } + break; + + default: + return -ENODEV; + } + + if ( cx->type == ACPI_STATE_C3 ) + { + /* All the logic here assumes flags.bm_check is same across all CPUs */ + if ( !bm_check_flag ) + { + /* Determine whether bm_check is needed based on CPU */ + acpi_processor_power_init_bm_check(&(power->flags)); + bm_check_flag = power->flags.bm_check; + } + else + { + power->flags.bm_check = bm_check_flag; + } + + if ( power->flags.bm_check ) + { + if ( !power->flags.bm_control ) + { + if ( power->flags.has_cst != 1 ) + { + /* bus mastering control is necessary */ + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "C3 support requires BM control\n")); + return -1; + } + else + { + /* Here we enter C3 without bus mastering */ + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "C3 support without BM control\n")); + } + } + } + else + { + /* + * WBINVD should be set in fadt, for C3 state to be + * supported on when bm_check is not required. + */ + if ( !(acpi_gbl_FADT.flags & ACPI_FADT_WBINVD) ) + { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Cache invalidation should work properly" + " for C3 to be enabled on SMP systems\n")); + return -1; + } + acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0); + } + } + + return 0; +} + +static int set_cx(struct acpi_processor_power *acpi_power, + xen_processor_cx_t *xen_cx) +{ + struct acpi_processor_cx *cx; + + /* skip unsupported acpi cstate */ + if ( check_cx(acpi_power, xen_cx) ) + return -EFAULT; + + cx = &acpi_power->states[xen_cx->type]; + if ( !cx->valid ) + acpi_power->count++; + + cx->valid = 1; + cx->type = xen_cx->type; + cx->address = xen_cx->reg.address; + cx->space_id = xen_cx->reg.space_id; + cx->latency = xen_cx->latency; + cx->power = xen_cx->power; + + cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); + + return 0; +} + +static int get_cpu_id(u8 acpi_id) +{ + int i; + u8 apic_id; + + apic_id = x86_acpiid_to_apicid[acpi_id]; + if ( apic_id == 0xff ) + return -1; + + for ( i = 0; i < NR_CPUS; i++ ) + { + if ( apic_id == x86_cpu_to_apicid[i] ) + return i; + } + + return -1; +} + +#ifdef DEBUG_PM_CX +static void print_cx_pminfo(uint32_t cpu, struct xen_processor_power *power) +{ + XEN_GUEST_HANDLE(xen_processor_cx_t) states; + xen_processor_cx_t state; + XEN_GUEST_HANDLE(xen_processor_csd_t) csd; + xen_processor_csd_t dp; + uint32_t i; + + printk("cpu%d cx acpi info:\n", cpu); + printk("\tcount = %d\n", power->count); + printk("\tflags: bm_cntl[%d], bm_chk[%d], has_cst[%d],\n" + "\t pwr_setup_done[%d], bm_rld_set[%d]\n", + power->flags.bm_control, power->flags.bm_check, power->flags.has_cst, + power->flags.power_setup_done, power->flags.bm_rld_set); + + states = power->states; + + for ( i = 0; i < power->count; i++ ) + { + if ( unlikely(copy_from_guest_offset(&state, states, i, 1)) ) + return; + + printk("\tstates[%d]:\n", i); + printk("\t\treg.space_id = 0x%x\n", state.reg.space_id); + printk("\t\treg.bit_width = 0x%x\n", state.reg.bit_width); + printk("\t\treg.bit_offset = 0x%x\n", state.reg.bit_offset); + printk("\t\treg.access_size = 0x%x\n", state.reg.access_size); + printk("\t\treg.address = 0x%"PRIx64"\n", state.reg.address); + printk("\t\ttype = %d\n", state.type); + printk("\t\tlatency = %d\n", state.latency); + printk("\t\tpower = %d\n", state.power); + + csd = state.dp; + printk("\t\tdp(@0x%p)\n", csd.p); + + if ( csd.p != NULL ) + { + if ( unlikely(copy_from_guest(&dp, csd, 1)) ) + return; + printk("\t\t\tdomain = %d\n", dp.domain); + printk("\t\t\tcoord_type = %d\n", dp.coord_type); + printk("\t\t\tnum = %d\n", dp.num); + } + } +} +#else +#define print_cx_pminfo(c, p) +#endif + +long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power) +{ + XEN_GUEST_HANDLE(xen_processor_cx_t) states; + xen_processor_cx_t xen_cx; + struct acpi_processor_power *acpi_power; + int cpu_id, i; + + if ( unlikely(!guest_handle_okay(power->states, power->count)) ) + return -EFAULT; + + print_cx_pminfo(cpu, power); + + /* map from acpi_id to cpu_id */ + cpu_id = get_cpu_id((u8)cpu); + if ( cpu_id == -1 ) + { + printk(XENLOG_ERR "no cpu_id for acpi_id %d\n", cpu); + return -EFAULT; + } + + acpi_power = &processor_powers[cpu_id]; + + init_cx_pminfo(acpi_power); + + acpi_power->flags.bm_check = power->flags.bm_check; + acpi_power->flags.bm_control = power->flags.bm_control; + acpi_power->flags.has_cst = power->flags.has_cst; + + states = power->states; + + for ( i = 0; i < power->count; i++ ) + { + if ( unlikely(copy_from_guest_offset(&xen_cx, states, i, 1)) ) + return -EFAULT; + + set_cx(acpi_power, &xen_cx); + } + + /* FIXME: C-state dependency is not supported by far */ + + /* initialize default policy */ + acpi_processor_set_power_policy(acpi_power); + + print_acpi_power(cpu_id, acpi_power); + + if ( cpu_id == 0 && pm_idle_save == NULL ) + { + pm_idle_save = pm_idle; + pm_idle = acpi_processor_idle; + } + + return 0; +} diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/apic.c --- a/xen/arch/x86/apic.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/apic.c Thu May 08 18:40:07 2008 +0900 @@ -47,6 +47,8 @@ int enable_local_apic __initdata = 0; /* */ int apic_verbosity; +int x2apic_enabled __read_mostly = 0; + static void apic_pm_activate(void); @@ -306,7 +308,10 @@ int __init verify_local_APIC(void) */ reg0 = apic_read(APIC_LVR); apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg0); - apic_write(APIC_LVR, reg0 ^ APIC_LVR_MASK); + + /* We don't try writing LVR in x2APIC mode since that incurs #GP. */ + if ( !x2apic_enabled ) + apic_write(APIC_LVR, reg0 ^ APIC_LVR_MASK); reg1 = apic_read(APIC_LVR); apic_printk(APIC_DEBUG, "Getting VERSION: %x\n", reg1); @@ -610,7 +615,8 @@ int lapic_suspend(void) apic_pm_state.apic_id = apic_read(APIC_ID); apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI); apic_pm_state.apic_ldr = apic_read(APIC_LDR); - apic_pm_state.apic_dfr = apic_read(APIC_DFR); + if ( !x2apic_enabled ) + apic_pm_state.apic_dfr = apic_read(APIC_DFR); apic_pm_state.apic_spiv = apic_read(APIC_SPIV); apic_pm_state.apic_lvtt = apic_read(APIC_LVTT); apic_pm_state.apic_lvtpc = apic_read(APIC_LVTPC); @@ -643,14 +649,20 @@ int lapic_resume(void) * FIXME! This will be wrong if we ever support suspend on * SMP! We'll need to do this as part of the CPU restore! */ - rdmsr(MSR_IA32_APICBASE, l, h); - l &= ~MSR_IA32_APICBASE_BASE; - l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; - wrmsr(MSR_IA32_APICBASE, l, h); + if ( !x2apic_enabled ) + { + rdmsr(MSR_IA32_APICBASE, l, h); + l &= ~MSR_IA32_APICBASE_BASE; + l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; + wrmsr(MSR_IA32_APICBASE, l, h); + } + else + enable_x2apic(); apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); apic_write(APIC_ID, apic_pm_state.apic_id); - apic_write(APIC_DFR, apic_pm_state.apic_dfr); + if ( !x2apic_enabled ) + apic_write(APIC_DFR, apic_pm_state.apic_dfr); apic_write(APIC_LDR, apic_pm_state.apic_ldr); apic_write(APIC_TASKPRI, apic_pm_state.apic_taskpri); apic_write(APIC_SPIV, apic_pm_state.apic_spiv); @@ -809,10 +821,29 @@ no_apic: return -1; } +void enable_x2apic(void) +{ + u32 lo, hi; + + rdmsr(MSR_IA32_APICBASE, lo, hi); + if ( !(lo & MSR_IA32_APICBASE_EXTD) ) + { + lo |= MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_EXTD; + wrmsr(MSR_IA32_APICBASE, lo, 0); + printk("x2APIC mode enabled.\n"); + } + else + printk("x2APIC mode enabled by BIOS.\n"); + + x2apic_enabled = 1; +} + void __init init_apic_mappings(void) { unsigned long apic_phys; + if ( x2apic_enabled ) + goto __next; /* * If no local APIC can be found then set up a fake all * zeroes page to simulate the local APIC and another @@ -828,12 +859,13 @@ void __init init_apic_mappings(void) apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n", APIC_BASE, apic_phys); +__next: /* * Fetch the APIC ID of the BSP in case we have a * default configuration (or the MP table is broken). */ if (boot_cpu_physical_apicid == -1U) - boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); + boot_cpu_physical_apicid = get_apic_id(); #ifdef CONFIG_X86_IO_APIC { @@ -1271,7 +1303,7 @@ int __init APIC_init_uniprocessor (void) * might be zero if read from MP tables. Get it from LAPIC. */ #ifdef CONFIG_CRASH_DUMP - boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); + boot_cpu_physical_apicid = get_apic_id(); #endif phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid); diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/domain.c Thu May 08 18:40:07 2008 +0900 @@ -56,6 +56,9 @@ DEFINE_PER_CPU(u64, efer); DEFINE_PER_CPU(u64, efer); DEFINE_PER_CPU(unsigned long, cr4); +static void default_idle(void); +void (*pm_idle) (void) = default_idle; + static void unmap_vcpu_info(struct vcpu *v); static void paravirt_ctxt_switch_from(struct vcpu *v); @@ -105,7 +108,7 @@ void idle_loop(void) if ( cpu_is_offline(smp_processor_id()) ) play_dead(); page_scrub_schedule_work(); - default_idle(); + (*pm_idle)(); do_softirq(); } } @@ -440,10 +443,9 @@ int arch_domain_create(struct domain *d, { #ifdef __x86_64__ struct page_info *pg; - int i; #endif l1_pgentry_t gdt_l1e; - int vcpuid, pdpt_order, paging_initialised = 0; + int i, vcpuid, pdpt_order, paging_initialised = 0; int rc = -ENOMEM; d->arch.hvm_domain.hap_enabled = @@ -526,6 +528,8 @@ int arch_domain_create(struct domain *d, goto fail; } + spin_lock_init(&d->arch.irq_lock); + if ( is_hvm_domain(d) ) { if ( (rc = hvm_domain_initialise(d)) != 0 ) @@ -539,6 +543,13 @@ int arch_domain_create(struct domain *d, /* 32-bit PV guest by default only if Xen is not 64-bit. */ d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = (CONFIG_PAGING_LEVELS != 4); + } + + memset(d->arch.cpuids, 0, sizeof(d->arch.cpuids)); + for ( i = 0; i < MAX_CPUID_INPUT; i++ ) + { + d->arch.cpuids[i].input[0] = XEN_CPUID_INPUT_UNUSED; + d->arch.cpuids[i].input[1] = XEN_CPUID_INPUT_UNUSED; } return 0; @@ -1910,6 +1921,37 @@ void arch_dump_vcpu_info(struct vcpu *v) paging_dump_vcpu_info(v); } +void domain_cpuid( + struct domain *d, + unsigned int input, + unsigned int sub_input, + unsigned int *eax, + unsigned int *ebx, + unsigned int *ecx, + unsigned int *edx) +{ + cpuid_input_t *cpuid; + int i; + + for ( i = 0; i < MAX_CPUID_INPUT; i++ ) + { + cpuid = &d->arch.cpuids[i]; + + if ( (cpuid->input[0] == input) && + ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) || + (cpuid->input[1] == sub_input)) ) + { + *eax = cpuid->eax; + *ebx = cpuid->ebx; + *ecx = cpuid->ecx; + *edx = cpuid->edx; + return; + } + } + + *eax = *ebx = *ecx = *edx = 0; +} + /* * Local variables: * mode: C diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/domctl.c --- a/xen/arch/x86/domctl.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/domctl.c Thu May 08 18:40:07 2008 +0900 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -539,7 +540,7 @@ long arch_do_domctl( if ( device_assigned(bus, devfn) ) { gdprintk(XENLOG_ERR, "XEN_DOMCTL_test_assign_device: " - "%x:%x:%x already assigned\n", + "%x:%x:%x already assigned, or non-existent\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); break; } @@ -568,7 +569,7 @@ long arch_do_domctl( if ( device_assigned(bus, devfn) ) { gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: " - "%x:%x:%x already assigned\n", + "%x:%x:%x already assigned, or non-existent\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); break; } @@ -842,6 +843,45 @@ long arch_do_domctl( } break; + case XEN_DOMCTL_set_cpuid: + { + struct domain *d; + xen_domctl_cpuid_t *ctl = &domctl->u.cpuid; + cpuid_input_t *cpuid = NULL; + int i; + + ret = -ESRCH; + d = rcu_lock_domain_by_id(domctl->domain); + if ( d == NULL ) + break; + + for ( i = 0; i < MAX_CPUID_INPUT; i++ ) + { + cpuid = &d->arch.cpuids[i]; + + if ( cpuid->input[0] == XEN_CPUID_INPUT_UNUSED ) + break; + + if ( (cpuid->input[0] == ctl->input[0]) && + ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) || + (cpuid->input[1] == ctl->input[1])) ) + break; + } + + if ( i == MAX_CPUID_INPUT ) + { + ret = -ENOENT; + } + else + { + memcpy(cpuid, ctl, sizeof(cpuid_input_t)); + ret = 0; + } + + rcu_unlock_domain(d); + } + break; + default: ret = -ENOSYS; break; diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/genapic/Makefile --- a/xen/arch/x86/genapic/Makefile Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/genapic/Makefile Thu May 08 18:40:07 2008 +0900 @@ -1,4 +1,5 @@ obj-y += bigsmp.o obj-y += bigsmp.o +obj-y += x2apic.o obj-y += default.o obj-y += delivery.o obj-y += probe.o diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/genapic/delivery.c --- a/xen/arch/x86/genapic/delivery.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/genapic/delivery.c Thu May 08 18:40:07 2008 +0900 @@ -17,7 +17,7 @@ void init_apic_ldr_flat(void) apic_write_around(APIC_DFR, APIC_DFR_FLAT); val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; - val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id()); + val |= SET_xAPIC_LOGICAL_ID(1UL << smp_processor_id()); apic_write_around(APIC_LDR, val); } diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/genapic/probe.c --- a/xen/arch/x86/genapic/probe.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/genapic/probe.c Thu May 08 18:40:07 2008 +0900 @@ -14,6 +14,7 @@ #include #include +extern struct genapic apic_x2apic; extern struct genapic apic_summit; extern struct genapic apic_bigsmp; extern struct genapic apic_default; @@ -21,6 +22,7 @@ struct genapic *genapic; struct genapic *genapic; struct genapic *apic_probe[] __initdata = { + &apic_x2apic, &apic_summit, &apic_bigsmp, &apic_default, /* must be last */ diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/genapic/x2apic.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/genapic/x2apic.c Thu May 08 18:40:07 2008 +0900 @@ -0,0 +1,79 @@ +/* + * x2APIC driver. + * + * 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, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include + +__init int probe_x2apic(void) +{ + return x2apic_is_available(); +} + +struct genapic apic_x2apic= { + APIC_INIT("x2apic", probe_x2apic), + GENAPIC_X2APIC +}; + +void init_apic_ldr_x2apic(void) +{ + /* We only use physical delivery mode. */ + return; +} + +void clustered_apic_check_x2apic(void) +{ + /* We only use physical delivery mode. */ + return; +} + +cpumask_t target_cpus_x2apic(void) +{ + /* Deliver interrupts only to CPU0 for now */ + return cpumask_of_cpu(0); +} + +unsigned int cpu_mask_to_apicid_x2apic(cpumask_t cpumask) +{ + return cpu_physical_id(first_cpu(cpumask)); +} + +void send_IPI_mask_x2apic(cpumask_t cpumask, int vector) +{ + unsigned int query_cpu; + u32 cfg, dest; + unsigned long flags; + + ASSERT(cpus_subset(cpumask, cpu_online_map)); + ASSERT(!cpus_empty(cpumask)); + + local_irq_save(flags); + + cfg = APIC_DM_FIXED | 0 /* no shorthand */ | APIC_DEST_PHYSICAL | vector; + for_each_cpu_mask(query_cpu, cpumask) + { + dest = cpu_physical_id(query_cpu); + apic_icr_write(cfg, dest); + } + + local_irq_restore(flags); +} + diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/hvm/Makefile --- a/xen/arch/x86/hvm/Makefile Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/hvm/Makefile Thu May 08 18:40:07 2008 +0900 @@ -16,4 +16,5 @@ obj-y += vlapic.o obj-y += vlapic.o obj-y += vpic.o obj-y += save.o +obj-y += vmsi.o obj-y += stdvga.o diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/hvm/hvm.c Thu May 08 18:40:07 2008 +0900 @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -739,15 +740,22 @@ void hvm_send_assist_req(struct vcpu *v) void hvm_hlt(unsigned long rflags) { + struct vcpu *curr = current; + + if ( hvm_event_pending(curr) ) + return; + /* * If we halt with interrupts disabled, that's a pretty sure sign that we * want to shut down. In a real processor, NMIs are the only way to break * out of this. */ if ( unlikely(!(rflags & X86_EFLAGS_IF)) ) - return hvm_vcpu_down(current); + return hvm_vcpu_down(curr); do_sched_op_compat(SCHEDOP_block, 0); + + HVMTRACE_1D(HLT, curr, /* pending = */ vcpu_runnable(curr)); } void hvm_triple_fault(void) @@ -1594,66 +1602,15 @@ void hvm_cpuid(unsigned int input, unsig if ( cpuid_hypervisor_leaves(input, eax, ebx, ecx, edx) ) return; - cpuid(input, eax, ebx, ecx, edx); - - switch ( input ) - { - case 0x00000001: - /* Clear #threads count and poke initial VLAPIC ID. */ - *ebx &= 0x0000FFFFu; - *ebx |= (current->vcpu_id * 2) << 24; - - /* We always support MTRR MSRs. */ - *edx |= bitmaskof(X86_FEATURE_MTRR); - - *ecx &= (bitmaskof(X86_FEATURE_XMM3) | - bitmaskof(X86_FEATURE_SSSE3) | - bitmaskof(X86_FEATURE_CX16) | - bitmaskof(X86_FEATURE_SSE4_1) | - bitmaskof(X86_FEATURE_SSE4_2) | - bitmaskof(X86_FEATURE_POPCNT)); - - *edx &= (bitmaskof(X86_FEATURE_FPU) | - bitmaskof(X86_FEATURE_VME) | - bitmaskof(X86_FEATURE_DE) | - bitmaskof(X86_FEATURE_PSE) | - bitmaskof(X86_FEATURE_TSC) | - bitmaskof(X86_FEATURE_MSR) | - bitmaskof(X86_FEATURE_PAE) | - bitmaskof(X86_FEATURE_MCE) | - bitmaskof(X86_FEATURE_CX8) | - bitmaskof(X86_FEATURE_APIC) | - bitmaskof(X86_FEATURE_SEP) | - bitmaskof(X86_FEATURE_MTRR) | - bitmaskof(X86_FEATURE_PGE) | - bitmaskof(X86_FEATURE_MCA) | - bitmaskof(X86_FEATURE_CMOV) | - bitmaskof(X86_FEATURE_PAT) | - bitmaskof(X86_FEATURE_CLFLSH) | - bitmaskof(X86_FEATURE_MMX) | - bitmaskof(X86_FEATURE_FXSR) | - bitmaskof(X86_FEATURE_XMM) | - bitmaskof(X86_FEATURE_XMM2)); + domain_cpuid(v->domain, input, *ecx, eax, ebx, ecx, edx); + + if ( input == 0x00000001 ) + { + /* Fix up VLAPIC details. */ + *ebx &= 0x00FFFFFFu; + *ebx |= (v->vcpu_id * 2) << 24; if ( vlapic_hw_disabled(vcpu_vlapic(v)) ) - __clear_bit(X86_FEATURE_APIC & 31, edx); -#if CONFIG_PAGING_LEVELS >= 3 - if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_PAE_ENABLED] ) -#endif - __clear_bit(X86_FEATURE_PAE & 31, edx); - break; - - case 0x80000001: -#if CONFIG_PAGING_LEVELS >= 3 - if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_PAE_ENABLED] ) -#endif - __clear_bit(X86_FEATURE_NX & 31, edx); -#ifdef __i386__ - /* Mask feature for Intel ia32e or AMD long mode. */ - __clear_bit(X86_FEATURE_LAHF_LM & 31, ecx); - __clear_bit(X86_FEATURE_LM & 31, edx); - __clear_bit(X86_FEATURE_SYSCALL & 31, edx); -#endif - break; + __clear_bit(X86_FEATURE_APIC & 31, ebx); } } @@ -1663,10 +1620,14 @@ int hvm_msr_read_intercept(struct cpu_us uint64_t msr_content = 0; struct vcpu *v = current; uint64_t *var_range_base, *fixed_range_base; - int index; + int index, mtrr; + uint32_t cpuid[4]; var_range_base = (uint64_t *)v->arch.hvm_vcpu.mtrr.var_ranges; fixed_range_base = (uint64_t *)v->arch.hvm_vcpu.mtrr.fixed_ranges; + + hvm_cpuid(1, &cpuid[0], &cpuid[1], &cpuid[2], &cpuid[3]); + mtrr = !!(cpuid[3] & bitmaskof(X86_FEATURE_MTRR)); switch ( ecx ) { @@ -1695,25 +1656,37 @@ int hvm_msr_read_intercept(struct cpu_us break; case MSR_MTRRcap: + if ( !mtrr ) + goto gp_fault; msr_content = v->arch.hvm_vcpu.mtrr.mtrr_cap; break; case MSR_MTRRdefType: + if ( !mtrr ) + goto gp_fault; msr_content = v->arch.hvm_vcpu.mtrr.def_type | (v->arch.hvm_vcpu.mtrr.enabled << 10); break; case MSR_MTRRfix64K_00000: + if ( !mtrr ) + goto gp_fault; msr_content = fixed_range_base[0]; break; case MSR_MTRRfix16K_80000: case MSR_MTRRfix16K_A0000: + if ( !mtrr ) + goto gp_fault; index = regs->ecx - MSR_MTRRfix16K_80000; msr_content = fixed_range_base[index + 1]; break; case MSR_MTRRfix4K_C0000...MSR_MTRRfix4K_F8000: + if ( !mtrr ) + goto gp_fault; index = regs->ecx - MSR_MTRRfix4K_C0000; msr_content = fixed_range_base[index + 3]; break; case MSR_IA32_MTRR_PHYSBASE0...MSR_IA32_MTRR_PHYSMASK7: + if ( !mtrr ) + goto gp_fault; index = regs->ecx - MSR_IA32_MTRR_PHYSBASE0; msr_content = var_range_base[index]; break; @@ -1725,6 +1698,10 @@ int hvm_msr_read_intercept(struct cpu_us regs->eax = (uint32_t)msr_content; regs->edx = (uint32_t)(msr_content >> 32); return X86EMUL_OKAY; + +gp_fault: + hvm_inject_exception(TRAP_gp_fault, 0, 0); + return X86EMUL_EXCEPTION; } int hvm_msr_write_intercept(struct cpu_user_regs *regs) @@ -1739,7 +1716,11 @@ int hvm_msr_write_intercept(struct cpu_u uint32_t ecx = regs->ecx; uint64_t msr_content = (uint32_t)regs->eax | ((uint64_t)regs->edx << 32); struct vcpu *v = current; - int index; + int index, mtrr; + uint32_t cpuid[4]; + + hvm_cpuid(1, &cpuid[0], &cpuid[1], &cpuid[2], &cpuid[3]); + mtrr = !!(cpuid[3] & bitmaskof(X86_FEATURE_MTRR)); switch ( ecx ) { @@ -1758,29 +1739,41 @@ int hvm_msr_write_intercept(struct cpu_u break; case MSR_MTRRcap: + if ( !mtrr ) + goto gp_fault; goto gp_fault; case MSR_MTRRdefType: + if ( !mtrr ) + goto gp_fault; if ( !mtrr_def_type_msr_set(&v->arch.hvm_vcpu.mtrr, msr_content) ) goto gp_fault; break; case MSR_MTRRfix64K_00000: + if ( !mtrr ) + goto gp_fault; if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, 0, msr_content) ) goto gp_fault; break; case MSR_MTRRfix16K_80000: case MSR_MTRRfix16K_A0000: + if ( !mtrr ) + goto gp_fault; index = regs->ecx - MSR_MTRRfix16K_80000 + 1; if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, index, msr_content) ) goto gp_fault; break; case MSR_MTRRfix4K_C0000...MSR_MTRRfix4K_F8000: + if ( !mtrr ) + goto gp_fault; index = regs->ecx - MSR_MTRRfix4K_C0000 + 3; if ( !mtrr_fix_range_msr_set(&v->arch.hvm_vcpu.mtrr, index, msr_content) ) goto gp_fault; break; case MSR_IA32_MTRR_PHYSBASE0...MSR_IA32_MTRR_PHYSMASK7: + if ( !mtrr ) + goto gp_fault; if ( !mtrr_var_range_msr_set(&v->arch.hvm_vcpu.mtrr, regs->ecx, msr_content) ) goto gp_fault; @@ -2360,6 +2353,54 @@ long do_hvm_op(unsigned long op, XEN_GUE rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -ENOSYS; break; + case HVMOP_track_dirty_vram: + { + struct xen_hvm_track_dirty_vram a; + struct domain *d; + + if ( copy_from_guest(&a, arg, 1) ) + return -EFAULT; + + if ( a.domid == DOMID_SELF ) + { + d = rcu_lock_current_domain(); + } + else + { + if ( (d = rcu_lock_domain_by_id(a.domid)) == NULL ) + return -ESRCH; + if ( !IS_PRIV_FOR(current->domain, d) ) + { + rc = -EPERM; + goto param_fail2; + } + } + + rc = -EINVAL; + if ( !is_hvm_domain(d) ) + goto param_fail2; + + rc = xsm_hvm_param(d, op); + if ( rc ) + goto param_fail2; + + rc = -ESRCH; + if ( d->is_dying ) + goto param_fail2; + + rc = -EINVAL; + if ( !shadow_mode_enabled(d)) + goto param_fail2; + if ( d->vcpu[0] == NULL ) + goto param_fail2; + + rc = shadow_track_dirty_vram(d, a.first_pfn, a.nr, a.dirty_bitmap); + + param_fail2: + rcu_unlock_domain(d); + break; + } + default: { gdprintk(XENLOG_WARNING, "Bad HVM op %ld.\n", op); diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/hvm/i8254.c --- a/xen/arch/x86/hvm/i8254.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/hvm/i8254.c Thu May 08 18:40:07 2008 +0900 @@ -206,19 +206,21 @@ static void pit_load_count(PITState *pit switch ( s->mode ) { - case 2: - /* Periodic timer. */ - create_periodic_time(v, &pit->pt0, period, 0, 0, pit_time_fired, - &pit->count_load_time[channel]); - break; - case 1: - /* One-shot timer. */ - create_periodic_time(v, &pit->pt0, period, 0, 1, pit_time_fired, - &pit->count_load_time[channel]); - break; - default: - destroy_periodic_time(&pit->pt0); - break; + case 2: + case 3: + /* Periodic timer. */ + create_periodic_time(v, &pit->pt0, period, 0, 0, pit_time_fired, + &pit->count_load_time[channel]); + break; + case 1: + case 4: + /* One-shot timer. */ + create_periodic_time(v, &pit->pt0, period, 0, 1, pit_time_fired, + &pit->count_load_time[channel]); + break; + default: + destroy_periodic_time(&pit->pt0); + break; } } diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/hvm/stdvga.c --- a/xen/arch/x86/hvm/stdvga.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/hvm/stdvga.c Thu May 08 18:40:07 2008 +0900 @@ -131,14 +131,15 @@ static int stdvga_outb(uint64_t addr, ui /* When in standard vga mode, emulate here all writes to the vram buffer * so we can immediately satisfy reads without waiting for qemu. */ - s->stdvga = - (s->sr[7] == 0x00) && /* standard vga mode */ - (s->gr[6] == 0x05); /* misc graphics register w/ MemoryMapSelect=1 - * 0xa0000-0xaffff (64k region), AlphaDis=1 */ + s->stdvga = (s->sr[7] == 0x00); if ( !prev_stdvga && s->stdvga ) { - s->cache = 1; /* (re)start caching video buffer */ + /* + * (Re)start caching of video buffer. + * XXX TODO: In case of a restart the cache could be unsynced. + */ + s->cache = 1; gdprintk(XENLOG_INFO, "entering stdvga and caching modes\n"); } else if ( prev_stdvga && !s->stdvga ) @@ -180,6 +181,40 @@ static int stdvga_intercept_pio( } return X86EMUL_UNHANDLEABLE; /* propagate to external ioemu */ +} + +static unsigned int stdvga_mem_offset( + struct hvm_hw_stdvga *s, unsigned int mmio_addr) +{ + unsigned int memory_map_mode = (s->gr[6] >> 2) & 3; + unsigned int offset = mmio_addr & 0x1ffff; + + switch ( memory_map_mode ) + { + case 0: + break; + case 1: + if ( offset >= 0x10000 ) + goto fail; + offset += 0; /* assume bank_offset == 0; */ + break; + case 2: + offset -= 0x10000; + if ( offset >= 0x8000 ) + goto fail; + break; + default: + case 3: + offset -= 0x18000; + if ( offset >= 0x8000 ) + goto fail; + break; + } + + return offset; + + fail: + return ~0u; } #define GET_PLANE(data, p) (((data) >> ((p) * 8)) & 0xff) @@ -191,8 +226,8 @@ static uint8_t stdvga_mem_readb(uint64_t uint32_t ret, *vram_l; uint8_t *vram_b; - addr &= 0x1ffff; - if ( addr >= 0x10000 ) + addr = stdvga_mem_offset(s, addr); + if ( addr == ~0u ) return 0xff; if ( s->sr[4] & 0x08 ) @@ -273,8 +308,8 @@ static void stdvga_mem_writeb(uint64_t a uint32_t write_mask, bit_mask, set_mask, *vram_l; uint8_t *vram_b; - addr &= 0x1ffff; - if ( addr >= 0x10000 ) + addr = stdvga_mem_offset(s, addr); + if ( addr == ~0u ) return; if ( s->sr[4] & 0x08 ) @@ -531,7 +566,7 @@ void stdvga_init(struct domain *d) register_portio_handler(d, 0x3ce, 2, stdvga_intercept_pio); /* MMIO. */ register_buffered_io_handler( - d, 0xa0000, 0x10000, stdvga_intercept_mmio); + d, 0xa0000, 0x20000, stdvga_intercept_mmio); } } diff -r f2457c7aff8d -r 611787b6ca35 xen/arch/x86/hvm/svm/emulate.c --- a/xen/arch/x86/hvm/svm/emulate.c Fri Apr 25 20:13:52 2008 +0900 +++ b/xen/arch/x86/hvm/svm/emulate.c Thu May 08 18:40:07 2008 +0900 @@ -28,18 +28,6 @@ #include #define MAX_INST_LEN 15 - -static int inst_copy_from_guest( - unsigned char *buf, unsigned long guest_eip, int inst_len) -{ - struct vmcb_struct *vmcb = current->arch.hvm_svm.vmcb; - uint32_t pfec = (vmcb->cpl == 3) ? PFEC_user_mode : 0; - if ( (inst_len > MAX_INST_LEN) || (inst_len <= 0) ) - return 0; - if ( hvm_fetch_from_guest_virt_nofault(buf, guest_eip, inst_len, pfec) ) - return 0; - return inst_len; -} _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTnx-0002TS-84 for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTob-0007at-CW; Tue, 20 May 2008 15:31:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTns-0007BK-GR for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:04 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnl-0002zS-Ao for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:01 +0000 X-SBRS: 3.6 X-MesageID: 267630 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267630" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:08 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFU7qM029564 for ; Tue, 20 May 2008 08:30:07 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUQt4032392 for ; Tue, 20 May 2008 08:30:26 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUQdx032391 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:26 -0700 Message-Id: <200805201530.m4KFUQdx032391@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:24 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] fix gmfn_to_mfn X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210326058 -32400 # Node ID 948188bc9fa3f22c13b8bd98e4daccdd11b9e99c # Parent af327038a43f030cdc4e111188c6585ac740d79e [IA64] fix gmfn_to_mfn gmfn_to_mfn should return INVALID_MFN when the gpfn is I/O page. Using PV on HVM, I got the following error message. (XEN) /xen/include/asm/mm.h:181:d2 Error pfn 2: rd=f000000007fb4080, od=0000000000000000, caf=0000000000000000, taf=0000000000000000 (XEN) memory.c:165:d2 Bad page free for domain 2 Signed-off-by: Kouya Shimura --- xen/arch/ia64/xen/mm.c | 4 ++++ 1 files changed, 4 insertions(+) diff -r af327038a43f -r 948188bc9fa3 xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Fri Apr 11 17:05:30 2008 +0900 +++ b/xen/arch/ia64/xen/mm.c Fri May 09 18:40:58 2008 +0900 @@ -494,6 +494,10 @@ gmfn_to_mfn_foreign(struct domain *d, un if (!pte) { panic("gmfn_to_mfn_foreign: bad gpfn. spinning...\n"); } + + if ((pte & _PAGE_IO) && is_hvm_domain(d)) + return INVALID_MFN; + return ((pte & _PFN_MASK) >> PAGE_SHIFT); } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTo2-0002TV-G8 for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTog-0007ez-L5; Tue, 20 May 2008 15:31:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnu-0007DN-Vv for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:07 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTno-0002zM-70 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:04 +0000 X-SBRS: 3.6 X-MesageID: 267631 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267631" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:09 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFU8Z3029567 for ; Tue, 20 May 2008 08:30:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUR5O032409 for ; Tue, 20 May 2008 08:30:27 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFURwv032408 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:27 -0700 Message-Id: <200805201530.m4KFURwv032408@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:26 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] fix restoring HVM domain with PV driver X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210326058 -32400 # Node ID debc868e380b4fe40d50772b6e09cd96ba88d085 # Parent 948188bc9fa3f22c13b8bd98e4daccdd11b9e99c [IA64] fix restoring HVM domain with PV driver The HVM domain with PV driver always panics after save/restore or migration. This patch fixes it. Signed-off-by: Kouya Shimura --- xen/arch/ia64/linux-xen/entry.S | 38 +++++++++++++++++++++++++++++++------- xen/arch/ia64/vmx/vmx_init.c | 5 ----- 2 files changed, 31 insertions(+), 12 deletions(-) diff -r 948188bc9fa3 -r debc868e380b xen/arch/ia64/linux-xen/entry.S --- a/xen/arch/ia64/linux-xen/entry.S Fri May 09 18:40:58 2008 +0900 +++ b/xen/arch/ia64/linux-xen/entry.S Fri May 09 18:40:58 2008 +0900 @@ -651,13 +651,37 @@ GLOBAL_ENTRY(ia64_ret_from_clone) #ifdef XEN // new domains are cloned but not exec'ed so switch to user mode here cmp.ne pKStk,pUStk=r0,r0 - adds r16 = IA64_VCPU_FLAGS_OFFSET, r13 - ;; - ld8 r16 = [r16] - ;; - cmp.ne p6,p7 = r16, r0 - (p6) br.cond.spnt ia64_leave_hypervisor /* VTi */ - (p7) br.cond.spnt ia64_leave_kernel /* !VTi */ + adds r16 = IA64_VCPU_FLAGS_OFFSET, r13 + ;; + ld8 r16 = [r16] // arch.arch_vmx.flags + ;; + cmp.eq p6,p0 = r16, r0 +(p6) br.cond.spnt ia64_leave_kernel // !VMX_DOMAIN + ;; + adds r16 = PT(CR_IFS)+16, r12 + ;; + ld8 r16 = [r16] + cmp.eq pNonSys,pSys=r0,r0 // pSys=0,pNonSys=1 + ;; + cmp.eq p6,p7 = 0x6, r16 +(p7) br.cond.sptk ia64_leave_hypervisor // VMX_DOMAIN + ;; + /* + * cr.ifs.v==0 && cr.ifm(ar.pfm)==6 means that HYPERVISOR_suspend + * has been called. (i.e. HVM with PV driver is restored here) + * We need to allocate a dummy RSE stack frame to resume. + */ + alloc r32=ar.pfs, 0, 0, 6, 0 + cmp.eq pSys,pNonSys=r0,r0 // pSys=1,pNonSys=0 + ;; + bsw.0 + ;; + mov r21=r13 // set current + ;; + bsw.1 + ;; + mov r8=r0 + br.cond.sptk.many ia64_leave_hypercall #else .ret8: adds r2=TI_FLAGS+IA64_TASK_SIZE,r13 diff -r 948188bc9fa3 -r debc868e380b xen/arch/ia64/vmx/vmx_init.c --- a/xen/arch/ia64/vmx/vmx_init.c Fri May 09 18:40:58 2008 +0900 +++ b/xen/arch/ia64/vmx/vmx_init.c Fri May 09 18:40:58 2008 +0900 @@ -55,7 +55,6 @@ #include #include #include -#include "entry.h" /* Global flag to identify whether Intel vmx feature is on */ u32 vmx_enabled = 0; @@ -532,10 +531,6 @@ vmx_final_setup_guest(struct vcpu *v) /* Set up guest 's indicator for VTi domain*/ set_bit(ARCH_VMX_DOMAIN, &v->arch.arch_vmx.flags); - /* Initialize pNonSys=1 for the first context switching */ - sw = (struct switch_stack *)vcpu_regs(v) - 1; - sw->pr = (1UL << PRED_NON_SYSCALL); - return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTo7-0002TY-22 for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTol-0007j5-9K; Tue, 20 May 2008 15:31:59 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnw-0007Ey-TS for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:08 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnq-0002zS-Hh for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:06 +0000 X-SBRS: 3.6 X-MesageID: 267634 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267634" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:11 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUBRQ029573 for ; Tue, 20 May 2008 08:30:11 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUTE5032448 for ; Tue, 20 May 2008 08:30:29 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUT1Q032446 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:29 -0700 Message-Id: <200805201530.m4KFUT1Q032446@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:28 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] define VHPT_ENABLED in Rules.mk instead of the header file, vhpt.h. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210148132 -32400 # Node ID f23e7e07bf1d41577ed5fb14cd4135537290785e # Parent 6df8dcf48d9d2400a6cb6f23a2c0c2a47b33b02a [IA64] define VHPT_ENABLED in Rules.mk instead of the header file, vhpt.h. VHPT_ENABLED is defined in vhpt.h, but it is intended for compile time option. Defining in the header file caused that VHPT_ENABLED is undefined in some files resulting in unintentional compilation. Define the macro in Rules.mk resolves it. And minor modifications to remove compilation error/warning. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/Rules.mk | 9 +++++++++ xen/arch/ia64/asm-offsets.c | 2 ++ xen/arch/ia64/xen/domain.c | 3 +-- xen/include/asm-ia64/vhpt.h | 2 -- 4 files changed, 12 insertions(+), 4 deletions(-) diff -r 6df8dcf48d9d -r f23e7e07bf1d xen/arch/ia64/Rules.mk --- a/xen/arch/ia64/Rules.mk Mon May 12 11:24:47 2008 +0900 +++ b/xen/arch/ia64/Rules.mk Wed May 07 17:15:32 2008 +0900 @@ -8,6 +8,7 @@ no_warns ?= n no_warns ?= n vti_debug ?= n vmx_panic ?= n +vhpt_disable ?= n xen_ia64_expose_p2m ?= y xen_ia64_pervcpu_vhpt ?= y xen_ia64_tlb_track ?= y @@ -45,6 +46,9 @@ endif endif ifeq ($(xen_ia64_pervcpu_vhpt),y) CFLAGS += -DCONFIG_XEN_IA64_PERVCPU_VHPT +ifeq ($(vhpt_disable),y) +$(error "both xen_ia64_pervcpu_vhpt=y and vhpt_disable=y are enabled. they can't be enabled simultaneously. disable one of them.") +endif endif ifeq ($(xen_ia64_tlb_track),y) CFLAGS += -DCONFIG_XEN_IA64_TLB_TRACK @@ -57,6 +61,11 @@ endif endif ifeq ($(no_warns),y) CFLAGS += -Wa,--fatal-warnings -Werror -Wno-uninitialized +endif +ifneq ($(vhpt_disable),y) +CFLAGS += -DVHPT_ENABLED=1 +else +CFLAGS += -DVHPT_ENABLED=0 endif LDFLAGS := -g diff -r 6df8dcf48d9d -r f23e7e07bf1d xen/arch/ia64/asm-offsets.c --- a/xen/arch/ia64/asm-offsets.c Mon May 12 11:24:47 2008 +0900 +++ b/xen/arch/ia64/asm-offsets.c Wed May 07 17:15:32 2008 +0900 @@ -254,10 +254,12 @@ void foo(void) DEFINE(IA64_MCA_CPU_RBSTORE_OFFSET, offsetof(struct ia64_mca_cpu, rbstore)); +#if VHPT_ENABLED DEFINE(IA64_VCPU_VHPT_PAGE_OFFSET, offsetof(struct vcpu, arch.vhpt_page)); DEFINE(IA64_VCPU_VHPT_MADDR_OFFSET, offsetof(struct vcpu, arch.vhpt_maddr)); +#endif BLANK(); DEFINE(IA64_MCA_TLB_INFO_SIZE, sizeof(struct ia64_mca_tlb_info)); diff -r 6df8dcf48d9d -r f23e7e07bf1d xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Mon May 12 11:24:47 2008 +0900 +++ b/xen/arch/ia64/xen/domain.c Wed May 07 17:15:32 2008 +0900 @@ -499,10 +499,9 @@ static void vcpu_share_privregs_with_gue int vcpu_late_initialise(struct vcpu *v) { - struct domain *d = v->domain; int rc, order; - if (HAS_PERVCPU_VHPT(d)) { + if (HAS_PERVCPU_VHPT(v->domain)) { rc = pervcpu_vhpt_alloc(v); if (rc != 0) return rc; diff -r 6df8dcf48d9d -r f23e7e07bf1d xen/include/asm-ia64/vhpt.h --- a/xen/include/asm-ia64/vhpt.h Mon May 12 11:24:47 2008 +0900 +++ b/xen/include/asm-ia64/vhpt.h Wed May 07 17:15:32 2008 +0900 @@ -1,7 +1,5 @@ #ifndef ASM_VHPT_H #define ASM_VHPT_H - -#define VHPT_ENABLED 1 /* Size of the VHPT. */ // XXX work around to avoid trigerring xenLinux software lock up detection. _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:24 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:24 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyToC-0002Tc-9P for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:24 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToq-0007ms-ET; Tue, 20 May 2008 15:32:04 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTnx-0007Fj-Lc for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:09 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnp-0002zQ-AV for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:07 +0000 X-SBRS: 3.6 X-MesageID: 267633 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267633" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:10 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUAvq029570 for ; Tue, 20 May 2008 08:30:10 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUSrA032428 for ; Tue, 20 May 2008 08:30:28 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUSvp032427 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:28 -0700 Message-Id: <200805201530.m4KFUSvp032427@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:27 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] cleanup: VTLB_PTE_IO_BIT is not used X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210559087 -32400 # Node ID 6df8dcf48d9d2400a6cb6f23a2c0c2a47b33b02a # Parent debc868e380b4fe40d50772b6e09cd96ba88d085 [IA64] cleanup: VTLB_PTE_IO_BIT is not used VTLB_PTE_IO_BIT is not used any more. Signed-off-by: Kouya Shimura --- xen/arch/ia64/vmx/vmmu.c | 5 +---- xen/include/asm-ia64/vmmu.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff -r debc868e380b -r 6df8dcf48d9d xen/arch/ia64/vmx/vmmu.c --- a/xen/arch/ia64/vmx/vmmu.c Fri May 09 18:40:58 2008 +0900 +++ b/xen/arch/ia64/vmx/vmmu.c Mon May 12 11:24:47 2008 +0900 @@ -282,7 +282,7 @@ IA64FAULT vmx_vcpu_itr_d(VCPU *vcpu, u64 #ifdef VTLB_DEBUG int index; #endif - u64 gpfn, gpte; + u64 gpfn; u64 ps, va, rid; thash_data_t * p_dtr; @@ -313,9 +313,6 @@ IA64FAULT vmx_vcpu_itr_d(VCPU *vcpu, u64 if (ps != _PAGE_SIZE_16M) thash_purge_entries(vcpu, va, ps); gpfn = (pte & _PAGE_PPN_MASK)>> PAGE_SHIFT; - gpte = lookup_domain_mpa(vcpu->domain, gpfn, NULL); - if (gpte & _PAGE_IO) - pte |= VTLB_PTE_IO; vcpu_get_rr(vcpu, va, &rid); rid &= RR_RID_MASK; p_dtr = (thash_data_t *)&vcpu->arch.dtrs[slot]; diff -r debc868e380b -r 6df8dcf48d9d xen/include/asm-ia64/vmmu.h --- a/xen/include/asm-ia64/vmmu.h Fri May 09 18:40:58 2008 +0900 +++ b/xen/include/asm-ia64/vmmu.h Mon May 12 11:24:47 2008 +0900 @@ -46,8 +46,6 @@ enum { #endif /* __ASSEMBLY__ */ #define VTLB_PTE_P_BIT 0 -#define VTLB_PTE_IO_BIT 60 -#define VTLB_PTE_IO (1UL< Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:28 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyToG-0002Tf-K7 for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:28 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTou-0007qM-Qy; Tue, 20 May 2008 15:32:08 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTo0-0007Hx-W5 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:13 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnt-0002zM-FG for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:10 +0000 X-SBRS: 3.6 X-MesageID: 267635 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267635" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:12 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUCH2029576 for ; Tue, 20 May 2008 08:30:12 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUUb2032483 for ; Tue, 20 May 2008 08:30:30 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUUBp032482 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:30 -0700 Message-Id: <200805201530.m4KFUUBp032482@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:29 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] warning fix of dom_fw_dom0.c X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1209715292 -32400 # Node ID 705e203ba9056df244c308191f04246161cb676d # Parent f23e7e07bf1d41577ed5fb14cd4135537290785e [IA64] warning fix of dom_fw_dom0.c dom_fw_dom0.c: In function 'complete_dom0_memmap': dom_fw_dom0.c:461: warning: unused variable 'flags' dom_fw_dom0.c:460: warning: unused variable 'mpaddr' Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/dom_fw_dom0.c | 2 -- 1 files changed, 2 deletions(-) diff -r f23e7e07bf1d -r 705e203ba905 xen/arch/ia64/xen/dom_fw_dom0.c --- a/xen/arch/ia64/xen/dom_fw_dom0.c Wed May 07 17:15:32 2008 +0900 +++ b/xen/arch/ia64/xen/dom_fw_dom0.c Fri May 02 17:01:32 2008 +0900 @@ -457,8 +457,6 @@ complete_dom0_memmap(struct domain *d, s u64 start = md->phys_addr; u64 size = md->num_pages << EFI_PAGE_SHIFT; u64 end = start + size; - u64 mpaddr; - unsigned long flags; switch (md->type) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:33 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:33 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyToL-0002Ti-2c for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:33 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToz-0007u9-7j; Tue, 20 May 2008 15:32:13 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTo1-0007IH-Us for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:13 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnv-0002zS-Nm for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:11 +0000 X-SBRS: 3.6 X-MesageID: 267636 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267636" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:13 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUDjZ029579 for ; Tue, 20 May 2008 08:30:13 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUVCW032502 for ; Tue, 20 May 2008 08:30:31 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUVQB032501 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:31 -0700 Message-Id: <200805201530.m4KFUVQB032501@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:30 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] remove warning in vmx_final_setup_guest() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210828718 -32400 # Node ID 24cbbd5e31551c152cc8ae7e69e85d75857c2430 # Parent 705e203ba9056df244c308191f04246161cb676d [IA64] remove warning in vmx_final_setup_guest() This patch removes the warning in vmx_final_setup_guest() > vmx_init.c:497: warning: unused variable 'sw' Signed-off-by: Isaku Yamahata --- xen/arch/ia64/vmx/vmx_init.c | 1 - 1 files changed, 1 deletion(-) diff -r 705e203ba905 -r 24cbbd5e3155 xen/arch/ia64/vmx/vmx_init.c --- a/xen/arch/ia64/vmx/vmx_init.c Fri May 02 17:01:32 2008 +0900 +++ b/xen/arch/ia64/vmx/vmx_init.c Thu May 15 14:18:38 2008 +0900 @@ -494,7 +494,6 @@ vmx_final_setup_guest(struct vcpu *v) { vpd_t *vpd; int rc; - struct switch_stack *sw; vpd = alloc_vpd(); ASSERT(vpd); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:37 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:37 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyToO-0002Tm-LP for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:36 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTp2-0007xV-S0; Tue, 20 May 2008 15:32:16 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTo3-0007Iw-Cm for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:15 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnw-0002zQ-42 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:13 +0000 X-SBRS: 3.6 X-MesageID: 267637 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267637" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:15 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUFos029582 for ; Tue, 20 May 2008 08:30:15 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUXlu032522 for ; Tue, 20 May 2008 08:30:33 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUXG2032521 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:33 -0700 Message-Id: <200805201530.m4KFUXG2032521@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:32 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] remove warnings in replace_grant_host_mapping() X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210828718 -32400 # Node ID f0737df2dee1150a19283fffb26c57e4b06f1874 # Parent 24cbbd5e31551c152cc8ae7e69e85d75857c2430 [IA64] remove warnings in replace_grant_host_mapping() This patch removes warnings in replace_grant_host_mapping(). > mm.c: In function 'replace_grant_host_mapping': > mm.c:2194: warning: 'new_page_mfn' may be used uninitialized in this function > mm.c:2190: warning: 'old_pte.pte' may be used uninitialized in this function > mm.c:2188: warning: 'cur_pte.pte' may be used uninitialized in this function Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/mm.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff -r 24cbbd5e3155 -r f0737df2dee1 xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Thu May 15 14:18:38 2008 +0900 +++ b/xen/arch/ia64/xen/mm.c Thu May 15 14:18:38 2008 +0900 @@ -2191,7 +2191,7 @@ replace_grant_host_mapping(unsigned long struct page_info* page = mfn_to_page(mfn); struct page_info* new_page = NULL; volatile pte_t* new_page_pte = NULL; - unsigned long new_page_mfn; + unsigned long new_page_mfn = INVALID_MFN; if (new_gpaddr) { new_page_pte = lookup_noalloc_domain_pte_none(d, new_gpaddr); @@ -2211,7 +2211,7 @@ replace_grant_host_mapping(unsigned long "new_gpaddr 0x%lx mfn 0x%lx\n", __func__, gpaddr, mfn, new_gpaddr, new_page_mfn); new_page = NULL; /* prevent domain_put_page() */ - goto out; + return GNTST_general_error; } /* @@ -2228,7 +2228,7 @@ replace_grant_host_mapping(unsigned long "new_gpaddr 0x%lx mfn 0x%lx\n", __func__, gpaddr, mfn, new_gpaddr, new_page_mfn); - goto out; + return GNTST_general_error; } } domain_put_page(d, new_gpaddr, new_page_pte, new_pte, 0); @@ -2246,7 +2246,7 @@ replace_grant_host_mapping(unsigned long if (pte == NULL) { gdprintk(XENLOG_INFO, "%s: gpaddr 0x%lx mfn 0x%lx\n", __func__, gpaddr, mfn); - goto out; + return GNTST_general_error; } again: @@ -2256,10 +2256,11 @@ replace_grant_host_mapping(unsigned long (page_get_owner(page) == d && get_gpfn_from_mfn(mfn) == gpfn)) { gdprintk(XENLOG_INFO, "%s: gpaddr 0x%lx mfn 0x%lx cur_pte 0x%lx\n", __func__, gpaddr, mfn, pte_val(cur_pte)); - goto out; + return GNTST_general_error; } if (new_page) { + BUG_ON(new_page_mfn == INVALID_MFN); set_gpfn_from_mfn(new_page_mfn, gpfn); /* smp_mb() isn't needed because assign_domain_pge_cmpxchg_rel() has release semantics. */ @@ -2270,6 +2271,7 @@ replace_grant_host_mapping(unsigned long goto again; } if (new_page) { + BUG_ON(new_page_mfn == INVALID_MFN); set_gpfn_from_mfn(new_page_mfn, INVALID_M2P_ENTRY); domain_put_page(d, new_gpaddr, new_page_pte, new_pte, 1); } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:41 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:42 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyToT-0002Tp-Jh for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:41 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTp7-00081g-PY; Tue, 20 May 2008 15:32:21 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTo9-0007LL-L3 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:21 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTnz-0002zM-ER for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:17 +0000 X-SBRS: 3.6 X-MesageID: 267638 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267638" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:16 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUG39029585 for ; Tue, 20 May 2008 08:30:16 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUYZP032540 for ; Tue, 20 May 2008 08:30:34 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUYNC032539 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:34 -0700 Message-Id: <200805201530.m4KFUYNC032539@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:33 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] fix sal emulation. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210828718 -32400 # Node ID b03e24f9c1d85e50fcd9cb07d8a517e7f6df2b9a # Parent f0737df2dee1150a19283fffb26c57e4b06f1874 [IA64] fix sal emulation. fix sal emulation, SAL_SET_VECTORS, SAL_MC_SET_PARAMS. It allowed any domains to change system wide state. But only dom0 is able to change it. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/fw_emul.c | 43 ++++++++++++++++++++++++++++++++----------- 1 files changed, 32 insertions(+), 11 deletions(-) diff -r f0737df2dee1 -r b03e24f9c1d8 xen/arch/ia64/xen/fw_emul.c --- a/xen/arch/ia64/xen/fw_emul.c Thu May 15 14:18:38 2008 +0900 +++ b/xen/arch/ia64/xen/fw_emul.c Thu May 15 14:18:38 2008 +0900 @@ -200,10 +200,15 @@ sal_emulator (long index, unsigned long d->arch.sal_data->boot_rdv_r1 = in3; } } - else - { - if (in1 > sizeof(sal_vectors)/sizeof(sal_vectors[0])-1) - BUG(); + else if (current->domain == dom0) { + if (in1 > + sizeof(sal_vectors)/sizeof(sal_vectors[0])-1) { + gdprintk(XENLOG_DEBUG, + "SAL_SET_VECTORS invalid in1 %ld\n", + in1); + status = -2; + break; + } sal_vectors[in1].vector_type = in1; sal_vectors[in1].handler_addr1 = in2; sal_vectors[in1].gp1 = in3; @@ -211,6 +216,10 @@ sal_emulator (long index, unsigned long sal_vectors[in1].handler_addr2 = in5; sal_vectors[in1].gp2 = in6; sal_vectors[in1].handler_len2 = in7; + } else { + gdprintk(XENLOG_DEBUG, "NON-PRIV DOMAIN CALLED " + "SAL_SET_VECTORS %ld\n", in1); + status = -2; } break; case SAL_GET_STATE_INFO: @@ -352,13 +361,25 @@ sal_emulator (long index, unsigned long printk("*** CALLED SAL_MC_RENDEZ. IGNORED...\n"); break; case SAL_MC_SET_PARAMS: - if (in1 > sizeof(sal_mc_params)/sizeof(sal_mc_params[0])) - BUG(); - sal_mc_params[in1].param_type = in1; - sal_mc_params[in1].i_or_m = in2; - sal_mc_params[in1].i_or_m_val = in3; - sal_mc_params[in1].timeout = in4; - sal_mc_params[in1].rz_always = in5; + if (current->domain == dom0) { + if (in1 > + sizeof(sal_mc_params) / sizeof(sal_mc_params[0])) { + gdprintk(XENLOG_DEBUG, + "SAL_MC_SET_PARAMS invalid in1 %ld\n", + in1); + status = -2; + break; + } + sal_mc_params[in1].param_type = in1; + sal_mc_params[in1].i_or_m = in2; + sal_mc_params[in1].i_or_m_val = in3; + sal_mc_params[in1].timeout = in4; + sal_mc_params[in1].rz_always = in5; + } else { + gdprintk(XENLOG_DEBUG, + "*** CALLED SAL_MC_SET_PARAMS. IGNORED...\n"); + status = -1; /* not implemented */ + } break; case SAL_CACHE_FLUSH: if (1) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:46 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:46 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyToX-0002Ts-O0 for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:46 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTpB-00085E-V6; Tue, 20 May 2008 15:32:26 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToA-0007Lq-Re for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:22 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTo0-0002zS-Ca for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:20 +0000 X-SBRS: 3.6 X-MesageID: 267639 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267639" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:17 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUHPq029588 for ; Tue, 20 May 2008 08:30:17 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUZUf032557 for ; Tue, 20 May 2008 08:30:35 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUZAO032556 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:35 -0700 Message-Id: <200805201530.m4KFUZAO032556@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:34 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] Build new infrastructure for fast fault handling path. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210830828 -32400 # Node ID ef290f39ae6b8e3c58c224ec469ab09522cc7e0b # Parent b03e24f9c1d85e50fcd9cb07d8a517e7f6df2b9a [IA64] Build new infrastructure for fast fault handling path. 1. use jump table to dispatch virtualization faults. 2. for virtualization faults, handler is executed with psr.i=0, psr.ic=0, psr.bn=0. less context switch. 3. use register stack instead of memory stack to switch context. 4. Use C code to handle faults as possible, to reduce maintanance efforts, remove assembly handlers for rsm , ssm, mov to psr, mov to rr. 5. add fast path C handler for rsm, ssm, mov to psr, rfi. Signed-off-by: Anthony Xu --- xen/arch/ia64/asm-offsets.c | 5 xen/arch/ia64/vmx/optvfault.S | 1196 +++++++++++++++++++----------------- xen/arch/ia64/vmx/vmx_ivt.S | 39 - xen/arch/ia64/vmx/vmx_phy_mode.c | 27 xen/arch/ia64/vmx/vmx_vcpu.c | 162 ++++ xen/include/asm-ia64/vmx_phy_mode.h | 3 xen/include/asm-ia64/vmx_vcpu.h | 2 7 files changed, 862 insertions(+), 572 deletions(-) diff -r b03e24f9c1d8 -r ef290f39ae6b xen/arch/ia64/asm-offsets.c --- a/xen/arch/ia64/asm-offsets.c Thu May 15 14:18:38 2008 +0900 +++ b/xen/arch/ia64/asm-offsets.c Thu May 15 14:53:48 2008 +0900 @@ -204,6 +204,11 @@ void foo(void) DEFINE(IA64_VPD_BASE_OFFSET, offsetof (struct vcpu, arch.privregs)); DEFINE(IA64_VPD_VIFS_OFFSET, offsetof (mapped_regs_t, ifs)); + DEFINE(IA64_VPD_VHPI_OFFSET, offsetof (mapped_regs_t, vhpi)); + DEFINE(IA64_VPD_VB1REG_OFFSET, offsetof (mapped_regs_t, bank1_regs[0])); + DEFINE(IA64_VPD_VB0REG_OFFSET, offsetof (mapped_regs_t, bank0_regs[0])); + DEFINE(IA64_VPD_VB1NAT_OFFSET, offsetof (mapped_regs_t, vnat)); + DEFINE(IA64_VPD_VB0NAT_OFFSET, offsetof (mapped_regs_t, vbnat)); DEFINE(IA64_VLSAPIC_INSVC_BASE_OFFSET, offsetof (struct vcpu, arch.insvc[0])); DEFINE(IA64_VPD_VPTA_OFFSET, offsetof (struct mapped_regs, pta)); DEFINE(XXX_THASH_SIZE, sizeof (thash_data_t)); diff -r b03e24f9c1d8 -r ef290f39ae6b xen/arch/ia64/vmx/optvfault.S --- a/xen/arch/ia64/vmx/optvfault.S Thu May 15 14:18:38 2008 +0900 +++ b/xen/arch/ia64/vmx/optvfault.S Thu May 15 14:53:48 2008 +0900 @@ -3,10 +3,10 @@ * optimize virtualization fault handler * * Copyright (C) 2006 Intel Co - * Xuefei Xu (Anthony Xu) + * Xuefei Xu (Anthony Xu) */ -#include +#include #include #include #include @@ -20,26 +20,230 @@ #include #include #include - -#define ACCE_MOV_FROM_AR -#define ACCE_MOV_FROM_RR -#define ACCE_MOV_TO_RR -#define ACCE_RSM -#define ACCE_SSM -#define ACCE_MOV_TO_PSR -#define ACCE_THASH +#include "entry.h" + +// r21 : current +// r23 : b0 +// r31 : pr + +#define VMX_VIRT_SAVE \ + mov r27=ar.rsc; /* M */ \ + ;; \ + cover; /* B;; (or nothing) */ \ + ;; \ + /* switch from user to kernel RBS: */ \ + invala; /* M */ \ + ;; \ + mov ar.rsc=0; /* set enforced lazy mode */ \ + ;; \ + mov.m r26=ar.rnat; \ + movl r28=IA64_RBS_OFFSET; /* compute base of RBS */ \ + ;; \ + mov r22=ar.bspstore; /* save ar.bspstore */ \ + add r28=r28,r21; \ + ;; \ + mov ar.bspstore=r28; /* switch to kernel RBS */ \ + ;; \ + mov r18=ar.bsp; \ + mov ar.rsc=0x3; /* set eager mode */ \ + ;; \ + alloc r32=ar.pfs,24,0,3,0 /* save pfs */ \ + ;; \ + sub r18=r18,r28; /* r18=RSE.ndirty*8 */ \ + ;; \ + shl r33=r18,16; /* save loadrs */ \ + mov r35=b6; /* save b6 */ \ + mov r36=b7; /* save b7 */ \ + mov r37=ar.csd; /* save ar.csd */ \ + mov r38=ar.ssd; /* save ar.ssd */ \ + mov r39=r8; /* save r8 */ \ + mov r40=r9; /* save r9 */ \ + mov r41=r10; /* save r10 */ \ + mov r42=r11; /* save r11 */ \ + mov r43=r27; /* save ar.rsc */ \ + mov r44=r26; /* save ar.rnat */ \ + mov r45=r22; /* save ar.bspstore */ \ + mov r46=r31; /* save pr */ \ + mov r47=r23; /* save b0 */ \ + mov r48=r1; /* save r1 */ \ + mov r49=r12; /* save r12 */ \ + mov r50=r13; /* save r13 */ \ + mov r51=r15; /* save r15 */ \ + mov r52=r14; /* save r14 */ \ + mov r53=r2; /* save r2 */ \ + mov r54=r3; /* save r3 */ \ + mov r34=ar.ccv; /* save ar.ccv */ \ + ;; \ + movl r1=__gp; \ + movl r29=IA64_STK_OFFSET-IA64_PT_REGS_SIZE-16; \ + ;; \ + add r12=r29,r21; /* compute base of memory stack */ \ + mov r13=r21; \ + ;; \ +{ .mii; /* call vps sync read */ \ + add r25=IA64_VPD_BASE_OFFSET, r21; \ + nop 0x0; \ + mov r24=ip; \ + ;; \ +}; \ +{ .mmb; \ + add r24 = 0x20, r24; \ + ld8 r25=[r25]; /* read vpd base */ \ + br.cond.sptk vmx_vps_sync_read; /* call the service */ \ + ;; \ +}; + + +ENTRY(ia64_leave_hypervisor_virt) + invala /* M */ + ;; + mov r21=r13 /* get current */ + mov b6=r35 /* restore b6 */ + mov b7=r36 /* restore b7 */ + mov ar.csd=r37 /* restore ar.csd */ + mov ar.ssd=r38 /* restore ar.ssd */ + mov r8=r39 /* restore r8 */ + mov r9=r40 /* restore r9 */ + mov r10=r41 /* restore r10 */ + mov r11=r42 /* restore r11 */ + mov ar.pfs=r32 /* restore ar.pfs */ + mov r27=r43 /* restore ar.rsc */ + mov r26=r44 /* restore ar.rnat */ + mov r25=r45 /* restore ar.bspstore */ + mov r23=r46 /* restore predicates */ + mov r22=r47 /* restore b0 */ + mov r1=r48 /* restore r1 */ + mov r12=r49 /* restore r12 */ + mov r13=r50 /* restore r13 */ + mov r15=r51 /* restore r15 */ + mov r14=r52 /* restore r14 */ + mov r2=r53 /* restore r2 */ + mov r3=r54 /* restore r3 */ + mov ar.ccv=r34 /* restore ar.ccv */ + mov ar.rsc=r33 /* load ar.rsc to be used for "loadrs" */ + ;; + alloc r16=ar.pfs,0,0,0,0 /* drop current register frame */ + ;; + loadrs + ;; + mov ar.bspstore=r25 + ;; + mov ar.rnat=r26 + ;; + mov ar.rsc=r27 + adds r18=IA64_VPD_BASE_OFFSET,r21 + ;; + ld8 r25=[r18] // load vpd + mov r17=r0 + ;; +//vsa_sync_write_start + ;; + movl r24=ia64_leave_hypervisor_virt_1 // calculate return address + br.cond.sptk vmx_vps_sync_write // call the service + ;; +ia64_leave_hypervisor_virt_1: + mov r24=r22 + mov r31=r23 + br.cond.sptk vmx_resume_to_guest +END(ia64_leave_hypervisor_virt) + + // Inputs are: r21 (= current), r24 (= cause), r25 (= insn), r31 (=saved pr) + +#define BACK_TO_SLOW_PATH \ +{; \ + nop.m 0x0; \ + mov b0=r23; \ + br.many vmx_virtualization_fault_back; \ +}; \ + +GLOBAL_ENTRY(virtualization_fault_table) + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH +{ /* Entry 3 */ + cmp.eq p2,p0=r0,r0 + mov b0=r23 + br.many vmx_asm_mov_from_ar +} + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH +{ /* Entry 6 */ + cmp.eq p2,p0=r0,r0 + mov b0=r23 + br.many vmx_asm_mov_to_psr +} + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH +{ /* Entry 10 */ + cmp.eq p2,p0=r0,r0 + mov b0=r23 + br.many vmx_asm_mov_to_rr +} + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH +{ /* Entry 18 */ + cmp.eq p2,p0=r0,r0 + mov b0=r23 + br.many vmx_asm_mov_from_rr +} + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH +{ /* Entry 24 */ + cmp.eq p2,p0=r0,r0 + mov b0=r23 + br.many vmx_asm_ssm +} +{ /* Entry 25 */ + cmp.eq p2,p0=r0,r0 + mov b0=r23 + br.many vmx_asm_rsm +} + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH +{ /* Entry 31 */ + cmp.eq p2,p0=r0,r0 + mov b0=r23 + br.many vmx_asm_thash +} + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH +{ /* Entry 37 */ + cmp.ne p2,p0=r0,r0 + mov b0=r23 + br.many vmx_asm_rfi +} + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH + BACK_TO_SLOW_PATH +END(virtualization_fault_table) + ENTRY(vmx_dummy_function) br.sptk.many vmx_dummy_function END(vmx_dummy_function) /* - * Inputs: - * r24 : return address - * r25 : vpd - * r29 : scratch + * Inputs: + * r24 : return address + * r25 : vpd + * r29 : scratch * */ GLOBAL_ENTRY(vmx_vps_sync_read) @@ -50,11 +254,10 @@ END(vmx_vps_sync_read) END(vmx_vps_sync_read) /* - * Inputs: - * r24 : return address - * r25 : vpd - * r29 : scratch - * + * Inputs: + * r24 : return address + * r25 : vpd + * r29 : scratch */ GLOBAL_ENTRY(vmx_vps_sync_write) movl r29 = vmx_dummy_function @@ -64,11 +267,10 @@ END(vmx_vps_sync_write) END(vmx_vps_sync_write) /* - * Inputs: - * r23 : pr - * r24 : guest b0 - * r25 : vpd - * + * Inputs: + * r23 : pr + * r24 : guest b0 + * r25 : vpd */ GLOBAL_ENTRY(vmx_vps_resume_normal) movl r29 = vmx_dummy_function @@ -79,11 +281,11 @@ END(vmx_vps_resume_normal) END(vmx_vps_resume_normal) /* - * Inputs: - * r23 : pr - * r24 : guest b0 - * r25 : vpd - * r17 : isr + * Inputs: + * r23 : pr + * r24 : guest b0 + * r25 : vpd + * r17 : isr */ GLOBAL_ENTRY(vmx_vps_resume_handler) movl r29 = vmx_dummy_function @@ -97,12 +299,203 @@ GLOBAL_ENTRY(vmx_vps_resume_handler) br.sptk.many b0 END(vmx_vps_resume_handler) +//r13 ->vcpu +//call with psr.bn = 0 +GLOBAL_ENTRY(vmx_asm_bsw0) + mov r15=ar.unat + ;; + adds r14=IA64_VPD_BASE_OFFSET,r13 + ;; + ld8 r14=[r14] + bsw.1 + ;; + adds r2=IA64_VPD_VB1REG_OFFSET, r14 + adds r3=IA64_VPD_VB1REG_OFFSET+8, r14 + ;; + .mem.offset 0,0; st8.spill [r2]=r16,16 + .mem.offset 8,0; st8.spill [r3]=r17,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r18,16 + .mem.offset 8,0; st8.spill [r3]=r19,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r20,16 + .mem.offset 8,0; st8.spill [r3]=r21,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r22,16 + .mem.offset 8,0; st8.spill [r3]=r23,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r24,16 + .mem.offset 8,0; st8.spill [r3]=r25,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r26,16 + .mem.offset 8,0; st8.spill [r3]=r27,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r28,16 + .mem.offset 8,0; st8.spill [r3]=r29,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r30,16 + .mem.offset 8,0; st8.spill [r3]=r31,16 + ;; + mov r9=ar.unat + adds r8=IA64_VPD_VB1NAT_OFFSET, r14 + ;; + st8 [r8]=r9 + adds r8=IA64_VPD_VB0NAT_OFFSET, r14 + ;; + ld8 r9=[r8] + adds r2= IA64_VPD_VB0REG_OFFSET, r14 + adds r3= IA64_VPD_VB0REG_OFFSET+8, r14 + ;; + mov ar.unat=r9 + ;; + ld8.fill r16=[r2],16 + ld8.fill r17=[r3],16 + ;; + ld8.fill r18=[r2],16 + ld8.fill r19=[r3],16 + ;; + ld8.fill r20=[r2],16 + ld8.fill r21=[r3],16 + ;; + ld8.fill r22=[r2],16 + ld8.fill r23=[r3],16 + ;; + ld8.fill r24=[r2],16 + ld8.fill r25=[r3],16 + ;; + ld8.fill r26=[r2],16 + ld8.fill r27=[r3],16 + ;; + ld8.fill r28=[r2],16 + ld8.fill r29=[r3],16 + ;; + ld8.fill r30=[r2],16 + ld8.fill r31=[r3],16 + ;; + mov ar.unat=r15 + ;; + bsw.0 + ;; + br.ret.sptk.many b0 +END(vmx_asm_bsw0) + +//r13 ->vcpu +//call with psr.bn = 0 +GLOBAL_ENTRY(vmx_asm_bsw1) + mov r15=ar.unat + ;; + adds r14=IA64_VPD_BASE_OFFSET,r13 + ;; + ld8 r14=[r14] + bsw.1 + ;; + adds r2=IA64_VPD_VB0REG_OFFSET, r14 + adds r3=IA64_VPD_VB0REG_OFFSET+8, r14 + ;; + .mem.offset 0,0; st8.spill [r2]=r16,16 + .mem.offset 8,0; st8.spill [r3]=r17,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r18,16 + .mem.offset 8,0; st8.spill [r3]=r19,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r20,16 + .mem.offset 8,0; st8.spill [r3]=r21,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r22,16 + .mem.offset 8,0; st8.spill [r3]=r23,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r24,16 + .mem.offset 8,0; st8.spill [r3]=r25,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r26,16 + .mem.offset 8,0; st8.spill [r3]=r27,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r28,16 + .mem.offset 8,0; st8.spill [r3]=r29,16 + ;; + .mem.offset 0,0; st8.spill [r2]=r30,16 + .mem.offset 8,0; st8.spill [r3]=r31,16 + ;; + mov r9=ar.unat + adds r8=IA64_VPD_VB0NAT_OFFSET, r14 + ;; + st8 [r8]=r9 + adds r8=IA64_VPD_VB1NAT_OFFSET, r14 + ;; + ld8 r9=[r8] + adds r2=IA64_VPD_VB1REG_OFFSET, r14 + adds r3=IA64_VPD_VB1REG_OFFSET+8, r14 + ;; + mov ar.unat=r9 + ;; + ld8.fill r16=[r2],16 + ld8.fill r17=[r3],16 + ;; + ld8.fill r18=[r2],16 + ld8.fill r19=[r3],16 + ;; + ld8.fill r20=[r2],16 + ld8.fill r21=[r3],16 + ;; + ld8.fill r22=[r2],16 + ld8.fill r23=[r3],16 + ;; + ld8.fill r24=[r2],16 + ld8.fill r25=[r3],16 + ;; + ld8.fill r26=[r2],16 + ld8.fill r27=[r3],16 + ;; + ld8.fill r28=[r2],16 + ld8.fill r29=[r3],16 + ;; + ld8.fill r30=[r2],16 + ld8.fill r31=[r3],16 + ;; + mov ar.unat=r15 + ;; + bsw.0 + ;; + br.ret.sptk.many b0 +END(vmx_asm_bsw1) + + +// rfi +ENTRY(vmx_asm_rfi) + adds r18=IA64_VPD_BASE_OFFSET,r21 + ;; + ld8 r18=[r18] + ;; + adds r26=IA64_VPD_VIFS_OFFSET,r18 + ;; + ld8 r26=[r26] + ;; + tbit.z p6,p0=r26,63 + (p6) br.cond.dptk.few vmx_asm_rfi_1 + ;; + //if vifs.v=1 desert current register frame + alloc r27=ar.pfs,0,0,0,0 + ;; +vmx_asm_rfi_1: + adds r26=IA64_VPD_VHPI_OFFSET,r18 + ;; + ld8 r26=[r26] + ;; + cmp.ne p6,p0=r26,r0 + (p6) br.cond.dpnt.many vmx_virtualization_fault_back + ;; + VMX_VIRT_SAVE + ;; + mov out0=r21 + movl r14=ia64_leave_hypervisor_virt + ;; + mov rp=r14 + br.call.sptk.many b6=vmx_vcpu_rfi_fast +END(vmx_asm_rfi) + //mov r1=ar3 (only itc is virtualized) -GLOBAL_ENTRY(vmx_asm_mov_from_ar) -#ifndef ACCE_MOV_FROM_AR - br.many vmx_virtualization_fault_back -#endif +ENTRY(vmx_asm_mov_from_ar) add r18=VCPU_VTM_OFFSET_OFS,r21 add r16=VCPU_VTM_LAST_ITC_OFS,r21 extr.u r17=r25,6,7 @@ -127,10 +520,7 @@ END(vmx_asm_mov_from_ar) // mov r1=rr[r3] -GLOBAL_ENTRY(vmx_asm_mov_from_rr) -#ifndef ACCE_MOV_FROM_RR - br.many vmx_virtualization_fault_back -#endif +ENTRY(vmx_asm_mov_from_rr) extr.u r16=r25,20,7 extr.u r17=r25,6,7 movl r20=asm_mov_from_reg @@ -142,8 +532,8 @@ GLOBAL_ENTRY(vmx_asm_mov_from_rr) add r27=VCPU_VRR0_OFS,r21 mov b0=r16 br.many b0 - ;; -vmx_asm_mov_from_rr_back_1: + ;; +vmx_asm_mov_from_rr_back_1: adds r30=vmx_resume_to_guest-asm_mov_from_reg,r20 adds r22=asm_mov_to_reg-asm_mov_from_reg,r20 shr.u r26=r19,61 @@ -158,475 +548,204 @@ END(vmx_asm_mov_from_rr) // mov rr[r3]=r2 -GLOBAL_ENTRY(vmx_asm_mov_to_rr) -#ifndef ACCE_MOV_TO_RR - br.many vmx_virtualization_fault_back -#endif - add r22=IA64_VCPU_RID_BITS_OFFSET,r21 - extr.u r16=r25,20,7 // r3 - extr.u r17=r25,13,7 // r2 - ;; +ENTRY(vmx_asm_mov_to_rr) + extr.u r16=r25,20,7 // r3 + extr.u r17=r25,13,7 // r2 movl r20=asm_mov_from_reg ;; adds r30=vmx_asm_mov_to_rr_back_1-asm_mov_from_reg,r20 - shladd r16=r16,4,r20 // get r3 - mov r18=b0 // save b0 - ;; - add r27=VCPU_VRR0_OFS,r21 + shladd r16=r16,4,r20 // get r3 + ;; mov b0=r16 br.many b0 - ;; + ;; vmx_asm_mov_to_rr_back_1: adds r30=vmx_asm_mov_to_rr_back_2-asm_mov_from_reg,r20 - shr.u r23=r19,61 // get RR # - shladd r17=r17,4,r20 // get r2 + shr.u r16=r19,61 // get RR # ;; //if rr7, go back - cmp.eq p6,p0=7,r23 - mov b0=r18 // restore b0 + cmp.eq p6,p0=7,r16 + mov b0=r23// restore b0 (p6) br.cond.dpnt.many vmx_virtualization_fault_back ;; - mov r28=r19 // save r3 + mov r16=r19 + shladd r17=r17,4,r20 // get r2 + ;; mov b0=r17 br.many b0 -vmx_asm_mov_to_rr_back_2: - adds r30=vmx_resume_to_guest-asm_mov_from_reg,r20 - shladd r27=r23,3,r27 // address of VRR - ;; - ld1 r22=[r22] // Load rid_bits from domain - mov b0=r18 // restore b0 - adds r16=IA64_VCPU_STARTING_RID_OFFSET,r21 - ;; - ld4 r16=[r16] // load starting_rid - extr.u r17=r19,8,24 // Extract RID - ;; - shr r17=r17,r22 // Shift out used bits - shl r16=r16,8 - ;; - add r20=r19,r16 - cmp.ne p6,p0=0,r17 // If reserved RID bits are set, use C fall back. +vmx_asm_mov_to_rr_back_2: + mov r17=r19 // get value + ;; + // if invalid value , go back + adds r26=IA64_VCPU_RID_BITS_OFFSET,r21 + mov r27=r0 + ;; + ld1 r27=[r26] + ;; + shr r19=r19,r27 + ;; + cmp.ne p6,p0=r19,r0 + mov b0=r23// restore b0 (p6) br.cond.dpnt.many vmx_virtualization_fault_back - ;; //mangling rid 1 and 3 - extr.u r16=r20,8,8 - extr.u r17=r20,24,8 - mov r24=r18 // saved b0 for resume - ;; - extr.u r18=r20,2,6 // page size - dep r20=r16,r20,24,8 - mov b0=r30 - ;; - dep r20=r17,r20,8,8 - ;; //set ve 1 - dep r20=-1,r20,0,1 - // If ps > PAGE_SHIFT, use PAGE_SHIFT - cmp.lt p6,p0=PAGE_SHIFT,r18 - ;; - (p6) mov r18=PAGE_SHIFT - ;; - (p6) dep r20=r18,r20,2,6 - ;; - st8 [r27]=r19 // Write to vrr. - // Write to save_rr if rr=0 or rr=4. - cmp.eq p6,p0=0,r23 - ;; - cmp.eq.or p6,p0=4,r23 - ;; - adds r16=IA64_VCPU_MMU_MODE_OFFSET,r21 - (p6) adds r17=IA64_VCPU_META_SAVED_RR0_OFFSET,r21 - ;; - ld1 r16=[r16] - cmp.eq p7,p0=r0,r0 - (p6) shladd r17=r23,1,r17 - ;; - (p6) st8 [r17]=r20 - (p6) cmp.eq p7,p0=VMX_MMU_VIRTUAL,r16 // Set physical rr if in virt mode - ;; - (p7) mov rr[r28]=r20 - br.many b0 + ;; + VMX_VIRT_SAVE + ;; + mov out0=r21 + mov out1=r16 + mov out2=r17 + movl r14=ia64_leave_hypervisor_virt + ;; + mov rp=r14 + br.call.sptk.many b6=vmx_vcpu_set_rr_fast END(vmx_asm_mov_to_rr) -//rsm -GLOBAL_ENTRY(vmx_asm_rsm) -#ifndef ACCE_RSM - br.many vmx_virtualization_fault_back -#endif - mov r23=r31 - add r16=IA64_VPD_BASE_OFFSET,r21 +//rsm 25 +ENTRY(vmx_asm_rsm) extr.u r26=r25,6,21 // Imm21 extr.u r27=r25,31,2 // I2d ;; - ld8 r16=[r16] extr.u r28=r25,36,1 // I dep r26=r27,r26,21,2 ;; - add r17=VPD_VPSR_START_OFFSET,r16 //r18 is imm24 - dep r18=r28,r26,23,1 - ;; - //sync read - mov r25=r16 - movl r24=vmx_asm_rsm_sync_read_return - mov r20=b0 - br.sptk.many vmx_vps_sync_read - ;; -vmx_asm_rsm_sync_read_return: - ld8 r26=[r17] - // xenoprof - // Don't change mPSR.pp. - // It is manipulated by xenoprof. - movl r28=IA64_PSR_IC+IA64_PSR_I+IA64_PSR_DT+IA64_PSR_SI+IA64_PSR_PP - - sub r27=-1,r18 // ~imm24 - ;; - or r28=r27,r28 // Keep IC,I,DT,SI - and r19=r26,r27 // Update vpsr - ;; - st8 [r17]=r19 - mov r24=cr.ipsr - ;; - and r24=r24,r28 // Update ipsr - adds r27=IA64_VCPU_FP_PSR_OFFSET,r21 - ;; - ld8 r27=[r27] - ;; - tbit.nz p8,p0=r27,IA64_PSR_DFH_BIT - ;; - (p8) dep r24=-1,r24,IA64_PSR_DFH_BIT,1 // Keep dfh - ;; - mov cr.ipsr=r24 - //sync write - mov r25=r16 - movl r24=vmx_asm_rsm_sync_write_return - br.sptk.many vmx_vps_sync_write - ;; -vmx_asm_rsm_sync_write_return: - add r29=IA64_VCPU_MMU_MODE_OFFSET,r21 - ;; - ld1 r27=[r29] - ;; - cmp.ne p6,p0=VMX_MMU_VIRTUAL,r27 - ;; - tbit.z.or p6,p0=r18,IA64_PSR_DT_BIT - (p6) br.dptk vmx_asm_rsm_out - // DT not cleared or already in phy mode - ;; - // Switch to meta physical mode D. - add r26=IA64_VCPU_META_RID_D_OFFSET,r21 - mov r27=VMX_MMU_PHY_D + dep r16=r28,r26,23,1 + ;; + VMX_VIRT_SAVE + ;; + mov out0=r21 + mov out1=r16 + movl r14=ia64_leave_hypervisor_virt + ;; + mov rp=r14 + br.call.sptk.many b6=vmx_vcpu_rsm_fast +END(vmx_asm_rsm) + + +//ssm 24 +ENTRY(vmx_asm_ssm) + adds r18=IA64_VPD_BASE_OFFSET,r21 + ;; + ld8 r18=[r18] + ;; + adds r26=IA64_VPD_VHPI_OFFSET,r18 ;; ld8 r26=[r26] - st1 [r29]=r27 - dep.z r28=4,61,3 - ;; - mov rr[r0]=r26 - ;; - mov rr[r28]=r26 - ;; - srlz.d -vmx_asm_rsm_out: - mov r31=r23 - mov r24=r20 - br.many vmx_resume_to_guest -END(vmx_asm_rsm) - - -//ssm -GLOBAL_ENTRY(vmx_asm_ssm) -#ifndef ACCE_SSM - br.many vmx_virtualization_fault_back -#endif - mov r23=r31 - add r16=IA64_VPD_BASE_OFFSET,r21 + ;; + cmp.ne p6,p0=r26,r0 + (p6) br.cond.dpnt.many vmx_virtualization_fault_back + ;; extr.u r26=r25,6,21 extr.u r27=r25,31,2 ;; - ld8 r16=[r16] extr.u r28=r25,36,1 dep r26=r27,r26,21,2 ;; //r18 is imm24 - dep r18=r28,r26,23,1 - ;; - //sync read - mov r25=r16 - movl r24=vmx_asm_ssm_sync_read_return - mov r20=b0 - br.sptk.many vmx_vps_sync_read - ;; -vmx_asm_ssm_sync_read_return: - add r27=VPD_VPSR_START_OFFSET,r16 - ;; - ld8 r17=[r27] //r17 old vpsr - dep r28=0,r18,IA64_PSR_PP_BIT,1 // For xenoprof - // Don't change mPSR.pp - // It is maintained by xenoprof. - ;; - or r19=r17,r18 //r19 new vpsr - ;; - st8 [r27]=r19 // update vpsr - mov r24=cr.ipsr - ;; - or r24=r24,r28 - ;; - mov cr.ipsr=r24 - //sync_write - mov r25=r16 - movl r24=vmx_asm_ssm_sync_write_return - br.sptk.many vmx_vps_sync_write - ;; -vmx_asm_ssm_sync_write_return: - add r29=IA64_VCPU_MMU_MODE_OFFSET,r21 - movl r28=IA64_PSR_DT+IA64_PSR_RT+IA64_PSR_IT - ;; - ld1 r30=[r29] // mmu_mode - ;; - and r27=r28,r19 - cmp.eq p6,p0=VMX_MMU_VIRTUAL,r30 - ;; - cmp.ne.or p6,p0=r28,r27 // (vpsr & (it+dt+rt)) /= (it+dt+rt) ie stay in phy - (p6) br.dptk vmx_asm_ssm_1 - ;; - add r26=IA64_VCPU_META_SAVED_RR0_OFFSET,r21 - add r27=IA64_VCPU_META_SAVED_RR0_OFFSET+8,r21 - mov r30=VMX_MMU_VIRTUAL - ;; - ld8 r26=[r26] - ld8 r27=[r27] - st1 [r29]=r30 - dep.z r28=4,61,3 - ;; - mov rr[r0]=r26 - ;; - mov rr[r28]=r27 - ;; - srlz.d - ;; -vmx_asm_ssm_1: - tbit.nz p6,p0=r17,IA64_PSR_I_BIT - ;; - tbit.z.or p6,p0=r19,IA64_PSR_I_BIT - (p6) br.dptk vmx_asm_ssm_out - ;; - add r29=VPD_VTPR_START_OFFSET,r16 - add r30=VPD_VHPI_START_OFFSET,r16 - ;; - ld8 r29=[r29] - ld8 r30=[r30] - ;; - extr.u r17=r29,4,4 - extr.u r18=r29,16,1 - ;; - dep r17=r18,r17,4,1 - mov r31=r23 - mov b0=r20 - ;; - cmp.gt p6,p0=r30,r17 - (p6) br.dpnt.few vmx_asm_dispatch_vexirq -vmx_asm_ssm_out: - mov r31=r23 - mov r24=r20 - br.many vmx_resume_to_guest + dep r16=r28,r26,23,1 + ;; + VMX_VIRT_SAVE + ;; + mov out0=r21 + mov out1=r16 + movl r14=ia64_leave_hypervisor_virt + ;; + mov rp=r14 + br.call.sptk.many b6=vmx_vcpu_ssm_fast END(vmx_asm_ssm) -//mov psr.l=r2 -GLOBAL_ENTRY(vmx_asm_mov_to_psr) -#ifndef ACCE_MOV_TO_PSR - br.many vmx_virtualization_fault_back -#endif - mov r23=r31 - add r16=IA64_VPD_BASE_OFFSET,r21 +//mov psr.l=r2 +ENTRY(vmx_asm_mov_to_psr) extr.u r26=r25,13,7 //r2 - ;; - ld8 r16=[r16] - movl r24=asm_mov_from_reg - ;; - adds r30=vmx_asm_mov_to_psr_back-asm_mov_from_reg,r24 - shladd r26=r26,4,r24 - mov r20=b0 + movl r27=asm_mov_from_reg + ;; + adds r30=vmx_asm_mov_to_psr_back-asm_mov_from_reg,r27 + shladd r26=r26,4,r27 ;; mov b0=r26 br.many b0 - ;; + ;; vmx_asm_mov_to_psr_back: - //sync read - mov r25=r16 - movl r24=vmx_asm_mov_to_psr_sync_read_return - br.sptk.many vmx_vps_sync_read - ;; -vmx_asm_mov_to_psr_sync_read_return: - add r27=VPD_VPSR_START_OFFSET,r16 - ;; - ld8 r17=[r27] // r17 old vpsr - dep r19=0,r19,32,32 // Clear bits 32-63 - ;; - dep r18=0,r17,0,32 - ;; - or r18=r18,r19 //r18 new vpsr - ;; - st8 [r27]=r18 // set vpsr - //sync write - mov r25=r16 - movl r24=vmx_asm_mov_to_psr_sync_write_return - br.sptk.many vmx_vps_sync_write - ;; -vmx_asm_mov_to_psr_sync_write_return: - add r22=IA64_VCPU_MMU_MODE_OFFSET,r21 - movl r28=IA64_PSR_DT+IA64_PSR_RT+IA64_PSR_IT - ;; - and r27=r28,r18 - and r29=r28,r17 - ;; - cmp.eq p5,p0=r29,r27 // (old_vpsr & (dt+rt+it)) == (new_vpsr & (dt+rt+it)) - cmp.eq p6,p7=r28,r27 // (new_vpsr & (dt+rt+it)) == (dt+rt+it) - (p5) br.many vmx_asm_mov_to_psr_1 // no change - ;; - //virtual to physical D - (p7) add r26=IA64_VCPU_META_RID_D_OFFSET,r21 - (p7) add r27=IA64_VCPU_META_RID_D_OFFSET,r21 - (p7) mov r30=VMX_MMU_PHY_D - ;; - //physical to virtual - (p6) add r26=IA64_VCPU_META_SAVED_RR0_OFFSET,r21 - (p6) add r27=IA64_VCPU_META_SAVED_RR0_OFFSET+8,r21 - (p6) mov r30=VMX_MMU_VIRTUAL + adds r18=IA64_VPD_BASE_OFFSET,r21 + tbit.nz p6,p0 = r19, IA64_PSR_I_BIT + ;; + ld8 r18=[r18] + ;; + adds r26=IA64_VPD_VHPI_OFFSET,r18 ;; ld8 r26=[r26] - ld8 r27=[r27] - st1 [r22]=r30 - dep.z r28=4,61,3 - ;; - mov rr[r0]=r26 - ;; - mov rr[r28]=r27 - ;; - srlz.d - ;; -vmx_asm_mov_to_psr_1: - mov r24=cr.ipsr - movl r28=IA64_PSR_IC+IA64_PSR_I+IA64_PSR_DT+IA64_PSR_SI+IA64_PSR_RT - ;; - tbit.nz p7,p0=r24,IA64_PSR_PP_BIT // For xenoprof - or r27=r19,r28 - dep r24=0,r24,0,32 - ;; - add r24=r27,r24 - ;; - adds r27=IA64_VCPU_FP_PSR_OFFSET,r21 - (p7) dep r24=-1,r24,IA64_PSR_PP_BIT,1 // For xenoprof - // Dom't change mPSR.pp - // It is maintaned by xenoprof - ;; - ld8 r27=[r27] - ;; - tbit.nz p8,p0=r27,IA64_PSR_DFH_BIT - ;; - (p8) dep r24=-1,r24,IA64_PSR_DFH_BIT,1 - ;; - mov cr.ipsr=r24 - tbit.nz p6,p0=r17,IA64_PSR_I_BIT - ;; - tbit.z.or p6,p0=r18,IA64_PSR_I_BIT - (p6) br.dpnt.few vmx_asm_mov_to_psr_out - ;; - add r29=VPD_VTPR_START_OFFSET,r16 - add r30=VPD_VHPI_START_OFFSET,r16 - ;; - ld8 r29=[r29] - ld8 r30=[r30] - ;; - extr.u r17=r29,4,4 - extr.u r18=r29,16,1 - ;; - dep r17=r18,r17,4,1 - mov r31=r23 - mov b0=r20 - ;; - cmp.gt p6,p0=r30,r17 - (p6) br.dpnt.few vmx_asm_dispatch_vexirq -vmx_asm_mov_to_psr_out: - mov r31=r23 - mov r24=r20 - br.many vmx_resume_to_guest + ;; + // if enable interrupt and vhpi has value, return + cmp.ne.and p6,p0=r26,r0 + (p6) br.cond.dpnt.many vmx_virtualization_fault_back + ;; + mov r16=r19 + ;; + VMX_VIRT_SAVE + ;; + mov out0=r21 + mov out1=r16 + movl r14=ia64_leave_hypervisor_virt + ;; + mov rp=r14 + br.call.sptk.many b6=vmx_vcpu_mov_to_psr_fast END(vmx_asm_mov_to_psr) - -ENTRY(vmx_asm_dispatch_vexirq) -//increment iip - mov r16=cr.ipsr - ;; - extr.u r17=r16,IA64_PSR_RI_BIT,2 - tbit.nz p6,p7=r16,IA64_PSR_RI_BIT+1 - ;; - (p6) mov r18=cr.iip - (p6) mov r17=r0 - (p7) add r17=1,r17 - ;; - (p6) add r18=0x10,r18 - dep r16=r17,r16,IA64_PSR_RI_BIT,2 - ;; - (p6) mov cr.iip=r18 - mov cr.ipsr=r16 - br.many vmx_dispatch_vexirq -END(vmx_asm_dispatch_vexirq) // thash r1=r3 // TODO: add support when pta.vf = 1 -GLOBAL_ENTRY(vmx_asm_thash) -#ifndef ACCE_THASH - br.many vmx_virtualization_fault_back -#endif - extr.u r17=r25,20,7 // get r3 from opcode in r25 - extr.u r18=r25,6,7 // get r1 from opcode in r25 +ENTRY(vmx_asm_thash) + extr.u r17=r25,20,7 // get r3 from opcode in r25 + extr.u r18=r25,6,7 // get r1 from opcode in r25 movl r20=asm_mov_from_reg ;; adds r30=vmx_asm_thash_back1-asm_mov_from_reg,r20 - shladd r17=r17,4,r20 // get addr of MOVE_FROM_REG(r17) - adds r16=IA64_VPD_BASE_OFFSET,r21 // get vcpu.arch.priveregs - mov r24=b0 // save b0 - ;; - ld8 r16=[r16] // get VPD addr + shladd r17=r17,4,r20 // get addr of MOVE_FROM_REG(r17) + adds r16=IA64_VPD_BASE_OFFSET,r21 // get vcpu.arch.priveregs + mov r24=b0 // save b0 + ;; + ld8 r16=[r16] // get VPD addr mov b0=r17 - br.many b0 // r19 return value - ;; + br.many b0 // r19 return value + ;; vmx_asm_thash_back1: - shr.u r23=r19,61 // get RR number - adds r28=VCPU_VRR0_OFS,r21 // get vcpu->arch.arch_vmx.vrr[0]'s addr - adds r16=IA64_VPD_VPTA_OFFSET,r16 // get virtual pta - ;; - shladd r27=r23,3,r28 // get vcpu->arch.arch_vmx.vrr[r23]'s addr - ld8 r17=[r16] // get virtual PTA + shr.u r23=r19,61 // get RR number + adds r28=VCPU_VRR0_OFS,r21 // get vcpu->arch.arch_vmx.vrr[0]'s addr + adds r16=IA64_VPD_VPTA_OFFSET,r16 // get virtual pta + ;; + shladd r27=r23,3,r28 // get vcpu->arch.arch_vmx.vrr[r23]'s addr + ld8 r17=[r16] // get virtual PTA mov r26=1 ;; - extr.u r29=r17,2,6 // get pta.size - ld8 r28=[r27] // get vcpu->arch.arch_vmx.vrr[r23]'s value + extr.u r29=r17,2,6// get pta.size + ld8 r28=[r27] // get vcpu->arch.arch_vmx.vrr[r23]'s value ;; // Fall-back to C if VF (long format) is set tbit.nz p6,p0=r17,8 mov b0=r24 ;; -(p6) mov r24=EVENT_THASH -(p6) br.cond.dpnt.many vmx_virtualization_fault_back - extr.u r28=r28,2,6 // get rr.ps - shl r22=r26,r29 // 1UL << pta.size - ;; - shr.u r23=r19,r28 // vaddr >> rr.ps - adds r26=3,r29 // pta.size + 3 - shl r27=r17,3 // pta << 3 - ;; - shl r23=r23,3 // (vaddr >> rr.ps) << 3 - shr.u r27=r27,r26 // (pta << 3) >> (pta.size+3) + (p6) mov r24=EVENT_THASH + (p6) br.cond.dpnt.many vmx_virtualization_fault_back + extr.u r28=r28,2,6 // get rr.ps + shl r22=r26,r29 // 1UL << pta.size + ;; + shr.u r23=r19,r28 // vaddr >> rr.ps + adds r26=3,r29 // pta.size + 3 + shl r27=r17,3 // pta << 3 + ;; + shl r23=r23,3 // (vaddr >> rr.ps) << 3 + shr.u r27=r27,r26 // (pta << 3) >> (pta.size+3) movl r16=VRN_MASK ;; - adds r22=-1,r22 // (1UL << pta.size) - 1 - shl r27=r27,r29 // ((pta<<3)>>(pta.size+3))<>(pta.size + 3))<>(pta.size+3))<>(pta.size + 3))<arch.arch_vmx.mmu_mode = VMX_MMU_PHY_DT; + switch_to_physical_rid(vcpu); + break; + case SW_2P_D: + vcpu->arch.arch_vmx.mmu_mode = VMX_MMU_PHY_D; + switch_to_physical_rid(vcpu); + break; + case SW_2V: + vcpu->arch.arch_vmx.mmu_mode = VMX_MMU_VIRTUAL; + switch_to_virtual_rid(vcpu); + break; + default: + break; + } + return; +} + void switch_mm_mode(VCPU *vcpu, IA64_PSR old_psr, IA64_PSR new_psr) { diff -r b03e24f9c1d8 -r ef290f39ae6b xen/arch/ia64/vmx/vmx_vcpu.c --- a/xen/arch/ia64/vmx/vmx_vcpu.c Thu May 15 14:18:38 2008 +0900 +++ b/xen/arch/ia64/vmx/vmx_vcpu.c Thu May 15 14:53:48 2008 +0900 @@ -168,6 +168,34 @@ IA64FAULT vmx_vcpu_cover(VCPU *vcpu) return (IA64_NO_FAULT); } +/* In fast path, psr.ic = 0, psr.i = 0, psr.bn = 0 + * so that no tlb miss is allowed. + */ +void vmx_vcpu_set_rr_fast(VCPU *vcpu, u64 reg, u64 val) +{ + u64 rrval; + + VMX(vcpu, vrr[reg >> VRN_SHIFT]) = val; + switch((u64)(reg >> VRN_SHIFT)) { + case VRN4: + rrval = vrrtomrr(vcpu, val); + vcpu->arch.metaphysical_saved_rr4 = rrval; + if (is_virtual_mode(vcpu) && likely(vcpu == current)) + ia64_set_rr(reg, rrval); + break; + case VRN0: + rrval = vrrtomrr(vcpu, val); + vcpu->arch.metaphysical_saved_rr0 = rrval; + if (is_virtual_mode(vcpu) && likely(vcpu == current)) + ia64_set_rr(reg, rrval); + break; + default: + if (likely(vcpu == current)) + ia64_set_rr(reg, vrrtomrr(vcpu, val)); + break; + } +} + IA64FAULT vmx_vcpu_set_rr(VCPU *vcpu, u64 reg, u64 val) { u64 rrval; @@ -246,8 +274,138 @@ u64 vmx_vcpu_get_itir_on_fault(VCPU *vcp return (rr1.rrval); } - - +/* In fast path, psr.ic = 0, psr.i = 0, psr.bn = 0 + * so that no tlb miss is allowed. + */ +void vmx_vcpu_mov_to_psr_fast(VCPU *vcpu, u64 value) +{ + /* TODO: Only allowed for current vcpu */ + u64 old_vpsr, new_vpsr, mipsr, mask; + old_vpsr = VCPU(vcpu, vpsr); + + new_vpsr = (old_vpsr & 0xffffffff00000000) | (value & 0xffffffff); + VCPU(vcpu, vpsr) = new_vpsr; + + mipsr = ia64_getreg(_IA64_REG_CR_IPSR); + + /* xenoprof: + * don't change psr.pp. + * It is manipulated by xenoprof. + */ + mask = 0xffffffff00000000 | IA64_PSR_IC | IA64_PSR_I + | IA64_PSR_DT | IA64_PSR_PP | IA64_PSR_SI | IA64_PSR_RT; + + mipsr = (mipsr & mask) | (value & (~mask)); + + if (FP_PSR(vcpu) & IA64_PSR_DFH) + mipsr |= IA64_PSR_DFH; + + ia64_setreg(_IA64_REG_CR_IPSR, mipsr); + + switch_mm_mode_fast(vcpu, (IA64_PSR)old_vpsr, (IA64_PSR)new_vpsr); +} + +#define IA64_PSR_MMU_VIRT (IA64_PSR_DT | IA64_PSR_RT | IA64_PSR_IT) +/* In fast path, psr.ic = 0, psr.i = 0, psr.bn = 0 + * so that no tlb miss is allowed. + */ +void vmx_vcpu_rfi_fast(VCPU *vcpu) +{ + /* TODO: Only allowed for current vcpu */ + u64 vifs, vipsr, vpsr, mipsr, mask; + vipsr = VCPU(vcpu, ipsr); + vpsr = VCPU(vcpu, vpsr); + vifs = VCPU(vcpu, ifs); + if (vipsr & IA64_PSR_BN) { + if(!(vpsr & IA64_PSR_BN)) + vmx_asm_bsw1(); + } else if (vpsr & IA64_PSR_BN) + vmx_asm_bsw0(); + + /* + * For those IA64_PSR bits: id/da/dd/ss/ed/ia + * Since these bits will become 0, after success execution of each + * instruction, we will change set them to mIA64_PSR + */ + VCPU(vcpu, vpsr) = vipsr & (~ (IA64_PSR_ID |IA64_PSR_DA + | IA64_PSR_DD | IA64_PSR_ED | IA64_PSR_IA)); + + /* + * All vIA64_PSR bits shall go to mPSR (v->tf->tf_special.psr) + * , except for the following bits: + * ic/i/dt/si/rt/mc/it/bn/vm + */ + /* xenoprof */ + mask = (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_DT | IA64_PSR_SI | + IA64_PSR_RT | IA64_PSR_MC | IA64_PSR_IT | IA64_PSR_BN | + IA64_PSR_VM | IA64_PSR_PP); + mipsr = ia64_getreg(_IA64_REG_CR_IPSR); + mipsr = (mipsr & mask) | (vipsr & (~mask)); + + if (FP_PSR(vcpu) & IA64_PSR_DFH) + mipsr |= IA64_PSR_DFH; + + ia64_setreg(_IA64_REG_CR_IPSR, mipsr); + vmx_ia64_set_dcr(vcpu); + + if(vifs >> 63) + ia64_setreg(_IA64_REG_CR_IFS, vifs); + + ia64_setreg(_IA64_REG_CR_IIP, VCPU(vcpu, iip)); + + switch_mm_mode_fast(vcpu, (IA64_PSR)vpsr, (IA64_PSR)vipsr); +} + +/* In fast path, psr.ic = 0, psr.i = 0, psr.bn = 0 + * so that no tlb miss is allowed. + */ +void vmx_vcpu_ssm_fast(VCPU *vcpu, u64 imm24) +{ + u64 old_vpsr, new_vpsr, mipsr; + + old_vpsr = VCPU(vcpu, vpsr); + new_vpsr = old_vpsr | imm24; + + VCPU(vcpu, vpsr) = new_vpsr; + + mipsr = ia64_getreg(_IA64_REG_CR_IPSR); + /* xenoprof: + * don't change psr.pp. + * It is manipulated by xenoprof. + */ + mipsr |= imm24 & (~IA64_PSR_PP); + ia64_setreg(_IA64_REG_CR_IPSR, mipsr); + + switch_mm_mode_fast(vcpu, (IA64_PSR)old_vpsr, (IA64_PSR)new_vpsr); +} + +/* In fast path, psr.ic = 0, psr.i = 0, psr.bn = 0 + * so that no tlb miss is allowed. + */ +void vmx_vcpu_rsm_fast(VCPU *vcpu, u64 imm24) +{ + u64 old_vpsr, new_vpsr, mipsr; + + old_vpsr = VCPU(vcpu, vpsr); + new_vpsr = old_vpsr & ~imm24; + + VCPU(vcpu, vpsr) = new_vpsr; + + mipsr = ia64_getreg(_IA64_REG_CR_IPSR); + /* xenoprof: + * don't change psr.pp. + * It is manipulated by xenoprof. + */ + mipsr &= (~imm24) | IA64_PSR_PP; + mipsr |= IA64_PSR_IC | IA64_PSR_I | IA64_PSR_DT | IA64_PSR_SI; + + if (FP_PSR(vcpu) & IA64_PSR_DFH) + mipsr |= IA64_PSR_DFH; + + ia64_setreg(_IA64_REG_CR_IPSR, mipsr); + + switch_mm_mode_fast(vcpu, (IA64_PSR)old_vpsr, (IA64_PSR)new_vpsr); +} IA64FAULT vmx_vcpu_rfi(VCPU *vcpu) { diff -r b03e24f9c1d8 -r ef290f39ae6b xen/include/asm-ia64/vmx_phy_mode.h --- a/xen/include/asm-ia64/vmx_phy_mode.h Thu May 15 14:18:38 2008 +0900 +++ b/xen/include/asm-ia64/vmx_phy_mode.h Thu May 15 14:53:48 2008 +0900 @@ -79,7 +79,8 @@ extern void switch_to_physical_rid(VCPU extern void switch_to_physical_rid(VCPU *); extern void switch_to_virtual_rid(VCPU *vcpu); extern void switch_mm_mode(VCPU *vcpu, IA64_PSR old_psr, IA64_PSR new_psr); -extern void check_mm_mode_switch (VCPU *vcpu, IA64_PSR old_psr, IA64_PSR new_psr); +extern void switch_mm_mode_fast(VCPU *vcpu, IA64_PSR old_psr, IA64_PSR new_psr); +extern void check_mm_mode_switch(VCPU *vcpu, IA64_PSR old_psr, IA64_PSR new_psr); extern void prepare_if_physical_mode(VCPU *vcpu); extern void recover_if_physical_mode(VCPU *vcpu); extern void vmx_init_all_rr(VCPU *vcpu); diff -r b03e24f9c1d8 -r ef290f39ae6b xen/include/asm-ia64/vmx_vcpu.h --- a/xen/include/asm-ia64/vmx_vcpu.h Thu May 15 14:18:38 2008 +0900 +++ b/xen/include/asm-ia64/vmx_vcpu.h Thu May 15 14:53:48 2008 +0900 @@ -106,6 +106,8 @@ extern void vmx_switch_rr7(unsigned long extern void vmx_switch_rr7(unsigned long, void *, void *, void *); extern void vmx_ia64_set_dcr(VCPU * v); extern void inject_guest_interruption(struct vcpu *vcpu, u64 vec); +extern void vmx_asm_bsw0(void); +extern void vmx_asm_bsw1(void); /************************************************************************** VCPU control register access routines _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:31:53 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:31:53 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyToe-0002Tw-By for www-data@colo.xensource.com; Tue, 20 May 2008 08:31:53 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTpI-00089Y-ES; Tue, 20 May 2008 15:32:32 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToG-0007OI-UV for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:29 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTo9-0002zS-Ay for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:26 +0000 X-SBRS: 3.6 X-MesageID: 267641 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267641" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:20 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUKVX029591 for ; Tue, 20 May 2008 08:30:20 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUc4M032594 for ; Tue, 20 May 2008 08:30:38 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUc4l032593 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:38 -0700 Message-Id: <200805201530.m4KFUc4l032593@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:35 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-SA-Exim-Scanned: No (on lists.xensource.com); Message bigger than SAmaxbody (256000) Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210836236 -32400 # Node ID c96507e0c83d292f36bd48b1d4a59771e92c0907 # Parent ef290f39ae6b8e3c58c224ec469ab09522cc7e0b # Parent 86587698116d742ff257e64ddfd230157fcee42c merge with xen-unstable.hg --- config/powerpc64.mk | 6 tools/libxc/powerpc64/Makefile | 4 tools/libxc/powerpc64/flatdevtree.c | 662 ---------- tools/libxc/powerpc64/flatdevtree.h | 108 - tools/libxc/powerpc64/flatdevtree_env.h | 94 - tools/libxc/powerpc64/mk_flatdevtree.c | 648 --------- tools/libxc/powerpc64/mk_flatdevtree.h | 37 tools/libxc/powerpc64/xc_memory.c | 42 tools/libxc/xc_core_powerpc.c | 79 - tools/libxc/xc_core_powerpc.h | 58 tools/libxc/xc_dom_powerpc.c | 236 --- tools/xm-test/ramdisk/configs/buildroot-powerpc | 338 ----- xen/arch/powerpc/0opt.c | 34 xen/arch/powerpc/Makefile | 152 -- xen/arch/powerpc/Rules.mk | 52 xen/arch/powerpc/audit.c | 47 xen/arch/powerpc/backtrace.c | 217 --- xen/arch/powerpc/bitops.c | 94 - xen/arch/powerpc/boot_of.c | 1257 ------------------- xen/arch/powerpc/cmdline.c | 24 xen/arch/powerpc/crash.c | 20 xen/arch/powerpc/dart.c | 297 ---- xen/arch/powerpc/dart.h | 36 xen/arch/powerpc/dart_u3.c | 108 - xen/arch/powerpc/dart_u4.c | 184 -- xen/arch/powerpc/domain.c | 357 ----- xen/arch/powerpc/domain_build.c | 297 ---- xen/arch/powerpc/domctl.c | 120 - xen/arch/powerpc/exceptions.c | 91 - xen/arch/powerpc/exceptions.h | 54 xen/arch/powerpc/external.c | 202 --- xen/arch/powerpc/float.S | 243 --- xen/arch/powerpc/gdbstub.c | 216 --- xen/arch/powerpc/hcalls.c | 171 -- xen/arch/powerpc/iommu.c | 95 - xen/arch/powerpc/iommu.h | 28 xen/arch/powerpc/irq.c | 22 xen/arch/powerpc/machine_kexec.c | 41 xen/arch/powerpc/memory.c | 224 --- xen/arch/powerpc/mm.c | 617 --------- xen/arch/powerpc/mpic.c | 1100 ---------------- xen/arch/powerpc/mpic_init.c | 416 ------ xen/arch/powerpc/mpic_init.h | 27 xen/arch/powerpc/multiboot2.c | 67 - xen/arch/powerpc/numa.c | 1 xen/arch/powerpc/of-devtree.c | 1087 ---------------- xen/arch/powerpc/of-devtree.h | 157 -- xen/arch/powerpc/of-devwalk.c | 133 -- xen/arch/powerpc/of_handler/Makefile | 32 xen/arch/powerpc/of_handler/console.c | 233 --- xen/arch/powerpc/of_handler/control.c | 90 - xen/arch/powerpc/of_handler/cpu.c | 82 - xen/arch/powerpc/of_handler/devtree.c | 268 ---- xen/arch/powerpc/of_handler/head.S | 156 -- xen/arch/powerpc/of_handler/io.c | 160 -- xen/arch/powerpc/of_handler/leap.S | 38 xen/arch/powerpc/of_handler/memcmp.c | 39 xen/arch/powerpc/of_handler/memory.c | 129 - xen/arch/powerpc/of_handler/memset.c | 67 - xen/arch/powerpc/of_handler/ofh.c | 439 ------ xen/arch/powerpc/of_handler/ofh.h | 164 -- xen/arch/powerpc/of_handler/papr.S | 97 - xen/arch/powerpc/of_handler/papr.h | 69 - xen/arch/powerpc/of_handler/rtas.c | 82 - xen/arch/powerpc/of_handler/services.c | 96 - xen/arch/powerpc/of_handler/snprintf.c | 332 ----- xen/arch/powerpc/of_handler/strcmp.c | 36 xen/arch/powerpc/of_handler/strlcpy.c | 58 xen/arch/powerpc/of_handler/strlen.c | 30 xen/arch/powerpc/of_handler/strncmp.c | 39 xen/arch/powerpc/of_handler/strnlen.c | 30 xen/arch/powerpc/of_handler/vdevice.c | 74 - xen/arch/powerpc/of_handler/xen_hvcall.S | 44 xen/arch/powerpc/of_handler/xencomm.c | 84 - xen/arch/powerpc/ofd_fixup.c | 428 ------ xen/arch/powerpc/ofd_fixup_memory.c | 128 - xen/arch/powerpc/oftree.h | 38 xen/arch/powerpc/papr/Makefile | 11 xen/arch/powerpc/papr/debug.c | 84 - xen/arch/powerpc/papr/h_perfmon.c | 158 -- xen/arch/powerpc/papr/tce.c | 84 - xen/arch/powerpc/papr/vtce.c | 158 -- xen/arch/powerpc/papr/vterm.c | 70 - xen/arch/powerpc/papr/xlate.c | 619 --------- xen/arch/powerpc/physdev.c | 24 xen/arch/powerpc/platform.c | 43 xen/arch/powerpc/powerpc64/Makefile | 14 xen/arch/powerpc/powerpc64/asm-offsets.c | 67 - xen/arch/powerpc/powerpc64/domain.c | 222 --- xen/arch/powerpc/powerpc64/exceptions.S | 644 --------- xen/arch/powerpc/powerpc64/hypercall_table.S | 46 xen/arch/powerpc/powerpc64/io.S | 193 -- xen/arch/powerpc/powerpc64/memcpy.S | 171 -- xen/arch/powerpc/powerpc64/ppc970.c | 302 ---- xen/arch/powerpc/powerpc64/ppc970_machinecheck.c | 125 - xen/arch/powerpc/powerpc64/ppc970_scom.c | 184 -- xen/arch/powerpc/powerpc64/prom_call.S | 116 - xen/arch/powerpc/powerpc64/scom.h | 39 xen/arch/powerpc/powerpc64/string.S | 286 ---- xen/arch/powerpc/powerpc64/traps.c | 58 xen/arch/powerpc/ppc32/prom_call.c | 41 xen/arch/powerpc/rtas.c | 201 --- xen/arch/powerpc/rtas.h | 65 xen/arch/powerpc/rtas_flash.c | 182 -- xen/arch/powerpc/rtas_nvram.c | 129 - xen/arch/powerpc/setup.c | 509 ------- xen/arch/powerpc/shadow.c | 155 -- xen/arch/powerpc/smp-tbsync.c | 193 -- xen/arch/powerpc/smp.c | 214 --- xen/arch/powerpc/smpboot.c | 29 xen/arch/powerpc/start.S | 62 xen/arch/powerpc/sysctl.c | 65 xen/arch/powerpc/systemsim.S | 64 xen/arch/powerpc/tce.h | 71 - xen/arch/powerpc/time.c | 90 - xen/arch/powerpc/usercopy.c | 50 xen/arch/powerpc/xen.lds.S | 250 --- xen/include/asm-powerpc/acpi.h | 2 xen/include/asm-powerpc/asm_defns.h | 28 xen/include/asm-powerpc/atomic.h | 211 --- xen/include/asm-powerpc/bitops.h | 309 ---- xen/include/asm-powerpc/boot.h | 46 xen/include/asm-powerpc/bug.h | 7 xen/include/asm-powerpc/byteorder.h | 80 - xen/include/asm-powerpc/cache.h | 74 - xen/include/asm-powerpc/config.h | 85 - xen/include/asm-powerpc/current.h | 79 - xen/include/asm-powerpc/debugger.h | 97 - xen/include/asm-powerpc/delay.h | 40 xen/include/asm-powerpc/desc.h | 25 xen/include/asm-powerpc/div64.h | 33 xen/include/asm-powerpc/domain.h | 123 - xen/include/asm-powerpc/elf.h | 30 xen/include/asm-powerpc/event.h | 99 - xen/include/asm-powerpc/flushtlb.h | 105 - xen/include/asm-powerpc/grant_table.h | 92 - xen/include/asm-powerpc/guest_access.h | 26 xen/include/asm-powerpc/hardirq.h | 21 xen/include/asm-powerpc/hcalls.h | 34 xen/include/asm-powerpc/htab.h | 136 -- xen/include/asm-powerpc/hypercall.h | 26 xen/include/asm-powerpc/init.h | 40 xen/include/asm-powerpc/io.h | 69 - xen/include/asm-powerpc/iocap.h | 26 xen/include/asm-powerpc/irq.h | 31 xen/include/asm-powerpc/mach-default/irq_vectors.h | 89 - xen/include/asm-powerpc/memory.h | 39 xen/include/asm-powerpc/mm.h | 286 ---- xen/include/asm-powerpc/mpic.h | 294 ---- xen/include/asm-powerpc/msr.h | 66 xen/include/asm-powerpc/multicall.h | 27 xen/include/asm-powerpc/nmi.h | 9 xen/include/asm-powerpc/numa.h | 28 xen/include/asm-powerpc/page.h | 134 -- xen/include/asm-powerpc/papr.h | 219 --- xen/include/asm-powerpc/pci.h | 35 xen/include/asm-powerpc/percpu.h | 36 xen/include/asm-powerpc/perfc.h | 16 xen/include/asm-powerpc/platform.h | 28 xen/include/asm-powerpc/powerpc64/config.h | 39 xen/include/asm-powerpc/powerpc64/ppc970-hid.h | 144 -- xen/include/asm-powerpc/powerpc64/ppc970.h | 31 xen/include/asm-powerpc/powerpc64/procarea.h | 38 xen/include/asm-powerpc/powerpc64/processor.h | 228 --- xen/include/asm-powerpc/powerpc64/string.h | 42 xen/include/asm-powerpc/processor.h | 429 ------ xen/include/asm-powerpc/reg_defs.h | 210 --- xen/include/asm-powerpc/regs.h | 25 xen/include/asm-powerpc/shadow.h | 52 xen/include/asm-powerpc/shared.h | 4 xen/include/asm-powerpc/smp.h | 60 xen/include/asm-powerpc/softirq.h | 6 xen/include/asm-powerpc/spinlock.h | 218 --- xen/include/asm-powerpc/string.h | 26 xen/include/asm-powerpc/system.h | 247 --- xen/include/asm-powerpc/time.h | 86 - xen/include/asm-powerpc/trace.h | 4 xen/include/asm-powerpc/types.h | 79 - xen/include/asm-powerpc/xenoprof.h | 100 - xen/include/asm-x86/x86_32/page-2level.h | 60 xen/include/asm-x86/x86_32/page-3level.h | 90 - xen/include/public/arch-powerpc.h | 120 - Config.mk | 7 Makefile | 4 buildconfigs/mk.linux-2.6-common | 4 buildconfigs/mk.linux-2.6.5-SLES-xen | 2 buildconfigs/mk.linux-2.6.9-RHEL-xen | 2 extras/mini-os/Config.mk | 8 extras/mini-os/arch/x86/arch.mk | 5 extras/mini-os/arch/x86/mm.c | 17 extras/mini-os/arch/x86/setup.c | 2 extras/mini-os/arch/x86/time.c | 2 extras/mini-os/arch/x86/traps.c | 5 extras/mini-os/arch/x86/x86_32.S | 4 extras/mini-os/blkfront.c | 32 extras/mini-os/events.c | 8 extras/mini-os/fbfront.c | 112 + extras/mini-os/hypervisor.c | 11 extras/mini-os/include/arch/cc.h | 3 extras/mini-os/include/fbfront.h | 3 extras/mini-os/include/lib.h | 4 extras/mini-os/include/mm.h | 1 extras/mini-os/include/types.h | 6 extras/mini-os/include/x86/arch_limits.h | 2 extras/mini-os/include/x86/arch_mm.h | 30 extras/mini-os/include/x86/x86_32/hypercall-x86_32.h | 12 extras/mini-os/kernel.c | 74 - extras/mini-os/lib/sys.c | 20 extras/mini-os/lib/xmalloc.c | 2 extras/mini-os/netfront.c | 68 - tools/examples/xmexample.hvm | 46 tools/examples/xmexample.vti | 3 tools/examples/xmexample1 | 5 tools/examples/xmexample2 | 5 tools/examples/xmexample3 | 5 tools/ioemu/block.c | 2 tools/ioemu/hw/ide.c | 6 tools/ioemu/hw/pass-through.c | 11 tools/ioemu/hw/pass-through.h | 21 tools/ioemu/hw/pt-msi.c | 424 +++++- tools/ioemu/hw/pt-msi.h | 15 tools/ioemu/hw/xenfb.c | 282 +++- tools/ioemu/keymaps.c | 16 tools/ioemu/sdl.c | 2 tools/ioemu/vl.c | 4 tools/ioemu/vl.h | 4 tools/ioemu/vnc.c | 58 tools/ioemu/vnc_keysym.h | 1 tools/ioemu/xenstore.c | 36 tools/libxc/Makefile | 2 tools/libxc/xc_core.h | 2 tools/libxc/xc_dom_elfloader.c | 2 tools/libxc/xc_physdev.c | 2 tools/libxc/xenctrl.h | 10 tools/libxc/xenguest.h | 14 tools/python/xen/lowlevel/xc/xc.c | 32 tools/python/xen/util/xsm/acm/acm.py | 97 + tools/python/xen/web/connection.py | 167 ++ tools/python/xen/web/tcp.py | 12 tools/python/xen/xend/XendCheckpoint.py | 14 tools/python/xen/xend/XendConfig.py | 108 + tools/python/xen/xend/XendDomain.py | 92 - tools/python/xen/xend/XendDomainInfo.py | 36 tools/python/xen/xend/arch.py | 2 tools/python/xen/xend/image.py | 24 tools/python/xen/xend/server/blkif.py | 17 tools/python/xen/xend/server/relocate.py | 22 tools/python/xen/xm/create.py | 7 tools/python/xen/xm/xenapi_create.py | 9 tools/xm-test/lib/XmTestLib/arch.py | 40 tools/xm-test/lib/XmTestReport/arch.py | 6 tools/xm-test/ramdisk/Makefile.am | 2 tools/xm-test/ramdisk/make-release.sh | 3 tools/xm-test/runtest.sh | 2 unmodified_drivers/linux-2.6/overrides.mk | 14 xen/Rules.mk | 3 xen/arch/ia64/xen/dom0_ops.c | 10 xen/arch/x86/Rules.mk | 5 xen/arch/x86/acpi/Makefile | 2 xen/arch/x86/acpi/cpu_idle.c | 2 xen/arch/x86/acpi/cpufreq/Makefile | 3 xen/arch/x86/acpi/cpufreq/cpufreq.c | 603 +++++++++ xen/arch/x86/acpi/cpufreq/cpufreq_ondemand.c | 237 +++ xen/arch/x86/acpi/cpufreq/utility.c | 167 ++ xen/arch/x86/boot/head.S | 24 xen/arch/x86/boot/trampoline.S | 6 xen/arch/x86/boot/wakeup.S | 6 xen/arch/x86/boot/x86_32.S | 2 xen/arch/x86/domain.c | 34 xen/arch/x86/domain_build.c | 6 xen/arch/x86/hvm/hvm.c | 2 xen/arch/x86/hvm/vmx/vmcs.c | 34 xen/arch/x86/hvm/vmx/vmx.c | 4 xen/arch/x86/mm.c | 53 xen/arch/x86/mm/hap/hap.c | 44 xen/arch/x86/mm/p2m.c | 43 xen/arch/x86/mm/shadow/Makefile | 18 xen/arch/x86/mm/shadow/common.c | 318 +--- xen/arch/x86/mm/shadow/multi.c | 212 --- xen/arch/x86/mm/shadow/multi.h | 58 xen/arch/x86/mm/shadow/private.h | 56 xen/arch/x86/mm/shadow/types.h | 107 - xen/arch/x86/msi.c | 33 xen/arch/x86/platform_hypercall.c | 66 xen/arch/x86/setup.c | 33 xen/arch/x86/sysctl.c | 19 xen/arch/x86/traps.c | 4 xen/arch/x86/x86_32/mm.c | 11 xen/arch/x86/x86_32/traps.c | 10 xen/arch/x86/x86_64/domain.c | 19 xen/arch/x86/x86_64/platform_hypercall.c | 6 xen/common/compat/domain.c | 20 xen/common/domain.c | 10 xen/drivers/passthrough/vtd/iommu.c | 1 xen/include/acpi/cpufreq/cpufreq.h | 129 + xen/include/acpi/cpufreq/processor_perf.h | 30 xen/include/asm-x86/config.h | 49 xen/include/asm-x86/desc.h | 2 xen/include/asm-x86/domain.h | 4 xen/include/asm-x86/fixmap.h | 2 xen/include/asm-x86/mm.h | 4 xen/include/asm-x86/msi.h | 1 xen/include/asm-x86/msr-index.h | 4 xen/include/asm-x86/mtrr.h | 3 xen/include/asm-x86/page.h | 16 xen/include/asm-x86/types.h | 6 xen/include/asm-x86/x86_32/page.h | 91 + xen/include/public/arch-x86/xen-x86_32.h | 7 xen/include/public/hvm/hvm_op.h | 5 xen/include/public/io/fbif.h | 21 xen/include/public/io/pciif.h | 14 xen/include/public/io/protocols.h | 3 xen/include/public/libelf.h | 4 xen/include/public/platform.h | 51 xen/include/public/xen.h | 2 xen/include/xen/domain.h | 2 xen/include/xlat.lst | 5 xen/tools/get-fields.sh | 1 318 files changed, 3452 insertions(+), 27297 deletions(-) diff -r ef290f39ae6b -r c96507e0c83d Config.mk --- a/Config.mk Thu May 15 14:53:48 2008 +0900 +++ b/Config.mk Thu May 15 16:23:56 2008 +0900 @@ -4,14 +4,9 @@ debug ?= n debug ?= n XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ \ - -e s/ppc/powerpc/ -e s/i86pc/x86_32/ \ - -e s/amd64/x86_64/) + -e s/i86pc/x86_32/ -e s/amd64/x86_64/) XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH) XEN_OS ?= $(shell uname -s) - -ifeq ($(XEN_TARGET_ARCH),x86_32) -XEN_TARGET_X86_PAE ?= y -endif CONFIG_$(XEN_OS) := y diff -r ef290f39ae6b -r c96507e0c83d Makefile --- a/Makefile Thu May 15 14:53:48 2008 +0900 +++ b/Makefile Thu May 15 16:23:56 2008 +0900 @@ -12,10 +12,6 @@ SUBARCH := $(subst x86_32,i386,$(XEN_TAR SUBARCH := $(subst x86_32,i386,$(XEN_TARGET_ARCH)) export XEN_TARGET_ARCH SUBARCH XEN_SYSTYPE include buildconfigs/Rules.mk - -ifeq ($(XEN_TARGET_X86_PAE),y) -export pae=y -endif # build and install everything into the standard system directories .PHONY: install diff -r ef290f39ae6b -r c96507e0c83d buildconfigs/mk.linux-2.6-common --- a/buildconfigs/mk.linux-2.6-common Thu May 15 14:53:48 2008 +0900 +++ b/buildconfigs/mk.linux-2.6-common Thu May 15 16:23:56 2008 +0900 @@ -91,11 +91,7 @@ ifneq ($(XEN_LINUX_CONFIG_UPDATE),) sh $(XEN_LINUX_CONFIG_UPDATE) $(CONFIG_FILE) endif ifeq ($(XEN_TARGET_ARCH),x86_32) -ifeq ($(pae),y) sed -e 's!^CONFIG_HIGHMEM4G=y$$!\# CONFIG_HIGHMEM4G is not set!;s!^\# CONFIG_HIGHMEM64G is not set$$!CONFIG_HIGHMEM64G=y!' $(CONFIG_FILE) > $(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) -else - grep '^CONFIG_HIGHMEM64G=y' $(CONFIG_FILE) >/dev/null && ( sed -e 's!^CONFIG_HIGHMEM64G=y$$!\# CONFIG_HIGHMEM64G is not set!;s!^\# CONFIG_HIGHMEM4G is not set$$!CONFIG_HIGHMEM4G=y!' $(CONFIG_FILE) > $(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) ) || true -endif endif ifneq ($(EXTRAVERSION),) echo "$(EXTRAVERSION)" >$(LINUX_DIR)/localversion-xen diff -r ef290f39ae6b -r c96507e0c83d buildconfigs/mk.linux-2.6.5-SLES-xen --- a/buildconfigs/mk.linux-2.6.5-SLES-xen Thu May 15 14:53:48 2008 +0900 +++ b/buildconfigs/mk.linux-2.6.5-SLES-xen Thu May 15 16:23:56 2008 +0900 @@ -1,6 +1,4 @@ -# This tree only supports PAE XEN_TARGET_ARCH = x86_32 -XEN_TARGET_X86_PAE = y EXTRAVERSION = -xen LINUX_VER = 2.6.5-SLES diff -r ef290f39ae6b -r c96507e0c83d buildconfigs/mk.linux-2.6.9-RHEL-xen --- a/buildconfigs/mk.linux-2.6.9-RHEL-xen Thu May 15 14:53:48 2008 +0900 +++ b/buildconfigs/mk.linux-2.6.9-RHEL-xen Thu May 15 16:23:56 2008 +0900 @@ -1,6 +1,4 @@ -# This tree only supports PAE XEN_TARGET_ARCH = x86_32 -XEN_TARGET_X86_PAE = y EXTRAVERSION = -xen LINUX_VER = 2.6.9-RHEL diff -r ef290f39ae6b -r c96507e0c83d config/powerpc64.mk --- a/config/powerpc64.mk Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -CONFIG_POWERPC := y -CONFIG_POWERPC_$(XEN_OS) := y - -CONFIG_XENCOMM := y - -CFLAGS += -DELFSIZE=64 diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/Config.mk --- a/extras/mini-os/Config.mk Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/Config.mk Thu May 15 16:23:56 2008 +0900 @@ -2,9 +2,6 @@ MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os MINI-OS_ROOT=$(XEN_ROOT)/extras/mini-os export MINI-OS_ROOT -ifeq ($(XEN_TARGET_ARCH),x86_32) -export pae ?= y -endif libc = $(stubdom) XEN_INTERFACE_VERSION := 0x00030205 @@ -25,7 +22,6 @@ TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FA # Export these variables for possible use in architecture dependent makefiles. export TARGET_ARCH_DIR export TARGET_ARCH_FAM -export XEN_TARGET_X86_PAE # This is used for architecture specific links. # This can be overwritten from arch specific rules. @@ -70,7 +66,3 @@ ifneq ($(CAMLDIR),) ifneq ($(CAMLDIR),) caml=y endif - -ifeq ($(pae),y) -DEF_CPPFLAGS += -DCONFIG_X86_PAE -endif diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/arch/x86/arch.mk --- a/extras/mini-os/arch/x86/arch.mk Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/arch/x86/arch.mk Thu May 15 16:23:56 2008 +0900 @@ -9,11 +9,6 @@ ARCH_ASFLAGS := -m32 ARCH_ASFLAGS := -m32 EXTRA_INC += $(TARGET_ARCH_FAM)/$(XEN_TARGET_ARCH) EXTRA_SRC += arch/$(EXTRA_INC) - -ifeq ($(XEN_TARGET_X86_PAE),y) -ARCH_CFLAGS += -DCONFIG_X86_PAE=1 -ARCH_ASFLAGS += -DCONFIG_X86_PAE=1 -endif endif ifeq ($(XEN_TARGET_ARCH),x86_64) diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/arch/x86/mm.c --- a/extras/mini-os/arch/x86/mm.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/arch/x86/mm.c Thu May 15 16:23:56 2008 +0900 @@ -79,13 +79,11 @@ void new_pt_frame(unsigned long *pt_pfn, prot_t = L2_PROT; pincmd = MMUEXT_PIN_L1_TABLE; break; -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) case L2_FRAME: prot_e = L2_PROT; prot_t = L3_PROT; pincmd = MMUEXT_PIN_L2_TABLE; break; -#endif #if defined(__x86_64__) case L3_FRAME: prot_e = L3_PROT; @@ -102,11 +100,8 @@ void new_pt_frame(unsigned long *pt_pfn, /* Update the entry */ #if defined(__x86_64__) tab = pte_to_virt(tab[l4_table_offset(pt_page)]); +#endif tab = pte_to_virt(tab[l3_table_offset(pt_page)]); -#endif -#if defined(CONFIG_X86_PAE) - tab = pte_to_virt(tab[l3_table_offset(pt_page)]); -#endif mmu_updates[0].ptr = ((pgentry_t)tab[l2_table_offset(pt_page)] & PAGE_MASK) + sizeof(pgentry_t) * l1_table_offset(pt_page); @@ -164,7 +159,6 @@ static int need_pt_frame(unsigned long v } else #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) if(level == L2_FRAME) { #if defined(__x86_64__) @@ -181,7 +175,6 @@ static int need_pt_frame(unsigned long v return 1; } else -#endif /* defined(__x86_64__) || defined(CONFIG_X86_PAE) */ /* Always need l1 frames */ if(level == L1_FRAME) @@ -236,7 +229,6 @@ void build_pagetable(unsigned long *star mfn = pte_to_mfn(page); tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) offset = l3_table_offset(start_address); /* Need new L2 pt frame */ if(!(start_address & L2_MASK)) @@ -246,7 +238,6 @@ void build_pagetable(unsigned long *star page = tab[offset]; mfn = pte_to_mfn(page); tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT); -#endif offset = l2_table_offset(start_address); /* Need new L1 pt frame */ if(!(start_address & L1_MASK)) @@ -298,12 +289,10 @@ static void set_readonly(void *text, voi mfn = pte_to_mfn(page); tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) offset = l3_table_offset(start_address); page = tab[offset]; mfn = pte_to_mfn(page); tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT); -#endif offset = l2_table_offset(start_address); page = tab[offset]; mfn = pte_to_mfn(page); @@ -382,13 +371,11 @@ static pgentry_t *get_pgt(unsigned long mfn = pte_to_mfn(tab[offset]); tab = mfn_to_virt(mfn); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) offset = l3_table_offset(addr); if (!(tab[offset] & _PAGE_PRESENT)) return NULL; mfn = pte_to_mfn(tab[offset]); tab = mfn_to_virt(mfn); -#endif offset = l2_table_offset(addr); if (!(tab[offset] & _PAGE_PRESENT)) return NULL; @@ -418,7 +405,6 @@ static pgentry_t *need_pgt(unsigned long mfn = pte_to_mfn(tab[offset]); tab = mfn_to_virt(mfn); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) offset = l3_table_offset(addr); if (!(tab[offset] & _PAGE_PRESENT)) { pt_pfn = virt_to_pfn(alloc_page()); @@ -427,7 +413,6 @@ static pgentry_t *need_pgt(unsigned long ASSERT(tab[offset] & _PAGE_PRESENT); mfn = pte_to_mfn(tab[offset]); tab = mfn_to_virt(mfn); -#endif offset = l2_table_offset(addr); if (!(tab[offset] & _PAGE_PRESENT)) { pt_pfn = virt_to_pfn(alloc_page()); diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/arch/x86/setup.c --- a/extras/mini-os/arch/x86/setup.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/arch/x86/setup.c Thu May 15 16:23:56 2008 +0900 @@ -53,7 +53,7 @@ void hypervisor_callback(void); void hypervisor_callback(void); void failsafe_callback(void); -#if !defined(CONFIG_X86_PAE) +#if defined(__x86_64__) #define __pte(x) ((pte_t) { (x) } ) #else #define __pte(x) ({ unsigned long long _x = (x); \ diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/arch/x86/time.c --- a/extras/mini-os/arch/x86/time.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/arch/x86/time.c Thu May 15 16:23:56 2008 +0900 @@ -201,10 +201,12 @@ void block_domain(s_time_t until) { struct timeval tv; gettimeofday(&tv, NULL); + ASSERT(irqs_disabled()); if(monotonic_clock() < until) { HYPERVISOR_set_timer_op(until); HYPERVISOR_sched_op(SCHEDOP_block, 0); + local_irq_disable(); } } diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/arch/x86/traps.c --- a/extras/mini-os/arch/x86/traps.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/arch/x86/traps.c Thu May 15 16:23:56 2008 +0900 @@ -104,11 +104,9 @@ void page_walk(unsigned long virt_addres tab = pte_to_virt(page); printk(" L4 = %"PRIpte" (%p) [offset = %lx]\n", page, tab, l4_table_offset(addr)); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) page = tab[l3_table_offset(addr)]; tab = pte_to_virt(page); printk(" L3 = %"PRIpte" (%p) [offset = %lx]\n", page, tab, l3_table_offset(addr)); -#endif page = tab[l2_table_offset(addr)]; tab = pte_to_virt(page); printk(" L2 = %"PRIpte" (%p) [offset = %lx]\n", page, tab, l2_table_offset(addr)); @@ -129,12 +127,11 @@ static int handle_cow(unsigned long addr return 0; tab = pte_to_virt(page); #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) page = tab[l3_table_offset(addr)]; if (!(page & _PAGE_PRESENT)) return 0; tab = pte_to_virt(page); -#endif + page = tab[l2_table_offset(addr)]; if (!(page & _PAGE_PRESENT)) return 0; diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/arch/x86/x86_32.S --- a/extras/mini-os/arch/x86/x86_32.S Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/arch/x86/x86_32.S Thu May 15 16:23:56 2008 +0900 @@ -8,11 +8,7 @@ .ascii ",VIRT_BASE=0x0" /* &_text from minios_x86_32.lds */ .ascii ",ELF_PADDR_OFFSET=0x0" .ascii ",HYPERCALL_PAGE=0x2" -#ifdef CONFIG_X86_PAE .ascii ",PAE=yes" -#else - .ascii ",PAE=no" -#endif .ascii ",LOADER=generic" .byte 0 .text diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/blkfront.c --- a/extras/mini-os/blkfront.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/blkfront.c Thu May 15 16:23:56 2008 +0900 @@ -68,6 +68,21 @@ void blkfront_handler(evtchn_port_t port wake_up(&blkfront_queue); } +static void free_blkfront(struct blkfront_dev *dev) +{ + mask_evtchn(dev->evtchn); + + free(dev->backend); + + gnttab_end_access(dev->ring_ref); + free_page(dev->ring.sring); + + unbind_evtchn(dev->evtchn); + + free(dev->nodename); + free(dev); +} + struct blkfront_dev *init_blkfront(char *nodename, struct blkfront_info *info) { xenbus_transaction_t xbt; @@ -88,6 +103,7 @@ struct blkfront_dev *init_blkfront(char printk("******************* BLKFRONT for %s **********\n\n\n", nodename); dev = malloc(sizeof(*dev)); + memset(dev, 0, sizeof(*dev)); dev->nodename = strdup(nodename); snprintf(path, sizeof(path), "%s/backend-id", nodename); @@ -139,7 +155,7 @@ again: abort_transaction: xenbus_transaction_end(xbt, 1, &retry); - return NULL; + goto error; done: @@ -147,7 +163,7 @@ done: msg = xenbus_read(XBT_NIL, path, &dev->backend); if (msg) { printk("Error %s when reading the backend path %s\n", msg, path); - return NULL; + goto error; } printk("backend at %s\n", dev->backend); @@ -160,7 +176,7 @@ done: msg = xenbus_read(XBT_NIL, path, &c); if (msg) { printk("Error %s when reading the mode\n", msg); - return NULL; + goto error; } if (*c == 'w') dev->info.mode = O_RDWR; @@ -198,6 +214,10 @@ done: printk("**************************\n"); return dev; + +error: + free_blkfront(dev); + return NULL; } void shutdown_blkfront(struct blkfront_dev *dev) @@ -220,11 +240,7 @@ void shutdown_blkfront(struct blkfront_d xenbus_unwatch_path(XBT_NIL, path); - unbind_evtchn(dev->evtchn); - - free(nodename); - free(dev->backend); - free(dev); + free_blkfront(dev); } static void blkfront_wait_slot(struct blkfront_dev *dev) diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/events.c --- a/extras/mini-os/events.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/events.c Thu May 15 16:23:56 2008 +0900 @@ -58,9 +58,12 @@ int do_event(evtchn_port_t port, struct int do_event(evtchn_port_t port, struct pt_regs *regs) { ev_action_t *action; + + clear_evtchn(port); + if (port >= NR_EVS) { printk("Port number too large: %d\n", port); - goto out; + return 1; } action = &ev_actions[port]; @@ -68,9 +71,6 @@ int do_event(evtchn_port_t port, struct /* call the handler */ action->handler(port, regs, action->data); - - out: - clear_evtchn(port); return 1; diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/fbfront.c --- a/extras/mini-os/fbfront.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/fbfront.c Thu May 15 16:23:56 2008 +0900 @@ -49,6 +49,20 @@ void kbdfront_handler(evtchn_port_t port wake_up(&kbdfront_queue); } +static void free_kbdfront(struct kbdfront_dev *dev) +{ + mask_evtchn(dev->evtchn); + + free(dev->backend); + + free_page(dev->page); + + unbind_evtchn(dev->evtchn); + + free(dev->nodename); + free(dev); +} + struct kbdfront_dev *init_kbdfront(char *nodename, int abs_pointer) { xenbus_transaction_t xbt; @@ -122,7 +136,7 @@ again: abort_transaction: xenbus_transaction_end(xbt, 1, &retry); - return NULL; + goto error; done: @@ -130,7 +144,7 @@ done: msg = xenbus_read(XBT_NIL, path, &dev->backend); if (msg) { printk("Error %s when reading the backend path %s\n", msg, path); - return NULL; + goto error; } printk("backend at %s\n", dev->backend); @@ -153,6 +167,9 @@ done: printk("************************** KBDFRONT\n"); return dev; +error: + free_kbdfront(dev); + return NULL; } int kbdfront_receive(struct kbdfront_dev *dev, union xenkbd_in_event *buf, int n) @@ -208,12 +225,7 @@ void shutdown_kbdfront(struct kbdfront_d xenbus_unwatch_path(XBT_NIL, path); - unbind_evtchn(dev->evtchn); - - free_pages(dev->page,0); - free(nodename); - free(dev->backend); - free(dev); + free_kbdfront(dev); } #ifdef HAVE_LIBC @@ -255,11 +267,69 @@ struct fbfront_dev { int offset; xenbus_event_queue events; + +#ifdef HAVE_LIBC + int fd; +#endif }; void fbfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) { +#ifdef HAVE_LIBC + struct fbfront_dev *dev = data; + int fd = dev->fd; + + files[fd].read = 1; +#endif wake_up(&fbfront_queue); +} + +static void free_fbfront(struct fbfront_dev *dev) +{ + mask_evtchn(dev->evtchn); + + free(dev->backend); + + free_page(dev->page); + + unbind_evtchn(dev->evtchn); + + free(dev->nodename); + free(dev); +} + +int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n) +{ + struct xenfb_page *page = dev->page; + uint32_t prod, cons; + int i; + +#ifdef HAVE_LIBC + files[dev->fd].read = 0; + mb(); /* Make sure to let the handler set read to 1 before we start looking at the ring */ +#endif + + prod = page->in_prod; + + if (prod == page->in_cons) + return 0; + + rmb(); /* ensure we see ring contents up to prod */ + + for (i = 0, cons = page->in_cons; i < n && cons != prod; i++, cons++) + memcpy(buf + i, &XENFB_IN_RING_REF(page, cons), sizeof(*buf)); + + mb(); /* ensure we got ring contents */ + page->in_cons = cons; + notify_remote_via_evtchn(dev->evtchn); + +#ifdef HAVE_LIBC + if (cons != prod) + /* still some events to read */ + files[dev->fd].read = 1; +#endif + + return i; } struct fbfront_dev *init_fbfront(char *nodename, unsigned long *mfns, int width, int height, int depth, int stride, int n) @@ -357,7 +427,7 @@ again: abort_transaction: xenbus_transaction_end(xbt, 1, &retry); - return NULL; + goto error; done: @@ -365,7 +435,7 @@ done: msg = xenbus_read(XBT_NIL, path, &dev->backend); if (msg) { printk("Error %s when reading the backend path %s\n", msg, path); - return NULL; + goto error; } printk("backend at %s\n", dev->backend); @@ -391,6 +461,10 @@ done: printk("************************** FBFRONT\n"); return dev; + +error: + free_fbfront(dev); + return NULL; } static void fbfront_out_event(struct fbfront_dev *dev, union xenfb_out_event *event) @@ -477,8 +551,16 @@ void shutdown_fbfront(struct fbfront_dev unbind_evtchn(dev->evtchn); - free_pages(dev->page,0); - free(nodename); - free(dev->backend); - free(dev); -} + free_fbfront(dev); +} + +#ifdef HAVE_LIBC +int fbfront_open(struct fbfront_dev *dev) +{ + dev->fd = alloc_fd(FTYPE_FB); + printk("fb_open(%s) -> %d\n", dev->nodename, dev->fd); + files[dev->fd].fb.dev = dev; + return dev->fd; +} +#endif + diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/hypervisor.c --- a/extras/mini-os/hypervisor.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/hypervisor.c Thu May 15 16:23:56 2008 +0900 @@ -46,7 +46,11 @@ void do_hypervisor_callback(struct pt_re in_callback = 1; vcpu_info->evtchn_upcall_pending = 0; - /* NB. No need for a barrier here -- XCHG is a barrier on x86. */ + /* NB x86. No need for a barrier here -- XCHG is a barrier on x86. */ +#if !defined(__i386__) && !defined(__x86_64__) + /* Clear master flag /before/ clearing selector flag. */ + wmb(); +#endif l1 = xchg(&vcpu_info->evtchn_pending_sel, 0); while ( l1 != 0 ) { @@ -58,7 +62,7 @@ void do_hypervisor_callback(struct pt_re l2i = __ffs(l2); l2 &= ~(1 << l2i); - port = (l1i << 5) + l2i; + port = (l1i * (sizeof(unsigned long) * 8)) + l2i; do_event(port, regs); } } @@ -100,7 +104,8 @@ inline void unmask_evtchn(u32 port) * a real IO-APIC we 'lose the interrupt edge' if the channel is masked. */ if ( synch_test_bit (port, &s->evtchn_pending[0]) && - !synch_test_and_set_bit(port>>5, &vcpu_info->evtchn_pending_sel) ) + !synch_test_and_set_bit(port / (sizeof(unsigned long) * 8), + &vcpu_info->evtchn_pending_sel) ) { vcpu_info->evtchn_upcall_pending = 1; if ( !vcpu_info->evtchn_upcall_mask ) diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/include/arch/cc.h --- a/extras/mini-os/include/arch/cc.h Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/include/arch/cc.h Thu May 15 16:23:56 2008 +0900 @@ -84,7 +84,4 @@ extern void lwip_die(char *fmt, ...); #define DBG_TYPES_ON DBG_ON #endif -/* TODO: checksum doesn't work fine?! */ -#define CHECKSUM_CHECK_TCP 0 - #endif /* __LWIP_ARCH_CC_H__ */ diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/include/fbfront.h --- a/extras/mini-os/include/fbfront.h Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/include/fbfront.h Thu May 15 16:23:56 2008 +0900 @@ -1,4 +1,5 @@ #include +#include #include /* from */ @@ -36,6 +37,8 @@ int fbfront_open(struct fbfront_dev *dev int fbfront_open(struct fbfront_dev *dev); #endif +int fbfront_receive(struct fbfront_dev *dev, union xenfb_in_event *buf, int n); +extern struct wait_queue_head fbfront_queue; void fbfront_update(struct fbfront_dev *dev, int x, int y, int width, int height); void fbfront_resize(struct fbfront_dev *dev, int width, int height, int stride, int depth, int offset); diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/include/lib.h --- a/extras/mini-os/include/lib.h Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/include/lib.h Thu May 15 16:23:56 2008 +0900 @@ -141,6 +141,7 @@ enum fd_type { FTYPE_TAP, FTYPE_BLK, FTYPE_KBD, + FTYPE_FB, }; #define MAX_EVTCHN_PORTS 16 @@ -175,6 +176,9 @@ extern struct file { struct { struct kbdfront_dev *dev; } kbd; + struct { + struct fbfront_dev *dev; + } fb; struct { /* To each xenbus FD is associated a queue of watch events for this * FD. */ diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/include/mm.h --- a/extras/mini-os/include/mm.h Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/include/mm.h Thu May 15 16:23:56 2008 +0900 @@ -48,6 +48,7 @@ unsigned long alloc_pages(int order); unsigned long alloc_pages(int order); #define alloc_page() alloc_pages(0) void free_pages(void *pointer, int order); +#define free_page(p) free_pages(p, 0) static __inline__ int get_order(unsigned long size) { diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/include/types.h --- a/extras/mini-os/include/types.h Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/include/types.h Thu May 15 16:23:56 2008 +0900 @@ -43,11 +43,7 @@ typedef long long quad_t; typedef long long quad_t; typedef unsigned long long u_quad_t; -#if !defined(CONFIG_X86_PAE) -typedef struct { unsigned long pte_low; } pte_t; -#else typedef struct { unsigned long pte_low, pte_high; } pte_t; -#endif /* CONFIG_X86_PAE */ #elif defined(__x86_64__) || defined(__ia64__) typedef long quad_t; @@ -56,7 +52,7 @@ typedef struct { unsigned long pte; } pt typedef struct { unsigned long pte; } pte_t; #endif /* __i386__ || __x86_64__ */ -#if !defined(CONFIG_X86_PAE) +#ifdef __x86_64__ #define __pte(x) ((pte_t) { (x) } ) #else #define __pte(x) ({ unsigned long long _x = (x); \ diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/include/x86/arch_limits.h --- a/extras/mini-os/include/x86/arch_limits.h Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/include/x86/arch_limits.h Thu May 15 16:23:56 2008 +0900 @@ -7,7 +7,7 @@ #ifdef __ASSEMBLY__ #define __PAGE_SIZE (1 << __PAGE_SHIFT) #else -#ifndef CONFIG_X86_PAE +#ifdef __x86_64__ #define __PAGE_SIZE (1UL << __PAGE_SHIFT) #else #define __PAGE_SIZE (1ULL << __PAGE_SHIFT) diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/include/x86/arch_mm.h --- a/extras/mini-os/include/x86/arch_mm.h Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/include/x86/arch_mm.h Thu May 15 16:23:56 2008 +0900 @@ -44,24 +44,6 @@ #if defined(__i386__) -#if !defined(CONFIG_X86_PAE) - -#define L2_PAGETABLE_SHIFT 22 - -#define L1_PAGETABLE_ENTRIES 1024 -#define L2_PAGETABLE_ENTRIES 1024 - -#define PADDR_BITS 32 -#define PADDR_MASK (~0UL) - -#define NOT_L1_FRAMES 1 -#define PRIpte "08lx" -#ifndef __ASSEMBLY__ -typedef unsigned long pgentry_t; -#endif - -#else /* defined(CONFIG_X86_PAE) */ - #define L2_PAGETABLE_SHIFT 21 #define L3_PAGETABLE_SHIFT 30 @@ -85,8 +67,6 @@ typedef uint64_t pgentry_t; typedef uint64_t pgentry_t; #endif -#endif /* !defined(CONFIG_X86_PAE) */ - #elif defined(__x86_64__) #define L2_PAGETABLE_SHIFT 21 @@ -122,10 +102,8 @@ typedef unsigned long pgentry_t; (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1)) #define l2_table_offset(_a) \ (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1)) -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) #define l3_table_offset(_a) \ (((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1)) -#endif #if defined(__x86_64__) #define l4_table_offset(_a) \ (((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1)) @@ -146,9 +124,7 @@ typedef unsigned long pgentry_t; #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED) #define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED) #define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY |_PAGE_USER) -#if defined(CONFIG_X86_PAE) #define L3_PROT (_PAGE_PRESENT) -#endif /* CONFIG_X86_PAE */ #elif defined(__x86_64__) #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER) #define L1_PROT_RO (_PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_USER) @@ -172,7 +148,7 @@ typedef unsigned long pgentry_t; #ifndef __ASSEMBLY__ /* Definitions for machine and pseudophysical addresses. */ -#ifdef CONFIG_X86_PAE +#ifdef __i386__ typedef unsigned long long paddr_t; typedef unsigned long long maddr_t; #else @@ -225,14 +201,10 @@ static __inline__ paddr_t machine_to_phy #define virtual_to_l3(_virt) PT_BASE #endif -#if defined(__x86_64__) || defined(CONFIG_X86_PAE) #define virtual_to_l2(_virt) ({ \ unsigned long __virt2 = (_virt); \ (pgentry_t *) pte_to_virt(virtual_to_l3(__virt2)[l3_table_offset(__virt2)]); \ }) -#else -#define virtual_to_l2(_virt) PT_BASE -#endif #define virtual_to_l1(_virt) ({ \ unsigned long __virt1 = (_virt); \ diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/include/x86/x86_32/hypercall-x86_32.h --- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h Thu May 15 16:23:56 2008 +0900 @@ -220,12 +220,8 @@ HYPERVISOR_update_va_mapping( HYPERVISOR_update_va_mapping( unsigned long va, pte_t new_val, unsigned long flags) { - unsigned long pte_hi = 0; -#ifdef CONFIG_X86_PAE - pte_hi = new_val.pte_high; -#endif return _hypercall4(int, update_va_mapping, va, - new_val.pte_low, pte_hi, flags); + new_val.pte_low, new_val.pte_high, flags); } static inline int @@ -267,12 +263,8 @@ HYPERVISOR_update_va_mapping_otherdomain HYPERVISOR_update_va_mapping_otherdomain( unsigned long va, pte_t new_val, unsigned long flags, domid_t domid) { - unsigned long pte_hi = 0; -#ifdef CONFIG_X86_PAE - pte_hi = new_val.pte_high; -#endif return _hypercall5(int, update_va_mapping_otherdomain, va, - new_val.pte_low, pte_hi, flags, domid); + new_val.pte_low, new_val.pte_high, flags, domid); } static inline int diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/kernel.c --- a/extras/mini-os/kernel.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/kernel.c Thu May 15 16:23:56 2008 +0900 @@ -260,6 +260,7 @@ static void blkfront_thread(void *p) #define DEPTH 32 static uint32_t *fb; +static int refresh_period = 50; static struct fbfront_dev *fb_dev; static struct semaphore fbfront_sem = __SEMAPHORE_INITIALIZER(fbfront_sem, 0); @@ -302,13 +303,10 @@ static void fbfront_thread(void *p) memsize = n * PAGE_SIZE; fb = _xmalloc(memsize, PAGE_SIZE); + memset(fb, 0, memsize); mfns = xmalloc_array(unsigned long, n); - for (i = 0; i < n; i++) { - /* trigger CoW */ - ((char *) fb) [i * PAGE_SIZE] = 0; - barrier(); + for (i = 0; i < n; i++) mfns[i] = virtual_to_mfn((char *) fb + i * PAGE_SIZE); - } fb_dev = init_fbfront(NULL, mfns, WIDTH, HEIGHT, DEPTH, line_length, n); xfree(mfns); if (!fb_dev) { @@ -333,6 +331,10 @@ static void refresh_cursor(int new_x, in static void refresh_cursor(int new_x, int new_y) { static int old_x = -1, old_y = -1; + + if (!refresh_period) + return; + if (old_x != -1 && old_y != -1) { fbfront_drawvert(old_x, old_y + 1, old_y + 8, 0xffffffff); fbfront_drawhoriz(old_x + 1, old_x + 8, old_y, 0xffffffff); @@ -358,43 +360,46 @@ static void kbdfront_thread(void *p) down(&fbfront_sem); refresh_cursor(x, y); while (1) { - union xenkbd_in_event event; + union xenkbd_in_event kbdevent; + union xenfb_in_event fbevent; + int sleep = 1; add_waiter(w, kbdfront_queue); - - if (kbdfront_receive(kbd_dev, &event, 1) == 0) - schedule(); - else switch(event.type) { + add_waiter(w, fbfront_queue); + + while (kbdfront_receive(kbd_dev, &kbdevent, 1) != 0) { + sleep = 0; + switch(kbdevent.type) { case XENKBD_TYPE_MOTION: printk("motion x:%d y:%d z:%d\n", - event.motion.rel_x, - event.motion.rel_y, - event.motion.rel_z); - x += event.motion.rel_x; - y += event.motion.rel_y; - z += event.motion.rel_z; + kbdevent.motion.rel_x, + kbdevent.motion.rel_y, + kbdevent.motion.rel_z); + x += kbdevent.motion.rel_x; + y += kbdevent.motion.rel_y; + z += kbdevent.motion.rel_z; clip_cursor(&x, &y); refresh_cursor(x, y); break; case XENKBD_TYPE_POS: printk("pos x:%d y:%d dz:%d\n", - event.pos.abs_x, - event.pos.abs_y, - event.pos.rel_z); - x = event.pos.abs_x; - y = event.pos.abs_y; - z = event.pos.rel_z; + kbdevent.pos.abs_x, + kbdevent.pos.abs_y, + kbdevent.pos.rel_z); + x = kbdevent.pos.abs_x; + y = kbdevent.pos.abs_y; + z = kbdevent.pos.rel_z; clip_cursor(&x, &y); refresh_cursor(x, y); break; case XENKBD_TYPE_KEY: printk("key %d %s\n", - event.key.keycode, - event.key.pressed ? "pressed" : "released"); - if (event.key.keycode == BTN_LEFT) { + kbdevent.key.keycode, + kbdevent.key.pressed ? "pressed" : "released"); + if (kbdevent.key.keycode == BTN_LEFT) { printk("mouse %s at (%d,%d,%d)\n", - event.key.pressed ? "clic" : "release", x, y, z); - if (event.key.pressed) { + kbdevent.key.pressed ? "clic" : "release", x, y, z); + if (kbdevent.key.pressed) { uint32_t color = rand(); fbfront_drawvert(x - 16, y - 16, y + 15, color); fbfront_drawhoriz(x - 16, x + 15, y + 16, color); @@ -402,13 +407,26 @@ static void kbdfront_thread(void *p) fbfront_drawhoriz(x - 15, x + 16, y - 16, color); fbfront_update(fb_dev, x - 16, y - 16, 33, 33); } - } else if (event.key.keycode == KEY_Q) { + } else if (kbdevent.key.keycode == KEY_Q) { struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_poweroff }; HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); do_exit(); } break; + } } + while (fbfront_receive(fb_dev, &fbevent, 1) != 0) { + sleep = 0; + switch(fbevent.type) { + case XENFB_TYPE_REFRESH_PERIOD: + refresh_period = fbevent.refresh_period.period; + printk("refresh period %d\n", refresh_period); + refresh_cursor(x, y); + break; + } + } + if (sleep) + schedule(); } } diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/lib/sys.c --- a/extras/mini-os/lib/sys.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/lib/sys.c Thu May 15 16:23:56 2008 +0900 @@ -249,6 +249,16 @@ int read(int fd, void *buf, size_t nbyte } return ret * sizeof(union xenkbd_in_event); } + case FTYPE_FB: { + int ret, n; + n = nbytes / sizeof(union xenfb_in_event); + ret = fbfront_receive(files[fd].fb.dev, buf, n); + if (ret <= 0) { + errno = EAGAIN; + return -1; + } + return ret * sizeof(union xenfb_in_event); + } case FTYPE_NONE: case FTYPE_XENBUS: case FTYPE_EVTCHN: @@ -290,6 +300,7 @@ int write(int fd, const void *buf, size_ case FTYPE_EVTCHN: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: break; } printk("write(%d): Bad descriptor\n", fd); @@ -348,6 +359,7 @@ int fsync(int fd) { case FTYPE_TAP: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: break; } printk("fsync(%d): Bad descriptor\n", fd); @@ -394,6 +406,10 @@ int close(int fd) shutdown_kbdfront(files[fd].kbd.dev); files[fd].type = FTYPE_NONE; return 0; + case FTYPE_FB: + shutdown_fbfront(files[fd].fb.dev); + files[fd].type = FTYPE_NONE; + return 0; case FTYPE_NONE: break; } @@ -485,6 +501,7 @@ int fstat(int fd, struct stat *buf) case FTYPE_TAP: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: break; } @@ -513,6 +530,7 @@ int ftruncate(int fd, off_t length) case FTYPE_TAP: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: break; } @@ -624,6 +642,7 @@ static const char file_types[] = { [FTYPE_TAP] = 'T', [FTYPE_BLK] = 'B', [FTYPE_KBD] = 'K', + [FTYPE_FB] = 'G', }; #ifdef LIBC_DEBUG static void dump_set(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) @@ -732,6 +751,7 @@ static int select_poll(int nfds, fd_set case FTYPE_TAP: case FTYPE_BLK: case FTYPE_KBD: + case FTYPE_FB: if (FD_ISSET(i, readfds)) { if (files[i].read) n++; diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/lib/xmalloc.c --- a/extras/mini-os/lib/xmalloc.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/lib/xmalloc.c Thu May 15 16:23:56 2008 +0900 @@ -264,7 +264,7 @@ void xfree(const void *p) printk("Bug\n"); *(int*)0=0; } - free_pages(hdr, 0); + free_page(hdr); } else { diff -r ef290f39ae6b -r c96507e0c83d extras/mini-os/netfront.c --- a/extras/mini-os/netfront.c Thu May 15 14:53:48 2008 +0900 +++ b/extras/mini-os/netfront.c Thu May 15 16:23:56 2008 +0900 @@ -52,6 +52,7 @@ struct netfront_dev { char *nodename; char *backend; + char *mac; xenbus_event_queue events; @@ -263,6 +264,39 @@ void netfront_select_handler(evtchn_port } #endif +static void free_netfront(struct netfront_dev *dev) +{ + int i; + + for(i=0;itx_sem); + + mask_evtchn(dev->evtchn); + + free(dev->mac); + free(dev->backend); + + gnttab_end_access(dev->rx_ring_ref); + gnttab_end_access(dev->tx_ring_ref); + + free_page(dev->rx.sring); + free_page(dev->tx.sring); + + unbind_evtchn(dev->evtchn); + + for(i=0;irx_buffers[i].gref); + free_page(dev->rx_buffers[i].page); + } + + for(i=0;itx_buffers[i].page) + free_page(dev->tx_buffers[i].page); + + free(dev->nodename); + free(dev); +} + struct netfront_dev *init_netfront(char *nodename, void (*thenetif_rx)(unsigned char* data, int len), unsigned char rawmac[6], char **ip) { xenbus_transaction_t xbt; @@ -272,7 +306,6 @@ struct netfront_dev *init_netfront(char struct netif_rx_sring *rxs; int retry=0; int i; - char* mac; char* msg; struct netfront_dev *dev; @@ -288,6 +321,7 @@ struct netfront_dev *init_netfront(char printk("************************ NETFRONT for %s **********\n\n\n", nodename); dev = malloc(sizeof(*dev)); + memset(dev, 0, sizeof(*dev)); dev->nodename = strdup(nodename); printk("net TX ring size %d\n", NET_TX_RING_SIZE); @@ -314,7 +348,7 @@ struct netfront_dev *init_netfront(char #endif evtchn_alloc_unbound(dev->dom, netfront_handler, dev, &dev->evtchn); - txs = (struct netif_tx_sring*) alloc_page(); + txs = (struct netif_tx_sring *) alloc_page(); rxs = (struct netif_rx_sring *) alloc_page(); memset(txs,0,PAGE_SIZE); memset(rxs,0,PAGE_SIZE); @@ -328,11 +362,12 @@ struct netfront_dev *init_netfront(char dev->tx_ring_ref = gnttab_grant_access(dev->dom,virt_to_mfn(txs),0); dev->rx_ring_ref = gnttab_grant_access(dev->dom,virt_to_mfn(rxs),0); + init_rx_buffers(dev); + dev->netif_rx = thenetif_rx; dev->events = NULL; - // FIXME: proper frees on failures again: err = xenbus_transaction_start(&xbt); if (err) { @@ -379,25 +414,22 @@ again: abort_transaction: xenbus_transaction_end(xbt, 1, &retry); - return NULL; + goto error; done: snprintf(path, sizeof(path), "%s/backend", nodename); msg = xenbus_read(XBT_NIL, path, &dev->backend); snprintf(path, sizeof(path), "%s/mac", nodename); - msg = xenbus_read(XBT_NIL, path, &mac); - - if ((dev->backend == NULL) || (mac == NULL)) { - struct evtchn_close op = { dev->evtchn }; + msg = xenbus_read(XBT_NIL, path, &dev->mac); + + if ((dev->backend == NULL) || (dev->mac == NULL)) { printk("%s: backend/mac failed\n", __func__); - unbind_evtchn(dev->evtchn); - HYPERVISOR_event_channel_op(EVTCHNOP_close, &op); - return NULL; + goto error; } printk("backend at %s\n",dev->backend); - printk("mac is %s\n",mac); + printk("mac is %s\n",dev->mac); { char path[strlen(dev->backend) + 1 + 5 + 1]; @@ -415,13 +447,12 @@ done: printk("**************************\n"); - init_rx_buffers(dev); unmask_evtchn(dev->evtchn); /* Special conversion specifier 'hh' needed for __ia64__. Without this mini-os panics with 'Unaligned reference'. */ if (rawmac) - sscanf(mac,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", + sscanf(dev->mac,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &rawmac[0], &rawmac[1], &rawmac[2], @@ -430,6 +461,9 @@ done: &rawmac[5]); return dev; +error: + free_netfront(dev); + return NULL; } #ifdef HAVE_LIBC @@ -467,11 +501,7 @@ void shutdown_netfront(struct netfront_d xenbus_unwatch_path(XBT_NIL, path); - unbind_evtchn(dev->evtchn); - - free(nodename); - free(dev->backend); - free(dev); + free_netfront(dev); } diff -r ef290f39ae6b -r c96507e0c83d tools/examples/xmexample.hvm --- a/tools/examples/xmexample.hvm Thu May 15 14:53:48 2008 +0900 +++ b/tools/examples/xmexample.hvm Thu May 15 16:23:56 2008 +0900 @@ -56,7 +56,8 @@ name = "ExampleHVMDomain" # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 # Optionally define mac and/or bridge for the network interfaces. # Random MACs are assigned if not given. @@ -222,17 +223,54 @@ serial='pty' #----------------------------------------------------------------------------- # Configure guest CPUID responses: -#cpuid=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx, +# +#cpuid=[ '1:ecx=xxxxxxxxxxx00xxxxxxxxxxxxxxxxxxx, # eax=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ] -# - Set the VMX feature flag in the guest (CPUID_1:ECX:5) +# - Unset the SSE4 features (CPUID.1[ECX][20-19]) # - Default behaviour for all other bits in ECX And EAX registers. # # Each successive character represent a lesser-significant bit: # '1' -> force the corresponding bit to 1 # '0' -> force to 0 -# 'x' -> we don't care (default behaviour) +# 'x' -> Get a safe value (pass through and mask with the default policy) # 'k' -> pass through the host bit value # 's' -> as 'k' but preserve across save/restore and migration +# +# Expose to the guest multi-core cpu instead of multiple processors +# Example for intel, expose a 8-core processor : +#cpuid=['1:edx=xxx1xxxxxxxxxxxxxxxxxxxxxxxxxxxx, +# ebx=xxxxxxxx00010000xxxxxxxxxxxxxxxx', +# '4,0:eax=001111xxxxxxxxxxxxxxxxxxxxxxxxxx'] +# - CPUID.1[EDX][HT] : Enable HT +# - CPUID.1[EBX] : Number of vcpus * 2 +# - CPUID.4,0[EAX] : Number of vcpus * 2 - 1 +#vcpus=8 +# +# Example for amd, expose a 5-core processor : +# cpuid = ['1:ebx=xxxxxxxx00000001xxxxxxxxxxxxxxxx, +# edx=xxx1xxxxxxxxxxxxxxxxxxxxxxxxxxxx', +# '0x80000008:ecx=xxxxxxxxxxxxxxxx0000xxxx00001010'] +# - CPUID.1[EBX] : (Thread * Cores ) per processors +# - CPUID.1[EDX][HT] : Enable HT +# - CPUID.0x80000008[ECX] : Number of vcpus * 2 +#vcpus=5 +# +# Downgrade the cpuid to make a better compatibility for migration : +# Look like a PIII : +# cpuid = [ '0:eax=0x3', +# '1:eax=0x06b1, +# ecx=xxxxxxxxxx0000xx00xxx0000000xx0, +# edx=xx00000xxxxxxx0xxxxxxxxx0xxxxxx', +# '4:eax=0x3,ebx=0x756e6547,ecx=0x6c65746e,edx=0x49656e69', +# '0x80000000:eax=0x3,ebx=0x756e6547,ecx=0x6c65746e,edx=0x49656e69'] +# with the highest leaf +# - CPUID.0[EAX] : Set the highest leaf +# - CPUID.1[EAX] : Pentium III +# - CPUID.1[ECX] : Mask some features +# - CPUID.1[EDX] : Mask some features +# - CPUID.4 : Reply like the highest leaf, in our case CPUID.3 +# - CPUID.0x80000000 : No extension we are on a Pentium III, reply like the +# highest leaf (CPUID.3). # # Configure host CPUID consistency checks, which must be satisfied for this # VM to be allowed to run on this host's processor type: diff -r ef290f39ae6b -r c96507e0c83d tools/examples/xmexample.vti --- a/tools/examples/xmexample.vti Thu May 15 14:53:48 2008 +0900 +++ b/tools/examples/xmexample.vti Thu May 15 16:23:56 2008 +0900 @@ -33,7 +33,8 @@ name = "ExampleVTIDomain" # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 # Log2 of VHPT size, default=23 (8MB), minimum=15 (32KB). # In Windows OS, smaller size shows better performance. diff -r ef290f39ae6b -r c96507e0c83d tools/examples/xmexample1 --- a/tools/examples/xmexample1 Thu May 15 14:53:48 2008 +0900 +++ b/tools/examples/xmexample1 Thu May 15 16:23:56 2008 +0900 @@ -33,7 +33,8 @@ name = "ExampleDomain" # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 # Number of Virtual CPUS to use, default is 1 #vcpus = 1 @@ -90,7 +91,7 @@ disk = [ 'phy:hda1,hda1,w' ] # # Or you can bind the first unused port above 5900: # -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vnunused=1' ] +# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ] # # You can override the password: # diff -r ef290f39ae6b -r c96507e0c83d tools/examples/xmexample2 --- a/tools/examples/xmexample2 Thu May 15 14:53:48 2008 +0900 +++ b/tools/examples/xmexample2 Thu May 15 16:23:56 2008 +0900 @@ -62,7 +62,8 @@ name = "VM%d" % vmid # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 #cpus = "%s" % vmid # set based on vmid (mod number of CPUs) # Number of Virtual CPUS to use, default is 1 @@ -126,7 +127,7 @@ disk = [ 'phy:sda%d,sda1,w' % (7+vmid), # # Or you can bind the first unused port above 5900: # -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vnunused=1' ] +# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ] # # You can override the password: # diff -r ef290f39ae6b -r c96507e0c83d tools/examples/xmexample3 --- a/tools/examples/xmexample3 Thu May 15 14:53:48 2008 +0900 +++ b/tools/examples/xmexample3 Thu May 15 16:23:56 2008 +0900 @@ -62,7 +62,8 @@ name = "VM%d" % vmid # List of which CPUS this domain is allowed to use, default Xen picks #cpus = "" # leave to Xen to pick #cpus = "0" # all vcpus run on CPU0 -#cpus = "0-3,5,^1" # run on cpus 0,2,3,5 +#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5 +#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3 cpus = "%s" % vmid # set based on vmid (mod number of CPUs) #---------------------------------------------------------------------------- @@ -111,7 +112,7 @@ disk = [ 'phy:hda%d,hda1,w' % (vmid)] # # Or you can bind the first unused port above 5900: # -# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vnunused=1' ] +# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vncunused=1' ] # # You can override the password: # diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/block.c --- a/tools/ioemu/block.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/block.c Thu May 15 16:23:56 2008 +0900 @@ -254,7 +254,7 @@ static BlockDriver *find_protocol(const #endif p = strchr(filename, ':'); if (!p) - return &bdrv_raw; + return NULL; /* do not ever guess raw, it is a security problem! */ len = p - filename; if (len > sizeof(protocol) - 1) len = sizeof(protocol) - 1; diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/hw/ide.c --- a/tools/ioemu/hw/ide.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/hw/ide.c Thu May 15 16:23:56 2008 +0900 @@ -289,6 +289,7 @@ #define ASC_ILLEGAL_OPCODE 0x20 #define ASC_LOGICAL_BLOCK_OOR 0x21 #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 +#define ASC_MEDIUM_MAY_HAVE_CHANGED 0x28 #define ASC_MEDIUM_NOT_PRESENT 0x3a #define ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39 @@ -1456,6 +1457,11 @@ static void ide_atapi_cmd(IDEState *s) switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: if (bdrv_is_inserted(s->bs)) { + if (s->is_cdrom && s->sense_key == SENSE_NOT_READY) { + ide_atapi_cmd_error(s, SENSE_UNIT_ATTENTION, + ASC_MEDIUM_MAY_HAVE_CHANGED); + break; + } ide_atapi_cmd_ok(s); } else { ide_atapi_cmd_error(s, SENSE_NOT_READY, diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/hw/pass-through.c --- a/tools/ioemu/hw/pass-through.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/hw/pass-through.c Thu May 15 16:23:56 2008 +0900 @@ -205,6 +205,7 @@ void pt_iomem_map(PCIDevice *d, int i, u if ( !first_map ) { + add_msix_mapping(assigned_device, i); /* Remove old mapping */ ret = xc_domain_memory_mapping(xc_handle, domid, old_ebase >> XC_PAGE_SHIFT, @@ -227,6 +228,9 @@ void pt_iomem_map(PCIDevice *d, int i, u if ( ret != 0 ) PT_LOG("Error: create new mapping failed!\n"); + ret = remove_msix_mapping(assigned_device, i); + if ( ret != 0 ) + PT_LOG("Error: remove MSX-X mmio mapping failed!\n"); } /* Being called each time a pio region has been updated */ @@ -289,6 +293,9 @@ static void pt_pci_write_config(PCIDevic } if ( pt_msi_write(assigned_device, address, val, len) ) + return; + + if ( pt_msix_write(assigned_device, address, val, len) ) return; /* PCI config pass-through */ @@ -338,6 +345,7 @@ static uint32_t pt_pci_read_config(PCIDe } pt_msi_read(assigned_device, address, len, &val); + pt_msix_read(assigned_device, address, len, &val); exit: #ifdef PT_DEBUG_PCI_CONFIG_ACCESS @@ -549,6 +557,9 @@ struct pt_dev * register_real_device(PCI if ( (pos = find_cap_offset(pci_dev, PCI_CAP_ID_MSI)) ) pt_msi_init(assigned_device, pos); + if ( (pos = find_cap_offset(pci_dev, PCI_CAP_ID_MSIX)) ) + pt_msix_init(assigned_device, pos); + /* Handle real device's MMIO/PIO BARs */ pt_register_regions(assigned_device); diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/hw/pass-through.h --- a/tools/ioemu/hw/pass-through.h Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/hw/pass-through.h Thu May 15 16:23:56 2008 +0900 @@ -61,8 +61,26 @@ struct pt_msi_info { uint32_t flags; int offset; int size; - int pvec; /* physical vector used */ int pirq; /* guest pirq corresponding */ +}; + +struct msix_entry_info { + int pirq; /* -1 means unmapped */ + int flags; /* flags indicting whether MSI ADDR or DATA is updated */ + uint32_t io_mem[4]; +}; + +struct pt_msix_info { + int enabled; + int offset; + int total_entries; + int bar_index; + uint32_t table_off; + uint64_t mmio_base_addr; + int mmio_index; + int fd; + void *phys_iomem_base; + struct msix_entry_info msix_entry[0]; }; /* @@ -74,6 +92,7 @@ struct pt_dev { struct pci_dev *pci_dev; /* libpci struct */ struct pt_region bases[PCI_NUM_REGIONS]; /* Access regions */ struct pt_msi_info *msi; /* MSI virtualization */ + struct pt_msix_info *msix; /* MSI-X virtualization */ }; /* Used for formatting PCI BDF into cf8 format */ diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/hw/pt-msi.c --- a/tools/ioemu/hw/pt-msi.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/hw/pt-msi.c Thu May 15 16:23:56 2008 +0900 @@ -20,7 +20,9 @@ */ #include "pt-msi.h" - +#include + +/* MSI virtuailization functions */ #define PT_MSI_CTRL_WR_MASK_HI (0x1) #define PT_MSI_CTRL_WR_MASK_LO (0x8E) #define PT_MSI_DATA_WR_MASK (0x38) @@ -76,7 +78,7 @@ int pt_msi_init(struct pt_dev *dev, int */ static int pt_msi_setup(struct pt_dev *dev) { - int vector = -1, pirq = -1; + int pirq = -1; if ( !(dev->msi->flags & MSI_FLAG_UNINIT) ) { @@ -85,15 +87,15 @@ static int pt_msi_setup(struct pt_dev *d } if ( xc_physdev_map_pirq_msi(xc_handle, domid, MAP_PIRQ_TYPE_MSI, - vector, &pirq, + AUTO_ASSIGN, &pirq, dev->pci_dev->dev << 3 | dev->pci_dev->func, - dev->pci_dev->bus, 1) ) - { - PT_LOG("error map vector %x\n", vector); + dev->pci_dev->bus, 0, 1) ) + { + PT_LOG("error map msi\n"); return -1; } dev->msi->pirq = pirq; - PT_LOG("vector %x pirq %x\n", vector, pirq); + PT_LOG("msi mapped with pirq %x\n", pirq); return 0; } @@ -147,15 +149,10 @@ static uint8_t get_msi_gctrl(struct pt_d return *(uint8_t *)(pd->config + d->msi->offset + PCI_MSI_FLAGS); } -static uint32_t get_msi_gflags(struct pt_dev *d) +static uint32_t __get_msi_gflags(uint32_t data, uint64_t addr) { uint32_t result = 0; int rh, dm, dest_id, deliv_mode, trig_mode; - uint16_t data; - uint64_t addr; - - data = get_msi_gdata(d); - addr = get_msi_gaddr(d); rh = (addr >> MSI_ADDR_REDIRECTION_SHIFT) & 0x1; dm = (addr >> MSI_ADDR_DESTMODE_SHIFT) & 0x1; @@ -170,25 +167,20 @@ static uint32_t get_msi_gflags(struct pt return result; } +static uint32_t get_msi_gflags(struct pt_dev *d) +{ + uint16_t data = get_msi_gdata(d); + uint64_t addr = get_msi_gaddr(d); + + return __get_msi_gflags(data, addr); +} + /* * This may be arch different */ static inline uint8_t get_msi_gvec(struct pt_dev *d) { return get_msi_gdata(d) & 0xff; -} - -static inline uint8_t get_msi_hvec(struct pt_dev *d) -{ - struct pci_dev *pd = d->pci_dev; - uint16_t data; - - if ( d->msi->flags & PCI_MSI_FLAGS_64BIT ) - data = pci_read_word(pd, PCI_MSI_DATA_64); - else - data = pci_read_word(pd, PCI_MSI_DATA_32); - - return data & 0xff; } /* @@ -198,7 +190,7 @@ static int pt_msi_update(struct pt_dev * static int pt_msi_update(struct pt_dev *d) { PT_LOG("now update msi with pirq %x gvec %x\n", - get_msi_gvec(d), d->msi->pirq); + d->msi->pirq, get_msi_gvec(d)); return xc_domain_update_msi_irq(xc_handle, domid, get_msi_gvec(d), d->msi->pirq, get_msi_gflags(d)); } @@ -266,7 +258,6 @@ static int static int pt_msi_map_update(struct pt_dev *d, uint32_t old_data, uint64_t old_addr) { - uint16_t pctrl; uint32_t data; uint64_t addr; @@ -301,6 +292,8 @@ static int pt_msi_mask_update(struct pt_ if ( old_mask != mask ) pci_write_long(pd, offset, mask); + + return 0; } #define ACCESSED_DATA 0x2 @@ -486,3 +479,378 @@ int pt_msi_read(struct pt_dev *d, int ad return e_len; } +/* MSI-X virtulization functions */ +#define PT_MSIX_CTRL_WR_MASK_HI (0xC0) +static void mask_physical_msix_entry(struct pt_dev *dev, int entry_nr, int mask) +{ + void *phys_off; + + phys_off = dev->msix->phys_iomem_base + 16 * entry_nr + 12; + *(uint32_t *)phys_off = mask; +} + +static int pt_msix_update_one(struct pt_dev *dev, int entry_nr) +{ + struct msix_entry_info *entry = &dev->msix->msix_entry[entry_nr]; + int pirq = entry->pirq; + int gvec = entry->io_mem[2] & 0xff; + uint64_t gaddr = *(uint64_t *)&entry->io_mem[0]; + uint32_t gflags = __get_msi_gflags(entry->io_mem[2], gaddr); + int ret; + + if ( !entry->flags ) + return 0; + + /* Check if this entry is already mapped */ + if ( entry->pirq == -1 ) + { + ret = xc_physdev_map_pirq_msi(xc_handle, domid, MAP_PIRQ_TYPE_MSI, + AUTO_ASSIGN, &pirq, + dev->pci_dev->dev << 3 | dev->pci_dev->func, + dev->pci_dev->bus, entry_nr, 0); + if ( ret ) + { + PT_LOG("error map msix entry %x\n", entry_nr); + return ret; + } + entry->pirq = pirq; + } + + PT_LOG("now update msix entry %x with pirq %x gvec %x\n", + entry_nr, pirq, gvec); + + ret = xc_domain_update_msi_irq(xc_handle, domid, gvec, pirq, gflags); + if ( ret ) + { + PT_LOG("error update msix irq info for entry %d\n", entry_nr); + return ret; + } + + entry->flags = 0; + + return 0; +} + +static int pt_msix_update(struct pt_dev *dev) +{ + struct pt_msix_info *msix = dev->msix; + int i; + + for ( i = 0; i < msix->total_entries; i++ ) + { + pt_msix_update_one(dev, i); + } + + return 0; +} + +static void pci_msix_invalid_write(void *opaque, target_phys_addr_t addr, + uint32_t val) +{ + PT_LOG("invalid write to MSI-X table, \ + only dword access is allowed.\n"); +} + +static void pci_msix_writel(void *opaque, target_phys_addr_t addr, uint32_t val) +{ + struct pt_dev *dev = (struct pt_dev *)opaque; + struct pt_msix_info *msix = dev->msix; + struct msix_entry_info *entry; + int entry_nr, offset; + + if ( addr % 4 ) + { + PT_LOG("unaligned dword access to MSI-X table, addr %016lx\n", + addr); + return; + } + + entry_nr = (addr - msix->mmio_base_addr) / 16; + entry = &msix->msix_entry[entry_nr]; + offset = ((addr - msix->mmio_base_addr) % 16) / 4; + + if ( offset != 3 && msix->enabled && entry->io_mem[3] & 0x1 ) + { + PT_LOG("can not update msix entry %d since MSI-X is already \ + function now.\n", entry_nr); + return; + } + + if ( offset != 3 && entry->io_mem[offset] != val ) + entry->flags = 1; + entry->io_mem[offset] = val; + + if ( offset == 3 ) + { + if ( !(val & 0x1) ) + pt_msix_update_one(dev, entry_nr); + mask_physical_msix_entry(dev, entry_nr, entry->io_mem[3] & 0x1); + } +} + +static CPUWriteMemoryFunc *pci_msix_write[] = { + pci_msix_invalid_write, + pci_msix_invalid_write, + pci_msix_writel +}; + +static uint32_t pci_msix_invalid_read(void *opaque, target_phys_addr_t addr) +{ + PT_LOG("invalid read to MSI-X table, \ + only dword access is allowed.\n"); + return 0; +} + +static uint32_t pci_msix_readl(void *opaque, target_phys_addr_t addr) +{ + struct pt_dev *dev = (struct pt_dev *)opaque; + struct pt_msix_info *msix = dev->msix; + int entry_nr, offset; + + if ( addr % 4 ) + { + PT_LOG("unaligned dword access to MSI-X table, addr %016lx\n", + addr); + return 0; + } + + entry_nr = (addr - msix->mmio_base_addr) / 16; + offset = ((addr - msix->mmio_base_addr) % 16) / 4; + + return msix->msix_entry[entry_nr].io_mem[offset]; +} + +static CPUReadMemoryFunc *pci_msix_read[] = { + pci_msix_invalid_read, + pci_msix_invalid_read, + pci_msix_readl +}; + +int add_msix_mapping(struct pt_dev *dev, int bar_index) +{ + if ( !(dev->msix && dev->msix->bar_index == bar_index) ) + return 0; + + return xc_domain_memory_mapping(xc_handle, domid, + dev->msix->mmio_base_addr >> XC_PAGE_SHIFT, + (dev->bases[bar_index].access.maddr + + dev->msix->table_off) >> XC_PAGE_SHIFT, + (dev->msix->total_entries * 16 + + XC_PAGE_SIZE -1) >> XC_PAGE_SHIFT, + DPCI_ADD_MAPPING); +} + +int remove_msix_mapping(struct pt_dev *dev, int bar_index) +{ + if ( !(dev->msix && dev->msix->bar_index == bar_index) ) + return 0; + + dev->msix->mmio_base_addr = dev->bases[bar_index].e_physbase + + dev->msix->table_off; + + cpu_register_physical_memory(dev->msix->mmio_base_addr, + dev->msix->total_entries * 16, + dev->msix->mmio_index); + + return xc_domain_memory_mapping(xc_handle, domid, + dev->msix->mmio_base_addr >> XC_PAGE_SHIFT, + (dev->bases[bar_index].access.maddr + + dev->msix->table_off) >> XC_PAGE_SHIFT, + (dev->msix->total_entries * 16 + + XC_PAGE_SIZE -1) >> XC_PAGE_SHIFT, + DPCI_REMOVE_MAPPING); +} + +int pt_msix_init(struct pt_dev *dev, int pos) +{ + uint8_t id; + uint16_t flags, control; + int i, total_entries, table_off, bar_index; + uint64_t bar_base; + struct pci_dev *pd = dev->pci_dev; + + id = pci_read_byte(pd, pos + PCI_CAP_LIST_ID); + + if ( id != PCI_CAP_ID_MSIX ) + { + PT_LOG("error id %x pos %x\n", id, pos); + return -1; + } + + control = pci_read_word(pd, pos + 2); + total_entries = control & 0x7ff; + total_entries += 1; + + dev->msix = malloc(sizeof(struct pt_msix_info) + + total_entries*sizeof(struct msix_entry_info)); + if ( !dev->msix ) + { + PT_LOG("error allocation pt_msix_info\n"); + return -1; + } + memset(dev->msix, 0, sizeof(struct pt_msix_info) + + total_entries*sizeof(struct msix_entry_info)); + dev->msix->total_entries = total_entries; + dev->msix->offset = pos; + for ( i = 0; i < total_entries; i++ ) + dev->msix->msix_entry[i].pirq = -1; + + dev->msix->mmio_index = + cpu_register_io_memory(0, pci_msix_read, pci_msix_write, dev); + + flags = pci_read_word(pd, pos + PCI_MSI_FLAGS); + if ( flags & PCI_MSIX_ENABLE ) + { + PT_LOG("MSIX enabled already, disable first\n"); + pci_write_word(pd, pos + PCI_MSI_FLAGS, flags & ~PCI_MSIX_ENABLE); + *(uint16_t *)&dev->dev.config[pos + PCI_MSI_FLAGS] + = flags & ~(PCI_MSIX_ENABLE | PCI_MSIX_MASK); + } + + table_off = pci_read_long(pd, pos + PCI_MSIX_TABLE); + bar_index = dev->msix->bar_index = table_off & PCI_MSIX_BIR; + table_off &= table_off & ~PCI_MSIX_BIR; + bar_base = pci_read_long(pd, 0x10 + 4 * bar_index); + if ( (bar_base & 0x6) == 0x4 ) + { + bar_base &= ~0xf; + bar_base += (uint64_t)pci_read_long(pd, 0x10 + 4 * (bar_index + 1)) << 32; + } + PT_LOG("get MSI-X table bar base %lx\n", bar_base); + + dev->msix->fd = open("/dev/mem", O_RDWR); + dev->msix->phys_iomem_base = mmap(0, total_entries * 16, + PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED, + dev->msix->fd, bar_base + table_off); + PT_LOG("mapping physical MSI-X table to %lx\n", + (unsigned long)dev->msix->phys_iomem_base); + return 0; +} + +static int pt_msix_enable(struct pt_dev *d, int enable) +{ + uint16_t ctrl; + struct pci_dev *pd = d->pci_dev; + + if ( !pd ) + return -1; + + ctrl = pci_read_word(pd, d->msix->offset + PCI_MSI_FLAGS); + if ( enable ) + ctrl |= PCI_MSIX_ENABLE; + else + ctrl &= ~PCI_MSIX_ENABLE; + pci_write_word(pd, d->msix->offset + PCI_MSI_FLAGS, ctrl); + d->msix->enabled = !!enable; + + return 0; +} + +static int pt_msix_func_mask(struct pt_dev *d, int mask) +{ + uint16_t ctrl; + struct pci_dev *pd = d->pci_dev; + + if ( !pd ) + return -1; + + ctrl = pci_read_word(pd, d->msix->offset + PCI_MSI_FLAGS); + + if ( mask ) + ctrl |= PCI_MSIX_MASK; + else + ctrl &= ~PCI_MSIX_MASK; + + pci_write_word(pd, d->msix->offset + PCI_MSI_FLAGS, ctrl); + return 0; +} + +static int pt_msix_control_update(struct pt_dev *d) +{ + PCIDevice *pd = (PCIDevice *)d; + uint16_t ctrl = *(uint16_t *)(&pd->config[d->msix->offset + 2]); + + if ( ctrl & PCI_MSIX_ENABLE && !(ctrl & PCI_MSIX_MASK ) ) + pt_msix_update(d); + + pt_msix_func_mask(d, ctrl & PCI_MSIX_MASK); + pt_msix_enable(d, ctrl & PCI_MSIX_ENABLE); + + return 0; +} + +int pt_msix_write(struct pt_dev *d, uint32_t addr, uint32_t val, uint32_t len) +{ + struct pci_dev *pd; + int i, cur = addr; + uint8_t value; + PCIDevice *dev = (PCIDevice *)d; + + if ( !d || !d->msix ) + return 0; + + if ( (addr >= (d->msix->offset + 4) ) || + (addr + len) < d->msix->offset) + return 0; + + PT_LOG("addr %x val %x len %x offset %x\n", + addr, val, len, d->msix->offset); + + pd = d->pci_dev; + + for ( i = 0; i < len; i++, cur++ ) + { + uint8_t orig_value; + + if ( cur != d->msix->offset + 3 ) + continue; + + value = (val >> (i * 8)) & 0xff; + + orig_value = pci_read_byte(pd, cur); + value = (orig_value & ~PT_MSIX_CTRL_WR_MASK_HI) | + (value & PT_MSIX_CTRL_WR_MASK_HI); + dev->config[cur] = value; + pt_msix_control_update(d); + return 1; + } + + return 0; +} + +int pt_msix_read(struct pt_dev *d, int addr, int len, uint32_t *val) +{ + int e_addr = addr, e_len = len, offset = 0, i; + uint8_t e_val = 0; + PCIDevice *pd = (PCIDevice *)d; + + if ( !d || !d->msix ) + return 0; + + if ( (addr > (d->msix->offset + 3) ) || + (addr + len) <= d->msix->offset ) + return 0; + + if ( (addr + len ) > (d->msix->offset + 3) ) + e_len -= addr + len - d->msix->offset - 3; + + if ( addr < d->msix->offset ) + { + e_addr = d->msix->offset; + offset = d->msix->offset - addr; + e_len -= offset; + } + + for ( i = 0; i < e_len; i++ ) + { + e_val = *(uint8_t *)(&pd->config[e_addr] + i); + *val &= ~(0xff << ( (offset + i) * 8)); + *val |= (e_val << ( (offset + i) * 8)); + } + + PT_LOG("addr %x len %x val %x offset %x\n", + addr, len, *val, d->msix->offset); + + return e_len; +} + diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/hw/pt-msi.h --- a/tools/ioemu/hw/pt-msi.h Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/hw/pt-msi.h Thu May 15 16:23:56 2008 +0900 @@ -62,4 +62,19 @@ int int pt_msi_read(struct pt_dev *d, int addr, int len, uint32_t *val); +int +remove_msix_mapping(struct pt_dev *dev, int bar_index); + +int +add_msix_mapping(struct pt_dev *dev, int bar_index); + +int +pt_msix_init(struct pt_dev *dev, int pos); + +int +pt_msix_write(struct pt_dev *d, uint32_t addr, uint32_t val, uint32_t len); + +int +pt_msix_read(struct pt_dev *d, int addr, int len, uint32_t *val); + #endif diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/hw/xenfb.c Thu May 15 16:23:56 2008 +0900 @@ -29,8 +29,6 @@ #define BTN_LEFT 0x110 /* from */ #endif -// FIXME defend against malicious frontend? - struct xenfb; struct xenfb_device { @@ -59,6 +57,7 @@ struct xenfb { int offset; /* offset of the framebuffer */ int abs_pointer_wanted; /* Whether guest supports absolute pointer */ int button_state; /* Last seen pointer button state */ + int refresh_period; /* The refresh period we have advised */ char protocol[64]; /* frontend protocol */ }; @@ -483,6 +482,68 @@ void xenfb_shutdown(struct xenfb *xenfb) free(xenfb); } +static int xenfb_configure_fb(struct xenfb *xenfb, size_t fb_len_lim, + int width, int height, int depth, + size_t fb_len, int offset, int row_stride) +{ + size_t mfn_sz = sizeof(*((struct xenfb_page *)0)->pd); + size_t pd_len = sizeof(((struct xenfb_page *)0)->pd) / mfn_sz; + size_t fb_pages = pd_len * XC_PAGE_SIZE / mfn_sz; + size_t fb_len_max = fb_pages * XC_PAGE_SIZE; + int max_width, max_height; + + if (fb_len_lim > fb_len_max) { + fprintf(stderr, + "FB: fb size limit %zu exceeds %zu, corrected\n", + fb_len_lim, fb_len_max); + fb_len_lim = fb_len_max; + } + if (fb_len > fb_len_lim) { + fprintf(stderr, + "FB: frontend fb size %zu limited to %zu\n", + fb_len, fb_len_lim); + } + if (depth != 8 && depth != 16 && depth != 24 && depth != 32) { + fprintf(stderr, + "FB: can't handle frontend fb depth %d\n", + depth); + return -1; + } + if (row_stride < 0 || row_stride > fb_len) { + fprintf(stderr, + "FB: invalid frontend stride %d\n", row_stride); + return -1; + } + max_width = row_stride / (depth / 8); + if (width < 0 || width > max_width) { + fprintf(stderr, + "FB: invalid frontend width %d limited to %d\n", + width, max_width); + width = max_width; + } + if (offset < 0 || offset >= fb_len) { + fprintf(stderr, + "FB: invalid frontend offset %d (max %zu)\n", + offset, fb_len - 1); + return -1; + } + max_height = (fb_len - offset) / row_stride; + if (height < 0 || height > max_height) { + fprintf(stderr, + "FB: invalid frontend height %d limited to %d\n", + height, max_height); + height = max_height; + } + xenfb->fb_len = fb_len; + xenfb->row_stride = row_stride; + xenfb->depth = depth; + xenfb->width = width; + xenfb->height = height; + xenfb->offset = offset; + fprintf(stderr, "Framebuffer %dx%dx%d offset %d stride %d\n", + width, height, depth, offset, row_stride); + return 0; +} static void xenfb_on_fb_event(struct xenfb *xenfb) { @@ -513,16 +574,18 @@ static void xenfb_on_fb_event(struct xen || h != event->update.height) { fprintf(stderr, "%s bogus update clipped\n", xenfb->fb.nodename); - break; } xenfb_guest_copy(xenfb, x, y, w, h); break; case XENFB_TYPE_RESIZE: - xenfb->width = event->resize.width; - xenfb->height = event->resize.height; - xenfb->depth = event->resize.depth; - xenfb->row_stride = event->resize.stride; - xenfb->offset = event->resize.offset; + if (xenfb_configure_fb(xenfb, xenfb->fb_len, + event->resize.width, + event->resize.height, + event->resize.depth, + xenfb->fb_len, + event->resize.offset, + event->resize.stride) < 0) + break; dpy_colourdepth(xenfb->ds, xenfb->depth); dpy_resize(xenfb->ds, xenfb->width, xenfb->height, xenfb->row_stride); if (xenfb->ds->shared_buf) @@ -534,6 +597,41 @@ static void xenfb_on_fb_event(struct xen xen_mb(); /* ensure we're done with ring contents */ page->out_cons = cons; xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port); +} + +static int xenfb_queue_full(struct xenfb *xenfb) +{ + struct xenfb_page *page = xenfb->fb.page; + uint32_t cons, prod; + + prod = page->in_prod; + cons = page->in_cons; + return prod - cons == XENFB_IN_RING_LEN; +} + +static void xenfb_send_event(struct xenfb *xenfb, union xenfb_in_event *event) +{ + uint32_t prod; + struct xenfb_page *page = xenfb->fb.page; + + prod = page->in_prod; + /* caller ensures !xenfb_queue_full() */ + xen_mb(); /* ensure ring space available */ + XENFB_IN_RING_REF(page, prod) = *event; + xen_wmb(); /* ensure ring contents visible */ + page->in_prod = prod + 1; + + xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port); +} + +static void xenfb_send_refresh_period(struct xenfb *xenfb, int period) +{ + union xenfb_in_event event; + + memset(&event, 0, sizeof(event)); + event.type = XENFB_TYPE_REFRESH_PERIOD; + event.refresh_period.period = period; + xenfb_send_event(xenfb, &event); } static void xenfb_on_kbd_event(struct xenfb *xenfb) @@ -707,30 +805,20 @@ static int xenfb_read_frontend_fb_config xenfb->protocol) < 0) xenfb->protocol[0] = '\0'; xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "request-update", "1"); - - /* TODO check for permitted ranges */ - fb_page = xenfb->fb.page; - xenfb->depth = fb_page->depth; - xenfb->width = fb_page->width; - xenfb->height = fb_page->height; - /* TODO check for consistency with the above */ - xenfb->fb_len = fb_page->mem_length; - xenfb->row_stride = fb_page->line_length; - - /* Protect against hostile frontend, limit fb_len to max allowed */ + xenfb->refresh_period = -1; + if (xenfb_xs_scanf1(xenfb->xsh, xenfb->fb.nodename, "videoram", "%d", &videoram) < 0) videoram = 0; - videoram = videoram * 1024 * 1024; - if (videoram && xenfb->fb_len > videoram) { - fprintf(stderr, "Framebuffer requested length of %zd exceeded allowed %d\n", - xenfb->fb_len, videoram); - xenfb->fb_len = videoram; - if (xenfb->row_stride * xenfb->height > xenfb->fb_len) - xenfb->height = xenfb->fb_len / xenfb->row_stride; - } - fprintf(stderr, "Framebuffer depth %d width %d height %d line %d\n", - fb_page->depth, fb_page->width, fb_page->height, fb_page->line_length); + fb_page = xenfb->fb.page; + if (xenfb_configure_fb(xenfb, videoram * 1024 * 1024U, + fb_page->width, fb_page->height, fb_page->depth, + fb_page->mem_length, 0, fb_page->line_length) + < 0) { + errno = EINVAL; + return -1; + } + if (xenfb_map_fb(xenfb, xenfb->fb.otherend_id) < 0) return -1; @@ -1185,10 +1273,28 @@ static void xenfb_guest_copy(struct xenf dpy_update(xenfb->ds, x, y, w, h); } -/* Periodic update of display, no need for any in our case */ +/* Periodic update of display, transmit the refresh interval to the frontend */ static void xenfb_update(void *opaque) { struct xenfb *xenfb = opaque; + int period; + + if (xenfb_queue_full(xenfb)) + return; + + if (xenfb->ds->idle) + period = XENFB_NO_REFRESH; + else { + period = xenfb->ds->gui_timer_interval; + if (!period) + period = GUI_REFRESH_INTERVAL; + } + + /* Will have to be disabled for frontends without feature-update */ + if (xenfb->refresh_period != period) { + xenfb_send_refresh_period(xenfb, period); + xenfb->refresh_period = period; + } } /* QEMU display state changed, so refresh the framebuffer copy */ @@ -1232,11 +1338,17 @@ static int xenfb_register_console(struct } #ifdef CONFIG_STUBDOM -static struct semaphore kbd_sem = __SEMAPHORE_INITIALIZER(kbd_sem, 0); -static struct kbdfront_dev *kbd_dev; +typedef struct XenFBState { + struct semaphore kbd_sem; + struct kbdfront_dev *kbd_dev; + struct fbfront_dev *fb_dev; + void *vga_vram, *nonshared_vram; + DisplayState *ds; +} XenFBState; + +XenFBState *xs; + static char *kbd_path, *fb_path; -static void *vga_vram, *nonshared_vram; -static DisplayState *xenfb_ds; static unsigned char linux2scancode[KEY_MAX + 1]; @@ -1254,7 +1366,8 @@ int xenfb_connect_vfb(const char *path) static void xenfb_pv_update(DisplayState *ds, int x, int y, int w, int h) { - struct fbfront_dev *fb_dev = ds->opaque; + XenFBState *xs = ds->opaque; + struct fbfront_dev *fb_dev = xs->fb_dev; if (!fb_dev) return; fbfront_update(fb_dev, x, y, w, h); @@ -1262,7 +1375,8 @@ static void xenfb_pv_update(DisplayState static void xenfb_pv_resize(DisplayState *ds, int w, int h, int linesize) { - struct fbfront_dev *fb_dev = ds->opaque; + XenFBState *xs = ds->opaque; + struct fbfront_dev *fb_dev = xs->fb_dev; fprintf(stderr,"resize to %dx%d, %d required\n", w, h, linesize); ds->width = w; ds->height = h; @@ -1276,14 +1390,15 @@ static void xenfb_pv_resize(DisplayState if (ds->shared_buf) { ds->data = NULL; } else { - ds->data = nonshared_vram; + ds->data = xs->nonshared_vram; fbfront_resize(fb_dev, w, h, linesize, ds->depth, VGA_RAM_SIZE); } } static void xenfb_pv_colourdepth(DisplayState *ds, int depth) { - struct fbfront_dev *fb_dev = ds->opaque; + XenFBState *xs = ds->opaque; + struct fbfront_dev *fb_dev = xs->fb_dev; static int lastdepth = -1; if (!depth) { ds->shared_buf = 0; @@ -1301,15 +1416,16 @@ static void xenfb_pv_colourdepth(Display if (ds->shared_buf) { ds->data = NULL; } else { - ds->data = nonshared_vram; + ds->data = xs->nonshared_vram; fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, VGA_RAM_SIZE); } } static void xenfb_pv_setdata(DisplayState *ds, void *pixels) { - struct fbfront_dev *fb_dev = ds->opaque; - int offset = pixels - vga_vram; + XenFBState *xs = ds->opaque; + struct fbfront_dev *fb_dev = xs->fb_dev; + int offset = pixels - xs->vga_vram; ds->data = pixels; if (!fb_dev) return; @@ -1321,16 +1437,45 @@ static void xenfb_pv_refresh(DisplayStat vga_hw_update(); } +static void xenfb_fb_handler(void *opaque) +{ +#define FB_NUM_BATCH 4 + union xenfb_in_event buf[FB_NUM_BATCH]; + int n, i; + XenFBState *xs = opaque; + DisplayState *ds = xs->ds; + + n = fbfront_receive(xs->fb_dev, buf, FB_NUM_BATCH); + for (i = 0; i < n; i++) { + switch (buf[i].type) { + case XENFB_TYPE_REFRESH_PERIOD: + if (buf[i].refresh_period.period == XENFB_NO_REFRESH) { + /* Sleeping interval */ + ds->idle = 1; + ds->gui_timer_interval = 500; + } else { + /* Set interval */ + ds->idle = 0; + ds->gui_timer_interval = buf[i].refresh_period.period; + } + default: + /* ignore unknown events */ + break; + } + } +} + static void xenfb_kbd_handler(void *opaque) { #define KBD_NUM_BATCH 64 union xenkbd_in_event buf[KBD_NUM_BATCH]; int n, i; - DisplayState *s = opaque; + XenFBState *xs = opaque; + DisplayState *s = xs->ds; static int buttons; static int x, y; - n = kbdfront_receive(kbd_dev, buf, KBD_NUM_BATCH); + n = kbdfront_receive(xs->kbd_dev, buf, KBD_NUM_BATCH); for (i = 0; i < n; i++) { switch (buf[i].type) { @@ -1412,12 +1557,13 @@ static void kbdfront_thread(void *p) static void kbdfront_thread(void *p) { int scancode, keycode; - kbd_dev = init_kbdfront(p, 1); - if (!kbd_dev) { + XenFBState *xs = p; + xs->kbd_dev = init_kbdfront(kbd_path, 1); + if (!xs->kbd_dev) { fprintf(stderr,"can't open keyboard\n"); exit(1); } - up(&kbd_sem); + up(&xs->kbd_sem); for (scancode = 0; scancode < 128; scancode++) { keycode = atkbd_set2_keycode[atkbd_unxlate_table[scancode]]; linux2scancode[keycode] = scancode; @@ -1431,12 +1577,18 @@ int xenfb_pv_display_init(DisplayState * if (!fb_path || !kbd_path) return -1; - create_thread("kbdfront", kbdfront_thread, (void*) kbd_path); - - xenfb_ds = ds; - - ds->data = nonshared_vram = qemu_memalign(PAGE_SIZE, VGA_RAM_SIZE); + xs = qemu_mallocz(sizeof(XenFBState)); + if (!xs) + return -1; + + init_SEMAPHORE(&xs->kbd_sem, 0); + xs->ds = ds; + + create_thread("kbdfront", kbdfront_thread, (void*) xs); + + ds->data = xs->nonshared_vram = qemu_memalign(PAGE_SIZE, VGA_RAM_SIZE); memset(ds->data, 0, VGA_RAM_SIZE); + ds->opaque = xs; ds->depth = 32; ds->bgr = 0; ds->width = 640; @@ -1452,9 +1604,9 @@ int xenfb_pv_display_init(DisplayState * int xenfb_pv_display_start(void *data) { - DisplayState *ds = xenfb_ds; + DisplayState *ds; struct fbfront_dev *fb_dev; - int kbd_fd; + int kbd_fd, fb_fd; int offset = 0; unsigned long *mfns; int n = VGA_RAM_SIZE / PAGE_SIZE; @@ -1463,12 +1615,13 @@ int xenfb_pv_display_start(void *data) if (!fb_path || !kbd_path) return 0; - vga_vram = data; + ds = xs->ds; + xs->vga_vram = data; mfns = malloc(2 * n * sizeof(*mfns)); for (i = 0; i < n; i++) - mfns[i] = virtual_to_mfn(vga_vram + i * PAGE_SIZE); + mfns[i] = virtual_to_mfn(xs->vga_vram + i * PAGE_SIZE); for (i = 0; i < n; i++) - mfns[n + i] = virtual_to_mfn(nonshared_vram + i * PAGE_SIZE); + mfns[n + i] = virtual_to_mfn(xs->nonshared_vram + i * PAGE_SIZE); fb_dev = init_fbfront(fb_path, mfns, ds->width, ds->height, ds->depth, ds->linesize, 2 * n); free(mfns); @@ -1479,21 +1632,24 @@ int xenfb_pv_display_start(void *data) free(fb_path); if (ds->shared_buf) { - offset = (void*) ds->data - vga_vram; + offset = (void*) ds->data - xs->vga_vram; } else { offset = VGA_RAM_SIZE; - ds->data = nonshared_vram; + ds->data = xs->nonshared_vram; } if (offset) fbfront_resize(fb_dev, ds->width, ds->height, ds->linesize, ds->depth, offset); - down(&kbd_sem); + down(&xs->kbd_sem); free(kbd_path); - kbd_fd = kbdfront_open(kbd_dev); - qemu_set_fd_handler(kbd_fd, xenfb_kbd_handler, NULL, ds); - - xenfb_ds->opaque = fb_dev; + kbd_fd = kbdfront_open(xs->kbd_dev); + qemu_set_fd_handler(kbd_fd, xenfb_kbd_handler, NULL, xs); + + fb_fd = fbfront_open(fb_dev); + qemu_set_fd_handler(fb_fd, xenfb_fb_handler, NULL, xs); + + xs->fb_dev = fb_dev; return 0; } #endif diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/keymaps.c --- a/tools/ioemu/keymaps.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/keymaps.c Thu May 15 16:23:56 2008 +0900 @@ -50,6 +50,7 @@ typedef struct { struct key_range *keypad_range; struct key_range *numlock_range; struct key_range *shift_range; + struct key_range *localstate_range; } kbd_layout_t; static void add_to_key_range(struct key_range **krp, int code) { @@ -132,6 +133,10 @@ static kbd_layout_t *parse_keyboard_layo add_to_key_range(&k->shift_range, keysym); //fprintf(stderr, "shift keysym %04x keycode %d\n", keysym, keycode); } + if (rest && strstr(rest, "localstate")) { + add_to_key_range(&k->localstate_range, keycode); + //fprintf(stderr, "localstate keysym %04x keycode %d\n", keysym, keycode); + } /* if(keycode&0x80) keycode=(keycode<<8)^0x80e0; */ @@ -221,3 +226,14 @@ static int keysymIsShift(void *kbd_layou return 1; return 0; } + +static int keycodeIsShiftable(void *kbd_layout, int keycode) +{ + kbd_layout_t *k = kbd_layout; + struct key_range *kr; + + for (kr = k->localstate_range; kr; kr = kr->next) + if (keycode >= kr->start && keycode <= kr->end) + return 0; + return 1; +} diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/sdl.c --- a/tools/ioemu/sdl.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/sdl.c Thu May 15 16:23:56 2008 +0900 @@ -696,9 +696,11 @@ static void sdl_refresh(DisplayState *ds if (ev->active.gain) { /* Back to default interval */ ds->gui_timer_interval = 0; + ds->idle = 0; } else { /* Sleeping interval */ ds->gui_timer_interval = 500; + ds->idle = 1; } } break; diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/vl.c --- a/tools/ioemu/vl.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/vl.c Thu May 15 16:23:56 2008 +0900 @@ -130,8 +130,6 @@ #else #define DEFAULT_RAM_SIZE 128 #endif -/* in ms */ -#define GUI_REFRESH_INTERVAL 30 /* Max number of USB devices that can be specified on the commandline. */ #define MAX_USB_CMDLINE 8 @@ -4467,6 +4465,8 @@ void dumb_display_init(DisplayState *ds) ds->dpy_resize = dumb_resize; ds->dpy_colourdepth = NULL; ds->dpy_refresh = dumb_refresh; + ds->gui_timer_interval = 500; + ds->idle = 1; } /***********************************************************/ diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/vl.h --- a/tools/ioemu/vl.h Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/vl.h Thu May 15 16:23:56 2008 +0900 @@ -929,6 +929,9 @@ extern struct soundhw soundhw[]; #define VGA_RAM_SIZE (8192 * 1024) +/* in ms */ +#define GUI_REFRESH_INTERVAL 30 + struct DisplayState { uint8_t *data; int linesize; @@ -939,6 +942,7 @@ struct DisplayState { void *opaque; uint32_t *palette; uint64_t gui_timer_interval; + int idle; int shared_buf; diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/vnc.c --- a/tools/ioemu/vnc.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/vnc.c Thu May 15 16:23:56 2008 +0900 @@ -778,6 +778,7 @@ static void _vnc_update_client(void *opa vs->has_update = 0; vnc_flush(vs); vs->last_update_time = now; + vs->ds->idle = 0; vs->timer_interval /= 2; if (vs->timer_interval < VNC_REFRESH_INTERVAL_BASE) @@ -790,26 +791,29 @@ static void _vnc_update_client(void *opa vs->timer_interval += VNC_REFRESH_INTERVAL_INC; if (vs->timer_interval > VNC_REFRESH_INTERVAL_MAX) { vs->timer_interval = VNC_REFRESH_INTERVAL_MAX; - if (now - vs->last_update_time >= VNC_MAX_UPDATE_INTERVAL && - vs->update_requested) { - /* Send a null update. If the client is no longer - interested (e.g. minimised) it'll ignore this, and we - can stop scanning the buffer until it sends another - update request. */ - /* It turns out that there's a bug in realvncviewer 4.1.2 - which means that if you send a proper null update (with - no update rectangles), it gets a bit out of sync and - never sends any further requests, regardless of whether - it needs one or not. Fix this by sending a single 1x1 - update rectangle instead. */ - vnc_write_u8(vs, 0); - vnc_write_u8(vs, 0); - vnc_write_u16(vs, 1); - send_framebuffer_update(vs, 0, 0, 1, 1); - vnc_flush(vs); - vs->last_update_time = now; - vs->update_requested--; - return; + if (now - vs->last_update_time >= VNC_MAX_UPDATE_INTERVAL) { + if (!vs->update_requested) { + vs->ds->idle = 1; + } else { + /* Send a null update. If the client is no longer + interested (e.g. minimised) it'll ignore this, and we + can stop scanning the buffer until it sends another + update request. */ + /* It turns out that there's a bug in realvncviewer 4.1.2 + which means that if you send a proper null update (with + no update rectangles), it gets a bit out of sync and + never sends any further requests, regardless of whether + it needs one or not. Fix this by sending a single 1x1 + update rectangle instead. */ + vnc_write_u8(vs, 0); + vnc_write_u8(vs, 0); + vnc_write_u16(vs, 1); + send_framebuffer_update(vs, 0, 0, 1, 1); + vnc_flush(vs); + vs->last_update_time = now; + vs->update_requested--; + return; + } } } qemu_mod_timer(vs->timer, now + vs->timer_interval); @@ -970,6 +974,7 @@ static int vnc_client_io_error(VncState qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL); closesocket(vs->csock); vs->csock = -1; + vs->ds->idle = 1; buffer_reset(&vs->input); buffer_reset(&vs->output); free_queue(vs); @@ -1302,6 +1307,7 @@ static void do_key_event(VncState *vs, i int keycode; int shift_keys = 0; int shift = 0; + int keypad = 0; if (is_graphic_console()) { if (sym >= 'A' && sym <= 'Z') { @@ -1328,6 +1334,8 @@ static void do_key_event(VncState *vs, i case 0x9d: /* Right CTRL */ case 0x38: /* Left ALT */ case 0xb8: /* Right ALT */ + if (keycode & 0x80) + kbd_put_keycode(0xe0); if (down) { vs->modifiers_state[keycode] = 1; kbd_put_keycode(keycode & 0x7f); @@ -1356,7 +1364,8 @@ static void do_key_event(VncState *vs, i return; } - if (keycodeIsKeypad(vs->kbd_layout, keycode)) { + keypad = keycodeIsKeypad(vs->kbd_layout, keycode); + if (keypad) { /* If the numlock state needs to change then simulate an additional keypress before sending this one. This will happen if the user toggles numlock away from the VNC window. @@ -1376,13 +1385,14 @@ static void do_key_event(VncState *vs, i if (is_graphic_console()) { /* If the shift state needs to change then simulate an additional - keypress before sending this one. + keypress before sending this one. Ignore for non shiftable keys. */ if (shift && !shift_keys) { press_key_shift_down(vs, down, keycode); return; } - else if (!shift && shift_keys) { + else if (!shift && shift_keys && !keypad && + keycodeIsShiftable(vs->kbd_layout, keycode)) { press_key_shift_up(vs, down, keycode); return; } @@ -2443,6 +2453,7 @@ static void vnc_listen_read(void *opaque vs->csock = accept(vs->lsock, (struct sockaddr *)&addr, &addrlen); if (vs->csock != -1) { VNC_DEBUG("New client on socket %d\n", vs->csock); + vs->ds->idle = 0; socket_set_nonblock(vs->csock); qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, opaque); vnc_write(vs, "RFB 003.008\n", 12); @@ -2468,6 +2479,7 @@ void vnc_display_init(DisplayState *ds) exit(1); ds->opaque = vs; + ds->idle = 1; vnc_state = vs; vs->display = NULL; vs->password = NULL; diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/vnc_keysym.h --- a/tools/ioemu/vnc_keysym.h Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/vnc_keysym.h Thu May 15 16:23:56 2008 +0900 @@ -345,6 +345,7 @@ static name2keysym_t name2keysym[]={ {"Num_Lock", 0xff7f}, /* XK_Num_Lock */ {"Pause", 0xff13}, /* XK_Pause */ {"Escape", 0xff1b}, /* XK_Escape */ +{"ISO_Left_Tab", 0xfe20},/* XK_ISO_Left_Tab */ /* localized keys */ {"BackApostrophe", 0xff21}, diff -r ef290f39ae6b -r c96507e0c83d tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/ioemu/xenstore.c Thu May 15 16:23:56 2008 +0900 @@ -90,6 +90,7 @@ void xenstore_parse_domain_config(int hv int i, is_scsi, is_hdN = 0; unsigned int len, num, hd_index, pci_devid = 0; BlockDriverState *bs; + BlockDriver *format; for(i = 0; i < MAX_DISKS + MAX_SCSI_DISKS; i++) media_filename[i] = NULL; @@ -135,6 +136,8 @@ void xenstore_parse_domain_config(int hv } for (i = 0; i < num; i++) { + format = NULL; /* don't know what the format is yet */ + /* read the backend path */ if (pasprintf(&buf, "%s/device/vbd/%s/backend", path, e[i]) == -1) continue; @@ -181,13 +184,20 @@ void xenstore_parse_domain_config(int hv drv = xs_read(xsh, XBT_NULL, buf, &len); if (drv == NULL) continue; - /* Strip off blktap sub-type prefix aio: - QEMU can autodetect this */ + /* Obtain blktap sub-type prefix */ if (!strcmp(drv, "tap") && params[0]) { char *offset = strchr(params, ':'); if (!offset) continue ; + free(drv); + drv = malloc(offset - params + 1); + memcpy(drv, params, offset - params); + drv[offset - params] = '\0'; + if (!strcmp(drv, "aio")) + /* qemu does aio anyway if it can */ + format = &bdrv_raw; memmove(params, offset+1, strlen(offset+1)+1 ); - fprintf(logfile, "Strip off blktap sub-type prefix to %s\n", params); + fprintf(logfile, "Strip off blktap sub-type prefix to %s (drv '%s')\n", params, drv); } /* Prefix with /dev/ if needed */ if (!strcmp(drv, "phy") && params[0] != '/') { @@ -195,6 +205,7 @@ void xenstore_parse_domain_config(int hv sprintf(newparams, "/dev/%s", params); free(params); params = newparams; + format = &bdrv_raw; } /* @@ -240,8 +251,25 @@ void xenstore_parse_domain_config(int hv #endif if (params[0]) { - if (bdrv_open(bs, params, 0 /* snapshot */) < 0) - fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s'\n", buf, params); + if (!format) { + if (!drv) { + fprintf(stderr, "qemu: type (image format) not specified for vbd '%s' or image '%s'\n", buf, params); + continue; + } + if (!strcmp(drv,"qcow")) { + /* autoguess qcow vs qcow2 */ + } else if (!strcmp(drv,"file") || !strcmp(drv,"phy")) { + format = &bdrv_raw; + } else { + format = bdrv_find_format(drv); + if (!format) { + fprintf(stderr, "qemu: type (image format) '%s' unknown for vbd '%s' or image '%s'\n", drv, buf, params); + continue; + } + } + } + if (bdrv_open2(bs, params, 0 /* snapshot */, format) < 0) + fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s')\n", buf, params, drv ? drv : "?"); } } diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/Makefile --- a/tools/libxc/Makefile Thu May 15 14:53:48 2008 +0900 +++ b/tools/libxc/Makefile Thu May 15 16:23:56 2008 +0900 @@ -9,7 +9,6 @@ CTRL_SRCS-y += xc_core.c CTRL_SRCS-y += xc_core.c CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c -CTRL_SRCS-$(CONFIG_POWERPC) += xc_core_powerpc.c endif CTRL_SRCS-y += xc_domain.c CTRL_SRCS-y += xc_evtchn.c @@ -55,7 +54,6 @@ GUEST_SRCS-$(CONFIG_X86) += xc_dom_x GUEST_SRCS-$(CONFIG_X86) += xc_dom_x86.c GUEST_SRCS-$(CONFIG_X86) += xc_cpuid_x86.c GUEST_SRCS-$(CONFIG_IA64) += xc_dom_ia64.c -GUEST_SRCS-$(CONFIG_POWERPC) += xc_dom_powerpc.c endif -include $(XEN_TARGET_ARCH)/Makefile diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/powerpc64/Makefile --- a/tools/libxc/powerpc64/Makefile Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -GUEST_SRCS-y += powerpc64/flatdevtree.c -GUEST_SRCS-y += powerpc64/mk_flatdevtree.c - -CTRL_SRCS-y += powerpc64/xc_memory.c diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/powerpc64/flatdevtree.c --- a/tools/libxc/powerpc64/flatdevtree.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,662 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright Pantelis Antoniou 2006 - * Copyright IBM Corporation 2006, 2007 - * 2006 (c) MontaVista, Software, Inc. - * - * Authors: Pantelis Antoniou - * Hollis Blanchard - * Mark A. Greer - */ - -#include "flatdevtree.h" - -/* Set ptrs to current one's info; return addr of next one */ -static u32 *ft_next(u32 *p, const u32 *p_strings, const u32 version, - u32 **tagpp, char **namepp, char **datapp, u32 **sizepp) -{ - u32 sz; - - *namepp = NULL; - *datapp = NULL; - *sizepp = NULL; - *tagpp = p; - - switch (be32_to_cpu(*p++)) { /* Tag */ - case OF_DT_BEGIN_NODE: - *namepp = (char *)p; - p = (u32 *)_ALIGN((unsigned long)p + strlen((char *)p) + 1, 4); - break; - case OF_DT_PROP: - sz = be32_to_cpu(*p); - *sizepp = p++; - *namepp = (char *)p_strings + be32_to_cpu(*p++); - if ((version < 0x10) && (sz >= 8)) - p = (u32 *)_ALIGN((unsigned long)p, 8); - *datapp = (char *)p; - p = (u32 *)_ALIGN((unsigned long)p + sz, 4); - break; - case OF_DT_END_NODE: - case OF_DT_NOP: - break; - case OF_DT_END: - default: - p = NULL; - break; - } - - return p; -} - -static void ft_put_word(struct ft_cxt *cxt, u32 v) -{ - if (cxt->overflow) /* do nothing */ - return; - - /* check for overflow */ - if (cxt->p + 4 > cxt->pstr) { - cxt->overflow = 1; - return; - } - - *(u32 *) cxt->p = cpu_to_be32(v); - cxt->p += 4; -} - -static inline void ft_put_bin(struct ft_cxt *cxt, const void *data, int sz) -{ - char *p; - - if (cxt->overflow) /* do nothing */ - return; - - /* next pointer pos */ - p = (char *) _ALIGN((unsigned long)cxt->p + sz, 4); - - /* check for overflow */ - if (p > cxt->pstr) { - cxt->overflow = 1; - return; - } - - memcpy(cxt->p, data, sz); - if ((sz & 3) != 0) - memset(cxt->p + sz, 0, 4 - (sz & 3)); - cxt->p = p; -} - -void ft_begin_node(struct ft_cxt *cxt, const char *name) -{ - ft_put_word(cxt, OF_DT_BEGIN_NODE); - ft_put_bin(cxt, name, strlen(name) + 1); -} - -void ft_end_node(struct ft_cxt *cxt) -{ - ft_put_word(cxt, OF_DT_END_NODE); -} - -void ft_nop(struct ft_cxt *cxt) -{ - ft_put_word(cxt, OF_DT_NOP); -} - -static int lookup_string(struct ft_cxt *cxt, const char *name) -{ - char *p; - - p = cxt->pstr; - while (p < cxt->pstr_begin) { - if (strcmp(p, (char *)name) == 0) - return p - cxt->p_begin; - p += strlen(p) + 1; - } - - return -1; -} - -void ft_prop(struct ft_cxt *cxt, const char *name, - const void *data, unsigned int sz) -{ - int len, off; - - if (cxt->overflow) - return; - - len = strlen(name) + 1; - - off = lookup_string(cxt, name); - if (off == -1) { - /* check if we have space */ - if (cxt->p + 12 + sz + len > cxt->pstr) { - cxt->overflow = 1; - return; - } - - cxt->pstr -= len; - memcpy(cxt->pstr, name, len); - off = cxt->pstr - cxt->p_begin; - } - - /* now put offset from beginning of *STRUCTURE* */ - /* will be fixed up at the end */ - ft_put_word(cxt, OF_DT_PROP); - ft_put_word(cxt, sz); - ft_put_word(cxt, off); - ft_put_bin(cxt, data, sz); -} - -void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str) -{ - ft_prop(cxt, name, str, strlen(str) + 1); -} - -void ft_prop_int(struct ft_cxt *cxt, const char *name, unsigned int val) -{ - u32 v = cpu_to_be32((u32) val); - - ft_prop(cxt, name, &v, 4); -} - -/* start construction of the flat OF tree */ -void ft_begin(struct ft_cxt *cxt, void *blob, unsigned int max_size) -{ - struct boot_param_header *bph = blob; - u32 off; - - /* clear the cxt */ - memset(cxt, 0, sizeof(*cxt)); - - cxt->bph = bph; - cxt->max_size = max_size; - - /* zero everything in the header area */ - memset(bph, 0, sizeof(*bph)); - - bph->magic = cpu_to_be32(OF_DT_HEADER); - bph->version = cpu_to_be32(0x10); - bph->last_comp_version = cpu_to_be32(0x10); - - /* start pointers */ - cxt->pres_begin = (char *) _ALIGN((unsigned long)(bph + 1), 8); - cxt->pres = cxt->pres_begin; - - off = (unsigned long)cxt->pres_begin - (unsigned long)bph; - bph->off_mem_rsvmap = cpu_to_be32(off); - - ((u64 *) cxt->pres)[0] = 0; /* phys = 0, size = 0, terminate */ - ((u64 *) cxt->pres)[1] = 0; - - cxt->p_anchor = cxt->pres + 16; /* over the terminator */ -} - -/* add a reserver physical area to the rsvmap */ -void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size) -{ - ((u64 *) cxt->pres)[0] = cpu_to_be64(physaddr); /* phys = 0, size = 0, terminate */ - ((u64 *) cxt->pres)[1] = cpu_to_be64(size); - - cxt->pres += 16; /* advance two u64s worth */ - - ((u64 *) cxt->pres)[0] = 0; /* phys = 0, size = 0, terminate */ - ((u64 *) cxt->pres)[1] = 0; - - /* keep track of size */ - cxt->res_size = cxt->pres + 16 - cxt->pres_begin; - - cxt->p_anchor = cxt->pres + 16; /* over the terminator */ -} - -int ft_set_rsvmap(void *bphp, int m, u64 physaddr, u64 size) -{ - const struct boot_param_header *bph = bphp; - u64 *p_rsvmap = (u64 *) - ((char *)bph + be32_to_cpu(bph->off_mem_rsvmap)); - u32 i; - - for (i = 0;; i++) { - u64 addr, sz; - - addr = be64_to_cpu(p_rsvmap[i * 2]); - sz = be64_to_cpu(p_rsvmap[i * 2 + 1]); - if (addr == 0 && size == 0) - break; - if (m == i) { - p_rsvmap[i * 2] = cpu_to_be64(physaddr); - p_rsvmap[i * 2 + 1] = cpu_to_be64(size); - return 0; - } - } - return -1; -} - -void ft_begin_tree(struct ft_cxt *cxt) -{ - cxt->p_begin = cxt->p_anchor; - cxt->pstr_begin = (char *)cxt->bph + cxt->max_size; /* point at the end */ - - cxt->p = cxt->p_begin; - cxt->pstr = cxt->pstr_begin; -} - -int ft_end_tree(struct ft_cxt *cxt) -{ - struct boot_param_header *bph = cxt->bph; - int off, sz, sz1; - u32 tag, v; - char *p; - - ft_put_word(cxt, OF_DT_END); - - if (cxt->overflow) - return -ENOMEM; - - /* size of the areas */ - cxt->struct_size = cxt->p - cxt->p_begin; - cxt->strings_size = cxt->pstr_begin - cxt->pstr; - - /* the offset we must move */ - off = (cxt->pstr_begin - cxt->p_begin) - cxt->strings_size; - - /* the new strings start */ - cxt->pstr_begin = cxt->p_begin + cxt->struct_size; - - /* move the whole string area */ - memmove(cxt->pstr_begin, cxt->pstr, cxt->strings_size); - - /* now perform the fixup of the strings */ - p = cxt->p_begin; - while ((tag = be32_to_cpu(*(u32 *) p)) != OF_DT_END) { - p += 4; - - if (tag == OF_DT_BEGIN_NODE) { - p = (char *) _ALIGN((unsigned long)p + strlen(p) + 1, 4); - continue; - } - - if (tag == OF_DT_END_NODE || tag == OF_DT_NOP) - continue; - - if (tag != OF_DT_PROP) - return -EINVAL; - - sz = be32_to_cpu(*(u32 *) p); - p += 4; - - v = be32_to_cpu(*(u32 *) p); - v -= off; - *(u32 *) p = cpu_to_be32(v); /* move down */ - p += 4; - - p = (char *) _ALIGN((unsigned long)p + sz, 4); - } - - /* fix sizes */ - p = (char *)cxt->bph; - sz = (cxt->pstr_begin + cxt->strings_size) - p; - sz1 = _ALIGN(sz, 16); /* align at 16 bytes */ - if (sz != sz1) - memset(p + sz, 0, sz1 - sz); - bph->totalsize = cpu_to_be32(sz1); - bph->off_dt_struct = cpu_to_be32(cxt->p_begin - p); - bph->off_dt_strings = cpu_to_be32(cxt->pstr_begin - p); - - /* the new strings start */ - cxt->pstr_begin = cxt->p_begin + cxt->struct_size; - cxt->pstr = cxt->pstr_begin + cxt->strings_size; - - /* mark the size of string structure in bph */ - bph->size_dt_strings = cxt->strings_size; - - return 0; -} - -/**********************************************************************/ - -static inline int isprint(int c) -{ - return c >= 0x20 && c <= 0x7e; -} - -static int is_printable_string(const void *data, int len) -{ - const char *s = data; - const char *ss; - - /* zero length is not */ - if (len == 0) - return 0; - - /* must terminate with zero */ - if (s[len - 1] != '\0') - return 0; - - ss = s; - while (*s && isprint(*s)) - s++; - - /* not zero, or not done yet */ - if (*s != '\0' || (s + 1 - ss) < len) - return 0; - - return 1; -} - -static void print_data(const void *data, int len) -{ - int i; - const char *s; - - /* no data, don't print */ - if (len == 0) - return; - - if (is_printable_string(data, len)) { - printf(" = \"%s\"", (char *)data); - return; - } - - switch (len) { - case 1: /* byte */ - printf(" = <0x%02x>", (*(char *) data) & 0xff); - break; - case 2: /* half-word */ - printf(" = <0x%04x>", be16_to_cpu(*(u16 *) data) & 0xffff); - break; - case 4: /* word */ - printf(" = <0x%08x>", be32_to_cpu(*(u32 *) data) & 0xffffffffU); - break; - case 8: /* double-word */ - printf(" = <0x%16llx>", be64_to_cpu(*(u64 *) data)); - break; - default: /* anything else... hexdump */ - printf(" = ["); - for (i = 0, s = data; i < len; i++) - printf("%02x%s", s[i], i < len - 1 ? " " : ""); - printf("]"); - - break; - } -} - -void ft_dump_blob(const void *bphp) -{ - const struct boot_param_header *bph = bphp; - const u64 *p_rsvmap = (const u64 *) - ((const char *)bph + be32_to_cpu(bph->off_mem_rsvmap)); - const u32 *p_struct = (const u32 *) - ((const char *)bph + be32_to_cpu(bph->off_dt_struct)); - const u32 *p_strings = (const u32 *) - ((const char *)bph + be32_to_cpu(bph->off_dt_strings)); - const u32 version = be32_to_cpu(bph->version); - u32 i, *p, *tagp, *sizep; - char *namep, *datap; - int depth, shift; - u64 addr, size; - - - if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { - /* not valid tree */ - return; - } - - depth = 0; - shift = 4; - - for (i = 0;; i++) { - addr = be64_to_cpu(p_rsvmap[i * 2]); - size = be64_to_cpu(p_rsvmap[i * 2 + 1]); - if (addr == 0 && size == 0) - break; - - printf("/memreserve/ 0x%llx 0x%llx;\n", addr, size); - } - - p = (u32 *)p_struct; - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - printf("%*s%s {\n", depth * shift, "", namep); - depth++; - break; - case OF_DT_END_NODE: - depth--; - printf("%*s};\n", depth * shift, ""); - break; - case OF_DT_NOP: - printf("%*s[NOP]\n", depth * shift, ""); - break; - case OF_DT_END: - break; - case OF_DT_PROP: - printf("%*s%s", depth * shift, "", namep); - print_data(datap, *sizep); - printf(";\n"); - break; - default: - fprintf(stderr, "%*s ** Unknown tag 0x%08x\n", - depth * shift, "", *tagp); - return; - } -} - -void ft_backtrack_node(struct ft_cxt *cxt) -{ - if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE) - return; /* XXX only for node */ - - cxt->p -= 4; -} - -/* note that the root node of the blob is "peeled" off */ -void ft_merge_blob(struct ft_cxt *cxt, void *blob) -{ - struct boot_param_header *bph = (struct boot_param_header *)blob; - u32 *p_struct = (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_struct)); - u32 *p_strings = - (u32 *) ((char *)bph + be32_to_cpu(bph->off_dt_strings)); - const u32 version = be32_to_cpu(bph->version); - u32 *p, *tagp, *sizep; - char *namep, *datap; - int depth; - - if (be32_to_cpu(*(u32 *) (cxt->p - 4)) != OF_DT_END_NODE) - return; /* XXX only for node */ - - cxt->p -= 4; - - depth = 0; - p = p_struct; - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - if (depth++ > 0) - ft_begin_node(cxt, namep); - break; - case OF_DT_END_NODE: - ft_end_node(cxt); - if (--depth == 0) - return; - break; - case OF_DT_PROP: - ft_prop(cxt, namep, datap, *sizep); - break; - } -} - -/**********************************************************************/ - -void *ft_find_node(const void *bphp, const char *srch_path) -{ - const struct boot_param_header *bph = bphp; - u32 *p_struct = (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_struct)); - u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings)); - u32 version = be32_to_cpu(bph->version); - u32 *p, *tagp, *sizep; - char *namep, *datap; - static char path[MAX_PATH_LEN]; - - path[0] = '\0'; - p = p_struct; - - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - strcat(path, namep); - if (!strcmp(path, srch_path)) - return tagp; - strcat(path, "/"); - break; - case OF_DT_END_NODE: - ft_parentize(path, 1); - break; - } - return NULL; -} - -int ft_get_prop(const void *bphp, const void *node, const char *propname, - void *buf, const unsigned int buflen) -{ - const struct boot_param_header *bph = bphp; - u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings)); - u32 version = be32_to_cpu(bph->version); - u32 *p, *tagp, *sizep, size; - char *namep, *datap; - int depth; - - depth = 0; - p = (u32 *)node; - - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - depth++; - break; - case OF_DT_PROP: - if ((depth == 1) && !strcmp(namep, propname)) { - size = min(be32_to_cpu(*sizep), (u32)buflen); - memcpy(buf, datap, size); - return size; - } - break; - case OF_DT_END_NODE: - if (--depth <= 0) - return -1; - break; - } - return -1; -} - -static void ft_modify_prop(void **bphpp, char *datap, u32 *old_prop_sizep, - const char *buf, const unsigned int buflen) -{ - u32 old_prop_data_len, new_prop_data_len; - - old_prop_data_len = _ALIGN(be32_to_cpu(*old_prop_sizep), 4); - new_prop_data_len = _ALIGN(buflen, 4); - - /* Check if new prop data fits in old prop data area */ - if (new_prop_data_len == old_prop_data_len) { - memcpy(datap, buf, buflen); - *old_prop_sizep = cpu_to_be32(buflen); - } else { - /* Need to alloc new area to put larger or smaller ft */ - struct boot_param_header *old_bph = *bphpp, *new_bph; - u32 *old_tailp, *new_tailp, *new_datap; - u32 old_total_size, new_total_size, head_len, tail_len, diff, v; - - old_total_size = be32_to_cpu(old_bph->totalsize); - head_len = (u32)(datap - (char *)old_bph); - tail_len = old_total_size - (head_len + old_prop_data_len); - old_tailp = (u32 *)(datap + old_prop_data_len); - new_total_size = head_len + new_prop_data_len + tail_len; - - if (!(new_bph = malloc(new_total_size))) { - printf("Can't alloc space for new ft\n"); - ft_exit(-ENOSPC); - } - - new_datap = (u32 *)((char *)new_bph + head_len); - new_tailp = (u32 *)((char *)new_datap + new_prop_data_len); - - memcpy(new_bph, *bphpp, head_len); - memcpy(new_datap, buf, buflen); - memcpy(new_tailp, old_tailp, tail_len); - - *(new_datap - 2) = cpu_to_be32(buflen); /* Set prop size */ - - new_bph->totalsize = cpu_to_be32(new_total_size); - diff = new_prop_data_len - old_prop_data_len; - - if (be32_to_cpu(old_bph->off_dt_strings) - > be32_to_cpu(old_bph->off_dt_struct)) { - v = be32_to_cpu(new_bph->off_dt_strings); - new_bph->off_dt_strings = cpu_to_be32(v + diff); - } - - if (be32_to_cpu(old_bph->off_mem_rsvmap) - > be32_to_cpu(old_bph->off_dt_struct)) { - v = be32_to_cpu(new_bph->off_mem_rsvmap); - new_bph->off_mem_rsvmap = cpu_to_be32(v + diff); - } - - ft_free(*bphpp, old_total_size); - *bphpp = new_bph; - } -} - -/* - * - Only modifies existing properties. - * - The dev tree passed in may be freed and a new one allocated - * (and *bphpp set to location of new dev tree). - */ -int ft_set_prop(void **bphpp, const void *node, const char *propname, - const void *buf, const unsigned int buflen) -{ - struct boot_param_header *bph = *bphpp; - u32 *p_strings= (u32 *)((char *)bph + be32_to_cpu(bph->off_dt_strings)); - u32 version = be32_to_cpu(bph->version); - u32 *p, *tagp, *sizep; - char *namep, *datap; - int depth; - - depth = 0; - p = (u32 *)node; - - while ((p = ft_next(p, p_strings, version, &tagp, &namep, &datap, - &sizep)) != NULL) - switch (be32_to_cpu(*tagp)) { - case OF_DT_BEGIN_NODE: - depth++; - break; - case OF_DT_PROP: - if ((depth == 1) && !strcmp(namep, propname)) { - ft_modify_prop(bphpp, datap, sizep, buf, - buflen); - return be32_to_cpu(*sizep); - } - break; - case OF_DT_END_NODE: - if (--depth <= 0) - return -1; - break; - } - return -1; -} diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/powerpc64/flatdevtree.h --- a/tools/libxc/powerpc64/flatdevtree.h Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _FLATDEVTREE_H_ -#define _FLATDEVTREE_H_ - -#include "flatdevtree_env.h" - -/* Definitions used by the flattened device tree */ -#define OF_DT_HEADER 0xd00dfeed /* marker */ -#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ -#define OF_DT_END_NODE 0x2 /* End node */ -#define OF_DT_PROP 0x3 /* Property: name off, size, content */ -#define OF_DT_NOP 0x4 /* nop */ -#define OF_DT_END 0x9 - -#define OF_DT_VERSION 0x10 - -struct boot_param_header { - u32 magic; /* magic word OF_DT_HEADER */ - u32 totalsize; /* total size of DT block */ - u32 off_dt_struct; /* offset to structure */ - u32 off_dt_strings; /* offset to strings */ - u32 off_mem_rsvmap; /* offset to memory reserve map */ - u32 version; /* format version */ - u32 last_comp_version; /* last compatible version */ - /* version 2 fields below */ - u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ - /* version 3 fields below */ - u32 size_dt_strings; /* size of the DT strings block */ -}; - -struct ft_cxt { - struct boot_param_header *bph; - int max_size; /* maximum size of tree */ - int overflow; /* set when this happens */ - char *p, *pstr, *pres; /* running pointers */ - char *p_begin, *pstr_begin, *pres_begin; /* starting pointers */ - char *p_anchor; /* start of constructed area */ - int struct_size, strings_size, res_size; -}; - -void ft_begin_node(struct ft_cxt *cxt, const char *name); -void ft_end_node(struct ft_cxt *cxt); - -void ft_begin_tree(struct ft_cxt *cxt); -int ft_end_tree(struct ft_cxt *cxt); - -void ft_nop(struct ft_cxt *cxt); -void ft_prop(struct ft_cxt *cxt, const char *name, - const void *data, unsigned int sz); -void ft_prop_str(struct ft_cxt *cxt, const char *name, const char *str); -void ft_prop_int(struct ft_cxt *cxt, const char *name, unsigned int val); -void ft_begin(struct ft_cxt *cxt, void *blob, unsigned int max_size); -void ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size); -int ft_set_rsvmap(void *bphp, int m, u64 physaddr, u64 size); - -void ft_dump_blob(const void *bphp); -void ft_backtrack_node(struct ft_cxt *cxt); -void ft_merge_blob(struct ft_cxt *cxt, void *blob); - -void *ft_find_node(const void *bphp, const char *srch_path); -int ft_get_prop(const void *bphp, const void *node, const char *propname, - void *buf, const unsigned int buflen); -int ft_set_prop(void **bphp, const void *node, const char *propname, - const void *buf, const unsigned int buflen); - -static inline char *ft_strrchr(const char *s, int c) -{ - const char *p = s + strlen(s); - - do { - if (*p == (char)c) - return (char *)p; - } while (--p >= s); - return NULL; -} - -/* 'path' is modified */ -static inline void ft_parentize(char *path, int leave_slash) -{ - char *s = &path[strlen(path) - 1]; - - if (*s == '/') - *s = '\0'; - s = ft_strrchr(path, '/'); - if (s != NULL) { - if (leave_slash) - s[1] = '\0'; - else if (s[0] == '/') - s[0] = '\0'; - } -} - -#endif /* FLATDEVTREE_H */ diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/powerpc64/flatdevtree_env.h --- a/tools/libxc/powerpc64/flatdevtree_env.h Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _FLATDEVTREE_ENV_H_ -#define _FLATDEVTREE_ENV_H_ - -#include -#include -#include -#include -#include -#include - -#define MAX_PATH_LEN 1024 - -#define _ALIGN(addr,size) (((addr)+(size)-1)&(~((size)-1))) - -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned long long u64; - -static inline u16 swab16(u16 x) -{ - return (((u16)(x) & (u16)0x00ffU) << 8) | - (((u16)(x) & (u16)0xff00U) >> 8); -} - -static inline u32 swab32(u32 x) -{ - return (((u32)(x) & (u32)0x000000ffUL) << 24) | - (((u32)(x) & (u32)0x0000ff00UL) << 8) | - (((u32)(x) & (u32)0x00ff0000UL) >> 8) | - (((u32)(x) & (u32)0xff000000UL) >> 24); -} - -static inline u64 swab64(u64 x) -{ - return (u64)(((u64)(x) & (u64)0x00000000000000ffULL) << 56) | - (u64)(((u64)(x) & (u64)0x000000000000ff00ULL) << 40) | - (u64)(((u64)(x) & (u64)0x0000000000ff0000ULL) << 24) | - (u64)(((u64)(x) & (u64)0x00000000ff000000ULL) << 8) | - (u64)(((u64)(x) & (u64)0x000000ff00000000ULL) >> 8) | - (u64)(((u64)(x) & (u64)0x0000ff0000000000ULL) >> 24) | - (u64)(((u64)(x) & (u64)0x00ff000000000000ULL) >> 40) | - (u64)(((u64)(x) & (u64)0xff00000000000000ULL) >> 56); -} - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define cpu_to_be16(x) swab16(x) -#define be16_to_cpu(x) swab16(x) -#define cpu_to_be32(x) swab32(x) -#define be32_to_cpu(x) swab32(x) -#define cpu_to_be64(x) swab64(x) -#define be64_to_cpu(x) swab64(x) -#else -#define cpu_to_be16(x) (x) -#define be16_to_cpu(x) (x) -#define cpu_to_be32(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_be64(x) (x) -#define be64_to_cpu(x) (x) -#endif - -static inline void ft_exit(int code) -{ - exit(code); -} - -static inline void ft_free(void *ptr, int len) -{ - free(ptr); -} - -static inline u32 min(u32 a, u32 b) -{ - if (a < b) - return a; - return b; -} - -#endif /* _FLATDEVTREE_ENV_H_ */ diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/powerpc64/mk_flatdevtree.c --- a/tools/libxc/powerpc64/mk_flatdevtree.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,648 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright IBM Corporation 2007 - * - * Authors: Ryan Harper - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include /* for PERROR() */ -#include - -#include "mk_flatdevtree.h" - -static uint32_t current_phandle = 0; - -static uint32_t get_phandle(void) -{ - return current_phandle++; -} - -static int readfile(const char *fullpath, void *data, int len) -{ - struct stat st; - int saved_errno; - int rc = -1; - int fd; - - if ((fd = open(fullpath, O_RDONLY)) == -1) { - PERROR("%s: failed to open file %s", __func__, fullpath); - return -1; - } - - if ((rc = fstat(fd, &st)) == -1) { - PERROR("%s: failed to stat fd %d", __func__, fd); - goto error; - } - - if (S_ISREG(st.st_mode)) - rc = read(fd, data, len); - - close(fd); - return rc; - -error: - saved_errno = errno; - close(fd); - errno = saved_errno; - return -1; -} - -/* - * @property - string to check against the filter list - * @filter - NULL terminated list of strings - * - * compare @property string to each string in @filter - * - * return 1 if @property matches any filter, otherwise 0 - * - */ -static int match(const char *property, const char **filter) -{ - int i; - - for (i=0; filter[i] != NULL; i++) { - /* compare the filter to property */ - if (strncmp(property, filter[i], strlen(filter[i])) == 0) - return 1; - } - - return 0; -} - -/* - * copy the node at @dirpath filtering out any properties that match in @propfilter - */ -static int copynode(struct ft_cxt *cxt, const char *dirpath, const char **propfilter) -{ - struct dirent *tree; - struct stat st; - DIR *dir; - char fullpath[MAX_PATH]; - char *bname = NULL; - char *basec = NULL; - int saved_errno; - - if ((dir = opendir(dirpath)) == NULL) { - PERROR("%s: failed to open dir %s", __func__, dirpath); - return -1; - } - - while (1) { - if ((tree = readdir(dir)) == NULL) - break; /* reached end of directory entries */ - - /* ignore . and .. */ - if (strcmp(tree->d_name,"." ) == 0 || strcmp(tree->d_name,"..") == 0) - continue; - - /* build full path name of the file, for stat() */ - if (snprintf(fullpath, sizeof(fullpath), "%s/%s", dirpath, - tree->d_name) >= sizeof(fullpath)) { - PERROR("%s: failed to build full path", __func__); - goto error; - } - - /* stat the entry */ - if (stat(fullpath, &st) < 0) { - PERROR("%s: failed to stat file %s", __func__, fullpath); - goto error; - } - - if (S_ISDIR(st.st_mode)) { - /* start a new node for a dir */ - ft_begin_node(cxt, tree->d_name); - - /* copy everything in this dir */ - if (copynode(cxt, fullpath, propfilter) < 0) { - PERROR("%s: failed to copy node @ %s", __func__, fullpath); - goto error; - } - - /* end the node */ - ft_end_node(cxt); - } - /* add files in dir as properties */ - else if (S_ISREG(st.st_mode)) { - - if ((basec = strdup(fullpath)) == NULL) { - PERROR("%s: failed to dupe string", __func__); - goto error; - } - - if ((bname = basename(basec)) == NULL) { - PERROR("%s: basename() failed", __func__); - goto error; - } - - /* only add files that don't match the property filter string */ - if (!match(bname, propfilter)) { - char data[BUFSIZE]; - int len; - - /* snarf the data and push into the property */ - if ((len = readfile(fullpath, data, sizeof(data))) < 0) { - PERROR("%s: failed to read data from file %s", __func__, - fullpath); - goto error; - } - ft_prop(cxt, tree->d_name, data, len); - - } - - /* strdup mallocs memory */ - if (basec != NULL ) { - free(basec); - basec = NULL; - } - - } - } - - closedir(dir); - return 0; - -error: - saved_errno = errno; - - /* strdup mallocs memory */ - if (basec != NULL ) { - free(basec); - basec = NULL; - } - - closedir(dir); - - errno = saved_errno; - return -1; -} - -static int find_cpu0(char *cpupath, int len) -{ - const char path[] = "/proc/device-tree/cpus"; - const char device[] = "device_type"; - const char dev_cpu[] = "cpu"; - const char reg[] = "reg"; - char data[sizeof(dev_cpu)]; - char prop[MAX_PATH]; - char node[MAX_PATH]; - struct dirent *tree; - struct stat st; - DIR* dir; - int saved_errno; - int found = 0; - - if ((dir = opendir(path)) == NULL) { - PERROR("%s: failed to open directory %s", __func__, path); - return -1; - } - - while (!found) { - - if ((tree = readdir(dir)) == NULL) - break; /* reached end of directory entries */ - - /* ignore ., .. */ - if (strcmp(tree->d_name,"." ) == 0 || strcmp(tree->d_name,"..") == 0) - continue; - - /* build full path name of the file, for stat() */ - if (snprintf(node, sizeof(node), "%s/%s", path, - tree->d_name) >= sizeof(node)) { - PERROR("%s: failed to concat strings", __func__); - goto error; - } - - /* stat the entry */ - if (stat(node, &st) < 0) { - PERROR("%s: failed to stat file %s", __func__, node); - /* something funny happen in /proc/device-tree, but march onward */ - continue; - } - - /* for each dir, check the device_type property until we find 'cpu'*/ - if (S_ISDIR(st.st_mode)) { - - /* construct path to device_type */ - if (snprintf(prop, sizeof(prop), "%s/%s", node, - device) >= sizeof(prop)) { - PERROR("%s: failed to concat strings", __func__); - goto error; - } - - /* read device_type into buffer */ - if ((readfile(prop, data, sizeof(data))) < 0) { - PERROR("%s: failed to read data from file %s", __func__, prop); - goto error; - } - - /* if the device_type is 'cpu', and reg is 0 - * return the path where we found it */ - if (strcmp(data, "cpu") == 0) { - - /* construct path to reg */ - if (snprintf(prop, sizeof(prop), "%s/%s", node, - reg) >= sizeof(prop)) { - PERROR("%s: failed to concat strings", __func__); - goto error; - } - - /* using data buffer since reg and device_type values have same size */ - if ((readfile(prop, data, sizeof(data))) < 0) { - PERROR("%s: failed to read data from file %s", __func__, prop); - goto error; - } - - /* now check property "reg" for value 0 */ - if ((u32)*data == 0) { - if (snprintf(cpupath, len, "%s", node) >= len) { - PERROR("%s: failed to copy cpupath", __func__); - goto error; - } - found = 1; - } - } - } - } - - closedir(dir); - return found; - -error: - saved_errno = errno; - closedir(dir); - errno = saved_errno; - return -1; -} - -void free_devtree(struct ft_cxt *root) -{ - if ((root != NULL) && root->bph != NULL) { - free(root->bph); - root->bph = NULL; - } -} - -int make_devtree(struct ft_cxt *root, - struct xc_dom_image *dom, - unsigned long shadow_mb) -{ - struct boot_param_header *bph = NULL; - uint64_t val[2]; - uint32_t val32[2]; - uint64_t shared_info_paddr = dom->shared_info_pfn << PAGE_SHIFT; - uint64_t xenstore_paddr = dom->xenstore_pfn << PAGE_SHIFT; - uint64_t console_paddr = dom->console_pfn << PAGE_SHIFT; - long remaining; - unsigned long ramdisk_start; - unsigned long ramdisk_size; - unsigned long rma_bytes = 1 << dom->realmodearea_log; - int64_t shadow_mb_log; - uint64_t pft_size; - char cpupath[MAX_PATH]; - const char *propfilter[] = { "ibm", "linux,", NULL }; - char *cpupath_copy = NULL; - char *cpuname = NULL; - int saved_errno; - int dtb_fd = -1; - uint32_t cpu0_phandle = get_phandle(); - uint32_t xen_phandle = get_phandle(); - uint32_t rma_phandle = get_phandle(); - - /* initialize bph to prevent double free on error path */ - root->bph = NULL; - - /* carve out space for bph */ - if ((bph = (struct boot_param_header *)malloc(BPH_SIZE)) == NULL) { - PERROR("%s: Failed to malloc bph buffer size", __func__); - goto error; - } - - /* NB: struct ft_cxt root defined at top of file */ - /* root = Tree() */ - ft_begin(root, bph, BPH_SIZE); - - /* you MUST set reservations BEFORE _starting_the_tree_ */ - - /* reserve shared_info_t page */ - if (shared_info_paddr) { - val[0] = cpu_to_be64((u64) shared_info_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_add_rsvmap(root, val[0], val[1]); - } - - /* reserve console page for domU */ - if (console_paddr) { - val[0] = cpu_to_be64((u64) console_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_add_rsvmap(root, val[0], val[1]); - } - - /* reserve xen store page for domU */ - if (xenstore_paddr) { - val[0] = cpu_to_be64((u64) xenstore_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_add_rsvmap(root, val[0], val[1]); - } - - /* reserve space for initrd if needed */ - ramdisk_start = dom->ramdisk_seg.pfn << PAGE_SHIFT; - ramdisk_size = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart; - if (ramdisk_size > 0) { - val[0] = cpu_to_be64((u64) ramdisk_start); - val[1] = cpu_to_be64((u64) ramdisk_size); - ft_add_rsvmap(root, val[0], val[1]); - } - - /* NB: ft_add_rsvmap() already terminates with a NULL reservation for us */ - - /* done with reservations, _starting_the_tree_ */ - ft_begin_tree(root); - - /* make root node */ - ft_begin_node(root, ""); - - /* root.addprop('device_type', 'chrp-but-not-really\0') */ - ft_prop_str(root, "device_type", "chrp-but-not-really"); - - /* root.addprop('#size-cells', 2) */ - ft_prop_int(root, "#size-cells", 2); - - /* root.addprop('#address-cells', 2) */ - ft_prop_int(root, "#address-cells", 2); - - /* root.addprop('model', 'Momentum,Maple-D\0') */ - ft_prop_str(root, "model", "Momentum,Maple-D"); - - /* root.addprop('compatible', 'Momentum,Maple\0') */ - ft_prop_str(root, "compatible", "Momentum,Maple"); - - /* start chosen node */ - ft_begin_node(root, "chosen"); - - /* chosen.addprop('cpu', cpu0.get_phandle()) */ - ft_prop_int(root, "cpu", cpu0_phandle); - - /* chosen.addprop('rma', rma.get_phandle()) */ - ft_prop_int(root, "memory", rma_phandle); - - /* chosen.addprop('linux,stdout-path', '/xen/console\0') */ - ft_prop_str(root, "linux,stdout-path", "/xen/console"); - - /* chosen.addprop('interrupt-controller, xen.get_phandle()) */ - ft_prop_int(root, "interrupt-controller", xen_phandle); - - /* chosen.addprop('bootargs', imghandler.cmdline + '\0') */ - if (dom->cmdline != NULL) - ft_prop_str(root, "bootargs", dom->cmdline); - - /* mark where the initrd is, if present */ - if (ramdisk_size > 0) { - val[0] = cpu_to_be64((u64) ramdisk_start); - val[1] = cpu_to_be64((u64) ramdisk_start + ramdisk_size); - ft_prop(root, "linux,initrd-start", &(val[0]), sizeof(val[0])); - ft_prop(root, "linux,initrd-end", &(val[1]), sizeof(val[1])); - } - - /* end chosen node */ - ft_end_node(root); - - /* xen = root.addnode('xen') */ - ft_begin_node(root, "xen"); - - /* xen.addprop('version', 'Xen-3.0-unstable\0') */ - ft_prop_str(root, "compatible", "Xen-3.0-unstable"); - - /* xen.addprop('reg', long(imghandler.vm.domid), long(0)) */ - val[0] = cpu_to_be64((u64) dom->guest_domid); - val[1] = cpu_to_be64((u64) 0); - ft_prop(root, "reg", val, sizeof(val)); - - /* point to shared_info_t page base addr */ - val[0] = cpu_to_be64((u64) shared_info_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_prop(root, "shared-info", val, sizeof(val)); - - /* xen.addprop('domain-name', imghandler.vm.getName() + '\0') */ - /* libxc doesn't know the domain name, that is purely a xend thing */ - /* ft_prop_str(root, "domain-name", domain_name); */ - - /* add xen/linux,phandle for chosen/interrupt-controller */ - ft_prop_int(root, "linux,phandle", xen_phandle); - - if (console_paddr != 0) { - /* xencons = xen.addnode('console') */ - ft_begin_node(root, "console"); - - /* console_paddr */ - val[0] = cpu_to_be64((u64) console_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_prop(root, "reg", val, sizeof(val)); - - /* xencons.addprop('interrupts', console_evtchn, 0) */ - val32[0] = cpu_to_be32((u32) dom->console_evtchn); - val32[1] = cpu_to_be32((u32) 0); - ft_prop(root, "interrupts", val32, sizeof(val32)); - - /* end of console */ - ft_end_node(root); - } - - if (xenstore_paddr != 0) { - /* start store node */ - ft_begin_node(root, "store"); - - /* store paddr */ - val[0] = cpu_to_be64((u64) xenstore_paddr); - val[1] = cpu_to_be64((u64) PAGE_SIZE); - ft_prop(root, "reg", val, sizeof(val)); - - /* store event channel */ - val32[0] = cpu_to_be32((u32) dom->xenstore_evtchn); - val32[1] = cpu_to_be32((u32) 0); - ft_prop(root, "interrupts", val32, sizeof(val32)); - - /* end of store */ - ft_end_node(root); - } - - /* end of xen node */ - ft_end_node(root); - - /* rma = root.addnode('memory@0') */ - ft_begin_node(root, "memory@0"); - - /* rma.addprop('reg', long(0), long(rma_bytes)) */ - val[0] = cpu_to_be64((u64) 0); - val[1] = cpu_to_be64((u64) rma_bytes); - ft_prop(root, "reg", val, sizeof(val)); - - /* rma.addprop('device_type', 'memory\0') */ - ft_prop_str(root, "device_type", "memory"); - - /* add linux,phandle for chosen/rma node */ - ft_prop_int(root, "linux,phandle", rma_phandle); - - /* end of memory@0 */ - ft_end_node(root); - - /* calculate remaining bytes from total - rma size */ - remaining = (dom->total_pages << PAGE_SHIFT) - rma_bytes; - - /* memory@ is all remaining memory after RMA */ - if (remaining > 0) - { - char mem[MAX_PATH]; - - if (snprintf(mem, sizeof(mem), "memory@%lx", - rma_bytes) >= sizeof(mem)) { - PERROR("%s: failed to build memory string", __func__); - goto error; - } - - /* memory@ is all remaining memory after RMA */ - ft_begin_node(root, mem); - - /* mem.addprop('reg', long(rma_bytes), long(remaining)) */ - val[0] = cpu_to_be64((u64) rma_bytes); - val[1] = cpu_to_be64((u64) remaining); - ft_prop(root, "reg", val, sizeof(val)); - - /* mem.addprop('device_type', 'memory\0') */ - ft_prop_str(root, "device_type", "memory"); - - /* end memory@ node */ - ft_end_node(root); - } - - /* add CPU nodes */ - /* cpus = root.addnode('cpus') */ - ft_begin_node(root, "cpus"); - - /* cpus.addprop('smp-enabled') */ - ft_prop(root, "smp-enabled", NULL, 0); - - /* cpus.addprop('#size-cells', 0) */ - ft_prop_int(root, "#size-cells", 0); - - /* cpus.addprop('#address-cells', 1) */ - ft_prop_int(root, "#address-cells", 1); - - /* - * Copy all properties the system firmware gave us from a - * CPU node in the device tree. - */ - if (find_cpu0(cpupath, sizeof(cpupath)) <= 0) { - PERROR("%s: failed find cpu0 node in host devtree", __func__); - goto error; - } - - /* get the basename from path to cpu device */ - if ((cpupath_copy = strdup(cpupath)) == NULL) { - PERROR("%s: failed to dupe string", __func__); - goto error; - } - if ((cpuname = basename(cpupath_copy)) == NULL) { - PERROR("%s: basename() failed", __func__); - goto error; - } - - /* start node for the cpu */ - ft_begin_node(root, cpuname); - - /* strdup() mallocs memory */ - if ( cpupath_copy != NULL ) { - free(cpupath_copy); - cpupath_copy = NULL; - } - - /* copy over most properties from host tree for cpu */ - if (copynode(root, cpupath, propfilter) < 0) { - PERROR("%s: failed to copy node", __func__); - goto error; - } - - /* calculate the pft-size */ - shadow_mb_log = (int)log2((double)shadow_mb); - pft_size = shadow_mb_log + 20; - - val32[0] = cpu_to_be32((u32) 0); - val32[1] = cpu_to_be32((u32) pft_size); - ft_prop(root, "ibm,pft-size", val32, sizeof(val32)); - - /* make phandle for cpu0 */ - ft_prop_int(root, "linux,phandle", cpu0_phandle); - - /* end node */ - ft_end_node(root); - - /* end cpus node */ - ft_end_node(root); - - /* end root node */ - ft_end_node(root); - - /* end of the tree */ - if (ft_end_tree(root) != 0) { - PERROR("%s: failed to end tree", __func__); - goto error; - } - - /* write a copy of the tree to a file */ - if ((dtb_fd = creat(DTB_FILE, S_IRUSR | S_IWUSR)) == -1) { - PERROR("%s: failed to open file %s", __func__, DTB_FILE); - goto error; - } - - if (write(dtb_fd, (const void *)bph, bph->totalsize) != bph->totalsize) { - PERROR("%s: failed to write blob to file", __func__); - goto error; - } - - return 0; - -error: - saved_errno = errno; - - /* strdup() mallocs memory */ - if ( cpupath_copy != NULL ) { - free(cpupath_copy); - cpupath_copy = NULL; - } - - /* free bph buffer */ - free_devtree(root); - - if (dtb_fd) - close(dtb_fd); - - errno = saved_errno; - return -1; -} diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/powerpc64/mk_flatdevtree.h --- a/tools/libxc/powerpc64/mk_flatdevtree.h Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright IBM Corporation 2007 - * - * Authors: Ryan Harper - */ - -#ifndef MK_FLATDEVTREE_H -#define MK_FLATDEVTREE_H - -#include "flatdevtree_env.h" -#include "flatdevtree.h" - -extern void free_devtree(struct ft_cxt *root); -extern int make_devtree(struct ft_cxt *root, - struct xc_dom_image *dom, - unsigned long shadow_mb); - -#define MAX_PATH 200 -#define BUFSIZE 1024 -#define BPH_SIZE 16*1024 -#define DTB_FILE "/tmp/domU.dtb" - -#endif /* MK_FLATDEVTREE_H */ diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/powerpc64/xc_memory.c --- a/tools/libxc/powerpc64/xc_memory.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright (C) IBM Corporation 2006 - * - * Authors: Hollis Blanchard - */ - -#include "xc_private.h" -#include - -int xc_alloc_real_mode_area(int xc_handle, - uint32_t domain, - unsigned int log) -{ - DECLARE_DOMCTL; - int err; - - domctl.cmd = XEN_DOMCTL_real_mode_area; - domctl.domain = (domid_t)domain; - domctl.u.real_mode_area.log = log; - - err = do_domctl(xc_handle, &domctl); - - if (err) - DPRINTF("Failed real mode area allocation for dom %u (log %u)\n", - domain, log); - - return err; -} diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/xc_core.h --- a/tools/libxc/xc_core.h Thu May 15 14:53:48 2008 +0900 +++ b/tools/libxc/xc_core.h Thu May 15 16:23:56 2008 +0900 @@ -148,8 +148,6 @@ int xc_core_arch_map_p2m(int xc_handle, # include "xc_core_x86.h" #elif defined (__ia64__) # include "xc_core_ia64.h" -#elif defined (__powerpc__) -# include "xc_core_powerpc.h" #else # error "unsupported architecture" #endif diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/xc_core_powerpc.c --- a/tools/libxc/xc_core_powerpc.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (c) 2007 Isaku Yamahata - * VA Linux Systems Japan K.K. - * Copyright IBM Corp. 2007 - * - * Authors: Isaku Yamahata - * Hollis Blanchard - * - */ - -#include "xg_private.h" -#include "xc_core.h" - -int -xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info) -{ - /* All PowerPC domU are autotranslated. */ - return 1; -} - -int -xc_core_arch_map_p2m(int xc_handle, xc_dominfo_t *info, - shared_info_t *live_shinfo, xen_pfn_t **live_p2m, - unsigned long *pfnp) -{ - /* All PowerPC domU are autotranslated. */ - errno = ENOSYS; - return -1; -} - -int -xc_core_arch_memory_map_get(int xc_handle, struct xc_core_arch_context *unused, - xc_dominfo_t *info, shared_info_t *live_shinfo, - xc_core_memory_map_t **mapp, - unsigned int *nr_entries) -{ - xc_core_memory_map_t *map = NULL; - - map = malloc(sizeof(*map)); - if (!map) { - PERROR("Could not allocate memory"); - goto out; - } - - map->addr = 0; - map->size = info->max_memkb * 1024; - - *mapp = map; - *nr_entries = 1; - return 0; - -out: - free(map); - return -1; -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/xc_core_powerpc.h --- a/tools/libxc/xc_core_powerpc.h Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (c) 2007 Isaku Yamahata - * VA Linux Systems Japan K.K. - * - */ - -#ifndef XC_CORE_POWERPC_H -#define XC_CORE_POWERPC_H - -#define ELF_ARCH_DATA ELFDATA2MSB -#define ELF_ARCH_MACHINE EM_PPC64 - -struct xc_core_arch_context { - /* nothing */ -}; - -#define xc_core_arch_context_init(arch_ctxt) do {} while (0) -#define xc_core_arch_context_free(arch_ctxt) do {} while (0) -#define xc_core_arch_context_get(arch_ctxt, ctxt, xc_handle, domid) \ - (0) -#define xc_core_arch_context_dump(arch_ctxt, args, dump_rtn) (0) -#define xc_core_arch_gpfn_may_present(arch_ctxt, i) (1) - -static inline int -xc_core_arch_context_get_shdr(struct xc_core_arch_context *arch_ctxt, - struct xc_core_section_headers *sheaders, - struct xc_core_strtab *strtab, - uint64_t *filesz, uint64_t offset) -{ - *filesz = 0; - return 0; -} - -#endif /* XC_CORE_POWERPC_H */ - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/xc_dom_elfloader.c --- a/tools/libxc/xc_dom_elfloader.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/libxc/xc_dom_elfloader.c Thu May 15 16:23:56 2008 +0900 @@ -43,8 +43,6 @@ static char *xc_dom_guest_type(struct xc return "xen-3.0-x86_64"; case EM_IA_64: return elf_msb(elf) ? "xen-3.0-ia64be" : "xen-3.0-ia64"; - case EM_PPC64: - return "xen-3.0-powerpc64"; default: return "xen-3.0-unknown"; } diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/xc_dom_powerpc.c --- a/tools/libxc/xc_dom_powerpc.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,236 +0,0 @@ -/* - * Xen domain builder -- powerpc bits. - * - * Most architecture-specific code for powerpc goes here. - * - * This code is licenced under the GPL. - * written 2006 by Gerd Hoffmann . - * - * Copyright IBM Corp. 2007 - * - * Authors: Gerd Hoffmann - * Hollis Blanchard - * - */ -#include -#include -#include -#include - -#include - -#include "xg_private.h" -#include "xc_dom.h" -#include "powerpc64/flatdevtree.h" -#include "powerpc64/mk_flatdevtree.h" - -#define RMA_LOG 26 /* 64 MB */ -#define EXTENT_LOG 24 /* 16 MB */ -#define EXTENT_ORDER (EXTENT_LOG - PAGE_SHIFT) - -/* ------------------------------------------------------------------------ */ - -static int alloc_magic_pages(struct xc_dom_image *dom) -{ - struct ft_cxt devtree; - void *guest_devtree; - unsigned long shadow_mb; - int rma_pages; - int rc; - - /* Allocate special pages from the end of the RMA. */ - rma_pages = 1 << (dom->realmodearea_log - PAGE_SHIFT); - dom->shared_info_pfn = --rma_pages; - dom->console_pfn = --rma_pages; - dom->xenstore_pfn = --rma_pages; - - /* Gather shadow allocation info for the device tree. */ - rc = xc_shadow_control(dom->guest_xc, dom->guest_domid, - XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION, NULL, 0, - &shadow_mb, 0, NULL); - if (rc < 0 || shadow_mb == 0) { - xc_dom_printf("Couldn't get shadow allocation size or it was 0.\n"); - return rc; - } - - /* Build device tree. */ - rc = make_devtree(&devtree, dom, shadow_mb); - if (rc < 0) { - xc_dom_printf("Failed to create flattened device tree.\n"); - return rc; - } - - /* Find a spot for it. */ - rc = xc_dom_alloc_segment(dom, &dom->devicetree_seg, "devtree", 0, - devtree.bph->totalsize); - if (rc) - goto out; - - /* Copy the device tree into place. */ - guest_devtree = xc_dom_seg_to_ptr(dom, &dom->devicetree_seg); - if (!guest_devtree) { - xc_dom_printf("Couldn't map guest memory for device tree.\n"); - rc = -1; - goto out; - } - memcpy(guest_devtree, devtree.bph, devtree.bph->totalsize); - -out: - free_devtree(&devtree); - return rc; -} - -static int shared_info(struct xc_dom_image *dom, void *ptr) -{ - shared_info_t *shared_info = ptr; - - xc_dom_printf("%s: called\n", __FUNCTION__); - - memset(shared_info, 0, sizeof(*shared_info)); - return 0; -} - -static int vcpu(struct xc_dom_image *dom, void *ptr) -{ - vcpu_guest_context_t *ctxt = ptr; - - memset(ctxt, 0x55, sizeof(*ctxt)); - ctxt->user_regs.pc = dom->parms.virt_entry; - ctxt->user_regs.msr = 0; - ctxt->user_regs.gprs[1] = 0; /* Linux uses its own stack */ - ctxt->user_regs.gprs[3] = dom->devicetree_seg.pfn << PAGE_SHIFT; - ctxt->user_regs.gprs[4] = dom->kernel_seg.pfn << PAGE_SHIFT; - ctxt->user_regs.gprs[5] = 0; - - /* There is a buggy kernel that does not zero the "local_paca", so - * we must make sure this register is 0 */ - ctxt->user_regs.gprs[13] = 0; - - xc_dom_printf("%s: initial vcpu:\n", __FUNCTION__); - xc_dom_printf(" pc 0x%016"PRIx64", msr 0x%016"PRIx64"\n" - " r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64" %016"PRIx64 - " %016"PRIx64"\n", - ctxt->user_regs.pc, ctxt->user_regs.msr, - ctxt->user_regs.gprs[1], - ctxt->user_regs.gprs[2], - ctxt->user_regs.gprs[3], - ctxt->user_regs.gprs[4], - ctxt->user_regs.gprs[5]); - - return 0; -} - -/* ------------------------------------------------------------------------ */ - -static struct xc_dom_arch xc_dom_arch = { - .guest_type = "xen-3.0-powerpc64", - .page_shift = PAGE_SHIFT, - .alloc_magic_pages = alloc_magic_pages, - .shared_info = shared_info, - .vcpu = vcpu, -}; - -static void __init register_arch_hooks(void) -{ - xc_dom_register_arch_hooks(&xc_dom_arch); -} - -int arch_setup_meminit(struct xc_dom_image *dom) -{ - xen_pfn_t *extent_list; - unsigned long total_mem = dom->total_pages << PAGE_SHIFT; - unsigned long rma_bytes; - unsigned long rma_nr_pages; - unsigned long nr_extents; - int rc = 0; - int i; - - /* XXX RMA size is processor-dependent. */ - dom->realmodearea_log = RMA_LOG; - rma_bytes = 1 << dom->realmodearea_log; - rma_nr_pages = rma_bytes >> PAGE_SHIFT; - - xc_dom_printf("dom%u memory: %lu MB RMA, %lu MB additional.\n", - dom->guest_domid, rma_bytes >> 20, (total_mem - rma_bytes) >> 20); - - if (total_mem < rma_bytes) { - xc_dom_printf("Domain must have at least %lu MB\n", rma_bytes >> 20); - return -EINVAL; - } - - /* Allocate the first chunk of memory. */ - rc = xc_alloc_real_mode_area(dom->guest_xc, dom->guest_domid, - dom->realmodearea_log); - if (rc) { - xc_dom_printf("Failed to allocate real mode area.\n"); - return rc; - } - - /* Allocate p2m map. */ - dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages); - if (dom->p2m_host == NULL) { - xc_dom_printf("Couldn't allocate p2m map.\n"); - return -ENOMEM; - } - - nr_extents = (dom->total_pages - rma_nr_pages) >> EXTENT_ORDER; - if (nr_extents) { - /* Allocate extent list for populate_physmap() call. */ - extent_list = xc_dom_malloc(dom, sizeof(xen_pfn_t) * nr_extents); - if (extent_list == NULL) { - xc_dom_printf("Couldn't allocate extent list.\n"); - return -ENOMEM; - } - - /* Allocate the remaining (non-RMA) memory. */ - for (i = 0; i < nr_extents; i++) { - /* Use PFNs above the RMA memory we already allocated. */ - extent_list[i] = rma_nr_pages + i * (1<guest_xc, dom->guest_domid, - nr_extents, EXTENT_ORDER, 0, - extent_list); - if (rc < 0) { - xc_dom_printf("populate_physmap(0x%lx extents order %u) -> 0x%x\n", - nr_extents, EXTENT_ORDER, rc); - return rc; - } - } - - /* Populate the p2m map. */ - rc = xc_get_pfn_list(dom->guest_xc, dom->guest_domid, dom->p2m_host, - dom->total_pages); - if (rc < 0) { - xc_dom_printf("Couldn't get p2m translation.\n"); - return rc; - } - - xc_dom_printf("%s: success\n", __func__); - - return 0; -} - -int arch_setup_bootearly(struct xc_dom_image *dom) -{ - xc_dom_printf("%s: doing nothing\n", __FUNCTION__); - return 0; -} - -int arch_setup_bootlate(struct xc_dom_image *dom) -{ - unsigned int page_size = XC_DOM_PAGE_SIZE(dom); - shared_info_t *shared_info; - - /* setup shared_info page */ - xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n", - __FUNCTION__, dom->shared_info_mfn); - shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid, - page_size, - PROT_READ | PROT_WRITE, - dom->shared_info_mfn); - if ( shared_info == NULL ) - return -1; - dom->arch_hooks->shared_info(dom, shared_info); - munmap(shared_info, page_size); - return 0; -} diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/xc_physdev.c --- a/tools/libxc/xc_physdev.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/libxc/xc_physdev.c Thu May 15 16:23:56 2008 +0900 @@ -52,6 +52,7 @@ int xc_physdev_map_pirq_msi(int xc_handl int *pirq, int devfn, int bus, + int entry_nr, int msi_type) { int rc; @@ -66,6 +67,7 @@ int xc_physdev_map_pirq_msi(int xc_handl map.pirq = *pirq; map.msi_info.devfn = devfn; map.msi_info.bus = bus; + map.msi_info.entry_nr = entry_nr; map.msi_info.msi = msi_type; rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map); diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Thu May 15 14:53:48 2008 +0900 +++ b/tools/libxc/xenctrl.h Thu May 15 16:23:56 2008 +0900 @@ -55,10 +55,6 @@ #define xen_mb() asm volatile ("mf" ::: "memory") #define xen_rmb() asm volatile ("mf" ::: "memory") #define xen_wmb() asm volatile ("mf" ::: "memory") -#elif defined(__powerpc__) -#define xen_mb() asm volatile ("sync" : : : "memory") -#define xen_rmb() asm volatile ("sync" : : : "memory") /* lwsync? */ -#define xen_wmb() asm volatile ("sync" : : : "memory") /* eieio? */ #else #error "Define barriers" #endif @@ -863,6 +859,7 @@ int xc_physdev_map_pirq_msi(int xc_handl int *pirq, int devfn, int bus, + int entry_nr, int msi_type); int xc_physdev_unmap_pirq(int xc_handle, @@ -943,11 +940,6 @@ xc_error_handler xc_set_error_handler(xc int xc_set_hvm_param(int handle, domid_t dom, int param, unsigned long value); int xc_get_hvm_param(int handle, domid_t dom, int param, unsigned long *value); - -/* PowerPC specific. */ -int xc_alloc_real_mode_area(int xc_handle, - uint32_t domid, - unsigned int log); /* IA64 specific, nvram save */ int xc_ia64_save_to_nvram(int xc_handle, uint32_t dom); diff -r ef290f39ae6b -r c96507e0c83d tools/libxc/xenguest.h --- a/tools/libxc/xenguest.h Thu May 15 14:53:48 2008 +0900 +++ b/tools/libxc/xenguest.h Thu May 15 16:23:56 2008 +0900 @@ -136,18 +136,4 @@ int xc_hvm_build_mem(int xc_handle, const char *image_buffer, unsigned long image_size); -/* PowerPC specific. */ -int xc_prose_build(int xc_handle, - uint32_t domid, - unsigned int mem_mb, - const char *image_name, - const char *ramdisk_name, - const char *cmdline, - const char *features, - unsigned long flags, - unsigned int store_evtchn, - unsigned long *store_mfn, - unsigned int console_evtchn, - unsigned long *console_mfn); - #endif /* XENGUEST_H */ diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/lowlevel/xc/xc.c Thu May 15 16:23:56 2008 +0900 @@ -1350,28 +1350,6 @@ static PyObject *dom_op(XcObject *self, return zero; } -#ifdef __powerpc__ -static PyObject *pyxc_alloc_real_mode_area(XcObject *self, - PyObject *args, - PyObject *kwds) -{ - uint32_t dom; - unsigned int log; - - static char *kwd_list[] = { "dom", "log", NULL }; - - if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, - &dom, &log) ) - return NULL; - - if ( xc_alloc_real_mode_area(self->xc_handle, dom, log) ) - return pyxc_error_to_exception(); - - Py_INCREF(zero); - return zero; -} -#endif /* powerpc */ - static PyMethodDef pyxc_methods[] = { { "handle", (PyCFunction)pyxc_handle, @@ -1759,16 +1737,6 @@ static PyMethodDef pyxc_methods[] = { "Inject debug keys into Xen.\n" " keys [str]: String of keys to inject.\n" }, -#ifdef __powerpc__ - { "arch_alloc_real_mode_area", - (PyCFunction)pyxc_alloc_real_mode_area, - METH_VARARGS | METH_KEYWORDS, "\n" - "Allocate a domain's real mode area.\n" - " dom [int]: Identifier of domain.\n" - " log [int]: Specifies the area's size.\n" - "Returns: [int] 0 on success; -1 on error.\n" }, -#endif /* __powerpc */ - #if defined(__i386__) || defined(__x86_64__) { "domain_check_cpuid", (PyCFunction)pyxc_dom_check_cpuid, diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/util/xsm/acm/acm.py --- a/tools/python/xen/util/xsm/acm/acm.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/util/xsm/acm/acm.py Thu May 15 16:23:56 2008 +0900 @@ -1363,6 +1363,45 @@ def relabel_domains(relabel_list): return rc, errors +def __update_label_policy_change(sec_lab, + cur_poltype, + cur_polname, + new_poltype, + new_polname, + polnew_labels, + label_map): + """ + Determine a new resource label given the new policy's type + and name and the new policy's (resource/VM) labels and the + (resource/VM) label map that indicates renaming rules for + labels. + """ + is_deleted = False + policytype, policy, label = sec_lab + + if cur_poltype != policytype or \ + cur_polname != policy: + return sec_lab, is_deleted + + if policytype != xsconstants.ACM_POLICY_ID: + return sec_lab, is_deleted + elif label_map.has_key(label) and policy == cur_polname: + # renaming of an active label; policy may have been renamed + label = label_map[label] + polname = new_polname + elif label not in polnew_labels: + # label been removed + policytype = xsconstants.INVALID_POLICY_PREFIX + policytype + polname = policy + is_deleted = True + else: + # no change to label + policytype = xsconstants.ACM_POLICY_ID + polname = new_polname + + return tuple( [ policytype, polname, label ] ), is_deleted + + def change_acm_policy(bin_pol, del_array, chg_array, vmlabel_map, reslabel_map, cur_acmpol, new_acmpol, is_reset): @@ -1430,30 +1469,21 @@ def change_acm_policy(bin_pol, del_array else: return -xsconstants.XSERR_BAD_LABEL_FORMAT, "" - if policytype != cur_policytype or \ - policy != cur_policyname: - continue - - # label been renamed or deleted? - if policytype != xsconstants.ACM_POLICY_ID: - continue - elif reslabel_map.has_key(label) and cur_policyname == policy: - # renaming of an active label; policy may have been renamed - label = reslabel_map[label] - polname = new_policyname - elif label not in polnew_reslabels: - # label been removed - policytype = xsconstants.INVALID_POLICY_PREFIX + policytype + new_sec_lab, is_deleted = \ + __update_label_policy_change( tuple([policytype, + policy, + label]), + cur_policytype, + cur_policyname, + new_policytype, + new_policyname, + polnew_reslabels, + reslabel_map) + + if is_deleted: label_changes.append(key) - polname = policy - else: - # no change to label - policytype = xsconstants.ACM_POLICY_ID - polname = new_policyname - # Update entry - access_control[key] = \ - tuple([ policytype, polname, label ]) + access_control[key] = new_sec_lab # All resources have new labels in the access_control map # There may still be labels in there that are invalid now. @@ -1509,6 +1539,29 @@ def change_acm_policy(bin_pol, del_array new_acmpol.policy_get_virtualmachinelabel_names()) if not compatible: return (-xsconstants.XSERR_RESOURCE_ACCESS, "") + + for dominfo in dominfos: + # relabel the VIF interfaces + changed = False + for vif_uuid in dominfo.get_vifs(): + sec_lab = dominfo.info['devices'][vif_uuid][1]\ + .get('security_label') + if sec_lab: + result, _ = \ + __update_label_policy_change(tuple(sec_lab.split(':')), + cur_policytype, + cur_policyname, + new_policytype, + new_policyname, + polnew_reslabels, + reslabel_map) + new_sec_lab = ':'.join(list(result)) + if new_sec_lab != sec_lab: + changed = True + dominfo.info['devices'][vif_uuid][1]\ + ['security_label'] = new_sec_lab + if changed: + XendDomain.instance().managed_config_save(dominfo) rc, errors = hv_chg_policy(bin_pol, del_array, chg_array) if rc == 0: diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/web/connection.py --- a/tools/python/xen/web/connection.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/web/connection.py Thu May 15 16:23:56 2008 +0900 @@ -18,11 +18,17 @@ #============================================================================ import sys +import os import threading import socket import fcntl from errno import EAGAIN, EINTR, EWOULDBLOCK + +try: + from OpenSSL import SSL +except ImportError: + pass from xen.xend.XendLogging import log @@ -113,6 +119,167 @@ class SocketListener: break finally: self.close() + + +class SSLSocketServerConnection(SocketServerConnection): + """An SSL aware accepted connection to a server. + + As pyOpenSSL SSL.Connection fileno() method just retrieve the file + descriptor number for the underlying socket, direct read/write to the file + descriptor will result no data encrypted. + + recv2fd() and fd2send() are simple wrappers for functions who need direct + read/write to a file descriptor rather than a socket like object. + + To use recv2fd(), you can create a pipe and start a thread to transfer all + received data to one end of the pipe, then read from the other end: + + p2cread, p2cwrite = os.pipe() + threading.Thread(target=connection.SSLSocketServerConnection.recv2fd, + args=(sock, p2cwrite)).start() + os.read(p2cread, 1024) + + To use fd2send(): + + p2cread, p2cwrite = os.pipe() + threading.Thread(target=connection.SSLSocketServerConnection.fd2send, + args=(sock, p2cread)).start() + os.write(p2cwrite, "data") + """ + + def __init__(self, sock, protocol_class): + SocketServerConnection.__init__(self, sock, protocol_class) + + + def main(self): + try: + while True: + try: + data = self.sock.recv(BUFFER_SIZE) + if data == "": + break + if self.protocol.dataReceived(data): + break + except socket.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + break + except (SSL.WantReadError, SSL.WantWriteError, \ + SSL.WantX509LookupError): + # The operation did not complete; the same I/O method + # should be called again. + continue + except SSL.ZeroReturnError: + # The SSL Connection has been closed. + break + except SSL.SysCallError, (retval, desc): + if ((retval == -1 and desc == "Unexpected EOF") + or retval > 0): + # The SSL Connection is lost. + break + log.debug("SSL SysCallError:%d:%s" % (retval, desc)) + break + except SSL.Error, e: + # other SSL errors + log.debug("SSL Error:%s" % e) + break + finally: + try: + self.sock.close() + except: + pass + + + def recv2fd(sock, fd): + try: + while True: + try: + data = sock.recv(BUFFER_SIZE) + if data == "": + break + count = 0 + while count < len(data): + try: + nbytes = os.write(fd, data[count:]) + count += nbytes + except os.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + raise + except socket.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + break + except (SSL.WantReadError, SSL.WantWriteError, \ + SSL.WantX509LookupError): + # The operation did not complete; the same I/O method + # should be called again. + continue + except SSL.ZeroReturnError: + # The SSL Connection has been closed. + break + except SSL.SysCallError, (retval, desc): + if ((retval == -1 and desc == "Unexpected EOF") + or retval > 0): + # The SSL Connection is lost. + break + log.debug("SSL SysCallError:%d:%s" % (retval, desc)) + break + except SSL.Error, e: + # other SSL errors + log.debug("SSL Error:%s" % e) + break + finally: + try: + sock.close() + os.close(fd) + except: + pass + + recv2fd = staticmethod(recv2fd) + + + def fd2send(sock, fd): + try: + while True: + try: + data = os.read(fd, BUFFER_SIZE) + if data == "": + break + count = 0 + while count < len(data): + try: + nbytes = sock.send(data[count:]) + count += nbytes + except socket.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + raise + except (SSL.WantReadError, SSL.WantWriteError, \ + SSL.WantX509LookupError): + # The operation did not complete; the same I/O method + # should be called again. + continue + except SSL.ZeroReturnError: + # The SSL Connection has been closed. + raise + except SSL.SysCallError, (retval, desc): + if not (retval == -1 and data == ""): + # errors when writing empty strings are expected + # and can be ignored + log.debug("SSL SysCallError:%d:%s" % (retval, desc)) + raise + except SSL.Error, e: + # other SSL errors + log.debug("SSL Error:%s" % e) + raise + except os.error, ex: + if ex.args[0] not in (EWOULDBLOCK, EAGAIN, EINTR): + break + finally: + try: + sock.close() + os.close(fd) + except: + pass + + fd2send = staticmethod(fd2send) def hostAllowed(addrport, hosts_allowed): diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/web/tcp.py --- a/tools/python/xen/web/tcp.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/web/tcp.py Thu May 15 16:23:56 2008 +0900 @@ -88,6 +88,7 @@ class SSLTCPListener(TCPListener): ctx.use_certificate_file(self.ssl_cert_file) sock = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) + sock.set_accept_state() sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # SO_REUSEADDR does not always ensure that we do not get an address @@ -104,3 +105,14 @@ class SSLTCPListener(TCPListener): else: raise + + def acceptConnection(self, sock, addrport): + addr = addrport[0] + if connection.hostAllowed(addrport, self.hosts_allow): + connection.SSLSocketServerConnection(sock, self.protocol_class) + else: + try: + sock.close() + except: + pass + diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xend/XendCheckpoint.py --- a/tools/python/xen/xend/XendCheckpoint.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xend/XendCheckpoint.py Thu May 15 16:23:56 2008 +0900 @@ -81,8 +81,6 @@ def save(fd, dominfo, network, live, dst # thing is useful for debugging. dominfo.setName('migrating-' + domain_name) - done_suspend = 0 - try: dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP1, domain_name) @@ -110,7 +108,6 @@ def save(fd, dominfo, network, live, dst log.debug("Suspending %d ...", dominfo.getDomid()) dominfo.shutdown('suspend') dominfo.waitForShutdown() - done_suspend = 1 dominfo.migrateDevices(network, dst, DEV_MIGRATE_STEP2, domain_name) log.info("Domain %d suspended.", dominfo.getDomid()) @@ -154,16 +151,9 @@ def save(fd, dominfo, network, live, dst pass except Exception, exn: - log.exception("Save failed on domain %s (%s).", domain_name, + log.exception("Save failed on domain %s (%s) - resuming.", domain_name, dominfo.getDomid()) - - # If we didn't get as far as suspending the domain (for - # example, we couldn't balloon enough memory for the new - # domain), then we don't want to re-plumb the devices, as the - # domU will not be expecting it. - if done_suspend: - log.debug("XendCheckpoint.save: resumeDomain") - dominfo.resumeDomain() + dominfo.resumeDomain() try: dominfo.setName(domain_name) diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xend/XendConfig.py Thu May 15 16:23:56 2008 +0900 @@ -640,46 +640,84 @@ class XendConfig(dict): else: cfg['cpus'] = str(cfg['cpu']) - # Convert 'cpus' to list of ints + # Convert 'cpus' to list of list of ints + cpus_list = [] if 'cpus' in cfg: - cpus = [] + # Convert the following string to list of ints. + # The string supports a list of ranges (0-3), + # seperated by commas, and negation (^1). + # Precedence is settled by order of the string: + # "0-3,^1" -> [0,2,3] + # "0-3,^1,1" -> [0,1,2,3] + def cnv(s): + l = [] + for c in s.split(','): + if c.find('-') != -1: + (x, y) = c.split('-') + for i in range(int(x), int(y)+1): + l.append(int(i)) + else: + # remove this element from the list + if c[0] == '^': + l = [x for x in l if x != int(c[1:])] + else: + l.append(int(c)) + return l + if type(cfg['cpus']) == list: - # If sxp_cfg was created from config.sxp, - # the form of 'cpus' is list of string. - # Convert 'cpus' to list of ints. - # ['1'] -> [1] - # ['0','2','3'] -> [0,2,3] + if len(cfg['cpus']) > 0 and type(cfg['cpus'][0]) == list: + # If sxp_cfg was created from config.sxp, + # the form of 'cpus' is list of list of string. + # Convert 'cpus' to list of list of ints. + # Conversion examples: + # [['1']] -> [[1]] + # [['0','2'],['1','3']] -> [[0,2],[1,3]] + try: + for c1 in cfg['cpus']: + cpus = [] + for c2 in c1: + cpus.append(int(c2)) + cpus_list.append(cpus) + except ValueError, e: + raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) + else: + # Conversion examples: + # ["1"] -> [[1]] + # ["0,2","1,3"] -> [[0,2],[1,3]] + # ["0-3,^1","1-4,^2"] -> [[0,2,3],[1,3,4]] + try: + for c in cfg['cpus']: + cpus = cnv(c) + cpus_list.append(cpus) + except ValueError, e: + raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) + + if len(cpus_list) != cfg['vcpus']: + raise XendConfigError('vcpus and the item number of cpus are not same') + else: + # Conversion examples: + # vcpus=1: + # "1" -> [[1]] + # "0-3,^1" -> [[0,2,3]] + # vcpus=2: + # "1" -> [[1],[1]] + # "0-3,^1" -> [[0,2,3],[0,2,3]] try: - for c in cfg['cpus']: - cpus.append(int(c)) - - cfg['cpus'] = cpus + cpus = cnv(cfg['cpus']) + for v in range(0, cfg['vcpus']): + cpus_list.append(cpus) except ValueError, e: raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) - else: - # Convert 'cpus' string to list of ints - # 'cpus' supports a list of ranges (0-3), - # seperated by commas, and negation, (^1). - # Precedence is settled by order of the - # string: - # "0-3,^1" -> [0,2,3] - # "0-3,^1,1" -> [0,1,2,3] - try: - for c in cfg['cpus'].split(','): - if c.find('-') != -1: - (x, y) = c.split('-') - for i in range(int(x), int(y)+1): - cpus.append(int(i)) - else: - # remove this element from the list - if c[0] == '^': - cpus = [x for x in cpus if x != int(c[1:])] - else: - cpus.append(int(c)) - - cfg['cpus'] = cpus - except ValueError, e: - raise XendConfigError('cpus = %s: %s' % (cfg['cpus'], e)) + else: + # Generation examples: + # vcpus=1: + # -> [[]] + # vcpus=2: + # -> [[],[]] + for v in range(0, cfg['vcpus']): + cpus_list.append(list()) + + cfg['cpus'] = cpus_list # Parse cpuid if 'cpuid' in cfg: diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xend/XendDomain.py Thu May 15 16:23:56 2008 +0900 @@ -1293,23 +1293,56 @@ class XendDomain: if port == 0: port = xoptions.get_xend_relocation_port() - try: - tls = xoptions.get_xend_relocation_tls() - if tls: - from OpenSSL import SSL + tls = xoptions.get_xend_relocation_tls() + if tls: + from OpenSSL import SSL + from xen.web import connection + try: ctx = SSL.Context(SSL.SSLv23_METHOD) - sock = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) + sock = SSL.Connection(ctx, + socket.socket(socket.AF_INET, socket.SOCK_STREAM)) sock.set_connect_state() - else: + sock.connect((dst, port)) + sock.send("sslreceive\n") + sock.recv(80) + except SSL.Error, err: + raise XendError("SSL error: %s" % err) + except socket.error, err: + raise XendError("can't connect: %s" % err) + + p2cread, p2cwrite = os.pipe() + threading.Thread(target=connection.SSLSocketServerConnection.fd2send, + args=(sock, p2cread)).start() + + try: + XendCheckpoint.save(p2cwrite, dominfo, True, live, dst, + node=node) + finally: + sock.shutdown() + sock.close() + + os.close(p2cread) + os.close(p2cwrite) + else: + try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.connect((dst, port)) - except socket.error, err: - raise XendError("can't connect: %s" % err[1]) - - sock.send("receive\n") - sock.recv(80) - XendCheckpoint.save(sock.fileno(), dominfo, True, live, dst, node=node) - sock.close() + # When connecting to our ssl enabled relocation server using a + # plain socket, send will success but recv will block. Add a + # 30 seconds timeout to raise a socket.timeout exception to + # inform the client. + sock.settimeout(30.0) + sock.connect((dst, port)) + sock.send("receive\n") + sock.recv(80) + sock.settimeout(None) + except socket.error, err: + raise XendError("can't connect: %s" % err) + + try: + XendCheckpoint.save(sock.fileno(), dominfo, True, live, + dst, node=node) + finally: + sock.close() def domain_save(self, domid, dst, checkpoint=False): """Start saving a domain to file. @@ -1365,28 +1398,25 @@ class XendDomain: raise XendInvalidDomain(str(domid)) # if vcpu is keyword 'all', apply the cpumap to all vcpus - vcpus = [ vcpu ] if str(vcpu).lower() == "all": vcpus = range(0, int(dominfo.getVCpuCount())) + else: + vcpus = [ int(vcpu) ] # set the same cpumask for all vcpus rc = 0 - if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): - for v in vcpus: - try: - rc = xc.vcpu_setaffinity(dominfo.getDomid(), int(v), cpumap) - except Exception, ex: - log.exception(ex) - raise XendError("Cannot pin vcpu: %s to cpu: %s - %s" % \ - (v, cpumap, str(ex))) - else: - # FIXME: if we could define cpu affinity definitions to - # each vcpu, reprogram the following processing. - if str(vcpu).lower() != "all": - raise XendError("Must specify 'all' to VCPU " - "for inactive managed domains") - dominfo.setCpus(cpumap) - self.managed_config_save(dominfo) + cpus = dominfo.getCpus() + for v in vcpus: + try: + if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED): + rc = xc.vcpu_setaffinity(dominfo.getDomid(), v, cpumap) + cpus[v] = cpumap + except Exception, ex: + log.exception(ex) + raise XendError("Cannot pin vcpu: %d to cpu: %s - %s" % \ + (v, cpumap, str(ex))) + dominfo.setCpus(cpus) + self.managed_config_save(dominfo) return rc diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu May 15 16:23:56 2008 +0900 @@ -1051,8 +1051,8 @@ class XendDomainInfo: ['running', 0], ['cpu_time', 0.0], ['cpu', -1], - ['cpumap', self.info['cpus'] and \ - self.info['cpus'] or range(64)]]) + ['cpumap', self.info['cpus'][i] and \ + self.info['cpus'][i] or range(64)]]) return sxpr @@ -1477,6 +1477,13 @@ class XendDomainInfo: self.info['VCPUs_live'] = vcpus self._writeDom(self._vcpuDomDetails()) else: + if self.info['VCPUs_max'] > vcpus: + # decreasing + del self.info['cpus'][vcpus:] + elif self.info['VCPUs_max'] < vcpus: + # increasing + for c in range(self.info['VCPUs_max'], vcpus): + self.info['cpus'].append(list()) self.info['VCPUs_max'] = vcpus xen.xend.XendDomain.instance().managed_config_save(self) log.info("Set VCPU count on domain %s to %d", self.info['name_label'], @@ -2071,9 +2078,17 @@ class XendDomainInfo: # repin domain vcpus if a restricted cpus list is provided # this is done prior to memory allocation to aide in memory # distribution for NUMA systems. - if self.info['cpus'] is not None and len(self.info['cpus']) > 0: + def has_cpus(): + if self.info['cpus'] is not None: + for c in self.info['cpus']: + if c: + return True + return False + + if has_cpus(): for v in range(0, self.info['VCPUs_max']): - xc.vcpu_setaffinity(self.domid, v, self.info['cpus']) + if self.info['cpus'][v]: + xc.vcpu_setaffinity(self.domid, v, self.info['cpus'][v]) else: def find_relaxed_node(node_list): import sys @@ -2363,8 +2378,19 @@ class XendDomainInfo: def resumeDomain(self): log.debug("XendDomainInfo.resumeDomain(%s)", str(self.domid)) - if self.domid is None: + # resume a suspended domain (e.g. after live checkpoint, or after + # a later error during save or migate); checks that the domain + # is currently suspended first so safe to call from anywhere + + xeninfo = dom_get(self.domid) + if xeninfo is None: return + if not xeninfo['shutdown']: + return + reason = shutdown_reason(xeninfo['shutdown_reason']) + if reason != 'suspend': + return + try: # could also fetch a parsed note from xenstore fast = self.info.get_notes().get('SUSPEND_CANCEL') and 1 or 0 diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xend/arch.py --- a/tools/python/xen/xend/arch.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xend/arch.py Thu May 15 16:23:56 2008 +0900 @@ -28,7 +28,5 @@ _types = { "amd64": "x86", "i86pc": "x86", "ia64": "ia64", - "ppc": "powerpc", - "ppc64": "powerpc", } type = _types.get(os.uname()[4], "unknown") diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xend/image.py Thu May 15 16:23:56 2008 +0900 @@ -294,11 +294,11 @@ class ImageHandler: vnclisten = vnc_config.get('vnclisten', XendOptions.instance().get_vnclisten_address()) - vncdisplay = vnc_config.get('vncdisplay', 0) + vncdisplay = int(vnc_config.get('vncdisplay', 0)) ret.append('-vnc') ret.append("%s:%s%s" % (vnclisten, vncdisplay, vncopts)) - if vnc_config.get('vncunused', 0): + if int(vnc_config.get('vncunused', 1)) != 0: ret.append('-vncunused') elif has_sdl: @@ -506,20 +506,6 @@ class LinuxImageHandler(ImageHandler): return args -class PPC_LinuxImageHandler(LinuxImageHandler): - - ostype = "linux" - - def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb): - """@param shadow_mem_kb The configured shadow memory, in KiB. - @param maxmem_kb The configured maxmem, in KiB. - @return The corresponding required amount of shadow memory, also in - KiB. - PowerPC currently uses "shadow memory" to refer to the hash table.""" - return max(maxmem_kb / 64, shadow_mem_kb) - - - class HVMImageHandler(ImageHandler): ostype = "hvm" @@ -734,6 +720,9 @@ class IA64_HVM_ImageHandler(HVMImageHand (self.getRequiredInitialReservation() / 1024) ]) return args + def setCpuid(self): + # Guest CPUID configuration is not implemented yet. + return class IA64_Linux_ImageHandler(LinuxImageHandler): @@ -783,9 +772,6 @@ class X86_Linux_ImageHandler(LinuxImageH return LinuxImageHandler.buildDomain(self) _handlers = { - "powerpc": { - "linux": PPC_LinuxImageHandler, - }, "ia64": { "linux": IA64_Linux_ImageHandler, "hvm": IA64_HVM_ImageHandler, diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xend/server/blkif.py Thu May 15 16:23:56 2008 +0900 @@ -47,7 +47,7 @@ class BlkifController(DevController): except ValueError: dev_type = "disk" - if uname is None: + if uname == '': if dev_type == 'cdrom': (typ, params) = ("", "") else: @@ -56,8 +56,13 @@ class BlkifController(DevController): else: try: (typ, params) = string.split(uname, ':', 1) + if typ not in ('phy', 'file', 'tap'): + raise VmError( + 'Block device must have "phy", "file" or "tap" ' + 'specified to type') except ValueError: - (typ, params) = ("", "") + raise VmError( + 'Block device must have physical details specified') mode = config.get('mode', 'r') if mode not in ('r', 'w', 'w!'): @@ -83,6 +88,10 @@ class BlkifController(DevController): front = { 'virtual-device' : "%i" % devid, 'device-type' : dev_type } + + protocol = config.get('protocol') + if protocol: + front['protocol'] = protocol return (devid, back, front) @@ -157,6 +166,10 @@ class BlkifController(DevController): if uuid: config['uuid'] = uuid + proto = self.readFrontend(devid, 'protocol') + if proto: + config['protocol'] = proto + return config def destroyDevice(self, devid, force): diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xend/server/relocate.py --- a/tools/python/xen/xend/server/relocate.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xend/server/relocate.py Thu May 15 16:23:56 2008 +0900 @@ -17,10 +17,12 @@ #============================================================================ import re +import os import sys import StringIO +import threading -from xen.web import protocol, tcp, unix +from xen.web import protocol, tcp, unix, connection from xen.xend import sxp from xen.xend import XendDomain @@ -116,6 +118,24 @@ class RelocationProtocol(protocol.Protoc log.error(name + ": no transport") raise XendError(name + ": no transport") + def op_sslreceive(self, name, _): + if self.transport: + self.send_reply(["ready", name]) + p2cread, p2cwrite = os.pipe() + threading.Thread(target=connection.SSLSocketServerConnection.recv2fd, + args=(self.transport.sock, p2cwrite)).start() + try: + XendDomain.instance().domain_restore_fd(p2cread, + relocating=True) + except: + os.close(p2cread) + os.close(p2cwrite) + self.send_error() + self.close() + else: + log.error(name + ": no transport") + raise XendError(name + ": no transport") + def listenRelocation(): xoptions = XendOptions.instance() diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xm/create.py Thu May 15 16:23:56 2008 +0900 @@ -610,7 +610,7 @@ def configure_disks(config_devs, vals): def configure_disks(config_devs, vals): """Create the config for disks (virtual block devices). """ - for (uname, dev, mode, backend) in vals.disk: + for (uname, dev, mode, backend, protocol) in vals.disk: if uname.startswith('tap:'): cls = 'tap' else: @@ -622,6 +622,8 @@ def configure_disks(config_devs, vals): ['mode', mode ] ] if backend: config_vbd.append(['backend', backend]) + if protocol: + config_vbd.append(['protocol', protocol]) config_devs.append(['device', config_vbd]) def configure_pci(config_devs, vals): @@ -845,7 +847,10 @@ def preprocess_disk(vals): n = len(d) if n == 3: d.append(None) + d.append(None) elif n == 4: + d.append(None) + elif n == 5: pass else: err('Invalid disk specifier: ' + v) diff -r ef290f39ae6b -r c96507e0c83d tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/python/xen/xm/xenapi_create.py Thu May 15 16:23:56 2008 +0900 @@ -31,6 +31,7 @@ import sys import sys import os import traceback +import re def log(_, msg): #print "> " + msg @@ -509,7 +510,7 @@ class sxp2xml: if len(child) > 0 and child[0] == "device"] vbds_sxp = map(lambda x: x[1], [device for device in devices - if device[1][0] == "vbd"]) + if device[1][0] in ("vbd", "tap")]) vifs_sxp = map(lambda x: x[1], [device for device in devices if device[1][0] == "vif"]) @@ -707,9 +708,11 @@ class sxp2xml: = get_child_by_name(vbd_sxp, "mode") != "w" \ and "RO" or "RW" vbd.attributes["device"] \ - = get_child_by_name(vbd_sxp, "dev") + = re.sub(":cdrom$", "", get_child_by_name(vbd_sxp, "dev")) vbd.attributes["bootable"] = "1" - vbd.attributes["type"] = "disk" + vbd.attributes["type"] \ + = re.search(":cdrom$", get_child_by_name(vbd_sxp, "dev")) \ + and "CD" or "disk" vbd.attributes["qos_algorithm_type"] = "" return vbd diff -r ef290f39ae6b -r c96507e0c83d tools/xm-test/lib/XmTestLib/arch.py --- a/tools/xm-test/lib/XmTestLib/arch.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/xm-test/lib/XmTestLib/arch.py Thu May 15 16:23:56 2008 +0900 @@ -88,39 +88,6 @@ ia_HVMDefaults = {"memory" : } # End : Intel ia32 and ia64 as well as AMD 32-bit and 64-bit processors -# Begin: PowerPC -def ppc_checkBuffer(buffer): - checks = [ - {"pattern" : re.compile("^\d+:mon>\s*$", re.MULTILINE), - "message" : "domain trapped into XMON"}, - ] - - for i in range(0, len(checks)): - check=checks[i] - if check.get('pattern').search(buffer): - FAIL(check.get('message')) - - return - -def ppc_minSafeMem(): - return 64 - -def ppc_getDefaultKernel(): - """Get the path to the default DomU kernel""" - dom0Ver = commands.getoutput("uname -r"); - domUVer = dom0Ver.replace("xen0", "xenU"); - - return "/boot/vmlinux-" + domUVer; - -ppc_ParavirtDefaults = {"memory" : 64, - "vcpus" : 1, - "kernel" : ppc_getDefaultKernel(), - "root" : "/dev/ram0", - "ramdisk" : getRdPath() + "/initrd.img", - "extra" : "xencons=tty128 console=tty128", -} -# End : PowerPC - """Convert from uname specification to a more general platform.""" _uname_to_arch_map = { "i386" : "x86", @@ -129,8 +96,6 @@ _uname_to_arch_map = { "i686" : "x86", "x86_64": "x86_64", "ia64" : "ia64", - "ppc" : "powerpc", - "ppc64" : "powerpc", } # Lookup current platform. @@ -158,10 +123,5 @@ if _arch == "x86" or _arch == "x86_64" o minSafeMem = ia64_minSafeMem configDefaults['memory'] = ia64_minSafeMem() -elif _arch == "powerpc": - minSafeMem = ppc_minSafeMem - getDefaultKernel = ppc_getDefaultKernel - checkBuffer = ppc_checkBuffer - configDefaults = ppc_ParavirtDefaults else: raise ValueError, "Unknown architecture!" diff -r ef290f39ae6b -r c96507e0c83d tools/xm-test/lib/XmTestReport/arch.py --- a/tools/xm-test/lib/XmTestReport/arch.py Thu May 15 14:53:48 2008 +0900 +++ b/tools/xm-test/lib/XmTestReport/arch.py Thu May 15 16:23:56 2008 +0900 @@ -30,8 +30,6 @@ _uname_to_arch_map = { "i686" : "x86", "x86_64": "x86_64", "ia64" : "ia64", - "ppc" : "powerpc", - "ppc64" : "powerpc", } _arch = _uname_to_arch_map.get(os.uname()[4], "Unknown") @@ -44,9 +42,5 @@ elif _arch == "ia64": elif _arch == "ia64": cpuValues = {"arch" : "Unknown", "features" : "Unknown"} -elif _arch == "powerpc": - cpuValues = {"cpu" : "Unknown", - "platform" : "Unknown", - "revision" : "Unknown"} else: raise ValueError, "Unknown architecture!" diff -r ef290f39ae6b -r c96507e0c83d tools/xm-test/ramdisk/Makefile.am --- a/tools/xm-test/ramdisk/Makefile.am Thu May 15 14:53:48 2008 +0900 +++ b/tools/xm-test/ramdisk/Makefile.am Thu May 15 16:23:56 2008 +0900 @@ -14,7 +14,7 @@ INITRD ?= http://xm-test.xensource.com/ramdisks -BR_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/ppc\(64\)*/powerpc/' -e 's/x86_64/i386/') +BR_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/x86_64/i386/') @MK@ifdef BR_SNAPSHOT @MK@ BR_URL = http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2 diff -r ef290f39ae6b -r c96507e0c83d tools/xm-test/ramdisk/configs/buildroot-powerpc --- a/tools/xm-test/ramdisk/configs/buildroot-powerpc Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,338 +0,0 @@ -# -# Automatically generated make config: don't edit -# -BR2_HAVE_DOT_CONFIG=y -# BR2_alpha is not set -# BR2_arm is not set -# BR2_armeb is not set -# BR2_cris is not set -# BR2_i386 is not set -# BR2_m68k is not set -# BR2_mips is not set -# BR2_mipsel is not set -# BR2_nios2 is not set -BR2_powerpc=y -# BR2_sh is not set -# BR2_sh64 is not set -# BR2_sparc is not set -# BR2_x86_64 is not set -BR2_ARCH="powerpc" -BR2_ENDIAN="BIG" - -# -# Build options -# -BR2_WGET="wget --passive-ftp" -BR2_SVN="svn co" -BR2_ZCAT="zcat" -BR2_TAR_OPTIONS="" -BR2_DL_DIR="$(BASE_DIR)/dl" -BR2_SOURCEFORGE_MIRROR="easynews" -BR2_STAGING_DIR="$(BUILD_DIR)/staging_dir" -BR2_TOPDIR_PREFIX="" -BR2_TOPDIR_SUFFIX="" -BR2_GNU_BUILD_SUFFIX="pc-linux-gnu" -BR2_GNU_TARGET_SUFFIX="linux-uclibc" -BR2_JLEVEL=1 - -# -# Toolchain Options -# - -# -# Kernel Header Options -# -# BR2_KERNEL_HEADERS_2_4_25 is not set -# BR2_KERNEL_HEADERS_2_4_27 is not set -# BR2_KERNEL_HEADERS_2_4_29 is not set -# BR2_KERNEL_HEADERS_2_4_31 is not set -# BR2_KERNEL_HEADERS_2_6_9 is not set -# BR2_KERNEL_HEADERS_2_6_11 is not set -BR2_KERNEL_HEADERS_2_6_12=y -# BR2_KERNEL_HEADERS_2_6_18 is not set -BR2_DEFAULT_KERNEL_HEADERS="2.6.12" - -# -# uClibc Options -# -# BR2_UCLIBC_VERSION_SNAPSHOT is not set -# BR2_ENABLE_LOCALE is not set -# BR2_PTHREADS_NONE is not set -# BR2_PTHREADS is not set -BR2_PTHREADS_OLD=y -# BR2_PTHREADS_NATIVE is not set - -# -# Binutils Options -# -# BR2_BINUTILS_VERSION_2_14_90_0_8 is not set -# BR2_BINUTILS_VERSION_2_15 is not set -# BR2_BINUTILS_VERSION_2_15_94_0_2_2 is not set -# BR2_BINUTILS_VERSION_2_16_1 is not set -# BR2_BINUTILS_VERSION_2_16_90_0_3 is not set -# BR2_BINUTILS_VERSION_2_16_91_0_5 is not set -# BR2_BINUTILS_VERSION_2_16_91_0_6 is not set -# BR2_BINUTILS_VERSION_2_16_91_0_7 is not set -BR2_BINUTILS_VERSION_2_17=y -# BR2_BINUTILS_VERSION_2_17_50_0_2 is not set -# BR2_BINUTILS_VERSION_2_17_50_0_3 is not set -# BR2_BINUTILS_VERSION_2_17_50_0_4 is not set -# BR2_BINUTILS_VERSION_2_17_50_0_5 is not set -# BR2_BINUTILS_VERSION_2_17_50_0_6 is not set -BR2_BINUTILS_VERSION="2.17" -BR2_EXTRA_BINUTILS_CONFIG_OPTIONS="" - -# -# Gcc Options -# -# BR2_GCC_VERSION_3_3_5 is not set -# BR2_GCC_VERSION_3_3_6 is not set -BR2_GCC_VERSION_3_4_2=y -# BR2_GCC_VERSION_3_4_3 is not set -# BR2_GCC_VERSION_3_4_4 is not set -# BR2_GCC_VERSION_3_4_5 is not set -# BR2_GCC_VERSION_3_4_6 is not set -# BR2_GCC_VERSION_4_0_0 is not set -# BR2_GCC_VERSION_4_0_1 is not set -# BR2_GCC_VERSION_4_0_2 is not set -# BR2_GCC_VERSION_4_0_3 is not set -# BR2_GCC_VERSION_4_1_0 is not set -# BR2_GCC_VERSION_4_1_1 is not set -# BR2_GCC_VERSION_4_2 is not set -# BR2_GCC_IS_SNAP is not set -BR2_GCC_VERSION="3.4.2" -# BR2_GCC_USE_SJLJ_EXCEPTIONS is not set -BR2_EXTRA_GCC_CONFIG_OPTIONS="" -# BR2_INSTALL_LIBSTDCPP is not set -# BR2_INSTALL_OBJC is not set -# BR2_GCC_SHARED_LIBGCC is not set - -# -# Ccache Options -# -BR2_CCACHE=y - -# -# Gdb Options -# -# BR2_PACKAGE_GDB is not set -# BR2_PACKAGE_GDB_SERVER is not set -# BR2_PACKAGE_GDB_HOST is not set - -# -# elf2flt -# -# BR2_ELF2FLT is not set -# BR2_MKLIBS is not set - -# -# Common Toolchain Options -# -# BR2_PACKAGE_SSTRIP_TARGET is not set -# BR2_PACKAGE_SSTRIP_HOST is not set -BR2_ENABLE_MULTILIB=y -BR2_LARGEFILE=y -# BR2_SOFT_FLOAT is not set -BR2_TARGET_OPTIMIZATION="-Os -pipe" -BR2_CROSS_TOOLCHAIN_TARGET_UTILS=y - -# -# Package Selection for the target -# - -# -# The default minimal system -# -BR2_PACKAGE_BUSYBOX=y -# BR2_PACKAGE_BUSYBOX_SNAPSHOT is not set -BR2_PACKAGE_BUSYBOX_INSTALL_SYMLINKS=y -BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox.config" - -# -# The minimum needed to build a uClibc development system -# -# BR2_PACKAGE_BASH is not set -# BR2_PACKAGE_BZIP2 is not set -# BR2_PACKAGE_COREUTILS is not set -# BR2_PACKAGE_DIFFUTILS is not set -# BR2_PACKAGE_ED is not set -# BR2_PACKAGE_FINDUTILS is not set -# BR2_PACKAGE_FLEX is not set -# BR2_PACKAGE_GAWK is not set -# BR2_PACKAGE_GCC_TARGET is not set -# BR2_PACKAGE_CCACHE_TARGET is not set -# BR2_PACKAGE_GREP is not set -# BR2_PACKAGE_MAKE is not set -# BR2_PACKAGE_PATCH is not set -# BR2_PACKAGE_SED is not set -# BR2_PACKAGE_TAR is not set - -# -# Other stuff -# -# BR2_PACKAGE_ACPID is not set -# BR2_PACKAGE_ASTERISK is not set -# BR2_PACKAGE_AT is not set -# BR2_PACKAGE_AUTOCONF is not set -# BR2_PACKAGE_AUTOMAKE is not set -# BR2_PACKAGE_BERKELEYDB is not set -# BR2_PACKAGE_BIND is not set -# BR2_PACKAGE_BISON is not set -# BR2_PACKAGE_BOA is not set -# BR2_PACKAGE_BRIDGE is not set -# BR2_PACKAGE_CUSTOMIZE is not set -# BR2_PACKAGE_ISC_DHCP is not set -# BR2_PACKAGE_DIALOG is not set -# BR2_PACKAGE_DIRECTFB is not set -# BR2_PACKAGE_DISTCC is not set -# BR2_PACKAGE_DM is not set -# BR2_PACKAGE_DMRAID is not set -# BR2_PACKAGE_DNSMASQ is not set -# BR2_PACKAGE_DROPBEAR is not set -# BR2_PACKAGE_ETHTOOL is not set -# BR2_PACKAGE_EXPAT is not set -# BR2_PACKAGE_E2FSPROGS is not set -# BR2_PACKAGE_FAKEROOT is not set -# BR2_PACKAGE_FILE is not set -# BR2_PACKAGE_FREETYPE is not set -# BR2_PACKAGE_GETTEXT is not set -# BR2_PACKAGE_LIBINTL is not set -# BR2_PACKAGE_GZIP is not set -# BR2_PACKAGE_HASERL is not set -# BR2_PACKAGE_HDPARM is not set -# BR2_PACKAGE_HOSTAP is not set -# BR2_PACKAGE_HOTPLUG is not set -# BR2_PACKAGE_IOSTAT is not set -# BR2_PACKAGE_IPROUTE2 is not set -# BR2_PACKAGE_IPSEC_TOOLS is not set -# BR2_PACKAGE_IPTABLES is not set -# BR2_PACKAGE_JPEG is not set -# BR2_PACKAGE_LESS is not set -# BR2_PACKAGE_LIBCGI is not set -# BR2_PACKAGE_LIBCGICC is not set -# BR2_PACKAGE_LIBELF is not set -# BR2_PACKAGE_LIBFLOAT is not set -# BR2_PACKAGE_LIBGLIB12 is not set -# BR2_PACKAGE_LIBMAD is not set -# BR2_PACKAGE_LIBPCAP is not set -# BR2_PACKAGE_LIBPNG is not set -# BR2_PACKAGE_LIBSYSFS is not set -# BR2_PACKAGE_LIBTOOL is not set -# BR2_PACKAGE_LIBUSB is not set -# BR2_PACKAGE_LIGHTTPD is not set -# BR2_PACKAGE_LINKS is not set -# BR2_PACKAGE_LRZSZ is not set -# BR2_PACKAGE_LSOF is not set -# BR2_PACKAGE_LTP-TESTSUITE is not set -# BR2_PACKAGE_LTT is not set -# BR2_PACKAGE_LVM2 is not set -# BR2_PACKAGE_LZO is not set -# BR2_PACKAGE_LZMA is not set -# BR2_PACKAGE_M4 is not set -# BR2_PACKAGE_MDADM is not set -# BR2_PACKAGE_MEMTESTER is not set -# BR2_PACKAGE_MICROCOM is not set -# BR2_PACKAGE_MICROPERL is not set -# BR2_PACKAGE_MICROWIN is not set -# BR2_PACKAGE_MKDOSFS is not set -# BR2_PACKAGE_MODULE_INIT_TOOLS is not set -# BR2_PACKAGE_MODUTILS is not set -# BR2_PACKAGE_MPG123 is not set -# BR2_PACKAGE_MROUTED is not set -# BR2_PACKAGE_MTD is not set -# BR2_PACKAGE_NANO is not set -# BR2_PACKAGE_NBD is not set -# BR2_PACKAGE_NCURSES is not set -# BR2_PACKAGE_NETKITBASE is not set -# BR2_PACKAGE_NETKITTELNET is not set -# BR2_PACKAGE_NETSNMP is not set -# BR2_PACKAGE_NEWT is not set -# BR2_PACKAGE_NTP is not set -# BR2_PACKAGE_OPENNTPD is not set -# BR2_PACKAGE_OPENSSH is not set -# BR2_PACKAGE_OPENSSL is not set -# BR2_PACKAGE_OPENVPN is not set -# BR2_PACKAGE_PCIUTILS is not set -# BR2_PACKAGE_PKGCONFIG is not set -# BR2_PACKAGE_PORTAGE is not set -# BR2_PACKAGE_PORTMAP is not set -# BR2_PACKAGE_PPPD is not set -# BR2_PACKAGE_PROCPS is not set -# BR2_PACKAGE_PSMISC is not set -# BR2_PACKAGE_PYTHON is not set -# BR2_PACKAGE_QTE is not set -BR2_QTE_TMAKE_VERSION="1.13" -# BR2_PACKAGE_RAIDTOOLS is not set -# BR2_READLINE is not set -# BR2_PACKAGE_RSYNC is not set -# BR2_PACKAGE_RUBY is not set -# BR2_PACKAGE_RXVT is not set -# BR2_PACKAGE_SDL is not set -# BR2_PACKAGE_SFDISK is not set -# BR2_PACKAGE_SLANG is not set -# BR2_PACKAGE_SMARTMONTOOLS is not set -# BR2_PACKAGE_SOCAT is not set -# BR2_PACKAGE_SQLITE is not set -# BR2_PACKAGE_STRACE is not set -# BR2_PACKAGE_SUDO is not set -# BR2_PACKAGE_SYSKLOGD is not set -# BR2_PACKAGE_SYSVINIT is not set -# BR2_PACKAGE_TCL is not set -# BR2_PACKAGE_TCPDUMP is not set -# BR2_PACKAGE_TFTPD is not set -# BR2_PACKAGE_THTTPD is not set -# BR2_PACKAGE_TINYLOGIN is not set -# BR2_PACKAGE_TINYX is not set -# BR2_PACKAGE_TN5250 is not set -# BR2_PACKAGE_TTCP is not set -# BR2_PACKAGE_UDEV is not set -# BR2_PACKAGE_UDHCP is not set -# BR2_PACKAGE_UEMACS is not set -# BR2_PACKAGE_USBUTILS is not set -# BR2_PACKAGE_UTIL-LINUX is not set -# BR2_PACKAGE_VALGRIND is not set -# BR2_PACKAGE_VTUN is not set -# BR2_PACKAGE_WGET is not set -# BR2_PACKAGE_WHICH is not set -# BR2_PACKAGE_WIPE is not set -# BR2_PACKAGE_WIRELESS_TOOLS is not set -# BR2_PACKAGE_XFSPROGS is not set -# BR2_PACKAGE_ZLIB is not set -BR2_PACKAGE_HPING=y - -# -# Target Options -# - -# -# filesystem for target device -# -# BR2_TARGET_ROOTFS_CRAMFS is not set -# BR2_TARGET_ROOTFS_CLOOP is not set -BR2_TARGET_ROOTFS_EXT2=y -BR2_TARGET_ROOTFS_EXT2_BLOCKS=0 -BR2_TARGET_ROOTFS_EXT2_INODES=0 -BR2_TARGET_ROOTFS_EXT2_RESBLKS=0 -BR2_TARGET_ROOTFS_EXT2_SQUASH=y -BR2_TARGET_ROOTFS_EXT2_OUTPUT="$(IMAGE).ext2" -# BR2_TARGET_ROOTFS_EXT2_GZ is not set -BR2_TARGET_ROOTFS_EXT2_COPYTO="" -# BR2_TARGET_ROOTFS_JFFS2 is not set -# BR2_TARGET_ROOTFS_SQUASHFS is not set -# BR2_TARGET_ROOTFS_TAR is not set - -# -# bootloader for target device -# -# BR2_TARGET_YABOOT is not set - -# -# Board Support Options -# - -# -# Generic System Support -# -# BR2_TARGET_GENERIC_ACCESS_POINT is not set -# BR2_TARGET_GENERIC_FIREWALL is not set -# BR2_TARGET_GENERIC_DEV_SYSTEM is not set diff -r ef290f39ae6b -r c96507e0c83d tools/xm-test/ramdisk/make-release.sh --- a/tools/xm-test/ramdisk/make-release.sh Thu May 15 14:53:48 2008 +0900 +++ b/tools/xm-test/ramdisk/make-release.sh Thu May 15 16:23:56 2008 +0900 @@ -3,9 +3,6 @@ if [ "$1" == "" ] if [ "$1" == "" ] then arch="" -elif [ "$1" == "powerpc" ] -then - arch="BR_ARCH=powerpc" else echo "Invalid architecture specified." >&2 exit 1 diff -r ef290f39ae6b -r c96507e0c83d tools/xm-test/runtest.sh --- a/tools/xm-test/runtest.sh Thu May 15 14:53:48 2008 +0900 +++ b/tools/xm-test/runtest.sh Thu May 15 16:23:56 2008 +0900 @@ -77,7 +77,7 @@ runnable_tests() { # using the right version realrd=$(readlink ramdisk/initrd.img) eval $(./lib/XmTestReport/xmtest.py) - ARCH=$(uname -m | sed -e s/i.86/i386/ -e 's/ppc\(64\)*/powerpc/') + ARCH=$(uname -m | sed -e s/i.86/i386/) rrdver="initrd-${XM_TEST_MAJ}.${XM_TEST_MIN}-${ARCH}.img" exp_flag=0 realarch=`echo $realrd | awk -F- '{print $3}' | awk -F. '{print $1}'` diff -r ef290f39ae6b -r c96507e0c83d unmodified_drivers/linux-2.6/overrides.mk --- a/unmodified_drivers/linux-2.6/overrides.mk Thu May 15 14:53:48 2008 +0900 +++ b/unmodified_drivers/linux-2.6/overrides.mk Thu May 15 16:23:56 2008 +0900 @@ -4,12 +4,14 @@ # # (i.e. we need the native config for things like -mregparm, but # a Xen kernel to find the right headers) -EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030205 -EXTRA_CFLAGS += -DCONFIG_XEN_COMPAT=0xffffff -EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H +_XEN_CPPFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030205 +_XEN_CPPFLAGS += -DCONFIG_XEN_COMPAT=0xffffff +_XEN_CPPFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H ifeq ($(ARCH),ia64) - EXTRA_CFLAGS += -DCONFIG_VMX_GUEST + _XEN_CPPFLAGS += -DCONFIG_VMX_GUEST endif -EXTRA_CFLAGS += -include $(objtree)/include/linux/autoconf.h -EXTRA_AFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_XEN_PLATFORM_COMPAT_H +_XEN_CPPFLAGS += -include $(objtree)/include/linux/autoconf.h + +EXTRA_CFLAGS += $(_XEN_CPPFLAGS) +EXTRA_AFLAGS += $(_XEN_CPPFLAGS) diff -r ef290f39ae6b -r c96507e0c83d xen/Rules.mk --- a/xen/Rules.mk Thu May 15 14:53:48 2008 +0900 +++ b/xen/Rules.mk Thu May 15 16:23:56 2008 +0900 @@ -30,8 +30,7 @@ endif # Set ARCH/SUBARCH appropriately. override TARGET_SUBARCH := $(XEN_TARGET_ARCH) override TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \ - sed -e 's/x86.*/x86/' \ - -e 's/powerpc.*/powerpc/') + sed -e 's/x86.*/x86/') TARGET := $(BASEDIR)/xen diff -r ef290f39ae6b -r c96507e0c83d xen/arch/ia64/xen/dom0_ops.c --- a/xen/arch/ia64/xen/dom0_ops.c Thu May 15 14:53:48 2008 +0900 +++ b/xen/arch/ia64/xen/dom0_ops.c Thu May 15 16:23:56 2008 +0900 @@ -407,10 +407,15 @@ long arch_do_sysctl(xen_sysctl_t *op, XE { int i; uint32_t max_array_ent; + XEN_GUEST_HANDLE_64(uint32) cpu_to_node_arr; xen_sysctl_physinfo_t *pi = &op->u.physinfo; + max_array_ent = pi->max_cpu_id; + cpu_to_node_arr = pi->cpu_to_node; + memset(pi, 0, sizeof(*pi)); + pi->cpu_to_node = cpu_to_node_arr; pi->threads_per_core = cpus_weight(cpu_sibling_map[0]); pi->cores_per_socket = cpus_weight(cpu_core_map[0]) / pi->threads_per_core; @@ -421,16 +426,15 @@ long arch_do_sysctl(xen_sysctl_t *op, XE pi->scrub_pages = avail_scrub_pages(); pi->cpu_khz = local_cpu_data->proc_freq / 1000; - max_array_ent = pi->max_cpu_id; pi->max_cpu_id = last_cpu(cpu_online_map); max_array_ent = min_t(uint32_t, max_array_ent, pi->max_cpu_id); ret = 0; - if (!guest_handle_is_null(pi->cpu_to_node)) { + if (!guest_handle_is_null(cpu_to_node_arr)) { for (i = 0; i <= max_array_ent; i++) { uint32_t node = cpu_online(i) ? cpu_to_node(i) : ~0u; - if (copy_to_guest_offset(pi->cpu_to_node, i, &node, 1)) { + if (copy_to_guest_offset(cpu_to_node_arr, i, &node, 1)) { ret = -EFAULT; break; } diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/0opt.c --- a/xen/arch/powerpc/0opt.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#include -#include - -extern void __xchg_called_with_bad_pointer(void); -void __xchg_called_with_bad_pointer(void) -{ - BUG(); -} - -extern void __cmpxchg_called_with_bad_pointer(void); -void __cmpxchg_called_with_bad_pointer(void) -{ - BUG(); -} diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/Makefile --- a/xen/arch/powerpc/Makefile Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -ifneq ($(DOM0_IMAGE),) -builtin_dom0 := y -endif - -subdir-$(HAS_PPC64) += powerpc64 -subdir-y += papr - -obj-y += audit.o -obj-y += backtrace.o -obj-y += bitops.o -obj-y += boot_of.o -obj-y += cmdline.o -obj-y += dart.o -obj-y += dart_u3.o -obj-y += dart_u4.o -obj-y += domctl.o -obj-y += domain_build.o -obj-y += domain.o -obj-y += exceptions.o -obj-y += external.o -obj-y += float.o -obj-y += hcalls.o -obj-y += iommu.o -obj-y += irq.o -obj-y += systemsim.o -obj-y += memory.o -obj-y += mm.o -obj-y += mpic.o -obj-y += mpic_init.o -obj-y += multiboot2.o -obj-y += numa.o -obj-y += of-devtree.o -obj-y += of-devwalk.o -obj-y += ofd_fixup.o -obj-y += ofd_fixup_memory.o -obj-y += physdev.o -obj-y += platform.o -obj-y += rtas.o -obj-y += rtas_nvram.o -obj-y += rtas_flash.o -obj-y += setup.o -obj-y += shadow.o -obj-y += smp.o -obj-y += smpboot.o -obj-y += smp-tbsync.o -obj-y += sysctl.o -obj-y += time.o -obj-y += usercopy.o -obj-y += machine_kexec.o -obj-y += crash.o - -obj-$(debug) += 0opt.o -obj-$(crash_debug) += gdbstub.o -obj-$(builtin_dom0) += dom0.o - -obj-y += firmware_image.o - -# These are extra warnings like for the arch/ppc directory but may not -# allow the rest of the tree to build. -PPC_C_WARNINGS += -Wundef -Wmissing-prototypes -Wmissing-declarations -PPC_C_WARNINGS += -Wshadow -CFLAGS += $(PPC_C_WARNINGS) - -# -# The following flags are fed to gcc in order to link several -# objects into a single ELF segment and to not link in any additional -# objects that gcc would normally like to -# -OMAGIC = -nodefaultlibs -nostartfiles -Wl,--omagic - -firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o - $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@ - -# -# Link firmware again but this time at the place we expect to load it. -# This makes debugging _way_ easier. -# -firmware.dbg: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o - $(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x2000000 $^ -o $@ - -firmware_image.bin: firmware firmware.dbg - $(CROSS_COMPILE)objcopy --output-target=binary $< $@ - -# -# Hacks for included C files -# -irq.o: ../x86/irq.c -physdev.o: ../x86/physdev.c -numa.o: ../x86/numa.c - -ifneq ($(CMDLINE),) -# The first token in the arguments will be silently dropped. -FULL_CMDLINE := xen $(CMDLINE) -endif - -ifeq ($(wildcard cmdline.dep),) -cmdline.dep: - echo $(FULL_CMDLINE) > cmdline.dep -else -ifneq ($(FULL_CMDLINE),$(shell cat cmdline.dep)) -cmdline.dep:: - echo $(FULL_CMDLINE) > cmdline.dep -else -cmdline.dep: -endif -endif - -cmdline.o: cmdline.dep -cmdline.o: CFLAGS += -DCMDLINE="\"$(FULL_CMDLINE)\"" - -TARGET_OPTS = $(OMAGIC) -Wl,-T,xen.lds -TARGET_OPTS += start.o $(ALL_OBJS) - -.xen-syms: start.o $(ALL_OBJS) xen.lds - $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o - $(CC) $(CFLAGS) $(TARGET_OPTS) $(BASEDIR)/common/symbols-dummy.o -o $@ - -NM=$(CROSS_COMPILE)nm -new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) - -ifeq ($(new_nm),y) -NM := $(NM) --synthetic -endif - -xen-syms.S: .xen-syms - $(NM) -n $^ | $(BASEDIR)/tools/symbols > $@ - -xen-syms.o: xen-syms.S - $(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@ - -$(TARGET)-syms: start.o $(ALL_OBJS) xen-syms.o xen.lds - $(CC) $(CFLAGS) $(TARGET_OPTS) xen-syms.o -o $@ - -# our firmware only loads 32-bit ELF files -OCPYFLAGS := --input-target=elf64-powerpc --output-target=elf32-powerpc -$(TARGET): $(TARGET)-syms - $(CROSS_COMPILE)objcopy $(OCPYFLAGS) $^ $@ - -asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS) - $(CC) $(CFLAGS) -S -o $@ $< - -xen.lds: xen.lds.S $(HDRS) - $(CC) -P -E $(AFLAGS) -o $@ $< - -dom0.bin: $(DOM0_IMAGE) - cp $< $@ - -clean:: - $(MAKE) -f $(BASEDIR)/Rules.mk -C of_handler clean - rm -f firmware firmware.dbg firmware_image.bin \ - dom0.bin .xen-syms xen-syms.S \ - xen.lds asm-offsets.s cmdline.dep diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/Rules.mk --- a/xen/arch/powerpc/Rules.mk Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -HAS_PPC64 := y - -CC := $(CROSS_COMPILE)gcc -LD := $(CROSS_COMPILE)ld - -# These are goodess that applies to all source. -C_WARNINGS := -Wredundant-decls - -# _no_ common code can have packed data structures or we are in touble. -C_WARNINGS += -Wpacked - -CFLAGS += -m64 -ffreestanding -fno-builtin -fno-common -CFLAGS += -iwithprefix include -Werror -pipe -CFLAGS += -I$(BASEDIR)/include -CFLAGS += -I$(BASEDIR)/include/asm-powerpc/mach-default -CFLAGS += $(C_WARNINGS) -CFLAGS += -msoft-float -O2 -CFLAGS-$(debug) += -O0 # last one wins -CFLAGS-$(papr_vterm) += -DPAPR_VDEVICE -DPAPR_VTERM - -LDFLAGS += -m elf64ppc - -# -# command to embed a binary inside a .o -# -%.o: %.bin - $(CROSS_COMPILE)objcopy --input-target=binary \ - --output-target=elf64-powerpc \ - --binary-architecture=powerpc \ - --redefine-sym _binary_$*_bin_start=$*_start \ - --redefine-sym _binary_$*_bin_end=$*_end \ - --redefine-sym _binary_$*_bin_size=$*_size \ - $< $@ - -HDRS += $(wildcard $(BASEDIR)/include/asm-powerpc/mach-*/*.h) - -# Test for at least GCC v3.2.x. -gcc-ver = $(shell $(CC) -dumpversion | sed -e 's/^\(.\)\.\(.\)\.\(.\)/\$(1)/') -ifeq ($(call gcc-ver,1),1) -$(error gcc-1.x.x unsupported - upgrade to at least gcc-3.2.x) -endif -ifeq ($(call gcc-ver,1),2) -$(error gcc-2.x.x unsupported - upgrade to at least gcc-3.2.x) -endif -ifeq ($(call gcc-ver,1),3) -ifeq ($(call gcc-ver,2),0) -$(error gcc-3.0.x unsupported - upgrade to at least gcc-3.2.x) -endif -ifeq ($(call gcc-ver,2),1) -$(error gcc-3.1.x unsupported - upgrade to at least gcc-3.2.x) -endif -endif diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/audit.c --- a/xen/arch/powerpc/audit.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Hollis Blanchard - */ - -#ifndef NDEBUG -#include -#include - -extern void audit_domain(struct domain *d); -extern void audit_domains(void); -extern void audit_domains_key(unsigned char key); - -void audit_domain(struct domain *d) -{ - panic("%s unimplemented\n", __func__); -} - -void audit_domains(void) -{ - struct domain *d; - rcu_read_lock(&domlist_read_lock); - for_each_domain ( d ) - audit_domain(d); - rcu_read_unlock(&domlist_read_lock); -} - -void audit_domains_key(unsigned char key) -{ - audit_domains(); -} -#endif diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/backtrace.c --- a/xen/arch/powerpc/backtrace.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -/* - * Routines providing a simple monitor for use on the PowerMac. - * - * Copyright (C) 1996-2005 Paul Mackerras. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - -static char namebuf[KSYM_NAME_LEN+1]; - -/* Shamelessly lifted from Linux Xmon try to keep pristene */ -#ifdef __powerpc64__ -#define LRSAVE_OFFSET 0x10 -#define REG_FRAME_MARKER 0x7265677368657265ul /* "regshere" */ -#define MARKER_OFFSET 0x60 -#define REGS_OFFSET 0x70 -#define REG "%016lX" -#else -#define LRSAVE_OFFSET 4 -#define REG_FRAME_MARKER 0x72656773 -#define MARKER_OFFSET 8 -#define REGS_OFFSET 16 -#define REG "%08lX" -#endif - -#define TRAP(regs) ((regs)->entry_vector & ~0xF) -static int xmon_depth_to_print = 64; - -/* Very cheap human name for vector lookup. */ -static -const char *getvecname(unsigned long vec) -{ - char *ret; - - switch (vec) { - case 0x100: ret = "(System Reset)"; break; - case 0x200: ret = "(Machine Check)"; break; - case 0x300: ret = "(Data Access)"; break; - case 0x380: ret = "(Data SLB Access)"; break; - case 0x400: ret = "(Instruction Access)"; break; - case 0x480: ret = "(Instruction SLB Access)"; break; - case 0x500: ret = "(Hardware Interrupt)"; break; - case 0x600: ret = "(Alignment)"; break; - case 0x700: ret = "(Program Check)"; break; - case 0x800: ret = "(FPU Unavailable)"; break; - case 0x900: ret = "(Decrementer)"; break; - case 0xc00: ret = "(System Call)"; break; - case 0xd00: ret = "(Single Step)"; break; - case 0xf00: ret = "(Performance Monitor)"; break; - case 0xf20: ret = "(Altivec Unavailable)"; break; - case 0x1300: ret = "(Instruction Breakpoint)"; break; - default: ret = ""; - } - return ret; -} - -static int mread(unsigned long adrs, void *buf, int size) -{ - memcpy(buf, (void *)adrs, size); - return size; -} - -static void get_function_bounds(unsigned long pc, unsigned long *startp, - unsigned long *endp) -{ - unsigned long size, offset; - const char *name; - - *startp = *endp = 0; - if (pc == 0) - return; - - name = symbols_lookup(pc, &size, &offset, namebuf); - if (name != NULL) { - *startp = pc - offset; - *endp = pc - offset + size; - } -} - -/* Print an address in numeric and symbolic form (if possible) */ -static void xmon_print_symbol(unsigned long address, const char *mid, - const char *after) -{ - const char *name = NULL; - unsigned long offset, size; - - printk(REG, address); - - name = symbols_lookup(address, &size, &offset, namebuf); - if (name) { - printk("%s%s+%#lx/%#lx", mid, name, offset, size); - } - printk("%s", after); -} - -static void backtrace( - unsigned long sp, unsigned long lr, unsigned long pc) -{ - unsigned long ip; - unsigned long newsp; - unsigned long marker; - int count = 0; - struct cpu_user_regs regs; - - do { - if (sp > xenheap_phys_end) { - if (sp != 0) - printk("SP (%lx) is not in xen space\n", sp); - break; - } - - if (!mread(sp + LRSAVE_OFFSET, &ip, sizeof(unsigned long)) - || !mread(sp, &newsp, sizeof(unsigned long))) { - printk("Couldn't read stack frame at %lx\n", sp); - break; - } - - /* - * For the first stack frame, try to work out if - * LR and/or the saved LR value in the bottommost - * stack frame are valid. - */ - if ((pc | lr) != 0) { - unsigned long fnstart, fnend; - unsigned long nextip; - int printip = 1; - - get_function_bounds(pc, &fnstart, &fnend); - nextip = 0; - if (newsp > sp) - mread(newsp + LRSAVE_OFFSET, &nextip, - sizeof(unsigned long)); - if (lr == ip) { - if (lr >= xenheap_phys_end - || (fnstart <= lr && lr < fnend)) - printip = 0; - } else if (lr == nextip) { - printip = 0; - } else if (lr < xenheap_phys_end - && !(fnstart <= lr && lr < fnend)) { - printk("[link register ] "); - xmon_print_symbol(lr, " ", "\n"); - } - if (printip) { - printk("["REG"] ", sp); - xmon_print_symbol(ip, " ", " (unreliable)\n"); - } - pc = lr = 0; - - } else { - printk("["REG"] ", sp); - xmon_print_symbol(ip, " ", "\n"); - } - - /* Look for "regshere" marker to see if this is - an exception frame. */ - if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long)) - && marker == REG_FRAME_MARKER) { - if (mread(sp + REGS_OFFSET, ®s, sizeof(regs)) - != sizeof(regs)) { - printk("Couldn't read registers at %lx\n", - sp + REGS_OFFSET); - break; - } - printk("--- Exception: %x %s at ", regs.entry_vector, - getvecname(TRAP(®s))); - pc = regs.pc; - lr = regs.lr; - xmon_print_symbol(pc, " ", "\n"); - } - - if (newsp == 0) - break; - - sp = newsp; - } while (count++ < xmon_depth_to_print); -} - -void show_backtrace(ulong sp, ulong lr, ulong pc) -{ - console_start_sync(); - backtrace(sp, lr, pc); - console_end_sync(); -} - -void show_backtrace_regs(struct cpu_user_regs *regs) -{ - console_start_sync(); - - show_registers(regs); - printk("hid4 0x%016lx\n", regs->hid4); - printk("---[ backtrace ]---\n"); - show_backtrace(regs->gprs[1], regs->lr, regs->pc); - - console_end_sync(); -} - -void dump_execution_state(void) -{ - struct cpu_user_regs *regs = guest_cpu_user_regs(); - - show_registers(regs); - if (regs->msr & MSR_HV) { - printk("In Xen:\n"); - show_backtrace(regs->gprs[1], regs->pc, regs->lr); - } -} diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/bitops.c --- a/xen/arch/powerpc/bitops.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* from linux/arch/powerpc/lib/bitops.c */ - -#include -#include - -#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) - -/** - * find_next_bit - find the next set bit in a memory region - * @addr: The address to base the search on - * @offset: The bitnumber to start searching at - * @size: The maximum size to search - */ -unsigned long find_next_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) -{ - const unsigned long *p = addr + BITOP_WORD(offset); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset %= BITS_PER_LONG; - if (offset) { - tmp = *(p++); - tmp &= (~0UL << offset); - if (size < BITS_PER_LONG) - goto found_first; - if (tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) { - if ((tmp = *(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = *p; - -found_first: - tmp &= (~0UL >> (BITS_PER_LONG - size)); - if (tmp == 0UL) /* Are any bits set? */ - return result + size; /* Nope. */ -found_middle: - return result + __ffs(tmp); -} - -/* - * This implementation of find_{first,next}_zero_bit was stolen from - * Linus' asm-alpha/bitops.h. - */ -unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) -{ - const unsigned long *p = addr + BITOP_WORD(offset); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset %= BITS_PER_LONG; - if (offset) { - tmp = *(p++); - tmp |= ~0UL >> (BITS_PER_LONG - offset); - if (size < BITS_PER_LONG) - goto found_first; - if (~tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) { - if (~(tmp = *(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = *p; - -found_first: - tmp |= ~0UL << size; - if (tmp == ~0UL) /* Are any bits zero? */ - return result + size; /* Nope. */ -found_middle: - return result + ffz(tmp); -} diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/boot_of.c --- a/xen/arch/powerpc/boot_of.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1257 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2006, 2007 - * - * Authors: Jimi Xenidis - * Hollis Blanchard - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "exceptions.h" -#include "of-devtree.h" -#include "oftree.h" -#include "rtas.h" - -/* Secondary processors use this for handshaking with main processor. */ -volatile unsigned int __spin_ack; - -static ulong of_vec; -static ulong of_msr; -static int of_out; -static ulong eomem; - -/* Track memory during early boot with a limited per-page bitmap. We need an - * allocator to tell us where we can place RTAS, our copy of the device tree. - * We could examine the "available" properties in memory nodes, but we - * apparently can't depend on firmware to update those when we call "claim". So - * we need to track it ourselves. - * We can't dynamically allocate the bitmap, because we would need something - * to tell us where it's safe to allocate... - */ -#define MEM_AVAILABLE_PAGES ((32 << 20) >> PAGE_SHIFT) -static DECLARE_BITMAP(mem_available_pages, MEM_AVAILABLE_PAGES); - -extern struct ns16550_defaults ns16550; - -#undef OF_DEBUG -#undef OF_DEBUG_LOW - -#ifdef OF_DEBUG -#define DBG(args...) of_printf(args) -#else -#define DBG(args...) -#endif - -#ifdef OF_DEBUG_LOW -#define DBG_LOW(args...) of_printf(args) -#else -#define DBG_LOW(args...) -#endif - -#define of_panic(MSG...) \ - do { of_printf(MSG); of_printf("\nHANG\n"); for (;;); } while (0) - -struct of_service { - u32 ofs_service; - u32 ofs_nargs; - u32 ofs_nrets; - u32 ofs_args[10]; -}; - -static int bof_chosen; - -static struct of_service s; - -static int __init of_call( - const char *service, u32 nargs, u32 nrets, s32 rets[], ...) -{ - int rc; - - if (of_vec != 0) { - va_list args; - int i; - memset(&s, 0, sizeof (s)); - s.ofs_service = (ulong)service; - s.ofs_nargs = nargs; - s.ofs_nrets = nrets; - s.ofs_nargs = nargs; - - /* copy all the params into the args array */ - va_start(args, rets); - - for (i = 0; i < nargs; i++) { - s.ofs_args[i] = va_arg(args, u32); - } - - va_end(args); - - rc = prom_call(&s, 0, of_vec, of_msr); - - /* yes always to the copy, just in case */ - for (i = 0; i < nrets; i++) { - rets[i] = s.ofs_args[i + nargs]; - } - } else { - rc = OF_FAILURE; - } - return rc; -} - -/* popular OF methods */ -static int __init _of_write(int ih, const char *addr, u32 len) -{ - int rets[1] = { OF_FAILURE }; - if (of_call("write", 3, 1, rets, ih, addr, len) == OF_FAILURE) { - return OF_FAILURE; - } - return rets[0]; -} - -/* popular OF methods */ -static int __init of_write(int ih, const char *addr, u32 len) -{ - int rc; - int i = 0; - int sum = 0; - - while (i < len) { - if (addr[i] == '\n') { - if (i > 0) { - rc = _of_write(ih, addr, i); - if (rc == OF_FAILURE) - return rc; - sum += rc; - } - rc = _of_write(ih, "\r\n", 2); - if (rc == OF_FAILURE) - return rc; - sum += rc; - i++; - addr += i; - len -= i; - i = 0; - continue; - } - i++; - } - if (len > 0) { - rc = _of_write(ih, addr, len); - if (rc == OF_FAILURE) - return rc; - sum += rc; - } - - return sum; -} - -static int of_printf(const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); -static int __init of_printf(const char *fmt, ...) -{ - static char buf[1024]; - va_list args; - int sz; - - if (of_out == 0) { - return OF_FAILURE; - } - - va_start(args, fmt); - - sz = vsnprintf(buf, sizeof (buf), fmt, args); - if (sz <= sizeof (buf)) { - of_write(of_out, buf, sz); - } else { - static const char trunc[] = "\n(TRUNCATED)\n"; - - sz = sizeof (buf); - of_write(of_out, buf, sz); - of_write(of_out, trunc, sizeof (trunc)); - } - return sz; -} - -static int __init of_finddevice(const char *devspec) -{ - int rets[1] = { OF_FAILURE }; - - of_call("finddevice", 1, 1, rets, devspec); - if (rets[0] == OF_FAILURE) { - DBG("finddevice %s -> FAILURE %d\n",devspec,rets[0]); - return OF_FAILURE; - } - DBG_LOW("finddevice %s -> %d\n",devspec, rets[0]); - return rets[0]; -} - -static int __init of_getprop(int ph, const char *name, void *buf, u32 buflen) -{ - int rets[1] = { OF_FAILURE }; - - of_call("getprop", 4, 1, rets, ph, name, buf, buflen); - - if (rets[0] == OF_FAILURE) { - DBG_LOW("getprop 0x%x %s -> FAILURE\n", ph, name); - return OF_FAILURE; - } - - DBG_LOW("getprop 0x%x %s -> 0x%x (%s)\n", ph, name, rets[0], (char *)buf); - return rets[0]; -} - -static int __init of_setprop( - int ph, const char *name, const void *buf, u32 buflen) -{ - int rets[1] = { OF_FAILURE }; - - of_call("setprop", 4, 1, rets, ph, name, buf, buflen); - - if (rets[0] == OF_FAILURE) { - DBG("setprop 0x%x %s -> FAILURE\n", ph, name); - return OF_FAILURE; - } - - DBG_LOW("setprop 0x%x %s -> %s\n", ph, name, (char *)buf); - return rets[0]; -} - -/* - * returns 0 if there are no children (of spec) - */ -static int __init of_getchild(int ph) -{ - int rets[1] = { OF_FAILURE }; - - of_call("child", 1, 1, rets, ph); - DBG_LOW("getchild 0x%x -> 0x%x\n", ph, rets[0]); - - return rets[0]; -} - -/* - * returns 0 is there are no peers - */ -static int __init of_getpeer(int ph) -{ - int rets[1] = { OF_FAILURE }; - - of_call("peer", 1, 1, rets, ph); - DBG_LOW("getpeer 0x%x -> 0x%x\n", ph, rets[0]); - - return rets[0]; -} - -static int __init of_getproplen(int ph, const char *name) -{ - int rets[1] = { OF_FAILURE }; - - of_call("getproplen", 2, 1, rets, ph, name); - if (rets[0] == OF_FAILURE) { - DBG("getproplen 0x%x %s -> FAILURE\n", ph, name); - return OF_FAILURE; - } - DBG_LOW("getproplen 0x%x %s -> 0x%x\n", ph, name, rets[0]); - return rets[0]; -} - -static int __init of_package_to_path(int ph, char *buffer, u32 buflen) -{ - int rets[1] = { OF_FAILURE }; - - of_call("package-to-path", 3, 1, rets, ph, buffer, buflen); - if (rets[0] == OF_FAILURE) { - DBG("%s 0x%x -> FAILURE\n", __func__, ph); - return OF_FAILURE; - } - DBG_LOW("%s 0x%x %s -> 0x%x\n", __func__, ph, buffer, rets[0]); - if (rets[0] <= buflen) - buffer[rets[0]] = '\0'; - return rets[0]; -} - -static int __init of_nextprop(int ph, const char *name, void *buf) -{ - int rets[1] = { OF_FAILURE }; - - of_call("nextprop", 3, 1, rets, ph, name, buf); - - if (rets[0] == OF_FAILURE) { - DBG("nextprop 0x%x %s -> FAILURE\n", ph, name); - return OF_FAILURE; - } - - DBG_LOW("nextprop 0x%x %s -> %s\n", ph, name, (char *)buf); - return rets[0]; -} - -static int __init of_instance_to_path(int ih, char *buffer, u32 buflen) -{ - int rets[1] = { OF_FAILURE }; - - if (of_call("instance-to-path", 3, 1, rets, ih, buffer, buflen) - == OF_FAILURE) - return OF_FAILURE; - - if (rets[0] <= buflen) - buffer[rets[0]] = '\0'; - return rets[0]; -} - -static int __init of_start_cpu(int cpu, u32 pc, u32 reg) -{ - int ret; - - ret = of_call("start-cpu", 3, 0, NULL, cpu, pc, reg); - - return ret; -} - -static void __init of_test(const char *of_method_name) -{ - int rets[1] = { OF_FAILURE }; - - of_call("test", 1, 1, rets, of_method_name); - if (rets[0] == OF_FAILURE ) { - of_printf("Warning: possibly no OF method %s.\n" - "(Ignore this warning on PIBS.)\n", of_method_name); - } -} - -static int __init of_claim(u32 virt, u32 size, u32 align) -{ - int rets[1] = { OF_FAILURE }; - - of_call("claim", 3, 1, rets, virt, size, align); - if (rets[0] == OF_FAILURE) { - DBG("%s 0x%08x 0x%08x 0x%08x -> FAIL\n", __func__, virt, size, align); - return OF_FAILURE; - } - - DBG_LOW("%s 0x%08x 0x%08x 0x%08x -> 0x%08x\n", __func__, virt, size, align, - rets[0]); - return rets[0]; -} - -static int __init of_instance_to_package(int ih) -{ - int rets[1] = { OF_FAILURE }; - - of_call("instance-to-package", 1, 1, rets, ih); - if (rets[0] == OF_FAILURE) - return OF_FAILURE; - - return rets[0]; -} - -static int __init of_getparent(int ph) -{ - int rets[1] = { OF_FAILURE }; - - of_call("parent", 1, 1, rets, ph); - - DBG_LOW("getparent 0x%x -> 0x%x\n", ph, rets[0]); - return rets[0]; -} - -static int __init of_open(const char *devspec) -{ - int rets[1] = { OF_FAILURE }; - - of_call("open", 1, 1, rets, devspec); - return rets[0]; -} - -static void boot_of_alloc_init(int m, uint addr_cells, uint size_cells) -{ - int rc; - uint pg; - uint a[64]; - int tst; - u64 start; - u64 size; - - rc = of_getprop(m, "available", a, sizeof (a)); - if (rc > 0) { - int l = rc / sizeof(a[0]); - int r = 0; - -#ifdef OF_DEBUG - { - int i; - of_printf("avail:\n"); - for (i = 0; i < l; i += 4) - of_printf(" 0x%x%x, 0x%x%x\n", - a[i], a[i + 1], - a[i + 2] ,a[i + 3]); - } -#endif - - pg = 0; - while (pg < MEM_AVAILABLE_PAGES && r < l) { - ulong end; - - start = a[r++]; - if (addr_cells == 2 && (r < l) ) - start = (start << 32) | a[r++]; - - size = a[r++]; - if (size_cells == 2 && (r < l) ) - size = (size << 32) | a[r++]; - - end = ALIGN_DOWN(start + size, PAGE_SIZE); - - start = ALIGN_UP(start, PAGE_SIZE); - - DBG("%s: marking 0x%x - 0x%lx\n", __func__, - pg << PAGE_SHIFT, start); - - start >>= PAGE_SHIFT; - while (pg < MEM_AVAILABLE_PAGES && pg < start) { - set_bit(pg, mem_available_pages); - pg++; - } - - pg = end >> PAGE_SHIFT; - } - } - - /* Now make sure we mark our own memory */ - pg = (ulong)_start >> PAGE_SHIFT; - start = (ulong)_end >> PAGE_SHIFT; - - DBG("%s: marking 0x%x - 0x%lx\n", __func__, - pg << PAGE_SHIFT, start << PAGE_SHIFT); - - /* Lets try and detect if our image has stepped on something. It - * is possible that FW has already subtracted our image from - * available memory so we must make sure that the previous bits - * are the same for the whole image */ - tst = test_and_set_bit(pg, mem_available_pages); - ++pg; - while (pg <= start) { - if (test_and_set_bit(pg, mem_available_pages) != tst) - of_panic("%s: pg :0x%x of our image is different\n", - __func__, pg); - ++pg; - } - - DBG("%s: marking 0x%x - 0x%x\n", __func__, - 0 << PAGE_SHIFT, 3 << PAGE_SHIFT); - /* First for pages (where the vectors are) should be left alone as well */ - set_bit(0, mem_available_pages); - set_bit(1, mem_available_pages); - set_bit(2, mem_available_pages); - set_bit(3, mem_available_pages); -} - -#ifdef BOOT_OF_FREE -/* this is here in case we ever need a free call at a later date */ -static void boot_of_free(ulong addr, ulong size) -{ - ulong bits; - ulong pos; - ulong i; - - size = ALIGN_UP(size, PAGE_SIZE); - bits = size >> PAGE_SHIFT; - pos = addr >> PAGE_SHIFT; - - for (i = 0; i < bits; i++) { - if (!test_and_clear_bit(pos + i, mem_available_pages)) - of_panic("%s: pg :0x%lx was never allocated\n", - __func__, pos + i); - } -} -#endif - -static ulong boot_of_alloc(ulong size) -{ - ulong bits; - ulong pos; - - if (size == 0) - return 0; - - DBG("%s(0x%lx)\n", __func__, size); - - size = ALIGN_UP(size, PAGE_SIZE); - bits = size >> PAGE_SHIFT; - pos = 0; - for (;;) { - ulong i; - - pos = find_next_zero_bit(mem_available_pages, - MEM_AVAILABLE_PAGES, pos); - DBG("%s: found start bit at: 0x%lx\n", __func__, pos); - - /* found nothing */ - if ((pos + bits) > MEM_AVAILABLE_PAGES) { - of_printf("%s: allocation of size: 0x%lx failed\n", - __func__, size); - return 0; - } - - /* find a set that fits */ - DBG("%s: checking for 0x%lx bits: 0x%lx\n", __func__, bits, pos); - - i = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, pos); - if (i - pos >= bits) { - uint addr = pos << PAGE_SHIFT; - - /* make sure OF is happy with our choice */ - if (of_claim(addr, size, 0) != OF_FAILURE) { - for (i = 0; i < bits; i++) - set_bit(pos + i, mem_available_pages); - - DBG("%s: 0x%lx is good returning 0x%x\n", - __func__, pos, addr); - return addr; - } - /* if OF did not like the address then simply start from - * the next bit */ - i = 1; - } - - pos = pos + i; - } -} - -int boot_of_mem_avail(int pos, ulong *startpage, ulong *endpage) -{ - ulong freebit; - ulong usedbit; - - if (pos >= MEM_AVAILABLE_PAGES) - /* Stop iterating. */ - return -1; - - /* Find first free page. */ - freebit = find_next_zero_bit(mem_available_pages, MEM_AVAILABLE_PAGES, pos); - if (freebit >= MEM_AVAILABLE_PAGES) { - /* We know everything after MEM_AVAILABLE_PAGES is still free. */ - *startpage = MEM_AVAILABLE_PAGES << PAGE_SHIFT; - *endpage = ~0UL; - return freebit; - } - *startpage = freebit << PAGE_SHIFT; - - /* Now find first used page after that. */ - usedbit = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, freebit); - if (usedbit >= MEM_AVAILABLE_PAGES) { - /* We know everything after MEM_AVAILABLE_PAGES is still free. */ - *endpage = ~0UL; - return usedbit; - } - - *endpage = usedbit << PAGE_SHIFT; - return usedbit; -} - -static ulong boot_of_mem_init(void) -{ - int root; - int p; - int rc; - uint addr_cells; - uint size_cells; - - root = of_finddevice("/"); - p = of_getchild(root); - - /* code is writen to assume sizes of 1 */ - of_getprop(root, "#address-cells", &addr_cells, - sizeof (addr_cells)); - of_getprop(root, "#size-cells", &size_cells, - sizeof (size_cells)); - DBG("%s: address_cells=%d size_cells=%d\n", - __func__, addr_cells, size_cells); - - /* We do ream memory discovery later, for now we only want to find - * the first LMB */ - do { - const char memory[] = "memory"; - char type[32]; - - type[0] = '\0'; - - of_getprop(p, "device_type", type, sizeof (type)); - if (strncmp(type, memory, sizeof (memory)) == 0) { - uint reg[48]; - u64 start; - u64 size; - int r; - int l; - - rc = of_getprop(p, "reg", reg, sizeof (reg)); - if (rc == OF_FAILURE) { - of_panic("no reg property for memory node: 0x%x.\n", p); - } - - l = rc / sizeof(reg[0]); /* number reg element */ - DBG("%s: number of bytes in property 'reg' %d\n", - __func__, rc); - - r = 0; - while (r < l) { - start = reg[r++]; - if (addr_cells == 2 && (r < l) ) - start = (start << 32) | reg[r++]; - - if (r >= l) - break; /* partial line. Skip */ - - if (start > 0) { - /* this is not the first LMB so we skip it */ - break; - } - - size = reg[r++]; - if (size_cells == 2 && (r < l) ) - size = (size << 32) | reg[r++]; - - if (r > l) - break; /* partial line. Skip */ - - boot_of_alloc_init(p, addr_cells, size_cells); - - eomem = size; - return size; - } - } - p = of_getpeer(p); - } while (p != OF_FAILURE && p != 0); - - return 0; -} - -static int save_props(void *m, ofdn_t n, int pkg) -{ - int ret; - char name[128]; - int result = 1; - int found_name = 0; - int found_device_type = 0; - const char name_str[] = "name"; - const char devtype_str[] = "device_type"; - - /* get first */ - result = of_nextprop(pkg, 0, name); - - while (result > 0) { - int sz; - u64 obj[1024]; - - sz = of_getproplen(pkg, name); - if (sz >= 0) { - ret = OF_SUCCESS; - } else { - ret = OF_FAILURE; - } - - if (ret == OF_SUCCESS) { - int actual = 0; - ofdn_t pos; - - if (sz > 0) { - if (sz > sizeof (obj)) { - of_panic("obj array not big enough for 0x%x\n", sz); - } - actual = of_getprop(pkg, name, obj, sz); - if (actual > sz) - of_panic("obj too small"); - } - - if (strncmp(name, name_str, sizeof(name_str)) == 0) { - found_name = 1; - } - - if (strncmp(name, devtype_str, sizeof(devtype_str)) == 0) { - found_device_type = 1; - } - - pos = ofd_prop_add(m, n, name, obj, actual); - if (pos == 0) - of_panic("prop_create"); - } - - result = of_nextprop(pkg, name, name); - } - - return 1; -} - - -static void do_pkg(void *m, ofdn_t n, int p, char *path, size_t psz) -{ - int pnext; - ofdn_t nnext; - int sz; - -retry: - save_props(m, n, p); - - /* do children first */ - pnext = of_getchild(p); - - if (pnext != 0) { - sz = of_package_to_path(pnext, path, psz); - if (sz == OF_FAILURE) - of_panic("bad path\n"); - - nnext = ofd_node_child_create(m, n, path, sz); - if (nnext == 0) - of_panic("out of mem\n"); - - do_pkg(m, nnext, pnext, path, psz); - } - - /* do peer */ - pnext = of_getpeer(p); - - if (pnext != 0) { - sz = of_package_to_path(pnext, path, psz); - - nnext = ofd_node_peer_create(m, n, path, sz); - if (nnext <= 0) - of_panic("out of space in OFD tree.\n"); - - n = nnext; - p = pnext; - goto retry; - } -} - -static long pkg_save(void *mem) -{ - int root; - char path[256]; - int r; - - path[0]='/'; - path[1]='\0'; - - /* get root */ - root = of_getpeer(0); - if (root == OF_FAILURE) - of_panic("no root package\n"); - - do_pkg(mem, OFD_ROOT, root, path, sizeof(path)); - - r = ofd_size(mem); - - of_printf("%s: saved device tree in 0x%x bytes\n", __func__, r); - - return r; -} - -static int boot_of_fixup_refs(void *mem) -{ - static const char *fixup_props[] = { - "interrupt-parent", - }; - int i; - int count = 0; - - for (i = 0; i < ARRAY_SIZE(fixup_props); i++) { - ofdn_t c; - const char *name = fixup_props[i]; - - c = ofd_node_find_by_prop(mem, OFD_ROOT, name, NULL, 0); - while (c > 0) { - const char *path; - int rp; - int ref; - ofdn_t dp; - int rc; - ofdn_t upd; - char ofpath[256]; - - path = ofd_node_path(mem, c); - if (path == NULL) - of_panic("no path to found prop: %s\n", name); - - rp = of_finddevice(path); - if (rp == OF_FAILURE) - of_panic("no real device for: name %s, path %s\n", - name, path); - /* Note: In theory 0 is a valid node handle but it is highly - * unlikely. - */ - if (rp == 0) { - of_panic("%s: of_finddevice returns 0 for path %s\n", - __func__, path); - } - - rc = of_getprop(rp, name, &ref, sizeof(ref)); - if ((rc == OF_FAILURE) || (rc == 0)) - of_panic("no prop: name %s, path %s, device 0x%x\n", - name, path, rp); - - rc = of_package_to_path(ref, ofpath, sizeof (ofpath)); - if (rc == OF_FAILURE) - of_panic("no package: name %s, path %s, device 0x%x,\n" - "ref 0x%x\n", name, path, rp, ref); - - dp = ofd_node_find(mem, ofpath); - if (dp <= 0) - of_panic("no ofd node for OF node[0x%x]: %s\n", - ref, ofpath); - - ref = dp; - - upd = ofd_prop_add(mem, c, name, &ref, sizeof(ref)); - if (upd <= 0) - of_panic("update failed: %s\n", name); - -#ifdef DEBUG - of_printf("%s: %s/%s -> %s\n", __func__, - path, name, ofpath); -#endif - ++count; - c = ofd_node_find_next(mem, c); - } - } - return count; -} - -static int boot_of_fixup_chosen(void *mem) -{ - int ch; - ofdn_t dn; - ofdn_t dc; - int val; - int rc; - char ofpath[256]; - - ch = of_finddevice("/chosen"); - if (ch == OF_FAILURE) - of_panic("/chosen not found\n"); - - rc = of_getprop(ch, "cpu", &val, sizeof (val)); - - if (rc != OF_FAILURE) { - rc = of_instance_to_path(val, ofpath, sizeof (ofpath)); - - if (rc > 0) { - dn = ofd_node_find(mem, ofpath); - if (dn <= 0) - of_panic("no node for: %s\n", ofpath); - - ofd_boot_cpu = dn; - val = dn; - - dn = ofd_node_find(mem, "/chosen"); - if (dn <= 0) - of_panic("no /chosen node\n"); - - dc = ofd_prop_add(mem, dn, "cpu", &val, sizeof (val)); - if (dc <= 0) - of_panic("could not fix /chosen/cpu\n"); - rc = 1; - } else { - of_printf("*** can't find path to booting cpu, " - "SMP is disabled\n"); - ofd_boot_cpu = -1; - } - } - return rc; -} - -/* PIBS Version 1.05.0000 04/26/2005 has an incorrect /ht/isa/ranges - * property. The values are bad, and it doesn't even have the - * right number of cells. */ - -static void __init boot_of_fix_maple(void) -{ - int isa; - const char *ranges = "ranges"; - u32 isa_ranges[3]; - const u32 isa_test[] = { 0x00000001, 0xf4000000, 0x00010000 }; - const u32 isa_fixed[] = { - 0x00000001, - 0x00000000, - 0x00000000, /* 0xf4000000, matt says this */ - 0x00000000, - 0x00000000, - 0x00010000 - }; - - isa = of_finddevice("/ht@0/isa@4"); - if (isa != OF_FAILURE) { - if (of_getproplen(isa, ranges) == sizeof (isa_test)) { - of_getprop(isa, ranges, isa_ranges, sizeof (isa_ranges)); - if (memcmp(isa_ranges, isa_test, sizeof (isa_test)) == 0) { - int rc; - - of_printf("OF: fixing bogus ISA range on maple\n"); - rc = of_setprop(isa, ranges, isa_fixed, sizeof (isa_fixed)); - if (rc == OF_FAILURE) { - of_panic("of_setprop() failed\n"); - } - } - } - } -} - -void __init boot_of_serial(void *oft) -{ - int n; - int p; - int rc; - u32 val[3]; - char buf[128]; - - n = of_instance_to_package(of_out); - if (n == OF_FAILURE) { - of_panic("instance-to-package of /chosen/stdout: failed\n"); - } - - /* Prune all serial devices from the device tree, including the - * one pointed to by /chosen/stdout, because a guest domain can - * initialize them and in so doing corrupt our console output. - */ - for (p = n; p > 0; p = of_getpeer(p)) { - char type[32]; - - rc = of_package_to_path(p, buf, sizeof(buf)); - if (rc == OF_FAILURE) - of_panic("package-to-path failed\n"); - - rc = of_getprop(p, "device_type", type, sizeof (type)); - if (rc == OF_FAILURE) { - of_printf("%s: fetching type of `%s' failed\n", __func__, buf); - continue; - } - - if (strcmp(type, "serial") != 0) - continue; - - of_printf("pruning `%s' from devtree\n", buf); - rc = ofd_prune_path(oft, buf); - if (rc < 0) - of_panic("prune of `%s' failed\n", buf); - } - - p = of_getparent(n); - if (p == OF_FAILURE) { - of_panic("no parent for: 0x%x\n", n); - } - - buf[0] = '\0'; - of_getprop(p, "device_type", buf, sizeof (buf)); - if (strstr(buf, "isa") == NULL) { - of_panic("only ISA UARTS supported\n"); - } - - /* should get this from devtree */ - isa_io_base = 0xf4000000; - of_printf("%s: ISA base: 0x%lx\n", __func__, isa_io_base); - - buf[0] = '\0'; - of_getprop(n, "device_type", buf, sizeof (buf)); - if (strstr(buf, "serial") == NULL) { - of_panic("only UARTS supported\n"); - } - - rc = of_getprop(n, "reg", val, sizeof (val)); - if (rc == OF_FAILURE) { - of_panic("%s: no location for serial port\n", __func__); - } - - ns16550.baud = BAUD_AUTO; - ns16550.data_bits = 8; - ns16550.parity = 'n'; - ns16550.stop_bits = 1; - - rc = of_getprop(n, "interrupts", val, sizeof (val)); - if (rc == OF_FAILURE) { - of_printf("%s: no ISRC, forcing poll mode\n", __func__); - ns16550.irq = 0; - } else { - ns16550.irq = val[0]; - of_printf("%s: ISRC=0x%x, but forcing poll mode\n", - __func__, ns16550.irq); - ns16550.irq = 0; - } -} - -static int __init boot_of_rtas(void) -{ - int rtas_node; - int rtas_instance; - uint size = 0; - int res[2]; - int mem; - int ret; - - rtas_node = of_finddevice("/rtas"); - - if (rtas_node <= 0) { - of_printf("No RTAS, Xen has no power control\n"); - return 0; - } - of_getprop(rtas_node, "rtas-size", &size, sizeof (size)); - if (size == 0) { - of_printf("RTAS, has no size\n"); - return 0; - } - - rtas_instance = of_open("/rtas"); - if (rtas_instance == OF_FAILURE) { - of_printf("RTAS, could not open\n"); - return 0; - } - - size = ALIGN_UP(size, PAGE_SIZE); - - mem = boot_of_alloc(size); - if (mem == 0) - of_panic("Could not allocate RTAS tree\n"); - - of_printf("instantiating RTAS at: 0x%x\n", mem); - - ret = of_call("call-method", 3, 2, res, - "instantiate-rtas", rtas_instance, mem); - if (ret == OF_FAILURE) { - of_printf("RTAS, could not open\n"); - return 0; - } - - rtas_entry = res[1]; - rtas_base = mem; - rtas_end = mem + size; - rtas_msr = of_msr; - - return 1; -} - -void __init *boot_of_devtree(void) -{ - void *oft; - ulong oft_sz = 48 * PAGE_SIZE; - ulong alloc_sz = 32 << 10; /* 32KiB should be plenty */ - ulong sz; - - /* snapshot the tree */ - oft = (void *)boot_of_alloc(alloc_sz); - if (oft == NULL) - of_panic("Could not allocate OFD tree\n"); - - of_printf("creating oftree at: 0x%p\n", oft); - of_test("package-to-path"); - oft = ofd_create(oft, alloc_sz); - pkg_save(oft); - sz = ofd_size(oft); - - if (sz > alloc_sz) - of_panic("Could not fit all of native devtree in 0x%lx of memory\n", - alloc_sz); - - boot_of_fixup_refs(oft); - boot_of_fixup_chosen(oft); - - if (sz > alloc_sz) - of_panic("Could not fit all devtree fixupsin 0x%lx of memory\n", - alloc_sz); - - ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2); - - oftree = (ulong)oft; - oftree = (ulong)oft + oft_sz; - oftree_len = oft_sz; - - return oft; -} - -static int __init boot_of_cpus(void) -{ - int cpus_node, cpu_node; - int bootcpu_instance, bootcpu_node; - int logical; - int result; - s32 cpuid; - u32 cpu_clock[2]; - extern uint cpu_hard_id[NR_CPUS]; - u32 tbf; - - /* Look up which CPU we are running on right now and get all info - * from there */ - result = of_getprop(bof_chosen, "cpu", - &bootcpu_instance, sizeof (bootcpu_instance)); - if (result == OF_FAILURE) - of_panic("Failed to look up boot cpu instance\n"); - - bootcpu_node = of_instance_to_package(bootcpu_instance); - if (result == OF_FAILURE) - of_panic("Failed to look up boot cpu package\n"); - - cpu_node = bootcpu_node; - - result = of_getprop(cpu_node, "timebase-frequency", &tbf, sizeof(tbf)); - timebase_freq = tbf; - if (result == OF_FAILURE) { - of_panic("Couldn't get timebase frequency!\n"); - } - of_printf("OF: timebase-frequency = %ld Hz\n", timebase_freq); - - result = of_getprop(cpu_node, "clock-frequency", - &cpu_clock, sizeof(cpu_clock)); - if (result == OF_FAILURE || (result !=4 && result != 8)) { - of_panic("Couldn't get clock frequency!\n"); - } - cpu_khz = cpu_clock[0]; - if (result == 8) { - cpu_khz <<= 32; - cpu_khz |= cpu_clock[1]; - } - cpu_khz /= 1000; - of_printf("OF: clock-frequency = %ld KHz\n", cpu_khz); - - /* We want a continuous logical cpu number space and we'll make - * the booting CPU logical 0. */ - cpu_set(0, cpu_present_map); - cpu_set(0, cpu_online_map); - cpu_set(0, cpu_possible_map); - - result = of_getprop(cpu_node, "reg", &cpuid, sizeof(cpuid)); - cpu_hard_id[0] = cpuid; - - /* Spin up all CPUS, even if there are more than NR_CPUS or we are - * runnign nosmp, because Open Firmware has them spinning on cache - * lines which will eventually be scrubbed, which could lead to - * random CPU activation. - */ - - /* Find the base of the multi-CPU package node */ - cpus_node = of_finddevice("/cpus"); - if (cpus_node <= 0) { - of_printf("Single Processor System\n"); - return 1; - } - /* Start with the first child */ - cpu_node = of_getchild(cpus_node); - - for (logical = 1; cpu_node > 0; logical++) { - unsigned int ping, pong; - unsigned long now, then, timeout; - - if (cpu_node == bootcpu_node) { - /* same CPU as boot CPU shich we have already made 0 so - * reduce the logical count */ - --logical; - } else { - result = of_getprop(cpu_node, "reg", &cpuid, sizeof(cpuid)); - if (result == OF_FAILURE) - of_panic("cpuid lookup failed\n"); - - cpu_hard_id[logical] = cpuid; - - of_printf("spinning up secondary processor #%d: ", logical); - - __spin_ack = ~0x0; - ping = __spin_ack; - pong = __spin_ack; - of_printf("ping = 0x%x: ", ping); - - mb(); - result = of_start_cpu(cpu_node, (ulong)spin_start, logical); - if (result == OF_FAILURE) - of_panic("start cpu failed\n"); - - /* We will give the secondary processor five seconds to reply. */ - then = mftb(); - timeout = then + (5 * timebase_freq); - - do { - now = mftb(); - if (now >= timeout) { - of_printf("BROKEN: "); - break; - } - - mb(); - pong = __spin_ack; - } while (pong == ping); - of_printf("pong = 0x%x\n", pong); - - if (pong != ping) { - cpu_set(logical, cpu_present_map); - cpu_set(logical, cpu_possible_map); - } - } - cpu_node = of_getpeer(cpu_node); - } - return 1; -} - -void __init boot_of_init(ulong vec, ulong orig_msr) -{ - int r; - - of_vec = vec; - of_msr = orig_msr; - - if (is_kernel(vec)) { - of_panic("Hmm.. OF[0x%lx] seems to have stepped on our image " - "that ranges: %p .. %p.\n", - vec, _start, _end); - } - of_printf("%s: _start %p _end %p\n", __func__, _start, _end); - - bof_chosen = of_finddevice("/chosen"); - of_getprop(bof_chosen, "stdout", &of_out, sizeof (of_out)); - - of_printf("%s\n", "---------------------------------------------------"); - of_printf("OF: Xen/PPC version %d.%d%s (%s@%s) (%s) %s\n", - xen_major_version(), xen_minor_version(), xen_extra_version(), - xen_compile_by(), xen_compile_domain(), - xen_compiler(), xen_compile_date()); - - boot_of_fix_maple(); - r = boot_of_mem_init(); - if (r == 0) - of_panic("failure to initialize memory allocator"); - - boot_of_rtas(); - boot_of_cpus(); -} - -void __init boot_of_finish(void) -{ - /* end of OF */ - of_printf("Quiescing Open Firmware ...\n"); - of_call("quiesce", 0, 0, NULL); -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/cmdline.c --- a/xen/arch/powerpc/cmdline.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2006 - * - * Authors: Hollis Blanchard - */ - -#include - -char builtin_cmdline[CONFIG_CMDLINE_SIZE] - __attribute__((section("__builtin_cmdline"))) = CMDLINE; diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/crash.c --- a/xen/arch/powerpc/crash.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -#include /* for printk() used in stub */ -#include -#include -#include - -void machine_crash_shutdown(void) -{ - printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__); -} - -/* - * Local variables: - * mode: C - * c-set-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ - diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/dart.c --- a/xen/arch/powerpc/dart.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#include -#include -#include -#include -#include -#include "tce.h" -#include "iommu.h" -#include "dart.h" -#include "oftree.h" -#include "of-devtree.h" - -#undef DEBUG -#ifdef DEBUG -#define DBG(fmt...) printk(fmt) -static int dbg_after; -#define DBG_SET_AFTER dbg_after = 1; -#define DBG_AFTER(fmt...) if (dbg_after) DBG(fmt) -#else -#define DBG(fmt...) -#define DBG_SET_AFTER -#define DBG_AFTER(fmt...) -#endif - -/* Max size of 512 pages */ -#define U3_LOG_MAX_PAGES 9 - -#define DART_DEF_BASE 0xf8033000UL -#define DART_NONE 0 -#define DART_U3 3 -#define DART_U4 4 -#define DART_WRITE 0x1 -#define DART_READ 0x2 - -static ulong dummy_page; -static ulong dart_entries; -static struct dart_ops *dops; -static u32 *dart_table; - -union dart_entry { - u32 de_word; - struct { - u32 de_v:1; /* valid */ - u32 de_rp:1; /* read protected */ - u32 de_wp:1; /* write protected */ - u32 _de_res:5; - u32 de_ppn:24; /* 24 bit Physical Page Number - * representing address [28:51] */ - } de_bits; -}; - -struct dma_window { - u32 dw_liobn; - u32 dw_base_hi; - u64 dw_base; - u64 dw_size; -}; - -struct dart_info { - struct dma_window di_window; - ulong di_base; - int di_model; -}; - -static u32 dart_encode(int perm, ulong rpn) -{ - union dart_entry e; - - e.de_word = 0; - e.de_bits.de_v = 1; - e.de_bits.de_ppn = rpn; - - /* protect the page */ - e.de_bits.de_rp = 1; - e.de_bits.de_wp = 1; - if (perm & DART_READ) { - e.de_bits.de_rp = 0; - } - if (perm & DART_WRITE) { - e.de_bits.de_wp = 0; - } - return e.de_word; -} - -static void dart_fill(ulong index, int perm, ulong rpg, ulong num_pg) -{ - u32 volatile *entry = dart_table + index; - ulong i = 0; - ulong last_flush = 0; - - while (1) { - entry[i] = dart_encode(perm, rpg); - ++i; - ++rpg; - if (i == num_pg) break; - - if ((((ulong)&entry[i]) % cpu_caches.dline_size) == 0) { - last_flush = (ulong)&entry[i - 1]; - dcbst(last_flush); - } - } - dcbst((ulong) &entry[i - 1]); -} - -static void dart_clear(ulong index, ulong num_pg) -{ - u32 *entry = dart_table + index; - ulong i = 0; - ulong rpg = dummy_page; - ulong last_flush = 0; - - while (1) { - entry[i] = dart_encode(DART_READ | DART_WRITE, rpg); - ++i; - if (i == num_pg) break; - - if ((((ulong)&entry[i]) % cpu_caches.dline_size) == 0) { - last_flush = (ulong)&entry[i - 1]; - dcbst(last_flush); - } - } - dcbst((ulong)&entry[i - 1]); -} - -static int dart_put(ulong ioba, union tce tce) -{ - ulong index = ioba >> PAGE_SHIFT; - - if (index > dart_entries) { - return -1; - } - - if (tce.tce_bits.tce_vlps != 0 || tce.tce_bits.tce_lpx != 0) { - panic("no support for large TCEs\n"); - } - - if (tce.tce_bits.tce_read == 0 && - tce.tce_bits.tce_write == 0) { - /* the TCE table is inited by the domain by a bunch of 0 - * perminssion puts. We are only interesting in debugging the - * ones after the first put */ - DBG_AFTER(">DART[0x%lx] clear\n", index); - dart_clear(index, 1); - } else { - unsigned perm = 0; - - if (tce.tce_bits.tce_read) - perm |= DART_READ; - if (tce.tce_bits.tce_write) - perm |= DART_WRITE; - - DBG("do_inv_entry(tce.tce_bits.tce_rpn); - - return 0; -} - -static int find_dart(struct dart_info *di) -{ - int rc; - void *ofd_p; - ofdn_t n; - char compat[128]; - - if (on_systemsim()) { - DBG("%s: systemsim does not support a dart\n", __func__); - return -1; - } - - ofd_p = (void *)oftree; - n = ofd_node_find(ofd_p, "/ht"); - if (n <= 0) - return -1; - - /* get the defaults from the HT node model */ - rc = ofd_getprop(ofd_p, n, "compatible", compat, sizeof (compat)); - if (rc <= 0) - return -1; - - if (ofd_strstr(compat, rc, "u4")) - di->di_model = DART_U4; - else if (ofd_strstr(compat, rc, "u3")) - di->di_model = DART_U3; - else { - DBG("%s: not a U3 or U4\n", __func__); - return -1; - } - - di->di_base = DART_DEF_BASE; - - /* FIXME: this should actually be the HT reg value */ - di->di_window.dw_liobn = 0; - di->di_window.dw_base_hi = 0; - di->di_window.dw_base = 0; - - /* lets see if the devtree has more info */ - n = ofd_node_find(ofd_p, "/dart"); - if (n > 0) { - ulong base; - - rc = ofd_getprop(ofd_p, n, "compatible", compat, sizeof (compat)); - if (rc > 0) { - if (strstr(compat, "u4")) { - di->di_model = DART_U4; - } - } - - rc = ofd_getprop(ofd_p, n, "reg", &base, sizeof (base)); - if (rc > 0) { - di->di_base = base; - } - } - return 0; -} - -static int init_dart(void) -{ - ulong log_pgs; - void *ofd_p; - ofdn_t n; - struct dart_info di; - - if (find_dart(&di)) - return 0; - - /* Max size of 512 pages == 2MB == 1<<21. That siz is good enough for U4 */ - log_pgs = U3_LOG_MAX_PAGES; - dart_table = alloc_xenheap_pages(log_pgs); - BUG_ON(dart_table == NULL); - - dart_entries = (1UL << (log_pgs + PAGE_SHIFT)) / sizeof (union dart_entry); - di.di_window.dw_size = dart_entries << PAGE_SHIFT; - - /* Linux uses a dummy page, filling "empty" DART entries with a - reference to this page to capture stray DMA's */ - dummy_page = (ulong)alloc_xenheap_pages(0); - clear_page((void *)dummy_page); - dummy_page >>= PAGE_SHIFT; - - printk("Initializing DART 0x%lx: tbl: %p[0x%lx] entries: 0x%lx\n", - di.di_base, dart_table, 1UL << log_pgs, dart_entries); - - /* register this iommu */ - iommu_register(di.di_window.dw_liobn, dart_put); - - switch (di.di_model) { - case DART_U3: - dops = u3_init(di.di_base, (ulong)dart_table, 1UL << log_pgs); - break; - case DART_U4: - dops = u4_init(di.di_base, (ulong)dart_table, 1UL << log_pgs); - break; - } - - dart_clear(0, dart_entries); - dops->do_inv_all(); - - /* fix up the devtree */ - ofd_p = (void *)oftree; - n = ofd_node_find(ofd_p, "/ht"); - if (n > 0) { - di.di_window.dw_size = dart_entries << PAGE_SHIFT; - ofd_prop_add(ofd_p, n, "ibm,dma-window", &di.di_window, - sizeof (di.di_window)); - } else { - panic("%s: no /ht node\n", __func__); - } - return 0; -} -__initcall(init_dart); diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/dart.h --- a/xen/arch/powerpc/dart.h Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#ifndef _DART_H -#define _DART_H - -#include -#include - -struct dart_ops { - void (*do_inv_all)(void); - void (*do_inv_entry)(ulong pg); -}; - -extern struct dart_ops *u3_init(ulong base, ulong table, ulong dart_pages); -extern struct dart_ops *u4_init(ulong base, ulong table, ulong dart_pages); - -#endif /* _DART_H */ - diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/dart_u3.c --- a/xen/arch/powerpc/dart_u3.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#undef DEBUG - -#include -#include -#include -#include -#include -#include -#include -#include "tce.h" -#include "iommu.h" -#include "dart.h" - -union dart_ctl { - u32 dc_word; - struct { - u32 dc_base:20; - u32 dc_stop_access:1; - u32 dc_invtlb:1; - u32 dc_enable:1; - u32 dc_size:9; - } reg; -}; - -static u32 volatile *dart_ctl_reg; - -static void u3_inv_all(void) -{ - union dart_ctl dc; - ulong r = 0; - int l = 0; - - for (;;) { - dc.dc_word = in_32(dart_ctl_reg); - dc.reg.dc_invtlb = 1; - out_32(dart_ctl_reg, dc.dc_word); - - do { - dc.dc_word = in_32(dart_ctl_reg); - r++; - } while ((dc.reg.dc_invtlb == 1) && (r < (1 << l))); - - if (r == (1 << l)) { - if (l < 4) { - l++; - dc.dc_word = in_32(dart_ctl_reg); - dc.reg.dc_invtlb = 0; - out_32(dart_ctl_reg, dc.dc_word); - continue; - } else { - panic(" broken U3???\n"); - } - } - return; - } -} - -static void u3_inv_entry(ulong pg) -{ - /* sadly single entry invalidation has been reported not to work */ - u3_inv_all(); -} - -static struct dart_ops u3_ops = { - .do_inv_all = u3_inv_all, - .do_inv_entry = u3_inv_entry, -}; - -struct dart_ops *u3_init(ulong base, ulong table, ulong dart_pages) -{ - union dart_ctl dc; - - dart_ctl_reg = (u32 *)base; - - dc.dc_word = 0; - - dc.reg.dc_base = table >> PAGE_SHIFT; - dc.reg.dc_size = dart_pages; - dc.reg.dc_enable = 1; - - - printk("Initializing DART Model U3: reg: %p word: %x\n", - dart_ctl_reg, dc.dc_word); - - out_32(dart_ctl_reg, dc.dc_word); - - return &u3_ops; -} diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/dart_u4.c --- a/xen/arch/powerpc/dart_u4.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright (C) IBM Corp. 2005 - * - * Authors: Jimi Xenidis - */ - -#undef DEBUG -#define INVALIDATE_ALL - -#include -#include -#include -#include -#include -#include -#include -#include -#include "tce.h" -#include "iommu.h" -#include "dart.h" - -#define TOO_MANY_RETRIES ~0 - -union dart_ctl { - u32 dc_word; - struct { - u32 dc_darten:1; /* DART Enable (0:disabled) */ - u32 dc_ione:1; /* Invalidate one DART TLB entry (using ILPN) */ - u32 dc_iall:1; /* Invalidate all DART TLB entries */ - u32 dc_idle:1; /* DART is idle */ - u32 dc_peen:1; /* Parity Checking is enabled */ - u32 dc_ilpn:27; /* 27-bit Logical Page Address for - * invalidating one TLB entry */ - } dc_bits; -}; - -union dart_base { - u32 db_word; - struct { - u32 _db_resv:8; - u32 db_dartbase:24; /* Base Address of DART (4K byte Alignment) */ - } db_bits; -}; - -union dart_size { - u32 ds_word; - struct { - u32 _ds_resv:15; - u32 ds_dartsize:17; /* Size of Dart in 4K-Byte Pages */ - } ds_bits; -}; - -union dart_excp { - u32 de_word; - struct { - u32 de_rqsrc:1; /* Request Source. [0:PCIE, 1:HT] */ - u32 de_lpn:27; /* 27Ðbit Logical Address of Exception [25:51] */ - u32 de_rqop:1; /* Request operation. [0:Read, 1:Write] */ - u32 de_xcd:3; /* Exception code */ - } de_bits; -}; - -struct dart { - /* 0x00 */ - union dart_ctl d_dartcntl; - u32 _pad0x04_0x10[3]; - /* 0x10 */ - union dart_base d_dartbase; - u32 _pad0x14_0x20[3]; - /* 0x20 */ - union dart_size d_dartsize; - u32 _pad0x24_0x30[3]; - /* 0x30 */ - union dart_excp d_dartexcp; - u32 _pad0x34_0x40[3]; -}; - -static volatile struct dart *dart; - -static void u4_inv_all(void) -{ - union dart_ctl dc; - ulong r = 0; - int l = 0; - - for (;;) { - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - dc.dc_bits.dc_iall = 1; - out_32(&dart->d_dartcntl.dc_word, dc.dc_word); - - do { - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - r++; - } while ((dc.dc_bits.dc_iall == 1) && (r < (1 << l))); - - if (r == (1 << l)) { - if (l < 4) { - l++; - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - dc.dc_bits.dc_iall = 0; - out_32(&dart->d_dartcntl.dc_word, dc.dc_word); - continue; - } else { - panic(" broken U4???\n"); - } - } - return; - } -} - -static void u4_inv_entry(ulong pgn) -{ -#ifdef INVALIDATE_ALL - return u4_inv_all(); -#else - union dart_ctl dc; - ulong retries = 0; - - return u4_inv_all(); - - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - dc.dc_bits.dc_ilpn = pgn; - dc.dc_bits.dc_ione = 1; - out_32(&dart->d_dartcntl.dc_word, dc.dc_word); - - /* wait for completion */ - /* FIXME: since we do this from the HV do we need to wait?! */ - do { - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - retries++; - if (retries > 1000000) - panic("WAY! too long\n"); - } while (dc.dc_bits.dc_ione != 0); -#endif -} - -static struct dart_ops u4_ops = { - .do_inv_all = u4_inv_all, - .do_inv_entry = u4_inv_entry, -}; - -struct dart_ops *u4_init(ulong base, ulong table, ulong dart_pages) -{ - union dart_base db; - union dart_size ds; - union dart_ctl dc; - - dart = (struct dart *)base; - - db.db_word = 0; - db.db_bits.db_dartbase = table >> PAGE_SHIFT; - - ds.ds_word = 0; - ds.ds_bits.ds_dartsize = dart_pages; - - dc.dc_word = in_32(&dart->d_dartcntl.dc_word); - if (dc.dc_bits.dc_darten == 1) { - panic("%s: dart is already enabled: 0x%x\n", __func__, dc.dc_word); - } - dc.dc_bits.dc_darten = 1; /* enable it */ - - printk("Initializing DART Model U4: ctl: 0x%x base: 0x%x size: 0x%x\n", - dc.dc_word, db.db_word, ds.ds_word); - - out_32(&dart->d_dartbase.db_word, db.db_word); - out_32(&dart->d_dartsize.ds_word, ds.ds_word); - out_32(&dart->d_dartcntl.dc_word, dc.dc_word); - - return &u4_ops; -} diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/domain.c --- a/xen/arch/powerpc/domain.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,357 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2006, 2007 - * - * Authors: Jimi Xenidis - * Ryan Harper - * Hollis Blanchard - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "rtas.h" -#include "exceptions.h" - -#define next_arg(fmt, args) ({ \ - unsigned long __arg; \ - switch ( *(fmt)++ ) \ - { \ - case 'i': __arg = (unsigned long)va_arg(args, unsigned int); break; \ - case 'l': __arg = (unsigned long)va_arg(args, unsigned long); break; \ - case 'p': __arg = (unsigned long)va_arg(args, void *); break; \ - case 'h': __arg = (unsigned long)va_arg(args, void *); break; \ - default: __arg = 0; BUG(); \ - } \ - __arg; \ -}) - -unsigned long hypercall_create_continuation(unsigned int op, - const char *format, ...) -{ - struct cpu_user_regs *regs = guest_cpu_user_regs(); - const char *p = format; - va_list args; - int gprnum = 4; - int i; - - va_start(args, format); - - regs->pc -= 4; /* re-execute 'sc' */ - - for (i = 0; *p != '\0'; i++) { - regs->gprs[gprnum++] = next_arg(p, args); - } - - va_end(args); - - /* As luck would have it, we use the same register for hcall opcodes and - * for hcall return values. The return value from this function is placed - * in r3 on return, so modifying regs->gprs[3] would have no effect. */ - return XEN_MARK(op); -} - -int arch_domain_create(struct domain *d, unsigned int domcr_flags) -{ - if (d->domain_id == IDLE_DOMAIN_ID) { - d->shared_info = (void *)alloc_xenheap_page(); - clear_page(d->shared_info); - - return 0; - } - - d->arch.large_page_sizes = cpu_large_page_orders( - d->arch.large_page_order, ARRAY_SIZE(d->arch.large_page_order)); - - d->arch.foreign_mfn_count = 2048; - d->arch.foreign_mfns = xmalloc_array(uint, d->arch.foreign_mfn_count); - BUG_ON(d->arch.foreign_mfns == NULL); - - memset(d->arch.foreign_mfns, -1, d->arch.foreign_mfn_count * sizeof(uint)); - - return 0; -} - -void arch_domain_destroy(struct domain *d) -{ - shadow_teardown(d); - /* shared_info is part of the RMA so no need to release it */ -} - -static void machine_fail(const char *s) -{ - printk("%s failed, manual powercycle required!\n" - " spinning....\n", s); - for (;;) - sleep(); -} -void machine_halt(void) -{ - console_start_sync(); - printk("%s called\n", __func__); - rtas_halt(); - - machine_fail(__func__); -} - -void machine_restart(void) -{ - console_start_sync(); - printk("%s called\n", __func__); - rtas_reboot(); - machine_fail(__func__); -} - -struct vcpu *alloc_vcpu_struct(void) -{ - struct vcpu *v; - if ( (v = xmalloc(struct vcpu)) != NULL ) - memset(v, 0, sizeof(*v)); - return v; -} - -void free_vcpu_struct(struct vcpu *v) -{ - xfree(v); -} - -int vcpu_initialise(struct vcpu *v) -{ - /* Guests by default have a 100Hz ticker. */ - v->periodic_period = MILLISECS(10); - return 0; -} - -void vcpu_destroy(struct vcpu *v) -{ -} - -int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_u c) -{ - struct domain *d = v->domain; - - memcpy(&v->arch.ctxt, &c.nat->user_regs, sizeof(c.nat->user_regs)); - - printk("Domain[%d].%d: initializing\n", d->domain_id, v->vcpu_id); - - if (d->arch.htab.order == 0) - panic("Page table never allocated for Domain: %d\n", d->domain_id); - if (d->arch.rma_order == 0) - panic("RMA never allocated for Domain: %d\n", d->domain_id); - - d->shared_info->wc_sec = dom0->shared_info->wc_sec; - d->shared_info->wc_nsec = dom0->shared_info->wc_nsec; - d->shared_info->arch.boot_timebase = dom0->shared_info->arch.boot_timebase; - - if ( !v->is_initialised ) - { - v->is_initialised = 1; - /* Auto-online VCPU0 when it is initialised. */ - if ( v->vcpu_id == 0 ) - clear_bit(_VPF_down, &v->pause_flags); - } - - cpu_init_vcpu(v); - - return 0; -} - -int arch_vcpu_reset(struct vcpu *v) -{ - panic("%s: called for Dom%d[%d]\n", - __func__, v->domain->domain_id, v->vcpu_id); - return 0; -} - -void dump_pageframe_info(struct domain *d) -{ - struct page_info *page; - - printk("Memory pages belonging to domain %u:\n", d->domain_id); - - if ( d->tot_pages >= 10 ) - { - printk(" DomPage list too long to display\n"); - } - else - { - list_for_each_entry ( page, &d->page_list, list ) - { - printk(" DomPage %p: mfn=%p, caf=%016lx, taf=%" PRtype_info "\n", - _p(page_to_maddr(page)), _p(page_to_mfn(page)), - page->count_info, page->u.inuse.type_info); - } - } - - list_for_each_entry ( page, &d->xenpage_list, list ) - { - printk(" XenPage %p: mfn=%p, caf=%016lx, taf=%" PRtype_info "\n", - _p(page_to_maddr(page)), _p(page_to_mfn(page)), - page->count_info, page->u.inuse.type_info); - } -} - -void context_switch(struct vcpu *prev, struct vcpu *next) -{ - struct cpu_user_regs *stack_regs = guest_cpu_user_regs(); - cpumask_t dirty_mask = next->vcpu_dirty_cpumask; - unsigned int cpu = smp_processor_id(); - -#if 0 - printk("%s: dom %x to dom %x\n", __func__, prev->domain->domain_id, - next->domain->domain_id); -#endif - - /* Allow at most one CPU at a time to be dirty. */ - ASSERT(cpus_weight(dirty_mask) <= 1); - if (unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask))) - { - /* Other cpus call __sync_lazy_execstate from flush ipi handler. */ - if (!cpus_empty(next->vcpu_dirty_cpumask)) - flush_tlb_mask(next->vcpu_dirty_cpumask); - } - - /* copy prev guest state off the stack into its vcpu */ - memcpy(&prev->arch.ctxt, stack_regs, sizeof(struct cpu_user_regs)); - - set_current(next); - - /* copy next guest state onto the stack */ - memcpy(stack_regs, &next->arch.ctxt, sizeof(struct cpu_user_regs)); - - /* save old domain state */ - save_sprs(prev); - save_float(prev); - save_segments(prev); - - context_saved(prev); - - /* load up new domain */ - load_sprs(next); - load_float(next); - load_segments(next); - - mtsdr1(next->domain->arch.htab.sdr1); - local_flush_tlb(); /* XXX maybe flush_tlb_mask? */ - cpu_flush_icache(); - - if (is_idle_vcpu(next)) { - reset_stack_and_jump(idle_loop); - } - - reset_stack_and_jump(full_resume); - /* not reached */ -} - -void continue_running(struct vcpu *same) -{ - /* nothing to do */ - return; -} - -void sync_vcpu_execstate(struct vcpu *v) -{ - /* do nothing */ - return; -} - -static void relinquish_memory(struct domain *d, struct list_head *list) -{ - struct list_head *ent; - struct page_info *page; - - /* Use a recursive lock, as we may enter 'free_domheap_page'. */ - spin_lock_recursive(&d->page_alloc_lock); - - ent = list->next; - while ( ent != list ) - { - page = list_entry(ent, struct page_info, list); - - /* Grab a reference to the page so it won't disappear from under us. */ - if ( unlikely(!get_page(page, d)) ) - { - /* Couldn't get a reference -- someone is freeing this page. */ - ent = ent->next; - continue; - } - if ( test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) ) - put_page_and_type(page); - - if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) - put_page(page); - - /* Follow the list chain and /then/ potentially free the page. */ - ent = ent->next; - put_page(page); - } - spin_unlock_recursive(&d->page_alloc_lock); -} - -int domain_relinquish_resources(struct domain *d) -{ - relinquish_memory(d, &d->xenpage_list); - relinquish_memory(d, &d->page_list); - xfree(d->arch.foreign_mfns); - xfree(d->arch.p2m); - return 0; -} - -void arch_dump_domain_info(struct domain *d) -{ -} - -void arch_dump_vcpu_info(struct vcpu *v) -{ -} - -static void safe_halt(void) -{ - int cpu = smp_processor_id(); - - while (!softirq_pending(cpu)) - sleep(); -} - -static void default_idle(void) -{ - local_irq_disable(); - if ( !softirq_pending(smp_processor_id()) ) - safe_halt(); - else - local_irq_enable(); -} - -void idle_loop(void) -{ - for ( ; ; ) { - page_scrub_schedule_work(); - default_idle(); - do_softirq(); - } -} diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/domain_build.c --- a/xen/arch/powerpc/domain_build.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,297 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that 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, write to the Free Software - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Copyright IBM Corp. 2005, 2007 - * - * Authors: Jimi Xenidis - * Ryan Harper - * Hollis Blanchard - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "oftree.h" - -/* opt_dom0_mem: memory allocated to domain 0. */ -static unsigned int dom0_nrpages; -static void parse_dom0_mem(char *s) -{ - unsigned long long bytes; - - bytes = parse_size_and_unit(s, NULL); - dom0_nrpages = bytes >> PAGE_SHIFT; -} -custom_param("dom0_mem", parse_dom0_mem); - -static unsigned int opt_dom0_max_vcpus; -integer_param("dom0_max_vcpus", opt_dom0_max_vcpus); - -static unsigned int opt_dom0_shadow; -boolean_param("dom0_shadow", opt_dom0_shadow); - -/* adapted from common/elf.c */ -#define RM_MASK(a,l) ((a) & ((1UL << (l)) - 1)) - -int construct_dom0(struct domain *d, - unsigned long image_start, unsigned long image_len, - unsigned long initrd_start, unsigned long initrd_len, - char *cmdline) -{ - struct elf_binary elf; - struct elf_dom_parms parms; - int rc; - struct vcpu *v; - ulong dst; - u64 *ofh_tree; - ulong firmware_base; - uint rma_nrpages = 1 << cpu_default_rma_order_pages(); - ulong rma_sz; - ulong rma; - ulong eomem; - int preempt = 0; - int vcpu; - ulong mod_start = 0; - ulong mod_len = 0; - ulong shared_info_addr; - uint extent_size = 1 << cpu_extent_order(); - ulong sz; - - /* Sanity! */ - BUG_ON(d->domain_id != 0); - - if (image_len == 0) - panic("No Dom0 image supplied\n"); - - printk("*** LOADING DOMAIN 0 ***\n"); - - /* default is the max(1/16th of memory, CONFIG_MIN_DOM0_PAGES) */ - if (dom0_nrpages == 0) { - dom0_nrpages = total_pages >> 4; - - if (dom0_nrpages < CONFIG_MIN_DOM0_PAGES) - dom0_nrpages = CONFIG_MIN_DOM0_PAGES; - } - - /* Dom0 has to be at least RMA size. */ - if (dom0_nrpages < rma_nrpages) { - dom0_nrpages = rma_nrpages; - printk("Increasing DOM0 memory size to %u MiB for RMA.\n", - ((rma_nrpages << PAGE_SHIFT) >> 20)); - } - - /* Ensure Dom0 is cpu_extent_order aligned. Round up if - not and let user know we did so. */ - if (dom0_nrpages != ALIGN_UP(dom0_nrpages, extent_size)) { - dom0_nrpages = ALIGN_UP(dom0_nrpages, extent_size); - printk("Increasing DOM0 memory size to %u MiB for large pages.\n", - ((dom0_nrpages << PAGE_SHIFT) >> 20)); - } - - /* XXX Dom0 currently can't extend past the IO hole. */ - if (dom0_nrpages > (platform_iohole_base() >> PAGE_SHIFT)) { - dom0_nrpages = (platform_iohole_base() >> PAGE_SHIFT); - printk("Limiting DOM0 memory size to %u MiB to avoid IO hole.\n", - ((dom0_nrpages << PAGE_SHIFT) >> 20)); - } - - /* Set Dom0 max mem, triggering p2m table creation. */ - if ((guest_physmap_max_mem_pages(d, dom0_nrpages)) != 0) - panic("Failed to set DOM0 max mem pages value\n"); - - d->max_pages = dom0_nrpages; - if (0 > allocate_rma(d, cpu_default_rma_order_pages())) - panic("Error allocating domain 0 RMA\n"); - - rma_sz = rma_size(d->arch.rma_order); - rma = page_to_maddr(d->arch.rma_page); - - /* If we are bigger than RMA, allocate extents. */ - if (dom0_nrpages > rma_nrpages) - dom0_nrpages = allocate_extents(d, dom0_nrpages, rma_nrpages); - - ASSERT(d->tot_pages == dom0_nrpages); - ASSERT(d->tot_pages >= rma_nrpages); - - if (opt_dom0_shadow == 0) { - /* 1/64 of memory */ - opt_dom0_shadow = (d->tot_pages >> 6) >> (20 - PAGE_SHIFT); - } - - do { - shadow_set_allocation(d, opt_dom0_shadow, &preempt); - } while (preempt); - if (shadow_get_allocation(d) == 0) - panic("shadow allocation failed: %dMib\n", opt_dom0_shadow); - - ASSERT( image_len < rma_sz ); - - eomem = ((ulong)d->shared_info) - rma; - printk("shared_info: 0x%lx,%p\n", eomem, d->shared_info); - - /* startup secondary processors */ - if ( opt_dom0_max_vcpus == 0 ) - opt_dom0_max_vcpus = num_online_cpus(); - if ( opt_dom0_max_vcpus > num_online_cpus() ) - opt_dom0_max_vcpus = num_online_cpus(); - if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS ) - opt_dom0_max_vcpus = MAX_VIRT_CPUS; -#ifdef BITS_PER_GUEST_LONG - if ( opt_dom0_max_vcpus > BITS_PER_GUEST_LONG(d) ) - opt_dom0_max_vcpus = BITS_PER_GUEST_LONG(d); -#endif - printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus); - - for (vcpu = 0; vcpu < opt_dom0_max_vcpus; vcpu++) { - if (NULL == alloc_vcpu(dom0, vcpu, vcpu)) - panic("Error creating domain 0 vcpu %d\n", vcpu); - /* for now we pin Dom0 VCPUs to their coresponding CPUs */ - if (cpu_isset(vcpu, cpu_online_map)) - dom0->vcpu[vcpu]->cpu_affinity = cpumask_of_cpu(vcpu); - } - - /* Init VCPU0. */ - v = d->vcpu[0]; - cpu_init_vcpu(v); - - /* convert xen pointer shared_info into guest physical */ - shared_info_addr = (ulong)d->shared_info - page_to_maddr(d->arch.rma_page); - - /* start loading stuff */ - rc = elf_init(&elf, (void *)image_start, image_len); - if (rc) - return rc; -#ifdef VERBOSE - elf_set_verbose(&elf); -#endif - elf_parse_binary(&elf); - if (0 != (elf_xen_parse(&elf, &parms))) - return rc; - - printk("Dom0 kernel: %s, paddr 0x%" PRIx64 " -> 0x%" PRIx64 "\n", - elf_64bit(&elf) ? "64-bit" : "32-bit", - elf.pstart, elf.pend); - - /* elf contains virtual addresses that can have the upper bits - * masked while running in real mode, so we do the masking as well - * as well */ - parms.virt_kend = RM_MASK(parms.virt_kend, 42); - parms.virt_entry = RM_MASK(parms.virt_entry, 42); - - /* set the MSR bit correctly */ - if (elf_64bit(&elf)) - v->arch.ctxt.msr = MSR_SF; - else - v->arch.ctxt.msr = 0; - - /* Load the dom0 kernel. */ - elf.dest = (void *)(parms.virt_kstart + rma); - - elf_load_binary(&elf); - v->arch.ctxt.pc = parms.virt_entry; - - dst = ALIGN_UP(parms.virt_kend + rma, PAGE_SIZE); - - /* Load the initrd. */ - if (initrd_len > 0) { - ASSERT((dst - rma) + image_len < eomem); - - printk("loading initrd: 0x%lx, 0x%lx\n", dst, initrd_len); - memcpy((void *)dst, (void *)initrd_start, initrd_len); - - mod_start = dst - rma; - mod_len = image_len; - - dst = ALIGN_UP(dst + initrd_len, PAGE_SIZE); - } else { - printk("no initrd\n"); - } - - v->arch.ctxt.gprs[3] = mod_start; - v->arch.ctxt.gprs[4] = mod_len; - - /* OF usually sits here: - * - Linux needs it to be loaded before the vmlinux or initrd - * - AIX demands it to be @ 32M. - */ - firmware_base = (32 << 20); - if (dst - rma > firmware_base) - panic("Firmware [0x%lx] will over-write images ending: 0x%lx\n", - firmware_base, dst - rma); - dst = firmware_base + rma; - - /* Put stack below firmware. */ - v->arch.ctxt.gprs[1] = dst - rma - STACK_FRAME_OVERHEAD; - v->arch.ctxt.gprs[2] = 0; - - ASSERT((dst - rma) + (ulong)firmware_image_size < eomem); - printk("loading OFH: 0x%lx, RMA: 0x%lx\n", dst, dst - rma); - memcpy((void *)dst, firmware_image_start, (ulong)firmware_image_size); - - v->arch.ctxt.gprs[5] = (dst - rma); - ofh_tree = (u64 *)(dst + 0x10); - ASSERT(*ofh_tree == 0xdeadbeef00000000); - - /* accomodate for a modest bss section */ - dst = ALIGN_UP(dst + (ulong)firmware_image_size + PAGE_SIZE, PAGE_SIZE); - - ASSERT((dst - rma) + oftree_len < eomem); - - *ofh_tree = dst - rma; - printk("loading OFD: 0x%lx RMA: 0x%lx, 0x%lx\n", dst, dst - rma, - oftree_len); - memcpy((void *)dst, (void *)oftree, oftree_len); - - /* fixup and add stuff for dom0 */ - sz = ofd_dom0_fixup(d, *ofh_tree + rma, cmdline, shared_info_addr); - printk("modified OFD size: 0x%lx\n", sz); - dst = ALIGN_UP(dst + sz + PAGE_SIZE, PAGE_SIZE); - - printk("dom0 initial register state:\n" - " pc %016lx msr %016lx\n" - " r1 %016lx r2 %016lx r3 %016lx\n" - " r4 %016lx r5 %016lx\n", - v->arch.ctxt.pc, - v->arch.ctxt.msr, - v->arch.ctxt.gprs[1], - v->arch.ctxt.gprs[2], - v->arch.ctxt.gprs[3], - v->arch.ctxt.gprs[4], - v->arch.ctxt.gprs[5]); - - v->is_initialised = 1; - clear_bit(_VPF_down, &v->pause_flags); - - rc = 0; - - /* DOM0 is permitted full I/O capabilities. */ - rc |= iomem_permit_access(dom0, 0UL, ~0UL); - rc |= irqs_permit_access(dom0, 0, NR_IRQS-1); - - BUG_ON(rc != 0); - - return 0; -} diff -r ef290f39ae6b -r c96507e0c83d xen/arch/powerpc/domctl.c --- a/xen/arch/powerpc/domctl.c Thu May 15 14:53:48 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:00 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:00 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTom-0002Tz-Gs for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:00 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTpQ-0008DS-LN; Tue, 20 May 2008 15:32:40 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToI-0007Pb-Az for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:30 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTo5-0002zM-Ks for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:28 +0000 X-SBRS: 3.6 X-MesageID: 267643 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267643" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:23 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUMxv029597 for ; Tue, 20 May 2008 08:30:22 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUfTx032628 for ; Tue, 20 May 2008 08:30:41 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUfwC032627 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:41 -0700 Message-Id: <200805201530.m4KFUfwC032627@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:40 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] compilation fix of 17669:d0817f08599a X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210944347 -32400 # Node ID e78f5dbedbe0a5e34b4af43c9c248413e5340190 # Parent 6d0cc186bf41e10d7cbf4e3c466acce82f6d9454 [IA64] compilation fix of 17669:d0817f08599a compilation fix of 17669:d0817f08599a. The change set needs the definition of do_get_pm_info(). Define the stub function. Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/dom0_ops.c | 10 ++++++++++ 1 files changed, 10 insertions(+) diff -r 6d0cc186bf41 -r e78f5dbedbe0 xen/arch/ia64/xen/dom0_ops.c --- a/xen/arch/ia64/xen/dom0_ops.c Fri May 16 21:59:38 2008 +0900 +++ b/xen/arch/ia64/xen/dom0_ops.c Fri May 16 22:25:47 2008 +0900 @@ -455,6 +455,16 @@ long arch_do_sysctl(xen_sysctl_t *op, XE return ret; } +int +do_get_pm_info(struct xen_sysctl_get_pmstat *op) +{ + /* + * For now just place holder to compile. + * xen/common/sysctl.c refers this function. + */ + return -ENOSYS; +} + static unsigned long dom0vp_ioremap(struct domain *d, unsigned long mpaddr, unsigned long size) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTos-0002UY-8y for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTpW-0008HL-GX; Tue, 20 May 2008 15:32:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToI-0007PR-1g for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:30 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyTo1-0002zQ-SV for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:27 +0000 X-SBRS: 3.6 X-MesageID: 267642 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267642" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:22 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFULVW029594 for ; Tue, 20 May 2008 08:30:21 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUeOK032611 for ; Tue, 20 May 2008 08:30:40 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUevs032610 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:40 -0700 Message-Id: <200805201530.m4KFUevs032610@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:39 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210942778 -32400 # Node ID 6d0cc186bf41e10d7cbf4e3c466acce82f6d9454 # Parent c96507e0c83d292f36bd48b1d4a59771e92c0907 # Parent d0817f08599afe3f2d7ffa2e3fd88e6a65f5e85d merge with xen-unstable.hg --- tools/ioemu/block.c | 32 +++ tools/ioemu/hw/serial.c | 8 tools/ioemu/hw/xenfb.c | 1 tools/ioemu/xenstore.c | 4 tools/libxc/Makefile | 1 tools/libxc/xc_hvm_build.c | 50 +++++ tools/libxc/xc_pm.c | 101 ++++++++++++ tools/libxc/xenctrl.h | 19 ++ tools/python/xen/xend/XendDomainInfo.py | 3 xen/arch/ia64/xen/mm.c | 41 ++-- xen/arch/x86/acpi/Makefile | 1 xen/arch/x86/acpi/boot.c | 14 - xen/arch/x86/acpi/cpufreq/cpufreq.c | 16 + xen/arch/x86/acpi/cpufreq/utility.c | 77 +++++++++ xen/arch/x86/acpi/pmstat.c | 110 +++++++++++++ xen/arch/x86/mm.c | 6 xen/arch/x86/mm/hap/p2m-ept.c | 208 ++++++++++++++++++------ xen/arch/x86/mm/p2m.c | 251 +++++++++++++++++++++++------- xen/arch/x86/platform_hypercall.c | 3 xen/common/grant_table.c | 2 xen/common/memory.c | 12 - xen/common/sysctl.c | 16 + xen/include/acpi/cpufreq/processor_perf.h | 23 ++ xen/include/asm-ia64/grant_table.h | 2 xen/include/asm-ia64/shadow.h | 6 xen/include/asm-x86/p2m.h | 15 + xen/include/public/sysctl.h | 37 ++++ xen/include/xen/paging.h | 4 28 files changed, 890 insertions(+), 173 deletions(-) diff -r c96507e0c83d -r 6d0cc186bf41 tools/ioemu/block.c --- a/tools/ioemu/block.c Thu May 15 16:23:56 2008 +0900 +++ b/tools/ioemu/block.c Fri May 16 21:59:38 2008 +0900 @@ -240,8 +240,28 @@ static int is_windows_drive(const char * } #endif +static int bdrv_invalid_protocol_open(BlockDriverState *bs, + const char *filename, int flags) { + return -ENOENT; +} + +static BlockDriver bdrv_invalid_protocol = { + "invalid_protocol", + .bdrv_open = bdrv_invalid_protocol_open, +}; + static BlockDriver *find_protocol(const char *filename) { + /* Return values: + * &bdrv_xxx + * filename specifies protocol xxx + * caller should use that + * NULL filename does not specify any protocol + * caller may apply their own default + * &bdrv_invalid_protocol filename speciies an unknown protocol + * caller should return -ENOENT; or may just try to open with + * that bdrv, which always fails that way. + */ BlockDriver *drv1; char protocol[128]; int len; @@ -254,7 +274,7 @@ static BlockDriver *find_protocol(const #endif p = strchr(filename, ':'); if (!p) - return NULL; /* do not ever guess raw, it is a security problem! */ + return NULL; len = p - filename; if (len > sizeof(protocol) - 1) len = sizeof(protocol) - 1; @@ -265,7 +285,7 @@ static BlockDriver *find_protocol(const !strcmp(drv1->protocol_name, protocol)) return drv1; } - return NULL; + return &bdrv_invalid_protocol; } /* XXX: force raw format if block or character device ? It would @@ -295,8 +315,8 @@ static BlockDriver *find_image_format(co #endif drv = find_protocol(filename); - /* no need to test disk image formats for vvfat */ - if (drv == &bdrv_vvfat) + /* no need to test disk image format if the filename told us */ + if (drv != NULL) return drv; ret = bdrv_file_open(&bs, filename, BDRV_O_RDONLY); @@ -390,7 +410,7 @@ int bdrv_open2(BlockDriverState *bs, con if (flags & BDRV_O_FILE) { drv = find_protocol(filename); if (!drv) - return -ENOENT; + drv = &bdrv_raw; } else { if (!drv) { drv = find_image_format(filename); @@ -438,7 +458,7 @@ int bdrv_open2(BlockDriverState *bs, con } path_combine(backing_filename, sizeof(backing_filename), filename, bs->backing_file); - if (bdrv_open(bs->backing_hd, backing_filename, 0) < 0) + if (bdrv_open2(bs->backing_hd, backing_filename, 0, &bdrv_raw) < 0) goto fail; } diff -r c96507e0c83d -r 6d0cc186bf41 tools/ioemu/hw/serial.c --- a/tools/ioemu/hw/serial.c Thu May 15 16:23:56 2008 +0900 +++ b/tools/ioemu/hw/serial.c Fri May 16 21:59:38 2008 +0900 @@ -705,12 +705,13 @@ static void serial_save(QEMUFile *f, voi qemu_put_8s(f,&s->lsr); qemu_put_8s(f,&s->msr); qemu_put_8s(f,&s->scr); - qemu_get_8s(f,&s->fcr); + qemu_put_8s(f,&s->fcr); } static int serial_load(QEMUFile *f, void *opaque, int version_id) { SerialState *s = opaque; + uint8_t fcr = 0; if(version_id > 2) return -EINVAL; @@ -729,6 +730,11 @@ static int serial_load(QEMUFile *f, void qemu_get_8s(f,&s->scr); qemu_get_8s(f,&s->fcr); + if (version_id >= 2) + qemu_get_8s(f,&fcr); + + /* Initialize fcr via setter to perform essential side-effects */ + serial_ioport_write(s, 0x02, fcr); return 0; } diff -r c96507e0c83d -r 6d0cc186bf41 tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Thu May 15 16:23:56 2008 +0900 +++ b/tools/ioemu/hw/xenfb.c Fri May 16 21:59:38 2008 +0900 @@ -502,6 +502,7 @@ static int xenfb_configure_fb(struct xen fprintf(stderr, "FB: frontend fb size %zu limited to %zu\n", fb_len, fb_len_lim); + fb_len = fb_len_lim; } if (depth != 8 && depth != 16 && depth != 24 && depth != 32) { fprintf(stderr, diff -r c96507e0c83d -r 6d0cc186bf41 tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Thu May 15 16:23:56 2008 +0900 +++ b/tools/ioemu/xenstore.c Fri May 16 21:59:38 2008 +0900 @@ -260,6 +260,8 @@ void xenstore_parse_domain_config(int hv /* autoguess qcow vs qcow2 */ } else if (!strcmp(drv,"file") || !strcmp(drv,"phy")) { format = &bdrv_raw; + } else if (!strcmp(drv,"phy")) { + format = &bdrv_raw; } else { format = bdrv_find_format(drv); if (!format) { @@ -269,7 +271,7 @@ void xenstore_parse_domain_config(int hv } } if (bdrv_open2(bs, params, 0 /* snapshot */, format) < 0) - fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s')\n", buf, params, drv ? drv : "?"); + fprintf(stderr, "qemu: could not open vbd '%s' or hard disk image '%s' (drv '%s' format '%s')\n", buf, params, drv ? drv : "?", format ? format->format_name : "0"); } } diff -r c96507e0c83d -r 6d0cc186bf41 tools/libxc/Makefile --- a/tools/libxc/Makefile Thu May 15 16:23:56 2008 +0900 +++ b/tools/libxc/Makefile Fri May 16 21:59:38 2008 +0900 @@ -20,6 +20,7 @@ CTRL_SRCS-y += xc_sedf.c CTRL_SRCS-y += xc_sedf.c CTRL_SRCS-y += xc_csched.c CTRL_SRCS-y += xc_tbuf.c +CTRL_SRCS-y += xc_pm.c ifneq ($(stubdom),y) CTRL_SRCS-y += xc_resume.c endif diff -r c96507e0c83d -r 6d0cc186bf41 tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Thu May 15 16:23:56 2008 +0900 +++ b/tools/libxc/xc_hvm_build.c Fri May 16 21:59:38 2008 +0900 @@ -18,6 +18,9 @@ #include "xc_e820.h" #include + +#define SUPERPAGE_PFN_SHIFT 9 +#define SUPERPAGE_NR_PFNS (1UL << SUPERPAGE_PFN_SHIFT) #define SCRATCH_PFN 0xFFFFF @@ -211,7 +214,7 @@ static int setup_guest(int xc_handle, /* * Allocate memory for HVM guest, skipping VGA hole 0xA0000-0xC0000. - * We allocate pages in batches of no more than 2048 to ensure that + * We allocate pages in batches of no more than 8MB to ensure that * we can be preempted and hence dom0 remains responsive. */ rc = xc_domain_memory_populate_physmap( @@ -219,13 +222,50 @@ static int setup_guest(int xc_handle, cur_pages = 0xc0; while ( (rc == 0) && (nr_pages > cur_pages) ) { + /* Clip count to maximum 8MB extent. */ unsigned long count = nr_pages - cur_pages; if ( count > 2048 ) count = 2048; - rc = xc_domain_memory_populate_physmap( - xc_handle, dom, count, 0, 0, &page_array[cur_pages]); - cur_pages += count; - } + + /* Clip partial superpage extents to superpage boundaries. */ + if ( ((cur_pages & (SUPERPAGE_NR_PFNS-1)) != 0) && + (count > (-cur_pages & (SUPERPAGE_NR_PFNS-1))) ) + count = -cur_pages & (SUPERPAGE_NR_PFNS-1); /* clip s.p. tail */ + else if ( ((count & (SUPERPAGE_NR_PFNS-1)) != 0) && + (count > SUPERPAGE_NR_PFNS) ) + count &= ~(SUPERPAGE_NR_PFNS - 1); /* clip non-s.p. tail */ + + /* Attempt to allocate superpage extents. */ + if ( ((count | cur_pages) & (SUPERPAGE_NR_PFNS - 1)) == 0 ) + { + long done; + xen_pfn_t sp_extents[2048 >> SUPERPAGE_PFN_SHIFT]; + struct xen_memory_reservation sp_req = { + .nr_extents = count >> SUPERPAGE_PFN_SHIFT, + .extent_order = SUPERPAGE_PFN_SHIFT, + .domid = dom + }; + set_xen_guest_handle(sp_req.extent_start, sp_extents); + for ( i = 0; i < sp_req.nr_extents; i++ ) + sp_extents[i] = page_array[cur_pages+(i< 0 ) + { + done <<= SUPERPAGE_PFN_SHIFT; + cur_pages += done; + count -= done; + } + } + + /* Fall back to 4kB extents. */ + if ( count != 0 ) + { + rc = xc_domain_memory_populate_physmap( + xc_handle, dom, count, 0, 0, &page_array[cur_pages]); + cur_pages += count; + } + } + if ( rc != 0 ) { PERROR("Could not allocate memory for HVM guest.\n"); diff -r c96507e0c83d -r 6d0cc186bf41 tools/libxc/xc_pm.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxc/xc_pm.c Fri May 16 21:59:38 2008 +0900 @@ -0,0 +1,101 @@ +/****************************************************************************** + * xc_pm.c - Libxc API for Xen Power Management (Px/Cx/Tx, etc.) statistic + * + * Copyright (c) 2008, Liu Jinsong + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#include "xc_private.h" + +int xc_pm_get_max_px(int xc_handle, int cpuid, int *max_px) +{ + DECLARE_SYSCTL; + int ret; + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_get_max_px; + sysctl.u.get_pmstat.cpuid = cpuid; + ret = xc_sysctl(xc_handle, &sysctl); + if ( ret ) + return ret; + + *max_px = sysctl.u.get_pmstat.u.getpx.total; + return ret; +} + +int xc_pm_get_pxstat(int xc_handle, int cpuid, struct xc_px_stat *pxpt) +{ + DECLARE_SYSCTL; + int max_px, ret; + + if ( !pxpt || !(pxpt->trans_pt) || !(pxpt->pt) ) + return -EINVAL; + + if ( (ret = xc_pm_get_max_px(xc_handle, cpuid, &max_px)) != 0) + return ret; + + if ( (ret = lock_pages(pxpt->trans_pt, + max_px * max_px * sizeof(uint64_t))) != 0 ) + return ret; + + if ( (ret = lock_pages(pxpt->pt, + max_px * sizeof(struct xc_px_val))) != 0 ) + { + unlock_pages(pxpt->trans_pt, max_px * max_px * sizeof(uint64_t)); + return ret; + } + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_get_pxstat; + sysctl.u.get_pmstat.cpuid = cpuid; + set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.trans_pt, pxpt->trans_pt); + set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.pt, + (pm_px_val_t *)pxpt->pt); + + ret = xc_sysctl(xc_handle, &sysctl); + if ( ret ) + { + unlock_pages(pxpt->trans_pt, max_px * max_px * sizeof(uint64_t)); + unlock_pages(pxpt->pt, max_px * sizeof(struct xc_px_val)); + return ret; + } + + pxpt->total = sysctl.u.get_pmstat.u.getpx.total; + pxpt->usable = sysctl.u.get_pmstat.u.getpx.usable; + pxpt->last = sysctl.u.get_pmstat.u.getpx.last; + pxpt->cur = sysctl.u.get_pmstat.u.getpx.cur; + + unlock_pages(pxpt->trans_pt, max_px * max_px * sizeof(uint64_t)); + unlock_pages(pxpt->pt, max_px * sizeof(struct xc_px_val)); + + return ret; +} + +int xc_pm_reset_pxstat(int xc_handle, int cpuid) +{ + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_reset_pxstat; + sysctl.u.get_pmstat.cpuid = cpuid; + + return xc_sysctl(xc_handle, &sysctl); +} diff -r c96507e0c83d -r 6d0cc186bf41 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Thu May 15 16:23:56 2008 +0900 +++ b/tools/libxc/xenctrl.h Fri May 16 21:59:38 2008 +0900 @@ -1034,4 +1034,23 @@ void xc_cpuid_to_str(const unsigned int char **strs); #endif +struct xc_px_val { + uint64_t freq; /* Px core frequency */ + uint64_t residency; /* Px residency time */ + uint64_t count; /* Px transition count */ +}; + +struct xc_px_stat { + uint8_t total; /* total Px states */ + uint8_t usable; /* usable Px states */ + uint8_t last; /* last Px state */ + uint8_t cur; /* current Px state */ + uint64_t *trans_pt; /* Px transition table */ + struct xc_px_val *pt; +}; + +int xc_pm_get_max_px(int xc_handle, int cpuid, int *max_px); +int xc_pm_get_pxstat(int xc_handle, int cpuid, struct xc_px_stat *pxpt); +int xc_pm_reset_pxstat(int xc_handle, int cpuid); + #endif /* XENCTRL_H */ diff -r c96507e0c83d -r 6d0cc186bf41 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu May 15 16:23:56 2008 +0900 +++ b/tools/python/xen/xend/XendDomainInfo.py Fri May 16 21:59:38 2008 +0900 @@ -3013,7 +3013,8 @@ class XendDomainInfo: # shortcut if the domain isn't started because # the devcontrollers will have no better information # than XendConfig. - if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED,): + if self._stateGet() in (XEN_API_VM_POWER_STATE_HALTED, + XEN_API_VM_POWER_STATE_SUSPENDED): if dev_config: return copy.deepcopy(dev_config) return None diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/ia64/xen/mm.c --- a/xen/arch/ia64/xen/mm.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/ia64/xen/mm.c Fri May 16 21:59:38 2008 +0900 @@ -2424,16 +2424,20 @@ steal_page(struct domain *d, struct page int guest_physmap_add_page(struct domain *d, unsigned long gpfn, - unsigned long mfn) -{ - BUG_ON(!mfn_valid(mfn)); - BUG_ON(mfn_to_page(mfn)->count_info != (PGC_allocated | 1)); - set_gpfn_from_mfn(mfn, gpfn); - smp_mb(); - assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn, - ASSIGN_writable | ASSIGN_pgc_allocated); - - //BUG_ON(mfn != ((lookup_domain_mpa(d, gpfn << PAGE_SHIFT) & _PFN_MASK) >> PAGE_SHIFT)); + unsigned long mfn, unsigned int page_order) +{ + unsigned long i; + + for (i = 0; i < (1UL << page_order); i++) { + BUG_ON(!mfn_valid(mfn)); + BUG_ON(mfn_to_page(mfn)->count_info != (PGC_allocated | 1)); + set_gpfn_from_mfn(mfn, gpfn); + smp_mb(); + assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn, + ASSIGN_writable | ASSIGN_pgc_allocated); + mfn++; + gpfn++; + } perfc_incr(guest_physmap_add_page); return 0; @@ -2441,10 +2445,15 @@ guest_physmap_add_page(struct domain *d, void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, - unsigned long mfn) -{ + unsigned long mfn, unsigned int page_order) +{ + unsigned long i; + BUG_ON(mfn == 0);//XXX - zap_domain_page_one(d, gpfn << PAGE_SHIFT, 0, mfn); + + for (i = 0; i < (1UL << page_order); i++) + zap_domain_page_one(d, (gpfn+i) << PAGE_SHIFT, 0, mfn+i); + perfc_incr(guest_physmap_remove_page); } @@ -2847,7 +2856,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE( if (prev_mfn && mfn_valid(prev_mfn)) { if (is_xen_heap_mfn(prev_mfn)) /* Xen heap frames are simply unhooked from this phys slot. */ - guest_physmap_remove_page(d, xatp.gpfn, prev_mfn); + guest_physmap_remove_page(d, xatp.gpfn, prev_mfn, 0); else /* Normal domain memory is freed, to avoid leaking memory. */ guest_remove_page(d, xatp.gpfn); @@ -2856,10 +2865,10 @@ arch_memory_op(int op, XEN_GUEST_HANDLE( /* Unmap from old location, if any. */ gpfn = get_gpfn_from_mfn(mfn); if (gpfn != INVALID_M2P_ENTRY) - guest_physmap_remove_page(d, gpfn, mfn); + guest_physmap_remove_page(d, gpfn, mfn, 0); /* Map at new location. */ - guest_physmap_add_page(d, xatp.gpfn, mfn); + guest_physmap_add_page(d, xatp.gpfn, mfn, 0); out: domain_unlock(d); diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/acpi/Makefile --- a/xen/arch/x86/acpi/Makefile Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/x86/acpi/Makefile Fri May 16 21:59:38 2008 +0900 @@ -2,3 +2,4 @@ subdir-y += cpufreq obj-y += boot.o obj-y += power.o suspend.o wakeup_prot.o cpu_idle.o +obj-y += pmstat.o diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/x86/acpi/boot.c Fri May 16 21:59:38 2008 +0900 @@ -441,17 +441,9 @@ acpi_fadt_parse_sleep_info(struct acpi_t "FACS is shorter than ACPI spec allow: 0x%x", facs->length); - if ((rsdp->revision < 2) || (facs->length < 32)) { - acpi_sinfo.wakeup_vector = facs_pa + - offsetof(struct acpi_table_facs, - firmware_waking_vector); - acpi_sinfo.vector_width = 32; - } else { - acpi_sinfo.wakeup_vector = facs_pa + - offsetof(struct acpi_table_facs, - xfirmware_waking_vector); - acpi_sinfo.vector_width = 64; - } + acpi_sinfo.wakeup_vector = facs_pa + + offsetof(struct acpi_table_facs, firmware_waking_vector); + acpi_sinfo.vector_width = 32; printk(KERN_INFO PREFIX " wakeup_vec[%"PRIx64"], vec_size[%x]\n", diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/acpi/cpufreq/cpufreq.c --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Fri May 16 21:59:38 2008 +0900 @@ -369,6 +369,8 @@ static int acpi_cpufreq_target(struct cp if (!check_freqs(cmd.mask, freqs.new, data)) return -EAGAIN; + px_statistic_update(cmd.mask, perf->state, next_perf_state); + perf->state = next_perf_state; policy->cur = freqs.new; @@ -581,9 +583,13 @@ int acpi_cpufreq_init(void) for_each_online_cpu(i) { xen_px_policy[i].cpu = i; + ret = px_statistic_init(i); + if (ret) + goto out; + ret = acpi_cpufreq_cpu_init(&xen_px_policy[i]); if (ret) - goto cpufreq_init_out; + goto out; } /* setup ondemand cpufreq */ @@ -593,10 +599,10 @@ int acpi_cpufreq_init(void) i = first_cpu(pt[dom]); ret = cpufreq_governor_dbs(&xen_px_policy[i], CPUFREQ_GOV_START); if (ret) - goto cpufreq_init_out; - } - -cpufreq_init_out: + goto out; + } + +out: xfree(pt); return ret; diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/acpi/cpufreq/utility.c --- a/xen/arch/x86/acpi/cpufreq/utility.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/x86/acpi/cpufreq/utility.c Fri May 16 21:59:38 2008 +0900 @@ -34,6 +34,83 @@ struct cpufreq_driver *cpufreq_driver; struct cpufreq_driver *cpufreq_driver; /********************************************************************* + * Px STATISTIC INFO * + *********************************************************************/ + +void px_statistic_update(cpumask_t cpumask, uint8_t from, uint8_t to) +{ + uint32_t i; + uint64_t now; + + now = NOW(); + + for_each_cpu_mask(i, cpumask) { + struct pm_px *pxpt = &px_statistic_data[i]; + uint32_t statnum = processor_pminfo[i].perf.state_count; + + pxpt->u.last = from; + pxpt->u.cur = to; + pxpt->u.pt[to].count++; + pxpt->u.pt[from].residency += now - pxpt->prev_state_wall; + + (*(pxpt->u.trans_pt + from*statnum + to))++; + + pxpt->prev_state_wall = now; + } +} + +int px_statistic_init(int cpuid) +{ + uint32_t i, count; + struct pm_px *pxpt = &px_statistic_data[cpuid]; + struct processor_pminfo *pmpt = &processor_pminfo[cpuid]; + + count = pmpt->perf.state_count; + + pxpt->u.trans_pt = xmalloc_array(uint64_t, count * count); + if (!pxpt->u.trans_pt) + return -ENOMEM; + + pxpt->u.pt = xmalloc_array(struct pm_px_val, count); + if (!pxpt->u.pt) { + xfree(pxpt->u.trans_pt); + return -ENOMEM; + } + + memset(pxpt->u.trans_pt, 0, count * count * (sizeof(uint64_t))); + memset(pxpt->u.pt, 0, count * (sizeof(struct pm_px_val))); + + pxpt->u.total = pmpt->perf.state_count; + pxpt->u.usable = pmpt->perf.state_count - pmpt->perf.ppc; + + for (i=0; i < pmpt->perf.state_count; i++) + pxpt->u.pt[i].freq = pmpt->perf.states[i].core_frequency; + + pxpt->prev_state_wall = NOW(); + + return 0; +} + +void px_statistic_reset(int cpuid) +{ + uint32_t i, j, count; + struct pm_px *pxpt = &px_statistic_data[cpuid]; + + count = processor_pminfo[cpuid].perf.state_count; + + for (i=0; i < count; i++) { + pxpt->u.pt[i].residency = 0; + pxpt->u.pt[i].count = 0; + + for (j=0; j < count; j++) + *(pxpt->u.trans_pt + i*count + j) = 0; + } + + pxpt->prev_state_wall = NOW(); +} + + +/********************************************************************* * FREQUENCY TABLE HELPERS * *********************************************************************/ diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/acpi/pmstat.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/acpi/pmstat.c Fri May 16 21:59:38 2008 +0900 @@ -0,0 +1,110 @@ +/***************************************************************************** +# pmstat.c - Power Management statistic information (Px/Cx/Tx, etc.) +# +# Copyright (c) 2008, Liu Jinsong +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., 59 +# Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# The full GNU General Public License is included in this distribution in the +# file called LICENSE. +# +*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +struct pm_px px_statistic_data[NR_CPUS]; + +int do_get_pm_info(struct xen_sysctl_get_pmstat *op) +{ + int ret = 0; + struct pm_px *pxpt = &px_statistic_data[op->cpuid]; + struct processor_pminfo *pmpt = &processor_pminfo[op->cpuid]; + + /* to protect the case when Px was controlled by dom0-kernel */ + /* or when CPU_FREQ not set in which case ACPI Px objects not parsed */ + if ( !pmpt->perf.init ) + return -EINVAL; + + if ( !cpu_online(op->cpuid) ) + return -EINVAL; + + switch( op->type ) + { + case PMSTAT_get_max_px: + { + op->u.getpx.total = pmpt->perf.state_count; + break; + } + + case PMSTAT_get_pxstat: + { + uint64_t now, ct; + + now = NOW(); + pxpt->u.usable = pmpt->perf.state_count - pmpt->perf.ppc; + pxpt->u.pt[pxpt->u.cur].residency += now - pxpt->prev_state_wall; + pxpt->prev_state_wall = now; + + ct = pmpt->perf.state_count; + if ( copy_to_guest(op->u.getpx.trans_pt, pxpt->u.trans_pt, ct*ct) ) + { + ret = -EFAULT; + break; + } + + if ( copy_to_guest(op->u.getpx.pt, pxpt->u.pt, ct) ) + { + ret = -EFAULT; + break; + } + + op->u.getpx.total = pxpt->u.total; + op->u.getpx.usable = pxpt->u.usable; + op->u.getpx.last = pxpt->u.last; + op->u.getpx.cur = pxpt->u.cur; + + break; + } + + case PMSTAT_reset_pxstat: + { + px_statistic_reset(op->cpuid); + break; + } + + default: + printk("not defined sub-hypercall @ do_get_pm_info\n"); + ret = -ENOSYS; + break; + } + + return ret; +} diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/x86/mm.c Fri May 16 21:59:38 2008 +0900 @@ -3297,7 +3297,7 @@ long arch_memory_op(int op, XEN_GUEST_HA { if ( is_xen_heap_mfn(prev_mfn) ) /* Xen heap frames are simply unhooked from this phys slot. */ - guest_physmap_remove_page(d, xatp.gpfn, prev_mfn); + guest_physmap_remove_page(d, xatp.gpfn, prev_mfn, 0); else /* Normal domain memory is freed, to avoid leaking memory. */ guest_remove_page(d, xatp.gpfn); @@ -3306,10 +3306,10 @@ long arch_memory_op(int op, XEN_GUEST_HA /* Unmap from old location, if any. */ gpfn = get_gpfn_from_mfn(mfn); if ( gpfn != INVALID_M2P_ENTRY ) - guest_physmap_remove_page(d, gpfn, mfn); + guest_physmap_remove_page(d, gpfn, mfn, 0); /* Map at new location. */ - guest_physmap_add_page(d, xatp.gpfn, mfn); + guest_physmap_add_page(d, xatp.gpfn, mfn, 0); domain_unlock(d); diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/mm/hap/p2m-ept.c --- a/xen/arch/x86/mm/hap/p2m-ept.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/x86/mm/hap/p2m-ept.c Fri May 16 21:59:38 2008 +0900 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -46,6 +47,9 @@ static void ept_p2m_type_to_flags(ept_en } } +#define GUEST_TABLE_NORMAL_PAGE 1 +#define GUEST_TABLE_SUPER_PAGE 2 + static int ept_next_level(struct domain *d, bool_t read_only, ept_entry_t **table, unsigned long *gfn_remainder, u32 shift) @@ -54,7 +58,6 @@ static int ept_next_level(struct domain u32 index; index = *gfn_remainder >> shift; - *gfn_remainder &= (1UL << shift) - 1; ept_entry = (*table) + index; @@ -83,31 +86,53 @@ static int ept_next_level(struct domain ept_entry->r = ept_entry->w = ept_entry->x = 1; } - next = map_domain_page(ept_entry->mfn); - unmap_domain_page(*table); - *table = next; - - return 1; + if ( !ept_entry->sp_avail ) + { + *gfn_remainder &= (1UL << shift) - 1; + next = map_domain_page(ept_entry->mfn); + unmap_domain_page(*table); + *table = next; + return GUEST_TABLE_NORMAL_PAGE; + } + else + return GUEST_TABLE_SUPER_PAGE; } static int -ept_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt) -{ - ept_entry_t *table = - map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); - unsigned long gfn_remainder = gfn; +ept_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, + unsigned int order, p2m_type_t p2mt) +{ + ept_entry_t *table = NULL; + unsigned long gfn_remainder = gfn, offset = 0; ept_entry_t *ept_entry = NULL; u32 index; - int i, rv = 0; + int i, rv = 0, ret = 0; + int walk_level = order / EPT_TABLE_ORDER; /* Should check if gfn obeys GAW here */ - for ( i = EPT_DEFAULT_GAW; i > 0; i-- ) - if ( !ept_next_level(d, 0, &table, &gfn_remainder, - i * EPT_TABLE_ORDER) ) + if ( order != 0 ) + if ( (gfn & ((1UL << order) - 1)) ) + return 1; + + table = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); + + ASSERT(table != NULL); + + for ( i = EPT_DEFAULT_GAW; i > walk_level; i-- ) + { + ret = ept_next_level(d, 0, &table, &gfn_remainder, + i * EPT_TABLE_ORDER); + if ( !ret ) goto out; - - index = gfn_remainder; + else if ( ret == GUEST_TABLE_SUPER_PAGE ) + break; + } + + index = gfn_remainder >> ( i ? (i * EPT_TABLE_ORDER): order); + walk_level = ( i ? ( i * EPT_TABLE_ORDER) : order) / EPT_TABLE_ORDER; + offset = (gfn_remainder & ( ((1 << (i*EPT_TABLE_ORDER)) - 1))); + ept_entry = table + index; if ( mfn_valid(mfn_x(mfn)) || (p2mt == p2m_mmio_direct) ) @@ -117,9 +142,20 @@ ept_set_entry(struct domain *d, unsigned d->arch.p2m->max_mapped_pfn = gfn; ept_entry->emt = EPT_DEFAULT_MT; - ept_entry->sp_avail = 0; + ept_entry->sp_avail = walk_level ? 1 : 0; + + if ( ret == GUEST_TABLE_SUPER_PAGE ) + { + ept_entry->mfn = mfn_x(mfn) - offset; + if ( ept_entry->avail1 == p2m_ram_logdirty && + p2mt == p2m_ram_rw ) + for ( i = 0; i < 512; i++ ) + paging_mark_dirty(d, mfn_x(mfn)-offset+i); + } + else + ept_entry->mfn = mfn_x(mfn); + ept_entry->avail1 = p2mt; - ept_entry->mfn = mfn_x(mfn); ept_entry->rsvd = 0; ept_entry->avail2 = 0; /* last step */ @@ -132,14 +168,42 @@ ept_set_entry(struct domain *d, unsigned /* Success */ rv = 1; - out: +out: unmap_domain_page(table); ept_sync_domain(d); + /* Now the p2m table is not shared with vt-d page table */ + + if ( iommu_enabled && is_hvm_domain(d) ) + { + if ( p2mt == p2m_ram_rw ) + { + if ( ret == GUEST_TABLE_SUPER_PAGE ) + { + for ( i = 0; i < 512; i++ ) + iommu_map_page(d, gfn-offset+i, mfn_x(mfn)-offset+i); + } + else if ( ret ) + iommu_map_page(d, gfn, mfn_x(mfn)); + } + else + { + if ( ret == GUEST_TABLE_SUPER_PAGE ) + { + for ( i = 0; i < 512; i++ ) + iommu_unmap_page(d, gfn-offset+i); + } + else if ( ret ) + iommu_unmap_page(d, gfn); + } + } + +#ifdef P2M_SHARE_WITH_VTD_PAGE_TABLE /* If p2m table is shared with vtd page-table. */ if ( iommu_enabled && is_hvm_domain(d) && (p2mt == p2m_mmio_direct) ) iommu_flush(d, gfn, (u64*)ept_entry); +#endif return rv; } @@ -152,7 +216,7 @@ static mfn_t ept_get_entry(struct domain unsigned long gfn_remainder = gfn; ept_entry_t *ept_entry; u32 index; - int i; + int i, ret=0; mfn_t mfn = _mfn(INVALID_MFN); *t = p2m_mmio_dm; @@ -164,17 +228,31 @@ static mfn_t ept_get_entry(struct domain /* Should check if gfn obeys GAW here. */ for ( i = EPT_DEFAULT_GAW; i > 0; i-- ) - if ( !ept_next_level(d, 1, &table, &gfn_remainder, - i * EPT_TABLE_ORDER) ) + { + ret = ept_next_level(d, 1, &table, &gfn_remainder, + i * EPT_TABLE_ORDER); + if ( !ret ) goto out; - - index = gfn_remainder; + else if ( ret == GUEST_TABLE_SUPER_PAGE ) + break; + } + + index = gfn_remainder >> ( i * EPT_TABLE_ORDER); ept_entry = table + index; if ( ept_entry->avail1 != p2m_invalid ) { *t = ept_entry->avail1; mfn = _mfn(ept_entry->mfn); + if ( i ) + { + /* we may meet super pages, and to split into 4k pages + * to emulate p2m table + */ + unsigned long split_mfn = + mfn_x(mfn) + (gfn_remainder & ( ((1 << (i*EPT_TABLE_ORDER)) - 1 ))); + mfn = _mfn(split_mfn); + } } out: @@ -205,33 +283,63 @@ static void ept_change_entry_type_global l4e = map_domain_page(mfn_x(pagetable_get_mfn(d->arch.phys_table))); for (i4 = 0; i4 < EPT_PAGETABLE_ENTRIES; i4++ ) { - if ( !l4e[i4].epte || l4e[i4].sp_avail ) + if ( !l4e[i4].epte ) continue; - l3e = map_domain_page(l4e[i4].mfn); - for ( i3 = 0; i3 < EPT_PAGETABLE_ENTRIES; i3++ ) - { - if ( !l3e[i3].epte || l3e[i3].sp_avail ) + if ( !l4e[i4].sp_avail ) + { + l3e = map_domain_page(l4e[i4].mfn); + for ( i3 = 0; i3 < EPT_PAGETABLE_ENTRIES; i3++ ) + { + if ( !l3e[i3].epte ) + continue; + if ( !l3e[i3].sp_avail ) + { + l2e = map_domain_page(l3e[i3].mfn); + for ( i2 = 0; i2 < EPT_PAGETABLE_ENTRIES; i2++ ) + { + if ( !l2e[i2].epte ) + continue; + if ( !l2e[i2].sp_avail ) + { + l1e = map_domain_page(l2e[i2].mfn); + for ( i1 = 0; i1 < EPT_PAGETABLE_ENTRIES; i1++ ) + { + if ( !l1e[i1].epte ) + continue; + if ( l1e[i1].avail1 != ot ) + continue; + l1e[i1].avail1 = nt; + ept_p2m_type_to_flags(l1e+i1, nt); + } + unmap_domain_page(l1e); + } + else + { + if ( l2e[i2].avail1 != ot ) + continue; + l2e[i2].avail1 = nt; + ept_p2m_type_to_flags(l2e+i2, nt); + } + } + unmap_domain_page(l2e); + } + else + { + if ( l3e[i3].avail1 != ot ) + continue; + l3e[i3].avail1 = nt; + ept_p2m_type_to_flags(l3e+i3, nt); + } + } + unmap_domain_page(l3e); + } + else + { + if ( l4e[i4].avail1 != ot ) continue; - l2e = map_domain_page(l3e[i3].mfn); - for ( i2 = 0; i2 < EPT_PAGETABLE_ENTRIES; i2++ ) - { - if ( !l2e[i2].epte || l2e[i2].sp_avail ) - continue; - l1e = map_domain_page(l2e[i2].mfn); - for ( i1 = 0; i1 < EPT_PAGETABLE_ENTRIES; i1++ ) - { - if ( !l1e[i1].epte ) - continue; - if ( l1e[i1].avail1 != ot ) - continue; - l1e[i1].avail1 = nt; - ept_p2m_type_to_flags(l1e+i1, nt); - } - unmap_domain_page(l1e); - } - unmap_domain_page(l2e); - } - unmap_domain_page(l3e); + l4e[i4].avail1 = nt; + ept_p2m_type_to_flags(l4e+i4, nt); + } } unmap_domain_page(l4e); diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/x86/mm/p2m.c Fri May 16 21:59:38 2008 +0900 @@ -151,9 +151,11 @@ p2m_next_level(struct domain *d, mfn_t * unsigned long *gfn_remainder, unsigned long gfn, u32 shift, u32 max, unsigned long type) { + l1_pgentry_t *l1_entry; l1_pgentry_t *p2m_entry; l1_pgentry_t new_entry; void *next; + int i; ASSERT(d->arch.p2m->alloc_page); if ( !(p2m_entry = p2m_find_entry(*table, gfn_remainder, gfn, @@ -194,6 +196,44 @@ p2m_next_level(struct domain *d, mfn_t * break; } } + + ASSERT(l1e_get_flags(*p2m_entry) & _PAGE_PRESENT); + + /* split single large page into 4KB page in P2M table */ + if ( type == PGT_l1_page_table && (l1e_get_flags(*p2m_entry) & _PAGE_PSE) ) + { + unsigned long flags, pfn; + struct page_info *pg = d->arch.p2m->alloc_page(d); + if ( pg == NULL ) + return 0; + list_add_tail(&pg->list, &d->arch.p2m->pages); + pg->u.inuse.type_info = PGT_l1_page_table | 1 | PGT_validated; + pg->count_info = 1; + + /* New splintered mappings inherit the flags of the old superpage, + * with a little reorganisation for the _PAGE_PSE_PAT bit. */ + flags = l1e_get_flags(*p2m_entry); + pfn = l1e_get_pfn(*p2m_entry); + if ( pfn & 1 ) /* ==> _PAGE_PSE_PAT was set */ + pfn -= 1; /* Clear it; _PAGE_PSE becomes _PAGE_PAT */ + else + flags &= ~_PAGE_PSE; /* Clear _PAGE_PSE (== _PAGE_PAT) */ + + l1_entry = map_domain_page(mfn_x(page_to_mfn(pg))); + for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ ) + { + new_entry = l1e_from_pfn(pfn + i, flags); + paging_write_p2m_entry(d, gfn, + l1_entry+i, *table_mfn, new_entry, 1); + } + unmap_domain_page(l1_entry); + + new_entry = l1e_from_pfn(mfn_x(page_to_mfn(pg)), + __PAGE_HYPERVISOR|_PAGE_USER); + paging_write_p2m_entry(d, gfn, + p2m_entry, *table_mfn, new_entry, 2); + } + *table_mfn = _mfn(l1e_get_pfn(*p2m_entry)); next = map_domain_page(mfn_x(*table_mfn)); unmap_domain_page(*table); @@ -204,7 +244,8 @@ p2m_next_level(struct domain *d, mfn_t * // Returns 0 on error (out of memory) static int -p2m_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt) +p2m_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, + unsigned int page_order, p2m_type_t p2mt) { // XXX -- this might be able to be faster iff current->domain == d mfn_t table_mfn = pagetable_get_mfn(d->arch.phys_table); @@ -212,6 +253,7 @@ p2m_set_entry(struct domain *d, unsigned unsigned long gfn_remainder = gfn; l1_pgentry_t *p2m_entry; l1_pgentry_t entry_content; + l2_pgentry_t l2e_content; int rv=0; #if CONFIG_PAGING_LEVELS >= 4 @@ -235,26 +277,53 @@ p2m_set_entry(struct domain *d, unsigned PGT_l2_page_table) ) goto out; - if ( !p2m_next_level(d, &table_mfn, &table, &gfn_remainder, gfn, - L2_PAGETABLE_SHIFT - PAGE_SHIFT, - L2_PAGETABLE_ENTRIES, PGT_l1_page_table) ) - goto out; - - p2m_entry = p2m_find_entry(table, &gfn_remainder, gfn, - 0, L1_PAGETABLE_ENTRIES); - ASSERT(p2m_entry); + if ( page_order == 0 ) + { + if ( !p2m_next_level(d, &table_mfn, &table, &gfn_remainder, gfn, + L2_PAGETABLE_SHIFT - PAGE_SHIFT, + L2_PAGETABLE_ENTRIES, PGT_l1_page_table) ) + goto out; + + p2m_entry = p2m_find_entry(table, &gfn_remainder, gfn, + 0, L1_PAGETABLE_ENTRIES); + ASSERT(p2m_entry); + + if ( mfn_valid(mfn) || (p2mt == p2m_mmio_direct) ) + entry_content = l1e_from_pfn(mfn_x(mfn), p2m_type_to_flags(p2mt)); + else + entry_content = l1e_empty(); + + /* level 1 entry */ + paging_write_p2m_entry(d, gfn, p2m_entry, table_mfn, entry_content, 1); + } + else + { + p2m_entry = p2m_find_entry(table, &gfn_remainder, gfn, + L2_PAGETABLE_SHIFT - PAGE_SHIFT, + L2_PAGETABLE_ENTRIES); + ASSERT(p2m_entry); + + if ( (l1e_get_flags(*p2m_entry) & _PAGE_PRESENT) && + !(l1e_get_flags(*p2m_entry) & _PAGE_PSE) ) + { + P2M_ERROR("configure P2M table 4KB L2 entry with large page\n"); + domain_crash(d); + goto out; + } + + if ( mfn_valid(mfn) ) + l2e_content = l2e_from_pfn(mfn_x(mfn), + p2m_type_to_flags(p2mt) | _PAGE_PSE); + else + l2e_content = l2e_empty(); + + entry_content.l1 = l2e_content.l2; + paging_write_p2m_entry(d, gfn, p2m_entry, table_mfn, entry_content, 2); + } /* Track the highest gfn for which we have ever had a valid mapping */ if ( mfn_valid(mfn) && (gfn > d->arch.p2m->max_mapped_pfn) ) d->arch.p2m->max_mapped_pfn = gfn; - - if ( mfn_valid(mfn) || (p2mt == p2m_mmio_direct) ) - entry_content = l1e_from_pfn(mfn_x(mfn), p2m_type_to_flags(p2mt)); - else - entry_content = l1e_empty(); - - /* level 1 entry */ - paging_write_p2m_entry(d, gfn, p2m_entry, table_mfn, entry_content, 1); if ( iommu_enabled && is_hvm_domain(d) ) { @@ -335,6 +404,16 @@ p2m_gfn_to_mfn(struct domain *d, unsigne unmap_domain_page(l2e); return _mfn(INVALID_MFN); } + else if ( (l2e_get_flags(*l2e) & _PAGE_PSE) ) + { + mfn = _mfn(l2e_get_pfn(*l2e) + l1_table_offset(addr)); + *t = p2m_flags_to_type(l2e_get_flags(*l2e)); + unmap_domain_page(l2e); + + ASSERT(mfn_valid(mfn) || !p2m_is_ram(*t)); + return (p2m_is_valid(*t)) ? mfn : _mfn(INVALID_MFN); + } + mfn = _mfn(l2e_get_pfn(*l2e)); unmap_domain_page(l2e); @@ -358,6 +437,7 @@ static mfn_t p2m_gfn_to_mfn_current(unsi { mfn_t mfn = _mfn(INVALID_MFN); p2m_type_t p2mt = p2m_mmio_dm; + paddr_t addr = ((paddr_t)gfn) << PAGE_SHIFT; /* XXX This is for compatibility with the old model, where anything not * XXX marked as RAM was considered to be emulated MMIO space. * XXX Once we start explicitly registering MMIO regions in the p2m @@ -366,25 +446,44 @@ static mfn_t p2m_gfn_to_mfn_current(unsi if ( gfn <= current->domain->arch.p2m->max_mapped_pfn ) { l1_pgentry_t l1e = l1e_empty(); + l2_pgentry_t l2e = l2e_empty(); int ret; ASSERT(gfn < (RO_MPT_VIRT_END - RO_MPT_VIRT_START) / sizeof(l1_pgentry_t)); - /* Need to __copy_from_user because the p2m is sparse and this - * part might not exist */ - ret = __copy_from_user(&l1e, - &phys_to_machine_mapping[gfn], - sizeof(l1e)); - - if ( ret == 0 ) { - p2mt = p2m_flags_to_type(l1e_get_flags(l1e)); - ASSERT(l1e_get_pfn(l1e) != INVALID_MFN || !p2m_is_ram(p2mt)); + ret = __copy_from_user(&l2e, + &__linear_l1_table[l1_linear_offset(RO_MPT_VIRT_START) + l2_linear_offset(addr)], + sizeof(l2e)); + + if ( (ret == 0) && (l2e_get_flags(l2e) & _PAGE_PRESENT) && + (l2e_get_flags(l2e) & _PAGE_PSE) ) + { + p2mt = p2m_flags_to_type(l2e_get_flags(l2e)); + ASSERT(l2e_get_pfn(l2e) != INVALID_MFN || !p2m_is_ram(p2mt)); if ( p2m_is_valid(p2mt) ) - mfn = _mfn(l1e_get_pfn(l1e)); - else - /* XXX see above */ + mfn = _mfn(l2e_get_pfn(l2e) + l1_table_offset(addr)); + else p2mt = p2m_mmio_dm; + } + else + { + + /* Need to __copy_from_user because the p2m is sparse and this + * part might not exist */ + ret = __copy_from_user(&l1e, + &phys_to_machine_mapping[gfn], + sizeof(l1e)); + + if ( ret == 0 ) { + p2mt = p2m_flags_to_type(l1e_get_flags(l1e)); + ASSERT(l1e_get_pfn(l1e) != INVALID_MFN || !p2m_is_ram(p2mt)); + if ( p2m_is_valid(p2mt) ) + mfn = _mfn(l1e_get_pfn(l1e)); + else + /* XXX see above */ + p2mt = p2m_mmio_dm; + } } } @@ -430,9 +529,10 @@ void p2m_change_entry_type_global(struct } static inline -int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt) -{ - return d->arch.p2m->set_entry(d, gfn, mfn, p2mt); +int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, + unsigned int page_order, p2m_type_t p2mt) +{ + return d->arch.p2m->set_entry(d, gfn, mfn, page_order, p2mt); } // Allocate a new p2m table for a domain. @@ -493,7 +593,8 @@ int p2m_alloc_table(struct domain *d, P2M_PRINTK("populating p2m table\n"); /* Initialise physmap tables for slot zero. Other code assumes this. */ - if ( !set_p2m_entry(d, 0, _mfn(INVALID_MFN), p2m_invalid) ) + if ( !set_p2m_entry(d, 0, _mfn(INVALID_MFN), 0, + p2m_invalid) ) goto error; /* Copy all existing mappings from the page list and m2p */ @@ -512,7 +613,7 @@ int p2m_alloc_table(struct domain *d, (gfn != 0x55555555L) #endif && gfn != INVALID_M2P_ENTRY - && !set_p2m_entry(d, gfn, mfn, p2m_ram_rw) ) + && !set_p2m_entry(d, gfn, mfn, 0, p2m_ram_rw) ) goto error; } @@ -688,6 +789,28 @@ static void audit_p2m(struct domain *d) gfn += 1 << (L2_PAGETABLE_SHIFT - PAGE_SHIFT); continue; } + + /* check for super page */ + if ( l2e_get_flags(l2e[i2]) & _PAGE_PSE ) + { + mfn = l2e_get_pfn(l2e[i2]); + ASSERT(mfn_valid(_mfn(mfn))); + for ( i1 = 0; i1 < L1_PAGETABLE_ENTRIES; i1++) + { + m2pfn = get_gpfn_from_mfn(mfn+i1); + if ( m2pfn != (gfn + i) ) + { + pmbad++; + P2M_PRINTK("mismatch: gfn %#lx -> mfn %#lx" + " -> gfn %#lx\n", gfn+i, mfn+i, + m2pfn); + BUG(); + } + } + gfn += 1 << (L2_PAGETABLE_SHIFT - PAGE_SHIFT); + continue; + } + l1e = map_domain_page(mfn_x(_mfn(l2e_get_pfn(l2e[i2])))); for ( i1 = 0; i1 < L1_PAGETABLE_ENTRIES; i1++, gfn++ ) @@ -737,32 +860,38 @@ static void audit_p2m(struct domain *d) static void -p2m_remove_page(struct domain *d, unsigned long gfn, unsigned long mfn) -{ +p2m_remove_page(struct domain *d, unsigned long gfn, unsigned long mfn, + unsigned int page_order) +{ + unsigned long i; + if ( !paging_mode_translate(d) ) return; + P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn, mfn); - set_p2m_entry(d, gfn, _mfn(INVALID_MFN), p2m_invalid); - set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY); + set_p2m_entry(d, gfn, _mfn(INVALID_MFN), page_order, p2m_invalid); + for ( i = 0; i < (1UL << page_order); i++ ) + set_gpfn_from_mfn(mfn+i, INVALID_M2P_ENTRY); } void guest_physmap_remove_page(struct domain *d, unsigned long gfn, - unsigned long mfn) + unsigned long mfn, unsigned int page_order) { p2m_lock(d->arch.p2m); audit_p2m(d); - p2m_remove_page(d, gfn, mfn); + p2m_remove_page(d, gfn, mfn, page_order); audit_p2m(d); p2m_unlock(d->arch.p2m); } int guest_physmap_add_entry(struct domain *d, unsigned long gfn, - unsigned long mfn, p2m_type_t t) -{ - unsigned long ogfn; + unsigned long mfn, unsigned int page_order, + p2m_type_t t) +{ + unsigned long i, ogfn; p2m_type_t ot; mfn_t omfn; int rc = 0; @@ -795,7 +924,8 @@ guest_physmap_add_entry(struct domain *d if ( p2m_is_ram(ot) ) { ASSERT(mfn_valid(omfn)); - set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); + for ( i = 0; i < (1UL << page_order); i++ ) + set_gpfn_from_mfn(mfn_x(omfn)+i, INVALID_M2P_ENTRY); } ogfn = mfn_to_gfn(d, _mfn(mfn)); @@ -818,21 +948,23 @@ guest_physmap_add_entry(struct domain *d P2M_DEBUG("old gfn=%#lx -> mfn %#lx\n", ogfn , mfn_x(omfn)); if ( mfn_x(omfn) == mfn ) - p2m_remove_page(d, ogfn, mfn); + p2m_remove_page(d, ogfn, mfn, page_order); } } if ( mfn_valid(_mfn(mfn)) ) { - if ( !set_p2m_entry(d, gfn, _mfn(mfn), t) ) + if ( !set_p2m_entry(d, gfn, _mfn(mfn), page_order, t) ) rc = -EINVAL; - set_gpfn_from_mfn(mfn, gfn); + for ( i = 0; i < (1UL << page_order); i++ ) + set_gpfn_from_mfn(mfn+i, gfn+i); } else { gdprintk(XENLOG_WARNING, "Adding bad mfn to p2m map (%#lx -> %#lx)\n", gfn, mfn); - if ( !set_p2m_entry(d, gfn, _mfn(INVALID_MFN), p2m_invalid) ) + if ( !set_p2m_entry(d, gfn, _mfn(INVALID_MFN), page_order, + p2m_invalid) ) rc = -EINVAL; } @@ -851,7 +983,7 @@ void p2m_change_type_global(struct domai l1_pgentry_t l1e_content; l1_pgentry_t *l1e; l2_pgentry_t *l2e; - mfn_t l1mfn; + mfn_t l1mfn, l2mfn; int i1, i2; l3_pgentry_t *l3e; int i3; @@ -891,11 +1023,26 @@ void p2m_change_type_global(struct domai { continue; } + l2mfn = _mfn(l3e_get_pfn(l3e[i3])); l2e = map_domain_page(l3e_get_pfn(l3e[i3])); for ( i2 = 0; i2 < L2_PAGETABLE_ENTRIES; i2++ ) { if ( !(l2e_get_flags(l2e[i2]) & _PAGE_PRESENT) ) { + continue; + } + + if ( (l2e_get_flags(l2e[i2]) & _PAGE_PSE) ) + { + flags = l2e_get_flags(l2e[i2]); + if ( p2m_flags_to_type(flags) != ot ) + continue; + mfn = l2e_get_pfn(l2e[i2]); + gfn = get_gpfn_from_mfn(mfn); + flags = p2m_flags_to_type(nt); + l1e_content = l1e_from_pfn(mfn, flags | _PAGE_PSE); + paging_write_p2m_entry(d, gfn, (l1_pgentry_t *)&l2e[i2], + l2mfn, l1e_content, 2); continue; } @@ -944,7 +1091,7 @@ p2m_type_t p2m_change_type(struct domain mfn = gfn_to_mfn(d, gfn, &pt); if ( pt == ot ) - set_p2m_entry(d, gfn, mfn, nt); + set_p2m_entry(d, gfn, mfn, 0, nt); p2m_unlock(d->arch.p2m); @@ -968,7 +1115,7 @@ set_mmio_p2m_entry(struct domain *d, uns set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY); } - rc = set_p2m_entry(d, gfn, mfn, p2m_mmio_direct); + rc = set_p2m_entry(d, gfn, mfn, 0, p2m_mmio_direct); if ( 0 == rc ) gdprintk(XENLOG_ERR, "set_mmio_p2m_entry: set_p2m_entry failed! mfn=%08lx\n", @@ -992,7 +1139,7 @@ clear_mmio_p2m_entry(struct domain *d, u "clear_mmio_p2m_entry: gfn_to_mfn failed! gfn=%08lx\n", gfn); return 0; } - rc = set_p2m_entry(d, gfn, _mfn(INVALID_MFN), 0); + rc = set_p2m_entry(d, gfn, _mfn(INVALID_MFN), 0, 0); return rc; } diff -r c96507e0c83d -r 6d0cc186bf41 xen/arch/x86/platform_hypercall.c --- a/xen/arch/x86/platform_hypercall.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/arch/x86/platform_hypercall.c Fri May 16 21:59:38 2008 +0900 @@ -403,7 +403,10 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe if ( xenpxpt->flags == ( XEN_PX_PCT | XEN_PX_PSS | XEN_PX_PSD | XEN_PX_PPC ) ) + { + pxpt->init =1; cpu_count++; + } if ( cpu_count == num_online_cpus() ) ret = acpi_cpufreq_init(); break; diff -r c96507e0c83d -r 6d0cc186bf41 xen/common/grant_table.c --- a/xen/common/grant_table.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/common/grant_table.c Fri May 16 21:59:38 2008 +0900 @@ -1159,7 +1159,7 @@ gnttab_transfer( spin_lock(&e->grant_table->lock); sha = &shared_entry(e->grant_table, gop.ref); - guest_physmap_add_page(e, sha->frame, mfn); + guest_physmap_add_page(e, sha->frame, mfn, 0); sha->frame = mfn; wmb(); sha->flags |= GTF_transfer_completed; diff -r c96507e0c83d -r 6d0cc186bf41 xen/common/memory.c --- a/xen/common/memory.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/common/memory.c Fri May 16 21:59:38 2008 +0900 @@ -127,9 +127,7 @@ static void populate_physmap(struct memo if ( unlikely(paging_mode_translate(d)) ) { - for ( j = 0; j < (1 << a->extent_order); j++ ) - if ( guest_physmap_add_page(d, gpfn + j, mfn + j) ) - goto out; + guest_physmap_add_page(d, gpfn, mfn, a->extent_order); } else { @@ -172,7 +170,7 @@ int guest_remove_page(struct domain *d, if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) put_page(page); - guest_physmap_remove_page(d, gmfn, mfn); + guest_physmap_remove_page(d, gmfn, mfn, 0); put_page(page); @@ -419,7 +417,7 @@ static long memory_exchange(XEN_GUEST_HA if ( !test_and_clear_bit(_PGC_allocated, &page->count_info) ) BUG(); mfn = page_to_mfn(page); - guest_physmap_remove_page(d, mfn_to_gmfn(d, mfn), mfn); + guest_physmap_remove_page(d, mfn_to_gmfn(d, mfn), mfn, 0); put_page(page); } @@ -440,9 +438,7 @@ static long memory_exchange(XEN_GUEST_HA mfn = page_to_mfn(page); if ( unlikely(paging_mode_translate(d)) ) { - /* Ignore failure here. There's nothing we can do. */ - for ( k = 0; k < (1UL << exch.out.extent_order); k++ ) - (void)guest_physmap_add_page(d, gpfn + k, mfn + k); + guest_physmap_add_page(d, gpfn, mfn, exch.out.extent_order); } else { diff -r c96507e0c83d -r 6d0cc186bf41 xen/common/sysctl.c --- a/xen/common/sysctl.c Thu May 15 16:23:56 2008 +0900 +++ b/xen/common/sysctl.c Fri May 16 21:59:38 2008 +0900 @@ -25,6 +25,8 @@ #include #include +extern int do_get_pm_info(struct xen_sysctl_get_pmstat *op); + extern long arch_do_sysctl( struct xen_sysctl *op, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl); @@ -193,6 +195,20 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc op->u.availheap.avail_bytes <<= PAGE_SHIFT; ret = copy_to_guest(u_sysctl, op, 1) ? -EFAULT : 0; + } + break; + + case XEN_SYSCTL_get_pmstat: + { + ret = do_get_pm_info(&op->u.get_pmstat); + if ( ret ) + break; + + if ( copy_to_guest(u_sysctl, op, 1) ) + { + ret = -EFAULT; + break; + } } break; diff -r c96507e0c83d -r 6d0cc186bf41 xen/include/acpi/cpufreq/processor_perf.h --- a/xen/include/acpi/cpufreq/processor_perf.h Thu May 15 16:23:56 2008 +0900 +++ b/xen/include/acpi/cpufreq/processor_perf.h Fri May 16 21:59:38 2008 +0900 @@ -2,9 +2,13 @@ #define __XEN_PROCESSOR_PM_H__ #include +#include int get_cpu_id(u8); int acpi_cpufreq_init(void); +void px_statistic_update(cpumask_t, uint8_t, uint8_t); +int px_statistic_init(int); +void px_statistic_reset(int); struct processor_performance { uint32_t state; @@ -16,15 +20,32 @@ struct processor_performance { struct xen_psd_package domain_info; cpumask_t shared_cpu_map; uint32_t shared_type; + + uint32_t init; }; struct processor_pminfo { uint32_t acpi_id; uint32_t id; - uint32_t flag; struct processor_performance perf; }; extern struct processor_pminfo processor_pminfo[NR_CPUS]; +struct px_stat { + uint8_t total; /* total Px states */ + uint8_t usable; /* usable Px states */ + uint8_t last; /* last Px state */ + uint8_t cur; /* current Px state */ + uint64_t *trans_pt; /* Px transition table */ + pm_px_val_t *pt; +}; + +struct pm_px { + struct px_stat u; + uint64_t prev_state_wall; +}; + +extern struct pm_px px_statistic_data[NR_CPUS]; + #endif /* __XEN_PROCESSOR_PM_H__ */ diff -r c96507e0c83d -r 6d0cc186bf41 xen/include/asm-ia64/grant_table.h --- a/xen/include/asm-ia64/grant_table.h Thu May 15 16:23:56 2008 +0900 +++ b/xen/include/asm-ia64/grant_table.h Fri May 16 21:59:38 2008 +0900 @@ -13,7 +13,7 @@ int replace_grant_host_mapping(unsigned int replace_grant_host_mapping(unsigned long gpaddr, unsigned long mfn, unsigned long new_gpaddr, unsigned int flags); // for grant transfer -int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn); +int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn, unsigned int page_order); /* XXX * somewhere appropriate diff -r c96507e0c83d -r 6d0cc186bf41 xen/include/asm-ia64/shadow.h --- a/xen/include/asm-ia64/shadow.h Thu May 15 16:23:56 2008 +0900 +++ b/xen/include/asm-ia64/shadow.h Fri May 16 21:59:38 2008 +0900 @@ -40,8 +40,10 @@ * Utilities to change relationship of gpfn->mfn for designated domain, * which is required by gnttab transfer, balloon, device model and etc. */ -int guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn); -void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, unsigned long mfn); +int guest_physmap_add_page(struct domain *d, unsigned long gpfn, + unsigned long mfn, unsigned int page_order); +void guest_physmap_remove_page(struct domain *d, unsigned long gpfn, + unsigned long mfn, unsigned int page_order); static inline int shadow_mode_enabled(struct domain *d) diff -r c96507e0c83d -r 6d0cc186bf41 xen/include/asm-x86/p2m.h --- a/xen/include/asm-x86/p2m.h Thu May 15 16:23:56 2008 +0900 +++ b/xen/include/asm-x86/p2m.h Fri May 16 21:59:38 2008 +0900 @@ -102,7 +102,8 @@ struct p2m_domain { void (*free_page )(struct domain *d, struct page_info *pg); int (*set_entry )(struct domain *d, unsigned long gfn, - mfn_t mfn, p2m_type_t p2mt); + mfn_t mfn, unsigned int page_order, + p2m_type_t p2mt); mfn_t (*get_entry )(struct domain *d, unsigned long gfn, p2m_type_t *p2mt); mfn_t (*get_entry_current)(unsigned long gfn, @@ -203,21 +204,23 @@ void p2m_final_teardown(struct domain *d /* Add a page to a domain's p2m table */ int guest_physmap_add_entry(struct domain *d, unsigned long gfn, - unsigned long mfn, p2m_type_t t); + unsigned long mfn, unsigned int page_order, + p2m_type_t t); /* Untyped version for RAM only, for compatibility * * Return 0 for success */ static inline int guest_physmap_add_page(struct domain *d, unsigned long gfn, - unsigned long mfn) -{ - return guest_physmap_add_entry(d, gfn, mfn, p2m_ram_rw); + unsigned long mfn, + unsigned int page_order) +{ + return guest_physmap_add_entry(d, gfn, mfn, page_order, p2m_ram_rw); } /* Remove a page from a domain's p2m table */ void guest_physmap_remove_page(struct domain *d, unsigned long gfn, - unsigned long mfn); + unsigned long mfn, unsigned int page_order); /* Change types across all p2m entries in a domain */ void p2m_change_type_global(struct domain *d, p2m_type_t ot, p2m_type_t nt); diff -r c96507e0c83d -r 6d0cc186bf41 xen/include/public/sysctl.h --- a/xen/include/public/sysctl.h Thu May 15 16:23:56 2008 +0900 +++ b/xen/include/public/sysctl.h Fri May 16 21:59:38 2008 +0900 @@ -212,7 +212,41 @@ struct xen_sysctl_availheap { }; typedef struct xen_sysctl_availheap xen_sysctl_availheap_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t); - + +#define XEN_SYSCTL_get_pmstat 10 +struct pm_px_val { + uint64_aligned_t freq; /* Px core frequency */ + uint64_aligned_t residency; /* Px residency time */ + uint64_aligned_t count; /* Px transition count */ +}; +typedef struct pm_px_val pm_px_val_t; +DEFINE_XEN_GUEST_HANDLE(pm_px_val_t); + +struct pm_px_stat { + uint8_t total; /* total Px states */ + uint8_t usable; /* usable Px states */ + uint8_t last; /* last Px state */ + uint8_t cur; /* current Px state */ + XEN_GUEST_HANDLE_64(uint64) trans_pt; /* Px transition table */ + XEN_GUEST_HANDLE_64(pm_px_val_t) pt; +}; +typedef struct pm_px_stat pm_px_stat_t; +DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t); + +struct xen_sysctl_get_pmstat { +#define PMSTAT_get_max_px 0x11 +#define PMSTAT_get_pxstat 0x12 +#define PMSTAT_reset_pxstat 0x13 + uint32_t type; + uint32_t cpuid; + union { + struct pm_px_stat getpx; + /* other struct for cx, tx, etc */ + } u; +}; +typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t; +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t); + struct xen_sysctl { uint32_t cmd; uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ @@ -226,6 +260,7 @@ struct xen_sysctl { struct xen_sysctl_debug_keys debug_keys; struct xen_sysctl_getcpuinfo getcpuinfo; struct xen_sysctl_availheap availheap; + struct xen_sysctl_get_pmstat get_pmstat; uint8_t pad[128]; } u; }; diff -r c96507e0c83d -r 6d0cc186bf41 xen/include/xen/paging.h --- a/xen/include/xen/paging.h Thu May 15 16:23:56 2008 +0900 +++ b/xen/include/xen/paging.h Fri May 16 21:59:38 2008 +0900 @@ -18,8 +18,8 @@ #else #define paging_mode_translate(d) (0) -#define guest_physmap_add_page(d, p, m) (0) -#define guest_physmap_remove_page(d, p, m) ((void)0) +#define guest_physmap_add_page(d, p, m, o) (0) +#define guest_physmap_remove_page(d, p, m, o) ((void)0) #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyToy-0002Ue-4q for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTpc-0008Ll-Af; Tue, 20 May 2008 15:32:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToN-0007RU-ID for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:35 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToG-0002zQ-G7 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:33 +0000 X-SBRS: 3.6 X-MesageID: 267645 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267645" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:25 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUPpb029603 for ; Tue, 20 May 2008 08:30:25 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUhlm032662 for ; Tue, 20 May 2008 08:30:43 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUhJW032661 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:43 -0700 Message-Id: <200805201530.m4KFUhJW032661@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:42 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Merge with ia64 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211273750 -3600 # Node ID 2757cf34d1ea6c29047121e8c25aaa6cf0a642b2 # Parent 4269ab4b37eecae7cc026b4366acd92b9e6c39e9 # Parent 7c8e2a2c006ef5953ef9c50e1b5918c342ac8890 Merge with ia64 --- tools/ioemu/hw/xenfb.c | 2 +- tools/python/xen/xend/XendDomain.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff -r 4269ab4b37ee -r 2757cf34d1ea tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Tue May 20 11:33:15 2008 +0900 +++ b/tools/ioemu/hw/xenfb.c Tue May 20 09:55:50 2008 +0100 @@ -498,7 +498,7 @@ static int xenfb_configure_fb(struct xen fb_len_lim, fb_len_max); fb_len_lim = fb_len_max; } - if (fb_len > fb_len_lim) { + if (fb_len_lim && fb_len > fb_len_lim) { fprintf(stderr, "FB: frontend fb size %zu limited to %zu\n", fb_len, fb_len_lim); diff -r 4269ab4b37ee -r 2757cf34d1ea tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Tue May 20 11:33:15 2008 +0900 +++ b/tools/python/xen/xend/XendDomain.py Tue May 20 09:55:50 2008 +0100 @@ -1282,6 +1282,10 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot migrate privileged domain %s" % domid) + if dominfo._stateGet() != DOM_STATE_RUNNING: + raise VMBadState("Domain is not running", + POWER_STATE_NAMES[DOM_STATE_RUNNING], + POWER_STATE_NAMES[dominfo._stateGet()]) """ The following call may raise a XendError exception """ dominfo.testMigrateDevices(True, dst) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:17 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:17 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTp2-0002Uh-Tk for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:17 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTph-0008PO-4p; Tue, 20 May 2008 15:32:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToP-0007Ss-0k for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:37 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToG-0002zM-Pm for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:34 +0000 X-SBRS: 3.6 X-MesageID: 267646 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267646" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:27 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUQ7T029606 for ; Tue, 20 May 2008 08:30:26 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUjqR032739 for ; Tue, 20 May 2008 08:30:45 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUjVA032738 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:45 -0700 Message-Id: <200805201530.m4KFUjVA032738@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:44 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] [IA64] avoid unnecessarily SWIOTLB bounce buffering X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1207152177 21600 # Node ID ec6e3e18ea314e9520ee6bba898e30228bf3bda4 # Parent ad7ad9af265e3276d084f8074192bec9d3867747 [IA64] avoid unnecessarily SWIOTLB bounce buffering x86 improved range_straddles_page_boundary() by the c/s 501:5486a234923d. The same discussion applies to ia64. This patch is ia64 counter part of it. Signed-off-by: Isaku Yamahata --- arch/ia64/xen/xen_dma.c | 35 +++++++++++++++++++++++++++++++++++ include/asm-ia64/maddr.h | 12 +----------- 2 files changed, 36 insertions(+), 11 deletions(-) diff -r ad7ad9af265e -r ec6e3e18ea31 arch/ia64/xen/xen_dma.c --- a/arch/ia64/xen/xen_dma.c Tue Apr 01 11:29:31 2008 -0600 +++ b/arch/ia64/xen/xen_dma.c Wed Apr 02 10:02:57 2008 -0600 @@ -37,6 +37,41 @@ do { \ } \ } while (0) +static int check_pages_physically_contiguous(unsigned long pfn, + unsigned int offset, + size_t length) +{ + unsigned long next_bus; + int i; + int nr_pages; + + next_bus = pfn_to_mfn_for_dma(pfn); + nr_pages = (offset + length + PAGE_SIZE-1) >> PAGE_SHIFT; + + for (i = 1; i < nr_pages; i++) { + if (pfn_to_mfn_for_dma(++pfn) != ++next_bus) + return 0; + } + return 1; +} + +int range_straddles_page_boundary(paddr_t p, size_t size) +{ + extern unsigned long *contiguous_bitmap; + unsigned long pfn = p >> PAGE_SHIFT; + unsigned int offset = p & ~PAGE_MASK; + + if (!is_running_on_xen()) + return 0; + + if (offset + size <= PAGE_SIZE) + return 0; + if (test_bit(pfn, contiguous_bitmap)) + return 0; + if (check_pages_physically_contiguous(pfn, offset, size)) + return 0; + return 1; +} /* * This should be broken out of swiotlb and put in a common place diff -r ad7ad9af265e -r ec6e3e18ea31 include/asm-ia64/maddr.h --- a/include/asm-ia64/maddr.h Tue Apr 01 11:29:31 2008 -0600 +++ b/include/asm-ia64/maddr.h Wed Apr 02 10:02:57 2008 -0600 @@ -108,17 +108,7 @@ typedef unsigned long paddr_t; #endif #ifdef CONFIG_XEN -static inline int -range_straddles_page_boundary(paddr_t p, size_t size) -{ - extern unsigned long *contiguous_bitmap; - - if (!is_running_on_xen()) - return 0; - - return ((((p & ~PAGE_MASK) + size) > PAGE_SIZE) && - !test_bit(p >> PAGE_SHIFT, contiguous_bitmap)); -} +int range_straddles_page_boundary(paddr_t p, size_t size); #else #define range_straddles_page_boundary(addr, size) (0) #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:21 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:21 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTp6-0002Uk-Gu for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:20 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTpk-0008Sa-Kd; Tue, 20 May 2008 15:33:00 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToQ-0007Ua-8V for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:38 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToE-0002zS-HP for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:35 +0000 X-SBRS: 3.6 X-MesageID: 267644 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267644" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:24 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUOUN029600 for ; Tue, 20 May 2008 08:30:24 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUgBG032645 for ; Tue, 20 May 2008 08:30:42 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUgDC032644 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:42 -0700 Message-Id: <200805201530.m4KFUgDC032644@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:41 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1211250795 -32400 # Node ID 4269ab4b37eecae7cc026b4366acd92b9e6c39e9 # Parent e78f5dbedbe0a5e34b4af43c9c248413e5340190 # Parent 2ada81810ddb73f29dfd1eb00de466eec2881ce6 merge with xen-unstable.hg --- tools/ioemu/hw/pci.c | 2 +- tools/python/xen/xm/main.py | 2 +- xen/arch/x86/hvm/stdvga.c | 36 +++++++++++++++++++++++++++++------- xen/arch/x86/hvm/svm/intr.c | 6 ++++++ xen/arch/x86/hvm/svm/svm.c | 38 ++++++++++++++++++++++++++++++++++++-- xen/arch/x86/setup.c | 2 +- 6 files changed, 74 insertions(+), 12 deletions(-) diff -r e78f5dbedbe0 -r 4269ab4b37ee tools/ioemu/hw/pci.c --- a/tools/ioemu/hw/pci.c Fri May 16 22:25:47 2008 +0900 +++ b/tools/ioemu/hw/pci.c Tue May 20 11:33:15 2008 +0900 @@ -101,7 +101,7 @@ int pci_device_load(PCIDevice *s, QEMUFi int i; qemu_get_buffer(f, &irq_state, 1); for (i = 0; i < 4; i++) - pci_set_irq(s, i, !!(irq_state >> i)); + pci_set_irq(s, i, (irq_state >> i) & 1); } return 0; } diff -r e78f5dbedbe0 -r 4269ab4b37ee tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Fri May 16 22:25:47 2008 +0900 +++ b/tools/python/xen/xm/main.py Tue May 20 11:33:15 2008 +0900 @@ -1096,7 +1096,7 @@ def xm_vcpu_list(args): # normalize cpumap by modulus nr_cpus, and drop duplicates cpumap = dict.fromkeys( - map(lambda x: x % nr_cpus, cpumap)).keys() + filter(lambda x: x < nr_cpus, cpumap)).keys() if len(cpumap) == nr_cpus: return "any cpu" diff -r e78f5dbedbe0 -r 4269ab4b37ee xen/arch/x86/hvm/stdvga.c --- a/xen/arch/x86/hvm/stdvga.c Fri May 16 22:25:47 2008 +0900 +++ b/xen/arch/x86/hvm/stdvga.c Tue May 20 11:33:15 2008 +0900 @@ -271,9 +271,9 @@ static uint8_t stdvga_mem_readb(uint64_t return ret; } -static uint32_t stdvga_mem_read(uint32_t addr, uint32_t size) -{ - uint32_t data = 0; +static uint64_t stdvga_mem_read(uint64_t addr, uint64_t size) +{ + uint64_t data = 0; switch ( size ) { @@ -293,8 +293,19 @@ static uint32_t stdvga_mem_read(uint32_t data |= stdvga_mem_readb(addr + 3) << 24; break; + case 8: + data = (uint64_t)(stdvga_mem_readb(addr)); + data |= (uint64_t)(stdvga_mem_readb(addr + 1)) << 8; + data |= (uint64_t)(stdvga_mem_readb(addr + 2)) << 16; + data |= (uint64_t)(stdvga_mem_readb(addr + 3)) << 24; + data |= (uint64_t)(stdvga_mem_readb(addr + 4)) << 32; + data |= (uint64_t)(stdvga_mem_readb(addr + 5)) << 40; + data |= (uint64_t)(stdvga_mem_readb(addr + 6)) << 48; + data |= (uint64_t)(stdvga_mem_readb(addr + 7)) << 56; + break; + default: - gdprintk(XENLOG_WARNING, "invalid io size:%d\n", size); + gdprintk(XENLOG_WARNING, "invalid io size: %"PRId64"\n", size); break; } @@ -409,7 +420,7 @@ static void stdvga_mem_writeb(uint64_t a } } -static void stdvga_mem_write(uint32_t addr, uint32_t data, uint32_t size) +static void stdvga_mem_write(uint64_t addr, uint64_t data, uint64_t size) { /* Intercept mmio write */ switch ( size ) @@ -430,8 +441,19 @@ static void stdvga_mem_write(uint32_t ad stdvga_mem_writeb(addr+3, (data >> 24) & 0xff); break; + case 8: + stdvga_mem_writeb(addr+0, (data >> 0) & 0xff); + stdvga_mem_writeb(addr+1, (data >> 8) & 0xff); + stdvga_mem_writeb(addr+2, (data >> 16) & 0xff); + stdvga_mem_writeb(addr+3, (data >> 24) & 0xff); + stdvga_mem_writeb(addr+4, (data >> 32) & 0xff); + stdvga_mem_writeb(addr+5, (data >> 40) & 0xff); + stdvga_mem_writeb(addr+6, (data >> 48) & 0xff); + stdvga_mem_writeb(addr+7, (data >> 56) & 0xff); + break; + default: - gdprintk(XENLOG_WARNING, "invalid io size:%d\n", size); + gdprintk(XENLOG_WARNING, "invalid io size: %"PRId64"\n", size); break; } } @@ -447,7 +469,7 @@ static int mmio_move(struct hvm_hw_stdvg { if ( p->dir == IOREQ_READ ) { - uint32_t addr = p->addr, data = p->data, tmp; + uint64_t addr = p->addr, data = p->data, tmp; for ( i = 0; i < p->count; i++ ) { tmp = stdvga_mem_read(addr, p->size); diff -r e78f5dbedbe0 -r 4269ab4b37ee xen/arch/x86/hvm/svm/intr.c --- a/xen/arch/x86/hvm/svm/intr.c Fri May 16 22:25:47 2008 +0900 +++ b/xen/arch/x86/hvm/svm/intr.c Tue May 20 11:33:15 2008 +0900 @@ -51,6 +51,12 @@ static void svm_inject_nmi(struct vcpu * ASSERT(vmcb->eventinj.fields.v == 0); vmcb->eventinj = event; + + /* + * SVM does not virtualise the NMI mask, so we emulate it by intercepting + * the next IRET and blocking NMI injection until the intercept triggers. + */ + vmcb->general1_intercepts |= GENERAL1_INTERCEPT_IRET; } static void svm_inject_extint(struct vcpu *v, int vector) diff -r e78f5dbedbe0 -r 4269ab4b37ee xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Fri May 16 22:25:47 2008 +0900 +++ b/xen/arch/x86/hvm/svm/svm.c Tue May 20 11:33:15 2008 +0900 @@ -367,15 +367,27 @@ static unsigned int svm_get_interrupt_sh static unsigned int svm_get_interrupt_shadow(struct vcpu *v) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; - return (vmcb->interrupt_shadow ? - (HVM_INTR_SHADOW_MOV_SS|HVM_INTR_SHADOW_STI) : 0); + unsigned int intr_shadow = 0; + + if ( vmcb->interrupt_shadow ) + intr_shadow |= HVM_INTR_SHADOW_MOV_SS | HVM_INTR_SHADOW_STI; + + if ( vmcb->general1_intercepts & GENERAL1_INTERCEPT_IRET ) + intr_shadow |= HVM_INTR_SHADOW_NMI; + + return intr_shadow; } static void svm_set_interrupt_shadow(struct vcpu *v, unsigned int intr_shadow) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; + vmcb->interrupt_shadow = !!(intr_shadow & (HVM_INTR_SHADOW_MOV_SS|HVM_INTR_SHADOW_STI)); + + vmcb->general1_intercepts &= ~GENERAL1_INTERCEPT_IRET; + if ( intr_shadow & HVM_INTR_SHADOW_NMI ) + vmcb->general1_intercepts |= GENERAL1_INTERCEPT_IRET; } static int svm_guest_x86_mode(struct vcpu *v) @@ -1266,6 +1278,15 @@ asmlinkage void svm_vmexit_handler(struc reason = TSW_call_or_int; if ( (vmcb->exitinfo2 >> 44) & 1 ) errcode = (uint32_t)vmcb->exitinfo2; + + /* + * Some processors set the EXITINTINFO field when the task switch + * is caused by a task gate in the IDT. In this case we will be + * emulating the event injection, so we do not want the processor + * to re-inject the original event! + */ + vmcb->eventinj.bytes = 0; + hvm_task_switch((uint16_t)vmcb->exitinfo1, reason, errcode); break; } @@ -1331,6 +1352,19 @@ asmlinkage void svm_vmexit_handler(struc svm_do_nested_pgfault(vmcb->exitinfo2, regs); break; + case VMEXIT_IRET: + /* + * IRET clears the NMI mask. However because we clear the mask + * /before/ executing IRET, we set the interrupt shadow to prevent + * a pending NMI from being injected immediately. This will work + * perfectly unless the IRET instruction faults: in that case we + * may inject an NMI before the NMI handler's IRET instruction is + * retired. + */ + vmcb->general1_intercepts &= ~GENERAL1_INTERCEPT_IRET; + vmcb->interrupt_shadow = 1; + break; + default: exit_and_crash: gdprintk(XENLOG_ERR, "unexpected VMEXIT: exit reason = 0x%x, " diff -r e78f5dbedbe0 -r 4269ab4b37ee xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Fri May 16 22:25:47 2008 +0900 +++ b/xen/arch/x86/setup.c Tue May 20 11:33:15 2008 +0900 @@ -362,7 +362,7 @@ void __init kexec_reserve_area(struct e8 is_reserved = 1; - if ( !reserve_e820_ram(e820, kdump_start, kdump_size) ) + if ( !reserve_e820_ram(e820, kdump_start, kdump_start + kdump_size) ) { printk("Kdump: DISABLED (failed to reserve %luMB (%lukB) at 0x%lx)" "\n", kdump_size >> 20, kdump_size >> 10, kdump_start); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:24 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:24 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTpA-0002Uo-GA for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:24 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTpo-0008WL-Oa; Tue, 20 May 2008 15:33:04 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToT-0007WW-3L for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:41 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToL-0002zQ-S1 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:39 +0000 X-SBRS: 3.6 X-MesageID: 267647 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267647" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:28 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUSYA029609 for ; Tue, 20 May 2008 08:30:28 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUkLS032756 for ; Tue, 20 May 2008 08:30:46 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUkUk032755 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:46 -0700 Message-Id: <200805201530.m4KFUkUk032755@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:45 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] [IA64] Set memory attribute in inline asm X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1208201377 21600 # Node ID dbe8a35dcaf7c12b816e358c596f7fcc9b926e77 # Parent ec6e3e18ea314e9520ee6bba898e30228bf3bda4 [IA64] Set memory attribute in inline asm Some priv_ops need memory attribulte in inline asm. This avoids potential issues if the compiler optimizes the functions. Signed-off-by: Akio Takebe --- include/asm-ia64/xen/privop.h | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff -r ec6e3e18ea31 -r dbe8a35dcaf7 include/asm-ia64/xen/privop.h --- a/include/asm-ia64/xen/privop.h Wed Apr 02 10:02:57 2008 -0600 +++ b/include/asm-ia64/xen/privop.h Mon Apr 14 13:29:37 2008 -0600 @@ -67,8 +67,7 @@ #endif #ifndef __ASSEMBLY__ -#define XEN_HYPER_SSM_I asm("break %0" : : "i" (HYPERPRIVOP_SSM_I)) -#define XEN_HYPER_GET_IVR asm("break %0" : : "i" (HYPERPRIVOP_GET_IVR)) +#define XEN_HYPER_SSM_I asm("break %0" : : "i" (HYPERPRIVOP_SSM_I): "memory") /************************************************/ /* Instructions paravirtualized for correctness */ @@ -83,7 +82,7 @@ xen_fc(unsigned long addr) xen_fc(unsigned long addr) { register __u64 __addr asm ("r8") = addr; - asm volatile ("break %0":: "i"(HYPERPRIVOP_FC), "r"(__addr)); + asm volatile ("break %0":: "i"(HYPERPRIVOP_FC), "r"(__addr): "memory"); } static inline unsigned long @@ -188,7 +187,7 @@ xen_set_eflag(unsigned long val) xen_set_eflag(unsigned long val) { register __u64 __val asm ("r8") = val; - asm volatile ("break %0":: "i"(HYPERPRIVOP_SET_EFLAG), "r"(__val)); + asm volatile ("break %0":: "i"(HYPERPRIVOP_SET_EFLAG), "r"(__val): "memory"); } #else extern unsigned long xen_get_eflag(void); /* see xen_ia64_getreg */ @@ -331,7 +330,7 @@ xen_set_tpr(unsigned long val) { register __u64 __val asm ("r8") = val; asm volatile ("break %0":: - "i"(HYPERPRIVOP_GET_TPR), "r"(__val)); + "i"(HYPERPRIVOP_GET_TPR), "r"(__val): "memory"); } static inline void @@ -339,14 +338,14 @@ xen_eoi(unsigned long val) { register __u64 __val asm ("r8") = val; asm volatile ("break %0":: - "i"(HYPERPRIVOP_EOI), "r"(__val)); + "i"(HYPERPRIVOP_EOI), "r"(__val): "memory"); } static inline void xen_set_itm(unsigned long val) { register __u64 __val asm ("r8") = val; - asm volatile ("break %0":: "i"(HYPERPRIVOP_SET_ITM), "r"(__val)); + asm volatile ("break %0":: "i"(HYPERPRIVOP_SET_ITM), "r"(__val): "memory"); } static inline void @@ -355,7 +354,7 @@ xen_ptcga(unsigned long addr, unsigned l register __u64 __addr asm ("r8") = addr; register __u64 __size asm ("r9") = size; asm volatile ("break %0":: - "i"(HYPERPRIVOP_PTC_GA), "r"(__addr), "r"(__size)); + "i"(HYPERPRIVOP_PTC_GA), "r"(__addr), "r"(__size): "memory"); } static inline unsigned long @@ -375,7 +374,7 @@ xen_set_rr(unsigned long index, unsigned register __u64 __index asm ("r8") = index; register __u64 __val asm ("r9") = val; asm volatile ("break %0":: - "i"(HYPERPRIVOP_SET_RR), "r"(__index), "r"(__val)); + "i"(HYPERPRIVOP_SET_RR), "r"(__index), "r"(__val): "memory"); } static inline void @@ -390,7 +389,7 @@ xen_set_rr0_to_rr4(unsigned long val0, u asm volatile ("break %0" :: "i"(HYPERPRIVOP_SET_RR0_TO_RR4), "r"(__val0), "r"(__val1), - "r"(__val2), "r"(__val3), "r"(__val4)); + "r"(__val2), "r"(__val3), "r"(__val4): "memory"); } static inline void @@ -399,7 +398,7 @@ xen_set_kr(unsigned long index, unsigned register __u64 __index asm ("r8") = index; register __u64 __val asm ("r9") = val; asm volatile ("break %0":: - "i"(HYPERPRIVOP_SET_KR), "r"(__index), "r"(__val)); + "i"(HYPERPRIVOP_SET_KR), "r"(__index), "r"(__val): "memory"); } #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:29 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:29 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTpE-0002Ur-KO for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:29 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTps-00008A-U3; Tue, 20 May 2008 15:33:08 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToV-0007XW-CP for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:43 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToN-0002zM-0v for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:41 +0000 X-SBRS: 3.6 X-MesageID: 267648 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267648" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:29 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUTON029612 for ; Tue, 20 May 2008 08:30:29 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUlQu000307 for ; Tue, 20 May 2008 08:30:47 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUlVD000306 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:47 -0700 Message-Id: <200805201530.m4KFUlVD000306@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:46 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1208279427 21600 # Node ID ae505684a995b9aa366fffc4d78cebfdf0552ddc # Parent dbe8a35dcaf7c12b816e358c596f7fcc9b926e77 # Parent 7f8b544237bf70b05d0ac2b2ee9d537b6fa50100 merge with linux-2.6.18-xen.hg --- arch/i386/kernel/acpi/sleep-xen.c | 21 ------------- arch/i386/kernel/sysenter.c | 12 ++++--- arch/powerpc/kernel/vdso.c | 7 ++++ arch/x86_64/ia32/ia32_binfmt.c | 49 -------------------------------- arch/x86_64/ia32/syscall32.c | 7 ++++ arch/x86_64/kernel/acpi/sleep-xen.c | 21 ------------- drivers/acpi/hardware/hwsleep.c | 21 ++++++++----- drivers/char/mem.c | 10 ++++++ drivers/pci/quirks.c | 14 ++++++++- drivers/xen/balloon/balloon.c | 37 +++++++++++++++++++++++- drivers/xen/blkback/common.h | 2 - drivers/xen/blkback/vbd.c | 4 +- drivers/xen/blkback/xenbus.c | 10 +++++- drivers/xen/blktap/blktap.c | 2 - drivers/xen/evtchn/evtchn.c | 2 + drivers/xen/gntdev/gntdev.c | 2 - drivers/xen/netfront/netfront.c | 38 ++++++++++++++++++------ drivers/xen/xenbus/xenbus_probe.c | 3 + fs/binfmt_elf.c | 4 ++ fs/compat_ioctl.c | 2 + include/asm-i386/acpi.h | 28 +++++++++++++++--- include/asm-i386/elf.h | 44 ---------------------------- include/asm-i386/mach-xen/asm/pgtable.h | 4 +- include/asm-x86_64/acpi.h | 29 +++++++++++++++--- include/linux/mm.h | 1 25 files changed, 197 insertions(+), 177 deletions(-) diff -r dbe8a35dcaf7 -r ae505684a995 arch/i386/kernel/acpi/sleep-xen.c --- a/arch/i386/kernel/acpi/sleep-xen.c Mon Apr 14 13:29:37 2008 -0600 +++ b/arch/i386/kernel/acpi/sleep-xen.c Tue Apr 15 11:10:27 2008 -0600 @@ -110,25 +110,4 @@ static int __init acpisleep_dmi_init(voi } core_initcall(acpisleep_dmi_init); - -#else /* CONFIG_ACPI_PV_SLEEP */ -#include -#include -int acpi_notify_hypervisor_state(u8 sleep_state, - u32 pm1a_cnt, u32 pm1b_cnt) -{ - struct xen_platform_op op = { - .cmd = XENPF_enter_acpi_sleep, - .interface_version = XENPF_INTERFACE_VERSION, - .u = { - .enter_acpi_sleep = { - .pm1a_cnt_val = (u16)pm1a_cnt, - .pm1b_cnt_val = (u16)pm1b_cnt, - .sleep_state = sleep_state, - }, - }, - }; - - return HYPERVISOR_platform_op(&op); -} #endif /* CONFIG_ACPI_PV_SLEEP */ diff -r dbe8a35dcaf7 -r ae505684a995 arch/i386/kernel/sysenter.c --- a/arch/i386/kernel/sysenter.c Mon Apr 14 13:29:37 2008 -0600 +++ b/arch/i386/kernel/sysenter.c Tue Apr 15 11:10:27 2008 -0600 @@ -109,11 +109,6 @@ int __init sysenter_setup(void) #ifdef CONFIG_COMPAT_VDSO __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY); printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO)); -#else - /* - * In the non-compat case the ELF coredumping code needs the fixmap: - */ - __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_KERNEL_RO); #endif if (!boot_cpu_has(X86_FEATURE_SEP)) { @@ -176,6 +171,13 @@ int arch_setup_additional_pages(struct l vma->vm_end = addr + PAGE_SIZE; /* MAYWRITE to allow gdb to COW and set breakpoints */ vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE; + /* + * Make sure the vDSO gets into every core dump. + * Dumping its contents makes post-mortem fully interpretable later + * without matching up the same kernel and hardware config to see + * what PC values meant. + */ + vma->vm_flags |= VM_ALWAYSDUMP; vma->vm_flags |= mm->def_flags; vma->vm_page_prot = protection_map[vma->vm_flags & 7]; vma->vm_ops = &syscall_vm_ops; diff -r dbe8a35dcaf7 -r ae505684a995 arch/powerpc/kernel/vdso.c --- a/arch/powerpc/kernel/vdso.c Mon Apr 14 13:29:37 2008 -0600 +++ b/arch/powerpc/kernel/vdso.c Tue Apr 15 11:10:27 2008 -0600 @@ -282,6 +282,13 @@ int arch_setup_additional_pages(struct l * pages though */ vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC; + /* + * Make sure the vDSO gets into every core dump. + * Dumping its contents makes post-mortem fully interpretable later + * without matching up the same kernel and hardware config to see + * what PC values meant. + */ + vma->vm_flags |= VM_ALWAYSDUMP; vma->vm_flags |= mm->def_flags; vma->vm_page_prot = protection_map[vma->vm_flags & 0x7]; vma->vm_ops = &vdso_vmops; diff -r dbe8a35dcaf7 -r ae505684a995 arch/x86_64/ia32/ia32_binfmt.c --- a/arch/x86_64/ia32/ia32_binfmt.c Mon Apr 14 13:29:37 2008 -0600 +++ b/arch/x86_64/ia32/ia32_binfmt.c Tue Apr 15 11:10:27 2008 -0600 @@ -64,55 +64,6 @@ typedef unsigned int elf_greg_t; #define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -/* - * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out - * extra segments containing the vsyscall DSO contents. Dumping its - * contents makes post-mortem fully interpretable later without matching up - * the same kernel and hardware config to see what PC values meant. - * Dumping its extra ELF program headers includes all the other information - * a debugger needs to easily find how the vsyscall DSO was being used. - */ -#define ELF_CORE_EXTRA_PHDRS (find_vma(current->mm, VSYSCALL32_BASE) ? \ - (VSYSCALL32_EHDR->e_phnum) : 0) -#define ELF_CORE_WRITE_EXTRA_PHDRS \ -do { \ - if (find_vma(current->mm, VSYSCALL32_BASE)) { \ - const struct elf32_phdr *const vsyscall_phdrs = \ - (const struct elf32_phdr *) (VSYSCALL32_BASE \ - + VSYSCALL32_EHDR->e_phoff);\ - int i; \ - Elf32_Off ofs = 0; \ - for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) { \ - struct elf32_phdr phdr = vsyscall_phdrs[i]; \ - if (phdr.p_type == PT_LOAD) { \ - BUG_ON(ofs != 0); \ - ofs = phdr.p_offset = offset; \ - phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \ - phdr.p_filesz = phdr.p_memsz; \ - offset += phdr.p_filesz; \ - } \ - else \ - phdr.p_offset += ofs; \ - phdr.p_paddr = 0; /* match other core phdrs */ \ - DUMP_WRITE(&phdr, sizeof(phdr)); \ - } \ - } \ -} while (0) -#define ELF_CORE_WRITE_EXTRA_DATA \ -do { \ - if (find_vma(current->mm, VSYSCALL32_BASE)) { \ - const struct elf32_phdr *const vsyscall_phdrs = \ - (const struct elf32_phdr *) (VSYSCALL32_BASE \ - + VSYSCALL32_EHDR->e_phoff); \ - int i; \ - for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) { \ - if (vsyscall_phdrs[i].p_type == PT_LOAD) \ - DUMP_WRITE((void *) (u64) vsyscall_phdrs[i].p_vaddr,\ - PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \ - } \ - } \ -} while (0) struct elf_siginfo { diff -r dbe8a35dcaf7 -r ae505684a995 arch/x86_64/ia32/syscall32.c --- a/arch/x86_64/ia32/syscall32.c Mon Apr 14 13:29:37 2008 -0600 +++ b/arch/x86_64/ia32/syscall32.c Tue Apr 15 11:10:27 2008 -0600 @@ -59,6 +59,13 @@ int syscall32_setup_pages(struct linux_b vma->vm_end = VSYSCALL32_END; /* MAYWRITE to allow gdb to COW and set breakpoints */ vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE; + /* + * Make sure the vDSO gets into every core dump. + * Dumping its contents makes post-mortem fully interpretable later + * without matching up the same kernel and hardware config to see + * what PC values meant. + */ + vma->vm_flags |= VM_ALWAYSDUMP; vma->vm_flags |= mm->def_flags; vma->vm_page_prot = protection_map[vma->vm_flags & 7]; vma->vm_ops = &syscall32_vm_ops; diff -r dbe8a35dcaf7 -r ae505684a995 arch/x86_64/kernel/acpi/sleep-xen.c --- a/arch/x86_64/kernel/acpi/sleep-xen.c Mon Apr 14 13:29:37 2008 -0600 +++ b/arch/x86_64/kernel/acpi/sleep-xen.c Tue Apr 15 11:10:27 2008 -0600 @@ -137,27 +137,6 @@ static int __init acpi_sleep_setup(char } __setup("acpi_sleep=", acpi_sleep_setup); - -#else /* CONFIG_ACPI_PV_SLEEP */ -#include -#include -int acpi_notify_hypervisor_state(u8 sleep_state, - u32 pm1a_cnt, u32 pm1b_cnt) -{ - struct xen_platform_op op = { - .cmd = XENPF_enter_acpi_sleep, - .interface_version = XENPF_INTERFACE_VERSION, - .u = { - .enter_acpi_sleep = { - .pm1a_cnt_val = (u16)pm1a_cnt, - .pm1b_cnt_val = (u16)pm1b_cnt, - .sleep_state = sleep_state, - }, - }, - }; - - return HYPERVISOR_platform_op(&op); -} #endif /* CONFIG_ACPI_PV_SLEEP */ #endif /*CONFIG_ACPI_SLEEP */ diff -r dbe8a35dcaf7 -r ae505684a995 drivers/acpi/hardware/hwsleep.c --- a/drivers/acpi/hardware/hwsleep.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/acpi/hardware/hwsleep.c Tue Apr 15 11:10:27 2008 -0600 @@ -227,7 +227,11 @@ acpi_status asmlinkage acpi_enter_sleep_ u32 PM1Bcontrol; struct acpi_bit_register_info *sleep_type_reg_info; struct acpi_bit_register_info *sleep_enable_reg_info; +#if !(defined(CONFIG_XEN) && defined(CONFIG_X86)) u32 in_value; +#else + int err; +#endif acpi_status status; ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); @@ -327,7 +331,7 @@ acpi_status asmlinkage acpi_enter_sleep_ ACPI_FLUSH_CPU_CACHE(); -#ifndef CONFIG_ACPI_PV_SLEEP +#if !(defined(CONFIG_XEN) && defined(CONFIG_X86)) status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); @@ -377,17 +381,18 @@ acpi_status asmlinkage acpi_enter_sleep_ /* Spin until we wake */ } while (!in_value); - - return_ACPI_STATUS(AE_OK); #else /* PV ACPI just need check hypercall return value */ - status = acpi_notify_hypervisor_state(sleep_state, + err = acpi_notify_hypervisor_state(sleep_state, PM1Acontrol, PM1Bcontrol); - if (ACPI_FAILURE(status)) - return_ACPI_STATUS(status); - else - return_ACPI_STATUS(AE_OK); + if (err) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Hypervisor failure [%d]\n", err)); + return_ACPI_STATUS(AE_ERROR); + } #endif + + return_ACPI_STATUS(AE_OK); } ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) diff -r dbe8a35dcaf7 -r ae505684a995 drivers/char/mem.c --- a/drivers/char/mem.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/char/mem.c Tue Apr 15 11:10:27 2008 -0600 @@ -264,6 +264,9 @@ static int mmap_kmem(struct file * file, static int mmap_kmem(struct file * file, struct vm_area_struct * vma) { unsigned long pfn; +#ifdef CONFIG_XEN + unsigned long i, count; +#endif /* Turn a kernel-virtual address into a physical page frame */ pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT; @@ -277,6 +280,13 @@ static int mmap_kmem(struct file * file, */ if (!pfn_valid(pfn)) return -EIO; + +#ifdef CONFIG_XEN + count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + for (i = 0; i < count; i++) + if ((pfn + i) != mfn_to_local_pfn(pfn_to_mfn(pfn + i))) + return -EIO; +#endif vma->vm_pgoff = pfn; return mmap_mem(file, vma); diff -r dbe8a35dcaf7 -r ae505684a995 drivers/pci/quirks.c --- a/drivers/pci/quirks.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/pci/quirks.c Tue Apr 15 11:10:27 2008 -0600 @@ -1528,10 +1528,11 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_N static void __devinit quirk_e100_interrupt(struct pci_dev *dev) { - u16 command; + u16 command, pmcsr; u32 bar; u8 __iomem *csr; u8 cmd_hi; + int pm; switch (dev->device) { /* PCI IDs taken from drivers/net/e100.c */ @@ -1566,6 +1567,17 @@ static void __devinit quirk_e100_interru if (!(command & PCI_COMMAND_MEMORY) || !bar) return; + /* + * Check that the device is in the D0 power state. If it's not, + * there is no point to look any further. + */ + pm = pci_find_capability(dev, PCI_CAP_ID_PM); + if (pm) { + pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr); + if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) + return; + } + csr = ioremap(bar, 8); if (!csr) { printk(KERN_WARNING "PCI: Can't map %s e100 registers\n", diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/balloon/balloon.c --- a/drivers/xen/balloon/balloon.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/balloon/balloon.c Tue Apr 15 11:10:27 2008 -0600 @@ -194,6 +194,41 @@ static unsigned long current_target(void return target; } +static unsigned long minimum_target(void) +{ +#ifndef CONFIG_XEN + return 0; +#else + unsigned long min_pages, curr_pages = current_target(); + +#define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) + /* Simple continuous piecewiese linear function: + * max MiB -> min MiB gradient + * 0 0 + * 16 16 + * 32 24 + * 128 72 (1/2) + * 512 168 (1/4) + * 2048 360 (1/8) + * 8192 552 (1/32) + * 32768 1320 + * 131072 4392 + */ + if (max_pfn < MB2PAGES(128)) + min_pages = MB2PAGES(8) + (max_pfn >> 1); + else if (max_pfn < MB2PAGES(512)) + min_pages = MB2PAGES(40) + (max_pfn >> 2); + else if (max_pfn < MB2PAGES(2048)) + min_pages = MB2PAGES(104) + (max_pfn >> 3); + else + min_pages = MB2PAGES(296) + (max_pfn >> 5); +#undef MB2PAGES + + /* Don't enforce growth */ + return min(min_pages, curr_pages); +#endif +} + static int increase_reservation(unsigned long nr_pages) { unsigned long pfn, i, flags; @@ -384,7 +419,7 @@ void balloon_set_new_target(unsigned lon { /* No need for lock. Not read-modify-write updates. */ bs.hard_limit = ~0UL; - bs.target_pages = target; + bs.target_pages = max(target, minimum_target()); schedule_work(&balloon_worker); } diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/blkback/common.h --- a/drivers/xen/blkback/common.h Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/blkback/common.h Tue Apr 15 11:10:27 2008 -0600 @@ -110,7 +110,7 @@ int blkif_map(blkif_t *blkif, unsigned l /* Create a vbd. */ int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, unsigned major, - unsigned minor, int readonly); + unsigned minor, int readonly, int cdrom); void vbd_free(struct vbd *vbd); unsigned long long vbd_size(struct vbd *vbd); diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/blkback/vbd.c --- a/drivers/xen/blkback/vbd.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/blkback/vbd.c Tue Apr 15 11:10:27 2008 -0600 @@ -51,7 +51,7 @@ unsigned long vbd_secsize(struct vbd *vb } int vbd_create(blkif_t *blkif, blkif_vdev_t handle, unsigned major, - unsigned minor, int readonly) + unsigned minor, int readonly, int cdrom) { struct vbd *vbd; struct block_device *bdev; @@ -81,7 +81,7 @@ int vbd_create(blkif_t *blkif, blkif_vde return -ENOENT; } - if (vbd->bdev->bd_disk->flags & GENHD_FL_CD) + if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) vbd->type |= VDISK_CDROM; if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE) vbd->type |= VDISK_REMOVABLE; diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/blkback/xenbus.c --- a/drivers/xen/blkback/xenbus.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/blkback/xenbus.c Tue Apr 15 11:10:27 2008 -0600 @@ -270,6 +270,8 @@ static void backend_changed(struct xenbu struct backend_info *be = container_of(watch, struct backend_info, backend_watch); struct xenbus_device *dev = be->dev; + int cdrom = 0; + char *device_type; DPRINTK(""); @@ -303,6 +305,12 @@ static void backend_changed(struct xenbu return; } + device_type = xenbus_read(XBT_NIL, dev->otherend, "device-type", NULL); + if (!IS_ERR(device_type)) { + cdrom = strcmp(device_type, "cdrom") == 0; + kfree(device_type); + } + if (be->major == 0 && be->minor == 0) { /* Front end dir is a number, which is used as the handle. */ @@ -313,7 +321,7 @@ static void backend_changed(struct xenbu be->minor = minor; err = vbd_create(be->blkif, handle, major, minor, - (NULL == strchr(be->mode, 'w'))); + (NULL == strchr(be->mode, 'w')), cdrom); if (err) { be->major = be->minor = 0; xenbus_dev_fatal(dev, err, "creating vbd structure"); diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/blktap/blktap.c Tue Apr 15 11:10:27 2008 -0600 @@ -684,7 +684,7 @@ static int blktap_mmap(struct file *filp /* Mark this VM as containing foreign pages, and set up mappings. */ map = kzalloc(((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) - * sizeof(struct page_struct*), + * sizeof(struct page *), GFP_KERNEL); if (map == NULL) { WPRINTK("Couldn't alloc VM_FOREIGN map.\n"); diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/evtchn/evtchn.c --- a/drivers/xen/evtchn/evtchn.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/evtchn/evtchn.c Tue Apr 15 11:10:27 2008 -0600 @@ -349,6 +349,7 @@ static long evtchn_ioctl(struct file *fi port_user[unbind.port] = NULL; mask_evtchn(unbind.port); + rebind_evtchn_to_cpu(unbind.port, 0); spin_unlock_irq(&port_user_lock); @@ -458,6 +459,7 @@ static int evtchn_release(struct inode * port_user[i] = NULL; mask_evtchn(i); + rebind_evtchn_to_cpu(i, 0); close.port = i; ret = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close); diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/gntdev/gntdev.c --- a/drivers/xen/gntdev/gntdev.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/gntdev/gntdev.c Tue Apr 15 11:10:27 2008 -0600 @@ -555,7 +555,7 @@ static int gntdev_mmap (struct file *fli /* The VM area contains pages from another VM. */ vma->vm_flags |= VM_FOREIGN; - vma->vm_private_data = kzalloc(size * sizeof(struct page_struct *), + vma->vm_private_data = kzalloc(size * sizeof(struct page *), GFP_KERNEL); if (vma->vm_private_data == NULL) { printk(KERN_ERR "Couldn't allocate mapping structure for VM " diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/netfront/netfront.c --- a/drivers/xen/netfront/netfront.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/netfront/netfront.c Tue Apr 15 11:10:27 2008 -0600 @@ -366,10 +366,14 @@ static int talk_to_backend(struct xenbus struct xenbus_transaction xbt; int err; - err = xen_net_read_mac(dev, info->mac); - if (err) { - xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename); - goto out; + /* Read mac only in the first setup. */ + if (!is_valid_ether_addr(info->mac)) { + err = xen_net_read_mac(dev, info->mac); + if (err) { + xenbus_dev_fatal(dev, err, "parsing %s/mac", + dev->nodename); + goto out; + } } /* Create shared ring, alloc event channel. */ @@ -1027,6 +1031,7 @@ static int network_start_xmit(struct sk_ np->stats.tx_bytes += skb->len; np->stats.tx_packets++; + dev->trans_start = jiffies; /* Note: It is not safe to access skb after network_tx_buf_gc()! */ network_tx_buf_gc(dev); @@ -1059,6 +1064,7 @@ static irqreturn_t netif_int(int irq, vo netfront_accelerator_call_stop_napi_irq(np, dev); netif_rx_schedule(dev); + dev->last_rx = jiffies; } } @@ -1688,6 +1694,23 @@ static struct net_device_stats *network_ return &np->stats; } +static int xennet_set_mac_address(struct net_device *dev, void *p) +{ + struct netfront_info *np = netdev_priv(dev); + struct sockaddr *addr = p; + + if (netif_running(dev)) + return -EBUSY; + + if (!is_valid_ether_addr(addr->sa_data)) + return -EADDRNOTAVAIL; + + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); + memcpy(np->mac, addr->sa_data, ETH_ALEN); + + return 0; +} + static int xennet_change_mtu(struct net_device *dev, int mtu) { int max = xennet_can_sg(dev) ? 65535 - ETH_HLEN : ETH_DATA_LEN; @@ -2075,6 +2098,7 @@ static struct net_device * __devinit cre netdev->poll = netif_poll; netdev->set_multicast_list = network_set_multicast_list; netdev->uninit = netif_uninit; + netdev->set_mac_address = xennet_set_mac_address; netdev->change_mtu = xennet_change_mtu; netdev->weight = 64; netdev->features = NETIF_F_IP_CSUM; @@ -2189,9 +2213,6 @@ static int __init netif_init(void) MODPARM_rx_flip = 1; /* Default is to flip. */ #endif - if (is_initial_xendomain()) - return 0; - netif_init_accel(); IPRINTK("Initialising virtual ethernet driver.\n"); @@ -2207,9 +2228,6 @@ module_init(netif_init); static void __exit netif_exit(void) { - if (is_initial_xendomain()) - return; - #ifdef CONFIG_INET unregister_inetaddr_notifier(¬ifier_inetdev); #endif diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/xenbus/xenbus_probe.c --- a/drivers/xen/xenbus/xenbus_probe.c Mon Apr 14 13:29:37 2008 -0600 +++ b/drivers/xen/xenbus/xenbus_probe.c Tue Apr 15 11:10:27 2008 -0600 @@ -347,6 +347,9 @@ static void xenbus_dev_shutdown(struct d DPRINTK("%s", dev->nodename); + if (is_initial_xendomain()) + return; + get_device(&dev->dev); if (dev->state != XenbusStateConnected) { printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__, diff -r dbe8a35dcaf7 -r ae505684a995 fs/binfmt_elf.c --- a/fs/binfmt_elf.c Mon Apr 14 13:29:37 2008 -0600 +++ b/fs/binfmt_elf.c Tue Apr 15 11:10:27 2008 -0600 @@ -1170,6 +1170,10 @@ static int dump_seek(struct file *file, */ static int maydump(struct vm_area_struct *vma) { + /* The vma can be set up to tell us the answer directly. */ + if (vma->vm_flags & VM_ALWAYSDUMP) + return 1; + /* Do not dump I/O mapped devices or special mappings */ if (vma->vm_flags & (VM_IO | VM_RESERVED)) return 0; diff -r dbe8a35dcaf7 -r ae505684a995 fs/compat_ioctl.c --- a/fs/compat_ioctl.c Mon Apr 14 13:29:37 2008 -0600 +++ b/fs/compat_ioctl.c Tue Apr 15 11:10:27 2008 -0600 @@ -124,10 +124,12 @@ #include #include +#ifdef CONFIG_XEN #include #include #include #include +#endif /* Aiee. Someone does not find a difference between int and long */ #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int) diff -r dbe8a35dcaf7 -r ae505684a995 include/asm-i386/acpi.h --- a/include/asm-i386/acpi.h Mon Apr 14 13:29:37 2008 -0600 +++ b/include/asm-i386/acpi.h Tue Apr 15 11:10:27 2008 -0600 @@ -31,6 +31,9 @@ #include #include /* defines cmpxchg */ +#ifdef CONFIG_XEN +#include +#endif #define COMPILER_DEPENDENT_INT64 long long #define COMPILER_DEPENDENT_UINT64 unsigned long long @@ -156,6 +159,27 @@ static inline void acpi_disable_pci(void } extern int acpi_irq_balance_set(char *str); +#ifdef CONFIG_XEN +static inline int acpi_notify_hypervisor_state(u8 sleep_state, + u32 pm1a_cnt_val, + u32 pm1b_cnt_val) +{ + struct xen_platform_op op = { + .cmd = XENPF_enter_acpi_sleep, + .interface_version = XENPF_INTERFACE_VERSION, + .u = { + .enter_acpi_sleep = { + .pm1a_cnt_val = pm1a_cnt_val, + .pm1b_cnt_val = pm1b_cnt_val, + .sleep_state = sleep_state, + }, + }, + }; + + return HYPERVISOR_platform_op(&op); +} +#endif /* CONFIG_XEN */ + #else /* !CONFIG_ACPI */ #define acpi_lapic 0 @@ -177,10 +201,6 @@ extern unsigned long acpi_wakeup_address /* early initialization routine */ extern void acpi_reserve_bootmem(void); -#ifdef CONFIG_ACPI_PV_SLEEP -extern int acpi_notify_hypervisor_state(u8 sleep_state, - u32 pm1a_cnt, u32 pm1b_cnt); -#endif /* CONFIG_ACPI_PV_SLEEP */ #endif /*CONFIG_ACPI_SLEEP*/ extern u8 x86_acpiid_to_apicid[]; diff -r dbe8a35dcaf7 -r ae505684a995 include/asm-i386/elf.h --- a/include/asm-i386/elf.h Mon Apr 14 13:29:37 2008 -0600 +++ b/include/asm-i386/elf.h Tue Apr 15 11:10:27 2008 -0600 @@ -169,50 +169,6 @@ do if (vdso_enabled) { \ NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE); \ } while (0) -/* - * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out - * extra segments containing the vsyscall DSO contents. Dumping its - * contents makes post-mortem fully interpretable later without matching up - * the same kernel and hardware config to see what PC values meant. - * Dumping its extra ELF program headers includes all the other information - * a debugger needs to easily find how the vsyscall DSO was being used. - */ -#define ELF_CORE_EXTRA_PHDRS (VDSO_HIGH_EHDR->e_phnum) -#define ELF_CORE_WRITE_EXTRA_PHDRS \ -do { \ - const struct elf_phdr *const vsyscall_phdrs = \ - (const struct elf_phdr *) (VDSO_HIGH_BASE \ - + VDSO_HIGH_EHDR->e_phoff); \ - int i; \ - Elf32_Off ofs = 0; \ - for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) { \ - struct elf_phdr phdr = vsyscall_phdrs[i]; \ - if (phdr.p_type == PT_LOAD) { \ - BUG_ON(ofs != 0); \ - ofs = phdr.p_offset = offset; \ - phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \ - phdr.p_filesz = phdr.p_memsz; \ - offset += phdr.p_filesz; \ - } \ - else \ - phdr.p_offset += ofs; \ - phdr.p_paddr = 0; /* match other core phdrs */ \ - DUMP_WRITE(&phdr, sizeof(phdr)); \ - } \ -} while (0) -#define ELF_CORE_WRITE_EXTRA_DATA \ -do { \ - const struct elf_phdr *const vsyscall_phdrs = \ - (const struct elf_phdr *) (VDSO_HIGH_BASE \ - + VDSO_HIGH_EHDR->e_phoff); \ - int i; \ - for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) { \ - if (vsyscall_phdrs[i].p_type == PT_LOAD) \ - DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \ - PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \ - } \ -} while (0) - #endif #endif diff -r dbe8a35dcaf7 -r ae505684a995 include/asm-i386/mach-xen/asm/pgtable.h --- a/include/asm-i386/mach-xen/asm/pgtable.h Mon Apr 14 13:29:37 2008 -0600 +++ b/include/asm-i386/mach-xen/asm/pgtable.h Tue Apr 15 11:10:27 2008 -0600 @@ -105,7 +105,7 @@ void paging_init(void); #define _PAGE_BIT_DIRTY 6 #define _PAGE_BIT_PSE 7 /* 4 MB (or 2MB) page, Pentium+, if present.. */ #define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ -#define _PAGE_BIT_UNUSED1 9 /* available for programmer */ +/*#define _PAGE_BIT_UNUSED1 9*/ /* available for programmer */ #define _PAGE_BIT_UNUSED2 10 #define _PAGE_BIT_UNUSED3 11 #define _PAGE_BIT_NX 63 @@ -119,7 +119,7 @@ void paging_init(void); #define _PAGE_DIRTY 0x040 #define _PAGE_PSE 0x080 /* 4 MB (or 2MB) page, Pentium+, if present.. */ #define _PAGE_GLOBAL 0x100 /* Global TLB entry PPro+ */ -#define _PAGE_UNUSED1 0x200 /* available for programmer */ +/*#define _PAGE_UNUSED1 0x200*/ /* available for programmer */ #define _PAGE_UNUSED2 0x400 #define _PAGE_UNUSED3 0x800 diff -r dbe8a35dcaf7 -r ae505684a995 include/asm-x86_64/acpi.h --- a/include/asm-x86_64/acpi.h Mon Apr 14 13:29:37 2008 -0600 +++ b/include/asm-x86_64/acpi.h Tue Apr 15 11:10:27 2008 -0600 @@ -28,6 +28,9 @@ #ifdef __KERNEL__ +#ifdef CONFIG_XEN +#include +#endif #include #define COMPILER_DEPENDENT_INT64 long long @@ -129,6 +132,27 @@ static inline void acpi_disable_pci(void } extern int acpi_irq_balance_set(char *str); +#ifdef CONFIG_XEN +static inline int acpi_notify_hypervisor_state(u8 sleep_state, + u32 pm1a_cnt_val, + u32 pm1b_cnt_val) +{ + struct xen_platform_op op = { + .cmd = XENPF_enter_acpi_sleep, + .interface_version = XENPF_INTERFACE_VERSION, + .u = { + .enter_acpi_sleep = { + .pm1a_cnt_val = pm1a_cnt_val, + .pm1b_cnt_val = pm1b_cnt_val, + .sleep_state = sleep_state, + }, + }, + }; + + return HYPERVISOR_platform_op(&op); +} +#endif /* CONFIG_XEN */ + #else /* !CONFIG_ACPI */ #define acpi_lapic 0 @@ -152,11 +176,6 @@ extern unsigned long acpi_wakeup_address /* early initialization routine */ extern void acpi_reserve_bootmem(void); - -#ifdef CONFIG_ACPI_PV_SLEEP -extern int acpi_notify_hypervisor_state(u8 sleep_state, - u32 pm1a_cnt, u32 pm1b_cnt); -#endif /* CONFIG_ACPI_PV_SLEEP */ #endif /*CONFIG_ACPI_SLEEP*/ #define boot_cpu_physical_apicid boot_cpu_id diff -r dbe8a35dcaf7 -r ae505684a995 include/linux/mm.h --- a/include/linux/mm.h Mon Apr 14 13:29:37 2008 -0600 +++ b/include/linux/mm.h Tue Apr 15 11:10:27 2008 -0600 @@ -167,6 +167,7 @@ extern unsigned int kobjsize(const void #ifdef CONFIG_XEN #define VM_FOREIGN 0x04000000 /* Has pages belonging to another VM */ #endif +#define VM_ALWAYSDUMP 0x08000000 /* Always include in core dumps */ #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:34 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:34 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTpK-0002Uv-6b for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:34 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTpy-0000CH-As; Tue, 20 May 2008 15:33:14 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToa-0007ZK-2h for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToO-0002zS-Hw for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:45 +0000 X-SBRS: 3.6 X-MesageID: 267649 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267649" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:30 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUUE9029615 for ; Tue, 20 May 2008 08:30:30 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUmEd000324 for ; Tue, 20 May 2008 08:30:48 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUmTA000323 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:48 -0700 Message-Id: <200805201530.m4KFUmTA000323@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:47 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Alex Williamson # Date 1209067734 21600 # Node ID 5d938fac27a2f7365f1cc0b28a0dcbe1af95b727 # Parent ae505684a995b9aa366fffc4d78cebfdf0552ddc # Parent 81c5a517a42b817378b63ced1420684e9bed1e21 merge with linux-2.6.18-xen.hg --- arch/i386/kernel/setup-xen.c | 27 ++++++++++++++++----------- arch/x86_64/kernel/e820-xen.c | 23 +++++++++++++++++++---- arch/x86_64/kernel/setup-xen.c | 12 +----------- 3 files changed, 36 insertions(+), 26 deletions(-) diff -r ae505684a995 -r 5d938fac27a2 arch/i386/kernel/setup-xen.c --- a/arch/i386/kernel/setup-xen.c Tue Apr 15 11:10:27 2008 -0600 +++ b/arch/i386/kernel/setup-xen.c Thu Apr 24 14:08:54 2008 -0600 @@ -736,6 +736,21 @@ int __init copy_e820_map(struct e820entr #endif add_memory_region(start, size, type); } while (biosmap++,--nr_map); + +#ifdef CONFIG_XEN + if (is_initial_xendomain()) { + struct xen_memory_map memmap; + + memmap.nr_entries = E820MAX; + set_xen_guest_handle(memmap.buffer, machine_e820.map); + + if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) + BUG(); + machine_e820.nr_map = memmap.nr_entries; + } else + machine_e820 = e820; +#endif + return 0; } @@ -1569,18 +1584,8 @@ static void __init register_memory(void) static void __init register_memory(void) { #ifdef CONFIG_XEN - if (is_initial_xendomain()) { - struct xen_memory_map memmap; - - memmap.nr_entries = E820MAX; - set_xen_guest_handle(memmap.buffer, machine_e820.map); - - if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) - BUG(); - - machine_e820.nr_map = memmap.nr_entries; + if (is_initial_xendomain()) e820_setup_gap(machine_e820.map, machine_e820.nr_map); - } else #endif e820_setup_gap(e820.map, e820.nr_map); diff -r ae505684a995 -r 5d938fac27a2 arch/x86_64/kernel/e820-xen.c --- a/arch/x86_64/kernel/e820-xen.c Tue Apr 15 11:10:27 2008 -0600 +++ b/arch/x86_64/kernel/e820-xen.c Thu Apr 24 14:08:54 2008 -0600 @@ -45,6 +45,10 @@ unsigned long end_user_pfn = MAXMEM>>PAG extern struct resource code_resource, data_resource; +#ifdef CONFIG_XEN +extern struct e820map machine_e820; +#endif + /* Check for some hardcoded bad areas that early boot is not allowed to touch */ static inline int bad_addr(unsigned long *addrp, unsigned long size) { @@ -109,8 +113,6 @@ int e820_any_mapped(unsigned long start, for (i = 0; i < e820.nr_map; i++) { struct e820entry *ei = &e820.map[i]; #else - extern struct e820map machine_e820; - if (!is_initial_xendomain()) return 0; for (i = 0; i < machine_e820.nr_map; i++) { @@ -141,8 +143,6 @@ int __init e820_all_mapped(unsigned long for (i = 0; i < e820.nr_map; i++) { struct e820entry *ei = &e820.map[i]; #else - extern struct e820map machine_e820; - if (!is_initial_xendomain()) return 0; for (i = 0; i < machine_e820.nr_map; i++) { @@ -604,6 +604,21 @@ static int __init copy_e820_map(struct e add_memory_region(start, size, type); } while (biosmap++,--nr_map); + +#ifdef CONFIG_XEN + if (is_initial_xendomain()) { + struct xen_memory_map memmap; + + memmap.nr_entries = E820MAX; + set_xen_guest_handle(memmap.buffer, machine_e820.map); + + if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) + BUG(); + machine_e820.nr_map = memmap.nr_entries; + } else + machine_e820 = e820; +#endif + return 0; } diff -r ae505684a995 -r 5d938fac27a2 arch/x86_64/kernel/setup-xen.c --- a/arch/x86_64/kernel/setup-xen.c Tue Apr 15 11:10:27 2008 -0600 +++ b/arch/x86_64/kernel/setup-xen.c Thu Apr 24 14:08:54 2008 -0600 @@ -903,18 +903,8 @@ void __init setup_arch(char **cmdline_p) */ probe_roms(); #ifdef CONFIG_XEN - if (is_initial_xendomain()) { - struct xen_memory_map memmap; - - memmap.nr_entries = E820MAX; - set_xen_guest_handle(memmap.buffer, machine_e820.map); - - if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap)) - BUG(); - machine_e820.nr_map = memmap.nr_entries; - + if (is_initial_xendomain()) e820_reserve_resources(machine_e820.map, machine_e820.nr_map); - } #else e820_reserve_resources(e820.map, e820.nr_map); #endif _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:41 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:41 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTpQ-0002Uy-4C for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:41 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTq4-0000GK-Bc; Tue, 20 May 2008 15:33:20 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyToi-0007f4-0W for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToR-0002zQ-IY for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:51 +0000 X-SBRS: 3.6 X-MesageID: 267650 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267650" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:32 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUWY8029618 for ; Tue, 20 May 2008 08:30:32 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUooA000359 for ; Tue, 20 May 2008 08:30:50 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUoO8000358 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:50 -0700 Message-Id: <200805201530.m4KFUoO8000358@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:49 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210642684 -32400 # Node ID f6fcc65413aee0da4b6b1df03a876342fd526667 # Parent 5d938fac27a2f7365f1cc0b28a0dcbe1af95b727 # Parent 05b7df5cc607bf5b00725232085c35e5b6d493fe merge with linux-2.6.18-xen.hg --- arch/i386/kernel/acpi/Makefile | 1 arch/i386/kernel/acpi/processor.c | 11 arch/i386/kernel/acpi/processor_extcntl_xen.c | 142 ++++ arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | 11 arch/x86_64/kernel/acpi/Makefile | 2 buildconfigs/linux-defconfig_xen0_x86_32 | 1 buildconfigs/linux-defconfig_xen0_x86_64 | 1 buildconfigs/linux-defconfig_xen_x86_32 | 1 buildconfigs/linux-defconfig_xen_x86_64 | 1 drivers/acpi/Kconfig | 6 drivers/acpi/Makefile | 3 drivers/acpi/processor_core.c | 70 ++ drivers/acpi/processor_extcntl.c | 137 ++++ drivers/acpi/processor_idle.c | 44 + drivers/acpi/processor_perflib.c | 5 drivers/pci/Kconfig | 1 drivers/pci/msi-xen.c | 709 ++++++++++++++++++++++++ drivers/pci/msi.h | 5 drivers/xen/core/evtchn.c | 5 drivers/xen/pciback/Makefile | 1 drivers/xen/pciback/conf_space_capability_msi.c | 60 ++ drivers/xen/pciback/pci_stub.c | 24 drivers/xen/pciback/pciback.h | 14 drivers/xen/pciback/pciback_ops.c | 38 + drivers/xen/pcifront/pci_op.c | 116 +++ drivers/xen/privcmd/privcmd.c | 2 include/acpi/processor.h | 97 +++ include/asm-i386/io_apic.h | 2 include/asm-x86_64/io_apic.h | 2 include/asm-x86_64/msi.h | 9 include/linux/pci.h | 3 include/xen/evtchn.h | 14 include/xen/interface/arch-ia64.h | 59 - include/xen/interface/arch-ia64/hvm/memmap.h | 88 ++ include/xen/interface/arch-ia64/sioemu.h | 53 + include/xen/interface/arch-x86/xen-x86_32.h | 7 include/xen/interface/domctl.h | 23 include/xen/interface/hvm/hvm_op.h | 16 include/xen/interface/hvm/params.h | 8 include/xen/interface/io/protocols.h | 3 include/xen/interface/io/xs_wire.h | 1 include/xen/interface/libelf.h | 4 include/xen/interface/physdev.h | 32 + include/xen/interface/platform.h | 65 ++ include/xen/interface/sysctl.h | 11 include/xen/interface/xen.h | 2 include/xen/interface/xsm/acm.h | 8 47 files changed, 1829 insertions(+), 89 deletions(-) diff -r 5d938fac27a2 -r f6fcc65413ae arch/i386/kernel/acpi/Makefile --- a/arch/i386/kernel/acpi/Makefile Thu Apr 24 14:08:54 2008 -0600 +++ b/arch/i386/kernel/acpi/Makefile Tue May 13 10:38:04 2008 +0900 @@ -4,6 +4,7 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wake ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += cstate.o processor.o +obj-$(CONFIG_XEN) += processor_extcntl_xen.o endif disabled-obj-$(CONFIG_XEN) := cstate.o wakeup.o diff -r 5d938fac27a2 -r f6fcc65413ae arch/i386/kernel/acpi/processor.c --- a/arch/i386/kernel/acpi/processor.c Thu Apr 24 14:08:54 2008 -0600 +++ b/arch/i386/kernel/acpi/processor.c Tue May 13 10:38:04 2008 +0900 @@ -62,7 +62,18 @@ static void init_intel_pdc(struct acpi_p /* Initialize _PDC data based on the CPU vendor */ void arch_acpi_processor_init_pdc(struct acpi_processor *pr) { +#ifdef CONFIG_XEN + /* + * As a work-around, just use cpu0's cpuinfo for all processors. + * Further work is required to expose xen hypervisor interface of + * getting physical cpuinfo to dom0 kernel and then + * arch_acpi_processor_init_pdc can set _PDC parameters according + * to Xen's phys information. + */ + unsigned int cpu = 0; +#else unsigned int cpu = pr->id; +#endif /* CONFIG_XEN */ struct cpuinfo_x86 *c = cpu_data + cpu; pr->pdc = NULL; diff -r 5d938fac27a2 -r f6fcc65413ae arch/i386/kernel/acpi/processor_extcntl_xen.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c Tue May 13 10:38:04 2008 +0900 @@ -0,0 +1,142 @@ +/* + * processor_extcntl_xen.c - interface to notify Xen + * + * Copyright (C) 2008, Intel corporation + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +static int xen_processor_pmbits; +static int __init set_xen_processor_pmbits(char *str) +{ + get_option(&str, &xen_processor_pmbits); + + return 1; +} +__setup("xen_processor_pmbits=", set_xen_processor_pmbits); +EXPORT_SYMBOL(xen_processor_pmbits); + +static int xen_cx_notifier(struct acpi_processor *pr, int action) +{ + int ret, count = 0, i; + xen_platform_op_t op = { + .cmd = XENPF_set_processor_pminfo, + .interface_version = XENPF_INTERFACE_VERSION, + .u.set_pminfo.id = pr->acpi_id, + .u.set_pminfo.type = XEN_PM_CX, + }; + struct xen_processor_cx *data, *buf; + struct acpi_processor_cx *cx; + + if (action == PROCESSOR_PM_CHANGE) + return -EINVAL; + + /* Convert to Xen defined structure and hypercall */ + buf = kzalloc(pr->power.count * sizeof(struct xen_processor_cx), + GFP_KERNEL); + if (!buf) + return -ENOMEM; + + data = buf; + for (i = 1; i <= pr->power.count; i++) { + cx = &pr->power.states[i]; + /* Skip invalid cstate entry */ + if (!cx->valid) + continue; + + data->type = cx->type; + data->latency = cx->latency; + data->power = cx->power; + data->reg.space_id = cx->reg.space_id; + data->reg.bit_width = cx->reg.bit_width; + data->reg.bit_offset = cx->reg.bit_offset; + data->reg.access_size = cx->reg.reserved; + data->reg.address = cx->reg.address; + + /* Get dependency relationships */ + if (cx->csd_count) { + printk("Wow! _CSD is found. Not support for now!\n"); + kfree(buf); + return -EINVAL; + } else { + data->dpcnt = 0; + set_xen_guest_handle(data->dp, NULL); + } + + data++; + count++; + } + + if (!count) { + printk("No available Cx info for cpu %d\n", pr->acpi_id); + kfree(buf); + return -EINVAL; + } + + op.u.set_pminfo.power.count = count; + op.u.set_pminfo.power.flags.bm_control = pr->flags.bm_control; + op.u.set_pminfo.power.flags.bm_check = pr->flags.bm_check; + op.u.set_pminfo.power.flags.has_cst = pr->flags.has_cst; + op.u.set_pminfo.power.flags.power_setup_done = pr->flags.power_setup_done; + + set_xen_guest_handle(op.u.set_pminfo.power.states, buf); + ret = HYPERVISOR_platform_op(&op); + kfree(buf); + return ret; +} + +static int xen_px_notifier(struct acpi_processor *pr, int action) +{ + return -EINVAL; +} + +static int xen_tx_notifier(struct acpi_processor *pr, int action) +{ + return -EINVAL; +} +static int xen_hotplug_notifier(struct acpi_processor *pr, int event) +{ + return -EINVAL; +} + +static struct processor_extcntl_ops xen_extcntl_ops = { + .hotplug = xen_hotplug_notifier, +}; + +static int __cpuinit xen_init_processor_extcntl(void) +{ + if (xen_processor_pmbits & XEN_PROCESSOR_PM_CX) + xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier; + if (xen_processor_pmbits & XEN_PROCESSOR_PM_PX) + xen_extcntl_ops.pm_ops[PM_TYPE_PERF] = xen_px_notifier; + if (xen_processor_pmbits & XEN_PROCESSOR_PM_TX) + xen_extcntl_ops.pm_ops[PM_TYPE_THR] = xen_tx_notifier; + + return processor_register_extcntl(&xen_extcntl_ops); +} +core_initcall(xen_init_processor_extcntl); diff -r 5d938fac27a2 -r f6fcc65413ae arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c Thu Apr 24 14:08:54 2008 -0600 +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c Tue May 13 10:38:04 2008 +0900 @@ -568,6 +568,17 @@ acpi_cpufreq_init (void) { dprintk("acpi_cpufreq_init\n"); +#ifdef CONFIG_XEN + /* + * This effectively blocks in-kernel cpufreq driver to interfere + * external control logic + */ + if (processor_pmperf_external()) { + printk("CPUFREQ is controllerd externally...exit then!\n"); + return -1; + } +#endif /* CONFIG_XEN */ + acpi_cpufreq_early_init_acpi(); return cpufreq_register_driver(&acpi_cpufreq_driver); diff -r 5d938fac27a2 -r f6fcc65413ae arch/x86_64/kernel/acpi/Makefile --- a/arch/x86_64/kernel/acpi/Makefile Thu Apr 24 14:08:54 2008 -0600 +++ b/arch/x86_64/kernel/acpi/Makefile Tue May 13 10:38:04 2008 +0900 @@ -8,4 +8,6 @@ processor-$(CONFIG_XEN) := ../../../i386 processor-$(CONFIG_XEN) := ../../../i386/kernel/acpi/processor.o endif +obj-$(CONFIG_XEN) += processor_extcnt_xen.o +processor_extcnt_xen-$(CONFIG_XEN) := ../../../i386/kernel/acpi/processor_extcntl_xen.o disabled-obj-$(CONFIG_XEN) := wakeup.o diff -r 5d938fac27a2 -r f6fcc65413ae buildconfigs/linux-defconfig_xen0_x86_32 --- a/buildconfigs/linux-defconfig_xen0_x86_32 Thu Apr 24 14:08:54 2008 -0600 +++ b/buildconfigs/linux-defconfig_xen0_x86_32 Tue May 13 10:38:04 2008 +0900 @@ -248,6 +248,7 @@ CONFIG_XEN_PCIDEV_FRONTEND=y CONFIG_XEN_PCIDEV_FRONTEND=y # CONFIG_XEN_PCIDEV_FE_DEBUG is not set # CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_MSI is not set # CONFIG_PCI_DEBUG is not set CONFIG_ISA_DMA_API=y # CONFIG_SCx200 is not set diff -r 5d938fac27a2 -r f6fcc65413ae buildconfigs/linux-defconfig_xen0_x86_64 --- a/buildconfigs/linux-defconfig_xen0_x86_64 Thu Apr 24 14:08:54 2008 -0600 +++ b/buildconfigs/linux-defconfig_xen0_x86_64 Tue May 13 10:38:04 2008 +0900 @@ -204,6 +204,7 @@ CONFIG_XEN_PCIDEV_FRONTEND=y CONFIG_XEN_PCIDEV_FRONTEND=y # CONFIG_XEN_PCIDEV_FE_DEBUG is not set # CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_MSI is not set # CONFIG_PCI_DEBUG is not set # diff -r 5d938fac27a2 -r f6fcc65413ae buildconfigs/linux-defconfig_xen_x86_32 --- a/buildconfigs/linux-defconfig_xen_x86_32 Thu Apr 24 14:08:54 2008 -0600 +++ b/buildconfigs/linux-defconfig_xen_x86_32 Tue May 13 10:38:04 2008 +0900 @@ -254,6 +254,7 @@ CONFIG_XEN_PCIDEV_FRONTEND=y CONFIG_XEN_PCIDEV_FRONTEND=y # CONFIG_XEN_PCIDEV_FE_DEBUG is not set # CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_MSI is not set # CONFIG_PCI_DEBUG is not set CONFIG_ISA_DMA_API=y CONFIG_SCx200=m diff -r 5d938fac27a2 -r f6fcc65413ae buildconfigs/linux-defconfig_xen_x86_64 --- a/buildconfigs/linux-defconfig_xen_x86_64 Thu Apr 24 14:08:54 2008 -0600 +++ b/buildconfigs/linux-defconfig_xen_x86_64 Tue May 13 10:38:04 2008 +0900 @@ -209,6 +209,7 @@ CONFIG_XEN_PCIDEV_FRONTEND=y CONFIG_XEN_PCIDEV_FRONTEND=y # CONFIG_XEN_PCIDEV_FE_DEBUG is not set # CONFIG_PCIEPORTBUS is not set +# CONFIG_PCI_MSI is not set # CONFIG_PCI_DEBUG is not set # diff -r 5d938fac27a2 -r f6fcc65413ae drivers/acpi/Kconfig --- a/drivers/acpi/Kconfig Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/acpi/Kconfig Tue May 13 10:38:04 2008 +0900 @@ -367,6 +367,12 @@ config ACPI_PV_SLEEP bool depends on X86 && XEN && ACPI_SLEEP default y + +config PROCESSOR_EXTERNAL_CONTROL + bool + depends on X86 && XEN + select ACPI_PROCESSOR + default y endif # ACPI endmenu diff -r 5d938fac27a2 -r f6fcc65413ae drivers/acpi/Makefile --- a/drivers/acpi/Makefile Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/acpi/Makefile Tue May 13 10:38:04 2008 +0900 @@ -34,6 +34,9 @@ ifdef CONFIG_CPU_FREQ ifdef CONFIG_CPU_FREQ processor-objs += processor_perflib.o endif +ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL +processor-objs += processor_extcntl.o +endif obj-y += sleep/ obj-y += bus.o glue.o diff -r 5d938fac27a2 -r f6fcc65413ae drivers/acpi/processor_core.c --- a/drivers/acpi/processor_core.c Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/acpi/processor_core.c Tue May 13 10:38:04 2008 +0900 @@ -474,8 +474,14 @@ static int acpi_processor_get_info(struc * they are physically not present. */ if (cpu_index == -1) { +#ifdef CONFIG_XEN + if (ACPI_FAILURE + (acpi_processor_hotadd_init(pr->handle, &pr->id)) && + !processor_cntl_external()) { +#else if (ACPI_FAILURE (acpi_processor_hotadd_init(pr->handle, &pr->id))) { +#endif /* CONFIG_XEN */ printk(KERN_ERR PREFIX "Getting cpuindex for acpiid 0x%x\n", pr->acpi_id); @@ -517,7 +523,11 @@ static int acpi_processor_get_info(struc return 0; } +#ifdef CONFIG_XEN +static void *processor_device_array[NR_ACPI_CPUS]; +#else static void *processor_device_array[NR_CPUS]; +#endif /* CONFIG_XEN */ static int acpi_processor_start(struct acpi_device *device) { @@ -529,27 +539,48 @@ static int acpi_processor_start(struct a pr = acpi_driver_data(device); result = acpi_processor_get_info(pr); +#ifdef CONFIG_XEN + if (result || + ((pr->id == -1) && !processor_cntl_external())) { +#else if (result) { +#endif /* CONFIG_XEN */ /* Processor is physically not present */ return 0; } +#ifdef CONFIG_XEN + BUG_ON(!processor_cntl_external() && + ((pr->id >= NR_CPUS) || (pr->id < 0))); +#else BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); +#endif /* CONFIG_XEN */ /* * Buggy BIOS check * ACPI id of processors can be reported wrongly by the BIOS. * Don't trust it blindly */ +#ifdef CONFIG_XEN + if (processor_device_array[pr->acpi_id] != NULL && + processor_device_array[pr->acpi_id] != (void *)device) { +#else if (processor_device_array[pr->id] != NULL && processor_device_array[pr->id] != (void *)device) { +#endif /* CONFIG_XEN */ printk(KERN_WARNING "BIOS reported wrong ACPI id" "for the processor\n"); return -ENODEV; } +#ifdef CONFIG_XEN + processor_device_array[pr->acpi_id] = (void *)device; + if (pr->id != -1) + processors[pr->id] = pr; +#else processor_device_array[pr->id] = (void *)device; processors[pr->id] = pr; +#endif /* CONFIG_XEN */ result = acpi_processor_add_fs(device); if (result) @@ -563,6 +594,10 @@ static int acpi_processor_start(struct a acpi_processor_set_pdc(pr); acpi_processor_power_init(pr, device); + +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL + processor_extcntl_init(pr); +#endif if (pr->flags.throttling) { printk(KERN_INFO PREFIX "%s [%s] (supports", @@ -656,7 +691,13 @@ static int acpi_processor_remove(struct acpi_processor_remove_fs(device); +#ifdef CONFIG_XEN + if (pr->id != -1) + processors[pr->id] = NULL; +#else processors[pr->id] = NULL; +#endif /* CONFIG_XEN */ + kfree(pr); @@ -709,6 +750,12 @@ int acpi_processor_device_add(acpi_handl pr = acpi_driver_data(*device); if (!pr) return -ENODEV; + +#ifdef CONFIG_XEN + if (processor_cntl_external()) + processor_notify_external(pr, + PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD); +#endif /* CONFIG_XEN */ if ((pr->id >= 0) && (pr->id < NR_CPUS)) { kobject_uevent(&(*device)->kobj, KOBJ_ONLINE); @@ -747,6 +794,12 @@ acpi_processor_hotplug_notify(acpi_handl printk(KERN_ERR PREFIX "Driver data is NULL\n"); break; } + +#ifdef CONFIG_XEN + if (processor_cntl_external()) + processor_notify_external(pr, + PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD); +#endif /* CONFIG_XEN */ if (pr->id >= 0 && (pr->id < NR_CPUS)) { kobject_uevent(&device->kobj, KOBJ_OFFLINE); @@ -777,8 +830,20 @@ acpi_processor_hotplug_notify(acpi_handl return; } +#ifdef CONFIG_XEN + if ((pr->id >= 0) && (pr->id < NR_CPUS) + && (cpu_present(pr->id))) +#else if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) +#endif /* CONFIG_XEN */ kobject_uevent(&device->kobj, KOBJ_OFFLINE); + +#ifdef CONFIG_XEN + if (processor_cntl_external()) + processor_notify_external(pr, PROCESSOR_HOTPLUG, + HOTPLUG_TYPE_REMOVE); +#endif /* CONFIG_XEN */ + break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, @@ -843,6 +908,11 @@ static acpi_status acpi_processor_hotadd static int acpi_processor_handle_eject(struct acpi_processor *pr) { +#ifdef CONFIG_XEN + if (pr->id == -1) + return (0); +#endif /* CONFIG_XEN */ + if (cpu_online(pr->id)) { return (-EINVAL); } diff -r 5d938fac27a2 -r f6fcc65413ae drivers/acpi/processor_extcntl.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/acpi/processor_extcntl.c Tue May 13 10:38:04 2008 +0900 @@ -0,0 +1,137 @@ +/* + * processor_extcntl.c - channel to external control logic + * + * Copyright (C) 2008, Intel corporation + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include + +static int processor_extcntl_parse_csd(struct acpi_processor *pr); +/* + * External processor control logic may register with its own set of + * ops to get ACPI related notification. One example is like VMM. + */ +struct processor_extcntl_ops *processor_extcntl_ops; + +int processor_notify_external(struct acpi_processor *pr, int event, int type) +{ + int ret = -EINVAL; + + if (!processor_cntl_external()) + return -EINVAL; + + switch (event) { + case PROCESSOR_PM_INIT: + case PROCESSOR_PM_CHANGE: + if ((type >= PM_TYPE_MAX) || + !processor_extcntl_ops->pm_ops[type]) + break; + + ret = processor_extcntl_ops->pm_ops[type](pr, event); + break; + case PROCESSOR_HOTPLUG: + if (processor_extcntl_ops->hotplug) + ret = processor_extcntl_ops->hotplug(pr, type); + break; + default: + printk(KERN_ERR "Unsupport processor events %d.\n", event); + break; + } + + return ret; +} + +/* + * External control logic can decide to grab full or part of physical + * processor control bits. Take a VMM for example, physical processors + * are owned by VMM and thus existence information like hotplug is + * always required to be notified to VMM. Similar is processor idle + * state which is also necessarily controlled by VMM. But for other + * control bits like performance/throttle states, VMM may choose to + * control or not upon its own policy. + * + * Such ownership is unlikely to be switched in the fly, and thus + * not sure unregister interface is required or not. Being same reason, + * lock is not forced now. + */ +int processor_register_extcntl(struct processor_extcntl_ops *ops) +{ + if (!ops) + return -EINVAL; + + if (processor_extcntl_ops && + (processor_extcntl_ops != ops)) + return -EBUSY; + + processor_extcntl_ops = ops; + return 0; +} + +int processor_unregister_extcntl(struct processor_extcntl_ops *ops) +{ + if (processor_extcntl_ops == ops) + processor_extcntl_ops = NULL; + + return 0; +} + +/* + * This is called from ACPI processor init, and targeted to hold + * some tricky housekeeping jobs to satisfy external control model. + * For example, we may put dependency parse stub here for idle + * and performance state. Those information may be not available + * if splitting from dom0 control logic like cpufreq driver. + */ +int processor_extcntl_init(struct acpi_processor *pr) +{ + /* parse cstate dependency information */ + processor_extcntl_parse_csd(pr); + + return 0; +} + +/* + * Currently no _CSD is implemented which is why existing ACPI code + * doesn't parse _CSD at all. But to keep interface complete with + * external control logic, we put a placeholder here for future + * compatibility. + */ +static int processor_extcntl_parse_csd(struct acpi_processor *pr) +{ + int i; + + for (i = 0; i < pr->power.count; i++) { + if (!pr->power.states[i].valid) + continue; + + /* No dependency by default */ + pr->power.states[i].domain_info = NULL; + pr->power.states[i].csd_count = 0; + } + + return 0; +} diff -r 5d938fac27a2 -r f6fcc65413ae drivers/acpi/processor_idle.c --- a/drivers/acpi/processor_idle.c Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/acpi/processor_idle.c Tue May 13 10:38:04 2008 +0900 @@ -714,8 +714,17 @@ static int acpi_processor_get_power_info (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) continue; +#ifdef CONFIG_XEN + if (!processor_pm_external()) + cx.address = (reg->space_id == + ACPI_ADR_SPACE_FIXED_HARDWARE) ? + 0 : reg->address; + else + cx.address = reg->address; +#else cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? 0 : reg->address; +#endif /* CONFIG_XEN */ /* There should be an easy way to extract an integer... */ obj = (union acpi_object *)&(element->package.elements[1]); @@ -724,9 +733,17 @@ static int acpi_processor_get_power_info cx.type = obj->integer.value; +#ifdef CONFIG_XEN + /* Following check doesn't apply to external control case */ + if (!processor_pm_external()) + if ((cx.type != ACPI_STATE_C1) && + (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) + continue; +#else if ((cx.type != ACPI_STATE_C1) && (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) continue; +#endif /* CONFIG_XEN */ if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3)) continue; @@ -742,6 +759,12 @@ static int acpi_processor_get_power_info continue; cx.power = obj->integer.value; + +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL + /* cache control methods to notify external logic */ + if (processor_pm_external()) + memcpy(&cx.reg, reg, sizeof(*reg)); +#endif current_count++; memcpy(&(pr->power.states[current_count]), &cx, sizeof(cx)); @@ -985,12 +1008,24 @@ int acpi_processor_cst_has_changed(struc return -ENODEV; /* Fall back to the default idle loop */ +#ifdef CONFIG_XEN + if (!processor_pm_external()) + pm_idle = pm_idle_save; +#else pm_idle = pm_idle_save; +#endif /* CONFIG_XEN */ synchronize_sched(); /* Relies on interrupts forcing exit from idle. */ pr->flags.power = 0; result = acpi_processor_get_power_info(pr); +#ifdef CONFIG_XEN + if (processor_pm_external()) + processor_notify_external(pr, + PROCESSOR_PM_CHANGE, PM_TYPE_IDLE); + else if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) +#else if ((pr->flags.power == 1) && (pr->flags.power_setup_done)) +#endif /* CONFIG_XEN */ pm_idle = acpi_processor_idle; return result; @@ -1122,7 +1157,11 @@ int acpi_processor_power_init(struct acp pr->power.states[i].type); printk(")\n"); +#ifdef CONFIG_XEN + if (!processor_pm_external() && (pr->id == 0)) { +#else if (pr->id == 0) { +#endif /* CONFIG_XEN */ pm_idle_save = pm_idle; pm_idle = acpi_processor_idle; } @@ -1141,6 +1180,11 @@ int acpi_processor_power_init(struct acp pr->flags.power_setup_done = 1; +#ifdef CONFIG_XEN + if (processor_pm_external()) + processor_notify_external(pr, + PROCESSOR_PM_INIT, PM_TYPE_IDLE); +#endif /* CONFIG_XEN */ return 0; } diff -r 5d938fac27a2 -r f6fcc65413ae drivers/acpi/processor_perflib.c --- a/drivers/acpi/processor_perflib.c Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/acpi/processor_perflib.c Tue May 13 10:38:04 2008 +0900 @@ -136,6 +136,11 @@ int acpi_processor_ppc_has_changed(struc int ret = acpi_processor_get_platform_limit(pr); if (ret < 0) return (ret); +#ifdef CONFIG_XEN + else if (processor_pmperf_external()) + return processor_notify_external(pr, + PROCESSOR_PM_CHANGE, PM_TYPE_PERF); +#endif /* CONFIG_XEN */ else return cpufreq_update_policy(pr->id); } diff -r 5d938fac27a2 -r f6fcc65413ae drivers/pci/Kconfig --- a/drivers/pci/Kconfig Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/pci/Kconfig Tue May 13 10:38:04 2008 +0900 @@ -5,7 +5,6 @@ config PCI_MSI bool "Message Signaled Interrupts (MSI and MSI-X)" depends on PCI depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64 - depends on !XEN help This allows device drivers to enable MSI (Message Signaled Interrupts). Message Signaled Interrupts enable a device to diff -r 5d938fac27a2 -r f6fcc65413ae drivers/pci/msi-xen.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/pci/msi-xen.c Tue May 13 10:38:04 2008 +0900 @@ -0,0 +1,709 @@ +/* + * File: msi.c + * Purpose: PCI Message Signaled Interrupt (MSI) + * + * Copyright (C) 2003-2004 Intel + * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com) + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "pci.h" +#include "msi.h" + +static int pci_msi_enable = 1; + +static struct msi_ops *msi_ops; + +int msi_register(struct msi_ops *ops) +{ + msi_ops = ops; + return 0; +} + +static struct list_head msi_dev_head; +static int msi_dev_head_inited = 0; +DEFINE_SPINLOCK(msi_dev_lock); + +struct msi_dev_list { + struct pci_dev *dev; + struct list_head list; + spinlock_t pirq_list_lock; + struct list_head pirq_list_head; +}; + +struct msi_pirq_entry { + struct list_head list; + int pirq; + int entry_nr; +}; + +static struct msi_dev_list *get_msi_dev_pirq_list(struct pci_dev *dev) +{ + struct msi_dev_list *msi_dev_list, *ret = NULL; + unsigned long flags; + + if (!msi_dev_head_inited) { + INIT_LIST_HEAD(&msi_dev_head); + msi_dev_head_inited = 1; + } + + spin_lock_irqsave(&msi_dev_lock, flags); + + list_for_each_entry(msi_dev_list, &msi_dev_head, list) + if ( msi_dev_list->dev == dev ) + ret = msi_dev_list; + + if ( ret ) { + spin_unlock_irqrestore(&msi_dev_lock, flags); + return ret; + } + + /* Has not allocate msi_dev until now. */ + ret = kmalloc(sizeof(struct msi_dev_list), GFP_ATOMIC); + + /* Failed to allocate msi_dev structure */ + if ( !ret ) { + spin_unlock_irqrestore(&msi_dev_lock, flags); + return NULL; + } + + list_add_tail(&ret->list, &msi_dev_head); + spin_unlock_irqrestore(&msi_dev_lock, flags); + spin_lock_init(&ret->pirq_list_lock); + INIT_LIST_HEAD(&ret->pirq_list_head); + return ret; +} + +static int attach_pirq_entry(int pirq, int entry_nr, + struct msi_dev_list *msi_dev_entry) +{ + struct msi_pirq_entry *entry = kmalloc(sizeof(*entry), GFP_ATOMIC); + unsigned long flags; + + if (!entry) + return -ENOMEM; + entry->pirq = pirq; + entry->entry_nr = entry_nr; + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + list_add_tail(&entry->list, &msi_dev_entry->pirq_list_head); + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + return 0; +} + +/* + * pciback will provide device's owner + */ +int (*get_owner)(struct pci_dev *dev); + +int register_msi_get_owner(int (*func)(struct pci_dev *dev)) +{ + if (get_owner) { + printk(KERN_WARNING "register msi_get_owner again\n"); + return -EEXIST; + } + get_owner = func; + return 0; +} + +int unregister_msi_get_owner(int (*func)(struct pci_dev *dev)) +{ + if (get_owner == func) + get_owner = NULL; + return 0; +} + +static int msi_get_dev_owner(struct pci_dev *dev) +{ + int owner = DOMID_SELF; + + BUG_ON(!is_initial_xendomain()); + if (get_owner && (owner = get_owner(dev)) >=0 ) { + printk(KERN_INFO "get owner for dev %x get %x \n", + dev->devfn, owner); + return owner; + } + else + return DOMID_SELF; +} + +static int msi_unmap_pirq(struct pci_dev *dev, int pirq) +{ + struct physdev_unmap_pirq unmap; + int rc; + domid_t domid = DOMID_SELF; + + domid = msi_get_dev_owner(dev); + unmap.domid = domid; + unmap.pirq = pirq; + + if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_unmap_pirq, &unmap))) + printk(KERN_WARNING "unmap irq %x failed\n", pirq); + + if (rc < 0) + return rc; + return 0; +} + +/* + * Protected by msi_lock + */ +static int msi_map_pirq_to_vector(struct pci_dev *dev, int pirq, + int entry_nr, int msi) +{ + struct physdev_map_pirq map_irq; + int rc; + domid_t domid = DOMID_SELF; + + domid = msi_get_dev_owner(dev); + + map_irq.domid = domid; + map_irq.type = MAP_PIRQ_TYPE_MSI; + map_irq.index = -1; + map_irq.pirq = pirq; + map_irq.msi_info.bus = dev->bus->number; + map_irq.msi_info.devfn = dev->devfn; + map_irq.msi_info.entry_nr = entry_nr; + map_irq.msi_info.msi = msi; + + if ((rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq))) + printk(KERN_WARNING "map irq failed\n"); + + if (rc < 0) + return rc; + + return map_irq.pirq; +} + +static int msi_map_vector(struct pci_dev *dev, int entry_nr, int msi) +{ + return msi_map_pirq_to_vector(dev, -1, entry_nr, msi); +} + +static int msi_init(void) +{ + static int status = 0; + + if (pci_msi_quirk) { + pci_msi_enable = 0; + printk(KERN_WARNING "PCI: MSI quirk detected. MSI disabled.\n"); + status = -EINVAL; + } + + return status; +} + +void pci_scan_msi_device(struct pci_dev *dev) { } + +void disable_msi_mode(struct pci_dev *dev, int pos, int type) +{ + u16 control; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (type == PCI_CAP_ID_MSI) { + /* Set enabled bits to single MSI & enable MSI_enable bit */ + msi_disable(control); + pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msi_enabled = 0; + } else { + msix_disable(control); + pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msix_enabled = 0; + } + if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { + /* PCI Express Endpoint device detected */ + pci_intx(dev, 1); /* enable intx */ + } +} + +static void enable_msi_mode(struct pci_dev *dev, int pos, int type) +{ + u16 control; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (type == PCI_CAP_ID_MSI) { + /* Set enabled bits to single MSI & enable MSI_enable bit */ + msi_enable(control, 1); + pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msi_enabled = 1; + } else { + msix_enable(control); + pci_write_config_word(dev, msi_control_reg(pos), control); + dev->msix_enabled = 1; + } + if (pci_find_capability(dev, PCI_CAP_ID_EXP)) { + /* PCI Express Endpoint device detected */ + pci_intx(dev, 0); /* disable intx */ + } +} + +#ifdef CONFIG_PM +int pci_save_msi_state(struct pci_dev *dev) +{ + int pos; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (pos <= 0 || dev->no_msi) + return 0; + + if (!dev->msi_enabled) + return 0; + + /* Restore dev->irq to its default pin-assertion vector */ + msi_unmap_pirq(dev, dev->irq); + /* Disable MSI mode */ + disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); + /* Set the flags for use of restore */ + dev->msi_enabled = 1; + return 0; +} + +void pci_restore_msi_state(struct pci_dev *dev) +{ + int pos, pirq; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (pos <= 0) + return; + + if (!dev->msi_enabled) + return; + + pirq = msi_map_pirq_to_vector(dev, dev->irq, 0, 1); + if (pirq < 0) + return; + enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); +} + +int pci_save_msix_state(struct pci_dev *dev) +{ + int pos; + unsigned long flags; + struct msi_dev_list *msi_dev_entry; + struct msi_pirq_entry *pirq_entry, *tmp; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (pos <= 0 || dev->no_msi) + return 0; + + /* save the capability */ + if (!dev->msix_enabled) + return 0; + + msi_dev_entry = get_msi_dev_pirq_list(dev); + + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) + msi_unmap_pirq(dev, pirq_entry->pirq); + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + + disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); + /* Set the flags for use of restore */ + dev->msix_enabled = 1; + + return 0; +} + +void pci_restore_msix_state(struct pci_dev *dev) +{ + int pos; + unsigned long flags; + struct msi_dev_list *msi_dev_entry; + struct msi_pirq_entry *pirq_entry, *tmp; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (pos <= 0) + return; + + if (!dev->msix_enabled) + return; + + msi_dev_entry = get_msi_dev_pirq_list(dev); + + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) + msi_map_pirq_to_vector(dev, pirq_entry->pirq, pirq_entry->entry_nr, 0); + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + + enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); +} +#endif + +/** + * msi_capability_init - configure device's MSI capability structure + * @dev: pointer to the pci_dev data structure of MSI device function + * + * Setup the MSI capability structure of device function with a single + * MSI vector, regardless of device function is capable of handling + * multiple messages. A return of zero indicates the successful setup + * of an entry zero with the new MSI vector or non-zero for otherwise. + **/ +static int msi_capability_init(struct pci_dev *dev) +{ + int pos, pirq; + u16 control; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + pci_read_config_word(dev, msi_control_reg(pos), &control); + + pirq = msi_map_vector(dev, 0, 1); + if (pirq < 0) + return -EBUSY; + + dev->irq = pirq; + /* Set MSI enabled bits */ + enable_msi_mode(dev, pos, PCI_CAP_ID_MSI); + dev->msi_enabled = 1; + + return 0; +} + +/** + * msix_capability_init - configure device's MSI-X capability + * @dev: pointer to the pci_dev data structure of MSI-X device function + * @entries: pointer to an array of struct msix_entry entries + * @nvec: number of @entries + * + * Setup the MSI-X capability structure of device function with a + * single MSI-X vector. A return of zero indicates the successful setup of + * requested MSI-X entries with allocated vectors or non-zero for otherwise. + **/ +static int msix_capability_init(struct pci_dev *dev, + struct msix_entry *entries, int nvec) +{ + int pirq, i, pos; + struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev); + struct msi_pirq_entry *pirq_entry, *tmp; + unsigned long flags; + + if (!msi_dev_entry) + return -ENOMEM; + + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + { + printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ + before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) { + msi_unmap_pirq(dev, pirq_entry->pirq); + list_del(&pirq_entry->list); + kfree(pirq_entry); + } + } + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + + /* MSI-X Table Initialization */ + for (i = 0; i < nvec; i++) { + pirq = msi_map_vector(dev, entries[i].entry, 0); + if (pirq < 0) + break; + attach_pirq_entry(pirq, entries[i].entry, msi_dev_entry); + (entries + i)->vector = pirq; + } + if (i != nvec) { + msi_unmap_pirq(dev, dev->irq); + (entries + i)->vector = 0; + return -EBUSY; + } + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); + dev->msix_enabled = 1; + + return 0; +} + +/** + * pci_enable_msi - configure device's MSI capability structure + * @dev: pointer to the pci_dev data structure of MSI device function + * + * Setup the MSI capability structure of device function with + * a single MSI vector upon its software driver call to request for + * MSI mode enabled on its hardware device function. A return of zero + * indicates the successful setup of an entry zero with the new MSI + * vector or non-zero for otherwise. + **/ +extern int pci_frontend_enable_msi(struct pci_dev *dev); +int pci_enable_msi(struct pci_dev* dev) +{ + struct pci_bus *bus; + int pos, temp, status = -EINVAL; + + if (!pci_msi_enable || !dev) + return status; + + if (dev->no_msi) + return status; + + for (bus = dev->bus; bus; bus = bus->parent) + if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) + return -EINVAL; + + status = msi_init(); + if (status < 0) + return status; + +#ifdef CONFIG_XEN_PCIDEV_FRONTEND + if (!is_initial_xendomain()) + { + int ret; + + temp = dev->irq; + ret = pci_frontend_enable_msi(dev); + if (ret) + return ret; + + dev->irq_old = temp; + + return ret; + } +#endif + + temp = dev->irq; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (!pos) + return -EINVAL; + + /* Check whether driver already requested for MSI-X vectors */ + if (dev->msix_enabled) { + printk(KERN_INFO "PCI: %s: Can't enable MSI. " + "Device already has MSI-X vectors assigned\n", + pci_name(dev)); + dev->irq = temp; + return -EINVAL; + } + + status = msi_capability_init(dev); + if ( !status ) + dev->irq_old = temp; + else + dev->irq = temp; + + return status; +} + +extern void pci_frontend_disable_msi(struct pci_dev* dev); +void pci_disable_msi(struct pci_dev* dev) +{ + int pos; + int pirq; + + if (!pci_msi_enable) + return; + if (!dev) + return; + +#ifdef CONFIG_XEN_PCIDEV_FRONTEND + if (!is_initial_xendomain()) { + pci_frontend_disable_msi(dev); + dev->irq = dev->irq_old; + return; + } +#endif + + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (!pos) + return; + + pirq = dev->irq; + /* Restore dev->irq to its default pin-assertion vector */ + dev->irq = dev->irq_old; + msi_unmap_pirq(dev, pirq); + + /* Disable MSI mode */ + disable_msi_mode(dev, pos, PCI_CAP_ID_MSI); +} + +/** + * pci_enable_msix - configure device's MSI-X capability structure + * @dev: pointer to the pci_dev data structure of MSI-X device function + * @entries: pointer to an array of MSI-X entries + * @nvec: number of MSI-X vectors requested for allocation by device driver + * + * Setup the MSI-X capability structure of device function with the number + * of requested vectors upon its software driver call to request for + * MSI-X mode enabled on its hardware device function. A return of zero + * indicates the successful configuration of MSI-X capability structure + * with new allocated MSI-X vectors. A return of < 0 indicates a failure. + * Or a return of > 0 indicates that driver request is exceeding the number + * of vectors available. Driver should use the returned value to re-send + * its request. + **/ +extern int pci_frontend_enable_msix(struct pci_dev *dev, + struct msix_entry *entries, int nvec); +int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) +{ + struct pci_bus *bus; + int status, pos, nr_entries; + int i, j, temp; + u16 control; + + if (!pci_msi_enable || !dev || !entries) + return -EINVAL; + + if (dev->no_msi) + return -EINVAL; + + for (bus = dev->bus; bus; bus = bus->parent) + if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI) + return -EINVAL; + +#ifdef CONFIG_XEN_PCIDEV_FRONTEND + if (!is_initial_xendomain()) { + int ret; + + ret = pci_frontend_enable_msix(dev, entries, nvec); + if (ret) { + printk("get %x from pci_frontend_enable_msix\n", ret); + return ret; + } + + return 0; + } +#endif + + status = msi_init(); + if (status < 0) + return status; + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (!pos) + return -EINVAL; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + nr_entries = multi_msix_capable(control); + if (nvec > nr_entries) + return -EINVAL; + + /* Check for any invalid entries */ + for (i = 0; i < nvec; i++) { + if (entries[i].entry >= nr_entries) + return -EINVAL; /* invalid entry */ + for (j = i + 1; j < nvec; j++) { + if (entries[i].entry == entries[j].entry) + return -EINVAL; /* duplicate entry */ + } + } + + temp = dev->irq; + /* Check whether driver already requested for MSI vector */ + if (dev->msi_enabled) { + printk(KERN_INFO "PCI: %s: Can't enable MSI-X. " + "Device already has an MSI vector assigned\n", + pci_name(dev)); + dev->irq = temp; + return -EINVAL; + } + + status = msix_capability_init(dev, entries, nvec); + + if ( !status ) + dev->irq_old = temp; + else + dev->irq = temp; + + return status; +} + +extern void pci_frontend_disable_msix(struct pci_dev* dev); +void pci_disable_msix(struct pci_dev* dev) +{ + int pos; + u16 control; + + + if (!pci_msi_enable) + return; + if (!dev) + return; + +#ifdef CONFIG_XEN_PCIDEV_FRONTEND + if (!is_initial_xendomain()) { + pci_frontend_disable_msix(dev); + dev->irq = dev->irq_old; + return; + } +#endif + + pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); + if (!pos) + return; + + pci_read_config_word(dev, msi_control_reg(pos), &control); + if (!(control & PCI_MSIX_FLAGS_ENABLE)) + return; + + msi_remove_pci_irq_vectors(dev); + + /* Disable MSI mode */ + disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); +} + +/** + * msi_remove_pci_irq_vectors - reclaim MSI(X) vectors to unused state + * @dev: pointer to the pci_dev data structure of MSI(X) device function + * + * Being called during hotplug remove, from which the device function + * is hot-removed. All previous assigned MSI/MSI-X vectors, if + * allocated for this device function, are reclaimed to unused state, + * which may be used later on. + **/ +void msi_remove_pci_irq_vectors(struct pci_dev* dev) +{ + unsigned long flags; + struct msi_dev_list *msi_dev_entry; + struct msi_pirq_entry *pirq_entry, *tmp; + + if (!pci_msi_enable || !dev) + return; + + msi_dev_entry = get_msi_dev_pirq_list(dev); + + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + { + printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ + before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) { + msi_unmap_pirq(dev, pirq_entry->pirq); + list_del(&pirq_entry->list); + kfree(pirq_entry); + } + } + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + dev->irq = dev->irq_old; +} + +void pci_no_msi(void) +{ + pci_msi_enable = 0; +} + +EXPORT_SYMBOL(pci_enable_msi); +EXPORT_SYMBOL(pci_disable_msi); +EXPORT_SYMBOL(pci_enable_msix); +EXPORT_SYMBOL(pci_disable_msix); +#ifdef CONFIG_XEN +EXPORT_SYMBOL(register_msi_get_owner); +EXPORT_SYMBOL(unregister_msi_get_owner); +#endif + diff -r 5d938fac27a2 -r f6fcc65413ae drivers/pci/msi.h --- a/drivers/pci/msi.h Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/pci/msi.h Tue May 13 10:38:04 2008 +0900 @@ -84,6 +84,11 @@ extern void (*interrupt[NR_IRQS])(void); extern void (*interrupt[NR_IRQS])(void); extern int pci_vector_resources(int last, int nr_released); +#ifdef CONFIG_XEN +extern int unregister_msi_get_owner(int (*func)(struct pci_dev *dev)); +extern int register_msi_get_owner(int (*func)(struct pci_dev *dev)); +#endif + /* * MSI-X Address Register */ diff -r 5d938fac27a2 -r f6fcc65413ae drivers/xen/core/evtchn.c --- a/drivers/xen/core/evtchn.c Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/xen/core/evtchn.c Tue May 13 10:38:04 2008 +0900 @@ -200,9 +200,6 @@ static inline void exit_idle(void) {} (regs)->IRQ_REG = ~(irq); \ do_IRQ((regs)); \ } while (0) -#elif defined (__powerpc__) -#define do_IRQ(irq, regs) __do_IRQ(irq, regs) -static inline void exit_idle(void) {} #endif /* Xen will never allocate port zero for any purpose. */ @@ -246,7 +243,7 @@ asmlinkage void evtchn_do_upcall(struct #ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */ /* Clear master flag /before/ clearing selector flag. */ - rmb(); + wmb(); #endif l1 = xchg(&vcpu_info->evtchn_pending_sel, 0); diff -r 5d938fac27a2 -r f6fcc65413ae drivers/xen/pciback/Makefile --- a/drivers/xen/pciback/Makefile Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/xen/pciback/Makefile Tue May 13 10:38:04 2008 +0900 @@ -6,6 +6,7 @@ pciback-y += conf_space.o conf_space_hea conf_space_capability_vpd.o \ conf_space_capability_pm.o \ conf_space_quirks.o +pciback-$(CONFIG_PCI_MSI) += conf_space_capability_msi.o pciback-$(CONFIG_XEN_PCIDEV_BACKEND_VPCI) += vpci.o pciback-$(CONFIG_XEN_PCIDEV_BACKEND_SLOT) += slot.o pciback-$(CONFIG_XEN_PCIDEV_BACKEND_PASS) += passthrough.o diff -r 5d938fac27a2 -r f6fcc65413ae drivers/xen/pciback/conf_space_capability_msi.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/xen/pciback/conf_space_capability_msi.c Tue May 13 10:38:04 2008 +0900 @@ -0,0 +1,60 @@ +/* + * PCI Backend -- Configuration overlay for MSI capability + */ +#include +#include "conf_space.h" +#include "conf_space_capability.h" +#include +#include "pciback.h" + +int pciback_enable_msi(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op) +{ + int otherend = pdev->xdev->otherend_id; + int irq; + int status; + + status = pci_enable_msi(dev); + + if (status) { + printk("error enable msi for guest %x status %x\n", otherend, status); + op->value = 0; + return XEN_PCI_ERR_op_failed; + } + + op->value = dev->irq; + return 0; +} + +int pciback_disable_msi(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op) +{ + int old_irq = dev->irq; + + pci_disable_msi(dev); + + op->value = dev->irq; + return 0; +} + +int pciback_enable_msix(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op) +{ + int otherend = pdev->xdev->otherend_id, result, i; + + result = pci_enable_msix(dev, op->msix_entries, op->value); + + op->value = result; + return result; +} + +int pciback_disable_msix(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op) +{ + + pci_disable_msix(dev); + + op->value = dev->irq; + return 0; +} + diff -r 5d938fac27a2 -r f6fcc65413ae drivers/xen/pciback/pci_stub.c --- a/drivers/xen/pciback/pci_stub.c Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/xen/pciback/pci_stub.c Tue May 13 10:38:04 2008 +0900 @@ -805,6 +805,23 @@ static ssize_t permissive_show(struct de DRIVER_ATTR(permissive, S_IRUSR | S_IWUSR, permissive_show, permissive_add); +#ifdef CONFIG_PCI_MSI + +int pciback_get_owner(struct pci_dev *dev) +{ + struct pcistub_device *psdev; + + psdev = pcistub_device_find(pci_domain_nr(dev->bus), dev->bus->number, + PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); + /* XXX will other domain has pciback support ??? */ + if (!psdev || !psdev->pdev) { + printk(KERN_WARNING "no ownder\n"); + return -1; + } + return psdev->pdev->xdev->otherend_id; +} +#endif + static void pcistub_exit(void) { driver_remove_file(&pciback_pci_driver.driver, &driver_attr_new_slot); @@ -815,6 +832,9 @@ static void pcistub_exit(void) driver_remove_file(&pciback_pci_driver.driver, &driver_attr_permissive); pci_unregister_driver(&pciback_pci_driver); +#ifdef CONFIG_PCI_MSI + unregister_msi_get_owner(pciback_get_owner); +#endif } static int __init pcistub_init(void) @@ -872,6 +892,10 @@ static int __init pcistub_init(void) err = driver_create_file(&pciback_pci_driver.driver, &driver_attr_permissive); +#ifdef CONFIG_PCI_MSI + if (!err) + err = register_msi_get_owner(pciback_get_owner); +#endif if (err) pcistub_exit(); diff -r 5d938fac27a2 -r f6fcc65413ae drivers/xen/pciback/pciback.h --- a/drivers/xen/pciback/pciback.h Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/xen/pciback/pciback.h Tue May 13 10:38:04 2008 +0900 @@ -93,5 +93,19 @@ int pciback_xenbus_register(void); int pciback_xenbus_register(void); void pciback_xenbus_unregister(void); +#ifdef CONFIG_PCI_MSI +int pciback_enable_msi(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op); + +int pciback_disable_msi(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op); + + +int pciback_enable_msix(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op); + +int pciback_disable_msix(struct pciback_device *pdev, + struct pci_dev *dev, struct xen_pci_op *op); +#endif extern int verbose_request; #endif diff -r 5d938fac27a2 -r f6fcc65413ae drivers/xen/pciback/pciback_ops.c --- a/drivers/xen/pciback/pciback_ops.c Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/xen/pciback/pciback_ops.c Tue May 13 10:38:04 2008 +0900 @@ -61,15 +61,37 @@ void pciback_do_op(void *data) if (dev == NULL) op->err = XEN_PCI_ERR_dev_not_found; - else if (op->cmd == XEN_PCI_OP_conf_read) - op->err = pciback_config_read(dev, op->offset, op->size, - &op->value); - else if (op->cmd == XEN_PCI_OP_conf_write) - op->err = pciback_config_write(dev, op->offset, op->size, - op->value); else - op->err = XEN_PCI_ERR_not_implemented; - + { + switch (op->cmd) + { + case XEN_PCI_OP_conf_read: + op->err = pciback_config_read(dev, + op->offset, op->size, &op->value); + break; + case XEN_PCI_OP_conf_write: + op->err = pciback_config_write(dev, + op->offset, op->size, op->value); + break; +#ifdef CONFIG_PCI_MSI + case XEN_PCI_OP_enable_msi: + op->err = pciback_enable_msi(pdev, dev, op); + break; + case XEN_PCI_OP_disable_msi: + op->err = pciback_disable_msi(pdev, dev, op); + break; + case XEN_PCI_OP_enable_msix: + op->err = pciback_enable_msix(pdev, dev, op); + break; + case XEN_PCI_OP_disable_msix: + op->err = pciback_disable_msix(pdev, dev, op); + break; +#endif + default: + op->err = XEN_PCI_ERR_not_implemented; + break; + } + } /* Tell the driver domain that we're done. */ wmb(); clear_bit(_XEN_PCIF_active, (unsigned long *)&pdev->sh_info->flags); diff -r 5d938fac27a2 -r f6fcc65413ae drivers/xen/pcifront/pci_op.c --- a/drivers/xen/pcifront/pci_op.c Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/xen/pcifront/pci_op.c Tue May 13 10:38:04 2008 +0900 @@ -277,6 +277,122 @@ struct pci_ops pcifront_bus_ops = { .write = pcifront_bus_write, }; +#ifdef CONFIG_PCI_MSI +int pci_frontend_enable_msix(struct pci_dev *dev, + struct msix_entry *entries, + int nvec) +{ + int err; + int i; + struct xen_pci_op op = { + .cmd = XEN_PCI_OP_enable_msix, + .domain = pci_domain_nr(dev->bus), + .bus = dev->bus->number, + .devfn = dev->devfn, + .value = nvec, + }; + struct pcifront_sd *sd = dev->bus->sysdata; + struct pcifront_device *pdev = pcifront_get_pdev(sd); + + if (nvec > SH_INFO_MAX_VEC) { + printk("too much vector for pci frontend%x\n", nvec); + return -EINVAL; + } + + for (i = 0; i < nvec; i++) { + op.msix_entries[i].entry = entries[i].entry; + op.msix_entries[i].vector = entries[i].vector; + } + + err = do_pci_op(pdev, &op); + + if (!err) { + if (!op.value) { + /* we get the result */ + for ( i = 0; i < nvec; i++) + entries[i].vector = op.msix_entries[i].vector; + return 0; + } + else { + printk("enable msix get value %x\n", op.value); + return op.value; + } + } + else { + printk("enable msix get err %x\n", err); + return err; + } +} + +void pci_frontend_disable_msix(struct pci_dev* dev) +{ + int err; + struct xen_pci_op op = { + .cmd = XEN_PCI_OP_disable_msix, + .domain = pci_domain_nr(dev->bus), + .bus = dev->bus->number, + .devfn = dev->devfn, + }; + struct pcifront_sd *sd = dev->bus->sysdata; + struct pcifront_device *pdev = pcifront_get_pdev(sd); + + err = do_pci_op(pdev, &op); + + /* What should do for error ? */ + if (err) + printk("pci_disable_msix get err %x\n", err); +} + +int pci_frontend_enable_msi(struct pci_dev *dev) +{ + int err; + struct xen_pci_op op = { + .cmd = XEN_PCI_OP_enable_msi, + .domain = pci_domain_nr(dev->bus), + .bus = dev->bus->number, + .devfn = dev->devfn, + }; + struct pcifront_sd *sd = dev->bus->sysdata; + struct pcifront_device *pdev = pcifront_get_pdev(sd); + + err = do_pci_op(pdev, &op); + if (likely(!err)) { + dev->irq = op.value; + } + else { + printk("pci frontend enable msi failed for dev %x:%x \n", + op.bus, op.devfn); + err = -EINVAL; + } + return err; +} + +void pci_frontend_disable_msi(struct pci_dev* dev) +{ + int err; + struct xen_pci_op op = { + .cmd = XEN_PCI_OP_disable_msi, + .domain = pci_domain_nr(dev->bus), + .bus = dev->bus->number, + .devfn = dev->devfn, + }; + struct pcifront_sd *sd = dev->bus->sysdata; + struct pcifront_device *pdev = pcifront_get_pdev(sd); + + err = do_pci_op(pdev, &op); + if (err == XEN_PCI_ERR_dev_not_found) { + /* XXX No response from backend, what shall we do? */ + printk("get no response from backend for disable MSI\n"); + return; + } + if (likely(!err)) + dev->irq = op.value; + else + /* how can pciback notify us fail? */ + printk("get fake response frombackend \n"); +} +#endif /* CONFIG_PCI_MSI */ + /* Claim resources for the PCI frontend as-is, backend won't allow changes */ static void pcifront_claim_resource(struct pci_dev *dev, void *data) { diff -r 5d938fac27a2 -r f6fcc65413ae drivers/xen/privcmd/privcmd.c --- a/drivers/xen/privcmd/privcmd.c Thu Apr 24 14:08:54 2008 -0600 +++ b/drivers/xen/privcmd/privcmd.c Tue May 13 10:38:04 2008 +0900 @@ -229,11 +229,9 @@ static struct vm_operations_struct privc static int privcmd_mmap(struct file * file, struct vm_area_struct * vma) { -#ifndef __powerpc__ /* PowerPC has a trick to safely do this. */ /* Unsupported for auto-translate guests. */ if (xen_feature(XENFEAT_auto_translated_physmap)) return -ENOSYS; -#endif /* DONTCOPY is essential for Xen as copy_page_range is broken. */ vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; diff -r 5d938fac27a2 -r f6fcc65413ae include/acpi/processor.h --- a/include/acpi/processor.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/acpi/processor.h Tue May 13 10:38:04 2008 +0900 @@ -20,6 +20,10 @@ #define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */ #define ACPI_PSD_REV0_ENTRIES 5 + +#ifdef CONFIG_XEN +#define NR_ACPI_CPUS 256 +#endif /* CONFIG_XEN */ /* * Types of coordination defined in ACPI 3.0. Same macros can be used across @@ -32,6 +36,17 @@ /* Power Management */ struct acpi_processor_cx; + +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL +struct acpi_csd_package { + acpi_integer num_entries; + acpi_integer revision; + acpi_integer domain; + acpi_integer coord_type; + acpi_integer num_processors; + acpi_integer index; +} __attribute__ ((packed)); +#endif struct acpi_power_register { u8 descriptor; @@ -63,6 +78,12 @@ struct acpi_processor_cx { u32 power; u32 usage; u64 time; +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL + /* Require raw information for external control logic */ + struct acpi_power_register reg; + u32 csd_count; + struct acpi_csd_package *domain_info; +#endif struct acpi_processor_cx_policy promotion; struct acpi_processor_cx_policy demotion; }; @@ -275,4 +296,78 @@ static inline void acpi_thermal_cpufreq_ } #endif -#endif +#ifdef CONFIG_XEN +/* + * Following are interfaces geared to external processor PM control + * logic like a VMM + */ +/* Events notified to external control logic */ +#define PROCESSOR_PM_INIT 1 +#define PROCESSOR_PM_CHANGE 2 +#define PROCESSOR_HOTPLUG 3 + +/* Objects for the PM envents */ +#define PM_TYPE_IDLE 0 +#define PM_TYPE_PERF 1 +#define PM_TYPE_THR 2 +#define PM_TYPE_MAX 3 + +/* Processor hotplug events */ +#define HOTPLUG_TYPE_ADD 0 +#define HOTPLUG_TYPE_REMOVE 1 + +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL +struct processor_extcntl_ops { + /* Transfer processor PM events to external control logic */ + int (*pm_ops[PM_TYPE_MAX])(struct acpi_processor *pr, int event); + /* Notify physical processor status to external control logic */ + int (*hotplug)(struct acpi_processor *pr, int event); +}; +extern struct processor_extcntl_ops *processor_extcntl_ops; + +static inline int processor_cntl_external(void) +{ + return (processor_extcntl_ops != NULL); +} + +static inline int processor_pm_external(void) +{ + return processor_cntl_external() && + (processor_extcntl_ops->pm_ops[PM_TYPE_IDLE] != NULL); +} + +static inline int processor_pmperf_external(void) +{ + return processor_cntl_external() && + (processor_extcntl_ops->pm_ops[PM_TYPE_PERF] != NULL); +} + +static inline int processor_pmthr_external(void) +{ + return processor_cntl_external() && + (processor_extcntl_ops->pm_ops[PM_TYPE_THR] != NULL); +} + +extern int processor_notify_external(struct acpi_processor *pr, + int event, int type); +extern int processor_register_extcntl(struct processor_extcntl_ops *ops); +extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops); +extern int processor_extcntl_init(struct acpi_processor *pr); +#else +static inline int processor_cntl_external(void) {return 0;} +static inline int processor_pm_external(void) {return 0;} +static inline int processor_pmperf_external(void) {return 0;} +static inline int processor_pmthr_external(void) {return 0;} +static inline int processor_notify_external(struct acpi_processor *pr, + int event, int type) +{ + return -EINVAL; +} +static inline int processor_extcntl_init(struct acpi_processor *pr) +{ + return -EINVAL; +} +#endif /* CONFIG_PROCESSOR_EXTERNAL_CONTROL */ +#endif /* CONFIG_XEN */ + +#endif diff -r 5d938fac27a2 -r f6fcc65413ae include/asm-i386/io_apic.h --- a/include/asm-i386/io_apic.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/asm-i386/io_apic.h Tue May 13 10:38:04 2008 +0900 @@ -12,7 +12,7 @@ #ifdef CONFIG_X86_IO_APIC -#ifdef CONFIG_PCI_MSI +#if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN) static inline int use_pci_vector(void) {return 1;} static inline void disable_edge_ioapic_vector(unsigned int vector) { } static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { } diff -r 5d938fac27a2 -r f6fcc65413ae include/asm-x86_64/io_apic.h --- a/include/asm-x86_64/io_apic.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/asm-x86_64/io_apic.h Tue May 13 10:38:04 2008 +0900 @@ -12,7 +12,7 @@ #ifdef CONFIG_X86_IO_APIC -#ifdef CONFIG_PCI_MSI +#if defined(CONFIG_PCI_MSI) && !defined(CONFIG_XEN) static inline int use_pci_vector(void) {return 1;} static inline void disable_edge_ioapic_vector(unsigned int vector) { } static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { } diff -r 5d938fac27a2 -r f6fcc65413ae include/asm-x86_64/msi.h --- a/include/asm-x86_64/msi.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/asm-x86_64/msi.h Tue May 13 10:38:04 2008 +0900 @@ -7,14 +7,21 @@ #define ASM_MSI_H #include +#ifndef CONFIG_XEN #include +#endif #include +#ifndef CONFIG_XEN #define LAST_DEVICE_VECTOR (FIRST_SYSTEM_VECTOR - 1) +#else +#define LAST_DYNAMIC_VECTOR 0xdf +#define LAST_DEVICE_VECTOR (LAST_DYNAMIC_VECTOR) +#endif + #define MSI_TARGET_CPU_SHIFT 12 extern struct msi_ops msi_apic_ops; - static inline int msi_arch_init(void) { msi_register(&msi_apic_ops); diff -r 5d938fac27a2 -r f6fcc65413ae include/linux/pci.h --- a/include/linux/pci.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/linux/pci.h Tue May 13 10:38:04 2008 +0900 @@ -152,6 +152,9 @@ struct pci_dev { * directly, use the values stored here. They might be different! */ unsigned int irq; +#ifdef CONFIG_XEN + unsigned int irq_old; +#endif struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ /* These fields are used by common fixups */ diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/evtchn.h --- a/include/xen/evtchn.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/evtchn.h Tue May 13 10:38:04 2008 +0900 @@ -136,4 +136,18 @@ void notify_remote_via_irq(int irq); void notify_remote_via_irq(int irq); int irq_to_evtchn_port(int irq); +#define PIRQ_SET_MAPPING 0x0 +#define PIRQ_CLEAR_MAPPING 0x1 +#define PIRQ_GET_MAPPING 0x3 +int pirq_mapstatus(int pirq, int action); +int set_pirq_hw_action(int pirq, int (*action)(int pirq, int action)); +int clear_pirq_hw_action(int pirq); + +#define PIRQ_STARTUP 1 +#define PIRQ_SHUTDOWN 2 +#define PIRQ_ENABLE 3 +#define PIRQ_DISABLE 4 +#define PIRQ_END 5 +#define PIRQ_ACK 6 + #endif /* __ASM_EVTCHN_H__ */ diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/arch-ia64.h --- a/include/xen/interface/arch-ia64.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/arch-ia64.h Tue May 13 10:38:04 2008 +0900 @@ -68,6 +68,10 @@ typedef unsigned long xen_pfn_t; /* WARNING: before changing this, check that shared_info fits on a page */ #define MAX_VIRT_CPUS 64 +/* IO ports location for PV. */ +#define IO_PORTS_PADDR 0x00000ffffc000000UL +#define IO_PORTS_SIZE 0x0000000004000000UL + #ifndef __ASSEMBLY__ typedef unsigned long xen_ulong_t; @@ -79,54 +83,6 @@ typedef unsigned long xen_ulong_t; #endif #define INVALID_MFN (~0UL) - -#define MEM_G (1UL << 30) -#define MEM_M (1UL << 20) -#define MEM_K (1UL << 10) - -/* Guest physical address of IO ports space. */ -#define IO_PORTS_PADDR 0x00000ffffc000000UL -#define IO_PORTS_SIZE 0x0000000004000000UL - -#define MMIO_START (3 * MEM_G) -#define MMIO_SIZE (512 * MEM_M) - -#define VGA_IO_START 0xA0000UL -#define VGA_IO_SIZE 0x20000 - -#define LEGACY_IO_START (MMIO_START + MMIO_SIZE) -#define LEGACY_IO_SIZE (64*MEM_M) - -#define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE) -#define IO_PAGE_SIZE XEN_PAGE_SIZE - -#define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE) -#define STORE_PAGE_SIZE XEN_PAGE_SIZE - -#define BUFFER_IO_PAGE_START (STORE_PAGE_START + STORE_PAGE_SIZE) -#define BUFFER_IO_PAGE_SIZE XEN_PAGE_SIZE - -#define BUFFER_PIO_PAGE_START (BUFFER_IO_PAGE_START + BUFFER_IO_PAGE_SIZE) -#define BUFFER_PIO_PAGE_SIZE XEN_PAGE_SIZE - -#define IO_SAPIC_START 0xfec00000UL -#define IO_SAPIC_SIZE 0x100000 - -#define PIB_START 0xfee00000UL -#define PIB_SIZE 0x200000 - -#define GFW_START (4*MEM_G -16*MEM_M) -#define GFW_SIZE (16*MEM_M) - -/* Nvram belongs to GFW memory space */ -#define NVRAM_SIZE (MEM_K * 64) -#define NVRAM_START (GFW_START + 10 * MEM_M) - -#define NVRAM_VALID_SIG 0x4650494e45584948 // "HIXENIPF" -struct nvram_save_addr { - unsigned long addr; - unsigned long signature; -}; struct pt_fpreg { union { @@ -509,6 +465,9 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte /* Internal only: associated with PGC_allocated bit */ #define _ASSIGN_pgc_allocated 3 #define ASSIGN_pgc_allocated (1UL << _ASSIGN_pgc_allocated) +/* Page is an IO page. */ +#define _ASSIGN_io 4 +#define ASSIGN_io (1UL << _ASSIGN_io) /* This structure has the same layout of struct ia64_boot_param, defined in . It is redefined here to ease use. */ @@ -644,6 +603,10 @@ DEFINE_XEN_GUEST_HANDLE(pfarg_load_t); #endif /* __ASSEMBLY__ */ #endif /* XEN */ +#ifndef __ASSEMBLY__ +#include "arch-ia64/hvm/memmap.h" +#endif + #endif /* __HYPERVISOR_IF_IA64_H__ */ /* diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/arch-ia64/hvm/memmap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/xen/interface/arch-ia64/hvm/memmap.h Tue May 13 10:38:04 2008 +0900 @@ -0,0 +1,88 @@ +/****************************************************************************** + * memmap.h + * + * Copyright (c) 2008 Tristan Gingold + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ +#define __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ + +#define MEM_G (1UL << 30) +#define MEM_M (1UL << 20) +#define MEM_K (1UL << 10) + +/* Guest physical address of IO ports space. */ +#define MMIO_START (3 * MEM_G) +#define MMIO_SIZE (512 * MEM_M) + +#define VGA_IO_START 0xA0000UL +#define VGA_IO_SIZE 0x20000 + +#define LEGACY_IO_START (MMIO_START + MMIO_SIZE) +#define LEGACY_IO_SIZE (64 * MEM_M) + +#define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE) +#define IO_PAGE_SIZE XEN_PAGE_SIZE + +#define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE) +#define STORE_PAGE_SIZE XEN_PAGE_SIZE + +#define BUFFER_IO_PAGE_START (STORE_PAGE_START + STORE_PAGE_SIZE) +#define BUFFER_IO_PAGE_SIZE XEN_PAGE_SIZE + +#define BUFFER_PIO_PAGE_START (BUFFER_IO_PAGE_START + BUFFER_IO_PAGE_SIZE) +#define BUFFER_PIO_PAGE_SIZE XEN_PAGE_SIZE + +#define IO_SAPIC_START 0xfec00000UL +#define IO_SAPIC_SIZE 0x100000 + +#define PIB_START 0xfee00000UL +#define PIB_SIZE 0x200000 + +#define GFW_START (4 * MEM_G - 16 * MEM_M) +#define GFW_SIZE (16 * MEM_M) + +/* domVTI */ +#define GPFN_FRAME_BUFFER 0x1 /* VGA framebuffer */ +#define GPFN_LOW_MMIO 0x2 /* Low MMIO range */ +#define GPFN_PIB 0x3 /* PIB base */ +#define GPFN_IOSAPIC 0x4 /* IOSAPIC base */ +#define GPFN_LEGACY_IO 0x5 /* Legacy I/O base */ +#define GPFN_HIGH_MMIO 0x6 /* High MMIO range */ + +/* Nvram belongs to GFW memory space */ +#define NVRAM_SIZE (MEM_K * 64) +#define NVRAM_START (GFW_START + 10 * MEM_M) + +#define NVRAM_VALID_SIG 0x4650494e45584948 /* "HIXENIPF" */ +struct nvram_save_addr { + unsigned long addr; + unsigned long signature; +}; + +#endif /* __XEN_PUBLIC_HVM_MEMMAP_IA64_H__ */ + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/arch-ia64/sioemu.h --- a/include/xen/interface/arch-ia64/sioemu.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/arch-ia64/sioemu.h Tue May 13 10:38:04 2008 +0900 @@ -22,6 +22,9 @@ #ifndef __XEN_PUBLIC_IA64_SIOEMU_H__ #define __XEN_PUBLIC_IA64_SIOEMU_H__ +/* SIOEMU specific hypercalls. + The numbers are the minor part of FW_HYPERCALL_SIOEMU. */ + /* Defines the callback entry point. r8=ip, r9=data. Must be called per-vcpu. */ #define SIOEMU_HYPERCALL_SET_CALLBACK 0x01 @@ -35,8 +38,52 @@ /* Get wallclock time. */ #define SIOEMU_HYPERCALL_GET_TIME 0x04 -/* Return from callback. r16=0. - Unmask vcpu events. */ -#define SIOEMU_HYPERPRIVOP_CALLBACK_RETURN 0x01 +/* Flush cache. */ +#define SIOEMU_HYPERCALL_FLUSH_CACHE 0x07 +/* Get freq base. */ +#define SIOEMU_HYPERCALL_FREQ_BASE 0x08 + +/* Return from callback. */ +#define SIOEMU_HYPERCALL_CALLBACK_RETURN 0x09 + +/* Deliver an interrupt. */ +#define SIOEMU_HYPERCALL_DELIVER_INT 0x0a + +/* SIOEMU callback reason. */ + +/* An event (from event channel) has to be delivered. */ +#define SIOEMU_CB_EVENT 0x00 + +/* Emulate an IO access. */ +#define SIOEMU_CB_IO_EMULATE 0x01 + +/* An IPI is sent to a dead vcpu. */ +#define SIOEMU_CB_WAKEUP_VCPU 0x02 + +/* A SAL hypercall is executed. */ +#define SIOEMU_CB_SAL_ASSIST 0x03 + +#ifndef __ASSEMBLY__ +struct sioemu_callback_info { + /* Saved registers. */ + unsigned long ip; + unsigned long psr; + unsigned long ifs; + unsigned long nats; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + + /* Callback parameters. */ + unsigned long cause; + unsigned long arg0; + unsigned long arg1; + unsigned long arg2; + unsigned long arg3; + unsigned long _pad2[2]; + unsigned long r2; +}; +#endif /* __ASSEMBLY__ */ #endif /* __XEN_PUBLIC_IA64_SIOEMU_H__ */ diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/arch-x86/xen-x86_32.h --- a/include/xen/interface/arch-x86/xen-x86_32.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/arch-x86/xen-x86_32.h Tue May 13 10:38:04 2008 +0900 @@ -74,6 +74,7 @@ #define MACH2PHYS_VIRT_END_PAE \ mk_unsigned_long(__MACH2PHYS_VIRT_END_PAE) +/* Non-PAE bounds are obsolete. */ #define __HYPERVISOR_VIRT_START_NONPAE 0xFC000000 #define __MACH2PHYS_VIRT_START_NONPAE 0xFC000000 #define __MACH2PHYS_VIRT_END_NONPAE 0xFC400000 @@ -84,15 +85,9 @@ #define MACH2PHYS_VIRT_END_NONPAE \ mk_unsigned_long(__MACH2PHYS_VIRT_END_NONPAE) -#ifdef CONFIG_X86_PAE #define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE #define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_PAE #define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_PAE -#else -#define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_NONPAE -#define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_NONPAE -#define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_NONPAE -#endif #ifndef HYPERVISOR_VIRT_START #define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START) diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/domctl.h --- a/include/xen/interface/domctl.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/domctl.h Tue May 13 10:38:04 2008 +0900 @@ -454,7 +454,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_assig #define XEN_DOMCTL_unbind_pt_irq 48 typedef enum pt_irq_type_e { PT_IRQ_TYPE_PCI, - PT_IRQ_TYPE_ISA + PT_IRQ_TYPE_ISA, + PT_IRQ_TYPE_MSI, } pt_irq_type_t; struct xen_domctl_bind_pt_irq { uint32_t machine_irq; @@ -470,6 +471,10 @@ struct xen_domctl_bind_pt_irq { uint8_t device; uint8_t intx; } pci; + struct { + uint8_t gvec; + uint32_t gflags; + } msi; } u; }; typedef struct xen_domctl_bind_pt_irq xen_domctl_bind_pt_irq_t; @@ -571,6 +576,19 @@ typedef struct xen_domctl_set_target xen typedef struct xen_domctl_set_target xen_domctl_set_target_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_set_target_t); +#if defined(__i386__) || defined(__x86_64__) +# define XEN_CPUID_INPUT_UNUSED 0xFFFFFFFF +# define XEN_DOMCTL_set_cpuid 49 +struct xen_domctl_cpuid { + unsigned int input[2]; + unsigned int eax; + unsigned int ebx; + unsigned int ecx; + unsigned int edx; +}; +typedef struct xen_domctl_cpuid xen_domctl_cpuid_t; +DEFINE_XEN_GUEST_HANDLE(xen_domctl_cpuid_t); +#endif struct xen_domctl { uint32_t cmd; @@ -609,6 +627,9 @@ struct xen_domctl { struct xen_domctl_ext_vcpucontext ext_vcpucontext; struct xen_domctl_set_opt_feature set_opt_feature; struct xen_domctl_set_target set_target; +#if defined(__i386__) || defined(__x86_64__) + struct xen_domctl_cpuid cpuid; +#endif uint8_t pad[128]; } u; }; diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/hvm/hvm_op.h --- a/include/xen/interface/hvm/hvm_op.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/hvm/hvm_op.h Tue May 13 10:38:04 2008 +0900 @@ -73,4 +73,20 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_ /* Flushes all VCPU TLBs: @arg must be NULL. */ #define HVMOP_flush_tlbs 5 +/* Track dirty VRAM. */ +#define HVMOP_track_dirty_vram 6 +struct xen_hvm_track_dirty_vram { + /* Domain to be tracked. */ + domid_t domid; + /* First pfn to track. */ + uint64_aligned_t first_pfn; + /* Number of pages to track. */ + uint64_aligned_t nr; + /* OUT variable. */ + /* Dirty bitmap buffer. */ + XEN_GUEST_HANDLE_64(uint8) dirty_bitmap; +}; +typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t; +DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t); + #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/hvm/params.h --- a/include/xen/interface/hvm/params.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/hvm/params.h Tue May 13 10:38:04 2008 +0900 @@ -84,6 +84,12 @@ /* Boolean: Enable virtual HPET (high-precision event timer)? (x86-only) */ #define HVM_PARAM_HPET_ENABLED 11 -#define HVM_NR_PARAMS 12 +/* Identity-map page directory used by Intel EPT when CR0.PG=0. */ +#define HVM_PARAM_IDENT_PT 12 + +/* Device Model domain, defaults to 0. */ +#define HVM_PARAM_DM_DOMAIN 13 + +#define HVM_NR_PARAMS 14 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/io/protocols.h --- a/include/xen/interface/io/protocols.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/io/protocols.h Tue May 13 10:38:04 2008 +0900 @@ -26,7 +26,6 @@ #define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi" #define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi" #define XEN_IO_PROTO_ABI_IA64 "ia64-abi" -#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi" #if defined(__i386__) # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32 @@ -34,8 +33,6 @@ # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64 #elif defined(__ia64__) # define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64 -#elif defined(__powerpc64__) -# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64 #else # error arch fixup needed here #endif diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/io/xs_wire.h --- a/include/xen/interface/io/xs_wire.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/io/xs_wire.h Tue May 13 10:38:04 2008 +0900 @@ -61,6 +61,7 @@ struct xsd_errors const char *errstring; }; #define XSD_ERROR(x) { x, #x } +/* LINTED: static unused */ static struct xsd_errors xsd_errors[] #if defined(__GNUC__) __attribute__((unused)) diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/libelf.h --- a/include/xen/interface/libelf.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/libelf.h Tue May 13 10:38:04 2008 +0900 @@ -23,10 +23,8 @@ #ifndef __XC_LIBELF__ #define __XC_LIBELF__ 1 -#if defined(__i386__) || defined(__x86_64) || defined(__ia64__) +#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) #define XEN_ELF_LITTLE_ENDIAN -#elif defined(__powerpc__) -#define XEN_ELF_BIG_ENDIAN #else #error define architectural endianness #endif diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/physdev.h --- a/include/xen/interface/physdev.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/physdev.h Tue May 13 10:38:04 2008 +0900 @@ -121,6 +121,38 @@ struct physdev_irq { }; typedef struct physdev_irq physdev_irq_t; DEFINE_XEN_GUEST_HANDLE(physdev_irq_t); + +#define MAP_PIRQ_TYPE_MSI 0x0 +#define MAP_PIRQ_TYPE_GSI 0x1 +#define MAP_PIRQ_TYPE_UNKNOWN 0x2 + +#define PHYSDEVOP_map_pirq 13 +struct physdev_map_pirq { + domid_t domid; + /* IN */ + int type; + /* IN */ + int index; + /* IN or OUT */ + int pirq; + /* IN */ + struct { + int bus, devfn, entry_nr; + int msi; /* 0 - MSIX 1 - MSI */ + } msi_info; +}; +typedef struct physdev_map_pirq physdev_map_pirq_t; +DEFINE_XEN_GUEST_HANDLE(physdev_map_pirq_t); + +#define PHYSDEVOP_unmap_pirq 14 +struct physdev_unmap_pirq { + domid_t domid; + /* IN */ + int pirq; +}; + +typedef struct physdev_unmap_pirq physdev_unmap_pirq_t; +DEFINE_XEN_GUEST_HANDLE(physdev_unmap_pirq_t); /* * Argument to physdev_op_compat() hypercall. Superceded by new physdev_op() diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/platform.h --- a/include/xen/interface/platform.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/platform.h Tue May 13 10:38:04 2008 +0900 @@ -199,6 +199,70 @@ typedef struct xenpf_getidletime xenpf_g typedef struct xenpf_getidletime xenpf_getidletime_t; DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t); +#define XENPF_set_processor_pminfo 54 + +/* ability bits */ +#define XEN_PROCESSOR_PM_CX 1 +#define XEN_PROCESSOR_PM_PX 2 +#define XEN_PROCESSOR_PM_TX 4 + +/* cmd type */ +#define XEN_PM_CX 0 +#define XEN_PM_PX 1 +#define XEN_PM_TX 2 + +struct xen_power_register { + uint32_t space_id; + uint32_t bit_width; + uint32_t bit_offset; + uint32_t access_size; + uint64_t address; +}; + +struct xen_processor_csd { + uint32_t domain; /* domain number of one dependent group */ + uint32_t coord_type; /* coordination type */ + uint32_t num; /* number of processors in same domain */ +}; +typedef struct xen_processor_csd xen_processor_csd_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_csd_t); + +struct xen_processor_cx { + struct xen_power_register reg; /* GAS for Cx trigger register */ + uint8_t type; /* cstate value, c0: 0, c1: 1, ... */ + uint32_t latency; /* worst latency (ms) to enter/exit this cstate */ + uint32_t power; /* average power consumption(mW) */ + uint32_t dpcnt; /* number of dependency entries */ + XEN_GUEST_HANDLE(xen_processor_csd_t) dp; /* NULL if no dependency */ +}; +typedef struct xen_processor_cx xen_processor_cx_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_cx_t); + +struct xen_processor_flags { + uint32_t bm_control:1; + uint32_t bm_check:1; + uint32_t has_cst:1; + uint32_t power_setup_done:1; + uint32_t bm_rld_set:1; +}; + +struct xen_processor_power { + uint32_t count; /* number of C state entries in array below */ + struct xen_processor_flags flags; /* global flags of this processor */ + XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */ +}; + +struct xenpf_set_processor_pminfo { + /* IN variables */ + uint32_t id; /* ACPI CPU ID */ + uint32_t type; /* {XEN_PM_CX, ...} */ + union { + struct xen_processor_power power;/* Cx: _CST/_CSD */ + }; +}; +typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; +DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t); + struct xen_platform_op { uint32_t cmd; uint32_t interface_version; /* XENPF_INTERFACE_VERSION */ @@ -213,6 +277,7 @@ struct xen_platform_op { struct xenpf_enter_acpi_sleep enter_acpi_sleep; struct xenpf_change_freq change_freq; struct xenpf_getidletime getidletime; + struct xenpf_set_processor_pminfo set_pminfo; uint8_t pad[128]; } u; }; diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/sysctl.h --- a/include/xen/interface/sysctl.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/sysctl.h Tue May 13 10:38:04 2008 +0900 @@ -84,8 +84,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_ * Get physical information about the host machine */ #define XEN_SYSCTL_physinfo 3 + /* (x86) The platform supports HVM guests. */ +#define _XEN_SYSCTL_PHYSCAP_hvm 0 +#define XEN_SYSCTL_PHYSCAP_hvm (1u<<_XEN_SYSCTL_PHYSCAP_hvm) + /* (x86) The platform supports HVM-guest direct access to I/O devices. */ +#define _XEN_SYSCTL_PHYSCAP_hvm_directio 1 +#define XEN_SYSCTL_PHYSCAP_hvm_directio (1u<<_XEN_SYSCTL_PHYSCAP_hvm_directio) struct xen_sysctl_physinfo { - /* IN variables. */ uint32_t threads_per_core; uint32_t cores_per_socket; uint32_t nr_cpus; @@ -96,7 +101,6 @@ struct xen_sysctl_physinfo { uint64_aligned_t scrub_pages; uint32_t hw_cap[8]; - /* IN/OUT variables. */ /* * IN: maximum addressable entry in the caller-provided cpu_to_node array. * OUT: largest cpu identifier in the system. @@ -112,6 +116,9 @@ struct xen_sysctl_physinfo { * elements of the array will not be written by the sysctl. */ XEN_GUEST_HANDLE_64(uint32) cpu_to_node; + + /* XEN_SYSCTL_PHYSCAP_??? */ + uint32_t capabilities; }; typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_physinfo_t); diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/xen.h --- a/include/xen/interface/xen.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/xen.h Tue May 13 10:38:04 2008 +0900 @@ -33,8 +33,6 @@ #include "arch-x86/xen.h" #elif defined(__ia64__) #include "arch-ia64.h" -#elif defined(__powerpc__) -#include "arch-powerpc.h" #else #error "Unsupported architecture" #endif diff -r 5d938fac27a2 -r f6fcc65413ae include/xen/interface/xsm/acm.h --- a/include/xen/interface/xsm/acm.h Thu Apr 24 14:08:54 2008 -0600 +++ b/include/xen/interface/xsm/acm.h Tue May 13 10:38:04 2008 +0900 @@ -91,7 +91,7 @@ * whenever the interpretation of the related * policy's data structure changes */ -#define ACM_POLICY_VERSION 3 +#define ACM_POLICY_VERSION 4 #define ACM_CHWALL_VERSION 1 #define ACM_STE_VERSION 1 @@ -102,6 +102,7 @@ typedef uint32_t ssidref_t; #define ACMHOOK_none 0 #define ACMHOOK_sharing 1 #define ACMHOOK_authorization 2 +#define ACMHOOK_conflictset 3 /* -------security policy relevant type definitions-------- */ @@ -130,6 +131,10 @@ typedef uint16_t domaintype_t; /* high-16 = version, low-16 = check magic */ #define ACM_MAGIC 0x0001debc +/* size of the SHA1 hash identifying the XML policy from which the + binary policy was created */ +#define ACM_SHA1_HASH_SIZE 20 + /* each offset in bytes from start of the struct they * are part of */ @@ -159,6 +164,7 @@ struct acm_policy_buffer { uint32_t secondary_policy_code; uint32_t secondary_buffer_offset; struct acm_policy_version xml_pol_version; /* add in V3 */ + uint8_t xml_policy_hash[ACM_SHA1_HASH_SIZE]; /* added in V4 */ }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:47 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:47 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTpW-0002V1-Os for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:47 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTqB-0000Kp-0c; Tue, 20 May 2008 15:33:27 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTol-0007i8-Oy for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:59 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToY-0002zS-IG for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:57 +0000 X-SBRS: 3.6 X-MesageID: 267652 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267652" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:36 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUZjw029624 for ; Tue, 20 May 2008 08:30:35 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUsBa000396 for ; Tue, 20 May 2008 08:30:54 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUs8W000395 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:54 -0700 Message-Id: <200805201530.m4KFUs8W000395@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:52 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210836376 -32400 # Node ID 2d858799d109f2225882257c029c84ae10538972 # Parent e5933404dadad1fb144b8cc29caad044cc54a491 # Parent d59a4aaf8615aea0ff42349f0d0367be641c36b0 merge with linux-2.6.18-xen.hg --- arch/i386/kernel/acpi/processor_extcntl_xen.c | 95 +++++++++++++++++++- drivers/acpi/dispatcher/dsobject.c | 91 ++++++++++++++++++- drivers/acpi/processor_extcntl.c | 113 +++++++++++++++++++++++- drivers/acpi/processor_perflib.c | 8 + drivers/pci/msi-xen.c | 22 +--- drivers/xen/blkback/blkback.c | 3 drivers/xen/blktap/blktap.c | 3 drivers/xen/pciback/conf_space_capability_msi.c | 5 - include/acpi/processor.h | 2 include/xen/blkif.h | 10 +- include/xen/interface/hvm/hvm_op.h | 5 + include/xen/interface/io/pciif.h | 14 ++ include/xen/interface/platform.h | 51 ++++++++++ 13 files changed, 391 insertions(+), 31 deletions(-) diff -r e5933404dada -r 2d858799d109 arch/i386/kernel/acpi/processor_extcntl_xen.c --- a/arch/i386/kernel/acpi/processor_extcntl_xen.c Tue May 13 10:42:09 2008 +0900 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c Thu May 15 16:26:16 2008 +0900 @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -110,9 +111,101 @@ static int xen_cx_notifier(struct acpi_p return ret; } +static void convert_pct_reg(struct xen_pct_register *xpct, + struct acpi_pct_register *apct) +{ + xpct->descriptor = apct->descriptor; + xpct->length = apct->length; + xpct->space_id = apct->space_id; + xpct->bit_width = apct->bit_width; + xpct->bit_offset = apct->bit_offset; + xpct->reserved = apct->reserved; + xpct->address = apct->address; +} + +static void convert_pss_states(struct xen_processor_px *xpss, + struct acpi_processor_px *apss, int state_count) +{ + int i; + for(i=0; icore_frequency = apss->core_frequency; + xpss->power = apss->power; + xpss->transition_latency = apss->transition_latency; + xpss->bus_master_latency = apss->bus_master_latency; + xpss->control = apss->control; + xpss->status = apss->status; + xpss++; + apss++; + } +} + +static void convert_psd_pack(struct xen_psd_package *xpsd, + struct acpi_psd_package *apsd) +{ + xpsd->num_entries = apsd->num_entries; + xpsd->revision = apsd->revision; + xpsd->domain = apsd->domain; + xpsd->coord_type = apsd->coord_type; + xpsd->num_processors = apsd->num_processors; +} + static int xen_px_notifier(struct acpi_processor *pr, int action) { - return -EINVAL; + int ret; + xen_platform_op_t op = { + .cmd = XENPF_set_processor_pminfo, + .interface_version = XENPF_INTERFACE_VERSION, + .u.set_pminfo.id = pr->acpi_id, + .u.set_pminfo.type = XEN_PM_PX, + }; + struct xen_processor_performance *perf; + struct xen_processor_px *states = NULL; + struct acpi_processor_performance *px; + struct acpi_psd_package *pdomain; + + /* leave dynamic ppc handle in the future */ + if (action == PROCESSOR_PM_CHANGE) + return 0; + + perf = &op.u.set_pminfo.perf; + px = pr->performance; + + perf->flags = XEN_PX_PPC | + XEN_PX_PCT | + XEN_PX_PSS | + XEN_PX_PSD; + + /* ppc */ + perf->ppc = pr->performance_platform_limit; + + /* pct */ + convert_pct_reg(&perf->control_register, &px->control_register); + convert_pct_reg(&perf->status_register, &px->status_register); + + /* pss */ + perf->state_count = px->state_count; + states = kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL); + if (!states) + return -ENOMEM; + convert_pss_states(states, px->states, px->state_count); + set_xen_guest_handle(perf->states, states); + + /* psd */ + pdomain = &px->domain_info; + convert_psd_pack(&perf->domain_info, pdomain); + if (perf->domain_info.num_processors) { + if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL) + perf->shared_type = CPUFREQ_SHARED_TYPE_ALL; + else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) + perf->shared_type = CPUFREQ_SHARED_TYPE_ANY; + else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) + perf->shared_type = CPUFREQ_SHARED_TYPE_HW; + } else + perf->shared_type = CPUFREQ_SHARED_TYPE_NONE; + + ret = HYPERVISOR_platform_op(&op); + kfree(states); + return ret; } static int xen_tx_notifier(struct acpi_processor *pr, int action) diff -r e5933404dada -r 2d858799d109 drivers/acpi/dispatcher/dsobject.c --- a/drivers/acpi/dispatcher/dsobject.c Tue May 13 10:42:09 2008 +0900 +++ b/drivers/acpi/dispatcher/dsobject.c Thu May 15 16:26:16 2008 +0900 @@ -137,6 +137,71 @@ acpi_ds_build_internal_object(struct acp return_ACPI_STATUS(status); } } + + /* Special object resolution for elements of a package */ + + if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) || + (op->common.parent->common.aml_opcode == + AML_VAR_PACKAGE_OP)) { + /* + * Attempt to resolve the node to a value before we insert it into + * the package. If this is a reference to a common data type, + * resolve it immediately. According to the ACPI spec, package + * elements can only be "data objects" or method references. + * Attempt to resolve to an Integer, Buffer, String or Package. + * If cannot, return the named reference (for things like Devices, + * Methods, etc.) Buffer Fields and Fields will resolve to simple + * objects (int/buf/str/pkg). + * + * NOTE: References to things like Devices, Methods, Mutexes, etc. + * will remain as named references. This behavior is not described + * in the ACPI spec, but it appears to be an oversight. + */ + obj_desc = (union acpi_operand_object *)op->common.node; + + status = + acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR + (struct + acpi_namespace_node, + &obj_desc), + walk_state); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + switch (op->common.node->type) { + /* + * For these types, we need the actual node, not the subobject. + * However, the subobject got an extra reference count above. + */ + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_METHOD: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_REGION: + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + obj_desc = + (union acpi_operand_object *)op->common. + node; + break; + + default: + break; + } + + /* + * If above resolved to an operand object, we are done. Otherwise, + * we have a NS node, we must create the package entry as a named + * reference. + */ + if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != + ACPI_DESC_TYPE_NAMED) { + goto exit; + } + } } /* Create and init a new internal ACPI object */ @@ -156,6 +221,7 @@ acpi_ds_build_internal_object(struct acp return_ACPI_STATUS(status); } + exit: *obj_desc_ptr = obj_desc; return_ACPI_STATUS(AE_OK); } @@ -358,12 +424,25 @@ acpi_ds_build_internal_package_obj(struc arg = arg->common.next; for (i = 0; arg; i++) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { - - /* Object (package or buffer) is already built */ - - obj_desc->package.elements[i] = - ACPI_CAST_PTR(union acpi_operand_object, - arg->common.node); + if (arg->common.node->type == ACPI_TYPE_METHOD) { + /* + * A method reference "looks" to the parser to be a method + * invocation, so we special case it here + */ + arg->common.aml_opcode = AML_INT_NAMEPATH_OP; + status = + acpi_ds_build_internal_object(walk_state, + arg, + &obj_desc-> + package. + elements[i]); + } else { + /* This package element is already built, just get it */ + + obj_desc->package.elements[i] = + ACPI_CAST_PTR(union acpi_operand_object, + arg->common.node); + } } else { status = acpi_ds_build_internal_object(walk_state, arg, &obj_desc-> diff -r e5933404dada -r 2d858799d109 drivers/acpi/processor_extcntl.c --- a/drivers/acpi/processor_extcntl.c Tue May 13 10:42:09 2008 +0900 +++ b/drivers/acpi/processor_extcntl.c Thu May 15 16:26:16 2008 +0900 @@ -31,11 +31,49 @@ #include static int processor_extcntl_parse_csd(struct acpi_processor *pr); +static int processor_extcntl_get_performance(struct acpi_processor *pr); /* * External processor control logic may register with its own set of * ops to get ACPI related notification. One example is like VMM. */ struct processor_extcntl_ops *processor_extcntl_ops; + +static int processor_notify_smm(void) +{ + acpi_status status; + static int is_done = 0; + + /* only need successfully notify BIOS once */ + /* avoid double notification which may lead to unexpected result */ + if (is_done) + return 0; + + /* Can't write pstate_cnt to smi_cmd if either value is zero */ + if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO,"No SMI port or pstate_cnt\n")); + return 0; + } + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", + acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); + + /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use + * it anyway, so we need to support it... */ + if (acpi_fadt_is_v1) { + ACPI_DEBUG_PRINT((ACPI_DB_INFO, + "Using v1.0 FADT reserved value for pstate_cnt\n")); + } + + status = acpi_os_write_port(acpi_fadt.smi_cmd, + (u32) acpi_fadt.pstate_cnt, 8); + if (ACPI_FAILURE(status)) + return status; + + is_done = 1; + + return 0; +} int processor_notify_external(struct acpi_processor *pr, int event, int type) { @@ -109,7 +147,12 @@ int processor_extcntl_init(struct acpi_p int processor_extcntl_init(struct acpi_processor *pr) { /* parse cstate dependency information */ - processor_extcntl_parse_csd(pr); + if (processor_pm_external()) + processor_extcntl_parse_csd(pr); + + /* Initialize performance states */ + if (processor_pmperf_external()) + processor_extcntl_get_performance(pr); return 0; } @@ -135,3 +178,71 @@ static int processor_extcntl_parse_csd(s return 0; } + +/* + * Existing ACPI module does parse performance states at some point, + * when acpi-cpufreq driver is loaded which however is something + * we'd like to disable to avoid confliction with external control + * logic. So we have to collect raw performance information here + * when ACPI processor object is found and started. + */ +#ifdef CONFIG_CPU_FREQ +static int processor_extcntl_get_performance(struct acpi_processor *pr) +{ + int ret; + struct acpi_processor_performance *perf; + struct acpi_psd_package *pdomain; + + if (pr->performance) + return -EBUSY; + + perf = kzalloc(sizeof(struct acpi_processor_performance), GFP_KERNEL); + if (!perf) + return -ENOMEM; + + pr->performance = perf; + /* Get basic performance state information */ + ret = acpi_processor_get_performance_info(pr); + if (ret < 0) + goto err_out; + + /* + * Well, here we need retrieve performance dependency information + * from _PSD object. The reason why existing interface is not used + * is due to the reason that existing interface sticks to Linux cpu + * id to construct some bitmap, however we want to split ACPI + * processor objects from Linux cpu id logic. For example, even + * when Linux is configured as UP, we still want to parse all ACPI + * processor objects to external logic. In this case, it's preferred + * to use ACPI ID instead. + */ + pr->performance->domain_info.num_processors = 0; + ret = acpi_processor_get_psd(pr); + if (ret < 0) + goto err_out; + + /* Some sanity check */ + pdomain = &pr->performance->domain_info; + if ((pdomain->revision != ACPI_PSD_REV0_REVISION) || + (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) || + ((pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL) && + (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY) && + (pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL))) { + ret = -EINVAL; + goto err_out; + } + + /* Last step is to notify BIOS that external logic exists */ + processor_notify_smm(); + + processor_notify_external(pr, PROCESSOR_PM_INIT, PM_TYPE_PERF); + + return 0; +err_out: + pr->performance = NULL; + kfree(perf); + return ret; +} +#else +static int processor_extcntl_get_performance(struct acpi_processor *pr) { return 0; } +#endif diff -r e5933404dada -r 2d858799d109 drivers/acpi/processor_perflib.c --- a/drivers/acpi/processor_perflib.c Tue May 13 10:42:09 2008 +0900 +++ b/drivers/acpi/processor_perflib.c Thu May 15 16:26:16 2008 +0900 @@ -304,7 +304,11 @@ static int acpi_processor_get_performanc return result; } +#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL static int acpi_processor_get_performance_info(struct acpi_processor *pr) +#else +int acpi_processor_get_performance_info(struct acpi_processor *pr) +#endif { int result = 0; acpi_status status = AE_OK; @@ -543,7 +547,11 @@ static void acpi_cpufreq_remove_file(str } #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ +#ifndef CONFIG_PROCESSOR_EXTERNAL_CONTROL static int acpi_processor_get_psd(struct acpi_processor *pr) +#else +int acpi_processor_get_psd(struct acpi_processor *pr) +#endif { int result = 0; acpi_status status = AE_OK; diff -r e5933404dada -r 2d858799d109 drivers/pci/msi-xen.c --- a/drivers/pci/msi-xen.c Tue May 13 10:42:09 2008 +0900 +++ b/drivers/pci/msi-xen.c Thu May 15 16:26:16 2008 +0900 @@ -32,7 +32,7 @@ int msi_register(struct msi_ops *ops) return 0; } -static struct list_head msi_dev_head; +static LIST_HEAD(msi_dev_head); static int msi_dev_head_inited = 0; DEFINE_SPINLOCK(msi_dev_lock); @@ -54,11 +54,6 @@ static struct msi_dev_list *get_msi_dev_ struct msi_dev_list *msi_dev_list, *ret = NULL; unsigned long flags; - if (!msi_dev_head_inited) { - INIT_LIST_HEAD(&msi_dev_head); - msi_dev_head_inited = 1; - } - spin_lock_irqsave(&msi_dev_lock, flags); list_for_each_entry(msi_dev_list, &msi_dev_head, list) @@ -79,10 +74,10 @@ static struct msi_dev_list *get_msi_dev_ return NULL; } + spin_lock_init(&ret->pirq_list_lock); + INIT_LIST_HEAD(&ret->pirq_list_head); list_add_tail(&ret->list, &msi_dev_head); spin_unlock_irqrestore(&msi_dev_lock, flags); - spin_lock_init(&ret->pirq_list_lock); - INIT_LIST_HEAD(&ret->pirq_list_head); return ret; } @@ -304,10 +299,9 @@ int pci_save_msix_state(struct pci_dev * msi_dev_entry = get_msi_dev_pirq_list(dev); spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) - list_for_each_entry_safe(pirq_entry, tmp, - &msi_dev_entry->pirq_list_head, list) - msi_unmap_pirq(dev, pirq_entry->pirq); + list_for_each_entry_safe(pirq_entry, tmp, + &msi_dev_entry->pirq_list_head, list) + msi_unmap_pirq(dev, pirq_entry->pirq); spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); disable_msi_mode(dev, pos, PCI_CAP_ID_MSIX); @@ -394,7 +388,7 @@ static int msix_capability_init(struct p return -ENOMEM; spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + if (!list_empty(&msi_dev_entry->pirq_list_head)) { printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), @@ -677,7 +671,7 @@ void msi_remove_pci_irq_vectors(struct p msi_dev_entry = get_msi_dev_pirq_list(dev); spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - if (!list_empty_careful(&msi_dev_entry->pirq_list_head)) + if (!list_empty(&msi_dev_entry->pirq_list_head)) { printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), diff -r e5933404dada -r 2d858799d109 drivers/xen/blkback/blkback.c --- a/drivers/xen/blkback/blkback.c Tue May 13 10:42:09 2008 +0900 +++ b/drivers/xen/blkback/blkback.c Thu May 15 16:26:16 2008 +0900 @@ -343,6 +343,9 @@ static int do_block_io_op(blkif_t *blkif BUG(); } blk_rings->common.req_cons = ++rc; /* before make_response() */ + + /* Apply all sanity checks to /private copy/ of request. */ + barrier(); switch (req.operation) { case BLKIF_OP_READ: diff -r e5933404dada -r 2d858799d109 drivers/xen/blktap/blktap.c --- a/drivers/xen/blktap/blktap.c Tue May 13 10:42:09 2008 +0900 +++ b/drivers/xen/blktap/blktap.c Thu May 15 16:26:16 2008 +0900 @@ -1264,6 +1264,9 @@ static int do_block_io_op(blkif_t *blkif } blk_rings->common.req_cons = ++rc; /* before make_response() */ + /* Apply all sanity checks to /private copy/ of request. */ + barrier(); + switch (req.operation) { case BLKIF_OP_READ: blkif->st_rd_req++; diff -r e5933404dada -r 2d858799d109 drivers/xen/pciback/conf_space_capability_msi.c --- a/drivers/xen/pciback/conf_space_capability_msi.c Tue May 13 10:42:09 2008 +0900 +++ b/drivers/xen/pciback/conf_space_capability_msi.c Thu May 15 16:26:16 2008 +0900 @@ -11,7 +11,6 @@ int pciback_enable_msi(struct pciback_de struct pci_dev *dev, struct xen_pci_op *op) { int otherend = pdev->xdev->otherend_id; - int irq; int status; status = pci_enable_msi(dev); @@ -29,8 +28,6 @@ int pciback_disable_msi(struct pciback_d int pciback_disable_msi(struct pciback_device *pdev, struct pci_dev *dev, struct xen_pci_op *op) { - int old_irq = dev->irq; - pci_disable_msi(dev); op->value = dev->irq; @@ -40,7 +37,7 @@ int pciback_enable_msix(struct pciback_d int pciback_enable_msix(struct pciback_device *pdev, struct pci_dev *dev, struct xen_pci_op *op) { - int otherend = pdev->xdev->otherend_id, result, i; + int result; result = pci_enable_msix(dev, op->msix_entries, op->value); diff -r e5933404dada -r 2d858799d109 include/acpi/processor.h --- a/include/acpi/processor.h Tue May 13 10:42:09 2008 +0900 +++ b/include/acpi/processor.h Thu May 15 16:26:16 2008 +0900 @@ -353,6 +353,8 @@ extern int processor_register_extcntl(st extern int processor_register_extcntl(struct processor_extcntl_ops *ops); extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops); extern int processor_extcntl_init(struct acpi_processor *pr); +extern int acpi_processor_get_performance_info(struct acpi_processor *pr); +extern int acpi_processor_get_psd(struct acpi_processor *pr); #else static inline int processor_cntl_external(void) {return 0;} static inline int processor_pm_external(void) {return 0;} diff -r e5933404dada -r 2d858799d109 include/xen/blkif.h --- a/include/xen/blkif.h Tue May 13 10:42:09 2008 +0900 +++ b/include/xen/blkif.h Thu May 15 16:26:16 2008 +0900 @@ -98,8 +98,9 @@ static void inline blkif_get_x86_32_req( dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; - if (n > src->nr_segments) - n = src->nr_segments; + barrier(); + if (n > dst->nr_segments) + n = dst->nr_segments; for (i = 0; i < n; i++) dst->seg[i] = src->seg[i]; } @@ -112,8 +113,9 @@ static void inline blkif_get_x86_64_req( dst->handle = src->handle; dst->id = src->id; dst->sector_number = src->sector_number; - if (n > src->nr_segments) - n = src->nr_segments; + barrier(); + if (n > dst->nr_segments) + n = dst->nr_segments; for (i = 0; i < n; i++) dst->seg[i] = src->seg[i]; } diff -r e5933404dada -r 2d858799d109 include/xen/interface/hvm/hvm_op.h --- a/include/xen/interface/hvm/hvm_op.h Tue May 13 10:42:09 2008 +0900 +++ b/include/xen/interface/hvm/hvm_op.h Thu May 15 16:26:16 2008 +0900 @@ -73,6 +73,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_pci_ /* Flushes all VCPU TLBs: @arg must be NULL. */ #define HVMOP_flush_tlbs 5 +/* Following tools-only interfaces may change in future. */ +#if defined(__XEN__) || defined(__XEN_TOOLS__) + /* Track dirty VRAM. */ #define HVMOP_track_dirty_vram 6 struct xen_hvm_track_dirty_vram { @@ -89,4 +92,6 @@ typedef struct xen_hvm_track_dirty_vram typedef struct xen_hvm_track_dirty_vram xen_hvm_track_dirty_vram_t; DEFINE_XEN_GUEST_HANDLE(xen_hvm_track_dirty_vram_t); +#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ + #endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ diff -r e5933404dada -r 2d858799d109 include/xen/interface/io/pciif.h --- a/include/xen/interface/io/pciif.h Tue May 13 10:42:09 2008 +0900 +++ b/include/xen/interface/io/pciif.h Thu May 15 16:26:16 2008 +0900 @@ -34,6 +34,10 @@ /* xen_pci_op commands */ #define XEN_PCI_OP_conf_read (0) #define XEN_PCI_OP_conf_write (1) +#define XEN_PCI_OP_enable_msi (2) +#define XEN_PCI_OP_disable_msi (3) +#define XEN_PCI_OP_enable_msix (4) +#define XEN_PCI_OP_disable_msix (5) /* xen_pci_op error numbers */ #define XEN_PCI_ERR_success (0) @@ -43,6 +47,12 @@ #define XEN_PCI_ERR_not_implemented (-4) /* XEN_PCI_ERR_op_failed - backend failed to complete the operation */ #define XEN_PCI_ERR_op_failed (-5) + +/* + * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry)) + * Should not exceed 128 + */ +#define SH_INFO_MAX_VEC 128 struct xen_pci_op { /* IN: what action to perform: XEN_PCI_OP_* */ @@ -62,6 +72,10 @@ struct xen_pci_op { /* IN/OUT: Contains the result after a READ or the value to WRITE */ uint32_t value; + /* IN: Contains extra infor for this operation */ + uint32_t info; + /*IN: param for msi-x */ + struct msix_entry msix_entries[SH_INFO_MAX_VEC]; }; struct xen_pci_sharedinfo { diff -r e5933404dada -r 2d858799d109 include/xen/interface/platform.h --- a/include/xen/interface/platform.h Tue May 13 10:42:09 2008 +0900 +++ b/include/xen/interface/platform.h Thu May 15 16:26:16 2008 +0900 @@ -211,6 +211,12 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_getidletim #define XEN_PM_PX 1 #define XEN_PM_TX 2 +/* Px sub info type */ +#define XEN_PX_PCT 1 +#define XEN_PX_PSS 2 +#define XEN_PX_PPC 4 +#define XEN_PX_PSD 8 + struct xen_power_register { uint32_t space_id; uint32_t bit_width; @@ -252,12 +258,55 @@ struct xen_processor_power { XEN_GUEST_HANDLE(xen_processor_cx_t) states; /* supported c states */ }; +struct xen_pct_register { + uint8_t descriptor; + uint16_t length; + uint8_t space_id; + uint8_t bit_width; + uint8_t bit_offset; + uint8_t reserved; + uint64_t address; +}; + +struct xen_processor_px { + uint64_t core_frequency; /* megahertz */ + uint64_t power; /* milliWatts */ + uint64_t transition_latency; /* microseconds */ + uint64_t bus_master_latency; /* microseconds */ + uint64_t control; /* control value */ + uint64_t status; /* success indicator */ +}; +typedef struct xen_processor_px xen_processor_px_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_px_t); + +struct xen_psd_package { + uint64_t num_entries; + uint64_t revision; + uint64_t domain; + uint64_t coord_type; + uint64_t num_processors; +}; + +struct xen_processor_performance { + uint32_t flags; /* flag for Px sub info type */ + uint32_t ppc; /* Platform limitation on freq usage */ + struct xen_pct_register control_register; + struct xen_pct_register status_register; + uint32_t state_count; /* total available performance states */ + XEN_GUEST_HANDLE(xen_processor_px_t) states; + struct xen_psd_package domain_info; + uint32_t shared_type; /* coordination type of this processor */ +}; +typedef struct xen_processor_performance xen_processor_performance_t; +DEFINE_XEN_GUEST_HANDLE(xen_processor_performance_t); + struct xenpf_set_processor_pminfo { /* IN variables */ uint32_t id; /* ACPI CPU ID */ - uint32_t type; /* {XEN_PM_CX, ...} */ + uint32_t type; /* {XEN_PM_CX, XEN_PM_PX} */ union { struct xen_processor_power power;/* Cx: _CST/_CSD */ + struct xen_processor_performance perf; /* Px: _PPC/_PCT/_PSS/_PSD */ }; }; typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:32:51 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:32:51 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyTpb-0002V6-9O for www-data@colo.xensource.com; Tue, 20 May 2008 08:32:51 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTqF-0000Ow-JI; Tue, 20 May 2008 15:33:31 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyTos-0007n7-60 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:32:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToe-0002zQ-2X for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:32:04 +0000 X-SBRS: 3.6 X-MesageID: 267653 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267653" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:37 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUbBE029627 for ; Tue, 20 May 2008 08:30:37 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUtpj000413 for ; Tue, 20 May 2008 08:30:55 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUt3n000412 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:55 -0700 Message-Id: <200805201530.m4KFUt3n000412@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:54 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1211250813 -32400 # Node ID 6b0a85eb515569490f4a02876c95d2b1153d444a # Parent 2d858799d109f2225882257c029c84ae10538972 # Parent 8ce60d057d0c4d4394df2c5fab4965d4ec189722 merge with linux-2.6.18-xen.hg --- arch/x86_64/mm/init-xen.c | 54 +++++++++++++-------------- arch/x86_64/mm/pageattr-xen.c | 2 - drivers/pci/msi-xen.c | 60 +++++++++++++++++++----------- drivers/xen/balloon/balloon.c | 6 ++- include/asm-i386/mach-xen/asm/pgtable.h | 17 +++----- include/asm-x86_64/mach-xen/asm/pgtable.h | 19 ++++----- include/xen/interface/sysctl.h | 35 +++++++++++++++++ 7 files changed, 121 insertions(+), 72 deletions(-) diff -r 2d858799d109 -r 6b0a85eb5155 arch/x86_64/mm/init-xen.c --- a/arch/x86_64/mm/init-xen.c Thu May 15 16:26:16 2008 +0900 +++ b/arch/x86_64/mm/init-xen.c Tue May 20 11:33:33 2008 +0900 @@ -59,6 +59,8 @@ EXPORT_SYMBOL(__kernel_page_user); EXPORT_SYMBOL(__kernel_page_user); #endif +int after_bootmem; + extern unsigned long *contiguous_bitmap; static unsigned long dma_reserve __initdata; @@ -82,6 +84,8 @@ static void __meminit early_make_page_re unsigned long addr, _va = (unsigned long)va; pte_t pte, *ptep; unsigned long *page = (unsigned long *) init_level4_pgt; + + BUG_ON(after_bootmem); if (xen_feature(feature)) return; @@ -207,7 +211,6 @@ void show_mem(void) printk(KERN_INFO "%lu pages swap cached\n",cached); } -int after_bootmem; static __init void *spp_getpage(void) { @@ -373,11 +376,6 @@ static __meminit void *alloc_static_page #define PTE_SIZE PAGE_SIZE -static inline void __set_pte(pte_t *dst, pte_t val) -{ - *dst = val; -} - static inline int make_readonly(unsigned long paddr) { extern char __vsyscall_0; @@ -446,28 +444,28 @@ phys_pmd_init(pmd_t *pmd, unsigned long unsigned long pte_phys; pte_t *pte, *pte_save; - if (address >= end) { - if (!after_bootmem) - for (; i < PTRS_PER_PMD; i++, pmd++) - set_pmd(pmd, __pmd(0)); + if (address >= end) break; - } pte = alloc_static_page(&pte_phys); pte_save = pte; for (k = 0; k < PTRS_PER_PTE; pte++, k++, address += PTE_SIZE) { unsigned long pteval = address | _PAGE_NX | _KERNPG_TABLE; - if ((address >= end) || - ((address >> PAGE_SHIFT) >= - xen_start_info->nr_pages)) + if (address >= (after_bootmem + ? end + : xen_start_info->nr_pages << PAGE_SHIFT)) pteval = 0; else if (make_readonly(address)) pteval &= ~_PAGE_RW; - __set_pte(pte, __pte(pteval & __supported_pte_mask)); - } - pte = pte_save; - early_make_page_readonly(pte, XENFEAT_writable_page_tables); - set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE)); + set_pte(pte, __pte(pteval & __supported_pte_mask)); + } + if (!after_bootmem) { + early_make_page_readonly(pte_save, XENFEAT_writable_page_tables); + *pmd = __pmd(pte_phys | _KERNPG_TABLE); + } else { + make_page_readonly(pte_save, XENFEAT_writable_page_tables); + set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE)); + } } } @@ -504,11 +502,13 @@ static void __meminit phys_pud_init(pud_ break; pmd = alloc_static_page(&pmd_phys); - early_make_page_readonly(pmd, XENFEAT_writable_page_tables); + spin_lock(&init_mm.page_table_lock); - set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE)); + *pud = __pud(pmd_phys | _KERNPG_TABLE); phys_pmd_init(pmd, paddr, end); spin_unlock(&init_mm.page_table_lock); + + early_make_page_readonly(pmd, XENFEAT_writable_page_tables); } __flush_tlb(); } @@ -739,20 +739,18 @@ void __meminit init_memory_mapping(unsig pgd_t *pgd = pgd_offset_k(start); pud_t *pud; - if (after_bootmem) { + if (after_bootmem) pud = pud_offset(pgd, start & PGDIR_MASK); - make_page_readonly(pud, XENFEAT_writable_page_tables); - pud_phys = __pa(pud); - } else { + else pud = alloc_static_page(&pud_phys); - early_make_page_readonly(pud, XENFEAT_writable_page_tables); - } next = start + PGDIR_SIZE; if (next > end) next = end; phys_pud_init(pud, __pa(start), __pa(next)); - if (!after_bootmem) + if (!after_bootmem) { + early_make_page_readonly(pud, XENFEAT_writable_page_tables); set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys)); + } } if (!after_bootmem) { diff -r 2d858799d109 -r 6b0a85eb5155 arch/x86_64/mm/pageattr-xen.c --- a/arch/x86_64/mm/pageattr-xen.c Thu May 15 16:26:16 2008 +0900 +++ b/arch/x86_64/mm/pageattr-xen.c Tue May 20 11:33:33 2008 +0900 @@ -276,7 +276,7 @@ void pte_free(struct page *pte) } #endif /* CONFIG_XEN */ -static inline pte_t *lookup_address(unsigned long address) +pte_t *lookup_address(unsigned long address) { pgd_t *pgd = pgd_offset_k(address); pud_t *pud; diff -r 2d858799d109 -r 6b0a85eb5155 drivers/pci/msi-xen.c --- a/drivers/pci/msi-xen.c Thu May 15 16:26:16 2008 +0900 +++ b/drivers/pci/msi-xen.c Tue May 20 11:33:33 2008 +0900 @@ -33,7 +33,6 @@ int msi_register(struct msi_ops *ops) } static LIST_HEAD(msi_dev_head); -static int msi_dev_head_inited = 0; DEFINE_SPINLOCK(msi_dev_lock); struct msi_dev_list { @@ -95,6 +94,23 @@ static int attach_pirq_entry(int pirq, i list_add_tail(&entry->list, &msi_dev_entry->pirq_list_head); spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); return 0; +} + +static void detach_pirq_entry(int entry_nr, + struct msi_dev_list *msi_dev_entry) +{ + unsigned long flags; + struct msi_pirq_entry *pirq_entry; + + list_for_each_entry(pirq_entry, &msi_dev_entry->pirq_list_head, list) { + if (pirq_entry->entry_nr == entry_nr) { + spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); + list_del(&pirq_entry->list); + spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); + kfree(pirq_entry); + return; + } + } } /* @@ -379,40 +395,42 @@ static int msix_capability_init(struct p static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, int nvec) { - int pirq, i, pos; + int pirq, i, j, mapped, pos; struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev); - struct msi_pirq_entry *pirq_entry, *tmp; - unsigned long flags; + struct msi_pirq_entry *pirq_entry; if (!msi_dev_entry) return -ENOMEM; - spin_lock_irqsave(&msi_dev_entry->pirq_list_lock, flags); - if (!list_empty(&msi_dev_entry->pirq_list_head)) - { - printk(KERN_WARNING "msix pirqs for dev %02x:%02x:%01x are not freed \ - before acquire again.\n", dev->bus->number, PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn)); - list_for_each_entry_safe(pirq_entry, tmp, - &msi_dev_entry->pirq_list_head, list) { - msi_unmap_pirq(dev, pirq_entry->pirq); - list_del(&pirq_entry->list); - kfree(pirq_entry); - } - } - spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags); - /* MSI-X Table Initialization */ for (i = 0; i < nvec; i++) { + mapped = 0; + list_for_each_entry(pirq_entry, &msi_dev_entry->pirq_list_head, list) { + if (pirq_entry->entry_nr == entries[i].entry) { + printk(KERN_WARNING "msix entry %d for dev %02x:%02x:%01x are \ + not freed before acquire again.\n", entries[i].entry, + dev->bus->number, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + (entries + i)->vector = pirq_entry->pirq; + mapped = 1; + break; + } + } + if (mapped) + continue; pirq = msi_map_vector(dev, entries[i].entry, 0); if (pirq < 0) break; attach_pirq_entry(pirq, entries[i].entry, msi_dev_entry); (entries + i)->vector = pirq; } + if (i != nvec) { - msi_unmap_pirq(dev, dev->irq); - (entries + i)->vector = 0; + for (j = --i; j >= 0; j--) { + msi_unmap_pirq(dev, entries[j].vector); + detach_pirq_entry(entries[j].entry, msi_dev_entry); + entries[j].vector = 0; + } return -EBUSY; } diff -r 2d858799d109 -r 6b0a85eb5155 drivers/xen/balloon/balloon.c --- a/drivers/xen/balloon/balloon.c Thu May 15 16:26:16 2008 +0900 +++ b/drivers/xen/balloon/balloon.c Tue May 20 11:33:33 2008 +0900 @@ -197,8 +197,8 @@ static unsigned long minimum_target(void static unsigned long minimum_target(void) { #ifndef CONFIG_XEN - return 0; -#else +#define max_pfn num_physpages +#endif unsigned long min_pages, curr_pages = current_target(); #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) @@ -226,6 +226,8 @@ static unsigned long minimum_target(void /* Don't enforce growth */ return min(min_pages, curr_pages); +#ifndef CONFIG_XEN +#undef max_pfn #endif } diff -r 2d858799d109 -r 6b0a85eb5155 include/asm-i386/mach-xen/asm/pgtable.h --- a/include/asm-i386/mach-xen/asm/pgtable.h Thu May 15 16:26:16 2008 +0900 +++ b/include/asm-i386/mach-xen/asm/pgtable.h Tue May 20 11:33:33 2008 +0900 @@ -477,19 +477,16 @@ void make_pages_readonly(void *va, unsig void make_pages_readonly(void *va, unsigned int nr, unsigned int feature); void make_pages_writable(void *va, unsigned int nr, unsigned int feature); -#define virt_to_ptep(__va) \ +#define virt_to_ptep(va) \ ({ \ - pgd_t *__pgd = pgd_offset_k((unsigned long)(__va)); \ - pud_t *__pud = pud_offset(__pgd, (unsigned long)(__va)); \ - pmd_t *__pmd = pmd_offset(__pud, (unsigned long)(__va)); \ - pte_offset_kernel(__pmd, (unsigned long)(__va)); \ + pte_t *__ptep = lookup_address((unsigned long)(va)); \ + BUG_ON(!__ptep || !pte_present(*__ptep)); \ + __ptep; \ }) -#define arbitrary_virt_to_machine(__va) \ -({ \ - maddr_t m = (maddr_t)pte_mfn(*virt_to_ptep(__va)) << PAGE_SHIFT;\ - m | ((unsigned long)(__va) & (PAGE_SIZE-1)); \ -}) +#define arbitrary_virt_to_machine(va) \ + (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ + | ((unsigned long)(va) & (PAGE_SIZE - 1))) #endif /* !__ASSEMBLY__ */ diff -r 2d858799d109 -r 6b0a85eb5155 include/asm-x86_64/mach-xen/asm/pgtable.h --- a/include/asm-x86_64/mach-xen/asm/pgtable.h Thu May 15 16:26:16 2008 +0900 +++ b/include/asm-x86_64/mach-xen/asm/pgtable.h Tue May 20 11:33:33 2008 +0900 @@ -18,19 +18,18 @@ extern pud_t level3_user_pgt[512]; extern void xen_init_pt(void); -#define virt_to_ptep(__va) \ +extern pte_t *lookup_address(unsigned long address); + +#define virt_to_ptep(va) \ ({ \ - pgd_t *__pgd = pgd_offset_k((unsigned long)(__va)); \ - pud_t *__pud = pud_offset(__pgd, (unsigned long)(__va)); \ - pmd_t *__pmd = pmd_offset(__pud, (unsigned long)(__va)); \ - pte_offset_kernel(__pmd, (unsigned long)(__va)); \ + pte_t *__ptep = lookup_address((unsigned long)(va)); \ + BUG_ON(!__ptep || !pte_present(*__ptep)); \ + __ptep; \ }) -#define arbitrary_virt_to_machine(__va) \ -({ \ - maddr_t m = (maddr_t)pte_mfn(*virt_to_ptep(__va)) << PAGE_SHIFT;\ - m | ((unsigned long)(__va) & (PAGE_SIZE-1)); \ -}) +#define arbitrary_virt_to_machine(va) \ + (((maddr_t)pte_mfn(*virt_to_ptep(va)) << PAGE_SHIFT) \ + | ((unsigned long)(va) & (PAGE_SIZE - 1))) #endif extern pud_t level3_kernel_pgt[512]; diff -r 2d858799d109 -r 6b0a85eb5155 include/xen/interface/sysctl.h --- a/include/xen/interface/sysctl.h Thu May 15 16:26:16 2008 +0900 +++ b/include/xen/interface/sysctl.h Tue May 20 11:33:33 2008 +0900 @@ -212,6 +212,40 @@ struct xen_sysctl_availheap { }; typedef struct xen_sysctl_availheap xen_sysctl_availheap_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_availheap_t); + +#define XEN_SYSCTL_get_pmstat 10 +struct pm_px_val { + uint64_aligned_t freq; /* Px core frequency */ + uint64_aligned_t residency; /* Px residency time */ + uint64_aligned_t count; /* Px transition count */ +}; +typedef struct pm_px_val pm_px_val_t; +DEFINE_XEN_GUEST_HANDLE(pm_px_val_t); + +struct pm_px_stat { + uint8_t total; /* total Px states */ + uint8_t usable; /* usable Px states */ + uint8_t last; /* last Px state */ + uint8_t cur; /* current Px state */ + XEN_GUEST_HANDLE_64(uint64) trans_pt; /* Px transition table */ + XEN_GUEST_HANDLE_64(pm_px_val_t) pt; +}; +typedef struct pm_px_stat pm_px_stat_t; +DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t); + +struct xen_sysctl_get_pmstat { +#define PMSTAT_get_max_px 0x11 +#define PMSTAT_get_pxstat 0x12 +#define PMSTAT_reset_pxstat 0x13 + uint32_t type; + uint32_t cpuid; + union { + struct pm_px_stat getpx; + /* other struct for cx, tx, etc */ + } u; +}; +typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t; +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t); struct xen_sysctl { uint32_t cmd; @@ -226,6 +260,7 @@ struct xen_sysctl { struct xen_sysctl_debug_keys debug_keys; struct xen_sysctl_getcpuinfo getcpuinfo; struct xen_sysctl_availheap availheap; + struct xen_sysctl_get_pmstat get_pmstat; uint8_t pad[128]; } u; }; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 08:59:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 08:59:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyUF5-0002xE-Qj for www-data@colo.xensource.com; Tue, 20 May 2008 08:59:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyUFk-0001tG-41; Tue, 20 May 2008 15:59:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyUFi-0001sV-Cb for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:59:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyToT-0002zM-Rb for xen-changelog@lists.xensource.com; Tue, 20 May 2008 15:31:52 +0000 X-SBRS: 3.6 X-MesageID: 267651 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,516,1204520400"; d="scan'208";a="267651" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 11:30:34 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUY2K029621 for ; Tue, 20 May 2008 08:30:34 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KFUqX9000377 for ; Tue, 20 May 2008 08:30:52 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KFUpAK000375 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 08:30:52 -0700 Message-Id: <200805201530.m4KFUpAK000375@xenbits.xensource.com> Date: Tue, 20 May 2008 08:30:51 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] [IA64] implement xencomm routine for HVMOP_track_dirty_vram. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Isaku Yamahata # Date 1210642929 -32400 # Node ID e5933404dadad1fb144b8cc29caad044cc54a491 # Parent f6fcc65413aee0da4b6b1df03a876342fd526667 [IA64] implement xencomm routine for HVMOP_track_dirty_vram. This patches implement xencomm routine for HVMOP_track_dirty_vram hypercall. Without this, using vfb results in annoying messages in dom0 as > xencomm_privcmd_hvm_op: unknown HVMOP 6 xen/ia64 doesn't implement the hypercall at this moment so that it simply returns -ENOSYS. So the xencomm routine returns -ENOSYS directly without issuing the useless hypercall. Signed-off-by: Isaku Yamahata --- arch/ia64/xen/xcom_privcmd.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+) diff -r f6fcc65413ae -r e5933404dada arch/ia64/xen/xcom_privcmd.c --- a/arch/ia64/xen/xcom_privcmd.c Tue May 13 10:38:04 2008 +0900 +++ b/arch/ia64/xen/xcom_privcmd.c Tue May 13 10:42:09 2008 +0900 @@ -661,6 +661,41 @@ xencomm_privcmd_event_channel_op(privcmd } static int +xencomm_privcmd_hvm_op_track_dirty_vram(privcmd_hypercall_t *hypercall) +{ +#if 1 + /* + * At this moment HVMOP_track_dirty_vram isn't implemented + * on xen/ia64 so that it just returns -ENOSYS. + * Don't issue hypercall to get -ENOSYS. + * When the hypercall is implemented, enable the following codes. + */ + return -ENOSYS; +#else + int cmd = hypercall->arg[0]; + struct xen_hvm_track_dirty_vram *user_op = (void*)hypercall->arg[1]; + struct xen_hvm_track_dirty_vram kern_op; + struct xencomm_handle *desc; + struct xencomm_handle *bitmap_desc; + int ret; + + BUG_ON(cmd != HVMOP_track_dirty_vram); + if (copy_from_user(&kern_op, user_op, sizeof(kern_op))) + return -EFAULT; + desc = xencomm_map_no_alloc(&kern_op, sizeof(kern_op)); + bitmap_desc = xencomm_map(xen_guest_handle(kern_op.dirty_bitmap), + kern_op.nr * sizeof(uint8_t)); + if (bitmap_desc == NULL) + return -ENOMEM; + set_xen_guest_handle(kern_op.dirty_bitmap, (void*)bitmap_desc); + ret = xencomm_arch_hypercall_hvm_op(cmd, desc); + xencomm_free(bitmap_desc); + + return ret; +#endif +} + +static int xencomm_privcmd_hvm_op(privcmd_hypercall_t *hypercall) { int cmd = hypercall->arg[0]; @@ -682,6 +717,9 @@ xencomm_privcmd_hvm_op(privcmd_hypercall case HVMOP_set_pci_link_route: argsize = sizeof(xen_hvm_set_pci_link_route_t); break; + + case HVMOP_track_dirty_vram: + return xencomm_privcmd_hvm_op_track_dirty_vram(hypercall); default: printk("%s: unknown HVMOP %d\n", __func__, cmd); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 12:50:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 12:50:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyXqe-0007CV-2C for www-data@colo.xensource.com; Tue, 20 May 2008 12:50:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrI-0003KL-3w; Tue, 20 May 2008 19:50:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrG-0003Jx-DL for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:50:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyXr8-00064S-IL for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:50:48 +0000 X-SBRS: 3.6 X-MesageID: 269467 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,517,1204520400"; d="scan'208";a="269467" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 15:49:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJntSZ030408 for ; Tue, 20 May 2008 12:49:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJoDQQ015116 for ; Tue, 20 May 2008 12:50:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KJoDeO015115 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 12:50:13 -0700 Message-Id: <200805201950.m4KJoDeO015115@xenbits.xensource.com> Date: Tue, 20 May 2008 12:50:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Xen interface and implementation for virtual S3 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211289435 -3600 # Node ID fd5b2ed9574afefe582d3985fc868abad6c76254 # Parent 2757cf34d1ea6c29047121e8c25aaa6cf0a642b2 x86 hvm: Xen interface and implementation for virtual S3 Signed-off-by: Tian Kevin Signed-off-by: Yu Ke Signed-off-by: Ke Liping Signed-off-by: Keir Fraser --- xen/arch/ia64/xen/domain.c | 3 xen/arch/x86/domain.c | 3 xen/arch/x86/hvm/hpet.c | 5 + xen/arch/x86/hvm/hvm.c | 137 +++++++++++++++++++++++++++++++++++++- xen/arch/x86/hvm/i8254.c | 30 +++++--- xen/arch/x86/hvm/pmtimer.c | 6 + xen/arch/x86/hvm/rtc.c | 6 + xen/arch/x86/hvm/vioapic.c | 22 +++--- xen/arch/x86/hvm/vlapic.c | 105 ++++++----------------------- xen/arch/x86/hvm/vpic.c | 13 ++- xen/common/domain.c | 10 -- xen/common/domctl.c | 3 xen/include/asm-x86/hvm/domain.h | 1 xen/include/asm-x86/hvm/hvm.h | 1 xen/include/asm-x86/hvm/vioapic.h | 1 xen/include/asm-x86/hvm/vpic.h | 1 xen/include/asm-x86/hvm/vpt.h | 6 + xen/include/public/hvm/params.h | 5 + xen/include/xen/domain.h | 4 - 19 files changed, 240 insertions(+), 122 deletions(-) diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/ia64/xen/domain.c Tue May 20 14:17:15 2008 +0100 @@ -644,10 +644,9 @@ void arch_domain_destroy(struct domain * deallocate_rid_range(d); } -int arch_vcpu_reset(struct vcpu *v) +void arch_vcpu_reset(struct vcpu *v) { /* FIXME: Stub for now */ - return 0; } /* Here it is assumed that all of the CPUs has same RSE.N_STACKED_PHYS */ diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/domain.c Tue May 20 14:17:15 2008 +0100 @@ -823,11 +823,10 @@ int arch_set_info_guest( #undef c } -int arch_vcpu_reset(struct vcpu *v) +void arch_vcpu_reset(struct vcpu *v) { destroy_gdt(v); vcpu_destroy_pagetables(v); - return 0; } /* diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/hvm/hpet.c --- a/xen/arch/x86/hvm/hpet.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/hvm/hpet.c Tue May 20 14:17:15 2008 +0100 @@ -591,3 +591,8 @@ void hpet_deinit(struct domain *d) kill_timer(&h->timers[i]); } +void hpet_reset(struct domain *d) +{ + hpet_deinit(d); + hpet_init(d->vcpu[0]); +} diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Tue May 20 14:17:15 2008 +0100 @@ -2058,6 +2058,118 @@ static int hvmop_set_pci_intx_level( return rc; } +void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip) +{ + struct domain *d = current->domain; + struct vcpu_guest_context *ctxt; + struct segment_register reg; + + BUG_ON(vcpu_runnable(v)); + + domain_lock(d); + + if ( v->is_initialised ) + goto out; + + ctxt = &v->arch.guest_context; + memset(ctxt, 0, sizeof(*ctxt)); + ctxt->flags = VGCF_online; + ctxt->user_regs.eflags = 2; + ctxt->user_regs.edx = 0x00000f00; + ctxt->user_regs.eip = ip; + + v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_ET; + hvm_update_guest_cr(v, 0); + + v->arch.hvm_vcpu.guest_cr[2] = 0; + hvm_update_guest_cr(v, 2); + + v->arch.hvm_vcpu.guest_cr[3] = 0; + hvm_update_guest_cr(v, 3); + + v->arch.hvm_vcpu.guest_cr[4] = 0; + hvm_update_guest_cr(v, 4); + + v->arch.hvm_vcpu.guest_efer = 0; + hvm_update_guest_efer(v); + + reg.sel = cs; + reg.base = (uint32_t)reg.sel << 4; + reg.limit = 0xffff; + reg.attr.bytes = 0x09b; + hvm_set_segment_register(v, x86_seg_cs, ®); + + reg.sel = reg.base = 0; + reg.limit = 0xffff; + reg.attr.bytes = 0x093; + hvm_set_segment_register(v, x86_seg_ds, ®); + hvm_set_segment_register(v, x86_seg_es, ®); + hvm_set_segment_register(v, x86_seg_fs, ®); + hvm_set_segment_register(v, x86_seg_gs, ®); + hvm_set_segment_register(v, x86_seg_ss, ®); + + reg.attr.bytes = 0x82; /* LDT */ + hvm_set_segment_register(v, x86_seg_ldtr, ®); + + reg.attr.bytes = 0x8b; /* 32-bit TSS (busy) */ + hvm_set_segment_register(v, x86_seg_tr, ®); + + reg.attr.bytes = 0; + hvm_set_segment_register(v, x86_seg_gdtr, ®); + hvm_set_segment_register(v, x86_seg_idtr, ®); + + /* Sync AP's TSC with BSP's. */ + v->arch.hvm_vcpu.cache_tsc_offset = + v->domain->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset; + hvm_funcs.set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset); + + v->arch.flags |= TF_kernel_mode; + v->is_initialised = 1; + clear_bit(_VPF_down, &v->pause_flags); + + out: + domain_unlock(d); +} + +static void hvm_s3_suspend(struct domain *d) +{ + struct vcpu *v; + + domain_pause(d); + domain_lock(d); + + if ( (d->vcpu[0] == NULL) || + test_and_set_bool(d->arch.hvm_domain.is_s3_suspended) ) + { + domain_unlock(d); + domain_unpause(d); + return; + } + + for_each_vcpu ( d, v ) + { + vlapic_reset(vcpu_vlapic(v)); + vcpu_reset(v); + } + + vpic_reset(d); + vioapic_reset(d); + pit_reset(d); + rtc_reset(d); + pmtimer_reset(d); + hpet_reset(d); + + hvm_vcpu_reset_state(d->vcpu[0], 0xf000, 0xfff0); + + domain_unlock(d); +} + +static void hvm_s3_resume(struct domain *d) +{ + if ( test_and_clear_bool(d->arch.hvm_domain.is_s3_suspended) ) + domain_unpause(d); +} + static int hvmop_set_isa_irq_level( XEN_GUEST_HANDLE(xen_hvm_set_isa_irq_level_t) uop) { @@ -2314,6 +2426,21 @@ long do_hvm_op(unsigned long op, XEN_GUE } domain_unpause(d); break; + case HVM_PARAM_ACPI_S_STATE: + /* Privileged domains only, as we must domain_pause(d). */ + rc = -EPERM; + if ( !IS_PRIV_FOR(current->domain, d) ) + break; + + rc = 0; + if ( a.value == 3 ) + hvm_s3_suspend(d); + else if ( a.value == 0 ) + hvm_s3_resume(d); + else + rc = -EINVAL; + + break; } if ( rc == 0 ) @@ -2321,7 +2448,15 @@ long do_hvm_op(unsigned long op, XEN_GUE } else { - a.value = d->arch.hvm_domain.params[a.index]; + switch ( a.index ) + { + case HVM_PARAM_ACPI_S_STATE: + a.value = d->arch.hvm_domain.is_s3_suspended ? 3 : 0; + break; + default: + a.value = d->arch.hvm_domain.params[a.index]; + break; + } rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0; } diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/hvm/i8254.c --- a/xen/arch/x86/hvm/i8254.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/hvm/i8254.c Tue May 20 14:17:15 2008 +0100 @@ -446,22 +446,16 @@ static int pit_load(struct domain *d, hv HVM_REGISTER_SAVE_RESTORE(PIT, pit_save, pit_load, 1, HVMSR_PER_DOM); -void pit_init(struct vcpu *v, unsigned long cpu_khz) -{ - PITState *pit = vcpu_vpit(v); +void pit_reset(struct domain *d) +{ + PITState *pit = domain_vpit(d); struct hvm_hw_pit_channel *s; int i; - spin_lock_init(&pit->lock); - - /* Some sub-functions assert that they are called with the lock held. */ - spin_lock(&pit->lock); - + destroy_periodic_time(&pit->pt0); pit->pt0.source = PTSRC_isa; - register_portio_handler(v->domain, PIT_BASE, 4, handle_pit_io); - register_portio_handler(v->domain, 0x61, 1, handle_speaker_io); - ticks_per_sec(v) = cpu_khz * (int64_t)1000; + spin_lock(&pit->lock); for ( i = 0; i < 3; i++ ) { @@ -472,6 +466,20 @@ void pit_init(struct vcpu *v, unsigned l } spin_unlock(&pit->lock); +} + +void pit_init(struct vcpu *v, unsigned long cpu_khz) +{ + PITState *pit = vcpu_vpit(v); + + spin_lock_init(&pit->lock); + + register_portio_handler(v->domain, PIT_BASE, 4, handle_pit_io); + register_portio_handler(v->domain, 0x61, 1, handle_speaker_io); + + ticks_per_sec(v) = cpu_khz * (int64_t)1000; + + pit_reset(v->domain); } void pit_deinit(struct domain *d) diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/hvm/pmtimer.c --- a/xen/arch/x86/hvm/pmtimer.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/hvm/pmtimer.c Tue May 20 14:17:15 2008 +0100 @@ -276,3 +276,9 @@ void pmtimer_deinit(struct domain *d) PMTState *s = &d->arch.hvm_domain.pl_time.vpmt; kill_timer(&s->timer); } + +void pmtimer_reset(struct domain *d) +{ + /* Reset the counter. */ + d->arch.hvm_domain.pl_time.vpmt.pm.tmr_val = 0; +} diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/hvm/rtc.c --- a/xen/arch/x86/hvm/rtc.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/hvm/rtc.c Tue May 20 14:17:15 2008 +0100 @@ -511,3 +511,9 @@ void rtc_deinit(struct domain *d) kill_timer(&s->second_timer); kill_timer(&s->second_timer2); } + +void rtc_reset(struct domain *d) +{ + RTCState *s = domain_vrtc(d); + destroy_periodic_time(&s->pt); +} diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/hvm/vioapic.c --- a/xen/arch/x86/hvm/vioapic.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/hvm/vioapic.c Tue May 20 14:17:15 2008 +0100 @@ -494,21 +494,25 @@ static int ioapic_load(struct domain *d, HVM_REGISTER_SAVE_RESTORE(IOAPIC, ioapic_save, ioapic_load, 1, HVMSR_PER_DOM); -int vioapic_init(struct domain *d) -{ - struct hvm_vioapic *vioapic; +void vioapic_reset(struct domain *d) +{ + struct hvm_vioapic *vioapic = d->arch.hvm_domain.vioapic; int i; - - vioapic = d->arch.hvm_domain.vioapic = xmalloc(struct hvm_vioapic); - if ( vioapic == NULL ) - return -ENOMEM; - - vioapic->domain = d; memset(&vioapic->hvm_hw_vioapic, 0, sizeof(vioapic->hvm_hw_vioapic)); for ( i = 0; i < VIOAPIC_NUM_PINS; i++ ) vioapic->hvm_hw_vioapic.redirtbl[i].fields.mask = 1; vioapic->hvm_hw_vioapic.base_address = VIOAPIC_DEFAULT_BASE_ADDRESS; +} + +int vioapic_init(struct domain *d) +{ + if ( (d->arch.hvm_domain.vioapic == NULL) && + ((d->arch.hvm_domain.vioapic = xmalloc(struct hvm_vioapic)) == NULL) ) + return -ENOMEM; + + d->arch.hvm_domain.vioapic->domain = d; + vioapic_reset(d); return 0; } diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/hvm/vlapic.c Tue May 20 14:17:15 2008 +0100 @@ -298,10 +298,6 @@ static int vlapic_accept_init(struct vcp static int vlapic_accept_sipi(struct vcpu *v, int trampoline_vector) { - struct domain *d = current->domain; - struct vcpu_guest_context *ctxt; - struct segment_register reg; - /* If the VCPU is not on its way down we have nothing to do. */ if ( !test_bit(_VPF_down, &v->pause_flags) ) return X86EMUL_OKAY; @@ -309,68 +305,10 @@ static int vlapic_accept_sipi(struct vcp if ( !vlapic_vcpu_pause_async(v) ) return X86EMUL_RETRY; - domain_lock(d); - - if ( v->is_initialised ) - goto out; - - ctxt = &v->arch.guest_context; - memset(ctxt, 0, sizeof(*ctxt)); - ctxt->flags = VGCF_online; - ctxt->user_regs.eflags = 2; - - v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_ET; - hvm_update_guest_cr(v, 0); - - v->arch.hvm_vcpu.guest_cr[2] = 0; - hvm_update_guest_cr(v, 2); - - v->arch.hvm_vcpu.guest_cr[3] = 0; - hvm_update_guest_cr(v, 3); - - v->arch.hvm_vcpu.guest_cr[4] = 0; - hvm_update_guest_cr(v, 4); - - v->arch.hvm_vcpu.guest_efer = 0; - hvm_update_guest_efer(v); - - reg.sel = trampoline_vector << 8; - reg.base = (uint32_t)reg.sel << 4; - reg.limit = 0xffff; - reg.attr.bytes = 0x89b; - hvm_set_segment_register(v, x86_seg_cs, ®); - - reg.sel = reg.base = 0; - reg.limit = 0xffff; - reg.attr.bytes = 0x893; - hvm_set_segment_register(v, x86_seg_ds, ®); - hvm_set_segment_register(v, x86_seg_es, ®); - hvm_set_segment_register(v, x86_seg_fs, ®); - hvm_set_segment_register(v, x86_seg_gs, ®); - hvm_set_segment_register(v, x86_seg_ss, ®); - - reg.attr.bytes = 0x82; /* LDT */ - hvm_set_segment_register(v, x86_seg_ldtr, ®); - - reg.attr.bytes = 0x8b; /* 32-bit TSS (busy) */ - hvm_set_segment_register(v, x86_seg_tr, ®); - - reg.attr.bytes = 0; - hvm_set_segment_register(v, x86_seg_gdtr, ®); - hvm_set_segment_register(v, x86_seg_idtr, ®); - - /* Sync AP's TSC with BSP's. */ - v->arch.hvm_vcpu.cache_tsc_offset = - v->domain->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset; - hvm_funcs.set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset); - - v->arch.flags |= TF_kernel_mode; - v->is_initialised = 1; - clear_bit(_VPF_down, &v->pause_flags); - - out: - domain_unlock(d); + hvm_vcpu_reset_state(v, trampoline_vector << 8, 0); + vcpu_unpause(v); + return X86EMUL_OKAY; } @@ -1028,23 +966,26 @@ int vlapic_init(struct vcpu *v) if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) memflags |= MEMF_bits(32); #endif - - vlapic->regs_page = alloc_domheap_page(NULL, memflags); - if ( vlapic->regs_page == NULL ) - { - dprintk(XENLOG_ERR, "alloc vlapic regs error: %d/%d\n", - v->domain->domain_id, v->vcpu_id); - return -ENOMEM; - } - - vlapic->regs = map_domain_page_global(page_to_mfn(vlapic->regs_page)); - if ( vlapic->regs == NULL ) - { - dprintk(XENLOG_ERR, "map vlapic regs error: %d/%d\n", - v->domain->domain_id, v->vcpu_id); - return -ENOMEM; - } - + if (vlapic->regs_page == NULL) + { + vlapic->regs_page = alloc_domheap_page(NULL, memflags); + if ( vlapic->regs_page == NULL ) + { + dprintk(XENLOG_ERR, "alloc vlapic regs error: %d/%d\n", + v->domain->domain_id, v->vcpu_id); + return -ENOMEM; + } + } + if (vlapic->regs == NULL) + { + vlapic->regs = map_domain_page_global(page_to_mfn(vlapic->regs_page)); + if ( vlapic->regs == NULL ) + { + dprintk(XENLOG_ERR, "map vlapic regs error: %d/%d\n", + v->domain->domain_id, v->vcpu_id); + return -ENOMEM; + } + } clear_page(vlapic->regs); vlapic_reset(vlapic); diff -r 2757cf34d1ea -r fd5b2ed9574a xen/arch/x86/hvm/vpic.c --- a/xen/arch/x86/hvm/vpic.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/arch/x86/hvm/vpic.c Tue May 20 14:17:15 2008 +0100 @@ -395,7 +395,7 @@ static int vpic_load(struct domain *d, h HVM_REGISTER_SAVE_RESTORE(PIC, vpic_save, vpic_load, 2, HVMSR_PER_DOM); -void vpic_init(struct domain *d) +void vpic_reset(struct domain *d) { struct hvm_hw_vpic *vpic; @@ -404,13 +404,20 @@ void vpic_init(struct domain *d) memset(vpic, 0, sizeof(*vpic)); vpic->is_master = 1; vpic->elcr = 1 << 2; - register_portio_handler(d, 0x20, 2, vpic_intercept_pic_io); - register_portio_handler(d, 0x4d0, 1, vpic_intercept_elcr_io); /* Slave PIC. */ vpic++; memset(vpic, 0, sizeof(*vpic)); +} + +void vpic_init(struct domain *d) +{ + vpic_reset(d); + + register_portio_handler(d, 0x20, 2, vpic_intercept_pic_io); register_portio_handler(d, 0xa0, 2, vpic_intercept_pic_io); + + register_portio_handler(d, 0x4d0, 1, vpic_intercept_elcr_io); register_portio_handler(d, 0x4d1, 1, vpic_intercept_elcr_io); } diff -r 2757cf34d1ea -r fd5b2ed9574a xen/common/domain.c --- a/xen/common/domain.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/common/domain.c Tue May 20 14:17:15 2008 +0100 @@ -633,17 +633,14 @@ int boot_vcpu(struct domain *d, int vcpu return arch_set_info_guest(v, ctxt); } -int vcpu_reset(struct vcpu *v) +void vcpu_reset(struct vcpu *v) { struct domain *d = v->domain; - int rc; domain_pause(d); domain_lock(d); - rc = arch_vcpu_reset(v); - if ( rc != 0 ) - goto out; + arch_vcpu_reset(v); set_bit(_VPF_down, &v->pause_flags); @@ -655,11 +652,8 @@ int vcpu_reset(struct vcpu *v) v->nmi_masked = 0; clear_bit(_VPF_blocked, &v->pause_flags); - out: domain_unlock(v->domain); domain_unpause(d); - - return rc; } diff -r 2757cf34d1ea -r fd5b2ed9574a xen/common/domctl.c --- a/xen/common/domctl.c Tue May 20 09:55:50 2008 +0100 +++ b/xen/common/domctl.c Tue May 20 14:17:15 2008 +0100 @@ -218,7 +218,8 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc if ( guest_handle_is_null(op->u.vcpucontext.ctxt) ) { - ret = vcpu_reset(v); + vcpu_reset(v); + ret = 0; goto svc_out; } diff -r 2757cf34d1ea -r fd5b2ed9574a xen/include/asm-x86/hvm/domain.h --- a/xen/include/asm-x86/hvm/domain.h Tue May 20 09:55:50 2008 +0100 +++ b/xen/include/asm-x86/hvm/domain.h Tue May 20 14:17:15 2008 +0100 @@ -76,6 +76,7 @@ struct hvm_domain { bool_t hap_enabled; bool_t qemu_mapcache_invalidate; + bool_t is_s3_suspended; union { struct vmx_domain vmx; diff -r 2757cf34d1ea -r fd5b2ed9574a xen/include/asm-x86/hvm/hvm.h --- a/xen/include/asm-x86/hvm/hvm.h Tue May 20 09:55:50 2008 +0100 +++ b/xen/include/asm-x86/hvm/hvm.h Tue May 20 14:17:15 2008 +0100 @@ -141,6 +141,7 @@ void hvm_vcpu_down(struct vcpu *v); void hvm_vcpu_down(struct vcpu *v); int hvm_vcpu_cacheattr_init(struct vcpu *v); void hvm_vcpu_cacheattr_destroy(struct vcpu *v); +void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip); void hvm_send_assist_req(struct vcpu *v); diff -r 2757cf34d1ea -r fd5b2ed9574a xen/include/asm-x86/hvm/vioapic.h --- a/xen/include/asm-x86/hvm/vioapic.h Tue May 20 09:55:50 2008 +0100 +++ b/xen/include/asm-x86/hvm/vioapic.h Tue May 20 14:17:15 2008 +0100 @@ -63,6 +63,7 @@ struct hvm_vioapic { int vioapic_init(struct domain *d); void vioapic_deinit(struct domain *d); +void vioapic_reset(struct domain *d); void vioapic_irq_positive_edge(struct domain *d, unsigned int irq); void vioapic_update_EOI(struct domain *d, int vector); diff -r 2757cf34d1ea -r fd5b2ed9574a xen/include/asm-x86/hvm/vpic.h --- a/xen/include/asm-x86/hvm/vpic.h Tue May 20 09:55:50 2008 +0100 +++ b/xen/include/asm-x86/hvm/vpic.h Tue May 20 14:17:15 2008 +0100 @@ -32,6 +32,7 @@ void vpic_irq_positive_edge(struct domai void vpic_irq_positive_edge(struct domain *d, int irq); void vpic_irq_negative_edge(struct domain *d, int irq); void vpic_init(struct domain *d); +void vpic_reset(struct domain *d); int vpic_ack_pending_irq(struct vcpu *v); int is_periodic_irq(struct vcpu *v, int irq, int type); diff -r 2757cf34d1ea -r fd5b2ed9574a xen/include/asm-x86/hvm/vpt.h --- a/xen/include/asm-x86/hvm/vpt.h Tue May 20 09:55:50 2008 +0100 +++ b/xen/include/asm-x86/hvm/vpt.h Tue May 20 14:17:15 2008 +0100 @@ -166,17 +166,23 @@ void destroy_periodic_time(struct period void destroy_periodic_time(struct periodic_time *pt); int pv_pit_handler(int port, int data, int write); +void pit_reset(struct domain *d); + void pit_init(struct vcpu *v, unsigned long cpu_khz); void pit_stop_channel0_irq(PITState * pit); void pit_deinit(struct domain *d); void rtc_init(struct vcpu *v, int base); void rtc_migrate_timers(struct vcpu *v); void rtc_deinit(struct domain *d); +void rtc_reset(struct domain *d); + void pmtimer_init(struct vcpu *v); void pmtimer_deinit(struct domain *d); +void pmtimer_reset(struct domain *d); void hpet_migrate_timers(struct vcpu *v); void hpet_init(struct vcpu *v); void hpet_deinit(struct domain *d); +void hpet_reset(struct domain *d); #endif /* __ASM_X86_HVM_VPT_H__ */ diff -r 2757cf34d1ea -r fd5b2ed9574a xen/include/public/hvm/params.h --- a/xen/include/public/hvm/params.h Tue May 20 09:55:50 2008 +0100 +++ b/xen/include/public/hvm/params.h Tue May 20 14:17:15 2008 +0100 @@ -90,6 +90,9 @@ /* Device Model domain, defaults to 0. */ #define HVM_PARAM_DM_DOMAIN 13 -#define HVM_NR_PARAMS 14 +/* ACPI S state: currently support S0 and S3 on x86. */ +#define HVM_PARAM_ACPI_S_STATE 14 + +#define HVM_NR_PARAMS 15 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ diff -r 2757cf34d1ea -r fd5b2ed9574a xen/include/xen/domain.h --- a/xen/include/xen/domain.h Tue May 20 09:55:50 2008 +0100 +++ b/xen/include/xen/domain.h Tue May 20 14:17:15 2008 +0100 @@ -14,7 +14,7 @@ int boot_vcpu( int boot_vcpu( struct domain *d, int vcpuid, vcpu_guest_context_u ctxt); struct vcpu *alloc_idle_vcpu(unsigned int cpu_id); -int vcpu_reset(struct vcpu *v); +void vcpu_reset(struct vcpu *v); struct domain *alloc_domain(domid_t domid); void free_domain(struct domain *d); @@ -55,7 +55,7 @@ void arch_dump_vcpu_info(struct vcpu *v) void arch_dump_domain_info(struct domain *d); -int arch_vcpu_reset(struct vcpu *v); +void arch_vcpu_reset(struct vcpu *v); extern unsigned int xen_processor_pmbits; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 12:50:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 12:50:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyXqg-0007CW-UT for www-data@colo.xensource.com; Tue, 20 May 2008 12:50:15 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrL-0003NG-63; Tue, 20 May 2008 19:50:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrI-0003K2-TB for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:50:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyXrC-00064U-AY for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:50:50 +0000 X-SBRS: 3.6 X-MesageID: 269468 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,517,1204520400"; d="scan'208";a="269468" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 15:49:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJnuMV030411 for ; Tue, 20 May 2008 12:49:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJoEW0015133 for ; Tue, 20 May 2008 12:50:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KJoEn8015132 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 12:50:14 -0700 Message-Id: <200805201950.m4KJoEn8015132@xenbits.xensource.com> Date: Tue, 20 May 2008 12:50:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Fix bugzilla bug #1253. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211289512 -3600 # Node ID 4b4b829e34a233b5b9d1d3112cad069da58d9517 # Parent fd5b2ed9574afefe582d3985fc868abad6c76254 xend: Fix bugzilla bug #1253. Signed-off-by: Masaki Kanno --- tools/python/xen/xend/XendConfig.py | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff -r fd5b2ed9574a -r 4b4b829e34a2 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Tue May 20 14:17:15 2008 +0100 +++ b/tools/python/xen/xend/XendConfig.py Tue May 20 14:18:32 2008 +0100 @@ -1143,10 +1143,11 @@ class XendConfig(dict): if o_dev_type == 'vbd' or o_dev_type == 'tap': blkdev_file = blkdev_uname_to_file(dev_uname) o_dev_uname = sxp.child_value(o_dev_info, 'uname') - o_blkdev_file = blkdev_uname_to_file(o_dev_uname) - if blkdev_file == o_blkdev_file: - raise XendConfigError('The file "%s" is already used' % - blkdev_file) + if o_dev_uname != None: + o_blkdev_file = blkdev_uname_to_file(o_dev_uname) + if blkdev_file == o_blkdev_file: + raise XendConfigError('The file "%s" is already used' % + blkdev_file) o_blkdev_name = sxp.child_value(o_dev_info, 'dev') o_devid = self._blkdev_name_to_number(o_blkdev_name) if o_devid != None and devid == o_devid: _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 12:50:20 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 12:50:20 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyXql-0007Cc-Rq for www-data@colo.xensource.com; Tue, 20 May 2008 12:50:20 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrQ-0003RZ-87; Tue, 20 May 2008 19:51:00 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrM-0003MW-4V for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:50:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyXrE-00064S-Qv for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:50:54 +0000 X-SBRS: 3.6 X-MesageID: 269469 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,517,1204520400"; d="scan'208";a="269469" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 15:49:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJnvtF030414 for ; Tue, 20 May 2008 12:49:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJoFec015150 for ; Tue, 20 May 2008 12:50:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KJoF0K015149 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 12:50:15 -0700 Message-Id: <200805201950.m4KJoF0K015149@xenbits.xensource.com> Date: Tue, 20 May 2008 12:50:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: HVM virtual S3 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211290099 -3600 # Node ID 34ac0d3b5bfb59c7133a53061bfe8933faf404ef # Parent 4b4b829e34a233b5b9d1d3112cad069da58d9517 ioemu: HVM virtual S3 - add S3 suspend logic in PM1A control register. when guest write specific value to this register, QEMU will trigger S3 sleep by * reset all qemu device * set CMOS shutdown status as S3 resume, so that rombios will do S3 resume later * request Xen to S3-suspend the guest Signed-off-by: Yu Ke Signed-off-by: Liping Ke --- tools/ioemu/hw/pc.c | 8 ++++++++ tools/ioemu/hw/piix4acpi.c | 11 +++++++++++ tools/ioemu/target-i386-dm/helper2.c | 4 ++++ tools/ioemu/vl.h | 1 + 4 files changed, 24 insertions(+) diff -r 4b4b829e34a2 -r 34ac0d3b5bfb tools/ioemu/hw/pc.c --- a/tools/ioemu/hw/pc.c Tue May 20 14:18:32 2008 +0100 +++ b/tools/ioemu/hw/pc.c Tue May 20 14:28:19 2008 +0100 @@ -1121,6 +1121,14 @@ static void pc_init_isa(uint64_t ram_siz initrd_filename, 0, NULL); } +/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE) + BIOS will read it and start S3 resume at POST Entry*/ +void cmos_set_s3_resume(void) +{ + if (rtc_state) + rtc_set_memory(rtc_state, 0xF, 0xFE); +} + QEMUMachine pc_machine = { "pc", "Standard PC", diff -r 4b4b829e34a2 -r 34ac0d3b5bfb tools/ioemu/hw/piix4acpi.c --- a/tools/ioemu/hw/piix4acpi.c Tue May 20 14:18:32 2008 +0100 +++ b/tools/ioemu/hw/piix4acpi.c Tue May 20 14:28:19 2008 +0100 @@ -25,6 +25,7 @@ #include "vl.h" #include +#include /* PM1a_CNT bits, as defined in the ACPI specification. */ #define SCI_EN (1 << 0) @@ -35,6 +36,7 @@ /* Sleep state type codes as defined by the \_Sx objects in the DSDT. */ /* These must be kept in sync with the DSDT (hvmloader/acpi/dsdt.asl) */ #define SLP_TYP_S4 (6 << 10) +#define SLP_TYP_S3 (5 << 10) #define SLP_TYP_S5 (7 << 10) #define ACPI_DBG_IO_ADDR 0xb044 @@ -78,6 +80,8 @@ typedef struct PHPSlots { } PHPSlots; PHPSlots php_slots; + +int s3_shutdown_flag; static void piix4acpi_save(QEMUFile *f, void *opaque) { @@ -118,6 +122,13 @@ static void acpi_shutdown(uint32_t val) return; switch (val & SLP_TYP_Sx) { + case SLP_TYP_S3: + s3_shutdown_flag = 1; + qemu_system_reset(); + s3_shutdown_flag = 0; + cmos_set_s3_resume(); + xc_set_hvm_param(xc_handle, domid, HVM_PARAM_ACPI_S_STATE, 3); + break; case SLP_TYP_S4: case SLP_TYP_S5: qemu_system_shutdown_request(); diff -r 4b4b829e34a2 -r 34ac0d3b5bfb tools/ioemu/target-i386-dm/helper2.c --- a/tools/ioemu/target-i386-dm/helper2.c Tue May 20 14:18:32 2008 +0100 +++ b/tools/ioemu/target-i386-dm/helper2.c Tue May 20 14:28:19 2008 +0100 @@ -133,8 +133,12 @@ CPUX86State *cpu_x86_init(void) /* called from main_cpu_reset */ void cpu_reset(CPUX86State *env) { + extern int s3_shutdown_flag; int xcHandle; int sts; + + if (s3_shutdown_flag) + return; xcHandle = xc_interface_open(); if (xcHandle < 0) diff -r 4b4b829e34a2 -r 34ac0d3b5bfb tools/ioemu/vl.h --- a/tools/ioemu/vl.h Tue May 20 14:18:32 2008 +0100 +++ b/tools/ioemu/vl.h Tue May 20 14:28:19 2008 +0100 @@ -1181,6 +1181,7 @@ extern int fd_bootchk; void ioport_set_a20(int enable); int ioport_get_a20(void); +void cmos_set_s3_resume(void); /* ppc.c */ extern QEMUMachine prep_machine; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 12:50:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 12:50:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyXqo-0007Cd-Ss for www-data@colo.xensource.com; Tue, 20 May 2008 12:50:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrT-0003Us-8p; Tue, 20 May 2008 19:51:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrO-0003OW-51 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:50:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyXrH-00064U-Ce for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:50:56 +0000 X-SBRS: 3.6 X-MesageID: 269471 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,517,1204520400"; d="scan'208";a="269471" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 15:49:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJnxt5030420 for ; Tue, 20 May 2008 12:49:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJoHJe015184 for ; Tue, 20 May 2008 12:50:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KJoHe3015183 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 12:50:17 -0700 Message-Id: <200805201950.m4KJoHe3015183@xenbits.xensource.com> Date: Tue, 20 May 2008 12:50:17 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Support HVM S3 resume. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211291445 -3600 # Node ID 672c09aad49df0b8056c795bd6c351746d037975 # Parent 7c752689b0eaeff1cc68e39931040d0bda04aa25 xend: Support HVM S3 resume. Signed-off-by: Yu Ke Signed-off-by: Ke Liping Signed-off-by: Keir Fraser --- tools/python/xen/xend/XendConstants.py | 5 ++++- tools/python/xen/xend/XendDomain.py | 3 +++ tools/python/xen/xm/main.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff -r 7c752689b0ea -r 672c09aad49d tools/python/xen/xend/XendConstants.py --- a/tools/python/xen/xend/XendConstants.py Tue May 20 14:36:05 2008 +0100 +++ b/tools/python/xen/xend/XendConstants.py Tue May 20 14:50:45 2008 +0100 @@ -48,6 +48,7 @@ HVM_PARAM_BUFPIOREQ_PFN = 9 HVM_PARAM_BUFPIOREQ_PFN = 9 HVM_PARAM_TIMER_MODE = 10 HVM_PARAM_HPET_ENABLED = 11 +HVM_PARAM_ACPI_S_STATE = 14 restart_modes = [ "restart", @@ -102,11 +103,13 @@ TRIGGER_NMI = 0 TRIGGER_NMI = 0 TRIGGER_RESET = 1 TRIGGER_INIT = 2 +TRIGGER_S3RESUME = 3 TRIGGER_TYPE = { "nmi" : TRIGGER_NMI, "reset" : TRIGGER_RESET, - "init" : TRIGGER_INIT + "init" : TRIGGER_INIT, + "s3resume": TRIGGER_S3RESUME } # diff -r 7c752689b0ea -r 672c09aad49d tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Tue May 20 14:36:05 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Tue May 20 14:50:45 2008 +0100 @@ -1657,6 +1657,9 @@ class XendDomain: trigger = TRIGGER_TYPE[trigger_name.lower()] else: raise XendError("Invalid trigger: %s" % trigger_name) + if trigger == TRIGGER_S3RESUME: + xc.hvm_set_param(dominfo.getDomid(), HVM_PARAM_ACPI_S_STATE, 0) + return None try: return xc.domain_send_trigger(dominfo.getDomid(), trigger, diff -r 7c752689b0ea -r 672c09aad49d tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Tue May 20 14:36:05 2008 +0100 +++ b/tools/python/xen/xm/main.py Tue May 20 14:50:45 2008 +0100 @@ -143,7 +143,7 @@ SUBCOMMAND_HELP = { 'Get/set credit scheduler parameters.'), 'sysrq' : (' ', 'Send a sysrq to a domain.'), 'debug-keys' : ('', 'Send debug keys to Xen.'), - 'trigger' : (' []', + 'trigger' : (' []', 'Send a trigger to a domain.'), 'vcpu-list' : ('[Domain, ...]', 'List the VCPUs for all/some domains.'), _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 20 12:50:27 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 20 May 2008 12:50:27 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JyXqs-0007Cl-9W for www-data@colo.xensource.com; Tue, 20 May 2008 12:50:27 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrW-0003YC-I8; Tue, 20 May 2008 19:51:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JyXrS-0003Rn-6R for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:51:02 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JyXrH-00064Y-BF for xen-changelog@lists.xensource.com; Tue, 20 May 2008 19:51:00 +0000 X-SBRS: 3.6 X-MesageID: 269470 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,517,1204520400"; d="scan'208";a="269470" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 20 May 2008 15:49:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJnwmq030417 for ; Tue, 20 May 2008 12:49:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4KJoGKX015167 for ; Tue, 20 May 2008 12:50:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4KJoGkM015166 for xen-changelog@lists.xensource.com; Tue, 20 May 2008 12:50:16 -0700 Message-Id: <200805201950.m4KJoGkM015166@xenbits.xensource.com> Date: Tue, 20 May 2008 12:50:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] hvm: rombios interface for HVM S3 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211290565 -3600 # Node ID 7c752689b0eaeff1cc68e39931040d0bda04aa25 # Parent 34ac0d3b5bfb59c7133a53061bfe8933faf404ef hvm: rombios interface for HVM S3 - add S3 package in ACPI DSDT table. Guest OS will get S3 value from this package and write the value to PM1A control register to trigger S3 suspend. - Add S3 resume logic in rombios post code. the CMOS shutdown register is used to indicate if this is a S3 resume. - if it is s3 resume, rombios will get wakeup vector from ACPI FACS table and jump to wakeup vector. Per ACPI spec, the wakeup vector jumping must be the forms CS:IP, in which CS=3D(wakeup vector>>4) IP=3D(wakeup vector)&0xF, for example, for vector=3D0x12345, CS:IP=3D0x1234:0x5 Note: clobber_entry_point will clobber the post entry, which make S3 resume not work. We will directly jmp to POST Entry if it in S3 Resume path. Signed-off-by: Yu Ke Signed-off-by: Ke Liping Signed-off-by: Keir Fraser --- tools/firmware/hvmloader/acpi/dsdt.asl | 12 tools/firmware/hvmloader/acpi/dsdt.c | 1024 ++++++++++++++++----------------- tools/firmware/rombios/rombios.c | 91 ++ 3 files changed, 615 insertions(+), 512 deletions(-) diff -r 34ac0d3b5bfb -r 7c752689b0ea tools/firmware/hvmloader/acpi/dsdt.asl --- a/tools/firmware/hvmloader/acpi/dsdt.asl Tue May 20 14:28:19 2008 +0100 +++ b/tools/firmware/hvmloader/acpi/dsdt.asl Tue May 20 14:36:05 2008 +0100 @@ -52,7 +52,17 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, * at HVM guest boot time. */ } - /* S4 (STD) and S5 (power-off) type codes: must match piix4 emulation. */ + /* + * S3 (suspend-to-ram), S4 (suspend-to-disc) and S5 (power-off) type codes: + * must match piix4 emulation. + */ + Name (\_S3, Package (0x04) + { + 0x05, /* PM1a_CNT.SLP_TYP */ + 0x05, /* PM1b_CNT.SLP_TYP */ + 0x0, /* reserved */ + 0x0 /* reserved */ + }) Name (\_S4, Package (0x04) { 0x06, /* PM1a_CNT.SLP_TYP */ diff -r 34ac0d3b5bfb -r 7c752689b0ea tools/firmware/hvmloader/acpi/dsdt.c --- a/tools/firmware/hvmloader/acpi/dsdt.c Tue May 20 14:28:19 2008 +0100 +++ b/tools/firmware/hvmloader/acpi/dsdt.c Tue May 20 14:36:05 2008 +0100 @@ -5,15 +5,15 @@ * Copyright (C) 2000 - 2006 Intel Corporation * Supports ACPI Specification Revision 3.0a * - * Compilation of "dsdt.asl" - Tue Mar 25 10:53:38 2008 + * Compilation of "dsdt.asl" - Tue May 20 14:34:40 2008 * * C source code output * */ unsigned char AmlCode[] = { - 0x44,0x53,0x44,0x54,0x24,0x11,0x00,0x00, /* 00000000 "DSDT$..." */ - 0x02,0x82,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 "..Xen..." */ + 0x44,0x53,0x44,0x54,0x32,0x11,0x00,0x00, /* 00000000 "DSDT2..." */ + 0x02,0xEC,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 "..Xen..." */ 0x48,0x56,0x4D,0x00,0x00,0x00,0x00,0x00, /* 00000010 "HVM....." */ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ 0x07,0x07,0x06,0x20,0x08,0x50,0x4D,0x42, /* 00000020 "... .PMB" */ @@ -48,518 +48,520 @@ unsigned char AmlCode[] = 0x00,0x5B,0x83,0x0B,0x50,0x52,0x30,0x44, /* 00000108 ".[..PR0D" */ 0x0D,0x00,0x00,0x00,0x00,0x00,0x5B,0x83, /* 00000110 "......[." */ 0x0B,0x50,0x52,0x30,0x45,0x0E,0x00,0x00, /* 00000118 ".PR0E..." */ - 0x00,0x00,0x00,0x08,0x5F,0x53,0x34,0x5F, /* 00000120 "...._S4_" */ - 0x12,0x08,0x04,0x0A,0x06,0x0A,0x06,0x00, /* 00000128 "........" */ - 0x00,0x08,0x5F,0x53,0x35,0x5F,0x12,0x08, /* 00000130 ".._S5_.." */ - 0x04,0x0A,0x07,0x0A,0x07,0x00,0x00,0x08, /* 00000138 "........" */ - 0x50,0x49,0x43,0x44,0x00,0x14,0x0C,0x5F, /* 00000140 "PICD..._" */ - 0x50,0x49,0x43,0x01,0x70,0x68,0x50,0x49, /* 00000148 "PIC.phPI" */ - 0x43,0x44,0x10,0x42,0xF1,0x5F,0x53,0x42, /* 00000150 "CD.B._SB" */ - 0x5F,0x5B,0x80,0x42,0x49,0x4F,0x53,0x00, /* 00000158 "_[.BIOS." */ - 0x0C,0x00,0xA0,0x0E,0x00,0x0A,0x10,0x5B, /* 00000160 ".......[" */ - 0x81,0x21,0x42,0x49,0x4F,0x53,0x01,0x55, /* 00000168 ".!BIOS.U" */ - 0x41,0x52,0x31,0x01,0x55,0x41,0x52,0x32, /* 00000170 "AR1.UAR2" */ - 0x01,0x48,0x50,0x45,0x54,0x01,0x00,0x1D, /* 00000178 ".HPET..." */ - 0x50,0x4D,0x49,0x4E,0x20,0x50,0x4C,0x45, /* 00000180 "PMIN PLE" */ - 0x4E,0x20,0x5B,0x82,0x49,0x04,0x4D,0x45, /* 00000188 "N [.I.ME" */ - 0x4D,0x30,0x08,0x5F,0x48,0x49,0x44,0x0C, /* 00000190 "M0._HID." */ - 0x41,0xD0,0x0C,0x02,0x08,0x5F,0x43,0x52, /* 00000198 "A...._CR" */ - 0x53,0x11,0x33,0x0A,0x30,0x8A,0x2B,0x00, /* 000001A0 "S.3.0.+." */ - 0x00,0x0D,0x03,0x00,0x00,0x00,0x00,0x00, /* 000001A8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001B0 "........" */ - 0x00,0x00,0x00,0xFF,0xFF,0x09,0x00,0x00, /* 000001B8 "........" */ + 0x00,0x00,0x00,0x08,0x5F,0x53,0x33,0x5F, /* 00000120 "...._S3_" */ + 0x12,0x08,0x04,0x0A,0x05,0x0A,0x05,0x00, /* 00000128 "........" */ + 0x00,0x08,0x5F,0x53,0x34,0x5F,0x12,0x08, /* 00000130 ".._S4_.." */ + 0x04,0x0A,0x06,0x0A,0x06,0x00,0x00,0x08, /* 00000138 "........" */ + 0x5F,0x53,0x35,0x5F,0x12,0x08,0x04,0x0A, /* 00000140 "_S5_...." */ + 0x07,0x0A,0x07,0x00,0x00,0x08,0x50,0x49, /* 00000148 "......PI" */ + 0x43,0x44,0x00,0x14,0x0C,0x5F,0x50,0x49, /* 00000150 "CD..._PI" */ + 0x43,0x01,0x70,0x68,0x50,0x49,0x43,0x44, /* 00000158 "C.phPICD" */ + 0x10,0x42,0xF1,0x5F,0x53,0x42,0x5F,0x5B, /* 00000160 ".B._SB_[" */ + 0x80,0x42,0x49,0x4F,0x53,0x00,0x0C,0x00, /* 00000168 ".BIOS..." */ + 0xA0,0x0E,0x00,0x0A,0x10,0x5B,0x81,0x21, /* 00000170 ".....[.!" */ + 0x42,0x49,0x4F,0x53,0x01,0x55,0x41,0x52, /* 00000178 "BIOS.UAR" */ + 0x31,0x01,0x55,0x41,0x52,0x32,0x01,0x48, /* 00000180 "1.UAR2.H" */ + 0x50,0x45,0x54,0x01,0x00,0x1D,0x50,0x4D, /* 00000188 "PET...PM" */ + 0x49,0x4E,0x20,0x50,0x4C,0x45,0x4E,0x20, /* 00000190 "IN PLEN " */ + 0x5B,0x82,0x49,0x04,0x4D,0x45,0x4D,0x30, /* 00000198 "[.I.MEM0" */ + 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 000001A0 "._HID.A." */ + 0x0C,0x02,0x08,0x5F,0x43,0x52,0x53,0x11, /* 000001A8 "..._CRS." */ + 0x33,0x0A,0x30,0x8A,0x2B,0x00,0x00,0x0D, /* 000001B0 "3.0.+..." */ + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001B8 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0x00, /* 000001C8 "........" */ - 0x00,0x00,0x00,0x79,0x00,0x5B,0x82,0x4E, /* 000001D0 "...y.[.N" */ - 0xE8,0x50,0x43,0x49,0x30,0x08,0x5F,0x48, /* 000001D8 ".PCI0._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x0A,0x03,0x08, /* 000001E0 "ID.A...." */ - 0x5F,0x55,0x49,0x44,0x00,0x08,0x5F,0x41, /* 000001E8 "_UID.._A" */ - 0x44,0x52,0x00,0x08,0x5F,0x42,0x42,0x4E, /* 000001F0 "DR.._BBN" */ - 0x00,0x14,0x4E,0x0C,0x5F,0x43,0x52,0x53, /* 000001F8 "..N._CRS" */ - 0x00,0x08,0x50,0x52,0x54,0x30,0x11,0x42, /* 00000200 "..PRT0.B" */ - 0x07,0x0A,0x6E,0x88,0x0D,0x00,0x02,0x0E, /* 00000208 "..n....." */ - 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, /* 00000210 "........" */ - 0x00,0x00,0x01,0x47,0x01,0xF8,0x0C,0xF8, /* 00000218 "...G...." */ - 0x0C,0x01,0x08,0x88,0x0D,0x00,0x01,0x0C, /* 00000220 "........" */ - 0x03,0x00,0x00,0x00,0x00,0xF7,0x0C,0x00, /* 00000228 "........" */ - 0x00,0xF8,0x0C,0x88,0x0D,0x00,0x01,0x0C, /* 00000230 "........" */ - 0x03,0x00,0x00,0x00,0x0D,0xFF,0xFF,0x00, /* 00000238 "........" */ - 0x00,0x00,0xF3,0x87,0x17,0x00,0x00,0x0C, /* 00000240 "........" */ - 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x0A, /* 00000248 "........" */ - 0x00,0xFF,0xFF,0x0B,0x00,0x00,0x00,0x00, /* 00000250 "........" */ - 0x00,0x00,0x00,0x02,0x00,0x87,0x17,0x00, /* 00000258 "........" */ - 0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00, /* 00000260 "........" */ - 0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF4,0x00, /* 00000268 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x79, /* 00000270 ".......y" */ - 0x00,0x8A,0x50,0x52,0x54,0x30,0x0A,0x5C, /* 00000278 "..PRT0.\" */ - 0x4D,0x4D,0x49,0x4E,0x8A,0x50,0x52,0x54, /* 00000280 "MMIN.PRT" */ - 0x30,0x0A,0x60,0x4D,0x4D,0x41,0x58,0x8A, /* 00000288 "0.`MMAX." */ - 0x50,0x52,0x54,0x30,0x0A,0x68,0x4D,0x4C, /* 00000290 "PRT0.hML" */ - 0x45,0x4E,0x70,0x50,0x4D,0x49,0x4E,0x4D, /* 00000298 "ENpPMINM" */ - 0x4D,0x49,0x4E,0x70,0x50,0x4C,0x45,0x4E, /* 000002A0 "MINpPLEN" */ - 0x4D,0x4C,0x45,0x4E,0x72,0x4D,0x4D,0x49, /* 000002A8 "MLENrMMI" */ - 0x4E,0x4D,0x4C,0x45,0x4E,0x4D,0x4D,0x41, /* 000002B0 "NMLENMMA" */ - 0x58,0x74,0x4D,0x4D,0x41,0x58,0x01,0x4D, /* 000002B8 "XtMMAX.M" */ - 0x4D,0x41,0x58,0xA4,0x50,0x52,0x54,0x30, /* 000002C0 "MAX.PRT0" */ - 0x08,0x42,0x55,0x46,0x41,0x11,0x09,0x0A, /* 000002C8 ".BUFA..." */ - 0x06,0x23,0x20,0x0C,0x18,0x79,0x00,0x08, /* 000002D0 ".# ..y.." */ - 0x42,0x55,0x46,0x42,0x11,0x09,0x0A,0x06, /* 000002D8 "BUFB...." */ - 0x23,0x00,0x00,0x18,0x79,0x00,0x8B,0x42, /* 000002E0 "#...y..B" */ - 0x55,0x46,0x42,0x01,0x49,0x52,0x51,0x56, /* 000002E8 "UFB.IRQV" */ - 0x5B,0x82,0x48,0x08,0x4C,0x4E,0x4B,0x41, /* 000002F0 "[.H.LNKA" */ - 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 000002F8 "._HID.A." */ - 0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x01, /* 00000300 "..._UID." */ - 0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B, /* 00000308 ".._STA.{" */ - 0x50,0x49,0x52,0x41,0x0A,0x80,0x60,0xA0, /* 00000310 "PIRA..`." */ - 0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09, /* 00000318 "..`....." */ - 0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F, /* 00000320 "......._" */ - 0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46, /* 00000328 "PRS..BUF" */ - 0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00, /* 00000330 "A.._DIS." */ - 0x7D,0x50,0x49,0x52,0x41,0x0A,0x80,0x50, /* 00000338 "}PIRA..P" */ - 0x49,0x52,0x41,0x14,0x1A,0x5F,0x43,0x52, /* 00000340 "IRA.._CR" */ - 0x53,0x00,0x7B,0x50,0x49,0x52,0x41,0x0A, /* 00000348 "S.{PIRA." */ - 0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51, /* 00000350 ".`y.`IRQ" */ - 0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B, /* 00000358 "V.BUFB.." */ - 0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01, /* 00000360 "_SRS..h." */ - 0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51, /* 00000368 "IRQ1.IRQ" */ - 0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49, /* 00000370 "1`v`p`PI" */ - 0x52,0x41,0x5B,0x82,0x49,0x08,0x4C,0x4E, /* 00000378 "RA[.I.LN" */ - 0x4B,0x42,0x08,0x5F,0x48,0x49,0x44,0x0C, /* 00000380 "KB._HID." */ - 0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49, /* 00000388 "A...._UI" */ - 0x44,0x0A,0x02,0x14,0x1C,0x5F,0x53,0x54, /* 00000390 "D...._ST" */ - 0x41,0x00,0x7B,0x50,0x49,0x52,0x42,0x0A, /* 00000398 "A.{PIRB." */ - 0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80, /* 000003A0 ".`...`.." */ - 0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B, /* 000003A8 "........" */ - 0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4, /* 000003B0 ".._PRS.." */ - 0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44, /* 000003B8 "BUFA.._D" */ - 0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x42, /* 000003C0 "IS.}PIRB" */ - 0x0A,0x80,0x50,0x49,0x52,0x42,0x14,0x1A, /* 000003C8 "..PIRB.." */ - 0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49, /* 000003D0 "_CRS.{PI" */ - 0x52,0x42,0x0A,0x0F,0x60,0x79,0x01,0x60, /* 000003D8 "RB..`y.`" */ - 0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46, /* 000003E0 "IRQV.BUF" */ - 0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01, /* 000003E8 "B.._SRS." */ - 0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82, /* 000003F0 ".h.IRQ1." */ - 0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70, /* 000003F8 "IRQ1`v`p" */ - 0x60,0x50,0x49,0x52,0x42,0x5B,0x82,0x49, /* 00000400 "`PIRB[.I" */ - 0x08,0x4C,0x4E,0x4B,0x43,0x08,0x5F,0x48, /* 00000408 ".LNKC._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08, /* 00000410 "ID.A...." */ - 0x5F,0x55,0x49,0x44,0x0A,0x03,0x14,0x1C, /* 00000418 "_UID...." */ - 0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49, /* 00000420 "_STA.{PI" */ - 0x52,0x43,0x0A,0x80,0x60,0xA0,0x08,0x93, /* 00000428 "RC..`..." */ - 0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04, /* 00000430 "`......." */ - 0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52, /* 00000438 "....._PR" */ - 0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14, /* 00000440 "S..BUFA." */ - 0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50, /* 00000448 "._DIS.}P" */ - 0x49,0x52,0x43,0x0A,0x80,0x50,0x49,0x52, /* 00000450 "IRC..PIR" */ - 0x43,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00, /* 00000458 "C.._CRS." */ - 0x7B,0x50,0x49,0x52,0x43,0x0A,0x0F,0x60, /* 00000460 "{PIRC..`" */ - 0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4, /* 00000468 "y.`IRQV." */ - 0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53, /* 00000470 "BUFB.._S" */ - 0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52, /* 00000478 "RS..h.IR" */ - 0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60, /* 00000480 "Q1.IRQ1`" */ - 0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x43, /* 00000488 "v`p`PIRC" */ - 0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,0x44, /* 00000490 "[.I.LNKD" */ - 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000498 "._HID.A." */ - 0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A, /* 000004A0 "..._UID." */ - 0x04,0x14,0x1C,0x5F,0x53,0x54,0x41,0x00, /* 000004A8 "..._STA." */ - 0x7B,0x50,0x49,0x52,0x44,0x0A,0x80,0x60, /* 000004B0 "{PIRD..`" */ - 0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A, /* 000004B8 "...`...." */ - 0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B, /* 000004C0 "........" */ - 0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,0x55, /* 000004C8 "_PRS..BU" */ - 0x46,0x41,0x14,0x11,0x5F,0x44,0x49,0x53, /* 000004D0 "FA.._DIS" */ - 0x00,0x7D,0x50,0x49,0x52,0x44,0x0A,0x80, /* 000004D8 ".}PIRD.." */ - 0x50,0x49,0x52,0x44,0x14,0x1A,0x5F,0x43, /* 000004E0 "PIRD.._C" */ - 0x52,0x53,0x00,0x7B,0x50,0x49,0x52,0x44, /* 000004E8 "RS.{PIRD" */ - 0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,0x52, /* 000004F0 "..`y.`IR" */ - 0x51,0x56,0xA4,0x42,0x55,0x46,0x42,0x14, /* 000004F8 "QV.BUFB." */ - 0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68, /* 00000500 "._SRS..h" */ - 0x01,0x49,0x52,0x51,0x31,0x82,0x49,0x52, /* 00000508 ".IRQ1.IR" */ - 0x51,0x31,0x60,0x76,0x60,0x70,0x60,0x50, /* 00000510 "Q1`v`p`P" */ - 0x49,0x52,0x44,0x5B,0x82,0x44,0x05,0x48, /* 00000518 "IRD[.D.H" */ - 0x50,0x45,0x54,0x08,0x5F,0x48,0x49,0x44, /* 00000520 "PET._HID" */ - 0x0C,0x41,0xD0,0x01,0x03,0x08,0x5F,0x55, /* 00000528 ".A...._U" */ - 0x49,0x44,0x00,0x14,0x18,0x5F,0x53,0x54, /* 00000530 "ID..._ST" */ - 0x41,0x00,0xA0,0x0C,0x93,0x5E,0x5E,0x5E, /* 00000538 "A....^^^" */ - 0x48,0x50,0x45,0x54,0x00,0xA4,0x00,0xA1, /* 00000540 "HPET...." */ - 0x04,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52, /* 00000548 "....._CR" */ - 0x53,0x11,0x1F,0x0A,0x1C,0x87,0x17,0x00, /* 00000550 "S......." */ - 0x00,0x0D,0x01,0x00,0x00,0x00,0x00,0x00, /* 00000558 "........" */ - 0x00,0xD0,0xFE,0xFF,0x03,0xD0,0xFE,0x00, /* 00000560 "........" */ - 0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x79, /* 00000568 ".......y" */ - 0x00,0x14,0x16,0x5F,0x50,0x52,0x54,0x00, /* 00000570 "..._PRT." */ - 0xA0,0x0A,0x50,0x49,0x43,0x44,0xA4,0x50, /* 00000578 "..PICD.P" */ - 0x52,0x54,0x41,0xA4,0x50,0x52,0x54,0x50, /* 00000580 "RTA.PRTP" */ - 0x08,0x50,0x52,0x54,0x50,0x12,0x49,0x36, /* 00000588 ".PRTP.I6" */ - 0x3C,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01, /* 00000590 "<......." */ - 0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,0x12, /* 00000598 "..LNKB.." */ - 0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,0x01, /* 000005A0 "........" */ - 0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04, /* 000005A8 "LNKC...." */ - 0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,0x4C, /* 000005B0 ".......L" */ - 0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C, /* 000005B8 "NKD....." */ - 0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C,0x4E, /* 000005C0 "......LN" */ - 0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000005C8 "KA......" */ - 0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B,0x43, /* 000005D0 "....LNKC" */ + 0x00,0xFF,0xFF,0x09,0x00,0x00,0x00,0x00, /* 000001C8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001D0 "........" */ + 0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00, /* 000001D8 "........" */ + 0x00,0x79,0x00,0x5B,0x82,0x4E,0xE8,0x50, /* 000001E0 ".y.[.N.P" */ + 0x43,0x49,0x30,0x08,0x5F,0x48,0x49,0x44, /* 000001E8 "CI0._HID" */ + 0x0C,0x41,0xD0,0x0A,0x03,0x08,0x5F,0x55, /* 000001F0 ".A...._U" */ + 0x49,0x44,0x00,0x08,0x5F,0x41,0x44,0x52, /* 000001F8 "ID.._ADR" */ + 0x00,0x08,0x5F,0x42,0x42,0x4E,0x00,0x14, /* 00000200 ".._BBN.." */ + 0x4E,0x0C,0x5F,0x43,0x52,0x53,0x00,0x08, /* 00000208 "N._CRS.." */ + 0x50,0x52,0x54,0x30,0x11,0x42,0x07,0x0A, /* 00000210 "PRT0.B.." */ + 0x6E,0x88,0x0D,0x00,0x02,0x0E,0x00,0x00, /* 00000218 "n......." */ + 0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, /* 00000220 "........" */ + 0x01,0x47,0x01,0xF8,0x0C,0xF8,0x0C,0x01, /* 00000228 ".G......" */ + 0x08,0x88,0x0D,0x00,0x01,0x0C,0x03,0x00, /* 00000230 "........" */ + 0x00,0x00,0x00,0xF7,0x0C,0x00,0x00,0xF8, /* 00000238 "........" */ + 0x0C,0x88,0x0D,0x00,0x01,0x0C,0x03,0x00, /* 00000240 "........" */ + 0x00,0x00,0x0D,0xFF,0xFF,0x00,0x00,0x00, /* 00000248 "........" */ + 0xF3,0x87,0x17,0x00,0x00,0x0C,0x03,0x00, /* 00000250 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x0A,0x00,0xFF, /* 00000258 "........" */ + 0xFF,0x0B,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000260 "........" */ + 0x00,0x02,0x00,0x87,0x17,0x00,0x00,0x0C, /* 00000268 "........" */ + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000270 "........" */ + 0xF0,0xFF,0xFF,0xFF,0xF4,0x00,0x00,0x00, /* 00000278 "........" */ + 0x00,0x00,0x00,0x00,0x05,0x79,0x00,0x8A, /* 00000280 ".....y.." */ + 0x50,0x52,0x54,0x30,0x0A,0x5C,0x4D,0x4D, /* 00000288 "PRT0.\MM" */ + 0x49,0x4E,0x8A,0x50,0x52,0x54,0x30,0x0A, /* 00000290 "IN.PRT0." */ + 0x60,0x4D,0x4D,0x41,0x58,0x8A,0x50,0x52, /* 00000298 "`MMAX.PR" */ + 0x54,0x30,0x0A,0x68,0x4D,0x4C,0x45,0x4E, /* 000002A0 "T0.hMLEN" */ + 0x70,0x50,0x4D,0x49,0x4E,0x4D,0x4D,0x49, /* 000002A8 "pPMINMMI" */ + 0x4E,0x70,0x50,0x4C,0x45,0x4E,0x4D,0x4C, /* 000002B0 "NpPLENML" */ + 0x45,0x4E,0x72,0x4D,0x4D,0x49,0x4E,0x4D, /* 000002B8 "ENrMMINM" */ + 0x4C,0x45,0x4E,0x4D,0x4D,0x41,0x58,0x74, /* 000002C0 "LENMMAXt" */ + 0x4D,0x4D,0x41,0x58,0x01,0x4D,0x4D,0x41, /* 000002C8 "MMAX.MMA" */ + 0x58,0xA4,0x50,0x52,0x54,0x30,0x08,0x42, /* 000002D0 "X.PRT0.B" */ + 0x55,0x46,0x41,0x11,0x09,0x0A,0x06,0x23, /* 000002D8 "UFA....#" */ + 0x20,0x0C,0x18,0x79,0x00,0x08,0x42,0x55, /* 000002E0 " ..y..BU" */ + 0x46,0x42,0x11,0x09,0x0A,0x06,0x23,0x00, /* 000002E8 "FB....#." */ + 0x00,0x18,0x79,0x00,0x8B,0x42,0x55,0x46, /* 000002F0 "..y..BUF" */ + 0x42,0x01,0x49,0x52,0x51,0x56,0x5B,0x82, /* 000002F8 "B.IRQV[." */ + 0x48,0x08,0x4C,0x4E,0x4B,0x41,0x08,0x5F, /* 00000300 "H.LNKA._" */ + 0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F, /* 00000308 "HID.A..." */ + 0x08,0x5F,0x55,0x49,0x44,0x01,0x14,0x1C, /* 00000310 "._UID..." */ + 0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49, /* 00000318 "_STA.{PI" */ + 0x52,0x41,0x0A,0x80,0x60,0xA0,0x08,0x93, /* 00000320 "RA..`..." */ + 0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04, /* 00000328 "`......." */ + 0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52, /* 00000330 "....._PR" */ + 0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14, /* 00000338 "S..BUFA." */ + 0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50, /* 00000340 "._DIS.}P" */ + 0x49,0x52,0x41,0x0A,0x80,0x50,0x49,0x52, /* 00000348 "IRA..PIR" */ + 0x41,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00, /* 00000350 "A.._CRS." */ + 0x7B,0x50,0x49,0x52,0x41,0x0A,0x0F,0x60, /* 00000358 "{PIRA..`" */ + 0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4, /* 00000360 "y.`IRQV." */ + 0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53, /* 00000368 "BUFB.._S" */ + 0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52, /* 00000370 "RS..h.IR" */ + 0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60, /* 00000378 "Q1.IRQ1`" */ + 0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x41, /* 00000380 "v`p`PIRA" */ + 0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,0x42, /* 00000388 "[.I.LNKB" */ + 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000390 "._HID.A." */ + 0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A, /* 00000398 "..._UID." */ + 0x02,0x14,0x1C,0x5F,0x53,0x54,0x41,0x00, /* 000003A0 "..._STA." */ + 0x7B,0x50,0x49,0x52,0x42,0x0A,0x80,0x60, /* 000003A8 "{PIRB..`" */ + 0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A, /* 000003B0 "...`...." */ + 0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B, /* 000003B8 "........" */ + 0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,0x55, /* 000003C0 "_PRS..BU" */ + 0x46,0x41,0x14,0x11,0x5F,0x44,0x49,0x53, /* 000003C8 "FA.._DIS" */ + 0x00,0x7D,0x50,0x49,0x52,0x42,0x0A,0x80, /* 000003D0 ".}PIRB.." */ + 0x50,0x49,0x52,0x42,0x14,0x1A,0x5F,0x43, /* 000003D8 "PIRB.._C" */ + 0x52,0x53,0x00,0x7B,0x50,0x49,0x52,0x42, /* 000003E0 "RS.{PIRB" */ + 0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,0x52, /* 000003E8 "..`y.`IR" */ + 0x51,0x56,0xA4,0x42,0x55,0x46,0x42,0x14, /* 000003F0 "QV.BUFB." */ + 0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68, /* 000003F8 "._SRS..h" */ + 0x01,0x49,0x52,0x51,0x31,0x82,0x49,0x52, /* 00000400 ".IRQ1.IR" */ + 0x51,0x31,0x60,0x76,0x60,0x70,0x60,0x50, /* 00000408 "Q1`v`p`P" */ + 0x49,0x52,0x42,0x5B,0x82,0x49,0x08,0x4C, /* 00000410 "IRB[.I.L" */ + 0x4E,0x4B,0x43,0x08,0x5F,0x48,0x49,0x44, /* 00000418 "NKC._HID" */ + 0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55, /* 00000420 ".A...._U" */ + 0x49,0x44,0x0A,0x03,0x14,0x1C,0x5F,0x53, /* 00000428 "ID...._S" */ + 0x54,0x41,0x00,0x7B,0x50,0x49,0x52,0x43, /* 00000430 "TA.{PIRC" */ + 0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,0x0A, /* 00000438 "..`...`." */ + 0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A, /* 00000440 "........" */ + 0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,0x00, /* 00000448 "..._PRS." */ + 0xA4,0x42,0x55,0x46,0x41,0x14,0x11,0x5F, /* 00000450 ".BUFA.._" */ + 0x44,0x49,0x53,0x00,0x7D,0x50,0x49,0x52, /* 00000458 "DIS.}PIR" */ + 0x43,0x0A,0x80,0x50,0x49,0x52,0x43,0x14, /* 00000460 "C..PIRC." */ + 0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,0x50, /* 00000468 "._CRS.{P" */ + 0x49,0x52,0x43,0x0A,0x0F,0x60,0x79,0x01, /* 00000470 "IRC..`y." */ + 0x60,0x49,0x52,0x51,0x56,0xA4,0x42,0x55, /* 00000478 "`IRQV.BU" */ + 0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,0x53, /* 00000480 "FB.._SRS" */ + 0x01,0x8B,0x68,0x01,0x49,0x52,0x51,0x31, /* 00000488 "..h.IRQ1" */ + 0x82,0x49,0x52,0x51,0x31,0x60,0x76,0x60, /* 00000490 ".IRQ1`v`" */ + 0x70,0x60,0x50,0x49,0x52,0x43,0x5B,0x82, /* 00000498 "p`PIRC[." */ + 0x49,0x08,0x4C,0x4E,0x4B,0x44,0x08,0x5F, /* 000004A0 "I.LNKD._" */ + 0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F, /* 000004A8 "HID.A..." */ + 0x08,0x5F,0x55,0x49,0x44,0x0A,0x04,0x14, /* 000004B0 "._UID..." */ + 0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,0x50, /* 000004B8 "._STA.{P" */ + 0x49,0x52,0x44,0x0A,0x80,0x60,0xA0,0x08, /* 000004C0 "IRD..`.." */ + 0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1, /* 000004C8 ".`......" */ + 0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50, /* 000004D0 "......_P" */ + 0x52,0x53,0x00,0xA4,0x42,0x55,0x46,0x41, /* 000004D8 "RS..BUFA" */ + 0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D, /* 000004E0 ".._DIS.}" */ + 0x50,0x49,0x52,0x44,0x0A,0x80,0x50,0x49, /* 000004E8 "PIRD..PI" */ + 0x52,0x44,0x14,0x1A,0x5F,0x43,0x52,0x53, /* 000004F0 "RD.._CRS" */ + 0x00,0x7B,0x50,0x49,0x52,0x44,0x0A,0x0F, /* 000004F8 ".{PIRD.." */ + 0x60,0x79,0x01,0x60,0x49,0x52,0x51,0x56, /* 00000500 "`y.`IRQV" */ + 0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,0x5F, /* 00000508 ".BUFB.._" */ + 0x53,0x52,0x53,0x01,0x8B,0x68,0x01,0x49, /* 00000510 "SRS..h.I" */ + 0x52,0x51,0x31,0x82,0x49,0x52,0x51,0x31, /* 00000518 "RQ1.IRQ1" */ + 0x60,0x76,0x60,0x70,0x60,0x50,0x49,0x52, /* 00000520 "`v`p`PIR" */ + 0x44,0x5B,0x82,0x44,0x05,0x48,0x50,0x45, /* 00000528 "D[.D.HPE" */ + 0x54,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41, /* 00000530 "T._HID.A" */ + 0xD0,0x01,0x03,0x08,0x5F,0x55,0x49,0x44, /* 00000538 "...._UID" */ + 0x00,0x14,0x18,0x5F,0x53,0x54,0x41,0x00, /* 00000540 "..._STA." */ + 0xA0,0x0C,0x93,0x5E,0x5E,0x5E,0x48,0x50, /* 00000548 "...^^^HP" */ + 0x45,0x54,0x00,0xA4,0x00,0xA1,0x04,0xA4, /* 00000550 "ET......" */ + 0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11, /* 00000558 "..._CRS." */ + 0x1F,0x0A,0x1C,0x87,0x17,0x00,0x00,0x0D, /* 00000560 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xD0, /* 00000568 "........" */ + 0xFE,0xFF,0x03,0xD0,0xFE,0x00,0x00,0x00, /* 00000570 "........" */ + 0x00,0x00,0x04,0x00,0x00,0x79,0x00,0x14, /* 00000578 ".....y.." */ + 0x16,0x5F,0x50,0x52,0x54,0x00,0xA0,0x0A, /* 00000580 "._PRT..." */ + 0x50,0x49,0x43,0x44,0xA4,0x50,0x52,0x54, /* 00000588 "PICD.PRT" */ + 0x41,0xA4,0x50,0x52,0x54,0x50,0x08,0x50, /* 00000590 "A.PRTP.P" */ + 0x52,0x54,0x50,0x12,0x49,0x36,0x3C,0x12, /* 00000598 "RTP.I6<." */ + 0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,0x00, /* 000005A0 "........" */ + 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04, /* 000005A8 "LNKB...." */ + 0x0C,0xFF,0xFF,0x01,0x00,0x01,0x4C,0x4E, /* 000005B0 "......LN" */ + 0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 000005B8 "KC......" */ + 0xFF,0x01,0x00,0x0A,0x02,0x4C,0x4E,0x4B, /* 000005C0 ".....LNK" */ + 0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 000005C8 "D......." */ + 0x01,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41, /* 000005D0 "....LNKA" */ 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x02, /* 000005D8 "........" */ - 0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,0x12, /* 000005E0 "..LNKD.." */ - 0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A, /* 000005E8 "........" */ - 0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E, /* 000005F0 ".LNKA..." */ - 0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x03, /* 000005F8 "........" */ - 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04, /* 00000600 "LNKB...." */ - 0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C,0x4E, /* 00000608 "......LN" */ - 0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 00000610 "KD......" */ - 0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B,0x41, /* 00000618 "....LNKA" */ - 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03, /* 00000620 "........" */ - 0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,0x00, /* 00000628 "...LNKB." */ - 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,0x00, /* 00000630 "........" */ - 0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 00000638 "..LNKC.." */ - 0x0D,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00, /* 00000640 "........" */ - 0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04, /* 00000648 "LNKA...." */ - 0x0C,0xFF,0xFF,0x04,0x00,0x01,0x4C,0x4E, /* 00000650 "......LN" */ - 0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 00000658 "KB......" */ - 0xFF,0x04,0x00,0x0A,0x02,0x4C,0x4E,0x4B, /* 00000660 ".....LNK" */ - 0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000668 "C......." */ - 0x04,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x44, /* 00000670 "....LNKD" */ - 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x05, /* 00000678 "........" */ - 0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,0x12, /* 00000680 "..LNKB.." */ - 0x0D,0x04,0x0C,0xFF,0xFF,0x05,0x00,0x01, /* 00000688 "........" */ - 0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04, /* 00000690 "LNKC...." */ - 0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02,0x4C, /* 00000698 ".......L" */ - 0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C, /* 000006A0 "NKD....." */ - 0xFF,0xFF,0x05,0x00,0x0A,0x03,0x4C,0x4E, /* 000006A8 "......LN" */ - 0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000006B0 "KA......" */ - 0xFF,0x06,0x00,0x00,0x4C,0x4E,0x4B,0x43, /* 000006B8 "....LNKC" */ + 0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 000005E0 "..LNKC.." */ + 0x0D,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x01, /* 000005E8 "........" */ + 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 000005F0 "LNKD...." */ + 0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x02,0x4C, /* 000005F8 ".......L" */ + 0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C, /* 00000600 "NKA....." */ + 0xFF,0xFF,0x02,0x00,0x0A,0x03,0x4C,0x4E, /* 00000608 "......LN" */ + 0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 00000610 "KB......" */ + 0xFF,0x03,0x00,0x00,0x4C,0x4E,0x4B,0x44, /* 00000618 "....LNKD" */ + 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x03, /* 00000620 "........" */ + 0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000628 "..LNKA.." */ + 0x0E,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A, /* 00000630 "........" */ + 0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E, /* 00000638 ".LNKB..." */ + 0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x03, /* 00000640 "........" */ + 0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04, /* 00000648 "LNKC...." */ + 0x0C,0xFF,0xFF,0x04,0x00,0x00,0x4C,0x4E, /* 00000650 "......LN" */ + 0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 00000658 "KA......" */ + 0xFF,0x04,0x00,0x01,0x4C,0x4E,0x4B,0x42, /* 00000660 "....LNKB" */ + 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x04, /* 00000668 "........" */ + 0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00, /* 00000670 "...LNKC." */ + 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x04,0x00, /* 00000678 "........" */ + 0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,0x12, /* 00000680 "..LNKD.." */ + 0x0D,0x04,0x0C,0xFF,0xFF,0x05,0x00,0x00, /* 00000688 "........" */ + 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04, /* 00000690 "LNKB...." */ + 0x0C,0xFF,0xFF,0x05,0x00,0x01,0x4C,0x4E, /* 00000698 "......LN" */ + 0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 000006A0 "KC......" */ + 0xFF,0x05,0x00,0x0A,0x02,0x4C,0x4E,0x4B, /* 000006A8 ".....LNK" */ + 0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 000006B0 "D......." */ + 0x05,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41, /* 000006B8 "....LNKA" */ 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x06, /* 000006C0 "........" */ - 0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,0x12, /* 000006C8 "..LNKD.." */ - 0x0E,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x0A, /* 000006D0 "........" */ - 0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E, /* 000006D8 ".LNKA..." */ - 0x04,0x0C,0xFF,0xFF,0x06,0x00,0x0A,0x03, /* 000006E0 "........" */ - 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04, /* 000006E8 "LNKB...." */ - 0x0C,0xFF,0xFF,0x07,0x00,0x00,0x4C,0x4E, /* 000006F0 "......LN" */ - 0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000006F8 "KD......" */ - 0xFF,0x07,0x00,0x01,0x4C,0x4E,0x4B,0x41, /* 00000700 "....LNKA" */ - 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x07, /* 00000708 "........" */ - 0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,0x00, /* 00000710 "...LNKB." */ - 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x07,0x00, /* 00000718 "........" */ - 0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 00000720 "..LNKC.." */ - 0x0D,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x00, /* 00000728 "........" */ - 0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04, /* 00000730 "LNKA...." */ - 0x0C,0xFF,0xFF,0x08,0x00,0x01,0x4C,0x4E, /* 00000738 "......LN" */ - 0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 00000740 "KB......" */ - 0xFF,0x08,0x00,0x0A,0x02,0x4C,0x4E,0x4B, /* 00000748 ".....LNK" */ - 0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000750 "C......." */ - 0x08,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x44, /* 00000758 "....LNKD" */ - 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x09, /* 00000760 "........" */ - 0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,0x12, /* 00000768 "..LNKB.." */ - 0x0D,0x04,0x0C,0xFF,0xFF,0x09,0x00,0x01, /* 00000770 "........" */ - 0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04, /* 00000778 "LNKC...." */ - 0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x02,0x4C, /* 00000780 ".......L" */ - 0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C, /* 00000788 "NKD....." */ - 0xFF,0xFF,0x09,0x00,0x0A,0x03,0x4C,0x4E, /* 00000790 "......LN" */ - 0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 00000798 "KA......" */ - 0xFF,0x0A,0x00,0x00,0x4C,0x4E,0x4B,0x43, /* 000007A0 "....LNKC" */ + 0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 000006C8 "..LNKC.." */ + 0x0D,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x01, /* 000006D0 "........" */ + 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 000006D8 "LNKD...." */ + 0x0C,0xFF,0xFF,0x06,0x00,0x0A,0x02,0x4C, /* 000006E0 ".......L" */ + 0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C, /* 000006E8 "NKA....." */ + 0xFF,0xFF,0x06,0x00,0x0A,0x03,0x4C,0x4E, /* 000006F0 "......LN" */ + 0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000006F8 "KB......" */ + 0xFF,0x07,0x00,0x00,0x4C,0x4E,0x4B,0x44, /* 00000700 "....LNKD" */ + 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x07, /* 00000708 "........" */ + 0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 00000710 "..LNKA.." */ + 0x0E,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A, /* 00000718 "........" */ + 0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E, /* 00000720 ".LNKB..." */ + 0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A,0x03, /* 00000728 "........" */ + 0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04, /* 00000730 "LNKC...." */ + 0x0C,0xFF,0xFF,0x08,0x00,0x00,0x4C,0x4E, /* 00000738 "......LN" */ + 0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 00000740 "KA......" */ + 0xFF,0x08,0x00,0x01,0x4C,0x4E,0x4B,0x42, /* 00000748 "....LNKB" */ + 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x08, /* 00000750 "........" */ + 0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00, /* 00000758 "...LNKC." */ + 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x08,0x00, /* 00000760 "........" */ + 0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,0x12, /* 00000768 "..LNKD.." */ + 0x0D,0x04,0x0C,0xFF,0xFF,0x09,0x00,0x00, /* 00000770 "........" */ + 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04, /* 00000778 "LNKB...." */ + 0x0C,0xFF,0xFF,0x09,0x00,0x01,0x4C,0x4E, /* 00000780 "......LN" */ + 0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 00000788 "KC......" */ + 0xFF,0x09,0x00,0x0A,0x02,0x4C,0x4E,0x4B, /* 00000790 ".....LNK" */ + 0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000798 "D......." */ + 0x09,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41, /* 000007A0 "....LNKA" */ 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0A, /* 000007A8 "........" */ - 0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,0x12, /* 000007B0 "..LNKD.." */ - 0x0E,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x0A, /* 000007B8 "........" */ - 0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E, /* 000007C0 ".LNKA..." */ - 0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x0A,0x03, /* 000007C8 "........" */ - 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04, /* 000007D0 "LNKB...." */ - 0x0C,0xFF,0xFF,0x0B,0x00,0x00,0x4C,0x4E, /* 000007D8 "......LN" */ - 0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000007E0 "KD......" */ - 0xFF,0x0B,0x00,0x01,0x4C,0x4E,0x4B,0x41, /* 000007E8 "....LNKA" */ - 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0B, /* 000007F0 "........" */ - 0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,0x00, /* 000007F8 "...LNKB." */ - 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0B,0x00, /* 00000800 "........" */ - 0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 00000808 "..LNKC.." */ - 0x0D,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x00, /* 00000810 "........" */ - 0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04, /* 00000818 "LNKA...." */ - 0x0C,0xFF,0xFF,0x0C,0x00,0x01,0x4C,0x4E, /* 00000820 "......LN" */ - 0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 00000828 "KB......" */ - 0xFF,0x0C,0x00,0x0A,0x02,0x4C,0x4E,0x4B, /* 00000830 ".....LNK" */ - 0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000838 "C......." */ - 0x0C,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x44, /* 00000840 "....LNKD" */ - 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0D, /* 00000848 "........" */ - 0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,0x12, /* 00000850 "..LNKB.." */ - 0x0D,0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x01, /* 00000858 "........" */ - 0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,0x04, /* 00000860 "LNKC...." */ - 0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x02,0x4C, /* 00000868 ".......L" */ - 0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C, /* 00000870 "NKD....." */ - 0xFF,0xFF,0x0D,0x00,0x0A,0x03,0x4C,0x4E, /* 00000878 "......LN" */ - 0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 00000880 "KA......" */ - 0xFF,0x0E,0x00,0x00,0x4C,0x4E,0x4B,0x43, /* 00000888 "....LNKC" */ + 0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 000007B0 "..LNKC.." */ + 0x0D,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x01, /* 000007B8 "........" */ + 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 000007C0 "LNKD...." */ + 0x0C,0xFF,0xFF,0x0A,0x00,0x0A,0x02,0x4C, /* 000007C8 ".......L" */ + 0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C, /* 000007D0 "NKA....." */ + 0xFF,0xFF,0x0A,0x00,0x0A,0x03,0x4C,0x4E, /* 000007D8 "......LN" */ + 0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000007E0 "KB......" */ + 0xFF,0x0B,0x00,0x00,0x4C,0x4E,0x4B,0x44, /* 000007E8 "....LNKD" */ + 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0B, /* 000007F0 "........" */ + 0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 000007F8 "..LNKA.." */ + 0x0E,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A, /* 00000800 "........" */ + 0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E, /* 00000808 ".LNKB..." */ + 0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A,0x03, /* 00000810 "........" */ + 0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04, /* 00000818 "LNKC...." */ + 0x0C,0xFF,0xFF,0x0C,0x00,0x00,0x4C,0x4E, /* 00000820 "......LN" */ + 0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 00000828 "KA......" */ + 0xFF,0x0C,0x00,0x01,0x4C,0x4E,0x4B,0x42, /* 00000830 "....LNKB" */ + 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0C, /* 00000838 "........" */ + 0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00, /* 00000840 "...LNKC." */ + 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0C,0x00, /* 00000848 "........" */ + 0x0A,0x03,0x4C,0x4E,0x4B,0x44,0x00,0x12, /* 00000850 "..LNKD.." */ + 0x0D,0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x00, /* 00000858 "........" */ + 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04, /* 00000860 "LNKB...." */ + 0x0C,0xFF,0xFF,0x0D,0x00,0x01,0x4C,0x4E, /* 00000868 "......LN" */ + 0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF, /* 00000870 "KC......" */ + 0xFF,0x0D,0x00,0x0A,0x02,0x4C,0x4E,0x4B, /* 00000878 ".....LNK" */ + 0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF, /* 00000880 "D......." */ + 0x0D,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x41, /* 00000888 "....LNKA" */ 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0E, /* 00000890 "........" */ - 0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,0x12, /* 00000898 "..LNKD.." */ - 0x0E,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x0A, /* 000008A0 "........" */ - 0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E, /* 000008A8 ".LNKA..." */ - 0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x0A,0x03, /* 000008B0 "........" */ - 0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,0x04, /* 000008B8 "LNKB...." */ - 0x0C,0xFF,0xFF,0x0F,0x00,0x00,0x4C,0x4E, /* 000008C0 "......LN" */ - 0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000008C8 "KD......" */ - 0xFF,0x0F,0x00,0x01,0x4C,0x4E,0x4B,0x41, /* 000008D0 "....LNKA" */ - 0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0F, /* 000008D8 "........" */ - 0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,0x00, /* 000008E0 "...LNKB." */ - 0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0F,0x00, /* 000008E8 "........" */ - 0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,0x08, /* 000008F0 "..LNKC.." */ - 0x50,0x52,0x54,0x41,0x12,0x41,0x2F,0x3C, /* 000008F8 "PRTA.A/<" */ - 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01,0x00, /* 00000900 "........" */ - 0x00,0x00,0x0A,0x14,0x12,0x0B,0x04,0x0C, /* 00000908 "........" */ - 0xFF,0xFF,0x01,0x00,0x01,0x00,0x0A,0x15, /* 00000910 "........" */ - 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x01,0x00, /* 00000918 "........" */ - 0x0A,0x02,0x00,0x0A,0x16,0x12,0x0C,0x04, /* 00000920 "........" */ - 0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,0x00, /* 00000928 "........" */ - 0x0A,0x17,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000930 "........" */ - 0x02,0x00,0x00,0x00,0x0A,0x18,0x12,0x0B, /* 00000938 "........" */ - 0x04,0x0C,0xFF,0xFF,0x02,0x00,0x01,0x00, /* 00000940 "........" */ - 0x0A,0x19,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000948 "........" */ - 0x02,0x00,0x0A,0x02,0x00,0x0A,0x1A,0x12, /* 00000950 "........" */ - 0x0C,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A, /* 00000958 "........" */ - 0x03,0x00,0x0A,0x1B,0x12,0x0B,0x04,0x0C, /* 00000960 "........" */ - 0xFF,0xFF,0x03,0x00,0x00,0x00,0x0A,0x1C, /* 00000968 "........" */ - 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03,0x00, /* 00000970 "........" */ - 0x01,0x00,0x0A,0x1D,0x12,0x0C,0x04,0x0C, /* 00000978 "........" */ - 0xFF,0xFF,0x03,0x00,0x0A,0x02,0x00,0x0A, /* 00000980 "........" */ - 0x1E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x03, /* 00000988 "........" */ - 0x00,0x0A,0x03,0x00,0x0A,0x1F,0x12,0x0B, /* 00000990 "........" */ - 0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00,0x00, /* 00000998 "........" */ - 0x0A,0x20,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 000009A0 ". ......" */ - 0x04,0x00,0x01,0x00,0x0A,0x21,0x12,0x0C, /* 000009A8 ".....!.." */ - 0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A,0x02, /* 000009B0 "........" */ - 0x00,0x0A,0x22,0x12,0x0C,0x04,0x0C,0xFF, /* 000009B8 ".."....." */ - 0xFF,0x04,0x00,0x0A,0x03,0x00,0x0A,0x23, /* 000009C0 ".......#" */ - 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x05,0x00, /* 000009C8 "........" */ - 0x00,0x00,0x0A,0x24,0x12,0x0B,0x04,0x0C, /* 000009D0 "...$...." */ - 0xFF,0xFF,0x05,0x00,0x01,0x00,0x0A,0x25, /* 000009D8 ".......%" */ - 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x05,0x00, /* 000009E0 "........" */ - 0x0A,0x02,0x00,0x0A,0x26,0x12,0x0C,0x04, /* 000009E8 "....&..." */ - 0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x03,0x00, /* 000009F0 "........" */ - 0x0A,0x27,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 000009F8 ".'......" */ - 0x06,0x00,0x00,0x00,0x0A,0x28,0x12,0x0B, /* 00000A00 ".....(.." */ - 0x04,0x0C,0xFF,0xFF,0x06,0x00,0x01,0x00, /* 00000A08 "........" */ - 0x0A,0x29,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000A10 ".)......" */ - 0x06,0x00,0x0A,0x02,0x00,0x0A,0x2A,0x12, /* 00000A18 "......*." */ - 0x0C,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x0A, /* 00000A20 "........" */ - 0x03,0x00,0x0A,0x2B,0x12,0x0B,0x04,0x0C, /* 00000A28 "...+...." */ - 0xFF,0xFF,0x07,0x00,0x00,0x00,0x0A,0x2C, /* 00000A30 ".......," */ - 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x07,0x00, /* 00000A38 "........" */ - 0x01,0x00,0x0A,0x2D,0x12,0x0C,0x04,0x0C, /* 00000A40 "...-...." */ - 0xFF,0xFF,0x07,0x00,0x0A,0x02,0x00,0x0A, /* 00000A48 "........" */ - 0x2E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x07, /* 00000A50 "........" */ - 0x00,0x0A,0x03,0x00,0x0A,0x2F,0x12,0x0B, /* 00000A58 "...../.." */ - 0x04,0x0C,0xFF,0xFF,0x08,0x00,0x00,0x00, /* 00000A60 "........" */ - 0x0A,0x11,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000A68 "........" */ - 0x08,0x00,0x01,0x00,0x0A,0x12,0x12,0x0C, /* 00000A70 "........" */ - 0x04,0x0C,0xFF,0xFF,0x08,0x00,0x0A,0x02, /* 00000A78 "........" */ - 0x00,0x0A,0x13,0x12,0x0C,0x04,0x0C,0xFF, /* 00000A80 "........" */ - 0xFF,0x08,0x00,0x0A,0x03,0x00,0x0A,0x14, /* 00000A88 "........" */ - 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x09,0x00, /* 00000A90 "........" */ - 0x00,0x00,0x0A,0x15,0x12,0x0B,0x04,0x0C, /* 00000A98 "........" */ - 0xFF,0xFF,0x09,0x00,0x01,0x00,0x0A,0x16, /* 00000AA0 "........" */ - 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x09,0x00, /* 00000AA8 "........" */ - 0x0A,0x02,0x00,0x0A,0x17,0x12,0x0C,0x04, /* 00000AB0 "........" */ - 0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x03,0x00, /* 00000AB8 "........" */ - 0x0A,0x18,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000AC0 "........" */ - 0x0A,0x00,0x00,0x00,0x0A,0x19,0x12,0x0B, /* 00000AC8 "........" */ - 0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x01,0x00, /* 00000AD0 "........" */ - 0x0A,0x1A,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000AD8 "........" */ - 0x0A,0x00,0x0A,0x02,0x00,0x0A,0x1B,0x12, /* 00000AE0 "........" */ - 0x0C,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x0A, /* 00000AE8 "........" */ - 0x03,0x00,0x0A,0x1C,0x12,0x0B,0x04,0x0C, /* 00000AF0 "........" */ - 0xFF,0xFF,0x0B,0x00,0x00,0x00,0x0A,0x1D, /* 00000AF8 "........" */ - 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0B,0x00, /* 00000B00 "........" */ - 0x01,0x00,0x0A,0x1E,0x12,0x0C,0x04,0x0C, /* 00000B08 "........" */ - 0xFF,0xFF,0x0B,0x00,0x0A,0x02,0x00,0x0A, /* 00000B10 "........" */ - 0x1F,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0B, /* 00000B18 "........" */ - 0x00,0x0A,0x03,0x00,0x0A,0x20,0x12,0x0B, /* 00000B20 "..... .." */ - 0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x00,0x00, /* 00000B28 "........" */ - 0x0A,0x21,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000B30 ".!......" */ - 0x0C,0x00,0x01,0x00,0x0A,0x22,0x12,0x0C, /* 00000B38 ".....".." */ - 0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x0A,0x02, /* 00000B40 "........" */ - 0x00,0x0A,0x23,0x12,0x0C,0x04,0x0C,0xFF, /* 00000B48 "..#....." */ - 0xFF,0x0C,0x00,0x0A,0x03,0x00,0x0A,0x24, /* 00000B50 ".......$" */ - 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0D,0x00, /* 00000B58 "........" */ - 0x00,0x00,0x0A,0x25,0x12,0x0B,0x04,0x0C, /* 00000B60 "...%...." */ - 0xFF,0xFF,0x0D,0x00,0x01,0x00,0x0A,0x26, /* 00000B68 ".......&" */ - 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0D,0x00, /* 00000B70 "........" */ - 0x0A,0x02,0x00,0x0A,0x27,0x12,0x0C,0x04, /* 00000B78 "....'..." */ - 0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x03,0x00, /* 00000B80 "........" */ - 0x0A,0x28,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000B88 ".(......" */ - 0x0E,0x00,0x00,0x00,0x0A,0x29,0x12,0x0B, /* 00000B90 ".....).." */ - 0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x01,0x00, /* 00000B98 "........" */ - 0x0A,0x2A,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000BA0 ".*......" */ - 0x0E,0x00,0x0A,0x02,0x00,0x0A,0x2B,0x12, /* 00000BA8 "......+." */ - 0x0C,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x0A, /* 00000BB0 "........" */ - 0x03,0x00,0x0A,0x2C,0x12,0x0B,0x04,0x0C, /* 00000BB8 "...,...." */ - 0xFF,0xFF,0x0F,0x00,0x00,0x00,0x0A,0x2D, /* 00000BC0 ".......-" */ - 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0F,0x00, /* 00000BC8 "........" */ - 0x01,0x00,0x0A,0x2E,0x12,0x0C,0x04,0x0C, /* 00000BD0 "........" */ - 0xFF,0xFF,0x0F,0x00,0x0A,0x02,0x00,0x0A, /* 00000BD8 "........" */ - 0x2F,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0F, /* 00000BE0 "/......." */ - 0x00,0x0A,0x03,0x00,0x0A,0x10,0x5B,0x82, /* 00000BE8 "......[." */ - 0x46,0x37,0x49,0x53,0x41,0x5F,0x08,0x5F, /* 00000BF0 "F7ISA_._" */ - 0x41,0x44,0x52,0x0C,0x00,0x00,0x01,0x00, /* 00000BF8 "ADR....." */ - 0x5B,0x80,0x50,0x49,0x52,0x51,0x02,0x0A, /* 00000C00 "[.PIRQ.." */ - 0x60,0x0A,0x04,0x10,0x2E,0x5C,0x00,0x5B, /* 00000C08 "`....\.[" */ - 0x81,0x29,0x5C,0x2F,0x04,0x5F,0x53,0x42, /* 00000C10 ".)\/._SB" */ - 0x5F,0x50,0x43,0x49,0x30,0x49,0x53,0x41, /* 00000C18 "_PCI0ISA" */ - 0x5F,0x50,0x49,0x52,0x51,0x01,0x50,0x49, /* 00000C20 "_PIRQ.PI" */ - 0x52,0x41,0x08,0x50,0x49,0x52,0x42,0x08, /* 00000C28 "RA.PIRB." */ - 0x50,0x49,0x52,0x43,0x08,0x50,0x49,0x52, /* 00000C30 "PIRC.PIR" */ - 0x44,0x08,0x5B,0x82,0x46,0x0B,0x53,0x59, /* 00000C38 "D.[.F.SY" */ - 0x53,0x52,0x08,0x5F,0x48,0x49,0x44,0x0C, /* 00000C40 "SR._HID." */ - 0x41,0xD0,0x0C,0x02,0x08,0x5F,0x55,0x49, /* 00000C48 "A...._UI" */ - 0x44,0x01,0x08,0x43,0x52,0x53,0x5F,0x11, /* 00000C50 "D..CRS_." */ - 0x4E,0x08,0x0A,0x8A,0x47,0x01,0x10,0x00, /* 00000C58 "N...G..." */ - 0x10,0x00,0x00,0x10,0x47,0x01,0x22,0x00, /* 00000C60 "....G."." */ - 0x22,0x00,0x00,0x0C,0x47,0x01,0x30,0x00, /* 00000C68 ""...G.0." */ - 0x30,0x00,0x00,0x10,0x47,0x01,0x44,0x00, /* 00000C70 "0...G.D." */ - 0x44,0x00,0x00,0x1C,0x47,0x01,0x62,0x00, /* 00000C78 "D...G.b." */ - 0x62,0x00,0x00,0x02,0x47,0x01,0x65,0x00, /* 00000C80 "b...G.e." */ - 0x65,0x00,0x00,0x0B,0x47,0x01,0x72,0x00, /* 00000C88 "e...G.r." */ - 0x72,0x00,0x00,0x0E,0x47,0x01,0x80,0x00, /* 00000C90 "r...G..." */ - 0x80,0x00,0x00,0x01,0x47,0x01,0x84,0x00, /* 00000C98 "....G..." */ - 0x84,0x00,0x00,0x03,0x47,0x01,0x88,0x00, /* 00000CA0 "....G..." */ - 0x88,0x00,0x00,0x01,0x47,0x01,0x8C,0x00, /* 00000CA8 "....G..." */ - 0x8C,0x00,0x00,0x03,0x47,0x01,0x90,0x00, /* 00000CB0 "....G..." */ - 0x90,0x00,0x00,0x10,0x47,0x01,0xA2,0x00, /* 00000CB8 "....G..." */ - 0xA2,0x00,0x00,0x1C,0x47,0x01,0xE0,0x00, /* 00000CC0 "....G..." */ - 0xE0,0x00,0x00,0x10,0x47,0x01,0xA0,0x08, /* 00000CC8 "....G..." */ - 0xA0,0x08,0x00,0x04,0x47,0x01,0xC0,0x0C, /* 00000CD0 "....G..." */ - 0xC0,0x0C,0x00,0x10,0x47,0x01,0xD0,0x04, /* 00000CD8 "....G..." */ - 0xD0,0x04,0x00,0x02,0x79,0x00,0x14,0x0B, /* 00000CE0 "....y..." */ - 0x5F,0x43,0x52,0x53,0x00,0xA4,0x43,0x52, /* 00000CE8 "_CRS..CR" */ - 0x53,0x5F,0x5B,0x82,0x2B,0x50,0x49,0x43, /* 00000CF0 "S_[.+PIC" */ - 0x5F,0x08,0x5F,0x48,0x49,0x44,0x0B,0x41, /* 00000CF8 "_._HID.A" */ - 0xD0,0x08,0x5F,0x43,0x52,0x53,0x11,0x18, /* 00000D00 ".._CRS.." */ - 0x0A,0x15,0x47,0x01,0x20,0x00,0x20,0x00, /* 00000D08 "..G. . ." */ - 0x01,0x02,0x47,0x01,0xA0,0x00,0xA0,0x00, /* 00000D10 "..G....." */ - 0x01,0x02,0x22,0x04,0x00,0x79,0x00,0x5B, /* 00000D18 ".."..y.[" */ - 0x82,0x47,0x05,0x44,0x4D,0x41,0x30,0x08, /* 00000D20 ".G.DMA0." */ - 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x02, /* 00000D28 "_HID.A.." */ - 0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x41, /* 00000D30 ".._CRS.A" */ - 0x04,0x0A,0x3D,0x2A,0x10,0x04,0x47,0x01, /* 00000D38 "..=*..G." */ - 0x00,0x00,0x00,0x00,0x00,0x10,0x47,0x01, /* 00000D40 "......G." */ - 0x81,0x00,0x81,0x00,0x00,0x03,0x47,0x01, /* 00000D48 "......G." */ - 0x87,0x00,0x87,0x00,0x00,0x01,0x47,0x01, /* 00000D50 "......G." */ - 0x89,0x00,0x89,0x00,0x00,0x03,0x47,0x01, /* 00000D58 "......G." */ - 0x8F,0x00,0x8F,0x00,0x00,0x01,0x47,0x01, /* 00000D60 "......G." */ - 0xC0,0x00,0xC0,0x00,0x00,0x20,0x47,0x01, /* 00000D68 "..... G." */ - 0x80,0x04,0x80,0x04,0x00,0x10,0x79,0x00, /* 00000D70 "......y." */ - 0x5B,0x82,0x25,0x54,0x4D,0x52,0x5F,0x08, /* 00000D78 "[.%TMR_." */ - 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x01, /* 00000D80 "_HID.A.." */ - 0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x10, /* 00000D88 ".._CRS.." */ - 0x0A,0x0D,0x47,0x01,0x40,0x00,0x40,0x00, /* 00000D90 "..G.@.@." */ - 0x00,0x04,0x22,0x01,0x00,0x79,0x00,0x5B, /* 00000D98 ".."..y.[" */ - 0x82,0x25,0x52,0x54,0x43,0x5F,0x08,0x5F, /* 00000DA0 ".%RTC_._" */ - 0x48,0x49,0x44,0x0C,0x41,0xD0,0x0B,0x00, /* 00000DA8 "HID.A..." */ - 0x08,0x5F,0x43,0x52,0x53,0x11,0x10,0x0A, /* 00000DB0 "._CRS..." */ - 0x0D,0x47,0x01,0x70,0x00,0x70,0x00,0x00, /* 00000DB8 ".G.p.p.." */ - 0x02,0x22,0x00,0x01,0x79,0x00,0x5B,0x82, /* 00000DC0 "."..y.[." */ - 0x22,0x53,0x50,0x4B,0x52,0x08,0x5F,0x48, /* 00000DC8 ""SPKR._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x08,0x00,0x08, /* 00000DD0 "ID.A...." */ - 0x5F,0x43,0x52,0x53,0x11,0x0D,0x0A,0x0A, /* 00000DD8 "_CRS...." */ - 0x47,0x01,0x61,0x00,0x61,0x00,0x00,0x01, /* 00000DE0 "G.a.a..." */ - 0x79,0x00,0x5B,0x82,0x31,0x50,0x53,0x32, /* 00000DE8 "y.[.1PS2" */ - 0x4D,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41, /* 00000DF0 "M._HID.A" */ - 0xD0,0x0F,0x13,0x08,0x5F,0x43,0x49,0x44, /* 00000DF8 "...._CID" */ - 0x0C,0x41,0xD0,0x0F,0x13,0x14,0x09,0x5F, /* 00000E00 ".A....._" */ - 0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08, /* 00000E08 "STA....." */ - 0x5F,0x43,0x52,0x53,0x11,0x08,0x0A,0x05, /* 00000E10 "_CRS...." */ - 0x22,0x00,0x10,0x79,0x00,0x5B,0x82,0x42, /* 00000E18 ""..y.[.B" */ - 0x04,0x50,0x53,0x32,0x4B,0x08,0x5F,0x48, /* 00000E20 ".PS2K._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x03,0x03,0x08, /* 00000E28 "ID.A...." */ - 0x5F,0x43,0x49,0x44,0x0C,0x41,0xD0,0x03, /* 00000E30 "_CID.A.." */ - 0x0B,0x14,0x09,0x5F,0x53,0x54,0x41,0x00, /* 00000E38 "..._STA." */ - 0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53, /* 00000E40 "...._CRS" */ - 0x11,0x18,0x0A,0x15,0x47,0x01,0x60,0x00, /* 00000E48 "....G.`." */ - 0x60,0x00,0x00,0x01,0x47,0x01,0x64,0x00, /* 00000E50 "`...G.d." */ - 0x64,0x00,0x00,0x01,0x22,0x02,0x00,0x79, /* 00000E58 "d..."..y" */ - 0x00,0x5B,0x82,0x3A,0x46,0x44,0x43,0x30, /* 00000E60 ".[.:FDC0" */ - 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000E68 "._HID.A." */ - 0x07,0x00,0x14,0x09,0x5F,0x53,0x54,0x41, /* 00000E70 "...._STA" */ - 0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52, /* 00000E78 "....._CR" */ - 0x53,0x11,0x1B,0x0A,0x18,0x47,0x01,0xF0, /* 00000E80 "S....G.." */ - 0x03,0xF0,0x03,0x01,0x06,0x47,0x01,0xF7, /* 00000E88 ".....G.." */ - 0x03,0xF7,0x03,0x01,0x01,0x22,0x40,0x00, /* 00000E90 "....."@." */ - 0x2A,0x04,0x00,0x79,0x00,0x5B,0x82,0x46, /* 00000E98 "*..y.[.F" */ - 0x04,0x55,0x41,0x52,0x31,0x08,0x5F,0x48, /* 00000EA0 ".UAR1._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,0x08, /* 00000EA8 "ID.A...." */ - 0x5F,0x55,0x49,0x44,0x01,0x14,0x19,0x5F, /* 00000EB0 "_UID..._" */ - 0x53,0x54,0x41,0x00,0xA0,0x0D,0x93,0x5E, /* 00000EB8 "STA....^" */ - 0x5E,0x5E,0x5E,0x55,0x41,0x52,0x31,0x00, /* 00000EC0 "^^^UAR1." */ - 0xA4,0x00,0xA1,0x04,0xA4,0x0A,0x0F,0x08, /* 00000EC8 "........" */ - 0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D, /* 00000ED0 "_CRS...." */ - 0x47,0x01,0xF8,0x03,0xF8,0x03,0x08,0x08, /* 00000ED8 "G......." */ - 0x22,0x10,0x00,0x79,0x00,0x5B,0x82,0x47, /* 00000EE0 ""..y.[.G" */ - 0x04,0x55,0x41,0x52,0x32,0x08,0x5F,0x48, /* 00000EE8 ".UAR2._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,0x08, /* 00000EF0 "ID.A...." */ - 0x5F,0x55,0x49,0x44,0x0A,0x02,0x14,0x19, /* 00000EF8 "_UID...." */ - 0x5F,0x53,0x54,0x41,0x00,0xA0,0x0D,0x93, /* 00000F00 "_STA...." */ - 0x5E,0x5E,0x5E,0x5E,0x55,0x41,0x52,0x32, /* 00000F08 "^^^^UAR2" */ - 0x00,0xA4,0x00,0xA1,0x04,0xA4,0x0A,0x0F, /* 00000F10 "........" */ - 0x08,0x5F,0x43,0x52,0x53,0x11,0x10,0x0A, /* 00000F18 "._CRS..." */ - 0x0D,0x47,0x01,0xF8,0x02,0xF8,0x02,0x08, /* 00000F20 ".G......" */ - 0x08,0x22,0x08,0x00,0x79,0x00,0x5B,0x82, /* 00000F28 "."..y.[." */ - 0x36,0x4C,0x54,0x50,0x31,0x08,0x5F,0x48, /* 00000F30 "6LTP1._H" */ - 0x49,0x44,0x0C,0x41,0xD0,0x04,0x00,0x08, /* 00000F38 "ID.A...." */ - 0x5F,0x55,0x49,0x44,0x0A,0x02,0x14,0x09, /* 00000F40 "_UID...." */ - 0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F, /* 00000F48 "_STA...." */ - 0x08,0x5F,0x43,0x52,0x53,0x11,0x10,0x0A, /* 00000F50 "._CRS..." */ - 0x0D,0x47,0x01,0x78,0x03,0x78,0x03,0x08, /* 00000F58 ".G.x.x.." */ - 0x08,0x22,0x80,0x00,0x79,0x00,0x5B,0x82, /* 00000F60 "."..y.[." */ - 0x4D,0x07,0x53,0x31,0x46,0x30,0x08,0x5F, /* 00000F68 "M.S1F0._" */ - 0x41,0x44,0x52,0x0C,0x00,0x00,0x06,0x00, /* 00000F70 "ADR....." */ - 0x08,0x5F,0x53,0x55,0x4E,0x01,0x14,0x13, /* 00000F78 "._SUN..." */ - 0x5F,0x50,0x53,0x30,0x00,0x70,0x0A,0x80, /* 00000F80 "_PS0.p.." */ - 0x5C,0x2E,0x5F,0x47,0x50,0x45,0x44,0x50, /* 00000F88 "\._GPEDP" */ - 0x54,0x32,0x14,0x13,0x5F,0x50,0x53,0x33, /* 00000F90 "T2.._PS3" */ - 0x00,0x70,0x0A,0x83,0x5C,0x2E,0x5F,0x47, /* 00000F98 ".p..\._G" */ - 0x50,0x45,0x44,0x50,0x54,0x32,0x14,0x1F, /* 00000FA0 "PEDPT2.." */ - 0x5F,0x45,0x4A,0x30,0x01,0x70,0x0A,0x88, /* 00000FA8 "_EJ0.p.." */ - 0x5C,0x2E,0x5F,0x47,0x50,0x45,0x44,0x50, /* 00000FB0 "\._GPEDP" */ - 0x54,0x32,0x70,0x01,0x5C,0x2E,0x5F,0x47, /* 00000FB8 "T2p.\._G" */ - 0x50,0x45,0x50,0x48,0x50,0x31,0x14,0x1E, /* 00000FC0 "PEPHP1.." */ - 0x5F,0x53,0x54,0x41,0x00,0x70,0x0A,0x89, /* 00000FC8 "_STA.p.." */ - 0x5C,0x2E,0x5F,0x47,0x50,0x45,0x44,0x50, /* 00000FD0 "\._GPEDP" */ - 0x54,0x32,0xA4,0x5C,0x2E,0x5F,0x47,0x50, /* 00000FD8 "T2.\._GP" */ - 0x45,0x50,0x48,0x50,0x31,0x5B,0x82,0x4E, /* 00000FE0 "EPHP1[.N" */ - 0x07,0x53,0x32,0x46,0x30,0x08,0x5F,0x41, /* 00000FE8 ".S2F0._A" */ - 0x44,0x52,0x0C,0x00,0x00,0x07,0x00,0x08, /* 00000FF0 "DR......" */ - 0x5F,0x53,0x55,0x4E,0x0A,0x02,0x14,0x13, /* 00000FF8 "_SUN...." */ - 0x5F,0x50,0x53,0x30,0x00,0x70,0x0A,0x90, /* 00001000 "_PS0.p.." */ - 0x5C,0x2E,0x5F,0x47,0x50,0x45,0x44,0x50, /* 00001008 "\._GPEDP" */ - 0x54,0x32,0x14,0x13,0x5F,0x50,0x53,0x33, /* 00001010 "T2.._PS3" */ - 0x00,0x70,0x0A,0x93,0x5C,0x2E,0x5F,0x47, /* 00001018 ".p..\._G" */ - 0x50,0x45,0x44,0x50,0x54,0x32,0x14,0x1F, /* 00001020 "PEDPT2.." */ - 0x5F,0x45,0x4A,0x30,0x01,0x70,0x0A,0x98, /* 00001028 "_EJ0.p.." */ - 0x5C,0x2E,0x5F,0x47,0x50,0x45,0x44,0x50, /* 00001030 "\._GPEDP" */ - 0x54,0x32,0x70,0x01,0x5C,0x2E,0x5F,0x47, /* 00001038 "T2p.\._G" */ - 0x50,0x45,0x50,0x48,0x50,0x32,0x14,0x1E, /* 00001040 "PEPHP2.." */ - 0x5F,0x53,0x54,0x41,0x00,0x70,0x0A,0x99, /* 00001048 "_STA.p.." */ - 0x5C,0x2E,0x5F,0x47,0x50,0x45,0x44,0x50, /* 00001050 "\._GPEDP" */ - 0x54,0x32,0xA4,0x5C,0x2E,0x5F,0x47,0x50, /* 00001058 "T2.\._GP" */ - 0x45,0x50,0x48,0x50,0x32,0x10,0x4E,0x0B, /* 00001060 "EPHP2.N." */ - 0x5F,0x47,0x50,0x45,0x5B,0x80,0x50,0x48, /* 00001068 "_GPE[.PH" */ - 0x50,0x5F,0x01,0x0B,0xC0,0x10,0x0A,0x03, /* 00001070 "P_......" */ - 0x5B,0x81,0x15,0x50,0x48,0x50,0x5F,0x01, /* 00001078 "[..PHP_." */ - 0x50,0x53,0x54,0x41,0x08,0x50,0x48,0x50, /* 00001080 "PSTA.PHP" */ - 0x31,0x08,0x50,0x48,0x50,0x32,0x08,0x5B, /* 00001088 "1.PHP2.[" */ - 0x80,0x44,0x47,0x31,0x5F,0x01,0x0B,0x44, /* 00001090 ".DG1_..D" */ - 0xB0,0x0A,0x04,0x5B,0x81,0x10,0x44,0x47, /* 00001098 "...[..DG" */ - 0x31,0x5F,0x01,0x44,0x50,0x54,0x31,0x08, /* 000010A0 "1_.DPT1." */ - 0x44,0x50,0x54,0x32,0x08,0x14,0x46,0x07, /* 000010A8 "DPT2..F." */ - 0x5F,0x4C,0x30,0x33,0x00,0x08,0x53,0x4C, /* 000010B0 "_L03..SL" */ - 0x54,0x5F,0x00,0x08,0x45,0x56,0x54,0x5F, /* 000010B8 "T_..EVT_" */ - 0x00,0x70,0x50,0x53,0x54,0x41,0x61,0x7A, /* 000010C0 ".pPSTAaz" */ - 0x61,0x0A,0x04,0x53,0x4C,0x54,0x5F,0x7B, /* 000010C8 "a..SLT_{" */ - 0x61,0x0A,0x0F,0x45,0x56,0x54,0x5F,0x70, /* 000010D0 "a..EVT_p" */ - 0x53,0x4C,0x54,0x5F,0x44,0x50,0x54,0x31, /* 000010D8 "SLT_DPT1" */ - 0x70,0x45,0x56,0x54,0x5F,0x44,0x50,0x54, /* 000010E0 "pEVT_DPT" */ - 0x32,0xA0,0x1B,0x93,0x53,0x4C,0x54,0x5F, /* 000010E8 "2...SLT_" */ - 0x01,0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42, /* 000010F0 "..\/._SB" */ - 0x5F,0x50,0x43,0x49,0x30,0x53,0x31,0x46, /* 000010F8 "_PCI0S1F" */ - 0x30,0x45,0x56,0x54,0x5F,0xA1,0x1E,0xA0, /* 00001100 "0EVT_..." */ - 0x1C,0x93,0x53,0x4C,0x54,0x5F,0x0A,0x02, /* 00001108 "..SLT_.." */ - 0x86,0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F, /* 00001110 ".\/._SB_" */ - 0x50,0x43,0x49,0x30,0x53,0x32,0x46,0x30, /* 00001118 "PCI0S2F0" */ - 0x45,0x56,0x54,0x5F, + 0x00,0x00,0x4C,0x4E,0x4B,0x43,0x00,0x12, /* 00000898 "..LNKC.." */ + 0x0D,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x01, /* 000008A0 "........" */ + 0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04, /* 000008A8 "LNKD...." */ + 0x0C,0xFF,0xFF,0x0E,0x00,0x0A,0x02,0x4C, /* 000008B0 ".......L" */ + 0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,0x0C, /* 000008B8 "NKA....." */ + 0xFF,0xFF,0x0E,0x00,0x0A,0x03,0x4C,0x4E, /* 000008C0 "......LN" */ + 0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF, /* 000008C8 "KB......" */ + 0xFF,0x0F,0x00,0x00,0x4C,0x4E,0x4B,0x44, /* 000008D0 "....LNKD" */ + 0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0F, /* 000008D8 "........" */ + 0x00,0x01,0x4C,0x4E,0x4B,0x41,0x00,0x12, /* 000008E0 "..LNKA.." */ + 0x0E,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A, /* 000008E8 "........" */ + 0x02,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0E, /* 000008F0 ".LNKB..." */ + 0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A,0x03, /* 000008F8 "........" */ + 0x4C,0x4E,0x4B,0x43,0x00,0x08,0x50,0x52, /* 00000900 "LNKC..PR" */ + 0x54,0x41,0x12,0x41,0x2F,0x3C,0x12,0x0B, /* 00000908 "TA.A/<.." */ + 0x04,0x0C,0xFF,0xFF,0x01,0x00,0x00,0x00, /* 00000910 "........" */ + 0x0A,0x14,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000918 "........" */ + 0x01,0x00,0x01,0x00,0x0A,0x15,0x12,0x0C, /* 00000920 "........" */ + 0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02, /* 00000928 "........" */ + 0x00,0x0A,0x16,0x12,0x0C,0x04,0x0C,0xFF, /* 00000930 "........" */ + 0xFF,0x01,0x00,0x0A,0x03,0x00,0x0A,0x17, /* 00000938 "........" */ + 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00, /* 00000940 "........" */ + 0x00,0x00,0x0A,0x18,0x12,0x0B,0x04,0x0C, /* 00000948 "........" */ + 0xFF,0xFF,0x02,0x00,0x01,0x00,0x0A,0x19, /* 00000950 "........" */ + 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x02,0x00, /* 00000958 "........" */ + 0x0A,0x02,0x00,0x0A,0x1A,0x12,0x0C,0x04, /* 00000960 "........" */ + 0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x03,0x00, /* 00000968 "........" */ + 0x0A,0x1B,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000970 "........" */ + 0x03,0x00,0x00,0x00,0x0A,0x1C,0x12,0x0B, /* 00000978 "........" */ + 0x04,0x0C,0xFF,0xFF,0x03,0x00,0x01,0x00, /* 00000980 "........" */ + 0x0A,0x1D,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000988 "........" */ + 0x03,0x00,0x0A,0x02,0x00,0x0A,0x1E,0x12, /* 00000990 "........" */ + 0x0C,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A, /* 00000998 "........" */ + 0x03,0x00,0x0A,0x1F,0x12,0x0B,0x04,0x0C, /* 000009A0 "........" */ + 0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x20, /* 000009A8 "....... " */ + 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00, /* 000009B0 "........" */ + 0x01,0x00,0x0A,0x21,0x12,0x0C,0x04,0x0C, /* 000009B8 "...!...." */ + 0xFF,0xFF,0x04,0x00,0x0A,0x02,0x00,0x0A, /* 000009C0 "........" */ + 0x22,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x04, /* 000009C8 ""......." */ + 0x00,0x0A,0x03,0x00,0x0A,0x23,0x12,0x0B, /* 000009D0 ".....#.." */ + 0x04,0x0C,0xFF,0xFF,0x05,0x00,0x00,0x00, /* 000009D8 "........" */ + 0x0A,0x24,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 000009E0 ".$......" */ + 0x05,0x00,0x01,0x00,0x0A,0x25,0x12,0x0C, /* 000009E8 ".....%.." */ + 0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02, /* 000009F0 "........" */ + 0x00,0x0A,0x26,0x12,0x0C,0x04,0x0C,0xFF, /* 000009F8 "..&....." */ + 0xFF,0x05,0x00,0x0A,0x03,0x00,0x0A,0x27, /* 00000A00 ".......'" */ + 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x06,0x00, /* 00000A08 "........" */ + 0x00,0x00,0x0A,0x28,0x12,0x0B,0x04,0x0C, /* 00000A10 "...(...." */ + 0xFF,0xFF,0x06,0x00,0x01,0x00,0x0A,0x29, /* 00000A18 ".......)" */ + 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x06,0x00, /* 00000A20 "........" */ + 0x0A,0x02,0x00,0x0A,0x2A,0x12,0x0C,0x04, /* 00000A28 "....*..." */ + 0x0C,0xFF,0xFF,0x06,0x00,0x0A,0x03,0x00, /* 00000A30 "........" */ + 0x0A,0x2B,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000A38 ".+......" */ + 0x07,0x00,0x00,0x00,0x0A,0x2C,0x12,0x0B, /* 00000A40 ".....,.." */ + 0x04,0x0C,0xFF,0xFF,0x07,0x00,0x01,0x00, /* 00000A48 "........" */ + 0x0A,0x2D,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000A50 ".-......" */ + 0x07,0x00,0x0A,0x02,0x00,0x0A,0x2E,0x12, /* 00000A58 "........" */ + 0x0C,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A, /* 00000A60 "........" */ + 0x03,0x00,0x0A,0x2F,0x12,0x0B,0x04,0x0C, /* 00000A68 ".../...." */ + 0xFF,0xFF,0x08,0x00,0x00,0x00,0x0A,0x11, /* 00000A70 "........" */ + 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x08,0x00, /* 00000A78 "........" */ + 0x01,0x00,0x0A,0x12,0x12,0x0C,0x04,0x0C, /* 00000A80 "........" */ + 0xFF,0xFF,0x08,0x00,0x0A,0x02,0x00,0x0A, /* 00000A88 "........" */ + 0x13,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x08, /* 00000A90 "........" */ + 0x00,0x0A,0x03,0x00,0x0A,0x14,0x12,0x0B, /* 00000A98 "........" */ + 0x04,0x0C,0xFF,0xFF,0x09,0x00,0x00,0x00, /* 00000AA0 "........" */ + 0x0A,0x15,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000AA8 "........" */ + 0x09,0x00,0x01,0x00,0x0A,0x16,0x12,0x0C, /* 00000AB0 "........" */ + 0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x02, /* 00000AB8 "........" */ + 0x00,0x0A,0x17,0x12,0x0C,0x04,0x0C,0xFF, /* 00000AC0 "........" */ + 0xFF,0x09,0x00,0x0A,0x03,0x00,0x0A,0x18, /* 00000AC8 "........" */ + 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0A,0x00, /* 00000AD0 "........" */ + 0x00,0x00,0x0A,0x19,0x12,0x0B,0x04,0x0C, /* 00000AD8 "........" */ + 0xFF,0xFF,0x0A,0x00,0x01,0x00,0x0A,0x1A, /* 00000AE0 "........" */ + 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0A,0x00, /* 00000AE8 "........" */ + 0x0A,0x02,0x00,0x0A,0x1B,0x12,0x0C,0x04, /* 00000AF0 "........" */ + 0x0C,0xFF,0xFF,0x0A,0x00,0x0A,0x03,0x00, /* 00000AF8 "........" */ + 0x0A,0x1C,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000B00 "........" */ + 0x0B,0x00,0x00,0x00,0x0A,0x1D,0x12,0x0B, /* 00000B08 "........" */ + 0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x01,0x00, /* 00000B10 "........" */ + 0x0A,0x1E,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000B18 "........" */ + 0x0B,0x00,0x0A,0x02,0x00,0x0A,0x1F,0x12, /* 00000B20 "........" */ + 0x0C,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A, /* 00000B28 "........" */ + 0x03,0x00,0x0A,0x20,0x12,0x0B,0x04,0x0C, /* 00000B30 "... ...." */ + 0xFF,0xFF,0x0C,0x00,0x00,0x00,0x0A,0x21, /* 00000B38 ".......!" */ + 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0C,0x00, /* 00000B40 "........" */ + 0x01,0x00,0x0A,0x22,0x12,0x0C,0x04,0x0C, /* 00000B48 "..."...." */ + 0xFF,0xFF,0x0C,0x00,0x0A,0x02,0x00,0x0A, /* 00000B50 "........" */ + 0x23,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0C, /* 00000B58 "#......." */ + 0x00,0x0A,0x03,0x00,0x0A,0x24,0x12,0x0B, /* 00000B60 ".....$.." */ + 0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x00,0x00, /* 00000B68 "........" */ + 0x0A,0x25,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000B70 ".%......" */ + 0x0D,0x00,0x01,0x00,0x0A,0x26,0x12,0x0C, /* 00000B78 ".....&.." */ + 0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x02, /* 00000B80 "........" */ + 0x00,0x0A,0x27,0x12,0x0C,0x04,0x0C,0xFF, /* 00000B88 "..'....." */ + 0xFF,0x0D,0x00,0x0A,0x03,0x00,0x0A,0x28, /* 00000B90 ".......(" */ + 0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0E,0x00, /* 00000B98 "........" */ + 0x00,0x00,0x0A,0x29,0x12,0x0B,0x04,0x0C, /* 00000BA0 "...)...." */ + 0xFF,0xFF,0x0E,0x00,0x01,0x00,0x0A,0x2A, /* 00000BA8 ".......*" */ + 0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0E,0x00, /* 00000BB0 "........" */ + 0x0A,0x02,0x00,0x0A,0x2B,0x12,0x0C,0x04, /* 00000BB8 "....+..." */ + 0x0C,0xFF,0xFF,0x0E,0x00,0x0A,0x03,0x00, /* 00000BC0 "........" */ + 0x0A,0x2C,0x12,0x0B,0x04,0x0C,0xFF,0xFF, /* 00000BC8 ".,......" */ + 0x0F,0x00,0x00,0x00,0x0A,0x2D,0x12,0x0B, /* 00000BD0 ".....-.." */ + 0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x01,0x00, /* 00000BD8 "........" */ + 0x0A,0x2E,0x12,0x0C,0x04,0x0C,0xFF,0xFF, /* 00000BE0 "........" */ + 0x0F,0x00,0x0A,0x02,0x00,0x0A,0x2F,0x12, /* 00000BE8 "....../." */ + 0x0C,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A, /* 00000BF0 "........" */ + 0x03,0x00,0x0A,0x10,0x5B,0x82,0x46,0x37, /* 00000BF8 "....[.F7" */ + 0x49,0x53,0x41,0x5F,0x08,0x5F,0x41,0x44, /* 00000C00 "ISA_._AD" */ + 0x52,0x0C,0x00,0x00,0x01,0x00,0x5B,0x80, /* 00000C08 "R.....[." */ + 0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A, /* 00000C10 "PIRQ..`." */ + 0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29, /* 00000C18 "...\.[.)" */ + 0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50, /* 00000C20 "\/._SB_P" */ + 0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50, /* 00000C28 "CI0ISA_P" */ + 0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41, /* 00000C30 "IRQ.PIRA" */ + 0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49, /* 00000C38 ".PIRB.PI" */ + 0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08, /* 00000C40 "RC.PIRD." */ + 0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52, /* 00000C48 "[.F.SYSR" */ + 0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0, /* 00000C50 "._HID.A." */ + 0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01, /* 00000C58 "..._UID." */ + 0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08, /* 00000C60 ".CRS_.N." */ + 0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00, /* 00000C68 "..G....." */ + 0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00, /* 00000C70 "..G."."." */ + 0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00, /* 00000C78 "..G.0.0." */ + 0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00, /* 00000C80 "..G.D.D." */ + 0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00, /* 00000C88 "..G.b.b." */ + 0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00, /* 00000C90 "..G.e.e." */ + 0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00, /* 00000C98 "..G.r.r." */ + 0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00, /* 00000CA0 "..G....." */ + 0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00, /* 00000CA8 "..G....." */ + 0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00, /* 00000CB0 "..G....." */ + 0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00, /* 00000CB8 "..G....." */ + 0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00, /* 00000CC0 "..G....." */ + 0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00, /* 00000CC8 "..G....." */ + 0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00, /* 00000CD0 "..G....." */ + 0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08, /* 00000CD8 "..G....." */ + 0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C, /* 00000CE0 "..G....." */ + 0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04, /* 00000CE8 "..G....." */ + 0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43, /* 00000CF0 "..y..._C" */ + 0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F, /* 00000CF8 "RS..CRS_" */ + 0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08, /* 00000D00 "[.+PIC_." */ + 0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08, /* 00000D08 "_HID.A.." */ + 0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15, /* 00000D10 "_CRS...." */ + 0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02, /* 00000D18 "G. . ..." */ + 0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02, /* 00000D20 "G......." */ + 0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47, /* 00000D28 ""..y.[.G" */ + 0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48, /* 00000D30 ".DMA0._H" */ + 0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08, /* 00000D38 "ID.A...." */ + 0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A, /* 00000D40 "_CRS.A.." */ + 0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00, /* 00000D48 "=*..G..." */ + 0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00, /* 00000D50 "....G..." */ + 0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00, /* 00000D58 "....G..." */ + 0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00, /* 00000D60 "....G..." */ + 0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00, /* 00000D68 "....G..." */ + 0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00, /* 00000D70 "....G..." */ + 0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04, /* 00000D78 "... G..." */ + 0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82, /* 00000D80 "....y.[." */ + 0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48, /* 00000D88 "%TMR_._H" */ + 0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08, /* 00000D90 "ID.A...." */ + 0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D, /* 00000D98 "_CRS...." */ + 0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04, /* 00000DA0 "G.@.@..." */ + 0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25, /* 00000DA8 ""..y.[.%" */ + 0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49, /* 00000DB0 "RTC_._HI" */ + 0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F, /* 00000DB8 "D.A...._" */ + 0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47, /* 00000DC0 "CRS....G" */ + 0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22, /* 00000DC8 ".p.p..."" */ + 0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53, /* 00000DD0 "..y.[."S" */ + 0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44, /* 00000DD8 "PKR._HID" */ + 0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43, /* 00000DE0 ".A...._C" */ + 0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01, /* 00000DE8 "RS....G." */ + 0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00, /* 00000DF0 "a.a...y." */ + 0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08, /* 00000DF8 "[.1PS2M." */ + 0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F, /* 00000E00 "_HID.A.." */ + 0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41, /* 00000E08 ".._CID.A" */ + 0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54, /* 00000E10 "....._ST" */ + 0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43, /* 00000E18 "A....._C" */ + 0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00, /* 00000E20 "RS...."." */ + 0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50, /* 00000E28 ".y.[.B.P" */ + 0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44, /* 00000E30 "S2K._HID" */ + 0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43, /* 00000E38 ".A...._C" */ + 0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14, /* 00000E40 "ID.A...." */ + 0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A, /* 00000E48 "._STA..." */ + 0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18, /* 00000E50 ".._CRS.." */ + 0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00, /* 00000E58 "..G.`.`." */ + 0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00, /* 00000E60 "..G.d.d." */ + 0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B, /* 00000E68 ".."..y.[" */ + 0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F, /* 00000E70 ".:FDC0._" */ + 0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00, /* 00000E78 "HID.A..." */ + 0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4, /* 00000E80 ".._STA.." */ + 0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11, /* 00000E88 "..._CRS." */ + 0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0, /* 00000E90 "...G...." */ + 0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7, /* 00000E98 "...G...." */ + 0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04, /* 00000EA0 "..."@.*." */ + 0x00,0x79,0x00,0x5B,0x82,0x46,0x04,0x55, /* 00000EA8 ".y.[.F.U" */ + 0x41,0x52,0x31,0x08,0x5F,0x48,0x49,0x44, /* 00000EB0 "AR1._HID" */ + 0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,0x55, /* 00000EB8 ".A...._U" */ + 0x49,0x44,0x01,0x14,0x19,0x5F,0x53,0x54, /* 00000EC0 "ID..._ST" */ + 0x41,0x00,0xA0,0x0D,0x93,0x5E,0x5E,0x5E, /* 00000EC8 "A....^^^" */ + 0x5E,0x55,0x41,0x52,0x31,0x00,0xA4,0x00, /* 00000ED0 "^UAR1..." */ + 0xA1,0x04,0xA4,0x0A,0x0F,0x08,0x5F,0x43, /* 00000ED8 "......_C" */ + 0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,0x01, /* 00000EE0 "RS....G." */ + 0xF8,0x03,0xF8,0x03,0x08,0x08,0x22,0x10, /* 00000EE8 "......"." */ + 0x00,0x79,0x00,0x5B,0x82,0x47,0x04,0x55, /* 00000EF0 ".y.[.G.U" */ + 0x41,0x52,0x32,0x08,0x5F,0x48,0x49,0x44, /* 00000EF8 "AR2._HID" */ + 0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,0x55, /* 00000F00 ".A...._U" */ + 0x49,0x44,0x0A,0x02,0x14,0x19,0x5F,0x53, /* 00000F08 "ID...._S" */ + 0x54,0x41,0x00,0xA0,0x0D,0x93,0x5E,0x5E, /* 00000F10 "TA....^^" */ + 0x5E,0x5E,0x55,0x41,0x52,0x32,0x00,0xA4, /* 00000F18 "^^UAR2.." */ + 0x00,0xA1,0x04,0xA4,0x0A,0x0F,0x08,0x5F, /* 00000F20 "......._" */ + 0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47, /* 00000F28 "CRS....G" */ + 0x01,0xF8,0x02,0xF8,0x02,0x08,0x08,0x22, /* 00000F30 "......."" */ + 0x08,0x00,0x79,0x00,0x5B,0x82,0x36,0x4C, /* 00000F38 "..y.[.6L" */ + 0x54,0x50,0x31,0x08,0x5F,0x48,0x49,0x44, /* 00000F40 "TP1._HID" */ + 0x0C,0x41,0xD0,0x04,0x00,0x08,0x5F,0x55, /* 00000F48 ".A...._U" */ + 0x49,0x44,0x0A,0x02,0x14,0x09,0x5F,0x53, /* 00000F50 "ID...._S" */ + 0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F, /* 00000F58 "TA....._" */ + 0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47, /* 00000F60 "CRS....G" */ + 0x01,0x78,0x03,0x78,0x03,0x08,0x08,0x22, /* 00000F68 ".x.x..."" */ + 0x80,0x00,0x79,0x00,0x5B,0x82,0x4D,0x07, /* 00000F70 "..y.[.M." */ + 0x53,0x31,0x46,0x30,0x08,0x5F,0x41,0x44, /* 00000F78 "S1F0._AD" */ + 0x52,0x0C,0x00,0x00,0x06,0x00,0x08,0x5F, /* 00000F80 "R......_" */ + 0x53,0x55,0x4E,0x01,0x14,0x13,0x5F,0x50, /* 00000F88 "SUN..._P" */ + 0x53,0x30,0x00,0x70,0x0A,0x80,0x5C,0x2E, /* 00000F90 "S0.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000F98 "_GPEDPT2" */ + 0x14,0x13,0x5F,0x50,0x53,0x33,0x00,0x70, /* 00000FA0 ".._PS3.p" */ + 0x0A,0x83,0x5C,0x2E,0x5F,0x47,0x50,0x45, /* 00000FA8 "..\._GPE" */ + 0x44,0x50,0x54,0x32,0x14,0x1F,0x5F,0x45, /* 00000FB0 "DPT2.._E" */ + 0x4A,0x30,0x01,0x70,0x0A,0x88,0x5C,0x2E, /* 00000FB8 "J0.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000FC0 "_GPEDPT2" */ + 0x70,0x01,0x5C,0x2E,0x5F,0x47,0x50,0x45, /* 00000FC8 "p.\._GPE" */ + 0x50,0x48,0x50,0x31,0x14,0x1E,0x5F,0x53, /* 00000FD0 "PHP1.._S" */ + 0x54,0x41,0x00,0x70,0x0A,0x89,0x5C,0x2E, /* 00000FD8 "TA.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000FE0 "_GPEDPT2" */ + 0xA4,0x5C,0x2E,0x5F,0x47,0x50,0x45,0x50, /* 00000FE8 ".\._GPEP" */ + 0x48,0x50,0x31,0x5B,0x82,0x4E,0x07,0x53, /* 00000FF0 "HP1[.N.S" */ + 0x32,0x46,0x30,0x08,0x5F,0x41,0x44,0x52, /* 00000FF8 "2F0._ADR" */ + 0x0C,0x00,0x00,0x07,0x00,0x08,0x5F,0x53, /* 00001000 "......_S" */ + 0x55,0x4E,0x0A,0x02,0x14,0x13,0x5F,0x50, /* 00001008 "UN...._P" */ + 0x53,0x30,0x00,0x70,0x0A,0x90,0x5C,0x2E, /* 00001010 "S0.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00001018 "_GPEDPT2" */ + 0x14,0x13,0x5F,0x50,0x53,0x33,0x00,0x70, /* 00001020 ".._PS3.p" */ + 0x0A,0x93,0x5C,0x2E,0x5F,0x47,0x50,0x45, /* 00001028 "..\._GPE" */ + 0x44,0x50,0x54,0x32,0x14,0x1F,0x5F,0x45, /* 00001030 "DPT2.._E" */ + 0x4A,0x30,0x01,0x70,0x0A,0x98,0x5C,0x2E, /* 00001038 "J0.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00001040 "_GPEDPT2" */ + 0x70,0x01,0x5C,0x2E,0x5F,0x47,0x50,0x45, /* 00001048 "p.\._GPE" */ + 0x50,0x48,0x50,0x32,0x14,0x1E,0x5F,0x53, /* 00001050 "PHP2.._S" */ + 0x54,0x41,0x00,0x70,0x0A,0x99,0x5C,0x2E, /* 00001058 "TA.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00001060 "_GPEDPT2" */ + 0xA4,0x5C,0x2E,0x5F,0x47,0x50,0x45,0x50, /* 00001068 ".\._GPEP" */ + 0x48,0x50,0x32,0x10,0x4E,0x0B,0x5F,0x47, /* 00001070 "HP2.N._G" */ + 0x50,0x45,0x5B,0x80,0x50,0x48,0x50,0x5F, /* 00001078 "PE[.PHP_" */ + 0x01,0x0B,0xC0,0x10,0x0A,0x03,0x5B,0x81, /* 00001080 "......[." */ + 0x15,0x50,0x48,0x50,0x5F,0x01,0x50,0x53, /* 00001088 ".PHP_.PS" */ + 0x54,0x41,0x08,0x50,0x48,0x50,0x31,0x08, /* 00001090 "TA.PHP1." */ + 0x50,0x48,0x50,0x32,0x08,0x5B,0x80,0x44, /* 00001098 "PHP2.[.D" */ + 0x47,0x31,0x5F,0x01,0x0B,0x44,0xB0,0x0A, /* 000010A0 "G1_..D.." */ + 0x04,0x5B,0x81,0x10,0x44,0x47,0x31,0x5F, /* 000010A8 ".[..DG1_" */ + 0x01,0x44,0x50,0x54,0x31,0x08,0x44,0x50, /* 000010B0 ".DPT1.DP" */ + 0x54,0x32,0x08,0x14,0x46,0x07,0x5F,0x4C, /* 000010B8 "T2..F._L" */ + 0x30,0x33,0x00,0x08,0x53,0x4C,0x54,0x5F, /* 000010C0 "03..SLT_" */ + 0x00,0x08,0x45,0x56,0x54,0x5F,0x00,0x70, /* 000010C8 "..EVT_.p" */ + 0x50,0x53,0x54,0x41,0x61,0x7A,0x61,0x0A, /* 000010D0 "PSTAaza." */ + 0x04,0x53,0x4C,0x54,0x5F,0x7B,0x61,0x0A, /* 000010D8 ".SLT_{a." */ + 0x0F,0x45,0x56,0x54,0x5F,0x70,0x53,0x4C, /* 000010E0 ".EVT_pSL" */ + 0x54,0x5F,0x44,0x50,0x54,0x31,0x70,0x45, /* 000010E8 "T_DPT1pE" */ + 0x56,0x54,0x5F,0x44,0x50,0x54,0x32,0xA0, /* 000010F0 "VT_DPT2." */ + 0x1B,0x93,0x53,0x4C,0x54,0x5F,0x01,0x86, /* 000010F8 "..SLT_.." */ + 0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50, /* 00001100 "\/._SB_P" */ + 0x43,0x49,0x30,0x53,0x31,0x46,0x30,0x45, /* 00001108 "CI0S1F0E" */ + 0x56,0x54,0x5F,0xA1,0x1E,0xA0,0x1C,0x93, /* 00001110 "VT_....." */ + 0x53,0x4C,0x54,0x5F,0x0A,0x02,0x86,0x5C, /* 00001118 "SLT_...\" */ + 0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50,0x43, /* 00001120 "/._SB_PC" */ + 0x49,0x30,0x53,0x32,0x46,0x30,0x45,0x56, /* 00001128 "I0S2F0EV" */ + 0x54,0x5F, }; int DsdtLen=sizeof(AmlCode); diff -r 34ac0d3b5bfb -r 7c752689b0ea tools/firmware/rombios/rombios.c --- a/tools/firmware/rombios/rombios.c Tue May 20 14:28:19 2008 +0100 +++ b/tools/firmware/rombios/rombios.c Tue May 20 14:36:05 2008 +0100 @@ -1843,12 +1843,24 @@ keyboard_panic(status) BX_PANIC("Keyboard error:%u\n",status); } + +#define CMOS_SHUTDOWN_S3 0xFE //-------------------------------------------------------------------------- // machine_reset //-------------------------------------------------------------------------- void machine_reset() { +ASM_START +;we must check whether CMOS_SHUTDOWN_S3 is set or not +;if it is s3 resume, just jmp back to normal Post Entry +;below port io will prevent s3 resume + mov al, #0x0f + out 0x70, al + in al, 0x71 + cmp al, #0xFE + jz post +ASM_END /* Frob the keyboard reset line to reset the processor */ outb(0x64, 0x60); /* Map the flags register at data port (0x60) */ outb(0x60, 0x14); /* Set the flags to system|disable */ @@ -2305,6 +2317,72 @@ debugger_off() debugger_off() { outb(0xfedc, 0x00); +} + +/* according to memory layout defined in acpi_build_tables(), + acpi FACS table is located in ACPI_PHYSICAL_ADDRESS(0xEA000) */ +#define ACPI_FACS_ADDRESS 0xEA000 +#define ACPI_FACS_OFFSET 0x10 +/* S3 resume status in CMOS 0Fh shutdown status byte*/ + +void +s3_resume() +{ + Bit16u s3_wakeup_vector; + extern Bit16u s3_wakeup_ip; + extern Bit16u s3_wakeup_cs; + extern Bit8u s3_resume_flag; + +ASM_START + push ds + mov ax, #0xF000 + mov ds, ax +ASM_END + + if (s3_resume_flag!=CMOS_SHUTDOWN_S3){ + goto s3_out; + } + s3_resume_flag = 0; + +ASM_START + mov ax, #0x0 + mov ds, ax +ASM_END + + /* get x_firmware_waking_vector */ + s3_wakeup_vector = *((Bit16u*)(ACPI_FACS_ADDRESS+ACPI_FACS_OFFSET+24)); + if (s3_wakeup_vector == 0){ + /* get firmware_waking_vector */ + s3_wakeup_vector = *((Bit16u*)(ACPI_FACS_ADDRESS+ACPI_FACS_OFFSET+12)); + if (s3_wakeup_vector == 0){ + goto s3_out; + } + } + + /* setup wakeup vector */ + s3_wakeup_ip = s3_wakeup_vector & 0xF; + s3_wakeup_cs = s3_wakeup_vector >> 4; + +ASM_START + mov bx, [_s3_wakeup_cs] + mov dx, [_s3_wakeup_ip] + + mov ax, #0xF000 + mov ds, ax + mov [_s3_wakeup_cs], bx + mov [_s3_wakeup_ip], dx + jmpf [_s3_wakeup_ip] + +; S3 data +_s3_wakeup_ip: dw 0x0a +_s3_wakeup_cs: dw 0x0 +_s3_resume_flag: db 0 ; set at POST time by CMOS[0xF] shutdown status +ASM_END + +s3_out: +ASM_START + pop ds +ASM_END } #if BX_USE_ATADRV @@ -9752,6 +9830,18 @@ post: ;; Examine CMOS shutdown status. mov al, bl + ;; 0xFE S3 resume + cmp AL, #0xFE + jnz not_s3_resume + + ;; set S3 resume flag + mov dx, #0xF000 + mov ds, dx + mov [_s3_resume_flag], AL + jmp normal_post + +not_s3_resume: + ;; 0x00, 0x09, 0x0D+ = normal startup cmp AL, #0x00 jz normal_post @@ -10049,6 +10139,7 @@ post_default_ints: ;; #endif // BX_ELTORITO_BOOT + call _s3_resume call _interactive_bootkey #if BX_TCGBIOS _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 05:30:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 05:30:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JynSI-0008HE-IB for www-data@colo.xensource.com; Wed, 21 May 2008 05:30:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JynSw-0006Zj-Vp; Wed, 21 May 2008 12:30:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JynSu-0006ZO-OA for xen-changelog@lists.xensource.com; Wed, 21 May 2008 12:30:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JynSn-0001gA-HE for xen-changelog@lists.xensource.com; Wed, 21 May 2008 12:30:42 +0000 X-SBRS: 3.6 X-MesageID: 275404 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,520,1204520400"; d="scan'208";a="275404" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 08:29:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LCToAF031583 for ; Wed, 21 May 2008 05:29:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LCU80I007032 for ; Wed, 21 May 2008 05:30:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LCU8dU007031 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 05:30:08 -0700 Message-Id: <200805211230.m4LCU8dU007031@xenbits.xensource.com> Date: Wed, 21 May 2008 05:30:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Fix lapic timer stop issue in deep C state X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211362737 -3600 # Node ID d795e15b85a788d0389d24963897cf480dcab0e9 # Parent 672c09aad49df0b8056c795bd6c351746d037975 x86: Fix lapic timer stop issue in deep C state Local APIC timer may stop at deep C state (C3/C4...) entry/exit. this patch add the logic that use platform timer (HPET) to reenable local APIC timer at C state entry/exit. Signed-off-by: Wei Gang Signed-off-by: Yu Ke Signed-off-by: Keir Fraser --- xen/arch/x86/Makefile | 1 xen/arch/x86/acpi/cpu_idle.c | 11 - xen/arch/x86/hpet.c | 291 +++++++++++++++++++++++++++++++++++++++++++ xen/arch/x86/time.c | 59 ++------ xen/common/timer.c | 8 - xen/include/asm-x86/hpet.h | 20 ++ xen/include/xen/timer.h | 9 + 7 files changed, 348 insertions(+), 51 deletions(-) diff -r 672c09aad49d -r d795e15b85a7 xen/arch/x86/Makefile --- a/xen/arch/x86/Makefile Tue May 20 14:50:45 2008 +0100 +++ b/xen/arch/x86/Makefile Wed May 21 10:38:57 2008 +0100 @@ -50,6 +50,7 @@ obj-y += machine_kexec.o obj-y += machine_kexec.o obj-y += crash.o obj-y += tboot.o +obj-y += hpet.o obj-$(crash_debug) += gdbstub.o diff -r 672c09aad49d -r d795e15b85a7 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Tue May 20 14:50:45 2008 +0100 +++ b/xen/arch/x86/acpi/cpu_idle.c Wed May 21 10:38:57 2008 +0100 @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -438,19 +439,19 @@ static void acpi_processor_idle(void) t1 = inl(pmtmr_ioport); /* - * FIXME: Before invoking C3, be aware that TSC/APIC timer may be + * Before invoking C3, be aware that TSC/APIC timer may be * stopped by H/W. Without carefully handling of TSC/APIC stop issues, * deep C state can't work correctly. */ /* preparing TSC stop */ cstate_save_tsc(); - /* placeholder for preparing APIC stop */ - + /* preparing APIC stop */ + hpet_broadcast_enter(); /* Invoke C3 */ acpi_idle_do_entry(cx); - /* placeholder for recovering APIC */ - + /* recovering APIC */ + hpet_broadcast_exit(); /* recovering TSC */ cstate_restore_tsc(); diff -r 672c09aad49d -r d795e15b85a7 xen/arch/x86/hpet.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xen/arch/x86/hpet.c Wed May 21 10:38:57 2008 +0100 @@ -0,0 +1,291 @@ +/****************************************************************************** + * arch/x86/hpet.c + * + * HPET management. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STIME_MAX ((s_time_t)((uint64_t)~0ull>>1)) + +#define MAX_DELTA_NS MILLISECS(10*1000) +#define MIN_DELTA_NS MICROSECS(1) + +struct hpet_event_channel +{ + unsigned long mult; + int shift; + s_time_t next_event; + cpumask_t cpumask; + spinlock_t lock; + void (*event_handler)(struct hpet_event_channel *); +}; +static struct hpet_event_channel hpet_event; + +unsigned long hpet_address; + +/* + * Calculate a multiplication factor for scaled math, which is used to convert + * nanoseconds based values to clock ticks: + * + * clock_ticks = (nanoseconds * factor) >> shift. + * + * div_sc is the rearranged equation to calculate a factor from a given clock + * ticks / nanoseconds ratio: + * + * factor = (clock_ticks << shift) / nanoseconds + */ +static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec, + int shift) +{ + uint64_t tmp = ((uint64_t)ticks) << shift; + + do_div(tmp, nsec); + return (unsigned long) tmp; +} + +/* + * Convert nanoseconds based values to clock ticks: + * + * clock_ticks = (nanoseconds * factor) >> shift. + */ +static inline unsigned long ns2ticks(unsigned long nsec, int shift, + unsigned long factor) +{ + uint64_t tmp = ((uint64_t)nsec * factor) >> shift; + + return (unsigned long) tmp; +} + +static int hpet_legacy_next_event(unsigned long delta) +{ + unsigned long cnt; + + cnt = hpet_read32(HPET_COUNTER); + cnt += delta; + hpet_write32(cnt, HPET_T0_CMP); + + return ((long)(hpet_read32(HPET_COUNTER) - cnt) > 0) ? -ETIME : 0; +} + +static int reprogram_hpet_evt_channel( + struct hpet_event_channel *ch, + s_time_t expire, s_time_t now, int force) +{ + int64_t delta; + int ret; + + if ( unlikely(expire < 0) ) + { + printk(KERN_DEBUG "reprogram: expire < 0\n"); + return -ETIME; + } + + delta = expire - now; + if ( delta <= 0 ) + { + printk(KERN_DEBUG "reprogram: expire(%"PRIx64") < " + "now(%"PRIx64")\n", expire, now); + if ( !force ) + return -ETIME; + } + + ch->next_event = expire; + + delta = min_t(int64_t, delta, MAX_DELTA_NS); + delta = max_t(int64_t, delta, MIN_DELTA_NS); + delta = ns2ticks(delta, ch->shift, ch->mult); + + ret = hpet_legacy_next_event(delta); + while ( ret && force ) + { + delta += delta; + ret = hpet_legacy_next_event(delta); + } + + return ret; +} + +static int evt_do_broadcast(cpumask_t mask) +{ + int ret = 0, cpu = smp_processor_id(); + + if ( cpu_isset(cpu, mask) ) + { + cpu_clear(cpu, mask); + raise_softirq(TIMER_SOFTIRQ); + ret = 1; + } + + if ( !cpus_empty(mask) ) + { + cpumask_raise_softirq(mask, TIMER_SOFTIRQ); + ret = 1; + } + return ret; +} + +static void handle_hpet_broadcast(struct hpet_event_channel *ch) +{ + cpumask_t mask; + s_time_t now, next_event; + int cpu, current_cpu = smp_processor_id(); + + spin_lock(&ch->lock); + + if ( cpu_isset(current_cpu, ch->cpumask) ) + printk(KERN_DEBUG "WARNING: current cpu%d in bc_mask\n", current_cpu); +again: + ch->next_event = STIME_MAX; + next_event = STIME_MAX; + mask = (cpumask_t)CPU_MASK_NONE; + now = NOW(); + + /* find all expired events */ + for_each_cpu_mask(cpu, ch->cpumask) + { + if ( per_cpu(timer_deadline, cpu) <= now ) + cpu_set(cpu, mask); + else if ( per_cpu(timer_deadline, cpu) < next_event ) + next_event = per_cpu(timer_deadline, cpu); + } + if ( per_cpu(timer_deadline, current_cpu) <= now ) + cpu_set(current_cpu, mask); + + /* wakeup the cpus which have an expired event. */ + evt_do_broadcast(mask); + + if ( next_event != STIME_MAX ) + { + if ( reprogram_hpet_evt_channel(ch, next_event, now, 0) ) + goto again; + } + spin_unlock(&ch->lock); +} + +void hpet_broadcast_init(void) +{ + u64 hpet_rate; + u32 hpet_id, cfg; + + hpet_rate = hpet_setup(); + if ( hpet_rate == 0 ) + return; + + hpet_id = hpet_read32(HPET_ID); + if ( !(hpet_id & HPET_ID_LEGSUP) ) + return; + + /* Start HPET legacy interrupts */ + cfg = hpet_read32(HPET_CFG); + cfg |= HPET_CFG_LEGACY; + hpet_write32(cfg, HPET_CFG); + + /* set HPET T0 as oneshot */ + cfg = hpet_read32(HPET_T0_CFG); + cfg &= ~HPET_TN_PERIODIC; + cfg |= HPET_TN_ENABLE | HPET_TN_32BIT; + hpet_write32(cfg, HPET_T0_CFG); + + /* + * The period is a femto seconds value. We need to calculate the scaled + * math multiplication factor for nanosecond to hpet tick conversion. + */ + hpet_event.mult = div_sc((unsigned long)hpet_rate, 1000000000ul, 32); + hpet_event.shift = 32; + hpet_event.next_event = STIME_MAX; + hpet_event.event_handler = handle_hpet_broadcast; + spin_lock_init(&hpet_event.lock); +} + +void hpet_broadcast_enter(void) +{ + struct hpet_event_channel *ch = &hpet_event; + + cpu_set(smp_processor_id(), ch->cpumask); + + spin_lock(&ch->lock); + + /* reprogram if current cpu expire time is nearer */ + if ( this_cpu(timer_deadline) < ch->next_event ) + reprogram_hpet_evt_channel(ch, this_cpu(timer_deadline), NOW(), 1); + + spin_unlock(&ch->lock); +} + +void hpet_broadcast_exit(void) +{ + struct hpet_event_channel *ch = &hpet_event; + int cpu = smp_processor_id(); + + if ( cpu_test_and_clear(cpu, ch->cpumask) ) + reprogram_timer(per_cpu(timer_deadline, cpu)); +} + +int hpet_legacy_irq_tick(void) +{ + if ( !hpet_event.event_handler ) + return 0; + hpet_event.event_handler(&hpet_event); + return 1; +} + +u64 hpet_setup(void) +{ + static u64 hpet_rate; + static int initialised; + u32 hpet_id, hpet_period, cfg; + int i; + + if ( initialised ) + return hpet_rate; + initialised = 1; + + if ( hpet_address == 0 ) + return 0; + + set_fixmap_nocache(FIX_HPET_BASE, hpet_address); + + hpet_id = hpet_read32(HPET_ID); + if ( hpet_id == 0 ) + { + printk("BAD HPET vendor id.\n"); + return 0; + } + + /* Check for sane period (100ps <= period <= 100ns). */ + hpet_period = hpet_read32(HPET_PERIOD); + if ( (hpet_period > 100000000) || (hpet_period < 100000) ) + { + printk("BAD HPET period %u.\n", hpet_period); + return 0; + } + + cfg = hpet_read32(HPET_CFG); + cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY); + hpet_write32(cfg, HPET_CFG); + + for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ ) + { + cfg = hpet_read32(HPET_T0_CFG + i*0x20); + cfg &= ~HPET_TN_ENABLE; + hpet_write32(cfg & ~HPET_TN_ENABLE, HPET_T0_CFG); + } + + cfg = hpet_read32(HPET_CFG); + cfg |= HPET_CFG_ENABLE; + hpet_write32(cfg, HPET_CFG); + + hpet_rate = 1000000000000000ULL; /* 10^15 */ + (void)do_div(hpet_rate, hpet_period); + + return hpet_rate; +} diff -r 672c09aad49d -r d795e15b85a7 xen/arch/x86/time.c --- a/xen/arch/x86/time.c Tue May 20 14:50:45 2008 +0100 +++ b/xen/arch/x86/time.c Wed May 21 10:38:57 2008 +0100 @@ -38,7 +38,6 @@ string_param("clocksource", opt_clocksou #define EPOCH MILLISECS(1000) unsigned long cpu_khz; /* CPU clock frequency in kHz. */ -unsigned long hpet_address; DEFINE_SPINLOCK(rtc_lock); unsigned long pit0_ticks; static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */ @@ -68,7 +67,8 @@ struct platform_timesource { static DEFINE_PER_CPU(struct cpu_time, cpu_time); -static u8 tsc_invariant=0; /* TSC is invariant upon C state entry */ +/* TSC is invariant on C state entry? */ +static bool_t tsc_invariant; /* * We simulate a 32-bit platform timer from the 16-bit PIT ch2 counter. @@ -151,6 +151,9 @@ static void timer_interrupt(int irq, voi { ASSERT(local_irq_is_enabled()); + if ( hpet_legacy_irq_tick() ) + return; + /* Only for start-of-day interruopt tests in io_apic.c. */ (*(volatile unsigned long *)&pit0_ticks)++; @@ -347,47 +350,10 @@ static u32 read_hpet_count(void) static int init_hpet(struct platform_timesource *pts) { - u64 hpet_rate; - u32 hpet_id, hpet_period, cfg; - int i; - - if ( hpet_address == 0 ) + u64 hpet_rate = hpet_setup(); + + if ( hpet_rate == 0 ) return 0; - - set_fixmap_nocache(FIX_HPET_BASE, hpet_address); - - hpet_id = hpet_read32(HPET_ID); - if ( hpet_id == 0 ) - { - printk("BAD HPET vendor id.\n"); - return 0; - } - - /* Check for sane period (100ps <= period <= 100ns). */ - hpet_period = hpet_read32(HPET_PERIOD); - if ( (hpet_period > 100000000) || (hpet_period < 100000) ) - { - printk("BAD HPET period %u.\n", hpet_period); - return 0; - } - - cfg = hpet_read32(HPET_CFG); - cfg &= ~(HPET_CFG_ENABLE | HPET_CFG_LEGACY); - hpet_write32(cfg, HPET_CFG); - - for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ ) - { - cfg = hpet_read32(HPET_T0_CFG + i*0x20); - cfg &= ~HPET_TN_ENABLE; - hpet_write32(cfg & ~HPET_TN_ENABLE, HPET_T0_CFG); - } - - cfg = hpet_read32(HPET_CFG); - cfg |= HPET_CFG_ENABLE; - hpet_write32(cfg, HPET_CFG); - - hpet_rate = 1000000000000000ULL; /* 10^15 */ - (void)do_div(hpet_rate, hpet_period); pts->name = "HPET"; pts->frequency = hpet_rate; @@ -1041,7 +1007,14 @@ static int __init disable_pit_irq(void) outb_p(0x30, PIT_MODE); outb_p(0, PIT_CH0); outb_p(0, PIT_CH0); - } + + /* + * If we do not rely on PIT CH0 then we can use HPET for one-shot + * timer emulation when entering deep C states. + */ + hpet_broadcast_init(); + } + return 0; } __initcall(disable_pit_irq); diff -r 672c09aad49d -r d795e15b85a7 xen/common/timer.c --- a/xen/common/timer.c Tue May 20 14:50:45 2008 +0100 +++ b/xen/common/timer.c Wed May 21 10:38:57 2008 +0100 @@ -35,7 +35,7 @@ struct timers { static DEFINE_PER_CPU(struct timers, timers); -extern int reprogram_timer(s_time_t timeout); +DEFINE_PER_CPU(s_time_t, timer_deadline); /**************************************************************************** * HEAP OPERATIONS. @@ -323,8 +323,10 @@ static void timer_softirq_action(void) } ts->running = NULL; - } - while ( !reprogram_timer(GET_HEAP_SIZE(heap) ? heap[1]->expires : 0) ); + + this_cpu(timer_deadline) = GET_HEAP_SIZE(heap) ? heap[1]->expires : 0; + } + while ( !reprogram_timer(this_cpu(timer_deadline)) ); spin_unlock_irq(&ts->lock); } diff -r 672c09aad49d -r d795e15b85a7 xen/include/asm-x86/hpet.h --- a/xen/include/asm-x86/hpet.h Tue May 20 14:50:45 2008 +0100 +++ b/xen/include/asm-x86/hpet.h Wed May 21 10:38:57 2008 +0100 @@ -49,4 +49,24 @@ #define hpet_write32(y,x) \ (*(volatile u32 *)(fix_to_virt(FIX_HPET_BASE) + (x)) = (y)) +/* + * Detect and initialise HPET hardware: return counter update frequency. + * Return value is zero if HPET is unavailable. + */ +u64 hpet_setup(void); + +/* + * Callback from legacy timer (PIT channel 0) IRQ handler. + * Returns 1 if tick originated from HPET; else 0. + */ +int hpet_legacy_irq_tick(void); + +/* + * Temporarily use an HPET event counter for timer interrupt handling, + * rather than using the LAPIC timer. Used for Cx state entry. + */ +void hpet_broadcast_init(void); +void hpet_broadcast_enter(void); +void hpet_broadcast_exit(void); + #endif /* __X86_HPET_H__ */ diff -r 672c09aad49d -r d795e15b85a7 xen/include/xen/timer.h --- a/xen/include/xen/timer.h Tue May 20 14:50:45 2008 +0100 +++ b/xen/include/xen/timer.h Wed May 21 10:38:57 2008 +0100 @@ -99,6 +99,15 @@ extern void process_pending_timers(void) */ extern void timer_init(void); +/* + * Next timer deadline for each CPU. + * Modified only by the local CPU and never in interrupt context. + */ +DECLARE_PER_CPU(s_time_t, timer_deadline); + +/* Arch-defined function to reprogram timer hardware for new deadline. */ +extern int reprogram_timer(s_time_t timeout); + #endif /* _TIMER_H_ */ /* _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq6o-0002RT-UF for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7S-0005XB-VZ; Wed, 21 May 2008 15:20:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7R-0005Wp-UH for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7K-0004LP-Pl for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:43 +0000 X-SBRS: 3.6 X-MesageID: 276802 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276802" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:19:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFJpFH032196 for ; Wed, 21 May 2008 08:19:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFK9dB016912 for ; Wed, 21 May 2008 08:20:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFK96L016911 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:09 -0700 Message-Id: <200805211520.m4LFK96L016911@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Remove XendLogging dependency from a couple of generally useful X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211363828 -3600 # Node ID 5d4eac11e14f7a753f918042d93bab1b39792597 # Parent d795e15b85a788d0389d24963897cf480dcab0e9 xend: Remove XendLogging dependency from a couple of generally useful support modules. Signed-off-by: Zhigang Wang --- tools/python/xen/util/blkif.py | 2 -- tools/python/xen/xend/xenstore/xswatch.py | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff -r d795e15b85a7 -r 5d4eac11e14f tools/python/xen/util/blkif.py --- a/tools/python/xen/util/blkif.py Wed May 21 10:38:57 2008 +0100 +++ b/tools/python/xen/util/blkif.py Wed May 21 10:57:08 2008 +0100 @@ -1,8 +1,6 @@ import os import os import re import string - -from xen.xend.XendLogging import log def expand_dev_name(name): if not name: diff -r d795e15b85a7 -r 5d4eac11e14f tools/python/xen/xend/xenstore/xswatch.py --- a/tools/python/xen/xend/xenstore/xswatch.py Wed May 21 10:38:57 2008 +0100 +++ b/tools/python/xen/xend/xenstore/xswatch.py Wed May 21 10:57:08 2008 +0100 @@ -8,8 +8,6 @@ import errno import errno import threading from xen.xend.xenstore.xsutil import xshandle - -from xen.xend.XendLogging import log class xswatch: @@ -76,7 +74,7 @@ def watchMain(): else: raise except: - log.exception("read_watch failed") + pass # Ignore this exception -- there's no point throwing it # further on because that will just kill the watcher thread, # which achieves nothing. _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:10 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:10 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq6r-0002RX-LL for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:10 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7W-0005aV-8X; Wed, 21 May 2008 15:20:50 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7S-0005Wq-I1 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7L-0004LS-OC for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:44 +0000 X-SBRS: 3.6 X-MesageID: 276803 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276803" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:19:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFJqhx032199 for ; Wed, 21 May 2008 08:19:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFKBAO016929 for ; Wed, 21 May 2008 08:20:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFKAo5016928 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:10 -0700 Message-Id: <200805211520.m4LFKAo5016928@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Make cx key handler print simpler but formatted info. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211363940 -3600 # Node ID b9735935a69e49e4caaed8844a50a227bd0725c7 # Parent 5d4eac11e14f7a753f918042d93bab1b39792597 x86: Make cx key handler print simpler but formatted info. Signed-off-by: Wei Gang --- xen/arch/x86/acpi/cpu_idle.c | 66 ++++++++++++++++--------------------------- 1 files changed, 25 insertions(+), 41 deletions(-) diff -r 5d4eac11e14f -r b9735935a69e xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Wed May 21 10:57:08 2008 +0100 +++ b/xen/arch/x86/acpi/cpu_idle.c Wed May 21 10:59:00 2008 +0100 @@ -37,13 +37,13 @@ #include #include #include +#include +#include #include #include #include -#include +#include #include -#include -#include #define DEBUG_PM_CX @@ -128,45 +128,29 @@ static void print_acpi_power(uint32_t cp { uint32_t i; - printk("saved cpu%d cx acpi info:\n", cpu); - printk("\tcurrent state is C%d\n", (power->state)?power->state->type:-1); - printk("\tbm_check_timestamp = %"PRId64"\n", power->bm_check_timestamp); - printk("\tdefault_state = %d\n", power->default_state); - printk("\tbm_activity = 0x%08x\n", power->bm_activity); - printk("\tcount = %d\n", power->count); + printk("==cpu%d==\n", cpu); + printk("active state:\t\tC%d\n", (power->state)?power->state->type:-1); + printk("max_cstate:\t\tC%d\n", max_cstate); + printk("bus master activity:\t%08x\n", power->bm_activity); + printk("states:\n"); - for ( i = 0; i < power->count; i++ ) - { - printk("\tstates[%d]:\n", i); - printk("\t\tvalid = %d\n", power->states[i].valid); - printk("\t\ttype = %d\n", power->states[i].type); - printk("\t\taddress = 0x%x\n", power->states[i].address); - printk("\t\tspace_id = 0x%x\n", power->states[i].space_id); - printk("\t\tlatency = %d\n", power->states[i].latency); - printk("\t\tpower = %d\n", power->states[i].power); - printk("\t\tlatency_ticks = %d\n", power->states[i].latency_ticks); - printk("\t\tusage = %d\n", power->states[i].usage); - printk("\t\ttime = %"PRId64"\n", power->states[i].time); - - printk("\t\tpromotion policy:\n"); - printk("\t\t\tcount = %d\n", power->states[i].promotion.count); - printk("\t\t\tstate = C%d\n", - (power->states[i].promotion.state) ? - power->states[i].promotion.state->type : -1); - printk("\t\t\tthreshold.time = %d\n", power->states[i].promotion.threshold.time); - printk("\t\t\tthreshold.ticks = %d\n", power->states[i].promotion.threshold.ticks); - printk("\t\t\tthreshold.count = %d\n", power->states[i].promotion.threshold.count); - printk("\t\t\tthreshold.bm = %d\n", power->states[i].promotion.threshold.bm); - - printk("\t\tdemotion policy:\n"); - printk("\t\t\tcount = %d\n", power->states[i].demotion.count); - printk("\t\t\tstate = C%d\n", - (power->states[i].demotion.state) ? - power->states[i].demotion.state->type : -1); - printk("\t\t\tthreshold.time = %d\n", power->states[i].demotion.threshold.time); - printk("\t\t\tthreshold.ticks = %d\n", power->states[i].demotion.threshold.ticks); - printk("\t\t\tthreshold.count = %d\n", power->states[i].demotion.threshold.count); - printk("\t\t\tthreshold.bm = %d\n", power->states[i].demotion.threshold.bm); + for ( i = 1; i < power->count; i++ ) + { + printk((power->states[i].type == power->state->type) ? " *" : " "); + printk("C%d:\t\t", i); + printk("type[C%d] ", power->states[i].type); + if ( power->states[i].promotion.state ) + printk("promotion[C%d] ", power->states[i].promotion.state->type); + else + printk("promotion[--] "); + if ( power->states[i].demotion.state ) + printk("demotion[C%d] ", power->states[i].demotion.state->type); + else + printk("demotion[--] "); + printk("latency[%03d]\n ", power->states[i].latency); + printk("\t\t\t"); + printk("usage[%08d] ", power->states[i].usage); + printk("duration[%"PRId64"]\n", power->states[i].time); } } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq6v-0002Rg-Pp for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7a-0005dx-F1; Wed, 21 May 2008 15:20:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7V-0005YL-M1 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7N-0004LT-57 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:47 +0000 X-SBRS: 3.6 X-MesageID: 276804 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276804" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:19:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFJsGb032202 for ; Wed, 21 May 2008 08:19:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFKCtN016946 for ; Wed, 21 May 2008 08:20:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFKCJj016945 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:12 -0700 Message-Id: <200805211520.m4LFKCJj016945@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add statistic interface for cx. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211363989 -3600 # Node ID ef019d230080cc1c85a3a9a79c170f898db6be53 # Parent b9735935a69e49e4caaed8844a50a227bd0725c7 Add statistic interface for cx. Implement statistic interface for cx via sysctl & libxc. Provide a easy way to collect processor cx info within dom0. Signed-off-by: Wei Gang --- tools/libxc/xc_pm.c | 68 +++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 13 ++++++++ xen/arch/x86/acpi/cpu_idle.c | 39 ++++++++++++++++++++++++ xen/arch/x86/acpi/pmstat.c | 25 +++++++++++++++ xen/include/public/sysctl.h | 23 ++++++++++++-- 5 files changed, 163 insertions(+), 5 deletions(-) diff -r b9735935a69e -r ef019d230080 tools/libxc/xc_pm.c --- a/tools/libxc/xc_pm.c Wed May 21 10:59:00 2008 +0100 +++ b/tools/libxc/xc_pm.c Wed May 21 10:59:49 2008 +0100 @@ -99,3 +99,71 @@ int xc_pm_reset_pxstat(int xc_handle, in return xc_sysctl(xc_handle, &sysctl); } + +int xc_pm_get_max_cx(int xc_handle, int cpuid, int *max_cx) +{ + DECLARE_SYSCTL; + int ret = 0; + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_get_max_cx; + sysctl.u.get_pmstat.cpuid = cpuid; + if ( (ret = xc_sysctl(xc_handle, &sysctl)) != 0 ) + return ret; + + *max_cx = sysctl.u.get_pmstat.u.getcx.nr; + return ret; +} + +int xc_pm_get_cxstat(int xc_handle, int cpuid, struct xc_cx_stat *cxpt) +{ + DECLARE_SYSCTL; + int max_cx, ret; + + if( !cxpt || !(cxpt->triggers) || !(cxpt->residencies) ) + return -EINVAL; + + if ( (ret = xc_pm_get_max_cx(xc_handle, cpuid, &max_cx)) ) + goto unlock_0; + + if ( (ret = lock_pages(cxpt, sizeof(struct xc_cx_stat))) ) + goto unlock_0; + if ( (ret = lock_pages(cxpt->triggers, max_cx * sizeof(uint64_t))) ) + goto unlock_1; + if ( (ret = lock_pages(cxpt->residencies, max_cx * sizeof(uint64_t))) ) + goto unlock_2; + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_get_cxstat; + sysctl.u.get_pmstat.cpuid = cpuid; + set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.triggers, cxpt->triggers); + set_xen_guest_handle(sysctl.u.get_pmstat.u.getcx.residencies, + cxpt->residencies); + + if ( (ret = xc_sysctl(xc_handle, &sysctl)) ) + goto unlock_3; + + cxpt->nr = sysctl.u.get_pmstat.u.getcx.nr; + cxpt->last = sysctl.u.get_pmstat.u.getcx.last; + cxpt->idle_time = sysctl.u.get_pmstat.u.getcx.idle_time; + +unlock_3: + unlock_pages(cxpt->residencies, max_cx * sizeof(uint64_t)); +unlock_2: + unlock_pages(cxpt->triggers, max_cx * sizeof(uint64_t)); +unlock_1: + unlock_pages(cxpt, sizeof(struct xc_cx_stat)); +unlock_0: + return ret; +} + +int xc_pm_reset_cxstat(int xc_handle, int cpuid) +{ + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_get_pmstat; + sysctl.u.get_pmstat.type = PMSTAT_reset_cxstat; + sysctl.u.get_pmstat.cpuid = cpuid; + + return xc_sysctl(xc_handle, &sysctl); +} diff -r b9735935a69e -r ef019d230080 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Wed May 21 10:59:00 2008 +0100 +++ b/tools/libxc/xenctrl.h Wed May 21 10:59:49 2008 +0100 @@ -1053,4 +1053,17 @@ int xc_pm_get_pxstat(int xc_handle, int int xc_pm_get_pxstat(int xc_handle, int cpuid, struct xc_px_stat *pxpt); int xc_pm_reset_pxstat(int xc_handle, int cpuid); +struct xc_cx_stat { + uint32_t nr; /* entry nr in triggers & residencies, including C0 */ + uint32_t last; /* last Cx state */ + uint64_t idle_time; /* idle time from boot */ + uint64_t *triggers; /* Cx trigger counts */ + uint64_t *residencies; /* Cx residencies */ +}; +typedef struct xc_cx_stat xc_cx_stat_t; + +int xc_pm_get_max_cx(int xc_handle, int cpuid, int *max_cx); +int xc_pm_get_cxstat(int xc_handle, int cpuid, struct xc_cx_stat *cxpt); +int xc_pm_reset_cxstat(int xc_handle, int cpuid); + #endif /* XENCTRL_H */ diff -r b9735935a69e -r ef019d230080 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Wed May 21 10:59:00 2008 +0100 +++ b/xen/arch/x86/acpi/cpu_idle.c Wed May 21 10:59:49 2008 +0100 @@ -44,6 +44,7 @@ #include #include #include +#include #define DEBUG_PM_CX @@ -940,3 +941,41 @@ long set_cx_pminfo(uint32_t cpu, struct return 0; } + +uint32_t pmstat_get_cx_nr(uint32_t cpuid) +{ + return processor_powers[cpuid].count; +} + +int pmstat_get_cx_stat(uint32_t cpuid, struct pm_cx_stat *stat) +{ + struct acpi_processor_power *power = &processor_powers[cpuid]; + struct vcpu *v = idle_vcpu[cpuid]; + uint64_t usage; + int i; + + stat->last = (power->state) ? power->state->type : 0; + stat->nr = processor_powers[cpuid].count; + stat->idle_time = v->runstate.time[RUNSTATE_running]; + if ( v->is_running ) + stat->idle_time += NOW() - v->runstate.state_entry_time; + + for ( i = 0; i < power->count; i++ ) + { + usage = power->states[i].usage; + if ( copy_to_guest_offset(stat->triggers, i, &usage, 1) ) + return -EFAULT; + } + for ( i = 0; i < power->count; i++ ) + if ( copy_to_guest_offset(stat->residencies, i, + &power->states[i].time, 1) ) + return -EFAULT; + + return 0; +} + +int pmstat_reset_cx_stat(uint32_t cpuid) +{ + return 0; +} + diff -r b9735935a69e -r ef019d230080 xen/arch/x86/acpi/pmstat.c --- a/xen/arch/x86/acpi/pmstat.c Wed May 21 10:59:00 2008 +0100 +++ b/xen/arch/x86/acpi/pmstat.c Wed May 21 10:59:49 2008 +0100 @@ -42,6 +42,10 @@ struct pm_px px_statistic_data[NR_CPUS]; +extern uint32_t pmstat_get_cx_nr(uint32_t cpuid); +extern int pmstat_get_cx_stat(uint32_t cpuid, struct pm_cx_stat *stat); +extern int pmstat_reset_cx_stat(uint32_t cpuid); + int do_get_pm_info(struct xen_sysctl_get_pmstat *op) { int ret = 0; @@ -50,7 +54,7 @@ int do_get_pm_info(struct xen_sysctl_get /* to protect the case when Px was controlled by dom0-kernel */ /* or when CPU_FREQ not set in which case ACPI Px objects not parsed */ - if ( !pmpt->perf.init ) + if ( !pmpt->perf.init && (op->type & PMSTAT_CATEGORY_MASK) == PMSTAT_PX ) return -EINVAL; if ( !cpu_online(op->cpuid) ) @@ -100,6 +104,25 @@ int do_get_pm_info(struct xen_sysctl_get break; } + case PMSTAT_get_max_cx: + { + op->u.getcx.nr = pmstat_get_cx_nr(op->cpuid); + ret = 0; + break; + } + + case PMSTAT_get_cxstat: + { + ret = pmstat_get_cx_stat(op->cpuid, &op->u.getcx); + break; + } + + case PMSTAT_reset_cxstat: + { + ret = pmstat_reset_cx_stat(op->cpuid); + break; + } + default: printk("not defined sub-hypercall @ do_get_pm_info\n"); ret = -ENOSYS; diff -r b9735935a69e -r ef019d230080 xen/include/public/sysctl.h --- a/xen/include/public/sysctl.h Wed May 21 10:59:00 2008 +0100 +++ b/xen/include/public/sysctl.h Wed May 21 10:59:49 2008 +0100 @@ -233,15 +233,30 @@ typedef struct pm_px_stat pm_px_stat_t; typedef struct pm_px_stat pm_px_stat_t; DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t); +struct pm_cx_stat { + uint32_t nr; /* entry nr in triggers & residencies, including C0 */ + uint32_t last; /* last Cx state */ + uint64_aligned_t idle_time; /* idle time from boot */ + XEN_GUEST_HANDLE_64(uint64) triggers; /* Cx trigger counts */ + XEN_GUEST_HANDLE_64(uint64) residencies; /* Cx residencies */ +}; + struct xen_sysctl_get_pmstat { -#define PMSTAT_get_max_px 0x11 -#define PMSTAT_get_pxstat 0x12 -#define PMSTAT_reset_pxstat 0x13 +#define PMSTAT_CATEGORY_MASK 0xf0 +#define PMSTAT_PX 0x10 +#define PMSTAT_CX 0x20 +#define PMSTAT_get_max_px (PMSTAT_PX | 0x1) +#define PMSTAT_get_pxstat (PMSTAT_PX | 0x2) +#define PMSTAT_reset_pxstat (PMSTAT_PX | 0x3) +#define PMSTAT_get_max_cx (PMSTAT_CX | 0x1) +#define PMSTAT_get_cxstat (PMSTAT_CX | 0x2) +#define PMSTAT_reset_cxstat (PMSTAT_CX | 0x3) uint32_t type; uint32_t cpuid; union { struct pm_px_stat getpx; - /* other struct for cx, tx, etc */ + struct pm_cx_stat getcx; + /* other struct for tx, etc */ } u; }; typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:20 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:20 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq71-0002Rl-Ef for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7f-0005iW-VS; Wed, 21 May 2008 15:21:00 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7X-0005Zh-CY for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7Q-0004LP-1M for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:49 +0000 X-SBRS: 3.6 X-MesageID: 276805 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276805" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:19:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFJtYp032205 for ; Wed, 21 May 2008 08:19:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFKDUS016963 for ; Wed, 21 May 2008 08:20:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFKDVZ016962 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:13 -0700 Message-Id: <200805211520.m4LFKDVZ016962@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Intel EPT: Add page shattering logic for EPT when a super-page gets partially freed. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211364171 -3600 # Node ID ff23c9a11085dce8c5b2e3b692cde86cd87698a7 # Parent ef019d230080cc1c85a3a9a79c170f898db6be53 Intel EPT: Add page shattering logic for EPT when a super-page gets partially freed. Signed-off-by: Xin Xiaohui --- xen/arch/x86/mm/hap/p2m-ept.c | 172 +++++++++++++++++++++++++++++------------- 1 files changed, 120 insertions(+), 52 deletions(-) diff -r ef019d230080 -r ff23c9a11085 xen/arch/x86/mm/hap/p2m-ept.c --- a/xen/arch/x86/mm/hap/p2m-ept.c Wed May 21 10:59:49 2008 +0100 +++ b/xen/arch/x86/mm/hap/p2m-ept.c Wed May 21 11:02:51 2008 +0100 @@ -49,10 +49,35 @@ static void ept_p2m_type_to_flags(ept_en #define GUEST_TABLE_NORMAL_PAGE 1 #define GUEST_TABLE_SUPER_PAGE 2 +#define GUEST_TABLE_SPLIT_PAGE 3 + +static int ept_set_middle_entry(struct domain *d, ept_entry_t *ept_entry) +{ + struct page_info *pg; + + pg = d->arch.p2m->alloc_page(d); + if ( pg == NULL ) + return 0; + + pg->count_info = 1; + pg->u.inuse.type_info = 1 | PGT_validated; + list_add_tail(&pg->list, &d->arch.p2m->pages); + + ept_entry->emt = 0; + ept_entry->sp_avail = 0; + ept_entry->avail1 = 0; + ept_entry->mfn = page_to_mfn(pg); + ept_entry->rsvd = 0; + ept_entry->avail2 = 0; + /* last step */ + ept_entry->r = ept_entry->w = ept_entry->x = 1; + + return 1; +} static int ept_next_level(struct domain *d, bool_t read_only, ept_entry_t **table, unsigned long *gfn_remainder, - u32 shift) + u32 shift, int order) { ept_entry_t *ept_entry, *next; u32 index; @@ -63,27 +88,11 @@ static int ept_next_level(struct domain if ( !(ept_entry->epte & 0x7) ) { - struct page_info *pg; - if ( read_only ) return 0; - pg = d->arch.p2m->alloc_page(d); - if ( pg == NULL ) + if ( !ept_set_middle_entry(d, ept_entry) ) return 0; - - pg->count_info = 1; - pg->u.inuse.type_info = 1 | PGT_validated; - list_add_tail(&pg->list, &d->arch.p2m->pages); - - ept_entry->emt = 0; - ept_entry->sp_avail = 0; - ept_entry->avail1 = 0; - ept_entry->mfn = page_to_mfn(pg); - ept_entry->rsvd = 0; - ept_entry->avail2 = 0; - /* last step */ - ept_entry->r = ept_entry->w = ept_entry->x = 1; } if ( !ept_entry->sp_avail ) @@ -95,7 +104,12 @@ static int ept_next_level(struct domain return GUEST_TABLE_NORMAL_PAGE; } else - return GUEST_TABLE_SUPER_PAGE; + { + if ( order == shift || read_only ) + return GUEST_TABLE_SUPER_PAGE; + else + return GUEST_TABLE_SPLIT_PAGE; + } } static int @@ -109,7 +123,9 @@ ept_set_entry(struct domain *d, unsigned int i, rv = 0, ret = 0; int walk_level = order / EPT_TABLE_ORDER; - /* Should check if gfn obeys GAW here */ + /* we only support 4k and 2m pages now */ + + BUG_ON(order && order != EPT_TABLE_ORDER); if ( order != 0 ) if ( (gfn & ((1UL << order) - 1)) ) @@ -122,10 +138,10 @@ ept_set_entry(struct domain *d, unsigned for ( i = EPT_DEFAULT_GAW; i > walk_level; i-- ) { ret = ept_next_level(d, 0, &table, &gfn_remainder, - i * EPT_TABLE_ORDER); + i * EPT_TABLE_ORDER, order); if ( !ret ) goto out; - else if ( ret == GUEST_TABLE_SUPER_PAGE ) + else if ( ret != GUEST_TABLE_NORMAL_PAGE ) break; } @@ -135,35 +151,87 @@ ept_set_entry(struct domain *d, unsigned ept_entry = table + index; - if ( mfn_valid(mfn_x(mfn)) || (p2mt == p2m_mmio_direct) ) - { - /* Track the highest gfn for which we have ever had a valid mapping */ - if ( gfn > d->arch.p2m->max_mapped_pfn ) - d->arch.p2m->max_mapped_pfn = gfn; - - ept_entry->emt = EPT_DEFAULT_MT; - ept_entry->sp_avail = walk_level ? 1 : 0; - - if ( ret == GUEST_TABLE_SUPER_PAGE ) - { - ept_entry->mfn = mfn_x(mfn) - offset; - if ( ept_entry->avail1 == p2m_ram_logdirty && - p2mt == p2m_ram_rw ) - for ( i = 0; i < 512; i++ ) - paging_mark_dirty(d, mfn_x(mfn)-offset+i); + if ( ret != GUEST_TABLE_SPLIT_PAGE ) + { + if ( mfn_valid(mfn_x(mfn)) || (p2mt == p2m_mmio_direct) ) + { + /* Track the highest gfn for which we have ever had a valid mapping */ + if ( gfn > d->arch.p2m->max_mapped_pfn ) + d->arch.p2m->max_mapped_pfn = gfn; + + ept_entry->emt = EPT_DEFAULT_MT; + ept_entry->sp_avail = walk_level ? 1 : 0; + + if ( ret == GUEST_TABLE_SUPER_PAGE ) + { + ept_entry->mfn = mfn_x(mfn) - offset; + if ( ept_entry->avail1 == p2m_ram_logdirty && + p2mt == p2m_ram_rw ) + for ( i = 0; i < 512; i++ ) + paging_mark_dirty(d, mfn_x(mfn)-offset+i); + } + else + ept_entry->mfn = mfn_x(mfn); + + ept_entry->avail1 = p2mt; + ept_entry->rsvd = 0; + ept_entry->avail2 = 0; + /* last step */ + ept_entry->r = ept_entry->w = ept_entry->x = 1; + ept_p2m_type_to_flags(ept_entry, p2mt); } else - ept_entry->mfn = mfn_x(mfn); - - ept_entry->avail1 = p2mt; - ept_entry->rsvd = 0; - ept_entry->avail2 = 0; - /* last step */ - ept_entry->r = ept_entry->w = ept_entry->x = 1; - ept_p2m_type_to_flags(ept_entry, p2mt); + ept_entry->epte = 0; } else - ept_entry->epte = 0; + { + /* It's super page before, now set one of the 4k pages, so + * we should split the 2m page to 4k pages now. + */ + + ept_entry_t *split_table = NULL; + ept_entry_t *split_ept_entry = NULL; + unsigned long split_mfn = ept_entry->mfn; + p2m_type_t split_p2mt = ept_entry->avail1; + + /* alloc new page for new ept middle level entry which is + * before a leaf super entry + */ + + if ( !ept_set_middle_entry(d, ept_entry) ) + goto out; + + /* split the super page before to 4k pages */ + + split_table = map_domain_page(ept_entry->mfn); + + for ( i = 0; i < 512; i++ ) + { + split_ept_entry = split_table + i; + split_ept_entry->emt = EPT_DEFAULT_MT; + split_ept_entry->sp_avail = 0; + + split_ept_entry->mfn = split_mfn+i; + + split_ept_entry->avail1 = split_p2mt; + split_ept_entry->rsvd = 0; + split_ept_entry->avail2 = 0; + /* last step */ + split_ept_entry->r = split_ept_entry->w = split_ept_entry->x = 1; + ept_p2m_type_to_flags(split_ept_entry, split_p2mt); + } + + /* Set the destinated 4k page as normal */ + + offset = gfn & ((1 << EPT_TABLE_ORDER) - 1); + split_ept_entry = split_table + offset; + split_ept_entry->mfn = mfn_x(mfn); + split_ept_entry->avail1 = p2mt; + ept_p2m_type_to_flags(split_ept_entry, p2mt); + + unmap_domain_page(split_table); + + } /* Success */ rv = 1; @@ -179,22 +247,22 @@ out: { if ( p2mt == p2m_ram_rw ) { - if ( ret == GUEST_TABLE_SUPER_PAGE ) + if ( order == EPT_TABLE_ORDER ) { for ( i = 0; i < 512; i++ ) iommu_map_page(d, gfn-offset+i, mfn_x(mfn)-offset+i); } - else if ( ret ) + else if ( !order ) iommu_map_page(d, gfn, mfn_x(mfn)); } else { - if ( ret == GUEST_TABLE_SUPER_PAGE ) + if ( order == EPT_TABLE_ORDER ) { for ( i = 0; i < 512; i++ ) iommu_unmap_page(d, gfn-offset+i); } - else if ( ret ) + else if ( !order ) iommu_unmap_page(d, gfn); } } @@ -230,7 +298,7 @@ static mfn_t ept_get_entry(struct domain for ( i = EPT_DEFAULT_GAW; i > 0; i-- ) { ret = ept_next_level(d, 1, &table, &gfn_remainder, - i * EPT_TABLE_ORDER); + i * EPT_TABLE_ORDER, 0); if ( !ret ) goto out; else if ( ret == GUEST_TABLE_SUPER_PAGE ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:24 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:24 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq75-0002Rs-Q7 for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:24 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7k-0005m2-E7; Wed, 21 May 2008 15:21:04 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7X-0005aN-SG for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7R-0004LS-10 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:49 +0000 X-SBRS: 3.6 X-MesageID: 276806 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276806" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:19:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFJuWi032208 for ; Wed, 21 May 2008 08:19:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFKE3Y016980 for ; Wed, 21 May 2008 08:20:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFKEoD016979 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:14 -0700 Message-Id: <200805211520.m4LFKEoD016979@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Handle IOMMU pagetable allocations when set_p2m_entry is called with X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211364443 -3600 # Node ID 70ca37d228951e98fdf2b5f9bd5883a04321c2c8 # Parent ff23c9a11085dce8c5b2e3b692cde86cd87698a7 Handle IOMMU pagetable allocations when set_p2m_entry is called with non-zero page order. Signed-off-by: Xin Xiaohui Signed-off-by: Keir Fraser --- xen/arch/x86/mm/p2m.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff -r ff23c9a11085 -r 70ca37d22895 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Wed May 21 11:02:51 2008 +0100 +++ b/xen/arch/x86/mm/p2m.c Wed May 21 11:07:23 2008 +0100 @@ -250,7 +250,7 @@ p2m_set_entry(struct domain *d, unsigned // XXX -- this might be able to be faster iff current->domain == d mfn_t table_mfn = pagetable_get_mfn(d->arch.phys_table); void *table =map_domain_page(mfn_x(table_mfn)); - unsigned long gfn_remainder = gfn; + unsigned long i, gfn_remainder = gfn; l1_pgentry_t *p2m_entry; l1_pgentry_t entry_content; l2_pgentry_t l2e_content; @@ -328,9 +328,11 @@ p2m_set_entry(struct domain *d, unsigned if ( iommu_enabled && is_hvm_domain(d) ) { if ( p2mt == p2m_ram_rw ) - iommu_map_page(d, gfn, mfn_x(mfn)); + for ( i = 0; i < (1UL << page_order); i++ ) + iommu_map_page(d, gfn+i, mfn_x(mfn)+i ); else - iommu_unmap_page(d, gfn); + for ( int i = 0; i < (1UL << page_order); i++ ) + iommu_unmap_page(d, gfn+i); } /* Success */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:27 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:27 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq79-0002Ry-Jn for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:27 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7o-0005pV-5d; Wed, 21 May 2008 15:21:08 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7a-0005d2-UH for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7U-0004LT-5D for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:52 +0000 X-SBRS: 3.6 X-MesageID: 276807 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276807" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:19:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFJvkw032211 for ; Wed, 21 May 2008 08:19:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFKGtK016997 for ; Wed, 21 May 2008 08:20:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFKFRg016996 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:15 -0700 Message-Id: <200805211520.m4LFKFRg016996@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vgabios: Support VESA power management extensions. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211365181 -3600 # Node ID b58e95aee14f0190a95b2ae610c24c8fe09e8c7a # Parent 70ca37d228951e98fdf2b5f9bd5883a04321c2c8 vgabios: Support VESA power management extensions. Signed-off-by: Keir Fraser --- tools/firmware/vgabios/clext.c | 54 ++++++++++++++++++++++++++++++++++--- tools/firmware/vgabios/vgatables.h | 1 2 files changed, 52 insertions(+), 3 deletions(-) diff -r 70ca37d22895 -r b58e95aee14f tools/firmware/vgabios/clext.c --- a/tools/firmware/vgabios/clext.c Wed May 21 11:07:23 2008 +0100 +++ b/tools/firmware/vgabios/clext.c Wed May 21 11:19:41 2008 +0100 @@ -26,6 +26,7 @@ #define PM_BIOSMEM_CURRENT_MODE 0x449 #define PM_BIOSMEM_CRTC_ADDRESS 0x463 #define PM_BIOSMEM_VBE_MODE 0x4BA +#define PM_BIOSMEM_VBE_POWER 0x4BC typedef struct { @@ -491,7 +492,7 @@ cirrus_vesa: #ifdef CIRRUS_DEBUG call cirrus_debug_dump #endif - cmp al, #0x0F + cmp al, #0x10 ja cirrus_vesa_not_handled push bx xor bx, bx @@ -682,7 +683,7 @@ c80h_2: ret cirrus_extbios_81h: - mov ax, #0x100 ;; XXX + mov ax, #0x103 ;; XXX ret cirrus_extbios_82h: push dx @@ -1175,6 +1176,52 @@ cirrus_vesa_07h_2: mov cx, ax pop dx mov ax, #0x004f + ret + +cirrus_vesa_10h: ;; Power management functions + ;; Set up DS to read stored power info from RAM + push ds +#ifdef CIRRUS_VESA3_PMINFO + db 0x2e ;; cs: + mov ax, [cirrus_vesa_sel0000_data] +#else + xor ax, ax +#endif + mov ds, ax + ;; Now choose the right function + cmp bl, #0x00 + ja cirrus_vesa_10h_01 + ;; + ;; Function 00h: Get capabilities + ;; + mov bx, #0x0720 ;; 07: standby/suspend/off, 20: VBE/PM 2.0 + mov ax, #0x004f + jmp cirrus_vesa_10h_done +cirrus_vesa_10h_01: + cmp bl, #0x01 + ja cirrus_vesa_10h_02 + ;; + ;; Function 01h: Set power state + ;; + mov ax, bx + mov bx, # PM_BIOSMEM_VBE_POWER + mov [bx], ah + mov ax, #0x004f + jmp cirrus_vesa_10h_done +cirrus_vesa_10h_02: + cmp bl, #0x02 + ja cirrus_vesa_10h_unimplemented + ;; + ;; Function 02h: Get power state + ;; + mov bx, # PM_BIOSMEM_VBE_POWER + mov bh, [bx] + mov ax, #0x004f + jmp cirrus_vesa_10h_done +cirrus_vesa_10h_unimplemented: + mov ax, #0x014F ;; not implemented +cirrus_vesa_10h_done: + pop ds ret cirrus_vesa_unimplemented: @@ -1601,7 +1648,8 @@ cirrus_vesa_handlers: dw cirrus_vesa_unimplemented dw cirrus_vesa_unimplemented dw cirrus_vesa_unimplemented - + ;; 10h + dw cirrus_vesa_10h ASM_END diff -r 70ca37d22895 -r b58e95aee14f tools/firmware/vgabios/vgatables.h --- a/tools/firmware/vgabios/vgatables.h Wed May 21 11:07:23 2008 +0100 +++ b/tools/firmware/vgabios/vgatables.h Wed May 21 11:19:41 2008 +0100 @@ -25,6 +25,7 @@ #define BIOSMEM_VS_POINTER 0xA8 #define BIOSMEM_VBE_FLAG 0xB9 #define BIOSMEM_VBE_MODE 0xBA +#define BIOSMEM_VBE_POWER 0xBC /* _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:33 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:33 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq7E-0002S3-M7 for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:33 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7t-0005tM-7U; Wed, 21 May 2008 15:21:13 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7d-0005fZ-LY for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:57 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7W-0004LS-BK for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:55 +0000 X-SBRS: 3.6 X-MesageID: 276809 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276809" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:20:01 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFK1x1032217 for ; Wed, 21 May 2008 08:20:01 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFKJ1x017079 for ; Wed, 21 May 2008 08:20:19 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFKJW3017078 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:19 -0700 Message-Id: <200805211520.m4LFKJW3017078@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:18 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] xen: Sync sysctl.h for xen cpuidle statistic interface. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211364028 -3600 # Node ID 8792274adfd0cab0311f3df6183743de3faa3c51 # Parent 6b0a85eb515569490f4a02876c95d2b1153d444a xen: Sync sysctl.h for xen cpuidle statistic interface. Signed-off-by: Wei Gang --- include/xen/interface/sysctl.h | 25 ++++++++++++++++++++----- 1 files changed, 20 insertions(+), 5 deletions(-) diff -r 6b0a85eb5155 -r 8792274adfd0 include/xen/interface/sysctl.h --- a/include/xen/interface/sysctl.h Tue May 20 11:33:33 2008 +0900 +++ b/include/xen/interface/sysctl.h Wed May 21 11:00:28 2008 +0100 @@ -233,20 +233,35 @@ typedef struct pm_px_stat pm_px_stat_t; typedef struct pm_px_stat pm_px_stat_t; DEFINE_XEN_GUEST_HANDLE(pm_px_stat_t); +struct pm_cx_stat { + uint32_t nr; /* entry nr in triggers & residencies, including C0 */ + uint32_t last; /* last Cx state */ + uint64_aligned_t idle_time; /* idle time from boot */ + XEN_GUEST_HANDLE_64(uint64) triggers; /* Cx trigger counts */ + XEN_GUEST_HANDLE_64(uint64) residencies; /* Cx residencies */ +}; + struct xen_sysctl_get_pmstat { -#define PMSTAT_get_max_px 0x11 -#define PMSTAT_get_pxstat 0x12 -#define PMSTAT_reset_pxstat 0x13 +#define PMSTAT_CATEGORY_MASK 0xf0 +#define PMSTAT_PX 0x10 +#define PMSTAT_CX 0x20 +#define PMSTAT_get_max_px (PMSTAT_PX | 0x1) +#define PMSTAT_get_pxstat (PMSTAT_PX | 0x2) +#define PMSTAT_reset_pxstat (PMSTAT_PX | 0x3) +#define PMSTAT_get_max_cx (PMSTAT_CX | 0x1) +#define PMSTAT_get_cxstat (PMSTAT_CX | 0x2) +#define PMSTAT_reset_cxstat (PMSTAT_CX | 0x3) uint32_t type; uint32_t cpuid; union { struct pm_px_stat getpx; - /* other struct for cx, tx, etc */ + struct pm_cx_stat getcx; + /* other struct for tx, etc */ } u; }; typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t); - + struct xen_sysctl { uint32_t cmd; uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:37 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:37 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq7J-0002S6-7u for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:37 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7x-0005wn-Qb; Wed, 21 May 2008 15:21:17 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7e-0005fw-3E for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7V-0004LP-S8 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:56 +0000 X-SBRS: 3.6 X-MesageID: 276808 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276808" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:19:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFJxcL032214 for ; Wed, 21 May 2008 08:19:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFKH7U017014 for ; Wed, 21 May 2008 08:20:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFKHaf017013 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:17 -0700 Message-Id: <200805211520.m4LFKHaf017013@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] hvmloader: Lay out memory a bit differently - X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211365383 -3600 # Node ID 36d9c5943b466c1e02386366bab3f1996efca9cb # Parent b58e95aee14f0190a95b2ae610c24c8fe09e8c7a hvmloader: Lay out memory a bit differently - * Cleanly define a scratch area for temporary storage * Raise Etherboot ROM out of the way of larger VGA BIOSes Also detect virtual VGA adaptors more cleanly. Signed-off-by: Jean Guyader Signed-off-by: Keir Fraser --- tools/firmware/hvmloader/config.h | 3 ++- tools/firmware/hvmloader/hvmloader.c | 29 +++++++++++++++++------------ tools/firmware/hvmloader/smbios.c | 7 ++++--- 3 files changed, 23 insertions(+), 16 deletions(-) diff -r b58e95aee14f -r 36d9c5943b46 tools/firmware/hvmloader/config.h --- a/tools/firmware/hvmloader/config.h Wed May 21 11:19:41 2008 +0100 +++ b/tools/firmware/hvmloader/config.h Wed May 21 11:23:03 2008 +0100 @@ -23,11 +23,12 @@ /* Memory map. */ #define HYPERCALL_PHYSICAL_ADDRESS 0x00080000 #define VGABIOS_PHYSICAL_ADDRESS 0x000C0000 -#define ETHERBOOT_PHYSICAL_ADDRESS 0x000C8000 +#define ETHERBOOT_PHYSICAL_ADDRESS 0x000D0000 #define EXTBOOT_PHYSICAL_ADDRESS 0x000DF800 #define SMBIOS_PHYSICAL_ADDRESS 0x000E9000 #define SMBIOS_MAXIMUM_SIZE 0x00001000 #define ACPI_PHYSICAL_ADDRESS 0x000EA000 #define ROMBIOS_PHYSICAL_ADDRESS 0x000F0000 +#define SCRATCH_PHYSICAL_ADDRESS 0x00010000 #endif /* __HVMLOADER_CONFIG_H__ */ diff -r b58e95aee14f -r 36d9c5943b46 tools/firmware/hvmloader/hvmloader.c --- a/tools/firmware/hvmloader/hvmloader.c Wed May 21 11:19:41 2008 +0100 +++ b/tools/firmware/hvmloader/hvmloader.c Wed May 21 11:23:03 2008 +0100 @@ -103,12 +103,7 @@ void create_mp_tables(void); void create_mp_tables(void); int hvm_write_smbios_tables(void); -static int -cirrus_check(void) -{ - outw(0x3C4, 0x9206); - return inb(0x3C5) == 0x12; -} +static enum { VGA_none, VGA_std, VGA_cirrus } virtual_vga = VGA_none; static void init_hypercalls(void) @@ -165,7 +160,7 @@ static void pci_setup(void) /* Create a list of device BARs in descending order of size. */ struct bars { uint32_t devfn, bar_reg, bar_sz; - } *bars = (struct bars *)0xc0000; + } *bars = (struct bars *)SCRATCH_PHYSICAL_ADDRESS; unsigned int i, nr_bars = 0; /* Program PCI-ISA bridge with appropriate link routes. */ @@ -196,6 +191,12 @@ static void pci_setup(void) switch ( class ) { + case 0x0300: + if ( (vendor_id == 0x1234) && (device_id == 0x1111) ) + virtual_vga = VGA_std; + if ( (vendor_id == 0x1013) && (device_id == 0xb8) ) + virtual_vga = VGA_cirrus; + break; case 0x0680: ASSERT((vendor_id == 0x8086) && (device_id == 0x7113)); /* @@ -464,19 +465,23 @@ int main(void) if ( (get_vcpu_nr() > 1) || get_apic_mode() ) create_mp_tables(); - if ( cirrus_check() ) - { + switch ( virtual_vga ) + { + case VGA_cirrus: printf("Loading Cirrus VGABIOS ...\n"); memcpy((void *)VGABIOS_PHYSICAL_ADDRESS, vgabios_cirrusvga, sizeof(vgabios_cirrusvga)); vgabios_sz = sizeof(vgabios_cirrusvga); - } - else - { + break; + case VGA_std: printf("Loading Standard VGABIOS ...\n"); memcpy((void *)VGABIOS_PHYSICAL_ADDRESS, vgabios_stdvga, sizeof(vgabios_stdvga)); vgabios_sz = sizeof(vgabios_stdvga); + break; + default: + printf("No emulated VGA adaptor ...\n"); + break; } etherboot_sz = scan_etherboot_nic((void*)ETHERBOOT_PHYSICAL_ADDRESS); diff -r b58e95aee14f -r 36d9c5943b46 tools/firmware/hvmloader/smbios.c --- a/tools/firmware/hvmloader/smbios.c Wed May 21 11:19:41 2008 +0100 +++ b/tools/firmware/hvmloader/smbios.c Wed May 21 11:23:03 2008 +0100 @@ -217,15 +217,16 @@ hvm_write_smbios_tables(void) xen_version_str[sizeof(xen_version_str)-1] = '\0'; - /* NB. 0xC0000 is a safe large memory area for scratch. */ - len = write_smbios_tables((void *)0xC0000, + /* SCRATCH_PHYSICAL_ADDRESS is a safe large memory area for scratch. */ + len = write_smbios_tables((void *)SCRATCH_PHYSICAL_ADDRESS, get_vcpu_nr(), get_memsize(), uuid, xen_version_str, xen_major_version, xen_minor_version); if ( len > SMBIOS_MAXIMUM_SIZE ) goto error_out; /* Okay, not too large: copy out of scratch to final location. */ - memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len); + memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, + (void *)SCRATCH_PHYSICAL_ADDRESS, len); return len; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 08:20:43 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 08:20:43 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1Jyq7P-0002SA-3p for www-data@colo.xensource.com; Wed, 21 May 2008 08:20:43 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq83-00060x-P7; Wed, 21 May 2008 15:21:23 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1Jyq7g-0005hv-QH for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:21:00 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1Jyq7Z-0004LT-Df for xen-changelog@lists.xensource.com; Wed, 21 May 2008 15:20:58 +0000 X-SBRS: 3.6 X-MesageID: 276810 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,521,1204520400"; d="scan'208";a="276810" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 11:20:03 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFK2Ac032220 for ; Wed, 21 May 2008 08:20:02 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LFKKhG017096 for ; Wed, 21 May 2008 08:20:21 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LFKKmK017095 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 08:20:20 -0700 Message-Id: <200805211520.m4LFKKmK017095@xenbits.xensource.com> Date: Wed, 21 May 2008 08:20:19 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] Add support for SB700 storage controllers. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211364660 -3600 # Node ID 1e8c3287b395f53d91c5e1951325563b5942d2c0 # Parent 8792274adfd0cab0311f3df6183743de3faa3c51 Add support for SB700 storage controllers. Signed-off-by: Travis Betak --- drivers/ide/pci/atiixp.c | 1 + drivers/pci/quirks.c | 19 +++++++++++++++++++ drivers/scsi/ahci.c | 23 +++++++++++++++++++++++ include/linux/libata.h | 6 ++++++ include/linux/pci_ids.h | 4 ++++ 5 files changed, 53 insertions(+) diff -r 8792274adfd0 -r 1e8c3287b395 drivers/ide/pci/atiixp.c --- a/drivers/ide/pci/atiixp.c Wed May 21 11:00:28 2008 +0100 +++ b/drivers/ide/pci/atiixp.c Wed May 21 11:11:00 2008 +0100 @@ -348,6 +348,7 @@ static struct pci_device_id atiixp_pci_t { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); diff -r 8792274adfd0 -r 1e8c3287b395 drivers/pci/quirks.c --- a/drivers/pci/quirks.c Wed May 21 11:00:28 2008 +0100 +++ b/drivers/pci/quirks.c Wed May 21 11:11:00 2008 +0100 @@ -873,6 +873,25 @@ static void __init quirk_disable_pxb(str } DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb ); +static void __devinit quirk_sb600_sata(struct pci_dev *pdev) +{ + /* set sb600/sb700/sb800 sata to ahci mode */ + u8 tmp; + + pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp); + if (tmp == 0x01) { + pci_read_config_byte(pdev, 0x40, &tmp); + pci_write_config_byte(pdev, 0x40, tmp|1); + pci_write_config_byte(pdev, 0x9, 1); + pci_write_config_byte(pdev, 0xa, 6); + pci_write_config_byte(pdev, 0x40, tmp); + + pdev->class = PCI_CLASS_STORAGE_SATA_AHCI; + dev_info(&pdev->dev, "set SATA to AHCI mode\n"); + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_sb600_sata); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_sb600_sata); /* * Serverworks CSB5 IDE does not fully support native mode diff -r 8792274adfd0 -r 1e8c3287b395 drivers/scsi/ahci.c --- a/drivers/scsi/ahci.c Wed May 21 11:00:28 2008 +0100 +++ b/drivers/scsi/ahci.c Wed May 21 11:11:00 2008 +0100 @@ -78,6 +78,7 @@ enum { board_ahci = 0, board_ahci_vt8251 = 1, + board_ahci_sb700 = 2, /* global controller registers */ HOST_CAP = 0x00, /* host capabilities */ @@ -282,6 +283,16 @@ static const struct ata_port_info ahci_p .pio_mask = 0x1f, /* pio0-4 */ .udma_mask = 0x7f, /* udma0-6 ; FIXME */ .port_ops = &ahci_ops, + }, + { + .sht = &ahci_sht, + .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | + ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | + ATA_FLAG_ACPI_SATA | ATA_FLAG_AN | + ATA_FLAG_IPM, + .pio_mask = 0x1f, /* pio0-4 */ + .udma_mask = 0x7f, + .port_ops = &ahci_ops, }, }; @@ -363,6 +374,18 @@ static const struct pci_device_id ahci_p board_ahci }, /* ATI SB600 non-raid */ { PCI_VENDOR_ID_ATI, 0x4381, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* ATI SB600 raid */ + { PCI_VENDOR_ID_ATI, 0x4390, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci_sb700 }, + { PCI_VENDOR_ID_ATI, 0x4391, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci_sb700 }, + { PCI_VENDOR_ID_ATI, 0x4392, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci_sb700 }, + { PCI_VENDOR_ID_ATI, 0x4393, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci_sb700 }, + { PCI_VENDOR_ID_ATI, 0x4394, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci_sb700 }, + { PCI_VENDOR_ID_ATI, 0x4395, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + board_ahci_sb700 }, /* VIA */ { PCI_VENDOR_ID_VIA, 0x3349, PCI_ANY_ID, PCI_ANY_ID, 0, 0, diff -r 8792274adfd0 -r 1e8c3287b395 include/linux/libata.h --- a/include/linux/libata.h Wed May 21 11:00:28 2008 +0100 +++ b/include/linux/libata.h Wed May 21 11:11:00 2008 +0100 @@ -162,6 +162,12 @@ enum { ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H * Register FIS clearing BSY */ ATA_FLAG_DEBUGMSG = (1 << 13), + ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ + ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */ + ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ + ATA_FLAG_AN = (1 << 18), /* controller supports AN */ + ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ + ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */ /* The following flag belongs to ap->pflags but is kept in * ap->flags because it's referenced in many LLDs and will be diff -r 8792274adfd0 -r 1e8c3287b395 include/linux/pci_ids.h --- a/include/linux/pci_ids.h Wed May 21 11:00:28 2008 +0100 +++ b/include/linux/pci_ids.h Wed May 21 11:11:00 2008 +0100 @@ -15,6 +15,8 @@ #define PCI_CLASS_STORAGE_FLOPPY 0x0102 #define PCI_CLASS_STORAGE_IPI 0x0103 #define PCI_CLASS_STORAGE_RAID 0x0104 +#define PCI_CLASS_STORAGE_SATA 0x0106 +#define PCI_CLASS_STORAGE_SATA_AHCI 0x010601 #define PCI_CLASS_STORAGE_SAS 0x0107 #define PCI_CLASS_STORAGE_OTHER 0x0180 @@ -363,6 +365,8 @@ #define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380 #define PCI_DEVICE_ID_ATI_IXP600_SRAID 0x4381 #define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c +#define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390 +#define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c #define PCI_VENDOR_ID_VLSI 0x1004 #define PCI_DEVICE_ID_VLSI_82C592 0x0005 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 21 11:50:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 21 May 2008 11:50:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JytO1-0005a2-UC for www-data@colo.xensource.com; Wed, 21 May 2008 11:50:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JytOg-0001hm-CG; Wed, 21 May 2008 18:50:46 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JytOe-0001gx-Kf for xen-changelog@lists.xensource.com; Wed, 21 May 2008 18:50:44 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JytOX-0007eg-Ra for xen-changelog@lists.xensource.com; Wed, 21 May 2008 18:50:42 +0000 X-SBRS: 3.6 X-MesageID: 278901 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,522,1204520400"; d="scan'208";a="278901" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 21 May 2008 14:49:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4LInoJr032425 for ; Wed, 21 May 2008 11:49:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4LIo8Sl028400 for ; Wed, 21 May 2008 11:50:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4LIo8rh028399 for xen-changelog@lists.xensource.com; Wed, 21 May 2008 11:50:08 -0700 Message-Id: <200805211850.m4LIo8rh028399@xenbits.xensource.com> Date: Wed, 21 May 2008 11:50:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] libxc, x86: Fix CPUID inline asm for x86/64. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211385311 -3600 # Node ID e64c3a8c60e17ccdf5290c9479dc7ad32c14ca78 # Parent 36d9c5943b466c1e02386366bab3f1996efca9cb libxc, x86: Fix CPUID inline asm for x86/64. Must save all 64 bits of RBX, not just the EBX sub-part. Based on bug diagnosis and patch by Juergen Keil Signed-off-by: Keir Fraser --- tools/libxc/xc_cpuid_x86.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff -r 36d9c5943b46 -r e64c3a8c60e1 tools/libxc/xc_cpuid_x86.c --- a/tools/libxc/xc_cpuid_x86.c Wed May 21 11:23:03 2008 +0100 +++ b/tools/libxc/xc_cpuid_x86.c Wed May 21 16:55:11 2008 +0100 @@ -105,11 +105,14 @@ static void cpuid(const unsigned int *in static void cpuid(const unsigned int *input, unsigned int *regs) { unsigned int count = (input[1] == XEN_CPUID_INPUT_UNUSED) ? 0 : input[1]; - unsigned int bx_temp; - asm ( "mov %%ebx,%4; cpuid; mov %%ebx,%1; mov %4,%%ebx" - : "=a" (regs[0]), "=r" (regs[1]), - "=c" (regs[2]), "=d" (regs[3]), "=m" (bx_temp) - : "0" (input[0]), "2" (count) ); + asm ( +#ifdef __i386__ + "push %%ebx; cpuid; mov %%ebx,%1; pop %%ebx" +#else + "push %%rbx; cpuid; mov %%ebx,%1; pop %%rbx" +#endif + : "=a" (regs[0]), "=r" (regs[1]), "=c" (regs[2]), "=d" (regs[3]) + : "0" (input[0]), "2" (count) ); } /* Get the manufacturer brand name of the host processor. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 05:40:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 05:40:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzA5c-0006Q6-Tq for www-data@colo.xensource.com; Thu, 22 May 2008 05:40:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzA6H-00014P-T4; Thu, 22 May 2008 12:40:53 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzA6A-0000uz-2X for xen-changelog@lists.xensource.com; Thu, 22 May 2008 12:40:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzA63-000153-4P for xen-changelog@lists.xensource.com; Thu, 22 May 2008 12:40:43 +0000 X-SBRS: 3.6 X-MesageID: 285261 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,524,1204520400"; d="scan'208";a="285261" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 08:39:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MCdpgE002470 for ; Thu, 22 May 2008 05:39:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MCe9XU027809 for ; Thu, 22 May 2008 05:40:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MCe91S027808 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 05:40:09 -0700 Message-Id: <200805221240.m4MCe91S027808@xenbits.xensource.com> Date: Thu, 22 May 2008 05:40:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Remove 32-bit non-PAE code from dom0 builder, and avoid use of X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211449240 -3600 # Node ID 3ed3d0688fa8183e9c8e221a390f90b564516d98 # Parent e64c3a8c60e17ccdf5290c9479dc7ad32c14ca78 x86: Remove 32-bit non-PAE code from dom0 builder, and avoid use of get_page_type() on pagetable pages (pending support for preemptive get_page_type(), as dom0 builder would be an awkward place to deal with preemption). Signed-off-by: Keir Fraser --- xen/arch/x86/domain_build.c | 57 +++----------------------------------------- 1 files changed, 4 insertions(+), 53 deletions(-) diff -r e64c3a8c60e1 -r 3ed3d0688fa8 xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Wed May 21 16:55:11 2008 +0100 +++ b/xen/arch/x86/domain_build.c Thu May 22 10:40:40 2008 +0100 @@ -221,9 +221,7 @@ int __init construct_dom0( #if CONFIG_PAGING_LEVELS >= 4 l4_pgentry_t *l4tab = NULL, *l4start = NULL; #endif -#if CONFIG_PAGING_LEVELS >= 3 l3_pgentry_t *l3tab = NULL, *l3start = NULL; -#endif l2_pgentry_t *l2tab = NULL, *l2start = NULL; l1_pgentry_t *l1tab = NULL, *l1start = NULL; @@ -277,13 +275,6 @@ int __init construct_dom0( compat32 = 0; machine = elf_uval(&elf, elf.ehdr, e_machine); switch (CONFIG_PAGING_LEVELS) { - case 2: /* x86_32 */ - if (parms.pae == PAEKERN_bimodal) - parms.pae = PAEKERN_no; - printk(" Xen kernel: 32-bit, lsb\n"); - if (elf_32bit(&elf) && !parms.pae && machine == EM_386) - compatible = 1; - break; case 3: /* x86_32p */ if (parms.pae == PAEKERN_bimodal) parms.pae = PAEKERN_extended_cr3; @@ -479,7 +470,6 @@ int __init construct_dom0( } /* WARNING: The new domain must have its 'processor' field filled in! */ -#if CONFIG_PAGING_LEVELS == 3 l3start = l3tab = (l3_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE; l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += 4*PAGE_SIZE; memcpy(l2tab, idle_pg_table_l2, 4*PAGE_SIZE); @@ -489,13 +479,6 @@ int __init construct_dom0( l2e_from_paddr((u32)l2tab + i*PAGE_SIZE, __PAGE_HYPERVISOR); } v->arch.guest_table = pagetable_from_paddr((unsigned long)l3start); -#else - l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE; - copy_page(l2tab, idle_pg_table); - l2tab[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] = - l2e_from_paddr((unsigned long)l2start, __PAGE_HYPERVISOR); - v->arch.guest_table = pagetable_from_paddr((unsigned long)l2start); -#endif for ( i = 0; i < PDPT_L2_ENTRIES; i++ ) l2tab[l2_linear_offset(PERDOMAIN_VIRT_START) + i] = @@ -539,16 +522,16 @@ int __init construct_dom0( if ( !get_page_type(page, PGT_writable_page) ) BUG(); -#if CONFIG_PAGING_LEVELS == 3 - switch (count) { + switch ( count ) + { case 0: page->u.inuse.type_info &= ~PGT_type_mask; page->u.inuse.type_info |= PGT_l3_page_table; get_page(page, d); /* an extra ref because of readable mapping */ /* Get another ref to L3 page so that it can be pinned. */ - if ( !get_page_and_type(page, d, PGT_l3_page_table) ) - BUG(); + page->u.inuse.type_info++; + page->count_info++; set_bit(_PGT_pinned, &page->u.inuse.type_info); break; case 1 ... 4: @@ -564,38 +547,6 @@ int __init construct_dom0( get_page(page, d); /* an extra ref because of readable mapping */ break; } -#else - if ( count == 0 ) - { - page->u.inuse.type_info &= ~PGT_type_mask; - page->u.inuse.type_info |= PGT_l2_page_table; - - /* - * No longer writable: decrement the type_count. - * Installed as CR3: increment both the ref_count and type_count. - * Net: just increment the ref_count. - */ - get_page(page, d); /* an extra ref because of readable mapping */ - - /* Get another ref to L2 page so that it can be pinned. */ - if ( !get_page_and_type(page, d, PGT_l2_page_table) ) - BUG(); - set_bit(_PGT_pinned, &page->u.inuse.type_info); - } - else - { - page->u.inuse.type_info &= ~PGT_type_mask; - page->u.inuse.type_info |= PGT_l1_page_table; - - /* - * No longer writable: decrement the type_count. - * This is an L1 page, installed in a validated L2 page: - * increment both the ref_count and type_count. - * Net: just increment the ref_count. - */ - get_page(page, d); /* an extra ref because of readable mapping */ - } -#endif if ( !((unsigned long)++l1tab & (PAGE_SIZE - 1)) ) l1start = l1tab = (l1_pgentry_t *)(u32)l2e_get_paddr(*++l2tab); } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 05:40:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 05:40:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzA5g-0006QG-9u for www-data@colo.xensource.com; Thu, 22 May 2008 05:40:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzA6L-00017b-54; Thu, 22 May 2008 12:40:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzA6B-0000wj-Vv for xen-changelog@lists.xensource.com; Thu, 22 May 2008 12:40:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzA64-000154-Sy for xen-changelog@lists.xensource.com; Thu, 22 May 2008 12:40:45 +0000 X-SBRS: 3.6 X-MesageID: 285262 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,524,1204520400"; d="scan'208";a="285262" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 08:39:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MCdqEq002473 for ; Thu, 22 May 2008 05:39:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MCeAcx027826 for ; Thu, 22 May 2008 05:40:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MCeAjB027825 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 05:40:10 -0700 Message-Id: <200805221240.m4MCeAjB027825@xenbits.xensource.com> Date: Thu, 22 May 2008 05:40:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Change a local label in asm entry stubs to really be local. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211449309 -3600 # Node ID e48453f82d30ded8c7b4f454f7a9d37ea56d3fcb # Parent 3ed3d0688fa8183e9c8e221a390f90b564516d98 x86: Change a local label in asm entry stubs to really be local. This prevents it appearing in crash traces, where it can be a bit confusing. Signed-off-by: Keir Fraser --- xen/arch/x86/x86_32/entry.S | 5 ++--- xen/arch/x86/x86_64/compat/entry.S | 5 ++--- xen/arch/x86/x86_64/entry.S | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff -r 3ed3d0688fa8 -r e48453f82d30 xen/arch/x86/x86_32/entry.S --- a/xen/arch/x86/x86_32/entry.S Thu May 22 10:40:40 2008 +0100 +++ b/xen/arch/x86/x86_32/entry.S Thu May 22 10:41:49 2008 +0100 @@ -197,13 +197,12 @@ 1: sti #define SHADOW_BYTES 24 /* 6 shadow parameters */ #endif cmpb $0,tb_init_done - je tracing_off + je 1f call trace_hypercall /* Now restore all the registers that trace_hypercall clobbered */ movl UREGS_eax+SHADOW_BYTES(%esp),%eax /* Hypercall # */ #undef SHADOW_BYTES -tracing_off: - call *hypercall_table(,%eax,4) +1: call *hypercall_table(,%eax,4) addl $24,%esp # Discard the shadow parameters #ifndef NDEBUG /* Deliberately corrupt real parameter regs used by this hypercall. */ diff -r 3ed3d0688fa8 -r e48453f82d30 xen/arch/x86/x86_64/compat/entry.S --- a/xen/arch/x86/x86_64/compat/entry.S Thu May 22 10:40:40 2008 +0100 +++ b/xen/arch/x86/x86_64/compat/entry.S Thu May 22 10:41:49 2008 +0100 @@ -59,7 +59,7 @@ ENTRY(compat_hypercall) #define SHADOW_BYTES 0 /* No on-stack shadow state */ #endif cmpb $0,tb_init_done(%rip) - je compat_tracing_off + je 1f call trace_hypercall /* Now restore all the registers that trace_hypercall clobbered */ movl UREGS_rax+SHADOW_BYTES(%rsp),%eax /* Hypercall # */ @@ -70,8 +70,7 @@ ENTRY(compat_hypercall) movl UREGS_rdi+SHADOW_BYTES(%rsp),%r8d /* Arg 5 */ movl UREGS_rbp+SHADOW_BYTES(%rsp),%r9d /* Arg 6 */ #undef SHADOW_BYTES -compat_tracing_off: - leaq compat_hypercall_table(%rip),%r10 +1: leaq compat_hypercall_table(%rip),%r10 PERFC_INCR(PERFC_hypercalls, %rax, %rbx) callq *(%r10,%rax,8) #ifndef NDEBUG diff -r 3ed3d0688fa8 -r e48453f82d30 xen/arch/x86/x86_64/entry.S --- a/xen/arch/x86/x86_64/entry.S Thu May 22 10:40:40 2008 +0100 +++ b/xen/arch/x86/x86_64/entry.S Thu May 22 10:41:49 2008 +0100 @@ -163,7 +163,7 @@ ENTRY(syscall_enter) #define SHADOW_BYTES 0 /* No on-stack shadow state */ #endif cmpb $0,tb_init_done(%rip) - je tracing_off + je 1f call trace_hypercall /* Now restore all the registers that trace_hypercall clobbered */ movq UREGS_rax+SHADOW_BYTES(%rsp),%rax /* Hypercall # */ @@ -174,8 +174,7 @@ ENTRY(syscall_enter) movq UREGS_rdi+SHADOW_BYTES(%rsp),%r8 /* Arg 5 */ movq UREGS_rbp+SHADOW_BYTES(%rsp),%r9 /* Arg 6 */ #undef SHADOW_BYTES -tracing_off: - leaq hypercall_table(%rip),%r10 +1: leaq hypercall_table(%rip),%r10 PERFC_INCR(PERFC_hypercalls, %rax, %rbx) callq *(%r10,%rax,8) #ifndef NDEBUG _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 05:40:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 05:40:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzA5j-0006QR-Iv for www-data@colo.xensource.com; Thu, 22 May 2008 05:40:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzA6O-0001BI-Hl; Thu, 22 May 2008 12:41:00 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzA6F-0000ze-9L for xen-changelog@lists.xensource.com; Thu, 22 May 2008 12:40:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzA68-000153-Hm for xen-changelog@lists.xensource.com; Thu, 22 May 2008 12:40:49 +0000 X-SBRS: 3.6 X-MesageID: 285263 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,524,1204520400"; d="scan'208";a="285263" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 08:39:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MCdrqQ002476 for ; Thu, 22 May 2008 05:39:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MCeBmV027889 for ; Thu, 22 May 2008 05:40:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MCeBat027888 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 05:40:11 -0700 Message-Id: <200805221240.m4MCeBat027888@xenbits.xensource.com> Date: Thu, 22 May 2008 05:40:11 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] xen: Do not allow gcc-3.4 to turn loop on a 64-bit variable into X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211385877 -3600 # Node ID 446c39a967fc0904e2d27ca876c671b414fb5917 # Parent 1e8c3287b395f53d91c5e1951325563b5942d2c0 xen: Do not allow gcc-3.4 to turn loop on a 64-bit variable into 64-bit division, which the kernel does not support. Signed-off-by: Guillaume Rousse Signed-off-by: Keir Fraser --- arch/i386/kernel/time-xen.c | 8 ++++++++ 1 files changed, 8 insertions(+) diff -r 1e8c3287b395 -r 446c39a967fc arch/i386/kernel/time-xen.c --- a/arch/i386/kernel/time-xen.c Wed May 21 11:11:00 2008 +0100 +++ b/arch/i386/kernel/time-xen.c Wed May 21 17:04:37 2008 +0100 @@ -137,13 +137,21 @@ static void __clock_was_set(void *unused } static DECLARE_WORK(clock_was_set_work, __clock_was_set, NULL); +/* + * GCC 4.3 can turn loops over an induction variable into division. We do + * not support arbitrary 64-bit division, and so must break the induction. + */ +#define clobber_induction_variable(v) asm ( "" : "+r" (v) ) + static inline void __normalize_time(time_t *sec, s64 *nsec) { while (*nsec >= NSEC_PER_SEC) { + clobber_induction_variable(*nsec); (*nsec) -= NSEC_PER_SEC; (*sec)++; } while (*nsec < 0) { + clobber_induction_variable(*nsec); (*nsec) += NSEC_PER_SEC; (*sec)--; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 08:40:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 08:40:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzCtk-0000aG-WE for www-data@colo.xensource.com; Thu, 22 May 2008 08:40:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzCuP-0004Hb-UK; Thu, 22 May 2008 15:40:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzCuN-0004HE-R2 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 15:40:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzCuD-0003IG-Sy for xen-changelog@lists.xensource.com; Thu, 22 May 2008 15:40:45 +0000 X-SBRS: 3.6 X-MesageID: 287411 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,524,1204520400"; d="scan'208";a="287411" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 11:39:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MFdo41004467 for ; Thu, 22 May 2008 08:39:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MFe8Uc005403 for ; Thu, 22 May 2008 08:40:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MFe8qW005402 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 08:40:08 -0700 Message-Id: <200805221540.m4MFe8qW005402@xenbits.xensource.com> Date: Thu, 22 May 2008 08:40:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] hvmloader: Fix pci_setup() to not skip BAR remapping for virtual VGA devices. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211450642 -3600 # Node ID b259eebb0223e58eb9caf88f80b5aae1f12fc394 # Parent e48453f82d30ded8c7b4f454f7a9d37ea56d3fcb hvmloader: Fix pci_setup() to not skip BAR remapping for virtual VGA devices. Signed-off-by: Keir Fraser --- tools/firmware/hvmloader/hvmloader.c | 74 ++++++++++++++++------------------- 1 files changed, 35 insertions(+), 39 deletions(-) diff -r e48453f82d30 -r b259eebb0223 tools/firmware/hvmloader/hvmloader.c --- a/tools/firmware/hvmloader/hvmloader.c Thu May 22 10:41:49 2008 +0100 +++ b/tools/firmware/hvmloader/hvmloader.c Thu May 22 11:04:02 2008 +0100 @@ -198,11 +198,8 @@ static void pci_setup(void) virtual_vga = VGA_cirrus; break; case 0x0680: + /* PIIX4 ACPI PM. Special device with special PCI config space. */ ASSERT((vendor_id == 0x8086) && (device_id == 0x7113)); - /* - * PIIX4 ACPI PM. Special device with special PCI config space. - * No ordinary BARs. - */ pci_writew(devfn, 0x20, 0x0000); /* No smb bus IO enable */ pci_writew(devfn, 0x22, 0x0000); pci_writew(devfn, 0x3c, 0x0009); /* Hardcoded IRQ9 */ @@ -213,42 +210,41 @@ static void pci_setup(void) ASSERT((vendor_id == 0x8086) && (device_id == 0x7010)); pci_writew(devfn, 0x40, 0x8000); /* enable IDE0 */ pci_writew(devfn, 0x42, 0x8000); /* enable IDE1 */ - /* fall through */ - default: - /* Default memory mappings. */ - for ( bar = 0; bar < 7; bar++ ) - { - bar_reg = PCI_BASE_ADDRESS_0 + 4*bar; - if ( bar == 6 ) - bar_reg = PCI_ROM_ADDRESS; - - bar_data = pci_readl(devfn, bar_reg); - pci_writel(devfn, bar_reg, ~0); - bar_sz = pci_readl(devfn, bar_reg); - pci_writel(devfn, bar_reg, bar_data); - if ( bar_sz == 0 ) - continue; - - bar_sz &= (((bar_data & PCI_BASE_ADDRESS_SPACE) == - PCI_BASE_ADDRESS_SPACE_MEMORY) ? - PCI_BASE_ADDRESS_MEM_MASK : - (PCI_BASE_ADDRESS_IO_MASK & 0xffff)); - bar_sz &= ~(bar_sz - 1); - - for ( i = 0; i < nr_bars; i++ ) - if ( bars[i].bar_sz < bar_sz ) - break; - - if ( i != nr_bars ) - memmove(&bars[i+1], &bars[i], (nr_bars-i) * sizeof(*bars)); - - bars[i].devfn = devfn; - bars[i].bar_reg = bar_reg; - bars[i].bar_sz = bar_sz; - - nr_bars++; - } break; + } + + /* Map the I/O memory and port resources. */ + for ( bar = 0; bar < 7; bar++ ) + { + bar_reg = PCI_BASE_ADDRESS_0 + 4*bar; + if ( bar == 6 ) + bar_reg = PCI_ROM_ADDRESS; + + bar_data = pci_readl(devfn, bar_reg); + pci_writel(devfn, bar_reg, ~0); + bar_sz = pci_readl(devfn, bar_reg); + pci_writel(devfn, bar_reg, bar_data); + if ( bar_sz == 0 ) + continue; + + bar_sz &= (((bar_data & PCI_BASE_ADDRESS_SPACE) == + PCI_BASE_ADDRESS_SPACE_MEMORY) ? + PCI_BASE_ADDRESS_MEM_MASK : + (PCI_BASE_ADDRESS_IO_MASK & 0xffff)); + bar_sz &= ~(bar_sz - 1); + + for ( i = 0; i < nr_bars; i++ ) + if ( bars[i].bar_sz < bar_sz ) + break; + + if ( i != nr_bars ) + memmove(&bars[i+1], &bars[i], (nr_bars-i) * sizeof(*bars)); + + bars[i].devfn = devfn; + bars[i].bar_reg = bar_reg; + bars[i].bar_sz = bar_sz; + + nr_bars++; } /* Map the interrupt. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 11:30:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 11:30:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzFYF-00031S-8y for www-data@colo.xensource.com; Thu, 22 May 2008 11:30:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFYt-00081u-Nf; Thu, 22 May 2008 18:30:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFYr-000816-QK for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:45 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzFYk-0005Hp-H3 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:43 +0000 X-SBRS: 3.6 X-MesageID: 288708 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,525,1204520400"; d="scan'208";a="288708" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 14:29:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MIToVg005088 for ; Thu, 22 May 2008 11:29:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MIU9Cd014520 for ; Thu, 22 May 2008 11:30:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MIU88A014519 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 11:30:08 -0700 Message-Id: <200805221830.m4MIU88A014519@xenbits.xensource.com> Date: Thu, 22 May 2008 11:30:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] shadow: check for gfn_to_mfn returning INVALID_MFN X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211465294 -3600 # Node ID 2195290728d4774eb86bbd73a6bee07f93d9e44a # Parent b259eebb0223e58eb9caf88f80b5aae1f12fc394 shadow: check for gfn_to_mfn returning INVALID_MFN Signed-off-by: Samuel Thibault --- xen/arch/x86/mm/shadow/common.c | 119 ++++++++++++++++++++++------------------ 1 files changed, 67 insertions(+), 52 deletions(-) diff -r b259eebb0223 -r 2195290728d4 xen/arch/x86/mm/shadow/common.c --- a/xen/arch/x86/mm/shadow/common.c Thu May 22 11:04:02 2008 +0100 +++ b/xen/arch/x86/mm/shadow/common.c Thu May 22 15:08:14 2008 +0100 @@ -2799,8 +2799,11 @@ int shadow_track_dirty_vram(struct domai if ( !d->dirty_vram ) { /* Just recount from start. */ - for ( i = begin_pfn; i < end_pfn; i++ ) - flush_tlb |= sh_remove_all_mappings(d->vcpu[0], gfn_to_mfn(d, i, &t)); + for ( i = begin_pfn; i < end_pfn; i++ ) { + mfn_t mfn = gfn_to_mfn(d, i, &t); + if (mfn_x(mfn) != INVALID_MFN) + flush_tlb |= sh_remove_all_mappings(d->vcpu[0], mfn); + } gdprintk(XENLOG_INFO, "tracking VRAM %lx - %lx\n", begin_pfn, end_pfn); @@ -2840,61 +2843,70 @@ int shadow_track_dirty_vram(struct domai /* Iterate over VRAM to track dirty bits. */ for ( i = 0; i < nr; i++ ) { mfn_t mfn = gfn_to_mfn(d, begin_pfn + i, &t); - struct page_info *page = mfn_to_page(mfn); - u32 count_info = page->u.inuse.type_info & PGT_count_mask; + struct page_info *page; + u32 count_info; int dirty = 0; paddr_t sl1ma = d->dirty_vram->sl1ma[i]; - switch (count_info) + if (mfn_x(mfn) == INVALID_MFN) { - case 0: - /* No guest reference, nothing to track. */ - break; - case 1: - /* One guest reference. */ - if ( sl1ma == INVALID_PADDR ) + dirty = 1; + } + else + { + page = mfn_to_page(mfn); + count_info = page->u.inuse.type_info & PGT_count_mask; + switch (count_info) { - /* We don't know which sl1e points to this, too bad. */ + case 0: + /* No guest reference, nothing to track. */ + break; + case 1: + /* One guest reference. */ + if ( sl1ma == INVALID_PADDR ) + { + /* We don't know which sl1e points to this, too bad. */ + dirty = 1; + /* TODO: Heuristics for finding the single mapping of + * this gmfn */ + flush_tlb |= sh_remove_all_mappings(d->vcpu[0], mfn); + } + else + { + /* Hopefully the most common case: only one mapping, + * whose dirty bit we can use. */ + l1_pgentry_t *sl1e; +#ifdef __i386__ + void *sl1p = map_sl1p; + unsigned long sl1mfn = paddr_to_pfn(sl1ma); + + if ( sl1mfn != map_mfn ) { + if ( map_sl1p ) + sh_unmap_domain_page(map_sl1p); + map_sl1p = sl1p = sh_map_domain_page(_mfn(sl1mfn)); + map_mfn = sl1mfn; + } + sl1e = sl1p + (sl1ma & ~PAGE_MASK); +#else + sl1e = maddr_to_virt(sl1ma); +#endif + + if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY ) + { + dirty = 1; + /* Note: this is atomic, so we may clear a + * _PAGE_ACCESSED set by another processor. */ + l1e_remove_flags(*sl1e, _PAGE_DIRTY); + flush_tlb = 1; + } + } + break; + default: + /* More than one guest reference, + * we don't afford tracking that. */ dirty = 1; - /* TODO: Heuristics for finding the single mapping of - * this gmfn */ - flush_tlb |= sh_remove_all_mappings(d->vcpu[0], gfn_to_mfn(d, begin_pfn + i, &t)); + break; } - else - { - /* Hopefully the most common case: only one mapping, - * whose dirty bit we can use. */ - l1_pgentry_t *sl1e; -#ifdef __i386__ - void *sl1p = map_sl1p; - unsigned long sl1mfn = paddr_to_pfn(sl1ma); - - if ( sl1mfn != map_mfn ) { - if ( map_sl1p ) - sh_unmap_domain_page(map_sl1p); - map_sl1p = sl1p = sh_map_domain_page(_mfn(sl1mfn)); - map_mfn = sl1mfn; - } - sl1e = sl1p + (sl1ma & ~PAGE_MASK); -#else - sl1e = maddr_to_virt(sl1ma); -#endif - - if ( l1e_get_flags(*sl1e) & _PAGE_DIRTY ) - { - dirty = 1; - /* Note: this is atomic, so we may clear a - * _PAGE_ACCESSED set by another processor. */ - l1e_remove_flags(*sl1e, _PAGE_DIRTY); - flush_tlb = 1; - } - } - break; - default: - /* More than one guest reference, - * we don't afford tracking that. */ - dirty = 1; - break; } if ( dirty ) @@ -2916,8 +2928,11 @@ int shadow_track_dirty_vram(struct domai { /* was clean for more than two seconds, try to disable guest * write access */ - for ( i = begin_pfn; i < end_pfn; i++ ) - flush_tlb |= sh_remove_write_access(d->vcpu[0], gfn_to_mfn(d, i, &t), 1, 0); + for ( i = begin_pfn; i < end_pfn; i++ ) { + mfn_t mfn = gfn_to_mfn(d, i, &t); + if (mfn_x(mfn) != INVALID_MFN) + flush_tlb |= sh_remove_write_access(d->vcpu[0], mfn, 1, 0); + } d->dirty_vram->last_dirty = -1; } rc = 0; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 11:30:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 11:30:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzFYH-00031U-GY for www-data@colo.xensource.com; Thu, 22 May 2008 11:30:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFYw-00085R-Hg; Thu, 22 May 2008 18:30:50 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFYs-000817-Vo for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzFYm-0005Hq-2s for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:44 +0000 X-SBRS: 3.6 X-MesageID: 288709 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,525,1204520400"; d="scan'208";a="288709" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 14:29:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MITp4U005091 for ; Thu, 22 May 2008 11:29:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MIUAex014537 for ; Thu, 22 May 2008 11:30:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MIUAwB014536 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 11:30:10 -0700 Message-Id: <200805221830.m4MIUAwB014536@xenbits.xensource.com> Date: Thu, 22 May 2008 11:30:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: drop unused shared_vram variable X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211465328 -3600 # Node ID f472d708b9af3a74a5cdaddac009819b11c180ac # Parent 2195290728d4774eb86bbd73a6bee07f93d9e44a ioemu: drop unused shared_vram variable Signed-off-by: Samuel Thibault --- tools/ioemu/hw/cirrus_vga.c | 2 -- tools/ioemu/vl.h | 2 -- 2 files changed, 4 deletions(-) diff -r 2195290728d4 -r f472d708b9af tools/ioemu/hw/cirrus_vga.c --- a/tools/ioemu/hw/cirrus_vga.c Thu May 22 15:08:14 2008 +0100 +++ b/tools/ioemu/hw/cirrus_vga.c Thu May 22 15:08:48 2008 +0100 @@ -281,8 +281,6 @@ typedef struct PCICirrusVGAState { static uint8_t rop_to_index[256]; -void *shared_vram; - /*************************************** * * prototypes. diff -r 2195290728d4 -r f472d708b9af tools/ioemu/vl.h --- a/tools/ioemu/vl.h Thu May 22 15:08:14 2008 +0100 +++ b/tools/ioemu/vl.h Thu May 22 15:08:48 2008 +0100 @@ -153,8 +153,6 @@ int unset_mm_mapping(int xc_handle, uint unsigned int address_bits, unsigned long *extent_start); int set_mm_mapping(int xc_handle, uint32_t domid, unsigned long nr_pages, unsigned int address_bits, unsigned long *extent_start); - -extern void *shared_vram; extern FILE *logfile; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 11:30:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 11:30:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzFYL-00031Z-2q for www-data@colo.xensource.com; Thu, 22 May 2008 11:30:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFZ0-00089K-3w; Thu, 22 May 2008 18:30:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFYv-00081j-DZ for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzFYn-0005Hs-Uf for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:47 +0000 X-SBRS: 3.6 X-MesageID: 288710 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,525,1204520400"; d="scan'208";a="288710" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 14:29:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MITqLF005094 for ; Thu, 22 May 2008 11:29:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MIUBq7014554 for ; Thu, 22 May 2008 11:30:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MIUAop014553 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 11:30:10 -0700 Message-Id: <200805221830.m4MIUAop014553@xenbits.xensource.com> Date: Thu, 22 May 2008 11:30:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] stubdom: support constructors and destructors X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211465348 -3600 # Node ID e7eb66a4c5f7ff55cf7f9a8122a9a22e9e044aac # Parent f472d708b9af3a74a5cdaddac009819b11c180ac stubdom: support constructors and destructors Signed-off-by: Samuel Thibault --- extras/mini-os/arch/ia64/minios-ia64.lds | 17 +++++++++++++++++ extras/mini-os/arch/x86/minios-x86_32.lds | 18 +++++++++++++++++- extras/mini-os/arch/x86/minios-x86_64.lds | 18 +++++++++++++++++- extras/mini-os/main.c | 8 ++++++++ 4 files changed, 59 insertions(+), 2 deletions(-) diff -r f472d708b9af -r e7eb66a4c5f7 extras/mini-os/arch/ia64/minios-ia64.lds --- a/extras/mini-os/arch/ia64/minios-ia64.lds Thu May 22 15:08:48 2008 +0100 +++ b/extras/mini-os/arch/ia64/minios-ia64.lds Thu May 22 15:09:08 2008 +0100 @@ -52,6 +52,23 @@ SECTIONS .fini_array : { *(.fini_array) } PROVIDE (__fini_array_end = .); + .ctors : { + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) + *(SORT_BY_NAME(.ctors)) + SORT_BY_NAME(CONSTRUCTORS) + LONG(0) + __CTOR_END__ = .; + } + + .dtors : { + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 8 - 2) + *(SORT_BY_NAME(.dtors)) + LONG(0) + __DTOR_END__ = .; + } + .IA_64.unwind_info : AT(ADDR(.IA_64.unwind_info) - (((5<<(61))+0x100000000) - (1 << 20))) { *(.IA_64.unwind_info) } diff -r f472d708b9af -r e7eb66a4c5f7 extras/mini-os/arch/x86/minios-x86_32.lds --- a/extras/mini-os/arch/x86/minios-x86_32.lds Thu May 22 15:08:48 2008 +0100 +++ b/extras/mini-os/arch/x86/minios-x86_32.lds Thu May 22 15:09:08 2008 +0100 @@ -28,9 +28,25 @@ SECTIONS .fini_array : { *(.fini_array) } PROVIDE (__fini_array_end = .); + .ctors : { + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(SORT_BY_NAME(.ctors)) + SORT_BY_NAME(CONSTRUCTORS) + LONG(0) + __CTOR_END__ = .; + } + + .dtors : { + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(SORT_BY_NAME(.dtors)) + LONG(0) + __DTOR_END__ = .; + } + .data : { /* Data */ *(.data) - CONSTRUCTORS } _edata = .; /* End of data section */ diff -r f472d708b9af -r e7eb66a4c5f7 extras/mini-os/arch/x86/minios-x86_64.lds --- a/extras/mini-os/arch/x86/minios-x86_64.lds Thu May 22 15:08:48 2008 +0100 +++ b/extras/mini-os/arch/x86/minios-x86_64.lds Thu May 22 15:09:08 2008 +0100 @@ -28,9 +28,25 @@ SECTIONS .fini_array : { *(.fini_array) } PROVIDE (__fini_array_end = .); + .ctors : { + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) + *(SORT_BY_NAME(.ctors)) + SORT_BY_NAME(CONSTRUCTORS) + LONG(0) + __CTOR_END__ = .; + } + + .dtors : { + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 8 - 2) + *(SORT_BY_NAME(.dtors)) + LONG(0) + __DTOR_END__ = .; + } + .data : { /* Data */ *(.data) - CONSTRUCTORS } _edata = .; /* End of data section */ diff -r f472d708b9af -r e7eb66a4c5f7 extras/mini-os/main.c --- a/extras/mini-os/main.c Thu May 22 15:08:48 2008 +0100 +++ b/extras/mini-os/main.c Thu May 22 15:09:08 2008 +0100 @@ -19,6 +19,8 @@ extern int main(int argc, char *argv[], extern int main(int argc, char *argv[], char *envp[]); extern void __libc_init_array(void); extern void __libc_fini_array(void); +extern unsigned long __CTOR_LIST__[]; +extern unsigned long __DTOR_LIST__[]; struct thread *main_thread; @@ -147,6 +149,8 @@ static void call_main(void *p) __libc_init_array(); environ = envp; + for (i = 1; i <= __CTOR_LIST__[0]; i++) + ((void((*)(void)))__CTOR_LIST__[i]) (); tzset(); exit(main(argc, argv, envp)); @@ -154,6 +158,10 @@ static void call_main(void *p) void _exit(int ret) { + int i; + + for (i = 1; i <= __DTOR_LIST__[0]; i++) + ((void((*)(void)))__DTOR_LIST__[i]) (); close_all_files(); __libc_fini_array(); printk("main returned %d\n", ret); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 11:30:16 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 11:30:16 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzFYO-00031b-1y for www-data@colo.xensource.com; Thu, 22 May 2008 11:30:16 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFZ3-0008Ch-0a; Thu, 22 May 2008 18:30:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFYx-00083y-2l for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzFYq-0005Hp-99 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:48 +0000 X-SBRS: 3.6 X-MesageID: 288711 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,525,1204520400"; d="scan'208";a="288711" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 14:29:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MITrhC005097 for ; Thu, 22 May 2008 11:29:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MIUCdZ014571 for ; Thu, 22 May 2008 11:30:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MIUB2f014570 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 11:30:11 -0700 Message-Id: <200805221830.m4MIUB2f014570@xenbits.xensource.com> Date: Thu, 22 May 2008 11:30:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] libxc: drop double un?lock_pages definition to fix static linking X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211465389 -3600 # Node ID 7325ea8445cba1f9e8cd5641538d4e633a5e9459 # Parent e7eb66a4c5f7ff55cf7f9a8122a9a22e9e044aac libxc: drop double un?lock_pages definition to fix static linking Signed-off-by: Samuel Thibault --- tools/libxc/xg_private.c | 16 ---------------- 1 files changed, 16 deletions(-) diff -r e7eb66a4c5f7 -r 7325ea8445cb tools/libxc/xg_private.c --- a/tools/libxc/xg_private.c Thu May 22 15:09:08 2008 +0100 +++ b/tools/libxc/xg_private.c Thu May 22 15:09:49 2008 +0100 @@ -11,22 +11,6 @@ #include #include "xg_private.h" - -int lock_pages(void *addr, size_t len) -{ - int e = 0; -#ifndef __sun__ - e = mlock(addr, len); -#endif - return (e); -} - -void unlock_pages(void *addr, size_t len) -{ -#ifndef __sun__ - safe_munlock(addr, len); -#endif -} char *xc_read_image(const char *filename, unsigned long *size) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Thu May 22 11:30:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Thu, 22 May 2008 11:30:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzFYR-00031g-BV for www-data@colo.xensource.com; Thu, 22 May 2008 11:30:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFZ6-0008Fy-C3; Thu, 22 May 2008 18:31:00 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzFYx-00084o-Rv for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzFYr-0005Hq-Ex for xen-changelog@lists.xensource.com; Thu, 22 May 2008 18:30:49 +0000 X-SBRS: 3.6 X-MesageID: 288712 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,525,1204520400"; d="scan'208";a="288712" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 22 May 2008 14:29:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4MITsjW005100 for ; Thu, 22 May 2008 11:29:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4MIUCtc014588 for ; Thu, 22 May 2008 11:30:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4MIUCv2014587 for xen-changelog@lists.xensource.com; Thu, 22 May 2008 11:30:12 -0700 Message-Id: <200805221830.m4MIUCv2014587@xenbits.xensource.com> Date: Thu, 22 May 2008 11:30:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: fix automatic vcpu NUMA placement X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211465466 -3600 # Node ID 2e6a51378451a225b20acee90bcd171996251fb4 # Parent 7325ea8445cba1f9e8cd5641538d4e633a5e9459 xend: fix automatic vcpu NUMA placement The automatic NUMA placement code (find_relaxed_node) in XendDomainInfo.py contains several bugs: 1. The domain just created shall not be considered in the load calculation. 2. Nodes with too less memory for the domain must be considered during the load calculation phase and abandoned later, currently these nodes win with a load of 0. 3. CPUs which are offline shall not be considered in load calculation. 4. (Integer-)Dividing the load value by the number of cores per node may conceal subtle load differences resulting in a non-optimal node to be chosen. Signed-off-by: Andre Przywara --- tools/python/xen/xend/XendDomainInfo.py | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff -r 7325ea8445cb -r 2e6a51378451 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Thu May 22 15:09:49 2008 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu May 22 15:11:06 2008 +0100 @@ -2091,28 +2091,28 @@ class XendDomainInfo: xc.vcpu_setaffinity(self.domid, v, self.info['cpus'][v]) else: def find_relaxed_node(node_list): - import sys + import sys + nr_nodes = info['nr_nodes'] if node_list is None: - node_list = range(0, info['nr_nodes']) + node_list = range(0, nr_nodes) nodeload = [0] - nodeload = nodeload * info['nr_nodes'] + nodeload = nodeload * nr_nodes from xen.xend import XendDomain doms = XendDomain.instance().list('all') - for dom in doms: + for dom in filter (lambda d: d.domid != self.domid, doms): cpuinfo = dom.getVCPUInfo() for vcpu in sxp.children(cpuinfo, 'vcpu'): - def vinfo(n, t): - return t(sxp.child_value(vcpu, n)) - cpumap = vinfo('cpumap', list) - for i in node_list: + if sxp.child_value(vcpu, 'online') == 0: continue + cpumap = list(sxp.child_value(vcpu,'cpumap')) + for i in range(0, nr_nodes): node_cpumask = info['node_to_cpu'][i] for j in node_cpumask: if j in cpumap: nodeload[i] += 1 break - for i in node_list: - if len(info['node_to_cpu'][i]) > 0: - nodeload[i] = int(nodeload[i] / len(info['node_to_cpu'][i])) + for i in range(0, nr_nodes): + if len(info['node_to_cpu'][i]) > 0 and i in node_list: + nodeload[i] = int(nodeload[i] * 16 / len(info['node_to_cpu'][i])) else: nodeload[i] = sys.maxint index = nodeload.index( min(nodeload) ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 04:00:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 04:00:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzV0P-00007C-93 for www-data@colo.xensource.com; Fri, 23 May 2008 04:00:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzV14-0001W3-II; Fri, 23 May 2008 11:00:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzV0w-0001N1-Jy for xen-changelog@lists.xensource.com; Fri, 23 May 2008 11:00:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzV0o-0008U9-90 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 11:00:44 +0000 X-SBRS: 3.6 X-MesageID: 294816 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,529,1204520400"; d="scan'208";a="294816" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 06:59:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NAxouA006222 for ; Fri, 23 May 2008 03:59:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NB08S9003107 for ; Fri, 23 May 2008 04:00:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NB08l4003106 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 04:00:08 -0700 Message-Id: <200805231100.m4NB08l4003106@xenbits.xensource.com> Date: Fri, 23 May 2008 04:00:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] stubdom: complete libxc support X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211531723 -3600 # Node ID 90c37c32182ce8e1b8362000fac3c61ec68c2c2e # Parent 2e6a51378451a225b20acee90bcd171996251fb4 stubdom: complete libxc support Signed-off-by: Samuel Thibault --- extras/mini-os/Config.mk | 5 -- extras/mini-os/Makefile | 2 - extras/mini-os/arch/ia64/mm.c | 8 ++++ extras/mini-os/include/lib.h | 1 extras/mini-os/include/mm.h | 3 + extras/mini-os/include/x86/arch_mm.h | 5 -- extras/mini-os/lib/sys.c | 67 ++++++++++++----------------------- tools/libxc/Makefile | 8 ---- tools/libxc/xc_core.c | 18 ++++----- tools/libxc/xc_minios.c | 17 +++++++- xen/common/libelf/libelf-private.h | 2 - 11 files changed, 62 insertions(+), 74 deletions(-) diff -r 2e6a51378451 -r 90c37c32182c extras/mini-os/Config.mk --- a/extras/mini-os/Config.mk Thu May 22 15:11:06 2008 +0100 +++ b/extras/mini-os/Config.mk Fri May 23 09:35:23 2008 +0100 @@ -41,10 +41,7 @@ extra_incl := $(foreach dir,$(EXTRA_INC) extra_incl := $(foreach dir,$(EXTRA_INC),-I$(MINI-OS_ROOT)/include/$(dir)) DEF_CPPFLAGS += -I$(MINI-OS_ROOT)/include - -ifeq ($(stubdom),y) -DEF_CPPFLAGS += -DCONFIG_STUBDOM -endif +DEF_CPPFLAGS += -D__MINIOS__ ifeq ($(libc),y) DEF_CPPFLAGS += -DHAVE_LIBC diff -r 2e6a51378451 -r 90c37c32182c extras/mini-os/Makefile --- a/extras/mini-os/Makefile Thu May 22 15:11:06 2008 +0100 +++ b/extras/mini-os/Makefile Fri May 23 09:35:23 2008 +0100 @@ -96,7 +96,7 @@ endif endif ifeq ($(libc),y) -LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -lxenctrl -lxenguest +APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -whole-archive -lxenguest -lxenctrl -no-whole-archive APP_LDLIBS += -lpci APP_LDLIBS += -lz LDLIBS += -lc diff -r 2e6a51378451 -r 90c37c32182c extras/mini-os/arch/ia64/mm.c --- a/extras/mini-os/arch/ia64/mm.c Thu May 22 15:11:06 2008 +0100 +++ b/extras/mini-os/arch/ia64/mm.c Fri May 23 09:35:23 2008 +0100 @@ -131,6 +131,14 @@ arch_init_demand_mapping_area(unsigned l } /* Helper function used in gnttab.c. */ +void do_map_frames(unsigned long addr, + unsigned long *f, unsigned long n, unsigned long stride, + unsigned long increment, domid_t id, int may_fail, unsigned long prot) +{ + /* TODO */ + ASSERT(0); +} + void* map_frames_ex(unsigned long* frames, unsigned long n, unsigned long stride, unsigned long increment, unsigned long alignment, domid_t id, diff -r 2e6a51378451 -r 90c37c32182c extras/mini-os/include/lib.h --- a/extras/mini-os/include/lib.h Thu May 22 15:11:06 2008 +0100 +++ b/extras/mini-os/include/lib.h Fri May 23 09:35:23 2008 +0100 @@ -136,6 +136,7 @@ enum fd_type { FTYPE_CONSOLE, FTYPE_FILE, FTYPE_XENBUS, + FTYPE_XC, FTYPE_EVTCHN, FTYPE_SOCKET, FTYPE_TAP, diff -r 2e6a51378451 -r 90c37c32182c extras/mini-os/include/mm.h --- a/extras/mini-os/include/mm.h Thu May 22 15:11:06 2008 +0100 +++ b/extras/mini-os/include/mm.h Fri May 23 09:35:23 2008 +0100 @@ -67,6 +67,9 @@ void *map_frames_ex(unsigned long *f, un void *map_frames_ex(unsigned long *f, unsigned long n, unsigned long stride, unsigned long increment, unsigned long alignment, domid_t id, int may_fail, unsigned long prot); +void do_map_frames(unsigned long addr, + unsigned long *f, unsigned long n, unsigned long stride, + unsigned long increment, domid_t id, int may_fail, unsigned long prot); #ifdef HAVE_LIBC extern unsigned long heap, brk, heap_mapped, heap_end; #endif diff -r 2e6a51378451 -r 90c37c32182c extras/mini-os/include/x86/arch_mm.h --- a/extras/mini-os/include/x86/arch_mm.h Thu May 22 15:11:06 2008 +0100 +++ b/extras/mini-os/include/x86/arch_mm.h Fri May 23 09:35:23 2008 +0100 @@ -219,11 +219,6 @@ static __inline__ paddr_t machine_to_phy #define map_frames(f, n) map_frames_ex(f, n, 1, 0, 1, DOMID_SELF, 0, L1_PROT) #define map_zero(n, a) map_frames_ex(&mfn_zero, n, 0, 0, a, DOMID_SELF, 0, L1_PROT_RO) -#ifndef __ASSEMBLY__ -void do_map_frames(unsigned long addr, - unsigned long *f, unsigned long n, unsigned long stride, - unsigned long increment, domid_t id, int may_fail, unsigned long prot); -#endif #define do_map_zero(start, n) do_map_frames(start, &mfn_zero, n, 0, 0, DOMID_SELF, 0, L1_PROT_RO) #endif /* _ARCH_MM_H_ */ diff -r 2e6a51378451 -r 90c37c32182c extras/mini-os/lib/sys.c --- a/extras/mini-os/lib/sys.c Thu May 22 15:11:06 2008 +0100 +++ b/extras/mini-os/lib/sys.c Fri May 23 09:35:23 2008 +0100 @@ -81,6 +81,7 @@ #define NOFILE 32 extern int xc_evtchn_close(int fd); +extern int xc_interface_close(int fd); pthread_mutex_t fd_lock = PTHREAD_MUTEX_INITIALIZER; struct file files[NOFILE] = { @@ -259,10 +260,7 @@ int read(int fd, void *buf, size_t nbyte } return ret * sizeof(union xenfb_in_event); } - case FTYPE_NONE: - case FTYPE_XENBUS: - case FTYPE_EVTCHN: - case FTYPE_BLK: + default: break; } printk("read(%d): Bad descriptor\n", fd); @@ -295,12 +293,7 @@ int write(int fd, const void *buf, size_ case FTYPE_TAP: netfront_xmit(files[fd].tap.dev, (void*) buf, nbytes); return nbytes; - case FTYPE_NONE: - case FTYPE_XENBUS: - case FTYPE_EVTCHN: - case FTYPE_BLK: - case FTYPE_KBD: - case FTYPE_FB: + default: break; } printk("write(%d): Bad descriptor\n", fd); @@ -351,15 +344,7 @@ int fsync(int fd) { } return 0; } - case FTYPE_NONE: - case FTYPE_CONSOLE: - case FTYPE_SOCKET: - case FTYPE_XENBUS: - case FTYPE_EVTCHN: - case FTYPE_TAP: - case FTYPE_BLK: - case FTYPE_KBD: - case FTYPE_FB: + default: break; } printk("fsync(%d): Bad descriptor\n", fd); @@ -391,6 +376,9 @@ int close(int fd) files[fd].type = FTYPE_NONE; return res; } + case FTYPE_XC: + xc_interface_close(fd); + return 0; case FTYPE_EVTCHN: xc_evtchn_close(fd); return 0; @@ -495,13 +483,7 @@ int fstat(int fd, struct stat *buf) stat_from_fs(buf, &stat); return 0; } - case FTYPE_NONE: - case FTYPE_XENBUS: - case FTYPE_EVTCHN: - case FTYPE_TAP: - case FTYPE_BLK: - case FTYPE_KBD: - case FTYPE_FB: + default: break; } @@ -522,15 +504,7 @@ int ftruncate(int fd, off_t length) } return 0; } - case FTYPE_NONE: - case FTYPE_CONSOLE: - case FTYPE_SOCKET: - case FTYPE_XENBUS: - case FTYPE_EVTCHN: - case FTYPE_TAP: - case FTYPE_BLK: - case FTYPE_KBD: - case FTYPE_FB: + default: break; } @@ -636,9 +610,10 @@ static const char file_types[] = { [FTYPE_NONE] = 'N', [FTYPE_CONSOLE] = 'C', [FTYPE_FILE] = 'F', - [FTYPE_XENBUS] = 'X', + [FTYPE_XENBUS] = 'S', + [FTYPE_XC] = 'X', [FTYPE_EVTCHN] = 'E', - [FTYPE_SOCKET] = 'S', + [FTYPE_SOCKET] = 's', [FTYPE_TAP] = 'T', [FTYPE_BLK] = 'B', [FTYPE_KBD] = 'K', @@ -722,7 +697,7 @@ static int select_poll(int nfds, fd_set /* Then see others as well. */ for (i = 0; i < nfds; i++) { switch(files[i].type) { - case FTYPE_NONE: + default: if (FD_ISSET(i, readfds) || FD_ISSET(i, writefds) || FD_ISSET(i, exceptfds)) printk("bogus fd %d in select\n", i); /* Fallthrough. */ @@ -1083,14 +1058,20 @@ int clock_gettime(clockid_t clk_id, stru void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { + unsigned long n = (length + PAGE_SIZE - 1) / PAGE_SIZE; + ASSERT(!start); - length = (length + PAGE_SIZE - 1) & PAGE_MASK; ASSERT(prot == (PROT_READ|PROT_WRITE)); - ASSERT(flags == (MAP_SHARED|MAP_ANON) || flags == (MAP_PRIVATE|MAP_ANON)); - ASSERT(fd == -1); + ASSERT((fd == -1 && (flags == (MAP_SHARED|MAP_ANON) || flags == (MAP_PRIVATE|MAP_ANON))) + || (fd != -1 && flags == MAP_SHARED)); ASSERT(offset == 0); - return map_zero(length / PAGE_SIZE, 1); + if (fd == -1) + return map_zero(n, 1); + else if (files[fd].type == FTYPE_XC) { + unsigned long zero = 0; + return map_frames_ex(&zero, n, 0, 0, 1, DOMID_SELF, 0, 0); + } else ASSERT(0); } #if defined(__x86_64__) || defined(__ia64__) __typeof__(mmap) mmap64 __attribute__((__alias__("mmap"))); @@ -1110,7 +1091,7 @@ int munmap(void *start, size_t length) call[i].args[0] = (unsigned long) &data[i]; call[i].args[1] = 0; call[i].args[2] = 0; - call[i].args[3] = UVMF_INVLPG | UVMF_ALL; + call[i].args[3] = UVMF_INVLPG; } ret = HYPERVISOR_multicall(call, n); diff -r 2e6a51378451 -r 90c37c32182c tools/libxc/Makefile --- a/tools/libxc/Makefile Thu May 22 15:11:06 2008 +0100 +++ b/tools/libxc/Makefile Fri May 23 09:35:23 2008 +0100 @@ -5,11 +5,9 @@ MINOR = 0 MINOR = 0 CTRL_SRCS-y := -ifneq ($(stubdom),y) CTRL_SRCS-y += xc_core.c CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c -endif CTRL_SRCS-y += xc_domain.c CTRL_SRCS-y += xc_evtchn.c CTRL_SRCS-y += xc_misc.c @@ -21,9 +19,7 @@ CTRL_SRCS-y += xc_csched.c CTRL_SRCS-y += xc_csched.c CTRL_SRCS-y += xc_tbuf.c CTRL_SRCS-y += xc_pm.c -ifneq ($(stubdom),y) CTRL_SRCS-y += xc_resume.c -endif CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c @@ -33,15 +29,12 @@ CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios. GUEST_SRCS-y := GUEST_SRCS-y += xg_private.c -ifneq ($(stubdom),y) GUEST_SRCS-$(CONFIG_MIGRATE) += xc_domain_restore.c xc_domain_save.c GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c -endif VPATH = ../../xen/common/libelf CFLAGS += -I../../xen/common/libelf -ifneq ($(stubdom),y) GUEST_SRCS-y += libelf-tools.c libelf-loader.c GUEST_SRCS-y += libelf-dominfo.c libelf-relocate.c @@ -55,7 +48,6 @@ GUEST_SRCS-$(CONFIG_X86) += xc_dom_x GUEST_SRCS-$(CONFIG_X86) += xc_dom_x86.c GUEST_SRCS-$(CONFIG_X86) += xc_cpuid_x86.c GUEST_SRCS-$(CONFIG_IA64) += xc_dom_ia64.c -endif -include $(XEN_TARGET_ARCH)/Makefile diff -r 2e6a51378451 -r 90c37c32182c tools/libxc/xc_core.c --- a/tools/libxc/xc_core.c Thu May 22 15:11:06 2008 +0100 +++ b/tools/libxc/xc_core.c Fri May 23 09:35:23 2008 +0100 @@ -64,7 +64,7 @@ /* string table */ struct xc_core_strtab { char *strings; - uint16_t current; + uint16_t length; uint16_t max; }; @@ -89,7 +89,7 @@ xc_core_strtab_init(void) /* index 0 represents none */ strtab->strings[0] = '\0'; - strtab->current = 1; + strtab->length = 1; return strtab; } @@ -107,14 +107,14 @@ xc_core_strtab_get(struct xc_core_strtab uint16_t ret = 0; uint16_t len = strlen(name) + 1; - if ( strtab->current > UINT16_MAX - len ) + if ( strtab->length > UINT16_MAX - len ) { PERROR("too long string table"); errno = E2BIG; return ret; } - if ( strtab->current + len > strtab->max ) + if ( strtab->length + len > strtab->max ) { char *tmp; if ( strtab->max > UINT16_MAX / 2 ) @@ -135,9 +135,9 @@ xc_core_strtab_get(struct xc_core_strtab strtab->max *= 2; } - ret = strtab->current; - strcpy(strtab->strings + strtab->current, name); - strtab->current += len; + ret = strtab->length; + strcpy(strtab->strings + strtab->length, name); + strtab->length += len; return ret; } @@ -669,7 +669,7 @@ xc_domain_dumpcore_via_callback(int xc_h offset += filesz; /* fixing up section header string table section header */ - filesz = strtab->current; + filesz = strtab->length; sheaders->shdrs[strtab_idx].sh_offset = offset; sheaders->shdrs[strtab_idx].sh_size = filesz; @@ -829,7 +829,7 @@ copy_done: goto out; /* elf section header string table: .shstrtab */ - sts = dump_rtn(args, strtab->strings, strtab->current); + sts = dump_rtn(args, strtab->strings, strtab->length); if ( sts != 0 ) goto out; diff -r 2e6a51378451 -r 90c37c32182c tools/libxc/xc_minios.c --- a/tools/libxc/xc_minios.c Thu May 22 15:11:06 2008 +0100 +++ b/tools/libxc/xc_minios.c Fri May 23 09:35:23 2008 +0100 @@ -35,11 +35,12 @@ extern struct wait_queue_head event_queu int xc_interface_open(void) { - return 0; + return alloc_fd(FTYPE_XC); } int xc_interface_close(int xc_handle) { + files[xc_handle].type = FTYPE_NONE; return 0; } @@ -79,8 +80,12 @@ int xc_map_foreign_ranges(int xc_handle, int xc_map_foreign_ranges(int xc_handle, uint32_t dom, privcmd_mmap_entry_t *entries, int nr) { - printf("xc_map_foreign_ranges, TODO\n"); - do_exit(); + int i; + for (i = 0; i < nr; i++) { + unsigned long mfn = entries[i].mfn; + do_map_frames(entries[i].va, &mfn, entries[i].npages, 0, 1, dom, 0, L1_PROT); + } + return 0; } int do_xen_hypercall(int xc_handle, privcmd_hypercall_t *hypercall) @@ -294,6 +299,12 @@ int xc_evtchn_unmask(int xce_handle, evt return 0; } +/* Optionally flush file to disk and discard page cache */ +void discard_file_cache(int fd, int flush) +{ + if (flush) + fsync(fd); +} /* * Local variables: * mode: C diff -r 2e6a51378451 -r 90c37c32182c xen/common/libelf/libelf-private.h --- a/xen/common/libelf/libelf-private.h Thu May 22 15:11:06 2008 +0100 +++ b/xen/common/libelf/libelf-private.h Fri May 23 09:35:23 2008 +0100 @@ -43,7 +43,7 @@ #define bswap_16(x) swap16(x) #define bswap_32(x) swap32(x) #define bswap_64(x) swap64(x) -#elif defined(__linux__) || defined(__Linux__) +#elif defined(__linux__) || defined(__Linux__) || defined(__MINIOS__) #include #else #error Unsupported OS _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 04:00:18 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 04:00:18 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzV0T-00007F-PE for www-data@colo.xensource.com; Fri, 23 May 2008 04:00:18 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzV19-0001aO-3w; Fri, 23 May 2008 11:00:59 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzV0y-0001Om-DY for xen-changelog@lists.xensource.com; Fri, 23 May 2008 11:00:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzV0p-0008UA-GA for xen-changelog@lists.xensource.com; Fri, 23 May 2008 11:00:46 +0000 X-SBRS: 3.6 X-MesageID: 294818 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,529,1204520400"; d="scan'208";a="294818" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 06:59:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NAxokN006225 for ; Fri, 23 May 2008 03:59:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NB09wa003124 for ; Fri, 23 May 2008 04:00:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NB09p5003123 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 04:00:09 -0700 Message-Id: <200805231100.m4NB09p5003123@xenbits.xensource.com> Date: Fri, 23 May 2008 04:00:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] stubdom: fix and clean pthread minimal support X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211531743 -3600 # Node ID f05795acfca9fe2be69622b782bfa5b91abe9725 # Parent 90c37c32182ce8e1b8362000fac3c61ec68c2c2e stubdom: fix and clean pthread minimal support Signed-off-by: Samuel Thibault --- extras/mini-os/include/posix/pthread.h | 52 ++++++++++++++++++++++++++++----- 1 files changed, 45 insertions(+), 7 deletions(-) diff -r 90c37c32182c -r f05795acfca9 extras/mini-os/include/posix/pthread.h --- a/extras/mini-os/include/posix/pthread.h Fri May 23 09:35:23 2008 +0100 +++ b/extras/mini-os/include/posix/pthread.h Fri May 23 09:35:43 2008 +0100 @@ -1,18 +1,56 @@ #ifndef _POSIX_PTHREAD_H #define _POSIX_PTHREAD_H +#include + /* Let's be single-threaded for now. */ -typedef void *pthread_key_t; -typedef struct {} pthread_mutex_t, pthread_once_t; +typedef struct { + void *ptr; +} *pthread_key_t; +static inline int pthread_key_create(pthread_key_t *key, void (*destr_function)(void*)) +{ + *key = malloc(sizeof(**key)); + (*key)->ptr = NULL; + return 0; +} +static inline int pthread_setspecific(pthread_key_t key, const void *pointer) +{ + key->ptr = (void*) pointer; + return 0; +} +static inline void *pthread_getspecific(pthread_key_t key) +{ + return key->ptr; +} +static inline int pthread_key_delete(pthread_key_t key) +{ + free(key); + return 0; +} + + + +typedef struct {} pthread_mutex_t; #define PTHREAD_MUTEX_INITIALIZER {} -#define PTHREAD_ONCE_INIT {} static inline int pthread_mutex_lock(pthread_mutex_t *mutex) { return 0; } static inline int pthread_mutex_unlock(pthread_mutex_t *mutex) { return 0; } -static inline int pthread_key_create(pthread_key_t *key, void (*destr_function)(void*)) { *key = NULL; return 0; } -static inline int pthread_setspecific(pthread_key_t *key, const void *pointer) { *key = (void*) pointer; return 0; } -static inline void *pthread_getspecific(pthread_key_t *key) { return *key; } -static inline int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) { init_routine(); return 0; } + + + +typedef struct { + int done; +} pthread_once_t; +#define PTHREAD_ONCE_INIT { 0 } + +static inline int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) +{ + if (!once_control->done) { + once_control->done = 1; + init_routine(); + } + return 0; +} #define __thread _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 04:00:21 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 04:00:21 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzV0X-00007J-Bd for www-data@colo.xensource.com; Fri, 23 May 2008 04:00:21 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzV1C-0001dr-Q5; Fri, 23 May 2008 11:01:02 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzV11-0001RX-R4 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 11:00:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzV0v-0008U9-34 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 11:00:49 +0000 X-SBRS: 3.6 X-MesageID: 294819 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,529,1204520400"; d="scan'208";a="294819" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 06:59:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NAxpHm006228 for ; Fri, 23 May 2008 03:59:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NB0Ar6003141 for ; Fri, 23 May 2008 04:00:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NB0ABo003140 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 04:00:10 -0700 Message-Id: <200805231100.m4NB0ABo003140@xenbits.xensource.com> Date: Fri, 23 May 2008 04:00:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] stubdom: fix constructors/destructors in 64bit mode X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211531757 -3600 # Node ID fbf09143c2e51b9f662e9d53020fa2487674edc4 # Parent f05795acfca9fe2be69622b782bfa5b91abe9725 stubdom: fix constructors/destructors in 64bit mode Signed-off-by: Samuel Thibault --- extras/mini-os/arch/ia64/minios-ia64.lds | 8 ++++---- extras/mini-os/arch/x86/minios-x86_64.lds | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff -r f05795acfca9 -r fbf09143c2e5 extras/mini-os/arch/ia64/minios-ia64.lds --- a/extras/mini-os/arch/ia64/minios-ia64.lds Fri May 23 09:35:43 2008 +0100 +++ b/extras/mini-os/arch/ia64/minios-ia64.lds Fri May 23 09:35:57 2008 +0100 @@ -54,18 +54,18 @@ SECTIONS .ctors : { __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) + QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) *(SORT_BY_NAME(.ctors)) SORT_BY_NAME(CONSTRUCTORS) - LONG(0) + QUAD(0) __CTOR_END__ = .; } .dtors : { __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 8 - 2) + QUAD((__DTOR_END__ - __DTOR_LIST__) / 8 - 2) *(SORT_BY_NAME(.dtors)) - LONG(0) + QUAD(0) __DTOR_END__ = .; } diff -r f05795acfca9 -r fbf09143c2e5 extras/mini-os/arch/x86/minios-x86_64.lds --- a/extras/mini-os/arch/x86/minios-x86_64.lds Fri May 23 09:35:43 2008 +0100 +++ b/extras/mini-os/arch/x86/minios-x86_64.lds Fri May 23 09:35:57 2008 +0100 @@ -30,18 +30,18 @@ SECTIONS .ctors : { __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) + QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) *(SORT_BY_NAME(.ctors)) SORT_BY_NAME(CONSTRUCTORS) - LONG(0) + QUAD(0) __CTOR_END__ = .; } .dtors : { __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 8 - 2) + QUAD((__DTOR_END__ - __DTOR_LIST__) / 8 - 2) *(SORT_BY_NAME(.dtors)) - LONG(0) + QUAD(0) __DTOR_END__ = .; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 06:50:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 06:50:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzXf4-0002Ps-MA for www-data@colo.xensource.com; Fri, 23 May 2008 06:50:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfk-0004Kl-2M; Fri, 23 May 2008 13:51:04 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfi-0004KK-BZ for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:02 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzXfb-0002Ey-DX for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:00 +0000 X-SBRS: 3.6 X-MesageID: 295920 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,530,1204520400"; d="scan'208";a="295920" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 09:50:07 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDo71K008910 for ; Fri, 23 May 2008 06:50:07 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoPAs013466 for ; Fri, 23 May 2008 06:50:25 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NDoPFq013465 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 06:50:25 -0700 Message-Id: <200805231350.m4NDoPFq013465@xenbits.xensource.com> Date: Fri, 23 May 2008 06:50:24 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] stdvga: handle 64bit io operations X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211537059 -3600 # Node ID 75e018812e6cc1813cb0942521245c578380be53 # Parent 0016f5a1dd5a1622bcc66b82d2ef9bf4d36e88e3 stdvga: handle 64bit io operations Handle 64bit operations in stdvga instead of throwing away the upper 32bits. This fixes some noisy xen messages like "invalid io size: 8". Signed-off-by: Christoph Egger xen-unstable changeset: 17651:3a5750f4a7387cd635328449a03bdc0eb4ae9ce6 xen-unstable date: Mon May 19 09:40:53 2008 +0100 --- xen/arch/x86/hvm/stdvga.c | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff -r 0016f5a1dd5a -r 75e018812e6c xen/arch/x86/hvm/stdvga.c --- a/xen/arch/x86/hvm/stdvga.c Thu May 15 15:11:29 2008 +0100 +++ b/xen/arch/x86/hvm/stdvga.c Fri May 23 11:04:19 2008 +0100 @@ -270,9 +270,9 @@ static uint8_t stdvga_mem_readb(uint64_t return ret; } -static uint32_t stdvga_mem_read(uint32_t addr, uint32_t size) -{ - uint32_t data = 0; +static uint64_t stdvga_mem_read(uint64_t addr, uint64_t size) +{ + uint64_t data = 0; switch ( size ) { @@ -292,8 +292,19 @@ static uint32_t stdvga_mem_read(uint32_t data |= stdvga_mem_readb(addr + 3) << 24; break; + case 8: + data = (uint64_t)(stdvga_mem_readb(addr)); + data |= (uint64_t)(stdvga_mem_readb(addr + 1)) << 8; + data |= (uint64_t)(stdvga_mem_readb(addr + 2)) << 16; + data |= (uint64_t)(stdvga_mem_readb(addr + 3)) << 24; + data |= (uint64_t)(stdvga_mem_readb(addr + 4)) << 32; + data |= (uint64_t)(stdvga_mem_readb(addr + 5)) << 40; + data |= (uint64_t)(stdvga_mem_readb(addr + 6)) << 48; + data |= (uint64_t)(stdvga_mem_readb(addr + 7)) << 56; + break; + default: - gdprintk(XENLOG_WARNING, "invalid io size:%d\n", size); + gdprintk(XENLOG_WARNING, "invalid io size: %"PRId64"\n", size); break; } @@ -408,7 +419,7 @@ static void stdvga_mem_writeb(uint64_t a } } -static void stdvga_mem_write(uint32_t addr, uint32_t data, uint32_t size) +static void stdvga_mem_write(uint64_t addr, uint64_t data, uint64_t size) { /* Intercept mmio write */ switch ( size ) @@ -429,8 +440,19 @@ static void stdvga_mem_write(uint32_t ad stdvga_mem_writeb(addr+3, (data >> 24) & 0xff); break; + case 8: + stdvga_mem_writeb(addr+0, (data >> 0) & 0xff); + stdvga_mem_writeb(addr+1, (data >> 8) & 0xff); + stdvga_mem_writeb(addr+2, (data >> 16) & 0xff); + stdvga_mem_writeb(addr+3, (data >> 24) & 0xff); + stdvga_mem_writeb(addr+4, (data >> 32) & 0xff); + stdvga_mem_writeb(addr+5, (data >> 40) & 0xff); + stdvga_mem_writeb(addr+6, (data >> 48) & 0xff); + stdvga_mem_writeb(addr+7, (data >> 56) & 0xff); + break; + default: - gdprintk(XENLOG_WARNING, "invalid io size:%d\n", size); + gdprintk(XENLOG_WARNING, "invalid io size: %"PRId64"\n", size); break; } } @@ -446,7 +468,7 @@ static int mmio_move(struct hvm_hw_stdvg { if ( p->dir == IOREQ_READ ) { - uint32_t addr = p->addr, data = p->data, tmp; + uint64_t addr = p->addr, data = p->data, tmp; for ( i = 0; i < p->count; i++ ) { tmp = stdvga_mem_read(addr, p->size); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 06:50:25 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 06:50:25 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzXf7-0002Pt-7q for www-data@colo.xensource.com; Fri, 23 May 2008 06:50:25 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfm-0004Ne-Hm; Fri, 23 May 2008 13:51:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfk-0004KN-4q for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:04 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzXfc-0002F3-Vz for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:02 +0000 X-SBRS: 3.6 X-MesageID: 295921 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,530,1204520400"; d="scan'208";a="295921" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 09:50:08 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDo8M1008913 for ; Fri, 23 May 2008 06:50:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoQP7013483 for ; Fri, 23 May 2008 06:50:26 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NDoQA9013482 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 06:50:26 -0700 Message-Id: <200805231350.m4NDoQA9013482@xenbits.xensource.com> Date: Fri, 23 May 2008 06:50:25 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86: Fix kexec reservation X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211537086 -3600 # Node ID e75c00f319290898e4bc9fd70f611cf6f338c8e0 # Parent 75e018812e6cc1813cb0942521245c578380be53 x86: Fix kexec reservation The reservation of space for the kexec area in kexec_reserve_area is incorrect. It specifies the start address and size to reserve_e820_mem when the args should be start and end. Bug found and fixed by Dave Anderson. Signed-off-by: Bill Burns xen-unstable changeset: 17653:e66aefdfedcca8319f7ecf9c8d742ae157c2d690 xen-unstable date: Mon May 19 09:43:42 2008 +0100 --- xen/arch/x86/setup.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 75e018812e6c -r e75c00f31929 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Fri May 23 11:04:19 2008 +0100 +++ b/xen/arch/x86/setup.c Fri May 23 11:04:46 2008 +0100 @@ -359,7 +359,7 @@ void __init kexec_reserve_area(struct e8 is_reserved = 1; - if ( !reserve_e820_ram(e820, kdump_start, kdump_size) ) + if ( !reserve_e820_ram(e820, kdump_start, kdump_start + kdump_size) ) { printk("Kdump: DISABLED (failed to reserve %luMB (%lukB) at 0x%lx)" "\n", kdump_size >> 20, kdump_size >> 10, kdump_start); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 06:50:29 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 06:50:29 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzXfA-0002Py-LH for www-data@colo.xensource.com; Fri, 23 May 2008 06:50:29 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfp-0004RE-V3; Fri, 23 May 2008 13:51:09 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfm-0004La-Jz for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzXfg-0002Ey-Mt for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:04 +0000 X-SBRS: 3.6 X-MesageID: 295923 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,530,1204520400"; d="scan'208";a="295923" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 09:50:10 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoAZs008919 for ; Fri, 23 May 2008 06:50:10 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoSVR013517 for ; Fri, 23 May 2008 06:50:28 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NDoSnm013516 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 06:50:28 -0700 Message-Id: <200805231350.m4NDoSnm013516@xenbits.xensource.com> Date: Fri, 23 May 2008 06:50:27 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] svm: Better handling of NMI injection -- avoid nested NMIs. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211537345 -3600 # Node ID 98e7af9f5a4219d05ba26d2327bcd0db487c7de5 # Parent e03ac7ab7521543019a72aa47514e018d55232ae svm: Better handling of NMI injection -- avoid nested NMIs. We do this by emulating the NMI mask which blocks NMI delivery until next IRET on native hardware. Signed-off-by: Gianluca Guida Signed-off-by: Keir Fraser xen-unstable changeset: 17655:2ada81810ddb73f29dfd1eb00de466eec2881ce6 xen-unstable date: Mon May 19 10:03:26 2008 +0100 --- xen/arch/x86/hvm/svm/intr.c | 6 ++++++ xen/arch/x86/hvm/svm/svm.c | 25 ++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff -r e03ac7ab7521 -r 98e7af9f5a42 xen/arch/x86/hvm/svm/intr.c --- a/xen/arch/x86/hvm/svm/intr.c Fri May 23 11:05:12 2008 +0100 +++ b/xen/arch/x86/hvm/svm/intr.c Fri May 23 11:09:05 2008 +0100 @@ -51,6 +51,12 @@ static void svm_inject_nmi(struct vcpu * ASSERT(vmcb->eventinj.fields.v == 0); vmcb->eventinj = event; + + /* + * SVM does not virtualise the NMI mask, so we emulate it by intercepting + * the next IRET and blocking NMI injection until the intercept triggers. + */ + vmcb->general1_intercepts |= GENERAL1_INTERCEPT_IRET; } static void svm_inject_extint(struct vcpu *v, int vector) diff -r e03ac7ab7521 -r 98e7af9f5a42 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Fri May 23 11:05:12 2008 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Fri May 23 11:09:05 2008 +0100 @@ -438,7 +438,8 @@ static enum hvm_intblk svm_interrupt_blo return hvm_intblk_shadow; if ( intack.source == hvm_intsrc_nmi ) - return hvm_intblk_none; + return ((vmcb->general1_intercepts & GENERAL1_INTERCEPT_IRET) ? + hvm_intblk_nmi_iret : hvm_intblk_none); ASSERT((intack.source == hvm_intsrc_pic) || (intack.source == hvm_intsrc_lapic)); @@ -2112,6 +2113,15 @@ asmlinkage void svm_vmexit_handler(struc reason = TSW_call_or_int; if ( (vmcb->exitinfo2 >> 44) & 1 ) errcode = (uint32_t)vmcb->exitinfo2; + + /* + * Some processors set the EXITINTINFO field when the task switch + * is caused by a task gate in the IDT. In this case we will be + * emulating the event injection, so we do not want the processor + * to re-inject the original event! + */ + vmcb->eventinj.bytes = 0; + hvm_task_switch((uint16_t)vmcb->exitinfo1, reason, errcode); break; } @@ -2191,6 +2201,19 @@ asmlinkage void svm_vmexit_handler(struc svm_do_nested_pgfault(vmcb->exitinfo2, regs); break; + case VMEXIT_IRET: + /* + * IRET clears the NMI mask. However because we clear the mask + * /before/ executing IRET, we set the interrupt shadow to prevent + * a pending NMI from being injected immediately. This will work + * perfectly unless the IRET instruction faults: in that case we + * may inject an NMI before the NMI handler's IRET instruction is + * retired. + */ + vmcb->general1_intercepts &= ~GENERAL1_INTERCEPT_IRET; + vmcb->interrupt_shadow = 1; + break; + default: exit_and_crash: gdprintk(XENLOG_ERR, "unexpected VMEXIT: exit reason = 0x%x, " _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 06:50:33 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 06:50:33 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzXfE-0002Q1-Tf for www-data@colo.xensource.com; Fri, 23 May 2008 06:50:33 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXft-0004Us-RQ; Fri, 23 May 2008 13:51:13 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfn-0004N4-Pd for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:07 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzXfe-0002F9-PW for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:05 +0000 X-SBRS: 3.6 X-MesageID: 295922 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,530,1204520400"; d="scan'208";a="295922" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 09:50:09 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDo9tb008916 for ; Fri, 23 May 2008 06:50:09 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoR0X013500 for ; Fri, 23 May 2008 06:50:27 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NDoRJ1013499 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 06:50:27 -0700 Message-Id: <200805231350.m4NDoRJ1013499@xenbits.xensource.com> Date: Fri, 23 May 2008 06:50:26 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] Fix showing of CPU Affinity by xm vcpu-list X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211537112 -3600 # Node ID e03ac7ab7521543019a72aa47514e018d55232ae # Parent e75c00f319290898e4bc9fd70f611cf6f338c8e0 Fix showing of CPU Affinity by xm vcpu-list Signed-off-by: Masaki Kanno xen-unstable changeset: 17654:8dce20be0bd5a4d3abaebb84b3c749e8d69bfb48 xen-unstable date: Mon May 19 09:46:02 2008 +0100 --- tools/python/xen/xm/main.py | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r e75c00f31929 -r e03ac7ab7521 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Fri May 23 11:04:46 2008 +0100 +++ b/tools/python/xen/xm/main.py Fri May 23 11:05:12 2008 +0100 @@ -1082,7 +1082,7 @@ def xm_vcpu_list(args): # normalize cpumap by modulus nr_cpus, and drop duplicates cpumap = dict.fromkeys( - map(lambda x: x % nr_cpus, cpumap)).keys() + filter(lambda x: x < nr_cpus, cpumap)).keys() if len(cpumap) == nr_cpus: return "any cpu" _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 06:50:36 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 06:50:36 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzXfI-0002Q4-6K for www-data@colo.xensource.com; Fri, 23 May 2008 06:50:36 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfx-0004YD-I9; Fri, 23 May 2008 13:51:17 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfs-0004RY-0b for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:12 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzXfi-0002F3-KO for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:09 +0000 X-SBRS: 3.6 X-MesageID: 295924 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,530,1204520400"; d="scan'208";a="295924" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 09:50:11 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoB83008922 for ; Fri, 23 May 2008 06:50:11 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoTUd013535 for ; Fri, 23 May 2008 06:50:29 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NDoTI4013534 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 06:50:29 -0700 Message-Id: <200805231350.m4NDoTI4013534@xenbits.xensource.com> Date: Fri, 23 May 2008 06:50:28 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] xm migrate: Better error report when attempt to migrate non-running domain. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211537380 -3600 # Node ID 08e8f5f7b0b56bafb7450bf578bfdd341c5df388 # Parent 98e7af9f5a4219d05ba26d2327bcd0db487c7de5 xm migrate: Better error report when attempt to migrate non-running domain. Signed-off-by: Masaki Kanno xen-unstable changeset: 17657:7c8e2a2c006ef5953ef9c50e1b5918c342ac8890 xen-unstable date: Tue May 20 09:43:02 2008 +0100 --- tools/python/xen/xend/XendDomain.py | 4 ++++ 1 files changed, 4 insertions(+) diff -r 98e7af9f5a42 -r 08e8f5f7b0b5 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Fri May 23 11:09:05 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Fri May 23 11:09:40 2008 +0100 @@ -1278,6 +1278,10 @@ class XendDomain: if dominfo.getDomid() == DOM0_ID: raise XendError("Cannot migrate privileged domain %s" % domid) + if dominfo._stateGet() != DOM_STATE_RUNNING: + raise VMBadState("Domain is not running", + POWER_STATE_NAMES[DOM_STATE_RUNNING], + POWER_STATE_NAMES[dominfo._stateGet()]) """ The following call may raise a XendError exception """ dominfo.testMigrateDevices(True, dst) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 06:50:40 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 06:50:40 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzXfL-0002Q7-Ks for www-data@colo.xensource.com; Fri, 23 May 2008 06:50:39 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXg0-0004bX-V7; Fri, 23 May 2008 13:51:21 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXft-0004SU-1F for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:13 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzXfm-0002F9-7t for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:10 +0000 X-SBRS: 3.6 X-MesageID: 295926 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,530,1204520400"; d="scan'208";a="295926" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 09:50:13 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoD9J008928 for ; Fri, 23 May 2008 06:50:13 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoVHc013569 for ; Fri, 23 May 2008 06:50:31 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NDoV3b013568 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 06:50:31 -0700 Message-Id: <200805231350.m4NDoV3b013568@xenbits.xensource.com> Date: Fri, 23 May 2008 06:50:30 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86: Fix Xen boot on 8-node AMD machines X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211537804 -3600 # Node ID b38e8c9f7a693e7dc1d6fcf63f11e616b5dec12c # Parent 8ef1af9923450de52a1b565cf2bed7eafcbb6fd5 x86: Fix Xen boot on 8-node AMD machines In xen/arch/x86/cpu/amd.c the function disable_c1_ramping iterates over the northbridges using NR_CPUS as an upper bound for the number of nodes. If there are no more northbridges found, it stops iterating. Sadly it just adds the northbridge number to 0x18 and uses this as a PCI device number, so probing the 9th northbridge on an 8 node system will be caught by the newly inserted assertion in pci_conf_read in current unstable. We fix this by first querying the number of nodes from the first northbridge to avoid the overflow. Signed-off-by: Andre Przywara Verified by Mark.Johnson@sun.com xen-unstable changeset: 17712:5cc5b9c37c6d429502e75536822810219b23b033 xen-unstable date: Fri May 23 11:15:19 2008 +0100 --- xen/arch/x86/cpu/amd.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff -r 8ef1af992345 -r b38e8c9f7a69 xen/arch/x86/cpu/amd.c --- a/xen/arch/x86/cpu/amd.c Fri May 23 11:10:09 2008 +0100 +++ b/xen/arch/x86/cpu/amd.c Fri May 23 11:16:44 2008 +0100 @@ -86,9 +86,11 @@ static void disable_c1_ramping(void) static void disable_c1_ramping(void) { u8 pmm7; - int node; - - for (node=0; node < NR_CPUS; node++) { + int node, nr_nodes; + + /* Read the number of nodes from the first Northbridge. */ + nr_nodes = ((pci_read_byte(0, 0x18, 0x0, 0x60)>>4)&0x07)+1; + for (node = 0; node < nr_nodes; node++) { /* PMM7: bus=0, dev=0x18+node, function=0x3, register=0x87. */ pmm7 = pci_read_byte(0, 0x18+node, 0x3, 0x87); /* Invalid read means we've updated every Northbridge. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 06:50:43 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 06:50:43 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzXfP-0002QA-BX for www-data@colo.xensource.com; Fri, 23 May 2008 06:50:43 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXg4-0004er-OF; Fri, 23 May 2008 13:51:24 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzXfu-0004Tx-La for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:14 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzXfl-0002Ey-31 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 13:51:12 +0000 X-SBRS: 3.6 X-MesageID: 295925 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,530,1204520400"; d="scan'208";a="295925" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 09:50:12 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoCQb008925 for ; Fri, 23 May 2008 06:50:12 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NDoUUJ013552 for ; Fri, 23 May 2008 06:50:30 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NDoU0X013551 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 06:50:30 -0700 Message-Id: <200805231350.m4NDoU0X013551@xenbits.xensource.com> Date: Fri, 23 May 2008 06:50:29 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86: Change a local label in asm entry stubs to really be local. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211537409 -3600 # Node ID 8ef1af9923450de52a1b565cf2bed7eafcbb6fd5 # Parent 08e8f5f7b0b56bafb7450bf578bfdd341c5df388 x86: Change a local label in asm entry stubs to really be local. This prevents it appearing in crash traces, where it can be a bit confusing. Signed-off-by: Keir Fraser xen-unstable changeset: 17696:e48453f82d30ded8c7b4f454f7a9d37ea56d3fcb xen-unstable date: Thu May 22 10:41:49 2008 +0100 --- xen/arch/x86/x86_32/entry.S | 5 ++--- xen/arch/x86/x86_64/compat/entry.S | 5 ++--- xen/arch/x86/x86_64/entry.S | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff -r 08e8f5f7b0b5 -r 8ef1af992345 xen/arch/x86/x86_32/entry.S --- a/xen/arch/x86/x86_32/entry.S Fri May 23 11:09:40 2008 +0100 +++ b/xen/arch/x86/x86_32/entry.S Fri May 23 11:10:09 2008 +0100 @@ -197,13 +197,12 @@ 1: sti #define SHADOW_BYTES 24 /* 6 shadow parameters */ #endif cmpb $0,tb_init_done - je tracing_off + je 1f call trace_hypercall /* Now restore all the registers that trace_hypercall clobbered */ movl UREGS_eax+SHADOW_BYTES(%esp),%eax /* Hypercall # */ #undef SHADOW_BYTES -tracing_off: - call *hypercall_table(,%eax,4) +1: call *hypercall_table(,%eax,4) addl $24,%esp # Discard the shadow parameters #ifndef NDEBUG /* Deliberately corrupt real parameter regs used by this hypercall. */ diff -r 08e8f5f7b0b5 -r 8ef1af992345 xen/arch/x86/x86_64/compat/entry.S --- a/xen/arch/x86/x86_64/compat/entry.S Fri May 23 11:09:40 2008 +0100 +++ b/xen/arch/x86/x86_64/compat/entry.S Fri May 23 11:10:09 2008 +0100 @@ -59,7 +59,7 @@ ENTRY(compat_hypercall) #define SHADOW_BYTES 0 /* No on-stack shadow state */ #endif cmpb $0,tb_init_done(%rip) - je compat_tracing_off + je 1f call trace_hypercall /* Now restore all the registers that trace_hypercall clobbered */ movl UREGS_rax+SHADOW_BYTES(%rsp),%eax /* Hypercall # */ @@ -70,8 +70,7 @@ ENTRY(compat_hypercall) movl UREGS_rdi+SHADOW_BYTES(%rsp),%r8d /* Arg 5 */ movl UREGS_rbp+SHADOW_BYTES(%rsp),%r9d /* Arg 6 */ #undef SHADOW_BYTES -compat_tracing_off: - leaq compat_hypercall_table(%rip),%r10 +1: leaq compat_hypercall_table(%rip),%r10 PERFC_INCR(PERFC_hypercalls, %rax, %rbx) callq *(%r10,%rax,8) #ifndef NDEBUG diff -r 08e8f5f7b0b5 -r 8ef1af992345 xen/arch/x86/x86_64/entry.S --- a/xen/arch/x86/x86_64/entry.S Fri May 23 11:09:40 2008 +0100 +++ b/xen/arch/x86/x86_64/entry.S Fri May 23 11:10:09 2008 +0100 @@ -163,7 +163,7 @@ ENTRY(syscall_enter) #define SHADOW_BYTES 0 /* No on-stack shadow state */ #endif cmpb $0,tb_init_done(%rip) - je tracing_off + je 1f call trace_hypercall /* Now restore all the registers that trace_hypercall clobbered */ movq UREGS_rax+SHADOW_BYTES(%rsp),%rax /* Hypercall # */ @@ -174,8 +174,7 @@ ENTRY(syscall_enter) movq UREGS_rdi+SHADOW_BYTES(%rsp),%r8 /* Arg 5 */ movq UREGS_rbp+SHADOW_BYTES(%rsp),%r9 /* Arg 6 */ #undef SHADOW_BYTES -tracing_off: - leaq hypercall_table(%rip),%r10 +1: leaq hypercall_table(%rip),%r10 PERFC_INCR(PERFC_hypercalls, %rax, %rbx) callq *(%r10,%rax,8) #ifndef NDEBUG _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:08 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:08 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaT1-0004W9-Ej for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTg-0006Yw-Q9; Fri, 23 May 2008 16:50:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTe-0006YW-NH for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTW-0004oK-NG for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:44 +0000 X-SBRS: 3.6 X-MesageID: 297413 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297413" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGno4d009369 for ; Fri, 23 May 2008 09:49:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGo9th023443 for ; Fri, 23 May 2008 09:50:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGo8eu023442 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:08 -0700 Message-Id: <200805231650.m4NGo8eu023442@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Remove xend-config-xenapi.sxp and xm-config-xenapi.xml X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211532465 -3600 # Node ID fbc8cf8e0d6b3c419c798a77de4db930db0cd6a4 # Parent fbf09143c2e51b9f662e9d53020fa2487674edc4 Remove xend-config-xenapi.sxp and xm-config-xenapi.xml The contents of these two files are duplicate of xend-config.sxp and xm-config.xml. They only add maintaining burdens to developers. This patch removes them permanently. Signed-off-by: Zhigang Wang --- tools/examples/xend-config-xenapi.sxp | 196 ---------------------------------- tools/examples/xm-config-xenapi.xml | 41 ------- 2 files changed, 237 deletions(-) diff -r fbf09143c2e5 -r fbc8cf8e0d6b tools/examples/xend-config-xenapi.sxp --- a/tools/examples/xend-config-xenapi.sxp Fri May 23 09:35:57 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -# -*- sh -*- - -# -# Xend configuration file. -# - -# This example configuration is appropriate for an installation that -# utilizes a bridged network configuration. Access to xend via http -# is disabled. - -# Commented out entries show the default for that entry, unless otherwise -# specified. - -#(logfile /var/log/xen/xend.log) -#(loglevel DEBUG) - - -# The Xen-API server configuration. (Please note that this server is -# available as an UNSUPPORTED PREVIEW in Xen 3.0.4, and should not be relied -# upon). -# -# This value configures the ports, interfaces, and access controls for the -# Xen-API server. Each entry in the list starts with either unix, a port -# number, or an address:port pair. If this is "unix", then a UDP socket is -# opened, and this entry applies to that. If it is a port, then Xend will -# listen on all interfaces on that TCP port, and if it is an address:port -# pair, then Xend will listen on the specified port, using the interface with -# the specified address. -# -# The subsequent string configures the user-based access control for the -# listener in question. This can be one of "none" or "pam", indicating either -# that users should be allowed access unconditionally, or that the local -# Pluggable Authentication Modules configuration should be used. If this -# string is missing or empty, then "pam" is used. -# -# The final string gives the host-based access control for that listener. If -# this is missing or empty, then all connections are accepted. Otherwise, -# this should be a space-separated sequence of regular expressions; any host -# with a fully-qualified domain name or an IP address that matches one of -# these regular expressions will be accepted. -# -# Example: listen on TCP port 9363 on all interfaces, accepting connections -# only from machines in example.com or localhost, and allow access through -# the unix domain socket unconditionally: -# - (xen-api-server ((9363 none))) -# (unix none))) -# -# Optionally, the TCP Xen-API server can use SSL by specifying the private -# key and certificate location: -# -# (9367 pam '' /etc/xen/xen-api.key /etc/xen/xen-api.crt) -# -# Default: -# (xen-api-server ((unix))) - - -#(xend-http-server no) -#(xend-unix-server no) -#(xend-tcp-xmlrpc-server no) -#(xend-unix-xmlrpc-server yes) -#(xend-relocation-server no) -(xend-relocation-server yes) - -#(xend-unix-path /var/lib/xend/xend-socket) - - -# Address and port xend should use for the legacy TCP XMLRPC interface, -# if xend-tcp-xmlrpc-server is set. -#(xend-tcp-xmlrpc-server-address 'localhost') -#(xend-tcp-xmlrpc-server-port 8006) - -# SSL key and certificate to use for the legacy TCP XMLRPC interface. -# Setting these will mean that this port serves only SSL connections as -# opposed to plaintext ones. -#(xend-tcp-xmlrpc-server-ssl-key-file /etc/xen/xmlrpc.key) -#(xend-tcp-xmlrpc-server-ssl-cert-file /etc/xen/xmlrpc.crt) - - -# Port xend should use for the HTTP interface, if xend-http-server is set. -#(xend-port 8000) - -# Port xend should use for the relocation interface, if xend-relocation-server -# is set. -#(xend-relocation-port 8002) - -# Address xend should listen on for HTTP connections, if xend-http-server is -# set. -# Specifying 'localhost' prevents remote connections. -# Specifying the empty string '' (the default) allows all connections. -#(xend-address '') -#(xend-address localhost) - -# Address xend should listen on for relocation-socket connections, if -# xend-relocation-server is set. -# Meaning and default as for xend-address above. -#(xend-relocation-address '') - -# The hosts allowed to talk to the relocation port. If this is empty (the -# default), then all connections are allowed (assuming that the connection -# arrives on a port and interface on which we are listening; see -# xend-relocation-port and xend-relocation-address above). Otherwise, this -# should be a space-separated sequence of regular expressions. Any host with -# a fully-qualified domain name or an IP address that matches one of these -# regular expressions will be accepted. -# -# For example: -# (xend-relocation-hosts-allow '^localhost$ ^.*\\.example\\.org$') -# -#(xend-relocation-hosts-allow '') -(xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$') - -# The limit (in kilobytes) on the size of the console buffer -#(console-limit 1024) - -## -# To bridge network traffic, like this: -# -# dom0: ----------------- bridge -> real eth0 -> the network -# | -# domU: fake eth0 -> vifN.0 -+ -# -# use -# -# (network-script network-bridge) -# -# Your default ethernet device is used as the outgoing interface, by default. -# To use a different one (e.g. eth1) use -# -# (network-script 'network-bridge netdev=eth1') -# -# The bridge is named xenbr0, by default. To rename the bridge, use -# -# (network-script 'network-bridge bridge=') -# -# It is possible to use the network-bridge script in more complicated -# scenarios, such as having two outgoing interfaces, with two bridges, and -# two fake interfaces per guest domain. To do things like this, write -# yourself a wrapper script, and call network-bridge from it, as appropriate. -# -(network-script network-bridge) - -# The script used to control virtual interfaces. This can be overridden on a -# per-vif basis when creating a domain or a configuring a new vif. The -# vif-bridge script is designed for use with the network-bridge script, or -# similar configurations. -# -# If you have overridden the bridge name using -# (network-script 'network-bridge bridge=') then you may wish to do the -# same here. The bridge name can also be set when creating a domain or -# configuring a new vif, but a value specified here would act as a default. -# -# If you are using only one bridge, the vif-bridge script will discover that, -# so there is no need to specify it explicitly. -# -(vif-script vif-bridge) - - -## Use the following if network traffic is routed, as an alternative to the -# settings for bridged networking given above. -#(network-script network-route) -#(vif-script vif-route) - - -## Use the following if network traffic is routed with NAT, as an alternative -# to the settings for bridged networking given above. -#(network-script network-nat) -#(vif-script vif-nat) - -# dom0-min-mem is the lowest permissible memory level (in MB) for dom0. -# This is a minimum both for auto-ballooning (as enabled by -# enable-dom0-ballooning below) and for xm mem-set when applied to dom0. -(dom0-min-mem 196) - -# Whether to enable auto-ballooning of dom0 to allow domUs to be created. -# If enable-dom0-ballooning = no, dom0 will never balloon out. -(enable-dom0-ballooning yes) - -# In SMP system, dom0 will use dom0-cpus # of CPUS -# If dom0-cpus = 0, dom0 will take all cpus available -(dom0-cpus 0) - -# Whether to enable core-dumps when domains crash. -#(enable-dump no) - -# The tool used for initiating virtual TPM migration -#(external-migration-tool '') - -# The interface for VNC servers to listen on. Defaults -# to 127.0.0.1 To restore old 'listen everywhere' behaviour -# set this to 0.0.0.0 -#(vnc-listen '127.0.0.1') - -# The default password for VNC console on HVM domain. -# Empty string is no authentication. -(vncpasswd '') diff -r fbf09143c2e5 -r fbc8cf8e0d6b tools/examples/xm-config-xenapi.xml --- a/tools/examples/xm-config-xenapi.xml Fri May 23 09:35:57 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ - - - - - - - - _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:09 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:09 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaT3-0004WA-3E for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:09 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTi-0006bb-Ic; Fri, 23 May 2008 16:50:50 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTf-0006YX-H4 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTY-0004oL-CP for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:45 +0000 X-SBRS: 3.6 X-MesageID: 297414 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297414" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGnpkp009372 for ; Fri, 23 May 2008 09:49:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGoAQZ023460 for ; Fri, 23 May 2008 09:50:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGo9O0023459 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:09 -0700 Message-Id: <200805231650.m4NGo9O0023459@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] tboot, s3: Fix S3 issue of Xen and tboot, since the structure X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211532524 -3600 # Node ID 4c8fc8def9b30d4d72a418960d168c77d3325ce1 # Parent fbc8cf8e0d6b3c419c798a77de4db930db0cd6a4 tboot, s3: Fix S3 issue of Xen and tboot, since the structure acpi_sleep_info is changed but some of the code in Xen is not synchronized up with this change, which causes Xen S3 failure. Signed-off-by: Shane Wang --- xen/arch/x86/acpi/power.c | 14 +++++++++++--- xen/include/asm-x86/tboot.h | 15 ++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff -r fbc8cf8e0d6b -r 4c8fc8def9b3 xen/arch/x86/acpi/power.c --- a/xen/arch/x86/acpi/power.c Fri May 23 09:47:45 2008 +0100 +++ b/xen/arch/x86/acpi/power.c Fri May 23 09:48:44 2008 +0100 @@ -238,9 +238,17 @@ static void tboot_sleep(u8 sleep_state) static void tboot_sleep(u8 sleep_state) { uint32_t shutdown_type; - - *((struct acpi_sleep_info *)(unsigned long)g_tboot_shared->acpi_sinfo) = - acpi_sinfo; + + g_tboot_shared->acpi_sinfo.pm1a_cnt = + (uint16_t)acpi_sinfo.pm1a_cnt_blk.address; + g_tboot_shared->acpi_sinfo.pm1b_cnt = + (uint16_t)acpi_sinfo.pm1b_cnt_blk.address; + g_tboot_shared->acpi_sinfo.pm1a_evt = + (uint16_t)acpi_sinfo.pm1a_evt_blk.address; + g_tboot_shared->acpi_sinfo.pm1b_evt = + (uint16_t)acpi_sinfo.pm1b_evt_blk.address; + g_tboot_shared->acpi_sinfo.pm1a_cnt_val = acpi_sinfo.pm1a_cnt_val; + g_tboot_shared->acpi_sinfo.pm1b_cnt_val = acpi_sinfo.pm1b_cnt_val; switch ( sleep_state ) { diff -r fbc8cf8e0d6b -r 4c8fc8def9b3 xen/include/asm-x86/tboot.h --- a/xen/include/asm-x86/tboot.h Fri May 23 09:47:45 2008 +0100 +++ b/xen/include/asm-x86/tboot.h Fri May 23 09:48:44 2008 +0100 @@ -46,7 +46,15 @@ typedef struct __attribute__ ((__packed_ } uuid_t; /* used to communicate between tboot and the launched kernel (i.e. Xen) */ -#define MAX_TB_ACPI_SINFO_SIZE 64 + +typedef struct __attribute__ ((__packed__)) { + uint16_t pm1a_cnt; + uint16_t pm1b_cnt; + uint16_t pm1a_evt; + uint16_t pm1b_evt; + uint16_t pm1a_cnt_val; + uint16_t pm1b_cnt_val; +} tboot_acpi_sleep_info; typedef struct __attribute__ ((__packed__)) { /* version 0x01+ fields: */ @@ -58,8 +66,9 @@ typedef struct __attribute__ ((__packed_ uint32_t shutdown_type; /* type of shutdown (TB_SHUTDOWN_*) */ uint32_t s3_tb_wakeup_entry;/* entry point for tboot s3 wake up */ uint32_t s3_k_wakeup_entry; /* entry point for xen s3 wake up */ - uint8_t acpi_sinfo[MAX_TB_ACPI_SINFO_SIZE]; - /* where kernel put acpi sleep info in Sx */ + tboot_acpi_sleep_info + acpi_sinfo; /* where kernel put acpi sleep info in Sx */ + uint8_t reserved[52]; /* this pad is for compat with old field */ /* version 0x02+ fields: */ uint32_t tboot_base; /* starting addr for tboot */ uint32_t tboot_size; /* size of tboot */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaT7-0004WH-HU for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTm-0006fq-WC; Fri, 23 May 2008 16:50:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTj-0006aC-IH for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTa-0004oN-8n for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:49 +0000 X-SBRS: 3.6 X-MesageID: 297415 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297415" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGnqGh009375 for ; Fri, 23 May 2008 09:49:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGoAD1023477 for ; Fri, 23 May 2008 09:50:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGoAYg023476 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:10 -0700 Message-Id: <200805231650.m4NGoAYg023476@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Make ssl relocation server listen on different port X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211535704 -3600 # Node ID 91a9e28aed468d6548b3a4aac9d80988093cc91e # Parent 4c8fc8def9b30d4d72a418960d168c77d3325ce1 Make ssl relocation server listen on different port This patch makes ssl relocation server listen on 8003 if enabled. Whether to start ssl relocation server now controlled by xend-relocation-ssl-server. So ssl and non-ssl relocation server can run simultaneously. You can also only start ssl server or only start non-ssl relocation server. When mix deploy xen 3.2 server (has no ssl support) and 3.3 servers, start ssl and non-ssl relocation server simultaneously can keep backward compatibility. It's also more reasonable to have separate ports for ssl and non-ssl. In this patch, also renames xend-relocation-tls to xend-relocation-ssl. Signed-off-by: Zhigang Wang --- tools/examples/xend-config.sxp | 16 ++++++++++------ tools/python/xen/xend/XendDomain.py | 11 ++++++----- tools/python/xen/xend/XendOptions.py | 27 +++++++++++++++++++++++---- tools/python/xen/xend/server/relocate.py | 24 +++++++++++++++--------- 4 files changed, 54 insertions(+), 24 deletions(-) diff -r 4c8fc8def9b3 -r 91a9e28aed46 tools/examples/xend-config.sxp --- a/tools/examples/xend-config.sxp Fri May 23 09:48:44 2008 +0100 +++ b/tools/examples/xend-config.sxp Fri May 23 10:41:44 2008 +0100 @@ -59,6 +59,7 @@ #(xend-unix-xmlrpc-server yes) #(xend-relocation-server no) (xend-relocation-server yes) +#(xend-relocation-ssl-server no) #(xend-unix-path /var/lib/xend/xend-socket) @@ -82,14 +83,17 @@ # is set. #(xend-relocation-port 8002) -# Whether to use tls when relocating. -#(xend-relocation-tls no) - -# SSL key and certificate to use for the relocation interface. -# Setting these will mean that this port serves only SSL connections as -# opposed to plaintext ones. +# Port xend should use for the ssl relocation interface, if +# xend-relocation-ssl-server is set. +#(xend-relocation-ssl-port 8003) + +# SSL key and certificate to use for the ssl relocation interface, if +# xend-relocation-ssl-server is set. #(xend-relocation-server-ssl-key-file /etc/xen/xmlrpc.key) #(xend-relocation-server-ssl-cert-file /etc/xen/xmlrpc.crt) + +# Whether to use ssl as default when relocating. +#(xend-relocation-ssl no) # Address xend should listen on for HTTP connections, if xend-http-server is # set. diff -r 4c8fc8def9b3 -r 91a9e28aed46 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Fri May 23 09:48:44 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Fri May 23 10:41:44 2008 +0100 @@ -1294,13 +1294,12 @@ class XendDomain: """ Make sure there's memory free for enabling shadow mode """ dominfo.checkLiveMigrateMemory() - if port == 0: - port = xoptions.get_xend_relocation_port() - - tls = xoptions.get_xend_relocation_tls() - if tls: + ssl = xoptions.get_xend_relocation_ssl() + if ssl: from OpenSSL import SSL from xen.web import connection + if port == 0: + port = xoptions.get_xend_relocation_ssl_port() try: ctx = SSL.Context(SSL.SSLv23_METHOD) sock = SSL.Connection(ctx, @@ -1328,6 +1327,8 @@ class XendDomain: os.close(p2cread) os.close(p2cwrite) else: + if port == 0: + port = xoptions.get_xend_relocation_port() try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # When connecting to our ssl enabled relocation server using a diff -r 4c8fc8def9b3 -r 91a9e28aed46 tools/python/xen/xend/XendOptions.py --- a/tools/python/xen/xend/XendOptions.py Fri May 23 09:48:44 2008 +0100 +++ b/tools/python/xen/xend/XendOptions.py Fri May 23 10:41:44 2008 +0100 @@ -72,6 +72,9 @@ class XendOptions: """Default for the flag indicating whether xend should run a relocation server.""" xend_relocation_server_default = 'no' + """Default for the flag indicating whether xend should run a ssl relocation server.""" + xend_relocation_ssl_server_default = 'no' + """Default interface address the xend relocation server listens at. """ xend_relocation_address_default = '' @@ -80,6 +83,9 @@ class XendOptions: """Default port xend serves relocation at. """ xend_relocation_port_default = 8002 + + """Default port xend serves ssl relocation at. """ + xend_relocation_ssl_port_default = 8003 xend_relocation_hosts_allow_default = '' @@ -192,6 +198,12 @@ class XendOptions: return self.get_config_bool("xend-relocation-server", self.xend_relocation_server_default) + def get_xend_relocation_ssl_server(self): + """Get the flag indicating whether xend should run a ssl relocation server. + """ + return self.get_config_bool("xend-relocation-ssl-server", + self.xend_relocation_ssl_server_default) + def get_xend_relocation_server_ssl_key_file(self): return self.get_config_string("xend-relocation-server-ssl-key-file") @@ -209,10 +221,17 @@ class XendOptions: return self.get_config_int('xend-relocation-port', self.xend_relocation_port_default) - def get_xend_relocation_tls(self): - """Whether to use tls when relocating. - """ - return self.get_config_bool('xend-relocation-tls', 'no') + def get_xend_relocation_ssl_port(self): + """Get the port xend listens at for ssl connection to its relocation + server. + """ + return self.get_config_int('xend-relocation-ssl-port', + self.xend_relocation_ssl_port_default) + + def get_xend_relocation_ssl(self): + """Whether to use ssl when relocating. + """ + return self.get_config_bool('xend-relocation-ssl', 'no') def get_xend_relocation_hosts_allow(self): return self.get_config_string("xend-relocation-hosts-allow", diff -r 4c8fc8def9b3 -r 91a9e28aed46 tools/python/xen/xend/server/relocate.py --- a/tools/python/xen/xend/server/relocate.py Fri May 23 09:48:44 2008 +0100 +++ b/tools/python/xen/xend/server/relocate.py Fri May 23 10:41:44 2008 +0100 @@ -142,16 +142,22 @@ def listenRelocation(): if xoptions.get_xend_unix_server(): path = '/var/lib/xend/relocation-socket' unix.UnixListener(path, RelocationProtocol) + + interface = xoptions.get_xend_relocation_address() + + hosts_allow = xoptions.get_xend_relocation_hosts_allow() + if hosts_allow == '': + hosts_allow = None + else: + hosts_allow = map(re.compile, hosts_allow.split(" ")) + if xoptions.get_xend_relocation_server(): port = xoptions.get_xend_relocation_port() - interface = xoptions.get_xend_relocation_address() + tcp.TCPListener(RelocationProtocol, port, interface = interface, + hosts_allow = hosts_allow) - hosts_allow = xoptions.get_xend_relocation_hosts_allow() - if hosts_allow == '': - hosts_allow = None - else: - hosts_allow = map(re.compile, hosts_allow.split(" ")) - + if xoptions.get_xend_relocation_ssl_server(): + port = xoptions.get_xend_relocation_ssl_port() ssl_key_file = xoptions.get_xend_relocation_server_ssl_key_file() ssl_cert_file = xoptions.get_xend_relocation_server_ssl_cert_file() @@ -161,5 +167,5 @@ def listenRelocation(): ssl_key_file = ssl_key_file, ssl_cert_file = ssl_cert_file) else: - tcp.TCPListener(RelocationProtocol, port, interface = interface, - hosts_allow = hosts_allow) + raise XendError("ssl_key_file or ssl_cert_file for ssl relocation server is missing.") + _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:17 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:17 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaTB-0004WO-0O for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:17 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTq-0006j6-Aa; Fri, 23 May 2008 16:50:58 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTk-0006c4-O3 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTc-0004oK-QU for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:50 +0000 X-SBRS: 3.6 X-MesageID: 297416 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297416" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGnrUP009378 for ; Fri, 23 May 2008 09:49:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGoBQB023494 for ; Fri, 23 May 2008 09:50:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGoBxN023493 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:11 -0700 Message-Id: <200805231650.m4NGoBxN023493@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add -s --ssl option to xm migrate X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211535731 -3600 # Node ID 33a6590ba948b29cba9e5d2e1df1774c6b9a1cfd # Parent 91a9e28aed468d6548b3a4aac9d80988093cc91e Add -s --ssl option to xm migrate This patch adds -s --ssl option to xm migrate. It will override xend-relocation-ssl setting in /etc/xen/xend-config.sxp. When mix deploy xen 3.2 and xen 3.3 servers, it's convenient to have a command line option rather than modify /etc/xen/xend-config.sxp every time. Signed-off-by: Zhigang Wang --- tools/python/xen/xend/XendAPI.py | 3 ++- tools/python/xen/xend/XendDomain.py | 8 ++++++-- tools/python/xen/xend/server/SrvDomain.py | 3 ++- tools/python/xen/xm/migrate.py | 10 ++++++++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff -r 91a9e28aed46 -r 33a6590ba948 tools/python/xen/xend/XendAPI.py --- a/tools/python/xen/xend/XendAPI.py Fri May 23 10:41:44 2008 +0100 +++ b/tools/python/xen/xend/XendAPI.py Fri May 23 10:42:11 2008 +0100 @@ -1762,9 +1762,10 @@ class XendAPI(object): resource = other_config.get("resource", 0) port = other_config.get("port", 0) node = other_config.get("node", 0) + ssl = other_config.get("ssl", 0) xendom.domain_migrate(xeninfo.getDomid(), destination_url, - bool(live), resource, port, node) + bool(live), resource, port, node, ssl) return xen_api_success_void() def VM_save(self, _, vm_ref, dest, checkpoint): diff -r 91a9e28aed46 -r 33a6590ba948 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Fri May 23 10:41:44 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Fri May 23 10:42:11 2008 +0100 @@ -1258,7 +1258,7 @@ class XendDomain: return val - def domain_migrate(self, domid, dst, live=False, port=0, node=-1): + def domain_migrate(self, domid, dst, live=False, port=0, node=-1, ssl=None): """Start domain migration. @param domid: Domain ID or Name @@ -1269,6 +1269,8 @@ class XendDomain: @type port: int @keyword live: Live migration @type live: bool + @keyword ssl: use ssl connection + @type ssl: bool @rtype: None @keyword node: use node number for target @rtype: int @@ -1294,7 +1296,9 @@ class XendDomain: """ Make sure there's memory free for enabling shadow mode """ dominfo.checkLiveMigrateMemory() - ssl = xoptions.get_xend_relocation_ssl() + if ssl is None: + ssl = xoptions.get_xend_relocation_ssl() + if ssl: from OpenSSL import SSL from xen.web import connection diff -r 91a9e28aed46 -r 33a6590ba948 tools/python/xen/xend/server/SrvDomain.py --- a/tools/python/xen/xend/server/SrvDomain.py Fri May 23 10:41:44 2008 +0100 +++ b/tools/python/xen/xend/server/SrvDomain.py Fri May 23 10:42:11 2008 +0100 @@ -115,7 +115,8 @@ class SrvDomain(SrvDir): [['dom', 'int'], ['destination', 'str'], ['live', 'int'], - ['port', 'int']]) + ['port', 'int'], + ['ssl', 'int']]) return fn(req.args, {'dom': self.dom.domid}) def op_pincpu(self, _, req): diff -r 91a9e28aed46 -r 33a6590ba948 tools/python/xen/xm/migrate.py --- a/tools/python/xen/xm/migrate.py Fri May 23 10:41:44 2008 +0100 +++ b/tools/python/xen/xm/migrate.py Fri May 23 10:42:11 2008 +0100 @@ -47,6 +47,10 @@ gopts.opt('node', short='n', val='nodenu fn=set_int, default=-1, use="Use specified NUMA node on target.") +gopts.opt('ssl', short='s', + fn=set_true, default=None, + use="Use ssl connection for migration.") + def help(): return str(gopts) @@ -65,11 +69,13 @@ def main(argv): vm_ref = get_single_vm(dom) other_config = { "port": opts.vals.port, - "node": opts.vals.node + "node": opts.vals.node, + "ssl": opts.vals.ssl } server.xenapi.VM.migrate(vm_ref, dst, bool(opts.vals.live), other_config) else: server.xend.domain.migrate(dom, dst, opts.vals.live, opts.vals.port, - opts.vals.node) + opts.vals.node, + opts.vals.ssl) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:22 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:22 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaTF-0004WV-Rn for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:22 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTv-0006nS-Aq; Fri, 23 May 2008 16:51:03 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTl-0006dI-SS for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:53 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTd-0004oL-WE for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:51 +0000 X-SBRS: 3.6 X-MesageID: 297417 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297417" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGnsYC009381 for ; Fri, 23 May 2008 09:49:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGoCG1023511 for ; Fri, 23 May 2008 09:50:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGoCGl023510 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:12 -0700 Message-Id: <200805231650.m4NGoCGl023510@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] rools/examples: Fix 'make install'. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211536036 -3600 # Node ID 9469ad6e263419227e9f4fdbecf0b53244ec58d6 # Parent 33a6590ba948b29cba9e5d2e1df1774c6b9a1cfd rools/examples: Fix 'make install'. Signed-off-by: Keir Fraser --- tools/examples/Makefile | 2 -- 1 files changed, 2 deletions(-) diff -r 33a6590ba948 -r 9469ad6e2634 tools/examples/Makefile --- a/tools/examples/Makefile Fri May 23 10:42:11 2008 +0100 +++ b/tools/examples/Makefile Fri May 23 10:47:16 2008 +0100 @@ -9,9 +9,7 @@ XENDOMAINS_SYSCONFIG = init.d/sysconfig. # Xen configuration dir and configs to go there. XEN_CONFIG_DIR = /etc/xen XEN_CONFIGS = xend-config.sxp -XEN_CONFIGS += xend-config-xenapi.sxp XEN_CONFIGS += xm-config.xml -XEN_CONFIGS += xm-config-xenapi.xml XEN_CONFIGS += xmexample1 XEN_CONFIGS += xmexample2 XEN_CONFIGS += xmexample.hvm _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:25 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:25 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaTI-0004Wc-VL for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:25 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTy-0006qh-Aw; Fri, 23 May 2008 16:51:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTo-0006g4-TY for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTi-0004oN-0V for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:54 +0000 X-SBRS: 3.6 X-MesageID: 297420 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297420" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGntCM009384 for ; Fri, 23 May 2008 09:49:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGoDsD023528 for ; Fri, 23 May 2008 09:50:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGoDiW023527 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:13 -0700 Message-Id: <200805231650.m4NGoDiW023527@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, UPPERCASE_25_50 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Import TRIGGER_S3RESUME and HVM_PARAM_ACPI_S_STATE into XendDomain.py. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211536623 -3600 # Node ID 938ae6abe297867e165acedcef186b8a63dd2f18 # Parent 9469ad6e263419227e9f4fdbecf0b53244ec58d6 xend: Import TRIGGER_S3RESUME and HVM_PARAM_ACPI_S_STATE into XendDomain.py. Signed-off-by: Keir Fraser --- tools/python/xen/xend/XendDomain.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -r 9469ad6e2634 -r 938ae6abe297 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Fri May 23 10:47:16 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Fri May 23 10:57:03 2008 +0100 @@ -43,8 +43,8 @@ from xen.xend.XendConstants import DOM_S from xen.xend.XendConstants import DOM_STATE_HALTED, DOM_STATE_PAUSED from xen.xend.XendConstants import DOM_STATE_RUNNING, DOM_STATE_SUSPENDED from xen.xend.XendConstants import DOM_STATE_SHUTDOWN, DOM_STATE_UNKNOWN -from xen.xend.XendConstants import DOM_STATE_CRASHED -from xen.xend.XendConstants import TRIGGER_TYPE +from xen.xend.XendConstants import DOM_STATE_CRASHED, HVM_PARAM_ACPI_S_STATE +from xen.xend.XendConstants import TRIGGER_TYPE, TRIGGER_S3RESUME from xen.xend.XendDevices import XendDevices from xen.xend.XendAPIConstants import * _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:29 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:29 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaTN-0004Wk-4O for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:29 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaU2-0006uI-K3; Fri, 23 May 2008 16:51:10 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTq-0006hQ-8b for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTj-0004oK-6W for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:56 +0000 X-SBRS: 3.6 X-MesageID: 297422 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297422" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGnu12009387 for ; Fri, 23 May 2008 09:49:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGoEJX023545 for ; Fri, 23 May 2008 09:50:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGoEiV023544 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:14 -0700 Message-Id: <200805231650.m4NGoEiV023544@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Fix Xen boot on 8-node AMD machines X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211537719 -3600 # Node ID 5cc5b9c37c6d429502e75536822810219b23b033 # Parent 938ae6abe297867e165acedcef186b8a63dd2f18 x86: Fix Xen boot on 8-node AMD machines In xen/arch/x86/cpu/amd.c the function disable_c1_ramping iterates over the northbridges using NR_CPUS as an upper bound for the number of nodes. If there are no more northbridges found, it stops iterating. Sadly it just adds the northbridge number to 0x18 and uses this as a PCI device number, so probing the 9th northbridge on an 8 node system will be caught by the newly inserted assertion in pci_conf_read in current unstable. We fix this by first querying the number of nodes from the first northbridge to avoid the overflow. Signed-off-by: Andre Przywara Verified by Mark.Johnson@sun.com --- xen/arch/x86/cpu/amd.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff -r 938ae6abe297 -r 5cc5b9c37c6d xen/arch/x86/cpu/amd.c --- a/xen/arch/x86/cpu/amd.c Fri May 23 10:57:03 2008 +0100 +++ b/xen/arch/x86/cpu/amd.c Fri May 23 11:15:19 2008 +0100 @@ -74,9 +74,11 @@ static void disable_c1_ramping(void) static void disable_c1_ramping(void) { u8 pmm7; - int node; - - for (node=0; node < NR_CPUS; node++) { + int node, nr_nodes; + + /* Read the number of nodes from the first Northbridge. */ + nr_nodes = ((pci_conf_read32(0, 0x18, 0x0, 0x60)>>4)&0x07)+1; + for (node = 0; node < nr_nodes; node++) { /* PMM7: bus=0, dev=0x18+node, function=0x3, register=0x87. */ pmm7 = pci_conf_read8(0, 0x18+node, 0x3, 0x87); /* Invalid read means we've updated every Northbridge. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:33 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:33 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaTR-0004Wo-3V for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:33 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaU6-0006xt-JG; Fri, 23 May 2008 16:51:14 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTr-0006iO-5H for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:59 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTk-0004oL-Bt for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:50:57 +0000 X-SBRS: 3.6 X-MesageID: 297424 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297424" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGnvkx009390 for ; Fri, 23 May 2008 09:49:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGoFI0023562 for ; Fri, 23 May 2008 09:50:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGoFZr023561 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:15 -0700 Message-Id: <200805231650.m4NGoFZr023561@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Fixes to VLAPIC and S3 state resets. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211539596 -3600 # Node ID 21422854b9f8cec9d789951cf5c9514aff905896 # Parent 5cc5b9c37c6d429502e75536822810219b23b033 x86: Fixes to VLAPIC and S3 state resets. Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 11 +++++++++-- xen/arch/x86/hvm/hvm.c | 2 ++ xen/arch/x86/hvm/vlapic.c | 23 +++++++++++------------ xen/common/domain.c | 4 ++-- 4 files changed, 24 insertions(+), 16 deletions(-) diff -r 5cc5b9c37c6d -r 21422854b9f8 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Fri May 23 11:15:19 2008 +0100 +++ b/xen/arch/x86/domain.c Fri May 23 11:46:36 2008 +0100 @@ -825,8 +825,15 @@ int arch_set_info_guest( void arch_vcpu_reset(struct vcpu *v) { - destroy_gdt(v); - vcpu_destroy_pagetables(v); + if ( !is_hvm_vcpu(v) ) + { + destroy_gdt(v); + vcpu_destroy_pagetables(v); + } + else + { + vcpu_end_shutdown_deferral(v); + } } /* diff -r 5cc5b9c37c6d -r 21422854b9f8 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Fri May 23 11:15:19 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Fri May 23 11:46:36 2008 +0100 @@ -2123,6 +2123,8 @@ void hvm_vcpu_reset_state(struct vcpu *v v->domain->vcpu[0]->arch.hvm_vcpu.cache_tsc_offset; hvm_funcs.set_tsc_offset(v, v->arch.hvm_vcpu.cache_tsc_offset); + paging_update_paging_modes(v); + v->arch.flags |= TF_kernel_mode; v->is_initialised = 1; clear_bit(_VPF_down, &v->pause_flags); diff -r 5cc5b9c37c6d -r 21422854b9f8 xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Fri May 23 11:15:19 2008 +0100 +++ b/xen/arch/x86/hvm/vlapic.c Fri May 23 11:46:36 2008 +0100 @@ -22,18 +22,19 @@ #include #include #include +#include #include -#include #include #include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include #include -#include #include #include @@ -259,6 +260,7 @@ static void vlapic_init_action(unsigned { struct vcpu *v = (struct vcpu *)_vcpu; struct domain *d = v->domain; + bool_t fpu_initialised; /* If the VCPU is not on its way down we have nothing to do. */ if ( !test_bit(_VPF_down, &v->pause_flags) ) @@ -270,15 +272,12 @@ static void vlapic_init_action(unsigned return; } + /* Reset necessary VCPU state. This does not include FPU state. */ domain_lock(d); - - /* Paranoia makes us re-assert VPF_down under the domain lock. */ - set_bit(_VPF_down, &v->pause_flags); - v->is_initialised = 0; - clear_bit(_VPF_blocked, &v->pause_flags); - + fpu_initialised = v->fpu_initialised; + vcpu_reset(v); + v->fpu_initialised = fpu_initialised; vlapic_reset(vcpu_vlapic(v)); - domain_unlock(d); vcpu_unpause(v); diff -r 5cc5b9c37c6d -r 21422854b9f8 xen/common/domain.c --- a/xen/common/domain.c Fri May 23 11:15:19 2008 +0100 +++ b/xen/common/domain.c Fri May 23 11:46:36 2008 +0100 @@ -637,7 +637,7 @@ void vcpu_reset(struct vcpu *v) { struct domain *d = v->domain; - domain_pause(d); + vcpu_pause(v); domain_lock(d); arch_vcpu_reset(v); @@ -653,7 +653,7 @@ void vcpu_reset(struct vcpu *v) clear_bit(_VPF_blocked, &v->pause_flags); domain_unlock(v->domain); - domain_unpause(d); + vcpu_unpause(v); } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 23 09:50:37 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 23 May 2008 09:50:37 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzaTU-0004Wv-UL for www-data@colo.xensource.com; Fri, 23 May 2008 09:50:37 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaUA-00071N-FX; Fri, 23 May 2008 16:51:18 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzaTu-0006lN-AP for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:51:02 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzaTn-0004oN-CF for xen-changelog@lists.xensource.com; Fri, 23 May 2008 16:51:00 +0000 X-SBRS: 3.6 X-MesageID: 297426 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,531,1204520400"; d="scan'208";a="297426" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 23 May 2008 12:49:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGnw5w009393 for ; Fri, 23 May 2008 09:49:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4NGoGbU023579 for ; Fri, 23 May 2008 09:50:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4NGoGfK023578 for xen-changelog@lists.xensource.com; Fri, 23 May 2008 09:50:16 -0700 Message-Id: <200805231650.m4NGoGfK023578@xenbits.xensource.com> Date: Fri, 23 May 2008 09:50:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] rombios: Remove annoying 3-second boot delay waiting for user to hit X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211540288 -3600 # Node ID ef7525e87030281c74768f6310f18bf4ed44ac15 # Parent 21422854b9f8cec9d789951cf5c9514aff905896 rombios: Remove annoying 3-second boot delay waiting for user to hit F10 to select boot device. This will be rarely used, and it is possible to hit F10 before the message is displayed and the keypress will still register. So in practice it is quite possibel to use this boot feature reliably without needing a multi-second delay. Signed-off-by: Keir Fraser --- tools/firmware/rombios/rombios.c | 26 ++++++-------------------- 1 files changed, 6 insertions(+), 20 deletions(-) diff -r 21422854b9f8 -r ef7525e87030 tools/firmware/rombios/rombios.c --- a/tools/firmware/rombios/rombios.c Fri May 23 11:46:36 2008 +0100 +++ b/tools/firmware/rombios/rombios.c Fri May 23 11:58:08 2008 +0100 @@ -2225,26 +2225,12 @@ void interactive_bootkey() Bit16u i; Bit8u scan = 0; - bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, "\n\nPress F10 to select boot device.\n"); - for (i = 3; i > 0; i--) - { - scan = wait(WAIT_HZ, 0); - switch (scan) { - case 0x3D: - case 0x3E: - case 0x3F: - case 0x58: - break; - case 0x44: - scan = bootmenu(inb_cmos(0x3d) & 0x0f); - break; - default: - scan = 0; - break; - } - if (scan != 0) - break; - } + bios_printf(BIOS_PRINTF_SCREEN | BIOS_PRINTF_INFO, + "\n\nPress F10 to select boot device.\n"); + + scan = wait(1, 0); + if (scan == 0x44) + scan = bootmenu(inb_cmos(0x3d) & 0x0f); /* set the default based on the keypress or menu */ switch(scan) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sat May 24 04:00:08 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 04:00:08 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzrTr-0004yu-Px for www-data@colo.xensource.com; Sat, 24 May 2008 04:00:08 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzrUX-0004Vv-0E; Sat, 24 May 2008 11:00:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzrUU-0004Va-RM for xen-changelog@lists.xensource.com; Sat, 24 May 2008 11:00:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzrUN-0002DU-W5 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 11:00:44 +0000 X-SBRS: 3.6 X-MesageID: 303455 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="303455" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 06:59:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4OAxo2H010579 for ; Sat, 24 May 2008 03:59:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OB09YD016979 for ; Sat, 24 May 2008 04:00:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OB09YP016978 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 04:00:09 -0700 Message-Id: <200805241100.m4OB09YP016978@xenbits.xensource.com> Date: Sat, 24 May 2008 04:00:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86_emulate: Check single-step status at instruction start rather than end. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211615699 -3600 # Node ID 30bf34f5a414d5400028ec094688be696234fcdf # Parent ef7525e87030281c74768f6310f18bf4ed44ac15 x86_emulate: Check single-step status at instruction start rather than end. This fixes booting of FreeDOS with HIMEM.SYS enabled. Signed-off-by: Trolle Selander Signed-off-by: Keir Fraser --- xen/arch/x86/x86_emulate/x86_emulate.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff -r ef7525e87030 -r 30bf34f5a414 xen/arch/x86/x86_emulate/x86_emulate.c --- a/xen/arch/x86/x86_emulate/x86_emulate.c Fri May 23 11:58:08 2008 +0100 +++ b/xen/arch/x86/x86_emulate/x86_emulate.c Sat May 24 08:54:59 2008 +0100 @@ -2105,12 +2105,14 @@ x86_emulate( break; } + /* Inject #DB if single-step tracing was enabled at instruction start. */ + if ( (ctxt->regs->eflags & EFLG_TF) && (rc == X86EMUL_OKAY) && + (ops->inject_hw_exception != NULL) ) + rc = ops->inject_hw_exception(EXC_DB, -1, ctxt) ? : X86EMUL_EXCEPTION; + /* Commit shadow register state. */ _regs.eflags &= ~EFLG_RF; *ctxt->regs = _regs; - if ( (_regs.eflags & EFLG_TF) && (rc == X86EMUL_OKAY) && - (ops->inject_hw_exception != NULL) ) - rc = ops->inject_hw_exception(EXC_DB, -1, ctxt) ? : X86EMUL_EXCEPTION; done: return rc; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sat May 24 07:00:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuI1-00087M-BX for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIh-0002eJ-4O; Sat, 24 May 2008 14:00:47 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIg-0002dO-2E for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:46 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIY-0004f1-7V for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:43 +0000 X-SBRS: 3.6 X-MesageID: 304366 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304366" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxnM9010916 for ; Sat, 24 May 2008 06:59:49 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE08uq026844 for ; Sat, 24 May 2008 07:00:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE08Q2026843 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:08 -0700 Message-Id: <200805241400.m4OE08Q2026843@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] hvm: Build guest timers on monotonic system time. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211617623 -3600 # Node ID 6c4cab061af414160b3fdafc7ca8855e3dc44af1 # Parent 30bf34f5a414d5400028ec094688be696234fcdf hvm: Build guest timers on monotonic system time. Move hvm platform timers from underlying physical CPU TSC to Xen system time and ensure domain-wide monotonicity. TSC on many systems may skew between processors leading to 'time going backwards' messages from some guests. Signed-off-by: Dan Magenheimer Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hpet.c | 18 +++++++++--------- xen/arch/x86/hvm/hvm.c | 8 +++++--- xen/arch/x86/hvm/i8254.c | 9 +++++---- xen/arch/x86/hvm/pmtimer.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 4 ++-- xen/arch/x86/hvm/vlapic.c | 1 - xen/arch/x86/hvm/vmx/vmx.c | 4 ++-- xen/arch/x86/hvm/vpt.c | 32 +++++++++++++++++++++++++++++++- xen/include/asm-x86/hvm/hvm.h | 6 ++++-- xen/include/asm-x86/hvm/vcpu.h | 3 +++ xen/include/asm-x86/hvm/vmx/vmx.h | 1 - xen/include/asm-x86/hvm/vpt.h | 7 ++++++- xen/include/xen/time.h | 1 + 13 files changed, 69 insertions(+), 27 deletions(-) diff -r 30bf34f5a414 -r 6c4cab061af4 xen/arch/x86/hvm/hpet.c --- a/xen/arch/x86/hvm/hpet.c Sat May 24 08:54:59 2008 +0100 +++ b/xen/arch/x86/hvm/hpet.c Sat May 24 09:27:03 2008 +0100 @@ -29,9 +29,9 @@ #define S_TO_NS 1000000000ULL /* 1s = 10^9 ns */ #define S_TO_FS 1000000000000000ULL /* 1s = 10^15 fs */ -/* Frequency_of_TSC / frequency_of_HPET = 32 */ -#define TSC_PER_HPET_TICK 32 -#define guest_time_hpet(v) (hvm_get_guest_time(v) / TSC_PER_HPET_TICK) +/* Frequency_of_Xen_systeme_time / frequency_of_HPET = 16 */ +#define STIME_PER_HPET_TICK 16 +#define guest_time_hpet(v) (hvm_get_guest_time(v) / STIME_PER_HPET_TICK) #define HPET_ID 0x000 #define HPET_PERIOD 0x004 @@ -192,7 +192,7 @@ static void hpet_stop_timer(HPETState *h /* the number of HPET tick that stands for * 1/(2^10) second, namely, 0.9765625 milliseconds */ -#define HPET_TINY_TIME_SPAN ((h->tsc_freq >> 10) / TSC_PER_HPET_TICK) +#define HPET_TINY_TIME_SPAN ((h->stime_freq >> 10) / STIME_PER_HPET_TICK) static void hpet_set_timer(HPETState *h, unsigned int tn) { @@ -558,17 +558,17 @@ void hpet_init(struct vcpu *v) spin_lock_init(&h->lock); h->vcpu = v; - h->tsc_freq = ticks_per_sec(v); - - h->hpet_to_ns_scale = ((S_TO_NS * TSC_PER_HPET_TICK) << 10) / h->tsc_freq; + h->stime_freq = S_TO_NS; + + h->hpet_to_ns_scale = ((S_TO_NS * STIME_PER_HPET_TICK) << 10) / h->stime_freq; h->hpet_to_ns_limit = ~0ULL / h->hpet_to_ns_scale; /* 64-bit main counter; 3 timers supported; LegacyReplacementRoute. */ h->hpet.capability = 0x8086A201ULL; /* This is the number of femptoseconds per HPET tick. */ - /* Here we define HPET's frequency to be 1/32 of the TSC's */ - h->hpet.capability |= ((S_TO_FS*TSC_PER_HPET_TICK/h->tsc_freq) << 32); + /* Here we define HPET's frequency to be 1/16 of Xen system time */ + h->hpet.capability |= ((S_TO_FS*STIME_PER_HPET_TICK/h->stime_freq) << 32); for ( i = 0; i < HPET_TIMER_NUM; i++ ) { diff -r 30bf34f5a414 -r 6c4cab061af4 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Sat May 24 08:54:59 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Sat May 24 09:27:03 2008 +0100 @@ -296,6 +296,8 @@ int hvm_domain_initialise(struct domain spin_lock_init(&d->arch.hvm_domain.irq_lock); spin_lock_init(&d->arch.hvm_domain.uc_lock); + hvm_init_guest_time(d); + d->arch.hvm_domain.params[HVM_PARAM_HPET_ENABLED] = 1; hvm_init_cacheattr_region_list(d); @@ -661,7 +663,7 @@ int hvm_vcpu_initialise(struct vcpu *v) hpet_init(v); /* Init guest TSC to start from zero. */ - hvm_set_guest_time(v, 0); + hvm_set_guest_tsc(v, 0); /* Can start up without SIPI-SIPI or setvcpucontext domctl. */ v->is_initialised = 1; @@ -1632,7 +1634,7 @@ int hvm_msr_read_intercept(struct cpu_us switch ( ecx ) { case MSR_IA32_TSC: - msr_content = hvm_get_guest_time(v); + msr_content = hvm_get_guest_tsc(v); break; case MSR_IA32_APICBASE: @@ -1725,7 +1727,7 @@ int hvm_msr_write_intercept(struct cpu_u switch ( ecx ) { case MSR_IA32_TSC: - hvm_set_guest_time(v, msr_content); + hvm_set_guest_tsc(v, msr_content); pt_reset(v); break; diff -r 30bf34f5a414 -r 6c4cab061af4 xen/arch/x86/hvm/i8254.c --- a/xen/arch/x86/hvm/i8254.c Sat May 24 08:54:59 2008 +0100 +++ b/xen/arch/x86/hvm/i8254.c Sat May 24 09:27:03 2008 +0100 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -87,7 +88,7 @@ static int pit_get_count(PITState *pit, ASSERT(spin_is_locked(&pit->lock)); d = muldiv64(hvm_get_guest_time(v) - pit->count_load_time[channel], - PIT_FREQ, ticks_per_sec(v)); + PIT_FREQ, SYSTEM_TIME_HZ); switch ( c->mode ) { @@ -118,7 +119,7 @@ static int pit_get_out(PITState *pit, in ASSERT(spin_is_locked(&pit->lock)); d = muldiv64(hvm_get_guest_time(v) - pit->count_load_time[channel], - PIT_FREQ, ticks_per_sec(v)); + PIT_FREQ, SYSTEM_TIME_HZ); switch ( s->mode ) { @@ -195,11 +196,11 @@ static void pit_load_count(PITState *pit val = 0x10000; if ( v == NULL ) - rdtscll(pit->count_load_time[channel]); + pit->count_load_time[channel] = 0; else pit->count_load_time[channel] = hvm_get_guest_time(v); s->count = val; - period = DIV_ROUND((val * 1000000000ULL), PIT_FREQ); + period = DIV_ROUND(val * SYSTEM_TIME_HZ, PIT_FREQ); if ( (v == NULL) || !is_hvm_vcpu(v) || (channel != 0) ) return; diff -r 30bf34f5a414 -r 6c4cab061af4 xen/arch/x86/hvm/pmtimer.c --- a/xen/arch/x86/hvm/pmtimer.c Sat May 24 08:54:59 2008 +0100 +++ b/xen/arch/x86/hvm/pmtimer.c Sat May 24 09:27:03 2008 +0100 @@ -257,7 +257,7 @@ void pmtimer_init(struct vcpu *v) spin_lock_init(&s->lock); - s->scale = ((uint64_t)FREQUENCE_PMTIMER << 32) / ticks_per_sec(v); + s->scale = ((uint64_t)FREQUENCE_PMTIMER << 32) / SYSTEM_TIME_HZ; s->vcpu = v; /* Intercept port I/O (need two handlers because PM1a_CNT is between diff -r 30bf34f5a414 -r 6c4cab061af4 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Sat May 24 08:54:59 2008 +0100 +++ b/xen/arch/x86/hvm/svm/svm.c Sat May 24 09:27:03 2008 +0100 @@ -299,7 +299,7 @@ static void svm_save_cpu_state(struct vc data->msr_efer = v->arch.hvm_vcpu.guest_efer; data->msr_flags = -1ULL; - data->tsc = hvm_get_guest_time(v); + data->tsc = hvm_get_guest_tsc(v); } @@ -315,7 +315,7 @@ static void svm_load_cpu_state(struct vc v->arch.hvm_vcpu.guest_efer = data->msr_efer; svm_update_guest_efer(v); - hvm_set_guest_time(v, data->tsc); + hvm_set_guest_tsc(v, data->tsc); } static void svm_save_vmcb_ctxt(struct vcpu *v, struct hvm_hw_cpu *ctxt) diff -r 30bf34f5a414 -r 6c4cab061af4 xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Sat May 24 08:54:59 2008 +0100 +++ b/xen/arch/x86/hvm/vlapic.c Sat May 24 09:27:03 2008 +0100 @@ -473,7 +473,6 @@ static uint32_t vlapic_get_tmcct(struct uint64_t counter_passed; counter_passed = ((hvm_get_guest_time(v) - vlapic->timer_last_update) - * 1000000000ULL / ticks_per_sec(v) / APIC_BUS_CYCLE_NS / vlapic->hw.timer_divisor); tmcct = tmict - counter_passed; diff -r 30bf34f5a414 -r 6c4cab061af4 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Sat May 24 08:54:59 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Sat May 24 09:27:03 2008 +0100 @@ -607,7 +607,7 @@ static void vmx_save_cpu_state(struct vc data->msr_syscall_mask = guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK]; #endif - data->tsc = hvm_get_guest_time(v); + data->tsc = hvm_get_guest_tsc(v); } static void vmx_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data) @@ -625,7 +625,7 @@ static void vmx_load_cpu_state(struct vc v->arch.hvm_vmx.shadow_gs = data->shadow_gs; #endif - hvm_set_guest_time(v, data->tsc); + hvm_set_guest_tsc(v, data->tsc); } diff -r 30bf34f5a414 -r 6c4cab061af4 xen/arch/x86/hvm/vpt.c --- a/xen/arch/x86/hvm/vpt.c Sat May 24 08:54:59 2008 +0100 +++ b/xen/arch/x86/hvm/vpt.c Sat May 24 09:27:03 2008 +0100 @@ -25,6 +25,36 @@ #define mode_is(d, name) \ ((d)->arch.hvm_domain.params[HVM_PARAM_TIMER_MODE] == HVMPTM_##name) +void hvm_init_guest_time(struct domain *d) +{ + struct pl_time *pl = &d->arch.hvm_domain.pl_time; + + spin_lock_init(&pl->pl_time_lock); + pl->stime_offset = -(u64)get_s_time(); + pl->last_guest_time = 0; +} + +u64 hvm_get_guest_time(struct vcpu *v) +{ + struct pl_time *pl = &v->domain->arch.hvm_domain.pl_time; + u64 now; + + spin_lock(&pl->pl_time_lock); + now = get_s_time() + pl->stime_offset; + if ( (int64_t)(now - pl->last_guest_time) >= 0 ) + pl->last_guest_time = now; + else + now = pl->last_guest_time; + spin_unlock(&pl->pl_time_lock); + + return now + v->arch.hvm_vcpu.stime_offset; +} + +void hvm_set_guest_time(struct vcpu *v, u64 guest_time) +{ + v->arch.hvm_vcpu.stime_offset += guest_time - hvm_get_guest_time(v); +} + static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src) { struct vcpu *v = pt->vcpu; @@ -348,7 +378,7 @@ void create_periodic_time( pt->vcpu = v; pt->last_plt_gtime = hvm_get_guest_time(pt->vcpu); pt->irq = irq; - pt->period_cycles = (u64)period * cpu_khz / 1000000L; + pt->period_cycles = (u64)period; pt->one_shot = one_shot; pt->scheduled = NOW() + period; /* diff -r 30bf34f5a414 -r 6c4cab061af4 xen/include/asm-x86/hvm/hvm.h --- a/xen/include/asm-x86/hvm/hvm.h Sat May 24 08:54:59 2008 +0100 +++ b/xen/include/asm-x86/hvm/hvm.h Sat May 24 09:27:03 2008 +0100 @@ -147,8 +147,10 @@ void hvm_send_assist_req(struct vcpu *v) void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc); u64 hvm_get_guest_tsc(struct vcpu *v); -#define hvm_set_guest_time(vcpu, gtime) hvm_set_guest_tsc(vcpu, gtime) -#define hvm_get_guest_time(vcpu) hvm_get_guest_tsc(vcpu) + +void hvm_init_guest_time(struct domain *d); +void hvm_set_guest_time(struct vcpu *v, u64 guest_time); +u64 hvm_get_guest_time(struct vcpu *v); #define hvm_paging_enabled(v) \ (!!((v)->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PG)) diff -r 30bf34f5a414 -r 6c4cab061af4 xen/include/asm-x86/hvm/vcpu.h --- a/xen/include/asm-x86/hvm/vcpu.h Sat May 24 08:54:59 2008 +0100 +++ b/xen/include/asm-x86/hvm/vcpu.h Sat May 24 09:27:03 2008 +0100 @@ -68,6 +68,9 @@ struct hvm_vcpu { struct mtrr_state mtrr; u64 pat_cr; + /* In mode delay_for_missed_ticks, VCPUs have differing guest times. */ + int64_t stime_offset; + /* Which cache mode is this VCPU in (CR0:CD/NW)? */ u8 cache_mode; diff -r 30bf34f5a414 -r 6c4cab061af4 xen/include/asm-x86/hvm/vmx/vmx.h --- a/xen/include/asm-x86/hvm/vmx/vmx.h Sat May 24 08:54:59 2008 +0100 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h Sat May 24 09:27:03 2008 +0100 @@ -49,7 +49,6 @@ void vmx_asm_do_vmentry(void); void vmx_asm_do_vmentry(void); void vmx_intr_assist(void); void vmx_do_resume(struct vcpu *); -void set_guest_time(struct vcpu *v, u64 gtime); void vmx_vlapic_msr_changed(struct vcpu *v); void vmx_realmode(struct cpu_user_regs *regs); diff -r 30bf34f5a414 -r 6c4cab061af4 xen/include/asm-x86/hvm/vpt.h --- a/xen/include/asm-x86/hvm/vpt.h Sat May 24 08:54:59 2008 +0100 +++ b/xen/include/asm-x86/hvm/vpt.h Sat May 24 09:27:03 2008 +0100 @@ -57,7 +57,7 @@ typedef struct HPETState { typedef struct HPETState { struct hpet_registers hpet; struct vcpu *vcpu; - uint64_t tsc_freq; + uint64_t stime_freq; uint64_t hpet_to_ns_scale; /* hpet ticks to ns (multiplied by 2^10) */ uint64_t hpet_to_ns_limit; /* max hpet ticks convertable to ns */ uint64_t mc_offset; @@ -137,6 +137,11 @@ struct pl_time { /* platform time */ struct RTCState vrtc; struct HPETState vhpet; struct PMTState vpmt; + /* guest_time = Xen sys time + stime_offset */ + int64_t stime_offset; + /* Ensures monotonicity in appropriate timer modes. */ + uint64_t last_guest_time; + spinlock_t pl_time_lock; }; #define ticks_per_sec(v) (v->domain->arch.hvm_domain.tsc_frequency) diff -r 30bf34f5a414 -r 6c4cab061af4 xen/include/xen/time.h --- a/xen/include/xen/time.h Sat May 24 08:54:59 2008 +0100 +++ b/xen/include/xen/time.h Sat May 24 09:27:03 2008 +0100 @@ -47,6 +47,7 @@ struct tm { }; struct tm gmtime(unsigned long t); +#define SYSTEM_TIME_HZ 1000000000ULL #define NOW() ((s_time_t)get_s_time()) #define SECONDS(_s) ((s_time_t)((_s) * 1000000000ULL)) #define MILLISECS(_ms) ((s_time_t)((_ms) * 1000000ULL)) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sat May 24 07:00:10 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:10 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuI6-00087Q-6Q for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:10 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIm-0002hs-1Q; Sat, 24 May 2008 14:00:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIj-0002f3-F8 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIZ-0004f5-PR for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:47 +0000 X-SBRS: 3.6 X-MesageID: 304367 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304367" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxoNd010919 for ; Sat, 24 May 2008 06:59:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE09DC026861 for ; Sat, 24 May 2008 07:00:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE09vS026860 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:09 -0700 Message-Id: <200805241400.m4OE09vS026860@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Cx fix - Add wrap-back calculation for 24b PM timer ticks. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211617420 -3600 # Node ID c4506386b299b481c6576676aac32c197b997d33 # Parent 6c4cab061af414160b3fdafc7ca8855e3dc44af1 Cx fix - Add wrap-back calculation for 24b PM timer ticks. Signed-off-by: Wei Gang --- xen/arch/x86/acpi/cpu_idle.c | 2 ++ 1 files changed, 2 insertions(+) diff -r 6c4cab061af4 -r c4506386b299 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Sat May 24 09:27:03 2008 +0100 +++ b/xen/arch/x86/acpi/cpu_idle.c Sat May 24 09:23:40 2008 +0100 @@ -173,6 +173,8 @@ static inline u32 ticks_elapsed(u32 t1, { if ( t2 >= t1 ) return (t2 - t1); + else if ( !(acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) ) + return (((0x00FFFFFF - t1) + t2) & 0x00FFFFFF); else return ((0xFFFFFFFF - t1) + t2); } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sat May 24 07:00:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuI9-00087T-PD for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIp-0002lM-F2; Sat, 24 May 2008 14:00:55 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIk-0002g3-I2 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIb-0004f7-K4 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:48 +0000 X-SBRS: 3.6 X-MesageID: 304368 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304368" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxpnA010922 for ; Sat, 24 May 2008 06:59:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE0AAu026878 for ; Sat, 24 May 2008 07:00:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE0AoJ026877 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:10 -0700 Message-Id: <200805241400.m4OE0AoJ026877@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: Fix width of shifted 1 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211617465 -3600 # Node ID 4c1bb3e4a5a09a5920ca6d3abdb41eca1f6efd33 # Parent c4506386b299b481c6576676aac32c197b997d33 minios: Fix width of shifted 1 Shifting 1 more that 32 bits requires 1 to be long-typed. Signed-off-by: Samuel Thibault --- extras/mini-os/hypervisor.c | 4 ++-- extras/mini-os/lib/xmalloc.c | 2 +- extras/mini-os/mm.c | 38 +++++++++++++++++++------------------- 3 files changed, 22 insertions(+), 22 deletions(-) diff -r c4506386b299 -r 4c1bb3e4a5a0 extras/mini-os/hypervisor.c --- a/extras/mini-os/hypervisor.c Sat May 24 09:23:40 2008 +0100 +++ b/extras/mini-os/hypervisor.c Sat May 24 09:24:25 2008 +0100 @@ -55,12 +55,12 @@ void do_hypervisor_callback(struct pt_re while ( l1 != 0 ) { l1i = __ffs(l1); - l1 &= ~(1 << l1i); + l1 &= ~(1UL << l1i); while ( (l2 = active_evtchns(cpu, s, l1i)) != 0 ) { l2i = __ffs(l2); - l2 &= ~(1 << l2i); + l2 &= ~(1UL << l2i); port = (l1i * (sizeof(unsigned long) * 8)) + l2i; do_event(port, regs); diff -r c4506386b299 -r 4c1bb3e4a5a0 extras/mini-os/lib/xmalloc.c --- a/extras/mini-os/lib/xmalloc.c Sat May 24 09:23:40 2008 +0100 +++ b/extras/mini-os/lib/xmalloc.c Sat May 24 09:24:25 2008 +0100 @@ -127,7 +127,7 @@ static void *xmalloc_whole_pages(size_t if ( hdr == NULL ) return NULL; - hdr->size = (1 << (pageorder + PAGE_SHIFT)); + hdr->size = (1UL << (pageorder + PAGE_SHIFT)); /* Debugging aid. */ hdr->freelist.next = hdr->freelist.prev = NULL; diff -r c4506386b299 -r 4c1bb3e4a5a0 extras/mini-os/mm.c --- a/extras/mini-os/mm.c Sat May 24 09:23:40 2008 +0100 +++ b/extras/mini-os/mm.c Sat May 24 09:24:25 2008 +0100 @@ -58,7 +58,7 @@ static unsigned long *alloc_bitmap; #define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8) #define allocated_in_map(_pn) \ -(alloc_bitmap[(_pn)/PAGES_PER_MAPWORD] & (1<<((_pn)&(PAGES_PER_MAPWORD-1)))) +(alloc_bitmap[(_pn)/PAGES_PER_MAPWORD] & (1UL<<((_pn)&(PAGES_PER_MAPWORD-1)))) /* * Hint regarding bitwise arithmetic in map_{alloc,free}: @@ -80,13 +80,13 @@ static void map_alloc(unsigned long firs if ( curr_idx == end_idx ) { - alloc_bitmap[curr_idx] |= ((1<level; count++) + for(count = 0; count < 1UL<< head->level; count++) { if(count + virt_to_pfn(head) - pfn_start < 1000) chunks[count + virt_to_pfn(head) - pfn_start] = current; @@ -235,13 +235,13 @@ static void init_page_allocator(unsigned * Next chunk is limited by alignment of min, but also * must not be bigger than remaining range. */ - for ( i = PAGE_SHIFT; (1<<(i+1)) <= range; i++ ) - if ( min & (1<level = i; @@ -280,8 +280,8 @@ unsigned long alloc_pages(int order) { /* Split into two equal parts. */ i--; - spare_ch = (chunk_head_t *)((char *)alloc_ch + (1<<(i+PAGE_SHIFT))); - spare_ct = (chunk_tail_t *)((char *)spare_ch + (1<<(i+PAGE_SHIFT)))-1; + spare_ch = (chunk_head_t *)((char *)alloc_ch + (1UL<<(i+PAGE_SHIFT))); + spare_ct = (chunk_tail_t *)((char *)spare_ch + (1UL<<(i+PAGE_SHIFT)))-1; /* Create new header for spare chunk. */ spare_ch->level = i; @@ -294,7 +294,7 @@ unsigned long alloc_pages(int order) free_head[i] = spare_ch; } - map_alloc(PHYS_PFN(to_phys(alloc_ch)), 1< Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:17 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuID-00087X-Bs for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:17 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIt-0002oa-4V; Sat, 24 May 2008 14:00:59 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIl-0002gH-9Y for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:51 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIe-0004f1-HV for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:49 +0000 X-SBRS: 3.6 X-MesageID: 304369 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304369" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxqJe010925 for ; Sat, 24 May 2008 06:59:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE0BRV026895 for ; Sat, 24 May 2008 07:00:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE0Bid026894 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:11 -0700 Message-Id: <200805241400.m4OE0Bid026894@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Remove physmap page upon granttab xfer X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211617504 -3600 # Node ID 572701272661884f40796c2090cb2c1a366b5e6a # Parent 4c1bb3e4a5a09a5920ca6d3abdb41eca1f6efd33 Remove physmap page upon granttab xfer Mapping should be removed from current domain's p2m table when doing a grant table transfer. Signed-off-by: Espen Skoglund --- xen/common/grant_table.c | 2 ++ 1 files changed, 2 insertions(+) diff -r 4c1bb3e4a5a0 -r 572701272661 xen/common/grant_table.c --- a/xen/common/grant_table.c Sat May 24 09:24:25 2008 +0100 +++ b/xen/common/grant_table.c Sat May 24 09:25:04 2008 +0100 @@ -1074,6 +1074,8 @@ gnttab_transfer( goto copyback; } + guest_physmap_remove_page(d, gop.mfn, mfn, 0); + /* Find the target domain. */ if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL) ) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sat May 24 07:00:22 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:22 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuII-00087b-6K for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:22 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIx-0002sr-WA; Sat, 24 May 2008 14:01:04 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIo-0002iy-Qw for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIh-0004f5-U4 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:52 +0000 X-SBRS: 3.6 X-MesageID: 304370 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304370" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxr4I010928 for ; Sat, 24 May 2008 06:59:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE0BPq026912 for ; Sat, 24 May 2008 07:00:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE0BoX026911 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:11 -0700 Message-Id: <200805241400.m4OE0BoX026911@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix iommu_unmap_page for VT-d X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211617668 -3600 # Node ID 5590509941b1cc12a5408d773532d9aa21e93e8e # Parent 572701272661884f40796c2090cb2c1a366b5e6a Fix iommu_unmap_page for VT-d Signed-off-by: Espen Skoglund --- xen/drivers/passthrough/vtd/iommu.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletion(-) diff -r 572701272661 -r 5590509941b1 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:25:04 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:27:48 2008 +0100 @@ -1518,6 +1518,8 @@ int intel_iommu_unmap_page(struct domain { struct acpi_drhd_unit *drhd; struct iommu *iommu; + struct dma_pte *page = NULL, *pte = NULL; + u64 pg_maddr; drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); iommu = drhd->iommu; @@ -1528,7 +1530,24 @@ int intel_iommu_unmap_page(struct domain return 0; #endif - dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K); + pg_maddr = addr_to_dma_page_maddr(d, (paddr_t)gfn << PAGE_SHIFT_4K); + if ( pg_maddr == 0 ) + return -ENOMEM; + page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); + pte = page + (gfn & LEVEL_MASK); + dma_clear_pte(*pte); + iommu_flush_cache_entry(drhd->iommu, pte); + unmap_vtd_domain_page(page); + + for_each_drhd_unit ( drhd ) + { + iommu = drhd->iommu; + if ( cap_caching_mode(iommu->cap) ) + iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), + (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0); + else if ( cap_rwbf(iommu->cap) ) + iommu_flush_write_buffer(iommu); + } return 0; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sat May 24 07:00:26 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:26 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuIL-00087e-N1 for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuJ1-0002wI-Gy; Sat, 24 May 2008 14:01:07 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIq-0002kp-JW for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIj-0004f7-19 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:54 +0000 X-SBRS: 3.6 X-MesageID: 304371 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304371" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxsqT010931 for ; Sat, 24 May 2008 06:59:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE0Cpt026929 for ; Sat, 24 May 2008 07:00:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE0CHC026928 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:12 -0700 Message-Id: <200805241400.m4OE0CHC026928@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] VT-d: Improve page table debug output X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211618105 -3600 # Node ID 36bbcc6baadf40b93372c39a387109b65dde20ad # Parent 5590509941b1cc12a5408d773532d9aa21e93e8e VT-d: Improve page table debug output Ignore 'current' domain when dumping VT-d page tables. Also add page type summary for domain pages output. Signed-off-by: Espen Skoglund --- xen/drivers/passthrough/vtd/extern.h | 3 xen/drivers/passthrough/vtd/iommu.c | 10 + xen/drivers/passthrough/vtd/utils.c | 178 ++++++++++++++++------------------- 3 files changed, 90 insertions(+), 101 deletions(-) diff -r 5590509941b1 -r 36bbcc6baadf xen/drivers/passthrough/vtd/extern.h --- a/xen/drivers/passthrough/vtd/extern.h Sat May 24 09:27:48 2008 +0100 +++ b/xen/drivers/passthrough/vtd/extern.h Sat May 24 09:35:05 2008 +0100 @@ -27,8 +27,7 @@ extern struct ir_ctrl *ir_ctrl; extern struct ir_ctrl *ir_ctrl; void print_iommu_regs(struct acpi_drhd_unit *drhd); -void print_vtd_entries(struct domain *d, struct iommu *iommu, - int bus, int devfn, unsigned long gmfn); +void print_vtd_entries(struct iommu *iommu, int bus, int devfn, u64 gmfn); void pdev_flr(u8 bus, u8 devfn); int qinval_setup(struct iommu *iommu); diff -r 5590509941b1 -r 36bbcc6baadf xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:27:48 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:35:05 2008 +0100 @@ -777,16 +777,17 @@ int iommu_disable_translation(struct iom static struct iommu *vector_to_iommu[NR_VECTORS]; static int iommu_page_fault_do_one(struct iommu *iommu, int type, - u8 fault_reason, u16 source_id, u32 addr) + u8 fault_reason, u16 source_id, u64 addr) { dprintk(XENLOG_WARNING VTDPREFIX, - "iommu_fault:%s: %x:%x.%x addr %x REASON %x iommu->reg = %p\n", + "iommu_fault:%s: %x:%x.%x addr %"PRIx64" REASON %x " + "iommu->reg = %p\n", (type ? "DMA Read" : "DMA Write"), (source_id >> 8), PCI_SLOT(source_id & 0xFF), PCI_FUNC(source_id & 0xFF), addr, fault_reason, iommu->reg); if ( fault_reason < 0x20 ) - print_vtd_entries(current->domain, iommu, (source_id >> 8), + print_vtd_entries(iommu, (source_id >> 8), (source_id & 0xff), (addr >> PAGE_SHIFT)); return 0; @@ -844,7 +845,8 @@ static void iommu_page_fault(int vector, { u8 fault_reason; u16 source_id; - u32 guest_addr, data; + u32 data; + u64 guest_addr; int type; /* highest 32 bits */ diff -r 5590509941b1 -r 36bbcc6baadf xen/drivers/passthrough/vtd/utils.c --- a/xen/drivers/passthrough/vtd/utils.c Sat May 24 09:27:48 2008 +0100 +++ b/xen/drivers/passthrough/vtd/utils.c Sat May 24 09:35:05 2008 +0100 @@ -213,109 +213,97 @@ u32 get_level_index(unsigned long gmfn, return gmfn & LEVEL_MASK; } -void print_vtd_entries( - struct domain *d, - struct iommu *iommu, - int bus, int devfn, - unsigned long gmfn) -{ - struct hvm_iommu *hd = domain_hvm_iommu(d); - struct acpi_drhd_unit *drhd; +void print_vtd_entries(struct iommu *iommu, int bus, int devfn, u64 gmfn) +{ struct context_entry *ctxt_entry; struct root_entry *root_entry; struct dma_pte pte; u64 *l; - u32 l_index; - u32 i = 0; - int level = agaw_to_level(hd->agaw); - - printk("print_vtd_entries: domain_id = %x bdf = %x:%x:%x gmfn = %lx\n", - d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn); - - if ( hd->pgd_maddr == 0 ) - { - printk(" hd->pgd_maddr == 0\n"); - return; - } - printk(" hd->pgd_maddr = %"PRIx64"\n", hd->pgd_maddr); - - for_each_drhd_unit ( drhd ) - { - printk("---- print_vtd_entries %d ----\n", i++); - - if ( iommu->root_maddr == 0 ) - { - printk(" iommu->root_maddr = 0\n"); - continue; - } - - root_entry = - (struct root_entry *)map_vtd_domain_page(iommu->root_maddr); + u32 l_index, level; + + printk("print_vtd_entries: iommu = %p bdf = %x:%x:%x gmfn = %"PRIx64"\n", + iommu, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn); + + if ( iommu->root_maddr == 0 ) + { + printk(" iommu->root_maddr = 0\n"); + return; + } + + root_entry = (struct root_entry *)map_vtd_domain_page(iommu->root_maddr); - printk(" root_entry = %p\n", root_entry); - printk(" root_entry[%x] = %"PRIx64"\n", bus, root_entry[bus].val); - if ( !root_present(root_entry[bus]) ) - { - unmap_vtd_domain_page(root_entry); - printk(" root_entry[%x] not present\n", bus); - continue; - } - - ctxt_entry = - (struct context_entry *)map_vtd_domain_page(root_entry[bus].val); - if ( ctxt_entry == NULL ) - { - unmap_vtd_domain_page(root_entry); - printk(" ctxt_entry == NULL\n"); - continue; - } - - printk(" context = %p\n", ctxt_entry); - printk(" context[%x] = %"PRIx64" %"PRIx64"\n", - devfn, ctxt_entry[devfn].hi, ctxt_entry[devfn].lo); - if ( !context_present(ctxt_entry[devfn]) ) + printk(" root_entry = %p\n", root_entry); + printk(" root_entry[%x] = %"PRIx64"\n", bus, root_entry[bus].val); + if ( !root_present(root_entry[bus]) ) + { + unmap_vtd_domain_page(root_entry); + printk(" root_entry[%x] not present\n", bus); + return; + } + + ctxt_entry = + (struct context_entry *)map_vtd_domain_page(root_entry[bus].val); + if ( ctxt_entry == NULL ) + { + unmap_vtd_domain_page(root_entry); + printk(" ctxt_entry == NULL\n"); + return; + } + + printk(" context = %p\n", ctxt_entry); + printk(" context[%x] = %"PRIx64"_%"PRIx64"\n", + devfn, ctxt_entry[devfn].hi, ctxt_entry[devfn].lo); + if ( !context_present(ctxt_entry[devfn]) ) + { + unmap_vtd_domain_page(ctxt_entry); + unmap_vtd_domain_page(root_entry); + printk(" ctxt_entry[%x] not present\n", devfn); + return; + } + + level = agaw_to_level(context_address_width(ctxt_entry[devfn])); + if ( level != VTD_PAGE_TABLE_LEVEL_3 && + level != VTD_PAGE_TABLE_LEVEL_4) + { + unmap_vtd_domain_page(ctxt_entry); + unmap_vtd_domain_page(root_entry); + printk("Unsupported VTD page table level (%d)!\n", level); + } + + l = maddr_to_virt(ctxt_entry[devfn].lo); + do + { + l = (u64*)(((unsigned long)l >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); + printk(" l%d = %p\n", level, l); + if ( l == NULL ) { unmap_vtd_domain_page(ctxt_entry); unmap_vtd_domain_page(root_entry); - printk(" ctxt_entry[%x] not present\n", devfn); - continue; - } - - if ( level != VTD_PAGE_TABLE_LEVEL_3 && - level != VTD_PAGE_TABLE_LEVEL_4) + printk(" l%d == NULL\n", level); + break; + } + l_index = get_level_index(gmfn, level); + printk(" l%d_index = %x\n", level, l_index); + printk(" l%d[%x] = %"PRIx64"\n", level, l_index, l[l_index]); + + pte.val = l[l_index]; + if ( !dma_pte_present(pte) ) { unmap_vtd_domain_page(ctxt_entry); unmap_vtd_domain_page(root_entry); - printk("Unsupported VTD page table level (%d)!\n", level); - continue; - } - - l = maddr_to_virt(ctxt_entry[devfn].lo); - do - { - l = (u64*)(((unsigned long)l >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K); - printk(" l%d = %p\n", level, l); - if ( l == NULL ) - { - unmap_vtd_domain_page(ctxt_entry); - unmap_vtd_domain_page(root_entry); - printk(" l%d == NULL\n", level); - break; - } - l_index = get_level_index(gmfn, level); - printk(" l%d_index = %x\n", level, l_index); - printk(" l%d[%x] = %"PRIx64"\n", level, l_index, l[l_index]); - - pte.val = l[l_index]; - if ( !dma_pte_present(pte) ) - { - unmap_vtd_domain_page(ctxt_entry); - unmap_vtd_domain_page(root_entry); - printk(" l%d[%x] not present\n", level, l_index); - break; - } - - l = maddr_to_virt(l[l_index]); - } while ( --level ); - } -} + printk(" l%d[%x] not present\n", level, l_index); + break; + } + + l = maddr_to_virt(l[l_index]); + } while ( --level ); +} + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sat May 24 07:00:29 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:29 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuIP-00087j-4Y for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:29 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuJ4-0002zf-SK; Sat, 24 May 2008 14:01:10 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIs-0002mW-Hn for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIj-0004f1-Mh for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:56 +0000 X-SBRS: 3.6 X-MesageID: 304372 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304372" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxt8c010934 for ; Sat, 24 May 2008 06:59:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE0DJc026946 for ; Sat, 24 May 2008 07:00:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE0DYs026945 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:13 -0700 Message-Id: <200805241400.m4OE0DYs026945@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Enable IOMMU for PV guests X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211618255 -3600 # Node ID 62f1c837057f33e1e58f90bbe90f33335a89558f # Parent 36bbcc6baadf40b93372c39a387109b65dde20ad Enable IOMMU for PV guests Introduce 'iommu_pv' boot parameter (default off). Added a need_iommu flag which is set if guest has PCI devices assigned. IOMMU page tables are populated with current guest memory when IOMMU is first enabled for the guest. Signed-off-by: Espen Skoglund --- xen/drivers/passthrough/iommu.c | 73 +++++++++++++++++++++++++++++++++--- xen/drivers/passthrough/vtd/iommu.c | 37 +++++++++++------- xen/include/xen/hvm/iommu.h | 3 + xen/include/xen/iommu.h | 1 xen/include/xen/sched.h | 3 + 5 files changed, 97 insertions(+), 20 deletions(-) diff -r 36bbcc6baadf -r 62f1c837057f xen/drivers/passthrough/iommu.c --- a/xen/drivers/passthrough/iommu.c Sat May 24 09:35:05 2008 +0100 +++ b/xen/drivers/passthrough/iommu.c Sat May 24 09:37:35 2008 +0100 @@ -15,14 +15,19 @@ #include #include +#include extern struct iommu_ops intel_iommu_ops; extern struct iommu_ops amd_iommu_ops; +static int iommu_populate_page_table(struct domain *d); int intel_vtd_setup(void); int amd_iov_detect(void); int iommu_enabled = 1; boolean_param("iommu", iommu_enabled); + +int iommu_pv_enabled = 0; +boolean_param("iommu_pv", iommu_pv_enabled); int iommu_domain_init(struct domain *domain) { @@ -54,11 +59,46 @@ int assign_device(struct domain *d, u8 b int assign_device(struct domain *d, u8 bus, u8 devfn) { struct hvm_iommu *hd = domain_hvm_iommu(d); - - if ( !iommu_enabled || !hd->platform_ops ) - return 0; - - return hd->platform_ops->assign_device(d, bus, devfn); + int rc; + + if ( !iommu_enabled || !hd->platform_ops ) + return 0; + + if ( (rc = hd->platform_ops->assign_device(d, bus, devfn)) ) + return rc; + + if ( has_iommu_pdevs(d) && !need_iommu(d) ) + { + d->need_iommu = 1; + return iommu_populate_page_table(d); + } + return 0; +} + +static int iommu_populate_page_table(struct domain *d) +{ + struct hvm_iommu *hd = domain_hvm_iommu(d); + struct page_info *page; + int rc; + + spin_lock(&d->page_alloc_lock); + + list_for_each_entry ( page, &d->page_list, list ) + { + if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) + { + rc = hd->platform_ops->map_page( + d, mfn_to_gmfn(d, page_to_mfn(page)), page_to_mfn(page)); + if (rc) + { + spin_unlock(&d->page_alloc_lock); + hd->platform_ops->teardown(d); + return rc; + } + } + } + spin_unlock(&d->page_alloc_lock); + return 0; } void iommu_domain_destroy(struct domain *d) @@ -137,7 +177,13 @@ void deassign_device(struct domain *d, u if ( !iommu_enabled || !hd->platform_ops ) return; - return hd->platform_ops->reassign_device(d, dom0, bus, devfn); + hd->platform_ops->reassign_device(d, dom0, bus, devfn); + + if ( !has_iommu_pdevs(d) && need_iommu(d) ) + { + d->need_iommu = 0; + hd->platform_ops->teardown(d); + } } static int iommu_setup(void) @@ -160,7 +206,22 @@ static int iommu_setup(void) iommu_enabled = (rc == 0); out: + if ( !iommu_enabled || !vtd_enabled ) + iommu_pv_enabled = 0; printk("I/O virtualisation %sabled\n", iommu_enabled ? "en" : "dis"); + if (iommu_enabled) + printk("I/O virtualisation for PV guests %sabled\n", + iommu_pv_enabled ? "en" : "dis"); return rc; } __initcall(iommu_setup); + + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff -r 36bbcc6baadf -r 62f1c837057f xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:35:05 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:37:35 2008 +0100 @@ -1138,26 +1138,35 @@ static int domain_context_mapping_one( } spin_lock_irqsave(&iommu->lock, flags); + +#ifdef CONTEXT_PASSTHRU + if ( ecap_pass_thru(iommu->ecap) && (domain->domain_id == 0) ) + context_set_translation_type(*context, CONTEXT_TT_PASS_THRU); + else + { +#endif + if ( hd->pgd_maddr == 0 ) + { + hd->pgd_maddr = alloc_pgtable_maddr(); + if ( hd->pgd_maddr == 0 ) + { + unmap_vtd_domain_page(context_entries); + spin_unlock_irqrestore(&iommu->lock, flags); + return -ENOMEM; + } + } + context_set_address_root(*context, hd->pgd_maddr); + context_set_translation_type(*context, CONTEXT_TT_MULTI_LEVEL); +#ifdef CONTEXT_PASSTHRU + } +#endif + /* * domain_id 0 is not valid on Intel's IOMMU, force domain_id to * be 1 based as required by intel's iommu hw. */ context_set_domain_id(context, domain); context_set_address_width(*context, hd->agaw); - - if ( ecap_pass_thru(iommu->ecap) ) - context_set_translation_type(*context, CONTEXT_TT_PASS_THRU); -#ifdef CONTEXT_PASSTHRU - else - { -#endif - ASSERT(hd->pgd_maddr != 0); - context_set_address_root(*context, hd->pgd_maddr); - context_set_translation_type(*context, CONTEXT_TT_MULTI_LEVEL); -#ifdef CONTEXT_PASSTHRU - } -#endif - context_set_fault_enable(*context); context_set_present(*context); iommu_flush_cache_entry(iommu, context); diff -r 36bbcc6baadf -r 62f1c837057f xen/include/xen/hvm/iommu.h --- a/xen/include/xen/hvm/iommu.h Sat May 24 09:35:05 2008 +0100 +++ b/xen/include/xen/hvm/iommu.h Sat May 24 09:37:35 2008 +0100 @@ -54,4 +54,7 @@ struct hvm_iommu { struct iommu_ops *platform_ops; }; +#define has_iommu_pdevs(domain) \ + (!list_empty(&(domain->arch.hvm_domain.hvm_iommu.pdev_list))) + #endif /* __ASM_X86_HVM_IOMMU_H__ */ diff -r 36bbcc6baadf -r 62f1c837057f xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Sat May 24 09:35:05 2008 +0100 +++ b/xen/include/xen/iommu.h Sat May 24 09:37:35 2008 +0100 @@ -29,6 +29,7 @@ extern int vtd_enabled; extern int iommu_enabled; +extern int iommu_pv_enabled; #define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu) #define domain_vmx_iommu(d) (&d->arch.hvm_domain.hvm_iommu.vmx_iommu) diff -r 36bbcc6baadf -r 62f1c837057f xen/include/xen/sched.h --- a/xen/include/xen/sched.h Sat May 24 09:35:05 2008 +0100 +++ b/xen/include/xen/sched.h Sat May 24 09:37:35 2008 +0100 @@ -186,6 +186,8 @@ struct domain /* Is this an HVM guest? */ bool_t is_hvm; + /* Does this guest need iommu mappings? */ + bool_t need_iommu; /* Is this guest fully privileged (aka dom0)? */ bool_t is_privileged; /* Which guest this guest has privileges on */ @@ -515,6 +517,7 @@ static inline void vcpu_unblock(struct v #define is_hvm_domain(d) ((d)->is_hvm) #define is_hvm_vcpu(v) (is_hvm_domain(v->domain)) +#define need_iommu(d) ((d)->need_iommu && !(d)->is_hvm) extern enum cpufreq_controller { FREQCTL_none, FREQCTL_dom0_kernel _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Sat May 24 07:00:32 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:32 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuIS-00087m-8s for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:32 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuJ8-00032p-48; Sat, 24 May 2008 14:01:14 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIt-0002no-R9 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:59 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIn-0004f5-A1 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:00:57 +0000 X-SBRS: 3.6 X-MesageID: 304373 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304373" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxufd010937 for ; Sat, 24 May 2008 06:59:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE0EpJ026963 for ; Sat, 24 May 2008 07:00:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE0EaI026962 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:14 -0700 Message-Id: <200805241400.m4OE0EaI026962@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Handle dynamic IOMMU map/unmap for guests X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211618522 -3600 # Node ID c684cf331f94573ff5829d9701141cf17414b2b8 # Parent 62f1c837057f33e1e58f90bbe90f33335a89558f Handle dynamic IOMMU map/unmap for guests Perform IOMMU map/unmap when (a) frame type changes, (b) memory reservation changes, and (c) a grant reference is newly mapped or completely unmapped from a domain. Signed-off-by: Espen Skoglund --- xen/arch/x86/mm.c | 14 +++++++++++++ xen/arch/x86/mm/p2m.c | 21 +++++++++++++++++-- xen/common/grant_table.c | 50 ++++++++++++++++++++++++++++++++++++++++------- xen/common/memory.c | 17 +++++---------- 4 files changed, 82 insertions(+), 20 deletions(-) diff -r 62f1c837057f -r c684cf331f94 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Sat May 24 09:37:35 2008 +0100 +++ b/xen/arch/x86/mm.c Sat May 24 09:42:02 2008 +0100 @@ -1939,6 +1939,20 @@ int get_page_type(struct page_info *page } while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) ); + if ( unlikely((x & PGT_type_mask) != type) ) + { + /* Special pages should not be accessible from devices. */ + struct domain *d = page_get_owner(page); + if ( d && unlikely(need_iommu(d)) ) + { + if ( (x & PGT_type_mask) == PGT_writable_page ) + iommu_unmap_page(d, mfn_to_gmfn(d, page_to_mfn(page))); + else if ( type == PGT_writable_page ) + iommu_map_page(d, mfn_to_gmfn(d, page_to_mfn(page)), + page_to_mfn(page)); + } + } + if ( unlikely(!(nx & PGT_validated)) ) { /* Try to validate page type; drop the new reference on failure. */ diff -r 62f1c837057f -r c684cf331f94 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Sat May 24 09:37:35 2008 +0100 +++ b/xen/arch/x86/mm/p2m.c Sat May 24 09:42:02 2008 +0100 @@ -325,7 +325,7 @@ p2m_set_entry(struct domain *d, unsigned if ( mfn_valid(mfn) && (gfn > d->arch.p2m->max_mapped_pfn) ) d->arch.p2m->max_mapped_pfn = gfn; - if ( iommu_enabled && is_hvm_domain(d) ) + if ( iommu_enabled && (is_hvm_domain(d) || need_iommu(d)) ) { if ( p2mt == p2m_ram_rw ) for ( i = 0; i < (1UL << page_order); i++ ) @@ -868,7 +868,12 @@ p2m_remove_page(struct domain *d, unsign unsigned long i; if ( !paging_mode_translate(d) ) + { + if ( need_iommu(d) ) + for ( i = 0; i < (1 << page_order); i++ ) + iommu_unmap_page(d, mfn + i); return; + } P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn, mfn); @@ -899,7 +904,19 @@ guest_physmap_add_entry(struct domain *d int rc = 0; if ( !paging_mode_translate(d) ) - return -EINVAL; + { + if ( need_iommu(d) && t == p2m_ram_rw ) + { + for ( i = 0; i < (1 << page_order); i++ ) + if ( (rc = iommu_map_page(d, mfn + i, mfn + i)) != 0 ) + { + while ( i-- > 0 ) + iommu_unmap_page(d, mfn + i); + return rc; + } + } + return 0; + } #if CONFIG_PAGING_LEVELS == 3 /* diff -r 62f1c837057f -r c684cf331f94 xen/common/grant_table.c --- a/xen/common/grant_table.c Sat May 24 09:37:35 2008 +0100 +++ b/xen/common/grant_table.c Sat May 24 09:42:02 2008 +0100 @@ -196,8 +196,9 @@ __gnttab_map_grant_ref( struct domain *ld, *rd; struct vcpu *led; int handle; - unsigned long frame = 0; + unsigned long frame = 0, nr_gets = 0; int rc = GNTST_okay; + u32 old_pin; unsigned int cache_flags; struct active_grant_entry *act; struct grant_mapping *mt; @@ -318,6 +319,7 @@ __gnttab_map_grant_ref( } } + old_pin = act->pin; if ( op->flags & GNTMAP_device_map ) act->pin += (op->flags & GNTMAP_readonly) ? GNTPIN_devr_inc : GNTPIN_devw_inc; @@ -361,20 +363,17 @@ __gnttab_map_grant_ref( rc = GNTST_general_error; goto undo_out; } - + + nr_gets++; if ( op->flags & GNTMAP_host_map ) { rc = create_grant_host_mapping(op->host_addr, frame, op->flags, 0); if ( rc != GNTST_okay ) - { - if ( gnttab_host_mapping_get_page_type(op, ld, rd) ) - put_page_type(mfn_to_page(frame)); - put_page(mfn_to_page(frame)); goto undo_out; - } if ( op->flags & GNTMAP_device_map ) { + nr_gets++; (void)get_page(mfn_to_page(frame), rd); if ( !(op->flags & GNTMAP_readonly) ) get_page_type(mfn_to_page(frame), PGT_writable_page); @@ -382,6 +381,17 @@ __gnttab_map_grant_ref( } } + if ( need_iommu(ld) && + !(old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) && + (act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) ) + { + if ( iommu_map_page(ld, mfn_to_gmfn(ld, frame), frame) ) + { + rc = GNTST_general_error; + goto undo_out; + } + } + TRACE_1D(TRC_MEM_PAGE_GRANT_MAP, op->dom); mt = &maptrack_entry(ld->grant_table, handle); @@ -397,6 +407,19 @@ __gnttab_map_grant_ref( return; undo_out: + if ( nr_gets > 1 ) + { + if ( !(op->flags & GNTMAP_readonly) ) + put_page_type(mfn_to_page(frame)); + put_page(mfn_to_page(frame)); + } + if ( nr_gets > 0 ) + { + if ( gnttab_host_mapping_get_page_type(op, ld, rd) ) + put_page_type(mfn_to_page(frame)); + put_page(mfn_to_page(frame)); + } + spin_lock(&rd->grant_table->lock); act = &active_entry(rd->grant_table, op->ref); @@ -451,6 +474,7 @@ __gnttab_unmap_common( struct active_grant_entry *act; grant_entry_t *sha; s16 rc = 0; + u32 old_pin; ld = current->domain; @@ -497,6 +521,7 @@ __gnttab_unmap_common( act = &active_entry(rd->grant_table, op->map->ref); sha = &shared_entry(rd->grant_table, op->map->ref); + old_pin = act->pin; if ( op->frame == 0 ) { @@ -532,6 +557,17 @@ __gnttab_unmap_common( act->pin -= GNTPIN_hstr_inc; else act->pin -= GNTPIN_hstw_inc; + } + + if ( need_iommu(ld) && + (old_pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) && + !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask)) ) + { + if ( iommu_unmap_page(ld, mfn_to_gmfn(ld, op->frame)) ) + { + rc = GNTST_general_error; + goto unmap_out; + } } /* If just unmapped a writable mapping, mark as dirtied */ diff -r 62f1c837057f -r c684cf331f94 xen/common/memory.c --- a/xen/common/memory.c Sat May 24 09:37:35 2008 +0100 +++ b/xen/common/memory.c Sat May 24 09:42:02 2008 +0100 @@ -124,12 +124,9 @@ static void populate_physmap(struct memo } mfn = page_to_mfn(page); - - if ( unlikely(paging_mode_translate(d)) ) - { - guest_physmap_add_page(d, gpfn, mfn, a->extent_order); - } - else + guest_physmap_add_page(d, gpfn, mfn, a->extent_order); + + if ( !paging_mode_translate(d) ) { for ( j = 0; j < (1 << a->extent_order); j++ ) set_gpfn_from_mfn(mfn + j, gpfn + j); @@ -436,11 +433,9 @@ static long memory_exchange(XEN_GUEST_HA &gpfn, exch.out.extent_start, (i< Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 24 May 2008 07:00:37 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1JzuIW-00087p-K7 for www-data@colo.xensource.com; Sat, 24 May 2008 07:00:37 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuJC-00036u-Fq; Sat, 24 May 2008 14:01:18 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1JzuIw-0002qH-9g for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:01:02 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1JzuIp-0004f7-2V for xen-changelog@lists.xensource.com; Sat, 24 May 2008 14:01:00 +0000 X-SBRS: 3.6 X-MesageID: 304374 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,535,1204520400"; d="scan'208";a="304374" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 24 May 2008 09:59:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4ODxv0n010940 for ; Sat, 24 May 2008 06:59:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4OE0FXP026980 for ; Sat, 24 May 2008 07:00:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4OE0Fmf026979 for xen-changelog@lists.xensource.com; Sat, 24 May 2008 07:00:15 -0700 Message-Id: <200805241400.m4OE0Fmf026979@xenbits.xensource.com> Date: Sat, 24 May 2008 07:00:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Handle IOMMU device assignment for PV guests X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211618737 -3600 # Node ID 28083093cc5de08465c60793a02089a4745ebf3a # Parent c684cf331f94573ff5829d9701141cf17414b2b8 Handle IOMMU device assignment for PV guests Added more informative error codes for device assignment domctls. Introduced python bindings for device assignment and enable xend to also perform IOMMU device assignment when assigning PCI devices. Signed-off-by: Espen Skoglund --- tools/python/xen/lowlevel/xc/xc.c | 155 ++++++++++++++++++++++++++-------- tools/python/xen/xend/server/pciif.py | 17 +++ xen/arch/x86/domctl.c | 24 ++++- 3 files changed, 156 insertions(+), 40 deletions(-) diff -r c684cf331f94 -r 28083093cc5d tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Sat May 24 09:42:02 2008 +0100 +++ b/tools/python/xen/lowlevel/xc/xc.c Sat May 24 09:45:37 2008 +0100 @@ -106,7 +106,7 @@ static PyObject *pyxc_domain_create(XcOb static char *kwd_list[] = { "domid", "ssidref", "handle", "flags", "target", NULL }; if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|iiOii", kwd_list, - &dom, &ssidref, &pyhandle, &flags, &target)) + &dom, &ssidref, &pyhandle, &flags, &target)) return NULL; if ( pyhandle != NULL ) { @@ -434,44 +434,44 @@ static PyObject *pyxc_linux_build(XcObje dom->vhpt_size_log2 = vhpt; if ( xc_dom_linux_build(self->xc_handle, dom, domid, mem_mb, image, - ramdisk, flags, store_evtchn, &store_mfn, - console_evtchn, &console_mfn) != 0 ) { - goto out; + ramdisk, flags, store_evtchn, &store_mfn, + console_evtchn, &console_mfn) != 0 ) { + goto out; } if ( !(elfnote_dict = PyDict_New()) ) - goto out; + goto out; for ( i = 0; i < ARRAY_SIZE(dom->parms.elf_notes); i++ ) { - switch ( dom->parms.elf_notes[i].type ) + switch ( dom->parms.elf_notes[i].type ) { - case XEN_ENT_NONE: - continue; - case XEN_ENT_LONG: - elfnote = Py_BuildValue("k", dom->parms.elf_notes[i].data.num); - break; - case XEN_ENT_STR: - elfnote = Py_BuildValue("s", dom->parms.elf_notes[i].data.str); - break; - } - PyDict_SetItemString(elfnote_dict, - dom->parms.elf_notes[i].name, - elfnote); - Py_DECREF(elfnote); + case XEN_ENT_NONE: + continue; + case XEN_ENT_LONG: + elfnote = Py_BuildValue("k", dom->parms.elf_notes[i].data.num); + break; + case XEN_ENT_STR: + elfnote = Py_BuildValue("s", dom->parms.elf_notes[i].data.str); + break; + } + PyDict_SetItemString(elfnote_dict, + dom->parms.elf_notes[i].name, + elfnote); + Py_DECREF(elfnote); } ret = Py_BuildValue("{s:i,s:i,s:N}", - "store_mfn", store_mfn, - "console_mfn", console_mfn, - "notes", elfnote_dict); + "store_mfn", store_mfn, + "console_mfn", console_mfn, + "notes", elfnote_dict); if ( dom->arch_hooks->native_protocol ) { - PyObject *native_protocol = - Py_BuildValue("s", dom->arch_hooks->native_protocol); - PyDict_SetItemString(ret, "native_protocol", native_protocol); - Py_DECREF(native_protocol); + PyObject *native_protocol = + Py_BuildValue("s", dom->arch_hooks->native_protocol); + PyDict_SetItemString(ret, "native_protocol", native_protocol); + Py_DECREF(native_protocol); } xc_dom_release(dom); @@ -556,7 +556,7 @@ static PyObject *pyxc_test_assign_device { uint32_t dom; char *pci_str; - uint32_t bdf = 0; + int32_t bdf = 0; int seg, bus, dev, func; static char *kwd_list[] = { "domid", "pci", NULL }; @@ -571,8 +571,75 @@ static PyObject *pyxc_test_assign_device bdf |= (func & 0x7) << 8; if ( xc_test_assign_device(self->xc_handle, dom, bdf) != 0 ) + { + if (errno == ENOSYS) + bdf = -1; break; - + } + bdf = 0; + } + + return Py_BuildValue("i", bdf); +} + +static PyObject *pyxc_assign_device(XcObject *self, + PyObject *args, + PyObject *kwds) +{ + uint32_t dom; + char *pci_str; + int32_t bdf = 0; + int seg, bus, dev, func; + + static char *kwd_list[] = { "domid", "pci", NULL }; + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list, + &dom, &pci_str) ) + return NULL; + + while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) ) + { + bdf |= (bus & 0xff) << 16; + bdf |= (dev & 0x1f) << 11; + bdf |= (func & 0x7) << 8; + + if ( xc_assign_device(self->xc_handle, dom, bdf) != 0 ) + { + if (errno == ENOSYS) + bdf = -1; + break; + } + bdf = 0; + } + + return Py_BuildValue("i", bdf); +} + +static PyObject *pyxc_deassign_device(XcObject *self, + PyObject *args, + PyObject *kwds) +{ + uint32_t dom; + char *pci_str; + int32_t bdf = 0; + int seg, bus, dev, func; + + static char *kwd_list[] = { "domid", "pci", NULL }; + if ( !PyArg_ParseTupleAndKeywords(args, kwds, "is", kwd_list, + &dom, &pci_str) ) + return NULL; + + while ( next_bdf(&pci_str, &seg, &bus, &dev, &func) ) + { + bdf |= (bus & 0xff) << 16; + bdf |= (dev & 0x1f) << 11; + bdf |= (func & 0x7) << 8; + + if ( xc_deassign_device(self->xc_handle, dom, bdf) != 0 ) + { + if (errno == ENOSYS) + bdf = -1; + break; + } bdf = 0; } @@ -729,8 +796,8 @@ static PyObject *pyxc_hvm_build(XcObject int memsize, vcpus = 1, acpi = 0, apic = 1; static char *kwd_list[] = { "domid", - "memsize", "image", "vcpus", "acpi", - "apic", NULL }; + "memsize", "image", "vcpus", "acpi", + "apic", NULL }; if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iis|iii", kwd_list, &dom, &memsize, &image, &vcpus, &acpi, &apic) ) @@ -782,8 +849,8 @@ static PyObject *pyxc_evtchn_alloc_unbou } static PyObject *pyxc_evtchn_reset(XcObject *self, - PyObject *args, - PyObject *kwds) + PyObject *args, + PyObject *kwds) { uint32_t dom; @@ -947,11 +1014,11 @@ static PyObject *pyxc_physinfo(XcObject for ( i = 0; i < info.nr_nodes; i++ ) { - xc_availheap(self->xc_handle, 0, 0, i, &free_heap); - PyList_Append(node_to_memory_obj, - PyInt_FromLong(free_heap / 1024)); + xc_availheap(self->xc_handle, 0, 0, i, &free_heap); + PyList_Append(node_to_memory_obj, + PyInt_FromLong(free_heap / 1024)); } - + PyDict_SetItemString(ret_obj, "node_to_cpu", node_to_cpu_obj); PyDict_SetItemString(ret_obj, "node_to_memory", node_to_memory_obj); @@ -1524,6 +1591,22 @@ static PyMethodDef pyxc_methods[] = { " dom [int]: Identifier of domain to build into.\n" " pci_str [str]: PCI devices.\n" "Returns: [int] 0 on success, or device bdf that can't be assigned.\n" }, + + { "assign_device", + (PyCFunction)pyxc_assign_device, + METH_VARARGS | METH_KEYWORDS, "\n" + "Assign device to IOMMU domain.\n" + " dom [int]: Domain to assign device to.\n" + " pci_str [str]: PCI devices.\n" + "Returns: [int] 0 on success, or device bdf that can't be assigned.\n" }, + + { "deassign_device", + (PyCFunction)pyxc_deassign_device, + METH_VARARGS | METH_KEYWORDS, "\n" + "Deassign device from IOMMU domain.\n" + " dom [int]: Domain to deassign device from.\n" + " pci_str [str]: PCI devices.\n" + "Returns: [int] 0 on success, or device bdf that can't be deassigned.\n" }, { "sched_id_get", (PyCFunction)pyxc_sched_id_get, diff -r c684cf331f94 -r 28083093cc5d tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Sat May 24 09:42:02 2008 +0100 +++ b/tools/python/xen/xend/server/pciif.py Sat May 24 09:45:37 2008 +0100 @@ -248,6 +248,15 @@ class PciController(DevController): PCIQuirk(dev.vendor, dev.device, dev.subvendor, dev.subdevice, domain, bus, slot, func) + if not self.vm.info.is_hvm(): + # Setup IOMMU device assignment + pci_str = "0x%x, 0x%x, 0x%x, 0x%x" % (domain, bus, slot, func) + bdf = xc.assign_device(fe_domid, pci_str) + if bdf > 0: + raise VmError("Failed to assign device to IOMMU (%x:%x.%x)" + % (bus, slot, func)) + log.debug("pci: assign device %x:%x.%x" % (bus, slot, func)) + for (start, size) in dev.ioports: log.debug('pci: enabling ioport 0x%x/0x%x'%(start,size)) rc = xc.domain_ioport_permission(domid = fe_domid, first_port = start, @@ -329,6 +338,14 @@ class PciController(DevController): "command-line parameter or\n"+ \ "bind your slot/device to the PCI backend using sysfs" \ )%(dev.name)) + + if not self.vm.info.is_hvm(): + pci_str = "0x%x, 0x%x, 0x%x, 0x%x" % (domain, bus, slot, func) + bdf = xc.deassign_device(fe_domid, pci_str) + if bdf > 0: + raise VmError("Failed to deassign device from IOMMU (%x:%x.%x)" + % (bus, slot, func)) + log.debug("pci: deassign device %x:%x.%x" % (bus, slot, func)) for (start, size) in dev.ioports: log.debug('pci: disabling ioport 0x%x/0x%x'%(start,size)) diff -r c684cf331f94 -r 28083093cc5d xen/arch/x86/domctl.c --- a/xen/arch/x86/domctl.c Sat May 24 09:42:02 2008 +0100 +++ b/xen/arch/x86/domctl.c Sat May 24 09:45:37 2008 +0100 @@ -530,10 +530,11 @@ long arch_do_domctl( { u8 bus, devfn; - ret = -EINVAL; + ret = -ENOSYS; if ( !iommu_enabled ) break; + ret = -EINVAL; bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff; devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff; @@ -553,10 +554,11 @@ long arch_do_domctl( struct domain *d; u8 bus, devfn; - ret = -EINVAL; + ret = -ENOSYS; if ( !iommu_enabled ) break; + ret = -EINVAL; if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) ) { gdprintk(XENLOG_ERR, @@ -565,6 +567,12 @@ long arch_do_domctl( } bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff; devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff; + + if ( !iommu_pv_enabled && !is_hvm_domain(d) ) + { + ret = -ENOSYS; + break; + } if ( device_assigned(bus, devfn) ) { @@ -576,7 +584,7 @@ long arch_do_domctl( ret = assign_device(d, bus, devfn); gdprintk(XENLOG_INFO, "XEN_DOMCTL_assign_device: bdf = %x:%x:%x\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); + bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); put_domain(d); } break; @@ -586,10 +594,11 @@ long arch_do_domctl( struct domain *d; u8 bus, devfn; - ret = -EINVAL; + ret = -ENOSYS; if ( !iommu_enabled ) break; + ret = -EINVAL; if ( unlikely((d = get_domain_by_id(domctl->domain)) == NULL) ) { gdprintk(XENLOG_ERR, @@ -599,9 +608,16 @@ long arch_do_domctl( bus = (domctl->u.assign_device.machine_bdf >> 16) & 0xff; devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff; + if ( !iommu_pv_enabled && !is_hvm_domain(d) ) + { + ret = -ENOSYS; + break; + } + if ( !device_assigned(bus, devfn) ) break; + ret = 0; deassign_device(d, bus, devfn); gdprintk(XENLOG_INFO, "XEN_DOMCTL_deassign_device: bdf = %x:%x:%x\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 26 01:00:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 26 May 2008 01:00:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0Xck-0005mT-Uv for www-data@colo.xensource.com; Mon, 26 May 2008 01:00:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0XdQ-0003Se-VA; Mon, 26 May 2008 08:00:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0XdP-0003SL-4A for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0XdI-0007AZ-9j for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:45 +0000 X-SBRS: 3.6 X-MesageID: 316711 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,541,1204520400"; d="scan'208";a="316711" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 May 2008 03:59:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q7xpkF014143 for ; Mon, 26 May 2008 00:59:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q809nu003875 for ; Mon, 26 May 2008 01:00:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4Q809bh003874 for xen-changelog@lists.xensource.com; Mon, 26 May 2008 01:00:09 -0700 Message-Id: <200805260800.m4Q809bh003874@xenbits.xensource.com> Date: Mon, 26 May 2008 01:00:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] VT-d: remove Xen and tboot range from dom0's VT-d table X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211786695 -3600 # Node ID c0c0f4fa88509b6f5e4fa9bf0687c7a6df53eeb8 # Parent 28083093cc5de08465c60793a02089a4745ebf3a VT-d: remove Xen and tboot range from dom0's VT-d table This a step forward to fix the security hole introduced by dom0's 1:1 mapping VT-d table: remove the critical code and data from it. The more flexible solution is to update dom0's VT-d table on demand as what will be done for other PV domains. However, there could bring a performance issue even with software optimization. Iotlb flush of some hardware is time-consuming. Signed-off-by: Yang, Xiaowei --- xen/arch/x86/setup.c | 8 ++++++++ xen/arch/x86/tboot.c | 12 ++++++++++++ xen/drivers/passthrough/vtd/iommu.c | 14 +++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff -r 28083093cc5d -r c0c0f4fa8850 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Sat May 24 09:45:37 2008 +0100 +++ b/xen/arch/x86/setup.c Mon May 26 08:24:55 2008 +0100 @@ -1100,6 +1100,14 @@ void arch_get_xen_caps(xen_capabilities_ #endif } +int xen_in_range(unsigned long start, unsigned long end) +{ + start = max_t(unsigned long, start, xenheap_phys_start); + end = min_t(unsigned long, end, xenheap_phys_end); + + return start < end; +} + /* * Local variables: * mode: C diff -r 28083093cc5d -r c0c0f4fa8850 xen/arch/x86/tboot.c --- a/xen/arch/x86/tboot.c Sat May 24 09:45:37 2008 +0100 +++ b/xen/arch/x86/tboot.c Mon May 26 08:24:55 2008 +0100 @@ -96,6 +96,18 @@ int tboot_in_measured_env(void) return (g_tboot_shared != NULL); } +int tboot_in_range(unsigned long start, unsigned long end) +{ + if ( g_tboot_shared == NULL || g_tboot_shared->version < 0x02 ) + return 0; + + start = max_t(unsigned long, start, g_tboot_shared->tboot_base); + end = min_t(unsigned long, end, + g_tboot_shared->tboot_base + g_tboot_shared->tboot_size); + + return start < end; +} + /* * Local variables: * mode: C diff -r 28083093cc5d -r c0c0f4fa8850 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Sat May 24 09:45:37 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Mon May 26 08:24:55 2008 +0100 @@ -1097,9 +1097,21 @@ static int intel_iommu_domain_init(struc if ( d->domain_id == 0 ) { - /* Set up 1:1 page table for dom0. */ + extern int xen_in_range(unsigned long start, unsigned long end); + extern int tboot_in_range(unsigned long start, unsigned long end); + + /* + * Set up 1:1 page table for dom0 except the critical segments + * like Xen and tboot. + */ for ( i = 0; i < max_page; i++ ) + { + if ( xen_in_range(i << PAGE_SHIFT_4K, (i + 1) << PAGE_SHIFT_4K) || + tboot_in_range(i << PAGE_SHIFT_4K, (i + 1) << PAGE_SHIFT_4K) ) + continue; + iommu_map_page(d, i, i); + } setup_dom0_devices(d); setup_dom0_rmrr(d); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 26 01:00:12 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 26 May 2008 01:00:12 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0Xcq-0005mZ-7o for www-data@colo.xensource.com; Mon, 26 May 2008 01:00:12 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0XdW-0003WD-P4; Mon, 26 May 2008 08:00:54 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0XdU-0003UI-7N for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0XdL-0007Ab-Jl for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:48 +0000 X-SBRS: 3.6 X-MesageID: 316712 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,541,1204520400"; d="scan'208";a="316712" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 May 2008 03:59:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q7xp2g014146 for ; Mon, 26 May 2008 00:59:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q80ACO003892 for ; Mon, 26 May 2008 01:00:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4Q80A0k003891 for xen-changelog@lists.xensource.com; Mon, 26 May 2008 01:00:10 -0700 Message-Id: <200805260800.m4Q80A0k003891@xenbits.xensource.com> Date: Mon, 26 May 2008 01:00:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] VT-d: flush iotlb of selective iommu when a domain's VT-d table is changed X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211786736 -3600 # Node ID 9a7a6f729d2c0352a772aa274454dee1c96faa5a # Parent c0c0f4fa88509b6f5e4fa9bf0687c7a6df53eeb8 VT-d: flush iotlb of selective iommu when a domain's VT-d table is changed When a domain's VT-d table is changed, only the iommus under which the domain has assigned devices need to be flushed. Signed-off-by: Yang, Xiaowei --- xen/drivers/passthrough/vtd/iommu.c | 39 ++++++++++++++++++++++++++++++++++-- xen/include/xen/hvm/iommu.h | 1 xen/include/xen/iommu.h | 1 3 files changed, 39 insertions(+), 2 deletions(-) diff -r c0c0f4fa8850 -r 9a7a6f729d2c xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Mon May 26 08:24:55 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Mon May 26 08:25:36 2008 +0100 @@ -572,6 +572,7 @@ void iommu_flush_all(void) /* clear one page's page table */ static void dma_pte_clear_one(struct domain *domain, u64 addr) { + struct hvm_iommu *hd = domain_hvm_iommu(domain); struct acpi_drhd_unit *drhd; struct iommu *iommu; struct dma_pte *page = NULL, *pte = NULL; @@ -593,6 +594,10 @@ static void dma_pte_clear_one(struct dom for_each_drhd_unit ( drhd ) { iommu = drhd->iommu; + + if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) + continue; + if ( cap_caching_mode(iommu->cap) ) iommu_flush_iotlb_psi(iommu, domain_iommu_domid(domain), addr, 1, 0); @@ -1022,7 +1027,7 @@ static int iommu_alloc(struct acpi_drhd_ set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, drhd->address); iommu->reg = (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus); - nr_iommus++; + iommu->index = nr_iommus++; iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG); iommu->ecap = dmar_readq(iommu->reg, DMAR_ECAP_REG); @@ -1191,6 +1196,8 @@ static int domain_context_mapping_one( iommu_flush_write_buffer(iommu); else iommu_flush_iotlb_dsi(iommu, domain_iommu_domid(domain), 0); + + set_bit(iommu->index, &hd->iommu_bitmap); spin_unlock_irqrestore(&iommu->lock, flags); return 0; @@ -1418,11 +1425,12 @@ void reassign_device_ownership( { struct hvm_iommu *source_hd = domain_hvm_iommu(source); struct hvm_iommu *target_hd = domain_hvm_iommu(target); - struct pci_dev *pdev; + struct pci_dev *pdev, *pdev2; struct acpi_drhd_unit *drhd; struct iommu *iommu; int status; unsigned long flags; + int found = 0; pdev_flr(bus, devfn); @@ -1443,6 +1451,18 @@ void reassign_device_ownership( list_move(&pdev->list, &target_hd->pdev_list); spin_unlock_irqrestore(&target_hd->iommu_list_lock, flags); spin_unlock_irqrestore(&source_hd->iommu_list_lock, flags); + + for_each_pdev ( source, pdev2 ) + { + drhd = acpi_find_matched_drhd_unit(pdev2); + if ( drhd->iommu == iommu ) + { + found = 1; + break; + } + } + if ( !found ) + clear_bit(iommu->index, &source_hd->iommu_bitmap); status = domain_context_mapping(target, iommu, pdev); if ( status != 0 ) @@ -1500,6 +1520,7 @@ int intel_iommu_map_page( int intel_iommu_map_page( struct domain *d, unsigned long gfn, unsigned long mfn) { + struct hvm_iommu *hd = domain_hvm_iommu(d); struct acpi_drhd_unit *drhd; struct iommu *iommu; struct dma_pte *page = NULL, *pte = NULL; @@ -1527,6 +1548,10 @@ int intel_iommu_map_page( for_each_drhd_unit ( drhd ) { iommu = drhd->iommu; + + if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) + continue; + if ( cap_caching_mode(iommu->cap) ) iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0); @@ -1578,6 +1603,7 @@ int iommu_page_mapping(struct domain *do int iommu_page_mapping(struct domain *domain, paddr_t iova, paddr_t hpa, size_t size, int prot) { + struct hvm_iommu *hd = domain_hvm_iommu(domain); struct acpi_drhd_unit *drhd; struct iommu *iommu; u64 start_pfn, end_pfn; @@ -1611,6 +1637,10 @@ int iommu_page_mapping(struct domain *do for_each_drhd_unit ( drhd ) { iommu = drhd->iommu; + + if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) + continue; + if ( cap_caching_mode(iommu->cap) ) iommu_flush_iotlb_psi(iommu, domain_iommu_domid(domain), iova, index, 0); @@ -1630,6 +1660,7 @@ int iommu_page_unmapping(struct domain * void iommu_flush(struct domain *d, unsigned long gfn, u64 *p2m_entry) { + struct hvm_iommu *hd = domain_hvm_iommu(d); struct acpi_drhd_unit *drhd; struct iommu *iommu = NULL; struct dma_pte *pte = (struct dma_pte *) p2m_entry; @@ -1637,6 +1668,10 @@ void iommu_flush(struct domain *d, unsig for_each_drhd_unit ( drhd ) { iommu = drhd->iommu; + + if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) + continue; + if ( cap_caching_mode(iommu->cap) ) iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0); diff -r c0c0f4fa8850 -r 9a7a6f729d2c xen/include/xen/hvm/iommu.h --- a/xen/include/xen/hvm/iommu.h Mon May 26 08:24:55 2008 +0100 +++ b/xen/include/xen/hvm/iommu.h Mon May 26 08:25:36 2008 +0100 @@ -43,6 +43,7 @@ struct hvm_iommu { int agaw; /* adjusted guest address width, 0 is level 2 30-bit */ struct list_head g2m_ioport_list; /* guest to machine ioport mapping */ domid_t iommu_domid; /* domain id stored in iommu */ + u64 iommu_bitmap; /* bitmap of iommu(s) that the domain uses */ /* amd iommu support */ int domain_id; diff -r c0c0f4fa8850 -r 9a7a6f729d2c xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Mon May 26 08:24:55 2008 +0100 +++ b/xen/include/xen/iommu.h Mon May 26 08:25:36 2008 +0100 @@ -44,6 +44,7 @@ struct iommu { struct iommu { struct list_head list; void __iomem *reg; /* Pointer to hardware regs, virtual addr */ + u32 index; /* Sequence number of iommu */ u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */ u64 cap; u64 ecap; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 26 01:00:15 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 26 May 2008 01:00:15 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0Xcs-0005ma-OS for www-data@colo.xensource.com; Mon, 26 May 2008 01:00:15 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0XdZ-0003Yx-4V; Mon, 26 May 2008 08:00:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0XdU-0003UX-Dz for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0XdN-0007Ac-BB for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:50 +0000 X-SBRS: 3.6 X-MesageID: 316713 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,541,1204520400"; d="scan'208";a="316713" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 May 2008 03:59:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q7xqIh014149 for ; Mon, 26 May 2008 00:59:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q80BrY003909 for ; Mon, 26 May 2008 01:00:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4Q80BKR003908 for xen-changelog@lists.xensource.com; Mon, 26 May 2008 01:00:11 -0700 Message-Id: <200805260800.m4Q80BKR003908@xenbits.xensource.com> Date: Mon, 26 May 2008 01:00:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix XendAPI VM_migrate parameters X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211786797 -3600 # Node ID 51274688c00088f2f6f194a9c7c50c54339aa1eb # Parent 9a7a6f729d2c0352a772aa274454dee1c96faa5a Fix XendAPI VM_migrate parameters This patch removes unused resource parameter and fixes the default value for domain_migrate. Also removes tab indent in XendOptions.py. Signed-off-by: Zhigang Wang --- tools/python/xen/xend/XendAPI.py | 7 +++---- tools/python/xen/xend/XendOptions.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff -r 9a7a6f729d2c -r 51274688c000 tools/python/xen/xend/XendAPI.py --- a/tools/python/xen/xend/XendAPI.py Mon May 26 08:25:36 2008 +0100 +++ b/tools/python/xen/xend/XendAPI.py Mon May 26 08:26:37 2008 +0100 @@ -1759,13 +1759,12 @@ class XendAPI(object): xendom = XendDomain.instance() xeninfo = xendom.get_vm_by_uuid(vm_ref) - resource = other_config.get("resource", 0) port = other_config.get("port", 0) - node = other_config.get("node", 0) - ssl = other_config.get("ssl", 0) + node = other_config.get("node", -1) + ssl = other_config.get("ssl", None) xendom.domain_migrate(xeninfo.getDomid(), destination_url, - bool(live), resource, port, node, ssl) + bool(live), port, node, ssl) return xen_api_success_void() def VM_save(self, _, vm_ref, dest, checkpoint): diff -r 9a7a6f729d2c -r 51274688c000 tools/python/xen/xend/XendOptions.py --- a/tools/python/xen/xend/XendOptions.py Mon May 26 08:25:36 2008 +0100 +++ b/tools/python/xen/xend/XendOptions.py Mon May 26 08:26:37 2008 +0100 @@ -222,7 +222,7 @@ class XendOptions: self.xend_relocation_port_default) def get_xend_relocation_ssl_port(self): - """Get the port xend listens at for ssl connection to its relocation + """Get the port xend listens at for ssl connection to its relocation server. """ return self.get_config_int('xend-relocation-ssl-port', _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 26 01:00:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 26 May 2008 01:00:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0Xcw-0005mg-W1 for www-data@colo.xensource.com; Mon, 26 May 2008 01:00:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0Xdd-0003cj-FK; Mon, 26 May 2008 08:01:01 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0XdX-0003Vb-DV for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:55 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0XdR-0007Ab-DZ for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:53 +0000 X-SBRS: 3.6 X-MesageID: 316715 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,541,1204520400"; d="scan'208";a="316715" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 May 2008 03:59:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q7xsVh014155 for ; Mon, 26 May 2008 00:59:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q80DbV003943 for ; Mon, 26 May 2008 01:00:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4Q80Dtl003942 for xen-changelog@lists.xensource.com; Mon, 26 May 2008 01:00:13 -0700 Message-Id: <200805260800.m4Q80Dtl003942@xenbits.xensource.com> Date: Mon, 26 May 2008 01:00:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix domain names that xentop shows X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211787463 -3600 # Node ID 57923ddaacb96e0b4dc0cc2203ca5bee79a829a3 # Parent 3544f12d22b2fa723154ec089cbb7ca1f46407cb Fix domain names that xentop shows When I changed the name of a domain by using xm rename command, the name of the domain that xentop shows did not change. This patch reflects new domain name to the name of domains that xentop shows. Signed-off-by: Masaki Kanno --- tools/xenstat/libxenstat/src/xenstat.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff -r 3544f12d22b2 -r 57923ddaacb9 tools/xenstat/libxenstat/src/xenstat.c --- a/tools/xenstat/libxenstat/src/xenstat.c Mon May 26 08:27:19 2008 +0100 +++ b/tools/xenstat/libxenstat/src/xenstat.c Mon May 26 08:37:43 2008 +0100 @@ -655,12 +655,20 @@ unsigned long long xenstat_vbd_wr_reqs(x static char *xenstat_get_domain_name(xenstat_handle *handle, unsigned int domain_id) { - char path[80]; - - snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id); - + char path[80], *vmpath; + + snprintf(path, sizeof(path),"/local/domain/%i/vm", domain_id); + + vmpath = xs_read(handle->xshandle, XBT_NULL, path, NULL); + + if (vmpath == NULL) + return NULL; + + snprintf(path, sizeof(path),"%s/name", vmpath); + free(vmpath); + return xs_read(handle->xshandle, XBT_NULL, path, NULL); -} +} /* Remove specified entry from list of domains */ static void xenstat_prune_domain(xenstat_node *node, unsigned int entry) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 26 01:00:22 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 26 May 2008 01:00:22 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0Xd0-0005mk-20 for www-data@colo.xensource.com; Mon, 26 May 2008 01:00:22 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0Xdg-0003gS-Hy; Mon, 26 May 2008 08:01:04 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0XdY-0003Wb-V9 for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:57 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0XdN-0007AZ-IU for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:54 +0000 X-SBRS: 3.6 X-MesageID: 316714 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,541,1204520400"; d="scan'208";a="316714" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 May 2008 03:59:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q7xrSi014152 for ; Mon, 26 May 2008 00:59:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q80C0o003926 for ; Mon, 26 May 2008 01:00:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4Q80CAZ003925 for xen-changelog@lists.xensource.com; Mon, 26 May 2008 01:00:12 -0700 Message-Id: <200805260800.m4Q80CAZ003925@xenbits.xensource.com> Date: Mon, 26 May 2008 01:00:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] remove warnings caused by c/s 17723:c684cf331f94 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211786839 -3600 # Node ID 3544f12d22b2fa723154ec089cbb7ca1f46407cb # Parent 51274688c00088f2f6f194a9c7c50c54339aa1eb [IA64] remove warnings caused by c/s 17723:c684cf331f94 This patch removes the following warnings on ia64 by including necessary header files. On x86 the necessary files are included by recusive inclusion. Signed-off-by: Isaku Yamahata --- xen/common/grant_table.c | 2 ++ 1 files changed, 2 insertions(+) diff -r 51274688c000 -r 3544f12d22b2 xen/common/grant_table.c --- a/xen/common/grant_table.c Mon May 26 08:26:37 2008 +0100 +++ b/xen/common/grant_table.c Mon May 26 08:27:19 2008 +0100 @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #ifndef max_nr_grant_frames _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 26 01:00:26 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 26 May 2008 01:00:26 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0Xd3-0005mo-UN for www-data@colo.xensource.com; Mon, 26 May 2008 01:00:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0Xdk-0003kh-DX; Mon, 26 May 2008 08:01:08 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0Xda-0003Z9-Vs for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0XdS-0007Ac-SB for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:56 +0000 X-SBRS: 3.6 X-MesageID: 316716 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,541,1204520400"; d="scan'208";a="316716" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 May 2008 03:59:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q7xtit014158 for ; Mon, 26 May 2008 00:59:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q80Ee0003960 for ; Mon, 26 May 2008 01:00:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4Q80EU1003959 for xen-changelog@lists.xensource.com; Mon, 26 May 2008 01:00:14 -0700 Message-Id: <200805260800.m4Q80EU1003959@xenbits.xensource.com> Date: Mon, 26 May 2008 01:00:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Drop pagetable reference when resetting a VCPU to real mode. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211787959 -3600 # Node ID 14f03101b61ce87d3c8274b4fac785e34c0819eb # Parent 57923ddaacb96e0b4dc0cc2203ca5bee79a829a3 x86 hvm: Drop pagetable reference when resetting a VCPU to real mode. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hvm.c | 7 +++++++ 1 files changed, 7 insertions(+) diff -r 57923ddaacb9 -r 14f03101b61c xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Mon May 26 08:37:43 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Mon May 26 08:45:59 2008 +0100 @@ -2073,6 +2073,13 @@ void hvm_vcpu_reset_state(struct vcpu *v if ( v->is_initialised ) goto out; + if ( !paging_mode_hap(d) ) + { + if ( v->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PG ) + put_page(pagetable_get_page(v->arch.guest_table)); + v->arch.guest_table = pagetable_null(); + } + ctxt = &v->arch.guest_context; memset(ctxt, 0, sizeof(*ctxt)); ctxt->flags = VGCF_online; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Mon May 26 01:00:29 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Mon, 26 May 2008 01:00:29 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0Xd7-0005ms-IQ for www-data@colo.xensource.com; Mon, 26 May 2008 01:00:29 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0Xdn-0003oR-Vl; Mon, 26 May 2008 08:01:12 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0Xdc-0003at-OT for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:01:00 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0XdV-0007Ab-Rp for xen-changelog@lists.xensource.com; Mon, 26 May 2008 08:00:58 +0000 X-SBRS: 3.6 X-MesageID: 316717 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,541,1204520400"; d="scan'208";a="316717" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 26 May 2008 03:59:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q7xuqR014161 for ; Mon, 26 May 2008 00:59:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4Q80FIA003977 for ; Mon, 26 May 2008 01:00:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4Q80FqS003976 for xen-changelog@lists.xensource.com; Mon, 26 May 2008 01:00:15 -0700 Message-Id: <200805260800.m4Q80FqS003976@xenbits.xensource.com> Date: Mon, 26 May 2008 01:00:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,INFO_TLD autolearn=no version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: take care of dead qemu-dm process X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211788405 -3600 # Node ID eafb252f141262c8bd6ce956ed951c40e13d3495 # Parent 14f03101b61ce87d3c8274b4fac785e34c0819eb xend: take care of dead qemu-dm process This patch fix xend as when fatal error happened (e.g. qemu-dm process was killed) log error message then mark that domain as crashed, do what specified on crashed in the domain config file. Added some code in xend to check those crashed hvm DM status each 30 seconds. Signed-off-by: Xiaowei Hu --- tools/python/xen/xend/server/SrvServer.py | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff -r 14f03101b61c -r eafb252f1412 tools/python/xen/xend/server/SrvServer.py --- a/tools/python/xen/xend/server/SrvServer.py Mon May 26 08:45:59 2008 +0100 +++ b/tools/python/xen/xend/server/SrvServer.py Mon May 26 08:53:25 2008 +0100 @@ -44,6 +44,7 @@ import re import re import time import signal +import os from threading import Thread from xen.web.httpserver import HttpServer, UnixHttpServer @@ -148,14 +149,27 @@ class XendServers: # Reaching this point means we can auto start domains try: - xenddomain().autostart_domains() + dom = xenddomain() + dom.autostart_domains() except Exception, e: log.exception("Failed while autostarting domains") # loop to keep main thread alive until it receives a SIGTERM self.running = True while self.running: - time.sleep(100000000) + # loop to destroy those hvm domain that whoes DM has dead unexpectedly. + for item in dom.domains.values(): + if item.info.is_hvm(): + device_model_pid = item.gatherDom(('image/device-model-pid', str)) + dm_stat_cmd = "ps -o stat --no-headers -p"+device_model_pid + dm_stat = os.popen(dm_stat_cmd).readline().rstrip() + if dm_stat == 'Z': + log.warn("Devices Model for domain " + str(item.domid) + "was killed unexpectedly") + item.info['crashed'] = 1 + item.refreshShutdown(item.info) + else: + continue + time.sleep(30) if self.reloadingConfig: log.info("Restarting all XML-RPC and Xen-API servers...") _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 27 05:20:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 27 May 2008 05:20:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0y9v-0004S9-23 for www-data@colo.xensource.com; Tue, 27 May 2008 05:20:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAb-0005KQ-V8; Tue, 27 May 2008 12:20:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAa-0005JY-Gv for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:48 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0yAT-00055A-IK for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:46 +0000 X-SBRS: 3.6 X-MesageID: 327675 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,548,1204520400"; d="scan'208,217";a="327675" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 May 2008 08:19:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCJqRQ017889 for ; Tue, 27 May 2008 05:19:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKAZm018655 for ; Tue, 27 May 2008 05:20:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4RCKAFV018654 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 05:20:10 -0700 Message-Id: <200805271220.m4RCKAFV018654@xenbits.xensource.com> Date: Tue, 27 May 2008 05:20:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: add a reset button to Web interface. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211880685 -3600 # Node ID 9df61d6601ba411eab24378c3caba903db9145dc # Parent eafb252f141262c8bd6ce956ed951c40e13d3495 xend: add a reset button to Web interface. Signed-off-by: Masaki Kanno --- tools/python/xen/xend/server/SrvDomain.py | 9 +++++++++ 1 files changed, 9 insertions(+) diff -r eafb252f1412 -r 9df61d6601ba tools/python/xen/xend/server/SrvDomain.py --- a/tools/python/xen/xend/server/SrvDomain.py Mon May 26 08:53:25 2008 +0100 +++ b/tools/python/xen/xend/server/SrvDomain.py Tue May 27 10:31:25 2008 +0100 @@ -216,6 +216,11 @@ class SrvDomain(SrvDir): def op_vcpuinfo(self, _1, req): return self.call(self.dom.getVCPUInfo, [], req) + + + def op_reset(self, _, req): + self.acceptCommand(req) + return self.xd.domain_reset(self.dom.getName()) def render_POST(self, req): @@ -258,6 +263,10 @@ class SrvDomain(SrvDir): req.write('') req.write('
' % url) + req.write('') + req.write('
') + + req.write('
' % url) req.write('') req.write('Poweroff') req.write('Halt') _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 27 05:20:10 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 27 May 2008 05:20:10 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0y9y-0004SD-8U for www-data@colo.xensource.com; Tue, 27 May 2008 05:20:10 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAe-0005Na-Rn; Tue, 27 May 2008 12:20:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAb-0005JZ-Nx for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:49 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0yAU-00055B-Ka for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:47 +0000 X-SBRS: 3.6 X-MesageID: 327676 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,548,1204520400"; d="scan'208";a="327676" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 May 2008 08:19:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCJrw3017892 for ; Tue, 27 May 2008 05:19:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKBnj018672 for ; Tue, 27 May 2008 05:20:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4RCKB8T018671 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 05:20:11 -0700 Message-Id: <200805271220.m4RCKB8T018671@xenbits.xensource.com> Date: Tue, 27 May 2008 05:20:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: fix a typo in domain_migrate(). X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211880715 -3600 # Node ID 80ee45e007e1fc3d500d800a6c0aaa56e815e262 # Parent 9df61d6601ba411eab24378c3caba903db9145dc xend: fix a typo in domain_migrate(). - @rtype: -> @type node: Signed-off-by: Masaki Kanno --- tools/python/xen/xend/XendDomain.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff -r 9df61d6601ba -r 80ee45e007e1 tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Tue May 27 10:31:25 2008 +0100 +++ b/tools/python/xen/xend/XendDomain.py Tue May 27 10:31:55 2008 +0100 @@ -1265,17 +1265,17 @@ class XendDomain: @type domid: int or string. @param dst: Destination IP address @type dst: string - @keyword port: relocation port on destination - @type port: int @keyword live: Live migration @type live: bool + @keyword port: relocation port on destination + @type port: int + @keyword node: use node number for target + @type node: int @keyword ssl: use ssl connection @type ssl: bool @rtype: None - @keyword node: use node number for target - @rtype: int @raise XendError: Failed to migrate - @raise XendInvalidDomain: Domain is not valid + @raise XendInvalidDomain: Domain is not valid """ dominfo = self.domain_lookup_nr(domid) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 27 05:20:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 27 May 2008 05:20:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0yA1-0004SG-3C for www-data@colo.xensource.com; Tue, 27 May 2008 05:20:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAi-0005R7-2e; Tue, 27 May 2008 12:20:56 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAe-0005Lz-ST for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0yAY-00055A-N4 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:50 +0000 X-SBRS: 3.6 X-MesageID: 327678 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,548,1204520400"; d="scan'208";a="327678" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 May 2008 08:19:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCJt4l017898 for ; Tue, 27 May 2008 05:19:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKEYf018706 for ; Tue, 27 May 2008 05:20:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4RCKDGJ018705 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 05:20:13 -0700 Message-Id: <200805271220.m4RCKDGJ018705@xenbits.xensource.com> Date: Tue, 27 May 2008 05:20:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,INFO_TLD autolearn=no version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Revert 17731:eafb252f141. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211885443 -3600 # Node ID 634fe9f86d62e3e4dc416f64b4ade6b31b0926e7 # Parent e265878e8f657ca532ebe98b5bac233f395f2814 Revert 17731:eafb252f141. Signed-off-by: Keir Fraser --- tools/python/xen/xend/server/SrvServer.py | 18 ++---------------- 1 files changed, 2 insertions(+), 16 deletions(-) diff -r e265878e8f65 -r 634fe9f86d62 tools/python/xen/xend/server/SrvServer.py --- a/tools/python/xen/xend/server/SrvServer.py Tue May 27 10:35:10 2008 +0100 +++ b/tools/python/xen/xend/server/SrvServer.py Tue May 27 11:50:43 2008 +0100 @@ -44,7 +44,6 @@ import re import re import time import signal -import os from threading import Thread from xen.web.httpserver import HttpServer, UnixHttpServer @@ -149,27 +148,14 @@ class XendServers: # Reaching this point means we can auto start domains try: - dom = xenddomain() - dom.autostart_domains() + xenddomain().autostart_domains() except Exception, e: log.exception("Failed while autostarting domains") # loop to keep main thread alive until it receives a SIGTERM self.running = True while self.running: - # loop to destroy those hvm domain that whoes DM has dead unexpectedly. - for item in dom.domains.values(): - if item.info.is_hvm(): - device_model_pid = item.gatherDom(('image/device-model-pid', str)) - dm_stat_cmd = "ps -o stat --no-headers -p"+device_model_pid - dm_stat = os.popen(dm_stat_cmd).readline().rstrip() - if dm_stat == 'Z': - log.warn("Devices Model for domain " + str(item.domid) + "was killed unexpectedly") - item.info['crashed'] = 1 - item.refreshShutdown(item.info) - else: - continue - time.sleep(30) + time.sleep(100000000) if self.reloadingConfig: log.info("Restarting all XML-RPC and Xen-API servers...") _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 27 05:20:17 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 27 May 2008 05:20:17 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0yA4-0004SJ-VJ for www-data@colo.xensource.com; Tue, 27 May 2008 05:20:17 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAl-0005Ul-TZ; Tue, 27 May 2008 12:20:59 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAe-0005M1-Sx for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0yAV-00055C-NU for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:50 +0000 X-SBRS: 3.6 X-MesageID: 327677 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,548,1204520400"; d="scan'208";a="327677" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 May 2008 08:19:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCJssh017895 for ; Tue, 27 May 2008 05:19:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKDMk018689 for ; Tue, 27 May 2008 05:20:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4RCKChm018688 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 05:20:12 -0700 Message-Id: <200805271220.m4RCKChm018688@xenbits.xensource.com> Date: Tue, 27 May 2008 05:20:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Fix 17725:c0c0f4fa8850: use type paddr_t instead of unsigned long for physcial memory address X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211880910 -3600 # Node ID e265878e8f657ca532ebe98b5bac233f395f2814 # Parent 80ee45e007e1fc3d500d800a6c0aaa56e815e262 Fix 17725:c0c0f4fa8850: use type paddr_t instead of unsigned long for physcial memory address Otherwise, the address overflows on PAE system with memory size > 4G. Signed-off-by: Yang, Xiaowei --- xen/arch/x86/setup.c | 8 ++++---- xen/arch/x86/tboot.c | 6 +++--- xen/drivers/passthrough/vtd/iommu.c | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff -r 80ee45e007e1 -r e265878e8f65 xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c Tue May 27 10:31:55 2008 +0100 +++ b/xen/arch/x86/setup.c Tue May 27 10:35:10 2008 +0100 @@ -1100,10 +1100,10 @@ void arch_get_xen_caps(xen_capabilities_ #endif } -int xen_in_range(unsigned long start, unsigned long end) -{ - start = max_t(unsigned long, start, xenheap_phys_start); - end = min_t(unsigned long, end, xenheap_phys_end); +int xen_in_range(paddr_t start, paddr_t end) +{ + start = max_t(paddr_t, start, xenheap_phys_start); + end = min_t(paddr_t, end, xenheap_phys_end); return start < end; } diff -r 80ee45e007e1 -r e265878e8f65 xen/arch/x86/tboot.c --- a/xen/arch/x86/tboot.c Tue May 27 10:31:55 2008 +0100 +++ b/xen/arch/x86/tboot.c Tue May 27 10:35:10 2008 +0100 @@ -96,13 +96,13 @@ int tboot_in_measured_env(void) return (g_tboot_shared != NULL); } -int tboot_in_range(unsigned long start, unsigned long end) +int tboot_in_range(paddr_t start, paddr_t end) { if ( g_tboot_shared == NULL || g_tboot_shared->version < 0x02 ) return 0; - start = max_t(unsigned long, start, g_tboot_shared->tboot_base); - end = min_t(unsigned long, end, + start = max_t(paddr_t, start, g_tboot_shared->tboot_base); + end = min_t(paddr_t, end, g_tboot_shared->tboot_base + g_tboot_shared->tboot_size); return start < end; diff -r 80ee45e007e1 -r e265878e8f65 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Tue May 27 10:31:55 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Tue May 27 10:35:10 2008 +0100 @@ -1074,7 +1074,8 @@ static int intel_iommu_domain_init(struc struct hvm_iommu *hd = domain_hvm_iommu(d); struct iommu *iommu = NULL; int guest_width = DEFAULT_DOMAIN_ADDRESS_WIDTH; - int i, adjust_width, agaw; + int adjust_width, agaw; + u64 i; unsigned long sagaw; struct acpi_drhd_unit *drhd; @@ -1102,8 +1103,8 @@ static int intel_iommu_domain_init(struc if ( d->domain_id == 0 ) { - extern int xen_in_range(unsigned long start, unsigned long end); - extern int tboot_in_range(unsigned long start, unsigned long end); + extern int xen_in_range(paddr_t start, paddr_t end); + extern int tboot_in_range(paddr_t start, paddr_t end); /* * Set up 1:1 page table for dom0 except the critical segments _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 27 05:20:20 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 27 May 2008 05:20:20 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0yA7-0004SN-Qw for www-data@colo.xensource.com; Tue, 27 May 2008 05:20:20 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAo-0005Xy-Ng; Tue, 27 May 2008 12:21:02 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAg-0005Nr-SA for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:54 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0yAa-00055B-5R for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:52 +0000 X-SBRS: 3.6 X-MesageID: 327679 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,548,1204520400"; d="scan'208";a="327679" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 May 2008 08:19:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCJuF2017901 for ; Tue, 27 May 2008 05:19:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKF1m018723 for ; Tue, 27 May 2008 05:20:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4RCKF35018722 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 05:20:15 -0700 Message-Id: <200805271220.m4RCKF35018722@xenbits.xensource.com> Date: Tue, 27 May 2008 05:20:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: Force floppy disk images to be interpreted as raw. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211885493 -3600 # Node ID 6b28a18a8c2d22993adbf35fa66712661118dede # Parent 634fe9f86d62e3e4dc416f64b4ade6b31b0926e7 ioemu: Force floppy disk images to be interpreted as raw. Fixes specifying fda/fdb image names in domain configs. Signed-off-by: Keir Fraser --- tools/ioemu/vl.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r 634fe9f86d62 -r 6b28a18a8c2d tools/ioemu/vl.c --- a/tools/ioemu/vl.c Tue May 27 11:50:43 2008 +0100 +++ b/tools/ioemu/vl.c Tue May 27 11:51:33 2008 +0100 @@ -7807,8 +7807,9 @@ int main(int argc, char **argv) bdrv_set_type_hint(fd_table[i], BDRV_TYPE_FLOPPY); } if (fd_filename[i] != '\0') { - if (bdrv_open(fd_table[i], fd_filename[i], - snapshot ? BDRV_O_SNAPSHOT : 0) < 0) { + if (bdrv_open2(fd_table[i], fd_filename[i], + snapshot ? BDRV_O_SNAPSHOT : 0, + &bdrv_raw) < 0) { fprintf(stderr, "qemu: could not open floppy disk image '%s'\n", fd_filename[i]); exit(1); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 27 05:20:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 27 May 2008 05:20:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0yAB-0004SR-4S for www-data@colo.xensource.com; Tue, 27 May 2008 05:20:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAs-0005bS-4W; Tue, 27 May 2008 12:21:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAj-0005Qc-IK for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:57 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0yAd-00055A-AI for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:55 +0000 X-SBRS: 3.6 X-MesageID: 327680 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,548,1204520400"; d="scan'208";a="327680" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 May 2008 08:19:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCJv4d017904 for ; Tue, 27 May 2008 05:19:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKGcl018740 for ; Tue, 27 May 2008 05:20:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4RCKGtj018739 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 05:20:16 -0700 Message-Id: <200805271220.m4RCKGtj018739@xenbits.xensource.com> Date: Tue, 27 May 2008 05:20:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] minios: We do not need to pin the page tables, as they implicitly get X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211889785 -3600 # Node ID c93a913c221f19d2eea96d9cf9f98d9e10a078ea # Parent 6b28a18a8c2d22993adbf35fa66712661118dede minios: We do not need to pin the page tables, as they implicitly get pinned when we point the permanent page directory to them. Signed-off-by: Samuel Thibault --- extras/mini-os/arch/x86/mm.c | 17 ++--------------- 1 files changed, 2 insertions(+), 15 deletions(-) diff -r 6b28a18a8c2d -r c93a913c221f extras/mini-os/arch/x86/mm.c --- a/extras/mini-os/arch/x86/mm.c Tue May 27 11:51:33 2008 +0100 +++ b/extras/mini-os/arch/x86/mm.c Tue May 27 13:03:05 2008 +0100 @@ -59,11 +59,10 @@ void new_pt_frame(unsigned long *pt_pfn, { pgentry_t *tab = (pgentry_t *)start_info.pt_base; unsigned long pt_page = (unsigned long)pfn_to_virt(*pt_pfn); - unsigned long prot_e, prot_t, pincmd; + unsigned long prot_e, prot_t; mmu_update_t mmu_updates[1]; - struct mmuext_op pin_request; - prot_e = prot_t = pincmd = 0; + prot_e = prot_t = 0; DEBUG("Allocating new L%d pt frame for pt_pfn=%lx, " "prev_l_mfn=%lx, offset=%lx", level, *pt_pfn, prev_l_mfn, offset); @@ -77,18 +76,15 @@ void new_pt_frame(unsigned long *pt_pfn, case L1_FRAME: prot_e = L1_PROT; prot_t = L2_PROT; - pincmd = MMUEXT_PIN_L1_TABLE; break; case L2_FRAME: prot_e = L2_PROT; prot_t = L3_PROT; - pincmd = MMUEXT_PIN_L2_TABLE; break; #if defined(__x86_64__) case L3_FRAME: prot_e = L3_PROT; prot_t = L4_PROT; - pincmd = MMUEXT_PIN_L3_TABLE; break; #endif default: @@ -113,15 +109,6 @@ void new_pt_frame(unsigned long *pt_pfn, do_exit(); } - /* Pin the page to provide correct protection */ - pin_request.cmd = pincmd; - pin_request.arg1.mfn = pfn_to_mfn(*pt_pfn); - if(HYPERVISOR_mmuext_op(&pin_request, 1, NULL, DOMID_SELF) < 0) - { - printk("ERROR: pinning failed\n"); - do_exit(); - } - /* Now fill the new page table page with entries. Update the page directory as well. */ mmu_updates[0].ptr = ((pgentry_t)prev_l_mfn << PAGE_SHIFT) + sizeof(pgentry_t) * offset; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 27 05:20:27 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 27 May 2008 05:20:27 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0yAE-0004SU-Ko for www-data@colo.xensource.com; Tue, 27 May 2008 05:20:26 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAv-0005em-Jq; Tue, 27 May 2008 12:21:09 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yAk-0005Rt-KI for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:58 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0yAd-00055C-Au for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:20:56 +0000 X-SBRS: 3.6 X-MesageID: 327681 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,548,1204520400"; d="scan'208";a="327681" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 May 2008 08:19:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCJxfe017907 for ; Tue, 27 May 2008 05:19:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKHSs018803 for ; Tue, 27 May 2008 05:20:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4RCKH0A018802 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 05:20:17 -0700 Message-Id: <200805271220.m4RCKH0A018802@xenbits.xensource.com> Date: Tue, 27 May 2008 05:20:17 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] x86_64: Remove warning message about 'Breaking affinity for irq'. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211880834 -3600 # Node ID 936f6dd9d49c71c95931c9d8bdf4393cdb9fb42f # Parent 446c39a967fc0904e2d27ca876c671b414fb5917 x86_64: Remove warning message about 'Breaking affinity for irq'. 32-bit equivalent checked in as: http://xenbits.xensource.com/xen-unstable.hg/rev/d24ab5abf857 Signed-off-by: Masaki Kanno --- arch/x86_64/kernel/irq-xen.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 446c39a967fc -r 936f6dd9d49c arch/x86_64/kernel/irq-xen.c --- a/arch/x86_64/kernel/irq-xen.c Wed May 21 17:04:37 2008 +0100 +++ b/arch/x86_64/kernel/irq-xen.c Tue May 27 10:33:54 2008 +0100 @@ -148,7 +148,7 @@ void fixup_irqs(cpumask_t map) cpus_and(mask, irq_desc[irq].affinity, map); if (any_online_cpu(mask) == NR_CPUS) { - printk("Breaking affinity for irq %i\n", irq); + /*printk("Breaking affinity for irq %i\n", irq);*/ mask = map; } if (irq_desc[irq].chip->set_affinity) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Tue May 27 05:20:34 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Tue, 27 May 2008 05:20:34 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K0yAM-0004SY-63 for www-data@colo.xensource.com; Tue, 27 May 2008 05:20:34 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yB3-0005j1-3g; Tue, 27 May 2008 12:21:17 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K0yB0-0005hG-AC for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:21:14 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K0yAu-00055c-Jr for xen-changelog@lists.xensource.com; Tue, 27 May 2008 12:21:12 +0000 X-SBRS: 3.6 X-MesageID: 327684 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,548,1204520400"; d="scan'208";a="327684" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 27 May 2008 08:20:19 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKJYq017910 for ; Tue, 27 May 2008 05:20:19 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4RCKbLM018932 for ; Tue, 27 May 2008 05:20:37 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4RCKb3X018931 for xen-changelog@lists.xensource.com; Tue, 27 May 2008 05:20:37 -0700 Message-Id: <200805271220.m4RCKb3X018931@xenbits.xensource.com> Date: Tue, 27 May 2008 05:20:37 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] vt-d: Do FLR of assigned devices with VT-d X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211881079 -3600 # Node ID 2ec56b04abf48d091310e6f778297d82f328eefe # Parent b38e8c9f7a693e7dc1d6fcf63f11e616b5dec12c vt-d: Do FLR of assigned devices with VT-d Currently there is a pdev_flr() function to do FLR before device assignment in qemu, but most of devices don't have FLR capability. What's more, should do FLR before assignment and deassignment for keeping correct device status. If the device doesn't have FLR capablility, this patch implemented to enter D3hot and return to D0 to do FLR. And exposed pdev_flr() in VT-d utils, then it can be invoked by assignment and deassignment functions. Signed-off-by: Weidong Han Signed-off-by: Anthony Xu xen-unstable changeset: 16875:74a9bfccddba0fedd59c57e5f1a76d83a4178d7c xen-unstable date: Thu Jan 24 14:39:38 2008 +0000 --- tools/ioemu/hw/pass-through.c | 55 ------------------ xen/arch/x86/hvm/vmx/vtd/intel-iommu.c | 4 + xen/arch/x86/hvm/vmx/vtd/utils.c | 97 ++++++++++++++++++++++++++++++++- 3 files changed, 101 insertions(+), 55 deletions(-) diff -r b38e8c9f7a69 -r 2ec56b04abf4 tools/ioemu/hw/pass-through.c --- a/tools/ioemu/hw/pass-through.c Fri May 23 11:16:44 2008 +0100 +++ b/tools/ioemu/hw/pass-through.c Tue May 27 10:37:59 2008 +0100 @@ -56,56 +56,6 @@ static int next_bdf(char **str, int *seg return 1; } -uint8_t find_cap_offset(struct pci_dev *pci_dev, uint8_t cap) -{ - int id; - int max_cap = 48; - int pos = PCI_CAPABILITY_LIST; - int status; - - status = pci_read_byte(pci_dev, PCI_STATUS); - if ( (status & PCI_STATUS_CAP_LIST) == 0 ) - return 0; - - while ( max_cap-- ) - { - pos = pci_read_byte(pci_dev, pos); - if ( pos < 0x40 ) - break; - - pos &= ~3; - id = pci_read_byte(pci_dev, pos + PCI_CAP_LIST_ID); - - if ( id == 0xff ) - break; - if ( id == cap ) - return pos; - - pos += PCI_CAP_LIST_NEXT; - } - return 0; -} - -void pdev_flr(struct pci_dev *pci_dev) -{ - int pos; - int dev_cap; - int dev_status; - - pos = find_cap_offset(pci_dev, PCI_CAP_ID_EXP); - if ( pos ) - { - dev_cap = pci_read_long(pci_dev, pos + PCI_EXP_DEVCAP); - if ( dev_cap & PCI_EXP_DEVCAP_FLR ) - { - pci_write_word(pci_dev, pos + PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_FLR); - do { - dev_status = pci_read_long(pci_dev, pos + PCI_EXP_DEVSTA); - } while (dev_status & PCI_EXP_DEVSTA_TRPND); - } - } -} - /* Being called each time a mmio region has been updated */ void pt_iomem_map(PCIDevice *d, int i, uint32_t e_phys, uint32_t e_size, int type) @@ -273,7 +223,7 @@ static int pt_register_regions(struct pt PCIDevice *d = &assigned_device->dev; /* Register PIO/MMIO BARs */ - for ( i=0; i < PCI_BAR_ENTRIES; i++ ) + for ( i = 0; i < PCI_BAR_ENTRIES; i++ ) { if ( pci_dev->base_addr[i] ) { @@ -358,9 +308,6 @@ struct pt_dev * register_real_device(PCI assigned_device->pci_dev = pci_dev; - /* Issue PCIe FLR */ - pdev_flr(pci_dev); - /* Assign device */ machine_bdf.reg = 0; machine_bdf.bus = r_bus; diff -r b38e8c9f7a69 -r 2ec56b04abf4 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c --- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Fri May 23 11:16:44 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Tue May 27 10:37:59 2008 +0100 @@ -40,6 +40,8 @@ extern void print_iommu_regs(struct acpi extern void print_iommu_regs(struct acpi_drhd_unit *drhd); extern void print_vtd_entries(struct domain *d, int bus, int devfn, unsigned long gmfn); + +void pdev_flr(u8 bus, u8 devfn); static spinlock_t domid_bitmap_lock; /* protect domain id bitmap */ static int domid_bitmap_size; /* domain id bitmap size in bit */ @@ -1424,6 +1426,7 @@ void return_devices_to_dom0(struct domai dprintk(XENLOG_INFO VTDPREFIX, "return_devices_to_dom0: bdf = %x:%x:%x\n", pdev->bus, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); + pdev_flr(pdev->bus, pdev->devfn); reassign_device_ownership(d, dom0, pdev->bus, pdev->devfn); } @@ -1862,6 +1865,7 @@ int assign_device(struct domain *d, u8 b "assign_device: bus = %x dev = %x func = %x\n", bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); + pdev_flr(bus, devfn); reassign_device_ownership(dom0, d, bus, devfn); /* Setup rmrr identify mapping */ diff -r b38e8c9f7a69 -r 2ec56b04abf4 xen/arch/x86/hvm/vmx/vtd/utils.c --- a/xen/arch/x86/hvm/vmx/vtd/utils.c Fri May 23 11:16:44 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vtd/utils.c Tue May 27 10:37:59 2008 +0100 @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include "dmar.h" @@ -93,6 +93,101 @@ void disable_pmr(struct iommu *iommu) "Disabled protected memory registers\n"); } +static u8 find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap) +{ + u8 id; + int max_cap = 48; + u8 pos = PCI_CAPABILITY_LIST; + u16 status; + + status = read_pci_config_16(bus, dev, func, PCI_STATUS); + if ( (status & PCI_STATUS_CAP_LIST) == 0 ) + return 0; + + while ( max_cap-- ) + { + pos = read_pci_config_byte(bus, dev, func, pos); + if ( pos < 0x40 ) + break; + + pos &= ~3; + id = read_pci_config_byte(bus, dev, func, pos + PCI_CAP_LIST_ID); + + if ( id == 0xff ) + break; + else if ( id == cap ) + return pos; + + pos += PCI_CAP_LIST_NEXT; + } + + return 0; +} + +#define PCI_D3hot (3) +#define PCI_CONFIG_DWORD_SIZE (64) +#define PCI_EXP_DEVCAP_FLR (1 << 28) +#define PCI_EXP_DEVCTL_FLR (1 << 15) + +void pdev_flr(u8 bus, u8 devfn) +{ + u8 pos; + u32 dev_cap, dev_status, pm_ctl; + int flr = 0; + u8 dev = PCI_SLOT(devfn); + u8 func = PCI_FUNC(devfn); + + pos = find_cap_offset(bus, dev, func, PCI_CAP_ID_EXP); + if ( pos != 0 ) + { + dev_cap = read_pci_config(bus, dev, func, pos + PCI_EXP_DEVCAP); + if ( dev_cap & PCI_EXP_DEVCAP_FLR ) + { + write_pci_config(bus, dev, func, + pos + PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_FLR); + do { + dev_status = read_pci_config(bus, dev, func, + pos + PCI_EXP_DEVSTA); + } while ( dev_status & PCI_EXP_DEVSTA_TRPND ); + + flr = 1; + } + } + + /* If this device doesn't support function level reset, + * program device from D0 t0 D3hot, and then return to D0 + * to implement function level reset + */ + if ( flr == 0 ) + { + pos = find_cap_offset(bus, dev, func, PCI_CAP_ID_PM); + if ( pos != 0 ) + { + int i; + u32 config[PCI_CONFIG_DWORD_SIZE]; + for ( i = 0; i < PCI_CONFIG_DWORD_SIZE; i++ ) + config[i] = read_pci_config(bus, dev, func, i*4); + + /* Enter D3hot without soft reset */ + pm_ctl = read_pci_config(bus, dev, func, pos + PCI_PM_CTRL); + pm_ctl |= PCI_PM_CTRL_NO_SOFT_RESET; + pm_ctl &= ~PCI_PM_CTRL_STATE_MASK; + pm_ctl |= PCI_D3hot; + write_pci_config(bus, dev, func, pos + PCI_PM_CTRL, pm_ctl); + mdelay(10); + + /* From D3hot to D0 */ + write_pci_config(bus, dev, func, pos + PCI_PM_CTRL, 0); + mdelay(10); + + /* Write saved configurations to device */ + for ( i = 0; i < PCI_CONFIG_DWORD_SIZE; i++ ) + write_pci_config(bus, dev, func, i*4, config[i]); + + flr = 1; + } + } +} void print_iommu_regs(struct acpi_drhd_unit *drhd) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:06 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:06 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NRe-0003Qm-1u for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:06 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSL-0005se-Dt; Wed, 28 May 2008 15:20:49 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSJ-0005rx-Gk for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:47 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSC-0004yr-NF for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:45 +0000 X-SBRS: 3.6 X-MesageID: 338426 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338426" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJocm022979 for ; Wed, 28 May 2008 08:19:50 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFK8qG010787 for ; Wed, 28 May 2008 08:20:08 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFK8N7010786 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:08 -0700 Message-Id: <200805281520.m4SFK8N7010786@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:07 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vtd: Fix bugs of ioapic interrupt remapping. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211963322 -3600 # Node ID 5de1048b884ec2546f783c97e7c7d5af6dbb40eb # Parent c93a913c221f19d2eea96d9cf9f98d9e10a078ea vtd: Fix bugs of ioapic interrupt remapping. Signed-off-by: Weidong Han Signed-off-by: Allen Kay --- xen/drivers/passthrough/vtd/intremap.c | 150 +++++++++++++++++---------------- 1 files changed, 80 insertions(+), 70 deletions(-) diff -r c93a913c221f -r 5de1048b884e xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Tue May 27 13:03:05 2008 +0100 +++ b/xen/drivers/passthrough/vtd/intremap.c Wed May 28 09:28:42 2008 +0100 @@ -48,14 +48,14 @@ static void remap_entry_to_ioapic_rte( { struct iremap_entry *iremap_entry = NULL, *iremap_entries; struct IO_APIC_route_remap_entry *remap_rte; - unsigned int index; + int index = 0; unsigned long flags; struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); - if ( ir_ctrl == NULL ) + if ( ir_ctrl == NULL || ir_ctrl->iremap_index < 0 ) { dprintk(XENLOG_ERR VTDPREFIX, - "remap_entry_to_ioapic_rte: ir_ctl == NULL"); + "remap_entry_to_ioapic_rte: ir_ctl is not ready\n"); return; } @@ -63,11 +63,8 @@ static void remap_entry_to_ioapic_rte( index = (remap_rte->index_15 << 15) + remap_rte->index_0_14; if ( index > ir_ctrl->iremap_index ) - { - dprintk(XENLOG_ERR VTDPREFIX, - "Index is larger than remap table entry size. Error!\n"); - return; - } + panic("%s: index (%d) is larger than remap table entry size (%d)!\n", + __func__, index, ir_ctrl->iremap_index); spin_lock_irqsave(&ir_ctrl->iremap_lock, flags); @@ -81,79 +78,90 @@ static void remap_entry_to_ioapic_rte( old_rte->trigger = iremap_entry->lo.tm; old_rte->__reserved_2 = 0; old_rte->dest.logical.__reserved_1 = 0; - old_rte->dest.logical.logical_dest = iremap_entry->lo.dst; + old_rte->dest.logical.logical_dest = iremap_entry->lo.dst >> 8; unmap_vtd_domain_page(iremap_entries); spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags); } static void ioapic_rte_to_remap_entry(struct iommu *iommu, - int apic_id, struct IO_APIC_route_entry *old_rte) + int apic_id, struct IO_APIC_route_entry *old_rte, + unsigned int rte_upper, unsigned int value) { struct iremap_entry *iremap_entry = NULL, *iremap_entries; - struct IO_APIC_route_remap_entry *remap_rte; - unsigned int index; + struct iremap_entry new_ire; + struct IO_APIC_route_remap_entry *remap_rte; + struct IO_APIC_route_entry new_rte; + int index; unsigned long flags; - int ret = 0; struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); remap_rte = (struct IO_APIC_route_remap_entry *) old_rte; spin_lock_irqsave(&ir_ctrl->iremap_lock, flags); - index = ir_ctrl->iremap_index; + + if ( remap_rte->format == 0 ) + { + ir_ctrl->iremap_index++; + index = ir_ctrl->iremap_index; + } + else + index = (remap_rte->index_15 << 15) | remap_rte->index_0_14; + if ( index > IREMAP_ENTRY_NR - 1 ) - { - dprintk(XENLOG_ERR VTDPREFIX, - "The interrupt number is more than 256!\n"); - goto out; - } + panic("ioapic_rte_to_remap_entry: intremap index is more than 256!\n"); iremap_entries = (struct iremap_entry *)map_vtd_domain_page(ir_ctrl->iremap_maddr); iremap_entry = &iremap_entries[index]; - if ( *(u64 *)iremap_entry != 0 ) - dprintk(XENLOG_WARNING VTDPREFIX, - "Interrupt remapping entry is in use already!\n"); - iremap_entry->lo.fpd = 0; - iremap_entry->lo.dm = old_rte->dest_mode; - iremap_entry->lo.rh = 0; - iremap_entry->lo.tm = old_rte->trigger; - iremap_entry->lo.dlm = old_rte->delivery_mode; - iremap_entry->lo.avail = 0; - iremap_entry->lo.res_1 = 0; - iremap_entry->lo.vector = old_rte->vector; - iremap_entry->lo.res_2 = 0; - iremap_entry->lo.dst = (old_rte->dest.logical.logical_dest << 8); - iremap_entry->hi.sid = apicid_to_bdf(apic_id); - iremap_entry->hi.sq = 0; /* comparing all 16-bit of SID */ - iremap_entry->hi.svt = 1; /* turn on requestor ID verification SID/SQ */ - iremap_entry->hi.res_1 = 0; - iremap_entry->lo.p = 1; /* finally, set present bit */ - ir_ctrl->iremap_index++; + memcpy(&new_ire, iremap_entry, sizeof(struct iremap_entry)); + + if ( rte_upper ) + new_ire.lo.dst = (value >> 24) << 8; + else + { + *(((u32 *)&new_rte) + 0) = value; + new_ire.lo.fpd = 0; + new_ire.lo.dm = new_rte.dest_mode; + new_ire.lo.rh = 0; + new_ire.lo.tm = new_rte.trigger; + new_ire.lo.dlm = new_rte.delivery_mode; + new_ire.lo.avail = 0; + new_ire.lo.res_1 = 0; + new_ire.lo.vector = new_rte.vector; + new_ire.lo.res_2 = 0; + new_ire.hi.sid = apicid_to_bdf(apic_id); + + new_ire.hi.sq = 0; /* comparing all 16-bit of SID */ + new_ire.hi.svt = 1; /* requestor ID verification SID/SQ */ + new_ire.hi.res_1 = 0; + new_ire.lo.p = 1; /* finally, set present bit */ + + /* now construct new ioapic rte entry */ + remap_rte->vector = new_rte.vector; + remap_rte->delivery_mode = 0; /* has to be 0 for remap format */ + remap_rte->index_15 = index & 0x8000; + remap_rte->index_0_14 = index & 0x7fff; + + remap_rte->delivery_status = new_rte.delivery_status; + remap_rte->polarity = new_rte.polarity; + remap_rte->irr = new_rte.irr; + remap_rte->trigger = new_rte.trigger; + remap_rte->mask = new_rte.mask; + remap_rte->reserved = 0; + remap_rte->format = 1; /* indicate remap format */ + } + + memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry)); + iommu_flush_iec_index(iommu, 0, index); + invalidate_sync(iommu); unmap_vtd_domain_page(iremap_entries); - iommu_flush_iec_index(iommu, 0, index); - ret = invalidate_sync(iommu); - - /* now construct new ioapic rte entry */ - remap_rte->vector = old_rte->vector; - remap_rte->delivery_mode = 0; /* has to be 0 for remap format */ - remap_rte->index_15 = index & 0x8000; - remap_rte->index_0_14 = index & 0x7fff; - remap_rte->delivery_status = old_rte->delivery_status; - remap_rte->polarity = old_rte->polarity; - remap_rte->irr = old_rte->irr; - remap_rte->trigger = old_rte->trigger; - remap_rte->mask = 1; - remap_rte->reserved = 0; - remap_rte->format = 1; /* indicate remap format */ -out: spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags); return; } -unsigned int -io_apic_read_remap_rte( +unsigned int io_apic_read_remap_rte( unsigned int apic, unsigned int reg) { struct IO_APIC_route_entry old_rte = { 0 }; @@ -198,15 +206,15 @@ io_apic_read_remap_rte( } } -void -io_apic_write_remap_rte( +void io_apic_write_remap_rte( unsigned int apic, unsigned int reg, unsigned int value) { struct IO_APIC_route_entry old_rte = { 0 }; struct IO_APIC_route_remap_entry *remap_rte; - int rte_upper = (reg & 1) ? 1 : 0; + unsigned int rte_upper = (reg & 1) ? 1 : 0; struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid); struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); + int saved_mask; if ( !iommu || !ir_ctrl || ir_ctrl->iremap_maddr == 0 ) { @@ -225,21 +233,22 @@ io_apic_write_remap_rte( *(((u32 *)&old_rte) + 1) = *(IO_APIC_BASE(apic)+4); remap_rte = (struct IO_APIC_route_remap_entry *) &old_rte; - if ( remap_rte->mask || (remap_rte->format == 0) ) - { - *IO_APIC_BASE(apic) = rte_upper ? ++reg : reg; - *(IO_APIC_BASE(apic)+4) = value; - return; - } - - *(((u32 *)&old_rte) + rte_upper) = value; - ioapic_rte_to_remap_entry(iommu, mp_ioapics[apic].mpc_apicid, &old_rte); + + /* mask the interrupt while we change the intremap table */ + saved_mask = remap_rte->mask; + remap_rte->mask = 1; + *IO_APIC_BASE(apic) = reg; + *(IO_APIC_BASE(apic)+4) = *(((int *)&old_rte)+0); + remap_rte->mask = saved_mask; + + ioapic_rte_to_remap_entry(iommu, mp_ioapics[apic].mpc_apicid, + &old_rte, rte_upper, value); /* write new entry to ioapic */ *IO_APIC_BASE(apic) = reg; - *(IO_APIC_BASE(apic)+4) = *(((int *)&old_rte)+0); + *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+0); *IO_APIC_BASE(apic) = reg + 1; - *(IO_APIC_BASE(apic)+4) = *(((int *)&old_rte)+1); + *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+1); } int intremap_setup(struct iommu *iommu) @@ -260,6 +269,7 @@ int intremap_setup(struct iommu *iommu) "Cannot allocate memory for ir_ctrl->iremap_maddr\n"); return -ENODEV; } + ir_ctrl->iremap_index = -1; } #if defined(ENABLED_EXTENDED_INTERRUPT_SUPPORT) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:10 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:10 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NRh-0003Qr-RY for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:10 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSP-0005vw-71; Wed, 28 May 2008 15:20:53 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSM-0005s6-M5 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSF-0004yv-TE for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:48 +0000 X-SBRS: 3.6 X-MesageID: 338427 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338427" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJpst022982 for ; Wed, 28 May 2008 08:19:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFK9fR010804 for ; Wed, 28 May 2008 08:20:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFK91U010803 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:09 -0700 Message-Id: <200805281520.m4SFK91U010803@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:09 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vtd: interrupt remapping for MSI/MSI-x. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211963345 -3600 # Node ID 1e66fa5931ee46e8740871a3b372b2b01734a441 # Parent 5de1048b884ec2546f783c97e7c7d5af6dbb40eb vtd: interrupt remapping for MSI/MSI-x. Signed-off-by: Weidong Han --- xen/arch/x86/msi.c | 7 + xen/drivers/passthrough/vtd/intremap.c | 170 +++++++++++++++++++++++++++++++++ xen/drivers/passthrough/vtd/vtd.h | 18 +++ xen/include/xen/iommu.h | 3 4 files changed, 198 insertions(+) diff -r 5de1048b884e -r 1e66fa5931ee xen/arch/x86/msi.c --- a/xen/arch/x86/msi.c Wed May 28 09:28:42 2008 +0100 +++ b/xen/arch/x86/msi.c Wed May 28 09:29:05 2008 +0100 @@ -25,6 +25,7 @@ #include #include #include +#include extern int msi_irq_enable; @@ -156,6 +157,9 @@ void read_msi_msg(unsigned int irq, stru default: BUG(); } + + if ( vtd_enabled ) + msi_msg_read_remap_rte(entry, msg); } static int set_vector_msi(struct msi_desc *entry) @@ -201,6 +205,9 @@ void write_msi_msg(unsigned int irq, str void write_msi_msg(unsigned int irq, struct msi_msg *msg) { struct msi_desc *entry = irq_desc[irq].msi_desc; + + if ( vtd_enabled ) + msi_msg_write_remap_rte(entry, msg); switch ( entry->msi_attrib.type ) { diff -r 5de1048b884e -r 1e66fa5931ee xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Wed May 28 09:28:42 2008 +0100 +++ b/xen/drivers/passthrough/vtd/intremap.c Wed May 28 09:29:05 2008 +0100 @@ -251,6 +251,176 @@ void io_apic_write_remap_rte( *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+1); } +static void remap_entry_to_msi_msg( + struct iommu *iommu, struct msi_msg *msg) +{ + struct iremap_entry *iremap_entry = NULL, *iremap_entries; + struct msi_msg_remap_entry *remap_rte; + int index; + unsigned long flags; + struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); + + if ( ir_ctrl == NULL ) + { + dprintk(XENLOG_ERR VTDPREFIX, + "remap_entry_to_msi_msg: ir_ctl == NULL"); + return; + } + + remap_rte = (struct msi_msg_remap_entry *) msg; + index = (remap_rte->address_lo.index_15 << 15) | + remap_rte->address_lo.index_0_14; + + if ( index > ir_ctrl->iremap_index ) + panic("%s: index (%d) is larger than remap table entry size (%d)\n", + __func__, index, ir_ctrl->iremap_index); + + spin_lock_irqsave(&ir_ctrl->iremap_lock, flags); + + iremap_entries = + (struct iremap_entry *)map_vtd_domain_page(ir_ctrl->iremap_maddr); + iremap_entry = &iremap_entries[index]; + + msg->address_hi = MSI_ADDR_BASE_HI; + msg->address_lo = + MSI_ADDR_BASE_LO | + ((iremap_entry->lo.dm == 0) ? + MSI_ADDR_DESTMODE_PHYS: + MSI_ADDR_DESTMODE_LOGIC) | + ((iremap_entry->lo.dlm != dest_LowestPrio) ? + MSI_ADDR_REDIRECTION_CPU: + MSI_ADDR_REDIRECTION_LOWPRI) | + iremap_entry->lo.dst >> 8; + + msg->data = + MSI_DATA_TRIGGER_EDGE | + MSI_DATA_LEVEL_ASSERT | + ((iremap_entry->lo.dlm != dest_LowestPrio) ? + MSI_DATA_DELIVERY_FIXED: + MSI_DATA_DELIVERY_LOWPRI) | + iremap_entry->lo.vector; + + unmap_vtd_domain_page(iremap_entries); + spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags); +} + +static void msi_msg_to_remap_entry( + struct iommu *iommu, struct pci_dev *pdev, struct msi_msg *msg) +{ + struct iremap_entry *iremap_entry = NULL, *iremap_entries; + struct iremap_entry new_ire; + struct msi_msg_remap_entry *remap_rte; + unsigned int index; + unsigned long flags; + struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); + int i = 0; + + remap_rte = (struct msi_msg_remap_entry *) msg; + spin_lock_irqsave(&ir_ctrl->iremap_lock, flags); + + iremap_entries = + (struct iremap_entry *)map_vtd_domain_page(ir_ctrl->iremap_maddr); + + /* If the entry for a PCI device has been there, use the old entry, + * Or, assign a new entry for it. + */ + for ( i = 0; i <= ir_ctrl->iremap_index; i++ ) + { + iremap_entry = &iremap_entries[i]; + if ( iremap_entry->hi.sid == + ((pdev->bus << 8) | pdev->devfn) ) + break; + } + + if ( i > ir_ctrl->iremap_index ) + { + ir_ctrl->iremap_index++; + index = ir_ctrl->iremap_index; + } + else + index = i; + + if ( index > IREMAP_ENTRY_NR - 1 ) + panic("msi_msg_to_remap_entry: intremap index is more than 256!\n"); + + iremap_entry = &iremap_entries[index]; + memcpy(&new_ire, iremap_entry, sizeof(struct iremap_entry)); + + /* Set interrupt remapping table entry */ + new_ire.lo.fpd = 0; + new_ire.lo.dm = (msg->address_lo >> MSI_ADDR_DESTMODE_SHIFT) & 0x1; + new_ire.lo.rh = 0; + new_ire.lo.tm = (msg->data >> MSI_DATA_TRIGGER_SHIFT) & 0x1; + new_ire.lo.dlm = (msg->data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x1; + new_ire.lo.avail = 0; + new_ire.lo.res_1 = 0; + new_ire.lo.vector = (msg->data >> MSI_DATA_VECTOR_SHIFT) & + MSI_DATA_VECTOR_MASK; + new_ire.lo.res_2 = 0; + new_ire.lo.dst = ((msg->address_lo >> MSI_ADDR_DEST_ID_SHIFT) + & 0xff) << 8; + + new_ire.hi.sid = (pdev->bus << 8) | pdev->devfn; + new_ire.hi.sq = 0; + new_ire.hi.svt = 1; + new_ire.hi.res_1 = 0; + new_ire.lo.p = 1; /* finally, set present bit */ + + /* now construct new MSI/MSI-X rte entry */ + remap_rte->address_lo.dontcare = 0; + remap_rte->address_lo.index_15 = index & 0x8000; + remap_rte->address_lo.index_0_14 = index & 0x7fff; + remap_rte->address_lo.SHV = 1; + remap_rte->address_lo.format = 1; + + remap_rte->address_hi = 0; + remap_rte->data = 0; + + memcpy(iremap_entry, &new_ire, sizeof(struct iremap_entry)); + iommu_flush_iec_index(iommu, 0, index); + invalidate_sync(iommu); + + unmap_vtd_domain_page(iremap_entries); + spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags); + return; +} + +void msi_msg_read_remap_rte( + struct msi_desc *msi_desc, struct msi_msg *msg) +{ + struct pci_dev *pdev = msi_desc->dev; + struct acpi_drhd_unit *drhd = NULL; + struct iommu *iommu = NULL; + struct ir_ctrl *ir_ctrl; + + drhd = acpi_find_matched_drhd_unit(pdev); + iommu = drhd->iommu; + + ir_ctrl = iommu_ir_ctrl(iommu); + if ( !iommu || !ir_ctrl || ir_ctrl->iremap_maddr == 0 ) + return; + + remap_entry_to_msi_msg(iommu, msg); +} + +void msi_msg_write_remap_rte( + struct msi_desc *msi_desc, struct msi_msg *msg) +{ + struct pci_dev *pdev = msi_desc->dev; + struct acpi_drhd_unit *drhd = NULL; + struct iommu *iommu = NULL; + struct ir_ctrl *ir_ctrl; + + drhd = acpi_find_matched_drhd_unit(msi_desc->dev); + iommu = drhd->iommu; + + ir_ctrl = iommu_ir_ctrl(iommu); + if ( !iommu || !ir_ctrl || ir_ctrl->iremap_maddr == 0 ) + return; + + msi_msg_to_remap_entry(iommu, pdev, msg); +} + int intremap_setup(struct iommu *iommu) { struct ir_ctrl *ir_ctrl; diff -r 5de1048b884e -r 1e66fa5931ee xen/drivers/passthrough/vtd/vtd.h --- a/xen/drivers/passthrough/vtd/vtd.h Wed May 28 09:28:42 2008 +0100 +++ b/xen/drivers/passthrough/vtd/vtd.h Wed May 28 09:29:05 2008 +0100 @@ -42,6 +42,24 @@ struct IO_APIC_route_remap_entry { }; }; +struct msi_msg_remap_entry { + union { + u32 val; + struct { + u32 dontcare:2, + index_15:1, + SHV:1, + format:1, + index_0_14:15, + addr_id_val:12; /* Interrupt address identifier value, + must be 0FEEh */ + }; + } address_lo; /* low 32 bits of msi message address */ + + u32 address_hi; /* high 32 bits of msi message address */ + u32 data; /* msi message data */ +}; + unsigned int get_clflush_size(void); u64 alloc_pgtable_maddr(void); void free_pgtable_maddr(u64 maddr); diff -r 5de1048b884e -r 1e66fa5931ee xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Wed May 28 09:28:42 2008 +0100 +++ b/xen/include/xen/iommu.h Wed May 28 09:29:05 2008 +0100 @@ -26,6 +26,7 @@ #include #include #include +#include extern int vtd_enabled; extern int iommu_enabled; @@ -78,6 +79,8 @@ unsigned int io_apic_read_remap_rte(unsi unsigned int io_apic_read_remap_rte(unsigned int apic, unsigned int reg); void io_apic_write_remap_rte(unsigned int apic, unsigned int reg, unsigned int value); +void msi_msg_read_remap_rte(struct msi_desc *msi_desc, struct msi_msg *msg); +void msi_msg_write_remap_rte(struct msi_desc *msi_desc, struct msi_msg *msg); struct qi_ctrl *iommu_qi_ctrl(struct iommu *iommu); struct ir_ctrl *iommu_ir_ctrl(struct iommu *iommu); struct iommu_flush *iommu_get_flush(struct iommu *iommu); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NRl-0003Qu-W4 for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:14 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NST-0005zf-7Z; Wed, 28 May 2008 15:20:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSO-0005tn-0b for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:52 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSH-0004yw-50 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:49 +0000 X-SBRS: 3.6 X-MesageID: 338428 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338428" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:52 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJqb1022985 for ; Wed, 28 May 2008 08:19:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKA54010821 for ; Wed, 28 May 2008 08:20:10 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKAFG010820 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:10 -0700 Message-Id: <200805281520.m4SFKAFG010820@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:10 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] stubdom: make the build more generic by moving as many stubdom parts X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211963448 -3600 # Node ID 460f72ca97b6544e36c2fbe264d2d690ce0e815d # Parent 1e66fa5931ee46e8740871a3b372b2b01734a441 stubdom: make the build more generic by moving as many stubdom parts into stubdom/ as possible. That also permits to build all of ioemu, c and caml stubdoms at the same time. Signed-off-by: Samuel Thibault --- extras/mini-os/main-caml.c | 42 ------------------------------------------ extras/mini-os/Config.mk | 8 -------- extras/mini-os/Makefile | 33 +++++++-------------------------- extras/mini-os/main.c | 2 -- stubdom/Makefile | 33 ++++++++++++++++++--------------- stubdom/c/Makefile | 7 ++++++- stubdom/c/main.c | 2 ++ stubdom/caml/Makefile | 10 +++++++++- stubdom/caml/main-caml.c | 42 ++++++++++++++++++++++++++++++++++++++++++ tools/ioemu/Makefile.target | 7 +++++++ 10 files changed, 91 insertions(+), 95 deletions(-) diff -r 1e66fa5931ee -r 460f72ca97b6 extras/mini-os/Config.mk --- a/extras/mini-os/Config.mk Wed May 28 09:29:05 2008 +0100 +++ b/extras/mini-os/Config.mk Wed May 28 09:30:48 2008 +0100 @@ -55,11 +55,3 @@ DEF_CPPFLAGS += -I$(LWIPDIR)/src/include DEF_CPPFLAGS += -I$(LWIPDIR)/src/include DEF_CPPFLAGS += -I$(LWIPDIR)/src/include/ipv4 endif - -ifneq ($(QEMUDIR),) -qemu=y -endif - -ifneq ($(CAMLDIR),) -caml=y -endif diff -r 1e66fa5931ee -r 460f72ca97b6 extras/mini-os/Makefile --- a/extras/mini-os/Makefile Wed May 28 09:29:05 2008 +0100 +++ b/extras/mini-os/Makefile Wed May 28 09:30:48 2008 +0100 @@ -73,44 +73,25 @@ OBJS += lwip.a OBJS += lwip.a endif -OBJS := $(filter-out lwip%.o $(LWO), $(OBJS)) - -ifeq ($(caml),y) -CAMLLIB = $(shell ocamlc -where) -APP_OBJS += main-caml.o -APP_OBJS += $(CAMLDIR)/caml.o -APP_OBJS += $(CAMLLIB)/libasmrun.a -CFLAGS += -I$(CAMLLIB) -APP_LDLIBS += -lm -endif -OBJS := $(filter-out main-caml.o, $(OBJS)) - -ifeq ($(qemu),y) -APP_OBJS += $(QEMUDIR)/i386-dm-stubdom/qemu.a $(QEMUDIR)/i386-dm-stubdom/libqemu.a -CFLAGS += -DCONFIG_QEMU -endif - -ifneq ($(CDIR),) -APP_OBJS += $(CDIR)/main.a -APP_LDLIBS += -endif +OBJS := $(filter-out main.o lwip%.o $(LWO), $(OBJS)) ifeq ($(libc),y) APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -whole-archive -lxenguest -lxenctrl -no-whole-archive APP_LDLIBS += -lpci APP_LDLIBS += -lz +APP_LDLIBS += -lm LDLIBS += -lc endif -ifneq ($(caml)-$(qemu)-$(CDIR)-$(lwip),---y) +ifneq ($(APP_OBJS)-$(lwip),-y) OBJS := $(filter-out daytime.o, $(OBJS)) endif -app.o: $(APP_OBJS) app.lds - $(LD) -r -d $(LDFLAGS) $^ $(APP_LDLIBS) --undefined main -o $@ +$(TARGET)_app.o: $(APP_OBJS) app.lds + $(LD) -r -d $(LDFLAGS) $^ $(APP_LDLIBS) --undefined app_main -o $@ -$(TARGET): links $(OBJS) app.o arch_lib - $(LD) -r $(LDFLAGS) $(HEAD_OBJ) app.o $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o +$(TARGET): links $(OBJS) $(TARGET)_app.o arch_lib + $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(TARGET)_app.o $(OBJS) $(LDARCHLIB) $(LDLIBS) -o $@.o $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@ gzip -f -9 -c $@ >$@.gz diff -r 1e66fa5931ee -r 460f72ca97b6 extras/mini-os/main-caml.c --- a/extras/mini-os/main-caml.c Wed May 28 09:29:05 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Caml bootstrap - * - * Samuel Thibault , January 2008 - */ - -#include -#include - -#include -#include -#include - -/* Ugly binary compatibility with Linux */ -FILE *_stderr asm("stderr"); -int *__errno_location; -/* Will probably break everything, probably need to fetch from glibc */ -void *__ctype_b_loc; - -int main(int argc, char *argv[], char *envp[]) -{ - value *val; - - /* Get current thread's value */ - _stderr = stderr; - __errno_location = &errno; - - printf("starting caml\n"); - - /* Wait before things might hang up */ - sleep(1); - - caml_startup(argv); - val = caml_named_value("main"); - if (!val) { - printf("Couldn't find Caml main"); - return 1; - } - caml_callback(*val, Val_int(0)); - printf("callback returned\n"); - return 0; -} diff -r 1e66fa5931ee -r 460f72ca97b6 extras/mini-os/main.c --- a/extras/mini-os/main.c Wed May 28 09:29:05 2008 +0100 +++ b/extras/mini-os/main.c Wed May 28 09:30:48 2008 +0100 @@ -4,7 +4,6 @@ * Samuel Thibault , October 2007 */ -#ifdef HAVE_LIBC #include #include #include @@ -180,4 +179,3 @@ int app_main(start_info_t *si) main_thread = create_thread("main", call_main, si); return 0; } -#endif diff -r 1e66fa5931ee -r 460f72ca97b6 stubdom/Makefile --- a/stubdom/Makefile Wed May 28 09:29:05 2008 +0100 +++ b/stubdom/Makefile Wed May 28 09:30:48 2008 +0100 @@ -37,7 +37,7 @@ export PATH:=$(CROSS_PREFIX)/bin:$(PATH) export PATH:=$(CROSS_PREFIX)/bin:$(PATH) .PHONY: all -all: qemu-stubdom +all: ioemu-stubdom c-stubdom ################ # Cross-binutils @@ -174,6 +174,7 @@ mk-symlinks: ([ ! -h config-host.h ] || rm -f config-host.h) && \ ([ ! -h config-host.mak ] || rm -f config-host.mak) ) [ -h mini-os ] || ln -sf ../extras/mini-os . + [ -h mini-os/include/xen ] || ln -sf ../../../xen/include/public mini-os/include/xen ####### # libxc @@ -198,40 +199,41 @@ ioemu: cross-zlib cross-libpci mk-symlin ###### .PHONY: caml -caml: - $(MAKE) -C $@ +caml: mk-symlinks + $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs ### # C ### .PHONY: c -c: - $(MAKE) -C $@ +c: mk-symlinks + $(MAKE) -C $@ LWIPDIR=$(CURDIR)/lwip-cvs ######## # minios ######## -.PHONY: qemu-stubdom -qemu-stubdom: mk-symlinks lwip-cvs libxc ioemu - $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs QEMUDIR=$(CURDIR)/ioemu - +.PHONY: ioemu-stubdom +ioemu-stubdom: lwip-cvs libxc ioemu + $(MAKE) -C mini-os TARGET=$@ LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS="$(CURDIR)/ioemu/i386-dm-stubdom/qemu.a $(CURDIR)/ioemu/i386-dm-stubdom/libqemu.a" + +CAMLLIB = $(shell ocamlc -where) .PHONY: caml-stubdom -caml-stubdom: mk-symlinks lwip-cvs libxc cross-libpci caml - $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs CAMLDIR=$(CURDIR)/caml +caml-stubdom: lwip-cvs libxc caml + $(MAKE) -C mini-os TARGET=$@ LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS="$(CURDIR)/caml/main-c.o $(CURDIR)/caml/main-caml.o $(CURDIR)/caml/caml.o $(CAMLLIB)/libasmrun.a" .PHONY: c-stubdom -c-stubdom: mk-symlinks lwip-cvs libxc cross-libpci c - $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs CDIR=$(CURDIR)/c +c-stubdom: lwip-cvs libxc c + $(MAKE) -C mini-os TARGET=$@ LWIPDIR=$(CURDIR)/lwip-cvs APP_OBJS=$(CURDIR)/c/main.a ######### # install ######### -install: mini-os/mini-os.gz +install: mini-os/ioemu-stubdom.gz $(INSTALL_PROG) stubdom-dm "$(DESTDIR)/usr/lib/xen/bin" - $(INSTALL_PROG) mini-os/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/stubdom.gz" + $(INSTALL_PROG) $< "$(DESTDIR)/usr/lib/xen/boot/stubdom.gz" ####### # clean @@ -242,6 +244,7 @@ clean: clean: -$(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs clean $(MAKE) -C caml clean + $(MAKE) -C c clean rm -fr libxc ioemu mini-os include # clean the cross-compilation result diff -r 1e66fa5931ee -r 460f72ca97b6 stubdom/c/Makefile --- a/stubdom/c/Makefile Wed May 28 09:29:05 2008 +0100 +++ b/stubdom/c/Makefile Wed May 28 09:30:48 2008 +0100 @@ -2,7 +2,12 @@ XEN_ROOT = ../.. include $(XEN_ROOT)/Config.mk -main.a: main.o +all: main.a + +main-c.c: + ln -sf $(XEN_ROOT)/extras/mini-os/main.c $@ + +main.a: main-c.o main.o $(AR) cr $@ $^ clean: diff -r 1e66fa5931ee -r 460f72ca97b6 stubdom/c/main.c --- a/stubdom/c/main.c Wed May 28 09:29:05 2008 +0100 +++ b/stubdom/c/main.c Wed May 28 09:30:48 2008 +0100 @@ -1,4 +1,6 @@ #include +#include + int main(void) { sleep(2); printf("Hello, world!\n"); diff -r 1e66fa5931ee -r 460f72ca97b6 stubdom/caml/Makefile --- a/stubdom/caml/Makefile Wed May 28 09:29:05 2008 +0100 +++ b/stubdom/caml/Makefile Wed May 28 09:30:48 2008 +0100 @@ -1,12 +1,20 @@ XEN_ROOT = ../.. XEN_ROOT = ../.. include $(XEN_ROOT)/Config.mk + +CAMLLIB = $(shell ocamlc -where) +DEF_CPPFLAGS += -I$(CAMLLIB) OCAMLFIND=ocamlfind OCAMLOPT=ocamlopt OBJS := hello.cmx LIBS := + +all: main-c.o main-caml.o caml.o + +main-c.c: + ln -sf $(XEN_ROOT)/extras/mini-os/main.c $@ %.cmx: %.ml $(OCAMLFIND) $(OCAMLOPT) -c $< -o $@ @@ -15,4 +23,4 @@ caml.o: $(OBJS) $(OCAMLFIND) $(OCAMLOPT) $(LIBS) $^ -output-obj -o $@ clean: - rm -f *.o *.cmx *.cmi + rm -f *.a *.o *.cmx *.cmi diff -r 1e66fa5931ee -r 460f72ca97b6 stubdom/caml/main-caml.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stubdom/caml/main-caml.c Wed May 28 09:30:48 2008 +0100 @@ -0,0 +1,42 @@ +/* + * Caml bootstrap + * + * Samuel Thibault , January 2008 + */ + +#include +#include + +#include +#include +#include + +/* Ugly binary compatibility with Linux */ +FILE *_stderr asm("stderr"); +int *__errno_location; +/* Will probably break everything, probably need to fetch from glibc */ +void *__ctype_b_loc; + +int main(int argc, char *argv[], char *envp[]) +{ + value *val; + + /* Get current thread's value */ + _stderr = stderr; + __errno_location = &errno; + + printf("starting caml\n"); + + /* Wait before things might hang up */ + sleep(1); + + caml_startup(argv); + val = caml_named_value("main"); + if (!val) { + printf("Couldn't find Caml main"); + return 1; + } + caml_callback(*val, Val_int(0)); + printf("callback returned\n"); + return 0; +} diff -r 1e66fa5931ee -r 460f72ca97b6 tools/ioemu/Makefile.target --- a/tools/ioemu/Makefile.target Wed May 28 09:29:05 2008 +0100 +++ b/tools/ioemu/Makefile.target Wed May 28 09:30:48 2008 +0100 @@ -358,6 +358,13 @@ endif endif ifdef CONFIG_STUBDOM +VL_OBJS+=main-qemu.o +CFLAGS += -DCONFIG_QEMU +main-qemu.c: + ln -s $(XEN_ROOT)/extras/mini-os/main.c $@ +endif + +ifdef CONFIG_STUBDOM #CONFIG_PASSTHROUGH=1 else ifeq (,$(wildcard /usr/include/pci)) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:19 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:19 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NRq-0003Qy-Vz for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:19 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSY-000646-9m; Wed, 28 May 2008 15:21:02 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSR-0005w6-4O for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:55 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSH-0004yr-V1 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:53 +0000 X-SBRS: 3.6 X-MesageID: 338429 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338429" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJrNu022988 for ; Wed, 28 May 2008 08:19:53 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKBn9010838 for ; Wed, 28 May 2008 08:20:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKB2T010837 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:11 -0700 Message-Id: <200805281520.m4SFKB2T010837@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:11 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] stubdom: Save main_thread value by moving it out from app_bss which X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211963464 -3600 # Node ID 38ec0d6748429050a349fb9e73b948389df0616d # Parent 460f72ca97b6544e36c2fbe264d2d690ce0e815d stubdom: Save main_thread value by moving it out from app_bss which gets cleared. Signed-off-by: Samuel Thibault --- extras/mini-os/main.c | 2 -- extras/mini-os/sched.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff -r 460f72ca97b6 -r 38ec0d674842 extras/mini-os/main.c --- a/extras/mini-os/main.c Wed May 28 09:30:48 2008 +0100 +++ b/extras/mini-os/main.c Wed May 28 09:31:04 2008 +0100 @@ -20,8 +20,6 @@ extern void __libc_fini_array(void); extern void __libc_fini_array(void); extern unsigned long __CTOR_LIST__[]; extern unsigned long __DTOR_LIST__[]; - -struct thread *main_thread; #if 0 #include diff -r 460f72ca97b6 -r 38ec0d674842 extras/mini-os/sched.c --- a/extras/mini-os/sched.c Wed May 28 09:30:48 2008 +0100 +++ b/extras/mini-os/sched.c Wed May 28 09:31:04 2008 +0100 @@ -57,6 +57,8 @@ struct thread *idle_thread = NULL; struct thread *idle_thread = NULL; LIST_HEAD(exited_threads); static int threads_started; + +struct thread *main_thread; void inline print_runqueue(void) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NRu-0003R3-Sk for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSc-00067k-7C; Wed, 28 May 2008 15:21:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSS-0005x4-0E for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:56 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSL-0004yv-3k for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:53 +0000 X-SBRS: 3.6 X-MesageID: 338430 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338430" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:54 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJstb022991 for ; Wed, 28 May 2008 08:19:54 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKCsd010855 for ; Wed, 28 May 2008 08:20:12 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKCQf010854 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:12 -0700 Message-Id: <200805281520.m4SFKCQf010854@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:12 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vtd: IOTLB flush fixups X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211963509 -3600 # Node ID 3613160e4fd17be429b8b7e18af3efb5d21a9ec3 # Parent 38ec0d6748429050a349fb9e73b948389df0616d vtd: IOTLB flush fixups On map: only flush when old PTE was valid or invalid PTE may be cached. On unmap: always flush old entry, but skip flush for unaffected IOMMUs. Signed-off-by: Espen Skoglund --- xen/drivers/passthrough/vtd/iommu.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff -r 38ec0d674842 -r 3613160e4fd1 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed May 28 09:31:04 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed May 28 09:31:49 2008 +0100 @@ -1526,6 +1526,7 @@ int intel_iommu_map_page( struct iommu *iommu; struct dma_pte *page = NULL, *pte = NULL; u64 pg_maddr; + int pte_present; drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); iommu = drhd->iommu; @@ -1541,6 +1542,7 @@ int intel_iommu_map_page( return -ENOMEM; page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); pte = page + (gfn & LEVEL_MASK); + pte_present = dma_pte_present(*pte); dma_set_pte_addr(*pte, (paddr_t)mfn << PAGE_SHIFT_4K); dma_set_pte_prot(*pte, DMA_PTE_READ | DMA_PTE_WRITE); iommu_flush_cache_entry(iommu, pte); @@ -1553,7 +1555,7 @@ int intel_iommu_map_page( if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) continue; - if ( cap_caching_mode(iommu->cap) ) + if ( pte_present || cap_caching_mode(iommu->cap) ) iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0); else if ( cap_rwbf(iommu->cap) ) @@ -1565,6 +1567,7 @@ int intel_iommu_map_page( int intel_iommu_unmap_page(struct domain *d, unsigned long gfn) { + struct hvm_iommu *hd = domain_hvm_iommu(d); struct acpi_drhd_unit *drhd; struct iommu *iommu; struct dma_pte *page = NULL, *pte = NULL; @@ -1591,11 +1594,13 @@ int intel_iommu_unmap_page(struct domain for_each_drhd_unit ( drhd ) { iommu = drhd->iommu; - if ( cap_caching_mode(iommu->cap) ) - iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), - (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0); - else if ( cap_rwbf(iommu->cap) ) - iommu_flush_write_buffer(iommu); + + if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) + continue; + + if ( iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), + (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0) ) + iommu_flush_write_buffer(iommu); } return 0; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:27 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:27 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NRz-0003R7-0J for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:27 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSg-0006BS-AD; Wed, 28 May 2008 15:21:10 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NST-0005yK-86 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:57 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSM-0004yw-F0 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:55 +0000 X-SBRS: 3.6 X-MesageID: 338431 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338431" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:55 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJt3B022994 for ; Wed, 28 May 2008 08:19:55 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKDG0010872 for ; Wed, 28 May 2008 08:20:13 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKDbD010871 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:13 -0700 Message-Id: <200805281520.m4SFKDbD010871@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] hvmloader: No need to map shared_info page into the legacy VGA MMIO X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211965320 -3600 # Node ID 4c75850a0caa8eb17bfad76ec02c6ccfc73914aa # Parent 3613160e4fd17be429b8b7e18af3efb5d21a9ec3 hvmloader: No need to map shared_info page into the legacy VGA MMIO hole. We can access address 0xfffff000 from 32-bit protected mode. Signed-off-by: Keir Fraser --- tools/firmware/hvmloader/util.c | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-) diff -r 3613160e4fd1 -r 4c75850a0caa tools/firmware/hvmloader/util.c --- a/tools/firmware/hvmloader/util.c Wed May 28 09:31:49 2008 +0100 +++ b/tools/firmware/hvmloader/util.c Wed May 28 10:02:00 2008 +0100 @@ -609,7 +609,7 @@ uint16_t get_cpu_mhz(void) uint16_t get_cpu_mhz(void) { struct xen_add_to_physmap xatp; - struct shared_info *shared_info = (struct shared_info *)0xa0000; + struct shared_info *shared_info = (struct shared_info *)0xfffff000; struct vcpu_time_info *info = &shared_info->vcpu_info[0].time; uint64_t cpu_khz; uint32_t tsc_to_nsec_mul, version; @@ -619,7 +619,7 @@ uint16_t get_cpu_mhz(void) if ( cpu_mhz != 0 ) return cpu_mhz; - /* Map shared-info page to 0xa0000 (i.e., overlap VGA hole). */ + /* Map shared-info page. */ xatp.domid = DOMID_SELF; xatp.space = XENMAPSPACE_shared_info; xatp.idx = 0; @@ -643,14 +643,6 @@ uint16_t get_cpu_mhz(void) cpu_khz = cpu_khz << -tsc_shift; else cpu_khz = cpu_khz >> tsc_shift; - - /* Get the VGA MMIO hole back by remapping shared info to scratch. */ - xatp.domid = DOMID_SELF; - xatp.space = XENMAPSPACE_shared_info; - xatp.idx = 0; - xatp.gpfn = 0xfffff; /* scratch pfn */ - if ( hypercall_memory_op(XENMEM_add_to_physmap, &xatp) != 0 ) - BUG(); cpu_mhz = (uint16_t)(((uint32_t)cpu_khz + 500) / 1000); return cpu_mhz; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:30 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:30 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NS2-0003RB-0x for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:30 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSj-0006Eb-EV; Wed, 28 May 2008 15:21:13 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSX-00061d-1i for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:21:01 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSP-0004yr-IM for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:58 +0000 X-SBRS: 3.6 X-MesageID: 338432 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338432" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:56 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJuDO022997 for ; Wed, 28 May 2008 08:19:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKEGe010889 for ; Wed, 28 May 2008 08:20:14 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKEcE010888 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:14 -0700 Message-Id: <200805281520.m4SFKEcE010888@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:13 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vtd: TLB flush fixups. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211965557 -3600 # Node ID 54289753904549c5fe1a97e50c5b87af6c795179 # Parent 4c75850a0caa8eb17bfad76ec02c6ccfc73914aa vtd: TLB flush fixups. Signed-off-by: Xiaowei Yang --- xen/arch/x86/mm/hap/p2m-ept.c | 6 -- xen/drivers/passthrough/vtd/iommu.c | 104 ++++++++++-------------------------- xen/include/xen/iommu.h | 1 3 files changed, 30 insertions(+), 81 deletions(-) diff -r 4c75850a0caa -r 542897539045 xen/arch/x86/mm/hap/p2m-ept.c --- a/xen/arch/x86/mm/hap/p2m-ept.c Wed May 28 10:02:00 2008 +0100 +++ b/xen/arch/x86/mm/hap/p2m-ept.c Wed May 28 10:05:57 2008 +0100 @@ -266,12 +266,6 @@ out: iommu_unmap_page(d, gfn); } } - -#ifdef P2M_SHARE_WITH_VTD_PAGE_TABLE - /* If p2m table is shared with vtd page-table. */ - if ( iommu_enabled && is_hvm_domain(d) && (p2mt == p2m_mmio_direct) ) - iommu_flush(d, gfn, (u64*)ept_entry); -#endif return rv; } diff -r 4c75850a0caa -r 542897539045 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed May 28 10:02:00 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed May 28 10:05:57 2008 +0100 @@ -485,9 +485,12 @@ static int flush_iotlb_reg(void *_iommu, /* check IOTLB invalidation granularity */ if ( DMA_TLB_IAIG(val) == 0 ) printk(KERN_ERR VTDPREFIX "IOMMU: flush IOTLB failed\n"); + +#ifdef VTD_DEBUG if ( DMA_TLB_IAIG(val) != DMA_TLB_IIRG(type) ) printk(KERN_ERR VTDPREFIX "IOMMU: tlb flush request %x, actual %x\n", (u32)DMA_TLB_IIRG(type), (u32)DMA_TLB_IAIG(val)); +#endif /* flush context entry will implictly flush write buffer */ return 0; } @@ -581,30 +584,29 @@ static void dma_pte_clear_one(struct dom drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); /* get last level pte */ - pg_maddr = dma_addr_level_page_maddr(domain, addr, 1); + pg_maddr = dma_addr_level_page_maddr(domain, addr, 2); if ( pg_maddr == 0 ) return; page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); pte = page + address_level_offset(addr, 1); - if ( pte ) - { - dma_clear_pte(*pte); - iommu_flush_cache_entry(drhd->iommu, pte); - - for_each_drhd_unit ( drhd ) - { - iommu = drhd->iommu; - - if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) - continue; - - if ( cap_caching_mode(iommu->cap) ) - iommu_flush_iotlb_psi(iommu, domain_iommu_domid(domain), - addr, 1, 0); - else if (cap_rwbf(iommu->cap)) - iommu_flush_write_buffer(iommu); - } - } + + if ( !dma_pte_present(*pte) ) + { + unmap_vtd_domain_page(page); + return; + } + + dma_clear_pte(*pte); + iommu_flush_cache_entry(drhd->iommu, pte); + + for_each_drhd_unit ( drhd ) + { + iommu = drhd->iommu; + + if ( test_bit(iommu->index, &hd->iommu_bitmap) ) + iommu_flush_iotlb_psi(iommu, domain_iommu_domid(domain), addr, 1, 0); + } + unmap_vtd_domain_page(page); } @@ -1191,12 +1193,13 @@ static int domain_context_mapping_one( unmap_vtd_domain_page(context_entries); + /* it's a non-present to present mapping */ if ( iommu_flush_context_device(iommu, domain_iommu_domid(domain), (((u16)bus) << 8) | devfn, DMA_CCMD_MASK_NOBIT, 1) ) iommu_flush_write_buffer(iommu); else - iommu_flush_iotlb_dsi(iommu, domain_iommu_domid(domain), 0); + iommu_flush_iotlb_dsi(iommu, 0, 0); set_bit(iommu->index, &hd->iommu_bitmap); spin_unlock_irqrestore(&iommu->lock, flags); @@ -1555,10 +1558,11 @@ int intel_iommu_map_page( if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) continue; - if ( pte_present || cap_caching_mode(iommu->cap) ) + if ( pte_present ) iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0); - else if ( cap_rwbf(iommu->cap) ) + else if ( iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), + (paddr_t)gfn << PAGE_SHIFT_4K, 1, 1) ) iommu_flush_write_buffer(iommu); } @@ -1567,11 +1571,8 @@ int intel_iommu_map_page( int intel_iommu_unmap_page(struct domain *d, unsigned long gfn) { - struct hvm_iommu *hd = domain_hvm_iommu(d); struct acpi_drhd_unit *drhd; struct iommu *iommu; - struct dma_pte *page = NULL, *pte = NULL; - u64 pg_maddr; drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); iommu = drhd->iommu; @@ -1582,26 +1583,7 @@ int intel_iommu_unmap_page(struct domain return 0; #endif - pg_maddr = addr_to_dma_page_maddr(d, (paddr_t)gfn << PAGE_SHIFT_4K); - if ( pg_maddr == 0 ) - return -ENOMEM; - page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); - pte = page + (gfn & LEVEL_MASK); - dma_clear_pte(*pte); - iommu_flush_cache_entry(drhd->iommu, pte); - unmap_vtd_domain_page(page); - - for_each_drhd_unit ( drhd ) - { - iommu = drhd->iommu; - - if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) - continue; - - if ( iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), - (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0) ) - iommu_flush_write_buffer(iommu); - } + dma_pte_clear_one(d, (paddr_t)gfn << PAGE_SHIFT_4K); return 0; } @@ -1647,10 +1629,8 @@ int iommu_page_mapping(struct domain *do if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) continue; - if ( cap_caching_mode(iommu->cap) ) - iommu_flush_iotlb_psi(iommu, domain_iommu_domid(domain), - iova, index, 0); - else if ( cap_rwbf(iommu->cap) ) + if ( iommu_flush_iotlb_psi(iommu, domain_iommu_domid(domain), + iova, index, 1) ) iommu_flush_write_buffer(iommu); } @@ -1662,30 +1642,6 @@ int iommu_page_unmapping(struct domain * dma_pte_clear_range(domain, addr, addr + size); return 0; -} - -void iommu_flush(struct domain *d, unsigned long gfn, u64 *p2m_entry) -{ - struct hvm_iommu *hd = domain_hvm_iommu(d); - struct acpi_drhd_unit *drhd; - struct iommu *iommu = NULL; - struct dma_pte *pte = (struct dma_pte *) p2m_entry; - - for_each_drhd_unit ( drhd ) - { - iommu = drhd->iommu; - - if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) - continue; - - if ( cap_caching_mode(iommu->cap) ) - iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), - (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0); - else if ( cap_rwbf(iommu->cap) ) - iommu_flush_write_buffer(iommu); - } - - iommu_flush_cache_entry(iommu, pte); } static int iommu_prepare_rmrr_dev( diff -r 4c75850a0caa -r 542897539045 xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Wed May 28 10:02:00 2008 +0100 +++ b/xen/include/xen/iommu.h Wed May 28 10:05:57 2008 +0100 @@ -66,7 +66,6 @@ void reassign_device_ownership(struct do u8 bus, u8 devfn); int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn); int iommu_unmap_page(struct domain *d, unsigned long gfn); -void iommu_flush(struct domain *d, unsigned long gfn, u64 *p2m_entry); void iommu_set_pgd(struct domain *d); void iommu_free_pgd(struct domain *d); void iommu_domain_teardown(struct domain *d); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:34 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:34 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NS5-0003RF-LJ for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:33 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSn-0006I2-0D; Wed, 28 May 2008 15:21:17 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSX-00061y-DV for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:21:01 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSR-0004yw-MX for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:20:59 +0000 X-SBRS: 3.6 X-MesageID: 338434 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338434" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:58 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJvWS023003 for ; Wed, 28 May 2008 08:19:57 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKGrl010923 for ; Wed, 28 May 2008 08:20:16 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKGAB010922 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:16 -0700 Message-Id: <200805281520.m4SFKGAB010922@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:15 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ioemu: set up all xenstore watches even if there are no VBDs. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211973756 -3600 # Node ID c2fab221b3ece1ecfc0cb2777655e181925fe340 # Parent 132243507b49ab772c34ad986628627998f4f9d1 ioemu: set up all xenstore watches even if there are no VBDs. Signed-off-by: Tim Deegan --- tools/ioemu/xenstore.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 132243507b49 -r c2fab221b3ec tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Wed May 28 11:43:37 2008 +0100 +++ b/tools/ioemu/xenstore.c Wed May 28 12:22:36 2008 +0100 @@ -112,7 +112,7 @@ void xenstore_parse_domain_config(int hv e = xs_directory(xsh, XBT_NULL, buf, &num); if (e == NULL) - goto out; + num = 0; for (i = 0; i < num; i++) { /* read the backend path */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:38 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:38 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NS9-0003RI-Mt for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:38 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSr-0006Li-2r; Wed, 28 May 2008 15:21:21 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSZ-00063d-6x for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:21:03 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSQ-0004yv-EG for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:21:00 +0000 X-SBRS: 3.6 X-MesageID: 338433 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338433" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:57 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJuJl023000 for ; Wed, 28 May 2008 08:19:56 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKF6N010906 for ; Wed, 28 May 2008 08:20:15 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKFhq010905 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:15 -0700 Message-Id: <200805281520.m4SFKFhq010905@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:14 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] grant_table: Flush host CPU TLBs during grant transfer. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211971417 -3600 # Node ID 132243507b49ab772c34ad986628627998f4f9d1 # Parent 54289753904549c5fe1a97e50c5b87af6c795179 grant_table: Flush host CPU TLBs during grant transfer. Signed-off-by: Keir Fraser --- xen/common/grant_table.c | 1 + 1 files changed, 1 insertion(+) diff -r 542897539045 -r 132243507b49 xen/common/grant_table.c --- a/xen/common/grant_table.c Wed May 28 10:05:57 2008 +0100 +++ b/xen/common/grant_table.c Wed May 28 11:43:37 2008 +0100 @@ -1113,6 +1113,7 @@ gnttab_transfer( } guest_physmap_remove_page(d, gop.mfn, mfn, 0); + flush_tlb_mask(d->domain_dirty_cpumask); /* Find the target domain. */ if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL) ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:42 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:42 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NSE-0003RO-CF for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:42 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSv-0006Pd-KI; Wed, 28 May 2008 15:21:25 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSc-00066W-MT for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:21:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSV-0004yw-S1 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:21:04 +0000 X-SBRS: 3.6 X-MesageID: 338436 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338436" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:20:00 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJxX0023009 for ; Wed, 28 May 2008 08:19:59 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKIvh010957 for ; Wed, 28 May 2008 08:20:18 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKIkA010956 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:18 -0700 Message-Id: <200805281520.m4SFKIkA010956@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:17 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vtd: More TLB flush fixes. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211987650 -3600 # Node ID f681c4de91fcfa90de2dbdc187eebd95d7927ee9 # Parent b60cf40fae135a38688892efee522d470abdf95b vtd: More TLB flush fixes. - Made the non-present flush testing a bit simpler. - Removed dma_addr_level_page_maddr(). Use a modified addr_to_dma_page_maddr() instead. - Upon mapping new context entry: flush old entry using domid 0 and always flush iotlb. Signed-off-by: Espen Skoglund --- xen/drivers/passthrough/vtd/iommu.c | 69 ++++++++---------------------------- 1 files changed, 17 insertions(+), 52 deletions(-) diff -r b60cf40fae13 -r f681c4de91fc xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed May 28 14:41:23 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed May 28 16:14:10 2008 +0100 @@ -191,7 +191,7 @@ static int device_context_mapped(struct return ret; } -static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr) +static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc) { struct hvm_iommu *hd = domain_hvm_iommu(domain); struct acpi_drhd_unit *drhd; @@ -201,7 +201,7 @@ static u64 addr_to_dma_page_maddr(struct int level = agaw_to_level(hd->agaw); int offset; unsigned long flags; - u64 pte_maddr = 0; + u64 pte_maddr = 0, maddr; u64 *vaddr = NULL; drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); @@ -211,6 +211,8 @@ static u64 addr_to_dma_page_maddr(struct spin_lock_irqsave(&hd->mapping_lock, flags); if ( hd->pgd_maddr == 0 ) { + if ( !alloc ) + return 0; hd->pgd_maddr = alloc_pgtable_maddr(); if ( hd->pgd_maddr == 0 ) return 0; @@ -224,7 +226,9 @@ static u64 addr_to_dma_page_maddr(struct if ( dma_pte_addr(*pte) == 0 ) { - u64 maddr = alloc_pgtable_maddr(); + if ( !alloc ) + break; + maddr = alloc_pgtable_maddr(); dma_set_pte_addr(*pte, maddr); vaddr = map_vtd_domain_page(maddr); if ( !vaddr ) @@ -263,41 +267,6 @@ static u64 addr_to_dma_page_maddr(struct return pte_maddr; } -/* return address's page at specific level */ -static u64 dma_addr_level_page_maddr( - struct domain *domain, u64 addr, int level) -{ - struct hvm_iommu *hd = domain_hvm_iommu(domain); - struct dma_pte *parent, *pte = NULL; - int total = agaw_to_level(hd->agaw); - int offset; - u64 pg_maddr = hd->pgd_maddr; - - if ( pg_maddr == 0 ) - return 0; - - parent = (struct dma_pte *)map_vtd_domain_page(pg_maddr); - while ( level <= total ) - { - offset = address_level_offset(addr, total); - pte = &parent[offset]; - if ( dma_pte_addr(*pte) == 0 ) - break; - - pg_maddr = pte->val & PAGE_MASK_4K; - unmap_vtd_domain_page(parent); - - if ( level == total ) - return pg_maddr; - - parent = map_vtd_domain_page(pte->val); - total--; - } - - unmap_vtd_domain_page(parent); - return 0; -} - static void iommu_flush_write_buffer(struct iommu *iommu) { u32 val; @@ -584,7 +553,7 @@ static void dma_pte_clear_one(struct dom drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); /* get last level pte */ - pg_maddr = dma_addr_level_page_maddr(domain, addr, 2); + pg_maddr = addr_to_dma_page_maddr(domain, addr, 0); if ( pg_maddr == 0 ) return; page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); @@ -1193,13 +1162,11 @@ static int domain_context_mapping_one( unmap_vtd_domain_page(context_entries); - /* it's a non-present to present mapping */ - if ( iommu_flush_context_device(iommu, domain_iommu_domid(domain), - (((u16)bus) << 8) | devfn, - DMA_CCMD_MASK_NOBIT, 1) ) + /* Context entry was previously non-present (with domid 0). */ + iommu_flush_context_device(iommu, 0, (((u16)bus) << 8) | devfn, + DMA_CCMD_MASK_NOBIT, 1); + if ( iommu_flush_iotlb_dsi(iommu, 0, 1) ) iommu_flush_write_buffer(iommu); - else - iommu_flush_iotlb_dsi(iommu, 0, 0); set_bit(iommu->index, &hd->iommu_bitmap); spin_unlock_irqrestore(&iommu->lock, flags); @@ -1540,7 +1507,7 @@ int intel_iommu_map_page( return 0; #endif - pg_maddr = addr_to_dma_page_maddr(d, (paddr_t)gfn << PAGE_SHIFT_4K); + pg_maddr = addr_to_dma_page_maddr(d, (paddr_t)gfn << PAGE_SHIFT_4K, 1); if ( pg_maddr == 0 ) return -ENOMEM; page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); @@ -1558,11 +1525,9 @@ int intel_iommu_map_page( if ( !test_bit(iommu->index, &hd->iommu_bitmap) ) continue; - if ( pte_present ) - iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), - (paddr_t)gfn << PAGE_SHIFT_4K, 1, 0); - else if ( iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), - (paddr_t)gfn << PAGE_SHIFT_4K, 1, 1) ) + if ( iommu_flush_iotlb_psi(iommu, domain_iommu_domid(d), + (paddr_t)gfn << PAGE_SHIFT_4K, 1, + !pte_present) ) iommu_flush_write_buffer(iommu); } @@ -1609,7 +1574,7 @@ int iommu_page_mapping(struct domain *do index = 0; while ( start_pfn < end_pfn ) { - pg_maddr = addr_to_dma_page_maddr(domain, iova + PAGE_SIZE_4K * index); + pg_maddr = addr_to_dma_page_maddr(domain, iova + PAGE_SIZE_4K*index, 1); if ( pg_maddr == 0 ) return -ENOMEM; page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 08:20:47 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 08:20:47 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1NSI-0003RR-LM for www-data@colo.xensource.com; Wed, 28 May 2008 08:20:47 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NT0-0006TJ-33; Wed, 28 May 2008 15:21:30 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1NSe-00068E-F7 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:21:08 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1NSV-0004yr-Ft for xen-changelog@lists.xensource.com; Wed, 28 May 2008 15:21:06 +0000 X-SBRS: 3.6 X-MesageID: 338435 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="338435" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 11:19:59 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFJwYQ023006 for ; Wed, 28 May 2008 08:19:58 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SFKHMA010940 for ; Wed, 28 May 2008 08:20:17 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SFKHH9010939 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 08:20:17 -0700 Message-Id: <200805281520.m4SFKHH9010939@xenbits.xensource.com> Date: Wed, 28 May 2008 08:20:16 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] iommu: Handle sibling device assignment correctly X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211982083 -3600 # Node ID b60cf40fae135a38688892efee522d470abdf95b # Parent c2fab221b3ece1ecfc0cb2777655e181925fe340 iommu: Handle sibling device assignment correctly Domctl interface is extended to allow libxc retrieve device group information from hypervisor. Vendor-specific iommu_ops is also extended by adding a new operation "get_device_group_id()", which is currently a null pointer but could be implemented later for vt-d. Error will be raised from tools side when user trying to assign PCI device with a sibling device being driven by dom0. User will keep being prompted until he has hidden the entire device group (at least, the sibling devices driven by dom0) in dom0 kernel parameter. Hopefully this framework could be flexible enough to support both amd iommu and vt-d. The following 2 cases are not covered by this patch, but should be easy to handle. * Checking for hot-plug devices (maybe we can delay calling ImageHandler.signalDeviceModel() until all checks are done?) * Checking for splitted device group between different passthru domains Signed-off-by: Wei Wang --- tools/libxc/xc_domain.c | 31 +++++++++++ tools/libxc/xenctrl.h | 7 ++ tools/python/xen/lowlevel/xc/xc.c | 73 ++++++++++++++++++++++++++++ tools/python/xen/xend/server/pciif.py | 35 +++++++++++++ xen/arch/x86/domctl.c | 39 ++++++++++++++ xen/drivers/passthrough/amd/pci_amd_iommu.c | 11 ++++ xen/drivers/passthrough/iommu.c | 37 +++++++++++++- xen/drivers/passthrough/vtd/iommu.c | 1 xen/include/public/domctl.h | 11 ++++ xen/include/xen/iommu.h | 3 + 10 files changed, 247 insertions(+), 1 deletion(-) diff -r c2fab221b3ec -r b60cf40fae13 tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Wed May 28 12:22:36 2008 +0100 +++ b/tools/libxc/xc_domain.c Wed May 28 14:41:23 2008 +0100 @@ -767,6 +767,37 @@ int xc_assign_device( return do_domctl(xc_handle, &domctl); } +int xc_get_device_group( + int xc_handle, + uint32_t domid, + uint32_t machine_bdf, + uint32_t max_sdevs, + uint32_t *num_sdevs, + uint32_t *sdev_array) +{ + int rc; + DECLARE_DOMCTL; + + domctl.cmd = XEN_DOMCTL_get_device_group; + domctl.domain = (domid_t)domid; + + domctl.u.get_device_group.machine_bdf = machine_bdf; + domctl.u.get_device_group.max_sdevs = max_sdevs; + + set_xen_guest_handle(domctl.u.get_device_group.sdev_array, sdev_array); + + if ( lock_pages(sdev_array, max_sdevs * sizeof(*sdev_array)) != 0 ) + { + PERROR("Could not lock memory for xc_get_device_group\n"); + return -ENOMEM; + } + rc = do_domctl(xc_handle, &domctl); + unlock_pages(sdev_array, max_sdevs * sizeof(*sdev_array)); + + *num_sdevs = domctl.u.get_device_group.num_sdevs; + return rc; +} + int xc_test_assign_device( int xc_handle, uint32_t domid, diff -r c2fab221b3ec -r b60cf40fae13 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Wed May 28 12:22:36 2008 +0100 +++ b/tools/libxc/xenctrl.h Wed May 28 14:41:23 2008 +0100 @@ -955,6 +955,13 @@ int xc_assign_device(int xc_handle, uint32_t domid, uint32_t machine_bdf); +int xc_get_device_group(int xc_handle, + uint32_t domid, + uint32_t machine_bdf, + uint32_t max_sdevs, + uint32_t *num_sdevs, + uint32_t *sdev_array); + int xc_test_assign_device(int xc_handle, uint32_t domid, uint32_t machine_bdf); diff -r c2fab221b3ec -r b60cf40fae13 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Wed May 28 12:22:36 2008 +0100 +++ b/tools/python/xen/lowlevel/xc/xc.c Wed May 28 14:41:23 2008 +0100 @@ -646,6 +646,68 @@ static PyObject *pyxc_deassign_device(Xc return Py_BuildValue("i", bdf); } +static PyObject *pyxc_get_device_group(XcObject *self, + PyObject *args) +{ + domid_t domid; + uint32_t bdf = 0; + uint32_t max_sdevs, num_sdevs; + int seg, bus, dev, func, rc, i; + PyObject *Pystr; + char *group_str; + char dev_str[9]; + uint32_t *sdev_array; + + if ( !PyArg_ParseTuple(args, "iiiii", &domid, &seg, &bus, &dev, &func) ) + return NULL; + + /* Maximum allowed siblings device number per group */ + max_sdevs = 1024; + + if ( (sdev_array = malloc(max_sdevs * sizeof(*sdev_array))) == NULL ) + return PyErr_NoMemory(); + memset(sdev_array, 0, max_sdevs * sizeof(*sdev_array)); + + bdf |= (bus & 0xff) << 16; + bdf |= (dev & 0x1f) << 11; + bdf |= (func & 0x7) << 8; + + rc = xc_get_device_group(self->xc_handle, + domid, bdf, max_sdevs, &num_sdevs, sdev_array); + + if ( rc < 0 ) + { + free(sdev_array); + return pyxc_error_to_exception(); + } + + if ( !num_sdevs ) + { + free(sdev_array); + return Py_BuildValue("s", ""); + } + + if ( (group_str = malloc(num_sdevs * sizeof(dev_str))) == NULL ) + return PyErr_NoMemory(); + memset(group_str, '\0', num_sdevs * sizeof(dev_str)); + + for ( i = 0; i < num_sdevs; i++ ) + { + bus = (sdev_array[i] >> 16) & 0xff; + dev = (sdev_array[i] >> 11) & 0x1f; + func = (sdev_array[i] >> 8) & 0x7; + sprintf(dev_str, "%02x:%02x.%x,", bus, dev, func); + strcat(group_str, dev_str); + } + + Pystr = Py_BuildValue("s", group_str); + + free(sdev_array); + free(group_str); + + return Pystr; +} + #ifdef __ia64__ static PyObject *pyxc_nvram_init(XcObject *self, PyObject *args) @@ -1583,6 +1645,17 @@ static PyMethodDef pyxc_methods[] = { " param [int]: No. of HVM param.\n" " value [long]: Value of param.\n" "Returns: [int] 0 on success.\n" }, + + { "get_device_group", + (PyCFunction)pyxc_get_device_group, + METH_VARARGS, "\n" + "get sibling devices infomation.\n" + " dom [int]: Domain to assign device to.\n" + " seg [int]: PCI segment.\n" + " bus [int]: PCI bus.\n" + " dev [int]: PCI dev.\n" + " func [int]: PCI func.\n" + "Returns: [string]: Sibling devices \n" }, { "test_assign_device", (PyCFunction)pyxc_test_assign_device, diff -r c2fab221b3ec -r b60cf40fae13 tools/python/xen/xend/server/pciif.py --- a/tools/python/xen/xend/server/pciif.py Wed May 28 12:22:36 2008 +0100 +++ b/tools/python/xen/xend/server/pciif.py Wed May 28 14:41:23 2008 +0100 @@ -226,6 +226,39 @@ class PciController(DevController): return sxpr + def CheckSiblingDevices(self, domid, dev): + """ Check if all sibling devices of dev are owned by pciback + """ + if not self.vm.info.is_hvm(): + return + + group_str = xc.get_device_group(domid, dev.domain, dev.bus, dev.slot, dev.func) + if group_str == "": + return + + #group string format xx:xx.x,xx:xx.x, + devstr_len = group_str.find(',') + for i in range(0, len(group_str), devstr_len + 1): + (bus, slotfunc) = group_str[i:i + devstr_len].split(':') + (slot, func) = slotfunc.split('.') + b = parse_hex(bus) + d = parse_hex(slot) + f = parse_hex(func) + try: + sdev = PciDevice(dev.domain, b, d, f) + except Exception, e: + #no dom0 drivers bound to sdev + continue + + if sdev.driver!='pciback': + raise VmError(("pci: PCI Backend does not own\n "+ \ + "sibling device %s of device %s\n"+ \ + "See the pciback.hide kernel "+ \ + "command-line parameter or\n"+ \ + "bind your slot/device to the PCI backend using sysfs" \ + )%(sdev.name, dev.name)) + return + def setupOneDevice(self, domain, bus, slot, func): """ Attach I/O resources for device to frontend domain """ @@ -244,6 +277,8 @@ class PciController(DevController): "command-line parameter or\n"+ \ "bind your slot/device to the PCI backend using sysfs" \ )%(dev.name)) + + self.CheckSiblingDevices(fe_domid, dev) PCIQuirk(dev.vendor, dev.device, dev.subvendor, dev.subdevice, domain, bus, slot, func) diff -r c2fab221b3ec -r b60cf40fae13 xen/arch/x86/domctl.c --- a/xen/arch/x86/domctl.c Wed May 28 12:22:36 2008 +0100 +++ b/xen/arch/x86/domctl.c Wed May 28 14:41:23 2008 +0100 @@ -526,6 +526,45 @@ long arch_do_domctl( } break; + case XEN_DOMCTL_get_device_group: + { + struct domain *d; + u32 max_sdevs; + u8 bus, devfn; + XEN_GUEST_HANDLE_64(uint32) sdevs; + int num_sdevs; + + ret = -ENOSYS; + if ( !iommu_enabled ) + break; + + ret = -EINVAL; + if ( (d = rcu_lock_domain_by_id(domctl->domain)) == NULL ) + break; + + bus = (domctl->u.get_device_group.machine_bdf >> 16) & 0xff; + devfn = (domctl->u.get_device_group.machine_bdf >> 8) & 0xff; + max_sdevs = domctl->u.get_device_group.max_sdevs; + sdevs = domctl->u.get_device_group.sdev_array; + + num_sdevs = iommu_get_device_group(d, bus, devfn, sdevs, max_sdevs); + if ( num_sdevs < 0 ) + { + dprintk(XENLOG_ERR, "iommu_get_device_group() failed!\n"); + ret = -EFAULT; + domctl->u.get_device_group.num_sdevs = 0; + } + else + { + ret = 0; + domctl->u.get_device_group.num_sdevs = num_sdevs; + } + if ( copy_to_guest(u_domctl, domctl, 1) ) + ret = -EFAULT; + rcu_unlock_domain(d); + } + break; + case XEN_DOMCTL_test_assign_device: { u8 bus, devfn; diff -r c2fab221b3ec -r b60cf40fae13 xen/drivers/passthrough/amd/pci_amd_iommu.c --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c Wed May 28 12:22:36 2008 +0100 +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c Wed May 28 14:41:23 2008 +0100 @@ -635,6 +635,16 @@ static void amd_iommu_return_device( reassign_device(s, t, bus, devfn); } +static int amd_iommu_group_id(u8 bus, u8 devfn) +{ + int rt; + int bdf = (bus << 8) | devfn; + rt = ( bdf < ivrs_bdf_entries ) ? + ivrs_mappings[bdf].dte_requestor_id : + bdf; + return rt; +} + struct iommu_ops amd_iommu_ops = { .init = amd_iommu_domain_init, .assign_device = amd_iommu_assign_device, @@ -642,4 +652,5 @@ struct iommu_ops amd_iommu_ops = { .map_page = amd_iommu_map_page, .unmap_page = amd_iommu_unmap_page, .reassign_device = amd_iommu_return_device, + .get_device_group_id = amd_iommu_group_id, }; diff -r c2fab221b3ec -r b60cf40fae13 xen/drivers/passthrough/iommu.c --- a/xen/drivers/passthrough/iommu.c Wed May 28 12:22:36 2008 +0100 +++ b/xen/drivers/passthrough/iommu.c Wed May 28 14:41:23 2008 +0100 @@ -16,6 +16,7 @@ #include #include #include +#include extern struct iommu_ops intel_iommu_ops; extern struct iommu_ops amd_iommu_ops; @@ -216,7 +217,41 @@ static int iommu_setup(void) } __initcall(iommu_setup); - +int iommu_get_device_group(struct domain *d, u8 bus, u8 devfn, + XEN_GUEST_HANDLE_64(uint32) buf, int max_sdevs) +{ + struct hvm_iommu *hd = domain_hvm_iommu(d); + struct pci_dev *pdev; + int group_id, sdev_id; + u32 bdf; + int i = 0; + struct iommu_ops *ops = hd->platform_ops; + + if ( !iommu_enabled || !ops || !ops->get_device_group_id ) + return 0; + + group_id = ops->get_device_group_id(bus, devfn); + + list_for_each_entry(pdev, + &(dom0->arch.hvm_domain.hvm_iommu.pdev_list), list) + { + if ( (pdev->bus == bus) && (pdev->devfn == devfn) ) + continue; + + sdev_id = ops->get_device_group_id(pdev->bus, pdev->devfn); + if ( (sdev_id == group_id) && (i < max_sdevs) ) + { + bdf = 0; + bdf |= (pdev->bus & 0xff) << 16; + bdf |= (pdev->devfn & 0xff) << 8; + if ( unlikely(copy_to_guest_offset(buf, i, &bdf, 1)) ) + return -1; + i++; + } + } + + return i; +} /* * Local variables: * mode: C diff -r c2fab221b3ec -r b60cf40fae13 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed May 28 12:22:36 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Wed May 28 14:41:23 2008 +0100 @@ -1955,6 +1955,7 @@ struct iommu_ops intel_iommu_ops = { .map_page = intel_iommu_map_page, .unmap_page = intel_iommu_unmap_page, .reassign_device = reassign_device_ownership, + .get_device_group_id = NULL, }; /* diff -r c2fab221b3ec -r b60cf40fae13 xen/include/public/domctl.h --- a/xen/include/public/domctl.h Wed May 28 12:22:36 2008 +0100 +++ b/xen/include/public/domctl.h Wed May 28 14:41:23 2008 +0100 @@ -448,6 +448,16 @@ typedef struct xen_domctl_assign_device typedef struct xen_domctl_assign_device xen_domctl_assign_device_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_assign_device_t); +/* Retrieve sibling devices infomation of machine_bdf */ +#define XEN_DOMCTL_get_device_group 50 +struct xen_domctl_get_device_group { + uint32_t machine_bdf; /* IN */ + uint32_t max_sdevs; /* IN */ + uint32_t num_sdevs; /* OUT */ + XEN_GUEST_HANDLE_64(uint32) sdev_array; /* OUT */ +}; +typedef struct xen_domctl_get_device_group xen_domctl_get_device_group_t; +DEFINE_XEN_GUEST_HANDLE(xen_domctl_get_device_group_t); /* Pass-through interrupts: bind real irq -> hvm devfn. */ #define XEN_DOMCTL_bind_pt_irq 38 @@ -619,6 +629,7 @@ struct xen_domctl { struct xen_domctl_hvmcontext hvmcontext; struct xen_domctl_address_size address_size; struct xen_domctl_sendtrigger sendtrigger; + struct xen_domctl_get_device_group get_device_group; struct xen_domctl_assign_device assign_device; struct xen_domctl_bind_pt_irq bind_pt_irq; struct xen_domctl_memory_mapping memory_mapping; diff -r c2fab221b3ec -r b60cf40fae13 xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Wed May 28 12:22:36 2008 +0100 +++ b/xen/include/xen/iommu.h Wed May 28 14:41:23 2008 +0100 @@ -61,6 +61,8 @@ int device_assigned(u8 bus, u8 devfn); int device_assigned(u8 bus, u8 devfn); int assign_device(struct domain *d, u8 bus, u8 devfn); void deassign_device(struct domain *d, u8 bus, u8 devfn); +int iommu_get_device_group(struct domain *d, u8 bus, u8 devfn, + XEN_GUEST_HANDLE_64(uint32) buf, int max_sdevs); void reassign_device_ownership(struct domain *source, struct domain *target, u8 bus, u8 devfn); @@ -98,6 +100,7 @@ struct iommu_ops { int (*unmap_page)(struct domain *d, unsigned long gfn); void (*reassign_device)(struct domain *s, struct domain *t, u8 bus, u8 devfn); + int (*get_device_group_id)(u8 bus, u8 devfn); }; #endif /* _IOMMU_H_ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 13:20:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 13:20:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1S8F-0007dV-6R for www-data@colo.xensource.com; Wed, 28 May 2008 13:20:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1S8w-0001NL-EQ; Wed, 28 May 2008 20:21:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1S8u-0001Mn-Fl for xen-changelog@lists.xensource.com; Wed, 28 May 2008 20:21:04 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1S8n-00015d-TJ for xen-changelog@lists.xensource.com; Wed, 28 May 2008 20:21:02 +0000 X-SBRS: 3.6 X-MesageID: 340848 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="340848" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 16:20:07 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SKK6Tv023965 for ; Wed, 28 May 2008 13:20:06 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SKKOD5027248 for ; Wed, 28 May 2008 13:20:24 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SKKO5K027247 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 13:20:24 -0700 Message-Id: <200805282020.m4SKKO5K027247@xenbits.xensource.com> Date: Wed, 28 May 2008 13:20:23 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86_emulate: Check single-step status at instruction start rather than end. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211988645 -3600 # Node ID 6d81a6f6cb2107cc8a3d0cf834ced28a5052619d # Parent 2ec56b04abf48d091310e6f778297d82f328eefe x86_emulate: Check single-step status at instruction start rather than end. This fixes booting of FreeDOS with HIMEM.SYS enabled. Signed-off-by: Trolle Selander Signed-off-by: Keir Fraser xen-unstable changeset: 17715:30bf34f5a414d5400028ec094688be696234fcdf xen-unstable date: Sat May 24 08:54:59 2008 +0100 --- xen/arch/x86/x86_emulate.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff -r 2ec56b04abf4 -r 6d81a6f6cb21 xen/arch/x86/x86_emulate.c --- a/xen/arch/x86/x86_emulate.c Tue May 27 10:37:59 2008 +0100 +++ b/xen/arch/x86/x86_emulate.c Wed May 28 16:30:45 2008 +0100 @@ -2036,14 +2036,14 @@ x86_emulate( break; } + /* Inject #DB if single-step tracing was enabled at instruction start. */ + if ( (ctxt->regs->eflags & EFLG_TF) && (rc == X86EMUL_OKAY) && + (ops->inject_hw_exception != NULL) ) + rc = ops->inject_hw_exception(EXC_DB, 0, ctxt) ? : X86EMUL_EXCEPTION; + /* Commit shadow register state. */ _regs.eflags &= ~EFLG_RF; *ctxt->regs = _regs; - - if ( (_regs.eflags & EFLG_TF) && - (rc == X86EMUL_OKAY) && - (ops->inject_hw_exception != NULL) ) - rc = ops->inject_hw_exception(EXC_DB, 0, ctxt) ? : X86EMUL_EXCEPTION; done: return rc; _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 13:20:28 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 13:20:28 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1S8J-0007dY-M8 for www-data@colo.xensource.com; Wed, 28 May 2008 13:20:28 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1S91-0001RL-43; Wed, 28 May 2008 20:21:11 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1S8y-0001ND-63 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 20:21:08 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1S8r-00015f-EK for xen-changelog@lists.xensource.com; Wed, 28 May 2008 20:21:06 +0000 X-SBRS: 3.6 X-MesageID: 340849 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="340849" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 16:20:07 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SKK7Di023968 for ; Wed, 28 May 2008 13:20:07 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SKKPff027265 for ; Wed, 28 May 2008 13:20:25 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SKKP06027264 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 13:20:25 -0700 Message-Id: <200805282020.m4SKKP06027264@xenbits.xensource.com> Date: Wed, 28 May 2008 13:20:24 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] ioemu: Force floppy disk images to be interpreted as raw. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211988705 -3600 # Node ID a38f0a4f501dee3a38a5f8767a64a8fc5865acd4 # Parent 6d81a6f6cb2107cc8a3d0cf834ced28a5052619d ioemu: Force floppy disk images to be interpreted as raw. Fixes specifying fda/fdb image names in domain configs. Signed-off-by: Keir Fraser xen-unstable changeset: 17736:6b28a18a8c2d22993adbf35fa66712661118dede xen-unstable date: Tue May 27 11:51:33 2008 +0100 --- tools/ioemu/vl.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r 6d81a6f6cb21 -r a38f0a4f501d tools/ioemu/vl.c --- a/tools/ioemu/vl.c Wed May 28 16:30:45 2008 +0100 +++ b/tools/ioemu/vl.c Wed May 28 16:31:45 2008 +0100 @@ -7754,8 +7754,9 @@ int main(int argc, char **argv) bdrv_set_type_hint(fd_table[i], BDRV_TYPE_FLOPPY); } if (fd_filename[i] != '\0') { - if (bdrv_open(fd_table[i], fd_filename[i], - snapshot ? BDRV_O_SNAPSHOT : 0) < 0) { + if (bdrv_open2(fd_table[i], fd_filename[i], + snapshot ? BDRV_O_SNAPSHOT : 0, + &bdrv_raw) < 0) { fprintf(stderr, "qemu: could not open floppy disk image '%s'\n", fd_filename[i]); exit(1); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 13:20:31 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 13:20:31 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1S8M-0007db-U0 for www-data@colo.xensource.com; Wed, 28 May 2008 13:20:31 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1S94-0001Uu-EP; Wed, 28 May 2008 20:21:14 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1S8z-0001P9-Hm for xen-changelog@lists.xensource.com; Wed, 28 May 2008 20:21:09 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1S8s-00015d-Uc for xen-changelog@lists.xensource.com; Wed, 28 May 2008 20:21:07 +0000 X-SBRS: 3.6 X-MesageID: 340851 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="340851" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 16:20:09 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SKK8Km023974 for ; Wed, 28 May 2008 13:20:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SKKRPT027299 for ; Wed, 28 May 2008 13:20:27 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SKKRqZ027298 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 13:20:27 -0700 Message-Id: <200805282020.m4SKKRqZ027298@xenbits.xensource.com> Date: Wed, 28 May 2008 13:20:26 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] ioemu: set up all xenstore watches even if there are no VBDs. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211988973 -3600 # Node ID 84196133c9e5a1e4ac84a04cb3c48737159d1878 # Parent 3708459fd101ec6fe24bb19b8581a80800c1b58f ioemu: set up all xenstore watches even if there are no VBDs. Signed-off-by: Tim Deegan xen-unstable changeset: 17746:c2fab221b3ece1ecfc0cb2777655e181925fe340 xen-unstable date: Wed May 28 12:22:36 2008 +0100 --- tools/ioemu/xenstore.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 3708459fd101 -r 84196133c9e5 tools/ioemu/xenstore.c --- a/tools/ioemu/xenstore.c Wed May 28 16:35:48 2008 +0100 +++ b/tools/ioemu/xenstore.c Wed May 28 16:36:13 2008 +0100 @@ -108,7 +108,7 @@ void xenstore_parse_domain_config(int do e = xs_directory(xsh, XBT_NULL, buf, &num); if (e == NULL) - goto out; + num = 0; for (i = 0; i < num; i++) { /* read the backend path */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Wed May 28 13:20:33 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Wed, 28 May 2008 13:20:33 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K1S8P-0007de-JG for www-data@colo.xensource.com; Wed, 28 May 2008 13:20:33 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1S97-0001Xt-3D; Wed, 28 May 2008 20:21:17 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K1S92-0001R4-Ja for xen-changelog@lists.xensource.com; Wed, 28 May 2008 20:21:12 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K1S8v-00015j-KV for xen-changelog@lists.xensource.com; Wed, 28 May 2008 20:21:10 +0000 X-SBRS: 3.6 X-MesageID: 340852 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,556,1204520400"; d="scan'208";a="340852" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 28 May 2008 16:20:11 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4SKK7iJ023971 for ; Wed, 28 May 2008 13:20:08 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4SKKQld027282 for ; Wed, 28 May 2008 13:20:26 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4SKKQjt027281 for xen-changelog@lists.xensource.com; Wed, 28 May 2008 13:20:26 -0700 Message-Id: <200805282020.m4SKKQjt027281@xenbits.xensource.com> Date: Wed, 28 May 2008 13:20:25 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] grant_table: Flush host CPU TLBs during grant transfer. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1211988948 -3600 # Node ID 3708459fd101ec6fe24bb19b8581a80800c1b58f # Parent a38f0a4f501dee3a38a5f8767a64a8fc5865acd4 grant_table: Flush host CPU TLBs during grant transfer. Signed-off-by: Keir Fraser xen-unstable changeset: 17745:132243507b49ab772c34ad986628627998f4f9d1 xen-unstable date: Wed May 28 11:43:37 2008 +0100 --- xen/common/grant_table.c | 2 ++ 1 files changed, 2 insertions(+) diff -r a38f0a4f501d -r 3708459fd101 xen/common/grant_table.c --- a/xen/common/grant_table.c Wed May 28 16:31:45 2008 +0100 +++ b/xen/common/grant_table.c Wed May 28 16:35:48 2008 +0100 @@ -1069,6 +1069,8 @@ gnttab_transfer( goto copyback; } + flush_tlb_mask(d->domain_dirty_cpumask); + /* Find the target domain. */ if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL) ) { _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:08 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:08 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2AAx-000480-UC for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:08 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABg-0002Yo-4K; Fri, 30 May 2008 19:22:52 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABe-0002Xx-CD for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:22:50 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABX-0004zn-PN for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:22:48 +0000 X-SBRS: 3.6 X-MesageID: 359415 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359415" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:14 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0ESp030248 for ; Fri, 30 May 2008 11:00:14 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0W30020165 for ; Fri, 30 May 2008 11:00:32 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI0W95020163 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:00:32 -0700 Message-Id: <200805301800.m4UI0W95020163@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:29 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vtd: addr_to_dma_page_maddr() must release its lock. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212050363 -3600 # Node ID 4505418b63933e4887c808e376985c2421d035e3 # Parent f681c4de91fcfa90de2dbdc187eebd95d7927ee9 vtd: addr_to_dma_page_maddr() must release its lock. Signed-off-by: Xiaowei Yang --- xen/drivers/passthrough/vtd/iommu.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff -r f681c4de91fc -r 4505418b6393 xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Wed May 28 16:14:10 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Thu May 29 09:39:23 2008 +0100 @@ -212,10 +212,10 @@ static u64 addr_to_dma_page_maddr(struct if ( hd->pgd_maddr == 0 ) { if ( !alloc ) - return 0; + goto out; hd->pgd_maddr = alloc_pgtable_maddr(); if ( hd->pgd_maddr == 0 ) - return 0; + goto out; } parent = (struct dma_pte *)map_vtd_domain_page(hd->pgd_maddr); @@ -263,6 +263,7 @@ static u64 addr_to_dma_page_maddr(struct } unmap_vtd_domain_page(parent); + out: spin_unlock_irqrestore(&hd->mapping_lock, flags); return pte_maddr; } _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:13 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:13 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2AB3-000484-8F for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:13 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABl-0002cA-Fn; Fri, 30 May 2008 19:22:57 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABj-0002ae-LS for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:22:55 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABc-0004zn-Ud for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:22:53 +0000 X-SBRS: 3.6 X-MesageID: 359416 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359416" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:17 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0G47030251 for ; Fri, 30 May 2008 11:00:16 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0Z18020199 for ; Fri, 30 May 2008 11:00:35 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI0Zvp020198 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:00:35 -0700 Message-Id: <200805301800.m4UI0Zvp020198@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:33 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] pv-on-hvm: Change barrier from rmb to wmb. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212050407 -3600 # Node ID 098c88335a74f05882e7221045a33da7499240d5 # Parent 4505418b63933e4887c808e376985c2421d035e3 pv-on-hvm: Change barrier from rmb to wmb. Signed-off-by: Kouya Shimura --- unmodified_drivers/linux-2.6/platform-pci/evtchn.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 4505418b6393 -r 098c88335a74 unmodified_drivers/linux-2.6/platform-pci/evtchn.c --- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c Thu May 29 09:39:23 2008 +0100 +++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c Thu May 29 09:40:07 2008 +0100 @@ -284,7 +284,7 @@ static irqreturn_t evtchn_interrupt(int #ifndef CONFIG_X86 /* No need for a barrier -- XCHG is a barrier on x86. */ /* Clear master flag /before/ clearing selector flag. */ - rmb(); + wmb(); #endif l1 = xchg(&v->evtchn_pending_sel, 0); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:18 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:18 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2AB8-000487-BD for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:18 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABq-0002fd-Kf; Fri, 30 May 2008 19:23:02 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABo-0002dj-F7 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:00 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABf-0004zs-Hy for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:22:58 +0000 X-SBRS: 3.6 X-MesageID: 359417 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359417" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:22 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0Mnp030254 for ; Fri, 30 May 2008 11:00:22 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0eqV020240 for ; Fri, 30 May 2008 11:00:40 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI0e0C020239 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:00:40 -0700 Message-Id: <200805301800.m4UI0e0C020239@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:35 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: Fix reboot failure after S3 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212050579 -3600 # Node ID 564c9be76aa496fda12923ffca5c4ca41a6c395f # Parent 098c88335a74f05882e7221045a33da7499240d5 x86: Fix reboot failure after S3 "warm reset vector" is used to start APs. At booting time, it is set by BP, and cleared after all APs have started. When do S3, similar work need to do. However, when enable non-boot CPUs after S3, Xen just sets this vector, but forgets to clear it after APs startup. Signed-off-by: Huacai Chen --- xen/arch/x86/smpboot.c | 5 +++++ 1 files changed, 5 insertions(+) diff -r 098c88335a74 -r 564c9be76aa4 xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Thu May 29 09:40:07 2008 +0100 +++ b/xen/arch/x86/smpboot.c Thu May 29 09:42:59 2008 +0100 @@ -1391,6 +1391,11 @@ void enable_nonboot_cpus(void) panic("Not enough cpus"); } cpus_clear(frozen_cpus); + + /* + * Cleanup possible dangling ends after sleep... + */ + smpboot_restore_warm_reset_vector(); } #else /* ... !CONFIG_HOTPLUG_CPU */ int __cpu_disable(void) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:23 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:23 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABC-00048B-Bf for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:23 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABu-0002jP-Lt; Fri, 30 May 2008 19:23:06 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABo-0002dw-UH for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:00 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABi-0004zn-7T for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:22:58 +0000 X-SBRS: 3.6 X-MesageID: 359418 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359418" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:25 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0PEf030257 for ; Fri, 30 May 2008 11:00:25 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0hgs020259 for ; Fri, 30 May 2008 11:00:43 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI0hs2020258 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:00:43 -0700 Message-Id: <200805301800.m4UI0hs2020258@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:40 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] ia64: Do not guest_physmap_remove_page() old page in gnttab_transfer op. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212056356 -3600 # Node ID dbd5d4eeb46adf866a64f65ce7768c1a34345ac4 # Parent 564c9be76aa496fda12923ffca5c4ca41a6c395f ia64: Do not guest_physmap_remove_page() old page in gnttab_transfer op. Signed-off-by: Keir Fraser --- xen/common/grant_table.c | 2 ++ 1 files changed, 2 insertions(+) diff -r 564c9be76aa4 -r dbd5d4eeb46a xen/common/grant_table.c --- a/xen/common/grant_table.c Thu May 29 09:42:59 2008 +0100 +++ b/xen/common/grant_table.c Thu May 29 11:19:16 2008 +0100 @@ -1112,7 +1112,9 @@ gnttab_transfer( goto copyback; } +#ifndef __ia64__ /* IA64 implicitly replaces the old page in steal_page(). */ guest_physmap_remove_page(d, gop.mfn, mfn, 0); +#endif flush_tlb_mask(d->domain_dirty_cpumask); /* Find the target domain. */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:27 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:27 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABG-00048F-Tz for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:27 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABz-0002ms-3P; Fri, 30 May 2008 19:23:11 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABr-0002f3-MC for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:03 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABk-0004zz-QD for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:01 +0000 X-SBRS: 3.6 X-MesageID: 359419 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359419" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:30 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0UE5030260 for ; Fri, 30 May 2008 11:00:30 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0mhB020278 for ; Fri, 30 May 2008 11:00:48 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI0lvf020277 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:00:47 -0700 Message-Id: <200805301800.m4UI0lvf020277@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:44 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] xend: Add node parameter to do_migrate() for HTTP interface X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212064711 -3600 # Node ID 6f48c4ee8ae231715a302af7cc98fd902adeb92c # Parent dbd5d4eeb46adf866a64f65ce7768c1a34345ac4 xend: Add node parameter to do_migrate() for HTTP interface Signed-off-by: Masaki Kanno --- tools/python/xen/xend/server/SrvDomain.py | 1 + 1 files changed, 1 insertion(+) diff -r dbd5d4eeb46a -r 6f48c4ee8ae2 tools/python/xen/xend/server/SrvDomain.py --- a/tools/python/xen/xend/server/SrvDomain.py Thu May 29 11:19:16 2008 +0100 +++ b/tools/python/xen/xend/server/SrvDomain.py Thu May 29 13:38:31 2008 +0100 @@ -116,6 +116,7 @@ class SrvDomain(SrvDir): ['destination', 'str'], ['live', 'int'], ['port', 'int'], + ['node', 'int'], ['ssl', 'int']]) return fn(req.args, {'dom': self.dom.domid}) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:31 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:31 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABL-00048I-97 for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:31 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2AC3-0002qX-Ck; Fri, 30 May 2008 19:23:15 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABu-0002hu-Cl for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:06 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABm-0004zs-Oa for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:04 +0000 X-SBRS: 3.6 X-MesageID: 359421 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359421" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:34 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0YkG030263 for ; Fri, 30 May 2008 11:00:34 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0qSJ020313 for ; Fri, 30 May 2008 11:00:52 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI0q5a020312 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:00:52 -0700 Message-Id: <200805301800.m4UI0q5a020312@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:49 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vtd: Remove dead code. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212067848 -3600 # Node ID 121d196b4cc85222dccbd947b372a8c2d218035c # Parent 6f48c4ee8ae231715a302af7cc98fd902adeb92c vtd: Remove dead code. Signed-off-by: Keir Fraser --- xen/drivers/passthrough/vtd/dmar.c | 33 ------ xen/drivers/passthrough/vtd/dmar.h | 1 xen/drivers/passthrough/vtd/x86/vtd.c | 178 ---------------------------------- xen/include/xen/iommu.h | 2 4 files changed, 214 deletions(-) diff -r 6f48c4ee8ae2 -r 121d196b4cc8 xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Thu May 29 13:38:31 2008 +0100 +++ b/xen/drivers/passthrough/vtd/dmar.c Thu May 29 14:30:48 2008 +0100 @@ -147,39 +147,6 @@ struct acpi_drhd_unit * acpi_find_matche return NULL; } -struct acpi_rmrr_unit * acpi_find_matched_rmrr_unit(struct pci_dev *dev) -{ - struct acpi_rmrr_unit *rmrr; - - list_for_each_entry ( rmrr, &acpi_rmrr_units, list ) - if ( acpi_pci_device_match(rmrr->devices, - rmrr->devices_cnt, dev) ) - return rmrr; - - return NULL; -} - -struct acpi_atsr_unit * acpi_find_matched_atsr_unit(struct pci_dev *dev) -{ - struct acpi_atsr_unit *atsru; - struct acpi_atsr_unit *all_ports_atsru; - - all_ports_atsru = NULL; - list_for_each_entry ( atsru, &acpi_atsr_units, list ) - { - if ( atsru->all_ports ) - all_ports_atsru = atsru; - if ( acpi_pci_device_match(atsru->devices, - atsru->devices_cnt, dev) ) - return atsru; - } - - if ( all_ports_atsru ) - return all_ports_atsru;; - - return NULL; -} - static int scope_device_count(void *start, void *end) { struct acpi_dev_scope *scope; diff -r 6f48c4ee8ae2 -r 121d196b4cc8 xen/drivers/passthrough/vtd/dmar.h --- a/xen/drivers/passthrough/vtd/dmar.h Thu May 29 13:38:31 2008 +0100 +++ b/xen/drivers/passthrough/vtd/dmar.h Thu May 29 14:30:48 2008 +0100 @@ -86,7 +86,6 @@ struct acpi_atsr_unit { } struct acpi_drhd_unit * acpi_find_matched_drhd_unit(struct pci_dev *dev); -struct acpi_rmrr_unit * acpi_find_matched_rmrr_unit(struct pci_dev *dev); #define DMAR_TYPE 1 #define RMRR_TYPE 2 diff -r 6f48c4ee8ae2 -r 121d196b4cc8 xen/drivers/passthrough/vtd/x86/vtd.c --- a/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 29 13:38:31 2008 +0100 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 29 14:30:48 2008 +0100 @@ -123,181 +123,3 @@ void hvm_dpci_isairq_eoi(struct domain * } } } - -void iommu_set_pgd(struct domain *d) -{ - struct hvm_iommu *hd = domain_hvm_iommu(d); - unsigned long p2m_table; - - p2m_table = mfn_x(pagetable_get_mfn(d->arch.phys_table)); - - if ( paging_mode_hap(d) ) - { - int level = agaw_to_level(hd->agaw); - struct dma_pte *dpte = NULL; - mfn_t pgd_mfn; - - switch ( level ) - { - case VTD_PAGE_TABLE_LEVEL_3: - dpte = map_domain_page(p2m_table); - if ( !dma_pte_present(*dpte) ) - { - gdprintk(XENLOG_ERR VTDPREFIX, - "iommu_set_pgd: second level wasn't there\n"); - unmap_domain_page(dpte); - return; - } - pgd_mfn = _mfn(dma_pte_addr(*dpte) >> PAGE_SHIFT_4K); - hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K; - unmap_domain_page(dpte); - break; - case VTD_PAGE_TABLE_LEVEL_4: - pgd_mfn = _mfn(p2m_table); - hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K; - break; - default: - gdprintk(XENLOG_ERR VTDPREFIX, - "iommu_set_pgd:Unsupported p2m table sharing level!\n"); - break; - } - } - else - { -#if CONFIG_PAGING_LEVELS == 3 - struct dma_pte *pte = NULL, *pgd_vaddr = NULL, *pmd_vaddr = NULL; - int i; - u64 pmd_maddr; - unsigned long flags; - l3_pgentry_t *l3e; - int level = agaw_to_level(hd->agaw); - - spin_lock_irqsave(&hd->mapping_lock, flags); - hd->pgd_maddr = alloc_pgtable_maddr(); - if ( hd->pgd_maddr == 0 ) - { - spin_unlock_irqrestore(&hd->mapping_lock, flags); - gdprintk(XENLOG_ERR VTDPREFIX, - "Allocate pgd memory failed!\n"); - return; - } - - pgd_vaddr = map_vtd_domain_page(hd->pgd_maddr); - l3e = map_domain_page(p2m_table); - switch ( level ) - { - case VTD_PAGE_TABLE_LEVEL_3: /* Weybridge */ - /* We only support 8 entries for the PAE L3 p2m table */ - for ( i = 0; i < 8 ; i++ ) - { - /* Don't create new L2 entry, use ones from p2m table */ - pgd_vaddr[i].val = l3e[i].l3 | _PAGE_PRESENT | _PAGE_RW; - } - break; - - case VTD_PAGE_TABLE_LEVEL_4: /* Stoakley */ - /* We allocate one more page for the top vtd page table. */ - pmd_maddr = alloc_pgtable_maddr(); - if ( pmd_maddr == 0 ) - { - unmap_vtd_domain_page(pgd_vaddr); - unmap_domain_page(l3e); - spin_unlock_irqrestore(&hd->mapping_lock, flags); - gdprintk(XENLOG_ERR VTDPREFIX, - "Allocate pmd memory failed!\n"); - return; - } - - pte = &pgd_vaddr[0]; - dma_set_pte_addr(*pte, pmd_maddr); - dma_set_pte_readable(*pte); - dma_set_pte_writable(*pte); - - pmd_vaddr = map_vtd_domain_page(pmd_maddr); - for ( i = 0; i < 8; i++ ) - { - /* Don't create new L2 entry, use ones from p2m table */ - pmd_vaddr[i].val = l3e[i].l3 | _PAGE_PRESENT | _PAGE_RW; - } - - unmap_vtd_domain_page(pmd_vaddr); - break; - default: - gdprintk(XENLOG_ERR VTDPREFIX, - "iommu_set_pgd:Unsupported p2m table sharing level!\n"); - break; - } - - unmap_vtd_domain_page(pgd_vaddr); - unmap_domain_page(l3e); - spin_unlock_irqrestore(&hd->mapping_lock, flags); - -#elif CONFIG_PAGING_LEVELS == 4 - mfn_t pgd_mfn; - l3_pgentry_t *l3e; - int level = agaw_to_level(hd->agaw); - - switch ( level ) - { - case VTD_PAGE_TABLE_LEVEL_3: - l3e = map_domain_page(p2m_table); - if ( (l3e_get_flags(*l3e) & _PAGE_PRESENT) == 0 ) - { - gdprintk(XENLOG_ERR VTDPREFIX, - "iommu_set_pgd: second level wasn't there\n"); - unmap_domain_page(l3e); - return; - } - - pgd_mfn = _mfn(l3e_get_pfn(*l3e)); - hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K; - unmap_domain_page(l3e); - break; - case VTD_PAGE_TABLE_LEVEL_4: - pgd_mfn = _mfn(p2m_table); - hd->pgd_maddr = (paddr_t)(mfn_x(pgd_mfn)) << PAGE_SHIFT_4K; - break; - default: - gdprintk(XENLOG_ERR VTDPREFIX, - "iommu_set_pgd:Unsupported p2m table sharing level!\n"); - break; - } -#endif - } -} - -void iommu_free_pgd(struct domain *d) -{ -#if CONFIG_PAGING_LEVELS == 3 - struct hvm_iommu *hd = domain_hvm_iommu(d); - int level = agaw_to_level(hd->agaw); - struct dma_pte *pgd_vaddr = NULL; - - switch ( level ) - { - case VTD_PAGE_TABLE_LEVEL_3: - if ( hd->pgd_maddr != 0 ) - { - free_pgtable_maddr(hd->pgd_maddr); - hd->pgd_maddr = 0; - } - break; - case VTD_PAGE_TABLE_LEVEL_4: - if ( hd->pgd_maddr != 0 ) - { - pgd_vaddr = (struct dma_pte*)map_vtd_domain_page(hd->pgd_maddr); - if ( pgd_vaddr[0].val != 0 ) - free_pgtable_maddr(pgd_vaddr[0].val); - unmap_vtd_domain_page(pgd_vaddr); - free_pgtable_maddr(hd->pgd_maddr); - hd->pgd_maddr = 0; - } - break; - default: - gdprintk(XENLOG_ERR VTDPREFIX, - "Unsupported p2m table sharing level!\n"); - break; - } -#endif -} - diff -r 6f48c4ee8ae2 -r 121d196b4cc8 xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Thu May 29 13:38:31 2008 +0100 +++ b/xen/include/xen/iommu.h Thu May 29 14:30:48 2008 +0100 @@ -68,8 +68,6 @@ void reassign_device_ownership(struct do u8 bus, u8 devfn); int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn); int iommu_unmap_page(struct domain *d, unsigned long gfn); -void iommu_set_pgd(struct domain *d); -void iommu_free_pgd(struct domain *d); void iommu_domain_teardown(struct domain *d); int hvm_do_IRQ_dpci(struct domain *d, unsigned int irq); int dpci_ioport_intercept(ioreq_t *p); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:35 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:35 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABP-00048N-CK for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:35 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2AC7-0002u6-Jw; Fri, 30 May 2008 19:23:19 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABw-0002jd-HW for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:08 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABn-0004zn-GX for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:06 +0000 X-SBRS: 3.6 X-MesageID: 359422 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359422" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:36 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0a9Y030266 for ; Fri, 30 May 2008 11:00:36 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0sWe020330 for ; Fri, 30 May 2008 11:00:54 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI0sZx020329 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:00:54 -0700 Message-Id: <200805301800.m4UI0sZx020329@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:52 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] vtd: Various cleanups and fixes: X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212156368 -3600 # Node ID ecd266cebcab648132d432899eabaecf8a168508 # Parent 121d196b4cc85222dccbd947b372a8c2d218035c vtd: Various cleanups and fixes: * Handle DRHDs with different supported AGAWs. To support this we create page tables which always have 4 levels, and skip top levels for units which support only 2 or 3 levels. * Handle systems with mixed DRHD support for cache snooping. We must pessimistically CLFLUSH if any DRHD does not support snooping. Signed-off-by: Keir Fraser --- xen/drivers/passthrough/vtd/iommu.c | 204 ++++++++++++++++------------------ xen/drivers/passthrough/vtd/iommu.h | 1 xen/drivers/passthrough/vtd/vtd.h | 4 xen/drivers/passthrough/vtd/x86/vtd.c | 6 - xen/include/xen/iommu.h | 1 5 files changed, 101 insertions(+), 115 deletions(-) diff -r 121d196b4cc8 -r ecd266cebcab xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Thu May 29 14:30:48 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Fri May 30 15:06:08 2008 +0100 @@ -112,28 +112,27 @@ struct iommu_flush *iommu_get_flush(stru return iommu ? &iommu->intel->flush : NULL; } -unsigned int clflush_size; -void clflush_cache_range(void *adr, int size) +static unsigned int clflush_size; +static int iommus_incoherent; +static void __iommu_flush_cache(void *addr, int size) { int i; + + if ( !iommus_incoherent ) + return; + for ( i = 0; i < size; i += clflush_size ) - clflush(adr + i); -} - -static void __iommu_flush_cache(struct iommu *iommu, void *addr, int size) -{ - if ( !ecap_coherent(iommu->ecap) ) - clflush_cache_range(addr, size); -} - -void iommu_flush_cache_entry(struct iommu *iommu, void *addr) -{ - __iommu_flush_cache(iommu, addr, 8); -} - -void iommu_flush_cache_page(struct iommu *iommu, void *addr) -{ - __iommu_flush_cache(iommu, addr, PAGE_SIZE_4K); + clflush((char *)addr + i); +} + +void iommu_flush_cache_entry(void *addr) +{ + __iommu_flush_cache(addr, 8); +} + +void iommu_flush_cache_page(void *addr) +{ + __iommu_flush_cache(addr, PAGE_SIZE_4K); } int nr_iommus; @@ -157,7 +156,7 @@ static u64 bus_to_context_maddr(struct i } set_root_value(*root, maddr); set_root_present(*root); - iommu_flush_cache_entry(iommu, root); + iommu_flush_cache_entry(root); } maddr = (u64) get_context_addr(*root); unmap_vtd_domain_page(root_entries); @@ -194,8 +193,6 @@ static u64 addr_to_dma_page_maddr(struct static u64 addr_to_dma_page_maddr(struct domain *domain, u64 addr, int alloc) { struct hvm_iommu *hd = domain_hvm_iommu(domain); - struct acpi_drhd_unit *drhd; - struct iommu *iommu; int addr_width = agaw_to_width(hd->agaw); struct dma_pte *parent, *pte = NULL; int level = agaw_to_level(hd->agaw); @@ -204,19 +201,11 @@ static u64 addr_to_dma_page_maddr(struct u64 pte_maddr = 0, maddr; u64 *vaddr = NULL; - drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); - iommu = drhd->iommu; - addr &= (((u64)1) << addr_width) - 1; spin_lock_irqsave(&hd->mapping_lock, flags); if ( hd->pgd_maddr == 0 ) - { - if ( !alloc ) + if ( !alloc || ((hd->pgd_maddr = alloc_pgtable_maddr()) == 0) ) goto out; - hd->pgd_maddr = alloc_pgtable_maddr(); - if ( hd->pgd_maddr == 0 ) - goto out; - } parent = (struct dma_pte *)map_vtd_domain_page(hd->pgd_maddr); while ( level > 1 ) @@ -240,7 +229,7 @@ static u64 addr_to_dma_page_maddr(struct */ dma_set_pte_readable(*pte); dma_set_pte_writable(*pte); - iommu_flush_cache_entry(iommu, pte); + iommu_flush_cache_entry(pte); } else { @@ -551,8 +540,6 @@ static void dma_pte_clear_one(struct dom struct dma_pte *page = NULL, *pte = NULL; u64 pg_maddr; - drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); - /* get last level pte */ pg_maddr = addr_to_dma_page_maddr(domain, addr, 0); if ( pg_maddr == 0 ) @@ -567,14 +554,14 @@ static void dma_pte_clear_one(struct dom } dma_clear_pte(*pte); - iommu_flush_cache_entry(drhd->iommu, pte); + iommu_flush_cache_entry(pte); for_each_drhd_unit ( drhd ) { iommu = drhd->iommu; - if ( test_bit(iommu->index, &hd->iommu_bitmap) ) - iommu_flush_iotlb_psi(iommu, domain_iommu_domid(domain), addr, 1, 0); + iommu_flush_iotlb_psi(iommu, domain_iommu_domid(domain), + addr, 1, 0); } unmap_vtd_domain_page(page); @@ -603,7 +590,6 @@ static void iommu_free_next_pagetable(u6 static void iommu_free_next_pagetable(u64 pt_maddr, unsigned long index, int level) { - struct acpi_drhd_unit *drhd; unsigned long next_index; struct dma_pte *pt_vaddr, *pde; int next_level; @@ -613,50 +599,38 @@ static void iommu_free_next_pagetable(u6 pt_vaddr = (struct dma_pte *)map_vtd_domain_page(pt_maddr); pde = &pt_vaddr[index]; - if ( dma_pte_addr(*pde) != 0 ) - { - next_level = level - 1; - if ( next_level > 1 ) - { - next_index = 0; - do - { - iommu_free_next_pagetable(pde->val, - next_index, next_level); - next_index++; - } while ( next_index < PTE_NUM ); - } - - dma_clear_pte(*pde); - drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); - iommu_flush_cache_entry(drhd->iommu, pde); - free_pgtable_maddr(pde->val); - unmap_vtd_domain_page(pt_vaddr); - } - else - unmap_vtd_domain_page(pt_vaddr); + if ( dma_pte_addr(*pde) == 0 ) + goto out; + + next_level = level - 1; + if ( next_level > 1 ) + { + for ( next_index = 0; next_index < PTE_NUM; next_index++ ) + iommu_free_next_pagetable(pde->val, next_index, next_level); + } + + dma_clear_pte(*pde); + iommu_flush_cache_entry(pde); + free_pgtable_maddr(pde->val); + + out: + unmap_vtd_domain_page(pt_vaddr); } /* free all VT-d page tables when shut down or destroy domain. */ static void iommu_free_pagetable(struct domain *domain) { - unsigned long index; struct hvm_iommu *hd = domain_hvm_iommu(domain); - int total_level = agaw_to_level(hd->agaw); - - if ( hd->pgd_maddr != 0 ) - { - index = 0; - do - { - iommu_free_next_pagetable(hd->pgd_maddr, - index, total_level + 1); - index++; - } while ( index < PTE_NUM ); - - free_pgtable_maddr(hd->pgd_maddr); - hd->pgd_maddr = 0; - } + int i, total_level = agaw_to_level(hd->agaw); + + if ( hd->pgd_maddr == 0 ) + return; + + for ( i = 0; i < PTE_NUM; i++ ) + iommu_free_next_pagetable(hd->pgd_maddr, i, total_level + 1); + + free_pgtable_maddr(hd->pgd_maddr); + hd->pgd_maddr = 0; } static int iommu_set_root_entry(struct iommu *iommu) @@ -977,6 +951,8 @@ static int iommu_alloc(struct acpi_drhd_ static int iommu_alloc(struct acpi_drhd_unit *drhd) { struct iommu *iommu; + unsigned long sagaw; + int agaw; if ( nr_iommus > MAX_IOMMUS ) { @@ -1003,6 +979,23 @@ static int iommu_alloc(struct acpi_drhd_ iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG); iommu->ecap = dmar_readq(iommu->reg, DMAR_ECAP_REG); + + /* Calculate number of pagetable levels: between 2 and 4. */ + sagaw = cap_sagaw(iommu->cap); + for ( agaw = level_to_agaw(4); agaw >= 0; agaw-- ) + if ( test_bit(agaw, &sagaw) ) + break; + if ( agaw < 0 ) + { + gdprintk(XENLOG_ERR VTDPREFIX, + "IOMMU: unsupported sagaw %lx\n", sagaw); + xfree(iommu); + return -ENODEV; + } + iommu->nr_pt_levels = agaw_to_level(agaw); + + if ( !ecap_coherent(iommu->ecap) ) + iommus_incoherent = 1; spin_lock_init(&iommu->lock); spin_lock_init(&iommu->register_lock); @@ -1045,10 +1038,7 @@ static int intel_iommu_domain_init(struc { struct hvm_iommu *hd = domain_hvm_iommu(d); struct iommu *iommu = NULL; - int guest_width = DEFAULT_DOMAIN_ADDRESS_WIDTH; - int adjust_width, agaw; u64 i; - unsigned long sagaw; struct acpi_drhd_unit *drhd; INIT_LIST_HEAD(&hd->pdev_list); @@ -1056,22 +1046,7 @@ static int intel_iommu_domain_init(struc drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); iommu = drhd->iommu; - /* Calculate AGAW. */ - if ( guest_width > cap_mgaw(iommu->cap) ) - guest_width = cap_mgaw(iommu->cap); - adjust_width = guestwidth_to_adjustwidth(guest_width); - agaw = width_to_agaw(adjust_width); - /* FIXME: hardware doesn't support it, choose a bigger one? */ - sagaw = cap_sagaw(iommu->cap); - if ( !test_bit(agaw, &sagaw) ) - { - gdprintk(XENLOG_ERR VTDPREFIX, - "IOMMU: hardware doesn't support the agaw\n"); - agaw = find_next_bit(&sagaw, 5, agaw); - if ( agaw >= 5 ) - return -ENODEV; - } - hd->agaw = agaw; + hd->agaw = width_to_agaw(DEFAULT_DOMAIN_ADDRESS_WIDTH); if ( d->domain_id == 0 ) { @@ -1115,7 +1090,8 @@ static int domain_context_mapping_one( struct hvm_iommu *hd = domain_hvm_iommu(domain); struct context_entry *context, *context_entries; unsigned long flags; - u64 maddr; + u64 maddr, pgd_maddr; + int agaw; maddr = bus_to_context_maddr(iommu, bus); context_entries = (struct context_entry *)map_vtd_domain_page(maddr); @@ -1135,17 +1111,33 @@ static int domain_context_mapping_one( else { #endif + /* Ensure we have pagetables allocated down to leaf PTE. */ if ( hd->pgd_maddr == 0 ) { - hd->pgd_maddr = alloc_pgtable_maddr(); + addr_to_dma_page_maddr(domain, 0, 1); if ( hd->pgd_maddr == 0 ) { + nomem: unmap_vtd_domain_page(context_entries); spin_unlock_irqrestore(&iommu->lock, flags); return -ENOMEM; } } - context_set_address_root(*context, hd->pgd_maddr); + + /* Skip top levels of page tables for 2- and 3-level DRHDs. */ + pgd_maddr = hd->pgd_maddr; + for ( agaw = level_to_agaw(4); + agaw != level_to_agaw(iommu->nr_pt_levels); + agaw-- ) + { + struct dma_pte *p = map_vtd_domain_page(pgd_maddr); + pgd_maddr = dma_pte_addr(*p); + unmap_vtd_domain_page(p); + if ( pgd_maddr == 0 ) + goto nomem; + } + + context_set_address_root(*context, pgd_maddr); context_set_translation_type(*context, CONTEXT_TT_MULTI_LEVEL); #ifdef CONTEXT_PASSTHRU } @@ -1156,10 +1148,10 @@ static int domain_context_mapping_one( * be 1 based as required by intel's iommu hw. */ context_set_domain_id(context, domain); - context_set_address_width(*context, hd->agaw); + context_set_address_width(*context, agaw); context_set_fault_enable(*context); context_set_present(*context); - iommu_flush_cache_entry(iommu, context); + iommu_flush_cache_entry(context); unmap_vtd_domain_page(context_entries); @@ -1316,7 +1308,7 @@ static int domain_context_unmap_one( spin_lock_irqsave(&iommu->lock, flags); context_clear_present(*context); context_clear_entry(*context); - iommu_flush_cache_entry(iommu, context); + iommu_flush_cache_entry(context); iommu_flush_context_global(iommu, 0); iommu_flush_iotlb_global(iommu, 0); unmap_vtd_domain_page(context_entries); @@ -1499,9 +1491,6 @@ int intel_iommu_map_page( u64 pg_maddr; int pte_present; - drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); - iommu = drhd->iommu; - #ifdef CONTEXT_PASSTHRU /* do nothing if dom0 and iommu supports pass thru */ if ( ecap_pass_thru(iommu->ecap) && (d->domain_id == 0) ) @@ -1516,7 +1505,7 @@ int intel_iommu_map_page( pte_present = dma_pte_present(*pte); dma_set_pte_addr(*pte, (paddr_t)mfn << PAGE_SHIFT_4K); dma_set_pte_prot(*pte, DMA_PTE_READ | DMA_PTE_WRITE); - iommu_flush_cache_entry(iommu, pte); + iommu_flush_cache_entry(pte); unmap_vtd_domain_page(page); for_each_drhd_unit ( drhd ) @@ -1565,10 +1554,9 @@ int iommu_page_mapping(struct domain *do int index; u64 pg_maddr; - drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); - iommu = drhd->iommu; if ( (prot & (DMA_PTE_READ|DMA_PTE_WRITE)) == 0 ) return -EINVAL; + iova = (iova >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K; start_pfn = hpa >> PAGE_SHIFT_4K; end_pfn = (PAGE_ALIGN_4K(hpa + size)) >> PAGE_SHIFT_4K; @@ -1582,7 +1570,7 @@ int iommu_page_mapping(struct domain *do pte = page + (start_pfn & LEVEL_MASK); dma_set_pte_addr(*pte, (paddr_t)start_pfn << PAGE_SHIFT_4K); dma_set_pte_prot(*pte, prot); - iommu_flush_cache_entry(iommu, pte); + iommu_flush_cache_entry(pte); unmap_vtd_domain_page(page); start_pfn++; index++; diff -r 121d196b4cc8 -r ecd266cebcab xen/drivers/passthrough/vtd/iommu.h --- a/xen/drivers/passthrough/vtd/iommu.h Thu May 29 14:30:48 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.h Fri May 30 15:06:08 2008 +0100 @@ -236,6 +236,7 @@ struct context_entry { #define LEVEL_STRIDE (9) #define LEVEL_MASK ((1 << LEVEL_STRIDE) - 1) #define PTE_NUM (1 << LEVEL_STRIDE) +#define level_to_agaw(val) ((val) - 2) #define agaw_to_level(val) ((val) + 2) #define agaw_to_width(val) (30 + val * LEVEL_STRIDE) #define width_to_agaw(w) ((w - 30)/LEVEL_STRIDE) diff -r 121d196b4cc8 -r ecd266cebcab xen/drivers/passthrough/vtd/vtd.h --- a/xen/drivers/passthrough/vtd/vtd.h Thu May 29 14:30:48 2008 +0100 +++ b/xen/drivers/passthrough/vtd/vtd.h Fri May 30 15:06:08 2008 +0100 @@ -66,7 +66,7 @@ void *map_vtd_domain_page(u64 maddr); void *map_vtd_domain_page(u64 maddr); void unmap_vtd_domain_page(void *va); -void iommu_flush_cache_entry(struct iommu *iommu, void *addr); -void iommu_flush_cache_page(struct iommu *iommu, void *addr); +void iommu_flush_cache_entry(void *addr); +void iommu_flush_cache_page(void *addr); #endif // _VTD_H_ diff -r 121d196b4cc8 -r ecd266cebcab xen/drivers/passthrough/vtd/x86/vtd.c --- a/xen/drivers/passthrough/vtd/x86/vtd.c Thu May 29 14:30:48 2008 +0100 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c Fri May 30 15:06:08 2008 +0100 @@ -41,8 +41,6 @@ u64 alloc_pgtable_maddr(void) { struct page_info *pg; u64 *vaddr; - struct acpi_drhd_unit *drhd; - struct iommu *iommu; pg = alloc_domheap_page(NULL, 0); vaddr = map_domain_page(page_to_mfn(pg)); @@ -50,9 +48,7 @@ u64 alloc_pgtable_maddr(void) return 0; memset(vaddr, 0, PAGE_SIZE); - drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); - iommu = drhd->iommu; - iommu_flush_cache_page(iommu, vaddr); + iommu_flush_cache_page(vaddr); unmap_domain_page(vaddr); return page_to_maddr(pg); diff -r 121d196b4cc8 -r ecd266cebcab xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Thu May 29 14:30:48 2008 +0100 +++ b/xen/include/xen/iommu.h Fri May 30 15:06:08 2008 +0100 @@ -47,6 +47,7 @@ struct iommu { void __iomem *reg; /* Pointer to hardware regs, virtual addr */ u32 index; /* Sequence number of iommu */ u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */ + u32 nr_pt_levels; u64 cap; u64 ecap; spinlock_t lock; /* protect context, domain ids */ _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:40 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:40 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABU-00048R-JL for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:40 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACC-0002yP-S4; Fri, 30 May 2008 19:23:24 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABx-0002k6-9L for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:09 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABq-0004zz-8z for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:07 +0000 X-SBRS: 3.6 X-MesageID: 359423 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359423" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:40 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0eVm030269 for ; Fri, 30 May 2008 11:00:40 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0xpn020347 for ; Fri, 30 May 2008 11:00:59 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI0wZg020346 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:00:58 -0700 Message-Id: <200805301800.m4UI0wZg020346@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:55 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] [IA64] compilation fix of iommu.h X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212156580 -3600 # Node ID c76e7f396c03cb65249487cf57fe30ed883e4b21 # Parent ecd266cebcab648132d432899eabaecf8a168508 [IA64] compilation fix of iommu.h Trivial compilation fix of iommu.h. It includes asm/msi.h for struct msi_desc and struct msi_msg definition. msi.h doesn't exist yet on ia64 so declare struct msi_desc and struct msi_msg in iommu.h and don't include asm/msi.h. Signed-off-by: Isaku Yamahata --- xen/include/xen/iommu.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) diff -r ecd266cebcab -r c76e7f396c03 xen/include/xen/iommu.h --- a/xen/include/xen/iommu.h Fri May 30 15:06:08 2008 +0100 +++ b/xen/include/xen/iommu.h Fri May 30 15:09:40 2008 +0100 @@ -26,7 +26,6 @@ #include #include #include -#include extern int vtd_enabled; extern int iommu_enabled; @@ -79,6 +78,9 @@ unsigned int io_apic_read_remap_rte(unsi unsigned int io_apic_read_remap_rte(unsigned int apic, unsigned int reg); void io_apic_write_remap_rte(unsigned int apic, unsigned int reg, unsigned int value); + +struct msi_desc; +struct msi_msg; void msi_msg_read_remap_rte(struct msi_desc *msi_desc, struct msi_msg *msg); void msi_msg_write_remap_rte(struct msi_desc *msi_desc, struct msi_msg *msg); struct qi_ctrl *iommu_qi_ctrl(struct iommu *iommu); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:44 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:44 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABY-00048U-6F for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:44 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACG-00031n-FM; Fri, 30 May 2008 19:23:28 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ABz-0002m7-OA for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:11 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABs-0004zs-UH for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:09 +0000 X-SBRS: 3.6 X-MesageID: 359424 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359424" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:42 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0g2p030272 for ; Fri, 30 May 2008 11:00:42 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI10mq020364 for ; Fri, 30 May 2008 11:01:00 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI10PL020363 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:01:00 -0700 Message-Id: <200805301801.m4UI10PL020363@xenbits.xensource.com> Date: Fri, 30 May 2008 11:00:59 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] Add xen_phys_start value in the crash info note X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212159860 -3600 # Node ID 439a3e9459f22394088dc0187d2ccad394e14667 # Parent c76e7f396c03cb65249487cf57fe30ed883e4b21 Add xen_phys_start value in the crash info note This patch makes the vmcore utilities (ex. crash, makedumpfile) be able to get the relocation address of the xen hypervisor from a vmcore. It is necessary for the utilities to find the data of the hypervisor structures. Note that this patch does not raise any comptibility issue for the utilities (which I know) nor the other components of xen. Signed-off-by: Itsuro Oda --- xen/arch/x86/crash.c | 1 + xen/include/xen/elfcore.h | 1 + 2 files changed, 2 insertions(+) diff -r c76e7f396c03 -r 439a3e9459f2 xen/arch/x86/crash.c --- a/xen/arch/x86/crash.c Fri May 30 15:09:40 2008 +0100 +++ b/xen/arch/x86/crash.c Fri May 30 16:04:20 2008 +0100 @@ -102,6 +102,7 @@ void machine_crash_shutdown(void) hvm_cpu_down(); info = kexec_crash_save_info(); + info->xen_phys_start = xen_phys_start; info->dom0_pfn_to_mfn_frame_list_list = arch_get_pfn_to_mfn_frame_list_list(dom0); } diff -r c76e7f396c03 -r 439a3e9459f2 xen/include/xen/elfcore.h --- a/xen/include/xen/elfcore.h Fri May 30 15:09:40 2008 +0100 +++ b/xen/include/xen/elfcore.h Fri May 30 16:04:20 2008 +0100 @@ -66,6 +66,7 @@ typedef struct { unsigned long xen_compile_time; unsigned long tainted; #if defined(__i386__) || defined(__x86_64__) + unsigned long xen_phys_start; unsigned long dom0_pfn_to_mfn_frame_list_list; #endif #if defined(__ia64__) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:48 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:48 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABb-00048Y-Th for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:48 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACK-00035J-6Q; Fri, 30 May 2008 19:23:32 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2AC1-0002o4-Vh for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:14 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABv-0004zn-5w for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:11 +0000 X-SBRS: 3.6 X-MesageID: 359426 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359426" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:48 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0mui030278 for ; Fri, 30 May 2008 11:00:48 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI16GS020420 for ; Fri, 30 May 2008 11:01:06 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI16sB020419 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:01:06 -0700 Message-Id: <200805301801.m4UI16sB020419@xenbits.xensource.com> Date: Fri, 30 May 2008 11:01:03 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Fix task-switch operation ordering. X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212162253 -3600 # Node ID 487dc63f95ff433eabb132253c5ff31cc178c00a # Parent 9c14ba60616d63ff849067dda9958c798f3f838b x86 hvm: Fix task-switch operation ordering. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hvm.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -r 9c14ba60616d -r 487dc63f95ff xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Fri May 30 16:30:40 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Fri May 30 16:44:13 2008 +0100 @@ -1402,13 +1402,13 @@ void hvm_task_switch( hvm_load_segment_selector(v, x86_seg_ldtr, tss.ldt) ) exn_raised = 1; - if ( (tss.trace & 1) && !exn_raised ) - hvm_inject_exception(TRAP_debug, tss_sel & 0xfff8, 0); - rc = hvm_copy_to_guest_virt( tr.base, &tss, sizeof(tss), PFEC_page_present); if ( rc == HVMCOPY_bad_gva_to_gfn ) exn_raised = 1; + + if ( (tss.trace & 1) && !exn_raised ) + hvm_inject_exception(TRAP_debug, tss_sel & 0xfff8, 0); tr.attr.fields.type = 0xb; /* busy 32-bit tss */ hvm_set_segment_register(v, x86_seg_tr, &tr); _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:52 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:52 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABf-00048b-Tp for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:52 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACO-00038r-46; Fri, 30 May 2008 19:23:36 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2AC4-0002qA-SB for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:16 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABv-0004zz-SN for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:13 +0000 X-SBRS: 3.6 X-MesageID: 359427 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359427" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:00:50 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI0ihq030275 for ; Fri, 30 May 2008 11:00:44 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI12YS020385 for ; Fri, 30 May 2008 11:01:02 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI127B020384 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:01:02 -0700 Message-Id: <200805301801.m4UI127B020384@xenbits.xensource.com> Date: Fri, 30 May 2008 11:01:01 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86 hvm: Support task switch when task state segments straddle page X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212161440 -3600 # Node ID 9c14ba60616d63ff849067dda9958c798f3f838b # Parent 439a3e9459f22394088dc0187d2ccad394e14667 x86 hvm: Support task switch when task state segments straddle page boundaries. Also improve error diagnostics from hvm_map(). Fixes multi-processor shutdown for some types of Windows OS. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hvm.c | 139 +++++++++++++++++++++++++------------------------ 1 files changed, 73 insertions(+), 66 deletions(-) diff -r 439a3e9459f2 -r 9c14ba60616d xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Fri May 30 16:04:20 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Fri May 30 16:30:40 2008 +0100 @@ -1100,16 +1100,17 @@ int hvm_virtual_to_linear_addr( return 0; } -static void *hvm_map(unsigned long va, int size) +static void *hvm_map_entry(unsigned long va) { unsigned long gfn, mfn; p2m_type_t p2mt; uint32_t pfec; - if ( ((va & ~PAGE_MASK) + size) > PAGE_SIZE ) - { - hvm_inject_exception(TRAP_page_fault, PFEC_write_access, - (va + PAGE_SIZE - 1) & PAGE_MASK); + if ( ((va & ~PAGE_MASK) + 8) > PAGE_SIZE ) + { + gdprintk(XENLOG_ERR, "Descriptor table entry " + "straddles page boundary\n"); + domain_crash(current->domain); return NULL; } @@ -1121,7 +1122,8 @@ static void *hvm_map(unsigned long va, i mfn = mfn_x(gfn_to_mfn_current(gfn, &p2mt)); if ( !p2m_is_ram(p2mt) ) { - hvm_inject_exception(TRAP_page_fault, pfec, va); + gdprintk(XENLOG_ERR, "Failed to look up descriptor table entry\n"); + domain_crash(current->domain); return NULL; } @@ -1132,7 +1134,7 @@ static void *hvm_map(unsigned long va, i return (char *)map_domain_page(mfn) + (va & ~PAGE_MASK); } -static void hvm_unmap(void *p) +static void hvm_unmap_entry(void *p) { if ( p ) unmap_domain_page(p); @@ -1168,7 +1170,7 @@ static int hvm_load_segment_selector( if ( ((sel & 0xfff8) + 7) > desctab.limit ) goto fail; - pdesc = hvm_map(desctab.base + (sel & 0xfff8), 8); + pdesc = hvm_map_entry(desctab.base + (sel & 0xfff8)); if ( pdesc == NULL ) goto hvm_map_fail; @@ -1228,7 +1230,7 @@ static int hvm_load_segment_selector( desc.b |= 0x100; skip_accessed_flag: - hvm_unmap(pdesc); + hvm_unmap_entry(pdesc); segr.base = (((desc.b << 0) & 0xff000000u) | ((desc.b << 16) & 0x00ff0000u) | @@ -1244,7 +1246,7 @@ static int hvm_load_segment_selector( return 0; unmap_and_fail: - hvm_unmap(pdesc); + hvm_unmap_entry(pdesc); fail: hvm_inject_exception(fault_type, sel & 0xfffc, 0); hvm_map_fail: @@ -1260,7 +1262,7 @@ void hvm_task_switch( struct segment_register gdt, tr, prev_tr, segr; struct desc_struct *optss_desc = NULL, *nptss_desc = NULL, tss_desc; unsigned long eflags; - int exn_raised; + int exn_raised, rc; struct { u16 back_link,__blh; u32 esp0; @@ -1272,7 +1274,7 @@ void hvm_task_switch( u32 cr3, eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi; u16 es, _3, cs, _4, ss, _5, ds, _6, fs, _7, gs, _8, ldt, _9; u16 trace, iomap; - } *ptss, tss; + } tss = { 0 }; hvm_get_segment_register(v, x86_seg_gdtr, &gdt); hvm_get_segment_register(v, x86_seg_tr, &prev_tr); @@ -1285,11 +1287,11 @@ void hvm_task_switch( goto out; } - optss_desc = hvm_map(gdt.base + (prev_tr.sel & 0xfff8), 8); + optss_desc = hvm_map_entry(gdt.base + (prev_tr.sel & 0xfff8)); if ( optss_desc == NULL ) goto out; - nptss_desc = hvm_map(gdt.base + (tss_sel & 0xfff8), 8); + nptss_desc = hvm_map_entry(gdt.base + (tss_sel & 0xfff8)); if ( nptss_desc == NULL ) goto out; @@ -1324,84 +1326,89 @@ void hvm_task_switch( goto out; } - ptss = hvm_map(prev_tr.base, sizeof(tss)); - if ( ptss == NULL ) + rc = hvm_copy_from_guest_virt( + &tss, prev_tr.base, sizeof(tss), PFEC_page_present); + if ( rc == HVMCOPY_bad_gva_to_gfn ) goto out; eflags = regs->eflags; if ( taskswitch_reason == TSW_iret ) eflags &= ~X86_EFLAGS_NT; - ptss->cr3 = v->arch.hvm_vcpu.guest_cr[3]; - ptss->eip = regs->eip; - ptss->eflags = eflags; - ptss->eax = regs->eax; - ptss->ecx = regs->ecx; - ptss->edx = regs->edx; - ptss->ebx = regs->ebx; - ptss->esp = regs->esp; - ptss->ebp = regs->ebp; - ptss->esi = regs->esi; - ptss->edi = regs->edi; + tss.cr3 = v->arch.hvm_vcpu.guest_cr[3]; + tss.eip = regs->eip; + tss.eflags = eflags; + tss.eax = regs->eax; + tss.ecx = regs->ecx; + tss.edx = regs->edx; + tss.ebx = regs->ebx; + tss.esp = regs->esp; + tss.ebp = regs->ebp; + tss.esi = regs->esi; + tss.edi = regs->edi; hvm_get_segment_register(v, x86_seg_es, &segr); - ptss->es = segr.sel; + tss.es = segr.sel; hvm_get_segment_register(v, x86_seg_cs, &segr); - ptss->cs = segr.sel; + tss.cs = segr.sel; hvm_get_segment_register(v, x86_seg_ss, &segr); - ptss->ss = segr.sel; + tss.ss = segr.sel; hvm_get_segment_register(v, x86_seg_ds, &segr); - ptss->ds = segr.sel; + tss.ds = segr.sel; hvm_get_segment_register(v, x86_seg_fs, &segr); - ptss->fs = segr.sel; + tss.fs = segr.sel; hvm_get_segment_register(v, x86_seg_gs, &segr); - ptss->gs = segr.sel; + tss.gs = segr.sel; hvm_get_segment_register(v, x86_seg_ldtr, &segr); - ptss->ldt = segr.sel; - - hvm_unmap(ptss); - - ptss = hvm_map(tr.base, sizeof(tss)); - if ( ptss == NULL ) + tss.ldt = segr.sel; + + rc = hvm_copy_to_guest_virt( + prev_tr.base, &tss, sizeof(tss), PFEC_page_present); + if ( rc == HVMCOPY_bad_gva_to_gfn ) goto out; - if ( hvm_set_cr3(ptss->cr3) ) - { - hvm_unmap(ptss); + rc = hvm_copy_from_guest_virt( + &tss, tr.base, sizeof(tss), PFEC_page_present); + if ( rc == HVMCOPY_bad_gva_to_gfn ) goto out; - } - - regs->eip = ptss->eip; - regs->eflags = ptss->eflags | 2; - regs->eax = ptss->eax; - regs->ecx = ptss->ecx; - regs->edx = ptss->edx; - regs->ebx = ptss->ebx; - regs->esp = ptss->esp; - regs->ebp = ptss->ebp; - regs->esi = ptss->esi; - regs->edi = ptss->edi; + + if ( hvm_set_cr3(tss.cr3) ) + goto out; + + regs->eip = tss.eip; + regs->eflags = tss.eflags | 2; + regs->eax = tss.eax; + regs->ecx = tss.ecx; + regs->edx = tss.edx; + regs->ebx = tss.ebx; + regs->esp = tss.esp; + regs->ebp = tss.ebp; + regs->esi = tss.esi; + regs->edi = tss.edi; if ( (taskswitch_reason == TSW_call_or_int) ) { regs->eflags |= X86_EFLAGS_NT; - ptss->back_link = prev_tr.sel; + tss.back_link = prev_tr.sel; } exn_raised = 0; - if ( hvm_load_segment_selector(v, x86_seg_es, ptss->es) || - hvm_load_segment_selector(v, x86_seg_cs, ptss->cs) || - hvm_load_segment_selector(v, x86_seg_ss, ptss->ss) || - hvm_load_segment_selector(v, x86_seg_ds, ptss->ds) || - hvm_load_segment_selector(v, x86_seg_fs, ptss->fs) || - hvm_load_segment_selector(v, x86_seg_gs, ptss->gs) || - hvm_load_segment_selector(v, x86_seg_ldtr, ptss->ldt) ) + if ( hvm_load_segment_selector(v, x86_seg_es, tss.es) || + hvm_load_segment_selector(v, x86_seg_cs, tss.cs) || + hvm_load_segment_selector(v, x86_seg_ss, tss.ss) || + hvm_load_segment_selector(v, x86_seg_ds, tss.ds) || + hvm_load_segment_selector(v, x86_seg_fs, tss.fs) || + hvm_load_segment_selector(v, x86_seg_gs, tss.gs) || + hvm_load_segment_selector(v, x86_seg_ldtr, tss.ldt) ) exn_raised = 1; - if ( (ptss->trace & 1) && !exn_raised ) + if ( (tss.trace & 1) && !exn_raised ) hvm_inject_exception(TRAP_debug, tss_sel & 0xfff8, 0); - hvm_unmap(ptss); + rc = hvm_copy_to_guest_virt( + tr.base, &tss, sizeof(tss), PFEC_page_present); + if ( rc == HVMCOPY_bad_gva_to_gfn ) + exn_raised = 1; tr.attr.fields.type = 0xb; /* busy 32-bit tss */ hvm_set_segment_register(v, x86_seg_tr, &tr); @@ -1430,8 +1437,8 @@ void hvm_task_switch( } out: - hvm_unmap(optss_desc); - hvm_unmap(nptss_desc); + hvm_unmap_entry(optss_desc); + hvm_unmap_entry(nptss_desc); } #define HVMCOPY_from_guest (0u<<0) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:55 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:55 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABj-00048h-GQ for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:55 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACR-0003CG-Pq; Fri, 30 May 2008 19:23:39 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2AC5-0002qN-2A for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:17 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2ABy-0004zs-8m for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:14 +0000 X-SBRS: 3.6 X-MesageID: 359430 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359430" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:01:36 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI1Zvv030283 for ; Fri, 30 May 2008 11:01:35 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI1sHl020741 for ; Fri, 30 May 2008 11:01:54 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI1sVM020740 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:01:54 -0700 Message-Id: <200805301801.m4UI1sVM020740@xenbits.xensource.com> Date: Fri, 30 May 2008 11:01:53 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86: Fix reboot failure after S3 X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212161765 -3600 # Node ID 89193df0ec1ca2b94bef17152db0c3e9da15f8d6 # Parent 84196133c9e5a1e4ac84a04cb3c48737159d1878 x86: Fix reboot failure after S3 "warm reset vector" is used to start APs. At booting time, it is set by BP, and cleared after all APs have started. When do S3, similar work need to do. However, when enable non-boot CPUs after S3, Xen just sets this vector, but forgets to clear it after APs startup. Signed-off-by: Huacai Chen xen-unstable changeset: 17751:564c9be76aa496fda12923ffca5c4ca41a6c395f xen-unstable date: Thu May 29 09:42:59 2008 +0100 --- xen/arch/x86/smpboot.c | 5 +++++ 1 files changed, 5 insertions(+) diff -r 84196133c9e5 -r 89193df0ec1c xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Wed May 28 16:36:13 2008 +0100 +++ b/xen/arch/x86/smpboot.c Fri May 30 16:36:05 2008 +0100 @@ -1362,6 +1362,11 @@ void enable_nonboot_cpus(void) panic("Not enough cpus"); } cpus_clear(frozen_cpus); + + /* + * Cleanup possible dangling ends after sleep... + */ + smpboot_restore_warm_reset_vector(); } #else /* ... !CONFIG_HOTPLUG_CPU */ int __cpu_disable(void) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:22:59 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:22:59 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABn-00048k-3w for www-data@colo.xensource.com; Fri, 30 May 2008 12:22:59 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACV-0003FY-E1; Fri, 30 May 2008 19:23:43 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2AC5-0002qu-HQ for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:17 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2AC0-0004zn-Im for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:15 +0000 X-SBRS: 3.6 X-MesageID: 359431 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359431" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:01:38 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI1bwo030286 for ; Fri, 30 May 2008 11:01:37 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UI1ufg020778 for ; Fri, 30 May 2008 11:01:56 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UI1ulh020777 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:01:56 -0700 Message-Id: <200805301801.m4UI1ulh020777@xenbits.xensource.com> Date: Fri, 30 May 2008 11:01:54 -0700 From: "Xen patchbot-3.2-testing" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-3.2-testing] x86 hvm: Support task switch when task state segments straddle page X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212162483 -3600 # Node ID 27351129428a63b0b4ed6e96255af18806b3d9f9 # Parent 89193df0ec1ca2b94bef17152db0c3e9da15f8d6 x86 hvm: Support task switch when task state segments straddle page boundaries. Also improve error diagnostics from hvm_map(). Fixes multi-processor shutdown for some types of Windows OS. Signed-off-by: Keir Fraser xen-unstable changeset: 17758:9c14ba60616d63ff849067dda9958c798f3f838b xen-unstable date: Fri May 30 16:30:40 2008 +0100 x86 hvm: Fix task-switch operation ordering. Signed-off-by: Keir Fraser xen-unstable changeset: 17759:487dc63f95ff433eabb132253c5ff31cc178c00a xen-unstable date: Fri May 30 16:44:13 2008 +0100 --- xen/arch/x86/hvm/hvm.c | 137 +++++++++++++++++++++++++------------------------ 1 files changed, 70 insertions(+), 67 deletions(-) diff -r 89193df0ec1c -r 27351129428a xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Fri May 30 16:36:05 2008 +0100 +++ b/xen/arch/x86/hvm/hvm.c Fri May 30 16:48:03 2008 +0100 @@ -927,16 +927,17 @@ int hvm_virtual_to_linear_addr( return 0; } -static void *hvm_map(unsigned long va, int size) +static void *hvm_map_entry(unsigned long va) { unsigned long gfn, mfn; p2m_type_t p2mt; uint32_t pfec; - if ( ((va & ~PAGE_MASK) + size) > PAGE_SIZE ) - { - hvm_inject_exception(TRAP_page_fault, PFEC_write_access, - (va + PAGE_SIZE - 1) & PAGE_MASK); + if ( ((va & ~PAGE_MASK) + 8) > PAGE_SIZE ) + { + gdprintk(XENLOG_ERR, "Descriptor table entry " + "straddles page boundary\n"); + domain_crash(current->domain); return NULL; } @@ -948,7 +949,8 @@ static void *hvm_map(unsigned long va, i mfn = mfn_x(gfn_to_mfn_current(gfn, &p2mt)); if ( !p2m_is_ram(p2mt) ) { - hvm_inject_exception(TRAP_page_fault, pfec, va); + gdprintk(XENLOG_ERR, "Failed to look up descriptor table entry\n"); + domain_crash(current->domain); return NULL; } @@ -959,7 +961,7 @@ static void *hvm_map(unsigned long va, i return (char *)map_domain_page(mfn) + (va & ~PAGE_MASK); } -static void hvm_unmap(void *p) +static void hvm_unmap_entry(void *p) { if ( p ) unmap_domain_page(p); @@ -995,7 +997,7 @@ static int hvm_load_segment_selector( if ( ((sel & 0xfff8) + 7) > desctab.limit ) goto fail; - pdesc = hvm_map(desctab.base + (sel & 0xfff8), 8); + pdesc = hvm_map_entry(desctab.base + (sel & 0xfff8)); if ( pdesc == NULL ) goto hvm_map_fail; @@ -1055,7 +1057,7 @@ static int hvm_load_segment_selector( desc.b |= 0x100; skip_accessed_flag: - hvm_unmap(pdesc); + hvm_unmap_entry(pdesc); segr.base = (((desc.b << 0) & 0xff000000u) | ((desc.b << 16) & 0x00ff0000u) | @@ -1071,7 +1073,7 @@ static int hvm_load_segment_selector( return 0; unmap_and_fail: - hvm_unmap(pdesc); + hvm_unmap_entry(pdesc); fail: hvm_inject_exception(fault_type, sel & 0xfffc, 0); hvm_map_fail: @@ -1087,7 +1089,7 @@ void hvm_task_switch( struct segment_register gdt, tr, prev_tr, segr; struct desc_struct *optss_desc = NULL, *nptss_desc = NULL, tss_desc; unsigned long eflags; - int exn_raised; + int exn_raised, rc; struct { u16 back_link,__blh; u32 esp0; @@ -1099,7 +1101,7 @@ void hvm_task_switch( u32 cr3, eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi; u16 es, _3, cs, _4, ss, _5, ds, _6, fs, _7, gs, _8, ldt, _9; u16 trace, iomap; - } *ptss, tss; + } tss = { 0 }; hvm_get_segment_register(v, x86_seg_gdtr, &gdt); hvm_get_segment_register(v, x86_seg_tr, &prev_tr); @@ -1112,11 +1114,11 @@ void hvm_task_switch( goto out; } - optss_desc = hvm_map(gdt.base + (prev_tr.sel & 0xfff8), 8); + optss_desc = hvm_map_entry(gdt.base + (prev_tr.sel & 0xfff8)); if ( optss_desc == NULL ) goto out; - nptss_desc = hvm_map(gdt.base + (tss_sel & 0xfff8), 8); + nptss_desc = hvm_map_entry(gdt.base + (tss_sel & 0xfff8)); if ( nptss_desc == NULL ) goto out; @@ -1151,84 +1153,85 @@ void hvm_task_switch( goto out; } - ptss = hvm_map(prev_tr.base, sizeof(tss)); - if ( ptss == NULL ) + rc = hvm_copy_from_guest_virt(&tss, prev_tr.base, sizeof(tss)); + if ( rc == HVMCOPY_bad_gva_to_gfn ) goto out; eflags = regs->eflags; if ( taskswitch_reason == TSW_iret ) eflags &= ~X86_EFLAGS_NT; - ptss->cr3 = v->arch.hvm_vcpu.guest_cr[3]; - ptss->eip = regs->eip; - ptss->eflags = eflags; - ptss->eax = regs->eax; - ptss->ecx = regs->ecx; - ptss->edx = regs->edx; - ptss->ebx = regs->ebx; - ptss->esp = regs->esp; - ptss->ebp = regs->ebp; - ptss->esi = regs->esi; - ptss->edi = regs->edi; + tss.cr3 = v->arch.hvm_vcpu.guest_cr[3]; + tss.eip = regs->eip; + tss.eflags = eflags; + tss.eax = regs->eax; + tss.ecx = regs->ecx; + tss.edx = regs->edx; + tss.ebx = regs->ebx; + tss.esp = regs->esp; + tss.ebp = regs->ebp; + tss.esi = regs->esi; + tss.edi = regs->edi; hvm_get_segment_register(v, x86_seg_es, &segr); - ptss->es = segr.sel; + tss.es = segr.sel; hvm_get_segment_register(v, x86_seg_cs, &segr); - ptss->cs = segr.sel; + tss.cs = segr.sel; hvm_get_segment_register(v, x86_seg_ss, &segr); - ptss->ss = segr.sel; + tss.ss = segr.sel; hvm_get_segment_register(v, x86_seg_ds, &segr); - ptss->ds = segr.sel; + tss.ds = segr.sel; hvm_get_segment_register(v, x86_seg_fs, &segr); - ptss->fs = segr.sel; + tss.fs = segr.sel; hvm_get_segment_register(v, x86_seg_gs, &segr); - ptss->gs = segr.sel; + tss.gs = segr.sel; hvm_get_segment_register(v, x86_seg_ldtr, &segr); - ptss->ldt = segr.sel; - - hvm_unmap(ptss); - - ptss = hvm_map(tr.base, sizeof(tss)); - if ( ptss == NULL ) + tss.ldt = segr.sel; + + rc = hvm_copy_to_guest_virt(prev_tr.base, &tss, sizeof(tss)); + if ( rc == HVMCOPY_bad_gva_to_gfn ) goto out; - if ( !hvm_set_cr3(ptss->cr3) ) - { - hvm_unmap(ptss); + rc = hvm_copy_from_guest_virt(&tss, tr.base, sizeof(tss)); + if ( rc == HVMCOPY_bad_gva_to_gfn ) goto out; - } - - regs->eip = ptss->eip; - regs->eflags = ptss->eflags | 2; - regs->eax = ptss->eax; - regs->ecx = ptss->ecx; - regs->edx = ptss->edx; - regs->ebx = ptss->ebx; - regs->esp = ptss->esp; - regs->ebp = ptss->ebp; - regs->esi = ptss->esi; - regs->edi = ptss->edi; + + if ( !hvm_set_cr3(tss.cr3) ) + goto out; + + regs->eip = tss.eip; + regs->eflags = tss.eflags | 2; + regs->eax = tss.eax; + regs->ecx = tss.ecx; + regs->edx = tss.edx; + regs->ebx = tss.ebx; + regs->esp = tss.esp; + regs->ebp = tss.ebp; + regs->esi = tss.esi; + regs->edi = tss.edi; if ( (taskswitch_reason == TSW_call_or_int) ) { regs->eflags |= X86_EFLAGS_NT; - ptss->back_link = prev_tr.sel; + tss.back_link = prev_tr.sel; } exn_raised = 0; - if ( hvm_load_segment_selector(v, x86_seg_es, ptss->es) || - hvm_load_segment_selector(v, x86_seg_cs, ptss->cs) || - hvm_load_segment_selector(v, x86_seg_ss, ptss->ss) || - hvm_load_segment_selector(v, x86_seg_ds, ptss->ds) || - hvm_load_segment_selector(v, x86_seg_fs, ptss->fs) || - hvm_load_segment_selector(v, x86_seg_gs, ptss->gs) || - hvm_load_segment_selector(v, x86_seg_ldtr, ptss->ldt) ) + if ( hvm_load_segment_selector(v, x86_seg_es, tss.es) || + hvm_load_segment_selector(v, x86_seg_cs, tss.cs) || + hvm_load_segment_selector(v, x86_seg_ss, tss.ss) || + hvm_load_segment_selector(v, x86_seg_ds, tss.ds) || + hvm_load_segment_selector(v, x86_seg_fs, tss.fs) || + hvm_load_segment_selector(v, x86_seg_gs, tss.gs) || + hvm_load_segment_selector(v, x86_seg_ldtr, tss.ldt) ) exn_raised = 1; - if ( (ptss->trace & 1) && !exn_raised ) + rc = hvm_copy_to_guest_virt(tr.base, &tss, sizeof(tss)); + if ( rc == HVMCOPY_bad_gva_to_gfn ) + exn_raised = 1; + + if ( (tss.trace & 1) && !exn_raised ) hvm_inject_exception(TRAP_debug, tss_sel & 0xfff8, 0); - - hvm_unmap(ptss); tr.attr.fields.type = 0xb; /* busy 32-bit tss */ hvm_set_segment_register(v, x86_seg_tr, &tr); @@ -1257,8 +1260,8 @@ void hvm_task_switch( } out: - hvm_unmap(optss_desc); - hvm_unmap(nptss_desc); + hvm_unmap_entry(optss_desc); + hvm_unmap_entry(nptss_desc); } /* _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:23:04 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:23:04 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABr-00048o-Oc for www-data@colo.xensource.com; Fri, 30 May 2008 12:23:04 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACa-0003JY-1F; Fri, 30 May 2008 19:23:48 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2AC9-0002tz-9B for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:21 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2AC1-0004zz-UI for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:19 +0000 X-SBRS: 3.6 X-MesageID: 359598 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359598" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:29:51 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UITpxM030289 for ; Fri, 30 May 2008 11:29:51 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UIU9x8022223 for ; Fri, 30 May 2008 11:30:09 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UIU9dM022222 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:30:09 -0700 Message-Id: <200805301830.m4UIU9dM022222@xenbits.xensource.com> Date: Fri, 30 May 2008 11:30:08 -0700 From: Xen patchbot-unstable To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [xen-unstable] x86: i8254 device model is shared between PV and HVM guests, so must X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212172278 -3600 # Node ID 6e688d5a936bb22c7938c38cb26c8592544e97eb # Parent 487dc63f95ff433eabb132253c5ff31cc178c00a x86: i8254 device model is shared between PV and HVM guests, so must take care not to run hvm_get_guest_time() on a PV VCPU. The spinlock is not initialised and spin_lock() can thus spin forever. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/i8254.c | 15 +++++++++------ xen/arch/x86/hvm/vpt.c | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) diff -r 487dc63f95ff -r 6e688d5a936b xen/arch/x86/hvm/i8254.c --- a/xen/arch/x86/hvm/i8254.c Fri May 30 16:44:13 2008 +0100 +++ b/xen/arch/x86/hvm/i8254.c Fri May 30 19:31:18 2008 +0100 @@ -54,6 +54,9 @@ static int handle_speaker_io( static int handle_speaker_io( int dir, uint32_t port, uint32_t bytes, uint32_t *val); +#define get_guest_time(v) \ + (is_hvm_vcpu(v) ? hvm_get_guest_time(v) : (u64)get_s_time()) + /* Compute with 96 bit intermediate result: (a*b)/c */ static uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) { @@ -87,7 +90,7 @@ static int pit_get_count(PITState *pit, ASSERT(spin_is_locked(&pit->lock)); - d = muldiv64(hvm_get_guest_time(v) - pit->count_load_time[channel], + d = muldiv64(get_guest_time(v) - pit->count_load_time[channel], PIT_FREQ, SYSTEM_TIME_HZ); switch ( c->mode ) @@ -118,7 +121,7 @@ static int pit_get_out(PITState *pit, in ASSERT(spin_is_locked(&pit->lock)); - d = muldiv64(hvm_get_guest_time(v) - pit->count_load_time[channel], + d = muldiv64(get_guest_time(v) - pit->count_load_time[channel], PIT_FREQ, SYSTEM_TIME_HZ); switch ( s->mode ) @@ -165,7 +168,7 @@ static void pit_set_gate(PITState *pit, case 3: /* Restart counting on rising edge. */ if ( s->gate < val ) - pit->count_load_time[channel] = hvm_get_guest_time(v); + pit->count_load_time[channel] = get_guest_time(v); break; } @@ -181,7 +184,7 @@ static void pit_time_fired(struct vcpu * static void pit_time_fired(struct vcpu *v, void *priv) { uint64_t *count_load_time = priv; - *count_load_time = hvm_get_guest_time(v); + *count_load_time = get_guest_time(v); } static void pit_load_count(PITState *pit, int channel, int val) @@ -198,7 +201,7 @@ static void pit_load_count(PITState *pit if ( v == NULL ) pit->count_load_time[channel] = 0; else - pit->count_load_time[channel] = hvm_get_guest_time(v); + pit->count_load_time[channel] = get_guest_time(v); s->count = val; period = DIV_ROUND(val * SYSTEM_TIME_HZ, PIT_FREQ); @@ -436,7 +439,7 @@ static int pit_load(struct domain *d, hv * time jitter here, but the wall-clock will have jumped massively, so * we hope the guest can handle it. */ - pit->pt0.last_plt_gtime = hvm_get_guest_time(d->vcpu[0]); + pit->pt0.last_plt_gtime = get_guest_time(d->vcpu[0]); for ( i = 0; i < 3; i++ ) pit_load_count(pit, i, pit->hw.channels[i].count); diff -r 487dc63f95ff -r 6e688d5a936b xen/arch/x86/hvm/vpt.c --- a/xen/arch/x86/hvm/vpt.c Fri May 30 16:44:13 2008 +0100 +++ b/xen/arch/x86/hvm/vpt.c Fri May 30 19:31:18 2008 +0100 @@ -39,6 +39,9 @@ u64 hvm_get_guest_time(struct vcpu *v) struct pl_time *pl = &v->domain->arch.hvm_domain.pl_time; u64 now; + /* Called from device models shared with PV guests. Be careful. */ + ASSERT(is_hvm_vcpu(v)); + spin_lock(&pl->pl_time_lock); now = get_s_time() + pl->stime_offset; if ( (int64_t)(now - pl->last_guest_time) >= 0 ) _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From xen-changelog-bounces@lists.xensource.com Fri May 30 12:23:07 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Fri, 30 May 2008 12:23:07 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2ABv-00049O-K3 for www-data@colo.xensource.com; Fri, 30 May 2008 12:23:07 -0700 Received: from localhost ([127.0.0.1] helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACd-0003N7-TV; Fri, 30 May 2008 19:23:51 +0000 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2ACA-0002v1-9X for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:22 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by lists.xensource.com with esmtp (Exim 4.50) id 1K2AC3-0004zs-Hr for xen-changelog@lists.xensource.com; Fri, 30 May 2008 19:23:20 +0000 X-SBRS: 3.6 X-MesageID: 359599 X-Ironport-Server: ftlpip01.citrite.net X-Remote-IP: 70.42.241.98 X-Policy: $Relay X-IronPort-AV: E=Sophos;i="4.27,568,1204520400"; d="scan'208";a="359599" Received: from relay.colo.xensource.com ([70.42.241.98]) by SMTP.CITRIX.COM with ESMTP; 30 May 2008 14:29:53 -0400 Received: from xenbits.xensource.com (xenbits.colo.xensource.com [70.42.241.107]) by relay.colo.xensource.com (8.13.1/8.13.1) with ESMTP id m4UITqfx030292 for ; Fri, 30 May 2008 11:29:52 -0700 Received: from xenbits.xensource.com (localhost.localdomain [127.0.0.1]) by xenbits.xensource.com (8.13.1/8.13.1) with ESMTP id m4UIUBA3022286 for ; Fri, 30 May 2008 11:30:11 -0700 Received: (from xen@localhost) by xenbits.xensource.com (8.13.1/8.13.1/Submit) id m4UIUBIQ022285 for xen-changelog@lists.xensource.com; Fri, 30 May 2008 11:30:11 -0700 Message-Id: <200805301830.m4UIUBIQ022285@xenbits.xensource.com> Date: Fri, 30 May 2008 11:30:10 -0700 From: "Xen patchbot-linux-2.6.18-xen" To: xen-changelog@lists.xensource.com X-SA-Exim-Connect-IP: 66.165.176.89 X-SA-Exim-Mail-From: xen@xensource.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Subject: [Xen-changelog] [linux-2.6.18-xen] xen: Set blocking timeout to 1/2 jiffy later than we want. This avoids X-BeenThere: xen-changelog@lists.xensource.com X-Mailman-Version: 2.1.5 Precedence: list Reply-To: xen-devel@lists.xensource.com List-Id: BK change log List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-changelog-bounces@lists.xensource.com Errors-To: xen-changelog-bounces@lists.xensource.com # HG changeset patch # User Keir Fraser # Date 1212170930 -3600 # Node ID 557a4a0a5eacb83ffb2808c66fd9674e8e26f3e0 # Parent 936f6dd9d49c71c95931c9d8bdf4393cdb9fb42f xen: Set blocking timeout to 1/2 jiffy later than we want. This avoids repeated early wakeup just before the jiffy tick, causing us to effectively spin rather than sleep. Signed-off-by: Keir Fraser --- arch/i386/kernel/time-xen.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -r 936f6dd9d49c -r 557a4a0a5eac arch/i386/kernel/time-xen.c --- a/arch/i386/kernel/time-xen.c Tue May 27 10:33:54 2008 +0100 +++ b/arch/i386/kernel/time-xen.c Fri May 30 19:08:50 2008 +0100 @@ -1013,7 +1013,7 @@ static void stop_hz_timer(void) j = jiffies + 1; } - singleshot.timeout_abs_ns = jiffies_to_st(j); + singleshot.timeout_abs_ns = jiffies_to_st(j) + NS_PER_TICK/2; singleshot.flags = 0; rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot); #if CONFIG_XEN_COMPAT <= 0x030004 _______________________________________________ Xen-changelog mailing list Xen-changelog@lists.xensource.com http://lists.xensource.com/xen-changelog From r_vonnierc@ieconomy.com Sat May 31 12:16:14 2008 Return-path: Envelope-to: www-data@colo.xensource.com Delivery-date: Sat, 31 May 2008 12:16:14 -0700 Received: from vm04-bcn-london.deploy.xenoserver.org ([217.147.82.229] helo=lists.xensource.com) by lists.xensource.com with esmtp (Exim 4.43) id 1K2WYn-0006WC-UD for www-data@colo.xensource.com; Sat, 31 May 2008 12:16:14 -0700 Received: from [192.168.0.10] (helo=lists.xensource.com) by host-192-168-0-1-bcn-london with esmtp (Exim 4.50) id 1K2WZU-0002cI-Ma; Sat, 31 May 2008 19:16:56 +0000 Received: from [189.61.78.75] (helo=qusznugb) by lists.xensource.com with esmtp (Exim 4.50) id 1K2WZO-00008S-RM; Sat, 31 May 2008 19:16:54 +0000 Date: Sat, 31 May 2008 12:14:33 -0700 In-Reply-To: From: "Robbie Vonnie" X-Sender: Sender: To: Bcc: , , , , , , , Message-ID: <1212261273.3618@ieconomy.com> Reply-To: "Robbie Vonnie" Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 189.61.78.75 X-SA-Exim-Mail-From: r_vonnierc@ieconomy.com X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on (none) X-Spam-Level: *** X-Spam-Status: No, score=3.9 required=5.0 tests=BAYES_50,RCVD_IN_XBL autolearn=no version=3.1.0 Subject: No test, No class, buy yourself Bacheelor/MasteerMBA/Doctoraate dip1omas, VALID in all countries whvm 1ji X-SA-Exim-Version: 4.2.1 (built Mon, 27 Mar 2006 13:42:28 +0200) X-SA-Exim-Scanned: Yes (on lists.xensource.com) Bacheelor, MasteerMBA, and Doctoraate diplomas available in the field of your choice that's right, you can even become a Doctor and receive all the benefits that comes with it! Our Diplomas/Certificates are recognised in most countries No required examination, tests, classes, books, or interviews. ** No one is turned down ** Confidentiality assured CALL US 24 HOURS A DAY, 7 DAYS A WEEK For US: 1-718-989-5740 Outside US: +1-718-989-5740 "Just leave your NAME & PHONE NO. (with CountryCode)" in the voicemail our staff will get back to you in next few days