Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Shrihari E S <shrihari.s@samsung.com>
Cc: linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org,
	qemu-devel@nongnu.org, cpgs@samsung.com, arun.george@samsung.com,
	vikash.k5@samsung.com, s.neeraj@samsung.com,
	dongjoo.seo1@samsung.com, dave@stgolabs.net,
	gost.dev@samsung.com
Subject: Re: [RFC 3/8] hw/pci: Add SVC capability and UIO properties to PCIe ports
Date: Tue, 16 Jun 2026 18:20:29 +0100	[thread overview]
Message-ID: <20260616182029.3dc0af33@jic23-huawei> (raw)
In-Reply-To: <20260609105836.3702787-4-shrihari.s@samsung.com>

On Tue,  9 Jun 2026 16:28:31 +0530
Shrihari E S <shrihari.s@samsung.com> wrote:

> From: Dongjoo Seo <dongjoo.seo1@samsung.com>
> 
> Implement the Streamlined Virtual Channel (SVC) extended capability
> for PCIe ports (Root, Upstream, and Downstream). This capability is
> mandatory for enabling Unordered IO (UIO) traffic as per PCIe 6.4
> specification [1].
> 
> UIO functionality depends on two key prerequisites:
>   1. SVC support (SVC3 mandatory, SVC4 optional)
>   2. 256-byte Flit mode support
> 
> This patch adds the following experimental properties to PCIe ports:
>   - x-uio-svc: Enable UIO traffic via SVC3 (mandatory path)
>   - x-uio-svc-opt: Enable UIO traffic via SVC4 (optional path)

That doesn't feel like naming that will stand the test of time.
I think it needs to mention svc4 in the name.  Or I suppose we could
do something with a single x-uio-svc parameter taking values.


>   - x-256b-flit: Enable 256B flit mode required for UIO
> 
> Helper functions are included to manage UIO traffic gating and SVC
> configuration. This change lays the groundwork for UIO emulation in
> QEMU.
> 
> [1]: PCIe 6.4 Specification, Table 2-46 (Streamlined Virtual Channel)

I'm currently out of the loop for PCIe specs. So if someone else could
review against spec that would be great.

