1. 08 6月, 2017 3 次提交
    • D
      spapr: Change DRC attach & detach methods to functions · 0be4e886
      David Gibson 提交于
      DRC objects have attach & detach methods, but there's only one
      implementation.  Although there are some differences in its behaviour for
      different DRC types, the overall structure is the same, so while we might
      want different method implementations for some parts, we're unlikely to
      want them for the top-level functions.
      
      So, replace them with direct function calls.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Acked-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      0be4e886
    • D
      spapr: Clean up handling of DR-indicator · cd74d27e
      David Gibson 提交于
      There are 3 types of "indicator" associated with hotplug in the PAPR spec
      the "allocation state", "isolation state" and "DR-indicator".  The first
      two are intimately tied to the various state transitions associated with
      hotplug.  The DR-indicator, however, is different and simpler.
      
      It's basically just a guest controlled variable which can be used by the
      guest to flag state or problems associated with a device.  The idea is that
      the hypervisor can use it to present information back on management
      consoles (on some machines with PowerVM it may even control physical LEDs
      on the machine case associated with the relevant device).
      
      For that reason, there's only ever likely to be a single update
      implementation so the set_indicator_state method isn't useful.  Replace it
      with a direct function call.
      
      While we're there, make some small associated cleanups:
        * PAPR doesn't use the term "indicator state", just "DR-indicator" and
      the allocation state and isolation state are also considered "indicators".
      Rename things to be less confusing
        * Fold set_indicator_state() and rtas_set_indicator_state() into a single
      rtas_set_dr_indicator() function.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Acked-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      cd74d27e
    • D
      spapr: Clean up DR entity sense handling · f224d35b
      David Gibson 提交于
      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: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Acked-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      f224d35b
  2. 06 6月, 2017 8 次提交
  3. 04 6月, 2017 1 次提交
  4. 02 6月, 2017 6 次提交
  5. 26 5月, 2017 3 次提交
  6. 25 5月, 2017 2 次提交
    • D
      hw/ppc: removing drc->detach_cb and drc->detach_cb_opaque · 31834723
      Daniel Henrique Barboza 提交于
      The pointer drc->detach_cb is being used as a way of informing
      the detach() function inside spapr_drc.c which cb to execute. This
      information can also be retrieved simply by checking drc->type and
      choosing the right callback based on it. In this context, detach_cb
      is redundant information that must be managed.
      
      After the previous spapr_lmb_release change, no detach_cb_opaques
      are being used by any of the three callbacks functions. This is
      yet another information that is now unused and, on top of that, can't
      be migrated either.
      
      This patch makes the following changes:
      
      - removal of detach_cb_opaque. the 'opaque' argument was removed from
      the callbacks and from the detach() function of sPAPRConnectorClass. The
      attribute detach_cb_opaque of sPAPRConnector was removed.
      
      - removal of detach_cb from the detach() call. The function pointer
      detach_cb of sPAPRConnector was removed. detach() now uses a
      switch(drc->type) to execute the apropriate callback. To achieve this,
      spapr_core_release, spapr_lmb_release and spapr_phb_remove_pci_device_cb
      callbacks were made public to be visible inside detach().
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      31834723
    • D
      hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState · 0cffce56
      David Gibson 提交于
      The LMB DRC release callback, spapr_lmb_release(), uses an opaque
      parameter, a sPAPRDIMMState struct that stores the current LMBs that
      are allocated to a DIMM (nr_lmbs). After each call to this callback,
      the nr_lmbs is decremented by one and, when it reaches zero, the callback
      proceeds with the qdev calls to hot unplug the LMB.
      
      Using drc->detach_cb_opaque is problematic because it can't be migrated in
      the future DRC migration work. This patch makes the following changes to
      eliminate the usage of this opaque callback inside spapr_lmb_release:
      
      - sPAPRDIMMState was moved from spapr.c and added to spapr.h. A new
      attribute called 'addr' was added to it. This is used as an unique
      identifier to associate a sPAPRDIMMState to a PCDIMM element.
      
      - sPAPRMachineState now hosts a new QTAILQ called 'pending_dimm_unplugs'.
      This queue of sPAPRDIMMState elements will store the DIMM state of DIMMs
      that are currently going under an unplug process.
      
      - spapr_lmb_release() will now retrieve the nr_lmbs value by getting the
      correspondent sPAPRDIMMState. A helper function called spapr_dimm_get_address
      was created to fetch the address of a PCDIMM device inside spapr_lmb_release.
      When nr_lmbs reaches zero and the callback proceeds with the qdev hot unplug
      calls, the sPAPRDIMMState struct is removed from spapr->pending_dimm_unplugs.
      
      After these changes, the opaque argument for spapr_lmb_release is now
      unused and is passed as NULL inside spapr_del_lmbs. This and the other
      opaque arguments can now be safely removed from the code.
      
      As an additional cleanup made by this patch, the spapr_del_lmbs function
      was merged with spapr_memory_unplug_request. The former was being called
      only by the latter and both were small enough to fit one single function.
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      [dwg: Minor stylistic cleanups]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      0cffce56
  7. 24 5月, 2017 4 次提交
  8. 19 5月, 2017 11 次提交
  9. 18 5月, 2017 1 次提交
  10. 17 5月, 2017 1 次提交
    • E
      qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable · e90f2a8c
      Eduardo Habkost 提交于
      cannot_instantiate_with_device_add_yet was introduced by commit
      efec3dd6 to replace no_user. It was
      supposed to be a temporary measure.
      
      When it was introduced, we had 54
      cannot_instantiate_with_device_add_yet=true lines in the code.
      Today (3 years later) this number has not shrunk: we now have
      57 cannot_instantiate_with_device_add_yet=true lines. I think it
      is safe to say it is not a temporary measure, and we won't see
      the flag go away soon.
      
      Instead of a long field name that misleads people to believe it
      is temporary, replace it a shorter and less misleading field:
      user_creatable.
      
      Except for code comments, changes were generated using the
      following Coccinelle patch:
      
        @@
        expression DC;
        @@
        (
        -DC->cannot_instantiate_with_device_add_yet = false;
        +DC->user_creatable = true;
        |
        -DC->cannot_instantiate_with_device_add_yet = true;
        +DC->user_creatable = false;
        )
      
        @@
        typedef ObjectClass;
        expression dc;
        identifier class, data;
        @@
         static void device_class_init(ObjectClass *class, void *data)
         {
         ...
         dc->hotpluggable = true;
        +dc->user_creatable = true;
         ...
         }
      
        @@
        @@
         struct DeviceClass {
         ...
        -bool cannot_instantiate_with_device_add_yet;
        +bool user_creatable;
         ...
        }
      
        @@
        expression DC;
        @@
        (
        -!DC->cannot_instantiate_with_device_add_yet
        +DC->user_creatable
        |
        -DC->cannot_instantiate_with_device_add_yet
        +!DC->user_creatable
        )
      
      Cc: Alistair Francis <alistair.francis@xilinx.com>
      Cc: Laszlo Ersek <lersek@redhat.com>
      Cc: Marcel Apfelbaum <marcel@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Peter Maydell <peter.maydell@linaro.org>
      Cc: Thomas Huth <thuth@redhat.com>
      Acked-by: NAlistair Francis <alistair.francis@xilinx.com>
      Reviewed-by: NThomas Huth <thuth@redhat.com>
      Reviewed-by: NMarcel Apfelbaum <marcel@redhat.com>
      Acked-by: NMarcel Apfelbaum <marcel@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <20170503203604.31462-2-ehabkost@redhat.com>
      [ehabkost: kept "TODO remove once we're there" comment]
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
      e90f2a8c