From: Stewart Hildebrand <stewart.hildebrand@amd.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v1 1/5] vpci: const-ify some pdev instances
Date: Wed, 11 Jun 2025 15:28:47 -0400 [thread overview]
Message-ID: <ea8d1add-7a53-40eb-b0e6-8bf5c2b83c68@amd.com> (raw)
In-Reply-To: <aEFnmVotuGhR4Ti0@macbook.local>
On 6/5/25 05:47, Roger Pau Monné wrote:
> On Sat, May 31, 2025 at 08:53:59AM -0400, Stewart Hildebrand wrote:
>> Since 622bdd962822 ("vpci/header: handle p2m range sets per BAR"), a
>> non-const pdev is no longer needed for error handling in
>> vpci_process_pending(). Const-ify pdev in vpci_process_pending(),
>> defer_map(), and struct vpci_vcpu.
>>
>> Get rid of const-removal workaround in modify_bars().
>>
>> Take the opportunity to remove an unused parameter in defer_map().
>>
>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
>
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Thanks!
> One further simplification below.
>
>> ---
>> This is prerequisite for ("vpci: use separate rangeset for BAR
>> unmapping") in order to call defer_map() with a const pdev.
>> ---
>> xen/drivers/vpci/header.c | 16 ++++------------
>> xen/include/xen/vpci.h | 2 +-
>> 2 files changed, 5 insertions(+), 13 deletions(-)
>>
>> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
>> index 1f48f2aac64e..e42c8efa2302 100644
>> --- a/xen/drivers/vpci/header.c
>> +++ b/xen/drivers/vpci/header.c
>> @@ -175,7 +175,7 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
>>
>> bool vpci_process_pending(struct vcpu *v)
>> {
>> - struct pci_dev *pdev = v->vpci.pdev;
>> + const struct pci_dev *pdev = v->vpci.pdev;
>> struct vpci_header *header = NULL;
>> unsigned int i;
>>
>> @@ -283,8 +283,7 @@ static int __init apply_map(struct domain *d, const struct pci_dev *pdev,
>> return rc;
>> }
>>
>> -static void defer_map(struct domain *d, struct pci_dev *pdev,
>> - uint16_t cmd, bool rom_only)
>> +static void defer_map(const struct pci_dev *pdev, uint16_t cmd, bool rom_only)
>> {
>> struct vcpu *curr = current;
>>
>> @@ -308,7 +307,7 @@ static void defer_map(struct domain *d, struct pci_dev *pdev,
>> static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only)
>> {
>> struct vpci_header *header = &pdev->vpci->header;
>> - struct pci_dev *tmp, *dev = NULL;
>> + struct pci_dev *tmp;
>> const struct domain *d;
>> const struct vpci_msix *msix = pdev->vpci->msix;
>> unsigned int i, j;
>> @@ -450,11 +449,6 @@ static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool rom_only)
>>
>> if ( tmp == pdev )
>> {
>> - /*
>> - * Need to store the device so it's not constified and defer_map
>> - * can modify it in case of error.
>> - */
>> - dev = tmp;
>> if ( !rom_only )
>
> You can now join this with the previous if, and reduce one level of
> indentation:
>
> if ( tmp == pdev && !rom_only )
> /* comment text */
> continue;
Will do. I'll plan to keep your R-b tag for v2 since this is a trivial
change.
next prev parent reply other threads:[~2025-06-11 19:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-31 12:53 [PATCH v1 0/5] vpci: allow 32-bit BAR writes with memory decoding enabled Stewart Hildebrand
2025-05-31 12:53 ` [PATCH v1 1/5] vpci: const-ify some pdev instances Stewart Hildebrand
2025-06-05 9:47 ` Roger Pau Monné
2025-06-11 19:28 ` Stewart Hildebrand [this message]
2025-07-07 16:27 ` Stewart Hildebrand
2025-05-31 12:54 ` [PATCH v1 2/5] vpci: rework error path in vpci_process_pending() Stewart Hildebrand
2025-06-05 9:53 ` Roger Pau Monné
2025-06-11 20:44 ` Stewart Hildebrand
2025-05-31 12:54 ` [PATCH v1 3/5] vpci: introduce map_bars() Stewart Hildebrand
2025-06-05 10:16 ` Roger Pau Monné
2025-06-11 19:55 ` Stewart Hildebrand
2025-05-31 12:54 ` [PATCH v1 4/5] vpci: use separate rangeset for BAR unmapping Stewart Hildebrand
2025-06-05 10:28 ` Roger Pau Monné
2025-06-05 10:38 ` Jan Beulich
2025-05-31 12:54 ` [PATCH v1 5/5] vpci: allow 32-bit BAR writes with memory decoding enabled Stewart Hildebrand
2025-06-05 10:41 ` Jan Beulich
2025-06-11 20:22 ` Stewart Hildebrand
2025-06-12 7:27 ` Jan Beulich
2025-06-12 7:32 ` Roger Pau Monné
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=ea8d1add-7a53-40eb-b0e6-8bf5c2b83c68@amd.com \
--to=stewart.hildebrand@amd.com \
--cc=roger.pau@citrix.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.