SHA256
1
0
forked from pool/xen
OBS User unknown 2007-03-06 08:12:51 +00:00 committed by Git OBS Bridge
parent 39a4f201bc
commit 759005f5a4
19 changed files with 1934 additions and 181 deletions

51
13574-win2k-mouse.patch Normal file
View File

@ -0,0 +1,51 @@
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1169635472 0
# Node ID b064775fba7d838c99bcf11ca4fec6127e0e8792
# Parent c9ac0bace498d1c25f07df95b88d8f8e89168514
[QEMU] Clear TD status field explicitly when it's fetched.
In current Qemu-dm, UHC will set some status bits of TD in status
updating stage, but never process the status bit if relevant condition
does not occur, leaving it as it is. When a TD is fetched with some
status bits are set to 1, it will return to Guest OS with these bits
set to 1 even this TD is executed successfully. Some Windows OS,
e.g. Windows 2000, will check status bits of TD in UHC interrupt
routine, treat it as a unsuccessful one if some status bits are set to
1 and discard the data. Other Windows OS just check USBSTS of UHC,
ignoring status field of TD unless the value of USBSTS indicates
occurrence of error.
With this patch, USB mouse/tablet in Windows 2000 works correctly.
Signed-off-by: Xinmei Huang <xinmei.huang@intel.com>
Index: xen-3.0.4-testing/tools/ioemu/hw/usb-uhci.c
===================================================================
--- xen-3.0.4-testing.orig/tools/ioemu/hw/usb-uhci.c
+++ xen-3.0.4-testing/tools/ioemu/hw/usb-uhci.c
@@ -43,9 +43,15 @@
#define TD_CTRL_IOC (1 << 24)
#define TD_CTRL_ACTIVE (1 << 23)
#define TD_CTRL_STALL (1 << 22)
+#define TD_CTRL_BUFFER (1 << 21)
#define TD_CTRL_BABBLE (1 << 20)
#define TD_CTRL_NAK (1 << 19)
#define TD_CTRL_TIMEOUT (1 << 18)
+#define TD_CTRL_BITSTUFF \
+ (1 << 17)
+#define TD_CTRL_MASK \
+ (TD_CTRL_BITSTUFF | TD_CTRL_TIMEOUT | TD_CTRL_NAK \
+ | TD_CTRL_BABBLE | TD_CTRL_BUFFER | TD_CTRL_STALL)
#define UHCI_PORT_RESET (1 << 9)
#define UHCI_PORT_LSDA (1 << 8)
@@ -428,6 +434,8 @@ static int uhci_handle_td(UHCIState *s,
ret = 1;
goto out;
}
+ /* Clear TD's status field explicitly */
+ td->ctrl = td->ctrl & (~TD_CTRL_MASK);
/* TD is active */
max_len = ((td->token >> 21) + 1) & 0x7ff;

42
13786_xenapi.patch Normal file
View File

@ -0,0 +1,42 @@
# HG changeset patch
# User Ewan Mellor <ewan@xensource.com>
# Date 1170356417 0
# Node ID a357bed2daf8096bb5c682d454a2b3af652fc73f
# Parent 23bf61e72279682f46342d8c01977bed63ceb5be
Make the string->string map and int->float map allocation functions set the
map size on allocation.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
diff -r 23bf61e72279 -r a357bed2daf8 tools/libxen/src/xen_int_float_map.c
--- a/tools/libxen/src/xen_int_float_map.c Thu Feb 01 18:45:50 2007 +0000
+++ b/tools/libxen/src/xen_int_float_map.c Thu Feb 01 19:00:17 2007 +0000
@@ -25,8 +25,10 @@ xen_int_float_map *
xen_int_float_map *
xen_int_float_map_alloc(size_t size)
{
- return calloc(1, sizeof(xen_int_float_map) +
- size * sizeof(struct xen_int_float_map_contents));
+ xen_int_float_map *result = calloc(1, sizeof(xen_int_float_map) +
+ size * sizeof(struct xen_int_float_map_contents));
+ result->size = size;
+ return result;
}
diff -r 23bf61e72279 -r a357bed2daf8 tools/libxen/src/xen_string_string_map.c
--- a/tools/libxen/src/xen_string_string_map.c Thu Feb 01 18:45:50 2007 +0000
+++ b/tools/libxen/src/xen_string_string_map.c Thu Feb 01 19:00:17 2007 +0000
@@ -25,8 +25,10 @@ xen_string_string_map *
xen_string_string_map *
xen_string_string_map_alloc(size_t size)
{
- return calloc(1, sizeof(xen_string_string_map) +
- size * sizeof(struct xen_string_string_map_contents));
+ xen_string_string_map *result = calloc(1, sizeof(xen_string_string_map) +
+ size * sizeof(struct xen_string_string_map_contents));
+ result->size = size;
+ return result;
}

326
14022_xenapi.patch Normal file
View File

@ -0,0 +1,326 @@
# HG changeset patch
# User Ewan Mellor <ewan@xensource.com>
# Date 1172000304 0
# Node ID 988b90c6b4f3b628430a73b5562e65c859953173
# Parent be35eed950da0f39d3d41f738f340707e01c4cbd
Added Console.other_config to the docs (Xend already has this).
Signed-off-by: Ewan Mellor <ewan@xensource.com>
diff -r be35eed950da -r 988b90c6b4f3 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Tue Feb 20 19:23:28 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Tue Feb 20 19:38:24 2007 +0000
@@ -10887,6 +10887,7 @@ Quals & Field & Type & Description \\
$\mathit{RO}_\mathit{run}$ & {\tt protocol} & console\_protocol & the protocol used by this console \\
$\mathit{RO}_\mathit{run}$ & {\tt location} & string & URI for the console service \\
$\mathit{RO}_\mathit{run}$ & {\tt VM} & VM ref & VM to which this console is attached \\
+$\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
\hline
\end{longtable}
\subsection{Additional RPCs associated with class: console}
@@ -11015,6 +11016,145 @@ VM ref
value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_other\_config}
+
+{\bf Overview:}
+Get the other\_config field of the given console.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, console 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 console ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_other\_config}
+
+{\bf Overview:}
+Set the other\_config field of the given console.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_other_config (session_id s, console ref self, (string -> string) Map value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt console ref } & self & reference to the object \\ \hline
+
+{\tt (string $\rightarrow$ string) Map } & 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:~add\_to\_other\_config}
+
+{\bf Overview:}
+Add the given key-value pair to the other\_config field of the given
+console.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void add_to_other_config (session_id s, console ref self, string key, 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 console ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to add \\ \hline
+
+{\tt string } & value & Value to add \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_other\_config}
+
+{\bf Overview:}
+Remove the given key and its corresponding value from the other\_config
+field of the given console. If the key is not in that Map, then do
+nothing.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void remove_from_other_config (session_id s, console ref self, string key)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt console ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to remove \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
diff -r be35eed950da -r 988b90c6b4f3 tools/libxen/include/xen_console.h
--- a/tools/libxen/include/xen_console.h Tue Feb 20 19:23:28 2007 +0000
+++ b/tools/libxen/include/xen_console.h Tue Feb 20 19:38:24 2007 +0000
@@ -22,6 +22,7 @@
#include "xen_common.h"
#include "xen_console_decl.h"
#include "xen_console_protocol.h"
+#include "xen_string_string_map.h"
#include "xen_vm_decl.h"
@@ -67,6 +68,7 @@ typedef struct xen_console_record
enum xen_console_protocol protocol;
char *location;
struct xen_vm_record_opt *vm;
+ xen_string_string_map *other_config;
} xen_console_record;
/**
@@ -204,4 +206,35 @@ xen_console_get_vm(xen_session *session,
xen_console_get_vm(xen_session *session, xen_vm *result, xen_console console);
+/**
+ * Get the other_config field of the given console.
+ */
+extern bool
+xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console);
+
+
+/**
+ * Set the other_config field of the given console.
+ */
+extern bool
+xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * console.
+ */
+extern bool
+xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given console. If the key is not in that Map,
+ * then do nothing.
+ */
+extern bool
+xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key);
+
+
#endif
diff -r be35eed950da -r 988b90c6b4f3 tools/libxen/src/xen_console.c
--- a/tools/libxen/src/xen_console.c Tue Feb 20 19:23:28 2007 +0000
+++ b/tools/libxen/src/xen_console.c Tue Feb 20 19:38:24 2007 +0000
@@ -24,6 +24,7 @@
#include "xen_console.h"
#include "xen_console_protocol_internal.h"
#include "xen_internal.h"
+#include "xen_string_string_map.h"
#include "xen_vm.h"
@@ -49,7 +50,10 @@ static const struct_member xen_console_r
.offset = offsetof(xen_console_record, location) },
{ .key = "VM",
.type = &abstract_type_ref,
- .offset = offsetof(xen_console_record, vm) }
+ .offset = offsetof(xen_console_record, vm) },
+ { .key = "other_config",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_console_record, other_config) }
};
const abstract_type xen_console_record_abstract_type_ =
@@ -73,6 +77,7 @@ xen_console_record_free(xen_console_reco
free(record->uuid);
free(record->location);
xen_vm_record_opt_free(record->vm);
+ xen_string_string_map_free(record->other_config);
free(record);
}
@@ -198,6 +203,73 @@ xen_console_get_vm(xen_session *session,
bool
+xen_console_get_other_config(xen_session *session, xen_string_string_map **result, xen_console console)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = console }
+ };
+
+ abstract_type result_type = abstract_type_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("console.get_other_config");
+ return session->ok;
+}
+
+
+bool
+xen_console_set_other_config(xen_session *session, xen_console console, xen_string_string_map *other_config)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = console },
+ { .type = &abstract_type_string_string_map,
+ .u.set_val = (arbitrary_set *)other_config }
+ };
+
+ xen_call_(session, "console.set_other_config", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_console_add_to_other_config(xen_session *session, xen_console console, char *key, char *value)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = console },
+ { .type = &abstract_type_string,
+ .u.string_val = key },
+ { .type = &abstract_type_string,
+ .u.string_val = value }
+ };
+
+ xen_call_(session, "console.add_to_other_config", param_values, 3, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_console_remove_from_other_config(xen_session *session, xen_console console, char *key)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = console },
+ { .type = &abstract_type_string,
+ .u.string_val = key }
+ };
+
+ xen_call_(session, "console.remove_from_other_config", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
xen_console_get_uuid(xen_session *session, char **result, xen_console console)
{
*result = session->ok ? xen_strdup_((char *)console) : NULL;

793
32on64-migrate.patch Normal file
View File

@ -0,0 +1,793 @@
# HG changeset 13995 patch
# User Emmanuel Ackaouy <ack@xensource.com>
# Node ID 9c2e6f8f3aa7a4e2a1f3af3204789568edf975cd
# Parent 0b882c911b885a51308eee3ec80bc4a5a230d7ce
[XEN] 32on64 shadowing / live migration support for PV PAE compat guests
PAE compat guests on 64bit hypervisors are shadowed
using 4-on-4 with special handling for the top level
L4 page and the L2E M2P mappings.
Signed-off-by: Emmanuel Ackaouy <ack@xensource.com>
Index: 2007-02-20/xen/arch/x86/mm.c
===================================================================
--- 2007-02-20.orig/xen/arch/x86/mm.c 2007-02-20 11:01:49.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm.c 2007-02-20 11:01:50.000000000 +0100
@@ -1095,7 +1095,7 @@ static int alloc_l4_table(struct page_in
for ( i = 0; i < L4_PAGETABLE_ENTRIES; i++ )
{
- if ( is_guest_l4_slot(i) &&
+ if ( is_guest_l4_slot(d, i) &&
unlikely(!get_page_from_l4e(pl4e[i], pfn, d)) )
goto fail;
@@ -1123,7 +1123,7 @@ static int alloc_l4_table(struct page_in
fail:
MEM_LOG("Failure in alloc_l4_table: entry %d", i);
while ( i-- > 0 )
- if ( is_guest_l4_slot(i) )
+ if ( is_guest_l4_slot(d, i) )
put_page_from_l4e(pl4e[i], pfn);
return 0;
@@ -1198,12 +1198,13 @@ static void free_l3_table(struct page_in
static void free_l4_table(struct page_info *page)
{
+ struct domain *d = page_get_owner(page);
unsigned long pfn = page_to_mfn(page);
l4_pgentry_t *pl4e = page_to_virt(page);
int i;
for ( i = 0; i < L4_PAGETABLE_ENTRIES; i++ )
- if ( is_guest_l4_slot(i) )
+ if ( is_guest_l4_slot(d, i) )
put_page_from_l4e(pl4e[i], pfn);
}
@@ -1463,13 +1464,14 @@ static int mod_l3_entry(l3_pgentry_t *pl
#if CONFIG_PAGING_LEVELS >= 4
/* Update the L4 entry at pl4e to new value nl4e. pl4e is within frame pfn. */
-static int mod_l4_entry(l4_pgentry_t *pl4e,
+static int mod_l4_entry(struct domain *d,
+ l4_pgentry_t *pl4e,
l4_pgentry_t nl4e,
unsigned long pfn)
{
l4_pgentry_t ol4e;
- if ( unlikely(!is_guest_l4_slot(pgentry_ptr_to_slot(pl4e))) )
+ if ( unlikely(!is_guest_l4_slot(d, pgentry_ptr_to_slot(pl4e))) )
{
MEM_LOG("Illegal L4 update attempt in Xen-private area %p", pl4e);
return 0;
@@ -1771,8 +1773,10 @@ int new_guest_cr3(unsigned long mfn)
put_page(mfn_to_page(old_base_mfn));
}
else
- okay = mod_l4_entry(__va(pagetable_get_paddr(v->arch.guest_table)),
- l4e, 0);
+ okay = mod_l4_entry(d,
+ __va(pagetable_get_paddr(v->arch.guest_table)),
+ l4e,
+ pagetable_get_pfn(v->arch.guest_table));
if ( unlikely(!okay) )
{
MEM_LOG("Error while installing new compat baseptr %lx", mfn);
@@ -2360,7 +2364,7 @@ int do_mmu_update(
if ( !IS_COMPAT(FOREIGNDOM) )
{
l4_pgentry_t l4e = l4e_from_intpte(req.val);
- okay = mod_l4_entry(va, l4e, mfn);
+ okay = mod_l4_entry(d, va, l4e, mfn);
}
break;
#endif
Index: 2007-02-20/xen/arch/x86/mm/shadow/common.c
===================================================================
--- 2007-02-20.orig/xen/arch/x86/mm/shadow/common.c 2007-02-20 11:01:43.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm/shadow/common.c 2007-02-20 11:02:03.000000000 +0100
@@ -472,7 +472,11 @@ void shadow_demote(struct vcpu *v, mfn_t
{
struct page_info *page = mfn_to_page(gmfn);
- ASSERT(test_bit(_PGC_page_table, &page->count_info));
+#ifdef CONFIG_COMPAT
+ if ( !IS_COMPAT(v->domain) || type != SH_type_l4_64_shadow )
+#endif
+ ASSERT(test_bit(_PGC_page_table, &page->count_info));
+
ASSERT(test_bit(type, &page->shadow_flags));
clear_bit(type, &page->shadow_flags);
@@ -555,6 +559,9 @@ __shadow_validate_guest_entry(struct vcp
if ( page->shadow_flags & SHF_L2_64 )
result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2e, 4, 4)
(v, gmfn, entry, size);
+ if ( page->shadow_flags & SHF_L2H_64 )
+ result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl2he, 4, 4)
+ (v, gmfn, entry, size);
if ( page->shadow_flags & SHF_L3_64 )
result |= SHADOW_INTERNAL_NAME(sh_map_and_validate_gl3e, 4, 4)
(v, gmfn, entry, size);
@@ -563,7 +570,7 @@ __shadow_validate_guest_entry(struct vcp
(v, gmfn, entry, size);
#else /* 32-bit/PAE hypervisor does not support 64-bit guests */
ASSERT((page->shadow_flags
- & (SHF_L4_64|SHF_L3_64|SHF_L2_64|SHF_L1_64)) == 0);
+ & (SHF_L4_64|SHF_L3_64|SHF_L2H_64|SHF_L2_64|SHF_L1_64)) == 0);
#endif
return result;
@@ -674,7 +681,7 @@ static inline u32
shadow_order(unsigned int shadow_type)
{
#if CONFIG_PAGING_LEVELS > 2
- static const u32 type_to_order[16] = {
+ static const u32 type_to_order[SH_type_unused] = {
0, /* SH_type_none */
1, /* SH_type_l1_32_shadow */
1, /* SH_type_fl1_32_shadow */
@@ -686,12 +693,13 @@ shadow_order(unsigned int shadow_type)
0, /* SH_type_l1_64_shadow */
0, /* SH_type_fl1_64_shadow */
0, /* SH_type_l2_64_shadow */
+ 0, /* SH_type_l2h_64_shadow */
0, /* SH_type_l3_64_shadow */
0, /* SH_type_l4_64_shadow */
2, /* SH_type_p2m_table */
0 /* SH_type_monitor_table */
};
- ASSERT(shadow_type < 16);
+ 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;
@@ -1849,6 +1857,9 @@ void sh_destroy_shadow(struct vcpu *v, m
t == SH_type_fl1_pae_shadow ||
t == SH_type_fl1_64_shadow ||
t == SH_type_monitor_table ||
+#ifdef CONFIG_COMPAT
+ (IS_COMPAT(v->domain) && t == SH_type_l4_64_shadow) ||
+#endif
(page_get_owner(mfn_to_page(_mfn(sp->backpointer)))
== v->domain));
@@ -1890,6 +1901,8 @@ void sh_destroy_shadow(struct vcpu *v, m
case SH_type_fl1_64_shadow:
SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 4, 4)(v, smfn);
break;
+ case SH_type_l2h_64_shadow:
+ ASSERT( IS_COMPAT(v->domain) );
case SH_type_l2_64_shadow:
SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 4, 4)(v, smfn);
break;
@@ -1918,7 +1931,7 @@ int shadow_remove_write_access(struct vc
unsigned long fault_addr)
{
/* Dispatch table for getting per-type functions */
- static hash_callback_t callbacks[16] = {
+ static hash_callback_t callbacks[SH_type_unused] = {
NULL, /* none */
#if CONFIG_PAGING_LEVELS == 2
SHADOW_INTERNAL_NAME(sh_remove_write_access,2,2), /* l1_32 */
@@ -1945,6 +1958,7 @@ int shadow_remove_write_access(struct vc
NULL, /* fl1_64 */
#endif
NULL, /* l2_64 */
+ NULL, /* l2h_64 */
NULL, /* l3_64 */
NULL, /* l4_64 */
NULL, /* p2m */
@@ -2107,7 +2121,7 @@ int shadow_remove_all_mappings(struct vc
int expected_count;
/* Dispatch table for getting per-type functions */
- static hash_callback_t callbacks[16] = {
+ static hash_callback_t callbacks[SH_type_unused] = {
NULL, /* none */
#if CONFIG_PAGING_LEVELS == 2
SHADOW_INTERNAL_NAME(sh_remove_all_mappings,2,2), /* l1_32 */
@@ -2134,6 +2148,7 @@ int shadow_remove_all_mappings(struct vc
NULL, /* fl1_64 */
#endif
NULL, /* l2_64 */
+ NULL, /* l2h_64 */
NULL, /* l3_64 */
NULL, /* l4_64 */
NULL, /* p2m */
@@ -2233,6 +2248,7 @@ static int sh_remove_shadow_via_pointer(
#if CONFIG_PAGING_LEVELS >= 4
case SH_type_l1_64_shadow:
case SH_type_l2_64_shadow:
+ 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);
@@ -2267,7 +2283,7 @@ void sh_remove_shadows(struct vcpu *v, m
/* Dispatch table for getting per-type functions: each level must
* be called with the function to remove a lower-level shadow. */
- static hash_callback_t callbacks[16] = {
+ static hash_callback_t callbacks[SH_type_unused] = {
NULL, /* none */
NULL, /* l1_32 */
NULL, /* fl1_32 */
@@ -2289,10 +2305,12 @@ void sh_remove_shadows(struct vcpu *v, m
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 */
#else
NULL, /* l2_64 */
+ NULL, /* l2h_64 */
NULL, /* l3_64 */
NULL, /* l4_64 */
#endif
@@ -2301,7 +2319,7 @@ void sh_remove_shadows(struct vcpu *v, m
};
/* Another lookup table, for choosing which mask to use */
- static unsigned int masks[16] = {
+ static unsigned int masks[SH_type_unused] = {
0, /* none */
1 << SH_type_l2_32_shadow, /* l1_32 */
0, /* fl1_32 */
@@ -2311,9 +2329,11 @@ void sh_remove_shadows(struct vcpu *v, m
0, /* fl1_pae */
0, /* l2_pae */
0, /* l2h_pae */
- 1 << SH_type_l2_64_shadow, /* l1_64 */
+ ((1 << SH_type_l2h_64_shadow)
+ | (1 << SH_type_l2_64_shadow)), /* l1_64 */
0, /* fl1_64 */
1 << SH_type_l3_64_shadow, /* l2_64 */
+ 1 << SH_type_l3_64_shadow, /* l2h_64 */
1 << SH_type_l4_64_shadow, /* l3_64 */
0, /* l4_64 */
0, /* p2m */
@@ -2360,6 +2380,7 @@ void sh_remove_shadows(struct vcpu *v, m
#if CONFIG_PAGING_LEVELS >= 4
if ( sh_flags & SHF_L1_64 ) DO_UNSHADOW(SH_type_l1_64_shadow);
if ( sh_flags & SHF_L2_64 ) DO_UNSHADOW(SH_type_l2_64_shadow);
+ if ( sh_flags & SHF_L2H_64 ) DO_UNSHADOW(SH_type_l2h_64_shadow);
if ( sh_flags & SHF_L3_64 ) DO_UNSHADOW(SH_type_l3_64_shadow);
if ( sh_flags & SHF_L4_64 ) DO_UNSHADOW(SH_type_l4_64_shadow);
#endif
@@ -2426,10 +2447,7 @@ void sh_update_paging_modes(struct vcpu
/// PV guest
///
#if CONFIG_PAGING_LEVELS == 4
- if ( pv_32bit_guest(v) )
- v->arch.shadow.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3);
- else
- v->arch.shadow.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,4,4);
+ v->arch.shadow.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,4,4);
#elif CONFIG_PAGING_LEVELS == 3
v->arch.shadow.mode = &SHADOW_INTERNAL_NAME(sh_paging_mode,3,3);
#elif CONFIG_PAGING_LEVELS == 2
@@ -2938,6 +2956,11 @@ static int shadow_log_dirty_enable(struc
goto out;
}
+#if (SHADOW_OPTIMIZATIONS & SHOPT_LINUX_L3_TOPLEVEL)
+ if ( IS_COMPAT(d) )
+ d->arch.shadow.opt_flags = SHOPT_LINUX_L3_TOPLEVEL;
+#endif
+
ret = sh_alloc_log_dirty_bitmap(d);
if ( ret != 0 )
{
@@ -3290,7 +3313,7 @@ int shadow_domctl(struct domain *d,
void shadow_audit_tables(struct vcpu *v)
{
/* Dispatch table for getting per-type functions */
- static hash_callback_t callbacks[16] = {
+ 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 */
@@ -3308,6 +3331,7 @@ void shadow_audit_tables(struct vcpu *v)
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 */
#endif /* CONFIG_PAGING_LEVELS >= 4 */
@@ -3330,7 +3354,7 @@ void shadow_audit_tables(struct vcpu *v)
case 3: mask = (SHF_L1_PAE|SHF_FL1_PAE|SHF_L2_PAE
|SHF_L2H_PAE); break;
case 4: mask = (SHF_L1_64|SHF_FL1_64|SHF_L2_64
- |SHF_L3_64|SHF_L4_64); break;
+ |SHF_L2H_64|SHF_L3_64|SHF_L4_64); break;
default: BUG();
}
}
Index: 2007-02-20/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- 2007-02-20.orig/xen/arch/x86/mm/shadow/multi.c 2007-02-20 11:01:43.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm/shadow/multi.c 2007-02-20 11:01:50.000000000 +0100
@@ -162,8 +162,13 @@ set_shadow_status(struct vcpu *v, mfn_t
else
mfn_to_shadow_page(smfn)->logdirty = 0;
- res = get_page(mfn_to_page(gmfn), d);
- ASSERT(res == 1);
+#ifdef CONFIG_COMPAT
+ if ( !IS_COMPAT(d) || shadow_type != SH_type_l4_64_shadow )
+#endif
+ {
+ res = get_page(mfn_to_page(gmfn), d);
+ ASSERT(res == 1);
+ }
shadow_hash_insert(v, mfn_x(gmfn), shadow_type, smfn);
}
@@ -185,7 +190,10 @@ delete_shadow_status(struct vcpu *v, mfn
v->domain->domain_id, v->vcpu_id,
mfn_x(gmfn), shadow_type, mfn_x(smfn));
shadow_hash_delete(v, mfn_x(gmfn), shadow_type, smfn);
- put_page(mfn_to_page(gmfn));
+#ifdef CONFIG_COMPAT
+ if ( !IS_COMPAT(v->domain) || shadow_type != SH_type_l4_64_shadow )
+#endif
+ put_page(mfn_to_page(gmfn));
}
/**************************************************************************/
@@ -764,7 +772,7 @@ _sh_propagate(struct vcpu *v,
// PV guests in 64-bit mode use two different page tables for user vs
// supervisor permissions, making the guest's _PAGE_USER bit irrelevant.
// It is always shadowed as present...
- if ( (GUEST_PAGING_LEVELS == 4) && !is_hvm_domain(d) )
+ if ( (GUEST_PAGING_LEVELS == 4) && !IS_COMPAT(d) && !is_hvm_domain(d) )
{
sflags |= _PAGE_USER;
}
@@ -1235,9 +1243,10 @@ do {
#if GUEST_PAGING_LEVELS == 2 && SHADOW_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, _xen, _code) \
+#define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _dom, _code) \
do { \
int _i, _j, __done = 0; \
+ int _xen = !shadow_mode_external(_dom); \
ASSERT(mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2_32_shadow); \
for ( _j = 0; _j < 4 && !__done; _j++ ) \
{ \
@@ -1261,9 +1270,10 @@ do {
#elif GUEST_PAGING_LEVELS == 2
/* 32-bit on 32-bit: avoid Xen entries */
-#define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _xen, _code) \
+#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++ ) \
@@ -1283,9 +1293,10 @@ do {
#elif GUEST_PAGING_LEVELS == 3
/* PAE: if it's an l2h, don't touch Xen mappings */
-#define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _xen, _code) \
+#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_pae_shadow \
|| mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2h_pae_shadow);\
@@ -1306,21 +1317,29 @@ do {
#else
-/* 64-bit l2: touch all entries */
-#define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _xen, _code) \
-do { \
- int _i; \
- shadow_l2e_t *_sp = map_shadow_page((_sl2mfn)); \
- ASSERT(mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2_64_shadow); \
- for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ ) \
- { \
- (_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); \
+/* 64-bit l2: touch all entries except for PAE compat guests. */
+#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_64_shadow || \
+ mfn_to_shadow_page(_sl2mfn)->type == SH_type_l2h_64_shadow); \
+ for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ ) \
+ { \
+ if ( (!(_xen)) \
+ || !IS_COMPAT(_dom) \
+ || mfn_to_shadow_page(_sl2mfn)->type != SH_type_l2h_64_shadow \
+ || (_i < COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom)) ) \
+ { \
+ (_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)
#endif /* different kinds of l2 */
@@ -1345,14 +1364,15 @@ do {
} while (0)
/* 64-bit l4: avoid Xen mappings */
-#define SHADOW_FOREACH_L4E(_sl4mfn, _sl4e, _gl4p, _done, _xen, _code) \
+#define SHADOW_FOREACH_L4E(_sl4mfn, _sl4e, _gl4p, _done, _dom, _code) \
do { \
- int _i; \
shadow_l4e_t *_sp = map_shadow_page((_sl4mfn)); \
+ int _xen = !shadow_mode_external(_dom); \
+ int _i; \
ASSERT(mfn_to_shadow_page(_sl4mfn)->type == SH_type_l4_64_shadow); \
for ( _i = 0; _i < SHADOW_L4_PAGETABLE_ENTRIES; _i++ ) \
{ \
- if ( (!(_xen)) || is_guest_l4_slot(_i) ) \
+ if ( (!(_xen)) || is_guest_l4_slot(_dom, _i) ) \
{ \
(_sl4e) = _sp + _i; \
if ( shadow_l4e_get_flags(*(_sl4e)) & _PAGE_PRESENT ) \
@@ -1419,17 +1439,25 @@ void sh_install_xen_entries_in_l4(struct
__PAGE_HYPERVISOR);
}
+ if ( IS_COMPAT(v->domain) )
+ {
+ /* install compat arg xlat entry */
+ sl4e[shadow_l4_table_offset(COMPAT_ARG_XLAT_VIRT_BASE)] =
+ shadow_l4e_from_mfn(
+ page_to_mfn(virt_to_page(d->arch.mm_arg_xlat_l3)),
+ __PAGE_HYPERVISOR);
+ }
+
sh_unmap_domain_page(sl4e);
}
#endif
-#if (CONFIG_PAGING_LEVELS == 3 || defined(CONFIG_COMPAT)) && GUEST_PAGING_LEVELS == 3
+#if CONFIG_PAGING_LEVELS >= 3 && GUEST_PAGING_LEVELS >= 3
// For 3-on-3 PV guests, we need to make sure the xen mappings are in
// place, which means that we need to populate the l2h entry in the l3
// table.
-void sh_install_xen_entries_in_l2h(struct vcpu *v,
- mfn_t sl2hmfn)
+static void sh_install_xen_entries_in_l2h(struct vcpu *v, mfn_t sl2hmfn)
{
struct domain *d = v->domain;
shadow_l2e_t *sl2e;
@@ -1491,9 +1519,10 @@ void sh_install_xen_entries_in_l2h(struc
#else
/* Copy the common Xen mappings from the idle domain */
- memcpy(&sl2e[COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(d)],
- &compat_idle_pg_table_l2[l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
- COMPAT_L2_PAGETABLE_XEN_SLOTS(d) * sizeof(*sl2e));
+ memcpy(
+ &sl2e[COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(d)],
+ &compat_idle_pg_table_l2[l2_table_offset(HIRO_COMPAT_MPT_VIRT_START)],
+ COMPAT_L2_PAGETABLE_XEN_SLOTS(d) * sizeof(*sl2e));
#endif
@@ -1619,8 +1648,11 @@ sh_make_shadow(struct vcpu *v, mfn_t gmf
case SH_type_l4_shadow:
sh_install_xen_entries_in_l4(v, gmfn, smfn); break;
#endif
-#if CONFIG_PAGING_LEVELS == 3 && GUEST_PAGING_LEVELS == 3
+#if CONFIG_PAGING_LEVELS >= 3 && GUEST_PAGING_LEVELS >= 3
case SH_type_l2h_shadow:
+#ifdef CONFIG_COMPAT
+ ASSERT( IS_COMPAT(v->domain) );
+#endif
sh_install_xen_entries_in_l2h(v, smfn); break;
#endif
#if CONFIG_PAGING_LEVELS == 2 && GUEST_PAGING_LEVELS == 2
@@ -1834,12 +1866,21 @@ static shadow_l2e_t * shadow_get_and_cre
{
int r;
shadow_l3e_t new_sl3e;
+ unsigned int t = SH_type_l2_shadow;
+
+#ifdef CONFIG_COMPAT
+ /* Tag compat L2 containing hypervisor (m2p) mappings */
+ if ( IS_COMPAT(v->domain) &&
+ guest_l4_table_offset(gw->va) == 0 &&
+ guest_l3_table_offset(gw->va) == 3 )
+ t = SH_type_l2h_shadow;
+#endif
/* No l2 shadow installed: find and install it. */
- *sl2mfn = get_shadow_status(v, gw->l2mfn, SH_type_l2_shadow);
+ *sl2mfn = get_shadow_status(v, gw->l2mfn, t);
if ( !mfn_valid(*sl2mfn) )
{
/* No l2 shadow of this page exists at all: make one. */
- *sl2mfn = sh_make_shadow(v, gw->l2mfn, SH_type_l2_shadow);
+ *sl2mfn = sh_make_shadow(v, gw->l2mfn, t);
}
/* Install the new sl2 table in the sl3e */
l3e_propagate_from_guest(v, gw->l3e, gw->l3mfn,
@@ -1960,7 +2001,6 @@ void sh_destroy_l4_shadow(struct vcpu *v
shadow_l4e_t *sl4e;
u32 t = mfn_to_shadow_page(smfn)->type;
mfn_t gmfn, sl4mfn;
- int xen_mappings;
SHADOW_DEBUG(DESTROY_SHADOW,
"%s(%05lx)\n", __func__, mfn_x(smfn));
@@ -1971,9 +2011,8 @@ void sh_destroy_l4_shadow(struct vcpu *v
delete_shadow_status(v, gmfn, t, smfn);
shadow_demote(v, gmfn, t);
/* Decrement refcounts of all the old entries */
- xen_mappings = (!shadow_mode_external(v->domain));
sl4mfn = smfn;
- SHADOW_FOREACH_L4E(sl4mfn, sl4e, 0, 0, xen_mappings, {
+ SHADOW_FOREACH_L4E(sl4mfn, sl4e, 0, 0, v->domain, {
if ( shadow_l4e_get_flags(*sl4e) & _PAGE_PRESENT )
{
sh_put_ref(v, shadow_l4e_get_mfn(*sl4e),
@@ -2021,12 +2060,15 @@ void sh_destroy_l2_shadow(struct vcpu *v
shadow_l2e_t *sl2e;
u32 t = mfn_to_shadow_page(smfn)->type;
mfn_t gmfn, sl2mfn;
- int xen_mappings;
SHADOW_DEBUG(DESTROY_SHADOW,
"%s(%05lx)\n", __func__, mfn_x(smfn));
- ASSERT(t == SH_type_l2_shadow
- || t == SH_type_l2h_pae_shadow);
+
+#if GUEST_PAGING_LEVELS >= 3
+ ASSERT(t == SH_type_l2_shadow || t == SH_type_l2h_shadow);
+#else
+ ASSERT(t == SH_type_l2_shadow);
+#endif
/* Record that the guest page isn't shadowed any more (in this type) */
gmfn = _mfn(mfn_to_shadow_page(smfn)->backpointer);
@@ -2035,11 +2077,7 @@ void sh_destroy_l2_shadow(struct vcpu *v
/* Decrement refcounts of all the old entries */
sl2mfn = smfn;
- xen_mappings = (!shadow_mode_external(v->domain) &&
- ((GUEST_PAGING_LEVELS == 2) ||
- ((GUEST_PAGING_LEVELS == 3) &&
- (t == SH_type_l2h_pae_shadow))));
- SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, xen_mappings, {
+ SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, v->domain, {
if ( shadow_l2e_get_flags(*sl2e) & _PAGE_PRESENT )
sh_put_ref(v, shadow_l2e_get_mfn(*sl2e),
(((paddr_t)mfn_x(sl2mfn)) << PAGE_SHIFT)
@@ -2140,8 +2178,7 @@ void sh_destroy_monitor_table(struct vcp
void sh_unhook_32b_mappings(struct vcpu *v, mfn_t sl2mfn)
{
shadow_l2e_t *sl2e;
- int xen_mappings = !shadow_mode_external(v->domain);
- SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, xen_mappings, {
+ SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, v->domain, {
(void) shadow_set_l2e(v, sl2e, shadow_l2e_empty(), sl2mfn);
});
}
@@ -2152,8 +2189,7 @@ void sh_unhook_pae_mappings(struct vcpu
/* Walk a PAE l2 shadow, unhooking entries from all the subshadows */
{
shadow_l2e_t *sl2e;
- int xen_mappings = !shadow_mode_external(v->domain);
- SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, xen_mappings, {
+ SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, 0, v->domain, {
(void) shadow_set_l2e(v, sl2e, shadow_l2e_empty(), sl2mfn);
});
}
@@ -2163,8 +2199,7 @@ void sh_unhook_pae_mappings(struct vcpu
void sh_unhook_64b_mappings(struct vcpu *v, mfn_t sl4mfn)
{
shadow_l4e_t *sl4e;
- int xen_mappings = !shadow_mode_external(v->domain);
- SHADOW_FOREACH_L4E(sl4mfn, sl4e, 0, 0, xen_mappings, {
+ SHADOW_FOREACH_L4E(sl4mfn, sl4e, 0, 0, v->domain, {
(void) shadow_set_l4e(v, sl4e, shadow_l4e_empty(), sl4mfn);
});
}
@@ -2210,7 +2245,7 @@ static int validate_gl4e(struct vcpu *v,
{
int shadow_index = (((unsigned long)sl4p & ~PAGE_MASK) /
sizeof(shadow_l4e_t));
- int reserved_xen_slot = !is_guest_l4_slot(shadow_index);
+ int reserved_xen_slot = !is_guest_l4_slot(v->domain, shadow_index);
if ( unlikely(reserved_xen_slot) )
{
@@ -2473,7 +2508,7 @@ int
sh_map_and_validate_gl2he(struct vcpu *v, mfn_t gl2mfn,
void *new_gl2p, u32 size)
{
-#if GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS >= 3
return sh_map_and_validate(v, gl2mfn, new_gl2p, size,
SH_type_l2h_shadow,
shadow_l2_index,
@@ -3350,7 +3385,12 @@ sh_set_toplevel_shadow(struct vcpu *v,
#if SHADOW_OPTIMIZATIONS & SHOPT_EARLY_UNSHADOW
/* Once again OK to unhook entries from this table if we see fork/exit */
- ASSERT(sh_mfn_is_a_page_table(gmfn));
+#if CONFIG_PAGING_LEVELS == 4
+ if ( IS_COMPAT(d) )
+ ASSERT(!sh_mfn_is_a_page_table(gmfn));
+ else
+#endif
+ ASSERT(sh_mfn_is_a_page_table(gmfn));
mfn_to_page(gmfn)->shadow_flags &= ~SHF_unhooked_mappings;
#endif
@@ -3746,7 +3786,7 @@ void sh_clear_shadow_entry(struct vcpu *
case SH_type_l1_shadow:
(void) shadow_set_l1e(v, ep, shadow_l1e_empty(), smfn); break;
case SH_type_l2_shadow:
-#if GUEST_PAGING_LEVELS == 3
+#if GUEST_PAGING_LEVELS >= 3
case SH_type_l2h_shadow:
#endif
(void) shadow_set_l2e(v, ep, shadow_l2e_empty(), smfn); break;
@@ -3766,11 +3806,8 @@ int sh_remove_l1_shadow(struct vcpu *v,
shadow_l2e_t *sl2e;
int done = 0;
int flags;
-#if GUEST_PAGING_LEVELS != 4
- int xen_mappings = !shadow_mode_external(v->domain);
-#endif
- SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, done, xen_mappings,
+ SHADOW_FOREACH_L2E(sl2mfn, sl2e, 0, done, v->domain,
{
flags = shadow_l2e_get_flags(*sl2e);
if ( (flags & _PAGE_PRESENT)
@@ -3813,9 +3850,9 @@ int sh_remove_l3_shadow(struct vcpu *v,
{
shadow_l4e_t *sl4e;
int done = 0;
- int flags, xen_mappings = !shadow_mode_external(v->domain);
+ int flags;
- SHADOW_FOREACH_L4E(sl4mfn, sl4e, 0, done, xen_mappings,
+ SHADOW_FOREACH_L4E(sl4mfn, sl4e, 0, done, v->domain,
{
flags = shadow_l4e_get_flags(*sl4e);
if ( (flags & _PAGE_PRESENT)
@@ -4153,14 +4190,11 @@ int sh_audit_l2_table(struct vcpu *v, mf
gfn_t gfn;
char *s;
int done = 0;
-#if GUEST_PAGING_LEVELS != 4
- int xen_mappings = !shadow_mode_external(v->domain);
-#endif
/* Follow the backpointer */
gl2mfn = _mfn(mfn_to_shadow_page(sl2mfn)->backpointer);
gl2e = gp = sh_map_domain_page(gl2mfn);
- SHADOW_FOREACH_L2E(sl2mfn, sl2e, &gl2e, done, xen_mappings, {
+ SHADOW_FOREACH_L2E(sl2mfn, sl2e, &gl2e, done, v->domain, {
s = sh_audit_flags(v, 2, guest_l2e_get_flags(*gl2e),
shadow_l2e_get_flags(*sl2e));
@@ -4212,10 +4246,11 @@ int sh_audit_l3_table(struct vcpu *v, mf
gfn = guest_l3e_get_gfn(*gl3e);
mfn = shadow_l3e_get_mfn(*sl3e);
gmfn = get_shadow_status(v, audit_gfn_to_mfn(v, gfn, gl3mfn),
- (GUEST_PAGING_LEVELS == 3
+ ((GUEST_PAGING_LEVELS == 3 ||
+ IS_COMPAT(v->domain))
&& !shadow_mode_external(v->domain)
&& (guest_index(gl3e) % 4) == 3)
- ? SH_type_l2h_pae_shadow
+ ? SH_type_l2h_shadow
: SH_type_l2_shadow);
if ( mfn_x(gmfn) != mfn_x(mfn) )
AUDIT_FAIL(3, "bad translation: gfn %" SH_PRI_gfn
@@ -4235,12 +4270,11 @@ int sh_audit_l4_table(struct vcpu *v, mf
gfn_t gfn;
char *s;
int done = 0;
- int xen_mappings = !shadow_mode_external(v->domain);
/* Follow the backpointer */
gl4mfn = _mfn(mfn_to_shadow_page(sl4mfn)->backpointer);
gl4e = gp = sh_map_domain_page(gl4mfn);
- SHADOW_FOREACH_L4E(sl4mfn, sl4e, &gl4e, done, xen_mappings,
+ SHADOW_FOREACH_L4E(sl4mfn, sl4e, &gl4e, done, v->domain,
{
s = sh_audit_flags(v, 4, guest_l4e_get_flags(*gl4e),
shadow_l4e_get_flags(*sl4e));
Index: 2007-02-20/xen/arch/x86/mm/shadow/private.h
===================================================================
--- 2007-02-20.orig/xen/arch/x86/mm/shadow/private.h 2007-02-20 11:01:43.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm/shadow/private.h 2007-02-20 11:01:50.000000000 +0100
@@ -190,12 +190,13 @@ static inline void shadow_check_page_str
#define SH_type_l1_64_shadow (8U) /* shadowing a 64-bit L1 page */
#define SH_type_fl1_64_shadow (9U) /* L1 shadow for 64-bit 2M superpg */
#define SH_type_l2_64_shadow (10U) /* shadowing a 64-bit L2 page */
-#define SH_type_l3_64_shadow (11U) /* shadowing a 64-bit L3 page */
-#define SH_type_l4_64_shadow (12U) /* shadowing a 64-bit L4 page */
-#define SH_type_max_shadow (12U)
-#define SH_type_p2m_table (13U) /* in use as the p2m table */
-#define SH_type_monitor_table (14U) /* in use as a monitor table */
-#define SH_type_unused (15U)
+#define SH_type_l2h_64_shadow (11U) /* shadowing a compat PAE L2 high page */
+#define SH_type_l3_64_shadow (12U) /* shadowing a 64-bit L3 page */
+#define SH_type_l4_64_shadow (13U) /* shadowing a 64-bit L4 page */
+#define SH_type_max_shadow (13U)
+#define SH_type_p2m_table (14U) /* in use as the p2m table */
+#define SH_type_monitor_table (15U) /* in use as a monitor table */
+#define SH_type_unused (16U)
/*
* What counts as a pinnable shadow?
@@ -246,6 +247,7 @@ static inline int sh_type_is_pinnable(st
#define SHF_L1_64 (1u << SH_type_l1_64_shadow)
#define SHF_FL1_64 (1u << SH_type_fl1_64_shadow)
#define SHF_L2_64 (1u << SH_type_l2_64_shadow)
+#define SHF_L2H_64 (1u << SH_type_l2h_64_shadow)
#define SHF_L3_64 (1u << SH_type_l3_64_shadow)
#define SHF_L4_64 (1u << SH_type_l4_64_shadow)
@@ -284,7 +286,6 @@ void shadow_unhook_mappings(struct vcpu
/* 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_l2h(struct vcpu *v, mfn_t sl2hmfn);
void sh_install_xen_entries_in_l2(struct vcpu *v, mfn_t gl2mfn, mfn_t sl2mfn);
Index: 2007-02-20/xen/arch/x86/mm/shadow/types.h
===================================================================
--- 2007-02-20.orig/xen/arch/x86/mm/shadow/types.h 2007-02-20 11:01:43.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm/shadow/types.h 2007-02-20 11:01:50.000000000 +0100
@@ -389,6 +389,7 @@ static inline guest_l4e_t guest_l4e_from
#define SH_type_l1_shadow SH_type_l1_64_shadow
#define SH_type_fl1_shadow SH_type_fl1_64_shadow
#define SH_type_l2_shadow SH_type_l2_64_shadow
+#define SH_type_l2h_shadow SH_type_l2h_64_shadow
#define SH_type_l3_shadow SH_type_l3_64_shadow
#define SH_type_l4_shadow SH_type_l4_64_shadow
#endif
Index: 2007-02-20/xen/include/asm-x86/x86_64/page.h
===================================================================
--- 2007-02-20.orig/xen/include/asm-x86/x86_64/page.h 2007-02-20 11:01:43.000000000 +0100
+++ 2007-02-20/xen/include/asm-x86/x86_64/page.h 2007-02-20 11:01:50.000000000 +0100
@@ -59,9 +59,11 @@ typedef l4_pgentry_t root_pgentry_t;
!((_t) & PGT_pae_xen_l2) || \
((_s) < COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_d)) )
#define is_guest_l3_slot(_s) (1)
-#define is_guest_l4_slot(_s) \
- (((_s) < ROOT_PAGETABLE_FIRST_XEN_SLOT) || \
- ((_s) > ROOT_PAGETABLE_LAST_XEN_SLOT))
+#define is_guest_l4_slot(_d, _s) \
+ ( IS_COMPAT(_d) \
+ ? ((_s) == 0) \
+ : (((_s) < ROOT_PAGETABLE_FIRST_XEN_SLOT) || \
+ ((_s) > ROOT_PAGETABLE_LAST_XEN_SLOT)))
#define root_get_pfn l4e_get_pfn
#define root_get_flags l4e_get_flags

View File

@ -1,7 +1,7 @@
Index: 2007-01-08/xen/arch/x86/domain.c
Index: 2007-02-20/xen/arch/x86/domain.c
===================================================================
--- 2007-01-08.orig/xen/arch/x86/domain.c 2007-01-08 15:20:39.000000000 +0100
+++ 2007-01-08/xen/arch/x86/domain.c 2007-01-08 14:54:35.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/domain.c 2007-02-26 15:41:28.000000000 +0100
+++ 2007-02-20/xen/arch/x86/domain.c 2007-01-08 14:54:35.000000000 +0100
@@ -253,7 +253,7 @@ static void release_compat_l4(struct vcp
static inline int may_switch_mode(struct domain *d)
@ -30,23 +30,23 @@ Index: 2007-01-08/xen/arch/x86/domain.c
return 0;
}
Index: 2007-01-08/xen/arch/x86/domain_build.c
Index: 2007-02-20/xen/arch/x86/domain_build.c
===================================================================
--- 2007-01-08.orig/xen/arch/x86/domain_build.c 2007-01-08 14:54:33.000000000 +0100
+++ 2007-01-08/xen/arch/x86/domain_build.c 2007-01-08 15:36:39.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/domain_build.c 2007-02-26 15:41:28.000000000 +0100
+++ 2007-02-20/xen/arch/x86/domain_build.c 2007-02-26 15:42:27.000000000 +0100
@@ -396,6 +396,8 @@ int construct_dom0(struct domain *d,
value = (value + mask) & ~mask;
#ifdef CONFIG_COMPAT
HYPERVISOR_COMPAT_VIRT_START(d) = max_t(unsigned int, m2p_compat_vstart, value);
+ d->pa_bitsize = fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+ + (PAGE_SIZE - 2);
+ d->pa_bitsize = !IS_COMPAT(d) ? 0 :
+ fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1 + (PAGE_SIZE - 2);
if ( value > (!IS_COMPAT(d) ?
HYPERVISOR_VIRT_START :
__HYPERVISOR_COMPAT_VIRT_START) )
Index: 2007-01-08/xen/common/page_alloc.c
Index: 2007-02-20/xen/common/page_alloc.c
===================================================================
--- 2007-01-08.orig/xen/common/page_alloc.c 2007-01-08 14:54:33.000000000 +0100
+++ 2007-01-08/xen/common/page_alloc.c 2007-01-08 14:54:35.000000000 +0100
--- 2007-02-20.orig/xen/common/page_alloc.c 2007-02-26 15:41:28.000000000 +0100
+++ 2007-02-20/xen/common/page_alloc.c 2007-01-08 14:54:35.000000000 +0100
@@ -718,7 +718,12 @@ struct page_info *__alloc_domheap_pages(
if ( bits && bits <= PAGE_SHIFT + 1 )
return NULL;
@ -61,10 +61,10 @@ Index: 2007-01-08/xen/common/page_alloc.c
if ( zone_hi >= NR_ZONES )
zone_hi = NR_ZONES - 1;
Index: 2007-01-08/xen/include/xen/sched.h
Index: 2007-02-20/xen/include/xen/sched.h
===================================================================
--- 2007-01-08.orig/xen/include/xen/sched.h 2007-01-08 15:20:39.000000000 +0100
+++ 2007-01-08/xen/include/xen/sched.h 2007-01-08 14:54:35.000000000 +0100
--- 2007-02-20.orig/xen/include/xen/sched.h 2007-02-26 15:41:28.000000000 +0100
+++ 2007-02-20/xen/include/xen/sched.h 2007-01-08 14:54:35.000000000 +0100
@@ -165,6 +165,10 @@ struct domain
unsigned long domain_flags;

View File

@ -1,7 +1,7 @@
Index: 2007-01-31/xen/arch/powerpc/backtrace.c
Index: 2007-02-20/xen/arch/powerpc/backtrace.c
===================================================================
--- 2007-01-31.orig/xen/arch/powerpc/backtrace.c 2006-12-15 16:33:59.000000000 +0100
+++ 2007-01-31/xen/arch/powerpc/backtrace.c 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/arch/powerpc/backtrace.c 2006-12-15 16:33:59.000000000 +0100
+++ 2007-02-20/xen/arch/powerpc/backtrace.c 2007-02-20 10:56:04.000000000 +0100
@@ -206,7 +206,7 @@ void show_backtrace_regs(struct cpu_user
console_end_sync();
}
@ -11,11 +11,11 @@ Index: 2007-01-31/xen/arch/powerpc/backtrace.c
{
ulong sp;
ulong lr;
Index: 2007-01-31/xen/arch/x86/mm/shadow/common.c
Index: 2007-02-20/xen/arch/x86/mm/shadow/common.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/mm/shadow/common.c 2007-01-31 09:36:44.000000000 +0100
+++ 2007-01-31/xen/arch/x86/mm/shadow/common.c 2007-01-31 09:42:07.000000000 +0100
@@ -940,6 +940,7 @@ mfn_t shadow_alloc(struct domain *d,
--- 2007-02-20.orig/xen/arch/x86/mm/shadow/common.c 2007-02-20 10:55:36.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm/shadow/common.c 2007-02-20 10:56:04.000000000 +0100
@@ -948,6 +948,7 @@ mfn_t shadow_alloc(struct domain *d,
* we might free up higher-level pages that the caller is working on. */
SHADOW_PRINTK("Can't allocate %i shadow pages!\n", 1 << order);
BUG();
@ -23,11 +23,11 @@ Index: 2007-01-31/xen/arch/x86/mm/shadow/common.c
}
Index: 2007-01-31/xen/arch/x86/mm/shadow/multi.c
Index: 2007-02-20/xen/arch/x86/mm/shadow/multi.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/mm/shadow/multi.c 2007-01-31 09:36:54.000000000 +0100
+++ 2007-01-31/xen/arch/x86/mm/shadow/multi.c 2007-01-31 09:42:07.000000000 +0100
@@ -3160,7 +3160,7 @@ sh_update_linear_entries(struct vcpu *v)
--- 2007-02-20.orig/xen/arch/x86/mm/shadow/multi.c 2007-02-20 10:55:27.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm/shadow/multi.c 2007-02-20 10:56:04.000000000 +0100
@@ -3195,7 +3195,7 @@ sh_update_linear_entries(struct vcpu *v)
*/
{
l2_pgentry_t *l2e, new_l2e;
@ -36,10 +36,10 @@ Index: 2007-01-31/xen/arch/x86/mm/shadow/multi.c
int i;
int unmap_l2e = 0;
Index: 2007-01-31/xen/arch/x86/traps.c
Index: 2007-02-20/xen/arch/x86/traps.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/traps.c 2007-01-31 09:41:54.000000000 +0100
+++ 2007-01-31/xen/arch/x86/traps.c 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/traps.c 2007-02-20 10:56:00.000000000 +0100
+++ 2007-02-20/xen/arch/x86/traps.c 2007-02-20 10:56:04.000000000 +0100
@@ -635,14 +635,50 @@ asmlinkage int do_invalid_op(struct cpu_
if ( unlikely(!guest_mode(regs)) )
@ -99,10 +99,10 @@ Index: 2007-01-31/xen/arch/x86/traps.c
}
DEBUGGER_trap_fatal(TRAP_invalid_op, regs);
show_execution_state(regs);
Index: 2007-01-31/xen/common/keyhandler.c
Index: 2007-02-20/xen/common/keyhandler.c
===================================================================
--- 2007-01-31.orig/xen/common/keyhandler.c 2007-01-31 09:29:10.000000000 +0100
+++ 2007-01-31/xen/common/keyhandler.c 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/common/keyhandler.c 2007-02-20 10:41:46.000000000 +0100
+++ 2007-02-20/xen/common/keyhandler.c 2007-02-20 10:56:04.000000000 +0100
@@ -94,7 +94,7 @@ static void show_handlers(unsigned char
static void __dump_execstate(void *unused)
@ -112,10 +112,10 @@ Index: 2007-01-31/xen/common/keyhandler.c
}
static void dump_registers(unsigned char key, struct cpu_user_regs *regs)
Index: 2007-01-31/xen/drivers/char/console.c
Index: 2007-02-20/xen/drivers/char/console.c
===================================================================
--- 2007-01-31.orig/xen/drivers/char/console.c 2006-12-15 16:33:59.000000000 +0100
+++ 2007-01-31/xen/drivers/char/console.c 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/drivers/char/console.c 2006-12-15 16:33:59.000000000 +0100
+++ 2007-02-20/xen/drivers/char/console.c 2007-02-20 10:56:04.000000000 +0100
@@ -880,15 +880,21 @@ void panic(const char *fmt, ...)
}
}
@ -140,10 +140,10 @@ Index: 2007-01-31/xen/drivers/char/console.c
/*
* Local variables:
* mode: C
Index: 2007-01-31/xen/include/asm-ia64/bug.h
Index: 2007-02-20/xen/include/asm-ia64/bug.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2007-01-31/xen/include/asm-ia64/bug.h 2007-01-31 09:42:07.000000000 +0100
+++ 2007-02-20/xen/include/asm-ia64/bug.h 2007-02-20 10:56:04.000000000 +0100
@@ -0,0 +1,6 @@
+#ifndef __ASM_IA64_BUG_H__
+#define __ASM_IA64_BUG_H__
@ -151,10 +151,10 @@ Index: 2007-01-31/xen/include/asm-ia64/bug.h
+#define DUMP_STATE() printk("FIXME: implement ia64 dump_execution_state()\n");
+
+#endif /* __ASM_IA64_BUG_H__ */
Index: 2007-01-31/xen/include/asm-ia64/linux-xen/asm/iosapic.h
Index: 2007-02-20/xen/include/asm-ia64/linux-xen/asm/iosapic.h
===================================================================
--- 2007-01-31.orig/xen/include/asm-ia64/linux-xen/asm/iosapic.h 2006-12-13 11:15:55.000000000 +0100
+++ 2007-01-31/xen/include/asm-ia64/linux-xen/asm/iosapic.h 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/include/asm-ia64/linux-xen/asm/iosapic.h 2006-12-13 11:15:55.000000000 +0100
+++ 2007-02-20/xen/include/asm-ia64/linux-xen/asm/iosapic.h 2007-02-20 10:56:04.000000000 +0100
@@ -123,11 +123,10 @@ static inline void list_move(struct list
#define move_irq(x)
@ -171,10 +171,10 @@ Index: 2007-01-31/xen/include/asm-ia64/linux-xen/asm/iosapic.h
} while (0)
#ifdef nop
Index: 2007-01-31/xen/include/asm-ia64/xenprocessor.h
Index: 2007-02-20/xen/include/asm-ia64/xenprocessor.h
===================================================================
--- 2007-01-31.orig/xen/include/asm-ia64/xenprocessor.h 2006-12-13 11:15:55.000000000 +0100
+++ 2007-01-31/xen/include/asm-ia64/xenprocessor.h 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/include/asm-ia64/xenprocessor.h 2006-12-13 11:15:55.000000000 +0100
+++ 2007-02-20/xen/include/asm-ia64/xenprocessor.h 2007-02-20 10:56:04.000000000 +0100
@@ -237,6 +237,4 @@ typedef union {
u64 itir;
} ia64_itir_t;
@ -182,10 +182,10 @@ Index: 2007-01-31/xen/include/asm-ia64/xenprocessor.h
-#define dump_execution_state() printk("FIXME: implement ia64 dump_execution_state()\n");
-
#endif // _ASM_IA64_XENPROCESSOR_H
Index: 2007-01-31/xen/include/asm-powerpc/bug.h
Index: 2007-02-20/xen/include/asm-powerpc/bug.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2007-01-31/xen/include/asm-powerpc/bug.h 2007-01-31 09:42:07.000000000 +0100
+++ 2007-02-20/xen/include/asm-powerpc/bug.h 2007-02-20 10:56:04.000000000 +0100
@@ -0,0 +1,7 @@
+#ifndef __ASM_PPC_BUG_H__
+#define __ASM_PPC_BUG_H__
@ -194,10 +194,10 @@ Index: 2007-01-31/xen/include/asm-powerpc/bug.h
+#define DUMP_STATE() dump_execution_state()
+
+#endif /* __ASM_PPC_BUG_H__ */
Index: 2007-01-31/xen/include/asm-powerpc/debugger.h
Index: 2007-02-20/xen/include/asm-powerpc/debugger.h
===================================================================
--- 2007-01-31.orig/xen/include/asm-powerpc/debugger.h 2006-12-15 16:33:59.000000000 +0100
+++ 2007-01-31/xen/include/asm-powerpc/debugger.h 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/include/asm-powerpc/debugger.h 2006-12-15 16:33:59.000000000 +0100
+++ 2007-02-20/xen/include/asm-powerpc/debugger.h 2007-02-20 10:56:04.000000000 +0100
@@ -67,10 +67,6 @@ static inline void unimplemented(void)
#endif
}
@ -209,10 +209,10 @@ Index: 2007-01-31/xen/include/asm-powerpc/debugger.h
extern void __attn(void);
#define ATTN() __attn();
Index: 2007-01-31/xen/include/asm-x86/bug.h
Index: 2007-02-20/xen/include/asm-x86/bug.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ 2007-01-31/xen/include/asm-x86/bug.h 2007-01-31 09:42:07.000000000 +0100
+++ 2007-02-20/xen/include/asm-x86/bug.h 2007-02-20 10:56:04.000000000 +0100
@@ -0,0 +1,60 @@
+#ifndef __ASM_X86_BUG_H__
+#define __ASM_X86_BUG_H__
@ -274,10 +274,10 @@ Index: 2007-01-31/xen/include/asm-x86/bug.h
+ } while (0)
+
+#endif /* __ASM_X86_BUG_H__ */
Index: 2007-01-31/xen/include/asm-x86/processor.h
Index: 2007-02-20/xen/include/asm-x86/processor.h
===================================================================
--- 2007-01-31.orig/xen/include/asm-x86/processor.h 2007-01-31 09:29:08.000000000 +0100
+++ 2007-01-31/xen/include/asm-x86/processor.h 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/include/asm-x86/processor.h 2007-02-20 10:41:44.000000000 +0100
+++ 2007-02-20/xen/include/asm-x86/processor.h 2007-02-20 10:56:04.000000000 +0100
@@ -565,11 +565,6 @@ void compat_show_guest_stack(struct cpu_
#define compat_show_guest_stack(regs, lines) ((void)0)
#endif
@ -290,10 +290,10 @@ Index: 2007-01-31/xen/include/asm-x86/processor.h
extern void mtrr_ap_init(void);
extern void mtrr_bp_init(void);
Index: 2007-01-31/xen/include/xen/lib.h
Index: 2007-02-20/xen/include/xen/lib.h
===================================================================
--- 2007-01-31.orig/xen/include/xen/lib.h 2007-01-08 14:16:35.000000000 +0100
+++ 2007-01-31/xen/include/xen/lib.h 2007-01-31 09:42:07.000000000 +0100
--- 2007-02-20.orig/xen/include/xen/lib.h 2007-01-08 14:16:35.000000000 +0100
+++ 2007-02-20/xen/include/xen/lib.h 2007-02-20 10:56:04.000000000 +0100
@@ -7,10 +7,26 @@
#include <xen/types.h>
#include <xen/xmalloc.h>

View File

@ -43,6 +43,7 @@ quiet = False
verbose = False
dryrun = False
tmpdir = '/var/lib/xen/tmp'
in_args = ''
# Helper functions
@ -353,17 +354,17 @@ def copyKernelAndRamdisk(disk, vdev, kernel, ramdisk):
def main(argv):
"Main routine: Parses options etc."
global quiet, dryrun, verbose, tmpdir
global quiet, dryrun, verbose, tmpdir, in_args
def usage():
"Help output (usage info)"
global verbose, quiet, dryrun
print >> sys.stderr, "domUloader usage: domUloader [--output=fd] [--quiet] [--dryrun] [--verbose]\n" +\
"[--help] --entry=dev:kernel[,ramdisk] physdisk [virtdisk]\n"
"[--args] [--help] --entry=dev:kernel[,ramdisk] physdisk [virtdisk]\n"
print >> sys.stderr, __doc__
try:
(optlist, args) = getopt.gnu_getopt(argv, 'qvh', \
('entry=', 'output=', 'tmpdir=', 'help', 'quiet', 'dryrun', 'verbose'))
('entry=', 'output=', 'tmpdir=', 'args=', 'help', 'quiet', 'dryrun', 'verbose'))
except:
usage()
sys.exit(1)
@ -389,6 +390,8 @@ def main(argv):
entry = oarg
elif opt == '--tmpdir':
tmpdir = oarg
elif opt == '--args':
in_args = oarg
verbose_print(str(argv))
@ -424,6 +427,8 @@ def main(argv):
r = 0
try:
sxpr = copyKernelAndRamdisk(disk, vdev, kernel, ramdisk)
if in_args:
sxpr += "(args %s)" % in_args
os.write(fd, sxpr)
except Exception, e:
error(str(e))

View File

@ -5,10 +5,10 @@ ptwr_emulated_update() uses gmfn_to_mfn() on the pte loaded from the
emulation context, while ptwr_do_page_fault() doesn't on the pte stored
into that context. Shouldn't these two be symmetric?
Index: 2007-01-08/xen/arch/x86/mm.c
Index: 2007-02-20/xen/arch/x86/mm.c
===================================================================
--- 2007-01-08.orig/xen/arch/x86/mm.c 2007-01-11 15:33:22.000000000 +0100
+++ 2007-01-08/xen/arch/x86/mm.c 2007-01-12 17:25:55.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/mm.c 2007-02-20 10:55:57.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm.c 2007-02-20 10:56:12.000000000 +0100
@@ -794,7 +794,7 @@ static void put_page_from_l2e(l2_pgentry
{
if ( (l2e_get_flags(l2e) & _PAGE_PRESENT) &&
@ -36,7 +36,7 @@ Index: 2007-01-08/xen/arch/x86/mm.c
}
#endif
@@ -3365,7 +3365,6 @@ int ptwr_do_page_fault(struct vcpu *v, u
@@ -3369,7 +3369,6 @@ int ptwr_do_page_fault(struct vcpu *v, u
struct cpu_user_regs *regs)
{
struct domain *d = v->domain;
@ -44,7 +44,7 @@ Index: 2007-01-08/xen/arch/x86/mm.c
struct page_info *page;
l1_pgentry_t pte;
struct ptwr_emulate_ctxt ptwr_ctxt;
@@ -3379,8 +3378,7 @@ int ptwr_do_page_fault(struct vcpu *v, u
@@ -3383,8 +3382,7 @@ int ptwr_do_page_fault(struct vcpu *v, u
guest_get_eff_l1e(v, addr, &pte);
if ( !(l1e_get_flags(pte) & _PAGE_PRESENT) )
goto bail;

View File

@ -1,7 +1,7 @@
Index: 2007-01-31/xen/arch/x86/physdev.c
Index: 2007-02-20/xen/arch/x86/physdev.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/physdev.c 2007-01-31 09:29:19.000000000 +0100
+++ 2007-01-31/xen/arch/x86/physdev.c 2007-02-14 18:22:18.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/physdev.c 2007-02-20 10:41:50.000000000 +0100
+++ 2007-02-20/xen/arch/x86/physdev.c 2007-02-20 10:56:30.000000000 +0100
@@ -143,6 +143,57 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
break;
}
@ -60,10 +60,10 @@ Index: 2007-01-31/xen/arch/x86/physdev.c
default:
ret = -ENOSYS;
break;
Index: 2007-01-31/xen/arch/x86/traps.c
Index: 2007-02-20/xen/arch/x86/traps.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/traps.c 2007-02-07 17:03:20.000000000 +0100
+++ 2007-01-31/xen/arch/x86/traps.c 2007-02-15 10:12:21.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/traps.c 2007-02-20 10:56:27.000000000 +0100
+++ 2007-02-20/xen/arch/x86/traps.c 2007-02-20 10:56:30.000000000 +0100
@@ -2516,6 +2516,12 @@ long do_set_trap_table(XEN_GUEST_HANDLE(
if ( cur.address == 0 )
break;
@ -77,10 +77,10 @@ Index: 2007-01-31/xen/arch/x86/traps.c
fixup_guest_code_selector(current->domain, cur.cs);
memcpy(&dst[cur.vector], &cur, sizeof(cur));
Index: 2007-01-31/xen/arch/x86/x86_32/asm-offsets.c
Index: 2007-02-20/xen/arch/x86/x86_32/asm-offsets.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/x86_32/asm-offsets.c 2006-12-13 11:15:54.000000000 +0100
+++ 2007-01-31/xen/arch/x86/x86_32/asm-offsets.c 2007-02-15 09:51:44.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/x86_32/asm-offsets.c 2006-12-13 11:15:54.000000000 +0100
+++ 2007-02-20/xen/arch/x86/x86_32/asm-offsets.c 2007-02-20 10:56:30.000000000 +0100
@@ -68,6 +68,7 @@ void __dummy__(void)
OFFSET(VCPU_arch_guest_fpu_ctxt, struct vcpu, arch.guest_context.fpu_ctxt);
OFFSET(VCPU_flags, struct vcpu, vcpu_flags);
@ -89,10 +89,10 @@ Index: 2007-01-31/xen/arch/x86/x86_32/asm-offsets.c
DEFINE(_VCPUF_nmi_pending, _VCPUF_nmi_pending);
DEFINE(_VCPUF_nmi_masked, _VCPUF_nmi_masked);
DEFINE(_VGCF_failsafe_disables_events, _VGCF_failsafe_disables_events);
Index: 2007-01-31/xen/arch/x86/x86_32/entry.S
Index: 2007-02-20/xen/arch/x86/x86_32/entry.S
===================================================================
--- 2007-01-31.orig/xen/arch/x86/x86_32/entry.S 2007-01-31 09:42:04.000000000 +0100
+++ 2007-01-31/xen/arch/x86/x86_32/entry.S 2007-02-15 09:54:40.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/x86_32/entry.S 2007-02-20 10:56:03.000000000 +0100
+++ 2007-02-20/xen/arch/x86/x86_32/entry.S 2007-02-20 10:56:30.000000000 +0100
@@ -232,7 +232,7 @@ test_all_events:
shl $IRQSTAT_shift,%eax
test %ecx,irq_stat(%eax,1)
@ -128,10 +128,10 @@ Index: 2007-01-31/xen/arch/x86/x86_32/entry.S
jmp test_guest_events
bad_hypercall:
Index: 2007-01-31/xen/arch/x86/x86_64/asm-offsets.c
Index: 2007-02-20/xen/arch/x86/x86_64/asm-offsets.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/x86_64/asm-offsets.c 2007-01-31 09:29:21.000000000 +0100
+++ 2007-01-31/xen/arch/x86/x86_64/asm-offsets.c 2007-02-15 10:03:33.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/x86_64/asm-offsets.c 2007-02-20 10:41:52.000000000 +0100
+++ 2007-02-20/xen/arch/x86/x86_64/asm-offsets.c 2007-02-20 10:56:30.000000000 +0100
@@ -76,6 +76,7 @@ void __dummy__(void)
OFFSET(VCPU_arch_guest_fpu_ctxt, struct vcpu, arch.guest_context.fpu_ctxt);
OFFSET(VCPU_flags, struct vcpu, vcpu_flags);
@ -140,10 +140,10 @@ Index: 2007-01-31/xen/arch/x86/x86_64/asm-offsets.c
DEFINE(_VCPUF_nmi_pending, _VCPUF_nmi_pending);
DEFINE(_VCPUF_nmi_masked, _VCPUF_nmi_masked);
DEFINE(_VGCF_failsafe_disables_events, _VGCF_failsafe_disables_events);
Index: 2007-01-31/xen/arch/x86/x86_64/compat/entry.S
Index: 2007-02-20/xen/arch/x86/x86_64/compat/entry.S
===================================================================
--- 2007-01-31.orig/xen/arch/x86/x86_64/compat/entry.S 2007-01-31 09:42:04.000000000 +0100
+++ 2007-01-31/xen/arch/x86/x86_64/compat/entry.S 2007-02-15 10:22:57.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/x86_64/compat/entry.S 2007-02-20 10:56:03.000000000 +0100
+++ 2007-02-20/xen/arch/x86/x86_64/compat/entry.S 2007-02-20 10:56:30.000000000 +0100
@@ -68,7 +68,7 @@ compat_test_all_events:
leaq irq_stat(%rip),%rcx
testl $~0,(%rcx,%rax,1)
@ -198,10 +198,10 @@ Index: 2007-01-31/xen/arch/x86/x86_64/compat/entry.S
movw $TBF_FAILSAFE,TRAPBOUNCE_flags(%rdx)
btq $_VGCF_failsafe_disables_events,VCPU_guest_context_flags(%rbx)
jnc 1f
Index: 2007-01-31/xen/arch/x86/x86_64/compat/traps.c
Index: 2007-02-20/xen/arch/x86/x86_64/compat/traps.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/x86_64/compat/traps.c 2007-01-31 09:29:26.000000000 +0100
+++ 2007-01-31/xen/arch/x86/x86_64/compat/traps.c 2007-02-15 10:10:46.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/x86_64/compat/traps.c 2007-02-20 10:41:57.000000000 +0100
+++ 2007-02-20/xen/arch/x86/x86_64/compat/traps.c 2007-02-20 10:56:30.000000000 +0100
@@ -287,6 +287,12 @@ int compat_set_trap_table(XEN_GUEST_HAND
if ( cur.address == 0 )
break;
@ -215,10 +215,10 @@ Index: 2007-01-31/xen/arch/x86/x86_64/compat/traps.c
fixup_guest_code_selector(current->domain, cur.cs);
XLAT_trap_info(dst + cur.vector, &cur);
Index: 2007-01-31/xen/arch/x86/x86_64/entry.S
Index: 2007-02-20/xen/arch/x86/x86_64/entry.S
===================================================================
--- 2007-01-31.orig/xen/arch/x86/x86_64/entry.S 2007-01-31 09:42:04.000000000 +0100
+++ 2007-01-31/xen/arch/x86/x86_64/entry.S 2007-02-14 17:15:25.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/x86_64/entry.S 2007-02-20 10:56:03.000000000 +0100
+++ 2007-02-20/xen/arch/x86/x86_64/entry.S 2007-02-20 10:56:30.000000000 +0100
@@ -177,7 +177,7 @@ test_all_events:
leaq irq_stat(%rip),%rcx
testl $~0,(%rcx,%rax,1)
@ -246,10 +246,10 @@ Index: 2007-01-31/xen/arch/x86/x86_64/entry.S
jmp test_guest_events
bad_hypercall:
Index: 2007-01-31/xen/arch/x86/x86_64/physdev.c
Index: 2007-02-20/xen/arch/x86/x86_64/physdev.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/x86_64/physdev.c 2007-01-31 09:29:19.000000000 +0100
+++ 2007-01-31/xen/arch/x86/x86_64/physdev.c 2007-02-14 18:26:33.000000000 +0100
--- 2007-02-20.orig/xen/arch/x86/x86_64/physdev.c 2007-02-20 10:41:50.000000000 +0100
+++ 2007-02-20/xen/arch/x86/x86_64/physdev.c 2007-02-20 10:56:30.000000000 +0100
@@ -30,6 +30,10 @@
#define physdev_irq_status_query compat_physdev_irq_status_query
#define physdev_irq_status_query_t physdev_irq_status_query_compat_t
@ -261,11 +261,11 @@ Index: 2007-01-31/xen/arch/x86/x86_64/physdev.c
#define COMPAT
#undef guest_handle_okay
#define guest_handle_okay compat_handle_okay
Index: 2007-01-31/xen/common/kernel.c
Index: 2007-02-20/xen/common/kernel.c
===================================================================
--- 2007-01-31.orig/xen/common/kernel.c 2007-01-31 09:44:25.000000000 +0100
+++ 2007-01-31/xen/common/kernel.c 2007-02-15 10:18:48.000000000 +0100
@@ -252,16 +252,20 @@ long register_guest_nmi_callback(unsigne
--- 2007-02-20.orig/xen/common/kernel.c 2007-02-20 10:41:46.000000000 +0100
+++ 2007-02-20/xen/common/kernel.c 2007-02-20 10:56:30.000000000 +0100
@@ -247,16 +247,20 @@ long register_guest_nmi_callback(unsigne
struct vcpu *v = current;
struct domain *d = current->domain;
@ -290,7 +290,7 @@ Index: 2007-01-31/xen/common/kernel.c
set_bit(_VCPUF_nmi_pending, &v->vcpu_flags);
#endif
@@ -272,6 +276,11 @@ long unregister_guest_nmi_callback(void)
@@ -267,6 +271,11 @@ long unregister_guest_nmi_callback(void)
{
struct vcpu *v = current;
@ -302,10 +302,10 @@ Index: 2007-01-31/xen/common/kernel.c
v->nmi_addr = 0;
return 0;
Index: 2007-01-31/xen/include/public/physdev.h
Index: 2007-02-20/xen/include/public/physdev.h
===================================================================
--- 2007-01-31.orig/xen/include/public/physdev.h 2006-12-13 11:15:56.000000000 +0100
+++ 2007-01-31/xen/include/public/physdev.h 2007-02-14 18:21:35.000000000 +0100
--- 2007-02-20.orig/xen/include/public/physdev.h 2006-12-13 11:15:56.000000000 +0100
+++ 2007-02-20/xen/include/public/physdev.h 2007-02-20 10:56:30.000000000 +0100
@@ -119,6 +119,22 @@ typedef struct physdev_irq physdev_irq_t
DEFINE_XEN_GUEST_HANDLE(physdev_irq_t);
@ -329,10 +329,10 @@ Index: 2007-01-31/xen/include/public/physdev.h
* Argument to physdev_op_compat() hypercall. Superceded by new physdev_op()
* hypercall since 0x00030202.
*/
Index: 2007-01-31/xen/include/xen/sched.h
Index: 2007-02-20/xen/include/xen/sched.h
===================================================================
--- 2007-01-31.orig/xen/include/xen/sched.h 2007-01-31 09:39:18.000000000 +0100
+++ 2007-01-31/xen/include/xen/sched.h 2007-02-15 09:38:57.000000000 +0100
--- 2007-02-20.orig/xen/include/xen/sched.h 2007-02-20 10:42:03.000000000 +0100
+++ 2007-02-20/xen/include/xen/sched.h 2007-02-20 10:56:30.000000000 +0100
@@ -108,7 +108,11 @@ struct vcpu
/* Bitmask of CPUs on which this VCPU may run. */
cpumask_t cpu_affinity;
@ -345,10 +345,10 @@ Index: 2007-01-31/xen/include/xen/sched.h
/* Bitmask of CPUs which are holding onto this VCPU's state. */
cpumask_t vcpu_dirty_cpumask;
Index: 2007-01-31/xen/include/xlat.lst
Index: 2007-02-20/xen/include/xlat.lst
===================================================================
--- 2007-01-31.orig/xen/include/xlat.lst 2007-01-31 09:29:27.000000000 +0100
+++ 2007-01-31/xen/include/xlat.lst 2007-02-14 17:58:42.000000000 +0100
--- 2007-02-20.orig/xen/include/xlat.lst 2007-02-20 10:41:58.000000000 +0100
+++ 2007-02-20/xen/include/xlat.lst 2007-02-20 10:56:30.000000000 +0100
@@ -40,6 +40,7 @@
! memory_map memory.h
! memory_reservation memory.h

View File

@ -1,8 +1,8 @@
Index: 2007-01-31/xen/arch/x86/mm.c
Index: 2007-02-20/xen/arch/x86/mm.c
===================================================================
--- 2007-01-31.orig/xen/arch/x86/mm.c 2007-01-31 09:42:10.000000000 +0100
+++ 2007-01-31/xen/arch/x86/mm.c 2007-01-31 09:43:38.000000000 +0100
@@ -3248,14 +3248,15 @@ static int ptwr_emulated_update(
--- 2007-02-20.orig/xen/arch/x86/mm.c 2007-02-20 10:56:12.000000000 +0100
+++ 2007-02-20/xen/arch/x86/mm.c 2007-02-20 10:56:25.000000000 +0100
@@ -3252,14 +3252,15 @@ static int ptwr_emulated_update(
{
if ( (CONFIG_PAGING_LEVELS == 3 || IS_COMPAT(d)) &&
(bytes == 4) &&
@ -22,7 +22,7 @@ Index: 2007-01-31/xen/arch/x86/mm.c
*/
MEM_LOG("ptwr_emulate: fixing up invalid PAE PTE %"PRIpte,
l1e_get_intpte(nl1e));
@@ -3387,7 +3388,7 @@ int ptwr_do_page_fault(struct vcpu *v, u
@@ -3391,7 +3392,7 @@ int ptwr_do_page_fault(struct vcpu *v, u
(page_get_owner(page) != d) )
goto bail;

View File

@ -1,3 +1,51 @@
Index: xen-3.0.4-testing/tools/python/xen/xend/XendBootloader.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendBootloader.py
+++ xen-3.0.4-testing/tools/python/xen/xend/XendBootloader.py
@@ -14,6 +14,7 @@
import os, select, errno, stat
import random
+import re
import shlex
from xen.xend import sxp
@@ -57,6 +58,8 @@ def bootloader(blexec, disk, quiet = Fal
args.append("-q")
if dryrun:
args.append("--dryrun")
+ if kernel_args:
+ args.append("--args=%s" % kernel_args)
args.append("--output=%s" % fifo)
if blargs:
args.extend(shlex.split(blargs))
@@ -97,3 +100,26 @@ def bootloader(blexec, disk, quiet = Fal
pin.input_eof()
blcfg = pin.val
return blcfg
+
+def bootfilter(bootloader, bootloader_args, vdisk):
+ """Is this virtual disk ok to boot from?"""
+ if vdisk.endswith(':disk'):
+ vdisk = vdisk[:-5] # temporary work-around for bug 237414
+ if bootloader.endswith('domUloader.py'):
+ for arg in bootloader_args.split():
+ if arg.startswith('--entry='):
+ m = re.match(r'^([hsx]v?d[a-z])[0-9]*:[^,]*(,[^,]*)?$', arg[8:])
+ if m:
+ return vdisk == m.group(1) or vdisk == m.group(2)
+ return True
+
+def bootselector(bootloader, bootloader_args, disks):
+ """Returns the desired disk to boot from.
+ @param disks List of (pdev, vdev, ...) tuples.
+ """
+ if bootloader.endswith('domUloader.py'):
+ for disk in disks:
+ if bootfilter(bootloader, bootloader_args, disk[1]):
+ return disk
+ return disks[0]
+
Index: xen-3.0.4-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendDomainInfo.py
@ -30,45 +78,6 @@ Index: xen-3.0.4-testing/tools/python/xen/xend/XendDomainInfo.py
fn = blkdev_uname_to_file(disk)
mounted = devtype == 'tap' and not os.stat(fn).st_rdev
if mounted:
Index: xen-3.0.4-testing/tools/python/xen/xend/XendBootloader.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendBootloader.py
+++ xen-3.0.4-testing/tools/python/xen/xend/XendBootloader.py
@@ -14,6 +14,7 @@
import os, select, errno, stat
import random
+import re
import shlex
from xen.xend import sxp
@@ -97,3 +98,26 @@ def bootloader(blexec, disk, quiet = Fal
pin.input_eof()
blcfg = pin.val
return blcfg
+
+def bootfilter(bootloader, bootloader_args, vdisk):
+ """Is this virtual disk ok to boot from?"""
+ if vdisk.endswith(':disk'):
+ vdisk = vdisk[:-5] # temporary work-around for bug 237414
+ if bootloader.endswith('domUloader.py'):
+ for arg in bootloader_args.split():
+ if arg.startswith('--entry='):
+ m = re.match(r'^([hsx]v?d[a-z])[0-9]*:[^,]*(,[^,]*)?$', arg[8:])
+ if m:
+ return vdisk == m.group(1) or vdisk == m.group(2)
+ return True
+
+def bootselector(bootloader, bootloader_args, disks):
+ """Returns the desired disk to boot from.
+ @param disks List of (pdev, vdev, ...) tuples.
+ """
+ if bootloader.endswith('domUloader.py'):
+ for disk in disks:
+ if bootfilter(bootloader, bootloader_args, disk[1]):
+ return disk
+ return disks[0]
+
Index: xen-3.0.4-testing/tools/python/xen/xm/create.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xm/create.py
@ -82,7 +91,7 @@ Index: xen-3.0.4-testing/tools/python/xen/xm/create.py
from xen.util import blkif
from xen.util import security
@@ -710,14 +710,15 @@ def run_bootloader(vals, config_image):
@@ -710,16 +710,18 @@ def run_bootloader(vals, config_image):
err("Bootloader '%s' isn't executable" % vals.bootloader)
if len(vals.disk) < 1:
err("No disks configured and boot loader requested")
@ -98,5 +107,9 @@ Index: xen-3.0.4-testing/tools/python/xen/xm/create.py
+ uname = bootdisk[0]
+ file = blkif.blkdev_uname_to_file(uname)
return bootloader(vals.bootloader, file, not vals.console_autoconnect,
vals.bootargs, config_image)
- vals.bootargs, config_image)
+ vals.bootargs,
+ kernel_args = sxp.child_value(config_image, 'args'))
def make_config(vals):
"""Create the domain configuration.

View File

@ -0,0 +1,256 @@
diff -Nuar ioemu-orig/hw/ide.c ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c 2007-03-01 15:18:35.000000000 -0700
+++ b/tools/ioemu/hw/ide.c 2007-03-01 15:19:15.000000000 -0700
@@ -392,6 +392,9 @@
int type; /* see IDE_TYPE_xxx */
} PCIIDEState;
+static PCIIDEState *principal_ide_controller;
+extern FILE *logfile;
+
#define DMA_MULTI_THREAD
#ifdef DMA_MULTI_THREAD
@@ -2001,6 +2004,27 @@
ide_dummy_transfer_stop(s);
}
+void ide_unplug_harddisks(void)
+{
+ IDEState *s;
+ int i;
+
+ if (!principal_ide_controller) {
+ fprintf(logfile, "No principal controller?\n");
+ return;
+ }
+ for (i = 0; i < 4; i++) {
+ s = principal_ide_controller->ide_if + i;
+ if (!s->bs)
+ continue; /* drive not present */
+ if (s->is_cdrom)
+ continue; /* cdrom */
+ /* Is a hard disk, unplug it. */
+ s->bs = NULL;
+ ide_reset(s);
+ }
+}
+
struct partition {
uint8_t boot_ind; /* 0x80 - active */
uint8_t head; /* starting head */
@@ -2436,6 +2460,9 @@
sizeof(PCIIDEState),
-1,
NULL, NULL);
+ if (principal_ide_controller)
+ abort();
+ principal_ide_controller = d;
d->type = IDE_TYPE_CMD646;
pci_conf = d->dev.config;
pci_conf[0x00] = 0x95; // CMD646
@@ -2493,6 +2520,9 @@
NULL, NULL);
d->type = IDE_TYPE_PIIX3;
+ if (principal_ide_controller)
+ abort();
+ principal_ide_controller = d;
pci_conf = d->dev.config;
pci_conf[0x00] = 0x86; // Intel
pci_conf[0x01] = 0x80;
diff -Nuar ioemu-orig/hw/pci.c ioemu/hw/pci.c
--- a/tools/ioemu/hw/pci.c 2007-03-01 15:18:35.000000000 -0700
+++ b/tools/ioemu/hw/pci.c 2007-03-01 15:19:15.000000000 -0700
@@ -514,3 +514,24 @@
}
}
+void pci_unplug_netifs(void)
+{
+ PCIBus *bus;
+ int x;
+
+ /* We only support one PCI bus */
+ for (bus = first_bus; bus; bus = NULL) {
+ for (x = 0; x < 256; x++) {
+ if (bus->devices[x] &&
+ bus->devices[x]->config[0xa] == 0 &&
+ bus->devices[x]->config[0xb] == 2) {
+ /* Found a netif. Remove it from the bus. Note that
+ we don't free it here, since there could still be
+ references to it floating around. There are only
+ ever one or two structures leaked, and it's not
+ worth finding them all. */
+ bus->devices[x] = NULL;
+ }
+ }
+ }
+}
diff -Nuar ioemu-orig/hw/xen_platform.c ioemu/hw/xen_platform.c
--- a/tools/ioemu/hw/xen_platform.c 2007-03-01 15:18:35.000000000 -0700
+++ b/tools/ioemu/hw/xen_platform.c 2007-03-01 15:19:15.000000000 -0700
@@ -29,9 +29,36 @@
extern FILE *logfile;
+static uint32_t ioport_base;
+
static void platform_ioport_write(void *opaque, uint32_t addr, uint32_t val)
{
- return;
+ DECLARE_DOMCTL;
+ int rc;
+
+ switch (addr - ioport_base) {
+ case 0:
+ fprintf(logfile, "Init hypercall page %x, addr %x.\n", val, addr);
+ domctl.domain = (domid_t)domid;
+ domctl.u.hypercall_init.gmfn = val;
+ domctl.cmd = XEN_DOMCTL_hypercall_init;
+ rc = xc_domctl(xc_handle, &domctl);
+ fprintf(logfile, "result -> %d.\n", rc);
+ break;
+ case 4:
+ fprintf(logfile, "Disconnect IDE hard disk...\n");
+ ide_unplug_harddisks();
+ fprintf(logfile, "Disconnect netifs...\n");
+ pci_unplug_netifs();
+ fprintf(logfile, "Shutdown taps...\n");
+ net_tap_shutdown_all();
+ fprintf(logfile, "Done.\n");
+ break;
+ default:
+ fprintf(logfile, "Write to bad port %x (base %x) on evtchn device.\n",
+ addr, ioport_base);
+ break;
+ }
}
static uint32_t platform_ioport_read(void *opaque, uint32_t addr)
@@ -42,6 +69,8 @@
static void platform_ioport_map(PCIDevice *pci_dev, int region_num,
uint32_t addr, uint32_t size, int type)
{
+ ioport_base = addr;
+
register_ioport_write(addr, 16, 4, platform_ioport_write, NULL);
register_ioport_read(addr, 16, 1, platform_ioport_read, NULL);
}
diff -Nuar ioemu-orig/vl.c ioemu/vl.c
--- a/tools/ioemu/vl.c 2007-03-01 15:18:35.000000000 -0700
+++ b/tools/ioemu/vl.c 2007-03-01 15:19:15.000000000 -0700
@@ -170,6 +170,19 @@
char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
extern int domid;
+typedef struct IOHandlerRecord {
+ int fd;
+ IOCanRWHandler *fd_read_poll;
+ IOHandler *fd_read;
+ IOHandler *fd_write;
+ void *opaque;
+ /* temporary data */
+ struct pollfd *ufd;
+ struct IOHandlerRecord *next;
+} IOHandlerRecord;
+
+static IOHandlerRecord *first_io_handler;
+
char vncpasswd[64];
unsigned char challenge[AUTHCHALLENGESIZE];
@@ -3084,6 +3097,7 @@
typedef struct TAPState {
VLANClientState *vc;
int fd;
+ struct TAPState *next;
} TAPState;
static void tap_receive(void *opaque, const uint8_t *buf, int size)
@@ -3111,6 +3125,36 @@
}
}
+static TAPState *head_net_tap;
+
+void net_tap_shutdown_all(void)
+{
+ struct IOHandlerRecord **pioh, *ioh;
+
+ while (head_net_tap) {
+ pioh = &first_io_handler;
+ for (;;) {
+ ioh = *pioh;
+ if (ioh == NULL)
+ break;
+ if (ioh->fd == head_net_tap->fd) {
+ *pioh = ioh->next;
+ qemu_free(ioh);
+ break;
+ }
+ pioh = &ioh->next;
+ }
+ if (!ioh)
+ fprintf(stderr,
+ "warning: can't find iohandler for %d to close it properly.\n",
+ head_net_tap->fd);
+ close(head_net_tap->fd);
+ head_net_tap = head_net_tap->next;
+ }
+}
+
+
+
/* fd support */
static TAPState *net_tap_fd_init(VLANState *vlan, int fd)
@@ -3122,6 +3166,8 @@
return NULL;
s->fd = fd;
s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s);
+ s->next = head_net_tap;
+ head_net_tap = s;
qemu_set_fd_handler(s->fd, tap_send, NULL, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd);
return s;
@@ -4047,19 +4093,6 @@
#define MAX_IO_HANDLERS 64
-typedef struct IOHandlerRecord {
- int fd;
- IOCanRWHandler *fd_read_poll;
- IOHandler *fd_read;
- IOHandler *fd_write;
- void *opaque;
- /* temporary data */
- struct pollfd *ufd;
- struct IOHandlerRecord *next;
-} IOHandlerRecord;
-
-static IOHandlerRecord *first_io_handler;
-
/* XXX: fd_read_poll should be suppressed, but an API change is
necessary in the character devices to suppress fd_can_read(). */
int qemu_set_fd_handler2(int fd,
diff -Nuar ioemu-orig/vl.h ioemu/vl.h
--- a/tools/ioemu/vl.h 2007-03-01 15:18:35.000000000 -0700
+++ b/tools/ioemu/vl.h 2007-03-01 15:19:15.000000000 -0700
@@ -826,6 +826,7 @@
void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn);
int pmac_ide_init (BlockDriverState **hd_table,
SetIRQFunc *set_irq, void *irq_opaque, int irq);
+void ide_unplug_harddisks(void);
/* cdrom.c */
int cdrom_read_toc(int nb_sectors, uint8_t *buf, int msf, int start_track);
@@ -1268,6 +1269,8 @@
extern char domain_name[];
void destroy_hvm_domain(void);
+void net_tap_shutdown_all(void);
+void pci_unplug_netifs(void);
/* VNC Authentication */
#define AUTHCHALLENGESIZE 16

View File

@ -1,8 +1,7 @@
Index: xen-3.0.4-testing/tools/misc/xend
===================================================================
--- xen-3.0.4-testing.orig/tools/misc/xend
+++ xen-3.0.4-testing/tools/misc/xend
@@ -60,22 +60,6 @@ def hline():
diff -ru xen-3.0.4-testing.orig/tools/misc/xend xen-3.0.4-testing/tools/misc/xend
--- xen-3.0.4-testing.orig/tools/misc/xend 2006-12-14 14:49:56.000000000 -0700
+++ xen-3.0.4-testing/tools/misc/xend 2007-03-01 18:05:38.000000000 -0700
@@ -60,22 +60,6 @@
def msg(message):
print >>sys.stderr, "*" * 3, message
@ -25,7 +24,7 @@ Index: xen-3.0.4-testing/tools/misc/xend
def check_user():
"""Check that the effective user id is 0 (root).
"""
@@ -102,7 +86,6 @@ def start_blktapctrl():
@@ -102,7 +86,6 @@
def main():
try:
@ -33,16 +32,24 @@ Index: xen-3.0.4-testing/tools/misc/xend
check_user()
except CheckError:
sys.exit(1)
Index: xen-3.0.4-testing/tools/python/xen/xend/XendDomain.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendDomain.py
+++ xen-3.0.4-testing/tools/python/xen/xend/XendDomain.py
@@ -780,6 +780,8 @@ class XendDomain:
diff -ru xen-3.0.4-testing.orig/tools/python/xen/xend/XendDomain.py xen-3.0.4-testing/tools/python/xen/xend/XendDomain.py
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendDomain.py 2006-12-18 14:57:04.000000000 -0700
+++ xen-3.0.4-testing/tools/python/xen/xend/XendDomain.py 2007-03-01 18:06:31.000000000 -0700
@@ -780,6 +780,8 @@
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot save privileged domain %s" % domname)
+ if dominfo.readVm('image/ostype') == "hvm":
+ if dominfo._readVm('image/ostype') == "hvm":
+ raise XendError("Cannot save fully virtualized domains")
if dominfo.state != DOM_STATE_RUNNING:
raise XendError("Cannot suspend domain that is not running.")
@@ -1158,6 +1160,8 @@
if dominfo.getDomid() == DOM0_ID:
raise XendError("Cannot save privileged domain %i" % domid)
+ if dominfo._readVm('image/ostype') == "hvm":
+ raise XendError("Cannot save fully virtualized domains")
fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
try:

17
xen-perdomain-free.patch Normal file
View File

@ -0,0 +1,17 @@
Index: xen-3.0.4-testing/xen/arch/x86/domain.c
===================================================================
--- xen-3.0.4-testing.orig/xen/arch/x86/domain.c
+++ xen-3.0.4-testing/xen/arch/x86/domain.c
@@ -455,8 +455,10 @@ int arch_domain_create(struct domain *d)
fail:
free_xenheap_page(d->shared_info);
#ifdef __x86_64__
- free_domheap_page(virt_to_page(d->arch.mm_perdomain_l2));
- free_domheap_page(virt_to_page(d->arch.mm_perdomain_l3));
+ if (d->arch.mm_perdomain_l2)
+ free_domheap_page(virt_to_page(d->arch.mm_perdomain_l2));
+ if (d->arch.mm_perdomain_l3)
+ free_domheap_page(virt_to_page(d->arch.mm_perdomain_l3));
#endif
free_xenheap_pages(d->arch.mm_perdomain_pt, pdpt_order);
return rc;

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3253fba32b807e1dbcbc7a3622682790f2fb76a6a09f513975961c8ca43b38e1
size 124352
oid sha256:555986d5b819ceb302b46d7f185b78e21228cfdb4a14fd761c61ae3f9292fd22
size 138263

View File

@ -1,3 +1,101 @@
-------------------------------------------------------------------
Mon Mar 5 09:38:36 MST 2007 - ccoffing@novell.com
- Default apic=0 for SLES 8 and 9, for performance. (#228133)
-------------------------------------------------------------------
Fri Mar 2 16:58:06 MST 2007 - carnold@novell.com
- Xen kernel crashes at domain creation time. Bug #248183.
Fix mouse for win2k hvm guest.
-------------------------------------------------------------------
Fri Mar 2 13:15:33 MST 2007 - jfehlig@novell.com
- Incorrect values returned for actions_after_* in Xen API. Added
patch xend-actions-after.patch for fix. Patch submitted upstream
as well. Bug #250870.
-------------------------------------------------------------------
Fri Mar 2 12:08:55 MST 2007 - ccoffing@novell.com
- Update vm-install:
+ Fixed possible "tree path exception" when editing disk
+ Fixed failure to properly refresh fields when editing disk
+ #248356: allow specifying bridge
-------------------------------------------------------------------
Fri Mar 2 10:23:38 MST 2007 - jfehlig@novell.com
- Add check for HVM domain in domain_save. The check is
performed in domain_suspend and should be included here as well.
-------------------------------------------------------------------
Thu Mar 1 18:13:20 MST 2007 - ccoffing@novell.com
- Update vm-install:
+ #250201: for linux PVFB, pass xencons=tty if graphics=none
+ #250016: honor non-sparse flag
-------------------------------------------------------------------
Thu Mar 1 17:25:44 MST 2007 - jfehlig@novell.com
- Fix exception caused by incorrect method name in xen-messages.diff.
This is one of perhaps several problems with save/restore,
bug #237859
-------------------------------------------------------------------
Thu Mar 1 15:43:00 MST 2007 - dpmerrill@novell.com
- Add xen-ioemu-hvm-pv-support.diff
This patch allows for shutting down the IDE drive.
-------------------------------------------------------------------
Thu Mar 1 11:27:00 MST 2007 - jfehlig@novell.com
- Fix bug #243667
+ Updated domUloader to accept '--args' parameter. The args
provided as an option to --args are simply added to the sexpr
returned by domUloader. pygrub has similar behavior.
-------------------------------------------------------------------
Wed Feb 28 18:16:53 MST 2007 - ccoffing@novell.com
- Update vm-install:
+ #249013, #228113: default to realtek instead of pcnet
+ #249124: write os-type to config files
+ Updated translations
+ Setting os_type should implicitly set full_virt; fixes NIC
model exceptions
+ Add "Add" button to Operating System Installation page, based
on usability feedback
-------------------------------------------------------------------
Wed Feb 28 15:55:15 MST 2007 - jfehlig@novell.com
- Added changeset 13786 and 14022 from xen-unstable. These
changesets affect the Xen API C bindings only and are low risk.
This is a continuation of support for FATE feature 110320. ECO
has been approved for late arrival of this feature.
-------------------------------------------------------------------
Mon Feb 26 10:39:06 MST 2007 - ccoffing@novell.com
- Update vm-install:
+ #244772: display error message in GUI if xen isn't running
+ #246049: better error message when OS==SUSE but ISO looks wrong
+ Fix printing of jobid when run with --background
-------------------------------------------------------------------
Wed Feb 21 15:54:51 MST 2007 - ccoffing@novell.com
- Don't allow "xm create" of running VM. (#245253)
- Update vm-install:
+ Fix inability to use already-extracted SUSE kernel/initrds
+ Fix accumulation of 0-byte tmp files
+ #237063: close fds before running vncviewer
+ default apic=0 for Windows, due to performance
-------------------------------------------------------------------
Tue Feb 20 13:53:22 MST 2007 - carnold@novell.com

109
xen.spec
View File

@ -30,7 +30,7 @@ BuildRequires: glibc-32bit glibc-devel-32bit
BuildRequires: kernel-source kernel-syms xorg-x11
%endif
Version: 3.0.4_13138
Release: 5
Release: 7
License: GNU General Public License (GPL)
Group: System/Kernel
Autoreqprov: on
@ -122,15 +122,17 @@ Patch132: domheap-no-dma.patch
Patch133: 32on64-per-domain-pa-bits.patch
Patch134: 32on64-fixes.patch
Patch135: 32on64-call-gates.patch
Patch136: emul-privop-lock.patch
Patch137: hide-asm-labels.patch
Patch138: bug.patch
Patch139: x86-mm-simplify.patch
Patch140: vgacon-50-lines.patch
Patch141: vgacon-keep.patch
Patch142: x86-ptwr_emulate.patch
Patch143: pae-guest-linear-pgtable.patch
Patch136: 32on64-migrate.patch
Patch137: emul-privop-lock.patch
Patch138: hide-asm-labels.patch
Patch139: bug.patch
Patch140: x86-mm-simplify.patch
Patch141: vgacon-50-lines.patch
Patch142: vgacon-keep.patch
Patch143: x86-ptwr_emulate.patch
Patch144: suppress-rdtscp.patch
Patch145: pae-guest-linear-pgtable.patch
Patch146: x86-nmi-inject.patch
## Gerd's patches begin here
# fix cross-build for tools
Patch150: cross-build-fix.diff
@ -170,11 +172,12 @@ Patch210: microcode-xen-13079.diff
Patch211: xen-localtime.patch
Patch212: svm-update-v_tpr-on-mmio.patch
Patch213: svm_cpuid_ffxsr_13743.patch
Patch214: 13630-domctl.patch
Patch215: 13903-domctl.patch
Patch216: 13908-domctl.patch
Patch217: bugfix-246160-domctl.patch
Patch218: x86-nmi-inject.patch
Patch214: 13574-win2k-mouse.patch
Patch215: 13630-domctl.patch
Patch216: 13903-domctl.patch
Patch217: 13908-domctl.patch
Patch218: bugfix-246160-domctl.patch
Patch219: xen-perdomain-free.patch
# pv driver building
Patch250: pv-driver-build.patch
# Jim' Xen API patches
@ -198,9 +201,14 @@ Patch286: 13775_xenapi.patch
Patch287: 13777_xenapi.patch
Patch288: 13778_xenapi.patch
Patch289: 13784_xenapi.patch
Patch290: 13787_xenapi.patch
Patch291: libxen_permissive.patch
Patch292: xend_disk_decorate_rm.patch
Patch290: 13786_xenapi.patch
Patch291: 13787_xenapi.patch
Patch292: 14022_xenapi.patch
Patch293: libxen_permissive.patch
Patch294: xend_disk_decorate_rm.patch
Patch295: xend_multiple_create.patch
Patch296: xen-ioemu-hvm-pv-support.diff
Patch297: xend-actions-after.patch
# Misc unused patches / need to be re-ported:
Patch300: xen-enable-hvm-debug.diff
Patch301: xen-removable.diff
@ -658,6 +666,8 @@ cd ..
%patch142 -p1
%patch143 -p1
%patch144 -p1
%patch145 -p1
%patch146 -p1
%patch150 -p1
%patch151 -p1
%patch152 -p1
@ -691,6 +701,7 @@ cd ..
%patch216 -p1
%patch217 -p1
%patch218 -p1
%patch219 -p1
%patch250 -p1
%patch270 -p1
%patch271 -p1
@ -715,6 +726,11 @@ cd ..
%patch290 -p1
%patch291 -p1
%patch292 -p1
%patch293 -p1
%patch294 -p1
%patch295 -p1
%patch296 -p1
%patch297 -p1
XEN_EXTRAVERSION=%version-%release
XEN_EXTRAVERSION=${XEN_EXTRAVERSION#%{xvers}}
sed -i "s/XEN_EXTRAVERSION[ ]*.=.*\$/XEN_EXTRAVERSION = $XEN_EXTRAVERSION/" xen/Makefile
@ -1032,6 +1048,65 @@ rm -f $RPM_BUILD_ROOT/%pysite/*.egg-info
%{insserv_cleanup}
%changelog
* Mon Mar 05 2007 - ccoffing@novell.com
- Default apic=0 for SLES 8 and 9, for performance. (#228133)
* Fri Mar 02 2007 - carnold@novell.com
- Xen kernel crashes at domain creation time. Bug #248183.
Fix mouse for win2k hvm guest.
* Fri Mar 02 2007 - jfehlig@novell.com
- Incorrect values returned for actions_after_* in Xen API. Added
patch xend-actions-after.patch for fix. Patch submitted upstream
as well. Bug #250870.
* Fri Mar 02 2007 - ccoffing@novell.com
- Update vm-install:
+ Fixed possible "tree path exception" when editing disk
+ Fixed failure to properly refresh fields when editing disk
+ #248356: allow specifying bridge
* Fri Mar 02 2007 - jfehlig@novell.com
- Add check for HVM domain in domain_save. The check is
performed in domain_suspend and should be included here as well.
* Thu Mar 01 2007 - ccoffing@novell.com
- Update vm-install:
+ #250201: for linux PVFB, pass xencons=tty if graphics=none
+ #250016: honor non-sparse flag
* Thu Mar 01 2007 - jfehlig@novell.com
- Fix exception caused by incorrect method name in xen-messages.diff.
This is one of perhaps several problems with save/restore,
bug #237859
* Thu Mar 01 2007 - dpmerrill@novell.com
- Add xen-ioemu-hvm-pv-support.diff
This patch allows for shutting down the IDE drive.
* Thu Mar 01 2007 - jfehlig@novell.com
- Fix bug #243667
+ Updated domUloader to accept '--args' parameter. The args
provided as an option to --args are simply added to the sexpr
returned by domUloader. pygrub has similar behavior.
* Wed Feb 28 2007 - ccoffing@novell.com
- Update vm-install:
+ #249013, #228113: default to realtek instead of pcnet
+ #249124: write os-type to config files
+ Updated translations
+ Setting os_type should implicitly set full_virt; fixes NIC
model exceptions
+ Add "Add" button to Operating System Installation page, based
on usability feedback
* Wed Feb 28 2007 - jfehlig@novell.com
- Added changeset 13786 and 14022 from xen-unstable. These
changesets affect the Xen API C bindings only and are low risk.
This is a continuation of support for FATE feature 110320. ECO
has been approved for late arrival of this feature.
* Mon Feb 26 2007 - ccoffing@novell.com
- Update vm-install:
+ #244772: display error message in GUI if xen isn't running
+ #246049: better error message when OS==SUSE but ISO looks wrong
+ Fix printing of jobid when run with --background
* Wed Feb 21 2007 - ccoffing@novell.com
- Don't allow "xm create" of running VM. (#245253)
- Update vm-install:
+ Fix inability to use already-extracted SUSE kernel/initrds
+ Fix accumulation of 0-byte tmp files
+ #237063: close fds before running vncviewer
+ default apic=0 for Windows, due to performance
* Tue Feb 20 2007 - carnold@novell.com
- Domain0 reboots after 2-6 hours of running guests. (#246160)
* Tue Feb 20 2007 - ccoffing@novell.com

44
xend-actions-after.patch Normal file
View File

@ -0,0 +1,44 @@
# HG changeset patch
# User Jim Fehlig <jfehlig@novell.com>
# Date 1172864588 25200
# Node ID 9e87f7af7f21182be5080cac0e4715053529a797
# Parent 3ac19fda0bc256bac20a4decf7e13bb086162220
VM.actions_after_[shutdown|reboot|suspend|crash] were not set properly in VM record returned via Xen API.
This patch fixes typos in key name for these fields.
Signed-off-by: Jim Fehlig <jfehlig@novell.com>
diff -r 3ac19fda0bc2 -r 9e87f7af7f21 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Fri Mar 02 12:11:52 2007 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Mar 02 12:43:08 2007 -0700
@@ -2090,26 +2090,26 @@ class XendDomainInfo:
return self.info.get('tools_version', {})
def get_on_shutdown(self):
- after_shutdown = self.info.get('action_after_shutdown')
+ after_shutdown = self.info.get('actions_after_shutdown')
if not after_shutdown or after_shutdown not in XEN_API_ON_NORMAL_EXIT:
return XEN_API_ON_NORMAL_EXIT[-1]
return after_shutdown
def get_on_reboot(self):
- after_reboot = self.info.get('action_after_reboot')
+ after_reboot = self.info.get('actions_after_reboot')
if not after_reboot or after_reboot not in XEN_API_ON_NORMAL_EXIT:
return XEN_API_ON_NORMAL_EXIT[-1]
return after_reboot
def get_on_suspend(self):
# TODO: not supported
- after_suspend = self.info.get('action_after_suspend')
+ after_suspend = self.info.get('actions_after_suspend')
if not after_suspend or after_suspend not in XEN_API_ON_NORMAL_EXIT:
return XEN_API_ON_NORMAL_EXIT[-1]
return after_suspend
def get_on_crash(self):
- after_crash = self.info.get('action_after_crash')
+ after_crash = self.info.get('actions_after_crash')
if not after_crash or after_crash not in XEN_API_ON_CRASH_BEHAVIOUR:
return XEN_API_ON_CRASH_BEHAVIOUR[0]
return after_crash

View File

@ -0,0 +1,26 @@
Bugzilla #245253
Index: xen-3.0.4-testing/tools/python/xen/xend/XendDomain.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendDomain.py
+++ xen-3.0.4-testing/tools/python/xen/xend/XendDomain.py
@@ -32,6 +32,7 @@ import threading
import xen.lowlevel.xc
+from xen.xend import sxp
from xen.xend import XendRoot, XendCheckpoint, XendDomainInfo
from xen.xend.PrettyPrint import prettyprint
from xen.xend.XendConfig import XendConfig
@@ -860,6 +861,11 @@ class XendDomain:
self.domains_lock.acquire()
try:
self._refresh()
+ for domid, dom in self.domains.items():
+ if (dom.state != DOM_STATE_HALTED and
+ (dom.getName() == sxp.child_value(config, 'name') or
+ dom.get_uuid() == sxp.child_value(config, 'uuid'))):
+ raise XendError("Domain is already running")
dominfo = XendDomainInfo.create(config)
self._add_domain(dominfo)