aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.rootkeys1
-rw-r--r--BitKeeper/etc/ignore1
-rw-r--r--xen/drivers/block/xen_block.c43
-rw-r--r--xen/drivers/block/xen_segment.c36
-rw-r--r--xen/include/hypervisor-ifs/block.h3
-rw-r--r--xen/include/hypervisor-ifs/segment.h17
-rw-r--r--xen/include/xeno/segment.h6
-rw-r--r--xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_segment_proc.c32
-rw-r--r--xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h2
9 files changed, 118 insertions, 23 deletions
diff --git a/.rootkeys b/.rootkeys
index dca28d4ed4..d9bc948816 100644
--- a/.rootkeys
+++ b/.rootkeys
@@ -385,6 +385,7 @@
3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/hypervisor-ifs/hypervisor-if.h
3ead095dE_VF-QA88rl_5cWYRWtRVQ xen/include/hypervisor-ifs/kbd.h
3ddb79c2oRPrzClk3zbTkRHlpumzKA xen/include/hypervisor-ifs/network.h
+3f0d22cbroqp_BkoDPwkfRJhaw1LiQ xen/include/hypervisor-ifs/segment.h
3ddb79c4qbCoOFHrv9sCGshbWzBVlQ xen/include/scsi/scsi.h
3ddb79c4R4iVwqIIeychVQYmIH4FUg xen/include/scsi/scsi_ioctl.h
3ddb79c4yw_mfd4Uikn3v_IOPRpa1Q xen/include/scsi/scsicam.h
diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore
index cf41f0cc4e..649ecc8bf0 100644
--- a/BitKeeper/etc/ignore
+++ b/BitKeeper/etc/ignore
@@ -436,3 +436,4 @@ xen/drivers/block/xen_physdisk.c~
tools/internal/xi_phys_grant.c~
tools/internal/xi_phys_probe.c~
tools/internal/xi_phys_revoke.c~
+xen/include/hypervisor-ifs/segment.h~
diff --git a/xen/drivers/block/xen_block.c b/xen/drivers/block/xen_block.c
index d1b8d855fd..644f91254d 100644
--- a/xen/drivers/block/xen_block.c
+++ b/xen/drivers/block/xen_block.c
@@ -571,10 +571,8 @@ static void dispatch_probe_blk(struct task_struct *p, int index)
make_response(p, blk_ring->ring[index].req.id, XEN_BLOCK_PROBE_BLK, rc);
}
-static void dispatch_probe_seg_common(struct task_struct *p,
- struct task_struct *target,
- int type,
- int index)
+static void dispatch_probe_seg(struct task_struct *p,
+ int index)
{
extern void xen_segment_probe(struct task_struct *, xen_disk_info_t *);
@@ -597,22 +595,43 @@ static void dispatch_probe_seg_common(struct task_struct *p,
spin_unlock_irqrestore(&p->page_lock, flags);
xdi = phys_to_virt(buffer);
- xen_segment_probe(target, xdi);
+ xen_segment_probe(p, xdi);
unlock_buffer(p, buffer, sizeof(xen_disk_info_t), 1);
out:
- make_response(p, blk_ring->ring[index].req.id, type, rc);
-}
-
-static void dispatch_probe_seg(struct task_struct *p, int index)
-{
- dispatch_probe_seg_common(p, p, XEN_BLOCK_PROBE_SEG, index);
+ make_response(p, blk_ring->ring[index].req.id, XEN_BLOCK_PROBE_SEG, rc);
}
static void dispatch_probe_seg_all(struct task_struct *p, int index)
{
- dispatch_probe_seg_common(p, NULL, XEN_BLOCK_PROBE_SEG_ALL, index);
+ extern void xen_segment_probe_all(xen_segment_info_t *);
+
+ blk_ring_t *blk_ring = p->blk_ring_base;
+ xen_segment_info_t *xsi;
+ unsigned long flags, buffer;
+ int rc = 0;
+
+ buffer = blk_ring->ring[index].req.buffer_and_sects[0] & ~0x1FF;
+
+ spin_lock_irqsave(&p->page_lock, flags);
+ if ( !__buffer_is_valid(p, buffer, sizeof(xen_segment_info_t), 1) )
+ {
+ DPRINTK("Bad buffer in dispatch_probe_seg_all\n");
+ spin_unlock_irqrestore(&p->page_lock, flags);
+ rc = 1;
+ goto out;
+ }
+ __lock_buffer(buffer, sizeof(xen_segment_info_t), 1);
+ spin_unlock_irqrestore(&p->page_lock, flags);
+
+ xsi = phys_to_virt(buffer);
+ xen_segment_probe_all(xsi);
+
+ unlock_buffer(p, buffer, sizeof(xen_segment_info_t), 1);
+
+ out:
+ make_response(p, blk_ring->ring[index].req.id, XEN_BLOCK_PROBE_SEG_ALL, rc);
}
static void dispatch_rw_block_io(struct task_struct *p, int index)
diff --git a/xen/drivers/block/xen_segment.c b/xen/drivers/block/xen_segment.c
index c82ff39e05..87d22e04dd 100644
--- a/xen/drivers/block/xen_segment.c
+++ b/xen/drivers/block/xen_segment.c
@@ -162,7 +162,7 @@ void xen_segment_probe(struct task_struct *p, xen_disk_info_t *raw_xdi)
for ( loop = 0; loop < XEN_MAX_SEGMENTS; loop++ )
{
if ( (xsegments[loop].mode == XEN_SEGMENT_UNUSED) ||
- (p && xsegments[loop].domain != p->domain) )
+ (xsegments[loop].domain != p->domain) )
continue;
device = MK_VIRTUAL_XENDEV(xsegments[loop].segment_number);
@@ -178,6 +178,39 @@ void xen_segment_probe(struct task_struct *p, xen_disk_info_t *raw_xdi)
}
/*
+ * xen_segment_probe_all
+ *
+ * return a list of all segments to domain 0
+ */
+void xen_segment_probe_all(xen_segment_info_t *raw_xsi)
+{
+ int loop;
+ xen_segment_info_t *xsi = map_domain_mem(virt_to_phys(raw_xsi));
+ unsigned long device;
+
+ xsi->count = 0;
+ for ( loop = 0; loop < XEN_MAX_SEGMENTS; loop++ )
+ {
+ if ( xsegments[loop].mode == XEN_SEGMENT_UNUSED )
+ continue;
+
+ device = MK_VIRTUAL_XENDEV(xsegments[loop].segment_number);
+
+ printk("Doing seg %d.\n", xsi->count);
+ xsi->segments[xsi->count].device = device;
+ xsi->segments[xsi->count].domain = xsegments[loop].domain;
+ memcpy(xsi->segments[xsi->count].key,
+ xsegments[loop].key,
+ XEN_SEGMENT_KEYSIZE);
+ xsi->segments[xsi->count].seg_nr = xsegments[loop].segment_number;
+ printk("Done.\n");
+ xsi->count++;
+ }
+
+ unmap_domain_mem(xsi);
+}
+
+/*
* xen_refresh_segment_list
*
* find all segments associated with a domain and assign
@@ -230,6 +263,7 @@ int xen_segment_create(xv_disk_t *xvd_in)
xsegments[idx].mode = xvd->mode;
xsegments[idx].domain = xvd->domain;
xsegments[idx].segment_number = xvd->segment;
+ memcpy(xsegments[idx].key, xvd->key, XEN_SEGMENT_KEYSIZE);
xsegments[idx].num_extents = xvd->ext_count;
xsegments[idx].extents = (extent_t *)kmalloc(
sizeof(extent_t)*xvd->ext_count,
diff --git a/xen/include/hypervisor-ifs/block.h b/xen/include/hypervisor-ifs/block.h
index f269e57bd1..5c9a0caa77 100644
--- a/xen/include/hypervisor-ifs/block.h
+++ b/xen/include/hypervisor-ifs/block.h
@@ -135,11 +135,14 @@ typedef struct xv_extent
unsigned long size; /* size in blocks */
} xv_extent_t;
+#define XEN_SEGMENT_KEYSIZE 10
+
typedef struct xv_disk
{
int mode; /* XEN_DISK_READ_WRITE or XEN_DISK_READ_ONLY */
int domain; /* domain */
int segment; /* segment number */
+ char key[XEN_SEGMENT_KEYSIZE]; /* key for benefit of dom0 userspace */
int ext_count; /* number of xv_extent_t to follow */
xv_extent_t extents[XEN_MAX_DISK_COUNT]; /* arbitrary reuse of constant */
} xv_disk_t;
diff --git a/xen/include/hypervisor-ifs/segment.h b/xen/include/hypervisor-ifs/segment.h
new file mode 100644
index 0000000000..99b8700a19
--- /dev/null
+++ b/xen/include/hypervisor-ifs/segment.h
@@ -0,0 +1,17 @@
+#ifndef __HYP_IFS_SEGMENT_H__
+#define __HYP_IFS_SEGMENT_H__
+
+#define XEN_MAX_SEGMENTS 100 /* total number of segments across all doms */
+
+typedef struct xen_segment_info
+{
+ int count;
+ struct {
+ unsigned domain;
+ unsigned seg_nr;
+ char key[XEN_SEGMENT_KEYSIZE];
+ unsigned short device;
+ } segments[XEN_MAX_SEGMENTS];
+} xen_segment_info_t;
+
+#endif /* __HYP_IFS_SEGMENT_H__ */
diff --git a/xen/include/xeno/segment.h b/xen/include/xeno/segment.h
index f6fcbb3958..3bbd8b20bf 100644
--- a/xen/include/xeno/segment.h
+++ b/xen/include/xeno/segment.h
@@ -2,6 +2,7 @@
#define __SEGMENT_H__
#include <hypervisor-ifs/block.h>
+#include <hypervisor-ifs/segment.h>
/* Describes a physical disk extent. */
typedef struct {
@@ -11,6 +12,8 @@ typedef struct {
unsigned long buffer;
} phys_seg_t;
+struct task_struct;
+
void xen_segment_initialize(void);
void xen_refresh_segment_list (struct task_struct *p);
int xen_segment_create(xv_disk_t *xvd);
@@ -19,8 +22,6 @@ int xen_segment_map_request(
unsigned short segment_number,
unsigned long sect_nr, unsigned long buffer, unsigned short nr_sects);
-#define XEN_MAX_SEGMENTS 100 /* total number of segments across all doms */
-
/*
* virtual hard disks
*
@@ -43,6 +44,7 @@ typedef struct segment
int mode; /* UNUSED, RO, or RW */
int domain;
int segment_number; /* segment number for domain */
+ char key[XEN_SEGMENT_KEYSIZE]; /* for the userspace tools in dom0 */
int num_extents; /* number of extents */
extent_t *extents;
} segment_t;
diff --git a/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_segment_proc.c b/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_segment_proc.c
index df65e8b046..dce8a2d4bf 100644
--- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_segment_proc.c
+++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_segment_proc.c
@@ -8,6 +8,7 @@
#include <linux/proc_fs.h>
#include <linux/delay.h>
#include <linux/seq_file.h>
+#include <asm/hypervisor-ifs/segment.h>
static struct proc_dir_entry *vhd;
@@ -15,7 +16,7 @@ extern unsigned short xldev_to_physdev(kdev_t xldev);
static void *proc_vhd_next(struct seq_file *s, void *v, loff_t *pos)
{
- xen_disk_info_t *data;
+ xen_segment_info_t *data;
if ( pos != NULL )
++(*pos);
@@ -27,7 +28,7 @@ static void *proc_vhd_next(struct seq_file *s, void *v, loff_t *pos)
static void *proc_vhd_start(struct seq_file *s, loff_t *ppos)
{
loff_t pos = *ppos;
- xen_disk_info_t *data;
+ xen_segment_info_t *data;
data = kmalloc(sizeof(*data), GFP_KERNEL);
xenolinux_control_msg(XEN_BLOCK_PROBE_SEG_ALL, (char *)data, sizeof(*data));
@@ -42,13 +43,14 @@ static void *proc_vhd_start(struct seq_file *s, loff_t *ppos)
static int proc_vhd_show(struct seq_file *s, void *v)
{
- xen_disk_info_t *data = v;
+ xen_segment_info_t *data = v;
seq_printf (s,
- "%4x %4x %lx\n",
- data->disks[data->count - 1].device,
- data->disks[data->count - 1].type,
- data->disks[data->count - 1].capacity);
+ "%x %x %10.10s %x\n",
+ data->segments[data->count - 1].domain,
+ data->segments[data->count - 1].seg_nr,
+ data->segments[data->count - 1].key,
+ data->segments[data->count - 1].device);
return 0;
}
@@ -201,6 +203,22 @@ static int proc_write_vhd(struct file *file, const char *buffer,
}
xvd.segment = (int) to_number(string);
+ string = get_string(NULL); /* look for key */
+ if (string == NULL || (*string != 'k' && *string != 'K'))
+ {
+ printk (KERN_ALERT
+ "error: key specifier missing [%s]. should be \"key\".\n",
+ string);
+ goto out;
+ }
+ string = get_string(NULL);
+ if (string == NULL || strlen(string) != XEN_SEGMENT_KEYSIZE)
+ {
+ printk (KERN_ALERT "error: key missing\n");
+ goto out;
+ }
+ memcpy(xvd.key, string, XEN_SEGMENT_KEYSIZE);
+
string = get_string(NULL); /* look for Extents */
if (string == NULL || (*string != 'e' && *string != 'E'))
{
diff --git a/xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h b/xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h
index 16e5fb396d..6609be0ae2 100644
--- a/xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h
+++ b/xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h
@@ -33,4 +33,4 @@ struct dom0_dopgupdates_args
unsigned long num_pgt_updates;
};
-#endif __DOM0_H__ /* __DOM0_H__ */
+#endif /* __DOM0_H__ */