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=eJbgge9EOLx7wsw+3O3qcQTGwtK6/Mrh1Hkzq8I05ANfBn2/JbXshsiZUZIZZDhKyPNe 82NGDoPqpxjjozu+C4/lOocadA+UTeUgN0BGbfpvGrXMwvbZuc/SxV183JNR7v0JvvxcS 4/9ntBfpCa/U6SLgg/bsPGF0EjbNrNutpsemI3lrDpg1QZosx3OidZ8qxvABgdXkbb9Zx 8HDiSJm5w0HszF2oagT4NBtF5iiGeSneS9w9zmxWbX5ny4YvMw19vjbTZ31nXGieCbdqT ni1cg8MbQ3w9BtH0tGpKWcktZhJxazw5cy/vlbsEC7pBx3N6WokJmK5hexosyAXLyQw== 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=kMYSaQc8dxVDA2VzrtgQb+dCsUTmGg023UibilC2zwpUsHMHWIpuF6Tr/3y7AD14rgqW 2f+CWjtFZXzcOavzdfwl0sShBFrch22ejG4vGOCng4642j+wsl/1w1qLNfBG3ffo4hB85 7lF60wvtb/Y9Z3ZGN8zaXlmPC9iyYKYNz5+wiy6e78q2FaTG7wPhgnpHdkOs7s9xbmBd4 7CAGkJ3t7yatE0ujCLIRZUlPXiRXRS9l6XnN486H0N3vmBMqlr5tCftyXQdsLV/Yr4jLe yigQ7Gbpbrdu6+l3OKcSLDh/7NixF3puDzWKkVYpcuAXRbpnNplfPAhkC1J1OkHXc5Q== 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 C5050606A333 for ; Thu, 3 Dec 2026 21:57:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C5050606A333 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 0DD7D7A00F2 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=PGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:V6Oi4UwLUAAe/V/0NpuR+jmd3zMlN5665yMg932U3/nrKIK L5ScD1i8ICKElrXuTpZLIJvz5p52k2BcXp2CbH/VpMcd5yNztWNYOoidCdMscZHq tuqV2OdCanTSfVAz541VPCp+WJBWvVtg0oStbp8Ugd7eFAU+/tqMFWXCvaJ1ZVDv P3XoEifAv0ijEH7uZNwZYi/hdXoqgNMUGY5K7s8FJj0KuLlRqfdXDnllb9vxbmnX mEV1NL3j2FaQ8LxDXQXXJe7zKLjYED8DBLml8Uc+6dwaCWPzmY6QBUNN3XabUXQt Yv4XoKo5lfNkrE4CJ4stYkJbPzczCY+P+ITkujg==; 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: linux-kernel@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