CXL/cxl_component: Add cxl_get_hb_cstate()

Accessor to get hold of the cxl state for a CXL host bridge
without exposing the internals of the implementation.

Signed-off-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220429144110.25167-32-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Jonathan Cameron 2022-04-29 15:40:56 +01:00 committed by Michael S. Tsirkin
parent aa970ed586
commit 0b4aec2469
2 changed files with 9 additions and 0 deletions

View File

@ -72,6 +72,13 @@ static GList *pxb_dev_list;
#define TYPE_PXB_HOST "pxb-host" #define TYPE_PXB_HOST "pxb-host"
CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb)
{
CXLHost *host = PXB_CXL_HOST(hb);
return &host->cxl_cstate;
}
static int pxb_bus_num(PCIBus *bus) static int pxb_bus_num(PCIBus *bus)
{ {
PXBDev *pxb = convert_to_pxb(bus->parent_dev); PXBDev *pxb = convert_to_pxb(bus->parent_dev);

View File

@ -218,4 +218,6 @@ static inline hwaddr cxl_decode_ig(int ig)
return 1 << (ig + 8); return 1 << (ig + 8);
} }
CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb);
#endif #endif