From patchwork Wed Oct 23 10:04:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 1182030 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="baVmfWeP"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46ymxd5Znmz9sNx for ; Wed, 23 Oct 2019 21:36:05 +1100 (AEDT) Received: from localhost ([::1]:60054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNDzn-0006Nb-85 for incoming@patchwork.ozlabs.org; Wed, 23 Oct 2019 06:36:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40596) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNDYV-0005cW-De for qemu-devel@nongnu.org; Wed, 23 Oct 2019 06:07:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNDYQ-0003VO-Pn for qemu-devel@nongnu.org; Wed, 23 Oct 2019 06:07:50 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:33010 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNDYO-0003S6-JF for qemu-devel@nongnu.org; Wed, 23 Oct 2019 06:07:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571825263; 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=372NNTcYnSIQBMgZ5qLgMiK1FMNHd9cWDMz+HfJfX38=; b=baVmfWePoKv+K5NaAezBlUcndLnhECBFWXxBh6RVfZr8wl3LU11PffjNtfpoxajvktyPqJ tbs1s1+teOdywQAvPRizDP9XSwiYPhHASb+sff/nF+yQrLecOH1i1/EPb0lsofOCXd7na4 GKUt/nGxMPzGrFSGJ5vDdo66CEue280= 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-76-tmfB42kUNLCS01B_CPvpXA-1; Wed, 23 Oct 2019 06:07:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08E0047B; Wed, 23 Oct 2019 10:07:41 +0000 (UTC) Received: from localhost (unknown [10.36.118.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DC7D1001E75; Wed, 23 Oct 2019 10:07:28 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v4 14/16] libqos: make the virtio-pci BAR index configurable Date: Wed, 23 Oct 2019 11:04:23 +0100 Message-Id: <20191023100425.12168-15-stefanha@redhat.com> In-Reply-To: <20191023100425.12168-1-stefanha@redhat.com> References: <20191023100425.12168-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: tmfB42kUNLCS01B_CPvpXA-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 205.139.110.120 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: Fam Zheng , Laurent Vivier , Thomas Huth , qemu-block@nongnu.org, slp@redhat.com, "Michael S. Tsirkin" , Cornelia Huck , Stefan Hajnoczi , Christophe de Dinechin , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The Legacy virtio-pci interface always uses BAR 0. VIRTIO 1.0 may need to use a different BAR index, so make it configurable. Signed-off-by: Stefan Hajnoczi Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé --- v3: * Change uint8_t bar_idx to int [Thomas] --- tests/libqos/virtio-pci.h | 2 ++ tests/libqos/virtio-pci.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/libqos/virtio-pci.h b/tests/libqos/virtio-pci.h index 0e4a8b7b00..78a1c15c2a 100644 --- a/tests/libqos/virtio-pci.h +++ b/tests/libqos/virtio-pci.h @@ -25,6 +25,8 @@ typedef struct QVirtioPCIDevice { uint16_t config_msix_entry; uint64_t config_msix_addr; uint32_t config_msix_data; + + int bar_idx; } QVirtioPCIDevice; struct QVirtioPCIMSIXOps { diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c index c900742f96..e9595603f5 100644 --- a/tests/libqos/virtio-pci.c +++ b/tests/libqos/virtio-pci.c @@ -310,7 +310,7 @@ static const QVirtioPCIMSIXOps qvirtio_pci_msix_ops_legacy = { void qvirtio_pci_device_enable(QVirtioPCIDevice *d) { qpci_device_enable(d->pdev); - d->bar = qpci_iomap(d->pdev, 0, NULL); + d->bar = qpci_iomap(d->pdev, d->bar_idx, NULL); } void qvirtio_pci_device_disable(QVirtioPCIDevice *d) @@ -400,6 +400,7 @@ static void qvirtio_pci_init_from_pcidev(QVirtioPCIDevice *dev, QPCIDevice *pci_ { dev->pdev = pci_dev; dev->vdev.device_type = qpci_config_readw(pci_dev, PCI_SUBSYSTEM_ID); + dev->bar_idx = 0; dev->config_msix_entry = -1; dev->msix_ops = &qvirtio_pci_msix_ops_legacy;