From nobody Sat May 10 12:13:28 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1509637882535688.6273775279209; Thu, 2 Nov 2017 08:51:22 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1eAHls-0007nw-QG; Thu, 02 Nov 2017 16:51:08 +0100 Received: from mx1.redhat.com ([209.132.183.28]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1eAHlh-0007m7-Cz for seabios@seabios.org; Thu, 02 Nov 2017 16:51:07 +0100 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9BB8369C4; Thu, 2 Nov 2017 15:50:54 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A15660BE5; Thu, 2 Nov 2017 15:50:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7C4113FB91; Thu, 2 Nov 2017 16:50:51 +0100 (CET) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B9BB8369C4 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com From: Gerd Hoffmann To: seabios@seabios.org, kvm@vger.kernel.org Date: Thu, 2 Nov 2017 16:50:30 +0100 Message-Id: <20171102155031.17454-3-kraxel@redhat.com> In-Reply-To: <20171102155031.17454-1-kraxel@redhat.com> References: <20171102155031.17454-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 02 Nov 2017 15:50:54 +0000 (UTC) X-Spam-Score: -3.0 (---) Subject: [SeaBIOS] [PATCH seabios 2/3] kvmtool: allow mmio for legacy bar 0 X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" kvmtool uses MMIO not IO bar for legacy virtio. Doesn't match spec. But easy to handle given we have the code anyway for virtio 1.0 which allows both MMIO and IO. Signed-off-by: Gerd Hoffmann --- src/hw/virtio-pci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/hw/virtio-pci.c b/src/hw/virtio-pci.c index 96f9c6b012..1a3acc9962 100644 --- a/src/hw/virtio-pci.c +++ b/src/hw/virtio-pci.c @@ -488,10 +488,18 @@ void vp_init_simple(struct vp_device *vp, struct pci_= device *pci) } else { dprintf(1, "pci dev %pP using legacy (0.9.5) virtio mode\n", pci); vp->legacy.bar =3D 0; - vp->legacy.ioaddr =3D pci_enable_iobar(pci, PCI_BASE_ADDRESS_0); - if (!vp->legacy.ioaddr) - return; - vp->legacy.mode =3D VP_ACCESS_IO; + addr =3D pci_config_readl(pci->bdf, PCI_BASE_ADDRESS_0); + if (addr & PCI_BASE_ADDRESS_SPACE_IO) { + vp->legacy.ioaddr =3D addr & PCI_BASE_ADDRESS_IO_MASK; + if (!vp->legacy.ioaddr) + return; + vp->legacy.mode =3D VP_ACCESS_IO; + } else { + vp->legacy.ioaddr =3D addr & PCI_BASE_ADDRESS_MEM_MASK; + if (!vp->legacy.ioaddr) + return; + vp->legacy.mode =3D VP_ACCESS_MMIO; + } } =20 vp_reset(vp); --=20 2.9.3 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios