From nobody Tue Nov 26 12:30:52 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=1707887704; cv=none; d=zohomail.com; s=zohoarc; b=Fi+2aQv6ChtivWW2oUhNL52xTxaXN30HbZt15IXQvAZe2p9HIwyrs7LMjgBD+uWjtJpq6Bya/Vqfu0D7a4hRaTdWK6mFjFPAFpmZ8duuxYJm6txp3B8xGTI7SezuLj/3XW05OkcygAZS+lkzwa3HODPwrDYnh2+LCQusqQsCDB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707887704; 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=AMJKf0v/M+FFicTJu/HiSNXQGXhiRqdJXUW8dIKkkgw=; b=SWCIlZyh694rczSn89AuOFD+EMIXKEHbIk124P3WM8qwP4vP8oGbNp4D0AtL0fKWyts463ngM9M+aKd32gyAMY2Q0GKk8I7h99/oIOgsGVeHO9YZnVoufhKee+7my+9YBD4jYVk0sI07SbofMxFHqnsZTOHGfoVfku3I6PuUnkg= 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 1707887704910466.77137570442835; Tue, 13 Feb 2024 21:15:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ra7ao-0005ot-7k; Wed, 14 Feb 2024 00:13:58 -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 1ra7am-0005oc-WD for qemu-devel@nongnu.org; Wed, 14 Feb 2024 00:13:57 -0500 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ra7al-0007pZ-IO for qemu-devel@nongnu.org; Wed, 14 Feb 2024 00:13:56 -0500 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6e09493eb8eso353186b3a.1 for ; Tue, 13 Feb 2024 21:13:55 -0800 (PST) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id b18-20020aa78ed2000000b006e0a4022fa2sm7452600pfr.189.2024.02.13.21.13.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Feb 2024 21:13:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1707887634; x=1708492434; 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=AMJKf0v/M+FFicTJu/HiSNXQGXhiRqdJXUW8dIKkkgw=; b=ZdctagRL7KFhnweQSnfiDEr91LJucWbw1BetMw7UHAghBNSqIEfYbOxghtCWryqop/ fvXQB3ZAI7yHdSk8FDd5KY8mCuG3h4NSM/g0qlb9BJFOCU0/SqskAMlRk1IujZt6shli caykxWGT6OxYDSsjCikAvl4JPXikI07MkkQpKGLzQa+bM0pA2WUe9Zl0l706ua1ZQlbh Y4ehN6cfWjX7OtFHzW8Z0kRQMv3YHtkIIKPdLrq3a9p3c8tGLXVBN0X7qj/APc7Yar3K 4BZMvQXXIOTvZDuUItXLIzRj7Dy/AepoxtJGQfPHmwdSQmx95RS2i+Xp0318Q/ZwcRzD gsqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707887634; x=1708492434; 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=AMJKf0v/M+FFicTJu/HiSNXQGXhiRqdJXUW8dIKkkgw=; b=IWOsf5y0byTUVRCZZxlBynEtOdGzauHzGRB/NZJobZRtPi2EpIMsFXcaozuzteLHzZ GH2K2IZGUUX6sozX6c+GVlgkFh6ScK/GonbfXmsR/GIeXRxLGwTIH9YKLxFLTmbnpvvK RPg8nkOCqnSgLFh/DykdyjaP1p5hcLzDetyhrK9o98P9XwgAkRTLvFX/15cVSYKWRAWk 62Cwq2vaPWkicdEDPSFFCUT4zFpdPx2Y3PC63GFBQGtK4SvXLGm5hSMQhsrnmTkAbnyI 6+KDiMD5fY8zbc+3cD72YFjmABp/GimOoj1szSi47wUUYlcpP6cU2tj/Oiw7t/vyJVj2 ux/Q== X-Gm-Message-State: AOJu0YzRya2nGpCUc6tuq/1y2Rjl/sRssnQlsHXsy7rIs2G84xu69VkO WFaPvLWXDBm5tHXaCB8/4xPHz5HWc23pFBSx8MhcQ2B+4mIfUTPqTqgK8qh/ZJY= X-Google-Smtp-Source: AGHT+IEkABjnERuYiGH+MKfqwmoIwC+4yd/WPG+EO8ooQA6EpkLNyMbKvwllFSlvbcVYBBN9/X72kQ== X-Received: by 2002:a05:6a20:43a2:b0:19e:4ab2:c362 with SMTP id i34-20020a056a2043a200b0019e4ab2c362mr1423478pzl.14.1707887634206; Tue, 13 Feb 2024 21:13:54 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUrsfXnd8sOujh39hlWsakF+8H3UF+75cXdFu6d7D4+fXN5+FOL933E811oM5roRicpwsjyqLA2aNuwHlMhWJJI8Kxtv0CtC4PEYmg3CeNILXfdkER/ifPHaMk5E8Z8xKS31nUG1eXkKiPrWSAFataBKJ2s2XoqCqhDQiE28xab7Fyjtc1ayF+/7rbnyUiskG0dzWX/tWGL47UR1nA6LqoRd2qzdn8x9gNJtwCj8istPanjUpGiONs/7hIc6h2dXRyWHuNvfgshNy2vQRYjh/FCt32r4PEBE8jFr4uN96G9G5K3prqwfpAtdDaHto6Bp88zXO03vgK/HbgmbLpr2bm8wRZR/TiUQRUWYkEn3WR54VrKWksiwMWLLZKTiOlhJTw3AWqvWFAaUDaB9/qRisYPzRmkJ8bKCKhbixkf/WKZbY8jSUjzZdlB1pphm+Q= From: Akihiko Odaki Date: Wed, 14 Feb 2024 14:13:40 +0900 Subject: [PATCH v4 2/9] hw/pci: Determine if rombar is explicitly enabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240214-reuse-v4-2-89ad093a07f4@daynix.com> References: <20240214-reuse-v4-0-89ad093a07f4@daynix.com> In-Reply-To: <20240214-reuse-v4-0-89ad093a07f4@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::42f; envelope-from=akihiko.odaki@daynix.com; helo=mail-pf1-x42f.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: 1707887705981100003 vfio determines if rombar is explicitly enabled by inspecting QDict. Inspecting QDict is not nice because QDict is untyped and depends on the details on the external interface. Add an infrastructure to determine if rombar is explicitly enabled to hw/pci. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci_device.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index d3dd0f64b273..54fa0676abf1 100644 --- a/include/hw/pci/pci_device.h +++ b/include/hw/pci/pci_device.h @@ -205,6 +205,11 @@ static inline uint16_t pci_get_bdf(PCIDevice *dev) return PCI_BUILD_BDF(pci_bus_num(pci_get_bus(dev)), dev->devfn); } =20 +static inline bool pci_rom_bar_explicitly_enabled(PCIDevice *dev) +{ + return dev->rom_bar && dev->rom_bar !=3D -1; +} + uint16_t pci_requester_id(PCIDevice *dev); =20 /* DMA access functions */ --=20 2.43.0