Le blog de Jean David TECHER, un Réunionnais à Saint-Priest/Lyon

Aller au contenu | Aller au menu | Aller à la recherche


< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 >

dimanche 27 novembre 2011

Création d'un domU PVOPS Ubuntu Hardy 8.04 64 bits sous Xen 4.2 unstable / Kernel 3.1.0

Voici mes différentes notes à ce sujet. L'installation se fait à partir des xen-tools

1. Xen-tools: Fichier de configuration

Remarque: contrairement à Ubuntu Lucid, il n'est pas nécessaire d'utiliser pygrub
root@mercury:~# cat /etc/xen-tools/templates/xen-tools-Ubuntu-hardy.conf
lvm = xenvg
install-method = debootstrap
size   = 20Gb      # Disk image size.
memory = 1024    # Memory size
swap   = 2048Mb    # Swap size
fs     = ext3     # use the EXT3 filesystem for the disk image.
dist   = hardy     # Default distribution to install.
image  = sparse   # Specify sparse vs. full disk images.
gateway   = 192.168.2.253
netmask   = 255.255.255.0
broadcast = 192.168.2.255
passwd = 1
accounts = 0
kernel      = /boot/vmlinuz-`uname -r`
initrd      = /boot/initrd.img-`uname -r`
#arch = i386
arch  = amd64
mirror = http://fr.archive.ubuntu.com/ubuntu
ext3_options   = noatime,nodiratime,errors=remount-ro
ext2_options   = noatime,nodiratime,errors=remount-ro
xfs_options    = defaults
reiser_options = defaults
serial_device = hvc0
disk_device = xvda
output    = /etc/xen/machines
extension = .cfg
role=udev

Création de la machine

Par l'invocation de la commande xen-create-image
root@mercury:~# xen-create-image --force --hostname=mercury-xen06  --ip=192.168.2.231   --config=/etc/xen-tools/templates/xen-tools-Ubuntu-hardy.conf

General Information
--------------------
Hostname       :  mercury-xen06
Distribution   :  hardy
Mirror         :  http://fr.archive.ubuntu.com/ubuntu
Partitions     :  swap            2048Mb (swap)
                  /               20Gb  (ext3)
Image type     :  full
Memory size    :  1024b
Kernel path    :  /boot/vmlinuz-3.1.0
Initrd path    :  /boot/initrd.img-3.1.0

Networking Information
----------------------
IP Address 1   : 192.168.2.231 [MAC: 00:16:3E:BF:B6:67]
Netmask        : 255.255.255.0
Broadcast      : 192.168.2.255
Gateway        : 192.168.2.253


Creating swap on /dev/xenvg/mercury-xen06-swap
Done

Creating ext3 filesystem on /dev/xenvg/mercury-xen06-disk
Done
Installation method: debootstrap
Done

Running hooks
Done

Role: udev
	File: /etc/xen-tools/role.d/udev
Role script completed.

Creating Xen configuration file
Done
Setting up root password
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
All done


Logfile produced at:
	 /var/log/xen-tools/mercury-xen06.log

Installation Summary
---------------------
Hostname        :  mercury-xen06
Distribution    :  hardy
IP-Address(es)  :  192.168.2.231 
RSA Fingerprint :  a1:07:37:a1:b7:1f:2c:2c:95:8c:a2:60:68:98:8e:04
Root Password   :  N/A

samedi 26 novembre 2011

Xen - Intel VT-d sur Core 5 2400 / VGA PassThrough sur Carte NVIDIA EVGA GTX 460 SE 1024: Nouveaus patchs

Faisant suite à ce billet, voici les nouveaux patchs. Ces derniers sont aussi téléchargeables ici
--- xen-unstable.hg-rev-24232_b/tools/firmware/hvmloader/acpi/dsdt.asl	2011-11-25 21:55:23.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/firmware/hvmloader/acpi/dsdt.asl	2011-11-26 14:19:33.000000000 +0100
@@ -142,15 +142,43 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2,
                         0x00000000,
                         0x00020000)
 
+                    /* reserve MMIO BARs of gfx for 1:1 mapping */
                     DWordMemory(
                         ResourceProducer, PosDecode, MinFixed, MaxFixed,
                         Cacheable, ReadWrite,
                         0x00000000,
-                        0xF0000000,
-                        0xF4FFFFFF,
+                        0xF8000000,
+                        0xF9FFFFFF,
                         0x00000000,
-                        0x05000000,
-                        ,, _Y01)
+                        0x02000000)
+
+                    DWordMemory(
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        NonCacheable, ReadWrite,
+                        0x00000000,
+                        0xD0000000,
+                        0xD7FFFFFF,
+                        0x00000000,
+                        0x08000000)
+
+                    DWordMemory(
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        Cacheable, ReadWrite,
+                        0x00000000,
+                        0xD8000000,
+                        0xDBFFFFFF,
+                        0x00000000,
+                        0x4000000)
+
+                    DWordMemory(
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        Cacheable, ReadWrite,
+                        0x00000000,
+                        0xFB000000,
+                        0xFB07FFFF,
+                        0x00000000,
+                        0x00080000,                        
+			,, _Y01)
                 })
 
                 CreateDWordField(PRT0, \_SB.PCI0._CRS._Y01._MIN, MMIN)
