Mailing List Archive

manual merge.
ChangeSet 1.1325, 2005/03/19 20:41:04+00:00, kaf24@firebug.cl.cam.ac.uk

manual merge.



xen0_defconfig | 10 ----------
1 files changed, 10 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig
--- a/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig 2005-03-19 16:04:36 -05:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/configs/xen0_defconfig 2005-03-19 16:04:36 -05:00
@@ -900,16 +900,6 @@
# CONFIG_INFINIBAND is not set

#
-# MMC/SD Card support
-#
-# CONFIG_MMC is not set
-
-#
-# InfiniBand support
-#
-# CONFIG_INFINIBAND is not set
-
-#
# File systems
#
CONFIG_EXT2_FS=y


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-changelog
Manual merge. [ In reply to ]
ChangeSet 1.1345, 2005/03/22 11:37:00+00:00, kaf24@firebug.cl.cam.ac.uk

Manual merge.
Signed-off-by: Keir Fraser <keir@xensource.com>



0 files changed




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-changelog
Manual merge. [ In reply to ]
ChangeSet 1.1349, 2005/03/22 19:35:36+00:00, kaf24@firebug.cl.cam.ac.uk

Manual merge.



arch/x86/domain.c | 1180 +++++++++++++++++++++++++++-------------------------
common/page_alloc.c | 78 +--
common/schedule.c | 208 +++++----
3 files changed, 803 insertions(+), 663 deletions(-)


diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c 2005-03-22 15:04:20 -05:00
+++ b/xen/arch/x86/domain.c 2005-03-22 15:04:21 -05:00
@@ -19,6 +19,7 @@
#include <xen/smp.h>
#include <xen/delay.h>
#include <xen/softirq.h>
+#include <xen/grant_table.h>
#include <asm/regs.h>
#include <asm/mc146818rtc.h>
#include <asm/system.h>
@@ -33,26 +34,17 @@
#include <asm/shadow.h>
#include <xen/console.h>
#include <xen/elf.h>
+#include <asm/vmx.h>
+#include <asm/vmx_vmcs.h>
+#include <asm/msr.h>
+#include <xen/kernel.h>
+#include <public/io/ioreq.h>
#include <xen/multicall.h>

/* opt_noreboot: If true, machine will need manual reset on error. */
static int opt_noreboot = 0;
boolean_param("noreboot", opt_noreboot);

