[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 10/13] vpci/header: reset the command register when adding devices
- To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Fri, 21 Jul 2023 15:37:47 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OGp5KHGWaERW7SP9NXvB2lhSCY8j+ezszZlvZ3qdXjM=; b=aXGklbL1sfnbx5QCUf+RnsdryHBU2mA5HhfK5HwlHDSuraXmPz/PzN8y16AID9vJwXLCaA8/+LYGGpaDbMEvoxckovpOUzoAOX98Qw44vhbhiUGOXUdH84Ep2pmB/cqLhonPCVuETyq8f3lJEh4/spvBggSLb0YQySuf73ZCr7rLvJdCTCo3W8INvWABvMB8YHsTadpZJW97dz2ii7ZaodLqlskYEc8LuLxarTKfENH0wfu6z1a8dU9QyEkRZWBQDAX0jT2rXe/j4p6nkQb2IKOdPbabizYixJWLHv1QENwkrzESih47cHzVZexU0M1+uzej2pG1o+/xhdcHinKGog==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qc8gVSVBut2vOyXfFQn0pqWO+ecA22EJm/X/VLU7L+sbcftjydeUJqSHG7FLvBSbrvwgKzG/sBXROPC4u+qGC9ZXXN5A45u66i8LeDdcByoIkTfwRkgkGeCZCLV7dGmEayLjSKq9wVkr8hggvU1fDy2SymbaddJNFtJJP0nC6lBWT4y2s5e9s5h0DYlbfZSQ4+ML4BjVr3fn7lB2iTHPn8C9/say36xdnXVpezBU+3ga+HzIK9x5UBCm1xe8mAQaFqnarLEKidpsGTppLqsZ7OseiQWNG0OkYm5RVtGlLbL2vV4aMbCiT5Xr3n0euwcxtziGQyQODTlQmhMgfIHAHA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Delivery-date: Fri, 21 Jul 2023 13:38:06 +0000
- Ironport-data: A9a23:TUSCG6px2U8TD+toC5IoXshPTmxeBmLfZBIvgKrLsJaIsI4StFCzt garIBnUMq3ZZGP2L99za42y8kNXuJTczIQxSVc5qywwFC4T9ZuZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpA1c/Ek/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKq04GpwUmAWP6gR5weBzSBNVfrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXAB8oMiy5vsW5+amQV9NJop0BItj1MbpK7xmMzRmBZRonabbqZvySoPN9gnI3jM0IGuvCb c0EbzYpdA7HfxBEJlYQDtQ5gfusgX78NTZfrTp5p4JuuzSVkFM3jeiraYKLEjCJbZw9ckKwv GXJ8n6/GhgHHNee1SCE4jSngeqncSbTAdtNSOblrqEx6LGV7mdQJDonCGWWmNee1nyFRvd0A lIW6zV7+MDe82TuFLERRSaQnnmAuRINXstKJMcz4gqN16n87h6QAy4PSTspQMwrsoo6SCIn0 neNnsj1Hnp/vbuNU3Wf+7yI6zSoNkA9CmsPZjQNSwcf1PDlrJsulRLETttlE6mdg8X8HHf7x DXikcQlr7AajMpO26Dl+1nC2mqovsKQFlBz4RjLVGW46A8/fJSie4Gj9Vnc67BHMZqdSV6C+ nMDnqBy8dwzMH1ErwTVKM1lIV1jz6zt3OH06bK3I6Qcyg==
- Ironport-hdrordr: A9a23:Op9a8qkRkWQoMJUPG7IBI6c9eZPpDfLo3DAbv31ZSRFFG/Fw9/ rCoB17726QtN91YhsdcL+7V5VoLUmzyXcX2/hyAV7BZmnbUQKTRekP0WKL+Vbd8kbFh41gPM lbEpSXCLfLfCJHZcSR2njELz73quP3jJxBho3lvghQpRkBUdAF0+/gYDzranGfQmN9dP0EPa vZ3OVrjRy6d08aa8yqb0N1JNQq97Xw5fTbiQdtPW9f1DWz
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Thu, Jul 20, 2023 at 12:32:33AM +0000, Volodymyr Babchuk wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>
> Reset the command register when assigning a PCI device to a guest:
> according to the PCI spec the PCI_COMMAND register is typically all 0's
> after reset, but this might not be true for the guest as it needs
> to respect host's settings.
> For that reason, do not write 0 to the PCI_COMMAND register directly,
> but go through the corresponding emulation layer (cmd_write), which
> will take care about the actual bits written.
>
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> ---
> Since v6:
> - use cmd_write directly without introducing emulate_cmd_reg
> - update commit message with more description on all 0's in PCI_COMMAND
> Since v5:
> - updated commit message
> Since v1:
> - do not write 0 to the command register, but respect host settings.
> ---
> xen/drivers/vpci/header.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> index ae05d242a5..44a9940fb9 100644
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -749,6 +749,10 @@ static int cf_check init_bars(struct pci_dev *pdev)
> */
> ASSERT(header->guest_cmd == 0);
>
> + /* Reset the command register for guests. */
> + if ( !is_hwdom )
> + cmd_write(pdev, PCI_COMMAND, 0, header);
So the assert just above is no longer needed? (and could be removed
from the previous patch).
As requested on the previous patch, should some message be logged if
the command register is not as expected (0 in this case?)
Thanks, Roger.
|