Re: [SeaBIOS PATCH v3] hotplug: Add device per func in ACPI DSDT tables

2011-12-19 Thread Amos Kong

On 14/12/11 09:06, Kevin O'Connor wrote:

On Tue, Dec 06, 2011 at 07:32:55PM -0500, Amos Kong wrote:

- Original Message -

On Tue, Dec 06, 2011 at 01:39:35PM +0800, Amos Kong wrote:

Only func 0 is registered to guest driver (we can
only found func 0 in slot-funcs list of driver),
the other functions could not be cleaned when
hot-removing the whole slot. This patch adds
device per function in ACPI DSDT tables.
Notify only when func0 is added and removed.

Have tested with linux/winxp/win7, hot-adding/hot-remving,
single/multiple function device, they are all fine(all
added devices can be removed).


This includes some bits I wrote but this is not an ack
of the patch yet :)

I find it surprising that this works: a function
has _EJ0 so would not guest expect that ejecting
a single one will only remove it, and not all functions?


Removing single func is not supported by specific, and current code
(qemu/kernel pci driver) process hot-remove with the whole slot.
We could not hot-remove single func with/without this patch.

Register _EJ0() for each func, then all the funcs will be record
into the function list of the slot.


Just as an update - it's not clear to me what this patch does, and it
seems like Michael had some concerns.

Also, it doesn't seem right to hardcode the generation of that many
devices (248) in the AML code.


Hi Kevin,

When we hot-unplug a pci device, all functions in same slot should be 
unpluged
in one time. Hot-plug/unpluging nics for winXp VM is fine(all funcs can 
be removed).
But hot-unpluging nics of linux VM exists problem(only function 0 is 
removed),
Because not all the functions are registered in slot-funcs list in 
guest kernel.


What we can do to resolve this problem:

1. remove all the functions when hot-unplug one function in the slot
   http://marc.info/?l=kvmm=131597620101566w=2
   [PATCH] pci: clean all funcs when hot-removing multifunc device

2. register all the functions to slot-funcs list, then we don't need to
   change guest pci driver.
   http://marc.info/?l=kvmm=132314964618843w=2
   [SeaBIOS PATCH v3] hotplug: Add device per func in ACPI DSDT tables

mst, any more comment?

Thanks,
Amos


So, unless there are further comments I'm going to hold off on this
patch.

-Kevin
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [SeaBIOS PATCH v3] hotplug: Add device per func in ACPI DSDT tables

2011-12-13 Thread Kevin O'Connor
On Tue, Dec 06, 2011 at 07:32:55PM -0500, Amos Kong wrote:
 - Original Message -
  On Tue, Dec 06, 2011 at 01:39:35PM +0800, Amos Kong wrote:
   Only func 0 is registered to guest driver (we can
   only found func 0 in slot-funcs list of driver),
   the other functions could not be cleaned when
   hot-removing the whole slot. This patch adds
   device per function in ACPI DSDT tables.
   Notify only when func0 is added and removed.
   
   Have tested with linux/winxp/win7, hot-adding/hot-remving,
   single/multiple function device, they are all fine(all
   added devices can be removed).
   
  This includes some bits I wrote but this is not an ack
  of the patch yet :)
  
  I find it surprising that this works: a function
  has _EJ0 so would not guest expect that ejecting
  a single one will only remove it, and not all functions?
 
 Removing single func is not supported by specific, and current code
 (qemu/kernel pci driver) process hot-remove with the whole slot.
 We could not hot-remove single func with/without this patch.
 
 Register _EJ0() for each func, then all the funcs will be record
 into the function list of the slot.

Just as an update - it's not clear to me what this patch does, and it
seems like Michael had some concerns.

Also, it doesn't seem right to hardcode the generation of that many
devices (248) in the AML code.

So, unless there are further comments I'm going to hold off on this
patch.

-Kevin
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [SeaBIOS PATCH v3] hotplug: Add device per func in ACPI DSDT tables

