All of lore.kernel.org
 help / color / mirror / Atom feed
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 3/5] vpci: introduce map_bars()
Date: Wed, 11 Jun 2025 15:55:24 -0400	[thread overview]
Message-ID: <ac318f2d-c678-4f84-8166-a48affd617cd@amd.com> (raw)
In-Reply-To: <aEFuiGq5KjrdNUE7@macbook.local>

On 6/5/25 06:16, Roger Pau Monné wrote:
> On Sat, May 31, 2025 at 08:54:01AM -0400, Stewart Hildebrand wrote:
>> Move some logic to a new function to enable code reuse.
> 
> Like with the previous changes, it's helpful if you explicitly note
> that no functional change is intended in the commit message (which I
> think it's the case here).

OK, will do.

>>
>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
>> ---
>>  xen/drivers/vpci/header.c | 56 ++++++++++++++++++++++++---------------
>>  1 file changed, 35 insertions(+), 21 deletions(-)
>>
>> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
>> index c1463d2ce076..b09ccc5e6be6 100644
>> --- a/xen/drivers/vpci/header.c
>> +++ b/xen/drivers/vpci/header.c
>> @@ -173,11 +173,38 @@ static void modify_decoding(const struct pci_dev *pdev, uint16_t cmd,
>>          ASSERT_UNREACHABLE();
>>  }
>>  
>> +static int map_bars(struct vpci_header *header, struct domain *d, bool map)
>> +{
>> +    unsigned int i;
>> +
>> +    for ( i = 0; i < ARRAY_SIZE(header->bars); i++ )
>> +    {
>> +        struct vpci_bar *bar = &header->bars[i];
>> +        struct map_data data = {
>> +            .d = d,
>> +            .map = map,
>> +            .bar = bar,
>> +        };
>> +        int rc;
>> +
>> +        if ( rangeset_is_empty(bar->mem) )
>> +            continue;
>> +
>> +        rc = rangeset_consume_ranges(bar->mem, map_range, &data);
>> +
>> +        if ( rc )
>> +            return rc;
>> +    }
>> +
>> +    return 0;
>> +}
>> +
>>  bool vpci_process_pending(struct vcpu *v)
>>  {
>>      const struct pci_dev *pdev = v->vpci.pdev;
>>      struct vpci_header *header = NULL;
>>      unsigned int i;
> 
> Maybe I'm missing something, but don't you get complains from the
> compiler here about i being unused after this change?

No, i is still used in the error path.


  reply	other threads:[~2025-06-11 19:55 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
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 [this message]
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=ac318f2d-c678-4f84-8166-a48affd617cd@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.