pcie/aer: glue inject aer error into hmp
cover pcie/aer: glue inject aer error into hmp
This patch series introduces hmp command to inject aer error. Now fw device path is used to specify pci function.
Isaku Yamahata (3):
build, pci: remove QMP dependency on core PCI code
pci: introduce a parser for fw device path to pci device pcie/aer: glue aer error injection into qemu monitor
Makefile.objs | 4 +- Makefile.target | 2 + hmp-commands.hx | 28 +++++++ hw/pci-stub.c | 50 ++++++++++++ hw/pci.c | 128 ++++++++++++++++++++++++++++++++ hw/pci.h | 2 + hw/pcie_aer.c | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ sysemu.h | 5 + 8 files changed, 438 insertions(+), 3 deletions(-) create mode 100644 hw/pci-stub.c
PATCH 1/3 build, pci: remove QMP dependency on core PCI code
by introducing pci-stub.c, eliminate QMP dependency on core PCI code rquired by query-pci command.
--- Makefile.objs | 4 +--- Makefile.target | 2 ++ hw/pci-stub.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 hw/pci-stub.c
Makefile.objs +1 -3
@@ -169,9 +169,7 @@ hw-obj-y = hw-obj-y += vl.o loader.o hw-obj-$(CONFIG_VIRTIO) += virtio.o virtio-console.o hw-obj-y += fw_cfg.o -# FIXME: Core PCI code and its direct dependencies are required by the -# QMP query-pci command. -hw-obj-y += pci.o pci_bridge.o +hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o hw-obj-$(CONFIG_PCI) += msix.o msi.o hw-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o hw-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.o
Makefile.target +2 -0
@@ -1,6 +1,7 @@ # -*- Mode: makefile -*- GENERATED_HEADERS = config-target.h +CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) include ../config-host.mak
@@ -188,6 +189,7 @@ ifdef CONFIG_SOFTMMU obj-y = arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o # virtio has to be here due to weird dependency between PCI and virtio-net. # need to fix this properly +obj-$(CONFIG_NO_PCI) += pci-stub.o obj-$(CONFIG_VIRTIO) += virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o obj-y += vhost_net.o
hw/pci-stub.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* PCI stubs for plathome that doesn't support pci bus. +* +* Copyright (c) 2010 Isaku Yamahata <yamahata at valinux co jp> +* VA Linux Systems Japan K.K. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "monitor.h" +#include "pci.h" + +static void pci_error_message (Monitor *mon) +{ +monitor_printf (mon,"PCI devices not supported\n" ); +} + +void do_pci_info (Monitor *mon,QObject **ret_data) +{ +pci_error_message (mon); +} + +void do_pci_info_print (Monitor *mon,const QObject *data) +{ +pci_error_message (mon); +}
Signature · 1 line
1.7.1.1
[Qemu-devel] Re: [PATCH 1/3] build, pci: remove QMP dependency on core PCI code
Quoted 4 lines · Isaku Yamahata
by introducing
pci-stub.c, eliminate QMP dependency on core PCI code rquired by query-pci command.Signed-off-by Isaku Yamahata <[email protected]>
Yay! Applied.
Quoted 87 lines
--- Makefile.objs | 4 +--- Makefile.target | 2 ++ hw/pci-stub.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 hw/pci-stub.cMakefile.objs +1
-3@@ -169,9 +169,7 @@ hw-obj-y = hw-obj-y += vl.o loader.o hw-obj-$(CONFIG_VIRTIO) += virtio.o virtio-console.o hw-obj-y += fw_cfg.o -# FIXME: Core PCI code and its direct dependencies are required by the -# QMP query-pci command. -hw-obj-y += pci.o pci_bridge.o +hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o hw-obj-$(CONFIG_PCI) += msix.o msi.o hw-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o hw-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.oMakefile.target +2
-0@@ -1,6 +1,7 @@ # -*- Mode: makefile -*- GENERATED_HEADERS = config-target.h +CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) include ../config-host.mak@@ -188,6 +189,7 @@ ifdef CONFIG_SOFTMMU obj-y = arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o # virtio has to be here due to weird dependency between PCI and virtio-net. # need to fix this properly +obj-$(CONFIG_NO_PCI) += pci-stub.o obj-$(CONFIG_VIRTIO) += virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o obj-y += vhost_net.ohw/pci-stub.c new file +37
-0@@ -0,0 +1,37 @@ +/* +* PCI stubs for plathome that doesn't support pci bus. +* +* Copyright (c) 2010 Isaku Yamahata <yamahata at valinux co jp> +* VA Linux Systems Japan K.K. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "monitor.h" +#include "pci.h" + +static void pci_error_message (Monitor *mon) +{ +monitor_printf (mon,"PCI devices not supported\n" ); +} + +void do_pci_info (Monitor *mon,QObject **ret_data) +{ +pci_error_message (mon); +} + +void do_pci_info_print (Monitor *mon,const QObject *data) +{ +pci_error_message (mon); +}Signature · 1 line
1.7.1.1
PATCH 2/3 pci: introduce a parser for fw device path to pci device
In reply to Isaku YamahataIntroduce a function to parse fw device path to pci device.
the format is
/pci@{<ioport>, <mmio>}/[<fw_name>]@<slot>,<func>/.../[<fw_name>]@<slot>,<func>
<ioport> = "i"<ioport addr in hex>
<mmio> = <mmio addr in hex>
<slot> = slot number in hex
<func> = func number in hex
--- hw/pci.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/pci.h | 2 + 2 files changed, 130 insertions(+), 0 deletions(-)
hw/pci.c +128 -0
@@ -2027,3 +2027,131 @@ static char *pcibus_get_dev_path(DeviceState *dev)return strdup (path); } +/* +* Parse format and get PCIDevice +* return 0 on success +* <0 on error: format is invalid or device isn't found. +* +* Format: +* /pci@{<ioport>, <mmio>}/[<fw_name>]@<slot>,<func>/... +* .../[<fw_name>]@<slot>,<func> +* +* <ioport> = "i"<ioport addr in hex> +* <mmio> = <mmio addr in hex> +* <slot> = slot number in hex +* <func> = func number in hex +* +*/ +int pci_parse_fw_dev_path (const char *path,PCIDevice **pdev) +{ +const char *p = path; +char *e; +size_t len; +PCIBus *bus; +struct PCIHostBus *host; + +if (*p !='/' ) { +return -EINVAL ; + } + e =strchr (p +1 ,'/' ); +if (e ==NULL ) { +return -EINVAL ; + } + len = e - p; + p = e +1 ; + + bus =NULL ; + QLIST_FOREACH(host, &host_buses, next) { +DeviceState *qdev = host->bus->qbus.parent; +if (qdev) { +char *devpath =qdev_get_fw_dev_path (qdev); + +if (len ==strlen (devpath) && !strncmp (devpath, path, len)) { + bus = host->bus; +qemu_free (devpath); +break ; + } +qemu_free (devpath); + }else { +/* This pci bus doesn't have host-to-pci bridge device. +* Check only if the path is pci ignoring other parameters. */ +#define PCI_FW_PATH "/pci@" +if (strncmp (path,PCI_FW_PATH ,strlen (PCI_FW_PATH ))) { +return -EINVAL ; + } + bus = host->bus; +break ; + } + } + +for (;;) { +char *at; +char *comma; +unsigned long slot; +unsigned long func; +PCIDevice *dev; +PCIBus *child_bus; + +if (!bus) { +return -ENODEV ; + } +if (*p =='\0' ) { +return -EINVAL ; + } + + at =strchr (p,'@' ); +if (at ==NULL ) { +return -EINVAL ; + } + slot =strtoul (at +1 , &e,16 ); +if (e == at +1 || *e !=',' ) { +return -EINVAL ; + } +if (slot >=PCI_SLOT_MAX ) { +return -EINVAL ; + } + + comma = e; + func =strtoul (comma +1 , &e,16 ); +if (e == comma +1 || (*e !='/' && *e !='\0' )) { +return -EINVAL ; + } +if (func >=PCI_FUNC_MAX ) { +return -EINVAL ; + } + + len = e - p; + dev = bus->devices[PCI_DEVFN (slot, func)]; +if (!dev) { +return -ENODEV ; + } +if (at != p) { +/* fw_name is specified. */ +char *fw_dev_path =pcibus_get_fw_dev_path (&dev->qdev); +if (strncmp (p, fw_dev_path, len)) { +qemu_free (fw_dev_path); +return -EINVAL ; + } +qemu_free (fw_dev_path); + } + +if (*e =='\0' ) { + *pdev = dev; +return 0 ; + } + +/* +* descending down pci-to-pci bridge. +* At the moment, there is no way to safely determine if the given +* pci device is really pci-to-pci device. +*/ + p = e; + QLIST_FOREACH(child_bus, &bus->child, sibling) { +if (child_bus->parent_dev == dev) { + bus = child_bus; +continue ; + } + } + bus =NULL ; + } +}
hw/pci.h +2 -0
@@ -16,6 +16,7 @@#define PCI_DEVFN (slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))#define PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define PCI_FUNC (devfn) ((devfn) & 0x07) +#define PCI_SLOT_MAX 32#define PCI_FUNC_MAX 8/* Class, Vendor and Device IDs from Linux's pci_ids.h */
@@ -258,6 +259,7 @@ int pci_parse_devaddr(const char *addr, int *domp, int *busp, unsigned int *slotp, unsigned int *funcp);int pci_read_devaddr (Monitor *mon,const char *addr,int *domp,int *busp,unsigned *slotp); +int pci_parse_fw_dev_path (const char *path,PCIDevice **pdev);void do_pci_info_print (Monitor *mon,const QObject *data);void do_pci_info (Monitor *mon,QObject **ret_data);
Signature · 1 line
1.7.1.1
[Qemu-devel] Re: [PATCH 2/3] pci: introduce a parser for fw device path to pci device
Quoted 10 lines · Isaku Yamahata
Introduce a function to parse fw device path to pci device.
the format is
/pci@{<ioport>, <mmio>}/[<fw_name>]@<slot>,<func>/.../[<fw_name>]@<slot>,<func><ioport> = "i"<ioport addr in hex>
<mmio> = <mmio addr in hex>
<slot> = slot number in hex
<func> = func number in hexSigned-off-by Isaku Yamahata <[email protected]>
What concerns me the most here is the use of io addresses, not sure it's the right thing for the command interface.
Why do we need to support full path at all? Can we use the id of the parent bus for this? Supplying a bus id for the device seems like a natural way to describe a tree, with minimal need for parsing.
Quoted 163 lines
--- hw/pci.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ hw/pci.h | 2 + 2 files changed, 130 insertions(+), 0 deletions(-)hw/pci.c +128
-0@@ -2027,3 +2027,131 @@ static char *pcibus_get_dev_path(DeviceState *dev)return strdup (path); } +/* +* Parse format and get PCIDevice +* return 0 on success +* <0 on error: format is invalid or device isn't found. +* +* Format: +* /pci@{<ioport>, <mmio>}/[<fw_name>]@<slot>,<func>/... +* .../[<fw_name>]@<slot>,<func> +* +* <ioport> = "i"<ioport addr in hex> +* <mmio> = <mmio addr in hex> +* <slot> = slot number in hex +* <func> = func number in hex +* +*/ +int pci_parse_fw_dev_path (const char *path,PCIDevice **pdev) +{ +const char *p = path; +char *e; +size_t len; +PCIBus *bus; +struct PCIHostBus *host; + +if (*p !='/' ) { +return -EINVAL ; + } + e =strchr (p +1 ,'/' ); +if (e ==NULL ) { +return -EINVAL ; + } + len = e - p; + p = e +1 ; + + bus =NULL ; + QLIST_FOREACH(host, &host_buses, next) { +DeviceState *qdev = host->bus->qbus.parent; +if (qdev) { +char *devpath =qdev_get_fw_dev_path (qdev); + +if (len ==strlen (devpath) && !strncmp (devpath, path, len)) { + bus = host->bus; +qemu_free (devpath); +break ; + } +qemu_free (devpath); + }else { +/* This pci bus doesn't have host-to-pci bridge device. +* Check only if the path is pci ignoring other parameters. */ +#define PCI_FW_PATH "/pci@" +if (strncmp (path,PCI_FW_PATH ,strlen (PCI_FW_PATH ))) { +return -EINVAL ; + } + bus = host->bus; +break ; + } + } + +for (;;) { +char *at; +char *comma; +unsigned long slot; +unsigned long func; +PCIDevice *dev; +PCIBus *child_bus; + +if (!bus) { +return -ENODEV ; + } +if (*p =='\0' ) { +return -EINVAL ; + } + + at =strchr (p,'@' ); +if (at ==NULL ) { +return -EINVAL ; + } + slot =strtoul (at +1 , &e,16 ); +if (e == at +1 || *e !=',' ) { +return -EINVAL ; + } +if (slot >=PCI_SLOT_MAX ) { +return -EINVAL ; + } + + comma = e; + func =strtoul (comma +1 , &e,16 ); +if (e == comma +1 || (*e !='/' && *e !='\0' )) { +return -EINVAL ; + } +if (func >=PCI_FUNC_MAX ) { +return -EINVAL ; + } + + len = e - p; + dev = bus->devices[PCI_DEVFN (slot, func)]; +if (!dev) { +return -ENODEV ; + } +if (at != p) { +/* fw_name is specified. */ +char *fw_dev_path =pcibus_get_fw_dev_path (&dev->qdev); +if (strncmp (p, fw_dev_path, len)) { +qemu_free (fw_dev_path); +return -EINVAL ; + } +qemu_free (fw_dev_path); + } + +if (*e =='\0' ) { + *pdev = dev; +return 0 ; + } + +/* +* descending down pci-to-pci bridge. +* At the moment, there is no way to safely determine if the given +* pci device is really pci-to-pci device. +*/ + p = e; + QLIST_FOREACH(child_bus, &bus->child, sibling) { +if (child_bus->parent_dev == dev) { + bus = child_bus; +continue ; + } + } + bus =NULL ; + } +}hw/pci.h +2
-0@@ -16,6 +16,7 @@#define PCI_DEVFN (slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))#define PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define PCI_FUNC (devfn) ((devfn) & 0x07) +#define PCI_SLOT_MAX 32#define PCI_FUNC_MAX 8/* Class, Vendor and Device IDs from Linux's pci_ids.h */ @@ -258,6 +259,7 @@ int pci_parse_devaddr(const char *addr, int *domp, int *busp, unsigned int *slotp, unsigned int *funcp);int pci_read_devaddr (Monitor *mon,const char *addr,int *domp,int *busp,unsigned *slotp); +int pci_parse_fw_dev_path (const char *path,PCIDevice **pdev);void do_pci_info_print (Monitor *mon,const QObject *data);void do_pci_info (Monitor *mon,QObject **ret_data);Signature · 1 line
1.7.1.1
[Qemu-devel] Re: [PATCH 2/3] pci: introduce a parser for fw device path to pci device
Quoted 10 lines · Michael S. Tsirkin
Quoted 9 lines · Isaku Yamahata
Introduce a function to parse fw device path to pci device.
the format is
/pci@{<ioport>, <mmio>}/[<fw_name>]@<slot>,<func>/.../[<fw_name>]@<slot>,<func><ioport> = "i"<ioport addr in hex>
<mmio> = <mmio addr in hex>
<slot> = slot number in hex
<func> = func number in hex
Quoted 8 lines
Quoted 1 line
Signed-off-by Isaku Yamahata <[email protected]>What concerns me the most here is the use of io addresses, not sure it's the right thing for the command interface.
Why do we need to support full path at all? Can we use the id of the parent bus for this? Supplying a bus id for the device seems like a natural way to describe a tree, with minimal need for parsing.
The ids of most devices are set NULL currently. So the id is useless right now unfortunately. Maybe how to assign ids to all of qdevs systematically would be difficult.
To be honest, I don't have strong opinion for format of pci topology. So far we discussed the following candidates.
what format do you prefer?
- domain:<bus>:<slot>.<func>
guest assigns bus number, so this can't be used for qemu internal use.
- domain:00:<slot>.<func>:...:<slot>.<func>
- fw device path
- id
Unfortunately id is NULL for most devices right now. So id doesn't work.
- any other?
thanks,
Signature · 1 line
yamahata
[Qemu-devel] Re: [PATCH 2/3] pci: introduce a parser for fw device path to pci device
Quoted 16 lines · Isaku Yamahata
Quoted 15 lines · Michael S. Tsirkin
Quoted 10 lines · Isaku Yamahata
Introduce a function to parse fw device path to pci device.
the format is
/pci@{<ioport>, <mmio>}/[<fw_name>]@<slot>,<func>/.../[<fw_name>]@<slot>,<func><ioport> = "i"<ioport addr in hex>
<mmio> = <mmio addr in hex>
<slot> = slot number in hex
<func> = func number in hexSigned-off-by Isaku Yamahata <[email protected]>What concerns me the most here is the use of io addresses, not sure it's the right thing for the command interface.
Quoted 6 lines
Quoted 3 lines
Why do we need to support full path at all? Can we use the id of the parent bus for this? Supplying a bus id for the device seems like a natural way to describe a tree, with minimal need for parsing.
The ids of most devices are set NULL currently. So the id is useless right now unfortunately.
It's up to the user to assign ids. If one doesn't one won't be able to activate hotplug/aer, which does not seem like a serious limitation.
Quoted 2 lines
Maybe how to assign ids to all of qdevs
systematically would be difficult.
I don't think it's urgent. No id -> can't use some of the functionality. No big deal IMO.
Quoted 15 lines
To be honest, I don't have strong opinion for format of pci topology. So far we discussed the following candidates.
what format do you prefer?- domain:<bus>:<slot>.<func>
guest assigns bus number, so this can't be used for qemu internal use.
- domain:00:<slot>.<func>:...:<slot>.<func>
- fw device path
- id
Unfortunately id is NULL for most devices right now. So id doesn't work.
- any other?thanks,
Signature · 1 line
yamahata
[Qemu-devel] Re: [PATCH 2/3] pci: introduce a parser for fw device path to pci device
Quoted 24 lines · Michael S. Tsirkin
Quoted 16 lines · Isaku Yamahata
Quoted 15 lines · Michael S. Tsirkin
Quoted 10 lines · Isaku Yamahata
Introduce a function to parse fw device path to pci device.
the format is
/pci@{<ioport>, <mmio>}/[<fw_name>]@<slot>,<func>/.../[<fw_name>]@<slot>,<func><ioport> = "i"<ioport addr in hex>
<mmio> = <mmio addr in hex>
<slot> = slot number in hex
<func> = func number in hexSigned-off-by Isaku Yamahata <[email protected]>What concerns me the most here is the use of io addresses, not sure it's the right thing for the command interface.
Quoted 6 lines
Quoted 3 lines
Why do we need to support full path at all? Can we use the id of the parent bus for this? Supplying a bus id for the device seems like a natural way to describe a tree, with minimal need for parsing.
The ids of most devices are set NULL currently. So the id is useless right now unfortunately.
Quoted 8 lines
It's up to the user to assign ids. If one doesn't one won't be able to activate hotplug/aer, which does not seem like a serious limitation.
Quoted 2 lines
Maybe how to assign ids to all of qdevs
systematically would be difficult.I don't think it's urgent. No id -> can't use some of the functionality. No big deal IMO.
Hmm, it's big deal for me.
How about trying id first, if failed, then trying fw device path as fall back?
Quoted 17 lines
Quoted 16 lines
To be honest, I don't have strong opinion for format of pci topology. So far we discussed the following candidates.
what format do you prefer?- domain:<bus>:<slot>.<func>
guest assigns bus number, so this can't be used for qemu internal use.
- domain:00:<slot>.<func>:...:<slot>.<func>
- fw device path
- id
Unfortunately id is NULL for most devices right now. So id doesn't work.
- any other?thanks,
Signature · 1 line
yamahata
Signature · 1 line
yamahata
[Qemu-devel] Re: [PATCH 2/3] pci: introduce a parser for fw device path to pci device
Quoted 28 lines · Isaku Yamahata
Quoted 27 lines · Michael S. Tsirkin
Quoted 16 lines · Isaku Yamahata
Quoted 15 lines · Michael S. Tsirkin
Quoted 10 lines · Isaku Yamahata
Introduce a function to parse fw device path to pci device.
the format is
/pci@{<ioport>, <mmio>}/[<fw_name>]@<slot>,<func>/.../[<fw_name>]@<slot>,<func><ioport> = "i"<ioport addr in hex>
<mmio> = <mmio addr in hex>
<slot> = slot number in hex
<func> = func number in hexSigned-off-by Isaku Yamahata <[email protected]>What concerns me the most here is the use of io addresses, not sure it's the right thing for the command interface.
Quoted 6 lines
Quoted 3 lines
Why do we need to support full path at all? Can we use the id of the parent bus for this? Supplying a bus id for the device seems like a natural way to describe a tree, with minimal need for parsing.
The ids of most devices are set NULL currently. So the id is useless right now unfortunately.
It's up to the user to assign ids. If one doesn't one won't be able to activate hotplug/aer, which does not seem like a serious limitation.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Maybe how to assign ids to all of qdevs
systematically would be difficult.I don't think it's urgent. No id -> can't use some of the functionality. No big deal IMO.
Hmm, it's big deal for me.
OK, but why? Another push in qdev/machine description direction can only be a good thing, no?
Quoted 2 lines
How about trying id first, if failed, then trying fw device path as fall back?
Well what bothered me with the proposed format in cli didn't go away. Specifically the use of the io address as device name really looks strange, and the mmio address is guest assigned, isn't it?
Also, for QMP, it seems we should be using arrays and attributes, instead of asking everyone to build up/parse a path.
Quoted 20 lines
Quoted 17 lines
Quoted 16 lines
To be honest, I don't have strong opinion for format of pci topology. So far we discussed the following candidates.
what format do you prefer?- domain:<bus>:<slot>.<func>
guest assigns bus number, so this can't be used for qemu internal use.
- domain:00:<slot>.<func>:...:<slot>.<func>
- fw device path
- id
Unfortunately id is NULL for most devices right now. So id doesn't work.
- any other?thanks,
Signature · 1 line
yamahataSignature · 1 line
yamahata
PATCH 3/3 pcie/aer: glue aer error injection into qemu monitor
In reply to Isaku Yamahataintroduce pcie_aer_inject_error command.
---
Changes v9 -> v10:
- use fw device path
- error path
- pci-stub.c for CONFIG_PCI=n
Changes v8 -> v9:
- revise error code
Changes v7 -> v8:
- use domain:slot.func:slot.func...:slot.func instead of domain:bus:slot.func
- allow symbolic aer error name in addition to 32bit value
Changes v6 -> v7:
- check return value.
Changes v3 -> v4:
- s/PCIE_AER/PCIEAER/g for structure names.
- compilation adjustment.
Changes v2 -> v3:
- compilation adjustment.
--- hmp-commands.hx | 28 +++++++ hw/pci-stub.c | 13 +++ hw/pcie_aer.c | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ sysemu.h | 5 + 4 files changed, 268 insertions(+), 0 deletions(-)
hmp-commands.hx +28 -0
@@ -873,6 +873,34 @@ Hot remove PCI device. ETEXI { + .name = "pcie_aer_inject_error", + .args_type = "advisory_non_fatal:-a,correctable:-c," + "pci_fw_dev_path:s,error_status:s," + "header0:i?,header1:i?,header2:i?,header3:i?," + "prefix0:i?,prefix1:i?,prefix2:i?,prefix3:i?", + .params = "[-a] [-c] <pci_fw_dev_path> " + "<error_status> [<tlp header> [<tlp header prefix>]]", + .help = "inject pcie aer error\n\t\t\t" + " -a for advisory non fatal error\n\t\t\t" + " -c for correctable error\n\t\t\t" + "<pci_fw_dev_path> = fw device path to pci device" + "\n\t\t\t/pci@<ioport or mmio(hex)>/" + "[<fw_name>]@<slot(hex)>,<func(hex)>/.../" + "[<fw_name>]@<slot(hex)>,<func(hex)>\n\t\t\t" + "<error_status> = error string or 32bit\n\t\t\t" + "<tlb header> = 32bit x 4\n\t\t\t" + "<tlb header prefix> = 32bit x 4", + .user_print = pcie_aer_inject_error_print, + .mhandler.cmd_new = do_pcie_aer_inejct_error, + }, + +STEXI +@item pcie_aer_inject_error +@findex pcie_aer_inject_error +Inject PCIe AER error +ETEXI + + { .name = "host_net_add", .args_type = "device:s,opts:s?", .params = "tap|user|socket|vde|dump [options]",
hw/pci-stub.c +13 -0
@@ -18,6 +18,7 @@* with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include "sysemu.h" #include "monitor.h" #include "pci.h"
@@ -35,3 +36,15 @@ void do_pci_info_print(Monitor *mon, const QObject *data) {pci_error_message (mon); } + +int do_pcie_aer_inejct_error (Monitor *mon, +const QDict *qdict,QObject **ret_data) +{ +pci_error_message (mon); +return -ENOSYS ; +} + +void pcie_aer_inject_error_print (Monitor *mon,const QObject *data) +{ +pci_error_message (mon); +}
hw/pcie_aer.c +222 -0
231 lines not on this page · raw message
sysemu.h +5 -0
@@ -157,6 +157,11 @@ void pci_device_hot_add(Monitor *mon, const QDict *qdict);void drive_hot_add (Monitor *mon,const QDict *qdict);void do_pci_device_hot_remove (Monitor *mon,const QDict *qdict); +/* pcie aer error injection */ +void pcie_aer_inject_error_print (Monitor *mon,const QObject *data); +int do_pcie_aer_inejct_error (Monitor *mon, +const QDict *qdict,QObject **ret_data); +/* serial ports */ #define MAX_SERIAL_PORTS 4
Signature · 1 line
1.7.1.1