-#if !defined(CONFIG_X86_64BITMODE)
-/* No ring-3 access in initial page tables. */
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
-#else
-/* Allow ring-3 access in long mode as guest cannot use ring 1. */
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
-#endif
-#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-
-#define round_pgup(_p) (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
-#define round_pgdown(_p) ((_p)&PAGE_MASK)
-
static void default_idle(void)
{
__cli();
@@ -80,8 +72,8 @@
void startup_cpu_idle_loop(void)
{
/* Just some sanity to ensure that the scheduler is set up okay. */
- ASSERT(current->id == IDLE_DOMAIN_ID);
- domain_unpause_by_systemcontroller(current);
+ ASSERT(current->domain->id == IDLE_DOMAIN_ID);
+ domain_unpause_by_systemcontroller(current->domain);
__enter_scheduler();

/*
@@ -96,106 +88,79 @@

static long no_idt[2];
static int reboot_mode;
-int reboot_thru_bios = 0;
-
-#ifdef CONFIG_SMP
-int reboot_smp = 0;
-static int reboot_cpu = -1;
-/* shamelessly grabbed from lib/vsprintf.c for readability */
-#define is_digit(c) ((c) >= '0' && (c) <= '9')
-#endif
-

static inline void kb_wait(void)
{
int i;

- for (i=0; i<0x10000; i++)
- if ((inb_p(0x64) & 0x02) == 0)
+ for ( i = 0; i < 0x10000; i++ )
+ if ( (inb_p(0x64) & 0x02) == 0 )
break;
}

-
void machine_restart(char * __unused)
{
-#ifdef CONFIG_SMP
- int cpuid;
-#endif
+ int i;

if ( opt_noreboot )
{
printk("Reboot disabled on cmdline: require manual reset\n");
- for ( ; ; ) __asm__ __volatile__ ("hlt");
+ for ( ; ; )
+ safe_halt();
}

-#ifdef CONFIG_SMP
- cpuid = GET_APIC_ID(apic_read(APIC_ID));
-
- /* KAF: Need interrupts enabled for safe IPI. */
__sti();

- if (reboot_smp) {
-
- /* check to see if reboot_cpu is valid
- if its not, default to the BSP */
- if ((reboot_cpu == -1) ||
- (reboot_cpu > (NR_CPUS -1)) ||
- !(phys_cpu_present_map & (1<<cpuid)))
- reboot_cpu = boot_cpu_physical_apicid;
-
- reboot_smp = 0; /* use this as a flag to only go through this once*/
- /* re-run this function on the other CPUs
- it will fall though this section since we have
- cleared reboot_smp, and do the reboot if it is the
- correct CPU, otherwise it halts. */
- if (reboot_cpu != cpuid)
- smp_call_function((void *)machine_restart , NULL, 1, 0);
- }
-
- /* if reboot_cpu is still -1, then we want a tradional reboot,
- and if we are not running on the reboot_cpu,, halt */
- if ((reboot_cpu != -1) && (cpuid != reboot_cpu)) {
- for (;;)
- __asm__ __volatile__ ("hlt");
+ /* Ensure we are the boot CPU. */
+ if ( GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid )
+ {
+ smp_call_function((void *)machine_restart, NULL, 1, 0);
+ for ( ; ; )
+ safe_halt();
}
+
/*
* Stop all CPUs and turn off local APICs and the IO-APIC, so
* other OSs see a clean IRQ state.
*/
smp_send_stop();
disable_IO_APIC();
+
+#ifdef CONFIG_VMX
+ stop_vmx();
#endif

- if(!reboot_thru_bios) {
- /* rebooting needs to touch the page at absolute addr 0 */
- *((unsigned short *)__va(0x472)) = reboot_mode;
- for (;;) {
- int i;
- for (i=0; i<100; i++) {
- kb_wait();
- udelay(50);
- outb(0xfe,0x64); /* pulse reset low */
- udelay(50);
- }
- /* That didn't work - force a triple fault.. */
- __asm__ __volatile__("lidt %0": "=m" (no_idt));
- __asm__ __volatile__("int3");
+ /* Rebooting needs to touch the page at absolute address 0. */
+ *((unsigned short *)__va(0x472)) = reboot_mode;
+
+ for ( ; ; )
+ {
+ /* Pulse the keyboard reset line. */
+ for ( i = 0; i < 100; i++ )
+ {
+ kb_wait();
+ udelay(50);
+ outb(0xfe,0x64); /* pulse reset low */
+ udelay(50);
}
- }

- panic("Need to reinclude BIOS reboot code\n");
+ /* That didn't work - force a triple fault.. */
+ __asm__ __volatile__("lidt %0": "=m" (no_idt));
+ __asm__ __volatile__("int3");
+ }
}


void __attribute__((noreturn)) __machine_halt(void *unused)
{
for ( ; ; )
- __asm__ __volatile__ ( "cli; hlt" );
+ safe_halt();
}

void machine_halt(void)
{
- smp_call_function(__machine_halt, NULL, 1, 1);
+ watchdog_on = 0;
+ smp_call_function(__machine_halt, NULL, 1, 0);
__machine_halt(NULL);
}

@@ -219,158 +184,364 @@
page->u.inuse.type_info);
}

-xmem_cache_t *domain_struct_cachep;
-void __init domain_startofday(void)
+struct domain *arch_alloc_domain_struct(void)
{
- domain_struct_cachep = xmem_cache_create(
- "domain_cache", sizeof(struct domain),
- 0, SLAB_HWCACHE_ALIGN, NULL, NULL);
- if ( domain_struct_cachep == NULL )
- panic("No slab cache for domain structs.");
+ return xmalloc(struct domain);
}

-struct domain *arch_alloc_domain_struct(void)
+void arch_free_domain_struct(struct domain *d)
{
- return xmem_cache_alloc(domain_struct_cachep);
+ xfree(d);
}

-void arch_free_domain_struct(struct domain *d)
+struct exec_domain *arch_alloc_exec_domain_struct(void)
+{
+ return xmalloc(struct exec_domain);
+}
+
+void arch_free_exec_domain_struct(struct exec_domain *ed)
{
- xmem_cache_free(domain_struct_cachep, d);
+ xfree(ed);
}

void free_perdomain_pt(struct domain *d)
{
- free_xenheap_page((unsigned long)d->mm.perdomain_pt);
+ free_xenheap_page((unsigned long)d->arch.mm_perdomain_pt);
+#ifdef __x86_64__
+ free_xenheap_page((unsigned long)d->arch.mm_perdomain_l2);
+ free_xenheap_page((unsigned long)d->arch.mm_perdomain_l3);
+#endif
}

-static void continue_idle_task(struct domain *d)
+static void continue_idle_task(struct exec_domain *ed)
{
reset_stack_and_jump(idle_loop);
}

-static void continue_nonidle_task(struct domain *d)
+static void continue_nonidle_task(struct exec_domain *ed)
{
reset_stack_and_jump(ret_from_intr);


-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-changelog
Manual merge. [ In reply to ]
ChangeSet 1.1362, 2005/03/24 17:27:22+00:00, kaf24@firebug.cl.cam.ac.uk

Manual merge.
Signed-off-by: Keir Fraser <keir@xensource.com>



time.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 76 insertions(+), 6 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c 2005-03-24 13:02:55 -05:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c 2005-03-24 13:02:55 -05:00
@@ -47,6 +47,7 @@
#include <linux/efi.h>
#include <linux/mca.h>
#include <linux/sysctl.h>
+#include <linux/percpu.h>

#include <asm/io.h>
#include <asm/smp.h>
@@ -94,7 +95,6 @@
u64 shadow_system_time;
static u32 shadow_time_version;
static struct timeval shadow_tv;
-extern u64 processed_system_time;

/*
* We use this to ensure that gettimeofday() is monotonically increasing. We
@@ -112,6 +112,7 @@

/* Keep track of last time we did processing/updating of jiffies and xtime. */
u64 processed_system_time; /* System time (ns) at last processing. */
+DEFINE_PER_CPU(u64, processed_system_time);

#define NS_PER_TICK (1000000000ULL/HZ)

@@ -404,11 +405,9 @@
delta -= NS_PER_TICK;
processed_system_time += NS_PER_TICK;
do_timer(regs);
-#ifndef CONFIG_SMP
update_process_times(user_mode(regs));
-#endif
if (regs)
- profile_tick(CPU_PROFILING, regs);
+ profile_tick(CPU_PROFILING, regs);
}

/*
@@ -674,18 +673,28 @@
u64 alarm = 0;
int ret = 0;
unsigned long j;
+#ifdef CONFIG_SMP
+ unsigned long seq;
+#endif

/*
* This is safe against long blocking (since calculations are
* not based on TSC deltas). It is also safe against warped
* system time since suspend-resume is cooperative and we
- * would first get locked out. It is safe against normal
- * updates of jiffies since interrupts are off.
+ * would first get locked out.
*/
+#ifdef CONFIG_SMP
+ do {
+ seq = read_seqbegin(&xtime_lock);
+ j = jiffies + 1;
+ alarm = __jiffies_to_st(j);
+ } while (read_seqretry(&xtime_lock, seq));
+#else
j = next_timer_interrupt();
if (j < (jiffies + 1))
j = jiffies + 1;
alarm = __jiffies_to_st(j);
+#endif

/* Failure is pretty bad, but we'd best soldier on. */
if ( HYPERVISOR_set_timer_op(alarm) != 0 )
@@ -717,6 +726,67 @@
/* Make sure we resync UTC time with Xen on next timer interrupt. */
last_update_from_xen = 0;
}
+
+#ifdef CONFIG_SMP
+
+static irqreturn_t local_timer_interrupt(int irq, void *dev_id,
+ struct pt_regs *regs)
+{
+ s64 delta;
+ int cpu = smp_processor_id();
+
+ do {
+ __get_time_values_from_xen();
+
+ delta = (s64)(shadow_system_time +
+ ((s64)cur_timer->get_offset() *
+ (s64)NSEC_PER_USEC) -
+ per_cpu(processed_system_time, cpu));
+ }
+ while (!TIME_VALUES_UP_TO_DATE);
+
+ if (unlikely(delta < 0)) {
+ printk("Timer ISR/%d: Time went backwards: %lld %lld %lld %lld\n",
+ cpu, delta, shadow_system_time,
+ ((s64)cur_timer->get_offset() * (s64)NSEC_PER_USEC),
+ processed_system_time);
+ return IRQ_HANDLED;
+ }
+
+ /* Process elapsed jiffies since last call. */
+ while (delta >= NS_PER_TICK) {
+ delta -= NS_PER_TICK;
+ per_cpu(processed_system_time, cpu) += NS_PER_TICK;
+ if (regs)
+ update_process_times(user_mode(regs));
+#if 0
+ if (regs)
+ profile_tick(CPU_PROFILING, regs);
+#endif
+ }
+
+ return IRQ_HANDLED;
+}
+
+static struct irqaction local_irq_timer = {
+ local_timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "ltimer",
+ NULL, NULL
+};
+
+void local_setup_timer(void)
+{
+ int seq, time_irq;
+ int cpu = smp_processor_id();
+
+ do {
+ seq = read_seqbegin(&xtime_lock);
+ per_cpu(processed_system_time, cpu) = shadow_system_time;
+ } while (read_seqretry(&xtime_lock, seq));
+
+ time_irq = bind_virq_to_irq(VIRQ_TIMER);
+ (void)setup_irq(time_irq, &local_irq_timer);
+}
+#endif

/*
* /proc/sys/xen: This really belongs in another file. It can stay here for


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-changelog
Manual merge. [ In reply to ]
ChangeSet 1.1372, 2005/03/25 23:37:13+00:00, kaf24@firebug.cl.cam.ac.uk

Manual merge.



0 files changed




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-changelog
Manual merge. [ In reply to ]
ChangeSet 1.1373, 2005/03/25 23:38:21+00:00, kaf24@firebug.cl.cam.ac.uk

Manual merge.



Makefile | 2 ++
1 files changed, 2 insertions(+)


diff -Nru a/tools/Makefile b/tools/Makefile
--- a/tools/Makefile 2005-03-25 19:06:42 -05:00
+++ b/tools/Makefile 2005-03-25 19:06:42 -05:00
@@ -9,6 +9,8 @@
SUBDIRS += xentrace
SUBDIRS += python
SUBDIRS += xfrd
+SUBDIRS += xcs
+SUBDIRS += ioemu

.PHONY: all install clean check check_clean



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xen-changelog
manual merge. [ In reply to ]
ChangeSet 1.1414, 2005/03/31 22:56:15+01:00, kaf24@firebug.cl.cam.ac.uk

manual merge.



blkback.c | 79 ++++++++----
common.h | 43 ++----
vbd.c | 406 +++++++-------------------------------------------------------
3 files changed, 127 insertions(+), 401 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c 2005-03-31 17:03:17 -05:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c 2005-03-31 17:03:17 -05:00
@@ -11,6 +11,7 @@
*/

#include "common.h"
+#include <asm-xen/evtchn.h>

/*
* These are rather arbitrary. They are fairly large because adjacent requests
@@ -75,6 +76,18 @@
}
#endif

+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
+/*
+ * If the tap driver is used, we may get pages belonging to either the tap
+ * or (more likely) the real frontend. The backend must specify which domain
+ * a given page belongs to in update_va_mapping though. For the moment,
+ * the tap rewrites the ID field of the request to contain the request index
+ * and the id of the real front end domain.
+ */
+#define BLKTAP_COOKIE 0xbeadfeed
+static inline domid_t ID_TO_DOM(unsigned long id) { return (id >> 16); }
+#endif
+
static int do_block_io_op(blkif_t *blkif, int max_to_do);
static void dispatch_probe(blkif_t *blkif, blkif_request_t *req);
static void dispatch_rw_block_io(blkif_t *blkif, blkif_request_t *req);
@@ -89,12 +102,12 @@
for ( i = 0; i < nr_pages; i++ )
{
mcl[i].op = __HYPERVISOR_update_va_mapping;
- mcl[i].args[0] = MMAP_VADDR(idx, i) >> PAGE_SHIFT;
+ mcl[i].args[0] = MMAP_VADDR(idx, i);
mcl[i].args[1] = 0;
mcl[i].args[2] = 0;
}

- mcl[nr_pages-1].args[2] = UVMF_FLUSH_TLB;
+ mcl[nr_pages-1].args[2] = UVMF_TLB_FLUSH_ALL;
if ( unlikely(HYPERVISOR_multicall(mcl, nr_pages) != 0) )
BUG();
}
@@ -278,17 +291,16 @@

