ia64/xen-unstable

changeset 6329:473af43ac65b

Remove option for running block devices without grant-tables.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Mon Aug 22 10:20:58 2005 +0000 (2005-08-22)
parents b6ededee6dc9
children 531ad4bde8f2
files linux-2.6-xen-sparse/arch/xen/Kconfig linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6-xen-sparse/drivers/xen/blkback/common.h linux-2.6-xen-sparse/drivers/xen/blkback/interface.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c xen/include/public/io/blkif.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/Kconfig	Sun Aug 21 17:06:08 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/Kconfig	Mon Aug 22 10:20:58 2005 +0000
     1.3 @@ -61,15 +61,6 @@ config XEN_BLKDEV_TAP_BE
     1.4            with the blktap.  This option will be removed as the block drivers are
     1.5            modified to use grant tables.
     1.6  
     1.7 -config XEN_BLKDEV_GRANT
     1.8 -        bool "Grant table substrate for block drivers"
     1.9 -        depends on !XEN_BLKDEV_TAP_BE
    1.10 -        default y
    1.11 -        help
    1.12 -          This introduces the use of grant tables as a data exhange mechanism
    1.13 -          between the frontend and backend block drivers. This currently
    1.14 -          conflicts with the block tap.
    1.15 -
    1.16  config XEN_NETDEV_BACKEND
    1.17  	bool "Network-device backend driver"
    1.18  	depends on XEN_PHYSDEV_ACCESS
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Sun Aug 21 17:06:08 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32	Mon Aug 22 10:20:58 2005 +0000
     2.3 @@ -14,7 +14,6 @@ CONFIG_XEN_PRIVILEGED_GUEST=y
     2.4  CONFIG_XEN_PHYSDEV_ACCESS=y
     2.5  CONFIG_XEN_BLKDEV_BACKEND=y
     2.6  # CONFIG_XEN_BLKDEV_TAP_BE is not set
     2.7 -CONFIG_XEN_BLKDEV_GRANT=y
     2.8  CONFIG_XEN_NETDEV_BACKEND=y
     2.9  CONFIG_XEN_BLKDEV_FRONTEND=y
    2.10  CONFIG_XEN_NETDEV_FRONTEND=y
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Sun Aug 21 17:06:08 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Mon Aug 22 10:20:58 2005 +0000
     3.3 @@ -14,7 +14,6 @@ CONFIG_XEN_PRIVILEGED_GUEST=y
     3.4  CONFIG_XEN_PHYSDEV_ACCESS=y
     3.5  CONFIG_XEN_BLKDEV_BACKEND=y
     3.6  # CONFIG_XEN_BLKDEV_TAP_BE is not set
     3.7 -CONFIG_XEN_BLKDEV_GRANT=y
     3.8  CONFIG_XEN_NETDEV_BACKEND=y
     3.9  CONFIG_XEN_BLKDEV_FRONTEND=y
    3.10  CONFIG_XEN_NETDEV_FRONTEND=y
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Sun Aug 21 17:06:08 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32	Mon Aug 22 10:20:58 2005 +0000
     4.3 @@ -12,7 +12,6 @@ CONFIG_NO_IDLE_HZ=y
     4.4  #
     4.5  # CONFIG_XEN_PRIVILEGED_GUEST is not set
     4.6  # CONFIG_XEN_PHYSDEV_ACCESS is not set
     4.7 -CONFIG_XEN_BLKDEV_GRANT=y
     4.8  CONFIG_XEN_BLKDEV_FRONTEND=y
     4.9  CONFIG_XEN_NETDEV_FRONTEND=y
    4.10  CONFIG_XEN_NETDEV_GRANT_TX=y
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Sun Aug 21 17:06:08 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64	Mon Aug 22 10:20:58 2005 +0000
     5.3 @@ -12,7 +12,6 @@ CONFIG_NO_IDLE_HZ=y
     5.4  #
     5.5  # CONFIG_XEN_PRIVILEGED_GUEST is not set
     5.6  # CONFIG_XEN_PHYSDEV_ACCESS is not set
     5.7 -CONFIG_XEN_BLKDEV_GRANT=y
     5.8  CONFIG_XEN_BLKDEV_FRONTEND=y
     5.9  CONFIG_XEN_NETDEV_FRONTEND=y
    5.10  CONFIG_XEN_NETDEV_GRANT_TX=y
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Sun Aug 21 17:06:08 2005 +0000
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Mon Aug 22 10:20:58 2005 +0000
     6.3 @@ -14,7 +14,6 @@ CONFIG_XEN_PRIVILEGED_GUEST=y
     6.4  CONFIG_XEN_PHYSDEV_ACCESS=y
     6.5  CONFIG_XEN_BLKDEV_BACKEND=y
     6.6  # CONFIG_XEN_BLKDEV_TAP_BE is not set
     6.7 -CONFIG_XEN_BLKDEV_GRANT=y
     6.8  CONFIG_XEN_NETDEV_BACKEND=y
     6.9  CONFIG_XEN_BLKDEV_FRONTEND=y
    6.10  CONFIG_XEN_NETDEV_FRONTEND=y
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64	Sun Aug 21 17:06:08 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64	Mon Aug 22 10:20:58 2005 +0000
     7.3 @@ -14,7 +14,6 @@ CONFIG_XEN_PRIVILEGED_GUEST=y
     7.4  CONFIG_XEN_PHYSDEV_ACCESS=y
     7.5  CONFIG_XEN_BLKDEV_BACKEND=y
     7.6  # CONFIG_XEN_BLKDEV_TAP_BE is not set
     7.7 -CONFIG_XEN_BLKDEV_GRANT=y
     7.8  CONFIG_XEN_NETDEV_BACKEND=y
     7.9  CONFIG_XEN_BLKDEV_FRONTEND=y
    7.10  CONFIG_XEN_NETDEV_FRONTEND=y
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Sun Aug 21 17:06:08 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Mon Aug 22 10:20:58 2005 +0000
     8.3 @@ -143,13 +143,8 @@ static int __do_suspend(void *ignore)
     8.4  #define usbif_resume() do{}while(0)
     8.5  #endif
     8.6  
     8.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
     8.8      extern int gnttab_suspend(void);
     8.9      extern int gnttab_resume(void);
    8.10 -#else
    8.11 -#define gnttab_suspend() do{}while(0)
    8.12 -#define gnttab_resume()  do{}while(0)
    8.13 -#endif
    8.14  
    8.15  #ifdef CONFIG_SMP
    8.16      extern void smp_suspend(void);
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sun Aug 21 17:06:08 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Mon Aug 22 10:20:58 2005 +0000
     9.3 @@ -80,7 +80,6 @@ static inline void flush_plugged_queue(v
     9.4  }
     9.5  #endif
     9.6  
     9.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
     9.8  /* When using grant tables to map a frame for device access then the
     9.9   * handle returned must be used to unmap the frame. This is needed to
    9.10   * drop the ref count on the frame.
    9.11 @@ -89,7 +88,6 @@ static u16 pending_grant_handles[MMAP_PA
    9.12  #define pending_handle(_idx, _i) \
    9.13      (pending_grant_handles[((_idx) * BLKIF_MAX_SEGMENTS_PER_REQUEST) + (_i)])
    9.14  #define BLKBACK_INVALID_HANDLE (0xFFFF)
    9.15 -#endif
    9.16  
    9.17  #ifdef CONFIG_XEN_BLKDEV_TAP_BE
    9.18  /*
    9.19 @@ -110,7 +108,6 @@ static void make_response(blkif_t *blkif
    9.20  
    9.21  static void fast_flush_area(int idx, int nr_pages)
    9.22  {
    9.23 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    9.24      struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    9.25      unsigned int i, invcount = 0;
    9.26      u16 handle;
    9.27 @@ -129,21 +126,6 @@ static void fast_flush_area(int idx, int
    9.28      if ( unlikely(HYPERVISOR_grant_table_op(
    9.29                      GNTTABOP_unmap_grant_ref, unmap, invcount)))
    9.30          BUG();
    9.31 -#else
    9.32 -
    9.33 -    multicall_entry_t mcl[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    9.34 -    int               i;
    9.35 -
    9.36 -    for ( i = 0; i < nr_pages; i++ )
    9.37 -    {
    9.38 -	MULTI_update_va_mapping(mcl+i, MMAP_VADDR(idx, i),
    9.39 -				__pte(0), 0);
    9.40 -    }
    9.41 -
    9.42 -    mcl[nr_pages-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL;
    9.43 -    if ( unlikely(HYPERVISOR_multicall(mcl, nr_pages) != 0) )
    9.44 -        BUG();
    9.45 -#endif
    9.46  }
    9.47  
    9.48  
    9.49 @@ -367,12 +349,7 @@ static void dispatch_rw_block_io(blkif_t
    9.50      unsigned long fas = 0;
    9.51      int i, pending_idx = pending_ring[MASK_PEND_IDX(pending_cons)];
    9.52      pending_req_t *pending_req;
    9.53 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    9.54      struct gnttab_map_grant_ref map[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    9.55 -#else
    9.56 -    unsigned long remap_prot;
    9.57 -    multicall_entry_t mcl[BLKIF_MAX_SEGMENTS_PER_REQUEST];
    9.58 -#endif
    9.59      struct phys_req preq;
    9.60      struct { 
    9.61          unsigned long buf; unsigned int nsec;
    9.62 @@ -399,7 +376,6 @@ static void dispatch_rw_block_io(blkif_t
    9.63      preq.sector_number = req->sector_number;
    9.64      preq.nr_sects      = 0;
    9.65  
    9.66 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    9.67      for ( i = 0; i < nseg; i++ )
    9.68      {
    9.69          fas         = req->frame_and_sects[i];
    9.70 @@ -435,20 +411,11 @@ static void dispatch_rw_block_io(blkif_t
    9.71  
    9.72          pending_handle(pending_idx, i) = map[i].handle;
    9.73      }
    9.74 -#endif
    9.75  
    9.76      for ( i = 0; i < nseg; i++ )
    9.77      {
    9.78          fas         = req->frame_and_sects[i];
    9.79 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    9.80          seg[i].buf  = map[i].dev_bus_addr | (blkif_first_sect(fas) << 9);
    9.81 -#else
    9.82 -        seg[i].buf  = (fas & PAGE_MASK) | (blkif_first_sect(fas) << 9);
    9.83 -        seg[i].nsec = blkif_last_sect(fas) - blkif_first_sect(fas) + 1;
    9.84 -        if ( seg[i].nsec <= 0 )
    9.85 -            goto bad_descriptor;
    9.86 -        preq.nr_sects += seg[i].nsec;
    9.87 -#endif
    9.88      }
    9.89  
    9.90      if ( vbd_translate(&preq, blkif, operation) != 0 )
    9.91 @@ -459,40 +426,6 @@ static void dispatch_rw_block_io(blkif_t
    9.92          goto bad_descriptor;
    9.93      }
    9.94  
    9.95 -#ifndef CONFIG_XEN_BLKDEV_GRANT
    9.96 -    if ( operation == READ )
    9.97 -        remap_prot = _PAGE_PRESENT|_PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_RW;
    9.98 -    else
    9.99 -        remap_prot = _PAGE_PRESENT|_PAGE_DIRTY|_PAGE_ACCESSED;
   9.100 -
   9.101 -
   9.102 -    for ( i = 0; i < nseg; i++ )
   9.103 -    {
   9.104 -	MULTI_update_va_mapping_otherdomain(
   9.105 -	    mcl+i, MMAP_VADDR(pending_idx, i),
   9.106 -	    pfn_pte_ma(seg[i].buf >> PAGE_SHIFT, __pgprot(remap_prot)),
   9.107 -	    0, blkif->domid);
   9.108 -#ifdef CONFIG_XEN_BLKDEV_TAP_BE
   9.109 -        if ( blkif->is_blktap )
   9.110 -            mcl[i].args[MULTI_UVMDOMID_INDEX] = ID_TO_DOM(req->id);
   9.111 -#endif
   9.112 -        phys_to_machine_mapping[__pa(MMAP_VADDR(pending_idx, i))>>PAGE_SHIFT] =
   9.113 -            FOREIGN_FRAME(seg[i].buf >> PAGE_SHIFT);
   9.114 -    }
   9.115 -
   9.116 -    BUG_ON(HYPERVISOR_multicall(mcl, nseg) != 0);
   9.117 -
   9.118 -    for ( i = 0; i < nseg; i++ )
   9.119 -    {
   9.120 -        if ( unlikely(mcl[i].result != 0) )
   9.121 -        {
   9.122 -            DPRINTK("invalid buffer -- could not remap it\n");
   9.123 -            fast_flush_area(pending_idx, nseg);
   9.124 -            goto bad_descriptor;
   9.125 -        }
   9.126 -    }
   9.127 -#endif /* end ifndef CONFIG_XEN_BLKDEV_GRANT */
   9.128 -
   9.129      pending_req = &pending_reqs[pending_idx];
   9.130      pending_req->blkif     = blkif;
   9.131      pending_req->id        = req->id;
   9.132 @@ -666,10 +599,7 @@ static int __init blkif_init(void)
   9.133  
   9.134      blkif_xenbus_init();
   9.135  
   9.136 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   9.137      memset( pending_grant_handles,  BLKBACK_INVALID_HANDLE, MMAP_PAGES );
   9.138 -    printk(KERN_ALERT "Blkif backend is using grant tables.\n");
   9.139 -#endif
   9.140  
   9.141  #ifdef CONFIG_XEN_BLKDEV_TAP_BE
   9.142      printk(KERN_ALERT "NOTE: Blkif backend is running with tap support on!\n");
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Sun Aug 21 17:06:08 2005 +0000
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Mon Aug 22 10:20:58 2005 +0000
    10.3 @@ -17,9 +17,7 @@
    10.4  #include <asm-xen/hypervisor.h>
    10.5  #include <asm-xen/xen-public/io/blkif.h>
    10.6  #include <asm-xen/xen-public/io/ring.h>
    10.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    10.8  #include <asm-xen/gnttab.h>
    10.9 -#endif
   10.10  
   10.11  #if 0
   10.12  #define ASSERT(_p) \
   10.13 @@ -69,11 +67,9 @@ typedef struct blkif_st {
   10.14      atomic_t         refcnt;
   10.15  
   10.16      struct work_struct work;
   10.17 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   10.18      u16 shmem_handle;
   10.19      unsigned long shmem_vaddr;
   10.20      grant_ref_t shmem_ref;
   10.21 -#endif
   10.22  } blkif_t;
   10.23  
   10.24  void blkif_create(blkif_be_create_t *create);
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Sun Aug 21 17:06:08 2005 +0000
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Mon Aug 22 10:20:58 2005 +0000
    11.3 @@ -47,19 +47,6 @@ blkif_t *blkif_find(domid_t domid)
    11.4      return blkif;
    11.5  }
    11.6  
    11.7 -#ifndef CONFIG_XEN_BLKDEV_GRANT
    11.8 -static int map_frontend_page(blkif_t *blkif, unsigned long localaddr,
    11.9 -			     unsigned long shared_page)
   11.10 -{
   11.11 -    return direct_remap_area_pages(&init_mm, localaddr,
   11.12 -				   shared_page<<PAGE_SHIFT, PAGE_SIZE,
   11.13 -				   __pgprot(_KERNPG_TABLE), blkif->domid);
   11.14 -}
   11.15 -
   11.16 -static void unmap_frontend_page(blkif_t *blkif)
   11.17 -{
   11.18 -}
   11.19 -#else
   11.20  static int map_frontend_page(blkif_t *blkif, unsigned long localaddr,
   11.21  			     unsigned long shared_page)
   11.22  {
   11.23 @@ -91,7 +78,6 @@ static void unmap_frontend_page(blkif_t 
   11.24      op.dev_bus_addr = 0;
   11.25      BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
   11.26  }
   11.27 -#endif /* CONFIG_XEN_BLKDEV_GRANT */
   11.28  
   11.29  int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
   11.30  {
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Sun Aug 21 17:06:08 2005 +0000
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Mon Aug 22 10:20:58 2005 +0000
    12.3 @@ -75,16 +75,6 @@ static void frontend_changed(struct xenb
    12.4  	if (vbd_is_active(be->vbd))
    12.5  		return;
    12.6  
    12.7 -#ifndef CONFIG_XEN_BLKDEV_GRANT
    12.8 -	err = xenbus_gather(be->frontpath, "shared-frame", "%lu", &sharedmfn,
    12.9 -			    "event-channel", "%u", &evtchn, NULL);
   12.10 -	if (err) {
   12.11 -		xenbus_dev_error(be->dev, err, 
   12.12 -				 "reading %s/shared-frame and event-channel",
   12.13 -				 be->frontpath);
   12.14 -		return;
   12.15 -	}
   12.16 -#else
   12.17  	err = xenbus_gather(be->frontpath, "grant-id", "%lu", &sharedmfn,
   12.18  			    "event-channel", "%u", &evtchn, NULL);
   12.19  	if (err) {
   12.20 @@ -93,7 +83,6 @@ static void frontend_changed(struct xenb
   12.21  				 be->frontpath);
   12.22  		return;
   12.23  	}
   12.24 -#endif
   12.25  
   12.26  	/* Domains must use same shared frame for all vbds. */
   12.27  	if (be->blkif->status == CONNECTED &&
    13.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Sun Aug 21 17:06:08 2005 +0000
    13.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Mon Aug 22 10:20:58 2005 +0000
    13.3 @@ -55,10 +55,8 @@
    13.4  #include <scsi/scsi.h>
    13.5  #include <asm-xen/evtchn.h>
    13.6  #include <asm-xen/xenbus.h>
    13.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    13.8  #include <asm-xen/xen-public/grant_table.h>
    13.9  #include <asm-xen/gnttab.h>
   13.10 -#endif
   13.11  
   13.12  typedef unsigned char byte; /* from linux/ide.h */
   13.13  
   13.14 @@ -78,14 +76,12 @@ static blkif_front_ring_t blk_ring;
   13.15  
   13.16  #define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
   13.17  
   13.18 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   13.19  static domid_t rdomid = 0;
   13.20  static grant_ref_t gref_head, gref_terminal;
   13.21  #define MAXIMUM_OUTSTANDING_BLOCK_REQS \
   13.22      (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLKIF_RING_SIZE)
   13.23  #define GRANTREF_INVALID (1<<15)
   13.24  static int shmem_ref;
   13.25 -#endif
   13.26  
   13.27  static struct blk_shadow {
   13.28      blkif_request_t req;
   13.29 @@ -131,30 +127,14 @@ static int sg_operation = -1;
   13.30  
   13.31  static inline void pickle_request(struct blk_shadow *s, blkif_request_t *r)
   13.32  {
   13.33 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   13.34 -    int i;
   13.35 -#endif
   13.36  
   13.37      s->req = *r;
   13.38 -
   13.39 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   13.40 -    for ( i = 0; i < r->nr_segments; i++ )
   13.41 -        s->req.frame_and_sects[i] = machine_to_phys(r->frame_and_sects[i]);
   13.42 -#endif
   13.43  }
   13.44  
   13.45  static inline void unpickle_request(blkif_request_t *r, struct blk_shadow *s)
   13.46  {
   13.47 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   13.48 -    int i;
   13.49 -#endif
   13.50  
   13.51      *r = s->req;
   13.52 -
   13.53 -#ifndef CONFIG_XEN_BLKDEV_GRANT
   13.54 -    for ( i = 0; i < s->req.nr_segments; i++ )
   13.55 -        r->frame_and_sects[i] = phys_to_machine(s->req.frame_and_sects[i]);
   13.56 -#endif
   13.57  }
   13.58  
   13.59  
   13.60 @@ -256,9 +236,7 @@ static int blkif_queue_request(struct re
   13.61      int idx;
   13.62      unsigned long id;
   13.63      unsigned int fsect, lsect;
   13.64 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   13.65      int ref;
   13.66 -#endif
   13.67  
   13.68      if ( unlikely(blkif_state != BLKIF_STATE_CONNECTED) )
   13.69          return 1;
   13.70 @@ -284,7 +262,6 @@ static int blkif_queue_request(struct re
   13.71              buffer_ma = page_to_phys(bvec->bv_page);
   13.72              fsect = bvec->bv_offset >> 9;
   13.73              lsect = fsect + (bvec->bv_len >> 9) - 1;
   13.74 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   13.75              /* install a grant reference. */
   13.76              ref = gnttab_claim_grant_reference(&gref_head, gref_terminal);
   13.77              ASSERT( ref != -ENOSPC );
   13.78 @@ -300,11 +277,6 @@ static int blkif_queue_request(struct re
   13.79  
   13.80              ring_req->frame_and_sects[ring_req->nr_segments++] =
   13.81                  blkif_fas_from_gref(ref, fsect, lsect);
   13.82 -
   13.83 -#else
   13.84 -            ring_req->frame_and_sects[ring_req->nr_segments++] =
   13.85 -                blkif_fas(buffer_ma, fsect, lsect);
   13.86 -#endif
   13.87          }
   13.88      }
   13.89  
   13.90 @@ -711,9 +683,7 @@ static int blkif_queue_request(unsigned 
   13.91      blkif_request_t    *req;
   13.92      struct buffer_head *bh;
   13.93      unsigned int        fsect, lsect;
   13.94 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   13.95      int ref;
   13.96 -#endif
   13.97  
   13.98      fsect = (buffer_ma & ~PAGE_MASK) >> 9;
   13.99      lsect = fsect + nr_sectors - 1;
  13.100 @@ -762,7 +732,6 @@ static int blkif_queue_request(unsigned 
  13.101              bh->b_reqnext = (struct buffer_head *)blk_shadow[req->id].request;
  13.102              blk_shadow[req->id].request = (unsigned long)id;
  13.103  
  13.104 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.105              /* install a grant reference. */
  13.106              ref = gnttab_claim_grant_reference(&gref_head, gref_terminal);
  13.107              ASSERT( ref != -ENOSPC );
  13.108 @@ -778,10 +747,6 @@ static int blkif_queue_request(unsigned 
  13.109  
  13.110              req->frame_and_sects[req->nr_segments] =
  13.111                  blkif_fas_from_gref(ref, fsect, lsect);
  13.112 -#else
  13.113 -            req->frame_and_sects[req->nr_segments] =
  13.114 -                blkif_fas(buffer_ma, fsect, lsect);
  13.115 -#endif
  13.116              if ( ++req->nr_segments < BLKIF_MAX_SEGMENTS_PER_REQUEST )
  13.117                  sg_next_sect += nr_sectors;
  13.118              else
  13.119 @@ -819,7 +784,6 @@ static int blkif_queue_request(unsigned 
  13.120      req->sector_number = (blkif_sector_t)sector_number;
  13.121      req->handle        = handle; 
  13.122      req->nr_segments   = 1;
  13.123 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.124      /* install a grant reference. */
  13.125      ref = gnttab_claim_grant_reference(&gref_head, gref_terminal);
  13.126      ASSERT( ref != -ENOSPC );
  13.127 @@ -833,9 +797,6 @@ static int blkif_queue_request(unsigned 
  13.128      blk_shadow[xid].frame[0] = buffer_ma >> PAGE_SHIFT;
  13.129  
  13.130      req->frame_and_sects[0] = blkif_fas_from_gref(ref, fsect, lsect);
  13.131 -#else
  13.132 -    req->frame_and_sects[0] = blkif_fas(buffer_ma, fsect, lsect);
  13.133 -#endif
  13.134  
  13.135      /* Keep a private copy so we can reissue requests when recovering. */    
  13.136      pickle_request(&blk_shadow[xid], req);
  13.137 @@ -1015,9 +976,7 @@ static void blkif_recover(void)
  13.138      int i;
  13.139      blkif_request_t *req;
  13.140      struct blk_shadow *copy;
  13.141 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.142      int j;
  13.143 -#endif
  13.144  
  13.145      /* Stage 1: Make a safe copy of the shadow state. */
  13.146      copy = (struct blk_shadow *)kmalloc(sizeof(blk_shadow), GFP_KERNEL);
  13.147 @@ -1047,7 +1006,6 @@ static void blkif_recover(void)
  13.148          req->id = GET_ID_FROM_FREELIST();
  13.149          memcpy(&blk_shadow[req->id], &copy[i], sizeof(copy[i]));
  13.150  
  13.151 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.152          /* Rewrite any grant references invalidated by suspend/resume. */
  13.153          for ( j = 0; j < req->nr_segments; j++ )
  13.154          {
  13.155 @@ -1061,7 +1019,6 @@ static void blkif_recover(void)
  13.156              req->frame_and_sects[j] &= ~GRANTREF_INVALID;
  13.157          }
  13.158          blk_shadow[req->id].req = *req;
  13.159 -#endif
  13.160  
  13.161          blk_ring.req_prod_pvt++;
  13.162      }
  13.163 @@ -1085,9 +1042,7 @@ static void blkif_connect(u16 evtchn, do
  13.164      int err = 0;
  13.165  
  13.166      blkif_evtchn = evtchn;
  13.167 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.168      rdomid       = domid;
  13.169 -#endif
  13.170  
  13.171      err = bind_evtchn_to_irqhandler(
  13.172          blkif_evtchn, blkif_int, SA_SAMPLE_RANDOM, "blkif", NULL);
  13.173 @@ -1168,7 +1123,6 @@ static int setup_blkring(struct xenbus_d
  13.174  	SHARED_RING_INIT(sring);
  13.175  	FRONT_RING_INIT(&blk_ring, sring, PAGE_SIZE);
  13.176  
  13.177 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.178  	shmem_ref = gnttab_claim_grant_reference(&gref_head,
  13.179  						 gref_terminal);
  13.180  	ASSERT(shmem_ref != -ENOSPC);
  13.181 @@ -1176,7 +1130,6 @@ static int setup_blkring(struct xenbus_d
  13.182  					backend_id,
  13.183  					virt_to_mfn(blk_ring.sring),
  13.184  					0);
  13.185 -#endif
  13.186  
  13.187  	op.u.alloc_unbound.dom = backend_id;
  13.188  	err = HYPERVISOR_event_channel_op(&op);
  13.189 @@ -1228,20 +1181,11 @@ static int talk_to_backend(struct xenbus
  13.190  		goto destroy_blkring;
  13.191  	}
  13.192  
  13.193 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.194  	err = xenbus_printf(dev->nodename, "grant-id","%u", shmem_ref);
  13.195  	if (err) {
  13.196  		message = "writing grant-id";
  13.197  		goto abort_transaction;
  13.198  	}
  13.199 -#else
  13.200 -	err = xenbus_printf(dev->nodename, "shared-frame", "%lu",
  13.201 -			    virt_to_mfn(blk_ring.sring));
  13.202 -	if (err) {
  13.203 -		message = "writing shared-frame";
  13.204 -		goto abort_transaction;
  13.205 -	}
  13.206 -#endif
  13.207  	err = xenbus_printf(dev->nodename,
  13.208  			    "event-channel", "%u", blkif_evtchn);
  13.209  	if (err) {
  13.210 @@ -1419,13 +1363,10 @@ static int __init xlblk_init(void)
  13.211  {
  13.212      int i;
  13.213  
  13.214 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.215      /* A grant for every ring slot, plus one for the ring itself. */
  13.216      if (gnttab_alloc_grant_references(MAXIMUM_OUTSTANDING_BLOCK_REQS + 1,
  13.217  				      &gref_head, &gref_terminal) < 0)
  13.218          return 1;
  13.219 -    printk(KERN_ALERT "Blkif frontend is using grant tables.\n");
  13.220 -#endif
  13.221  
  13.222      if ( (xen_start_info.flags & SIF_INITDOMAIN) ||
  13.223           (xen_start_info.flags & SIF_BLK_BE_DOMAIN) )
  13.224 @@ -1449,20 +1390,7 @@ static int __init xlblk_init(void)
  13.225  static void blkif_completion(struct blk_shadow *s)
  13.226  {
  13.227      int i;
  13.228 -#ifdef CONFIG_XEN_BLKDEV_GRANT
  13.229      for ( i = 0; i < s->req.nr_segments; i++ )
  13.230          gnttab_release_grant_reference(
  13.231              &gref_head, blkif_gref_from_fas(s->req.frame_and_sects[i]));
  13.232 -#else
  13.233 -    /* This is a hack to get the dirty logging bits set */
  13.234 -    if ( s->req.operation == BLKIF_OP_READ )
  13.235 -    {
  13.236 -        for ( i = 0; i < s->req.nr_segments; i++ )
  13.237 -        {
  13.238 -            unsigned long pfn = s->req.frame_and_sects[i] >> PAGE_SHIFT;
  13.239 -            unsigned long mfn = phys_to_machine_mapping[pfn];
  13.240 -            xen_machphys_update(mfn, pfn);
  13.241 -        }
  13.242 -    }
  13.243 -#endif
  13.244  }
    14.1 --- a/xen/include/public/io/blkif.h	Sun Aug 21 17:06:08 2005 +0000
    14.2 +++ b/xen/include/public/io/blkif.h	Mon Aug 22 10:20:58 2005 +0000
    14.3 @@ -36,11 +36,7 @@ typedef struct blkif_request {
    14.4      unsigned long  id;           /* private guest value, echoed in resp  */
    14.5      blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
    14.6      /* @f_a_s[4:0]=last_sect ; @f_a_s[9:5]=first_sect                        */
    14.7 -#ifdef CONFIG_XEN_BLKDEV_GRANT
    14.8      /* @f_a_s[:16]= grant reference (16 bits)                                */
    14.9 -#else
   14.10 -    /* @f_a_s[:12]=@frame: machine page frame number.                        */
   14.11 -#endif
   14.12      /* @first_sect: first sector in frame to transfer (inclusive).           */
   14.13      /* @last_sect: last sector in frame to transfer (inclusive).             */
   14.14      unsigned long  frame_and_sects[BLKIF_MAX_SEGMENTS_PER_REQUEST];
   14.15 @@ -50,10 +46,8 @@ typedef struct blkif_request {
   14.16  #define blkif_first_sect(_fas) (((_fas)>>5)&31)
   14.17  #define blkif_last_sect(_fas)  ((_fas)&31)
   14.18  
   14.19 -#ifdef CONFIG_XEN_BLKDEV_GRANT
   14.20  #define blkif_fas_from_gref(_gref, _fs, _ls) (((_gref)<<16)|((_fs)<<5)|(_ls))
   14.21  #define blkif_gref_from_fas(_fas) ((_fas)>>16)
   14.22 -#endif
   14.23  
   14.24  typedef struct blkif_response {
   14.25      unsigned long   id;              /* copied from request */