--- xen-unstable.hg-rev-24232_b/tools/firmware/hvmloader/hvmloader.c	2011-11-25 21:55:23.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/firmware/hvmloader/hvmloader.c	2011-11-26 14:19:33.000000000 +0100
@@ -31,6 +31,7 @@
 #include 
 
 #define ROM_INCLUDE_VGABIOS
+#define ROM_INCLUDE_PTVGABIOS
 #define ROM_INCLUDE_ETHERBOOT
 #include "roms.inc"
 
@@ -113,6 +114,9 @@ asm (
 
 unsigned long scratch_start = SCRATCH_PHYSICAL_ADDRESS;
 
+/* virtual BDF of pass-throughed gfx */
+uint8_t gfx_bdf;
+
 static void init_hypercalls(void)
 {
     uint32_t eax, ebx, ecx, edx;
@@ -310,6 +314,20 @@ static int pci_load_option_roms(unsigned
     return rom_phys_addr - rom_base_addr;
 }
 
+static void init_vm86_tss(void)
+{
+    void *tss;
+    struct xen_hvm_param p;
+
+    tss = mem_alloc(128, 128);
+    memset(tss, 0, 128);
+    p.domid = DOMID_SELF;
+    p.index = HVM_PARAM_VM86_TSS;
+    p.value = virt_to_phys(tss);
+    hypercall_hvm_op(HVMOP_set_param, &p);
+    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
+}
+
 /* Replace possibly erroneous memory-size CMOS fields with correct values. */
 static void cmos_write_memory_size(void)
 {
@@ -336,25 +354,6 @@ static void cmos_write_memory_size(void)
     cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
 }
 
-/*
- * Set up an empty TSS area for virtual 8086 mode to use. 
- * The only important thing is that it musn't have any bits set 
- * in the interrupt redirection bitmap, so all zeros will do.
- */
-static void init_vm86_tss(void)
-{
-    void *tss;
-    struct xen_hvm_param p;
-
-    tss = mem_alloc(128, 128);
-    memset(tss, 0, 128);
-    p.domid = DOMID_SELF;
-    p.index = HVM_PARAM_VM86_TSS;
-    p.value = virt_to_phys(tss);
-    hypercall_hvm_op(HVMOP_set_param, &p);
-    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
-}
-
 static void apic_setup(void)
 {
     /* Set the IOAPIC ID to the static value used in the MP/ACPI tables. */
@@ -488,8 +487,10 @@ int main(void)
             break;
         case VGA_pt:
             printf("Loading VGABIOS of passthroughed gfx ...\n");
-            vgabios_sz = round_option_rom(
-                (*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
+        memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+               vgabios_pt, sizeof(vgabios_pt));
+        *(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS + sizeof(vgabios_pt)) = gfx_bdf;
+        vgabios_sz = round_option_rom(sizeof(vgabios_pt) + 1);
             break;
         default:
             printf("No emulated VGA adaptor ...\n");
@@ -528,7 +529,7 @@ int main(void)
         hypercall_hvm_op(HVMOP_set_param, &p);
     }
 
-    init_vm86_tss();
+   init_vm86_tss();
 
     cmos_write_memory_size();
 
--- xen-unstable.hg-rev-24232_b/tools/firmware/hvmloader/Makefile	2011-11-25 21:55:23.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/firmware/hvmloader/Makefile	2011-11-26 14:19:33.000000000 +0100
@@ -56,6 +56,7 @@ CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl
 else
 CIRRUSVGA_ROM := ../vgabios/VGABIOS-lgpl-latest.cirrus.bin
 endif
+PTVGA_ROM     := ../vgabios/vgabios-pt.bin
 
 .PHONY: all
 all: subdirs-all
@@ -94,6 +95,11 @@ ifneq ($(CIRRUSVGA_ROM),)
 	sh ./mkhex vgabios_cirrusvga $(CIRRUSVGA_ROM) >> $@.new
 	echo "#endif" >> $@.new
 endif
+ifneq ($(PTVGA_ROM),)
+	echo "#ifdef ROM_INCLUDE_PTVGABIOS" >> $@.new
+	sh ./mkhex vgabios_pt $(PTVGA_ROM) >> $@.new
+	echo "#endif" >> $@.new
+endif
 
 	echo "#ifdef ROM_INCLUDE_ETHERBOOT" >> $@.new
 	cat ../etherboot/eb-roms.h >> $@.new
--- xen-unstable.hg-rev-24232_b/tools/ioemu-remote/hw/pass-through.c	2011-11-26 17:28:22.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/ioemu-remote/hw/pass-through.c	2011-11-26 14:19:33.000000000 +0100
@@ -3243,6 +3243,8 @@ static int pt_cmd_reg_read(struct pt_dev
 }
 
 /* read BAR */
+static int gfx_first_read_BAR[7] = {1, 1, 1, 1, 1, 1, 1};
+
 static int pt_bar_reg_read(struct pt_dev *ptdev,
         struct pt_reg_tbl *cfg_entry,
         uint32_t *value, uint32_t valid_mask)
@@ -3265,6 +3267,17 @@ static int pt_bar_reg_read(struct pt_dev
     /* use fixed-up value from kernel sysfs */
     *value = ptdev->pci_dev->base_addr[index];
 
+    if ( ptdev->pci_dev->device_class == 0x300 )
+    {
+        if ( gfx_first_read_BAR[index] == 1 )
+        {
+            gfx_first_read_BAR[index] = 0;
+            PT_LOG("first read BARs of gfx\n");
+            return 0;
+        }
+    }
+
+
     /* set emulate mask depend on BAR flag */
     switch (ptdev->bases[index].bar_flag)
     {
--- xen-unstable.hg-rev-24232_b/tools/firmware/hvmloader/pci.c	2011-11-25 21:55:23.000000000 +0100
+++ xen-unstable.hg-rev-24232_a/tools/firmware/hvmloader/pci.c	2011-11-26 17:03:42.000000000 +0100
@@ -34,6 +34,10 @@ unsigned long pci_mem_end = PCI_MEM_END;
 enum virtual_vga virtual_vga = VGA_none;
 unsigned long igd_opregion_pgbase = 0;
 
+/* virtual BDF of pass-throughed gfx declared in hvmloader.c*/
+extern uint8_t gfx_bdf;
+
+
 void pci_setup(void)
 {
     uint32_t base, devfn, bar_reg, bar_data, bar_sz, cmd, mmio_total = 0;
@@ -94,19 +98,43 @@ void pci_setup(void)
             }
             else if ( virtual_vga == VGA_none )
             {
-                vga_devfn = devfn;
-                virtual_vga = VGA_pt;
-                if ( vendor_id == 0x8086 )
-                {
-                    igd_opregion_pgbase = mem_hole_alloc(2);
-                    /*
-                     * Write the the OpRegion offset to give the opregion
-                     * address to the device model. The device model will trap 
-                     * and map the OpRegion at the give address.
-                     */
-                    pci_writel(vga_devfn, PCI_INTEL_OPREGION,
-                               igd_opregion_pgbase << PAGE_SHIFT);
+                 virtual_vga = VGA_pt;
+                 gfx_bdf = devfn;
+ 
+                 /* Make vBAR=pBAR */
+                 printf("Make vBAR = pBAR of assigned gfx\n");
+                 for ( bar = 0; bar < 7; bar++ )
+                 {
+                     bar_reg = PCI_BASE_ADDRESS_0 + 4*bar;
+                     if ( bar == 6 )
+                             bar_reg = PCI_ROM_ADDRESS;
+                     /* When first time read, it will return physical address */
+                     bar_data = pci_readl(devfn, bar_reg);
+                     pci_writel(devfn, bar_reg, bar_data);
+ 
+                     /* Now enable the memory or I/O mapping. */
+                     cmd = pci_readw(devfn, PCI_COMMAND);
+                     if ( (bar_reg == PCI_ROM_ADDRESS) ||
+                              ((bar_data & PCI_BASE_ADDRESS_SPACE) ==
+                               PCI_BASE_ADDRESS_SPACE_MEMORY) )
+                           cmd |= PCI_COMMAND_MEMORY;
+                     else
+                           cmd |= PCI_COMMAND_IO;
+                     cmd |= PCI_COMMAND_MASTER;
+                     pci_writew(devfn, PCI_COMMAND, cmd);
                 }
+ 
+                 /* Map the interrupt. */
+                 pin = pci_readb(devfn, PCI_INTERRUPT_PIN);
+                 if ( pin != 0 )
+                 {
+                     /* This is the barber's pole mapping used by Xen. */
+                     link = ((pin - 1) + (devfn >> 3)) & 3;
+                     isa_irq = pci_readb(PCI_ISA_DEVFN, 0x60 + link);
+                     pci_writeb(devfn, PCI_INTERRUPT_LINE, isa_irq);
+                 }
+                 continue;
+
             }
             break;
         case 0x0680:

vendredi 25 novembre 2011

Documentation officielle Slony pour 1.2.11 et 1.2.22

Voici les liens des documentations officielles

lundi 21 novembre 2011

Assistance informatique à l'Ile de la Réunion

Pour mon petit frèro, je pense que ça devrait t'être util