tests/qapi-schema: Tidy up pylint warnings and advice
[qemu/armbru.git] / include / hw / cxl / cxl.h
blob75e47b6864414f7149a272201d3a3868eaa97af3
1 /*
2 * QEMU CXL Support
4 * Copyright (c) 2020 Intel
6 * This work is licensed under the terms of the GNU GPL, version 2. See the
7 * COPYING file in the top-level directory.
8 */
10 #ifndef CXL_H
11 #define CXL_H
14 #include "qapi/qapi-types-machine.h"
15 #include "qapi/qapi-visit-machine.h"
16 #include "hw/pci/pci_host.h"
17 #include "cxl_pci.h"
18 #include "cxl_component.h"
19 #include "cxl_device.h"
21 #define CXL_CACHE_LINE_SIZE 64
22 #define CXL_COMPONENT_REG_BAR_IDX 0
23 #define CXL_DEVICE_REG_BAR_IDX 2
25 #define CXL_WINDOW_MAX 10
27 typedef struct PXBCXLDev PXBCXLDev;
29 typedef struct CXLFixedWindow {
30 uint64_t size;
31 char **targets;
32 PXBCXLDev *target_hbs[16];
33 uint8_t num_targets;
34 uint8_t enc_int_ways;
35 uint8_t enc_int_gran;
36 /* Todo: XOR based interleaving */
37 MemoryRegion mr;
38 hwaddr base;
39 } CXLFixedWindow;
41 typedef struct CXLState {
42 bool is_enabled;
43 MemoryRegion host_mr;
44 unsigned int next_mr_idx;
45 GList *fixed_windows;
46 CXLFixedMemoryWindowOptionsList *cfmw_list;
47 } CXLState;
49 struct CXLHost {
50 PCIHostState parent_obj;
52 CXLComponentState cxl_cstate;
53 bool passthrough;
56 #define TYPE_PXB_CXL_HOST "pxb-cxl-host"
57 OBJECT_DECLARE_SIMPLE_TYPE(CXLHost, PXB_CXL_HOST)
59 #define TYPE_CXL_USP "cxl-upstream"
61 typedef struct CXLUpstreamPort CXLUpstreamPort;
62 DECLARE_INSTANCE_CHECKER(CXLUpstreamPort, CXL_USP, TYPE_CXL_USP)
63 CXLComponentState *cxl_usp_to_cstate(CXLUpstreamPort *usp);
65 #define TYPE_CXL_DSP "cxl-downstream"
67 typedef struct CXLDownstreamPort CXLDownstreamPort;
68 DECLARE_INSTANCE_CHECKER(CXLDownstreamPort, CXL_DSP, TYPE_CXL_DSP)
70 #endif