Skip to contentSkip to conversation

Disable xen platform device when it is not needed.

RFC Yuji Shimada 7 participants 19 messages Feb 18, 2009 – Feb 23, 2009

lore
Share & tools
lore
#0 lore raw

I plan to create the patch to disable xen platform device when it is not needed. Please let me know if anyone has a comment.

Windows guest shows xen platform device as unknown device with "!" mark in the device manager, when PV drivers are not loaded. So I'd like to disable xen platform device.

If following conditions are all true, I will disable xen platform device. Otherwise, xen platform device will be enabled.

- All entries in "disk" parameter have "ioemu:" prefix in DEV field. Example:
disk = [ '/var/images/guest.img,ioemu:hda,w', ',ioemu:hdc:cdrom,r' ]

- All entries in "vif" parameter have "type=ioemu". Example:
vif = [ 'type=ioemu, bridge=eth0', 'type=ioemu, bridge=eth1' ]

- "vscsi" parameter is not specified.

Xen platform device has functions for PV drivers and guest firmware (hvmloader and rombios). The functions for PV drivers will be disabled when xen platform device is disabled. This is no problem. But the function for guest firmware should not be disabled.

I will move the function for guest firmware from xen platform device to host bridge. The interface between host bridge and guest firmware will be in PCI configuration space, because host bridge does not have io resource and memory resource.

The function which I will move is switching RW/RO state of ROM memory area. Please refer qemu-xen/hw/xen_platform.c:xen_platform_ioport_writeb. I will not move the other functions.

Thanks,
--
Yuji Shimada

#1 lore raw
Quoted 4 lines

I plan to create the patch to disable xen platform device when it is not needed. Please let me know if anyone has a comment.

Quoted 8 lines

Windows guest shows xen platform device as unknown device with "!" mark in the device manager, when PV drivers are not loaded. So I'd like to disable xen platform device.

If following conditions are all true, I will disable xen platform device. Otherwise, xen platform device will be enabled.

- All entries in "disk" parameter have "ioemu:" prefix in DEV

field.

Quoted 2 lines
        Example:
        disk = [ '/var/images/guest.img,ioemu:hda,w',

',ioemu:hdc:cdrom,r'

Quoted 7 lines

]

- All entries in "vif" parameter have "type=ioemu". Example:
vif = [ 'type=ioemu, bridge=eth0', 'type=ioemu, bridge=eth1' ]

- "vscsi" parameter is not specified.

I still leave my disks and network as ioemu even when using PV drivers, as I simply need to use the /NOGPLPV boot option to switch back to them.

I recommend you add a 'no_platform_pci=1' option or something like that, rather than try and guess that the user doesn't want it.

I'm also not sure that xen will boot without the disks being in ioemu mode, so using a non-ioemu disk for the situation where you want to use PV drivers will not give you a bootable system.

James

#2 lore raw
Quoted 22 lines · James Harper
Quoted 4 lines

I plan to create the patch to disable xen platform device when it is not needed. Please let me know if anyone has a comment.

Quoted 8 lines

Windows guest shows xen platform device as unknown device with "!" mark in the device manager, when PV drivers are not loaded. So I'd like to disable xen platform device.

If following conditions are all true, I will disable xen platform device. Otherwise, xen platform device will be enabled.

- All entries in "disk" parameter have "ioemu:" prefix in DEV

field.

Quoted 2 lines
        Example:
        disk = [ '/var/images/guest.img,ioemu:hda,w',

',ioemu:hdc:cdrom,r'

Quoted 6 lines

]

- All entries in "vif" parameter have "type=ioemu". Example:
vif = [ 'type=ioemu, bridge=eth0', 'type=ioemu, bridge=eth1' ]

Quoted 7 lines
Quoted 1 line

- "vscsi" parameter is not specified.

I still leave my disks and network as ioemu even when using PV drivers, as I simply need to use the /NOGPLPV boot option to switch back to them.

I recommend you add a 'no_platform_pci=1' option or something like that, rather than try and guess that the user doesn't want it.

Besides, we can add a PV disk by 'xm block-attach' command after boot. My vote would be a 'xen_platform_pci=0' option (default=1).

Quoted 3 lines

I'm also not sure that xen will boot without the disks being in ioemu mode, so using a non-ioemu disk for the situation where you want to use PV drivers will not give you a bootable system.

The PCI passthrough enables it.

Thanks,
Kouya

#3 lore raw
In reply to James Harper

Thank you for your comments.

Quoted 18 lines · On Wed, 18 Feb 2009 11:29:54 +1100 "James Harper"…
Quoted 4 lines

I plan to create the patch to disable xen platform device when it is not needed. Please let me know if anyone has a comment.

Quoted 8 lines

Windows guest shows xen platform device as unknown device with "!" mark in the device manager, when PV drivers are not loaded. So I'd like to disable xen platform device.

If following conditions are all true, I will disable xen platform device. Otherwise, xen platform device will be enabled.

- All entries in "disk" parameter have "ioemu:" prefix in DEV

field.

Quoted 2 lines
        Example:
        disk = [ '/var/images/guest.img,ioemu:hda,w',

',ioemu:hdc:cdrom,r'

Quoted 2 lines

]

Quoted 8 lines
Quoted 5 lines

- All entries in "vif" parameter have "type=ioemu". Example:
vif = [ 'type=ioemu, bridge=eth0', 'type=ioemu, bridge=eth1' ]

- "vscsi" parameter is not specified.

I still leave my disks and network as ioemu even when using PV drivers, as I simply need to use the /NOGPLPV boot option to switch back to them.

When "ioemu:" or "type=ioemu" are not specified, both emulated device and PV device are enabled. This is current xen's behavior.

So my idea does not break your usage.

Quoted 2 lines

I recommend you add a 'no_platform_pci=1' option or something like that, rather than try and guess that the user doesn't want it.

I think xen's users are not interested in whether platform device is enabled or disabled. When they find that the device manager shows "!", they will complain. On the other hand, they are interested in type of disk and vif, because this affects the performance of disk and vif. So I think it is better to use "ioemu:" and "type=ioemu".

What do you think about this?

Thanks,
--
Yuji Shimada

#4 lore raw
Quoted 12 lines

Thank you for your comments.

Quoted 6 lines · On Wed, 18 Feb 2009 11:29:54 +1100 "James Harper"…
Quoted 6 lines

I plan to create the patch to disable xen platform device when it is not needed. Please let me know if anyone has a comment.

Windows guest shows xen platform device as unknown device with "!" mark in the device manager, when PV drivers are

not

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

loaded. So I'd like to disable xen platform device.

If following conditions are all true, I will disable xen platform device. Otherwise, xen platform device will be enabled.

- All entries in "disk" parameter have "ioemu:" prefix in DEV

field.

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
        Example:
        disk = [ '/var/images/guest.img,ioemu:hda,w',

',ioemu:hdc:cdrom,r'

Quoted 5 lines

]

- All entries in "vif" parameter have "type=ioemu". Example:
vif = [ 'type=ioemu, bridge=eth0', 'type=ioemu,

bridge=eth1' ]

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

- "vscsi" parameter is not specified.

I still leave my disks and network as ioemu even when using PV

drivers,

Quoted 1 line
Quoted 1 line

as I simply need to use the /NOGPLPV boot option to switch back to

them.

Quoted 5 lines

When "ioemu:" or "type=ioemu" are not specified, both emulated device and PV device are enabled. This is current xen's behavior.

So my idea does not break your usage.

Maybe I don't understand your idea, but I think you are saying that if ioemu is specified then the PV drivers won't work because you will disable the platform pci device.

James

#5 lore raw
Quoted 36 lines
Quoted 11 lines

Thank you for your comments.

Quoted 6 lines · On Wed, 18 Feb 2009 11:29:54 +1100 "James Harper"…
Quoted 6 lines

I plan to create the patch to disable xen platform device when it is not needed. Please let me know if anyone has a comment.

Windows guest shows xen platform device as unknown device with "!" mark in the device manager, when PV drivers are

not

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

loaded. So I'd like to disable xen platform device.

If following conditions are all true, I will disable xen platform device. Otherwise, xen platform device will be enabled.

- All entries in "disk" parameter have "ioemu:" prefix in DEV

field.

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
        Example:
        disk = [ '/var/images/guest.img,ioemu:hda,w',

',ioemu:hdc:cdrom,r'

Quoted 5 lines

]

- All entries in "vif" parameter have "type=ioemu". Example:
vif = [ 'type=ioemu, bridge=eth0', 'type=ioemu,

bridge=eth1' ]

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

- "vscsi" parameter is not specified.

I still leave my disks and network as ioemu even when using PV

drivers,

Quoted 1 line
Quoted 1 line

as I simply need to use the /NOGPLPV boot option to switch back to

them.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

When "ioemu:" or "type=ioemu" are not specified, both emulated device and PV device are enabled. This is current xen's behavior.

So my idea does not break your usage.

Maybe I don't understand your idea, but I think you are saying that if ioemu is specified then the PV drivers won't work because you will disable the platform pci device.

I suppose your understanding is right.

BTW, I have one question.
If you want to use the PV drivers, I don't think xen requires "ioemu" option. Without "ioemu" option, xen will enable the emulated devices.
Why do you need "ioemu" option?

Thanks,
--
Shohei Fujiwara

#6 lore raw
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

So my idea does not break your usage.

Maybe I don't understand your idea, but I think you are saying that

if

Quoted 11 lines
Quoted 2 lines

ioemu is specified then the PV drivers won't work because you will disable the platform pci device.

I suppose your understanding is right.

BTW, I have one question.
If you want to use the PV drivers, I don't think xen requires "ioemu" option.
Without "ioemu" option, xen will enable the emulated devices. Why do you need "ioemu" option?

For booting. I don't think PV boot in HVM is supported properly yet is it? That post I was directed to appears to just be an idea.

Also, the instructions for setting up GPLPV specify to add a separate entry into boot.ini with a '/NOGPLPV' option in it which will disable the PV device drivers and use the ioemu drivers, which is useful for testing to see if an error is being caused by the GPLPV drivers or is unrelated. Also safe mode will disable the PV drivers (I'm not sure if that will stay that way though). It would be a nuisance to have to edit the domu config file each time you wanted to flip between the two modes.

Do you have an objection to something like an explicit 'xen_platform_pci=0' option in the config to disable the PCI device? That seems like a far more sensible way of doing things IMHO if users are really bothered by the extra PCI device.

James

#7 lore raw
In reply to James Harper
Quoted 8 lines · James Harper
Quoted 4 lines

When "ioemu:" or "type=ioemu" are not specified, both emulated device and PV device are enabled. This is current xen's behavior.

So my idea does not break your usage.

Maybe I don't understand your idea, but I think you are saying that if ioemu is specified then the PV drivers won't work because you will disable the platform pci device.

That's my understanding. I'm not keen.

-- Keir

#9 lore raw
In reply to Yuji Shimada
Quoted 3 lines · Yuji Shimada

Windows guest shows xen platform device as unknown device with "!" mark in the device manager, when PV drivers are not loaded. So I'd like to disable xen platform device.

Is it really worth the hassle just to get rid of that? A number of responders have said they don't want the device auto disabled, and noone is going to bother to manually disable the device just to get rid of a warning triangle in device manager.

-- Keir

#10 lore raw
In reply to Yuji Shimada

Thank all for the comments.

I will create the patch to add "xen_platform_pci" option in guest config file to disable xen platform device.

xen_platform_pci=0: Disable xen platform device. xen_platform_pci=1: Enable xen platform device. (default)

Thanks,
--
Yuji Shimada

Quoted 38 lines · On Wed, 18 Feb 2009 09:15:43 +0900 Yuji Shimada <[email protected]>…

I plan to create the patch to disable xen platform device when it is not needed. Please let me know if anyone has a comment.

Windows guest shows xen platform device as unknown device with "!" mark in the device manager, when PV drivers are not loaded. So I'd like to disable xen platform device.

If following conditions are all true, I will disable xen platform device. Otherwise, xen platform device will be enabled.

- All entries in "disk" parameter have "ioemu:" prefix in DEV field. Example:
disk = [ '/var/images/guest.img,ioemu:hda,w', ',ioemu:hdc:cdrom,r' ]

- All entries in "vif" parameter have "type=ioemu". Example:
vif = [ 'type=ioemu, bridge=eth0', 'type=ioemu, bridge=eth1' ]

- "vscsi" parameter is not specified.

Xen platform device has functions for PV drivers and guest firmware (hvmloader and rombios). The functions for PV drivers will be disabled when xen platform device is disabled. This is no problem. But the function for guest firmware should not be disabled.

I will move the function for guest firmware from xen platform device to host bridge. The interface between host bridge and guest firmware will be in PCI configuration space, because host bridge does not have io resource and memory resource.

The function which I will move is switching RW/RO state of ROM memory area. Please refer qemu-xen/hw/xen_platform.c:xen_platform_ioport_writeb. I will not move the other functions.

Thanks,
--
Yuji Shimada

#11 lore raw
Quoted 7 lines · Yuji Shimada

Thank all for the comments.

I will create the patch to add "xen_platform_pci" option in guest config file to disable xen platform device.

xen_platform_pci=0: Disable xen platform device. xen_platform_pci=1: Enable xen platform device. (default)

I still might veto this. I don't really want the platform device I/O ports scattered elsewhere for this rather frivolous reason.

-- Keir

#12 lore raw
Quoted 8 lines · Keir Fraser
Quoted 5 lines

I will create the patch to add "xen_platform_pci" option in guest config file to disable xen platform device.

xen_platform_pci=0: Disable xen platform device. xen_platform_pci=1: Enable xen platform device. (default)

I still might veto this. I don't really want the platform device I/O ports scattered elsewhere for this rather frivolous reason.

Actually it's okay, you can alias the 'platform_flags' byte of the ioport BAR to fixed byte port 0x10. There's a handler for that already in xen_platform.c (platform_fixed_ioport_{read,write}1). That's the only port that hvmloader/rombios cares about.

Hvmloader/rombios can then always use fixed single-byte ioport 0x10. This is actually better since the code is simpler and also rombios accesses that port on S3 suspend/resume, at which point an OS could have relocated the xen_platform ioport BAR! Using a fixed port is therefore safer.

Notice that I said you must *alias* this ioport byte. You cannot remove it from the xen_platform BAR as old saved guests will rely on it being there, and removing it will break their S3. We have to be backward compatible with the Xen-3.3 virtual hardware interface for saved guests.

So, no veto after all!

-- Keir

#13 lore raw
Quoted 21 lines · On Thu, 19 Feb 2009 09:53:54 +0000 Keir Fraser <[email protected]>…
Quoted 8 lines · Keir Fraser
Quoted 5 lines

I will create the patch to add "xen_platform_pci" option in guest config file to disable xen platform device.

xen_platform_pci=0: Disable xen platform device. xen_platform_pci=1: Enable xen platform device. (default)

I still might veto this. I don't really want the platform device I/O ports scattered elsewhere for this rather frivolous reason.

Actually it's okay, you can alias the 'platform_flags' byte of the ioport BAR to fixed byte port 0x10. There's a handler for that already in xen_platform.c (platform_fixed_ioport_{read,write}1). That's the only port that hvmloader/rombios cares about.

Hvmloader/rombios can then always use fixed single-byte ioport 0x10. This is actually better since the code is simpler and also rombios accesses that port on S3 suspend/resume, at which point an OS could have relocated the xen_platform ioport BAR! Using a fixed port is therefore safer.

Quoted 6 lines

Notice that I said you must *alias* this ioport byte. You cannot remove it from the xen_platform BAR as old saved guests will rely on it being there, and removing it will break their S3. We have to be backward compatible with the Xen-3.3 virtual hardware interface for saved guests.

So, no veto after all!

I will create the patch as follows.

- Alias the 'platform_flags' byte of the ioport BAR to fixed byte port 0x10, and don't remove existing 'platform_flags' byte.

- Change guest firmware to use new fixed byte port 0x10.

- Add "xen_platform_pci" option in guest config file.

xen_platform_pci=0: Disable xen platform device. xen_platform_pci=1: Enable xen platform device. (default)

Thanks,
--
Yuji Shimada

#14 lore raw
Quoted 11 lines · Yuji Shimada

I will create the patch as follows.

- Alias the 'platform_flags' byte of the ioport BAR to fixed byte port 0x10, and don't remove existing 'platform_flags' byte.

- Change guest firmware to use new fixed byte port 0x10.

- Add "xen_platform_pci" option in guest config file.

xen_platform_pci=0: Disable xen platform device. xen_platform_pci=1: Enable xen platform device. (default)

Agreed.

K.

#15 lore raw
In reply to Yuji Shimada

Yuji Shimada writes ("Re: [Xen-devel] [RFC] Disable xen platform device when it is not needed."):

Quoted 2 lines

- Alias the 'platform_flags' byte of the ioport BAR to fixed byte port 0x10, and don't remove existing 'platform_flags' byte.

How will this interact with the `disable qemu PCI devices in HVM domains' feature, which also uses ioport 0x10 ?

Ian.

#16 lore raw
Quoted 7 lines · Ian Jackson

Yuji Shimada writes ("Re: [Xen-devel] [RFC] Disable xen platform device when it is not needed."):

Quoted 2 lines

- Alias the 'platform_flags' byte of the ioport BAR to fixed byte port 0x10, and don't remove existing 'platform_flags' byte.

How will this interact with the `disable qemu PCI devices in HVM domains' feature, which also uses ioport 0x10 ?

That feature implements WORD and DWORD ports at address 0x10, but leaves the BYTE port at that address available for other uses.

-- Keir

#17 lore raw

Keir Fraser writes ("Re: [Xen-devel] [RFC] Disable xen platform device when it is not needed."):

Quoted 6 lines · Ian Jackson
Quoted 2 lines

How will this interact with the `disable qemu PCI devices in HVM domains' feature, which also uses ioport 0x10 ?

That feature implements WORD and DWORD ports at address 0x10, but leaves the BYTE port at that address available for other uses.

Ah, err, yes. Ugh. Maybe a table of uses of ioports 0x10 (and 0x12!) would be a sensible addition to xen-unstable.hg/doc/ somewhere.

Ian.

#18 lore raw
Quoted 11 lines · Ian Jackson

Keir Fraser writes ("Re: [Xen-devel] [RFC] Disable xen platform device when it is not needed."):

Quoted 6 lines · Ian Jackson
Quoted 2 lines

How will this interact with the `disable qemu PCI devices in HVM domains' feature, which also uses ioport 0x10 ?

That feature implements WORD and DWORD ports at address 0x10, but leaves the BYTE port at that address available for other uses.

Ah, err, yes. Ugh. Maybe a table of uses of ioports 0x10 (and 0x12!) would be a sensible addition to xen-unstable.hg/doc/ somewhere.

Well, byte 0x10 is available and is the first one, so it seemed to make sense to me. ;-) The protocol on the fixed ports is already kind of ugly and makes use of different meanings for different access sizes, so it's in the existing spirit also. More documentation is almost always nice, so I can't disagree with that.

-- Keir