static int do_block_io_op(blkif_t *blkif, int max_to_do)
{
- blkif_ring_t *blk_ring = blkif->blk_ring_base;
+ blkif_back_ring_t *blk_ring = &blkif->blk_ring;
blkif_request_t *req;
- BLKIF_RING_IDX i, rp;
+ RING_IDX i, rp;
int more_to_do = 0;

- rp = blk_ring->req_prod;
+ rp = blk_ring->sring->req_prod;
rmb(); /* Ensure we see queued requests up to 'rp'. */

- /* Take items off the comms ring, taking care not to overflow. */
- for ( i = blkif->blk_req_cons;
- (i != rp) && ((i-blkif->blk_resp_prod) != BLKIF_RING_SIZE);
+ for ( i = blk_ring->req_cons;
+ (i != rp) && !RING_REQUEST_CONS_OVERFLOW(blk_ring, i);
i++ )
{
if ( (max_to_do-- == 0) || (NR_PENDING_REQS == MAX_PENDING_REQS) )
@@ -297,7 +309,7 @@
break;
}

- req = &blk_ring->ring[MASK_BLKIF_IDX(i)].req;
+ req = RING_GET_REQUEST(blk_ring, i);
switch ( req->operation )
{
case BLKIF_OP_READ:
@@ -311,14 +323,13 @@

default:
DPRINTK("error: unknown block io operation [%d]\n",
- blk_ring->ring[i].req.operation);
- make_response(blkif, blk_ring->ring[i].req.id,
- blk_ring->ring[i].req.operation, BLKIF_RSP_ERROR);
+ req->operation);
+ make_response(blkif, req->id, req->operation, BLKIF_RSP_ERROR);
break;
}
}

