// SPDX-License-Identifier: GPL-2.0-only /* * IOMMU sysfs class support * * Copyright (C) 2014 Red Hat, Inc. All rights reserved. * Author: Alex Williamson <alex.williamson@redhat.com>
*/
/* * We provide a common class "devices" group which initially has no attributes. * As devices are added to the IOMMU, we'll add links to the group.
*/ staticstruct attribute *devices_attr[] = {
NULL,
};
/* * Init the struct device for the IOMMU. IOMMU specific attributes can * be provided as an attribute group, allowing a unique namespace per * IOMMU type.
*/ int iommu_device_sysfs_add(struct iommu_device *iommu, struct device *parent, conststruct attribute_group **groups, constchar *fmt, ...)
{
va_list vargs; int ret;
iommu->dev = kzalloc(sizeof(*iommu->dev), GFP_KERNEL); if (!iommu->dev) return -ENOMEM;
/* * IOMMU drivers can indicate a device is managed by a given IOMMU using * this interface. A link to the device will be created in the "devices" * directory of the IOMMU device in sysfs and an "iommu" link will be * created under the linked device, pointing back at the IOMMU device.
*/ int iommu_device_link(struct iommu_device *iommu, struct device *link)
{ int ret;
ret = sysfs_add_link_to_group(&iommu->dev->kobj, "devices",
&link->kobj, dev_name(link)); if (ret) return ret;
ret = sysfs_create_link_nowarn(&link->kobj, &iommu->dev->kobj, "iommu"); if (ret)
sysfs_remove_link_from_group(&iommu->dev->kobj, "devices",
dev_name(link));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.