From nobody Sun May 5 14:38:59 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575654376; cv=none; d=zohomail.com; s=zohoarc; b=CtdSyHJH9JuQkbJKRSao/U4PND77JfE7oRiIoX+J7P5guy+M+RtWYjwIAjQTBGF3GAtf7KkOnCfUnDa0vm/omAc8X8p0WTtu97Af0OQ9qG17Y5qhZFM0JiAb1PYn10OqA6aBD38uMyCUI2hvNaSXoTgdPvkNMDK0BW4aBgmAkTA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575654376; 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=DQT1twDpLbPdu5i3g7UASwR5tJqP0VI32dQgZGzQBd4=; b=iyIn/zpy1sR19dkESS3YF418MAdOUjZrz31MwFP02EoHU1vAnTJYm0S6QGViNzIbkQa4GVBMhcm/Y+EupR0d2exxAQppUz0b2c2i5/kL3x6WM1OjyF8YwW9zDhw17ECia0VD96eQc3d7Ntk5Ud64asiIt5GJNo2YqLLp3uaGz8U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1575654376710712.0993512582548; Fri, 6 Dec 2019 09:46:16 -0800 (PST) Received: from localhost ([::1]:42492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHgE-0005KB-U9 for importer@patchew.org; Fri, 06 Dec 2019 12:46:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33183) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHMW-0008GY-Kd for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idHMT-00071N-G8 for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:50 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:54173 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1idHMJ-0006ph-Nc for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:41 -0500 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-313-UN4_S0gqMUivaCNQkYQQoA-1; Fri, 06 Dec 2019 12:25:30 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 397A71883521; Fri, 6 Dec 2019 17:25:29 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-212.brq.redhat.com [10.40.204.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6F215C1C3; Fri, 6 Dec 2019 17:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575653133; 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=DQT1twDpLbPdu5i3g7UASwR5tJqP0VI32dQgZGzQBd4=; b=K2+9jvJWtIYuTEqCXCxQOmrSZJQAGCdmJqFSnWCHMHSihQqw8AMABltcVZWd31Z1l0KTTt 563EljYqUorM+K0PK3Iwct5hgGVVbPV8DpiZOrriPAORk2yiN1bU8LGf4MCi7mMDS92aXW tGVY4MUQfKn0NEpmTbD8Fd4uGAtX5QU= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.0 v2 1/6] hw/pci-host/i440fx: Correct the header description Date: Fri, 6 Dec 2019 18:25:09 +0100 Message-Id: <20191206172514.21268-2-philmd@redhat.com> In-Reply-To: <20191206172514.21268-1-philmd@redhat.com> References: <20191206172514.21268-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: UN4_S0gqMUivaCNQkYQQoA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: Thomas Huth , "Michael S. Tsirkin" , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Missed during the refactor in commits 14a026dd58 and 0f25d865a, this file is now only about the i440FX chipset. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/i440fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index f27131102d..3fc94426ea 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -1,5 +1,5 @@ /* - * QEMU i440FX/PIIX3 PCI Bridge Emulation + * QEMU i440FX PCI Bridge Emulation * * Copyright (c) 2006 Fabrice Bellard * --=20 2.21.0 From nobody Sun May 5 14:38:59 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575654599; cv=none; d=zohomail.com; s=zohoarc; b=IS2xkVYLpz4tmnTa5/VPSoeMWjc0WV4YA6jkHUOAm9DJIgDIcV05lwSIZ2frql09cgyX+DEWlrPGfiUXJ0Lym75y+y3knUQrV6mEMtKHVp6xy4h9m0bsMG+F4A05JvBpt6n+91GeIw1Ueo9opRzH+JyBHXQDPwfMi7ZXcldUwMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575654599; 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=65dn2EaMCTP37YOCYHLxZUlHztk6cKACuH+ML1W/q/Y=; b=OgmF9ZJtvZkF3fL2kG1Xb6OGMdf2cxGnTSUTHJdjKm2WsF4qVP+5vDzUMvjCfUU6AfediW3mt16dEWpIW8FSIIwB8T5/ZnwkN1gaCcL8Gic5+9aFCL0Pibu1DhDqv2MhHfwmS4qGYsuRcSts6SeqNUZlpaeMVVeTe7cXWqRmzPI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1575654599681256.994137793406; Fri, 6 Dec 2019 09:49:59 -0800 (PST) Received: from localhost ([::1]:42536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHjq-0000n7-5S for importer@patchew.org; Fri, 06 Dec 2019 12:49:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33187) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHMW-0008GZ-Kl for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idHMT-00071c-Gn for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:50 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:56909 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1idHMN-0006ut-Fw for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:46 -0500 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-373-8050xD_CMJmfp4Lka9As7A-1; Fri, 06 Dec 2019 12:25:37 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2AF3800D5E; Fri, 6 Dec 2019 17:25:35 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-212.brq.redhat.com [10.40.204.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 068835C1C3; Fri, 6 Dec 2019 17:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575653140; 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=65dn2EaMCTP37YOCYHLxZUlHztk6cKACuH+ML1W/q/Y=; b=aMziH11yQgjQtf/AW/mkS61z6aXPuSFZD+m3gRvZ6GZ7v+5vSaWs+hDv+IgULtwuf1blXD Sao1I+yJ5oL1VJG2xBCbFQsvnSX5IMs4RvhREt4roxDfTttSTch353LwNBrjXTdBU3djOq mBNYbEQTnLr3iwQaU4Eipx8qpXiUWBM= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.0 v2 2/6] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Date: Fri, 6 Dec 2019 18:25:10 +0100 Message-Id: <20191206172514.21268-3-philmd@redhat.com> In-Reply-To: <20191206172514.21268-1-philmd@redhat.com> References: <20191206172514.21268-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: 8050xD_CMJmfp4Lka9As7A-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: Thomas Huth , "Michael S. Tsirkin" , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Make the PCII440FXState structure public, so it can be used out of this source file. This will allow us to extract the IGD Passthrough Host Bridge, which is a children of the TYPE_I440FX_PCI_DEVICE. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/pci-host/i440fx.h | 19 +++++++++++++++++-- hw/pci-host/i440fx.c | 18 ------------------ 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index f54e6466e4..cc58d82ed4 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -13,12 +13,27 @@ =20 #include "hw/hw.h" #include "hw/pci/pci_bus.h" - -typedef struct PCII440FXState PCII440FXState; +#include "hw/pci-host/pam.h" =20 #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" #define TYPE_I440FX_PCI_DEVICE "i440FX" =20 +#define I440FX_PCI_DEVICE(obj) \ + OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE) + +typedef struct PCII440FXState { + /*< private >*/ + PCIDevice parent_obj; + /*< public >*/ + + MemoryRegion *system_memory; + MemoryRegion *pci_address_space; + MemoryRegion *ram_memory; + PAMMemoryRegion pam_regions[13]; + MemoryRegion smram_region; + MemoryRegion smram, low_smram; +} PCII440FXState; + #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" =20 PCIBus *i440fx_init(const char *host_type, const char *pci_type, diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 3fc94426ea..fbdc563599 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -31,7 +31,6 @@ #include "hw/sysbus.h" #include "qapi/error.h" #include "migration/vmstate.h" -#include "hw/pci-host/pam.h" #include "qapi/visitor.h" #include "qemu/error-report.h" =20 @@ -51,23 +50,6 @@ typedef struct I440FXState { uint32_t short_root_bus; } I440FXState; =20 -#define I440FX_PCI_DEVICE(obj) \ - OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE) - -struct PCII440FXState { - /*< private >*/ - PCIDevice parent_obj; - /*< public >*/ - - MemoryRegion *system_memory; - MemoryRegion *pci_address_space; - MemoryRegion *ram_memory; - PAMMemoryRegion pam_regions[13]; - MemoryRegion smram_region; - MemoryRegion smram, low_smram; -}; - - #define I440FX_PAM 0x59 #define I440FX_PAM_SIZE 7 #define I440FX_SMRAM 0x72 --=20 2.21.0 From nobody Sun May 5 14:38:59 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575657402; cv=none; d=zohomail.com; s=zohoarc; b=i6j6uyEFkXUk/o8kYxUvNyKWDfVUtb9nn+QTnQ4luJD1HPKmlGKZNyKF9x9W/IKV6TnOqX12IZQOGB8BRBNmvtAEBJDYwReUoDL6aZQStiXbNpJ3P+bYj9C2Zp7Ejp9Jel5egorPRs+7oJ4Fl6RYQLcvk4Jp7QjeejFL761LwAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575657402; 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=nQooNv4KuAJbOCpnZQESZEyWieR/hAlT1WGgxUjJTpQ=; b=JjaYqOZjb3KAgFFAZBaVNXycqlBX/N/Bv58wArCLZtXFGDMNJvye8aV0/d/Y4HPDVEAUV0f/OyoySDmwe6pbNztuvM1jSansUN3eKTTF/VrP5vPvs96peCcTn91bR7uSeMn7J+v69+vWsGNyFFFPIh3c7ddeArueFmB3PBdJx60= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1575657402780408.3782578767135; Fri, 6 Dec 2019 10:36:42 -0800 (PST) Received: from localhost ([::1]:43662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idIT3-0002ww-Ip for importer@patchew.org; Fri, 06 Dec 2019 13:36:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33263) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHMZ-0008Gv-Uu for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idHMW-00075V-KN for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:53 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49627 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 1idHMU-0006vJ-5b for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:50 -0500 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-273-_nT3yCq4Neyb1iO-Ui7GbQ-1; Fri, 06 Dec 2019 12:25:39 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A22E4DBE6; Fri, 6 Dec 2019 17:25:38 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-212.brq.redhat.com [10.40.204.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FAC65C1C3; Fri, 6 Dec 2019 17:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575653140; 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=nQooNv4KuAJbOCpnZQESZEyWieR/hAlT1WGgxUjJTpQ=; b=Ox5V+JUcOq5SnVwzk3FFKfGOyvmqrR9C0UqWgSrbNGQBLQyIF2aeiA1DslCVFS1tx+l/RY g0cJaEeJOfS2RItY//mHZKdG+yB5w2TNmcF7VNw1PGp6smIE/n2+0ajTwq/Sv/5yH64SoF SHJAaSSVi1zB0nec7n/pO3ID5rJE7pc= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.0 v2 3/6] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Date: Fri, 6 Dec 2019 18:25:11 +0100 Message-Id: <20191206172514.21268-4-philmd@redhat.com> In-Reply-To: <20191206172514.21268-1-philmd@redhat.com> References: <20191206172514.21268-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: _nT3yCq4Neyb1iO-Ui7GbQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.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: Thomas Huth , "Michael S. Tsirkin" , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We don't enforce the -Wsign-conversion CPPFLAG, but it doesn't hurt to avoid this warning: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka '= unsigned long') [-Wsign-conversion] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/i440fx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index fbdc563599..0cc80b276d 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -419,12 +419,11 @@ out: static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) { uint32_t val =3D 0; - int i, num; + size_t i; int pos, len; Error *local_err =3D NULL; =20 - num =3D ARRAY_SIZE(igd_host_bridge_infos); - for (i =3D 0; i < num; i++) { + for (i =3D 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) { pos =3D igd_host_bridge_infos[i].offset; len =3D igd_host_bridge_infos[i].len; host_pci_config_read(pos, len, &val, &local_err); --=20 2.21.0 From nobody Sun May 5 14:38:59 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575654773; cv=none; d=zohomail.com; s=zohoarc; b=Nbb2PpM8OpgeoMbTmZpXqWtLM6etXdGpNDqhNcWdOfAarqL19KlU4XWJXxWAg6RFvZ+QzT0QdQOtJi4kFF+wx+aYhG1c5ChwOz34O4w/Tq4Zgrgdhe7KBKTYoKuzbx26X+G5kSP9Zw7DCaJdYVFWkKHA0OZuE61YEJ/cT6YbJcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575654773; 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=2iD6T3th+ueTgWBqM5ey4lwC4HSji2/frVsA2WgJMg0=; b=PhVVRMFlg+wqaf8CBg40KLX0wpi0g75ccadvS8yLfVDPGBDhslWxuLmgm0FFGLWq7U2qt46+JNd3icgvslptYxgfa/mFpzzvVbcD/EbP8gz58KUN0TNN6bYe4KwJHHVYsWMYVsrq2Lep8M/jSfpkmBrmdmGQiXUEsjOc+cLv7kQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1575654773190419.4696239621346; Fri, 6 Dec 2019 09:52:53 -0800 (PST) Received: from localhost ([::1]:42608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHmd-0004ph-E2 for importer@patchew.org; Fri, 06 Dec 2019 12:52:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33302) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHMa-0008HI-Vx for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idHMY-00078E-8R for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:55 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35889 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 1idHMW-00073H-SY for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:53 -0500 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-415-vlIwAwDEM_WoBwOTa-OnCQ-1; Fri, 06 Dec 2019 12:25:48 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E3F91005514; Fri, 6 Dec 2019 17:25:47 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-212.brq.redhat.com [10.40.204.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23CBC5C1C3; Fri, 6 Dec 2019 17:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575653151; 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=2iD6T3th+ueTgWBqM5ey4lwC4HSji2/frVsA2WgJMg0=; b=Fsu0StlEl5s9SvOYviSKfJCxi7ZqdHu+vWXUkfd2uctG4/abSPREvnKrALKD3YyyrayWUo 12Fzczwfb0aQdvZ3yEUvn7CrwD/027aQsBu2XM+Vn7Tph072SyVUJF0DXjJ0YKyNY1jlA9 d1M3luCiSfe6bWCa4H2PYatbxwkf3PM= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.0 v2 4/6] hw/pci-host/i440fx: Use existing definitions instead of magic values Date: Fri, 6 Dec 2019 18:25:12 +0100 Message-Id: <20191206172514.21268-5-philmd@redhat.com> In-Reply-To: <20191206172514.21268-1-philmd@redhat.com> References: <20191206172514.21268-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: vlIwAwDEM_WoBwOTa-OnCQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.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: Thomas Huth , "Michael S. Tsirkin" , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Use definitions from "hw/pci/pci_regs.h". This also helps when using git-grep. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/i440fx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 0cc80b276d..414138595b 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -376,13 +376,13 @@ typedef struct { =20 /* Here we just expose minimal host bridge offset subset. */ static const IGDHostInfo igd_host_bridge_infos[] =3D { - {0x08, 2}, /* revision id */ - {0x2c, 2}, /* sybsystem vendor id */ - {0x2e, 2}, /* sybsystem id */ - {0x50, 2}, /* SNB: processor graphics control register */ - {0x52, 2}, /* processor graphics control register */ - {0xa4, 4}, /* SNB: graphics base of stolen memory */ - {0xa8, 4}, /* SNB: base of GTT stolen memory */ + {PCI_REVISION_ID, 2}, + {PCI_SUBSYSTEM_VENDOR_ID, 2}, + {PCI_SUBSYSTEM_ID, 2}, + {0x50, 2}, /* SNB: processor graphics control regis= ter */ + {0x52, 2}, /* processor graphics control register */ + {0xa4, 4}, /* SNB: graphics base of stolen memory */ + {0xa8, 4}, /* SNB: base of GTT stolen memory */ }; =20 static void host_pci_config_read(int pos, int len, uint32_t *val, Error **= errp) --=20 2.21.0 From nobody Sun May 5 14:38:59 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575657500; cv=none; d=zohomail.com; s=zohoarc; b=ZKFcxjmEWpa7C2C+8a5tFQdIT3Kb4mcxfPByrBnPkca/64PB1EFojhuYEIGEzktR25PJ9Tjxfne3X0S+Nu3DNxISs79y59gpnGIp5+5uLChErheMK3RXrJ9vjr11qFFa7Hy6m53pn5CfUPD3Eubs7sHrkz4XKjHSGrDlPC+2TG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575657500; 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=zyxQiqqrEprht3py1dbaIiNqypLtgpZdIv+cmw+Abmk=; b=ZolKPbrH/kRxgU/4n9O9gh9qigBswePRlGJds4TBcBlD7RPzqkKNt3AWtQMk1QEhSX43lptJz75Rxw37rI51VLZDUNKBXUEkeILQ54OD1dmdLMbnO0/zzNRmABTRFFXSK8wB9DUDDOoHdqLbaQqayPDagHwh4NYKIBrehtF7LaA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1575657500256662.2393771060711; Fri, 6 Dec 2019 10:38:20 -0800 (PST) Received: from localhost ([::1]:43678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idIUc-0004l9-UX for importer@patchew.org; Fri, 06 Dec 2019 13:38:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33397) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHMf-0008Hq-2i for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:26:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idHMa-0007Az-Vw for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:58 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:52106 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1idHMY-00077y-LG for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:55 -0500 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-227-lN49Q2DVM9u6yvlQUx3dhQ-1; Fri, 06 Dec 2019 12:25:52 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C385E800EB5; Fri, 6 Dec 2019 17:25:51 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-212.brq.redhat.com [10.40.204.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C2E75C1C3; Fri, 6 Dec 2019 17:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575653154; 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=zyxQiqqrEprht3py1dbaIiNqypLtgpZdIv+cmw+Abmk=; b=E1N97CPwDBoOWi79UMRAUNoJ1+xgRcN8GThy1bkVSio92/ss7AyojGouxcZ7deniht4wT9 YMAtW3bMtwpmiz+pej0lpmGn3wHsINPuNIz7P62u5egvj+qBy8Q52YzCklNLTZHbruDIqe BHBqVh3TJdE3qHYNmAho/7NX9NB6Osg= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.0 v2 5/6] hw/pci-host/i440fx: Extract the IGD Passthrough Host Bridge device Date: Fri, 6 Dec 2019 18:25:13 +0100 Message-Id: <20191206172514.21268-6-philmd@redhat.com> In-Reply-To: <20191206172514.21268-1-philmd@redhat.com> References: <20191206172514.21268-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: lN49Q2DVM9u6yvlQUx3dhQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: Thomas Huth , "Michael S. Tsirkin" , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We can use a i440FX without the IGD passthrough host bridge. Extract it into a new file, 'hw/pci-host/igd_pt.c'. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/i440fx.c | 84 -------------------------- hw/pci-host/igd_pt.c | 120 ++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + hw/pci-host/Makefile.objs | 1 + 4 files changed, 122 insertions(+), 84 deletions(-) create mode 100644 hw/pci-host/igd_pt.c diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 414138595b..bae7b42327 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -368,89 +368,6 @@ static const TypeInfo i440fx_info =3D { }, }; =20 -/* IGD Passthrough Host Bridge. */ -typedef struct { - uint8_t offset; - uint8_t len; -} IGDHostInfo; - -/* Here we just expose minimal host bridge offset subset. */ -static const IGDHostInfo igd_host_bridge_infos[] =3D { - {PCI_REVISION_ID, 2}, - {PCI_SUBSYSTEM_VENDOR_ID, 2}, - {PCI_SUBSYSTEM_ID, 2}, - {0x50, 2}, /* SNB: processor graphics control regis= ter */ - {0x52, 2}, /* processor graphics control register */ - {0xa4, 4}, /* SNB: graphics base of stolen memory */ - {0xa8, 4}, /* SNB: base of GTT stolen memory */ -}; - -static void host_pci_config_read(int pos, int len, uint32_t *val, Error **= errp) -{ - int rc, config_fd; - /* Access real host bridge. */ - char *path =3D g_strdup_printf("/sys/bus/pci/devices/%04x:%02x:%02x.%d= /%s", - 0, 0, 0, 0, "config"); - - config_fd =3D open(path, O_RDWR); - if (config_fd < 0) { - error_setg_errno(errp, errno, "Failed to open: %s", path); - goto out; - } - - if (lseek(config_fd, pos, SEEK_SET) !=3D pos) { - error_setg_errno(errp, errno, "Failed to seek: %s", path); - goto out_close_fd; - } - - do { - rc =3D read(config_fd, (uint8_t *)val, len); - } while (rc < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); - if (rc !=3D len) { - error_setg_errno(errp, errno, "Failed to read: %s", path); - } - -out_close_fd: - close(config_fd); -out: - g_free(path); -} - -static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) -{ - uint32_t val =3D 0; - size_t i; - int pos, len; - Error *local_err =3D NULL; - - for (i =3D 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) { - pos =3D igd_host_bridge_infos[i].offset; - len =3D igd_host_bridge_infos[i].len; - host_pci_config_read(pos, len, &val, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - pci_default_write_config(pci_dev, pos, val, len); - } -} - -static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *da= ta) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - - k->realize =3D igd_pt_i440fx_realize; - dc->desc =3D "IGD Passthrough Host bridge"; -} - -static const TypeInfo igd_passthrough_i440fx_info =3D { - .name =3D TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE, - .parent =3D TYPE_I440FX_PCI_DEVICE, - .instance_size =3D sizeof(PCII440FXState), - .class_init =3D igd_passthrough_i440fx_class_init, -}; - static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge, PCIBus *rootbus) { @@ -495,7 +412,6 @@ static const TypeInfo i440fx_pcihost_info =3D { static void i440fx_register_types(void) { type_register_static(&i440fx_info); - type_register_static(&igd_passthrough_i440fx_info); type_register_static(&i440fx_pcihost_info); } =20 diff --git a/hw/pci-host/igd_pt.c b/hw/pci-host/igd_pt.c new file mode 100644 index 0000000000..efcc9347ff --- /dev/null +++ b/hw/pci-host/igd_pt.c @@ -0,0 +1,120 @@ +/* + * QEMU Intel IGD Passthrough Host Bridge Emulation + * + * Copyright (c) 2006 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "hw/pci/pci.h" +#include "hw/pci/pci_host.h" +#include "hw/pci-host/i440fx.h" +#include "qapi/error.h" + +typedef struct { + uint8_t offset; + uint8_t len; +} IGDHostInfo; + +/* Here we just expose minimal host bridge offset subset. */ +static const IGDHostInfo igd_host_bridge_infos[] =3D { + {PCI_REVISION_ID, 2}, + {PCI_SUBSYSTEM_VENDOR_ID, 2}, + {PCI_SUBSYSTEM_ID, 2}, + {0x50, 2}, /* SNB: processor graphics control regis= ter */ + {0x52, 2}, /* processor graphics control register */ + {0xa4, 4}, /* SNB: graphics base of stolen memory */ + {0xa8, 4}, /* SNB: base of GTT stolen memory */ +}; + +static void host_pci_config_read(int pos, int len, uint32_t *val, Error **= errp) +{ + int rc, config_fd; + /* Access real host bridge. */ + char *path =3D g_strdup_printf("/sys/bus/pci/devices/%04x:%02x:%02x.%d= /%s", + 0, 0, 0, 0, "config"); + + config_fd =3D open(path, O_RDWR); + if (config_fd < 0) { + error_setg_errno(errp, errno, "Failed to open: %s", path); + goto out; + } + + if (lseek(config_fd, pos, SEEK_SET) !=3D pos) { + error_setg_errno(errp, errno, "Failed to seek: %s", path); + goto out_close_fd; + } + + do { + rc =3D read(config_fd, (uint8_t *)val, len); + } while (rc < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); + if (rc !=3D len) { + error_setg_errno(errp, errno, "Failed to read: %s", path); + } + + out_close_fd: + close(config_fd); + out: + g_free(path); +} + +static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) +{ + uint32_t val =3D 0; + size_t i; + int pos, len; + Error *local_err =3D NULL; + + for (i =3D 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) { + pos =3D igd_host_bridge_infos[i].offset; + len =3D igd_host_bridge_infos[i].len; + host_pci_config_read(pos, len, &val, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + pci_default_write_config(pci_dev, pos, val, len); + } +} + +static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *da= ta) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + + k->realize =3D igd_pt_i440fx_realize; + dc->desc =3D "IGD Passthrough Host bridge"; +} + +static const TypeInfo igd_passthrough_i440fx_info =3D { + .name =3D TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE, + .parent =3D TYPE_I440FX_PCI_DEVICE, + .instance_size =3D sizeof(PCII440FXState), + .class_init =3D igd_passthrough_i440fx_class_init, +}; + +static void igd_pt_i440fx_register_types(void) +{ + type_register_static(&igd_passthrough_i440fx_info); +} + +type_init(igd_pt_i440fx_register_types) diff --git a/MAINTAINERS b/MAINTAINERS index 5e5e3e52d6..2822e68bfe 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1242,6 +1242,7 @@ S: Supported F: include/hw/i386/ F: hw/i386/ F: hw/pci-host/i440fx.c +F: hw/pci-host/igd_pt.c F: hw/pci-host/q35.c F: hw/pci-host/pam.c F: include/hw/pci-host/i440fx.h diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs index efd752b766..5affd21899 100644 --- a/hw/pci-host/Makefile.objs +++ b/hw/pci-host/Makefile.objs @@ -14,6 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) +=3D versatile.o common-obj-$(CONFIG_PCI_SABRE) +=3D sabre.o common-obj-$(CONFIG_FULONG) +=3D bonito.o common-obj-$(CONFIG_PCI_I440FX) +=3D i440fx.o +common-obj-$(CONFIG_PCI_I440FX) +=3D igd_pt.o common-obj-$(CONFIG_PCI_EXPRESS_Q35) +=3D q35.o common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) +=3D gpex.o common-obj-$(CONFIG_PCI_EXPRESS_XILINX) +=3D xilinx-pcie.o --=20 2.21.0 From nobody Sun May 5 14:38:59 2024 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1575654954; cv=none; d=zohomail.com; s=zohoarc; b=Y3uXt4Y2pb7raC4oumdpc4Okg/i+yHvmRkjHXzmjYk7mDCx7fAx9BhoNuQ/B1DS/PBJ2L/7h+135E4VjrfotOj0F28BMBkVzniGXHM6fSx0ghjaglM1XWWUW5VB/UT4rv6JByOD+qgXplj5tEgh+zoBTMDVXc5wbrJ36ZnHtENI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575654954; 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=SEbTH43GGJvjGQgNO86PJFzX5Xp5SPv3KxJ0OAEuU0A=; b=lt98sLSGXCZE2+03fCjEn9aXsXb8dXzqKtJRpaghfn+W/rdjbicPD82kuqZE9Ohq6Wya32X0iWAyFFAggEVnZiiAQR28dcdVy1P3WGlJXWMA+mp2KUny98e/YJwdM7y6w9Tlxpu6Dik3g0CkZefIiUOuxGBKefbn+Ve1ApERfgc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1575654954197800.1162935094798; Fri, 6 Dec 2019 09:55:54 -0800 (PST) Received: from localhost ([::1]:42670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHpX-0008TL-7c for importer@patchew.org; Fri, 06 Dec 2019 12:55:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33445) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idHMg-0008I4-Up for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:26:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idHMf-0007Fn-2b for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:26:02 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:56376 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1idHMc-0007BR-Fx for qemu-devel@nongnu.org; Fri, 06 Dec 2019 12:25:58 -0500 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-87-UupczAd4NzCgQKHLE0Q-Hg-1; Fri, 06 Dec 2019 12:25:55 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB7451883523; Fri, 6 Dec 2019 17:25:54 +0000 (UTC) Received: from x1w.redhat.com (ovpn-204-212.brq.redhat.com [10.40.204.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 796515C1C3; Fri, 6 Dec 2019 17:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575653157; 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=SEbTH43GGJvjGQgNO86PJFzX5Xp5SPv3KxJ0OAEuU0A=; b=CFPrXs6zJMm9HobqxrvaGxIy4g71cY/ARoN4q6fkEe4YOamPVpvMfmLoCi9BjtFPeOakz3 1qz81/2eAuUy6jmyqemNTIYXiJ4VHUO2vxfvd+y9WlKoVHjzXaKofcLKlgmFs3NtcXrL+X tHF89rxTnnvTgDGmCXDUuBukm0LmNjo= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.0 v2 6/6] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Date: Fri, 6 Dec 2019 18:25:14 +0100 Message-Id: <20191206172514.21268-7-philmd@redhat.com> In-Reply-To: <20191206172514.21268-1-philmd@redhat.com> References: <20191206172514.21268-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: UupczAd4NzCgQKHLE0Q-Hg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: Thomas Huth , "Michael S. Tsirkin" , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add the INTEL_IGD_PASSTHROUGH Kconfig option. Since it is implied by the PCI_I440FX option, this does not change the default selection. However users are now able to deselelect it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/Kconfig | 4 ++++ hw/pci-host/Makefile.objs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig index b0aa8351c4..8c88a7b9dd 100644 --- a/hw/pci-host/Kconfig +++ b/hw/pci-host/Kconfig @@ -1,6 +1,9 @@ config PAM bool =20 +config INTEL_IGD_PASSTHROUGH + bool + config PREP_PCI bool select PCI @@ -32,6 +35,7 @@ config PCI_I440FX bool select PCI select PAM + imply INTEL_IGD_PASSTHROUGH =20 config PCI_EXPRESS_Q35 bool diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs index 5affd21899..9dbd0f9042 100644 --- a/hw/pci-host/Makefile.objs +++ b/hw/pci-host/Makefile.objs @@ -14,7 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) +=3D versatile.o common-obj-$(CONFIG_PCI_SABRE) +=3D sabre.o common-obj-$(CONFIG_FULONG) +=3D bonito.o common-obj-$(CONFIG_PCI_I440FX) +=3D i440fx.o -common-obj-$(CONFIG_PCI_I440FX) +=3D igd_pt.o +common-obj-$(CONFIG_INTEL_IGD_PASSTHROUGH) +=3D igd_pt.o common-obj-$(CONFIG_PCI_EXPRESS_Q35) +=3D q35.o common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) +=3D gpex.o common-obj-$(CONFIG_PCI_EXPRESS_XILINX) +=3D xilinx-pcie.o --=20 2.21.0