[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Disable xen platform PCI device when xen_platform_pci=0 is specified



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1237376279 0
# Node ID 33270c9a3d2f56006a166b42ae0d717bc6b1644f
# Parent  6e619d8eece54ff3548a933bfe6cbc06d4559ef5
Disable xen platform PCI device when xen_platform_pci=0 is specified

 - Change guest firmware to use new fixed byte port 0x10.
 - Add "xen_platform_pci" option into guest config file and APIs.
    xen_platform_pci=0: Disable xen platform device.
    xen_platform_pci=1: Enable xen platform device. (default)
 - Add "disable_pf" entry into xenstore.

Signed-off-by: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx>
---
 tools/examples/xmexample.hvm         |    4 ++++
 tools/firmware/hvmloader/config.h    |    3 +--
 tools/firmware/hvmloader/hvmloader.c |   20 --------------------
 tools/firmware/rombios/rombios.c     |   14 ++------------
 tools/python/xen/xend/XendConfig.py  |    3 +++
 tools/python/xen/xend/image.py       |   13 ++++++++++++-
 tools/python/xen/xm/create.py        |    6 +++++-
 tools/python/xen/xm/xenapi_create.py |    1 +
 8 files changed, 28 insertions(+), 36 deletions(-)

diff -r 6e619d8eece5 -r 33270c9a3d2f tools/examples/xmexample.hvm
--- a/tools/examples/xmexample.hvm      Wed Mar 18 11:34:20 2009 +0000
+++ b/tools/examples/xmexample.hvm      Wed Mar 18 11:37:59 2009 +0000
@@ -223,6 +223,10 @@ serial='pty'
 #-----------------------------------------------------------------------------
 #   Set keyboard layout, default is en-us keyboard. 
 #keymap='ja'
+
+#-----------------------------------------------------------------------------
+#   Enable/disable xen platform PCI device, default=1 (enabled)
+#xen_platform_pci=1
 
 #-----------------------------------------------------------------------------
 #   Configure guest CPUID responses:
diff -r 6e619d8eece5 -r 33270c9a3d2f tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h Wed Mar 18 11:34:20 2009 +0000
+++ b/tools/firmware/hvmloader/config.h Wed Mar 18 11:37:59 2009 +0000
@@ -47,6 +47,7 @@ extern unsigned long pci_mem_start, pci_
 #define E820_OFFSET                   0x8
 
 /* Xen Platform Device */
+#define XEN_PF_IOBASE   0x10
 #define PFFLAG_ROM_LOCK 1 /* Sets whether ROM memory area is RW or RO */
 
 /* Located at BIOS_INFO_PHYSICAL_ADDRESS. */
@@ -56,9 +57,7 @@ struct bios_info {
     uint8_t  hpet_present:1;    /* 0[2] - System has HPET? */
     uint32_t pci_min, pci_len;  /* 4, 8 - PCI I/O hole boundaries */
     uint32_t bios32_entry;      /* 12   - Entry point for 32-bit BIOS */
-    uint16_t xen_pfiob;         /* 16   - Xen platform device I/O ports */
 };
 #define BIOSINFO_OFF_bios32_entry 12
-#define BIOSINFO_OFF_xen_pfiob    16
 
 #endif /* __HVMLOADER_CONFIG_H__ */
diff -r 6e619d8eece5 -r 33270c9a3d2f tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Wed Mar 18 11:34:20 2009 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c      Wed Mar 18 11:37:59 2009 +0000
@@ -539,25 +539,6 @@ static void cmos_write_memory_size(void)
     cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
 }
 
-static uint16_t xen_platform_io_base(void)
-{
-    uint32_t devfn, bar_data;
-    uint16_t vendor_id, device_id;
-
-    for ( devfn = 0; devfn < 128; devfn++ )
-    {
-        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
-        device_id = pci_readw(devfn, PCI_DEVICE_ID);
-        if ( (vendor_id == 0x5853) && (device_id == 0x0001) )
-        {
-            bar_data = pci_readl(devfn, PCI_BASE_ADDRESS_0);
-            return bar_data & PCI_BASE_ADDRESS_IO_MASK;
-        }
-    }
-
-    return 0;
-}
-
 /*
  * 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 
@@ -744,7 +725,6 @@ int main(void)
     bios_info->pci_min = pci_mem_start;
     bios_info->pci_len = pci_mem_end - pci_mem_start;
     bios_info->bios32_entry = bios32_addr;
-    bios_info->xen_pfiob = xen_platform_io_base();
 
     printf("Invoking ROMBIOS ...\n");
     return 0;
diff -r 6e619d8eece5 -r 33270c9a3d2f tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c  Wed Mar 18 11:34:20 2009 +0000
+++ b/tools/firmware/rombios/rombios.c  Wed Mar 18 11:37:59 2009 +0000
@@ -1418,24 +1418,14 @@ fixup_base_mem_in_k()
   write_word(0x40, 0x13, base_mem >> 10);
 }
 
-ASM_START
-_rom_write_access_control:
-    push ds
-    mov ax,#(BIOS_INFO_PHYSICAL_ADDRESS >> 4)
-    mov ds,ax
-    mov ax,[BIOSINFO_OFF_xen_pfiob]
-    pop ds
-    ret
-ASM_END
-
 void enable_rom_write_access()
 {
-    outb(rom_write_access_control(), 0);
+    outb(XEN_PF_IOBASE, 0);
 }
 
 void disable_rom_write_access()
 {
-    outb(rom_write_access_control(), PFFLAG_ROM_LOCK);
+    outb(XEN_PF_IOBASE, PFFLAG_ROM_LOCK);
 }
     
 #endif /* HVMASSIST */
