[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/2] Disable xen platform PCI device when xen_platform_pci=0 is specified
This patch is the xen side of the series. - 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. Thanks, -- Yuji Shimada Signed-off-by: Yuji Shimada <shimada-yxb@xxxxxxxxxxxxxxx> diff -r 92a6cc5eae2e tools/examples/xmexample.hvm --- a/tools/examples/xmexample.hvm Tue Mar 17 15:29:57 2009 +0000 +++ b/tools/examples/xmexample.hvm Wed Mar 18 15:35:45 2009 +0900 @@ -225,6 +225,10 @@ #keymap='ja' #----------------------------------------------------------------------------- +# Enable/disable xen platform PCI device, default=1 (enabled) +#xen_platform_pci=1 + +#----------------------------------------------------------------------------- # Configure guest CPUID responses: # #cpuid=[ '1:ecx=xxxxxxxxxxx00xxxxxxxxxxxxxxxxxxx, diff -r 92a6cc5eae2e tools/firmware/hvmloader/config.h --- a/tools/firmware/hvmloader/config.h Tue Mar 17 15:29:57 2009 +0000 +++ b/tools/firmware/hvmloader/config.h Wed Mar 18 15:35:45 2009 +0900 @@ -56,9 +56,7 @@ 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 92a6cc5eae2e tools/firmware/hvmloader/hvmloader.c --- a/tools/firmware/hvmloader/hvmloader.c Tue Mar 17 15:29:57 2009 +0000 +++ b/tools/firmware/hvmloader/hvmloader.c Wed Mar 18 15:35:45 2009 +0900 @@ -539,25 +539,6 @@ 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 @@ 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 92a6cc5eae2e tools/firmware/rombios/rombios.c --- a/tools/firmware/rombios/rombios.c Tue Mar 17 15:29:57 2009 +0000 +++ b/tools/firmware/rombios/rombios.c Wed Mar 18 15:35:45 2009 +0900 @@ -1418,24 +1418,14 @@ 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(0x10, 0); } void disable_rom_write_access() { - outb(rom_write_access_control(), PFFLAG_ROM_LOCK); + outb(0x10, PFFLAG_ROM_LOCK); } #endif /* HVMASSIST */ diff -r 92a6cc5eae2e tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Tue Mar 17 15:29:57 2009 +0000 +++ b/tools/python/xen/xend/XendConfig.py Wed Mar 18 15:35:45 2009 +0900 @@ -170,6 +170,7 @@ '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 @@ 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 92a6cc5eae2e tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Tue Mar 17 15:29:57 2009 +0000 +++ b/tools/python/xen/xend/image.py Wed Mar 18 15:35:45 2009 +0900 @@ -716,6 +716,7 @@ 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 @@ ("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 92a6cc5eae2e tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Tue Mar 17 15:29:57 2009 +0000 +++ b/tools/python/xen/xm/create.py Wed Mar 18 15:35:45 2009 +0900 @@ -611,6 +611,10 @@ 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. """ @@ -921,7 +925,7 @@ '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 92a6cc5eae2e tools/python/xen/xm/xenapi_create.py --- a/tools/python/xen/xm/xenapi_create.py Tue Mar 17 15:29:57 2009 +0000 +++ b/tools/python/xen/xm/xenapi_create.py Wed Mar 18 15:35:45 2009 +0900 @@ -1048,6 +1048,7 @@ 'hap', 'pci_msitranslate', 'pci_power_mgmt', + 'xen_platform_pci', ] platform_configs = [] _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |