* [Qemu-devel] [PATCH] pcie/aer: fix inject aer error command
@ 2011-08-05 9:22 Isaku Yamahata
2011-08-11 7:56 ` Michael S. Tsirkin
0 siblings, 1 reply; 2+ messages in thread
From: Isaku Yamahata @ 2011-08-05 9:22 UTC (permalink / raw)
To: qemu-devel; +Cc: yamahata, mst
various fixes to make aer inject error command work.
- wrong assert
- command line parser
- err.status needs initialization
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
hw/pcie_aer.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
index be019c7..4346345 100644
--- a/hw/pcie_aer.c
+++ b/hw/pcie_aer.c
@@ -415,7 +415,7 @@ static void pcie_aer_update_log(PCIDevice *dev, const PCIEAERErr *err)
int i;
assert(err->status);
- assert(err->status & (err->status - 1));
+ assert(!(err->status & (err->status - 1)));
errcap &= ~(PCI_ERR_CAP_FEP_MASK | PCI_ERR_CAP_TLP);
errcap |= PCI_ERR_CAP_FEP(first_bit);
@@ -495,7 +495,7 @@ static int pcie_aer_record_error(PCIDevice *dev,
int fep = PCI_ERR_CAP_FEP(errcap);
assert(err->status);
- assert(err->status & (err->status - 1));
+ assert(!(err->status & (err->status - 1)));
if (errcap & PCI_ERR_CAP_MHRE &&
(pci_get_long(aer_cap + PCI_ERR_UNCOR_STATUS) & (1U << fep))) {
@@ -979,20 +979,21 @@ int do_pcie_aer_inejct_error(Monitor *mon,
if (pcie_aer_parse_error_string(error_name, &error_status, &correctable)) {
char *e = NULL;
error_status = strtoul(error_name, &e, 0);
- correctable = !!qdict_get_int(qdict, "correctable");
+ correctable = qdict_get_try_bool(qdict, "correctable", 0);
if (!e || *e != '\0') {
monitor_printf(mon, "invalid error status value. \"%s\"",
error_name);
return -EINVAL;
}
}
+ err.status = error_status;
err.source_id = (pci_bus_num(dev->bus) << 8) | dev->devfn;
err.flags = 0;
if (correctable) {
err.flags |= PCIE_AER_ERR_IS_CORRECTABLE;
}
- if (qdict_get_int(qdict, "advisory_non_fatal")) {
+ if (qdict_get_try_bool(qdict, "advisory_non_fatal", 0)) {
err.flags |= PCIE_AER_ERR_MAYBE_ADVISORY;
}
if (qdict_haskey(qdict, "header0")) {
--
1.7.1.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] pcie/aer: fix inject aer error command
2011-08-05 9:22 [Qemu-devel] [PATCH] pcie/aer: fix inject aer error command Isaku Yamahata
@ 2011-08-11 7:56 ` Michael S. Tsirkin
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2011-08-11 7:56 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: qemu-devel
On Fri, Aug 05, 2011 at 06:22:06PM +0900, Isaku Yamahata wrote:
> various fixes to make aer inject error command work.
> - wrong assert
> - command line parser
> - err.status needs initialization
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Thanks, applied.
> ---
> hw/pcie_aer.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/pcie_aer.c b/hw/pcie_aer.c
> index be019c7..4346345 100644
> --- a/hw/pcie_aer.c
> +++ b/hw/pcie_aer.c
> @@ -415,7 +415,7 @@ static void pcie_aer_update_log(PCIDevice *dev, const PCIEAERErr *err)
> int i;
>
> assert(err->status);
> - assert(err->status & (err->status - 1));
> + assert(!(err->status & (err->status - 1)));
>
> errcap &= ~(PCI_ERR_CAP_FEP_MASK | PCI_ERR_CAP_TLP);
> errcap |= PCI_ERR_CAP_FEP(first_bit);
> @@ -495,7 +495,7 @@ static int pcie_aer_record_error(PCIDevice *dev,
> int fep = PCI_ERR_CAP_FEP(errcap);
>
> assert(err->status);
> - assert(err->status & (err->status - 1));
> + assert(!(err->status & (err->status - 1)));
>
> if (errcap & PCI_ERR_CAP_MHRE &&
> (pci_get_long(aer_cap + PCI_ERR_UNCOR_STATUS) & (1U << fep))) {
> @@ -979,20 +979,21 @@ int do_pcie_aer_inejct_error(Monitor *mon,
> if (pcie_aer_parse_error_string(error_name, &error_status, &correctable)) {
> char *e = NULL;
> error_status = strtoul(error_name, &e, 0);
> - correctable = !!qdict_get_int(qdict, "correctable");
> + correctable = qdict_get_try_bool(qdict, "correctable", 0);
> if (!e || *e != '\0') {
> monitor_printf(mon, "invalid error status value. \"%s\"",
> error_name);
> return -EINVAL;
> }
> }
> + err.status = error_status;
> err.source_id = (pci_bus_num(dev->bus) << 8) | dev->devfn;
>
> err.flags = 0;
> if (correctable) {
> err.flags |= PCIE_AER_ERR_IS_CORRECTABLE;
> }
> - if (qdict_get_int(qdict, "advisory_non_fatal")) {
> + if (qdict_get_try_bool(qdict, "advisory_non_fatal", 0)) {
> err.flags |= PCIE_AER_ERR_MAYBE_ADVISORY;
> }
> if (qdict_haskey(qdict, "header0")) {
> --
> 1.7.1.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-11 7:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05 9:22 [Qemu-devel] [PATCH] pcie/aer: fix inject aer error command Isaku Yamahata
2011-08-11 7:56 ` Michael S. Tsirkin
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).