2011-12-06 Thread Amos Kong
- Original Message -
 On Tue, Dec 06, 2011 at 01:39:35PM +0800, Amos Kong wrote:
  Only func 0 is registered to guest driver (we can
  only found func 0 in slot-funcs list of driver),
  the other functions could not be cleaned when
  hot-removing the whole slot. This patch adds
  device per function in ACPI DSDT tables.
  Notify only when func0 is added and removed.
  
  Have tested with linux/winxp/win7, hot-adding/hot-remving,
  single/multiple function device, they are all fine(all
  added devices can be removed).
  
  Changes from v2:
   update patch based on latest seabios tree
  
  Signed-off-by: Michael S. Tsirkin m...@redhat.com
  Signed-off-by: Amos Kong ak...@redhat.com
 
 This includes some bits I wrote but this is not an ack
 of the patch yet :)
 
 I find it surprising that this works: a function
 has _EJ0 so would not guest expect that ejecting
 a single one will only remove it, and not all functions?

Removing single func is not supported by specific, and current code
(qemu/kernel pci driver) process hot-remove with the whole slot.
We could not hot-remove single func with/without this patch.

Register _EJ0() for each func, then all the funcs will be record
into the function list of the slot.

Thanks, Amos

  ---
  
   src/ssdt-pcihp.dsl |   17
   src/ssdt-pcihp.hex | 9225
   ++--
   2 files changed, 8959 insertions(+), 283 deletions(-)
  
  diff --git a/src/ssdt-pcihp.dsl b/src/ssdt-pcihp.dsl
  index 4b435b8..2a3c326 100644
  --- a/src/ssdt-pcihp.dsl
  +++ b/src/ssdt-pcihp.dsl
  @@ -17,14 +17,23 @@ DefinitionBlock (ssdt-pcihp.aml, SSDT,
  0x01, BXPC, BXSSDTPCIHP, 0x1)
   // at runtime, if the slot is detected to not support
   hotplug.
   // Extract the offset of the address dword and the
   // _EJ0 name to allow this patching.
  -#define hotplug_slot(slot)  \
  -Device (S##slot) {  \
  +#define hotplug_func(slot, fn)  \
  +Device (S##slot##fn) {  \
  ACPI_EXTRACT_NAME_DWORD_CONST aml_adr_dword  \
  -   Name (_ADR, 0x##slot##)  \
  +   Name (_ADR, 0x##slot##000##fn)   \
  ACPI_EXTRACT_METHOD_STRING aml_ej0_name  \
  Method (_EJ0, 1) { Return(PCEJ(0x##slot)) }  \
  Name (_SUN, 0x##slot)\
   }
  +#define hotplug_slot(slot) \
  +hotplug_func(slot, 0)  \
  +hotplug_func(slot, 1)  \
  +hotplug_func(slot, 2)  \
  +hotplug_func(slot, 3)  \
  +hotplug_func(slot, 4)  \
  +hotplug_func(slot, 5)  \
  +hotplug_func(slot, 6)  \
  +hotplug_func(slot, 7)
   
   hotplug_slot(01)
   hotplug_slot(02)
  @@ -59,7 +68,7 @@ DefinitionBlock (ssdt-pcihp.aml, SSDT, 0x01,
  BXPC, BXSSDTPCIHP, 0x1)
   hotplug_slot(1f)
   
   #define gen_pci_hotplug(slot)   \
  -If (LEqual(Arg0, 0x##slot)) { Notify(S##slot, Arg1) }
  +If (LEqual(Arg0, 0x##slot)) { Notify(S##slot##0, Arg1)
  }
   
   Method(PCNT, 2) {
   gen_pci_hotplug(01)
  diff --git a/src/ssdt-pcihp.hex b/src/ssdt-pcihp.hex
  index b15ad5a..4c9b5df 100644
  --- a/src/ssdt-pcihp.hex
  +++ b/src/ssdt-pcihp.hex
  @@ -1,80 +1,514 @@
   static unsigned short aml_adr_dword[] = {
  -0x3e,
  -0x62,
  -0x88,
  -0xae,
  -0xd4,
  -0xfa,
  -0x120,

...
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html