[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 15/25] hw/block/nvme: QOM'ify PCI NVME
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PULL 15/25] hw/block/nvme: QOM'ify PCI NVME |
Date: |
Thu, 21 Dec 2017 22:38:00 +0200 |
On Thu, Dec 21, 2017 at 04:29:21PM +0200, Michael S. Tsirkin wrote:
> From: Philippe Mathieu-Daudé <address@hidden>
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> Reviewed-by: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
Dropped due to merge conflicts. Pls rebase and ask
storage maintainers to apply as appropriate.
> ---
> hw/block/nvme.c | 32 +++++++++++++++++---------------
> 1 file changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index 441e21e..9c5f898 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -920,9 +920,9 @@ static const MemoryRegionOps nvme_cmb_ops = {
> },
> };
>
> -static int nvme_init(PCIDevice *pci_dev)
> +static void nvme_realize(PCIDevice *pci, Error **errp)
> {
> - NvmeCtrl *n = NVME(pci_dev);
> + NvmeCtrl *n = NVME(pci);
> NvmeIdCtrl *id = &n->id_ctrl;
>
> int i;
> @@ -931,30 +931,33 @@ static int nvme_init(PCIDevice *pci_dev)
> Error *local_err = NULL;
>
> if (!n->conf.blk) {
> - return -1;
> + error_setg(errp, "Block device missing");
> + return;
> }
>
> bs_size = blk_getlength(n->conf.blk);
> if (bs_size < 0) {
> - return -1;
> + error_setg_errno(errp, -bs_size, "Could not get length of device");
> + return;
> }
>
> blkconf_serial(&n->conf, &n->serial);
> if (!n->serial) {
> - return -1;
> + error_setg(errp, "Could not get device serial number");
> + return;
> }
> blkconf_blocksizes(&n->conf);
> blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk),
> false, &local_err);
> if (local_err) {
> - error_report_err(local_err);
> - return -1;
> + error_propagate(errp, local_err);
> + return;
> }
>
> - pci_conf = pci_dev->config;
> + pci_conf = pci->config;
> pci_conf[PCI_INTERRUPT_PIN] = 1;
> - pci_config_set_prog_interface(pci_dev->config, 0x2);
> - pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS);
> + pci_config_set_prog_interface(pci->config, 0x2);
> + pci_config_set_class(pci->config, PCI_CLASS_STORAGE_EXPRESS);
> pcie_endpoint_cap_init(&n->parent_obj, 0x80);
>
> n->num_namespaces = 1;
> @@ -1046,12 +1049,11 @@ static int nvme_init(PCIDevice *pci_dev)
> cpu_to_le64(n->ns_size >>
> id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds);
> }
> - return 0;
> }
>
> -static void nvme_exit(PCIDevice *pci_dev)
> +static void nvme_exit(PCIDevice *pci)
> {
> - NvmeCtrl *n = NVME(pci_dev);
> + NvmeCtrl *n = NVME(pci);
>
> nvme_clear_ctrl(n);
> g_free(n->namespaces);
> @@ -1061,7 +1063,7 @@ static void nvme_exit(PCIDevice *pci_dev)
> memory_region_unref(&n->ctrl_mem);
> }
>
> - msix_uninit_exclusive_bar(pci_dev);
> + msix_uninit_exclusive_bar(pci);
> }
>
> static Property nvme_props[] = {
> @@ -1081,7 +1083,7 @@ static void nvme_class_init(ObjectClass *oc, void *data)
> DeviceClass *dc = DEVICE_CLASS(oc);
> PCIDeviceClass *pc = PCI_DEVICE_CLASS(oc);
>
> - pc->init = nvme_init;
> + pc->realize = nvme_realize;
> pc->exit = nvme_exit;
> pc->class_id = PCI_CLASS_STORAGE_EXPRESS;
> pc->vendor_id = PCI_VENDOR_ID_INTEL;
> --
> MST
>
- [Qemu-devel] [PULL 06/25] pci: Move bridge data structures from pci_bus.h to pci_bridge.h, (continued)
- [Qemu-devel] [PULL 06/25] pci: Move bridge data structures from pci_bus.h to pci_bridge.h, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 07/25] pci: Add pci_dev_bus_num() helper, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 10/25] virtio_error: don't invoke status callbacks, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 09/25] pci: Eliminate pci_find_primary_bus(), Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 11/25] tests/pxe-test: Remove unnecessary special case test functions, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 14/25] tests/pxe-test: Add some extra tests, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 08/25] pci: Eliminate redundant PCIDevice::bus pointer, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 12/25] tests/pxe-test: Use table of testcases rather than open-coding, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 13/25] tests/pxe-test: Test net booting over IPv6 in some cases, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 15/25] hw/block/nvme: QOM'ify PCI NVME, Michael S. Tsirkin, 2017/12/21
- Re: [Qemu-devel] [PULL 15/25] hw/block/nvme: QOM'ify PCI NVME,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 16/25] hw/pci-host/piix: QOM'ify the IGD Passthrough host bridge, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 17/25] hw/pci-host/xilinx: QOM'ify the AXI-PCIe host bridge, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 18/25] hw/pci: remove obsolete PCIDevice->init(), Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 19/25] vhost-user: fix indentation in protocol specification, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 20/25] vhost-user: document memory accesses, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 23/25] virtio-pci: Don't force Subsystem Vendor ID = Vendor ID, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 25/25] smbus: do not immediately complete commands, Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 24/25] dump-guest-memory.py: fix "You can't do that without a process to debug", Michael S. Tsirkin, 2017/12/21
- [Qemu-devel] [PULL 21/25] intel_iommu: remove X86_IOMMU_PCI_DEVFN_MAX, Michael S. Tsirkin, 2017/12/21