> 
> Signed-off-by: Dongjoo Seo <dongjoo.seo1@samsung.com>
> Signed-off-by: Shrihari E S <shrihari.s@samsung.com>
> ---
>  hw/pci-bridge/pcie_root_port.c     |  2 ++
>  hw/pci-bridge/xio3130_downstream.c |  3 +++
>  hw/pci-bridge/xio3130_upstream.c   |  8 ++++++++
>  include/hw/pci/pcie_port.h         | 21 +++++++++++++++++++++
>  4 files changed, 34 insertions(+)
> 
> diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c
> index eeee24e042..20554bd854 100644
> --- a/hw/pci-bridge/pcie_root_port.c
> +++ b/hw/pci-bridge/pcie_root_port.c
> @@ -153,6 +153,8 @@ static const Property rp_props[] = {
>                      QEMU_PCIE_SLTCAP_PCP_BITNR, true),
>      DEFINE_PROP_BOOL("disable-acs", PCIESlot, disable_acs, false),
>      DEFINE_PROP_BOOL("x-256b-flit", PCIEPort, flitmode, true),
> +    DEFINE_PROP_BIT("x-uio-svc", PCIEPort, svc, UIO_MANDATORY_SVC, false),
> +    DEFINE_PROP_BIT("x-uio-svc-opt", PCIEPort, svc, UIO_OPTIONAL_SVC, false),
>  };
>  
>  static void rp_instance_post_init(Object *obj)
> diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_downstream.c
> index 0c3fed3053..b0b297bb53 100644
> --- a/hw/pci-bridge/xio3130_downstream.c
> +++ b/hw/pci-bridge/xio3130_downstream.c
> @@ -137,6 +137,9 @@ static void xio3130_downstream_exitfn(PCIDevice *d)
>  static const Property xio3130_downstream_props[] = {
>      DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present,
>                      QEMU_PCIE_SLTCAP_PCP_BITNR, true),
> +    DEFINE_PROP_BIT("x-uio-svc", PCIEPort, svc, UIO_MANDATORY_SVC, false),
> +    DEFINE_PROP_BIT("x-uio-svc-opt", PCIEPort, svc, UIO_OPTIONAL_SVC, false),
> +    DEFINE_PROP_BOOL("x-256b-flit", PCIEPort, flitmode, false),
>  };
>  
>  static const VMStateDescription vmstate_xio3130_downstream = {
> diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c
> index 40057b749b..925df5add3 100644
> --- a/hw/pci-bridge/xio3130_upstream.c
> +++ b/hw/pci-bridge/xio3130_upstream.c
> @@ -24,6 +24,7 @@
>  #include "hw/pci/msi.h"
>  #include "hw/pci/pcie.h"
>  #include "hw/pci/pcie_port.h"
> +#include "hw/core/qdev-properties.h"
>  #include "migration/vmstate.h"
>  #include "qemu/module.h"
>  
> @@ -123,6 +124,12 @@ static const VMStateDescription vmstate_xio3130_upstream = {
>      }
>  };
>  
> +static const Property xio3130_upstream_props[] = {
> +    DEFINE_PROP_BIT("x-uio-svc", PCIEPort, svc, UIO_MANDATORY_SVC, false),
> +    DEFINE_PROP_BIT("x-uio-svc-opt", PCIEPort, svc, UIO_OPTIONAL_SVC, false),
> +    DEFINE_PROP_BOOL("x-256b-flit", PCIEPort, flitmode, false),
> +};
> +
>  static void xio3130_upstream_class_init(ObjectClass *klass, const void *data)
>  {
>      DeviceClass *dc = DEVICE_CLASS(klass);
> @@ -138,6 +145,7 @@ static void xio3130_upstream_class_init(ObjectClass *klass, const void *data)
>      dc->desc = "TI X3130 Upstream Port of PCI Express Switch";
>      device_class_set_legacy_reset(dc, xio3130_upstream_reset);
>      dc->vmsd = &vmstate_xio3130_upstream;
> +    device_class_set_props(dc, xio3130_upstream_props);
>  }
>  
>  static const TypeInfo xio3130_upstream_info = {
> diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h
> index 1bcc734649..a6b1b8a6cf 100644
> --- a/include/hw/pci/pcie_port.h
> +++ b/include/hw/pci/pcie_port.h
> @@ -37,8 +37,29 @@ struct PCIEPort {
>  
>      /* pci express switch port */
>      uint8_t     port;
> +
> +    /*
> +     * This field declares Streamlined Virtual Channel (SVC) capability.
> +     * Per PCIe 6.4 specification section 7.9.29, a pcie port supports
> +     * upto 8 SVCs, in that SVC0 is a default one, SVC3 is for UIO traffic
> +     * and SVC 4 is shared by both UIO and non-UIO traffic.

What actually goes in there?  Is this literally the SVC capability content?

> +     */
> +    uint32_t    svc;
>  };
>  
> +#define UIO_MANDATORY_SVC 3
> +#define UIO_OPTIONAL_SVC 4
> +
> +static inline bool get_uio_mandatory_svc(PCIEPort *port)
> +{
> +    return (port->svc >> UIO_MANDATORY_SVC) & 1;

Could just define the field mask given I don't think you ever care about them
being the numeric values themselves. If you need the value defines later, then
fair enough.

If you do switch to defining fields.
	return port->svc & UIO_MANDATORY_SVC;
and rely on boolean cast from non 0 to be true.

Also, do we want to route those two defines through the kernel uapi/linux/pci_regs.h
and then just make use of them in QEMU?

I kind of assume you have some kernel patches as well as this qemu support so
it would form part of that?

> +}
> +
> +static inline bool get_uio_optional_svc(PCIEPort *port)
> +{
> +    return (port->svc >> UIO_OPTIONAL_SVC) & 1;
> +}
> +
>  void pcie_port_init_reg(PCIDevice *d);
>  
>  PCIDevice *pcie_find_port_by_pn(PCIBus *bus, uint8_t pn);


  reply	other threads:[~2026-06-16 17:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260609104453epcas5p327a974e978790e693c0660f27f9b43ef@epcas5p3.samsung.com>
2026-06-09 10:58 ` [RFC 0/8] pci: cxl: Add enumeration support for Unordered I/O (UIO) feature Shrihari E S
2026-06-09 10:58   ` [RFC 1/8] hw/pci: Refactor flitmode from PCIESlot to PCIEPort Shrihari E S
2026-06-16 13:27     ` Jonathan Cameron
2026-06-24 14:01       ` Shrihari E S
2026-06-09 10:58   ` [RFC 2/8] hw/pci: Move 'x-256b-flit' property from cxl_root_port to pcie_root_port Shrihari E S
2026-06-09 10:58   ` [RFC 3/8] hw/pci: Add SVC capability and UIO properties to PCIe ports Shrihari E S
2026-06-16 17:20     ` Jonathan Cameron [this message]
2026-06-24 14:18       ` Shrihari E S
2026-06-09 10:58   ` [RFC 4/8] hw/cxl: Add Streamlined Virtual Channel (SVC) property to CXL ports Shrihari E S
2026-06-16 17:21     ` Jonathan Cameron
2026-06-24 14:21       ` Shrihari E S
2026-06-09 10:58   ` [RFC 5/8] hw/cxl: Wire UIO capability into HDM decoder registers Shrihari E S
2026-06-16 17:40     ` Jonathan Cameron
2026-06-24 14:47       ` Shrihari E S
2026-06-17 15:45     ` Junjie Cao
2026-06-24 15:04       ` Shrihari E S
2026-06-09 10:58   ` [RFC 6/8] hw/pci: Add PCIe Streamlined Virtual Channel (SVC) capability Shrihari E S
2026-06-16 18:46     ` Jonathan Cameron
2026-06-24 15:00       ` Shrihari E S
2026-06-17 15:45     ` Junjie Cao
2026-06-24 15:09       ` Shrihari E S
2026-06-09 10:58   ` [RFC 7/8] hw/pci: hw/cxl: Wire SVC initialization into port realize functions Shrihari E S
2026-06-17 15:45     ` Junjie Cao
2026-06-24 15:18       ` Shrihari E S
2026-06-09 10:58   ` [RFC 8/8] cxl: Add documentation for UIO-enabled CXL devices Shrihari E S

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=20260616182029.3dc0af33@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=arun.george@samsung.com \
    --cc=cpgs@samsung.com \
    --cc=dave@stgolabs.net \
    --cc=dongjoo.seo1@samsung.com \
    --cc=gost.dev@samsung.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=s.neeraj@samsung.com \
    --cc=shrihari.s@samsung.com \
    --cc=vikash.k5@samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox