Re: [PATCH v2] vfio/pci: Introduce x-pci-class-code option

2025-05-28 Thread Alex Williamson
On Wed, 28 May 2025 23:55:48 +0800 Tomita Moeko wrote: > Introduce x-pci-class-code option to allow users to override PCI class > code of a device, similar to the existing x-pci-vendor-id option. Only > the lower 24 bits of this option are used, though a uint32 is used here > for determining whet

Re: [PATCH v2] vfio/igd: Fix incorrect error propagation in vfio_pci_igd_opregion_detect()

2025-05-27 Thread Alex Williamson
errp)) { > +if (!vfio_pci_igd_opregion_detect(vdev, &opregion)) { > return true; > } > info_report("OpRegion detected on Intel display %x.", vdev->device_id); > @@ -695,7 +693,7 @@ static bool vfio_pci_kvmgt_config_quirk(VFIOPCIDevice > *vdev, E

Re: [PATCH] vfio/pci: Introduce x-pci-class-code option

2025-05-27 Thread Alex Williamson
On Sat, 24 May 2025 23:31:02 +0800 Tomita Moeko wrote: > Introduce x-pci-class-code option to allow users to override PCI class > code of a device, similar to the existing x-pci-vendor-id option. Only > the lower 24 bits of this option are used, though a uint32 is used here > for determining whet

Re: [PATCH] vfio/igd: Fix incorrect error propagation in vfio_pci_igd_opregion_detect()

2025-05-21 Thread Alex Williamson
On Wed, 21 May 2025 23:40:36 +0800 Tomita Moeko wrote: > In vfio_pci_igd_opregion_detect(), errp will be set when device does > not have OpRegion or is hotplugged. This errp will be propergated to propagated > pci_qdev_realize(), which interprets it as failure, causing unexpected > termination

Re: [PATCH] vfio/igd: Support non-boot gpus

2025-05-19 Thread Alex Williamson
[Please Cc maintainers - added here] On Mon, 19 May 2025 18:08:39 +0300 Qwinci wrote: > Change the IGD detection logic to also accept gpus with > PCI_CLASS_DISPLAY_OTHER class which is used if the igpu is not > set as the primary boot gpu. > > Signed-off-by: Qwinci > --- > hw/vfio/igd.c | 16

Re: [PATCH] vfio/igd: Respect x-igd-opregion=off in IGD quirk handling

2025-05-18 Thread Alex Williamson
On Sun, 18 May 2025 22:09:33 + "edmund.raile" wrote: > Restore SR-IOV Intel iGPU VF passthrough capability: > Check x-igd-opregion=off parameter in vfio_pci_igd_config_quirk and > vfio_pci_kvmgt_config_quirk to ensure x-igd-opregion=off is > respected despite subsequent attempt of automatic >

Re: [PATCH 0/9] vfio/igd: Detect IGD by OpRegion and enable OpRegion automatically

2025-05-05 Thread Alex Williamson
hen x-igd-gms is set > vfio/igd: Remove generation limitation for IGD passthrough > > docs/igd-assign.txt | 11 ++- > hw/vfio/igd.c | 218 ++-- > hw/vfio/pci.c | 2 +- > 3 files changed, 137 insertions(+), 94 deletions(-) > Looks ok to me, my Kaby Lake GVT-g and GVT-d configs still work. Reviewed-by: Alex Williamson Tested-by: Alex Williamson

Re: [PATCH 03/11] vfio/igd: Detect IGD device by OpRegion

2025-04-24 Thread Alex Williamson
On Tue, 22 Apr 2025 00:31:03 +0800 Tomita Moeko wrote: > There is currently no straightforward way to distinguish if a Intel > graphics device is IGD or discrete GPU. However, only IGD devices expose > OpRegion. Use the presence of VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION > to identify IGD devices.

Re: [PATCH 01/11] vfio/igd: Restrict legacy mode to Gen6-9 devices

2025-04-24 Thread Alex Williamson
On Tue, 22 Apr 2025 00:31:01 +0800 Tomita Moeko wrote: > Intel only provides legacy VBIOS for IGD up to Gen9, and there is no > CSM support on later devices. Additionally, Seabios can only handle > 32-bit BDSM register used until Gen9. Since legacy mode requires VGA > capability, restrict it to G

Re: [PATCH 07/11] vfio/igd: Allow hotplugging with OpRegion enabled

2025-04-24 Thread Alex Williamson
On Tue, 22 Apr 2025 00:31:07 +0800 Tomita Moeko wrote: > OpRegion is exposed to guest as a read-only fw_cfg item, so hotplugging > with it wouldn't cause issues. Since OpRegion needs to be set up by > guest firmware, a guest reboot is typically required. For linux guests, > i915 driver is able to

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-16 Thread Alex Williamson
On Thu, 17 Apr 2025 01:41:22 +0800 Tomita Moeko wrote: > On 4/17/25 00:10, Alex Williamson wrote: > > On Wed, 16 Apr 2025 23:45:08 +0800 > > Tomita Moeko wrote: > > > >> On 4/16/25 03:04, Alex Williamson wrote: > >>> On Wed, 16 Apr 202

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-16 Thread Alex Williamson
On Wed, 16 Apr 2025 23:45:08 +0800 Tomita Moeko wrote: > On 4/16/25 03:04, Alex Williamson wrote: > > On Wed, 16 Apr 2025 01:36:15 +0800 > > Tomita Moeko wrote: > >> > >> The generation register also exists on discrete GPUs. In the new xe > >> driv

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-15 Thread Alex Williamson
On Wed, 16 Apr 2025 01:36:15 +0800 Tomita Moeko wrote: > > The generation register also exists on discrete GPUs. In the new xe > driver [1], the Battlemage discrete GPU shares the same logic reading > GMD_ID_DISPLAY register. The driver itself uses is_dgfx bit mapped to > device id. In QEMU, we n

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-14 Thread Alex Williamson
On Sun, 13 Apr 2025 19:30:10 +0800 Tomita Moeko wrote: > On 4/10/25 01:18, Alex Williamson wrote: > > On Wed, 26 Mar 2025 01:22:39 +0800 > > Tomita Moeko wrote: > > > >> So far, all Intel VGA adapters, including discrete GPUs like A770 and > >> B580,

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-14 Thread Alex Williamson
On Mon, 14 Apr 2025 01:23:56 +0800 Tomita Moeko wrote: > On 4/10/25 15:34, Cédric Le Goater wrote: > > + Corvin > > > > On 4/9/25 19:18, Alex Williamson wrote: > >> On Wed, 26 Mar 2025 01:22:39 +0800 > >> Tomita Moeko wrote: > >> > >

Re: [PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x

2025-04-11 Thread Alex Williamson
On Thu, 10 Apr 2025 09:07:51 -0700 Farhan Ali wrote: > On 4/3/2025 2:24 PM, Alex Williamson wrote: > > On Thu, 3 Apr 2025 13:33:17 -0700 > > Farhan Ali wrote: > > > >> On 4/3/2025 11:05 AM, Alex Williamson wrote: > >>> On Thu, 3 Apr 2

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-10 Thread Alex Williamson
On Wed, 26 Mar 2025 01:22:39 +0800 Tomita Moeko wrote: > So far, all Intel VGA adapters, including discrete GPUs like A770 and > B580, were treated as IGD devices. While this had no functional impact, > a error about "unsupported IGD device" will be printed when passthrough > Intel discrete GPUs.

Re: [PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x

2025-04-05 Thread Alex Williamson
On Thu, 3 Apr 2025 10:33:52 -0700 Farhan Ali wrote: > On 4/3/2025 9:27 AM, Alex Williamson wrote: > > On Thu, 3 Apr 2025 11:44:42 -0400 > > Stefan Hajnoczi wrote: > > > >> On Thu, Apr 03, 2025 at 09:47:26AM +0200, Niklas Schnelle wrote: > >>>

Re: [PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x

2025-04-03 Thread Alex Williamson
On Thu, 3 Apr 2025 13:33:17 -0700 Farhan Ali wrote: > On 4/3/2025 11:05 AM, Alex Williamson wrote: > > On Thu, 3 Apr 2025 10:33:52 -0700 > > Farhan Ali wrote: > > > >> On 4/3/2025 9:27 AM, Alex Williamson wrote: > >>> On Thu, 3 Apr 2025 1

Re: [PATCH v3 0/3] Enable QEMU NVMe userspace driver on s390x

2025-04-03 Thread Alex Williamson
On Thu, 3 Apr 2025 11:44:42 -0400 Stefan Hajnoczi wrote: > On Thu, Apr 03, 2025 at 09:47:26AM +0200, Niklas Schnelle wrote: > > On Wed, 2025-04-02 at 11:51 -0400, Stefan Hajnoczi wrote: > > > On Tue, Apr 01, 2025 at 10:22:43AM -0700, Farhan Ali wrote: > > > > Hi, > > > > > > > > Recently on

Re: [PATCH v2] vfio: pci: Check INTx availability before enabling them

2025-03-18 Thread Alex Williamson
On Tue, 18 Mar 2025 17:52:53 + Shivaprasad G Bhat wrote: > Currently, the PCI_INTERRUPT_PIN alone is checked before enabling > the INTx. It is also necessary to have the IRQ Lines assigned for > the INTx to work. > > The problem was observed on Power10 systems which primarily use > MSI-X, an

Re: [PATCH v2] vfio/igd: Update IGD passthrough documentation

2025-03-14 Thread Alex Williamson
com/ > > docs/igd-assign.txt | 265 > 1 file changed, 196 insertions(+), 69 deletions(-) Reviewed-by: Alex Williamson

Re: [PATCH] vfio/igd: Update IGD passthrough docoumentation

2025-03-12 Thread Alex Williamson
| Data Stolen | +-+ > +| | (Host)| > ++>+-----+<--Host BDSM > + Non-| | "real" one in HW > + Passthrough | | Programmed by host FW > + +-+ > > Footnotes > = > -[1] Nothing precludes adding additional emulated or assigned graphics devices > -as non-primary, other than the combination typically not working. I only > -intend to set user expectations, others are welcome to find working > -combinations or fix whatever issues prevent this from working in the > common > -case. > +[1] > https://www.intel.com/content/www/us/en/docs/graphics-for-linux/developer-reference/1-0/dump-video-bios.html > [2] # echo "vfio-pci" > /sys/bus/pci/devices/:00:02.0/driver_override > +[3] > https://web.archive.org/web/20240827012422/https://bugzilla.tianocore.org/show_bug.cgi?id=935 > +Tianocore bugzilla was down since Jan 2025 :( > +[4] https://eci.intel.com/docs/3.3/components/kvm-hypervisor.html, Patch > 0001-0004 > +[5] https://github.com/tomitamoeko/VfioIgdPkg > +[6] > https://winraid.level1techs.com/t/tool-guide-news-uefi-bios-updater-ubu/30357 This is great and a much needed update. Thanks! With above corrections: Reviewed-by: Alex Williamson

Re: [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk

2025-03-11 Thread Alex Williamson
} > We should probably predicate calls to vfio_bar_quirk_setup() on VFIOBAR.size to avoid such segfaults, but agree this likely fixes the reported issue as well. Reviewed-by: Alex Williamson

Re: [PATCH v3 00/10] vfio/igd: Decoupling quirks with legacy mode

2025-03-06 Thread Alex Williamson
tch to solve the possible KVMGT/GVT-g fail. > Link: > https://lore.kernel.org/all/20250303175220.74917-1-tomitamo...@gmail.com/ See comment on 07/ but otherwise works for me with GVT-d and GVT-g on my i7-7700: Reviewed-by: Alex Williamson Tested-by: Alex Williamson

Re: [PATCH v3 07/10] vfio/igd: Decouple common quirks from legacy mode

2025-03-06 Thread Alex Williamson
On Fri, 7 Mar 2025 02:01:27 +0800 Tomita Moeko wrote: > So far, IGD-specific quirks all require enabling legacy mode, which is > toggled by assigning IGD to 00:02.0. However, some quirks, like the BDSM > and GGC register quirks, should be applied to all supported IGD devices. > A new config opti

Re: [PATCH v2 7/9] vfio/igd: Decouple common quirks from legacy mode

2025-03-03 Thread Alex Williamson
On Tue, 4 Mar 2025 01:52:17 +0800 Tomita Moeko wrote: > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index a58d555934..b0620a0ae8 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -3363,6 +3363,8 @@ static const Property vfio_pci_dev_properties[] = { > VFIO_FEATURE_ENA

Re: [PATCH] MAINTAINERS: Add myself as vfio-igd maintainer

2025-02-28 Thread Alex Williamson
On Fri, 28 Feb 2025 00:27:41 +0800 Tomita Moeko wrote: > As suggested by Cédric, I'm glad to be a maintainer of vfio-igd. > > Signed-off-by: Tomita Moeko > --- > MAINTAINERS | 9 - > 1 file changed, 8 insertions(+), 1 deletion(-) We welcome your expert

Re: [PATCH 00/10] vfio/igd: Remove legacy mode

2025-02-27 Thread Alex Williamson
On Tue, 25 Feb 2025 02:29:17 +0800 Tomita Moeko wrote: > This patchset removes some legacy checks and converts the legacy mode > implicitly enabled by BDF 00:02.0 into x-igd-* options, including: > * Removing PCI ROM BAR and VGA IO/MMIO range check before applying quirk > * Using unified x-igd-op

Re: [PATCH 2/2] vfio: Make vfio-platform available on Aarch64 platforms only

2025-02-27 Thread Alex Williamson
On Thu, 27 Feb 2025 09:32:46 +0100 Eric Auger wrote: > Hi Cédric, > > On 2/26/25 9:47 AM, Cédric Le Goater wrote: > > VFIO Platforms was designed for Aarch64. Restrict availability to > > 64-bit host platforms. > > > > Cc: Eric Auger > > Signed-off-by: Cédric Le Goater > Reviewed-by: Eric Au

[PATCH v2 4/5] pcie, virtio: Remove redundant pm_cap

2025-02-25 Thread Alex Williamson
The pm_cap on the PCIExpressDevice object can be distilled down to the new instance on the PCIDevice object. Cc: Michael S. Tsirkin Cc: Marcel Apfelbaum Reviewed-by: Michael S. Tsirkin Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Signed-off-by: Alex Williamson --- hw/pci-bridge

[PATCH v2 3/5] vfio/pci: Delete local pm_cap

2025-02-25 Thread Alex Williamson
This is now redundant to PCIDevice.pm_cap. Cc: Cédric Le Goater Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Signed-off-by: Alex Williamson --- hw/vfio/pci.c | 9 - hw/vfio/pci.h | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio

[PATCH v2 2/5] pci: Use PCI PM capability initializer

2025-02-25 Thread Alex Williamson
Apfelbaum Cc: Cédric Le Goater Signed-off-by: Alex Williamson --- hw/net/e1000e.c | 3 +-- hw/net/eepro100.c | 4 +--- hw/net/igb.c| 3 +-- hw/nvme/ctrl.c | 3 +-- hw/pci-bridge/pcie_pci_bridge.c | 2 +- hw/vfio/pci.c

[PATCH v2 0/5] PCI: Implement basic PCI PM capability backing

2025-02-25 Thread Alex Williamson
machine state bump, or are there alternatives? Thanks, Alex [1]https://lore.kernel.org/all/20250219175941.135390-1-eric.au...@redhat.com/ Alex Williamson (5): hw/pci: Basic support for PCI power management pci: Use PCI PM capability initializer vfio/pci: Delete local pm_cap pcie, virtio:

[PATCH v2 1/5] hw/pci: Basic support for PCI power management

2025-02-25 Thread Alex Williamson
sk to enable guest writes to initiate a power state change. The contents and write access of the PM capability are still managed by the caller. Cc: Michael S. Tsirkin Cc: Marcel Apfelbaum Signed-off-by: Alex Williamson --- hw/pci/pci.c| 93 - h

[PATCH v2 5/5] hw/vfio/pci: Re-order pre-reset

2025-02-25 Thread Alex Williamson
doesn't enable the BARs. Cc: Cédric Le Goater Reviewed-by: Zhenzhong Duan Reviewed-by: Eric Auger Signed-off-by: Alex Williamson --- hw/vfio/pci.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index eab8974

Re: [PATCH 1/5] hw/pci: Basic support for PCI power management

2025-02-24 Thread Alex Williamson
On Mon, 24 Feb 2025 20:03:56 +0100 Eric Auger wrote: > Hi Alex, > > On 2/20/25 11:48 PM, Alex Williamson wrote: > > The memory and IO BARs for devices are only accessible in the D0 > > power state. In other power states the PCI spec defines that the > > device

Re: [PATCH 2/5] pci: Use PCI PM capability initializer

2025-02-24 Thread Alex Williamson
On Mon, 24 Feb 2025 19:37:03 +0100 Eric Auger wrote: > Hi Alex, > > On 2/20/25 11:48 PM, Alex Williamson wrote: > > Switch callers directly initializing the PCI PM capability with > > pci_add_capability() to use pci_pm_init(). > > > > Cc: Dmitry Fleytman >

Re: [PATCH 0/5] PCI: Implement basic PCI PM capability backing

2025-02-24 Thread Alex Williamson
On Mon, 24 Feb 2025 09:14:19 +0100 Cédric Le Goater wrote: > > An aspect that needs attention here is whether this change in the > > wmask and PMCSR bits becomes a problem for migration, and how we > > might solve it. For a guest migrating old->new, the device would > > always be in the D0 power

[PATCH 4/5] pcie, virtio: Remove redundant pm_cap

2025-02-20 Thread Alex Williamson
The pm_cap on the PCIExpressDevice object can be distilled down to the new instance on the PCIDevice object. Cc: Michael S. Tsirkin Cc: Marcel Apfelbaum Signed-off-by: Alex Williamson --- hw/pci-bridge/pcie_pci_bridge.c | 1 - hw/virtio/virtio-pci.c | 8 +++- include/hw/pci

[PATCH 3/5] vfio/pci: Delete local pm_cap

2025-02-20 Thread Alex Williamson
This is now redundant to PCIDevice.pm_cap. Cc: Cédric Le Goater Signed-off-by: Alex Williamson --- hw/vfio/pci.c | 9 - hw/vfio/pci.h | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 6903f831e45f..ba4ef65b16fa 100644 --- a/hw

[PATCH 1/5] hw/pci: Basic support for PCI power management

2025-02-20 Thread Alex Williamson
unmapped, removing them from the address space. Introduce an interface to register the PM capability such that the device power state is considered relative to the BAR mapping state. Cc: Michael S. Tsirkin Cc: Marcel Apfelbaum Signed-off-by: Alex Williamson --- hw/pci/pci.c| 83

[PATCH 0/5] PCI: Implement basic PCI PM capability backing

2025-02-20 Thread Alex Williamson
d a machine state bump, or are there alternatives? Thanks, Alex [1]https://lore.kernel.org/all/20250219175941.135390-1-eric.au...@redhat.com/ Alex Williamson (5): hw/pci: Basic support for PCI power management pci: Use PCI PM capability initializer vfio/pci: Delete local pm_cap pcie, vir

[PATCH 2/5] pci: Use PCI PM capability initializer

2025-02-20 Thread Alex Williamson
Apfelbaum Cc: Cédric Le Goater Signed-off-by: Alex Williamson --- hw/net/e1000e.c | 3 +-- hw/net/eepro100.c | 4 +--- hw/net/igb.c| 3 +-- hw/nvme/ctrl.c | 3 +-- hw/pci-bridge/pcie_pci_bridge.c | 2 +- hw/vfio/pci.c

[PATCH 5/5] hw/vfio/pci: Re-order pre-reset

2025-02-20 Thread Alex Williamson
doesn't enable the BARs. Cc: Cédric Le Goater Signed-off-by: Alex Williamson --- hw/vfio/pci.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index ba4ef65b16fa..fcc5f118bf90 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/

Re: [RFC 0/2] hw/vfio/pci: Prevent BARs from being dma mapped in d3hot state

2025-02-20 Thread Alex Williamson
On Thu, 20 Feb 2025 11:45:35 +0100 Eric Auger wrote: > Hi Alex, > > On 2/20/25 11:31 AM, Eric Auger wrote: > > > > Hi Alex, > > > > On 2/19/25 10:19 PM, Alex Williamson wrote: > >> On Wed, 19 Feb 2025 11:58:44 -0700 > >> Alex Williamso

Re: [RFC 0/2] hw/vfio/pci: Prevent BARs from being dma mapped in d3hot state

2025-02-20 Thread Alex Williamson
On Thu, 20 Feb 2025 08:07:23 -0700 Alex Williamson wrote: > On Thu, 20 Feb 2025 11:45:35 +0100 > Eric Auger wrote: > > > Hi Alex, > > > > On 2/20/25 11:31 AM, Eric Auger wrote: > > > > > > Hi Alex, > > > > > > On 2/19/25 10:

Re: [RFC 0/2] hw/vfio/pci: Prevent BARs from being dma mapped in d3hot state

2025-02-19 Thread Alex Williamson
On Thu, 20 Feb 2025 04:24:13 + "Duan, Zhenzhong" wrote: > >-Original Message----- > >From: Alex Williamson > >Subject: Re: [RFC 0/2] hw/vfio/pci: Prevent BARs from being dma mapped in > >d3hot state > > > >On Wed, 19 Feb 2025 18:58:58 +0100

Re: [RFC 0/2] hw/vfio/pci: Prevent BARs from being dma mapped in d3hot state

2025-02-19 Thread Alex Williamson
On Wed, 19 Feb 2025 11:58:44 -0700 Alex Williamson wrote: > On Wed, 19 Feb 2025 18:58:58 +0100 > Eric Auger wrote: > > > Since kernel commit: > > 2b2c651baf1c ("vfio/pci: Invalidate mmaps and block the access > > in D3hot power state") > > any att

Re: [RFC 0/2] hw/vfio/pci: Prevent BARs from being dma mapped in d3hot state

2025-02-19 Thread Alex Williamson
On Wed, 19 Feb 2025 18:58:58 +0100 Eric Auger wrote: > Since kernel commit: > 2b2c651baf1c ("vfio/pci: Invalidate mmaps and block the access > in D3hot power state") > any attempt to do an mmap access to a BAR when the device is in d3hot > state will generate a fault. > > On system_powerdown, if

Re: [PATCH v4] vfio: Add property documentation

2025-02-18 Thread Alex Williamson
e MSI interrupts (DEBUG)"); > +object_class_property_set_description(klass, /* 2.5 */ > + "x-no-kvm-msix", > + "Disable direct VFIO->KVM MSIx > injection. Allows to " > +

Re: [PATCH v3] vfio: Add property documentation

2025-02-14 Thread Alex Williamson
On Fri, 14 Feb 2025 15:34:15 +0100 Cédric Le Goater wrote: > Investigate the git history to uncover when and why the VFIO > properties were introduced and update the models. This is mostly > targeting vfio-pci device, since vfio-platform, vfio-ap and vfio-ccw > devices are simpler. > > Sort the

Re: [PATCH v2] vfio: Add property documentation

2025-02-13 Thread Alex Williamson
On Thu, 13 Feb 2025 14:50:50 +0100 Cédric Le Goater wrote: > Investigate the git history to uncover when and why the VFIO > properties were introduced and update the models. This is mostly > targeting vfio-pci device, since vfio-plateform, vfio-ap and vfio-ccw > devices are simpler. > > Organize

Re: [PATCH v3 0/7] vfio: Improve error reporting when MMIO region mapping fails

2025-02-10 Thread Alex Williamson
| 3 --- > hw/vfio/common.c | 40 +-- > hw/vfio/container.c | 2 -- > hw/vfio/helpers.c | 10 +++++ > hw/vfio/pci.c | 2 +- > util/error.c | 11 ++ > 8 files changed, 64 insertions(+), 17 deletions(-) > Reviewed-by: Alex Williamson

Re: [PATCH 3/4] vfio/igd: use PCI ID defines to detect IGD gen

2025-02-06 Thread Alex Williamson
On Thu, 6 Feb 2025 13:13:39 +0100 Corvin Köhne wrote: > From: Corvin Köhne > > We've recently imported the PCI ID list of knwon Intel GPU devices from > Linux. It allows us to properly match GPUs to their generation without > maintaining an own list of PCI IDs. > > Signed-off-by: Corvin Köhne

Re: [PATCH v2 8/9] vfio: Check compatibility of CPU and IOMMU address space width

2025-01-31 Thread Alex Williamson
On Fri, 31 Jan 2025 14:23:58 +0100 Gerd Hoffmann wrote: > On Fri, Jan 31, 2025 at 01:42:31PM +0100, Cédric Le Goater wrote: > > + Gerd for insights regarding vIOMMU support in edk2. > > > > > > +static bool vfio_device_check_address_space(VFIODevice *vbasedev, > > > > Error **errp) > > > > +{

Re: [PATCH] vfio/pci: Skip enabling INTx if the IRQ line is also unassgined

2025-01-31 Thread Alex Williamson
On Fri, 31 Jan 2025 17:15:01 + Shivaprasad G Bhat wrote: > Currently, the PCI_INTERRUPT_PIN alone is checked before enabling > the INTx. Its also necessary to have the IRQ Lines assigned for > the INTx to work. So, check the PCI_INTERRUPT_LINE against 0xff > indicates no connection. > > The

Re: [PATCH v2 5/5] vfio/igd: handle x-igd-opregion in vfio_probe_igd_config_quirk()

2025-01-30 Thread Alex Williamson
On Fri, 31 Jan 2025 02:33:03 +0800 Tomita Moeko wrote: > On 1/25/25 15:42, Tomita Moeko wrote: > > On 1/25/25 05:13, Alex Williamson wrote: > >> On Sat, 25 Jan 2025 03:12:45 +0800 > >> Tomita Moeko wrote: > >> > >>> Both enable opregion

Re: [PATCH v2 8/9] vfio: Check compatibility of CPU and IOMMU address space width

2025-01-30 Thread Alex Williamson
On Thu, 30 Jan 2025 14:43:45 +0100 Cédric Le Goater wrote: > Print a warning if IOMMU address space width is smaller than the > physical address width. In this case, PCI peer-to-peer transactions on > BARs are not supported and failures of device MMIO regions are to be > expected. > > This can o

Re: [PATCH v2 1/9] util/error: Introduce warn_report_once_err()

2025-01-30 Thread Alex Williamson
On Thu, 30 Jan 2025 14:43:38 +0100 Cédric Le Goater wrote: > Depending on the configuration, a passthrough device may produce > recurring DMA mapping errors at runtime and produce a lot of > output. It is useful to report only once. > > Cc: Markus Armbruster > Signed-off-by: Cédric Le Goater >

Re: [PATCH v2 5/5] vfio/igd: handle x-igd-opregion in vfio_probe_igd_config_quirk()

2025-01-24 Thread Alex Williamson
On Sat, 25 Jan 2025 03:12:45 +0800 Tomita Moeko wrote: > Both enable opregion option (x-igd-opregion) and legacy mode require > setting up OpRegion copy for IGD devices. Move x-igd-opregion handler > in vfio_realize() to vfio_probe_igd_config_quirk() to elimate duplicate > code. Finally we moved

Re: [PATCH 3/4] vfio/igd: refactor vfio_probe_igd_bar4_quirk() into pci config quirk

2025-01-24 Thread Alex Williamson
On Thu, 23 Jan 2025 01:17:30 +0800 Tomita Moeko wrote: > The actual IO BAR4 write quirk in vfio_probe_igd_bar4_quirk() was > removed in previous change, leaving the function not matching its name, > so move it into the newly introduced vfio_config_quirk_setup(). There > is no functional change in

Re: [PATCH] vfio: Support P2P access in confidential VM

2025-01-16 Thread Alex Williamson
On Thu, 16 Jan 2025 17:53:55 +0800 Wencheng Yang wrote: > On confidential VM platform, for example, AMD-SEV, P2P doesn't work. > The underlying reason is that IOMMU driver set encryption bit on > IOMMU page table pte entry, it's reasonalbe if the pte maps iova > to system memory. However, if the

Re: [PATCH v2 0/3] vfio/igd: VFIOConfigMirrorQuirk for igd mirrored registers

2025-01-16 Thread Alex Williamson
igd.c| 125 +++ > hw/vfio/pci-quirks.c | 57 +++- > hw/vfio/pci-quirks.h | 72 + > 3 files changed, 109 insertions(+), 145 deletions(-) > create mode 100644 hw/vfio/pci-quirks.h > Reviewed-by: Alex Williamson

Re: [PATCH] vfio/igd: Fix potential overflow in igd_gtt_memory_size()

2025-01-16 Thread Alex Williamson
EN8_GGMS_SHIFT) & IGD_GMCH_GEN8_GGMS_MASK; > if (ggms != 0) { > - ggms = 1 << ggms; > +ggms = 1ULL << ggms; > } > } > Reviewed-by: Alex Williamson

Re: [PATCH v1 0/5] Report vfio-ap configuration changes

2025-01-07 Thread Alex Williamson
On Tue, 7 Jan 2025 13:43:49 -0500 Rorie Reyes wrote: > This patch series creates and registers a handler that is called when > userspace is notified by the kernel that a guest's AP configuration has > changed. The handler in turn notifies the guest that its AP configuration > has changed. This a

Re: [PATCH 2/3] vfio/pci: introduce config_offset field in VFIOConfigMirrorQuirk

2025-01-03 Thread Alex Williamson
On Tue, 31 Dec 2024 23:19:52 +0800 Tomita Moeko wrote: > Device may only expose a specific portion of PCI config space through a > region in a BAR, such behavior is seen in igd GGC and BDSM mirrors in > BAR0. To handle these, config_offset is introduced to allow mirroring > arbitrary region in PC

Re: [PATCH 3/3] vfio/igd: use VFIOConfigMirrorQuirk for mirrored registers

2025-01-03 Thread Alex Williamson
On Tue, 31 Dec 2024 23:19:53 +0800 Tomita Moeko wrote: > With the introduction of config_offset field, VFIOConfigMirrorQuirk can > now be used for those mirrored register in igd bar0. This eliminates > the need for the macro intoduced in 1a2623b5c9e7 ("vfio/igd: add macro > for declaring mirrored

Re: [PATCH v4 00/10] vfio/igd: Enable legacy mode on more devices

2024-12-06 Thread Alex Williamson
igd: fix GTT stolen memory size calculation for gen 8+" to > the first. > Link: > https://lore.kernel.org/qemu-devel/20241205105535.30498-1-tomitamo...@gmail.com/ Series: Reviewed-by: Alex Williamson

Re: [PATCH v3 03/10] vfio/igd: fix GTT stolen memory size calculation for gen 8+

2024-12-05 Thread Alex Williamson
tel.com/content/www/us/en/content-details/330835 > > Reported-By: Alex Williamson > Signed-off-by: Tomita Moeko > --- > hw/vfio/igd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) This should come before the preceding patch in the series so that we're no

Re: [PATCH v2 6/9] vfio/igd: add macro for declaring mirrored registers

2024-12-04 Thread Alex Williamson
On Tue, 3 Dec 2024 21:35:45 +0800 Tomita Moeko wrote: > igd devices have multipe registers mirroring mmio address and pci > config space, more than a single BDSM register. To support this, > the read/write functions are made common and a macro is defined to > simplify the declaration of MemoryRe

Re: [PATCH v2 7/9] vfio/igd: emulate GGC register in mmio bar0

2024-12-04 Thread Alex Williamson
On Tue, 3 Dec 2024 21:35:46 +0800 Tomita Moeko wrote: > The GGC register at 0x50 of pci config space is a mirror of the same > register at 0x108040 of mmio bar0 [1]. i915 driver also reads that > register from mmio bar0 instead of config space. As GGC is programmed > and emulated by qemu, the mm

Re: [PATCH v2 9/9] vfio/igd: add x-igd-gms option back to set DSM region size for guest

2024-12-04 Thread Alex Williamson
On Tue, 3 Dec 2024 16:30:56 + Corvin Köhne wrote: > On Tue, 2024-12-03 at 21:35 +0800, Tomita Moeko wrote: > > CAUTION: External Email!! > > DSM region is likely to store framebuffer in Windows, a small DSM > > region may cause display issues (e.g. half of the screen is black). > > By defaul

Re: [PATCH v2 3/9] vfio/igd: canonicalize memory size calculations

2024-12-04 Thread Alex Williamson
On Tue, 3 Dec 2024 21:35:42 +0800 Tomita Moeko wrote: > Add helper functions igd_gtt_memory_size() and igd_stolen_size() for > calculating GTT stolen memory and Data stolen memory size in bytes, > and use macros to replace the hardware-related magic numbers for > better readability. > > Signed-

Re: [PATCH v2 2/9] vfio/igd: align generation with i915 kernel driver

2024-12-04 Thread Alex Williamson
On Tue, 3 Dec 2024 21:35:41 +0800 Tomita Moeko wrote: > Define the igd device generations according to i915 kernel driver to > avoid confusion, and adjust comment placement to clearly reflect the > relationship between ids and devices. > > The condition of how GTT stolen memory size is calculat

Re: [PATCH v2 0/9] vfio/igd: Enable legacy mode on more devices

2024-12-03 Thread Alex Williamson
On Tue, 3 Dec 2024 21:35:39 +0800 Tomita Moeko wrote: > This patchset extends the support of legacy mode igd passthrough to > all Intel Gen 11 and 12 devices (including Ice Lake, Jasper Lake, > Rocket Lake, Alder Lake and Raptor Lake), and emulates GGC register > in MMIO BAR0 for better compatib

Re: [PATCH v2] pci: ensure valid link status bits for downstream ports

2024-12-03 Thread Alex Williamson
nity checks added via 88c869198aa63 > ("pci: Sanity test minimum downstream LNKSTA") outside of the > branch to make sure downstream ports always have a valid LNKSTA. > > Signed-off-by: Sebastian Ott > Tested-by: Zhenyu Zhang > --- > hw/pci/pcie.c | 12 ++++ >

Re: [PATCH] pci: ensure valid link status bits for downstream ports

2024-12-02 Thread Alex Williamson
On Mon, 11 Nov 2024 13:37:56 +0100 Sebastian Ott wrote: > PCI hotplug for downstream endpoints on arm fails because Linux' > PCIe hotplug driver doesn't like the QEMU provided LNKSTA: > > pcieport :08:01.0: pciehp: Slot(2): Card present > pcieport :08:01.0: pciehp: Slot(2): Link Up >

Re: [PATCH 1/8] vfio/igd: fix GTT stolen memory size calculation for gen 7

2024-12-01 Thread Alex Williamson
On Sun, 1 Dec 2024 22:11:29 -0700 Alex Williamson wrote: > On Mon, 2 Dec 2024 00:09:31 +0800 > Tomita Moeko wrote: > > > Both intel documentation [1][2] and i915 driver shows GGMS represents > > GTT stolen memory size in multiple of 1MB, not 2MB starting from gen 8. &g

Re: [PATCH 4/8] vfio/igd: align generation with i915 kernel driver

2024-12-01 Thread Alex Williamson
On Mon, 2 Dec 2024 00:09:34 +0800 Tomita Moeko wrote: > Define the igd device generations according to i915 kernel driver to > avoid confusion, and adjust comment placement to clearly reflect the > relationship between ids and devices. > > Signed-off-by: Tomita Moeko > --- > hw/vfio/igd.c | 3

Re: [PATCH 3/8] vfio/igd: remove unsupported device ids

2024-12-01 Thread Alex Williamson
3500: > -case 0xa000: > -return -1; > /* SandyBridge, IvyBridge, ValleyView, Haswell */ > case 0x0100: > case 0x0400: Reviewed-by: Alex Williamson

Re: [PATCH 2/8] vfio/igd: canonicalize memory size calculations

2024-12-01 Thread Alex Williamson
On Mon, 2 Dec 2024 00:09:32 +0800 Tomita Moeko wrote: > Add helper functions igd_gtt_memory_size() and igd_stolen_size() for > calculating GTT stolen memory and Data stolen memory size in bytes, > and use macros to replace the hardware-related magic numbers for > better readability. > > Signed-

Re: [PATCH 1/8] vfio/igd: fix GTT stolen memory size calculation for gen 7

2024-12-01 Thread Alex Williamson
On Mon, 2 Dec 2024 00:09:31 +0800 Tomita Moeko wrote: > Both intel documentation [1][2] and i915 driver shows GGMS represents > GTT stolen memory size in multiple of 1MB, not 2MB starting from gen 8. > > [1] > https://www.intel.com/content/dam/www/public/us/en/documents/datasheets/3rd-gen-core

Re: [PATCH 1/1] vfio/platform: Add mmio-base property to define start address for MMIO mapping

2024-11-12 Thread Alex Williamson
On Tue, 12 Nov 2024 22:02:12 + Juan Pablo Ruiz wrote: > Some platform devices have large MMIO regions (e.g., GPU reserved memory). For > certain devices, it's preferable to have a 1:1 address translation in the VM > to > avoid modifying driver source code. Why do we need 1:1 mappings? Shou

Re: [PATCH] hw/igd: fix calculation of graphics stolen memory

2024-11-08 Thread Alex Williamson
uint32_t gmch) > if (gms < 0xf0) > return gms * 32; > else > - return gms * 4 + 4; > +return (gms - 0xf0) * 4 + 4; > } > } > Reviewed-by: Alex Williamson

Re: [PATCH] vfio/igd: add pci id for Coffee Lake

2024-11-08 Thread Alex Williamson
; +case 0x3e00: > +return 9; > /* ElkhartLake */ > case 0x4500: > return 11; Reviewed-by: Alex Williamson

Re: [PATCH 2/2] vfio/helpers: Align mmaps

2024-10-23 Thread Alex Williamson
On Wed, 23 Oct 2024 14:44:19 +0200 Cédric Le Goater wrote: > On 10/22/24 22:08, Alex Williamson wrote: > > Thanks to work by Peter Xu, support is introduced in Linux v6.12 to > > allow pfnmap insertions at PMD and PUD levels of the page table. This > > means that provid

[PATCH 1/2] vfio/helpers: Refactor vfio_region_mmap() error handling

2024-10-22 Thread Alex Williamson
Move error handling code to the end of the function so that it can more easily be shared by new mmap failure conditions. No functional change intended. Signed-off-by: Alex Williamson --- hw/vfio/helpers.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions

[PATCH 2/2] vfio/helpers: Align mmaps

2024-10-22 Thread Alex Williamson
pping level sizes, therefore this takes the simple approach to align the mapping to the power-of-two size of the region, up to 1GiB, which is currently the maximum alignment we care about. Cc: Peter Xu Signed-off-by: Alex Williamson --- hw/vfio/helpers.c | 32 ++-- 1

[PATCH 0/2] vfio: Align mmaps

2024-10-22 Thread Alex Williamson
value for mmap, please share. Thanks, Alex Alex Williamson (2): vfio/helpers: Refactor vfio_region_mmap() error handling vfio/helpers: Align mmaps hw/vfio/helpers.c | 66 +-- 1 file changed, 47 insertions(+), 19 deletions(-) -- 2.46.2

Re: [RFC 1/1] vfio: support CXL device in VFIO stub

2024-10-11 Thread Alex Williamson
On Sat, 21 Sep 2024 00:14:40 -0700 Zhi Wang wrote: > To support CXL device passthrough, vfio-cxl-core is introduced. This > is the QEMU part. > > Get the CXL caps from the vfio-cxl-core. Trap and emulate the HDM > decoder registers. Map the HDM decdoers when the guest commits a HDM > decoder. I

Re: [PATCH v3 0/7] vfio/igd: add passthrough support for IGDs of gen 11 and later

2024-08-29 Thread Alex Williamson
gt; hw/vfio/igd.c| 185 +-- > hw/vfio/pci-quirks.c | 1 + > hw/vfio/pci.h | 1 + > 3 files changed, 161 insertions(+), 26 deletions(-) > LGTM, for series Reviewed-by: Alex Williamson

Re: [PATCH 4/7] vfio/igd: add new bar0 quirk to emulate BDSM mirror

2024-08-26 Thread Alex Williamson
On Thu, 22 Aug 2024 13:08:29 +0200 Corvin Köhne wrote: > The BDSM register is mirrored into MMIO space at least for gen 11 and > later devices. Unfortunately, the Windows driver reads the register > value from MMIO space instead of PCI config space for those devices [1]. > Therefore, we either h

Re: [PATCH RFC/RFT] vfio/pci-quirks: Quirk for ath wireless

2024-08-15 Thread Alex Williamson
On Tue, 13 Aug 2024 20:37:24 -0300 Jason Gunthorpe wrote: > On Tue, Aug 13, 2024 at 03:03:20PM -0600, Alex Williamson wrote: > > > How does the guest know to write a remappable vector format? How does > > the guest know the host interrupt architecture? For example why wo

Re: [PATCH RFC/RFT] vfio/pci-quirks: Quirk for ath wireless

2024-08-13 Thread Alex Williamson
On Tue, 13 Aug 2024 13:43:41 -0300 Jason Gunthorpe wrote: > On Mon, Aug 12, 2024 at 11:00:40AM -0600, Alex Williamson wrote: > > These devices have an embedded interrupt controller which is programmed > > with guest physical MSI address/data, which doesn't work. We need

Re: [PATCH V2 01/11] machine: alloc-anon option

2024-08-13 Thread Alex Williamson
On Tue, 13 Aug 2024 11:35:15 -0400 Peter Xu wrote: > On Mon, Aug 12, 2024 at 02:37:59PM -0400, Steven Sistare wrote: > > On 8/8/2024 2:32 PM, Steven Sistare wrote: > > > On 7/29/2024 8:29 AM, Igor Mammedov wrote: > > > > On Sat, 20 Jul 2024 16:28:25 -0400 > > > > Steven Sistare wrote: > > >

Re: [RFC V1 02/12] iommufd: no DMA to BARs

2024-08-12 Thread Alex Williamson
On Sat, 20 Jul 2024 12:15:27 -0700 Steve Sistare wrote: > Do not map VFIO PCI BARs for DMA. This stops a raft of warnings of the > following form at QEMU start time when using -object iommufd: > > qemu-kvm: warning: IOMMU_IOAS_MAP failed: Bad address, PCI BAR? > qemu-kvm: vfio_container_dma_map

[PATCH RFC/RFT] vfio/pci-quirks: Quirk for ath wireless

2024-08-12 Thread Alex Williamson
uires interrupt remapping support in the host. NB. The #define for the new vfio feature is temporary for RFC/RFT, a formal proposal will include a proper linux-headers update. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216055 Signed-off-by: Alex Williamson --- hw/vfio/pci-quirks.c

Re: [PATCH V1 4/8] vfio-pci: cpr part 1 (fd and dma)

2024-07-10 Thread Alex Williamson
On Tue, 9 Jul 2024 13:58:53 -0700 Steve Sistare wrote: > Enable vfio-pci devices to be saved and restored across a cpr-exec of qemu. > > At vfio creation time, save the value of vfio container, group, and device > descriptors in CPR state. > > In the container pre_save handler, suspend the use

Re: About VFIO Device Pass-through on Qemu.

2024-07-05 Thread Alex Williamson
On Fri, 5 Jul 2024 17:08:49 +0800 (CST) tugouxp <13824125...@163.com> wrote: > Hi folks: > > > I have a questions about device vfio pass-through usage snarios, > PCI device pass-throug for example. did the GPA that host physical > memory mapped to Guest vcpu through MMU must be identical wi

  1   2   3   4   5   6   7   8   9   10   >