diff -r 6e619d8eece5 -r 33270c9a3d2f tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py       Wed Mar 18 11:34:20 2009 +0000
+++ b/tools/python/xen/xend/XendConfig.py       Wed Mar 18 11:37:59 2009 +0000
@@ -170,6 +170,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'xen_extended_power_mgmt': int,
     'pci_msitranslate': int,
     'pci_power_mgmt': int,
+    'xen_platform_pci': int,
 }
 
 # Xen API console 'other_config' keys.
@@ -464,6 +465,8 @@ class XendConfig(dict):
                 self['platform']['rtc_timeoffset'] = 0
             if 'hpet' not in self['platform']:
                 self['platform']['hpet'] = 0
+            if 'xen_platform_pci' not in self['platform']:
+                self['platform']['xen_platform_pci'] = 1
             if 'vpt_align' not in self['platform']:
                 self['platform']['vpt_align'] = 1
             if 'loader' not in self['platform']:
diff -r 6e619d8eece5 -r 33270c9a3d2f tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Wed Mar 18 11:34:20 2009 +0000
+++ b/tools/python/xen/xend/image.py    Wed Mar 18 11:37:59 2009 +0000
@@ -716,6 +716,7 @@ class HVMImageHandler(ImageHandler):
         if 'hvm' not in info['xen_caps']:
             raise HVMRequired()
 
+        xen_platform_pci = int(vmConfig['platform'].get('xen_platform_pci',1))
         rtc_timeoffset = vmConfig['platform'].get('rtc_timeoffset')
 
         if not self.display :
@@ -724,13 +725,23 @@ class HVMImageHandler(ImageHandler):
                         ("image/device-model", self.device_model),
                         ("image/display", self.display))
         self.vm.permissionsVm("image/dmargs", { 'dom': self.vm.getDomid(), 
'read': True } )
+
+        if xen_platform_pci == 0:
+            disable_pf = 1
+            log.info("No need to create platform device.[domid:%d]", 
self.vm.getDomid())
+        else:
+            disable_pf = 0
+            log.info("Need to create platform device.[domid:%d]", 
self.vm.getDomid())
+
+        xstransact.Store("/local/domain/0/device-model/%i"%self.vm.getDomid(),
+                                      ('disable_pf', disable_pf))
         self.vm.storeVm(("rtc/timeoffset", rtc_timeoffset))
         self.vm.permissionsVm("rtc/timeoffset", { 'dom': self.vm.getDomid(), 
'read': True } )
 
         self.apic = int(vmConfig['platform'].get('apic', 0))
         self.acpi = int(vmConfig['platform'].get('acpi', 0))
         self.guest_os_type = vmConfig['platform'].get('guest_os_type')
-           
+
 
     # Return a list of cmd line args to the device models based on the
     # xm config file
diff -r 6e619d8eece5 -r 33270c9a3d2f tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Wed Mar 18 11:34:20 2009 +0000
+++ b/tools/python/xen/xm/create.py     Wed Mar 18 11:37:59 2009 +0000
@@ -610,6 +610,10 @@ gopts.var('pci_power_mgmt', val='POWERMG
 gopts.var('pci_power_mgmt', val='POWERMGMT',
           fn=set_int, default=0,
           use="""Global PCI Power Management flag (0=disable;1=enable).""")
+
+gopts.var('xen_platform_pci', val='0|1',
+           fn=set_int, default=1,
+           use="Is xen_platform_pci used?")
 
 def err(msg):
     """Print an error to stderr and exit.
@@ -924,7 +928,7 @@ def configure_hvm(config_image, vals):
              'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',
              'guest_os_type', 'hap', 'opengl', 'cpuid', 'cpuid_check',
              'viridian', 'xen_extended_power_mgmt', 'pci_msitranslate',
-             'vpt_align', 'pci_power_mgmt' ]
+             'vpt_align', 'pci_power_mgmt', 'xen_platform_pci' ]
 
     for a in args:
         if a in vals.__dict__ and vals.__dict__[a] is not None:
diff -r 6e619d8eece5 -r 33270c9a3d2f tools/python/xen/xm/xenapi_create.py
--- a/tools/python/xen/xm/xenapi_create.py      Wed Mar 18 11:34:20 2009 +0000
+++ b/tools/python/xen/xm/xenapi_create.py      Wed Mar 18 11:37:59 2009 +0000
@@ -1048,6 +1048,7 @@ class sxp2xml:
             'hap',
             'pci_msitranslate',
             'pci_power_mgmt',
+            'xen_platform_pci',
         ]
 
         platform_configs = []

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.