qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Chen, Jiqian" <Jiqian.Chen@amd.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Huang, Ray" <Ray.Huang@amd.com>
Subject: Re: [RFC QEMU PATCH v7 1/1] virtio-pci: implement No_Soft_Reset bit
Date: Thu, 28 Mar 2024 05:56:35 -0400	[thread overview]
Message-ID: <20240328055609-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <BL1PR12MB5849CC32915B97625156EAF7E73B2@BL1PR12MB5849.namprd12.prod.outlook.com>

On Thu, Mar 28, 2024 at 09:02:28AM +0000, Chen, Jiqian wrote:
> 
> On 2024/3/28 16:11, Michael S. Tsirkin wrote:
> > 
> >> +        VirtIOPCIProxy *proxy = VIRTIO_PCI(dev);
> >> +
> >>          pcie_cap_deverr_reset(dev);
> >>          pcie_cap_lnkctl_reset(dev);
> >>  
> >> -        pci_set_word(dev->config + dev->exp.pm_cap + PCI_PM_CTRL, 0);
> >> +        if (proxy->flags & VIRTIO_PCI_FLAG_PM_NO_SOFT_RESET) {
> >> +            val |= PCI_PM_CTRL_NO_SOFT_RESET;
> >> +        }
> >> +        pci_set_word(dev->config + dev->exp.pm_cap + PCI_PM_CTRL, val);
> > 
> > 
> > There is no need to do it like this - only state is writeable
> > anyway. So simply
> > 	pci_word_test_and_clear_mask(dev->config + dev->exp.pm_cap + PCI_PM_CTRL, PCI_PM_CTRL_STATE_MASK)
> > 
> > 
> > maybe we should actually check here:
> >        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM)
> > there's a chance commit 27ce0f3afc9 broke things for old machines
> > and we never noticed. If so that should be a separate bugfix patch though.
> Make sense. It is actually a bug imported by 27ce0f3afc9.
> According to your comments, I think here should be a separate patch, like:
>    if (pci_is_express(dev)) {
>         VirtIOPCIProxy *proxy = VIRTIO_PCI(dev);
> 
>         pcie_cap_deverr_reset(dev);
>         pcie_cap_lnkctl_reset(dev);
> 
>         if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM) {
>             pci_word_test_and_clear_mask(
>                 dev->config + dev->exp.pm_cap + PCI_PM_CTRL,
>                 PCI_PM_CTRL_STATE_MASK);
>         }
>     }
> Right?

Works for me.

> > 
> > 
> 
> -- 
> Best regards,
> Jiqian Chen.



      reply	other threads:[~2024-03-28  9:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25  7:07 [RFC QEMU PATCH v7 0/1] S3 support Jiqian Chen
2024-03-25  7:07 ` [RFC QEMU PATCH v7 1/1] virtio-pci: implement No_Soft_Reset bit Jiqian Chen
2024-03-28  7:27   ` Chen, Jiqian
2024-03-28  8:11   ` Michael S. Tsirkin
2024-03-28  9:02     ` Chen, Jiqian
2024-03-28  9:56       ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240328055609-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).