Merge "Adding QAT devices support in sysinv"

This commit is contained in:
Zuul 2024-04-17 13:49:58 +00:00 committed by Gerrit Code Review
commit 5f4e3a3378
4 changed files with 56 additions and 4 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013-2023 Wind River Systems, Inc.
# Copyright (c) 2013-2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -39,7 +39,13 @@ KNOWN_PCI_DEVICES = [{"vendor_id": constants.NOVA_PCI_ALIAS_QAT_PF_VENDOR,
"device_id": constants.NOVA_PCI_ALIAS_QAT_C62X_PF_DEVICE,
"class_id": constants.NOVA_PCI_ALIAS_QAT_CLASS},
{"class_id": constants.NOVA_PCI_ALIAS_GPU_CLASS},
{"class_id": dconstants.PCI_DEVICE_CLASS_FPGA}]
{"class_id": dconstants.PCI_DEVICE_CLASS_FPGA},
{"vendor_id": constants.PCI_ALIAS_QAT_VENDOR,
"device_id": constants.PCI_ALIAS_QAT_4XXX_PF_DEVICE,
"class_id": constants.PCI_ALIAS_QAT_CLASS},
{"vendor_id": constants.PCI_ALIAS_QAT_VENDOR,
"device_id": constants.PCI_ALIAS_QAT_401XX_PF_DEVICE,
"class_id": constants.PCI_ALIAS_QAT_CLASS}]
# PCI-SIG 0x06 bridge devices to not inventory.
IGNORE_BRIDGE_PCI_CLASSES = ['bridge', 'isa bridge', 'host bridge']

View File

@ -1,4 +1,4 @@
# Copyright (c) 2015-2022 Wind River Systems, Inc.
# Copyright (c) 2015-2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -387,6 +387,23 @@ def _check_field(field):
def _check_device_sriov(device, host):
sriov_update = False
if (device['pdevice_id'] in constants.PCI_ALIAS_SRIOV_ENABLED_QAT_DEVICE_IDS):
LOG.debug("sriov enabled qat dev: %s" % device['pdevice_id'])
current_device = pecan.request.dbapi.pci_device_get(device['pciaddr'],
hostid=host['id'])
# Because of the limitations of the Intel qat_service code, only max number
# of VFs configuration is supported. Currently it is not allowed to modify
# the number of VFs and any other configuration using sysinv. Qat is already
# initialized with the max number of VFs at the time of bootstrap, so
# returning from here without doing any configuration.
msg = (_("QAT device is already initialized, "
"further modification not allowed. Details:- "
"devicename: {}, enabled status: {}, driver: {}, "
"VF driver: vfio, sriov numvfs: {}").format(
current_device['name'], current_device['enabled'],
current_device['driver'], current_device['sriov_numvfs']))
raise wsme.exc.ClientSideError(msg)
if (device['pdevice_id'] in dconstants.SRIOV_ENABLED_FEC_DEVICE_IDS and
host.invprovision not in [constants.UPGRADING, constants.PROVISIONED]):
raise wsme.exc.ClientSideError(_("Cannot configure device %s "

View File

@ -1050,6 +1050,12 @@ NOVA_PCI_ALIAS_QAT_C62X_VF_NAME = "qat-c62x-vf"
NOVA_PCI_ALIAS_QAT_VF_VENDOR = "8086"
NOVA_PCI_ALIAS_QAT_DH895XCC_VF_DEVICE = "0443"
NOVA_PCI_ALIAS_QAT_C62X_VF_DEVICE = "37c9"
PCI_ALIAS_QAT_CLASS = "0x0b4000"
PCI_ALIAS_QAT_VENDOR = "8086"
PCI_ALIAS_QAT_4XXX_PF_DEVICE = "4940"
PCI_ALIAS_QAT_401XX_PF_DEVICE = "4942"
PCI_ALIAS_SRIOV_ENABLED_QAT_DEVICE_IDS = [PCI_ALIAS_QAT_4XXX_PF_DEVICE,
PCI_ALIAS_QAT_401XX_PF_DEVICE]
NOVA_PCI_ALIAS_USER_NAME = "user"
# Service Parameter

View File

@ -2,7 +2,7 @@
# -*- encoding: utf-8 -*-
#
#
# Copyright (c) 2020-2022 Wind River Systems, Inc.
# Copyright (c) 2020-2024 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -606,3 +606,26 @@ class TestPatchDevice(TestDevice):
self.assertIn('The value for number of SR-IOV VFs must be > 0 when the '
'VF driver is igb_uio',
response.json['error_message'])
def test_device_modify_sriov_qat_reset_all(self):
self.pci_device = dbutils.create_test_pci_device(
host_id=self.worker.id,
pclass_id=self.pclass_id,
pdevice_id=constants.PCI_ALIAS_QAT_401XX_PF_DEVICE,
driver='4xxx',
sriov_vf_driver='vfio',
sriov_totalvfs=16,
sriov_numvfs=16)
response = self.patch_dict_json(
'%s' % self._get_path(self.pci_device['uuid']),
driver='none',
sriov_vf_driver='none',
sriov_numvfs=0,
expect_errors=True)
self.assertEqual(http_client.BAD_REQUEST, response.status_int)
self.assertEqual('application/json', response.content_type)
self.assertTrue(response.json['error_message'])
self.assertIn('QAT device is already initialized, further modification '
'not allowed. Details:- devicename: pci_0000_00_02_0 , '
'enabled status: True, driver: 4xxx, VF driver: vfio, '
'sriov numvfs: 16', response.json['error_message'])