1. 09 2月, 2018 1 次提交
    • M
      qdict qlist: Make most helper macros functions · 15280c36
      Markus Armbruster 提交于
      The macro expansions of qdict_put_TYPE() and qlist_append_TYPE() need
      qbool.h, qnull.h, qnum.h and qstring.h to compile.  We include qnull.h
      and qnum.h in the headers, but not qbool.h and qstring.h.  Works,
      because we include those wherever the macros get used.
      
      Open-coding these helpers is of dubious value.  Turn them into
      functions and drop the includes from the headers.
      
      This cleanup makes the number of objects depending on qapi/qmp/qnum.h
      from 4551 (out of 4743) to 46 in my "build everything" tree.  For
      qapi/qmp/qnull.h, the number drops from 4552 to 21.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180201111846.21846-10-armbru@redhat.com>
      15280c36
  2. 20 11月, 2017 1 次提交
    • G
      spapr: reset DRCs after devices · 82512483
      Greg Kurz 提交于
      A DRC with a pending unplug request releases its associated device at
      machine reset time.
      
      In the case of LMB, when all DRCs for a DIMM device have been reset,
      the DIMM gets unplugged, causing guest memory to disappear. This may
      be very confusing for anything still using this memory.
      
      This is exactly what happens with vhost backends, and QEMU aborts
      with:
      
      qemu-system-ppc64: used ring relocated for ring 2
      qemu-system-ppc64: qemu/hw/virtio/vhost.c:649: vhost_commit: Assertion
       `r >= 0' failed.
      
      The issue is that each DRC registers a QEMU reset handler, and we
      don't control the order in which these handlers are called (ie,
      a LMB DRC will unplug a DIMM before the virtio device using the
      memory on this DIMM could stop its vhost backend).
      
      To avoid such situations, let's reset DRCs after all devices
      have been reset.
      Reported-by: NMallesh N. Koti <mallesh@linux.vnet.ibm.com>
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      82512483
  3. 08 9月, 2017 5 次提交
    • M
      spapr_drc: pass object ownership to parent/owner · f3f41030
      Michael Roth 提交于
      DRC objects attach themselves to an owner as a child
      property. unref afterward to allow them to be finalized
      when their owner is finalized.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      f3f41030
    • G
      spapr_drc: add unrealize method to physical DRC class · 379ae096
      Greg Kurz 提交于
      When hot-unplugging a PHB, all its PCI DRC connectors get unrealized. This
      patch adds an unrealize method to the physical DRC class, in order to undo
      registrations performed in realize_physical().
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      379ae096
    • G
      spapr_drc: use g_strdup_printf() instead of snprintf() · f5babeac
      Greg Kurz 提交于
      Passing a stack allocated buffer of arbitrary length to snprintf()
      without checking the return value can cause the resultant strings
      to be silently truncated.
      Signed-off-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      f5babeac
    • D
      hw/ppc: CAS reset on early device hotplug · 10f12e64
      Daniel Henrique Barboza 提交于
      This patch is a follow up on the discussions made in patch
      "hw/ppc: disable hotplug before CAS is completed" that can be
      found at [1].
      
      At this moment, we do not support CPU/memory hotplug in early
      boot stages, before CAS. When a hotplug occurs, the event is logged
      in an internal RTAS event log queue and an IRQ pulse is fired. In
      regular conditions, the guest handles the interrupt by executing
      check_exception, fetching the generated hotplug event and enabling
      the device for use.
      
      In early boot, this IRQ isn't caught (SLOF does not handle hotplug
      events), leaving the event in the rtas event log queue. If the guest
      executes check_exception due to another hotplug event, the re-assertion
      of the IRQ ends up de-queuing the first hotplug event as well. In short,
      a device hotplugged before CAS is considered coldplugged by SLOF.
      This leads to device misbehavior and, in some cases, guest kernel
      Ooops when trying to unplug the device.
      
      A proper fix would be to turn every device hotplugged before CAS
      as a colplugged device. This is not trivial to do with the current
      code base though - the FDT is written in the guest memory at
      ppc_spapr_reset and can't be retrieved without adding extra state
      (fdt_size for example) that will need to managed and migrated. Adding
      the hotplugged DT in the middle of CAS negotiation via the updated DT
      tree works with CPU devs, but panics the guest kernel at boot. Additional
      analysis would be necessary for LMBs and PCI devices. There are
      questions to be made in QEMU/SLOF/kernel level about how we can make
      this change in a sustainable way.
      
      With Linux guests, a fix would be the kernel executing check_exception
      at boot time, de-queueing the events that happened in early boot and
      processing them. However, even if/when the newer kernels start
      fetching these events at boot time, we need to take care of older
      kernels that won't be doing that.
      
      This patch works around the situation by issuing a CAS reset if a hotplugged
      device is detected during CAS:
      
      - the DRC conditions that warrant a CAS reset is the same as those that
      triggers a DRC migration - the DRC must have a device attached and
      the DRC state is not equal to its ready_state. With that in mind, this
      patch makes use of 'spapr_drc_needed' to determine if a CAS reset
      is needed.
      
      - In the middle of CAS negotiations, the function
      'spapr_hotplugged_dev_before_cas' goes through all the DRCs to see
      if there are any DRC that requires a reset, using spapr_drc_needed. If
      that happens, returns '1' in 'spapr_h_cas_compose_response' which will set
      spapr->cas_reboot to true, causing the machine to reboot.
      
      No changes are made for coldplug devices.
      
      [1] http://lists.nongnu.org/archive/html/qemu-devel/2017-08/msg02855.htmlSigned-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      10f12e64
    • D
      hw/ppc/spapr_drc.c: change spapr_drc_needed to use drc->dev · c618e300
      Daniel Henrique Barboza 提交于
      This patch makes a small fix in 'spapr_drc_needed' to change how we detect
      if a DRC has a device attached. Previously it used dr_entity_sense for this,
      which  works for physical DRCs.
      
      However, for logical DRCs, it didn't cover the case where a logical DRC has
      a drc->dev but the state is LOGICAL_UNUSABLE (e.g. a hotplugged CPU before
      CAS). In this case, the dr_entity_sense of this DRC returns UNUSABLE and the
      code was considering that there were no dev attached, making spapr_drc_needed
      return 'false' when in fact we would like to migrate the DRC.
      
      Changing it to check for drc->dev instead works for all DRC types.
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      c618e300
  4. 22 8月, 2017 1 次提交
    • B
      spapr: Allow configure-connector to be called multiple times · 188bfe1b
      Bharata B Rao 提交于
      In case of in-kernel memory hot unplug, when the guest is not able
      to remove all the LMBs that are requested for removal, it will add back
      any LMBs that have been successfully removed. The DR Connectors of
      these LMBs wouldn't have been unconfigured and hence the addition of
      these LMBs will result in configure-connector call being issued on
      LMB DR connectors that are already in configured state. Such
      configure-connector calls will fail resulting in a DIMM which is
      partially unplugged.
      
      This however worked till recently before we overhauled the DRC
      implementation in QEMU. Commit 9d4c0f4f: "spapr: Consolidate
      DRC state variables" is the first commit where this problem shows up
      as per git bisect.
      
      Ideally guest shouldn't be issuing configure-connector call on an
      already configured DR connector. However for now, work around this in
      QEMU by allowing configure-connector to be called multiple times for
      all types of DR connectors.
      Signed-off-by: NBharata B Rao <bharata@linux.vnet.ibm.com>
      [dwg: Corrected buglet that would have initialized fdt pointers ready
       for reading on a device not present at reset]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      188bfe1b
  5. 09 8月, 2017 1 次提交
  6. 29 7月, 2017 1 次提交
  7. 24 7月, 2017 1 次提交
  8. 17 7月, 2017 9 次提交
    • D
      spapr: Implement DR-indicator for physical DRCs only · 67fea71b
      David Gibson 提交于
      According to PAPR, the DR-indicator should only be valid for physical DRCs,
      not logical DRCs.  At the moment we implement it for all DRCs, so restrict
      it to physical ones only.
      
      We move the state to the physical DRC subclass, which means adding some
      QOM boilerplate to handle the newly distinct type.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      Tested-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      67fea71b
    • D
      spapr: Remove sPAPRConfigureConnectorState sub-structure · 4445b1d2
      David Gibson 提交于
      Most of the time, the state of a DRC object is contained in the single
      'state' variable.  However, during the transition from UNISOLATE to
      CONFIGURED state requires multiple calls to the ibm,configure-connector
      RTAS call to retrieve the device tree for the attached device.  We need
      some extra state to keep track of where we're up to in delivering the
      device tree information to the guest.
      
      Currently that extra state is in a sPAPRConfigureConnectorState
      substructure which is only allocated when we're in the middle of the
      configure connector process.  That sounds like a good idea, but the extra
      state is only two integers - on many platforms that will take up the same
      room as the (maybe NULL) ccs pointer even before malloc() overhead.  Plus
      it's another object whose lifetime we need to manage.  In short, it's not
      worth it.
      
      So, fold the sPAPRConfigureConnectorState substructure directly into the
      DRC object.
      
      Previously the structure was allocated lazily when the configure-connector
      call discovers it's not there.  Now, we need to initialize the subfields
      pre-emptively, as soon as we enter UNISOLATE state.
      
      Although it's not strictly necessary (the field values should only ever
      be consulted when in UNISOLATE state), we try to keep them at -1 when in
      other states, as a debugging aid.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      Tested-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      4445b1d2
    • D
      spapr: Consolidate DRC state variables · 9d4c0f4f
      David Gibson 提交于
      Each DRC has three fields describing its state: isolation_state,
      allocation_state and configured.  At first this seems like a reasonable
      representation, since its based directly on the PAPR defined
      isolation-state and allocation-state indicators.  However:
        * Only a few combinations of the two fields' values are permitted
        * allocation_state isn't used at all for physical DRCs
        * The indicators are write only so they don't really have a well
          defined current value independent of each other
      
      This replaces these variables with a single state variable, whose names
      and numbers are based on the diagram in LoPAPR section 13.4.  Along with
      this we add code to check the current state on various operations and make
      sure the requested transition is permitted.
      
      Strictly speaking, this makes guest visible changes to behaviour (since we
      probably allowed some transitions we shouldn't have before).  However, a
      hypothetical guest broken by that wasn't PAPR compliant, and probably
      wouldn't have worked under PowerVM.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      Tested-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      9d4c0f4f
    • D
      spapr: Cleanups relating to DRC awaiting_release field · f1c52354
      David Gibson 提交于
      'awaiting_release' indicates that the host has requested an unplug of the
      device attached to the DRC, but the guest has not (yet) put the device
      into a state where it is safe to complete removal.
      
      1. Rename it to 'unplug_requested' which to me at least is clearer
      
      2. Remove the ->release_pending() method used to check this from outside
      spapr_drc.c.  The method only plausibly has one implementation, so use
      a plain function (spapr_drc_unplug_requested()) instead.
      
      3. Remove it from the migration stream.  Attempting to migrate mid-unplug
      is broken not just for spapr - in general management has no good way to
      determine if the device should be present on the destination or not.  So,
      until that's fixed, there's no point adding extra things to the stream.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      f1c52354
    • D
      spapr: Refactor spapr_drc_detach() · a8dc47fd
      David Gibson 提交于
      This function has two unused parameters - remove them.
      
      It also sets awaiting_release on all paths, except one.  On that path
      setting it is harmless, since it will be immediately cleared by
      spapr_drc_release().  So factor it out of the if statements.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      a8dc47fd
    • D
      spapr: Abort on delete failure in spapr_drc_release() · ba50822f
      David Gibson 提交于
      We currently ignore errors from the object_property_del() in
      spapr_drc_release().  But the only way that could fail is if the property
      doesn't exist, in which case it's a bug that we're in spapr_drc_release()
      at all.  So change from ignoring to abort()ing on errors.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      ba50822f
    • D
      spapr: Remove 'awaiting_allocation' DRC flag · 82a93a1d
      David Gibson 提交于
      The awaiting_allocation flag in the DRC was introduced by aab99135
      "spapr_drc: Prevent detach racing against attach for CPU DR", allegedly to
      prevent a guest crash on racing attach and detach.  Except.. information
      from the BZ actually suggests a qemu crash, not a guest crash.  And there
      shouldn't be a problem here anyway: if the guest has already moved the DRC
      away from UNUSABLE state, the detach would already be deferred, and if it
      hadn't it should be safe to detach it (the guest should fail gracefully
      when it attempts to change the allocation state).
      
      I think this was probably just a bandaid for some other problem in the
      state management.  So, remove awaiting_allocation and associated code.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      82a93a1d
    • L
      spapr: Treat devices added before inbound migration as coldplugged · 94fd9cba
      Laurent Vivier 提交于
      When migrating a guest which has already had devices hotplugged,
      libvirt typically starts the destination qemu with -incoming defer,
      adds those hotplugged devices with qmp, then initiates the incoming
      migration.
      
      This causes problems for the management of spapr DRC state.  Because
      the device is treated as hotplugged, it goes into a DRC state for a
      device immediately after it's plugged, but before the guest has
      acknowledged its presence.  However, chances are the guest on the
      source machine *has* acknowledged the device's presence and configured
      it.
      
      If the source has fully configured the device, then DRC state won't be
      sent in the migration stream: for maximum migration compatibility with
      earlier versions we don't migrate DRCs in coldplug-equivalent state.
      That means that the DRC effectively changes state over the migrate,
      causing problems later on.
      
      In addition, logging hotplug events for these devices isn't what we
      want because a) those events should already have been issued on the
      source host and b) the event queue should get wiped out by the
      incoming state anyway.
      
      In short, what we really want is to treat devices added before an
      incoming migration as if they were coldplugged.
      
      To do this, we first add a spapr_drc_hotplugged() helper which
      determines if the device is hotplugged in the sense relevant for DRC
      state management.  We only send hotplug events when this is true.
      Second, when we add a device which isn't hotplugged in this sense, we
      force a reset of the DRC state - this ensures the DRC is in a
      coldplug-equivalent state (there isn't usually a system reset between
      these device adds and the incoming migration).
      
      This is based on an earlier patch by Laurent Vivier, cleaned up and
      extended.
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NDaniel Barboza <danielhb@linux.vnet.ibm.com>
      94fd9cba
    • D
      spapr: Remove unnecessary instance_size specifications from DRC subtypes · 3579d606
      David Gibson 提交于
      All the DRC subtypes explicitly list instance_size in TypeInfo (all as
      sizeof(sPAPRDRConnector).  This isn't necessary, since if it's not listed
      it will be derived from the parent type.
      
      Worse, this is dangerous, because if a subtype is changed in future to
      have a larger structure, then subtypes of that subtype also need to have
      instance_size changed, or it will lead to hard to track memory corruption
      bugs.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3579d606
  9. 11 7月, 2017 4 次提交
  10. 30 6月, 2017 6 次提交
    • D
      spapr: Clean up DRC set_isolation_state() path · 0dfabd39
      David Gibson 提交于
      There are substantial differences in the various paths through
      set_isolation_state(), both for setting to ISOLATED versus UNISOLATED
      state and for logical versus physical DRCs.
      
      So, split the set_isolation_state() method into isolate() and unisolate()
      methods, and give it different implementations for the two DRC types.
      
      Factor some minimal common checks, including for valid indicator values
      (which we weren't previously checking) into rtas_set_isolation_state().
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      0dfabd39
    • D
      spapr: Clean up DRC set_allocation_state path · 61736732
      David Gibson 提交于
      The allocation-state indicator should only actually be implemented for
      "logical" DRCs, not physical ones.  Factor a check for this, and also for
      valid indicator state values into rtas_set_allocation_state().  Because
      they don't exist for physical DRCs, there's no reason that we'd ever want
      more than one method implementation, so it can just be a plain function.
      
      In addition, the setting to USABLE and setting to UNUSABLE paths in
      set_allocation_state() don't actually have much in common.  So, split the
      method separate functions for each parameter value (drc_set_usable()
      and drc_set_unusable()).
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      61736732
    • D
      spapr: Make DRC reset force DRC into known state · 4f9242fc
      David Gibson 提交于
      The reset handler for DRCs attempts several state transitions which are
      subject to various checks and restrictions.  But at reset time we know
      there is no guest, so we can ignore most of the usual sequencing rules and
      just set the DRC back to a known state.  In fact, it's safer to do so.
      
      The existing code also has several redundant checks for
      drc->awaiting_release inside a block which has already tested that.  This
      patch removes those and sets the DRC to a fixed initial state based only
      on whether a device is currently plugged or not.
      
      With DRCs correctly reset to a state based on device presence, we don't
      need to force state transitions as cold plugged devices are processed.
      This allows us to remove all the callers of the set_*_state() methods from
      outside spapr_drc.c.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      4f9242fc
    • D
      spapr: Split DRC release from DRC detach · 9c914e53
      David Gibson 提交于
      spapr_drc_detach() is called when qemu generic code requests a device be
      unplugged.  It makes a number of tests, which could well delay further
      action until later, before actually detach the device from the DRC.
      
      This splits out the part which actually removes the device from the DRC
      into spapr_drc_release().  This will be useful for further cleanups.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      9c914e53
    • D
      spapr: Eliminate DRC 'signalled' state variable · 307b7715
      David Gibson 提交于
      The 'signalled' field in the DRC appears to be entirely a torturous
      workaround for the fact that PCI devices were started in UNISOLATED state
      for unclear reasons.
      
      1) 'signalled' is already meaningless for logical (so far, all non PCI)
      DRCs.  It's always set to true (at least at any point it might be tested),
      and can't be assigned any real meaning due to the way signalling works for
      logical DRCs.
      
      2) For PCI DRCs, the only time signalled would be false is when non-zero
      functions of a multifunction device are hotplugged, followed by function
      zero (the other way around is explicitly not permitted). In that case the
      secondary function DRCs are attached, but the notification isn't sent to
      the guest until function 0 is plugged.
      
      3) signalled being false is used to allow a DRC detach to switch mode
      back to ISOLATED state, which allows a secondary function to be hotplugged
      then unplugged with function 0 never inserted.  Without this a secondary
      function starting in UNISOLATED state couldn't be detached again without
      function 0 being inserted, all the functions configured by the guest, then
      sent back to ISOLATED state.
      
      4) But now that PCI DRCs start in ISOLATED state, there's nothing to be
      done.  If the guest doesn't get the notification, it won't switch the
      device to UNISOLATED state, so nothing prevents it from being unplugged.
      If the guest does move it to UNISOLATED state without the signal (due to
      a manual drmgr call, for instance) then it really isn't safe to unplug it.
      
      So, this patch removes the signalled variable and all code related to it.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      307b7715
    • D
      spapr: Start hotplugged PCI devices in ISOLATED state · af8ad96b
      David Gibson 提交于
      PCI DRCs, and only PCI DRCs, are immediately moved to UNISOLATED isolation
      state once the device is attached.  This has been there from the initial
      implementation, and it's not clear why.
      
      The state diagram in PAPR 13.4 suggests PCI devices should start in
      ISOLATED state until the guest moves them into UNISOLATED, and the code in
      the guest-side drmgr tool seems to work that way too.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      Reviewed-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      af8ad96b
  11. 09 6月, 2017 1 次提交
  12. 08 6月, 2017 5 次提交
    • D
      spapr: Rework DRC name handling · 79808336
      David Gibson 提交于
      DRC objects have a get_name method which returns the DRC name generated
      when the DRC is created.  Replace that with a fixed spapr_drc_name()
      function which generates the name on the fly from other information.  This
      means:
        * We get rid of a method with only one implementation, and only local
          callers
        * We don't have to carry the name string around for the lifetime of the
          DRC
        * We use information added to the class structure to generate the name
          in standard format, so we don't need an explicit switch on drc type
          any more
      
      We also eliminate the 'name' property; it's basically useless since the
      only information in it can easily be deduced from other things.
      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>
      79808336
    • 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 RTAS set-indicator · 7b7258f8
      David Gibson 提交于
      In theory the RTAS set-indicator call can be used for a number of
      "indicators" defined by PAPR.  In practice the only ones we're ever likely
      to implement are those used for Dynamic Reconfiguration (i.e. hotplug).
      Because of this, the current implementation determines the associated DRC
      object, before dispatching based on the type of indicator.
      
      However, this means we also need a check that we're dealing with a DR
      related indicator at all, which duplicates some of the logic from the
      switch further down.
      
      Even though it means a bit of code duplication, things work out cleaner if
      we delegate the DRC lookup to the individual indicator type functions -
      and it also allows some further cleanups.
      
      While we're there, remove references to "sensor", a copy/paste artefact
      from the related, but distinct "get-sensor" call.
      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>
      7b7258f8
    • 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
  13. 06 6月, 2017 4 次提交