Skip to content

Commit

Permalink
Pull pv_ops-xen into release branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Luck committed Oct 17, 2008
2 parents 9224652 + f8d1f99 commit 22ca532
Show file tree
Hide file tree
Showing 50 changed files with 4,631 additions and 11 deletions.
183 changes: 183 additions & 0 deletions Documentation/ia64/xen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
Recipe for getting/building/running Xen/ia64 with pv_ops
--------------------------------------------------------

This recipe describes how to get xen-ia64 source and build it,
and run domU with pv_ops.

============
Requirements
============

- python
- mercurial
it (aka "hg") is an open-source source code
management software. See the below.
http://www.selenic.com/mercurial/wiki/
- git
- bridge-utils

=================================
Getting and Building Xen and Dom0
=================================

My environment is;
Machine : Tiger4
Domain0 OS : RHEL5
DomainU OS : RHEL5

1. Download source
# hg clone http://xenbits.xensource.com/ext/ia64/xen-unstable.hg
# cd xen-unstable.hg
# hg clone http://xenbits.xensource.com/ext/ia64/linux-2.6.18-xen.hg

2. # make world

3. # make install-tools

4. copy kernels and xen
# cp xen/xen.gz /boot/efi/efi/redhat/
# cp build-linux-2.6.18-xen_ia64/vmlinux.gz \
/boot/efi/efi/redhat/vmlinuz-2.6.18.8-xen

5. make initrd for Dom0/DomU
# make -C linux-2.6.18-xen.hg ARCH=ia64 modules_install \
O=$(/bin/pwd)/build-linux-2.6.18-xen_ia64
# mkinitrd -f /boot/efi/efi/redhat/initrd-2.6.18.8-xen.img \
2.6.18.8-xen --builtin mptspi --builtin mptbase \
--builtin mptscsih --builtin uhci-hcd --builtin ohci-hcd \
--builtin ehci-hcd

================================
Making a disk image for guest OS
================================

1. make file
# dd if=/dev/zero of=/root/rhel5.img bs=1M seek=4096 count=0
# mke2fs -F -j /root/rhel5.img
# mount -o loop /root/rhel5.img /mnt
# cp -ax /{dev,var,etc,usr,bin,sbin,lib} /mnt
# mkdir /mnt/{root,proc,sys,home,tmp}

Note: You may miss some device files. If so, please create them
with mknod. Or you can use tar instead of cp.

2. modify DomU's fstab
# vi /mnt/etc/fstab
/dev/xvda1 / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0

3. modify inittab
set runlevel to 3 to avoid X trying to start
# vi /mnt/etc/inittab
id:3:initdefault:
Start a getty on the hvc0 console
X0:2345:respawn:/sbin/mingetty hvc0
tty1-6 mingetty can be commented out

4. add hvc0 into /etc/securetty
# vi /mnt/etc/securetty (add hvc0)

5. umount
# umount /mnt

FYI, virt-manager can also make a disk image for guest OS.
It's GUI tools and easy to make it.

==================
Boot Xen & Domain0
==================

1. replace elilo
elilo of RHEL5 can boot Xen and Dom0.
If you use old elilo (e.g RHEL4), please download from the below
http://elilo.sourceforge.net/cgi-bin/blosxom
and copy into /boot/efi/efi/redhat/
# cp elilo-3.6-ia64.efi /boot/efi/efi/redhat/elilo.efi

2. modify elilo.conf (like the below)
# vi /boot/efi/efi/redhat/elilo.conf
prompt
timeout=20
default=xen
relocatable

image=vmlinuz-2.6.18.8-xen
label=xen
vmm=xen.gz
initrd=initrd-2.6.18.8-xen.img
read-only
append=" -- rhgb root=/dev/sda2"

The append options before "--" are for xen hypervisor,
the options after "--" are for dom0.

FYI, your machine may need console options like
"com1=19200,8n1 console=vga,com1". For example,
append="com1=19200,8n1 console=vga,com1 -- rhgb console=tty0 \
console=ttyS0 root=/dev/sda2"

=====================================
Getting and Building domU with pv_ops
=====================================

1. get pv_ops tree
# git clone http://people.valinux.co.jp/~yamahata/xen-ia64/linux-2.6-xen-ia64.git/

2. git branch (if necessary)
# cd linux-2.6-xen-ia64/
# git checkout -b your_branch origin/xen-ia64-domu-minimal-2008may19
(Note: The current branch is xen-ia64-domu-minimal-2008may19.
But you would find the new branch. You can see with
"git branch -r" to get the branch lists.
http://people.valinux.co.jp/~yamahata/xen-ia64/for_eagl/linux-2.6-ia64-pv-ops.git/
is also available. The tree is based on
git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 test)


3. copy .config for pv_ops of domU
# cp arch/ia64/configs/xen_domu_wip_defconfig .config

4. make kernel with pv_ops
# make oldconfig
# make

5. install the kernel and initrd
# cp vmlinux.gz /boot/efi/efi/redhat/vmlinuz-2.6-pv_ops-xenU
# make modules_install
# mkinitrd -f /boot/efi/efi/redhat/initrd-2.6-pv_ops-xenU.img \
2.6.26-rc3xen-ia64-08941-g1b12161 --builtin mptspi \
--builtin mptbase --builtin mptscsih --builtin uhci-hcd \
--builtin ohci-hcd --builtin ehci-hcd

========================
Boot DomainU with pv_ops
========================

1. make config of DomU
# vi /etc/xen/rhel5
kernel = "/boot/efi/efi/redhat/vmlinuz-2.6-pv_ops-xenU"
ramdisk = "/boot/efi/efi/redhat/initrd-2.6-pv_ops-xenU.img"
vcpus = 1
memory = 512
name = "rhel5"
disk = [ 'file:/root/rhel5.img,xvda1,w' ]
root = "/dev/xvda1 ro"
extra= "rhgb console=hvc0"

