From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Jiqian Chen" <Jiqian.Chen@amd.com>,
"Huang Rui" <ray.huang@amd.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org, consulting@bugseng.com
Subject: Re: [PATCH v9 4/8] vpci: Hide extended capability when it fails to initialize
Date: Wed, 30 Jul 2025 12:42:31 +0200 [thread overview]
Message-ID: <562265e2a66b4eae06c4703a836e7d21@bugseng.com> (raw)
In-Reply-To: <8051d388-48f9-4878-8924-8e645f313238@suse.com>
On 2025-07-30 11:50, Jan Beulich wrote:
> On 28.07.2025 07:03, Jiqian Chen wrote:
>> +static int vpci_ext_capability_hide(
>> + const struct pci_dev *pdev, unsigned int cap)
>> +{
>> + const unsigned int offset = pci_find_ext_capability(pdev->sbdf,
>> cap);
>> + struct vpci_register *r, *prev_r;
>> + struct vpci *vpci = pdev->vpci;
>> + uint32_t header, pre_header;
>> +
>> + if ( offset < PCI_CFG_SPACE_SIZE )
>> + {
>> + ASSERT_UNREACHABLE();
>> + return 0;
>> + }
>> +
>> + spin_lock(&vpci->lock);
>> + r = vpci_get_register(vpci, offset, 4);
>> + if ( !r )
>> + {
>> + spin_unlock(&vpci->lock);
>> + return -ENODEV;
>> + }
>> +
>> + header = (uint32_t)(uintptr_t)r->private;
>> + if ( offset == PCI_CFG_SPACE_SIZE )
>> + {
>> + if ( PCI_EXT_CAP_NEXT(header) <= PCI_CFG_SPACE_SIZE )
>> + r->private = (void *)(uintptr_t)0;
>
> Eclair regards this a Misra rule 11.9 violation. Elsewhere we use (void
> *)0,
> which I then would conclude is "fine". But I can't say why that is.
> Cc-ing
> Bugseng for a possible explanation.
>
Hi Jan,
I only see
0|$ git grep "(void\*)0"
xen/include/xen/types.h:#define NULL ((void*)0)
which is fine for R11.9 of course. As Andrew noted, I don't see the need
for the use of uintptr_t either.
--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
next prev parent reply other threads:[~2025-07-30 10:42 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 5:03 [PATCH v9 0/8] Support hiding capability when its initialization fails Jiqian Chen
2025-07-28 5:03 ` [PATCH v9 1/8] vpci/header: Emulate extended capability list for dom0 Jiqian Chen
2025-07-28 5:03 ` [PATCH v9 2/8] vpci: Refactor REGISTER_VPCI_INIT Jiqian Chen
2025-07-29 12:47 ` Roger Pau Monné
2025-07-28 5:03 ` [PATCH v9 3/8] vpci: Hide legacy capability when it fails to initialize Jiqian Chen
2025-07-28 5:03 ` [PATCH v9 4/8] vpci: Hide extended " Jiqian Chen
2025-07-30 9:50 ` Jan Beulich
2025-07-30 10:19 ` Andrew Cooper
2025-07-30 10:24 ` Jan Beulich
2025-07-30 10:42 ` Nicola Vetrini [this message]
2025-07-30 10:46 ` Nicola Vetrini
2025-07-31 6:30 ` Chen, Jiqian
2025-07-28 5:03 ` [PATCH v9 5/8] vpci: Refactor vpci_remove_register to remove matched registers Jiqian Chen
2025-07-30 11:23 ` Andrew Cooper
2025-07-31 6:28 ` Chen, Jiqian
2025-08-04 15:31 ` Roger Pau Monné
2025-07-28 5:03 ` [PATCH v9 6/8] vpci/rebar: Free Rebar resources when init_rebar() fails Jiqian Chen
2025-07-28 5:04 ` [PATCH v9 7/8] vpci/msi: Free MSI resources when init_msi() fails Jiqian Chen
2025-07-28 5:04 ` [PATCH v9 8/8] vpci/msix: Free MSIX resources when init_msix() fails Jiqian Chen
2025-07-29 16:36 ` Roger Pau Monné
2025-07-30 2:52 ` 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=562265e2a66b4eae06c4703a836e7d21@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=Jiqian.Chen@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=consulting@bugseng.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=ray.huang@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--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.