mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
cxl/test: Add support for acpi extended linear cache
Add the mock wrappers for hmat_get_extended_linear_cache_size() in order to emulate the ACPI helper function for the regions that are mock'd by cxl_test. Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Tested-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Fabio M. De Francesco <fabio.m.de.francesco@linux.intel.com> Link: https://patch.msgid.link/20251117144611.903692-4-dave.jiang@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
This commit is contained in:
@@ -612,6 +612,25 @@ mock_acpi_evaluate_integer(acpi_handle handle, acpi_string pathname,
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
mock_hmat_get_extended_linear_cache_size(struct resource *backing_res,
|
||||
int nid, resource_size_t *cache_size)
|
||||
{
|
||||
struct acpi_cedt_cfmws *window = mock_cfmws[0];
|
||||
struct resource cfmws0_res =
|
||||
DEFINE_RES_MEM(window->base_hpa, window->window_size);
|
||||
|
||||
if (!extended_linear_cache ||
|
||||
!resource_contains(&cfmws0_res, backing_res)) {
|
||||
return hmat_get_extended_linear_cache_size(backing_res,
|
||||
nid, cache_size);
|
||||
}
|
||||
|
||||
*cache_size = mock_auto_region_size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pci_bus mock_pci_bus[NR_BRIDGES];
|
||||
static struct acpi_pci_root mock_pci_root[ARRAY_SIZE(mock_pci_bus)] = {
|
||||
[0] = {
|
||||
@@ -1140,6 +1159,8 @@ static struct cxl_mock_ops cxl_mock_ops = {
|
||||
.devm_cxl_port_enumerate_dports = mock_cxl_port_enumerate_dports,
|
||||
.cxl_endpoint_parse_cdat = mock_cxl_endpoint_parse_cdat,
|
||||
.devm_cxl_add_dport_by_dev = mock_cxl_add_dport_by_dev,
|
||||
.hmat_get_extended_linear_cache_size =
|
||||
mock_hmat_get_extended_linear_cache_size,
|
||||
.list = LIST_HEAD_INIT(cxl_mock_ops.list),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user