From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405492; cv=none; d=zohomail.com; s=zohoarc; b=NDw5yvI/0/bF1vbyouNbjv90mWQwmpSVvzgrs7oDOiHNl+vFcuF7jbByv1m9Af/kMPju4b3G9yTW7zcHhTg/YEDKbRtw2uYDKaEAANlN0ebQWGyVfoz7z4WcZTRcBmtvb6WhrAvN19l0yKM2BDVPUen7vrpxqIYwITUQYmjxLsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405492; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eVFz5Q176/3p6VzQR0SwPBqhCFRMIJcNYF6vMJCwZ0Y=; b=XZDK5BrTtMwbMTQDwHlzqBkwbUf6fySiguVzniC+7oG1cyhs6lSWHTmvDb3YmDSID6MHkUX8795KG+5rsgWUPSZjy2HWkEbdONi3waY5qX2FQiTqhUSK5cf67jEPlhJBledVF4JgYqzgEHXYuShb55XVBYdytxuRWSsZejyhP7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405492938433.5291923606271; Wed, 17 Jun 2020 07:51:32 -0700 (PDT) Received: from localhost ([::1]:50530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZPX-0005RM-8T for importer@patchew.org; Wed, 17 Jun 2020 10:51:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNT-0002iH-JJ for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:23 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34817 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNP-0001d3-8b for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:22 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401--zJqdMBdN0m4tnEQWGgFlg-1; Wed, 17 Jun 2020 10:49:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE7D418A266A; Wed, 17 Jun 2020 14:49:14 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id E77EA7CAA0; Wed, 17 Jun 2020 14:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eVFz5Q176/3p6VzQR0SwPBqhCFRMIJcNYF6vMJCwZ0Y=; b=FtrdoKiPgW1XZoAs0DfSNMqYDqwREZDzJWPKy8CNuhEINV15B0XzIoJUzDNeybjO9lyCmI zTdqpb+m4DjnSuPPK9wK1cP0lLwlrTHRr65stZ2qo2qK/J4wBV8g3Ou5+4/zUbFMi8d6H9 xvzxCNQmQDBLqN+faYp2wsCqqKdydls= X-MC-Unique: -zJqdMBdN0m4tnEQWGgFlg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 01/43] hw/ide: Make IDEDMAOps handlers take a const IDEDMA pointer Date: Wed, 17 Jun 2020 16:48:27 +0200 Message-Id: <20200617144909.192176-2-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 Handlers don't need to modify the IDEDMA structure. Make it const. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200512194917.15807-1-philmd@redhat.com> Acked-by: John Snow Signed-off-by: Kevin Wolf --- include/hw/ide/internal.h | 12 ++++++------ hw/ide/ahci.c | 18 +++++++++--------- hw/ide/core.c | 6 +++--- hw/ide/macio.c | 6 +++--- hw/ide/pci.c | 12 ++++++------ 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 55da35d768..1a7869e85d 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -322,12 +322,12 @@ typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKi= nd; =20 typedef void EndTransferFunc(IDEState *); =20 -typedef void DMAStartFunc(IDEDMA *, IDEState *, BlockCompletionFunc *); -typedef void DMAVoidFunc(IDEDMA *); -typedef int DMAIntFunc(IDEDMA *, bool); -typedef int32_t DMAInt32Func(IDEDMA *, int32_t len); -typedef void DMAu32Func(IDEDMA *, uint32_t); -typedef void DMAStopFunc(IDEDMA *, bool); +typedef void DMAStartFunc(const IDEDMA *, IDEState *, BlockCompletionFunc = *); +typedef void DMAVoidFunc(const IDEDMA *); +typedef int DMAIntFunc(const IDEDMA *, bool); +typedef int32_t DMAInt32Func(const IDEDMA *, int32_t len); +typedef void DMAu32Func(const IDEDMA *, uint32_t); +typedef void DMAStopFunc(const IDEDMA *, bool); =20 struct unreported_events { bool eject_request; diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index fc82cbd5f1..009120f88b 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -44,7 +44,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slo= t); static void ahci_reset_port(AHCIState *s, int port); static bool ahci_write_fis_d2h(AHCIDevice *ad); static void ahci_init_d2h(AHCIDevice *ad); -static int ahci_dma_prepare_buf(IDEDMA *dma, int32_t limit); +static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit); static bool ahci_map_clb_address(AHCIDevice *ad); static bool ahci_map_fis_address(AHCIDevice *ad); static void ahci_unmap_clb_address(AHCIDevice *ad); @@ -1338,7 +1338,7 @@ out: } =20 /* Transfer PIO data between RAM and device */ -static void ahci_pio_transfer(IDEDMA *dma) +static void ahci_pio_transfer(const IDEDMA *dma) { AHCIDevice *ad =3D DO_UPCAST(AHCIDevice, dma, dma); IDEState *s =3D &ad->port.ifs[0]; @@ -1397,7 +1397,7 @@ out: } } =20 -static void ahci_start_dma(IDEDMA *dma, IDEState *s, +static void ahci_start_dma(const IDEDMA *dma, IDEState *s, BlockCompletionFunc *dma_cb) { AHCIDevice *ad =3D DO_UPCAST(AHCIDevice, dma, dma); @@ -1406,7 +1406,7 @@ static void ahci_start_dma(IDEDMA *dma, IDEState *s, dma_cb(s, 0); } =20 -static void ahci_restart_dma(IDEDMA *dma) +static void ahci_restart_dma(const IDEDMA *dma) { /* Nothing to do, ahci_start_dma already resets s->io_buffer_offset. = */ } @@ -1415,7 +1415,7 @@ static void ahci_restart_dma(IDEDMA *dma) * IDE/PIO restarts are handled by the core layer, but NCQ commands * need an extra kick from the AHCI HBA. */ -static void ahci_restart(IDEDMA *dma) +static void ahci_restart(const IDEDMA *dma) { AHCIDevice *ad =3D DO_UPCAST(AHCIDevice, dma, dma); int i; @@ -1432,7 +1432,7 @@ static void ahci_restart(IDEDMA *dma) * Called in DMA and PIO R/W chains to read the PRDT. * Not shared with NCQ pathways. */ -static int32_t ahci_dma_prepare_buf(IDEDMA *dma, int32_t limit) +static int32_t ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit) { AHCIDevice *ad =3D DO_UPCAST(AHCIDevice, dma, dma); IDEState *s =3D &ad->port.ifs[0]; @@ -1453,7 +1453,7 @@ static int32_t ahci_dma_prepare_buf(IDEDMA *dma, int3= 2_t limit) * Called via dma_buf_commit, for both DMA and PIO paths. * sglist destruction is handled within dma_buf_commit. */ -static void ahci_commit_buf(IDEDMA *dma, uint32_t tx_bytes) +static void ahci_commit_buf(const IDEDMA *dma, uint32_t tx_bytes) { AHCIDevice *ad =3D DO_UPCAST(AHCIDevice, dma, dma); =20 @@ -1461,7 +1461,7 @@ static void ahci_commit_buf(IDEDMA *dma, uint32_t tx_= bytes) ad->cur_cmd->status =3D cpu_to_le32(tx_bytes); } =20 -static int ahci_dma_rw_buf(IDEDMA *dma, bool is_write) +static int ahci_dma_rw_buf(const IDEDMA *dma, bool is_write) { AHCIDevice *ad =3D DO_UPCAST(AHCIDevice, dma, dma); IDEState *s =3D &ad->port.ifs[0]; @@ -1486,7 +1486,7 @@ static int ahci_dma_rw_buf(IDEDMA *dma, bool is_write) return 1; } =20 -static void ahci_cmd_done(IDEDMA *dma) +static void ahci_cmd_done(const IDEDMA *dma) { AHCIDevice *ad =3D DO_UPCAST(AHCIDevice, dma, dma); =20 diff --git a/hw/ide/core.c b/hw/ide/core.c index 689bb36409..d997a78e47 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2570,16 +2570,16 @@ static void ide_init1(IDEBus *bus, int unit) ide_sector_write_timer_cb, s); } =20 -static int ide_nop_int(IDEDMA *dma, bool is_write) +static int ide_nop_int(const IDEDMA *dma, bool is_write) { return 0; } =20 -static void ide_nop(IDEDMA *dma) +static void ide_nop(const IDEDMA *dma) { } =20 -static int32_t ide_nop_int32(IDEDMA *dma, int32_t l) +static int32_t ide_nop_int32(const IDEDMA *dma, int32_t l) { return 0; } diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 30af0e93e6..62a599a075 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -376,17 +376,17 @@ static void macio_ide_reset(DeviceState *dev) ide_bus_reset(&d->bus); } =20 -static int ide_nop_int(IDEDMA *dma, bool is_write) +static int ide_nop_int(const IDEDMA *dma, bool is_write) { return 0; } =20 -static int32_t ide_nop_int32(IDEDMA *dma, int32_t l) +static int32_t ide_nop_int32(const IDEDMA *dma, int32_t l) { return 0; } =20 -static void ide_dbdma_start(IDEDMA *dma, IDEState *s, +static void ide_dbdma_start(const IDEDMA *dma, IDEState *s, BlockCompletionFunc *cb) { MACIOIDEState *m =3D container_of(dma, MACIOIDEState, dma); diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 97347f07f1..5e85c4ad17 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -103,7 +103,7 @@ const MemoryRegionOps pci_ide_data_le_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN, }; =20 -static void bmdma_start_dma(IDEDMA *dma, IDEState *s, +static void bmdma_start_dma(const IDEDMA *dma, IDEState *s, BlockCompletionFunc *dma_cb) { BMDMAState *bm =3D DO_UPCAST(BMDMAState, dma, dma); @@ -126,7 +126,7 @@ static void bmdma_start_dma(IDEDMA *dma, IDEState *s, * IDEState.io_buffer_size will contain the number of bytes described * by the PRDs, whether or not we added them to the sglist. */ -static int32_t bmdma_prepare_buf(IDEDMA *dma, int32_t limit) +static int32_t bmdma_prepare_buf(const IDEDMA *dma, int32_t limit) { BMDMAState *bm =3D DO_UPCAST(BMDMAState, dma, dma); IDEState *s =3D bmdma_active_if(bm); @@ -181,7 +181,7 @@ static int32_t bmdma_prepare_buf(IDEDMA *dma, int32_t l= imit) } =20 /* return 0 if buffer completed */ -static int bmdma_rw_buf(IDEDMA *dma, bool is_write) +static int bmdma_rw_buf(const IDEDMA *dma, bool is_write) { BMDMAState *bm =3D DO_UPCAST(BMDMAState, dma, dma); IDEState *s =3D bmdma_active_if(bm); @@ -230,7 +230,7 @@ static int bmdma_rw_buf(IDEDMA *dma, bool is_write) return 1; } =20 -static void bmdma_set_inactive(IDEDMA *dma, bool more) +static void bmdma_set_inactive(const IDEDMA *dma, bool more) { BMDMAState *bm =3D DO_UPCAST(BMDMAState, dma, dma); =20 @@ -242,7 +242,7 @@ static void bmdma_set_inactive(IDEDMA *dma, bool more) } } =20 -static void bmdma_restart_dma(IDEDMA *dma) +static void bmdma_restart_dma(const IDEDMA *dma) { BMDMAState *bm =3D DO_UPCAST(BMDMAState, dma, dma); =20 @@ -257,7 +257,7 @@ static void bmdma_cancel(BMDMAState *bm) } } =20 -static void bmdma_reset(IDEDMA *dma) +static void bmdma_reset(const IDEDMA *dma) { BMDMAState *bm =3D DO_UPCAST(BMDMAState, dma, dma); =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405530; cv=none; d=zohomail.com; s=zohoarc; b=ACTPJ+JX/lqaMX+OW2/2N0BOW/v0++ayjNY7gi2qCDkXDS78J9R1Yaahc6yxlNEEMJo90QblSHT+6vHoIxiizmI0vNvdgydrnl/GyDNg8zd+qx4z94oj7y3TEArV/Q13538iJD+tVhnIIkG1fJSdHvlxfRMobjD21erTYkLzaBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405530; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8FDtFgVXbdXkJ2To4Y8gFPq3/FazjDall/X6/Ks/zPA=; b=b1eAeic5dUh5Apff+/ZsBu+XbHEYba2MuXSDc5N3nZ5JBms0mkxAgJmwwxvBhDN4/j4369GqsKmNphCy38/joSm+4B9t5VYe/k1Cc7z47+cMtzaDIjiDFcUVmLjsABhzaq89DDKWsFpCp6Or+eKbotnOHpVuGdSK1xN4N5+19xA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159240553065191.53437003974454; Wed, 17 Jun 2020 07:52:10 -0700 (PDT) Received: from localhost ([::1]:54034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZQ9-000756-1u for importer@patchew.org; Wed, 17 Jun 2020 10:52:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNd-0002rI-1p for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:33 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:41894 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNW-0001eU-NN for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-367-tmtw0q-OOBqPDJRXUBZV5w-1; Wed, 17 Jun 2020 10:49:17 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B409108BBE0; Wed, 17 Jun 2020 14:49:16 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33E547CAAA; Wed, 17 Jun 2020 14:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8FDtFgVXbdXkJ2To4Y8gFPq3/FazjDall/X6/Ks/zPA=; b=Zn/dBj6SHBqwyjuC1LRcbesUYl+eXi4NAdI8E6+vVNXy93Am6ZFyZlUwM5rhJWudexkJyC kUKQ0VPjZ+9WYkMIqDD0qYg9yXeFMWXDo84UrlUFjhVY9jIKTLbh6SGysONDDoHtNr5uP4 3KgrcGlPxsdboRjLVXZNLsVrt4gfmDU= X-MC-Unique: tmtw0q-OOBqPDJRXUBZV5w-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 02/43] icount: make dma reads deterministic Date: Wed, 17 Jun 2020 16:48:28 +0200 Message-Id: <20200617144909.192176-3-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk Windows guest sometimes makes DMA requests with overlapping target addresses. This leads to the following structure of iov for the block driver: addr size1 addr size2 addr size3 It means that three adjacent disk blocks should be read into the same memory buffer. Windows does not expects anything from these bytes (should it be data from the first block, or the last one, or some mix), but uses them somehow. It leads to non-determinism of the guest execution, because block driver does not preserve any order of reading. This situation was discusses in the mailing list at least twice: https://lists.gnu.org/archive/html/qemu-devel/2010-09/msg01996.html https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg05185.html This patch makes such disk reads deterministic in icount mode. It splits the whole request into several parts. Parts may overlap, but SGs inside one part do not overlap. Parts that are processed later overwrite the prior ones in case of overlapping. Examples for different SG part sequences: 1) A1 1000 A2 1000 A1 1000 A3 1000 -> One request is split into two. A1 1000 A2 1000 -- A1 1000 A3 1000 2) A1 800 A2 1000 A1 1000 -> A1 800 A2 1000 -- A1 1000 Signed-off-by: Pavel Dovgalyuk Message-Id: <159117972206.12193.12939621311413561779.stgit@pasha-ThinkPad-X= 280> Signed-off-by: Kevin Wolf --- dma-helpers.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dma-helpers.c b/dma-helpers.c index e8a26e81e1..2a77b5a9cb 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -13,6 +13,8 @@ #include "trace-root.h" #include "qemu/thread.h" #include "qemu/main-loop.h" +#include "sysemu/cpus.h" +#include "qemu/range.h" =20 /* #define DEBUG_IOMMU */ =20 @@ -142,6 +144,26 @@ static void dma_blk_cb(void *opaque, int ret) cur_addr =3D dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byt= e; cur_len =3D dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte; mem =3D dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir); + /* + * Make reads deterministic in icount mode. Windows sometimes issu= es + * disk read requests with overlapping SGs. It leads + * to non-determinism, because resulting buffer contents may be mi= xed + * from several sectors. This code splits all SGs into several + * groups. SGs in every group do not overlap. + */ + if (mem && use_icount && dbs->dir =3D=3D DMA_DIRECTION_FROM_DEVICE= ) { + int i; + for (i =3D 0 ; i < dbs->iov.niov ; ++i) { + if (ranges_overlap((intptr_t)dbs->iov.iov[i].iov_base, + dbs->iov.iov[i].iov_len, (intptr_t)mem, + cur_len)) { + dma_memory_unmap(dbs->sg->as, mem, cur_len, + dbs->dir, cur_len); + mem =3D NULL; + break; + } + } + } if (!mem) break; qemu_iovec_add(&dbs->iov, mem, cur_len); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405584; cv=none; d=zohomail.com; s=zohoarc; b=aTZgDA6JTz1gLnfR81rv69WCmhSDyYZTKCt9+G3ujvUHgQ7qpt531hiulauvW4lK/m7qj49IdWakFSTENepYJgR5N5ElKcUDvXi5w3563ctQ3APNFb5QtR3JV73kZjG+I75NNhRO1/PLmBUoEkigotM0xXP8DWeWpQQde4qPCgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405584; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MS76N2qGEoEBGWY9Y1mZmvMCgv+GQMKggv6OjvNYR5M=; b=TdFiIfU+PQuaz8HaPhJXwp5cCYngq2ObPZEGq+ihJIuplkgIHhJblz9w3TbCq3yEYnEgrQB0LFgz2A85KCAyXRw3p5IMYGlInsVe0omPUpLqDFPDcOQhbhzMlWB6/bDKATSagyI4BxR1P/NUAlkhpFw1gi5ZouP0mIDNy30QPLk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405584805664.6250888257368; Wed, 17 Jun 2020 07:53:04 -0700 (PDT) Received: from localhost ([::1]:59056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZR0-0000iu-BG for importer@patchew.org; Wed, 17 Jun 2020 10:53:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNY-0002o8-WB for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:29 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:54942 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNR-0001dQ-OJ for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-264-00nl0N0MMNSWHxExF1wgNQ-1; Wed, 17 Jun 2020 10:49:18 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D7FC134D3; Wed, 17 Jun 2020 14:49:17 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 760207CAA0; Wed, 17 Jun 2020 14:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MS76N2qGEoEBGWY9Y1mZmvMCgv+GQMKggv6OjvNYR5M=; b=cVybmmzsCRXsFzvN4aRWtHLgwy3IcD6YK2IXd71dt++n6RPnC1SNWHzj39GXFKeu+u/HQt w8ldVqt53lkVYsHWEL1GR86aQb2oNZG4Hux430wcTo3++w1IFunEX/GcHPbgTtYP1xo11p 7p90bDhQC7yJytH/Ji4XKd9006qOIaY= X-MC-Unique: 00nl0N0MMNSWHxExF1wgNQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 03/43] virtio-blk: Refactor the code that processes queued requests Date: Wed, 17 Jun 2020 16:48:29 +0200 Message-Id: <20200617144909.192176-4-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Sergio Lopez Move the code that processes queued requests from virtio_blk_dma_restart_bh() to its own, non-static, function. This will allow us to call it from the virtio_blk_data_plane_start() in a future patch. Signed-off-by: Sergio Lopez Message-Id: <20200603093240.40489-2-slp@redhat.com> Signed-off-by: Kevin Wolf --- include/hw/virtio/virtio-blk.h | 1 + hw/block/virtio-blk.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index 1e62f869b2..f584ad9b86 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -86,5 +86,6 @@ typedef struct MultiReqBuffer { } MultiReqBuffer; =20 bool virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq); +void virtio_blk_process_queued_requests(VirtIOBlock *s); =20 #endif diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index f5f6fc925e..978574e4da 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -819,15 +819,11 @@ static void virtio_blk_handle_output(VirtIODevice *vd= ev, VirtQueue *vq) virtio_blk_handle_output_do(s, vq); } =20 -static void virtio_blk_dma_restart_bh(void *opaque) +void virtio_blk_process_queued_requests(VirtIOBlock *s) { - VirtIOBlock *s =3D opaque; VirtIOBlockReq *req =3D s->rq; MultiReqBuffer mrb =3D {}; =20 - qemu_bh_delete(s->bh); - s->bh =3D NULL; - s->rq =3D NULL; =20 aio_context_acquire(blk_get_aio_context(s->conf.conf.blk)); @@ -855,6 +851,16 @@ static void virtio_blk_dma_restart_bh(void *opaque) aio_context_release(blk_get_aio_context(s->conf.conf.blk)); } =20 +static void virtio_blk_dma_restart_bh(void *opaque) +{ + VirtIOBlock *s =3D opaque; + + qemu_bh_delete(s->bh); + s->bh =3D NULL; + + virtio_blk_process_queued_requests(s); +} + static void virtio_blk_dma_restart_cb(void *opaque, int running, RunState state) { --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405502; cv=none; d=zohomail.com; s=zohoarc; b=KV2epuDCpvQr/sQH38qXc8ThMaybINDPJQy0gcX3uHtYNhgrQtQu0u693QKAVW615b7lhz12WbGHkqA5MBBypLv0eulUL2c69zclYg+dYqQ65ab7T7x9HFYQzA7osadu4qwo7tkdhLt1gTG42WquVzleWSYLUN7f0eTzYXa9nJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405502; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1OkAX3Snq8ZE3zFbYQJi9tGeAS9Ynk5O0dFhCFpVXKQ=; b=ScRZ95EI/ADRVWjbquu3Apu1eV6JAERljh2qOEzX1X4tF3VBQNiwFQTE3HKkFFJ/EXf+GLPpj6j9y7o+LEnKINuprgVLdgml2lhGDgWpUSFjKdoEhH2/ZrhhM0Nb/hx0DaFZOBU95is5sTcyPQKXRRwMfMOXJz3cqDZGjRchiXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405502923562.1135521082208; Wed, 17 Jun 2020 07:51:42 -0700 (PDT) Received: from localhost ([::1]:51404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZPh-0005nb-5f for importer@patchew.org; Wed, 17 Jun 2020 10:51:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNd-0002rU-7X for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:33 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22852 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNW-0001eF-RH for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-395-pcuWkRTbPbOX5YG3ia0liA-1; Wed, 17 Jun 2020 10:49:19 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BEBCA100CCC9; Wed, 17 Jun 2020 14:49:18 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id C61BF7CAA0; Wed, 17 Jun 2020 14:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1OkAX3Snq8ZE3zFbYQJi9tGeAS9Ynk5O0dFhCFpVXKQ=; b=ZH+HNl/6PWM1M6Z7vY1ZN9vc+rmxJGcEO6vVr7gMpd8MXt24jRNBOsE9/ZfDFlB9bzu0kF h7UgKbNVE6gH7X7AFJCrt2LVexYS1jhvaiIvK28zXUrcUuT0lhwhhQOuHOilLnHFugcOyu iPY4KG/J9qSgIKsGr/eksaGe/IAFdYE= X-MC-Unique: pcuWkRTbPbOX5YG3ia0liA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 04/43] virtio-blk: On restart, process queued requests in the proper context Date: Wed, 17 Jun 2020 16:48:30 +0200 Message-Id: <20200617144909.192176-5-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Sergio Lopez On restart, we were scheduling a BH to process queued requests, which would run before starting up the data plane, leading to those requests being assigned and started on coroutines on the main context. This could cause requests to be wrongly processed in parallel from different threads (the main thread and the iothread managing the data plane), potentially leading to multiple issues. For example, stopping and resuming a VM multiple times while the guest is generating I/O on a virtio_blk device can trigger a crash with a stack tracing looking like this one: <------> Thread 2 (Thread 0x7ff736765700 (LWP 1062503)): #0 0x00005567a13b99d6 in iov_memset (iov=3D0x6563617073206f4e, iov_cnt=3D1717922848, offset=3D516096, fill= c=3D0, bytes=3D7018105756081554803) at util/iov.c:69 #1 0x00005567a13bab73 in qemu_iovec_memset (qiov=3D0x7ff73ec99748, offset=3D516096, fillc=3D0, bytes=3D7018105756= 081554803) at util/iov.c:530 #2 0x00005567a12f411c in qemu_laio_process_completion (laiocb=3D0x7ff6512= ee6c0) at block/linux-aio.c:86 #3 0x00005567a12f42ff in qemu_laio_process_completions (s=3D0x7ff7182e842= 0) at block/linux-aio.c:217 #4 0x00005567a12f480d in ioq_submit (s=3D0x7ff7182e8420) at block/linux-a= io.c:323 #5 0x00005567a12f43d9 in qemu_laio_process_completions_and_submit (s=3D0x= 7ff7182e8420) at block/linux-aio.c:236 #6 0x00005567a12f44c2 in qemu_laio_poll_cb (opaque=3D0x7ff7182e8430) at b= lock/linux-aio.c:267 #7 0x00005567a13aed83 in run_poll_handlers_once (ctx=3D0x5567a2b58c70, ti= meout=3D0x7ff7367645f8) at util/aio-posix.c:520 #8 0x00005567a13aee9f in run_poll_handlers (ctx=3D0x5567a2b58c70, max_ns= =3D16000, timeout=3D0x7ff7367645f8) at util/aio-posix.c:562 #9 0x00005567a13aefde in try_poll_mode (ctx=3D0x5567a2b58c70, timeout=3D0= x7ff7367645f8) at util/aio-posix.c:597 #10 0x00005567a13af115 in aio_poll (ctx=3D0x5567a2b58c70, blocking=3Dtrue)= at util/aio-posix.c:639 #11 0x00005567a109acca in iothread_run (opaque=3D0x5567a2b29760) at iothre= ad.c:75 #12 0x00005567a13b2790 in qemu_thread_start (args=3D0x5567a2b694c0) at uti= l/qemu-thread-posix.c:519 #13 0x00007ff73eedf2de in start_thread () at /lib64/libpthread.so.0 #14 0x00007ff73ec10e83 in clone () at /lib64/libc.so.6 Thread 1 (Thread 0x7ff743986f00 (LWP 1062500)): #0 0x00005567a13b99d6 in iov_memset (iov=3D0x6563617073206f4e, iov_cnt=3D1717922848, offset=3D516096, fill= c=3D0, bytes=3D7018105756081554803) at util/iov.c:69 #1 0x00005567a13bab73 in qemu_iovec_memset (qiov=3D0x7ff73ec99748, offset=3D516096, fillc=3D0, bytes=3D7018105756= 081554803) at util/iov.c:530 #2 0x00005567a12f411c in qemu_laio_process_completion (laiocb=3D0x7ff6512= ee6c0) at block/linux-aio.c:86 #3 0x00005567a12f42ff in qemu_laio_process_completions (s=3D0x7ff7182e842= 0) at block/linux-aio.c:217 #4 0x00005567a12f480d in ioq_submit (s=3D0x7ff7182e8420) at block/linux-a= io.c:323 #5 0x00005567a12f4a2f in laio_do_submit (fd=3D19, laiocb=3D0x7ff5f4ff9ae0= , offset=3D472363008, type=3D2) at block/linux-aio.c:375 #6 0x00005567a12f4af2 in laio_co_submit (bs=3D0x5567a2b8c460, s=3D0x7ff7182e8420, fd=3D19, offset=3D472363008,= qiov=3D0x7ff5f4ff9ca0, type=3D2) at block/linux-aio.c:394 #7 0x00005567a12f1803 in raw_co_prw (bs=3D0x5567a2b8c460, offset=3D472363008, bytes=3D20480, qiov=3D0x7ff5= f4ff9ca0, type=3D2) at block/file-posix.c:1892 #8 0x00005567a12f1941 in raw_co_pwritev (bs=3D0x5567a2b8c460, offset=3D472363008, bytes=3D20480, qiov=3D0x7ff5= f4ff9ca0, flags=3D0) at block/file-posix.c:1925 #9 0x00005567a12fe3e1 in bdrv_driver_pwritev (bs=3D0x5567a2b8c460, offset=3D472363008, bytes=3D20480, qiov=3D0x7ff5= f4ff9ca0, qiov_offset=3D0, flags=3D0) at block/io.c:1183 #10 0x00005567a1300340 in bdrv_aligned_pwritev (child=3D0x5567a2b5b070, req=3D0x7ff5f4ff9db0, offset=3D472363008, byt= es=3D20480, align=3D512, qiov=3D0x7ff72c0425b8, qiov_offset=3D0, flags=3D0)= at block/io.c:1980 #11 0x00005567a1300b29 in bdrv_co_pwritev_part (child=3D0x5567a2b5b070, offset=3D472363008, bytes=3D20480, qiov=3D0x7= ff72c0425b8, qiov_offset=3D0, flags=3D0) at block/io.c:2137 #12 0x00005567a12baba1 in qcow2_co_pwritev_task (bs=3D0x5567a2b92740, file_cluster_offset=3D472317952, offset=3D487305= 216, bytes=3D20480, qiov=3D0x7ff72c0425b8, qiov_offset=3D0, l2meta=3D0x0) a= t block/qcow2.c:2444 #13 0x00005567a12bacdb in qcow2_co_pwritev_task_entry (task=3D0x5567a2b485= 40) at block/qcow2.c:2475 #14 0x00005567a13167d8 in aio_task_co (opaque=3D0x5567a2b48540) at block/a= io_task.c:45 #15 0x00005567a13cf00c in coroutine_trampoline (i0=3D738245600, i1=3D32759= ) at util/coroutine-ucontext.c:115 #16 0x00007ff73eb622e0 in __start_context () at /lib64/libc.so.6 #17 0x00007ff6626f1350 in () #18 0x0000000000000000 in () <------> This is also known to cause crashes with this message (assertion failed): aio_co_schedule: Co-routine was already scheduled in 'aio_co_schedule' RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=3D1812765 Signed-off-by: Sergio Lopez Message-Id: <20200603093240.40489-3-slp@redhat.com> Signed-off-by: Kevin Wolf --- include/hw/virtio/virtio-blk.h | 2 +- hw/block/dataplane/virtio-blk.c | 8 ++++++++ hw/block/virtio-blk.c | 18 ++++++++++++------ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index f584ad9b86..b1334c3904 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -86,6 +86,6 @@ typedef struct MultiReqBuffer { } MultiReqBuffer; =20 bool virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq); -void virtio_blk_process_queued_requests(VirtIOBlock *s); +void virtio_blk_process_queued_requests(VirtIOBlock *s, bool is_bh); =20 #endif diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-bl= k.c index 1b52e8159c..37499c5564 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -220,6 +220,9 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) goto fail_guest_notifiers; } =20 + /* Process queued requests before the ones in vring */ + virtio_blk_process_queued_requests(vblk, false); + /* Kick right away to begin processing requests already in vring */ for (i =3D 0; i < nvqs; i++) { VirtQueue *vq =3D virtio_get_queue(s->vdev, i); @@ -239,6 +242,11 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) return 0; =20 fail_guest_notifiers: + /* + * If we failed to set up the guest notifiers queued requests will be + * processed on the main context. + */ + virtio_blk_process_queued_requests(vblk, false); vblk->dataplane_disabled =3D true; s->starting =3D false; vblk->dataplane_started =3D true; diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 978574e4da..8882a1d1d4 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -819,7 +819,7 @@ static void virtio_blk_handle_output(VirtIODevice *vdev= , VirtQueue *vq) virtio_blk_handle_output_do(s, vq); } =20 -void virtio_blk_process_queued_requests(VirtIOBlock *s) +void virtio_blk_process_queued_requests(VirtIOBlock *s, bool is_bh) { VirtIOBlockReq *req =3D s->rq; MultiReqBuffer mrb =3D {}; @@ -847,7 +847,9 @@ void virtio_blk_process_queued_requests(VirtIOBlock *s) if (mrb.num_reqs) { virtio_blk_submit_multireq(s->blk, &mrb); } - blk_dec_in_flight(s->conf.conf.blk); + if (is_bh) { + blk_dec_in_flight(s->conf.conf.blk); + } aio_context_release(blk_get_aio_context(s->conf.conf.blk)); } =20 @@ -858,21 +860,25 @@ static void virtio_blk_dma_restart_bh(void *opaque) qemu_bh_delete(s->bh); s->bh =3D NULL; =20 - virtio_blk_process_queued_requests(s); + virtio_blk_process_queued_requests(s, true); } =20 static void virtio_blk_dma_restart_cb(void *opaque, int running, RunState state) { VirtIOBlock *s =3D opaque; + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(s))); + VirtioBusState *bus =3D VIRTIO_BUS(qbus); =20 if (!running) { return; } =20 - if (!s->bh) { - /* FIXME The data plane is not started yet, so these requests are - * processed in the main thread. */ + /* + * If ioeventfd is enabled, don't schedule the BH here as queued + * requests will be processed while starting the data plane. + */ + if (!s->bh && !virtio_bus_ioeventfd_enabled(bus)) { s->bh =3D aio_bh_new(blk_get_aio_context(s->conf.conf.blk), virtio_blk_dma_restart_bh, s); blk_inc_in_flight(s->conf.conf.blk); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405714; cv=none; d=zohomail.com; s=zohoarc; b=i/ByNNyHH4GQHw0aMZJzT2Brj/qa+bamqNrd4XResIZwD/pj6W9VCcmgQ+EQ+/xZgNedY9A8la2A3ryqvcp58Bpst7Mplvjb2WaOvPvbjgxXC5d/5R6jxzgZta3+TQgBmGC5ehK0B5D/1qZ+aXXuna+6lUgdwslDXVqiBdWFJfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405714; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sqJdrth38nvygdcTzodKR39xUdQaBYTwoxQvC0MCKFk=; b=d7UdYWFowfZP5c/6TZnuE0nZHZHxTjfY9lrVEstUKKE6uGZx9MlA2g+H9GP2PmuTAqyyebiQQsw7ReqBGLe1uKJjg8A1YH0/RM/96pQulQtUly7sF5Ocw9s3KhRtR33YiFQQ5W9hrMTBrqpp0nP2n22IkXyaNmL+ux7bYxftaZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159240571498097.08243567937336; Wed, 17 Jun 2020 07:55:14 -0700 (PDT) Received: from localhost ([::1]:40536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZT7-0006AE-Im for importer@patchew.org; Wed, 17 Jun 2020 10:55:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNd-0002rW-6S for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:33 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:52309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNW-0001eZ-Ne for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-16-NmsVLae4NsC2FElFn0PKQg-1; Wed, 17 Jun 2020 10:49:21 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 125BC835BB8; Wed, 17 Jun 2020 14:49:20 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13BEF7CAA0; Wed, 17 Jun 2020 14:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sqJdrth38nvygdcTzodKR39xUdQaBYTwoxQvC0MCKFk=; b=N3zK+G0ye13ErAnxgchY6Tj1mYK6WgCTjsqB6ZlIqiWyFq+zR2zbotOFQx4bNP3W8foHrX MJIxqhqTM4HZQRQmR3dKk7F1eeBltvj6Gn4lFFyHXJUREMlJdQ7IavNQqmYU/PJBOcSYuL VIGkvCqbfZHHLHQvEujy3mLwfM1IjlM= X-MC-Unique: NmsVLae4NsC2FElFn0PKQg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 05/43] block: Refactor subdirectory recursion during make Date: Wed, 17 Jun 2020 16:48:31 +0200 Message-Id: <20200617144909.192176-6-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Eric Blake Rather than listing block/monitor from the top-level Makefile.objs, we should instead list monitor from block/Makefile.objs. Suggested-by: Kevin Wolf Fixes: bb4e58c613 Signed-off-by: Eric Blake Message-Id: <20200608173339.3244211-1-eblake@redhat.com> Signed-off-by: Kevin Wolf --- Makefile.objs | 2 +- block/Makefile.objs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.objs b/Makefile.objs index c09d95dfe3..7ce2588b89 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -13,7 +13,7 @@ chardev-obj-y =3D chardev/ =20 authz-obj-y =3D authz/ =20 -block-obj-y =3D block/ block/monitor/ nbd/ scsi/ +block-obj-y =3D block/ nbd/ scsi/ block-obj-y +=3D block.o blockjob.o job.o block-obj-y +=3D qemu-io-cmds.o block-obj-$(CONFIG_REPLICATION) +=3D replication.o diff --git a/block/Makefile.objs b/block/Makefile.objs index 3635b6b4c1..96028eedce 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -46,6 +46,7 @@ block-obj-y +=3D aio_task.o block-obj-y +=3D backup-top.o block-obj-y +=3D filter-compress.o common-obj-y +=3D monitor/ +block-obj-y +=3D monitor/ =20 block-obj-y +=3D stream.o =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405592; cv=none; d=zohomail.com; s=zohoarc; b=UL9d1qn4d5kRs0lNJcWFTvKr99NWh0B0m22xUQj2211M/hQiYaG8RpXeD6aEB9AI9q/1US1nS7qEs5xCbjpDFehBfYkFEbPKQKmnUAdDHPtOinnvmpxkJvZaDck9ViHmJu0U2wgr+Ok+hvXTQB8PVgE/9bp0jtwXiaD/lVkQZJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405592; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QhoWVbBUNVB2GtqglvNwOvve4cTH8w1dCPMuKWAeIgw=; b=IW60t8v04QouIycvDKCaQSvBZWrbF7x0TnUspyz3JAvvYWfrjKRnVyRTTOgLyILc5fyijPpsUK6pUxp+K87RNv6FTARq3paKpM0hluwliThFWGIC6rysIhan7gBsvllB8ikcgVunihBxdkzkwpAIdAKHWGzoYYFPYfnqOT5M9pE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405592542986.0313554508175; Wed, 17 Jun 2020 07:53:12 -0700 (PDT) Received: from localhost ([::1]:59812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZR9-00013X-2y for importer@patchew.org; Wed, 17 Jun 2020 10:53:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNd-0002rL-50 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:33 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:43431 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNY-0001eg-8E for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-346-B2KuTUGxNGKdhu8BIME0kw-1; Wed, 17 Jun 2020 10:49:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F028108BCA1; Wed, 17 Jun 2020 14:49:21 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 639707CAA0; Wed, 17 Jun 2020 14:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QhoWVbBUNVB2GtqglvNwOvve4cTH8w1dCPMuKWAeIgw=; b=Ibjs60MSU3k9Tdbo2prHeFk5tcY16iLpxF94sAPwbxyOSpCZ9tSsaOL8ARw+w0XHJJpSMx kksgd0HTpaL/JcnPGvK53RP6ZiZyNsqFJKxw5ODpuFscn5ETbFxWcnZmSu/dIB7mBn4MW7 /kN29NlpGLDzupWvUxEptSaiuYGVDcU= X-MC-Unique: B2KuTUGxNGKdhu8BIME0kw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 06/43] qcow2: Tweak comments on qcow2_get_persistent_dirty_bitmap_size Date: Wed, 17 Jun 2020 16:48:32 +0200 Message-Id: <20200617144909.192176-7-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Eric Blake For now, we don't have persistent bitmaps in any other formats, but that might not be true in the future. Make it obvious that our incoming parameter is not necessarily a qcow2 image, and therefore is limited to just the bdrv_dirty_bitmap_* API calls (rather than probing into qcow2 internals). Suggested-by: Kevin Wolf Signed-off-by: Eric Blake Message-Id: <20200608190821.3293867-1-eblake@redhat.com> Signed-off-by: Kevin Wolf --- block/qcow2-bitmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index 7bf12502da..1f38806ca6 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -1757,19 +1757,20 @@ bool qcow2_supports_persistent_dirty_bitmap(BlockDr= iverState *bs) } =20 /* - * Compute the space required for bitmaps in @bs. + * Compute the space required to copy bitmaps from @in_bs. * * The computation is based as if copying to a new image with the - * given @cluster_size, which may differ from the cluster size in @bs. + * given @cluster_size, which may differ from the cluster size in + * @in_bs; in fact, @in_bs might be something other than qcow2. */ -uint64_t qcow2_get_persistent_dirty_bitmap_size(BlockDriverState *bs, +uint64_t qcow2_get_persistent_dirty_bitmap_size(BlockDriverState *in_bs, uint32_t cluster_size) { uint64_t bitmaps_size =3D 0; BdrvDirtyBitmap *bm; size_t bitmap_dir_size =3D 0; =20 - FOR_EACH_DIRTY_BITMAP(bs, bm) { + FOR_EACH_DIRTY_BITMAP(in_bs, bm) { if (bdrv_dirty_bitmap_get_persistence(bm)) { const char *name =3D bdrv_dirty_bitmap_name(bm); uint32_t granularity =3D bdrv_dirty_bitmap_granularity(bm); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405751; cv=none; d=zohomail.com; s=zohoarc; b=C5RsHwd0EeJ1Beie4zjrnrXaXLvgisB4d9F7FY5x+wp93lK1FZ5ox9nCeQK5Ww4FzXz/m57IfzLNyuaMAdNTGad05h7nSLed3PNxkBjtCVzRgM+yOmFSpSNcIySgpYtxAliOuwPg3WWUDTVXlMVdsLLCaxMtujvx0bYh256PLnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405751; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OeTAIUXbQvCLy+gN9jiiCS7VpxqfG8BurMGuBOXIqZU=; b=Y7G75H/qOKsPPGgU++DXK7x2CWyrTWhRyQyb6CPwubty7/az+CWVbvu+JKH2XKNO8GPW0/cHi8gEEGJBt+mGcvv4nkegpiDDIxHRYu/t0qL4SZsCQH1AUth3amOfFDKWYDH1Lf8HY0D84I0LM6hG/IM/Ksdqoa+3l1cJEg+F4Sg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405751987346.6808725537686; Wed, 17 Jun 2020 07:55:51 -0700 (PDT) Received: from localhost ([::1]:42916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZTi-0007Su-JR for importer@patchew.org; Wed, 17 Jun 2020 10:55:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNf-0002xl-TG for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:35 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:55600 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNc-0001fa-ME for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:35 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-E_4Cr9f_Pcm04_a92G2SKg-1; Wed, 17 Jun 2020 10:49:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A86FB80332A; Wed, 17 Jun 2020 14:49:22 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id A97E57CAAA; Wed, 17 Jun 2020 14:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405370; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OeTAIUXbQvCLy+gN9jiiCS7VpxqfG8BurMGuBOXIqZU=; b=aw4sQfjTGEeHtEM51wig4elHV7ytktSYPao+13GwC9+CXdIHmrZbM6M/D2TEL8qaoLroq/ 1T0AJnf1gxpWETPcXvWr0G42aT4aJdXNiPBJdcQPFTudLim21OzyD17Ea1TZUapaoKuwfv NFx1GvFrjj3oEzL9Q9/3duqAOM90+uI= X-MC-Unique: E_4Cr9f_Pcm04_a92G2SKg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 07/43] hw/block/nvme: fix pci doorbell size calculation Date: Wed, 17 Jun 2020 16:48:33 +0200 Message-Id: <20200617144909.192176-8-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen The size of the BAR is 0x1000 (main registers) + 8 bytes for each queue. Currently, the size of the BAR is calculated like so: n->reg_size =3D pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); Since the 'num_queues' parameter already accounts for the admin queue, this should in any case not need to be incremented by one. Also, the size should be initialized to (0x1000). n->reg_size =3D pow2ceil(0x1000 + 2 * n->num_queues * 4); This, with the default value of num_queues (64), we will set aside room for 1 admin queue and 63 I/O queues (4 bytes per doorbell, 2 doorbells per queue). Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-2-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index a21eeca2fb..c1476e8b2a 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -53,6 +53,9 @@ #include "trace.h" #include "nvme.h" =20 +#define NVME_REG_SIZE 0x1000 +#define NVME_DB_SIZE 4 + #define NVME_GUEST_ERR(trace, fmt, ...) \ do { \ (trace_##trace)(__VA_ARGS__); \ @@ -1401,7 +1404,9 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) pcie_endpoint_cap_init(pci_dev, 0x80); =20 n->num_namespaces =3D 1; - n->reg_size =3D pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); + + /* num_queues is really number of pairs, so each has two doorbells */ + n->reg_size =3D pow2ceil(NVME_REG_SIZE + 2 * n->num_queues * NVME_DB_S= IZE); n->ns_size =3D bs_size / (uint64_t)n->num_namespaces; =20 n->namespaces =3D g_new0(NvmeNamespace, n->num_namespaces); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407165; cv=none; d=zohomail.com; s=zohoarc; b=SW+vaaxeX4AkHBBxrIk2Qqr55L73IIhChhLbKg0mFbaXEkk6sbttGSWc1OWs8ax0WOJl2h0TO+wBO5OZOCcnsX+FxBVXnf2fEgR4DmA8rZd25CPakq/Wn2UJZlypom7otpvU5cr/KbrJYlvQuBcK58rLRxN7VRudykP1z959tNQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407165; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=quAKcevXrOdeRdlRslNyScOgSNAd4WCPDXKR+lhw7r8=; b=TJvYZMU6ag+56x16x+WxgvcUsOpasA9tJVweCLlZKoAOgc+6malWFKMcF3dzGSSEPuP3QaG5omjoYeBOq6xS3gS0SUnmZ93qGCWIHUKld80zjAp4CxazNxqt9S3uCLq/7ZFFjLehvCyptW1LvEE/8tA2zQqwpASELt1C0SkJBs8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407165826593.7802539446719; Wed, 17 Jun 2020 08:19:25 -0700 (PDT) Received: from localhost ([::1]:39476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZZx-00025L-F4 for importer@patchew.org; Wed, 17 Jun 2020 11:02:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45248) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNl-00032N-O0 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:42 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34723 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNg-0001hY-5O for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-494-JDpfJagANxubn9R9SBtILg-1; Wed, 17 Jun 2020 10:49:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BCA2835B77; Wed, 17 Jun 2020 14:49:24 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 021707CAAA; Wed, 17 Jun 2020 14:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405375; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=quAKcevXrOdeRdlRslNyScOgSNAd4WCPDXKR+lhw7r8=; b=aYoxlqq9ucxzmBXQzvsRjG43K9iHE1lFWaIxbfbZhM0/XvkDyDzHucoS+Iur8C1Puhqq6l iC7vCaBPHiU1IBdx2sMtlHbxGm6QGJyC0QZIsVu+gFabMlQkbvNxJCvZSI5Gm2Q3zi1chD nsuDBdqXydQJDNe2PcqrGuwl1YGawB0= X-MC-Unique: JDpfJagANxubn9R9SBtILg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 08/43] hw/block/nvme: rename trace events to pci_nvme Date: Wed, 17 Jun 2020 16:48:34 +0200 Message-Id: <20200617144909.192176-9-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Change the prefix of all nvme device related trace events to 'pci_nvme' to not clash with trace events from the nvme block driver. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-3-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 198 +++++++++++++++++++++--------------------- hw/block/trace-events | 180 +++++++++++++++++++------------------- 2 files changed, 188 insertions(+), 190 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index c1476e8b2a..e8f5c5ab82 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -125,16 +125,16 @@ static void nvme_irq_assert(NvmeCtrl *n, NvmeCQueue *= cq) { if (cq->irq_enabled) { if (msix_enabled(&(n->parent_obj))) { - trace_nvme_irq_msix(cq->vector); + trace_pci_nvme_irq_msix(cq->vector); msix_notify(&(n->parent_obj), cq->vector); } else { - trace_nvme_irq_pin(); + trace_pci_nvme_irq_pin(); assert(cq->cqid < 64); n->irq_status |=3D 1 << cq->cqid; nvme_irq_check(n); } } else { - trace_nvme_irq_masked(); + trace_pci_nvme_irq_masked(); } } =20 @@ -159,7 +159,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVec= tor *iov, uint64_t prp1, int num_prps =3D (len >> n->page_bits) + 1; =20 if (unlikely(!prp1)) { - trace_nvme_err_invalid_prp(); + trace_pci_nvme_err_invalid_prp(); return NVME_INVALID_FIELD | NVME_DNR; } else if (n->cmbsz && prp1 >=3D n->ctrl_mem.addr && prp1 < n->ctrl_mem.addr + int128_get64(n->ctrl_mem.size)) { @@ -173,7 +173,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVec= tor *iov, uint64_t prp1, len -=3D trans_len; if (len) { if (unlikely(!prp2)) { - trace_nvme_err_invalid_prp2_missing(); + trace_pci_nvme_err_invalid_prp2_missing(); goto unmap; } if (len > n->page_size) { @@ -189,7 +189,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVec= tor *iov, uint64_t prp1, =20 if (i =3D=3D n->max_prp_ents - 1 && len > n->page_size) { if (unlikely(!prp_ent || prp_ent & (n->page_size - 1))= ) { - trace_nvme_err_invalid_prplist_ent(prp_ent); + trace_pci_nvme_err_invalid_prplist_ent(prp_ent); goto unmap; } =20 @@ -202,7 +202,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVec= tor *iov, uint64_t prp1, } =20 if (unlikely(!prp_ent || prp_ent & (n->page_size - 1))) { - trace_nvme_err_invalid_prplist_ent(prp_ent); + trace_pci_nvme_err_invalid_prplist_ent(prp_ent); goto unmap; } =20 @@ -217,7 +217,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVec= tor *iov, uint64_t prp1, } } else { if (unlikely(prp2 & (n->page_size - 1))) { - trace_nvme_err_invalid_prp2_align(prp2); + trace_pci_nvme_err_invalid_prp2_align(prp2); goto unmap; } if (qsg->nsg) { @@ -265,20 +265,20 @@ static uint16_t nvme_dma_read_prp(NvmeCtrl *n, uint8_= t *ptr, uint32_t len, QEMUIOVector iov; uint16_t status =3D NVME_SUCCESS; =20 - trace_nvme_dma_read(prp1, prp2); + trace_pci_nvme_dma_read(prp1, prp2); =20 if (nvme_map_prp(&qsg, &iov, prp1, prp2, len, n)) { return NVME_INVALID_FIELD | NVME_DNR; } if (qsg.nsg > 0) { if (unlikely(dma_buf_read(ptr, len, &qsg))) { - trace_nvme_err_invalid_dma(); + trace_pci_nvme_err_invalid_dma(); status =3D NVME_INVALID_FIELD | NVME_DNR; } qemu_sglist_destroy(&qsg); } else { if (unlikely(qemu_iovec_from_buf(&iov, 0, ptr, len) !=3D len)) { - trace_nvme_err_invalid_dma(); + trace_pci_nvme_err_invalid_dma(); status =3D NVME_INVALID_FIELD | NVME_DNR; } qemu_iovec_destroy(&iov); @@ -367,7 +367,7 @@ static uint16_t nvme_write_zeros(NvmeCtrl *n, NvmeNames= pace *ns, NvmeCmd *cmd, uint32_t count =3D nlb << data_shift; =20 if (unlikely(slba + nlb > ns->id_ns.nsze)) { - trace_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze); + trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze); return NVME_LBA_RANGE | NVME_DNR; } =20 @@ -395,11 +395,11 @@ static uint16_t nvme_rw(NvmeCtrl *n, NvmeNamespace *n= s, NvmeCmd *cmd, int is_write =3D rw->opcode =3D=3D NVME_CMD_WRITE ? 1 : 0; enum BlockAcctType acct =3D is_write ? BLOCK_ACCT_WRITE : BLOCK_ACCT_R= EAD; =20 - trace_nvme_rw(is_write ? "write" : "read", nlb, data_size, slba); + trace_pci_nvme_rw(is_write ? "write" : "read", nlb, data_size, slba); =20 if (unlikely((slba + nlb) > ns->id_ns.nsze)) { block_acct_invalid(blk_get_stats(n->conf.blk), acct); - trace_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze); + trace_pci_nvme_err_invalid_lba_range(slba, nlb, ns->id_ns.nsze); return NVME_LBA_RANGE | NVME_DNR; } =20 @@ -434,7 +434,7 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeCmd *cmd, = NvmeRequest *req) uint32_t nsid =3D le32_to_cpu(cmd->nsid); =20 if (unlikely(nsid =3D=3D 0 || nsid > n->num_namespaces)) { - trace_nvme_err_invalid_ns(nsid, n->num_namespaces); + trace_pci_nvme_err_invalid_ns(nsid, n->num_namespaces); return NVME_INVALID_NSID | NVME_DNR; } =20 @@ -448,7 +448,7 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeCmd *cmd, = NvmeRequest *req) case NVME_CMD_READ: return nvme_rw(n, ns, cmd, req); default: - trace_nvme_err_invalid_opc(cmd->opcode); + trace_pci_nvme_err_invalid_opc(cmd->opcode); return NVME_INVALID_OPCODE | NVME_DNR; } } @@ -473,11 +473,11 @@ static uint16_t nvme_del_sq(NvmeCtrl *n, NvmeCmd *cmd) uint16_t qid =3D le16_to_cpu(c->qid); =20 if (unlikely(!qid || nvme_check_sqid(n, qid))) { - trace_nvme_err_invalid_del_sq(qid); + trace_pci_nvme_err_invalid_del_sq(qid); return NVME_INVALID_QID | NVME_DNR; } =20 - trace_nvme_del_sq(qid); + trace_pci_nvme_del_sq(qid); =20 sq =3D n->sq[qid]; while (!QTAILQ_EMPTY(&sq->out_req_list)) { @@ -541,26 +541,26 @@ static uint16_t nvme_create_sq(NvmeCtrl *n, NvmeCmd *= cmd) uint16_t qflags =3D le16_to_cpu(c->sq_flags); uint64_t prp1 =3D le64_to_cpu(c->prp1); =20 - trace_nvme_create_sq(prp1, sqid, cqid, qsize, qflags); + trace_pci_nvme_create_sq(prp1, sqid, cqid, qsize, qflags); =20 if (unlikely(!cqid || nvme_check_cqid(n, cqid))) { - trace_nvme_err_invalid_create_sq_cqid(cqid); + trace_pci_nvme_err_invalid_create_sq_cqid(cqid); return NVME_INVALID_CQID | NVME_DNR; } if (unlikely(!sqid || !nvme_check_sqid(n, sqid))) { - trace_nvme_err_invalid_create_sq_sqid(sqid); + trace_pci_nvme_err_invalid_create_sq_sqid(sqid); return NVME_INVALID_QID | NVME_DNR; } if (unlikely(!qsize || qsize > NVME_CAP_MQES(n->bar.cap))) { - trace_nvme_err_invalid_create_sq_size(qsize); + trace_pci_nvme_err_invalid_create_sq_size(qsize); return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR; } if (unlikely(!prp1 || prp1 & (n->page_size - 1))) { - trace_nvme_err_invalid_create_sq_addr(prp1); + trace_pci_nvme_err_invalid_create_sq_addr(prp1); return NVME_INVALID_FIELD | NVME_DNR; } if (unlikely(!(NVME_SQ_FLAGS_PC(qflags)))) { - trace_nvme_err_invalid_create_sq_qflags(NVME_SQ_FLAGS_PC(qflags)); + trace_pci_nvme_err_invalid_create_sq_qflags(NVME_SQ_FLAGS_PC(qflag= s)); return NVME_INVALID_FIELD | NVME_DNR; } sq =3D g_malloc0(sizeof(*sq)); @@ -586,17 +586,17 @@ static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeCmd *cmd) uint16_t qid =3D le16_to_cpu(c->qid); =20 if (unlikely(!qid || nvme_check_cqid(n, qid))) { - trace_nvme_err_invalid_del_cq_cqid(qid); + trace_pci_nvme_err_invalid_del_cq_cqid(qid); return NVME_INVALID_CQID | NVME_DNR; } =20 cq =3D n->cq[qid]; if (unlikely(!QTAILQ_EMPTY(&cq->sq_list))) { - trace_nvme_err_invalid_del_cq_notempty(qid); + trace_pci_nvme_err_invalid_del_cq_notempty(qid); return NVME_INVALID_QUEUE_DEL; } nvme_irq_deassert(n, cq); - trace_nvme_del_cq(qid); + trace_pci_nvme_del_cq(qid); nvme_free_cq(cq, n); return NVME_SUCCESS; } @@ -629,27 +629,27 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *= cmd) uint16_t qflags =3D le16_to_cpu(c->cq_flags); uint64_t prp1 =3D le64_to_cpu(c->prp1); =20 - trace_nvme_create_cq(prp1, cqid, vector, qsize, qflags, - NVME_CQ_FLAGS_IEN(qflags) !=3D 0); + trace_pci_nvme_create_cq(prp1, cqid, vector, qsize, qflags, + NVME_CQ_FLAGS_IEN(qflags) !=3D 0); =20 if (unlikely(!cqid || !nvme_check_cqid(n, cqid))) { - trace_nvme_err_invalid_create_cq_cqid(cqid); + trace_pci_nvme_err_invalid_create_cq_cqid(cqid); return NVME_INVALID_CQID | NVME_DNR; } if (unlikely(!qsize || qsize > NVME_CAP_MQES(n->bar.cap))) { - trace_nvme_err_invalid_create_cq_size(qsize); + trace_pci_nvme_err_invalid_create_cq_size(qsize); return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR; } if (unlikely(!prp1)) { - trace_nvme_err_invalid_create_cq_addr(prp1); + trace_pci_nvme_err_invalid_create_cq_addr(prp1); return NVME_INVALID_FIELD | NVME_DNR; } if (unlikely(vector > n->num_queues)) { - trace_nvme_err_invalid_create_cq_vector(vector); + trace_pci_nvme_err_invalid_create_cq_vector(vector); return NVME_INVALID_IRQ_VECTOR | NVME_DNR; } if (unlikely(!(NVME_CQ_FLAGS_PC(qflags)))) { - trace_nvme_err_invalid_create_cq_qflags(NVME_CQ_FLAGS_PC(qflags)); + trace_pci_nvme_err_invalid_create_cq_qflags(NVME_CQ_FLAGS_PC(qflag= s)); return NVME_INVALID_FIELD | NVME_DNR; } =20 @@ -664,7 +664,7 @@ static uint16_t nvme_identify_ctrl(NvmeCtrl *n, NvmeIde= ntify *c) uint64_t prp1 =3D le64_to_cpu(c->prp1); uint64_t prp2 =3D le64_to_cpu(c->prp2); =20 - trace_nvme_identify_ctrl(); + trace_pci_nvme_identify_ctrl(); =20 return nvme_dma_read_prp(n, (uint8_t *)&n->id_ctrl, sizeof(n->id_ctrl), prp1, prp2); @@ -677,10 +677,10 @@ static uint16_t nvme_identify_ns(NvmeCtrl *n, NvmeIde= ntify *c) uint64_t prp1 =3D le64_to_cpu(c->prp1); uint64_t prp2 =3D le64_to_cpu(c->prp2); =20 - trace_nvme_identify_ns(nsid); + trace_pci_nvme_identify_ns(nsid); =20 if (unlikely(nsid =3D=3D 0 || nsid > n->num_namespaces)) { - trace_nvme_err_invalid_ns(nsid, n->num_namespaces); + trace_pci_nvme_err_invalid_ns(nsid, n->num_namespaces); return NVME_INVALID_NSID | NVME_DNR; } =20 @@ -700,7 +700,7 @@ static uint16_t nvme_identify_nslist(NvmeCtrl *n, NvmeI= dentify *c) uint16_t ret; int i, j =3D 0; =20 - trace_nvme_identify_nslist(min_nsid); + trace_pci_nvme_identify_nslist(min_nsid); =20 list =3D g_malloc0(data_len); for (i =3D 0; i < n->num_namespaces; i++) { @@ -729,14 +729,14 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeCmd *c= md) case 0x02: return nvme_identify_nslist(n, c); default: - trace_nvme_err_invalid_identify_cns(le32_to_cpu(c->cns)); + trace_pci_nvme_err_invalid_identify_cns(le32_to_cpu(c->cns)); return NVME_INVALID_FIELD | NVME_DNR; } } =20 static inline void nvme_set_timestamp(NvmeCtrl *n, uint64_t ts) { - trace_nvme_setfeat_timestamp(ts); + trace_pci_nvme_setfeat_timestamp(ts); =20 n->host_timestamp =3D le64_to_cpu(ts); n->timestamp_set_qemu_clock_ms =3D qemu_clock_get_ms(QEMU_CLOCK_VIRTUA= L); @@ -769,7 +769,7 @@ static inline uint64_t nvme_get_timestamp(const NvmeCtr= l *n) /* If the host timestamp is non-zero, set the timestamp origin */ ts.origin =3D n->host_timestamp ? 0x01 : 0x00; =20 - trace_nvme_getfeat_timestamp(ts.all); + trace_pci_nvme_getfeat_timestamp(ts.all); =20 return cpu_to_le64(ts.all); } @@ -793,17 +793,17 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd= *cmd, NvmeRequest *req) switch (dw10) { case NVME_VOLATILE_WRITE_CACHE: result =3D blk_enable_write_cache(n->conf.blk); - trace_nvme_getfeat_vwcache(result ? "enabled" : "disabled"); + trace_pci_nvme_getfeat_vwcache(result ? "enabled" : "disabled"); break; case NVME_NUMBER_OF_QUEUES: result =3D cpu_to_le32((n->num_queues - 2) | ((n->num_queues - 2) = << 16)); - trace_nvme_getfeat_numq(result); + trace_pci_nvme_getfeat_numq(result); break; case NVME_TIMESTAMP: return nvme_get_feature_timestamp(n, cmd); break; default: - trace_nvme_err_invalid_getfeat(dw10); + trace_pci_nvme_err_invalid_getfeat(dw10); return NVME_INVALID_FIELD | NVME_DNR; } =20 @@ -839,9 +839,9 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *= cmd, NvmeRequest *req) blk_set_enable_write_cache(n->conf.blk, dw11 & 1); break; case NVME_NUMBER_OF_QUEUES: - trace_nvme_setfeat_numq((dw11 & 0xFFFF) + 1, - ((dw11 >> 16) & 0xFFFF) + 1, - n->num_queues - 1, n->num_queues - 1); + trace_pci_nvme_setfeat_numq((dw11 & 0xFFFF) + 1, + ((dw11 >> 16) & 0xFFFF) + 1, + n->num_queues - 1, n->num_queues - 1); req->cqe.result =3D cpu_to_le32((n->num_queues - 2) | ((n->num_queues - 2) << 16)); break; @@ -851,7 +851,7 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *= cmd, NvmeRequest *req) break; =20 default: - trace_nvme_err_invalid_setfeat(dw10); + trace_pci_nvme_err_invalid_setfeat(dw10); return NVME_INVALID_FIELD | NVME_DNR; } return NVME_SUCCESS; @@ -875,7 +875,7 @@ static uint16_t nvme_admin_cmd(NvmeCtrl *n, NvmeCmd *cm= d, NvmeRequest *req) case NVME_ADM_CMD_GET_FEATURES: return nvme_get_feature(n, cmd, req); default: - trace_nvme_err_invalid_admin_opc(cmd->opcode); + trace_pci_nvme_err_invalid_admin_opc(cmd->opcode); return NVME_INVALID_OPCODE | NVME_DNR; } } @@ -938,77 +938,77 @@ static int nvme_start_ctrl(NvmeCtrl *n) uint32_t page_size =3D 1 << page_bits; =20 if (unlikely(n->cq[0])) { - trace_nvme_err_startfail_cq(); + trace_pci_nvme_err_startfail_cq(); return -1; } if (unlikely(n->sq[0])) { - trace_nvme_err_startfail_sq(); + trace_pci_nvme_err_startfail_sq(); return -1; } if (unlikely(!n->bar.asq)) { - trace_nvme_err_startfail_nbarasq(); + trace_pci_nvme_err_startfail_nbarasq(); return -1; } if (unlikely(!n->bar.acq)) { - trace_nvme_err_startfail_nbaracq(); + trace_pci_nvme_err_startfail_nbaracq(); return -1; } if (unlikely(n->bar.asq & (page_size - 1))) { - trace_nvme_err_startfail_asq_misaligned(n->bar.asq); + trace_pci_nvme_err_startfail_asq_misaligned(n->bar.asq); return -1; } if (unlikely(n->bar.acq & (page_size - 1))) { - trace_nvme_err_startfail_acq_misaligned(n->bar.acq); + trace_pci_nvme_err_startfail_acq_misaligned(n->bar.acq); return -1; } if (unlikely(NVME_CC_MPS(n->bar.cc) < NVME_CAP_MPSMIN(n->bar.cap))) { - trace_nvme_err_startfail_page_too_small( + trace_pci_nvme_err_startfail_page_too_small( NVME_CC_MPS(n->bar.cc), NVME_CAP_MPSMIN(n->bar.cap)); return -1; } if (unlikely(NVME_CC_MPS(n->bar.cc) > NVME_CAP_MPSMAX(n->bar.cap))) { - trace_nvme_err_startfail_page_too_large( + trace_pci_nvme_err_startfail_page_too_large( NVME_CC_MPS(n->bar.cc), NVME_CAP_MPSMAX(n->bar.cap)); return -1; } if (unlikely(NVME_CC_IOCQES(n->bar.cc) < NVME_CTRL_CQES_MIN(n->id_ctrl.cqes))) { - trace_nvme_err_startfail_cqent_too_small( + trace_pci_nvme_err_startfail_cqent_too_small( NVME_CC_IOCQES(n->bar.cc), NVME_CTRL_CQES_MIN(n->bar.cap)); return -1; } if (unlikely(NVME_CC_IOCQES(n->bar.cc) > NVME_CTRL_CQES_MAX(n->id_ctrl.cqes))) { - trace_nvme_err_startfail_cqent_too_large( + trace_pci_nvme_err_startfail_cqent_too_large( NVME_CC_IOCQES(n->bar.cc), NVME_CTRL_CQES_MAX(n->bar.cap)); return -1; } if (unlikely(NVME_CC_IOSQES(n->bar.cc) < NVME_CTRL_SQES_MIN(n->id_ctrl.sqes))) { - trace_nvme_err_startfail_sqent_too_small( + trace_pci_nvme_err_startfail_sqent_too_small( NVME_CC_IOSQES(n->bar.cc), NVME_CTRL_SQES_MIN(n->bar.cap)); return -1; } if (unlikely(NVME_CC_IOSQES(n->bar.cc) > NVME_CTRL_SQES_MAX(n->id_ctrl.sqes))) { - trace_nvme_err_startfail_sqent_too_large( + trace_pci_nvme_err_startfail_sqent_too_large( NVME_CC_IOSQES(n->bar.cc), NVME_CTRL_SQES_MAX(n->bar.cap)); return -1; } if (unlikely(!NVME_AQA_ASQS(n->bar.aqa))) { - trace_nvme_err_startfail_asqent_sz_zero(); + trace_pci_nvme_err_startfail_asqent_sz_zero(); return -1; } if (unlikely(!NVME_AQA_ACQS(n->bar.aqa))) { - trace_nvme_err_startfail_acqent_sz_zero(); + trace_pci_nvme_err_startfail_acqent_sz_zero(); return -1; } =20 @@ -1031,14 +1031,14 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offs= et, uint64_t data, unsigned size) { if (unlikely(offset & (sizeof(uint32_t) - 1))) { - NVME_GUEST_ERR(nvme_ub_mmiowr_misaligned32, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_misaligned32, "MMIO write not 32-bit aligned," " offset=3D0x%"PRIx64"", offset); /* should be ignored, fall through for now */ } =20 if (unlikely(size < sizeof(uint32_t))) { - NVME_GUEST_ERR(nvme_ub_mmiowr_toosmall, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_toosmall, "MMIO write smaller than 32-bits," " offset=3D0x%"PRIx64", size=3D%u", offset, size); @@ -1048,32 +1048,30 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offs= et, uint64_t data, switch (offset) { case 0xc: /* INTMS */ if (unlikely(msix_enabled(&(n->parent_obj)))) { - NVME_GUEST_ERR(nvme_ub_mmiowr_intmask_with_msix, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_intmask_with_msix, "undefined access to interrupt mask set" " when MSI-X is enabled"); /* should be ignored, fall through for now */ } n->bar.intms |=3D data & 0xffffffff; n->bar.intmc =3D n->bar.intms; - trace_nvme_mmio_intm_set(data & 0xffffffff, - n->bar.intmc); + trace_pci_nvme_mmio_intm_set(data & 0xffffffff, n->bar.intmc); nvme_irq_check(n); break; case 0x10: /* INTMC */ if (unlikely(msix_enabled(&(n->parent_obj)))) { - NVME_GUEST_ERR(nvme_ub_mmiowr_intmask_with_msix, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_intmask_with_msix, "undefined access to interrupt mask clr" " when MSI-X is enabled"); /* should be ignored, fall through for now */ } n->bar.intms &=3D ~(data & 0xffffffff); n->bar.intmc =3D n->bar.intms; - trace_nvme_mmio_intm_clr(data & 0xffffffff, - n->bar.intmc); + trace_pci_nvme_mmio_intm_clr(data & 0xffffffff, n->bar.intmc); nvme_irq_check(n); break; case 0x14: /* CC */ - trace_nvme_mmio_cfg(data & 0xffffffff); + trace_pci_nvme_mmio_cfg(data & 0xffffffff); /* Windows first sends data, then sends enable bit */ if (!NVME_CC_EN(data) && !NVME_CC_EN(n->bar.cc) && !NVME_CC_SHN(data) && !NVME_CC_SHN(n->bar.cc)) @@ -1084,42 +1082,42 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offs= et, uint64_t data, if (NVME_CC_EN(data) && !NVME_CC_EN(n->bar.cc)) { n->bar.cc =3D data; if (unlikely(nvme_start_ctrl(n))) { - trace_nvme_err_startfail(); + trace_pci_nvme_err_startfail(); n->bar.csts =3D NVME_CSTS_FAILED; } else { - trace_nvme_mmio_start_success(); + trace_pci_nvme_mmio_start_success(); n->bar.csts =3D NVME_CSTS_READY; } } else if (!NVME_CC_EN(data) && NVME_CC_EN(n->bar.cc)) { - trace_nvme_mmio_stopped(); + trace_pci_nvme_mmio_stopped(); nvme_clear_ctrl(n); n->bar.csts &=3D ~NVME_CSTS_READY; } if (NVME_CC_SHN(data) && !(NVME_CC_SHN(n->bar.cc))) { - trace_nvme_mmio_shutdown_set(); + trace_pci_nvme_mmio_shutdown_set(); nvme_clear_ctrl(n); n->bar.cc =3D data; n->bar.csts |=3D NVME_CSTS_SHST_COMPLETE; } else if (!NVME_CC_SHN(data) && NVME_CC_SHN(n->bar.cc)) { - trace_nvme_mmio_shutdown_cleared(); + trace_pci_nvme_mmio_shutdown_cleared(); n->bar.csts &=3D ~NVME_CSTS_SHST_COMPLETE; n->bar.cc =3D data; } break; case 0x1C: /* CSTS */ if (data & (1 << 4)) { - NVME_GUEST_ERR(nvme_ub_mmiowr_ssreset_w1c_unsupported, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_ssreset_w1c_unsupported, "attempted to W1C CSTS.NSSRO" " but CAP.NSSRS is zero (not supported)"); } else if (data !=3D 0) { - NVME_GUEST_ERR(nvme_ub_mmiowr_ro_csts, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_ro_csts, "attempted to set a read only bit" " of controller status"); } break; case 0x20: /* NSSR */ if (data =3D=3D 0x4E564D65) { - trace_nvme_ub_mmiowr_ssreset_unsupported(); + trace_pci_nvme_ub_mmiowr_ssreset_unsupported(); } else { /* The spec says that writes of other values have no effect */ return; @@ -1127,55 +1125,55 @@ static void nvme_write_bar(NvmeCtrl *n, hwaddr offs= et, uint64_t data, break; case 0x24: /* AQA */ n->bar.aqa =3D data & 0xffffffff; - trace_nvme_mmio_aqattr(data & 0xffffffff); + trace_pci_nvme_mmio_aqattr(data & 0xffffffff); break; case 0x28: /* ASQ */ n->bar.asq =3D data; - trace_nvme_mmio_asqaddr(data); + trace_pci_nvme_mmio_asqaddr(data); break; case 0x2c: /* ASQ hi */ n->bar.asq |=3D data << 32; - trace_nvme_mmio_asqaddr_hi(data, n->bar.asq); + trace_pci_nvme_mmio_asqaddr_hi(data, n->bar.asq); break; case 0x30: /* ACQ */ - trace_nvme_mmio_acqaddr(data); + trace_pci_nvme_mmio_acqaddr(data); n->bar.acq =3D data; break; case 0x34: /* ACQ hi */ n->bar.acq |=3D data << 32; - trace_nvme_mmio_acqaddr_hi(data, n->bar.acq); + trace_pci_nvme_mmio_acqaddr_hi(data, n->bar.acq); break; case 0x38: /* CMBLOC */ - NVME_GUEST_ERR(nvme_ub_mmiowr_cmbloc_reserved, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_cmbloc_reserved, "invalid write to reserved CMBLOC" " when CMBSZ is zero, ignored"); return; case 0x3C: /* CMBSZ */ - NVME_GUEST_ERR(nvme_ub_mmiowr_cmbsz_readonly, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_cmbsz_readonly, "invalid write to read only CMBSZ, ignored"); return; case 0xE00: /* PMRCAP */ - NVME_GUEST_ERR(nvme_ub_mmiowr_pmrcap_readonly, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_pmrcap_readonly, "invalid write to PMRCAP register, ignored"); return; case 0xE04: /* TODO PMRCTL */ break; case 0xE08: /* PMRSTS */ - NVME_GUEST_ERR(nvme_ub_mmiowr_pmrsts_readonly, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_pmrsts_readonly, "invalid write to PMRSTS register, ignored"); return; case 0xE0C: /* PMREBS */ - NVME_GUEST_ERR(nvme_ub_mmiowr_pmrebs_readonly, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_pmrebs_readonly, "invalid write to PMREBS register, ignored"); return; case 0xE10: /* PMRSWTP */ - NVME_GUEST_ERR(nvme_ub_mmiowr_pmrswtp_readonly, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_pmrswtp_readonly, "invalid write to PMRSWTP register, ignored"); return; case 0xE14: /* TODO PMRMSC */ break; default: - NVME_GUEST_ERR(nvme_ub_mmiowr_invalid, + NVME_GUEST_ERR(pci_nvme_ub_mmiowr_invalid, "invalid MMIO write," " offset=3D0x%"PRIx64", data=3D%"PRIx64"", offset, data); @@ -1190,12 +1188,12 @@ static uint64_t nvme_mmio_read(void *opaque, hwaddr= addr, unsigned size) uint64_t val =3D 0; =20 if (unlikely(addr & (sizeof(uint32_t) - 1))) { - NVME_GUEST_ERR(nvme_ub_mmiord_misaligned32, + NVME_GUEST_ERR(pci_nvme_ub_mmiord_misaligned32, "MMIO read not 32-bit aligned," " offset=3D0x%"PRIx64"", addr); /* should RAZ, fall through for now */ } else if (unlikely(size < sizeof(uint32_t))) { - NVME_GUEST_ERR(nvme_ub_mmiord_toosmall, + NVME_GUEST_ERR(pci_nvme_ub_mmiord_toosmall, "MMIO read smaller than 32-bits," " offset=3D0x%"PRIx64"", addr); /* should RAZ, fall through for now */ @@ -1213,7 +1211,7 @@ static uint64_t nvme_mmio_read(void *opaque, hwaddr a= ddr, unsigned size) } memcpy(&val, ptr + addr, size); } else { - NVME_GUEST_ERR(nvme_ub_mmiord_invalid_ofs, + NVME_GUEST_ERR(pci_nvme_ub_mmiord_invalid_ofs, "MMIO read beyond last register," " offset=3D0x%"PRIx64", returning 0", addr); } @@ -1226,7 +1224,7 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr,= int val) uint32_t qid; =20 if (unlikely(addr & ((1 << 2) - 1))) { - NVME_GUEST_ERR(nvme_ub_db_wr_misaligned, + NVME_GUEST_ERR(pci_nvme_ub_db_wr_misaligned, "doorbell write not 32-bit aligned," " offset=3D0x%"PRIx64", ignoring", addr); return; @@ -1241,7 +1239,7 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr,= int val) =20 qid =3D (addr - (0x1000 + (1 << 2))) >> 3; if (unlikely(nvme_check_cqid(n, qid))) { - NVME_GUEST_ERR(nvme_ub_db_wr_invalid_cq, + NVME_GUEST_ERR(pci_nvme_ub_db_wr_invalid_cq, "completion queue doorbell write" " for nonexistent queue," " sqid=3D%"PRIu32", ignoring", qid); @@ -1250,7 +1248,7 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr,= int val) =20 cq =3D n->cq[qid]; if (unlikely(new_head >=3D cq->size)) { - NVME_GUEST_ERR(nvme_ub_db_wr_invalid_cqhead, + NVME_GUEST_ERR(pci_nvme_ub_db_wr_invalid_cqhead, "completion queue doorbell write value" " beyond queue size, sqid=3D%"PRIu32"," " new_head=3D%"PRIu16", ignoring", @@ -1279,7 +1277,7 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr,= int val) =20 qid =3D (addr - 0x1000) >> 3; if (unlikely(nvme_check_sqid(n, qid))) { - NVME_GUEST_ERR(nvme_ub_db_wr_invalid_sq, + NVME_GUEST_ERR(pci_nvme_ub_db_wr_invalid_sq, "submission queue doorbell write" " for nonexistent queue," " sqid=3D%"PRIu32", ignoring", qid); @@ -1288,7 +1286,7 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr,= int val) =20 sq =3D n->sq[qid]; if (unlikely(new_tail >=3D sq->size)) { - NVME_GUEST_ERR(nvme_ub_db_wr_invalid_sqtail, + NVME_GUEST_ERR(pci_nvme_ub_db_wr_invalid_sqtail, "submission queue doorbell write value" " beyond queue size, sqid=3D%"PRIu32"," " new_tail=3D%"PRIu16", ignoring", diff --git a/hw/block/trace-events b/hw/block/trace-events index aca54bda14..958fcc5508 100644 --- a/hw/block/trace-events +++ b/hw/block/trace-events @@ -29,100 +29,100 @@ hd_geometry_guess(void *blk, uint32_t cyls, uint32_t = heads, uint32_t secs, int t =20 # nvme.c # nvme traces for successful events -nvme_irq_msix(uint32_t vector) "raising MSI-X IRQ vector %u" -nvme_irq_pin(void) "pulsing IRQ pin" -nvme_irq_masked(void) "IRQ is masked" -nvme_dma_read(uint64_t prp1, uint64_t prp2) "DMA read, prp1=3D0x%"PRIx64" = prp2=3D0x%"PRIx64"" -nvme_rw(const char *verb, uint32_t blk_count, uint64_t byte_count, uint64_= t lba) "%s %"PRIu32" blocks (%"PRIu64" bytes) from LBA %"PRIu64"" -nvme_create_sq(uint64_t addr, uint16_t sqid, uint16_t cqid, uint16_t qsize= , uint16_t qflags) "create submission queue, addr=3D0x%"PRIx64", sqid=3D%"P= RIu16", cqid=3D%"PRIu16", qsize=3D%"PRIu16", qflags=3D%"PRIu16"" -nvme_create_cq(uint64_t addr, uint16_t cqid, uint16_t vector, uint16_t siz= e, uint16_t qflags, int ien) "create completion queue, addr=3D0x%"PRIx64", = cqid=3D%"PRIu16", vector=3D%"PRIu16", qsize=3D%"PRIu16", qflags=3D%"PRIu16"= , ien=3D%d" -nvme_del_sq(uint16_t qid) "deleting submission queue sqid=3D%"PRIu16"" -nvme_del_cq(uint16_t cqid) "deleted completion queue, cqid=3D%"PRIu16"" -nvme_identify_ctrl(void) "identify controller" -nvme_identify_ns(uint16_t ns) "identify namespace, nsid=3D%"PRIu16"" -nvme_identify_nslist(uint16_t ns) "identify namespace list, nsid=3D%"PRIu1= 6"" -nvme_getfeat_vwcache(const char* result) "get feature volatile write cache= , result=3D%s" -nvme_getfeat_numq(int result) "get feature number of queues, result=3D%d" -nvme_setfeat_numq(int reqcq, int reqsq, int gotcq, int gotsq) "requested c= q_count=3D%d sq_count=3D%d, responding with cq_count=3D%d sq_count=3D%d" -nvme_setfeat_timestamp(uint64_t ts) "set feature timestamp =3D 0x%"PRIx64"" -nvme_getfeat_timestamp(uint64_t ts) "get feature timestamp =3D 0x%"PRIx64"" -nvme_mmio_intm_set(uint64_t data, uint64_t new_mask) "wrote MMIO, interrup= t mask set, data=3D0x%"PRIx64", new_mask=3D0x%"PRIx64"" -nvme_mmio_intm_clr(uint64_t data, uint64_t new_mask) "wrote MMIO, interrup= t mask clr, data=3D0x%"PRIx64", new_mask=3D0x%"PRIx64"" -nvme_mmio_cfg(uint64_t data) "wrote MMIO, config controller config=3D0x%"P= RIx64"" -nvme_mmio_aqattr(uint64_t data) "wrote MMIO, admin queue attributes=3D0x%"= PRIx64"" -nvme_mmio_asqaddr(uint64_t data) "wrote MMIO, admin submission queue addre= ss=3D0x%"PRIx64"" -nvme_mmio_acqaddr(uint64_t data) "wrote MMIO, admin completion queue addre= ss=3D0x%"PRIx64"" -nvme_mmio_asqaddr_hi(uint64_t data, uint64_t new_addr) "wrote MMIO, admin = submission queue high half=3D0x%"PRIx64", new_address=3D0x%"PRIx64"" -nvme_mmio_acqaddr_hi(uint64_t data, uint64_t new_addr) "wrote MMIO, admin = completion queue high half=3D0x%"PRIx64", new_address=3D0x%"PRIx64"" -nvme_mmio_start_success(void) "setting controller enable bit succeeded" -nvme_mmio_stopped(void) "cleared controller enable bit" -nvme_mmio_shutdown_set(void) "shutdown bit set" -nvme_mmio_shutdown_cleared(void) "shutdown bit cleared" +pci_nvme_irq_msix(uint32_t vector) "raising MSI-X IRQ vector %u" +pci_nvme_irq_pin(void) "pulsing IRQ pin" +pci_nvme_irq_masked(void) "IRQ is masked" +pci_nvme_dma_read(uint64_t prp1, uint64_t prp2) "DMA read, prp1=3D0x%"PRIx= 64" prp2=3D0x%"PRIx64"" +pci_nvme_rw(const char *verb, uint32_t blk_count, uint64_t byte_count, uin= t64_t lba) "%s %"PRIu32" blocks (%"PRIu64" bytes) from LBA %"PRIu64"" +pci_nvme_create_sq(uint64_t addr, uint16_t sqid, uint16_t cqid, uint16_t q= size, uint16_t qflags) "create submission queue, addr=3D0x%"PRIx64", sqid= =3D%"PRIu16", cqid=3D%"PRIu16", qsize=3D%"PRIu16", qflags=3D%"PRIu16"" +pci_nvme_create_cq(uint64_t addr, uint16_t cqid, uint16_t vector, uint16_t= size, uint16_t qflags, int ien) "create completion queue, addr=3D0x%"PRIx6= 4", cqid=3D%"PRIu16", vector=3D%"PRIu16", qsize=3D%"PRIu16", qflags=3D%"PRI= u16", ien=3D%d" +pci_nvme_del_sq(uint16_t qid) "deleting submission queue sqid=3D%"PRIu16"" +pci_nvme_del_cq(uint16_t cqid) "deleted completion queue, cqid=3D%"PRIu16"" +pci_nvme_identify_ctrl(void) "identify controller" +pci_nvme_identify_ns(uint16_t ns) "identify namespace, nsid=3D%"PRIu16"" +pci_nvme_identify_nslist(uint16_t ns) "identify namespace list, nsid=3D%"P= RIu16"" +pci_nvme_getfeat_vwcache(const char* result) "get feature volatile write c= ache, result=3D%s" +pci_nvme_getfeat_numq(int result) "get feature number of queues, result=3D= %d" +pci_nvme_setfeat_numq(int reqcq, int reqsq, int gotcq, int gotsq) "request= ed cq_count=3D%d sq_count=3D%d, responding with cq_count=3D%d sq_count=3D%d" +pci_nvme_setfeat_timestamp(uint64_t ts) "set feature timestamp =3D 0x%"PRI= x64"" +pci_nvme_getfeat_timestamp(uint64_t ts) "get feature timestamp =3D 0x%"PRI= x64"" +pci_nvme_mmio_intm_set(uint64_t data, uint64_t new_mask) "wrote MMIO, inte= rrupt mask set, data=3D0x%"PRIx64", new_mask=3D0x%"PRIx64"" +pci_nvme_mmio_intm_clr(uint64_t data, uint64_t new_mask) "wrote MMIO, inte= rrupt mask clr, data=3D0x%"PRIx64", new_mask=3D0x%"PRIx64"" +pci_nvme_mmio_cfg(uint64_t data) "wrote MMIO, config controller config=3D0= x%"PRIx64"" +pci_nvme_mmio_aqattr(uint64_t data) "wrote MMIO, admin queue attributes=3D= 0x%"PRIx64"" +pci_nvme_mmio_asqaddr(uint64_t data) "wrote MMIO, admin submission queue a= ddress=3D0x%"PRIx64"" +pci_nvme_mmio_acqaddr(uint64_t data) "wrote MMIO, admin completion queue a= ddress=3D0x%"PRIx64"" +pci_nvme_mmio_asqaddr_hi(uint64_t data, uint64_t new_addr) "wrote MMIO, ad= min submission queue high half=3D0x%"PRIx64", new_address=3D0x%"PRIx64"" +pci_nvme_mmio_acqaddr_hi(uint64_t data, uint64_t new_addr) "wrote MMIO, ad= min completion queue high half=3D0x%"PRIx64", new_address=3D0x%"PRIx64"" +pci_nvme_mmio_start_success(void) "setting controller enable bit succeeded" +pci_nvme_mmio_stopped(void) "cleared controller enable bit" +pci_nvme_mmio_shutdown_set(void) "shutdown bit set" +pci_nvme_mmio_shutdown_cleared(void) "shutdown bit cleared" =20 # nvme traces for error conditions -nvme_err_invalid_dma(void) "PRP/SGL is too small for transfer size" -nvme_err_invalid_prplist_ent(uint64_t prplist) "PRP list entry is null or = not page aligned: 0x%"PRIx64"" -nvme_err_invalid_prp2_align(uint64_t prp2) "PRP2 is not page aligned: 0x%"= PRIx64"" -nvme_err_invalid_prp2_missing(void) "PRP2 is null and more data to be tran= sferred" -nvme_err_invalid_prp(void) "invalid PRP" -nvme_err_invalid_ns(uint32_t ns, uint32_t limit) "invalid namespace %u not= within 1-%u" -nvme_err_invalid_opc(uint8_t opc) "invalid opcode 0x%"PRIx8"" -nvme_err_invalid_admin_opc(uint8_t opc) "invalid admin opcode 0x%"PRIx8"" -nvme_err_invalid_lba_range(uint64_t start, uint64_t len, uint64_t limit) "= Invalid LBA start=3D%"PRIu64" len=3D%"PRIu64" limit=3D%"PRIu64"" -nvme_err_invalid_del_sq(uint16_t qid) "invalid submission queue deletion, = sid=3D%"PRIu16"" -nvme_err_invalid_create_sq_cqid(uint16_t cqid) "failed creating submission= queue, invalid cqid=3D%"PRIu16"" -nvme_err_invalid_create_sq_sqid(uint16_t sqid) "failed creating submission= queue, invalid sqid=3D%"PRIu16"" -nvme_err_invalid_create_sq_size(uint16_t qsize) "failed creating submissio= n queue, invalid qsize=3D%"PRIu16"" -nvme_err_invalid_create_sq_addr(uint64_t addr) "failed creating submission= queue, addr=3D0x%"PRIx64"" -nvme_err_invalid_create_sq_qflags(uint16_t qflags) "failed creating submis= sion queue, qflags=3D%"PRIu16"" -nvme_err_invalid_del_cq_cqid(uint16_t cqid) "failed deleting completion qu= eue, cqid=3D%"PRIu16"" -nvme_err_invalid_del_cq_notempty(uint16_t cqid) "failed deleting completio= n queue, it is not empty, cqid=3D%"PRIu16"" -nvme_err_invalid_create_cq_cqid(uint16_t cqid) "failed creating completion= queue, cqid=3D%"PRIu16"" -nvme_err_invalid_create_cq_size(uint16_t size) "failed creating completion= queue, size=3D%"PRIu16"" -nvme_err_invalid_create_cq_addr(uint64_t addr) "failed creating completion= queue, addr=3D0x%"PRIx64"" -nvme_err_invalid_create_cq_vector(uint16_t vector) "failed creating comple= tion queue, vector=3D%"PRIu16"" -nvme_err_invalid_create_cq_qflags(uint16_t qflags) "failed creating comple= tion queue, qflags=3D%"PRIu16"" -nvme_err_invalid_identify_cns(uint16_t cns) "identify, invalid cns=3D0x%"P= RIx16"" -nvme_err_invalid_getfeat(int dw10) "invalid get features, dw10=3D0x%"PRIx3= 2"" -nvme_err_invalid_setfeat(uint32_t dw10) "invalid set features, dw10=3D0x%"= PRIx32"" -nvme_err_startfail_cq(void) "nvme_start_ctrl failed because there are non-= admin completion queues" -nvme_err_startfail_sq(void) "nvme_start_ctrl failed because there are non-= admin submission queues" -nvme_err_startfail_nbarasq(void) "nvme_start_ctrl failed because the admin= submission queue address is null" -nvme_err_startfail_nbaracq(void) "nvme_start_ctrl failed because the admin= completion queue address is null" -nvme_err_startfail_asq_misaligned(uint64_t addr) "nvme_start_ctrl failed b= ecause the admin submission queue address is misaligned: 0x%"PRIx64"" -nvme_err_startfail_acq_misaligned(uint64_t addr) "nvme_start_ctrl failed b= ecause the admin completion queue address is misaligned: 0x%"PRIx64"" -nvme_err_startfail_page_too_small(uint8_t log2ps, uint8_t maxlog2ps) "nvme= _start_ctrl failed because the page size is too small: log2size=3D%u, min= =3D%u" -nvme_err_startfail_page_too_large(uint8_t log2ps, uint8_t maxlog2ps) "nvme= _start_ctrl failed because the page size is too large: log2size=3D%u, max= =3D%u" -nvme_err_startfail_cqent_too_small(uint8_t log2ps, uint8_t maxlog2ps) "nvm= e_start_ctrl failed because the completion queue entry size is too small: l= og2size=3D%u, min=3D%u" -nvme_err_startfail_cqent_too_large(uint8_t log2ps, uint8_t maxlog2ps) "nvm= e_start_ctrl failed because the completion queue entry size is too large: l= og2size=3D%u, max=3D%u" -nvme_err_startfail_sqent_too_small(uint8_t log2ps, uint8_t maxlog2ps) "nvm= e_start_ctrl failed because the submission queue entry size is too small: l= og2size=3D%u, min=3D%u" -nvme_err_startfail_sqent_too_large(uint8_t log2ps, uint8_t maxlog2ps) "nvm= e_start_ctrl failed because the submission queue entry size is too large: l= og2size=3D%u, max=3D%u" -nvme_err_startfail_asqent_sz_zero(void) "nvme_start_ctrl failed because th= e admin submission queue size is zero" -nvme_err_startfail_acqent_sz_zero(void) "nvme_start_ctrl failed because th= e admin completion queue size is zero" -nvme_err_startfail(void) "setting controller enable bit failed" +pci_nvme_err_invalid_dma(void) "PRP/SGL is too small for transfer size" +pci_nvme_err_invalid_prplist_ent(uint64_t prplist) "PRP list entry is null= or not page aligned: 0x%"PRIx64"" +pci_nvme_err_invalid_prp2_align(uint64_t prp2) "PRP2 is not page aligned: = 0x%"PRIx64"" +pci_nvme_err_invalid_prp2_missing(void) "PRP2 is null and more data to be = transferred" +pci_nvme_err_invalid_prp(void) "invalid PRP" +pci_nvme_err_invalid_ns(uint32_t ns, uint32_t limit) "invalid namespace %u= not within 1-%u" +pci_nvme_err_invalid_opc(uint8_t opc) "invalid opcode 0x%"PRIx8"" +pci_nvme_err_invalid_admin_opc(uint8_t opc) "invalid admin opcode 0x%"PRIx= 8"" +pci_nvme_err_invalid_lba_range(uint64_t start, uint64_t len, uint64_t limi= t) "Invalid LBA start=3D%"PRIu64" len=3D%"PRIu64" limit=3D%"PRIu64"" +pci_nvme_err_invalid_del_sq(uint16_t qid) "invalid submission queue deleti= on, sid=3D%"PRIu16"" +pci_nvme_err_invalid_create_sq_cqid(uint16_t cqid) "failed creating submis= sion queue, invalid cqid=3D%"PRIu16"" +pci_nvme_err_invalid_create_sq_sqid(uint16_t sqid) "failed creating submis= sion queue, invalid sqid=3D%"PRIu16"" +pci_nvme_err_invalid_create_sq_size(uint16_t qsize) "failed creating submi= ssion queue, invalid qsize=3D%"PRIu16"" +pci_nvme_err_invalid_create_sq_addr(uint64_t addr) "failed creating submis= sion queue, addr=3D0x%"PRIx64"" +pci_nvme_err_invalid_create_sq_qflags(uint16_t qflags) "failed creating su= bmission queue, qflags=3D%"PRIu16"" +pci_nvme_err_invalid_del_cq_cqid(uint16_t cqid) "failed deleting completio= n queue, cqid=3D%"PRIu16"" +pci_nvme_err_invalid_del_cq_notempty(uint16_t cqid) "failed deleting compl= etion queue, it is not empty, cqid=3D%"PRIu16"" +pci_nvme_err_invalid_create_cq_cqid(uint16_t cqid) "failed creating comple= tion queue, cqid=3D%"PRIu16"" +pci_nvme_err_invalid_create_cq_size(uint16_t size) "failed creating comple= tion queue, size=3D%"PRIu16"" +pci_nvme_err_invalid_create_cq_addr(uint64_t addr) "failed creating comple= tion queue, addr=3D0x%"PRIx64"" +pci_nvme_err_invalid_create_cq_vector(uint16_t vector) "failed creating co= mpletion queue, vector=3D%"PRIu16"" +pci_nvme_err_invalid_create_cq_qflags(uint16_t qflags) "failed creating co= mpletion queue, qflags=3D%"PRIu16"" +pci_nvme_err_invalid_identify_cns(uint16_t cns) "identify, invalid cns=3D0= x%"PRIx16"" +pci_nvme_err_invalid_getfeat(int dw10) "invalid get features, dw10=3D0x%"P= RIx32"" +pci_nvme_err_invalid_setfeat(uint32_t dw10) "invalid set features, dw10=3D= 0x%"PRIx32"" +pci_nvme_err_startfail_cq(void) "nvme_start_ctrl failed because there are = non-admin completion queues" +pci_nvme_err_startfail_sq(void) "nvme_start_ctrl failed because there are = non-admin submission queues" +pci_nvme_err_startfail_nbarasq(void) "nvme_start_ctrl failed because the a= dmin submission queue address is null" +pci_nvme_err_startfail_nbaracq(void) "nvme_start_ctrl failed because the a= dmin completion queue address is null" +pci_nvme_err_startfail_asq_misaligned(uint64_t addr) "nvme_start_ctrl fail= ed because the admin submission queue address is misaligned: 0x%"PRIx64"" +pci_nvme_err_startfail_acq_misaligned(uint64_t addr) "nvme_start_ctrl fail= ed because the admin completion queue address is misaligned: 0x%"PRIx64"" +pci_nvme_err_startfail_page_too_small(uint8_t log2ps, uint8_t maxlog2ps) "= nvme_start_ctrl failed because the page size is too small: log2size=3D%u, m= in=3D%u" +pci_nvme_err_startfail_page_too_large(uint8_t log2ps, uint8_t maxlog2ps) "= nvme_start_ctrl failed because the page size is too large: log2size=3D%u, m= ax=3D%u" +pci_nvme_err_startfail_cqent_too_small(uint8_t log2ps, uint8_t maxlog2ps) = "nvme_start_ctrl failed because the completion queue entry size is too smal= l: log2size=3D%u, min=3D%u" +pci_nvme_err_startfail_cqent_too_large(uint8_t log2ps, uint8_t maxlog2ps) = "nvme_start_ctrl failed because the completion queue entry size is too larg= e: log2size=3D%u, max=3D%u" +pci_nvme_err_startfail_sqent_too_small(uint8_t log2ps, uint8_t maxlog2ps) = "nvme_start_ctrl failed because the submission queue entry size is too smal= l: log2size=3D%u, min=3D%u" +pci_nvme_err_startfail_sqent_too_large(uint8_t log2ps, uint8_t maxlog2ps) = "nvme_start_ctrl failed because the submission queue entry size is too larg= e: log2size=3D%u, max=3D%u" +pci_nvme_err_startfail_asqent_sz_zero(void) "nvme_start_ctrl failed becaus= e the admin submission queue size is zero" +pci_nvme_err_startfail_acqent_sz_zero(void) "nvme_start_ctrl failed becaus= e the admin completion queue size is zero" +pci_nvme_err_startfail(void) "setting controller enable bit failed" =20 # Traces for undefined behavior -nvme_ub_mmiowr_misaligned32(uint64_t offset) "MMIO write not 32-bit aligne= d, offset=3D0x%"PRIx64"" -nvme_ub_mmiowr_toosmall(uint64_t offset, unsigned size) "MMIO write smalle= r than 32 bits, offset=3D0x%"PRIx64", size=3D%u" -nvme_ub_mmiowr_intmask_with_msix(void) "undefined access to interrupt mask= set when MSI-X is enabled" -nvme_ub_mmiowr_ro_csts(void) "attempted to set a read only bit of controll= er status" -nvme_ub_mmiowr_ssreset_w1c_unsupported(void) "attempted to W1C CSTS.NSSRO = but CAP.NSSRS is zero (not supported)" -nvme_ub_mmiowr_ssreset_unsupported(void) "attempted NVM subsystem reset bu= t CAP.NSSRS is zero (not supported)" -nvme_ub_mmiowr_cmbloc_reserved(void) "invalid write to reserved CMBLOC whe= n CMBSZ is zero, ignored" -nvme_ub_mmiowr_cmbsz_readonly(void) "invalid write to read only CMBSZ, ign= ored" -nvme_ub_mmiowr_pmrcap_readonly(void) "invalid write to read only PMRCAP, i= gnored" -nvme_ub_mmiowr_pmrsts_readonly(void) "invalid write to read only PMRSTS, i= gnored" -nvme_ub_mmiowr_pmrebs_readonly(void) "invalid write to read only PMREBS, i= gnored" -nvme_ub_mmiowr_pmrswtp_readonly(void) "invalid write to read only PMRSWTP,= ignored" -nvme_ub_mmiowr_invalid(uint64_t offset, uint64_t data) "invalid MMIO write= , offset=3D0x%"PRIx64", data=3D0x%"PRIx64"" -nvme_ub_mmiord_misaligned32(uint64_t offset) "MMIO read not 32-bit aligned= , offset=3D0x%"PRIx64"" -nvme_ub_mmiord_toosmall(uint64_t offset) "MMIO read smaller than 32-bits, = offset=3D0x%"PRIx64"" -nvme_ub_mmiord_invalid_ofs(uint64_t offset) "MMIO read beyond last registe= r, offset=3D0x%"PRIx64", returning 0" -nvme_ub_db_wr_misaligned(uint64_t offset) "doorbell write not 32-bit align= ed, offset=3D0x%"PRIx64", ignoring" -nvme_ub_db_wr_invalid_cq(uint32_t qid) "completion queue doorbell write fo= r nonexistent queue, cqid=3D%"PRIu32", ignoring" -nvme_ub_db_wr_invalid_cqhead(uint32_t qid, uint16_t new_head) "completion = queue doorbell write value beyond queue size, cqid=3D%"PRIu32", new_head=3D= %"PRIu16", ignoring" -nvme_ub_db_wr_invalid_sq(uint32_t qid) "submission queue doorbell write fo= r nonexistent queue, sqid=3D%"PRIu32", ignoring" -nvme_ub_db_wr_invalid_sqtail(uint32_t qid, uint16_t new_tail) "submission = queue doorbell write value beyond queue size, sqid=3D%"PRIu32", new_head=3D= %"PRIu16", ignoring" +pci_nvme_ub_mmiowr_misaligned32(uint64_t offset) "MMIO write not 32-bit al= igned, offset=3D0x%"PRIx64"" +pci_nvme_ub_mmiowr_toosmall(uint64_t offset, unsigned size) "MMIO write sm= aller than 32 bits, offset=3D0x%"PRIx64", size=3D%u" +pci_nvme_ub_mmiowr_intmask_with_msix(void) "undefined access to interrupt = mask set when MSI-X is enabled" +pci_nvme_ub_mmiowr_ro_csts(void) "attempted to set a read only bit of cont= roller status" +pci_nvme_ub_mmiowr_ssreset_w1c_unsupported(void) "attempted to W1C CSTS.NS= SRO but CAP.NSSRS is zero (not supported)" +pci_nvme_ub_mmiowr_ssreset_unsupported(void) "attempted NVM subsystem rese= t but CAP.NSSRS is zero (not supported)" +pci_nvme_ub_mmiowr_cmbloc_reserved(void) "invalid write to reserved CMBLOC= when CMBSZ is zero, ignored" +pci_nvme_ub_mmiowr_cmbsz_readonly(void) "invalid write to read only CMBSZ,= ignored" +pci_nvme_ub_mmiowr_pmrcap_readonly(void) "invalid write to read only PMRCA= P, ignored" +pci_nvme_ub_mmiowr_pmrsts_readonly(void) "invalid write to read only PMRST= S, ignored" +pci_nvme_ub_mmiowr_pmrebs_readonly(void) "invalid write to read only PMREB= S, ignored" +pci_nvme_ub_mmiowr_pmrswtp_readonly(void) "invalid write to read only PMRS= WTP, ignored" +pci_nvme_ub_mmiowr_invalid(uint64_t offset, uint64_t data) "invalid MMIO w= rite, offset=3D0x%"PRIx64", data=3D0x%"PRIx64"" +pci_nvme_ub_mmiord_misaligned32(uint64_t offset) "MMIO read not 32-bit ali= gned, offset=3D0x%"PRIx64"" +pci_nvme_ub_mmiord_toosmall(uint64_t offset) "MMIO read smaller than 32-bi= ts, offset=3D0x%"PRIx64"" +pci_nvme_ub_mmiord_invalid_ofs(uint64_t offset) "MMIO read beyond last reg= ister, offset=3D0x%"PRIx64", returning 0" +pci_nvme_ub_db_wr_misaligned(uint64_t offset) "doorbell write not 32-bit a= ligned, offset=3D0x%"PRIx64", ignoring" +pci_nvme_ub_db_wr_invalid_cq(uint32_t qid) "completion queue doorbell writ= e for nonexistent queue, cqid=3D%"PRIu32", ignoring" +pci_nvme_ub_db_wr_invalid_cqhead(uint32_t qid, uint16_t new_head) "complet= ion queue doorbell write value beyond queue size, cqid=3D%"PRIu32", new_hea= d=3D%"PRIu16", ignoring" +pci_nvme_ub_db_wr_invalid_sq(uint32_t qid) "submission queue doorbell writ= e for nonexistent queue, sqid=3D%"PRIu32", ignoring" +pci_nvme_ub_db_wr_invalid_sqtail(uint32_t qid, uint16_t new_tail) "submiss= ion queue doorbell write value beyond queue size, sqid=3D%"PRIu32", new_hea= d=3D%"PRIu16", ignoring" =20 # xen-block.c xen_block_realize(const char *type, uint32_t disk, uint32_t partition) "%s= d%up%u" --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405593; cv=none; d=zohomail.com; s=zohoarc; b=nqOFgqTl67Ls4UiK0e3fkfNXCACdeUZo8Xg2i3/6uQrm5YY5eBWoWgg4BpM7S5VICkk/MdxxIha2WH+0sFGmncjWJMjoAxatSRsh37eDp9QxoIlWd37oaMO8LcBB/1MN8KQkTdAJRXUFykYoB3w9ampo1YCXVbIL9WIOS9Sybw8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405593; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2Utk5L2ouoqN29QdO+mm6k9lBgU5fDYtT12Dun46psQ=; b=jifrseJ0zgFLBmkKV6Ki1ZUXGx39npCgKe0flQWZJPeqr7xA9LoLiGwSdboiNMqaQTPoFRVTXdX04/nQZjaqcA7C09FKpNkFPUC12h9CUVTYOO55J4Ml+XleQX3/qt8Bdqqm6pe51Wgdif78SsPtEvALpwe4hH8CNut6LCOYrT4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405593698718.8088363705618; Wed, 17 Jun 2020 07:53:13 -0700 (PDT) Received: from localhost ([::1]:59932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZRA-00017d-DP for importer@patchew.org; Wed, 17 Jun 2020 10:53:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNg-0002zV-MD for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:36 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:43536 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNa-0001f9-Gx for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:36 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-149-6XT74I2YMFOCbWy0unluaQ-1; Wed, 17 Jun 2020 10:49:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8FE6C18A266D; Wed, 17 Jun 2020 14:49:25 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 958937CAB0; Wed, 17 Jun 2020 14:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405368; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2Utk5L2ouoqN29QdO+mm6k9lBgU5fDYtT12Dun46psQ=; b=drFnZNmkz2WrdBJutOgELXLHJZ4PLLr0QLj78w9WsT5xRTiOyeF/2ZTWX475kYowRLDw9P JoofQnXU8E+riJjBOd8T9V9qBH8PlgcGSmy3hfQraLWBTrGb2hlqiL5KGPEhRnvXdobQ1E PQafrjMrRH2lAv/VRVO+Ij3vqxILS0o= X-MC-Unique: 6XT74I2YMFOCbWy0unluaQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 09/43] hw/block/nvme: remove superfluous breaks Date: Wed, 17 Jun 2020 16:48:35 +0200 Message-Id: <20200617144909.192176-10-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen These break statements was left over when commit 3036a626e9ef ("nvme: add Get/Set Feature Timestamp support") was merged. Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-4-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index e8f5c5ab82..0d3f8f345f 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -801,7 +801,6 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd *= cmd, NvmeRequest *req) break; case NVME_TIMESTAMP: return nvme_get_feature_timestamp(n, cmd); - break; default: trace_pci_nvme_err_invalid_getfeat(dw10); return NVME_INVALID_FIELD | NVME_DNR; @@ -845,11 +844,8 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd = *cmd, NvmeRequest *req) req->cqe.result =3D cpu_to_le32((n->num_queues - 2) | ((n->num_queues - 2) << 16)); break; - case NVME_TIMESTAMP: return nvme_set_feature_timestamp(n, cmd); - break; - default: trace_pci_nvme_err_invalid_setfeat(dw10); return NVME_INVALID_FIELD | NVME_DNR; --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405624; cv=none; d=zohomail.com; s=zohoarc; b=egOBHk3mJo5460O3iAJVRBwyj0Ou4Dvd7lfyXz/teM2impFLWmgjExbYnrZDde0FqLcGkEtw3/3wiAA3jHQpUkLRF4BZ1YdLBc/pl9aKoM7LEsD3V+pWE+ZvDvmBfyGlYA4dxzGStx5qbRnzN9ze2eolFtW9VKtksm9mNiroFuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405624; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=o5bNTS1jzDQj7QZ+WsJZ1DsNx+qW3D28EFPPzk1VR9o=; b=hDv47zLE334Q18zKTBxRRuDCXmxR0Wwz30mE57zyKkr6VcFXJldy9LoNhXdm9h729KSsiINEFgXoPJP9Ae0KxLTrVMViXmjNHIxsMK+j2JavFKstdrPMQ6dMnr4fBx60UF/aE2fa7gfJiydUr9vuf2ghwwbdNxSGUKr/SdQsXes= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405624436260.52267393224986; Wed, 17 Jun 2020 07:53:44 -0700 (PDT) Received: from localhost ([::1]:34304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZRf-0002Or-1V for importer@patchew.org; Wed, 17 Jun 2020 10:53:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45084) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNe-0002vd-SX for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:34 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42403 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNc-0001fr-LM for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:34 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-54-xV9b68JlOFCNsQjBV4LLMA-1; Wed, 17 Jun 2020 10:49:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D480B134D0; Wed, 17 Jun 2020 14:49:26 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D91757CAD2; Wed, 17 Jun 2020 14:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405371; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o5bNTS1jzDQj7QZ+WsJZ1DsNx+qW3D28EFPPzk1VR9o=; b=JQ9x3lujq7ySybAzF5kB4t5Qi1ntHmeESu1VwwHIypgMhGx8XkClGVj9CKQF9GC8wAHRSr RcfgJiHDtgS9iSyPhu6LIwQ4SfeX55/DpetzyPosTEjM9ll+UhODqIIfVXjTOBV38awtgn SvI+K5w034DDbPNEXIh0VGjGD5c7BJ4= X-MC-Unique: xV9b68JlOFCNsQjBV4LLMA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 10/43] hw/block/nvme: move device parameters to separate struct Date: Wed, 17 Jun 2020 16:48:36 +0200 Message-Id: <20200617144909.192176-11-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Move device configuration parameters to separate struct to make it explicit what is configurable and what is set internally. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Message-Id: <20200609190333.59390-5-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.h | 11 ++++++++--- hw/block/nvme.c | 49 ++++++++++++++++++++++++++----------------------- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 6520a9f0be..9df244c93c 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -1,7 +1,14 @@ #ifndef HW_NVME_H #define HW_NVME_H + #include "block/nvme.h" =20 +typedef struct NvmeParams { + char *serial; + uint32_t num_queues; + uint32_t cmb_size_mb; +} NvmeParams; + typedef struct NvmeAsyncEvent { QSIMPLEQ_ENTRY(NvmeAsyncEvent) entry; NvmeAerResult result; @@ -63,6 +70,7 @@ typedef struct NvmeCtrl { MemoryRegion ctrl_mem; NvmeBar bar; BlockConf conf; + NvmeParams params; =20 uint32_t page_size; uint16_t page_bits; @@ -71,10 +79,8 @@ typedef struct NvmeCtrl { uint16_t sqe_size; uint32_t reg_size; uint32_t num_namespaces; - uint32_t num_queues; uint32_t max_q_ents; uint64_t ns_size; - uint32_t cmb_size_mb; uint32_t cmbsz; uint32_t cmbloc; uint8_t *cmbuf; @@ -82,7 +88,6 @@ typedef struct NvmeCtrl { uint64_t host_timestamp; /* Timestamp sent by the h= ost */ uint64_t timestamp_set_qemu_clock_ms; /* QEMU clock time */ =20 - char *serial; HostMemoryBackend *pmrdev; =20 NvmeNamespace *namespaces; diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 0d3f8f345f..bc2d9d2091 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -77,12 +77,12 @@ static void nvme_addr_read(NvmeCtrl *n, hwaddr addr, vo= id *buf, int size) =20 static int nvme_check_sqid(NvmeCtrl *n, uint16_t sqid) { - return sqid < n->num_queues && n->sq[sqid] !=3D NULL ? 0 : -1; + return sqid < n->params.num_queues && n->sq[sqid] !=3D NULL ? 0 : -1; } =20 static int nvme_check_cqid(NvmeCtrl *n, uint16_t cqid) { - return cqid < n->num_queues && n->cq[cqid] !=3D NULL ? 0 : -1; + return cqid < n->params.num_queues && n->cq[cqid] !=3D NULL ? 0 : -1; } =20 static void nvme_inc_cq_tail(NvmeCQueue *cq) @@ -644,7 +644,7 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *cm= d) trace_pci_nvme_err_invalid_create_cq_addr(prp1); return NVME_INVALID_FIELD | NVME_DNR; } - if (unlikely(vector > n->num_queues)) { + if (unlikely(vector > n->params.num_queues)) { trace_pci_nvme_err_invalid_create_cq_vector(vector); return NVME_INVALID_IRQ_VECTOR | NVME_DNR; } @@ -796,7 +796,8 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd *= cmd, NvmeRequest *req) trace_pci_nvme_getfeat_vwcache(result ? "enabled" : "disabled"); break; case NVME_NUMBER_OF_QUEUES: - result =3D cpu_to_le32((n->num_queues - 2) | ((n->num_queues - 2) = << 16)); + result =3D cpu_to_le32((n->params.num_queues - 2) | + ((n->params.num_queues - 2) << 16)); trace_pci_nvme_getfeat_numq(result); break; case NVME_TIMESTAMP: @@ -840,9 +841,10 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd = *cmd, NvmeRequest *req) case NVME_NUMBER_OF_QUEUES: trace_pci_nvme_setfeat_numq((dw11 & 0xFFFF) + 1, ((dw11 >> 16) & 0xFFFF) + 1, - n->num_queues - 1, n->num_queues - 1); - req->cqe.result =3D - cpu_to_le32((n->num_queues - 2) | ((n->num_queues - 2) << 16)); + n->params.num_queues - 1, + n->params.num_queues - 1); + req->cqe.result =3D cpu_to_le32((n->params.num_queues - 2) | + ((n->params.num_queues - 2) << 16)); break; case NVME_TIMESTAMP: return nvme_set_feature_timestamp(n, cmd); @@ -913,12 +915,12 @@ static void nvme_clear_ctrl(NvmeCtrl *n) =20 blk_drain(n->conf.blk); =20 - for (i =3D 0; i < n->num_queues; i++) { + for (i =3D 0; i < n->params.num_queues; i++) { if (n->sq[i] !=3D NULL) { nvme_free_sq(n->sq[i], n); } } - for (i =3D 0; i < n->num_queues; i++) { + for (i =3D 0; i < n->params.num_queues; i++) { if (n->cq[i] !=3D NULL) { nvme_free_cq(n->cq[i], n); } @@ -1348,7 +1350,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) int64_t bs_size; uint8_t *pci_conf; =20 - if (!n->num_queues) { + if (!n->params.num_queues) { error_setg(errp, "num_queues can't be zero"); return; } @@ -1364,12 +1366,12 @@ static void nvme_realize(PCIDevice *pci_dev, Error = **errp) return; } =20 - if (!n->serial) { + if (!n->params.serial) { error_setg(errp, "serial property not set"); return; } =20 - if (!n->cmb_size_mb && n->pmrdev) { + if (!n->params.cmb_size_mb && n->pmrdev) { if (host_memory_backend_is_mapped(n->pmrdev)) { char *path =3D object_get_canonical_path_component(OBJECT(n->p= mrdev)); error_setg(errp, "can't use already busy memdev: %s", path); @@ -1400,25 +1402,26 @@ static void nvme_realize(PCIDevice *pci_dev, Error = **errp) n->num_namespaces =3D 1; =20 /* num_queues is really number of pairs, so each has two doorbells */ - n->reg_size =3D pow2ceil(NVME_REG_SIZE + 2 * n->num_queues * NVME_DB_S= IZE); + n->reg_size =3D pow2ceil(NVME_REG_SIZE + + 2 * n->params.num_queues * NVME_DB_SIZE); n->ns_size =3D bs_size / (uint64_t)n->num_namespaces; =20 n->namespaces =3D g_new0(NvmeNamespace, n->num_namespaces); - n->sq =3D g_new0(NvmeSQueue *, n->num_queues); - n->cq =3D g_new0(NvmeCQueue *, n->num_queues); + n->sq =3D g_new0(NvmeSQueue *, n->params.num_queues); + n->cq =3D g_new0(NvmeCQueue *, n->params.num_queues); =20 memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); - msix_init_exclusive_bar(pci_dev, n->num_queues, 4, NULL); + msix_init_exclusive_bar(pci_dev, n->params.num_queues, 4, NULL); =20 id->vid =3D cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid =3D cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR= _ID)); strpadcpy((char *)id->mn, sizeof(id->mn), "QEMU NVMe Ctrl", ' '); strpadcpy((char *)id->fr, sizeof(id->fr), "1.0", ' '); - strpadcpy((char *)id->sn, sizeof(id->sn), n->serial, ' '); + strpadcpy((char *)id->sn, sizeof(id->sn), n->params.serial, ' '); id->rab =3D 6; id->ieee[0] =3D 0x00; id->ieee[1] =3D 0x02; @@ -1447,7 +1450,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) n->bar.vs =3D 0x00010200; n->bar.intmc =3D n->bar.intms =3D 0; =20 - if (n->cmb_size_mb) { + if (n->params.cmb_size_mb) { =20 NVME_CMBLOC_SET_BIR(n->bar.cmbloc, 2); NVME_CMBLOC_SET_OFST(n->bar.cmbloc, 0); @@ -1458,7 +1461,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) NVME_CMBSZ_SET_RDS(n->bar.cmbsz, 1); NVME_CMBSZ_SET_WDS(n->bar.cmbsz, 1); NVME_CMBSZ_SET_SZU(n->bar.cmbsz, 2); /* MBs */ - NVME_CMBSZ_SET_SZ(n->bar.cmbsz, n->cmb_size_mb); + NVME_CMBSZ_SET_SZ(n->bar.cmbsz, n->params.cmb_size_mb); =20 n->cmbloc =3D n->bar.cmbloc; n->cmbsz =3D n->bar.cmbsz; @@ -1542,7 +1545,7 @@ static void nvme_exit(PCIDevice *pci_dev) g_free(n->cq); g_free(n->sq); =20 - if (n->cmb_size_mb) { + if (n->params.cmb_size_mb) { g_free(n->cmbuf); } =20 @@ -1556,9 +1559,9 @@ static Property nvme_props[] =3D { DEFINE_BLOCK_PROPERTIES(NvmeCtrl, conf), DEFINE_PROP_LINK("pmrdev", NvmeCtrl, pmrdev, TYPE_MEMORY_BACKEND, HostMemoryBackend *), - DEFINE_PROP_STRING("serial", NvmeCtrl, serial), - DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, cmb_size_mb, 0), - DEFINE_PROP_UINT32("num_queues", NvmeCtrl, num_queues, 64), + DEFINE_PROP_STRING("serial", NvmeCtrl, params.serial), + DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, params.cmb_size_mb, 0), + DEFINE_PROP_UINT32("num_queues", NvmeCtrl, params.num_queues, 64), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405861; cv=none; d=zohomail.com; s=zohoarc; b=dY58sk5zONUPIVGZxPdd+K6KiHojv6HEQ1U+s54+Ky908syZ0XzjTI0OyBggRJaR9vGpXOP4bhSOH5smA6hkEFL62HNdfz2GF4Sv8GRm+B/Ia8GG5eLECFaqzkCYFu5WH1cjdEEcLYC44mSmUgmqHquo4Nha5hyuMknr/oweUdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405861; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=InV1qEWufXZr6hH2vyCx35BRI/HztcBKiTggXjb2xNY=; b=CbxnqCHxgv/mG7xRhBxUnEP+kdUxgUspUYOkmGw3fWObVOBi7YgZCxqDr92Y9XYWc1cY1ImCZs8mZgMhtXcNBJXLGa8QdTlgXbsALNH/iI/yCysUL+/511q1WQYILYkEbM6oYKpbLuBNIU/QpnRADeXcuz66Aexa+v2aRg4IeTE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405861783538.1840161048486; Wed, 17 Jun 2020 07:57:41 -0700 (PDT) Received: from localhost ([::1]:52056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZVU-00038R-Ho for importer@patchew.org; Wed, 17 Jun 2020 10:57:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNh-000311-Gc for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:37 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:25046 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNf-0001hB-9h for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:37 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-293-l0wb-9I7PluMQc7EhRh4og-1; Wed, 17 Jun 2020 10:49:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C238835BC3; Wed, 17 Jun 2020 14:49:28 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 299AE7CAA0; Wed, 17 Jun 2020 14:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=InV1qEWufXZr6hH2vyCx35BRI/HztcBKiTggXjb2xNY=; b=g1R6yXVaiQTczAxAlc7KqfxJznOvl5C08YUfohsWYhG4QCTW5p2CHC+4g92Qve8hH6NXk3 TIPbl9KfraTa2VCFvL78TwQ2/1kAZrM1lFv0JZXKIvL/pMDdhsJTUfDDOTS/3jqyHAbqW+ 75OO6wp7wOHv8T3Z1xlzZNIPhIS7kSc= X-MC-Unique: l0wb-9I7PluMQc7EhRh4og-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 11/43] hw/block/nvme: use constants in identify Date: Wed, 17 Jun 2020 16:48:37 +0200 Message-Id: <20200617144909.192176-12-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-6-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- include/block/nvme.h | 8 ++++++++ hw/block/nvme.c | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/block/nvme.h b/include/block/nvme.h index 5525c8e343..1720ee1d51 100644 --- a/include/block/nvme.h +++ b/include/block/nvme.h @@ -705,6 +705,14 @@ typedef struct NvmePSD { uint8_t resv[16]; } NvmePSD; =20 +#define NVME_IDENTIFY_DATA_SIZE 4096 + +enum { + NVME_ID_CNS_NS =3D 0x0, + NVME_ID_CNS_CTRL =3D 0x1, + NVME_ID_CNS_NS_ACTIVE_LIST =3D 0x2, +}; + typedef struct NvmeIdCtrl { uint16_t vid; uint16_t ssvid; diff --git a/hw/block/nvme.c b/hw/block/nvme.c index bc2d9d2091..2a26b8859a 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -692,7 +692,7 @@ static uint16_t nvme_identify_ns(NvmeCtrl *n, NvmeIdent= ify *c) =20 static uint16_t nvme_identify_nslist(NvmeCtrl *n, NvmeIdentify *c) { - static const int data_len =3D 4 * KiB; + static const int data_len =3D NVME_IDENTIFY_DATA_SIZE; uint32_t min_nsid =3D le32_to_cpu(c->nsid); uint64_t prp1 =3D le64_to_cpu(c->prp1); uint64_t prp2 =3D le64_to_cpu(c->prp2); @@ -722,11 +722,11 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeCmd *c= md) NvmeIdentify *c =3D (NvmeIdentify *)cmd; =20 switch (le32_to_cpu(c->cns)) { - case 0x00: + case NVME_ID_CNS_NS: return nvme_identify_ns(n, c); - case 0x01: + case NVME_ID_CNS_CTRL: return nvme_identify_ctrl(n, c); - case 0x02: + case NVME_ID_CNS_NS_ACTIVE_LIST: return nvme_identify_nslist(n, c); default: trace_pci_nvme_err_invalid_identify_cns(le32_to_cpu(c->cns)); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405845; cv=none; d=zohomail.com; s=zohoarc; b=k+8cWKj3u5zgknccZRDcxvpN+arPIT3tHA5+a5TDNgXHEYDt0+zUn5EaNLQGHAHeH0zOdLNQCqoBG/FCZSHSsOhrdF9igvwzprLMRwmfIchIznqQSg/ZugUOMx04GoKjJCr42ZbYbCH8GOlBFChz+vZQyFp2+BPl6e9c4mV9Zt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405845; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tgueg5odBcUiVyg8UUwykUifJJbuVk5C7HBCzlaak3g=; b=mG6s1gDaACpJhDz7VBIwtdiG2ZwcrcFO/zXm5PS4lxEmUN3tE40G88F/D6P6VTk18+EHhnDiwrU+kH9eXGwFpVI+fosB7pfZaGkXOiNLDe6niAxw+7ouQfCNtwBo8Rl0Ykebj5J/8kt31DVaXTRCwET8MWd2ZSXP4DrV/I9+YBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405845495289.7493725002697; Wed, 17 Jun 2020 07:57:25 -0700 (PDT) Received: from localhost ([::1]:50442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZVE-0002TR-7h for importer@patchew.org; Wed, 17 Jun 2020 10:57:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNg-0002ze-O6 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:36 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33586 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNd-0001g2-DM for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:36 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-172-QuYGfuClPt-xLPcnIyPYRw-1; Wed, 17 Jun 2020 10:49:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 70F3A835BE6; Wed, 17 Jun 2020 14:49:29 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75DE77CAA0; Wed, 17 Jun 2020 14:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tgueg5odBcUiVyg8UUwykUifJJbuVk5C7HBCzlaak3g=; b=O2tE6uT0cWrgaw6sZJXpC2pQuN+Pnnvrx4WYGfj+uFmGQHzkFD6EpX4AfD3g50WM3rBZ8p yP1Smid8qOs6KUxNYwpktXJXUNlxLAeGjeXCYmlx/SBHysDnq6Ju3rdfF8QVBXIpGRIlYe JNb0OrJyeJ47ylVVsHHXbSraxYhngNg= X-MC-Unique: QuYGfuClPt-xLPcnIyPYRw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 12/43] hw/block/nvme: refactor nvme_addr_read Date: Wed, 17 Jun 2020 16:48:38 +0200 Message-Id: <20200617144909.192176-13-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Pull the controller memory buffer check to its own function. The check will be used on its own in later patches. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-7-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 2a26b8859a..d6fcf078a4 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -65,14 +65,22 @@ =20 static void nvme_process_sq(void *opaque); =20 +static bool nvme_addr_is_cmb(NvmeCtrl *n, hwaddr addr) +{ + hwaddr low =3D n->ctrl_mem.addr; + hwaddr hi =3D n->ctrl_mem.addr + int128_get64(n->ctrl_mem.size); + + return addr >=3D low && addr < hi; +} + static void nvme_addr_read(NvmeCtrl *n, hwaddr addr, void *buf, int size) { - if (n->cmbsz && addr >=3D n->ctrl_mem.addr && - addr < (n->ctrl_mem.addr + int128_get64(n->ctrl_mem.size))= ) { + if (n->cmbsz && nvme_addr_is_cmb(n, addr)) { memcpy(buf, (void *)&n->cmbuf[addr - n->ctrl_mem.addr], size); - } else { - pci_dma_read(&n->parent_obj, addr, buf, size); + return; } + + pci_dma_read(&n->parent_obj, addr, buf, size); } =20 static int nvme_check_sqid(NvmeCtrl *n, uint16_t sqid) --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405940; cv=none; d=zohomail.com; s=zohoarc; b=B/PuQsH7vH0KkuuVeo4vJlYU122TbF1ML2HqX3Syo6J7P8Y9M3JCMkQGYmnH4Nud8fSbMdbMSIB34T4ii9HYx7mqAW2vpvNSjwBTW0eADs6n0YAEQ6cTewdgq5AcU+fWuRtR8wpmAWhswNXGIOVmV354AhGuK6qURVQpCLSHA7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405940; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wmvqFrrNA6PmYVGzeQgPjmNtOe0odHrviI5a7ZFsoqQ=; b=cd7lLiKolJPbO1A+9OCpjVRAOkjw1NYwagyARfCLU+dtwCNv+48nosY2kNpY7XdtnHaTsB9vSxS7pINvu+HS8nPvAlx7fs6vQJxEcHQ8FeQ3n/YVkLW4+m47o9sfG1gZyK8LEslC88HcvvOgx2dyPKRq8iAcb8RUQL6VT/voD0Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405940457864.4706347085875; Wed, 17 Jun 2020 07:59:00 -0700 (PDT) Received: from localhost ([::1]:58934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZWl-0006F3-JZ for importer@patchew.org; Wed, 17 Jun 2020 10:58:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNh-00030L-5l for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:37 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:38814 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNe-0001gn-Ez for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:36 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-397-OJbhx6RsN0Gs-_Q-BsSb2g-1; Wed, 17 Jun 2020 10:49:31 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2BC683DB7A; Wed, 17 Jun 2020 14:49:30 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB6547CAA8; Wed, 17 Jun 2020 14:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wmvqFrrNA6PmYVGzeQgPjmNtOe0odHrviI5a7ZFsoqQ=; b=hn3KNSeg/djEEbPYYiBU/qvs1A7dnoFMl947GFpS4oC1WoTZGmypDsDw6DSNOi+m4ctvur KdFJ1tuq/HHuUn7eF4raPCGrctkfY35ua50A8hdOf1xFCjR4gn//xlMxbUYxp1K90LXhuQ ptfeOFjem7vuurpT5DC1o7ms6sAoD0g= X-MC-Unique: OJbhx6RsN0Gs-_Q-BsSb2g-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 13/43] hw/block/nvme: fix pin-based interrupt behavior Date: Wed, 17 Jun 2020 16:48:39 +0200 Message-Id: <20200617144909.192176-14-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Klaus Jensen First, since the device only supports MSI-X or pin-based interrupt, if MSI-X is not enabled, it should not accept interrupt vectors different from 0 when creating completion queues. Secondly, the irq_status NvmeCtrl member is meant to be compared to the INTMS register, so it should only be 32 bits wide. And it is really only useful when used with multi-message MSI. Third, since we do not force a 1-to-1 correspondence between cqid and interrupt vector, the irq_status register should not have bits set according to cqid, but according to the associated interrupt vector. Fix these issues, but keep irq_status available so we can easily support multi-message MSI down the line. Fixes: 5e9aa92eb1a5 ("hw/block: Fix pin-based interrupt behaviour of NVMe") Cc: "Michael S. Tsirkin" Cc: Marcel Apfelbaum Signed-off-by: Klaus Jensen Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-8-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.h | 2 +- hw/block/nvme.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 9df244c93c..91f16c8125 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -84,7 +84,7 @@ typedef struct NvmeCtrl { uint32_t cmbsz; uint32_t cmbloc; uint8_t *cmbuf; - uint64_t irq_status; + uint32_t irq_status; uint64_t host_timestamp; /* Timestamp sent by the h= ost */ uint64_t timestamp_set_qemu_clock_ms; /* QEMU clock time */ =20 diff --git a/hw/block/nvme.c b/hw/block/nvme.c index d6fcf078a4..ee514625ee 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -137,8 +137,8 @@ static void nvme_irq_assert(NvmeCtrl *n, NvmeCQueue *cq) msix_notify(&(n->parent_obj), cq->vector); } else { trace_pci_nvme_irq_pin(); - assert(cq->cqid < 64); - n->irq_status |=3D 1 << cq->cqid; + assert(cq->vector < 32); + n->irq_status |=3D 1 << cq->vector; nvme_irq_check(n); } } else { @@ -152,8 +152,8 @@ static void nvme_irq_deassert(NvmeCtrl *n, NvmeCQueue *= cq) if (msix_enabled(&(n->parent_obj))) { return; } else { - assert(cq->cqid < 64); - n->irq_status &=3D ~(1 << cq->cqid); + assert(cq->vector < 32); + n->irq_status &=3D ~(1 << cq->vector); nvme_irq_check(n); } } @@ -652,6 +652,10 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *c= md) trace_pci_nvme_err_invalid_create_cq_addr(prp1); return NVME_INVALID_FIELD | NVME_DNR; } + if (unlikely(!msix_enabled(&n->parent_obj) && vector)) { + trace_pci_nvme_err_invalid_create_cq_vector(vector); + return NVME_INVALID_IRQ_VECTOR | NVME_DNR; + } if (unlikely(vector > n->params.num_queues)) { trace_pci_nvme_err_invalid_create_cq_vector(vector); return NVME_INVALID_IRQ_VECTOR | NVME_DNR; --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405720; cv=none; d=zohomail.com; s=zohoarc; b=cBkQKv2jJw5aghxOOmDfC2nZrYmDK+GdTHq24zNhfZnZjbwjq5SHtJWG2Eh0S1T1a8U0t44o360s3ADuTuqHPOgA2Dvmqi4UDYPMAaOP9+J39N3wv+6cjTEoUnpjwLTcJDEx0EAXjZF7E54xqTQ4gLVbSaJb/MBxjgc5kPkNXGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405720; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5JsuWQNMLKUx5eCDIz6whYhj2Lt5qPIjmQPTK3i+YhE=; b=gxX1iWIsv7bZ3C2IEeJHtgKfsGpYXehKXE81E9zAL1Tbo5BRsu26iQOG6ZIzTgdskvld2XzVw7ze/CnbudXU1/EpHEuuNGlpE7JbhmRtt/+Fa+6h3Wx8xrFCqfSF3yOs575SfuhWJYkHTOaUf6XeCOTs8o6Qq4UQK22jy0Ny3lM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405720554213.72738329251422; Wed, 17 Jun 2020 07:55:20 -0700 (PDT) Received: from localhost ([::1]:40930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZTD-0006KE-8g for importer@patchew.org; Wed, 17 Jun 2020 10:55:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNi-000324-95 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:41 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:41742 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNf-0001hO-W0 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:38 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-5b64oG_5PIeiz4ufTz0WsQ-1; Wed, 17 Jun 2020 10:49:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0474880F5F0; Wed, 17 Jun 2020 14:49:32 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08CD17CAB0; Wed, 17 Jun 2020 14:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405375; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5JsuWQNMLKUx5eCDIz6whYhj2Lt5qPIjmQPTK3i+YhE=; b=T+VphW8rdMrZpjVyZq7AKFR6kVk46pxG0rTPjRzV56SoZb+BRORmKBVvr5K0RDM9xSaf6O RErXPijRa/698ACn8Ke/OgmWQmxHuWOJ2At0diOwoYA2tHji0oh24r7CyiODtX1Rspw2e1 OGuUpAcFan6EHreX7aJdf2Qe97TddyM= X-MC-Unique: 5b64oG_5PIeiz4ufTz0WsQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 14/43] hw/block/nvme: add max_ioqpairs device parameter Date: Wed, 17 Jun 2020 16:48:40 +0200 Message-Id: <20200617144909.192176-15-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen The num_queues device paramater has a slightly confusing meaning because it accounts for the admin queue pair which is not really optional. Secondly, it is really a maximum value of queues allowed. Add a new max_ioqpairs parameter that only accounts for I/O queue pairs, but keep num_queues for compatibility. Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-9-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.h | 3 ++- hw/block/nvme.c | 51 ++++++++++++++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 91f16c8125..26c38bd913 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -5,7 +5,8 @@ =20 typedef struct NvmeParams { char *serial; - uint32_t num_queues; + uint32_t num_queues; /* deprecated since 5.1 */ + uint32_t max_ioqpairs; uint32_t cmb_size_mb; } NvmeParams; =20 diff --git a/hw/block/nvme.c b/hw/block/nvme.c index ee514625ee..1c1d2f8b77 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -20,7 +20,7 @@ * -device nvme,drive=3D,serial=3D,id=3D, \ * cmb_size_mb=3D, \ * [pmrdev=3D,] \ - * num_queues=3D + * max_ioqpairs=3D * * Note cmb_size_mb denotes size of CMB in MB. CMB is assumed to be at * offset 0 in BAR2 and supports only WDS, RDS and SQS for now. @@ -36,6 +36,7 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/error-report.h" #include "hw/block/block.h" #include "hw/pci/msix.h" #include "hw/pci/pci.h" @@ -85,12 +86,12 @@ static void nvme_addr_read(NvmeCtrl *n, hwaddr addr, vo= id *buf, int size) =20 static int nvme_check_sqid(NvmeCtrl *n, uint16_t sqid) { - return sqid < n->params.num_queues && n->sq[sqid] !=3D NULL ? 0 : -1; + return sqid < n->params.max_ioqpairs + 1 && n->sq[sqid] !=3D NULL ? 0 = : -1; } =20 static int nvme_check_cqid(NvmeCtrl *n, uint16_t cqid) { - return cqid < n->params.num_queues && n->cq[cqid] !=3D NULL ? 0 : -1; + return cqid < n->params.max_ioqpairs + 1 && n->cq[cqid] !=3D NULL ? 0 = : -1; } =20 static void nvme_inc_cq_tail(NvmeCQueue *cq) @@ -656,7 +657,7 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *cm= d) trace_pci_nvme_err_invalid_create_cq_vector(vector); return NVME_INVALID_IRQ_VECTOR | NVME_DNR; } - if (unlikely(vector > n->params.num_queues)) { + if (unlikely(vector > n->params.max_ioqpairs)) { trace_pci_nvme_err_invalid_create_cq_vector(vector); return NVME_INVALID_IRQ_VECTOR | NVME_DNR; } @@ -808,8 +809,8 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd *= cmd, NvmeRequest *req) trace_pci_nvme_getfeat_vwcache(result ? "enabled" : "disabled"); break; case NVME_NUMBER_OF_QUEUES: - result =3D cpu_to_le32((n->params.num_queues - 2) | - ((n->params.num_queues - 2) << 16)); + result =3D cpu_to_le32((n->params.max_ioqpairs - 1) | + ((n->params.max_ioqpairs - 1) << 16)); trace_pci_nvme_getfeat_numq(result); break; case NVME_TIMESTAMP: @@ -853,10 +854,10 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd= *cmd, NvmeRequest *req) case NVME_NUMBER_OF_QUEUES: trace_pci_nvme_setfeat_numq((dw11 & 0xFFFF) + 1, ((dw11 >> 16) & 0xFFFF) + 1, - n->params.num_queues - 1, - n->params.num_queues - 1); - req->cqe.result =3D cpu_to_le32((n->params.num_queues - 2) | - ((n->params.num_queues - 2) << 16)); + n->params.max_ioqpairs, + n->params.max_ioqpairs); + req->cqe.result =3D cpu_to_le32((n->params.max_ioqpairs - 1) | + ((n->params.max_ioqpairs - 1) << 16)= ); break; case NVME_TIMESTAMP: return nvme_set_feature_timestamp(n, cmd); @@ -927,12 +928,12 @@ static void nvme_clear_ctrl(NvmeCtrl *n) =20 blk_drain(n->conf.blk); =20 - for (i =3D 0; i < n->params.num_queues; i++) { + for (i =3D 0; i < n->params.max_ioqpairs + 1; i++) { if (n->sq[i] !=3D NULL) { nvme_free_sq(n->sq[i], n); } } - for (i =3D 0; i < n->params.num_queues; i++) { + for (i =3D 0; i < n->params.max_ioqpairs + 1; i++) { if (n->cq[i] !=3D NULL) { nvme_free_cq(n->cq[i], n); } @@ -1362,8 +1363,17 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) int64_t bs_size; uint8_t *pci_conf; =20 - if (!n->params.num_queues) { - error_setg(errp, "num_queues can't be zero"); + if (n->params.num_queues) { + warn_report("num_queues is deprecated; please use max_ioqpairs " + "instead"); + + n->params.max_ioqpairs =3D n->params.num_queues - 1; + } + + if (n->params.max_ioqpairs < 1 || + n->params.max_ioqpairs > PCI_MSIX_FLAGS_QSIZE) { + error_setg(errp, "max_ioqpairs must be between 1 and %d", + PCI_MSIX_FLAGS_QSIZE); return; } =20 @@ -1413,21 +1423,21 @@ static void nvme_realize(PCIDevice *pci_dev, Error = **errp) =20 n->num_namespaces =3D 1; =20 - /* num_queues is really number of pairs, so each has two doorbells */ + /* add one to max_ioqpairs to account for the admin queue pair */ n->reg_size =3D pow2ceil(NVME_REG_SIZE + - 2 * n->params.num_queues * NVME_DB_SIZE); + 2 * (n->params.max_ioqpairs + 1) * NVME_DB_SIZE= ); n->ns_size =3D bs_size / (uint64_t)n->num_namespaces; =20 n->namespaces =3D g_new0(NvmeNamespace, n->num_namespaces); - n->sq =3D g_new0(NvmeSQueue *, n->params.num_queues); - n->cq =3D g_new0(NvmeCQueue *, n->params.num_queues); + n->sq =3D g_new0(NvmeSQueue *, n->params.max_ioqpairs + 1); + n->cq =3D g_new0(NvmeCQueue *, n->params.max_ioqpairs + 1); =20 memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); - msix_init_exclusive_bar(pci_dev, n->params.num_queues, 4, NULL); + msix_init_exclusive_bar(pci_dev, n->params.max_ioqpairs + 1, 4, NULL); =20 id->vid =3D cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid =3D cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR= _ID)); @@ -1573,7 +1583,8 @@ static Property nvme_props[] =3D { HostMemoryBackend *), DEFINE_PROP_STRING("serial", NvmeCtrl, params.serial), DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, params.cmb_size_mb, 0), - DEFINE_PROP_UINT32("num_queues", NvmeCtrl, params.num_queues, 64), + DEFINE_PROP_UINT32("num_queues", NvmeCtrl, params.num_queues, 0), + DEFINE_PROP_UINT32("max_ioqpairs", NvmeCtrl, params.max_ioqpairs, 64), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405717; cv=none; d=zohomail.com; s=zohoarc; b=KL6DWQzgfjS0dxTHpEvgC60uyejk63zLWax4cv4Xzg5uZm2z4DFavu6WAs98/1/AkfLUZ1bww0JF+sbMMBEbb1byViQlhtNY8OmTVIQOXaKrGKIm72hsEfUp3qzdnsjyOsQeOdLmzsbQ+aNSuMcjZCQwEBbdN0/oGTSBBnxGhv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405717; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=51GFUb8c35LSlE6iefEt3ZZg/mvNA51IXwW1PwoSmaY=; b=haKQ3NuJ6oSbpomHAwih4CdLHGV9fWl/1D9ikb3pOi5+jW+MFiybijxx8ZUSUvdyhB0ooqARqjT6zEvUGYOR2i6Ot15KXWL65eu8RTu8oNoxo2wW0JK7XCaJds3sQU1H5DWjDOjBnJ/mwREYGr+6QNR6XfP3poQ16GVFQjlyyIU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405717157628.116048381024; Wed, 17 Jun 2020 07:55:17 -0700 (PDT) Received: from localhost ([::1]:40728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZT9-0006FA-Qy for importer@patchew.org; Wed, 17 Jun 2020 10:55:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNn-00033R-1H for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:43 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:37463 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNh-0001i3-F3 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:42 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-421-fLnK-ghVNqC9dbm_Q85HkA-1; Wed, 17 Jun 2020 10:49:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 46650134D5; Wed, 17 Jun 2020 14:49:33 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E7B47CAA0; Wed, 17 Jun 2020 14:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=51GFUb8c35LSlE6iefEt3ZZg/mvNA51IXwW1PwoSmaY=; b=gcdWUtQbunw7q2h+IbCpTXg2aR0vfdKJ6S+hAIJjDSkQi4VIBmr1MD9FkhNwuKZwQtEjG8 Cl4k1BTl+OcCs6Hpyv43Xlqg3c9o1Ec9HkcfiSmyTj0JWE/x6SRjpgHPC61KAomPlBQqib gHuFOh7Wj1+gXBcZ+jZGX7Bxw1hcyY4= X-MC-Unique: fLnK-ghVNqC9dbm_Q85HkA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 15/43] hw/block/nvme: remove redundant cmbloc/cmbsz members Date: Wed, 17 Jun 2020 16:48:41 +0200 Message-Id: <20200617144909.192176-16-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-10-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.h | 2 -- hw/block/nvme.c | 7 ++----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 26c38bd913..cedc8022db 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -82,8 +82,6 @@ typedef struct NvmeCtrl { uint32_t num_namespaces; uint32_t max_q_ents; uint64_t ns_size; - uint32_t cmbsz; - uint32_t cmbloc; uint8_t *cmbuf; uint32_t irq_status; uint64_t host_timestamp; /* Timestamp sent by the h= ost */ diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 1c1d2f8b77..61447220a8 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -76,7 +76,7 @@ static bool nvme_addr_is_cmb(NvmeCtrl *n, hwaddr addr) =20 static void nvme_addr_read(NvmeCtrl *n, hwaddr addr, void *buf, int size) { - if (n->cmbsz && nvme_addr_is_cmb(n, addr)) { + if (n->bar.cmbsz && nvme_addr_is_cmb(n, addr)) { memcpy(buf, (void *)&n->cmbuf[addr - n->ctrl_mem.addr], size); return; } @@ -170,7 +170,7 @@ static uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVec= tor *iov, uint64_t prp1, if (unlikely(!prp1)) { trace_pci_nvme_err_invalid_prp(); return NVME_INVALID_FIELD | NVME_DNR; - } else if (n->cmbsz && prp1 >=3D n->ctrl_mem.addr && + } else if (n->bar.cmbsz && prp1 >=3D n->ctrl_mem.addr && prp1 < n->ctrl_mem.addr + int128_get64(n->ctrl_mem.size)) { qsg->nsg =3D 0; qemu_iovec_init(iov, num_prps); @@ -1485,9 +1485,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) NVME_CMBSZ_SET_SZU(n->bar.cmbsz, 2); /* MBs */ NVME_CMBSZ_SET_SZ(n->bar.cmbsz, n->params.cmb_size_mb); =20 - n->cmbloc =3D n->bar.cmbloc; - n->cmbsz =3D n->bar.cmbsz; - n->cmbuf =3D 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)= ); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405986; cv=none; d=zohomail.com; s=zohoarc; b=XJUC92z3Qgevu5+wn/4A5cRumRBZzIhK9Yl65ddorRNse0SSsD20hn01ARN8Un45F2QAP6riM224aw79nvnQtE0Q1dKL5YQcaLvTDX7xn3QV/+ZRUGtfOtlvsy+uGeTcjMbebkKcw620uUWYrXpo7mNC1Qz4wFg5tO5O5dta7kM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405986; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Iyw/Q2JpgVOyfsqbzKlZnH45NH/c7NT9F6B2ehHiDmE=; b=Qgiaty2gSLWiwIT8uyIbVw8khf8FuCTBQYuwXjhb/Vd2KcaZI3uzbpeO9Df7I9ABByEj0lETB3pUN5sOtvIIDW45tZwPu9thDzJOJzTzAlChQmqRZKzVTf6ZYt2oIJI6G2Dil0Of0BxRV+j0h1RYb+l2tELaPkJv78029rv/Ti0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405986824207.4139919744057; Wed, 17 Jun 2020 07:59:46 -0700 (PDT) Received: from localhost ([::1]:33660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZXW-0007US-05 for importer@patchew.org; Wed, 17 Jun 2020 10:59:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNn-00033j-8f for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:45 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:40778 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNi-0001iP-Fj for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:42 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-MSht19-UPWCKRkseYOg_mQ-1; Wed, 17 Jun 2020 10:49:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87D5918A267A; Wed, 17 Jun 2020 14:49:34 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FFF17CAA0; Wed, 17 Jun 2020 14:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Iyw/Q2JpgVOyfsqbzKlZnH45NH/c7NT9F6B2ehHiDmE=; b=FEvUsNtVTIGViq5tNl+qat3takKf6mFELJUqnrVMZBeIkpz1CQ8rAeWTN3Wp7XeJlUBO7h v9Y+MyE5baAuXFBrgRbqPqzYjbcqesCHvn25/bXIwv4JTRwnU6H/p38YYmwS+hpIGfW+eG 8WkRHms5xoGVab7igsibJui/TMKAdRE= X-MC-Unique: MSht19-UPWCKRkseYOg_mQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 16/43] hw/block/nvme: factor out property/constraint checks Date: Wed, 17 Jun 2020 16:48:42 +0200 Message-Id: <20200617144909.192176-17-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-11-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 61447220a8..ee669ee8dc 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1354,24 +1354,19 @@ static const MemoryRegionOps nvme_cmb_ops =3D { }, }; =20 -static void nvme_realize(PCIDevice *pci_dev, Error **errp) +static void nvme_check_constraints(NvmeCtrl *n, Error **errp) { - NvmeCtrl *n =3D NVME(pci_dev); - NvmeIdCtrl *id =3D &n->id_ctrl; - - int i; - int64_t bs_size; - uint8_t *pci_conf; + NvmeParams *params =3D &n->params; =20 - if (n->params.num_queues) { + if (params->num_queues) { warn_report("num_queues is deprecated; please use max_ioqpairs " "instead"); =20 - n->params.max_ioqpairs =3D n->params.num_queues - 1; + params->max_ioqpairs =3D params->num_queues - 1; } =20 - if (n->params.max_ioqpairs < 1 || - n->params.max_ioqpairs > PCI_MSIX_FLAGS_QSIZE) { + if (params->max_ioqpairs < 1 || + params->max_ioqpairs > PCI_MSIX_FLAGS_QSIZE) { error_setg(errp, "max_ioqpairs must be between 1 and %d", PCI_MSIX_FLAGS_QSIZE); return; @@ -1382,13 +1377,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) return; } =20 - bs_size =3D blk_getlength(n->conf.blk); - if (bs_size < 0) { - error_setg(errp, "could not get backing file size"); - return; - } - - if (!n->params.serial) { + if (!params->serial) { error_setg(errp, "serial property not set"); return; } @@ -1408,6 +1397,29 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) =20 host_memory_backend_set_mapped(n->pmrdev, true); } +} + +static void nvme_realize(PCIDevice *pci_dev, Error **errp) +{ + NvmeCtrl *n =3D NVME(pci_dev); + NvmeIdCtrl *id =3D &n->id_ctrl; + Error *local_err =3D NULL; + + int i; + int64_t bs_size; + uint8_t *pci_conf; + + nvme_check_constraints(n, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + bs_size =3D blk_getlength(n->conf.blk); + if (bs_size < 0) { + error_setg(errp, "could not get backing file size"); + return; + } =20 blkconf_blocksizes(&n->conf); if (!blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.= blk), --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406194; cv=none; d=zohomail.com; s=zohoarc; b=dGD4vB/W9SW0YuavKDZ2VkQDGElu0XZENq3SKwEVGMLlouxZXD1wSeWLisO3xT4h/yNp0rRktQJpHeivgqhx7kmRpxiXoDp/yiec/aWLZxDwWS9rPaZp2B5fEPEPlJ8wafN1355odcv/m57Z5TTjG+4YzynGtEjvdaBDDpteiBA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406194; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=E0S3KnoPwmqMahXIoE1s8/g6EU45UbGowJAc/xq1GzA=; b=XbLhS7GjOPbLOo6VWOWkb6mSwP04rC0kNsgMA49jF0xSBjxO0Hp570/V27BMTyqXwDc63D5DhMKKC6hWSt/9+foPyDq/ri5eJZVZGHX0HTIHF39+kW5DQBmL64pn0yfuP1FNlqIK4W0uTpiGC027Y3uIQcfZjFdPKcHoz3o97Q4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159240619455257.187490665130554; Wed, 17 Jun 2020 08:03:14 -0700 (PDT) Received: from localhost ([::1]:42136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZar-0003G8-KU for importer@patchew.org; Wed, 17 Jun 2020 11:03:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNq-00034T-C4 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:46 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:33295 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNl-0001ih-DA for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-75-cMQC-2UuMxKT8gsQi3uQ0g-1; Wed, 17 Jun 2020 10:49:36 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC253134D5; Wed, 17 Jun 2020 14:49:35 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D28977CAA0; Wed, 17 Jun 2020 14:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E0S3KnoPwmqMahXIoE1s8/g6EU45UbGowJAc/xq1GzA=; b=bTkVvRdTqJzwvm3Ldl6u57F6ItxfB09Rkoo3qrEq0AqyK/hd7nXH8efk/ojBPgS7ISx8xR cP+EKgfZNyCtrMtEqOfiiK1RWmgatxL18Mwz6u8VBwvRm3u3FgrFff2GTjq5b6cYf2miCs mSEnFYCJyxJa5n3i4/z8g4u3ImqgRKs= X-MC-Unique: cMQC-2UuMxKT8gsQi3uQ0g-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 17/43] hw/block/nvme: factor out device state setup Date: Wed, 17 Jun 2020 16:48:43 +0200 Message-Id: <20200617144909.192176-18-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-12-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index ee669ee8dc..b721cab9b0 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1399,6 +1399,17 @@ static void nvme_check_constraints(NvmeCtrl *n, Erro= r **errp) } } =20 +static void nvme_init_state(NvmeCtrl *n) +{ + n->num_namespaces =3D 1; + /* add one to max_ioqpairs to account for the admin queue pair */ + n->reg_size =3D pow2ceil(NVME_REG_SIZE + + 2 * (n->params.max_ioqpairs + 1) * NVME_DB_SIZE= ); + n->namespaces =3D g_new0(NvmeNamespace, n->num_namespaces); + n->sq =3D g_new0(NvmeSQueue *, n->params.max_ioqpairs + 1); + n->cq =3D g_new0(NvmeCQueue *, n->params.max_ioqpairs + 1); +} + static void nvme_realize(PCIDevice *pci_dev, Error **errp) { NvmeCtrl *n =3D NVME(pci_dev); @@ -1415,6 +1426,8 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) return; } =20 + nvme_init_state(n); + bs_size =3D blk_getlength(n->conf.blk); if (bs_size < 0) { error_setg(errp, "could not get backing file size"); @@ -1433,17 +1446,8 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS); pcie_endpoint_cap_init(pci_dev, 0x80); =20 - n->num_namespaces =3D 1; - - /* add one to max_ioqpairs to account for the admin queue pair */ - n->reg_size =3D pow2ceil(NVME_REG_SIZE + - 2 * (n->params.max_ioqpairs + 1) * NVME_DB_SIZE= ); n->ns_size =3D bs_size / (uint64_t)n->num_namespaces; =20 - n->namespaces =3D g_new0(NvmeNamespace, n->num_namespaces); - n->sq =3D g_new0(NvmeSQueue *, n->params.max_ioqpairs + 1); - n->cq =3D g_new0(NvmeCQueue *, n->params.max_ioqpairs + 1); - memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); pci_register_bar(pci_dev, 0, --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407182; cv=none; d=zohomail.com; s=zohoarc; b=GqDntmMLZ0Nta07QcMQFSn2nI3BciZqHNdTwW7Vd7CDxdtA78cWDcpXgbgTsCmHBsxcLxkk4JYrEwJ6fcJf8tNFbsBoYcetyl0ewFJ+6WXU0cgZEGIDFpY7hMx8o10rnxHQxQ51TiQG2rpeTYKza/BHGKv7VNN+eDnp9Vm8h3uU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407182; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Vkx3Gbc4xe3zntOOxWB679eH/cE6ClvCik3q1EsrHU0=; b=LH+gizyW0jgKsxzpidjUG7HrzNHjR1ksMsyXWfSGCKh3dJrkeYiS4zqMe87ql7lxbYRMO4wTsvXTb1nVt+24Y4Ro8J/uc/n/ukUI78KFg9gXO3tBE6meN0DGE4myzFxKe5pLfXwDbVBdbpbX7tKwnfC9ET8HhPRj00KBNj0JwDw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407182126958.346306143448; Wed, 17 Jun 2020 08:19:42 -0700 (PDT) Received: from localhost ([::1]:50592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZdf-0007O3-A1 for importer@patchew.org; Wed, 17 Jun 2020 11:06:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNs-00036U-A4 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:49 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:59503 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNo-0001jA-PC for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-wocKRcZgOeaJsSPsVT1X7g-1; Wed, 17 Jun 2020 10:49:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1C99780331A; Wed, 17 Jun 2020 14:49:37 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24A857CAA0; Wed, 17 Jun 2020 14:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vkx3Gbc4xe3zntOOxWB679eH/cE6ClvCik3q1EsrHU0=; b=f7R7KJywXN0QyoXvSsCsY9AK5vJUSmNc3rpYVYCeSpwPf/L+qI8PiZj/Hko5ejMgTBDDhr 4g4yAxvO3tVWhVT2q1gQ7dlHvClUf1V9FJ5lKVrTacMGogre8mkwYBJt5r9rqK5gEJxOZ7 E0DW1vRxWV9/8IFdCrWtnTlRWO4zJl4= X-MC-Unique: wocKRcZgOeaJsSPsVT1X7g-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 18/43] hw/block/nvme: factor out block backend setup Date: Wed, 17 Jun 2020 16:48:44 +0200 Message-Id: <20200617144909.192176-19-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-13-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index b721cab9b0..87f1f0d0d1 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1410,6 +1410,13 @@ static void nvme_init_state(NvmeCtrl *n) n->cq =3D g_new0(NvmeCQueue *, n->params.max_ioqpairs + 1); } =20 +static void nvme_init_blk(NvmeCtrl *n, Error **errp) +{ + blkconf_blocksizes(&n->conf); + blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk), + false, errp); +} + static void nvme_realize(PCIDevice *pci_dev, Error **errp) { NvmeCtrl *n =3D NVME(pci_dev); @@ -1434,9 +1441,9 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) return; } =20 - blkconf_blocksizes(&n->conf); - if (!blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.= blk), - false, errp)) { + nvme_init_blk(n, &local_err); + if (local_err) { + error_propagate(errp, local_err); return; } =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407146; cv=none; d=zohomail.com; s=zohoarc; b=AgP0wW+MggOHiYriWOp4gQnjvrPyjrOqmENH49UwX3zO/czMUMXtQqgGPnJA5trZClAVJk2Pt1IUGWE2ngkYPAMqVematdbH7vqCGxR6MZVcBNIfx8Ij816O4v2So2VcJlNsDZkxW30B7Hn1xcqRtZOYf9CMQ4zA+ihAUHUNN6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407146; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WCMxHSIvK8NrqxtaLK1jm+7CZhdADvSuKPMRRngiERc=; b=hKl1oZ+7gHk644MWaTAYcsmQKxzjgw4GrBj9eaIUrnk7KDuBA7pjQ/QyhBlDhq9mLvrHn96zsyxXyrTUv0Z0p6mzfM1NPQXVTqQqA8W764n+nzWJLY5CD6tZnETsosoo0wU0oqiRyb0Q9EtxKBj3L/pu8xjVom1erDZCwoQjbUA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407146552922.0505989336812; Wed, 17 Jun 2020 08:19:06 -0700 (PDT) Received: from localhost ([::1]:58708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZfn-0002k8-8r for importer@patchew.org; Wed, 17 Jun 2020 11:08:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNt-00037U-L6 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:49 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:36760 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNq-0001jS-49 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:49 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-lCqjJV6EOOuB_9TTCh_UVA-1; Wed, 17 Jun 2020 10:49:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE3CF80F5F0; Wed, 17 Jun 2020 14:49:40 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 689BD7CAA0; Wed, 17 Jun 2020 14:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WCMxHSIvK8NrqxtaLK1jm+7CZhdADvSuKPMRRngiERc=; b=Ax8ZRl3fSxpIZ/y41K+fU8kYY75GtTzbGSkb4ihU3vJrhdolD9Rmh1YjINHHYLTBnZZmXV qA1JNBZO7UxhhrUPi829oI7/HJcwI2YluU+yA6MgSgQXaRI2EN6ajhXWKPn1CfAzSezQt+ RAtTAVRGTN0+JN7Tr7LdyH2qmLJimO0= X-MC-Unique: lCqjJV6EOOuB_9TTCh_UVA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 19/43] hw/block/nvme: add namespace helpers Date: Wed, 17 Jun 2020 16:48:45 +0200 Message-Id: <20200617144909.192176-20-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Introduce some small helpers to make the next patches easier on the eye. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-14-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.h | 17 +++++++++++++++++ hw/block/nvme.c | 3 +-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index cedc8022db..61dd9b23b8 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -61,6 +61,17 @@ typedef struct NvmeNamespace { NvmeIdNs id_ns; } NvmeNamespace; =20 +static inline NvmeLBAF *nvme_ns_lbaf(NvmeNamespace *ns) +{ + NvmeIdNs *id_ns =3D &ns->id_ns; + return &id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(id_ns->flbas)]; +} + +static inline uint8_t nvme_ns_lbads(NvmeNamespace *ns) +{ + return nvme_ns_lbaf(ns)->ds; +} + #define TYPE_NVME "nvme" #define NVME(obj) \ OBJECT_CHECK(NvmeCtrl, (obj), TYPE_NVME) @@ -97,4 +108,10 @@ typedef struct NvmeCtrl { NvmeIdCtrl id_ctrl; } NvmeCtrl; =20 +/* calculate the number of LBAs that the namespace can accomodate */ +static inline uint64_t nvme_ns_nlbas(NvmeCtrl *n, NvmeNamespace *ns) +{ + return n->ns_size >> nvme_ns_lbads(ns); +} + #endif /* HW_NVME_H */ diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 87f1f0d0d1..3f3db17231 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1573,8 +1573,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) id_ns->dps =3D 0; id_ns->lbaf[0].ds =3D BDRV_SECTOR_BITS; id_ns->ncap =3D id_ns->nuse =3D id_ns->nsze =3D - cpu_to_le64(n->ns_size >> - id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds); + cpu_to_le64(nvme_ns_nlbas(n, ns)); } } =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405835; cv=none; d=zohomail.com; s=zohoarc; b=gBWDRyuEqWX0ag+7Y+WgRrdEw/liyQnDWSw/62yqWW2E1TX01EMeMvngm/sXYZq3WatN2TGkDOywR9B50CgG/H7/uwiXhCaI5iXeflFycCYCNGXaiD3n5+rjT+7oh7rwpIgMIpKnD6Vj5c4X8xOo7z8/xQHWeXEuhM229J9btjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405835; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OSLtLmcReavzS0Sph2ulwbtnl2qhAbzhnvNYRCXTCc8=; b=frGOM29W6pE25UmcbLqiAbJt9vExct7OV5jWZmbVZ9jX5QudJf6ejnNf9AqRkT48Yi7Nt2w5UfJ+daMwifQq/RplWR2mDPsub7rg55VALU9hP+CKOXpGzRBFqQ5xP0VgR2+72R94ND1i5uDHO3hqjjtLE2UP2+CtRQJagSjI9oI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405835261439.52304654716363; Wed, 17 Jun 2020 07:57:15 -0700 (PDT) Received: from localhost ([::1]:49284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZV2-0001z6-Lt for importer@patchew.org; Wed, 17 Jun 2020 10:57:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNu-00038E-AQ for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:50 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:30600 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNq-0001je-5R for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:49 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-141-1198zFYzPXaRnsvHNQXgtw-1; Wed, 17 Jun 2020 10:49:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D287134D2; Wed, 17 Jun 2020 14:49:42 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 138447CAAA; Wed, 17 Jun 2020 14:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OSLtLmcReavzS0Sph2ulwbtnl2qhAbzhnvNYRCXTCc8=; b=YR6UeM4FSl+d5Egk8hNH6YAuxrMVjgJgcrkKDdIGUS2ijdq8mZfpIIONIBycCaQPkgoF7j vIORZwp0/HNw6B6SDBONE85KbZkyrLrhi9DHTI6ILliiVSzsygCgDS/cCNfMG0Q5X8MPz3 LvtAC4K6Hp9ewa0/3mjnn2A6tLidgd4= X-MC-Unique: 1198zFYzPXaRnsvHNQXgtw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 20/43] hw/block/nvme: factor out namespace setup Date: Wed, 17 Jun 2020 16:48:46 +0200 Message-Id: <20200617144909.192176-21-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-15-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 3f3db17231..c98af03f44 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1417,6 +1417,27 @@ static void nvme_init_blk(NvmeCtrl *n, Error **errp) false, errp); } =20 +static void nvme_init_namespace(NvmeCtrl *n, NvmeNamespace *ns, Error **er= rp) +{ + int64_t bs_size; + NvmeIdNs *id_ns =3D &ns->id_ns; + + bs_size =3D blk_getlength(n->conf.blk); + if (bs_size < 0) { + error_setg_errno(errp, -bs_size, "could not get backing file size"= ); + return; + } + + n->ns_size =3D bs_size; + + id_ns->lbaf[0].ds =3D BDRV_SECTOR_BITS; + id_ns->nsze =3D cpu_to_le64(nvme_ns_nlbas(n, ns)); + + /* no thin provisioning */ + id_ns->ncap =3D id_ns->nsze; + id_ns->nuse =3D id_ns->ncap; +} + static void nvme_realize(PCIDevice *pci_dev, Error **errp) { NvmeCtrl *n =3D NVME(pci_dev); @@ -1424,7 +1445,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) Error *local_err =3D NULL; =20 int i; - int64_t bs_size; uint8_t *pci_conf; =20 nvme_check_constraints(n, &local_err); @@ -1435,12 +1455,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) =20 nvme_init_state(n); =20 - bs_size =3D blk_getlength(n->conf.blk); - if (bs_size < 0) { - error_setg(errp, "could not get backing file size"); - return; - } - nvme_init_blk(n, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -1453,8 +1467,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS); pcie_endpoint_cap_init(pci_dev, 0x80); =20 - n->ns_size =3D bs_size / (uint64_t)n->num_namespaces; - memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); pci_register_bar(pci_dev, 0, @@ -1563,17 +1575,11 @@ static void nvme_realize(PCIDevice *pci_dev, Error = **errp) } =20 for (i =3D 0; i < n->num_namespaces; i++) { - NvmeNamespace *ns =3D &n->namespaces[i]; - NvmeIdNs *id_ns =3D &ns->id_ns; - id_ns->nsfeat =3D 0; - id_ns->nlbaf =3D 0; - id_ns->flbas =3D 0; - id_ns->mc =3D 0; - id_ns->dpc =3D 0; - id_ns->dps =3D 0; - id_ns->lbaf[0].ds =3D BDRV_SECTOR_BITS; - id_ns->ncap =3D id_ns->nuse =3D id_ns->nsze =3D - cpu_to_le64(nvme_ns_nlbas(n, ns)); + nvme_init_namespace(n, &n->namespaces[i], &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } } } =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405929; cv=none; d=zohomail.com; s=zohoarc; b=euuUBU4frh38+2CVVF9XOQmwZFJ3xuggQqCJgMqmkzsrelSk2BpzTRsJs577SKkCDMG2HC2jKd+lZutmamGOkCcMK8YxbZ3R6P78o57eFYo7k5Pcz5CYk/Pqj4mmm9isH7H1rlBxtf+xVVDFlejLPmvTRUar4lOOkKUkWlWjxo0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405929; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4EYn0YLgcyInod5P5CKlMLEhfPAmsvkNju5dTdEPi0w=; b=HCVtIVNXBBG6+wuQ8KTmwX3Q+Bc9Q3Or/sU4ulUoAXdYSU1IZcCpClKUl0w25LaT4BJQtMjtbkclmpbCXClI/w9NJGtscYDVRAxrDF8ggYkvQb8YKyr36PFoy8cr1zR/fWxr7tE9g9VU0xmCd+yqWk5MAhvU1jOfefzE8yXcrBE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592405929349114.60399071116842; Wed, 17 Jun 2020 07:58:49 -0700 (PDT) Received: from localhost ([::1]:57694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZWa-0005jM-2a for importer@patchew.org; Wed, 17 Jun 2020 10:58:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNv-0003BL-IF for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:51 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46868 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNs-0001jw-0n for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:51 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-LC3o_UuWMo6jIB3spxarmQ-1; Wed, 17 Jun 2020 10:49:44 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D3B78730AC; Wed, 17 Jun 2020 14:49:43 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55DE07CAA0; Wed, 17 Jun 2020 14:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4EYn0YLgcyInod5P5CKlMLEhfPAmsvkNju5dTdEPi0w=; b=D7YLDZL1u9JH2+hr66bDcAt/C/UxhOmgvOMC9NG5SYg2t4djs7xYa07Q3pic+SQF64u+As 8dU5A+fN1VpwBPpB9b7SwPPTytgydzmT5age/lcsFivIMOUr8wj8XhYC5yVKtM7fKk/f0K JV9o6b7ImEqZjhcFbFzKao8ucSs9128= X-MC-Unique: LC3o_UuWMo6jIB3spxarmQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 21/43] hw/block/nvme: factor out pci setup Date: Wed, 17 Jun 2020 16:48:47 +0200 Message-Id: <20200617144909.192176-22-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-16-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index c98af03f44..a4022b0291 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1438,6 +1438,22 @@ static void nvme_init_namespace(NvmeCtrl *n, NvmeNam= espace *ns, Error **errp) id_ns->nuse =3D id_ns->ncap; } =20 +static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev) +{ + uint8_t *pci_conf =3D pci_dev->config; + + pci_conf[PCI_INTERRUPT_PIN] =3D 1; + pci_config_set_prog_interface(pci_conf, 0x2); + pci_config_set_class(pci_conf, PCI_CLASS_STORAGE_EXPRESS); + pcie_endpoint_cap_init(pci_dev, 0x80); + + memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", + n->reg_size); + pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | + PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); + msix_init_exclusive_bar(pci_dev, n->params.max_ioqpairs + 1, 4, NULL); +} + static void nvme_realize(PCIDevice *pci_dev, Error **errp) { NvmeCtrl *n =3D NVME(pci_dev); @@ -1461,19 +1477,9 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) return; } =20 - pci_conf =3D pci_dev->config; - pci_conf[PCI_INTERRUPT_PIN] =3D 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(pci_dev, 0x80); - - memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, - "nvme", n->reg_size); - pci_register_bar(pci_dev, 0, - PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, - &n->iomem); - msix_init_exclusive_bar(pci_dev, n->params.max_ioqpairs + 1, 4, NULL); + nvme_init_pci(n, pci_dev); =20 + pci_conf =3D pci_dev->config; id->vid =3D cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid =3D cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR= _ID)); strpadcpy((char *)id->mn, sizeof(id->mn), "QEMU NVMe Ctrl", ' '); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592405869; cv=none; d=zohomail.com; s=zohoarc; b=EkQ98hKjyhPPtKg2kySk0hqeNNenk9vJKDO65sOYndQZLTGUpwIWBcOtT44TR1JxDITFanj3LLKKE3FGYnl7eBAIsXjQGznz/hhxNMdaFxokF83b3nB5keoW/KVTRYADwMGGP6FQe8N/Wr/yt/Ab/M391Uzfgg3Hd2oGlH5EohQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592405869; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kYEy4CSlUwYadDuzhQLAHzO3vI5ceB/8XHO+tzwcPP0=; b=nW/SQRx2tKhPa5t5/GfMfpWXx3i0nsuJO2Mi+H6si6LPAWYdrz8b4+p3VkXqjKDsH6H4OAqvq/mOSaHan70geianrC7VPC4B/OgxcIHMMOB3p2VCODRLeSAFwEvvWswZesh6cR/5Yr9ADrIFIdJkvYosShwu4rFIakdVQM11A/M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159240586987262.979088762603396; Wed, 17 Jun 2020 07:57:49 -0700 (PDT) Received: from localhost ([::1]:52822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZVc-0003WK-Ex for importer@patchew.org; Wed, 17 Jun 2020 10:57:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNw-0003Em-Qz for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:52 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:35253 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNu-0001kV-Gt for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-176-3HKbV3FNPQeMIVkgd9OXIA-1; Wed, 17 Jun 2020 10:49:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91E241091337; Wed, 17 Jun 2020 14:49:44 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 967847CAAA; Wed, 17 Jun 2020 14:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kYEy4CSlUwYadDuzhQLAHzO3vI5ceB/8XHO+tzwcPP0=; b=EdzSn4a7c2TP4zY4QCDN22qJC6TudYKAjVxcVVxWpR2PkBBkwRBG6DvfBN/kbUlUckw8e4 BwnOEFBXzBInrZzsamWEyS7u4KHnN/xxpKLbocNmGu9dSkpAjAE4U8XWL7dJLHXwwqb0hx vens4PvLh3/WpTd1IGHmjl4rOCkN/pc= X-MC-Unique: 3HKbV3FNPQeMIVkgd9OXIA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 22/43] hw/block/nvme: factor out cmb setup Date: Wed, 17 Jun 2020 16:48:48 +0200 Message-Id: <20200617144909.192176-23-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-17-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index a4022b0291..8aabb4c3c3 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -56,6 +56,7 @@ =20 #define NVME_REG_SIZE 0x1000 #define NVME_DB_SIZE 4 +#define NVME_CMB_BIR 2 =20 #define NVME_GUEST_ERR(trace, fmt, ...) \ do { \ @@ -1438,6 +1439,28 @@ static void nvme_init_namespace(NvmeCtrl *n, NvmeNam= espace *ns, Error **errp) id_ns->nuse =3D id_ns->ncap; } =20 +static void nvme_init_cmb(NvmeCtrl *n, PCIDevice *pci_dev) +{ + NVME_CMBLOC_SET_BIR(n->bar.cmbloc, NVME_CMB_BIR); + NVME_CMBLOC_SET_OFST(n->bar.cmbloc, 0); + + NVME_CMBSZ_SET_SQS(n->bar.cmbsz, 1); + NVME_CMBSZ_SET_CQS(n->bar.cmbsz, 0); + NVME_CMBSZ_SET_LISTS(n->bar.cmbsz, 0); + NVME_CMBSZ_SET_RDS(n->bar.cmbsz, 1); + NVME_CMBSZ_SET_WDS(n->bar.cmbsz, 1); + NVME_CMBSZ_SET_SZU(n->bar.cmbsz, 2); /* MBs */ + NVME_CMBSZ_SET_SZ(n->bar.cmbsz, n->params.cmb_size_mb); + + n->cmbuf =3D 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(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); +} + static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev) { uint8_t *pci_conf =3D pci_dev->config; @@ -1514,25 +1537,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) n->bar.intmc =3D n->bar.intms =3D 0; =20 if (n->params.cmb_size_mb) { - - NVME_CMBLOC_SET_BIR(n->bar.cmbloc, 2); - NVME_CMBLOC_SET_OFST(n->bar.cmbloc, 0); - - NVME_CMBSZ_SET_SQS(n->bar.cmbsz, 1); - NVME_CMBSZ_SET_CQS(n->bar.cmbsz, 0); - NVME_CMBSZ_SET_LISTS(n->bar.cmbsz, 0); - NVME_CMBSZ_SET_RDS(n->bar.cmbsz, 1); - NVME_CMBSZ_SET_WDS(n->bar.cmbsz, 1); - NVME_CMBSZ_SET_SZU(n->bar.cmbsz, 2); /* MBs */ - NVME_CMBSZ_SET_SZ(n->bar.cmbsz, n->params.cmb_size_mb); - - n->cmbuf =3D 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(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); - + nvme_init_cmb(n, pci_dev); } else if (n->pmrdev) { /* Controller Capabilities register */ NVME_CAP_SET_PMRS(n->bar.cap, 1); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406815; cv=none; d=zohomail.com; s=zohoarc; b=kr53l/SGctpnwvToT8eDcMBi9+udeaqiIDC3oXSF+Qno5SmoHBxgwrl6RXHbGih22YEWEheDv0Nws4ObgmHQ/YMa4y4ysH5Xjab4tm92W6prKs2zZuPwEZvVgCUmoeiFJVsaFnQOkMJB8XdgPS6TOP/KVTmzPUxtbRQTOecZSYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406815; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pyK2MsouuN6zHcH+tYkXVojAXdDXYRw821r2LOw8TmE=; b=j4hDcz+ks+JlBf6Dd8PHdqmu8vgNp7JUMWa7O3hO9zOl5QsDvTb8XCKHNuKQbvX5XtUaL16Zf7U7QgIflwYc4LWfHmerUUNLup2e/vwRmak2gQbQg9PH5YHYeBI3lIqgh5YvSEJit+kjN2XJ22Iduj1M6upeuxjGzKTjWgiDKQI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592406815589173.7370649453536; Wed, 17 Jun 2020 08:13:35 -0700 (PDT) Received: from localhost ([::1]:50426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZks-0003RD-A2 for importer@patchew.org; Wed, 17 Jun 2020 11:13:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNz-0003K5-8i for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:41471 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNw-0001l3-7s for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281-LISF0vxCPma-Q18bvFTpww-1; Wed, 17 Jun 2020 10:49:46 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D342A8730AC; Wed, 17 Jun 2020 14:49:45 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB2D77CAA0; Wed, 17 Jun 2020 14:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405391; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pyK2MsouuN6zHcH+tYkXVojAXdDXYRw821r2LOw8TmE=; b=d4zNNw1FkIrP/LVzeKGEjBYspkl9Y7X8ugzRO8wKy4tV53NDrDcngGugOgOrjm0srJU5uV YTAQQsMb7nfnfqhNEU6m211m6OLOiugW3PgXe5I9Dwtrogl+scAC2dJdQi7VM0h/PiR/bp aThPJeSEv/DzwDY/afrlkaXQNDSvA/I= X-MC-Unique: LISF0vxCPma-Q18bvFTpww-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 23/43] hw/block/nvme: factor out pmr setup Date: Wed, 17 Jun 2020 16:48:49 +0200 Message-Id: <20200617144909.192176-24-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200609190333.59390-18-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 95 ++++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 44 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 8aabb4c3c3..b954e7b7b2 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -57,6 +57,7 @@ #define NVME_REG_SIZE 0x1000 #define NVME_DB_SIZE 4 #define NVME_CMB_BIR 2 +#define NVME_PMR_BIR 2 =20 #define NVME_GUEST_ERR(trace, fmt, ...) \ do { \ @@ -1461,6 +1462,55 @@ static void nvme_init_cmb(NvmeCtrl *n, PCIDevice *pc= i_dev) PCI_BASE_ADDRESS_MEM_PREFETCH, &n->ctrl_mem); } =20 +static void nvme_init_pmr(NvmeCtrl *n, PCIDevice *pci_dev) +{ + /* Controller Capabilities register */ + NVME_CAP_SET_PMRS(n->bar.cap, 1); + + /* PMR Capabities register */ + n->bar.pmrcap =3D 0; + NVME_PMRCAP_SET_RDS(n->bar.pmrcap, 0); + NVME_PMRCAP_SET_WDS(n->bar.pmrcap, 0); + NVME_PMRCAP_SET_BIR(n->bar.pmrcap, NVME_PMR_BIR); + NVME_PMRCAP_SET_PMRTU(n->bar.pmrcap, 0); + /* Turn on bit 1 support */ + NVME_PMRCAP_SET_PMRWBM(n->bar.pmrcap, 0x02); + NVME_PMRCAP_SET_PMRTO(n->bar.pmrcap, 0); + NVME_PMRCAP_SET_CMSS(n->bar.pmrcap, 0); + + /* PMR Control register */ + n->bar.pmrctl =3D 0; + NVME_PMRCTL_SET_EN(n->bar.pmrctl, 0); + + /* PMR Status register */ + n->bar.pmrsts =3D 0; + NVME_PMRSTS_SET_ERR(n->bar.pmrsts, 0); + NVME_PMRSTS_SET_NRDY(n->bar.pmrsts, 0); + NVME_PMRSTS_SET_HSTS(n->bar.pmrsts, 0); + NVME_PMRSTS_SET_CBAI(n->bar.pmrsts, 0); + + /* PMR Elasticity Buffer Size register */ + n->bar.pmrebs =3D 0; + NVME_PMREBS_SET_PMRSZU(n->bar.pmrebs, 0); + NVME_PMREBS_SET_RBB(n->bar.pmrebs, 0); + NVME_PMREBS_SET_PMRWBZ(n->bar.pmrebs, 0); + + /* PMR Sustained Write Throughput register */ + n->bar.pmrswtp =3D 0; + NVME_PMRSWTP_SET_PMRSWTU(n->bar.pmrswtp, 0); + NVME_PMRSWTP_SET_PMRSWTV(n->bar.pmrswtp, 0); + + /* PMR Memory Space Control register */ + n->bar.pmrmsc =3D 0; + NVME_PMRMSC_SET_CMSE(n->bar.pmrmsc, 0); + NVME_PMRMSC_SET_CBA(n->bar.pmrmsc, 0); + + pci_register_bar(pci_dev, NVME_PMRCAP_BIR(n->bar.pmrcap), + PCI_BASE_ADDRESS_SPACE_MEMORY | + PCI_BASE_ADDRESS_MEM_TYPE_64 | + PCI_BASE_ADDRESS_MEM_PREFETCH, &n->pmrdev->mr); +} + static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev) { uint8_t *pci_conf =3D pci_dev->config; @@ -1539,50 +1589,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) if (n->params.cmb_size_mb) { nvme_init_cmb(n, pci_dev); } else if (n->pmrdev) { - /* Controller Capabilities register */ - NVME_CAP_SET_PMRS(n->bar.cap, 1); - - /* PMR Capabities register */ - n->bar.pmrcap =3D 0; - NVME_PMRCAP_SET_RDS(n->bar.pmrcap, 0); - NVME_PMRCAP_SET_WDS(n->bar.pmrcap, 0); - NVME_PMRCAP_SET_BIR(n->bar.pmrcap, 2); - NVME_PMRCAP_SET_PMRTU(n->bar.pmrcap, 0); - /* Turn on bit 1 support */ - NVME_PMRCAP_SET_PMRWBM(n->bar.pmrcap, 0x02); - NVME_PMRCAP_SET_PMRTO(n->bar.pmrcap, 0); - NVME_PMRCAP_SET_CMSS(n->bar.pmrcap, 0); - - /* PMR Control register */ - n->bar.pmrctl =3D 0; - NVME_PMRCTL_SET_EN(n->bar.pmrctl, 0); - - /* PMR Status register */ - n->bar.pmrsts =3D 0; - NVME_PMRSTS_SET_ERR(n->bar.pmrsts, 0); - NVME_PMRSTS_SET_NRDY(n->bar.pmrsts, 0); - NVME_PMRSTS_SET_HSTS(n->bar.pmrsts, 0); - NVME_PMRSTS_SET_CBAI(n->bar.pmrsts, 0); - - /* PMR Elasticity Buffer Size register */ - n->bar.pmrebs =3D 0; - NVME_PMREBS_SET_PMRSZU(n->bar.pmrebs, 0); - NVME_PMREBS_SET_RBB(n->bar.pmrebs, 0); - NVME_PMREBS_SET_PMRWBZ(n->bar.pmrebs, 0); - - /* PMR Sustained Write Throughput register */ - n->bar.pmrswtp =3D 0; - NVME_PMRSWTP_SET_PMRSWTU(n->bar.pmrswtp, 0); - NVME_PMRSWTP_SET_PMRSWTV(n->bar.pmrswtp, 0); - - /* PMR Memory Space Control register */ - n->bar.pmrmsc =3D 0; - NVME_PMRMSC_SET_CMSE(n->bar.pmrmsc, 0); - NVME_PMRMSC_SET_CBA(n->bar.pmrmsc, 0); - - pci_register_bar(pci_dev, NVME_PMRCAP_BIR(n->bar.pmrcap), - PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64 | - PCI_BASE_ADDRESS_MEM_PREFETCH, &n->pmrdev->mr); + nvme_init_pmr(n, pci_dev); } =20 for (i =3D 0; i < n->num_namespaces; i++) { --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406908; cv=none; d=zohomail.com; s=zohoarc; b=S9I6q3eLSAwZUN0jvvLMikkWq2Jc9mtAjyNAMvXZ8ujyk09dRebC3ryznEYG3uoZGFjGKVeOrPSos+oDWM6LLz/iJMSAwkHE+1WYIOykgaPSEJ+zy5N2pVCOYa/4ctz+dKxpjD+RcYv6BBMtAH+XzU6Fg9bG1gH1mwdGI5Gv1nY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406908; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kCaCGtGblgI3hJl6i1ZVHNtUUPvTH+cLuXwuP+Y1FFg=; b=itHABtAS9oitaYom5xJY2MNa+Jyc9PE29PWmCo2nM4i1Q24ROfVDexueTGtn+RRXjsHg0ijHjDFjG2vprofPOP3ovQ7myrkoR/W7Hf+e37hWoz2d4+9c4q093z8eO5HLyptCqVOwXcDDaJtCRWP7UCJw14ZhXD/AY/Sk971L9hk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592406908055539.4999374288118; Wed, 17 Jun 2020 08:15:08 -0700 (PDT) Received: from localhost ([::1]:38766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZhk-0006T7-TE for importer@patchew.org; Wed, 17 Jun 2020 11:10:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZNx-0003FM-9H for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:53 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:53334 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNu-0001kf-QC for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-217-HZDPbELsOAuNDVr9Z90cmw-1; Wed, 17 Jun 2020 10:49:48 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EAE01091333; Wed, 17 Jun 2020 14:49:47 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 287807CAA0; Wed, 17 Jun 2020 14:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kCaCGtGblgI3hJl6i1ZVHNtUUPvTH+cLuXwuP+Y1FFg=; b=Ze54h3Qeki39fBDmdCQj0kJpiN0iPb4XjKYe0mHKRmuetxt48tToZjkDQiImN0TwcCqZ3S pz0SLdjsgVh3GCHGFbDFqIwT+Jv2mkLVcOpUa5KK4kTdcdi0JcoGSTcaSdw0InZQ7eWpcL TgtP5BLefzaQaqNUiDucPPARLP5p+0U= X-MC-Unique: HZDPbELsOAuNDVr9Z90cmw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 24/43] hw/block/nvme: do cmb/pmr init as part of pci init Date: Wed, 17 Jun 2020 16:48:50 +0200 Message-Id: <20200617144909.192176-25-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200609190333.59390-19-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index b954e7b7b2..02a6a97df9 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1525,6 +1525,12 @@ static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pc= i_dev) pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); msix_init_exclusive_bar(pci_dev, n->params.max_ioqpairs + 1, 4, NULL); + + if (n->params.cmb_size_mb) { + nvme_init_cmb(n, pci_dev); + } else if (n->pmrdev) { + nvme_init_pmr(n, pci_dev); + } } =20 static void nvme_realize(PCIDevice *pci_dev, Error **errp) @@ -1586,12 +1592,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) n->bar.vs =3D 0x00010200; n->bar.intmc =3D n->bar.intms =3D 0; =20 - if (n->params.cmb_size_mb) { - nvme_init_cmb(n, pci_dev); - } else if (n->pmrdev) { - nvme_init_pmr(n, pci_dev); - } - for (i =3D 0; i < n->num_namespaces; i++) { nvme_init_namespace(n, &n->namespaces[i], &local_err); if (local_err) { --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406131; cv=none; d=zohomail.com; s=zohoarc; b=F8UeuMKJ2Yl8BkpI8455VBAgim9Syamf9MCQZh8SzmfgtbeMW/vsnYa0QFAYEDfGDHl0DyXM2Kg5DZy1o+VZQalfbZO61TaLx/pncxmqtYFq/hSrjXBKOtwihGBPwUGGuz20GWVpZF8+ThVouMnk5qV3lBVj3F4Tr5zKN/heQI8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406131; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RtliEl+YCN3TfhiPvfmCF89LvF3CEG5dcqYVRAtnlzo=; b=Ikog6Newwfy8MO/LkjXFY5FcHSimBbnGVffzMziCclLdeQcxxZT5eeoScEWKe6IpW6t80A4qekj/7ibgIfqc+ohoEAjeEkdia/QfHWs+IGTt+HXcfRT6wyhbfIX5ta46ZXcyX1r60gg9yAQ5X3rbf4s7TDm7CTjGnCRLcjSJ13k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159240613178631.871058436683484; Wed, 17 Jun 2020 08:02:11 -0700 (PDT) Received: from localhost ([::1]:39126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZZq-0001qV-SD for importer@patchew.org; Wed, 17 Jun 2020 11:02:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZO1-0003M2-3y for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:58 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:36741 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNy-0001lZ-BS for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:55 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-luSJxr7bOMyitVRSqMil8g-1; Wed, 17 Jun 2020 10:49:49 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FCB2100CCCB; Wed, 17 Jun 2020 14:49:48 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68B427CAA0; Wed, 17 Jun 2020 14:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RtliEl+YCN3TfhiPvfmCF89LvF3CEG5dcqYVRAtnlzo=; b=h5NNodtx1mVLpy5RYqsdRF44EgIcqOXyhydykeWUtxJx0yFcZJjjeMHFRrnctbsZgtcHB4 Xh8/MVMNyD24pV5GMD1hOWpIXTtRGO8iWnhni5+lrKxggvS1oToPRYymv5CafMW2AyBvI2 gVSR5YicvdSf5QBDlext+fBE6yZ9vqI= X-MC-Unique: luSJxr7bOMyitVRSqMil8g-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 25/43] hw/block/nvme: factor out controller identify setup Date: Wed, 17 Jun 2020 16:48:51 +0200 Message-Id: <20200617144909.192176-26-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Maxim Levitsky Reviewed-by: Keith Busch Message-Id: <20200609190333.59390-20-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 02a6a97df9..e10fc774fc 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1533,32 +1533,11 @@ static void nvme_init_pci(NvmeCtrl *n, PCIDevice *p= ci_dev) } } =20 -static void nvme_realize(PCIDevice *pci_dev, Error **errp) +static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev) { - NvmeCtrl *n =3D NVME(pci_dev); NvmeIdCtrl *id =3D &n->id_ctrl; - Error *local_err =3D NULL; - - int i; - uint8_t *pci_conf; - - nvme_check_constraints(n, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - - nvme_init_state(n); - - nvme_init_blk(n, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - - nvme_init_pci(n, pci_dev); + uint8_t *pci_conf =3D pci_dev->config; =20 - pci_conf =3D pci_dev->config; id->vid =3D cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid =3D cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR= _ID)); strpadcpy((char *)id->mn, sizeof(id->mn), "QEMU NVMe Ctrl", ' '); @@ -1591,6 +1570,30 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) =20 n->bar.vs =3D 0x00010200; n->bar.intmc =3D n->bar.intms =3D 0; +} + +static void nvme_realize(PCIDevice *pci_dev, Error **errp) +{ + NvmeCtrl *n =3D NVME(pci_dev); + Error *local_err =3D NULL; + + int i; + + nvme_check_constraints(n, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + nvme_init_state(n); + nvme_init_blk(n, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + nvme_init_pci(n, pci_dev); + nvme_init_ctrl(n, pci_dev); =20 for (i =3D 0; i < n->num_namespaces; i++) { nvme_init_namespace(n, &n->namespaces[i], &local_err); --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406013; cv=none; d=zohomail.com; s=zohoarc; b=IrW9aRqKqqlftcpuk34qrrkGaEZxZlZJfrBGGqQxPP409lM3l9bnHHCTQvcT4r/4tfgSO0+D/kDAdDSoXhcoBsSObpoFTa/Nwums23S1P0zQi/QmI9C/HWSGeWLUniidAFRii+sODpTE7HoDRPFV2R+p04Re51Su+wzaKuxxxMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406013; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uy5ich4VT/VB6LLjP8nA02pW5jPVY/jmocAF5nozH+o=; b=Pw0fV9WKAcH6cjPAMYfeuS2SBUc50hywdGCxMprVRI/a7vO+JQ9tCa2KActlY4A5kZW4g9bgjbkLuX3GNJ1UpPsiLF2aji88NAL7C9dEXUW3KP5CrTIs9Ltjbkig7CYRuGcegEHIYlIVuvjA+VATKTDeEl4syByaDXOld0Bh5AQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592406013933719.6524575365715; Wed, 17 Jun 2020 08:00:13 -0700 (PDT) Received: from localhost ([::1]:34378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZXx-0007mH-0B for importer@patchew.org; Wed, 17 Jun 2020 11:00:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZO3-0003Nq-09 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:59 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46454 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZO0-0001m7-UL for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:58 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-DX5p0snINXmGJtLZ3A-qAg-1; Wed, 17 Jun 2020 10:49:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A17AE8730B2; Wed, 17 Jun 2020 14:49:49 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id A95F57CAA0; Wed, 17 Jun 2020 14:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uy5ich4VT/VB6LLjP8nA02pW5jPVY/jmocAF5nozH+o=; b=KO8M6ECVbnLg8/dS+Y9gGIVkcGedeSuAF+dlwFaaXbnJgQEtqs/9It++HaWN1xis+IJ43L jNkjIjAJptppgXmawcP+hAunN3xYxYzNbVW7GIE+W3/1mJo4hPmqjtBzp+QEuSZqmTDwIh KBaF4N33Bxkj4j+7dMqXgcaxXofcdLA= X-MC-Unique: DX5p0snINXmGJtLZ3A-qAg-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 26/43] hw/block/nvme: Verify msix_vector_use() returned value Date: Wed, 17 Jun 2020 16:48:52 +0200 Message-Id: <20200617144909.192176-27-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 msix_vector_use() returns -EINVAL on error. Assert it won't. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200609190333.59390-21-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index e10fc774fc..fe17aa5d70 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -615,6 +615,10 @@ static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeCmd *cmd) static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr, uint16_t cqid, uint16_t vector, uint16_t size, uint16_t irq_enabled) { + int ret; + + ret =3D msix_vector_use(&n->parent_obj, vector); + assert(ret =3D=3D 0); cq->ctrl =3D n; cq->cqid =3D cqid; cq->size =3D size; @@ -625,7 +629,6 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, u= int64_t dma_addr, cq->head =3D cq->tail =3D 0; QTAILQ_INIT(&cq->req_list); QTAILQ_INIT(&cq->sq_list); - msix_vector_use(&n->parent_obj, cq->vector); n->cq[cqid] =3D cq; cq->timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_post_cqes, cq); } --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407180; cv=none; d=zohomail.com; s=zohoarc; b=adLfpMY6+OIjWmJ55kbJnWwdM/DhvQEz0O9KS2gn8y2iRTbyI7SUJIVA/kN588j1dMrlinJRw+oBG8EpvBN0S+8p3K0qnX6KnbfqmvSCFQwzN7svOClRndtoHfh5bwq5tPwB8esOMBox2+fcP3Df8iN2fL+PmiIdljIdw+E0V90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407180; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iMaGkIV4H/VcvnLuJFfX383qw/BOg4LMNlsgAjuJ2uc=; b=EOzOfVOPeJZzKMteRGn8fhpWBHWDj5daGO8frQoz52hjyyTk4UdWHeVBOQr8qAh2TqEWVHn8vp4bTpTB3sWQPUQMcJ710rGf4KjjHeD+H6OqI+WwjXVojMVLuVYZXEhAeR3hRtO33KA036ut+KI3h/CiVVWX7kEfXumRuGjL1ao= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407180605957.0236402053499; Wed, 17 Jun 2020 08:19:40 -0700 (PDT) Received: from localhost ([::1]:50898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZdo-0007Wo-7u for importer@patchew.org; Wed, 17 Jun 2020 11:06:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZO1-0003MM-Ok for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:58 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:30534 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZNy-0001lm-RU for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:57 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-173-1gMgQpKYOtqvytETexVz5A-1; Wed, 17 Jun 2020 10:49:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E352480331A; Wed, 17 Jun 2020 14:49:50 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC0627CAA0; Wed, 17 Jun 2020 14:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iMaGkIV4H/VcvnLuJFfX383qw/BOg4LMNlsgAjuJ2uc=; b=Q/gDuapAB+NnbQmZYrKgSXO+EcdGuQoUUvFLk9WPPLKJ5MAbpuFgah7oSxVjgTxwDUWM8i Se+IkLfB9uX7snWheJlhz0xmUcRvFeiUJG0d5CEiyb2XjxBvvvTXpRYiv8ed3/dxmvGZf6 HPGXkDDSAoRbTx5xg1pf0tECXrEH2TI= X-MC-Unique: 1gMgQpKYOtqvytETexVz5A-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 27/43] hw/block/nvme: add msix_qsize parameter Date: Wed, 17 Jun 2020 16:48:53 +0200 Message-Id: <20200617144909.192176-28-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Decouple the requested maximum number of ioqpairs (param max_ioqpairs) from the number of MSI-X interrupt vectors by introducing a new msix_qsize parameter and initialize MSI-X with that. This allows emulating a device that has fewer vectors than I/O queue pairs and also allows more than 2048 queue pairs. To keep the device behaving as previously, use a msix_qsize default of 65 (default max_ioqpairs + 1). This decoupling was actually suggested by Maxim some time ago in a slightly different context, so adding a Suggested-by. Suggested-by: Maxim Levitsky Signed-off-by: Klaus Jensen Message-Id: <20200609190333.59390-22-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.h | 1 + hw/block/nvme.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.h b/hw/block/nvme.h index 61dd9b23b8..1d30c0bca2 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -7,6 +7,7 @@ typedef struct NvmeParams { char *serial; uint32_t num_queues; /* deprecated since 5.1 */ uint32_t max_ioqpairs; + uint16_t msix_qsize; uint32_t cmb_size_mb; } NvmeParams; =20 diff --git a/hw/block/nvme.c b/hw/block/nvme.c index fe17aa5d70..acc6dbc900 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -54,6 +54,7 @@ #include "trace.h" #include "nvme.h" =20 +#define NVME_MAX_IOQPAIRS 0xffff #define NVME_REG_SIZE 0x1000 #define NVME_DB_SIZE 4 #define NVME_CMB_BIR 2 @@ -662,7 +663,7 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeCmd *cm= d) trace_pci_nvme_err_invalid_create_cq_vector(vector); return NVME_INVALID_IRQ_VECTOR | NVME_DNR; } - if (unlikely(vector > n->params.max_ioqpairs)) { + if (unlikely(vector >=3D n->params.msix_qsize)) { trace_pci_nvme_err_invalid_create_cq_vector(vector); return NVME_INVALID_IRQ_VECTOR | NVME_DNR; } @@ -1371,9 +1372,16 @@ static void nvme_check_constraints(NvmeCtrl *n, Erro= r **errp) } =20 if (params->max_ioqpairs < 1 || - params->max_ioqpairs > PCI_MSIX_FLAGS_QSIZE) { + params->max_ioqpairs > NVME_MAX_IOQPAIRS) { error_setg(errp, "max_ioqpairs must be between 1 and %d", - PCI_MSIX_FLAGS_QSIZE); + NVME_MAX_IOQPAIRS); + return; + } + + if (params->msix_qsize < 1 || + params->msix_qsize > PCI_MSIX_FLAGS_QSIZE + 1) { + error_setg(errp, "msix_qsize must be between 1 and %d", + PCI_MSIX_FLAGS_QSIZE + 1); return; } =20 @@ -1527,7 +1535,7 @@ static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci= _dev) n->reg_size); pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); - msix_init_exclusive_bar(pci_dev, n->params.max_ioqpairs + 1, 4, NULL); + msix_init_exclusive_bar(pci_dev, n->params.msix_qsize, 4, NULL); =20 if (n->params.cmb_size_mb) { nvme_init_cmb(n, pci_dev); @@ -1634,6 +1642,7 @@ static Property nvme_props[] =3D { DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, params.cmb_size_mb, 0), DEFINE_PROP_UINT32("num_queues", NvmeCtrl, params.num_queues, 0), DEFINE_PROP_UINT32("max_ioqpairs", NvmeCtrl, params.max_ioqpairs, 64), + DEFINE_PROP_UINT16("msix_qsize", NvmeCtrl, params.msix_qsize, 65), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407181; cv=none; d=zohomail.com; s=zohoarc; b=gnWRnTYM9UNboOAKyaO0ZK9U/c28ux9EMyGb0qG75h4ucmJGvnGvRXBIJTQ1MY6lSh366TmsNMhBLxcxC8Lz97beGtrjC05zEPf+UmLe24U3d1kYwb0uQOcnWWDSklrbWQ0RjfshXSpHrZ0ryRgLA9LEMwuRvH+jsz3AIRfmDPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407181; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vLvr08dl856z5pwql72CFgRjGAy1S559L7/FJIEOUUk=; b=f9vTDP7qPtUlfrgoG1LKyuEMRqD10X8x+xdZ6fB4p2YReWlycobFOjY8eIcfBsDopwDU0/Vf/lFVBRIgBqUXOv9bdFDrTgYZioGf50f71edz5bfe3D3ELFWvSZUBKFvq8oxSFw7TKKz6bdPI2v2xD4DX05OTWbs/q7dqnDhJpVY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407181529586.5051307206465; Wed, 17 Jun 2020 08:19:41 -0700 (PDT) Received: from localhost ([::1]:59056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZfq-0002tR-Qd for importer@patchew.org; Wed, 17 Jun 2020 11:08:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZO3-0003Ok-Lq for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:00 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52708 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZO0-0001mM-TR for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:59 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-297-iqx5X3ykM6G-Z8FxDMC1Qw-1; Wed, 17 Jun 2020 10:49:53 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 302CF18A266A; Wed, 17 Jun 2020 14:49:52 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3944A7CAA0; Wed, 17 Jun 2020 14:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405395; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vLvr08dl856z5pwql72CFgRjGAy1S559L7/FJIEOUUk=; b=PuOIu/hKQyn41niWauKIjQDz+XvvR6QXaF503UaHEIPgmTi45UUcN7ry+bNPV+rEvgCHCe 5DAVGGlqiADG2OLa7DEQmXNKEGIi4z7IkFSIBmOcCDzI2LeyKmUcGQNGLq/uM9Sk1TCKUO c/TCe9X8E+HxFN3ej11DBSlWh+x7QmI= X-MC-Unique: iqx5X3ykM6G-Z8FxDMC1Qw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 28/43] hw/block/nvme: verify msix_init_exclusive_bar() return value Date: Wed, 17 Jun 2020 16:48:54 +0200 Message-Id: <20200617144909.192176-29-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Pass an Error to msix_init_exclusive_bar() and check it. Signed-off-by: Klaus Jensen Message-Id: <20200609190333.59390-23-its@irrelevant.dk> Signed-off-by: Kevin Wolf --- hw/block/nvme.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index acc6dbc900..2a2e43f681 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1522,7 +1522,7 @@ static void nvme_init_pmr(NvmeCtrl *n, PCIDevice *pci= _dev) PCI_BASE_ADDRESS_MEM_PREFETCH, &n->pmrdev->mr); } =20 -static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev) +static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp) { uint8_t *pci_conf =3D pci_dev->config; =20 @@ -1535,7 +1535,9 @@ static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci= _dev) n->reg_size); pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); - msix_init_exclusive_bar(pci_dev, n->params.msix_qsize, 4, NULL); + if (msix_init_exclusive_bar(pci_dev, n->params.msix_qsize, 4, errp)) { + return; + } =20 if (n->params.cmb_size_mb) { nvme_init_cmb(n, pci_dev); @@ -1603,7 +1605,12 @@ static void nvme_realize(PCIDevice *pci_dev, Error *= *errp) return; } =20 - nvme_init_pci(n, pci_dev); + nvme_init_pci(n, pci_dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + nvme_init_ctrl(n, pci_dev); =20 for (i =3D 0; i < n->num_namespaces; i++) { --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407080; cv=none; d=zohomail.com; s=zohoarc; b=Cm/vSm9lZcg5RhuCDoP67czyycDoRHbmLMhDft/dG2k/RJ3uYmEj5cZhUkO/3iZnHKGk3iYYS84X7fBZeGZkHXpha4cYc2FR6LtZ43AR3H71rlh+FUuQbHwV+Jj7xIJCkSJlAQrcqL77Sv6MQdiSX8TXaFoKNIRWYHKSTXg8kWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407080; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eNkFvaj4dyE8+3xm5mpLxjxl0tkxOUKwoofudZ84/Lo=; b=hSLj+ovMEGLCBOCTuc4Zt8PSqKjAkvtMTmmYglhkG3z7hh7Nz5C9RwfTSkbd6tQLjS7mEZMmvgB2k5/HzsV85VGrHsgokP9YjrBa2hrbO7l7AkVgwjhWkafbTD6GmibR3R3fATclC9kU2juzLTo+GHXTQYH1VKLIJbJxfxbzCmw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407079977612.6307226071152; Wed, 17 Jun 2020 08:17:59 -0700 (PDT) Received: from localhost ([::1]:37650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZp8-0001xs-7R for importer@patchew.org; Wed, 17 Jun 2020 11:17:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOA-0003Wz-8v for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:06 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43557 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZO6-0001na-6T for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:04 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-uZv1vobLNBGmoxO4k0QzXw-1; Wed, 17 Jun 2020 10:49:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E49480331A; Wed, 17 Jun 2020 14:49:53 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A4237CAAA; Wed, 17 Jun 2020 14:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eNkFvaj4dyE8+3xm5mpLxjxl0tkxOUKwoofudZ84/Lo=; b=gVBHLkMO4KxGETBmo8J0Nh8Ig1BPMNiO5uvXCJQiyDEAhIQkOqsR5Xz6lJf1iuoUPNEvPS 0bx2JsX2xWfJfl+UMID0CL0GgPood91j7MPphfpgir8uQWwXZGp0e3mjsnJ5cMub4yLn08 /KSPZgzbp8B1B//4vNn0R8QtNVWkG+8= X-MC-Unique: uZv1vobLNBGmoxO4k0QzXw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 29/43] .gitignore: Ignore storage-daemon files Date: Wed, 17 Jun 2020 16:48:55 +0200 Message-Id: <20200617144909.192176-30-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Roman Bolshakov The files are generated. Fixes: 2af282ec51a ("qemu-storage-daemon: Add --monitor option") Cc: Kevin Wolf Signed-off-by: Roman Bolshakov Message-Id: <20200612105830.17082-1-r.bolshakov@yadro.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Kevin Wolf --- .gitignore | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 0c5af83aa7..90acb4347d 100644 --- a/.gitignore +++ b/.gitignore @@ -34,18 +34,18 @@ /qapi/qapi-builtin-types.[ch] /qapi/qapi-builtin-visit.[ch] /qapi/qapi-commands-*.[ch] -/qapi/qapi-commands.[ch] -/qapi/qapi-emit-events.[ch] +**/qapi/qapi-commands.[ch] +**/qapi/qapi-emit-events.[ch] /qapi/qapi-events-*.[ch] -/qapi/qapi-events.[ch] -/qapi/qapi-init-commands.[ch] -/qapi/qapi-introspect.[ch] +**/qapi/qapi-events.[ch] +**/qapi/qapi-init-commands.[ch] +**/qapi/qapi-introspect.[ch] /qapi/qapi-types-*.[ch] -/qapi/qapi-types.[ch] +**/qapi/qapi-types.[ch] /qapi/qapi-visit-*.[ch] !/qapi/qapi-visit-core.c -/qapi/qapi-visit.[ch] -/qapi/qapi-doc.texi +**/qapi/qapi-visit.[ch] +**/qapi/qapi-doc.texi /qemu-edid /qemu-img /qemu-nbd @@ -59,6 +59,7 @@ /qemu-keymap /qemu-monitor.texi /qemu-monitor-info.texi +/qemu-storage-daemon /qemu-version.h /qemu-version.h.tmp /module_block.h --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407187; cv=none; d=zohomail.com; s=zohoarc; b=icQoxiDXNmoWU8ZHUZn9V4BIsVQXvJ2ipzVImXI9Y2UTyJo17Vi9okVzZmlffcbxboTweAYhoClRh945ymIQk6KI/a/xIsaLN7VOlpD1xx+OxbzdH/jBO8Cw/XgTVaTrXNWXc3QzSgx0lh3mbIgTHXfVfmu8Snb4aucoA8E+eRc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407187; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F4tVTuc6+QSaTZN04YsV5ZPsNOhBhqMPzw/FjFPLSpA=; b=XT+pga5Ds92rHjwd6cPWjJlaGIDdwFAF5j++/3OB6A2UsrEmm0Kl+dxPGMm0V1TbqVJBwvN20Rb9FS8puccGgICFjQVPgm5qbbaYfK9fhguh1e6pjU5G5DE9SCT5817FPhrNhVysrTzFtJyNBNoc3IapD9kv74vZfmsKRgb7j74= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407187083811.8217327161367; Wed, 17 Jun 2020 08:19:47 -0700 (PDT) Received: from localhost ([::1]:47646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZcf-00062L-Uc for importer@patchew.org; Wed, 17 Jun 2020 11:05:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZO4-0003Oo-Ae for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:00 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34697 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZO2-0001ms-MC for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:49:59 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-G7dCqsJsNH2JSygKD9PbFA-1; Wed, 17 Jun 2020 10:49:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF1E8100CCC8; Wed, 17 Jun 2020 14:49:54 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7FCA7CAA0; Wed, 17 Jun 2020 14:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F4tVTuc6+QSaTZN04YsV5ZPsNOhBhqMPzw/FjFPLSpA=; b=gtPUXDXD0sYCpiO1LyjZdNua+l3Pjfj2/eXtIlQgMONFjlcoAudlwfiZYpNzHC663nlm8e dSNlo06gQ+bPFErRdNyNYNFUfy/ZVx5b0od1pCEsOyVWlgtBI1rSkdaUKYw6f35t7ft1fV 0/XRJhgWbJGRTKN4Yj/lbJLercplcvc= X-MC-Unique: G7dCqsJsNH2JSygKD9PbFA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 30/43] virtio-blk: store opt_io_size with correct size Date: Wed, 17 Jun 2020 16:48:56 +0200 Message-Id: <20200617144909.192176-31-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Roman Kagan The width of opt_io_size in virtio_blk_config is 32bit. However, it's written with virtio_stw_p; this may result in value truncation, and on big-endian systems with legacy virtio in completely bogus readings in the guest. Use the appropriate accessor to store it. Signed-off-by: Roman Kagan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Kevin Wolf Message-Id: <20200528225516.1676602-2-rvkagan@yandex-team.ru> Signed-off-by: Kevin Wolf --- hw/block/virtio-blk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 8882a1d1d4..6938a75aa5 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -930,7 +930,7 @@ static void virtio_blk_update_config(VirtIODevice *vdev= , uint8_t *config) virtio_stw_p(vdev, &blkcfg.geometry.cylinders, conf->cyls); virtio_stl_p(vdev, &blkcfg.blk_size, blk_size); virtio_stw_p(vdev, &blkcfg.min_io_size, conf->min_io_size / blk_size); - virtio_stw_p(vdev, &blkcfg.opt_io_size, conf->opt_io_size / blk_size); + virtio_stl_p(vdev, &blkcfg.opt_io_size, conf->opt_io_size / blk_size); blkcfg.geometry.heads =3D conf->heads; /* * We must ensure that the block device capacity is a multiple of --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406953; cv=none; d=zohomail.com; s=zohoarc; b=oJ+uYDzrHzgmuZtkHRmE5XevwCn9F92j8IsZxXjDK/rGVQ/n0Xxh1E2M+yUfD0It8L/HOetbE/Q56rPrmJqDH6PZdbeNXnEHFaO+lOwsXp6sLwUagCUdhCAPcFA+uF2tYkTGnmVD06F46dxO6HByCG38UZ4h68Tk5xU80j90sIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406953; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oCwklQt9sS1bGWr0feitdiQ1QfpA9UktJx3cpW47Mko=; b=MOTzg9VWZcwAYcOnrDr7cQMSfUfcPR0z2VzVuS/rxKKv+Nh+n3oienQf+iUIgO9vPfAdSVRNsbGQBGulicVBsHdAE0vTqYCx0gtOSNXSroTFh+zzGsyvNaUWDh6ShwJVw9s1bVfHbHp4i4AiQ3tQuzA0nIm5I21tdzI6+bVeHoA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592406953827357.86924971569204; Wed, 17 Jun 2020 08:15:53 -0700 (PDT) Received: from localhost ([::1]:59458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZn6-0007Sg-8G for importer@patchew.org; Wed, 17 Jun 2020 11:15:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZO8-0003VJ-CH for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:04 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:59165 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZO4-0001nJ-EW for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-18-44gXWSAGPbuIIgK8LwJK8A-1; Wed, 17 Jun 2020 10:49:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D48E18A266A; Wed, 17 Jun 2020 14:49:56 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 159167CAA0; Wed, 17 Jun 2020 14:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405399; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oCwklQt9sS1bGWr0feitdiQ1QfpA9UktJx3cpW47Mko=; b=YpOQ7putieZC2NT9CA6sx0s4rrJQyN38+XcFaw6WAqawaky/hUN+pJlfGV3e6j0L1xO8vn jmFY7LmXLMf6UMfy7x+FlsiLxWAXwhF5khOR06IcKrauhpN4rYY4xGNInicQjrz6zqix6v d8ypJu/G/3yYdvXvXRNaG6H76f5faiY= X-MC-Unique: 44gXWSAGPbuIIgK8LwJK8A-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 31/43] block: consolidate blocksize properties consistency checks Date: Wed, 17 Jun 2020 16:48:57 +0200 Message-Id: <20200617144909.192176-32-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Roman Kagan Several block device properties related to blocksize configuration must be in certain relationship WRT each other: physical block must be no smaller than logical block; min_io_size, opt_io_size, and discard_granularity must be a multiple of a logical block. To ensure these requirements are met, add corresponding consistency checks to blkconf_blocksizes, adjusting its signature to communicate possible error to the caller. Also remove the now redundant consistency checks from the specific devices. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake Reviewed-by: Paul Durrant Message-Id: <20200528225516.1676602-3-rvkagan@yandex-team.ru> Signed-off-by: Kevin Wolf --- include/hw/block/block.h | 2 +- hw/block/block.c | 30 +++++++++++++++++++++++++++++- hw/block/fdc.c | 5 ++++- hw/block/nvme.c | 4 +++- hw/block/swim.c | 5 ++++- hw/block/virtio-blk.c | 7 +------ hw/block/xen-block.c | 6 +----- hw/ide/qdev.c | 5 ++++- hw/scsi/scsi-disk.c | 12 +++++------- hw/usb/dev-storage.c | 5 ++++- tests/qemu-iotests/172.out | 2 +- 11 files changed, 57 insertions(+), 26 deletions(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index d7246f3862..784953a237 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -87,7 +87,7 @@ bool blk_check_size_and_read_all(BlockBackend *blk, void = *buf, hwaddr size, bool blkconf_geometry(BlockConf *conf, int *trans, unsigned cyls_max, unsigned heads_max, unsigned secs= _max, Error **errp); -void blkconf_blocksizes(BlockConf *conf); +bool blkconf_blocksizes(BlockConf *conf, Error **errp); bool blkconf_apply_backend_options(BlockConf *conf, bool readonly, bool resizable, Error **errp); =20 diff --git a/hw/block/block.c b/hw/block/block.c index bf56c7612b..b22207c921 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -61,7 +61,7 @@ bool blk_check_size_and_read_all(BlockBackend *blk, void = *buf, hwaddr size, return true; } =20 -void blkconf_blocksizes(BlockConf *conf) +bool blkconf_blocksizes(BlockConf *conf, Error **errp) { BlockBackend *blk =3D conf->blk; BlockSizes blocksizes; @@ -83,6 +83,34 @@ void blkconf_blocksizes(BlockConf *conf) conf->logical_block_size =3D BDRV_SECTOR_SIZE; } } + + if (conf->logical_block_size > conf->physical_block_size) { + error_setg(errp, + "logical_block_size > physical_block_size not supported= "); + return false; + } + + if (!QEMU_IS_ALIGNED(conf->min_io_size, conf->logical_block_size)) { + error_setg(errp, + "min_io_size must be a multiple of logical_block_size"); + return false; + } + + if (!QEMU_IS_ALIGNED(conf->opt_io_size, conf->logical_block_size)) { + error_setg(errp, + "opt_io_size must be a multiple of logical_block_size"); + return false; + } + + if (conf->discard_granularity !=3D -1 && + !QEMU_IS_ALIGNED(conf->discard_granularity, + conf->logical_block_size)) { + error_setg(errp, "discard_granularity must be " + "a multiple of logical_block_size"); + return false; + } + + return true; } =20 bool blkconf_apply_backend_options(BlockConf *conf, bool readonly, diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 8528b9a3c7..be0674e4aa 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -554,7 +554,10 @@ static void floppy_drive_realize(DeviceState *qdev, Er= ror **errp) read_only =3D !blk_bs(dev->conf.blk) || blk_is_read_only(dev->conf= .blk); } =20 - blkconf_blocksizes(&dev->conf); + if (!blkconf_blocksizes(&dev->conf, errp)) { + return; + } + if (dev->conf.logical_block_size !=3D 512 || dev->conf.physical_block_size !=3D 512) { diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 2a2e43f681..1aee042d4c 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1425,7 +1425,9 @@ static void nvme_init_state(NvmeCtrl *n) =20 static void nvme_init_blk(NvmeCtrl *n, Error **errp) { - blkconf_blocksizes(&n->conf); + if (!blkconf_blocksizes(&n->conf, errp)) { + return; + } blkconf_apply_backend_options(&n->conf, blk_is_read_only(n->conf.blk), false, errp); } diff --git a/hw/block/swim.c b/hw/block/swim.c index 8f124782f4..74f56e8f46 100644 --- a/hw/block/swim.c +++ b/hw/block/swim.c @@ -189,7 +189,10 @@ static void swim_drive_realize(DeviceState *qdev, Erro= r **errp) assert(ret =3D=3D 0); } =20 - blkconf_blocksizes(&dev->conf); + if (!blkconf_blocksizes(&dev->conf, errp)) { + return; + } + if (dev->conf.logical_block_size !=3D 512 || dev->conf.physical_block_size !=3D 512) { diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 6938a75aa5..413783693c 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1174,12 +1174,7 @@ static void virtio_blk_device_realize(DeviceState *d= ev, Error **errp) return; } =20 - blkconf_blocksizes(&conf->conf); - - if (conf->conf.logical_block_size > - conf->conf.physical_block_size) { - error_setg(errp, - "logical_block_size > physical_block_size not supported= "); + if (!blkconf_blocksizes(&conf->conf, errp)) { return; } =20 diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c index 2827c90ac7..1b7bc5de08 100644 --- a/hw/block/xen-block.c +++ b/hw/block/xen-block.c @@ -239,11 +239,7 @@ static void xen_block_realize(XenDevice *xendev, Error= **errp) return; } =20 - blkconf_blocksizes(conf); - - if (conf->logical_block_size > conf->physical_block_size) { - error_setg( - errp, "logical_block_size > physical_block_size not supported"= ); + if (!blkconf_blocksizes(conf, errp)) { return; } =20 diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index caa88526f5..3ccb5e2529 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -187,7 +187,10 @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKin= d kind, Error **errp) return; } =20 - blkconf_blocksizes(&dev->conf); + if (!blkconf_blocksizes(&dev->conf, errp)) { + return; + } + if (dev->conf.logical_block_size !=3D 512) { error_setg(errp, "logical_block_size must be 512 for IDE"); return; diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 387503e11b..8ce68a9dd6 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2346,12 +2346,7 @@ static void scsi_realize(SCSIDevice *dev, Error **er= rp) return; } =20 - blkconf_blocksizes(&s->qdev.conf); - - if (s->qdev.conf.logical_block_size > - s->qdev.conf.physical_block_size) { - error_setg(errp, - "logical_block_size > physical_block_size not supported= "); + if (!blkconf_blocksizes(&s->qdev.conf, errp)) { return; } =20 @@ -2436,7 +2431,9 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **= errp) if (s->qdev.conf.blk) { ctx =3D blk_get_aio_context(s->qdev.conf.blk); aio_context_acquire(ctx); - blkconf_blocksizes(&s->qdev.conf); + if (!blkconf_blocksizes(&s->qdev.conf, errp)) { + goto out; + } } s->qdev.blocksize =3D s->qdev.conf.logical_block_size; s->qdev.type =3D TYPE_DISK; @@ -2444,6 +2441,7 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **= errp) s->product =3D g_strdup("QEMU HARDDISK"); } scsi_realize(&s->qdev, errp); +out: if (ctx) { aio_context_release(ctx); } diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index a5204b6f2a..f5977eb72e 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -612,7 +612,10 @@ static void usb_msd_storage_realize(USBDevice *dev, Er= ror **errp) return; } =20 - blkconf_blocksizes(&s->conf); + if (!blkconf_blocksizes(&s->conf, errp)) { + return; + } + if (!blkconf_apply_backend_options(&s->conf, blk_is_read_only(blk), tr= ue, errp)) { return; diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index 7abbe82427..59cc70aebb 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -1204,7 +1204,7 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0,physica drive-type =3D "144" =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -device floppy,drive=3Dn= one0,logical_block_size=3D4096 -QEMU_PROG: -device floppy,drive=3Dnone0,logical_block_size=3D4096: Physica= l and logical block size must be 512 for floppy +QEMU_PROG: -device floppy,drive=3Dnone0,logical_block_size=3D4096: logical= _block_size > physical_block_size not supported =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -device floppy,drive=3Dn= one0,physical_block_size=3D1024 QEMU_PROG: -device floppy,drive=3Dnone0,physical_block_size=3D1024: Physic= al and logical block size must be 512 for floppy --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407197; cv=none; d=zohomail.com; s=zohoarc; b=bdHkyF33VGUTyPV0jlQc+My3GauCfwycIj0ycvTGZSLxgYl0fITmQM+z5tdhxD3vZDaiw3cPFUGXnAc2DuMKAIGx4K5CUF1gnjISIAjNAg3HOmsnMI93nqzN1O6OzRec3sWKtTnI9wCtkMKhykBpNaCX4yprvNmY8g2r0TB9LIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407197; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hWojdpuV8jZ3RVbv7qXlRl7CymuA7CdOoe/U5kUOIGE=; b=KTqvX9cZT2O/+zsYKKXtJgTFB7LgnsA1nju012wklHlnSGFmKnIJe9LCQmEVGf36CRlPUVdGk7avH2bjOx5Hy3f6Qhd+IzHdPz4K/2gDgn/slpqXYV1J7Bz+0Un1+rM0iSV3q+0x74cMOm8rb1b7ZLGBD8XWW3Z2rhh6O1jTGb8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407197275770.0449599824514; Wed, 17 Jun 2020 08:19:57 -0700 (PDT) Received: from localhost ([::1]:55894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZf3-0001O5-Vn for importer@patchew.org; Wed, 17 Jun 2020 11:07:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45730) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOA-0003XI-LK for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:53219 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZO6-0001nf-DR for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:06 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-pu_LaA0tPyafdL8jhz47ew-1; Wed, 17 Jun 2020 10:49:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5164018A266E; Wed, 17 Jun 2020 14:49:57 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58C467CAA0; Wed, 17 Jun 2020 14:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hWojdpuV8jZ3RVbv7qXlRl7CymuA7CdOoe/U5kUOIGE=; b=RmbVqaXdMaNRYphuh0RwYuwaaOENqYTGGUlRvXGHYCrXfHXw7nfjPK5AWAOEF7+8JjPciJ rkBg3nwAYfw3WuwFGAcNhxJRp5kB3pK43UTKpWCyq58CY+/VYbkYRYTNRqSv4gL1nVEBmI 4CfHbnaSc0yOdmuqYBIJcKmcG652dWQ= X-MC-Unique: pu_LaA0tPyafdL8jhz47ew-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 32/43] qdev-properties: blocksize: use same limits in code and description Date: Wed, 17 Jun 2020 16:48:58 +0200 Message-Id: <20200617144909.192176-33-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/16 23:30:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Roman Kagan Make it easier (more visible) to maintain the limits on the blocksize properties in sync with the respective description, by using macros both in the code and in the description. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake Message-Id: <20200528225516.1676602-4-rvkagan@yandex-team.ru> Signed-off-by: Kevin Wolf --- hw/core/qdev-properties.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index cc924815da..249dc69bd8 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -729,6 +729,13 @@ const PropertyInfo qdev_prop_pci_devfn =3D { =20 /* --- blocksize --- */ =20 +/* lower limit is sector size */ +#define MIN_BLOCK_SIZE 512 +#define MIN_BLOCK_SIZE_STR stringify(MIN_BLOCK_SIZE) +/* upper limit is the max power of 2 that fits in uint16_t */ +#define MAX_BLOCK_SIZE 32768 +#define MAX_BLOCK_SIZE_STR stringify(MAX_BLOCK_SIZE) + static void set_blocksize(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -736,8 +743,6 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, Property *prop =3D opaque; uint16_t value, *ptr =3D qdev_get_prop_ptr(dev, prop); Error *local_err =3D NULL; - const int64_t min =3D 512; - const int64_t max =3D 32768; =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -750,9 +755,12 @@ static void set_blocksize(Object *obj, Visitor *v, con= st char *name, return; } /* value of 0 means "unset" */ - if (value && (value < min || value > max)) { - error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, - dev->id ? : "", name, (int64_t)value, min, max); + if (value && (value < MIN_BLOCK_SIZE || value > MAX_BLOCK_SIZE)) { + error_setg(errp, + "Property %s.%s doesn't take value %" PRIu16 + " (minimum: " MIN_BLOCK_SIZE_STR + ", maximum: " MAX_BLOCK_SIZE_STR ")", + dev->id ? : "", name, value); return; } =20 @@ -769,7 +777,8 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, =20 const PropertyInfo qdev_prop_blocksize =3D { .name =3D "uint16", - .description =3D "A power of two between 512 and 32768", + .description =3D "A power of two between " MIN_BLOCK_SIZE_STR + " and " MAX_BLOCK_SIZE_STR, .get =3D get_uint16, .set =3D set_blocksize, .set_default_value =3D set_default_value_uint, --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407201; cv=none; d=zohomail.com; s=zohoarc; b=YHe4uZBpgpzSzdfnejGyB/CuRkMf3HPwjjdG9YQjo1i9crSGJk1afJoFuHkbwsiDT92wOZPDlor4OywjCJJnRoK8Nfl4wkF3zxji8gbY+rfqUv+n5QG5/Pmhd5yvW3sh0nHBQCoyjfOfpHBy29OSoEiTFr9h3C0YsYXAi5XulpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407201; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w8eey7xparn6EiYKkK4D9XdwiuvnjzzdXKZSyblvuEI=; b=JqahPTg127d2a75Bo+T6o4z6OmhaoNvhVocMxcWFIvTDcuehGblH3oaF/Ka0F4NdDZPMUdE76d50QohK7HYj/DaDO4R6P+P4JuKuPmg/J9U+RUYb7T5sNus607LQPEwUczBSyLbcO3LA1zz0ce0uHsXFZok/hVCoWHEw6D1gcxc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159240720188285.12714649747943; Wed, 17 Jun 2020 08:20:01 -0700 (PDT) Received: from localhost ([::1]:41830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZr7-00040I-2R for importer@patchew.org; Wed, 17 Jun 2020 11:20:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOB-0003Y5-Iu for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:07 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39947 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZO9-0001oX-Vi for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:07 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-WTht3TI8PkaEkxIL5-x3Yw-1; Wed, 17 Jun 2020 10:49:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9198A8730B2; Wed, 17 Jun 2020 14:49:58 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A9AB7CAA0; Wed, 17 Jun 2020 14:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w8eey7xparn6EiYKkK4D9XdwiuvnjzzdXKZSyblvuEI=; b=OWOsHNNtoKNhJrDTLNVjxuTWkts0nLUEhVTzooJEPmXOYOjHnsf4B5g8X0mUlJrBvSUpJ6 ObIyuGmSezzySpMCWPN4zeLwhbrtqGTX+66QSpxvhgokpkoMckJuGjPwaOOuv/tAenvL8d dGzQ9W9j26KPBJpH0o4DQFhZLXkrI0E= X-MC-Unique: WTht3TI8PkaEkxIL5-x3Yw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 33/43] qdev-properties: add size32 property type Date: Wed, 17 Jun 2020 16:48:59 +0200 Message-Id: <20200617144909.192176-34-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Roman Kagan Introduce size32 property type which handles size suffixes (k, m, g) just like size property, but is uint32_t rather than uint64_t. It's going to be useful for properties that are byte sizes but are inherently 32bit, like BlkConf.opt_io_size or .discard_granularity (they are switched to this new property type in a followup commit). The getter for size32 is left out for a separate patch as its benefit is less obvious, and it affects test output; for now the regular uint32 getter is used. Signed-off-by: Roman Kagan Message-Id: <20200528225516.1676602-5-rvkagan@yandex-team.ru> Signed-off-by: Kevin Wolf --- include/hw/qdev-properties.h | 3 +++ hw/core/qdev-properties.c | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index f161604fb6..c03eadfad6 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -29,6 +29,7 @@ extern const PropertyInfo qdev_prop_drive; extern const PropertyInfo qdev_prop_drive_iothread; extern const PropertyInfo qdev_prop_netdev; extern const PropertyInfo qdev_prop_pci_devfn; +extern const PropertyInfo qdev_prop_size32; extern const PropertyInfo qdev_prop_blocksize; extern const PropertyInfo qdev_prop_pci_host_devaddr; extern const PropertyInfo qdev_prop_uuid; @@ -196,6 +197,8 @@ extern const PropertyInfo qdev_prop_pcie_link_width; BlockdevOnError) #define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int) +#define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ + DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t) #define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint16_t) #define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 249dc69bd8..40c13f6ebe 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -727,6 +727,46 @@ const PropertyInfo qdev_prop_pci_devfn =3D { .set_default_value =3D set_default_value_int, }; =20 +/* --- 32bit unsigned int 'size' type --- */ + +static void set_size32(Object *obj, Visitor *v, const char *name, void *op= aque, + Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; + uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t value; + Error *local_err =3D NULL; + + if (dev->realized) { + qdev_prop_set_after_realize(dev, name, errp); + return; + } + + visit_type_size(v, name, &value, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + if (value > UINT32_MAX) { + error_setg(errp, + "Property %s.%s doesn't take value %" PRIu64 + " (maximum: %u)", + dev->id ? : "", name, value, UINT32_MAX); + return; + } + + *ptr =3D value; +} + +const PropertyInfo qdev_prop_size32 =3D { + .name =3D "size", + .get =3D get_uint32, + .set =3D set_size32, + .set_default_value =3D set_default_value_uint, +}; + /* --- blocksize --- */ =20 /* lower limit is sector size */ --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407322; cv=none; d=zohomail.com; s=zohoarc; b=WDf/CJOVpsCP+r5S1Zr0pDJLPW7aERETgTMhFd+1i3DagXTIqY1r9M3WvncpF8GEEsEUpXdyPlShSDdRoS72bEGPTUu9tTh8jUj//TzNVLjKlN+fTyizjE03NxFLftxDSXBrzeHYWvfP4uv3UhG0lgzE1dpg5mD2nQs0idIKTus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407322; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tt2N+uEB83ZuFciVwjy3KoXxy2tp+qRsRdtWU4oVpuo=; b=A47uGHx08zbY/R8eyPD9VcopEtswPiX52XPRdAI8pQ+TO/VCuXcUA3i4pX8J4vpHbMznSfPxuKy4XTJWLPHfcxnMbGzXmDtngV0RWh3t1GZnr0uqm7iEazjBxS+QS4VdRGp5QAhjc1NKT0tn+poGGiArYvCk8pId0CM/Rz3hI1s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15924073220091.1823997753929234; Wed, 17 Jun 2020 08:22:02 -0700 (PDT) Received: from localhost ([::1]:47200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZt2-00014m-UC for importer@patchew.org; Wed, 17 Jun 2020 11:22:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45764) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOB-0003Y8-V5 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:07 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39977 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOA-0001pg-09 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:07 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-Ywh6JeiiNwexC_bdiDcvqw-1; Wed, 17 Jun 2020 10:50:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4A4E134CF; Wed, 17 Jun 2020 14:49:59 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBBA67CAB0; Wed, 17 Jun 2020 14:49:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tt2N+uEB83ZuFciVwjy3KoXxy2tp+qRsRdtWU4oVpuo=; b=CBEI7rtjJpf6QRdVR0l43KXsUaE18unzfBuXbonQ1MFVY/FTBWe41Ey3Ltuh0mN5sYbhcs Wui9CdZh6ZSmfq5MLvgsbJtmnLb6JUxFTtKXN/iSTk8/9T9DlTXRlL4dz7nNRh0QZGcFdK gaulDGkxvAZIZwIi/I5kg80vyvaMDqg= X-MC-Unique: Ywh6JeiiNwexC_bdiDcvqw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 34/43] qdev-properties: make blocksize accept size suffixes Date: Wed, 17 Jun 2020 16:49:00 +0200 Message-Id: <20200617144909.192176-35-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Roman Kagan It appears convenient to be able to specify physical_block_size and logical_block_size using common size suffixes. Teach the blocksize property setter to interpret them. Also express the upper and lower limits in the respective units. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake Message-Id: <20200528225516.1676602-6-rvkagan@yandex-team.ru> Signed-off-by: Kevin Wolf --- hw/core/qdev-properties.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 40c13f6ebe..c9af6a1341 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -14,6 +14,7 @@ #include "qapi/visitor.h" #include "chardev/char.h" #include "qemu/uuid.h" +#include "qemu/units.h" =20 void qdev_prop_set_after_realize(DeviceState *dev, const char *name, Error **errp) @@ -771,17 +772,18 @@ const PropertyInfo qdev_prop_size32 =3D { =20 /* lower limit is sector size */ #define MIN_BLOCK_SIZE 512 -#define MIN_BLOCK_SIZE_STR stringify(MIN_BLOCK_SIZE) +#define MIN_BLOCK_SIZE_STR "512 B" /* upper limit is the max power of 2 that fits in uint16_t */ -#define MAX_BLOCK_SIZE 32768 -#define MAX_BLOCK_SIZE_STR stringify(MAX_BLOCK_SIZE) +#define MAX_BLOCK_SIZE (32 * KiB) +#define MAX_BLOCK_SIZE_STR "32 KiB" =20 static void set_blocksize(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint16_t value, *ptr =3D qdev_get_prop_ptr(dev, prop); + uint16_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t value; Error *local_err =3D NULL; =20 if (dev->realized) { @@ -789,7 +791,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, return; } =20 - visit_type_uint16(v, name, &value, &local_err); + visit_type_size(v, name, &value, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -797,7 +799,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, /* value of 0 means "unset" */ if (value && (value < MIN_BLOCK_SIZE || value > MAX_BLOCK_SIZE)) { error_setg(errp, - "Property %s.%s doesn't take value %" PRIu16 + "Property %s.%s doesn't take value %" PRIu64 " (minimum: " MIN_BLOCK_SIZE_STR ", maximum: " MAX_BLOCK_SIZE_STR ")", dev->id ? : "", name, value); @@ -816,7 +818,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, } =20 const PropertyInfo qdev_prop_blocksize =3D { - .name =3D "uint16", + .name =3D "size", .description =3D "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, .get =3D get_uint16, --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407198; cv=none; d=zohomail.com; s=zohoarc; b=OuKM3K/UapLP8+RhykiScdGn5IwnWiirxBYHWeaGiSsABlRa+XbAicy1RSfpPr1NdGqbiyxu0PrvLWbj7ncnZOM1EM28PqcTNKdHb3ZFfDb1SkVpHFArKr5EHw4TjkV4g8xNxtVgHKy5K93Hw7fTpOiFcA4o7nq7FfmwCqIbTSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407198; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IAboVCEopLwq/H63SkvV8dIYUxGkdBAmKaYWgBotN3k=; b=I9Mf50MnCou2GH1YZ+cOrZPRovHb08mkGUXCX0xkTttAhI9EVkoWD/gIKmSG5Owyt9TTCopRS8DZvANJpZrAh+X4mXBpMnZYbYJYaBSUt8JMezfmU0JlKgVKh2/BHFxF7DA1DhXeJmZKc5VjJ7FZT5PQbfKdo+V2hZ3IxPmYYGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407198389697.1302114190029; Wed, 17 Jun 2020 08:19:58 -0700 (PDT) Received: from localhost ([::1]:35844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZh3-00057p-Ls for importer@patchew.org; Wed, 17 Jun 2020 11:09:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOF-0003eG-A4 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:11 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:20445 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOC-0001qU-MK for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:10 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-UvroBpQIMWi60hesAX_y_Q-1; Wed, 17 Jun 2020 10:50:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 25CB081CBF3; Wed, 17 Jun 2020 14:50:01 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B6A57CAB0; Wed, 17 Jun 2020 14:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IAboVCEopLwq/H63SkvV8dIYUxGkdBAmKaYWgBotN3k=; b=MRYRn8IhDFFrnFN5YuUFhfd5bpX2bodj1ezP90Kg8pAyAnyT3iPu4CjgAR7uBOL3orbEOQ 6ECsWj74e6SNdV5AGbY/tBdaj4x7Y77teXhH0pY4m5mzeGnXHElONXuNIxKBN1lqILLO70 UIyVceDfU8nkZ3oTwePWZUV3zaeJUGg= X-MC-Unique: UvroBpQIMWi60hesAX_y_Q-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 35/43] block: make BlockConf size props 32bit and accept size suffixes Date: Wed, 17 Jun 2020 16:49:01 +0200 Message-Id: <20200617144909.192176-36-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Roman Kagan Convert all size-related properties in BlockConf to 32bit. This will accommodate bigger block sizes (in a followup patch). This also allows to make them all accept size suffixes, either via DEFINE_PROP_BLOCKSIZE or via DEFINE_PROP_SIZE32. Also, since min_io_size is exposed to the guest by scsi and virtio-blk devices as an uint16_t in units of logical blocks, introduce an additional check in blkconf_blocksizes to prevent its silent truncation. Signed-off-by: Roman Kagan Message-Id: <20200528225516.1676602-7-rvkagan@yandex-team.ru> Signed-off-by: Kevin Wolf --- include/hw/block/block.h | 12 ++++++------ include/hw/qdev-properties.h | 2 +- hw/block/block.c | 10 ++++++++++ hw/core/qdev-properties.c | 4 ++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 784953a237..1e8b6253dd 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -18,9 +18,9 @@ =20 typedef struct BlockConf { BlockBackend *blk; - uint16_t physical_block_size; - uint16_t logical_block_size; - uint16_t min_io_size; + uint32_t physical_block_size; + uint32_t logical_block_size; + uint32_t min_io_size; uint32_t opt_io_size; int32_t bootindex; uint32_t discard_granularity; @@ -51,9 +51,9 @@ static inline unsigned int get_physical_block_exp(BlockCo= nf *conf) _conf.logical_block_size), \ DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \ _conf.physical_block_size), \ - DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \ - DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \ - DEFINE_PROP_UINT32("discard_granularity", _state, \ + DEFINE_PROP_SIZE32("min_io_size", _state, _conf.min_io_size, 0), \ + DEFINE_PROP_SIZE32("opt_io_size", _state, _conf.opt_io_size, 0), \ + DEFINE_PROP_SIZE32("discard_granularity", _state, \ _conf.discard_granularity, -1), \ DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, \ ON_OFF_AUTO_AUTO), \ diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index c03eadfad6..5252bb6b1a 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -200,7 +200,7 @@ extern const PropertyInfo qdev_prop_pcie_link_width; #define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \ DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t) #define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \ - DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint16_t) + DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t) #define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddre= ss) #define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \ diff --git a/hw/block/block.c b/hw/block/block.c index b22207c921..1e34573da7 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -96,6 +96,16 @@ bool blkconf_blocksizes(BlockConf *conf, Error **errp) return false; } =20 + /* + * all devices which support min_io_size (scsi and virtio-blk) expose = it to + * the guest as a uint16_t in units of logical blocks + */ + if (conf->min_io_size / conf->logical_block_size > UINT16_MAX) { + error_setg(errp, "min_io_size must not exceed %u logical blocks", + UINT16_MAX); + return false; + } + if (!QEMU_IS_ALIGNED(conf->opt_io_size, conf->logical_block_size)) { error_setg(errp, "opt_io_size must be a multiple of logical_block_size"); diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index c9af6a1341..bd4abdc1d1 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -782,7 +782,7 @@ static void set_blocksize(Object *obj, Visitor *v, cons= t char *name, { DeviceState *dev =3D DEVICE(obj); Property *prop =3D opaque; - uint16_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); uint64_t value; Error *local_err =3D NULL; =20 @@ -821,7 +821,7 @@ const PropertyInfo qdev_prop_blocksize =3D { .name =3D "size", .description =3D "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, - .get =3D get_uint16, + .get =3D get_uint32, .set =3D set_blocksize, .set_default_value =3D set_default_value_uint, }; --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406888; cv=none; d=zohomail.com; s=zohoarc; b=aXzsRtGnXtmZfq5F+baz2jNdp4Ycgjp4GcPdH3lqHCHoxo9LibyFy7Di4RpZih4gxbGBnpi52/BmTOhfep6YYQkspxodwJcPnBZZBZBzNmuF6m79QZV/wK3QDA2Ae/HxzEjc2q6astzc8ePCe1LwCujccsSa+aUJZPpDd/IIBpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406888; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VHz4cZNb0+rW5o8P0D9xRx7ShpORlZfgpLRB1CLd2Jg=; b=lLxPKsy8TEqrae0LdY8SzdNCVVFwjGSl89LdQW1yDx8FeIjnyK2qQzUwBvdk4G1YNQceCgmxUtFtkWGXkXzteEA0dggbt80tJBXYm/WBOPuExzePPcZzTHC1VnhDx/8gyM2EQO5KZ9bvoSaIAodGHPv4fxWJDO2/SZkpJoKp4B4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592406888852300.1276786601135; Wed, 17 Jun 2020 08:14:48 -0700 (PDT) Received: from localhost ([::1]:53374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZeS-0000E5-Ro for importer@patchew.org; Wed, 17 Jun 2020 11:06:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOK-0003nh-4d for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:16 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:57021 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOG-0001rJ-2V for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-8EoL6nvpN0GsXiv7etBVkw-1; Wed, 17 Jun 2020 10:50:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7DAF78730EC; Wed, 17 Jun 2020 14:50:02 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71E8E7CAA0; Wed, 17 Jun 2020 14:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VHz4cZNb0+rW5o8P0D9xRx7ShpORlZfgpLRB1CLd2Jg=; b=M7QE5ZtVjxyE/F0WBuwQyAqO/MyHVbCMXTjaPc8DmBmWXGGkIt3xemcXLZ/DPGsI2gVE/u djN97zwgWKqw1SEXwFQQ9PrV/bOMc2oXCLq3RH6EGGzoo/9bsKm59pWaPStXsC6/a0qHrX 0zWHzPE2wL4ainDTrsU122ywLVjSb7M= X-MC-Unique: 8EoL6nvpN0GsXiv7etBVkw-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 36/43] qdev-properties: add getter for size32 and blocksize Date: Wed, 17 Jun 2020 16:49:02 +0200 Message-Id: <20200617144909.192176-37-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Roman Kagan Add getter for size32, and use it for blocksize, too. In its human-readable branch, it reports approximate size in human-readable units next to the exact byte value, like the getter for 64bit size does. Adjust the expected test output accordingly. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake Message-Id: <20200528225516.1676602-8-rvkagan@yandex-team.ru> Signed-off-by: Kevin Wolf --- hw/core/qdev-properties.c | 15 +- tests/qemu-iotests/172.out | 530 ++++++++++++++++++------------------- 2 files changed, 278 insertions(+), 267 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index bd4abdc1d1..63d48db70c 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -730,6 +730,17 @@ const PropertyInfo qdev_prop_pci_devfn =3D { =20 /* --- 32bit unsigned int 'size' type --- */ =20 +static void get_size32(Object *obj, Visitor *v, const char *name, void *op= aque, + Error **errp) +{ + DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; + uint32_t *ptr =3D qdev_get_prop_ptr(dev, prop); + uint64_t value =3D *ptr; + + visit_type_size(v, name, &value, errp); +} + static void set_size32(Object *obj, Visitor *v, const char *name, void *op= aque, Error **errp) { @@ -763,7 +774,7 @@ static void set_size32(Object *obj, Visitor *v, const c= har *name, void *opaque, =20 const PropertyInfo qdev_prop_size32 =3D { .name =3D "size", - .get =3D get_uint32, + .get =3D get_size32, .set =3D set_size32, .set_default_value =3D set_default_value_uint, }; @@ -821,7 +832,7 @@ const PropertyInfo qdev_prop_blocksize =3D { .name =3D "size", .description =3D "A power of two between " MIN_BLOCK_SIZE_STR " and " MAX_BLOCK_SIZE_STR, - .get =3D get_uint32, + .get =3D get_size32, .set =3D set_blocksize, .set_default_value =3D set_default_value_uint, }; diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index 59cc70aebb..e782c5957e 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -24,11 +24,11 @@ Testing: dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -54,11 +54,11 @@ Testing: -fda TEST_DIR/t.qcow2 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -81,22 +81,22 @@ Testing: -fdb TEST_DIR/t.qcow2 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -119,22 +119,22 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -160,11 +160,11 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -187,22 +187,22 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2,i= ndex=3D1 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -225,22 +225,22 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -= drive if=3Dfloppy,file=3DTEST_DIR/t dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -266,11 +266,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -gl= obal isa-fdc.driveA=3Dnone0 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -293,11 +293,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -gl= obal isa-fdc.driveB=3Dnone0 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -320,22 +320,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -361,11 +361,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -388,11 +388,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -de= vice floppy,drive=3Dnone0,unit=3D1 dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -415,22 +415,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -456,22 +456,22 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -494,22 +494,22 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -532,11 +532,11 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -559,11 +559,11 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -589,22 +589,22 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -627,22 +627,22 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -665,22 +665,22 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -703,22 +703,22 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -750,22 +750,22 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -= drive if=3Dnone,file=3DTEST_DIR/t.q dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -788,22 +788,22 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -= drive if=3Dnone,file=3DTEST_DIR/t.q dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -832,22 +832,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -870,22 +870,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -908,22 +908,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -946,22 +946,22 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" dev: floppy, id "" unit =3D 1 (0x1) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -999,11 +999,11 @@ Testing: -device floppy dev: floppy, id "" unit =3D 0 (0x0) drive =3D "" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -1026,11 +1026,11 @@ Testing: -device floppy,drive-type=3D120 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "120" @@ -1053,11 +1053,11 @@ Testing: -device floppy,drive-type=3D144 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -1080,11 +1080,11 @@ Testing: -device floppy,drive-type=3D288 dev: floppy, id "" unit =3D 0 (0x0) drive =3D "" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -1110,11 +1110,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= device floppy,drive=3Dnone0,drive-t dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "120" @@ -1137,11 +1137,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= device floppy,drive=3Dnone0,drive-t dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -1167,11 +1167,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= device floppy,drive=3Dnone0,logical dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -1194,11 +1194,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= device floppy,drive=3Dnone0,physica dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407193; cv=none; d=zohomail.com; s=zohoarc; b=mvWX/suwSq6q/93vipSX+fQPeLulXTFcJpURnrMOkjjqRcQK2ucBtRn8UC3MK1n1udL0SBnds13ASNBsmpOrkLdr1faKXqZAcOlOwRN6n1/0EOpWuowWLtqmK7K33cPCAGqrm9Ci/HhNdZsCm4b3zfqd9Z6QUi6//8MrWYF6HHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407193; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cxCDe5YbJ92Z6Vq7n4mmb7lS89YUzHq/6dTh//AJbho=; b=jNgmY4FSNuyhaZ8aoA4Y1kS1bVfIBj8UL8rUXw1YKD9CT3al1593dkqY2Ffml9g74JJ9eBtIHb3KjsjOa1NSRk1g/QP0HK0vVT/tpZE0yOzh2WzX1z+7sRxv0ecigYrZggbl3xO3N+/mq8iXQXfVJvN5wiH4y6oQEBE50UNdqmU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407193152157.84226175914534; Wed, 17 Jun 2020 08:19:53 -0700 (PDT) Received: from localhost ([::1]:44270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZje-0000iY-SA for importer@patchew.org; Wed, 17 Jun 2020 11:12:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOH-0003iE-AT for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46017 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOF-0001r2-9B for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:12 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-5wOCv53TNAiBd7tyX5GZBQ-1; Wed, 17 Jun 2020 10:50:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3DC43100CCC9; Wed, 17 Jun 2020 14:50:07 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id C860F7CAA0; Wed, 17 Jun 2020 14:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cxCDe5YbJ92Z6Vq7n4mmb7lS89YUzHq/6dTh//AJbho=; b=hLlBlDfGJwzhT5c5nCxBtE+i2xsp4qHzRa8vFUWGZygQndTjfYaiziTyLWUSh6xX0ZnlIn UnqOaBxNWu3m+4IjffvhnFQ1Cbh5d2E3kTNIbL+SjGoh/rVuBjqbDmfq5UDVfg+EIVJd6N zwM4kF6qzZlzQK690Q77j92CyERMwgY= X-MC-Unique: 5wOCv53TNAiBd7tyX5GZBQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 37/43] block: lift blocksize property limit to 2 MiB Date: Wed, 17 Jun 2020 16:49:03 +0200 Message-Id: <20200617144909.192176-38-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Roman Kagan Logical and physical block sizes in QEMU are limited to 32 KiB. This appears unnecessarily tight, and we've seen bigger block sizes handy at times. Lift the limitation up to 2 MiB which appears to be good enough for everybody, and matches the qcow2 cluster size limit. Signed-off-by: Roman Kagan Reviewed-by: Eric Blake Message-Id: <20200528225516.1676602-9-rvkagan@yandex-team.ru> Signed-off-by: Kevin Wolf --- hw/core/qdev-properties.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 63d48db70c..ead35d7ffd 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -784,9 +784,12 @@ const PropertyInfo qdev_prop_size32 =3D { /* lower limit is sector size */ #define MIN_BLOCK_SIZE 512 #define MIN_BLOCK_SIZE_STR "512 B" -/* upper limit is the max power of 2 that fits in uint16_t */ -#define MAX_BLOCK_SIZE (32 * KiB) -#define MAX_BLOCK_SIZE_STR "32 KiB" +/* + * upper limit is arbitrary, 2 MiB looks sufficient for all sensible uses,= and + * matches qcow2 cluster size limit + */ +#define MAX_BLOCK_SIZE (2 * MiB) +#define MAX_BLOCK_SIZE_STR "2 MiB" =20 static void set_blocksize(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406890; cv=none; d=zohomail.com; s=zohoarc; b=AwtRE1ZL/dh33roQEtN0gbg4QLOp9UOso57XeZjVq8tjIGksVZGcKJR+1LqQ0YVkXvTzGTS57kcOGK+C7Igfe1hifRhKDYTxxmx3p4/k6WnRPbOB8UV4kDUEGMXgN5T7VnwDIUVl+Y56O5HaXeRLunDhl53b85CrSgmzsv78hL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406890; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d/oeVVVfMLDy1yG/A/G7YahrOhPwijV++m4PuFJMog4=; b=dWaAdyrwxigc4cVPsYqd8QqOe8iGLInT8vUawxhH98s/D9vC5dpf2qvL5KmYgOUXhJWxvukey3MuimhGs58VmzRHDinmhjjD43Js/dePc6X9zvIJhjGD9WGxxkQAtxy3pgDxn0YksCHO58JqA295WPmqDna1JUjCmNP+heVxHD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592406890557320.95089980059925; Wed, 17 Jun 2020 08:14:50 -0700 (PDT) Received: from localhost ([::1]:34346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZgS-0004Tk-VE for importer@patchew.org; Wed, 17 Jun 2020 11:09:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOL-0003pm-9g for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:17 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:53863 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOJ-0001tD-5o for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:16 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-367-klJ1lgcIMd2DS5S9buZZTQ-1; Wed, 17 Jun 2020 10:50:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8533481CBF3; Wed, 17 Jun 2020 14:50:07 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 870307CAA8; Wed, 17 Jun 2020 14:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d/oeVVVfMLDy1yG/A/G7YahrOhPwijV++m4PuFJMog4=; b=Hfa8PTVa3pJD3VA0FFL9ya9aQXMyoO92ykpP3Z7UaKlsPWYeIXTTViAOuYEEgjhbjPV6/J UX2qjjIUskG8azIAhZwroUf74XFOveeY9cAP83IObucCzEAtKZ6V3BhNRnMoclXqCHGSfZ S5I9iM8C2a9QKXQ/+t1uZZI5kyGnkOQ= X-MC-Unique: klJ1lgcIMd2DS5S9buZZTQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 38/43] iotests.py: Add skip_for_formats() decorator Date: Wed, 17 Jun 2020 16:49:04 +0200 Message-Id: <20200617144909.192176-39-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz Sometimes, we want to skip some test methods for certain formats. This decorator allows that. Signed-off-by: Max Reitz Message-Id: <20200617104822.27525-2-mreitz@redhat.com> Tested-by: Thomas Huth Signed-off-by: Kevin Wolf --- tests/qemu-iotests/iotests.py | 16 ++++++++++++++++ tests/qemu-iotests/118 | 7 +++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f20d90f969..5ea4c4df8b 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1103,6 +1103,22 @@ def skip_if_unsupported(required_formats=3D(), read_= only=3DFalse): return func_wrapper return skip_test_decorator =20 +def skip_for_formats(formats: Sequence[str] =3D ()) \ + -> Callable[[Callable[[QMPTestCase, List[Any], Dict[str, Any]], None]], + Callable[[QMPTestCase, List[Any], Dict[str, Any]], None]]: + '''Skip Test Decorator + Skips the test for the given formats''' + def skip_test_decorator(func): + def func_wrapper(test_case: QMPTestCase, *args: List[Any], + **kwargs: Dict[str, Any]) -> None: + if imgfmt in formats: + msg =3D f'{test_case}: Skipped for format {imgfmt}' + test_case.case_skip(msg) + else: + func(test_case, *args, **kwargs) + return func_wrapper + return skip_test_decorator + def skip_if_user_is_root(func): '''Skip Test Decorator Runs the test only without root permissions''' diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118 index adc8a848b5..2350929fd8 100755 --- a/tests/qemu-iotests/118 +++ b/tests/qemu-iotests/118 @@ -683,11 +683,10 @@ class TestBlockJobsAfterCycle(ChangeBaseClass): except OSError: pass =20 + # We need backing file support + @iotests.skip_for_formats(('vpc', 'parallels', 'qcow', 'vdi', 'vmdk', = 'raw', + 'vhdx')) def test_snapshot_and_commit(self): - # We need backing file support - if iotests.imgfmt !=3D 'qcow2' and iotests.imgfmt !=3D 'qed': - return - result =3D self.vm.qmp('blockdev-snapshot-sync', device=3D'drive0', snapshot_file=3Dnew= _img, format=3Diotests.im= gfmt) --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407403; cv=none; d=zohomail.com; s=zohoarc; b=TkdHjTxWY51ODT9dNr9AMsuo1PYs/Ea6z5L0HK42z7qXY+excTlOPnnywuHLoYtzbBVnPO6xCyxny42KjMNusogw47Q5RxKg+DZ7X+heBn3j8u/eUoqr3EsQScnbHO3Z9XU16y+YaO7YpDZDniqsM/e42+Q0/Te02UJ0mI24/9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407403; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eqQXSFyP0kuFjE3fFDQshh/+swbSOqeRdeu3TmA5zKM=; b=bLx2uQNcRkibZzW9s8Rg1KPvj7BoBDUdsm6Cm59x3l3AqjYpJP7U9EBBTtNqXpDktQ+avw03g7xxZ9Fx4HcR/U+EfSZM0Lq8s+JwDh4hpJd2EsLIYWKDU26KfpXJBGnz2HUMOZUIINlCkEtacqd6NAesEUdbk1xFJQTKnjsLPXA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407403383344.05682964341327; Wed, 17 Jun 2020 08:23:23 -0700 (PDT) Received: from localhost ([::1]:51474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZuM-0002xk-A1 for importer@patchew.org; Wed, 17 Jun 2020 11:23:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOJ-0003mB-Ha for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:15 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:38884 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOG-0001rP-RF for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:14 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-sVOEbP1iP4-YplTOMPAqzA-1; Wed, 17 Jun 2020 10:50:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC972134D7; Wed, 17 Jun 2020 14:50:08 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id CED0F7CAA0; Wed, 17 Jun 2020 14:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eqQXSFyP0kuFjE3fFDQshh/+swbSOqeRdeu3TmA5zKM=; b=TVjeUlrdIkY7z2wOZxrJGfBTKyxJ0UGmxIjk5BFzFkTXDDwnEkYqu9PzW9z3USbaXTtn8Y j7zRuwlLYYrPWcFwd/m7kfqfxx+s05YUDLj6+/tp4U3ORRT1sv9DirCCP2uChSBxlam6Mj REpaD1vHh0cY6sOHsQD0oLlMztwu20c= X-MC-Unique: sVOEbP1iP4-YplTOMPAqzA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 39/43] iotests/041: Skip test_small_target for qed Date: Wed, 17 Jun 2020 16:49:05 +0200 Message-Id: <20200617144909.192176-40-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz qed does not support shrinking images, so the test_small_target method should be skipped to keep 041 passing. Fixes: 16cea4ee1c8e5a69a058e76f426b2e17974d8d7d Signed-off-by: Max Reitz Message-Id: <20200617104822.27525-3-mreitz@redhat.com> Tested-by: Thomas Huth Signed-off-by: Kevin Wolf --- tests/qemu-iotests/041 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041 index 601c756117..b843f88a66 100755 --- a/tests/qemu-iotests/041 +++ b/tests/qemu-iotests/041 @@ -277,6 +277,8 @@ class TestSingleBlockdev(TestSingleDrive): result =3D self.vm.run_job('job0') self.assertEqual(result, 'Source and target image have different s= izes') =20 + # qed does not support shrinking + @iotests.skip_for_formats(('qed')) def test_small_target(self): self.do_test_target_size(self.image_len // 2) =20 --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407086; cv=none; d=zohomail.com; s=zohoarc; b=LlPFieCJ1lyrgnfI/q/tj8UM22KnSrYmlRejviyGzwIh46m0Kj2xoApjWGjGopKNgrQ6yfmqwX4ZTNiJemMQKHNAwJiycl8cjOLbwpDMJn6lCnLC7VWUpBSNgracioeFNPeAS0RedBY19HZGzryUWSJiZAtmUynOg/mazjB2wiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407086; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1YzF2zYeHLHdgZyeMg7SvF4k2GFQa0dhiDsGJTjXkQA=; b=MM6nvuK7y+L4E3Uk42l/VbJcrpswSIcdzCwrJFgcKLERKM/Hh8Y4PmE7ZRNzwYmRmui11q8YBKdkAcIb51kcDuERZthYiK/qivuoGhyUondvKK48rnLH2a/xcJ6rrtvcQAAGmNgZ4/HapxBXHPmK9uaHS4gBw3jQyQ2TLHGtKbk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407086229568.8830741302102; Wed, 17 Jun 2020 08:18:06 -0700 (PDT) Received: from localhost ([::1]:44658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZba-0004PW-7p for importer@patchew.org; Wed, 17 Jun 2020 11:03:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOK-0003ni-5X for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:16 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:45443 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOH-0001s3-TO for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-39-vss185q0PNaDXUC2R8sbQA-1; Wed, 17 Jun 2020 10:50:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E8A5134D0; Wed, 17 Jun 2020 14:50:10 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 260E77CAA0; Wed, 17 Jun 2020 14:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1YzF2zYeHLHdgZyeMg7SvF4k2GFQa0dhiDsGJTjXkQA=; b=QFd9IvfuKynNMfBW1D8OSu0+P8RmyXLEG++xbttfIhxbJgxIsvmI+/pDN1PncXES6D26cO 8J2F6iO87Y1jAGjltuXY0vtW89yUxpLxAwprk0F5sg5u+JD+r2y4tCEal5JZxKvtvugUgy AmlvRllE9YmsK8xKfGq5/hFTL02xibM= X-MC-Unique: vss185q0PNaDXUC2R8sbQA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 40/43] iotests/292: data_file is unsupported Date: Wed, 17 Jun 2020 16:49:06 +0200 Message-Id: <20200617144909.192176-41-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kwolf@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz Fixes: e4d7019e1a81c61de6a925c3ac5bb6e62ea21b29 Signed-off-by: Max Reitz Message-Id: <20200617104822.27525-4-mreitz@redhat.com> Signed-off-by: Kevin Wolf --- tests/qemu-iotests/292 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/qemu-iotests/292 b/tests/qemu-iotests/292 index a2de27cca4..83ab19231d 100755 --- a/tests/qemu-iotests/292 +++ b/tests/qemu-iotests/292 @@ -40,6 +40,11 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux +# We need qemu-img map to show the file where the data is allocated, +# but with an external data file, it will show that instead of the +# file we want to check. So just skip this test for external data +# files. +_unsupported_imgopts data_file =20 echo '### Create the backing image' BACKING_IMG=3D"$TEST_IMG.base" --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592406865; cv=none; d=zohomail.com; s=zohoarc; b=Ai4DmLlGCYr0YzKccosgdtZ06y+TXpYyCrivXtx8MG//6ubkvzIW77D5UqyPm4Oihmyjq/ZeqFhiuy8cZcdrTcHWx4+se3IbyrgRtIdyJNXuP9dezjXG164j0TIzJcxUt3l7OwKcaXtlu+8i99zSUZ18frXgVhKJmdLi0lC4ya8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592406865; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=83wB9T7HX+oIDJxJh7iboMbmpbeTUk5kg1XD4my9L3k=; b=A3gxx4GQdai0tqd+7LCw5AqjJTZTrsTMDUXhkAgNPtxc2YFHej9oPs1glU9RYaFOPLUlkm+rUNbkX5/nRVaEHfUDim2m9C8dj0rEWv4L21Arm9JQxZ1EMQboWpxPTYS060o3piDWNIIjC6sn7JGWsjfLDorVFvEG0OMPD967u/w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592406865634729.6838973781552; Wed, 17 Jun 2020 08:14:25 -0700 (PDT) Received: from localhost ([::1]:53292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZlg-0004ff-9D for importer@patchew.org; Wed, 17 Jun 2020 11:14:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOL-0003qb-LY for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:17 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52262 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOJ-0001tJ-8r for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:17 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-315-3vctua3AME6O-PyJ_8dYeQ-1; Wed, 17 Jun 2020 10:50:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 63BAB18A2673; Wed, 17 Jun 2020 14:50:11 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68CCE7CAA0; Wed, 17 Jun 2020 14:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=83wB9T7HX+oIDJxJh7iboMbmpbeTUk5kg1XD4my9L3k=; b=W+ItJBaBWQldziQdoDMLRhnegrhmkV2bzKy1sLnWnsZy1/rBWaqdekrPX08VGVxBo6MUGg fi1cN+A5O/B6vTp0m3sa9x4b+n4UB+AF4hgK42KCgwkpJPBuhG2PQBdrz6FXijm9ayGRl1 phJC9IoDdDhFJA/0+pK7XexWP3aHDDg= X-MC-Unique: 3vctua3AME6O-PyJ_8dYeQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 41/43] iotests/229: data_file is unsupported Date: Wed, 17 Jun 2020 16:49:07 +0200 Message-Id: <20200617144909.192176-42-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz Fixes: d89ac3cf305b28c024a76805a84d75c0ee1e786f Signed-off-by: Max Reitz Message-Id: <20200617104822.27525-5-mreitz@redhat.com> Signed-off-by: Kevin Wolf --- tests/qemu-iotests/229 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229 index 99acb55ebb..89a5359f32 100755 --- a/tests/qemu-iotests/229 +++ b/tests/qemu-iotests/229 @@ -46,6 +46,9 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file _supported_os Linux +# blkdebug can only inject errors on bs->file, so external data files +# do not work with this test +_unsupported_imgopts data_file =20 =20 DEST_IMG=3D"$TEST_DIR/d.$IMGFMT" --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407506; cv=none; d=zohomail.com; s=zohoarc; b=F7sp/tJKDQfDizocbjkcGFNVbLXU8Zx2ZIrrcHzTWw2oqHDr4QzRFff2+SdL6iewFm6NlmT/JAzAR4gXqljDEgiArKf3Dem1xrUDsJAGTN9UeveiS1mI+/ePU11ffHVGfcmpxKTQifysic863T6k+sBbizrXL8XBKULEZyQ01/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407506; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aCyRlcLsLgVaRXnU5SLsAruLHHDQZWjPTIPP8PG6N8w=; b=ZB3NHEmSKm/5VhgpYaMoPHgYhuOOFkC0TvKNi1ZwhjSNbAt6HYbVOz0fOjrSYJNL3qOD6CFp5uoVGQdpIUYQQsNqbJH8yl7f631Sqe9WGu6ZMFQadH82EXsJo8Qqgug8n+QK9a8IIWIDWMDnrVTHxMV5xAsw1EbKMBBJ+Ix+sTo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407506178487.60408437267654; Wed, 17 Jun 2020 08:25:06 -0700 (PDT) Received: from localhost ([::1]:56368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZw1-00052u-3s for importer@patchew.org; Wed, 17 Jun 2020 11:25:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOP-00041y-Hw for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:21 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24858 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZON-0001wo-Rj for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:21 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-_40xnGk-MuKe-J7Bqb9zjQ-1; Wed, 17 Jun 2020 10:50:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A6C28100CCCB; Wed, 17 Jun 2020 14:50:13 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACAFD7CAB0; Wed, 17 Jun 2020 14:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405419; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aCyRlcLsLgVaRXnU5SLsAruLHHDQZWjPTIPP8PG6N8w=; b=Gh20qtoemgV0udipwT1ig7coYYRtMOhSZpavhuHzCzXluJGTTwK6Tc93zymzZhoDhlcSHU 3OTJSHe9jXII1yfMzr0fTZrWXOduPdGiQzp8pwN8r4z3LBkm1AOOz43BukJSmwMEInG1t4 9fRgiLJiHwAE/Cez8CFkChpGFngbHcM= X-MC-Unique: _40xnGk-MuKe-J7Bqb9zjQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 42/43] iotests/{190,291}: compat=0.10 is unsupported Date: Wed, 17 Jun 2020 16:49:08 +0200 Message-Id: <20200617144909.192176-43-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=kwolf@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 01:42:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Max Reitz Fixes: 5d72c68b49769c927e90b78af6d90f6a384b26ac Fixes: cf2d1203dcfc2bf964453d83a2302231ce77f2dc Signed-off-by: Max Reitz Message-Id: <20200617104822.27525-6-mreitz@redhat.com> Signed-off-by: Kevin Wolf --- tests/qemu-iotests/190 | 2 ++ tests/qemu-iotests/291 | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190 index fe630918e9..c22d8d64f9 100755 --- a/tests/qemu-iotests/190 +++ b/tests/qemu-iotests/190 @@ -41,6 +41,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # See 178 for more extensive tests across more formats _supported_fmt qcow2 _supported_proto file +# compat=3D0.10 does not support bitmaps +_unsupported_imgopts 'compat=3D0.10' =20 echo "=3D=3D Huge file without bitmaps =3D=3D" echo diff --git a/tests/qemu-iotests/291 b/tests/qemu-iotests/291 index 404f8521f7..28e4fb9b4d 100755 --- a/tests/qemu-iotests/291 +++ b/tests/qemu-iotests/291 @@ -39,6 +39,8 @@ _supported_fmt qcow2 _supported_proto file _supported_os Linux _require_command QEMU_NBD +# compat=3D0.10 does not support bitmaps +_unsupported_imgopts 'compat=3D0.10' =20 echo echo "=3D=3D=3D Initial image setup =3D=3D=3D" --=20 2.25.4 From nobody Wed Jun 26 00:47:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592407637; cv=none; d=zohomail.com; s=zohoarc; b=LGCcUbC7v3ystNCrkdUHimxD4vQIMJIWzKNIJv+Zh4bqapMFQA/SK9b2dS/VW/17+CbaqYb1wpHkNOdvxM//OvHY0xYTaFJZUNBYwwiB5n4RXZpSGQ3XoxJ91KFax7HiowGIv6zPI7UjHt9h9txOBhXKOWieDyXsBSmfEMhOfP4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592407637; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QBRyIk7B7xmT8l1t42vYAaOZtJ4LS49ba0oQDJ/xDdY=; b=Wlua2bp3oawokTHWGHLofz5E0eVo0blHLcaazsda92n2/ZJ1ef+FRYGPjAJ5ckBgOEeyTR/cwHrzN0KGyDPHdgfS+7ldkDrc5v2IvO3pZIVjRfIjZPBvDPb30vzviEkypzqyDINimawPe8NC++MOjwHpK81nwAdY3boEr+V6Xic= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592407637325335.08951782639565; Wed, 17 Jun 2020 08:27:17 -0700 (PDT) Received: from localhost ([::1]:33636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlZy8-0007QE-4g for importer@patchew.org; Wed, 17 Jun 2020 11:27:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlZOS-00049J-91 for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:24 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:20871 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jlZOP-0001xW-9V for qemu-devel@nongnu.org; Wed, 17 Jun 2020 10:50:23 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-gr3tsLZTPxSsQh31q23HHA-1; Wed, 17 Jun 2020 10:50:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E8B32100CCCE; Wed, 17 Jun 2020 14:50:13 +0000 (UTC) Received: from linux.fritz.box.com (ovpn-114-44.ams2.redhat.com [10.36.114.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEF977CAD9; Wed, 17 Jun 2020 14:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592405420; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QBRyIk7B7xmT8l1t42vYAaOZtJ4LS49ba0oQDJ/xDdY=; b=P4f7W71pYRXnZg+rUl2WayEAar54TLbW0PkoKv4N5h6Z/GlgrAGwY84VzhcuOvZkzkkT+d Om3dWyrkJAjr4zcckT/mOHVHIn7yRCxIy2BqPh+FPEh4kYXWYQqd4em2h8TfBPOcamMYI4 CxOK3KUCzJ3uz08A0zAvLHkSM2eM1LU= X-MC-Unique: gr3tsLZTPxSsQh31q23HHA-1 From: Kevin Wolf To: qemu-block@nongnu.org Subject: [PULL 43/43] iotests: Add copyright line in qcow2.py Date: Wed, 17 Jun 2020 16:49:09 +0200 Message-Id: <20200617144909.192176-44-kwolf@redhat.com> In-Reply-To: <20200617144909.192176-1-kwolf@redhat.com> References: <20200617144909.192176-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 02:02:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) From: Eric Blake The file qcow2.py was originally contributed in 2012 by Kevin Wolf, but was not given traditional boilerplate headers at the time. The missing license was just rectified (commit 16306a7b39) using the project-default GPLv2+, but as Vladimir is not at Red Hat, he did not add a Copyright line. All earlier contributions have come from CC'd authors, where all but Stefan used a Red Hat address at the time of the contribution, and that copyright carries over to the split to qcow2_format.py (d5262c7124). CC: Kevin Wolf CC: Stefan Hajnoczi CC: Eduardo Habkost CC: Max Reitz CC: Philippe Mathieu-Daud=C3=A9 CC: Paolo Bonzini Signed-off-by: Eric Blake Message-Id: <20200609205944.3549240-1-eblake@redhat.com> Acked-by: Stefan Hajnoczi Acked-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Kevin Wolf --- tests/qemu-iotests/qcow2.py | 2 ++ tests/qemu-iotests/qcow2_format.py | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py index 8c187e9a72..0910e6ac07 100755 --- a/tests/qemu-iotests/qcow2.py +++ b/tests/qemu-iotests/qcow2.py @@ -2,6 +2,8 @@ # # Manipulations with qcow2 image # +# Copyright (C) 2012 Red Hat, Inc. +# # 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 diff --git a/tests/qemu-iotests/qcow2_format.py b/tests/qemu-iotests/qcow2_= format.py index 0f65fd161d..cc432e7ae0 100644 --- a/tests/qemu-iotests/qcow2_format.py +++ b/tests/qemu-iotests/qcow2_format.py @@ -1,6 +1,7 @@ # Library for manipulations with qcow2 image # # Copyright (c) 2020 Virtuozzo International GmbH. +# Copyright (C) 2012 Red Hat, Inc. # # 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 --=20 2.25.4