From nobody Thu Nov 14 18:00:18 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 ARC-Seal: i=1; a=rsa-sha256; t=1708432002; cv=none; d=zohomail.com; s=zohoarc; b=JHITFbW0fVt0CUTQZsega0vHj1sR/84YlQAjICNJZ+M7sLVey+dl7NZzivaB9iiXa86wJ+4q2bCsCIij10mc34b/kiA3wrZTTcPAzB+fbgZGj4Vv4HRBWiu9mf7UH68FvW0bS59d1GMvaAbtdMQjJQ1YXmYXex2qLZmEajbcgA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708432002; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2CSd9i6jUkmyRdPPv1psHKlWQIuoE+JKADHe2JQGZio=; b=jqCa53Qpq7iKaMngzmFQHpnGqqhZcC/J5iBnTQLFV+0aoDgfOy1J4VIYMq+SvJFbnMPFAIVmQ7rh8eKj7duvwBVURT3qk1KZjltBRWT4uPKJJ8h55FEP0UqvlQkvFPFCIKxhGpPgFuGxXJ3kocKZ/sPBkb0BFuMMyzEOzNLUG3c= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708432002866538.9961704055177; Tue, 20 Feb 2024 04:26:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcPC5-0005bl-MN; Tue, 20 Feb 2024 07:25:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcPBx-0005Ae-Tu for qemu-devel@nongnu.org; Tue, 20 Feb 2024 07:25:45 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcPBu-0006F1-PC for qemu-devel@nongnu.org; Tue, 20 Feb 2024 07:25:45 -0500 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1dc13fb0133so6435685ad.3 for ; Tue, 20 Feb 2024 04:25:42 -0800 (PST) Received: from localhost ([157.82.203.206]) by smtp.gmail.com with UTF8SMTPSA id o16-20020a17090323d000b001db7e461d8asm6185261plh.130.2024.02.20.04.25.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Feb 2024 04:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1708431941; x=1709036741; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2CSd9i6jUkmyRdPPv1psHKlWQIuoE+JKADHe2JQGZio=; b=TeKG8FB5QHPAvbE4enKqIlJnuyNcHzesIehSYBpnBSXv7eFYmazhxbSNMdyIWX+uWj rC4iJzh0GtTccSB64rptQSwoDPCg+x1tWnkwVr91a7NblAE1HmYBEZXyS2PX782XUskf G9+ftqWFa6/nDYZI9h0/oLPEid3g4zopyp1OornP62PLg7g0A3iHayFizgoDfJrS2ETc eVpo27b80t4Bi3Xgm3Xi634KP7BKHKCIoi27WWDAHvakZudrs4xthXIttZ1y+2x08gLj oWZjvVNSStBaqOV/wRFLt8VNbkP3XO0E6y5RKCISRnUpVtYXTY8nf5h7T/k1BZd6PtlF z6vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708431941; x=1709036741; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2CSd9i6jUkmyRdPPv1psHKlWQIuoE+JKADHe2JQGZio=; b=ewpttiUmsp8lQ9ZJbqsoBgyzyE9ABv/W9VgfJrfQm+wsKBR72yfIhe9ciCkY404WVY wvO2l7d33tgnobcRdN2mnc/BUCvdOSnfQzc2VelS8KDJKuQbs36uKnueu5KT1eMeT9d3 vYqE2Nm9psj887sCaZS2SrN2x1Yzjt52tQ6A9wbrC0Ea2dWl/PhhGhHz2wxuahkFgELw /iK8UcE1xCW3+r5UEyMYKj7GSh9nEQi1CrTbLHaAZyEu/ktz5InuRIjr9S+FcXjuKxwW Hyxtxqzxrq6XxqEEV729RFqcn/POgTifs8Baw/sc6P51QE88YCZhZRe2kn0fchWpN7bG G3dQ== X-Gm-Message-State: AOJu0YyVORpcyuIkcvUxgxE/Nbg5O1wg5OFNgp+xOSVIKHcMMsiD4iev las5XLSSo8SFZNCVsWp5/m1d0uSvDmjN829yFjlXn1hDruF7chiaiB2O6vd/vto= X-Google-Smtp-Source: AGHT+IF3Zx+4V77tBK/Ad6xoliCjosSFH3K+Rze4e8kymnyK4KWltrL/5BMcZs1ZJQNqObq45NhtYQ== X-Received: by 2002:a17:902:b112:b0:1db:d184:c458 with SMTP id q18-20020a170902b11200b001dbd184c458mr6049225plr.44.1708431941341; Tue, 20 Feb 2024 04:25:41 -0800 (PST) From: Akihiko Odaki Date: Tue, 20 Feb 2024 21:24:47 +0900 Subject: [PATCH v6 12/15] hw/pci: Use -1 as a default value for rombar MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240220-reuse-v6-12-2e42a28b0cf2@daynix.com> References: <20240220-reuse-v6-0-2e42a28b0cf2@daynix.com> In-Reply-To: <20240220-reuse-v6-0-2e42a28b0cf2@daynix.com> To: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Sriram Yagnaraman , Jason Wang , Keith Busch , Klaus Jensen Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Akihiko Odaki X-Mailer: b4 0.12.3 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: none client-ip=2607:f8b0:4864:20::62d; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1708432003778100001 Currently there is no way to distinguish the case that rombar is explicitly specified as 1 and the case that rombar is not specified. Set rombar -1 by default to distinguish these cases just as it is done for addr and romsize. It was confirmed that changing the default value to -1 will not change the behavior by looking at occurences of rom_bar. $ git grep -w rom_bar hw/display/qxl.c:328: QXLRom *rom =3D memory_region_get_ram_ptr(&d->rom_= bar); hw/display/qxl.c:431: qxl_set_dirty(&qxl->rom_bar, 0, qxl->rom_size); hw/display/qxl.c:1048: QXLRom *rom =3D memory_region_get_ram_ptr(&qxl->r= om_bar); hw/display/qxl.c:2131: memory_region_init_rom(&qxl->rom_bar, OBJECT(qxl)= , "qxl.vrom", hw/display/qxl.c:2154: PCI_BASE_ADDRESS_SPACE_MEMORY, &qxl->rom_bar); hw/display/qxl.h:101: MemoryRegion rom_bar; hw/pci/pci.c:74: DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1), hw/pci/pci.c:2329: if (!pdev->rom_bar) { hw/vfio/pci.c:1019: if (vdev->pdev.romfile || !vdev->pdev.rom_bar) { hw/xen/xen_pt_load_rom.c:29: if (dev->romfile || !dev->rom_bar) { include/hw/pci/pci_device.h:150: uint32_t rom_bar; rom_bar refers to a different variable in qxl. It is only tested if the value is 0 or not in the other places. Signed-off-by: Akihiko Odaki --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 54b375da2d26..909c5b3ee4ee 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -71,7 +71,7 @@ static Property pci_props[] =3D { DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), DEFINE_PROP_STRING("romfile", PCIDevice, romfile), DEFINE_PROP_UINT32("romsize", PCIDevice, romsize, -1), - DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1), + DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, -1), DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present, QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present, --=20 2.43.1