From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.158 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796335033; b=AStGh2zejC05TfVJHTwL7rM0L+sHZoVZMxEh1q9mNspafhoIMTCih7FGRE6le/axjE2E lGxJ8B6pUnevsReuf8eMNOLFIXll/EUVHywPxPz5U7r8nZf7i7lnY4TcGArEmvNA8xhA4 2jNSIyybMfoY1MlZSvnt/qKh7n7bSeQn1yIuMmfi9vMwxYyCrq0oBBGM8npi9cH4ARPq2 ilw/X2+MkmxE7nyc3NzM9Ps/dSpsNIIw9U9xifBPWH2lwSMtegDMWQyTw3oZIULrHNDIp CEV6uQhGbG7/yJmR6IPoUw4soEmpZNy2uId9ZAVEYYeHyt863deUV01QOerXztJHLRw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796335033; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: X-Mailer:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=aiQYfm14I46dqgaVpmmH2dhnS0D6weVrKJgulH1q44Y=; b=hgwSlzP3S2scHsNG4ucJIRQJ/vyLty48yotLOqFINVBopXsEg7NkJLTyJ7mdWa9Zopy0 UGpXnQlTUGv0dSqYLZ0i1hpd42hjuSE7S6YgyIySqKyGiGtUkYFdcwK6p8a/oPL5Lz6z8 ugmhiWlr0oKFkHZ9fLZgedcCMyX8/7KNFoIkAAU1oRnYz52trDWxE8x9yV+AYkAL3AL1H aM1MtOu6YoIMZYkoBb7MtPvXN+/+rDAbc95AMAAbhYrFoqvzBMtNciAk/X+4LJLd8Hk/K aE23sPkil1RGLr+sb6R5w5kS/gyWDwFUwNKugO8tTIvjpWlK29+46xv+vKFtkvJij/g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=shazbot.org; spf=pass smtp.mailfrom=shazbot.org; dkim=pass header.d=shazbot.org header.i=@shazbot.org header.a=rsa-sha256 header.s=fm3 header.b=jQWcET0K; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=g1zDKgZE; arc=none smtp.remote-ip=202.12.124.158 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5018606A332 for ; Thu, 3 Dec 2026 21:57:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C5018606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shazbot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shazbot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=shazbot.org header.i=@shazbot.org header.a=rsa-sha256 header.s=fm3 header.b=jQWcET0K; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=g1zDKgZE Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 338447A00F3 for ; Thu, 3 Dec 2026 16:57:12 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Thu, 03 Dec 2026 16:57:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shazbot.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1796335031; x=1796421431; bh=aiQYfm14I46dqgaVpmmH2dhnS0D6weVrKJgulH1q44Y=; b= jQWcET0K4hs8Ij7O+no7LIpHnZcA77HDRL0OcyeDwU83v96K4zBCn7IJkAwe1uok Q5bXtXRfLMahlZmH/2DIhWXRyBRtxQx9QlipvhX237z9hGz9vZiFPtIwG6BquUY9 HU96ezVU9q6Jtqs/WYYl3Rgxi0O/ylil4wbymhRzjrRwIXETwEH7UwQHANuUj6Qt jY3eMKdmBZcRaOHueBckA0K3NWWDpLWl6vKxnrm/Nvjj+7n8LX2qhx0cdIVJ5aK/ OZMkaLZ0ezlUzBf55D/YdSJFT6q08JblI0yFL2rr9EFO88PtUtmB8+94GcWqGubo bgtzEIb14usUUg2SOUn09Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1796335031; x= 1796421431; bh=aiQYfm14I46dqgaVpmmH2dhnS0D6weVrKJgulH1q44Y=; b=g 1zDKgZELpUipSKFxpvTaznRwwaUaYdFLDP9ifON5YVDqgp7SOwEPfE+VxD7PPPCy JkZvdqi0pkOpj8Q8GwA9Nec3kNxWqir7A2ra7amyIi2+/OBw7/kl3DKf5gV0/wlv TstKI0OvSBS5yje19eeE4awPT8lrFCGGnrvdaNzk3j0OCVvdWf/z2ODRAuIPuY0J gl/rrrZHT05eX9rt0IIwnv0/0db4E5ym8us9NfbVn6CpDir3TaVPs12wCG9sMpTq jSG0UIziyrbCclV/1F3FvzAkPlsdw5Mha3xYg/1eHZbI0nzay4s+ceuYKzh5S11U n0s0f0+MSXqs1RUDO8psw== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=shazbot.org a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796335031; d=shazbot.org; mf=PGFsZXhAc2hhemJvdC5vcmc+; rt=PGt2bUB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:X58GnOV3+rCjWefWWY3SEzE5buyE8laJUqIFhl8iywC9PKy aVveMPL2asdF1HOnglKYQLL7gEhfwgIa27z7sOug4Gp9n6pC3eCa7icTlgIlmLu2 eZbQyVK4ngXFVKvlpNGwFOSTJhrwEGP2tXsRSMfohL9KsNT5cb178sdXtkxdNpmK EGoWlxrPlHLtYlOKwPQppMk/YWwkm4e2qoNawnHZHs0JVb830JBaTnc0Uxq5tMP1 sZdzqCLrM7TjJnnO6qHA1QWaVaHpPUawfOZXf3oykoSDuU67BbEtQssX+3qv2pa6 JxDbg6oQlCt1Pot64lniDnjiV8ZvwzW8WvZ8ekQ==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-transfer-encoding,content-type,date,feedback-id, from,in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:QyriLNp0ECzCg6+xrBxueShtKuOgQIN2k+v6NoSWRDA=:I1/N4aRekrwARaBVKEAE58jMqPghMxKUI5K4Nl5zLwc=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFhfCeVJn6MVaTfF2Zg9/0gIecEzmiveyo8/ocRLg5S95y9tN49UmpfUmC7EbRvwS U/xjjLr1M9mBDs6aJ1Pvr2ezoykS9KZYmoC9torp70Joosmwpj54ZxyYlyXwixdHuUFGeI 0yUGYEEM9m/Yw3gJ6WsDR3NmCJF149ha/xgdUWsmT7xcJaFSvJO0K8Qal0Q2fZC+1ztTnS fFx/70KsqCU0fgshvIg/nyIJ9F5RWkXWqXL1REwKoMHcIR8h45psDhxy3mM/zftcG0Yf5u XVFsjzlKsxGa/e4RyXWGUd9VQSzS9jWkKKtewc/LRL85uoSbIqXwVyYqiwqkv9Dzfh4CeN 75Gmo0gp8isZWJnDwWOHqAn7EGNRrFkVSyYPC+7ml/x8azXKtdcETEeWWikyc3HZunKa0n 3rxQi54Jgn13NCWaFIsLHo0B2E1iqpwkRwqseBaOB3XCdzd6geInswWhnsV3Uz9fFAEQnY WjIFbaLPwfsgGbEW45Uj/3cVv2sbbx+yFi375XAWG1yAcbmdeCP0BFsj0tvbmaHqKIjI5l TyuZ6VV18Kfn5rhIgjNzdQdO//NE6wDb6YK9V6d7KlbDCAtwVwbr4ObR3k4DFncDRbec/H 4QHhM1STmaTTvqqv8Tq7MnVK9YJF+uqBavdLa78fcXsXXvXyHeePym5DftbA X-ME-Proxy: Feedback-ID: i03f14258:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Dec 2026 16:57:10 -0500 (EST) Date: Thu, 3 Dec 2026 14:57:09 -0700 From: Alex Williamson To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, alex@shazbot.org Subject: Re: [PATCH v3] vfio/pci: expose ACPI _ROM through a device region Message-ID: <20261203145709.29c06f89@shazbot.org> In-Reply-To: <147be6bed8795824d27429a8c717e2d1d08ad89f.1796307888.git.mst@redhat.com> References: <147be6bed8795824d27429a8c717e2d1d08ad89f.1796307888.git.mst@redhat.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 3 Dec 2026 09:35:01 -0500 "Michael S. Tsirkin" wrote: > +void vfio_pci_register_acpi_rom(struct vfio_pci_core_device *vdev) > +{ > + acpi_handle handle = ACPI_HANDLE(&vdev->pdev->dev); > + union acpi_object args[] = { > + { .integer = { .type = ACPI_TYPE_INTEGER } }, > + { .integer = { .type = ACPI_TYPE_INTEGER, .value = SZ_4K } }, > + }; > + struct acpi_object_list params = { ARRAY_SIZE(args), args }; > + size_t size = 0, capacity = 0; > + void *rom = NULL; > + acpi_handle method; > + int ret = -EIO; > + > + if (!handle || ACPI_FAILURE(acpi_get_handle(handle, "_ROM", &method))) > + return; > + > + /* > + * Some firmware requires 4 KiB-aligned requests. Snapshot the image > + * at open so reads never invoke AML and the size and contents agree. > + */ Can you cite some firmware that has this requirement? I don't want to come back to this in the future without an example of firmware that imposes this requirement. That alone also doesn't feel like it justifies allocating up to 16MB of kernel memory and holding it for the whole user session. We can perform reads with 4K alignment and return short reads to get the user onto the alignment we require. Sashiko notes a couple issues, particularly in this method of sizing the ROM. Why shouldn't we walk the ROM image chain read through _ROM to determine the size, save only that size in the init phase, then do aligned reads (if necessary), on demand as the user accesses? Aside from the alignment, and the device specific region proposed here, I basically proposed those mechanics in https://lore.kernel.org/all/20261015112719.20d08b4c@shazbot.org/ Architecturally I'm fine with the device specific region approach. > diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h > index e41437fa17ad0..0d77f860020e9 100644 > --- a/include/uapi/linux/vfio.h > +++ b/include/uapi/linux/vfio.h > @@ -345,6 +345,15 @@ struct vfio_region_info_cap_type { > #define VFIO_REGION_TYPE_GFX (1) > #define VFIO_REGION_TYPE_CCW (2) > #define VFIO_REGION_TYPE_MIGRATION_DEPRECATED (3) > +#define VFIO_REGION_TYPE_ACPI (4) > + > +/* sub-types for VFIO_REGION_TYPE_ACPI */ > +/* > + * The device firmware's ACPI _ROM image, when available. The region size is > + * the exact image length in bytes. This region supports read() and pread() > + * only. It is independent of the PCI expansion ROM region. > + */ > +#define VFIO_REGION_SUBTYPE_ACPI_ROM (1) > > /* sub-types for VFIO_REGION_TYPE_PCI_* */ > Note that the sub-type definitions are in the same order as the types are defined. This jumps the line. Thanks, Alex