From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger@xenproject.org>,
"Teddy Astie" <teddy.astie@vates.tech>,
Xen-devel <xen-devel@lists.xenproject.org>
Subject: [PATCH 4/3] x86/PCI: use pci_sbdf_t also for pci_dev_base()
Date: Wed, 9 Sep 2026 09:16:46 +0200 [thread overview]
Message-ID: <f2ed324f-3a52-42b1-8b26-b3ae53ab2ead@suse.com> (raw)
In-Reply-To: <20260908215721.3346842-1-andrew.cooper3@citrix.com>
No need to pass three arguments when both callers already hold SBDF in
their hands.
No functional change.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
With gcc16 this turns out to change generated code only in so far as a
SHR moves position.
--- a/xen/arch/x86/x86_64/mmconfig_64.c
+++ b/xen/arch/x86/x86_64/mmconfig_64.c
@@ -45,14 +45,15 @@ static char __iomem *get_virt(unsigned i
return NULL;
}
-static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
+static char __iomem *pci_dev_base(pci_sbdf_t sbdf)
{
- char __iomem *addr;
+ unsigned int bus = sbdf.bus;
+ char __iomem *addr = get_virt(sbdf.seg, &bus);
- addr = get_virt(seg, &bus);
if (!addr)
return NULL;
- return addr + ((bus << 20) | (devfn << 12));
+
+ return addr + ((bus << 20) | (sbdf.devfn << 12));
}
int pci_mmcfg_read(
@@ -66,7 +67,7 @@ err: *value = -1;
return -EINVAL;
}
- addr = pci_dev_base(sbdf.seg, sbdf.bus, sbdf.devfn);
+ addr = pci_dev_base(sbdf);
if (!addr)
goto err;
@@ -94,7 +95,7 @@ int pci_mmcfg_write(
if (unlikely(reg + len > PCI_CFG_SPACE_EXP_SIZE))
return -EINVAL;
- addr = pci_dev_base(sbdf.seg, sbdf.bus, sbdf.devfn);
+ addr = pci_dev_base(sbdf);
if (!addr)
return -EINVAL;
next prev parent reply other threads:[~2026-09-09 7:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 21:57 [PATCH 0/3] x86: Fixes for not-quite-XSA in pci_conf_write_intercept() Andrew Cooper
2026-09-08 21:57 ` [PATCH 1/3] x86/pv: Convert struct mmio_ro_emulate_ctxt to use pci_sbdf_t Andrew Cooper
2026-09-08 21:57 ` [PATCH 2/3] x86/pci: Convert pci_mmcfg_{read,write}() " Andrew Cooper
2026-09-08 21:57 ` [PATCH 3/3] x86/pci: Update pci_conf_write_intercept() " Andrew Cooper
2026-09-09 6:39 ` [PATCH 0/3] x86: Fixes for not-quite-XSA in pci_conf_write_intercept() Jan Beulich
2026-09-09 8:59 ` Andrew Cooper
2026-09-09 7:16 ` Jan Beulich [this message]
2026-09-09 7:22 ` [PATCH 4/3] x86/PCI: use pci_sbdf_t also for pci_dev_base() Roger Pau Monné
2026-09-09 8:26 ` Teddy Astie
2026-09-09 9:59 ` Andrew Cooper
2026-09-09 8:26 ` [PATCH 0/3] x86: Fixes for not-quite-XSA in pci_conf_write_intercept() Teddy Astie
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=f2ed324f-3a52-42b1-8b26-b3ae53ab2ead@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger@xenproject.org \
--cc=teddy.astie@vates.tech \
--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.