All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: "Chen, Jiqian" <Jiqian.Chen@amd.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"Huang, Ray" <Ray.Huang@amd.com>
Subject: Re: [PATCH v3 03/11] vpci/header: Emulate legacy capability list for dom0
Date: Wed, 7 May 2025 09:49:37 +0200	[thread overview]
Message-ID: <aBsQkZLNAEEztXZC@macbook.lan> (raw)
In-Reply-To: <BL1PR12MB5849A7D00734B43A38F14D10E788A@BL1PR12MB5849.namprd12.prod.outlook.com>

On Wed, May 07, 2025 at 02:46:52AM +0000, Chen, Jiqian wrote:
> On 2025/5/6 21:50, Roger Pau Monné wrote:
> > On Mon, Apr 21, 2025 at 02:18:55PM +0800, Jiqian Chen wrote:
> >> Current logic of emulating legacy capability list is only for domU.
> >> So, expand it to emulate for dom0 too. Then it will be easy to hide
> >> a capability whose initialization fails in a function.
> >>
> >> Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
> > 
> > Sorry, one nit I've noticed while looking at the next patch.
> > 
> >> @@ -786,13 +787,15 @@ static int vpci_init_capability_list(struct pci_dev *pdev)
> >>  
> >>              next = pci_find_next_cap_ttl(pdev->sbdf,
> >>                                           pos + PCI_CAP_LIST_NEXT,
> >> -                                         supported_caps,
> >> -                                         ARRAY_SIZE(supported_caps), &ttl);
> >> +                                         caps, n, &ttl);
> >>  
> >> -            rc = vpci_add_register(pdev->vpci, vpci_hw_read8, NULL,
> The same here, NULL -> vpci_hw_write8, I think.

No, not here, since the PCI_CAP_LIST_ID handler is only added for
non-hardware domains, and in that case we do want to ignore writes to
the register.

> >> -                                   pos + PCI_CAP_LIST_ID, 1, NULL);
> >> -            if ( rc )
> >> -                return rc;
> >> +            if ( !is_hwdom )
> >> +            {
> >> +                rc = vpci_add_register(pdev->vpci, vpci_hw_read8, NULL,
> >> +                                       pos + PCI_CAP_LIST_ID, 1, NULL);
> >> +                if ( rc )
> >> +                    return rc;
> >> +            }
> >>  
> >>              rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
> > 
> > For the hardware domain the write handler should be vpci_hw_write8
> > instead of NULL.
> OK, I think I need to add definition of vpci_hw_write8.
> But I have a question, if hardware domain write this register through vpci_hw_write8,
> then the "next address data" of hardware will be in consistent with vpci.
> Is it fine? Or should I update vpci's cache?

According to the spec this field is read-only, so writes should be
ignored.  We allow hardware domain full access because for hardware
domain we aim to trap as little as possible to not diverge behavior
from native, and to allow possible device quirks to work.

It could be conceivable that some vendor has a hidden specific
functionality that somehow triggered by a write to this field.

Regards, Roger.


  parent reply	other threads:[~2025-05-07  7:49 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21  6:18 [PATCH v3 00/11] Support hiding capability when its initialization fails Jiqian Chen
2025-04-21  6:18 ` [PATCH v3 01/11] vpci/header: Move emulating cap list logic into new function Jiqian Chen
2025-04-29  7:10   ` Chen, Jiqian
2025-05-06 13:30   ` Roger Pau Monné
2025-04-21  6:18 ` [PATCH v3 02/11] driver/pci: Get next capability without passing caps Jiqian Chen
2025-04-22 15:59   ` Jan Beulich
2025-04-23  3:13     ` Chen, Jiqian
2025-04-21  6:18 ` [PATCH v3 03/11] vpci/header: Emulate legacy capability list for dom0 Jiqian Chen
2025-04-22 16:01   ` Jan Beulich
2025-04-23  3:31     ` Chen, Jiqian
2025-04-23  7:27       ` Jan Beulich
2025-05-06 13:47   ` Roger Pau Monné
2025-05-06 13:50   ` Roger Pau Monné
2025-05-07  2:46     ` Chen, Jiqian
2025-05-07  2:50       ` Chen, Jiqian
2025-05-07  7:49       ` Roger Pau Monné [this message]
2025-05-07  8:13         ` Chen, Jiqian
2025-04-21  6:18 ` [PATCH v3 04/11] vpci/header: Emulate extended " Jiqian Chen
2025-05-06 14:14   ` Roger Pau Monné
2025-05-07  3:32     ` Chen, Jiqian
2025-05-07  7:55       ` Roger Pau Monné
2025-04-21  6:18 ` [PATCH v3 05/11] vpci: Refactor REGISTER_VPCI_INIT Jiqian Chen
2025-04-22 16:03   ` Jan Beulich
2025-04-23  3:49     ` Chen, Jiqian
2025-04-23  7:36       ` Jan Beulich
2025-04-23  8:17         ` Chen, Jiqian
2025-05-06 14:37   ` Roger Pau Monné
2025-05-07  5:59     ` Chen, Jiqian
2025-05-07  8:04       ` Roger Pau Monné
2025-05-07  8:23         ` Chen, Jiqian
2025-04-21  6:18 ` [PATCH v3 06/11] vpci: Hide legacy capability when it fails to initialize Jiqian Chen
2025-05-06 16:00   ` Roger Pau Monné
2025-05-07  6:38     ` Chen, Jiqian
2025-05-07  8:07       ` Roger Pau Monné
2025-04-21  6:18 ` [PATCH v3 07/11] vpci: Hide extended " Jiqian Chen
2025-04-22 16:06   ` Jan Beulich
2025-05-08  9:16     ` Chen, Jiqian
2025-05-08  9:47       ` Roger Pau Monné
2025-05-06 16:21   ` Roger Pau Monné
2025-05-07  7:26     ` Chen, Jiqian
2025-05-07  8:09       ` Roger Pau Monné
2025-05-07  8:49         ` Chen, Jiqian
2025-05-07  9:05           ` Roger Pau Monné
2025-04-21  6:19 ` [PATCH v3 08/11] vpci: Refactor vpci_remove_register to remove matched registers Jiqian Chen
2025-05-06 16:29   ` Roger Pau Monné
2025-04-21  6:19 ` [PATCH v3 09/11] vpci/rebar: Remove registers when init_rebar() fails Jiqian Chen
2025-05-08  9:39   ` Roger Pau Monné
2025-05-09  5:27     ` Chen, Jiqian
2025-04-21  6:19 ` [PATCH v3 10/11] vpci/msi: Free MSI resources when init_msi() fails Jiqian Chen
2025-05-08  9:57   ` Roger Pau Monné
2025-04-21  6:19 ` [PATCH v3 11/11] vpci/msix: Add function to clean MSIX resources Jiqian Chen
2025-05-08 10:04   ` Roger Pau Monné
2025-05-09  5:45     ` Chen, Jiqian

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=aBsQkZLNAEEztXZC@macbook.lan \
    --to=roger.pau@citrix.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.