2. After boot xen and dom0, start xend
# /etc/init.d/xend start
( In the debugging case, # XEND_DEBUG=1 xend trace_start )

3. start domU
# xm create -c rhel5

=========
Reference
=========
- Wiki of Xen/IA64 upstream merge
http://wiki.xensource.com/xenwiki/XenIA64/UpstreamMerge

Written by Akio Takebe <takebe_akio@jp.fujitsu.com> on 28 May 2008
32 changes: 32 additions & 0 deletions arch/ia64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,33 @@ config AUDIT_ARCH
bool
default y

menuconfig PARAVIRT_GUEST
bool "Paravirtualized guest support"
help
Say Y here to get to see options related to running Linux under
various hypervisors. This option alone does not add any kernel code.

If you say N, all options in this submenu will be skipped and disabled.

if PARAVIRT_GUEST

config PARAVIRT
bool "Enable paravirtualization code"
depends on PARAVIRT_GUEST
default y
bool
default y
help
This changes the kernel so it can modify itself when it is run
under a hypervisor, potentially improving performance significantly
over full virtualization. However, when run without a hypervisor
the kernel is theoretically slower and slightly larger.


source "arch/ia64/xen/Kconfig"

endif

choice
prompt "System type"
default IA64_GENERIC
Expand All @@ -130,6 +157,7 @@ config IA64_GENERIC
SGI-SN2 For SGI Altix systems
SGI-UV For SGI UV systems
Ski-simulator For the HP simulator <http://www.hpl.hp.com/research/linux/ski/>
Xen-domU For xen domU system

If you don't know what to do, choose "generic".

Expand Down Expand Up @@ -180,6 +208,10 @@ config IA64_HP_SIM
bool "Ski-simulator"
select SWIOTLB

config IA64_XEN_GUEST
bool "Xen guest"
depends on XEN

endchoice

choice
Expand Down
2 changes: 2 additions & 0 deletions arch/ia64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ core-$(CONFIG_IA64_DIG) += arch/ia64/dig/
core-$(CONFIG_IA64_GENERIC) += arch/ia64/dig/
core-$(CONFIG_IA64_HP_ZX1) += arch/ia64/dig/
core-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/dig/
core-$(CONFIG_IA64_XEN_GUEST) += arch/ia64/dig/
core-$(CONFIG_IA64_SGI_SN2) += arch/ia64/sn/
core-$(CONFIG_IA64_SGI_UV) += arch/ia64/uv/
core-$(CONFIG_KVM) += arch/ia64/kvm/
core-$(CONFIG_XEN) += arch/ia64/xen/

drivers-$(CONFIG_PCI) += arch/ia64/pci/
drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/
Expand Down
9 changes: 9 additions & 0 deletions arch/ia64/include/asm/break.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@
*/
#define __IA64_BREAK_SYSCALL 0x100000

/*
* Xen specific break numbers:
*/
#define __IA64_XEN_HYPERCALL 0x1000
/* [__IA64_XEN_HYPERPRIVOP_START, __IA64_XEN_HYPERPRIVOP_MAX] is used
for xen hyperprivops */
#define __IA64_XEN_HYPERPRIVOP_START 0x1
#define __IA64_XEN_HYPERPRIVOP_MAX 0x1a

#endif /* _ASM_IA64_BREAK_H */
2 changes: 2 additions & 0 deletions arch/ia64/include/asm/machvec.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
# include <asm/machvec_sn2.h>
# elif defined (CONFIG_IA64_SGI_UV)
# include <asm/machvec_uv.h>
# elif defined (CONFIG_IA64_XEN_GUEST)
# include <asm/machvec_xen.h>
# elif defined (CONFIG_IA64_GENERIC)

# ifdef MACHVEC_PLATFORM_HEADER
Expand Down
22 changes: 22 additions & 0 deletions arch/ia64/include/asm/machvec_xen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef _ASM_IA64_MACHVEC_XEN_h
#define _ASM_IA64_MACHVEC_XEN_h

extern ia64_mv_setup_t dig_setup;
extern ia64_mv_cpu_init_t xen_cpu_init;
extern ia64_mv_irq_init_t xen_irq_init;
extern ia64_mv_send_ipi_t xen_platform_send_ipi;

/*
* This stuff has dual use!
*
* For a generic kernel, the macros are used to initialize the
* platform's machvec structure. When compiling a non-generic kernel,
* the macros are used directly.
*/
#define platform_name "xen"
#define platform_setup dig_setup
#define platform_cpu_init xen_cpu_init
#define platform_irq_init xen_irq_init
#define platform_send_ipi xen_platform_send_ipi

#endif /* _ASM_IA64_MACHVEC_XEN_h */
3 changes: 2 additions & 1 deletion arch/ia64/include/asm/meminit.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
* - crash dumping code reserved region
* - Kernel memory map built from EFI memory map
* - ELF core header
* - xen start info if CONFIG_XEN
*
* More could be added if necessary
*/
#define IA64_MAX_RSVD_REGIONS 8
#define IA64_MAX_RSVD_REGIONS 9

struct rsvd_region {
unsigned long start; /* virtual address of beginning of element */
Expand Down
10 changes: 8 additions & 2 deletions arch/ia64/include/asm/native/inst.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@
;; \
movl clob = PARAVIRT_POISON; \
;;
# define CLOBBER_PRED(pred_clob) \
;; \
cmp.eq pred_clob, p0 = r0, r0 \
;;
#else
# define CLOBBER(clob) /* nothing */
# define CLOBBER(clob) /* nothing */
# define CLOBBER_PRED(pred_clob) /* nothing */
#endif

#define MOV_FROM_IFA(reg) \
Expand Down Expand Up @@ -136,7 +141,8 @@

#define SSM_PSR_I(pred, pred_clob, clob) \
(pred) ssm psr.i \
CLOBBER(clob)
CLOBBER(clob) \
CLOBBER_PRED(pred_clob)

#define RSM_PSR_I(pred, clob0, clob1) \
(pred) rsm psr.i \
Expand Down
Loading

0 comments on commit 22ca532

Please sign in to comment.