From patchwork Fri Jan 11 02:08:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10757207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D49013BF for ; Fri, 11 Jan 2019 02:10:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9045D29C4D for ; Fri, 11 Jan 2019 02:10:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84E2929C51; Fri, 11 Jan 2019 02:10:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 42FCC29C4D for ; Fri, 11 Jan 2019 02:10:19 +0000 (UTC) Received: from localhost ([127.0.0.1]:34289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghmH4-0001Om-I1 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 10 Jan 2019 21:10:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghmFs-0008JX-6Z for qemu-devel@nongnu.org; Thu, 10 Jan 2019 21:09:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghmFr-0004cz-Hs for qemu-devel@nongnu.org; Thu, 10 Jan 2019 21:09:04 -0500 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:42369) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghmFq-0004bw-4e; Thu, 10 Jan 2019 21:09:02 -0500 Received: by mail-oi1-x243.google.com with SMTP id w13so10985369oiw.9; Thu, 10 Jan 2019 18:09:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YZBhFnunBok1Gmb6mwNusTfLJTnvkZu+Im6xs8b6SQY=; b=lBt1kA3RCVXFNj3gRnDhQNgFUNefKV7sMb3Nb53lAGsuB+sagCu3LZC+zhvTkvYbbD usiOSiKDgYktbVWUjqJErm67MtKEzmVg7TrOE0GgBcWLEaHNRCOzOOzSkRzj59eXVs3o HPeAOymeX0Y2GZcEpXYW/yzRVirVWQuDxpabhGrW8tw2WrEHkHoSvtVAYkwe7mVg3xs7 i7hgg6mkbprD6rOeIbpuoPS0xQ6cLUZdZeLgG3z9SQOduJypXEIDE6r1eZaORyRIJzZg vKi1+xNXfIrf6wUnsFmMj4NXQ5Lsjfu3YuXkB09YaX+L6wCzheEbUfqjmvWbF4aID5eC oN9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YZBhFnunBok1Gmb6mwNusTfLJTnvkZu+Im6xs8b6SQY=; b=nJIT5iRc4oeHOPrhZ7PLbjz8vQTIMXABO+c9sQbm/Gr5l0y7YUpR6tpj839A2TGXbq nIqYbxmXVatCESvYUI0q6EVdBUGzdwS1wyj/hplBL0D+Z0G6w/WQ72zVSqqLSG1zcTu1 zILy7PTwBFoX0sLhePLQKzZvOvQ65tXJE7VZZro8SSFzY2vB5N/PPGECg6ULCrQLuyln GL0eoBRrwKuHkRLBpOJm0yB2ufkBdA/dvZkpYpGjiq7xTNzYrX0snV4PeBdsoz4dfrtC lEprDsNKJcQDxkEdqREmeACQhbslQD3vcoiEUe1qESlwvu139bECvbMlAUefL1IJVum7 vNoA== X-Gm-Message-State: AJcUukeHJc7gH9Z7HkSrH9PFUVP96B4++aJhEJuZtfkCxUpuOAmomZWm 0mZwsIEymwKWLusXlnqNcMs= X-Google-Smtp-Source: ALg8bN4XocG3u3dMx81t50XjzBfQmRGOK+c8Rl+Jl/lOStTsYJ6OCCvtzFiFTz3Ut+KzfPOSnNCMmA== X-Received: by 2002:a05:6808:89:: with SMTP id s9mr8296318oic.131.1547172541439; Thu, 10 Jan 2019 18:09:01 -0800 (PST) Received: from dockertest-VirtualBox.hz.ali.com ([205.204.117.36]) by smtp.gmail.com with ESMTPSA id u19sm37177122oia.31.2019.01.10.18.08.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 18:09:00 -0800 (PST) From: Li Qiang To: keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com Date: Fri, 11 Jan 2019 10:08:47 +0800 Message-Id: <20190111020849.22674-2-liq3ea@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190111020849.22674-1-liq3ea@gmail.com> References: <20190111020849.22674-1-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::243 Subject: [Qemu-devel] [PATCH v2 1/3] nvme: use TYPE_NVME instead of constant string X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Li Qiang Reviewed-by: Max Reitz Reviewed-by: Philippe Mathieu-Daudé --- hw/block/nvme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 7c8c63e8f5..f206391e8e 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1381,7 +1381,7 @@ static void nvme_instance_init(Object *obj) } static const TypeInfo nvme_info = { - .name = "nvme", + .name = TYPE_NVME, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(NvmeCtrl), .class_init = nvme_class_init, From patchwork Fri Jan 11 02:08:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10757213 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8689413BF for ; Fri, 11 Jan 2019 02:12:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7535329CEA for ; Fri, 11 Jan 2019 02:12:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69B5229CF7; Fri, 11 Jan 2019 02:12:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0877829CEA for ; Fri, 11 Jan 2019 02:12:43 +0000 (UTC) Received: from localhost ([127.0.0.1]:34907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghmJO-000383-BD for patchwork-qemu-devel@patchwork.kernel.org; Thu, 10 Jan 2019 21:12:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghmFw-0008Ns-MU for qemu-devel@nongnu.org; Thu, 10 Jan 2019 21:09:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghmFv-0004f9-Od for qemu-devel@nongnu.org; Thu, 10 Jan 2019 21:09:08 -0500 Received: from mail-oi1-x244.google.com ([2607:f8b0:4864:20::244]:44973) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghmFt-0004dl-LV; Thu, 10 Jan 2019 21:09:05 -0500 Received: by mail-oi1-x244.google.com with SMTP id m6so10996668oig.11; Thu, 10 Jan 2019 18:09:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AOTdhN8lUFUzc0nRlUkTGqJX9B9zTvuQbAktT0c3xkk=; b=kbjJTvUJ0hJu2kydwQo6VyFDkHLwTGEz1Pb9Ufin0jpB0OX/fRXKYfyExx3sE8VFAH hRSLOtcPnM6TbZHXNSQirmqgQfZJg5sif2p14KUDr3FwjOlyyy1eZMFqWjkfwi+pmxbV IfSpnviGKYBKlmlq1FWgcdUcIMn4VK85t9T+st+jdM+Vs4+CiB5f3PJKNqRO79U2OnCG cIIe+WnegLHZRZvLceF+qJh8fCvl0azd8wQTlOaQhdXNk9ZibVAVPkyDRU2jDiBTOzA1 Bc36hTkh+z30QYf8Cehu1qALJ3JfECotUTBkpB2oNaLCnJk6kWomI1oltiU57CeBX0sy +Dsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AOTdhN8lUFUzc0nRlUkTGqJX9B9zTvuQbAktT0c3xkk=; b=SVBc1Td4QN3uFZ1u5cRvGG+E4PKKQ7/FirXLOKQEhxnRcXvO1auW5xUmoOpwr5xQ/X T2hvIReTqacsLHDPDv7mXIypa1DLxqIkj8oMRa0OEZkMgeq1v8YiouxwAR/fYL7Vc/w0 JsOHqOUlLmlkLYkZhk35PPPv5SHCodXh7pQ4x5Yb7qd+ZHDimBZYhEIpdP9I7EMgmrYq q/gdUJoUsjsOswq6dnqxi8hT4KTAYaXZSsil11naolqG89Y3VPGfekE+XP6XqjiKmd10 dR5bkfaOf/qKgLEE3B0SZ1ZxE12LgIVXzneLoyMpLHykPs4DPAjGczBgPsqeN/wwCcRd 5HeA== X-Gm-Message-State: AJcUukdR9QhjuUADg/y6qpsotmae0ptF/a4+72fxNIOZpsWTagIpp3Rz e/OP4drkgdg1ZoyDc3hVdOQ= X-Google-Smtp-Source: ALg8bN5lZuMRMEPsjoH9jbh/Df9MgtP2qftH4KKX+mlqtEsBMKj1ohFloPcZ+y9ixUAUTt32BDvhKA== X-Received: by 2002:aca:b804:: with SMTP id i4mr7757180oif.280.1547172544929; Thu, 10 Jan 2019 18:09:04 -0800 (PST) Received: from dockertest-VirtualBox.hz.ali.com ([205.204.117.36]) by smtp.gmail.com with ESMTPSA id u19sm37177122oia.31.2019.01.10.18.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 18:09:04 -0800 (PST) From: Li Qiang To: keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com Date: Fri, 11 Jan 2019 10:08:48 +0800 Message-Id: <20190111020849.22674-3-liq3ea@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190111020849.22674-1-liq3ea@gmail.com> References: <20190111020849.22674-1-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::244 Subject: [Qemu-devel] [PATCH v2 2/3] nvme: ensure the num_queues is not zero X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP When it is zero, it causes segv. Backtrack: Thread 5 "qemu-system-x86" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffc6c17700 (LWP 51808)] 0x0000555555acbd90 in nvme_start_ctrl (n=0x6240000c8100) at hw/block/nvme.c:820 warning: Source file is more recent than executable. 820 if (unlikely(n->cq[0])) { (gdb) bt 0 0x0000555555acbd90 in nvme_start_ctrl (n=0x6240000c8100) at hw/block/nvme.c:820 1 0x0000555555accdbc in nvme_write_bar (n=0x6240000c8100, offset=20, data=4587521, size=4) at hw/block/nvme.c:964 2 0x0000555555acdd2b in nvme_mmio_write (opaque=0x6240000c8100, addr=20, data=4587521, size=4) at hw/block/nvme.c:1158 3 0x00005555558973ed in memory_region_write_accessor (mr=0x6240000c89e0, addr=20, value=0x7fffc6c14428, size=4, shift=0, mask=4294967295, attrs=...) at /home/liqiang02/qemu-upstream/qemu/memory.c:500 4 0x0000555555897600 in access_with_adjusted_size (addr=20, value=0x7fffc6c14428, size=4, access_size_min=2, access_size_max=8, access_fn=0x555555897304 , mr=0x6240000c89e0, attrs=...) at /home/liqiang02/qemu-upstream/qemu/memory.c:566 5 0x000055555589a200 in memory_region_dispatch_write (mr=0x6240000c89e0, addr=20, data=4587521, size=4, attrs=...) at /home/liqiang02/qemu-upstream/qemu/memory.c:1442 6 0x0000555555835151 in flatview_write_continue (fv=0x6060000e6fc0, addr=4273930260, attrs=..., buf=0x7fffc8a18028 "\001", len=4, addr1=20, l=4, mr=0x6240000c89e0) at /home/liqiang02/qemu-upstream/qemu/exec.c:3233 7 0x000055555583529b in flatview_write (fv=0x6060000e6fc0, addr=4273930260, attrs=..., buf=0x7fffc8a18028 "\001", len=4) at /home/liqiang02/qemu-upstream/qemu/exec.c:3272 8 0x00005555558355a1 in address_space_write (as=0x55555683ade0 , addr=4273930260, attrs=..., buf=0x7fffc8a18028 "\001", len=4) at /home/liqiang02/qemu-upstream/qemu/exec.c:3362 9 0x00005555558355f2 in address_space_rw (as=0x55555683ade0 , addr=4273930260, attrs=..., buf=0x7fffc8a18028 "\001", len=4, is_write=true) at /home/liqiang02/qemu-upstream/qemu/exec.c:3373 10 0x00005555558b66ac in kvm_cpu_exec (cpu=0x631000014800) at /home/liqiang02/qemu-upstream/qemu/accel/kvm/kvm-all.c:2031 11 0x000055555587c3ac in qemu_kvm_cpu_thread_fn (arg=0x631000014800) at /home/liqiang02/qemu-upstream/qemu/cpus.c:1277 12 0x0000555555e54ae6 in qemu_thread_start (args=0x60300002c170) at util/qemu-thread-posix.c:504 13 0x00007fffdadbd494 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 14 0x00007fffdaaffacf in clone () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) q Signed-off-by: Li Qiang Reviewed-by: Philippe Mathieu-Daudé --- hw/block/nvme.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index f206391e8e..0ded74fa9a 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1223,6 +1223,11 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) error_setg(errp, "serial property not set"); return; } + + if (!n->num_queues) { + error_setg(errp, "num_queues can't be zero"); + return; + } blkconf_blocksizes(&n->conf); if (!blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk), false, errp)) { From patchwork Fri Jan 11 02:08:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Qiang X-Patchwork-Id: 10757211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18F6513BF for ; Fri, 11 Jan 2019 02:12:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0ADEA29CEA for ; Fri, 11 Jan 2019 02:12:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2D7329CF7; Fri, 11 Jan 2019 02:12:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A298429CEA for ; Fri, 11 Jan 2019 02:12:33 +0000 (UTC) Received: from localhost ([127.0.0.1]:34872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghmJE-00032A-S2 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 10 Jan 2019 21:12:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghmG6-0008WR-4S for qemu-devel@nongnu.org; Thu, 10 Jan 2019 21:09:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ghmG5-0004kw-Fd for qemu-devel@nongnu.org; Thu, 10 Jan 2019 21:09:18 -0500 Received: from mail-oi1-x242.google.com ([2607:f8b0:4864:20::242]:33786) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ghmG3-0004jl-7I; Thu, 10 Jan 2019 21:09:15 -0500 Received: by mail-oi1-x242.google.com with SMTP id c206so11054043oib.0; Thu, 10 Jan 2019 18:09:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q4zJzR2Ir+O/sS2GJGT71B9mXMMRwXReqR0tnxjrSiQ=; b=MRGDy9QFevZ6UvY9jZSNOadGxtES/ueI/r2JuYIrlZ0moGYfgDtJuQnq9rn4CEuYhb RU2WsKvGnDWXERqEBuAEXt5InmGU3T3kEdFQxgm9fFhMuWXB8lDktLf1pQ509uJ/dFBw j1R+ldfgTBradKgGSjFoCwrNPTtb5nOx191BSErVjRX/aUPFZLsLADmZnv+BAG6dzq5S 4Ixbm+ka4s6FpEZsT3i3cYYc2idQgC6NAzd4iMnNmwaokuYnNjtFAgaptxAOtqQxSr2q c08zcgZDYvWZjyN5XfNhD8CbcD5ZnbNSmFccaLFGRhN7yJLE2PzHrDrLtzTLGrPpJdHr ccZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q4zJzR2Ir+O/sS2GJGT71B9mXMMRwXReqR0tnxjrSiQ=; b=GaAJIJGYyQIUwzAiFHAyBvO/+lldCejZ1ztgu0yJXD6uiURdwi77CcWHCVsp11szUy XKPryzcbIBonx2LvtZPqP0J1QB2R1Z5pa81Jx8NG3XQ5FrPE+myz+cFhodpEAj1OYbPy ay+nNxj0ye47pf5d4gvqZlkk4zYp3ySwUDTkxC0/BRD6VHKdzo/NISxA/UmCi/D1uVZA aY2cL3ubdf+1y0suLPR8jiEQUXGXjdfB8Khe+2J0t+d96A1cNgXGVMludba7pWJn6i8Z iF4q6oguNgef42/bjEtOJvCp3CdotIJ7c2dOO6m3+ZeTlGM4Xe/UA55t4h15icTBX2Xx 5d1Q== X-Gm-Message-State: AJcUukeUkAFuY5jZ1hKXez91qRGyQihb7pnFxlosMCKSzLgsQsxOJ6GF 2BKCaB0dwYsFw3PnGTg5fsE= X-Google-Smtp-Source: ALg8bN58T+ENPjPaZaVNp7fEiwUXk71BBZ3OO6iN4ethyqRGWVsHFmzlW2vHeu160kwZ66y7F2+8xA== X-Received: by 2002:aca:5987:: with SMTP id n129mr8327260oib.174.1547172554557; Thu, 10 Jan 2019 18:09:14 -0800 (PST) Received: from dockertest-VirtualBox.hz.ali.com ([205.204.117.36]) by smtp.gmail.com with ESMTPSA id u19sm37177122oia.31.2019.01.10.18.09.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 18:09:14 -0800 (PST) From: Li Qiang To: keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com Date: Fri, 11 Jan 2019 10:08:49 +0800 Message-Id: <20190111020849.22674-4-liq3ea@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190111020849.22674-1-liq3ea@gmail.com> References: <20190111020849.22674-1-liq3ea@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::242 Subject: [Qemu-devel] [PATCH v2 3/3] nvme: use pci_dev directly in nvme_realize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Li Qiang , qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP There is no need to make another reference. Signed-off-by: Li Qiang Reviewed-by: Max Reitz Reviewed-by: Philippe Mathieu-Daudé --- hw/block/nvme.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 0ded74fa9a..0a1da749fc 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1238,7 +1238,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) 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); - pcie_endpoint_cap_init(&n->parent_obj, 0x80); + pcie_endpoint_cap_init(pci_dev, 0x80); n->num_namespaces = 1; n->reg_size = pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); @@ -1250,10 +1250,10 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); - pci_register_bar(&n->parent_obj, 0, + pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); - msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4, NULL); + msix_init_exclusive_bar(pci_dev, n->num_queues, 4, NULL); id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID)); @@ -1308,7 +1308,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) n->cmbuf = g_malloc0(NVME_CMBSZ_GETSIZE(n->bar.cmbsz)); memory_region_init_io(&n->ctrl_mem, OBJECT(n), &nvme_cmb_ops, n, "nvme-cmb", NVME_CMBSZ_GETSIZE(n->bar.cmbsz)); - pci_register_bar(&n->parent_obj, NVME_CMBLOC_BIR(n->bar.cmbloc), + pci_register_bar(pci_dev, NVME_CMBLOC_BIR(n->bar.cmbloc), PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64 | PCI_BASE_ADDRESS_MEM_PREFETCH, &n->ctrl_mem);