
* Update to QEMU v9.0.0 --------- Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Signed-off-by: Ido Plat <ido.plat@ibm.com> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: David Hildenbrand <david@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com> Signed-off-by: Gregory Price <gregory.price@memverge.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Lorenz Brun <lorenz@brun.one> Signed-off-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> Signed-off-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Sven Schnelle <svens@stackframe.org> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com> Signed-off-by: Avihai Horon <avihaih@nvidia.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Joonas Kankaala <joonas.a.kankaala@gmail.com> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Glenn Miles <milesg@linux.ibm.com> Signed-off-by: Oleg Sviridov <oleg.sviridov@red-soft.ru> Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Signed-off-by: Yajun Wu <yajunw@nvidia.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Pierre-Clément Tosi <ptosi@google.com> Signed-off-by: Lei Wang <lei4.wang@intel.com> Signed-off-by: Wei Wang <wei.w.wang@intel.com> Signed-off-by: Martin Hundebøll <martin@geanix.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Signed-off-by: Wafer <wafer@jaguarmicro.com> Signed-off-by: Yuxue Liu <yuxue.liu@jaguarmicro.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com> Signed-off-by: Zack Buhman <zack@buhman.org> Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Yuquan Wang wangyuquan1236@phytium.com.cn Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Signed-off-by: Cindy Lu <lulu@redhat.com> Co-authored-by: Peter Maydell <peter.maydell@linaro.org> Co-authored-by: Fabiano Rosas <farosas@suse.de> Co-authored-by: Peter Xu <peterx@redhat.com> Co-authored-by: Thomas Huth <thuth@redhat.com> Co-authored-by: Cédric Le Goater <clg@redhat.com> Co-authored-by: Zheyu Ma <zheyuma97@gmail.com> Co-authored-by: Ido Plat <ido.plat@ibm.com> Co-authored-by: Ilya Leoshkevich <iii@linux.ibm.com> Co-authored-by: Markus Armbruster <armbru@redhat.com> Co-authored-by: Marc-André Lureau <marcandre.lureau@redhat.com> Co-authored-by: Paolo Bonzini <pbonzini@redhat.com> Co-authored-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Co-authored-by: David Hildenbrand <david@redhat.com> Co-authored-by: Kevin Wolf <kwolf@redhat.com> Co-authored-by: Stefan Reiter <s.reiter@proxmox.com> Co-authored-by: Fiona Ebner <f.ebner@proxmox.com> Co-authored-by: Gregory Price <gregory.price@memverge.com> Co-authored-by: Lorenz Brun <lorenz@brun.one> Co-authored-by: Yao Xingtao <yaoxt.fnst@fujitsu.com> Co-authored-by: Philippe Mathieu-Daudé <philmd@linaro.org> Co-authored-by: Arnaud Minier <arnaud.minier@telecom-paris.fr> Co-authored-by: BALATON Zoltan <balaton@eik.bme.hu> Co-authored-by: Igor Mammedov <imammedo@redhat.com> Co-authored-by: Akihiko Odaki <akihiko.odaki@daynix.com> Co-authored-by: Richard Henderson <richard.henderson@linaro.org> Co-authored-by: Sven Schnelle <svens@stackframe.org> Co-authored-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Co-authored-by: Helge Deller <deller@kernel.org> Co-authored-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Co-authored-by: Benjamin Gray <bgray@linux.ibm.com> Co-authored-by: Nicholas Piggin <npiggin@gmail.com> Co-authored-by: Avihai Horon <avihaih@nvidia.com> Co-authored-by: Michael Tokarev <mjt@tls.msk.ru> Co-authored-by: Joonas Kankaala <joonas.a.kankaala@gmail.com> Co-authored-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Co-authored-by: Stefan Weil <sw@weilnetz.de> Co-authored-by: Dayu Liu <liu.dayu@zte.com.cn> Co-authored-by: Zhao Liu <zhao1.liu@intel.com> Co-authored-by: Glenn Miles <milesg@linux.vnet.ibm.com> Co-authored-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Co-authored-by: Yajun Wu <yajunw@nvidia.com> Co-authored-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Co-authored-by: Pierre-Clément Tosi <ptosi@google.com> Co-authored-by: Wei Wang <wei.w.wang@intel.com> Co-authored-by: Martin Hundebøll <martin@geanix.com> Co-authored-by: Michael S. Tsirkin <mst@redhat.com> Co-authored-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Co-authored-by: Wafer <wafer@jaguarmicro.com> Co-authored-by: lyx634449800 <yuxue.liu@jaguarmicro.com> Co-authored-by: Gerd Hoffmann <kraxel@redhat.com> Co-authored-by: Nguyen Dinh Phi <phind.uet@gmail.com> Co-authored-by: Zack Buhman <zack@buhman.org> Co-authored-by: Keith Packard <keithp@keithp.com> Co-authored-by: Yuquan Wang <wangyuquan1236@phytium.com.cn> Co-authored-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Co-authored-by: Cindy Lu <lulu@redhat.com>
195 lines
4.9 KiB
C
195 lines
4.9 KiB
C
/*
|
|
* QEMU CXL PCI interfaces
|
|
*
|
|
* Copyright (c) 2020 Intel
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See the
|
|
* COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef CXL_PCI_H
|
|
#define CXL_PCI_H
|
|
|
|
|
|
#define CXL_VENDOR_ID 0x1e98
|
|
|
|
#define PCIE_DVSEC_HEADER1_OFFSET 0x4 /* Offset from start of extend cap */
|
|
#define PCIE_DVSEC_ID_OFFSET 0x8
|
|
|
|
#define PCIE_CXL_DEVICE_DVSEC_LENGTH 0x3C
|
|
#define PCIE_CXL31_DEVICE_DVSEC_REVID 3
|
|
|
|
#define EXTENSIONS_PORT_DVSEC_LENGTH 0x28
|
|
#define EXTENSIONS_PORT_DVSEC_REVID 0
|
|
|
|
#define GPF_PORT_DVSEC_LENGTH 0x10
|
|
#define GPF_PORT_DVSEC_REVID 0
|
|
|
|
#define GPF_DEVICE_DVSEC_LENGTH 0x10
|
|
#define GPF_DEVICE_DVSEC_REVID 0
|
|
|
|
#define PCIE_CXL3_FLEXBUS_PORT_DVSEC_LENGTH 0x20
|
|
#define PCIE_CXL3_FLEXBUS_PORT_DVSEC_REVID 2
|
|
|
|
#define REG_LOC_DVSEC_LENGTH 0x24
|
|
#define REG_LOC_DVSEC_REVID 0
|
|
|
|
enum {
|
|
PCIE_CXL_DEVICE_DVSEC = 0,
|
|
NON_CXL_FUNCTION_MAP_DVSEC = 2,
|
|
EXTENSIONS_PORT_DVSEC = 3,
|
|
GPF_PORT_DVSEC = 4,
|
|
GPF_DEVICE_DVSEC = 5,
|
|
PCIE_FLEXBUS_PORT_DVSEC = 7,
|
|
REG_LOC_DVSEC = 8,
|
|
MLD_DVSEC = 9,
|
|
CXL20_MAX_DVSEC
|
|
};
|
|
|
|
typedef struct DVSECHeader {
|
|
uint32_t cap_hdr;
|
|
uint32_t dv_hdr1;
|
|
uint16_t dv_hdr2;
|
|
} QEMU_PACKED DVSECHeader;
|
|
QEMU_BUILD_BUG_ON(sizeof(DVSECHeader) != 10);
|
|
|
|
/*
|
|
* CXL r3.1 Table 8-2: CXL DVSEC ID Assignment
|
|
* Devices must implement certain DVSEC IDs, and can [optionally]
|
|
* implement others.
|
|
* (x) - IDs in Table 8-2.
|
|
*
|
|
* CXL RCD (D1): 0, [2], [5], 7, [8], A - Not emulated yet
|
|
* CXL RCD USP (UP1): 7, [8] - Not emulated yet
|
|
* CXL RCH DSP (DP1): 7, [8]
|
|
* CXL SLD (D2): 0, [2], 5, 7, 8, [A]
|
|
* CXL LD (LD): 0, [2], 5, 7, 8
|
|
* CXL RP (R): 3, 4, 7, 8
|
|
* CXL Switch USP (USP): [2], 7, 8
|
|
* CXL Switch DSP (DSP): 3, 4, 7, 8
|
|
* FM-Owned LD (FMLD): 0, [2], 7, 8, 9
|
|
*/
|
|
|
|
/*
|
|
* CXL r3.1 Section 8.1.3: PCIe DVSEC for Devices
|
|
* DVSEC ID: 0, Revision: 3
|
|
*/
|
|
typedef struct CXLDVSECDevice {
|
|
DVSECHeader hdr;
|
|
uint16_t cap;
|
|
uint16_t ctrl;
|
|
uint16_t status;
|
|
uint16_t ctrl2;
|
|
uint16_t status2;
|
|
uint16_t lock;
|
|
uint16_t cap2;
|
|
uint32_t range1_size_hi;
|
|
uint32_t range1_size_lo;
|
|
uint32_t range1_base_hi;
|
|
uint32_t range1_base_lo;
|
|
uint32_t range2_size_hi;
|
|
uint32_t range2_size_lo;
|
|
uint32_t range2_base_hi;
|
|
uint32_t range2_base_lo;
|
|
uint16_t cap3;
|
|
uint16_t resv;
|
|
} QEMU_PACKED CXLDVSECDevice;
|
|
QEMU_BUILD_BUG_ON(sizeof(CXLDVSECDevice) != PCIE_CXL_DEVICE_DVSEC_LENGTH);
|
|
|
|
/*
|
|
* CXL r3.1 Section 8.1.5: CXL Extensions DVSEC for Ports
|
|
* DVSEC ID: 3, Revision: 0
|
|
*/
|
|
typedef struct CXLDVSECPortExt {
|
|
DVSECHeader hdr;
|
|
uint16_t status;
|
|
uint16_t control;
|
|
uint8_t alt_bus_base;
|
|
uint8_t alt_bus_limit;
|
|
uint16_t alt_memory_base;
|
|
uint16_t alt_memory_limit;
|
|
uint16_t alt_prefetch_base;
|
|
uint16_t alt_prefetch_limit;
|
|
uint32_t alt_prefetch_base_high;
|
|
uint32_t alt_prefetch_limit_high;
|
|
uint32_t rcrb_base;
|
|
uint32_t rcrb_base_high;
|
|
} CXLDVSECPortExt;
|
|
QEMU_BUILD_BUG_ON(sizeof(CXLDVSECPortExt) != 0x28);
|
|
|
|
#define PORT_CONTROL_OFFSET 0xc
|
|
#define PORT_CONTROL_UNMASK_SBR 1
|
|
#define PORT_CONTROL_ALT_MEMID_EN 4
|
|
|
|
/*
|
|
* CXL r3.1 Section 8.1.6: GPF DVSEC for CXL Port
|
|
* DVSEC ID: 4, Revision: 0
|
|
*/
|
|
typedef struct CXLDVSECPortGPF {
|
|
DVSECHeader hdr;
|
|
uint16_t rsvd;
|
|
uint16_t phase1_ctrl;
|
|
uint16_t phase2_ctrl;
|
|
} CXLDVSECPortGPF;
|
|
QEMU_BUILD_BUG_ON(sizeof(CXLDVSECPortGPF) != 0x10);
|
|
|
|
/*
|
|
* CXL r3.1 Section 8.1.7: GPF DVSEC for CXL Device
|
|
* DVSEC ID: 5, Revision 0
|
|
*/
|
|
typedef struct CXLDVSECDeviceGPF {
|
|
DVSECHeader hdr;
|
|
uint16_t phase2_duration;
|
|
uint32_t phase2_power;
|
|
} CXLDVSECDeviceGPF;
|
|
QEMU_BUILD_BUG_ON(sizeof(CXLDVSECDeviceGPF) != 0x10);
|
|
|
|
/*
|
|
* CXL r3.1 Section 8.1.8: PCIe DVSEC for Flex Bus Port
|
|
* CXL r3.1 Section 8.2.1.3: Flex Bus Port DVSEC
|
|
* DVSEC ID: 7, Revision 2
|
|
*/
|
|
typedef struct CXLDVSECPortFlexBus {
|
|
DVSECHeader hdr;
|
|
uint16_t cap;
|
|
uint16_t ctrl;
|
|
uint16_t status;
|
|
uint32_t rcvd_mod_ts_data_phase1;
|
|
uint32_t cap2;
|
|
uint32_t ctrl2;
|
|
uint32_t status2;
|
|
} CXLDVSECPortFlexBus;
|
|
QEMU_BUILD_BUG_ON(sizeof(CXLDVSECPortFlexBus) != 0x20);
|
|
|
|
/*
|
|
* CXL r3.1 Section 8.1.9: Register Locator DVSEC
|
|
* DVSEC ID: 8, Revision 0
|
|
*/
|
|
typedef struct CXLDVSECRegisterLocator {
|
|
DVSECHeader hdr;
|
|
uint16_t rsvd;
|
|
uint32_t reg0_base_lo;
|
|
uint32_t reg0_base_hi;
|
|
uint32_t reg1_base_lo;
|
|
uint32_t reg1_base_hi;
|
|
uint32_t reg2_base_lo;
|
|
uint32_t reg2_base_hi;
|
|
} CXLDVSECRegisterLocator;
|
|
QEMU_BUILD_BUG_ON(sizeof(CXLDVSECRegisterLocator) != 0x24);
|
|
|
|
/* BAR Equivalence Indicator */
|
|
#define BEI_BAR_10H 0
|
|
#define BEI_BAR_14H 1
|
|
#define BEI_BAR_18H 2
|
|
#define BEI_BAR_1cH 3
|
|
#define BEI_BAR_20H 4
|
|
#define BEI_BAR_24H 5
|
|
|
|
/* Register Block Identifier */
|
|
#define RBI_EMPTY 0
|
|
#define RBI_COMPONENT_REG (1 << 8)
|
|
#define RBI_BAR_VIRT_ACL (2 << 8)
|
|
#define RBI_CXL_DEVICE_REG (3 << 8)
|
|
|
|
#endif
|