mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
spapr: Clean up DR entity sense handling
DRC classes have an entity_sense method to determine (in a specific PAPR sense) the presence or absence of a device plugged into a DRC. However, we only have one implementation of the method, which explicitly tests for different DRC types. This changes it to instead have different method implementations for the two cases: "logical" and "physical" DRCs. While we're at it, the entity sense method always returns RTAS_OUT_SUCCESS, and the interesting value is returned via pass-by-reference. Simplify this to directly return the value we care about Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> Acked-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
parent
2c5534776b
commit
f224d35be9
4 changed files with 41 additions and 44 deletions
|
@ -1481,7 +1481,7 @@ static void spapr_phb_hot_plug_child(HotplugHandler *plug_handler,
|
|||
func_drc = spapr_phb_get_pci_func_drc(phb, pci_bus_num(bus),
|
||||
PCI_DEVFN(slotnr, i));
|
||||
func_drck = SPAPR_DR_CONNECTOR_GET_CLASS(func_drc);
|
||||
func_drck->entity_sense(func_drc, &state);
|
||||
state = func_drck->dr_entity_sense(func_drc);
|
||||
|
||||
if (state == SPAPR_DR_ENTITY_SENSE_PRESENT) {
|
||||
spapr_hotplug_req_add_by_index(func_drc);
|
||||
|
@ -1522,7 +1522,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,
|
|||
func_drc = spapr_phb_get_pci_func_drc(phb, pci_bus_num(bus),
|
||||
PCI_DEVFN(slotnr, i));
|
||||
func_drck = SPAPR_DR_CONNECTOR_GET_CLASS(func_drc);
|
||||
func_drck->entity_sense(func_drc, &state);
|
||||
state = func_drck->dr_entity_sense(func_drc);
|
||||
if (state == SPAPR_DR_ENTITY_SENSE_PRESENT
|
||||
&& !func_drck->release_pending(func_drc)) {
|
||||
error_setg(errp,
|
||||
|
@ -1548,7 +1548,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,
|
|||
func_drc = spapr_phb_get_pci_func_drc(phb, pci_bus_num(bus),
|
||||
PCI_DEVFN(slotnr, i));
|
||||
func_drck = SPAPR_DR_CONNECTOR_GET_CLASS(func_drc);
|
||||
func_drck->entity_sense(func_drc, &state);
|
||||
state = func_drck->dr_entity_sense(func_drc);
|
||||
if (state == SPAPR_DR_ENTITY_SENSE_PRESENT) {
|
||||
spapr_hotplug_req_remove_by_index(func_drc);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue