qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: agraf@suse.de, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com,
	nfont@linux.vnet.ibm.com, imammedo@redhat.com,
	david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [RFC PATCH v0 2/3] spapr-rtas: Enable rtas_set_indicator() to return correct error
Date: Mon, 24 Aug 2015 21:26:28 -0500	[thread overview]
Message-ID: <20150825022628.11069.64154@loki> (raw)
In-Reply-To: <1439967371-15870-3-git-send-email-bharata@linux.vnet.ibm.com>

Quoting Bharata B Rao (2015-08-19 01:56:10)
> drck->set_isolation_state() can return error. For such a case ensure
> correct error is returned by rtas_set_indicator() instead of always
> returning success.
> 
> TODO: rtas_st(, , uint32 val) => the return value uint32, but
> drck->set_[allocation/indicator/isolation]_state() is returning int.
> Should we change this return value to uint32_t to match with rtas_st()
> argument ?

I wouldn't bother too much aligning the types unless we go to the extent
of documenting these interfaces as returning rtas error codes. That's
not really the case currently, and there's a lot of rtas errors that
don't really need to be determined by DRC code so I think it's more
trouble than it's worth.

For now I think it's better to just check for ret != 0 and set return
values explicitly in rtas code based on what the drc errors entail.

> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> ---
>  hw/ppc/spapr_rtas.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
> index e99e25f..96729b4 100644
> --- a/hw/ppc/spapr_rtas.c
> +++ b/hw/ppc/spapr_rtas.c
> @@ -374,6 +374,7 @@ static void rtas_set_indicator(PowerPCCPU *cpu, sPAPRMachineState *spapr,
>      uint32_t sensor_state;
>      sPAPRDRConnector *drc;
>      sPAPRDRConnectorClass *drck;
> +    int ret;
> 
>      if (nargs != 3 || nret != 1) {
>          rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
> @@ -413,19 +414,19 @@ static void rtas_set_indicator(PowerPCCPU *cpu, sPAPRMachineState *spapr,
>                  spapr_ccs_remove(spapr, ccs);
>              }
>          }
> -        drck->set_isolation_state(drc, sensor_state);
> +        ret = drck->set_isolation_state(drc, sensor_state);
>          break;
>      case RTAS_SENSOR_TYPE_DR:
> -        drck->set_indicator_state(drc, sensor_state);
> +        ret = drck->set_indicator_state(drc, sensor_state);
>          break;
>      case RTAS_SENSOR_TYPE_ALLOCATION_STATE:
> -        drck->set_allocation_state(drc, sensor_state);
> +        ret = drck->set_allocation_state(drc, sensor_state);
>          break;
>      default:
>          goto out_unimplemented;
>      }
> 
> -    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
> +    rtas_st(rets, 0, ret);
>      return;
> 
>  out_unimplemented:
> -- 
> 2.1.0
> 

  reply	other threads:[~2015-08-25  2:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  6:56 [Qemu-devel] [RFC PATCH v0 0/3] sPAPR: Memory hot removal support Bharata B Rao
2015-08-19  6:56 ` [Qemu-devel] [RFC PATCH v0 1/3] pc-dimm: Add a field to PCDIMMDevice to mark device deletion state Bharata B Rao
2015-08-25  2:30   ` Michael Roth
2015-08-26  4:32     ` Bharata B Rao
2015-08-19  6:56 ` [Qemu-devel] [RFC PATCH v0 2/3] spapr-rtas: Enable rtas_set_indicator() to return correct error Bharata B Rao
2015-08-25  2:26   ` Michael Roth [this message]
2015-09-04  7:10   ` David Gibson
2015-08-19  6:56 ` [Qemu-devel] [RFC PATCH v0 3/3] spapr: Memory hot-unplug support Bharata B Rao
2015-08-25  2:39   ` Michael Roth
2015-08-26  9:57     ` Bharata B Rao
2015-09-04 16:06       ` Michael Roth
2015-09-04  7:20   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150825022628.11069.64154@loki \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=imammedo@redhat.com \
    --cc=nfont@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=tyreld@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).