- blkif->blk_req_cons = i;
+ blk_ring->req_cons = i;
return more_to_do;
}

@@ -336,12 +347,29 @@
(blkif_last_sect(req->frame_and_sects[0]) != 7) )
goto out;

+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
+ /* Grab the real frontend out of the probe message. */
+ if (req->frame_and_sects[1] == BLKTAP_COOKIE)
+ blkif->is_blktap = 1;
+#endif
+
+
+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
if ( HYPERVISOR_update_va_mapping_otherdomain(
- MMAP_VADDR(pending_idx, 0) >> PAGE_SHIFT,
+ MMAP_VADDR(pending_idx, 0),
(pte_t) { (req->frame_and_sects[0] & PAGE_MASK) | __PAGE_KERNEL },
- 0, blkif->domid) )
+ 0, (blkif->is_blktap ? ID_TO_DOM(req->id) : blkif->domid) ) )
+
goto out;
-
+#else
+ if ( HYPERVISOR_update_va_mapping_otherdomain(
+ MMAP_VADDR(pending_idx, 0),
+ (pte_t) { (req->frame_and_sects[0] & PAGE_MASK) | __PAGE_KERNEL },
+ 0, blkif->domid) )
+
+ goto out;
+#endif
+
rsp = vbd_probe(blkif, (vdisk_t *)MMAP_VADDR(pending_idx, 0),
PAGE_SIZE / sizeof(vdisk_t));

@@ -421,11 +449,14 @@
for ( i = 0; i < nr_psegs; i++ )
{
mcl[i].op = __HYPERVISOR_update_va_mapping_otherdomain;
- mcl[i].args[0] = MMAP_VADDR(pending_idx, i) >> PAGE_SHIFT;
+ mcl[i].args[0] = MMAP_VADDR(pending_idx, i);
mcl[i].args[1] = (phys_seg[i].buffer & PAGE_MASK) | remap_prot;
mcl[i].args[2] = 0;
+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
+ mcl[i].args[3] = (blkif->is_blktap) ? ID_TO_DOM(req->id) : blkif->domid;
+#else
mcl[i].args[3] = blkif->domid;
-
+#endif
phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
FOREIGN_FRAME(phys_seg[i].buffer >> PAGE_SHIFT);
}
@@ -543,16 +574,17 @@
{
blkif_response_t *resp;
unsigned long flags;
+ blkif_back_ring_t *blk_ring = &blkif->blk_ring;

/* Place on the response ring for the relevant domain. */
spin_lock_irqsave(&blkif->blk_ring_lock, flags);
- resp = &blkif->blk_ring_base->
- ring[MASK_BLKIF_IDX(blkif->blk_resp_prod)].resp;
+ resp = RING_GET_RESPONSE(blk_ring, blk_ring->rsp_prod_pvt);
resp->id = id;
resp->operation = op;
resp->status = st;
wmb(); /* Ensure other side can see the response fields. */
- blkif->blk_ring_base->resp_prod = ++blkif->blk_resp_prod;
+ blk_ring->rsp_prod_pvt++;
+ RING_PUSH_RESPONSES(blk_ring);
spin_unlock_irqrestore(&blkif->blk_ring_lock, flags);

/* Kick the relevant domain. */
@@ -596,7 +628,10 @@
#endif

blkif_ctrlif_init();
-
+
+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
+ printk(KERN_ALERT "NOTE: Blkif backend is running with tap support on!\n");
+#endif
return 0;
}

diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/blkback/common.h b/linux-2.6.11-xen-sparse/drivers/xen/blkback/common.h
--- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/common.h 2005-03-31 17:03:17 -05:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/common.h 2005-03-31 17:03:17 -05:00
@@ -15,6 +15,7 @@
#include <asm-xen/ctrl_if.h>
#include <asm-xen/hypervisor.h>
#include <asm-xen/xen-public/io/blkif.h>
+#include <asm-xen/xen-public/io/ring.h>

#if 0
#define ASSERT(_p) \
@@ -36,19 +37,17 @@

typedef struct blkif_st {
/* Unique identifier for this interface. */
- domid_t domid;
- unsigned int handle;
+ domid_t domid;
+ unsigned int handle;
/* Physical parameters of the comms window. */
- unsigned long shmem_frame;
- unsigned int evtchn;
- int irq;
+ unsigned long shmem_frame;
+ unsigned int evtchn;
+ int irq;
/* Comms information. */
- blkif_ring_t *blk_ring_base; /* ioremap()'ed ptr to shmem_frame. */
- BLKIF_RING_IDX blk_req_cons; /* Request consumer. */
- BLKIF_RING_IDX blk_resp_prod; /* Private version of resp. producer. */
+ blkif_back_ring_t blk_ring;
/* VBDs attached to this interface. */
- rb_root_t vbd_rb; /* Mapping from 16-bit vdevices to VBDs. */
- spinlock_t vbd_lock; /* Protects VBD mapping. */
+ rb_root_t vbd_rb; /* Mapping from 16-bit vdevices to VBDs.*/
+ spinlock_t vbd_lock; /* Protects VBD mapping. */
/* Private fields. */
enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
/*
@@ -56,6 +55,10 @@
* We therefore need to store the id from the original request.
*/
u8 disconnect_rspid;
+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
+ /* Is this a blktap frontend */
+ unsigned int is_blktap;
+#endif
struct blkif_st *hash_next;
struct list_head blkdev_list;
spinlock_t blk_ring_lock;
@@ -77,24 +80,16 @@
blkif_disconnect_complete(_b); \
} while (0)

-/* An entry in a list of xen_extents. */
-typedef struct _blkif_extent_le {
- blkif_extent_t extent; /* an individual extent */
- struct _blkif_extent_le *next; /* and a pointer to the next */
- struct block_device *bdev;
-} blkif_extent_le_t;
-
typedef struct _vbd {
- blkif_vdev_t vdevice; /* what the domain refers to this vbd as */
- unsigned char readonly; /* Non-zero -> read-only */
- unsigned char type; /* VDISK_TYPE_xxx */
- blkif_extent_le_t *extents; /* list of xen_extents making up this vbd */
- rb_node_t rb; /* for linking into R-B tree lookup struct */
+ blkif_vdev_t vdevice; /* what the domain refers to this vbd as */
+ unsigned char readonly; /* Non-zero -> read-only */
+ unsigned char type; /* VDISK_TYPE_xxx */
+ blkif_pdev_t pdevice; /* phys device that this vbd maps to */
+ struct block_device *bdev;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog
Manual merge. [ In reply to ]
ChangeSet 1.1296, 2005/04/14 21:53:24+01:00, kaf24@firebug.cl.cam.ac.uk

Manual merge.



b/xen/arch/x86/mm.c | 2946 +++++++++++++++++++++++++++++++++++++++++++
b/xen/common/grant_table.c | 940 +++++++++++--
b/xen/include/asm-x86/page.h | 240 +--
xen/arch/x86/memory.c | 2399 -----------------------------------
4 files changed, 3824 insertions(+), 2701 deletions(-)


diff -Nru a/xen/arch/x86/memory.c b/xen/arch/x86/memory.c
--- a/xen/arch/x86/memory.c 2005-04-14 17:03:22 -04:00
+++ /dev/null Wed Dec 31 16:00:00 196900
@@ -1,2399 +0,0 @@
-/******************************************************************************
- * arch/x86/memory.c
- *
- * Copyright (c) 2002-2004 K A Fraser
- * Copyright (c) 2004 Christian Limpach
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * A description of the x86 page table API:
- *
- * Domains trap to do_mmu_update with a list of update requests.
- * This is a list of (ptr, val) pairs, where the requested operation
- * is *ptr = val.
- *
- * Reference counting of pages:
- * ----------------------------
- * Each page has two refcounts: tot_count and type_count.
- *
- * TOT_COUNT is the obvious reference count. It counts all uses of a
- * physical page frame by a domain, including uses as a page directory,
- * a page table, or simple mappings via a PTE. This count prevents a
- * domain from releasing a frame back to the free pool when it still holds
- * a reference to it.
- *
- * TYPE_COUNT is more subtle. A frame can be put to one of three
- * mutually-exclusive uses: it might be used as a page directory, or a
- * page table, or it may be mapped writable by the domain [.of course, a
- * frame may not be used in any of these three ways!].
- * So, type_count is a count of the number of times a frame is being
- * referred to in its current incarnation. Therefore, a page can only
- * change its type when its type count is zero.
- *
- * Pinning the page type:
- * ----------------------
- * The type of a page can be pinned/unpinned with the commands
- * MMUEXT_[UN]PIN_L?_TABLE. Each page can be pinned exactly once (that is,
- * pinning is not reference counted, so it can't be nested).
- * This is useful to prevent a page's type count falling to zero, at which
- * point safety checks would need to be carried out next time the count
- * is increased again.
- *
- * A further note on writable page mappings:
- * -----------------------------------------
- * For simplicity, the count of writable mappings for a page may not
- * correspond to reality. The 'writable count' is incremented for every
- * PTE which maps the page with the _PAGE_RW flag set. However, for
- * write access to be possible the page directory entry must also have
- * its _PAGE_RW bit set. We do not check this as it complicates the
- * reference counting considerably [.consider the case of multiple
- * directory entries referencing a single page table, some with the RW
- * bit set, others not -- it starts getting a bit messy].
- * In normal use, this simplification shouldn't be a problem.
- * However, the logic can be added if required.
- *
- * One more note on read-only page mappings:
- * -----------------------------------------
- * We want domains to be able to map pages for read-only access. The
- * main reason is that page tables and directories should be readable
- * by a domain, but it would not be safe for them to be writable.
- * However, domains have free access to rings 1 & 2 of the Intel
- * privilege model. In terms of page protection, these are considered
- * to be part of 'supervisor mode'. The WP bit in CR0 controls whether
- * read-only restrictions are respected in supervisor mode -- if the
- * bit is clear then any mapped page is writable.
- *
- * We get round this by always setting the WP bit and disallowing
- * updates to it. This is very unlikely to cause a problem for guest
- * OS's, which will generally use the WP bit to simplify copy-on-write
- * implementation (in that case, OS wants a fault when it writes to
- * an application-supplied buffer).
- */
-
-#include <xen/config.h>
-#include <xen/init.h>
-#include <xen/kernel.h>
-#include <xen/lib.h>
-#include <xen/mm.h>
-#include <xen/sched.h>
-#include <xen/errno.h>
-#include <xen/perfc.h>
-#include <xen/irq.h>
-#include <xen/softirq.h>
-#include <asm/shadow.h>
-#include <asm/page.h>
-#include <asm/flushtlb.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include <asm/domain_page.h>
-#include <asm/ldt.h>
-#include <asm/e820.h>
-
-#ifdef VERBOSE
-#define MEM_LOG(_f, _a...) \
- printk("DOM%u: (file=memory.c, line=%d) " _f "\n", \
- current->id , __LINE__ , ## _a )
-#else
-#define MEM_LOG(_f, _a...) ((void)0)
-#endif
-
-static int alloc_l2_table(struct pfn_info *page);
-static int alloc_l1_table(struct pfn_info *page);
-static int get_page_from_pagenr(unsigned long page_nr, struct domain *d);
-static int get_page_and_type_from_pagenr(unsigned long page_nr,
- u32 type,
- struct domain *d);
-
-static void free_l2_table(struct pfn_info *page);
-static void free_l1_table(struct pfn_info *page);
-
-static int mod_l2_entry(l2_pgentry_t *, l2_pgentry_t, unsigned long);
-static int mod_l1_entry(l1_pgentry_t *, l1_pgentry_t);
-
-/* Used to defer flushing of memory structures. */
-static struct {
-#define DOP_FLUSH_TLB (1<<0) /* Flush the TLB. */
-#define DOP_RELOAD_LDT (1<<1) /* Reload the LDT shadow mapping. */
- unsigned long deferred_ops;
- /* If non-NULL, specifies a foreign subject domain for some operations. */
- struct domain *foreign;
-} __cacheline_aligned percpu_info[NR_CPUS];
-
-/*
- * Returns the current foreign domain; defaults to the currently-executing
- * domain if a foreign override hasn't been specified.
- */
-#define FOREIGNDOM (percpu_info[smp_processor_id()].foreign ? : current)
-
-/* Private domain structs for DOMID_XEN and DOMID_IO. */
-static struct domain *dom_xen, *dom_io;
-
-/* Frame table and its size in pages. */
-struct pfn_info *frame_table;
-unsigned long frame_table_size;
-unsigned long max_page;
-
-void __init init_frametable(void)
-{
- unsigned long i, p;
-
- frame_table = (struct pfn_info *)FRAMETABLE_VIRT_START;
- frame_table_size = max_page * sizeof(struct pfn_info);
- frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK;
-
- for ( i = 0; i < frame_table_size; i += (4UL << 20) )
- {
- p = alloc_boot_pages(min(frame_table_size - i, 4UL << 20), 4UL << 20);
- if ( p == 0 )
- panic("Not enough memory for frame table\n");
- idle_pg_table[(FRAMETABLE_VIRT_START + i) >> L2_PAGETABLE_SHIFT] =
- mk_l2_pgentry(p | __PAGE_HYPERVISOR | _PAGE_PSE);
- }
-
- memset(frame_table, 0, frame_table_size);
-}
-
-void arch_init_memory(void)
-{
- unsigned long i, j, pfn, nr_pfns;
- struct pfn_info *page;
-
- /*
- * We are rather picky about the layout of 'struct pfn_info'. The
- * count_info and domain fields must be adjacent, as we perform atomic
- * 64-bit operations on them. Also, just for sanity, we assert the size
- * of the structure here.
- */
- if ( (offsetof(struct pfn_info, u.inuse.domain) !=
- (offsetof(struct pfn_info, count_info) + sizeof(u32))) ||
- (sizeof(struct pfn_info) != 24) )
- {
- printk("Weird pfn_info layout (%ld,%ld,%d)\n",
- offsetof(struct pfn_info, count_info),
- offsetof(struct pfn_info, u.inuse.domain),
- sizeof(struct pfn_info));
- for ( ; ; ) ;
- }
-
- memset(percpu_info, 0, sizeof(percpu_info));
-
- /* Initialise to a magic of 0x55555555 so easier to spot bugs later. */
- memset(machine_to_phys_mapping, 0x55, 4<<20);
-
- /*
- * Initialise our DOMID_XEN domain.
- * Any Xen-heap pages that we will allow to be mapped will have
- * their domain field set to dom_xen.
- */
- dom_xen = alloc_domain_struct();
- atomic_set(&dom_xen->refcnt, 1);
- dom_xen->id = DOMID_XEN;
-
- /*
- * Initialise our DOMID_IO domain.
- * This domain owns I/O pages that are within the range of the pfn_info
- * array. Mappings occur at the priv of the caller.
- */
- dom_io = alloc_domain_struct();
- atomic_set(&dom_io->refcnt, 1);
- dom_io->id = DOMID_IO;
-
- /* M2P table is mappable read-only by privileged domains. */
- for ( i = 0; i < 1024; i++ )
- {
- /* Ensure it's mapped read-only by guests (use GDT type). */
- page = &frame_table[m2p_start_mfn+i];
- page->count_info = PGC_allocated | 1;
- page->u.inuse.type_info = PGT_gdt_page | PGT_validated | 1;
- page->u.inuse.domain = dom_xen;
- }
-
- /* First 1MB of RAM is historically marked as I/O. */
- for ( i = 0; i < 0x100; i++ )
- {
- page = &frame_table[i];
- page->count_info = PGC_allocated | 1;
- page->u.inuse.type_info = PGT_writable_page | PGT_validated | 1;
- page->u.inuse.domain = dom_io;
- }
-
- /* Any non-RAM areas in the e820 map are considered to be for I/O. */
- for ( i = 0; i < e820.nr_map; i++ )
- {
- if ( e820.map[i].type == E820_RAM )
- continue;
- pfn = e820.map[i].addr >> PAGE_SHIFT;
- nr_pfns = (e820.map[i].size +
- (e820.map[i].addr & ~PAGE_MASK) +
- ~PAGE_MASK) >> PAGE_SHIFT;
- for ( j = 0; j < nr_pfns; j++ )
- {
- if ( !pfn_valid(pfn+j) )
- continue;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog