All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <Andrew.Cooper3@citrix.com>
To: Jan Beulich <jbeulich@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Paul Durrant <paul@xen.org>,
	Roger Pau Monne <roger.pau@citrix.com>,
	Rahul Singh <Rahul.Singh@arm.com>,
	George Dunlap <George.Dunlap@citrix.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH v2 2/3] PCI: fold pci_get_pdev{,_by_domain}()
Date: Thu, 11 Aug 2022 13:21:29 +0000	[thread overview]
Message-ID: <48eee228-f7fa-5932-ac93-03cf70de01e8@citrix.com> (raw)
In-Reply-To: <0bdd4f3f-965a-fe39-f7af-d8a40b7a68c6@suse.com>

On 11/08/2022 11:52, Jan Beulich wrote:
> Rename the latter, subsuming the functionality of the former when passed
> NULL as first argument.
>
> Since this requires touching all call sites anyway, take the opportunity
> and fold the remaining three parameters into a single pci_sbdf_t one.
>
> No functional change intended. In particular the locking related
> assertion needs to continue to be kept silent when a non-NULL domain
> pointer is passed - both vpci_read() and vpci_write() call the function
> without holding the lock (adding respective locking to vPCI [or finding
> an alternative to doing so] is the topic of a separate series).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> v2: New.
>
> --- a/xen/arch/x86/irq.c
> +++ b/xen/arch/x86/irq.c
> @@ -2162,7 +2162,7 @@ int map_domain_pirq(
>          if ( !cpu_has_apic )
>              goto done;
>  
> -        pdev = pci_get_pdev_by_domain(d, msi->seg, msi->bus, msi->devfn);
> +        pdev = pci_get_pdev(d, PCI_SBDF(msi->seg, msi->bus, msi->devfn));

Oh, I should really have read this patch before trying to do the sbdf
conversion in patch 1.

However, it occurs to me that this:

diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index 117379318f2c..6f0ab845017c 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -59,9 +59,14 @@
 #define FIX_MSIX_MAX_PAGES              512
 
 struct msi_info {
-    u16 seg;
-    u8 bus;
-    u8 devfn;
+    union {
+        struct {
+            u8 devfn;
+            u8 bus;
+            u16 seg;
+        };
+        pci_sbdf_t sbdf;
+    };
     int irq;
     int entry_nr;
     uint64_t table_base;

will simplify several hunks in this patch, because you can just pass
msi->sbdf rather than reconstructing it by reversing 32 bits worth of
data from their in-memory representation.

Preferably with something to this effect included, Reviewed-by: Andrew
Cooper <andrew.cooper3@citrix.com>

  reply	other threads:[~2022-08-11 13:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 10:50 [PATCH v2 0/3] PCI: re-work pci_get_pdev() and friends Jan Beulich
2022-08-11 10:51 ` [PATCH v2 1/3] PCI: simplify (and thus correct) pci_get_pdev{,_by_domain}() Jan Beulich
2022-08-11 13:11   ` Andrew Cooper
2022-08-11 13:21     ` Jan Beulich
2022-08-11 16:15   ` Rahul Singh
2022-08-11 10:52 ` [PATCH v2 2/3] PCI: fold pci_get_pdev{,_by_domain}() Jan Beulich
2022-08-11 13:21   ` Andrew Cooper [this message]
2022-08-11 13:26     ` Jan Beulich
2022-08-11 15:09       ` Andrew Cooper
2022-08-11 15:41         ` Jan Beulich
2022-08-11 16:17   ` Rahul Singh
2022-08-11 10:52 ` [PATCH v2 3/3] PCI: bring pci_get_real_pdev() in line with pci_get_pdev() Jan Beulich
2022-08-11 13:28   ` Andrew Cooper
2022-08-11 16:16   ` Rahul Singh
2022-08-11 16:37 ` [PATCH] x86/msi: Switch msi_info to using pci_sbdf_t Andrew Cooper
2022-08-12  6:45   ` Jan Beulich
2022-08-12 10:22     ` Andrew Cooper

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=48eee228-f7fa-5932-ac93-03cf70de01e8@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=Rahul.Singh@arm.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=paul@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.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.