|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v13 10/14] vpci/header: emulate PCI_COMMAND register for guests
On 02.02.2024 22:33, Stewart Hildebrand wrote:
> @@ -836,9 +870,20 @@ static int cf_check init_header(struct pci_dev *pdev)
> if ( pdev->ignore_bars )
> return 0;
>
> - /* Disable memory decoding before sizing. */
> cmd = pci_conf_read16(pdev->sbdf, PCI_COMMAND);
> - if ( cmd & PCI_COMMAND_MEMORY )
> +
> + /*
> + * Clear PCI_COMMAND_MEMORY and PCI_COMMAND_IO for DomUs, so they will
> + * always start with memory decoding disabled and to ensure that we will
> not
> + * call modify_bars() at the end of this function.
To achieve this, fiddling with PCI_COMMAND_IO isn't necessary. Which isn't
to say its clearing should go away; quite the other way around: Why would
we leave e.g. PCI_COMMAND_MASTER enabled? In fact wasn't it in an earlier
version of the series that the guest view simply started out as zero? The
patch description still says so.
> --- a/xen/drivers/vpci/msi.c
> +++ b/xen/drivers/vpci/msi.c
> @@ -70,6 +70,13 @@ static void cf_check control_write(
>
> if ( vpci_msi_arch_enable(msi, pdev, vectors) )
> return;
> +
> + /* Make sure domU doesn't enable INTx while enabling MSI. */
> + if ( !is_hardware_domain(pdev->domain) )
> + {
> + pci_intx(pdev, false);
> + pdev->vpci->header.guest_cmd |= PCI_COMMAND_INTX_DISABLE;
> + }
While here we're inside "if ( new_enabled )", ...
> --- a/xen/drivers/vpci/msix.c
> +++ b/xen/drivers/vpci/msix.c
> @@ -135,6 +135,13 @@ static void cf_check control_write(
> }
> }
>
> + /* Make sure domU doesn't enable INTx while enabling MSI-X. */
> + if ( new_enabled && !msix->enabled && !is_hardware_domain(pdev->domain) )
> + {
> + pci_intx(pdev, false);
> + pdev->vpci->header.guest_cmd |= PCI_COMMAND_INTX_DISABLE;
> + }
.. here you further check that it's actually a 0->1 transition? Why
not alike for MSI?
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |